diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..c888454a3c --- /dev/null +++ b/.gitattributes @@ -0,0 +1,99 @@ +# prevent git from changing line endings for conan recipes and CMake files, +# since they are hashed to produce a conan recipe revision ID +conanfile.py text eol=lf +CMakeLists.txt text eol=lf +*.cmake text eol=lf +*.in text eol=lf + +# Modern tools on Windows can handle Linux LF +# See https://stackoverflow.com/a/13154031/8877 for details +* text=auto eol=lf +*.* text=auto eol=lf +.git?* text=auto eol=lf + +# Leave known Windows-only text files as CR/LF +*.sln text eol=crlf +*.dsw text eol=crlf +*.dsp text eol=crlf +*.vcproj text eol=crlf +*.vcxproj text eol=crlf +*.vcxproj.filters text eol=crlf +*.ruleset text eol=crlf +*.bat text eol=crlf + +###################### +# Known binary files + +# Python builds with WAF +waf binary + +# executables, libraries; yes, sometimes they're part of a repository +*.exe binary +*.out binary +lib*.so* binary +*.dll binary +lib*.a* binary +*.lib binary +*.mex binary +*.pyc binary + +# from various unit_test/ directories +*.dat binary +*.*hdr binary +*.flat binary +*.sig binary +*.bin binary +*.dump binary + +# images +*.bmp binary +*.ico binary +*.tiff binary +*.tif binary +*.gif binary +*.jpg binary +*.jpeg binary +*.png binary +# SVG images are XML +*.svg text +*.raw binary +*.hei? binary +*.kmz binary + +# music +*.mp3 binary +*.m4a binary +*.wav binary +*.wma binary + +# video +*.m4v binary +*.avi binary +*.wmv binary +*.mkv binary + +# documents +*.pdf binary +*.dvi binary +*.doc binary +*.docx binary +*.xls binary +*.xlsx binary +*.ppt binary +*.pptx binary + +# SAR +*.h5 binary +*.sio binary +*.hdr binary +*.ntf binary +*.nitf binary +*.sidd binary +*.sicd? binary + +# containers +*.zip binary +*.gz binary +*.tar binary +*.tgz binary +*.jar binary diff --git a/.github/workflows/frequent_check.yml b/.github/workflows/frequent_check.yml index b69a59042f..a3ffa7618b 100644 --- a/.github/workflows/frequent_check.yml +++ b/.github/workflows/frequent_check.yml @@ -64,7 +64,7 @@ jobs: cmake --build . --config ${{ matrix.configuration }} -j cmake --build . --config ${{ matrix.configuration }} --target install - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1 # https://github.com/marketplace/actions/setup-msbuild + uses: microsoft/setup-msbuild@v1.0.2 # https://github.com/marketplace/actions/setup-msbuild with: msbuild-architecture: x64 - name: msbuild diff --git a/.gitignore b/.gitignore index 52ada7d53a..b8babd6f1a 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,7 @@ six/modules/**/Makefile *_config.hpp # ignore build directories ... build/ +out/ # ... but not coda-oss/build !/externals/coda-oss/build/ diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 64c5f815ba..6aadfa0da1 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -2,6 +2,24 @@ # SIX [Release](https://github.com/ngageoint/six-library/releases) Notes +## [Version 3.2.5](https://github.com/ngageoint/six-library/releases/tag/SIX-3.2.5); October 23, 2023 +* [coda-oss](https://github.com/mdaus/coda-oss) version [2023-10-23](https://github.com/mdaus/coda-oss/releases/tag/2023-10-23) +* [nitro](https://github.com/mdaus/nitro) version [2.11.5](https://github.com/mdaus/nitro/releases/tag/NITRO-2.11.5) +* Simplify 8AMP_PHSI interfaces. +* Be more explicit about the CPHD version being used. +* *io::OutputStream* overloads to make it easier to write CPHD data in pieces. +* Be sure XML strings are UTF-8. + +## [Version 3.2.4](https://github.com/ngageoint/six-library/releases/tag/SIX-3.2.4); August 21, 2023 +* [coda-oss](https://github.com/mdaus/coda-oss) version [2023-08-18](https://github.com/mdaus/coda-oss/releases/tag/2023-08-18) +* [nitro](https://github.com/mdaus/nitro) version [2.11.4](https://github.com/mdaus/nitro/releases/tag/NITRO-2.11.4) +* Prepare for deprecating [`std::complex`](https://en.cppreference.com/w/cpp/numeric/complex), et. al. +* Allow XML metadata to be parsed with `preserveCharacterData(true)` to keep white-space. +* Added support for [CPHD 1.1.0](https://nsgreg.nga.mil/doc/view?i=5388) XML metadata. +* Bugfix: read SIDDs [without a LUT](https://github.com/ngageoint/six-library/pull/683). +* Bugfix: [CPHD 'releaseInfo' can be empty](https://github.com/ngageoint/six-library/pull/670). +* Added **.gitattributes** and normalized line-endings (`\n` for most text files). + ## [Version 3.2.3](https://github.com/ngageoint/six-library/releases/tag/SIX-3.2.3); June 5, 2023 * [coda-oss](https://github.com/mdaus/coda-oss) version [2023-06-05](https://github.com/mdaus/coda-oss/releases/tag/2023-06-05) * [nitro](https://github.com/mdaus/nitro) version [2.11.3](https://github.com/mdaus/nitro/releases/tag/NITRO-2.11.3) diff --git a/UnitTest/CppUnitTestAssert.cpp b/UnitTest/CppUnitTestAssert.cpp index fdcf5f92b5..d2d76d169e 100644 --- a/UnitTest/CppUnitTestAssert.cpp +++ b/UnitTest/CppUnitTestAssert.cpp @@ -1,43 +1,41 @@ -#include "pch.h" -#include "TestCase.h" - -#include "str/EncodedStringView.h" - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -// EQUALS_MESSAGE() wants ToString() specializations (or overloads) for our types, which is a nusiance. -// This hooks up our existing str::toString() into the VC++ unit-test infrastructure - -// C++ hack to call private methods -// https://stackoverflow.com/a/71578383/8877 - -using FailOnCondition_t = void(bool condition, const unsigned short* message, const __LineInfo* pLineInfo); // declare method's type -using GetAssertMessage_t = std::wstring(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message); // declare method's type -template -struct caller final // helper structure to inject call() code -{ - friend void FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo) - { - fFailOnCondition(condition, message, pLineInfo); - } - - friend std::wstring GetAssertMessage(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message) - { - return fGetAssertMessage(equality, expected, actual, message); - } -}; -template struct caller<&Assert::FailOnCondition, &Assert::GetAssertMessage>; // even instantiation of the helper - -void FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo); // declare caller -void test::Assert::FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo) -{ - ::FailOnCondition(condition, message, pLineInfo); // and call! -} - -std::wstring GetAssertMessage(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message); // declare caller -std::wstring test::Assert::GetAssertMessage(bool equality, const std::string& expected, const std::string& actual, const wchar_t *message) -{ - const str::EncodedStringView vExpected(expected); - const str::EncodedStringView vActual(actual); - return ::GetAssertMessage(equality, vExpected.wstring(), vActual.wstring(), message); // and call! -} +#include "pch.h" +#include "TestCase.h" + +#include "str/Encoding.h" + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +// EQUALS_MESSAGE() wants ToString() specializations (or overloads) for our types, which is a nusiance. +// This hooks up our existing str::toString() into the VC++ unit-test infrastructure + +// C++ hack to call private methods +// https://stackoverflow.com/a/71578383/8877 + +using FailOnCondition_t = void(bool condition, const unsigned short* message, const __LineInfo* pLineInfo); // declare method's type +using GetAssertMessage_t = std::wstring(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message); // declare method's type +template +struct caller final // helper structure to inject call() code +{ + friend void FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo) + { + fFailOnCondition(condition, message, pLineInfo); + } + + friend std::wstring GetAssertMessage(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message) + { + return fGetAssertMessage(equality, expected, actual, message); + } +}; +template struct caller<&Assert::FailOnCondition, &Assert::GetAssertMessage>; // even instantiation of the helper + +void FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo); // declare caller +void test::Assert::FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo) +{ + ::FailOnCondition(condition, message, pLineInfo); // and call! +} + +std::wstring GetAssertMessage(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message); // declare caller +std::wstring test::Assert::GetAssertMessage(bool equality, const std::string& expected, const std::string& actual, const wchar_t *message) +{ + return ::GetAssertMessage(equality, str::details::to_wstring(expected), str::details::to_wstring(actual), message); // and call! +} diff --git a/UnitTest/Test.cpp b/UnitTest/Test.cpp index 1b5022b55b..288bc85ad2 100644 --- a/UnitTest/Test.cpp +++ b/UnitTest/Test.cpp @@ -1,96 +1,96 @@ -#include "pch.h" -#include "Test.h" - -#include - -#include - -namespace fs = std::filesystem; - -static bool is_x64_Configuration(const fs::path& path) // "Configuration" is typically "Debug" or "Release" -{ - const std::string build_configuration = -#if defined(NDEBUG) // i.e., release - "Release"; -#else - "Debug"; -#endif - - const auto Configuration = path.filename(); - const auto path_parent_path = path.parent_path(); - const auto x64 = path_parent_path.filename(); - return (Configuration == build_configuration) && (x64 == "x64"); -} - -static bool is_install_unittests(const fs::path& path) -{ - const auto unittests = path.filename(); - const auto path_parent_path = path.parent_path(); - const auto install = path_parent_path.filename(); - return (unittests == "unittests") && (install == "install"); -} -static bool is_install_tests(const fs::path& path) -{ - const auto tests = path.filename(); - const auto path_parent_path = path.parent_path(); - const auto install = path_parent_path.filename(); - return (tests == "tests") && (install == "install"); -} - -fs::path six::Test::buildSchemaDir() -{ - const auto cwd = fs::current_path(); - - const sys::OS os; - const auto exec = fs::path(os.getCurrentExecutable()); - const auto argv0 = exec.filename(); - if ((argv0 == "Test.exe") || (argv0 == "testhost.exe")) - { - // Running GTest unit-tests in Visual Studio on Windows - if (is_x64_Configuration(cwd)) - { - const auto root_path = cwd.parent_path().parent_path(); - return root_path / "six" / "modules" / "c++" / "six.sidd" / "conf" / "schema"; - } - } - - if (argv0 == "unittests.exe") - { - // stand-alone unittest executable on Windows (ends in .EXE) - const auto parent_path = exec.parent_path(); - if (is_x64_Configuration(parent_path)) - { - const auto parent_path_ = parent_path.parent_path().parent_path(); - return parent_path_ / "dev" / "tests" / "images"; - } - } - - // stand-alone unit-test on Linux - const auto exec_dir = exec.parent_path(); - if (is_install_unittests(exec_dir)) - { - const auto install = exec_dir.parent_path(); - return install / "unittests" / "data"; - } - if (is_install_tests(exec_dir)) - { - const auto install = exec_dir.parent_path(); - return install / "unittests" / "data"; - } - - if (argv0 == "unittests") - { - // stand-alone unittest executable on Linux - const auto bin = exec.parent_path(); - if (bin.filename() == "bin") - { - const auto unittests = bin.parent_path(); - return unittests / "unittests" / "data"; - } - } - - //fprintf(stderr, "cwd = %s\n", cwd.c_str()); - //fprintf(stderr, "exec = %s\n", exec.c_str()); - - return cwd; -} +#include "pch.h" +#include "Test.h" + +#include + +#include + +namespace fs = std::filesystem; + +static bool is_x64_Configuration(const fs::path& path) // "Configuration" is typically "Debug" or "Release" +{ + const std::string build_configuration = +#if defined(NDEBUG) // i.e., release + "Release"; +#else + "Debug"; +#endif + + const auto Configuration = path.filename(); + const auto path_parent_path = path.parent_path(); + const auto x64 = path_parent_path.filename(); + return (Configuration == build_configuration) && (x64 == "x64"); +} + +static bool is_install_unittests(const fs::path& path) +{ + const auto unittests = path.filename(); + const auto path_parent_path = path.parent_path(); + const auto install = path_parent_path.filename(); + return (unittests == "unittests") && (install == "install"); +} +static bool is_install_tests(const fs::path& path) +{ + const auto tests = path.filename(); + const auto path_parent_path = path.parent_path(); + const auto install = path_parent_path.filename(); + return (tests == "tests") && (install == "install"); +} + +fs::path six::Test::buildSchemaDir() +{ + const auto cwd = fs::current_path(); + + const sys::OS os; + const auto exec = fs::path(os.getCurrentExecutable()); + const auto argv0 = exec.filename(); + if ((argv0 == "Test.exe") || (argv0 == "testhost.exe")) + { + // Running GTest unit-tests in Visual Studio on Windows + if (is_x64_Configuration(cwd)) + { + const auto root_path = cwd.parent_path().parent_path(); + return root_path / "six" / "modules" / "c++" / "six.sidd" / "conf" / "schema"; + } + } + + if (argv0 == "unittests.exe") + { + // stand-alone unittest executable on Windows (ends in .EXE) + const auto parent_path = exec.parent_path(); + if (is_x64_Configuration(parent_path)) + { + const auto parent_path_ = parent_path.parent_path().parent_path(); + return parent_path_ / "dev" / "tests" / "images"; + } + } + + // stand-alone unit-test on Linux + const auto exec_dir = exec.parent_path(); + if (is_install_unittests(exec_dir)) + { + const auto install = exec_dir.parent_path(); + return install / "unittests" / "data"; + } + if (is_install_tests(exec_dir)) + { + const auto install = exec_dir.parent_path(); + return install / "unittests" / "data"; + } + + if (argv0 == "unittests") + { + // stand-alone unittest executable on Linux + const auto bin = exec.parent_path(); + if (bin.filename() == "bin") + { + const auto unittests = bin.parent_path(); + return unittests / "unittests" / "data"; + } + } + + //fprintf(stderr, "cwd = %s\n", cwd.c_str()); + //fprintf(stderr, "exec = %s\n", exec.c_str()); + + return cwd; +} diff --git a/UnitTest/Test.h b/UnitTest/Test.h index 232a94cf1b..057b8d5209 100644 --- a/UnitTest/Test.h +++ b/UnitTest/Test.h @@ -1,11 +1,11 @@ -#pragma once - -#include - -namespace six -{ - namespace Test - { - extern std::filesystem::path buildSchemaDir(); - } +#pragma once + +#include + +namespace six +{ + namespace Test + { + extern std::filesystem::path buildSchemaDir(); + } } \ No newline at end of file diff --git a/UnitTest/TestCase.h b/UnitTest/TestCase.h index 70666e5fce..225afd7bda 100644 --- a/UnitTest/TestCase.h +++ b/UnitTest/TestCase.h @@ -5,7 +5,7 @@ #include "CppUnitTest.h" #include -#include +#include #undef TEST_CHECK #undef TEST_ASSERT @@ -89,7 +89,7 @@ inline void assert_almost_eq(const std::string& testName, long double X1, long d #define TEST_ASSERT_EQ_MSG(msg, X1, X2) testName, Microsoft::VisualStudio::CppUnitTestFramework::Logger::WriteMessage(msg.c_str()); TEST_ASSERT_EQ(X1, X2) #undef TEST_FAIL -#define TEST_FAIL(msg) { (void)testName; const str::EncodedStringView vw(msg); Microsoft::VisualStudio::CppUnitTestFramework::Assert::Fail(vw.wstring().c_str()); } +#define TEST_FAIL(msg) { (void)testName; const auto vw(str::details::to_wstring(msg)); Microsoft::VisualStudio::CppUnitTestFramework::Assert::Fail(vw.c_str()); } #undef TEST_EXCEPTION #undef TEST_THROWS diff --git a/UnitTest/UnitTest.vcxproj b/UnitTest/UnitTest.vcxproj index a982b81e2c..d98ea5b10e 100644 --- a/UnitTest/UnitTest.vcxproj +++ b/UnitTest/UnitTest.vcxproj @@ -1,316 +1,316 @@ - - - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {F6888896-E658-414C-90CD-1208FA31A22E} - Win32Proj - UnitTest - 10.0 - NativeUnitTestProject - - - - DynamicLibrary - true - v143 - Unicode - false - - - DynamicLibrary - false - v143 - true - Unicode - false - - - - - - - - - - - - - - - true - - - false - - - - Use - Level3 - true - $(SolutionDir);$(SolutionDir)six\modules\c++\scene\include;$(SolutionDir)six\modules\c++\six\include;$(SolutionDir)six\modules\c++\six.sidd\include;$(SolutionDir)six\modules\c++\six.sicd\include;$(SolutionDir)six\modules\c++\cphd\include;$(SolutionDir)six\modules\c++\cphd03\include;$(SolutionDir)externals\nitro\modules\c\nrt\include;$(SolutionDir)externals\nitro\modules\c\nitf\include;$(SolutionDir)externals\nitro\modules\c++\nitf\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration);$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration);$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - _DEBUG;SIX_DEFAULT_SCHEMA_PATH=R"($(SolutionDir)install-$(Configuration)-$(Platform).$(PlatformToolset)\conf\schema\six)";%(PreprocessorDefinitions);_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING - true - pch.h - true - AdvancedVectorExtensions2 - true - MultiThreadedDebugDLL - true - true - true - - - Windows - $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - - - Use - Level3 - true - true - true - $(SolutionDir);$(SolutionDir)six\modules\c++\scene\include;$(SolutionDir)six\modules\c++\six\include;$(SolutionDir)six\modules\c++\six.sidd\include;$(SolutionDir)six\modules\c++\six.sicd\include;$(SolutionDir)six\modules\c++\cphd\include;$(SolutionDir)six\modules\c++\cphd03\include;$(SolutionDir)externals\nitro\modules\c\nrt\include;$(SolutionDir)externals\nitro\modules\c\nitf\include;$(SolutionDir)externals\nitro\modules\c++\nitf\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration);$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration);$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - NDEBUG;%(PreprocessorDefinitions);_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING - true - pch.h - true - AdvancedVectorExtensions2 - true - true - true - - - Windows - true - true - $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - {016ef417-e41c-404c-b3b5-34b6cdd94bb3} - - - {01be4480-9620-4ded-b34f-d2e3ab4b7c8b} - - - {34ac2314-fbd1-42ad-aaf4-0cebc6bf737e} - - - {ddc587c2-53ba-44a9-94e7-07be52af3d0b} - - - {62aad4dd-35ba-41a0-8263-1f4dfd755689} - - - - - - - - - + + + + + Debug + x64 + + + Release + x64 + + + + 17.0 + {F6888896-E658-414C-90CD-1208FA31A22E} + Win32Proj + UnitTest + 10.0 + NativeUnitTestProject + + + + DynamicLibrary + true + v143 + Unicode + false + + + DynamicLibrary + false + v143 + true + Unicode + false + + + + + + + + + + + + + + + true + + + false + + + + Use + Level3 + true + $(SolutionDir);$(SolutionDir)six\modules\c++\scene\include;$(SolutionDir)six\modules\c++\six\include;$(SolutionDir)six\modules\c++\six.sidd\include;$(SolutionDir)six\modules\c++\six.sicd\include;$(SolutionDir)six\modules\c++\cphd\include;$(SolutionDir)six\modules\c++\cphd03\include;$(SolutionDir)externals\nitro\modules\c\nrt\include;$(SolutionDir)externals\nitro\modules\c\nitf\include;$(SolutionDir)externals\nitro\modules\c++\nitf\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration);$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration);$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + _DEBUG;SIX_DEFAULT_SCHEMA_PATH=R"($(SolutionDir)install-$(Configuration)-$(Platform).$(PlatformToolset)\conf\schema\six)";%(PreprocessorDefinitions);_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING + true + pch.h + true + AdvancedVectorExtensions2 + true + MultiThreadedDebugDLL + true + true + true + + + Windows + $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Use + Level3 + true + true + true + $(SolutionDir);$(SolutionDir)six\modules\c++\scene\include;$(SolutionDir)six\modules\c++\six\include;$(SolutionDir)six\modules\c++\six.sidd\include;$(SolutionDir)six\modules\c++\six.sicd\include;$(SolutionDir)six\modules\c++\cphd\include;$(SolutionDir)six\modules\c++\cphd03\include;$(SolutionDir)externals\nitro\modules\c\nrt\include;$(SolutionDir)externals\nitro\modules\c\nitf\include;$(SolutionDir)externals\nitro\modules\c++\nitf\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration);$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration);$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions);_SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING + true + pch.h + true + AdvancedVectorExtensions2 + true + true + true + + + Windows + true + true + $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + Create + Create + + + + + + + + + + + + + + + + + + + {016ef417-e41c-404c-b3b5-34b6cdd94bb3} + + + {01be4480-9620-4ded-b34f-d2e3ab4b7c8b} + + + {34ac2314-fbd1-42ad-aaf4-0cebc6bf737e} + + + {ddc587c2-53ba-44a9-94e7-07be52af3d0b} + + + {62aad4dd-35ba-41a0-8263-1f4dfd755689} + + + + + + + + + \ No newline at end of file diff --git a/UnitTest/UnitTest.vcxproj.filters b/UnitTest/UnitTest.vcxproj.filters index 924b309cfc..440a0297ed 100644 --- a/UnitTest/UnitTest.vcxproj.filters +++ b/UnitTest/UnitTest.vcxproj.filters @@ -1,194 +1,194 @@ - - - - - - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd - - - cphd03 - - - cphd03 - - - cphd03 - - - cphd03 - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sicd - - - sidd - - - sidd - - - sidd - - - sidd - - - sidd - - - sidd - - - six - - - six - - - six - - - six - - - six - - - - - - - - cphd - - - cphd03 - - - sicd - - - sidd - - - six - - - - - {004a37ca-2175-4642-988e-94516ea1a147} - - - {ef494548-4aed-4ebb-a93c-b56a11f17f5e} - - - {593807ae-bc84-424f-ba11-0537277cd2fc} - - - {f8053c57-ba04-41c4-8dd8-2056f5a19f25} - - - {8d8a73fb-96b1-4bdf-a055-2b34d7f94e14} - - - - - sidd - - - sidd - - + + + + + + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd + + + cphd03 + + + cphd03 + + + cphd03 + + + cphd03 + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sicd + + + sidd + + + sidd + + + sidd + + + sidd + + + sidd + + + sidd + + + six + + + six + + + six + + + six + + + six + + + + + + + + cphd + + + cphd03 + + + sicd + + + sidd + + + six + + + + + {004a37ca-2175-4642-988e-94516ea1a147} + + + {ef494548-4aed-4ebb-a93c-b56a11f17f5e} + + + {593807ae-bc84-424f-ba11-0537277cd2fc} + + + {f8053c57-ba04-41c4-8dd8-2056f5a19f25} + + + {8d8a73fb-96b1-4bdf-a055-2b34d7f94e14} + + + + + sidd + + + sidd + + \ No newline at end of file diff --git a/UnitTest/pch.h b/UnitTest/pch.h index 2cb2d03796..0925dea43a 100644 --- a/UnitTest/pch.h +++ b/UnitTest/pch.h @@ -32,6 +32,7 @@ #pragma warning(disable: 5219) // implicit conversion from '...' to '...', possible loss of data #pragma warning(disable: 4514) // '...': unreferenced inline function has been removed #pragma warning(disable: 5039) // '...' : pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor // TODO: get rid of these someday? ... from Visual Studio code-analysis #pragma warning(disable: 26495) // Variable '...' is uninitialized. Always initialize a member variable(type.6). @@ -63,7 +64,6 @@ #include #pragma warning(pop) #include -#include #include #include #include diff --git a/UnitTest/sicd.cpp b/UnitTest/sicd.cpp index 6a141b7e12..e0b11986bd 100644 --- a/UnitTest/sicd.cpp +++ b/UnitTest/sicd.cpp @@ -79,4 +79,8 @@ TEST_CLASS(test_valid_six) { public: #include "six/modules/c++/six.sicd/unittests/test_valid_six.cpp" }; -} \ No newline at end of file +TEST_CLASS(test_valid_sixsicd) { public: +#include "six/modules/c++/six.sicd/unittests/test_valid_sixsicd.cpp" +}; + +} diff --git a/docs/NGA.STND.0068-1_1.1.0_CPHD_DIDD_FINAL.pdf b/docs/NGA.STND.0068-1_1.1.0_CPHD_DIDD_FINAL.pdf new file mode 100644 index 0000000000..b68b1c4c9d Binary files /dev/null and b/docs/NGA.STND.0068-1_1.1.0_CPHD_DIDD_FINAL.pdf differ diff --git a/externals/coda-oss/.gitattributes b/externals/coda-oss/.gitattributes index 11cea51085..c888454a3c 100644 --- a/externals/coda-oss/.gitattributes +++ b/externals/coda-oss/.gitattributes @@ -4,3 +4,96 @@ conanfile.py text eol=lf CMakeLists.txt text eol=lf *.cmake text eol=lf *.in text eol=lf + +# Modern tools on Windows can handle Linux LF +# See https://stackoverflow.com/a/13154031/8877 for details +* text=auto eol=lf +*.* text=auto eol=lf +.git?* text=auto eol=lf + +# Leave known Windows-only text files as CR/LF +*.sln text eol=crlf +*.dsw text eol=crlf +*.dsp text eol=crlf +*.vcproj text eol=crlf +*.vcxproj text eol=crlf +*.vcxproj.filters text eol=crlf +*.ruleset text eol=crlf +*.bat text eol=crlf + +###################### +# Known binary files + +# Python builds with WAF +waf binary + +# executables, libraries; yes, sometimes they're part of a repository +*.exe binary +*.out binary +lib*.so* binary +*.dll binary +lib*.a* binary +*.lib binary +*.mex binary +*.pyc binary + +# from various unit_test/ directories +*.dat binary +*.*hdr binary +*.flat binary +*.sig binary +*.bin binary +*.dump binary + +# images +*.bmp binary +*.ico binary +*.tiff binary +*.tif binary +*.gif binary +*.jpg binary +*.jpeg binary +*.png binary +# SVG images are XML +*.svg text +*.raw binary +*.hei? binary +*.kmz binary + +# music +*.mp3 binary +*.m4a binary +*.wav binary +*.wma binary + +# video +*.m4v binary +*.avi binary +*.wmv binary +*.mkv binary + +# documents +*.pdf binary +*.dvi binary +*.doc binary +*.docx binary +*.xls binary +*.xlsx binary +*.ppt binary +*.pptx binary + +# SAR +*.h5 binary +*.sio binary +*.hdr binary +*.ntf binary +*.nitf binary +*.sidd binary +*.sicd? binary + +# containers +*.zip binary +*.gz binary +*.tar binary +*.tgz binary +*.jar binary diff --git a/externals/coda-oss/.github/workflows/build_unittest.yml b/externals/coda-oss/.github/workflows/build_unittest.yml index b96a17a63e..4490ff1940 100644 --- a/externals/coda-oss/.github/workflows/build_unittest.yml +++ b/externals/coda-oss/.github/workflows/build_unittest.yml @@ -58,7 +58,8 @@ jobs: os: [windows-latest] platform: [x64] configuration: [Debug] # Debug turns on more compiler warnings - name: ${{ matrix.os }}-msbuild + avx: [AVX2, AVX512F] + name: ${{ matrix.os }}-${{ matrix.avx }}-msbuild runs-on: ${{ matrix.os }} steps: @@ -68,14 +69,14 @@ jobs: ls env: mkdir out cd out - cmake .. -DCMAKE_INSTALL_PREFIX=install\${{ matrix.platform }}-${{ matrix.configuration }} -DENABLE_PYTHON=OFF + cmake .. -DCMAKE_INSTALL_PREFIX=install\${{ matrix.platform }}-${{ matrix.configuration }} -DENABLE_PYTHON=OFF -DENABLE_${{ matrix.avx }}=ON - name: build run: | cd out cmake --build . --config ${{ matrix.configuration }} -j cmake --build . --config ${{ matrix.configuration }} --target install - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1 # https://github.com/marketplace/actions/setup-msbuild + uses: microsoft/setup-msbuild@v1.0.2 # https://github.com/marketplace/actions/setup-msbuild with: msbuild-architecture: x64 - name: msbuild @@ -89,7 +90,7 @@ jobs: # searchFolder: D:\a\nitro\nitro\${{ matrix.platform }}\${{ matrix.configuration }} # runInParallel: true - build-linux-cmake: + build-linux-cmake-default: strategy: matrix: os: [ubuntu-latest] @@ -109,8 +110,7 @@ jobs: run: | env which python - mkdir target - cd target + mkdir target && cd target cmake .. -DCMAKE_INSTALL_PREFIX=install${{ matrix.os }}CMake-Github -DPYTHON_VERSION=${{ matrix.python-version }} -DENABLE_SWIG=ON - name: build run: | @@ -127,6 +127,31 @@ jobs: cd target cmake --build . --target install + build-linux-cmake: + strategy: + matrix: + os: [ubuntu-latest] + configuration: [Debug, Release] + avx: [AVX2, AVX512F] + name: ${{ matrix.os }}-${{ matrix.configuration }}-${{ matrix.avx }}-CMake + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: configure + run: | + mkdir out && cd out + cmake .. -DENABLE_PYTHON=OFF -DENABLE_ASAN=ON -DENABLE_${{ matrix.avx }}=ON + - name: build + run: | + cd out + # "-j" spawns too many processes causing GCC to crash + cmake --build . --config ${{ matrix.configuration }} -j 12 + - name: test + # should run w/o install + run: | + cd out + ctest -C ${{ matrix.configuration }} --output-on-failure + build-waf: strategy: matrix: diff --git a/externals/coda-oss/.gitignore b/externals/coda-oss/.gitignore index 8549527fe3..f50718172e 100644 --- a/externals/coda-oss/.gitignore +++ b/externals/coda-oss/.gitignore @@ -1,56 +1,56 @@ -*.swp -*~ -*.pyc -__pycache__/ - -# Build artifacts -install/ -install-*/ -target/ - -# Conan -modules/drivers/**/build -test_package/build/ - -# CMake -_deps/ -CMakeCache.txt -CMakeFiles/ -*_config.h -Makefile -modules/**/Makefile -out/ -CMakeSettings.json - -# Waf -.waf-* -waf-* -.waf3-* -waf3-* -.lock-waf* -build/waf*/ - -# Eclipse -.project -.cproject - -# Drivers -modules/drivers/fftw/fftw-2.1.*/ -modules/drivers/jpeg/jpeg-9/ -modules/drivers/jpeg/jpeg-9d/ -modules/drivers/j2k/openjpeg/openjpeg-2.3.*_mod/ -modules/drivers/pcre/pcre2-10.*/ -modules/drivers/uuid/e2fsprogs-1.*-uuid/ -modules/drivers/xml/xerces/xerces-c-*/ -modules/drivers/zlib/zlib-1.2.*/ - -# VS -.vs/ -project.sln -.depproj/ -*.tlog -**/x64/ -*.vcxproj.user - -# Unit-tests +*.swp +*~ +*.pyc +__pycache__/ + +# Build artifacts +install/ +install-*/ +target/ + +# Conan +modules/drivers/**/build +test_package/build/ + +# CMake +_deps/ +CMakeCache.txt +CMakeFiles/ +*_config.h +Makefile +modules/**/Makefile +out/ +CMakeSettings.json + +# Waf +.waf-* +waf-* +.waf3-* +waf3-* +.lock-waf* +build/waf*/ + +# Eclipse +.project +.cproject + +# Drivers +modules/drivers/fftw/fftw-2.1.*/ +modules/drivers/jpeg/jpeg-9/ +modules/drivers/jpeg/jpeg-9d/ +modules/drivers/j2k/openjpeg/openjpeg-2.3.*_mod/ +modules/drivers/pcre/pcre2-10.*/ +modules/drivers/uuid/e2fsprogs-1.*.*/ +modules/drivers/xml/xerces/xerces-c-*/ +modules/drivers/zlib/zlib-1.2.*/ + +# VS +.vs/ +project.sln +.depproj/ +*.tlog +**/x64/ +*.vcxproj.user + +# Unit-tests TEST_*_TMP*.* diff --git a/externals/coda-oss/CMakeLists.txt b/externals/coda-oss/CMakeLists.txt index 4b1bc2c645..f512d520a8 100644 --- a/externals/coda-oss/CMakeLists.txt +++ b/externals/coda-oss/CMakeLists.txt @@ -24,19 +24,8 @@ if (${CMAKE_PROJECT_NAME} STREQUAL coda-oss) if (MSVC) add_compile_options(/WX) # warnings as errors add_compile_options(/MP) # multi-processor compile - - if (ENABLE_ASAN) - # https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-160 - add_compile_options(/fsanitize=address) - endif() elseif (UNIX) add_compile_options(-Werror) # warnings as errors - - if (ENABLE_ASAN) - # https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html - add_compile_options(-fsanitize=address) - add_link_options(-fsanitize=address) - endif() endif() list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") diff --git a/externals/coda-oss/ReleaseNotes.md b/externals/coda-oss/ReleaseNotes.md index c54bdadcbc..bd37823dd2 100644 --- a/externals/coda-oss/ReleaseNotes.md +++ b/externals/coda-oss/ReleaseNotes.md @@ -1,85 +1,98 @@ -``` - _________________________ - | ____ _||_ ___ __ | - | /___ \/_||_\| __\/ \ | - | // \// || \|| \\ _ \ | - | || [===||===] ||(_)| | - | || _|| || ||| ||__ | | - | \\ _/ |\_||_/||__/|| || | - | \___/ \_||_/|___/|| || | - |__________||_____________| - ``` -# coda-oss Release Notes - -## [Release 2023-06-05](https://github.com/mdaus/coda-oss/releases/tag/2023-06-05) -* *zlib* updated to [1.2.13](https://github.com/madler/zlib/releases/tag/v1.2.13). -* new `mem::ComplexView` class to make it easier to process complex data stored in parallel. -* adjust compiler flags for clean *CMake* builds. -* wrap common "file open" routines (e.g., `fopen()`) to support `sys::expandEnvironmentVariables()`. -* add header-only [HighFive](https://github.com/BlueBrain/HighFive) HDF5-wrapper library. -* Added a handful of [HighFive](https://github.com/BlueBrain/HighFive) utility routines. -* `mt::transform_async()` removed, it doesn't match C++17 techniques. -* Revamp `sys::byteSwap()` for improved type-safety and - [better performance](https://devblogs.microsoft.com/cppblog/a-tour-of-4-msvc-backend-improvements/). - * Added case-insensitive string comparison utilities: `str::eq()` and `str::ne()`; - `xml::lite::Uri`s compare case-insensitive. - -## [Release 2022-12-14](https://github.com/mdaus/coda-oss/releases/tag/2022-12-14) -* removed remaining vestiges of `std::auto_ptr`, provide `mem::AutoPtr` for the tiny handful of - places (e.g., SWIG bindings) that still need copying. -* `xml::lite::Element` overloads to make creating new XML documents easier; see unittests for examples. -* try even harder to find unittest files in various scenarios. -* build *hdf5.lite* with **waf**. -* New `--optz=fastest-possible` (**waf** only) which adds - [`-march=native`](https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/x86-Options.html#x86-Options) - to *fastest* for **waf** builds. There is a new *faster* option (the default) which is currently - the same as *fastest* (i.e., no `-march=native`). - -## [Release 2022-11-04](https://github.com/mdaus/coda-oss/releases/tag/2022-11-04) -* "Cut" from [main](https://github.com/mdaus/coda-oss/tree/main), not *master*. -* The [HDFGroup](https://hdfgroup.org/)s [HDF5 library](https://github.com/HDFGroup/hdf5) is built - and installed; a simple (and very incomplete!) wrapper is provided, this is at the "hello world!" stage. -* A few **cli** routines have been tweaked to make unit-testing easier. -* Utility routines for finding various files when unit-testing. -* Removed C++14 work-arounds needed in C++11. Legacy C++ exception specifications removed. -* Rebuild `waf` for FIPS error; added more debug options. - -## [Release 2022-08-30](https://github.com/mdaus/coda-oss/releases/tag/2022-08-30) -* XML is now always written as UTF-8; the code will still try to read Windows-1252. -* `Uri`s are no longer validated by default. -* Minor tweaks from other projects. -* ~~Final C++11 release 🤞🏻; future releases will be C++14 from [main](https://github.com/mdaus/coda-oss/tree/main).~~ - -## [Release 2022-08-02](https://github.com/mdaus/coda-oss/releases/tag/2022-08-02) -* remove *Expat* and *libXML* modules and support in **xml.lite**; only *Xerces* was actively used. -* ~~fix `waf` to work-around FIPS warning because of insecure *md5* hashing.~~ -* tweak `str::EncodedStringView` and `str::EncodedString` for - [future XML changes](https://github.com/mdaus/coda-oss/tree/feature/always-write-xml-as-utf8). - -## [Release 2022-06-29](https://github.com/mdaus/coda-oss/releases/tag/2022-06-29) -* remove **modules/drivers/boost** as it was empty (and unused); - **modules/c++/serialize** depended on boost, so it has also been removed. -* Update to [zlib 1.2.12](https://www.zlib.net/zlib-1.2.12.tar.gz), - ["Due to the bug fixes, any installations of 1.2.11 should be replaced with 1.2.12."](https://www.zlib.net/) -* Build most code in Visual Studio 2022 -* Removed more compiler warnings -* Begin work on `CODA_OSS_API` (needed for building a shared-library/DLL) -* Add `run1D()` method to `mt::GenerationThreadPool` - -## [Release 2022-05-03](https://github.com/mdaus/coda-oss/releases/tag/2022-05-03) -* Fixed a bug in `Poly2D::atY()`; improved `flipXY()` behavior. -* Implement [std::filesystem::file_size()](https://en.cppreference.com/w/cpp/filesystem/file_size). -* use `inline` functions for `TEST_` macros -* force use of [64-bit `time_t`](https://en.wikipedia.org/wiki/Year_2038_problem) -* more routines now support a `std::span` overload; e.g., `io::InputStream::read()`. - -## [Release 2022-02-22](https://github.com/mdaus/coda-oss/releases/tag/2022-02-22) -* new `EnocdedString` and `EncodedStringView` to manage strings in different encodings -* XML containing UTF-8 characters can now be validated -* Update to [GSL 4.0.0](https://github.com/microsoft/GSL/releases/tag/v4.0.0) -* our implementation of `std` stuff is all in the `coda_oss` namespace -* old, unused **log4j.jar** deleted to remove any questions about the security vulnerability - -## [Release 2021-12-13](https://github.com/mdaus/coda-oss/releases/tag/2021-12-13) -* Try hard to parse XML encoded in various ways -* Simplify XML element creation for common idioms +# coda-oss Release Notes + +## [Release 202?-??-??](https://github.com/mdaus/coda-oss/releases/tag/202?-??-??) +* Update to [HighFive 2.8.0](https://github.com/BlueBrain/HighFive/releases/tag/v2.8.0). + +## [Release 2023-10-23](https://github.com/mdaus/coda-oss/releases/tag/2023-10-23) +* Tweaked **.gitattributes**. +* Removed *str::EncodedStringView*; made *str* conversion routines more consistent. +* *FmtX()* uses overloads rather than C-style varargs. +* Add [`std::ssize()`](https://en.cppreference.com/w/cpp/iterator/size). +* `ENABLE_AVX2` and `ENABLE_AVX512F` flags for CMake builds. +* Build cleanly with ASAN. + +## [Release 2023-08-18](https://github.com/mdaus/coda-oss/releases/tag/2023-08-18) +* New `sys::OS::getSIMDInstructionSet()` utility routine; SSE2 is required (default with 64-bit builds). +* `types::ComplexInteger` to work-around `std::complex` no longer being [valid C++](https://en.cppreference.com/w/cpp/numeric/complex). +* Another round of reducing various compiler warnings (of note: `NULL` -> `nullptr`). +* Some support for [`std::numbers`](https://en.cppreference.com/w/cpp/header/numbers) from C++20. +* Update to [HighFive 2.7.1](https://github.com/BlueBrain/HighFive/releases/tag/v2.7.1). +* Update to [e2fsprogs 1.47.0](https://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.47.0). +* Update to [xerces-c 3.2.4](https://issues.apache.org/jira/secure/ReleaseNote.jspa?version=12350542&styleName=Text&projectId=10510). +* Update to [HDF5](https://www.hdfgroup.org/) [1.14.2](https://github.com/HDFGroup/hdf5/releases/tag/hdf5-1_14_2). +* `mem::ComplexView`s renamed to be more descriptive. +* **hdf5.lite** removed, use [HighFive](https://github.com/BlueBrain/HighFive/) (included). +* added **.gitattributes** and normalized line-endings (`\n` for most text files). + +## [Release 2023-06-05](https://github.com/mdaus/coda-oss/releases/tag/2023-06-05) +* *zlib* updated to [1.2.13](https://github.com/madler/zlib/releases/tag/v1.2.13). +* new `mem::ComplexView` class to make it easier to process complex data stored in parallel. +* adjust compiler flags for clean *CMake* builds. +* wrap common "file open" routines (e.g., `fopen()`) to support `sys::expandEnvironmentVariables()`. +* add header-only [HighFive](https://github.com/BlueBrain/HighFive) HDF5-wrapper library. +* Added a handful of [HighFive](https://github.com/BlueBrain/HighFive) utility routines. +* `mt::transform_async()` removed, it doesn't match C++17 techniques. +* Revamp `sys::byteSwap()` for improved type-safety and + [better performance](https://devblogs.microsoft.com/cppblog/a-tour-of-4-msvc-backend-improvements/). + * Added case-insensitive string comparison utilities: `str::eq()` and `str::ne()`; + `xml::lite::Uri`s compare case-insensitive. + +## [Release 2022-12-14](https://github.com/mdaus/coda-oss/releases/tag/2022-12-14) +* removed remaining vestiges of `std::auto_ptr`, provide `mem::AutoPtr` for the tiny handful of + places (e.g., SWIG bindings) that still need copying. +* `xml::lite::Element` overloads to make creating new XML documents easier; see unittests for examples. +* try even harder to find unittest files in various scenarios. +* build *hdf5.lite* with **waf**. +* New `--optz=fastest-possible` (**waf** only) which adds + [`-march=native`](https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/x86-Options.html#x86-Options) + to *fastest* for **waf** builds. There is a new *faster* option (the default) which is currently + the same as *fastest* (i.e., no `-march=native`). + +## [Release 2022-11-04](https://github.com/mdaus/coda-oss/releases/tag/2022-11-04) +* "Cut" from [main](https://github.com/mdaus/coda-oss/tree/main), not *master*. +* The [HDFGroup](https://hdfgroup.org/)s [HDF5 library](https://github.com/HDFGroup/hdf5) is built + and installed; a simple (and very incomplete!) wrapper is provided, this is at the "hello world!" stage. +* A few **cli** routines have been tweaked to make unit-testing easier. +* Utility routines for finding various files when unit-testing. +* Removed C++14 work-arounds needed in C++11. Legacy C++ exception specifications removed. +* Rebuild `waf` for FIPS error; added more debug options. + +## [Release 2022-08-30](https://github.com/mdaus/coda-oss/releases/tag/2022-08-30) +* XML is now always written as UTF-8; the code will still try to read Windows-1252. +* `Uri`s are no longer validated by default. +* Minor tweaks from other projects. +* ~~Final C++11 release 🤞🏻; future releases will be C++14 from [main](https://github.com/mdaus/coda-oss/tree/main).~~ + +## [Release 2022-08-02](https://github.com/mdaus/coda-oss/releases/tag/2022-08-02) +* remove *Expat* and *libXML* modules and support in **xml.lite**; only *Xerces* was actively used. +* ~~fix `waf` to work-around FIPS warning because of insecure *md5* hashing.~~ +* tweak `str::EncodedStringView` and `str::EncodedString` for + [future XML changes](https://github.com/mdaus/coda-oss/tree/feature/always-write-xml-as-utf8). + +## [Release 2022-06-29](https://github.com/mdaus/coda-oss/releases/tag/2022-06-29) +* remove **modules/drivers/boost** as it was empty (and unused); + **modules/c++/serialize** depended on boost, so it has also been removed. +* Update to [zlib 1.2.12](https://www.zlib.net/zlib-1.2.12.tar.gz), + ["Due to the bug fixes, any installations of 1.2.11 should be replaced with 1.2.12."](https://www.zlib.net/) +* Build most code in Visual Studio 2022 +* Removed more compiler warnings +* Begin work on `CODA_OSS_API` (needed for building a shared-library/DLL) +* Add `run1D()` method to `mt::GenerationThreadPool` + +## [Release 2022-05-03](https://github.com/mdaus/coda-oss/releases/tag/2022-05-03) +* Fixed a bug in `Poly2D::atY()`; improved `flipXY()` behavior. +* Implement [std::filesystem::file_size()](https://en.cppreference.com/w/cpp/filesystem/file_size). +* use `inline` functions for `TEST_` macros +* force use of [64-bit `time_t`](https://en.wikipedia.org/wiki/Year_2038_problem) +* more routines now support a `std::span` overload; e.g., `io::InputStream::read()`. + +## [Release 2022-02-22](https://github.com/mdaus/coda-oss/releases/tag/2022-02-22) +* new `EnocdedString` and `EncodedStringView` to manage strings in different encodings +* XML containing UTF-8 characters can now be validated +* Update to [GSL 4.0.0](https://github.com/microsoft/GSL/releases/tag/v4.0.0) +* our implementation of `std` stuff is all in the `coda_oss` namespace +* old, unused **log4j.jar** deleted to remove any questions about the security vulnerability + +## [Release 2021-12-13](https://github.com/mdaus/coda-oss/releases/tag/2021-12-13) +* Try hard to parse XML encoded in various ways +* Simplify XML element creation for common idioms diff --git a/externals/coda-oss/UnitTest/CppUnitTestAssert.cpp b/externals/coda-oss/UnitTest/CppUnitTestAssert.cpp index 5bea8da590..13b75386ac 100644 --- a/externals/coda-oss/UnitTest/CppUnitTestAssert.cpp +++ b/externals/coda-oss/UnitTest/CppUnitTestAssert.cpp @@ -1,5 +1,5 @@ -#include "pch.h" -#include "TestCase.h" - -// Can't get this to build in the **coda-oss** project. -#include "sys/source/CppUnitTestAssert_.cpp_" +#include "pch.h" +#include "TestCase.h" + +// Can't get this to build in the **coda-oss** project. +#include "sys/source/CppUnitTestAssert_.cpp_" diff --git a/externals/coda-oss/UnitTest/UnitTest.vcxproj b/externals/coda-oss/UnitTest/UnitTest.vcxproj index 835f574dca..f06331de90 100644 --- a/externals/coda-oss/UnitTest/UnitTest.vcxproj +++ b/externals/coda-oss/UnitTest/UnitTest.vcxproj @@ -1,416 +1,412 @@ - - - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {34A31B3F-47C5-441D-AB22-3C85B3C5314E} - Win32Proj - UnitTest - 10.0 - NativeUnitTestProject - - - - DynamicLibrary - true - v143 - false - Unicode - - - DynamicLibrary - false - v143 - true - false - Unicode - - - - - - - - - - - - - - - true - - - false - - - - Use - Level4 - true - $(VCInstallDir)UnitTest\include;$(ProjectDir);$(SolutionDir)modules\c++\;$(SolutionDir)modules\c++\avx\include;$(SolutionDir)modules\c++\cli\include;$(SolutionDir)modules\c++\config\include;$(SolutionDir)modules\c++\coda_oss\include;$(SolutionDir)modules\c++\gsl\include;$(SolutionDir)modules\c++\hdf5.lite\include;$(SolutionDir)modules\c++\io\include;$(SolutionDir)modules\c++\std\include;$(SolutionDir)modules\c++\str\include;$(SolutionDir)modules\c++\sys\include;$(SolutionDir)modules\c++\except\include;$(SolutionDir)modules\c++\logging\include;$(SolutionDir)modules\c++\math\include;$(SolutionDir)modules\c++\math.linear\include;$(SolutionDir)modules\c++\math.poly\include;$(SolutionDir)modules\c++\mem\include;$(SolutionDir)modules\c++\mt\include;$(SolutionDir)modules\c++\polygon\include;$(SolutionDir)modules\c++\re\include;$(SolutionDir)modules\c++\types\include;$(SolutionDir)modules\c++\units\include;$(SolutionDir)modules\c++\xml.lite\include;$(SolutionDir)modules\c++\zip\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;%(AdditionalIncludeDirectories) - _DEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1 - true - pch.h - true - true - Guard - ProgramDatabase - true - true - true - true - /Zc:__cplusplus %(AdditionalOptions) - AdvancedVectorExtensions2 - - - Windows - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - - - Use - Level3 - true - true - true - $(VCInstallDir)UnitTest\include;$(ProjectDir);$(SolutionDir)modules\c++\;$(SolutionDir)modules\c++\avx\include;$(SolutionDir)modules\c++\cli\include;$(SolutionDir)modules\c++\config\include;$(SolutionDir)modules\c++\coda_oss\include;$(SolutionDir)modules\c++\gsl\include;$(SolutionDir)modules\c++\hdf5.lite\include;$(SolutionDir)modules\c++\io\include;$(SolutionDir)modules\c++\std\include;$(SolutionDir)modules\c++\str\include;$(SolutionDir)modules\c++\sys\include;$(SolutionDir)modules\c++\except\include;$(SolutionDir)modules\c++\logging\include;$(SolutionDir)modules\c++\math\include;$(SolutionDir)modules\c++\math.linear\include;$(SolutionDir)modules\c++\math.poly\include;$(SolutionDir)modules\c++\mem\include;$(SolutionDir)modules\c++\mt\include;$(SolutionDir)modules\c++\polygon\include;$(SolutionDir)modules\c++\re\include;$(SolutionDir)modules\c++\types\include;$(SolutionDir)modules\c++\units\include;$(SolutionDir)modules\c++\xml.lite\include;$(SolutionDir)modules\c++\zip\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;%(AdditionalIncludeDirectories) - NDEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1 - true - pch.h - true - Guard - true - true - true - true - /Zc:__cplusplus %(AdditionalOptions) - AdvancedVectorExtensions2 - - - Windows - true - true - $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - {9997e895-5161-4ddf-8f3f-099894cb2f21} - - - - - + + + + + Debug + x64 + + + Release + x64 + + + + 17.0 + {34A31B3F-47C5-441D-AB22-3C85B3C5314E} + Win32Proj + UnitTest + 10.0 + NativeUnitTestProject + + + + DynamicLibrary + true + v143 + false + Unicode + + + DynamicLibrary + false + v143 + true + false + Unicode + + + + + + + + + + + + + + + true + + + false + + + + Use + Level4 + true + $(VCInstallDir)UnitTest\include;$(ProjectDir);$(SolutionDir)modules\c++;$(SolutionDir)modules\c++\avx\include;$(SolutionDir)modules\c++\cli\include;$(SolutionDir)modules\c++\config\include;$(SolutionDir)modules\c++\coda_oss\include;$(SolutionDir)modules\c++\gsl\include;$(SolutionDir)modules\c++\hdf5.lite\include;$(SolutionDir)modules\c++\io\include;$(SolutionDir)modules\c++\std\include;$(SolutionDir)modules\c++\str\include;$(SolutionDir)modules\c++\sys\include;$(SolutionDir)modules\c++\except\include;$(SolutionDir)modules\c++\logging\include;$(SolutionDir)modules\c++\math\include;$(SolutionDir)modules\c++\math.linear\include;$(SolutionDir)modules\c++\math.poly\include;$(SolutionDir)modules\c++\mem\include;$(SolutionDir)modules\c++\mt\include;$(SolutionDir)modules\c++\polygon\include;$(SolutionDir)modules\c++\re\include;$(SolutionDir)modules\c++\types\include;$(SolutionDir)modules\c++\units\include;$(SolutionDir)modules\c++\xml.lite\include;$(SolutionDir)modules\c++\zip\include;$(SolutionDir)modules\drivers;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1 + true + pch.h + true + true + Guard + ProgramDatabase + true + true + true + true + /Zc:__cplusplus %(AdditionalOptions) + AdvancedVectorExtensions2 + + + Windows + $(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;$(ProjectDir);$(SolutionDir)modules\c++;$(SolutionDir)modules\c++\avx\include;$(SolutionDir)modules\c++\cli\include;$(SolutionDir)modules\c++\config\include;$(SolutionDir)modules\c++\coda_oss\include;$(SolutionDir)modules\c++\gsl\include;$(SolutionDir)modules\c++\hdf5.lite\include;$(SolutionDir)modules\c++\io\include;$(SolutionDir)modules\c++\std\include;$(SolutionDir)modules\c++\str\include;$(SolutionDir)modules\c++\sys\include;$(SolutionDir)modules\c++\except\include;$(SolutionDir)modules\c++\logging\include;$(SolutionDir)modules\c++\math\include;$(SolutionDir)modules\c++\math.linear\include;$(SolutionDir)modules\c++\math.poly\include;$(SolutionDir)modules\c++\mem\include;$(SolutionDir)modules\c++\mt\include;$(SolutionDir)modules\c++\polygon\include;$(SolutionDir)modules\c++\re\include;$(SolutionDir)modules\c++\types\include;$(SolutionDir)modules\c++\units\include;$(SolutionDir)modules\c++\xml.lite\include;$(SolutionDir)modules\c++\zip\include;$(SolutionDir)modules\drivers;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions);MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1 + true + pch.h + true + Guard + true + true + true + true + /Zc:__cplusplus %(AdditionalOptions) + AdvancedVectorExtensions2 + + + Windows + true + true + $(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + + + + + Create + Create + + + + + + + + + + + + + + + + + + {9997e895-5161-4ddf-8f3f-099894cb2f21} + + + + + \ No newline at end of file diff --git a/externals/coda-oss/UnitTest/UnitTest.vcxproj.filters b/externals/coda-oss/UnitTest/UnitTest.vcxproj.filters index ab3ead71f4..f838a04336 100644 --- a/externals/coda-oss/UnitTest/UnitTest.vcxproj.filters +++ b/externals/coda-oss/UnitTest/UnitTest.vcxproj.filters @@ -1,325 +1,322 @@ - - - - - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - cli - - - cli - - - io - - - io - - - io - - - io - - - math - - - math - - - math - - - math - - - math - - - math - - - math - - - math.linear - - - math.poly - - - math.linear - - - math.linear - - - math.linear - - - math.linear - - - math.linear - - - math.linear - - - math.linear - - - math.linear - - - math.linear - - - math.poly - - - math.poly - - - math.poly - - - math.poly - - - math.poly - - - math.poly - - - math.poly - - - mem - - - polygon - - - str - - - types - - - units - - - units - - - types - - - types - - - types - - - str - - - str - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - polygon - - - avx - - - avx - - - logging - - - logging - - - logging - - - re - - - re - - - mt - - - types - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - zip - - - zip - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - - - - - - - {ea90a933-47d1-448a-8265-3742d1ce18f8} - - - {e3f97021-8c19-46cb-962c-d1cea71da3a2} - - - {4e86a44b-1997-42e6-86bc-f4167698b3a1} - - - {5f9ed5ed-863e-4dd6-a5dd-e22758218112} - - - {d343bd9f-8b19-4740-bdf8-39d687ab56bf} - - - {a4045a72-e6a4-4421-9eab-818136f2d22c} - - - {90e2ffd7-1b9a-4096-b2fa-b41159333682} - - - {cf1423ec-9599-4936-9563-afdcdda85f62} - - - {331ec48a-ac3a-4a63-b410-23701adec599} - - - {87b5dc54-ceaf-4f37-b074-41b295b8a92d} - - - {d444ddb7-6b00-495a-94d6-a2674cbfea83} - - - {7a48027a-9dd9-4700-a6fc-703dc7468721} - - - {0afb2127-0ee7-46d6-963c-132a7830a7d7} - - - {3baea66d-2852-40fe-8482-e3f6ba1a81e0} - - - {d205c017-7e98-456f-923f-2f78870a3d7d} - - - {5997a3de-0dc5-4439-b068-b351c5f395e3} - - - {223c163f-0321-4935-8e20-0e05f048adf0} - - - {f4dfc761-e468-4305-84dc-f3579e46107e} - - + + + + + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + cli + + + cli + + + io + + + io + + + io + + + io + + + math + + + math + + + math + + + math + + + math + + + math + + + math + + + math.linear + + + math.poly + + + math.linear + + + math.linear + + + math.linear + + + math.linear + + + math.linear + + + math.linear + + + math.linear + + + math.linear + + + math.linear + + + math.poly + + + math.poly + + + math.poly + + + math.poly + + + math.poly + + + math.poly + + + math.poly + + + mem + + + polygon + + + str + + + types + + + units + + + units + + + types + + + types + + + types + + + str + + + str + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + polygon + + + avx + + + avx + + + logging + + + logging + + + logging + + + re + + + re + + + mt + + + types + + + hdf5.lite + + + zip + + + zip + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + hdf5.lite + + + hdf5.lite + + + + + + + + + {ea90a933-47d1-448a-8265-3742d1ce18f8} + + + {e3f97021-8c19-46cb-962c-d1cea71da3a2} + + + {4e86a44b-1997-42e6-86bc-f4167698b3a1} + + + {5f9ed5ed-863e-4dd6-a5dd-e22758218112} + + + {d343bd9f-8b19-4740-bdf8-39d687ab56bf} + + + {a4045a72-e6a4-4421-9eab-818136f2d22c} + + + {90e2ffd7-1b9a-4096-b2fa-b41159333682} + + + {cf1423ec-9599-4936-9563-afdcdda85f62} + + + {331ec48a-ac3a-4a63-b410-23701adec599} + + + {87b5dc54-ceaf-4f37-b074-41b295b8a92d} + + + {d444ddb7-6b00-495a-94d6-a2674cbfea83} + + + {7a48027a-9dd9-4700-a6fc-703dc7468721} + + + {0afb2127-0ee7-46d6-963c-132a7830a7d7} + + + {3baea66d-2852-40fe-8482-e3f6ba1a81e0} + + + {d205c017-7e98-456f-923f-2f78870a3d7d} + + + {5997a3de-0dc5-4439-b068-b351c5f395e3} + + + {223c163f-0321-4935-8e20-0e05f048adf0} + + + {f4dfc761-e468-4305-84dc-f3579e46107e} + + \ No newline at end of file diff --git a/externals/coda-oss/UnitTest/hdf5.lite.cpp b/externals/coda-oss/UnitTest/hdf5.lite.cpp index 6546a2f004..f3d70924e2 100644 --- a/externals/coda-oss/UnitTest/hdf5.lite.cpp +++ b/externals/coda-oss/UnitTest/hdf5.lite.cpp @@ -1,25 +1,26 @@ -#include "pch.h" -#include "CppUnitTest.h" - -#include -#include -#include -#include -#include - -namespace hdf5_lite -{ - -TEST_CLASS(test_hdf5info){ public: -#include "hdf5.lite/unittests/test_hdf5info.cpp" -}; - -TEST_CLASS(test_hdf5read){ public: -#include "hdf5.lite/unittests/test_hdf5read.cpp" -}; - -TEST_CLASS(test_hdf5write){ public: -#include "hdf5.lite/unittests/test_hdf5write.cpp" -}; - +#include "pch.h" +#include "CppUnitTest.h" + +#include +#include +#pragma comment(lib, "hdf5-c++.lib") + +#include +#include +#include +#include +#include +#include + +namespace hdf5_lite +{ + +TEST_CLASS(test_highfive){ public: +#include "hdf5.lite/unittests/test_highfive.cpp" +}; + +//TEST_CLASS(test_high_five_base){ public: +//#include "highfive/unittests/tests_high_five_base.cpp" +//}; + } \ No newline at end of file diff --git a/externals/coda-oss/UnitTest/io.cpp b/externals/coda-oss/UnitTest/io.cpp index b536c9b52e..5a56cce7c4 100644 --- a/externals/coda-oss/UnitTest/io.cpp +++ b/externals/coda-oss/UnitTest/io.cpp @@ -1,21 +1,21 @@ -#include "pch.h" -#include "CppUnitTest.h" - -#include -#include - -namespace io -{ -TEST_CLASS(test_stream_splitter){ public: -#include "io/unittests/test_stream_splitter.cpp" -}; - -TEST_CLASS(test_streams){ public: -#include "io/unittests/test_streams.cpp" -}; - -TEST_CLASS(test_tempfile){ public: -#include "io/unittests/test_tempfile.cpp" -}; - +#include "pch.h" +#include "CppUnitTest.h" + +#include +#include + +namespace io +{ +TEST_CLASS(test_stream_splitter){ public: +#include "io/unittests/test_stream_splitter.cpp" +}; + +TEST_CLASS(test_streams){ public: +#include "io/unittests/test_streams.cpp" +}; + +TEST_CLASS(test_tempfile){ public: +#include "io/unittests/test_tempfile.cpp" +}; + } \ No newline at end of file diff --git a/externals/coda-oss/UnitTest/math.cpp b/externals/coda-oss/UnitTest/math.cpp index 567f5fe20b..7b16b850a9 100644 --- a/externals/coda-oss/UnitTest/math.cpp +++ b/externals/coda-oss/UnitTest/math.cpp @@ -1,31 +1,31 @@ -#include "pch.h" -#include "CppUnitTest.h" - -#include - -namespace math -{ -TEST_CLASS(test_bessel_functions){ public: -#include "math/unittests/test_bessel_functions.cpp" -}; - -TEST_CLASS(test_convex_hull){ public: -#include "math/unittests/test_convex_hull.cpp" -}; - -TEST_CLASS(test_is_nan){ public: -#include "math/unittests/test_is_nan.cpp" -}; - -TEST_CLASS(test_n_choose_k){ public: -#include "math/unittests/test_n_choose_k.cpp" -}; - -TEST_CLASS(test_round){ public: -#include "math/unittests/test_round.cpp" -}; - -TEST_CLASS(test_sign){ public: -#include "math/unittests/test_sign.cpp" -}; +#include "pch.h" +#include "CppUnitTest.h" + +#include + +namespace math +{ +TEST_CLASS(test_bessel_functions){ public: +#include "math/unittests/test_bessel_functions.cpp" +}; + +TEST_CLASS(test_convex_hull){ public: +#include "math/unittests/test_convex_hull.cpp" +}; + +TEST_CLASS(test_is_nan){ public: +#include "math/unittests/test_is_nan.cpp" +}; + +TEST_CLASS(test_n_choose_k){ public: +#include "math/unittests/test_n_choose_k.cpp" +}; + +TEST_CLASS(test_round){ public: +#include "math/unittests/test_round.cpp" +}; + +TEST_CLASS(test_sign){ public: +#include "math/unittests/test_sign.cpp" +}; } \ No newline at end of file diff --git a/externals/coda-oss/UnitTest/math.linear.cpp b/externals/coda-oss/UnitTest/math.linear.cpp index 7ff8f33f57..d44984fb94 100644 --- a/externals/coda-oss/UnitTest/math.linear.cpp +++ b/externals/coda-oss/UnitTest/math.linear.cpp @@ -1,47 +1,47 @@ -#include "pch.h" -#include "CppUnitTest.h" - -#include - -namespace math_linear -{ -TEST_CLASS(test_eigenvalue){ public: -#include "math.linear/unittests/test_eigenvalue.cpp" -}; - -TEST_CLASS(test_inf_equality){ public: -#include "math.linear/unittests/test_inf_equality.cpp" -}; - -TEST_CLASS(test_inverse){ public: -#include "math.linear/unittests/test_inverse.cpp" -}; - -TEST_CLASS(test_lin){ public: -#include "math.linear/unittests/test_lin.cpp" -}; - -#ifdef HAVE_BOOST -TEST_CLASS(test_Matrix2D_serialize){ public: -#include "math.linear/unittests/test_Matrix2D_serialize.cpp" -}; -#endif - -TEST_CLASS(test_mx){ public: -#include "math.linear/unittests/test_mx.cpp" -}; - -TEST_CLASS(test_Vector){ public: -#include "math.linear/unittests/test_Vector.cpp" -}; - -#ifdef HAVE_BOOST -TEST_CLASS(test_Vector_serialize){ public: -#include "math.linear/unittests/test_Vector_serialize.cpp" -}; -#endif - -TEST_CLASS(test_VectorN){ public: -#include "math.linear/unittests/test_VectorN.cpp" -}; +#include "pch.h" +#include "CppUnitTest.h" + +#include + +namespace math_linear +{ +TEST_CLASS(test_eigenvalue){ public: +#include "math.linear/unittests/test_eigenvalue.cpp" +}; + +TEST_CLASS(test_inf_equality){ public: +#include "math.linear/unittests/test_inf_equality.cpp" +}; + +TEST_CLASS(test_inverse){ public: +#include "math.linear/unittests/test_inverse.cpp" +}; + +TEST_CLASS(test_lin){ public: +#include "math.linear/unittests/test_lin.cpp" +}; + +#ifdef HAVE_BOOST +TEST_CLASS(test_Matrix2D_serialize){ public: +#include "math.linear/unittests/test_Matrix2D_serialize.cpp" +}; +#endif + +TEST_CLASS(test_mx){ public: +#include "math.linear/unittests/test_mx.cpp" +}; + +TEST_CLASS(test_Vector){ public: +#include "math.linear/unittests/test_Vector.cpp" +}; + +#ifdef HAVE_BOOST +TEST_CLASS(test_Vector_serialize){ public: +#include "math.linear/unittests/test_Vector_serialize.cpp" +}; +#endif + +TEST_CLASS(test_VectorN){ public: +#include "math.linear/unittests/test_VectorN.cpp" +}; } \ No newline at end of file diff --git a/externals/coda-oss/UnitTest/math.poly.cpp b/externals/coda-oss/UnitTest/math.poly.cpp index 20fd78e854..84dcaf98a9 100644 --- a/externals/coda-oss/UnitTest/math.poly.cpp +++ b/externals/coda-oss/UnitTest/math.poly.cpp @@ -1,41 +1,41 @@ -#include "pch.h" -#include "CppUnitTest.h" - -#include -#include - -namespace math_poly -{ -TEST_CLASS(test_1d_poly){ public: -#include "math.poly/unittests/test_1d_poly.cpp" -}; - -#ifdef HAVE_BOOST -TEST_CLASS(test_1d_poly_serialize){ public: -#include "math.poly/unittests/test_1d_poly_serialize.cpp" -}; -#endif - -TEST_CLASS(test_2d_poly){ public: -#include "math.poly/unittests/test_2d_poly.cpp" -}; - -#ifdef HAVE_BOOST -TEST_CLASS(test_2d_poly_serialize){ public: -#include "math.poly/unittests/test_2d_poly_serialize.cpp" -}; -#endif - -TEST_CLASS(test_fixed_1d_poly){ public: -#include "math.poly/unittests/test_fixed_1d_poly.cpp" -}; - -TEST_CLASS(test_fixed_2d_poly){ public: -#include "math.poly/unittests/test_fixed_2d_poly.cpp" -}; - -TEST_CLASS(test_llsq){ public: -#include "math.poly/unittests/test_llsq.cpp" -}; - +#include "pch.h" +#include "CppUnitTest.h" + +#include +#include + +namespace math_poly +{ +TEST_CLASS(test_1d_poly){ public: +#include "math.poly/unittests/test_1d_poly.cpp" +}; + +#ifdef HAVE_BOOST +TEST_CLASS(test_1d_poly_serialize){ public: +#include "math.poly/unittests/test_1d_poly_serialize.cpp" +}; +#endif + +TEST_CLASS(test_2d_poly){ public: +#include "math.poly/unittests/test_2d_poly.cpp" +}; + +#ifdef HAVE_BOOST +TEST_CLASS(test_2d_poly_serialize){ public: +#include "math.poly/unittests/test_2d_poly_serialize.cpp" +}; +#endif + +TEST_CLASS(test_fixed_1d_poly){ public: +#include "math.poly/unittests/test_fixed_1d_poly.cpp" +}; + +TEST_CLASS(test_fixed_2d_poly){ public: +#include "math.poly/unittests/test_fixed_2d_poly.cpp" +}; + +TEST_CLASS(test_llsq){ public: +#include "math.poly/unittests/test_llsq.cpp" +}; + } \ No newline at end of file diff --git a/externals/coda-oss/UnitTest/mem.cpp b/externals/coda-oss/UnitTest/mem.cpp index 375bb9384e..dba2dd8e24 100644 --- a/externals/coda-oss/UnitTest/mem.cpp +++ b/externals/coda-oss/UnitTest/mem.cpp @@ -1,41 +1,41 @@ -#include "pch.h" -#include "CppUnitTest.h" - -#include -#include -#include -#include -#include - -namespace mem -{ - -TEST_CLASS(test_scoped_cloneable_ptr){ public: -#include "mem/unittests/test_scoped_cloneable_ptr.cpp" -}; - -TEST_CLASS(test_scoped_copyable_ptr){ public: -#include "mem/unittests/test_scoped_copyable_ptr.cpp" -}; - -TEST_CLASS(test_scratch_memory){ public: -#include "mem/unittests/test_scratch_memory.cpp" -}; - -TEST_CLASS(test_shared_ptr){ public: -#include "mem/unittests/test_shared_ptr.cpp" -}; - -TEST_CLASS(test_Span){ public: -#include "mem/unittests/test_Span.cpp" -}; - -TEST_CLASS(test_unique_ptr){ public: -#include "mem/unittests/test_unique_ptr.cpp" -}; - -TEST_CLASS(test_vector_pointers){ public: -#include "mem/unittests/test_vector_pointers.cpp" -}; - +#include "pch.h" +#include "CppUnitTest.h" + +#include +#include +#include +#include +#include + +namespace mem +{ + +TEST_CLASS(test_scoped_cloneable_ptr){ public: +#include "mem/unittests/test_scoped_cloneable_ptr.cpp" +}; + +TEST_CLASS(test_scoped_copyable_ptr){ public: +#include "mem/unittests/test_scoped_copyable_ptr.cpp" +}; + +TEST_CLASS(test_scratch_memory){ public: +#include "mem/unittests/test_scratch_memory.cpp" +}; + +TEST_CLASS(test_shared_ptr){ public: +#include "mem/unittests/test_shared_ptr.cpp" +}; + +TEST_CLASS(test_Span){ public: +#include "mem/unittests/test_Span.cpp" +}; + +TEST_CLASS(test_unique_ptr){ public: +#include "mem/unittests/test_unique_ptr.cpp" +}; + +TEST_CLASS(test_vector_pointers){ public: +#include "mem/unittests/test_vector_pointers.cpp" +}; + } \ No newline at end of file diff --git a/externals/coda-oss/UnitTest/pch.cpp b/externals/coda-oss/UnitTest/pch.cpp index 91c22df2a1..64b7eef6d6 100644 --- a/externals/coda-oss/UnitTest/pch.cpp +++ b/externals/coda-oss/UnitTest/pch.cpp @@ -1,5 +1,5 @@ -// pch.cpp: source file corresponding to the pre-compiled header - -#include "pch.h" - -// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/externals/coda-oss/UnitTest/pch.h b/externals/coda-oss/UnitTest/pch.h index 8c2ebbb93c..fec9e020b6 100644 --- a/externals/coda-oss/UnitTest/pch.h +++ b/externals/coda-oss/UnitTest/pch.h @@ -1,59 +1,59 @@ -// pch.h: This is a precompiled header file. -// Files listed below are compiled only once, improving build performance for future builds. -// This also affects IntelliSense performance, including code completion and many code browsing features. -// However, files listed here are ALL re-compiled if any one of them is updated between builds. -// Do not add files here that you will be updating frequently as this negates the performance advantage. - -#ifndef PCH_H -#define PCH_H - -// add headers that you want to pre-compile here - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#pragma warning(push) -#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior -#include -#include -#include -#pragma warning(pop) -#undef min -#undef max - -#define _USE_MATH_DEFINES -#include -#include - -#include "import/std.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include "CppUnitTest.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "TestCase.h" - -#endif //PCH_H +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#ifndef PCH_H +#define PCH_H + +// add headers that you want to pre-compile here + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#pragma warning(push) +#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior +#include +#include +#include +#pragma warning(pop) +#undef min +#undef max + +#define _USE_MATH_DEFINES +#include +#include + +#include "import/std.h" +#include +#include +#include +#include +#include +#include +#include +#include + +#include "CppUnitTest.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "TestCase.h" + +#endif //PCH_H diff --git a/externals/coda-oss/UnitTest/str.cpp b/externals/coda-oss/UnitTest/str.cpp index a3be22b7c9..a1987212ea 100644 --- a/externals/coda-oss/UnitTest/str.cpp +++ b/externals/coda-oss/UnitTest/str.cpp @@ -1,19 +1,17 @@ -#include "pch.h" -#include "CppUnitTest.h" - -#include - -#include -#include -#include - -namespace str -{ - TEST_CLASS(test_base_convert){ public: - #include "str/unittests/test_base_convert.cpp" - }; - - TEST_CLASS(test_str){ public: - #include "str/unittests/test_str.cpp" - }; -} +#include "pch.h" +#include "CppUnitTest.h" + +#include + +#include + +namespace str +{ + TEST_CLASS(test_base_convert){ public: + #include "str/unittests/test_base_convert.cpp" + }; + + TEST_CLASS(test_str){ public: + #include "str/unittests/test_str.cpp" + }; +} diff --git a/externals/coda-oss/UnitTest/units.cpp b/externals/coda-oss/UnitTest/units.cpp index cbb47cbe91..f0ce0ff732 100644 --- a/externals/coda-oss/UnitTest/units.cpp +++ b/externals/coda-oss/UnitTest/units.cpp @@ -1,12 +1,12 @@ -#include "pch.h" -#include "CppUnitTest.h" - -#include -#include - -namespace units -{ - TEST_CLASS(test_units){ public: - #include "units/unittests/test_units.cpp" - }; -} +#include "pch.h" +#include "CppUnitTest.h" + +#include +#include + +namespace units +{ + TEST_CLASS(test_units){ public: + #include "units/unittests/test_units.cpp" + }; +} diff --git a/externals/coda-oss/build/build.py b/externals/coda-oss/build/build.py index 1c9c5eca2a..01d512e989 100644 --- a/externals/coda-oss/build/build.py +++ b/externals/coda-oss/build/build.py @@ -1023,8 +1023,8 @@ def configureCompilerOptions(self): config['cxx'].update(vars) config['cc'].update(vars) - defines = '_FILE_OFFSET_BITS=64 ' \ - '_LARGEFILE_SOURCE WIN32 _USE_MATH_DEFINES NOMINMAX WIN32_LEAN_AND_MEAN'.split() + defines = '_FILE_OFFSET_BITS=64 _LARGEFILE_SOURCE' \ + 'WIN32 _USE_MATH_DEFINES NOMINMAX _CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN'.split() flags = '/UUNICODE /U_UNICODE /EHs /GR'.split() #If building with cpp17 add flags/defines to enable auto_ptr diff --git a/externals/coda-oss/build/scripts/makeEnums.py b/externals/coda-oss/build/scripts/makeEnums.py index 911a7fefee..6e909511c3 100755 --- a/externals/coda-oss/build/scripts/makeEnums.py +++ b/externals/coda-oss/build/scripts/makeEnums.py @@ -110,7 +110,7 @@ def cmpValues(x, y): s.write(' %sif (s == "%s")\n value = %s%s;\n' % (i > 0 and 'else ' or '', n, values.cleanPrefix, item.names[0].replace(' ', '_'))) i += 1 - s.write(' else\n throw except::InvalidFormatException(Ctxt(FmtX("Invalid enum value: %s", s.c_str())));\n') + s.write(' else\n throw except::InvalidFormatException(Ctxt(str::Format("Invalid enum value: %s", s.c_str())));\n') s.write(' }\n\n') s.write(' //! int constructor\n') @@ -123,7 +123,7 @@ def cmpValues(x, y): try: idx += 1 except:{} - s.write(' default:\n throw except::InvalidFormatException(Ctxt(FmtX("Invalid enum value: %d", i)));\n') + s.write(' default:\n throw except::InvalidFormatException(Ctxt(str::Format("Invalid enum value: %d", i)));\n') s.write(' }\n }\n\n') s.write(' //! destructor\n') @@ -142,7 +142,7 @@ def cmpValues(x, y): try: idx += 1 except:{} - s.write(' default:\n throw except::InvalidFormatException(Ctxt(FmtX("Invalid enum value: %d", value)));\n') + s.write(' default:\n throw except::InvalidFormatException(Ctxt(str::Format("Invalid enum value: %d", value)));\n') s.write(' }\n }\n\n') s.write(' //! assignment operator\n') diff --git a/externals/coda-oss/build/scripts/makeInstallPath.py b/externals/coda-oss/build/scripts/makeInstallPath.py index b80587e2ce..94a804af86 100644 --- a/externals/coda-oss/build/scripts/makeInstallPath.py +++ b/externals/coda-oss/build/scripts/makeInstallPath.py @@ -1,34 +1,34 @@ -import os -from os.path import join - -def installPath(package_name): - install_suffix = '' - - if 'studio11' in os.environ.get('JOB_NAME'): - install_suffix = 'sparc-sun-solaris2.10-64-studio11' - elif 'studio12' in os.environ.get('JOB_NAME') or 'solaris' in os.environ.get('JOB_NAME'): - install_suffix = 'sparc-sun-solaris2.10-64-studio12' - elif 'linux' in os.environ.get('JOB_NAME'): - install_suffix = 'x86_64-linux-gnu-64' - elif 'win32' in os.environ.get('JOB_NAME'): - install_suffix = 'win32' - elif 'win64' in os.environ.get('JOB_NAME'): - install_suffix = 'win64' - - if '-mt' in os.environ.get('JOB_NAME'): - install_suffix += '-mt' - if '-vc9' in os.environ.get('JOB_NAME'): - install_suffix += '-vc9' - elif '-vc10' in os.environ.get('JOB_NAME'): - install_suffix += '-vc10' - - - if 'GIT_COMMIT' in os.environ: - commit_id = os.environ.get('GIT_COMMIT', '') - commit_id = commit_id[-8:] - elif 'SVN_REVISION' in os.environ: - commit_id = os.environ.get('SVN_REVISION', '') - install_path = "%s-%s-r%s" % (package_name,install_suffix, commit_id) - if 'SVN_REVISION' in os.environ: - install_path = join('..', install_path) - return install_path +import os +from os.path import join + +def installPath(package_name): + install_suffix = '' + + if 'studio11' in os.environ.get('JOB_NAME'): + install_suffix = 'sparc-sun-solaris2.10-64-studio11' + elif 'studio12' in os.environ.get('JOB_NAME') or 'solaris' in os.environ.get('JOB_NAME'): + install_suffix = 'sparc-sun-solaris2.10-64-studio12' + elif 'linux' in os.environ.get('JOB_NAME'): + install_suffix = 'x86_64-linux-gnu-64' + elif 'win32' in os.environ.get('JOB_NAME'): + install_suffix = 'win32' + elif 'win64' in os.environ.get('JOB_NAME'): + install_suffix = 'win64' + + if '-mt' in os.environ.get('JOB_NAME'): + install_suffix += '-mt' + if '-vc9' in os.environ.get('JOB_NAME'): + install_suffix += '-vc9' + elif '-vc10' in os.environ.get('JOB_NAME'): + install_suffix += '-vc10' + + + if 'GIT_COMMIT' in os.environ: + commit_id = os.environ.get('GIT_COMMIT', '') + commit_id = commit_id[-8:] + elif 'SVN_REVISION' in os.environ: + commit_id = os.environ.get('SVN_REVISION', '') + install_path = "%s-%s-r%s" % (package_name,install_suffix, commit_id) + if 'SVN_REVISION' in os.environ: + install_path = join('..', install_path) + return install_path diff --git a/externals/coda-oss/cmake/CodaBuild.cmake b/externals/coda-oss/cmake/CodaBuild.cmake index 69a143c1b2..1427737888 100644 --- a/externals/coda-oss/cmake/CodaBuild.cmake +++ b/externals/coda-oss/cmake/CodaBuild.cmake @@ -165,6 +165,22 @@ macro(coda_initialize_build) # This should probably be replaced by GenerateExportHeader #set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD TRUE) + + if (ENABLE_ASAN) + # https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-160 + add_compile_options(/fsanitize=address) + endif() + + # Note SSE2 is implicitly enabled for x64 builds. + if (ENABLE_AVX2 AND (NOT ENABLE_AVX512F)) + # https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86?view=msvc-170 + add_compile_options(/arch:AVX2) + endif() + if (ENABLE_AVX512F) + # https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86?view=msvc-170 + add_compile_options(/arch:AVX512) + endif() + endif() # Unix/Linux specific options @@ -173,6 +189,27 @@ macro(coda_initialize_build) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 ) + + if (ENABLE_ASAN) + # https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html + add_compile_options(-fsanitize=address) + add_link_options(-fsanitize=address) + endif() + + # Note SSE2 is implicitly enabled for x64 builds. + if (ENABLE_AVX2 AND (NOT ENABLE_AVX512F)) + # https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html + # It doesn't look like GCC has a specific option for AVX2; + # other projects use "haswell" + add_compile_options(-march=haswell) + endif() + if (ENABLE_AVX512F) + # https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html + # It doesn't look like GCC has a specific option for AVX512F; + # other projects use "native" which isn't quite correct.' + add_compile_options(-march=native) + endif() + endif() # all targets should be installed using this export set diff --git a/externals/coda-oss/coda-oss.sln b/externals/coda-oss/coda-oss.sln index cea89c6f03..48a3923320 100644 --- a/externals/coda-oss/coda-oss.sln +++ b/externals/coda-oss/coda-oss.sln @@ -1,47 +1,47 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.1.32421.90 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coda-oss", "modules\c++\coda-oss.vcxproj", "{9997E895-5161-4DDF-8F3F-099894CB2F21}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DEB848DD-4285-4BFA-9B2F-60FA46200205}" - ProjectSection(SolutionItems) = preProject - .gitattributes = .gitattributes - .gitignore = .gitignore - README.md = README.md - ReleaseNotes.md = ReleaseNotes.md - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTest.vcxproj", "{34A31B3F-47C5-441D-AB22-3C85B3C5314E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github-workflows", ".github-workflows", "{E0FA1194-0806-4A6B-A331-33CB43C0C946}" - ProjectSection(SolutionItems) = preProject - .github\workflows\build_unittest.yml = .github\workflows\build_unittest.yml - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9997E895-5161-4DDF-8F3F-099894CB2F21}.Debug|x64.ActiveCfg = Debug|x64 - {9997E895-5161-4DDF-8F3F-099894CB2F21}.Debug|x64.Build.0 = Debug|x64 - {9997E895-5161-4DDF-8F3F-099894CB2F21}.Release|x64.ActiveCfg = Release|x64 - {9997E895-5161-4DDF-8F3F-099894CB2F21}.Release|x64.Build.0 = Release|x64 - {34A31B3F-47C5-441D-AB22-3C85B3C5314E}.Debug|x64.ActiveCfg = Debug|x64 - {34A31B3F-47C5-441D-AB22-3C85B3C5314E}.Debug|x64.Build.0 = Debug|x64 - {34A31B3F-47C5-441D-AB22-3C85B3C5314E}.Release|x64.ActiveCfg = Release|x64 - {34A31B3F-47C5-441D-AB22-3C85B3C5314E}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {E0FA1194-0806-4A6B-A331-33CB43C0C946} = {DEB848DD-4285-4BFA-9B2F-60FA46200205} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {3CAB4AC9-7865-44AD-8623-57905729A559} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.1.32421.90 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "coda-oss", "modules\c++\coda-oss.vcxproj", "{9997E895-5161-4DDF-8F3F-099894CB2F21}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DEB848DD-4285-4BFA-9B2F-60FA46200205}" + ProjectSection(SolutionItems) = preProject + .gitattributes = .gitattributes + .gitignore = .gitignore + README.md = README.md + ReleaseNotes.md = ReleaseNotes.md + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTest.vcxproj", "{34A31B3F-47C5-441D-AB22-3C85B3C5314E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github-workflows", ".github-workflows", "{E0FA1194-0806-4A6B-A331-33CB43C0C946}" + ProjectSection(SolutionItems) = preProject + .github\workflows\build_unittest.yml = .github\workflows\build_unittest.yml + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9997E895-5161-4DDF-8F3F-099894CB2F21}.Debug|x64.ActiveCfg = Debug|x64 + {9997E895-5161-4DDF-8F3F-099894CB2F21}.Debug|x64.Build.0 = Debug|x64 + {9997E895-5161-4DDF-8F3F-099894CB2F21}.Release|x64.ActiveCfg = Release|x64 + {9997E895-5161-4DDF-8F3F-099894CB2F21}.Release|x64.Build.0 = Release|x64 + {34A31B3F-47C5-441D-AB22-3C85B3C5314E}.Debug|x64.ActiveCfg = Debug|x64 + {34A31B3F-47C5-441D-AB22-3C85B3C5314E}.Debug|x64.Build.0 = Debug|x64 + {34A31B3F-47C5-441D-AB22-3C85B3C5314E}.Release|x64.ActiveCfg = Release|x64 + {34A31B3F-47C5-441D-AB22-3C85B3C5314E}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {E0FA1194-0806-4A6B-A331-33CB43C0C946} = {DEB848DD-4285-4BFA-9B2F-60FA46200205} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3CAB4AC9-7865-44AD-8623-57905729A559} + EndGlobalSection +EndGlobal diff --git a/externals/coda-oss/modules/c++/CMakeLists.txt b/externals/coda-oss/modules/c++/CMakeLists.txt index d242748651..d30fb57661 100644 --- a/externals/coda-oss/modules/c++/CMakeLists.txt +++ b/externals/coda-oss/modules/c++/CMakeLists.txt @@ -1,17 +1,12 @@ set(TARGET_LANGUAGE c++) -# turn on maximum warnings if (MSVC) - add_compile_options(/std:c++14) - # By default, there is a /W3 on the command-line from somewhere (?); adding # /Wn results in a compiler warning. #add_compile_options(/W4) # /Wall string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # /Wall elseif (UNIX) - add_compile_options(-std=c++14) - # https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html add_compile_options(-Werror) # Make all warnings into errors add_compile_options(-Wall -Wextra -Wpedantic -pedantic-errors -Wunused) diff --git a/externals/coda-oss/modules/c++/avx/unittests/test_m256.cpp b/externals/coda-oss/modules/c++/avx/unittests/test_m256.cpp index 8c6cdc47b9..920a0f9f8d 100644 --- a/externals/coda-oss/modules/c++/avx/unittests/test_m256.cpp +++ b/externals/coda-oss/modules/c++/avx/unittests/test_m256.cpp @@ -25,7 +25,9 @@ #include #include +#include #include +#include TEST_CASE(extractf) { @@ -49,8 +51,50 @@ TEST_CASE(extractf) */ TEST_SUCCESS; } + +TEST_CASE(test_getSIMDInstructionSet) +{ + // This is the reverse of getSIMDInstructionSet(): it uses the macros to generate a value. + constexpr auto simdInstructionSet = sys::getSIMDInstructionSet(); + #if __AVX512F__ + static_assert(simdInstructionSet == sys::SIMDInstructionSet::AVX512F, "getSIMDInstructionSet()"); + #elif __AVX2__ + static_assert(simdInstructionSet == sys::SIMDInstructionSet::AVX2, "getSIMDInstructionSet()"); + #else + static_assert(simdInstructionSet == sys::SIMDInstructionSet::SSE2, "getSIMDInstructionSet()"); + #endif + CODA_OSS_disable_warning_push + #if _MSC_VER + #pragma warning(disable: 4127) // conditional expression is constant + #endif + + switch (sys::getSIMDInstructionSet()) // run-time value + { + case sys::SIMDInstructionSet::SSE2: + { + TEST_ASSERT(simdInstructionSet == sys::SIMDInstructionSet::SSE2); + break; + } + case sys::SIMDInstructionSet::AVX2: + { + TEST_ASSERT(simdInstructionSet == sys::SIMDInstructionSet::AVX2); + break; + } + case sys::SIMDInstructionSet::AVX512F: + { + TEST_ASSERT(simdInstructionSet == sys::SIMDInstructionSet::AVX512F); + break; + } + default: + { + TEST_FAIL; + } + } + CODA_OSS_disable_warning_pop +} TEST_MAIN( TEST_CHECK(extractf); + TEST_CHECK(test_getSIMDInstructionSet); ) diff --git a/externals/coda-oss/modules/c++/cli/include/cli/Results.h b/externals/coda-oss/modules/c++/cli/include/cli/Results.h index fecb008a03..bd293cf695 100644 --- a/externals/coda-oss/modules/c++/cli/include/cli/Results.h +++ b/externals/coda-oss/modules/c++/cli/include/cli/Results.h @@ -20,19 +20,25 @@ * */ -#ifndef __CLI_RESULTS_H__ -#define __CLI_RESULTS_H__ +#pragma once +#ifndef CODA_OSS_cli_Results_h_INCLUDED_ +#define CODA_OSS_cli_Results_h_INCLUDED_ #include +#include +#include +#include + +#include "sys/Conf.h" + #include "cli/Value.h" namespace cli { -class Results +class Results final { -protected: - typedef std::map ValueStorage_T; + typedef std::map> ValueStorage_T; typedef ValueStorage_T::iterator ValueIter_T; typedef ValueStorage_T::const_iterator ConstValueIter_T; typedef std::map ResultsStorage_T; @@ -40,13 +46,15 @@ class Results typedef ResultsStorage_T::const_iterator ConstResultsIter_T; public: - Results() - { - } + Results() = default; ~Results() { destroy(); } + Results(const Results&) = delete; + Results& operator=(const Results&) = delete; + Results(Results&&) = default; + Results& operator=(Results&&) = default; bool hasValue(const std::string& key) const { @@ -58,20 +66,30 @@ class Results return mResults.find(key) != mResults.end(); } - cli::Value* operator[](const std::string& key) const + const cli::Value* operator[](const std::string& key) const { return getValue(key); } - cli::Value* getValue(const std::string& key) const + const cli::Value* getValue(const std::string& key) const { - ConstValueIter_T p = mValues.find(key); + auto const p = mValues.find(key); if (p == mValues.end()) { const std::string errorMessage = "No argument named " + key; throw except::NoSuchKeyException(Ctxt(errorMessage)); } - return p->second; + return p->second.get(); + } + cli::Value* getValue(const std::string& key) + { + auto const p = mValues.find(key); + if (p == mValues.end()) + { + const std::string errorMessage = "No argument named " + key; + throw except::NoSuchKeyException(Ctxt(errorMessage)); + } + return p->second.get(); } template @@ -96,15 +114,22 @@ class Results return p->second; } - void put(const std::string& key, cli::Value *value) + void put(const std::string& key, std::unique_ptr value) + { + if (hasValue(key) && (getValue(key) == value.get())) + { + return; + } + mValues[key] = std::move(value); + } + void put(const std::string& key, cli::Value* value) { - if (hasValue(key)) + cli::Value* pExistingValue = hasValue(key) ? getValue(key) : nullptr; + if ((pExistingValue == nullptr) || (pExistingValue != value)) { - cli::Value* existing = getValue(key); - if (existing != value) - delete getValue(key); + // Either 1) we didn't already have a value or 2) the existing value is different + put(key, std::unique_ptr(value)); } - mValues[key] = value; } void put(const std::string& key, cli::Results *args) @@ -118,30 +143,25 @@ class Results mResults[key] = args; } - typedef ValueStorage_T::iterator iterator; - typedef ValueStorage_T::const_iterator const_iterator; - - iterator begin() { return mValues.begin(); } - const_iterator begin() const { return mValues.begin(); } - iterator end() { return mValues.end(); } - const_iterator end() const { return mValues.end(); } + auto begin() { return mValues.begin(); } + auto begin() const { return mValues.begin(); } + auto end() { return mValues.end(); } + auto end() const { return mValues.end(); } -protected: +private: ValueStorage_T mValues; ResultsStorage_T mResults; void destroy() { - for (ValueIter_T it = mValues.begin(), end = mValues.end(); it != end; ++it) - delete it->second; + mValues.clear(); for (ResultsIter_T it = mResults.begin(), end = mResults.end(); it != end; ++it) delete it->second; - mValues.clear(); mResults.clear(); } }; } -#endif +#endif // CODA_OSS_cli_Results_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/cli/include/cli/Value.h b/externals/coda-oss/modules/c++/cli/include/cli/Value.h index f47e8e0a1b..49f1125ebd 100644 --- a/externals/coda-oss/modules/c++/cli/include/cli/Value.h +++ b/externals/coda-oss/modules/c++/cli/include/cli/Value.h @@ -20,13 +20,16 @@ * */ -#ifndef __CLI_VALUE_H__ -#define __CLI_VALUE_H__ +#pragma once +#ifndef CODA_OSS_cli_Value_h_INCLUDED_ +#define CODA_OSS_cli_Value_h_INCLUDED_ -#include -#include +#include #include +#include +#include +#include "sys/Conf.h" #include "config/Exports.h" namespace cli @@ -36,12 +39,9 @@ namespace cli * The Value class provides access to one or more actual values. * It provides index-based access to parameters. */ -class CODA_OSS_API Value +struct CODA_OSS_API Value final { -public: - Value() - { - } + Value() = default; template explicit Value(std::vector value) @@ -55,12 +55,6 @@ class CODA_OSS_API Value set(value); } - template - Value(T* value, size_t size, bool own = false) - { - set(value, size, own); - } - ~Value() { cleanup(); @@ -73,17 +67,6 @@ class CODA_OSS_API Value mValues.push_back(str::toString(value)); } - template - void set(T* value, size_t size, bool own = false) - { - cleanup(); - mValues.reserve(size); - for (size_t i = 0; i < size; ++i) - add(value[i]); - if (own) - delete[] value; - } - template void setContainer(const std::vector& c) { @@ -104,10 +87,7 @@ class CODA_OSS_API Value { if (index >= mValues.size()) throw except::IndexOutOfRangeException( - Ctxt( - FmtX( - "Invalid index: %d", - index))); + Ctxt(str::Format("Invalid index: %d", index))); return str::toType(mValues[index]); } @@ -163,4 +143,4 @@ class CODA_OSS_API Value }; } -#endif +#endif // CODA_OSS_cli_Value_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/cli/source/Argument.cpp b/externals/coda-oss/modules/c++/cli/source/Argument.cpp index 11c541a2c2..8b924f30a7 100644 --- a/externals/coda-oss/modules/c++/cli/source/Argument.cpp +++ b/externals/coda-oss/modules/c++/cli/source/Argument.cpp @@ -19,11 +19,14 @@ * see . * */ - #include "cli/Argument.h" -#include "cli/ArgumentParser.h" + #include +#include + +#include "cli/ArgumentParser.h" + cli::Argument::Argument(const std::string& nameOrFlags, cli::ArgumentParser* parser): mParser(parser) { @@ -51,7 +54,7 @@ cli::Argument::~Argument() cli::Argument* cli::Argument::addFlag(const std::string& flag) { char p = mParser->mPrefixChar; - std::string p2 = FmtX("%c%c", p, p); + std::string p2 = str::Format("%c%c", p, p); if (flag.size() > 2 && str::startsWith(flag, p2) && flag[2] != p) mLongFlags.push_back(validateFlag(flag.substr(2))); else if (flag.size() > 1 && flag[0] == p && flag[1] != p) diff --git a/externals/coda-oss/modules/c++/cli/source/ArgumentParser.cpp b/externals/coda-oss/modules/c++/cli/source/ArgumentParser.cpp index be702484ef..e6c8fb4442 100644 --- a/externals/coda-oss/modules/c++/cli/source/ArgumentParser.cpp +++ b/externals/coda-oss/modules/c++/cli/source/ArgumentParser.cpp @@ -24,13 +24,15 @@ #include #include +#include #include #include +#include namespace { -static const size_t MAX_ARG_LINE_LENGTH = 21; +constexpr size_t MAX_ARG_LINE_LENGTH = 21; bool containsOnly(const std::string& str, const std::map& flags) @@ -283,6 +285,20 @@ cli::Results* cli::ArgumentParser::parse(const std::vector& args) return parse("cli::ArgumentParser::parse" /*program*/, args).release(); // provide a "meaningful" default program name } } + +static auto put(cli::Results& currentResults, const std::string& argVar, + cli::Value* v, std::unique_ptr&& v_) +{ + if (v == v_.get()) // no existing value, using the newly created std::unique_ptr + { + currentResults.put(argVar, std::move(v_)); + } + else + { + currentResults.put(argVar, v); // already had a value, just update + } +} + std::unique_ptr cli::ArgumentParser::parse(const std::string& program, const std::vector& args) { if (!program.empty()) @@ -317,8 +333,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog std::map& flagMap = (subOption ? shortOptionsFlags : shortFlags); if (flagMap.find(op) != flagMap.end()) - parseError(FmtX("Conflicting option: %c%s", mPrefixChar, - op.c_str())); + parseError(str::Format("Conflicting option: %c%s", mPrefixChar, op)); flagMap[op] = arg; } for (std::vector::const_iterator it = @@ -328,8 +343,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog std::map& flagMap = (subOption ? longOptionsFlags : longFlags); if (flagMap.find(op) != flagMap.end()) - parseError(FmtX("Conflicting option: %c%c%s", mPrefixChar, - mPrefixChar, op.c_str())); + parseError(str::Format("Conflicting option: %c%c%s", mPrefixChar, mPrefixChar, op)); flagMap[op] = arg; } } @@ -458,8 +472,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog } else { - throw except::Exception(Ctxt( - FmtX("Invalid option: [%s]", argStr.c_str()))); + throw except::Exception(Ctxt(str::Format("Invalid option: [%s]", argStr))); } } } @@ -500,8 +513,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog } else { - throw except::Exception(Ctxt( - FmtX("Invalid option: [%s]", argStr.c_str()))); + throw except::Exception(Ctxt(str::Format("Invalid option: [%s]", argStr))); } } @@ -516,9 +528,8 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog { case cli::STORE: { - cli::Value* v = currentResults->hasValue(argVar) - ? currentResults->getValue(argVar) - : new cli::Value; + auto v_ = std::make_unique(); + auto v = currentResults->hasValue(argVar) ? currentResults->getValue(argVar) : v_.get(); int maxArgs = arg->getMaxArgs(); // risky, I know... bool added = false; @@ -537,8 +548,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog break; } } - if (maxArgs >= 0 && - v->size() >= static_cast(maxArgs)) + if (maxArgs >= 0 && std::ssize(*v) >= maxArgs) { // it's another positional argument, so we break out break; @@ -549,19 +559,16 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog } if (!added) - parseError( - FmtX( - "option requires value or has exceeded its max: [%s]", - argVar.c_str())); + parseError(str::Format("option requires value or has exceeded its max: [%s]", argVar)); - currentResults->put(argVar, v); + put(*currentResults, argVar, v, std::move(v_)); break; } case cli::STORE_TRUE: - currentResults->put(argVar, new cli::Value(true)); + currentResults->put(argVar, std::make_unique(true)); break; case cli::STORE_FALSE: - currentResults->put(argVar, new cli::Value(false)); + currentResults->put(argVar, std::make_unique(false)); break; case cli::STORE_CONST: { @@ -572,10 +579,10 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog case cli::SUB_OPTIONS: { if (optionsStr.empty()) - parseError(FmtX("invalid sub option: [%s]", argVar.c_str())); - cli::Value* v = currentResults->hasValue(optionsStr) - ? currentResults->getValue(optionsStr) - : new cli::Value; + parseError(str::Format("invalid sub option: [%s]", argVar)); + + auto v_ = std::make_unique(); + auto v = currentResults->hasValue(optionsStr) ? currentResults->getValue(optionsStr) : v_.get(); if (i < s - 1) { std::string nextArg = explodedArgs[i + 1]; @@ -596,7 +603,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog // this indicates the sub op is a bool v->add(true); } - currentResults->put(optionsStr, v); + put(*currentResults, optionsStr, v, std::move(v_)); break; } case cli::VERSION: @@ -608,24 +615,22 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog { // it's a positional argument cli::Value* lastPosVal = nullptr; - for (std::vector::iterator it = - positionalArgs.begin(); it != positionalArgs.end(); ++it) + for (auto&& posArg : positionalArgs) { - cli::Argument *posArg = *it; std::string argVar = posArg->getVariable(); int maxArgs = posArg->getMaxArgs(); if (currentResults->hasValue(argVar)) { - cli::Value *posVal = lastPosVal - = currentResults->getValue(argVar); - if (static_cast(posVal->size()) >= maxArgs) + lastPosVal = currentResults->getValue(argVar); + if (gsl::narrow(lastPosVal->size()) >= maxArgs) continue; break; } else if (maxArgs != 0) { - lastPosVal = new cli::Value; - currentResults->put(argVar, lastPosVal); + auto lastPosVal_ = std::make_unique(); + lastPosVal = lastPosVal_.get(); + currentResults->put(argVar, std::move(lastPosVal_)); break; } } @@ -658,12 +663,11 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog if (defaultVal != nullptr) results->put(argVar, defaultVal->clone()); else if (arg->getAction() == cli::STORE_FALSE) - results->put(argVar, new cli::Value(true)); + results->put(argVar, std::make_unique(true)); else if (arg->getAction() == cli::STORE_TRUE) - results->put(argVar, new cli::Value(false)); + results->put(argVar, std::make_unique(false)); else if (arg->isRequired()) - parseError(FmtX("missing required argument: [%s]", - argVar.c_str())); + parseError(str::Format("missing required argument: [%s]", argVar)); } @@ -677,11 +681,9 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog if (arg->isRequired() || numGiven > 0) { if (minArgs > 0 && numGiven < static_cast(minArgs)) - parseError(FmtX("not enough arguments, %d required: [%s]", - minArgs, argId.c_str())); + parseError(str::Format("not enough arguments, %d required: [%s]", minArgs, argId)); if (maxArgs >= 0 && numGiven > static_cast(maxArgs)) - parseError(FmtX("too many arguments, %d supported: [%s]", - maxArgs, argId.c_str())); + parseError(str::Format("too many arguments, %d supported: [%s]", maxArgs, argId)); } @@ -691,7 +693,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog if (numGiven > 0 && !choices.empty()) { bool isValid = false; - cli::Value *vals = results->getValue(argVar); + auto vals = results->getValue(argVar); for (size_t ii = 0; ii < numGiven; ++ii) { @@ -704,7 +706,7 @@ std::unique_ptr cli::ArgumentParser::parse(const std::string& prog } if (!isValid) { - parseError(FmtX("invalid option for [%s]", argVar.c_str())); + parseError(str::Format("invalid option for [%s]", argVar)); } } } diff --git a/externals/coda-oss/modules/c++/cli/unittests/test_cli.cpp b/externals/coda-oss/modules/c++/cli/unittests/test_cli.cpp index 62fa2192f9..288df201a6 100644 --- a/externals/coda-oss/modules/c++/cli/unittests/test_cli.cpp +++ b/externals/coda-oss/modules/c++/cli/unittests/test_cli.cpp @@ -20,12 +20,16 @@ * */ +#include + +#include +#include +#include + #include #include + #include "TestCase.h" -#include -#include -#include TEST_CASE(testValue) { @@ -41,7 +45,7 @@ TEST_CASE(testValue) for(int i = 0; i < 10; ++i) { floats.push_back(10.0f * i); - strings.push_back(str::toString(i)); + strings.push_back(std::to_string(i)); } // floats @@ -50,15 +54,15 @@ TEST_CASE(testValue) { TEST_ASSERT_ALMOST_EQ(v.at(i), 10.0f * i); } - TEST_ASSERT_EQ(v.size(), static_cast(10)); + TEST_ASSERT_EQ(std::ssize(v), 10); // strings v.setContainer(strings); for(int i = 0; i < 10; ++i) { - TEST_ASSERT_EQ(v.at(i), str::toString(i)); + TEST_ASSERT_EQ(v.at(i), std::to_string(i)); } - TEST_ASSERT_EQ(v.size(), static_cast(10)); + TEST_ASSERT_EQ(std::ssize(v), 10); } TEST_CASE(testChoices) @@ -156,9 +160,9 @@ TEST_CASE(testIterate) std::unique_ptr results(parser.parse(str::split("-v -c config.xml"))); std::vector keys; - for(cli::Results::const_iterator it = results->begin(); it != results->end(); ++it) + for(auto it = results->begin(); it != results->end(); ++it) keys.push_back(it->first); - TEST_ASSERT_EQ(keys.size(), static_cast(2)); + TEST_ASSERT_EQ(std::ssize(keys), 2); // std::map returns keys in alphabetical order... TEST_ASSERT_EQ(keys[0], "config"); TEST_ASSERT_EQ(keys[1], "verbose"); @@ -168,16 +172,25 @@ TEST_CASE(testRequired) { cli::ArgumentParser parser; parser.setProgram("tester"); - parser.addArgument("-v --verbose", "Toggle verbose", cli::STORE_TRUE); parser.addArgument("-c --config", "Specify a config file", cli::STORE)->setRequired(true); const std::string program(testName); - TEST_EXCEPTION(parser.parse(program, str::split(""))); - TEST_EXCEPTION(parser.parse(program, str::split("-c"))); const auto results = parser.parse(program, str::split("-c configFile")); TEST_ASSERT_EQ(results->get("config"), "configFile"); } +TEST_CASE(testRequiredThrows) +{ + cli::ArgumentParser parser; + parser.setProgram("tester"); + parser.addArgument("-c --config", "Specify a config file", cli::STORE) + ->setRequired(true); + + const std::string program(testName); + TEST_EXCEPTION(parser.parse(program, str::split(""))); + TEST_EXCEPTION(parser.parse(program, str::split("-c"))); +} + TEST_CASE(testUnknownArgumentsOptions) { std::ostringstream outStream; @@ -254,6 +267,7 @@ TEST_MAIN( TEST_CHECK( testSubOptions); TEST_CHECK( testIterate); TEST_CHECK( testRequired); + TEST_CHECK( testRequiredThrows); TEST_CHECK( testUnknownArgumentsOptions); ) diff --git a/externals/coda-oss/modules/c++/coda-oss.ruleset b/externals/coda-oss/modules/c++/coda-oss.ruleset index 0da8c00a63..19ab93d378 100644 --- a/externals/coda-oss/modules/c++/coda-oss.ruleset +++ b/externals/coda-oss/modules/c++/coda-oss.ruleset @@ -1,699 +1,699 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/coda-oss.vcxproj b/externals/coda-oss/modules/c++/coda-oss.vcxproj index 6dc5c0fc65..e2b2a306dc 100644 --- a/externals/coda-oss/modules/c++/coda-oss.vcxproj +++ b/externals/coda-oss/modules/c++/coda-oss.vcxproj @@ -1,639 +1,626 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - true - - - - 16.0 - Win32Proj - {9997e895-5161-4ddf-8f3f-099894cb2f21} - codaoss - 10.0 - coda-oss - - - - DynamicLibrary - true - v143 - - - DynamicLibrary - false - v143 - true - - - - - - - - - - - - - - - true - true - coda-oss.ruleset - - - false - coda-oss.ruleset - - - - EnableAllWarnings - true - _DEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL;MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1 - pch.h - cli\include;coda_oss\include;config\include;dbi\include;except\include;gsl\include;hdf5.lite\include;io\include;logging\include;math\include;math.linear\include;math.poly\include;mem\include;mt\include;net\include;net.ssl\include;plugin\include;polygon\include;re\include;sio.lite\include;std\include;str\include;sys\include;tiff\include;types\include;unique\include;units\include;xml.lite\include;zip\include;$(ProjectDir)include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\include - Use - pch.h - true - Guard - ProgramDatabase - true - true - true - /Zc:__cplusplus %(AdditionalOptions) - true - AdvancedVectorExtensions2 - MultiThreadedDebugDLL - true - MultiThreadedDebugDLL - - - - - true - $(SolutionDir)\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)\externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\lib - rpcrt4.lib;%(AdditionalDependencies) - - - - - Level3 - true - true - true - NDEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL;MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1 - pch.h - cli\include;coda_oss\include;config\include;dbi\include;except\include;gsl\include;hdf5.lite\include;io\include;logging\include;math\include;math.linear\include;math.poly\include;mem\include;mt\include;net\include;net.ssl\include;plugin\include;polygon\include;re\include;sio.lite\include;std\include;str\include;sys\include;tiff\include;types\include;unique\include;units\include;xml.lite\include;zip\include;$(ProjectDir)include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\include - Use - pch.h - true - Guard - true - true - true - /Zc:__cplusplus %(AdditionalOptions) - AdvancedVectorExtensions2 - - - - - true - true - true - $(SolutionDir)\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)\externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\lib - rpcrt4.lib;%(AdditionalDependencies) - - - - - + + + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + 16.0 + Win32Proj + {9997e895-5161-4ddf-8f3f-099894cb2f21} + codaoss + 10.0 + coda-oss + + + + DynamicLibrary + true + v143 + + + DynamicLibrary + false + v143 + true + + + + + + + + + + + + + + + true + true + coda-oss.ruleset + + + false + coda-oss.ruleset + + + + EnableAllWarnings + true + _DEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL;MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1 + pch.h + cli\include;coda_oss\include;config\include;dbi\include;except\include;gsl\include;hdf5.lite\include;io\include;logging\include;math\include;math.linear\include;math.poly\include;mem\include;mt\include;net\include;net.ssl\include;plugin\include;polygon\include;re\include;sio.lite\include;std\include;str\include;sys\include;tiff\include;types\include;unique\include;units\include;xml.lite\include;zip\include;$(ProjectDir)include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\include + Use + pch.h + true + Guard + ProgramDatabase + true + true + true + /Zc:__cplusplus %(AdditionalOptions) + true + AdvancedVectorExtensions2 + MultiThreadedDebugDLL + true + + + + + true + $(SolutionDir)\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)\externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\lib + rpcrt4.lib;%(AdditionalDependencies) + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions);CODA_OSS_EXPORTS;CODA_OSS_DLL;MT_DEFAULT_PINNING=0;RE_ENABLE_STD_REGEX=1 + pch.h + cli\include;coda_oss\include;config\include;dbi\include;except\include;gsl\include;hdf5.lite\include;io\include;logging\include;math\include;math.linear\include;math.poly\include;mem\include;mt\include;net\include;net.ssl\include;plugin\include;polygon\include;re\include;sio.lite\include;std\include;str\include;sys\include;tiff\include;types\include;unique\include;units\include;xml.lite\include;zip\include;$(ProjectDir)include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\include + Use + pch.h + true + Guard + true + true + true + /Zc:__cplusplus %(AdditionalOptions) + AdvancedVectorExtensions2 + + + + + true + true + true + $(SolutionDir)\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)\externals\$(ProjectName)\out\install\$(Platform)-$(Configuration)\lib + rpcrt4.lib;%(AdditionalDependencies) + + + + + \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters b/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters index adb5a57f71..50db461753 100644 --- a/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters +++ b/externals/coda-oss/modules/c++/coda-oss.vcxproj.filters @@ -1,1599 +1,1563 @@ - - - - - - - config - - - config - - - gsl - - - gsl - - - gsl - - - gsl - - - coda_oss - - - coda_oss - - - coda_oss - - - coda_oss - - - coda_oss - - - coda_oss - - - coda_oss - - - coda_oss - - - coda_oss - - - coda_oss - - - except - - - except - - - except - - - except - - - except - - - except - - - except - - - str - - - str - - - str - - - str - - - str - - - str - - - str - - - str - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - types - - - types - - - types - - - types - - - types - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - mem - - - math - - - math - - - math - - - math - - - math - - - units - - - units - - - units - - - math.linear - - - math.linear - - - math.linear - - - math.linear - - - math.linear - - - math.linear - - - math.poly - - - math.poly - - - math.poly - - - math.poly - - - math.poly - - - math.poly - - - math.poly - - - math.poly - - - polygon - - - polygon - - - polygon - - - config - - - include - - - cli - - - cli - - - cli - - - cli - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - avx - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - re - - - re - - - re - - - sio.lite - - - sio.lite - - - sio.lite - - - sio.lite - - - sio.lite - - - sio.lite - - - sio.lite - - - sio.lite - - - sio.lite - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - sio.lite - - - sio.lite - - - plugin - - - plugin - - - plugin - - - sys - - - mem - - - mem - - - std - - - config - - - sys - - - sys - - - mt - - - sys - - - sys - - - types - - - coda_oss - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - zip - - - zip - - - zip - - - zip - - - zip - - - zip - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - dbi - - - dbi - - - dbi - - - dbi - - - dbi - - - dbi - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net.ssl - - - net.ssl - - - net.ssl - - - net.ssl - - - unique - - - unique - - - hdf5.lite - - - xml.lite - - - hdf5.lite - - - mt - - - include - - - - - - except - - - except - - - except - - - except - - - str - - - str - - - str - - - str - - - str - - - str - - - str - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - sys - - - types - - - types - - - mem - - - mem - - - math - - - math - - - math - - - math.linear - - - polygon - - - cli - - - cli - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - io - - - mt - - - mt - - - mt - - - mt - - - mt - - - mt - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - logging - - - re - - - re - - - sio.lite - - - sio.lite - - - sio.lite - - - sio.lite - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - tiff - - - plugin - - - sys - - - sys - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - hdf5.lite - - - zip - - - zip - - - zip - - - zip - - - zip - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - xml.lite - - - dbi - - - dbi - - - dbi - - - dbi - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net - - - net.ssl - - - net.ssl - - - unique - - - - - {89602880-5929-45e9-a603-d13f81972397} - - - {619ad1da-f21c-4027-9b5d-23f08225b96f} - - - {59f3d9a1-06d3-4779-aef2-cc55223c3017} - - - {3051f4b6-dad4-47ea-b4bd-d25d9e09f782} - - - {44a8dfa7-099c-4dd5-87b6-3b05ce13580b} - - - {d714ac63-ef19-4629-a13f-59b550604842} - - - {d8059280-e435-4365-be67-865195b9e813} - - - {3613caf2-18d1-4af7-bfa0-a3712a44da45} - - - {0e318d08-1ee3-4644-a299-a81e436c9a32} - - - {6d8f380f-54e3-4d0d-bd1a-a2edd0efbaa7} - - - {1bf84676-4c62-4e2b-b943-59bf82f89126} - - - {b3d7f0e3-2e9f-4a19-b181-27cace7536c0} - - - {15f9b62f-d17e-4d84-bc34-de6fd5fbcb33} - - - {f2544ccb-0933-44c7-af39-cd986982af3d} - - - {9050a469-23a5-4da0-92b1-a07a8e52e9fc} - - - {de76f131-1cd6-4c3d-aa9c-37ca3b5079f0} - - - {cc681a99-da96-483e-a92a-eab0ea3a0ec0} - - - {4875d8c0-f285-460a-98a9-38a60f3fcffd} - - - {9720bf2c-6d77-4685-9318-d6e714065c99} - - - {9f9acff4-c149-4908-ae9d-67557974f4ee} - - - {83ae731c-66f7-468c-bc71-7cb57a363b5b} - - - {327a7b72-9a2d-48e4-9c23-2b5b9d2f3519} - - - {d76b6d3f-51f8-4cf8-bc56-35f720080a8b} - - - {387bc6cb-323a-42b3-8502-4fac72586d12} - - - {e4db8b19-0870-4cb2-af64-14b928c68725} - - - {a2682912-3963-489a-9cf0-c5224b27eb84} - - - {1bb6daf3-40dd-44d8-8680-0e77e2c3bd17} - - - {13c98009-f1f9-4297-a2b3-bde23f3bea55} - - - {6575592b-9b28-49eb-be76-27f40825475e} - - - {21ddb4b6-54a2-4618-81ed-4fbbf37b30de} - - - {79aa73a7-ed0d-4826-b7ed-c8d91d96998a} - - - - - gsl - - - gsl - - - gsl - - - gsl - - - gsl - - - gsl - - - gsl - - - gsl - - - gsl - - - gsl - - - std - - - std - - - std - - - std - - - std - - - std - - - std - - - std - - - sys - - - std - - - - sys - - + + + + + + + config + + + config + + + gsl + + + gsl + + + gsl + + + gsl + + + coda_oss + + + coda_oss + + + coda_oss + + + coda_oss + + + coda_oss + + + coda_oss + + + coda_oss + + + coda_oss + + + coda_oss + + + coda_oss + + + except + + + except + + + except + + + except + + + except + + + except + + + except + + + str + + + str + + + str + + + str + + + str + + + str + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + types + + + types + + + types + + + types + + + types + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + mem + + + math + + + math + + + math + + + math + + + math + + + units + + + units + + + units + + + math.linear + + + math.linear + + + math.linear + + + math.linear + + + math.linear + + + math.linear + + + math.poly + + + math.poly + + + math.poly + + + math.poly + + + math.poly + + + math.poly + + + math.poly + + + math.poly + + + polygon + + + polygon + + + polygon + + + config + + + include + + + cli + + + cli + + + cli + + + cli + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + avx + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + re + + + re + + + re + + + sio.lite + + + sio.lite + + + sio.lite + + + sio.lite + + + sio.lite + + + sio.lite + + + sio.lite + + + sio.lite + + + sio.lite + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + sio.lite + + + sio.lite + + + plugin + + + plugin + + + plugin + + + sys + + + mem + + + std + + + config + + + sys + + + sys + + + mt + + + sys + + + sys + + + types + + + coda_oss + + + hdf5.lite + + + hdf5.lite + + + hdf5.lite + + + zip + + + zip + + + zip + + + zip + + + zip + + + zip + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + dbi + + + dbi + + + dbi + + + dbi + + + dbi + + + dbi + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net.ssl + + + net.ssl + + + net.ssl + + + net.ssl + + + unique + + + unique + + + hdf5.lite + + + xml.lite + + + mt + + + include + + + hdf5.lite + + + mem + + + str + + + + + + except + + + except + + + except + + + except + + + str + + + str + + + str + + + str + + + str + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + sys + + + types + + + types + + + mem + + + mem + + + math + + + math + + + math + + + math.linear + + + polygon + + + cli + + + cli + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + io + + + mt + + + mt + + + mt + + + mt + + + mt + + + mt + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + logging + + + re + + + re + + + sio.lite + + + sio.lite + + + sio.lite + + + sio.lite + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + tiff + + + plugin + + + sys + + + sys + + + hdf5.lite + + + zip + + + zip + + + zip + + + zip + + + zip + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + xml.lite + + + dbi + + + dbi + + + dbi + + + dbi + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net + + + net.ssl + + + net.ssl + + + unique + + + + + {89602880-5929-45e9-a603-d13f81972397} + + + {619ad1da-f21c-4027-9b5d-23f08225b96f} + + + {3051f4b6-dad4-47ea-b4bd-d25d9e09f782} + + + {44a8dfa7-099c-4dd5-87b6-3b05ce13580b} + + + {d714ac63-ef19-4629-a13f-59b550604842} + + + {d8059280-e435-4365-be67-865195b9e813} + + + {3613caf2-18d1-4af7-bfa0-a3712a44da45} + + + {0e318d08-1ee3-4644-a299-a81e436c9a32} + + + {6d8f380f-54e3-4d0d-bd1a-a2edd0efbaa7} + + + {1bf84676-4c62-4e2b-b943-59bf82f89126} + + + {b3d7f0e3-2e9f-4a19-b181-27cace7536c0} + + + {15f9b62f-d17e-4d84-bc34-de6fd5fbcb33} + + + {f2544ccb-0933-44c7-af39-cd986982af3d} + + + {9050a469-23a5-4da0-92b1-a07a8e52e9fc} + + + {de76f131-1cd6-4c3d-aa9c-37ca3b5079f0} + + + {cc681a99-da96-483e-a92a-eab0ea3a0ec0} + + + {4875d8c0-f285-460a-98a9-38a60f3fcffd} + + + {9720bf2c-6d77-4685-9318-d6e714065c99} + + + {9f9acff4-c149-4908-ae9d-67557974f4ee} + + + {83ae731c-66f7-468c-bc71-7cb57a363b5b} + + + {327a7b72-9a2d-48e4-9c23-2b5b9d2f3519} + + + {d76b6d3f-51f8-4cf8-bc56-35f720080a8b} + + + {387bc6cb-323a-42b3-8502-4fac72586d12} + + + {e4db8b19-0870-4cb2-af64-14b928c68725} + + + {a2682912-3963-489a-9cf0-c5224b27eb84} + + + {1bb6daf3-40dd-44d8-8680-0e77e2c3bd17} + + + {13c98009-f1f9-4297-a2b3-bde23f3bea55} + + + {6575592b-9b28-49eb-be76-27f40825475e} + + + {21ddb4b6-54a2-4618-81ed-4fbbf37b30de} + + + {79aa73a7-ed0d-4826-b7ed-c8d91d96998a} + + + {59f3d9a1-06d3-4779-aef2-cc55223c3017} + + + + + gsl + + + gsl + + + gsl + + + gsl + + + gsl + + + gsl + + + gsl + + + gsl + + + gsl + + + gsl + + + std + + + std + + + std + + + std + + + std + + + std + + + std + + + std + + + sys + + + std + + + + sys + + \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h index b912e9c3e7..ab528a085b 100644 --- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h +++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/CPlusPlus.h @@ -20,9 +20,9 @@ * */ +#pragma once #ifndef CODA_OSS_coda_oss_CPlusPlus_h_INCLUDED_ #define CODA_OSS_coda_oss_CPlusPlus_h_INCLUDED_ -#pragma once #ifdef CODA_OSS_cplusplus #error "CODA_OSS_cplusplus already #define'd." @@ -33,18 +33,28 @@ #endif #define CODA_OSS_cplusplus __cplusplus -#if CODA_OSS_cplusplus < 201103L // We need at least C++11 +// There are now enough C++ versions that it's a pain to keep track of the values +// https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros +#define CODA_OSS_cplusplus11 201103L +#define CODA_OSS_cplusplus14 201402L +#define CODA_OSS_cplusplus17 201703L +#define CODA_OSS_cplusplus20 202002L +#define CODA_OSS_cplusplus23 202302L + +#if CODA_OSS_cplusplus < CODA_OSS_cplusplus11 #undef CODA_OSS_cplusplus // oops...try to fix // MSVC only sets __cplusplus >199711L with the /Zc:__cplusplus command-line option. // https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ - #if defined(_MSVC_LANG) - // https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-160 - // "Defined as an integer literal that specifies the C++ language standard targeted by the compiler." - #define CODA_OSS_cplusplus _MSVC_LANG - #elif defined(_MSC_VER) - #error "_MSVC_LANG should be #define'd." - #endif // _MSVC_LANG + #if defined(_MSC_VER) + #if defined(_MSVC_LANG) + // https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-160 + // "Defined as an integer literal that specifies the C++ language standard targeted by the compiler." + #define CODA_OSS_cplusplus _MSVC_LANG + #else + #error "_MSVC_LANG should be #define'd." + #endif + #endif // _MSC_VER #if defined(__GNUC__) #endif // __GNUC__ @@ -53,25 +63,41 @@ #endif // __INTEL_COMPILER #endif // CODA_OSS_cplusplus -#if CODA_OSS_cplusplus < 202002L - // oops ... try to fix +#if CODA_OSS_cplusplus < CODA_OSS_cplusplus20 #if defined(__GNUC__) && (__cplusplus >= 201709L) // note > C++ 17 of 201703L - // Enough C++20 for our needs + // Enough C++20 for our much of our needs ... + // at least with std/ and coda_oss/ library support. #undef CODA_OSS_cplusplus - #define CODA_OSS_cplusplus 202002L + #define CODA_OSS_cplusplus CODA_OSS_cplusplus20 #endif #endif // CODA_OSS_cplusplus // Define a few macros as that's less verbose than testing against a version number -// https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros -#define CODA_OSS_cpp11 (CODA_OSS_cplusplus >= 201103L) -#define CODA_OSS_cpp14 (CODA_OSS_cplusplus >= 201402L) -#define CODA_OSS_cpp17 (CODA_OSS_cplusplus >= 201703L) -#define CODA_OSS_cpp20 (CODA_OSS_cplusplus >= 202002L) -#define CODA_OSS_cpp23 (CODA_OSS_cplusplus >= 202302L) +#define CODA_OSS_cpp11 (CODA_OSS_cplusplus >= CODA_OSS_cplusplus11) +#define CODA_OSS_cpp14 (CODA_OSS_cplusplus >= CODA_OSS_cplusplus14) +#define CODA_OSS_cpp17 (CODA_OSS_cplusplus >= CODA_OSS_cplusplus17) +#define CODA_OSS_cpp20 (CODA_OSS_cplusplus >= CODA_OSS_cplusplus20) +#define CODA_OSS_cpp23 (CODA_OSS_cplusplus >= CODA_OSS_cplusplus23) #if !CODA_OSS_cpp14 #error "Must compile with C++14 or greater." #endif +// Get feature-testing macros: https://en.cppreference.com/w/cpp/feature_test +#if CODA_OSS_cpp17 // C++17 for __has_include + #if !CODA_OSS_cpp20 + // "error C4996: '...': warning STL4036: is removed in C++20. You can define _SILENCE_CXX20_CISO646_REMOVED_WARNING or _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS to suppress this warning." + + // https://en.cppreference.com/w/cpp/header/version + // "Prior to C++20, including is sometimes used for this purpose." + #if __has_include() + #include + #endif + #endif // !CODA_OSS_cpp20 + + #if __has_include() + #include + #endif +#endif // CODA_OSS_cpp17 + #endif // CODA_OSS_coda_oss_CPlusPlus_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h index 0079457ae4..f1fab3a0b1 100644 --- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h +++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional.h @@ -18,17 +18,38 @@ * License along with this program; If not, http://www.gnu.org/licenses/. * */ +#pragma once #ifndef CODA_OSS_coda_oss_optional_h_INCLUDED_ #define CODA_OSS_coda_oss_optional_h_INCLUDED_ -#pragma once -#include "coda_oss/namespace_.h" +#include "coda_oss/CPlusPlus.h" + +// This logic needs to be here rather than so that `coda_oss::optional` will +// be the same as `std::optional`. +#ifndef CODA_OSS_HAVE_std_optional_ + #define CODA_OSS_HAVE_std_optional_ 0 // assume no +#endif +#if CODA_OSS_cpp17 // C++17 for `__has_include()` + #if __has_include() // __cpp_lib_optional not until C++20 + #include + #undef CODA_OSS_HAVE_std_optional_ + #define CODA_OSS_HAVE_std_optional_ 1 // provided by the implementation, probably C++17 + #endif +#endif // CODA_OSS_cpp17 + +#if !CODA_OSS_HAVE_std_optional_ #include "coda_oss/optional_.h" +#endif namespace coda_oss { - using details::optional; - using details::make_optional; + #if CODA_OSS_HAVE_std_optional_ + using std::optional; + using std::make_optional; + #else + using details::optional; + using details::make_optional; + #endif } #endif // CODA_OSS_coda_oss_optional_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional_.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional_.h index 8aa35e198d..ea9ccf1bc5 100644 --- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional_.h +++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/optional_.h @@ -18,9 +18,10 @@ * License along with this program; If not, http://www.gnu.org/licenses/. * */ + +#pragma once #ifndef CODA_OSS_coda_oss_optional__h_INCLUDED_ #define CODA_OSS_coda_oss_optional__h_INCLUDED_ -#pragma once #include @@ -28,27 +29,21 @@ #include // Simple version of std::optional since that doesn't exist until C++17. -// -// This doesn't even TRY to match the actual C++17 specification, -// it only tries to minimize code changes. -// // http://en.cppreference.com/w/cpp/utility/Optional -#include "coda_oss/namespace_.h" namespace coda_oss { namespace details { inline void throw_bad_optional_access() { - throw std::logic_error( - "No value for optional<>."); // TODO: std::bad_optional_access + throw std::logic_error("No value for optional<>."); // TODO: std::bad_optional_access } template class optional final { - T value_; + T value_{}; bool has_value_ = false; void check_has_value() const @@ -62,61 +57,81 @@ class optional final public: using value_type = T; -#if defined(_MSC_VER) && _PREFAST_ // Visual Studio /analyze - __pragma(warning(push)) __pragma(warning(disable : 26495)) // Variable '...' is uninitialized. Always initialize a member variable(type.6). -#endif optional() noexcept { } -#if defined(_MSC_VER) && _PREFAST_ - __pragma(warning(pop)) -#endif optional(const value_type& v) : value_(v), has_value_(true) { } -#if defined(_MSC_VER) && _PREFAST_ // Visual Studio /analyze - __pragma(warning(push)) __pragma(warning(disable : 26495)) // Variable '...' is uninitialized. Always initialize a member variable(type.6). -#endif - optional(const optional& other) : has_value_(other.has_value_) + optional(value_type&& v) : value_(std::move(v)), has_value_(true) { - if (has_value()) - { - value_ = other.value_; - } } -#if defined(_MSC_VER) && _PREFAST_ - __pragma(warning(pop)) -#endif - optional& operator=(const optional& other) - { - if (has_value() && !other.has_value()) - { - reset(); - } - else if (other.has_value()) - { - value_ = other.value_; - has_value_ = true; - } - - return *this; + optional(const optional& other) + { + *this = other; } - - template // https://en.cppreference.com/w/cpp/utility/Optional/emplace - T& emplace(Args&&... args) + optional(optional&& other) noexcept { - value_ = value_type(std::forward(args)...); - has_value_ = true; - return value_; + *this = std::move(other); + } + template + explicit optional(const optional& other) + { + *this = other; + } + template + explicit optional(optional&& other) + { + *this = std::forward>(other); + } + template + explicit optional(U&& value) + { + *this = std::forward(value); } - template // https://en.cppreference.com/w/cpp/utility/optional/operator%3D + // https://en.cppreference.com/w/cpp/utility/optional/operator%3D + optional& operator=(const optional& other) + { + value_ = other.value_; + has_value_ = other.has_value_; + return *this; + } + optional& operator=(optional&& other) noexcept + { + value_ = std::move(other.value_); + has_value_ = std::move(other.has_value_); + return *this; + } + template optional& operator=(U&& value) noexcept { value_ = std::forward(value); has_value_ = true; return *this; } + template + optional& operator=(const optional& other) + { + value_ = other.value_; + has_value_ = other.has_value_; + return *this; + } + template + optional& operator=(optional&& other) + { + value_ = std::forward>(other.value_); + has_value_ = other.has_value_; + return *this; + } + + template // https://en.cppreference.com/w/cpp/utility/Optional/emplace + T& emplace(Args&&... args) + { + value_ = value_type(std::forward(args)...); + has_value_ = true; + return value_; + } bool has_value() const noexcept { @@ -159,16 +174,13 @@ class optional final const T* operator->() const { assert(has_value()); - return &value_; // "This operator does not check whether the optional - // contains a value!" + return &value_; // "This operator does not check whether the optional contains a value!" } T* operator->() noexcept { assert(has_value()); - return &value_; // "This operator does not check whether the optional - // contains a value!" + return &value_; // "This operator does not check whether the optional contains a value!" } - const T& operator*() const& noexcept { assert(has_value()); @@ -177,20 +189,17 @@ class optional final T& operator*() & { assert(has_value()); - return value_; // "This operator does not check whether the optional - // contains a value!" + return value_; // "This operator does not check whether the optional contains a value!" } const T&& operator*() const&& { assert(has_value()); - return value_; // "This operator does not check whether the optional - // contains a value!" + return value_; // "This operator does not check whether the optional contains a value!" } T&& operator*() && { assert(has_value()); - return value_; // "This operator does not check whether the optional - // contains a value!" + return value_; // "This operator does not check whether the optional contains a value!" } // https://en.cppreference.com/w/cpp/utility/optional/value_or @@ -223,26 +232,23 @@ inline optional make_optional(TArgs&&... args) // Compares two optional objects, lhs and rhs. The contained values are compared // (using the corresponding operator of T) only if both lhs and rhs contain // values. Otherwise, -// * lhs is considered equal to rhs if, and only if, both lhs and rhs do not -// contain a value. -// * lhs is considered less than rhs if, and only if, rhs contains a value and -// lhs does not. +// * lhs is considered equal to rhs if, and only if, both lhs and rhs do not contain a value. +// * lhs is considered less than rhs if, and only if, rhs contains a value and lhs does not. template inline bool operator==(const optional& lhs, const optional& rhs) { - // If bool(lhs) != bool(rhs), returns false - if (bool(lhs) != bool(rhs)) + // "If bool(lhs) != bool(rhs), returns false." + if (lhs.has_value() != rhs.has_value()) { return false; } - // Otherwise, if bool(lhs) == false (and so bool(rhs) == false as well), - // returns true + // "Otherwise, if bool(lhs) == false (and so bool(rhs) == false as well), returns true." if (!lhs.has_value()) { assert(!rhs.has_value()); return true; } - // Otherwise, returns *lhs == *rhs. + // "Otherwise, returns *lhs == *rhs." return *lhs == *rhs; } template @@ -275,17 +281,17 @@ inline bool operator!=(const optional& opt, const U& value) template inline bool operator<(const optional& lhs, const optional& rhs) { - // If bool(rhs) == false returns false + // "If bool(rhs) == false returns false." if (!rhs.has_value()) { return false; } - // Otherwise, if bool(lhs) == false, returns true + // "Otherwise, if bool(lhs) == false, returns true." if (!lhs.has_value()) { return true; } - // Otherwise returns *lhs < *rhs + // "Otherwise returns *lhs < *rhs." return *lhs < *rhs; } template @@ -302,17 +308,17 @@ inline bool operator<(const optional& opt, const U& value) template inline bool operator<=(const optional& lhs, const optional& rhs) { - // If bool(lhs) == false returns true + // "If bool(lhs) == false returns true." if (!lhs.has_value()) { return true; } - // Otherwise, if bool(rhs) == false, returns false + // "Otherwise, if bool(rhs) == false, returns false." if (!rhs.has_value()) { return false; } - // Otherwise returns *lhs <= *rhs + // "Otherwise returns *lhs <= *rhs." return *lhs <= *rhs; } template @@ -329,17 +335,17 @@ inline bool operator<=(const optional& opt, const U& value) template inline bool operator>(const optional& lhs, const optional& rhs) { - // If bool(lhs) == false returns false + // "If bool(lhs) == false returns false." if (!lhs.has_value()) { return false; } - // Otherwise, if bool(rhs) == false, returns true + // "Otherwise, if bool(rhs) == false, returns true." if (!rhs.has_value()) { return true; } - // Otherwise returns *lhs > *rhs + // "Otherwise returns *lhs > *rhs." return *lhs > *rhs; } template @@ -356,17 +362,17 @@ inline bool operator>(const optional& opt, const U& value) template inline bool operator>=(const optional& lhs, const optional& rhs) { - // If bool(rhs) == false returns true + // "If bool(rhs) == false returns true." if (!rhs.has_value()) { return true; } - // Otherwise, if bool(lhs) == false, returns false + // "Otherwise, if bool(lhs) == false, returns false." if (!lhs.has_value()) { return false; } - // Otherwise returns *lhs >= *rhs + // "Otherwise returns *lhs >= *rhs." return *lhs >= *rhs; } template diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/span.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/span.h index 6aff3b5d5a..c69d055c68 100644 --- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/span.h +++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/span.h @@ -23,10 +23,14 @@ #ifndef CODA_OSS_coda_oss_span_h_INCLUDED_ #define CODA_OSS_coda_oss_span_h_INCLUDED_ -#include +#include +#include +#include +#include #include +#include "coda_oss/CPlusPlus.h" #include "coda_oss/namespace_.h" #include "coda_oss/span_.h" #include "coda_oss/cstddef.h" // byte @@ -35,13 +39,31 @@ // we really need for span (e.g., gsl::narrow()), but it keeps things simple. #include "gsl/gsl.h" // not gsl/span; need #pragma here to turn off warnings +// This logic needs to be here rather than so that `coda_oss::span` will +// be the same as `std::span`. +#ifndef CODA_OSS_HAVE_std_span_ + #define CODA_OSS_HAVE_std_span_ 0 // assume no +#endif +#if CODA_OSS_cpp17 // C++17 for `__has_include()` + #if __has_include() && __cpp_lib_span // Some versions of G++ say they're C++20 but don't have + #include + #undef CODA_OSS_HAVE_std_span_ + #define CODA_OSS_HAVE_std_span_ 1 // provided by the implementation, probably C++20 + #endif +#endif // CODA_OSS_cpp17 + namespace coda_oss { -#if defined(GSL_SPAN_H) // the above #include'd gsl/span - using gsl::span; -#else // no gsl::span, use our own - using details::span; -#endif // GSL_SPAN_H + #if CODA_OSS_HAVE_std_span_ + using std::span; // coda_oss::span == std::span + #elif defined(GSL_SPAN_H) // the above #include'd gsl/span + using gsl::span; + #else + using details::span; // no std::span or gsl::span, use our own + #endif + + +// Even if `span` is `std::span`, these are still in the `coda_oss` namespace. // https://en.cppreference.com/w/cpp/container/span/as_bytes template @@ -73,6 +95,29 @@ inline span as_writable_bytes(span s) noexcept return span(p, s.size_bytes()); } +// https://en.cppreference.com/w/cpp/iterator/size +template +constexpr size_t size(const C& c) +{ + return c.size(); +} +template +constexpr ptrdiff_t ssize(const C& c) +{ + return gsl::narrow(c.size()); +} + +template +constexpr size_t size(const T (&)[N]) noexcept +{ + return N; +} +template +constexpr ptrdiff_t ssize(const T (&)[N]) noexcept +{ + return N; +} + } #endif // CODA_OSS_coda_oss_span_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/string.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/string.h index 0eeb73ef08..396b06899b 100644 --- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/string.h +++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/string.h @@ -20,15 +20,28 @@ * */ +#pragma once #ifndef CODA_OSS_coda_oss_string_h_INCLUDED_ #define CODA_OSS_coda_oss_string_h_INCLUDED_ -#pragma once #include +#include "coda_oss/CPlusPlus.h" + +// This logic needs to be here rather than so that `coda_oss::u8string` will +// be the same as `std::u8string`. +#ifndef CODA_OSS_HAVE_std_u8string_ + #define CODA_OSS_HAVE_std_u8string_ 0 // assume no std::u8string +#endif +#if CODA_OSS_cpp20 + #if defined(__cpp_lib_char8_t) // https://en.cppreference.com/w/cpp/feature_test + #undef CODA_OSS_HAVE_std_u8string_ + #define CODA_OSS_HAVE_std_u8string_ 1 + #endif +#endif // CODA_OSS_cpp20 + #include "config/compiler_extensions.h" -#include "coda_oss/namespace_.h" namespace coda_oss { // char8_t for UTF-8 characters @@ -36,10 +49,18 @@ namespace coda_oss #if _MSC_VER #pragma warning(disable: 5052) // Keyword '...' was introduced in C++20 and requires use of the '...' command-line option #endif + #if !defined(__cpp_char8_t) // https://en.cppreference.com/w/cpp/feature_test - enum class char8_t : unsigned char { }; // https://en.cppreference.com/w/cpp/language/types + enum class char8_t : unsigned char { }; // https://en.cppreference.com/w/cpp/language/types + #elif CODA_OSS_HAVE_std_u8string_ + // `char8_t` is a keyword in C++20 #endif - using u8string = std::basic_string; // https://en.cppreference.com/w/cpp/string + #if CODA_OSS_HAVE_std_u8string_ + using u8string = std::u8string; + #else + using u8string = std::basic_string; // https://en.cppreference.com/w/cpp/string + #endif + CODA_OSS_disable_warning_pop } diff --git a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/type_traits.h b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/type_traits.h index 5c92c1d321..17f538ca4c 100644 --- a/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/type_traits.h +++ b/externals/coda-oss/modules/c++/coda_oss/include/coda_oss/type_traits.h @@ -18,15 +18,12 @@ * License along with this program; If not, http://www.gnu.org/licenses/. * */ +#pragma once #ifndef CODA_OSS_coda_oss_type_traits_h_INCLUDED_ #define CODA_OSS_coda_oss_type_traits_h_INCLUDED_ -#pragma once #include -#include "CPlusPlus.h" - -#include "coda_oss/namespace_.h" namespace coda_oss { using std::is_trivially_copyable; diff --git a/externals/coda-oss/modules/c++/coda_oss/unittests/test_optional.cpp b/externals/coda-oss/modules/c++/coda_oss/unittests/test_optional.cpp index 4f0736ee27..3abff8f7df 100644 --- a/externals/coda-oss/modules/c++/coda_oss/unittests/test_optional.cpp +++ b/externals/coda-oss/modules/c++/coda_oss/unittests/test_optional.cpp @@ -51,22 +51,7 @@ std::ostream& operator<<(std::ostream& s, const coda_oss::optional& opt) } return s; } -#if CODA_OSS_cpp17 -template -std::ostream& operator<<(std::ostream& s, const std::optional& opt) -{ - if (opt.has_value()) - { - s << *opt; - } - else - { - s << "[no value]"; - } - return s; -} -#endif - + template static void testOptional_(const std::string& testName, const TOptional& opt) { @@ -124,35 +109,34 @@ TEST_CASE(test_sys_Optional) } } -TEST_CASE(test_std_optional) +TEST_CASE(test_coda_oss_optional) { TEST_ASSERT(!testName.empty()); -#if CODA_OSS_cpp17 - const std::optional null; + + const coda_oss::optional null; TEST_ASSERT_FALSE(null.has_value()); { - std::optional opt; + coda_oss::optional opt; TEST_ASSERT_FALSE(opt.has_value()); TEST_ASSERT_EQ(null, opt); opt = 314; testOptional_(testName, opt); } { - std::optional opt = 314; + coda_oss::optional opt = 314; testOptional_(testName, opt); } { - auto opt = std::make_optional(314); + auto opt = coda_oss::make_optional(314); testOptional_(testName, opt); } -#endif } } int main(int /*argc*/, char** /*argv*/) { TEST_CHECK(test_sys_Optional); - TEST_CHECK(test_std_optional); + TEST_CHECK(test_coda_oss_optional); return 0; } diff --git a/externals/coda-oss/modules/c++/config/include/config/Version.h b/externals/coda-oss/modules/c++/config/include/config/Version.h index 69944fc0b8..d146355759 100644 --- a/externals/coda-oss/modules/c++/config/include/config/Version.h +++ b/externals/coda-oss/modules/c++/config/include/config/Version.h @@ -42,13 +42,13 @@ static_assert(CODA_OSS_MAKE_VERSION_MMPB(9999, 9999, 9999, 9999) <= UINT64_MAX, // Do this ala C++ ... we don't currently have major/minor/patch //#define CODA_OSS_VERSION_ 20210910L // c.f. __cplusplus -#define CODA_OSS_VERSION_ 2023 ## 0006 ## 0005 ## 0000 ## L +#define CODA_OSS_VERSION_ 2023 ## 0010 ## 0023 ## 0000 ## L // Use the same macros other projects might want to use; overkill for us. #define CODA_OSS_VERSION_MAJOR 2023 -#define CODA_OSS_VERSION_MINOR 6 -#define CODA_OSS_VERSION_PATCH 5 -#define CODA_OSS_VERSION_BUILD 0 +#define CODA_OSS_VERSION_MINOR 10 +#define CODA_OSS_VERSION_PATCH 23 // a.k.a. "point," but too similar to "patch." +#define CODA_OSS_VERSION_BUILD 0 // a.k.a. "patch," but too similar to "point." #define CODA_OSS_VERSION CODA_OSS_MAKE_VERSION_MMPB(CODA_OSS_VERSION_MAJOR, CODA_OSS_VERSION_MINOR, CODA_OSS_VERSION_PATCH, CODA_OSS_VERSION_BUILD) namespace config diff --git a/externals/coda-oss/modules/c++/config/include/config/disable_compiler_warnings.h b/externals/coda-oss/modules/c++/config/include/config/disable_compiler_warnings.h index a3b1a5125e..1b9584392a 100644 --- a/externals/coda-oss/modules/c++/config/include/config/disable_compiler_warnings.h +++ b/externals/coda-oss/modules/c++/config/include/config/disable_compiler_warnings.h @@ -26,6 +26,7 @@ #include "compiler_extensions.h" #if defined(_MSC_VER) + // We don't care about any padding added to structs #pragma warning(disable: 4820) // '...': '...' bytes padding added after data member '...' @@ -38,10 +39,14 @@ // ??? #pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified +// Different versions of Visual Studio have different warnings; and almost all of our +// use of them is `disable`. It not very useful to know we're (attempting) to +// disable a warning that doesn't exist. +#pragma warning(disable: 4619) // #pragma warning: there is no warning number '...' #elif defined(__GNUC__) || defined(__clang__) -// don't care about compatibility between different -std=c++nn values +// Don't care about compatibility between different -std=c++nn values. CODA_OSS_disable_warning(-Wnoexcept-type) #endif // _MSC_VER diff --git a/externals/coda-oss/modules/c++/dbi/include/dbi/OracleConnection.h b/externals/coda-oss/modules/c++/dbi/include/dbi/OracleConnection.h index b09554224b..1651808288 100644 --- a/externals/coda-oss/modules/c++/dbi/include/dbi/OracleConnection.h +++ b/externals/coda-oss/modules/c++/dbi/include/dbi/OracleConnection.h @@ -20,129 +20,129 @@ * */ -#ifndef __DBI_ORACLECONNECTION_H__ -#define __DBI_ORACLECONNECTION_H__ - -#if defined(USE_ORACLE) - -#include "dbi/DatabaseConnection.h" -#include - -/*! - * \file OracleConnection.h - * \brief Oracle interface for database connections - * - */ -namespace dbi -{ -/*! - * \class OracleResultSet - * \brief This class defines the Oracle interface for a result set - */ -class OracleResultSet : public ResultSet -{ -public: - /*! - * Default Constructor - */ - OracleResultSet(OCIStmt * sqlHandle, OCIError* errorHandle, unsigned int rowCount) : ResultSet() - { - mSQLHandle = sqlHandle; - mErrorHandle = errorHandle; - mRowIndex = 0; - mRowCount = rowCount; - } - - /*! - * Default Destructor - */ - ~OracleResultSet() - { - OCIHandleFree(mSQLHandle, OCI_HTYPE_STMT); - } - - /*! - * fetchRow function returns the next row in the result set - * \return The next row - */ - Row fetchRow(); - - /*! - * getNumRows function returns the number of rows from the - * result set - * \return The number of Rows being returned - */ - unsigned int getNumRows(); - -private: - OCIStmt* mSQLHandle; - OCIError* mErrorHandle; - unsigned int mRowIndex; - unsigned int mRowCount; -}; - -/*! - * \class OracleConnection - * \brief Oracle database interface - * - * This class provides the basis for Oracle connections - * - */ -class OracleConnection : public DatabaseConnection -{ -public: - - /*! - * Default Constructor - */ - OracleConnection(); - - /*! - * Destructor - * - */ - ~OracleConnection(); - - /*! - * Connect to the specified database - * \param database The database name - * \param user The username - * \param pass The user password - * \param host The computer host name where the database is located - * \param port The receiving port on the host - * \return True if successful, False otherwise - */ - bool connect(const std::string& database, - const std::string& user = "", - const std::string& pass = "", - const std::string& host = "localhost", - unsigned int port = 1521); - - /*! - * Disconnect connection to the database - */ - void disconnect(); - - /*! - * Send a command to the database as a string - * \param q The command as a string - * \return The result set of command - * \throw SQLException on error - */ - pResultSet query(const std::string& q); - - /*! - * Get the last connection error message - * \return The error message - */ - const std::string getLastErrorMessage(); - -private: - /*! Handles to the Oracle database connection */ - OCIEnv* mEnvHandle; - OCIError* mErrorHandle; - OCISvcCtx* mContextHandle; -}; -} -#endif -#endif +#ifndef __DBI_ORACLECONNECTION_H__ +#define __DBI_ORACLECONNECTION_H__ + +#if defined(USE_ORACLE) + +#include "dbi/DatabaseConnection.h" +#include + +/*! + * \file OracleConnection.h + * \brief Oracle interface for database connections + * + */ +namespace dbi +{ +/*! + * \class OracleResultSet + * \brief This class defines the Oracle interface for a result set + */ +class OracleResultSet : public ResultSet +{ +public: + /*! + * Default Constructor + */ + OracleResultSet(OCIStmt * sqlHandle, OCIError* errorHandle, unsigned int rowCount) : ResultSet() + { + mSQLHandle = sqlHandle; + mErrorHandle = errorHandle; + mRowIndex = 0; + mRowCount = rowCount; + } + + /*! + * Default Destructor + */ + ~OracleResultSet() + { + OCIHandleFree(mSQLHandle, OCI_HTYPE_STMT); + } + + /*! + * fetchRow function returns the next row in the result set + * \return The next row + */ + Row fetchRow(); + + /*! + * getNumRows function returns the number of rows from the + * result set + * \return The number of Rows being returned + */ + unsigned int getNumRows(); + +private: + OCIStmt* mSQLHandle; + OCIError* mErrorHandle; + unsigned int mRowIndex; + unsigned int mRowCount; +}; + +/*! + * \class OracleConnection + * \brief Oracle database interface + * + * This class provides the basis for Oracle connections + * + */ +class OracleConnection : public DatabaseConnection +{ +public: + + /*! + * Default Constructor + */ + OracleConnection(); + + /*! + * Destructor + * + */ + ~OracleConnection(); + + /*! + * Connect to the specified database + * \param database The database name + * \param user The username + * \param pass The user password + * \param host The computer host name where the database is located + * \param port The receiving port on the host + * \return True if successful, False otherwise + */ + bool connect(const std::string& database, + const std::string& user = "", + const std::string& pass = "", + const std::string& host = "localhost", + unsigned int port = 1521); + + /*! + * Disconnect connection to the database + */ + void disconnect(); + + /*! + * Send a command to the database as a string + * \param q The command as a string + * \return The result set of command + * \throw SQLException on error + */ + pResultSet query(const std::string& q); + + /*! + * Get the last connection error message + * \return The error message + */ + const std::string getLastErrorMessage(); + +private: + /*! Handles to the Oracle database connection */ + OCIEnv* mEnvHandle; + OCIError* mErrorHandle; + OCISvcCtx* mContextHandle; +}; +} +#endif +#endif diff --git a/externals/coda-oss/modules/c++/dbi/source/OracleConnection.cpp b/externals/coda-oss/modules/c++/dbi/source/OracleConnection.cpp index a03203e4f9..37b56ab312 100644 --- a/externals/coda-oss/modules/c++/dbi/source/OracleConnection.cpp +++ b/externals/coda-oss/modules/c++/dbi/source/OracleConnection.cpp @@ -20,228 +20,228 @@ * */ -#if defined(USE_ORACLE) - -#include "dbi/OracleConnection.h" -#include -#include -#include -#include - -dbi::OracleConnection::OracleConnection() -{ - mEnvHandle = nullptr; - mErrorHandle = nullptr; - (void) OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0, - (dvoid * (*)(dvoid *, size_t)) 0, - (dvoid * (*)(dvoid *, dvoid *, size_t))0, - (void (*)(dvoid *, dvoid *)) 0 ); - - (void) OCIEnvInit( (OCIEnv **) &mEnvHandle, OCI_DEFAULT, (size_t) 0, - (dvoid **) 0 ); - - - (void) OCIHandleAlloc( (dvoid *) mEnvHandle, (dvoid **) &mErrorHandle, OCI_HTYPE_ERROR, - (size_t) 0, (dvoid **) 0); - - (void) OCIHandleAlloc( (dvoid *) mEnvHandle, (dvoid **) &mContextHandle, OCI_HTYPE_SVCCTX, - (size_t) 0, (dvoid **) 0); -} - -dbi::OracleConnection::~OracleConnection() -{ - OCIHandleFree((dvoid *)mContextHandle, OCI_HTYPE_SVCCTX); - OCIHandleFree((dvoid *)mErrorHandle, OCI_HTYPE_ERROR); - OCIHandleFree((dvoid *)mEnvHandle, OCI_HTYPE_ENV); -} - -bool dbi::OracleConnection::connect(const std::string& database, - const std::string& user, - const std::string& pass, - const std::string& host, - unsigned int port) -{ - if (port == 0) port = 1521; - int rc = OCILogon(mEnvHandle, mErrorHandle, &mContextHandle, - (const OraText*)user.c_str(), user.length(), (const OraText*)pass.c_str(), pass.length(), - (const OraText*)database.c_str(), database.length()); - if (rc != 0) - return false; - return true; -} - -void dbi::OracleConnection::disconnect() -{ - OCILogoff(mContextHandle, mErrorHandle); -} - -const std::string dbi::OracleConnection::getLastErrorMessage() -{ - char errbuf[100]; - memset(errbuf, 0, 100); - int errcode; - OCIErrorGet((dvoid *)mErrorHandle, (ub4) 1, (text *) nullptr, &errcode, - (OraText*)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR); - if (strlen(errbuf) > 0) - return std::string(errbuf); - return ""; -} - -dbi::pResultSet dbi::OracleConnection::query(const std::string& q) -{ - unsigned rowCount = 0; - OCIStmt* sqlHandle; - /* Allocate and prepare SQL statement */ - OCIHandleAlloc( (dvoid *) mEnvHandle, (dvoid **) &sqlHandle, - OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0); - OCIStmtPrepare(sqlHandle, mErrorHandle, (const OraText*)q.c_str(), - (ub4) q.length(), (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT); - - // Oracle is ridiculous. This MUST be 1 for non-SELECT statements - // but needs to be 0 to avoid prefetching the first row on a SELECT. - ub4 val = 1; - - std::string lowerCaseQuery = q; - transform(lowerCaseQuery.begin(), lowerCaseQuery.end(), lowerCaseQuery.begin(), tolower); - - if (lowerCaseQuery.find("select") == 0) - { - val = 0; - std::string countq = lowerCaseQuery; - int one = countq.find("select "); - int two = countq.find(" from "); - countq = countq.replace(one, two - one, "select count(*) "); - OCIStmt* countHandle; - OCIHandleAlloc( (dvoid *) mEnvHandle, (dvoid **)&countHandle, - OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0); - OCIStmtPrepare(countHandle, mErrorHandle, (const OraText*)countq.c_str(), - (ub4)countq.length(), (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT); - OCIStmtExecute(mContextHandle, countHandle, mErrorHandle, (ub4)val, (ub4)0, - (CONST OCISnapshot *) nullptr, (OCISnapshot *) nullptr, OCI_DEFAULT); - OCIDefine * defineHandle = nullptr; - OCIDefineByPos(countHandle, &defineHandle, mErrorHandle, 1, - &rowCount, sizeof(rowCount), SQLT_UIN, 0, 0, 0, OCI_DEFAULT); - OCIStmtFetch(countHandle, mErrorHandle, 1, OCI_FETCH_NEXT, OCI_DEFAULT); - } - - /* Execute the SQL statment */ - OCIStmtExecute(mContextHandle, sqlHandle, mErrorHandle, (ub4) val, (ub4) 0, - (CONST OCISnapshot *) nullptr, (OCISnapshot *) nullptr, OCI_DEFAULT); - - return dbi::pResultSet(new dbi::OracleResultSet(sqlHandle, mErrorHandle, rowCount)); -} - -unsigned int dbi::OracleResultSet::getNumRows() -{ - return mRowCount; -} - -struct Column -{ - char name[128]; - ub2 type; - ub2 extType; - ub4 fieldSize; - char *value; -}; - -dbi::Row dbi::OracleResultSet::fetchRow() -{ - dbi::Row row; - ub4 count = 0; - sword result = OCIAttrGet(mSQLHandle, OCI_HTYPE_STMT, - &count, nullptr, OCI_ATTR_PARAM_COUNT, mErrorHandle); - Column * fields = new Column[count]; - if (result == OCI_SUCCESS) - { - for (int i = 0; i < (int)count; i++) - { - memset(fields[i].name, '\0', 128); - fields[i].type = 0; - fields[i].extType = SQLT_STR; - fields[i].fieldSize = 0; - fields[i].value = nullptr; - - OCIParam* param_handle = nullptr; - ub4 name_len = 0; - - result = OCIParamGet(mSQLHandle, OCI_HTYPE_STMT, - mErrorHandle, (dvoid **) & param_handle, - i + 1); - if (result == OCI_SUCCESS) - { - text * temp; - result = OCIAttrGet(param_handle, OCI_DTYPE_PARAM, - &temp, &name_len, OCI_ATTR_NAME, - mErrorHandle); - strncpy(fields[i].name, (const char*)temp, name_len); - } - - if (result == OCI_SUCCESS) - { - result = OCIAttrGet(param_handle, OCI_DTYPE_PARAM, - &fields[i].type, nullptr, OCI_ATTR_DATA_TYPE, - mErrorHandle); - } - - if (result == OCI_SUCCESS) - { - result = OCIAttrGet(param_handle, OCI_DTYPE_PARAM, - &fields[i].fieldSize, nullptr, OCI_ATTR_DATA_SIZE, - mErrorHandle); - } - - if (param_handle) - { - OCIDescriptorFree(param_handle, OCI_DTYPE_PARAM); - } - - ub4 fieldSize = fields[i].fieldSize; - if (fields[i].type == SQLT_DAT) - { - fields[i].extType = SQLT_ODT; - fieldSize = sizeof(OCIDate); - } - - - if (result == OCI_SUCCESS) - { - //char temp[1]; - int indp = -1; // This means that NULL values will not cause an error - fields[i].value = new char[fields[i].fieldSize]; - memset(fields[i].value, '\0', fields[i].fieldSize); - OCIDefine* defineHandle = nullptr; - result = OCIDefineByPos(mSQLHandle, &defineHandle, mErrorHandle, i + 1, - fields[i].value, fieldSize, fields[i].extType, - &indp, 0, 0, OCI_DEFAULT); - } - } - result = OCIStmtFetch(mSQLHandle, mErrorHandle, 1, OCI_FETCH_NEXT, OCI_DEFAULT); - if (result == OCI_SUCCESS || result == OCI_NO_DATA || result == OCI_SUCCESS_WITH_INFO) - { - for (int i = 0; i < (int)count; i++) - { - //std::string v = std::string(fields[i].value); - //str::trim(v); - if (fields[i].extType == SQLT_ODT) - { - char buffer[9]; - ub4 bufferSize = 9; - - OCIDateToText(mErrorHandle, (const OCIDate*)fields[i].value, - nullptr, 0, - nullptr, 0, &bufferSize, (text*)buffer); - memset(fields[i].value, '\0', sizeof(OCIDate)); - strncpy(fields[i].value, buffer, bufferSize); - } - row.addField((const char*)fields[i].name, fields[i].type, fields[i].fieldSize, fields[i].value); - delete [] fields[i].value; - } - } - } - delete [] fields; - mRowIndex++; - return row; -} - -#endif +#if defined(USE_ORACLE) + +#include "dbi/OracleConnection.h" +#include +#include +#include +#include + +dbi::OracleConnection::OracleConnection() +{ + mEnvHandle = nullptr; + mErrorHandle = nullptr; + (void) OCIInitialize((ub4) OCI_DEFAULT, (dvoid *)0, + (dvoid * (*)(dvoid *, size_t)) 0, + (dvoid * (*)(dvoid *, dvoid *, size_t))0, + (void (*)(dvoid *, dvoid *)) 0 ); + + (void) OCIEnvInit( (OCIEnv **) &mEnvHandle, OCI_DEFAULT, (size_t) 0, + (dvoid **) 0 ); + + + (void) OCIHandleAlloc( (dvoid *) mEnvHandle, (dvoid **) &mErrorHandle, OCI_HTYPE_ERROR, + (size_t) 0, (dvoid **) 0); + + (void) OCIHandleAlloc( (dvoid *) mEnvHandle, (dvoid **) &mContextHandle, OCI_HTYPE_SVCCTX, + (size_t) 0, (dvoid **) 0); +} + +dbi::OracleConnection::~OracleConnection() +{ + OCIHandleFree((dvoid *)mContextHandle, OCI_HTYPE_SVCCTX); + OCIHandleFree((dvoid *)mErrorHandle, OCI_HTYPE_ERROR); + OCIHandleFree((dvoid *)mEnvHandle, OCI_HTYPE_ENV); +} + +bool dbi::OracleConnection::connect(const std::string& database, + const std::string& user, + const std::string& pass, + const std::string& host, + unsigned int port) +{ + if (port == 0) port = 1521; + int rc = OCILogon(mEnvHandle, mErrorHandle, &mContextHandle, + (const OraText*)user.c_str(), user.length(), (const OraText*)pass.c_str(), pass.length(), + (const OraText*)database.c_str(), database.length()); + if (rc != 0) + return false; + return true; +} + +void dbi::OracleConnection::disconnect() +{ + OCILogoff(mContextHandle, mErrorHandle); +} + +const std::string dbi::OracleConnection::getLastErrorMessage() +{ + char errbuf[100]; + memset(errbuf, 0, 100); + int errcode; + OCIErrorGet((dvoid *)mErrorHandle, (ub4) 1, (text *) nullptr, &errcode, + (OraText*)errbuf, (ub4) sizeof(errbuf), OCI_HTYPE_ERROR); + if (strlen(errbuf) > 0) + return std::string(errbuf); + return ""; +} + +dbi::pResultSet dbi::OracleConnection::query(const std::string& q) +{ + unsigned rowCount = 0; + OCIStmt* sqlHandle; + /* Allocate and prepare SQL statement */ + OCIHandleAlloc( (dvoid *) mEnvHandle, (dvoid **) &sqlHandle, + OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0); + OCIStmtPrepare(sqlHandle, mErrorHandle, (const OraText*)q.c_str(), + (ub4) q.length(), (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT); + + // Oracle is ridiculous. This MUST be 1 for non-SELECT statements + // but needs to be 0 to avoid prefetching the first row on a SELECT. + ub4 val = 1; + + std::string lowerCaseQuery = q; + transform(lowerCaseQuery.begin(), lowerCaseQuery.end(), lowerCaseQuery.begin(), tolower); + + if (lowerCaseQuery.find("select") == 0) + { + val = 0; + std::string countq = lowerCaseQuery; + int one = countq.find("select "); + int two = countq.find(" from "); + countq = countq.replace(one, two - one, "select count(*) "); + OCIStmt* countHandle; + OCIHandleAlloc( (dvoid *) mEnvHandle, (dvoid **)&countHandle, + OCI_HTYPE_STMT, (size_t) 0, (dvoid **) 0); + OCIStmtPrepare(countHandle, mErrorHandle, (const OraText*)countq.c_str(), + (ub4)countq.length(), (ub4) OCI_NTV_SYNTAX, (ub4) OCI_DEFAULT); + OCIStmtExecute(mContextHandle, countHandle, mErrorHandle, (ub4)val, (ub4)0, + (CONST OCISnapshot *) nullptr, (OCISnapshot *) nullptr, OCI_DEFAULT); + OCIDefine * defineHandle = nullptr; + OCIDefineByPos(countHandle, &defineHandle, mErrorHandle, 1, + &rowCount, sizeof(rowCount), SQLT_UIN, 0, 0, 0, OCI_DEFAULT); + OCIStmtFetch(countHandle, mErrorHandle, 1, OCI_FETCH_NEXT, OCI_DEFAULT); + } + + /* Execute the SQL statment */ + OCIStmtExecute(mContextHandle, sqlHandle, mErrorHandle, (ub4) val, (ub4) 0, + (CONST OCISnapshot *) nullptr, (OCISnapshot *) nullptr, OCI_DEFAULT); + + return dbi::pResultSet(new dbi::OracleResultSet(sqlHandle, mErrorHandle, rowCount)); +} + +unsigned int dbi::OracleResultSet::getNumRows() +{ + return mRowCount; +} + +struct Column +{ + char name[128]; + ub2 type; + ub2 extType; + ub4 fieldSize; + char *value; +}; + +dbi::Row dbi::OracleResultSet::fetchRow() +{ + dbi::Row row; + ub4 count = 0; + sword result = OCIAttrGet(mSQLHandle, OCI_HTYPE_STMT, + &count, nullptr, OCI_ATTR_PARAM_COUNT, mErrorHandle); + Column * fields = new Column[count]; + if (result == OCI_SUCCESS) + { + for (int i = 0; i < (int)count; i++) + { + memset(fields[i].name, '\0', 128); + fields[i].type = 0; + fields[i].extType = SQLT_STR; + fields[i].fieldSize = 0; + fields[i].value = nullptr; + + OCIParam* param_handle = nullptr; + ub4 name_len = 0; + + result = OCIParamGet(mSQLHandle, OCI_HTYPE_STMT, + mErrorHandle, (dvoid **) & param_handle, + i + 1); + if (result == OCI_SUCCESS) + { + text * temp; + result = OCIAttrGet(param_handle, OCI_DTYPE_PARAM, + &temp, &name_len, OCI_ATTR_NAME, + mErrorHandle); + strncpy(fields[i].name, (const char*)temp, name_len); + } + + if (result == OCI_SUCCESS) + { + result = OCIAttrGet(param_handle, OCI_DTYPE_PARAM, + &fields[i].type, nullptr, OCI_ATTR_DATA_TYPE, + mErrorHandle); + } + + if (result == OCI_SUCCESS) + { + result = OCIAttrGet(param_handle, OCI_DTYPE_PARAM, + &fields[i].fieldSize, nullptr, OCI_ATTR_DATA_SIZE, + mErrorHandle); + } + + if (param_handle) + { + OCIDescriptorFree(param_handle, OCI_DTYPE_PARAM); + } + + ub4 fieldSize = fields[i].fieldSize; + if (fields[i].type == SQLT_DAT) + { + fields[i].extType = SQLT_ODT; + fieldSize = sizeof(OCIDate); + } + + + if (result == OCI_SUCCESS) + { + //char temp[1]; + int indp = -1; // This means that NULL values will not cause an error + fields[i].value = new char[fields[i].fieldSize]; + memset(fields[i].value, '\0', fields[i].fieldSize); + OCIDefine* defineHandle = nullptr; + result = OCIDefineByPos(mSQLHandle, &defineHandle, mErrorHandle, i + 1, + fields[i].value, fieldSize, fields[i].extType, + &indp, 0, 0, OCI_DEFAULT); + } + } + result = OCIStmtFetch(mSQLHandle, mErrorHandle, 1, OCI_FETCH_NEXT, OCI_DEFAULT); + if (result == OCI_SUCCESS || result == OCI_NO_DATA || result == OCI_SUCCESS_WITH_INFO) + { + for (int i = 0; i < (int)count; i++) + { + //std::string v = std::string(fields[i].value); + //str::trim(v); + if (fields[i].extType == SQLT_ODT) + { + char buffer[9]; + ub4 bufferSize = 9; + + OCIDateToText(mErrorHandle, (const OCIDate*)fields[i].value, + nullptr, 0, + nullptr, 0, &bufferSize, (text*)buffer); + memset(fields[i].value, '\0', sizeof(OCIDate)); + strncpy(fields[i].value, buffer, bufferSize); + } + row.addField((const char*)fields[i].name, fields[i].type, fields[i].fieldSize, fields[i].value); + delete [] fields[i].value; + } + } + } + delete [] fields; + mRowIndex++; + return row; +} + +#endif diff --git a/externals/coda-oss/modules/c++/dbi/tests/SQLTest1.cpp b/externals/coda-oss/modules/c++/dbi/tests/SQLTest1.cpp index dbca6e5e83..ad1b0eb8d7 100644 --- a/externals/coda-oss/modules/c++/dbi/tests/SQLTest1.cpp +++ b/externals/coda-oss/modules/c++/dbi/tests/SQLTest1.cpp @@ -30,7 +30,7 @@ int main(int argc, char* argv[]) { try { - if (argc < 4) throw except::Exception(Ctxt(FmtX("Usage %s [host] [port]", argv[0]))); + if (argc < 4) throw except::Exception(Ctxt(str::Format("Usage %s [host] [port]", argv[0]))); std::string database(argv[1]); std::string user(argv[2]); diff --git a/externals/coda-oss/modules/c++/dbi/tests/SQLTest2.cpp b/externals/coda-oss/modules/c++/dbi/tests/SQLTest2.cpp index 843a4d2780..c1bc60f2d7 100644 --- a/externals/coda-oss/modules/c++/dbi/tests/SQLTest2.cpp +++ b/externals/coda-oss/modules/c++/dbi/tests/SQLTest2.cpp @@ -30,7 +30,7 @@ int main(int argc, char* argv[]) { try { - if (argc != 6) throw except::Exception(Ctxt(FmtX("Usage %s ", argv[0]))); + if (argc != 6) throw except::Exception(Ctxt(str::Format("Usage %s ", argv[0]))); std::string database(argv[1]); std::string host(argv[4]); diff --git a/externals/coda-oss/modules/c++/except/include/except/Context.h b/externals/coda-oss/modules/c++/except/include/except/Context.h index 83f80acee3..27816dccec 100644 --- a/externals/coda-oss/modules/c++/except/include/except/Context.h +++ b/externals/coda-oss/modules/c++/except/include/except/Context.h @@ -20,13 +20,13 @@ * */ - +#pragma once #ifndef CODA_OSS_except_Context_h_INCLUDED_ #define CODA_OSS_except_Context_h_INCLUDED_ -#pragma once #include #include +#include #include "config/Exports.h" #include "config/disable_compiler_warnings.h" @@ -59,12 +59,12 @@ struct CODA_OSS_API Context final Context(const char* file /*__FILE__*/, int line /*__LINE__*/, const std::string& func, const std::string& time, - const std::string& message = "") : - mMessage(message), - mTime(time), - mFunc(func), - mFile(file), - mLine(line) { } + const std::string& message = "" /*for existing SWIG bindings*/) + : mMessage(message), mTime(time), mFunc(func), mFile(file), mLine(line) { } + Context(const char* file /*__FILE__*/, int line /*__LINE__*/, + const std::string& func, + const std::string& time, + const std::ostringstream& message) : Context(file, line, func, time, message.str()) { } Context(const std::string& message, const char* file /*__FILE__*/, int line /*__LINE__*/, const std::string& func = "", diff --git a/externals/coda-oss/modules/c++/framework.h b/externals/coda-oss/modules/c++/framework.h index 1cab8338a0..410a711d99 100644 --- a/externals/coda-oss/modules/c++/framework.h +++ b/externals/coda-oss/modules/c++/framework.h @@ -1,22 +1,22 @@ -#pragma once - -#pragma warning(push) -#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under - EHc.Undefined behavior may occur if this function throws an exception. -#pragma warning(disable: 4514) // '...': unreferenced inline function has been removed -#pragma warning(disable: 4365) // '...': conversion from '...' to '...', signed/unsigned mismatch -#pragma warning(disable: 5204) // '...': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly -#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#define NOMINMAX // no min()/max() macros -#include - -#define _WINSOCK_DEPRECATED_NO_WARNINGS // '...': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings -#include -#include -#pragma comment(lib, "Ws2_32") - -#include - -#pragma warning(pop) - +#pragma once + +#pragma warning(push) +#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under - EHc.Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 4514) // '...': unreferenced inline function has been removed +#pragma warning(disable: 4365) // '...': conversion from '...' to '...', signed/unsigned mismatch +#pragma warning(disable: 5204) // '...': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly +#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define NOMINMAX // no min()/max() macros +#include + +#define _WINSOCK_DEPRECATED_NO_WARNINGS // '...': Use getaddrinfo() or GetAddrInfoW() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings +#include +#include +#pragma comment(lib, "Ws2_32") + +#include + +#pragma warning(pop) + diff --git a/externals/coda-oss/modules/c++/gsl/include/gsl/narrow b/externals/coda-oss/modules/c++/gsl/include/gsl/narrow index bec30d113f..ac341ec8cf 100644 --- a/externals/coda-oss/modules/c++/gsl/include/gsl/narrow +++ b/externals/coda-oss/modules/c++/gsl/include/gsl/narrow @@ -1,71 +1,71 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2015 Microsoft Corporation. All rights reserved. -// -// This code is licensed under the MIT License (MIT). -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef GSL_NARROW_H -#define GSL_NARROW_H -#include // for Expects -#include // for narrow_cast -namespace gsl -{ -struct narrowing_error : public std::exception -{ - const char* what() const noexcept override { return "narrowing_error"; } -}; - -// narrow() : a checked version of narrow_cast() that throws if the cast changed the value -template ::value>::type* = nullptr> -// clang-format off -GSL_SUPPRESS(type.1) // NO-FORMAT: attribute -GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) - // clang-format on - constexpr T narrow(U u) noexcept(false) -{ - constexpr const bool is_different_signedness = - (std::is_signed::value != std::is_signed::value); - -GSL_SUPPRESS(es.103) // NO-FORMAT: attribute // don't overflow -GSL_SUPPRESS(es.104) // NO-FORMAT: attribute // don't underflow -GSL_SUPPRESS(p.2) // NO-FORMAT: attribute // don't rely on undefined behavior - const T t = narrow_cast(u); // While this is technically undefined behavior in some cases (i.e., if the source value is of floating-point type - // and cannot fit into the destination integral type), the resultant behavior is benign on the platforms - // that we target (i.e., no hardware trap representations are hit). - - if (static_cast(t) != u || (is_different_signedness && ((t < T{}) != (u < U{})))) - { - throw narrowing_error{}; - } - - return t; -} - -template ::value>::type* = nullptr> -// clang-format off -GSL_SUPPRESS(type.1) // NO-FORMAT: attribute -GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) - // clang-format on - constexpr T narrow(U u) noexcept(false) -{ - const T t = narrow_cast(u); - - if (static_cast(t) != u) - { - throw narrowing_error{}; - } - - return t; -} -} // namespace gsl -#endif // GSL_NARROW_H +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2015 Microsoft Corporation. All rights reserved. +// +// This code is licensed under the MIT License (MIT). +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef GSL_NARROW_H +#define GSL_NARROW_H +#include // for Expects +#include // for narrow_cast +namespace gsl +{ +struct narrowing_error : public std::exception +{ + const char* what() const noexcept override { return "narrowing_error"; } +}; + +// narrow() : a checked version of narrow_cast() that throws if the cast changed the value +template ::value>::type* = nullptr> +// clang-format off +GSL_SUPPRESS(type.1) // NO-FORMAT: attribute +GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) + // clang-format on + constexpr T narrow(U u) noexcept(false) +{ + constexpr const bool is_different_signedness = + (std::is_signed::value != std::is_signed::value); + +GSL_SUPPRESS(es.103) // NO-FORMAT: attribute // don't overflow +GSL_SUPPRESS(es.104) // NO-FORMAT: attribute // don't underflow +GSL_SUPPRESS(p.2) // NO-FORMAT: attribute // don't rely on undefined behavior + const T t = narrow_cast(u); // While this is technically undefined behavior in some cases (i.e., if the source value is of floating-point type + // and cannot fit into the destination integral type), the resultant behavior is benign on the platforms + // that we target (i.e., no hardware trap representations are hit). + + if (static_cast(t) != u || (is_different_signedness && ((t < T{}) != (u < U{})))) + { + throw narrowing_error{}; + } + + return t; +} + +template ::value>::type* = nullptr> +// clang-format off +GSL_SUPPRESS(type.1) // NO-FORMAT: attribute +GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) + // clang-format on + constexpr T narrow(U u) noexcept(false) +{ + const T t = narrow_cast(u); + + if (static_cast(t) != u) + { + throw narrowing_error{}; + } + + return t; +} +} // namespace gsl +#endif // GSL_NARROW_H diff --git a/externals/coda-oss/modules/c++/gsl/include/gsl/span_ext b/externals/coda-oss/modules/c++/gsl/include/gsl/span_ext index 5feb2b868b..e82a5b6bad 100644 --- a/externals/coda-oss/modules/c++/gsl/include/gsl/span_ext +++ b/externals/coda-oss/modules/c++/gsl/include/gsl/span_ext @@ -1,212 +1,212 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2015 Microsoft Corporation. All rights reserved. -// -// This code is licensed under the MIT License (MIT). -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef GSL_SPAN_EXT_H -#define GSL_SPAN_EXT_H - -/////////////////////////////////////////////////////////////////////////////// -// -// File: span_ext -// Purpose: continue offering features that have been cut from the official -// implementation of span. -// While modernizing gsl::span a number of features needed to be removed to -// be compliant with the design of std::span -// -/////////////////////////////////////////////////////////////////////////////// - -#include // GSL_KERNEL_MODE -#include // for narrow_cast, narrow - -#include // for ptrdiff_t, size_t -#include - -#ifndef GSL_KERNEL_MODE -#include // for lexicographical_compare -#endif // GSL_KERNEL_MODE - -namespace gsl -{ - -// [span.views.constants], constants -constexpr const std::size_t dynamic_extent = narrow_cast(-1); - -template -class span; - -// std::equal and std::lexicographical_compare are not /kernel compatible -// so all comparison operators must be removed for kernel mode. -#ifndef GSL_KERNEL_MODE - -// [span.comparison], span comparison operators -template -constexpr bool operator==(span l, span r) -{ - return std::equal(l.begin(), l.end(), r.begin(), r.end()); -} - -template -constexpr bool operator!=(span l, span r) -{ - return !(l == r); -} - -template -constexpr bool operator<(span l, span r) -{ - return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end()); -} - -template -constexpr bool operator<=(span l, span r) -{ - return !(l > r); -} - -template -constexpr bool operator>(span l, span r) -{ - return r < l; -} - -template -constexpr bool operator>=(span l, span r) -{ - return !(l < r); -} - -#endif // GSL_KERNEL_MODE - -// -// make_span() - Utility functions for creating spans -// -template -constexpr span make_span(ElementType* ptr, typename span::size_type count) -{ - return span(ptr, count); -} - -template -constexpr span make_span(ElementType* firstElem, ElementType* lastElem) -{ - return span(firstElem, lastElem); -} - -template -constexpr span make_span(ElementType (&arr)[N]) noexcept -{ - return span(arr); -} - -template -constexpr span make_span(Container& cont) -{ - return span(cont); -} - -template -constexpr span make_span(const Container& cont) -{ - return span(cont); -} - -template -constexpr span make_span(Ptr& cont, std::size_t count) -{ - return span(cont, count); -} - -template -constexpr span make_span(Ptr& cont) -{ - return span(cont); -} - -// Specialization of gsl::at for span -template -constexpr ElementType& at(span s, index i) -{ - // No bounds checking here because it is done in span::operator[] called below - Ensures(i >= 0); - return s[narrow_cast(i)]; -} - -// [span.obs] Free observer functions -template -constexpr std::ptrdiff_t ssize(const span& s) noexcept -{ - return static_cast(s.size()); -} - -// [span.iter] Free functions for begin/end functions -template -constexpr typename span::iterator -begin(const span& s) noexcept -{ - return s.begin(); -} - -template -constexpr typename span::iterator -end(const span& s) noexcept -{ - return s.end(); -} - -template -constexpr typename span::reverse_iterator -rbegin(const span& s) noexcept -{ - return s.rbegin(); -} - -template -constexpr typename span::reverse_iterator -rend(const span& s) noexcept -{ - return s.rend(); -} - -template -constexpr typename span::iterator -cbegin(const span& s) noexcept -{ - return s.begin(); -} - -template -constexpr typename span::iterator -cend(const span& s) noexcept -{ - return s.end(); -} - -template -constexpr typename span::reverse_iterator -crbegin(const span& s) noexcept -{ - return s.rbegin(); -} - -template -constexpr typename span::reverse_iterator -crend(const span& s) noexcept -{ - return s.rend(); -} - -} // namespace gsl - -#endif // GSL_SPAN_EXT_H +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2015 Microsoft Corporation. All rights reserved. +// +// This code is licensed under the MIT License (MIT). +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef GSL_SPAN_EXT_H +#define GSL_SPAN_EXT_H + +/////////////////////////////////////////////////////////////////////////////// +// +// File: span_ext +// Purpose: continue offering features that have been cut from the official +// implementation of span. +// While modernizing gsl::span a number of features needed to be removed to +// be compliant with the design of std::span +// +/////////////////////////////////////////////////////////////////////////////// + +#include // GSL_KERNEL_MODE +#include // for narrow_cast, narrow + +#include // for ptrdiff_t, size_t +#include + +#ifndef GSL_KERNEL_MODE +#include // for lexicographical_compare +#endif // GSL_KERNEL_MODE + +namespace gsl +{ + +// [span.views.constants], constants +constexpr const std::size_t dynamic_extent = narrow_cast(-1); + +template +class span; + +// std::equal and std::lexicographical_compare are not /kernel compatible +// so all comparison operators must be removed for kernel mode. +#ifndef GSL_KERNEL_MODE + +// [span.comparison], span comparison operators +template +constexpr bool operator==(span l, span r) +{ + return std::equal(l.begin(), l.end(), r.begin(), r.end()); +} + +template +constexpr bool operator!=(span l, span r) +{ + return !(l == r); +} + +template +constexpr bool operator<(span l, span r) +{ + return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end()); +} + +template +constexpr bool operator<=(span l, span r) +{ + return !(l > r); +} + +template +constexpr bool operator>(span l, span r) +{ + return r < l; +} + +template +constexpr bool operator>=(span l, span r) +{ + return !(l < r); +} + +#endif // GSL_KERNEL_MODE + +// +// make_span() - Utility functions for creating spans +// +template +constexpr span make_span(ElementType* ptr, typename span::size_type count) +{ + return span(ptr, count); +} + +template +constexpr span make_span(ElementType* firstElem, ElementType* lastElem) +{ + return span(firstElem, lastElem); +} + +template +constexpr span make_span(ElementType (&arr)[N]) noexcept +{ + return span(arr); +} + +template +constexpr span make_span(Container& cont) +{ + return span(cont); +} + +template +constexpr span make_span(const Container& cont) +{ + return span(cont); +} + +template +constexpr span make_span(Ptr& cont, std::size_t count) +{ + return span(cont, count); +} + +template +constexpr span make_span(Ptr& cont) +{ + return span(cont); +} + +// Specialization of gsl::at for span +template +constexpr ElementType& at(span s, index i) +{ + // No bounds checking here because it is done in span::operator[] called below + Ensures(i >= 0); + return s[narrow_cast(i)]; +} + +// [span.obs] Free observer functions +template +constexpr std::ptrdiff_t ssize(const span& s) noexcept +{ + return static_cast(s.size()); +} + +// [span.iter] Free functions for begin/end functions +template +constexpr typename span::iterator +begin(const span& s) noexcept +{ + return s.begin(); +} + +template +constexpr typename span::iterator +end(const span& s) noexcept +{ + return s.end(); +} + +template +constexpr typename span::reverse_iterator +rbegin(const span& s) noexcept +{ + return s.rbegin(); +} + +template +constexpr typename span::reverse_iterator +rend(const span& s) noexcept +{ + return s.rend(); +} + +template +constexpr typename span::iterator +cbegin(const span& s) noexcept +{ + return s.begin(); +} + +template +constexpr typename span::iterator +cend(const span& s) noexcept +{ + return s.end(); +} + +template +constexpr typename span::reverse_iterator +crbegin(const span& s) noexcept +{ + return s.rbegin(); +} + +template +constexpr typename span::reverse_iterator +crend(const span& s) noexcept +{ + return s.rend(); +} + +} // namespace gsl + +#endif // GSL_SPAN_EXT_H diff --git a/externals/coda-oss/modules/c++/gsl/include/gsl/string_span b/externals/coda-oss/modules/c++/gsl/include/gsl/string_span index bcc672af09..7c1f3458ff 100644 --- a/externals/coda-oss/modules/c++/gsl/include/gsl/string_span +++ b/externals/coda-oss/modules/c++/gsl/include/gsl/string_span @@ -1,759 +1,759 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2015 Microsoft Corporation. All rights reserved. -// -// This code is licensed under the MIT License (MIT). -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef GSL_STRING_SPAN_H -#define GSL_STRING_SPAN_H - -#include // for Ensures, Expects -#include // for operator!=, operator==, dynamic_extent -#include // for narrow_cast - -#include // for equal, lexicographical_compare -#include // for array -#include // for size_t, nullptr_t -#include // for PTRDIFF_MAX -#include -#include // for basic_string, allocator, char_traits -#include // for declval, is_convertible, enable_if_t, add_... - -#if defined(_MSC_VER) && !defined(__clang__) -#pragma warning(push) - -// Turn MSVC /analyze rules that generate too much noise. TODO: fix in the tool. -#pragma warning(disable : 26446) // TODO: bug in parser - attributes and templates -#pragma warning(disable : 26481) // TODO: suppress does not work inside templates sometimes -#pragma warning(disable : 4996) // use of functions & classes marked [[deprecated]] -#endif // _MSC_VER - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - -namespace gsl -{ -// -// czstring and wzstring -// -// These are "tag" typedefs for C-style strings (i.e. null-terminated character arrays) -// that allow static analysis to help find bugs. -// -// There are no additional features/semantics that we can find a way to add inside the -// type system for these types that will not either incur significant runtime costs or -// (sometimes needlessly) break existing programs when introduced. -// - -template -using basic_zstring = CharT*; - -using czstring = basic_zstring; - -using cwzstring = basic_zstring; - -using cu16zstring = basic_zstring; - -using cu32zstring = basic_zstring; - -using zstring = basic_zstring; - -using wzstring = basic_zstring; - -using u16zstring = basic_zstring; - -using u32zstring = basic_zstring; - -namespace details -{ - template - [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " - "isocpp/CppCoreGuidelines PR#1680")]] constexpr std::size_t - string_length(const CharT* str, std::size_t n) - { - if (str == nullptr || n == dynamic_extent) return 0; - - const span str_span{str, n}; - - std::size_t len = 0; - while (len < n && str_span[len]) len++; - - return len; - } -} // namespace details - -// -// ensure_sentinel() -// -// Provides a way to obtain an span from a contiguous sequence -// that ends with a (non-inclusive) sentinel value. -// -// Will fail-fast if sentinel cannot be found before max elements are examined. -// -template -[[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " - "isocpp/CppCoreGuidelines PR#1680")]] constexpr span -ensure_sentinel(T* seq, std::size_t max = static_cast(-1)) -{ - Ensures(seq != nullptr); - - // clang-format off - GSL_SUPPRESS(f.23) // TODO: false positive // TODO: suppress does not work - // clang-format on - auto cur = seq; - Ensures(cur != nullptr); // workaround for removing the warning - - // clang-format off - GSL_SUPPRESS(bounds.1) // TODO: suppress does not work - // clang-format on - while (static_cast(cur - seq) < max && *cur != Sentinel) ++cur; - Ensures(*cur == Sentinel); - return {seq, static_cast(cur - seq)}; -} - -// -// ensure_z - creates a span for a zero terminated strings. The span will not contain the zero -// termination. Will fail fast if a null-terminator cannot be found before the limit of size_type. -// -template -[[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " - "isocpp/CppCoreGuidelines PR#1680")]] constexpr span -ensure_z(CharT* const& sz, std::size_t max = static_cast(-1)) -{ - return ensure_sentinel(sz, max); -} - -template -constexpr span ensure_z(CharT (&sz)[N]) -{ - return ensure_z(&sz[0], N); -} - -template -[[deprecated( - "string_span was removed from the C++ Core Guidelines. For more information, see " - "isocpp/CppCoreGuidelines PR#1680")]] constexpr span::type, - dynamic_extent> -ensure_z(Cont& cont) -{ - return ensure_z(cont.data(), cont.size()); -} - -template -class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " - "see isocpp/CppCoreGuidelines PR#1680")]] basic_string_span; - -namespace details -{ - template - struct [[deprecated( - "string_span was removed from the C++ Core Guidelines. For more information, " - "see isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span_oracle : std::false_type{}; - - template - struct [[deprecated( - "string_span was removed from the C++ Core Guidelines. For more information, see " - "isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span_oracle> - : std::true_type{}; - - template - struct [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span - : is_basic_string_span_oracle>{}; -} // namespace details - -// -// string_span and relatives -// -template -class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " - "see isocpp/CppCoreGuidelines PR#1680")]] basic_string_span -{ -public: - using element_type = CharT; - using value_type = std::remove_cv_t; - using pointer = std::add_pointer_t; - using reference = std::add_lvalue_reference_t; - using const_reference = std::add_lvalue_reference_t>; - using impl_type = span; - - using size_type = typename impl_type::size_type; - using iterator = typename impl_type::iterator; - using reverse_iterator = typename impl_type::reverse_iterator; - - // default (empty) - constexpr basic_string_span() noexcept = default; - - // copy - constexpr basic_string_span(const basic_string_span& other) noexcept = default; - - // assign - constexpr basic_string_span& operator=(const basic_string_span& other) noexcept = default; - - constexpr basic_string_span(pointer ptr, size_type length) : span_(ptr, length) {} - constexpr basic_string_span(pointer firstElem, pointer lastElem) : span_(firstElem, lastElem) {} - - // From static arrays - if 0-terminated, remove 0 from the view - // All other containers allow 0s within the length, so we do not remove them - template - constexpr basic_string_span(element_type(&arr)[N]) : span_(remove_z(arr)) - {} - - template > - constexpr basic_string_span(std::array & arr) noexcept : span_(arr) - {} - - template > - constexpr basic_string_span(const std::array& arr) noexcept : span_(arr) - {} - - // Container signature should work for basic_string after C++17 version exists - template - // GSL_SUPPRESS(bounds.4) // TODO: parser bug - constexpr basic_string_span(std::basic_string & str) - : span_(&str[0], str.length()) - {} - - template - constexpr basic_string_span(const std::basic_string& str) - : span_(&str[0], str.length()) - {} - - // from containers. Containers must have a pointer type and data() function signatures - template ::value && - std::is_convertible::value && - std::is_convertible().data())>::value>> - constexpr basic_string_span(Container & cont) : span_(cont) - {} - - template ::value && - std::is_convertible::value && - std::is_convertible().data())>::value>> - constexpr basic_string_span(const Container& cont) : span_(cont) - {} - - // from string_span - template < - class OtherValueType, std::size_t OtherExtent, - class = std::enable_if_t::impl_type, impl_type>::value>> - constexpr basic_string_span(basic_string_span other) - : span_(other.data(), other.length()) - {} - - template - constexpr basic_string_span first() const - { - return {span_.template first()}; - } - - constexpr basic_string_span first(size_type count) const - { - return {span_.first(count)}; - } - - template - constexpr basic_string_span last() const - { - return {span_.template last()}; - } - - constexpr basic_string_span last(size_type count) const - { - return {span_.last(count)}; - } - - template - constexpr basic_string_span subspan() const - { - return {span_.template subspan()}; - } - - constexpr basic_string_span subspan( - size_type offset, size_type count = dynamic_extent) const - { - return {span_.subspan(offset, count)}; - } - - constexpr reference operator[](size_type idx) const { return span_[idx]; } - constexpr reference operator()(size_type idx) const { return span_[idx]; } - - constexpr pointer data() const { return span_.data(); } - - constexpr size_type length() const noexcept { return span_.size(); } - constexpr size_type size() const noexcept { return span_.size(); } - constexpr size_type size_bytes() const noexcept { return span_.size_bytes(); } - constexpr size_type length_bytes() const noexcept { return span_.length_bytes(); } - constexpr bool empty() const noexcept { return size() == 0; } - - constexpr iterator begin() const noexcept { return span_.begin(); } - constexpr iterator end() const noexcept { return span_.end(); } - - constexpr reverse_iterator rbegin() const noexcept { return span_.rbegin(); } - constexpr reverse_iterator rend() const noexcept { return span_.rend(); } - -private: - static constexpr impl_type remove_z(pointer const& sz, std::size_t max) - { - return impl_type(sz, details::string_length(sz, max)); - } - - template - static constexpr impl_type remove_z(element_type(&sz)[N]) - { - return remove_z(&sz[0], N); - } - - impl_type span_; -}; - -template -using string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using cstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using wstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using cwstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using u16string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using cu16string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using u32string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using cu32string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -// -// to_string() allow (explicit) conversions from string_span to string -// - -template -constexpr std::basic_string::type> -to_string(basic_string_span view) -{ - return {view.data(), narrow_cast(view.length())}; -} - -template , - typename Allocator = std::allocator, typename gCharT, std::size_t Extent> -constexpr std::basic_string -to_basic_string(basic_string_span view) -{ - return {view.data(), narrow_cast(view.length())}; -} - -template -constexpr basic_string_span::value> -as_bytes(basic_string_span s) noexcept -{ - // clang-format off - GSL_SUPPRESS(type.1) - // clang-format on - return {reinterpret_cast(s.data()), s.size_bytes()}; -} - -template ::value>> -constexpr basic_string_span::value> -as_writable_bytes(basic_string_span s) noexcept -{ - // clang-format off - GSL_SUPPRESS(type.1) - // clang-format on - return {reinterpret_cast(s.data()), s.size_bytes()}; -} - -// zero-terminated string span, used to convert -// zero-terminated spans to legacy strings -template -class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " - "see isocpp/CppCoreGuidelines PR#1680")]] basic_zstring_span -{ -public: - using value_type = CharT; - using const_value_type = std::add_const_t; - - using pointer = std::add_pointer_t; - using const_pointer = std::add_pointer_t; - - using zstring_type = basic_zstring; - using const_zstring_type = basic_zstring; - - using impl_type = span; - using string_span_type = basic_string_span; - - constexpr basic_zstring_span(impl_type s) : span_(s) - { - // expects a zero-terminated span - Expects(s.size() > 0); - Expects(s[s.size() - 1] == value_type{}); - } - - // copy - constexpr basic_zstring_span(const basic_zstring_span& other) = default; - - // move - constexpr basic_zstring_span(basic_zstring_span && other) = default; - - // assign - constexpr basic_zstring_span& operator=(const basic_zstring_span& other) = default; - - // move assign - constexpr basic_zstring_span& operator=(basic_zstring_span&& other) = default; - - constexpr bool empty() const noexcept { return false; } - - constexpr string_span_type as_string_span() const noexcept - { - return {span_.data(), span_.size() - 1}; - } - constexpr string_span_type ensure_z() const { return gsl::ensure_z(span_); } - - constexpr const_zstring_type assume_z() const noexcept { return span_.data(); } - -private: - impl_type span_; -}; - -template -using zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using wzstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using u16zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using u32zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using czstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using cwzstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using cu16zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For " - "more information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using cu32zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For " - "more information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -// operator == -template ::value || - std::is_convertible>>::value>> -bool operator==(const gsl::basic_string_span& one, const T& other) -{ - const gsl::basic_string_span> tmp(other); - return std::equal(one.begin(), one.end(), tmp.begin(), tmp.end()); -} - -template ::value && - std::is_convertible>>::value>> -bool operator==(const T& one, const gsl::basic_string_span& other) -{ - const gsl::basic_string_span> tmp(one); - return std::equal(tmp.begin(), tmp.end(), other.begin(), other.end()); -} - -// operator != -template , Extent>>::value>> -bool operator!=(gsl::basic_string_span one, const T& other) -{ - return !(one == other); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename = std::enable_if_t< - std::is_convertible, Extent>>::value && - !gsl::details::is_basic_string_span::value>> -bool operator!=(const T& one, gsl::basic_string_span other) -{ - return !(one == other); -} - -// operator< -template , Extent>>::value>> -bool operator<(gsl::basic_string_span one, const T& other) -{ - const gsl::basic_string_span, Extent> tmp(other); - return std::lexicographical_compare(one.begin(), one.end(), tmp.begin(), tmp.end()); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename = std::enable_if_t< - std::is_convertible, Extent>>::value && - !gsl::details::is_basic_string_span::value>> -bool operator<(const T& one, gsl::basic_string_span other) -{ - gsl::basic_string_span, Extent> tmp(one); - return std::lexicographical_compare(tmp.begin(), tmp.end(), other.begin(), other.end()); -} - -#ifndef _MSC_VER - -// VS treats temp and const containers as convertible to basic_string_span, -// so the cases below are already covered by the previous operators - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator<(gsl::basic_string_span one, const T& other) -{ - gsl::basic_string_span, Extent> tmp(other); - return std::lexicographical_compare(one.begin(), one.end(), tmp.begin(), tmp.end()); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator<(const T& one, gsl::basic_string_span other) -{ - gsl::basic_string_span, Extent> tmp(one); - return std::lexicographical_compare(tmp.begin(), tmp.end(), other.begin(), other.end()); -} -#endif - -// operator <= -template , Extent>>::value>> -bool operator<=(gsl::basic_string_span one, const T& other) -{ - return !(other < one); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename = std::enable_if_t< - std::is_convertible, Extent>>::value && - !gsl::details::is_basic_string_span::value>> -bool operator<=(const T& one, gsl::basic_string_span other) -{ - return !(other < one); -} - -#ifndef _MSC_VER - -// VS treats temp and const containers as convertible to basic_string_span, -// so the cases below are already covered by the previous operators - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator<=(gsl::basic_string_span one, const T& other) -{ - return !(other < one); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator<=(const T& one, gsl::basic_string_span other) -{ - return !(other < one); -} -#endif - -// operator> -template , Extent>>::value>> -bool operator>(gsl::basic_string_span one, const T& other) -{ - return other < one; -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename = std::enable_if_t< - std::is_convertible, Extent>>::value && - !gsl::details::is_basic_string_span::value>> -bool operator>(const T& one, gsl::basic_string_span other) -{ - return other < one; -} - -#ifndef _MSC_VER - -// VS treats temp and const containers as convertible to basic_string_span, -// so the cases below are already covered by the previous operators - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator>(gsl::basic_string_span one, const T& other) -{ - return other < one; -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator>(const T& one, gsl::basic_string_span other) -{ - return other < one; -} -#endif - -// operator >= -template , Extent>>::value>> -bool operator>=(gsl::basic_string_span one, const T& other) -{ - return !(one < other); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename = std::enable_if_t< - std::is_convertible, Extent>>::value && - !gsl::details::is_basic_string_span::value>> -bool operator>=(const T& one, gsl::basic_string_span other) -{ - return !(one < other); -} - -#ifndef _MSC_VER - -// VS treats temp and const containers as convertible to basic_string_span, -// so the cases below are already covered by the previous operators - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator>=(gsl::basic_string_span one, const T& other) -{ - return !(one < other); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator>=(const T& one, gsl::basic_string_span other) -{ - return !(one < other); -} -#endif -} // namespace gsl - -#if defined(_MSC_VER) && !defined(__clang__) -#pragma warning(pop) - -#endif // _MSC_VER - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -#endif // GSL_STRING_SPAN_H +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2015 Microsoft Corporation. All rights reserved. +// +// This code is licensed under the MIT License (MIT). +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef GSL_STRING_SPAN_H +#define GSL_STRING_SPAN_H + +#include // for Ensures, Expects +#include // for operator!=, operator==, dynamic_extent +#include // for narrow_cast + +#include // for equal, lexicographical_compare +#include // for array +#include // for size_t, nullptr_t +#include // for PTRDIFF_MAX +#include +#include // for basic_string, allocator, char_traits +#include // for declval, is_convertible, enable_if_t, add_... + +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(push) + +// Turn MSVC /analyze rules that generate too much noise. TODO: fix in the tool. +#pragma warning(disable : 26446) // TODO: bug in parser - attributes and templates +#pragma warning(disable : 26481) // TODO: suppress does not work inside templates sometimes +#pragma warning(disable : 4996) // use of functions & classes marked [[deprecated]] +#endif // _MSC_VER + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +namespace gsl +{ +// +// czstring and wzstring +// +// These are "tag" typedefs for C-style strings (i.e. null-terminated character arrays) +// that allow static analysis to help find bugs. +// +// There are no additional features/semantics that we can find a way to add inside the +// type system for these types that will not either incur significant runtime costs or +// (sometimes needlessly) break existing programs when introduced. +// + +template +using basic_zstring = CharT*; + +using czstring = basic_zstring; + +using cwzstring = basic_zstring; + +using cu16zstring = basic_zstring; + +using cu32zstring = basic_zstring; + +using zstring = basic_zstring; + +using wzstring = basic_zstring; + +using u16zstring = basic_zstring; + +using u32zstring = basic_zstring; + +namespace details +{ + template + [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " + "isocpp/CppCoreGuidelines PR#1680")]] constexpr std::size_t + string_length(const CharT* str, std::size_t n) + { + if (str == nullptr || n == dynamic_extent) return 0; + + const span str_span{str, n}; + + std::size_t len = 0; + while (len < n && str_span[len]) len++; + + return len; + } +} // namespace details + +// +// ensure_sentinel() +// +// Provides a way to obtain an span from a contiguous sequence +// that ends with a (non-inclusive) sentinel value. +// +// Will fail-fast if sentinel cannot be found before max elements are examined. +// +template +[[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " + "isocpp/CppCoreGuidelines PR#1680")]] constexpr span +ensure_sentinel(T* seq, std::size_t max = static_cast(-1)) +{ + Ensures(seq != nullptr); + + // clang-format off + GSL_SUPPRESS(f.23) // TODO: false positive // TODO: suppress does not work + // clang-format on + auto cur = seq; + Ensures(cur != nullptr); // workaround for removing the warning + + // clang-format off + GSL_SUPPRESS(bounds.1) // TODO: suppress does not work + // clang-format on + while (static_cast(cur - seq) < max && *cur != Sentinel) ++cur; + Ensures(*cur == Sentinel); + return {seq, static_cast(cur - seq)}; +} + +// +// ensure_z - creates a span for a zero terminated strings. The span will not contain the zero +// termination. Will fail fast if a null-terminator cannot be found before the limit of size_type. +// +template +[[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " + "isocpp/CppCoreGuidelines PR#1680")]] constexpr span +ensure_z(CharT* const& sz, std::size_t max = static_cast(-1)) +{ + return ensure_sentinel(sz, max); +} + +template +constexpr span ensure_z(CharT (&sz)[N]) +{ + return ensure_z(&sz[0], N); +} + +template +[[deprecated( + "string_span was removed from the C++ Core Guidelines. For more information, see " + "isocpp/CppCoreGuidelines PR#1680")]] constexpr span::type, + dynamic_extent> +ensure_z(Cont& cont) +{ + return ensure_z(cont.data(), cont.size()); +} + +template +class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " + "see isocpp/CppCoreGuidelines PR#1680")]] basic_string_span; + +namespace details +{ + template + struct [[deprecated( + "string_span was removed from the C++ Core Guidelines. For more information, " + "see isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span_oracle : std::false_type{}; + + template + struct [[deprecated( + "string_span was removed from the C++ Core Guidelines. For more information, see " + "isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span_oracle> + : std::true_type{}; + + template + struct [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span + : is_basic_string_span_oracle>{}; +} // namespace details + +// +// string_span and relatives +// +template +class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " + "see isocpp/CppCoreGuidelines PR#1680")]] basic_string_span +{ +public: + using element_type = CharT; + using value_type = std::remove_cv_t; + using pointer = std::add_pointer_t; + using reference = std::add_lvalue_reference_t; + using const_reference = std::add_lvalue_reference_t>; + using impl_type = span; + + using size_type = typename impl_type::size_type; + using iterator = typename impl_type::iterator; + using reverse_iterator = typename impl_type::reverse_iterator; + + // default (empty) + constexpr basic_string_span() noexcept = default; + + // copy + constexpr basic_string_span(const basic_string_span& other) noexcept = default; + + // assign + constexpr basic_string_span& operator=(const basic_string_span& other) noexcept = default; + + constexpr basic_string_span(pointer ptr, size_type length) : span_(ptr, length) {} + constexpr basic_string_span(pointer firstElem, pointer lastElem) : span_(firstElem, lastElem) {} + + // From static arrays - if 0-terminated, remove 0 from the view + // All other containers allow 0s within the length, so we do not remove them + template + constexpr basic_string_span(element_type(&arr)[N]) : span_(remove_z(arr)) + {} + + template > + constexpr basic_string_span(std::array & arr) noexcept : span_(arr) + {} + + template > + constexpr basic_string_span(const std::array& arr) noexcept : span_(arr) + {} + + // Container signature should work for basic_string after C++17 version exists + template + // GSL_SUPPRESS(bounds.4) // TODO: parser bug + constexpr basic_string_span(std::basic_string & str) + : span_(&str[0], str.length()) + {} + + template + constexpr basic_string_span(const std::basic_string& str) + : span_(&str[0], str.length()) + {} + + // from containers. Containers must have a pointer type and data() function signatures + template ::value && + std::is_convertible::value && + std::is_convertible().data())>::value>> + constexpr basic_string_span(Container & cont) : span_(cont) + {} + + template ::value && + std::is_convertible::value && + std::is_convertible().data())>::value>> + constexpr basic_string_span(const Container& cont) : span_(cont) + {} + + // from string_span + template < + class OtherValueType, std::size_t OtherExtent, + class = std::enable_if_t::impl_type, impl_type>::value>> + constexpr basic_string_span(basic_string_span other) + : span_(other.data(), other.length()) + {} + + template + constexpr basic_string_span first() const + { + return {span_.template first()}; + } + + constexpr basic_string_span first(size_type count) const + { + return {span_.first(count)}; + } + + template + constexpr basic_string_span last() const + { + return {span_.template last()}; + } + + constexpr basic_string_span last(size_type count) const + { + return {span_.last(count)}; + } + + template + constexpr basic_string_span subspan() const + { + return {span_.template subspan()}; + } + + constexpr basic_string_span subspan( + size_type offset, size_type count = dynamic_extent) const + { + return {span_.subspan(offset, count)}; + } + + constexpr reference operator[](size_type idx) const { return span_[idx]; } + constexpr reference operator()(size_type idx) const { return span_[idx]; } + + constexpr pointer data() const { return span_.data(); } + + constexpr size_type length() const noexcept { return span_.size(); } + constexpr size_type size() const noexcept { return span_.size(); } + constexpr size_type size_bytes() const noexcept { return span_.size_bytes(); } + constexpr size_type length_bytes() const noexcept { return span_.length_bytes(); } + constexpr bool empty() const noexcept { return size() == 0; } + + constexpr iterator begin() const noexcept { return span_.begin(); } + constexpr iterator end() const noexcept { return span_.end(); } + + constexpr reverse_iterator rbegin() const noexcept { return span_.rbegin(); } + constexpr reverse_iterator rend() const noexcept { return span_.rend(); } + +private: + static constexpr impl_type remove_z(pointer const& sz, std::size_t max) + { + return impl_type(sz, details::string_length(sz, max)); + } + + template + static constexpr impl_type remove_z(element_type(&sz)[N]) + { + return remove_z(&sz[0], N); + } + + impl_type span_; +}; + +template +using string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using cstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using wstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using cwstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using u16string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using cu16string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using u32string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using cu32string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +// +// to_string() allow (explicit) conversions from string_span to string +// + +template +constexpr std::basic_string::type> +to_string(basic_string_span view) +{ + return {view.data(), narrow_cast(view.length())}; +} + +template , + typename Allocator = std::allocator, typename gCharT, std::size_t Extent> +constexpr std::basic_string +to_basic_string(basic_string_span view) +{ + return {view.data(), narrow_cast(view.length())}; +} + +template +constexpr basic_string_span::value> +as_bytes(basic_string_span s) noexcept +{ + // clang-format off + GSL_SUPPRESS(type.1) + // clang-format on + return {reinterpret_cast(s.data()), s.size_bytes()}; +} + +template ::value>> +constexpr basic_string_span::value> +as_writable_bytes(basic_string_span s) noexcept +{ + // clang-format off + GSL_SUPPRESS(type.1) + // clang-format on + return {reinterpret_cast(s.data()), s.size_bytes()}; +} + +// zero-terminated string span, used to convert +// zero-terminated spans to legacy strings +template +class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " + "see isocpp/CppCoreGuidelines PR#1680")]] basic_zstring_span +{ +public: + using value_type = CharT; + using const_value_type = std::add_const_t; + + using pointer = std::add_pointer_t; + using const_pointer = std::add_pointer_t; + + using zstring_type = basic_zstring; + using const_zstring_type = basic_zstring; + + using impl_type = span; + using string_span_type = basic_string_span; + + constexpr basic_zstring_span(impl_type s) : span_(s) + { + // expects a zero-terminated span + Expects(s.size() > 0); + Expects(s[s.size() - 1] == value_type{}); + } + + // copy + constexpr basic_zstring_span(const basic_zstring_span& other) = default; + + // move + constexpr basic_zstring_span(basic_zstring_span && other) = default; + + // assign + constexpr basic_zstring_span& operator=(const basic_zstring_span& other) = default; + + // move assign + constexpr basic_zstring_span& operator=(basic_zstring_span&& other) = default; + + constexpr bool empty() const noexcept { return false; } + + constexpr string_span_type as_string_span() const noexcept + { + return {span_.data(), span_.size() - 1}; + } + constexpr string_span_type ensure_z() const { return gsl::ensure_z(span_); } + + constexpr const_zstring_type assume_z() const noexcept { return span_.data(); } + +private: + impl_type span_; +}; + +template +using zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using wzstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using u16zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using u32zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using czstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using cwzstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using cu16zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For " + "more information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using cu32zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For " + "more information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +// operator == +template ::value || + std::is_convertible>>::value>> +bool operator==(const gsl::basic_string_span& one, const T& other) +{ + const gsl::basic_string_span> tmp(other); + return std::equal(one.begin(), one.end(), tmp.begin(), tmp.end()); +} + +template ::value && + std::is_convertible>>::value>> +bool operator==(const T& one, const gsl::basic_string_span& other) +{ + const gsl::basic_string_span> tmp(one); + return std::equal(tmp.begin(), tmp.end(), other.begin(), other.end()); +} + +// operator != +template , Extent>>::value>> +bool operator!=(gsl::basic_string_span one, const T& other) +{ + return !(one == other); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename = std::enable_if_t< + std::is_convertible, Extent>>::value && + !gsl::details::is_basic_string_span::value>> +bool operator!=(const T& one, gsl::basic_string_span other) +{ + return !(one == other); +} + +// operator< +template , Extent>>::value>> +bool operator<(gsl::basic_string_span one, const T& other) +{ + const gsl::basic_string_span, Extent> tmp(other); + return std::lexicographical_compare(one.begin(), one.end(), tmp.begin(), tmp.end()); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename = std::enable_if_t< + std::is_convertible, Extent>>::value && + !gsl::details::is_basic_string_span::value>> +bool operator<(const T& one, gsl::basic_string_span other) +{ + gsl::basic_string_span, Extent> tmp(one); + return std::lexicographical_compare(tmp.begin(), tmp.end(), other.begin(), other.end()); +} + +#ifndef _MSC_VER + +// VS treats temp and const containers as convertible to basic_string_span, +// so the cases below are already covered by the previous operators + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator<(gsl::basic_string_span one, const T& other) +{ + gsl::basic_string_span, Extent> tmp(other); + return std::lexicographical_compare(one.begin(), one.end(), tmp.begin(), tmp.end()); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator<(const T& one, gsl::basic_string_span other) +{ + gsl::basic_string_span, Extent> tmp(one); + return std::lexicographical_compare(tmp.begin(), tmp.end(), other.begin(), other.end()); +} +#endif + +// operator <= +template , Extent>>::value>> +bool operator<=(gsl::basic_string_span one, const T& other) +{ + return !(other < one); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename = std::enable_if_t< + std::is_convertible, Extent>>::value && + !gsl::details::is_basic_string_span::value>> +bool operator<=(const T& one, gsl::basic_string_span other) +{ + return !(other < one); +} + +#ifndef _MSC_VER + +// VS treats temp and const containers as convertible to basic_string_span, +// so the cases below are already covered by the previous operators + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator<=(gsl::basic_string_span one, const T& other) +{ + return !(other < one); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator<=(const T& one, gsl::basic_string_span other) +{ + return !(other < one); +} +#endif + +// operator> +template , Extent>>::value>> +bool operator>(gsl::basic_string_span one, const T& other) +{ + return other < one; +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename = std::enable_if_t< + std::is_convertible, Extent>>::value && + !gsl::details::is_basic_string_span::value>> +bool operator>(const T& one, gsl::basic_string_span other) +{ + return other < one; +} + +#ifndef _MSC_VER + +// VS treats temp and const containers as convertible to basic_string_span, +// so the cases below are already covered by the previous operators + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator>(gsl::basic_string_span one, const T& other) +{ + return other < one; +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator>(const T& one, gsl::basic_string_span other) +{ + return other < one; +} +#endif + +// operator >= +template , Extent>>::value>> +bool operator>=(gsl::basic_string_span one, const T& other) +{ + return !(one < other); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename = std::enable_if_t< + std::is_convertible, Extent>>::value && + !gsl::details::is_basic_string_span::value>> +bool operator>=(const T& one, gsl::basic_string_span other) +{ + return !(one < other); +} + +#ifndef _MSC_VER + +// VS treats temp and const containers as convertible to basic_string_span, +// so the cases below are already covered by the previous operators + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator>=(gsl::basic_string_span one, const T& other) +{ + return !(one < other); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator>=(const T& one, gsl::basic_string_span other) +{ + return !(one < other); +} +#endif +} // namespace gsl + +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(pop) + +#endif // _MSC_VER + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif +#endif // GSL_STRING_SPAN_H diff --git a/externals/coda-oss/modules/c++/gsl/include/import/gsl.h b/externals/coda-oss/modules/c++/gsl/include/import/gsl.h index 4fa640d320..7609c95266 100644 --- a/externals/coda-oss/modules/c++/gsl/include/import/gsl.h +++ b/externals/coda-oss/modules/c++/gsl/include/import/gsl.h @@ -1,30 +1,30 @@ -/* ========================================================================= - * This file is part of coda-oss - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * - * sys-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - - -#ifndef CODA_OSS_import_gsl_h_INCLUDED_ -#define CODA_OSS_import_gsl_h_INCLUDED_ -#pragma once - -#include "gsl/gsl.h" - -#endif // CODA_OSS_import_gsl_h_INCLUDED_ +/* ========================================================================= + * This file is part of coda-oss + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * + * sys-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + + +#ifndef CODA_OSS_import_gsl_h_INCLUDED_ +#define CODA_OSS_import_gsl_h_INCLUDED_ +#pragma once + +#include "gsl/gsl.h" + +#endif // CODA_OSS_import_gsl_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/H5_.h b/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/H5_.h index cd470aef24..5f50a843b1 100644 --- a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/H5_.h +++ b/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/H5_.h @@ -47,6 +47,10 @@ CODA_OSS_disable_warning_system_header_push #pragma warning(disable: 26477) // Use '...' rather than 0 or NULL(es .47). #pragma warning(disable: 26457) // (void) should not be used to ignore return values, use '...' instead (es.48). #pragma warning(disable: 26813) // Use '...' to check if a flag is set. +#pragma warning(disable: 26475) // Do not use function style casts (es.49). Prefer '...' over '...' + +#pragma comment(lib, "shlwapi") // StrStrI() + #else CODA_OSS_disable_warning(-Wshadow) CODA_OSS_disable_warning(-Wsuggest-override) diff --git a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/HDF5Exception.h b/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/HDF5Exception.h deleted file mode 100644 index 463b8bf86b..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/HDF5Exception.h +++ /dev/null @@ -1,57 +0,0 @@ -/* ========================================================================= - * This file is part of hdf5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * hdf5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#pragma once -#ifndef CODA_OSS_hdf5_lite_HDF5Exception_h_INCLUDED_ -#define CODA_OSS_hdf5_lite_HDF5Exception_h_INCLUDED_ - -#include "except/Exception.h" - -/*! - * \file HDF5Exception.h - * \brief Contains the exceptions specific to HDF5 - * - * This file contains all of the specialized HDF5 exceptions used by - * the hdf5::lite package - */ -namespace hdf5 -{ -namespace lite -{ - -/*! - * \class HDF5Exception - * \brief The base HDF5 exception class - * - * This is the default HDF5 exception, for when - * other, more specialized exception make no sense - */ -CODA_OSS_DECLARE_EXCEPTION(HDF5); - -CODA_OSS_DECLARE_EXTENDED_EXCEPTION(DataSet, hdf5::lite::HDF5Exception); -CODA_OSS_DECLARE_EXTENDED_EXCEPTION(DataSpace, hdf5::lite::HDF5Exception); -CODA_OSS_DECLARE_EXTENDED_EXCEPTION(DataType, hdf5::lite::HDF5Exception); - -} -} - -#endif // CODA_OSS_hdf5_lite_HDF5Exception_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/Info.h b/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/Info.h deleted file mode 100644 index 145741f864..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/Info.h +++ /dev/null @@ -1,109 +0,0 @@ -/* ========================================================================= - * This file is part of hdf5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * hdf5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#pragma once -#ifndef CODA_OSS_hdf5_lite_Info_h_INCLUDED_ -#define CODA_OSS_hdf5_lite_Info_h_INCLUDED_ - -#include -#include - -#include "config/Exports.h" -#include "sys/filesystem.h" - -/*! - * \file Read.h - * \brief HDF File-reading API - * - * These are simple routines to read HDF5 files; they're modeled after the MATLab API - * https://www.mathworks.com/help/matlab/ref/h5info.html - */ -namespace hdf5 -{ -namespace lite -{ -enum class Class -{ - NoClass = -1, /**< error */ - Integer = 0, /**< integer types */ - Float = 1, /**< floating-point types */ - Time = 2, /**< date and time types */ - String = 3, /**< character string types */ - Bitfield = 4, /**< bit field types */ - Opaque = 5, /**< opaque types */ - Compound = 6, /**< compound types */ - Reference = 7, /**< reference types */ - Enum = 8, /**< enumeration types */ - Vlen = 9, /**< variable-Length types */ - Array = 10, /**< array types */ -}; - -// https://docs.hdfgroup.org/hdf5/develop/_h5_d_m__u_g.html -struct NamedObject -{ - std::string filename; // could be a URL, so not std::filesystem::path - std::string name; -}; - -struct DataTypeInfo final : public NamedObject -{ - Class h5Class; - // Type - size_t size = 0; -}; - -struct DataSpaceInfo final -{ -}; - -struct DataSetInfo final : public NamedObject -{ - DataTypeInfo dataType; - DataSpaceInfo dataSpace; - // ChunkSize - // FillValue - // Filter - // Attributes -}; - -struct GroupInfo : public NamedObject -{ - std::vector groups; - std::vector dataSets; - std::vector dataTypes; - // Links - // Attributes -}; - -struct FileInfo final : public GroupInfo -{ -}; - - -CODA_OSS_API FileInfo fileInfo(const coda_oss::filesystem::path&); -CODA_OSS_API GroupInfo groupInfo(const coda_oss::filesystem::path&, const std::string& loc); -CODA_OSS_API DataSetInfo dataSetInfo(const coda_oss::filesystem::path&, const std::string& loc); - -} -} - -#endif // CODA_OSS_hdf5_lite_Info_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/Read.h b/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/Read.h deleted file mode 100644 index 72498652f7..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/Read.h +++ /dev/null @@ -1,55 +0,0 @@ -/* ========================================================================= - * This file is part of hdf5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * hdf5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#pragma once -#ifndef CODA_OSS_hdf5_lite_Read_h_INCLUDED_ -#define CODA_OSS_hdf5_lite_Read_h_INCLUDED_ - -/*! - * \file Read.h - * \brief HDF File-reading API - * - * These are simple routines to read HDF5 files; they're loosely modeled after the MATLab API - * https://www.mathworks.com/help/matlab/import_export/import-hdf5-files.html - */ - -#include -#include - -#include "config/Exports.h" -#include "sys/filesystem.h" -#include "types/RowCol.h" - -#include "SpanRC.h" - -namespace hdf5 -{ -namespace lite -{ - -CODA_OSS_API SpanRC readFile(const coda_oss::filesystem::path&, const std::string& loc, std::vector&); -CODA_OSS_API SpanRC readFile(const coda_oss::filesystem::path&, const std::string& loc, std::vector&); - -} -} - -#endif // CODA_OSS_hdf5_lite_Read_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/Write.h b/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/Write.h deleted file mode 100644 index 536d74fa3e..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/include/hdf5/lite/Write.h +++ /dev/null @@ -1,83 +0,0 @@ -/* ========================================================================= - * This file is part of hdf5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2023, Maxar Technologies, Inc. - * - * hdf5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#pragma once -#ifndef CODA_OSS_hdf5_lite_Write_h_INCLUDED_ -#define CODA_OSS_hdf5_lite_Write_h_INCLUDED_ - - /*! - * \file Write.h - * \brief HDF File-writing API - * - * These are simple routines to write HDF5 files; they're loosely modeled after the MATLab API - * https://www.mathworks.com/help/matlab/ref/h5create.html - * https://www.mathworks.com/help/matlab/ref/h5write.html - */ - -#include -#include - -#include "config/Exports.h" -#include "sys/filesystem.h" -#include "types/RowCol.h" - -#include "SpanRC.h" - -namespace hdf5 -{ -namespace lite -{ -template // currently implemented for float and double -CODA_OSS_API void createFile(const coda_oss::filesystem::path&, const std::string& ds, const types::RowCol&); -template<> CODA_OSS_API void createFile(const coda_oss::filesystem::path&, const std::string& ds, const types::RowCol&); -template<> CODA_OSS_API void createFile(const coda_oss::filesystem::path&, const std::string& ds, const types::RowCol&); - -CODA_OSS_API void createFile(const coda_oss::filesystem::path&, const std::string& ds, SpanRC); -inline void createFile(const coda_oss::filesystem::path& path, const std::string& ds, SpanRC data_) -{ - SpanRC data(data_.data(), data_.dims()); - createFile(path, ds, data); -} -CODA_OSS_API void createFile(const coda_oss::filesystem::path&, const std::string& ds, SpanRC); -inline void createFile(const coda_oss::filesystem::path& path, const std::string& ds, SpanRC data_) -{ - SpanRC data(data_.data(), data_.dims()); - createFile(path, ds, data); -} - -CODA_OSS_API void writeFile(const coda_oss::filesystem::path&, const std::string& loc, SpanRC); -inline void writeFile(const coda_oss::filesystem::path& path, const std::string& ds, SpanRC data_) -{ - SpanRC data(data_.data(), data_.dims()); - writeFile(path, ds, data); -} -CODA_OSS_API void writeFile(const coda_oss::filesystem::path&, const std::string& loc, SpanRC); -inline void writeFile(const coda_oss::filesystem::path& path, const std::string& ds, SpanRC data_) -{ - SpanRC data(data_.data(), data_.dims()); - writeFile(path, ds, data); -} - -} -} - -#endif // CODA_OSS_hdf5_lite_Write_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/hdf5.lite/include/import/hdf5/lite.h b/externals/coda-oss/modules/c++/hdf5.lite/include/import/hdf5/lite.h index 9996da8ab3..c256e56fa1 100644 --- a/externals/coda-oss/modules/c++/hdf5.lite/include/import/hdf5/lite.h +++ b/externals/coda-oss/modules/c++/hdf5.lite/include/import/hdf5/lite.h @@ -1,10 +1,11 @@ /* ========================================================================= - * This file is part of xml.lite-c++ + * This file is part of hdf5.lite-c++ * ========================================================================= * * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * (C) Copyright 2022, Maxar Technologies, Inc. * - * xml.lite-c++ is free software; you can redistribute it and/or modify + * hdf5.lite-c++ is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. @@ -20,10 +21,10 @@ * */ +#pragma once #ifndef CODA_OSS_hd5_lite_import_lite_h_INCLUDED_ #define CODA_OSS_hd5_lite_import_lite_h_INCLUDED_ -#pragma once -#include "hdf5/lite/Read.h" +#include "hdf5/lite/highfive.h" #endif // CODA_OSS_hd5_lite_import_lite_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/hdf5.lite/source/H5.cpp b/externals/coda-oss/modules/c++/hdf5.lite/source/H5.cpp deleted file mode 100644 index 265f25de88..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/source/H5.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* ========================================================================= - * This file is part of hd5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * hd5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include "H5.h" - -#include -#include // std::ignore - -int hdf5::lite::details::getSimpleExtentNdims(const H5::DataSpace& dataspace) -{ - /* - * Get the number of dimensions in the dataspace. - */ - const auto rank = dataspace.getSimpleExtentNdims(); - // we only support 1- and 2-D data - if ((rank != 1) && (rank != 2)) - { - throw std::invalid_argument("'rank' must be 1 or 2."); - } - return rank; -} - -std::vector hdf5::lite::details::getSimpleExtentDims(const H5::DataSpace& dataspace) -{ - /* - * Get the number of dimensions in the dataspace. - */ - const auto rank = getSimpleExtentNdims(dataspace); - - /* - * Get the dimension size of each dimension in the dataspace. - */ - std::vector dims_out(rank); - dims_out.resize(rank); - const auto ndims = dataspace.getSimpleExtentDims(dims_out.data()); - dims_out.resize(ndims); - if (dims_out.empty() || (dims_out.size() > 2)) - { - throw std::invalid_argument("dims_out.size() must be 1 or 2."); - } - - return dims_out; -} - -types::RowCol hdf5::lite::details::getSimpleExtentSize(const H5::DataSet& dataset) -{ - /* - * Get dataspace of the dataset. - */ - const auto dataspace = dataset.getSpace(); - - /* - * Get the dimension size of each dimension in the dataspace. - */ - const auto dims_out = getSimpleExtentDims(dataspace); - - // Does it matter whether it's 1-row and n-cols or n-cols and 1-row? - types::RowCol retval; - retval.row = dims_out[0]; - retval.col = dims_out.size() == 2 ? dims_out[1] : 1; - return retval; -} diff --git a/externals/coda-oss/modules/c++/hdf5.lite/source/H5.h b/externals/coda-oss/modules/c++/hdf5.lite/source/H5.h deleted file mode 100644 index ecfe293d18..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/source/H5.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ========================================================================= - * This file is part of hd5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * hd5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#pragma once -#ifndef CODA_OSS_hdf5_lite_H5_h_INCLUDED_ -#define CODA_OSS_hdf5_lite_H5_h_INCLUDED_ - -#include - -#include "types/RowCol.h" - -#include "hdf5/lite/H5_.h" - -// Utility routines for INTERNAL use! - -namespace hdf5 -{ -namespace lite -{ -namespace details -{ - -int getSimpleExtentNdims(const H5::DataSpace&); -std::vector getSimpleExtentDims(const H5::DataSpace&); -types::RowCol getSimpleExtentSize(const H5::DataSet&); - -} -} -} - -#endif // CODA_OSS_hdf5_lite_H5_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/hdf5.lite/source/Info.cpp b/externals/coda-oss/modules/c++/hdf5.lite/source/Info.cpp deleted file mode 100644 index 18062343ab..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/source/Info.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* ========================================================================= - * This file is part of hd5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * hd5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include "hdf5/lite/Info.h" - -#include // std::ignore -#include - -#include "H5.h" -#include "hdf5.lite.h" - - -// https://docs.hdfgroup.org/archive/support/HDF5/doc1.8/cpplus_RM/h5group_8cpp-example.html -static herr_t group_info(hid_t loc_id, const char *name, const H5L_info_t* /*linfo*/, void *opdata) -{ - // only interested in groups - const auto obj = H5Gopen2(loc_id, name, H5P_DEFAULT); - if (obj > 0) - { - H5Gclose(obj); - - hdf5::lite::GroupInfo info; - info.name = name; - - auto pRetval = static_cast*>(opdata); - pRetval->push_back(info); - } - - return 0; -} -static std::vector getGroups(H5::Group& group) -{ - std::vector retval; - - const auto herr = H5Literate(group.getId(), H5_INDEX_NAME, H5_ITER_INC, nullptr /*idx*/, group_info, &retval); - if (herr != 0) - { - // How can this happen? - throw std::logic_error("H5Literate failed."); - } - - return retval; - } - -// https://docs.hdfgroup.org/archive/support/HDF5/doc1.8/cpplus_RM/h5group_8cpp-example.html -static herr_t dataset_info(hid_t loc_id, const char *name, const H5L_info_t* /*linfo*/, void *opdata) -{ - // only interested in Datasets - const auto obj = H5Dopen2(loc_id, name, H5P_DEFAULT); - if (obj > 0) - { - H5Dclose(obj); - - hdf5::lite::DataSetInfo info; - info.name = name; - - auto pRetval = static_cast*>(opdata); - pRetval->push_back(info); - } - - return 0; -} -static std::vector getDataSets(H5::Group& group) - { - std::vector retval; - - const auto herr = H5Literate(group.getId(), H5_INDEX_NAME, H5_ITER_INC, nullptr /*idx*/, dataset_info, &retval); - if (herr != 0) - { - // How can this happen? - throw std::logic_error("H5Literate failed."); - } - - return retval; - } - -// https://docs.hdfgroup.org/archive/support/HDF5/doc1.8/cpplus_RM/h5group_8cpp-example.html -static herr_t datatype_info(hid_t loc_id, const char *name, const H5L_info_t* /*linfo*/, void *opdata) -{ - // only interested in Datatypes - const auto obj = H5Topen2(loc_id, name, H5P_DEFAULT); - if (obj > 0) - { - H5Tclose(obj); - - hdf5::lite::DataTypeInfo info; - info.name = name; - - auto pRetval = static_cast*>(opdata); - pRetval->push_back(info); - } - - return 0; -} -static std::vector getDataTypes(H5::Group& group) - { - std::vector retval; - - const auto herr = H5Literate(group.getId(), H5_INDEX_NAME, H5_ITER_INC, nullptr /*idx*/, datatype_info, &retval); - if (herr != 0) - { - // How can this happen? - throw std::logic_error("H5Literate failed."); - } - - return retval; - } - -// https://docs.hdfgroup.org/archive/support/HDF5/doc1.8/cpplus_RM/readdata_8cpp-example.html -static hdf5::lite::GroupInfo groupInfo_(const coda_oss::filesystem::path& filename, const std::string& loc) -{ - hdf5::lite::GroupInfo retval; - retval.filename = filename.string(); - retval.name = loc; - - /* - * Open the specified file and the specified dataset in the file. - */ - H5::H5File file(retval.filename, H5F_ACC_RDONLY); - auto group = file.openGroup(retval.name); - - retval.groups = getGroups(group); - retval.dataSets = getDataSets(group); - retval.dataTypes = getDataTypes(group); - - return retval; -} -hdf5::lite::GroupInfo hdf5::lite::groupInfo(const coda_oss::filesystem::path& filename, const std::string& loc) -{ - return details::try_catch_H5Exceptions(groupInfo_, __FILE__, __LINE__, filename, loc); -} -hdf5::lite::FileInfo hdf5::lite::fileInfo(const coda_oss::filesystem::path& filename) -{ - hdf5::lite::FileInfo retval; - hdf5::lite::GroupInfo& retval_ = retval; - retval_= groupInfo(filename, "/" /*loc*/); - return retval; -} - -static hdf5::lite::Class H5T_class_to_Class(H5T_class_t type_class) -{ - switch (type_class) - { - case H5T_NO_CLASS: return hdf5::lite::Class::NoClass; - case H5T_INTEGER: return hdf5::lite::Class::Integer; - case H5T_FLOAT: return hdf5::lite::Class::Float; - case H5T_TIME: return hdf5::lite::Class::Time; - case H5T_STRING: return hdf5::lite::Class::String; - case H5T_BITFIELD: return hdf5::lite::Class::Bitfield; - case H5T_OPAQUE: return hdf5::lite::Class::Opaque; - case H5T_COMPOUND: return hdf5::lite::Class::Compound; - case H5T_REFERENCE: return hdf5::lite::Class::Reference; - case H5T_ENUM: return hdf5::lite::Class::Enum; - case H5T_VLEN: return hdf5::lite::Class::Vlen; - case H5T_ARRAY: return hdf5::lite::Class::Array; - - case H5T_NCLASSES: /*shouldn't be used*/ - throw std::logic_error("Unexpected H5T_class_t."); - default: - throw std::logic_error("Unknown H5T_class_t."); - } -} -static hdf5::lite::Class H5T_class_to_Class(const H5::DataSet& dataset) -{ - return H5T_class_to_Class(dataset.getTypeClass()); -} - -// https://docs.hdfgroup.org/archive/support/HDF5/doc1.8/cpplus_RM/readdata_8cpp-example.html -static hdf5::lite::DataSetInfo dataSetInfo_(const coda_oss::filesystem::path& filename, const std::string& loc) -{ - hdf5::lite::DataSetInfo retval; - retval.filename = filename.string(); - - /* - * Open the specified file and the specified dataset in the file. - */ - H5::H5File file(retval.filename, H5F_ACC_RDONLY); - const auto dataset = file.openDataSet(loc); - - const coda_oss::filesystem::path name = dataset.getObjName(); // e.g., "/g4/time" - retval.name = name.filename().string(); // "time" - - /* - * Get the class of the datatype that is used by the dataset. - */ - retval.dataType.h5Class = H5T_class_to_Class(dataset); - - return retval; -} -hdf5::lite::DataSetInfo hdf5::lite::dataSetInfo(const coda_oss::filesystem::path& filename, const std::string& loc) -{ - return details::try_catch_H5Exceptions(dataSetInfo_, __FILE__, __LINE__, filename, loc); -} diff --git a/externals/coda-oss/modules/c++/hdf5.lite/source/Read.cpp b/externals/coda-oss/modules/c++/hdf5.lite/source/Read.cpp deleted file mode 100644 index 325111a4fe..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/source/Read.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/* ========================================================================= - * This file is part of hd5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * hd5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include "hdf5/lite/Read.h" - -#include // std::ignore -#include - -#include "coda_oss/cstddef.h" // byte - -#include "hdf5/lite/HDF5Exception.h" -#include "H5.h" -#include "hdf5.lite.h" - -static void read(const H5::DataSet& dataset, std::vector& result) -{ - static_assert(sizeof(double) * 8 == 64, "'double' should be 64-bits"); // IEEE_F64LE - - const auto mem_type = dataset.getDataType(); - if (mem_type != H5::PredType::IEEE_F64LE) - { - const except::Context context("getDataType() != IEEE_F64LE", __FILE__, __LINE__, "read"); - throw hdf5::lite::DataSetException(context); - } - dataset.read(result.data(), mem_type); -} -static void read(const H5::DataSet& dataset, std::vector& result) -{ - static_assert(sizeof(float) * 8 == 32, "'float' should be 32-bits"); // IEEE_F32LE - - const auto mem_type = dataset.getDataType(); - if (mem_type != H5::PredType::IEEE_F32LE) - { - const except::Context context("getDataType() != IEEE_F32LE", __FILE__, __LINE__, "read"); - throw hdf5::lite::DataSetException(context); - } - dataset.read(result.data(), mem_type); -} -template -static hdf5::lite::SpanRC readDatasetT(const H5::DataSet& dataset, std::vector& result) -{ - if (dataset.getTypeClass() != H5T_FLOAT) - { - const except::Context context("getTypeClass() != H5T_FLOAT", __FILE__, __LINE__, "readDatasetT"); - throw hdf5::lite::DataSetException(context); - } - - const auto dims = hdf5::lite::details::getSimpleExtentSize(dataset); - result.resize(dims.area()); - hdf5::lite::SpanRC retval(result.data(), dims); - - // dataset.read() doesn't care about the buffer type ... that's because H5Dread() also - // uses void*. However, the LT API has H5LTread_dataset_double() and H5LTread_dataset_float(), - read(dataset, result); // data.read(result.data(), mem_type); - - return retval; -} - -inline hdf5::lite::SpanRC readDataset_(const H5::DataSet& dataset, std::vector& result) -{ - return readDatasetT(dataset, result); -} -inline hdf5::lite::SpanRC readDataset_(const H5::DataSet& dataset, std::vector& result) -{ - return readDatasetT(dataset, result); -} -template -static hdf5::lite::SpanRC readFile_(const coda_oss::filesystem::path& fileName, const std::string& datasetName, - std::vector& result) -{ - /* - * Open the specified file and the specified dataset in the file. - */ - H5::H5File file(fileName.string(), H5F_ACC_RDONLY); - const auto dataset = file.openDataSet(datasetName); - return readDataset_(dataset, result); -} - -hdf5::lite::SpanRC hdf5::lite::readFile(const coda_oss::filesystem::path& fileName, const std::string& loc, - std::vector& result) -{ - return details::try_catch_H5Exceptions(readFile_, __FILE__, __LINE__, fileName, loc, result); -} -hdf5::lite::SpanRC hdf5::lite::readFile(const coda_oss::filesystem::path& fileName, const std::string& loc, - std::vector& result) -{ - return details::try_catch_H5Exceptions(readFile_, __FILE__, __LINE__, fileName, loc, result); -} diff --git a/externals/coda-oss/modules/c++/hdf5.lite/source/Write.cpp b/externals/coda-oss/modules/c++/hdf5.lite/source/Write.cpp deleted file mode 100644 index ce140935aa..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/source/Write.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/* ========================================================================= - * This file is part of hd5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2023, Maxar Technologies, Inc. - * - * hd5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include "hdf5/lite/Write.h" - -#include // std::ignore -#include - -#include "coda_oss/cstddef.h" // byte - -#include "hdf5/lite/HDF5Exception.h" -#include "H5.h" -#include "hdf5.lite.h" - -// https://raw.githubusercontent.com/HDFGroup/hdf5/develop/c++/examples/h5tutr_rdwt.cpp - -template static H5::PredType getPredType(); -template <> -inline H5::PredType getPredType() -{ - static_assert(sizeof(float) * 8 == 32, "'float' should be 32-bits"); // IEEE_F32LE - return H5::PredType::IEEE_F32LE; -} -template <> -inline H5::PredType getPredType() -{ - static_assert(sizeof(double) * 8 == 64, "'double' should be 64-bits"); // IEEE_F64LE - return H5::PredType::IEEE_F64LE; -} - -template -static void createFile_(const coda_oss::filesystem::path& fileName, const std::string& ds, const types::RowCol& sz) -{ - // https://raw.githubusercontent.com/HDFGroup/hdf5/develop/c++/examples/h5tutr_crtdat.cpp - // - // Create a new file using the default property lists. - H5::H5File file(fileName.string(), H5F_ACC_TRUNC); - - // Create the data space for the dataset. - constexpr int RANK = 2; - const hsize_t dims[]{sz.row, sz.col}; // dataset dimensions - H5::DataSpace dataspace(RANK, dims); - - // Create the dataset. - const auto data_type = getPredType(); - std::ignore = file.createDataSet(ds, data_type, dataspace); -} -template<> -void hdf5::lite::createFile(const coda_oss::filesystem::path& fileName, const std::string& ds, const types::RowCol& sz) -{ - details::try_catch_H5ExceptionsV(createFile_, __FILE__, __LINE__, fileName, ds, sz); -} -template<> -void hdf5::lite::createFile(const coda_oss::filesystem::path& fileName, const std::string& ds, const types::RowCol& sz) -{ - details::try_catch_H5ExceptionsV(createFile_, __FILE__, __LINE__, fileName, ds, sz); -} -void hdf5::lite::createFile(const coda_oss::filesystem::path& fileName, const std::string& ds, hdf5::lite::SpanRC data) -{ - createFile(fileName, ds, data.dims()); -} -void hdf5::lite::createFile(const coda_oss::filesystem::path& fileName, const std::string& ds, hdf5::lite::SpanRC data) -{ - createFile(fileName, ds, data.dims()); -} - - -template -static void writeFile_(const coda_oss::filesystem::path& fileName, const std::string& ds, hdf5::lite::SpanRC data) -{ - // https://raw.githubusercontent.com/HDFGroup/hdf5/develop/c++/examples/h5tutr_rdwt.cpp - - // Open an existing file and dataset. - H5::H5File file(fileName.string(), H5F_ACC_RDWR); - auto dataset = file.openDataSet(ds); - - const auto dims = hdf5::lite::details::getSimpleExtentSize(dataset); - if (data.dims() != dims) - { - const except::Context ctx("dataSet dimensions do not match data dimensions", __FILE__, __LINE__, "writeFile"); - throw hdf5::lite::DataSetException(ctx); - } - - // Write the data to the dataset using default memory space, file - // space, and transfer properties. - const auto data_type = getPredType(); - dataset.write(data.data(), data_type); -} -void hdf5::lite::writeFile(const coda_oss::filesystem::path& fileName, const std::string& ds, SpanRC data) -{ - details::try_catch_H5ExceptionsV(writeFile_, __FILE__, __LINE__, fileName, ds, data); -} -void hdf5::lite::writeFile(const coda_oss::filesystem::path& fileName, const std::string& ds, SpanRC data) -{ - details::try_catch_H5ExceptionsV(writeFile_, __FILE__, __LINE__, fileName, ds, data); -} diff --git a/externals/coda-oss/modules/c++/hdf5.lite/source/hdf5.lite.cpp b/externals/coda-oss/modules/c++/hdf5.lite/source/hdf5.lite.cpp index 609e6da30d..ef2c40846d 100644 --- a/externals/coda-oss/modules/c++/hdf5.lite/source/hdf5.lite.cpp +++ b/externals/coda-oss/modules/c++/hdf5.lite/source/hdf5.lite.cpp @@ -22,45 +22,3 @@ #include "hdf5.lite.h" -inline except::Context make_Context(const H5::Exception& error, const char* file, int line) -{ - return except::Context(error.getDetailMsg(), file, line, error.getFuncName()); -} - -void hdf5::lite::details::try_catch_H5Exceptions_(std::function f, const char* file, int line, void* context) -{ - try - { - /* - * Turn off the auto-printing when failure occurs so that we can - * handle the errors appropriately - */ - H5::Exception::dontPrint(); - - f(context); - } - - // catch failure caused by the H5File operations - catch (const H5::FileIException& error) - { - throw except::IOException(make_Context(error, file, line)); - } - - // catch failure caused by the DataSet operations - catch (const H5::DataSetIException& error) - { - throw hdf5::lite::DataSetException(make_Context(error, file, line)); - } - - // catch failure caused by the DataSpace operations - catch (const H5::DataSpaceIException& error) - { - throw hdf5::lite::DataSpaceException(make_Context(error, file, line)); - } - - // catch failure caused by the DataType operations - catch (const H5::DataTypeIException& error) - { - throw hdf5::lite::DataTypeException(make_Context(error, file, line)); - } -} diff --git a/externals/coda-oss/modules/c++/hdf5.lite/source/hdf5.lite.h b/externals/coda-oss/modules/c++/hdf5.lite/source/hdf5.lite.h index 29617ac235..529060901b 100644 --- a/externals/coda-oss/modules/c++/hdf5.lite/source/hdf5.lite.h +++ b/externals/coda-oss/modules/c++/hdf5.lite/source/hdf5.lite.h @@ -30,44 +30,12 @@ #include "except/Exception.h" -#include "hdf5/lite/H5_.h" -#include "hdf5/lite/HDF5Exception.h" - // Utility routines for INTERNAL use! namespace hdf5 { namespace lite { -namespace details -{ -// Call the given function, converting H5 exceptions to our own. -void try_catch_H5Exceptions_(std::function f, const char* file, int line, void* context = nullptr); - -template -R return_type_of(R (*)(Args...)); - -template -auto try_catch_H5Exceptions(TFunc f, const char* file, int line, TArgs&&... args) -{ - // Figure out return type by "calling" the function at compile-time - // https://stackoverflow.com/a/53673522/8877 - decltype(return_type_of(f)) retval; - - // "Hide" the arguments inside of a lambda - auto call_f = [&](void*) { retval = f(std::forward(args)...); }; - details::try_catch_H5Exceptions_(call_f, file, line, &retval /*context*/); - return retval; -} -template -auto try_catch_H5ExceptionsV(TFunc f, const char* file, int line, TArgs&&... args) -{ - // "Hide" the arguments inside of a lambda - auto call_f = [&](void*) { f(std::forward(args)...); }; - details::try_catch_H5Exceptions_(call_f, file, line, nullptr /*context*/); -} - -} } } #endif // CODA_OSS_hdf5_lite_hdf5_lite_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/hdf5.lite/unittests/create_123_barfoo_catdog_cx.m b/externals/coda-oss/modules/c++/hdf5.lite/unittests/create_123_barfoo_catdog_cx.m index 58fcef2405..8591db46a2 100644 --- a/externals/coda-oss/modules/c++/hdf5.lite/unittests/create_123_barfoo_catdog_cx.m +++ b/externals/coda-oss/modules/c++/hdf5.lite/unittests/create_123_barfoo_catdog_cx.m @@ -1,55 +1,55 @@ -% https://www.mathworks.com/help/matlab/ref/h5write.html -mydata = rand(10, 1); - -h5create('123_barfoo_catdog_cx.h5', '/1/bar/cat/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/1/bar/cat/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/1/bar/cat/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/1/bar/cat/r', mydata) -h5create('123_barfoo_catdog_cx.h5', '/1/bar/dog/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/1/bar/dog/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/1/bar/dog/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/1/bar/dog/r', mydata) -h5create('123_barfoo_catdog_cx.h5', '/1/foo/cat/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/1/foo/cat/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/1/foo/cat/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/1/foo/cat/r', mydata) -h5create('123_barfoo_catdog_cx.h5', '/1/foo/dog/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/1/foo/dog/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/1/foo/dog/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/1/foo/dog/r', mydata) - -h5create('123_barfoo_catdog_cx.h5', '/2/bar/cat/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/2/bar/cat/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/2/bar/cat/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/2/bar/cat/r', mydata) -h5create('123_barfoo_catdog_cx.h5', '/2/bar/dog/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/2/bar/dog/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/2/bar/dog/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/2/bar/dog/r', mydata) -h5create('123_barfoo_catdog_cx.h5', '/2/foo/cat/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/2/foo/cat/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/2/foo/cat/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/2/foo/cat/r', mydata) -h5create('123_barfoo_catdog_cx.h5', '/2/foo/dog/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/2/foo/dog/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/2/foo/dog/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/2/foo/dog/r', mydata) - -h5create('123_barfoo_catdog_cx.h5', '/3/bar/cat/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/3/bar/cat/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/3/bar/cat/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/3/bar/cat/r', mydata) -h5create('123_barfoo_catdog_cx.h5', '/3/bar/dog/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/3/bar/dog/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/3/bar/dog/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/3/bar/dog/r', mydata) -h5create('123_barfoo_catdog_cx.h5', '/3/foo/cat/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/3/foo/cat/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/3/foo/cat/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/3/foo/cat/r', mydata) -h5create('123_barfoo_catdog_cx.h5', '/3/foo/dog/i', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/3/foo/dog/i', mydata) -h5create('123_barfoo_catdog_cx.h5', '/3/foo/dog/r', [10, 1]) -h5write('123_barfoo_catdog_cx.h5', '/3/foo/dog/r', mydata) - -h5disp('123_barfoo_catdog_cx.h5') +% https://www.mathworks.com/help/matlab/ref/h5write.html +mydata = rand(10, 1); + +h5create('123_barfoo_catdog_cx.h5', '/1/bar/cat/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/1/bar/cat/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/1/bar/cat/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/1/bar/cat/r', mydata) +h5create('123_barfoo_catdog_cx.h5', '/1/bar/dog/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/1/bar/dog/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/1/bar/dog/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/1/bar/dog/r', mydata) +h5create('123_barfoo_catdog_cx.h5', '/1/foo/cat/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/1/foo/cat/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/1/foo/cat/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/1/foo/cat/r', mydata) +h5create('123_barfoo_catdog_cx.h5', '/1/foo/dog/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/1/foo/dog/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/1/foo/dog/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/1/foo/dog/r', mydata) + +h5create('123_barfoo_catdog_cx.h5', '/2/bar/cat/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/2/bar/cat/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/2/bar/cat/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/2/bar/cat/r', mydata) +h5create('123_barfoo_catdog_cx.h5', '/2/bar/dog/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/2/bar/dog/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/2/bar/dog/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/2/bar/dog/r', mydata) +h5create('123_barfoo_catdog_cx.h5', '/2/foo/cat/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/2/foo/cat/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/2/foo/cat/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/2/foo/cat/r', mydata) +h5create('123_barfoo_catdog_cx.h5', '/2/foo/dog/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/2/foo/dog/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/2/foo/dog/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/2/foo/dog/r', mydata) + +h5create('123_barfoo_catdog_cx.h5', '/3/bar/cat/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/3/bar/cat/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/3/bar/cat/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/3/bar/cat/r', mydata) +h5create('123_barfoo_catdog_cx.h5', '/3/bar/dog/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/3/bar/dog/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/3/bar/dog/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/3/bar/dog/r', mydata) +h5create('123_barfoo_catdog_cx.h5', '/3/foo/cat/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/3/foo/cat/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/3/foo/cat/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/3/foo/cat/r', mydata) +h5create('123_barfoo_catdog_cx.h5', '/3/foo/dog/i', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/3/foo/dog/i', mydata) +h5create('123_barfoo_catdog_cx.h5', '/3/foo/dog/r', [10, 1]) +h5write('123_barfoo_catdog_cx.h5', '/3/foo/dog/r', mydata) + +h5disp('123_barfoo_catdog_cx.h5') diff --git a/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_hdf5info.cpp b/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_hdf5info.cpp deleted file mode 100644 index 8516c4655b..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_hdf5info.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/* ========================================================================= - * This file is part of hdf5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * hdf5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include -#include - -#include - -#include "sys/FileFinder.h" - -#include "hdf5/lite/Info.h" - -static std::filesystem::path find_unittest_file(const std::filesystem::path& name) -{ - static const auto unittests = std::filesystem::path("modules") / "c++" / "hdf5.lite" / "unittests"; - return sys::test::findGITModuleFile("coda-oss", unittests, name); -} - -TEST_CASE(test_hdf5Info_IOException) -{ - static const std::filesystem::path path = "does not exist . h5"; - try - { - // https://www.mathworks.com/help/matlab/ref/h5info.html - const auto info = hdf5::lite::fileInfo(path); - TEST_FAIL; - } - catch (const except::IOException&) - { - TEST_SUCCESS; - } -} - - -TEST_CASE(test_hdf5FileInfo) -{ - static const auto path = find_unittest_file("example.h5"); - - // https://www.mathworks.com/help/matlab/ref/h5info.html - /* - info = struct with fields: - Filename: '/mathworks/devel/bat/Bdoc22b/build/matlab/toolbox/matlab/demos/example.h5' - Name: '/' - Groups: [4x1 struct] - Datasets: [] - Datatypes: [] - Links: [] - Attributes: [2x1 struct] - */ - const auto info = hdf5::lite::fileInfo(path); - TEST_ASSERT_EQ(path.string(), info.filename); - TEST_ASSERT_EQ("/", info.name); - TEST_ASSERT_EQ(info.groups.size(), 4); - TEST_ASSERT_TRUE(info.dataSets.empty()); - TEST_ASSERT_TRUE(info.dataTypes.empty()); - //TEST_ASSERT_TRUE(info.links.empty()); - //TEST_ASSERT_EQ(info.attributes.size(), 2); -} - -TEST_CASE(test_hdf5GroupInfo) -{ - static const auto path = find_unittest_file("example.h5"); - - // https://www.mathworks.com/help/matlab/ref/h5info.html - const auto info = hdf5::lite::groupInfo(path, "/g4"); - /* - info = struct with fields: - Filename: '/mathworks/devel/bat/Bdoc22b/build/matlab/toolbox/matlab/demos/example.h5' - Name: '/g4' - Groups: [] - Datasets: [4x1 struct] - Datatypes: [] - Links: [] - Attributes: [] - */ - TEST_ASSERT_EQ(path.string(), info.filename); - TEST_ASSERT_EQ("/g4", info.name); - TEST_ASSERT_TRUE(info.groups.empty()); - TEST_ASSERT_EQ(info.dataSets.size(), 4); - TEST_ASSERT_TRUE(info.dataTypes.empty()); - //TEST_ASSERT_TRUE(info.links.empty()); - //TEST_ASSERT_TRUE(info.attributes.empty()); -} - -TEST_CASE(test_hdf5DatasetInfo) -{ - static const auto path = find_unittest_file("example.h5"); - - // https://www.mathworks.com/help/matlab/ref/h5info.html - const auto info = hdf5::lite::dataSetInfo(path, "/g4/time"); - /* - info = struct with fields: - Filename: '/mathworks/devel/bat/Bdoc22b/build/matlab/toolbox/matlab/demos/example.h5' - Name: 'time' - Datatype: [1x1 struct] - Dataspace: [1x1 struct] - ChunkSize: 10 - FillValue: 0 - Filters: [] - Attributes: [2x1 struct] - */ - TEST_ASSERT_EQ(path.string(), info.filename); - TEST_ASSERT_EQ("time", info.name); - TEST_ASSERT(info.dataType.h5Class == hdf5::lite::Class::Float); - //TEST_ASSERT(info.dataspace == hdf5::lite::Class::Float); - //TEST_ASSERT_EQ(info.chunkSize, 10); - //TEST_ASSERT_EQ(info.fillValue, 0); - //TEST_ASSERT_TRUE(info.filters.empty()); - //TEST_ASSERT_EQ(info.attributes.size(), 2); -} - -static void read_complex(const std::string& testName, - const std::filesystem::path& path, const std::string& datasetPath) -{ - const auto i_info = hdf5::lite::dataSetInfo(path, datasetPath + "/i"); - TEST_ASSERT(i_info.dataType.h5Class == hdf5::lite::Class::Float); - - const auto r_info = hdf5::lite::dataSetInfo(path, datasetPath + "/r"); - TEST_ASSERT(r_info.dataType.h5Class == hdf5::lite::Class::Float); -} - -TEST_CASE(test_hdf5Info_nested) -{ - /* - Group '/' - Group '/1' - Group '/1/bar' - Group '/1/bar/cat' - Dataset 'i' - Size: 10x1 - MaxSize: 10x1 - Datatype: H5T_IEEE_F64LE (double) - ChunkSize: [] - Filters: none - FillValue: 0.000000 - */ - - static const auto path = find_unittest_file("123_barfoo_catdog_cx.h5"); - - // https://www.mathworks.com/help/matlab/ref/h5info.html - const auto info = hdf5::lite::fileInfo(path); - TEST_ASSERT_EQ(path.string(), info.filename); - TEST_ASSERT_EQ("/", info.name); - TEST_ASSERT_TRUE(info.dataSets.empty()); - TEST_ASSERT_TRUE(info.dataTypes.empty()); - - const std::vector expectedOuterGroupNames{"1" , "2", "3"}; - TEST_ASSERT_EQ(info.groups.size(), expectedOuterGroupNames.size()); - for (size_t outer = 0; outer < info.groups.size(); outer++) - { - const auto groupName = info.groups[outer].name; - TEST_ASSERT_EQ(groupName, expectedOuterGroupNames[outer]); - - const auto subGroupInfo = hdf5::lite::groupInfo(path, "/" + groupName); - - const std::vector expectedSubGroupNames{"bar", "foo"}; - TEST_ASSERT_EQ(subGroupInfo.groups.size(), expectedSubGroupNames.size()); - for (size_t sub = 0; sub < subGroupInfo.groups.size(); sub++) - { - const auto subGroupName = subGroupInfo.groups[sub].name; - TEST_ASSERT_EQ(subGroupName, expectedSubGroupNames[sub]); - - const auto subSubGroupInfo = hdf5::lite::groupInfo(path, "/" + groupName + "/" + subGroupName); - - const std::vector expectedSubSubGroupNames{"cat", "dog"}; - TEST_ASSERT_EQ(subSubGroupInfo.groups.size(), expectedSubSubGroupNames.size()); - for (size_t subsub = 0; subsub < subSubGroupInfo.groups.size(); subsub++) - { - const auto subSubGroupName = subSubGroupInfo.groups[subsub].name; - TEST_ASSERT_EQ(subSubGroupName, expectedSubSubGroupNames[subsub]); - - const auto datasetPath = "/" + groupName + "/" + subGroupName + "/" + subSubGroupName; - read_complex(testName, path, datasetPath); - } - } - } -} - -TEST_CASE(test_hdf5Info_nested_small) -{ - // top group: Data - // outer groups: 1, 2, 3, 4, 5 - // sub groups: bar, foo - // sub-sub groups: cat, dog - // sub-sub-sub groups: a, b, c, d - // data: i (float array), r (float array) - static const auto path = find_unittest_file("nested_complex_float32_data_small.h5"); - - // https://www.mathworks.com/help/matlab/ref/h5info.html - const auto info = hdf5::lite::fileInfo(path); - TEST_ASSERT_EQ(path.string(), info.filename); - TEST_ASSERT_EQ("/", info.name); - TEST_ASSERT_TRUE(info.dataSets.empty()); - TEST_ASSERT_TRUE(info.dataTypes.empty()); - - const std::vector expectedDataGroupNames{"Data"}; - TEST_ASSERT_EQ(info.groups.size(), expectedDataGroupNames.size()); - TEST_ASSERT_EQ(info.groups.size(), 1); - const auto dataGroupName = info.groups[0].name; - TEST_ASSERT_EQ(dataGroupName, expectedDataGroupNames[0]); - const auto dataRootPath = "/" + dataGroupName; - - const auto dataGroupInfo = hdf5::lite::groupInfo(path, dataRootPath); - const std::vector expectedOuterGroupNames{"1", "2", "3", "4", "5"}; - TEST_ASSERT_EQ(dataGroupInfo.groups.size(), expectedOuterGroupNames.size()); - for (size_t outer = 0; outer < dataGroupInfo.groups.size(); outer++) - { - const auto groupName = dataGroupInfo.groups[outer].name; - TEST_ASSERT_EQ(groupName, expectedOuterGroupNames[outer]); - - const auto subGroupRoot = dataRootPath + "/" + groupName; - const auto subGroupInfo = hdf5::lite::groupInfo(path, subGroupRoot); - - const std::vector expectedSubGroupNames{"bar", "foo"}; - TEST_ASSERT_EQ(subGroupInfo.groups.size(), expectedSubGroupNames.size()); - for (size_t sub = 0; sub < subGroupInfo.groups.size(); sub++) - { - const auto subGroupName = subGroupInfo.groups[sub].name; - TEST_ASSERT_EQ(subGroupName, expectedSubGroupNames[sub]); - - const auto subSubGroupRoot = subGroupRoot + "/" + subGroupName; - const auto subSubGroupInfo = hdf5::lite::groupInfo(path, subSubGroupRoot); - - const std::vector expectedSubSubGroupNames{"cat", "dog"}; - TEST_ASSERT_EQ(subSubGroupInfo.groups.size(), expectedSubSubGroupNames.size()); - for (size_t subsub = 0; subsub < subSubGroupInfo.groups.size(); subsub++) - { - const auto subSubGroupName = subSubGroupInfo.groups[subsub].name; - TEST_ASSERT_EQ(subSubGroupName, expectedSubSubGroupNames[subsub]); - - const auto abcdGroupRoot = subSubGroupRoot + "/" + subSubGroupName; - const auto abcdGroupInfo = hdf5::lite::groupInfo(path, abcdGroupRoot); - - const std::vector expected_abcd_names { "a", "b", "c", "d"}; - TEST_ASSERT_EQ(abcdGroupInfo.groups.size(), expected_abcd_names.size()); - for (size_t abcd = 0; abcd < abcdGroupInfo.groups.size(); abcd++) - { - const auto abcdGroupName = abcdGroupInfo.groups[abcd].name; - TEST_ASSERT_EQ(abcdGroupName, expected_abcd_names[abcd]); - - const auto datasetPath = abcdGroupRoot + "/" + abcdGroupName; - read_complex(testName, path, datasetPath); - } - } - } - } -} - -TEST_MAIN( - TEST_CHECK(test_hdf5Info_IOException); - - TEST_CHECK(test_hdf5FileInfo); - TEST_CHECK(test_hdf5GroupInfo); - TEST_CHECK(test_hdf5DatasetInfo); - - TEST_CHECK(test_hdf5Info_nested); - TEST_CHECK(test_hdf5Info_nested_small); -) diff --git a/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_hdf5read.cpp b/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_hdf5read.cpp deleted file mode 100644 index 9abc451e3f..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_hdf5read.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* ========================================================================= - * This file is part of hdf5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * hdf5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include -#include -#include -#include - -#include - -#include "sys/FileFinder.h" - -#include "hdf5/lite/Read.h" -#include "hdf5/lite/HDF5Exception.h" - -static std::filesystem::path find_unittest_file(const std::filesystem::path& name) -{ - static const auto unittests = std::filesystem::path("modules") / "c++" / "hdf5.lite" / "unittests"; - return sys::test::findGITModuleFile("coda-oss", unittests, name); -} - -TEST_CASE(test_hdf5Read) -{ - static const auto path = find_unittest_file("example.h5"); - - // https://www.mathworks.com/help/matlab/ref/h5read.html - std::vector data; - const auto rc = hdf5::lite::readFile(path, "/g4/lat", data); - TEST_ASSERT_EQ(rc.area(), 19); - TEST_ASSERT_ALMOST_EQ(data[0], -90.0); - TEST_ASSERT_ALMOST_EQ(data[0], -data[18]); -} - -TEST_CASE(test_hdf5Read_IOException) -{ - static const std::filesystem::path path = "does not exist . h5"; - std::vector data; - TEST_SPECIFIC_EXCEPTION( - hdf5::lite::readFile(path, "/g4/lat", data), - except::IOException); -} - -TEST_CASE(test_hdf5Read_nested) -{ - /* - Group '/' - Group '/1' - Group '/1/bar' - Group '/1/bar/cat' - Dataset 'i' - Size: 10x1 - MaxSize: 10x1 - Datatype: H5T_IEEE_F64LE (double) - ChunkSize: [] - Filters: none - FillValue: 0.000000 - */ - static const auto path = find_unittest_file("123_barfoo_catdog_cx.h5"); - - // https://www.mathworks.com/help/matlab/ref/h5read.html - std::vector data; - auto rc = hdf5::lite::readFile(path, "/1/bar/cat/i", data); - TEST_ASSERT_EQ(rc.area(), 10); - TEST_ASSERT_EQ(rc.area(), data.size()); - - rc = hdf5::lite::readFile(path, "/3/foo/dog/r", data); - TEST_ASSERT_EQ(rc.area(), 10); - TEST_ASSERT_EQ(rc.area(), data.size()); -} - -TEST_CASE(test_hdf5Read_nested_small) -{ - // top group: Data - // outer groups: 1, 2, 3, 4, 5 - // sub groups: bar, foo - // sub-sub groups: cat, dog - // sub-sub-sub groups: a, b, c, d - // data: i (float array), r (float array) - static const auto path = find_unittest_file("nested_complex_float32_data_small.h5"); - - // https://www.mathworks.com/help/matlab/ref/h5read.html - std::vector data; - auto rc = hdf5::lite::readFile(path, "/Data/1/bar/cat/a/i", data); - TEST_ASSERT_EQ(rc.area(), 10); - TEST_ASSERT_EQ(rc.area(), data.size()); - auto actual = std::accumulate(data.cbegin(), data.cend(), 0.0); - TEST_ASSERT_EQ(actual, 0.0); - - rc = hdf5::lite::readFile(path, "/Data/5/foo/dog/d/r", data); - TEST_ASSERT_EQ(rc.area(), 10); - TEST_ASSERT_EQ(rc.area(), data.size()); - actual = std::accumulate(data.cbegin(), data.cend(), 0.0); - TEST_ASSERT_EQ(actual, 10.0); -} - -TEST_CASE(test_hdf5Read_nested_small_wrongType) -{ - static const auto path = find_unittest_file("nested_complex_float32_data_small.h5"); - - std::vector data; - TEST_SPECIFIC_EXCEPTION( - hdf5::lite::readFile(path, "/Data/1/bar/cat/a/r", data), - hdf5::lite::DataSetException); -} - -TEST_MAIN( - TEST_CHECK(test_hdf5Read); - TEST_CHECK(test_hdf5Read_IOException); - TEST_CHECK(test_hdf5Read_nested); - TEST_CHECK(test_hdf5Read_nested_small); - TEST_CHECK(test_hdf5Read_nested_small_wrongType); -) diff --git a/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_hdf5write.cpp b/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_hdf5write.cpp deleted file mode 100644 index 7a4412fe05..0000000000 --- a/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_hdf5write.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* ========================================================================= - * This file is part of hdf5.lite-c++ - * ========================================================================= - * - * (C) Copyright 2023, Maxar Technologies, Inc. - * - * hdf5.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include -#include -#include -#include - -#include - -#include "sys/FileFinder.h" - -#include "hdf5/lite/Write.h" -#include "hdf5/lite/HDF5Exception.h" -#include "hdf5/lite/Info.h" -#include "hdf5/lite/Read.h" - -static std::filesystem::path find_unittest_file(const std::filesystem::path& name) -{ - static const auto unittests = std::filesystem::path("modules") / "c++" / "hdf5.lite" / "unittests"; - return sys::test::findGITModuleFile("coda-oss", unittests, name); -} - -TEST_CASE(test_hdf5Create) -{ - static const auto path_ = find_unittest_file("example.h5"); - static const auto path = path_.parent_path() / "TEST_hdf5Create_TMP.h5"; - - // https://www.mathworks.com/help/matlab/ref/h5write.html - hdf5::lite::createFile(path, "/DS1", {10, 20}); - - TEST_ASSERT_TRUE(true); // need to use hidden "testName" parameter -} - -TEST_CASE(test_hdf5Write) -{ - static const auto path_ = find_unittest_file("example.h5"); - static const auto path = path_.parent_path() / "TEST_hdf5Write_TMP.h5"; - - const types::RowCol dims{10, 20}; - std::vector data_(dims.area()); - const hdf5::lite::SpanRC data(data_.data(), dims); - double d = 0.0; - for (size_t r = 0; r result; - const auto rc = hdf5::lite::readFile(path, "/DS1", result); - TEST_ASSERT(rc.dims() == dims); - TEST_ASSERT_EQ(dims.area(), result.size()); - for (size_t i = 0; i < result.size(); i++) - { - const auto expected = static_cast(i); - TEST_ASSERT_EQ(result[i], expected); - } -} - -TEST_MAIN( - TEST_CHECK(test_hdf5Create); - TEST_CHECK(test_hdf5Write); -) diff --git a/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_highfive.cpp b/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_highfive.cpp index b506e49484..f54526ab93 100644 --- a/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_highfive.cpp +++ b/externals/coda-oss/modules/c++/hdf5.lite/unittests/test_highfive.cpp @@ -147,7 +147,7 @@ TEST_CASE(test_highfive_nested_small) TEST_ASSERT_EQ(actual, 10.0f); const auto a = load_complex(file, "/Data/1/bar/cat/a/r", "/Data/1/bar/cat/a/i"); - const auto cx_view = mem::make_ComplexSpansView(a.first, a.second); + const auto cx_view = mem::make_ComplexParallelView(a.first, a.second); const auto cx_actual = std::accumulate(cx_view.begin(), cx_view.end(), std::complex(0.0)); TEST_ASSERT_EQ(cx_actual.real(), 10.0f); TEST_ASSERT_EQ(cx_actual.imag(), 0.0f); @@ -560,7 +560,7 @@ TEST_MAIN( TEST_CHECK(test_highfive_info_nested); TEST_CHECK(test_highfive_dump); - //TEST_CHECK(test_highfive_write); + TEST_CHECK(test_highfive_write); TEST_CHECK(test_highfive_getDataType); TEST_CHECK(test_highfive_getAttribute); diff --git a/externals/coda-oss/modules/c++/include/TestCase.h b/externals/coda-oss/modules/c++/include/TestCase.h index 5a091dd9be..08aa1a4fd6 100644 --- a/externals/coda-oss/modules/c++/include/TestCase.h +++ b/externals/coda-oss/modules/c++/include/TestCase.h @@ -20,9 +20,9 @@ * */ -#ifndef __TEST_CASE_H__ -#define __TEST_CASE_H__ #pragma once +#ifndef CODA_OSS_TestCase_h_INCLUDED_ +#define CODA_OSS_TestCase_h_INCLUDED_ #ifdef __cplusplus @@ -31,10 +31,12 @@ # include # include #include -# include -# include -# include -# include + +#include +#include +#include +#include + # define IS_NAN(X) X != X @@ -73,6 +75,10 @@ inline std::string toString(const TX& X) { return str::toString(X); } +inline std::string toString(const coda_oss::u8string& X) +{ + return str::to_native(X); +} template inline void diePrintf_(const char* format, const std::string& testName, const char* file, const char* func, int line, @@ -274,4 +280,4 @@ inline int main(TFunc f) #endif -#endif +#endif // CODA_OSS_TestCase_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/include/UnitTest.h b/externals/coda-oss/modules/c++/include/UnitTest.h index 751843c1f0..2ca366b687 100644 --- a/externals/coda-oss/modules/c++/include/UnitTest.h +++ b/externals/coda-oss/modules/c++/include/UnitTest.h @@ -4,7 +4,6 @@ #include #include "TestCase.h" -#include "str/EncodedStringView.h" #if !_MSC_VER #error "This file is for use with a Visual Studio 'UnitTest' project." @@ -133,7 +132,7 @@ inline void assert_almost_eq(const std::string& testName, long double X1, long d #define TEST_ASSERT_EQ_MSG(msg, X1, X2) testName, Microsoft::VisualStudio::CppUnitTestFramework::Logger::WriteMessage(msg.c_str()); TEST_ASSERT_EQ(X1, X2) #undef TEST_FAIL_MSG -#define TEST_FAIL_MSG(msg) { (void)testName; Microsoft::VisualStudio::CppUnitTestFramework::Assert::Fail(str::EncodedStringView(msg).wstring().c_str()); } +#define TEST_FAIL_MSG(msg) { (void)testName; Microsoft::VisualStudio::CppUnitTestFramework::Assert::Fail(str::details::to_wstring(msg).c_str()); } #undef TEST_EXCEPTION #undef TEST_THROWS diff --git a/externals/coda-oss/modules/c++/io/include/import/io.h b/externals/coda-oss/modules/c++/io/include/import/io.h index e9f9aceb55..557c180cd8 100644 --- a/externals/coda-oss/modules/c++/io/include/import/io.h +++ b/externals/coda-oss/modules/c++/io/include/import/io.h @@ -20,8 +20,9 @@ * */ -#ifndef __IMPORT_IO_H__ -#define __IMPORT_IO_H__ +#pragma once +#ifndef CODA_OSS_import_io_h_INCLUDED_ +#define CODA_OSS_import_io_h_INCLUDED_ /*! * \file io.h @@ -77,4 +78,4 @@ //#include "io/MMapInputStream.h" //using namespace io; -#endif +#endif // CODA_OSS_import_io_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/io/include/io/BufferViewStream.h b/externals/coda-oss/modules/c++/io/include/io/BufferViewStream.h index beb00d23a2..5f71ae46ca 100644 --- a/externals/coda-oss/modules/c++/io/include/io/BufferViewStream.h +++ b/externals/coda-oss/modules/c++/io/include/io/BufferViewStream.h @@ -191,7 +191,7 @@ void BufferViewStream::write(const void* buffer, size_t numBytes) { std::ostringstream msg; msg << "Write of size " << numBytes << " runs out of bounds."; - throw except::Exception(Ctxt(msg.str())); + throw except::Exception(Ctxt(msg)); } ::memcpy(mBufferView.data + mPosition, buffer, numBytes); diff --git a/externals/coda-oss/modules/c++/io/include/io/ByteStream.h b/externals/coda-oss/modules/c++/io/include/io/ByteStream.h index a64b7efc82..c8fc32a068 100644 --- a/externals/coda-oss/modules/c++/io/include/io/ByteStream.h +++ b/externals/coda-oss/modules/c++/io/include/io/ByteStream.h @@ -117,10 +117,13 @@ struct CODA_OSS_API ByteStream : public SeekableInputStream, public SeekableOutp return mData.empty() ? nullptr : &mData[0]; } - sys::Size_T - getSize() + auto size() const { - return mData.size(); + return mData.size(); + } + auto getSize() const + { + return size(); } protected: diff --git a/externals/coda-oss/modules/c++/io/include/io/FileInputStreamIOS.h b/externals/coda-oss/modules/c++/io/include/io/FileInputStreamIOS.h index c23223edb0..897ce8c3f7 100644 --- a/externals/coda-oss/modules/c++/io/include/io/FileInputStreamIOS.h +++ b/externals/coda-oss/modules/c++/io/include/io/FileInputStreamIOS.h @@ -28,17 +28,14 @@ #include #include #include + #include "except/Exception.h" -#include "sys/filesystem.h" #include "io/InputStream.h" #include "io/SeekableStreams.h" +#include "sys/filesystem.h" -#include "sys/CPlusPlus.h" -#if CODA_OSS_cpp17 -#include -#endif -/*! + /*! * \file FileInputStreamIOS.h * \brief The InputStream representation of a file * \todo Redefine the readln function to use getline() @@ -72,11 +69,6 @@ class FileInputStreamIOS : public SeekableInputStream */ FileInputStreamIOS(const coda_oss::filesystem::path& inputFile, std::ios::openmode mode = std::ios::in); - #if CODA_OSS_cpp17 - FileInputStreamIOS(const std::filesystem::path& inputFile, - std::ios::openmode mode = std::ios::in); - #endif - /*! * Alternate Constructor. Takes an input file and a mode diff --git a/externals/coda-oss/modules/c++/io/include/io/FileOutputStreamOS.h b/externals/coda-oss/modules/c++/io/include/io/FileOutputStreamOS.h index b8e70b893d..704b1946ec 100644 --- a/externals/coda-oss/modules/c++/io/include/io/FileOutputStreamOS.h +++ b/externals/coda-oss/modules/c++/io/include/io/FileOutputStreamOS.h @@ -31,13 +31,8 @@ #if !defined(USE_IO_STREAMS) #include "io/SeekableStreams.h" -#include "sys/filesystem.h" #include "sys/File.h" - -#include "sys/CPlusPlus.h" -#if CODA_OSS_cpp17 -#include -#endif +#include "sys/filesystem.h" /*! * \file FileOutputStream.h @@ -64,16 +59,13 @@ class CODA_OSS_API FileOutputStreamOS : public SeekableOutputStream public: FileOutputStreamOS() = default; + using path = coda_oss::filesystem::path; // still used in SWIG bindings + /*! * Alternate Constructor. Takes an output file and a mode * \param outputFile The file name * \param creationFlags see sys::File */ - #if CODA_OSS_cpp17 - using path = std::filesystem::path; - #else - using path = coda_oss::filesystem::path; - #endif FileOutputStreamOS(const path& outputFile, int creationFlags = sys::File::CREATE | sys::File::TRUNCATE); diff --git a/externals/coda-oss/modules/c++/io/include/io/FileUtils.h b/externals/coda-oss/modules/c++/io/include/io/FileUtils.h index 7f42b17612..927aeb4f5b 100644 --- a/externals/coda-oss/modules/c++/io/include/io/FileUtils.h +++ b/externals/coda-oss/modules/c++/io/include/io/FileUtils.h @@ -20,12 +20,16 @@ * */ -#ifndef __IO_FILE_UTILS_H__ -#define __IO_FILE_UTILS_H__ +#pragma once +#ifndef CODA_OSS_io_FileUtils_h_INCLUDED_ +#define CODA_OSS_io_FileUtils_h_INCLUDED_ + +#include +#include #include #include -#include +#include namespace io { @@ -58,7 +62,7 @@ inline void move(const std::string& path, oss << "Move Failed: Could not move source [" << path << "] to destination [" << newPath << "]"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } } @@ -94,4 +98,4 @@ struct FileUtils final }; } -#endif +#endif // CODA_OSS_io_FileUtils_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/io/source/ByteStream.cpp b/externals/coda-oss/modules/c++/io/source/ByteStream.cpp index bffd24aa19..7383011e42 100644 --- a/externals/coda-oss/modules/c++/io/source/ByteStream.cpp +++ b/externals/coda-oss/modules/c++/io/source/ByteStream.cpp @@ -20,6 +20,8 @@ * */ +#include + #include "io/ByteStream.h" sys::Off_T io::ByteStream::seek(sys::Off_T offset, Whence whence) @@ -33,13 +35,13 @@ sys::Off_T io::ByteStream::seek(sys::Off_T offset, Whence whence) mPosition = offset; break; case END: - if (offset > static_cast(mData.size())) + if (offset > std::ssize(mData)) { mPosition = 0; } else { - mPosition = static_cast(mData.size() - offset); + mPosition = std::ssize(mData) - offset; } break; case CURRENT: @@ -48,7 +50,7 @@ sys::Off_T io::ByteStream::seek(sys::Off_T offset, Whence whence) break; } - if (mPosition > static_cast(mData.size())) + if (mPosition > std::ssize(mData)) mPosition = -1; return tell(); } @@ -59,7 +61,7 @@ sys::Off_T io::ByteStream::available() throw except::Exception(Ctxt("Invalid available bytes on eof")); sys::Off_T where = mPosition; - sys::Off_T until = static_cast(mData.size()); + sys::Off_T until = std::ssize(mData); sys::Off_T diff = until - where; return (diff < 0) ? 0 : diff; } @@ -78,7 +80,7 @@ void io::ByteStream::write(const void* buffer, sys::Size_T size) mData.resize(newPos); const auto bufferPtr = static_cast(buffer); - std::copy(bufferPtr, bufferPtr + size, &mData[static_cast(mPosition)]); + std::copy(bufferPtr, bufferPtr + size, &mData[gsl::narrow(mPosition)]); mPosition = static_cast(newPos); } } diff --git a/externals/coda-oss/modules/c++/io/source/FileInputStreamIOS.cpp b/externals/coda-oss/modules/c++/io/source/FileInputStreamIOS.cpp index e1585d16ba..5ff403893d 100644 --- a/externals/coda-oss/modules/c++/io/source/FileInputStreamIOS.cpp +++ b/externals/coda-oss/modules/c++/io/source/FileInputStreamIOS.cpp @@ -91,7 +91,7 @@ void io::FileInputStreamIOS::open(const char *file, mFStream.open(file, mode); if (!isOpen()) throw except::IOException(Ctxt( - FmtX( + str::Format( "File %s could not be opened for reading", file) ) diff --git a/externals/coda-oss/modules/c++/io/source/FileUtils.cpp b/externals/coda-oss/modules/c++/io/source/FileUtils.cpp index 9de78af1f1..5e34ef8cc0 100644 --- a/externals/coda-oss/modules/c++/io/source/FileUtils.cpp +++ b/externals/coda-oss/modules/c++/io/source/FileUtils.cpp @@ -122,7 +122,7 @@ void io::copy(const std::string& path, oss << "Copy Failed: Could not copy source [" << path << "] to destination [" << newFile << "]"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } } } @@ -133,8 +133,7 @@ std::string io::FileUtils::createFile(std::string dirname, sys::OS os; if (!os.exists(dirname)) - throw except::IOException(Ctxt(FmtX("Directory does not exist: %s", - dirname.c_str()))); + throw except::IOException(Ctxt(str::Format("Directory does not exist: %s", dirname))); str::trim(filename); @@ -155,7 +154,7 @@ std::string io::FileUtils::createFile(std::string dirname, int count = 0; while (os.exists(outFilename)) { - std::string base = filename + "-" + str::toString(++count); + std::string base = filename + "-" + std::to_string(++count); outFilename = sys::Path::joinPaths(dirname, base); if (!ext.empty()) { diff --git a/externals/coda-oss/modules/c++/io/source/InputStream.cpp b/externals/coda-oss/modules/c++/io/source/InputStream.cpp index e39ac48a6b..b85dcf37d4 100644 --- a/externals/coda-oss/modules/c++/io/source/InputStream.cpp +++ b/externals/coda-oss/modules/c++/io/source/InputStream.cpp @@ -37,14 +37,14 @@ sys::SSize_T InputStream::read(void* buffer, { std::ostringstream ostr; ostr << "Tried to read " << len << " bytes but read failed"; - throw except::IOException(Ctxt(ostr.str())); + throw except::IOException(Ctxt(ostr)); } else if (numBytes != static_cast(len)) { std::ostringstream ostr; ostr << "Tried to read " << len << " bytes but only read " << numBytes << " bytes"; - throw except::IOException(Ctxt(ostr.str())); + throw except::IOException(Ctxt(ostr)); } } diff --git a/externals/coda-oss/modules/c++/io/source/MMapInputStream.cpp b/externals/coda-oss/modules/c++/io/source/MMapInputStream.cpp index d942ac2231..35959ef01f 100644 --- a/externals/coda-oss/modules/c++/io/source/MMapInputStream.cpp +++ b/externals/coda-oss/modules/c++/io/source/MMapInputStream.cpp @@ -28,7 +28,7 @@ void io::MMapInputStream::open(const std::string& fname, char* flags) // std::cout << mLength << std::endl; mFile = fopen(fname.c_str(), "r"); if (!mFile) - throw sys::SystemException(FmtX("Failure while opening file: %s", fname.c_str())); + throw sys::SystemException(str::Format("Failure while opening file: %s", fname)); _map(); diff --git a/externals/coda-oss/modules/c++/io/source/RotatingFileOutputStream.cpp b/externals/coda-oss/modules/c++/io/source/RotatingFileOutputStream.cpp index 777c60c009..67a431e537 100644 --- a/externals/coda-oss/modules/c++/io/source/RotatingFileOutputStream.cpp +++ b/externals/coda-oss/modules/c++/io/source/RotatingFileOutputStream.cpp @@ -28,10 +28,11 @@ io::RotatingFileOutputStream::RotatingFileOutputStream( unsigned long maxBytes, size_t backupCount, int creationFlags) : - io::CountingOutputStream(new io::FileOutputStream(filename, creationFlags), - true), mFilename(filename), mMaxBytes(maxBytes), - mBackupCount(backupCount) + io::CountingOutputStream(new io::FileOutputStream(filename, creationFlags), true), + mMaxBytes(maxBytes), mBackupCount(backupCount) { + mFilename = filename; // doing this in initializer list causes ASAN diagnostic on Windows ... VS bug? + mByteCount = ((io::FileOutputStream*) mProxy.get())->tell(); if (shouldRollover(0)) doRollover(); diff --git a/externals/coda-oss/modules/c++/io/source/StandardStreams.cpp b/externals/coda-oss/modules/c++/io/source/StandardStreams.cpp index 2323613990..3e374d09d5 100644 --- a/externals/coda-oss/modules/c++/io/source/StandardStreams.cpp +++ b/externals/coda-oss/modules/c++/io/source/StandardStreams.cpp @@ -33,7 +33,7 @@ void io::StandardOutStream::write(const void* buffer, sys::Size_T len) if (!std::cout.good()) throw except::IOException( Ctxt( - FmtX("std::cout stream is bad after requested write: (%d)", + str::Format("std::cout stream is bad after requested write: (%d)", len)) ); } @@ -53,7 +53,7 @@ void io::StandardErrStream::write(const void* buffer, sys::Size_T len) if (!std::cerr.good()) throw except::IOException( Ctxt( - FmtX("std::cerr stream is bad after requested write: (%d)", + str::Format("std::cerr stream is bad after requested write: (%d)", len) ) ); } diff --git a/externals/coda-oss/modules/c++/io/source/StreamSplitter.cpp b/externals/coda-oss/modules/c++/io/source/StreamSplitter.cpp index 57d6a2f603..dbef8edc2e 100644 --- a/externals/coda-oss/modules/c++/io/source/StreamSplitter.cpp +++ b/externals/coda-oss/modules/c++/io/source/StreamSplitter.cpp @@ -55,7 +55,7 @@ StreamSplitter::StreamSplitter(io::InputStream& inputStream, std::ostringstream os; os << "bufferSize must be >= twice the delimiter size + 1 byte. " << "Normally it should be much larger for good performance."; - throw except::InvalidArgumentException(Ctxt(os.str())); + throw except::InvalidArgumentException(Ctxt(os)); } } diff --git a/externals/coda-oss/modules/c++/io/tests/ioTest1.cpp b/externals/coda-oss/modules/c++/io/tests/ioTest1.cpp index 56cd99924e..f803f47e89 100644 --- a/externals/coda-oss/modules/c++/io/tests/ioTest1.cpp +++ b/externals/coda-oss/modules/c++/io/tests/ioTest1.cpp @@ -33,7 +33,7 @@ int main(int argc, char **argv) { if (argc != 3) { - throw Exception(Ctxt(FmtX("Usage: %s ", + throw Exception(Ctxt(str::Format("Usage: %s ", argv[0]))); } diff --git a/externals/coda-oss/modules/c++/io/tests/ioTest3.cpp b/externals/coda-oss/modules/c++/io/tests/ioTest3.cpp index 39a85190b7..f00693da4f 100644 --- a/externals/coda-oss/modules/c++/io/tests/ioTest3.cpp +++ b/externals/coda-oss/modules/c++/io/tests/ioTest3.cpp @@ -48,7 +48,7 @@ int main(int argc, char **argv) try { if (argc != 3) - throw Exception(Ctxt(FmtX("Usage: %s ", argv[0]))); + throw Exception(Ctxt(str::Format("Usage: %s ", argv[0]))); Copy::run(argv[1], argv[2]); } diff --git a/externals/coda-oss/modules/c++/io/tests/ioTest4.cpp b/externals/coda-oss/modules/c++/io/tests/ioTest4.cpp index a45f89b7fe..7121f9b0eb 100644 --- a/externals/coda-oss/modules/c++/io/tests/ioTest4.cpp +++ b/externals/coda-oss/modules/c++/io/tests/ioTest4.cpp @@ -53,7 +53,7 @@ int main(int argc, char **argv) if (argc != 3) throw except::Error( Ctxt( - FmtX( + str::Format( "Usage: %s ", argv[0]))); diff --git a/externals/coda-oss/modules/c++/io/tests/serializeTest1.cpp b/externals/coda-oss/modules/c++/io/tests/serializeTest1.cpp index 2037899aee..5229fb2652 100644 --- a/externals/coda-oss/modules/c++/io/tests/serializeTest1.cpp +++ b/externals/coda-oss/modules/c++/io/tests/serializeTest1.cpp @@ -47,9 +47,9 @@ class A : public Serializable virtual void serialize(OutputStream& os) override { os.writeln("Class A"); - os.writeln(FmtX("%f", vec[0])); - os.writeln(FmtX("%f", vec[1])); - os.writeln(FmtX("%f", vec[2])); + os.writeln(str::Format("%f", vec[0])); + os.writeln(str::Format("%f", vec[1])); + os.writeln(str::Format("%f", vec[2])); } virtual void deserialize(InputStream& is) override @@ -60,9 +60,9 @@ class A : public Serializable string vec_2 = fillString(is); assert(classType == "Class A"); - dbg.writeln(FmtX("vec[0] = %s", vec_0.c_str())); - dbg.writeln(FmtX("vec[1] = %s", vec_1.c_str())); - dbg.writeln(FmtX("vec[2] = %s", vec_2.c_str())); + dbg.writeln(str::Format("vec[0] = %s", vec_0)); + dbg.writeln(str::Format("vec[1] = %s", vec_1)); + dbg.writeln(str::Format("vec[2] = %s", vec_2)); vec[0] = str::toType(vec_0); vec[1] = str::toType(vec_1); diff --git a/externals/coda-oss/modules/c++/io/unittests/test_streams.cpp b/externals/coda-oss/modules/c++/io/unittests/test_streams.cpp index 63587403e7..ce253f7e3e 100644 --- a/externals/coda-oss/modules/c++/io/unittests/test_streams.cpp +++ b/externals/coda-oss/modules/c++/io/unittests/test_streams.cpp @@ -80,10 +80,10 @@ TEST_CASE(testByteStream) stream.seek(2, io::Seekable::END); TEST_ASSERT_EQ(stream.tell(), 18); - TEST_ASSERT_EQ(stream.getSize(), static_cast(20)); + TEST_ASSERT_EQ(std::ssize(stream), 20); stream.write("abcdef"); - TEST_ASSERT_EQ(stream.getSize(), static_cast(24)); + TEST_ASSERT_EQ(std::ssize(stream), 24); const std::string test("test"); { @@ -259,8 +259,8 @@ TEST_CASE(testRotate) for(size_t i = 0; i < maxFiles - 1; ++i) { - std::string fname = outFile + "." + str::toString(i + 1); - std::string next = outFile + "." + str::toString(i + 2); + std::string fname = outFile + "." + std::to_string(i + 1); + std::string next = outFile + "." + std::to_string(i + 2); TEST_ASSERT(os.isFile(fname)); TEST_ASSERT_FALSE(os.isFile(next)); diff --git a/externals/coda-oss/modules/c++/logging/include/logging/Enums.h b/externals/coda-oss/modules/c++/logging/include/logging/Enums.h index 95d7edeae7..9175a8126d 100644 --- a/externals/coda-oss/modules/c++/logging/include/logging/Enums.h +++ b/externals/coda-oss/modules/c++/logging/include/logging/Enums.h @@ -20,6 +20,7 @@ * */ +#pragma once #ifndef __LOGGING_ENUMS_H__ #define __LOGGING_ENUMS_H__ @@ -92,7 +93,7 @@ struct LogLevel final else if (s == "SEVERE") value = LOG_CRITICAL; else - throw except::InvalidFormatException(Ctxt(FmtX("Invalid enum value: %s", s.c_str()))); + throw except::InvalidFormatException(Ctxt(str::Format("Invalid enum value: %s", s))); } //! int constructor @@ -119,7 +120,7 @@ struct LogLevel final value = LOG_CRITICAL; break; default: - throw except::InvalidFormatException(Ctxt(FmtX("Invalid enum value: %d", i))); + throw except::InvalidFormatException(Ctxt(str::Format("Invalid enum value: %d", i))); } } @@ -144,7 +145,7 @@ struct LogLevel final case 5: return std::string("CRITICAL"); default: - throw except::InvalidFormatException(Ctxt(FmtX("Invalid enum value: %d", value))); + throw except::InvalidFormatException(Ctxt(str::Format("Invalid enum value: %d", value))); } } diff --git a/externals/coda-oss/modules/c++/logging/include/logging/Formatter.h b/externals/coda-oss/modules/c++/logging/include/logging/Formatter.h index 8fcdb688c2..dfe9b6a68d 100644 --- a/externals/coda-oss/modules/c++/logging/include/logging/Formatter.h +++ b/externals/coda-oss/modules/c++/logging/include/logging/Formatter.h @@ -24,8 +24,9 @@ // Formatter.h /////////////////////////////////////////////////////////// -#ifndef __LOGGING_FORMATTER_H__ -#define __LOGGING_FORMATTER_H__ +#pragma once +#ifndef CODA_OSS_logging_Formatter_h_INCLUDED_ +#define CODA_OSS_logging_Formatter_h_INCLUDED_ #include #include "config/Exports.h" @@ -88,4 +89,4 @@ class CODA_OSS_API Formatter }; } -#endif +#endif // CODA_OSS_logging_Formatter_h_INCLUDED_ \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/logging/include/logging/Logger.h b/externals/coda-oss/modules/c++/logging/include/logging/Logger.h index df158fcfc5..2b33c90658 100644 --- a/externals/coda-oss/modules/c++/logging/include/logging/Logger.h +++ b/externals/coda-oss/modules/c++/logging/include/logging/Logger.h @@ -24,12 +24,14 @@ // Logger.h /////////////////////////////////////////////////////////// +#pragma once #ifndef CODA_OSS_logging_Logger_h_INCLUDED_ #define CODA_OSS_logging_Logger_h_INCLUDED_ #include #include #include +#include #include "config/Exports.h" #include "logging/Filterer.h" @@ -79,6 +81,17 @@ struct CODA_OSS_API Logger : public Filterer //! Logs a message at the CRITICAL LogLevel void critical(const std::string& msg); + //! Logs a message at the DEBUG LogLevel + void debug(const std::ostringstream& msg); + //! Logs a message at the INFO LogLevel + void info(const std::ostringstream& msg); + //! Logs a message at the WARNING LogLevel + void warn(const std::ostringstream& msg); + //! Logs a message at the ERROR LogLevel + void error(const std::ostringstream& msg); + //! Logs a message at the CRITICAL LogLevel + void critical(const std::ostringstream& msg); + //! Logs an Exception Context at the DEBUG LogLevel void debug(const except::Context& ctxt); //! Logs an Exception Context at the INFO LogLevel diff --git a/externals/coda-oss/modules/c++/logging/include/logging/LoggerFactory.h b/externals/coda-oss/modules/c++/logging/include/logging/LoggerFactory.h index a577af33fa..944b2a36ef 100644 --- a/externals/coda-oss/modules/c++/logging/include/logging/LoggerFactory.h +++ b/externals/coda-oss/modules/c++/logging/include/logging/LoggerFactory.h @@ -24,15 +24,15 @@ // LoggerFactory.h /////////////////////////////////////////////////////////// -#ifndef __LOGGING_LOGGER_FACTORY_H__ -#define __LOGGING_LOGGER_FACTORY_H__ +#pragma once +#ifndef CODA_OSS_logging_LoggerFactory_h_INCLUDED_ +#define CODA_OSS_logging_LoggerFactory_h_INCLUDED_ #include #include #include -#include -#include +#include #include #include "logging/DefaultLogger.h" @@ -133,5 +133,4 @@ Logger* getLogger(const std::string& name = "root"); std::shared_ptr getLoggerSharedPtr(const std::string& name = "root"); } -#endif - +#endif // CODA_OSS_logging_LoggerFactory_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/logging/include/logging/Setup.h b/externals/coda-oss/modules/c++/logging/include/logging/Setup.h index 1f1e960c6f..ed6334d6e4 100644 --- a/externals/coda-oss/modules/c++/logging/include/logging/Setup.h +++ b/externals/coda-oss/modules/c++/logging/include/logging/Setup.h @@ -26,17 +26,13 @@ #include #include -#include "sys/filesystem.h" #include "mem/SharedPtr.h" #include "logging/Logger.h" - -#include "sys/CPlusPlus.h" -#if CODA_OSS_cpp17 -#include -#endif +#include "sys/filesystem.h" namespace logging { +using path = coda_oss::filesystem::path; // still used in SWIG bindings /*! * \fn setupLogger @@ -52,11 +48,6 @@ namespace logging * \param logCount - number of rotating logs to keep (default: 0 no rotation) * \param logBytes - number of bytes per rotating log (default: 0 no rotation) */ -#if CODA_OSS_cpp17 -using path = std::filesystem::path; -#else -using path = coda_oss::filesystem::path; -#endif std::unique_ptr setupLogger( const path& program, const std::string& logLevel = "warning", diff --git a/externals/coda-oss/modules/c++/logging/source/Logger.cpp b/externals/coda-oss/modules/c++/logging/source/Logger.cpp index 9fa37642f4..3f38375374 100644 --- a/externals/coda-oss/modules/c++/logging/source/Logger.cpp +++ b/externals/coda-oss/modules/c++/logging/source/Logger.cpp @@ -98,6 +98,30 @@ void logging::Logger::critical(const std::string& msg) log(LogLevel::LOG_CRITICAL, msg); } +void logging::Logger::debug(const std::ostringstream& msg) +{ + log(LogLevel::LOG_DEBUG, msg.str()); +} + +void logging::Logger::info(const std::ostringstream& msg) +{ + log(LogLevel::LOG_INFO, msg.str()); +} + +void logging::Logger::warn(const std::ostringstream& msg) +{ + log(LogLevel::LOG_WARNING, msg.str()); +} + +void logging::Logger::error(const std::ostringstream& msg) +{ + log(LogLevel::LOG_ERROR, msg.str()); +} + +void logging::Logger::critical(const std::ostringstream& msg) +{ + log(LogLevel::LOG_CRITICAL, msg.str()); +} void logging::Logger::debug(const except::Context& ctxt) { diff --git a/externals/coda-oss/modules/c++/logging/source/LoggerFactory.cpp b/externals/coda-oss/modules/c++/logging/source/LoggerFactory.cpp index 5282fa302c..9802febfec 100644 --- a/externals/coda-oss/modules/c++/logging/source/LoggerFactory.cpp +++ b/externals/coda-oss/modules/c++/logging/source/LoggerFactory.cpp @@ -26,6 +26,8 @@ #include "logging/LoggerFactory.h" +#include + std::shared_ptr logging::LoggerManager::getLoggerSharedPtr(const std::string& name) { diff --git a/externals/coda-oss/modules/c++/logging/source/StandardFormatter.cpp b/externals/coda-oss/modules/c++/logging/source/StandardFormatter.cpp index 82eeac8e79..32e687c340 100644 --- a/externals/coda-oss/modules/c++/logging/source/StandardFormatter.cpp +++ b/externals/coda-oss/modules/c++/logging/source/StandardFormatter.cpp @@ -48,15 +48,14 @@ void StandardFormatter::format(const LogRecord* record, io::OutputStream& os) co // populate log long threadId = sys::getThreadID(); std::string format = mFmt; - str::replace(format, THREAD_ID, str::toString(threadId)); + str::replace(format, THREAD_ID, std::to_string(threadId)); str::replace(format, LOG_NAME, name); str::replace(format, LOG_LEVEL, record->getLevelName()); str::replace(format, TIMESTAMP, record->getTimeStamp()); if (record->getLineNum() >= 0) { str::replace(format, FILE_NAME, record->getFile()); - str::replace(format, LINE_NUM, - str::toString(record->getLineNum())); + str::replace(format, LINE_NUM, std::to_string(record->getLineNum())); } else { diff --git a/externals/coda-oss/modules/c++/logging/source/XMLFormatter.cpp b/externals/coda-oss/modules/c++/logging/source/XMLFormatter.cpp index b0bd450bfc..c3f41b2f46 100644 --- a/externals/coda-oss/modules/c++/logging/source/XMLFormatter.cpp +++ b/externals/coda-oss/modules/c++/logging/source/XMLFormatter.cpp @@ -54,8 +54,8 @@ void logging::XMLFormatter::format(const logging::LogRecord* record, io::OutputS // conver record std::string name = (record->getName().empty()) ? ("DEFAULT") : record->getName(); - std::string line = str::toString(record->getLineNum()); - std::string threadID = str::toString(sys::getThreadID()); + const auto line = std::to_string(record->getLineNum()); + const auto threadID = std::to_string(sys::getThreadID()); // populate vector with record std::vector logRecord; diff --git a/externals/coda-oss/modules/c++/logging/unittests/test_exception_logger.cpp b/externals/coda-oss/modules/c++/logging/unittests/test_exception_logger.cpp index 57016a0de9..6084f1d87a 100644 --- a/externals/coda-oss/modules/c++/logging/unittests/test_exception_logger.cpp +++ b/externals/coda-oss/modules/c++/logging/unittests/test_exception_logger.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "TestCase.h" @@ -102,7 +103,7 @@ TEST_CASE(testExceptionWithBacktrace) } catch (const except::Throwable& t) { - TEST_ASSERT_EQ(t.getBacktrace().size(), static_cast(0)); + TEST_ASSERT_EQ(std::ssize(t.getBacktrace()), 0); s = t.toString(); what = t.what(); } diff --git a/externals/coda-oss/modules/c++/math.linear/include/math/linear/Eigenvalue.h b/externals/coda-oss/modules/c++/math.linear/include/math/linear/Eigenvalue.h index 39edf699d2..724e031d36 100644 --- a/externals/coda-oss/modules/c++/math.linear/include/math/linear/Eigenvalue.h +++ b/externals/coda-oss/modules/c++/math.linear/include/math/linear/Eigenvalue.h @@ -96,9 +96,7 @@ class Eigenvalue if (A.rows() != A.cols()) { throw except::Exception(Ctxt( - "Expected square matrix but got rows = " + - str::toString(A.rows()) + ", cols = " + - str::toString(A.cols()))); + "Expected square matrix but got rows = " + std::to_string(A.rows()) + ", cols = " + std::to_string(A.cols()))); } if (isSymmetric(A)) diff --git a/externals/coda-oss/modules/c++/math.linear/unittests/test_Vector.cpp b/externals/coda-oss/modules/c++/math.linear/unittests/test_Vector.cpp index 1a4df6d46e..4e912b21da 100644 --- a/externals/coda-oss/modules/c++/math.linear/unittests/test_Vector.cpp +++ b/externals/coda-oss/modules/c++/math.linear/unittests/test_Vector.cpp @@ -1,3 +1,4 @@ +#include #include #include "TestCase.h" #include "math/linear/Vector.h" @@ -256,8 +257,8 @@ TEST_CASE(testOperatorMinusEquals) Vector v2(5, -5); v2 -= v1; - TEST_ASSERT_EQ(v1.size(), static_cast(5)); - TEST_ASSERT_EQ(v2.size(), static_cast(5)); + TEST_ASSERT_EQ(std::ssize(v1), 5); + TEST_ASSERT_EQ(std::ssize(v2), 5); for (int i = 0; i < 5; i++) TEST_ASSERT_EQ(v2[i], -18); for (int i = 0; i < 5; i++) @@ -347,9 +348,9 @@ TEST_CASE(testOperatorMinus) Vector v3(v2 - v1); // TODO: Test what happens if v1 & v2 are of different lengths. - TEST_ASSERT_EQ(v1.size(), static_cast(4)); - TEST_ASSERT_EQ(v2.size(), static_cast(4)); - TEST_ASSERT_EQ(v3.size(), static_cast(4)); + TEST_ASSERT_EQ(std::ssize(v1), 4); + TEST_ASSERT_EQ(std::ssize(v2), 4); + TEST_ASSERT_EQ(std::ssize(v3), 4); for (int i = 0; i < 4; i++) { diff --git a/externals/coda-oss/modules/c++/math.poly/include/math/poly/Fit.h b/externals/coda-oss/modules/c++/math.poly/include/math/poly/Fit.h index 0a3978fdbc..3e54777bf7 100644 --- a/externals/coda-oss/modules/c++/math.poly/include/math/poly/Fit.h +++ b/externals/coda-oss/modules/c++/math.poly/include/math/poly/Fit.h @@ -82,7 +82,7 @@ template OneD fit(const Vector_T& x, << sizeX << " points for an order-" << order << "fit)! You should really have at least (order+1) = " << (order+1) << " points for this to do what you expect."; - throw except::Exception(Ctxt(excSS.str())); + throw except::Exception(Ctxt(excSS)); } // Compute mean value @@ -206,7 +206,7 @@ inline math::poly::TwoD fit(const math::linear::Matrix2D& x, << x.size() << " points for a " << acols << "-coefficient fit)!" << " You should really have at least (orderX+1)*(orderY+1) = " << acols << " points for this to do what you expect."; - throw except::Exception(Ctxt(excSS.str())); + throw except::Exception(Ctxt(excSS)); } diff --git a/externals/coda-oss/modules/c++/math.poly/include/math/poly/Fixed1D.h b/externals/coda-oss/modules/c++/math.poly/include/math/poly/Fixed1D.h index 5f14c6fcd4..03024de73f 100644 --- a/externals/coda-oss/modules/c++/math.poly/include/math/poly/Fixed1D.h +++ b/externals/coda-oss/modules/c++/math.poly/include/math/poly/Fixed1D.h @@ -203,14 +203,14 @@ template class Fixed1D _T& operator [] (size_t i) { if (i > _Order) - throw except::IndexOutOfRangeException(Ctxt(FmtX("index [%d] is not in range [0..%d]", i, _Order))); + throw except::IndexOutOfRangeException(Ctxt(str::Format("index [%d] is not in range [0..%d]", i, _Order))); return mCoef[i]; } _T operator [] (size_t i) const { if (i > _Order) - throw except::IndexOutOfRangeException(Ctxt(FmtX("index [%d] is not in range [0..%d]", i, _Order))); + throw except::IndexOutOfRangeException(Ctxt(str::Format("index [%d] is not in range [0..%d]", i, _Order))); return mCoef[i]; diff --git a/externals/coda-oss/modules/c++/math.poly/include/math/poly/OneD.hpp b/externals/coda-oss/modules/c++/math.poly/include/math/poly/OneD.hpp index 67fb59b7b8..9aa0253540 100644 --- a/externals/coda-oss/modules/c++/math.poly/include/math/poly/OneD.hpp +++ b/externals/coda-oss/modules/c++/math.poly/include/math/poly/OneD.hpp @@ -178,10 +178,9 @@ OneD<_T>::operator [] (size_t i) } else { - std::stringstream str; - str << "index: " << i << " not within range [0..." - << mCoef.size() << ")"; - throw except::IndexOutOfRangeException(Ctxt(str.str())); + std::ostringstream str; + str << "index: " << i << " not within range [0..." << mCoef.size() << ")"; + throw except::IndexOutOfRangeException(Ctxt(str)); } } @@ -196,9 +195,9 @@ OneD<_T>::operator [] (size_t i) const } else { - std::stringstream str; + std::ostringstream str; str << "idx(" << i << ") not within range [0..." << mCoef.size() << ")"; - throw except::IndexOutOfRangeException(Ctxt(str.str())); + throw except::IndexOutOfRangeException(Ctxt(str)); } } diff --git a/externals/coda-oss/modules/c++/math.poly/include/math/poly/TwoD.h b/externals/coda-oss/modules/c++/math.poly/include/math/poly/TwoD.h index 05c8893f4b..574d49c543 100644 --- a/externals/coda-oss/modules/c++/math.poly/include/math/poly/TwoD.h +++ b/externals/coda-oss/modules/c++/math.poly/include/math/poly/TwoD.h @@ -109,15 +109,10 @@ class TwoD void set(size_t i, const OneD<_T>& p) { if (i > orderX()) - throw except::Exception( - Ctxt("Index [" + str::toString(i) + - "] is out of bounds for orderX [" + - str::toString(orderX()) + "]")); + throw except::Exception(Ctxt("Index [" + std::to_string(i) + "] is out of bounds for orderX [" + std::to_string(orderX()) + "]")); else if (p.order() != orderY()) throw except::Exception( - Ctxt("OneD poly [" + str::toString(p.order()) + - "] is of the incorrect size for orderY [" + - str::toString(orderY()) + "]")); + Ctxt("OneD poly [" + std::to_string(p.order()) + "] is of the incorrect size for orderY [" + std::to_string(orderY()) + "]")); else mCoef[i] = p; } diff --git a/externals/coda-oss/modules/c++/math.poly/include/math/poly/TwoD.hpp b/externals/coda-oss/modules/c++/math.poly/include/math/poly/TwoD.hpp index 2a26275404..87d7f72178 100644 --- a/externals/coda-oss/modules/c++/math.poly/include/math/poly/TwoD.hpp +++ b/externals/coda-oss/modules/c++/math.poly/include/math/poly/TwoD.hpp @@ -187,11 +187,9 @@ TwoD<_T>::operator [] (size_t i) const } else { - std::stringstream str; - str << "index:" << i << " not within range [0..." - << mCoef.size() << ")"; - - throw except::IndexOutOfRangeException(Ctxt(str.str())); + std::ostringstream str; + str << "index:" << i << " not within range [0..." << mCoef.size() << ")"; + throw except::IndexOutOfRangeException(Ctxt(str)); } return ret; } @@ -206,10 +204,9 @@ TwoD<_T>::operator [] (size_t i) } else { - std::stringstream str; - str << "index: " << i << " not within range [0..." - << mCoef.size() << ")"; - throw except::IndexOutOfRangeException(Ctxt(str.str())); + std::ostringstream str; + str << "index: " << i << " not within range [0..." << mCoef.size() << ")"; + throw except::IndexOutOfRangeException(Ctxt(str)); } } diff --git a/externals/coda-oss/modules/c++/math/include/math/ConvexHull.h b/externals/coda-oss/modules/c++/math/include/math/ConvexHull.h index 787e231195..55849f9bcd 100644 --- a/externals/coda-oss/modules/c++/math/include/math/ConvexHull.h +++ b/externals/coda-oss/modules/c++/math/include/math/ConvexHull.h @@ -97,8 +97,7 @@ class ConvexHull { throw except::Exception(Ctxt( "ConvexHull constructor error: must use at least 2 input " - "points but " + str::toString(rawPoints.size()) + - " were used")); + "points but " + std::to_string(rawPoints.size()) + " were used")); } // Enforce (at compile time) that T is a signed type diff --git a/externals/coda-oss/modules/c++/math/source/Utilities.cpp b/externals/coda-oss/modules/c++/math/source/Utilities.cpp index 7d4cbc73c1..aa60b36fc7 100644 --- a/externals/coda-oss/modules/c++/math/source/Utilities.cpp +++ b/externals/coda-oss/modules/c++/math/source/Utilities.cpp @@ -41,7 +41,7 @@ sys::Uint64_T nChooseK(size_t n, size_t k) if (n < k) { throw except::Exception(Ctxt("n Choose k undefined for n < k.\n" - "n: " + str::toString(n) + " k: " + str::toString(k))); + "n: " + std::to_string(n) + " k: " + std::to_string(k))); } // Algorithm to compute n Choose k without using factorials found here: diff --git a/externals/coda-oss/modules/c++/mem/include/mem/AutoPtr.h b/externals/coda-oss/modules/c++/mem/include/mem/AutoPtr.h index ee3eba6010..6f045f3b08 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/AutoPtr.h +++ b/externals/coda-oss/modules/c++/mem/include/mem/AutoPtr.h @@ -21,13 +21,11 @@ * */ +#pragma once #ifndef CODA_OSS_mem_AutoPtr_h_INCLUDED_ #define CODA_OSS_mem_AutoPtr_h_INCLUDED_ -#pragma once - -#include -#include "mem/SharedPtr.h" +#include namespace mem { diff --git a/externals/coda-oss/modules/c++/mem/include/mem/BufferView.h b/externals/coda-oss/modules/c++/mem/include/mem/BufferView.h index 02816c5260..55997392b2 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/BufferView.h +++ b/externals/coda-oss/modules/c++/mem/include/mem/BufferView.h @@ -70,7 +70,7 @@ struct BufferView oss << "BufferView::section() called with sectionSize: " << sectionSize << " when"; oss << " there were only " << size << " elements in the BufferView"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } BufferView newSection(data, sectionSize); diff --git a/externals/coda-oss/modules/c++/mem/include/mem/ComplexView.h b/externals/coda-oss/modules/c++/mem/include/mem/ComplexView.h index 6b8a60c0dc..88c4be0141 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/ComplexView.h +++ b/externals/coda-oss/modules/c++/mem/include/mem/ComplexView.h @@ -21,9 +21,9 @@ * */ +#pragma once #ifndef CODA_OSS_mem_ComplexView_h_INCLUDED_ #define CODA_OSS_mem_ComplexView_h_INCLUDED_ -#pragma once #include #include @@ -42,7 +42,7 @@ namespace mem /*! * \class ComplexViewConstIterator - * \brief Iterate over a ComplexView class only needing to know the + * \brief Iterate over a ComplexParallelView class only needing to know the * "axis" of the std::complex<>, i.e., "float" or "double". * * This allows view-independent code to be written without having to use @@ -149,11 +149,13 @@ struct ComplexViewConstIterator final * This classes have (almost) the same access routines regardless of how the underlying data is actually stored. * * Thing are intentinally kept very simple (for now), because it's not yet clear - * what functionality will be needed; YAGNI. + * what functionality will be needed. */ +// Storing an array of std::complex is called "interleaved," e.g., https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2663r2.html + template -struct ComplexSpanView final +struct ComplexInterleavedView final { using size_type = size_t; using value_type = std::complex; @@ -163,18 +165,18 @@ struct ComplexSpanView final using const_iterator = ComplexViewConstIterator; using iterator = const_iterator; - ComplexSpanView() = delete; - ~ComplexSpanView() = default; - explicit ComplexSpanView(span_t_ data) : data_(data) + ComplexInterleavedView() = delete; + ~ComplexInterleavedView() = default; + explicit ComplexInterleavedView(span_t_ data) : data_(data) { } - ComplexSpanView(const ComplexSpanView&) = default; - ComplexSpanView& operator=(const ComplexSpanView&) = default; - ComplexSpanView(ComplexSpanView&&) = default; - ComplexSpanView& operator=(ComplexSpanView&&) = default; + ComplexInterleavedView(const ComplexInterleavedView&) = default; + ComplexInterleavedView& operator=(const ComplexInterleavedView&) = default; + ComplexInterleavedView(ComplexInterleavedView&&) = default; + ComplexInterleavedView& operator=(ComplexInterleavedView&&) = default; // This class is almost the same as std::span> ... but - // don't provide data() as ComplexSpansView stores complex numbers in two + // don't provide data() as ComplexParallelView stores complex numbers in two // parallel arrays. Also see reals(), imags() and values(); below. // const value_type* data() const noexcept = delete; @@ -230,11 +232,11 @@ struct ComplexSpanView final public: auto reals() const { - return copy_axis(&ComplexSpanView::real); + return copy_axis(&ComplexInterleavedView::real); } auto imags() const { - return copy_axis(&ComplexSpanView::imag); + return copy_axis(&ComplexInterleavedView::imag); } auto values() const { @@ -245,21 +247,23 @@ struct ComplexSpanView final span_t_ data_; // i.e., std::span> }; template -inline ComplexSpanView make_ComplexSpanView(coda_oss::span> s) +inline auto make_ComplexInterleavedView(coda_oss::span> s) { - return ComplexSpanView(s); + return ComplexInterleavedView(s); } template -inline auto make_ComplexSpanView(const TVectorLike& v) +inline auto make_ComplexInterleavedView(const TVectorLike& v) { using cxvalue_t = typename TVectorLike::value_type; // i.e., std::complex using span_t = coda_oss::span; - return make_ComplexSpanView(span_t(v.data(), v.size())); + return make_ComplexInterleavedView(span_t(v.data(), v.size())); } +// This is not the "normal" storage in C++ (that would be "interleaved" via std::complex, above). However, +// it's one more likely to need additional "support." template -struct ComplexSpansView final // "Span_s_,", i.e., two spans. Avoiding "parallel" because that can conjure up multi-threading thoughts. +struct ComplexParallelView final // Two parallel arrays, absolutely nothing to to with multi-treading. { using size_type = size_t; using value_type = T; @@ -269,23 +273,23 @@ struct ComplexSpansView final // "Span_s_,", i.e., two spans. Avoiding "parallel using const_iterator = ComplexViewConstIterator; using iterator = const_iterator; - ComplexSpansView() = delete; - ~ComplexSpansView() = default; - ComplexSpansView(span_t_ reals, span_t_ imags) : reals_(reals), imags_(imags) + ComplexParallelView() = delete; + ~ComplexParallelView() = default; + ComplexParallelView(span_t_ reals, span_t_ imags) : reals_(reals), imags_(imags) { if (reals_.size() != imags_.size()) { throw std::invalid_argument("real and imag must be the same size."); } } - ComplexSpansView(const T* reals, const T* imags, size_t sz) : - ComplexSpansView(span_t_(reals, sz), span_t_(imags, sz)) + ComplexParallelView(const T* reals, const T* imags, size_t sz) : + ComplexParallelView(span_t_(reals, sz), span_t_(imags, sz)) { } - ComplexSpansView(const ComplexSpansView&) = default; - ComplexSpansView& operator=(const ComplexSpansView&) = default; - ComplexSpansView(ComplexSpansView&&) = default; - ComplexSpansView& operator=(ComplexSpansView&&) = default; + ComplexParallelView(const ComplexParallelView&) = default; + ComplexParallelView& operator=(const ComplexParallelView&) = default; + ComplexParallelView(ComplexParallelView&&) = default; + ComplexParallelView& operator=(ComplexParallelView&&) = default; constexpr auto real(size_type idx) const noexcept { @@ -344,13 +348,12 @@ struct ComplexSpansView final // "Span_s_,", i.e., two spans. Avoiding "parallel span_t_ imags_; }; template -inline ComplexSpansView make_ComplexSpansView( - coda_oss::span reals, coda_oss::span imags) +inline auto make_ComplexParallelView(coda_oss::span reals, coda_oss::span imags) { - return ComplexSpansView(reals, imags); + return ComplexParallelView(reals, imags); } template -inline auto make_ComplexSpansView(const TVectorLike& reals_, const TVectorLike& imags_) +inline auto make_ComplexParallelView(const TVectorLike& reals_, const TVectorLike& imags_) { using value_type = typename TVectorLike::value_type; // i.e., float using cxvalue_t = std::complex; // i.e., std::complex @@ -359,7 +362,7 @@ inline auto make_ComplexSpansView(const TVectorLike& reals_, const TVectorLike& const span_t reals(reals_.data(), reals_.size()); const span_t imags(imags_.data(), imags_.size()); - return make_ComplexSpansView(reals, imags); + return make_ComplexParallelView(reals, imags); } } diff --git a/externals/coda-oss/modules/c++/mem/include/mem/ScratchMemory.hpp b/externals/coda-oss/modules/c++/mem/include/mem/ScratchMemory.hpp index 45c6fcd261..7b22af8354 100644 --- a/externals/coda-oss/modules/c++/mem/include/mem/ScratchMemory.hpp +++ b/externals/coda-oss/modules/c++/mem/include/mem/ScratchMemory.hpp @@ -52,7 +52,7 @@ inline void ScratchMemory::put(const std::string& key, { std::ostringstream oss; oss << "Scratch memory space was already reserved for " << key; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } mSegments.insert( iterSeg, diff --git a/externals/coda-oss/modules/c++/mem/source/ScratchMemory.cpp b/externals/coda-oss/modules/c++/mem/source/ScratchMemory.cpp index a3f162daa0..4677b1da99 100644 --- a/externals/coda-oss/modules/c++/mem/source/ScratchMemory.cpp +++ b/externals/coda-oss/modules/c++/mem/source/ScratchMemory.cpp @@ -212,9 +212,8 @@ const ScratchMemory::Segment& ScratchMemory::lookupSegment( if (mBuffer.data == nullptr) { std::ostringstream oss; - oss << "Tried to get scratch memory for \"" << key - << "\" before running setup."; - throw except::Exception(Ctxt(oss.str())); + oss << "Tried to get scratch memory for \"" << key << "\" before running setup."; + throw except::Exception(Ctxt(oss)); } std::map::const_iterator iterSeg = mSegments.find(key); @@ -222,7 +221,7 @@ const ScratchMemory::Segment& ScratchMemory::lookupSegment( { std::ostringstream oss; oss << "Scratch memory segment was not found for \"" << key << "\""; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } const Segment& segment = iterSeg->second; @@ -230,9 +229,8 @@ const ScratchMemory::Segment& ScratchMemory::lookupSegment( { std::ostringstream oss; oss << "Trying to get buffer index " << indexBuffer << " for \"" - << key << "\", which has only " << segment.buffers.size() - << " buffers"; - throw except::Exception(Ctxt(oss.str())); + << key << "\", which has only " << segment.buffers.size() << " buffers"; + throw except::Exception(Ctxt(oss)); } return segment; } diff --git a/externals/coda-oss/modules/c++/mem/unittests/test_unique_ptr.cpp b/externals/coda-oss/modules/c++/mem/unittests/test_unique_ptr.cpp index 9b462b4b63..97fac431ce 100644 --- a/externals/coda-oss/modules/c++/mem/unittests/test_unique_ptr.cpp +++ b/externals/coda-oss/modules/c++/mem/unittests/test_unique_ptr.cpp @@ -20,7 +20,7 @@ * */ -#include +#include #include #include @@ -45,17 +45,17 @@ TEST_CASE(testStdUniquePtr) TEST_ASSERT_NULL(fooCtor.get()); fooCtor.reset(new Foo(123)); - TEST_ASSERT_NOT_EQ(nullptr, fooCtor.get()); + TEST_ASSERT_NOT_NULL(fooCtor.get()); TEST_ASSERT_EQ(123, fooCtor->mVal); } { auto fooCtor = std::make_unique(123); - TEST_ASSERT_NOT_EQ(nullptr, fooCtor.get()); + TEST_ASSERT_NOT_NULL(fooCtor.get()); TEST_ASSERT_EQ(123, fooCtor->mVal); } { auto pFoos = std::make_unique(123); // 123 instances of Foo - TEST_ASSERT_NOT_EQ(nullptr, pFoos.get()); + TEST_ASSERT_NOT_NULL(pFoos.get()); TEST_ASSERT_EQ(0, pFoos[0].mVal); TEST_ASSERT_EQ(0, pFoos[122].mVal); } @@ -65,24 +65,24 @@ TEST_CASE(test_make_unique) { { auto fooCtor = std::make_unique(123); - TEST_ASSERT_NOT_EQ(nullptr, fooCtor.get()); + TEST_ASSERT_NOT_NULL(fooCtor.get()); TEST_ASSERT_EQ(123, fooCtor->mVal); } { auto pFoos = std::make_unique(123); // 123 instances of Foo - TEST_ASSERT_NOT_EQ(nullptr, pFoos.get()); + TEST_ASSERT_NOT_NULL(pFoos.get()); TEST_ASSERT_EQ(0, pFoos[0].mVal); TEST_ASSERT_EQ(0, pFoos[122].mVal); } { auto fooCtor = std::make_unique(123); - TEST_ASSERT_NOT_EQ(nullptr, fooCtor.get()); + TEST_ASSERT_NOT_NULL(fooCtor.get()); TEST_ASSERT_EQ(123, fooCtor->mVal); } { auto pFoos = std::make_unique(123); // 123 instances of Foo - TEST_ASSERT_NOT_EQ(nullptr, pFoos.get()); + TEST_ASSERT_NOT_NULL(pFoos.get()); TEST_ASSERT_EQ(0, pFoos[0].mVal); TEST_ASSERT_EQ(0, pFoos[122].mVal); } diff --git a/externals/coda-oss/modules/c++/mem/unittests/test_vector_pointers.cpp b/externals/coda-oss/modules/c++/mem/unittests/test_vector_pointers.cpp index 74c11f1a7b..d4cb11dc7e 100644 --- a/externals/coda-oss/modules/c++/mem/unittests/test_vector_pointers.cpp +++ b/externals/coda-oss/modules/c++/mem/unittests/test_vector_pointers.cpp @@ -134,7 +134,7 @@ static void test_cx_view(const std::string& testName, const TView& view) TEST_ASSERT_EQ(view[3].imag(), 8.0f); } template -static void test_mem_ComplexView(const std::string& testName, const TView& view) +static void test_mem_ComplexParallelView(const std::string& testName, const TView& view) { test_cx_view(testName, view); @@ -175,12 +175,12 @@ TEST_CASE(testSpanCxFloat) test_cx_view(testName, view); } -TEST_CASE(testComplexViewFloat) +TEST_CASE(testComplexParallelViewFloat) { { - const auto view = mem::make_ComplexSpanView(cx_data()); + const auto view = mem::make_ComplexInterleavedView(cx_data()); TEST_ASSERT_EQ(cx_data().size(), view.size()); - test_mem_ComplexView(testName, view); + test_mem_ComplexParallelView(testName, view); test_cx_view(testName, view.values()); } @@ -188,9 +188,9 @@ TEST_CASE(testComplexViewFloat) const std::vector imags{2, 4, 6, 8}; TEST_ASSERT_EQ(imags.size(), reals.size()); { - const auto view = mem::make_ComplexSpansView(reals, imags); + const auto view = mem::make_ComplexParallelView(reals, imags); TEST_ASSERT_EQ(reals.size(), view.size()); - test_mem_ComplexView(testName, view); + test_mem_ComplexParallelView(testName, view); test_cx_view(testName, view.values()); } } @@ -235,10 +235,10 @@ static void test_mem_ComplexViewConstIterator(const std::string& testName, TView } } -TEST_CASE(testComplexViewFloatIterator) +TEST_CASE(testComplexParallelViewFloatIterator) { { - const auto view = mem::make_ComplexSpanView(cx_data()); + const auto view = mem::make_ComplexInterleavedView(cx_data()); test_mem_ComplexViewConstIterator(testName, view); } @@ -246,7 +246,7 @@ TEST_CASE(testComplexViewFloatIterator) const std::vector imags{2, 4, 6, 8}; TEST_ASSERT_EQ(imags.size(), reals.size()); { - const auto view = mem::make_ComplexSpansView(reals, imags); + const auto view = mem::make_ComplexParallelView(reals, imags); test_mem_ComplexViewConstIterator(testName, view); } } @@ -256,6 +256,6 @@ TEST_MAIN( TEST_CHECK(testVecOfSharedPointers); TEST_CHECK(testSpanCxFloat); - TEST_CHECK(testComplexViewFloat); - TEST_CHECK(testComplexViewFloatIterator); + TEST_CHECK(testComplexParallelViewFloat); + TEST_CHECK(testComplexParallelViewFloatIterator); ) diff --git a/externals/coda-oss/modules/c++/mt/include/mt/BalancedRunnable1D.h b/externals/coda-oss/modules/c++/mt/include/mt/BalancedRunnable1D.h index c7af782fb7..3ee200e04d 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/BalancedRunnable1D.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/BalancedRunnable1D.h @@ -159,7 +159,7 @@ void runBalanced1D(size_t numElements, std::ostringstream ostr; ostr << "Got " << numThreads << " threads but " << ops.size() << " functors"; - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } if (numThreads <= 1) diff --git a/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerLinux.h b/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerLinux.h index cde51eb615..494f6fb5e6 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerLinux.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/CPUAffinityInitializerLinux.h @@ -40,6 +40,7 @@ namespace mt struct AbstractNextCPUProviderLinux { virtual std::unique_ptr nextCPU() = 0; + virtual ~AbstractNextCPUProviderLinux() {} }; /*! diff --git a/externals/coda-oss/modules/c++/mt/include/mt/Runnable1D.h b/externals/coda-oss/modules/c++/mt/include/mt/Runnable1D.h index 406f9903f1..fb277b1e8c 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/Runnable1D.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/Runnable1D.h @@ -1,113 +1,113 @@ -#ifndef __MT_RUNNABLE_1D_H__ -#define __MT_RUNNABLE_1D_H__ - -#include -#include - -#include -#include -#include -#include "mt/ThreadPlanner.h" -#include "mt/ThreadGroup.h" - -namespace mt -{ -template -class Runnable1D : public sys::Runnable -{ -public: - Runnable1D(size_t startElement, - size_t numElements, - const OpT& op) : - mStartElement(startElement), - mEndElement(startElement + numElements), - mOp(op) - { - } - - virtual void run() override - { - for (size_t ii = mStartElement; ii < mEndElement; ++ii) - { - mOp(ii); - } - } - -private: - const size_t mStartElement; - const size_t mEndElement; - const OpT& mOp; -}; - -template -void run1D(size_t numElements, size_t numThreads, const OpT& op) -{ - if (numThreads <= 1) - { - Runnable1D(0, numElements, op).run(); - } - else - { - ThreadGroup threads; - const ThreadPlanner planner(numElements, numThreads); - - size_t threadNum(0); - size_t startElement(0); - size_t numElementsThisThread(0); - while(planner.getThreadInfo(threadNum++, startElement, numElementsThisThread)) - { - threads.createThread(new Runnable1D( - startElement, numElementsThisThread, op)); - } - threads.joinAll(); - } -} - -// Same as above but each thread gets their own 'op' -// This is useful when each thread needs its own local storage and/or you -// need access to a per-thread result afterwards (make these member variables -// mutable since operator() is const). -template -void run1D(size_t numElements, size_t numThreads, const std::vector& ops) -{ - if (ops.size() != numThreads) - { - std::ostringstream ostr; - ostr << "Got " << numThreads << " threads but " << ops.size() - << " functors"; - throw except::Exception(Ctxt(ostr.str())); - } - - if (numThreads <= 1) - { - Runnable1D(0, numElements, ops[0]).run(); - } - else - { - ThreadGroup threads; - const ThreadPlanner planner(numElements, numThreads); - - size_t threadNum(0); - size_t startElement(0); - size_t numElementsThisThread(0); - while(planner.getThreadInfo(threadNum, startElement, numElementsThisThread)) - { - threads.createThread(new Runnable1D( - startElement, numElementsThisThread, ops[threadNum++])); - } - threads.joinAll(); - } -} - -// Same as above but each thread gets their own copy-constructed copy of 'op' -// This is useful when each thread needs its own local storage (make this -// scratch space mutable since operator() is const). -template -void run1DWithCopies(size_t numElements, size_t numThreads, const OpT& op) -{ - const std::vector ops(numThreads, op); - run1D(numElements, numThreads, ops); -} -} - -#endif +#ifndef __MT_RUNNABLE_1D_H__ +#define __MT_RUNNABLE_1D_H__ + +#include +#include + +#include +#include +#include +#include "mt/ThreadPlanner.h" +#include "mt/ThreadGroup.h" + +namespace mt +{ +template +class Runnable1D : public sys::Runnable +{ +public: + Runnable1D(size_t startElement, + size_t numElements, + const OpT& op) : + mStartElement(startElement), + mEndElement(startElement + numElements), + mOp(op) + { + } + + virtual void run() override + { + for (size_t ii = mStartElement; ii < mEndElement; ++ii) + { + mOp(ii); + } + } + +private: + const size_t mStartElement; + const size_t mEndElement; + const OpT& mOp; +}; + +template +void run1D(size_t numElements, size_t numThreads, const OpT& op) +{ + if (numThreads <= 1) + { + Runnable1D(0, numElements, op).run(); + } + else + { + ThreadGroup threads; + const ThreadPlanner planner(numElements, numThreads); + + size_t threadNum(0); + size_t startElement(0); + size_t numElementsThisThread(0); + while(planner.getThreadInfo(threadNum++, startElement, numElementsThisThread)) + { + threads.createThread(new Runnable1D( + startElement, numElementsThisThread, op)); + } + threads.joinAll(); + } +} + +// Same as above but each thread gets their own 'op' +// This is useful when each thread needs its own local storage and/or you +// need access to a per-thread result afterwards (make these member variables +// mutable since operator() is const). +template +void run1D(size_t numElements, size_t numThreads, const std::vector& ops) +{ + if (ops.size() != numThreads) + { + std::ostringstream ostr; + ostr << "Got " << numThreads << " threads but " << ops.size() + << " functors"; + throw except::Exception(Ctxt(ostr)); + } + + if (numThreads <= 1) + { + Runnable1D(0, numElements, ops[0]).run(); + } + else + { + ThreadGroup threads; + const ThreadPlanner planner(numElements, numThreads); + + size_t threadNum(0); + size_t startElement(0); + size_t numElementsThisThread(0); + while(planner.getThreadInfo(threadNum, startElement, numElementsThisThread)) + { + threads.createThread(new Runnable1D( + startElement, numElementsThisThread, ops[threadNum++])); + } + threads.joinAll(); + } +} + +// Same as above but each thread gets their own copy-constructed copy of 'op' +// This is useful when each thread needs its own local storage (make this +// scratch space mutable since operator() is const). +template +void run1DWithCopies(size_t numElements, size_t numThreads, const OpT& op) +{ + const std::vector ops(numThreads, op); + run1D(numElements, numThreads, ops); +} +} + +#endif diff --git a/externals/coda-oss/modules/c++/mt/include/mt/ThreadGroup.h b/externals/coda-oss/modules/c++/mt/include/mt/ThreadGroup.h index e12cbf8a9b..f54e29a129 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/ThreadGroup.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/ThreadGroup.h @@ -81,7 +81,7 @@ struct CODA_OSS_API ThreadGroup /*! * Creates and starts a thread from a sys::Runnable. - * \param runnable auto_ptr to sys::Runnable + * \param runnable unique_ptr to sys::Runnable */ void createThread(std::unique_ptr&& runnable); diff --git a/externals/coda-oss/modules/c++/mt/include/mt/WorkSharingBalancedRunnable1D.h b/externals/coda-oss/modules/c++/mt/include/mt/WorkSharingBalancedRunnable1D.h index dd8e4553de..95f36e6a75 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/WorkSharingBalancedRunnable1D.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/WorkSharingBalancedRunnable1D.h @@ -238,7 +238,7 @@ void runWorkSharingBalanced1D(size_t numElements, std::ostringstream ostr; ostr << "Got " << numThreads << " threads but " << ops.size() << " functors"; - throw except::Exception(Ctxt(ostr.str())); + throw except::Exception(Ctxt(ostr)); } std::vector threadPoolEndElements; diff --git a/externals/coda-oss/modules/c++/mt/include/mt/WorkerThread.h b/externals/coda-oss/modules/c++/mt/include/mt/WorkerThread.h index 2a2e204684..d2321e5491 100644 --- a/externals/coda-oss/modules/c++/mt/include/mt/WorkerThread.h +++ b/externals/coda-oss/modules/c++/mt/include/mt/WorkerThread.h @@ -98,7 +98,7 @@ template class WorkerThread : public sys::Thread */ std::string getThreadId() { - return str::toString(sys::getThreadID()); + return std::to_string(sys::getThreadID()); } protected: diff --git a/externals/coda-oss/modules/c++/mt/source/CPUAffinityInitializerLinux.cpp b/externals/coda-oss/modules/c++/mt/source/CPUAffinityInitializerLinux.cpp index 01181be6b7..2f728fad97 100644 --- a/externals/coda-oss/modules/c++/mt/source/CPUAffinityInitializerLinux.cpp +++ b/externals/coda-oss/modules/c++/mt/source/CPUAffinityInitializerLinux.cpp @@ -51,14 +51,14 @@ std::vector mergeAvailableCPUs() namespace mt { -class AvailableCPUProvider : public AbstractNextCPUProviderLinux +struct AvailableCPUProvider final : public AbstractNextCPUProviderLinux { -public: AvailableCPUProvider() : mCPUs(mergeAvailableCPUs()), mNextCPUIndex(0) { } + ~AvailableCPUProvider() = default; virtual std::unique_ptr nextCPU() override { @@ -66,7 +66,7 @@ class AvailableCPUProvider : public AbstractNextCPUProviderLinux { std::ostringstream msg; msg << "No more CPUs available (size = " << mCPUs.size() << ")"; - throw except::Exception(Ctxt(msg.str())); + throw except::Exception(Ctxt(msg)); } std::unique_ptr mask(new sys::ScopedCPUMaskUnix()); @@ -79,13 +79,13 @@ class AvailableCPUProvider : public AbstractNextCPUProviderLinux size_t mNextCPUIndex; }; -class OffsetCPUProvider : public AbstractNextCPUProviderLinux +struct OffsetCPUProvider final : public AbstractNextCPUProviderLinux { -public: OffsetCPUProvider(int initialOffset) : mNextCPU(initialOffset) { } + ~OffsetCPUProvider() = default; virtual std::unique_ptr nextCPU() override { diff --git a/externals/coda-oss/modules/c++/mt/tests/MTSingletonTest.cpp b/externals/coda-oss/modules/c++/mt/tests/MTSingletonTest.cpp index beb1719e35..e71dce3454 100644 --- a/externals/coda-oss/modules/c++/mt/tests/MTSingletonTest.cpp +++ b/externals/coda-oss/modules/c++/mt/tests/MTSingletonTest.cpp @@ -103,7 +103,7 @@ class Thespian : public Runnable } void run() override { - //__debugln__(FmtX("[%s]:", mName.c_str())); + //__debugln__(str::Format("[%s]:", mName.c_str())); doLines(); } virtual void doLines() = 0; diff --git a/externals/coda-oss/modules/c++/mt/unittests/Runnable1DTest.cpp b/externals/coda-oss/modules/c++/mt/unittests/Runnable1DTest.cpp index 7c4c5bb57a..2c23081547 100644 --- a/externals/coda-oss/modules/c++/mt/unittests/Runnable1DTest.cpp +++ b/externals/coda-oss/modules/c++/mt/unittests/Runnable1DTest.cpp @@ -1,89 +1,89 @@ -/* ========================================================================= - * This file is part of mt-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * - * mt-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include -#include - -#include -#include -#include -#include - -#include "import/sys.h" -#include "import/mt.h" -#include "TestCase.h" - -struct AddOp final -{ - AddOp() = default; - void operator()(size_t element) const - { - std::ostringstream ostr; - ostr << element << std::endl; - - // This SHOULD result in not getting the printouts garbled between - // threads - ::fprintf(stderr, "%s", ostr.str().c_str()); - } -}; - -struct LocalStorage final -{ - LocalStorage() = default; - void operator()(size_t element) const - { - // All we're really showing here is that we never print out the same - // value twice due to the threads colliding - mValue = element; - std::ostringstream ostr; - ostr << mValue << std::endl; - ::fprintf(stderr, "%s", ostr.str().c_str()); - } - -private: - mutable size_t mValue = 0; -}; - -TEST_CASE(DoRunnable1DTest) -{ - std::cout << "Running test case\n"; - const AddOp op; - std::cout << "Calling run1D\n"; - mt::run1D(10, 16, op); - TEST_ASSERT_TRUE(true); // need to use hidden "testName" parameter -} - -TEST_CASE(Runnable1DWithCopiesTest) -{ - // TODO: Have LocalStorage actually store its values off in a vector, then - // show we got all those values. - std::cout << "Running test case\n"; - const LocalStorage op; - std::cout << "Calling run1D\n"; - mt::run1DWithCopies(47, 16, op); - TEST_ASSERT_TRUE(true); // need to use hidden "testName" parameter -} - -TEST_MAIN( - TEST_CHECK(DoRunnable1DTest); - TEST_CHECK(Runnable1DWithCopiesTest); - ) +/* ========================================================================= + * This file is part of mt-c++ + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * + * mt-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + +#include +#include + +#include +#include +#include +#include + +#include "import/sys.h" +#include "import/mt.h" +#include "TestCase.h" + +struct AddOp final +{ + AddOp() = default; + void operator()(size_t element) const + { + std::ostringstream ostr; + ostr << element << std::endl; + + // This SHOULD result in not getting the printouts garbled between + // threads + ::fprintf(stderr, "%s", ostr.str().c_str()); + } +}; + +struct LocalStorage final +{ + LocalStorage() = default; + void operator()(size_t element) const + { + // All we're really showing here is that we never print out the same + // value twice due to the threads colliding + mValue = element; + std::ostringstream ostr; + ostr << mValue << std::endl; + ::fprintf(stderr, "%s", ostr.str().c_str()); + } + +private: + mutable size_t mValue = 0; +}; + +TEST_CASE(DoRunnable1DTest) +{ + std::cout << "Running test case\n"; + const AddOp op; + std::cout << "Calling run1D\n"; + mt::run1D(10, 16, op); + TEST_ASSERT_TRUE(true); // need to use hidden "testName" parameter +} + +TEST_CASE(Runnable1DWithCopiesTest) +{ + // TODO: Have LocalStorage actually store its values off in a vector, then + // show we got all those values. + std::cout << "Running test case\n"; + const LocalStorage op; + std::cout << "Calling run1D\n"; + mt::run1DWithCopies(47, 16, op); + TEST_ASSERT_TRUE(true); // need to use hidden "testName" parameter +} + +TEST_MAIN( + TEST_CHECK(DoRunnable1DTest); + TEST_CHECK(Runnable1DWithCopiesTest); + ) diff --git a/externals/coda-oss/modules/c++/mt/unittests/ThreadGroupTest.cpp b/externals/coda-oss/modules/c++/mt/unittests/ThreadGroupTest.cpp index 09641ef551..8697bf8dcc 100644 --- a/externals/coda-oss/modules/c++/mt/unittests/ThreadGroupTest.cpp +++ b/externals/coda-oss/modules/c++/mt/unittests/ThreadGroupTest.cpp @@ -1,107 +1,107 @@ -/* ========================================================================= - * This file is part of mt-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * - * mt-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include "import/sys.h" -#include "import/mt.h" -#include "TestCase.h" - -struct MyRunTask final : public sys::Runnable -{ - int result; - int *state; - int *num_deleted; - - MyRunTask(int *new_state, int *new_num_deleted) - { - state = new_state; - result = *new_state; - num_deleted = new_num_deleted; - } - virtual ~MyRunTask() - { - (*num_deleted)++; - } - - virtual void run() override - { - while (result == 1) - result = *state; - } -}; - -TEST_CASE(DoThreadGroupTest) -{ - auto threads = new mt::ThreadGroup(); - int state = 1, numDeleted = 0; - MyRunTask *tasks[3]; - - for (int i = 0; i < 3; i++) - tasks[i] = new MyRunTask(&state, &numDeleted); - - threads->createThread(tasks[0]); - threads->createThread(tasks[1]); - state = 2; - threads->joinAll(); - - TEST_ASSERT_EQ(tasks[0]->result, 2); - TEST_ASSERT_EQ(tasks[1]->result, 2); - - state = 1; - threads->createThread(tasks[2]); - state = 3; - - TEST_ASSERT_EQ(numDeleted, 0); - - delete threads; - TEST_ASSERT_EQ(numDeleted, 3); -} - -TEST_CASE(PinToCPUTest) -{ - bool defaultValue; -#if defined(MT_DEFAULT_PINNING) - defaultValue = true; -#else - defaultValue = false; -#endif - // Check the pinning settings for the default value - TEST_ASSERT_EQ(mt::ThreadGroup::getDefaultPinToCPU(), defaultValue); - mt::ThreadGroup threads1; - TEST_ASSERT_EQ(threads1.isPinToCPUEnabled(), defaultValue); - - // Check the pinning settings when pinning is enabled - mt::ThreadGroup::setDefaultPinToCPU(true); - TEST_ASSERT_EQ(mt::ThreadGroup::getDefaultPinToCPU(), true); - mt::ThreadGroup threads2; - TEST_ASSERT_EQ(threads2.isPinToCPUEnabled(), true); - - // Check the pinning settings when pinning is disabled - mt::ThreadGroup::setDefaultPinToCPU(false); - TEST_ASSERT_EQ(mt::ThreadGroup::getDefaultPinToCPU(), false); - mt::ThreadGroup threads3; - TEST_ASSERT_EQ(threads3.isPinToCPUEnabled(), false); -} - -TEST_MAIN( - TEST_CHECK(DoThreadGroupTest); - TEST_CHECK(PinToCPUTest); - ) +/* ========================================================================= + * This file is part of mt-c++ + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * + * mt-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + +#include "import/sys.h" +#include "import/mt.h" +#include "TestCase.h" + +struct MyRunTask final : public sys::Runnable +{ + int result; + int *state; + int *num_deleted; + + MyRunTask(int *new_state, int *new_num_deleted) + { + state = new_state; + result = *new_state; + num_deleted = new_num_deleted; + } + virtual ~MyRunTask() + { + (*num_deleted)++; + } + + virtual void run() override + { + while (result == 1) + result = *state; + } +}; + +TEST_CASE(DoThreadGroupTest) +{ + auto threads = new mt::ThreadGroup(); + int state = 1, numDeleted = 0; + MyRunTask *tasks[3]; + + for (int i = 0; i < 3; i++) + tasks[i] = new MyRunTask(&state, &numDeleted); + + threads->createThread(tasks[0]); + threads->createThread(tasks[1]); + state = 2; + threads->joinAll(); + + TEST_ASSERT_EQ(tasks[0]->result, 2); + TEST_ASSERT_EQ(tasks[1]->result, 2); + + state = 1; + threads->createThread(tasks[2]); + state = 3; + + TEST_ASSERT_EQ(numDeleted, 0); + + delete threads; + TEST_ASSERT_EQ(numDeleted, 3); +} + +TEST_CASE(PinToCPUTest) +{ + bool defaultValue; +#if defined(MT_DEFAULT_PINNING) + defaultValue = true; +#else + defaultValue = false; +#endif + // Check the pinning settings for the default value + TEST_ASSERT_EQ(mt::ThreadGroup::getDefaultPinToCPU(), defaultValue); + mt::ThreadGroup threads1; + TEST_ASSERT_EQ(threads1.isPinToCPUEnabled(), defaultValue); + + // Check the pinning settings when pinning is enabled + mt::ThreadGroup::setDefaultPinToCPU(true); + TEST_ASSERT_EQ(mt::ThreadGroup::getDefaultPinToCPU(), true); + mt::ThreadGroup threads2; + TEST_ASSERT_EQ(threads2.isPinToCPUEnabled(), true); + + // Check the pinning settings when pinning is disabled + mt::ThreadGroup::setDefaultPinToCPU(false); + TEST_ASSERT_EQ(mt::ThreadGroup::getDefaultPinToCPU(), false); + mt::ThreadGroup threads3; + TEST_ASSERT_EQ(threads3.isPinToCPUEnabled(), false); +} + +TEST_MAIN( + TEST_CHECK(DoThreadGroupTest); + TEST_CHECK(PinToCPUTest); + ) diff --git a/externals/coda-oss/modules/c++/mt/unittests/ThreadPlannerTest.cpp b/externals/coda-oss/modules/c++/mt/unittests/ThreadPlannerTest.cpp index 295719630a..f6069a11c2 100644 --- a/externals/coda-oss/modules/c++/mt/unittests/ThreadPlannerTest.cpp +++ b/externals/coda-oss/modules/c++/mt/unittests/ThreadPlannerTest.cpp @@ -1,84 +1,84 @@ -/* ========================================================================= - * This file is part of mt-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * - * mt-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include -#include "TestCase.h" - -TEST_CASE(GetThreadInfoTest) -{ - const size_t numThreads(16); - const mt::ThreadPlanner planner(500, numThreads); - size_t startElement(0); - size_t numElements(0); - for (size_t ii = 0; ii < numThreads; ++ii) - { - planner.getThreadInfo(ii, startElement, numElements); - if (ii == numThreads - 1) - { - TEST_ASSERT_EQ(numElements, static_cast(20)); - } - else - { - TEST_ASSERT_EQ(numElements, static_cast(32)); - } - } -} - -TEST_CASE(GetNumThreadsThatWillBeUsedTest) -{ - static const size_t NUM_ELEMENTS = 100; - - // This divides evenly - const mt::ThreadPlanner planner1(NUM_ELEMENTS, 10); - TEST_ASSERT_EQ(planner1.getNumThreadsThatWillBeUsed(), static_cast(10)); - - // This doesn't divide evenly but we still need all the threads - const mt::ThreadPlanner planner2(NUM_ELEMENTS, 9); - TEST_ASSERT_EQ(planner2.getNumThreadsThatWillBeUsed(), static_cast(9)); - - // This doesn't divide evenly - we only need 10 threads - const mt::ThreadPlanner planner3(NUM_ELEMENTS, 11); - TEST_ASSERT_EQ(planner3.getNumThreadsThatWillBeUsed(), static_cast(10)); - - // Have one less thread than the number of elements - at least one thread - // is going to need two elements, so we might as well just use 50 threads - // and give them all two elements - const mt::ThreadPlanner planner4(NUM_ELEMENTS, 99); - TEST_ASSERT_EQ(planner4.getNumThreadsThatWillBeUsed(), static_cast(50)); - - // Have as many elements as threads - one element per thread - const mt::ThreadPlanner planner5(NUM_ELEMENTS, 100); - TEST_ASSERT_EQ(planner5.getNumThreadsThatWillBeUsed(), static_cast(100)); - - // Have more elements than threads - only the first NUM_ELEMENTS threads - // are needed - const mt::ThreadPlanner planner6(NUM_ELEMENTS, 101); - TEST_ASSERT_EQ(planner6.getNumThreadsThatWillBeUsed(), static_cast(100)); - - const mt::ThreadPlanner planner7(NUM_ELEMENTS, 9999); - TEST_ASSERT_EQ(planner7.getNumThreadsThatWillBeUsed(), static_cast(100)); -} - -TEST_MAIN( - TEST_CHECK(GetThreadInfoTest); - TEST_CHECK(GetNumThreadsThatWillBeUsedTest); -) +/* ========================================================================= + * This file is part of mt-c++ + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * + * mt-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + +#include +#include "TestCase.h" + +TEST_CASE(GetThreadInfoTest) +{ + const size_t numThreads(16); + const mt::ThreadPlanner planner(500, numThreads); + size_t startElement(0); + size_t numElements(0); + for (size_t ii = 0; ii < numThreads; ++ii) + { + planner.getThreadInfo(ii, startElement, numElements); + if (ii == numThreads - 1) + { + TEST_ASSERT_EQ(numElements, static_cast(20)); + } + else + { + TEST_ASSERT_EQ(numElements, static_cast(32)); + } + } +} + +TEST_CASE(GetNumThreadsThatWillBeUsedTest) +{ + static const size_t NUM_ELEMENTS = 100; + + // This divides evenly + const mt::ThreadPlanner planner1(NUM_ELEMENTS, 10); + TEST_ASSERT_EQ(planner1.getNumThreadsThatWillBeUsed(), static_cast(10)); + + // This doesn't divide evenly but we still need all the threads + const mt::ThreadPlanner planner2(NUM_ELEMENTS, 9); + TEST_ASSERT_EQ(planner2.getNumThreadsThatWillBeUsed(), static_cast(9)); + + // This doesn't divide evenly - we only need 10 threads + const mt::ThreadPlanner planner3(NUM_ELEMENTS, 11); + TEST_ASSERT_EQ(planner3.getNumThreadsThatWillBeUsed(), static_cast(10)); + + // Have one less thread than the number of elements - at least one thread + // is going to need two elements, so we might as well just use 50 threads + // and give them all two elements + const mt::ThreadPlanner planner4(NUM_ELEMENTS, 99); + TEST_ASSERT_EQ(planner4.getNumThreadsThatWillBeUsed(), static_cast(50)); + + // Have as many elements as threads - one element per thread + const mt::ThreadPlanner planner5(NUM_ELEMENTS, 100); + TEST_ASSERT_EQ(planner5.getNumThreadsThatWillBeUsed(), static_cast(100)); + + // Have more elements than threads - only the first NUM_ELEMENTS threads + // are needed + const mt::ThreadPlanner planner6(NUM_ELEMENTS, 101); + TEST_ASSERT_EQ(planner6.getNumThreadsThatWillBeUsed(), static_cast(100)); + + const mt::ThreadPlanner planner7(NUM_ELEMENTS, 9999); + TEST_ASSERT_EQ(planner7.getNumThreadsThatWillBeUsed(), static_cast(100)); +} + +TEST_MAIN( + TEST_CHECK(GetThreadInfoTest); + TEST_CHECK(GetNumThreadsThatWillBeUsedTest); +) diff --git a/externals/coda-oss/modules/c++/mt/unittests/balanced_runnable_1d_test.cpp b/externals/coda-oss/modules/c++/mt/unittests/balanced_runnable_1d_test.cpp index 4ff1d80fad..c521870959 100644 --- a/externals/coda-oss/modules/c++/mt/unittests/balanced_runnable_1d_test.cpp +++ b/externals/coda-oss/modules/c++/mt/unittests/balanced_runnable_1d_test.cpp @@ -20,6 +20,8 @@ * */ #include +#include + #include "TestCase.h" class IncOp diff --git a/externals/coda-oss/modules/c++/mt/unittests/work_sharing_balanced_runnable_1d_test.cpp b/externals/coda-oss/modules/c++/mt/unittests/work_sharing_balanced_runnable_1d_test.cpp index c161b31cd5..cfd8249984 100644 --- a/externals/coda-oss/modules/c++/mt/unittests/work_sharing_balanced_runnable_1d_test.cpp +++ b/externals/coda-oss/modules/c++/mt/unittests/work_sharing_balanced_runnable_1d_test.cpp @@ -20,6 +20,8 @@ * */ #include +#include + #include "TestCase.h" struct IncOp final diff --git a/externals/coda-oss/modules/c++/net.ssl/source/SSLConnection.cpp b/externals/coda-oss/modules/c++/net.ssl/source/SSLConnection.cpp index 903fa077dc..433d737489 100644 --- a/externals/coda-oss/modules/c++/net.ssl/source/SSLConnection.cpp +++ b/externals/coda-oss/modules/c++/net.ssl/source/SSLConnection.cpp @@ -37,7 +37,7 @@ net::ssl::SSLConnection::SSLConnection(std::unique_ptr&& socket, mSSL = SSL_new(ctx); if (mSSL == nullptr) { - throw net::ssl::SSLException(Ctxt(FmtX("SSL_new failed"))); + throw net::ssl::SSLException(Ctxt(str::Format("SSL_new failed"))); } setupSocket(host); @@ -87,7 +87,7 @@ void net::ssl::SSLConnection::setupSocket(const std::string& hostName) #endif throw net::ssl::SSLException - (Ctxt(FmtX("SSL_connect failed: %d", SSL_get_error(mSSL, val)))); + (Ctxt(str::Format("SSL_connect failed: %d", SSL_get_error(mSSL, val)))); } if(mServerAuthentication) @@ -143,7 +143,7 @@ sys::SSize_T net::ssl::SSLConnection::read(sys::byte* b, sys::Size_T len) std::cout << "=============================================" << std::endl << std::endl; #endif - throw net::ssl::SSLException(Ctxt(FmtX("When receiving %d bytes", + throw net::ssl::SSLException(Ctxt(str::Format("When receiving %d bytes", len)) ); } else if (numBytes == 0) @@ -155,7 +155,7 @@ sys::SSize_T net::ssl::SSLConnection::read(sys::byte* b, sys::Size_T len) return -1; } #if defined(__DEBUG_SOCKET) - std::cout << FmtX("Read %d bytes from socket:", numBytes) << std::endl; + std::cout << str::Format("Read %d bytes from socket:", numBytes) << std::endl; std::cout << "---------------------------------------------" << std::endl; std::cout << std::string(b, numBytes) << std::endl; std::cout << "---------------------------------------------" << std::endl; @@ -172,7 +172,7 @@ void net::ssl::SSLConnection::write(const sys::byte* b, sys::Size_T len) const auto numBytes = SSL_write(mSSL, (const char*)b, len); if (static_cast(numBytes) != len) { - throw net::ssl::SSLException(Ctxt(FmtX("Tried sending %d bytes, %d sent", + throw net::ssl::SSLException(Ctxt(str::Format("Tried sending %d bytes, %d sent", len, numBytes)) ); } diff --git a/externals/coda-oss/modules/c++/net.ssl/source/SSLConnectionClientFactory.cpp b/externals/coda-oss/modules/c++/net.ssl/source/SSLConnectionClientFactory.cpp index 5a9d441480..63a721a818 100644 --- a/externals/coda-oss/modules/c++/net.ssl/source/SSLConnectionClientFactory.cpp +++ b/externals/coda-oss/modules/c++/net.ssl/source/SSLConnectionClientFactory.cpp @@ -60,12 +60,12 @@ void net::ssl::SSLConnectionClientFactory::initializeContext() if(method == nullptr) { - throw net::ssl::SSLException(Ctxt(FmtX("SSLv23_client_method failed"))); + throw net::ssl::SSLException(Ctxt(str::Format("SSLv23_client_method failed"))); } mCtx = SSL_CTX_new(method); if(mCtx == nullptr) { - throw net::ssl::SSLException(Ctxt(FmtX("SSL_CTX_new failed"))); + throw net::ssl::SSLException(Ctxt(str::Format("SSL_CTX_new failed"))); } if(mClientAuthentication) diff --git a/externals/coda-oss/modules/c++/net.ssl/tests/SSLTestClient.cpp b/externals/coda-oss/modules/c++/net.ssl/tests/SSLTestClient.cpp index 074b4abb23..ff8db2b6fd 100644 --- a/externals/coda-oss/modules/c++/net.ssl/tests/SSLTestClient.cpp +++ b/externals/coda-oss/modules/c++/net.ssl/tests/SSLTestClient.cpp @@ -39,7 +39,7 @@ int main(int argc, char **argv) try { if (argc != 2) - throw Exception(FmtX("Usage: %s ", argv[0])); + throw Exception(str::Format("Usage: %s ", argv[0])); URL url(argv[1]); //int sslOn = atoi(argv[2]); diff --git a/externals/coda-oss/modules/c++/net.ssl/tests/SSLTestClientNoURL.cpp b/externals/coda-oss/modules/c++/net.ssl/tests/SSLTestClientNoURL.cpp index 60baa34faa..89c4d64764 100644 --- a/externals/coda-oss/modules/c++/net.ssl/tests/SSLTestClientNoURL.cpp +++ b/externals/coda-oss/modules/c++/net.ssl/tests/SSLTestClientNoURL.cpp @@ -40,7 +40,7 @@ int main(int argc, char** argv) try { if (argc != 3) - throw Exception(FmtX("Usage: %s ", argv[0])); + throw Exception(str::Format("Usage: %s ", argv[0])); std::string host(argv[1]); int port(atoi(argv[2])); diff --git a/externals/coda-oss/modules/c++/net/include/net/Socket.h b/externals/coda-oss/modules/c++/net/include/net/Socket.h index 7d75eae466..024af735c5 100644 --- a/externals/coda-oss/modules/c++/net/include/net/Socket.h +++ b/externals/coda-oss/modules/c++/net/include/net/Socket.h @@ -170,7 +170,7 @@ class Socket std::ostringstream oss; oss << "Socket setOptions failure: " << err.toString(); - throw sys::SocketException(Ctxt(oss.str())); + throw sys::SocketException(Ctxt(oss)); } } diff --git a/externals/coda-oss/modules/c++/net/include/net/URL.h b/externals/coda-oss/modules/c++/net/include/net/URL.h index ea9b4f8fe7..60e914e795 100644 --- a/externals/coda-oss/modules/c++/net/include/net/URL.h +++ b/externals/coda-oss/modules/c++/net/include/net/URL.h @@ -113,6 +113,13 @@ class URL std::string mFragment; }; + +inline std::ostream& operator<<(std::ostream& os, const URL& url) +{ + os << url.toString(); + return os; +} + } #endif diff --git a/externals/coda-oss/modules/c++/net/source/DaemonUnix.cpp b/externals/coda-oss/modules/c++/net/source/DaemonUnix.cpp index 8683816f95..af0a1e0bf6 100644 --- a/externals/coda-oss/modules/c++/net/source/DaemonUnix.cpp +++ b/externals/coda-oss/modules/c++/net/source/DaemonUnix.cpp @@ -258,12 +258,12 @@ void DaemonUnix::redirectStreamsTo(const std::string& filename) if (openFileFor(STDOUT_FILENO, filename, O_WRONLY|O_CREAT|O_TRUNC) < 0) { throw except::Exception( - Ctxt(FmtX("Failed to open file %s for STDOUT.", filename.c_str()))); + Ctxt(str::Format("Failed to open file %s for STDOUT.", filename))); } if (openFileFor(STDERR_FILENO, filename, O_WRONLY|O_CREAT|O_TRUNC) < 0) { throw except::Exception( - Ctxt(FmtX("Failed to open file %s for STDERR.", filename.c_str()))); + Ctxt(str::Format("Failed to open file %s for STDERR.", filename))); } } diff --git a/externals/coda-oss/modules/c++/net/source/NetConnectionClientFactory.cpp b/externals/coda-oss/modules/c++/net/source/NetConnectionClientFactory.cpp index 7ae294eda7..20babad605 100644 --- a/externals/coda-oss/modules/c++/net/source/NetConnectionClientFactory.cpp +++ b/externals/coda-oss/modules/c++/net/source/NetConnectionClientFactory.cpp @@ -65,13 +65,6 @@ net::NetConnection* net::NetConnectionClientFactory::newConnection( { return new net::NetConnection(std::move(toServer)); } -#if CODA_OSS_autoptr_is_std // std::unique_ptr removed in C++17 -net::NetConnection* net::NetConnectionClientFactory::newConnection( - std::unique_ptr toServer) -{ - return new net::NetConnection(toServer); -} -#endif net::NetConnection * net::NetConnectionClientFactory::create( const net::SocketAddress& address) diff --git a/externals/coda-oss/modules/c++/net/source/Socket.cpp b/externals/coda-oss/modules/c++/net/source/Socket.cpp index 9c0c791b90..33c44057d9 100644 --- a/externals/coda-oss/modules/c++/net/source/Socket.cpp +++ b/externals/coda-oss/modules/c++/net/source/Socket.cpp @@ -101,10 +101,8 @@ size_t net::Socket::recv(void* b, size_t len, int flags) sys::Err err; std::ostringstream oss; - oss << "When receiving " << str::toString(len) << " bytes: " << - err.toString(); - - throw sys::SocketException(Ctxt(oss.str())); + oss << "When receiving " << len << " bytes: " << err.toString(); + throw sys::SocketException(Ctxt(oss)); } else if (numBytes == 0) { @@ -115,7 +113,7 @@ size_t net::Socket::recv(void* b, size_t len, int flags) return static_cast(-1); } #if defined(__DEBUG_SOCKET) - std::cout << FmtX("Read %d bytes from socket:", numBytes) << std::endl; + std::cout << str::Format("Read %d bytes from socket:", numBytes) << std::endl; std::cout << "---------------------------------------------" << std::endl; std::cout << std::string(b, numBytes) << std::endl; std::cout << "---------------------------------------------" << std::endl; @@ -170,7 +168,7 @@ void net::Socket::send(const void* b, size_t len, int flags) oss << "Tried sending " << len << " bytes, " << numBytes << " sent: " << err.toString(); - throw sys::SocketException(Ctxt(oss.str())); + throw sys::SocketException(Ctxt(oss)); } } @@ -193,6 +191,6 @@ void net::Socket::sendTo(const SocketAddress& address, oss << "Tried sending " << len << " bytes, " << numBytes << " sent: " << err.toString(); - throw sys::SocketException(Ctxt(oss.str())); + throw sys::SocketException(Ctxt(oss)); } } diff --git a/externals/coda-oss/modules/c++/net/source/URL.cpp b/externals/coda-oss/modules/c++/net/source/URL.cpp index 8791e0c6bd..98c2ab88b1 100644 --- a/externals/coda-oss/modules/c++/net/source/URL.cpp +++ b/externals/coda-oss/modules/c++/net/source/URL.cpp @@ -206,7 +206,11 @@ std::string net::URLParams::toString() const { if (!firstParam) s << "&"; - s << net::quote(key) << "=" << net::quote(*it2); + auto quotedKey = net::quote(key); + s << quotedKey; + s << "="; + quotedKey = net::quote(*it2); + s << quotedKey; firstParam = false; } } diff --git a/externals/coda-oss/modules/c++/net/tests/NetConnectionClientTest.cpp b/externals/coda-oss/modules/c++/net/tests/NetConnectionClientTest.cpp index 992ac5eca0..abe0b35790 100644 --- a/externals/coda-oss/modules/c++/net/tests/NetConnectionClientTest.cpp +++ b/externals/coda-oss/modules/c++/net/tests/NetConnectionClientTest.cpp @@ -39,7 +39,7 @@ int main(int argc, char **argv) try { if (argc != 3) - throw Exception(FmtX("Usage: %s ", argv[0])); + throw Exception(str::Format("Usage: %s ", argv[0])); std::string host(argv[1]); int port(atoi(argv[2])); diff --git a/externals/coda-oss/modules/c++/net/tests/NetConnectionServerTest.cpp b/externals/coda-oss/modules/c++/net/tests/NetConnectionServerTest.cpp index ed72a907ba..0cb8cdb0cf 100644 --- a/externals/coda-oss/modules/c++/net/tests/NetConnectionServerTest.cpp +++ b/externals/coda-oss/modules/c++/net/tests/NetConnectionServerTest.cpp @@ -74,7 +74,7 @@ int main(int argc, char **argv) try { if (argc < 2) - throw Exception(FmtX("Usage: %s (-mt|-st|-tp)", argv[0])); + throw Exception(str::Format("Usage: %s (-mt|-st|-tp)", argv[0])); net::AllocStrategy* strategy = nullptr; diff --git a/externals/coda-oss/modules/c++/net/tests/SerializableTestClient.cpp b/externals/coda-oss/modules/c++/net/tests/SerializableTestClient.cpp index 229758ca3f..0c472bf09f 100644 --- a/externals/coda-oss/modules/c++/net/tests/SerializableTestClient.cpp +++ b/externals/coda-oss/modules/c++/net/tests/SerializableTestClient.cpp @@ -39,7 +39,7 @@ int main(int argc, char **argv) try { if (argc != 2) - throw Exception(FmtX("Usage: %s ", argv[0])); + throw Exception(str::Format("Usage: %s ", argv[0])); URL url(argv[1]); diff --git a/externals/coda-oss/modules/c++/net/tests/URLTest.cpp b/externals/coda-oss/modules/c++/net/tests/URLTest.cpp index aacde069ca..e6c5f79320 100644 --- a/externals/coda-oss/modules/c++/net/tests/URLTest.cpp +++ b/externals/coda-oss/modules/c++/net/tests/URLTest.cpp @@ -36,7 +36,7 @@ int main(int argc, char **argv) try { if (argc != 2) - throw Exception(FmtX("Usage: %s ", argv[0])); + throw Exception(str::Format("Usage: %s ", argv[0])); URL url(argv[1]); diff --git a/externals/coda-oss/modules/c++/numpyutils/wscript b/externals/coda-oss/modules/c++/numpyutils/wscript index 950f4bfca6..4313a88594 100644 --- a/externals/coda-oss/modules/c++/numpyutils/wscript +++ b/externals/coda-oss/modules/c++/numpyutils/wscript @@ -1,5 +1,4 @@ NAME = 'numpyutils' -MAINTAINER = 'anuraag.pakanati@mdaus.com' VERSION = '1.0' MODULE_DEPS = 'types except sys' USELIB = 'NUMPY PYEXT PYEMBED' diff --git a/externals/coda-oss/modules/c++/pch.cpp b/externals/coda-oss/modules/c++/pch.cpp index 91c22df2a1..64b7eef6d6 100644 --- a/externals/coda-oss/modules/c++/pch.cpp +++ b/externals/coda-oss/modules/c++/pch.cpp @@ -1,5 +1,5 @@ -// pch.cpp: source file corresponding to the pre-compiled header - -#include "pch.h" - -// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/externals/coda-oss/modules/c++/pch.h b/externals/coda-oss/modules/c++/pch.h index 18067f14df..7952e6efa2 100644 --- a/externals/coda-oss/modules/c++/pch.h +++ b/externals/coda-oss/modules/c++/pch.h @@ -1,116 +1,117 @@ -// pch.h: This is a precompiled header file. -// Files listed below are compiled only once, improving build performance for future builds. -// This also affects IntelliSense performance, including code completion and many code browsing features. -// However, files listed here are ALL re-compiled if any one of them is updated between builds. -// Do not add files here that you will be updating frequently as this negates the performance advantage. - -#pragma once -#ifndef CODA_OSS_pch_h_INCLUDED_ -#define CODA_OSS_pch_h_INCLUDED_ - -#include "coda_oss/CPlusPlus.h" -#include "config/disable_compiler_warnings.h" - -CODA_OSS_disable_warning_system_header_push - -// add headers that you want to pre-compile here -#include "framework.h" - -#define _USE_MATH_DEFINES -#include -#include -#include -#include -#include -#include -#include -#include - -CODA_OSS_disable_warning_pop - -#include "import/std.h" - - -#include -#include -#pragma comment(lib, "z.lib") -#pragma comment(lib, "minizip.lib") - -#include - -#pragma warning(disable: 4251) // '...': class '...' needs to have dll-interface to be used by clients of class '...' -#pragma warning(disable: 4365) // '...': conversion from '...' to '...', signed/unsigned mismatch -#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' function under -EHc. Undefined behavior may occur if this function throws an exception. -#pragma warning(disable: 6054) // String '...' might not be zero-terminated. -#pragma warning(disable: 6387) // '...' could be '...'. -#pragma warning(disable: 6305) // Potential mismatch between sizeof and countof quantities. Use sizeof() to scale byte sizes. -#pragma warning(disable: 6389) // Move '...' to anonymous namespace or put a forward declaration in a common header included in this file. - -#pragma warning(disable: 26822) // Dereferencing a null pointer '...' (lifetime.1). -#pragma warning(disable: 26432) // If you define or delete any default operation in the type '...', define or delete them all (c.21). -#pragma warning(disable: 26429) // Symbol '...' is never tested for nullness, it can be marked as not_null (f.23). -#pragma warning(disable: 26455) // Default constructor should not throw. Declare it '...' (f.6). -#pragma warning(disable: 26440) // Function '...' can be declared '...' (f.6). -#pragma warning(disable: 26447) // The function is declared '...' but calls function '...' which may throw exceptions (f.6). -#pragma warning(disable: 26496) // The variable '...' does not change after construction, mark it as const (con.4). -#pragma warning(disable: 26462) // The value pointed to by '...' is assigned only once, mark it as a pointer to const (con.4). -#pragma warning(disable: 26409) // Avoid calling new and delete explicitly, use std::make_unique instead (r.11). -#pragma warning(disable: 26401) // Do not delete a raw pointer that is not an owner (i.11). -#pragma warning(disable: 26472) // Don't use a static_cast for arithmetic conversions. Use brace initialization, gsl::narrow_cast or gsl::narrow (type.1). -#pragma warning(disable: 26485) // Expression '...': No array to pointer decay (bounds.3). -#pragma warning(disable: 26493) // Don't use C-style casts (type.4). -#pragma warning(disable: 26451) // Arithmetic overflow: Using operator '...' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '...' to avoid overflow (io.2). -#pragma warning(disable: 26494) // Variable '...' is uninitialized. Always initialize an object (type.5). -#pragma warning(disable: 26814) // The const variable '...' can be computed at compile-time. Consider using constexpr (con.5). -#pragma warning(disable: 26826) // Don't use C-style variable arguments (f.55). -#pragma warning(disable: 26435) // Function '...' should specify exactly one of '...', '...', or '...' (c.128). -#pragma warning(disable: 26434) // Function '...' hides a non-virtual function '...'. -#pragma warning(disable: 26400) // Do not assign the result of an allocation or a function call with an owner return value to a raw pointer, use owner instead (i.11). -#pragma warning(disable: 26433) // Function '...' should be marked with '...' (c.128). -#pragma warning(disable: 26456) // Operator '...' hides a non-virtual operator '...' (c.128). -#pragma warning(disable: 26465) // Don't use const_cast to cast away const or volatile. const_cast is not required; constness or volatility is not being removed by this conversion (type.3). -#pragma warning(disable: 26408) // Avoid malloc() and free(), prefer the nothrow version of new with delete (r.10). -#pragma warning(disable: 26471) // Don't use reinterpret_cast. A cast from void* can use static_cast (type.1). -#pragma warning(disable: 26490) // Don't use reinterpret_cast (type.1). -#pragma warning(disable: 26460) // The reference argument '...' for function '...' can be marked as const (con.3). -#pragma warning(disable: 26495) // Variable '...' is uninitialized. Always initialize a member variable (type.6). -#pragma warning(disable: 26461) // The pointer argument '...' for function '...' can be marked as a pointer to const (con.3). -#pragma warning(disable: 26436) // The type '...' with a virtual function needs either public virtual or protected non-virtual destructor (c.35). -#pragma warning(disable: 26467) // Converting from floating point to unsigned integral types results in non-portable code if the double/float has a negative value. Use gsl::narrow_cast or gsl::narrow instead to guard against undefined behavior and potential data loss (es.46). -#pragma warning(disable: 26135) // Missing annotation _Acquires_lock_(this->mNative) at function '...'. -#pragma warning(disable: 28159) // Consider using '...' instead of '...'. Reason: Deprecated. Use VerifyVersionInfo* or IsWindows* macros from VersionHelpers. -#pragma warning(disable: 26439) // This kind of function should not throw. Declare it '...' (f.6). -#pragma warning(disable: 26454) // Arithmetic overflow: '...' operation produces a negative unsigned result at compile time (io.5). -#pragma warning(disable: 26492) // Don't use const_cast to cast away const or volatile (type.3). -#pragma warning(disable: 26110) // Caller failing to hold lock '...' before calling function '...'. -#pragma warning(disable: 26459) // You called an STL function '...' with a raw pointer parameter at position '...' that may be unsafe - this relies on the caller to check that the passed values are correct. Consider wrapping your range in a gsl::span and pass as a span iterator (stl.1). -#pragma warning(disable: 26473) // Don't cast between pointer types where the source type and the target type are the same (type.1). -#pragma warning(disable: 26491) // Don't use static_cast downcasts (type.2). -#pragma warning(disable: 26405) // Do not assign to an owner which may be in valid state (r.3). -#pragma warning(disable: 26403) // Reset or explicitly delete an owner pointer '...' (r.3). -#pragma warning(disable: 26489) // Don't dereference a pointer that may be invalid: '...'. '...' may have been invalidated at line 132 (lifetime.1). -#pragma warning(disable: 26486) // Don't pass a pointer that may be invalid to a function. Parameter 0 '...' in call to '...' may be invalid (lifetime.3). -#pragma warning(disable: 26823) // Dereferencing a possibly null pointer '...' (lifetime.1). -#pragma warning(disable: 26487) // Don't return a pointer '...' that may be invalid (lifetime.4). -#pragma warning(disable: 26812) // The enum type '...' is unscoped. Prefer '...' over '...' (Enum.3). -#pragma warning(disable: 26446) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). -#pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). -#pragma warning(disable: 26482) // Only index into arrays using constant expressions (bounds.2). -#pragma warning(disable: 26481) // Don't use pointer arithmetic. Use span instead (bounds.1). - -// Yes, these are our files ... but they don't change very often, and if they do -// change we want to rebuild everything anyway. -#include "gsl/gsl.h" -#include "config/Exports.h" -#include "except/Throwable.h" -#include "sys/Conf.h" -#include "sys/filesystem.h" -#include "mem/SharedPtr.h" - -#include "xml/lite/xerces_.h" -#pragma comment(lib, "xerces-c") - -#include "hdf5/lite/H5_.h" -#pragma comment(lib, "hdf5-c++.lib") - -#endif //CODA_OSS_pch_h_INCLUDED_ +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#pragma once +#ifndef CODA_OSS_pch_h_INCLUDED_ +#define CODA_OSS_pch_h_INCLUDED_ + +#include "coda_oss/CPlusPlus.h" +#include "config/disable_compiler_warnings.h" + +CODA_OSS_disable_warning_system_header_push + +// add headers that you want to pre-compile here +#include "framework.h" + +#define _USE_MATH_DEFINES +#include +#include +#include +#include +#include +#include +#include +#include + +CODA_OSS_disable_warning_pop + +#include "import/std.h" + + +#include +#include +#pragma comment(lib, "z.lib") +#pragma comment(lib, "minizip.lib") + +#include + +#pragma warning(disable: 4251) // '...': class '...' needs to have dll-interface to be used by clients of class '...' +#pragma warning(disable: 4365) // '...': conversion from '...' to '...', signed/unsigned mismatch +#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to '...' function under -EHc. Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 6054) // String '...' might not be zero-terminated. +#pragma warning(disable: 6387) // '...' could be '...'. +#pragma warning(disable: 6305) // Potential mismatch between sizeof and countof quantities. Use sizeof() to scale byte sizes. +#pragma warning(disable: 6389) // Move '...' to anonymous namespace or put a forward declaration in a common header included in this file. +#pragma warning(disable: 5267) // definition of implicit copy constructor for '...' is deprecated because it has a user-provided destructor + +#pragma warning(disable: 26822) // Dereferencing a null pointer '...' (lifetime.1). +#pragma warning(disable: 26432) // If you define or delete any default operation in the type '...', define or delete them all (c.21). +#pragma warning(disable: 26429) // Symbol '...' is never tested for nullness, it can be marked as not_null (f.23). +#pragma warning(disable: 26455) // Default constructor should not throw. Declare it '...' (f.6). +#pragma warning(disable: 26440) // Function '...' can be declared '...' (f.6). +#pragma warning(disable: 26447) // The function is declared '...' but calls function '...' which may throw exceptions (f.6). +#pragma warning(disable: 26496) // The variable '...' does not change after construction, mark it as const (con.4). +#pragma warning(disable: 26462) // The value pointed to by '...' is assigned only once, mark it as a pointer to const (con.4). +#pragma warning(disable: 26409) // Avoid calling new and delete explicitly, use std::make_unique instead (r.11). +#pragma warning(disable: 26401) // Do not delete a raw pointer that is not an owner (i.11). +#pragma warning(disable: 26472) // Don't use a static_cast for arithmetic conversions. Use brace initialization, gsl::narrow_cast or gsl::narrow (type.1). +#pragma warning(disable: 26485) // Expression '...': No array to pointer decay (bounds.3). +#pragma warning(disable: 26493) // Don't use C-style casts (type.4). +#pragma warning(disable: 26451) // Arithmetic overflow: Using operator '...' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '...' to avoid overflow (io.2). +#pragma warning(disable: 26494) // Variable '...' is uninitialized. Always initialize an object (type.5). +#pragma warning(disable: 26814) // The const variable '...' can be computed at compile-time. Consider using constexpr (con.5). +#pragma warning(disable: 26826) // Don't use C-style variable arguments (f.55). +#pragma warning(disable: 26435) // Function '...' should specify exactly one of '...', '...', or '...' (c.128). +#pragma warning(disable: 26434) // Function '...' hides a non-virtual function '...'. +#pragma warning(disable: 26400) // Do not assign the result of an allocation or a function call with an owner return value to a raw pointer, use owner instead (i.11). +#pragma warning(disable: 26433) // Function '...' should be marked with '...' (c.128). +#pragma warning(disable: 26456) // Operator '...' hides a non-virtual operator '...' (c.128). +#pragma warning(disable: 26465) // Don't use const_cast to cast away const or volatile. const_cast is not required; constness or volatility is not being removed by this conversion (type.3). +#pragma warning(disable: 26408) // Avoid malloc() and free(), prefer the nothrow version of new with delete (r.10). +#pragma warning(disable: 26471) // Don't use reinterpret_cast. A cast from void* can use static_cast (type.1). +#pragma warning(disable: 26490) // Don't use reinterpret_cast (type.1). +#pragma warning(disable: 26460) // The reference argument '...' for function '...' can be marked as const (con.3). +#pragma warning(disable: 26495) // Variable '...' is uninitialized. Always initialize a member variable (type.6). +#pragma warning(disable: 26461) // The pointer argument '...' for function '...' can be marked as a pointer to const (con.3). +#pragma warning(disable: 26436) // The type '...' with a virtual function needs either public virtual or protected non-virtual destructor (c.35). +#pragma warning(disable: 26467) // Converting from floating point to unsigned integral types results in non-portable code if the double/float has a negative value. Use gsl::narrow_cast or gsl::narrow instead to guard against undefined behavior and potential data loss (es.46). +#pragma warning(disable: 26135) // Missing annotation _Acquires_lock_(this->mNative) at function '...'. +#pragma warning(disable: 28159) // Consider using '...' instead of '...'. Reason: Deprecated. Use VerifyVersionInfo* or IsWindows* macros from VersionHelpers. +#pragma warning(disable: 26439) // This kind of function should not throw. Declare it '...' (f.6). +#pragma warning(disable: 26454) // Arithmetic overflow: '...' operation produces a negative unsigned result at compile time (io.5). +#pragma warning(disable: 26492) // Don't use const_cast to cast away const or volatile (type.3). +#pragma warning(disable: 26110) // Caller failing to hold lock '...' before calling function '...'. +#pragma warning(disable: 26459) // You called an STL function '...' with a raw pointer parameter at position '...' that may be unsafe - this relies on the caller to check that the passed values are correct. Consider wrapping your range in a gsl::span and pass as a span iterator (stl.1). +#pragma warning(disable: 26473) // Don't cast between pointer types where the source type and the target type are the same (type.1). +#pragma warning(disable: 26491) // Don't use static_cast downcasts (type.2). +#pragma warning(disable: 26405) // Do not assign to an owner which may be in valid state (r.3). +#pragma warning(disable: 26403) // Reset or explicitly delete an owner pointer '...' (r.3). +#pragma warning(disable: 26489) // Don't dereference a pointer that may be invalid: '...'. '...' may have been invalidated at line 132 (lifetime.1). +#pragma warning(disable: 26486) // Don't pass a pointer that may be invalid to a function. Parameter 0 '...' in call to '...' may be invalid (lifetime.3). +#pragma warning(disable: 26823) // Dereferencing a possibly null pointer '...' (lifetime.1). +#pragma warning(disable: 26487) // Don't return a pointer '...' that may be invalid (lifetime.4). +#pragma warning(disable: 26812) // The enum type '...' is unscoped. Prefer '...' over '...' (Enum.3). +#pragma warning(disable: 26446) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). +#pragma warning(disable: 26458) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). +#pragma warning(disable: 26482) // Only index into arrays using constant expressions (bounds.2). +#pragma warning(disable: 26481) // Don't use pointer arithmetic. Use span instead (bounds.1). + +// Yes, these are our files ... but they don't change very often, and if they do +// change we want to rebuild everything anyway. +#include "gsl/gsl.h" +#include "config/Exports.h" +#include "mem/SharedPtr.h" +#include "sys/filesystem.h" +#include "except/Throwable.h" +#include "sys/Conf.h" + +#include "xml/lite/xerces_.h" +#pragma comment(lib, "xerces-c") + +#include "hdf5/lite/H5_.h" +#pragma comment(lib, "hdf5-c++.lib") + +#endif //CODA_OSS_pch_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/plugin/include/plugin/BasicPluginManager.h b/externals/coda-oss/modules/c++/plugin/include/plugin/BasicPluginManager.h index c829446816..6e65ea9eb4 100644 --- a/externals/coda-oss/modules/c++/plugin/include/plugin/BasicPluginManager.h +++ b/externals/coda-oss/modules/c++/plugin/include/plugin/BasicPluginManager.h @@ -278,12 +278,9 @@ template class BasicPluginManager for (unsigned int i = 0; ops[i] != nullptr; i++) oss << ops[i] << ":"; - eh->onPluginVersionUnsupported( - FmtX("For plugin supporting ops %s version [%d.%d] not supported (%d.%d)", - oss.str().c_str(), majorVersion, minorVersion, - mMajorVersion, mMinorVersion - ) - ); + auto unsupported = str::Format("For plugin supporting ops %s version ", oss.str()); + unsupported += str::Format("[%d.%d] not supported (%d.%d)", majorVersion, minorVersion, mMajorVersion, mMinorVersion); + eh->onPluginVersionUnsupported(unsupported); return; } @@ -293,7 +290,7 @@ template class BasicPluginManager if (! pluginHandler ) { eh->onPluginLoadFailed( - FmtX("Failed to spawn handler for op %s", ops[i])); + str::Format("Failed to spawn handler for op %s", ops[i])); // Keep going } mHandlers[ops[i]].first = pluginHandler; diff --git a/externals/coda-oss/modules/c++/polygon/source/PolygonMask.cpp b/externals/coda-oss/modules/c++/polygon/source/PolygonMask.cpp index d9a729feff..6ad904aa2f 100644 --- a/externals/coda-oss/modules/c++/polygon/source/PolygonMask.cpp +++ b/externals/coda-oss/modules/c++/polygon/source/PolygonMask.cpp @@ -134,9 +134,8 @@ PolygonMask::PolygonMask(const std::vector >& points, // happen. std::ostringstream ostr; ostr << "Requires a convex polygon but these points produced " - << intersectionsVec.size() << " intersections for row " - << row; - throw except::Exception(Ctxt(ostr.str())); + << intersectionsVec.size() << " intersections for row " << row; + throw except::Exception(Ctxt(ostr)); } } diff --git a/externals/coda-oss/modules/c++/re/source/RegexPCRE.cpp b/externals/coda-oss/modules/c++/re/source/RegexPCRE.cpp index d70885e3e8..01b0393b3f 100644 --- a/externals/coda-oss/modules/c++/re/source/RegexPCRE.cpp +++ b/externals/coda-oss/modules/c++/re/source/RegexPCRE.cpp @@ -137,7 +137,7 @@ class ScopedMatchData ostr << "Match: Match substring out of range (" << index << ", " << end << ") for string of length " << str.length(); - throw re::RegexException(Ctxt(ostr.str())); + throw re::RegexException(Ctxt(ostr)); } const size_t subStringLength = end - index; @@ -225,7 +225,7 @@ Regex& Regex::compile(const std::string& pattern) std::ostringstream ostr; ostr << "PCRE compilation failed at offset " << errorOffset << ": " << getErrorMessage(errorCode); - throw RegexException(Ctxt(ostr.str())); + throw RegexException(Ctxt(ostr)); } return *this; @@ -330,6 +330,19 @@ void Regex::split(const std::string& str, std::vector& v) } } +inline static void replace(std::string& result, size_t pos, size_t count, const std::string& str) +{ + // https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170 + #if _WIN32 && __SANITIZE_ADDRESS__ && (_MSC_VER <= 1933 /*VS 2022 17.3*/) + // ASAN diagnostic on Windows with replace() ... bug in VS? + const auto input = result; + result = input.substr(0, pos); + result += str; + result += input.substr(pos + count); + #else + result.replace(pos, count, str); + #endif +} std::string Regex::sub(const std::string& str, const std::string& repl) { size_t begin; @@ -339,7 +352,7 @@ std::string Regex::sub(const std::string& str, const std::string& repl) std::string result = search(str, startIndex, 0, begin, end); while (!result.empty()) { - toReplace.replace(begin, result.size(), repl); + replace(toReplace, begin, result.size(), repl); // You can't skip ahead result.size() here because 'repl' may be shorter // than 'result' diff --git a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileWriter.h b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileWriter.h index 8d75266d52..72a895b00c 100644 --- a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileWriter.h +++ b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/SioFileWriter.h @@ -173,7 +173,7 @@ template void writeSIO(const T* image, size_t rows, size_t cols, et = FileHeader::UNSIGNED; break; default: - throw except::Exception(Ctxt(FmtX("Unexpected es: %d", es))); + throw except::Exception(Ctxt(str::Format("Unexpected es: %d", es))); } } diff --git a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/UserDataDictionary.h b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/UserDataDictionary.h index 627c975f81..00aae905b2 100644 --- a/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/UserDataDictionary.h +++ b/externals/coda-oss/modules/c++/sio.lite/include/sio/lite/UserDataDictionary.h @@ -77,6 +77,7 @@ class OrderedDictionary } virtual size_t size() const { return mList.size(); } + virtual bool empty() const { return mList.empty(); } virtual void add(Key_T key, const Value_T& value) { diff --git a/externals/coda-oss/modules/c++/sio.lite/source/FileHeader.cpp b/externals/coda-oss/modules/c++/sio.lite/source/FileHeader.cpp index 8a7c8a40fc..619f8af72b 100644 --- a/externals/coda-oss/modules/c++/sio.lite/source/FileHeader.cpp +++ b/externals/coda-oss/modules/c++/sio.lite/source/FileHeader.cpp @@ -65,7 +65,7 @@ long sio::lite::FileHeader::getLength() const { size_t length = SIO_HEADER_LENGTH; - if (userData.size() > 0) + if (!userData.empty()) length += 4; //num fields int for (sio::lite::UserDataDictionary::ConstIterator it = userData.begin(); it != userData.end(); ++it) @@ -158,7 +158,7 @@ void sio::lite::FileHeader::to(size_t numBands, io::OutputStream& os) void sio::lite::FileHeader::writeUserData(io::OutputStream& os) { - const auto numFields = static_cast(userData.size()); + const auto numFields = gsl::narrow(userData.size()); os.write((const sys::byte*)&numFields, 4); for(sio::lite::UserDataDictionary::Iterator it = userData.begin(); @@ -171,7 +171,7 @@ void sio::lite::FileHeader::writeUserData(io::OutputStream& os) os.write((const sys::byte*)key.c_str(), keySize); std::vector& uData = it->second; - const auto udSize = static_cast(uData.size()); + const auto udSize = gsl::narrow(uData.size()); os.write((const sys::byte*)&udSize, 4); //Do we need to check for endian-ness and possibly byteswap??? diff --git a/externals/coda-oss/modules/c++/std/include/import/std.h b/externals/coda-oss/modules/c++/std/include/import/std.h index 4dee10481c..32702da30d 100644 --- a/externals/coda-oss/modules/c++/std/include/import/std.h +++ b/externals/coda-oss/modules/c++/std/include/import/std.h @@ -22,9 +22,9 @@ */ +#pragma once #ifndef CODA_OSS_import_std_h_INCLUDED_ #define CODA_OSS_import_std_h_INCLUDED_ -#pragma once #include "coda_oss/CPlusPlus.h" #include "config/disable_compiler_warnings.h" @@ -51,6 +51,7 @@ CODA_OSS_disable_warning_system_header_push #include #include #include +#include #include #include @@ -91,6 +92,7 @@ CODA_OSS_disable_warning_system_header_push #include #include #include +#include //#include #include diff --git a/externals/coda-oss/modules/c++/std/include/std/optional b/externals/coda-oss/modules/c++/std/include/std/optional index e4a47e6fc3..ffbcbca002 100644 --- a/externals/coda-oss/modules/c++/std/include/std/optional +++ b/externals/coda-oss/modules/c++/std/include/std/optional @@ -18,18 +18,16 @@ * License along with this program; If not, http://www.gnu.org/licenses/. * */ +#pragma once #ifndef CODA_OSS_std_optional_INCLUDED_ #define CODA_OSS_std_optional_INCLUDED_ -#pragma once #include "coda_oss/optional.h" -#include "coda_oss/CPlusPlus.h" // Make it (too?) easy for clients to get our various std:: implementations #ifndef CODA_OSS_NO_std_optional - #if CODA_OSS_cpp17 - #include - #define CODA_OSS_NO_std_optional 1 // part of C++17 + #if CODA_OSS_HAVE_std_optional_ // set in coda_oss/optional.h + #define CODA_OSS_NO_std_optional 1 // no need to muck with `std` #else #define CODA_OSS_NO_std_optional 0 // use our own #endif @@ -41,6 +39,10 @@ namespace std // This is slightly uncouth: we're not supposed to augment "std". using coda_oss::optional; using coda_oss::make_optional; } +#ifndef __cpp_lib_optional +#define __cpp_lib_optional 201606L // https://en.cppreference.com/w/cpp/feature_test +#endif + #endif // !CODA_OSS_NO_std_optional #endif // CODA_OSS_std_optional_INCLUDED_ \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/std/include/std/span b/externals/coda-oss/modules/c++/std/include/std/span index 819befe157..6eb29377b2 100644 --- a/externals/coda-oss/modules/c++/std/include/std/span +++ b/externals/coda-oss/modules/c++/std/include/std/span @@ -18,18 +18,17 @@ * License along with this program; If not, http://www.gnu.org/licenses/. * */ +#pragma once #ifndef CODA_OSS_std_span_INCLUDED_ #define CODA_OSS_std_span_INCLUDED_ -#pragma once #include "coda_oss/span.h" #include "coda_oss/CPlusPlus.h" // Make it (too?) easy for clients to get our various std:: implementations #ifndef CODA_OSS_NO_std_span - #if CODA_OSS_cpp20 - #include - #define CODA_OSS_NO_std_span 1 // part of C++20 + #if CODA_OSS_HAVE_std_span_ // set in coda_oss/span.h + #define CODA_OSS_NO_std_span 1 // no need to muck with `std` #else #define CODA_OSS_NO_std_span 0 // use our own #endif @@ -43,6 +42,56 @@ namespace std // This is slightly uncouth: we're not supposed to augment "std". using coda_oss::as_bytes; using coda_oss::as_writable_bytes; } -#endif // CODA_OSS_DEFINE_std_span_ +#ifndef __cpp_lib_span +#define __cpp_lib_span 202002L // https://en.cppreference.com/w/cpp/feature_test +#endif + +#endif // CODA_OSS_NO_std_span + +// Make it (too?) easy for clients to get our various std:: implementations +#ifndef CODA_OSS_NO_nonmember_container_access + // https://en.cppreference.com/w/cpp/feature_test#cpp_lib_nonmember_container_access + #if defined(__cpp_lib_nonmember_container_access) && (__cpp_lib_nonmember_container_access >= 201411L) + #define CODA_OSS_NO_nonmember_container_access 1 // no need to muck with `std` + #else + // It seems MSVC has this even at C++14, see + // https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170 + #if _MSC_VER >= 1900 // Visual Studio 2015 (14.0) + #define CODA_OSS_NO_nonmember_container_access 1 // no need to muck with `std` + #else + #define CODA_OSS_NO_nonmember_container_access 0 // use our own + #endif + #endif +#endif + +#if !CODA_OSS_NO_nonmember_container_access +namespace std // This is slightly uncouth: we're not supposed to augment "std". +{ + using coda_oss::size; +} +#ifndef __cpp_lib_nonmember_container_access +#define __cpp_lib_nonmember_container_access 201411L // https://en.cppreference.com/w/cpp/feature_test +#endif +#endif // CODA_OSS_NO_nonmember_container_access + +// Make it (too?) easy for clients to get our various std:: implementations +#ifndef CODA_OSS_NO_std_ssize + // https://en.cppreference.com/w/cpp/feature_test#cpp_lib_ssize + #if defined(__cpp_lib_ssize) && (__cpp_lib_ssize >= 201902L) + #define CODA_OSS_NO_std_ssize 1 // no need to muck with `std` + #else + #define CODA_OSS_NO_std_ssize 0 // use our own + #endif +#endif + +#if !CODA_OSS_NO_std_ssize +namespace std // This is slightly uncouth: we're not supposed to augment "std". +{ + using coda_oss::ssize; +} +#ifndef __cpp_lib_ssize +#define __cpp_lib_ssize 201902L // https://en.cppreference.com/w/cpp/feature_test +#endif +#endif // CODA_OSS_NO_std_ssize #endif // CODA_OSS_std_span_INCLUDED_ \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/std/include/std/string b/externals/coda-oss/modules/c++/std/include/std/string index e740a42f28..f73c1c16d4 100644 --- a/externals/coda-oss/modules/c++/std/include/std/string +++ b/externals/coda-oss/modules/c++/std/include/std/string @@ -18,18 +18,17 @@ * License along with this program; If not, http://www.gnu.org/licenses/. * */ +#pragma once #ifndef CODA_OSS_std_string_INCLUDED_ #define CODA_OSS_std_string_INCLUDED_ -#pragma once #include #include "coda_oss/string.h" -#include "coda_oss/CPlusPlus.h" // Make it (too?) easy for clients to get our various std:: implementations #ifndef CODA_OSS_NO_std_u8string - #if CODA_OSS_cpp20 - #define CODA_OSS_NO_std_u8string 1 // part of C++20 + #if CODA_OSS_HAVE_std_u8string_ // set in coda_oss/string.h + #define CODA_OSS_NO_std_u8string 1 // no need to muck with `std` #else #define CODA_OSS_NO_std_u8string 0 // use our own #endif diff --git a/externals/coda-oss/modules/c++/std/include/std/type_traits b/externals/coda-oss/modules/c++/std/include/std/type_traits index 1aba653f96..cbcd0bfd8a 100644 --- a/externals/coda-oss/modules/c++/std/include/std/type_traits +++ b/externals/coda-oss/modules/c++/std/include/std/type_traits @@ -18,30 +18,11 @@ * License along with this program; If not, http://www.gnu.org/licenses/. * */ +#pragma once #ifndef CODA_OSS_std_type_traits_INCLUDED_ #define CODA_OSS_std_type_traits_INCLUDED_ -#pragma once #include -#include "coda_oss/type_traits.h" - -// Make it (too?) easy for clients to get our various std:: implementations -#ifndef CODA_OSS_NO_is_trivially_copyable - // https://stackoverflow.com/a/31798726/8877 - // workaround missing "is_trivially_copyable" in g++ < 5.0 - #if defined(__GNUC__) && (__GNUC__ < 5) - #define CODA_OSS_NO_is_trivially_copyable 0 // *need* our own - #else - #define CODA_OSS_NO_is_trivially_copyable 1 // *disabled*, unless explicitly enabled - #endif -#endif - -#if !CODA_OSS_NO_is_trivially_copyable -namespace std // This is slightly uncouth: we're not supposed to augment "std". -{ - using coda_oss::is_trivially_copyable; -} -#endif // CODA_OSS_NO_is_trivially_copyable #endif // CODA_OSS_std_type_traits_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/str/include/str/Convert.h b/externals/coda-oss/modules/c++/str/include/str/Convert.h index 0b3698e49f..cbcbcf0e15 100644 --- a/externals/coda-oss/modules/c++/str/include/str/Convert.h +++ b/externals/coda-oss/modules/c++/str/include/str/Convert.h @@ -25,6 +25,7 @@ #define CODA_OSS_str_Convert_h_INCLUDED_ #include +#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include "config/Exports.h" #include "coda_oss/string.h" @@ -41,6 +41,8 @@ #include "coda_oss/cstddef.h" #include "types/Complex.h" #include "import/except.h" +#include "gsl/gsl.h" +#include "str/Encoding.h" namespace str { @@ -50,123 +52,70 @@ template int getPrecision(const std::complex&); template int getPrecision(const types::ComplexInteger&); #endif -namespace details +// Note that std::to_string() doesn't necessarily generate the same output as writing +// to std::cout; see https://en.cppreference.com/w/cpp/string/basic_string/to_string +template +std::string toString_(const T& value) { - // Templating (and then specializing) toString() creates all kinds of weird name-look - // problems; avoid trying to work-around all that by just not doing it. - // - // The preferred approach is to make a a toString() free function. - template - inline std::string default_toString(const T& value) - { - // Use operator<<() to generate a string value; this may not be quite - // 100% kosher, but it's been long-standing practice in this codebase. - // - // Note that std::to_string() doesn't necessarily generate the same - // output as writing to std::cout; see - // https://en.cppreference.com/w/cpp/string/basic_string/to_string - std::ostringstream buf; - buf.precision(getPrecision(value)); - buf << std::boolalpha << value; - return buf.str(); - } - - // https://stackoverflow.com/a/73594999/19912380 - template struct priority : priority {}; - template<> struct priority<0> {}; - - template - inline auto toString_imp(const T& obj, priority<2>) -> decltype(obj.toString(), std::string()) - { - return obj.toString(); // member-function - } - - template - inline auto toString_imp(const T& obj, priority<1>) -> decltype(toString(obj), std::string()) - { - return toString(obj); // free function - } - - template - inline auto toString_imp(const T& obj, priority<0>) -> decltype(default_toString(obj), std::string()) - { - return details::default_toString(obj); // our default utility which uses operator<<() - } - - // In order, try to call 1) obj.toString() (highest priority), 2) toString(obj), - // and finally 3) toString_(obj) (lowest priority). - template - inline auto toString_(const T& obj) -> decltype(toString_imp(obj, priority<2>{}), std::string()) - { - return details::toString_imp(obj, priority<2>{}); - } + std::ostringstream buf; + buf.precision(getPrecision(value)); + buf << std::boolalpha << value; + return buf.str(); } template -inline std::string toString(const T& value) // no dectype() noise here, leave that in details::toString_() +inline std::string toString(const T& value) { - // This breaks the Windows-CMake build on GitHub (when building as an "external" in NITRO) - // ... different compilers or compile-options? - //return details::toString_(value); - - return details::default_toString(value); + return toString_(value); } -// C++11 has a bunch of overloads, do the same. // https://en.cppreference.com/w/cpp/string/basic_string/to_string -inline std::string toString(int value) +inline auto toString(int value) { - return details::default_toString(value); + return toString_(value); } -inline std::string toString(long value) +inline auto toString(long value) { - return details::default_toString(value); + return toString_(value); } -inline std::string toString(long long value) +inline auto toString(long long value) { - return details::default_toString(value); + return toString_(value); } -inline std::string toString(unsigned value) +inline auto toString(unsigned value) { - return details::default_toString(value); + return toString_(value); } -inline std::string toString(unsigned long value) +inline auto toString(unsigned long value) { - return details::default_toString(value); + return toString_(value); } -inline std::string toString(unsigned long long value) +inline auto toString(unsigned long long value) { - return details::default_toString(value); + return toString_(value); } -inline std::string toString(float value) +inline auto toString(float value) { - return details::default_toString(value); + return toString_(value); } -inline std::string toString(double value) +inline auto toString(double value) { - return details::default_toString(value); + return toString_(value); } -inline std::string oString(long double value) +inline auto toString(long double value) { - return details::default_toString(value); -} - -// C++ doesn't have these ... -// https://en.cppreference.com/w/cpp/string/basic_string/to_string -inline std::string toString(bool value) -{ - return details::default_toString(value); + return toString_(value); } inline std::string toString(uint8_t value) { - return toString(static_cast(value)); + return toString(gsl::narrow(value)); } inline std::string toString(int8_t value) { - return toString(static_cast(value)); + return toString(gsl::narrow(value)); } inline std::string toString(coda_oss::byte value) { - return toString(static_cast(value)); + return toString(gsl::narrow(value)); } inline std::string toString(std::nullptr_t) @@ -174,37 +123,48 @@ inline std::string toString(std::nullptr_t) return ""; } -CODA_OSS_API std::string toString(const coda_oss::u8string&); inline std::string toString(const std::string& value) { return value; } -inline std::string toString(char value) +// Prevent the template above from getting used; instead, use routines from **Encoding.h**. +std::string toString(const std::wstring&) = delete; +std::string toString(const std::u16string&) = delete; +std::string toString(const std::u32string&) = delete; +std::string toString(const coda_oss::u8string&) = delete; +std::string toString(const str::W1252string&) = delete; + +inline std::string toString(std::string::const_pointer pStr) { - return std::string(1, value); + return toString(std::string(pStr)); } -inline std::string toString(const char* pStr) +// can't be a template; `bool` overload above is a better match +std::string toString(std::wstring::const_pointer) = delete; // only used in unittests +std::string toString(std::u16string::const_pointer) = delete; // only used in unittests +std::string toString(std::u32string::const_pointer) = delete; // only used in unittests + +inline std::ostream& operator<<(std::ostream& os, const coda_oss::u8string& s) { - return std::string(pStr); + os << to_native(s); + return os; } -template -inline std::string toString(const coda_oss::optional& value) +inline std::string toString(char value) { - // TODO: handle empty/NULL optional? - return details::default_toString(value.value()); + return std::string(1, value); } template -inline std::string toString(const T& real, const T& imag) +inline std::string toString(const coda_oss::optional& value) { - return details::default_toString(std::complex(real, imag)); + // TODO: handle empty/NULL optional? + return toString(value.value()); } -template -inline std::string toString(const T* ptr) +template +inline std::string toString(const T& real, const T& imag) { - return details::default_toString(ptr); + return toString(std::complex(real, imag)); } template diff --git a/externals/coda-oss/modules/c++/str/include/str/EncodedString.h b/externals/coda-oss/modules/c++/str/include/str/EncodedString.h deleted file mode 100644 index d4377c7f3b..0000000000 --- a/externals/coda-oss/modules/c++/str/include/str/EncodedString.h +++ /dev/null @@ -1,171 +0,0 @@ -/* ========================================================================= - * This file is part of str-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * str-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#ifndef CODA_OSS_str_EncodedString_h_INCLLUDED_ -#define CODA_OSS_str_EncodedString_h_INCLLUDED_ -#pragma once - -#include -#include - -#include "config/Exports.h" - #include "str/EncodedStringView.h" - -/*! - * \file EncodedString.h - * \brief A String that can be either UTF-8 or "native" (Windows-1252). - * Unlike EncodedStringView, this hangs onto the underlying string. - * - * On Linux, there is good support for UTF-8, so a std::string encoded - * as UTF-8 will display the "foreign" characters properly. On Windows, - * the preferred way to do that is by using UTF-16 (WCHAR, std::wstring), - * but little (none?) of our existing code bases do that. (On Linux, std::wstring - * is typically UTF-32.) - * - */ - -namespace str -{ -class CODA_OSS_API EncodedString final -{ - std::string s_; - // We can do most everything through the view, so keep one around. - EncodedStringView v_; - - // No "public" operator=() for these; this class is mostly for storage and/or conversion, - // not extensive manipulation. Create a new instance and assign/move that. - -public: - EncodedString(); - ~EncodedString() = default; - EncodedString(const EncodedString&); - EncodedString& operator=(const EncodedString&); - EncodedString(EncodedString&&); - EncodedString& operator=(EncodedString&&); - - EncodedString(coda_oss::u8string::const_pointer, coda_oss::u8string::size_type); - explicit EncodedString(coda_oss::u8string::const_pointer); - explicit EncodedString(const coda_oss::u8string& s); - - EncodedString(str::W1252string::const_pointer, str::W1252string::size_type); - explicit EncodedString(str::W1252string::const_pointer); - explicit EncodedString(const str::W1252string&); - - EncodedString(std::string::const_pointer, std::string::size_type); - explicit EncodedString(std::string::const_pointer); // Assume platform native encoding: UTF-8 on Linux, Windows-1252 on Windows - explicit EncodedString(const std::string&); // Assume platform native encoding: UTF-8 on Linux, Windows-1252 on Windows - - explicit EncodedString(const std::u16string&); // converted to UTF-8 for storage - explicit EncodedString(const std::u32string&); // converted to UTF-8 for storage - explicit EncodedString(const std::wstring&); // Assume platform native encoding: UTF-32 on Linux, UTF-16 on Windows - explicit EncodedString(std::wstring::const_pointer); // can call wcslen() - - // create from a view - EncodedString(const EncodedStringView&); - EncodedString& operator=(const EncodedStringView&); - - // Input is encoded as specified on all platforms. - //static EncodedString fromUtf16(const std::wstring&); // not currently implemetned, no need - //static EncodedString fromUtf32(const std::wstring&); // not currently implemetned, no need - - // For "complex" operatations, use the view. - const EncodedStringView& view() const - { - return v_; - } - - // Regardless of what string we're looking at, return a string in platform - // native encoding: UTF-8 on Linux, Windows-1252 on Windows; this - // might result in string conversion. - std::string native() const // c.f. std::filesystem::path::native() - { - return view().native(); - } - - // Convert (perhaps) whatever we're looking at to UTF-8 - coda_oss::u8string u8string() const // c.f. std::filesystem::path::u8string() - { - return view().u8string(); - } - //std::string& toUtf8(std::string&) const; // std::string is encoded as UTF-8, always. - //str::W1252string w1252string() const; // c.f. std::filesystem::path::u8string() - - // Convert whatever we're looking at to UTF-16 or UTF-32 - std::u16string u16string() const // c.f. std::filesystem::path::u8string() - { - return view().u16string(); - } - std::u32string u32string() const // c.f. std::filesystem::path::u8string() - { - return view().u32string(); - } - std::wstring wstring() const // UTF-16 on Windows, UTF-32 on Linux - { - return view().wstring(); - } - - bool empty() const - { - return s_.empty(); - } - - struct details final - { - static const std::string& string(const EncodedString& es) // for unit-testing - { - return es.s_; - } - }; -}; - -inline bool operator==(const EncodedString& lhs, const EncodedStringView& rhs) -{ - return lhs.view() == rhs; -} -inline bool operator!=(const EncodedString& lhs, const EncodedStringView& rhs) -{ - return !(lhs == rhs); -} - -inline bool operator==(const EncodedString& lhs, const EncodedString& rhs) -{ - return lhs == rhs.view(); -} -inline bool operator!=(const EncodedString& lhs, const EncodedString& rhs) -{ - return !(lhs == rhs); -} - -inline std::string toString(const EncodedString& es) -{ - return es.native(); -} - -inline std::ostream& operator<<(std::ostream& os, const EncodedString& es) -{ - os << toString(es); - return os; -} - -} -#endif // CODA_OSS_str_EncodedString_h_INCLLUDED_ diff --git a/externals/coda-oss/modules/c++/str/include/str/EncodedStringView.h b/externals/coda-oss/modules/c++/str/include/str/EncodedStringView.h deleted file mode 100644 index 1fd1e99ac5..0000000000 --- a/externals/coda-oss/modules/c++/str/include/str/EncodedStringView.h +++ /dev/null @@ -1,204 +0,0 @@ -/* ========================================================================= - * This file is part of str-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * xml.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#ifndef CODA_OSS_str_EncodedStringView_h_INCLLUDED_ -#define CODA_OSS_str_EncodedStringView_h_INCLLUDED_ -#pragma once - -#include -#include - -#include "coda_oss/span.h" -#include "config/Exports.h" - #include "str/Encoding.h" - -/*! - * \file EncodedStringView.h - * \brief A read-only "view" onto a string. - * - * On Linux, there is good support for UTF-8, so a std::string encoded - * as UTF-8 will display the "foreign" characters properly. On Windows, - * the preferred way to do that is by using UTF-16 (WCHAR, std::wstring), - * but little (none?) of our existing code bases do that. (On Linux, std::wstring - * is typically UTF-32.) - * - */ - -namespace str -{ -class EncodedString; // forward -class CODA_OSS_API EncodedStringView final -{ - // Since we only support two encodings--UTF-8 (native on Linux) and Windows-1252 - // (native on Windows)--both of which are 8-bits, a simple "bool" flag will do. - coda_oss::span mString; - explicit EncodedStringView(coda_oss::span); - explicit EncodedStringView(coda_oss::span); - - #ifdef _WIN32 - static constexpr bool mNativeIsUtf8 = false; // Windows-1252 - #else - static constexpr bool mNativeIsUtf8 = true; // !_WIN32, assume Linux - #endif - bool mIsUtf8 = mNativeIsUtf8; - - // Want to create an EncodedString from EncodedStringView. The public interface - // doesn't expose "mIsUtf8" so there's (intentinally) no way for clients to know the encoding. - friend EncodedString; - - str::W1252string w1252string() const; // c.f. std::filesystem::path::u8string() - -public: - EncodedStringView() = default; - ~EncodedStringView() = default; - EncodedStringView(const EncodedStringView&) = default; - EncodedStringView& operator=(const EncodedStringView&) = default; - EncodedStringView(EncodedStringView&&) = default; - EncodedStringView& operator=(EncodedStringView&&) = default; - - // Need the const char* overloads to avoid creating temporary std::basic_string<> instances. - // Routnes always return a copy, never a reference, so there's no additional overhead - // with storing a raw pointer rather than a pointer to std::basic_string<>. - EncodedStringView(coda_oss::u8string::const_pointer, coda_oss::u8string::size_type); - explicit EncodedStringView(coda_oss::u8string::const_pointer); - explicit EncodedStringView(const coda_oss::u8string&); - - EncodedStringView(str::W1252string::const_pointer, str::W1252string::size_type); - explicit EncodedStringView(str::W1252string::const_pointer); - explicit EncodedStringView(const str::W1252string&); - - EncodedStringView(std::string::const_pointer, std::string::size_type); - explicit EncodedStringView(std::string::const_pointer); // Assume platform native encoding: UTF-8 on Linux, Windows-1252 on Windows - explicit EncodedStringView(const std::string&); // Assume platform native encoding: UTF-8 on Linux, Windows-1252 on Windows - - // Can't "view" UTF-16 or UTF-32 data; we assume we're looking at an 8-bit encoding, - // either UTF-8 or Windows-1252. - - // Regardless of what string we're looking at, return a string in platform - // native encoding: UTF-8 on Linux, Windows-1252 on Windows; this - // might result in string conversion. - std::string native() const; // c.f. std::filesystem::path::native() - - // Convert (perhaps) whatever we're looking at to UTF-8 - coda_oss::u8string u8string() const; // c.f. std::filesystem::path::u8string() - - // Convert whatever we're looking at to UTF-16 or UTF-32 - std::u16string u16string() const; // c.f. std::filesystem::path::u8string() - std::u32string u32string() const; // c.f. std::filesystem::path::u8string() - // This is especially useful on Windows because the default for characters - // is WCHAR (char* is converted to UTF-16). - std::wstring wstring() const; // UTF-16 on Windows, UTF-32 on Linux - - // These are for "advanced" use, most "normal" code should use the routines above. - std::string::const_pointer c_str() const noexcept - { - return mString.data(); - } - coda_oss::u8string::const_pointer c_u8str() const - { - return mIsUtf8 ? cast(c_str()) : nullptr; - } - str::W1252string::const_pointer c_w1252str() const - { - return mIsUtf8 ? nullptr : cast(c_str()); - } - size_t size() const noexcept - { - return mString.size(); - } - - // Input is encoded as specified on all platforms. - static EncodedStringView fromUtf8(const std::string& utf8) - { - return EncodedStringView(str::c_str(utf8), utf8.length()); - } - static EncodedStringView fromUtf8(std::string::const_pointer pUtf8) - { - return EncodedStringView(str::cast(pUtf8)); - } - static EncodedStringView fromWindows1252(const std::string& w1252) - { - return EncodedStringView(str::c_str(w1252), w1252.length()); - } - static EncodedStringView fromWindows1252(std::string::const_pointer pW1252) - { - return EncodedStringView(str::cast(pW1252)); - } - - std::string asUtf8() const; - std::string asWindows1252() const; - - bool operator_eq(const EncodedStringView&) const; - - struct details final - { - // Convert (perhaps) whatever we're looking at to Windows-1252 - // Intended for unit-testing; normal use is native(). - static str::W1252string w1252string(const EncodedStringView& v) - { - return v.w1252string(); - } - }; -}; - -inline bool operator==(const EncodedStringView& lhs, const EncodedStringView& rhs) -{ - return lhs.operator_eq(rhs); -} -inline bool operator!=(const EncodedStringView& lhs, const EncodedStringView& rhs) -{ - return !(lhs == rhs); -} - -// Since we'd really like to "traffic" in UTF-8 strings (at least when encoding is a consideration) -// make that comparision easy. -inline bool operator==(const EncodedStringView& lhs, const coda_oss::u8string& rhs) -{ - return lhs == EncodedStringView(rhs); -} -inline bool operator!=(const EncodedStringView& lhs, const coda_oss::u8string& rhs) -{ - return !(lhs == rhs); -} -inline bool operator==(const coda_oss::u8string& lhs, const EncodedStringView& rhs) -{ - return rhs == lhs; -} -inline bool operator!=(const coda_oss::u8string& lhs, const EncodedStringView& rhs) -{ - return !(lhs == rhs); -} - -inline std::string toString(const EncodedStringView& esv) -{ - return esv.native(); -} - -inline std::ostream& operator<<(std::ostream& os, const EncodedStringView& esv) -{ - os << toString(esv); - return os; -} - -} -#endif // CODA_OSS_str_EncodedStringView_h_INCLLUDED_ diff --git a/externals/coda-oss/modules/c++/str/include/str/Encoding.h b/externals/coda-oss/modules/c++/str/include/str/Encoding.h index 0147306ecf..4dbaa76f57 100644 --- a/externals/coda-oss/modules/c++/str/include/str/Encoding.h +++ b/externals/coda-oss/modules/c++/str/include/str/Encoding.h @@ -21,9 +21,9 @@ * */ +#pragma once #ifndef CODA_OSS_str_Encoding_h_INCLUDED_ #define CODA_OSS_str_Encoding_h_INCLUDED_ -#pragma once #include #include @@ -36,76 +36,178 @@ #include "coda_oss/string.h" #include "gsl/gsl.h" #include "config/Exports.h" +#include "str/W1252string.h" namespace str { +namespace details +{ template -inline TReturn cast(const TChar* s) +inline auto cast(const TChar* s) { // This is OK as UTF-8 can be stored in std::string // Note that casting between the string types will CRASH on some - // implementations. NO: reinterpret_cast(value) + // implementations. NO: reinterpret_cast(value). + // Instead, use c_str() or str(), below. const void* const pStr = s; auto const retval = static_cast(pStr); static_assert(sizeof(*retval) == sizeof(*s), "sizeof(*TReturn) != sizeof(*TChar)"); return retval; } +} template -inline typename TBasicStringT::const_pointer c_str(const std::basic_string& s) +inline auto c_str(const std::basic_string& s) { using return_t = typename TBasicStringT::const_pointer; - return cast(s.c_str()); + return details::cast(s.c_str()); +} +template +inline auto str(const std::basic_string& s) +{ + return TBasicStringT(c_str(s), s.length()); // avoid extra strlen() call +} +template +inline TBasicStringT make_string(TChar* p) +{ + using const_pointer = typename TBasicStringT::const_pointer; + return details::cast(p); // copy into RV } -// This is to make it difficult to get encodings mixed up; it's here (in a .h -// file) as we want to unit-test it. Windows1252_T for Windows-1252 characters -enum class Windows1252_T : unsigned char { }; // https://en.cppreference.com/w/cpp/language/types -using W1252string = std::basic_string; // https://en.cppreference.com/w/cpp/string - -////////////////////////////////////////////////////////////////////////////////////////// - -// We'll get strange errors, possibibly at link-time, if wchar_t is not a wchar_t type. -// MSVC has an option to control this: https://docs.microsoft.com/en-us/cpp/build/reference/zc-wchar-t-wchar-t-is-native-type -// https://en.cppreference.com/w/cpp/language/types -// "It has the same size, signedness, and alignment as one of the integer types, but is a distinct type." -static_assert(!std::is_same::value, "wchar_t should not be the same as uint16_t"); -static_assert(!std::is_same::value, "wchar_t should not be the same as int16_t"); -static_assert(!std::is_same::value, "wchar_t should not be the same as uint32_t"); -static_assert(!std::is_same::value, "wchar_t should not be the same as int32_t"); - +/************************************************************************/ // When the encoding is important, we want to "traffic" in coda_oss::u8string (UTF-8), not // str::W1252string (Windows-1252) or std::string (unknown). Make it easy to get those from other encodings. CODA_OSS_API coda_oss::u8string to_u8string(str::W1252string::const_pointer, size_t); -inline coda_oss::u8string to_u8string(coda_oss::u8string::const_pointer s, size_t sz) +CODA_OSS_API coda_oss::u8string to_u8string(std::u16string::const_pointer, size_t); +CODA_OSS_API coda_oss::u8string to_u8string(std::u32string::const_pointer, size_t); +inline coda_oss::u8string to_u8string(coda_oss::u8string::const_pointer p, size_t sz) { - return coda_oss::u8string(s, sz); + return coda_oss::u8string(p, sz); +} +// Explicit overloads so template can be used for a different purpose. +inline auto to_u8string(const coda_oss::u8string& s) +{ + return to_u8string(s.c_str(), s.length()); +} +inline auto to_u8string(const str::W1252string& s) +{ + return to_u8string(s.c_str(), s.length()); +} +inline auto to_u8string(const std::u16string& s) +{ + return to_u8string(s.c_str(), s.length()); +} +inline auto to_u8string(const std::u32string& s) +{ + return to_u8string(s.c_str(), s.length()); +} +// These two routines are "dangerous" as they make it easy to convert +// a `char*` **already** in UTF-8 encoding to UTF-8; the result is garbage. +// Use u8FromNative() or u8FromNative() which is a bit more explicit. +coda_oss::u8string to_u8string(std::string::const_pointer, size_t) = delete; +coda_oss::u8string to_u8string(std::wstring::const_pointer, size_t) = delete; + +// Template parameter specifies how `std::string` is encoded. As opposed +// to figuring it out a run-time based on the platform. +template +inline auto to_u8string(const std::string& s) // UTF-8 or Windows-1252 +{ + return to_u8string(str::c_str(s), s.length()); +} +template +inline auto to_u8string(const std::wstring& s) // UTF-16 or UTF-32 +{ + return to_u8string(str::c_str(s), s.length()); } -// UTF-16 is typically uses on Windows (where it is std::wstring::value_type); Linux prefers UTF-32. -CODA_OSS_API coda_oss::u8string to_u8string(std::u16string::const_pointer, size_t); - +/************************************************************************/ +// UTF-16 is the default on Windows. CODA_OSS_API std::u16string to_u16string(coda_oss::u8string::const_pointer, size_t); -std::u16string to_u16string(str::W1252string::const_pointer, size_t); +CODA_OSS_API std::u16string to_u16string(str::W1252string::const_pointer, size_t); +inline auto to_u16string(const coda_oss::u8string& s) +{ + return to_u16string(s.c_str(), s.length()); +} +inline auto to_u16string(const str::W1252string& s) +{ + return to_u16string(s.c_str(), s.length()); +} +/************************************************************************/ // UTF-32 is convenient because each code-point is a single 32-bit integer. // It's typically std::wstring::value_type on Linux, but NOT Windows. -CODA_OSS_API coda_oss::u8string to_u8string(std::u32string::const_pointer, size_t); CODA_OSS_API std::u32string to_u32string(coda_oss::u8string::const_pointer, size_t); -std::u32string to_u32string(str::W1252string::const_pointer, size_t); - -template -inline coda_oss::u8string to_u8string(const std::basic_string& s) +CODA_OSS_API std::u32string to_u32string(str::W1252string::const_pointer, size_t); +inline auto to_u32string(const coda_oss::u8string& s) +{ + return to_u32string(s.c_str(), s.length()); +} +inline auto to_u32string(const str::W1252string& s) { - return to_u8string(s.c_str(), s.size()); + return to_u32string(s.c_str(), s.length()); } +/************************************************************************/ +// Windows-1252 (almost the same as ISO8859-1) is the default single-byte encoding on Windows. CODA_OSS_API str::W1252string to_w1252string(coda_oss::u8string::const_pointer p, size_t sz); +inline auto to_w1252string(const coda_oss::u8string& s) +{ + return to_w1252string(s.c_str(), s.length()); +} + +/************************************************************************/ + +inline auto u8FromNative(const std::string& s) // platform determines Windows-1252 or UTF-8 input +{ + #if _WIN32 + const auto p = str::c_str(s); // std::string is Windows-1252 on Windows + #else + const auto p = str::c_str(s); // assume std::string is UTF-8 on any non-Windows platform + #endif + return str::to_u8string(p, s.length()); +} -namespace details // YOU should use EncodedStringView +namespace details { -void w1252to8(str::W1252string::const_pointer p, size_t sz, std::string&); // encoding is lost -void utf8to1252(coda_oss::u8string::const_pointer p, size_t sz, std::string&); // encoding is lost +inline auto c_str(const std::wstring& s) +{ + #if _WIN32 + return str::c_str(s); // std::wstring is UTF-16 on Windows + #else + return str::c_str(s); // assume std::wstring is UTF-32 on any non-Windows platform + #endif +} +} +inline auto u8FromNative(const std::wstring& s) // platform determines UTF16 or UTF-32 input +{ + return str::to_u8string(details::c_str(s), s.length()); +} + +/************************************************************************/ + +// The resultant `std::string`s have "native" encoding (which is lost) depending +// on the platform: UTF-8 on Linux and Windows-1252 on Windows. +namespace details +{ + inline std::string to_string(const std::string& s) + { + return s; + } +CODA_OSS_API std::string to_string(const coda_oss::u8string&); +CODA_OSS_API std::string to_string(const std::wstring&); // input is UTF-16 or UTF-32 depending on the platform +CODA_OSS_API std::wstring to_wstring(const std::string&); // platform determines Windows-1252 or UTF-8 input and output encoding +CODA_OSS_API std::wstring to_wstring(const coda_oss::u8string&); // platform determines UTF-16 or UTF-32 output encoding +} +namespace testing +{ +CODA_OSS_API std::string to_string(const str::W1252string&); +CODA_OSS_API std::wstring to_wstring(const str::W1252string&); // platform determines UTF-16 or UTF-32 output encoding } + +inline std::string to_native(const coda_oss::u8string& s) // cf., std::filesystem::native(), https://en.cppreference.com/w/cpp/filesystem/path/native +{ + return details::to_string(s); +} + } #endif // CODA_OSS_str_Encoding_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/str/include/str/Format.h b/externals/coda-oss/modules/c++/str/include/str/Format.h index 2409438076..6261e204df 100644 --- a/externals/coda-oss/modules/c++/str/include/str/Format.h +++ b/externals/coda-oss/modules/c++/str/include/str/Format.h @@ -21,40 +21,199 @@ */ -#ifndef __STR_FORMAT_H__ -#define __STR_FORMAT_H__ +#pragma once +#ifndef CODA_OSS_str_Format_h_INCLUDED_ +#define CODA_OSS_str_Format_h_INCLUDED_ #include +#include +#include + #include #include "config/Exports.h" namespace str { +namespace details +{ +CODA_OSS_API std::string Format_(const char* format, ...); + +inline auto Format(const char* format) +{ + return Format_(format); +} + +template +inline auto Format(const char* format, const T1& t1) +{ + return Format_(format, t1); +} +template +inline auto Format(const char* format, const T1& t1, const T2& t2) +{ + return Format_(format, t1, t2); +} +template +inline auto Format(const char* format, const T1& t1, const T2& t2, const T3& t3) +{ + return Format_(format, t1, t2, t3); +} +template +inline auto Format(const char* format, const T1& t1, const T2& t2, const T3& t3, const T4& t4) +{ + return Format_(format, t1, t2, t3, t4); +} +} + /*! * \param format The format * \param ... Any printf like thing */ -CODA_OSS_API std::string format(const char* format, ...); -struct CODA_OSS_API Format final +inline auto Format(const char* format) { - Format(const char* format, ...); + return details::Format(format); +} - operator std::string() const - { - return mString; - } +inline auto Format(const char* format, const char* pStr) +{ + return details::Format(format, pStr); +} +inline auto Format(const char* format, const std::string& s) +{ + return Format(format, s.c_str()); +} +inline auto Format(const char* format, int i) +{ + return details::Format(format, i); +} +inline auto Format(const char* format, uint32_t i) +{ + return details::Format(format, i); +} +inline auto Format(const char* format, ptrdiff_t l) +{ + return details::Format(format, l); +} +inline auto Format(const char* format, size_t ul) +{ + return details::Format(format, ul); +} +inline auto Format(const char* format, float f) +{ + return details::Format(format, f); +} +inline auto Format(const char* format, double d) +{ + return details::Format(format, d); +} +inline auto Format(const char* format, const void* p) +{ + return details::Format(format, p); +} - operator std::string& () noexcept - { - return mString; - } +inline auto Format(const char* format, char ch, const char* pStr) +{ + return details::Format(format, ch, pStr); +} +inline auto Format(const char* format, char ch, const std::string& s) +{ + return Format(format, ch, s.c_str()); +} +inline auto Format(const char* format, const std::string& s1, const std::string& s2) +{ + return details::Format(format, s1.c_str(), s2.c_str()); +} +inline auto Format(const char* format, const std::string& s, size_t ul) +{ + return details::Format(format, s.c_str(), ul); +} +inline auto Format(const char* format, char ch1, char ch2) +{ + return details::Format(format, ch1, ch2); +} +inline auto Format(const char* format, int i1, int i2) +{ + return details::Format(format, i1, i2); +} +inline auto Format(const char* format, long l1, long l2) +{ + return details::Format(format, l1, l2); +} +inline auto Format(const char* format, uint32_t ui1, uint32_t ui2) +{ + return details::Format(format, ui1, ui2); +} +inline auto Format(const char* format, size_t ul1, size_t ul2) +{ + return details::Format(format, ul1, ul2); +} +inline auto Format(const char* format, size_t ul1, int i2) +{ + return details::Format(format, ul1, i2); +} +inline auto Format(const char* format, double d1, double d2) +{ + return details::Format(format, d1, d2); +} +inline auto Format(const char* format, int i, const char* pStr) +{ + return details::Format(format, i, pStr); +} +inline auto Format(const char* fmt, int i, const std::string& s) +{ + return Format(fmt, i, s.c_str()); +} -protected: - std::string mString; -}; +inline auto Format(const char* format, char ch1, char ch2, const std::string& s) +{ + return details::Format(format, ch1, ch2, s.c_str()); +} +inline auto Format(const char* format, int i1, int i2, unsigned long ul) +{ + return details::Format(format, i1, i2, ul); +} +inline auto Format(const char* format, int i1, int i2, int i3) +{ + return details::Format(format, i1, i2, i3); +} +inline auto Format(const char* format, float f1, float f2, float f3) +{ + return details::Format(format, f1, f2, f3); +} +inline std::string Format(const char* format, const std::string& s1, int i2, int i3) +{ + return details::Format(format, s1.c_str(), i2, i3); +} +inline auto Format(const char* format, const std::string& s1, const std::string& s2, uint32_t ui) +{ + return details::Format(format, s1.c_str(), s2.c_str(), ui); +} +inline auto Format(const char* format, const std::string& s1, const std::string& s2, const std::string& s3) +{ + return details::Format(format, s1.c_str(), s2.c_str(), s3.c_str()); +} +inline auto Format(const char* format, int i1, int i2, int i3, int i4) +{ + return details::Format(format, i1, i2, i3, i4); +} +inline auto Format(const char* format, uint32_t ui1, uint32_t ui2, uint32_t ui3, uint32_t ui4) +{ + return details::Format(format, ui1, ui2, ui3, ui4); +} +inline auto Format(const char* format, const char* pStr1, const std::string& s2, const char* pStr3, const std::string& s4) +{ + return details::Format(format, pStr1, s2.c_str(), pStr3, s4.c_str()); } -#endif +inline auto Format(const char* format, const std::string& s1, int i2, const std::string& s3, int i4) +{ + return details::Format(format, s1.c_str(), i2, s3.c_str(), i4); +} +} + +#define FmtX(format, ...) str::Format(format, __VA_ARGS__) + +#endif // CODA_OSS_str_Format_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/str/include/str/W1252string.h b/externals/coda-oss/modules/c++/str/include/str/W1252string.h new file mode 100644 index 0000000000..9459227002 --- /dev/null +++ b/externals/coda-oss/modules/c++/str/include/str/W1252string.h @@ -0,0 +1,55 @@ +/* ========================================================================= + * This file is part of str-c++ + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * (C) Copyright 2020, 2021, 2022, 2023, Maxar Technologies, Inc. + * + * str-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + +#pragma once +#ifndef CODA_OSS_str_W1252string_h_INCLUDED_ +#define CODA_OSS_str_W1252string_h_INCLUDED_ + +#include +#include + +#include +#include + +namespace str +{ + +// This is to make it difficult to get encodings mixed up; it's here (in a .h +// file) as we want to unit-test it. Windows1252_T for Windows-1252 characters +enum class Windows1252_T : unsigned char { }; // https://en.cppreference.com/w/cpp/language/types +using W1252string = std::basic_string; // https://en.cppreference.com/w/cpp/string + +////////////////////////////////////////////////////////////////////////////////////////// + +// We'll get strange errors, possibibly at link-time, if wchar_t is not a wchar_t type. +// MSVC has an option to control this: https://docs.microsoft.com/en-us/cpp/build/reference/zc-wchar-t-wchar-t-is-native-type +// https://en.cppreference.com/w/cpp/language/types +// "It has the same size, signedness, and alignment as one of the integer types, but is a distinct type." +static_assert(!std::is_same::value, "wchar_t should not be the same as uint16_t"); +static_assert(!std::is_same::value, "wchar_t should not be the same as int16_t"); +static_assert(!std::is_same::value, "wchar_t should not be the same as uint32_t"); +static_assert(!std::is_same::value, "wchar_t should not be the same as int32_t"); + +} + +#endif // CODA_OSS_str_W1252string_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/str/source/EncodedString.cpp b/externals/coda-oss/modules/c++/str/source/EncodedString.cpp deleted file mode 100644 index 789ee55797..0000000000 --- a/externals/coda-oss/modules/c++/str/source/EncodedString.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* ========================================================================= - * This file is part of str-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * str-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ -#include "str/EncodedString.h" - -#include - -template -inline void assign_(const CharT* p, size_t c, std::string& s_, str::EncodedStringView& v_) -{ - using string_t = std::basic_string; - s_.assign(str::cast(p), c); // copy - v_ = str::EncodedStringView(str::c_str(s_), c); -} -template -inline void assign_(const CharT* p, std::string& s_, str::EncodedStringView& v_) -{ - using string_t = std::basic_string; - s_ = str::cast(p); // copy - v_ = str::EncodedStringView(str::c_str(s_), s_.length()); -} - -static str::EncodedStringView make_EncodedStringView(const std::string& s, bool isUtf8) -{ - if (isUtf8) - { - return str::EncodedStringView(str::c_str(s), s.length()); - } - - // not UTF-8, assume Windows-1252 - return str::EncodedStringView(str::c_str(s), s.length()); -} - -str::EncodedString::EncodedString(std::string::const_pointer p, std::string::size_type c) : s_(p, c) /*copy*/, v_(s_) { } -str::EncodedString::EncodedString(std::string::const_pointer p) : s_(p) /*copy*/, v_(s_) { } -str::EncodedString::EncodedString(const std::string& s) : s_(s) /*copy*/, v_(s_) { } - -str::EncodedString::EncodedString() : EncodedString(""){ } - -str::EncodedString::EncodedString(coda_oss::u8string::const_pointer p, coda_oss::u8string::size_type c) -{ - assign_(p, c, s_, v_); -} -str::EncodedString::EncodedString(coda_oss::u8string::const_pointer p) -{ - assign_(p, s_, v_); -} -str::EncodedString::EncodedString(const coda_oss::u8string& s) : EncodedString(s.c_str(), s.size()) { } - -str::EncodedString::EncodedString(str::W1252string::const_pointer p, str::W1252string::size_type c) -{ - assign_(p, c, s_, v_); -} -str::EncodedString::EncodedString(str::W1252string::const_pointer p) -{ - assign_(p, s_, v_); -} -str::EncodedString::EncodedString(const str::W1252string& s) : EncodedString(s.c_str(), s.size()) { } - -str::EncodedString::EncodedString(const std::u16string& s) : EncodedString(to_u8string(s)) { } -str::EncodedString::EncodedString(const std::u32string& s) : EncodedString(to_u8string(s)) { } - -static inline coda_oss::u8string to_u8string_(std::wstring::const_pointer p_, size_t sz) // std::wstring is UTF-16 or UTF-32 depending on platform -{ - const auto p = - // Need to use #ifdef's because str::cast() checks to be sure the sizes are correct. - #if _WIN32 - str::cast(p_); // std::wstring is UTF-16 on Windows - #endif - #if !_WIN32 - str::cast(p_); // std::wstring is UTF-32 on Linux - #endif - return str::to_u8string(p, sz); -} - -str::EncodedString::EncodedString(std::wstring::const_pointer s) : EncodedString(to_u8string_(s, wcslen(s))) { } -str::EncodedString::EncodedString(const std::wstring& s) : EncodedString(to_u8string_(s.c_str(), s.size())) { } - -// create from a view -str::EncodedString& str::EncodedString::operator=(const EncodedStringView& v) -{ - if (v.mIsUtf8) - { - assign_(v.c_u8str(), v.size(), s_, v_); - } - else - { - // not UTF-8, assume Windows-1252 - auto p = cast(v.c_str()); - assign_(p, v.size(), s_, v_); - } - - return *this; -} -str::EncodedString::EncodedString(const EncodedStringView& v) -{ - *this = v; -} - -str::EncodedString& str::EncodedString::operator=(const EncodedString& es) -{ - if (this != &es) - { - this->s_ = es.s_; // copy - this->v_ = make_EncodedStringView(s_, es.view().mIsUtf8); - } - return *this; -} -str::EncodedString::EncodedString(const EncodedString& es) -{ - *this = es; -} - -str::EncodedString& str::EncodedString::operator=(EncodedString&& es) -{ - if (this != &es) - { - this->s_ = std::move(es.s_); - this->v_ = make_EncodedStringView(s_, es.view().mIsUtf8); - } - return *this; -} -str::EncodedString::EncodedString(EncodedString&& es) -{ - *this = std::move(es); -} diff --git a/externals/coda-oss/modules/c++/str/source/EncodedStringView.cpp b/externals/coda-oss/modules/c++/str/source/EncodedStringView.cpp deleted file mode 100644 index 6bd00eef4d..0000000000 --- a/externals/coda-oss/modules/c++/str/source/EncodedStringView.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* ========================================================================= - * This file is part of str-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * (C) Copyright 2022, Maxar Technologies, Inc. - * - * str-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include "str/EncodedStringView.h" - -#include -#include - -#include -#include "coda_oss/span.h" - -#include "str/Convert.h" -#include "str/Encoding.h" -#include "str/EncodedString.h" - -enum class PlatformType -{ - Windows, - Linux, - // MacOS -}; - -#ifdef _WIN32 -static auto Platform = PlatformType::Windows; -#else -static auto Platform = PlatformType::Linux; -#endif - -inline std::u16string to_u16string(std::string::const_pointer s, size_t sz, bool is_utf8 /* is 's' UTF-8? */) -{ - if (is_utf8) - { - return str::to_u16string(str::cast(s), sz); - } - return str::to_u16string(str::cast(s), sz); -} - -static std::string to_native(coda_oss::u8string::const_pointer p, size_t sz) -{ - if (Platform == PlatformType::Windows) - { - std::string retval; - str::details::utf8to1252(p, sz, retval); - return retval; - } - if (Platform == PlatformType::Linux) - { - return std::string(str::cast(p), sz); - } - throw std::logic_error("Unknown platform."); -} - -static std::string to_native(str::W1252string::const_pointer p, size_t sz) -{ - if (Platform == PlatformType::Windows) - { - return std::string(str::cast(p), sz); - } - if (Platform == PlatformType::Linux) - { - std::string retval; - str::details::w1252to8(p, sz, retval); - return retval; - } - throw std::logic_error("Unknown platform."); -} - -template -inline auto make_span(const Char8T* s, size_t c) -{ - static_assert(sizeof(Char8T) == sizeof(char), "sizeof(Char8T) != sizeof(char)"); - return coda_oss::span(s, c); -} -template -inline auto make_span(const Char8T* s) -{ - auto const s_ = str::cast(s); - return make_span(s, strlen(s_)); -} -template -inline auto make_span(const std::basic_string& s) -{ - assert(strlen(str::c_str(s)) == s.length()); - return make_span(s.c_str(), s.length()); -} -template -inline auto make_span(coda_oss::span s) -{ - auto const s_ = str::cast(s.data()); - assert(strlen(s_) == s.size()); - return coda_oss::span(s_, s.size()); -} - -str::EncodedStringView::EncodedStringView(std::string::const_pointer p, std::string::size_type c) : mString(make_span(p, c)) { } -str::EncodedStringView::EncodedStringView(std::string::const_pointer p) : mString(make_span(p)) { } -str::EncodedStringView::EncodedStringView(const std::string& s) : mString(make_span(s)){ } - -str::EncodedStringView::EncodedStringView(coda_oss::span s) : mString(make_span(s)), mIsUtf8(true) {} -str::EncodedStringView::EncodedStringView(coda_oss::u8string::const_pointer p, coda_oss::u8string::size_type c) : EncodedStringView(make_span(p, c)) { } -str::EncodedStringView::EncodedStringView(coda_oss::u8string::const_pointer p) : EncodedStringView(make_span(p)) { } -str::EncodedStringView::EncodedStringView(const coda_oss::u8string& s) : EncodedStringView(make_span(s)) { } - -str::EncodedStringView::EncodedStringView(coda_oss::span s) : mString(make_span(s)), mIsUtf8(false) {} -str::EncodedStringView::EncodedStringView(str::W1252string::const_pointer p, str::W1252string::size_type c) : EncodedStringView(make_span(p, c)) { } -str::EncodedStringView::EncodedStringView(str::W1252string::const_pointer p) : EncodedStringView(make_span(p)) { } -str::EncodedStringView::EncodedStringView(const str::W1252string& s) : EncodedStringView(make_span(s)) { } - -std::string str::EncodedStringView::native() const -{ - const auto s = mString.data(); - const auto sz = mString.size(); - return mIsUtf8 ? to_native(str::cast(s), sz) - : to_native(str::cast(s), sz); -} - -coda_oss::u8string str::EncodedStringView::u8string() const -{ - return mIsUtf8 ? - str::cast(mString.data()) : // copy - str::to_u8string(str::cast(mString.data()), mString.size()); -} -std::string str::EncodedStringView::asUtf8() const -{ - const auto result = u8string(); - return str::c_str(result); // cast & copy -} - -std::u16string str::EncodedStringView::u16string() const -{ - return ::to_u16string(mString.data(), mString.size(), mIsUtf8); -} - -inline std::u32string to_u32string(std::string::const_pointer s, size_t sz, bool is_utf8 /* is 's' UTF-8? */) -{ - if (is_utf8) - { - return str::to_u32string(str::cast(s), sz); - } - return str::to_u32string(str::cast(s), sz); -} -std::u32string str::EncodedStringView::u32string() const -{ - return ::to_u32string(mString.data(), mString.size(), mIsUtf8); -} - -std::wstring str::EncodedStringView::wstring() const // UTF-16 on Windows, UTF-32 on Linux -{ - const auto p = mString.data(); - const auto sz = mString.size(); - const auto s = - // Need to use #ifdef's because str::cast() checks to be sure the sizes are correct. - #ifdef _WIN32 - ::to_u16string(p, sz, mIsUtf8); // std::wstring is UTF-16 on Windows - #else - ::to_u32string(p, sz, mIsUtf8); // std::wstring is UTF-32 on Linux - #endif - return str::c_str(s); // copy -} - -str::W1252string str::EncodedStringView::w1252string() const -{ - return mIsUtf8 ? - str::to_w1252string(str::cast(mString.data()), mString.size()) : - str::cast(mString.data()); // copy -} -std::string str::EncodedStringView::asWindows1252() const -{ - const auto result = w1252string(); - return str::c_str(result); // cast & copy -} - -bool str::EncodedStringView::operator_eq(const EncodedStringView& rhs) const -{ - auto& lhs = *this; - - // if encoding is the same, strcmp() will work - if (lhs.mIsUtf8 == rhs.mIsUtf8) // both are UTF-8 or both are Windows-1252 - { - // But we can avoid that call if the pointers are the same - const auto pLhs = lhs.mString.data(); - const auto pRhs = rhs.mString.data(); - if ((pLhs == pRhs) && (rhs.mString.size() == rhs.mString.size())) - { - return true; - } - return strcmp(pLhs, pRhs) == 0; - } - - // LHS and RHS have different encodings, but one must be UTF-8 - assert((lhs.mIsUtf8 && !rhs.mIsUtf8) || (!lhs.mIsUtf8 && rhs.mIsUtf8)); // should have used strcmp(), above - auto& utf8 = lhs.mIsUtf8 ? lhs : rhs; - auto& w1252 = !lhs.mIsUtf8 ? lhs : rhs; - - // If UTF-8 is native on this platform, convert to UTF-8; otherwise do a native comparision - return mNativeIsUtf8 ? utf8.c_u8str() == w1252.u8string() : utf8.native() == w1252.mString.data(); -} - - diff --git a/externals/coda-oss/modules/c++/str/source/Encoding.cpp b/externals/coda-oss/modules/c++/str/source/Encoding.cpp index 46ce45b738..eacc016d8f 100644 --- a/externals/coda-oss/modules/c++/str/source/Encoding.cpp +++ b/externals/coda-oss/modules/c++/str/source/Encoding.cpp @@ -20,6 +20,7 @@ * see . * */ +#include "str/Encoding.h" #include #include @@ -36,12 +37,8 @@ #include "gsl/gsl.h" #include "config/compiler_extensions.h" -#include "str/Encoding.h" #include "str/Manip.h" #include "str/Convert.h" -#include "str/EncodedStringView.h" - - CODA_OSS_disable_warning_push #if _MSC_VER #pragma warning(disable: 26818) // Switch statement does not cover all cases. Consider adding a '...' label (es.79). @@ -51,6 +48,21 @@ CODA_OSS_disable_warning(-Wshadow) #include "str/utf8.h" CODA_OSS_disable_warning_pop +//// "sys" depends on "str" so can't use sys::PlatformType +//enum class PlatformType +//{ +// Windows, +// Linux, +// // MacOS +//}; +#if _WIN32 +//static constexpr auto Platform = PlatformType::Windows; +#elif defined(_POSIX_C_SOURCE) +//static constexpr auto Platform = PlatformType::Linux; +#else +#error "Unknown platform" +#endif + // Need to look up characters from \x80 (EURO SIGN) to \x9F (LATIN CAPITAL LETTER Y WITH DIAERESIS) // in a map: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT inline coda_oss::u8string utf8_(uint32_t i) @@ -123,7 +135,7 @@ static auto Windows1252_to_u8string() inline void append(std::string& result, const coda_oss::u8string& utf8) { - result += str::c_str(utf8); + result += str::str(utf8); } inline void append(coda_oss::u8string& result, const coda_oss::u8string& utf8) { @@ -189,42 +201,31 @@ static void fromWindows1252_(str::W1252string::value_type ch, std::basic_string< } } template -void windows1252_to_string_(str::W1252string::const_pointer p, size_t sz, std::basic_string& result) +inline void w1252_to_string(str::W1252string::const_pointer p, size_t sz, std::basic_string& result) { for (size_t i = 0; i < sz; i++) { fromWindows1252_(p[i], result); } } -template -inline TReturn to_Tstring(str::W1252string::const_pointer p, size_t sz) -{ - TReturn retval; - windows1252_to_string_(p, sz, retval); - return retval; -} - -inline void windows1252_to_string(str::W1252string::const_pointer p, size_t sz, coda_oss::u8string& result) -{ - windows1252_to_string_(p, sz, result); -} -void str::details::w1252to8(str::W1252string::const_pointer p, size_t sz, std::string& result) +template +inline void w1252to8(str::W1252string::const_pointer p, size_t sz, std::basic_string& result) { - result = to_Tstring(p, sz); + w1252_to_string(p, sz, result); } -std::u16string str::to_u16string(str::W1252string::const_pointer p, size_t sz) +inline void w1252to16(str::W1252string::const_pointer p, size_t sz, std::u16string& result) { - auto retval = to_Tstring(p, sz); + w1252_to_string(p, sz, result); + #if defined(_WIN32) && (!defined(_NDEBUG) || defined(DEBUG)) - const _bstr_t bstr(std::string(str::cast(p), sz).c_str()); // no _bstr_t ctor taking sz + const _bstr_t bstr(std::string(str::details::cast(p), sz).c_str()); // no _bstr_t ctor taking sz const std::wstring wstr(static_cast(bstr)); - assert(retval == str::cast(wstr.c_str())); + assert(result == str::str(wstr)); #endif - return retval; } -std::u32string str::to_u32string(str::W1252string::const_pointer p, size_t sz) +inline void w1252to32(str::W1252string::const_pointer p, size_t sz, std::u32string& result) { - return to_Tstring(p, sz); + w1252_to_string(p, sz, result); } template @@ -258,7 +259,7 @@ static void get_next_utf8_byte(coda_oss::u8string::const_pointer p, size_t sz, template static void utf8to1252(coda_oss::u8string::const_pointer p, size_t sz, std::basic_string& result, bool strict=false) { - using value_type = typename std::basic_string::value_type; + using value_type = TChar; for (size_t i = 0; i < sz; i++) { const auto b1 = static_cast(p[i]); @@ -301,25 +302,62 @@ static void utf8to1252(coda_oss::u8string::const_pointer p, size_t sz, std::basi // _bstr_t preserves these values if (utf8.length() == 2) { - result += static_cast(utf8[1]); + result += static_cast(utf8[1]); } else { assert("UTF-8 sequence can't be converted to Windows-1252." && 0); - result += static_cast(0x7F); // + result += static_cast(0x7F); // } } } } -void str::details::utf8to1252(coda_oss::u8string::const_pointer p, size_t sz, std::string& result) + +static auto u16_to_Windows1252() { - ::utf8to1252(p, sz, result); + // Find the corresponding UTF-16 value for every Windows-1252 input; + // obviously, most UTF-16 values can't be converted. Skip the first half + // as they're the same for ASCII. + std::map retval; + for (uint16_t i = 0x0080; i <= 0x00ff; i++) // **not** `uint8_t` to avoid wrap-around + { + const auto ch = static_cast(i); + const auto u16 = str::to_u16string(&ch, 1); + assert(u16.length() == 1); + retval[u16[0]] = ch; + } + return retval; } -str::W1252string str::to_w1252string(coda_oss::u8string::const_pointer p, size_t sz) +static inline void utf16to1252(std::u16string::const_pointer p, size_t sz, std::string& result, bool strict=false) { - str::W1252string retval; - utf8to1252(p, sz, retval); - return retval; + using value_type = std::string::value_type; + + static const auto map = u16_to_Windows1252(); + for (size_t i = 0; i < sz; i++) + { + const auto ch = p[i]; + + if (ch < 0x0080) // ASCII + { + result += gsl::narrow(ch); + continue; + } + + const auto it = map.find(ch); + if (it != map.end()) + { + result += static_cast(it->second); + } + else if (strict) + { + throw std::invalid_argument("UTF-16 sequence can't be converted to Windows-1252."); + } + else + { + assert("UTF-16 sequence can't be converted to Windows-1252." && 0); + result += static_cast(0x7F); // + } + } } struct back_inserter final @@ -336,32 +374,112 @@ struct back_inserter final back_inserter operator++(int) noexcept { return *this; } }; -coda_oss::u8string str::to_u8string(std::u16string::const_pointer p, size_t sz) +template +inline auto to_uXXstring(const std::basic_string& s) +{ + const auto p = str::c_str(s); + #if _WIN32 + return str::to_u16string(p, s.length()); // std::wstring is UTF-16 on Windows + #else + return str::to_u32string(p, s.length()); // assume std::wstring is UTF-32 everywhere except Windows + #endif +} +template +static std::wstring to_wstring_(const std::basic_string& s, bool is_utf8) +{ + + const auto result = is_utf8 ? to_uXXstring(s) + : to_uXXstring(s); + return str::str(result); +} + +/***********************************************************************************/ + +std::string str::details::to_string(const coda_oss::u8string& s) +{ + #if _WIN32 + std::string retval; + utf8to1252(s.c_str(), s.length(), retval); + return retval; + #else + return str(s); + #endif +} + +std::string str::testing::to_string(const str::W1252string& s) +{ + #if _WIN32 + return str(s); + #else + std::string retval; + w1252to8(s.c_str(), s.length(), retval); + return retval; + #endif +} + +std::string str::details::to_string(const std::wstring& s) +{ + const auto p = details::c_str(s); + const auto sz = s.length(); + + std::string retval; + #if _WIN32 + utf16to1252(p, sz, retval); // UTF16 -> Windows-1252 on Windows. + #else + utf8::utf32to8(p, p + sz, std::back_inserter(retval)); // UTF32 -> UTF-8 everywhere else. + #endif + return retval; +} + +std::wstring str::details::to_wstring(const std::string& s) +{ + #if _WIN32 + return to_wstring_(s, false /*is_utf8*/); // Input is Windows-1252 on Windows + #else + return to_wstring_(s, true /*is_utf8*/); // Input is UTF-8 everywhere except Windows + #endif +} +std::wstring str::details::to_wstring(const coda_oss::u8string& s) +{ + return to_wstring_(s, true /*is_utf8*/); +} +std::wstring str::testing::to_wstring(const str::W1252string& s) +{ + return to_wstring_(s, false /*is_utf8*/); +} + +/***********************************************************************************/ + +std::u16string str::to_u16string(str::W1252string::const_pointer p, size_t sz) { - // http://utfcpp.sourceforge.net/#introsample - /* - // Convert it to utf-16 - vector utf16line; - utf8::utf8to16(line.begin(), end_it, back_inserter(utf16line)); + std::u16string retval; + w1252to16(p, sz, retval); + return retval; +} +std::u32string str::to_u32string(str::W1252string::const_pointer p, size_t sz) +{ + std::u32string retval; + w1252to32(p, sz, retval); + return retval; +} - // And back to utf-8 - string utf8line; - utf8::utf16to8(utf16line.begin(), utf16line.end(), back_inserter(utf8line)); - */ +str::W1252string str::to_w1252string(coda_oss::u8string::const_pointer p, size_t sz) +{ + str::W1252string retval; + utf8to1252(p, sz, retval); + return retval; +} + +coda_oss::u8string str::to_u8string(std::u16string::const_pointer p, size_t sz) +{ coda_oss::u8string retval; utf8::utf16to8(p, p + sz, back_inserter(retval)); return retval; - - /* - std::vector utf16line; - auto begin = c_str(result); - utf8::utf8to16(begin, begin+result.size(), std::back_inserter(utf16line)); - */ } std::u16string str::to_u16string(coda_oss::u8string::const_pointer p_, size_t sz) { - auto p = str::cast(p_); + auto p = details::cast(p_); std::u16string retval; utf8::utf8to16(p, p + sz, std::back_inserter(retval)); return retval; @@ -369,7 +487,7 @@ std::u16string str::to_u16string(coda_oss::u8string::const_pointer p_, size_t sz std::u32string str::to_u32string(coda_oss::u8string::const_pointer p_, size_t sz) { - auto p = str::cast(p_); + auto p = details::cast(p_); std::u32string retval; utf8::utf8to32(p, p + sz, std::back_inserter(retval)); return retval; @@ -385,11 +503,6 @@ coda_oss::u8string str::to_u8string(std::u32string::const_pointer p, size_t sz) coda_oss::u8string str::to_u8string(W1252string::const_pointer p, size_t sz) { coda_oss::u8string retval; - ::windows1252_to_string(p, sz, retval); + w1252to8(p, sz, retval); return retval; } - -std::string str::toString(const coda_oss::u8string& utf8) -{ - return str::EncodedStringView(utf8).native(); -} diff --git a/externals/coda-oss/modules/c++/str/source/Format.cpp b/externals/coda-oss/modules/c++/str/source/Format.cpp index b89c974e8f..fdcfc85448 100644 --- a/externals/coda-oss/modules/c++/str/source/Format.cpp +++ b/externals/coda-oss/modules/c++/str/source/Format.cpp @@ -51,20 +51,11 @@ inline void va_end_(va_list& args) CODA_OSS_disable_warning_pop } -std::string str::format(const char *format, ...) -{ - va_list args; - va_start(args, format); - auto retval = vformat(format, args); - va_end_(args); - return retval; -} - -str::Format::Format(const char* format, ...) +std::string str::details::Format_(const char* format, ...) { va_list args; va_start(args, format); auto result = vformat(format, args); va_end_(args); - mString = std::move(result); + return result; } diff --git a/externals/coda-oss/modules/c++/str/tests/VersionTest.cpp b/externals/coda-oss/modules/c++/str/tests/VersionTest.cpp index a3e5503682..627696cdf5 100644 --- a/externals/coda-oss/modules/c++/str/tests/VersionTest.cpp +++ b/externals/coda-oss/modules/c++/str/tests/VersionTest.cpp @@ -23,21 +23,15 @@ #include #include -#if defined(TEST_FUNTOR) -# define FORMAT_FUNC (std::string)str::Format -#else -# define FORMAT_FUNC str::format -#endif - int main() { - std::cout << FORMAT_FUNC("Your version of str is %d.%d.%d\n", + std::cout << str::Format("Your version of str is %d.%d.%d\n", STR_MAJOR_VERSION, STR_MINOR_VERSION, STR_MICRO_VERSION); - std::cout << "Specialization for string test..." << std::endl; + std::cout << "Specialization for string test...\n"; std::string ok("This test passes"); std::cout << str::toType(ok) << std::endl; - std::cout << "Testing the trim function..." << std::endl; + std::cout << "Testing the trim function...\n"; std::string s = " test "; std::cout << "'" << s << "', length: " << s.length() << std::endl; str::trim(s); diff --git a/externals/coda-oss/modules/c++/str/unittests/test_base_convert.cpp b/externals/coda-oss/modules/c++/str/unittests/test_base_convert.cpp index 71ee45016d..3b951015ad 100644 --- a/externals/coda-oss/modules/c++/str/unittests/test_base_convert.cpp +++ b/externals/coda-oss/modules/c++/str/unittests/test_base_convert.cpp @@ -1,621 +1,602 @@ -/* ========================================================================= - * This file is part of str-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * - * str-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include - -#include -#include -#include -#include -#if _WIN32 -#include -#endif - -#include -#include -#include -#include -#include - -#include "TestCase.h" - -inline static void test_assert_eq(const std::string& testName, const std::u8string& actual, const std::u32string& expected) -{ - TEST_ASSERT_EQ(actual, str::to_u8string(expected)); -} - -TEST_CASE(testConvert) -{ - TEST_ASSERT_EQ(str::toType("0x3BC7", 16), gsl::narrow(0x3BC7)); - TEST_ASSERT_EQ(str::toType("1101", 2), gsl::narrow(13)); - TEST_ASSERT_EQ(str::toType("231", 5), gsl::narrow(66)); - TEST_ASSERT_EQ(str::toType("0xFFFFFFFFFFFFFFFF", 16), - gsl::narrow(0xFFFFFFFFFFFFFFFF)); - TEST_ASSERT_EQ(str::toType("-10", 10), - gsl::narrow_cast(-10)); - TEST_ASSERT_EQ(str::toType("13", 4), gsl::narrow(7)); -} - -TEST_CASE(testBadConvert) -{ - TEST_EXCEPTION(str::toType("Not a number", 10)); - TEST_EXCEPTION(str::toType("0xFFFFFFFFFFFFFFFF", 16)); - TEST_EXCEPTION(str::toType("0xFFFFF", 16)); -} - -TEST_CASE(testEightBitIntToString) -{ - TEST_ASSERT_EQ(str::toString(static_cast(1)), "1"); - TEST_ASSERT_EQ(str::toString(static_cast(2)), "2"); - TEST_ASSERT_EQ(str::toString(static_cast(-2)), "-2"); -} - -TEST_CASE(testCharToString) -{ - TEST_ASSERT_EQ(str::toString('a'), "a"); - TEST_ASSERT_EQ(str::toString(static_cast(65)), "A"); -} - -static std::u8string fromWindows1252(const std::string& s) -{ - // s is Windows-1252 on ALL platforms - return str::EncodedStringView::fromWindows1252(s).u8string(); -} - -template -static constexpr std::u8string::value_type cast8(T ch) -{ - static_assert(sizeof(std::u8string::value_type) == sizeof(char), "sizeof(Char8_T) != sizeof(char)"); - return static_cast(ch); -} -template -static inline constexpr std::u32string::value_type U(TChar ch) -{ - return static_cast(ch); -} - -TEST_CASE(test_string_to_u8string_ascii) -{ - { - const std::string input = "|\x00"; // ASCII, "|" - const auto actual = fromWindows1252(input); - const std::u8string expected{cast8('|')}; // '\x00' is the end of the string in C/C++ - TEST_ASSERT_EQ(actual, expected); - } - constexpr uint8_t start_of_heading = 0x01; - constexpr uint8_t delete_character = 0x7f; - for (uint8_t ch = start_of_heading; ch <= delete_character; ch++) // ASCII - { - const std::string input { '|', static_cast(ch), '|'}; - const auto actual = fromWindows1252(input); - const std::u8string expected8{cast8('|'), cast8(ch), cast8('|')}; - TEST_ASSERT_EQ(actual, expected8); - const std::u32string expected{U'|', U(ch), U'|'}; - test_assert_eq(testName, actual, expected); - } -} - -static void test_string_to_u8string_windows_1252_(const std::string& testName, const std::string& input_) -{ - const str::W1252string input(str::c_str(input_)); - const auto actual = to_u8string(input); - - // No "expected" to test against as the UTF-8 values for these Windows-1252 characters - // are mapped one-by-one. However, we can test that UTF-8 to Windows-1252 - // works as that walks through a UTF-8 string which can have 1-, 2-, 3- and 4-bytes - // for a single code-point. - const auto w1252 = str::to_w1252string(actual.data(), actual.size()); - TEST_ASSERT(input == w1252); - - // Can't compare the values with == because TEST_ASSERT_EQ() - // wants to do toString() and that doesn't work on Linux as the encoding - // is wrong (see above). - //const std::string w1252_ = str::c_str(w1252); - //TEST_ASSERT_EQ(input_, w1252_); - const str::EncodedStringView inputView(input); - const str::EncodedStringView w1252View(w1252); - TEST_ASSERT_EQ(inputView, w1252View); -} -TEST_CASE(test_string_to_u8string_windows_1252) -{ - // Windows-1252 only characters must be mapped to UTF-8 - { - const std::string input = "|\x80|"; // Windows-1252, "||" - const auto actual = fromWindows1252(input); - const std::u8string expected8{cast8('|'), cast8('\xE2'), cast8('\x82'), cast8('\xAC'), cast8('|')}; // UTF-8, "||" - TEST_ASSERT_EQ(actual, expected8); - const std::u32string expected{U"|\u20AC|"}; // UTF-32, "||" - test_assert_eq(testName, actual, expected); - } - { - const std::string input = "|\x9F|"; // Windows-1252, "||" - const auto actual = fromWindows1252(input); - const std::u8string expected8{cast8('|'), cast8('\xC5'), cast8('\xB8'), cast8('|')}; // UTF-8, "||" - TEST_ASSERT_EQ(actual, expected8); - const std::u32string expected{U"|\u0178|"}; // UTF-32, "||" - test_assert_eq(testName, actual, expected); - } - { - const std::vector undefined{ '\x81', '\x8d', '\x8f', '\x90', '\x9d' }; - for (const auto& ch : undefined) - { - const std::string input{'|', ch, '|'}; - const auto actual = fromWindows1252(input); - TEST_ASSERT_TRUE(!actual.empty()); - //const std::u8string expected8{cast8('|'), cast8('\xEF'), cast8('\xBF'), cast8('\xBD'), cast8('|')}; // UTF-8, "||" - const std::u8string expected8{cast8('|'), cast8(194), cast8(ch), cast8('|')}; - TEST_ASSERT_EQ(actual, expected8); - //const std::u32string expected{U"|\ufffd|"}; // UTF-32, "||" - const auto expected = str::EncodedString(expected8).u32string(); - test_assert_eq(testName, actual, expected); - } - } - { - // http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT - const std::vector windows1252_characters{ - 0x80, // EURO SIGN - 0x82, // SINGLE LOW-9 QUOTATION MARK - 0x83, // LATIN SMALL LETTER F WITH HOOK - 0x84, // DOUBLE LOW-9 QUOTATION MARK - 0x85, // HORIZONTAL ELLIPSIS - 0x86, // DAGGER - 0x87, // DOUBLE DAGGER - 0x88, // MODIFIER LETTER CIRCUMFLEX ACCENT - 0x89, // PER MILLE SIGN - 0x8A, // LATIN CAPITAL LETTER S WITH CARON - 0x8B, // SINGLE LEFT-POINTING ANGLE QUOTATION MARK - 0x8C, // LATIN CAPITAL LIGATURE OE - 0x8E, // LATIN CAPITAL LETTER Z WITH CARON - 0x91, // LEFT SINGLE QUOTATION MARK - 0x92, // RIGHT SINGLE QUOTATION MARK - 0x93, // LEFT DOUBLE QUOTATION MARK - 0x94, // RIGHT DOUBLE QUOTATION MARK - 0x95, // BULLET - 0x96, // EN DASH - 0x97, // EM DASH - 0x98, // SMALL TILDE - 0x99, // TRADE MARK SIGN - 0x9A, // LATIN SMALL LETTER S WITH CARON - 0x9B, // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - 0x9C, // LATIN SMALL LIGATURE OE - 0x9E, // LATIN SMALL LETTER Z WITH CARON - 0x9F}; // LATIN CAPITAL LETTER Y WITH DIAERESIS - std::string runningInput1; - std::string runningInput2; - for (const auto& ch_ : windows1252_characters) - { - const auto ch = static_cast(ch_); - const std::string input_{'[', ch, ']'}; - test_string_to_u8string_windows_1252_(testName, input_); - - runningInput1 += ch; - test_string_to_u8string_windows_1252_(testName, runningInput1); - - runningInput2 += input_; - test_string_to_u8string_windows_1252_(testName, runningInput2); - test_string_to_u8string_windows_1252_(testName, runningInput1+runningInput2); - test_string_to_u8string_windows_1252_(testName, runningInput2+runningInput1); - } - } -} - -TEST_CASE(test_string_to_u8string_iso8859_1) -{ - constexpr uint8_t nobreak_space = 0xa0; - constexpr uint8_t latin_small_letter_y_with_diaeresis = 0xff; // '' - for (uint32_t ch = nobreak_space; ch <= latin_small_letter_y_with_diaeresis; ch++) // ISO8859-1 - { - const std::string input_ { '|', static_cast(ch), '|'}; - const str::W1252string input(str::c_str(input_)); - const auto actual = to_u8string(input); - const std::u32string expected{U'|', U(ch), U'|'}; - test_assert_eq(testName, actual, expected); - - // Can't compare the values with == because TEST_ASSERT_EQ() - // wants to do toString() and that doesn't work on Linux as the encoding - // is wrong (see above). - //std::string actual_; - //str::details::toString(actual.c_str(), actual_); - //TEST_ASSERT_EQ(input_, actual_); - const str::EncodedStringView inputView(input); - const str::EncodedStringView actualView(actual); - TEST_ASSERT_EQ(inputView, actualView); - } -} - -template -static void test_change_case_(const std::string& testName, const TString& lower, const TString& upper) -{ - auto s = upper; - str::lower(s); - TEST_ASSERT(s == lower); - s = lower; - str::upper(s); - TEST_ASSERT(s == upper); - - s = upper; - str::upper(s); - TEST_ASSERT(s == upper); - s = lower; - str::lower(s); - TEST_ASSERT(s == lower); -} -TEST_CASE(test_change_case) -{ - const std::string ABC = "ABC"; - const std::string abc = "abc"; - test_change_case_(testName, abc, ABC); - - //const std::wstring ABC_w = L"ABC"; - //const std::wstring abc_w = L"abc"; - //test_change_case_(testName, abc_w, ABC_w); - - //// Yes, this can really come up, "non classifi" is French (Canadian) for "unclassified". - //const std::string DEF_1252{'D', '\xc9', 'F'}; // "DF" Windows-1252 - //const auto DEF8 = fromWindows1252(DEF_1252); - - //const std::string def_1252{'d', '\xe9', 'f'}; // "df" Windows-1252 - //const auto def8 = fromWindows1252(def_1252); - - ////test_change_case_(testName, def, DEF); - //test_change_case_(testName, def_1252, DEF_1252); -} - -// https://en.wikipedia.org/wiki/%C3%89#Character_mappings -static const str::EncodedString& classificationText_utf_8() -{ - static const str::EncodedString retval(str::cast("A\xc3\x89IOU")); // UTF-8 "AIOU" - return retval; - } -static const str::EncodedString& classificationText_iso8859_1() -{ - static const str::EncodedString retval(str::cast("A\xc9IOU")); // ISO8859-1 "AIOU" - return retval; - } -// UTF-16 on Windows, UTF-32 on Linux -static const wchar_t* classificationText_wide_() { return L"A\xc9IOU"; } // UTF-8 "AIOU" -static str::EncodedString classificationText_wide() { return str::EncodedString(classificationText_wide_()); } -static std::string classificationText_platform() { return - sys::Platform == sys::PlatformType::Linux ? classificationText_utf_8().native() : classificationText_iso8859_1().native(); } - -TEST_CASE(test_u8string_to_string) -{ - { - const auto utf8 = classificationText_utf_8().u8string(); - const str::EncodedStringView utf8View(utf8); - const auto actual = utf8View.native(); - TEST_ASSERT_EQ(classificationText_platform(), actual); - } - { - const auto utf8 = classificationText_iso8859_1().u8string(); - const str::EncodedStringView utf8View(utf8); - const auto actual = utf8View.native(); - TEST_ASSERT_EQ(classificationText_platform(), actual); - } -} - -TEST_CASE(test_u8string_to_u16string) -{ - #if _WIN32 - const auto actual = classificationText_utf_8().u16string(); - const std::wstring s = str::c_str(actual); // Windows: std::wstring == std::u16string - TEST_ASSERT(classificationText_wide_() == s); // _EQ wants to do toString() - #endif - - TEST_ASSERT_EQ(classificationText_wide(), classificationText_utf_8()); - TEST_ASSERT_EQ(classificationText_wide(), classificationText_iso8859_1()); - - TEST_ASSERT(classificationText_wide().u16string() == classificationText_utf_8().u16string()); // _EQ wants to do toString() - TEST_ASSERT(classificationText_wide().u16string() == classificationText_iso8859_1().u16string()); // _EQ wants to do toString() -} - -TEST_CASE(test_u8string_to_u32string) -{ - #if !_WIN32 - const auto actual = classificationText_utf_8().u32string(); - const std::wstring s = str::c_str(actual); // Linux: std::wstring == std::u32string - TEST_ASSERT(classificationText_wide_() == s); // _EQ wants to do toString() - #endif - - TEST_ASSERT_EQ(classificationText_wide(), classificationText_utf_8()); - TEST_ASSERT_EQ(classificationText_wide(), classificationText_iso8859_1()); - - TEST_ASSERT(classificationText_wide().u32string() == classificationText_utf_8().u32string()); // _EQ wants to do toString() - TEST_ASSERT(classificationText_wide().u32string() == classificationText_iso8859_1().u32string()); // _EQ wants to do toString() -} - -static void test_wide_(const std::string& testName, const char* pStr, std::u16string::const_pointer pUtf16, const str::EncodedString& encoded) -{ - // from UTF-16 back to Windows-1252 - const auto w1252 = str::EncodedStringView::details::w1252string(encoded.view()); - const std::string str_w1252 = str::c_str(w1252); - TEST_ASSERT_EQ(str_w1252, pStr); - - #if _WIN32 - // Since we're using UTF-16, on Windows that can be cast to wchar_t - auto pWide = str::cast(pUtf16); - - const _bstr_t str(pStr); - const std::wstring std_wstr(static_cast(str)); // Windows-1252 -> UTF-16 - TEST_ASSERT(encoded.wstring() == std_wstr); - TEST_ASSERT(std_wstr == pWide); - - const _bstr_t wide_str(pWide); - const std::string std_str(static_cast(wide_str)); // UTF-16 -> Windows-1252 - TEST_ASSERT_EQ(encoded.native(), std_str); - TEST_ASSERT_EQ(std_str, pStr); - #else - pUtf16 = pUtf16; // avoid unused-parameter warning - #endif -} - -static void test_Windows1252_ascii(const std::string& testName, const char* pStr, std::u16string::const_pointer pUtf16) -{ - // For both UTF-8 and Windows-1252, ASCII is the same (they only differ for 0x80-0xff). - const auto view8 = str::EncodedStringView::fromUtf8(pStr); - TEST_ASSERT_EQ(pStr, view8.native()); // native() is the same on all platforms/encodings for ASCII - const auto view1252 = str::EncodedStringView::fromWindows1252(pStr); - TEST_ASSERT_EQ(pStr, view1252.native()); // native() is the same on all platforms/encodings for ASCII - - const str::EncodedString encoded(pStr); - TEST_ASSERT(encoded.u16string() == pUtf16); - test_wide_(testName, pStr, pUtf16, encoded); - - const str::EncodedString wide_encoded(pUtf16); - TEST_ASSERT_EQ(wide_encoded.native(), pStr); // native() is the same on all platforms/encodings for ASCII - TEST_ASSERT_EQ(view8, wide_encoded); - TEST_ASSERT_EQ(view1252, wide_encoded); - test_wide_(testName, pStr, pUtf16, wide_encoded); -} -TEST_CASE(test_ASCII) -{ - // https://en.cppreference.com/w/cpp/language/escape - constexpr auto escapes = "|\'|\"|\?|\\|\a|\b|\f|\n|\r|\t|\v|"; - constexpr auto u16_escapes = u"|\'|\"|\?|\\|\a|\b|\f|\n|\r|\t|\v|"; - test_Windows1252_ascii(testName, escapes, u16_escapes); - - // https://en.cppreference.com/w/cpp/language/escape - constexpr auto controls = "|\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x09|\x0a|\x0b|\x0c|\x0d|\x0e|\x0f" - "|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1a|\x1b|\x1c|\x1d|\x1e|\x1f"; - constexpr auto u16_controls = u"|\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x09|\x0a|\x0b|\x0c|\x0d|\x0e|\x0f" - u"|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1a|\x1b|\x1c|\x1d|\x1e|\x1f"; - test_Windows1252_ascii(testName, controls, u16_controls); - - // https://en.cppreference.com/w/cpp/language/ascii - constexpr auto ascii = " !\"#0@AZaz~\x7f"; - constexpr auto u16_ascii = u" !\"#0@AZaz~\x7f"; - test_Windows1252_ascii(testName, ascii, u16_ascii); -} - -static void test_Windows1252_(const std::string& testName, const char* pStr, std::u16string::const_pointer pUtf16) -{ - const auto view = str::EncodedStringView::fromWindows1252(pStr); - - const str::EncodedString encoded(view); - TEST_ASSERT(view.u16string() == pUtf16); - test_wide_(testName, pStr, pUtf16, encoded); - - const str::EncodedString wide_encoded(pUtf16); - TEST_ASSERT_EQ(view, wide_encoded); - test_wide_(testName, pStr, pUtf16, wide_encoded); -} -TEST_CASE(test_Windows1252_WIN32) -{ - // https://en.wikipedia.org/wiki/Windows-1252 - #if _WIN32 - // can convert with bit-twiddling - constexpr auto w1252_a1_ff = ""; // - //constexpr auto w1252_a1_ff = "\xa1\xa2\xfe\xff"; - constexpr auto u16_w1252_a1_ff = u"\u00a1\u00a2\u00fe\u00ff"; - test_Windows1252_(testName, w1252_a1_ff, u16_w1252_a1_ff); - - constexpr auto w1252 = ""; // these values must be mapped - //constexpr auto w1252 = "\x80\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8e" // these values must be mapped - // "\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9e\x9f"; - constexpr auto u16_utf8 = u"\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0160\u2039\u0152\u017d" - "\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\u017e\u0178"; - test_Windows1252_(testName, w1252, u16_utf8); - - // This only works with "relaxed" (i.e., not "strict") conversion; which is what _bstr_t does - constexpr auto w1252_unassigned = "\x81\x8d\x8f\x90\x9d"; - constexpr auto u16_w1252_unassigned = u"\x81\x8d\x8f\x90\x9d"; - test_Windows1252_(testName, w1252_unassigned, u16_w1252_unassigned); - #else - TEST_ASSERT_TRUE(true); // need to use hidden "testName" parameter - #endif -} - -TEST_CASE(test_Windows1252) -{ - // https://en.wikipedia.org/wiki/Windows-1252 - const std::map - w1252_to_utf16{ - {'\x80', u'\u20AC'} // EURO SIGN - , {'\x81', u'\u0081'} // UNDEFINED - , {'\x82', u'\u201A'} // SINGLE LOW-9 QUOTATION MARK - , {'\x83', u'\u0192'} // LATIN SMALL LETTER F WITH HOOK - , {'\x84', u'\u201E'} // DOUBLE LOW-9 QUOTATION MARK - , {'\x85', u'\u2026'} // HORIZONTAL ELLIPSIS - , {'\x86', u'\u2020'} // DAGGER - , {'\x87', u'\u2021'} // DOUBLE DAGGER - , {'\x88', u'\u02C6'} // MODIFIER LETTER CIRCUMFLEX ACCENT - , {'\x89', u'\u2030'} // PER MILLE SIGN - , {'\x8A', u'\u0160'} // LATIN CAPITAL LETTER S WITH CARON - , {'\x8B', u'\u2039'} // SINGLE LEFT-POINTING ANGLE QUOTATION MARK - , {'\x8C', u'\u0152'} // LATIN CAPITAL LIGATURE OE - , {'\x81', u'\u0081'} // UNDEFINED - , {'\x8E', u'\u017D'} // LATIN CAPITAL LETTER Z WITH CARON - , {'\x8F', u'\u008F'} // UNDEFINED - , {'\x90', u'\u0090'} // UNDEFINED - , {'\x91', u'\u2018'} // LEFT SINGLE QUOTATION MARK - , {'\x92', u'\u2019'} // RIGHT SINGLE QUOTATION MARK - , {'\x93', u'\u201C'} // LEFT DOUBLE QUOTATION MARK - , {'\x94', u'\u201D'} // RIGHT DOUBLE QUOTATION MARK - , {'\x95', u'\u2022'} // BULLET - , {'\x96', u'\u2013'} // EN DASH - , {'\x97', u'\u2014'} // EM DASH - , {'\x98', u'\u02DC'} // SMALL TILDE - , {'\x99', u'\u2122'} // TRADE MARK SIGN - , {'\x9A', u'\u0161'} // LATIN SMALL LETTER S WITH CARON - , {'\x9B', u'\u203A'} // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - , {'\x9C', u'\u0153'} // LATIN SMALL LIGATURE OE - , {'\x9D', u'\u009D'} // UNDEFINED - , {'\x9E', u'\u017E'} // LATIN SMALL LETTER Z WITH CARON - , {'\x9F', u'\u0178'} // LATIN CAPITAL LETTER Y WITH DIAERESIS - - , {'\xA0', u'\u00A0'} // NO-BREAK SPACE - , {'\xA1', u'\u00A1'} // INVERTED EXCLAMATION MARK - , {'\xA2', u'\u00A2'} // CENT SIGN - // ... - , {'\xFE', u'\u00FE'} // LATIN SMALL LETTER THORN - , {'\xFF', u'\u00FF'} // LATIN SMALL LETTER Y WITH DIAERESIS - }; - std::string running_w1252; - std::u16string running_utf16; - for (auto&& ch : w1252_to_utf16) - { - TEST_ASSERT_LESSER_EQ(static_cast(ch.first), 0xff); - TEST_ASSERT_LESSER_EQ(static_cast(ch.second), 0xffff); - - const std::string w1252{ch.first}; - const std::u16string utf16{ch.second}; - test_Windows1252_(testName, w1252.c_str(), utf16.c_str()); - - running_w1252 += w1252; - running_utf16 += utf16; - test_Windows1252_(testName, running_w1252.c_str(), running_utf16.c_str()); - } -} - -static void test_EncodedStringView_(const std::string& testName, - const str::EncodedStringView& utf_8_view, const str::EncodedStringView& iso8859_1_view) -{ - (void)testName; - TEST_ASSERT_EQ(iso8859_1_view, iso8859_1_view); - TEST_ASSERT_EQ(utf_8_view, utf_8_view); - TEST_ASSERT_EQ(iso8859_1_view, utf_8_view); - TEST_ASSERT_EQ(utf_8_view, iso8859_1_view); - - TEST_ASSERT_EQ(iso8859_1_view.native(), utf_8_view.native()); - const auto native = classificationText_platform(); - TEST_ASSERT_EQ(iso8859_1_view.native(), native); - TEST_ASSERT_EQ(utf_8_view.native(), native); - - TEST_ASSERT(utf_8_view == classificationText_utf_8()); - TEST_ASSERT_EQ(utf_8_view, classificationText_utf_8()); - TEST_ASSERT(iso8859_1_view == classificationText_utf_8()); - TEST_ASSERT_EQ(iso8859_1_view, classificationText_utf_8()); - TEST_ASSERT(iso8859_1_view.u8string() == utf_8_view.u8string()); - - const auto expected = str::EncodedString::details::string(classificationText_utf_8()); - { - const auto actual = utf_8_view.asUtf8(); - TEST_ASSERT_EQ(actual, expected); - } - { - const auto actual = iso8859_1_view.asUtf8(); - TEST_ASSERT_EQ(actual, expected); - } -} -TEST_CASE(test_EncodedStringView) -{ - str::EncodedStringView esv; - auto copy(esv); - copy = esv; // assignment - - { - auto utf_8_view(classificationText_utf_8().view()); - auto iso8859_1_view(classificationText_iso8859_1().view()); - test_EncodedStringView_(testName, utf_8_view, iso8859_1_view); - - utf_8_view = classificationText_iso8859_1().view(); - iso8859_1_view = classificationText_utf_8().view(); - test_EncodedStringView_(testName, utf_8_view, iso8859_1_view); - } - { - auto utf_8_view = classificationText_utf_8().view(); - auto iso8859_1_view = classificationText_iso8859_1().view(); - test_EncodedStringView_(testName, utf_8_view, iso8859_1_view); - - utf_8_view = classificationText_iso8859_1().view(); - iso8859_1_view = classificationText_utf_8().view(); - test_EncodedStringView_(testName, utf_8_view, iso8859_1_view); - } - { - str::EncodedStringView utf_8_view; - utf_8_view = classificationText_iso8859_1().view(); - str::EncodedStringView iso8859_1_view; - iso8859_1_view = classificationText_utf_8().view(); - test_EncodedStringView_(testName, utf_8_view, iso8859_1_view); - } -} - -TEST_CASE(test_EncodedString) -{ - str::EncodedString es; - TEST_ASSERT_TRUE(es.empty()); - TEST_ASSERT_TRUE(es.native().empty()); - { - str::EncodedString es_copy(es); // copy - TEST_ASSERT_TRUE(es_copy.empty()); - TEST_ASSERT_TRUE(es_copy.native().empty()); - } - es = str::EncodedString("abc"); // assignment - TEST_ASSERT_EQ(es.native(), "abc"); - { - str::EncodedString es_copy(es); // copy, again; this time w/o default content - TEST_ASSERT_EQ(es_copy.native(), "abc"); - } - - str::EncodedString abc(es); // copy, for use below - TEST_ASSERT_EQ(abc.native(), "abc"); - - str::EncodedString es2; - es = std::move(es2); // move assignment - TEST_ASSERT_TRUE(es.empty()); - TEST_ASSERT_TRUE(es.native().empty()); - str::EncodedString abc_(abc); // copy - es = std::move(abc_); // move assignment, w/o default content - TEST_ASSERT_EQ(es.native(), "abc"); - - str::EncodedString es3(std::move(abc)); // move constructor - TEST_ASSERT_EQ(es3.native(), "abc"); -} - -TEST_MAIN( - TEST_CHECK(testConvert); - TEST_CHECK(testBadConvert); - TEST_CHECK(testEightBitIntToString); - TEST_CHECK(testCharToString); - TEST_CHECK(test_string_to_u8string_ascii); - TEST_CHECK(test_string_to_u8string_windows_1252); - TEST_CHECK(test_string_to_u8string_iso8859_1); - TEST_CHECK(test_change_case); - TEST_CHECK(test_u8string_to_string); - TEST_CHECK(test_u8string_to_u16string); - TEST_CHECK(test_u8string_to_u32string); - TEST_CHECK(test_ASCII); - TEST_CHECK(test_Windows1252_WIN32); - TEST_CHECK(test_Windows1252); - TEST_CHECK(test_EncodedStringView); - TEST_CHECK(test_EncodedString); - ) +/* ========================================================================= + * This file is part of str-c++ + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * + * str-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + +#include + +#include +#include +#include +#include +#if _WIN32 +#include +#endif + +#include +#include +#include +#include +#include + +#include "TestCase.h" + +inline static void test_assert_eq(const std::string& testName, const std::u8string& actual, const std::u32string& expected) +{ + TEST_ASSERT_EQ(actual, str::to_u8string(expected)); +} + +TEST_CASE(testConvert) +{ + TEST_ASSERT_EQ(str::toType("0x3BC7", 16), gsl::narrow(0x3BC7)); + TEST_ASSERT_EQ(str::toType("1101", 2), gsl::narrow(13)); + TEST_ASSERT_EQ(str::toType("231", 5), gsl::narrow(66)); + TEST_ASSERT_EQ(str::toType("0xFFFFFFFFFFFFFFFF", 16), + gsl::narrow(0xFFFFFFFFFFFFFFFF)); + TEST_ASSERT_EQ(str::toType("-10", 10), + gsl::narrow_cast(-10)); + TEST_ASSERT_EQ(str::toType("13", 4), gsl::narrow(7)); +} + +TEST_CASE(testBadConvert) +{ + TEST_EXCEPTION(str::toType("Not a number", 10)); + TEST_EXCEPTION(str::toType("0xFFFFFFFFFFFFFFFF", 16)); + TEST_EXCEPTION(str::toType("0xFFFFF", 16)); +} + +TEST_CASE(testEightBitIntToString) +{ + TEST_ASSERT_EQ(std::to_string(static_cast(1)), "1"); + TEST_ASSERT_EQ(std::to_string(static_cast(2)), "2"); + TEST_ASSERT_EQ(std::to_string(static_cast(-2)), "-2"); +} + +TEST_CASE(testCharToString) +{ + TEST_ASSERT_EQ(str::toString('a'), "a"); + TEST_ASSERT_EQ(str::toString(static_cast(65)), "A"); +} + +template +static constexpr std::u8string::value_type cast8(T ch) +{ + using u8ch_t = std::u8string::value_type; + static_assert(sizeof(u8ch_t) == sizeof(char), "sizeof(Char8_T) != sizeof(char)"); + return static_cast(ch); +} + +TEST_CASE(test_string_to_u8string_ascii) +{ + { + const std::string input = "|\x00"; // ASCII, "|" + const auto actual = str::to_u8string(input); + const std::u8string expected{cast8('|')}; // '\x00' is the end of the string in C/C++ + TEST_ASSERT_EQ(actual, expected); + } + constexpr uint8_t start_of_heading = 0x01; + constexpr uint8_t delete_character = 0x7f; + for (uint8_t ch = start_of_heading; ch <= delete_character; ch++) // ASCII + { + const std::string input { '|', static_cast(ch), '|'}; + const auto actual = str::to_u8string(input); + const std::u8string expected8{cast8('|'), cast8(ch), cast8('|')}; + TEST_ASSERT_EQ(actual, expected8); + const std::u32string expected{U'|', ch, U'|'}; + test_assert_eq(testName, actual, expected); + } +} + +static void test_string_to_u8string_windows_1252_(const std::string& testName, const std::string& input_) +{ + const auto input(str::str(input_)); + const auto actual = str::to_u8string(input); + + // No "expected" to test against as the UTF-8 values for these Windows-1252 characters + // are mapped one-by-one. However, we can test that UTF-8 to Windows-1252 + // works as that walks through a UTF-8 string which can have 1-, 2-, 3- and 4-bytes + // for a single code-point. + const auto w1252 = str::to_w1252string(actual.data(), actual.size()); + TEST_ASSERT(input == w1252); +} +TEST_CASE(test_string_to_u8string_windows_1252) +{ + // Windows-1252 only characters must be mapped to UTF-8 + { + const std::string input = "|\x80|"; // Windows-1252, "||" + const auto actual = str::to_u8string(input); + const std::u8string expected8{cast8('|'), cast8('\xE2'), cast8('\x82'), cast8('\xAC'), cast8('|')}; // UTF-8, "||" + TEST_ASSERT_EQ(actual, expected8); + const std::u32string expected{U"|\u20AC|"}; // UTF-32, "||" + test_assert_eq(testName, actual, expected); + } + { + const std::string input = "|\x9F|"; // Windows-1252, "||" + const auto actual = str::to_u8string(input); + const std::u8string expected8{cast8('|'), cast8('\xC5'), cast8('\xB8'), cast8('|')}; // UTF-8, "||" + TEST_ASSERT_EQ(actual, expected8); + const std::u32string expected{U"|\u0178|"}; // UTF-32, "||" + test_assert_eq(testName, actual, expected); + } + { + const std::vector undefined{ '\x81', '\x8d', '\x8f', '\x90', '\x9d' }; + for (const auto& ch : undefined) + { + const std::string input{'|', ch, '|'}; + const auto actual = str::to_u8string(input); + TEST_ASSERT_TRUE(!actual.empty()); + //const std::u8string expected8{cast8('|'), cast8('\xEF'), cast8('\xBF'), cast8('\xBD'), cast8('|')}; // UTF-8, "||" + const std::u8string expected8{cast8('|'), cast8(194), cast8(ch), cast8('|')}; + TEST_ASSERT_EQ(actual, expected8); + //const std::u32string expected{U"|\ufffd|"}; // UTF-32, "||" + const auto expected = str::to_u32string(expected8); + test_assert_eq(testName, actual, expected); + } + } + { + // http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT + const std::vector windows1252_characters{ + 0x80, // EURO SIGN + 0x82, // SINGLE LOW-9 QUOTATION MARK + 0x83, // LATIN SMALL LETTER F WITH HOOK + 0x84, // DOUBLE LOW-9 QUOTATION MARK + 0x85, // HORIZONTAL ELLIPSIS + 0x86, // DAGGER + 0x87, // DOUBLE DAGGER + 0x88, // MODIFIER LETTER CIRCUMFLEX ACCENT + 0x89, // PER MILLE SIGN + 0x8A, // LATIN CAPITAL LETTER S WITH CARON + 0x8B, // SINGLE LEFT-POINTING ANGLE QUOTATION MARK + 0x8C, // LATIN CAPITAL LIGATURE OE + 0x8E, // LATIN CAPITAL LETTER Z WITH CARON + 0x91, // LEFT SINGLE QUOTATION MARK + 0x92, // RIGHT SINGLE QUOTATION MARK + 0x93, // LEFT DOUBLE QUOTATION MARK + 0x94, // RIGHT DOUBLE QUOTATION MARK + 0x95, // BULLET + 0x96, // EN DASH + 0x97, // EM DASH + 0x98, // SMALL TILDE + 0x99, // TRADE MARK SIGN + 0x9A, // LATIN SMALL LETTER S WITH CARON + 0x9B, // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + 0x9C, // LATIN SMALL LIGATURE OE + 0x9E, // LATIN SMALL LETTER Z WITH CARON + 0x9F}; // LATIN CAPITAL LETTER Y WITH DIAERESIS + std::string runningInput1; + std::string runningInput2; + for (const auto& ch_ : windows1252_characters) + { + const auto ch = static_cast(ch_); + const std::string input_{'[', ch, ']'}; + test_string_to_u8string_windows_1252_(testName, input_); + + runningInput1 += ch; + test_string_to_u8string_windows_1252_(testName, runningInput1); + + runningInput2 += input_; + test_string_to_u8string_windows_1252_(testName, runningInput2); + test_string_to_u8string_windows_1252_(testName, runningInput1+runningInput2); + test_string_to_u8string_windows_1252_(testName, runningInput2+runningInput1); + } + } +} + +TEST_CASE(test_string_to_u8string_iso8859_1) +{ + constexpr uint8_t nobreak_space = 0xa0; + constexpr uint8_t latin_small_letter_y_with_diaeresis = 0xff; // '' + for (uint32_t ch = nobreak_space; ch <= latin_small_letter_y_with_diaeresis; ch++) // ISO8859-1 + { + const std::string input_ { '|', static_cast(ch), '|'}; + const auto input(str::str(input_)); + const auto actual = to_u8string(input); + const std::u32string expected{U'|', ch, U'|'}; + test_assert_eq(testName, actual, expected); + + TEST_ASSERT(str::to_u8string(input) == actual); + TEST_ASSERT(input == str::to_w1252string(actual)); + } +} + +template +static void test_change_case_(const std::string& testName, const TString& lower, const TString& upper) +{ + auto s = upper; + str::lower(s); + TEST_ASSERT(s == lower); + s = lower; + str::upper(s); + TEST_ASSERT(s == upper); + + s = upper; + str::upper(s); + TEST_ASSERT(s == upper); + s = lower; + str::lower(s); + TEST_ASSERT(s == lower); +} +TEST_CASE(test_change_case) +{ + const std::string ABC = "ABC"; + const std::string abc = "abc"; + test_change_case_(testName, abc, ABC); + + //const std::wstring ABC_w = L"ABC"; + //const std::wstring abc_w = L"abc"; + //test_change_case_(testName, abc_w, ABC_w); + + //// Yes, this can really come up, "non classifi" is French (Canadian) for "unclassified". + //const std::string DEF_1252{'D', '\xc9', 'F'}; // "DF" Windows-1252 + //const auto DEF8 = from_windows1252(DEF_1252); + + //const std::string def_1252{'d', '\xe9', 'f'}; // "df" Windows-1252 + //const auto def8 = from_windows1252(def_1252); + + ////test_change_case_(testName, def, DEF); + //test_change_case_(testName, def_1252, DEF_1252); +} + +// https://en.wikipedia.org/wiki/%C3%89#Character_mappings +static const coda_oss::u8string& classificationText_u8() +{ + static const auto retval(str::make_string("A\xc3\x89IOU")); // UTF-8 "AIOU" + return retval; + } + +static const str::W1252string& classificationText_w1252() + { + static const auto retval(str::make_string("A\xc9IOU")); // ISO8859-1 "AIOU" + return retval; + } + + static auto toString(const coda_oss::u8string& s) + { + return str::to_native(s); + } + +// UTF-16 on Windows, UTF-32 on Linux +static const wchar_t* classificationText_wide_() { return L"A\x00c9IOU"; } // "wide characters" "AIOU" +static std::u16string classificationText_u16() { return u"A\u00c9IOU"; } // UTF-16 "AIOU" +static std::u32string classificationText_u32() { return U"A\u00c9IOU"; } // UTF-32 "AIOU" + +static std::string classificationText_platform() { return + sys::Platform == sys::PlatformType::Linux ? toString(classificationText_u8()) : str::testing::to_string(classificationText_w1252()); } + +TEST_CASE(test_u8string_to_string) +{ + auto actual = toString(classificationText_u8()); + TEST_ASSERT_EQ(classificationText_platform(), actual); + + actual = str::testing::to_string(classificationText_w1252()); + TEST_ASSERT_EQ(classificationText_platform(), actual); +} + +static auto w1252FromNative(const std::wstring& s) +{ + return str::to_w1252string(str::u8FromNative(s)); +} +static auto toWString(const str::W1252string& s) +{ + return str::testing::to_wstring(s); +} +static auto toWString(const coda_oss::u8string& s) +{ + return str::details::to_wstring(s); +} + +TEST_CASE(test_u8string_to_u16string) +{ + const auto actual = classificationText_u16(); + const std::wstring wide(classificationText_wide_()); + #if _WIN32 + const auto s = str::str(actual); // Windows: std::wstring == std::u16string + TEST_ASSERT(wide == s); // _EQ wants to do toString() + #endif + + const auto u8 = classificationText_u8(); + TEST_ASSERT(str::u8FromNative(wide) == u8); + TEST_ASSERT(wide == toWString(u8)); + + const auto w1252 = str::c_str(classificationText_w1252()); + TEST_ASSERT(w1252FromNative(wide) == w1252); + TEST_ASSERT(wide == toWString(w1252)); + + TEST_ASSERT(classificationText_u16() == actual); // _EQ wants to do toString() + TEST_ASSERT(classificationText_u16() == to_u16string(w1252)); // _EQ wants to do toString() +} + +TEST_CASE(test_u8string_to_u32string) +{ + const auto actual = classificationText_u32(); +#if !_WIN32 + const auto s = str::str(actual); // Linux: std::wstring == std::u32string + TEST_ASSERT(classificationText_wide_() == s); // _EQ wants to do toString() + #endif + + const std::wstring wide(classificationText_wide_()); + const auto u8 = classificationText_u8(); + TEST_ASSERT(str::u8FromNative(wide) == u8); + TEST_ASSERT(wide == toWString(u8)); + + const auto w1252 = str::c_str(classificationText_w1252()); + TEST_ASSERT(w1252FromNative(wide) == w1252); + TEST_ASSERT(wide == toWString(w1252)); + + TEST_ASSERT(classificationText_u32() == actual); // _EQ wants to do toString() + TEST_ASSERT(classificationText_u32() == to_u32string(w1252)); // _EQ wants to do toString() +} + +static auto toWString(const std::u16string& s) +{ + return toWString(str::to_u8string(s)); +} +static auto toWString(const std::string& s) +{ + return str::details::to_wstring(s); +} +static auto toString(const std::u16string& s) +{ + return str::details::to_string(str::to_u8string(s)); +} + +static void test_wide_(const std::string& testName, const char* pStr, std::u16string::const_pointer pUtf16, + const std::wstring& wstring, const std::string& native, const str::W1252string& w1252) +{ + // from UTF-16 back to Windows-1252 + const auto str_w1252 = str::str(w1252); + TEST_ASSERT_EQ(str_w1252, pStr); + + #if _WIN32 + // Since we're using UTF-16, on Windows that can be cast to wchar_t + const auto wide = str::make_string(pUtf16); + + const _bstr_t str(pStr); + const std::wstring std_wstr(static_cast(str)); // Windows-1252 -> UTF-16 + TEST_ASSERT(wstring == std_wstr); + TEST_ASSERT(std_wstr == wide); + + const _bstr_t wide_str(wide.c_str()); + const std::string std_str(static_cast(wide_str)); // UTF-16 -> Windows-1252 + TEST_ASSERT_EQ(native, std_str); + TEST_ASSERT_EQ(std_str, pStr); + #else + CODA_OSS_mark_symbol_unused(pUtf16); + CODA_OSS_mark_symbol_unused(wstring); + CODA_OSS_mark_symbol_unused(native); + #endif +} +static void test_Windows1252_ascii(const std::string& testName, const char* pStr, std::u16string::const_pointer pUtf16) +{ + // For both UTF-8 and Windows-1252, ASCII is the same (they only differ for 0x80-0xff). + const auto u8 = str::str(str::to_u8string(pStr)); + TEST_ASSERT_EQ(pStr, u8); // native() is the same on all platforms/encodings for ASCII + { + const auto w1252 = str::make_string(pStr); + const auto str1252 = str::testing::to_string(w1252); + TEST_ASSERT_EQ(pStr, str1252); // native() is the same on all platforms/encodings for ASCII + } + + const auto u16 = str::to_u16string(str::u8FromNative(pStr)); + TEST_ASSERT(u16 == pUtf16); + auto wstring = toWString(pStr); + std::string native = pStr; + auto w1252 = str::make_string(pStr); + test_wide_(testName, pStr, pUtf16, wstring, native, w1252); + + native = toString(pUtf16); + TEST_ASSERT_EQ(native, pStr); // native() is the same on all platforms/encodings for ASCII + wstring = toWString(pUtf16); + test_wide_(testName, pStr, pUtf16, wstring, native, w1252); +} +TEST_CASE(test_ASCII) +{ + // https://en.cppreference.com/w/cpp/language/escape + constexpr auto escapes = "|\'|\"|\?|\\|\a|\b|\f|\n|\r|\t|\v|"; + constexpr auto u16_escapes = u"|\'|\"|\?|\\|\a|\b|\f|\n|\r|\t|\v|"; + test_Windows1252_ascii(testName, escapes, u16_escapes); + + // https://en.cppreference.com/w/cpp/language/escape + constexpr auto controls = "|\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x09|\x0a|\x0b|\x0c|\x0d|\x0e|\x0f" + "|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1a|\x1b|\x1c|\x1d|\x1e|\x1f"; + constexpr auto u16_controls = u"|\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x09|\x0a|\x0b|\x0c|\x0d|\x0e|\x0f" + u"|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1a|\x1b|\x1c|\x1d|\x1e|\x1f"; + test_Windows1252_ascii(testName, controls, u16_controls); + + // https://en.cppreference.com/w/cpp/language/ascii + constexpr auto ascii = " !\"#0@AZaz~\x7f"; + constexpr auto u16_ascii = u" !\"#0@AZaz~\x7f"; + test_Windows1252_ascii(testName, ascii, u16_ascii); +} + +static auto to_w1252string(const std::u16string& s) +{ + return str::to_w1252string(str::to_u8string(s)); +} +inline static auto toString(const std::wstring& s) +{ + return str::details::to_string(s); +} + +static void test_Windows1252_(const std::string& testName, const char* pStr, std::u16string::const_pointer pUtf16) +{ + const auto u16 = str::to_u16string(str::to_u8string(pStr)); + TEST_ASSERT(u16 == pUtf16); + auto wstring = toWString(str::to_u8string(pStr)); + auto s = toString(str::to_u8string(pStr)); + auto w1252 = str::make_string(pStr); + test_wide_(testName, pStr, pUtf16, wstring, s, w1252); + + wstring = toWString(pUtf16); + s = toString(pUtf16); + w1252 = to_w1252string(pUtf16); + test_wide_(testName, pStr, pUtf16, wstring, s, w1252); +} +TEST_CASE(test_Windows1252_WIN32) +{ + // https://en.wikipedia.org/wiki/Windows-1252 + #if _WIN32 + // can convert with bit-twiddling + constexpr auto w1252_a1_ff = ""; // + //constexpr auto w1252_a1_ff = "\xa1\xa2\xfe\xff"; + constexpr auto u16_w1252_a1_ff = u"\u00a1\u00a2\u00fe\u00ff"; + test_Windows1252_(testName, w1252_a1_ff, u16_w1252_a1_ff); + + constexpr auto w1252 = ""; // these values must be mapped + //constexpr auto w1252 = "\x80\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8e" // these values must be mapped + // "\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9e\x9f"; + constexpr auto u16_utf8 = u"\u20ac\u201a\u0192\u201e\u2026\u2020\u2021\u02c6\u2030\u0160\u2039\u0152\u017d" + "\u2018\u2019\u201c\u201d\u2022\u2013\u2014\u02dc\u2122\u0161\u203a\u0153\u017e\u0178"; + test_Windows1252_(testName, w1252, u16_utf8); + + // This only works with "relaxed" (i.e., not "strict") conversion; which is what _bstr_t does + constexpr auto w1252_unassigned = "\x81\x8d\x8f\x90\x9d"; + constexpr auto u16_w1252_unassigned = u"\x81\x8d\x8f\x90\x9d"; + test_Windows1252_(testName, w1252_unassigned, u16_w1252_unassigned); + #else + TEST_ASSERT_TRUE(true); // need to use hidden "testName" parameter + #endif +} + +TEST_CASE(test_Windows1252) +{ + // https://en.wikipedia.org/wiki/Windows-1252 + const std::map + w1252_to_utf16{ + {'\x80', u'\u20AC'} // EURO SIGN + , {'\x81', u'\u0081'} // UNDEFINED + , {'\x82', u'\u201A'} // SINGLE LOW-9 QUOTATION MARK + , {'\x83', u'\u0192'} // LATIN SMALL LETTER F WITH HOOK + , {'\x84', u'\u201E'} // DOUBLE LOW-9 QUOTATION MARK + , {'\x85', u'\u2026'} // HORIZONTAL ELLIPSIS + , {'\x86', u'\u2020'} // DAGGER + , {'\x87', u'\u2021'} // DOUBLE DAGGER + , {'\x88', u'\u02C6'} // MODIFIER LETTER CIRCUMFLEX ACCENT + , {'\x89', u'\u2030'} // PER MILLE SIGN + , {'\x8A', u'\u0160'} // LATIN CAPITAL LETTER S WITH CARON + , {'\x8B', u'\u2039'} // SINGLE LEFT-POINTING ANGLE QUOTATION MARK + , {'\x8C', u'\u0152'} // LATIN CAPITAL LIGATURE OE + , {'\x81', u'\u0081'} // UNDEFINED + , {'\x8E', u'\u017D'} // LATIN CAPITAL LETTER Z WITH CARON + , {'\x8F', u'\u008F'} // UNDEFINED + , {'\x90', u'\u0090'} // UNDEFINED + , {'\x91', u'\u2018'} // LEFT SINGLE QUOTATION MARK + , {'\x92', u'\u2019'} // RIGHT SINGLE QUOTATION MARK + , {'\x93', u'\u201C'} // LEFT DOUBLE QUOTATION MARK + , {'\x94', u'\u201D'} // RIGHT DOUBLE QUOTATION MARK + , {'\x95', u'\u2022'} // BULLET + , {'\x96', u'\u2013'} // EN DASH + , {'\x97', u'\u2014'} // EM DASH + , {'\x98', u'\u02DC'} // SMALL TILDE + , {'\x99', u'\u2122'} // TRADE MARK SIGN + , {'\x9A', u'\u0161'} // LATIN SMALL LETTER S WITH CARON + , {'\x9B', u'\u203A'} // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK + , {'\x9C', u'\u0153'} // LATIN SMALL LIGATURE OE + , {'\x9D', u'\u009D'} // UNDEFINED + , {'\x9E', u'\u017E'} // LATIN SMALL LETTER Z WITH CARON + , {'\x9F', u'\u0178'} // LATIN CAPITAL LETTER Y WITH DIAERESIS + + , {'\xA0', u'\u00A0'} // NO-BREAK SPACE + , {'\xA1', u'\u00A1'} // INVERTED EXCLAMATION MARK + , {'\xA2', u'\u00A2'} // CENT SIGN + // ... + , {'\xFE', u'\u00FE'} // LATIN SMALL LETTER THORN + , {'\xFF', u'\u00FF'} // LATIN SMALL LETTER Y WITH DIAERESIS + }; + std::string running_w1252; + std::u16string running_utf16; + for (auto&& ch : w1252_to_utf16) + { + TEST_ASSERT_LESSER_EQ(static_cast(ch.first), 0xff); + TEST_ASSERT_LESSER_EQ(static_cast(ch.second), 0xffff); + + const std::string w1252{ch.first}; + const std::u16string utf16{ch.second}; + test_Windows1252_(testName, w1252.c_str(), utf16.c_str()); + + running_w1252 += w1252; + running_utf16 += utf16; + test_Windows1252_(testName, running_w1252.c_str(), running_utf16.c_str()); + } + + #if _WIN32 + // This only works on Windows because the "assume encoding" APIs are used. + for (auto&& ch : w1252_to_utf16) + { + const std::string expected(1, ch.first); + const std::wstring input(1, ch.second); // `std::wstring` is UTF-16 on Windows + const auto actual = toString(input); + TEST_ASSERT_EQ(expected, actual); + } + #endif +} + +static void test_Encodeding_(const std::string& testName, const coda_oss::u8string& classificationText_u8, + const std::string& utf_8, const std::string& iso8859_1, + const coda_oss::u8string& utf_8_u8, const coda_oss::u8string& iso8859_1_u8, + const std::string& utf_8_view, const std::string& iso8859_1_view) +{ + TEST_ASSERT_EQ(iso8859_1, utf_8); + static const auto s = classificationText_platform(); + TEST_ASSERT_EQ(iso8859_1, s); + TEST_ASSERT_EQ(utf_8, s); + + TEST_ASSERT(iso8859_1_u8 == utf_8_u8); + + const auto expected = str::c_str(classificationText_u8); + TEST_ASSERT_EQ(utf_8_view, expected); + TEST_ASSERT_EQ(iso8859_1_view, expected); +} +TEST_CASE(test_Encoding) +{ + const auto utf_8 = toString(classificationText_u8()); + const auto iso8859_1 = str::testing::to_string(classificationText_w1252()); + const auto utf_8_u8 = classificationText_u8(); + const auto iso8859_1_u8 = str::to_u8string(classificationText_w1252()); + const auto utf_8_view = str::str(classificationText_u8()); + const auto iso8859_1_view = str::str(str::to_u8string(classificationText_w1252())); + + test_Encodeding_(testName, classificationText_u8(), + utf_8, iso8859_1, + utf_8_u8, iso8859_1_u8, + utf_8_view, iso8859_1_view); + test_Encodeding_(testName, classificationText_u8(), + iso8859_1, utf_8, + iso8859_1_u8, utf_8_u8, + iso8859_1_view, utf_8_view); +} + +TEST_MAIN( + TEST_CHECK(testConvert); + TEST_CHECK(testBadConvert); + TEST_CHECK(testEightBitIntToString); + TEST_CHECK(testCharToString); + TEST_CHECK(test_string_to_u8string_ascii); + TEST_CHECK(test_string_to_u8string_windows_1252); + TEST_CHECK(test_string_to_u8string_iso8859_1); + TEST_CHECK(test_change_case); + TEST_CHECK(test_u8string_to_string); + TEST_CHECK(test_u8string_to_u16string); + TEST_CHECK(test_u8string_to_u32string); + TEST_CHECK(test_ASCII); + TEST_CHECK(test_Windows1252_WIN32); + TEST_CHECK(test_Windows1252); + TEST_CHECK(test_Encoding); + ) diff --git a/externals/coda-oss/modules/c++/str/unittests/test_str.cpp b/externals/coda-oss/modules/c++/str/unittests/test_str.cpp index a3381632d8..2d00862d8e 100644 --- a/externals/coda-oss/modules/c++/str/unittests/test_str.cpp +++ b/externals/coda-oss/modules/c++/str/unittests/test_str.cpp @@ -21,6 +21,7 @@ */ #include // std::ignore +#include #include #include @@ -28,11 +29,6 @@ #include "TestCase.h" -inline std::string to_string(const std::string& value) -{ - return value; -} - TEST_CASE(testTrim) { std::string s = " test "; @@ -130,9 +126,9 @@ TEST_CASE(testSplit) { std::string s = "space delimited values are the best!"; std::vector parts = str::split(s, " "); - TEST_ASSERT_EQ(parts.size(), static_cast(6)); + TEST_ASSERT_EQ(std::ssize(parts), 6); parts = str::split(s, " ", 3); - TEST_ASSERT_EQ(parts.size(), static_cast(3)); + TEST_ASSERT_EQ(std::ssize(parts), 3); TEST_ASSERT_EQ(parts[2], "values are the best!"); } @@ -277,7 +273,7 @@ TEST_CASE(test_toStringComplexShort) actual = str::toString(types_cx_short); TEST_ASSERT_EQ(actual, expected); - const types::zint16_t zint16(1, -2); + const types::Complex zint16(1, -2); actual = str::toString(zint16); TEST_ASSERT_EQ(actual, expected); } @@ -303,7 +299,7 @@ TEST_CASE(test_toTypeComplexShort) strActual = str::toString(zactual); TEST_ASSERT_EQ(strActual, strValue); - zactual = str::toType(strValue); + zactual = str::toType>(strValue); strActual = str::toString(zactual); TEST_ASSERT_EQ(strActual, strValue); } diff --git a/externals/coda-oss/modules/c++/sys/include/import/sys.h b/externals/coda-oss/modules/c++/sys/include/import/sys.h index e81f7e1863..85e69eb6ca 100644 --- a/externals/coda-oss/modules/c++/sys/include/import/sys.h +++ b/externals/coda-oss/modules/c++/sys/include/import/sys.h @@ -20,10 +20,9 @@ * */ - -#ifndef __IMPORT_SYS_H__ -#define __IMPORT_SYS_H__ #pragma once +#ifndef CODA_OSS_import_sys_h_INCLUDED_ +#define CODA_OSS_import_sys_h_INCLUDED_ #include "sys/AtomicCounter.h" #include "sys/ConditionVar.h" @@ -54,12 +53,11 @@ \file sys.h -The sys library servers the purpose of creating a common, system-indepenent +The sys library servers the purpose of creating a common, system-independent interface layer for cross-platform applications. It currently supports UNIX and Windows, and provides interfaces for sockets, threads, synchronization, conditions, time and operating system-specific function calls. */ -#endif - +#endif // CODA_OSS_import_sys_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/sys/include/sys/AbstractOS.h b/externals/coda-oss/modules/c++/sys/include/sys/AbstractOS.h index 1b040790e0..efd80de08b 100644 --- a/externals/coda-oss/modules/c++/sys/include/sys/AbstractOS.h +++ b/externals/coda-oss/modules/c++/sys/include/sys/AbstractOS.h @@ -63,6 +63,20 @@ enum class SIMDInstructionSet AVX512F, // https://en.wikipedia.org/wiki/AVX-512 }; +constexpr auto getSIMDInstructionSet() { return SIMDInstructionSet:: + // https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170 + + #if __AVX512F__ + AVX512F + #elif __AVX2__ + AVX2 + #elif _M_X64 /*MSVC*/ || __SSE2__ /*GCC*/ + SSE2 + #else + #error "Can't determine SIMDInstructionSet'" + #endif +; } + /*! * \class AbstractOS * \brief Interface for system independent function calls diff --git a/externals/coda-oss/modules/c++/sys/include/sys/ByteSwap.h b/externals/coda-oss/modules/c++/sys/include/sys/ByteSwap.h index 6b135288d8..04325c116f 100644 --- a/externals/coda-oss/modules/c++/sys/include/sys/ByteSwap.h +++ b/externals/coda-oss/modules/c++/sys/include/sys/ByteSwap.h @@ -91,6 +91,8 @@ inline void check_elemSize(size_t elemSize) template inline auto make_span(coda_oss::span> s) { + //static_assert(std::is_floating_point::value, "std::complex should use floating-point"); + const void* const p_ = s.data(); auto const p = static_cast(p_); const auto sz = s.size() * 2; // real and imag @@ -99,6 +101,8 @@ inline auto make_span(coda_oss::span> s) template inline auto make_span(coda_oss::span> s) { + //static_assert(std::is_floating_point::value, "std::complex should use floating-point"); + void* const p_ = s.data(); auto const p = static_cast(p_); const auto sz = s.size() * 2; // real and imag @@ -118,6 +122,8 @@ inline void byteSwap(T* buffer, size_t elemSize, size_t numElems) template inline void byteSwap(std::complex* buffer, size_t elemSize, size_t numElems) // dont't want `T` as `std::complex<...>` { + //static_assert(std::is_floating_point::value, "std::complex should use floating-point"); + details::check_elemSize(elemSize); void* const buffer_ = buffer; byteSwap(buffer_, elemSize, numElems); @@ -188,6 +194,8 @@ inline void byteSwap(const T* buffer, size_t elemSize, size_t numElems, U* outpu template inline void byteSwap(const std::complex* buffer, size_t elemSize, size_t numElems, U* outputBuffer) // dont't want `T` as `std::complex<...>` { + //static_assert(std::is_floating_point::value, "std::complex should use floating-point"); + details::check_elemSize(elemSize); const void* const buffer_ = buffer; void* const outputBuffer_ = outputBuffer; @@ -226,6 +234,8 @@ inline auto byteSwap(coda_oss::span> buffer) template inline auto byteSwapValue(std::complex z) { + //static_assert(std::is_floating_point::value, "std::complex should use floating-point"); + // C++ mandates that `std::complex` be the same as `T cx[2]`; that is // the structure is contiguous. https://en.cppreference.com/w/cpp/numeric/complex const auto& z_ = reinterpret_cast(z); diff --git a/externals/coda-oss/modules/c++/sys/include/sys/Conf.h b/externals/coda-oss/modules/c++/sys/include/sys/Conf.h index 45cf7da292..3469b69cf4 100644 --- a/externals/coda-oss/modules/c++/sys/include/sys/Conf.h +++ b/externals/coda-oss/modules/c++/sys/include/sys/Conf.h @@ -156,8 +156,6 @@ namespace sys #include "except/Exception.h" -#define FmtX str::format - #define SYS_FUNC NativeLayer_func__ #define Ctxt(MESSAGE) except::Context(__FILE__, __LINE__, SYS_FUNC, \ @@ -219,9 +217,7 @@ namespace sys #error "Don't know how to implement alignedAlloc()." #endif if (!p) - throw except::Exception(Ctxt( - "Aligned allocation failure of size [" + - str::toString(size) + "] bytes")); + throw except::Exception(Ctxt("Aligned allocation failure of size [" + std::to_string(size) + "] bytes")); return p; } diff --git a/externals/coda-oss/modules/c++/sys/include/sys/DirectoryEntry.h b/externals/coda-oss/modules/c++/sys/include/sys/DirectoryEntry.h index 5d079af2f8..b15a252de0 100644 --- a/externals/coda-oss/modules/c++/sys/include/sys/DirectoryEntry.h +++ b/externals/coda-oss/modules/c++/sys/include/sys/DirectoryEntry.h @@ -20,9 +20,9 @@ * */ - -#ifndef __SYS_DIRECTORY_ENTRY_H__ -#define __SYS_DIRECTORY_ENTRY_H__ +#pragma once +#ifndef CODA_OSS_sys_DirectoryEntry_h_INCLUDED_ +#define CODA_OSS_sys_DirectoryEntry_h_INCLUDED_ #include "except/Exception.h" #include "sys/OS.h" @@ -151,4 +151,4 @@ bool operator==(const sys::DirectoryEntry::Iterator& lhs, bool operator!=(const sys::DirectoryEntry::Iterator& lhs, const sys::DirectoryEntry::Iterator& rhs); -#endif +#endif // CODA_OSS_sys_DirectoryEntry_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/sys/include/sys/File.h b/externals/coda-oss/modules/c++/sys/include/sys/File.h index 0eacf0e320..39f02d3d9e 100644 --- a/externals/coda-oss/modules/c++/sys/include/sys/File.h +++ b/externals/coda-oss/modules/c++/sys/include/sys/File.h @@ -20,9 +20,9 @@ * */ +#pragma once #ifndef CODA_OSS_sys_File_h_INCLUDED_ #define CODA_OSS_sys_File_h_INCLUDED_ -#pragma once #include #include diff --git a/externals/coda-oss/modules/c++/sys/include/sys/Path.h b/externals/coda-oss/modules/c++/sys/include/sys/Path.h index 939ad9f6c7..d7d950202b 100644 --- a/externals/coda-oss/modules/c++/sys/include/sys/Path.h +++ b/externals/coda-oss/modules/c++/sys/include/sys/Path.h @@ -20,9 +20,9 @@ * */ +#pragma once #ifndef CODA_OSS_sys_Path_h_INCLUDED_ #define CODA_OSS_sys_Path_h_INCLUDED_ -#pragma once #include #include diff --git a/externals/coda-oss/modules/c++/sys/include/sys/ThreadInterface.h b/externals/coda-oss/modules/c++/sys/include/sys/ThreadInterface.h index e536fe48e7..cefbf8dcc4 100644 --- a/externals/coda-oss/modules/c++/sys/include/sys/ThreadInterface.h +++ b/externals/coda-oss/modules/c++/sys/include/sys/ThreadInterface.h @@ -132,7 +132,7 @@ struct CODA_OSS_API ThreadInterface : public Runnable // of nasty issues that could pop up (execution in freed memory, etc). if (isRunning()) { - std::cerr << Ctxt(FmtX("Thread object [%s] destructed before " \ + std::cerr << Ctxt(str::Format("Thread object [%s] destructed before " \ "thread terminated, aborting program.", getName().c_str())) << std::endl; abort(); diff --git a/externals/coda-oss/modules/c++/sys/source/AbstractOS.cpp b/externals/coda-oss/modules/c++/sys/source/AbstractOS.cpp index d1cd33306f..dd22c37868 100644 --- a/externals/coda-oss/modules/c++/sys/source/AbstractOS.cpp +++ b/externals/coda-oss/modules/c++/sys/source/AbstractOS.cpp @@ -292,7 +292,7 @@ static std::string getSpecialEnv_PID(const AbstractOS& os, const std::string& en UNREFERENCED_PARAMETER(envVar); #endif const auto pid = os.getProcessId(); - return str::toString(pid); + return std::to_string(pid); } static std::string getSpecialEnv_USER(const AbstractOS& os, const std::string& envVar) @@ -394,7 +394,7 @@ static std::string getSpecialEnv_SECONDS_() // https://en.cppreference.com/w/cpp/chrono/c/difftime static const auto start = std::time(nullptr); const auto diff = static_cast(std::difftime(std::time(nullptr), start)); - return str::toString(diff); + return std::to_string(diff); } static std::string getSpecialEnv_SECONDS(const AbstractOS&, const std::string& envVar) { @@ -475,7 +475,7 @@ std::string AbstractOS::getSpecialEnv(const std::string& envVar) const if (envVar == "EPOCHSECONDS") { - return str::toString(sys::DateTime::getEpochSeconds()); + return std::to_string(sys::DateTime::getEpochSeconds()); } if (envVar == "OSTYPE") diff --git a/externals/coda-oss/modules/c++/sys/source/CppUnitTestAssert_.cpp_ b/externals/coda-oss/modules/c++/sys/source/CppUnitTestAssert_.cpp_ index fdcf5f92b5..03f941aea0 100644 --- a/externals/coda-oss/modules/c++/sys/source/CppUnitTestAssert_.cpp_ +++ b/externals/coda-oss/modules/c++/sys/source/CppUnitTestAssert_.cpp_ @@ -1,43 +1,39 @@ -#include "pch.h" -#include "TestCase.h" - -#include "str/EncodedStringView.h" - -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - -// EQUALS_MESSAGE() wants ToString() specializations (or overloads) for our types, which is a nusiance. -// This hooks up our existing str::toString() into the VC++ unit-test infrastructure - -// C++ hack to call private methods -// https://stackoverflow.com/a/71578383/8877 - -using FailOnCondition_t = void(bool condition, const unsigned short* message, const __LineInfo* pLineInfo); // declare method's type -using GetAssertMessage_t = std::wstring(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message); // declare method's type -template -struct caller final // helper structure to inject call() code -{ - friend void FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo) - { - fFailOnCondition(condition, message, pLineInfo); - } - - friend std::wstring GetAssertMessage(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message) - { - return fGetAssertMessage(equality, expected, actual, message); - } -}; -template struct caller<&Assert::FailOnCondition, &Assert::GetAssertMessage>; // even instantiation of the helper - -void FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo); // declare caller -void test::Assert::FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo) -{ - ::FailOnCondition(condition, message, pLineInfo); // and call! -} - -std::wstring GetAssertMessage(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message); // declare caller -std::wstring test::Assert::GetAssertMessage(bool equality, const std::string& expected, const std::string& actual, const wchar_t *message) -{ - const str::EncodedStringView vExpected(expected); - const str::EncodedStringView vActual(actual); - return ::GetAssertMessage(equality, vExpected.wstring(), vActual.wstring(), message); // and call! -} +#include "pch.h" +#include "TestCase.h" + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +// EQUALS_MESSAGE() wants ToString() specializations (or overloads) for our types, which is a nusiance. +// This hooks up our existing str::toString() into the VC++ unit-test infrastructure + +// C++ hack to call private methods +// https://stackoverflow.com/a/71578383/8877 + +using FailOnCondition_t = void(bool condition, const unsigned short* message, const __LineInfo* pLineInfo); // declare method's type +using GetAssertMessage_t = std::wstring(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message); // declare method's type +template +struct caller final // helper structure to inject call() code +{ + friend void FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo) + { + fFailOnCondition(condition, message, pLineInfo); + } + + friend std::wstring GetAssertMessage(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message) + { + return fGetAssertMessage(equality, expected, actual, message); + } +}; +template struct caller<&Assert::FailOnCondition, &Assert::GetAssertMessage>; // even instantiation of the helper + +void FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo); // declare caller +void test::Assert::FailOnCondition(bool condition, const unsigned short* message, const __LineInfo* pLineInfo) +{ + ::FailOnCondition(condition, message, pLineInfo); // and call! +} + +std::wstring GetAssertMessage(bool equality, const std::wstring& expected, const std::wstring& actual, const wchar_t *message); // declare caller +std::wstring test::Assert::GetAssertMessage(bool equality, const std::string& expected, const std::string& actual, const wchar_t *message) +{ + return ::GetAssertMessage(equality, str::details::to_wstring(expected), str::details::to_wstring(actual), message); // and call! +} diff --git a/externals/coda-oss/modules/c++/sys/source/DLLWin32.cpp b/externals/coda-oss/modules/c++/sys/source/DLLWin32.cpp index 466f7d2952..6fc96611fc 100644 --- a/externals/coda-oss/modules/c++/sys/source/DLLWin32.cpp +++ b/externals/coda-oss/modules/c++/sys/source/DLLWin32.cpp @@ -45,7 +45,7 @@ void sys::DLL::load(const std::string& libName) // Now we check the return value if (!mLib) - throw sys::DLLException(FmtX("Failed to load() DLL: %s", + throw sys::DLLException(str::Format("Failed to load() DLL: %s", mLibName.c_str() ) ); } @@ -75,7 +75,7 @@ retrieve(const std::string& functionName) // Now we check the ptr value if (ptr == nullptr) - throw sys::DLLException(FmtX("Failed to load function: %s", + throw sys::DLLException(str::Format("Failed to load function: %s", functionName.c_str())); return ptr; } diff --git a/externals/coda-oss/modules/c++/sys/source/DateTime.cpp b/externals/coda-oss/modules/c++/sys/source/DateTime.cpp index a79b9bb8c0..b6669002d0 100644 --- a/externals/coda-oss/modules/c++/sys/source/DateTime.cpp +++ b/externals/coda-oss/modules/c++/sys/source/DateTime.cpp @@ -104,9 +104,7 @@ char* strptime(const char *buf, const char *fmt, struct tm& tm, double& millis) { bc = *bp++; if (bc != fc) - throw except::Exception(Ctxt( - "Value does not match format (" + str::toString(fc) + - "): " + str::toString(bc))); + throw except::Exception(Ctxt("Value does not match format (" + str::toString(fc) + "): " + str::toString(bc))); continue; } @@ -316,7 +314,7 @@ char* strptime(const char *buf, const char *fmt, struct tm& tm, double& millis) case 'Y': // The year. i = TM_YEAR_BASE; if (!(conv_num(bp, i, 0, 9999))) - throw except::Exception(Ctxt("Invalid year: " + str::toString(i))); + throw except::Exception(Ctxt("Invalid year: " + std::to_string(i))); tm.tm_year = i - TM_YEAR_BASE; break; diff --git a/externals/coda-oss/modules/c++/sys/source/FileUnix.cpp b/externals/coda-oss/modules/c++/sys/source/FileUnix.cpp index e603835a32..07d6c5ff94 100644 --- a/externals/coda-oss/modules/c++/sys/source/FileUnix.cpp +++ b/externals/coda-oss/modules/c++/sys/source/FileUnix.cpp @@ -43,7 +43,7 @@ void sys::File::create(const std::string& str, int accessFlags, if (mHandle < 0) { throw sys::SystemException(Ctxt( - FmtX("Error opening file [%d]: [%s]", mHandle, str.c_str()))); + str::Format("Error opening file [%d]: [%s]", mHandle, str.c_str()))); } } diff --git a/externals/coda-oss/modules/c++/sys/source/FileWin32.cpp b/externals/coda-oss/modules/c++/sys/source/FileWin32.cpp index 5e2f2b23d0..7ab87bb47d 100644 --- a/externals/coda-oss/modules/c++/sys/source/FileWin32.cpp +++ b/externals/coda-oss/modules/c++/sys/source/FileWin32.cpp @@ -58,8 +58,7 @@ void sys::File::create(const std::string& str, create(std::nothrow, str, accessFlags, creationFlags); if (mHandle == INVALID_HANDLE_VALUE) { - throw sys::SystemException( - Ctxt(FmtX("Error opening file: [%s]", str.c_str()))); + throw sys::SystemException(Ctxt(str::Format("Error opening file: [%s]", str))); } } @@ -141,7 +140,7 @@ sys::Off_T sys::File::seekTo(sys::Off_T offset, int whence) if (SetFilePointerEx(mHandle, largeInt, &newFilePointer, dwMoveMethod) == 0) { const auto dwLastError = GetLastError(); - throw sys::SystemException(Ctxt("SetFilePointer failed: GetLastError() = " + str::toString(dwLastError))); + throw sys::SystemException(Ctxt("SetFilePointer failed: GetLastError() = " + std::to_string(dwLastError))); } return static_cast(newFilePointer.QuadPart); @@ -169,8 +168,7 @@ sys::Off_T sys::File::lastModifiedTime() return (sys::Off_T)stInMillis; } throw sys::SystemException(Ctxt( - FmtX("Error getting last modified time for path %s", - mPath.c_str()))); + str::Format("Error getting last modified time for path %s", mPath))); } void sys::File::flush() diff --git a/externals/coda-oss/modules/c++/sys/source/OSUnix.cpp b/externals/coda-oss/modules/c++/sys/source/OSUnix.cpp index c9241b639f..9a3cb61b9a 100644 --- a/externals/coda-oss/modules/c++/sys/source/OSUnix.cpp +++ b/externals/coda-oss/modules/c++/sys/source/OSUnix.cpp @@ -122,7 +122,7 @@ std::set get_unique_thread_siblings() std::ostringstream msg; msg << "Unable to open thread siblings file " << tsPath.getPath(); - throw except::Exception(Ctxt(msg.str())); + throw except::Exception(Ctxt(msg)); } std::string tsContents; @@ -143,8 +143,10 @@ std::string sys::OSUnix::getPlatformName() const if (uname(&name) == -1) throw sys::SystemException("Uname failed"); - return FmtX("%s (%s): %s [build: %s]", name.sysname, name.machine, - name.release, name.version); + std::string retval = name.sysname; + retval += str::Format(" (%s): %s", name.machine, name.release); + retval += str::Format(" [build: %s]", name.version); + return retval; } std::string sys::OSUnix::getNodeName() const @@ -174,7 +176,7 @@ void sys::OSUnix::removeFile(const std::string& pathname) const oss << "Failure removing file [" << pathname << "] with error [" << err.toString() << "]"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } } @@ -187,7 +189,7 @@ void sys::OSUnix::removeDirectory(const std::string& pathname) const oss << "Failure removing directory [" << pathname << "] with error [" << err.toString() << "]"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } } @@ -461,7 +463,7 @@ void sys::OSUnix::removeSymlink(const std::string& symlinkPathname) const oss << "Failure removing symlink [" << symlinkPathname << "] with error [" << err.toString() << "]"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } } diff --git a/externals/coda-oss/modules/c++/sys/source/OSWin32.cpp b/externals/coda-oss/modules/c++/sys/source/OSWin32.cpp index e381f2f917..57145274ff 100644 --- a/externals/coda-oss/modules/c++/sys/source/OSWin32.cpp +++ b/externals/coda-oss/modules/c++/sys/source/OSWin32.cpp @@ -58,9 +58,10 @@ std::string sys::OSWin32::getPlatformName() const { platform = "Unknown Windows OS"; } - return FmtX("%s: %d.%d [build: %d], %s", platform.c_str(), - info.dwMajorVersion, info.dwMinorVersion, info.dwBuildNumber, - info.szCSDVersion); + auto retval = platform + ": "; + retval += str::Format("%d.%d [build: %d], ", info.dwMajorVersion, info.dwMinorVersion, info.dwBuildNumber); + retval += info.szCSDVersion; + return retval; } std::string sys::OSWin32::getNodeName() const @@ -111,7 +112,7 @@ void sys::OSWin32::removeFile(const std::string& pathname) const oss << "Failure removing file [" << pathname << "] with error [" << err.toString() << "]"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } } @@ -124,7 +125,7 @@ void sys::OSWin32::removeDirectory(const std::string& pathname) const oss << "Failure removing directory [" << pathname << "] with error [" << err.toString() << "]"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } } @@ -413,7 +414,7 @@ void sys::OSWin32::removeSymlink(const std::string& symlinkPathname) const oss << "Failure removing symlink [" << symlinkPathname << "] with error [" << err.toString() << "]"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } } diff --git a/externals/coda-oss/modules/c++/sys/source/Path.cpp b/externals/coda-oss/modules/c++/sys/source/Path.cpp index b775585af2..4c91e6d18f 100644 --- a/externals/coda-oss/modules/c++/sys/source/Path.cpp +++ b/externals/coda-oss/modules/c++/sys/source/Path.cpp @@ -279,7 +279,7 @@ std::vector Path::list(const std::string& path) std::ostringstream oss; oss << "'" << path << "' does not exist or is not a valid directory"; - throw except::Exception(Ctxt(oss.str())); + throw except::Exception(Ctxt(oss)); } std::vector listing; Directory directory; diff --git a/externals/coda-oss/modules/c++/sys/source/ScopedCPUAffinityUnix.cpp b/externals/coda-oss/modules/c++/sys/source/ScopedCPUAffinityUnix.cpp index e409b3b03f..07f67cfe42 100644 --- a/externals/coda-oss/modules/c++/sys/source/ScopedCPUAffinityUnix.cpp +++ b/externals/coda-oss/modules/c++/sys/source/ScopedCPUAffinityUnix.cpp @@ -56,7 +56,7 @@ void ScopedCPUMaskUnix::initialize(int numCPUs) { std::ostringstream msg; msg << "Failed to allocate CPU mask for " << numCPUs << "CPUs"; - throw except::Exception(Ctxt(msg.str())); + throw except::Exception(Ctxt(msg)); } CPU_ZERO_S(mSize, mMask); @@ -122,7 +122,7 @@ ScopedCPUAffinityUnix::ScopedCPUAffinityUnix() : default: msg << " Unknown cause."; } - throw except::Exception(Ctxt(msg.str())); + throw except::Exception(Ctxt(msg)); } } } diff --git a/externals/coda-oss/modules/c++/sys/source/sys_filesystem.cpp b/externals/coda-oss/modules/c++/sys/source/sys_filesystem.cpp index 95f9688962..fb3126f735 100644 --- a/externals/coda-oss/modules/c++/sys/source/sys_filesystem.cpp +++ b/externals/coda-oss/modules/c++/sys/source/sys_filesystem.cpp @@ -16,7 +16,6 @@ #include "sys/Path.h" #include "gsl/gsl.h" -#include "str/EncodedString.h" namespace fs = sys::filesystem; @@ -49,7 +48,7 @@ fs::path::string_type fs::path::to_native(const std::string& s_) { #ifdef _WIN32 - return str::EncodedStringView(s_).wstring(); + return str::details::to_wstring(s_); #else return s_; #endif @@ -104,7 +103,7 @@ fs::path::operator string_type() const std::string fs::path::string() const { - return str::EncodedString(p_).native(); + return str::details::to_string(p_); } fs::path fs::path::root_path() const diff --git a/externals/coda-oss/modules/c++/sys/tests/OSTest.cpp b/externals/coda-oss/modules/c++/sys/tests/OSTest.cpp index 330493eb76..79be99659a 100644 --- a/externals/coda-oss/modules/c++/sys/tests/OSTest.cpp +++ b/externals/coda-oss/modules/c++/sys/tests/OSTest.cpp @@ -92,7 +92,7 @@ int main(int argc, char **argv) std::string tempFileName = os.getTempName(); std::ofstream ofs(tempFileName.c_str()); if (!ofs.is_open()) - throw except::Exception(FmtX("Could not open file named: %s", + throw except::Exception(str::Format("Could not open file named: %s", tempFileName.c_str())); ofs << "Im writing some crap to this file!" << std::endl; ofs.close(); diff --git a/externals/coda-oss/modules/c++/sys/tests/ThreadFreeTest.cpp b/externals/coda-oss/modules/c++/sys/tests/ThreadFreeTest.cpp index 63e54d72a0..bd39881db9 100644 --- a/externals/coda-oss/modules/c++/sys/tests/ThreadFreeTest.cpp +++ b/externals/coda-oss/modules/c++/sys/tests/ThreadFreeTest.cpp @@ -1,94 +1,94 @@ -/* ========================================================================= - * This file is part of sys-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * - * sys-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#include -#include -using namespace sys; -using namespace std; - -class MyRunTask : public Runnable -{ -public: - int result; - - MyRunTask() - { - result = 0; - } - virtual ~MyRunTask() - { - } - - virtual void run() override - { - result = 1; - } -}; - -int main(int, char**) -{ - Thread *thread; - MyRunTask *task1; - MyRunTask *task2; - MyRunTask *task3; - - try - { - task1 = new MyRunTask(); - thread = new Thread(task1); - thread->start(); - thread->join(); - task2 = new MyRunTask(); - - if (task1->result != 1) - { - cout << "Task1 not run, result: " << task1->result << endl; - return -1; - } - - delete thread; - - task3 = new MyRunTask(); - - if (task1 == task3) - cout << "Task1 freed" << endl; - - - delete task2; - delete task3; - - std::cout << "Finished all" << std::endl; - } - - catch (except::Throwable& t) - { - cout << "Exception Caught: " << t.toString() << endl; - return -1; - } - catch (...) - { - cout << "Exception Caught!" << endl; - return -1; - } - - return 0; -} +/* ========================================================================= + * This file is part of sys-c++ + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * + * sys-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + +#include +#include +using namespace sys; +using namespace std; + +class MyRunTask : public Runnable +{ +public: + int result; + + MyRunTask() + { + result = 0; + } + virtual ~MyRunTask() + { + } + + virtual void run() override + { + result = 1; + } +}; + +int main(int, char**) +{ + Thread *thread; + MyRunTask *task1; + MyRunTask *task2; + MyRunTask *task3; + + try + { + task1 = new MyRunTask(); + thread = new Thread(task1); + thread->start(); + thread->join(); + task2 = new MyRunTask(); + + if (task1->result != 1) + { + cout << "Task1 not run, result: " << task1->result << endl; + return -1; + } + + delete thread; + + task3 = new MyRunTask(); + + if (task1 == task3) + cout << "Task1 freed" << endl; + + + delete task2; + delete task3; + + std::cout << "Finished all" << std::endl; + } + + catch (except::Throwable& t) + { + cout << "Exception Caught: " << t.toString() << endl; + return -1; + } + catch (...) + { + cout << "Exception Caught!" << endl; + return -1; + } + + return 0; +} diff --git a/externals/coda-oss/modules/c++/sys/tests/ThreadTest5.cpp b/externals/coda-oss/modules/c++/sys/tests/ThreadTest5.cpp index 664109b0db..60db3589be 100644 --- a/externals/coda-oss/modules/c++/sys/tests/ThreadTest5.cpp +++ b/externals/coda-oss/modules/c++/sys/tests/ThreadTest5.cpp @@ -20,7 +20,11 @@ * */ -#include +#include +#include + +#include +#include using namespace sys; using namespace std; @@ -76,7 +80,7 @@ int main() } } - catch (except::Exception& e) + catch (const except::Exception& e) { cout << e.toString() << endl; } diff --git a/externals/coda-oss/modules/c++/sys/unittests/test_NaN_testing.cpp b/externals/coda-oss/modules/c++/sys/unittests/test_NaN_testing.cpp index 82df405095..859e37b209 100644 --- a/externals/coda-oss/modules/c++/sys/unittests/test_NaN_testing.cpp +++ b/externals/coda-oss/modules/c++/sys/unittests/test_NaN_testing.cpp @@ -21,6 +21,9 @@ */ #include +#include +#include + #include "TestCase.h" TEST_CASE(testNaNsAreNotEqual) @@ -58,9 +61,40 @@ TEST_CASE(testIsNaN) TEST_ASSERT_FALSE(IS_NAN(std::string("test string"))); } +TEST_CASE(test_ssize) +{ + // https://en.cppreference.com/w/cpp/iterator/size + + // Works with containers + std::vector v{3, 1, 4}; + TEST_ASSERT_EQ(std::size(v), 3); + + // And works with built-in arrays too + int a[]{-5, 10, 15}; + // Returns the number of elements (not bytes) as opposed to sizeof + TEST_ASSERT_EQ(std::size(a), 3); + static_assert(sizeof(a) == 12, "sizeof(a)"); + + // Provides a safe way (compared to sizeof) of getting string buffer size + const char str[] = "12345"; + // These are fine and give the correct result + TEST_ASSERT_EQ(std::size(str), 6); + static_assert(sizeof(str) == 6, "sizeof(str)"); + + // But use of sizeof here is a common source of bugs + const char* str_decayed = "12345"; + static_assert(sizeof(str_decayed) == sizeof(void*), "sizeof(void*)"); + + // Since C++20 the signed size (std::ssize) is available + auto i = std::ssize(v); + for (--i; i != -1; --i) { } + TEST_ASSERT_EQ(i, -1); +} + TEST_MAIN( TEST_CHECK(testNaNsAreNotEqual); TEST_CHECK(testNaNIsNotAlmostEqualToNumber); TEST_CHECK(testIsNaN); -) + TEST_CHECK(test_ssize); + ) diff --git a/externals/coda-oss/modules/c++/sys/unittests/test_os.cpp b/externals/coda-oss/modules/c++/sys/unittests/test_os.cpp index 2261acd0ea..ba1d71b9af 100644 --- a/externals/coda-oss/modules/c++/sys/unittests/test_os.cpp +++ b/externals/coda-oss/modules/c++/sys/unittests/test_os.cpp @@ -350,7 +350,7 @@ TEST_CASE(testSpecialEnvVars) result = os.getSpecialEnv("$"); // i.e., ${$} TEST_ASSERT_FALSE(result.empty()); TEST_ASSERT_EQ(result, pid); - const auto strPid = str::toString(os.getProcessId()); + const auto strPid = std::to_string(os.getProcessId()); TEST_ASSERT_EQ(result, strPid); result = os.getSpecialEnv("PWD"); diff --git a/externals/coda-oss/modules/c++/tiff/include/tiff/IFD.h b/externals/coda-oss/modules/c++/tiff/include/tiff/IFD.h index 706309e8f4..9120f581a5 100644 --- a/externals/coda-oss/modules/c++/tiff/include/tiff/IFD.h +++ b/externals/coda-oss/modules/c++/tiff/include/tiff/IFD.h @@ -155,8 +155,7 @@ class IFD : public io::Serializable const tiff::IFDEntry *mapEntry = tiff::KnownTagsRegistry::getInstance()[name]; //we can't add it if we don't know about it if (!mapEntry) - throw except::Exception(Ctxt(FmtX( - "Unable to add IFD Entry: unknown tag [%s]", name.c_str()))); + throw except::Exception(Ctxt(str::Format("Unable to add IFD Entry: unknown tag [%s]", name))); const auto id = mapEntry->getTagID(); const auto type = mapEntry->getType(); diff --git a/externals/coda-oss/modules/c++/tiff/include/tiff/TiffFileWriter.h b/externals/coda-oss/modules/c++/tiff/include/tiff/TiffFileWriter.h index fb495a6766..f6474c6e2e 100644 --- a/externals/coda-oss/modules/c++/tiff/include/tiff/TiffFileWriter.h +++ b/externals/coda-oss/modules/c++/tiff/include/tiff/TiffFileWriter.h @@ -191,7 +191,7 @@ template void writeTIFF(const T* image, size_t rows, size_t cols, et = ::tiff::Const::SampleFormatType::UNSIGNED_INT; break; default: - throw except::Exception(Ctxt(FmtX("Unexpected es: %d", es))); + throw except::Exception(Ctxt(str::Format("Unexpected es: %d", es))); } } unsigned short alpha(0); diff --git a/externals/coda-oss/modules/c++/tiff/source/IFD.cpp b/externals/coda-oss/modules/c++/tiff/source/IFD.cpp index fb145461db..09a5396a26 100644 --- a/externals/coda-oss/modules/c++/tiff/source/IFD.cpp +++ b/externals/coda-oss/modules/c++/tiff/source/IFD.cpp @@ -90,8 +90,7 @@ void tiff::IFD::addEntry(const std::string& name) tiff::IFDEntry *mapEntry = tiff::KnownTagsRegistry::getInstance()[name]; // we can't add it b/c we don't know about this tag if (!mapEntry) - throw except::Exception(Ctxt(FmtX( - "Unable to add IFD Entry: unknown tag [%s]", name.c_str()))); + throw except::Exception(Ctxt(str::Format("Unable to add IFD Entry: unknown tag [%s]", name))); unsigned short id = mapEntry->getTagID(); diff --git a/externals/coda-oss/modules/c++/tiff/source/ImageReader.cpp b/externals/coda-oss/modules/c++/tiff/source/ImageReader.cpp index 5fd42c6adc..9e5c1cbf7e 100644 --- a/externals/coda-oss/modules/c++/tiff/source/ImageReader.cpp +++ b/externals/coda-oss/modules/c++/tiff/source/ImageReader.cpp @@ -65,7 +65,7 @@ void tiff::ImageReader::getData(unsigned char *buffer, { unsigned short c = *(tiff::GenericType *)(*compression)[0]; if (c != tiff::Const::CompressionType::NO_COMPRESSION) - throw except::Exception(Ctxt(FmtX("Unsupported compression type: %d", c))); + throw except::Exception(Ctxt(str::Format("Unsupported compression type: %d", c))); } if (mIFD["StripOffsets"]) diff --git a/externals/coda-oss/modules/c++/tiff/source/ImageWriter.cpp b/externals/coda-oss/modules/c++/tiff/source/ImageWriter.cpp index d293fed738..774d5b7294 100644 --- a/externals/coda-oss/modules/c++/tiff/source/ImageWriter.cpp +++ b/externals/coda-oss/modules/c++/tiff/source/ImageWriter.cpp @@ -26,6 +26,8 @@ #include #include +#include "gsl/gsl.h" + #include "tiff/Common.h" #include "tiff/GenericType.h" #include "tiff/IFDEntry.h" @@ -50,7 +52,7 @@ void tiff::ImageWriter::putData(const unsigned char *buffer, void tiff::ImageWriter::writeIFD() { // Retain the current file offset. - const auto offset = mOutput->tell(); + const auto offset = gsl::narrow(mOutput->tell()); // Per TIFF spec, "offset" MUST be a 32-bit value! // Seek to the position to write the current offset to. mOutput->seek(mIFDOffset, io::Seekable::START); diff --git a/externals/coda-oss/modules/c++/tiff/source/TiffFileReader.cpp b/externals/coda-oss/modules/c++/tiff/source/TiffFileReader.cpp index e0d78f8417..812a1bb9ce 100644 --- a/externals/coda-oss/modules/c++/tiff/source/TiffFileReader.cpp +++ b/externals/coda-oss/modules/c++/tiff/source/TiffFileReader.cpp @@ -79,7 +79,7 @@ void tiff::FileReader::close() tiff::ImageReader *tiff::FileReader::operator[](const sys::Uint32_T index) const { if (index >= mImages.size()) - throw except::Exception(Ctxt(FmtX("Index out of range: %d", index))); + throw except::Exception(Ctxt(str::Format("Index out of range: %d", index))); return mImages[index]; } @@ -106,7 +106,7 @@ void tiff::FileReader::getData(unsigned char *buffer, const sys::Uint32_T numElementsToRead, const sys::Uint32_T imageIndex) { if (imageIndex >= mImages.size()) - throw except::Exception(Ctxt(FmtX("Index out of range", imageIndex))); + throw except::Exception(Ctxt(str::Format("Index out of range", imageIndex))); mImages[imageIndex]->getData(buffer, numElementsToRead); } diff --git a/externals/coda-oss/modules/c++/tiff/source/Utils.cpp b/externals/coda-oss/modules/c++/tiff/source/Utils.cpp index ff6e60d044..0c15220d50 100644 --- a/externals/coda-oss/modules/c++/tiff/source/Utils.cpp +++ b/externals/coda-oss/modules/c++/tiff/source/Utils.cpp @@ -106,9 +106,8 @@ tiff::IFD* tiff::Utils::createGeoTiffIFD(tiff::IFD* ifd) if (idx + 3 >= geoVals.size()) { throw except::Exception(Ctxt( - "'GeoKeyDirectoryTag' specified " + - str::toString(numKeys) + " keys but the IFD entry only had " + - str::toString(geoVals.size()) + " values")); + "'GeoKeyDirectoryTag' specified " + + std::to_string(numKeys) + " keys but the IFD entry only had " + std::to_string(geoVals.size()) + " values")); } const unsigned short keyId = @@ -143,8 +142,7 @@ tiff::IFD* tiff::Utils::createGeoTiffIFD(tiff::IFD* ifd) { if (count != 1) { - throw except::Exception(Ctxt( - "Expected a count of 1 but got " + str::toString(count))); + throw except::Exception(Ctxt("Expected a count of 1 but got " + std::to_string(count))); } entry->addValue(new tiff::GenericType(valueStr)); diff --git a/externals/coda-oss/modules/c++/tiff/tests/DumpHeader.cpp b/externals/coda-oss/modules/c++/tiff/tests/DumpHeader.cpp index 1c310f4419..2e0be41cbe 100644 --- a/externals/coda-oss/modules/c++/tiff/tests/DumpHeader.cpp +++ b/externals/coda-oss/modules/c++/tiff/tests/DumpHeader.cpp @@ -31,7 +31,7 @@ int main(int argc, char **argv) try { if (argc < 2) - throw except::Exception(FmtX("usage: %s ", argv[0])); + throw except::Exception(str::Format("usage: %s ", argv[0])); sys::OS os; std::string path = sys::Path::absolutePath(argv[1]); @@ -47,7 +47,7 @@ int main(int argc, char **argv) if (tiff::Utils::hasGeoTiffIFD(reader[i]->getIFD())) { outStream.writeln("==========================="); - outStream.writeln(FmtX("GeoTIFF detected: Image %d\n", (i + 1))); + outStream.writeln(str::Format("GeoTIFF detected: Image %d\n", (i + 1))); tiff::IFD *geoIFD = tiff::Utils::createGeoTiffIFD(reader[i]->getIFD()); geoIFD->print(outStream); diff --git a/externals/coda-oss/modules/c++/types/include/types/Complex.h b/externals/coda-oss/modules/c++/types/include/types/Complex.h index 8b2218ff4b..bbc76e2f5c 100644 --- a/externals/coda-oss/modules/c++/types/include/types/Complex.h +++ b/externals/coda-oss/modules/c++/types/include/types/Complex.h @@ -165,37 +165,8 @@ inline auto abs(const Complex& z) // https://en.cppreference.com/w/cpp/numeri return abs(details::cast(z)); } -// Control whether ComplexInteger is std::complex or Complex. -// If it is std::complex, then a types::ComplexInteger overload normally can't be -// used as it will be the same as std::complex -#ifdef CODA_OSS_types_FORCE_unique_ComplexInteger // bypass checks below -#define CODA_OSS_types_unique_ComplexInteger 1 -#endif -#ifdef CODA_OSS_types_NO_unique_ComplexInteger -#ifdef CODA_OSS_types_unique_ComplexInteger -#error "CODA_OSS_types_unique_ComplexInteger already #define'd" -#endif -#define CODA_OSS_types_unique_ComplexInteger 0 -#endif - -#ifndef CODA_OSS_types_unique_ComplexInteger -// If the warning about using std::complex has been turned off, we might -// as well use std:complex. -#ifdef _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING -#define CODA_OSS_types_unique_ComplexInteger 0 -#endif -#endif - -#ifndef CODA_OSS_types_unique_ComplexInteger -#define CODA_OSS_types_unique_ComplexInteger 1 -#endif - template -#if CODA_OSS_types_unique_ComplexInteger using ComplexInteger = Complex; -#else -using ComplexInteger = std::complex; -#endif namespace details { @@ -224,10 +195,7 @@ static_assert(std::is_same, ComplexReal>::value, "sho using zfloat = ComplexReal; // i.e., std::complex using zdouble = ComplexReal; // i.e., std::complex //using zlong_double = ComplexReal; // i.e., std::complex -using zint8_t = ComplexInteger; // Complex -using zint16_t = ComplexInteger; // Complex -using zint32_t = ComplexInteger; // Complex -using zint64_t = ComplexInteger; // Complex +// No `zint8_t`, etc.; don't want to encourage the use of `types::Complex`. } #endif // CODA_OSS_types_Complex_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/types/unittests/test_complex.cpp b/externals/coda-oss/modules/c++/types/unittests/test_complex.cpp index 01fe012f0f..32dd2ecc85 100644 --- a/externals/coda-oss/modules/c++/types/unittests/test_complex.cpp +++ b/externals/coda-oss/modules/c++/types/unittests/test_complex.cpp @@ -41,7 +41,7 @@ TEST_CASE(TestCxShort_abs) #ifdef _MSC_VER #pragma warning(disable: 4996) // '...': warning STL4037: The effect of instantiating the template std::complex for any type other than float, double, or long double is unspecified. You can define _SILENCE_NONFLOATING_COMPLEX_DEPRECATION_WARNING to suppress this warning. #endif - const types::zint16_t types_zint16(cx_short); + const types::Complex types_zint16(cx_short); CODA_OSS_disable_warning_pop auto actual = abs(types_zint16); TEST_ASSERT_EQ(actual, expected); diff --git a/externals/coda-oss/modules/c++/units/include/units/Angles.h b/externals/coda-oss/modules/c++/units/include/units/Angles.h index 94eb5064bf..ac22cf3945 100644 --- a/externals/coda-oss/modules/c++/units/include/units/Angles.h +++ b/externals/coda-oss/modules/c++/units/include/units/Angles.h @@ -1,106 +1,106 @@ -/* ========================================================================= - * This file is part of units-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2015, MDA Information Systems LLC - * (C) Copyright 2021, Maxar Technologies, Inc. - * - * units-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#pragma once -#ifndef CODA_OSS_units_Angles_h_INCLUDED_ -#define CODA_OSS_units_Angles_h_INCLUDED_ - -#include - -#include "math/Constants.h" -#include "math/Utilities.h" -#include "units/Unit.h" - -namespace units -{ -// -// Avoid confusion between degrees and radians -// -namespace tags -{ -struct Radians final { }; -struct Degrees final { }; -//struct Gradians final { }; -} - -template -using Angle = Unit; - -template -using Radians = Angle; - -template -using Degrees = Angle; -//template -//using Gradians = Angle; - -template -inline /*constexpr*/ Degrees& convert(Radians v, Degrees& result) noexcept -{ - result.value() = v.value() * math::Constants::radians_to_degrees(); - return result; // ICC doesn't like "constexpr void" -} -template -inline /*constexpr*/ Radians& convert(Degrees v, Radians& result) noexcept -{ - result.value() = v.value() * math::Constants::degrees_to_radians(); - return result; // ICC doesn't like "constexpr void" -} - -template -inline Radians toRadians(Angle v) noexcept -{ - //return v.to(); - Radians retval{ 0 }; - convert(v, retval); - return retval; -} - -template -inline T sin(Angle v) noexcept -{ - //return std::sin(v.to().value()); - return std::sin(toRadians(v).value()); -} -template -inline T cos(Angle v) noexcept -{ - //return std::cos(v.to().value()); - return std::cos(toRadians(v).value()); -} -template -inline T tan(Angle v) noexcept -{ - //return std::tan(v.to().value()); - return std::tan(toRadians(v).value()); -} - -template -inline void SinCos(Angle v, T& sin, T& cos) noexcept -{ - math::SinCos(toRadians(v).value(), sin, cos); -} - -} - -#endif // CODA_OSS_units_Angles_h_INCLUDED_ +/* ========================================================================= + * This file is part of units-c++ + * ========================================================================= + * + * (C) Copyright 2004 - 2015, MDA Information Systems LLC + * (C) Copyright 2021, Maxar Technologies, Inc. + * + * units-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + +#pragma once +#ifndef CODA_OSS_units_Angles_h_INCLUDED_ +#define CODA_OSS_units_Angles_h_INCLUDED_ + +#include + +#include "math/Constants.h" +#include "math/Utilities.h" +#include "units/Unit.h" + +namespace units +{ +// +// Avoid confusion between degrees and radians +// +namespace tags +{ +struct Radians final { }; +struct Degrees final { }; +//struct Gradians final { }; +} + +template +using Angle = Unit; + +template +using Radians = Angle; + +template +using Degrees = Angle; +//template +//using Gradians = Angle; + +template +inline /*constexpr*/ Degrees& convert(Radians v, Degrees& result) noexcept +{ + result.value() = v.value() * math::Constants::radians_to_degrees(); + return result; // ICC doesn't like "constexpr void" +} +template +inline /*constexpr*/ Radians& convert(Degrees v, Radians& result) noexcept +{ + result.value() = v.value() * math::Constants::degrees_to_radians(); + return result; // ICC doesn't like "constexpr void" +} + +template +inline Radians toRadians(Angle v) noexcept +{ + //return v.to(); + Radians retval{ 0 }; + convert(v, retval); + return retval; +} + +template +inline T sin(Angle v) noexcept +{ + //return std::sin(v.to().value()); + return std::sin(toRadians(v).value()); +} +template +inline T cos(Angle v) noexcept +{ + //return std::cos(v.to().value()); + return std::cos(toRadians(v).value()); +} +template +inline T tan(Angle v) noexcept +{ + //return std::tan(v.to().value()); + return std::tan(toRadians(v).value()); +} + +template +inline void SinCos(Angle v, T& sin, T& cos) noexcept +{ + math::SinCos(toRadians(v).value(), sin, cos); +} + +} + +#endif // CODA_OSS_units_Angles_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/units/include/units/Lengths.h b/externals/coda-oss/modules/c++/units/include/units/Lengths.h index 6d85d32d06..4a7f17fbc3 100644 --- a/externals/coda-oss/modules/c++/units/include/units/Lengths.h +++ b/externals/coda-oss/modules/c++/units/include/units/Lengths.h @@ -1,92 +1,92 @@ -/* ========================================================================= - * This file is part of units-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2015, MDA Information Systems LLC - * (C) Copyright 2021, Maxar Technologies, Inc. - * - * units-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#pragma once -#ifndef CODA_OSS_units_Lengths_h_INCLUDED_ -#define CODA_OSS_units_Lengths_h_INCLUDED_ - -#include "math/Constants.h" -#include "units/Unit.h" - -namespace units -{ -// -// Avoid confusion between feet and meters -// -namespace tags -{ -struct Feet final { }; -struct Meters final { }; -} - -template -using Length = Unit; - -template -using Feet = Length; - -template -using Meters = Length; - -template -inline /*constexpr*/ Feet& convert(Meters v, Feet& result) noexcept -{ - result.value() = v.value() * math::Constants::METERS_TO_FEET; - return result; // ICC doesn't like "constexpr void" -} -template -inline /*constexpr*/ Meters& convert(Feet v, Meters& result) noexcept -{ - result.value() = v.value() * math::Constants::FEET_TO_METERS; - return result; // ICC doesn't like "constexpr void" -} - -namespace tags -{ -struct NauticalMiles final { }; -} - -template -using NauticalMiles = Length; - -template -inline /*constexpr*/ Feet& convert(NauticalMiles v, Feet& result) noexcept -{ - result.value() = v.value() * math::Constants::NAUTICAL_MILES_TO_FEET; - return result; // ICC doesn't like "constexpr void" -} -template -inline /*constexpr*/ Meters& convert(NauticalMiles v, Meters& result) noexcept -{ - result.value() = v.value() * math::Constants::NAUTICAL_MILES_TO_METERS; - return result; // ICC doesn't like "constexpr void" -} -template -inline /*constexpr*/ NauticalMiles& convert(Meters v, NauticalMiles& result) noexcept -{ - result.value() = v.value() * math::Constants::METERS_TO_NAUTICAL_MILES; - return result; // ICC doesn't like "constexpr void" -} -} - -#endif // CODA_OSS_units_Lengths_h_INCLUDED_ +/* ========================================================================= + * This file is part of units-c++ + * ========================================================================= + * + * (C) Copyright 2004 - 2015, MDA Information Systems LLC + * (C) Copyright 2021, Maxar Technologies, Inc. + * + * units-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + +#pragma once +#ifndef CODA_OSS_units_Lengths_h_INCLUDED_ +#define CODA_OSS_units_Lengths_h_INCLUDED_ + +#include "math/Constants.h" +#include "units/Unit.h" + +namespace units +{ +// +// Avoid confusion between feet and meters +// +namespace tags +{ +struct Feet final { }; +struct Meters final { }; +} + +template +using Length = Unit; + +template +using Feet = Length; + +template +using Meters = Length; + +template +inline /*constexpr*/ Feet& convert(Meters v, Feet& result) noexcept +{ + result.value() = v.value() * math::Constants::METERS_TO_FEET; + return result; // ICC doesn't like "constexpr void" +} +template +inline /*constexpr*/ Meters& convert(Feet v, Meters& result) noexcept +{ + result.value() = v.value() * math::Constants::FEET_TO_METERS; + return result; // ICC doesn't like "constexpr void" +} + +namespace tags +{ +struct NauticalMiles final { }; +} + +template +using NauticalMiles = Length; + +template +inline /*constexpr*/ Feet& convert(NauticalMiles v, Feet& result) noexcept +{ + result.value() = v.value() * math::Constants::NAUTICAL_MILES_TO_FEET; + return result; // ICC doesn't like "constexpr void" +} +template +inline /*constexpr*/ Meters& convert(NauticalMiles v, Meters& result) noexcept +{ + result.value() = v.value() * math::Constants::NAUTICAL_MILES_TO_METERS; + return result; // ICC doesn't like "constexpr void" +} +template +inline /*constexpr*/ NauticalMiles& convert(Meters v, NauticalMiles& result) noexcept +{ + result.value() = v.value() * math::Constants::METERS_TO_NAUTICAL_MILES; + return result; // ICC doesn't like "constexpr void" +} +} + +#endif // CODA_OSS_units_Lengths_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/units/include/units/Unit.h b/externals/coda-oss/modules/c++/units/include/units/Unit.h index 2e917509ae..fe1642223e 100644 --- a/externals/coda-oss/modules/c++/units/include/units/Unit.h +++ b/externals/coda-oss/modules/c++/units/include/units/Unit.h @@ -1,101 +1,101 @@ -/* ========================================================================= - * This file is part of units-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2015, MDA Information Systems LLC - * (C) Copyright 2021, Maxar Technologies, Inc. - * - * units-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#pragma once -#ifndef CODA_OSS_units_Unit_h_INCLUDED_ -#define CODA_OSS_units_Unit_h_INCLUDED_ - -namespace units -{ -// -// Simple template to help avoid confusion between different units. -// -// This is intentionally simple for several reasons: -// * simple and easy to understand and maintain -// * getting things like "+" or "*" right can be (very) difficult -// * it's not even clear that doubling a temperature or a length of -4 has real meaning -// * there's really not that much code that needs to manipulate units -// -template -struct Unit final -{ - using value_t = T; - using tag_t = Tag; - - value_t value_; - - Unit() = delete; - constexpr Unit(value_t v) noexcept : value_(v) { } - - /*constexpr*/ value_t& value() noexcept - { - return value_; - } - constexpr const value_t& value() const noexcept - { - return value_; - } - - // Calls convert() to convert from Unit to Unit. - // The defaults ensure converting to oneself works. - template - /*constexpr*/ Unit to() const noexcept; -}; - -// Make a unit specifying only the tag, inferring the type T. Rather than -// units::Unit u(123); -// (T specified as "int"), you can do -// auto u = units::make_Unit(123); -// the type is inferred from "123". -template -inline constexpr Unit make_Unit(T v) noexcept -{ - return Unit(v); -} - -// Allow Unit::to() (below) to compile; the routine below normally won't be used. -template -inline /*constexpr*/ Unit& convert(Unit v, Unit& result) noexcept -{ - result = make_Unit(v.value()); // or Unit<...>, this ensures make_Unit() works - return result; // ICC doesn't like "constexpr void"; want to use parameters for type deduction -} - -// Now that "convert" is visble (above), implement the Unit::to() member function. -// convert() might be easier to use as the tag/type for each can be inferred; -// the template argument to to() is the raw tag. For example, -// constexpr units::Meters meters_1 = 1.0; -// units::Feet feet{0}; -// convert(meters_1, feet); -// Using to() is a bit more awkward -// const auto meters = feet.to(); -template -template -inline /*constexpr*/ Unit Unit::to() const noexcept -{ - Unit retval{ 0 }; - return convert(*this, retval); -} -} - -#endif // CODA_OSS_units_Unit_h_INCLUDED_ +/* ========================================================================= + * This file is part of units-c++ + * ========================================================================= + * + * (C) Copyright 2004 - 2015, MDA Information Systems LLC + * (C) Copyright 2021, Maxar Technologies, Inc. + * + * units-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + +#pragma once +#ifndef CODA_OSS_units_Unit_h_INCLUDED_ +#define CODA_OSS_units_Unit_h_INCLUDED_ + +namespace units +{ +// +// Simple template to help avoid confusion between different units. +// +// This is intentionally simple for several reasons: +// * simple and easy to understand and maintain +// * getting things like "+" or "*" right can be (very) difficult +// * it's not even clear that doubling a temperature or a length of -4 has real meaning +// * there's really not that much code that needs to manipulate units +// +template +struct Unit final +{ + using value_t = T; + using tag_t = Tag; + + value_t value_; + + Unit() = delete; + constexpr Unit(value_t v) noexcept : value_(v) { } + + /*constexpr*/ value_t& value() noexcept + { + return value_; + } + constexpr const value_t& value() const noexcept + { + return value_; + } + + // Calls convert() to convert from Unit to Unit. + // The defaults ensure converting to oneself works. + template + /*constexpr*/ Unit to() const noexcept; +}; + +// Make a unit specifying only the tag, inferring the type T. Rather than +// units::Unit u(123); +// (T specified as "int"), you can do +// auto u = units::make_Unit(123); +// the type is inferred from "123". +template +inline constexpr Unit make_Unit(T v) noexcept +{ + return Unit(v); +} + +// Allow Unit::to() (below) to compile; the routine below normally won't be used. +template +inline /*constexpr*/ Unit& convert(Unit v, Unit& result) noexcept +{ + result = make_Unit(v.value()); // or Unit<...>, this ensures make_Unit() works + return result; // ICC doesn't like "constexpr void"; want to use parameters for type deduction +} + +// Now that "convert" is visble (above), implement the Unit::to() member function. +// convert() might be easier to use as the tag/type for each can be inferred; +// the template argument to to() is the raw tag. For example, +// constexpr units::Meters meters_1 = 1.0; +// units::Feet feet{0}; +// convert(meters_1, feet); +// Using to() is a bit more awkward +// const auto meters = feet.to(); +template +template +inline /*constexpr*/ Unit Unit::to() const noexcept +{ + Unit retval{ 0 }; + return convert(*this, retval); +} +} + +#endif // CODA_OSS_units_Unit_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/Element.h b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/Element.h index 14e23a900e..323b77aba3 100644 --- a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/Element.h +++ b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/Element.h @@ -34,7 +34,6 @@ #include #include #include -#include #include "sys/Conf.h" #include "mem/SharedPtr.h" @@ -320,7 +319,7 @@ struct CODA_OSS_API Element // SOAPElement derives :-( * \return the charater data */ std::string getCharacterData() const; - coda_oss::u8string& getCharacterData(coda_oss::u8string& result) const; + const coda_oss::u8string& getCharacterData(coda_oss::u8string& result) const; //explicit operator coda_oss::u8string() const //{ // coda_oss::u8string result; diff --git a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/MinidomHandler.h b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/MinidomHandler.h index ac9590662b..1413b0fc58 100644 --- a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/MinidomHandler.h +++ b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/MinidomHandler.h @@ -50,8 +50,6 @@ #include "coda_oss/string.h" #include -#include "str/EncodedString.h" -#include "str/EncodedStringView.h" #include "XMLReader.h" #include "io/StandardStreams.h" #include "Document.h" diff --git a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/QName.h b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/QName.h index b537b5262d..80c9d358cd 100644 --- a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/QName.h +++ b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/QName.h @@ -117,8 +117,14 @@ class CODA_OSS_API QName final setQName(qname); setAssociatedUri(uri); } - QName(const std::string& qname, const xml::lite::Uri& uri) : QName(uri, qname) { } - QName(const std::string& uri, const std::string& qname) : QName(Uri(uri), qname) { } + QName(const std::string& qname, const xml::lite::Uri& uri) : + QName(uri, qname) + { + } + QName(const std::string& uri, const std::string& qname) : + QName(Uri(uri), qname) + { + } /*! * Constructor taking just the local name (no namespace). @@ -197,6 +203,16 @@ class CODA_OSS_API QName final void getAssociatedUri(xml::lite::Uri&) const; const xml::lite::Uri& getUri() const; }; +inline bool operator==(const QName& lhs, const QName& rhs) +{ + return (lhs.getName() == rhs.getName()) + && (lhs.getAssociatedUri() == rhs.getAssociatedUri()) + && (lhs.getPrefix() == rhs.getPrefix()); +} +inline bool operator!=(const QName& lhs, const QName& rhs) +{ + return !(lhs == rhs); +} namespace literals // c.f. std::literals { diff --git a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/ValidatorInterface.h b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/ValidatorInterface.h index 4e50656eff..024c0a8b16 100644 --- a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/ValidatorInterface.h +++ b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/ValidatorInterface.h @@ -79,7 +79,7 @@ struct ValidationInfo final std::ostringstream oss; oss << "[" << this->getLevel() << "]" << " from File: " << this->getFile() << - " on Line: " << str::toString(this->getLine()) << + " on Line: " << this->getLine() << " with Message: " << this->getMessage(); return oss.str(); } diff --git a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/xerces_.h b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/xerces_.h index b35fc47147..efb64fabc9 100644 --- a/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/xerces_.h +++ b/externals/coda-oss/modules/c++/xml.lite/include/xml/lite/xerces_.h @@ -1,102 +1,102 @@ -/* ========================================================================= - * This file is part of xml.lite-c++ - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * - * xml.lite-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - -#pragma once -#ifndef CODA_OSS_xml_lite_xerces_h_INCLUDED_ -#define CODA_OSS_xml_lite_xerces_h_INCLUDED_ - -#include "config/compiler_extensions.h" -#include - -#if defined(USE_XERCES) - -CODA_OSS_disable_warning_system_header_push -#if _MSC_VER -#pragma warning(disable: 26493) // Don't use C-style casts (type.4). -#pragma warning(disable: 26494) // Variable '...' is uninitialized. Always initialize an object (type.5). -#pragma warning(disable: 26451) // Arithmetic overflow: Using operator '...' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '...' to avoid overflow (io.2). -#pragma warning(disable: 26814) // The const variable '...' can be computed at compile-time. Consider using constexpr (con.5). -#pragma warning(disable: 26447) // The function is declared '...' but calls function '...' which may throw exceptions (f.6). -#pragma warning(disable: 26455) // Default constructor should not throw. Declare it '...' (f.6). -#pragma warning(disable: 26440) // Function '...' can be declared '...' (f.6). -#pragma warning(disable: 26496) // The variable '...' does not change after construction, mark it as const (con.4). -#pragma warning(disable: 26462) // The value pointed to by '...' is assigned only once, mark it as a pointer to const (con.4). -#pragma warning(disable: 26435) // Function '...' should specify exactly one of '...', '...', or '...' (c.128). -#pragma warning(disable: 26433) // Function '...' should be marked with '...' (c.128). -#pragma warning(disable: 26497) // You can attempt to make '...' constexpr unless it contains any undefined behavior (f.4). -#pragma warning(disable: 26433) // Function '...' should be marked with '...' (c.128). -#pragma warning(disable: 26456) // Operator '...' hides a non-virtual operator '...' (c.128). -#pragma warning(disable: 26446) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). -#pragma warning(disable: 26488) // Do not dereference a potentially null pointer: '...'. '...' was null at line 133 (lifetime.1). -#pragma warning(disable : 26477) // Use '...' rather than 0 or NULL(es .47). -#pragma warning(disable: 26457) // (void) should not be used to ignore return values, use '...' instead (es.48). -#pragma warning(disable: 26475) // Do not use function style casts (es.49). Prefer '...' over '...'.. -#else -CODA_OSS_disable_warning(-Wshadow) -CODA_OSS_disable_warning(-Wsuggest-override) -CODA_OSS_disable_warning(-Wzero-as-null-pointer-constant) -CODA_OSS_disable_warning(-Wmisleading-indentation) -CODA_OSS_disable_warning(-Wsign-compare) -CODA_OSS_disable_warning(-Wformat-overflow=) -CODA_OSS_disable_warning(-Wunused-value) -CODA_OSS_disable_warning(-Walloc-size-larger-than=) -#endif - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -CODA_OSS_disable_warning_pop - -#endif - -#endif // CODA_OSS_xml_lite_xerces_h_INCLUDED_ - +/* ========================================================================= + * This file is part of xml.lite-c++ + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * + * xml.lite-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + +#pragma once +#ifndef CODA_OSS_xml_lite_xerces_h_INCLUDED_ +#define CODA_OSS_xml_lite_xerces_h_INCLUDED_ + +#include "config/compiler_extensions.h" +#include + +#if defined(USE_XERCES) + +CODA_OSS_disable_warning_system_header_push +#if _MSC_VER +#pragma warning(disable: 26493) // Don't use C-style casts (type.4). +#pragma warning(disable: 26494) // Variable '...' is uninitialized. Always initialize an object (type.5). +#pragma warning(disable: 26451) // Arithmetic overflow: Using operator '...' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '...' to avoid overflow (io.2). +#pragma warning(disable: 26814) // The const variable '...' can be computed at compile-time. Consider using constexpr (con.5). +#pragma warning(disable: 26447) // The function is declared '...' but calls function '...' which may throw exceptions (f.6). +#pragma warning(disable: 26455) // Default constructor should not throw. Declare it '...' (f.6). +#pragma warning(disable: 26440) // Function '...' can be declared '...' (f.6). +#pragma warning(disable: 26496) // The variable '...' does not change after construction, mark it as const (con.4). +#pragma warning(disable: 26462) // The value pointed to by '...' is assigned only once, mark it as a pointer to const (con.4). +#pragma warning(disable: 26435) // Function '...' should specify exactly one of '...', '...', or '...' (c.128). +#pragma warning(disable: 26433) // Function '...' should be marked with '...' (c.128). +#pragma warning(disable: 26497) // You can attempt to make '...' constexpr unless it contains any undefined behavior (f.4). +#pragma warning(disable: 26433) // Function '...' should be marked with '...' (c.128). +#pragma warning(disable: 26456) // Operator '...' hides a non-virtual operator '...' (c.128). +#pragma warning(disable: 26446) // Prefer to use gsl::at() instead of unchecked subscript operator (bounds.4). +#pragma warning(disable: 26488) // Do not dereference a potentially null pointer: '...'. '...' was null at line 133 (lifetime.1). +#pragma warning(disable : 26477) // Use '...' rather than 0 or NULL(es .47). +#pragma warning(disable: 26457) // (void) should not be used to ignore return values, use '...' instead (es.48). +#pragma warning(disable: 26475) // Do not use function style casts (es.49). Prefer '...' over '...'.. +#else +CODA_OSS_disable_warning(-Wshadow) +CODA_OSS_disable_warning(-Wsuggest-override) +CODA_OSS_disable_warning(-Wzero-as-null-pointer-constant) +CODA_OSS_disable_warning(-Wmisleading-indentation) +CODA_OSS_disable_warning(-Wsign-compare) +CODA_OSS_disable_warning(-Wformat-overflow=) +CODA_OSS_disable_warning(-Wunused-value) +CODA_OSS_disable_warning(-Walloc-size-larger-than=) +#endif + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +CODA_OSS_disable_warning_pop + +#endif + +#endif // CODA_OSS_xml_lite_xerces_h_INCLUDED_ + diff --git a/externals/coda-oss/modules/c++/xml.lite/source/Attributes.cpp b/externals/coda-oss/modules/c++/xml.lite/source/Attributes.cpp index a70077ad1a..aff2572562 100644 --- a/externals/coda-oss/modules/c++/xml.lite/source/Attributes.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/source/Attributes.cpp @@ -81,7 +81,7 @@ std::string xml::lite::Attributes::getValue(int i) const } catch (const std::out_of_range& ex) { - throw except::NoSuchKeyException(Ctxt(FmtX("attributes[%d] not found, %s", i, ex.what()))); + throw except::NoSuchKeyException(Ctxt(str::Format("attributes[%d] not found, %s", i, ex.what()))); } } bool xml::lite::Attributes::getValue(int i, std::string& result) const @@ -125,8 +125,7 @@ std::string xml::lite::Attributes::getValue(const std::string& qname) const std::string retval; if (!getValue(qname, retval)) { - throw except::NoSuchKeyException(Ctxt(FmtX("QName '%s' could not be found", - qname.c_str()))); + throw except::NoSuchKeyException(Ctxt(str::Format("QName '%s' could not be found", qname))); } return retval; @@ -152,8 +151,7 @@ std::string xml::lite::Attributes::getValue(const QName& qname) const { const auto uri = qname.getUri().value; const auto localName = qname.getName(); - throw except::NoSuchKeyException(Ctxt(FmtX("(uri: %s, localName: %s", - uri.c_str(), localName.c_str()))); + throw except::NoSuchKeyException(Ctxt(str::Format("(uri: %s, localName: %s", uri, localName))); } return retval; } diff --git a/externals/coda-oss/modules/c++/xml.lite/source/Element.cpp b/externals/coda-oss/modules/c++/xml.lite/source/Element.cpp index 150588e5e4..dcc211e6ca 100644 --- a/externals/coda-oss/modules/c++/xml.lite/source/Element.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/source/Element.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include "xml/lite/Attributes.h" std::unique_ptr xml::lite::Element::create(const std::string& qname, const std::string& uri, const std::string& characterData) @@ -130,7 +129,7 @@ std::tuple getElement(TGetElements getElements { return std::make_tuple(elements[0], ""); } - return std::make_tuple(nullptr, str::toString(elements.size())); + return std::make_tuple(nullptr, std::to_string(elements.size())); } template xml::lite::Element& getElement(TGetElements getElements, TMakeContext makeContext) @@ -260,9 +259,9 @@ void xml::lite::Element::prettyConsoleOutput_(io::OutputStream& stream, std::string xml::lite::Element::getCharacterData() const { - return str::EncodedStringView(mCharacterData).native(); + return str::to_native(mCharacterData); } -coda_oss::u8string& xml::lite::Element::getCharacterData(coda_oss::u8string& result) const +const coda_oss::u8string& xml::lite::Element::getCharacterData(coda_oss::u8string& result) const { result = mCharacterData; return result; @@ -279,7 +278,7 @@ static void writeCharacterData_utf8(io::OutputStream& stream, const std::u8strin } static void writeCharacterData_native(io::OutputStream& stream, const std::u8string& characterData) { - stream.write(str::EncodedStringView(characterData).native()); + stream.write(str::to_native(characterData)); } static void depthPrint_(const xml::lite::Element& element, @@ -466,7 +465,7 @@ void xml::lite::Element::setNamespaceURI( void xml::lite::Element::setCharacterData(const std::string& characters) { - mCharacterData = str::EncodedStringView(characters).u8string(); + mCharacterData = str::u8FromNative(characters); } xml::lite::Element& xml::lite::Element::operator=(const std::string& characterData) { @@ -507,7 +506,7 @@ xml::lite::Element& xml::lite::addChild(Element& e, const QName& qname, const co } xml::lite::Element& xml::lite::addChild(Element& e, const QName& qname, const std::string& characterData) { - return addChild(e, qname, str::EncodedStringView(characterData).u8string()); + return addChild(e, qname, str::u8FromNative(characterData)); } xml::lite::Element& xml::lite::addChild(Element& e, const QName& qname) { diff --git a/externals/coda-oss/modules/c++/xml.lite/source/MinidomHandler.cpp b/externals/coda-oss/modules/c++/xml.lite/source/MinidomHandler.cpp index 3e2e1334cd..009ab29e56 100644 --- a/externals/coda-oss/modules/c++/xml.lite/source/MinidomHandler.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/source/MinidomHandler.cpp @@ -28,7 +28,6 @@ #include "str/Convert.h" #include "str/Encoding.h" #include "sys/OS.h" -#include "str/EncodedStringView.h" #include "xml/lite/MinidomHandler.h" @@ -74,8 +73,7 @@ void xml::lite::MinidomHandler::characters(const char *value, int length) // If we're still here despite use_char() being "false" then the // wide-character routine "failed." On Windows, that means the char* value // is encoded as Windows-1252 (more-or-less ISO8859-1). - const str::EncodedString chars(std::string(value, length)); - characters(chars.u8string()); + characters(str::u8FromNative(std::string(value, length))); } bool xml::lite::MinidomHandler::vcharacters(const void /*XMLCh*/* chars_, size_t length) @@ -92,8 +90,7 @@ bool xml::lite::MinidomHandler::vcharacters(const void /*XMLCh*/* chars_, size_t static_assert(sizeof(XMLCh) == sizeof(char16_t), "XMLCh should be 16-bits."); auto pChars16 = static_cast(chars_); - auto chars = str::EncodedString(std::u16string(pChars16, length)).u8string(); - characters(std::move(chars)); + characters(str::to_u8string(pChars16, length)); return true; // vcharacters() processed } diff --git a/externals/coda-oss/modules/c++/xml.lite/source/ValidatorXerces.cpp b/externals/coda-oss/modules/c++/xml.lite/source/ValidatorXerces.cpp index cc1a1b516a..3950d12422 100644 --- a/externals/coda-oss/modules/c++/xml.lite/source/ValidatorXerces.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/source/ValidatorXerces.cpp @@ -29,7 +29,6 @@ #include // std::ignore #include -#include CODA_OSS_disable_warning_push #ifndef _MSC_VER CODA_OSS_disable_warning(-Wshadow) @@ -182,7 +181,7 @@ ValidatorXerces::ValidatorXerces( { std::ostringstream oss; oss << "Error: Failure to load schema " << schema; - log->warn(Ctxt(oss.str())); + log->warn(Ctxt(oss)); } } @@ -206,18 +205,18 @@ static_assert(sizeof(XMLCh) == 2, "XMLCh should be two bytes for UTF-16."); // On other platforms, char16_t is used; only wchar_t on Windows. using XMLCh_t = wchar_t; static_assert(std::is_same<::XMLCh, XMLCh_t>::value, "XMLCh should be wchar_t"); -inline void reset(str::EncodedStringView xmlView, std::unique_ptr& pWString) +inline void reset(const std::u8string& xml, std::unique_ptr& pWString) { - pWString = std::make_unique(xmlView.wstring()); + pWString = std::make_unique(str::details::to_wstring(xml)); } #else using XMLCh_t = char16_t; static_assert(std::is_same<::XMLCh, XMLCh_t>::value, "XMLCh should be char16_t"); #endif -inline void reset(str::EncodedStringView xmlView, std::unique_ptr& pWString) +inline void reset(const std::u8string& xml, std::unique_ptr& pWString) { - pWString = std::make_unique(xmlView.u16string()); + pWString = std::make_unique(str::to_u16string(xml)); } using XMLCh_string = std::basic_string; @@ -225,7 +224,7 @@ static std::unique_ptr setStringData(xercesc::DOMLSInputImpl& inpu { // expand to the wide character data for use with xerces std::unique_ptr retval; - reset(str::EncodedStringView(xml), retval); + reset(xml, retval); input.setStringData(retval->c_str()); return retval; } @@ -264,7 +263,7 @@ bool ValidatorXerces::validate_(const std::u8string& xml, return (!mErrorHandler->getErrorLog().empty()); } -static str::EncodedStringView encodeXml(const std::string& xml) +static coda_oss::u8string encodeXml(const std::string& xml) { // The XML might contain a specific encoding, if it does; // we want to use it, otherwise we'll corrupt the data. @@ -274,34 +273,34 @@ static str::EncodedStringView encodeXml(const std::string& xml) std::cmatch m; if (std::regex_search(xml.c_str(), m, reUtf8)) { - return str::EncodedStringView::fromUtf8(xml); + return str::str(xml); } // Maybe this is poor XML with Windows-1252 encoding :-( const std::regex reWindows1252("<\?.*encoding=.*['\"]?.*windows-1252.*['\"]?.*\?>", std::regex::icase); if (std::regex_search(xml.c_str(), m, reWindows1252)) { - return str::EncodedStringView::fromWindows1252(xml); + return to_u8string(str::str(xml)); } - // No "... encoding= ..."; let EncodedStringView deal with it - return str::EncodedStringView(xml); + // No "... encoding= ..."; let u8FromNative() deal with it + return str::u8FromNative(xml); } bool ValidatorXerces::validate(const std::string& xml, const std::string& xmlID, std::vector& errors) const { - const auto view = encodeXml(xml); + const auto u8xml = encodeXml(xml); try { - return validate(view.u8string(), xmlID, errors); + return validate(u8xml, xmlID, errors); } catch (const utf8::invalid_utf8&) { } // Can't process as "native" (UTF-8 on Linux, Windows-1252 on Windows). // Must be Windows-1252 on Linux. - return validate(str::c_str(xml), xmlID, errors); + return validate(str::str(xml), xmlID, errors); } bool ValidatorXerces::validate(const coda_oss::u8string& xml, const std::string& xmlID, @@ -313,8 +312,7 @@ bool ValidatorXerces::validate(const str::W1252string& xml, const std::string& xmlID, std::vector& errors) const { - const str::EncodedStringView xmlView(xml); - return validate(xmlView.u8string(), xmlID, errors); + return validate(str::to_u8string(xml), xmlID, errors); } } diff --git a/externals/coda-oss/modules/c++/xml.lite/tests/AttributeValueTest.cpp b/externals/coda-oss/modules/c++/xml.lite/tests/AttributeValueTest.cpp index c66f466caa..01e66e1e0a 100644 --- a/externals/coda-oss/modules/c++/xml.lite/tests/AttributeValueTest.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/tests/AttributeValueTest.cpp @@ -41,7 +41,7 @@ int main(int argc, char **argv) // Check to make sure we have right length if (argc != 2) - throw Exception(Ctxt(FmtX("Usage: %s \n", argv[0]))); + throw Exception(Ctxt(str::Format("Usage: %s \n", argv[0]))); // Create an input stream FileInputStream xmlFile(argv[1]); diff --git a/externals/coda-oss/modules/c++/xml.lite/tests/MinidomParserTest1.cpp b/externals/coda-oss/modules/c++/xml.lite/tests/MinidomParserTest1.cpp index ac5ffa42ea..aaa37b9abe 100644 --- a/externals/coda-oss/modules/c++/xml.lite/tests/MinidomParserTest1.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/tests/MinidomParserTest1.cpp @@ -39,7 +39,7 @@ int main(int argc, char **argv) // Check to make sure we have right length if (argc != 2) - throw Exception(Ctxt(FmtX("Usage: %s \n", argv[0]))); + throw Exception(Ctxt(str::Format("Usage: %s \n", argv[0]))); // Create an input stream FileInputStream xmlFile(argv[1]); diff --git a/externals/coda-oss/modules/c++/xml.lite/tests/MinidomParserTest2.cpp b/externals/coda-oss/modules/c++/xml.lite/tests/MinidomParserTest2.cpp index ee28d77d8c..78c01da3bc 100644 --- a/externals/coda-oss/modules/c++/xml.lite/tests/MinidomParserTest2.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/tests/MinidomParserTest2.cpp @@ -52,7 +52,7 @@ int main(int argc, char **argv) { if (argc != 5) { - throw Exception(Ctxt(FmtX( + throw Exception(Ctxt(str::Format( "Usage: %s [OPTION] \n\n\t-a\tadd service\n\t-s\tsubtract service\n\t-o\toutput file\n", argv[0]))); } @@ -123,7 +123,7 @@ int main(int argc, char **argv) if (rootElement) rootElement->print(out); break; default: - throw Exception(Ctxt(FmtX( + throw Exception(Ctxt(str::Format( "Usage: %s [OPTION] \n\n\t-a\tadd service\n\t-s\tsubtract service\n\t-o\toutput file\n", argv[0]))); } diff --git a/externals/coda-oss/modules/c++/xml.lite/tests/XMLReaderTest.cpp b/externals/coda-oss/modules/c++/xml.lite/tests/XMLReaderTest.cpp index 8e4cf9a080..83989cb4a1 100644 --- a/externals/coda-oss/modules/c++/xml.lite/tests/XMLReaderTest.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/tests/XMLReaderTest.cpp @@ -134,7 +134,7 @@ int main(int argc, char **argv) { // Check to make sure we have right length if (argc != 2) - throw Exception(Ctxt(FmtX("Usage: %s \n", argv[0]))); + throw Exception(Ctxt(str::Format("Usage: %s \n", argv[0]))); // Create an input stream FileInputStream diff --git a/externals/coda-oss/modules/c++/xml.lite/tests/large_benchmark1.xml b/externals/coda-oss/modules/c++/xml.lite/tests/large_benchmark1.xml index 53e9cbe88f..12b45e96bf 100644 --- a/externals/coda-oss/modules/c++/xml.lite/tests/large_benchmark1.xml +++ b/externals/coda-oss/modules/c++/xml.lite/tests/large_benchmark1.xml @@ -1,108775 +1,108775 @@ - - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - String - String - String - String - String - String - String - String - String - String - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - String - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - String - String - - - String - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - String - String - - - - Text - String - - String - - - - String - String - - String - - String - - String - String - String - - - String - - String - String - - - - Text - String - - String - - - - - String - String - - String - - String - - String - String - String - - - String - - String - String - - - - Text - String - - String - - - - String - - String - - String - String - String - - - String - - String - String - - - - Text - String - - String - - - String - String - - String - - + + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + String + String + String + String + String + String + String + String + String + String + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + String + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + String + String + + + String + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + String + String + + + + Text + String + + String + + + + String + String + + String + + String + + String + String + String + + + String + + String + String + + + + Text + String + + String + + + + + String + String + + String + + String + + String + String + String + + + String + + String + String + + + + Text + String + + String + + + + String + + String + + String + String + String + + + String + + String + String + + + + Text + String + + String + + + String + String + + String + + diff --git a/externals/coda-oss/modules/c++/xml.lite/tests/small_benchmark1.xml b/externals/coda-oss/modules/c++/xml.lite/tests/small_benchmark1.xml index 6a656bd02d..815d63aa01 100644 --- a/externals/coda-oss/modules/c++/xml.lite/tests/small_benchmark1.xml +++ b/externals/coda-oss/modules/c++/xml.lite/tests/small_benchmark1.xml @@ -1,117 +1,117 @@ - - - - - - String - String - - - String - String - - String - - String - - String - String - String - - - String - - String - String - - - - Text - String - - String - - - - - String - String - - String - - String - - String - String - String - - - String - - String - String - - - - Text - String - - String - - - - - String - String - - String - - String - - String - String - String - - - String - - String - String - - - - Text - String - - String - - - - String - - String - - String - String - String - - - String - - String - String - - - - Text - String - - String - - - String - String - - String - - + + + + + + String + String + + + String + String + + String + + String + + String + String + String + + + String + + String + String + + + + Text + String + + String + + + + + String + String + + String + + String + + String + String + String + + + String + + String + String + + + + Text + String + + String + + + + + String + String + + String + + String + + String + String + String + + + String + + String + String + + + + Text + String + + String + + + + String + + String + + String + String + String + + + String + + String + String + + + + Text + String + + String + + + String + String + + String + + diff --git a/externals/coda-oss/modules/c++/xml.lite/unittests/ascii.xml b/externals/coda-oss/modules/c++/xml.lite/unittests/ascii.xml index ec19f8e935..31aaa5b374 100644 --- a/externals/coda-oss/modules/c++/xml.lite/unittests/ascii.xml +++ b/externals/coda-oss/modules/c++/xml.lite/unittests/ascii.xml @@ -1,8 +1,8 @@ - - - TEXT - t e x t - - - + + + TEXT + t e x t + + + \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/xml.lite/unittests/ascii_encoding_utf-8.xml b/externals/coda-oss/modules/c++/xml.lite/unittests/ascii_encoding_utf-8.xml index 2ac1614360..5ba661f970 100644 --- a/externals/coda-oss/modules/c++/xml.lite/unittests/ascii_encoding_utf-8.xml +++ b/externals/coda-oss/modules/c++/xml.lite/unittests/ascii_encoding_utf-8.xml @@ -1,9 +1,9 @@ - - - - TEXT - t e x t - - - + + + + TEXT + t e x t + + + \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/xml.lite/unittests/encoding_utf-8.xml b/externals/coda-oss/modules/c++/xml.lite/unittests/encoding_utf-8.xml index 2488630518..6ec818437e 100644 --- a/externals/coda-oss/modules/c++/xml.lite/unittests/encoding_utf-8.xml +++ b/externals/coda-oss/modules/c++/xml.lite/unittests/encoding_utf-8.xml @@ -1,9 +1,9 @@ - - - - TÉXT - t e x t - - - + + + + TÉXT + t e x t + + + \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/xml.lite/unittests/encoding_windows-1252.xml b/externals/coda-oss/modules/c++/xml.lite/unittests/encoding_windows-1252.xml index e22027eda3..0c3735c1ee 100644 --- a/externals/coda-oss/modules/c++/xml.lite/unittests/encoding_windows-1252.xml +++ b/externals/coda-oss/modules/c++/xml.lite/unittests/encoding_windows-1252.xml @@ -1,9 +1,9 @@ - - - - TXT - t e x t - - - + + + + TXT + t e x t + + + \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlcreate.cpp b/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlcreate.cpp index 2b65f0827d..08cffd845b 100644 --- a/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlcreate.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlcreate.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include "io/StringStream.h" #include @@ -32,6 +31,13 @@ #include "xml/lite/Element.h" #include "xml/lite/QName.h" +static std::string print(const xml::lite::Element& element) +{ + io::StringStream output; + element.print(output); + return output.stream().str(); +} + TEST_CASE(testXmlCreateRoot) { using namespace xml::lite::literals; // _q and _u for QName and Uri @@ -41,17 +47,12 @@ TEST_CASE(testXmlCreateRoot) auto documents_ = document.createElement(xml::lite::QName(""_u, "abc"), "abc"); auto& documents = *documents_; - io::StringStream output; - documents.print(output); - auto actual = output.stream().str(); + auto actual = print(documents); TEST_ASSERT_EQ("abc", actual); documents = "test"; // setCharacterData() documents = xml::lite::QName(""_u, "documents"); // setChild() - - output.reset(); - documents.print(output); - actual = output.stream().str(); + actual = print(documents); TEST_ASSERT_EQ("test", actual); } @@ -65,9 +66,7 @@ TEST_CASE(testXmlCreateNested) auto documents_ = document.createElement(xml::lite::QName(""_u, "documents"), ""); auto& documents = *documents_; std::ignore = addChild(documents, "html"); - io::StringStream output; - documents.print(output); - auto actual = output.stream().str(); + auto actual = print(documents); const auto expected0 = ""; TEST_ASSERT_EQ(expected0, actual); @@ -81,9 +80,7 @@ TEST_CASE(testXmlCreateNested) std::ignore = addAttribute(p, "a"_q, "abc"); body += "br"; // addChild() - output.reset(); - documents.print(output); - actual = output.stream().str(); + actual = print(documents); const auto expected1 = // can't use a "raw" string because a string comparision is done, not a "XML comparision" "" "" @@ -98,8 +95,60 @@ TEST_CASE(testXmlCreateNested) TEST_ASSERT_EQ(expected1, actual); } +TEST_CASE(testXmlCreateEmpty) +{ + using namespace xml::lite::literals; // _q and _u for QName and Uri + + xml::lite::MinidomParser xmlParser; + auto& document = getDocument(xmlParser); + + auto documents_ = document.createElement(xml::lite::QName(""_u, "empty"), ""); + auto& documents = *documents_; + auto actual = print(documents); + TEST_ASSERT_EQ("", actual); +} + +TEST_CASE(testXmlCreateWhitespace) +{ + using namespace xml::lite::literals; // _q and _u for QName and Uri + + xml::lite::MinidomParser xmlParser; + auto& document = getDocument(xmlParser); + + const auto text = str::u8FromNative(" "); + auto documents_ = document.createElement(xml::lite::QName(""_u, "text"), text); + auto& documents = *documents_; + auto strXml = str::u8FromNative(print(documents)); + const auto expected = str::u8FromNative("") + text + str::u8FromNative(""); + TEST_ASSERT(strXml == expected); + + { + io::U8StringStream input; + input.stream() << strXml; + xmlParser.preserveCharacterData(false); + xmlParser.parse(input); + const auto& root = getRootElement(getDocument(xmlParser)); + std::u8string actual; + root.getCharacterData(actual); + static const coda_oss::u8string empty; + TEST_ASSERT(actual == empty); // preserveCharacterData == false + } + { + io::U8StringStream input; + input.stream() << strXml; + xmlParser.preserveCharacterData(true); + xmlParser.parse(input); + const auto& root = getRootElement(getDocument(xmlParser)); + std::u8string actual; + root.getCharacterData(actual); + TEST_ASSERT(actual == text); // preserveCharacterData == true + } +} + int main(int, char**) { TEST_CHECK(testXmlCreateRoot); TEST_CHECK(testXmlCreateNested); + TEST_CHECK(testXmlCreateEmpty); + TEST_CHECK(testXmlCreateWhitespace); } diff --git a/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlelement.cpp b/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlelement.cpp index 0c252e12a7..2f42d5b386 100644 --- a/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlelement.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlelement.cpp @@ -21,6 +21,7 @@ */ #include +#include #include "coda_oss/CPlusPlus.h" #include "io/StringStream.h" #include @@ -101,7 +102,7 @@ TEST_CASE(test_getElementsByTagName) { const auto aElements = root.getElementsByTagName("a", true /*recurse*/); - TEST_ASSERT_EQ(aElements.size(), static_cast(1)); + TEST_ASSERT_EQ(std::ssize(aElements), 1); const auto& a = *(aElements[0]); const auto characterData = a.getCharacterData(); @@ -113,7 +114,7 @@ TEST_CASE(test_getElementsByTagName) TEST_ASSERT_EQ(docElements.size(), static_cast(1)); { const auto aElements = docElements[0]->getElementsByTagName("a"); - TEST_ASSERT_EQ(aElements.size(), static_cast(1)); + TEST_ASSERT_EQ(std::ssize(aElements), 1); const auto& a = *(aElements[0]); const auto characterData = a.getCharacterData(); @@ -137,10 +138,10 @@ TEST_CASE(test_getElementsByTagName_duplicate) const auto docElements = root.getElementsByTagName("doc"); TEST_ASSERT_FALSE(docElements.empty()); - TEST_ASSERT_EQ(docElements.size(), static_cast(1)); + TEST_ASSERT_EQ(std::ssize(docElements), 1); { const auto duplicateElements = docElements[0]->getElementsByTagName("duplicate"); - TEST_ASSERT_EQ(duplicateElements.size(), static_cast(2)); + TEST_ASSERT_EQ(std::ssize(duplicateElements), 2); const auto& duplicate = *(duplicateElements[0]); const auto characterData = duplicate.getCharacterData(); diff --git a/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlparser.cpp b/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlparser.cpp index b0e88e33b3..e35911651a 100644 --- a/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlparser.cpp +++ b/externals/coda-oss/modules/c++/xml.lite/unittests/test_xmlparser.cpp @@ -23,12 +23,12 @@ #include #include #include +#include #include "io/StringStream.h" #include "io/FileInputStream.h" #include "str/Convert.h" #include "str/Encoding.h" -#include "str/EncodedString.h" #include "coda_oss/CPlusPlus.h" #include "sys/OS.h" #include "sys/FileFinder.h" @@ -38,11 +38,6 @@ #include "xml/lite/Validator.h" #include "xml/lite/QName.h" -static inline std::u8string fromUtf8(const std::string& utf8) -{ - return str::EncodedStringView::fromUtf8(utf8).u8string(); -} - static const std::string& text() { static const std::string retval("TEXT"); @@ -53,20 +48,19 @@ static const std::string& strXml() static const std::string retval = "" + text() + ""; return retval; } -static const std::u8string& text8() +static auto from_utf8(const std::string& utf8) { - static const auto retval = fromUtf8(text()); - return retval; + return str::str(utf8); } - -static const str::EncodedString& iso88591Text() +static const std::u8string& text8() { - static const str::EncodedString retval(str::cast("T\xc9XT")); // ISO8859-1, "TXT" + static const auto retval = from_utf8(text()); return retval; } + static const auto& iso88591Text1252() { - static const auto retval = str::EncodedStringView::details::w1252string(iso88591Text().view()); + static const auto retval = str::make_string("T\xc9XT"); // ISO8859-1, "TXT" return retval; } static auto pIso88591Text_() @@ -75,15 +69,9 @@ static auto pIso88591Text_() return retval; } -static const str::EncodedString& utf8Text() -{ - static const str::EncodedString retval(str::cast("T\xc3\x89XT")); // UTF-8, "TXT" - return retval; -} - static const auto& utf8Text8() { - static const auto retval = utf8Text().u8string(); + static const auto retval = str::make_string("T\xc3\x89XT"); // UTF-8, "TXT" return retval; } static const auto pUtf8Text_() @@ -94,12 +82,12 @@ static const auto pUtf8Text_() static const auto& strUtf8Xml8() { - static const auto retval = fromUtf8("") + utf8Text8() + fromUtf8(""); + static const auto retval = from_utf8("") + utf8Text8() + from_utf8(""); return retval; } static const std::string& strUtf8Xml() { - static const std::string retval = str::c_str(strUtf8Xml8()); + static const auto retval = str::str(strUtf8Xml8()); return retval; } @@ -118,7 +106,7 @@ static std::filesystem::path find_unittest_file(const std::filesystem::path& nam static void test_a_element(const std::string& testName, const xml::lite::Element& root) { const auto aElements = root.getElementsByTagName("a", true /*recurse*/); - TEST_ASSERT_EQ(aElements.size(), static_cast(1)); + TEST_ASSERT_EQ(std::ssize(aElements), 1); const auto& a = *(aElements[0]); const auto characterData = a.getCharacterData(); @@ -137,7 +125,7 @@ TEST_CASE(testXmlParseSimple) const auto docElements = root.getElementsByTagName("doc"); TEST_ASSERT_FALSE(docElements.empty()); - TEST_ASSERT_EQ(docElements.size(), static_cast(1)); + TEST_ASSERT_EQ(std::ssize(docElements), 1); test_a_element(testName, *docElements[0]); } @@ -216,10 +204,9 @@ TEST_CASE(testXmlPrintSimple) TEST_ASSERT_EQ(actual, expected); } -static std::u8string fromWindows1252(const std::string& s) +static auto from_windows1252(const std::string& w1252) { - // s is Windows-1252 on ALL platforms - return str::EncodedStringView::fromWindows1252(s).u8string(); + return to_u8string(str::str(w1252)); } TEST_CASE(testXmlPrintUtf8) @@ -231,7 +218,7 @@ TEST_CASE(testXmlPrintUtf8) xml::lite::MinidomParser xmlParser; auto& document = getDocument(xmlParser); - const auto s8_w1252 = fromWindows1252(pIso88591Text_()); + const auto s8_w1252 = from_windows1252(pIso88591Text_()); const auto pRootElement = document.createElement(root, s8_w1252); io::StringStream output; @@ -272,7 +259,7 @@ TEST_CASE(testXmlConsoleOutput) xml::lite::MinidomParser xmlParser; auto& document = getDocument(xmlParser); - const auto s8_w1252 = fromWindows1252(pIso88591Text_()); + const auto s8_w1252 = from_windows1252(pIso88591Text_()); const auto pRootElement = document.createElement(root, s8_w1252); io::StringStream output; @@ -379,7 +366,7 @@ static void testReadXmlFile(const std::string& testName, const std::string& xmlF const auto& root = getRootElement(getDocument(xmlParser)); const auto aElements = root.getElementsByTagName("a", true /*recurse*/); - TEST_ASSERT_EQ(aElements.size(), static_cast(1)); + TEST_ASSERT_EQ(std::ssize(aElements), 1); const auto& a = *(aElements[0]); auto characterData = a.getCharacterData(); @@ -437,6 +424,11 @@ static bool find_string(io::FileInputStream& stream, const std::string& s) return false; } +static std::string as_utf8(const coda_oss::u8string& s) +{ + return str::str(s); +} + TEST_CASE(testReadEmbeddedXml) { // This is a binary file with XML burried in it somewhere @@ -457,11 +449,11 @@ TEST_CASE(testReadEmbeddedXml) const auto characterData = classificationXML.getCharacterData(); TEST_ASSERT_EQ(characterData, classificationText_platform); - const str::EncodedStringView expectedCharDataView(str::c_str(classificationText_utf_8), classificationText_utf_8.length()); + const auto expected = from_utf8(classificationText_utf_8); std::u8string u8_characterData; classificationXML.getCharacterData(u8_characterData); - TEST_ASSERT_EQ(u8_characterData, expectedCharDataView); - const auto u8_characterData_ = str::EncodedStringView(u8_characterData).asUtf8(); + TEST_ASSERT_EQ(u8_characterData, expected); + const auto u8_characterData_ = as_utf8(u8_characterData); TEST_ASSERT_EQ(classificationText_utf_8, u8_characterData_); } diff --git a/externals/coda-oss/modules/c++/xml.lite/unittests/utf-8.xml b/externals/coda-oss/modules/c++/xml.lite/unittests/utf-8.xml index b5b1869f05..738e63cf8d 100644 --- a/externals/coda-oss/modules/c++/xml.lite/unittests/utf-8.xml +++ b/externals/coda-oss/modules/c++/xml.lite/unittests/utf-8.xml @@ -1,8 +1,8 @@ - - - TÉXT - t e x t - - - + + + TÉXT + t e x t + + + \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/xml.lite/unittests/windows-1252.xml b/externals/coda-oss/modules/c++/xml.lite/unittests/windows-1252.xml index d4d4f5a40f..8bd1ad8860 100644 --- a/externals/coda-oss/modules/c++/xml.lite/unittests/windows-1252.xml +++ b/externals/coda-oss/modules/c++/xml.lite/unittests/windows-1252.xml @@ -1,8 +1,8 @@ - - - TXT - t e x t - - - + + + TXT + t e x t + + + \ No newline at end of file diff --git a/externals/coda-oss/modules/c++/zip/include/zip/Types.h b/externals/coda-oss/modules/c++/zip/include/zip/Types.h index 3767a2f468..1fe5397497 100644 --- a/externals/coda-oss/modules/c++/zip/include/zip/Types.h +++ b/externals/coda-oss/modules/c++/zip/include/zip/Types.h @@ -20,12 +20,12 @@ * */ -#ifndef __ZIP_TYPES_H__ -#define __ZIP_TYPES_H__ +#pragma once +#ifndef CODA_OSS_zip_Types_h_INCLUDED_ +#define CODA_OSS_zip_Types_h_INCLUDED_ #include "io/InputStream.h" #include "io/OutputStream.h" -#include #include //#define DEF_MEM_LEVEL 8 @@ -43,5 +43,4 @@ enum }; } -#endif - +#endif // CODA_OSS_zip_Types_h_INCLUDED_ diff --git a/externals/coda-oss/modules/c++/zip/include/zip/ZipFile.h b/externals/coda-oss/modules/c++/zip/include/zip/ZipFile.h index 6e7c7e6e6c..b81927d745 100644 --- a/externals/coda-oss/modules/c++/zip/include/zip/ZipFile.h +++ b/externals/coda-oss/modules/c++/zip/include/zip/ZipFile.h @@ -23,6 +23,8 @@ #ifndef __ZIP_ZIP_FILE_H__ #define __ZIP_ZIP_FILE_H__ +#include "gsl/gsl.h" + #include "zip/ZipEntry.h" /*! @@ -144,9 +146,9 @@ class ZipFile return mComment; } - unsigned long getNumEntries() const + auto getNumEntries() const { - return static_cast(mEntries.size()); + return gsl::narrow(mEntries.size()); } }; diff --git a/externals/coda-oss/modules/c++/zip/source/ZipEntry.cpp b/externals/coda-oss/modules/c++/zip/source/ZipEntry.cpp index 4c93526729..14bc85be17 100644 --- a/externals/coda-oss/modules/c++/zip/source/ZipEntry.cpp +++ b/externals/coda-oss/modules/c++/zip/source/ZipEntry.cpp @@ -50,7 +50,7 @@ void ZipEntry::inflate(sys::ubyte* out, sys::Size_T outLen, sys::ubyte* in, int zerr = inflateInit2(&zstream, -MAX_WBITS); if (zerr != Z_OK) { - throw except::IOException(Ctxt(FmtX("inflateInit2 failed [%d]", zerr))); + throw except::IOException(Ctxt(str::Format("inflateInit2 failed [%d]", zerr))); } // decompress @@ -58,7 +58,7 @@ void ZipEntry::inflate(sys::ubyte* out, sys::Size_T outLen, sys::ubyte* in, if (zerr != Z_STREAM_END) { - throw except::IOException(Ctxt(FmtX( + throw except::IOException(Ctxt(str::Format( "inflate failed [%d]: wanted: %d, got: %lu", zerr, Z_STREAM_END, zstream.total_out))); } diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/.github/workflows/ios.yml b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/.github/workflows/ios.yml index 0ef9fa3b11..d231b4c2d1 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/.github/workflows/ios.yml +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/.github/workflows/ios.yml @@ -1,52 +1,52 @@ -name: CI_iOS -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - iOS: - runs-on: macos-latest - defaults: - run: - working-directory: build - steps: - - uses: actions/checkout@v2 - - - name: Create build directory - run: mkdir -p build - working-directory: . - - - name: Configure - run: | - cmake \ - -Werror=dev \ - -GXcode \ - -DCMAKE_SYSTEM_NAME=iOS \ - "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" \ - -DCMAKE_OSX_DEPLOYMENT_TARGET=9 \ - -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \ - "-DMACOSX_BUNDLE_GUI_IDENTIFIER=GSL.\$(EXECUTABLE_NAME)" \ - -DMACOSX_BUNDLE_BUNDLE_VERSION=3.1.0 \ - -DMACOSX_BUNDLE_SHORT_VERSION_STRING=3.1.0 \ - .. - - - name: Build - run: cmake --build . --parallel `sysctl -n hw.ncpu` --config Release -- -sdk iphonesimulator - - - name: Start simulator - run: | - RUNTIME=`xcrun simctl list runtimes iOS -j|jq '.runtimes|last.identifier'` - UDID=`xcrun simctl list devices iPhone available -j|jq -r ".devices[$RUNTIME]|last.udid"` - xcrun simctl bootstatus $UDID -b - - - name: Test - run: | - for TEST in `find tests/Release-iphonesimulator -depth 1 -name "*.app"` - do - xcrun simctl install booted $TEST - TEST_ID=`plutil -convert json -o - $TEST/Info.plist|jq -r ".CFBundleIdentifier"` - xcrun simctl launch --console booted $TEST_ID - xcrun simctl uninstall booted $TEST_ID - done +name: CI_iOS +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + iOS: + runs-on: macos-latest + defaults: + run: + working-directory: build + steps: + - uses: actions/checkout@v2 + + - name: Create build directory + run: mkdir -p build + working-directory: . + + - name: Configure + run: | + cmake \ + -Werror=dev \ + -GXcode \ + -DCMAKE_SYSTEM_NAME=iOS \ + "-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=9 \ + -DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \ + "-DMACOSX_BUNDLE_GUI_IDENTIFIER=GSL.\$(EXECUTABLE_NAME)" \ + -DMACOSX_BUNDLE_BUNDLE_VERSION=3.1.0 \ + -DMACOSX_BUNDLE_SHORT_VERSION_STRING=3.1.0 \ + .. + + - name: Build + run: cmake --build . --parallel `sysctl -n hw.ncpu` --config Release -- -sdk iphonesimulator + + - name: Start simulator + run: | + RUNTIME=`xcrun simctl list runtimes iOS -j|jq '.runtimes|last.identifier'` + UDID=`xcrun simctl list devices iPhone available -j|jq -r ".devices[$RUNTIME]|last.udid"` + xcrun simctl bootstatus $UDID -b + + - name: Test + run: | + for TEST in `find tests/Release-iphonesimulator -depth 1 -name "*.app"` + do + xcrun simctl install booted $TEST + TEST_ID=`plutil -convert json -o - $TEST/Info.plist|jq -r ".CFBundleIdentifier"` + xcrun simctl launch --console booted $TEST_ID + xcrun simctl uninstall booted $TEST_ID + done diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_algorithm b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_algorithm index 303a5ae68c..8a88a59b21 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_algorithm +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_algorithm @@ -1,4 +1,4 @@ -#pragma once -#pragma message( \ - "This header will soon be removed. Use instead of ") -#include +#pragma once +#pragma message( \ + "This header will soon be removed. Use instead of ") +#include diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_assert b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_assert index b83a7729d0..1dd24b1b38 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_assert +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_assert @@ -1,3 +1,3 @@ -#pragma once -#pragma message("This header will soon be removed. Use instead of ") -#include +#pragma once +#pragma message("This header will soon be removed. Use instead of ") +#include diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_byte b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_byte index 4f198ceffd..b41f2d9a4d 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_byte +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_byte @@ -1,3 +1,3 @@ -#pragma once -#pragma message("This header will soon be removed. Use instead of ") -#include +#pragma once +#pragma message("This header will soon be removed. Use instead of ") +#include diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_narrow b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_narrow index 6c2cd103c4..d30d42128c 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_narrow +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_narrow @@ -1,3 +1,3 @@ -#pragma once -#pragma message("This header will soon be removed. Use instead of ") -#include +#pragma once +#pragma message("This header will soon be removed. Use instead of ") +#include diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_util b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_util index 6a6d77e04b..feb19902cd 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_util +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/gsl_util @@ -1,3 +1,3 @@ -#pragma once -#pragma message("This header will soon be removed. Use instead of ") -#include +#pragma once +#pragma message("This header will soon be removed. Use instead of ") +#include diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/narrow b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/narrow index bec30d113f..ac341ec8cf 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/narrow +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/narrow @@ -1,71 +1,71 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2015 Microsoft Corporation. All rights reserved. -// -// This code is licensed under the MIT License (MIT). -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef GSL_NARROW_H -#define GSL_NARROW_H -#include // for Expects -#include // for narrow_cast -namespace gsl -{ -struct narrowing_error : public std::exception -{ - const char* what() const noexcept override { return "narrowing_error"; } -}; - -// narrow() : a checked version of narrow_cast() that throws if the cast changed the value -template ::value>::type* = nullptr> -// clang-format off -GSL_SUPPRESS(type.1) // NO-FORMAT: attribute -GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) - // clang-format on - constexpr T narrow(U u) noexcept(false) -{ - constexpr const bool is_different_signedness = - (std::is_signed::value != std::is_signed::value); - -GSL_SUPPRESS(es.103) // NO-FORMAT: attribute // don't overflow -GSL_SUPPRESS(es.104) // NO-FORMAT: attribute // don't underflow -GSL_SUPPRESS(p.2) // NO-FORMAT: attribute // don't rely on undefined behavior - const T t = narrow_cast(u); // While this is technically undefined behavior in some cases (i.e., if the source value is of floating-point type - // and cannot fit into the destination integral type), the resultant behavior is benign on the platforms - // that we target (i.e., no hardware trap representations are hit). - - if (static_cast(t) != u || (is_different_signedness && ((t < T{}) != (u < U{})))) - { - throw narrowing_error{}; - } - - return t; -} - -template ::value>::type* = nullptr> -// clang-format off -GSL_SUPPRESS(type.1) // NO-FORMAT: attribute -GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) - // clang-format on - constexpr T narrow(U u) noexcept(false) -{ - const T t = narrow_cast(u); - - if (static_cast(t) != u) - { - throw narrowing_error{}; - } - - return t; -} -} // namespace gsl -#endif // GSL_NARROW_H +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2015 Microsoft Corporation. All rights reserved. +// +// This code is licensed under the MIT License (MIT). +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef GSL_NARROW_H +#define GSL_NARROW_H +#include // for Expects +#include // for narrow_cast +namespace gsl +{ +struct narrowing_error : public std::exception +{ + const char* what() const noexcept override { return "narrowing_error"; } +}; + +// narrow() : a checked version of narrow_cast() that throws if the cast changed the value +template ::value>::type* = nullptr> +// clang-format off +GSL_SUPPRESS(type.1) // NO-FORMAT: attribute +GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) + // clang-format on + constexpr T narrow(U u) noexcept(false) +{ + constexpr const bool is_different_signedness = + (std::is_signed::value != std::is_signed::value); + +GSL_SUPPRESS(es.103) // NO-FORMAT: attribute // don't overflow +GSL_SUPPRESS(es.104) // NO-FORMAT: attribute // don't underflow +GSL_SUPPRESS(p.2) // NO-FORMAT: attribute // don't rely on undefined behavior + const T t = narrow_cast(u); // While this is technically undefined behavior in some cases (i.e., if the source value is of floating-point type + // and cannot fit into the destination integral type), the resultant behavior is benign on the platforms + // that we target (i.e., no hardware trap representations are hit). + + if (static_cast(t) != u || (is_different_signedness && ((t < T{}) != (u < U{})))) + { + throw narrowing_error{}; + } + + return t; +} + +template ::value>::type* = nullptr> +// clang-format off +GSL_SUPPRESS(type.1) // NO-FORMAT: attribute +GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false) + // clang-format on + constexpr T narrow(U u) noexcept(false) +{ + const T t = narrow_cast(u); + + if (static_cast(t) != u) + { + throw narrowing_error{}; + } + + return t; +} +} // namespace gsl +#endif // GSL_NARROW_H diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/span_ext b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/span_ext index 5feb2b868b..e82a5b6bad 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/span_ext +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/span_ext @@ -1,212 +1,212 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2015 Microsoft Corporation. All rights reserved. -// -// This code is licensed under the MIT License (MIT). -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef GSL_SPAN_EXT_H -#define GSL_SPAN_EXT_H - -/////////////////////////////////////////////////////////////////////////////// -// -// File: span_ext -// Purpose: continue offering features that have been cut from the official -// implementation of span. -// While modernizing gsl::span a number of features needed to be removed to -// be compliant with the design of std::span -// -/////////////////////////////////////////////////////////////////////////////// - -#include // GSL_KERNEL_MODE -#include // for narrow_cast, narrow - -#include // for ptrdiff_t, size_t -#include - -#ifndef GSL_KERNEL_MODE -#include // for lexicographical_compare -#endif // GSL_KERNEL_MODE - -namespace gsl -{ - -// [span.views.constants], constants -constexpr const std::size_t dynamic_extent = narrow_cast(-1); - -template -class span; - -// std::equal and std::lexicographical_compare are not /kernel compatible -// so all comparison operators must be removed for kernel mode. -#ifndef GSL_KERNEL_MODE - -// [span.comparison], span comparison operators -template -constexpr bool operator==(span l, span r) -{ - return std::equal(l.begin(), l.end(), r.begin(), r.end()); -} - -template -constexpr bool operator!=(span l, span r) -{ - return !(l == r); -} - -template -constexpr bool operator<(span l, span r) -{ - return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end()); -} - -template -constexpr bool operator<=(span l, span r) -{ - return !(l > r); -} - -template -constexpr bool operator>(span l, span r) -{ - return r < l; -} - -template -constexpr bool operator>=(span l, span r) -{ - return !(l < r); -} - -#endif // GSL_KERNEL_MODE - -// -// make_span() - Utility functions for creating spans -// -template -constexpr span make_span(ElementType* ptr, typename span::size_type count) -{ - return span(ptr, count); -} - -template -constexpr span make_span(ElementType* firstElem, ElementType* lastElem) -{ - return span(firstElem, lastElem); -} - -template -constexpr span make_span(ElementType (&arr)[N]) noexcept -{ - return span(arr); -} - -template -constexpr span make_span(Container& cont) -{ - return span(cont); -} - -template -constexpr span make_span(const Container& cont) -{ - return span(cont); -} - -template -constexpr span make_span(Ptr& cont, std::size_t count) -{ - return span(cont, count); -} - -template -constexpr span make_span(Ptr& cont) -{ - return span(cont); -} - -// Specialization of gsl::at for span -template -constexpr ElementType& at(span s, index i) -{ - // No bounds checking here because it is done in span::operator[] called below - Ensures(i >= 0); - return s[narrow_cast(i)]; -} - -// [span.obs] Free observer functions -template -constexpr std::ptrdiff_t ssize(const span& s) noexcept -{ - return static_cast(s.size()); -} - -// [span.iter] Free functions for begin/end functions -template -constexpr typename span::iterator -begin(const span& s) noexcept -{ - return s.begin(); -} - -template -constexpr typename span::iterator -end(const span& s) noexcept -{ - return s.end(); -} - -template -constexpr typename span::reverse_iterator -rbegin(const span& s) noexcept -{ - return s.rbegin(); -} - -template -constexpr typename span::reverse_iterator -rend(const span& s) noexcept -{ - return s.rend(); -} - -template -constexpr typename span::iterator -cbegin(const span& s) noexcept -{ - return s.begin(); -} - -template -constexpr typename span::iterator -cend(const span& s) noexcept -{ - return s.end(); -} - -template -constexpr typename span::reverse_iterator -crbegin(const span& s) noexcept -{ - return s.rbegin(); -} - -template -constexpr typename span::reverse_iterator -crend(const span& s) noexcept -{ - return s.rend(); -} - -} // namespace gsl - -#endif // GSL_SPAN_EXT_H +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2015 Microsoft Corporation. All rights reserved. +// +// This code is licensed under the MIT License (MIT). +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef GSL_SPAN_EXT_H +#define GSL_SPAN_EXT_H + +/////////////////////////////////////////////////////////////////////////////// +// +// File: span_ext +// Purpose: continue offering features that have been cut from the official +// implementation of span. +// While modernizing gsl::span a number of features needed to be removed to +// be compliant with the design of std::span +// +/////////////////////////////////////////////////////////////////////////////// + +#include // GSL_KERNEL_MODE +#include // for narrow_cast, narrow + +#include // for ptrdiff_t, size_t +#include + +#ifndef GSL_KERNEL_MODE +#include // for lexicographical_compare +#endif // GSL_KERNEL_MODE + +namespace gsl +{ + +// [span.views.constants], constants +constexpr const std::size_t dynamic_extent = narrow_cast(-1); + +template +class span; + +// std::equal and std::lexicographical_compare are not /kernel compatible +// so all comparison operators must be removed for kernel mode. +#ifndef GSL_KERNEL_MODE + +// [span.comparison], span comparison operators +template +constexpr bool operator==(span l, span r) +{ + return std::equal(l.begin(), l.end(), r.begin(), r.end()); +} + +template +constexpr bool operator!=(span l, span r) +{ + return !(l == r); +} + +template +constexpr bool operator<(span l, span r) +{ + return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end()); +} + +template +constexpr bool operator<=(span l, span r) +{ + return !(l > r); +} + +template +constexpr bool operator>(span l, span r) +{ + return r < l; +} + +template +constexpr bool operator>=(span l, span r) +{ + return !(l < r); +} + +#endif // GSL_KERNEL_MODE + +// +// make_span() - Utility functions for creating spans +// +template +constexpr span make_span(ElementType* ptr, typename span::size_type count) +{ + return span(ptr, count); +} + +template +constexpr span make_span(ElementType* firstElem, ElementType* lastElem) +{ + return span(firstElem, lastElem); +} + +template +constexpr span make_span(ElementType (&arr)[N]) noexcept +{ + return span(arr); +} + +template +constexpr span make_span(Container& cont) +{ + return span(cont); +} + +template +constexpr span make_span(const Container& cont) +{ + return span(cont); +} + +template +constexpr span make_span(Ptr& cont, std::size_t count) +{ + return span(cont, count); +} + +template +constexpr span make_span(Ptr& cont) +{ + return span(cont); +} + +// Specialization of gsl::at for span +template +constexpr ElementType& at(span s, index i) +{ + // No bounds checking here because it is done in span::operator[] called below + Ensures(i >= 0); + return s[narrow_cast(i)]; +} + +// [span.obs] Free observer functions +template +constexpr std::ptrdiff_t ssize(const span& s) noexcept +{ + return static_cast(s.size()); +} + +// [span.iter] Free functions for begin/end functions +template +constexpr typename span::iterator +begin(const span& s) noexcept +{ + return s.begin(); +} + +template +constexpr typename span::iterator +end(const span& s) noexcept +{ + return s.end(); +} + +template +constexpr typename span::reverse_iterator +rbegin(const span& s) noexcept +{ + return s.rbegin(); +} + +template +constexpr typename span::reverse_iterator +rend(const span& s) noexcept +{ + return s.rend(); +} + +template +constexpr typename span::iterator +cbegin(const span& s) noexcept +{ + return s.begin(); +} + +template +constexpr typename span::iterator +cend(const span& s) noexcept +{ + return s.end(); +} + +template +constexpr typename span::reverse_iterator +crbegin(const span& s) noexcept +{ + return s.rbegin(); +} + +template +constexpr typename span::reverse_iterator +crend(const span& s) noexcept +{ + return s.rend(); +} + +} // namespace gsl + +#endif // GSL_SPAN_EXT_H diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/string_span b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/string_span index bcc672af09..7c1f3458ff 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/string_span +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/include/gsl/string_span @@ -1,759 +1,759 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2015 Microsoft Corporation. All rights reserved. -// -// This code is licensed under the MIT License (MIT). -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef GSL_STRING_SPAN_H -#define GSL_STRING_SPAN_H - -#include // for Ensures, Expects -#include // for operator!=, operator==, dynamic_extent -#include // for narrow_cast - -#include // for equal, lexicographical_compare -#include // for array -#include // for size_t, nullptr_t -#include // for PTRDIFF_MAX -#include -#include // for basic_string, allocator, char_traits -#include // for declval, is_convertible, enable_if_t, add_... - -#if defined(_MSC_VER) && !defined(__clang__) -#pragma warning(push) - -// Turn MSVC /analyze rules that generate too much noise. TODO: fix in the tool. -#pragma warning(disable : 26446) // TODO: bug in parser - attributes and templates -#pragma warning(disable : 26481) // TODO: suppress does not work inside templates sometimes -#pragma warning(disable : 4996) // use of functions & classes marked [[deprecated]] -#endif // _MSC_VER - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - -namespace gsl -{ -// -// czstring and wzstring -// -// These are "tag" typedefs for C-style strings (i.e. null-terminated character arrays) -// that allow static analysis to help find bugs. -// -// There are no additional features/semantics that we can find a way to add inside the -// type system for these types that will not either incur significant runtime costs or -// (sometimes needlessly) break existing programs when introduced. -// - -template -using basic_zstring = CharT*; - -using czstring = basic_zstring; - -using cwzstring = basic_zstring; - -using cu16zstring = basic_zstring; - -using cu32zstring = basic_zstring; - -using zstring = basic_zstring; - -using wzstring = basic_zstring; - -using u16zstring = basic_zstring; - -using u32zstring = basic_zstring; - -namespace details -{ - template - [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " - "isocpp/CppCoreGuidelines PR#1680")]] constexpr std::size_t - string_length(const CharT* str, std::size_t n) - { - if (str == nullptr || n == dynamic_extent) return 0; - - const span str_span{str, n}; - - std::size_t len = 0; - while (len < n && str_span[len]) len++; - - return len; - } -} // namespace details - -// -// ensure_sentinel() -// -// Provides a way to obtain an span from a contiguous sequence -// that ends with a (non-inclusive) sentinel value. -// -// Will fail-fast if sentinel cannot be found before max elements are examined. -// -template -[[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " - "isocpp/CppCoreGuidelines PR#1680")]] constexpr span -ensure_sentinel(T* seq, std::size_t max = static_cast(-1)) -{ - Ensures(seq != nullptr); - - // clang-format off - GSL_SUPPRESS(f.23) // TODO: false positive // TODO: suppress does not work - // clang-format on - auto cur = seq; - Ensures(cur != nullptr); // workaround for removing the warning - - // clang-format off - GSL_SUPPRESS(bounds.1) // TODO: suppress does not work - // clang-format on - while (static_cast(cur - seq) < max && *cur != Sentinel) ++cur; - Ensures(*cur == Sentinel); - return {seq, static_cast(cur - seq)}; -} - -// -// ensure_z - creates a span for a zero terminated strings. The span will not contain the zero -// termination. Will fail fast if a null-terminator cannot be found before the limit of size_type. -// -template -[[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " - "isocpp/CppCoreGuidelines PR#1680")]] constexpr span -ensure_z(CharT* const& sz, std::size_t max = static_cast(-1)) -{ - return ensure_sentinel(sz, max); -} - -template -constexpr span ensure_z(CharT (&sz)[N]) -{ - return ensure_z(&sz[0], N); -} - -template -[[deprecated( - "string_span was removed from the C++ Core Guidelines. For more information, see " - "isocpp/CppCoreGuidelines PR#1680")]] constexpr span::type, - dynamic_extent> -ensure_z(Cont& cont) -{ - return ensure_z(cont.data(), cont.size()); -} - -template -class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " - "see isocpp/CppCoreGuidelines PR#1680")]] basic_string_span; - -namespace details -{ - template - struct [[deprecated( - "string_span was removed from the C++ Core Guidelines. For more information, " - "see isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span_oracle : std::false_type{}; - - template - struct [[deprecated( - "string_span was removed from the C++ Core Guidelines. For more information, see " - "isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span_oracle> - : std::true_type{}; - - template - struct [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span - : is_basic_string_span_oracle>{}; -} // namespace details - -// -// string_span and relatives -// -template -class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " - "see isocpp/CppCoreGuidelines PR#1680")]] basic_string_span -{ -public: - using element_type = CharT; - using value_type = std::remove_cv_t; - using pointer = std::add_pointer_t; - using reference = std::add_lvalue_reference_t; - using const_reference = std::add_lvalue_reference_t>; - using impl_type = span; - - using size_type = typename impl_type::size_type; - using iterator = typename impl_type::iterator; - using reverse_iterator = typename impl_type::reverse_iterator; - - // default (empty) - constexpr basic_string_span() noexcept = default; - - // copy - constexpr basic_string_span(const basic_string_span& other) noexcept = default; - - // assign - constexpr basic_string_span& operator=(const basic_string_span& other) noexcept = default; - - constexpr basic_string_span(pointer ptr, size_type length) : span_(ptr, length) {} - constexpr basic_string_span(pointer firstElem, pointer lastElem) : span_(firstElem, lastElem) {} - - // From static arrays - if 0-terminated, remove 0 from the view - // All other containers allow 0s within the length, so we do not remove them - template - constexpr basic_string_span(element_type(&arr)[N]) : span_(remove_z(arr)) - {} - - template > - constexpr basic_string_span(std::array & arr) noexcept : span_(arr) - {} - - template > - constexpr basic_string_span(const std::array& arr) noexcept : span_(arr) - {} - - // Container signature should work for basic_string after C++17 version exists - template - // GSL_SUPPRESS(bounds.4) // TODO: parser bug - constexpr basic_string_span(std::basic_string & str) - : span_(&str[0], str.length()) - {} - - template - constexpr basic_string_span(const std::basic_string& str) - : span_(&str[0], str.length()) - {} - - // from containers. Containers must have a pointer type and data() function signatures - template ::value && - std::is_convertible::value && - std::is_convertible().data())>::value>> - constexpr basic_string_span(Container & cont) : span_(cont) - {} - - template ::value && - std::is_convertible::value && - std::is_convertible().data())>::value>> - constexpr basic_string_span(const Container& cont) : span_(cont) - {} - - // from string_span - template < - class OtherValueType, std::size_t OtherExtent, - class = std::enable_if_t::impl_type, impl_type>::value>> - constexpr basic_string_span(basic_string_span other) - : span_(other.data(), other.length()) - {} - - template - constexpr basic_string_span first() const - { - return {span_.template first()}; - } - - constexpr basic_string_span first(size_type count) const - { - return {span_.first(count)}; - } - - template - constexpr basic_string_span last() const - { - return {span_.template last()}; - } - - constexpr basic_string_span last(size_type count) const - { - return {span_.last(count)}; - } - - template - constexpr basic_string_span subspan() const - { - return {span_.template subspan()}; - } - - constexpr basic_string_span subspan( - size_type offset, size_type count = dynamic_extent) const - { - return {span_.subspan(offset, count)}; - } - - constexpr reference operator[](size_type idx) const { return span_[idx]; } - constexpr reference operator()(size_type idx) const { return span_[idx]; } - - constexpr pointer data() const { return span_.data(); } - - constexpr size_type length() const noexcept { return span_.size(); } - constexpr size_type size() const noexcept { return span_.size(); } - constexpr size_type size_bytes() const noexcept { return span_.size_bytes(); } - constexpr size_type length_bytes() const noexcept { return span_.length_bytes(); } - constexpr bool empty() const noexcept { return size() == 0; } - - constexpr iterator begin() const noexcept { return span_.begin(); } - constexpr iterator end() const noexcept { return span_.end(); } - - constexpr reverse_iterator rbegin() const noexcept { return span_.rbegin(); } - constexpr reverse_iterator rend() const noexcept { return span_.rend(); } - -private: - static constexpr impl_type remove_z(pointer const& sz, std::size_t max) - { - return impl_type(sz, details::string_length(sz, max)); - } - - template - static constexpr impl_type remove_z(element_type(&sz)[N]) - { - return remove_z(&sz[0], N); - } - - impl_type span_; -}; - -template -using string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using cstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using wstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using cwstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using u16string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using cu16string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using u32string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -template -using cu32string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_string_span; - -// -// to_string() allow (explicit) conversions from string_span to string -// - -template -constexpr std::basic_string::type> -to_string(basic_string_span view) -{ - return {view.data(), narrow_cast(view.length())}; -} - -template , - typename Allocator = std::allocator, typename gCharT, std::size_t Extent> -constexpr std::basic_string -to_basic_string(basic_string_span view) -{ - return {view.data(), narrow_cast(view.length())}; -} - -template -constexpr basic_string_span::value> -as_bytes(basic_string_span s) noexcept -{ - // clang-format off - GSL_SUPPRESS(type.1) - // clang-format on - return {reinterpret_cast(s.data()), s.size_bytes()}; -} - -template ::value>> -constexpr basic_string_span::value> -as_writable_bytes(basic_string_span s) noexcept -{ - // clang-format off - GSL_SUPPRESS(type.1) - // clang-format on - return {reinterpret_cast(s.data()), s.size_bytes()}; -} - -// zero-terminated string span, used to convert -// zero-terminated spans to legacy strings -template -class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " - "see isocpp/CppCoreGuidelines PR#1680")]] basic_zstring_span -{ -public: - using value_type = CharT; - using const_value_type = std::add_const_t; - - using pointer = std::add_pointer_t; - using const_pointer = std::add_pointer_t; - - using zstring_type = basic_zstring; - using const_zstring_type = basic_zstring; - - using impl_type = span; - using string_span_type = basic_string_span; - - constexpr basic_zstring_span(impl_type s) : span_(s) - { - // expects a zero-terminated span - Expects(s.size() > 0); - Expects(s[s.size() - 1] == value_type{}); - } - - // copy - constexpr basic_zstring_span(const basic_zstring_span& other) = default; - - // move - constexpr basic_zstring_span(basic_zstring_span && other) = default; - - // assign - constexpr basic_zstring_span& operator=(const basic_zstring_span& other) = default; - - // move assign - constexpr basic_zstring_span& operator=(basic_zstring_span&& other) = default; - - constexpr bool empty() const noexcept { return false; } - - constexpr string_span_type as_string_span() const noexcept - { - return {span_.data(), span_.size() - 1}; - } - constexpr string_span_type ensure_z() const { return gsl::ensure_z(span_); } - - constexpr const_zstring_type assume_z() const noexcept { return span_.data(); } - -private: - impl_type span_; -}; - -template -using zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using wzstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using u16zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using u32zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using czstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using cwzstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " - "information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using cu16zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For " - "more information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -template -using cu32zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For " - "more information, see isocpp/CppCoreGuidelines PR#1680")]] = - basic_zstring_span; - -// operator == -template ::value || - std::is_convertible>>::value>> -bool operator==(const gsl::basic_string_span& one, const T& other) -{ - const gsl::basic_string_span> tmp(other); - return std::equal(one.begin(), one.end(), tmp.begin(), tmp.end()); -} - -template ::value && - std::is_convertible>>::value>> -bool operator==(const T& one, const gsl::basic_string_span& other) -{ - const gsl::basic_string_span> tmp(one); - return std::equal(tmp.begin(), tmp.end(), other.begin(), other.end()); -} - -// operator != -template , Extent>>::value>> -bool operator!=(gsl::basic_string_span one, const T& other) -{ - return !(one == other); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename = std::enable_if_t< - std::is_convertible, Extent>>::value && - !gsl::details::is_basic_string_span::value>> -bool operator!=(const T& one, gsl::basic_string_span other) -{ - return !(one == other); -} - -// operator< -template , Extent>>::value>> -bool operator<(gsl::basic_string_span one, const T& other) -{ - const gsl::basic_string_span, Extent> tmp(other); - return std::lexicographical_compare(one.begin(), one.end(), tmp.begin(), tmp.end()); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename = std::enable_if_t< - std::is_convertible, Extent>>::value && - !gsl::details::is_basic_string_span::value>> -bool operator<(const T& one, gsl::basic_string_span other) -{ - gsl::basic_string_span, Extent> tmp(one); - return std::lexicographical_compare(tmp.begin(), tmp.end(), other.begin(), other.end()); -} - -#ifndef _MSC_VER - -// VS treats temp and const containers as convertible to basic_string_span, -// so the cases below are already covered by the previous operators - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator<(gsl::basic_string_span one, const T& other) -{ - gsl::basic_string_span, Extent> tmp(other); - return std::lexicographical_compare(one.begin(), one.end(), tmp.begin(), tmp.end()); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator<(const T& one, gsl::basic_string_span other) -{ - gsl::basic_string_span, Extent> tmp(one); - return std::lexicographical_compare(tmp.begin(), tmp.end(), other.begin(), other.end()); -} -#endif - -// operator <= -template , Extent>>::value>> -bool operator<=(gsl::basic_string_span one, const T& other) -{ - return !(other < one); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename = std::enable_if_t< - std::is_convertible, Extent>>::value && - !gsl::details::is_basic_string_span::value>> -bool operator<=(const T& one, gsl::basic_string_span other) -{ - return !(other < one); -} - -#ifndef _MSC_VER - -// VS treats temp and const containers as convertible to basic_string_span, -// so the cases below are already covered by the previous operators - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator<=(gsl::basic_string_span one, const T& other) -{ - return !(other < one); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator<=(const T& one, gsl::basic_string_span other) -{ - return !(other < one); -} -#endif - -// operator> -template , Extent>>::value>> -bool operator>(gsl::basic_string_span one, const T& other) -{ - return other < one; -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename = std::enable_if_t< - std::is_convertible, Extent>>::value && - !gsl::details::is_basic_string_span::value>> -bool operator>(const T& one, gsl::basic_string_span other) -{ - return other < one; -} - -#ifndef _MSC_VER - -// VS treats temp and const containers as convertible to basic_string_span, -// so the cases below are already covered by the previous operators - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator>(gsl::basic_string_span one, const T& other) -{ - return other < one; -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator>(const T& one, gsl::basic_string_span other) -{ - return other < one; -} -#endif - -// operator >= -template , Extent>>::value>> -bool operator>=(gsl::basic_string_span one, const T& other) -{ - return !(one < other); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename = std::enable_if_t< - std::is_convertible, Extent>>::value && - !gsl::details::is_basic_string_span::value>> -bool operator>=(const T& one, gsl::basic_string_span other) -{ - return !(one < other); -} - -#ifndef _MSC_VER - -// VS treats temp and const containers as convertible to basic_string_span, -// so the cases below are already covered by the previous operators - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator>=(gsl::basic_string_span one, const T& other) -{ - return !(one < other); -} - -template < - typename CharT, std::size_t Extent = dynamic_extent, typename T, - typename DataType = typename T::value_type, - typename = std::enable_if_t< - !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && - std::is_convertible::value && - std::is_same().size(), *std::declval().data())>, - DataType>::value>> -bool operator>=(const T& one, gsl::basic_string_span other) -{ - return !(one < other); -} -#endif -} // namespace gsl - -#if defined(_MSC_VER) && !defined(__clang__) -#pragma warning(pop) - -#endif // _MSC_VER - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -#endif // GSL_STRING_SPAN_H +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2015 Microsoft Corporation. All rights reserved. +// +// This code is licensed under the MIT License (MIT). +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef GSL_STRING_SPAN_H +#define GSL_STRING_SPAN_H + +#include // for Ensures, Expects +#include // for operator!=, operator==, dynamic_extent +#include // for narrow_cast + +#include // for equal, lexicographical_compare +#include // for array +#include // for size_t, nullptr_t +#include // for PTRDIFF_MAX +#include +#include // for basic_string, allocator, char_traits +#include // for declval, is_convertible, enable_if_t, add_... + +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(push) + +// Turn MSVC /analyze rules that generate too much noise. TODO: fix in the tool. +#pragma warning(disable : 26446) // TODO: bug in parser - attributes and templates +#pragma warning(disable : 26481) // TODO: suppress does not work inside templates sometimes +#pragma warning(disable : 4996) // use of functions & classes marked [[deprecated]] +#endif // _MSC_VER + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +namespace gsl +{ +// +// czstring and wzstring +// +// These are "tag" typedefs for C-style strings (i.e. null-terminated character arrays) +// that allow static analysis to help find bugs. +// +// There are no additional features/semantics that we can find a way to add inside the +// type system for these types that will not either incur significant runtime costs or +// (sometimes needlessly) break existing programs when introduced. +// + +template +using basic_zstring = CharT*; + +using czstring = basic_zstring; + +using cwzstring = basic_zstring; + +using cu16zstring = basic_zstring; + +using cu32zstring = basic_zstring; + +using zstring = basic_zstring; + +using wzstring = basic_zstring; + +using u16zstring = basic_zstring; + +using u32zstring = basic_zstring; + +namespace details +{ + template + [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " + "isocpp/CppCoreGuidelines PR#1680")]] constexpr std::size_t + string_length(const CharT* str, std::size_t n) + { + if (str == nullptr || n == dynamic_extent) return 0; + + const span str_span{str, n}; + + std::size_t len = 0; + while (len < n && str_span[len]) len++; + + return len; + } +} // namespace details + +// +// ensure_sentinel() +// +// Provides a way to obtain an span from a contiguous sequence +// that ends with a (non-inclusive) sentinel value. +// +// Will fail-fast if sentinel cannot be found before max elements are examined. +// +template +[[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " + "isocpp/CppCoreGuidelines PR#1680")]] constexpr span +ensure_sentinel(T* seq, std::size_t max = static_cast(-1)) +{ + Ensures(seq != nullptr); + + // clang-format off + GSL_SUPPRESS(f.23) // TODO: false positive // TODO: suppress does not work + // clang-format on + auto cur = seq; + Ensures(cur != nullptr); // workaround for removing the warning + + // clang-format off + GSL_SUPPRESS(bounds.1) // TODO: suppress does not work + // clang-format on + while (static_cast(cur - seq) < max && *cur != Sentinel) ++cur; + Ensures(*cur == Sentinel); + return {seq, static_cast(cur - seq)}; +} + +// +// ensure_z - creates a span for a zero terminated strings. The span will not contain the zero +// termination. Will fail fast if a null-terminator cannot be found before the limit of size_type. +// +template +[[deprecated("string_span was removed from the C++ Core Guidelines. For more information, see " + "isocpp/CppCoreGuidelines PR#1680")]] constexpr span +ensure_z(CharT* const& sz, std::size_t max = static_cast(-1)) +{ + return ensure_sentinel(sz, max); +} + +template +constexpr span ensure_z(CharT (&sz)[N]) +{ + return ensure_z(&sz[0], N); +} + +template +[[deprecated( + "string_span was removed from the C++ Core Guidelines. For more information, see " + "isocpp/CppCoreGuidelines PR#1680")]] constexpr span::type, + dynamic_extent> +ensure_z(Cont& cont) +{ + return ensure_z(cont.data(), cont.size()); +} + +template +class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " + "see isocpp/CppCoreGuidelines PR#1680")]] basic_string_span; + +namespace details +{ + template + struct [[deprecated( + "string_span was removed from the C++ Core Guidelines. For more information, " + "see isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span_oracle : std::false_type{}; + + template + struct [[deprecated( + "string_span was removed from the C++ Core Guidelines. For more information, see " + "isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span_oracle> + : std::true_type{}; + + template + struct [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] is_basic_string_span + : is_basic_string_span_oracle>{}; +} // namespace details + +// +// string_span and relatives +// +template +class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " + "see isocpp/CppCoreGuidelines PR#1680")]] basic_string_span +{ +public: + using element_type = CharT; + using value_type = std::remove_cv_t; + using pointer = std::add_pointer_t; + using reference = std::add_lvalue_reference_t; + using const_reference = std::add_lvalue_reference_t>; + using impl_type = span; + + using size_type = typename impl_type::size_type; + using iterator = typename impl_type::iterator; + using reverse_iterator = typename impl_type::reverse_iterator; + + // default (empty) + constexpr basic_string_span() noexcept = default; + + // copy + constexpr basic_string_span(const basic_string_span& other) noexcept = default; + + // assign + constexpr basic_string_span& operator=(const basic_string_span& other) noexcept = default; + + constexpr basic_string_span(pointer ptr, size_type length) : span_(ptr, length) {} + constexpr basic_string_span(pointer firstElem, pointer lastElem) : span_(firstElem, lastElem) {} + + // From static arrays - if 0-terminated, remove 0 from the view + // All other containers allow 0s within the length, so we do not remove them + template + constexpr basic_string_span(element_type(&arr)[N]) : span_(remove_z(arr)) + {} + + template > + constexpr basic_string_span(std::array & arr) noexcept : span_(arr) + {} + + template > + constexpr basic_string_span(const std::array& arr) noexcept : span_(arr) + {} + + // Container signature should work for basic_string after C++17 version exists + template + // GSL_SUPPRESS(bounds.4) // TODO: parser bug + constexpr basic_string_span(std::basic_string & str) + : span_(&str[0], str.length()) + {} + + template + constexpr basic_string_span(const std::basic_string& str) + : span_(&str[0], str.length()) + {} + + // from containers. Containers must have a pointer type and data() function signatures + template ::value && + std::is_convertible::value && + std::is_convertible().data())>::value>> + constexpr basic_string_span(Container & cont) : span_(cont) + {} + + template ::value && + std::is_convertible::value && + std::is_convertible().data())>::value>> + constexpr basic_string_span(const Container& cont) : span_(cont) + {} + + // from string_span + template < + class OtherValueType, std::size_t OtherExtent, + class = std::enable_if_t::impl_type, impl_type>::value>> + constexpr basic_string_span(basic_string_span other) + : span_(other.data(), other.length()) + {} + + template + constexpr basic_string_span first() const + { + return {span_.template first()}; + } + + constexpr basic_string_span first(size_type count) const + { + return {span_.first(count)}; + } + + template + constexpr basic_string_span last() const + { + return {span_.template last()}; + } + + constexpr basic_string_span last(size_type count) const + { + return {span_.last(count)}; + } + + template + constexpr basic_string_span subspan() const + { + return {span_.template subspan()}; + } + + constexpr basic_string_span subspan( + size_type offset, size_type count = dynamic_extent) const + { + return {span_.subspan(offset, count)}; + } + + constexpr reference operator[](size_type idx) const { return span_[idx]; } + constexpr reference operator()(size_type idx) const { return span_[idx]; } + + constexpr pointer data() const { return span_.data(); } + + constexpr size_type length() const noexcept { return span_.size(); } + constexpr size_type size() const noexcept { return span_.size(); } + constexpr size_type size_bytes() const noexcept { return span_.size_bytes(); } + constexpr size_type length_bytes() const noexcept { return span_.length_bytes(); } + constexpr bool empty() const noexcept { return size() == 0; } + + constexpr iterator begin() const noexcept { return span_.begin(); } + constexpr iterator end() const noexcept { return span_.end(); } + + constexpr reverse_iterator rbegin() const noexcept { return span_.rbegin(); } + constexpr reverse_iterator rend() const noexcept { return span_.rend(); } + +private: + static constexpr impl_type remove_z(pointer const& sz, std::size_t max) + { + return impl_type(sz, details::string_length(sz, max)); + } + + template + static constexpr impl_type remove_z(element_type(&sz)[N]) + { + return remove_z(&sz[0], N); + } + + impl_type span_; +}; + +template +using string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using cstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using wstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using cwstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using u16string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using cu16string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using u32string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +template +using cu32string_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_string_span; + +// +// to_string() allow (explicit) conversions from string_span to string +// + +template +constexpr std::basic_string::type> +to_string(basic_string_span view) +{ + return {view.data(), narrow_cast(view.length())}; +} + +template , + typename Allocator = std::allocator, typename gCharT, std::size_t Extent> +constexpr std::basic_string +to_basic_string(basic_string_span view) +{ + return {view.data(), narrow_cast(view.length())}; +} + +template +constexpr basic_string_span::value> +as_bytes(basic_string_span s) noexcept +{ + // clang-format off + GSL_SUPPRESS(type.1) + // clang-format on + return {reinterpret_cast(s.data()), s.size_bytes()}; +} + +template ::value>> +constexpr basic_string_span::value> +as_writable_bytes(basic_string_span s) noexcept +{ + // clang-format off + GSL_SUPPRESS(type.1) + // clang-format on + return {reinterpret_cast(s.data()), s.size_bytes()}; +} + +// zero-terminated string span, used to convert +// zero-terminated spans to legacy strings +template +class [[deprecated("string_span was removed from the C++ Core Guidelines. For more information, " + "see isocpp/CppCoreGuidelines PR#1680")]] basic_zstring_span +{ +public: + using value_type = CharT; + using const_value_type = std::add_const_t; + + using pointer = std::add_pointer_t; + using const_pointer = std::add_pointer_t; + + using zstring_type = basic_zstring; + using const_zstring_type = basic_zstring; + + using impl_type = span; + using string_span_type = basic_string_span; + + constexpr basic_zstring_span(impl_type s) : span_(s) + { + // expects a zero-terminated span + Expects(s.size() > 0); + Expects(s[s.size() - 1] == value_type{}); + } + + // copy + constexpr basic_zstring_span(const basic_zstring_span& other) = default; + + // move + constexpr basic_zstring_span(basic_zstring_span && other) = default; + + // assign + constexpr basic_zstring_span& operator=(const basic_zstring_span& other) = default; + + // move assign + constexpr basic_zstring_span& operator=(basic_zstring_span&& other) = default; + + constexpr bool empty() const noexcept { return false; } + + constexpr string_span_type as_string_span() const noexcept + { + return {span_.data(), span_.size() - 1}; + } + constexpr string_span_type ensure_z() const { return gsl::ensure_z(span_); } + + constexpr const_zstring_type assume_z() const noexcept { return span_.data(); } + +private: + impl_type span_; +}; + +template +using zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using wzstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using u16zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using u32zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using czstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using cwzstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For more " + "information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using cu16zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For " + "more information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +template +using cu32zstring_span [[deprecated("string_span was removed from the C++ Core Guidelines. For " + "more information, see isocpp/CppCoreGuidelines PR#1680")]] = + basic_zstring_span; + +// operator == +template ::value || + std::is_convertible>>::value>> +bool operator==(const gsl::basic_string_span& one, const T& other) +{ + const gsl::basic_string_span> tmp(other); + return std::equal(one.begin(), one.end(), tmp.begin(), tmp.end()); +} + +template ::value && + std::is_convertible>>::value>> +bool operator==(const T& one, const gsl::basic_string_span& other) +{ + const gsl::basic_string_span> tmp(one); + return std::equal(tmp.begin(), tmp.end(), other.begin(), other.end()); +} + +// operator != +template , Extent>>::value>> +bool operator!=(gsl::basic_string_span one, const T& other) +{ + return !(one == other); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename = std::enable_if_t< + std::is_convertible, Extent>>::value && + !gsl::details::is_basic_string_span::value>> +bool operator!=(const T& one, gsl::basic_string_span other) +{ + return !(one == other); +} + +// operator< +template , Extent>>::value>> +bool operator<(gsl::basic_string_span one, const T& other) +{ + const gsl::basic_string_span, Extent> tmp(other); + return std::lexicographical_compare(one.begin(), one.end(), tmp.begin(), tmp.end()); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename = std::enable_if_t< + std::is_convertible, Extent>>::value && + !gsl::details::is_basic_string_span::value>> +bool operator<(const T& one, gsl::basic_string_span other) +{ + gsl::basic_string_span, Extent> tmp(one); + return std::lexicographical_compare(tmp.begin(), tmp.end(), other.begin(), other.end()); +} + +#ifndef _MSC_VER + +// VS treats temp and const containers as convertible to basic_string_span, +// so the cases below are already covered by the previous operators + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator<(gsl::basic_string_span one, const T& other) +{ + gsl::basic_string_span, Extent> tmp(other); + return std::lexicographical_compare(one.begin(), one.end(), tmp.begin(), tmp.end()); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator<(const T& one, gsl::basic_string_span other) +{ + gsl::basic_string_span, Extent> tmp(one); + return std::lexicographical_compare(tmp.begin(), tmp.end(), other.begin(), other.end()); +} +#endif + +// operator <= +template , Extent>>::value>> +bool operator<=(gsl::basic_string_span one, const T& other) +{ + return !(other < one); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename = std::enable_if_t< + std::is_convertible, Extent>>::value && + !gsl::details::is_basic_string_span::value>> +bool operator<=(const T& one, gsl::basic_string_span other) +{ + return !(other < one); +} + +#ifndef _MSC_VER + +// VS treats temp and const containers as convertible to basic_string_span, +// so the cases below are already covered by the previous operators + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator<=(gsl::basic_string_span one, const T& other) +{ + return !(other < one); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator<=(const T& one, gsl::basic_string_span other) +{ + return !(other < one); +} +#endif + +// operator> +template , Extent>>::value>> +bool operator>(gsl::basic_string_span one, const T& other) +{ + return other < one; +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename = std::enable_if_t< + std::is_convertible, Extent>>::value && + !gsl::details::is_basic_string_span::value>> +bool operator>(const T& one, gsl::basic_string_span other) +{ + return other < one; +} + +#ifndef _MSC_VER + +// VS treats temp and const containers as convertible to basic_string_span, +// so the cases below are already covered by the previous operators + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator>(gsl::basic_string_span one, const T& other) +{ + return other < one; +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator>(const T& one, gsl::basic_string_span other) +{ + return other < one; +} +#endif + +// operator >= +template , Extent>>::value>> +bool operator>=(gsl::basic_string_span one, const T& other) +{ + return !(one < other); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename = std::enable_if_t< + std::is_convertible, Extent>>::value && + !gsl::details::is_basic_string_span::value>> +bool operator>=(const T& one, gsl::basic_string_span other) +{ + return !(one < other); +} + +#ifndef _MSC_VER + +// VS treats temp and const containers as convertible to basic_string_span, +// so the cases below are already covered by the previous operators + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator>=(gsl::basic_string_span one, const T& other) +{ + return !(one < other); +} + +template < + typename CharT, std::size_t Extent = dynamic_extent, typename T, + typename DataType = typename T::value_type, + typename = std::enable_if_t< + !gsl::details::is_span::value && !gsl::details::is_basic_string_span::value && + std::is_convertible::value && + std::is_same().size(), *std::declval().data())>, + DataType>::value>> +bool operator>=(const T& one, gsl::basic_string_span other) +{ + return !(one < other); +} +#endif +} // namespace gsl + +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(pop) + +#endif // _MSC_VER + +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif +#endif // GSL_STRING_SPAN_H diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/pipelines/jobs.yml b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/pipelines/jobs.yml index aabd3db5a5..0d6b9eb01b 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/pipelines/jobs.yml +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/pipelines/jobs.yml @@ -1,43 +1,43 @@ -parameters: - CXXVersions: [ 14, 17, 20 ] - buildTypes: [ 'Debug', 'Release' ] - image: '' - - compiler: '' - compilerVersions: ["default"] # if default value, simply uses whatever version is on the machine. - # the text of this default value doesn't actually matter. - setupfile: '' - extraCmakeArgs: '' - -jobs: -- ${{ each compilerVersion in parameters.compilerVersions }}: - - ${{ each CXXVersion in parameters.CXXVersions }}: - - ${{ each buildType in parameters.buildTypes }}: - - job: - displayName: ${{ format('{0} {1} C++{2} {3}', parameters.compiler, compilerVersion, CXXVersion, buildType) }} - pool: - vmImage: ${{ parameters.image }} - continueOnError: false - - steps: - - ${{ if not(eq(parameters.setupfile, '')) }}: - - template: ${{ parameters.setupfile }} - parameters: - version: ${{ compilerVersion }} - - - task: CMake@1 - name: Configure - inputs: - workingDirectory: build - cmakeArgs: '-DGSL_CXX_STANDARD=${{ CXXVersion }} -DCMAKE_BUILD_TYPE=${{ buildType }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ parameters.extraCmakeArgs }} .. ' - - - task: CMake@1 - name: Build - inputs: - workingDirectory: build - cmakeArgs: '--build . ' - - - script: ctest . --output-on-failure --no-compress-output - name: CTest - workingDirectory: build - failOnStderr: true +parameters: + CXXVersions: [ 14, 17, 20 ] + buildTypes: [ 'Debug', 'Release' ] + image: '' + + compiler: '' + compilerVersions: ["default"] # if default value, simply uses whatever version is on the machine. + # the text of this default value doesn't actually matter. + setupfile: '' + extraCmakeArgs: '' + +jobs: +- ${{ each compilerVersion in parameters.compilerVersions }}: + - ${{ each CXXVersion in parameters.CXXVersions }}: + - ${{ each buildType in parameters.buildTypes }}: + - job: + displayName: ${{ format('{0} {1} C++{2} {3}', parameters.compiler, compilerVersion, CXXVersion, buildType) }} + pool: + vmImage: ${{ parameters.image }} + continueOnError: false + + steps: + - ${{ if not(eq(parameters.setupfile, '')) }}: + - template: ${{ parameters.setupfile }} + parameters: + version: ${{ compilerVersion }} + + - task: CMake@1 + name: Configure + inputs: + workingDirectory: build + cmakeArgs: '-DGSL_CXX_STANDARD=${{ CXXVersion }} -DCMAKE_BUILD_TYPE=${{ buildType }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ parameters.extraCmakeArgs }} .. ' + + - task: CMake@1 + name: Build + inputs: + workingDirectory: build + cmakeArgs: '--build . ' + + - script: ctest . --output-on-failure --no-compress-output + name: CTest + workingDirectory: build + failOnStderr: true diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/deathTestCommon.h b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/deathTestCommon.h index 7bf242393f..e92beb3e1b 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/deathTestCommon.h +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/deathTestCommon.h @@ -1,11 +1,11 @@ -#pragma once -#include - -constexpr char deathstring[] = "Expected Death"; -constexpr char failed_set_terminate_deathstring[] = ".*"; - -// This prevents a failed call to set_terminate from failing the test suite. -constexpr const char* GetExpectedDeathString(std::terminate_handler handle) -{ - return handle ? deathstring : failed_set_terminate_deathstring; -} +#pragma once +#include + +constexpr char deathstring[] = "Expected Death"; +constexpr char failed_set_terminate_deathstring[] = ".*"; + +// This prevents a failed call to set_terminate from failing the test suite. +constexpr const char* GetExpectedDeathString(std::terminate_handler handle) +{ + return handle ? deathstring : failed_set_terminate_deathstring; +} diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/no_exception_ensure_tests.cpp b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/no_exception_ensure_tests.cpp index 5fde41cf2f..5e5d6823f6 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/no_exception_ensure_tests.cpp +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/no_exception_ensure_tests.cpp @@ -1,55 +1,55 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2015 Microsoft Corporation. All rights reserved. -// -// This code is licensed under the MIT License (MIT). -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include // for std::exit -#include // for span -#include -#include - -int operator_subscript_no_throw() noexcept -{ - int arr[10]; - const gsl::span sp{arr}; - return sp[11]; -} - -[[noreturn]] void test_terminate() { std::exit(0); } - -void setup_termination_handler() noexcept -{ -#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND) - - auto& handler = gsl::details::get_terminate_handler(); - handler = &test_terminate; - -#else - - std::set_terminate(test_terminate); - -#endif -} - -int main() noexcept -{ - std::cout << "Running main() from " __FILE__ "\n"; -#if defined(IOS_PROCESS_DELAY_WORKAROUND) - std::this_thread::sleep_for(std::chrono::seconds(1)); -#endif - setup_termination_handler(); - operator_subscript_no_throw(); - return -1; -} +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2015 Microsoft Corporation. All rights reserved. +// +// This code is licensed under the MIT License (MIT). +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#include +#include // for std::exit +#include // for span +#include +#include + +int operator_subscript_no_throw() noexcept +{ + int arr[10]; + const gsl::span sp{arr}; + return sp[11]; +} + +[[noreturn]] void test_terminate() { std::exit(0); } + +void setup_termination_handler() noexcept +{ +#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND) + + auto& handler = gsl::details::get_terminate_handler(); + handler = &test_terminate; + +#else + + std::set_terminate(test_terminate); + +#endif +} + +int main() noexcept +{ + std::cout << "Running main() from " __FILE__ "\n"; +#if defined(IOS_PROCESS_DELAY_WORKAROUND) + std::this_thread::sleep_for(std::chrono::seconds(1)); +#endif + setup_termination_handler(); + operator_subscript_no_throw(); + return -1; +} diff --git a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/span_ext_tests.cpp b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/span_ext_tests.cpp index 3d35f8f42e..2c1da0b1ed 100644 --- a/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/span_ext_tests.cpp +++ b/externals/coda-oss/modules/drivers/gsl/GSL-4.0.0/tests/span_ext_tests.cpp @@ -1,361 +1,361 @@ -/////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2015 Microsoft Corporation. All rights reserved. -// -// This code is licensed under the MIT License (MIT). -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -// -/////////////////////////////////////////////////////////////////////////////// - -#include - -#include // for span and span_ext -#include // for narrow_cast, at - -#include // for array -#include // for cerr -#include // for vector - -using namespace std; -using namespace gsl; - -#include "deathTestCommon.h" - -TEST(span_ext_test, make_span_from_pointer_length_constructor) -{ - const auto terminateHandler = std::set_terminate([] { - std::cerr << "Expected Death. from_pointer_length_constructor"; - std::abort(); - }); - const auto expected = GetExpectedDeathString(terminateHandler); - - int arr[4] = {1, 2, 3, 4}; - - { - auto s = make_span(&arr[0], 2); - EXPECT_TRUE(s.size() == 2); - EXPECT_TRUE(s.data() == &arr[0]); - EXPECT_TRUE(s[0] == 1); - EXPECT_TRUE(s[1] == 2); - } - - { - int* p = nullptr; - auto s = make_span(p, narrow_cast::size_type>(0)); - EXPECT_TRUE(s.size() == 0); - EXPECT_TRUE(s.data() == nullptr); - } - - { - int* p = nullptr; - auto workaround_macro = [=]() { make_span(p, 2); }; - EXPECT_DEATH(workaround_macro(), expected); - } -} - -TEST(span_ext_test, make_span_from_pointer_pointer_construction) -{ - int arr[4] = {1, 2, 3, 4}; - - { - auto s = make_span(&arr[0], &arr[2]); - EXPECT_TRUE(s.size() == 2); - EXPECT_TRUE(s.data() == &arr[0]); - EXPECT_TRUE(s[0] == 1); - EXPECT_TRUE(s[1] == 2); - } - - { - auto s = make_span(&arr[0], &arr[0]); - EXPECT_TRUE(s.size() == 0); - EXPECT_TRUE(s.data() == &arr[0]); - } - - { - int* p = nullptr; - auto s = make_span(p, p); - EXPECT_TRUE(s.size() == 0); - EXPECT_TRUE(s.data() == nullptr); - } -} - -TEST(span_ext_test, make_span_from_array_constructor) -{ - int arr[5] = {1, 2, 3, 4, 5}; - int arr2d[2][3] = {1, 2, 3, 4, 5, 6}; - int arr3d[2][3][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; - - { - const auto s = make_span(arr); - EXPECT_TRUE(s.size() == 5); - EXPECT_TRUE(s.data() == std::addressof(arr[0])); - } - - { - const auto s = make_span(std::addressof(arr2d[0]), 1); - EXPECT_TRUE(s.size() == 1); - EXPECT_TRUE(s.data() == std::addressof(arr2d[0])); - } - - { - const auto s = make_span(std::addressof(arr3d[0]), 1); - EXPECT_TRUE(s.size() == 1); - EXPECT_TRUE(s.data() == std::addressof(arr3d[0])); - } -} - -TEST(span_ext_test, make_span_from_dynamic_array_constructor) -{ - double(*arr)[3][4] = new double[100][3][4]; - - { - auto s = make_span(&arr[0][0][0], 10); - EXPECT_TRUE(s.size() == 10); - EXPECT_TRUE(s.data() == &arr[0][0][0]); - } - - delete[] arr; -} - -TEST(span_ext_test, make_span_from_std_array_constructor) -{ - std::array arr = {1, 2, 3, 4}; - - { - auto s = make_span(arr); - EXPECT_TRUE(s.size() == arr.size()); - EXPECT_TRUE(s.data() == arr.data()); - } - - // This test checks for the bug found in gcc 6.1, 6.2, 6.3, 6.4, 6.5 7.1, 7.2, 7.3 - issue #590 - { - gsl::span s1 = make_span(arr); - - static gsl::span s2; - s2 = s1; - -#if defined(__GNUC__) && __GNUC__ == 6 && (__GNUC_MINOR__ == 4 || __GNUC_MINOR__ == 5) && \ - __GNUC_PATCHLEVEL__ == 0 && defined(__OPTIMIZE__) - // Known to be broken in gcc 6.4 and 6.5 with optimizations - // Issue in gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83116 - EXPECT_TRUE(s1.size() == 4); - EXPECT_TRUE(s2.size() == 0); -#else - EXPECT_TRUE(s1.size() == s2.size()); -#endif - } -} - -TEST(span_ext_test, make_span_from_const_std_array_constructor) -{ - const std::array arr = {1, 2, 3, 4}; - - { - auto s = make_span(arr); - EXPECT_TRUE(s.size() == arr.size()); - EXPECT_TRUE(s.data() == arr.data()); - } -} - -TEST(span_ext_test, make_span_from_std_array_const_constructor) -{ - std::array arr = {1, 2, 3, 4}; - - { - auto s = make_span(arr); - EXPECT_TRUE(s.size() == arr.size()); - EXPECT_TRUE(s.data() == arr.data()); - } -} - -TEST(span_ext_test, make_span_from_container_constructor) -{ - std::vector v = {1, 2, 3}; - const std::vector cv = v; - - { - auto s = make_span(v); - EXPECT_TRUE(s.size() == v.size()); - EXPECT_TRUE(s.data() == v.data()); - - auto cs = make_span(cv); - EXPECT_TRUE(cs.size() == cv.size()); - EXPECT_TRUE(cs.data() == cv.data()); - } -} - -TEST(span_test, interop_with_gsl_at) -{ - int arr[5] = {1, 2, 3, 4, 5}; - gsl::span s{arr}; - EXPECT_TRUE(at(s, 0) == 1); - EXPECT_TRUE(at(s, 1) == 2); -} - -TEST(span_ext_test, iterator_free_functions) -{ - int a[] = {1, 2, 3, 4}; - gsl::span s{a}; - - EXPECT_TRUE((std::is_same::value)); - EXPECT_TRUE((std::is_same::value)); - - EXPECT_TRUE((std::is_same::value)); - EXPECT_TRUE((std::is_same::value)); - - EXPECT_TRUE((std::is_same::value)); - EXPECT_TRUE((std::is_same::value)); - - EXPECT_TRUE((std::is_same::value)); - EXPECT_TRUE((std::is_same::value)); - - EXPECT_TRUE(s.begin() == begin(s)); - EXPECT_TRUE(s.end() == end(s)); - - EXPECT_TRUE(s.rbegin() == rbegin(s)); - EXPECT_TRUE(s.rend() == rend(s)); - - EXPECT_TRUE(s.begin() == cbegin(s)); - EXPECT_TRUE(s.end() == cend(s)); - - EXPECT_TRUE(s.rbegin() == crbegin(s)); - EXPECT_TRUE(s.rend() == crend(s)); -} - -TEST(span_ext_test, ssize_free_function) -{ - int a[] = {1, 2, 3, 4}; - gsl::span s{a}; - - EXPECT_FALSE((std::is_same::value)); - EXPECT_TRUE(s.size() == static_cast(ssize(s))); -} - -#ifndef GSL_KERNEL_MODE -TEST(span_ext_test, comparison_operators) -{ - { - gsl::span s1; - gsl::span s2; - EXPECT_TRUE(s1 == s2); - EXPECT_FALSE(s1 != s2); - EXPECT_FALSE(s1 < s2); - EXPECT_TRUE(s1 <= s2); - EXPECT_FALSE(s1 > s2); - EXPECT_TRUE(s1 >= s2); - EXPECT_TRUE(s2 == s1); - EXPECT_FALSE(s2 != s1); - EXPECT_FALSE(s2 != s1); - EXPECT_TRUE(s2 <= s1); - EXPECT_FALSE(s2 > s1); - EXPECT_TRUE(s2 >= s1); - } - - { - int arr[] = {2, 1}; - gsl::span s1 = arr; - gsl::span s2 = arr; - - EXPECT_TRUE(s1 == s2); - EXPECT_FALSE(s1 != s2); - EXPECT_FALSE(s1 < s2); - EXPECT_TRUE(s1 <= s2); - EXPECT_FALSE(s1 > s2); - EXPECT_TRUE(s1 >= s2); - EXPECT_TRUE(s2 == s1); - EXPECT_FALSE(s2 != s1); - EXPECT_FALSE(s2 < s1); - EXPECT_TRUE(s2 <= s1); - EXPECT_FALSE(s2 > s1); - EXPECT_TRUE(s2 >= s1); - } - - { - int arr[] = {2, 1}; // bigger - - gsl::span s1; - gsl::span s2 = arr; - - EXPECT_TRUE(s1 != s2); - EXPECT_TRUE(s2 != s1); - EXPECT_FALSE(s1 == s2); - EXPECT_FALSE(s2 == s1); - EXPECT_TRUE(s1 < s2); - EXPECT_FALSE(s2 < s1); - EXPECT_TRUE(s1 <= s2); - EXPECT_FALSE(s2 <= s1); - EXPECT_TRUE(s2 > s1); - EXPECT_FALSE(s1 > s2); - EXPECT_TRUE(s2 >= s1); - EXPECT_FALSE(s1 >= s2); - } - - { - int arr1[] = {1, 2}; - int arr2[] = {1, 2}; - gsl::span s1 = arr1; - gsl::span s2 = arr2; - - EXPECT_TRUE(s1 == s2); - EXPECT_FALSE(s1 != s2); - EXPECT_FALSE(s1 < s2); - EXPECT_TRUE(s1 <= s2); - EXPECT_FALSE(s1 > s2); - EXPECT_TRUE(s1 >= s2); - EXPECT_TRUE(s2 == s1); - EXPECT_FALSE(s2 != s1); - EXPECT_FALSE(s2 < s1); - EXPECT_TRUE(s2 <= s1); - EXPECT_FALSE(s2 > s1); - EXPECT_TRUE(s2 >= s1); - } - - { - int arr[] = {1, 2, 3}; - - gsl::span s1 = {&arr[0], 2}; // shorter - gsl::span s2 = arr; // longer - - EXPECT_TRUE(s1 != s2); - EXPECT_TRUE(s2 != s1); - EXPECT_FALSE(s1 == s2); - EXPECT_FALSE(s2 == s1); - EXPECT_TRUE(s1 < s2); - EXPECT_FALSE(s2 < s1); - EXPECT_TRUE(s1 <= s2); - EXPECT_FALSE(s2 <= s1); - EXPECT_TRUE(s2 > s1); - EXPECT_FALSE(s1 > s2); - EXPECT_TRUE(s2 >= s1); - EXPECT_FALSE(s1 >= s2); - } - - { - int arr1[] = {1, 2}; // smaller - int arr2[] = {2, 1}; // bigger - - gsl::span s1 = arr1; - gsl::span s2 = arr2; - - EXPECT_TRUE(s1 != s2); - EXPECT_TRUE(s2 != s1); - EXPECT_FALSE(s1 == s2); - EXPECT_FALSE(s2 == s1); - EXPECT_TRUE(s1 < s2); - EXPECT_FALSE(s2 < s1); - EXPECT_TRUE(s1 <= s2); - EXPECT_FALSE(s2 <= s1); - EXPECT_TRUE(s2 > s1); - EXPECT_FALSE(s1 > s2); - EXPECT_TRUE(s2 >= s1); - EXPECT_FALSE(s1 >= s2); - } -} -#endif // GSL_KERNEL_MODE +/////////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2015 Microsoft Corporation. All rights reserved. +// +// This code is licensed under the MIT License (MIT). +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +// +/////////////////////////////////////////////////////////////////////////////// + +#include + +#include // for span and span_ext +#include // for narrow_cast, at + +#include // for array +#include // for cerr +#include // for vector + +using namespace std; +using namespace gsl; + +#include "deathTestCommon.h" + +TEST(span_ext_test, make_span_from_pointer_length_constructor) +{ + const auto terminateHandler = std::set_terminate([] { + std::cerr << "Expected Death. from_pointer_length_constructor"; + std::abort(); + }); + const auto expected = GetExpectedDeathString(terminateHandler); + + int arr[4] = {1, 2, 3, 4}; + + { + auto s = make_span(&arr[0], 2); + EXPECT_TRUE(s.size() == 2); + EXPECT_TRUE(s.data() == &arr[0]); + EXPECT_TRUE(s[0] == 1); + EXPECT_TRUE(s[1] == 2); + } + + { + int* p = nullptr; + auto s = make_span(p, narrow_cast::size_type>(0)); + EXPECT_TRUE(s.size() == 0); + EXPECT_TRUE(s.data() == nullptr); + } + + { + int* p = nullptr; + auto workaround_macro = [=]() { make_span(p, 2); }; + EXPECT_DEATH(workaround_macro(), expected); + } +} + +TEST(span_ext_test, make_span_from_pointer_pointer_construction) +{ + int arr[4] = {1, 2, 3, 4}; + + { + auto s = make_span(&arr[0], &arr[2]); + EXPECT_TRUE(s.size() == 2); + EXPECT_TRUE(s.data() == &arr[0]); + EXPECT_TRUE(s[0] == 1); + EXPECT_TRUE(s[1] == 2); + } + + { + auto s = make_span(&arr[0], &arr[0]); + EXPECT_TRUE(s.size() == 0); + EXPECT_TRUE(s.data() == &arr[0]); + } + + { + int* p = nullptr; + auto s = make_span(p, p); + EXPECT_TRUE(s.size() == 0); + EXPECT_TRUE(s.data() == nullptr); + } +} + +TEST(span_ext_test, make_span_from_array_constructor) +{ + int arr[5] = {1, 2, 3, 4, 5}; + int arr2d[2][3] = {1, 2, 3, 4, 5, 6}; + int arr3d[2][3][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; + + { + const auto s = make_span(arr); + EXPECT_TRUE(s.size() == 5); + EXPECT_TRUE(s.data() == std::addressof(arr[0])); + } + + { + const auto s = make_span(std::addressof(arr2d[0]), 1); + EXPECT_TRUE(s.size() == 1); + EXPECT_TRUE(s.data() == std::addressof(arr2d[0])); + } + + { + const auto s = make_span(std::addressof(arr3d[0]), 1); + EXPECT_TRUE(s.size() == 1); + EXPECT_TRUE(s.data() == std::addressof(arr3d[0])); + } +} + +TEST(span_ext_test, make_span_from_dynamic_array_constructor) +{ + double(*arr)[3][4] = new double[100][3][4]; + + { + auto s = make_span(&arr[0][0][0], 10); + EXPECT_TRUE(s.size() == 10); + EXPECT_TRUE(s.data() == &arr[0][0][0]); + } + + delete[] arr; +} + +TEST(span_ext_test, make_span_from_std_array_constructor) +{ + std::array arr = {1, 2, 3, 4}; + + { + auto s = make_span(arr); + EXPECT_TRUE(s.size() == arr.size()); + EXPECT_TRUE(s.data() == arr.data()); + } + + // This test checks for the bug found in gcc 6.1, 6.2, 6.3, 6.4, 6.5 7.1, 7.2, 7.3 - issue #590 + { + gsl::span s1 = make_span(arr); + + static gsl::span s2; + s2 = s1; + +#if defined(__GNUC__) && __GNUC__ == 6 && (__GNUC_MINOR__ == 4 || __GNUC_MINOR__ == 5) && \ + __GNUC_PATCHLEVEL__ == 0 && defined(__OPTIMIZE__) + // Known to be broken in gcc 6.4 and 6.5 with optimizations + // Issue in gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83116 + EXPECT_TRUE(s1.size() == 4); + EXPECT_TRUE(s2.size() == 0); +#else + EXPECT_TRUE(s1.size() == s2.size()); +#endif + } +} + +TEST(span_ext_test, make_span_from_const_std_array_constructor) +{ + const std::array arr = {1, 2, 3, 4}; + + { + auto s = make_span(arr); + EXPECT_TRUE(s.size() == arr.size()); + EXPECT_TRUE(s.data() == arr.data()); + } +} + +TEST(span_ext_test, make_span_from_std_array_const_constructor) +{ + std::array arr = {1, 2, 3, 4}; + + { + auto s = make_span(arr); + EXPECT_TRUE(s.size() == arr.size()); + EXPECT_TRUE(s.data() == arr.data()); + } +} + +TEST(span_ext_test, make_span_from_container_constructor) +{ + std::vector v = {1, 2, 3}; + const std::vector cv = v; + + { + auto s = make_span(v); + EXPECT_TRUE(s.size() == v.size()); + EXPECT_TRUE(s.data() == v.data()); + + auto cs = make_span(cv); + EXPECT_TRUE(cs.size() == cv.size()); + EXPECT_TRUE(cs.data() == cv.data()); + } +} + +TEST(span_test, interop_with_gsl_at) +{ + int arr[5] = {1, 2, 3, 4, 5}; + gsl::span s{arr}; + EXPECT_TRUE(at(s, 0) == 1); + EXPECT_TRUE(at(s, 1) == 2); +} + +TEST(span_ext_test, iterator_free_functions) +{ + int a[] = {1, 2, 3, 4}; + gsl::span s{a}; + + EXPECT_TRUE((std::is_same::value)); + EXPECT_TRUE((std::is_same::value)); + + EXPECT_TRUE((std::is_same::value)); + EXPECT_TRUE((std::is_same::value)); + + EXPECT_TRUE((std::is_same::value)); + EXPECT_TRUE((std::is_same::value)); + + EXPECT_TRUE((std::is_same::value)); + EXPECT_TRUE((std::is_same::value)); + + EXPECT_TRUE(s.begin() == begin(s)); + EXPECT_TRUE(s.end() == end(s)); + + EXPECT_TRUE(s.rbegin() == rbegin(s)); + EXPECT_TRUE(s.rend() == rend(s)); + + EXPECT_TRUE(s.begin() == cbegin(s)); + EXPECT_TRUE(s.end() == cend(s)); + + EXPECT_TRUE(s.rbegin() == crbegin(s)); + EXPECT_TRUE(s.rend() == crend(s)); +} + +TEST(span_ext_test, ssize_free_function) +{ + int a[] = {1, 2, 3, 4}; + gsl::span s{a}; + + EXPECT_FALSE((std::is_same::value)); + EXPECT_TRUE(s.size() == static_cast(ssize(s))); +} + +#ifndef GSL_KERNEL_MODE +TEST(span_ext_test, comparison_operators) +{ + { + gsl::span s1; + gsl::span s2; + EXPECT_TRUE(s1 == s2); + EXPECT_FALSE(s1 != s2); + EXPECT_FALSE(s1 < s2); + EXPECT_TRUE(s1 <= s2); + EXPECT_FALSE(s1 > s2); + EXPECT_TRUE(s1 >= s2); + EXPECT_TRUE(s2 == s1); + EXPECT_FALSE(s2 != s1); + EXPECT_FALSE(s2 != s1); + EXPECT_TRUE(s2 <= s1); + EXPECT_FALSE(s2 > s1); + EXPECT_TRUE(s2 >= s1); + } + + { + int arr[] = {2, 1}; + gsl::span s1 = arr; + gsl::span s2 = arr; + + EXPECT_TRUE(s1 == s2); + EXPECT_FALSE(s1 != s2); + EXPECT_FALSE(s1 < s2); + EXPECT_TRUE(s1 <= s2); + EXPECT_FALSE(s1 > s2); + EXPECT_TRUE(s1 >= s2); + EXPECT_TRUE(s2 == s1); + EXPECT_FALSE(s2 != s1); + EXPECT_FALSE(s2 < s1); + EXPECT_TRUE(s2 <= s1); + EXPECT_FALSE(s2 > s1); + EXPECT_TRUE(s2 >= s1); + } + + { + int arr[] = {2, 1}; // bigger + + gsl::span s1; + gsl::span s2 = arr; + + EXPECT_TRUE(s1 != s2); + EXPECT_TRUE(s2 != s1); + EXPECT_FALSE(s1 == s2); + EXPECT_FALSE(s2 == s1); + EXPECT_TRUE(s1 < s2); + EXPECT_FALSE(s2 < s1); + EXPECT_TRUE(s1 <= s2); + EXPECT_FALSE(s2 <= s1); + EXPECT_TRUE(s2 > s1); + EXPECT_FALSE(s1 > s2); + EXPECT_TRUE(s2 >= s1); + EXPECT_FALSE(s1 >= s2); + } + + { + int arr1[] = {1, 2}; + int arr2[] = {1, 2}; + gsl::span s1 = arr1; + gsl::span s2 = arr2; + + EXPECT_TRUE(s1 == s2); + EXPECT_FALSE(s1 != s2); + EXPECT_FALSE(s1 < s2); + EXPECT_TRUE(s1 <= s2); + EXPECT_FALSE(s1 > s2); + EXPECT_TRUE(s1 >= s2); + EXPECT_TRUE(s2 == s1); + EXPECT_FALSE(s2 != s1); + EXPECT_FALSE(s2 < s1); + EXPECT_TRUE(s2 <= s1); + EXPECT_FALSE(s2 > s1); + EXPECT_TRUE(s2 >= s1); + } + + { + int arr[] = {1, 2, 3}; + + gsl::span s1 = {&arr[0], 2}; // shorter + gsl::span s2 = arr; // longer + + EXPECT_TRUE(s1 != s2); + EXPECT_TRUE(s2 != s1); + EXPECT_FALSE(s1 == s2); + EXPECT_FALSE(s2 == s1); + EXPECT_TRUE(s1 < s2); + EXPECT_FALSE(s2 < s1); + EXPECT_TRUE(s1 <= s2); + EXPECT_FALSE(s2 <= s1); + EXPECT_TRUE(s2 > s1); + EXPECT_FALSE(s1 > s2); + EXPECT_TRUE(s2 >= s1); + EXPECT_FALSE(s1 >= s2); + } + + { + int arr1[] = {1, 2}; // smaller + int arr2[] = {2, 1}; // bigger + + gsl::span s1 = arr1; + gsl::span s2 = arr2; + + EXPECT_TRUE(s1 != s2); + EXPECT_TRUE(s2 != s1); + EXPECT_FALSE(s1 == s2); + EXPECT_FALSE(s2 == s1); + EXPECT_TRUE(s1 < s2); + EXPECT_FALSE(s2 < s1); + EXPECT_TRUE(s1 <= s2); + EXPECT_FALSE(s2 <= s1); + EXPECT_TRUE(s2 > s1); + EXPECT_FALSE(s1 > s2); + EXPECT_TRUE(s2 >= s1); + EXPECT_FALSE(s1 >= s2); + } +} +#endif // GSL_KERNEL_MODE diff --git a/externals/coda-oss/modules/drivers/gsl/README.txt b/externals/coda-oss/modules/drivers/gsl/README.txt index b5cda32407..b7fe980e49 100644 --- a/externals/coda-oss/modules/drivers/gsl/README.txt +++ b/externals/coda-oss/modules/drivers/gsl/README.txt @@ -1,2 +1,2 @@ -GSL (Guideline Support Library) from https://github.com/Microsoft/GSL - +GSL (Guideline Support Library) from https://github.com/Microsoft/GSL + diff --git a/externals/coda-oss/modules/drivers/hdf5/CMakeLists.txt b/externals/coda-oss/modules/drivers/hdf5/CMakeLists.txt index dd8c01d3f8..c061c7e833 100644 --- a/externals/coda-oss/modules/drivers/hdf5/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/hdf5/CMakeLists.txt @@ -6,9 +6,11 @@ if(CODA_ENABLE_HDF5) if (MSVC) # DO NOT use standard (not legacy) C pre-processor add_compile_options(/Zc:preprocessor-) + + add_compile_definitions (_BIND_TO_CURRENT_VCLIBS_VERSION=1 _CONSOLE) endif() - coda_add_module(${MODULE_NAME} VERSION 1.13.2) + coda_add_module(${MODULE_NAME} VERSION 1.14.2) else() message("${MODULE_NAME} will not be built since HDF5 is not enabled") endif() diff --git a/externals/coda-oss/modules/drivers/hdf5/COPYING b/externals/coda-oss/modules/drivers/hdf5/COPYING index 9d32232bdf..9bd0402525 100644 --- a/externals/coda-oss/modules/drivers/hdf5/COPYING +++ b/externals/coda-oss/modules/drivers/hdf5/COPYING @@ -49,7 +49,7 @@ works thereof, in binary and source code form. Limited portions of HDF5 were developed by Lawrence Berkeley National Laboratory (LBNL). LBNL's Copyright Notice and Licensing Terms can be found here: COPYING_LBNL_HDF5 file in this directory or at -http://support.hdfgroup.org/ftp/HDF5/releases/COPYING_LBNL_HDF5. +https://raw.githubusercontent.com/hdfgroup/hdf5/develop/COPYING_LBNL_HDF5. ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- diff --git a/externals/coda-oss/modules/drivers/hdf5/README.txt b/externals/coda-oss/modules/drivers/hdf5/README.txt index 144c1e5d96..d752b9b8fc 100644 --- a/externals/coda-oss/modules/drivers/hdf5/README.txt +++ b/externals/coda-oss/modules/drivers/hdf5/README.txt @@ -1,2 +1,11 @@ -HDF5 version 1.13.2 from https://github.com/HDFGroup/hdf5/releases/tag/hdf5-1_13_2 +HDF5 version 1.14.2 from https://github.com/HDFGroup/hdf5/releases/tag/hdf5-1_14_2 + +============================================== + +Three files need to be copied and renamed. On each platform + +1. Build using CMake +2. Copy/rename H5Tinit.c to H5Tinit_.c_ +2. Copy/rename H5lib_settings.c to H5lib_settings_.c_ +2. Copy/rename H5pubconf.h to H5pubconf_.h diff --git a/externals/coda-oss/modules/drivers/hdf5/RELEASE.txt b/externals/coda-oss/modules/drivers/hdf5/RELEASE.txt new file mode 100644 index 0000000000..1584042da6 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/RELEASE.txt @@ -0,0 +1,518 @@ +HDF5 version 1.14.2 released on 2023-08-11 +================================================================================ + + +INTRODUCTION +============ + +This document describes the differences between this release and the previous +HDF5 release. It contains information on the platforms tested and known +problems in this release. For more details check the HISTORY*.txt files in the +HDF5 source. + +Note that documentation in the links below will be updated at the time of each +final release. + +Links to HDF5 documentation can be found on The HDF5 web page: + + https://portal.hdfgroup.org/display/HDF5/HDF5 + +The official HDF5 releases can be obtained from: + + https://www.hdfgroup.org/downloads/hdf5/ + +Changes from release to release and new features in the HDF5-1.14.x release series +can be found at: + + https://portal.hdfgroup.org/display/HDF5/Release+Specific+Information + +If you have any questions or comments, please send them to the HDF Help Desk: + + help@hdfgroup.org + + +CONTENTS +======== + +- New Features +- Support for new platforms and languages +- Bug Fixes since HDF5-1.14.1 +- Platforms Tested +- Known Problems +- CMake vs. Autotools installations + + +New Features +============ + + Configuration: + ------------- + - Updated HDF5 API tests CMake code to support VOL connectors + + * Implemented support for fetching, building and testing HDF5 + VOL connectors during the library build process and documented + the feature under doc/cmake-vols-fetchcontent.md + + * Implemented the HDF5_TEST_API_INSTALL option that enables + installation of the HDF5 API tests on the system + + + Library: + -------- + - Added support for in-place type conversion in most cases + + In-place type conversion allows the library to perform type conversion + without an intermediate type conversion buffer. This can improve + performance by allowing I/O in a single operation over the entire + selection instead of being limited by the size of the intermediate buffer. + Implemented for I/O on contiguous and chunked datasets when the selection + is contiguous in memory and when the memory datatype is not smaller than + the file datatype. + + - Changed selection I/O to be on by default when using the MPIO file driver + + - Added support for selection I/O in the MPIO file driver + + Previously, only vector I/O operations were supported. Support for + selection I/O should improve performance and reduce memory uses in some + cases. + + - Change the error handling for a not found path in the find plugin process. + + While attempting to load a plugin the HDF5 library will fail if one of the + directories in the plugin paths does not exist, even if there are more paths + to check. Instead of exiting the function with an error, just log the error + and continue processing the list of paths to check. + + + Parallel Library: + ----------------- + - + + + Fortran Library: + ---------------- + - + + + C++ Library: + ------------ + - + + + Java Library: + ------------- + - + + + Tools: + ------ + - + + + High-Level APIs: + ---------------- + - + + + C Packet Table API: + ------------------- + - + + + Internal header file: + --------------------- + - + + + Documentation: + -------------- + - + + +Support for new platforms, languages and compilers +================================================== + - Linux 5.14.21-cray_shasta_c + #1 SMP x86_64 GNU/Linux + (frontier) + + +Bug Fixes since HDF5-1.14.1 release +=================================== + Library + ------- + - Fixed bugs in selection I/O + + Previously, the library could fail in some cases when performing selection + I/O with type conversion. + + - Fixed CVE-2018-13867 + + A corrupt file containing an invalid local heap datablock address + could trigger an assert failure when the metadata cache attempted + to load the datablock from storage. + + The local heap now verifies that the datablock address is valid + when the local heap header information is parsed. + + - Fixed CVE-2018-11202 + + A malformed file could result in chunk index memory leaks. Under most + conditions (i.e., when the --enable-using-memchecker option is NOT + used), this would result in a small memory leak and and infinite loop + and abort when shutting down the library. The infinite loop would be + due to the "free list" package not being able to clear its resources + so the library couldn't shut down. When the "using a memory checker" + option is used, the free lists are disabled so there is just a memory + leak with no abort on library shutdown. + + The chunk index resources are now correctly cleaned up when reading + misparsed files and valgrind confirms no memory leaks. + + - Fixed an issue where an assert statement was converted to an + incorrect error check statement + + An assert statement in the library dealing with undefined dataset data + fill values was converted to an improper error check that would always + trigger when a dataset's fill value was set to NULL (undefined). This + has now been fixed. + + - Fixed an assertion failure when attempting to use the Subfiling IOC + VFD directly + + The Subfiling feature makes use of two Virtual File Drivers, the + Subfiling VFD and the IOC (I/O Concentrator) VFD. The two VFDs are + intended to be stacked together such that the Subfiling VFD sits + "on top" of the IOC VFD and routes I/O requests through it; using the + IOC VFD alone is currently unsupported. The IOC VFD has been fixed so + that an error message is displayed in this situation rather than causing + an assertion failure. + + - Fixed a potential bug when copying empty enum datatypes + + Copying an empty enum datatype (including implicitly, as when an enum + is a part of a compound datatype) would fail in an assert in debug + mode and could fail in release mode depending on how the platform + handles undefined behavior regarding size 0 memory allocations and + using memcpy with a NULL src pointer. + + The library is now more careful about using memory operations when + copying empty enum datatypes and will not error or raise an assert. + + - Added an AAPL check to H5Acreate + + A check was added to H5Acreate to ensure that a failure is correctly + returned when an invalid Attribute Access Property List is passed + in to the function. The HDF5 API tests were failing for certain + build types due to this condition not being checked previously. + + + Java Library + ------------ + - Fixed switch case 'L' block missing a break statement. + + The HDF5Array.arrayify method is missing a break statement in the case 'L': section + which causes it to fall through and throw an HDF5JavaException when attempting to + read an Array[Array[Long]]. + + The error was fixed by inserting a break statement at the end of the case 'L': sections. + + Fixes GitHub issue #3056 + + + Configuration + ------------- + - Fixed a configuration issue that prevented building of the Subfiling VFD on macOS + + Checks were added to the CMake and Autotools code to verify that CLOCK_MONOTONIC_COARSE, + PTHREAD_MUTEX_ADAPTIVE_NP and pthread_condattr_setclock() are available before attempting + to use them in Subfiling VFD-related utility code. Without these checks, attempting + to build the Subfiling VFD on macOS would fail. + + + Tools + ----- + - Fixed an issue in h5repack for variable-length typed datasets + + When repacking datasets into a new file, h5repack tries to determines whether + it can use H5Ocopy to copy each dataset into the new file, or if it needs to + manually re-create the dataset, then read data from the old dataset and write + it to the new dataset. H5repack was previously using H5Ocopy for datasets with + variable-length datatypes, but this can be problematic if the global heap + addresses involved do not match exactly between the old and new files. These + addresses could change for a variety of reasons, such as the command-line options + provided to h5repack, how h5repack allocates space in the repacked file, etc. + Since H5Ocopy does not currently perform any translation when these addresses + change, datasets that were repacked with H5Ocopy could become unreadable in the + new file. H5repack has been fixed to repack variable-length typed datasets without + using H5Ocopy to ensure that the new datasets always have the correct global heap + addresses. + + + Performance + ------------- + - + + + Fortran API + ----------- + - + + High-Level Library + ------------------ + - + + + Fortran High-Level APIs + ----------------------- + - + + + Documentation + ------------- + - + + + F90 APIs + -------- + - + + + C++ APIs + -------- + - + + + Testing + ------- + - Fixed a testing failure in testphdf5 on Cray machines + + On some Cray machines, what appears to be a bug in Cray MPICH was causing + calls to H5Fis_accessible to create a 0-byte file with strange Unix + permissions. This was causing an H5Fdelete file deletion test in the + testphdf5 program to fail due to a just-deleted HDF5 file appearing to + still be accessible on the file system. The issue in Cray MPICH has been + worked around for the time being by resetting the MPI_Info object on the + File Access Property List used to MPI_INFO_NULL before passing it to the + H5Fis_accessible call. + + - A bug was fixed in the HDF5 API test random datatype generation code + + A bug in the random datatype generation code could cause test failures + when trying to generate an enumeration datatype that has duplicated + name/value pairs in it. This has now been fixed. + + - A bug was fixed in the HDF5 API test VOL connector registration checking code + + The HDF5 API test code checks to see if the VOL connector specified by the + HDF5_VOL_CONNECTOR environment variable (if any) is registered with the library + before attempting to run tests with it so that testing can be skipped and an + error can be returned when a VOL connector fails to register successfully. + Previously, this code didn't account for VOL connectors that specify extra + configuration information in the HDF5_VOL_CONNECTOR environment variable and + would incorrectly report that the specified VOL connector isn't registered + due to including the configuration information as part of the VOL connector + name being checked for registration status. This has now been fixed. + + +Platforms Tested +=================== + + Linux 5.19.0-1023-aws GNU gcc, gfortran, g++ + #24-Ubuntu SMP x86_64 GNU/Linux (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0 + Ubuntu 22.04 Ubuntu clang version 14.0.0-1ubuntu1 + Intel(R) oneAPI DPC++/C++ Compiler 2023.1.0 + ifort (IFORT) 2021.9.0 20230302 + (cmake and autotools) + + Linux 5.16.14-200.fc35 GNU gcc (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) + #1 SMP x86_64 GNU/Linux GNU Fortran (GCC) 11.2.1 20220127 (Red Hat 11.2.1-9) + Fedora35 clang version 13.0.0 (Fedora 13.0.0-3.fc35) + (cmake and autotools) + + Linux 5.14.21-cray_shasta_c cray-mpich/8.1.23 + #1 SMP x86_64 GNU/Linux cce/15.0.0 + (frontier) gcc/12.2.0 + (cmake) + + Linux 5.11.0-34-generic GNU gcc (GCC) 9.4.0-1ubuntu1 + #36-Ubuntu SMP x86_64 GNU/Linux GNU Fortran (GCC) 9.4.0-1ubuntu1 + Ubuntu 20.04 Ubuntu clang version 10.0.0-4ubuntu1 + Intel(R) oneAPI DPC++/C++ Compiler 2023.1.0 + ifort (IFORT) 2021.9.0 20230302 + (cmake and autotools) + + Linux 4.14.0-115.35.1.1chaos aue/openmpi/4.1.4-arm-22.1.0.12 + #1 SMP aarch64 GNU/Linux Arm C/C++/Fortran Compiler version 22.1 + (stria) (based on LLVM 13.0.1) + (cmake) + + Linux 4.14.0-115.35.1.3chaos spectrum-mpi/rolling-release + #1 SMP ppc64le GNU/Linux clang 12.0.1 + (vortex) GCC 8.3.1 + XL 2021.09.22 + (cmake) + + Linux-4.14.0-115.21.2 spectrum-mpi/rolling-release + #1 SMP ppc64le GNU/Linux clang 12.0.1, 14.0.5 + (lassen) GCC 8.3.1 + XL 16.1.1.2, 2021.09.22, 2022.08.05 + (cmake) + + Linux-4.12.14-197.99-default cray-mpich/7.7.14 + #1 SMP x86_64 GNU/Linux cce 12.0.3 + (theta) GCC 11.2.0 + llvm 9.0 + Intel 19.1.2 + + Linux 3.10.0-1160.36.2.el7.ppc64 gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) + #1 SMP ppc64be GNU/Linux g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) + Power8 (echidna) GNU Fortran (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39) + + Linux 3.10.0-1160.24.1.el7 GNU C (gcc), Fortran (gfortran), C++ (g++) + #1 SMP x86_64 GNU/Linux compilers: + Centos7 Version 4.8.5 20150623 (Red Hat 4.8.5-4) + (jelly/kituo/moohan) Version 4.9.3, Version 7.2.0, Version 8.3.0, + Version 9.1.0, Version 10.2.0 + Intel(R) C (icc), C++ (icpc), Fortran (icc) + compilers: + Version 17.0.0.098 Build 20160721 + GNU C (gcc) and C++ (g++) 4.8.5 compilers + with NAG Fortran Compiler Release 7.1(Hanzomon) + Intel(R) C (icc) and C++ (icpc) 17.0.0.098 compilers + with NAG Fortran Compiler Release 7.1(Hanzomon) + MPICH 3.1.4 compiled with GCC 4.9.3 + MPICH 3.3 compiled with GCC 7.2.0 + OpenMPI 3.1.3 compiled with GCC 7.2.0 and 4.1.2 + compiled with GCC 9.1.0 + PGI C, Fortran, C++ for 64-bit target on + x86_64; + Versions 18.4.0 and 19.10-0 + NVIDIA nvc, nvfortran and nvc++ version 22.5-0 + (autotools and cmake) + + + Linux-3.10.0-1160.0.0.1chaos openmpi-4.1.2 + #1 SMP x86_64 GNU/Linux clang 6.0.0, 11.0.1 + (quartz) GCC 7.3.0, 8.1.0 + Intel 19.0.4, 2022.2, oneapi.2022.2 + + Linux-3.10.0-1160.90.1.1chaos openmpi/4.1 + #1 SMP x86_64 GNU/Linux GCC 7.2.0 + (skybridge) Intel/19.1 + (cmake) + + Linux-3.10.0-1160.90.1.1chaos openmpi/4.1 + #1 SMP x86_64 GNU/Linux GCC 7.2.0 + (attaway) Intel/19.1 + (cmake) + + Linux-3.10.0-1160.90.1.1chaos openmpi-intel/4.1 + #1 SMP x86_64 GNU/Linux Intel/19.1.2, 21.3.0 and 22.2.0 + (chama) (cmake) + + macOS Apple M1 11.6 Apple clang version 12.0.5 (clang-1205.0.22.11) + Darwin 20.6.0 arm64 gfortran GNU Fortran (Homebrew GCC 11.2.0) 11.1.0 + (macmini-m1) Intel icc/icpc/ifort version 2021.3.0 202106092021.3.0 20210609 + + macOS Big Sur 11.3.1 Apple clang version 12.0.5 (clang-1205.0.22.9) + Darwin 20.4.0 x86_64 gfortran GNU Fortran (Homebrew GCC 10.2.0_3) 10.2.0 + (bigsur-1) Intel icc/icpc/ifort version 2021.2.0 20210228 + + Mac OS X El Capitan 10.11.6 Apple clang version 7.3.0 from Xcode 7.3 + 64-bit gfortran GNU Fortran (GCC) 5.2.0 + (osx1011test) Intel icc/icpc/ifort version 16.0.2 + + + Linux 2.6.32-573.22.1.el6 GNU C (gcc), Fortran (gfortran), C++ (g++) + #1 SMP x86_64 GNU/Linux compilers: + Centos6 Version 4.4.7 20120313 + (platypus) Version 4.9.3, 5.3.0, 6.2.0 + MPICH 3.1.4 compiled with GCC 4.9.3 + PGI C, Fortran, C++ for 64-bit target on + x86_64; + Version 19.10-0 + + Windows 10 x64 Visual Studio 2019 w/ clang 12.0.0 + with MSVC-like command-line (C/C++ only - cmake) + Visual Studio 2019 w/ Intel C/C++ only cmake) + Visual Studio 2022 w/ clang 15.0.1 + with MSVC-like command-line (C/C++ only - cmake) + Visual Studio 2022 w/ Intel C/C++/Fortran oneAPI 2023 (cmake) + Visual Studio 2019 w/ MSMPI 10.1 (C only - cmake) + + +Known Problems +============== + + CMake files do not behave correctly with paths containing spaces. + Do not use spaces in paths because the required escaping for handling spaces + results in very complex and fragile build files. + ADB - 2019/05/07 + + At present, metadata cache images may not be generated by parallel + applications. Parallel applications can read files with metadata cache + images, but since this is a collective operation, a deadlock is possible + if one or more processes do not participate. + + CPP ptable test fails on both VS2017 and VS2019 with Intel compiler, JIRA + issue: HDFFV-10628. This test will pass with VS2015 with Intel compiler. + + The subsetting option in ph5diff currently will fail and should be avoided. + The subsetting option works correctly in serial h5diff. + + Several tests currently fail on certain platforms: + MPI_TEST-t_bigio fails with spectrum-mpi on ppc64le platforms. + + MPI_TEST-t_subfiling_vfd and MPI_TEST_EXAMPLES-ph5_subfiling fail with + cray-mpich on theta and with XL compilers on ppc64le platforms. + + MPI_TEST_testphdf5_tldsc fails with cray-mpich 7.7 on theta. + + Known problems in previous releases can be found in the HISTORY*.txt files + in the HDF5 source. Please report any new problems found to + help@hdfgroup.org. + + +CMake vs. Autotools installations +================================= +While both build systems produce similar results, there are differences. +Each system produces the same set of folders on linux (only CMake works +on standard Windows); bin, include, lib and share. Autotools places the +COPYING and RELEASE.txt file in the root folder, CMake places them in +the share folder. + +The bin folder contains the tools and the build scripts. Additionally, CMake +creates dynamic versions of the tools with the suffix "-shared". Autotools +installs one set of tools depending on the "--enable-shared" configuration +option. + build scripts + ------------- + Autotools: h5c++, h5cc, h5fc + CMake: h5c++, h5cc, h5hlc++, h5hlcc + +The include folder holds the header files and the fortran mod files. CMake +places the fortran mod files into separate shared and static subfolders, +while Autotools places one set of mod files into the include folder. Because +CMake produces a tools library, the header files for tools will appear in +the include folder. + +The lib folder contains the library files, and CMake adds the pkgconfig +subfolder with the hdf5*.pc files used by the bin/build scripts created by +the CMake build. CMake separates the C interface code from the fortran code by +creating C-stub libraries for each Fortran library. In addition, only CMake +installs the tools library. The names of the szip libraries are different +between the build systems. + +The share folder will have the most differences because CMake builds include +a number of CMake specific files for support of CMake's find_package and support +for the HDF5 Examples CMake project. + +The issues with the gif tool are: + HDFFV-10592 CVE-2018-17433 + HDFFV-10593 CVE-2018-17436 + HDFFV-11048 CVE-2020-10809 +These CVE issues have not yet been addressed and are avoided by not building +the gif tool by default. Enable building the High-Level tools with these options: + autotools: --enable-hlgiftools + cmake: HDF5_BUILD_HL_GIF_TOOLS=ON diff --git a/externals/coda-oss/modules/drivers/hdf5/USING_HDF5_CMake.txt b/externals/coda-oss/modules/drivers/hdf5/USING_HDF5_CMake.txt new file mode 100644 index 0000000000..698b275cf3 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/USING_HDF5_CMake.txt @@ -0,0 +1,257 @@ +************************************************************************ +* Build and Install HDF5 Applications with CMake * +************************************************************************ + +Notes: This short instruction is written for users who want to quickly + build HDF5 applications using the CMake tools. Users can adapt + these instructions for their own applications. For more information, + see the "Minimum C Project Files for CMake" section. + + More information about using CMake can be found at the KitWare + site, www.cmake.org. + + CMake uses the command line; however, the visual CMake tool is + available for the configuration step. The steps are similar for + all of the operating systems supported by CMake. + + NOTES: + 1. Using CMake for building and using HDF5 is under active + development. While we have attempted to provide error-free + files, please understand that development with CMake has not + been extensively tested outside of HDF. The CMake specific + files may change before the next release. + + 2. CMake for HDF5 development should be usable on any system + where CMake is supported. Please send us any comments on how + CMake support can be improved on any system. + + 3. See the appendix at the bottom of this file for an example + of using a ctest script for building and testing. See + INSTALL_CMake.txt for more information. + + 4. See https://cmake.org/cmake/help/latest/command/find_package.html + for more information on the CMake "Config Mode Search Procedure". + + +======================================================================== +I. Preconditions +======================================================================== + + 1. We suggest you obtain the latest CMake for your platform from the Kitware + web site. The HDF5 1.14.x product requires a minimum CMake version + of 3.18. If you are using VS2022, the minimum version is 3.21. + + 2. You have installed the HDF5 library built with CMake, by executing + the HDF Install Utility (the *.msi file in the binary package for + Windows or the *.sh on Linux). You can obtain pre-built binaries + from The HDF Group's website at www.hdfgroup.org. + + 3. Set the HDF5_ROOT CMake variable, -DHDF5_ROOT= + or environment variable, set(ENV{HDF5_ROOT} "") + to the installed location of HDF5. + On Windows: + HDF5_ROOT=C:/Program Files/HDF_Group/HDF5/1.14.x/ + On unix: + HDF5_ROOT=/HDF_Group/HDF5/1.14.x/ + + If you are using shared libraries, you may need to add to the path + environment variable. Set the path environment variable to the + installed location of the library files for HDF5. + On Windows (*.dll): + PATH=%PATH%;C:/Program Files/HDF_Group/HDF5/1.14.x/bin + On unix (*.so): + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/HDF_Group/HDF5/1.14.x/lib + + If you are using filter plugin libraries, you will need to set the + HDF5_PLUGIN_PATH environment variable. + On Windows: + HDF5_PLUGIN_PATH=C:/Program Files/HDF_Group/HDF5/1.14.x/lib/plugin + On unix: + HDF5_PLUGIN_PATH=/HDF_Group/HDF5/1.14.x/lib/plugin + + (Note there are no quote characters used on Windows and all platforms + use forward slashes) + + 4. Created separate source and build directories. + (CMake commands are executed in the build directory) + + 5. Created a CMakeLists.txt file(s) for your source. See Section III + below. + + + +======================================================================== +II. Building HDF5 Applications with CMake +======================================================================== + +Go through these steps to build HDF5 applications with CMake. + (The application must support building with CMake.) + + 1. Run CMake + 2. Configure the cache settings + 3. Build HDF5 Applications + 4. Test HDF5 Applications + +These steps are described in more detail below. + + + + 1. Run CMake + + The visual CMake executable is named "cmake-gui.exe" on Windows and should be + available in your Start menu. For Linux, UNIX, and Mac users the + executable is named "cmake-gui" and can be found where CMake was + installed. + + Specify the source and build directories. Make the build and source + directories different. For example on Windows, if the source is at + c:\MyHDFstuff\hdf5, then use c:\MyHDFstuff\hdf5\build or + c:\MyHDFstuff\build\hdf5 for the build directory. + + PREFERRED: + Users can perform the configuration step without using the visual + cmake-gui program. The following is an example command line + configuration step executed within the build directory: + + cmake -G "" [-D] + + Where is + * MinGW Makefiles + * NMake Makefiles + * Unix Makefiles + * Visual Studio 14 2015 + * Visual Studio 14 2015 Win64 + * Visual Studio 15 2017 + * Visual Studio 15 2017 Win64 + * Visual Studio 16 2019 + * ... in addition VS2019 will need to set the "-A" option, + * ... [Win32, x64, ARM, ARM64] + * Visual Studio 17 2022 + * ... in addition VS2022 will need to set the "-A" option, + * ... [Win32, x64, ARM, ARM64] + + is: + * BUILD_TESTING:BOOL=ON + * BUILD_SHARED_LIBS:BOOL=[ON | OFF] + + 2. Configure the cache settings + + 2.1 Visual CMake users, click the Configure button. If this is the first time you are + running cmake-gui in this directory, you will be prompted for the + generator you wish to use (for example on Windows, Visual Studio 14 2015 Win64). + CMake will read in the CMakeLists.txt files from the source directory and + display options for the HDF5 project. After the first configure you + can adjust the cache settings and/or specify locations of other programs. + + Any conflicts or new values will be highlighted by the configure + process in red. Once you are happy with all the settings and there are no + more values in red, click the Generate button to produce the appropriate + build files. + + On Windows, if you are using a Visual Studio generator, the solution and + project files will be created in the build folder. + + On linux, if you are using the Unix Makefiles generator, the Makefiles will + be created in the build folder. + + 2.2 Alternative command line example on Windows in c:\MyHDFstuff\hdf5\build directory: + + cmake -G "Visual Studio 14 2015 Win64" -DBUILD_TESTING:BOOL=ON .. + + 3. Build HDF5 Applications + + On Windows, you can build HDF5 applications using either the Visual Studio Environment + or the command line. The command line is normally used on linux, Unix, and Mac. + + To build from the command line, navigate to your build directory and + execute the following: + + cmake --build . --config {Debug | Release} + + NOTE: "--config {Debug | Release}" may be optional on your platform. We + recommend choosing either Debug or Release on Windows. If you are + using the pre-built binaries from HDF, use Release. + + 3.1 If you wish to use the Visual Studio environment, open the solution + file in your build directory. Be sure to select either Debug or + Release and build the solution. + + 4. Test HDF5 Applications + + To test the build, navigate to your build directory and execute: + + ctest . -C {Debug | Release} + + NOTE: "-C {Debug | Release}" may be optional on your platform. We + recommend choosing either Debug or Release to match the build + step on Windows. + + 5. The files that support building with CMake are all of the files in the + config/cmake folder, the CMakeLists.txt files in each source folder, and + CTestConfig.cmake. CTestConfig.cmake is specific to the internal testing + performed by The HDF Group. It should be altered for the user's + installation and needs. The cacheinit.cmake file settings are used by + The HDF Group for daily testing. It should be altered/ignored for the user's + installation and needs. + + + +======================================================================== +III. Minimum C Project Files for CMake +======================================================================== + +Given the preconditions in section I, create a CMakeLists.txt file at the +source root. Include the following text in the file: + +########################################################## +cmake_minimum_required (VERSION 3.18) +project (HDF5MyApp C CXX) + +set (LIB_TYPE STATIC) # or SHARED +string(TOLOWER ${LIB_TYPE} SEARCH_TYPE) + +find_package (HDF5 NAMES hdf5 COMPONENTS C ${SEARCH_TYPE}) +# find_package (HDF5) # Find non-cmake built HDF5 +set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${HDF5_INCLUDE_DIR}") +set (LINK_LIBS ${LINK_LIBS} ${HDF5_C_${LIB_TYPE}_LIBRARY}) + +set (example hdf_example) + +add_executable (${example} ${PROJECT_SOURCE_DIR}/${example}.c) +TARGET_C_PROPERTIES (${example} PRIVATE ${LIB_TYPE}) +target_link_libraries (${example} ${LINK_LIBS}) + +enable_testing () +include (CTest) + +add_test (NAME test_example COMMAND ${example}) +########################################################## + + + +======================================================================== +IV. APPENDIX +======================================================================== + +Below is an example of a ctest script that can be used to build the examples. +Adjust the values as necessary. Note that the defaults can be entered on the +command line and the build folder is created as a sub-folder. Windows should +adjust the forward slash to double backslashes, except for the HDF_DIR +environment variable. + +NOTE: this file is available at the HDF web site: + https://portal.hdfgroup.org/display/support/Building+HDF5+with+CMake + + HDF5_Examples.cmake + HDF5_Examples_options.cmake + +Also available at the HDF web site is a CMake application framework template. +You can quickly add files to the framework and execute the script to compile +your application with an installed HDF5 binary. + + +======================================================================== +For further assistance, send email to help@hdfgroup.org +======================================================================== + + diff --git a/externals/coda-oss/modules/drivers/hdf5/USING_HDF5_VS.txt b/externals/coda-oss/modules/drivers/hdf5/USING_HDF5_VS.txt new file mode 100644 index 0000000000..3375a7746d --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/USING_HDF5_VS.txt @@ -0,0 +1,90 @@ + +*********************************************************************** +* HDF5 Build and Install Suggestions for Windows and Visual Studio * +* (Full Version) * +*********************************************************************** + +These suggestions are for Visual Studio users. + +Instructions for building and testing HDF5 applications using CMake can +be found in the USING_HDF5_CMake.txt file found in this folder. + +NOTE: Building applications with the dynamic/shared hdf5 libraries requires + that the "H5_BUILT_AS_DYNAMIC_LIB" compile definition be used. + +The following two sections are helpful if you do not use CMake to build +your applications. + +============================================================================================== +Using Visual Studio 2010 and above with HDF5 Libraries built with Visual Studio 2010 and above +============================================================================================== + + 1. Set up path for external libraries and headers + + The path settings will need to be in the project property sheets per project. + Go to "Project" and select "Properties", find "Configuration Properties", + and then "VC++ Directories". + + 1.1 If you are building on 64-bit Windows, find the "Platform" dropdown + and select "x64". + + 1.2 Add the header path to the "Include Directories" setting. + + 1.3 Add the library path to the "Library Directories" setting. + + 1.4 Select Linker->Input and beginning with the + "Additional Dependencies" line, enter the library names. The + external libraries should be listed first, followed by the HDF5 + library, and then optionally the HDF5 High Level, Fortran or C++ + libraries. For example, to compile a C++ application, enter: + + hdf5.lib hdf5_cpp.lib + + For static linking: + libszaec.lib libaec.lib libzlib.lib libhdf5.lib libhdf5_cpp.lib + + +========================================================================== +Using Visual Studio 2008 with HDF5 Libraries built with Visual Studio 2008 +========================================================================== + + 2. Set up the path for external libraries and headers + + Invoke Microsoft Visual Studio and go to "Tools" and select "Options", + find "Projects", and then "VC++ Directories". + + 2.1 If you are building on 64-bit Windows, find the "Platform" dropdown + and select "x64". + + 2.2 Find the box "Show directories for", choose "Include files", add the + header path (i.e. c:\Program Files\HDF_Group\HDF5\1.14.x\include) + to the included directories. + + 2.3 Find the box "Show directories for", choose "Library files", add the + library path (i.e. c:\Program Files\HDF_Group\HDF5\1.14.x\lib) + to the library directories. + + 2.4 If using Fortran libraries, you will also need to setup the path + for the Intel Fortran compiler. + + 2.5 Select Project->Properties->Linker->Input and beginning with the + "Additional Dependencies" line, enter the library names. The + external libraries should be listed first, followed by the HDF5 + library, and then optionally the HDF5 High Level, Fortran or C++ + libraries. For example, to compile a C++ application, enter: + + szip.lib zlib.lib hdf5.lib hdf5_cpp.lib + +======================================================================== +3. Helpful Pointers +======================================================================== + + 3.1 FAQ + + Many other common questions and hints are located online and being updated + in the HDF Knowledge Base, please see: + + https://portal.hdfgroup.org/display/knowledge/HDF+Knowledge+Base + +************************************************************************ + Please send email to help@hdfgroup.org for further assistance. diff --git a/externals/coda-oss/modules/drivers/hdf5/hdf5-1_13_2.tar.gz b/externals/coda-oss/modules/drivers/hdf5/hdf5-1_14_2.tar.gz similarity index 54% rename from externals/coda-oss/modules/drivers/hdf5/hdf5-1_13_2.tar.gz rename to externals/coda-oss/modules/drivers/hdf5/hdf5-1_14_2.tar.gz index 9d04222952..21073f50f1 100644 Binary files a/externals/coda-oss/modules/drivers/hdf5/hdf5-1_13_2.tar.gz and b/externals/coda-oss/modules/drivers/hdf5/hdf5-1_14_2.tar.gz differ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5ACmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5ACmodule.h index a7f9a27d53..1ce26f6b15 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5ACmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5ACmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5AC package. Including this header means that the source file - * is part of the H5AC package. + * Purpose: This file contains declarations which define macros for the + * H5AC package. Including this header means that the source file + * is part of the H5AC package. */ #ifndef H5ACmodule_H #define H5ACmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5ACpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5ACpkg.h index 704788f630..535eabd5ff 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5ACpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5ACpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,18 +11,15 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: John Mainzer -- 4/19/06 + * Purpose: This file contains declarations which are normally visible + * only within the H5AC package (just H5AC.c at present). * - * Purpose: This file contains declarations which are normally visible - * only within the H5AC package (just H5AC.c at present). - * - * Source files outside the H5AC package should include - * H5ACprivate.h instead. - * - * The one exception to this rule is testpar/t_cache.c. The - * test code is easier to write if it can look at H5AC_aux_t. - * Indeed, this is the main reason why this file was created. + * Source files outside the H5AC package should include + * H5ACprivate.h instead. * + * The one exception to this rule is testpar/t_cache.c. The + * test code is easier to write if it can look at H5AC_aux_t. + * Indeed, this is the main reason why this file was created. */ #if !(defined H5AC_FRIEND || defined H5AC_MODULE) @@ -51,7 +47,7 @@ H5FL_EXTERN(H5AC_aux_t); /* Package Private Macros */ /**************************/ -#define H5AC_DEBUG_DIRTY_BYTES_CREATION 0 +/* #define H5AC_DEBUG_DIRTY_BYTES_CREATION */ #ifdef H5_HAVE_PARALLEL @@ -169,10 +165,6 @@ H5FL_EXTERN(H5AC_aux_t); * * JRM -- 1/6/15 * - * magic: Unsigned 32 bit integer always set to - * H5AC__H5AC_AUX_T_MAGIC. This field is used to validate - * pointers to instances of H5AC_aux_t. - * * mpi_comm: MPI communicator associated with the file for which the * cache has been created. * @@ -354,52 +346,34 @@ H5FL_EXTERN(H5AC_aux_t); #ifdef H5_HAVE_PARALLEL -#define H5AC__H5AC_AUX_T_MAGIC (unsigned)0x00D0A01 - typedef struct H5AC_aux_t { - uint32_t magic; - MPI_Comm mpi_comm; - - int mpi_rank; - - int mpi_size; + int mpi_rank; + int mpi_size; hbool_t write_permitted; - - size_t dirty_bytes_threshold; - - size_t dirty_bytes; - + size_t dirty_bytes_threshold; + size_t dirty_bytes; int32_t metadata_write_strategy; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION - +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION unsigned dirty_bytes_propagations; - size_t unprotect_dirty_bytes; unsigned unprotect_dirty_bytes_updates; - size_t insert_dirty_bytes; unsigned insert_dirty_bytes_updates; - size_t move_dirty_bytes; unsigned move_dirty_bytes_updates; - #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ H5SL_t *d_slist_ptr; - H5SL_t *c_slist_ptr; - H5SL_t *candidate_slist_ptr; void (*write_done)(void); - void (*sync_point_done)(unsigned num_writes, haddr_t *written_entries_tbl); unsigned p0_image_len; - } H5AC_aux_t; /* struct H5AC_aux_t */ /* Typedefs for debugging function pointers */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5ACprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5ACprivate.h index 67a310b003..5ea159e556 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5ACprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5ACprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5ACprivate.h - * Jul 9 1997 - * Robb Matzke * * Purpose: Constants and typedefs available to the rest of the * library. @@ -125,7 +122,7 @@ typedef enum { #define H5AC__DEFAULT_MIN_CLEAN_SIZE H5C__DEFAULT_MIN_CLEAN_SIZE /* Check if we are sanity checking tagging */ -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS #define H5AC_DO_TAGGING_SANITY_CHECKS 1 #else #define H5AC_DO_TAGGING_SANITY_CHECKS 0 diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5ACpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5ACpublic.h index 0e03574dc7..532cc80ed1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5ACpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5ACpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,19 +13,16 @@ /*------------------------------------------------------------------------- * * Created: H5ACpublic.h - * Jul 10 1997 - * Robb Matzke * - * Purpose: Public include file for cache functions. + * Purpose: Public include file for cache functions * *------------------------------------------------------------------------- */ #ifndef H5ACpublic_H #define H5ACpublic_H -/* Public headers needed by this file */ -#include "H5public.h" -#include "H5Cpublic.h" +#include "H5public.h" /* Generic Functions */ +#include "H5Cpublic.h" /* Cache */ /**************************************************************************** * @@ -467,7 +463,7 @@ typedef struct H5AC_cache_config_t { /* general configuration fields: */ //! int version; - /**< Integer field indicating the the version of the H5AC_cache_config_t + /**< Integer field indicating the version of the H5AC_cache_config_t * in use. This field should be set to #H5AC__CURR_CACHE_CONFIG_VERSION * (defined in H5ACpublic.h). */ @@ -563,7 +559,7 @@ typedef struct H5AC_cache_config_t { * The value must lie in the interval [0.0, 1.0]. 0.01 is a good place to * start in the serial case. In the parallel case, a larger value is needed * -- see the overview of the metadata cache in the - * “Metadata Caching in HDF5” section of the -- HDF5 User’s Guide + * “Metadata Caching in HDF5” section of the -- \ref UG * for details. */ size_t max_size; diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5AbstractDs.h b/externals/coda-oss/modules/drivers/hdf5/include/H5AbstractDs.h index b84867b2cb..49bcfebea0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5AbstractDs.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5AbstractDs.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Alltypes.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Alltypes.h index 7a14774f8f..b18add8d1f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Alltypes.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Alltypes.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Amodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Amodule.h index 3586414bb5..18fabe56f5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Amodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Amodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5A package. Including this header means that the source file - * is part of the H5A package. + * Purpose: This file contains declarations which define macros for the + * H5A package. Including this header means that the source file + * is part of the H5A package. */ #ifndef H5Amodule_H #define H5Amodule_H @@ -28,30 +25,92 @@ #define H5_MY_PKG H5A #define H5_MY_PKG_ERR H5E_ATTR -/**\defgroup H5A H5A +/** \page H5A_UG HDF5 Attributes + * + * \section sec_attribute HDF5 Attributes + * + * An HDF5 attribute is a small metadata object describing the nature and/or intended usage of a primary data + * object. A primary data object may be a dataset, group, or committed datatype. + * + * \subsection subsec_attribute_intro Introduction + * + * Attributes are assumed to be very small as data objects go, so storing them as standard HDF5 datasets would + * be quite inefficient. HDF5 attributes are therefore managed through a special attributes interface, + * \ref H5A, which is designed to easily attach attributes to primary data objects as small datasets + * containing metadata information and to minimize storage requirements. + * + * Consider, as examples of the simplest case, a set of laboratory readings taken under known temperature and + * pressure conditions of 18.0 degrees Celsius and 0.5 atmospheres, respectively. The temperature and pressure + * stored as attributes of the dataset could be described as the following name/value pairs: + * \li temp=18.0 + * \li pressure=0.5 + * + * While HDF5 attributes are not standard HDF5 datasets, they have much in common: + * \li An attribute has a user-defined dataspace and the included metadata has a user-assigned datatype + * \li Metadata can be of any valid HDF5 datatype + * \li Attributes are addressed by name + * + * But there are some very important differences: + * \li There is no provision for special storage such as compression or chunking + * \li There is no partial I/O or sub-setting capability for attribute data + * \li Attributes cannot be shared + * \li Attributes cannot have attributes + * \li Being small, an attribute is stored in the object header of the object it describes and is thus + * attached directly to that object + * + * \subsection subsec_error_H5A Attribute Function Summaries + * @see H5A reference manual + * + * \subsection subsec_attribute_program Programming Model for Attributes + * + * The figure below shows the UML model for an HDF5 attribute and its associated dataspace and datatype. + * + * + * + * + *
+ * \image html UML_Attribute.jpg "The UML model for an HDF5 attribute" + *
+ * + * Creating an attribute is similar to creating a dataset. To create an attribute, the application must + * specify the object to which the attribute is attached, the datatype and dataspace of the attribute + * data, and the attribute creation property list. * - * Use the functions in this module to manage HDF5 attributes. + * The following steps are required to create and write an HDF5 attribute: + * \li Obtain the object identifier for the attribute's primary data object + * \li Define the characteristics of the attribute and specify the attribute creation property list + *
  • Define the datatype
  • + *
  • Define the dataspace
  • + *
  • Specify the attribute creation property list
+ * \li Create the attribute + * \li Write the attribute data (optional) + * \li Close the attribute (and datatype, dataspace, and attribute creation property list, if necessary) + * \li Close the primary data object (if appropriate) * - * Like HDF5 datasets, HDF5 attributes are array variables which have an element - * datatype and a shape (dataspace). However, they perform a different function: - * Attributes decorate other HDF5 objects, and are typically used to - * represent application metadata. Unlike datasets, the HDF5 library does not - * support partial I/O operations for attributes and they cannot be compressed - * or extended. + * The following steps are required to open and read/write an existing attribute. Since HDF5 attributes + * allow no partial I/O, you need specify only the attribute and the attribute's memory datatype to read it: + * \li Obtain the object identifier for the attribute's primary data object + * \li Obtain the attribute's name or index + * \li Open the attribute + * \li Get attribute dataspace and datatype (optional) + * \li Specify the attribute's memory type + * \li Read and/or write the attribute data + * \li Close the attribute + * \li Close the primary data object (if appropriate) * * - * + * * * * - * + * * * * *
CreateRead
CreateUpdate
* \snippet{lineno} H5A_examples.c create * - * \snippet{lineno} H5A_examples.c read + * \snippet{lineno} H5A_examples.c update *
UpdateDelete
ReadDelete
- * \snippet{lineno} H5A_examples.c update + * \snippet{lineno} H5A_examples.c read * * \snippet{lineno} H5A_examples.c delete @@ -59,6 +118,266 @@ *
* + * \subsection subsec_attribute_work Working with Attributes + * + * \subsubsection subsubsec_attribute_work_struct The Structure of an Attribute + * + * An attribute has two parts: name and value(s). + * + * HDF5 attributes are sometimes discussed as name/value pairs in the form name=value. + * + * An attribute's name is a null-terminated ASCII or UTF-8 character string. Each attribute attached to an + * object has a unique name. + * + * The value portion of the attribute contains one or more data elements of the same datatype. + * + * HDF5 attributes have all the characteristics of HDF5 datasets except that there is no partial I/O + * capability. In other words, attributes can be written and read only in full with no sub-setting. + * + * \subsubsection subsubsec_attribute_work_create Creating, Writing, and Reading Attributes + * + * If attributes are used in an HDF5 file, these functions will be employed: \ref H5Acreate, \ref H5Awrite, + * and \ref H5Aread. \ref H5Acreate and \ref H5Awrite are used together to place the attribute in the file. If + * an attribute is to be used and is not currently in memory, \ref H5Aread generally comes into play + * usually in concert with one each of the H5Aget_* and H5Aopen_* functions. + * + * To create an attribute, call H5Acreate: + * \code + * hid_t H5Acreate (hid_t loc_id, const char *name, + * hid_t type_id, hid_t space_id, hid_t create_plist, + * hid_t access_plist) + * \endcode + * loc_id identifies the object (dataset, group, or committed datatype) to which the attribute is to be + * attached. name, type_id, space_id, and create_plist convey, respectively, the attribute's name, datatype, + * dataspace, and attribute creation property list. The attribute's name must be locally unique: it must be + * unique within the context of the object to which it is attached. + * + * \ref H5Acreate creates the attribute in memory. The attribute does not exist in the file until + * \ref H5Awrite writes it there. + * + * To write or read an attribute, call H5Awrite or H5Aread, respectively: + * \code + * herr_t H5Awrite (hid_t attr_id, hid_t mem_type_id, const void *buf) + * herr_t H5Aread (hid_t attr_id, hid_t mem_type_id, void *buf) + * \endcode + * attr_id identifies the attribute while mem_type_id identifies the in-memory datatype of the attribute data. + * + * \ref H5Awrite writes the attribute data from the buffer buf to the file. \ref H5Aread reads attribute data + * from the file into buf. + * + * The HDF5 Library converts the metadata between the in-memory datatype, mem_type_id, and the in-file + * datatype, defined when the attribute was created, without user intervention. + * + * \subsubsection subsubsec_attribute_work_access Accessing Attributes by Name or Index + * + * Attributes can be accessed by name or index value. The use of an index value makes it possible to iterate + * through all of the attributes associated with a given object. + * + * To access an attribute by its name, use the \ref H5Aopen_by_name function. \ref H5Aopen_by_name returns an + * attribute identifier that can then be used by any function that must access an attribute such as \ref + * H5Aread. Use the function \ref H5Aget_name to determine an attribute's name. + * + * To access an attribute by its index value, use the \ref H5Aopen_by_idx function. To determine an attribute + * index value when it is not already known, use the H5Oget_info function. \ref H5Aopen_by_idx is generally + * used in the course of opening several attributes for later access. Use \ref H5Aiterate if the intent is to + * perform the same operation on every attribute attached to an object. + * + * \subsubsection subsubsec_attribute_work_info Obtaining Information Regarding an Object's Attributes + * + * In the course of working with HDF5 attributes, one may need to obtain any of several pieces of information: + * \li An attribute name + * \li The dataspace of an attribute + * \li The datatype of an attribute + * \li The number of attributes attached to an object + * + * To obtain an attribute's name, call H5Aget_name with an attribute identifier, attr_id: + * \code + * ssize_t H5Aget_name (hid_t attr_id, size_t buf_size, char *buf) + * \endcode + * As with other attribute functions, attr_id identifies the attribute; buf_size defines the size of the + * buffer; and buf is the buffer to which the attribute's name will be read. + * + * If the length of the attribute name, and hence the value required for buf_size, is unknown, a first call + * to \ref H5Aget_name will return that size. If the value of buf_size used in that first call is too small, + * the name will simply be truncated in buf. A second \ref H5Aget_name call can then be used to retrieve the + * name in an appropriately-sized buffer. + * + * To determine the dataspace or datatype of an attribute, call \ref H5Aget_space or \ref H5Aget_type, + * respectively: \code hid_t H5Aget_space (hid_t attr_id) hid_t H5Aget_type (hid_t attr_id) \endcode \ref + * H5Aget_space returns the dataspace identifier for the attribute attr_id. \ref H5Aget_type returns the + * datatype identifier for the attribute attr_id. + * + * To determine the number of attributes attached to an object, use the \ref H5Oget_info function. The + * function signature is below. \code herr_t H5Oget_info( hid_t object_id, H5O_info_t *object_info ) \endcode + * The number of attributes will be returned in the object_info buffer. This is generally the preferred first + * step in determining attribute index values. If the call returns N, the attributes attached to the object + * object_id have index values of 0 through N-1. + * + * \subsubsection subsubsec_attribute_work_iterate Iterating across an Object's Attributes + * + * It is sometimes useful to be able to perform the identical operation across all of the attributes attached + * to an object. At the simplest level, you might just want to open each attribute. At a higher level, you + * might wish to perform a rather complex operation on each attribute as you iterate across the set. + * + * To iterate an operation across the attributes attached to an object, one must make a series of calls to + * \ref H5Aiterate + * \code + * herr_t H5Aiterate (hid_t obj_id, H5_index_t index_type, + * H5_iter_order_t order, hsize_t *n, H5A_operator2_t op, + * void *op_data) + * \endcode + * \ref H5Aiterate successively marches across all of the attributes attached to the object specified in + * loc_id, performing the operation(s) specified in op_func with the data specified in op_data on each + * attribute. + * + * When \ref H5Aiterate is called, index contains the index of the attribute to be accessed in this call. When + * \ref H5Aiterate returns, index will contain the index of the next attribute. If the returned index is the + * null pointer, then all attributes have been processed, and the iterative process is complete. + * + * op_func is a user-defined operation that adheres to the \ref H5A_operator_t prototype. This prototype and + * certain requirements imposed on the operator's behavior are described in the \ref H5Aiterate entry in the + * \ref RM. + * + * op_data is also user-defined to meet the requirements of op_func. Beyond providing a parameter with which + * to pass this data, HDF5 provides no tools for its management and imposes no restrictions. + * + * \subsubsection subsubsec_attribute_work_delete Deleting an Attribute + * + * Once an attribute has outlived its usefulness or is no longer appropriate, it may become necessary to + * delete it. + * + * To delete an attribute, call \ref H5Adelete + * \code + * herr_t H5Adelete (hid_t loc_id, const char *name) + * \endcode + * \ref H5Adelete removes the attribute name from the group, dataset, or committed datatype specified in + * loc_id. + * + * \ref H5Adelete must not be called if there are any open attribute identifiers on the object loc_id. Such a + * call can cause the internal attribute indexes to change; future writes to an open attribute would then + * produce unintended results. + * + * \subsubsection subsubsec_attribute_work_close Closing an Attribute + * + * As is the case with all HDF5 objects, once access to an attribute it is no longer needed, that attribute + * must be closed. It is best practice to close it as soon as practicable; it is mandatory that it be closed + * prior to the H5close call closing the HDF5 Library. + * + * To close an attribute, call \ref H5Aclose + * \code + * herr_t H5Aclose (hid_t attr_id) + * \endcode + * \ref H5Aclose closes the specified attribute by terminating access to its identifier, attr_id. + * + * \subsection subsec_attribute_special Special Issues + * + * Some special issues for attributes are discussed below. + * + *

Large Numbers of Attributes Stored in Dense Attribute Storage

+ * + * The dense attribute storage scheme was added in version 1.8 so that datasets, groups, and committed + * datatypes that have large numbers of attributes could be processed more quickly. + * + * Attributes start out being stored in an object's header. This is known as compact storage. For more + * information, see "Storage Strategies." + * + * As the number of attributes grows, attribute-related performance slows. To improve performance, dense + * attribute storage can be initiated with the H5Pset_attr_phase_change function. See the HDF5 Reference + * Manual for more information. + * + * When dense attribute storage is enabled, a threshold is defined for the number of attributes kept in + * compact storage. When the number is exceeded, the library moves all of the attributes into dense storage + * at another location. The library handles the movement of attributes and the pointers between the locations + * automatically. If some of the attributes are deleted so that the number falls below the threshold, then + * the attributes are moved back to compact storage by the library. + * + * The improvements in performance from using dense attribute storage are the result of holding attributes + * in a heap and indexing the heap with a B-tree. + * + * Note that there are some disadvantages to using dense attribute storage. One is that this is a new feature. + * Datasets, groups, and committed datatypes that use dense storage cannot be read by applications built with + * earlier versions of the library. Another disadvantage is that attributes in dense storage cannot be + * compressed. + * + *

Large Attributes Stored in Dense Attribute Storage

+ * + * We generally consider the maximum size of an attribute to be 64K bytes. The library has two ways of storing + * attributes larger than 64K bytes: in dense attribute storage or in a separate dataset. Using dense + * attribute storage is described in this section, and storing in a separate dataset is described in the next + * section. + * + * To use dense attribute storage to store large attributes, set the number of attributes that will be stored + * in compact storage to 0 with the H5Pset_attr_phase_change function. This will force all attributes to be + * put into dense attribute storage and will avoid the 64KB size limitation for a single attribute in compact + * attribute storage. + * + * The example code below illustrates how to create a large attribute that will be kept in dense storage. + * + * + * + * + * + * + *
Create
+ * \snippet{lineno} H5A_examples.c create + *
+ * + *

Large Attributes Stored in a Separate Dataset

+ * + * In addition to dense attribute storage (see above), a large attribute can be stored in a separate dataset. + * In the figure below, DatasetA holds an attribute that is too large for the object header in Dataset1. By + * putting a pointer to DatasetA as an attribute in Dataset1, the attribute becomes available to those + * working with Dataset1. + * This way of handling large attributes can be used in situations where backward compatibility is important + * and where compression is important. Applications built with versions before 1.8.x can read large + * attributes stored in separate datasets. Datasets can be compressed while attributes cannot. + * + * + * + * + *
+ * \image html Shared_Attribute.jpg "A large or shared HDF5 attribute and its associated dataset(s)" + *
+ * Note: In the figure above, DatasetA is an attribute of Dataset1 that is too large to store in Dataset1's + * header. DatasetA is associated with Dataset1 by means of an object reference pointer attached as an + * attribute to Dataset1. The attribute in DatasetA can be shared among multiple datasets by means of + * additional object reference pointers attached to additional datasets. + * + *

Shared Attributes

+ * + * Attributes written and managed through the \ref H5A interface cannot be shared. If shared attributes are + * required, they must be handled in the manner described above for large attributes and illustrated in + * the figure above. + * + *

Attribute Names

+ * + * While any ASCII or UTF-8 character may be used in the name given to an attribute, it is usually wise + * to avoid the following kinds of characters: + * \li Commonly used separators or delimiters such as slash, backslash, colon, and semi-colon (\, /, :, ;) + * \li Escape characters + * \li Wild cards such as asterisk and question mark (*, ?) + * NULL can be used within a name, but HDF5 names are terminated with a NULL: whatever comes after the NULL + * will be ignored by HDF5. + * + * The use of ASCII or UTF-8 characters is determined by the character encoding property. See + * #H5Pset_char_encoding in the \ref RM. + * + *

No Special I/O or Storage

+ * + * HDF5 attributes have all the characteristics of HDF5 datasets except the following: + * \li Attributes are written and read only in full: there is no provision for partial I/O or sub-setting + * \li No special storage capability is provided for attributes: there is no compression or chunking, and + * attributes are not extendable + * + * Previous Chapter \ref sec_dataspace - Next Chapter \ref sec_error + * + * \defgroup H5A Attributes (H5A) + * + * An HDF5 attribute is a small metadata object describing the nature and/or intended usage of a primary data + * object. A primary data object may be a dataset, group, or committed datatype. + * + * @see sec_attribute + * */ #endif /* H5Amodule_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Apkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Apkg.h index a25097394f..3a5c411c5f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Apkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Apkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Monday, Apr 20 - * * Purpose: This file contains declarations which are visible only within * the H5A package. Source files outside the H5A package should * include H5Aprivate.h instead. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Aprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Aprivate.h index 1a184b38b7..33f0134004 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Aprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Aprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Apublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Apublic.h index 4ac6a53551..3bef700dd4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Apublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Apublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -17,10 +16,10 @@ #ifndef H5Apublic_H #define H5Apublic_H -/* Public headers needed by this file */ -#include "H5Ipublic.h" /* IDs */ -#include "H5Opublic.h" /* Object Headers */ -#include "H5Tpublic.h" /* Datatypes */ +#include "H5public.h" /* Generic Functions */ +#include "H5Ipublic.h" /* Identifiers */ +#include "H5Opublic.h" /* Object Headers */ +#include "H5Tpublic.h" /* Datatypes */ //! /** @@ -40,7 +39,7 @@ typedef struct { * \param[in] location_id The identifier for the group, dataset * or named datatype being iterated over * \param[in] attr_name The name of the current object attribute - * \param[in] ainfo The attribute’s info struct + * \param[in] ainfo The attribute's info struct * \param[in,out] op_data A pointer to the operator data passed in to * H5Aiterate2() or H5Aiterate_by_name() * \returns The return values from an operator are: @@ -94,8 +93,12 @@ H5_DLL herr_t H5Aclose(hid_t attr_id); * \ingroup ASYNC * \async_variant_of{H5Aclose} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, hid_t es_id); +#else +H5_DLL herr_t H5Aclose_async(hid_t attr_id, hid_t es_id); +#endif /* --------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -124,8 +127,8 @@ H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigne * The attribute identifier returned by this function must be released * with H5Aclose() resource leaks will develop. * - * \note If \p loc_id is a file identifier, the attribute will be attached - * that file’s root group. + * \note If \p loc_id is a file identifier, the attribute will be attached to + * that file's root group. * * \par Example * \snippet H5A_examples.c create @@ -142,9 +145,15 @@ H5_DLL hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_ * \ingroup ASYNC * \async_variant_of{H5Acreate} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Acreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Acreate_async(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, + hid_t acpl_id, hid_t aapl_id, hid_t es_id); +#endif + /*--------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -190,10 +199,17 @@ H5_DLL hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *a * \ingroup ASYNC * \async_variant_of{H5Acreate_by_name} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Acreate_by_name_async(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t type_id, + hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id, + hid_t es_id); +#endif + /*-------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -230,8 +246,8 @@ H5_DLL herr_t H5Adelete(hid_t loc_id, const char *attr_name); * \param[in] obj_name Name of object, relative to location, from which * attribute is to be removed * \param[in] idx_type Type of index - * \param[in] order Order in which to iterate over index - * \param[in] n Offset within index + * \param[in] order Order in which to iterate over the index + * \param[in] n Offset within the index * \lapl_id * * \return \herr_t @@ -248,7 +264,7 @@ H5_DLL herr_t H5Adelete(hid_t loc_id, const char *attr_name); * The order in which the index is to be traversed is specified by * \p order. For example, if \p idx_type, \p order, * and \p n are set to #H5_INDEX_NAME, #H5_ITER_INC, and 5, - * respectively, the fifth attribute in lexicographic order of + * respectively, the fifth attribute in the lexicographic order of * attribute names will be removed. * * The link access property list, \p lapl_id, may provide @@ -310,8 +326,13 @@ H5_DLL htri_t H5Aexists(hid_t obj_id, const char *attr_name); * \ingroup ASYNC * \async_variant_of{H5Aexists} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id, const char *attr_name, hbool_t *exists, hid_t es_id); +#else +H5_DLL herr_t H5Aexists_async(hid_t obj_id, const char *attr_name, hbool_t *exists, hid_t es_id); +#endif + /*-------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -333,7 +354,7 @@ H5_DLL herr_t H5Aexists_async(const char *app_file, const char *app_func, unsign * \p loc_id specifies a location in the file containing the object. * \p obj_name is the name of the object to which the attribute is * attached and can be a relative name, relative to \p loc_id, - * or an absolute name, based in the root group of the file. + * or an absolute name, based on the root group of the file. * * The link access property list, \p lapl_id, may provide * information regarding the properties of links required to access @@ -348,9 +369,15 @@ H5_DLL htri_t H5Aexists_by_name(hid_t obj_id, const char *obj_name, const char * * \ingroup ASYNC * \async_variant_of{H5Aexists_by_name} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *obj_name, const char *attr_name, hbool_t *exists, hid_t lapl_id, hid_t es_id); +#else +H5_DLL herr_t H5Aexists_by_name_async(hid_t loc_id, const char *obj_name, const char *attr_name, + hbool_t *exists, hid_t lapl_id, hid_t es_id); +#endif + /*-------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -365,6 +392,9 @@ H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func * creation property list associated with the attribute specified * by \p attr_id. * + * The creation property list identifier should be released with + * H5Pclose() to prevent resource leaks. + * * \since 1.8.0 * */ @@ -373,7 +403,7 @@ H5_DLL hid_t H5Aget_create_plist(hid_t attr_id); /** * \ingroup H5A * - * \brief Retrieves attribute information, by attribute identifier + * \brief Retrieves attribute information by attribute identifier * * \attr_id * \param[out] ainfo Attribute information struct @@ -399,7 +429,7 @@ H5_DLL herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/); * relative to location * \param[in] idx_type Type of index * \param[in] order Index traversal order - * \param[in] n Attribute’s position in index + * \param[in] n Attribute's position in index * \param[out] ainfo Struct containing returned attribute information * \lapl_id * @@ -408,7 +438,7 @@ H5_DLL herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/); * \details H5Aget_info_by_idx() retrieves information for an attribute * that is attached to an object, which is specified by its * location and name, \p loc_id and \p obj_name, respectively. - * The attribute is located by its index position and the attribute + * The attribute is located by its index position, and the attribute * information is returned in the \p ainfo struct. * * The attribute is located by means of an index type, an index @@ -428,7 +458,7 @@ H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t /** * \ingroup H5A * - * \brief Retrieves attribute information, by attribute name + * \brief Retrieves attribute information by attribute name * * \fgdt_loc_id * \param[in] obj_name Name of the object to which an attribute is attached, @@ -464,7 +494,7 @@ H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char * \param[out] buf Buffer to store name in * * \return Returns the length of the attribute's name, which may be longer - * than \p buf_size, if successful. Otherwise returns a negative + * than \p buf_size, if successful. Otherwise, returns a negative * value. * * \details H5Aget_name() retrieves the name of an attribute specified by @@ -493,13 +523,13 @@ H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf); * relative to location * \param[in] idx_type Type of index * \param[in] order Index traversal order - * \param[in] n Attribute’s position in index + * \param[in] n Attribute's position in index * \param[out] name Attribute name * \param[in] size Size, in bytes, of attribute name * \lapl_id * * \return Returns attribute name size, in bytes, if successful; - * otherwise returns a negative value. + * otherwise, returns a negative value. * * \details H5Aget_name_by_idx() retrieves the name of an attribute that is * attached to an object, which is specified by its location and @@ -511,9 +541,9 @@ H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf); * traversal order, and a position in the index, \p idx_type, * \p order and \p n, respectively. * - * If the attribute name’s size is unknown, the values 0 and NULL + * If the attribute name's size is unknown, the values 0 and NULL * can be passed in for the parameters \p size and \p name. The - * function’s return value will provide the correct value for + * function's return value will provide the correct value for * \p size. * * The link access property list, \p lapl_id, may provide @@ -554,7 +584,7 @@ H5_DLL hid_t H5Aget_space(hid_t attr_id); * \attr_id * * \return Returns the amount of storage size allocated for the attribute; - * otherwise returns 0 (zero). + * otherwise, returns 0 (zero). * * \details H5Aget_storage_size() returns the amount of storage that is * required for the specified attribute, \p attr_id. @@ -615,7 +645,7 @@ H5_DLL hid_t H5Aget_type(hid_t attr_id); * The order of the iteration and the attributes iterated over * are specified by three parameters: the index type, * \p idx_type; the order in which the index is to be traversed, - * \p order; and the attribute’s position in the index, \p idx. + * \p order; and the attribute's position in the index, \p idx. * The next attribute to be operated on is specified by \p idx, * a position in the index. * @@ -634,6 +664,9 @@ H5_DLL hid_t H5Aget_type(hid_t attr_id); * * \note This function is also available through the H5Aiterate() macro. * + * \warning Adding or removing attributes to the object during iteration + * will lead to undefined behavior. + * * \since 1.8.0 * */ @@ -657,7 +690,7 @@ H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t ord * * \return \herr_t * Further note that this function returns the return value of - * the last operator if it was non-zero, which can be a negative + * the last operator if it is non-zero, which can be a negative * value, zero if all attributes were processed, or a positive value * indicating short-circuit success. * @@ -670,7 +703,7 @@ H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t ord * The order of the iteration and the attributes iterated over * are specified by three parameters: the index type, \p idx_type; * the order in which the index is to be traversed, \p order; - * and the attribute’s position in the index, \p idx. + * and the attribute's position in the index, \p idx. * The next attribute to be operated on is specified by \p idx, * a position in the index. * @@ -691,6 +724,9 @@ H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t ord * information regarding the properties of links required to access * the object, \p obj_name. * + * \warning Adding or removing attributes to the object during iteration + * will lead to undefined behavior. + * * \since 1.8.0 * */ @@ -735,8 +771,12 @@ H5_DLL hid_t H5Aopen(hid_t obj_id, const char *attr_name, hid_t aapl_id); * \ingroup ASYNC * \async_variant_of{H5Aopen} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Aopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id, const char *attr_name, hid_t aapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Aopen_async(hid_t obj_id, const char *attr_name, hid_t aapl_id, hid_t es_id); +#endif /*--------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -748,7 +788,7 @@ H5_DLL hid_t H5Aopen_async(const char *app_file, const char *app_func, unsigned * relative to location * \param[in] idx_type Type of index * \param[in] order Index traversal order - * \param[in] n Attribute’s position in index + * \param[in] n Attribute's position in index * \aapl_id * \lapl_id * @@ -785,9 +825,15 @@ H5_DLL hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_t * \ingroup ASYNC * \async_variant_of{H5Aopen_by_idx} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Aopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Aopen_by_idx_async(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id, + hid_t es_id); +#endif /*--------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -834,9 +880,15 @@ H5_DLL hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *att * \ingroup ASYNC * \async_variant_of{H5Aopen_by_name} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Aopen_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, hid_t lapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Aopen_by_name_async(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t aapl_id, + hid_t lapl_id, hid_t es_id); +#endif + /*-------------------------------------------------------------------------- */ /** * \ingroup H5A @@ -873,8 +925,12 @@ H5_DLL herr_t H5Aread(hid_t attr_id, hid_t type_id, void *buf); * \ingroup ASYNC * \async_variant_of{H5Aread} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, hid_t dtype_id, void *buf, hid_t es_id); +#else +H5_DLL herr_t H5Aread_async(chid_t attr_id, hid_t dtype_id, void *buf, hid_t es_id); +#endif /*-------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -902,16 +958,25 @@ H5_DLL herr_t H5Arename(hid_t loc_id, const char *old_name, const char *new_name * \ingroup ASYNC * \async_variant_of{H5Arename} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *old_name, const char *new_name, hid_t es_id); +#else +H5_DLL herr_t H5Arename_async(hid_t loc_id, const char *old_name, const char *new_name, hid_t es_id); +#endif /*--------------------------------------------------------------------------*/ /** * \ingroup ASYNC * \async_variant_of{H5Arename_by_name} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *obj_name, const char *old_attr_name, const char *new_attr_name, hid_t lapl_id, hid_t es_id); +#else +H5_DLL herr_t H5Arename_by_name_async(hid_t loc_id, const char *obj_name, const char *old_attr_name, + const char *new_attr_name, hid_t lapl_id, hid_t es_id); +#endif /*--------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -946,8 +1011,12 @@ H5_DLL herr_t H5Awrite(hid_t attr_id, hid_t type_id, const void *buf); * \ingroup ASYNC * \async_variant_of{H5Awrite} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Awrite_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, hid_t type_id, const void *buf, hid_t es_id); +#else +H5_DLL herr_t H5Awrite_async(hid_t attr_id, hid_t type_id, const void *buf, hid_t es_id); +#endif /*-------------------------------------------------------------------------*/ /** * \ingroup H5A @@ -1087,7 +1156,7 @@ H5_DLL hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t spa * * \fgdt_loc_id * - * \return Returns the number of attributes if successful; otherwise returns + * \return Returns the number of attributes if successful; otherwise, returns * a negative value. * * \deprecation_note{H5Oget_info(), H5Oget_info_by_name(), and H5Oget_info_by_idx()} @@ -1103,7 +1172,7 @@ H5_DLL int H5Aget_num_attrs(hid_t loc_id); /** * \ingroup H5A * - * \brief Calls a user’s function for each attribute on an object + * \brief Calls a user's function for each attribute on an object * * \loc_id * \param[in,out] idx Starting (in) and ending (out) attribute index @@ -1125,6 +1194,9 @@ H5_DLL int H5Aget_num_attrs(hid_t loc_id); * \p op, is returned in \p idx. If \p idx is the null pointer, * then all attributes are processed. * + * \warning Adding or removing attributes to the object during iteration + * will lead to undefined behavior. + * * \version 1.8.0 The function \p H5Aiterate was renamed to H5Aiterate1() * and deprecated in this release. * \since 1.0.0 @@ -1144,8 +1216,8 @@ H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *idx, H5A_operator1_t op, void * * \deprecation_note{H5Aopen_by_idx()} * - * \details H5Aopen_idx() opens an attribute which is attached to the - * object specified with \p loc_id . The location object may be + * \details H5Aopen_idx() opens an attribute that is attached to the + * object specified with \p loc_id. The location object may be * either a group, dataset, or named datatype, all of which may * have any sort of attribute. The attribute specified by the index, * \p idx , indicates the attribute to access. The value of \p idx diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5ArrayType.h b/externals/coda-oss/modules/drivers/hdf5/include/H5ArrayType.h index 29313c49d5..e9afb9c453 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5ArrayType.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5ArrayType.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5AtomType.h b/externals/coda-oss/modules/drivers/hdf5/include/H5AtomType.h index 1b5153ee2a..bb2cf48b33 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5AtomType.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5AtomType.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Attribute.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Attribute.h index 47375a5b99..6851e1ac76 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Attribute.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Attribute.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5B2module.h b/externals/coda-oss/modules/drivers/hdf5/include/H5B2module.h index 6a3131b5cc..8eaea2f266 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5B2module.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5B2module.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5B2 package. Including this header means that the source file - * is part of the H5B2 package. + * Purpose: This file contains declarations which define macros for the + * H5B2 package. Including this header means that the source file + * is part of the H5B2 package. */ #ifndef H5B2module_H #define H5B2module_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5B2pkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5B2pkg.h index 8f441ee207..668ea5d483 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5B2pkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5B2pkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Monday, January 31, 2005 - * - * Purpose: This file contains declarations which are visible only within - * the H5B2 package. Source files outside the H5B2 package should - * include H5B2private.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5B2 package. Source files outside the H5B2 package should + * include H5B2private.h instead. */ #if !(defined H5B2_FRIEND || defined H5B2_MODULE) #error "Do not include this file outside the H5B2 package!" diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5B2private.h b/externals/coda-oss/modules/drivers/hdf5/include/H5B2private.h index a60ee7cf06..354bea5352 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5B2private.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5B2private.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5B2private.h - * Jan 31 2005 - * Quincey Koziol * * Purpose: Private header for library accessible B-tree routines. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Bmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Bmodule.h index 9c0f73bc62..0ded7562a7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Bmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Bmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5B package. Including this header means that the source file - * is part of the H5B package. + * Purpose: This file contains declarations which define macros for the + * H5B package. Including this header means that the source file + * is part of the H5B package. */ #ifndef H5Bmodule_H #define H5Bmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Bpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Bpkg.h index 3a27acb1a2..f50bd48ac2 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Bpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Bpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Thursday, May 15, 2003 - * - * Purpose: This file contains declarations which are visible only within - * the H5B package. Source files outside the H5B package should - * include H5Bprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5B package. Source files outside the H5B package should + * include H5Bprivate.h instead. */ #if !(defined H5B_FRIEND || defined H5B_MODULE) #error "Do not include this file outside the H5B package!" @@ -48,21 +44,21 @@ /* The B-tree node as stored in memory... */ typedef struct H5B_t { H5AC_info_t cache_info; /* Information for H5AC cache functions */ - /* _must_ be first field in structure */ - H5UC_t *rc_shared; /*ref-counted shared info */ - unsigned level; /*node level */ - unsigned nchildren; /*number of child pointers */ - haddr_t left; /*address of left sibling */ - haddr_t right; /*address of right sibling */ - uint8_t *native; /*array of keys in native format */ - haddr_t *child; /*2k child pointers */ + /* MUST be first field in structure */ + H5UC_t *rc_shared; /* Ref-counted shared info */ + unsigned level; /* Node level */ + unsigned nchildren; /* Number of child pointers */ + haddr_t left; /* Address of left sibling */ + haddr_t right; /* Address of right sibling */ + uint8_t *native; /* Array of keys in native format */ + haddr_t *child; /* 2k child pointers */ } H5B_t; /* Callback info for loading a B-tree node into the cache */ typedef struct H5B_cache_ud_t { - H5F_t *f; /* File that B-tree node is within */ - const struct H5B_class_t *type; /* Type of tree */ - H5UC_t *rc_shared; /* Ref-counted shared info */ + H5F_t *f; /* File that B-tree node is within */ + const struct H5B_class_t *type; /* Type of tree */ + H5UC_t *rc_shared; /* Ref-counted shared info */ } H5B_cache_ud_t; /*****************************/ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Bprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Bprivate.h index b3311f0704..fd06efeeec 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Bprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Bprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Bprivate.h - * Jul 10 1997 - * Robb Matzke * * Purpose: Private non-prototype header. * @@ -83,16 +80,16 @@ typedef int (*H5B_operator_t)(H5F_t *f, const void *_lt_key, haddr_t addr, const * the instances of nodes in that B-tree. */ typedef struct H5B_shared_t { - const struct H5B_class_t *type; /* Type of tree */ - unsigned two_k; /* 2*"K" value for tree's nodes */ - size_t sizeof_rkey; /* Size of raw (disk) key */ - size_t sizeof_rnode; /* Size of raw (disk) node */ - size_t sizeof_keys; /* Size of native (memory) key node */ - size_t sizeof_addr; /* Size of file address (in bytes) */ - size_t sizeof_len; /* Size of file lengths (in bytes) */ + const struct H5B_class_t *type; /* Type of tree */ + unsigned two_k; /* 2*"K" value for tree's nodes */ + size_t sizeof_rkey; /* Size of raw (disk) key */ + size_t sizeof_rnode; /* Size of raw (disk) node */ + size_t sizeof_keys; /* Size of native (memory) key node */ + size_t sizeof_addr; /* Size of file address (in bytes) */ + size_t sizeof_len; /* Size of file lengths (in bytes) */ uint8_t *page; /* Disk page */ size_t *nkey; /* Offsets of each native key in native key buffer */ - void *udata; /* 'Local' info for a B-tree */ + void *udata; /* 'Local' info for a B-tree */ } H5B_shared_t; /* @@ -102,7 +99,6 @@ typedef struct H5B_shared_t { * has an array of K values indexed by the `id' class field below. The * array is initialized with the HDF5_BTREE_K_DEFAULT macro. */ - typedef struct H5B_class_t { H5B_subid_t id; /*id as found in file*/ size_t sizeof_nkey; /*size of native (memory) key*/ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5CSprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5CSprivate.h index 2dc28f5ad1..5cdf2d5fdd 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5CSprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5CSprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5CXmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5CXmodule.h index f9844a1f9a..ffb4804ab5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5CXmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5CXmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Sunday, February 25, 2018 - * - * Purpose: This file contains declarations which define macros for the - * H5CX package. Including this header means that the source file - * is part of the H5CX package. + * Purpose: This file contains declarations which define macros for the + * H5CX package. Including this header means that the source file + * is part of the H5CX package. */ #ifndef H5CXmodule_H #define H5CXmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5CXprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5CXprivate.h index 4c034c1a4d..f0bec205da 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5CXprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5CXprivate.h @@ -115,6 +115,9 @@ H5_DLL herr_t H5CX_get_filter_cb(H5Z_cb_t *filter_cb); H5_DLL herr_t H5CX_get_data_transform(H5Z_data_xform_t **data_transform); H5_DLL herr_t H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info); H5_DLL herr_t H5CX_get_dt_conv_cb(H5T_conv_cb_t *cb_struct); +H5_DLL herr_t H5CX_get_selection_io_mode(H5D_selection_io_mode_t *selection_io_mode); +H5_DLL herr_t H5CX_get_no_selection_io_cause(uint32_t *no_selection_io_cause); +H5_DLL herr_t H5CX_get_modify_write_buf(hbool_t *modify_write_buf); /* "Getter" routines for LCPL properties cached in API context */ H5_DLL herr_t H5CX_get_encoding(H5T_cset_t *encoding); @@ -158,6 +161,9 @@ H5_DLL herr_t H5CX_set_nlinks(size_t nlinks); H5_DLL herr_t H5CX_init(void); /* "Setter" routines for cached DXPL properties that must be returned to application */ + +H5_DLL void H5CX_set_no_selection_io_cause(uint32_t no_selection_io_cause); + #ifdef H5_HAVE_PARALLEL H5_DLL void H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t chunk_opt); H5_DLL void H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t actual_io_mode); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Classes.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Classes.h index 7820ce2564..b4a0670d46 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Classes.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Classes.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Clog.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Clog.h index ae06525998..b8ea5eda3d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Clog.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Clog.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -133,7 +132,7 @@ H5_DLL herr_t H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry herr_t fxn_ret_value); /* Logging-specific setup functions */ -H5_DLL herr_t H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank); -H5_DLL herr_t H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank); +H5_DLL herr_t H5C__log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank); +H5_DLL herr_t H5C__log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank); #endif /* H5Clog_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Cmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Cmodule.h index a3ef4d65ea..64c5279d92 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Cmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Cmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5C package. Including this header means that the source file - * is part of the H5C package. + * Purpose: This file contains declarations which define macros for the + * H5C package. Including this header means that the source file + * is part of the H5C package. */ #ifndef H5Cmodule_H #define H5Cmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5CommonFG.h b/externals/coda-oss/modules/drivers/hdf5/include/H5CommonFG.h index d87f9ca134..e6756177a7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5CommonFG.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5CommonFG.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5CompType.h b/externals/coda-oss/modules/drivers/hdf5/include/H5CompType.h index 59fd9cf993..0675d2041d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5CompType.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5CompType.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Cpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Cpkg.h index cfa8a6608d..cccb47fcd9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Cpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Cpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,18 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: John Mainzer -- 10/12/04 - * - * Purpose: This file contains declarations which are normally visible - * only within the H5C package. - * - * Source files outside the H5C package should include - * H5Cprivate.h instead. - * - * The one exception to this rule is test/cache.c. The test - * code is easier to write if it can look at the cache's - * internal data structures. Indeed, this is the main - * reason why this file was created. + * Purpose: This file contains declarations which are visible only within + * the H5C package. Source files outside the H5C package should + * include H5Cprivate.h instead. */ /* clang-format off */ @@ -50,22 +40,13 @@ /* Number of epoch markers active */ #define H5C__MAX_EPOCH_MARKERS 10 - /* Cache configuration settings */ #define H5C__HASH_TABLE_LEN (64 * 1024) /* must be a power of 2 */ -#define H5C__H5C_T_MAGIC 0x005CAC0E - /* Initial allocated size of the "flush_dep_parent" array */ #define H5C_FLUSH_DEP_PARENT_INIT 8 -/* Set to TRUE to enable the slist optimization. If this field is TRUE, - * the slist is disabled whenever a flush is not in progress. - */ -#define H5C__SLIST_OPT_ENABLED TRUE - - /**************************************************************************** * * We maintain doubly linked lists of instances of H5C_cache_entry_t for a @@ -84,515 +65,151 @@ * to the HGOTO_ERROR macro, which may not be appropriate in all cases. * If so, we will need versions of the insertion and deletion macros which * do not reference the sanity checking macros. - * JRM - 5/5/04 - * - * Changes: - * - * - Removed the line: - * - * ( ( (Size) == (entry_ptr)->size ) && ( (len) != 1 ) ) || - * - * from the H5C__DLL_PRE_REMOVE_SC macro. With the addition of the - * epoch markers used in the age out based cache size reduction algorithm, - * this invariant need not hold, as the epoch markers are of size 0. - * - * One could argue that I should have given the epoch markers a positive - * size, but this would break the index_size = LRU_list_size + pl_size - * + pel_size invariant. - * - * Alternatively, I could pass the current decr_mode in to the macro, - * and just skip the check whenever epoch markers may be in use. - * - * However, any size errors should be caught when the cache is flushed - * and destroyed. Until we are tracking such an error, this should be - * good enough. - * JRM - 12/9/04 - * - * - * - In the H5C__DLL_PRE_INSERT_SC macro, replaced the lines: - * - * ( ( (len) == 1 ) && - * ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || - * ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) - * ) - * ) || - * - * with: - * - * ( ( (len) == 1 ) && - * ( ( (head_ptr) != (tail_ptr) ) || - * ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) - * ) - * ) || - * - * Epoch markers have size 0, so we can now have a non-empty list with - * zero size. Hence the "( (Size) <= 0 )" clause cause false failures - * in the sanity check. Since "Size" is typically a size_t, it can't - * take on negative values, and thus the revised clause "( (Size) < 0 )" - * caused compiler warnings. - * JRM - 12/22/04 - * - * - In the H5C__DLL_SC macro, replaced the lines: - * - * ( ( (len) == 1 ) && - * ( ( (head_ptr) != (tail_ptr) ) || ( (cache_ptr)->size <= 0 ) || - * ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) - * ) - * ) || - * - * with - * - * ( ( (len) == 1 ) && - * ( ( (head_ptr) != (tail_ptr) ) || - * ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) - * ) - * ) || - * - * Epoch markers have size 0, so we can now have a non-empty list with - * zero size. Hence the "( (Size) <= 0 )" clause cause false failures - * in the sanity check. Since "Size" is typically a size_t, it can't - * take on negative values, and thus the revised clause "( (Size) < 0 )" - * caused compiler warnings. - * JRM - 1/10/05 - * - * - Added the H5C__DLL_UPDATE_FOR_SIZE_CHANGE macro and the associated - * sanity checking macros. These macro are used to update the size of - * a DLL when one of its entries changes size. - * - * JRM - 9/8/05 - * - * - Added macros supporting the index list -- a doubly liked list of - * all entries in the index. This list is necessary to reduce the - * cost of visiting all entries in the cache, which was previously - * done via a scan of the hash table. - * - * JRM - 10/15/15 * ****************************************************************************/ -#if H5C_DO_SANITY_CHECKS - -#define H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ -if ( ( (head_ptr) == NULL ) || \ - ( (tail_ptr) == NULL ) || \ - ( (entry_ptr) == NULL ) || \ - ( (len) <= 0 ) || \ - ( (Size) < (entry_ptr)->size ) || \ - ( ( (entry_ptr)->prev == NULL ) && ( (head_ptr) != (entry_ptr) ) ) || \ - ( ( (entry_ptr)->next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \ - ( ( (len) == 1 ) && \ - ( ! ( ( (head_ptr) == (entry_ptr) ) && \ - ( (tail_ptr) == (entry_ptr) ) && \ - ( (entry_ptr)->next == NULL ) && \ - ( (entry_ptr)->prev == NULL ) && \ - ( (Size) == (entry_ptr)->size ) \ - ) \ - ) \ - ) \ - ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL pre remove SC failed") \ -} - -#define H5C__DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ -if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ - ( (head_ptr) != (tail_ptr) ) \ - ) || \ - ( (len) < 0 ) || \ - ( (Size) < 0 ) || \ - ( ( (len) == 1 ) && \ - ( ( (head_ptr) != (tail_ptr) ) || \ - ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ - ) \ - ) || \ - ( ( (len) >= 1 ) && \ - ( ( (head_ptr) == NULL ) || ( (head_ptr)->prev != NULL ) || \ - ( (tail_ptr) == NULL ) || ( (tail_ptr)->next != NULL ) \ - ) \ - ) \ - ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL sanity check failed") \ -} - -#define H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ -if ( ( (entry_ptr) == NULL ) || \ - ( (entry_ptr)->next != NULL ) || \ - ( (entry_ptr)->prev != NULL ) || \ - ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ - ( (head_ptr) != (tail_ptr) ) \ - ) || \ - ( ( (len) == 1 ) && \ - ( ( (head_ptr) != (tail_ptr) ) || \ - ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ - ) \ - ) || \ - ( ( (len) >= 1 ) && \ - ( ( (head_ptr) == NULL ) || ( (head_ptr)->prev != NULL ) || \ - ( (tail_ptr) == NULL ) || ( (tail_ptr)->next != NULL ) \ - ) \ - ) \ +#ifdef H5C_DO_SANITY_CHECKS + +#define H5C__GEN_DLL_PRE_REMOVE_SC(entry_ptr, list_next, list_prev, head_ptr, tail_ptr, len, list_size, fail_val) \ +do { if ((head_ptr) == NULL || (tail_ptr) == NULL || \ + (entry_ptr) == NULL || (len) <= 0 || \ + (list_size) < (entry_ptr)->size || \ + ((entry_ptr)->list_prev == NULL && (head_ptr) != (entry_ptr)) || \ + ((entry_ptr)->list_next == NULL && (tail_ptr) != (entry_ptr)) || \ + ((len) == 1 && \ + !((head_ptr) == (entry_ptr) && (tail_ptr) == (entry_ptr) && \ + (entry_ptr)->list_next == NULL && (entry_ptr)->list_prev == NULL && \ + (list_size) == (entry_ptr)->size \ + ) \ + ) \ ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "DLL pre insert SC failed") \ -} - -#define H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ -if ( ( (dll_len) <= 0 ) || \ - ( (dll_size) <= 0 ) || \ - ( (old_size) <= 0 ) || \ - ( (old_size) > (dll_size) ) || \ - ( (new_size) <= 0 ) || \ - ( ( (dll_len) == 1 ) && ( (old_size) != (dll_size) ) ) ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "DLL pre size update SC failed") \ -} - -#define H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ -if ( ( (new_size) > (dll_size) ) || \ - ( ( (dll_len) == 1 ) && ( (new_size) != (dll_size) ) ) ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "DLL post size update SC failed") \ -} - -#else /* H5C_DO_SANITY_CHECKS */ - -#define H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) -#define H5C__DLL_SC(head_ptr, tail_ptr, len, Size, fv) -#define H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) -#define H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) -#define H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) - -#endif /* H5C_DO_SANITY_CHECKS */ - - -#define H5C__DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ -{ \ - H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (tail_ptr)->next = (entry_ptr); \ - (entry_ptr)->prev = (tail_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += (entry_ptr)->size; \ -} /* H5C__DLL_APPEND() */ - -#define H5C__DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ -{ \ - H5C__DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (head_ptr)->prev = (entry_ptr); \ - (entry_ptr)->next = (head_ptr); \ - (head_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; \ -} /* H5C__DLL_PREPEND() */ - -#define H5C__DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ -{ \ - H5C__DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - { \ - if ( (head_ptr) == (entry_ptr) ) \ - { \ - (head_ptr) = (entry_ptr)->next; \ - if ( (head_ptr) != NULL ) \ - (head_ptr)->prev = NULL; \ - } \ - else \ - (entry_ptr)->prev->next = (entry_ptr)->next; \ - if ( (tail_ptr) == (entry_ptr) ) \ - { \ - (tail_ptr) = (entry_ptr)->prev; \ - if ( (tail_ptr) != NULL ) \ - (tail_ptr)->next = NULL; \ - } \ - else \ - (entry_ptr)->next->prev = (entry_ptr)->prev; \ - entry_ptr->next = NULL; \ - entry_ptr->prev = NULL; \ - (len)--; \ - (Size) -= entry_ptr->size; \ - } \ -} /* H5C__DLL_REMOVE() */ - -#define H5C__DLL_UPDATE_FOR_SIZE_CHANGE(dll_len, dll_size, old_size, new_size) \ -{ \ - H5C__DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ - (dll_size) -= (old_size); \ - (dll_size) += (new_size); \ - H5C__DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size) \ -} /* H5C__DLL_UPDATE_FOR_SIZE_CHANGE() */ - -#if H5C_DO_SANITY_CHECKS - -#define H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ -if ( ( (hd_ptr) == NULL ) || \ - ( (tail_ptr) == NULL ) || \ - ( (entry_ptr) == NULL ) || \ - ( (len) <= 0 ) || \ - ( (Size) < (entry_ptr)->size ) || \ - ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \ - ( ( (entry_ptr)->aux_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \ - ( ( (entry_ptr)->aux_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \ - ( ( (len) == 1 ) && \ - ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \ - ( (entry_ptr)->aux_next == NULL ) && \ - ( (entry_ptr)->aux_prev == NULL ) && \ - ( (Size) == (entry_ptr)->size ) \ - ) \ - ) \ - ) \ - ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "aux DLL pre remove SC failed") \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "DLL pre remove SC failed"); \ +} } while (0) + +#define H5C__GEN_DLL_PRE_INSERT_SC(entry_ptr, list_next, list_prev, head_ptr, tail_ptr, len, list_size, fail_val) \ +if ((entry_ptr) == NULL || (entry_ptr)->list_next != NULL || (entry_ptr)->list_prev != NULL || \ + (((head_ptr) == NULL || (tail_ptr) == NULL) && (head_ptr) != (tail_ptr)) || \ + ((len) == 0 && \ + ((list_size) > 0 || (head_ptr) != NULL || (tail_ptr) != NULL) \ + ) || \ + ((len) == 1 && \ + ((head_ptr) != (tail_ptr) || (head_ptr) == NULL || \ + (head_ptr)->size != (list_size)) \ + ) || \ + ((len) >= 1 && \ + ((head_ptr) == NULL || (head_ptr)->list_prev != NULL || \ + (tail_ptr) == NULL || (tail_ptr)->list_next != NULL) \ + ) \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "DLL pre insert SC failed"); \ } -#define H5C__AUX_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ -if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ - ( (head_ptr) != (tail_ptr) ) \ - ) || \ - ( (len) < 0 ) || \ - ( (Size) < 0 ) || \ - ( ( (len) == 1 ) && \ - ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ - ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ - ) \ - ) || \ - ( ( (len) >= 1 ) && \ - ( ( (head_ptr) == NULL ) || ( (head_ptr)->aux_prev != NULL ) || \ - ( (tail_ptr) == NULL ) || ( (tail_ptr)->aux_next != NULL ) \ - ) \ - ) \ - ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "AUX DLL sanity check failed") \ +#define H5C__GEN_DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size, fail_val) \ +if ((dll_len) <= 0 || (dll_size) <= 0 || (old_size) <= 0 || \ + (old_size) > (dll_size) || (new_size) <= 0 || \ + ((dll_len) == 1 && (old_size) != (dll_size)) \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "DLL pre size update SC failed"); \ } -#define H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ -if ( ( (entry_ptr) == NULL ) || \ - ( (entry_ptr)->aux_next != NULL ) || \ - ( (entry_ptr)->aux_prev != NULL ) || \ - ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ - ( (hd_ptr) != (tail_ptr) ) \ - ) || \ - ( ( (len) == 1 ) && \ - ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ - ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \ - ) \ - ) || \ - ( ( (len) >= 1 ) && \ - ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->aux_prev != NULL ) || \ - ( (tail_ptr) == NULL ) || ( (tail_ptr)->aux_next != NULL ) \ - ) \ - ) \ - ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "AUX DLL pre insert SC failed") \ +#define H5C__GEN_DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size, fail_val) \ +if ((new_size) > (dll_size) || ((dll_len) == 1 && (new_size) != (dll_size))) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "DLL post size update SC failed"); \ } - #else /* H5C_DO_SANITY_CHECKS */ - -#define H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) -#define H5C__AUX_DLL_SC(head_ptr, tail_ptr, len, Size, fv) -#define H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) - +#define H5C__GEN_DLL_PRE_REMOVE_SC(entry_ptr, list_next, list_prev, head_ptr, tail_ptr, len, list_size, fail_val) +#define H5C__GEN_DLL_PRE_INSERT_SC(entry_ptr, list_next, list_prev, head_ptr, tail_ptr, len, list_size, fail_val) +#define H5C__GEN_DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size, fail_val) +#define H5C__GEN_DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size, fail_val) #endif /* H5C_DO_SANITY_CHECKS */ - -#define H5C__AUX_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val)\ +#define H5C__GEN_DLL_APPEND(entry_ptr, list_next, list_prev, head_ptr, tail_ptr, len, list_size, fail_val) \ { \ - H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ + H5C__GEN_DLL_PRE_INSERT_SC(entry_ptr, list_next, list_prev, head_ptr, tail_ptr, len, list_size, fail_val) \ + if ((head_ptr) == NULL) { \ (head_ptr) = (entry_ptr); \ (tail_ptr) = (entry_ptr); \ } \ - else \ - { \ - (tail_ptr)->aux_next = (entry_ptr); \ - (entry_ptr)->aux_prev = (tail_ptr); \ + else { \ + (tail_ptr)->list_next = (entry_ptr); \ + (entry_ptr)->list_prev = (tail_ptr); \ (tail_ptr) = (entry_ptr); \ } \ (len)++; \ - (Size) += entry_ptr->size; \ -} /* H5C__AUX_DLL_APPEND() */ - -#define H5C__AUX_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ -{ \ - H5C__AUX_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (head_ptr)->aux_prev = (entry_ptr); \ - (entry_ptr)->aux_next = (head_ptr); \ - (head_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; \ -} /* H5C__AUX_DLL_PREPEND() */ - -#define H5C__AUX_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ -{ \ - H5C__AUX_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ - { \ - if ( (head_ptr) == (entry_ptr) ) \ - { \ - (head_ptr) = (entry_ptr)->aux_next; \ - if ( (head_ptr) != NULL ) \ - (head_ptr)->aux_prev = NULL; \ - } \ - else \ - (entry_ptr)->aux_prev->aux_next = (entry_ptr)->aux_next; \ - if ( (tail_ptr) == (entry_ptr) ) \ - { \ - (tail_ptr) = (entry_ptr)->aux_prev; \ - if ( (tail_ptr) != NULL ) \ - (tail_ptr)->aux_next = NULL; \ - } \ - else \ - (entry_ptr)->aux_next->aux_prev = (entry_ptr)->aux_prev; \ - entry_ptr->aux_next = NULL; \ - entry_ptr->aux_prev = NULL; \ - (len)--; \ - (Size) -= entry_ptr->size; \ - } \ -} /* H5C__AUX_DLL_REMOVE() */ - -#if H5C_DO_SANITY_CHECKS - -#define H5C__IL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ -if ( ( (hd_ptr) == NULL ) || \ - ( (tail_ptr) == NULL ) || \ - ( (entry_ptr) == NULL ) || \ - ( (len) <= 0 ) || \ - ( (Size) < (entry_ptr)->size ) || \ - ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \ - ( ( (entry_ptr)->il_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \ - ( ( (entry_ptr)->il_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \ - ( ( (len) == 1 ) && \ - ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \ - ( (entry_ptr)->il_next == NULL ) && \ - ( (entry_ptr)->il_prev == NULL ) && \ - ( (Size) == (entry_ptr)->size ) \ - ) \ - ) \ - ) \ - ) { \ - HDassert(0 && "il DLL pre remove SC failed"); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "il DLL pre remove SC failed") \ -} - -#define H5C__IL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ -if ( ( (entry_ptr) == NULL ) || \ - ( (entry_ptr)->il_next != NULL ) || \ - ( (entry_ptr)->il_prev != NULL ) || \ - ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ - ( (hd_ptr) != (tail_ptr) ) \ - ) || \ - ( ( (len) == 1 ) && \ - ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ - ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \ - ) \ - ) || \ - ( ( (len) >= 1 ) && \ - ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->il_prev != NULL ) || \ - ( (tail_ptr) == NULL ) || ( (tail_ptr)->il_next != NULL ) \ - ) \ - ) \ - ) { \ - HDassert(0 && "IL DLL pre insert SC failed"); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "IL DLL pre insert SC failed") \ -} - -#define H5C__IL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ -if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ - ( (head_ptr) != (tail_ptr) ) \ - ) || \ - ( ( (len) == 1 ) && \ - ( ( (head_ptr) != (tail_ptr) ) || \ - ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ - ) \ - ) || \ - ( ( (len) >= 1 ) && \ - ( ( (head_ptr) == NULL ) || ( (head_ptr)->il_prev != NULL ) || \ - ( (tail_ptr) == NULL ) || ( (tail_ptr)->il_next != NULL ) \ - ) \ - ) \ - ) { \ - HDassert(0 && "IL DLL sanity check failed"); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "IL DLL sanity check failed") \ -} - -#else /* H5C_DO_SANITY_CHECKS */ + (list_size) += (entry_ptr)->size; \ +} /* H5C__GEN_DLL_APPEND() */ -#define H5C__IL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) -#define H5C__IL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) -#define H5C__IL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) - -#endif /* H5C_DO_SANITY_CHECKS */ - - -#define H5C__IL_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val)\ -{ \ - H5C__IL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (tail_ptr)->il_next = (entry_ptr); \ - (entry_ptr)->il_prev = (tail_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; \ - H5C__IL_DLL_SC(head_ptr, tail_ptr, len, Size, fail_val) \ -} /* H5C__IL_DLL_APPEND() */ +#define H5C__GEN_DLL_PREPEND(entry_ptr, list_next, list_prev, head_ptr, tail_ptr, len, list_size, fail_val) \ +{ \ + H5C__GEN_DLL_PRE_INSERT_SC(entry_ptr, list_next, list_prev, head_ptr, tail_ptr, len, list_size, fail_val) \ + if ((head_ptr) == NULL) { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else { \ + (head_ptr)->list_prev = (entry_ptr); \ + (entry_ptr)->list_next = (head_ptr); \ + (head_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (list_size) += (entry_ptr)->size; \ +} /* H5C__GEN_DLL_PREPEND() */ -#define H5C__IL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ -{ \ - H5C__IL_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ - { \ - if ( (head_ptr) == (entry_ptr) ) \ - { \ - (head_ptr) = (entry_ptr)->il_next; \ - if ( (head_ptr) != NULL ) \ - (head_ptr)->il_prev = NULL; \ - } \ - else \ - (entry_ptr)->il_prev->il_next = (entry_ptr)->il_next; \ - if ( (tail_ptr) == (entry_ptr) ) \ - { \ - (tail_ptr) = (entry_ptr)->il_prev; \ - if ( (tail_ptr) != NULL ) \ - (tail_ptr)->il_next = NULL; \ - } \ - else \ - (entry_ptr)->il_next->il_prev = (entry_ptr)->il_prev; \ - entry_ptr->il_next = NULL; \ - entry_ptr->il_prev = NULL; \ - (len)--; \ - (Size) -= entry_ptr->size; \ - } \ - H5C__IL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ -} /* H5C__IL_DLL_REMOVE() */ +#define H5C__GEN_DLL_REMOVE(entry_ptr, list_next, list_prev, head_ptr, tail_ptr, len, list_size, fail_val) \ +{ \ + H5C__GEN_DLL_PRE_REMOVE_SC(entry_ptr, list_next, list_prev, head_ptr, tail_ptr, len, list_size, fail_val); \ + if ((head_ptr) == (entry_ptr)) { \ + (head_ptr) = (entry_ptr)->list_next; \ + if ((head_ptr) != NULL) \ + (head_ptr)->list_prev = NULL; \ + } \ + else \ + (entry_ptr)->list_prev->list_next = (entry_ptr)->list_next; \ + if ((tail_ptr) == (entry_ptr)) { \ + (tail_ptr) = (entry_ptr)->list_prev; \ + if ((tail_ptr) != NULL) \ + (tail_ptr)->list_next = NULL; \ + } \ + else \ + (entry_ptr)->list_next->list_prev = (entry_ptr)->list_prev; \ + (entry_ptr)->list_next = NULL; \ + (entry_ptr)->list_prev = NULL; \ + (len)--; \ + (list_size) -= (entry_ptr)->size; \ +} /* H5C__GEN_DLL_REMOVE() */ + +#define H5C__GEN_DLL_UPDATE_FOR_SIZE_CHANGE(dll_len, dll_size, old_size, new_size, fail_val) \ +{ \ + H5C__GEN_DLL_PRE_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size, fail_val) \ + (dll_size) -= (old_size); \ + (dll_size) += (new_size); \ + H5C__GEN_DLL_POST_SIZE_UPDATE_SC(dll_len, dll_size, old_size, new_size, fail_val) \ +} /* H5C__GEN_DLL_UPDATE_FOR_SIZE_CHANGE() */ + + +/* Macros that modify the LRU/protected/pinned lists */ +#define H5C__DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, list_size, fail_val) \ + H5C__GEN_DLL_APPEND(entry_ptr, next, prev, head_ptr, tail_ptr, len, list_size, fail_val) +#define H5C__DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, list_size, fail_val) \ + H5C__GEN_DLL_PREPEND(entry_ptr, next, prev, head_ptr, tail_ptr, len, list_size, fail_val) +#define H5C__DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, list_size, fail_val) \ + H5C__GEN_DLL_REMOVE(entry_ptr, next, prev, head_ptr, tail_ptr, len, list_size, fail_val) +#define H5C__DLL_UPDATE_FOR_SIZE_CHANGE(dll_len, dll_size, old_size, new_size, fail_val) \ + H5C__GEN_DLL_UPDATE_FOR_SIZE_CHANGE(dll_len, dll_size, old_size, new_size, fail_val) + +/* Macros that modify the "auxiliary" LRU list */ +#define H5C__AUX_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, list_size, fail_val) \ + H5C__GEN_DLL_APPEND(entry_ptr, aux_next, aux_prev, head_ptr, tail_ptr, len, list_size, fail_val) +#define H5C__AUX_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, list_size, fail_val) \ + H5C__GEN_DLL_PREPEND(entry_ptr, aux_next, aux_prev, head_ptr, tail_ptr, len, list_size, fail_val) +#define H5C__AUX_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, list_size, fail_val) \ + H5C__GEN_DLL_REMOVE(entry_ptr, aux_next, aux_prev, head_ptr, tail_ptr, len, list_size, fail_val) + +/* Macros that modify the "index" list */ +#define H5C__IL_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, list_size, fail_val) \ + H5C__GEN_DLL_APPEND(entry_ptr, il_next, il_prev, head_ptr, tail_ptr, len, list_size, fail_val) +#define H5C__IL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, list_size, fail_val) \ + H5C__GEN_DLL_REMOVE(entry_ptr, il_next, il_prev, head_ptr, tail_ptr, len, list_size, fail_val) /*********************************************************************** @@ -609,350 +226,331 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ ***********************************************************************/ #define H5C__UPDATE_CACHE_HIT_RATE_STATS(cache_ptr, hit) \ - (cache_ptr->cache_accesses)++; \ - if ( hit ) { \ - (cache_ptr->cache_hits)++; \ - } \ +do { \ + (cache_ptr)->cache_accesses++; \ + if (hit) \ + (cache_ptr)->cache_hits++; \ +} while (0) #if H5C_COLLECT_CACHE_STATS #define H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->index_size > (cache_ptr)->max_index_size ) \ - (cache_ptr)->max_index_size = (cache_ptr)->index_size; \ - if ( (cache_ptr)->clean_index_size > \ - (cache_ptr)->max_clean_index_size ) \ - (cache_ptr)->max_clean_index_size = \ - (cache_ptr)->clean_index_size; \ - if ( (cache_ptr)->dirty_index_size > \ - (cache_ptr)->max_dirty_index_size ) \ - (cache_ptr)->max_dirty_index_size = \ - (cache_ptr)->dirty_index_size; - -#define H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) \ - (((cache_ptr)->dirty_pins)[(entry_ptr)->type->id])++; - -#define H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) \ - if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ - (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ - if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ - (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; - -#define H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) \ - if ( cache_ptr->flush_in_progress ) \ - ((cache_ptr)->cache_flush_moves[(entry_ptr)->type->id])++; \ - if ( entry_ptr->flush_in_progress ) \ - ((cache_ptr)->entry_flush_moves[(entry_ptr)->type->id])++; \ - (((cache_ptr)->moves)[(entry_ptr)->type->id])++; \ - (cache_ptr)->entries_relocated_counter++; - -#define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size)\ - if ( cache_ptr->flush_in_progress ) \ - ((cache_ptr)->cache_flush_size_changes[(entry_ptr)->type->id])++; \ - if ( entry_ptr->flush_in_progress ) \ - ((cache_ptr)->entry_flush_size_changes[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->size < (new_size) ) { \ - ((cache_ptr)->size_increases[(entry_ptr)->type->id])++; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ - (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ - if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ - (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ - } else if ( (entry_ptr)->size > (new_size) ) { \ - ((cache_ptr)->size_decreases[(entry_ptr)->type->id])++; \ - } +do { \ + if ((cache_ptr)->index_size > (cache_ptr)->max_index_size) \ + (cache_ptr)->max_index_size = (cache_ptr)->index_size; \ + if ((cache_ptr)->clean_index_size > (cache_ptr)->max_clean_index_size) \ + (cache_ptr)->max_clean_index_size = (cache_ptr)->clean_index_size; \ + if ((cache_ptr)->dirty_index_size > (cache_ptr)->max_dirty_index_size) \ + (cache_ptr)->max_dirty_index_size = (cache_ptr)->dirty_index_size; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) \ +do { \ + (cache_ptr)->dirty_pins[(entry_ptr)->type->id]++; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) \ +do { \ + if ((cache_ptr)->slist_len > (cache_ptr)->max_slist_len) \ + (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ + if ((cache_ptr)->slist_size > (cache_ptr)->max_slist_size) \ + (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ + if ((cache_ptr)->pel_len > (cache_ptr)->max_pel_len) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ((cache_ptr)->pel_size > (cache_ptr)->max_pel_size) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) \ +do { \ + if ((cache_ptr)->flush_in_progress) \ + (cache_ptr)->cache_flush_moves[(entry_ptr)->type->id]++; \ + if ((entry_ptr)->flush_in_progress) \ + (cache_ptr)->entry_flush_moves[(entry_ptr)->type->id]++; \ + (cache_ptr)->moves[(entry_ptr)->type->id]++; \ + (cache_ptr)->entries_relocated_counter++; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \ +do { \ + if ((cache_ptr)->flush_in_progress) \ + (cache_ptr)->cache_flush_size_changes[(entry_ptr)->type->id]++; \ + if ((entry_ptr)->flush_in_progress) \ + (cache_ptr)->entry_flush_size_changes[(entry_ptr)->type->id]++; \ + if ((entry_ptr)->size < (new_size)) { \ + (cache_ptr)->size_increases[(entry_ptr)->type->id]++; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr); \ + if ((cache_ptr)->slist_size > (cache_ptr)->max_slist_size) \ + (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ + if ((cache_ptr)->pl_size > (cache_ptr)->max_pl_size) \ + (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ + } else if ((entry_ptr)->size > (new_size)) { \ + (cache_ptr)->size_decreases[(entry_ptr)->type->id]++; \ + } \ +} while (0) #define H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \ - (cache_ptr)->total_ht_insertions++; +do { \ + (cache_ptr)->total_ht_insertions++; \ +} while (0) #define H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \ - (cache_ptr)->total_ht_deletions++; - -#define H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, success, depth) \ - if ( success ) { \ - (cache_ptr)->successful_ht_searches++; \ - (cache_ptr)->total_successful_ht_search_depth += depth; \ - } else { \ - (cache_ptr)->failed_ht_searches++; \ - (cache_ptr)->total_failed_ht_search_depth += depth; \ - } +do { \ + (cache_ptr)->total_ht_deletions++; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, success, depth) \ +do { \ + if (success) { \ + (cache_ptr)->successful_ht_searches++; \ + (cache_ptr)->total_successful_ht_search_depth += depth; \ + } else { \ + (cache_ptr)->failed_ht_searches++; \ + (cache_ptr)->total_failed_ht_search_depth += depth; \ + } \ +} while (0) #define H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) \ - ((cache_ptr)->unpins)[(entry_ptr)->type->id]++; - -#define H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) \ - ((cache_ptr)->slist_scan_restarts)++; - -#define H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) \ - ((cache_ptr)->LRU_scan_restarts)++; - -#define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) \ - ((cache_ptr)->index_scan_restarts)++; - -#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr) \ -{ \ - (cache_ptr)->images_created++; \ -} - -#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr) \ -{ \ - /* make sure image len is still good */ \ - HDassert((cache_ptr)->image_len > 0); \ - (cache_ptr)->images_read++; \ -} - -#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) \ -{ \ - /* make sure image len is still good */ \ - HDassert((cache_ptr)->image_len > 0); \ - (cache_ptr)->images_loaded++; \ - (cache_ptr)->last_image_size = (cache_ptr)->image_len; \ -} +do { \ + (cache_ptr)->unpins[(entry_ptr)->type->id]++; \ +} while (0) #define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty) \ -{ \ +do { \ (cache_ptr)->prefetches++; \ - if ( dirty ) \ + if (dirty) \ (cache_ptr)->dirty_prefetches++; \ -} +} while (0) #define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr) \ -{ \ - (cache_ptr)->prefetch_hits++; \ -} +do { \ + (cache_ptr)->prefetch_hits++; \ +} while (0) -#if H5C_COLLECT_CACHE_ENTRY_STATS +#define H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) \ +do { \ + (cache_ptr)->slist_scan_restarts++; \ +} while (0) -#define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \ -{ \ - (entry_ptr)->accesses = 0; \ - (entry_ptr)->clears = 0; \ - (entry_ptr)->flushes = 0; \ - (entry_ptr)->pins = 0; \ -} +#define H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) \ +do { \ + (cache_ptr)->LRU_scan_restarts++; \ +} while (0) -#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ -{ \ - (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \ - if((entry_ptr)->is_pinned) \ - (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ - ((entry_ptr)->clears)++; \ -} +#define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) \ +do { \ + (cache_ptr)->index_scan_restarts++; \ +} while (0) -#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ -{ \ - (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ - if((entry_ptr)->is_pinned) \ - (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ - ((entry_ptr)->flushes)++; \ -} +#if H5C_COLLECT_CACHE_ENTRY_STATS + +#define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) \ +do { \ + (entry_ptr)->accesses = 0; \ + (entry_ptr)->clears = 0; \ + (entry_ptr)->flushes = 0; \ + (entry_ptr)->pins = 0; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ +do { \ + (cache_ptr)->clears[(entry_ptr)->type->id]++; \ + if((entry_ptr)->is_pinned) \ + (cache_ptr)->pinned_clears[(entry_ptr)->type->id]++; \ + (entry_ptr)->clears++; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ +do { \ + (cache_ptr)->flushes[(entry_ptr)->type->id]++; \ + if((entry_ptr)->is_pinned) \ + (cache_ptr)->pinned_flushes[(entry_ptr)->type->id]++; \ + (entry_ptr)->flushes++; \ +} while (0) #define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) \ -{ \ - if ( take_ownership ) \ - (((cache_ptr)->take_ownerships)[(entry_ptr)->type->id])++; \ +do { \ + if (take_ownership) \ + (cache_ptr)->take_ownerships[(entry_ptr)->type->id]++; \ else \ - (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->accesses > \ - ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] ) \ - ((cache_ptr)->max_accesses)[(entry_ptr)->type->id] = \ - (entry_ptr)->accesses; \ - if ( (entry_ptr)->accesses < \ - ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] ) \ - ((cache_ptr)->min_accesses)[(entry_ptr)->type->id] = \ - (entry_ptr)->accesses; \ - if ( (entry_ptr)->clears > \ - ((cache_ptr)->max_clears)[(entry_ptr)->type->id] ) \ - ((cache_ptr)->max_clears)[(entry_ptr)->type->id] \ - = (entry_ptr)->clears; \ - if ( (entry_ptr)->flushes > \ - ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] ) \ - ((cache_ptr)->max_flushes)[(entry_ptr)->type->id] \ - = (entry_ptr)->flushes; \ - if ( (entry_ptr)->size > \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ - = (entry_ptr)->size; \ - if ( (entry_ptr)->pins > \ - ((cache_ptr)->max_pins)[(entry_ptr)->type->id] ) \ - ((cache_ptr)->max_pins)[(entry_ptr)->type->id] \ - = (entry_ptr)->pins; \ -} - -#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ -{ \ - (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - (entry_ptr)->pins++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ - (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ - if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ - (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ - if ( (entry_ptr)->size > \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] \ - = (entry_ptr)->size; \ - cache_ptr->entries_inserted_counter++; \ -} - -#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ -{ \ - if ( hit ) \ - ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ - else \ - ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ - if ( ! ((entry_ptr)->is_read_only) ) { \ - ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ - } else { \ - ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ - if ( ((entry_ptr)->ro_ref_count) > \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ - ((entry_ptr)->ro_ref_count); \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ - (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ - if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ - (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ - if ( (entry_ptr)->size > \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] ) \ - ((cache_ptr)->max_size)[(entry_ptr)->type->id] = (entry_ptr)->size; \ - ((entry_ptr)->accesses)++; \ -} + (cache_ptr)->evictions[(entry_ptr)->type->id]++; \ + if ((entry_ptr)->accesses > (cache_ptr)->max_accesses[(entry_ptr)->type->id]) \ + (cache_ptr)->max_accesses[(entry_ptr)->type->id] = (entry_ptr)->accesses; \ + if ((entry_ptr)->accesses < (cache_ptr)->min_accesses[(entry_ptr)->type->id]) \ + (cache_ptr)->min_accesses[(entry_ptr)->type->id] = (entry_ptr)->accesses; \ + if ((entry_ptr)->clears > (cache_ptr)->max_clears[(entry_ptr)->type->id]) \ + (cache_ptr)->max_clears[(entry_ptr)->type->id] = (entry_ptr)->clears; \ + if ((entry_ptr)->flushes > (cache_ptr)->max_flushes[(entry_ptr)->type->id]) \ + (cache_ptr)->max_flushes[(entry_ptr)->type->id] = (entry_ptr)->flushes; \ + if ((entry_ptr)->size > (cache_ptr)->max_size[(entry_ptr)->type->id]) \ + (cache_ptr)->max_size[(entry_ptr)->type->id] = (entry_ptr)->size; \ + if ((entry_ptr)->pins > (cache_ptr)->max_pins[(entry_ptr)->type->id]) \ + (cache_ptr)->max_pins[(entry_ptr)->type->id] = (entry_ptr)->pins; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ +do { \ + (cache_ptr)->insertions[(entry_ptr)->type->id]++; \ + if ((entry_ptr)->is_pinned) { \ + (cache_ptr)->pinned_insertions[(entry_ptr)->type->id]++; \ + (cache_ptr)->pins[(entry_ptr)->type->id]++; \ + (entry_ptr)->pins++; \ + if ((cache_ptr)->pel_len > (cache_ptr)->max_pel_len) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ((cache_ptr)->pel_size > (cache_ptr)->max_pel_size) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ + } \ + if ((cache_ptr)->index_len > (cache_ptr)->max_index_len) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr); \ + if ((cache_ptr)->slist_len > (cache_ptr)->max_slist_len) \ + (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ + if ((cache_ptr)->slist_size > (cache_ptr)->max_slist_size) \ + (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ + if ((entry_ptr)->size > (cache_ptr)->max_size[(entry_ptr)->type->id]) \ + (cache_ptr)->max_size[(entry_ptr)->type->id] = (entry_ptr)->size; \ + (cache_ptr)->entries_inserted_counter++; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ +do { \ + if (hit) \ + (cache_ptr)->hits[(entry_ptr)->type->id]++; \ + else \ + (cache_ptr)->misses[(entry_ptr)->type->id]++; \ + if (!(entry_ptr)->is_read_only) \ + (cache_ptr)->write_protects[(entry_ptr)->type->id]++; \ + else { \ + (cache_ptr)->read_protects[(entry_ptr)->type->id]++; \ + if ((entry_ptr)->ro_ref_count > (cache_ptr)->max_read_protects[(entry_ptr)->type->id]) \ + (cache_ptr)->max_read_protects[(entry_ptr)->type->id] = (entry_ptr)->ro_ref_count; \ + } \ + if ((cache_ptr)->index_len > (cache_ptr)->max_index_len) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr); \ + if ((cache_ptr)->pl_len > (cache_ptr)->max_pl_len) \ + (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ + if ((cache_ptr)->pl_size > (cache_ptr)->max_pl_size) \ + (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ + if ((entry_ptr)->size > (cache_ptr)->max_size[(entry_ptr)->type->id]) \ + (cache_ptr)->max_size[(entry_ptr)->type->id] = (entry_ptr)->size; \ + (entry_ptr)->accesses++; \ +} while (0) #define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ -{ \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ +do { \ + (cache_ptr)->pins[(entry_ptr)->type->id]++; \ (entry_ptr)->pins++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ + if ((cache_ptr)->pel_len > (cache_ptr)->max_pel_len) \ (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ + if ((cache_ptr)->pel_size > (cache_ptr)->max_pel_size) \ (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ -} +} while (0) #else /* H5C_COLLECT_CACHE_ENTRY_STATS */ #define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) -#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ -{ \ - (((cache_ptr)->clears)[(entry_ptr)->type->id])++; \ - if((entry_ptr)->is_pinned) \ - (((cache_ptr)->pinned_clears)[(entry_ptr)->type->id])++; \ -} +#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) \ +do { \ + (cache_ptr)->clears[(entry_ptr)->type->id]++; \ + if((entry_ptr)->is_pinned) \ + (cache_ptr)->pinned_clears[(entry_ptr)->type->id]++; \ +} while (0) -#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ -{ \ - (((cache_ptr)->flushes)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) \ - (((cache_ptr)->pinned_flushes)[(entry_ptr)->type->id])++; \ -} +#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) \ +do { \ + (cache_ptr)->flushes[(entry_ptr)->type->id]++; \ + if ((entry_ptr)->is_pinned) \ + (cache_ptr)->pinned_flushes[(entry_ptr)->type->id]++; \ +} while (0) #define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) \ -{ \ - if ( take_ownership ) \ - (((cache_ptr)->take_ownerships)[(entry_ptr)->type->id])++; \ - else \ - (((cache_ptr)->evictions)[(entry_ptr)->type->id])++; \ -} - -#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ -{ \ - (((cache_ptr)->insertions)[(entry_ptr)->type->id])++; \ - if ( (entry_ptr)->is_pinned ) { \ - (((cache_ptr)->pinned_insertions)[(entry_ptr)->type->id])++; \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->slist_len > (cache_ptr)->max_slist_len ) \ - (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ - if ( (cache_ptr)->slist_size > (cache_ptr)->max_slist_size ) \ - (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ - cache_ptr->entries_inserted_counter++; \ -} - -#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ -{ \ - if ( hit ) \ - ((cache_ptr)->hits)[(entry_ptr)->type->id]++; \ - else \ - ((cache_ptr)->misses)[(entry_ptr)->type->id]++; \ - if ( ! ((entry_ptr)->is_read_only) ) \ - ((cache_ptr)->write_protects)[(entry_ptr)->type->id]++; \ - else { \ - ((cache_ptr)->read_protects)[(entry_ptr)->type->id]++; \ - if ( ((entry_ptr)->ro_ref_count) > \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] ) \ - ((cache_ptr)->max_read_protects)[(entry_ptr)->type->id] = \ - ((entry_ptr)->ro_ref_count); \ - } \ - if ( (cache_ptr)->index_len > (cache_ptr)->max_index_len ) \ - (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ - H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ - if ( (cache_ptr)->pl_len > (cache_ptr)->max_pl_len ) \ - (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ - if ( (cache_ptr)->pl_size > (cache_ptr)->max_pl_size ) \ - (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ -} - -#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ -{ \ - ((cache_ptr)->pins)[(entry_ptr)->type->id]++; \ - if ( (cache_ptr)->pel_len > (cache_ptr)->max_pel_len ) \ - (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ - if ( (cache_ptr)->pel_size > (cache_ptr)->max_pel_size ) \ - (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ -} +do { \ + if (take_ownership) \ + (cache_ptr)->take_ownerships[(entry_ptr)->type->id]++; \ + else \ + (cache_ptr)->evictions[(entry_ptr)->type->id]++; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) \ +do { \ + (cache_ptr)->insertions[(entry_ptr)->type->id]++; \ + if ((entry_ptr)->is_pinned) { \ + (cache_ptr)->pinned_insertions[(entry_ptr)->type->id]++; \ + (cache_ptr)->pins[(entry_ptr)->type->id]++; \ + if ((cache_ptr)->pel_len > (cache_ptr)->max_pel_len) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ((cache_ptr)->pel_size > (cache_ptr)->max_pel_size) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ + } \ + if ((cache_ptr)->index_len > (cache_ptr)->max_index_len) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ + if ((cache_ptr)->slist_len > (cache_ptr)->max_slist_len) \ + (cache_ptr)->max_slist_len = (cache_ptr)->slist_len; \ + if ((cache_ptr)->slist_size > (cache_ptr)->max_slist_size) \ + (cache_ptr)->max_slist_size = (cache_ptr)->slist_size; \ + (cache_ptr)->entries_inserted_counter++; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) \ +do { \ + if (hit) \ + (cache_ptr)->hits[(entry_ptr)->type->id]++; \ + else \ + (cache_ptr)->misses[(entry_ptr)->type->id]++; \ + if (!(entry_ptr)->is_read_only) \ + (cache_ptr)->write_protects[(entry_ptr)->type->id]++; \ + else { \ + (cache_ptr)->read_protects[(entry_ptr)->type->id]++; \ + if ((entry_ptr)->ro_ref_count > \ + (cache_ptr)->max_read_protects[(entry_ptr)->type->id]) \ + (cache_ptr)->max_read_protects[(entry_ptr)->type->id] = \ + (entry_ptr)->ro_ref_count; \ + } \ + if ((cache_ptr)->index_len > (cache_ptr)->max_index_len) \ + (cache_ptr)->max_index_len = (cache_ptr)->index_len; \ + H5C__UPDATE_MAX_INDEX_SIZE_STATS(cache_ptr) \ + if ((cache_ptr)->pl_len > (cache_ptr)->max_pl_len) \ + (cache_ptr)->max_pl_len = (cache_ptr)->pl_len; \ + if ((cache_ptr)->pl_size > (cache_ptr)->max_pl_size) \ + (cache_ptr)->max_pl_size = (cache_ptr)->pl_size; \ +} while (0) + +#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) \ +do { \ + (cache_ptr)->pins[(entry_ptr)->type->id]++; \ + if ((cache_ptr)->pel_len > (cache_ptr)->max_pel_len) \ + (cache_ptr)->max_pel_len = (cache_ptr)->pel_len; \ + if ((cache_ptr)->pel_size > (cache_ptr)->max_pel_size) \ + (cache_ptr)->max_pel_size = (cache_ptr)->pel_size; \ +} while (0) #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ #else /* H5C_COLLECT_CACHE_STATS */ -#define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) -#define H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) -#define H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) -#define H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) -#define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) -#define H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) -#define H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) -#define H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, success, depth) -#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) -#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) -#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) -#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) -#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) -#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) -#define H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) -#define H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) -#define H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) -#define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) -#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr) -#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr) -#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) -#define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty) -#define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr) +#define H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) do {} while(0) +#define H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, success, depth) do {} while(0) +#define H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) do {} while(0) +#define H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) do {} while(0) +#define H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, dirty) do {} while(0) +#define H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) do {} while(0) +#define H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) do {} while(0) #endif /* H5C_COLLECT_CACHE_STATS */ @@ -964,680 +562,510 @@ if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ * The following macros handle searches, insertions, and deletion in * the hash table. * - * When modifying these macros, remember to modify the similar macros - * in tst/cache.c - * - * Changes: - * - * - Updated existing index macros and sanity check macros to maintain - * the clean_index_size and dirty_index_size fields of H5C_t. Also - * added macros to allow us to track entry cleans and dirties. - * - * JRM -- 11/5/08 - * - * - Updated existing index macros and sanity check macros to maintain - * the index_ring_len, index_ring_size, clean_index_ring_size, and - * dirty_index_ring_size fields of H5C_t. - * - * JRM -- 9/1/15 - * - * - Updated existing index macros and sanity checks macros to - * maintain an doubly linked list of all entries in the index. - * This is necessary to reduce the computational cost of visiting - * all entries in the index, which used to be done by scanning - * the hash table. - * - * JRM -- 10/15/15 - * ***********************************************************************/ -/* H5C__HASH_TABLE_LEN is defined in H5Cpkg.h. It mut be a power of two. */ - -#define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3) - +#define H5C__HASH_MASK ((size_t)(H5C__HASH_TABLE_LEN - 1) << 3) #define H5C__HASH_FCN(x) (int)((unsigned)((x) & H5C__HASH_MASK) >> 3) -#if H5C_DO_SANITY_CHECKS +#define H5C__POST_HT_SHIFT_TO_FRONT_SC_CMP(cache_ptr, entry_ptr, k) \ +((cache_ptr) == NULL || (cache_ptr)->index[k] != (entry_ptr) || \ + (entry_ptr)->ht_prev != NULL \ +) +#define H5C__PRE_HT_SEARCH_SC_CMP(cache_ptr, entry_addr) \ +((cache_ptr) == NULL || \ + (cache_ptr)->index_size != \ + ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + !H5_addr_defined(entry_addr) || \ + H5C__HASH_FCN(entry_addr) < 0 || \ + H5C__HASH_FCN(entry_addr) >= H5C__HASH_TABLE_LEN \ +) +#define H5C__POST_SUC_HT_SEARCH_SC_CMP(cache_ptr, entry_ptr, k) \ +((cache_ptr) == NULL || (cache_ptr)->index_len < 1 || \ + (entry_ptr) == NULL || \ + (cache_ptr)->index_size < (entry_ptr)->size || \ + (cache_ptr)->index_size != \ + ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (entry_ptr)->size <= 0 || \ + (cache_ptr)->index[k] == NULL || \ + ((cache_ptr)->index[k] != (entry_ptr) && (entry_ptr)->ht_prev == NULL) || \ + ((cache_ptr)->index[k] == (entry_ptr) && (entry_ptr)->ht_prev != NULL) || \ + ((entry_ptr)->ht_prev != NULL && (entry_ptr)->ht_prev->ht_next != (entry_ptr)) || \ + ((entry_ptr)->ht_next != NULL && (entry_ptr)->ht_next->ht_prev != (entry_ptr)) \ +) + +#ifdef H5C_DO_SANITY_CHECKS #define H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ -if ( ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ - ( (entry_ptr) == NULL ) || \ - ( ! H5F_addr_defined((entry_ptr)->addr) ) || \ - ( (entry_ptr)->ht_next != NULL ) || \ - ( (entry_ptr)->ht_prev != NULL ) || \ - ( (entry_ptr)->size <= 0 ) || \ - ( H5C__HASH_FCN((entry_ptr)->addr) < 0 ) || \ - ( H5C__HASH_FCN((entry_ptr)->addr) >= H5C__HASH_TABLE_LEN ) || \ - ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + \ - (cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ - ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ - ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ - (cache_ptr)->index_len ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ - (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ +if ((cache_ptr) == NULL || \ + (entry_ptr) == NULL || !H5_addr_defined((entry_ptr)->addr) || \ + (entry_ptr)->ht_next != NULL || (entry_ptr)->ht_prev != NULL || \ + (entry_ptr)->size <= 0 || \ + H5C__HASH_FCN((entry_ptr)->addr) < 0 || \ + H5C__HASH_FCN((entry_ptr)->addr) >= H5C__HASH_TABLE_LEN || \ + (cache_ptr)->index_size != \ + ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (cache_ptr)->index_size < (cache_ptr)->clean_index_size || \ + (cache_ptr)->index_size < (cache_ptr)->dirty_index_size || \ + (entry_ptr)->ring <= H5C_RING_UNDEFINED || \ + (entry_ptr)->ring >= H5C_RING_NTYPES || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ - (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \ - ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ - ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \ - HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "pre HT insert SC failed") \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) || \ + (cache_ptr)->index_len != (cache_ptr)->il_len || \ + (cache_ptr)->index_size != (cache_ptr)->il_size \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "pre HT insert SC failed"); \ } #define H5C__POST_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ -if ( ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ - ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + \ - (cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] == 0 ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ - (cache_ptr)->index_len ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ - (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ +if ((cache_ptr) == NULL || \ + (cache_ptr)->index_size != \ + ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (cache_ptr)->index_size < (cache_ptr)->clean_index_size || \ + (cache_ptr)->index_size < (cache_ptr)->dirty_index_size || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] == 0 || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ - (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \ - ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ - ( (cache_ptr)->index_size != (cache_ptr)->il_size) ) { \ - HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post HT insert SC failed") \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) || \ + (cache_ptr)->index_len != (cache_ptr)->il_len || \ + (cache_ptr)->index_size != (cache_ptr)->il_size \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post HT insert SC failed"); \ } -#define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \ -if ( ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ - ( (cache_ptr)->index_len < 1 ) || \ - ( (entry_ptr) == NULL ) || \ - ( (cache_ptr)->index_size < (entry_ptr)->size ) || \ - ( ! H5F_addr_defined((entry_ptr)->addr) ) || \ - ( (entry_ptr)->size <= 0 ) || \ - ( H5C__HASH_FCN((entry_ptr)->addr) < 0 ) || \ - ( H5C__HASH_FCN((entry_ptr)->addr) >= H5C__HASH_TABLE_LEN ) || \ - ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] \ - == NULL ) || \ - ( ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] \ - != (entry_ptr) ) && \ - ( (entry_ptr)->ht_prev == NULL ) ) || \ - ( ( ((cache_ptr)->index)[(H5C__HASH_FCN((entry_ptr)->addr))] == \ - (entry_ptr) ) && \ - ( (entry_ptr)->ht_prev != NULL ) ) || \ - ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + \ - (cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ - ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ - ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ - (cache_ptr)->index_len ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] < \ - (entry_ptr)->size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ - (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ +#define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr, fail_val) \ +if ( (cache_ptr) == NULL || (cache_ptr)->index_len < 1 || \ + (entry_ptr) == NULL || \ + (cache_ptr)->index_size < (entry_ptr)->size || \ + !H5_addr_defined((entry_ptr)->addr) || \ + (entry_ptr)->size <= 0 || \ + H5C__HASH_FCN((entry_ptr)->addr) < 0 || \ + H5C__HASH_FCN((entry_ptr)->addr) >= H5C__HASH_TABLE_LEN || \ + (cache_ptr)->index[H5C__HASH_FCN((entry_ptr)->addr)] == NULL || \ + ((cache_ptr)->index[H5C__HASH_FCN((entry_ptr)->addr)] != (entry_ptr) && \ + (entry_ptr)->ht_prev == NULL) || \ + ((cache_ptr)->index[H5C__HASH_FCN((entry_ptr)->addr)] == (entry_ptr) && \ + (entry_ptr)->ht_prev != NULL) || \ + (cache_ptr)->index_size != \ + ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (cache_ptr)->index_size < (cache_ptr)->clean_index_size || \ + (cache_ptr)->index_size < (cache_ptr)->dirty_index_size || \ + (entry_ptr)->ring <= H5C_RING_UNDEFINED || \ + (entry_ptr)->ring >= H5C_RING_NTYPES || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] < (entry_ptr)->size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ - (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \ - ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ - ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \ - HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT remove SC failed") \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) || \ + (cache_ptr)->index_len != (cache_ptr)->il_len || \ + (cache_ptr)->index_size != (cache_ptr)->il_size \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "pre HT remove SC failed"); \ } -#define H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \ -if ( ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ - ( (entry_ptr) == NULL ) || \ - ( ! H5F_addr_defined((entry_ptr)->addr) ) || \ - ( (entry_ptr)->size <= 0 ) || \ - ( (entry_ptr)->ht_prev != NULL ) || \ - ( (entry_ptr)->ht_prev != NULL ) || \ - ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + \ - (cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ - (cache_ptr)->index_len ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ - (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ - ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ - (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \ - ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ - ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \ - HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT remove SC failed") \ +#define H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr, fail_val) \ +if ((cache_ptr) == NULL || \ + (entry_ptr) == NULL || !H5_addr_defined((entry_ptr)->addr) || \ + (entry_ptr)->size <= 0 || \ + (entry_ptr)->ht_next != NULL || \ + (entry_ptr)->ht_prev != NULL || \ + (cache_ptr)->index_size != \ + ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (cache_ptr)->index_size < (cache_ptr)->clean_index_size || \ + (cache_ptr)->index_size < (cache_ptr)->dirty_index_size || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) || \ + (cache_ptr)->index_len != (cache_ptr)->il_len || \ + (cache_ptr)->index_size != (cache_ptr)->il_size \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "post HT remove SC failed"); \ } -/* (Keep in sync w/H5C_TEST__PRE_HT_SEARCH_SC macro in test/cache_common.h -QAK) */ -#define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \ -if ( ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ - ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ - ( ! H5F_addr_defined(Addr) ) || \ - ( H5C__HASH_FCN(Addr) < 0 ) || \ - ( H5C__HASH_FCN(Addr) >= H5C__HASH_TABLE_LEN ) ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "pre HT search SC failed") \ +#define H5C__PRE_HT_SEARCH_SC(cache_ptr, entry_addr, fail_val) \ +if (H5C__PRE_HT_SEARCH_SC_CMP(cache_ptr, entry_addr)) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "pre HT search SC failed"); \ } -/* (Keep in sync w/H5C_TEST__POST_SUC_HT_SEARCH_SC macro in test/cache_common.h -QAK) */ #define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val) \ -if ( ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ - ( (cache_ptr)->index_len < 1 ) || \ - ( (entry_ptr) == NULL ) || \ - ( (cache_ptr)->index_size < (entry_ptr)->size ) || \ - ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ - ( (entry_ptr)->size <= 0 ) || \ - ( ((cache_ptr)->index)[k] == NULL ) || \ - ( ( ((cache_ptr)->index)[k] != (entry_ptr) ) && \ - ( (entry_ptr)->ht_prev == NULL ) ) || \ - ( ( ((cache_ptr)->index)[k] == (entry_ptr) ) && \ - ( (entry_ptr)->ht_prev != NULL ) ) || \ - ( ( (entry_ptr)->ht_prev != NULL ) && \ - ( (entry_ptr)->ht_prev->ht_next != (entry_ptr) ) ) || \ - ( ( (entry_ptr)->ht_next != NULL ) && \ - ( (entry_ptr)->ht_next->ht_prev != (entry_ptr) ) ) ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post successful HT search SC failed") \ +if(H5C__POST_SUC_HT_SEARCH_SC_CMP(cache_ptr, entry_ptr, k)) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "post successful HT search SC failed"); \ } -/* (Keep in sync w/H5C_TEST__POST_HT_SHIFT_TO_FRONT macro in test/cache_common.h -QAK) */ -#define H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \ -if ( ( (cache_ptr) == NULL ) || \ - ( ((cache_ptr)->index)[k] != (entry_ptr) ) || \ - ( (entry_ptr)->ht_prev != NULL ) ) { \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, fail_val, "post HT shift to front SC failed") \ +#define H5C__POST_HT_SHIFT_TO_FRONT_SC(cache_ptr, entry_ptr, k, fail_val) \ +if(H5C__POST_HT_SHIFT_TO_FRONT_SC_CMP(cache_ptr, entry_ptr, k)) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "post HT shift to front SC failed"); \ } -#define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ -if ( ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->index_len <= 0 ) || \ - ( (cache_ptr)->index_size <= 0 ) || \ - ( (new_size) <= 0 ) || \ - ( (old_size) > (cache_ptr)->index_size ) || \ - ( ( (cache_ptr)->index_len == 1 ) && \ - ( (cache_ptr)->index_size != (old_size) ) ) || \ - ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + \ - (cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ - ( ( !( was_clean ) || \ - ( (cache_ptr)->clean_index_size < (old_size) ) ) && \ - ( ( (was_clean) ) || \ - ( (cache_ptr)->dirty_index_size < (old_size) ) ) ) || \ - ( (entry_ptr) == NULL ) || \ - ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ - ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ - (cache_ptr)->index_len ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ - (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ - ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ - (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \ - ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ - ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \ - HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT entry size change SC failed") \ +#define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ + entry_ptr, was_clean, fail_val) \ +if ((cache_ptr) == NULL || \ + (cache_ptr)->index_len <= 0 || (cache_ptr)->index_size <= 0 || \ + (new_size) <= 0 || (old_size) > (cache_ptr)->index_size || \ + ((cache_ptr)->index_len == 1 && (cache_ptr)->index_size != (old_size)) || \ + (cache_ptr)->index_size != \ + ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (cache_ptr)->index_size < (cache_ptr)->clean_index_size || \ + (cache_ptr)->index_size < (cache_ptr)->dirty_index_size || \ + ((!(was_clean) || (cache_ptr)->clean_index_size < (old_size)) && \ + ((was_clean) || (cache_ptr)->dirty_index_size < (old_size))) || \ + (entry_ptr) == NULL || \ + (entry_ptr)->ring <= H5C_RING_UNDEFINED || \ + (entry_ptr)->ring >= H5C_RING_NTYPES || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) || \ + (cache_ptr)->index_len != (cache_ptr)->il_len || \ + (cache_ptr)->index_size != (cache_ptr)->il_size \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "pre HT entry size change SC failed"); \ } -#define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr) \ -if ( ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->index_len <= 0 ) || \ - ( (cache_ptr)->index_size <= 0 ) || \ - ( (new_size) > (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + \ - (cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ - ( ( !((entry_ptr)->is_dirty ) || \ - ( (cache_ptr)->dirty_index_size < (new_size) ) ) && \ - ( ( ((entry_ptr)->is_dirty) ) || \ - ( (cache_ptr)->clean_index_size < (new_size) ) ) ) || \ - ( ( (cache_ptr)->index_len == 1 ) && \ - ( (cache_ptr)->index_size != (new_size) ) ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ - (cache_ptr)->index_len ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ - (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ - ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ - (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) || \ - ( (cache_ptr)->index_len != (cache_ptr)->il_len ) || \ - ( (cache_ptr)->index_size != (cache_ptr)->il_size ) ) { \ - HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT entry size change SC failed") \ +#define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ + entry_ptr, fail_val) \ +if ((cache_ptr) == NULL || \ + (cache_ptr)->index_len <= 0 || (cache_ptr)->index_size <= 0 || \ + (new_size) > (cache_ptr)->index_size || \ + (cache_ptr)->index_size != \ + ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (cache_ptr)->index_size < (cache_ptr)->clean_index_size || \ + (cache_ptr)->index_size < (cache_ptr)->dirty_index_size || \ + ((!((entry_ptr)->is_dirty ) || (cache_ptr)->dirty_index_size < (new_size)) && \ + ((entry_ptr)->is_dirty || (cache_ptr)->clean_index_size < (new_size)) \ + ) || \ + ((cache_ptr)->index_len == 1 && (cache_ptr)->index_size != (new_size)) || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) || \ + (cache_ptr)->index_len != (cache_ptr)->il_len || \ + (cache_ptr)->index_size != (cache_ptr)->il_size \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "post HT entry size change SC failed"); \ } -#define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \ -if ( \ - ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ - ( (cache_ptr)->index_len <= 0 ) || \ - ( (entry_ptr) == NULL ) || \ - ( (entry_ptr)->is_dirty != FALSE ) || \ - ( (cache_ptr)->index_size < (entry_ptr)->size ) || \ - ( (cache_ptr)->dirty_index_size < (entry_ptr)->size ) || \ - ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ - ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ - ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ - (cache_ptr)->index_len ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ - (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ +#define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr, fail_val) \ +if ((cache_ptr) == NULL || (cache_ptr)->index_len <= 0 || \ + (entry_ptr) == NULL || (entry_ptr)->is_dirty != FALSE || \ + (cache_ptr)->index_size < (entry_ptr)->size || \ + (cache_ptr)->dirty_index_size < (entry_ptr)->size || \ + (cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) || \ + (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) || \ + (entry_ptr)->ring <= H5C_RING_UNDEFINED || \ + (entry_ptr)->ring >= H5C_RING_NTYPES || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ - (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ - HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT update for entry clean SC failed") \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "pre HT update for entry clean SC failed"); \ } -#define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \ -if ( \ - ( (cache_ptr) == NULL ) || \ - ( (cache_ptr)->magic != H5C__H5C_T_MAGIC ) || \ - ( (cache_ptr)->index_len <= 0 ) || \ - ( (entry_ptr) == NULL ) || \ - ( (entry_ptr)->is_dirty != TRUE ) || \ - ( (cache_ptr)->index_size < (entry_ptr)->size ) || \ - ( (cache_ptr)->clean_index_size < (entry_ptr)->size ) || \ - ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ - ( (entry_ptr)->ring <= H5C_RING_UNDEFINED ) || \ - ( (entry_ptr)->ring >= H5C_RING_NTYPES ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ - (cache_ptr)->index_len ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ - (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ +#define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr, fail_val) \ +if ((cache_ptr) == NULL || (cache_ptr)->index_len <= 0 || \ + (entry_ptr) == NULL || (entry_ptr)->is_dirty != TRUE || \ + (cache_ptr)->index_size < (entry_ptr)->size || \ + (cache_ptr)->clean_index_size < (entry_ptr)->size || \ + (cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (cache_ptr)->index_size < (cache_ptr)->clean_index_size || \ + (cache_ptr)->index_size < (cache_ptr)->dirty_index_size || \ + (entry_ptr)->ring <= H5C_RING_UNDEFINED || \ + (entry_ptr)->ring >= H5C_RING_NTYPES || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] <= 0 || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ - (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ - HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pre HT update for entry dirty SC failed") \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "pre HT update for entry dirty SC failed"); \ } -#define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) \ -if ( ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ - (cache_ptr)->index_len ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ - (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ - ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ - (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ - HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT update for entry clean SC failed") \ +#define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr, fail_val) \ +if ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (cache_ptr)->index_size < (cache_ptr)->clean_index_size || \ + (cache_ptr)->index_size < (cache_ptr)->dirty_index_size || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "post HT update for entry clean SC failed"); \ } -#define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) \ -if ( ( (cache_ptr)->index_size != \ - ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->clean_index_size) ) || \ - ( (cache_ptr)->index_size < ((cache_ptr)->dirty_index_size) ) || \ - ( (cache_ptr)->index_ring_len[(entry_ptr)->ring] > \ - (cache_ptr)->index_len ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] > \ - (cache_ptr)->index_size ) || \ - ( (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ - ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ - (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) ) ) { \ - HDassert(FALSE); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "post HT update for entry dirty SC failed") \ +#define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr, fail_val) \ +if ((cache_ptr)->index_size != ((cache_ptr)->clean_index_size + (cache_ptr)->dirty_index_size) || \ + (cache_ptr)->index_size < (cache_ptr)->clean_index_size || \ + (cache_ptr)->index_size < (cache_ptr)->dirty_index_size || \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring] > (cache_ptr)->index_len || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] > (cache_ptr)->index_size || \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] != \ + ((cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] + \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring]) \ + ) { \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fail_val), "post HT update for entry dirty SC failed"); \ } #else /* H5C_DO_SANITY_CHECKS */ #define H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) #define H5C__POST_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) -#define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) -#define H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) -#define H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) +#define H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr, fail_val) +#define H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr, fail_val) +#define H5C__PRE_HT_SEARCH_SC(cache_ptr, entry_addr, fail_val) #define H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val) -#define H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) -#define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) -#define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) -#define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) -#define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr) -#define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr) -#define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr) +#define H5C__POST_HT_SHIFT_TO_FRONT_SC(cache_ptr, entry_ptr, k, fail_val) +#define H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr, fail_val) +#define H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr, fail_val) +#define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, entry_ptr, was_clean, fail_val) +#define H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, entry_ptr, fail_val) +#define H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr, fail_val) +#define H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr, fail_val) #endif /* H5C_DO_SANITY_CHECKS */ #define H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, fail_val) \ -{ \ +do { \ int k; \ H5C__PRE_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ k = H5C__HASH_FCN((entry_ptr)->addr); \ - if(((cache_ptr)->index)[k] != NULL) { \ - (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ + if((cache_ptr)->index[k] != NULL) { \ + (entry_ptr)->ht_next = (cache_ptr)->index[k]; \ (entry_ptr)->ht_next->ht_prev = (entry_ptr); \ } \ - ((cache_ptr)->index)[k] = (entry_ptr); \ + (cache_ptr)->index[k] = (entry_ptr); \ (cache_ptr)->index_len++; \ (cache_ptr)->index_size += (entry_ptr)->size; \ - ((cache_ptr)->index_ring_len[entry_ptr->ring])++; \ - ((cache_ptr)->index_ring_size[entry_ptr->ring]) \ - += (entry_ptr)->size; \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring]++; \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] += (entry_ptr)->size; \ if((entry_ptr)->is_dirty) { \ (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ - ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ - += (entry_ptr)->size; \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring] += (entry_ptr)->size; \ } else { \ (cache_ptr)->clean_index_size += (entry_ptr)->size; \ - ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ - += (entry_ptr)->size; \ + (cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] += (entry_ptr)->size; \ } \ if((entry_ptr)->flush_me_last) { \ (cache_ptr)->num_last_entries++; \ - HDassert((cache_ptr)->num_last_entries <= 2); \ + assert((cache_ptr)->num_last_entries <= 2); \ } \ H5C__IL_DLL_APPEND((entry_ptr), (cache_ptr)->il_head, \ (cache_ptr)->il_tail, (cache_ptr)->il_len, \ - (cache_ptr)->il_size, fail_val) \ - H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr) \ - H5C__POST_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val) \ -} + (cache_ptr)->il_size, fail_val); \ + H5C__UPDATE_STATS_FOR_HT_INSERTION(cache_ptr); \ + H5C__POST_HT_INSERT_SC(cache_ptr, entry_ptr, fail_val); \ +} while (0) #define H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, fail_val) \ -{ \ +do { \ int k; \ - H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr) \ + H5C__PRE_HT_REMOVE_SC(cache_ptr, entry_ptr, fail_val) \ k = H5C__HASH_FCN((entry_ptr)->addr); \ if((entry_ptr)->ht_next) \ (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \ if((entry_ptr)->ht_prev) \ (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ - if(((cache_ptr)->index)[k] == (entry_ptr)) \ - ((cache_ptr)->index)[k] = (entry_ptr)->ht_next; \ + if((cache_ptr)->index[k] == (entry_ptr)) \ + (cache_ptr)->index[k] = (entry_ptr)->ht_next; \ (entry_ptr)->ht_next = NULL; \ (entry_ptr)->ht_prev = NULL; \ (cache_ptr)->index_len--; \ (cache_ptr)->index_size -= (entry_ptr)->size; \ - ((cache_ptr)->index_ring_len[entry_ptr->ring])--; \ - ((cache_ptr)->index_ring_size[entry_ptr->ring]) \ - -= (entry_ptr)->size; \ + (cache_ptr)->index_ring_len[(entry_ptr)->ring]--; \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] -= (entry_ptr)->size; \ if((entry_ptr)->is_dirty) { \ (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \ - ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ - -= (entry_ptr)->size; \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring] -= (entry_ptr)->size; \ } else { \ (cache_ptr)->clean_index_size -= (entry_ptr)->size; \ - ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ - -= (entry_ptr)->size; \ + (cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] -= (entry_ptr)->size; \ } \ if((entry_ptr)->flush_me_last) { \ (cache_ptr)->num_last_entries--; \ - HDassert((cache_ptr)->num_last_entries <= 1); \ + assert((cache_ptr)->num_last_entries <= 1); \ } \ H5C__IL_DLL_REMOVE((entry_ptr), (cache_ptr)->il_head, \ (cache_ptr)->il_tail, (cache_ptr)->il_len, \ - (cache_ptr)->il_size, fail_val) \ - H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr) \ - H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \ -} - -#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \ -{ \ - int k; \ - int depth = 0; \ - H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \ - k = H5C__HASH_FCN(Addr); \ - entry_ptr = ((cache_ptr)->index)[k]; \ - while(entry_ptr) { \ - if(H5F_addr_eq(Addr, (entry_ptr)->addr)) { \ - H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val) \ - if(entry_ptr != ((cache_ptr)->index)[k]) { \ - if((entry_ptr)->ht_next) \ - (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \ - HDassert((entry_ptr)->ht_prev != NULL); \ - (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ - ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \ - (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ - (entry_ptr)->ht_prev = NULL; \ - ((cache_ptr)->index)[k] = (entry_ptr); \ - H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \ - } \ - break; \ - } \ - (entry_ptr) = (entry_ptr)->ht_next; \ - (depth)++; \ - } \ - H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, (entry_ptr != NULL), depth) \ -} - -#define H5C__SEARCH_INDEX_NO_STATS(cache_ptr, Addr, entry_ptr, fail_val) \ -{ \ - int k; \ - H5C__PRE_HT_SEARCH_SC(cache_ptr, Addr, fail_val) \ - k = H5C__HASH_FCN(Addr); \ - entry_ptr = ((cache_ptr)->index)[k]; \ - while(entry_ptr) { \ - if(H5F_addr_eq(Addr, (entry_ptr)->addr)) { \ - H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val) \ - if(entry_ptr != ((cache_ptr)->index)[k]) { \ - if((entry_ptr)->ht_next) \ - (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \ - HDassert((entry_ptr)->ht_prev != NULL); \ - (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ - ((cache_ptr)->index)[k]->ht_prev = (entry_ptr); \ - (entry_ptr)->ht_next = ((cache_ptr)->index)[k]; \ - (entry_ptr)->ht_prev = NULL; \ - ((cache_ptr)->index)[k] = (entry_ptr); \ - H5C__POST_HT_SHIFT_TO_FRONT(cache_ptr, entry_ptr, k, fail_val) \ - } \ - break; \ - } \ - (entry_ptr) = (entry_ptr)->ht_next; \ - } \ -} - -#define H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr) \ -{ \ - H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \ - (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \ - ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ - -= (entry_ptr)->size; \ - (cache_ptr)->clean_index_size += (entry_ptr)->size; \ - ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ - += (entry_ptr)->size; \ - H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr); \ -} + (cache_ptr)->il_size, fail_val); \ + H5C__UPDATE_STATS_FOR_HT_DELETION(cache_ptr); \ + H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr, fail_val); \ +} while (0) -#define H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) \ -{ \ - H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \ - (cache_ptr)->clean_index_size -= (entry_ptr)->size; \ - ((cache_ptr)->clean_index_ring_size[entry_ptr->ring]) \ - -= (entry_ptr)->size; \ - (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ - ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring]) \ - += (entry_ptr)->size; \ - H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr); \ -} +#define H5C__SEARCH_INDEX(cache_ptr, entry_addr, entry_ptr, fail_val) \ +do { \ + int k; \ + int depth = 0; \ + H5C__PRE_HT_SEARCH_SC(cache_ptr, entry_addr, fail_val); \ + k = H5C__HASH_FCN(entry_addr); \ + (entry_ptr) = (cache_ptr)->index[k]; \ + while(entry_ptr) { \ + if(H5_addr_eq(entry_addr, (entry_ptr)->addr)) { \ + H5C__POST_SUC_HT_SEARCH_SC(cache_ptr, entry_ptr, k, fail_val); \ + if((entry_ptr) != (cache_ptr)->index[k]) { \ + if((entry_ptr)->ht_next) \ + (entry_ptr)->ht_next->ht_prev = (entry_ptr)->ht_prev; \ + assert((entry_ptr)->ht_prev != NULL); \ + (entry_ptr)->ht_prev->ht_next = (entry_ptr)->ht_next; \ + (cache_ptr)->index[k]->ht_prev = (entry_ptr); \ + (entry_ptr)->ht_next = (cache_ptr)->index[k]; \ + (entry_ptr)->ht_prev = NULL; \ + (cache_ptr)->index[k] = (entry_ptr); \ + H5C__POST_HT_SHIFT_TO_FRONT_SC(cache_ptr, entry_ptr, k, fail_val); \ + } \ + break; \ + } \ + (entry_ptr) = (entry_ptr)->ht_next; \ + (depth)++; \ + } \ + H5C__UPDATE_STATS_FOR_HT_SEARCH(cache_ptr, ((entry_ptr) != NULL), depth); \ +} while (0) + +#define H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr, fail_val) \ +do { \ + H5C__PRE_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr, fail_val); \ + (cache_ptr)->dirty_index_size -= (entry_ptr)->size; \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring] -= (entry_ptr)->size; \ + (cache_ptr)->clean_index_size += (entry_ptr)->size; \ + (cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] += (entry_ptr)->size; \ + H5C__POST_HT_UPDATE_FOR_ENTRY_CLEAN_SC(cache_ptr, entry_ptr, fail_val); \ +} while (0) + +#define H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr, fail_val) \ +do { \ + H5C__PRE_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr, fail_val); \ + (cache_ptr)->clean_index_size -= (entry_ptr)->size; \ + (cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] -= (entry_ptr)->size; \ + (cache_ptr)->dirty_index_size += (entry_ptr)->size; \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring] += (entry_ptr)->size; \ + H5C__POST_HT_UPDATE_FOR_ENTRY_DIRTY_SC(cache_ptr, entry_ptr, fail_val); \ +} while (0) #define H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ -{ \ + entry_ptr, was_clean, fail_val) \ +do { \ H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ + entry_ptr, was_clean, fail_val); \ (cache_ptr)->index_size -= (old_size); \ (cache_ptr)->index_size += (new_size); \ - ((cache_ptr)->index_ring_size[entry_ptr->ring]) -= (old_size); \ - ((cache_ptr)->index_ring_size[entry_ptr->ring]) += (new_size); \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] -= (old_size); \ + (cache_ptr)->index_ring_size[(entry_ptr)->ring] += (new_size); \ if(was_clean) { \ (cache_ptr)->clean_index_size -= (old_size); \ - ((cache_ptr)->clean_index_ring_size[entry_ptr->ring])-= (old_size); \ + (cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] -= (old_size); \ } else { \ - (cache_ptr)->dirty_index_size -= (old_size); \ - ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring])-= (old_size); \ + (cache_ptr)->dirty_index_size -= (old_size); \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring] -= (old_size); \ } \ if((entry_ptr)->is_dirty) { \ (cache_ptr)->dirty_index_size += (new_size); \ - ((cache_ptr)->dirty_index_ring_size[entry_ptr->ring])+= (new_size); \ + (cache_ptr)->dirty_index_ring_size[(entry_ptr)->ring] += (new_size); \ } else { \ - (cache_ptr)->clean_index_size += (new_size); \ - ((cache_ptr)->clean_index_ring_size[entry_ptr->ring])+= (new_size); \ + (cache_ptr)->clean_index_size += (new_size); \ + (cache_ptr)->clean_index_ring_size[(entry_ptr)->ring] += (new_size); \ } \ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->il_len, \ (cache_ptr)->il_size, \ - (old_size), (new_size)) \ + (old_size), (new_size), (fail_val)); \ H5C__POST_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr) \ -} + entry_ptr, fail_val); \ +} while (0) /************************************************************************** * - * Skip list insertion and deletion macros: - * - * These used to be functions, but I converted them to macros to avoid some - * function call overhead. + * Skip list modification macros * **************************************************************************/ -/*------------------------------------------------------------------------- - * - * Macro: H5C__INSERT_ENTRY_IN_SLIST - * - * Purpose: Insert the specified instance of H5C_cache_entry_t into - * the skip list in the specified instance of H5C_t. Update - * the associated length and size fields. - * - * Return: N/A - * - * Programmer: John Mainzer, 5/10/04 - * - * Modifications: - * - * JRM -- 7/21/04 - * Updated function to set the in_tree flag when inserting - * an entry into the tree. Also modified the function to - * update the tree size and len fields instead of the similar - * index fields. - * - * All of this is part of the modifications to support the - * hash table. - * - * JRM -- 7/27/04 - * Converted the function H5C_insert_entry_in_tree() into - * the macro H5C__INSERT_ENTRY_IN_TREE in the hopes of - * wringing a little more speed out of the cache. - * - * Note that we don't bother to check if the entry is already - * in the tree -- if it is, H5SL_insert() will fail. - * - * QAK -- 11/27/04 - * Switched over to using skip list routines. - * - * JRM -- 6/27/06 - * Added fail_val parameter. - * - * JRM -- 8/25/06 - * Added the H5C_DO_SANITY_CHECKS version of the macro. - * - * This version maintains the slist_len_increase and - * slist_size_increase fields that are used in sanity - * checks in the flush routines. - * - * All this is needed as the fractal heap needs to be - * able to dirty, resize and/or move entries during the - * flush. - * - * JRM -- 12/13/14 - * Added code to set cache_ptr->slist_changed to TRUE - * when an entry is inserted in the slist. - * - * JRM -- 9/1/15 - * Added code to maintain the cache_ptr->slist_ring_len - * and cache_ptr->slist_ring_size arrays. - * - * JRM -- 4/29/20 - * Reworked macro to support the slist_enabled field - * of H5C_t. If slist_enabled == TRUE, the macro - * functions as before. Otherwise, the macro is a no-op, - * and the slist must be empty. - * - *------------------------------------------------------------------------- - */ - -/* NOTE: The H5C__INSERT_ENTRY_IN_SLIST() macro is set up so that - * - * H5C_DO_SANITY_CHECKS - * - * and - * - * H5C_DO_SLIST_SANITY_CHECKS - * - * can be selected independently. This is easy to miss as the - * two #defines are easy to confuse. - */ - -#if H5C_DO_SLIST_SANITY_CHECKS +#ifdef H5C_DO_SLIST_SANITY_CHECKS -#define ENTRY_IN_SLIST(cache_ptr, entry_ptr) \ - H5C_entry_in_skip_list((cache_ptr), (entry_ptr)) +#define H5C__ENTRY_IN_SLIST(cache_ptr, entry_ptr) \ + H5C__entry_in_skip_list((cache_ptr), (entry_ptr)) #else /* H5C_DO_SLIST_SANITY_CHECKS */ -#define ENTRY_IN_SLIST(cache_ptr, entry_ptr) FALSE +#define H5C__ENTRY_IN_SLIST(cache_ptr, entry_ptr) FALSE #endif /* H5C_DO_SLIST_SANITY_CHECKS */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS + +#define H5C__SLIST_INSERT_ENTRY_SC(cache_ptr, entry_ptr) \ +do { \ + (cache_ptr)->slist_len_increase++; \ + (cache_ptr)->slist_size_increase += (int64_t)((entry_ptr)->size); \ +} while (0) /* H5C__SLIST_INSERT_ENTRY_SC() */ +#define H5C__SLIST_REMOVE_ENTRY_SC(cache_ptr, entry_ptr) \ +do { \ + (cache_ptr)->slist_len_increase--; \ + (cache_ptr)->slist_size_increase -= (int64_t)((entry_ptr)->size); \ +} while (0) /* H5C__SLIST_REMOVE_ENTRY_SC() */ +#define H5C__SLIST_UPDATE_FOR_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size) \ +do { \ + (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \ + (cache_ptr)->slist_size_increase += (int64_t)(new_size); \ +} while (0) /* H5C__SLIST_UPDATE_FOR_ENTRY_SIZE_CHANGE_SC() */ + +#else /* H5C_DO_SANITY_CHECKS */ + +#define H5C__SLIST_INSERT_ENTRY_SC(cache_ptr, entry_ptr) +#define H5C__SLIST_REMOVE_ENTRY_SC(cache_ptr, entry_ptr) +#define H5C__SLIST_UPDATE_FOR_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size) + +#endif /* H5C_DO_SANITY_CHECKS */ + + +/*------------------------------------------------------------------------- + * + * Macro: H5C__INSERT_ENTRY_IN_SLIST + * + * Purpose: Insert a cache entry into a cache's skip list. Updates + * the associated length and size fields. + * + * Note: This macro is set up so that H5C_DO_SANITY_CHECKS and + * H5C_DO_SLIST_SANITY_CHECKS can be selected independently. + * + *------------------------------------------------------------------------- + */ #define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - \ - if ( (cache_ptr)->slist_enabled ) { \ +do { \ + assert(cache_ptr); \ \ - HDassert( (entry_ptr) ); \ - HDassert( (entry_ptr)->size > 0 ); \ - HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ - HDassert( !((entry_ptr)->in_slist) ); \ - HDassert( ! ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ + if((cache_ptr)->slist_enabled) { \ + assert(entry_ptr); \ + assert((entry_ptr)->size > 0); \ + assert(H5_addr_defined((entry_ptr)->addr)); \ + assert(!(entry_ptr)->in_slist); \ + assert(!H5C__ENTRY_IN_SLIST((cache_ptr), (entry_ptr))); \ + assert((entry_ptr)->ring > H5C_RING_UNDEFINED); \ + assert((entry_ptr)->ring < H5C_RING_NTYPES); \ + assert((cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len); \ + assert((cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size); \ + assert((cache_ptr)->slist_ptr); \ \ - if ( H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, \ - &((entry_ptr)->addr)) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ - "can't insert entry in skip list") \ + if(H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, &((entry_ptr)->addr)) < 0) \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), "can't insert entry in skip list"); \ \ (entry_ptr)->in_slist = TRUE; \ (cache_ptr)->slist_changed = TRUE; \ @@ -1645,548 +1073,155 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->slist_size += (entry_ptr)->size; \ ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \ ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size;\ - (cache_ptr)->slist_len_increase++; \ - (cache_ptr)->slist_size_increase += (int64_t)((entry_ptr)->size); \ - \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( (cache_ptr)->slist_size > 0 ); \ + H5C__SLIST_INSERT_ENTRY_SC(cache_ptr, entry_ptr); \ \ + assert((cache_ptr)->slist_len > 0); \ + assert((cache_ptr)->slist_size > 0); \ } else { /* slist disabled */ \ - \ - HDassert( (cache_ptr)->slist_len == 0 ); \ - HDassert( (cache_ptr)->slist_size == 0 ); \ + assert((cache_ptr)->slist_len == 0); \ + assert((cache_ptr)->slist_size == 0); \ } \ -} /* H5C__INSERT_ENTRY_IN_SLIST */ +} while (0) /* H5C__INSERT_ENTRY_IN_SLIST */ -#else /* H5C_DO_SANITY_CHECKS */ -#define H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - \ - if ( (cache_ptr)->slist_enabled ) { \ +/*------------------------------------------------------------------------- + * + * Macro: H5C__REMOVE_ENTRY_FROM_SLIST + * + * Purpose: Insert a cache entry into a cache's skip list. Updates + * the associated length and size fields. + * + *------------------------------------------------------------------------- + */ + +#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush, fail_val) \ +do { \ + assert(cache_ptr); \ \ - HDassert( (entry_ptr) ); \ - HDassert( (entry_ptr)->size > 0 ); \ - HDassert( ! ENTRY_IN_SLIST((cache_ptr), (entry_ptr)) ); \ - HDassert( H5F_addr_defined((entry_ptr)->addr) ); \ - HDassert( !((entry_ptr)->in_slist) ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ - HDassert( (cache_ptr)->slist_ptr ); \ + if((cache_ptr)->slist_enabled) { \ + assert(entry_ptr); \ + assert(!(entry_ptr)->is_read_only); \ + assert((entry_ptr)->ro_ref_count == 0); \ + assert((entry_ptr)->size > 0); \ + assert((entry_ptr)->in_slist); \ + assert((cache_ptr)->slist_ptr); \ + assert((entry_ptr)->ring > H5C_RING_UNDEFINED); \ + assert((entry_ptr)->ring < H5C_RING_NTYPES); \ + assert((cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len); \ + assert((cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size); \ + assert((cache_ptr)->slist_size >= (entry_ptr)->size); \ \ - if ( H5SL_insert((cache_ptr)->slist_ptr, entry_ptr, \ - &((entry_ptr)->addr)) < 0) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), \ - "can't insert entry in skip list") \ + if(H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) != (entry_ptr) ) \ + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, (fail_val), "can't delete entry from skip list"); \ \ - (entry_ptr)->in_slist = TRUE; \ - (cache_ptr)->slist_changed = TRUE; \ - (cache_ptr)->slist_len++; \ - (cache_ptr)->slist_size += (entry_ptr)->size; \ - ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])++; \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (entry_ptr)->size;\ - \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( (cache_ptr)->slist_size > 0 ); \ - \ - } else { /* slist disabled */ \ - \ - HDassert( (cache_ptr)->slist_len == 0 ); \ - HDassert( (cache_ptr)->slist_size == 0 ); \ - } \ -} /* H5C__INSERT_ENTRY_IN_SLIST */ - -#endif /* H5C_DO_SANITY_CHECKS */ - - -/*------------------------------------------------------------------------- - * - * Function: H5C__REMOVE_ENTRY_FROM_SLIST - * - * Purpose: Remove the specified instance of H5C_cache_entry_t from the - * index skip list in the specified instance of H5C_t. Update - * the associated length and size fields. - * - * Return: N/A - * - * Programmer: John Mainzer, 5/10/04 - * - * Modifications: - * - * JRM -- 7/21/04 - * Updated function for the addition of the hash table. - * - * JRM - 7/27/04 - * Converted from the function H5C_remove_entry_from_tree() - * to the macro H5C__REMOVE_ENTRY_FROM_TREE in the hopes of - * wringing a little more performance out of the cache. - * - * QAK -- 11/27/04 - * Switched over to using skip list routines. - * - * JRM -- 3/28/07 - * Updated sanity checks for the new is_read_only and - * ro_ref_count fields in H5C_cache_entry_t. - * - * JRM -- 12/13/14 - * Added code to set cache_ptr->slist_changed to TRUE - * when an entry is removed from the slist. - * - * JRM -- 4/29/20 - * Reworked macro to support the slist_enabled field - * of H5C_t. If slist_enabled == TRUE, the macro - * functions as before. Otherwise, the macro is a no-op, - * and the slist must be empty. - * - *------------------------------------------------------------------------- - */ - -#if H5C_DO_SANITY_CHECKS -#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - \ - if ( (cache_ptr)->slist_enabled ) { \ - \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - HDassert( (entry_ptr)->in_slist ); \ - HDassert( (cache_ptr)->slist_ptr ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ - HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ - \ - if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ - != (entry_ptr) ) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ - "can't delete entry from skip list") \ - \ - HDassert( (cache_ptr)->slist_len > 0 ); \ + assert((cache_ptr)->slist_len > 0); \ if(!(during_flush)) \ (cache_ptr)->slist_changed = TRUE; \ (cache_ptr)->slist_len--; \ - HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ + assert((cache_ptr)->slist_size >= (entry_ptr)->size); \ (cache_ptr)->slist_size -= (entry_ptr)->size; \ - ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])--; \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \ - (entry_ptr)->size ); \ + (cache_ptr)->slist_ring_len[(entry_ptr)->ring]--; \ + assert((cache_ptr)->slist_ring_size[(entry_ptr)->ring] >= (entry_ptr)->size); \ ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (entry_ptr)->size;\ - (cache_ptr)->slist_len_increase--; \ - (cache_ptr)->slist_size_increase -= (int64_t)((entry_ptr)->size); \ + H5C__SLIST_REMOVE_ENTRY_SC(cache_ptr, entry_ptr); \ (entry_ptr)->in_slist = FALSE; \ - \ } else { /* slist disabled */ \ - \ - HDassert( (cache_ptr)->slist_len == 0 ); \ - HDassert( (cache_ptr)->slist_size == 0 ); \ + assert((cache_ptr)->slist_len == 0); \ + assert((cache_ptr)->slist_size == 0); \ } \ -} /* H5C__REMOVE_ENTRY_FROM_SLIST */ - -#else /* H5C_DO_SANITY_CHECKS */ - -#define H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - \ - if ( (cache_ptr)->slist_enabled ) { \ - \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->in_slist ); \ - HDassert( (cache_ptr)->slist_ptr ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ - \ - if ( H5SL_remove((cache_ptr)->slist_ptr, &(entry_ptr)->addr) \ - != (entry_ptr) ) \ - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, \ - "can't delete entry from skip list") \ - \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - if(!(during_flush)) \ - (cache_ptr)->slist_changed = TRUE; \ - (cache_ptr)->slist_len--; \ - HDassert( (cache_ptr)->slist_size >= (entry_ptr)->size ); \ - (cache_ptr)->slist_size -= (entry_ptr)->size; \ - ((cache_ptr)->slist_ring_len[(entry_ptr)->ring])--; \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \ - (entry_ptr)->size ); \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (entry_ptr)->size;\ - (entry_ptr)->in_slist = FALSE; \ - \ - } else { /* slist disabled */ \ - \ - HDassert( (cache_ptr)->slist_len == 0 ); \ - HDassert( (cache_ptr)->slist_size == 0 ); \ - } \ -} /* H5C__REMOVE_ENTRY_FROM_SLIST */ - -#endif /* H5C_DO_SANITY_CHECKS */ +} while (0) /* H5C__REMOVE_ENTRY_FROM_SLIST */ /*------------------------------------------------------------------------- * - * Function: H5C__UPDATE_SLIST_FOR_SIZE_CHANGE + * Macro: H5C__UPDATE_SLIST_FOR_SIZE_CHANGE * * Purpose: Update cache_ptr->slist_size for a change in the size of * and entry in the slist. * - * Return: N/A - * - * Programmer: John Mainzer, 9/07/05 - * - * Modifications: - * - * JRM -- 8/27/06 - * Added the H5C_DO_SANITY_CHECKS version of the macro. - * - * This version maintains the slist_size_increase field - * that are used in sanity checks in the flush routines. - * - * All this is needed as the fractal heap needs to be - * able to dirty, resize and/or move entries during the - * flush. - * - * JRM -- 12/13/14 - * Note that we do not set cache_ptr->slist_changed to TRUE - * in this case, as the structure of the slist is not - * modified. - * - * JRM -- 9/1/15 - * Added code to maintain the cache_ptr->slist_ring_len - * and cache_ptr->slist_ring_size arrays. - * - * JRM -- 4/29/20 - * Reworked macro to support the slist_enabled field - * of H5C_t. If slist_enabled == TRUE, the macro - * functions as before. Otherwise, the macro is a no-op, - * and the slist must be empty. - * *------------------------------------------------------------------------- */ -#if H5C_DO_SANITY_CHECKS - #define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - \ - if ( (cache_ptr)->slist_enabled ) { \ +do { \ + assert(cache_ptr); \ \ - HDassert( (old_size) > 0 ); \ - HDassert( (new_size) > 0 ); \ - HDassert( (old_size) <= (cache_ptr)->slist_size ); \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( ((cache_ptr)->slist_len > 1) || \ - ( (cache_ptr)->slist_size == (old_size) ) ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ + if((cache_ptr)->slist_enabled) { \ + assert((old_size) > 0); \ + assert((new_size) > 0); \ + assert((old_size) <= (cache_ptr)->slist_size); \ + assert((cache_ptr)->slist_len > 0); \ + assert((cache_ptr)->slist_len > 1 || \ + (cache_ptr)->slist_size == (old_size)); \ + assert((entry_ptr)->ring > H5C_RING_UNDEFINED); \ + assert((entry_ptr)->ring < H5C_RING_NTYPES); \ + assert((cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_len); \ + assert((cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ + (cache_ptr)->slist_size); \ \ (cache_ptr)->slist_size -= (old_size); \ (cache_ptr)->slist_size += (new_size); \ \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] \ - >= (old_size) ); \ + assert((cache_ptr)->slist_ring_size[(entry_ptr)->ring] >= (old_size)); \ \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \ + (cache_ptr)->slist_ring_size[(entry_ptr)->ring] -= (old_size); \ + (cache_ptr)->slist_ring_size[(entry_ptr)->ring] += (new_size); \ \ - (cache_ptr)->slist_size_increase -= (int64_t)(old_size); \ - (cache_ptr)->slist_size_increase += (int64_t)(new_size); \ - \ - HDassert( (new_size) <= (cache_ptr)->slist_size ); \ - HDassert( ( (cache_ptr)->slist_len > 1 ) || \ - ( (cache_ptr)->slist_size == (new_size) ) ); \ + H5C__SLIST_UPDATE_FOR_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size); \ \ + assert((new_size) <= (cache_ptr)->slist_size); \ + assert((cache_ptr)->slist_len > 1 || \ + (cache_ptr)->slist_size == (new_size)); \ } else { /* slist disabled */ \ - \ - HDassert( (cache_ptr)->slist_len == 0 ); \ - HDassert( (cache_ptr)->slist_size == 0 ); \ + assert((cache_ptr)->slist_len == 0); \ + assert((cache_ptr)->slist_size == 0); \ } \ -} /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ - -#else /* H5C_DO_SANITY_CHECKS */ - -#define H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, old_size, new_size) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - \ - if ( (cache_ptr)->slist_enabled ) { \ - \ - HDassert( (old_size) > 0 ); \ - HDassert( (new_size) > 0 ); \ - HDassert( (old_size) <= (cache_ptr)->slist_size ); \ - HDassert( (cache_ptr)->slist_len > 0 ); \ - HDassert( ((cache_ptr)->slist_len > 1) || \ - ( (cache_ptr)->slist_size == (old_size) ) ); \ - HDassert( (entry_ptr)->ring > H5C_RING_UNDEFINED ); \ - HDassert( (entry_ptr)->ring < H5C_RING_NTYPES ); \ - HDassert( (cache_ptr)->slist_ring_len[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_len ); \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr)->ring] <= \ - (cache_ptr)->slist_size ); \ - \ - (cache_ptr)->slist_size -= (old_size); \ - (cache_ptr)->slist_size += (new_size); \ - \ - HDassert( (cache_ptr)->slist_ring_size[(entry_ptr->ring)] >= \ - (old_size) ); \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) -= (old_size); \ - ((cache_ptr)->slist_ring_size[(entry_ptr)->ring]) += (new_size); \ - \ - HDassert( (new_size) <= (cache_ptr)->slist_size ); \ - HDassert( ( (cache_ptr)->slist_len > 1 ) || \ - ( (cache_ptr)->slist_size == (new_size) ) ); \ - \ - } else { /* slist disabled */ \ - \ - HDassert( (cache_ptr)->slist_len == 0 ); \ - HDassert( (cache_ptr)->slist_size == 0 ); \ - } \ -} /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ - -#endif /* H5C_DO_SANITY_CHECKS */ +} while (0) /* H5C__UPDATE_SLIST_FOR_SIZE_CHANGE */ /************************************************************************** * - * Replacement policy update macros: - * - * These used to be functions, but I converted them to macros to avoid some - * function call overhead. + * Replacement policy update macros * **************************************************************************/ -/*------------------------------------------------------------------------- - * - * Macro: H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS - * - * Purpose: For efficiency, we sometimes change the order of flushes -- - * but doing so can confuse the replacement policy. This - * macro exists to allow us to specify an entry as the - * most recently touched so we can repair any such - * confusion. - * - * At present, we only support the modified LRU policy, so - * this function deals with that case unconditionally. If - * we ever support other replacement policies, the macro - * should switch on the current policy and act accordingly. - * - * Return: N/A - * - * Programmer: John Mainzer, 10/13/05 - * - * Modifications: - * - * JRM -- 3/20/06 - * Modified macro to ignore pinned entries. Pinned entries - * do not appear in the data structures maintained by the - * replacement policy code, and thus this macro has nothing - * to do if called for such an entry. - * - * JRM -- 3/28/07 - * Added sanity checks using the new is_read_only and - * ro_ref_count fields of struct H5C_cache_entry_t. - * - *------------------------------------------------------------------------- - */ - #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS -#define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( ! ((entry_ptr)->is_pinned) ) { \ - \ - /* modified LRU specific code */ \ - \ - /* remove the entry from the LRU list, and re-insert it at the head.\ - */ \ - \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* Use the dirty flag to infer whether the entry is on the clean or \ - * dirty LRU list, and remove it. Then insert it at the head of \ - * the same LRU list. \ - * \ - * At least initially, all entries should be clean. That may \ - * change, so we may as well deal with both cases now. \ - */ \ - \ - if ( (entry_ptr)->is_dirty ) { \ - H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, (fail_val)) \ - \ - H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, (fail_val)) \ - } else { \ - H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, (fail_val)) \ - \ - H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, (fail_val)) \ - } \ - \ - /* End modified LRU specific code. */ \ - } \ -} /* H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS */ - -#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - -#define H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( ! ((entry_ptr)->is_pinned) ) { \ - \ - /* modified LRU specific code */ \ - \ - /* remove the entry from the LRU list, and re-insert it at the head \ - */ \ - \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* End modified LRU specific code. */ \ - } \ -} /* H5C__FAKE_RP_FOR_MOST_RECENT_ACCESS */ - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - - -/*------------------------------------------------------------------------- - * - * Macro: H5C__UPDATE_RP_FOR_EVICTION - * - * Purpose: Update the replacement policy data structures for an - * eviction of the specified cache entry. - * - * At present, we only support the modified LRU policy, so - * this function deals with that case unconditionally. If - * we ever support other replacement policies, the function - * should switch on the current policy and act accordingly. - * - * Return: Non-negative on success/Negative on failure. - * - * Programmer: John Mainzer, 5/10/04 - * - * Modifications: - * - * JRM - 7/27/04 - * Converted the function H5C_update_rp_for_eviction() to the - * macro H5C__UPDATE_RP_FOR_EVICTION in an effort to squeeze - * a bit more performance out of the cache. - * - * At least for the first cut, I am leaving the comments and - * white space in the macro. If they cause difficulties with - * the pre-processor, I'll have to remove them. - * - * JRM - 7/28/04 - * Split macro into two version, one supporting the clean and - * dirty LRU lists, and the other not. Yet another attempt - * at optimization. - * - * JRM - 3/20/06 - * Pinned entries can't be evicted, so this entry should never - * be called on a pinned entry. Added assert to verify this. - * - * JRM -- 3/28/07 - * Added sanity checks for the new is_read_only and - * ro_ref_count fields of struct H5C_cache_entry_t. - * - *------------------------------------------------------------------------- - */ - -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - -#define H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( !((entry_ptr)->is_pinned) ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - /* modified LRU specific code */ \ - \ - /* remove the entry from the LRU list. */ \ - \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ +#define H5C__UPDATE_RP_FOR_EVICTION_CD_LRU(cache_ptr, entry_ptr, fail_val) \ +do { \ /* If the entry is clean when it is evicted, it should be on the \ * clean LRU list, if it was dirty, it should be on the dirty LRU list. \ * Remove it from the appropriate list according to the value of the \ * dirty flag. \ */ \ - \ - if ( (entry_ptr)->is_dirty ) { \ - \ + if((entry_ptr)->is_dirty) { \ + H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)) \ + } else { \ + H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)) \ + } \ +} while (0) /* H5C__UPDATE_RP_FOR_EVICTION_CD_LRU() */ + +#define H5C__UPDATE_RP_FOR_FLUSH_CD_LRU(cache_ptr, entry_ptr, fail_val) \ +do { \ + /* An entry being flushed or cleared, may not be dirty. Use the \ + * dirty flag to infer whether the entry is on the clean or dirty \ + * LRU list, and remove it. Then insert it at the head of the \ + * clean LRU list. \ + * \ + * The function presumes that a dirty entry will be either cleared \ + * or flushed shortly, so it is OK if we put a dirty entry on the \ + * clean LRU list. \ + */ \ + if((entry_ptr)->is_dirty) { \ H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ (cache_ptr)->dLRU_tail_ptr, \ (cache_ptr)->dLRU_list_len, \ @@ -2198,99 +1233,226 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->cLRU_list_size, (fail_val)) \ } \ \ -} /* H5C__UPDATE_RP_FOR_EVICTION */ + H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)) \ +} while (0) /* H5C__UPDATE_RP_FOR_FLUSH_CD_LRU() */ + +#define H5C__UPDATE_RP_FOR_INSERT_APPEND_CD_LRU(cache_ptr, entry_ptr, fail_val) \ +do { \ + /* Insert the entry at the _tail_ of the clean or dirty LRU list as \ + * appropriate. \ + */ \ + if((entry_ptr)->is_dirty) { \ + H5C__AUX_DLL_APPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)); \ + } else { \ + H5C__AUX_DLL_APPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)); \ + } \ +} while (0) /* H5C__UPDATE_RP_FOR_INSERT_APPEND_CD_LRU() */ + +#define H5C__UPDATE_RP_FOR_INSERTION_CD_LRU(cache_ptr, entry_ptr, fail_val) \ +do { \ + /* Insert the entry at the head of the clean or dirty LRU list as \ + * appropriate. \ + */ \ + if((entry_ptr)->is_dirty) { \ + H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)) \ + } else { \ + H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)) \ + } \ +} while(0) /* H5C__UPDATE_RP_FOR_INSERTION_CD_LRU() */ + +#define H5C__UPDATE_RP_FOR_PROTECT_CD_LRU(cache_ptr, entry_ptr, fail_val) \ +{ \ + /* Remove the entry from the clean or dirty LRU list as appropriate */ \ + if((entry_ptr)->is_dirty) { \ + H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)) \ + } else { \ + H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)) \ + } \ +} while (0) /* H5C__UPDATE_RP_FOR_PROTECT_CD_LRU() */ + +#define H5C__UPDATE_RP_FOR_MOVE_CD_LRU(cache_ptr, entry_ptr, was_dirty, fail_val) \ +do { \ + /* Remove the entry from either the clean or dirty LRU list as \ + * indicated by the was_dirty parameter \ + */ \ + if(was_dirty) { \ + H5C__AUX_DLL_REMOVE((entry_ptr), \ + (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)); \ + \ + } else { \ + H5C__AUX_DLL_REMOVE((entry_ptr), \ + (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)); \ + } \ + \ + /* Insert the entry at the head of either the clean or dirty \ + * LRU list as appropriate. \ + */ \ + if((entry_ptr)->is_dirty) { \ + H5C__AUX_DLL_PREPEND((entry_ptr), \ + (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)); \ + } else { \ + H5C__AUX_DLL_PREPEND((entry_ptr), \ + (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)); \ + } \ +} while (0) /* H5C__UPDATE_RP_FOR_MOVE_CD_LRU() */ + +#define H5C__UPDATE_RP_FOR_SIZE_CHANGE_CD_LRU(cache_ptr, entry_ptr, new_size, fail_val) \ +do { \ + /* Update the size of the clean or dirty LRU list as \ + * appropriate. \ + */ \ + if((entry_ptr)->is_dirty) { \ + H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, \ + (entry_ptr)->size, \ + (new_size), (fail_val)) \ + \ + } else { \ + H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, \ + (entry_ptr)->size, \ + (new_size), (fail_val)) \ + } \ +} while (0) /* H5C__UPDATE_RP_FOR_SIZE_CHANGE_CD_LRU() */ + +#define H5C__UPDATE_RP_FOR_UNPIN_CD_LRU(cache_ptr, entry_ptr, fail_val) \ +do { \ + /* Insert the entry at the head of either the clean \ + * or dirty LRU list as appropriate. \ + */ \ + if((entry_ptr)->is_dirty) { \ + H5C__AUX_DLL_PREPEND((entry_ptr), \ + (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)) \ + } else { \ + H5C__AUX_DLL_PREPEND((entry_ptr), \ + (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)) \ + } \ +} while (0) /* H5C__UPDATE_RP_FOR_UNPIN_CD_LRU() */ + +#define H5C__UPDATE_RP_FOR_UNPROTECT_CD_LRU(cache_ptr, entry_ptr, fail_val) \ +do { \ + /* Insert the entry at the head of either the clean or \ + * dirty LRU list as appropriate. \ + */ \ + if((entry_ptr)->is_dirty) { \ + H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ + (cache_ptr)->dLRU_tail_ptr, \ + (cache_ptr)->dLRU_list_len, \ + (cache_ptr)->dLRU_list_size, (fail_val)) \ + } else { \ + H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ + (cache_ptr)->cLRU_tail_ptr, \ + (cache_ptr)->cLRU_list_len, \ + (cache_ptr)->cLRU_list_size, (fail_val)) \ + } \ +} while (0) /* H5C__UPDATE_RP_FOR_UNPROTECT_CD_LRU() */ #else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ +#define H5C__UPDATE_RP_FOR_EVICTION_CD_LRU(cache_ptr, entry_ptr, fail_val) +#define H5C__UPDATE_RP_FOR_FLUSH_CD_LRU(cache_ptr, entry_ptr, fail_val) +#define H5C__UPDATE_RP_FOR_INSERT_APPEND_CD_LRU(cache_ptr, entry_ptr, fail_val) +#define H5C__UPDATE_RP_FOR_INSERTION_CD_LRU(cache_ptr, entry_ptr, fail_val) +#define H5C__UPDATE_RP_FOR_PROTECT_CD_LRU(cache_ptr, entry_ptr, fail_val) +#define H5C__UPDATE_RP_FOR_MOVE_CD_LRU(cache_ptr, entry_ptr, was_dirty, fail_val) +#define H5C__UPDATE_RP_FOR_SIZE_CHANGE_CD_LRU(cache_ptr, entry_ptr, new_size, fail_val) +#define H5C__UPDATE_RP_FOR_UNPIN_CD_LRU(cache_ptr, entry_ptr, fail_val) +#define H5C__UPDATE_RP_FOR_UNPROTECT_CD_LRU(cache_ptr, entry_ptr, fail_val) + +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + +/*------------------------------------------------------------------------- + * + * Macro: H5C__UPDATE_RP_FOR_EVICTION + * + * Purpose: Update the replacement policy data structures for an + * eviction of the specified cache entry. + * + *------------------------------------------------------------------------- + */ + #define H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( !((entry_ptr)->is_pinned) ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - /* modified LRU specific code */ \ - \ - /* remove the entry from the LRU list. */ \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ + assert(!(entry_ptr)->is_protected); \ + assert(!(entry_ptr)->is_read_only); \ + assert((entry_ptr)->ro_ref_count == 0); \ + assert(!(entry_ptr)->is_pinned); \ + assert((entry_ptr)->size > 0); \ \ + /* Remove the entry from the LRU list */ \ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, \ (cache_ptr)->LRU_list_size, (fail_val)) \ \ -} /* H5C__UPDATE_RP_FOR_EVICTION */ - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + /* Remove the entry from the clean & dirty LRU lists, if enabled */ \ + H5C__UPDATE_RP_FOR_EVICTION_CD_LRU(cache_ptr, entry_ptr, fail_val); \ +} while (0) /* H5C__UPDATE_RP_FOR_EVICTION */ /*------------------------------------------------------------------------- * - * Macro: H5C__UPDATE_RP_FOR_FLUSH + * Macro: H5C__UPDATE_RP_FOR_FLUSH * * Purpose: Update the replacement policy data structures for a flush - * of the specified cache entry. - * - * At present, we only support the modified LRU policy, so - * this function deals with that case unconditionally. If - * we ever support other replacement policies, the function - * should switch on the current policy and act accordingly. - * - * Return: N/A - * - * Programmer: John Mainzer, 5/6/04 - * - * Modifications: - * - * JRM - 7/27/04 - * Converted the function H5C_update_rp_for_flush() to the - * macro H5C__UPDATE_RP_FOR_FLUSH in an effort to squeeze - * a bit more performance out of the cache. - * - * At least for the first cut, I am leaving the comments and - * white space in the macro. If they cause difficulties with - * pre-processor, I'll have to remove them. - * - * JRM - 7/28/04 - * Split macro into two versions, one supporting the clean and - * dirty LRU lists, and the other not. Yet another attempt - * at optimization. - * - * JRM - 3/20/06 - * While pinned entries can be flushed, they don't reside in - * the replacement policy data structures when unprotected. - * Thus I modified this macro to do nothing if the entry is - * pinned. - * - * JRM - 3/28/07 - * Added sanity checks based on the new is_read_only and - * ro_ref_count fields of struct H5C_cache_entry_t. + * of the specified cache entry. * *------------------------------------------------------------------------- */ -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - #define H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ + assert(!(entry_ptr)->is_protected); \ + assert(!(entry_ptr)->is_read_only); \ + assert((entry_ptr)->ro_ref_count == 0); \ + assert((entry_ptr)->size > 0); \ \ - if ( ! ((entry_ptr)->is_pinned) ) { \ - \ - /* modified LRU specific code */ \ - \ - /* remove the entry from the LRU list, and re-insert it at the \ - * head. \ + if(!(entry_ptr)->is_pinned) { \ + /* Remove the entry from its location in the LRU list \ + * and re-insert it at the head of the list. \ */ \ - \ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ (cache_ptr)->LRU_tail_ptr, \ (cache_ptr)->LRU_list_len, \ @@ -2301,979 +1463,310 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->LRU_list_len, \ (cache_ptr)->LRU_list_size, (fail_val)) \ \ - /* since the entry is being flushed or cleared, one would think \ - * that it must be dirty -- but that need not be the case. Use the \ - * dirty flag to infer whether the entry is on the clean or dirty \ - * LRU list, and remove it. Then insert it at the head of the \ - * clean LRU list. \ - * \ - * The function presumes that a dirty entry will be either cleared \ - * or flushed shortly, so it is OK if we put a dirty entry on the \ - * clean LRU list. \ - */ \ - \ - if ( (entry_ptr)->is_dirty ) { \ - H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, (fail_val)) \ - } else { \ - H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, (fail_val)) \ - } \ - \ - H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, (fail_val)) \ - \ - /* End modified LRU specific code. */ \ + /* Maintain the clean & dirty LRU lists, if enabled */ \ + H5C__UPDATE_RP_FOR_FLUSH_CD_LRU(cache_ptr, entry_ptr, fail_val); \ } \ -} /* H5C__UPDATE_RP_FOR_FLUSH */ - -#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - -#define H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( ! ((entry_ptr)->is_pinned) ) { \ - \ - /* modified LRU specific code */ \ - \ - /* remove the entry from the LRU list, and re-insert it at the \ - * head. \ - */ \ - \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* End modified LRU specific code. */ \ - } \ -} /* H5C__UPDATE_RP_FOR_FLUSH */ - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ +} while (0) /* H5C__UPDATE_RP_FOR_FLUSH */ /*------------------------------------------------------------------------- * - * Macro: H5C__UPDATE_RP_FOR_INSERT_APPEND + * Macro: H5C__UPDATE_RP_FOR_INSERT_APPEND * * Purpose: Update the replacement policy data structures for an - * insertion of the specified cache entry. - * - * Unlike H5C__UPDATE_RP_FOR_INSERTION below, mark the - * new entry as the LEAST recently used entry, not the - * most recently used. + * insertion of the specified cache entry. * - * For now at least, this macro should only be used in - * the reconstruction of the metadata cache from a cache - * image block. - * - * At present, we only support the modified LRU policy, so - * this function deals with that case unconditionally. If - * we ever support other replacement policies, the function - * should switch on the current policy and act accordingly. - * - * Return: N/A - * - * Programmer: John Mainzer, 8/15/15 + * Unlike H5C__UPDATE_RP_FOR_INSERTION below, insert a non-pinned + * new entry as the LEAST recently used entry, not the + * most recently used. * *------------------------------------------------------------------------- */ -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - #define H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( (entry_ptr)->is_pinned ) { \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ + assert(!(entry_ptr)->is_protected); \ + assert(!(entry_ptr)->is_read_only); \ + assert((entry_ptr)->ro_ref_count == 0 ); \ + assert((entry_ptr)->size > 0 ); \ \ + if((entry_ptr)->is_pinned) { \ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ (cache_ptr)->pel_tail_ptr, \ (cache_ptr)->pel_len, \ (cache_ptr)->pel_size, (fail_val)) \ - \ } else { \ - \ - /* modified LRU specific code */ \ - \ - /* insert the entry at the tail of the LRU list. */ \ - \ + /* Insert the entry at the tail of the LRU list. */ \ H5C__DLL_APPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ (cache_ptr)->LRU_tail_ptr, \ (cache_ptr)->LRU_list_len, \ (cache_ptr)->LRU_list_size, (fail_val)) \ \ - /* insert the entry at the tail of the clean or dirty LRU list as \ - * appropriate. \ - */ \ - \ - if ( entry_ptr->is_dirty ) { \ - H5C__AUX_DLL_APPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, (fail_val)) \ - } else { \ - H5C__AUX_DLL_APPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, (fail_val)) \ - } \ - \ - /* End modified LRU specific code. */ \ + /* Maintain the clean & dirty LRU lists, if enabled */ \ + H5C__UPDATE_RP_FOR_INSERT_APPEND_CD_LRU(cache_ptr, entry_ptr, fail_val); \ } \ -} - -#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - -#define H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( (entry_ptr)->is_pinned ) { \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ - (cache_ptr)->pel_tail_ptr, \ - (cache_ptr)->pel_len, \ - (cache_ptr)->pel_size, (fail_val)) \ - \ - } else { \ - \ - /* modified LRU specific code */ \ - \ - /* insert the entry at the tail of the LRU list. */ \ - \ - H5C__DLL_APPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* End modified LRU specific code. */ \ - } \ -} - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ +} while (0) /*------------------------------------------------------------------------- * - * Macro: H5C__UPDATE_RP_FOR_INSERTION + * Macro: H5C__UPDATE_RP_FOR_INSERTION * * Purpose: Update the replacement policy data structures for an - * insertion of the specified cache entry. - * - * At present, we only support the modified LRU policy, so - * this function deals with that case unconditionally. If - * we ever support other replacement policies, the function - * should switch on the current policy and act accordingly. - * - * Return: N/A - * - * Programmer: John Mainzer, 5/17/04 - * - * Modifications: - * - * JRM - 7/27/04 - * Converted the function H5C_update_rp_for_insertion() to the - * macro H5C__UPDATE_RP_FOR_INSERTION in an effort to squeeze - * a bit more performance out of the cache. - * - * At least for the first cut, I am leaving the comments and - * white space in the macro. If they cause difficulties with - * pre-processor, I'll have to remove them. - * - * JRM - 7/28/04 - * Split macro into two version, one supporting the clean and - * dirty LRU lists, and the other not. Yet another attempt - * at optimization. - * - * JRM - 3/10/06 - * This macro should never be called on a pinned entry. - * Inserted an assert to verify this. - * - * JRM - 8/9/06 - * Not any more. We must now allow insertion of pinned - * entries. Updated macro to support this. - * - * JRM - 3/28/07 - * Added sanity checks using the new is_read_only and - * ro_ref_count fields of struct H5C_cache_entry_t. + * insertion of the specified cache entry. * *------------------------------------------------------------------------- */ -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - -#define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( (entry_ptr)->is_pinned ) { \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ - (cache_ptr)->pel_tail_ptr, \ - (cache_ptr)->pel_len, \ - (cache_ptr)->pel_size, (fail_val)) \ - \ - } else { \ - \ - /* modified LRU specific code */ \ - \ - /* insert the entry at the head of the LRU list. */ \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* insert the entry at the head of the clean or dirty LRU list as \ - * appropriate. \ - */ \ - \ - if ( entry_ptr->is_dirty ) { \ - H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, (fail_val)) \ - } else { \ - H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, (fail_val)) \ - } \ - \ - /* End modified LRU specific code. */ \ - } \ -} - -#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - -#define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( (entry_ptr)->is_pinned ) { \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ - (cache_ptr)->pel_tail_ptr, \ - (cache_ptr)->pel_len, \ - (cache_ptr)->pel_size, (fail_val)) \ - \ - } else { \ - \ - /* modified LRU specific code */ \ - \ - /* insert the entry at the head of the LRU list. */ \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* End modified LRU specific code. */ \ - } \ -} - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ +#define H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, fail_val) \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ + assert(!(entry_ptr)->is_protected); \ + assert(!(entry_ptr)->is_read_only); \ + assert((entry_ptr)->ro_ref_count == 0); \ + assert((entry_ptr)->size > 0); \ + \ + if((entry_ptr)->is_pinned) { \ + H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ + (cache_ptr)->pel_tail_ptr, \ + (cache_ptr)->pel_len, \ + (cache_ptr)->pel_size, (fail_val)) \ + \ + } else { \ + /* Insert the entry at the head of the LRU list. */ \ + H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ + (cache_ptr)->LRU_tail_ptr, \ + (cache_ptr)->LRU_list_len, \ + (cache_ptr)->LRU_list_size, (fail_val)) \ + \ + /* Maintain the clean & dirty LRU lists, if enabled */ \ + H5C__UPDATE_RP_FOR_INSERTION_CD_LRU(cache_ptr, entry_ptr, fail_val); \ + } \ +} while (0) /*------------------------------------------------------------------------- * - * Macro: H5C__UPDATE_RP_FOR_PROTECT + * Macro: H5C__UPDATE_RP_FOR_PROTECT * * Purpose: Update the replacement policy data structures for a - * protect of the specified cache entry. - * - * To do this, unlink the specified entry from any data - * structures used by the replacement policy, and add the - * entry to the protected list. - * - * At present, we only support the modified LRU policy, so - * this function deals with that case unconditionally. If - * we ever support other replacement policies, the function - * should switch on the current policy and act accordingly. - * - * Return: N/A - * - * Programmer: John Mainzer, 5/17/04 - * - * Modifications: - * - * JRM - 7/27/04 - * Converted the function H5C_update_rp_for_protect() to the - * macro H5C__UPDATE_RP_FOR_PROTECT in an effort to squeeze - * a bit more performance out of the cache. - * - * At least for the first cut, I am leaving the comments and - * white space in the macro. If they cause difficulties with - * pre-processor, I'll have to remove them. - * - * JRM - 7/28/04 - * Split macro into two version, one supporting the clean and - * dirty LRU lists, and the other not. Yet another attempt - * at optimization. - * - * JRM - 3/17/06 - * Modified macro to attempt to remove pinned entriese from - * the pinned entry list instead of from the data structures - * maintained by the replacement policy. + * protect of the specified cache entry. * - * JRM - 3/28/07 - * Added sanity checks based on the new is_read_only and - * ro_ref_count fields of struct H5C_cache_entry_t. + * To do this, unlink the specified entry from any data + * structures used by the replacement policy (or the pinned list, + * which is outside of the replacement policy), and add the + * entry to the protected list. * *------------------------------------------------------------------------- */ -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - -#define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( (entry_ptr)->is_pinned ) { \ - \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ - (cache_ptr)->pel_tail_ptr, \ - (cache_ptr)->pel_len, \ - (cache_ptr)->pel_size, (fail_val)) \ - \ - } else { \ - \ - /* modified LRU specific code */ \ - \ - /* remove the entry from the LRU list. */ \ - \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* Similarly, remove the entry from the clean or dirty LRU list \ - * as appropriate. \ - */ \ - \ - if ( (entry_ptr)->is_dirty ) { \ - \ - H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, (fail_val)) \ - \ - } else { \ - \ - H5C__AUX_DLL_REMOVE((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, (fail_val)) \ - } \ - \ - /* End modified LRU specific code. */ \ - } \ - \ - /* Regardless of the replacement policy, or whether the entry is \ - * pinned, now add the entry to the protected list. \ - */ \ - \ - H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, \ - (cache_ptr)->pl_tail_ptr, \ - (cache_ptr)->pl_len, \ - (cache_ptr)->pl_size, (fail_val)) \ -} /* H5C__UPDATE_RP_FOR_PROTECT */ - -#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - -#define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( (entry_ptr)->is_pinned ) { \ - \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ - (cache_ptr)->pel_tail_ptr, \ - (cache_ptr)->pel_len, \ - (cache_ptr)->pel_size, (fail_val)) \ - \ - } else { \ - \ - /* modified LRU specific code */ \ - \ - /* remove the entry from the LRU list. */ \ - \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* End modified LRU specific code. */ \ - } \ - \ - /* Regardless of the replacement policy, or whether the entry is \ - * pinned, now add the entry to the protected list. \ - */ \ - \ - H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, \ - (cache_ptr)->pl_tail_ptr, \ - (cache_ptr)->pl_len, \ - (cache_ptr)->pl_size, (fail_val)) \ -} /* H5C__UPDATE_RP_FOR_PROTECT */ - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ +#define H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, fail_val) \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ + assert(!(entry_ptr)->is_protected); \ + assert(!(entry_ptr)->is_read_only); \ + assert((entry_ptr)->ro_ref_count == 0); \ + assert((entry_ptr)->size > 0); \ + \ + if((entry_ptr)->is_pinned) { \ + H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ + (cache_ptr)->pel_tail_ptr, \ + (cache_ptr)->pel_len, \ + (cache_ptr)->pel_size, (fail_val)) \ + } else { \ + /* Remove the entry from the LRU list. */ \ + H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ + (cache_ptr)->LRU_tail_ptr, \ + (cache_ptr)->LRU_list_len, \ + (cache_ptr)->LRU_list_size, (fail_val)) \ + \ + /* Maintain the clean & dirty LRU lists, if enabled */ \ + H5C__UPDATE_RP_FOR_PROTECT_CD_LRU(cache_ptr, entry_ptr, fail_val); \ + } \ + \ + /* Regardless of whether the entry is pinned, add it to the protected \ + * list. \ + */ \ + H5C__DLL_APPEND((entry_ptr), (cache_ptr)->pl_head_ptr, \ + (cache_ptr)->pl_tail_ptr, \ + (cache_ptr)->pl_len, \ + (cache_ptr)->pl_size, (fail_val)) \ +} while (0) /* H5C__UPDATE_RP_FOR_PROTECT */ /*------------------------------------------------------------------------- * - * Macro: H5C__UPDATE_RP_FOR_MOVE + * Macro: H5C__UPDATE_RP_FOR_MOVE * * Purpose: Update the replacement policy data structures for a - * move of the specified cache entry. - * - * At present, we only support the modified LRU policy, so - * this function deals with that case unconditionally. If - * we ever support other replacement policies, the function - * should switch on the current policy and act accordingly. - * - * Return: N/A - * - * Programmer: John Mainzer, 5/17/04 + * move of the specified cache entry. * *------------------------------------------------------------------------- */ -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - -#define H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( ! ( (entry_ptr)->is_pinned ) && ! ( (entry_ptr->is_protected ) ) ) {\ - \ - /* modified LRU specific code */ \ +#define H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, fail_val) \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ + assert(!(entry_ptr)->is_read_only); \ + assert((entry_ptr)->ro_ref_count == 0); \ + assert((entry_ptr)->size > 0); \ \ - /* remove the entry from the LRU list, and re-insert it at the head. \ + if(!(entry_ptr)->is_pinned && !(entry_ptr)->is_protected) { \ + /* Remove the entry from the LRU list, and re-insert it at the head. \ */ \ - \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ + H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ + (cache_ptr)->LRU_tail_ptr, \ + (cache_ptr)->LRU_list_len, \ + (cache_ptr)->LRU_list_size, (fail_val)) \ \ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ (cache_ptr)->LRU_tail_ptr, \ (cache_ptr)->LRU_list_len, \ (cache_ptr)->LRU_list_size, (fail_val)) \ \ - /* remove the entry from either the clean or dirty LUR list as \ - * indicated by the was_dirty parameter \ - */ \ - if ( was_dirty ) { \ - \ - H5C__AUX_DLL_REMOVE((entry_ptr), \ - (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, \ - (fail_val)) \ - \ - } else { \ - \ - H5C__AUX_DLL_REMOVE((entry_ptr), \ - (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, \ - (fail_val)) \ - } \ - \ - /* insert the entry at the head of either the clean or dirty \ - * LRU list as appropriate. \ - */ \ - \ - if ( (entry_ptr)->is_dirty ) { \ - \ - H5C__AUX_DLL_PREPEND((entry_ptr), \ - (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, \ - (fail_val)) \ - \ - } else { \ - \ - H5C__AUX_DLL_PREPEND((entry_ptr), \ - (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, \ - (fail_val)) \ - } \ - \ - /* End modified LRU specific code. */ \ - } \ -} /* H5C__UPDATE_RP_FOR_MOVE */ - -#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - -#define H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - if ( ! ( (entry_ptr)->is_pinned ) && ! ( (entry_ptr->is_protected ) ) ) {\ - \ - /* modified LRU specific code */ \ - \ - /* remove the entry from the LRU list, and re-insert it at the head. \ - */ \ - \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* End modified LRU specific code. */ \ - } \ -} /* H5C__UPDATE_RP_FOR_MOVE */ - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + /* Maintain the clean & dirty LRU lists, if enabled */ \ + H5C__UPDATE_RP_FOR_MOVE_CD_LRU(cache_ptr, entry_ptr, was_dirty, fail_val); \ + } \ +} while (0) /* H5C__UPDATE_RP_FOR_MOVE */ /*------------------------------------------------------------------------- * - * Macro: H5C__UPDATE_RP_FOR_SIZE_CHANGE + * Macro: H5C__UPDATE_RP_FOR_SIZE_CHANGE * * Purpose: Update the replacement policy data structures for a - * size change of the specified cache entry. - * - * To do this, determine if the entry is pinned. If it is, - * update the size of the pinned entry list. - * - * If it isn't pinned, the entry must handled by the - * replacement policy. Update the appropriate replacement - * policy data structures. + * size change of the specified cache entry. * - * At present, we only support the modified LRU policy, so - * this function deals with that case unconditionally. If - * we ever support other replacement policies, the function - * should switch on the current policy and act accordingly. + * To do this, determine if the entry is pinned. If it is, + * update the size of the pinned entry list. * - * Return: N/A + * If it isn't pinned, the entry must handled by the + * replacement policy. Update the appropriate replacement + * policy data structures. * - * Programmer: John Mainzer, 8/23/06 - * - * Modifications: - * - * JRM -- 3/28/07 - * Added sanity checks based on the new is_read_only and - * ro_ref_count fields of struct H5C_cache_entry_t. + * If the entry is accessed with collective operations for + * parallel I/O, update that list. * *------------------------------------------------------------------------- */ -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS +#ifdef H5_HAVE_PARALLEL -#define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - HDassert( new_size > 0 ); \ - \ - if ( (entry_ptr)->coll_access ) { \ - \ - H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->coll_list_len, \ - (cache_ptr)->coll_list_size, \ - (entry_ptr)->size, \ - (new_size)); \ - \ - } \ +#define H5C__UPDATE_RP_FOR_SIZE_CHANGE_COLL(cache_ptr, entry_ptr, new_size, fail_val) \ +do { \ + if((entry_ptr)->coll_access) { \ + H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (entry_ptr)->size, \ + (new_size), (fail_val)); \ + \ + } \ +} while (0) /* H5C__UPDATE_RP_FOR_SIZE_CHANGE_COLL() */ + +#else /* H5_HAVE_PARALLEL */ + +#define H5C__UPDATE_RP_FOR_SIZE_CHANGE_COLL(cache_ptr, entry_ptr, new_size, fail_val) + +#endif /* H5_HAVE_PARALLEL */ + +#define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size, fail_val) \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ + assert(!(entry_ptr)->is_protected); \ + assert(!(entry_ptr)->is_read_only); \ + assert((entry_ptr)->ro_ref_count == 0); \ + assert((entry_ptr)->size > 0 ); \ + assert(new_size > 0 ); \ \ - if ( (entry_ptr)->is_pinned ) { \ + /* Maintain the collective access list, if enabled */ \ + H5C__UPDATE_RP_FOR_SIZE_CHANGE_COLL(cache_ptr, entry_ptr, new_size, fail_val); \ \ + if((entry_ptr)->is_pinned) { \ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \ (cache_ptr)->pel_size, \ (entry_ptr)->size, \ - (new_size)); \ - \ - } else { \ - \ - /* modified LRU specific code */ \ - \ - /* Update the size of the LRU list */ \ - \ - H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, \ - (entry_ptr)->size, \ - (new_size)); \ - \ - /* Similarly, update the size of the clean or dirty LRU list as \ - * appropriate. At present, the entry must be clean, but that \ - * could change. \ - */ \ - \ - if ( (entry_ptr)->is_dirty ) { \ - \ - H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, \ - (entry_ptr)->size, \ - (new_size)); \ - \ - } else { \ - \ - H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, \ - (entry_ptr)->size, \ - (new_size)); \ - } \ - \ - /* End modified LRU specific code. */ \ - } \ - \ -} /* H5C__UPDATE_RP_FOR_SIZE_CHANGE */ - -#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - -#define H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_size) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->size > 0 ); \ - HDassert( new_size > 0 ); \ - \ - if ( (entry_ptr)->is_pinned ) { \ - \ - H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \ - (cache_ptr)->pel_size, \ - (entry_ptr)->size, \ - (new_size)); \ - \ + (new_size), (fail_val)) \ } else { \ - \ - /* modified LRU specific code */ \ - \ /* Update the size of the LRU list */ \ - \ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->LRU_list_len, \ (cache_ptr)->LRU_list_size, \ (entry_ptr)->size, \ - (new_size)); \ + (new_size), (fail_val)) \ \ - /* End modified LRU specific code. */ \ + /* Maintain the clean & dirty LRU lists, if enabled */ \ + H5C__UPDATE_RP_FOR_SIZE_CHANGE_CD_LRU(cache_ptr, entry_ptr, new_size, fail_val); \ } \ - \ -} /* H5C__UPDATE_RP_FOR_SIZE_CHANGE */ - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ +} while (0) /* H5C__UPDATE_RP_FOR_SIZE_CHANGE */ /*------------------------------------------------------------------------- * - * Macro: H5C__UPDATE_RP_FOR_UNPIN + * Macro: H5C__UPDATE_RP_FOR_UNPIN * * Purpose: Update the replacement policy data structures for an - * unpin of the specified cache entry. - * - * To do this, unlink the specified entry from the protected - * entry list, and re-insert it in the data structures used - * by the current replacement policy. - * - * At present, we only support the modified LRU policy, so - * this function deals with that case unconditionally. If - * we ever support other replacement policies, the macro - * should switch on the current policy and act accordingly. - * - * Return: N/A + * unpin of the specified cache entry. * - * Programmer: John Mainzer, 3/22/06 - * - * Modifications: - * - * JRM -- 3/28/07 - * Added sanity checks based on the new is_read_only and - * ro_ref_count fields of struct H5C_cache_entry_t. + * To do this, unlink the specified entry from the pinned + * entry list, and re-insert it in the data structures used + * by the current replacement policy. * *------------------------------------------------------------------------- */ -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - #define H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->is_pinned); \ - HDassert( (entry_ptr)->size > 0 ); \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ + assert(!(entry_ptr)->is_protected); \ + assert(!(entry_ptr)->is_read_only); \ + assert((entry_ptr)->ro_ref_count == 0 ); \ + assert((entry_ptr)->is_pinned); \ + assert((entry_ptr)->size > 0); \ \ /* Regardless of the replacement policy, remove the entry from the \ * pinned entry list. \ */ \ H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ (cache_ptr)->pel_tail_ptr, (cache_ptr)->pel_len, \ - (cache_ptr)->pel_size, (fail_val)) \ - \ - /* modified LRU specific code */ \ - \ - /* insert the entry at the head of the LRU list. */ \ + (cache_ptr)->pel_size, (fail_val)); \ \ + /* Insert the entry at the head of the LRU list. */ \ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ (cache_ptr)->LRU_tail_ptr, \ (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* Similarly, insert the entry at the head of either the clean \ - * or dirty LRU list as appropriate. \ - */ \ - \ - if ( (entry_ptr)->is_dirty ) { \ - \ - H5C__AUX_DLL_PREPEND((entry_ptr), \ - (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, \ - (fail_val)) \ - \ - } else { \ - \ - H5C__AUX_DLL_PREPEND((entry_ptr), \ - (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, \ - (fail_val)) \ - } \ - \ - /* End modified LRU specific code. */ \ - \ -} /* H5C__UPDATE_RP_FOR_UNPIN */ - -#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - -#define H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( !((entry_ptr)->is_protected) ); \ - HDassert( !((entry_ptr)->is_read_only) ); \ - HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ - HDassert( (entry_ptr)->is_pinned); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - /* Regardless of the replacement policy, remove the entry from the \ - * pinned entry list. \ - */ \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pel_head_ptr, \ - (cache_ptr)->pel_tail_ptr, (cache_ptr)->pel_len, \ - (cache_ptr)->pel_size, (fail_val)) \ - \ - /* modified LRU specific code */ \ - \ - /* insert the entry at the head of the LRU list. */ \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ + (cache_ptr)->LRU_list_size, (fail_val)); \ \ - /* End modified LRU specific code. */ \ - \ -} /* H5C__UPDATE_RP_FOR_UNPIN */ - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + /* Maintain the clean & dirty LRU lists, if enabled */ \ + H5C__UPDATE_RP_FOR_UNPIN_CD_LRU(cache_ptr, entry_ptr, fail_val); \ +} while(0) /* H5C__UPDATE_RP_FOR_UNPIN */ /*------------------------------------------------------------------------- * - * Macro: H5C__UPDATE_RP_FOR_UNPROTECT + * Macro: H5C__UPDATE_RP_FOR_UNPROTECT * * Purpose: Update the replacement policy data structures for an - * unprotect of the specified cache entry. - * - * To do this, unlink the specified entry from the protected - * list, and re-insert it in the data structures used by the - * current replacement policy. - * - * At present, we only support the modified LRU policy, so - * this function deals with that case unconditionally. If - * we ever support other replacement policies, the function - * should switch on the current policy and act accordingly. - * - * Return: N/A - * - * Programmer: John Mainzer, 5/19/04 - * - * Modifications: + * unprotect of the specified cache entry. * - * JRM - 7/27/04 - * Converted the function H5C_update_rp_for_unprotect() to - * the macro H5C__UPDATE_RP_FOR_UNPROTECT in an effort to - * squeeze a bit more performance out of the cache. - * - * At least for the first cut, I am leaving the comments and - * white space in the macro. If they cause difficulties with - * pre-processor, I'll have to remove them. - * - * JRM - 7/28/04 - * Split macro into two version, one supporting the clean and - * dirty LRU lists, and the other not. Yet another attempt - * at optimization. - * - * JRM - 3/17/06 - * Modified macro to put pinned entries on the pinned entry - * list instead of inserting them in the data structures - * maintained by the replacement policy. + * To do this, unlink the specified entry from the protected + * list, and re-insert it in the data structures used by the + * current replacement policy. * *------------------------------------------------------------------------- */ -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - -#define H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( (entry_ptr)->is_protected); \ - HDassert( (entry_ptr)->size > 0 ); \ - \ - /* Regardless of the replacement policy, remove the entry from the \ - * protected list. \ - */ \ - H5C__DLL_REMOVE((entry_ptr), (cache_ptr)->pl_head_ptr, \ - (cache_ptr)->pl_tail_ptr, (cache_ptr)->pl_len, \ - (cache_ptr)->pl_size, (fail_val)) \ - \ - if ( (entry_ptr)->is_pinned ) { \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ - (cache_ptr)->pel_tail_ptr, \ - (cache_ptr)->pel_len, \ - (cache_ptr)->pel_size, (fail_val)) \ - \ - } else { \ - \ - /* modified LRU specific code */ \ - \ - /* insert the entry at the head of the LRU list. */ \ - \ - H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ - (cache_ptr)->LRU_tail_ptr, \ - (cache_ptr)->LRU_list_len, \ - (cache_ptr)->LRU_list_size, (fail_val)) \ - \ - /* Similarly, insert the entry at the head of either the clean or \ - * dirty LRU list as appropriate. \ - */ \ - \ - if ( (entry_ptr)->is_dirty ) { \ - \ - H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->dLRU_head_ptr, \ - (cache_ptr)->dLRU_tail_ptr, \ - (cache_ptr)->dLRU_list_len, \ - (cache_ptr)->dLRU_list_size, (fail_val)) \ - \ - } else { \ - \ - H5C__AUX_DLL_PREPEND((entry_ptr), (cache_ptr)->cLRU_head_ptr, \ - (cache_ptr)->cLRU_tail_ptr, \ - (cache_ptr)->cLRU_list_len, \ - (cache_ptr)->cLRU_list_size, (fail_val)) \ - } \ - \ - /* End modified LRU specific code. */ \ - } \ - \ -} /* H5C__UPDATE_RP_FOR_UNPROTECT */ - -#else /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - #define H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - HDassert( (entry_ptr)->is_protected); \ - HDassert( (entry_ptr)->size > 0 ); \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ + assert((entry_ptr)->is_protected); \ + assert((entry_ptr)->size > 0); \ \ /* Regardless of the replacement policy, remove the entry from the \ * protected list. \ @@ -3282,268 +1775,103 @@ if ( ( (cache_ptr)->index_size != \ (cache_ptr)->pl_tail_ptr, (cache_ptr)->pl_len, \ (cache_ptr)->pl_size, (fail_val)) \ \ - if ( (entry_ptr)->is_pinned ) { \ - \ + if((entry_ptr)->is_pinned) { \ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->pel_head_ptr, \ (cache_ptr)->pel_tail_ptr, \ (cache_ptr)->pel_len, \ (cache_ptr)->pel_size, (fail_val)) \ - \ } else { \ - \ - /* modified LRU specific code */ \ - \ - /* insert the entry at the head of the LRU list. */ \ - \ + /* Insert the entry at the head of the LRU list. */ \ H5C__DLL_PREPEND((entry_ptr), (cache_ptr)->LRU_head_ptr, \ (cache_ptr)->LRU_tail_ptr, \ (cache_ptr)->LRU_list_len, \ (cache_ptr)->LRU_list_size, (fail_val)) \ \ - /* End modified LRU specific code. */ \ + /* Maintain the clean & dirty LRU lists, if enabled */ \ + H5C__UPDATE_RP_FOR_UNPROTECT_CD_LRU(cache_ptr, entry_ptr, fail_val); \ } \ -} /* H5C__UPDATE_RP_FOR_UNPROTECT */ +} while (0) /* H5C__UPDATE_RP_FOR_UNPROTECT */ -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ #ifdef H5_HAVE_PARALLEL -#if H5C_DO_SANITY_CHECKS - -#define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ -if ( ( (hd_ptr) == NULL ) || \ - ( (tail_ptr) == NULL ) || \ - ( (entry_ptr) == NULL ) || \ - ( (len) <= 0 ) || \ - ( (Size) < (entry_ptr)->size ) || \ - ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \ - ( ( (entry_ptr)->coll_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \ - ( ( (entry_ptr)->coll_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) ||\ - ( ( (len) == 1 ) && \ - ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \ - ( (entry_ptr)->coll_next == NULL ) && \ - ( (entry_ptr)->coll_prev == NULL ) && \ - ( (Size) == (entry_ptr)->size ) \ - ) \ - ) \ - ) \ - ) { \ - HDassert(0 && "coll DLL pre remove SC failed"); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "coll DLL pre remove SC failed") \ -} - -#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ -if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ - ( (head_ptr) != (tail_ptr) ) \ - ) || \ - ( (len) < 0 ) || \ - ( (Size) < 0 ) || \ - ( ( (len) == 1 ) && \ - ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ - ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ - ) \ - ) || \ - ( ( (len) >= 1 ) && \ - ( ( (head_ptr) == NULL ) || ( (head_ptr)->coll_prev != NULL ) || \ - ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \ - ) \ - ) \ - ) { \ - HDassert(0 && "COLL DLL sanity check failed"); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL sanity check failed")\ -} - -#define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv)\ -if ( ( (entry_ptr) == NULL ) || \ - ( (entry_ptr)->coll_next != NULL ) || \ - ( (entry_ptr)->coll_prev != NULL ) || \ - ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ - ( (hd_ptr) != (tail_ptr) ) \ - ) || \ - ( ( (len) == 1 ) && \ - ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ - ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \ - ) \ - ) || \ - ( ( (len) >= 1 ) && \ - ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->coll_prev != NULL ) || \ - ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \ - ) \ - ) \ - ) { \ - HDassert(0 && "COLL DLL pre insert SC failed"); \ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL pre insert SC failed") \ -} - -#else /* H5C_DO_SANITY_CHECKS */ - -#define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) -#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) -#define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) - -#endif /* H5C_DO_SANITY_CHECKS */ - - -#define H5C__COLL_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ -{ \ - H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ - fail_val) \ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (tail_ptr)->coll_next = (entry_ptr); \ - (entry_ptr)->coll_prev = (tail_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; \ -} /* H5C__COLL_DLL_APPEND() */ - -#define H5C__COLL_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ -{ \ - H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)\ - if ( (head_ptr) == NULL ) \ - { \ - (head_ptr) = (entry_ptr); \ - (tail_ptr) = (entry_ptr); \ - } \ - else \ - { \ - (head_ptr)->coll_prev = (entry_ptr); \ - (entry_ptr)->coll_next = (head_ptr); \ - (head_ptr) = (entry_ptr); \ - } \ - (len)++; \ - (Size) += entry_ptr->size; \ -} /* H5C__COLL_DLL_PREPEND() */ - -#define H5C__COLL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ -{ \ - H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)\ - { \ - if ( (head_ptr) == (entry_ptr) ) \ - { \ - (head_ptr) = (entry_ptr)->coll_next; \ - if ( (head_ptr) != NULL ) \ - (head_ptr)->coll_prev = NULL; \ - } \ - else \ - { \ - (entry_ptr)->coll_prev->coll_next = (entry_ptr)->coll_next; \ - } \ - if ( (tail_ptr) == (entry_ptr) ) \ - { \ - (tail_ptr) = (entry_ptr)->coll_prev; \ - if ( (tail_ptr) != NULL ) \ - (tail_ptr)->coll_next = NULL; \ - } \ - else \ - (entry_ptr)->coll_next->coll_prev = (entry_ptr)->coll_prev; \ - entry_ptr->coll_next = NULL; \ - entry_ptr->coll_prev = NULL; \ - (len)--; \ - (Size) -= entry_ptr->size; \ - } \ -} /* H5C__COLL_DLL_REMOVE() */ +/* Macros that modify the "collective I/O" LRU list */ +#define H5C__COLL_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, list_size, fail_val) \ + H5C__GEN_DLL_PREPEND(entry_ptr, coll_next, coll_prev, head_ptr, tail_ptr, len, list_size, fail_val) +#define H5C__COLL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, list_size, fail_val) \ + H5C__GEN_DLL_REMOVE(entry_ptr, coll_next, coll_prev, head_ptr, tail_ptr, len, list_size, fail_val) /*------------------------------------------------------------------------- * - * Macro: H5C__INSERT_IN_COLL_LIST + * Macro: H5C__INSERT_IN_COLL_LIST * * Purpose: Insert entry into collective entries list * - * Return: N/A - * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ #define H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - \ - /* insert the entry at the head of the list. */ \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ \ + /* Insert the entry at the head of the list. */ \ H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \ (cache_ptr)->coll_tail_ptr, \ (cache_ptr)->coll_list_len, \ - (cache_ptr)->coll_list_size, \ - (fail_val)) \ - \ -} /* H5C__INSERT_IN_COLL_LIST */ + (cache_ptr)->coll_list_size, (fail_val)) \ +} while (0) /* H5C__INSERT_IN_COLL_LIST */ /*------------------------------------------------------------------------- * - * Macro: H5C__REMOVE_FROM_COLL_LIST + * Macro: H5C__REMOVE_FROM_COLL_LIST * * Purpose: Remove entry from collective entries list * - * Return: N/A - * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ #define H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ - \ - /* remove the entry from the list. */ \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ \ + /* Remove the entry from the list. */ \ H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, \ (cache_ptr)->coll_tail_ptr, \ (cache_ptr)->coll_list_len, \ - (cache_ptr)->coll_list_size, \ - (fail_val)) \ - \ -} /* H5C__REMOVE_FROM_COLL_LIST */ + (cache_ptr)->coll_list_size, (fail_val)) \ +} while (0) /* H5C__REMOVE_FROM_COLL_LIST */ /*------------------------------------------------------------------------- * - * Macro: H5C__MOVE_TO_TOP_IN_COLL_LIST + * Macro: H5C__MOVE_TO_TOP_IN_COLL_LIST * * Purpose: Update entry position in collective entries list * - * Return: N/A - * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ #define H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \ -{ \ - HDassert( (cache_ptr) ); \ - HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ - HDassert( (entry_ptr) ); \ +do { \ + assert(cache_ptr); \ + assert(entry_ptr); \ \ /* Remove entry and insert at the head of the list. */ \ H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, \ (cache_ptr)->coll_tail_ptr, \ (cache_ptr)->coll_list_len, \ - (cache_ptr)->coll_list_size, \ - (fail_val)) \ + (cache_ptr)->coll_list_size, (fail_val)) \ \ H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \ (cache_ptr)->coll_tail_ptr, \ (cache_ptr)->coll_list_len, \ - (cache_ptr)->coll_list_size, \ - (fail_val)) \ + (cache_ptr)->coll_list_size, (fail_val)) \ \ -} /* H5C__MOVE_TO_TOP_IN_COLL_LIST */ +} while (0) /* H5C__MOVE_TO_TOP_IN_COLL_LIST */ #endif /* H5_HAVE_PARALLEL */ @@ -3586,7 +1914,7 @@ typedef struct H5C_tag_info_t { hbool_t corked; /* Whether this object is corked */ /* Hash table fields */ - UT_hash_handle hh; /* Hash table handle (must be LAST) */ + UT_hash_handle hh; /* Hash table handle (must be LAST) */ } H5C_tag_info_t; @@ -3594,48 +1922,18 @@ typedef struct H5C_tag_info_t { * * structure H5C_t * - * Catchall structure for all variables specific to an instance of the cache. - * - * While the individual fields of the structure are discussed below, the - * following overview may be helpful. - * - * Entries in the cache are stored in an instance of H5TB_TREE, indexed on - * the entry's disk address. While the H5TB_TREE is less efficient than - * hash table, it keeps the entries in address sorted order. As flushes - * in parallel mode are more efficient if they are issued in increasing - * address order, this is a significant benefit. Also the H5TB_TREE code - * was readily available, which reduced development time. + * Structure for all information specific to an instance of the cache. * * While the cache was designed with multiple replacement policies in mind, * at present only a modified form of LRU is supported. * - * JRM - 4/26/04 - * - * Profiling has indicated that searches in the instance of H5TB_TREE are - * too expensive. To deal with this issue, I have augmented the cache - * with a hash table in which all entries will be stored. Given the - * advantages of flushing entries in increasing address order, the TBBT - * is retained, but only dirty entries are stored in it. At least for - * now, we will leave entries in the TBBT after they are flushed. - * - * Note that index_size and index_len now refer to the total size of - * and number of entries in the hash table. - * - * JRM - 7/19/04 - * - * The TBBT has since been replaced with a skip list. This change - * greatly predates this note. + * The cache has a hash table in which all entries are stored. Given the + * advantages of flushing entries in increasing address order, a skip list + * is used to track dirty entries. * - * JRM - 9/26/05 + * flush_in_progress: Boolean flag indicating whether a flush is in progress. * - * magic: Unsigned 32 bit integer always set to H5C__H5C_T_MAGIC. - * This field is used to validate pointers to instances of - * H5C_t. - * - * flush_in_progress: Boolean flag indicating whether a flush is in - * progress. - * - * log_info: Information used by the MDC logging functionality. + * log_info: Information used by the cache logging functionality. * Described in H5Clog.h. * * aux_ptr: Pointer to void used to allow wrapper code to associate @@ -3644,29 +1942,27 @@ typedef struct H5C_tag_info_t { * * max_type_id: Integer field containing the maximum type id number assigned * to a type of entry in the cache. All type ids from 0 to - * max_type_id inclusive must be defined. The names of the - * types are stored in the type_name_table discussed below, and - * indexed by the ids. + * max_type_id inclusive must be defined. * * class_table_ptr: Pointer to an array of H5C_class_t of length - * max_type_id + 1. Entry classes for the cache. + * max_type_id + 1. Entry classes for the cache. * * max_cache_size: Nominal maximum number of bytes that may be stored in the - * cache. This value should be viewed as a soft limit, as the - * cache can exceed this value under the following circumstances: + * cache. This value should be viewed as a soft limit, as the + * cache can exceed this value under the following circumstances: * - * a) All entries in the cache are protected, and the cache is - * asked to insert a new entry. In this case the new entry - * will be created. If this causes the cache to exceed - * max_cache_size, it will do so. The cache will attempt - * to reduce its size as entries are unprotected. + * a) All entries in the cache are protected, and the cache is + * asked to insert a new entry. In this case the new entry + * will be created. If this causes the cache to exceed + * max_cache_size, it will do so. The cache will attempt + * to reduce its size as entries are unprotected. * - * b) When running in parallel mode, the cache may not be + * b) When running in parallel mode, the cache may not be * permitted to flush a dirty entry in response to a read. * If there are no clean entries available to evict, the * cache will exceed its maximum size. Again the cache - * will attempt to reduce its size to the max_cache_size - * limit on the next cache write. + * will attempt to reduce its size to the max_cache_size + * limit on the next cache write. * * c) When an entry increases in size, the cache may exceed * the max_cache_size limit until the next time the cache @@ -3677,16 +1973,15 @@ typedef struct H5C_tag_info_t { * field is set to true. * * min_clean_size: Nominal minimum number of clean bytes in the cache. - * The cache attempts to maintain this number of bytes of - * clean data so as to avoid case b) above. Again, this is - * a soft limit. + * The cache attempts to maintain this number of bytes of clean + * data so as to avoid case b) above. Again, this is a soft limit. * * close_warning_received: Boolean flag indicating that a file closing * warning has been received. * * - * In addition to the call back functions required for each entry, the - * cache requires the following call back functions for this instance of + * In addition to the callback functions required for each entry's class, + * the cache requires the following callback functions for an instance of * the cache as a whole: * * check_write_permitted: In certain applications, the cache may not @@ -3720,13 +2015,8 @@ typedef struct H5C_tag_info_t { * The cache requires an index to facilitate searching for entries. The * following fields support that index. * - * Addendum: JRM -- 10/14/15 - * - * We sometimes need to visit all entries in the cache. In the past, this - * was done by scanning the hash table. However, this is expensive, and - * we have come to scan the hash table often enough that it has become a - * performance issue. To repair this, I have added code to maintain a - * list of all entries in the index -- call this list the index list. + * We sometimes need to visit all entries in the cache, they are stored in + * an index list. * * The index list is maintained by the same macros that maintain the * index, and must have the same length and size as the index proper. @@ -3735,13 +2025,13 @@ typedef struct H5C_tag_info_t { * the cache. * * index_size: Number of bytes of cache entries currently stored in the - * hash table used to index the cache. + * hash table used to index the cache. * - * This value should not be mistaken for footprint of the - * cache in memory. The average cache entry is small, and - * the cache has a considerable overhead. Multiplying the - * index_size by three should yield a conservative estimate - * of the cache's memory footprint. + * This value should not be mistaken for footprint of the + * cache in memory. The average cache entry is small, and + * the cache has a considerable overhead. Multiplying the + * index_size by three should yield a conservative estimate + * of the cache's memory footprint. * * index_ring_len: Array of integer of length H5C_RING_NTYPES used to * maintain a count of entries in the index by ring. Note @@ -3754,18 +2044,16 @@ typedef struct H5C_tag_info_t { * equal the value stored in index_size above. * * clean_index_size: Number of bytes of clean entries currently stored in - * the hash table. Note that the index_size field (above) + * the hash table. Note that the index_size field (above) * is also the sum of the sizes of all entries in the cache. * Thus we should have the invariant that clean_index_size + * dirty_index_size == index_size. * * WARNING: - * - * The value of the clean_index_size must not be mistaken - * for the current clean size of the cache. Rather, the - * clean size of the cache is the current value of - * clean_index_size plus the amount of empty space (if any) - * in the cache. + * The value of the clean_index_size must not be mistaken for + * the current clean size of the cache. Rather, the clean size + * of the cache is the current value of clean_index_size plus + * the amount of empty space (if any) in the cache. * * clean_index_ring_size: Array of size_t of length H5C_RING_NTYPES used to * maintain the sum of the sizes of all clean entries in the @@ -3773,7 +2061,7 @@ typedef struct H5C_tag_info_t { * must equal the value stored in clean_index_size above. * * dirty_index_size: Number of bytes of dirty entries currently stored in - * the hash table. Note that the index_size field (above) + * the hash table. Note that the index_size field (above) * is also the sum of the sizes of all entries in the cache. * Thus we should have the invariant that clean_index_size + * dirty_index_size == index_size. @@ -3783,11 +2071,11 @@ typedef struct H5C_tag_info_t { * index by ring. Note that the sum of all cells in this array * must equal the value stored in dirty_index_size above. * - * index: Array of pointer to H5C_cache_entry_t of size + * index: Array of pointers to H5C_cache_entry_t of size * H5C__HASH_TABLE_LEN. At present, this value is a power * of two, not the usual prime number. * - * I hope that the variable size of cache elements, the large + * Hopefully the variable size of cache elements, the large * hash table size, and the way in which HDF5 allocates space * will combine to avoid problems with periodicity. If so, we * can use a trivial hash function (a bit-and and a 3 bit left @@ -3798,7 +2086,7 @@ typedef struct H5C_tag_info_t { * changing the H5C__HASH_FCN macro and the deletion of the * H5C__HASH_MASK #define. No other changes should be required. * - * il_len: Number of entries on the index list. + * il_len: Number of entries on the index list. * * This must always be equal to index_len. As such, this * field is redundant. However, the existing linked list @@ -3806,7 +2094,7 @@ typedef struct H5C_tag_info_t { * this field exists primarily to avoid adding complexity to * these macros. * - * il_size: Number of bytes of cache entries currently stored in the + * il_size: Number of bytes of cache entries currently stored in the * index list. * * This must always be equal to index_size. As such, this @@ -3815,30 +2103,29 @@ typedef struct H5C_tag_info_t { * this field exists primarily to avoid adding complexity to * these macros. * - * il_head: Pointer to the head of the doubly linked list of entries in - * the index list. Note that cache entries on this list are + * il_head: Pointer to the head of the doubly linked list of entries in + * the index list. Note that cache entries on this list are * linked by their il_next and il_prev fields. * - * This field is NULL if the index is empty. + * This field is NULL if the index is empty. * - * il_tail: Pointer to the tail of the doubly linked list of entries in - * the index list. Note that cache entries on this list are - * linked by their il_next and il_prev fields. + * il_tail: Pointer to the tail of the doubly linked list of entries in + * the index list. Note that cache entries on this list are + * linked by their il_next and il_prev fields. * - * This field is NULL if the index is empty. + * This field is NULL if the index is empty. * * - * With the addition of the take ownership flag, it is possible that - * an entry may be removed from the cache as the result of the flush of - * a second entry. In general, this causes little trouble, but it is - * possible that the entry removed may be the next entry in the scan of - * a list. In this case, we must be able to detect the fact that the + * It is possible that an entry may be removed from the cache as the result + * of the flush of a second entry. In general, this causes little trouble, + * but it is possible that the entry removed may be the next entry in the + * scan of a list. In this case, we must be able to detect the fact that the * entry has been removed, so that the scan doesn't attempt to proceed with * an entry that is no longer in the cache. * * The following fields are maintained to facilitate this. * - * entries_removed_counter: Counter that is incremented each time an + * entries_removed_counter: Counter that is incremented each time an * entry is removed from the cache by any means (eviction, * expungement, or take ownership at this point in time). * Functions that perform scans on lists may set this field @@ -3846,7 +2133,7 @@ typedef struct H5C_tag_info_t { * Unexpected changes to the counter indicate that an entry * was removed from the cache as a side effect of the flush. * - * last_entry_removed_ptr: Pointer to the instance of H5C_cache_entry_t + * last_entry_removed_ptr: Pointer to the instance of H5C_cache_entry_t * which contained the last entry to be removed from the cache, * or NULL if there either is no such entry, or if a function * performing a scan of a list has set this field to NULL prior @@ -3856,33 +2143,22 @@ typedef struct H5C_tag_info_t { * maintained to allow functions that perform scans of lists * to compare this pointer with their pointers to next, thus * allowing them to avoid unnecessary restarts of scans if the - * pointers don't match, and if entries_removed_counter is - * one. + * pointers don't match, and if entries_removed_counter is one. * * entry_watched_for_removal: Pointer to an instance of H5C_cache_entry_t - * which contains the 'next' entry for an iteration. Removing - * this entry must trigger a rescan of the iteration, so each - * entry removed from the cache is compared against this pointer - * and the pointer is reset to NULL if the watched entry is - * removed. - * (This functions similarly to a "dead man's switch") + * which contains the 'next' entry for an iteration. Removing + * this entry must trigger a rescan of the iteration, so each + * entry removed from the cache is compared against this pointer + * and the pointer is reset to NULL if the watched entry is + * removed. (This functions similarly to a "dead man's switch") * * * When we flush the cache, we need to write entries out in increasing * address order. An instance of a skip list is used to store dirty entries in - * sorted order. Whether it is cheaper to sort the dirty entries as needed, - * or to maintain the list is an open question. At a guess, it depends - * on how frequently the cache is flushed. We will see how it goes. - * - * For now at least, I will not remove dirty entries from the list as they - * are flushed. (this has been changed -- dirty entries are now removed from - * the skip list as they are flushed. JRM - 10/25/05) + * sorted order. * - * Update 4/21/20: - * - * Profiling indicates that the cost of maintaining the skip list is - * significant. As it is only used on flush and close, maintaining it - * only when needed is an obvious optimization. + * The cost of maintaining the skip list is significant. As it is only used + * on flush and close, it is maintained only when needed. * * To do this, we add a flag to control maintenanace of the skip list. * This flag is initially set to FALSE, which disables all operations @@ -3902,76 +2178,64 @@ typedef struct H5C_tag_info_t { * the next flush or close. * * slist_enabled: Boolean flag used to control operation of the skip - * list. If this filed is FALSE, operations on the - * slist are no-ops, and the slist must be empty. If - * it is TRUE, operations on the slist proceed as usual, - * and all dirty entries in the metadata cache must be - * listed in the slist. + * list. If this filed is FALSE, operations on the slist are + * no-ops, and the slist must be empty. If it is TRUE, + * operations on the skip list proceed as usual, and all dirty + * entries in the metadata cache must be listed in the skip list. * * slist_changed: Boolean flag used to indicate whether the contents of - * the slist has changed since the last time this flag was + * the skip list has changed since the last time this flag was * reset. This is used in the cache flush code to detect * conditions in which pre-serialize or serialize callbacks - * have modified the slist -- which obliges us to restart - * the scan of the slist from the beginning. + * have modified the skip list -- which obliges us to restart + * the scan of the skip list from the beginning. * - * slist_len: Number of entries currently in the skip list - * used to maintain a sorted list of dirty entries in the - * cache. + * slist_len: Number of entries currently in the skip list. Used to + * maintain a sorted list of dirty entries in the cache. * - * slist_size: Number of bytes of cache entries currently stored in the - * skip list used to maintain a sorted list of - * dirty entries in the cache. + * slist_size: Number of bytes of cache entries currently stored in the + * skip list used to maintain a sorted list of dirty entries in + * the cache. * * slist_ring_len: Array of integer of length H5C_RING_NTYPES used to - * maintain a count of entries in the slist by ring. Note + * maintain a count of entries in the skip list by ring. Note * that the sum of all the cells in this array must equal * the value stored in slist_len above. * * slist_ring_size: Array of size_t of length H5C_RING_NTYPES used to - * maintain the sum of the sizes of all entries in the - * slist by ring. Note that the sum of all cells in this - * array must equal the value stored in slist_size above. + * maintain the sum of the sizes of all entries in the skip list + * by ring. Note that the sum of all cells in this array must + * equal the value stored in slist_size above. * - * slist_ptr: pointer to the instance of H5SL_t used maintain a sorted - * list of dirty entries in the cache. This sorted list has - * two uses: + * slist_ptr: Pointer to the instance of H5SL_t used maintain a sorted + * list of dirty entries in the cache. This sorted list has + * two uses: * - * a) It allows us to flush dirty entries in increasing address - * order, which results in significant savings. + * a) It allows us to flush dirty entries in increasing address + * order, which results in significant savings. * - * b) It facilitates checking for adjacent dirty entries when - * attempting to evict entries from the cache. While we - * don't use this at present, I hope that this will allow - * some optimizations when I get to it. + * b) It facilitates checking for adjacent dirty entries when + * attempting to evict entries from the cache. * * num_last_entries: The number of entries in the cache that can only be - * flushed after all other entries in the cache have - * been flushed. At this time, this will only ever be - * one entry (the superblock), and the code has been - * protected with HDasserts to enforce this. This restraint - * can certainly be relaxed in the future if the need for - * multiple entries being flushed last arises, though - * explicit tests for that case should be added when said - * HDasserts are removed. - * - * Update: There are now two possible last entries - * (superblock and file driver info message). This - * number will probably increase as we add superblock - * messages. JRM -- 11/18/14 - * - * With the addition of the fractal heap, the cache must now deal with - * the case in which entries may be dirtied, moved, or have their sizes - * changed during a flush. To allow sanity checks in this situation, the - * following two fields have been added. They are only compiled in when - * H5C_DO_SANITY_CHECKS is TRUE. + * flushed after all other entries in the cache have been flushed. + * + * Note: At this time, the this field will only be applied to + * two types of entries: the superblock and the file driver info + * message. The code utilizing these flags is protected with + * asserts to enforce this. + * + * The cache must deal with the case in which entries may be dirtied, moved, + * or have their sizes changed during a flush. To allow sanity checks in this + * situation, the following two fields have been added. They are only + * compiled in when H5C_DO_SANITY_CHECKS is TRUE. * * slist_len_increase: Number of entries that have been added to the - * slist since the last time this field was set to zero. + * skip list since the last time this field was set to zero. * Note that this value can be negative. * * slist_size_increase: Total size of all entries that have been added - * to the slist since the last time this field was set to + * to the skip list since the last time this field was set to * zero. Note that this value can be negative. * * Cache entries belonging to a particular object are "tagged" with that @@ -3979,71 +2243,69 @@ typedef struct H5C_tag_info_t { * * The following fields are maintained to facilitate this. * - * tag_list: A collection to track entries that belong to an object. - * Each H5C_tag_info_t struct on the tag list corresponds to - * a particular object in the file. Tagged entries can be - * flushed or evicted as a group, or corked to prevent entries - * from being evicted from the cache. + * tag_list: A collection to track entries that belong to an object. + * Each H5C_tag_info_t struct on the tag list corresponds to a + * particular object in the file. Tagged entries can be flushed + * or evicted as a group, or corked to prevent entries from being + * evicted from the cache. * - * "Global" entries, like the superblock and the file's - * freelist, as well as shared entries like global - * heaps and shared object header messages, are not tagged. + * "Global" entries, like the superblock and the file's freelist, + * as well as shared entries like global heaps and shared object + * header messages, are not tagged. * - * ignore_tags: Boolean flag to disable tag validation during entry insertion. + * ignore_tags: Boolean flag to disable tag validation during entry insertion. * * num_objs_corked: Unsigned integer field containing the number of objects - * that are "corked". The "corked" status of an object is - * found by searching the "tag_list". This field is added - * for optimization so that the skip list search on "tag_list" - * can be skipped if this field is zero, i.e. no "corked" - * objects. + * that are "corked". The "corked" status of an object is found by + * searching the "tag_list". This field is added for optimization + * so that the skip list search on "tag_list" can be skipped if this + * field is zero, i.e. no "corked" objects. * * When a cache entry is protected, it must be removed from the LRU - * list(s) as it cannot be either flushed or evicted until it is unprotected. + * list(s), as it cannot be either flushed or evicted until it is unprotected. * The following fields are used to implement the protected list (pl). * - * pl_len: Number of entries currently residing on the protected list. + * pl_len: Number of entries currently residing on the protected list. * - * pl_size: Number of bytes of cache entries currently residing on the - * protected list. + * pl_size: Number of bytes of cache entries currently residing on the + * protected list. * * pl_head_ptr: Pointer to the head of the doubly linked list of protected - * entries. Note that cache entries on this list are linked - * by their next and prev fields. + * entries. Note that cache entries on this list are linked + * by their next and prev fields. * - * This field is NULL if the list is empty. + * This field is NULL if the list is empty. * * pl_tail_ptr: Pointer to the tail of the doubly linked list of protected - * entries. Note that cache entries on this list are linked - * by their next and prev fields. + * entries. Note that cache entries on this list are linked + * by their next and prev fields. * - * This field is NULL if the list is empty. + * This field is NULL if the list is empty. * * * For very frequently used entries, the protect/unprotect overhead can - * become burdensome. To avoid this overhead, I have modified the cache - * to allow entries to be "pinned". A pinned entry is similar to a - * protected entry, in the sense that it cannot be evicted, and that - * the entry can be modified at any time. + * become burdensome. To avoid this overhead, the cache allows entries to + * be "pinned". A pinned entry is similar to a protected entry, in the + * sense that it cannot be evicted, and that the entry can be modified at + * any time. * * Pinning an entry has the following implications: * - * 1) A pinned entry cannot be evicted. Thus unprotected - * pinned entries reside in the pinned entry list, instead - * of the LRU list(s) (or other lists maintained by the current - * replacement policy code). + * 1) A pinned entry cannot be evicted. Thus unprotected pinned + * entries reside in the pinned entry list, instead of the LRU + * list(s) or other lists maintained by the current replacement + * policy code. * * 2) A pinned entry can be accessed or modified at any time. * This places an additional burden on the associated pre-serialize - * and serialize callbacks, which must ensure the the entry is in - * a consistent state before creating an image of it. + * and serialize callbacks, which must ensure the entry is in + * a consistent state before creating an image of it. * * 3) A pinned entry can be marked as dirty (and possibly * change size) while it is unprotected. * * 4) The flush-destroy code must allow pinned entries to - * be unpinned (and possibly unprotected) during the - * flush. + * be unpinned (and possibly unprotected) during the flush. * * Since pinned entries cannot be evicted, they must be kept on a pinned * entry list (pel), instead of being entrusted to the replacement policy @@ -4051,51 +2313,36 @@ typedef struct H5C_tag_info_t { * * Maintaining the pinned entry list requires the following fields: * - * pel_len: Number of entries currently residing on the pinned - * entry list. + * pel_len: Number of entries currently residing on the pinned entry list. * - * pel_size: Number of bytes of cache entries currently residing on + * pel_size: Number of bytes of cache entries currently residing on * the pinned entry list. * * pel_head_ptr: Pointer to the head of the doubly linked list of pinned * but not protected entries. Note that cache entries on * this list are linked by their next and prev fields. * - * This field is NULL if the list is empty. + * This field is NULL if the list is empty. * * pel_tail_ptr: Pointer to the tail of the doubly linked list of pinned * but not protected entries. Note that cache entries on * this list are linked by their next and prev fields. * - * This field is NULL if the list is empty. + * This field is NULL if the list is empty. * * * The cache must have a replacement policy, and the fields supporting this * policy must be accessible from this structure. * - * While there has been interest in several replacement policies for - * this cache, the initial development schedule is tight. Thus I have - * elected to support only a modified LRU (least recently used) policy - * for the first cut. - * - * To further simplify matters, I have simply included the fields needed - * by the modified LRU in this structure. When and if we add support for - * other policies, it will probably be easiest to just add the necessary - * fields to this structure as well -- we only create one instance of this - * structure per file, so the overhead is not excessive. - * - * * Fields supporting the modified LRU policy: * - * See most any OS text for a discussion of the LRU replacement policy. - * * When operating in parallel mode, we must ensure that a read does not * cause a write. If it does, the process will hang, as the write will * be collective and the other processes will not know to participate. * - * To deal with this issue, I have modified the usual LRU policy by adding + * To deal with this issue, the usual LRU policy has been modified by adding * clean and dirty LRU lists to the usual LRU list. In general, these - * lists are only exist in parallel builds. + * lists only exist in parallel builds. * * The clean LRU list is simply the regular LRU list with all dirty cache * entries removed. @@ -4105,10 +2352,9 @@ typedef struct H5C_tag_info_t { * * When reading in parallel mode, we evict from the clean LRU list only. * This implies that we must try to ensure that the clean LRU list is - * reasonably well stocked at all times. - * - * We attempt to do this by trying to flush enough entries on each write - * to keep the cLRU_list_size >= min_clean_size. + * reasonably well stocked at all times. We attempt to do this by trying + * to flush enough entries on each write to keep the cLRU_list_size >= + * min_clean_size. * * Even if we start with a completely clean cache, a sequence of protects * without unprotects can empty the clean LRU list. In this case, the @@ -4122,14 +2368,14 @@ typedef struct H5C_tag_info_t { * * LRU_list_len: Number of cache entries currently on the LRU list. * - * Observe that LRU_list_len + pl_len + pel_len must always - * equal index_len. + * The LRU_list_len + pl_len + pel_len must always + * equal index_len. * * LRU_list_size: Number of bytes of cache entries currently residing on the * LRU list. * - * Observe that LRU_list_size + pl_size + pel_size must always - * equal index_size. + * The LRU_list_size + pl_size + pel_size must always + * equal index_size. * * LRU_head_ptr: Pointer to the head of the doubly linked LRU list. Cache * entries on this list are linked by their next and prev fields. @@ -4143,13 +2389,13 @@ typedef struct H5C_tag_info_t { * * cLRU_list_len: Number of cache entries currently on the clean LRU list. * - * Observe that cLRU_list_len + dLRU_list_len must always + * The cLRU_list_len + dLRU_list_len must always * equal LRU_list_len. * * cLRU_list_size: Number of bytes of cache entries currently residing on * the clean LRU list. * - * Observe that cLRU_list_size + dLRU_list_size must always + * The cLRU_list_size + dLRU_list_size must always * equal LRU_list_size. * * cLRU_head_ptr: Pointer to the head of the doubly linked clean LRU list. @@ -4166,12 +2412,12 @@ typedef struct H5C_tag_info_t { * * dLRU_list_len: Number of cache entries currently on the dirty LRU list. * - * Observe that cLRU_list_len + dLRU_list_len must always + * The cLRU_list_len + dLRU_list_len must always * equal LRU_list_len. * * dLRU_list_size: Number of cache entries currently on the dirty LRU list. * - * Observe that cLRU_list_len + dLRU_list_len must always + * The cLRU_list_len + dLRU_list_len must always * equal LRU_list_len. * * dLRU_head_ptr: Pointer to the head of the doubly linked dirty LRU list. @@ -4189,46 +2435,41 @@ typedef struct H5C_tag_info_t { * * Automatic cache size adjustment: * - * While the default cache size is adequate for most cases, we can run into - * cases where the default is too small. Ideally, we will let the user + * While the default cache size is adequate for many cases, there are + * cases where the default is too small. Ideally, the user should * adjust the cache size as required. However, this is not possible in all - * cases. Thus I have added automatic cache size adjustment code. + * cases, so the cache has automatic cache size adjustment code. * * The configuration for the automatic cache size adjustment is stored in * the structure described below: * * size_increase_possible: Depending on the configuration data given - * in the resize_ctl field, it may or may not be possible - * to increase the size of the cache. Rather than test for - * all the ways this can happen, we simply set this flag when - * we receive a new configuration. + * in the resize_ctl field, it may or may not be possible to + * increase the size of the cache. Rather than test for all the + * ways this can happen, we simply set this flag when we receive + * a new configuration. * * flash_size_increase_possible: Depending on the configuration data given - * in the resize_ctl field, it may or may not be possible - * for a flash size increase to occur. We set this flag - * whenever we receive a new configuration so as to avoid - * repeated calculations. + * in the resize_ctl field, it may or may not be possible for a + * flash size increase to occur. We set this flag whenever we + * receive a new configuration so as to avoid repeated calculations. * * flash_size_increase_threshold: If a flash cache size increase is possible, - * this field is used to store the minimum size of a new entry - * or size increase needed to trigger a flash cache size - * increase. Note that this field must be updated whenever - * the size of the cache is changed. + * this field is used to store the minimum size of a new entry or size + * increase needed to trigger a flash cache size increase. Note that + * this field must be updated whenever the size of the cache is changed. * - * size_decrease_possible: Depending on the configuration data given - * in the resize_ctl field, it may or may not be possible - * to decrease the size of the cache. Rather than test for - * all the ways this can happen, we simply set this flag when - * we receive a new configuration. + * size_decrease_possible: Depending on the configuration data given in the + * resize_ctl field, it may or may not be possible to decrease the + * size of the cache. Rather than test for all the ways this can + * happen, we simply set this flag when we receive a new configuration. * * resize_enabled: This is another convenience flag which is set whenever - * a new set of values for resize_ctl are provided. Very - * simply, + * a new set of values for resize_ctl are provided. Very simply: * - * resize_enabled = size_increase_possible || - * size_decrease_possible; + * resize_enabled = size_increase_possible || size_decrease_possible; * - * cache_full: Boolean flag used to keep track of whether the cache is + * cache_full: Boolean flag used to keep track of whether the cache is * full, so we can refrain from increasing the size of a * cache which hasn't used up the space allotted to it. * @@ -4249,29 +2490,17 @@ typedef struct H5C_tag_info_t { * and to prevent the infinite recursion that would otherwise * occur. * - * Note that this issue is not hypothetical -- this field - * was added 12/29/15 to fix a bug exposed in the testing - * of changes to the file driver info superblock extension - * management code needed to support rings. - * * msic_in_progress: As the metadata cache has become re-entrant, and as - * the free space manager code has become more tightly - * integrated with the metadata cache, it is possible that - * a call to H5C_insert_entry() may trigger a call to - * H5C_make_space_in_cache(), which, via H5C__flush_single_entry() - * and client callbacks, may trigger an infinite regression - * of calls to H5C_make_space_in_cache(). - * - * The msic_in_progress boolean flag is used to detect this, - * and prevent the infinite regression that would otherwise - * occur. - * - * Note that this is issue is not hypothetical -- this field - * was added 2/16/17 to address this issue when it was - * exposed by modifications to test/fheap.c to cause it to - * use paged allocation. - * - * resize_ctl: Instance of H5C_auto_size_ctl_t containing configuration + * the free space manager code has become more tightly integrated + * with the metadata cache, it is possible that a call to + * H5C_insert_entry() may trigger a call to H5C_make_space_in_cache(), + * which, via H5C__flush_single_entry() and client callbacks, may + * trigger an infinite regression of calls to H5C_make_space_in_cache(). + * + * The msic_in_progress boolean flag is used to detect this, + * and prevent the infinite regression that would otherwise occur. + * + * resize_ctl: Instance of H5C_auto_size_ctl_t containing configuration * data for automatic cache resizing. * * epoch_markers_active: Integer field containing the number of epoch @@ -4304,27 +2533,24 @@ typedef struct H5C_tag_info_t { * in the ring buffer. * * epoch_markers: Array of instances of H5C_cache_entry_t of length - * H5C__MAX_EPOCH_MARKERS. The entries are used as markers - * in the LRU list to identify cache entries that haven't - * been accessed for some (small) specified number of - * epochs. These entries (if any) can then be evicted and - * the cache size reduced -- ideally without evicting any - * of the current working set. Needless to say, the epoch - * length and the number of epochs before an unused entry - * must be chosen so that all, or almost all, the working - * set will be accessed before the limit. - * - * Epoch markers only appear in the LRU list, never in - * the index or slist. While they are of type - * H5C__EPOCH_MARKER_TYPE, and have associated class - * functions, these functions should never be called. - * - * The addr fields of these instances of H5C_cache_entry_t - * are set to the index of the instance in the epoch_markers - * array, the size is set to 0, and the type field points - * to the constant structure epoch_marker_class defined - * in H5C.c. The next and prev fields are used as usual - * to link the entry into the LRU list. + * H5C__MAX_EPOCH_MARKERS. The entries are used as markers in the + * LRU list to identify cache entries that haven't been accessed for + * some (small) specified number of epochs. These entries (if any) + * can then be evicted and the cache size reduced -- ideally without + * evicting any of the current working set. Needless to say, the epoch + * length and the number of epochs before an unused entry must be + * chosen so that all, or almost all, the working set will be accessed + * before the limit. + * + * Epoch markers only appear in the LRU list, never in the index or + * skip list. While they are of type H5C__EPOCH_MARKER_TYPE, and have + * associated class functions, these functions should never be called. + * + * The addr fields of these instances of H5C_cache_entry_t are set to + * the index of the instance in the epoch_markers array, the size is + * set to 0, and the type field points to the constant structure + * epoch_marker_class defined in H5Cepoch.c. The next and prev fields + * are used as usual to link the entry into the LRU list. * * All other fields are unused. * @@ -4335,36 +2561,33 @@ typedef struct H5C_tag_info_t { * simple cache hit rate computation regardless of whether statistics * collection is enabled. The following fields support this capability. * - * cache_hits: Number of cache hits since the last time the cache hit - * rate statistics were reset. Note that when automatic cache - * re-sizing is enabled, this field will be reset every automatic - * resize epoch. + * cache_hits: Number of cache hits since the last time the cache hit rate + * statistics were reset. Note that when automatic cache re-sizing + * is enabled, this field will be reset every automatic resize epoch. * * cache_accesses: Number of times the cache has been accessed while - * since the last since the last time the cache hit rate statistics - * were reset. Note that when automatic cache re-sizing is enabled, - * this field will be reset every automatic resize epoch. + * since the last since the last time the cache hit rate statistics + * were reset. Note that when automatic cache re-sizing is enabled, + * this field will be reset every automatic resize epoch. * * * Metadata cache image management related fields. * - * image_ctl: Instance of H5C_cache_image_ctl_t containing configuration - * data for generation of a cache image on file close. + * image_ctl: Instance of H5C_cache_image_ctl_t containing configuration + * data for generation of a cache image on file close. * - * serialization_in_progress: Boolean field that is set to TRUE iff - * the cache is in the process of being serialized. This - * field is needed to support the H5C_serialization_in_progress() - * call, which is in turn required for sanity checks in some - * cache clients. + * serialization_in_progress: Boolean field that is set to TRUE iff + * the cache is in the process of being serialized. This field is + * needed to support the H5C_serialization_in_progress() call, which + * is in turn required for sanity checks in some cache clients. * - * load_image: Boolean flag indicating that the metadata cache image - * superblock extension message exists and should be - * read, and the image block read and decoded on the next - * call to H5C_protect(). + * load_image: Boolean flag indicating that the metadata cache image + * superblock extension message exists and should be read, and the + * image block read and decoded on the next call to H5C_protect(). * - * image_loaded: Boolean flag indicating that the metadata cache has - * loaded the metadata cache image as directed by the - * MDC cache image superblock extension message. + * image_loaded: Boolean flag indicating that the metadata cache has + * loaded the metadata cache image as directed by the + * cache image superblock extension message. * * delete_image: Boolean flag indicating whether the metadata cache image * superblock message should be deleted and the cache image @@ -4373,20 +2596,18 @@ typedef struct H5C_tag_info_t { * This flag should be set to TRUE iff the file is opened * R/W and there is a cache image to be read. * - * image_addr: haddr_t containing the base address of the on disk - * metadata cache image, or HADDR_UNDEF if that value is - * undefined. Note that this field is used both in the - * construction and write, and the read and decode of - * metadata cache image blocks. + * image_addr: The base address of the on-disk metadata cache image, or + * HADDR_UNDEF if that value is undefined. Note that this field + * is used both in the construction and write, and the read and + * decode of metadata cache image blocks. * - * image_len: hsize_t containing the size of the on disk metadata cache - * image, or zero if that value is undefined. Note that this - * field is used both in the construction and write, and the - * read and decode of metadata cache image blocks. + * image_len: The size of the on disk metadata cache image, or zero if that + * value is undefined. Note that this field is used both in the + * construction and write, and the read and decode of metadata cache + * image blocks. * - * image_data_len: size_t containing the number of bytes of data in the - * on disk metadata cache image, or zero if that value is - * undefined. + * image_data_len: The number of bytes of data in the on disk metadata + * cache image, or zero if that value is undefined. * * In most cases, this value is the same as the image_len * above. It exists to allow for metadata cache image blocks @@ -4399,7 +2620,7 @@ typedef struct H5C_tag_info_t { * order, we scan the index repeatedly, once for each flush dependency * height in increasing order. * - * This operation is complicated by the fact that entries other the the + * This operation is complicated by the fact that entries other than the * target may be inserted, loaded, relocated, or removed from the cache * (either by eviction or the take ownership flag) as the result of a * pre_serialize or serialize callback. While entry removals are not @@ -4432,11 +2653,11 @@ typedef struct H5C_tag_info_t { * The following fields are used assemble the cache image prior to * writing it to disk. * - * num_entries_in_image: Unsigned integer field containing the number of entries - * to be copied into the metadata cache image. Note that - * this value will be less than the number of entries in - * the cache, and the superblock and its related entries - * are not written to the metadata cache image. + * num_entries_in_image: Unsigned integer field containing the number of + * entries to be copied into the metadata cache image. Note that + * this value will be less than the number of entries in the cache, + * and the superblock and its related entries are not written to the + * metadata cache image. * * image_entries: Pointer to a dynamically allocated array of instance of * H5C_image_entry_t of length num_entries_in_image, or NULL @@ -4446,19 +2667,19 @@ typedef struct H5C_tag_info_t { * * image_buffer: Pointer to the dynamically allocated buffer of length * image_len in which the metadata cache image is assembled, - * or NULL if that buffer does not exist. + * or NULL if that buffer does not exist. * * * Free Space Manager Related fields: * - * The free space managers must be informed when we are about to close - * or flush the file so that they order themselves accordingly. This used - * to be done much later in the close process, but with cache image and + * The free space managers for the file must be informed when we are about to + * close or flush the file so that they order themselves accordingly. This + * used to be done much later in the close process, but with cache image and * page buffering, this is no longer viable, as we must finalize the on * disk image of all metadata much sooner. * * This is handled by the H5MF_settle_raw_data_fsm() and - * H5MF_settle_meta_data_FSM() routines. As these calls are expensive, + * H5MF_settle_meta_data_fsm() routines. As these calls are expensive, * the following fields are used to track whether the target free space * managers are clean. * @@ -4477,11 +2698,11 @@ typedef struct H5C_tag_info_t { * free space manager metadata. * * mdfsm_settled: Boolean flag indicating whether the meta data free space - * manager is settled -- i.e. whether the correct space has - * been allocated for it in the file. + * manager is settled -- i.e. whether the correct space has + * been allocated for it in the file. * - * Note that the name of this field is deceptive. In the - * multi file case, the flag applies only to free space + * Note that the name of this field is deceptive. In the + * multi-file case, the flag applies only to free space * managers that are involved in allocating space for free * space managers. * @@ -4492,151 +2713,122 @@ typedef struct H5C_tag_info_t { * below. The first set are collected only when H5C_COLLECT_CACHE_STATS * is true. * - * hits: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type id + * hits: Array to record the number of times an entry with type id * equal to the array index has been in cache when requested in * the current epoch. * - * misses: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type id + * misses: Array to record the number of times an entry with type id * equal to the array index has not been in cache when * requested in the current epoch. * - * write_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The - * cells are used to record the number of times an entry with + * write_protects: Array to record the number of times an entry with * type id equal to the array index has been write protected * in the current epoch. * * Observe that (hits + misses) = (write_protects + read_protects). * - * read_protects: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The - * cells are used to record the number of times an entry with + * read_protects: Array to record the number of times an entry with * type id equal to the array index has been read protected in * the current epoch. * - * Observe that (hits + misses) = (write_protects + read_protects). + * Observe that (hits + misses) = (write_protects + read_protects). * - * max_read_protects: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1. - * The cells are used to maximum number of simultaneous read + * max_read_protects: Array to maximum number of simultaneous read * protects on any entry with type id equal to the array index * in the current epoch. * - * insertions: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type + * insertions: Array to record the number of times an entry with type * id equal to the array index has been inserted into the * cache in the current epoch. * - * pinned_insertions: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. - * The cells are used to record the number of times an entry + * pinned_insertions: Array to record the number of times an entry * with type id equal to the array index has been inserted * pinned into the cache in the current epoch. * - * clears: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times a dirty entry with type - * id equal to the array index has been cleared in the current - * epoch. + * clears: Array to record the number of times a dirty entry with type + * id equal to the array index has been cleared in the current epoch. * - * flushes: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type id + * flushes: Array to record the number of times an entry with type id * equal to the array index has been written to disk in the - * current epoch. + * current epoch. * - * evictions: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type id + * evictions: Array to record the number of times an entry with type id * equal to the array index has been evicted from the cache in * the current epoch. * - * take_ownerships: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The - * cells are used to record the number of times an entry with + * take_ownerships: Array to record the number of times an entry with * type id equal to the array index has been removed from the * cache via the H5C__TAKE_OWNERSHIP_FLAG in the current epoch. * - * moves: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type - * id equal to the array index has been moved in the current - * epoch. + * moves: Array to record the number of times an entry with type + * id equal to the array index has been moved in the current epoch. * - * entry_flush_moves: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. - * The cells are used to record the number of times an entry + * entry_flush_moves: Array to record the number of times an entry * with type id equal to the array index has been moved * during its pre-serialize callback in the current epoch. * - * cache_flush_moves: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. - * The cells are used to record the number of times an entry + * cache_flush_moves: Array to record the number of times an entry * with type id equal to the array index has been moved * during a cache flush in the current epoch. * - * pins: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type - * id equal to the array index has been pinned in the current - * epoch. + * pins: Array to record the number of times an entry with type + * id equal to the array index has been pinned in the current epoch. * - * unpins: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type - * id equal to the array index has been unpinned in the current - * epoch. + * unpins: Array to record the number of times an entry with type + * id equal to the array index has been unpinned in the current epoch. * - * dirty_pins: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the number of times an entry with type + * dirty_pins: Array to record the number of times an entry with type * id equal to the array index has been marked dirty while pinned * in the current epoch. * - * pinned_flushes: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The - * cells are used to record the number of times an entry + * pinned_flushes: Array to record the number of times an entry * with type id equal to the array index has been flushed while * pinned in the current epoch. * - * pinned_clears: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. The - * cells are used to record the number of times an entry + * pinned_clears: Array to record the number of times an entry * with type id equal to the array index has been cleared while * pinned in the current epoch. * - * size_increases: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. - * The cells are used to record the number of times an entry + * size_increases: Array to record the number of times an entry * with type id equal to the array index has increased in * size in the current epoch. * - * size_decreases: Array of int64 of length H5C__MAX_NUM_TYPE_IDS + 1. - * The cells are used to record the number of times an entry + * size_decreases: Array to record the number of times an entry * with type id equal to the array index has decreased in * size in the current epoch. * - * entry_flush_size_changes: Array of int64 of length - * H5C__MAX_NUM_TYPE_IDS + 1. The cells are used to record - * the number of times an entry with type id equal to the - * array index has changed size while in its pre-serialize - * callback. + * entry_flush_size_changes: Array to record the number of times an entry + * with type id equal to the array index has changed size while in + * its pre-serialize callback. * - * cache_flush_size_changes: Array of int64 of length - * H5C__MAX_NUM_TYPE_IDS + 1. The cells are used to record - * the number of times an entry with type id equal to the - * array index has changed size during a cache flush + * cache_flush_size_changes: Array to record the number of times an entry + * with type id equal to the array index has changed size during a + * cache flush * * total_ht_insertions: Number of times entries have been inserted into the * hash table in the current epoch. * * total_ht_deletions: Number of times entries have been deleted from the - * hash table in the current epoch. - * - * successful_ht_searches: int64 containing the total number of successful - * searches of the hash table in the current epoch. + * hash table in the current epoch. * - * total_successful_ht_search_depth: int64 containing the total number of - * entries other than the targets examined in successful - * searches of the hash table in the current epoch. + * successful_ht_searches: The total number of successful searches of the + * hash table in the current epoch. * - * failed_ht_searches: int64 containing the total number of unsuccessful - * searches of the hash table in the current epoch. + * total_successful_ht_search_depth: The total number of entries other than + * the targets examined in successful searches of the hash table in + * the current epoch. * - * total_failed_ht_search_depth: int64 containing the total number of - * entries examined in unsuccessful searches of the hash + * failed_ht_searches: The total number of unsuccessful searches of the hash * table in the current epoch. * - * max_index_len: Largest value attained by the index_len field in the - * current epoch. + * total_failed_ht_search_depth: The total number of entries examined in + * unsuccessful searches of the hash table in the current epoch. + * + * max_index_len: Largest value attained by the index_len field in the + * current epoch. * - * max_index_size: Largest value attained by the index_size field in the - * current epoch. + * max_index_size: Largest value attained by the index_size field in the + * current epoch. * * max_clean_index_size: Largest value attained by the clean_index_size field * in the current epoch. @@ -4644,75 +2836,73 @@ typedef struct H5C_tag_info_t { * max_dirty_index_size: Largest value attained by the dirty_index_size field * in the current epoch. * - * max_slist_len: Largest value attained by the slist_len field in the - * current epoch. + * max_slist_len: Largest value attained by the slist_len field in the + * current epoch. * - * max_slist_size: Largest value attained by the slist_size field in the - * current epoch. + * max_slist_size: Largest value attained by the slist_size field in the + * current epoch. * * max_pl_len: Largest value attained by the pl_len field in the - * current epoch. + * current epoch. * * max_pl_size: Largest value attained by the pl_size field in the - * current epoch. + * current epoch. * * max_pel_len: Largest value attained by the pel_len field in the - * current epoch. + * current epoch. * * max_pel_size: Largest value attained by the pel_size field in the - * current epoch. + * current epoch. * * calls_to_msic: Total number of calls to H5C__make_space_in_cache * * total_entries_skipped_in_msic: Number of clean entries skipped while - * enforcing the min_clean_fraction in H5C__make_space_in_cache(). + * enforcing the min_clean_fraction in H5C__make_space_in_cache(). * * total_dirty_pf_entries_skipped_in_msic: Number of dirty prefetched entries - * skipped in H5C__make_space_in_cache(). Note that this can - * only occur when a file is opened R/O with a cache image - * containing dirty entries. + * skipped in H5C__make_space_in_cache(). Note that this can + * only occur when a file is opened R/O with a cache image + * containing dirty entries. * * total_entries_scanned_in_msic: Number of clean entries skipped while - * enforcing the min_clean_fraction in H5C__make_space_in_cache(). + * enforcing the min_clean_fraction in H5C__make_space_in_cache(). * * max_entries_skipped_in_msic: Maximum number of clean entries skipped - * in any one call to H5C__make_space_in_cache(). + * in any one call to H5C__make_space_in_cache(). * * max_dirty_pf_entries_skipped_in_msic: Maximum number of dirty prefetched - * entries skipped in any one call to H5C__make_space_in_cache(). - * Note that this can only occur when the file is opened - * R/O with a cache image containing dirty entries. + * entries skipped in any one call to H5C__make_space_in_cache(). + * Note that this can only occur when the file is opened + * R/O with a cache image containing dirty entries. * * max_entries_scanned_in_msic: Maximum number of entries scanned over - * in any one call to H5C__make_space_in_cache(). + * in any one call to H5C__make_space_in_cache(). * * entries_scanned_to_make_space: Number of entries scanned only when looking - * for entries to evict in order to make space in cache. + * for entries to evict in order to make space in cache. * * * The following fields track statistics on cache images. * - * images_created: Integer field containing the number of cache images - * created since the last time statistics were reset. + * images_created: The number of cache images created since the last + * time statistics were reset. * * At present, this field must always be either 0 or 1. * Further, since cache images are only created at file * close, this field should only be set at that time. * - * images_read: Integer field containing the number of cache images - * read from file. Note that reading an image is different - * from loading it -- reading the image means just that, - * while loading the image refers to decoding it and loading - * it into the metadata cache. + * images_read: The number of cache images read from file. Note that + * reading an image is different from loading it -- reading the + * image means just that, while loading the image refers to decoding + * it and loading it into the metadata cache. * - * In the serial case, image_read should always equal - * images_loaded. However, in the parallel case, the - * image should only be read by process 0. All other - * processes should receive the cache image via a broadcast - * from process 0. + * In the serial case, image_read should always equal images_loaded. + * However, in the parallel case, the image should only be read by + * process 0. All other processes should receive the cache image via + * a broadcast from process 0. * - * images_loaded: Integer field containing the number of cache images - * loaded since the last time statistics were reset. + * images_loaded: The number of cache images loaded since the last time + * statistics were reset. * * At present, this field must always be either 0 or 1. * Further, since cache images are only loaded at the @@ -4720,47 +2910,44 @@ typedef struct H5C_tag_info_t { * should only change on those events. * * last_image_size: Size of the most recently loaded metadata cache image - * loaded into the cache, or zero if no image has been - * loaded. + * loaded into the cache, or zero if no image has been loaded. * - * At present, at most one cache image can be loaded into - * the metadata cache for any given file, and this image - * will be loaded either on the first protect, or on file - * close if no entry is protected before then. + * At present, at most one cache image can be loaded into + * the metadata cache for any given file, and this image + * will be loaded either on the first protect, or on file + * close if no entry is protected before then. * * * Fields for tracking prefetched entries. Note that flushes and evictions * of prefetched entries are tracked in the flushes and evictions arrays * discussed above. * - * prefetches: Number of prefetched entries that are loaded to the - * cache. + * prefetches: Number of prefetched entries that are loaded to the cache. * - * dirty_prefetches: Number of dirty prefetched entries that are loaded + * dirty_prefetches: Number of dirty prefetched entries that are loaded * into the cache. * - * prefetch_hits: Number of prefetched entries that are actually used. + * prefetch_hits: Number of prefetched entries that are actually used. * * - * As entries are now capable of moving, loading, dirtying, and deleting - * other entries in their pre_serialize and serialize callbacks, it has - * been necessary to insert code to restart scans of lists so as to avoid - * improper behavior if the next entry in the list is the target of one on - * these operations. + * Entries may move, load, dirty, and delete other entries in their + * pre_serialize and serialize callbacks, there is code to restart scans of + * lists so as to avoid improper behavior if the next entry in the list is + * the target of one on these operations. * * The following fields are use to count such occurrences. They are used * both in tests (to verify that the scan has been restarted), and to * obtain estimates of how frequently these restarts occur. * - * slist_scan_restarts: Number of times a scan of the slist (that contains + * slist_scan_restarts: Number of times a scan of the skip list (that contains * calls to H5C__flush_single_entry()) has been restarted to * avoid potential issues with change of status of the next * entry in the scan. * * LRU_scan_restarts: Number of times a scan of the LRU list (that contains - * calls to H5C__flush_single_entry()) has been restarted to - * avoid potential issues with change of status of the next - * entry in the scan. + * calls to H5C__flush_single_entry()) has been restarted to + * avoid potential issues with change of status of the next + * entry in the scan. * * index_scan_restarts: Number of times a scan of the index has been * restarted to avoid potential issues with load, insertion @@ -4774,284 +2961,275 @@ typedef struct H5C_tag_info_t { * The remaining stats are collected only when both H5C_COLLECT_CACHE_STATS * and H5C_COLLECT_CACHE_ENTRY_STATS are true. * - * max_accesses: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the maximum number of times any single + * max_accesses: Array to record the maximum number of times any single * entry with type id equal to the array index has been * accessed in the current epoch. * - * min_accesses: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the minimum number of times any single + * min_accesses: Array to record the minimum number of times any single * entry with type id equal to the array index has been * accessed in the current epoch. * - * max_clears: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the maximum number of times any single + * max_clears: Array to record the maximum number of times any single * entry with type id equal to the array index has been cleared * in the current epoch. * - * max_flushes: Array of int32 of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the maximum number of times any single + * max_flushes: Array to record the maximum number of times any single * entry with type id equal to the array index has been * flushed in the current epoch. * - * max_size: Array of size_t of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the maximum size of any single entry + * max_size: Array to record the maximum size of any single entry * with type id equal to the array index that has resided in * the cache in the current epoch. * - * max_pins: Array of size_t of length H5C__MAX_NUM_TYPE_IDS + 1. The cells - * are used to record the maximum number of times that any single - * entry with type id equal to the array index that has been - * marked as pinned in the cache in the current epoch. + * max_pins: Array to record the maximum number of times that any single + * entry with type id equal to the array index that has been + * marked as pinned in the cache in the current epoch. * * * Fields supporting testing: * - * prefix Array of char used to prefix debugging output. The - * field is intended to allow marking of output of with - * the processes mpi rank. + * prefix: Array of char used to prefix debugging output. The field is + * intended to allow marking of output of with the processes mpi rank. * * get_entry_ptr_from_addr_counter: Counter used to track the number of - * times the H5C_get_entry_ptr_from_addr() function has been - * called successfully. This field is only defined when - * NDEBUG is not #defined. + * times the H5C_get_entry_ptr_from_addr() function has been + * called successfully. This field is only defined when + * NDEBUG is not #defined. * ****************************************************************************/ - struct H5C_t { - uint32_t magic; - hbool_t flush_in_progress; - H5C_log_info_t *log_info; - void * aux_ptr; - int32_t max_type_id; - const H5C_class_t * const *class_table_ptr; - size_t max_cache_size; - size_t min_clean_size; - H5C_write_permitted_func_t check_write_permitted; - hbool_t write_permitted; - H5C_log_flush_func_t log_flush; - hbool_t evictions_enabled; - hbool_t close_warning_received; + hbool_t flush_in_progress; + H5C_log_info_t * log_info; + void * aux_ptr; + int32_t max_type_id; + const H5C_class_t * const *class_table_ptr; + size_t max_cache_size; + size_t min_clean_size; + H5C_write_permitted_func_t check_write_permitted; + hbool_t write_permitted; + H5C_log_flush_func_t log_flush; + hbool_t evictions_enabled; + hbool_t close_warning_received; /* Fields for maintaining the [hash table] index of entries */ - uint32_t index_len; - size_t index_size; + uint32_t index_len; + size_t index_size; uint32_t index_ring_len[H5C_RING_NTYPES]; - size_t index_ring_size[H5C_RING_NTYPES]; - size_t clean_index_size; - size_t clean_index_ring_size[H5C_RING_NTYPES]; - size_t dirty_index_size; - size_t dirty_index_ring_size[H5C_RING_NTYPES]; - H5C_cache_entry_t * index[H5C__HASH_TABLE_LEN]; - uint32_t il_len; - size_t il_size; - H5C_cache_entry_t * il_head; - H5C_cache_entry_t * il_tail; + size_t index_ring_size[H5C_RING_NTYPES]; + size_t clean_index_size; + size_t clean_index_ring_size[H5C_RING_NTYPES]; + size_t dirty_index_size; + size_t dirty_index_ring_size[H5C_RING_NTYPES]; + H5C_cache_entry_t * index[H5C__HASH_TABLE_LEN]; + uint32_t il_len; + size_t il_size; + H5C_cache_entry_t * il_head; + H5C_cache_entry_t * il_tail; /* Fields to detect entries removed during scans */ - int64_t entries_removed_counter; - H5C_cache_entry_t * last_entry_removed_ptr; - H5C_cache_entry_t * entry_watched_for_removal; + int64_t entries_removed_counter; + H5C_cache_entry_t * last_entry_removed_ptr; + H5C_cache_entry_t * entry_watched_for_removal; /* Fields for maintaining list of in-order entries, for flushing */ - hbool_t slist_enabled; - hbool_t slist_changed; - uint32_t slist_len; - size_t slist_size; + hbool_t slist_enabled; + hbool_t slist_changed; + uint32_t slist_len; + size_t slist_size; uint32_t slist_ring_len[H5C_RING_NTYPES]; - size_t slist_ring_size[H5C_RING_NTYPES]; - H5SL_t * slist_ptr; - uint32_t num_last_entries; -#if H5C_DO_SANITY_CHECKS - int32_t slist_len_increase; - int64_t slist_size_increase; + size_t slist_ring_size[H5C_RING_NTYPES]; + H5SL_t * slist_ptr; + uint32_t num_last_entries; +#ifdef H5C_DO_SANITY_CHECKS + int32_t slist_len_increase; + int64_t slist_size_increase; #endif /* H5C_DO_SANITY_CHECKS */ /* Fields for maintaining list of tagged entries */ - H5C_tag_info_t * tag_list; - hbool_t ignore_tags; - uint32_t num_objs_corked; + H5C_tag_info_t * tag_list; + hbool_t ignore_tags; + uint32_t num_objs_corked; /* Fields for tracking protected entries */ - uint32_t pl_len; - size_t pl_size; - H5C_cache_entry_t * pl_head_ptr; - H5C_cache_entry_t * pl_tail_ptr; + uint32_t pl_len; + size_t pl_size; + H5C_cache_entry_t * pl_head_ptr; + H5C_cache_entry_t * pl_tail_ptr; /* Fields for tracking pinned entries */ - uint32_t pel_len; - size_t pel_size; - H5C_cache_entry_t * pel_head_ptr; - H5C_cache_entry_t * pel_tail_ptr; + uint32_t pel_len; + size_t pel_size; + H5C_cache_entry_t * pel_head_ptr; + H5C_cache_entry_t * pel_tail_ptr; /* Fields for complete LRU list of entries */ - uint32_t LRU_list_len; - size_t LRU_list_size; - H5C_cache_entry_t * LRU_head_ptr; - H5C_cache_entry_t * LRU_tail_ptr; + uint32_t LRU_list_len; + size_t LRU_list_size; + H5C_cache_entry_t * LRU_head_ptr; + H5C_cache_entry_t * LRU_tail_ptr; #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS /* Fields for clean LRU list of entries */ - uint32_t cLRU_list_len; - size_t cLRU_list_size; - H5C_cache_entry_t * cLRU_head_ptr; - H5C_cache_entry_t * cLRU_tail_ptr; + uint32_t cLRU_list_len; + size_t cLRU_list_size; + H5C_cache_entry_t * cLRU_head_ptr; + H5C_cache_entry_t * cLRU_tail_ptr; /* Fields for dirty LRU list of entries */ - uint32_t dLRU_list_len; - size_t dLRU_list_size; - H5C_cache_entry_t * dLRU_head_ptr; - H5C_cache_entry_t * dLRU_tail_ptr; + uint32_t dLRU_list_len; + size_t dLRU_list_size; + H5C_cache_entry_t * dLRU_head_ptr; + H5C_cache_entry_t * dLRU_tail_ptr; #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ #ifdef H5_HAVE_PARALLEL /* Fields for collective metadata reads */ - uint32_t coll_list_len; - size_t coll_list_size; - H5C_cache_entry_t * coll_head_ptr; - H5C_cache_entry_t * coll_tail_ptr; + uint32_t coll_list_len; + size_t coll_list_size; + H5C_cache_entry_t * coll_head_ptr; + H5C_cache_entry_t * coll_tail_ptr; /* Fields for collective metadata writes */ - H5SL_t * coll_write_list; + H5SL_t * coll_write_list; #endif /* H5_HAVE_PARALLEL */ /* Fields for automatic cache size adjustment */ - hbool_t size_increase_possible; - hbool_t flash_size_increase_possible; - size_t flash_size_increase_threshold; - hbool_t size_decrease_possible; - hbool_t resize_enabled; - hbool_t cache_full; - hbool_t size_decreased; - hbool_t resize_in_progress; - hbool_t msic_in_progress; - H5C_auto_size_ctl_t resize_ctl; + hbool_t size_increase_possible; + hbool_t flash_size_increase_possible; + size_t flash_size_increase_threshold; + hbool_t size_decrease_possible; + hbool_t resize_enabled; + hbool_t cache_full; + hbool_t size_decreased; + hbool_t resize_in_progress; + hbool_t msic_in_progress; + H5C_auto_size_ctl_t resize_ctl; /* Fields for epoch markers used in automatic cache size adjustment */ - int32_t epoch_markers_active; - hbool_t epoch_marker_active[H5C__MAX_EPOCH_MARKERS]; - int32_t epoch_marker_ringbuf[H5C__MAX_EPOCH_MARKERS+1]; - int32_t epoch_marker_ringbuf_first; - int32_t epoch_marker_ringbuf_last; - int32_t epoch_marker_ringbuf_size; - H5C_cache_entry_t epoch_markers[H5C__MAX_EPOCH_MARKERS]; + int32_t epoch_markers_active; + hbool_t epoch_marker_active[H5C__MAX_EPOCH_MARKERS]; + int32_t epoch_marker_ringbuf[H5C__MAX_EPOCH_MARKERS+1]; + int32_t epoch_marker_ringbuf_first; + int32_t epoch_marker_ringbuf_last; + int32_t epoch_marker_ringbuf_size; + H5C_cache_entry_t epoch_markers[H5C__MAX_EPOCH_MARKERS]; /* Fields for cache hit rate collection */ - int64_t cache_hits; - int64_t cache_accesses; + int64_t cache_hits; + int64_t cache_accesses; /* fields supporting generation of a cache image on file close */ - H5C_cache_image_ctl_t image_ctl; - hbool_t serialization_in_progress; - hbool_t load_image; - hbool_t image_loaded; - hbool_t delete_image; + H5C_cache_image_ctl_t image_ctl; + hbool_t serialization_in_progress; + hbool_t load_image; + hbool_t image_loaded; + hbool_t delete_image; haddr_t image_addr; - hsize_t image_len; - hsize_t image_data_len; - int64_t entries_loaded_counter; - int64_t entries_inserted_counter; - int64_t entries_relocated_counter; - int64_t entry_fd_height_change_counter; + hsize_t image_len; + hsize_t image_data_len; + int64_t entries_loaded_counter; + int64_t entries_inserted_counter; + int64_t entries_relocated_counter; + int64_t entry_fd_height_change_counter; uint32_t num_entries_in_image; - H5C_image_entry_t * image_entries; - void * image_buffer; + H5C_image_entry_t * image_entries; + void * image_buffer; /* Free Space Manager Related fields */ hbool_t rdfsm_settled; - hbool_t mdfsm_settled; + hbool_t mdfsm_settled; #if H5C_COLLECT_CACHE_STATS /* stats fields */ - int64_t hits[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t misses[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t write_protects[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t read_protects[H5C__MAX_NUM_TYPE_IDS + 1]; - int32_t max_read_protects[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t insertions[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t pinned_insertions[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t clears[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t flushes[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t evictions[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t take_ownerships[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t moves[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t entry_flush_moves[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t cache_flush_moves[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t pins[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t unpins[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t dirty_pins[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t pinned_flushes[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t pinned_clears[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t size_increases[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t size_decreases[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t entry_flush_size_changes[H5C__MAX_NUM_TYPE_IDS + 1]; - int64_t cache_flush_size_changes[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t hits[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t misses[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t write_protects[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t read_protects[H5C__MAX_NUM_TYPE_IDS + 1]; + int32_t max_read_protects[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t insertions[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t pinned_insertions[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t clears[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t flushes[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t evictions[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t take_ownerships[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t moves[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t entry_flush_moves[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t cache_flush_moves[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t pins[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t unpins[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t dirty_pins[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t pinned_flushes[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t pinned_clears[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t size_increases[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t size_decreases[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t entry_flush_size_changes[H5C__MAX_NUM_TYPE_IDS + 1]; + int64_t cache_flush_size_changes[H5C__MAX_NUM_TYPE_IDS + 1]; /* Fields for hash table operations */ - int64_t total_ht_insertions; - int64_t total_ht_deletions; - int64_t successful_ht_searches; - int64_t total_successful_ht_search_depth; - int64_t failed_ht_searches; - int64_t total_failed_ht_search_depth; - uint32_t max_index_len; - size_t max_index_size; - size_t max_clean_index_size; - size_t max_dirty_index_size; + int64_t total_ht_insertions; + int64_t total_ht_deletions; + int64_t successful_ht_searches; + int64_t total_successful_ht_search_depth; + int64_t failed_ht_searches; + int64_t total_failed_ht_search_depth; + uint32_t max_index_len; + size_t max_index_size; + size_t max_clean_index_size; + size_t max_dirty_index_size; /* Fields for in-order skip list */ - uint32_t max_slist_len; - size_t max_slist_size; + uint32_t max_slist_len; + size_t max_slist_size; /* Fields for protected entry list */ - uint32_t max_pl_len; - size_t max_pl_size; + uint32_t max_pl_len; + size_t max_pl_size; /* Fields for pinned entry list */ - uint32_t max_pel_len; - size_t max_pel_size; + uint32_t max_pel_len; + size_t max_pel_size; /* Fields for tracking 'make space in cache' (msic) operations */ - int64_t calls_to_msic; - int64_t total_entries_skipped_in_msic; - int64_t total_dirty_pf_entries_skipped_in_msic; - int64_t total_entries_scanned_in_msic; - int32_t max_entries_skipped_in_msic; - int32_t max_dirty_pf_entries_skipped_in_msic; - int32_t max_entries_scanned_in_msic; - int64_t entries_scanned_to_make_space; + int64_t calls_to_msic; + int64_t total_entries_skipped_in_msic; + int64_t total_dirty_pf_entries_skipped_in_msic; + int64_t total_entries_scanned_in_msic; + int32_t max_entries_skipped_in_msic; + int32_t max_dirty_pf_entries_skipped_in_msic; + int32_t max_entries_scanned_in_msic; + int64_t entries_scanned_to_make_space; /* Fields for tracking skip list scan restarts */ - int64_t slist_scan_restarts; - int64_t LRU_scan_restarts; - int64_t index_scan_restarts; + int64_t slist_scan_restarts; + int64_t LRU_scan_restarts; + int64_t index_scan_restarts; /* Fields for tracking cache image operations */ - int32_t images_created; - int32_t images_read; - int32_t images_loaded; - hsize_t last_image_size; + int32_t images_created; + int32_t images_read; + int32_t images_loaded; + hsize_t last_image_size; /* Fields for tracking prefetched entries */ - int64_t prefetches; - int64_t dirty_prefetches; - int64_t prefetch_hits; + int64_t prefetches; + int64_t dirty_prefetches; + int64_t prefetch_hits; #if H5C_COLLECT_CACHE_ENTRY_STATS - int32_t max_accesses[H5C__MAX_NUM_TYPE_IDS + 1]; - int32_t min_accesses[H5C__MAX_NUM_TYPE_IDS + 1]; - int32_t max_clears[H5C__MAX_NUM_TYPE_IDS + 1]; - int32_t max_flushes[H5C__MAX_NUM_TYPE_IDS + 1]; - size_t max_size[H5C__MAX_NUM_TYPE_IDS + 1]; - int32_t max_pins[H5C__MAX_NUM_TYPE_IDS + 1]; + int32_t max_accesses[H5C__MAX_NUM_TYPE_IDS + 1]; + int32_t min_accesses[H5C__MAX_NUM_TYPE_IDS + 1]; + int32_t max_clears[H5C__MAX_NUM_TYPE_IDS + 1]; + int32_t max_flushes[H5C__MAX_NUM_TYPE_IDS + 1]; + size_t max_size[H5C__MAX_NUM_TYPE_IDS + 1]; + int32_t max_pins[H5C__MAX_NUM_TYPE_IDS + 1]; #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ #endif /* H5C_COLLECT_CACHE_STATS */ - char prefix[H5C__PREFIX_LEN]; + char prefix[H5C__PREFIX_LEN]; #ifndef NDEBUG - int64_t get_entry_ptr_from_addr_counter; -#endif /* NDEBUG */ + int64_t get_entry_ptr_from_addr_counter; +#endif }; /* H5C_t */ @@ -5068,21 +3246,22 @@ typedef int (*H5C_tag_iter_cb_t)(H5C_cache_entry_t *entry, void *ctx); /* Package Private Prototypes */ /******************************/ H5_DLL herr_t H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated); -H5_DLL herr_t H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t * cache_ptr, - H5C_cache_entry_t** entry_ptr_ptr, const H5C_class_t * type, haddr_t addr, - void * udata); /* General routines */ +H5_DLL herr_t H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted); +H5_DLL herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t *cache_ptr); +H5_DLL herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t *cache_ptr); +H5_DLL herr_t H5C__flash_increase_cache_size(H5C_t *cache_ptr, size_t old_entry_size, size_t new_entry_size); +H5_DLL herr_t H5C__flush_invalidate_cache(H5F_t *f, unsigned flags); +H5_DLL herr_t H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags); H5_DLL herr_t H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags); H5_DLL herr_t H5C__generate_cache_image(H5F_t *f, H5C_t *cache_ptr); H5_DLL herr_t H5C__load_cache_image(H5F_t *f); -H5_DLL herr_t H5C__mark_flush_dep_serialized(H5C_cache_entry_t * entry_ptr); -H5_DLL herr_t H5C__mark_flush_dep_unserialized(H5C_cache_entry_t * entry_ptr); H5_DLL herr_t H5C__make_space_in_cache(H5F_t * f, size_t space_needed, hbool_t write_permitted); -H5_DLL herr_t H5C__flush_marked_entries(H5F_t * f); H5_DLL herr_t H5C__serialize_cache(H5F_t *f); +H5_DLL herr_t H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr); H5_DLL herr_t H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global, H5C_tag_iter_cb_t cb, void *cb_ctx); @@ -5090,6 +3269,20 @@ H5_DLL herr_t H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_ H5_DLL herr_t H5C__tag_entry(H5C_t * cache_ptr, H5C_cache_entry_t * entry_ptr); H5_DLL herr_t H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry); +/* Routines for operating on cache images */ +H5_DLL herr_t H5C__get_cache_image_config(const H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr); +H5_DLL herr_t H5C__image_stats(H5C_t *cache_ptr, hbool_t print_header); + +/* Debugging routines */ +#ifdef H5C_DO_SLIST_SANITY_CHECKS +H5_DLL hbool_t H5C__entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr); +#endif +#ifdef H5C_DO_EXTREME_SANITY_CHECKS +H5_DLL herr_t H5C__validate_lru_list(H5C_t *cache_ptr); +H5_DLL herr_t H5C__validate_pinned_entry_list(H5C_t *cache_ptr); +H5_DLL herr_t H5C__validate_protected_entry_list(H5C_t *cache_ptr); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + /* Testing functions */ #ifdef H5C_TESTING H5_DLL herr_t H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Cpp.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Cpp.h index 202d5843f5..34fdef2032 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Cpp.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Cpp.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5CppDoc.h b/externals/coda-oss/modules/drivers/hdf5/include/H5CppDoc.h index 4337a6fe91..37bd8a5cd0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5CppDoc.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5CppDoc.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Cprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Cprivate.h index 66ffc62615..2e818d2c4b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Cprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Cprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Cprivate.h - * 6/3/04 - * John Mainzer * * Purpose: Constants and typedefs available to the rest of the * library. @@ -43,8 +40,6 @@ /* This sanity checking constant was picked out of the air. Increase * or decrease it if appropriate. Its purposes is to detect corrupt * object sizes, so it probably doesn't matter if it is a bit big. - * - * JRM - 5/17/04 */ #define H5C_MAX_ENTRY_SIZE ((size_t)(32 * 1024 * 1024)) @@ -90,10 +85,6 @@ #define H5C__DEFAULT_MAX_CACHE_SIZE ((size_t)(4 * 1024 * 1024)) #define H5C__DEFAULT_MIN_CLEAN_SIZE ((size_t)(2 * 1024 * 1024)) -/* Values for cache entry magic field */ -#define H5C__H5C_CACHE_ENTRY_T_MAGIC 0x005CAC0A -#define H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC 0xDeadBeef - /* Cache configuration validation definitions */ #define H5C_RESIZE_CFG__VALIDATE_GENERAL 0x1 #define H5C_RESIZE_CFG__VALIDATE_INCREMENT 0x2 @@ -207,20 +198,24 @@ #define H5C__UPDATE_PAGE_BUFFER_FLAG 0x40000 /* Set during parallel I/O */ /* Debugging/sanity checking/statistics settings */ -#ifndef NDEBUG -#define H5C_DO_SANITY_CHECKS 1 -#define H5C_DO_SLIST_SANITY_CHECKS 0 -#define H5C_DO_TAGGING_SANITY_CHECKS 1 -#define H5C_DO_EXTREME_SANITY_CHECKS 0 -#else /* NDEBUG */ -/* With rare exceptions, the following defines should be set - * to 0 if NDEBUG is defined +/* #define H5C_DO_SANITY_CHECKS */ +/* #define H5C_DO_SLIST_SANITY_CHECKS */ +/* #define H5C_DO_TAGGING_SANITY_CHECKS */ +/* #define H5C_DO_EXTREME_SANITY_CHECKS */ + +/* + * If not already set externally (e.g., from the build + * system), set a few debugging options for debug builds. */ -#define H5C_DO_SANITY_CHECKS 0 -#define H5C_DO_SLIST_SANITY_CHECKS 0 -#define H5C_DO_TAGGING_SANITY_CHECKS 0 -#define H5C_DO_EXTREME_SANITY_CHECKS 0 -#endif /* NDEBUG */ +#ifndef NDEBUG +#ifndef H5C_DO_SANITY_CHECKS +#define H5C_DO_SANITY_CHECKS +#endif + +#ifndef H5C_DO_TAGGING_SANITY_CHECKS +#define H5C_DO_TAGGING_SANITY_CHECKS +#endif +#endif /* Cork actions: cork/uncork/get cork status of an object */ #define H5C__SET_CORK 0x1 @@ -975,27 +970,6 @@ typedef int H5C_ring_t; * * The fields of this structure are discussed individually below: * - * JRM - 4/26/04 - * - * magic: Unsigned 32 bit integer that must always be set to - * H5C__H5C_CACHE_ENTRY_T_MAGIC when the entry is valid. - * The field must be set to H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC - * just before the entry is freed. - * - * This is necessary, as the LRU list can be changed out - * from under H5C__make_space_in_cache() by the serialize - * callback which may change the size of an existing entry, - * and/or load a new entry while serializing the target entry. - * - * This in turn can cause a recursive call to - * H5C__make_space_in_cache() which may either flush or evict - * the next entry that the first invocation of that function - * was about to examine. - * - * The magic field allows H5C__make_space_in_cache() to - * detect this case, and re-start its scan from the bottom - * of the LRU when this situation occurs. - * * cache_ptr: Pointer to the cache that this entry is contained within. * * addr: Base address of the cache entry on disk. @@ -1097,15 +1071,9 @@ typedef int H5C_ring_t; * be unpinned (and possibly unprotected) during the * flush. * - * JRM -- 3/16/06 - * * in_slist: Boolean flag indicating whether the entry is in the skip list - * As a general rule, entries are placed in the list when they - * are marked dirty. However they may remain in the list after - * being flushed. - * - * Update: Dirty entries are now removed from the skip list - * when they are flushed. + * As a general rule, entries are placed in the list when they are + * marked dirty. * * flush_marker: Boolean flag indicating that the entry is to be flushed * the next time H5C_flush_cache() is called with the @@ -1113,24 +1081,13 @@ typedef int H5C_ring_t; * the entry is flushed for whatever reason. * * flush_me_last: Boolean flag indicating that this entry should not be - * flushed from the cache until all other entries without - * the flush_me_last flag set have been flushed. + * flushed from the cache until all other entries without the + * flush_me_last flag set have been flushed. * - * Note: - * - * At this time, the flush_me_last - * flag will only be applied to one entry, the superblock, - * and the code utilizing these flags is protected with HDasserts - * to enforce this. This restraint can certainly be relaxed in - * the future if the the need for multiple entries getting flushed - * last or collectively arises, though the code allowing for that - * will need to be expanded and tested appropriately if that - * functionality is desired. - * - * Update: There are now two possible last entries - * (superblock and file driver info message). This - * number will probably increase as we add superblock - * messages. JRM -- 11/18/14 + * Note: At this time, the flush_me_last flag will only be applied to + * two types of entries: the superblock and the file driver info + * message. The code utilizing these flags is protected with + * asserts to enforce this. * * clear_on_unprotect: Boolean flag used only in PHDF5. When H5C is used * to implement the metadata cache In the parallel case, only @@ -1225,8 +1182,6 @@ typedef int H5C_ring_t; * If there are multiple entries in any hash bin, they are stored in a doubly * linked list. * - * Addendum: JRM -- 10/14/15 - * * We have come to scan all entries in the cache frequently enough that * the cost of doing so by scanning the hash table has become unacceptable. * To reduce this cost, the index now also maintains a doubly linked list @@ -1590,7 +1545,6 @@ typedef int H5C_ring_t; * ****************************************************************************/ typedef struct H5C_cache_entry_t { - uint32_t magic; H5C_t *cache_ptr; haddr_t addr; size_t size; @@ -1688,13 +1642,6 @@ typedef struct H5C_cache_entry_t { * * The fields of this structure are discussed individually below: * - * JRM - 8/5/15 - * - * magic: Unsigned 32 bit integer that must always be set to - * H5C_IMAGE_ENTRY_T_MAGIC when the entry is valid. - * The field must be set to H5C_IMAGE_ENTRY_T_BAD_MAGIC - * just before the entry is freed. - * * addr: Base address of the cache entry on disk. * * size: Length of the cache entry on disk in bytes. @@ -1818,11 +1765,8 @@ typedef struct H5C_cache_entry_t { * callbacks must be used to update this image before it is * written to disk * - * ****************************************************************************/ - typedef struct H5C_image_entry_t { - uint32_t magic; haddr_t addr; size_t size; H5C_ring_t ring; @@ -1852,7 +1796,7 @@ typedef struct H5C_image_entry_t { * H5C_auto_size_ctl_t passed to the cache must have a known * version number, or an error will be flagged. * - * report_fcn: Pointer to the function that is to be called to report + * rpt_fcn: Pointer to the function that is to be called to report * activities each time the auto cache resize code is executed. If the * field is NULL, no call is made. * @@ -1975,10 +1919,6 @@ typedef struct H5C_image_entry_t { * performance, however the above flash increment algorithm will not be * triggered. * - * Hopefully, the add space algorithm detailed above will be sufficient - * for the performance problems encountered to date. However, we should - * expect to revisit the issue. - * * flash_multiple: Double containing the multiple described above in the * H5C_flash_incr__add_space section of the discussion of the * flash_incr_mode section. This field is ignored unless flash_incr_mode @@ -2045,8 +1985,8 @@ typedef struct H5C_image_entry_t { * The field is a double containing the multiplier used to derive the * new cache size from the old if a cache size decrement is triggered. * The decrement must be in the range 0.0 (in which case the cache will - * try to contract to its minimum size) to 1.0 (in which case the - * cache will never shrink). + * try to contract to its minimum size) to 1.0 (in which case the + * cache will never shrink). * * apply_max_decrement: Boolean flag used to determine whether decrements * in cache size are to be limited by the max_decrement field. @@ -2236,12 +2176,11 @@ H5_DLL herr_t H5C_flush_tagged_entries(H5F_t *f, haddr_t tag); H5_DLL herr_t H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, hbool_t match_global); H5_DLL herr_t H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags); H5_DLL herr_t H5C_get_tag(const void *thing, /*OUT*/ haddr_t *tag); -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS herr_t H5C_verify_tag(int id, haddr_t tag); #endif H5_DLL herr_t H5C_flush_to_min_clean(H5F_t *f); H5_DLL herr_t H5C_get_cache_auto_resize_config(const H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr); -H5_DLL herr_t H5C_get_cache_image_config(const H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr); H5_DLL herr_t H5C_get_cache_size(const H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_clean_size_ptr, size_t *cur_size_ptr, uint32_t *cur_num_entries_ptr); H5_DLL herr_t H5C_get_cache_flush_in_progress(const H5C_t *cache_ptr, hbool_t *flush_in_progress_ptr); @@ -2252,7 +2191,6 @@ H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t *size_pt hbool_t *is_flush_dep_child_ptr, hbool_t *image_up_to_date_ptr); H5_DLL herr_t H5C_get_evictions_enabled(const H5C_t *cache_ptr, hbool_t *evictions_enabled_ptr); H5_DLL void *H5C_get_aux_ptr(const H5C_t *cache_ptr); -H5_DLL herr_t H5C_image_stats(H5C_t *cache_ptr, hbool_t print_header); H5_DLL herr_t H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, unsigned int flags); H5_DLL herr_t H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_t rw); @@ -2292,16 +2230,6 @@ H5_DLL herr_t H5C_cache_image_status(H5F_t *f, hbool_t *load_ci_ptr, hbool_t * H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr); H5_DLL herr_t H5C_get_mdc_image_info(const H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len); -#if H5C_DO_SLIST_SANITY_CHECKS -H5_DLL hbool_t H5C_entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr); -#endif - -#if H5C_DO_EXTREME_SANITY_CHECKS -H5_DLL herr_t H5C_validate_lru_list(H5C_t *cache_ptr); -H5_DLL herr_t H5C_validate_pinned_entry_list(H5C_t *cache_ptr); -H5_DLL herr_t H5C_validate_protected_entry_list(H5C_t *cache_ptr); -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - /* Logging functions */ H5_DLL herr_t H5C_start_logging(H5C_t *cache); H5_DLL herr_t H5C_stop_logging(H5C_t *cache); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Cpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Cpublic.h index c65dc7c3e0..69c86cdef9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Cpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Cpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -13,19 +12,16 @@ /*------------------------------------------------------------------------- * - * Created: H5Cpublic.h - * June 4, 2005 - * John Mainzer + * Created: H5Cpublic.h * - * Purpose: Public include file for cache functions. + * Purpose: Public header file for cache functions * *------------------------------------------------------------------------- */ #ifndef H5Cpublic_H #define H5Cpublic_H -/* Public headers needed by this file */ -#include "H5public.h" +#include "H5public.h" /* Generic Functions */ enum H5C_cache_incr_mode { H5C_incr__off, diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5DOpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5DOpublic.h new file mode 100644 index 0000000000..887e65973e --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5DOpublic.h @@ -0,0 +1,250 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5DOpublic_H +#define H5DOpublic_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** \page H5DO_UG The HDF5 High Level Optimizations + * @todo Under Construction + */ + +/**\defgroup H5DO HDF5 Optimizations APIs (H5DO) + * + * Bypassing default HDF5 behavior in order to optimize for specific + * use cases (H5DO) + * + * HDF5 functions described is this section are implemented in the HDF5 High-level + * library as optimized functions. These functions generally require careful setup + * and testing as they enable an application to bypass portions of the HDF5 + * library's I/O pipeline for performance purposes. + * + * These functions are distributed in the standard HDF5 distribution and are + * available any time the HDF5 High-level library is available. + * + * - \ref H5DOappend + * \n Appends data to a dataset along a specified dimension. + * - \ref H5DOread_chunk + * \n Reads a raw data chunk directly from a dataset in a file into a buffer (DEPRECATED) + * - \ref H5DOwrite_chunk + * \n Writes a raw data chunk from a buffer directly to a dataset in a file (DEPRECATED) + * + */ + +/*------------------------------------------------------------------------- + * + * "Optimized dataset" routines. + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DO + * + * \brief Appends data to a dataset along a specified dimension. + * + * \param[in] dset_id Dataset identifier + * \param[in] dxpl_id Dataset transfer property list identifier + * \param[in] axis Dataset Dimension (0-based) for the append + * \param[in] extension Number of elements to append for the + * axis-th dimension + * \param[in] memtype The memory datatype identifier + * \param[in] buf Buffer with data for the append + * + * \return \herr_t + * + * \details The H5DOappend() routine extends a dataset by \p extension + * number of elements along a dimension specified by a + * dimension \p axis and writes \p buf of elements to the + * dataset. Dimension \p axis is 0-based. Elements’ type + * is described by \p memtype. + * + * This routine combines calling H5Dset_extent(), + * H5Sselect_hyperslab(), and H5Dwrite() into a single routine + * that simplifies application development for the common case + * of appending elements to an existing dataset. + * + * For a multi-dimensional dataset, appending to one dimension + * will write a contiguous hyperslab over the other dimensions. + * For example, if a 3-D dataset has dimension sizes (3, 5, 8), + * extending the 0th dimension (currently of size 3) by 3 will + * append 3*5*8 = 120 elements (which must be pointed to by the + * \p buffer parameter) to the dataset, making its final + * dimension sizes (6, 5, 8). + * + * If a dataset has more than one unlimited dimension, any of + * those dimensions may be appended to, although only along + * one dimension per call to H5DOappend(). + * + * \since 1.10.0 + * + */ +H5_HLDLL herr_t H5DOappend(hid_t dset_id, hid_t dxpl_id, unsigned axis, size_t extension, hid_t memtype, + const void *buf); + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/* Compatibility wrappers for functionality moved to H5D */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DO + * + * \brief Writes a raw data chunk from a buffer directly to a dataset in a file. + * + * \param[in] dset_id Identifier for the dataset to write to + * \param[in] dxpl_id Transfer property list identifier for + * this I/O operation + * \param[in] filters Mask for identifying the filters in use + * \param[in] offset Logical position of the chunk's first element + * in the dataspace + * \param[in] data_size Size of the actual data to be written in bytes + * \param[in] buf Buffer containing data to be written to the chunk + * + * \return \herr_t + * + * \deprecated This function was deprecated in favor of the function + * H5Dwrite_chunk() of HDF5-1.10.3. + * The functionality of H5DOwrite_chunk() was moved + * to H5Dwrite_chunk(). + * \deprecated For compatibility, this API call has been left as a stub which + * simply calls H5Dwrite_chunk(). New code should use H5Dwrite_chunk(). + * + * \details The H5DOwrite_chunk() writes a raw data chunk as specified by its + * logical \p offset in a chunked dataset \p dset_id from the application + * memory buffer \p buf to the dataset in the file. Typically, the data + * in \p buf is preprocessed in memory by a custom transformation, such as + * compression. The chunk will bypass the library's internal data + * transfer pipeline, including filters, and will be written directly to the file. + * + * \p dxpl_id is a data transfer property list identifier. + * + * \p filters is a mask providing a record of which filters are used + * with the chunk. The default value of the mask is zero (\c 0), + * indicating that all enabled filters are applied. A filter is skipped + * if the bit corresponding to the filter's position in the pipeline + * (0 ≤ position < 32) is turned on. This mask is saved + * with the chunk in the file. + * + * \p offset is an array specifying the logical position of the first + * element of the chunk in the dataset's dataspace. The length of the + * offset array must equal the number of dimensions, or rank, of the + * dataspace. The values in \p offset must not exceed the dimension limits + * and must specify a point that falls on a dataset chunk boundary. + * + * \p data_size is the size in bytes of the chunk, representing the number of + * bytes to be read from the buffer \p buf. If the data chunk has been + * precompressed, \p data_size should be the size of the compressed data. + * + * \p buf is the memory buffer containing data to be written to the chunk in the file. + * + * \attention Exercise caution when using H5DOread_chunk() and H5DOwrite_chunk(), + * as they read and write data chunks directly in a file. + * H5DOwrite_chunk() bypasses hyperslab selection, the conversion of data + * from one datatype to another, and the filter pipeline to write the chunk. + * Developers should have experience with these processes before + * using this function. Please see + * + * Using the Direct Chunk Write Function + * for more information. + * + * \note H5DOread_chunk() and H5DOwrite_chunk() are not + * supported under parallel and do not support variable length types. + * + * \par Example + * The following code illustrates the use of H5DOwrite_chunk to write + * an entire dataset, chunk by chunk: + * \snippet H5DO_examples.c H5DOwrite + * + * \version 1.10.3 Function deprecated in favor of H5Dwrite_chunk. + * + * \since 1.8.11 + */ +H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, + size_t data_size, const void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DO + * + * \brief Reads a raw data chunk directly from a dataset in a file into a buffer. + * + * \param[in] dset_id Identifier for the dataset to be read + * \param[in] dxpl_id Transfer property list identifier for + * this I/O operation + * \param[in] offset Logical position of the chunk's first + element in the dataspace + * \param[in,out] filters Mask for identifying the filters used + * with the chunk + * \param[in] buf Buffer containing the chunk read from + * the dataset + * + * \return \herr_t + * + * \deprecated This function was deprecated in favor of the function + * H5Dread_chunk() as of HDF5-1.10.3. + * In HDF5 1.10.3, the functionality of H5DOread_chunk() + * was moved to H5Dread_chunk(). + * \deprecated For compatibility, this API call has been left as a stub which + * simply calls H5Dread_chunk(). New code should use H5Dread_chunk(). + * + * \details The H5DOread_chunk() reads a raw data chunk as specified + * by its logical \p offset in a chunked dataset \p dset_id + * from the dataset in the file into the application memory + * buffer \p buf. The data in \p buf is read directly from the file + * bypassing the library's internal data transfer pipeline, + * including filters. + * + * \p dxpl_id is a data transfer property list identifier. + * + * The mask \p filters indicates which filters are used with the + * chunk when written. A zero value indicates that all enabled filters + * are applied on the chunk. A filter is skipped if the bit corresponding + * to the filter's position in the pipeline + * (0 ≤ position < 32) is turned on. + * + * \p offset is an array specifying the logical position of the first + * element of the chunk in the dataset's dataspace. The length of the + * offset array must equal the number of dimensions, or rank, of the + * dataspace. The values in \p offset must not exceed the dimension + * limits and must specify a point that falls on a dataset chunk boundary. + * + * \p buf is the memory buffer containing the chunk read from the dataset + * in the file. + * + * \par Example + * The following code illustrates the use of H5DOread_chunk() + * to read a chunk from a dataset: + * \snippet H5DO_examples.c H5DOread + * + * \version 1.10.3 Function deprecated in favor of H5Dread_chunk. + * + * \since 1.10.2, 1.8.19 + */ +H5_HLDLL herr_t H5DOread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters /*out*/, + void *buf /*out*/); + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5DSpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5DSpublic.h new file mode 100644 index 0000000000..edbebdbaf2 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5DSpublic.h @@ -0,0 +1,413 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5DSpublic_H +#define H5DSpublic_H + +#define DIMENSION_SCALE_CLASS "DIMENSION_SCALE" +#define DIMENSION_LIST "DIMENSION_LIST" +#define REFERENCE_LIST "REFERENCE_LIST" +#define DIMENSION_LABELS "DIMENSION_LABELS" + +/** + * \brief Prototype for H5DSiterate_scales() operator + * + */ +//! +typedef herr_t (*H5DS_iterate_t)(hid_t dset, unsigned dim, hid_t scale, void *visitor_data); +//! + +#ifdef __cplusplus +extern "C" { +#endif + +/** \page H5DS_UG The HDF5 High Level Dimension Scales + * @todo Under Construction + */ + +/**\defgroup H5DS HDF5 Dimension Scales APIs (H5DS) + * + * Creating and manipulating HDF5 datasets that are associated with + * the dimension of another HDF5 dataset (H5DS) + * + * \note \Bold{Programming hints:} + * \note To use any of these functions or subroutines, + * you must first include the relevant include file (C) or + * module (Fortran) in your application. + * \note The following line includes the HDF5 Dimension Scale package, + * H5DS, in C applications: + * \code #include "hdf5_hl.h" \endcode + * \note This line includes the H5DS module in Fortran applications: + * \code use h5ds \endcode + * + * - \ref H5DSwith_new_ref + * \n Determines if new references are used with dimension scales. + * - \ref H5DSattach_scale + * \n Attach dimension scale dsid to dimension idx of dataset did. + * - \ref H5DSdetach_scale + * \n Detach dimension scale dsid from the dimension idx of Dataset did. + * - \ref H5DSget_label + * \n Read the label for dimension idx of did into buffer label. + * - \ref H5DSget_num_scales + * \n Determines how many Dimension Scales are attached + * to dimension idx of did. + * - \ref H5DSget_scale_name + * \n Retrieves name of scale did into buffer name. + * - \ref H5DSis_attached + * \n Report if dimension scale dsid is currently attached + * to dimension idx of dataset did. + * - \ref H5DSis_scale + * \n Determines whether dset is a Dimension Scale. + * - \ref H5DSiterate_scales + * \n Iterates the operation visitor through the scales + * attached to dimension dim. + * - \ref H5DSset_label + * \n Set label for the dimension idx of did to the value label. + * - \ref H5DSset_scale + * \n Convert dataset dsid to a dimension scale, + * with optional name, dimname. + * + */ + +/* THIS IS A NEW ROUTINE NOT ON OLD PORTAL */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Determines if new references are used with dimension scales. + * + * \param[in] obj_id Object identifier + * \param[out] with_new_ref New references are used or not + * + * \return \herr_t + * + * \details H5DSwith_new_ref() takes any object identifier and checks + * if new references are used for dimension scales. Currently, + * new references are used when non-native VOL connector is + * used or when H5_DIMENSION_SCALES_WITH_NEW_REF is set up + * via configure option. + * + */ +H5_HLDLL herr_t H5DSwith_new_ref(hid_t obj_id, hbool_t *with_new_ref); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Attach dimension scale \p dsid to dimension \p idx of + * dataset did. + * + * \param[in] did The dataset + * \param[in] dsid The scale to be attached + * \param[in] idx The dimension of \p did that \p dsid is associated with + * + * \return \herr_t + * + * \details Define Dimension Scale \p dsid to be associated with + * dimension \p idx of dataset \p did. + * + * Entries are created in the #DIMENSION_LIST and + * #REFERENCE_LIST attributes, as defined in section 4.2 of + * + * HDF5 Dimension Scale Specification. + * + * Fails if: + * - Bad arguments + * - If \p dsid is not a Dimension Scale + * - If \p did is a Dimension Scale + * (A Dimension Scale cannot have scales.) + * + * \note The Dimension Scale \p dsid can be attached to the + * same dimension more than once, which has no effect. + */ +H5_HLDLL herr_t H5DSattach_scale(hid_t did, hid_t dsid, unsigned int idx); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Detach dimension scale \p dsid from the dimension \p idx of dataset \p did. + * + * \param[in] did The dataset + * \param[in] dsid The scale to be detached + * \param[in] idx The dimension of \p did to detach + * + * \return \herr_t + * + * \details If possible, deletes association of Dimension Scale \p dsid with + * dimension \p idx of dataset \p did. This deletes the entries in the + * #DIMENSION_LIST and #REFERENCE_LIST attributes, + * as defined in section 4.2 of + * + * HDF5 Dimension Scale Specification. + * + * Fails if: + * - Bad arguments + * - The dataset \p did or \p dsid do not exist + * - The \p dsid is not a Dimension Scale + * - \p dsid is not attached to \p did + * + * \note A scale may be associated with more than dimension of the + * same dataset. If so, the detach operation only deletes one + * of the associations, for \p did. + * + */ +H5_HLDLL herr_t H5DSdetach_scale(hid_t did, hid_t dsid, unsigned int idx); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Convert dataset \p dsid to a dimension scale, + * with optional name, \p dimname. + * + * \param[in] dsid The dataset to be made a Dimemsion Scale + * \param[in] dimname The dimension name (optional), NULL if the + * dimension has no name. + * + * \return \herr_t + * + * \details The dataset \p dsid is converted to a Dimension Scale dataset, + * as defined above. Creates the CLASS attribute, set to the value + * "DIMENSION_SCALE" and an empty #REFERENCE_LIST attribute, + * as described in + * + * HDF5 Dimension Scale Specification. + * (PDF, see section 4.2). + * + * If \p dimname is specified, then an attribute called NAME + * is created, with the value \p dimname. + * + * Fails if: + * - Bad arguments + * - If \p dsid is already a scale + * - If \p dsid is a dataset which already has dimension scales + * + * If the dataset was created with the Table, Image, or Palette interface [9], + * it is not recommended to convert to a Dimension Scale. + * (These Datasets will have a CLASS Table, Image, or Palette.) + * + * \todo what is [9] after Palette interface? + */ +H5_HLDLL herr_t H5DSset_scale(hid_t dsid, const char *dimname); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Determines how many Dimension Scales are attached + * to dimension \p idx of \p did. + * + * \param[in] did The dataset to query + * \param[in] idx The dimension of \p did to query + * + * \return Returns the number of Dimension Scales associated + * with \p did, if successful, otherwise returns a + * negative value. + * + * \details H5DSget_num_scales() determines how many Dimension + * Scales are attached to dimension \p idx of + * dataset \p did. + * + */ +H5_HLDLL int H5DSget_num_scales(hid_t did, unsigned int idx); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Set label for the dimension \p idx of \p did + * to the value \p label. + * + * \param[in] did The dataset + * \param[in] idx The dimension + * \param[in] label The label + * + * \return \herr_t + * + * \details Sets the #DIMENSION_LABELS for dimension \p idx of + * dataset \p did. If the dimension had a label, + * the new value replaces the old. + * + * Fails if: + * - Bad arguments + * + */ +H5_HLDLL herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Read the label for dimension \p idx of \p did into buffer \p label. + * + * \param[in] did The dataset + * \param[in] idx The dimension + * \param[out] label The label + * \param[in] size The length of the label buffer + * + * \return Upon success, size of label or zero if no label found. + * Negative if fail. + * + * \details Returns the value of the #DIMENSION_LABELS for + * dimension \p idx of dataset \p did, if set. + * Up to \p size characters of the name are copied into + * the buffer \p label. If the label is longer than + * \p size, it will be truncated to fit. The parameter + * \p size is set to the size of the returned \p label. + * + * If \p did has no label, the return value of + * \p label is NULL. + * + * Fails if: + * - Bad arguments + * + */ +H5_HLDLL ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Retrieves name of scale \p did into buffer \p name. + * + * \param[in] did Dimension scale identifier + * \param[out] name Buffer to contain the returned name + * \param[in] size Size in bytes, of the \p name buffer + * + * \return Upon success, the length of the scale name or zero if no name found. + * Negative if fail. + * + * \details H5DSget_scale_name() retrieves the name attribute + * for scale \p did. + * + * Up to \p size characters of the scale name are returned + * in \p name; additional characters, if any, are not returned + * to the user application. + * + * If the length of the name, which determines the required value of + * \p size, is unknown, a preliminary H5DSget_scale_name() call can + * be made by setting \p name to NULL. The return value of this call + * will be the size of the scale name; that value plus one (1) can then + * be assigned to \p size for a second H5DSget_scale_name() call, + * which will retrieve the actual name. (The value passed in with the + * parameter \p size must be one greater than size in bytes of the actual + * name in order to accommodate the null terminator; + * if \p size is set to the exact size of the name, the last byte + * passed back will contain the null terminator and the last character + * will be missing from the name passed back to the calling application.) + */ +H5_HLDLL ssize_t H5DSget_scale_name(hid_t did, char *name, size_t size); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Determines whether \p did is a Dimension Scale. + * + * \param[in] did The dataset to query + * + * \return \htri_t + * + * \details H5DSis_scale() determines if \p did is a Dimension Scale, + * i.e., has class="DIMENSION_SCALE"). + * + */ +H5_HLDLL htri_t H5DSis_scale(hid_t did); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Iterates the operation visitor through the scales + * attached to dimension \p dim. + * + * \param[in] did The dataset + * \param[in] dim The dimension of dataset \p did + * \param[in,out] idx Input the index to start iterating, + * output the next index to visit. + * If NULL, start at the first position. + * \param[in] visitor The visitor function + * \param[in] visitor_data Arbitrary data to pass to the + * visitor function + * + * \return Returns the return value of the last operator if it was + * non-zero, or zero if all scales were processed. + * + * \details H5DSiterate_scales() iterates over the scales attached to + * dimension \p dim of dataset \p did. For each scale in the + * list, the \p visitor_data and some additional information, + * specified below, are passed to the \p visitor function. + * The iteration begins with the \p idx object in the + * group and the next element to be processed by the operator + * is returned in \p idx. If \p idx is NULL, then the + * iterator starts at the first group member; since no + * stopping point is returned in this case, + * the iterator cannot be restarted if one of the calls + * to its operator returns non-zero. + * + * The prototype for \ref H5DS_iterate_t is: + * \snippet this H5DS_iterate_t_snip + * + * The operation receives the Dimension Scale dataset + * identifier, \p scale, and the pointer to the operator + * data passed in to H5DSiterate_scales(), \p visitor_data. + * + * The return values from an operator are: + * + * - Zero causes the iterator to continue, returning zero + * when all group members have been processed. + * - Positive causes the iterator to immediately return that + * positive value, indicating short-circuit success. + * The iterator can be restarted at the next group member. + * - Negative causes the iterator to immediately return + * that value, indicating failure. The iterator can be + * restarted at the next group member. + * + * H5DSiterate_scales() assumes that the scales of the + * dimension identified by \p dim remain unchanged through + * the iteration. If the membership changes during the iteration, + * the function's behavior is undefined. + */ +H5_HLDLL herr_t H5DSiterate_scales(hid_t did, unsigned int dim, int *idx, H5DS_iterate_t visitor, + void *visitor_data); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5DS + * + * \brief Report if dimension scale \p dsid is currently attached to + * dimension \p idx of dataset \p did. + * + * \param[in] did The dataset + * \param[in] dsid The scale to be attached + * \param[in] idx The dimension of \p did that \p dsid is associated with + * + * \return \htri_t + * + * \details Report if dimension scale \p dsid is currently attached to + * dimension \p idx of dataset \p did. + * + * Fails if: + * - Bad arguments + * - If \p dsid is not a Dimension Scale + * - The \p dsid is not a Dimension Scale + * - If \p did is a Dimension Scale (A Dimension Scale cannot have scales.) + * + */ +H5_HLDLL htri_t H5DSis_attached(hid_t did, hid_t dsid, unsigned int idx); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5DaccProp.h b/externals/coda-oss/modules/drivers/hdf5/include/H5DaccProp.h index 1accbd6f64..bb404cec40 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5DaccProp.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5DaccProp.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5DataSet.h b/externals/coda-oss/modules/drivers/hdf5/include/H5DataSet.h index 104638ed82..399235086f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5DataSet.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5DataSet.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5DataSpace.h b/externals/coda-oss/modules/drivers/hdf5/include/H5DataSpace.h index 87852a2b92..136a8ea63b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5DataSpace.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5DataSpace.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5DataType.h b/externals/coda-oss/modules/drivers/hdf5/include/H5DataType.h index 109dcbbcff..7cc1d31579 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5DataType.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5DataType.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5DcreatProp.h b/externals/coda-oss/modules/drivers/hdf5/include/H5DcreatProp.h index a2d5ff2172..94ecbb53a8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5DcreatProp.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5DcreatProp.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Dmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Dmodule.h index a05d71784c..84d00e89d0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Dmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Dmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5D package. Including this header means that the source file - * is part of the H5D package. + * Purpose: This file contains declarations which define macros for the + * H5D package. Including this header means that the source file + * is part of the H5D package. */ #ifndef H5Dmodule_H #define H5Dmodule_H @@ -28,7 +25,2666 @@ #define H5_MY_PKG H5D #define H5_MY_PKG_ERR H5E_DATASET -/**\defgroup H5D H5D +/** \page H5D_UG HDF5 Datasets + * + * \section sec_dataset HDF5 Datasets + * + * \subsection subsec_dataset_intro Introduction + * + * An HDF5 dataset is an object composed of a collection of data elements, or raw data, and + * metadata that stores a description of the data elements, data layout, and all other information + * necessary to write, read, and interpret the stored data. From the viewpoint of the application the + * raw data is stored as a one-dimensional or multi-dimensional array of elements (the raw data), + * those elements can be any of several numerical or character types, small arrays, or even + * compound types similar to C structs. The dataset object may have attribute objects. See the + * figure below. + * + * + * + * + * + *
+ * \image html Dsets_fig1.gif "Application view of a dataset" + *
+ * + * A dataset object is stored in a file in two parts: a header and a data array. The header contains + * information that is needed to interpret the array portion of the dataset, as well as metadata (or + * pointers to metadata) that describes or annotates the dataset. Header information includes the + * name of the object, its dimensionality, its number-type, information about how the data itself is + * stored on disk (the storage layout), and other information used by the library to speed up access + * to the dataset or maintain the file's integrity. + * + * The HDF5 dataset interface, comprising the @ref H5D functions, provides a mechanism for managing + * HDF5 datasets including the transfer of data between memory and disk and the description of + * dataset properties. + * + * A dataset is used by other HDF5 APIs, either by name or by an identifier. For more information, + * \see \ref api-compat-macros. + * + * \subsubsection subsubsec_dataset_intro_link Link/Unlink + * A dataset can be added to a group with one of the H5Lcreate calls, and deleted from a group with + * #H5Ldelete. The link and unlink operations use the name of an object, which may be a dataset. + * The dataset does not have to open to be linked or unlinked. + * + * \subsubsection subsubsec_dataset_intro_obj Object Reference + * A dataset may be the target of an object reference. The object reference is created by + * #H5Rcreate with the name of an object which may be a dataset and the reference type + * #H5R_OBJECT. The dataset does not have to be open to create a reference to it. + * + * An object reference may also refer to a region (selection) of a dataset. The reference is created + * with #H5Rcreate and a reference type of #H5R_DATASET_REGION. + * + * An object reference can be accessed by a call to #H5Rdereference. When the reference is to a + * dataset or dataset region, the #H5Rdereference call returns an identifier to the dataset just as if + * #H5Dopen has been called. + * + * \subsubsection subsubsec_dataset_intro_attr Adding Attributes + * A dataset may have user-defined attributes which are created with #H5Acreate and accessed + * through the @ref H5A API. To create an attribute for a dataset, the dataset must be open, and the + * identifier is passed to #H5Acreate. The attributes of a dataset are discovered and opened using + * #H5Aopen_name, #H5Aopen_idx, or #H5Aiterate; these functions use the identifier of the dataset. + * An attribute can be deleted with #H5Adelete which also uses the identifier of the dataset. + * + * \subsection subsec_dataset_function Dataset Function Summaries + * Functions that can be used with datasets (@ref H5D functions) and property list functions that can + * used with datasets (@ref H5P functions) are listed below. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Dataset functions
FunctionPurpose
#H5DcreateCreates a dataset at the specified location. The + * C function is a macro: \see \ref api-compat-macros.
#H5Dcreate_anonCreates a dataset in a file without linking it into the file structure.
#H5DopenOpens an existing dataset. The C function is a macro: \see \ref api-compat-macros.
#H5DcloseCloses the specified dataset.
#H5Dget_spaceReturns an identifier for a copy of the dataspace for a dataset.
#H5Dget_space_statusDetermines whether space has been allocated for a dataset.
#H5Dget_typeReturns an identifier for a copy of the datatype for a dataset.
#H5Dget_create_plistReturns an identifier for a copy of the dataset creation property list for a dataset.
#H5Dget_access_plistReturns the dataset access property list associated with a dataset.
#H5Dget_offsetReturns the dataset address in a file.
#H5Dget_storage_sizeReturns the amount of storage required for a dataset.
#H5Dvlen_get_buf_sizeDetermines the number of bytes required to store variable-length (VL) data.
#H5Dvlen_reclaimReclaims VL datatype memory buffers.
#H5DreadReads raw data from a dataset into a buffer.
#H5DwriteWrites raw data from a buffer to a dataset.
#H5DiterateIterates over all selected elements in a dataspace.
#H5DgatherGathers data from a selection within a memory buffer.
#H5DscatterScatters data into a selection within a memory buffer.
#H5DfillFills dataspace elements with a fill value in a memory buffer.
#H5Dset_extentChanges the sizes of a dataset's dimensions.
+ * + * \anchor dcpl_table_tag Dataset creation property list functions (H5P) + * \snippet{doc} tables/propertyLists.dox dcpl_table + * + * \anchor dapl_table_tag Dataset access property list functions (H5P) + * \snippet{doc} tables/propertyLists.dox dapl_table + * + * \subsection subsec_dataset_program Programming Model for Datasets + * This section explains the programming model for datasets. + * + * \subsubsection subsubsec_dataset_program_general General Model + * + * The programming model for using a dataset has three main phases: + * \li Obtain access to the dataset + * \li Operate on the dataset using the dataset identifier returned at access + * \li Release the dataset + * + * These three phases or steps are described in more detail below the figure. + * + * A dataset may be opened several times and operations performed with several different + * identifiers to the same dataset. All the operations affect the dataset although the calling program + * must synchronize if necessary to serialize accesses. + * + * Note that the dataset remains open until every identifier is closed. The figure below shows the + * basic sequence of operations. + * + * + * + * + * + *
+ * \image html Dsets_fig2.gif "Dataset programming sequence" + *
+ * + * Creation and data access operations may have optional parameters which are set with property + * lists. The general programming model is: + * \li Create property list of appropriate class (dataset create, dataset transfer) + * \li Set properties as needed; each type of property has its own format and datatype + * \li Pass the property list as a parameter of the API call + * + * The steps below describe the programming phases or steps for using a dataset. + *

Step 1. Obtain Access

+ * A new dataset is created by a call to #H5Dcreate. If successful, the call returns an identifier for the + * newly created dataset. + * + * Access to an existing dataset is obtained by a call to #H5Dopen. This call returns an identifier for + * the existing dataset. + * + * An object reference may be dereferenced to obtain an identifier to the dataset it points to. + * + * In each of these cases, the successful call returns an identifier to the dataset. The identifier is + * used in subsequent operations until the dataset is closed. + * + *

Step 2. Operate on the Dataset

+ * The dataset identifier can be used to write and read data to the dataset, to query and set + * properties, and to perform other operations such as adding attributes, linking in groups, and + * creating references. + * + * The dataset identifier can be used for any number of operations until the dataset is closed. + * + *

Step 3. Close the Dataset

+ * When all operations are completed, the dataset identifier should be closed with a call to + * #H5Dclose. This releases the dataset. + * + * After the identifier is closed, it cannot be used for further operations. + * + * \subsubsection subsubsec_dataset_program_create Create Dataset + * + * A dataset is created and initialized with a call to #H5Dcreate. The dataset create operation sets + * permanent properties of the dataset: + * \li Name + * \li Dataspace + * \li Datatype + * \li Storage properties + * + * These properties cannot be changed for the life of the dataset, although the dataspace may be + * expanded up to its maximum dimensions. + * + *

Name

+ * A dataset name is a sequence of alphanumeric ASCII characters. The full name would include a + * tracing of the group hierarchy from the root group of the file. An example is + * /rootGroup/groupA/subgroup23/dataset1. The local name or relative name within the lowest- + * level group containing the dataset would include none of the group hierarchy. An example is + * Dataset1. + * + *

Dataspace

+ * The dataspace of a dataset defines the number of dimensions and the size of each dimension. The + * dataspace defines the number of dimensions, and the maximum dimension sizes and current size + * of each dimension. The maximum dimension size can be a fixed value or the constant + * #H5S_UNLIMITED, in which case the actual dimension size can be changed with calls to + * #H5Dset_extent, up to the maximum set with the maxdims parameter in the #H5Screate_simple + * call that established the dataset's original dimensions. The maximum dimension size is set when + * the dataset is created and cannot be changed. + * + *

Datatype

+ * Raw data has a datatype which describes the layout of the raw data stored in the file. The + * datatype is set when the dataset is created and can never be changed. When data is transferred to + * and from the dataset, the HDF5 library will assure that the data is transformed to and from the + * stored format. + * + *

Storage Properties

+ * Storage properties of the dataset are set when it is created. The required inputs table below shows + * the categories of storage properties. The storage properties cannot be changed after the dataset is + * created. + * + *

Filters

+ * When a dataset is created, optional filters are specified. The filters are added to the data transfer + * pipeline when data is read or written. The standard library includes filters to implement + * compression, data shuffling, and error detection code. Additional user-defined filters may also be + * used. + * + * The required filters are stored as part of the dataset, and the list may not be changed after the + * dataset is created. The HDF5 library automatically applies the filters whenever data is + * transferred. + * + *

Summary

+ * + * A newly created dataset has no attributes and no data values. The dimensions, datatype, storage + * properties, and selected filters are set. The table below lists the required inputs, and the second + * table below lists the optional inputs. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Required inputs
Required InputsDescription
DataspaceThe shape of the array.
DatatypeThe layout of the stored elements.
NameThe name of the dataset in the group.
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Optional inputs
Optional InputsDescription
Storage LayoutHow the data is organized in the file including chunking.
Fill ValueThe behavior and value for uninitialized data.
External StorageOption to store the raw data in an external file.
FiltersSelect optional filters to be applied. One of the filters that might be applied is compression.
+ * + *

Example

+ * To create a new dataset, go through the following general steps: + * \li Set dataset characteristics (optional where default settings are acceptable) + * \li Datatype + * \li Dataspace + * \li Dataset creation property list + * \li Create the dataset + * \li Close the datatype, dataspace, and property list (as necessary) + * \li Close the dataset + * + * Example 1 below shows example code to create an empty dataset. The dataspace is 7 x 8, and the + * datatype is a big-endian integer. The dataset is created with the name “dset1” and is a member of + * the root group, “/”. + * + * Example 1. Create an empty dataset + * \code + * hid_t dataset, datatype, dataspace; + * + * // Create dataspace: Describe the size of the array and create the dataspace for fixed-size dataset. + * dimsf[0] = 7; + * dimsf[1] = 8; + * dataspace = H5Screate_simple(2, dimsf, NULL); + * + * // Define datatype for the data in the file. + * // For this example, store little-endian integer numbers. + * datatype = H5Tcopy(H5T_NATIVE_INT); + * status = H5Tset_order(datatype, H5T_ORDER_LE); + * + * // Create a new dataset within the file using defined + * // dataspace and datatype. No properties are set. + * dataset = H5Dcreate(file, "/dset", datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * H5Dclose(dataset); + * H5Sclose(dataspace); + * H5Tclose(datatype); + * \endcode + * + * Example 2, below, shows example code to create a similar dataset with a fill value of ‘-1’. This + * code has the same steps as in the example above, but uses a non-default property list. A file + * creation property list is created, and then the fill value is set to the desired value. Then the + * property list is passed to the #H5Dcreate call. + * + * Example 2. Create a dataset with fill value set + * \code + * hid_t plist; // property list + * hid_t dataset, datatype, dataspace; + * int fillval = -1; + * + * dimsf[0] = 7; + * dimsf[1] = 8; + * dataspace = H5Screate_simple(2, dimsf, NULL); + * datatype = H5Tcopy(H5T_NATIVE_INT); + * status = H5Tset_order(datatype, H5T_ORDER_LE); + * + * // Example of Dataset Creation property list: set fill value to '-1' + * plist = H5Pcreate(H5P_DATASET_CREATE); + * status = H5Pset_fill_value(plist, datatype, &fillval); + * + * // Same as above, but use the property list + * dataset = H5Dcreate(file, "/dset", datatype, dataspace, H5P_DEFAULT, plist, H5P_DEFAULT); + * H5Dclose(dataset); + * H5Sclose(dataspace); + * H5Tclose(datatype); + * H5Pclose(plist); + * \endcode + * + * After this code is executed, the dataset has been created and written to the file. The data array is + * uninitialized. Depending on the storage strategy and fill value options that have been selected, + * some or all of the space may be allocated in the file, and fill values may be written in the file. + * + * \subsubsection subsubsec_dataset_program_transfer Data Transfer Operations on a Dataset + * Data is transferred between memory and the raw data array of the dataset through #H5Dwrite and + * #H5Dread operations. A data transfer has the following basic steps: + * \li 1. Allocate and initialize memory space as needed + * \li 2. Define the datatype of the memory elements + * \li 3. Define the elements to be transferred (a selection, or all the elements) + * \li 4. Set data transfer properties (including parameters for filters or file drivers) as needed + * \li 5. Call the @ref H5D API + * + * Note that the location of the data in the file, the datatype of the data in the file, the storage + * properties, and the filters do not need to be specified because these are stored as a permanent part + * of the dataset. A selection of elements from the dataspace is specified; the selected elements may + * be the whole dataspace. + * + * The following figure shows a diagram of a write operation which + * transfers a data array from memory to a dataset in the file (usually on disk). A read operation has + * similar parameters with the data flowing the other direction. + * + * + * + * + * + *
+ * \image html Dsets_fig3.gif "A write operation" + *
+ * + *

Memory Space

+ * The calling program must allocate sufficient memory to store the data elements to be transferred. + * For a write (from memory to the file), the memory must be initialized with the data to be written + * to the file. For a read, the memory must be large enough to store the elements that will be read. + * The amount of storage needed can be computed from the memory datatype (which defines the + * size of each data element) and the number of elements in the selection. + * + *

Memory Datatype

+ * The memory layout of a single data element is specified by the memory datatype. This specifies + * the size, alignment, and byte order of the element as well as the datatype class. Note that the + * memory datatype must be the same datatype class as the file, but may have different byte order + * and other properties. The HDF5 Library automatically transforms data elements between the + * source and destination layouts. For more information, \ref sec_datatype. + * + * For a write, the memory datatype defines the layout of the data to be written; an example is IEEE + * floating-point numbers in native byte order. If the file datatype (defined when the dataset is + * created) is different but compatible, the HDF5 Library will transform each data element when it + * is written. For example, if the file byte order is different than the native byte order, the HDF5 + * library will swap the bytes. + * + * For a read, the memory datatype defines the desired layout of the data to be read. This must be + * compatible with the file datatype, but should generally use native formats such as byte orders. + * The HDF5 library will transform each data element as it is read. + * + *

Selection

+ * The data transfer will transfer some or all of the elements of the dataset depending on the + * dataspace selection. The selection has two dataspace objects: one for the source, and one for the + * destination. These objects describe which elements of the dataspace to be transferred. Some + * (partial I/O) or all of the data may be transferred. Partial I/O is defined by defining hyperslabs or + * lists of elements in a dataspace object. + * + * The dataspace selection for the source defines the indices of the elements to be read or written. + * The two selections must define the same number of points, but the order and layout may be + * different. The HDF5 Library automatically selects and distributes the elements according to the + * selections. It might, for example, perform a scatter-gather or sub-set of the data. + * + *

Data Transfer Properties

+ * For some data transfers, additional parameters should be set using the transfer property list. The + * table below lists the categories of transfer properties. These properties set parameters for the + * HDF5 Library and may be used to pass parameters for optional filters and file drivers. For + * example, transfer properties are used to select independent or collective operation when using + * MPI-I/O. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Categories of transfer properties
PropertiesDescription
Library parametersInternal caches, buffers, B-Trees, etc.
Memory managementVariable-length memory management, data overwrite
File driver managementParameters for file drivers
Filter managementParameters for filters
+ * + *

Data Transfer Operation (Read or Write)

+ * The data transfer is done by calling #H5Dread or #H5Dwrite with the parameters described above. + * The HDF5 Library constructs the required pipeline, which will scatter-gather, transform + * datatypes, apply the requested filters, and use the correct file driver. + * + * During the data transfer, the transformations and filters are applied to each element of the data in + * the required order until all the data is transferred. + * + *

Summary

+ * To perform a data transfer, it is necessary to allocate and initialize memory, describe the source + * and destination, set required and optional transfer properties, and call the \ref H5D API. + * + *

Examples

+ * The basic procedure to write to a dataset is the following: + * \li Open the dataset. + * \li Set the dataset dataspace for the write (optional if dataspace is #H5S_ALL). + * \li Write data. + * \li Close the datatype, dataspace, and property list (as necessary). + * \li Close the dataset. + * + * Example 3 below shows example code to write a 4 x 6 array of integers. In the example, the data + * is initialized in the memory array dset_data. The dataset has already been created in the file, so it + * is opened with H5Dopen. + * + * The data is written with #H5Dwrite. The arguments are the dataset identifier, the memory + * datatype (#H5T_NATIVE_INT), the memory and file selections (#H5S_ALL in this case: the + * whole array), and the default (empty) property list. The last argument is the data to be + * transferred. + * + * Example 3. Write an array of integers + * \code + * hid_t file_id, dataset_id; // identifiers + * herr_t status; + * int i, j, dset_data[4][6]; + * + * // Initialize the dataset. + * for (i = 0; i < 4; i++) + * for (j = 0; j < 6; j++) + * dset_data[i][j] = i * 6 + j + 1; + * + * // Open an existing file. + * file_id = H5Fopen("dset.h5", H5F_ACC_RDWR, H5P_DEFAULT); + * + * // Open an existing dataset. + * dataset_id = H5Dopen(file_id, "/dset", H5P_DEFAULT); + * + * // Write the entire dataset, using 'dset_data': memory type is 'native int' + * // write the entire dataspace to the entire dataspace, no transfer properties + * status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); + * + * status = H5Dclose(dataset_id); + * \endcode + * + * Example 4 below shows a similar write except for setting a non-default value for the transfer + * buffer. The code is the same as Example 3, but a transfer property list is created, and the desired + * buffer size is set. The #H5Dwrite function has the same arguments, but uses the property list to set + * the buffer. + * + * Example 4. Write an array using a property list + * \code + * hid_t file_id, dataset_id; + * hid_t xferplist; + * herr_t status; + * int i, j, dset_data[4][6]; + * + * file_id = H5Fopen("dset.h5", H5F_ACC_RDWR, H5P_DEFAULT); + * dataset_id = H5Dopen(file_id, "/dset", H5P_DEFAULT); + * + * // Example: set type conversion buffer to 64MB + * xferplist = H5Pcreate(H5P_DATASET_XFER); + * status = H5Pset_buffer( xferplist, 64 * 1024 *1024, NULL, NULL); + * + * // Write the entire dataset, using 'dset_data': memory type is 'native int' + * write the entire dataspace to the entire dataspace, set the buffer size with the property list + * status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xferplist, dset_data); + * + * status = H5Dclose(dataset_id); + * \endcode + * + * The basic procedure to read from a dataset is the following: + * \li Define the memory dataspace of the read (optional if dataspace is #H5S_ALL). + * \li Open the dataset. + * \li Get the dataset dataspace (if using #H5S_ALL above). + * + * Else define dataset dataspace of read. + * \li Define the memory datatype (optional). + * \li Define the memory buffer. + * \li Open the dataset. + * \li Read data. + * \li Close the datatype, dataspace, and property list (as necessary). + * \li Close the dataset. + * + * The example below shows code that reads a 4 x 6 array of integers from a dataset called “dset1”. + * First, the dataset is opened. The #H5Dread call has parameters: + * \li The dataset identifier (from #H5Dopen) + * \li The memory datatype (#H5T_NATIVE_INT) + * \li The memory and file dataspace (#H5S_ALL, the whole array) + * \li A default (empty) property list + * \li The memory to be filled + * + * Example 5. Read an array from a dataset + * \code + * hid_t file_id, dataset_id; + * herr_t status; + * int i, j, dset_data[4][6]; + * + * // Open an existing file. + * file_id = H5Fopen("dset.h5", H5F_ACC_RDWR, H5P_DEFAULT); + * + * // Open an existing dataset. + * dataset_id = H5Dopen(file_id, "/dset", H5P_DEFAULT); + * + * // read the entire dataset, into 'dset_data': memory type is 'native int' + * // read the entire dataspace to the entire dataspace, no transfer properties, + * status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); + * + * status = H5Dclose(dataset_id); + * \endcode + * + * \subsubsection subsubsec_dataset_program_read Retrieve the Properties of a Dataset + * The functions listed below allow the user to retrieve information regarding a dataset including + * the datatype, the dataspace, the dataset creation property list, and the total stored size of the data. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Retrieve dataset information
Query FunctionDescription
H5Dget_spaceRetrieve the dataspace of the dataset as stored in the file.
H5Dget_typeRetrieve the datatype of the dataset as stored in the file.
H5Dget_create_plistRetrieve the dataset creation properties.
H5Dget_storage_sizeRetrieve the total bytes for all the data of the dataset.
H5Dvlen_get_buf_sizeRetrieve the total bytes for all the variable-length data of the dataset.
+ * + * The example below illustrates how to retrieve dataset information. + * + * Example 6. Retrieve dataset + * \code + * hid_t file_id, dataset_id; + * hid_t dspace_id, dtype_id, plist_id; + * herr_t status; + * + * // Open an existing file. + * file_id = H5Fopen("dset.h5", H5F_ACC_RDWR, H5P_DEFAULT); + * + * // Open an existing dataset. + * dataset_id = H5Dopen(file_id, "/dset", H5P_DEFAULT); + * dspace_id = H5Dget_space(dataset_id); + * dtype_id = H5Dget_type(dataset_id); + * plist_id = H5Dget_create_plist(dataset_id); + * + * // use the objects to discover the properties of the dataset + * status = H5Dclose(dataset_id); + * \endcode + * + * \subsection subsec_dataset_transfer Data Transfer + * The HDF5 library implements data transfers through a pipeline which implements data + * transformations (according to the datatype and selections), chunking (as requested), and I/O + * operations using different mechanisms (file drivers). The pipeline is automatically configured by + * the HDF5 library. Metadata is stored in the file so that the correct pipeline can be constructed to + * retrieve the data. In addition, optional filters such as compression may be added to the standard + * pipeline. + * + * The figure below illustrates data layouts for different layers of an application using HDF5. The + * application data is organized as a multidimensional array of elements. The HDF5 format + * specification defines the stored layout of the data and metadata. The storage layout properties + * define the organization of the abstract data. This data is written to and read from some storage + * medium. + * + * + * + * + * + *
+ * \image html Dsets_fig4.gif "Data layouts in an application" + *
+ * + * The last stage of a write (and first stage of a read) is managed by an HDF5 file driver module. + * The virtual file layer of the HDF5 Library implements a standard interface to alternative I/O + * methods, including memory (AKA “core”) files, single serial file I/O, multiple file I/O, and + * parallel I/O. The file driver maps a simple abstract HDF5 file to the specific access methods. + * + * The raw data of an HDF5 dataset is conceived to be a multidimensional array of data elements. + * This array may be stored in the file according to several storage strategies: + * \li Contiguous + * \li Chunked + * \li Compact + * + * The storage strategy does not affect data access methods except that certain operations may be + * more or less efficient depending on the storage strategy and the access patterns. + * + * Overall, the data transfer operations (#H5Dread and #H5Dwrite) work identically for any storage + * method, for any file driver, and for any filters and transformations. The HDF5 library + * automatically manages the data transfer process. In some cases, transfer properties should or + * must be used to pass additional parameters such as MPI/IO directives when using the parallel file + * driver. + * + * \subsubsection subsubsec_dataset_transfer_pipe The Data Pipeline + * When data is written or read to or from an HDF5 file, the HDF5 library passes the data through a + * sequence of processing steps which are known as the HDF5 data pipeline. This data pipeline + * performs operations on the data in memory such as byte swapping, alignment, scatter-gather, and + * hyperslab selections. The HDF5 library automatically determines which operations are needed + * and manages the organization of memory operations such as extracting selected elements from a + * data block. The data pipeline modules operate on data buffers: each module processes a buffer + * and passes the transformed buffer to the next stage. + * + * The table below lists the stages of the data pipeline. The figure below the table shows the order + * of processing during a read or write. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Stages of the data pipeline
LayersDescription
I/O initiationInitiation of HDF5 I/O activities (#H5Dwrite and #H5Dread) in a user's application program.
Memory hyperslab operationData is scattered to (for read), or gathered from (for write) the application's memory buffer + * (bypassed if no datatype conversion is needed).
Datatype conversionDatatype is converted if it is different between memory and storage (bypassed if no datatype + * conversion is needed).
File hyperslab operationData is gathered from (for read), or scattered to (for write) to file space in memory (bypassed + * if no datatype conversion is needed).
Filter pipelineData is processed by filters when it passes. Data can be modified and restored here (bypassed + * if no datatype conversion is needed, no filter is enabled, or dataset is not chunked).
Virtual File LayerFacilitate easy plug-in file drivers such as MPIO or POSIX I/O.
Actual I/OActual file driver used by the library such as MPIO or STDIO.
+ * + * + * + * + * + *
+ * \image html Dsets_fig5.gif "The processing order in the data pipeline" + *
+ * + * The HDF5 library automatically applies the stages as needed. + * + * When the memory dataspace selection is other than the whole dataspace, the memory hyperslab + * stage scatters/gathers the data elements between the application memory (described by the + * selection) and a contiguous memory buffer for the pipeline. On a write, this is a gather operation; + * on a read, this is a scatter operation. + * + * When the memory datatype is different from the file datatype, the datatype conversion stage + * transforms each data element. For example, if data is written from 32-bit big-endian memory, + * and the file datatype is 32-bit little-endian, the datatype conversion stage will swap the bytes of + * every element. Similarly, when data is read from the file to native memory, byte swapping will + * be applied automatically when needed. + * + * The file hyperslab stage is similar to the memory hyperslab stage, but is managing the + * arrangement of the elements according to the dataspace selection. When data is read, data + * elements are gathered from the data blocks from the file to fill the contiguous buffers which are + * then processed by the pipeline. When data is read, the elements from a buffer are scattered to the + * data blocks of the file. + * + * \subsubsection subsubsec_dataset_transfer_filter Data Pipeline Filters + * In addition to the standard pipeline, optional stages, called filters, can be inserted in the pipeline. + * The standard distribution includes optional filters to implement compression and error checking. + * User applications may add custom filters as well. + * + * The HDF5 library distribution includes or employs several optional filters. These are listed in the + * table below. The filters are applied in the pipeline between the virtual file layer and the file + * hyperslab operation. See the figure above. The application can use any number of filters in any + * order. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Data pipeline filters
FilterDescription
gzip compressionData compression using zlib.
Szip compressionData compression using the Szip library. See The HDF Group website for more information + * regarding the Szip filter.
N-bit compressionData compression using an algorithm specialized for n-bit datatypes.
Scale-offset compressionData compression using a “scale and offset” algorithm.
ShufflingTo improve compression performance, data is regrouped by its byte position in the data + * unit. In other words, the 1st, 2nd, 3rd, and 4th bytes of integers are stored together + * respectively.
Fletcher32Fletcher32 checksum for error-detection.
+ * + * Filters may be used only for chunked data and are applied to chunks of data between the file + * hyperslab stage and the virtual file layer. At this stage in the pipeline, the data is organized as + * fixed-size blocks of elements, and the filter stage processes each chunk separately. + * + * Filters are selected by dataset creation properties, and some behavior may be controlled by data + * transfer properties. The library determines what filters must be applied and applies them in the + * order in which they were set by the application. That is, if an application calls + * #H5Pset_shuffle and then #H5Pset_deflate when creating a dataset's creation property list, the + * library will apply the shuffle filter first and then the deflate filter. + * + * For more information, + * \li @see @ref subsubsec_dataset_filters_nbit + * \li @see @ref subsubsec_dataset_filters_scale + * + * \subsubsection subsubsec_dataset_transfer_drive File Drivers + * I/O is performed by the HDF5 virtual file layer. The file driver interface writes and reads blocks + * of data; each driver module implements the interface using different I/O mechanisms. The table + * below lists the file drivers currently supported. Note that the I/O mechanisms are separated from + * the pipeline processing: the pipeline and filter operations are identical no matter what data access + * mechanism is used. + * + * \snippet{doc} tables/propertyLists.dox lcpl_table + * + * Each file driver writes/reads contiguous blocks of bytes from a logically contiguous address + * space. The file driver is responsible for managing the details of the different physical storage + * methods. + * + * In serial environments, everything above the virtual file layer tends to work identically no matter + * what storage method is used. + * + * Some options may have substantially different performance depending on the file driver that is + * used. In particular, multi-file and parallel I/O may perform considerably differently from serial + * drivers depending on chunking and other settings. + * + * \subsubsection subsubsec_dataset_transfer_props Data Transfer Properties to Manage the Pipeline + * Data transfer properties set optional parameters that control parts of the data pipeline. The + * function listing below shows transfer properties that control the behavior of the library. + * + * \snippet{doc} tables/fileDriverLists.dox file_driver_table + * + * Some filters and file drivers require or use additional parameters from the application program. + * These can be passed in the data transfer property list. The table below shows file driver property + * list functions. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
File driver property list functions
C FunctionPurpose
#H5Pset_dxpl_mpioControl the MPI I/O transfer mode (independent or collective) during data I/O operations.
#H5Pset_small_data_block_sizeReserves blocks of size bytes for the contiguous storage of the raw data portion of small + * datasets. The HDF5 Library then writes the raw data from small datasets to this reserved space + * which reduces unnecessary discontinuities within blocks of metadata and improves + * I/O performance.
#H5Pset_edc_checkDisable/enable EDC checking for read. When selected, EDC is always written.
+ * + * The transfer properties are set in a property list which is passed as a parameter of the #H5Dread or + * #H5Dwrite call. The transfer properties are passed to each pipeline stage. Each stage may use or + * ignore any property in the list. In short, there is one property list that contains all the properties. + * + * \subsubsection subsubsec_dataset_transfer_store Storage Strategies + * The raw data is conceptually a multi-dimensional array of elements that is stored as a contiguous + * array of bytes. The data may be physically stored in the file in several ways. The table below lists + * the storage strategies for a dataset. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Dataset storage strategies
Storage StrategyDescription
ContiguousThe dataset is stored as one continuous array of bytes.
Chunked The dataset is stored as fixed-size chunks.
CompactA small dataset is stored in the metadata header.
+ * + * The different storage strategies do not affect the data transfer operations of the dataset: reads and + * writes work the same for any storage strategy. + * + * These strategies are described in the following sections. + * + *

Contiguous

+ * A contiguous dataset is stored in the file as a header and a single continuous array of bytes. See + * the figure below. In the case of a multi-dimensional array, the data is serialized in row major order. By + * default, data is stored contiguously. + * + * + * + * + * + *
+ * \image html Dsets_fig6.gif "Contiguous data storage" + *
+ * + * Contiguous storage is the simplest model. It has several limitations. First, the dataset must be a + * fixed-size: it is not possible to extend the limit of the dataset or to have unlimited dimensions. In + * other words, if the number of dimensions of the array might change over time, then chunking + * storage must be used instead of contiguous. Second, because data is passed through the pipeline + * as fixed-size blocks, compression and other filters cannot be used with contiguous data. + * + *

Chunked

+ * The data of a dataset may be stored as fixed-size chunks. A chunk is a hyper- + * rectangle of any shape. When a dataset is chunked, each chunk is read or written as a single I/O + * operation, and individually passed from stage to stage of the data pipeline. + * + * + * + * + * + *
+ * \image html Dsets_fig7.gif "Chunked data storage" + *
+ * + * Chunks may be any size and shape that fits in the dataspace of the dataset. For example, a three + * dimensional dataspace can be chunked as 3-D cubes, 2-D planes, or 1-D lines. The chunks may + * extend beyond the size of the dataspace. For example, a 3 x 3 dataset might by chunked in 2 x 2 + * chunks. Sufficient chunks will be allocated to store the array, and any extra space will not be + * accessible. So, to store the 3 x 3 array, four 2 x 2 chunks would be allocated with 5 unused + * elements stored. + * + * Chunked datasets can be unlimited in any direction and can be compressed or filtered. + * + * Since the data is read or written by chunks, chunking can have a dramatic effect on performance + * by optimizing what is read and written. Note, too, that for specific access patterns such as + * parallel I/O, decomposition into chunks can have a large impact on performance. + * + * Two restrictions have been placed on chunk shape and size: + *
  • The rank of a chunk must be less than or equal to the rank of the dataset
  • + *
  • Chunk size cannot exceed the size of a fixed-size dataset; for example, a dataset consisting of + * a 5 x 4 fixed-size array cannot be defined with 10 x 10 chunks
+ * + *

Compact

+ * For contiguous and chunked storage, the dataset header information and data are stored in two + * (or more) blocks. Therefore, at least two I/O operations are required to access the data: one to + * access the header, and one (or more) to access data. For a small dataset, this is considerable + * overhead. + * + * A small dataset may be stored in a continuous array of bytes in the header block using the + * compact storage option. This dataset can be read entirely in one operation which retrieves the + * header and data. The dataset must fit in the header. This may vary depending on the metadata + * that is stored. In general, a compact dataset should be approximately 30 KB or less total size. + * + * + * + * + * + *
+ * \image html Dsets_fig8.gif "Compact data storage" + *
+ * + * \subsubsection subsubsec_dataset_transfer_partial Partial I/O Sub‐setting and Hyperslabs + * Data transfers can write or read some of the data elements of the dataset. This is controlled by + * specifying two selections: one for the source and one for the destination. Selections are specified + * by creating a dataspace with selections. + * + * Selections may be a union of hyperslabs or a list of points. A hyperslab is a contiguous hyper- + * rectangle from the dataspace. Selected fields of a compound datatype may be read or written. In + * this case, the selection is controlled by the memory and file datatypes. + * + * Summary of procedure: + * \li 1. Open the dataset + * \li 2. Define the memory datatype + * \li 3. Define the memory dataspace selection and file dataspace selection + * \li 4. Transfer data (#H5Dread or #H5Dwrite) + * + * For more information, + * @see @ref sec_dataspace + * + * \subsection subsec_dataset_allocation Allocation of Space in the File + * When a dataset is created, space is allocated in the file for its header and initial data. The amount +of space allocated when the dataset is created depends on the storage properties. When the +dataset is modified (data is written, attributes added, or other changes), additional storage may be +allocated if necessary. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Initial dataset size
ObjectSize
HeaderVariable, but typically around 256 bytes at the creation of a simple dataset with a simple + * datatype.
DataSize of the data array (number of elements x size of element). Space allocated in + * the file depends on the storage strategy and the allocation strategy.
+ * + *

Header

+ * A dataset header consists of one or more header messages containing persistent metadata + * describing various aspects of the dataset. These records are defined in the HDF5 File Format + * Specification. The amount of storage required for the metadata depends on the metadata to be + * stored. The table below summarizes the metadata. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Metadata storage sizes
Header InformationApproximate Storage Size
Datatype (required)Bytes or more. Depends on type.
Dataspace (required)Bytes or more. Depends on number of dimensions and hsize_t.
Layout (required)Points to the stored data. Bytes or more. Depends on hsize_t and number of dimensions.
FiltersDepends on the number of filters. The size of the filter message depends on the name and + * data that will be passed.
+ * + * The header blocks also store the name and values of attributes, so the total storage depends on + * the number and size of the attributes. + * + * In addition, the dataset must have at least one link, including a name, which is stored in the file + * and in the group it is linked from. + * + * The different storage strategies determine when and how much space is allocated for the data + * array. See the discussion of fill values below for a detailed explanation of the storage allocation. + * + *

Contiguous Storage

+ * For a continuous storage option, the data is stored in a single, contiguous block in the file. The + * data is nominally a fixed-size, (number of elements x size of element). The figure below shows + * an example of a two dimensional array stored as a contiguous dataset. + * + * Depending on the fill value properties, the space may be allocated when the dataset is created or + * when first written (default), and filled with fill values if specified. For parallel I/O, by default the + * space is allocated when the dataset is created. + * + * + * + * + * + *
+ * \image html Dsets_fig9.gif "A two dimensional array stored as a contiguous dataset" + *
+ * + *

Chunked Storage

+ * For chunked storage, the data is stored in one or more chunks. Each chunk is a continuous block + * in the file, but chunks are not necessarily stored contiguously. Each chunk has the same size. The + * data array has the same nominal size as a contiguous array (number of elements x size of + * element), but the storage is allocated in chunks, so the total size in the file can be larger than the + * nominal size of the array. See the figure below. + * + * If a fill value is defined, each chunk will be filled with the fill value. Chunks must be allocated + * when data is written, but they may be allocated when the file is created, as the file expands, or + * when data is written. + * + * For serial I/O, by default chunks are allocated incrementally, as data is written to the chunk. For + * a sparse dataset, chunks are allocated only for the parts of the dataset that are written. In this + * case, if the dataset is extended, no storage is allocated. + * + * For parallel I/O, by default chunks are allocated when the dataset is created or extended with fill + * values written to the chunk. + * + * In either case, the default can be changed using fill value properties. For example, using serial + * I/O, the properties can select to allocate chunks when the dataset is created. + * + * + * + * + * + *
+ * \image html Dsets_fig10.gif "A two dimensional array stored in chunks" + *
+ * + *

Changing Dataset Dimensions

+ * #H5Dset_extent is used to change the current dimensions of the dataset within the limits of the + * dataspace. Each dimension can be extended up to its maximum or unlimited. Extending the + * dataspace may or may not allocate space in the file and may or may not write fill values, if they + * are defined. See the example code below. + * + * The dimensions of the dataset can also be reduced. If the sizes specified are smaller than the + * dataset's current dimension sizes, #H5Dset_extent will reduce the dataset's dimension sizes to the + * specified values. It is the user's responsibility to ensure that valuable data is not lost; + * #H5Dset_extent does not check. + * + * Using #H5Dset_extent to increase the size of a dataset + * \code + * hid_t file_id, dataset_id; + * herr_t status; + * size_t newdims[2]; + * + * // Open an existing file. + * file_id = H5Fopen("dset.h5", H5F_ACC_RDWR, H5P_DEFAULT); + * + * // Open an existing dataset. + * dataset_id = H5Dopen(file_id, "/dset", H5P_DEFAULT); + * + * // Example: dataset is 2 x 3, each dimension is UNLIMITED + * // extend to 2 x 7 + * newdims[0] = 2; + * newdims[1] = 7; + * status = H5Dset_extent(dataset_id, newdims); + * + * // dataset is now 2 x 7 + * + * status = H5Dclose(dataset_id); + * \endcode + * + * \subsubsection subsubsec_dataset_allocation_store Storage Allocation in the File: Early, Incremental, Late + * The HDF5 Library implements several strategies for when storage is allocated if and when it is + * filled with fill values for elements not yet written by the user. Different strategies are + * recommended for different storage layouts and file drivers. In particular, a parallel program + * needs storage allocated during a collective call (for example, create or extend), while serial + * programs may benefit from delaying the allocation until the data is written. + * + * Two file creation properties control when to allocate space, when to write the fill value, and the + * actual fill value to write. + * + *

When to Allocate Space

+ * The table below shows the options for when data is allocated in the file. Early allocation is done + * during the dataset create call. Certain file drivers (especially MPI-I/O and MPI-POSIX) require + * space to be allocated when a dataset is created, so all processors will have the correct view of the + * data. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
File storage allocation options
StrategyDescription
EarlyAllocate storage for the dataset immediately when the dataset is created.
LateDefer allocating space for storing the dataset until the dataset is written.
IncrementalDefer allocating space for storing each chunk until the chunk is written.
DefaultUse the strategy (Early, Late, or Incremental) for the storage method and + * access method. This is the recommended strategy.
+ * + * Late allocation is done at the time of the first write to dataset. Space for the whole dataset is + * allocated at the first write. + * + * Incremental allocation (chunks only) is done at the time of the first write to the chunk. Chunks + * that have never been written are not allocated in the file. In a sparsely populated dataset, this + * option allocates chunks only where data is actually written. + * + * The “Default” property selects the option recommended as appropriate for the storage method + * and access method. The defaults are shown in the table below. Note that Early allocation is + * recommended for all Parallel I/O, while other options are recommended as the default for serial + * I/O cases. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Default storage options
Storage TypeSerial I/OParallel I/O
ContiguousLateEarly
ChunkedIncrementalEarly
CompactEarlyEarly
+ * + *

When to Write the Fill Value

+ * The second property is when to write the fill value. The possible values are “Never” and + * “Allocation”. The table below shows these options. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
When to write fill values
WhenDescription
NeverFill value will never be written.
AllocationFill value is written when space is allocated. (Default for chunked and contiguous + * data storage.)
+ * + *

What Fill Value to Write

+ * The third property is the fill value to write. The table below shows the values. By default, the + * data is filled with zeros. The application may choose no fill value (Undefined). In this case, + * uninitialized data may have random values. The application may define a fill value of an + * appropriate type. For more information, @see @ref subsec_datatype_fill. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Fill values to write
What to WriteDescription
DefaultBy default, the library fills allocated space with zeros.
UndefinedAllocated space is filled with random values.
User-definedThe application specifies the fill value.
+ * + * Together these three properties control the library's behavior. The table below summarizes the + * possibilities during the dataset create-write-close cycle. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Storage allocation and fill summary
When to allocate spaceWhen to write fill valueWhat fill value to writeLibrary create-write-close behavior
EarlyNever-Library allocates space when dataset is created, but never writes a fill value to dataset. A read + * of unwritten data returns undefined values.
LateNever-Library allocates space when dataset is written to, but never writes a fill value to the dataset. A + * read of unwritten data returns undefined values.
IncrementalNever-Library allocates space when a dataset or chunk (whichever is the smallest unit of space) + * is written to, but it never writes a fill value to a dataset or a chunk. A read of unwritten data + * returns undefined values.
-AllocationUndefinedError on creating the dataset. The dataset is not created.
EarlyAllocationDefault or User-definedAllocate space for the dataset when the dataset is created. Write the fill value (default or + * user-defined) to the entire dataset when the dataset is created.
LateAllocationDefault or User-defineAllocate space for the dataset when the application first writes data values to the dataset. + * Write the fill value to the entire dataset before writing application data values.
IncrementalAllocationDefault or User-defineAllocate space for the dataset when the application first writes data values to the dataset or + * chunk (whichever is the smallest unit of space). Write the fill value to the entire dataset + * or chunk before writing application data values.
+ * + * During the #H5Dread function call, the library behavior depends on whether space has been + * allocated, whether the fill value has been written to storage, how the fill value is defined, and + * when to write the fill value. The table below summarizes the different behaviors. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
H5Dread summary
Is space allocated in the file?What is the fill value?When to write the fill value?Library read behavior
NoUndefinedanytimeError. Cannot create this dataset.
NoDefault or User-defineanytimeFill the memory buffer with the fill value.
YesUndefinedanytimeReturn data from storage (dataset). Trash is possible if the application has not written data + * to the portion of the dataset being read.
YesDefault or User-defineNeverReturn data from storage (dataset). Trash is possible if the application has not written data + * to the portion of the dataset being read.
YesDefault or User-defineAllocationReturn data from storage (dataset).
+ * + * There are two cases to consider depending on whether the space in the file has been allocated + * before the read or not. When space has not yet been allocated and if a fill value is defined, the + * memory buffer will be filled with the fill values and returned. In other words, no data has been + * read from the disk. If space has been allocated, the values are returned from the stored data. The + * unwritten elements will be filled according to the fill value. + * + * \subsubsection subsubsec_dataset_allocation_delete Deleting a Dataset from a File and Reclaiming Space + * HDF5 does not at this time provide an easy mechanism to remove a dataset from a file or to + * reclaim the storage space occupied by a deleted object. + * + * Removing a dataset and reclaiming the space it used can be done with the #H5Ldelete function + * and the h5repack utility program. With the H5Ldelete function, links to a dataset can be removed + * from the file structure. After all the links have been removed, the dataset becomes inaccessible to + * any application and is effectively removed from the file. The way to recover the space occupied + * by an unlinked dataset is to write all of the objects of the file into a new file. Any unlinked object + * is inaccessible to the application and will not be included in the new file. Writing objects to a + * new file can be done with a custom program or with the h5repack utility program. + * + * For more information, @see @ref sec_group + * + * \subsubsection subsubsec_dataset_allocation_release Releasing Memory Resources + * The system resources required for HDF5 objects such as datasets, datatypes, and dataspaces + * should be released once access to the object is no longer needed. This is accomplished via the + * appropriate close function. This is not unique to datasets but a general requirement when + * working with the HDF5 Library; failure to close objects will result in resource leaks. + * + * In the case where a dataset is created or data has been transferred, there are several objects that + * must be closed. These objects include datasets, datatypes, dataspaces, and property lists. + * + * The application program must free any memory variables and buffers it allocates. When + * accessing data from the file, the amount of memory required can be determined by calculating + * the size of the memory datatype and the number of elements in the memory selection. + * + * Variable-length data are organized in two or more areas of memory. For more information, + * \see \ref h4_vlen_datatype "Variable-length Datatypes". + * + * When writing data, the application creates an array of + * vl_info_t which contains pointers to the elements. The elements might be, for example, strings. + * In the file, the variable-length data is stored in two parts: a heap with the variable-length values + * of the data elements and an array of vl_info_t elements. When the data is read, the amount of + * memory required for the heap can be determined with the #H5Dvlen_get_buf_size call. + * + * The data transfer property may be used to set a custom memory manager for allocating variable- + * length data for a #H5Dread. This is set with the #H5Pset_vlen_mem_manager call. + * To free the memory for variable-length data, it is necessary to visit each element, free the + * variable-length data, and reset the element. The application must free the memory it has + * allocated. For memory allocated by the HDF5 Library during a read, the #H5Dvlen_reclaim + * function can be used to perform this operation. + * + * \subsubsection subsubsec_dataset_allocation_ext External Storage Properties + * The external storage format allows data to be stored across a set of non-HDF5 files. A set of + * segments (offsets and sizes) in one or more files is defined as an external file list, or EFL, and + * the contiguous logical addresses of the data storage are mapped onto these segments. Currently, + * only the #H5D_CONTIGUOUS storage format allows external storage. External storage is + * enabled by a dataset creation property. The table below shows the API. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
External storage API
FunctionDescription
#H5Pset_externalThis function adds a new segment to the end of the external file list of the specified dataset + * creation property list. The segment begins a byte offset of file name and continues for size + * bytes. The space represented by this segment is adjacent to the space already represented by + * the external file list. The last segment in a file list may have the size #H5F_UNLIMITED, in + * which case the external file may be of unlimited size and no more files can be added to the + * external files list.
#H5Pget_external_countCalling this function returns the number of segments in an external file list. If the dataset + * creation property list has no external data, then zero is returned.
#H5Pget_externalThis is the counterpart for the #H5Pset_external function. Given a dataset creation + * property list and a zero-based index into that list, the file name, byte offset, and segment + * size are returned through non-null arguments. At most name_size characters are copied into + * the name argument which is not null terminated if the file name is longer than the + * supplied name buffer (this is similar to strncpy()).
+ * + * The figure below shows an example of how a contiguous, one-dimensional dataset is partitioned + * into three parts and each of those parts is stored in a segment of an external file. The top + * rectangle represents the logical address space of the dataset while the bottom rectangle represents + * an external file. + * + * + * + * + * + *
+ * \image html Dsets_fig11.gif "External file storage" + *
+ * + * The example below shows code that defines the external storage for the example. Note that the + * segments are defined in order of the logical addresses they represent, not their order within the + * external file. It would also have been possible to put the segments in separate files. Care should + * be taken when setting up segments in a single file since the library does not automatically check + * for segments that overlap. + * + * External storage + * \code + * plist = H5Pcreate (H5P_DATASET_CREATE); + * H5Pset_external (plist, "velocity.data", 3000, 1000); + * H5Pset_external (plist, "velocity.data", 0, 2500); + * H5Pset_external (plist, "velocity.data", 4500, 1500); + * \endcode + * + * The figure below shows an example of how a contiguous, two-dimensional dataset is partitioned + * into three parts and each of those parts is stored in a separate external file. The top rectangle + * represents the logical address space of the dataset while the bottom rectangles represent external + * files. + * + * + * + * + * + *
+ * \image html Dsets_fig12.gif "Partitioning a 2-D dataset for external storage" + *
+ * + * The example below shows code for the partitioning described above. In this example, the library + * maps the multi-dimensional array onto a linear address space as defined by the HDF5 format + * specification, and then maps that address space into the segments defined in the external file list. + * + * Partitioning a 2-D dataset for external storage + * \code + * plist = H5Pcreate (H5P_DATASET_CREATE); + * H5Pset_external (plist, "scan1.data", 0, 24); + * H5Pset_external (plist, "scan2.data", 0, 24); + * H5Pset_external (plist, "scan3.data", 0, 16); + * \endcode + * + * The segments of an external file can exist beyond the end of the (external) file. The library reads + * that part of a segment as zeros. When writing to a segment that exists beyond the end of a file, + * the external file is automatically extended. Using this feature, one can create a segment (or set of + * segments) which is larger than the current size of the dataset. This allows the dataset to be + * extended at a future time (provided the dataspace also allows the extension). + * + * All referenced external data files must exist before performing raw data I/O on the dataset. This + * is normally not a problem since those files are being managed directly by the application or + * indirectly through some other library. However, if the file is transferred from its original context, + * care must be taken to assure that all the external files are accessible in the new location. + * + * \subsection subsec_dataset_filters Using HDF5 Filters + * This section describes in detail how to use the n-bit, scale-offset filters and szip filters. + * + * \subsubsection subsubsec_dataset_filters_nbit Using the N‐bit Filter + * N-bit data has n significant bits, where n may not correspond to a precise number of bytes. On + * the other hand, computing systems and applications universally, or nearly so, run most efficiently + * when manipulating data as whole bytes or multiple bytes. + * + * Consider the case of 12-bit integer data. In memory, that data will be handled in at least 2 bytes, + * or 16 bits, and on some platforms in 4 or even 8 bytes. The size of such a dataset can be + * significantly reduced when written to disk if the unused bits are stripped out. + * + * The n-bit filter is provided for this purpose, packing n-bit data on output by stripping off all + * unused bits and unpacking on input, restoring the extra bits required by the computational + * processor. + * + *

N-bit Datatype

+ * An n-bit datatype is a datatype of n significant bits. Unless it is packed, an n-bit datatype is + * presented as an n-bit bitfield within a larger-sized value. For example, a 12-bit datatype might be + * presented as a 12-bit field in a 16-bit, or 2-byte, value. + * + * Currently, the datatype classes of n-bit datatype or n-bit field of a compound datatype or an array + * datatype are limited to integer or floating-point. + * + * The HDF5 user can create an n-bit datatype through a series of function calls. For example, the + * following calls create a 16-bit datatype that is stored in a 32-bit value with a 4-bit offset: + * \code + * hid_t nbit_datatype = H5Tcopy(H5T_STD_I32LE); + * H5Tset_precision(nbit_datatype, 16); + * H5Tset_offset(nbit_datatype, 4); + * \endcode + * + * In memory, one value of the above example n-bit datatype would be stored on a little-endian + * machine as follows: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
byte 3byte 2byte 1byte 0
???????? ????SPPP PPPPPPPP PPPP????
+ * Note: Key: S - sign bit, E - exponent bit, M - mantissa bit, ? - padding bit. Sign bit is + * included in signed integer datatype precision. + *
+ * + *

N-bit Filter

+ * When data of an n-bit datatype is stored on disk using the n-bit filter, the filter packs the data by + * stripping off the padding bits; only the significant bits are retained and stored. The values on disk + * will appear as follows: + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
1st value2nd valuenth value
SPPPPPPP PPPPPPPPSPPPPPPP PPPPPPPP...
+ * Note: Key: S - sign bit, E - exponent bit, M - mantissa bit, ? - padding bit. Sign bit is + * included in signed integer datatype precision. + *
+ * + *

How Does the N-bit Filter Work?

+ * The n-bit filter always compresses and decompresses according to dataset properties supplied by + * the HDF5 library in the datatype, dataspace, or dataset creation property list. + * + * The dataset datatype refers to how data is stored in an HDF5 file while the memory datatype + * refers to how data is stored in memory. The HDF5 library will do datatype conversion when + * writing data in memory to the dataset or reading data from the dataset to memory if the memory + * datatype differs from the dataset datatype. Datatype conversion is performed by HDF5 library + * before n-bit compression and after n-bit decompression. + * + * The following sub-sections examine the common cases: + * \li N-bit integer conversions + * \li N-bit floating-point conversions + * + *

N-bit Integer Conversions

+ * Integer data with a dataset of integer datatype of less than full precision and a memory datatype + * of #H5T_NATIVE_INT, provides the simplest application of the n-bit filter. + * + * The precision of #H5T_NATIVE_INT is 8 multiplied by sizeof(int). This value, the size of an + * int in bytes, differs from platform to platform; we assume a value of 4 for the following + * illustration. We further assume the memory byte order to be little-endian. + * + * In memory, therefore, the precision of #H5T_NATIVE_INT is 32 and the offset is 0. One value of + * #H5T_NATIVE_INT is laid out in memory as follows: + * + * + * + * + *
+ * \image html Dsets_NbitInteger1.gif "H5T_NATIVE_INT in memory"
+ * Note: Key: S - sign bit, E - exponent bit, M - mantissa bit, ? - padding bit. Sign bit is + * included in signed integer datatype precision. + *
+ * + * Suppose the dataset datatype has a precision of 16 and an offset of 4. After HDF5 converts + * values from the memory datatype to the dataset datatype, it passes something like the following + * to the n-bit filter for compression: + * + * + * + * + *
+ * \image html Dsets_NbitInteger2.gif "Passed to the n-bit filter"
+ * Note: Key: S - sign bit, E - exponent bit, M - mantissa bit, ? - padding bit. Sign bit is + * included in signed integer datatype precision. + *
+ * + * Notice that only the specified 16 bits (15 significant bits and the sign bit) are retained in the + * conversion. All other significant bits of the memory datatype are discarded because the dataset + * datatype calls for only 16 bits of precision. After n-bit compression, none of these discarded bits, + * known as padding bits will be stored on disk. + * + *

N-bit Floating-point Conversions

+ * Things get more complicated in the case of a floating-point dataset datatype class. This sub- + * section provides an example that illustrates the conversion from a memory datatype of + * #H5T_NATIVE_FLOAT to a dataset datatype of class floating-point. + * + * As before, let the #H5T_NATIVE_FLOAT be 4 bytes long, and let the memory byte order be + * little-endian. Per the IEEE standard, one value of #H5T_NATIVE_FLOAT is laid out in memory + * as follows: + * + * + * + * + *
+ * \image html Dsets_NbitFloating1.gif "H5T_NATIVE_FLOAT in memory"
+ * Note: Key: S - sign bit, E - exponent bit, M - mantissa bit, ? - padding bit. Sign bit is + * included in floating-point datatype precision. + *
+ * + * Suppose the dataset datatype has a precision of 20, offset of 7, mantissa size of 13, mantissa + * position of 7, exponent size of 6, exponent position of 20, and sign position of 26. For more + * information, @see @ref subsubsec_datatype_program_define. + * + * After HDF5 converts values from the memory datatype to the dataset datatype, it passes + * something like the following to the n-bit filter for compression: + * + * + * + * + *
+ * \image html Dsets_NbitFloating2.gif "Passed to the n-bit filter"
+ * Note: Key: S - sign bit, E - exponent bit, M - mantissa bit, ? - padding bit. Sign bit is + * included in floating-point datatype precision. + *
+ * + * The sign bit and truncated mantissa bits are not changed during datatype conversion by the + * HDF5 library. On the other hand, the conversion of the 8-bit exponent to a 6-bit exponent is a + * little tricky: + * + * The bias for the new exponent in the n-bit datatype is: + * + * 2(n-1)-1 + * + * + * The following formula is used for this exponent conversion:
+ * + * exp8 - (2(8-1) -1) = exp6 - (2(6-1)-1) = actual exponent value + *
+ * where exp8 is the stored decimal value as represented by the 8-bit exponent, and exp6 is the + * stored decimal value as represented by the 6-bit exponent. + * + * In this example, caution must be taken to ensure that, after conversion, the actual exponent value + * is within the range that can be represented by a 6-bit exponent. For example, an 8-bit exponent + * can represent values from -127 to 128 while a 6-bit exponent can represent values only from -31 + * to 32. + * + *

N-bit Filter Behavior

+ * The n-bit filter was designed to treat the incoming data byte by byte at the lowest level. The + * purpose was to make the n-bit filter as generic as possible so that no pointer cast related to the + * datatype is needed. + * + * Bitwise operations are employed for packing and unpacking at the byte level. + * + * Recursive function calls are used to treat compound and array datatypes. + * + *

N-bit Compression

+ * The main idea of n-bit compression is to use a loop to compress each data element in a chunk. + * Depending on the datatype of each element, the n-bit filter will call one of four functions. Each + * of these functions performs one of the following tasks: + * \li Compress a data element of a no-op datatype + * \li Compress a data element of an atomic datatype + * \li Compress a data element of a compound datatype + * \li Compress a data element of an array datatype + * + * No-op datatypes: The n-bit filter does not actually compress no-op datatypes. Rather, it copies + * the data buffer of the no-op datatype from the non-compressed buffer to the proper location in + * the compressed buffer; the compressed buffer has no holes. The term “compress” is used here + * simply to distinguish this function from the function that performs the reverse operation during + * decompression. + * + * Atomic datatypes: The n-bit filter will find the bytes where significant bits are located and try to + * compress these bytes, one byte at a time, using a loop. At this level, the filter needs the following + * information: + *
  • The byte offset of the beginning of the current data element with respect to the + * beginning of the input data buffer
  • + *
  • Datatype size, precision, offset, and byte order
+ * + * The n-bit filter compresses from the most significant byte containing significant bits to the least + * significant byte. For big-endian data, therefore, the loop index progresses from smaller to larger + * while for little-endian, the loop index progresses from larger to smaller. + * + * In the extreme case of when the n-bit datatype has full precision, this function copies the content + * of the entire non-compressed datatype to the compressed output buffer. + * + * Compound datatypes: The n-bit filter will compress each data member of the compound + * datatype. If the member datatype is of an integer or floating-point datatype, the n-bit filter will + * call the function described above. If the member datatype is of a no-op datatype, the filter will + * call the function described above. If the member datatype is of a compound datatype, the filter + * will make a recursive call to itself. If the member datatype is of an array datatype, the filter will + * call the function described below. + * + * Array datatypes: The n-bit filter will use a loop to compress each array element in the array. If + * the base datatype of array element is of an integer or floating-point datatype, the n-bit filter will + * call the function described above. If the base datatype is of a no-op datatype, the filter will call + * the function described above. If the base datatype is of a compound datatype, the filter will call + * the function described above. If the member datatype is of an array datatype, the filter will make + * a recursive call of itself. + * + *

N-bit Decompression

+ * The n-bit decompression algorithm is very similar to n-bit compression. The only difference is + * that at the byte level, compression packs out all padding bits and stores only significant bits into + * a continuous buffer (unsigned char) while decompression unpacks significant bits and inserts + * padding bits (zeros) at the proper positions to recover the data bytes as they existed before + * compression. + * + *

Storing N-bit Parameters to Array cd_value[]

+ * All of the information, or parameters, required by the n-bit filter are gathered and stored in the + * array cd_values[] by the private function H5Z__set_local_nbit and are passed to another private + * function, H5Z__filter_nbit, by the HDF5 Library. + * These parameters are as follows: + * \li Parameters related to the datatype + * \li The number of elements within the chunk + * \li A flag indicating whether compression is needed + * + * The first and second parameters can be obtained using the HDF5 dataspace and datatype + * interface calls. + * + * A compound datatype can have members of array or compound datatype. An array datatype's + * base datatype can be a complex compound datatype. Recursive calls are required to set + * parameters for these complex situations. + * + * Before setting the parameters, the number of parameters should be calculated to dynamically + * allocate the array cd_values[], which will be passed to the HDF5 Library. This also requires + * recursive calls. + * + * For an atomic datatype (integer or floating-point), parameters that will be stored include the + * datatype's size, endianness, precision, and offset. + * + * For a no-op datatype, only the size is required. + * + * For a compound datatype, parameters that will be stored include the datatype's total size and + * number of members. For each member, its member offset needs to be stored. Other parameters + * for members will depend on the respective datatype class. + * + * For an array datatype, the total size parameter should be stored. Other parameters for the array's + * base type depend on the base type's datatype class. + * + * Further, to correctly retrieve the parameter for use of n-bit compression or decompression later, + * parameters for distinguishing between datatype classes should be stored. + * + *

Implementation

+ * Three filter callback functions were written for the n-bit filter: + * \li H5Z__can_apply_nbit + * \li H5Z__set_local_nbit + * \li H5Z__filter_nbit + * + * These functions are called internally by the HDF5 library. A number of utility functions were + * written for the function H5Z__set_local_nbit. Compression and decompression functions were + * written and are called by function H5Z__filter_nbit. All these functions are included in the file + * H5Znbit.c. + * + * The public function #H5Pset_nbit is called by the application to set up the use of the n-bit filter. + * This function is included in the file H5Pdcpl.c. The application does not need to supply any + * parameters. + * + *

How N-bit Parameters are Stored

+ * A scheme of storing parameters required by the n-bit filter in the array cd_values[] was + * developed utilizing recursive function calls. + * + * Four private utility functions were written for storing the parameters associated with atomic + * (integer or floating-point), no-op, array, and compound datatypes: + * \li H5Z__set_parms_atomic + * \li H5Z__set_parms_array + * \li H5Z__set_parms_nooptype + * \li H5Z__set_parms_compound + * + * The scheme is briefly described below. + * + * First, assign a numeric code for datatype class atomic (integer or float), no-op, array, and + * compound datatype. The code is stored before other datatype related parameters are stored. + * + * The first three parameters of cd_values[] are reserved for: + * \li 1. The number of valid entries in the array cd_values[] + * \li 2. A flag indicating whether compression is needed + * \li 3. The number of elements in the chunk + * + * Throughout the balance of this explanation, i represents the index of cd_values[]. + * In the function H5Z__set_local_nbit: + *
  • 1. i = 2
  • + *
  • 2. Get the number of elements in the chunk and store in cd_value[i]; increment i
  • + *
  • 3. Get the class of the datatype: + *
    • For an integer or floating-point datatype, call H5Z__set_parms_atomic
    • + *
    • For an array datatype, call H5Z__set_parms_array
    • + *
    • For a compound datatype, call H5Z__set_parms_compound
    • + *
    • For none of the above, call H5Z__set_parms_noopdatatype
  • + *
  • 4. Store i in cd_value[0] and flag in cd_values[1]
+ * + * In the function H5Z__set_parms_atomic: + * \li 1. Store the assigned numeric code for the atomic datatype in cd_value[i]; increment i + * \li 2. Get the size of the atomic datatype and store in cd_value[i]; increment i + * \li 3. Get the order of the atomic datatype and store in cd_value[i]; increment i + * \li 4. Get the precision of the atomic datatype and store in cd_value[i]; increment i + * \li 5. Get the offset of the atomic datatype and store in cd_value[i]; increment i + * \li 6. Determine the need to do compression at this point + * + * In the function H5Z__set_parms_nooptype: + * \li 1. Store the assigned numeric code for the no-op datatype in cd_value[i]; increment i + * \li 2. Get the size of the no-op datatype and store in cd_value[i]; increment i + * + * In the function H5Z__set_parms_array: + *
  • 1. Store the assigned numeric code for the array datatype in cd_value[i]; increment i
  • + *
  • 2. Get the size of the array datatype and store in cd_value[i]; increment i
  • + *
  • 3. Get the class of the array's base datatype. + *
    • For an integer or floating-point datatype, call H5Z__set_parms_atomic
    • + *
    • For an array datatype, call H5Z__set_parms_array
    • + *
    • For a compound datatype, call H5Z__set_parms_compound
    • + *
    • If none of the above, call H5Z__set_parms_noopdatatype
+ * + * In the function H5Z__set_parms_compound: + *
  • 1. Store the assigned numeric code for the compound datatype in cd_value[i]; increment i
  • + *
  • 2. Get the size of the compound datatype and store in cd_value[i]; increment i
  • + *
  • 3. Get the number of members and store in cd_values[i]; increment i
  • + *
  • 4. For each member + *
    • Get the member offset and store in cd_values[i]; increment i
    • + *
    • Get the class of the member datatype
    • + *
    • For an integer or floating-point datatype, call H5Z__set_parms_atomic
    • + *
    • For an array datatype, call H5Z__set_parms_array
    • + *
    • For a compound datatype, call H5Z__set_parms_compound
    • + *
    • If none of the above, call H5Z__set_parms_noopdatatype
+ * + *

N-bit Compression and Decompression Functions

+ * The n-bit compression and decompression functions above are called by the private HDF5 + * function H5Z__filter_nbit. The compress and decompress functions retrieve the n-bit parameters + * from cd_values[] as it was passed by H5Z__filter_nbit. Parameters are retrieved in exactly the + * same order in which they are stored and lower-level compression and decompression functions + * for different datatype classes are called. + * + * N-bit compression is not implemented in place. Due to the difficulty of calculating actual output + * buffer size after compression, the same space as that of the input buffer is allocated for the output + * buffer as passed to the compression function. However, the size of the output buffer passed by + * reference to the compression function will be changed (smaller) after the compression is + * complete. + * + *

Usage Examples

+ * + * The following code example illustrates the use of the n-bit filter for writing and reading n-bit + * integer data. + * + * N-bit compression for integer data + * \code + * #include "hdf5.h" + * #include "stdlib.h" + * #include "math.h" + * + * #define H5FILE_NAME "nbit_test_int.h5" + * #define DATASET_NAME "nbit_int" + * #define NX 200 + * #define NY 300 + * #define CH_NX 10 + * #define CH_NY 15 + * + * int main(void) + * { + * hid_t file, dataspace, dataset, datatype, mem_datatype, dset_create_props; + * hsize_t dims[2], chunk_size[2]; + * int orig_data[NX][NY]; + * int new_data[NX][NY]; + * int i, j; + * size_t precision, offset; + * + * // Define dataset datatype (integer), and set precision, offset + * datatype = H5Tcopy(H5T_NATIVE_INT); + * precision = 17; // precision includes sign bit + * if(H5Tset_precision(datatype,precision) < 0) { + * printf("Error: fail to set precision\n"); + * return -1; + * } + * offset = 4; + * if(H5Tset_offset(datatype,offset) < 0) { + * printf("Error: fail to set offset\n"); + * return -1; + * } + * + * // Copy to memory datatype + * mem_datatype = H5Tcopy(datatype); + * + * // Set order of dataset datatype + * if(H5Tset_order(datatype, H5T_ORDER_BE) < 0) { + * printf("Error: fail to set endianness\n"); + * return -1; + * } + * + * // Initialize data buffer with random data within correct + * // range corresponding to the memory datatype's precision + * // and offset. + * for (i = 0; i < NX; i++) + * for (j = 0; j < NY; j++) + * orig_data[i][j] = rand() % (int)pow(2, precision-1) << offset; + * + * // Describe the size of the array. + * dims[0] = NX; + * dims[1] = NY; + * if((dataspace = H5Screate_simple (2, dims, NULL)) < 0) { + * printf("Error: fail to create dataspace\n"); + * return -1; + * } + * + * // Create a new file using read/write access, default file + * // creation properties, and default file access properties. + * if((file = H5Fcreate (H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + * printf("Error: fail to create file\n"); + * return -1; + * } + * + * // Set the dataset creation property list to specify that + * // the raw data is to be partitioned into 10 x 15 element + * // chunks and that each chunk is to be compressed. + * chunk_size[0] = CH_NX; + * chunk_size[1] = CH_NY; + * if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE)) < 0) { + * printf("Error: fail to create dataset property\n"); + * return -1; + * } + * if(H5Pset_chunk (dset_create_props, 2, chunk_size) < 0) { + * printf("Error: fail to set chunk\n"); + * return -1; + * } + * + * // Set parameters for n-bit compression; check the description + * // of the H5Pset_nbit function in the HDF5 Reference Manual + * // for more information. + * if(H5Pset_nbit (dset_create_props) < 0) { + * printf("Error: fail to set nbit filter\n"); + * return -1; + * } + * + * // Create a new dataset within the file. The datatype + * // and dataspace describe the data on disk, which may + * // be different from the format used in the application's + * // memory. + * if((dataset = H5Dcreate(file, DATASET_NAME, datatype, dataspace, + * H5P_DEFAULT, dset_create_props, H5P_DEFAULT)) < 0) { + * printf("Error: fail to create dataset\n"); + * return -1; + * } + * + * // Write the array to the file. The datatype and dataspace + * // describe the format of the data in the 'orig_data' buffer. + * // The raw data is translated to the format required on disk, + * // as defined above. We use default raw data transfer + * // properties. + * if(H5Dwrite (dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) { + * printf("Error: fail to write to dataset\n"); + * return -1; + * } + * H5Dclose (dataset); + * + * if((dataset = H5Dopen(file, DATASET_NAME, H5P_DEFAULT)) < 0) { + * printf("Error: fail to open dataset\n"); + * return -1; + * } + * + * // Read the array. This is similar to writing data, + * // except the data flows in the opposite direction. + * // Note: Decompression is automatic. + * if(H5Dread (dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) { + * printf("Error: fail to read from dataset\n"); + * return -1; + * } + * + * H5Tclose (datatype); + * H5Tclose (mem_datatype); + * H5Dclose (dataset); + * H5Sclose (dataspace); + * H5Pclose (dset_create_props); + * H5Fclose (file); + * + * return 0; + * } + * \endcode + * + * The following code example illustrates the use of the n-bit filter for writing and reading n-bit + * floating-point data. + * + * N-bit compression for floating-point data + * \code + * #include "hdf5.h" + * + * #define H5FILE_NAME "nbit_test_float.h5" + * #define DATASET_NAME "nbit_float" + * #define NX 2 + * #define NY 5 + * #define CH_NX 2 + * #define CH_NY 5 + * + * int main(void) + * { + * hid_t file, dataspace, dataset, datatype, dset_create_props; + * hsize_t dims[2], chunk_size[2]; + * + * // orig_data[] are initialized to be within the range that + * // can be represented by dataset datatype (no precision + * // loss during datatype conversion) + * // + * float orig_data[NX][NY] = {{188384.00, 19.103516,-1.0831790e9, -84.242188, 5.2045898}, + * {-49140.000, 2350.2500, -3.2110596e-1, 6.4998865e-5, -0.0000000}}; + * float new_data[NX][NY]; + * size_t precision, offset; + * + * // Define single-precision floating-point type for dataset + * //--------------------------------------------------------------- + * // size=4 byte, precision=20 bits, offset=7 bits, + * // mantissa size=13 bits, mantissa position=7, + * // exponent size=6 bits, exponent position=20, + * // exponent bias=31. + * // It can be illustrated in little-endian order as: + * // (S - sign bit, E - exponent bit, M - mantissa bit, ? - padding bit) + * // + * // 3 2 1 0 + * // ?????SEE EEEEMMMM MMMMMMMM M??????? + * // + * // To create a new floating-point type, the following + * // properties must be set in the order of + * // set fields -> set offset -> set precision -> set size. + * // All these properties must be set before the type can + * // function. Other properties can be set anytime. Derived + * // type size cannot be expanded bigger than original size + * // but can be decreased. There should be no holes + * // among the significant bits. Exponent bias usually + * // is set 2^(n-1)-1, where n is the exponent size. + * //--------------------------------------------------------------- + * datatype = H5Tcopy(H5T_IEEE_F32BE); + * if(H5Tset_fields(datatype, 26, 20, 6, 7, 13) < 0) { + * printf("Error: fail to set fields\n"); + * return -1; + * } + * offset = 7; + * if(H5Tset_offset(datatype,offset) < 0) { + * printf("Error: fail to set offset\n"); + * return -1; + * } + * precision = 20; + * if(H5Tset_precision(datatype,precision) < 0) { + * printf("Error: fail to set precision\n"); + * return -1; + * } + * if(H5Tset_size(datatype, 4) < 0) { + * printf("Error: fail to set size\n"); + * return -1; + * } + * if(H5Tset_ebias(datatype, 31) < 0) { + * printf("Error: fail to set exponent bias\n"); + * return -1; + * } + * + * // Describe the size of the array. + * dims[0] = NX; + * dims[1] = NY; + * if((dataspace = H5Screate_simple (2, dims, NULL)) < 0) { + * printf("Error: fail to create dataspace\n"); + * return -1; + * } + * + * // Create a new file using read/write access, default file + * // creation properties, and default file access properties. + * if((file = H5Fcreate (H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + * printf("Error: fail to create file\n"); + * return -1; + * } + * + * // Set the dataset creation property list to specify that + * // the raw data is to be partitioned into 2 x 5 element + * // chunks and that each chunk is to be compressed. + * chunk_size[0] = CH_NX; + * chunk_size[1] = CH_NY; + * if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE)) < 0) { + * printf("Error: fail to create dataset property\n"); + * return -1; + * } + * if(H5Pset_chunk (dset_create_props, 2, chunk_size) < 0) { + * printf("Error: fail to set chunk\n"); + * return -1; + * } + * + * // Set parameters for n-bit compression; check the description + * // of the H5Pset_nbit function in the HDF5 Reference Manual + * // for more information. + * if(H5Pset_nbit (dset_create_props) < 0) { + * printf("Error: fail to set nbit filter\n"); + * return -1; + * } + * + * // Create a new dataset within the file. The datatype + * // and dataspace describe the data on disk, which may + * // be different from the format used in the application's memory. + * if((dataset = H5Dcreate(file, DATASET_NAME, datatype, dataspace, H5P_DEFAULT, + * dset_create_plists, H5P_DEFAULT)) < 0) { + * printf("Error: fail to create dataset\n"); + * return -1; + * } + * + * // Write the array to the file. The datatype and dataspace + * // describe the format of the data in the 'orig_data' buffer. + * // The raw data is translated to the format required on disk, + * // as defined above. We use default raw data transfer properties. + * if(H5Dwrite (dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) { + * printf("Error: fail to write to dataset\n"); + * return -1; + * } + * H5Dclose (dataset); + * if((dataset = H5Dopen(file, DATASET_NAME, H5P_DEFAULT))<0) { + * printf("Error: fail to open dataset\n"); + * return -1; + * } + * + * // Read the array. This is similar to writing data, + * // except the data flows in the opposite direction. + * // Note: Decompression is automatic. + * if(H5Dread (dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) { + * printf("Error: fail to read from dataset\n"); + * return -1; + * } + * H5Tclose (datatype); + * H5Dclose (dataset); + * H5Sclose (dataspace); + * H5Pclose (dset_create_props); + * H5Fclose (file); + * + * return 0 + * } + * \endcode + * + *

Limitations

+ * Because the array cd_values[] has to fit into an object header message of 64K, the n-bit filter has + * an upper limit on the number of n-bit parameters that can be stored in it. To be conservative, a + * maximum of 4K is allowed for the number of parameters. + * + * The n-bit filter currently only compresses n-bit datatypes or fields derived from integer or + * floating-point datatypes. The n-bit filter assumes padding bits of zero. This may not be true since + * the HDF5 user can set padding bit to be zero, one, or leave the background alone. However, it is + * expected the n-bit filter will be modified to adjust to such situations. + * + * The n-bit filter does not have a way to handle the situation where the fill value of a dataset is + * defined and the fill value is not of an n-bit datatype although the dataset datatype is. + * + * \subsubsection subsubsec_dataset_filters_scale Using the Scale‐offset Filter + * Generally speaking, scale-offset compression performs a scale and/or offset operation on each + * data value and truncates the resulting value to a minimum number of bits (minimum-bits) before + * storing it. + * + * The current scale-offset filter supports integer and floating-point datatypes only. For the floating- + * point datatype, float and double are supported, but long double is not supported. + * + * Integer data compression uses a straight-forward algorithm. Floating-point data compression + * adopts the GRiB data packing mechanism which offers two alternate methods: a fixed minimum- + * bits method, and a variable minimum-bits method. Currently, only the variable minimum-bits + * method is implemented. + * + * Like other I/O filters supported by the HDF5 library, applications using the scale-offset filter + * must store data with chunked storage. + * + * Integer type: The minimum-bits of integer data can be determined by the filter. For example, if + * the maximum value of data to be compressed is 7065 and the minimum value is 2970. Then the + * “span” of dataset values is equal to (max-min+1), which is 4676. If no fill value is defined for the + * dataset, the minimum-bits is: ceiling(log2(span)) = 12. With fill value set, the minimum-bits is: + * ceiling(log2(span+1)) = 13. + * + * HDF5 users can also set the minimum-bits. However, if the user gives a minimum-bits that is + * less than that calculated by the filter, the compression will be lossy. + * + * Floating-point type: The basic idea of the scale-offset filter for the floating-point type is to + * transform the data by some kind of scaling to integer data, and then to follow the procedure of + * the scale-offset filter for the integer type to do the data compression. Due to the data + * transformation from floating-point to integer, the scale-offset filter is lossy in nature. + * + * Two methods of scaling the floating-point data are used: the so-called D-scaling and E-scaling. + * D-scaling is more straightforward and easy to understand. For HDF5 1.8 release, only the + * D-scaling method had been implemented. + * + *

Design

+ * Before the filter does any real work, it needs to gather some information from the HDF5 Library + * through API calls. The parameters the filter needs are: + * \li The minimum-bits of the data value + * \li The number of data elements in the chunk + * \li The datatype class, size, sign (only for integer type), byte order, and fill value if defined + * + * Size and sign are needed to determine what kind of pointer cast to use when retrieving values + * from the data buffer. + * + * The pipeline of the filter can be divided into four parts: (1)pre-compression; (2)compression; + * (3)decompression; (4)post-decompression. + * + * Depending on whether a fill value is defined or not, the filter will handle pre-compression and + * post-decompression differently. + * + * The scale-offset filter only needs the memory byte order, size of datatype, and minimum-bits for + * compression and decompression. + * + * Since decompression has no access to the original data, the minimum-bits and the minimum + * value need to be stored with the compressed data for decompression and post-decompression. + * + *

Integer Type

+ * Pre-compression: During pre-compression minimum-bits is calculated if it is not set by the user. + * For more information on how minimum-bits are calculated, @see @ref subsubsec_dataset_filters_nbit. + * + * If the fill value is defined, finding the maximum and minimum values should ignore the data + * element whose value is equal to the fill value. + * + * If no fill value is defined, the value of each data element is subtracted by the minimum value + * during this stage. + * + * If the fill value is defined, the fill value is assigned to the maximum value. In this way minimum- + * bits can represent a data element whose value is equal to the fill value and subtracts the + * minimum value from a data element whose value is not equal to the fill value. + * + * The fill value (if defined), the number of elements in a chunk, the class of the datatype, the size + * of the datatype, the memory order of the datatype, and other similar elements will be stored in + * the HDF5 object header for the post-decompression usage. + * + * After pre-compression, all values are non-negative and are within the range that can be stored by + * minimum-bits. + * + * Compression: All modified data values after pre-compression are packed together into the + * compressed data buffer. The number of bits for each data value decreases from the number of + * bits of integer (32 for most platforms) to minimum-bits. The value of minimum-bits and the + * minimum value are added to the data buffer and the whole buffer is sent back to the library. In + * this way, the number of bits for each modified value is no more than the size of minimum-bits. + * + * Decompression: In this stage, the number of bits for each data value is resumed from minimum- + * bits to the number of bits of integer. + * + * Post-decompression: For the post-decompression stage, the filter does the opposite of what it + * does during pre-compression except that it does not calculate the minimum-bits or the minimum + * value. These values were saved during compression and can be retrieved through the resumed + * data buffer. If no fill value is defined, the filter adds the minimum value back to each data + * element. + * + * If the fill value is defined, the filter assigns the fill value to the data element whose value is equal + * to the maximum value that minimum-bits can represent and adds the minimum value back to + * each data element whose value is not equal to the maximum value that minimum-bits can + * represent. + * + * @anchor h4_float_datatype

Floating-point Type

+ * The filter will do data transformation from floating-point type to integer type and then handle the + * data by using the procedure for handling the integer data inside the filter. Insignificant bits of + * floating-point data will be cut off during data transformation, so this filter is a lossy compression + * method. + * + * There are two scaling methods: D-scaling and E-scaling. The HDF5 1.8 release only supports D- + * scaling. D-scaling is short for decimal scaling. E-scaling should be similar conceptually. In order + * to transform data from floating-point to integer, a scale factor is introduced. The minimum value + * will be calculated. Each data element value will subtract the minimum value. The modified data + * will be multiplied by 10 (Decimal) to the power of scale_factor, and only the integer part will be + * kept and manipulated through the routines for the integer type of the filter during pre- + * compression and compression. Integer data will be divided by 10 to the power of scale_factor to + * transform back to floating-point data during decompression and post-decompression. Each data + * element value will then add the minimum value, and the floating-point data are resumed. + * However, the resumed data will lose some insignificant bits compared with the original value. + * + * For example, the following floating-point data are manipulated by the filter, and the D-scaling + * factor is 2. + * {104.561, 99.459, 100.545, 105.644} + * + * The minimum value is 99.459, each data element subtracts 99.459, the modified data is + * {5.102, 0, 1.086, 6.185} + * + * Since the D-scaling factor is 2, all floating-point data will be multiplied by 10^2 with this result: + * {510.2, 0, 108.6, 618.5} + * + * The digit after decimal point will be rounded off, and then the set looks like: + * {510, 0, 109, 619} + * + * After decompression, each value will be divided by 10^2 and will be added to the offset 99.459. + * The floating-point data becomes + * {104.559, 99.459, 100.549, 105.649} + * + * The relative error for each value should be no more than 5* (10^(D-scaling factor +1)). + * D-scaling sometimes is also referred as a variable minimum-bits method since for different datasets + * the minimum-bits to represent the same decimal precision will vary. The data value is modified + * to 2 to power of scale_factor for E-scaling. E-scaling is also called fixed-bits method since for + * different datasets the minimum-bits will always be fixed to the scale factor of E-scaling. + * Currently, HDF5 ONLY supports the D-scaling (variable minimum-bits) method. + * + *

Implementation

+ * The scale-offset filter implementation was written and included in the file H5Zscaleoffset.c. + * Function #H5Pset_scaleoffset was written and included in the file “H5Pdcpl.c”. The HDF5 user + * can supply minimum-bits by calling function #H5Pset_scaleoffset. + * + * The scale-offset filter was implemented based on the design outlined in this section. However, + * the following factors need to be considered: + *
  1. + * The filter needs the appropriate cast pointer whenever it needs to retrieve data values. + *
  2. + *
  3. + * The HDF5 Library passes to the filter the to-be-compressed data in the format of the dataset + * datatype, and the filter passes back the decompressed data in the same format. If a fill value is + * defined, it is also in dataset datatype format. For example, if the byte order of the dataset data- + * type is different from that of the memory datatype of the platform, compression or decompression performs + * an endianness conversion of data buffer. Moreover, it should be aware that + * memory byte order can be different during compression and decompression. + *
  4. + *
  5. + * The difference of endianness and datatype between file and memory should be considered + * when saving and retrieval of minimum-bits, minimum value, and fill value. + *
  6. + * If the user sets the minimum-bits to full precision of the datatype, no operation is needed at + * the filter side. If the full precision is a result of calculation by the filter, then the minimum-bits + * needs to be saved for decompression but no compression or decompression is needed (only a + * copy of the input buffer is needed).
  7. + *
  8. + * If by calculation of the filter, the minimum-bits is equal to zero, special handling is needed. + * Since it means all values are the same, no compression or decompression is needed. But the + * minimum-bits and minimum value still need to be saved during compression.
  9. + *
  10. + * For floating-point data, the minimum value of the dataset should be calculated at first. Each + * data element value will then subtract the minimum value to obtain the “offset” data. The offset + * data will then follow the steps outlined above in the discussion of floating-point types to do data + * transformation to integer and rounding. For more information, @see @ref h4_float_datatype. + *
+ * + *

Usage Examples

+ * The following code example illustrates the use of the scale-offset filter for writing and reading + * integer data. + * + * Scale-offset compression integer data + * \code + * #include "hdf5.h" + * #include "stdlib.h" + * + * #define H5FILE_NAME "scaleoffset_test_int.h5" + * #define DATASET_NAME "scaleoffset_int" + * #define NX 200 + * #define NY 300 + * #define CH_NX 10 + * #define CH_NY 15 + * int main(void) + * { + * hid_t file, dataspace, dataset, datatype, dset_create_props; + * hsize_t dims[2], chunk_size[2]; + * int orig_data[NX][NY]; + * int new_data[NX][NY]; + * int i, j, fill_val; + * + * // Define dataset datatype + * datatype = H5Tcopy(H5T_NATIVE_INT); + * + * // Initialize data buffer + * for (i=0; i < NX; i++) + * for (j=0; j < NY; j++) + * orig_data[i][j] = rand() % 10000; + * + * // Describe the size of the array. + * dims[0] = NX; + * dims[1] = NY; + * if((dataspace = H5Screate_simple (2, dims, NULL)) < 0) { + * printf("Error: fail to create dataspace\n"); + * return -1; + * } + * + * // Create a new file using read/write access, default file + * // creation properties, and default file access properties. + * if((file = H5Fcreate (H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + * printf("Error: fail to create file\n"); + * return -1; + * } + * + * // Set the dataset creation property list to specify that + * // the raw data is to be partitioned into 10 x 15 element + * // chunks and that each chunk is to be compressed. + * chunk_size[0] = CH_NX; + * chunk_size[1] = CH_NY; + * if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE)) < 0) { + * printf("Error: fail to create dataset property\n"); + * return -1; + * } + * if(H5Pset_chunk (dset_create_props, 2, chunk_size) < 0) { + * printf("Error: fail to set chunk\n"); + * return -1; + * } + * + * // Set the fill value of dataset + * fill_val = 10000; + * if (H5Pset_fill_value(dset_create_props, H5T_NATIVE_INT, &fill_val)<0) { + * printf("Error: can not set fill value for dataset\n"); + * return -1; + * } + * + * // Set parameters for scale-offset compression. Check the + * // description of the H5Pset_scaleoffset function in the + * // HDF5 Reference Manual for more information. + * if(H5Pset_scaleoffset (dset_create_props, H5Z_SO_INT, H5Z_SO_INT_MINIMUMBITS_DEFAULT) < 0) { + * printf("Error: fail to set scaleoffset filter\n"); + * return -1; + * } + * + * // Create a new dataset within the file. The datatype + * // and dataspace describe the data on disk, which may + * // or may not be different from the format used in the + * // application's memory. The link creation and + * // dataset access property list parameters are passed + * // with default values. + * if((dataset = H5Dcreate (file, DATASET_NAME, datatype, dataspace, H5P_DEFAULT, + * dset_create_props, H5P_DEFAULT)) < 0) { + * printf("Error: fail to create dataset\n"); + * return -1; + * } + * + * // Write the array to the file. The datatype and dataspace + * // describe the format of the data in the 'orig_data' buffer. + * // We use default raw data transfer properties. + * if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) { + * printf("Error: fail to write to dataset\n"); + * return -1; + * } + * + * H5Dclose (dataset); + * + * if((dataset = H5Dopen(file, DATASET_NAME, H5P_DEFAULT)) < 0) { + * printf("Error: fail to open dataset\n"); + * return -1; + * } + * + * // Read the array. This is similar to writing data, + * // except the data flows in the opposite direction. + * // Note: Decompression is automatic. + * if(H5Dread (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) { + * printf("Error: fail to read from dataset\n"); + * return -1; + * } + * + * H5Tclose (datatype); + * H5Dclose (dataset); + * H5Sclose (dataspace); + * H5Pclose (dset_create_props); + * H5Fclose (file); + * + * return 0; + * } + * \endcode + * + * The following code example illustrates the use of the scale-offset filter (set for variable + * minimum-bits method) for writing and reading floating-point data. + * + * Scale-offset compression floating-point data + * \code + * #include "hdf5.h" + * #include "stdlib.h" + * + * #define H5FILE_NAME "scaleoffset_test_float_Dscale.h5" + * #define DATASET_NAME "scaleoffset_float_Dscale" + * #define NX 200 + * #define NY 300 + * #define CH_NX 10 + * #define CH_NY 15 + * + * int main(void) + * { + * hid_t file, dataspace, dataset, datatype, dset_create_props; + * hsize_t dims[2], chunk_size[2]; + * float orig_data[NX][NY]; + * float new_data[NX][NY]; + * float fill_val; + * int i, j; + * + * // Define dataset datatype + * datatype = H5Tcopy(H5T_NATIVE_FLOAT); + * + * // Initialize data buffer + * for (i=0; i < NX; i++) + * for (j=0; j < NY; j++) + * orig_data[i][j] = (rand() % 10000) / 1000.0; + * + * // Describe the size of the array. + * dims[0] = NX; + * dims[1] = NY; + * if((dataspace = H5Screate_simple (2, dims, NULL)) < 0) { + * printf("Error: fail to create dataspace\n"); + * return -1; + * } + * + * // Create a new file using read/write access, default file + * // creation properties, and default file access properties. + * if((file = H5Fcreate (H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + * printf("Error: fail to create file\n"); + * return -1; + * } + * + * // Set the dataset creation property list to specify that + * // the raw data is to be partitioned into 10 x 15 element + * // chunks and that each chunk is to be compressed. + * chunk_size[0] = CH_NX; + * chunk_size[1] = CH_NY; + * if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE)) < 0) { + * printf("Error: fail to create dataset property\n"); + * return -1; + * } + * if(H5Pset_chunk (dset_create_props, 2, chunk_size) < 0) { + * printf("Error: fail to set chunk\n"); + * return -1; + * } + * + * // Set the fill value of dataset + * fill_val = 10000.0; + * if (H5Pset_fill_value(dset_create_props, H5T_NATIVE_FLOAT, &fill_val) < 0) { + * printf("Error: can not set fill value for dataset\n"); + * return -1; + * } + * + * // Set parameters for scale-offset compression; use variable + * // minimum-bits method, set decimal scale factor to 3. Check + * // the description of the H5Pset_scaleoffset function in the + * // HDF5 Reference Manual for more information. + * if(H5Pset_scaleoffset (dset_create_props, H5Z_SO_FLOAT_DSCALE, 3) < 0) { + * printf("Error: fail to set scaleoffset filter\n"); + * return -1; + * } + * + * // Create a new dataset within the file. The datatype + * // and dataspace describe the data on disk, which may + * // or may not be different from the format used in the + * // application's memory. + * if((dataset = H5Dcreate (file, DATASET_NAME, datatype, dataspace, H5P_DEFAULT, + * dset_create_props, H5P_DEFAULT)) < 0) { + * printf("Error: fail to create dataset\n"); + * return -1; + * } + * + * // Write the array to the file. The datatype and dataspace + * // describe the format of the data in the 'orig_data' buffer. + * // We use default raw data transfer properties. + * if(H5Dwrite (dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data) < 0) { + * printf("Error: fail to write to dataset\n"); + * return -1; + * } + * + * H5Dclose (dataset); + * + * if((dataset = H5Dopen(file, DATASET_NAME, H5P_DEFAULT)) < 0) { + * printf("Error: fail to open dataset\n"); + * return -1; + * } + * + * // Read the array. This is similar to writing data, + * // except the data flows in the opposite direction. + * // Note: Decompression is automatic. + * if(H5Dread (dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, new_data) < 0) { + * printf("Error: fail to read from dataset\n"); + * return -1; + * } + * + * H5Tclose (datatype); + * H5Dclose (dataset); + * H5Sclose (dataspace); + * H5Pclose (dset_create_props); + * H5Fclose (file); + * + * return 0; + * } + * \endcode + * + *

Limitations

+ * For floating-point data handling, there are some algorithmic limitations to the GRiB data packing + * mechanism: + *
  1. + * Both the E-scaling and D-scaling methods are lossy compression + *
  2. + *
  3. + * For the D-scaling method, since data values have been rounded to integer values (positive) + * before truncating to the minimum-bits, their range is limited by the maximum value that can be + * represented by the corresponding unsigned integer type (the same size as that of the floating- + * point type) + *
+ * + *

Suggestions

+ * The following are some suggestions for using the filter for floating-point data: + *
  1. + * It is better to convert the units of data so that the units are within certain common range (for + * example, 1200m to 1.2km) + *
  2. + *
  3. + * If data values to be compressed are very near to zero, it is strongly recommended that the + * user sets the fill value away from zero (for example, a large positive number); if the user does + * nothing, the HDF5 library will set the fill value to zero, and this may cause undesirable + * compression results + *
  4. + *
  5. + * Users are not encouraged to use a very large decimal scale factor (for example, 100) for the + * D-scaling method; this can cause the filter not to ignore the fill value when finding maximum + * and minimum values, and they will get a much larger minimum-bits (poor compression) + *
+ * + * \subsubsection subsubsec_dataset_filters_szip Using the Szip Filter + * See The HDF Group website for further information regarding the Szip filter. + * + * Previous Chapter \ref sec_group - Next Chapter \ref sec_datatype + * + */ + +/** + * \defgroup H5D Datasets (H5D) * * Use the functions in this module to manage HDF5 datasets, including the * transfer of data between memory and disk and the description of dataset diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Dpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Dpkg.h index 0b98ce7070..67dfb83a34 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Dpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Dpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Monday, April 14, 2003 - * - * Purpose: This file contains declarations which are visible only within - * the H5D package. Source files outside the H5D package should - * include H5Dprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5D package. Source files outside the H5D package should + * include H5Dprivate.h instead. */ #if !(defined H5D_FRIEND || defined H5D_MODULE) #error "Do not include this file outside the H5D package!" @@ -33,6 +29,7 @@ #include "H5ACprivate.h" /* Metadata cache */ #include "H5B2private.h" /* v2 B-trees */ #include "H5Fprivate.h" /* File access */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Gprivate.h" /* Groups */ #include "H5SLprivate.h" /* Skip lists */ #include "H5Tprivate.h" /* Datatypes */ @@ -44,20 +41,6 @@ /* Set the minimum object header size to create objects with */ #define H5D_MINHDR_SIZE 256 -/* [Simple] Macro to construct a H5D_io_info_t from it's components */ -#define H5D_BUILD_IO_INFO_WRT(io_info, ds, str, buf) \ - (io_info)->dset = ds; \ - (io_info)->f_sh = H5F_SHARED((ds)->oloc.file); \ - (io_info)->store = str; \ - (io_info)->op_type = H5D_IO_OP_WRITE; \ - (io_info)->u.wbuf = buf -#define H5D_BUILD_IO_INFO_RD(io_info, ds, str, buf) \ - (io_info)->dset = ds; \ - (io_info)->f_sh = H5F_SHARED((ds)->oloc.file); \ - (io_info)->store = str; \ - (io_info)->op_type = H5D_IO_OP_READ; \ - (io_info)->u.rbuf = buf - /* Flags for marking aspects of a dataset dirty */ #define H5D_MARK_SPACE 0x01 #define H5D_MARK_LAYOUT 0x02 @@ -83,6 +66,51 @@ #define H5D_BT2_SPLIT_PERC 100 #define H5D_BT2_MERGE_PERC 40 +/* Macro to determine if the layout I/O callback should perform I/O */ +#define H5D_LAYOUT_CB_PERFORM_IO(IO_INFO) \ + (((IO_INFO)->use_select_io == H5D_SELECTION_IO_MODE_OFF) || \ + ((IO_INFO)->count == 1 && (IO_INFO)->max_tconv_type_size == 0)) + +/* Macro to check if in-place type conversion will be used for a piece and add it to the global type + * conversion size if it won't be used */ +#define H5D_INIT_PIECE_TCONV(IO_INFO, DINFO, PIECE_INFO) \ + { \ + /* Check for potential in-place conversion */ \ + if ((IO_INFO)->may_use_in_place_tconv) { \ + size_t mem_type_size = ((IO_INFO)->op_type == H5D_IO_OP_READ) \ + ? (DINFO)->type_info.dst_type_size \ + : (DINFO)->type_info.src_type_size; \ + size_t file_type_size = ((IO_INFO)->op_type == H5D_IO_OP_READ) \ + ? (DINFO)->type_info.src_type_size \ + : (DINFO)->type_info.dst_type_size; \ + \ + /* Make sure the memory type is not smaller than the file type, otherwise the memory buffer \ + * won't be big enough to serve as the type conversion buffer */ \ + if (mem_type_size >= file_type_size) { \ + hbool_t is_contig; \ + hsize_t sel_off; \ + \ + /* Check if the space is contiguous */ \ + if (H5S_select_contig_block((PIECE_INFO)->mspace, &is_contig, &sel_off, NULL) < 0) \ + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't check if dataspace is contiguous"); \ + \ + /* If the first sequence includes all the elements selected in this piece, it it contiguous \ + */ \ + if (is_contig) { \ + H5_CHECK_OVERFLOW(sel_off, hsize_t, size_t); \ + (PIECE_INFO)->in_place_tconv = TRUE; \ + (PIECE_INFO)->buf_off = (size_t)sel_off * mem_type_size; \ + } \ + } \ + } \ + \ + /* If we're not using in-place type conversion, add this piece to global type conversion buffer \ + * size. This will only be used if we must allocate a type conversion buffer for the entire I/O. */ \ + if (!(PIECE_INFO)->in_place_tconv) \ + (IO_INFO)->tconv_buf_size += (PIECE_INFO)->piece_points * MAX((DINFO)->type_info.src_type_size, \ + (DINFO)->type_info.dst_type_size); \ + } + /****************************/ /* Package Private Typedefs */ /****************************/ @@ -99,21 +127,16 @@ typedef struct H5D_type_info_t { /* Computed/derived values */ size_t src_type_size; /* Size of source type */ size_t dst_type_size; /* Size of destination type */ - size_t max_type_size; /* Size of largest source/destination type */ hbool_t is_conv_noop; /* Whether the type conversion is a NOOP */ hbool_t is_xform_noop; /* Whether the data transform is a NOOP */ const H5T_subset_info_t *cmpd_subset; /* Info related to the compound subset conversion functions */ H5T_bkg_t need_bkg; /* Type of background buf needed */ size_t request_nelmts; /* Requested strip mine */ - uint8_t *tconv_buf; /* Datatype conv buffer */ - hbool_t tconv_buf_allocated; /* Whether the type conversion buffer was allocated */ - uint8_t *bkg_buf; /* Background buffer */ - hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */ } H5D_type_info_t; /* Forward declaration of structs used below */ struct H5D_io_info_t; -struct H5D_chunk_map_t; +struct H5D_dset_io_info_t; typedef struct H5D_shared_t H5D_shared_t; /* Function pointers for I/O on particular types of dataset layouts */ @@ -121,27 +144,27 @@ typedef herr_t (*H5D_layout_construct_func_t)(H5F_t *f, H5D_t *dset); typedef herr_t (*H5D_layout_init_func_t)(H5F_t *f, const H5D_t *dset, hid_t dapl_id); typedef hbool_t (*H5D_layout_is_space_alloc_func_t)(const H5O_storage_t *storage); typedef hbool_t (*H5D_layout_is_data_cached_func_t)(const H5D_shared_t *shared_dset); -typedef herr_t (*H5D_layout_io_init_func_t)(struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, - struct H5D_chunk_map_t *cm); -typedef herr_t (*H5D_layout_read_func_t)(struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, - struct H5D_chunk_map_t *fm); -typedef herr_t (*H5D_layout_write_func_t)(struct H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, - struct H5D_chunk_map_t *fm); -typedef ssize_t (*H5D_layout_readvv_func_t)(const struct H5D_io_info_t *io_info, size_t dset_max_nseq, +typedef herr_t (*H5D_layout_io_init_func_t)(struct H5D_io_info_t *io_info, struct H5D_dset_io_info_t *dinfo); +typedef herr_t (*H5D_layout_mdio_init_func_t)(struct H5D_io_info_t *io_info, + struct H5D_dset_io_info_t *dinfo); +typedef herr_t (*H5D_layout_read_func_t)(struct H5D_io_info_t *io_info, struct H5D_dset_io_info_t *dinfo); +typedef herr_t (*H5D_layout_write_func_t)(struct H5D_io_info_t *io_info, struct H5D_dset_io_info_t *dinfo); +typedef herr_t (*H5D_layout_read_md_func_t)(struct H5D_io_info_t *io_info); +typedef herr_t (*H5D_layout_write_md_func_t)(struct H5D_io_info_t *io_info); +typedef ssize_t (*H5D_layout_readvv_func_t)(const struct H5D_io_info_t *io_info, + const struct H5D_dset_io_info_t *dset_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); -typedef ssize_t (*H5D_layout_writevv_func_t)(const struct H5D_io_info_t *io_info, size_t dset_max_nseq, +typedef ssize_t (*H5D_layout_writevv_func_t)(const struct H5D_io_info_t *io_info, + const struct H5D_dset_io_info_t *dset_info, size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); typedef herr_t (*H5D_layout_flush_func_t)(H5D_t *dataset); -typedef herr_t (*H5D_layout_io_term_func_t)(const struct H5D_chunk_map_t *cm); +typedef herr_t (*H5D_layout_io_term_func_t)(struct H5D_io_info_t *io_info, struct H5D_dset_io_info_t *di); typedef herr_t (*H5D_layout_dest_func_t)(H5D_t *dataset); /* Typedef for grouping layout I/O routines */ @@ -152,27 +175,28 @@ typedef struct H5D_layout_ops_t { H5D_layout_is_data_cached_func_t is_data_cached; /* Query routine to determine if any raw data is cached. If routine is not present then the layout type never caches raw data. */ - H5D_layout_io_init_func_t io_init; /* I/O initialization routine */ - H5D_layout_read_func_t ser_read; /* High-level I/O routine for reading data in serial */ - H5D_layout_write_func_t ser_write; /* High-level I/O routine for writing data in serial */ -#ifdef H5_HAVE_PARALLEL - H5D_layout_read_func_t par_read; /* High-level I/O routine for reading data in parallel */ - H5D_layout_write_func_t par_write; /* High-level I/O routine for writing data in parallel */ -#endif /* H5_HAVE_PARALLEL */ - H5D_layout_readvv_func_t readvv; /* Low-level I/O routine for reading data */ - H5D_layout_writevv_func_t writevv; /* Low-level I/O routine for writing data */ - H5D_layout_flush_func_t flush; /* Low-level I/O routine for flushing raw data */ - H5D_layout_io_term_func_t io_term; /* I/O shutdown routine */ - H5D_layout_dest_func_t dest; /* Destroy layout info */ + H5D_layout_io_init_func_t io_init; /* I/O initialization routine */ + H5D_layout_mdio_init_func_t mdio_init; /* Multi Dataset I/O initialization routine - called after all + datasets have done io_init and sel_pieces has been allocated */ + H5D_layout_read_func_t ser_read; /* High-level I/O routine for reading data in serial */ + H5D_layout_write_func_t ser_write; /* High-level I/O routine for writing data in serial */ + H5D_layout_readvv_func_t readvv; /* Low-level I/O routine for reading data */ + H5D_layout_writevv_func_t writevv; /* Low-level I/O routine for writing data */ + H5D_layout_flush_func_t flush; /* Low-level I/O routine for flushing raw data */ + H5D_layout_io_term_func_t io_term; /* I/O shutdown routine for multi-dset */ + H5D_layout_dest_func_t dest; /* Destroy layout info */ } H5D_layout_ops_t; /* Function pointers for either multiple or single block I/O access */ -typedef herr_t (*H5D_io_single_read_func_t)(const struct H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space); -typedef herr_t (*H5D_io_single_write_func_t)(const struct H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space); +typedef herr_t (*H5D_io_single_read_func_t)(const struct H5D_io_info_t *io_info, + const struct H5D_dset_io_info_t *dset_info); +typedef herr_t (*H5D_io_single_write_func_t)(const struct H5D_io_info_t *io_info, + const struct H5D_dset_io_info_t *dset_info); + +typedef herr_t (*H5D_io_single_read_md_func_t)(const struct H5D_io_info_t *io_info, hsize_t nelmts, + H5S_t *file_space, H5S_t *mem_space); +typedef herr_t (*H5D_io_single_write_md_func_t)(const struct H5D_io_info_t *io_info, hsize_t nelmts, + H5S_t *file_space, H5S_t *mem_space); /* Typedef for raw data I/O framework info */ typedef struct H5D_io_ops_t { @@ -182,6 +206,14 @@ typedef struct H5D_io_ops_t { H5D_io_single_write_func_t single_write; /* I/O routine for writing single block */ } H5D_io_ops_t; +/* Typedef for raw data I/O framework info (multi-dataset I/O) */ +typedef struct H5D_md_io_ops_t { + H5D_layout_read_md_func_t multi_read_md; /* High-level I/O routine for reading data for multi-dset */ + H5D_layout_write_md_func_t multi_write_md; /* High-level I/O routine for writing data for multi-dset */ + H5D_io_single_read_md_func_t single_read_md; /* I/O routine for reading single block for multi-dset */ + H5D_io_single_write_md_func_t single_write_md; /* I/O routine for writing single block for multi-dset */ +} H5D_md_io_ops_t; + /* Typedefs for dataset storage information */ typedef struct { haddr_t dset_addr; /* Address of dataset in file */ @@ -210,25 +242,94 @@ typedef enum H5D_io_op_type_t { H5D_IO_OP_WRITE /* Write operation */ } H5D_io_op_type_t; +/* Piece info for a data chunk/block during I/O */ +typedef struct H5D_piece_info_t { + haddr_t faddr; /* File address */ + hsize_t index; /* "Index" of chunk in dataset */ + hsize_t piece_points; /* Number of elements selected in piece */ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Scaled coordinates of chunk (in file dataset's dataspace) */ + H5S_t *fspace; /* Dataspace describing chunk & selection in it */ + unsigned fspace_shared; /* Indicate that the file space for a chunk is shared and shouldn't be freed */ + H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */ + unsigned mspace_shared; /* Indicate that the memory space for a chunk is shared and shouldn't be freed */ + hbool_t in_place_tconv; /* Whether to perform type conversion in-place */ + size_t buf_off; /* Buffer offset for in-place type conversion */ + struct H5D_dset_io_info_t *dset_info; /* Pointer to dset_info */ +} H5D_piece_info_t; + +/* I/O info for a single dataset */ +typedef struct H5D_dset_io_info_t { + H5D_t *dset; /* Pointer to dataset being operated on */ + H5D_storage_t *store; /* Dataset storage info */ + H5D_layout_ops_t layout_ops; /* Dataset layout I/O operation function pointers */ + H5_flexible_const_ptr_t buf; /* Buffer pointer */ + + H5D_io_ops_t io_ops; /* I/O operations for this dataset */ + + H5O_layout_t *layout; /* Dataset layout information*/ + hsize_t nelmts; /* Number of elements selected in file & memory dataspaces */ + + H5S_t *file_space; /* Pointer to the file dataspace */ + H5S_t *mem_space; /* Pointer to the memory dataspace */ + + union { + struct H5D_chunk_map_t *chunk_map; /* Chunk specific I/O info */ + H5D_piece_info_t *contig_piece_info; /* Piece info for contiguous dataset */ + } layout_io_info; + + hid_t mem_type_id; /* memory datatype ID */ + H5D_type_info_t type_info; + hbool_t skip_io; /* Whether to skip I/O for this dataset */ +} H5D_dset_io_info_t; + +/* I/O info for entire I/O operation */ typedef struct H5D_io_info_t { - const H5D_t *dset; /* Pointer to dataset being operated on */ - /* QAK: Delete the f_sh field when oloc has a shared file pointer? */ + /* QAK: Delete the f_sh field when oloc has a shared file pointer? */ H5F_shared_t *f_sh; /* Pointer to shared file struct that dataset is within */ #ifdef H5_HAVE_PARALLEL - MPI_Comm comm; /* MPI communicator for file */ - hbool_t using_mpi_vfd; /* Whether the file is using an MPI-based VFD */ -#endif /* H5_HAVE_PARALLEL */ - H5D_storage_t *store; /* Dataset storage info */ - H5D_layout_ops_t layout_ops; /* Dataset layout I/O operation function pointers */ - H5D_io_ops_t io_ops; /* I/O operation function pointers */ - H5D_io_op_type_t op_type; - hbool_t use_select_io; /* Whether to use selection I/O */ - union { - void *rbuf; /* Pointer to buffer for read */ - const void *wbuf; /* Pointer to buffer to write */ - } u; + MPI_Comm comm; /* MPI communicator for file */ + hbool_t using_mpi_vfd; /* Whether the file is using an MPI-based VFD */ +#endif /* H5_HAVE_PARALLEL */ + H5D_md_io_ops_t md_io_ops; /* Multi dataset I/O operation function pointers */ + H5D_io_op_type_t op_type; + size_t count; /* Number of datasets in I/O request */ + H5D_dset_io_info_t *dsets_info; /* dsets info where I/O is done to/from */ + size_t piece_count; /* Number of pieces in I/O request */ + size_t pieces_added; /* Number of pieces added so far to arrays */ + H5D_piece_info_t **sel_pieces; /* Array of info struct for all pieces in I/O */ + H5S_t **mem_spaces; /* Array of chunk memory spaces */ + H5S_t **file_spaces; /* Array of chunk file spaces */ + haddr_t *addrs; /* Array of chunk addresses */ + size_t *element_sizes; /* Array of element sizes */ + void **rbufs; /* Array of read buffers */ + const void **wbufs; /* Array of write buffers */ + haddr_t store_faddr; /* lowest file addr for read/write */ + H5_flexible_const_ptr_t base_maddr; /* starting mem address */ + H5D_selection_io_mode_t use_select_io; /* Whether to use selection I/O */ + uint8_t *tconv_buf; /* Datatype conv buffer */ + hbool_t tconv_buf_allocated; /* Whether the type conversion buffer was allocated */ + size_t tconv_buf_size; /* Size of type conversion buffer */ + uint8_t *bkg_buf; /* Background buffer */ + hbool_t bkg_buf_allocated; /* Whether the background buffer was allocated */ + size_t bkg_buf_size; /* Size of background buffer */ + size_t max_tconv_type_size; /* Largest of all source and destination type sizes involved in type + conversion */ + hbool_t + must_fill_bkg; /* Whether any datasets need a background buffer filled with destination contents */ + hbool_t may_use_in_place_tconv; /* Whether datasets in this I/O could potentially use in-place type + conversion if the type sizes are compatible with it */ +#ifdef H5_HAVE_PARALLEL + H5D_mpio_actual_io_mode_t actual_io_mode; /* Actual type of collective or independent I/O */ +#endif /* H5_HAVE_PARALLEL */ + unsigned no_selection_io_cause; /* "No selection I/O cause" flags */ } H5D_io_info_t; +/* Created to pass both at once for callback func */ +typedef struct H5D_io_info_wrap_t { + H5D_io_info_t *io_info; + H5D_dset_io_info_t *dinfo; +} H5D_io_info_wrap_t; + /******************/ /* Chunk typedefs */ /******************/ @@ -330,46 +431,26 @@ typedef struct H5D_chunk_ops_t { H5D_chunk_dest_func_t dest; /* Routine to destroy indexing information in memory */ } H5D_chunk_ops_t; -/* Structure holding information about a chunk's selection for mapping */ -typedef struct H5D_chunk_info_t { - hsize_t index; /* "Index" of chunk in dataset */ - uint32_t chunk_points; /* Number of elements selected in chunk */ - hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Scaled coordinates of chunk (in file dataset's dataspace) */ - H5S_t *fspace; /* Dataspace describing chunk & selection in it */ - hbool_t fspace_shared; /* Indicate that the file space for a chunk is shared and shouldn't be freed */ - H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */ - hbool_t mspace_shared; /* Indicate that the memory space for a chunk is shared and shouldn't be freed */ -} H5D_chunk_info_t; - /* Main structure holding the mapping between file chunks and memory */ typedef struct H5D_chunk_map_t { - H5O_layout_t *layout; /* Dataset layout information*/ - hsize_t nelmts; /* Number of elements selected in file & memory dataspaces */ + unsigned f_ndims; /* Number of dimensions for file dataspace */ - H5S_t *file_space; /* Pointer to the file dataspace */ - unsigned f_ndims; /* Number of dimensions for file dataspace */ - - H5S_t *mem_space; /* Pointer to the memory dataspace */ H5S_t *mchunk_tmpl; /* Dataspace template for new memory chunks */ H5S_sel_iter_t mem_iter; /* Iterator for elements in memory selection */ unsigned m_ndims; /* Number of dimensions for memory dataspace */ H5S_sel_type msel_type; /* Selection type in memory */ H5S_sel_type fsel_type; /* Selection type in file */ - H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */ + H5SL_t *dset_sel_pieces; /* Skip list containing information for each chunk selected */ H5S_t *single_space; /* Dataspace for single chunk */ - H5D_chunk_info_t *single_chunk_info; /* Pointer to single chunk's info */ + H5D_piece_info_t *single_piece_info; /* Pointer to single chunk's info */ hbool_t use_single; /* Whether I/O is on a single element */ hsize_t last_index; /* Index of last chunk operated on */ - H5D_chunk_info_t *last_chunk_info; /* Pointer to last chunk's info */ + H5D_piece_info_t *last_piece_info; /* Pointer to last chunk's info */ hsize_t chunk_dim[H5O_LAYOUT_NDIMS]; /* Size of chunk in each dimension */ - -#ifdef H5_HAVE_PARALLEL - H5D_chunk_info_t **select_chunk; /* Store the information about whether this chunk is selected or not */ -#endif /* H5_HAVE_PARALLEL */ } H5D_chunk_map_t; /* Cached information about a particular chunk */ @@ -415,7 +496,7 @@ typedef struct H5D_rdcc_t { struct H5D_rdcc_ent_t **slot; /* Chunk slots, each points to a chunk*/ H5SL_t *sel_chunks; /* Skip list containing information for each chunk selected */ H5S_t *single_space; /* Dataspace for single element I/O on chunks */ - H5D_chunk_info_t *single_chunk_info; /* Pointer to single chunk's info */ + H5D_piece_info_t *single_piece_info; /* Pointer to single piece's info */ /* Cached information about scaled dataspace dimensions */ hsize_t scaled_dims[H5S_MAX_RANK]; /* The scaled dim sizes */ @@ -458,12 +539,13 @@ struct H5D_shared_t { /* Buffered/cached information for types of raw data storage*/ struct { - H5D_rdcdc_t contig; /* Information about contiguous data */ - /* (Note that the "contig" cache - * information can be used by a chunked - * dataset in certain circumstances) - */ - H5D_rdcc_t chunk; /* Information about chunked data */ + H5D_rdcdc_t contig; /* Information about contiguous data */ + /* (Note that the "contig" cache + * information can be used by a chunked + * dataset in certain circumstances) + */ + H5D_rdcc_t chunk; /* Information about chunked data */ + H5SL_t *sel_pieces; /* Skip list containing information for each piece selected */ } cache; H5D_append_flush_t append_flush; /* Append flush property information */ @@ -556,8 +638,8 @@ H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl H5_DLL hid_t H5D__get_space(const H5D_t *dset); H5_DLL hid_t H5D__get_type(const H5D_t *dset); H5_DLL herr_t H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation); -H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, - hbool_t full_overwrite, hsize_t old_dim[]); +H5_DLL herr_t H5D__alloc_storage(H5D_t *dset, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, + hsize_t old_dim[]); H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size); H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage_size); H5_DLL herr_t H5D__chunk_index_empty(const H5D_t *dset, hbool_t *empty); @@ -582,29 +664,25 @@ H5_DLL herr_t H5D__refresh(H5D_t *dataset, hid_t dset_id); H5_DLL herr_t H5D__format_convert(H5D_t *dataset); /* Internal I/O routines */ -H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, H5S_t *mem_space, H5S_t *file_space, - void *buf /*out*/); -H5_DLL herr_t H5D__write(H5D_t *dataset, hid_t mem_type_id, H5S_t *mem_space, H5S_t *file_space, - const void *buf); +H5_DLL herr_t H5D__read(size_t count, H5D_dset_io_info_t *dset_info); +H5_DLL herr_t H5D__write(size_t count, H5D_dset_io_info_t *dset_info); /* Functions that perform direct serial I/O operations */ -H5_DLL herr_t H5D__select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space); -H5_DLL herr_t H5D__select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space); +H5_DLL herr_t H5D__select_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info); +H5_DLL herr_t H5D__select_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info); /* Functions that perform direct copying between memory buffers */ H5_DLL herr_t H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *src_space, size_t elmt_size, size_t nelmts); -/* Functions that perform scatter-gather serial I/O operations */ +/* Functions that perform scatter-gather I/O operations */ H5_DLL herr_t H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts, void *_buf); H5_DLL size_t H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts, void *_tgath_buf /*out*/); -H5_DLL herr_t H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space); -H5_DLL herr_t H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space); +H5_DLL herr_t H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info); +H5_DLL herr_t H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info); +H5_DLL herr_t H5D__scatgath_read_select(H5D_io_info_t *io_info); +H5_DLL herr_t H5D__scatgath_write_select(H5D_io_info_t *io_info); /* Functions that operate on dataset's layout information */ H5_DLL herr_t H5D__layout_set_io_ops(const H5D_t *dataset); @@ -620,25 +698,23 @@ H5_DLL herr_t H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned upd H5_DLL herr_t H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage); H5_DLL hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage); H5_DLL hbool_t H5D__contig_is_data_cached(const H5D_shared_t *shared_dset); -H5_DLL herr_t H5D__contig_fill(const H5D_io_info_t *io_info); -H5_DLL herr_t H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm); -H5_DLL herr_t H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm); +H5_DLL herr_t H5D__contig_fill(H5D_t *dset); +H5_DLL herr_t H5D__contig_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); +H5_DLL herr_t H5D__contig_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); H5_DLL herr_t H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f_dst, H5O_storage_contig_t *storage_dst, H5T_t *src_dtype, H5O_copy_t *cpy_info); H5_DLL herr_t H5D__contig_delete(H5F_t *f, const H5O_storage_t *store); /* Functions that operate on chunked dataset storage */ -H5_DLL htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_op); -H5_DLL herr_t H5D__chunk_create(const H5D_t *dset /*in,out*/); -H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset); +H5_DLL htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, haddr_t caddr, + hbool_t write_op); +H5_DLL herr_t H5D__chunk_create(const H5D_t *dset /*in,out*/); +H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset); H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage); H5_DLL hbool_t H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset); H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata); H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes); -H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, - const hsize_t old_dim[]); +H5_DLL herr_t H5D__chunk_allocate(const H5D_t *dset, hbool_t full_overwrite, const hsize_t old_dim[]); H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert, const hsize_t *scaled); H5_DLL void *H5D__chunk_mem_alloc(size_t size, void *pline); @@ -651,7 +727,7 @@ H5_DLL hbool_t H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint3 H5_DLL herr_t H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim); H5_DLL herr_t H5D__chunk_set_sizes(H5D_t *dset); #ifdef H5_HAVE_PARALLEL -H5_DLL herr_t H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]); +H5_DLL herr_t H5D__chunk_addrmap(const H5D_t *dset, haddr_t chunk_addr[]); #endif /* H5_HAVE_PARALLEL */ H5_DLL herr_t H5D__chunk_update_cache(H5D_t *dset); H5_DLL herr_t H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk_t *layout_src, @@ -662,8 +738,8 @@ H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t * H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, FILE *stream); H5_DLL herr_t H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *store); H5_DLL herr_t H5D__chunk_get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy); -H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, - uint32_t data_size, const void *buf); +H5_DLL herr_t H5D__chunk_direct_write(H5D_t *dset, uint32_t filters, hsize_t *offset, uint32_t data_size, + const void *buf); H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t *filters, void *buf); #ifdef H5D_CHUNK_DEBUG H5_DLL herr_t H5D__chunk_stats(const H5D_t *dset, hbool_t headers); @@ -711,39 +787,31 @@ H5_DLL herr_t H5D__fill_term(H5D_fill_buf_info_t *fb_info); #define H5Dmpio_DEBUG #endif /*H5Dmpio_DEBUG*/ #endif /*H5D_DEBUG*/ -/* MPI-IO function to read, it will select either regular or irregular read */ -H5_DLL herr_t H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space); - -/* MPI-IO function to write, it will select either regular or irregular read */ -H5_DLL herr_t H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space); - -/* MPI-IO functions to handle contiguous collective IO */ -H5_DLL herr_t H5D__contig_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, - H5D_chunk_map_t *fm); -H5_DLL herr_t H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, - H5D_chunk_map_t *fm); - -/* MPI-IO functions to handle chunked collective IO */ -H5_DLL herr_t H5D__chunk_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, - H5D_chunk_map_t *fm); -H5_DLL herr_t H5D__chunk_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, H5S_t *file_space, H5S_t *mem_space, - H5D_chunk_map_t *fm); +/* MPI-IO function to read multi-dsets (Chunk, Contig), it will select either + * regular or irregular read */ +H5_DLL herr_t H5D__mpio_select_read(const H5D_io_info_t *io_info, hsize_t nelmts, H5S_t *file_space, + H5S_t *mem_space); + +/* MPI-IO function to write multi-dsets (Chunk, Contig), it will select either + * regular or irregular write */ +H5_DLL herr_t H5D__mpio_select_write(const H5D_io_info_t *io_info, hsize_t nelmts, H5S_t *file_space, + H5S_t *mem_space); + +/* MPI-IO functions to handle collective IO for multiple dsets (CONTIG, CHUNK) */ +H5_DLL herr_t H5D__collective_read(H5D_io_info_t *io_info); +H5_DLL herr_t H5D__collective_write(H5D_io_info_t *io_info); /* MPI-IO function to check if a direct I/O transfer is possible between * memory and the file */ -H5_DLL htri_t H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, - const H5S_t *mem_space, const H5D_type_info_t *type_info); +H5_DLL htri_t H5D__mpio_opt_possible(H5D_io_info_t *io_info); H5_DLL herr_t H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, char *global_cause, size_t global_cause_len); #endif /* H5_HAVE_PARALLEL */ +/* Free a piece (chunk or contiguous dataset data block) info struct */ +H5_DLL herr_t H5D__free_piece_info(void *item, void *key, void *opdata); + /* Testing functions */ #ifdef H5D_TESTING H5_DLL herr_t H5D__layout_version_test(hid_t did, unsigned *version); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Dprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Dprivate.h index a80bbb6326..8265ac2521 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Dprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Dprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -79,12 +78,15 @@ #define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME \ "local_no_collective_cause" /* cause of broken collective I/O in each process */ #define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME \ - "global_no_collective_cause" /* cause of broken collective I/O in all processes */ -#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ -#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ -#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ -#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */ -#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */ + "global_no_collective_cause" /* cause of broken collective I/O in all processes */ +#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ +#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ +#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ +#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */ +#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */ +#define H5D_XFER_SELECTION_IO_MODE_NAME "selection_io_mode" /* Selection I/O mode */ +#define H5D_XFER_NO_SELECTION_IO_CAUSE_NAME "no_selection_io_cause" /* Cause for no selection I/O */ +#define H5D_XFER_MODIFY_WRITE_BUF_NAME "modify_write_buf" /* Modify write buffers */ #ifdef H5_HAVE_INSTRUMENTED_LIBRARY /* Collective chunk instrumentation properties */ #define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard" diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Dpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Dpublic.h index 8126affd72..a4c60cd4b5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Dpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Dpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -17,11 +16,8 @@ #ifndef H5Dpublic_H #define H5Dpublic_H -/* System headers needed by this file */ - -/* Public headers needed by this file */ -#include "H5public.h" -#include "H5Ipublic.h" +#include "H5public.h" /* Generic Functions */ +#include "H5Ipublic.h" /* Identifiers */ /*****************/ /* Public Macros */ @@ -226,7 +222,7 @@ typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, size_t dst_buf_bytes_us /** * \brief Callback for H5Dchunk_iter() * - * \param[in] offset Logical position of the chunk’s first element in units of dataset elements + * \param[in] offset Logical position of the chunk's first element in units of dataset elements * \param[in] filter_mask Bitmask indicating the filters used when the chunk was written * \param[in] addr Chunk address in the file * \param[in] size Chunk size in bytes, 0 if the chunk does not exist @@ -239,7 +235,7 @@ typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, size_t dst_buf_bytes_us * \li A negative (#H5_ITER_ERROR) causes the iterator to immediately * return that value, indicating failure. */ -typedef int (*H5D_chunk_iter_op_t)(const hsize_t *offset, uint32_t filter_mask, haddr_t addr, uint32_t size, +typedef int (*H5D_chunk_iter_op_t)(const hsize_t *offset, unsigned filter_mask, haddr_t addr, hsize_t size, void *op_data); //! @@ -280,7 +276,7 @@ extern "C" { * * \p loc_id may specify a file, group, dataset, named datatype, * or attribute. If an attribute, dataset, or named datatype is - * specified then the dataset will be created at the location + * specified, then the dataset will be created at the location * where the attribute, dataset, or named datatype is attached. * * \p name may be either an absolute path in the file or a relative @@ -291,7 +287,7 @@ extern "C" { * file location where the dataset will be created, the datatype * is copied and converted to a transient type. * - * The link creation property list, \p lcpl_id, governs creation + * The link creation property list, \p lcpl_id, governs the creation * of the link(s) by which the new dataset is accessed and the * creation of any intermediate groups that may be missing. * @@ -320,9 +316,14 @@ H5_DLL hid_t H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t spa * \ingroup ASYNC * \async_variant_of{H5Dcreate} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Dcreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, hid_t dcpl_id, hid_t dapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Dcreate_async(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t lcpl_id, + hid_t dcpl_id, hid_t dapl_id, hid_t es_id); +#endif /** * -------------------------------------------------------------------------- @@ -344,12 +345,12 @@ H5_DLL hid_t H5Dcreate_async(const char *app_file, const char *app_func, unsigne * * \p loc_id may specify a file, group, dataset, named datatype, * or attribute. If an attribute, dataset, or named datatype is - * specified then the dataset will be created at the location + * specified, then the dataset will be created at the location * where the attribute, dataset, or named datatype is attached. * - * The dataset’s datatype and dataspace are specified by + * The dataset's datatype and dataspace are specified by * \p type_id and \p space_id, respectively. These are the - * datatype and dataspace of the dataset as it will exist in + * datatype and dataspace of the dataset as they will exist in * the file, which may differ from the datatype and dataspace * in application memory. * @@ -398,8 +399,12 @@ H5_DLL hid_t H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id); * \ingroup ASYNC * \async_variant_of{H5Dopen} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Dopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t dapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Dopen_async(hid_t loc_id, const char *name, hid_t dapl_id, hid_t es_id); +#endif /** * -------------------------------------------------------------------------- @@ -432,8 +437,12 @@ H5_DLL hid_t H5Dget_space(hid_t dset_id); * \ingroup ASYNC * \async_variant_of{H5Dget_space} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Dget_space_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id, hid_t es_id); +#else +H5_DLL hid_t H5Dget_space_async(hid_t dset_id, hid_t es_id); +#endif /** * -------------------------------------------------------------------------- @@ -449,6 +458,20 @@ H5_DLL hid_t H5Dget_space_async(const char *app_file, const char *app_func, unsi * \details H5Dget_space_status() determines whether space has been allocated * for the dataset \p dset_id. * + * \note \Bold{BUG:} Prior to the HDF5 1.14.0, 1.12.2 and 1.10.9 releases, + * H5Dget_space_status() may return incorrect space allocation status + * values for datasets with filters applied to them. + * H5Dget_space_status() calculated the space allocation status by + * comparing the sum of the sizes of all the allocated chunks in the + * dataset against the total data size of the dataset, as calculated by + * the number of elements in the dataset's dataspace multiplied by the + * dataset's datatype size. If the dataset had any compression filters + * applied to it and the dataset chunks were successfully compressed, + * the sum of the sizes of the allocated dataset chunks would generally + * always be less than the total data size of the dataset, and + * H5Dget_space_status() wouldn't ever return + * `H5D_SPACE_STATUS_ALLOCATED`. + * * \since 1.6.0 * */ @@ -489,6 +512,9 @@ H5_DLL hid_t H5Dget_type(hid_t dset_id); * a copy of the dataset creation property list associated with * the dataset specified by \p dset_id. * + * The creation property list identifier should be released with + * H5Pclose() to prevent resource leaks. + * */ H5_DLL hid_t H5Dget_create_plist(hid_t dset_id); @@ -517,7 +543,7 @@ H5_DLL hid_t H5Dget_create_plist(hid_t dset_id); * cache properties will be set to the default. The chunk cache * properties in the returned list are considered to be “set”, * and any use of this list will override the corresponding - * properties in the file’s file access property list. + * properties in the file's file access property list. * * All link access properties in the returned list will be set * to the default values. @@ -634,7 +660,7 @@ H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks * \brief Retrieves information about a chunk specified by its coordinates * * \dset_id - * \param[in] offset Logical position of the chunk’s first element in units of dataset elements + * \param[in] offset Logical position of the chunk's first element in units of dataset elements * \param[out] filter_mask Bitmask indicating the filters used when the chunk was written * \param[out] addr Chunk address in the file * \param[out] size Chunk size in bytes, 0 if the chunk does not exist @@ -650,8 +676,8 @@ H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks * filter_mask will not be modified. * * \p offset is a pointer to a one-dimensional array with a size - * equal to the dataset’s rank. Each element is the logical - * position of the chunk’s first element in a dimension. + * equal to the dataset's rank. Each element is the logical + * position of the chunk's first element in a dimension. * * \since 1.10.5 * @@ -666,7 +692,7 @@ H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, u * \brief Iterate over all chunks of a chunked dataset * * \dset_id - * \param[in] dxpl_id Identifier of a transfer property list + * \param[in] dxpl_id Identifier of a transfer property list * \param[in] cb User callback function, called for every chunk. * \param[in] op_data User-defined pointer to data required by op * @@ -677,12 +703,12 @@ H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, u * context \p op_data. * * \par Example - * For each chunk, print the allocated chunk size (0 for un-allocated chunks). + * For each chunk, print the allocated chunk size (0 for unallocated chunks). * \snippet H5D_examples.c H5Dchunk_iter_cb * Iterate over all chunked datasets and chunks in a file. * \snippet H5D_examples.c H5Ovisit_cb * - * \since 1.13.0 + * \since 1.14.0 * */ H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t cb, void *op_data); @@ -696,7 +722,7 @@ H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t cb * \dset_id * \param[in] fspace_id File dataspace selection identifier (See Note below) * \param[in] chk_idx Index of the chunk - * \param[out] offset Logical position of the chunk’s first element in units of dataset elements + * \param[out] offset Logical position of the chunk's first element in units of dataset elements * \param[out] filter_mask Bitmask indicating the filters used when the chunk was written * \param[out] addr Chunk address in the file * \param[out] size Chunk size in bytes, 0 if the chunk does not exist @@ -714,17 +740,17 @@ H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t cb * * \p chk_idx is the chunk index in the selection. The index value * may have a value of 0 up to the number of chunks stored in - * the file that have a nonempty intersection with the file - * dataspace selection + * the file that has a nonempty intersection with the file + * dataspace selection. * * \note As of 1.10.5, the dataspace intersection is not yet - * supported, hence, the index is of all the written chunks. + * supported. Hence, the index is of all the written chunks. * * \p fspace_id specifies the file dataspace selection. It is - * intended to take #H5S_ALL for specifying the current selection. + * intended to take #H5S_ALL to specify the current selection. * * \note Please be aware that this function currently does not - * support non-trivial selections, thus \p fspace_id has no + * support non-trivial selections; thus \p fspace_id has no * effect. Also, the implementation does not handle the #H5S_ALL * macro correctly. As a workaround, an application can get * the dataspace for the dataset using H5Dget_space() and pass that @@ -850,14 +876,79 @@ H5_DLL haddr_t H5Dget_offset(hid_t dset_id); H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf /*out*/); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Reads raw data from a set of datasets into the provided buffers + * + * \param[in] count Number of datasets to read from + * \param[in] dset_id Identifiers of the datasets to read from + * \param[in] mem_type_id Identifiers of the memory datatypes + * \param[in] mem_space_id Identifiers of the memory dataspaces + * \param[in] file_space_id Identifiers of the datasets' dataspaces in the file + * \param[in] dxpl_id Identifier of a transfer property list + * \param[out] buf Buffers to receive data read from file + * + * \return \herr_t + * + * \details H5Dread_multi() reads data from \p count datasets, whose identifiers + * are listed in the \p dset_id array, from the file into multiple + * application memory buffers listed in the \p buf array. Data transfer + * properties are defined by the argument \p dxpl_id. The memory + * datatypes of each dataset are listed by identifier in the \p + * mem_type_id array. The parts of each dataset to read are listed by + * identifier in the \p file_space_id array, and the parts of each + * application memory buffer to read to are listed by identifier in the + * \p mem_space_id array. All array parameters have length \p count. + * + * This function will produce the same results as \p count calls to + * H5Dread(). Information listed in that function about the specifics + * of its behavior also applies to H5Dread_multi(). By calling + * H5Dread_multi() instead of multiple calls to H5Dread(), however, the + * library can in some cases pass information about the entire I/O + * operation to the file driver, which can improve performance. + * + * All datasets must be in the same HDF5 file, and each unique dataset + * may only be listed once. If this function is called collectively in + * parallel, each rank must pass exactly the same list of datasets in + * \p dset_id , though the other parameters may differ. + * + * \since 1.14.0 + * + * \see H5Dread() + * + */ +H5_DLL herr_t H5Dread_multi(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, void *buf[] /*out*/); + /** * -------------------------------------------------------------------------- * \ingroup ASYNC * \async_variant_of{H5Dread} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Dread_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf /*out*/, hid_t es_id); +#else +H5_DLL herr_t H5Dread_async(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t dxpl_id, void *buf /*out*/, hid_t es_id); +#endif + +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Dread_multi} + */ +#ifndef H5_DOXYGEN +H5_DLL herr_t H5Dread_multi_async(const char *app_file, const char *app_func, unsigned app_line, size_t count, + hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, void *buf[] /*out*/, hid_t es_id); +#else +H5_DLL herr_t H5Dread_multi_async(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, void *buf[] /*out*/, hid_t es_id); +#endif /** * -------------------------------------------------------------------------- @@ -975,14 +1066,80 @@ H5_DLL herr_t H5Dread_async(const char *app_file, const char *app_func, unsigned H5_DLL herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf); +/** + * -------------------------------------------------------------------------- + * \ingroup H5D + * + * \brief Writes raw data from a set buffers to a set of datasets + * + * \param[in] count Number of datasets to write to + * \param[in] dset_id Identifiers of the datasets to write to + * \param[in] mem_type_id Identifiers of the memory datatypes + * \param[in] mem_space_id Identifiers of the memory dataspaces + * \param[in] file_space_id Identifiers of the datasets' dataspaces in the file + * \param[in] dxpl_id Identifier of a transfer property list + * \param[in] buf Buffers with data to be written to the file + * + * \return \herr_t + * + * \details H5Dwrite_multi() writes data to \p count datasets, whose identifiers + * are listed in the \p dset_id array, from multiple application memory + * buffers listed in the \p buf array. Data transfer properties are + * defined by the argument \p dxpl_id. The memory datatypes of each + * dataset are listed by identifier in the \p mem_type_id array. The + * parts of each dataset to write are listed by identifier in the \p + * file_space_id array, and the parts of each application memory buffer + * to write from are listed by identifier in the \p mem_space_id array. + * All array parameters have length \p count. + * + * This function will produce the same results as \p count calls to + * H5Dwrite(). Information listed in that function's documentation + * about the specifics of its behaviour also apply to H5Dwrite_multi(). + * By calling H5Dwrite_multi() instead of multiple calls to H5Dwrite(), + * however, the library can in some cases pass information about the + * entire I/O operation to the file driver, which can improve + * performance. + * + * All datasets must be in the same HDF5 file, and each unique dataset + * may only be listed once. If this function is called collectively in + * parallel, each rank must pass exactly the same list of datasets in + * \p dset_id , though the other parameters may differ. + * + * \since 1.14.0 + * + * \see H5Dwrite() + * + */ +H5_DLL herr_t H5Dwrite_multi(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, const void *buf[]); + /** * -------------------------------------------------------------------------- * \ingroup ASYNC * \async_variant_of{H5Dwrite} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Dwrite_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, hid_t es_id); +#else +H5_DLL herr_t H5Dwrite_async(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, + hid_t dxpl_id, const void *buf, hid_t es_id); +#endif + +/** + * -------------------------------------------------------------------------- + * \ingroup ASYNC + * \async_variant_of{H5Dwrite_multi} + */ +#ifndef H5_DOXYGEN +H5_DLL herr_t H5Dwrite_multi_async(const char *app_file, const char *app_func, unsigned app_line, + size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, const void *buf[], hid_t es_id); +#else +H5_DLL herr_t H5Dwrite_multi_async(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, const void *buf[], hid_t es_id); +#endif /** * -------------------------------------------------------------------------- @@ -993,7 +1150,7 @@ H5_DLL herr_t H5Dwrite_async(const char *app_file, const char *app_func, unsigne * \dset_id * \dxpl_id * \param[in] filters Mask for identifying the filters in use - * \param[in] offset Logical position of the chunk’s first element in the + * \param[in] offset Logical position of the chunk's first element in the * dataspace * \param[in] data_size Size of the actual data to be written in bytes * \param[in] buf Buffer containing data to be written to the chunk @@ -1005,19 +1162,19 @@ H5_DLL herr_t H5Dwrite_async(const char *app_file, const char *app_func, unsigne * from the application memory buffer \p buf to the dataset in * the file. Typically, the data in \p buf is preprocessed in * memory by a custom transformation, such as compression. The - * chunk will bypass the library’s internal data transfer + * chunk will bypass the library's internal data transfer * pipeline, including filters, and will be written directly to * the file. Only one chunk can be written with this function. * * \p filters is a mask providing a record of which filters are - * used with the the chunk. The default value of the mask is + * used with the chunk. The default value of the mask is * zero (0), indicating that all enabled filters are applied. A - * filter is skipped if the bit corresponding to the filter’s + * filter is skipped if the bit corresponding to the filter's * position in the pipeline (0 ≤ position < 32) is turned on. * This mask is saved with the chunk in the file. * * \p offset is an array specifying the logical position of the - * first element of the chunk in the dataset’s dataspace. The + * first element of the chunk in the dataset's dataspace. The * length of the offset array must equal the number of dimensions, * or rank, of the dataspace. The values in offset must not exceed * the dimension limits and must specify a point that falls on @@ -1056,10 +1213,10 @@ H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, con * * \dset_id * \dxpl_id - * \param[in] offset Logical position of the chunk’s first element in the + * \param[in] offset Logical position of the chunk's first element in the * dataspace * \param[in,out] filters Mask for identifying the filters in use - * \param[out] buf Buffer containing data to be written to the chunk + * \param[out] buf Buffer containing data to be read from the chunk * * \return \herr_t * @@ -1067,11 +1224,11 @@ H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, con * its logical offset \p offset in a chunked dataset \p dset_id * from the dataset in the file into the application memory * buffer \p buf. The data in \p buf is read directly from the - * file bypassing the library’s internal data transfer pipeline, + * file bypassing the library's internal data transfer pipeline, * including filters. * * \p offset is an array specifying the logical position of the - * first element of the chunk in the dataset’s dataspace. The + * first element of the chunk in the dataset's dataspace. The * length of the \p offset array must equal the number of dimensions, * or rank, of the dataspace. The values in \p offset must not exceed * the dimension limits and must specify a point that falls on @@ -1080,7 +1237,7 @@ H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, con * The mask \p filters indicates which filters were used when the * chunk was written. A zero value (all bits 0) indicates that all * enabled filters are applied on the chunk. A filter is skipped if - * the bit corresponding to the filter’s position in the pipeline + * the bit corresponding to the filter's position in the pipeline * (0 ≤ position < 32) is turned on. * * \p buf is the memory buffer containing the chunk read from @@ -1129,6 +1286,8 @@ H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, * be restarted at the point of exit; a second H5Diterate() * call will always restart at the beginning. * + * \warning Modifying the selection of \p space_id during iteration + * will lead to undefined behavior. * * \since 1.10.2 * @@ -1204,7 +1363,7 @@ H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf * -------------------------------------------------------------------------- * \ingroup H5D * - * \brief Changes the sizes of a dataset’s dimensions + * \brief Changes the sizes of a dataset's dimensions * * \dset_id * \param[in] size[] Array containing the new magnitude of each dimension @@ -1216,7 +1375,7 @@ H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf * chunked dataset \p dset_id to the sizes specified in size. * * \p size is a 1-dimensional array with n elements, where \p n is - * the rank of the dataset’s current dataspace. + * the rank of the dataset's current dataspace. * * This function can be applied to the following datasets: * - A chunked dataset with unlimited dimensions @@ -1231,20 +1390,20 @@ H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf * extended only along the first dimension. * * Space on disk is immediately allocated for the new dataset extent if - * the dataset’s space allocation time is set to #H5D_ALLOC_TIME_EARLY. + * the dataset's space allocation time is set to #H5D_ALLOC_TIME_EARLY. * * Fill values will be written to the dataset in either of the * following situations, but not otherwise: * - * - If the dataset’s fill time is set to #H5D_FILL_TIME_IFSET and a + * - If the dataset's fill time is set to #H5D_FILL_TIME_IFSET and a * fill value is defined (see H5Pset_fill_time() and * H5Pset_fill_value()) - * - If the dataset’s fill time is set to #H5D_FILL_TIME_ALLOC + * - If the dataset's fill time is set to #H5D_FILL_TIME_ALLOC * (see H5Pset_alloc_time()) * - * \note If the sizes specified in \p size array are smaller than the dataset’s - * current dimension sizes, H5Dset_extent() will reduce the dataset’s - * dimension sizes to the specified values. It is the user application’s + * \note If the sizes specified in \p size array are smaller than the dataset's + * current dimension sizes, H5Dset_extent() will reduce the dataset's + * dimension sizes to the specified values. It is the user application's * responsibility to ensure that valuable data is not lost as * H5Dset_extent() does not check. * @@ -1268,8 +1427,12 @@ H5_DLL herr_t H5Dset_extent(hid_t dset_id, const hsize_t size[]); * \ingroup ASYNC * \async_variant_of{H5Dset_extent} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Dset_extent_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id, const hsize_t size[], hid_t es_id); +#else +H5_DLL herr_t H5Dset_extent_async(hid_t dset_id, const hsize_t size[], hid_t es_id); +#endif /** * -------------------------------------------------------------------------- @@ -1339,7 +1502,7 @@ H5_DLL herr_t H5Drefresh(hid_t dset_id); * \p op and scatters it to the supplied buffer \p dst_buf in a * manner similar to data being written to a dataset. * - * \p dst_space_id is a dataspace which defines the extent of \p + * \p dst_space_id is a dataspace that defines the extent of \p * dst_buf and the selection within it to scatter the data to. * * \p type_id is the datatype of the data to be scattered in both @@ -1396,7 +1559,7 @@ H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hi * enough to hold all the data if the callback function \p op is * not provided. * - * \p op is a callback function which handles the gathered data. + * \p op is a callback function that handles the gathered data. * It is optional if \p dst_buf is large enough to hold all of the * gathered data; required otherwise. * @@ -1447,8 +1610,12 @@ H5_DLL herr_t H5Dclose(hid_t dset_id); * \ingroup ASYNC * \async_variant_of{H5Dclose} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Dclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id, hid_t es_id); +#else +H5_DLL herr_t H5Dclose_async(hid_t dset_id, hid_t es_id); +#endif /// \cond DEV /* Internal API routines */ H5_DLL herr_t H5Ddebug(hid_t dset_id); @@ -1461,13 +1628,15 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); /* (Must be defined _after_ the function prototype) */ /* (And must only defined when included in application code, not the library) */ #ifndef H5D_MODULE -#define H5Dcreate_async(...) H5Dcreate_async(__FILE__, __func__, __LINE__, __VA_ARGS__) -#define H5Dopen_async(...) H5Dopen_async(__FILE__, __func__, __LINE__, __VA_ARGS__) -#define H5Dget_space_async(...) H5Dget_space_async(__FILE__, __func__, __LINE__, __VA_ARGS__) -#define H5Dread_async(...) H5Dread_async(__FILE__, __func__, __LINE__, __VA_ARGS__) -#define H5Dwrite_async(...) H5Dwrite_async(__FILE__, __func__, __LINE__, __VA_ARGS__) -#define H5Dset_extent_async(...) H5Dset_extent_async(__FILE__, __func__, __LINE__, __VA_ARGS__) -#define H5Dclose_async(...) H5Dclose_async(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define H5Dcreate_async(...) H5Dcreate_async(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define H5Dopen_async(...) H5Dopen_async(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define H5Dget_space_async(...) H5Dget_space_async(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define H5Dread_async(...) H5Dread_async(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define H5Dread_multi_async(...) H5Dread_multi_async(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define H5Dwrite_async(...) H5Dwrite_async(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define H5Dwrite_multi_async(...) H5Dwrite_multi_async(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define H5Dset_extent_async(...) H5Dset_extent_async(__FILE__, __func__, __LINE__, __VA_ARGS__) +#define H5Dclose_async(...) H5Dclose_async(__FILE__, __func__, __LINE__, __VA_ARGS__) /* Define "wrapper" versions of function calls, to allow compile-time values to * be passed in by language wrapper or library layer on top of HDF5. @@ -1534,7 +1703,7 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); * path from the root of the file. Use of this function requires that * any intermediate groups specified in the path already exist. * - * The dataset’s datatype and dataspace are specified by \p type_id and + * The dataset's datatype and dataspace are specified by \p type_id and * \p space_id, respectively. These are the datatype and dataspace of * the dataset as it will exist in the file, which may differ from the * datatype and dataspace in application memory. @@ -1550,7 +1719,7 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); * H5reate1() and initialized with various property list functions * described in Property List Interface. * - * H5Dcreate() and H5Dcreate_anon() return an error if the dataset’s + * H5Dcreate() and H5Dcreate_anon() return an error if the dataset's * datatype includes a variable-length (VL) datatype and the fill value * is undefined, i.e., set to \c NULL in the dataset creation property * list. Such a VL datatype may be directly included, indirectly @@ -1559,10 +1728,10 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type); * * H5Dcreate() and H5Dcreate_anon() return a dataset identifier for * success or a negative value for failure. The dataset identifier - * should eventually be closed by calling H5Dclose() to release + * should eventually be closed by calling H5Dclose() to release the * resources it uses. * - * See H5Dcreate_anon() for discussion of the differences between + * See H5Dcreate_anon() for a discussion of the differences between * H5Dcreate() and H5Dcreate_anon(). * * The HDF5 library provides flexible means of specifying a fill value, @@ -1630,15 +1799,15 @@ H5_DLL hid_t H5Dopen1(hid_t loc_id, const char *name); * (see H5Screate_simple()) * * Space on disk is immediately allocated for the new dataset extent if - * the dataset’s space allocation time is set to + * the dataset's space allocation time is set to * #H5D_ALLOC_TIME_EARLY. Fill values will be written to the dataset if - * the dataset’s fill time is set to #H5D_FILL_TIME_IFSET or + * the dataset's fill time is set to #H5D_FILL_TIME_IFSET or * #H5D_FILL_TIME_ALLOC. (See H5Pset_fill_time() and * H5Pset_alloc_time().) * * This function ensures that the dataset dimensions are of at least * the sizes specified in size. The function H5Dset_extent() must be - * used if the dataset dimension sizes are are to be reduced. + * used if the dataset dimension sizes are to be reduced. * * \version 1.8.0 Function deprecated in this release. Parameter size * syntax changed to \Code{const hsize_t size[]} in this release. @@ -1666,7 +1835,7 @@ H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t size[]); * The \p type_id must be the datatype stored in the buffer. The \p * space_id describes the selection for the memory buffer to free the * VL datatypes within. The \p dxpl_id is the dataset transfer property - * list which was used for the I/O transfer to create the buffer. And + * list that was used for the I/O transfer to create the buffer. And * \p buf is the pointer to the buffer to be reclaimed. * * The VL structures (\ref hvl_t) in the user's buffer are modified to diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5DxferProp.h b/externals/coda-oss/modules/drivers/hdf5/include/H5DxferProp.h index 24f8d700dd..d0a65c108a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5DxferProp.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5DxferProp.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5EAmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5EAmodule.h index bba2a99b79..f992393ed5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5EAmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5EAmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5EA package. Including this header means that the source file - * is part of the H5EA package. + * Purpose: This file contains declarations which define macros for the + * H5EA package. Including this header means that the source file + * is part of the H5EA package. */ #ifndef H5EAmodule_H #define H5EAmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5EApkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5EApkg.h index c3cc937ce5..5014cc50f7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5EApkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5EApkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, June 17, 2008 - * * Purpose: This file contains declarations which are visible only * within the H5EA package. Source files outside the H5EA * package should include H5EAprivate.h instead. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5EAprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5EAprivate.h index c9c3f8bf6d..2780cb199d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5EAprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5EAprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EAprivate.h - * Jun 17 2008 - * Quincey Koziol * * Purpose: Private header for library accessible extensible * array routines. @@ -146,8 +143,4 @@ H5_DLL herr_t H5EA_patch_file(H5EA_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats); -/* Debugging routines */ -#ifdef H5EA_DEBUGGING -#endif /* H5EA_DEBUGGING */ - #endif /* H5EAprivate_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5ESdevelop.h b/externals/coda-oss/modules/drivers/hdf5/include/H5ESdevelop.h index 5bbf74ec49..b2facaacec 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5ESdevelop.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5ESdevelop.h @@ -2,10 +2,10 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5ESmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5ESmodule.h index 205089a15b..f128feeab0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5ESmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5ESmodule.h @@ -11,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Monday, April 6, 2020 - * * Purpose: This file contains declarations which define macros for the * H5ES package. Including this header means that the source file * is part of the H5ES package. @@ -28,13 +25,99 @@ #define H5_MY_PKG H5ES #define H5_MY_PKG_ERR H5E_EVENTSET -/**\defgroup H5ES H5ES +/** \page H5ES_UG The HDF5 Event Set + * @todo Under Construction + * + * \section sec_async The HDF5 Event Set Interface + * + * \section subsec_async_intro Introduction + * HDF5 provides asynchronous APIs for the HDF5 VOL connectors that support asynchronous HDF5 + * operations using the HDF5 Event Set (H5ES) API. This allows I/O to proceed in the background + * while the application is performing other tasks. + * + * To support AIO capabilities for the HDF5 VOL connectors, the AIO versions for the functions + * listed in the table below were added to HDF5 library version 1.14.0 and later. The async version + * of the function has “_async” suffix added to the function name. For example, the async version + * for H5Fcreate is H5Fcreate_async. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
InterfaceFunctions
H5F#H5Fcreate, #H5Fflush, #H5Fis_accessible, #H5Fopen, #H5Fclose + *
H5G#H5Gcreate, #H5Gget_info, #H5Gget_info_by_idx, #H5Gget_info_by_name, #H5Gclose + *
H5D#H5Dcreate, #H5Dopen, #H5Dset_extent, #H5Dwrite, #H5Dread, #H5Dget_space, #H5Dclose + *
H5A#H5Acreate, #H5Acreate_by_name, #H5Aopen, #H5Aopen_by_name, #H5Aexists, #H5Awrite, #H5Aread, +#H5Aclose, #H5Aopen_by_idx, #H5Arename, #H5Arename_by_name + *
H5L#H5Lcreate_hard, #H5Lcreate_soft, #H5Ldelete, #H5Ldelete_by_idx, #H5Lexists + *
H5O#H5Ocopy, #H5Orefresh, #H5Oflush, #H5Oclose, #H5Oopen, #H5Oopen_by_idx + *
H5R#H5Ropen_attr, #H5Ropen_object #H5Ropen_region, #H5Rdereference + *
H5M#H5Mcreate, #H5Mopen, #H5Mput, #H5Mget, #H5Mclose + *
H5T#H5Tcommit, #H5Topen, #H5Tcopy, #H5Tclose + *
+ * + * Async versions of the functions have an extra parameter called the event set parameter or es_id. + * For example, compare the signatures of #H5Dclose and #H5Dclose_async: + * \code + * herr_t H5Dclose(hid_t dset_id); + * herr_t H5Dclose_async(hid_t dset_id, hid_t es_id); + * \endcode + * + * An event set is an in-memory object that is created by an application and used to track many + * asynchronous operations with a single object. They function like a "bag" -- holding request + * tokens from one or more asynchronous operations and provide a simple interface for inspecting + * the status of the entire set of operations. + * + * See the \ref H5ES APIs that were added to the HDF5 library to manage event sets. + * + * Previous Chapter \ref sec_vol - Next Chapter \ref sec_map + * + */ + +/**\defgroup H5ES Event Set Interface (H5ES) * * \todo Add the event set life cycle. * * \brief Event Set Interface * - * \details \Bold{This interface can be only used with the HDF5 VOL connectors that + * \details \Bold{This interface can only be used with the HDF5 VOL connectors that * enable the asynchronous feature in HDF5.} The native HDF5 library has * only synchronous operations. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5ESpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5ESpkg.h index 68e16c127c..655efbbe8e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5ESpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5ESpkg.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Wednesday, April 8, 2020 - * - * Purpose: This file contains declarations which are visible only within - * the H5ES package. Source files outside the H5ES package should - * include H5ESprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5ES package. Source files outside the H5ES package should + * include H5ESprivate.h instead. */ #if !(defined H5ES_FRIEND || defined H5ES_MODULE) #error "Do not include this file outside the H5ES package!" diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5ESprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5ESprivate.h index 153e3e3a94..52392fbfd4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5ESprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5ESprivate.h @@ -13,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5ESprivate.h - * Apr 6 2020 - * Quincey Koziol * * Purpose: Private header for library accessible event set routines. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5ESpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5ESpublic.h index 3aeb87298a..b5f2af48f7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5ESpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5ESpublic.h @@ -2,7 +2,7 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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://www.hdfgroup.org/licenses. * @@ -17,53 +17,60 @@ #ifndef H5ESpublic_H #define H5ESpublic_H -/* Public headers needed by this file */ -#include "H5public.h" /* Generic Functions */ +#include "H5public.h" /* Generic Functions */ +#include "H5Ipublic.h" /* Identifiers */ /*****************/ /* Public Macros */ /*****************/ -/* Default value for "no event set" / synchronous execution */ -#define H5ES_NONE 0 /* (hid_t) */ +/** + * Default value for "no event set" / synchronous execution. Used in + * place of a @ref hid_t identifier. + */ +#define H5ES_NONE 0 /* Special "wait" timeout values */ -#define H5ES_WAIT_FOREVER (UINT64_MAX) /* Wait until all operations complete */ -#define H5ES_WAIT_NONE \ - (0) /* Don't wait for operations to complete, \ - * just check their status. \ - * (this allows H5ESwait to behave \ - * like a 'test' operation) \ - */ +#define H5ES_WAIT_FOREVER (UINT64_MAX) /**< Wait until all operations complete */ + +/** + * Don't wait for operations to complete, just check their status. + * (This allows @ref H5ESwait to behave like a 'test' operation) + */ +#define H5ES_WAIT_NONE (0) /*******************/ /* Public Typedefs */ /*******************/ -/* Asynchronous operation status */ +/** + * Asynchronous operation status + */ typedef enum H5ES_status_t { - H5ES_STATUS_IN_PROGRESS, /* Operation(s) have not yet completed */ - H5ES_STATUS_SUCCEED, /* Operation(s) have completed, successfully */ - H5ES_STATUS_CANCELED, /* Operation(s) has been canceled */ - H5ES_STATUS_FAIL /* An operation has completed, but failed */ + H5ES_STATUS_IN_PROGRESS, /**< Operation(s) have not yet completed */ + H5ES_STATUS_SUCCEED, /**< Operation(s) have completed, successfully */ + H5ES_STATUS_CANCELED, /**< Operation(s) has been canceled */ + H5ES_STATUS_FAIL /**< An operation has completed, but failed */ } H5ES_status_t; -/* Information about operations in an event set */ +/** + * Information about operations in an event set + */ typedef struct H5ES_op_info_t { /* API call info */ - const char *api_name; /* Name of HDF5 API routine called */ - char *api_args; /* "Argument string" for arguments to HDF5 API routine called */ + const char *api_name; /**< Name of HDF5 API routine called */ + char *api_args; /**< "Argument string" for arguments to HDF5 API routine called */ /* Application info */ - const char *app_file_name; /* Name of source file where the HDF5 API routine was called */ - const char *app_func_name; /* Name of function where the HDF5 API routine was called */ - unsigned app_line_num; /* Line # of source file where the HDF5 API routine was called */ + const char *app_file_name; /**< Name of source file where the HDF5 API routine was called */ + const char *app_func_name; /**< Name of function where the HDF5 API routine was called */ + unsigned app_line_num; /**< Line # of source file where the HDF5 API routine was called */ /* Operation info */ - uint64_t op_ins_count; /* Counter of operation's insertion into event set */ - uint64_t op_ins_ts; /* Timestamp for when the operation was inserted into the event set */ - uint64_t op_exec_ts; /* Timestamp for when the operation began execution */ - uint64_t op_exec_time; /* Execution time for operation (in ns) */ + uint64_t op_ins_count; /**< Counter of operation's insertion into event set */ + uint64_t op_ins_ts; /**< Timestamp for when the operation was inserted into the event set */ + uint64_t op_exec_ts; /**< Timestamp for when the operation began execution */ + uint64_t op_exec_time; /**< Execution time for operation (in ns) */ } H5ES_op_info_t; //! @@ -115,7 +122,14 @@ How to Trace Async Operations? */ +/** + * Callback for H5ESregister_insert_func() + */ typedef int (*H5ES_event_insert_func_t)(const H5ES_op_info_t *op_info, void *ctx); + +/** + * Callback for H5ESregister_complete_func() + */ typedef int (*H5ES_event_complete_func_t)(const H5ES_op_info_t *op_info, H5ES_status_t status, hid_t err_stack, void *ctx); @@ -136,12 +150,12 @@ extern "C" { * * \brief Creates an event set * - * \returns \hid_ti{event set} + * \returns \hid_t{event set} * * \details H5EScreate() creates a new event set and returns a corresponding * event set identifier. * - * \since 1.13.0 + * \since 1.14.0 * */ H5_DLL hid_t H5EScreate(void); @@ -174,10 +188,27 @@ H5_DLL hid_t H5EScreate(void); * immediately if an operation fails. If a failure occurs, the value * returned for the number of operations in progress may be inaccurate. * - * \since 1.13.0 + * \since 1.14.0 * */ H5_DLL herr_t H5ESwait(hid_t es_id, uint64_t timeout, size_t *num_in_progress, hbool_t *err_occurred); + +/** + * \ingroup H5ES + * + * \brief Attempt to cancel operations in an event set + * + * \es_id + * \param[out] num_not_canceled The number of events not canceled + * \param[out] err_occurred Status indicating if error is present in the event set + * \returns \herr_t + * + * \details H5EScancel() attempts to cancel operations in an event set specified + * by \p es_id. H5ES_NONE is a valid value for \p es_id, but functions as a no-op. + * + * \since 1.14.0 + * + */ H5_DLL herr_t H5EScancel(hid_t es_id, size_t *num_not_canceled, hbool_t *err_occurred); /** @@ -192,7 +223,7 @@ H5_DLL herr_t H5EScancel(hid_t es_id, size_t *num_not_canceled, hbool_t *err_occ * \details H5ESget_count() retrieves number of events in an event set specified * by \p es_id. * - * \since 1.13.0 + * \since 1.14.0 * */ H5_DLL herr_t H5ESget_count(hid_t es_id, size_t *count); @@ -200,20 +231,20 @@ H5_DLL herr_t H5ESget_count(hid_t es_id, size_t *count); /** * \ingroup H5ES * - * \brief Retrieves the next operation counter to be assigned in an event set + * \brief Retrieves the accumulative operation counter for an event set * * \es_id - * \param[out] counter The next counter value to be assigned to an event + * \param[out] counter The accumulative counter value for an event set * \returns \herr_t * - * \details H5ESget_op_counter() retrieves the \p counter that will be assigned - * to the next operation inserted into the event set \p es_id. + * \details H5ESget_op_counter() retrieves the current accumulative count of + * event set operations since the event set creation of \p es_id. * * \note This is designed for wrapper libraries mainly, to use as a mechanism * for matching operations inserted into the event set with possible * errors that occur. * - * \since 1.13.0 + * \since 1.14.0 * */ H5_DLL herr_t H5ESget_op_counter(hid_t es_id, uint64_t *counter); @@ -231,7 +262,7 @@ H5_DLL herr_t H5ESget_op_counter(hid_t es_id, uint64_t *counter); * \details H5ESget_err_status() checks if event set specified by es_id has * failed operations. * - * \since 1.13.0 + * \since 1.14.0 * */ H5_DLL herr_t H5ESget_err_status(hid_t es_id, hbool_t *err_occurred); @@ -251,7 +282,7 @@ H5_DLL herr_t H5ESget_err_status(hid_t es_id, hbool_t *err_occurred); * The function does not wait for active operations to complete, so * count may not include all failures. * - * \since 1.13.0 + * \since 1.14.0 * */ H5_DLL herr_t H5ESget_err_count(hid_t es_id, size_t *num_errs); @@ -275,13 +306,63 @@ H5_DLL herr_t H5ESget_err_count(hid_t es_id, size_t *num_errs); * \snippet this H5ES_err_info_t_snip * \click4more * - * \since 1.13.0 + * \since 1.14.0 * */ H5_DLL herr_t H5ESget_err_info(hid_t es_id, size_t num_err_info, H5ES_err_info_t err_info[], size_t *err_cleared); +/** + * \ingroup H5ES + * + * \brief Convenience routine to free an array of H5ES_err_info_t structs + * + * \param[in] num_err_info The number of elements in \p err_info array + * \param[in] err_info Array of structures + * \returns \herr_t + * + * \since 1.14.0 + * + */ H5_DLL herr_t H5ESfree_err_info(size_t num_err_info, H5ES_err_info_t err_info[]); + +/** + * \ingroup H5ES + * + * \brief Registers a callback to invoke when a new operation is inserted into + * an event set + * + * \es_id + * \param[in] func The insert function to register + * \param[in] ctx User-specified information (context) to pass to \p func + * \returns \herr_t + * + * \details Only one insert callback can be registered for each event set. + * Registering a new callback will replace the existing one. + * H5ES_NONE is a valid value for 'es_id', but functions as a no-op + * + * \since 1.14.0 + * + */ H5_DLL herr_t H5ESregister_insert_func(hid_t es_id, H5ES_event_insert_func_t func, void *ctx); + +/** + * \ingroup H5ES + * + * \brief Registers a callback to invoke when an operation completes within an + * event set + * + * \es_id + * \param[in] func The completion function to register + * \param[in] ctx User-specified information (context) to pass to \p func + * \returns \herr_t + * + * \details Only one complete callback can be registered for each event set. + * Registering a new callback will replace the existing one. + * H5ES_NONE is a valid value for 'es_id', but functions as a no-op + * + * \since 1.14.0 + * + */ H5_DLL herr_t H5ESregister_complete_func(hid_t es_id, H5ES_event_complete_func_t func, void *ctx); /** @@ -294,7 +375,7 @@ H5_DLL herr_t H5ESregister_complete_func(hid_t es_id, H5ES_event_complete_func_t * * \details H5ESclose() terminates access to an event set specified by \p es_id. * - * \since 1.13.0 + * \since 1.14.0 * */ H5_DLL herr_t H5ESclose(hid_t es_id); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Edefin.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Edefin.h index 77e26818b1..a526488ffb 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Edefin.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Edefin.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Einit.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Einit.h index 564f4cbef5..964ef7eb9e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Einit.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Einit.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -22,201 +21,201 @@ /* Major error codes */ /*********************/ -HDassert(H5E_FUNC_g==(-1)); +assert(H5E_FUNC_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Function entry/exit"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_FUNC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FILE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_FILE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "File accessibility"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_FILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_VOL_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_VOL_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Virtual Object Layer"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_VOL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SOHM_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_SOHM_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Shared Object Header Messages"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_SOHM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SYM_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_SYM_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Symbol table"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_SYM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PLUGIN_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_PLUGIN_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Plugin for dynamically loaded library"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_PLUGIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_VFL_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_VFL_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Virtual File Layer"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_VFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_INTERNAL_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_INTERNAL_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Internal error (too specific to document in detail)"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_INTERNAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BTREE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_BTREE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "B-Tree node"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BTREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_REFERENCE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_REFERENCE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "References"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_REFERENCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DATASPACE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_DATASPACE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Dataspace"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_DATASPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_RESOURCE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_RESOURCE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Resource unavailable"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_RESOURCE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_EVENTSET_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_EVENTSET_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Event Set"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_EVENTSET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ID_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_ID_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Object ID"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_ID_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_RS_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_RS_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Reference Counted Strings"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_RS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FARRAY_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_FARRAY_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Fixed Array"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_FARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_HEAP_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_HEAP_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Heap"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_HEAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_MAP_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_MAP_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Map"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_MAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ATTR_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_ATTR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Attribute"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_ATTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_IO_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_IO_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Low-level I/O"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_IO_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_EFL_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_EFL_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "External file list"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_EFL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_TST_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_TST_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Ternary Search Trees"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_TST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_LIB_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_LIB_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "General library infrastructure"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_LIB_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PAGEBUF_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_PAGEBUF_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Page Buffering"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_PAGEBUF_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FSPACE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_FSPACE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Free Space Manager"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_FSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DATASET_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_DATASET_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Dataset"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_DATASET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_STORAGE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_STORAGE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Data storage"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_STORAGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_LINK_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_LINK_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Links"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_LINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PLIST_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_PLIST_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Property lists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_PLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DATATYPE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_DATATYPE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Datatype"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_DATATYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_OHDR_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_OHDR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Object header"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_OHDR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NONE_MAJOR_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_NONE_MAJOR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "No error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NONE_MAJOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SLIST_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_SLIST_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Skip Lists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_SLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ARGS_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_ARGS_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Invalid arguments to routine"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_ARGS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CONTEXT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CONTEXT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "API Context"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CONTEXT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_EARRAY_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_EARRAY_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Extensible Array"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_EARRAY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PLINE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_PLINE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Data filters"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_PLINE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ERROR_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_ERROR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Error API"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_ERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CACHE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CACHE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MAJOR, "Object cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /*********************/ /* Minor error codes */ @@ -224,749 +223,749 @@ if((H5E_CACHE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) /* Object ID related errors */ -HDassert(H5E_BADID_g==(-1)); +assert(H5E_BADID_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to find ID information (already closed?)"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BADID_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADGROUP_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_BADGROUP_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to find ID group information"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BADGROUP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTREGISTER_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTREGISTER_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to register new ID"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTREGISTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTINC_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTINC_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to increment reference count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTINC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDEC_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTDEC_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to decrement reference count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTDEC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOIDS_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_NOIDS_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Out of IDs for group"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NOIDS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Generic low-level file I/O errors */ -HDassert(H5E_SEEKERROR_g==(-1)); +assert(H5E_SEEKERROR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Seek failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_SEEKERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_READERROR_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_READERROR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Read failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_READERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_WRITEERROR_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_WRITEERROR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Write failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_WRITEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CLOSEERROR_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CLOSEERROR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Close failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CLOSEERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_OVERFLOW_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_OVERFLOW_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Address overflowed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_OVERFLOW_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FCNTL_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_FCNTL_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "File control (fcntl) failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_FCNTL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Resource errors */ -HDassert(H5E_NOSPACE_g==(-1)); +assert(H5E_NOSPACE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "No space available for allocation"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NOSPACE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTALLOC_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTALLOC_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't allocate space"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTALLOC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCOPY_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTCOPY_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to copy object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCOPY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTFREE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTFREE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to free object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTFREE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ALREADYEXISTS_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_ALREADYEXISTS_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_ALREADYEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTLOCK_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTLOCK_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to lock object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNLOCK_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTUNLOCK_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to unlock object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTUNLOCK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTGC_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTGC_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to garbage collect"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTGC_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTGETSIZE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTGETSIZE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to compute size"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTGETSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_OBJOPEN_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_OBJOPEN_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Object is already open"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_OBJOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Heap errors */ -HDassert(H5E_CANTRESTORE_g==(-1)); +assert(H5E_CANTRESTORE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't restore condition"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTRESTORE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCOMPUTE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTCOMPUTE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't compute value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCOMPUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTEXTEND_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTEXTEND_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't extend heap's space"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTEXTEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTATTACH_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTATTACH_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't attach object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTATTACH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUPDATE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTUPDATE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't update object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTUPDATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTOPERATE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTOPERATE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't operate on object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTOPERATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Map related errors */ -HDassert(H5E_CANTPUT_g==(-1)); +assert(H5E_CANTPUT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't put value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTPUT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Function entry/exit interface errors */ -HDassert(H5E_CANTINIT_g==(-1)); +assert(H5E_CANTINIT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to initialize object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ALREADYINIT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_ALREADYINIT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Object already initialized"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_ALREADYINIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRELEASE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTRELEASE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to release object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTRELEASE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Property list errors */ -HDassert(H5E_CANTGET_g==(-1)); +assert(H5E_CANTGET_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't get value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTGET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSET_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTSET_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't set value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTSET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_DUPCLASS_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_DUPCLASS_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Duplicate class name in parent class"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_DUPCLASS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SETDISALLOWED_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_SETDISALLOWED_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Disallowed operation"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_SETDISALLOWED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Asynchronous operation errors */ -HDassert(H5E_CANTWAIT_g==(-1)); +assert(H5E_CANTWAIT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't wait on operation"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTWAIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCANCEL_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTCANCEL_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't cancel operation"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCANCEL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Free space errors */ -HDassert(H5E_CANTMERGE_g==(-1)); +assert(H5E_CANTMERGE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't merge objects"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTMERGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTREVIVE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTREVIVE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't revive object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTREVIVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSHRINK_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTSHRINK_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't shrink container"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTSHRINK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Object header related errors */ -HDassert(H5E_LINKCOUNT_g==(-1)); +assert(H5E_LINKCOUNT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Bad object header link count"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_LINKCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_VERSION_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_VERSION_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Wrong version number"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_VERSION_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_ALIGNMENT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_ALIGNMENT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Alignment error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_ALIGNMENT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADMESG_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_BADMESG_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unrecognized message"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BADMESG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDELETE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTDELETE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't delete message"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTDELETE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADITER_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_BADITER_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Iteration failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BADITER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTPACK_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTPACK_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't pack messages"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTPACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRESET_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTRESET_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't reset object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTRESET_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRENAME_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTRENAME_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to rename object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTRENAME_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* System level errors */ -HDassert(H5E_SYSERRSTR_g==(-1)); +assert(H5E_SYSERRSTR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "System error message"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_SYSERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* I/O pipeline errors */ -HDassert(H5E_NOFILTER_g==(-1)); +assert(H5E_NOFILTER_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Requested filter is not available"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NOFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CALLBACK_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CALLBACK_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Callback failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CALLBACK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANAPPLY_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANAPPLY_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Error from filter 'can apply' callback"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANAPPLY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SETLOCAL_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_SETLOCAL_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Error from filter 'set local' callback"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_SETLOCAL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOENCODER_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_NOENCODER_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Filter present but encoding disabled"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NOENCODER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTFILTER_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTFILTER_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Filter operation failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTFILTER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Group related errors */ -HDassert(H5E_CANTOPENOBJ_g==(-1)); +assert(H5E_CANTOPENOBJ_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't open object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTOPENOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCLOSEOBJ_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTCLOSEOBJ_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't close object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCLOSEOBJ_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_COMPLEN_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_COMPLEN_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Name component is too long"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_COMPLEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PATH_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_PATH_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Problem with path to object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_PATH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* No error */ -HDassert(H5E_NONE_MINOR_g==(-1)); +assert(H5E_NONE_MINOR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "No error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NONE_MINOR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Plugin errors */ -HDassert(H5E_OPENERROR_g==(-1)); +assert(H5E_OPENERROR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't open directory or file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_OPENERROR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* File accessibility errors */ -HDassert(H5E_FILEEXISTS_g==(-1)); +assert(H5E_FILEEXISTS_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "File already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_FILEEXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_FILEOPEN_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_FILEOPEN_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "File already open"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_FILEOPEN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCREATE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTCREATE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to create file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCREATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTOPENFILE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTOPENFILE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to open file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTOPENFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCLOSEFILE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTCLOSEFILE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to close file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCLOSEFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOTHDF5_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_NOTHDF5_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Not an HDF5 file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NOTHDF5_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADFILE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_BADFILE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Bad file ID accessed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BADFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_TRUNCATED_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_TRUNCATED_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "File has been truncated"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_TRUNCATED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_MOUNT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_MOUNT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "File mount error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_MOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_UNMOUNT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_UNMOUNT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "File unmount error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_UNMOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDELETEFILE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTDELETEFILE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to delete file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTDELETEFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTLOCKFILE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTLOCKFILE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to lock file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTLOCKFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNLOCKFILE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTUNLOCKFILE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to unlock file"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTUNLOCKFILE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Cache related errors */ -HDassert(H5E_CANTFLUSH_g==(-1)); +assert(H5E_CANTFLUSH_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to flush data from cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTFLUSH_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNSERIALIZE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTUNSERIALIZE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to mark metadata as unserialized"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTUNSERIALIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSERIALIZE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTSERIALIZE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to serialize data from cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTSERIALIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTTAG_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTTAG_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to tag metadata in the cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTTAG_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTLOAD_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTLOAD_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to load metadata into cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTLOAD_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_PROTECT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_PROTECT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Protected metadata error"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_PROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOTCACHED_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_NOTCACHED_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Metadata not currently cached"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NOTCACHED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_SYSTEM_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_SYSTEM_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Internal error detected"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_SYSTEM_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTINS_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTINS_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to insert metadata into cache"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTINS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTPROTECT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTPROTECT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to protect metadata"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNPROTECT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTUNPROTECT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to unprotect metadata"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTUNPROTECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTPIN_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTPIN_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to pin cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNPIN_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTUNPIN_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to un-pin cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTUNPIN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTMARKDIRTY_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTMARKDIRTY_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to mark a pinned entry as dirty"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTMARKDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTMARKCLEAN_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTMARKCLEAN_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to mark a pinned entry as clean"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTMARKCLEAN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTMARKUNSERIALIZED_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTMARKUNSERIALIZED_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to mark an entry as unserialized"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTMARKUNSERIALIZED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTMARKSERIALIZED_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTMARKSERIALIZED_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to mark an entry as serialized"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTMARKSERIALIZED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDIRTY_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTDIRTY_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to mark metadata as dirty"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTDIRTY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCLEAN_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTCLEAN_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to mark metadata as clean"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCLEAN_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTEXPUNGE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTEXPUNGE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to expunge a metadata cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTEXPUNGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRESIZE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTRESIZE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to resize a metadata cache entry"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTRESIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDEPEND_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTDEPEND_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to create a flush dependency"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTDEPEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNDEPEND_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTUNDEPEND_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to destroy a flush dependency"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTUNDEPEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTNOTIFY_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTNOTIFY_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to notify object about action"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTNOTIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_LOGGING_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_LOGGING_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Failure in the cache logging framework"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_LOGGING_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCORK_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTCORK_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to cork an object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCORK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTUNCORK_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTUNCORK_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to uncork an object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTUNCORK_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Link related errors */ -HDassert(H5E_TRAVERSE_g==(-1)); +assert(H5E_TRAVERSE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Link traversal failure"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_TRAVERSE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NLINKS_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_NLINKS_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Too many soft links in path"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NLINKS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NOTREGISTERED_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_NOTREGISTERED_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Link class not registered"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NOTREGISTERED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTMOVE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTMOVE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't move object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSORT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTSORT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't sort objects"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTSORT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Parallel MPI errors */ -HDassert(H5E_MPI_g==(-1)); +assert(H5E_MPI_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Some MPI function failed"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_MPI_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_MPIERRSTR_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_MPIERRSTR_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "MPI Error String"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_MPIERRSTR_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTRECV_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTRECV_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't receive data"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTRECV_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTGATHER_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTGATHER_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't gather data"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTGATHER_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_NO_INDEPENDENT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_NO_INDEPENDENT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't perform independent IO"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NO_INDEPENDENT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Dataspace errors */ -HDassert(H5E_CANTCLIP_g==(-1)); +assert(H5E_CANTCLIP_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't clip hyperslab region"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCLIP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCOUNT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTCOUNT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't count elements"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCOUNT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSELECT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTSELECT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't select hyperslab"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTSELECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTNEXT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTNEXT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't move to next iterator location"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTNEXT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADSELECT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_BADSELECT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Invalid selection"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BADSELECT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTCOMPARE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTCOMPARE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't compare objects"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCOMPARE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_INCONSISTENTSTATE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_INCONSISTENTSTATE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Internal states are inconsistent"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_INCONSISTENTSTATE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTAPPEND_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTAPPEND_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't append object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTAPPEND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Argument errors */ -HDassert(H5E_UNINITIALIZED_g==(-1)); +assert(H5E_UNINITIALIZED_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Information is uinitialized"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_UNINITIALIZED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_UNSUPPORTED_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_UNSUPPORTED_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Feature is unsupported"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_UNSUPPORTED_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADTYPE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_BADTYPE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Inappropriate type"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BADTYPE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADRANGE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_BADRANGE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Out of range"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BADRANGE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADVALUE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_BADVALUE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Bad value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BADVALUE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* B-tree related errors */ -HDassert(H5E_NOTFOUND_g==(-1)); +assert(H5E_NOTFOUND_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Object not found"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_NOTFOUND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_EXISTS_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_EXISTS_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Object already exists"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_EXISTS_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTENCODE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTENCODE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to encode value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTENCODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTDECODE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTDECODE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to decode value"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTDECODE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSPLIT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTSPLIT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to split node"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTSPLIT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTREDISTRIBUTE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTREDISTRIBUTE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to redistribute records"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTREDISTRIBUTE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTSWAP_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTSWAP_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to swap records"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTSWAP_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTINSERT_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTINSERT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to insert object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTINSERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTLIST_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTLIST_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to list node"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTLIST_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTMODIFY_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTMODIFY_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to modify record"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTMODIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTREMOVE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTREMOVE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to remove object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTREMOVE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_CANTFIND_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_CANTFIND_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Unable to check for record"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTFIND_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); /* Datatype conversion errors */ -HDassert(H5E_CANTCONVERT_g==(-1)); +assert(H5E_CANTCONVERT_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Can't convert datatypes"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_CANTCONVERT_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") -HDassert(H5E_BADSIZE_g==(-1)); + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); +assert(H5E_BADSIZE_g==(-1)); if((msg = H5E__create_msg(cls, H5E_MINOR, "Bad size for object"))==NULL) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed"); if((H5E_BADSIZE_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message"); #endif /* H5Einit_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Emodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Emodule.h index a2d59f3695..b41f70d8eb 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Emodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Emodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5E package. Including this header means that the source file - * is part of the H5E package. + * Purpose: This file contains declarations which define macros for the + * H5E package. Including this header means that the source file + * is part of the H5E package. */ #ifndef H5Emodule_H #define H5Emodule_H @@ -28,30 +25,502 @@ #define H5_MY_PKG H5E #define H5_MY_PKG_ERR H5E_ERROR -/**\defgroup H5E H5E +/** \page H5E_UG HDF5 Error Handling + * + * \section sec_error HDF5 Error Handling + * + * The HDF5 library provides an error reporting mechanism for both the library itself and for user + * application programs. It can trace errors through function stack and error information like file + * name, function name, line number, and error description. + * + * \subsection subsec_error_intro Introduction + * The HDF5 Library provides an error reporting mechanism for both the library itself and for user application + * programs. It can trace errors through function stack and error information like file name, function name, + * line number, and error description. + * + * \ref subsec_error_ops discusses the basic error concepts such as error stack, error record, and error + * message and describes the related API functions. These concepts and functions are sufficient for + * application programs to trace errors inside the HDF5 Library. + * + * \ref subsec_error_adv talks about the advanced concepts of error + * class and error stack handle and talks about the related functions. With these concepts and functions, an + * application library or program using the HDF5 Library can have its own error report blended with HDF5's + * error report. + * + * Starting with Release 1.8, we have a new set of Error Handling API functions. For the purpose of backward + * compatibility with version 1.6 and before, we still keep the old API functions, \ref H5Epush1, + * \ref H5Eprint1, \ref H5Ewalk1, \ref H5Eclear1, \ref H5Eget_auto1, \ref H5Eset_auto1. These functions do + * not have the error stack as a parameter. The library allows them to operate on the default error stack. + * (The H5E compatibility macros will choose the correct function based on the parameters) + * + * The old API is similar to functionality discussed in \ref subsec_error_ops. The functionality discussed in + * \ref subsec_error_adv,the ability of allowing applications to add their own error records, is the new + * design for the Error Handling API. + * + * \subsection subsec_error_H5E Error Handling Function Summaries + * @see H5E reference manual + * + * \subsection subsec_error_program Programming Model for Error Handling + * This section is under construction. + * + * \subsection subsec_error_ops Basic Error Handling Operations + * Let us first try to understand the error stack. An error stack is a collection of error records. Error + * records can be pushed onto or popped off the error stack. By default, when an error occurs deep within + * the HDF5 Library, an error record is pushed onto an error stack and that function returns a failure + * indication. + * Its caller detects the failure, pushes another record onto the stack, and returns a failure indication. + * This continues until the API function called by the application returns a failure indication. The next + * API function being called will reset the error stack. All HDF5 Library error records belong to the same + * error class. For more information, see \ref subsec_error_adv. + * + * \subsubsection subsubsec_error_ops_stack Error Stack and Error Message + * In normal circumstances, an error causes the stack to be printed on the standard error stream + * automatically. + * This automatic error stack is the library's default stack. For all the functions in this section, whenever + * an error stack ID is needed as a parameter, \ref H5E_DEFAULT can be used to indicate the library's default + * stack. The first error record of the error stack, number #000, is produced by the API function itself and + * is usually sufficient to indicate to the application what went wrong. + * + * + * + * + * + *
Example: An Error Message
+ *

If an application calls \ref H5Tclose on a + * predefined datatype then the following message is + * printed on the standard error stream. This is a + * simple error that has only one component, the API + * function; other errors may have many components. + *

+ * HDF5-DIAG: Error detected in HDF5 (1.10.9) thread 0.
+ *    #000: H5T.c line ### in H5Tclose(): predefined datatype
+ *       major: Function argument
+ *       minor: Bad value
+ *         
+ *
+ * In the example above, we can see that an error record has a major message and a minor message. A major + * message generally indicates where the error happens. The location can be a dataset or a dataspace, for + * example. A minor message explains further details of the error. An example is “unable to open file”. + * Another specific detail about the error can be found at the end of the first line of each error record. + * This error description is usually added by the library designer to tell what exactly goes wrong. In the + * example above, the “predefined datatype” is an error description. + * + * \subsubsection subsubsec_error_ops_print Print and Clear an Error Stack + * Besides the automatic error report, the error stack can also be printed and cleared by the functions + * \ref H5Eprint2 and \ref H5Eclear2. If an application wishes to make explicit + * calls to \ref H5Eprint2 to print the error stack, the automatic printing should be turned off + * to prevent error messages from being displayed twice (see \ref H5Eset_auto2). + * + * To print an error stack: + * \code + * herr_t H5Eprint2(hid_t error_stack, FILE * stream) + * \endcode + * This function prints the error stack specified by error_stack on the specified stream, stream. If the + * error stack is empty, a one‐line message will be printed. The following is an example of such a message. + * This message would be generated if the error was in the HDF5 Library. + * \code + * HDF5-DIAG: Error detected in HDF5 Library version: 1.10.9 thread 0. + * \endcode + * + * To clear an error stack: + * \code + * herr_t H5Eclear2(hid_t error_stack) + * \endcode + * The \ref H5Eclear2 function shown above clears the error stack specified by error_stack. + * \ref H5E_DEFAULT can be passed in to clear the current error stack. The current stack is also cleared + * whenever an API function is called; there are certain exceptions to this rule such as \ref H5Eprint2. + * + * \subsubsection subsubsec_error_ops_mute Mute Error Stack + * Sometimes an application calls a function for the sake of its return value, fully expecting the function + * to fail; sometimes the application wants to call \ref H5Eprint2 explicitly. In these situations, + * it would be misleading if an error message were still automatically printed. Using the + * \ref H5Eset_auto2 function can control the automatic printing of error messages. + * + * To enable or disable automatic printing of errors: + * \code + * herr_t H5Eset_auto2(hid_t error_stack, H5E_auto_t func, void *client_data) + * \endcode + * The \ref H5Eset_auto2 function can be used to turn on or off the automatic printing of errors + * for the error stack specified by error_stack. When turned on (non‐null func pointer), any API function + * which returns an error indication will first call func, passing it client_data as an argument. When the + * library is first initialized the auto printing function is set to \ref H5Eprint2 and client_data + * is the standard error stream pointer, stderr. + * + * To see the current settings: + * \code + * herr_t H5Eget_auto(hid_t error_stack, H5E_auto_t * func, void **client_data) + * \endcode + * The function above returns the current settings for the automatic error stack traversal function, func, and + * its data, client_data. If either or both of the arguments are null, then the value is not returned. + * + * An application can temporarily turn off error messages while “probing” a function. See the + * example below. + * + * Example: Turn off error messages while probing a function + * \code + * *** Save old error handler *** + * H5E_auto2_t oldfunc; + * void *old_client_data; + * H5Eget_auto2(error_stack, &old_func, &old_client_data); + * *** Turn off error handling *** + * H5Eset_auto2(error_stack, NULL, NULL); + * *** Probe. Likely to fail, but that's okay *** + * status = H5Fopen (......); + * *** Restore previous error handler *** + * H5Eset_auto2(error_stack, old_func, old_client_data); + * \endcode + * + * Or automatic printing can be disabled altogether and error messages can be explicitly printed. + * + * Example: Disable automatic printing and explicitly print error messages + * \code + * *** Turn off error handling permanently *** + * H5Eset_auto2(error_stack, NULL, NULL); + * *** If failure, print error message *** + * if (H5Fopen (....)<0) { + * H5Eprint2(H5E_DEFAULT, stderr); + * exit (1); + * } + * \endcode + * + * \subsubsection subsubsec_error_ops_custom_print Customized Printing of an Error Stack + * Applications are allowed to define an automatic error traversal function other than the default + * \ref H5Eprint(). For instance, one can define a function that prints a simple, one‐line error message to + * the standard error stream and then exits. The first example below defines a such a function. The second + * example below installs the function as the error handler. + * + * Example: Defining a function to print a simple error message + * \code + * herr_t + * my_hdf5_error_handler(void *unused) + * { + * fprintf (stderr, “An HDF5 error was detected. Bye.\\n”); + * exit (1); + * } + * \endcode + * + * Example: The user‐defined error handler + * \code + * H5Eset_auto2(H5E_DEFAULT, my_hdf5_error_handler, NULL); + * \endcode + * + * \subsubsection subsubsec_error_ops_walk Walk through the Error Stack + * The \ref H5Eprint2 function is actually just a wrapper around the more complex \ref H5Ewalk function + * which traverses an error stack and calls a user‐defined function for each member of the stack. The example + * below shows how \ref H5Ewalk is used. + * \code + * herr_t H5Ewalk(hid_t err_stack, H5E_direction_t direction, + * H5E_walk_t func, void *client_data) + * \endcode + * The error stack err_stack is traversed and func is called for each member of the stack. Its arguments + * are an integer sequence number beginning at zero (regardless of direction) and the client_data + * pointer. If direction is \ref H5E_WALK_UPWARD, then traversal begins at the inner‐most function that + * detected the error and concludes with the API function. Use \ref H5E_WALK_DOWNWARD for the opposite + * order. + * + * \subsubsection subsubsec_error_ops_travers Traverse an Error Stack with a Callback Function + * An error stack traversal callback function takes three arguments: n is a sequence number beginning at + * zero for each traversal, eptr is a pointer to an error stack member, and client_data is the same pointer + * used in the example above passed to \ref H5Ewalk. See the example below. + * \code + * typedef herr_t (*H5E_walk_t)(unsigned n, H5E_error2_t *eptr, void *client_data) + * \endcode + * The H5E_error2_t structure is shown below. + * \code + * typedef struct { + * hid_t cls_id; + * hid_t maj_num; + * hid_t min_num; + * unsigned line; + * const char *func_name; + * const char *file_name; + * const char *desc; + * } H5E_error2_t; + * \endcode + * The maj_num and min_num are major and minor error IDs, func_name is the name of the function where + * the error was detected, file_name and line locate the error within the HDF5 Library source code, and + * desc points to a description of the error. + * + * The following example shows a user‐defined callback function. + * + * Example: A user‐defined callback function + * \code + * \#define MSG_SIZE 64 + * herr_t + * custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) + * { + * FILE *stream = (FILE *)client_data; + * char maj[MSG_SIZE]; + * char min[MSG_SIZE]; + * char cls[MSG_SIZE]; + * const int indent = 4; + * + * *** Get descriptions for the major and minor error numbers *** + * if(H5Eget_class_name(err_desc->cls_id, cls, MSG_SIZE) < 0) + * TEST_ERROR; + * if(H5Eget_msg(err_desc->maj_num, NULL, maj, MSG_SIZE) < 0) + * TEST_ERROR; + * if(H5Eget_msg(err_desc->min_num, NULL, min, MSG_SIZE) < 0) + * TEST_ERROR; + * fprintf (stream, “%*serror #%03d: %s in %s(): + * line %u\\n”, + * indent, “”, n, err_desc->file_name, + * err_desc->func_name, err_desc->line); + * fprintf (stream, “%*sclass: %s\\n”, indent*2, “”, cls); + * fprintf (stream, “%*smajor: %s\\n”, indent*2, “”, maj); + * fprintf (stream, “%*sminor: %s\\n”, indent*2, “”, min); + * return 0; + * error: + * return -1; + * } + * \endcode + * + *

Programming Note for C++ Developers Using C Functions

+ * If a C routine that takes a function pointer as an argument is called from within C++ code, the C routine + * should be returned from normally. * - * Use the functions in this module to manage HDF5 error stacks and error - * messages. + * Examples of this kind of routine include callbacks such as \ref H5Pset_elink_cb and + * \ref H5Pset_type_conv_cb and + * functions such as \ref H5Tconvert and \ref H5Ewalk2. + * + * Exiting the routine in its normal fashion allows the HDF5 C Library to clean up its work properly. In other + * words, if the C++ application jumps out of the routine back to the C++ “catch” statement, the library is + * not given the opportunity to close any temporary data structures that were set up when the routine was + * called. The C++ application should save some state as the routine is started so that any problem that + * occurs might be diagnosed. + * + * \subsection subsec_error_adv Advanced Error Handling Operations + * The section above, see \ref subsec_error_ops, discusses the basic error + * handling operations of the library. In that section, all the error records on the error stack are from the + * library itself. In this section, we are going to introduce the operations that allow an application program + * to push its own error records onto the error stack once it declares an error class of its own through the + * HDF5 Error API. * * - * - * - * - * - * - * - * - * - * + * + * + * + * *
CreateRead
- * \snippet{lineno} H5E_examples.c create - * - * \snippet{lineno} H5E_examples.c read - *
UpdateDelete
- * \snippet{lineno} H5E_examples.c update - * - * \snippet{lineno} H5E_examples.c delete - *
Example: An Error Report
+ *

An error report shows both the library's error record and the application's error records. + * See the example below. + *

+ * Error Test-DIAG: Error detected in Error Program (1.0)
+ *         thread 8192:
+ *     #000: ../../hdf5/test/error_test.c line ### in main():
+ *         Error test failed
+ *       major: Error in test
+ *       minor: Error in subroutine
+ *     #001: ../../hdf5/test/error_test.c line ### in
+ *         test_error(): H5Dwrite failed as supposed to
+ *       major: Error in IO
+ *       minor: Error in H5Dwrite
+ *   HDF5-DIAG: Error detected in HDF5 (1.10.9) thread #####:
+ *     #002: ../../hdf5/src/H5Dio.c line ### in H5Dwrite():
+ *         not a dataset
+ *       major: Invalid arguments to routine
+ *       minor: Inappropriate type
+ *       
+ *
+ * In the line above error record #002 in the example above, the starting phrase is HDF5. This is the error + * class name of the HDF5 Library. All of the library's error messages (major and minor) are in this default + * error class. The Error Test in the beginning of the line above error record #000 is the name of the + * application's error class. The first two error records, #000 and #001, are from application's error class. + * By definition, an error class is a group of major and minor error messages for a library (the HDF5 Library + * or an application library built on top of the HDF5 Library) or an application program. The error class can + * be registered for a library or program through the HDF5 Error API. Major and minor messages can be defined + * in an error class. An application will have object handles for the error class and for major and minor + * messages for further operation. See the example below. + * + * Example: The user‐defined error handler + * \code + * \#define MSG_SIZE 64 + * herr_t + * custom_print_cb(unsigned n, const H5E_error2_t *err_desc, + * void* client_data) + * { + * FILE *stream = (FILE *)client_data; + * char maj[MSG_SIZE]; + * char min[MSG_SIZE]; + * char cls[MSG_SIZE]; + * const int indent = 4; + * + * *** Get descriptions for the major and minor error numbers *** + * if(H5Eget_class_name(err_desc->cls_id, cls, MSG_SIZE) < 0) + * TEST_ERROR; + * if(H5Eget_msg(err_desc->maj_num, NULL, maj, MSG_SIZE) < 0) + * TEST_ERROR; + * if(H5Eget_msg(err_desc->min_num, NULL, min, MSG_SIZE) < 0) + * TEST_ERROR; + * fprintf (stream, “%*serror #%03d: %s in %s(): + * line %u\\n”, + * indent, “”, n, err_desc->file_name, + * err_desc->func_name, err_desc->line); + * fprintf (stream, “%*sclass: %s\\n”, indent*2, “”, cls); + * fprintf (stream, “%*smajor: %s\\n”, indent*2, “”, maj); + * fprintf (stream, “%*sminor: %s\\n”, indent*2, “”, min); + * return 0; + * error: + * return -1; + * } + * \endcode + * + * \subsubsection subsubsec_error_adv_more More Error API Functions + * The Error API has functions that can be used to register or unregister an error class, to create or close + * error messages, and to query an error class or error message. These functions are illustrated below. + * + * To register an error class: + * \code + * hid_t H5Eregister_class(const char* cls_name, const char* lib_name, const char* version) + * \endcode + * This function registers an error class with the HDF5 Library so that the application library or program + * can report errors together with the HDF5 Library. + * + * To add an error message to an error class: + * \code + * hid_t H5Ecreate_msg(hid_t class, H5E_type_t msg_type, const char* mesg) + * \endcode + * This function adds an error message to an error class defined by an application library or program. The + * error message can be either major or minor which is indicated by parameter msg_type. + * + * To get the name of an error class: + * \code + * ssize_t H5Eget_class_name(hid_t class_id, char* name, size_t size) + * \endcode + * This function retrieves the name of the error class specified by the class ID. + * + * To retrieve an error message: + * \code + * ssize_t H5Eget_msg(hid_t mesg_id, H5E_type_t* mesg_type, char* mesg, size_t size) + * \endcode + * This function retrieves the error message including its length and type. + * + * To close an error message: + * \code + * herr_t H5Eclose_msg(hid_t mesg_id) + * \endcode + * This function closes an error message. + * + * To remove an error class: + * \code + * herr_t H5Eunregister_class(hid_t class_id) + * \endcode + * This function removes an error class from the Error API. + * + * The example below shows how an application creates an error class and error messages. + * + * Example: Create an error class and error messages + * \code + * *** Create an error class *** + * class_id = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS); + * *** Retrieve class name *** + * H5Eget_class_name(class_id, cls_name, cls_size); + * *** Create a major error message in the class *** + * maj_id = H5Ecreate_msg(class_id, H5E_MAJOR, “... ...”); + * *** Create a minor error message in the class *** + * min_id = H5Ecreate_msg(class_id, H5E_MINOR, “... ...”); + * \endcode + * + * The example below shows how an application closes error messages and unregisters the error class. + * + * Example: Closing error messages and unregistering the error class + * \code + * H5Eclose_msg(maj_id); + * H5Eclose_msg(min_id); + * H5Eunregister_class(class_id); + * \endcode + * + * \subsubsection subsubsec_error_adv_app Pushing an Application Error Message onto Error Stack + * An application can push error records onto or pop error records off of the error stack just as the library + * does internally. An error stack can be registered, and an object handle can be returned to the application + * so that the application can manipulate a registered error stack. + * + * To register the current stack: + * \code + * hid_t H5Eget_current_stack(void) + * \endcode + * This function registers the current error stack, returns an object handle, and clears the current error + * stack. + * An empty error stack will also be assigned an ID. + * + * To replace the current error stack with another: + * \code + * herr_t H5Eset_current_stack(hid_t error_stack) + * \endcode + * This function replaces the current error stack with another error stack specified by error_stack and + * clears the current error stack. The object handle error_stack is closed after this function call. + * + * To push a new error record to the error stack: + * \code + * herr_t H5Epush(hid_t error_stack, const char* file, const char* func, + * unsigned line, hid_t cls_id, hid_t major_id, hid_t minor_id, + * const char* desc, ... ) + * \endcode + * This function pushes a new error record onto the error stack for the current thread. + * + * To delete some error messages: + * \code + * herr_t H5Epop(hid_t error_stack, size_t count) + * \endcode + * This function deletes some error messages from the error stack. + * + * To retrieve the number of error records: + * \code + * int H5Eget_num(hid_t error_stack) + * \endcode + * This function retrieves the number of error records from an error stack. + * + * To clear the error stack: + * \code + * herr_t H5Eclear_stack(hid_t error_stack) + * \endcode + * This function clears the error stack. + * + * To close the object handle for an error stack: + * \code + * herr_t H5Eclose_stack(hid_t error_stack) + * \endcode + * This function closes the object handle for an error stack and releases its resources. + * + * The example below shows how an application pushes an error record onto the default error stack. + * + * Example: Pushing an error message to an error stack + * \code + * *** Make call to HDF5 I/O routine *** + * if((dset_id=H5Dopen(file_id, dset_name, access_plist)) < 0) + * { + * *** Push client error onto error stack *** + * H5Epush(H5E_DEFAULT,__FILE__,FUNC,__LINE__,cls_id, + * CLIENT_ERR_MAJ_IO,CLIENT_ERR_MINOR_OPEN, “H5Dopen failed”); + * } + * *** Indicate error occurred in function *** + * return 0; + * \endcode + * + * The example below shows how an application registers the current error stack and + * creates an object handle to avoid another HDF5 function from clearing the error stack. + * + * Example: Registering the error stack + * \code + * if (H5Dwrite(dset_id, mem_type_id, mem_space_id, file_space_id, dset_xfer_plist_id, buf) < 0) + * { + * *** Push client error onto error stack *** + * H5Epush2(H5E_DEFAULT,__FILE__,FUNC,__LINE__,cls_id, + * CLIENT_ERR_MAJ_IO,CLIENT_ERR_MINOR_HDF5, + * “H5Dwrite failed”); + * *** Preserve the error stack by assigning an object handle to it *** + * error_stack = H5Eget_current_stack(); + * *** Close dataset *** + * H5Dclose(dset_id); + * *** Replace the current error stack with the preserved one *** + * H5Eset_current_stack(error_stack); + * } + * return 0; + * \endcode + * + * Previous Chapter \ref sec_attribute - Next Chapter \ref sec_plist + * + * \defgroup H5E Error Handling (H5E) * * \internal The \c FUNC_ENTER macro clears the error stack whenever an * interface function is entered. When an error is detected, an entry @@ -76,6 +545,8 @@ * error stack. The error stack is statically allocated to reduce the * complexity of handling errors within the \ref H5E package. * + * @see sec_error + * */ #endif /* H5Emodule_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5EnumType.h b/externals/coda-oss/modules/drivers/hdf5/include/H5EnumType.h index f9091caa7c..a98688ea0b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5EnumType.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5EnumType.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Epkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Epkg.h index 11481ee5d3..c761179def 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Epkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Epkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Wednesday, April 11, 2007 - * - * Purpose: This file contains declarations which are visible only within - * the H5E package. Source files outside the H5E package should - * include H5Eprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5E package. Source files outside the H5E package should + * include H5Eprivate.h instead. */ #if !(defined H5E_FRIEND || defined H5E_MODULE) #error "Do not include this file outside the H5E package!" diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Eprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Eprivate.h index a30cb6ae71..995800256b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Eprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Eprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -31,16 +30,20 @@ typedef struct H5E_t H5E_t; * error number, the minor error number, and a description of the error. */ #define HERROR(maj_id, min_id, ...) \ - H5E_printf_stack(NULL, __FILE__, __func__, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__) + do { \ + H5E_printf_stack(NULL, __FILE__, __func__, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__); \ + } while (0) /* * HCOMMON_ERROR macro, used by HDONE_ERROR and HGOTO_ERROR * (Shouldn't need to be used outside this header file) */ #define HCOMMON_ERROR(maj, min, ...) \ - HERROR(maj, min, __VA_ARGS__); \ - err_occurred = TRUE; \ - err_occurred = err_occurred; /* Shut GCC warnings up! */ + do { \ + HERROR(maj, min, __VA_ARGS__); \ + err_occurred = TRUE; \ + err_occurred = err_occurred; /* Shut GCC warnings up! */ \ + } while (0) /* * HDONE_ERROR macro, used to facilitate error reporting between a @@ -52,10 +55,10 @@ typedef struct H5E_t H5E_t; * without jumping to any labels) */ #define HDONE_ERROR(maj, min, ret_val, ...) \ - { \ + do { \ HCOMMON_ERROR(maj, min, __VA_ARGS__); \ ret_value = ret_val; \ - } + } while (0) /* * HGOTO_ERROR macro, used to facilitate error reporting between a @@ -65,21 +68,21 @@ typedef struct H5E_t H5E_t; * control branches to the `done' label. */ #define HGOTO_ERROR(maj, min, ret_val, ...) \ - { \ + do { \ HCOMMON_ERROR(maj, min, __VA_ARGS__); \ - HGOTO_DONE(ret_val) \ - } + HGOTO_DONE(ret_val); \ + } while (0) /* * HGOTO_ERROR_TAG macro, used like HGOTO_ERROR between H5_BEGIN_TAG and * H5_END_TAG statements. Resets the metadata tag before leaving the function. */ #define HGOTO_ERROR_TAG(maj, min, ret_val, ...) \ - { \ + do { \ H5AC_tag(prv_tag, NULL); \ HCOMMON_ERROR(maj, min, __VA_ARGS__); \ - HGOTO_DONE(ret_val) \ - } + HGOTO_DONE(ret_val); \ + } while (0) /* * HGOTO_DONE macro, used to facilitate normal return between a FUNC_ENTER() @@ -88,20 +91,20 @@ typedef struct H5E_t H5E_t; * the `done' label. */ #define HGOTO_DONE(ret_val) \ - { \ + do { \ ret_value = ret_val; \ goto done; \ - } + } while (0) /* * HGOTO_DONE_TAG macro, used like HGOTO_DONE between H5_BEGIN_TAG and * H5_END_TAG statements. Resets the metadata tag before leaving the function. */ #define HGOTO_DONE_TAG(ret_val) \ - { \ + do { \ H5AC_tag(prv_tag, NULL); \ - HGOTO_DONE(ret_val) \ - } + HGOTO_DONE(ret_val); \ + } while (0) /* * Macros handling system error messages as described in C standard. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Epubgen.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Epubgen.h index d361925a8b..5c19d432de 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Epubgen.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Epubgen.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Epublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Epublic.h index 0254c37350..8db118b001 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Epublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Epublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -17,11 +16,10 @@ #ifndef H5Epublic_H #define H5Epublic_H -#include /*FILE arg of H5Eprint() */ +#include /* FILE arg of H5Eprint() */ -/* Public headers needed by this file */ -#include "H5public.h" -#include "H5Ipublic.h" +#include "H5public.h" /* Generic Functions */ +#include "H5Ipublic.h" /* Identifiers */ /* Value for the default error stack */ #define H5E_DEFAULT 0 /* (hid_t) */ @@ -60,8 +58,15 @@ typedef struct H5E_error2_t { #endif /* H5private_H */ /* HDF5 error class */ +/* Extern "C" block needed to compile C++ filter plugins with some compilers */ +#ifdef __cplusplus +extern "C" { +#endif #define H5E_ERR_CLS (H5OPEN H5E_ERR_CLS_g) H5_DLLVAR hid_t H5E_ERR_CLS_g; +#ifdef __cplusplus +} +#endif /* Include the automatically generated public header information */ /* (This includes the list of major and minor error codes for the library) */ @@ -74,7 +79,7 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; * easier just to use this macro like: * H5E_BEGIN_TRY { * ...stuff here that's likely to fail... - * } H5E_END_TRY; + * } H5E_END_TRY * * Warning: don't break, return, or longjmp() from the body of the loop or * the error reporting won't be properly restored! @@ -144,10 +149,10 @@ H5_DLLVAR hid_t H5E_ERR_CLS_g; * And goto a label after pushing error onto stack. */ #define H5Epush_goto(func, cls, maj, min, str, label) \ - { \ + do { \ H5Epush2(H5E_DEFAULT, __FILE__, func, __LINE__, cls, maj, min, str); \ goto label; \ - } + } while (0) /** * Error stack traversal direction @@ -197,7 +202,7 @@ typedef herr_t (*H5E_auto2_t)(hid_t estack, void *client_data); * \param[in] cls_name Name of the error class * \param[in] lib_name Name of the client library or application to which the error class belongs * \param[in] version Version of the client library or application to which the - error class belongs. Can be \c NULL. + error class belongs. It can be \c NULL. * \return Returns a class identifier on success; otherwise returns H5I_INVALID_ID. * * \details H5Eregister_class() registers a client library or application @@ -271,7 +276,7 @@ H5_DLL hid_t H5Ecreate_msg(hid_t cls, H5E_type_t msg_type, const char *msg); * \return \hid_ti{error stack} * * \details H5Ecreate_stack() creates a new empty error stack and returns the - * new stack’s identifier. Use H5Eclose_stack() to close the error stack + * new stack's identifier. Use H5Eclose_stack() to close the error stack * identifier returned by this function. * * \since 1.8.0 @@ -308,7 +313,7 @@ H5_DLL hid_t H5Eget_current_stack(void); * If \p close_source_stack is \c TRUE, the source error stack * will be closed. * - * \since 1.13.0 + * \since 1.14.0 */ H5_DLL herr_t H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_stack); /** @@ -335,12 +340,12 @@ H5_DLL herr_t H5Eclose_stack(hid_t stack_id); * * \param[in] class_id Error class identifier * \param[out] name Buffer for the error class name - * \param[in] size The maximum number of characters the class name to be returned - * by this function in\p name. + * \param[in] size The maximum number of characters of the class name to be returned + * by this function in \p name. * \return Returns non-negative value as on success; otherwise returns negative value. * * \details H5Eget_class_name() retrieves the name of the error class specified - * by the class identifier. If non-NULL pointer is passed in for \p + * by the class identifier. If a non-NULL pointer is passed in for \p * name and \p size is greater than zero, the class name of \p size * long is returned. The length of the error class name is also * returned. If NULL is passed in as \p name, only the length of class @@ -525,7 +530,7 @@ H5_DLL herr_t H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t f * H5Eget_auto2() will fail and will indicate that the application has * mixed H5Eset_auto1() and H5Eget_auto2(). On the other hand, mixing * H5Eset_auto2() and H5Eget_auto1() will also cause a failure. But if - * the traversal functions are the library’s default H5Eprint1() or + * the traversal functions are the library's default H5Eprint1() or * H5Eprint2(), mixing H5Eset_auto1() and H5Eget_auto2() or mixing * H5Eset_auto2() and H5Eget_auto1() does not fail. * @@ -763,7 +768,7 @@ H5_DLL herr_t H5Eclear1(void); * H5Eget_auto2() will fail and will indicate that the application has * mixed H5Eset_auto1() and H5Eget_auto2(). On the other hand, mixing * H5Eset_auto2() and H5Eget_auto1() will also cause a failure. But if - * the traversal functions are the library’s default H5Eprint1() or + * the traversal functions are the library's default H5Eprint1() or * H5Eprint2(), mixing H5Eset_auto1() and H5Eget_auto2() or mixing * H5Eset_auto2() and H5Eget_auto1() does not fail. * @@ -811,7 +816,7 @@ H5_DLL herr_t H5Epush1(const char *file, const char *func, unsigned line, H5E_ma * \deprecated 1.8.0 Function H5Eprint() renamed to H5Eprint1() and * deprecated in this release. * - * \details H5Eprint1() prints prints the error stack for the current thread + * \details H5Eprint1() prints the error stack for the current thread * on the specified stream, \p stream. Even if the error stack is empty, a * one-line message of the following form will be printed: * \code{.unparsed} @@ -899,8 +904,8 @@ H5_DLL herr_t H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client * * \deprecated 1.8.0 Function deprecated in this release. * - * \details Given a major error number, H5Eget_major() returns a constant - * character string that describes the error. + * \details H5Eget_major() returns a constant + * character string that describes the error, given a major error number. * * \attention This function returns a dynamically allocated string (\c char * array). An application calling this function must free the memory @@ -920,8 +925,8 @@ H5_DLL char *H5Eget_major(H5E_major_t maj); * * \deprecated 1.8.0 Function deprecated and return type changed in this release. * - * \details Given a minor error number, H5Eget_minor() returns a constant - * character string that describes the error. + * \details H5Eget_minor() returns a constant + * character string that describes the error, given a minor error number. * * \attention In the Release 1.8.x series, H5Eget_minor() returns a string of * dynamic allocated \c char array. An application calling this diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Eterm.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Eterm.h index cb0c5747d4..c4a760cc8d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Eterm.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Eterm.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Exception.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Exception.h index 89419669d1..d4533e59d3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Exception.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Exception.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -75,7 +74,7 @@ class H5_DLLCPP Exception { Exception(const Exception &orig); // virtual Destructor - virtual ~Exception() noexcept; + virtual ~Exception() throw(); protected: // Default value for detail_message @@ -90,84 +89,84 @@ class H5_DLLCPP FileIException : public Exception { public: FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); FileIException(); - virtual ~FileIException() noexcept override; + virtual ~FileIException() throw() override; }; class H5_DLLCPP GroupIException : public Exception { public: GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); GroupIException(); - virtual ~GroupIException() noexcept override; + virtual ~GroupIException() throw() override; }; class H5_DLLCPP DataSpaceIException : public Exception { public: DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSpaceIException(); - virtual ~DataSpaceIException() noexcept override; + virtual ~DataSpaceIException() throw() override; }; class H5_DLLCPP DataTypeIException : public Exception { public: DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataTypeIException(); - virtual ~DataTypeIException() noexcept override; + virtual ~DataTypeIException() throw() override; }; class H5_DLLCPP ObjHeaderIException : public Exception { public: ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ObjHeaderIException(); - virtual ~ObjHeaderIException() noexcept override; + virtual ~ObjHeaderIException() throw() override; }; class H5_DLLCPP PropListIException : public Exception { public: PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); PropListIException(); - virtual ~PropListIException() noexcept override; + virtual ~PropListIException() throw() override; }; class H5_DLLCPP DataSetIException : public Exception { public: DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); DataSetIException(); - virtual ~DataSetIException() noexcept override; + virtual ~DataSetIException() throw() override; }; class H5_DLLCPP AttributeIException : public Exception { public: AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); AttributeIException(); - virtual ~AttributeIException() noexcept override; + virtual ~AttributeIException() throw() override; }; class H5_DLLCPP ReferenceException : public Exception { public: ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); ReferenceException(); - virtual ~ReferenceException() noexcept override; + virtual ~ReferenceException() throw() override; }; class H5_DLLCPP LibraryIException : public Exception { public: LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LibraryIException(); - virtual ~LibraryIException() noexcept override; + virtual ~LibraryIException() throw() override; }; class H5_DLLCPP LocationException : public Exception { public: LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); LocationException(); - virtual ~LocationException() noexcept override; + virtual ~LocationException() throw() override; }; class H5_DLLCPP IdComponentException : public Exception { public: IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); IdComponentException(); - virtual ~IdComponentException() noexcept override; + virtual ~IdComponentException() throw() override; }; // end of IdComponentException } // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FAmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FAmodule.h index 3fbdb901d8..8ef75820d5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FAmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FAmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5FA package. Including this header means that the source file - * is part of the H5FA package. + * Purpose: This file contains declarations which define macros for the + * H5FA package. Including this header means that the source file + * is part of the H5FA package. */ #ifndef H5FAmodule_H #define H5FAmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FApkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FApkg.h index e66af8fd29..c08e575370 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FApkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FApkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,11 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: - * - * Purpose: This file contains declarations which are visible only within - * the H5FA package. Source files outside the H5FA package should - * include H5FAprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5FA package. Source files outside the H5FA package should + * include H5FAprivate.h instead. */ #if !(defined(H5FA_FRIEND) | defined(H5FA_MODULE)) #error "Do not include this file outside the H5FA package!" diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FAprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FAprivate.h index 835b06fcfb..9bdc0742c7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FAprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FAprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDcore.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDcore.h index 4067980114..e4d792b5f9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDcore.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDcore.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Monday, August 2, 1999 - * * Purpose: The public header file for the core driver. */ #ifndef H5FDcore_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDdevelop.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDdevelop.h index db29c87ed5..75e63b14c0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDdevelop.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDdevelop.h @@ -2,10 +2,10 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -163,7 +163,7 @@ typedef struct H5FD_t H5FD_t; /* Class information for each file driver */ typedef struct H5FD_class_t { - unsigned version; /**< File driver class struct version # */ + unsigned version; /**< File driver class struct version number */ H5FD_class_value_t value; const char *name; haddr_t maxaddr; @@ -281,6 +281,18 @@ H5_DLL herr_t H5FDread_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, H5_DLL herr_t H5FDwrite_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, hid_t mem_spaces[], hid_t file_spaces[], haddr_t offsets[], size_t element_sizes[], const void *bufs[]); +H5_DLL herr_t H5FDread_vector_from_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, + hid_t mem_spaces[], hid_t file_spaces[], haddr_t offsets[], + size_t element_sizes[], void *bufs[] /* out */); +H5_DLL herr_t H5FDwrite_vector_from_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, + hid_t mem_spaces[], hid_t file_spaces[], haddr_t offsets[], + size_t element_sizes[], const void *bufs[] /* in */); +H5_DLL herr_t H5FDread_from_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], + size_t element_sizes[], void *bufs[] /* out */); +H5_DLL herr_t H5FDwrite_from_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], + size_t element_sizes[], const void *bufs[] /* in */); H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing); H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDdirect.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDdirect.h index bfad16ab7e..e47ac37cde 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDdirect.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDdirect.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 - * * Purpose: The public header file for the direct driver. */ #ifndef H5FDdirect_H @@ -58,7 +54,7 @@ H5_DLL hid_t H5FD_direct_init(void); * cached by the system. * * File systems usually require the data address in memory, the file - * address, and the size of the data to be aligned. The HDF5 library’s + * address, and the size of the data to be aligned. The HDF5 library's * direct I/O driver is able to handle unaligned data, though that will * consume some additional memory resources and may slow * performance. To get better performance, use the system function \p @@ -71,7 +67,7 @@ H5_DLL hid_t H5FD_direct_init(void); * \p alignment specifies the required alignment boundary in memory. * * \p block_size specifies the file system block size. A value of 0 - * (zero) means to use HDF5 library’s default value of 4KB. + * (zero) means to use HDF5 library's default value of 4KB. * * \p cbuf_size specifies the copy buffer size. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDdrvr_module.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDdrvr_module.h index 4a7a4d10f1..c984cf5100 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDdrvr_module.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDdrvr_module.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5FD driver package. Including this header means that the source file - * is part of the H5FD driver package. + * Purpose: This file contains declarations which define macros for the + * H5FD driver package. Including this header means that the source file + * is part of the H5FD driver package. */ #ifndef H5FDdrvr_module_H #define H5FDdrvr_module_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDfamily.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDfamily.h index bd51f36bc3..76020f0a26 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDfamily.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDfamily.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Monday, August 4, 1999 - * * Purpose: The public header file for the family driver. */ #ifndef H5FDfamily_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDhdfs.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDhdfs.h index e401e81bee..c8c2c37f1b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDhdfs.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDhdfs.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Jacob Smith - * 2018-04-23 - * * Purpose: The public header file for the hdfs driver. */ @@ -91,11 +87,6 @@ extern "C" { * * TBD: If -1, relies on a default value. * - * - * - * Programmer: Jacob Smith - * 2018-04-23 - * ****************************************************************************/ #define H5FD__CURR_HDFS_FAPL_T_VERSION 1 diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDioc.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDioc.h new file mode 100644 index 0000000000..bcacd52252 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDioc.h @@ -0,0 +1,196 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Purpose: The public header file for the "I/O concentrator" driver. + * This provides a similar functionality to that of the subfiling driver + * but introduces the necessary file access functionality via a multi- + * threading MPI service + */ + +#ifndef H5FDioc_H +#define H5FDioc_H + +#include "H5FDsubfiling.h" + +#ifdef H5_HAVE_IOC_VFD +/** + * \def H5FD_IOC + * Macro that returns the identifier for the #H5FD_IOC driver. \hid_t{file driver} + */ +#define H5FD_IOC (H5FDperform_init(H5FD_ioc_init)) +#else +#define H5FD_IOC (H5I_INVALID_HID) +#endif + +/** + * \def H5FD_IOC_NAME + * The canonical name for the #H5FD_IOC driver + */ +#define H5FD_IOC_NAME "ioc" + +#ifdef H5_HAVE_IOC_VFD + +#ifndef H5FD_IOC_FAPL_MAGIC +/** + * \def H5FD_IOC_CURR_FAPL_VERSION + * The version number of the H5FD_ioc_config_t configuration + * structure for the #H5FD_IOC driver + */ +#define H5FD_IOC_CURR_FAPL_VERSION 1 +/** + * \def H5FD_IOC_FAPL_MAGIC + * Unique number used to distinguish the #H5FD_IOC driver from other HDF5 file drivers + */ +#define H5FD_IOC_FAPL_MAGIC 0xFED21331 +#endif + +/** + * \def H5FD_IOC_DEFAULT_THREAD_POOL_SIZE + * The default number of I/O concentrator worker threads + */ +#define H5FD_IOC_DEFAULT_THREAD_POOL_SIZE 4 + +/* + * Environment variables interpreted by the IOC VFD + */ + +/** + * \def H5FD_IOC_THREAD_POOL_SIZE + * Macro for name of the environment variable that controls/overrides + * the number of I/O concentrator worker threads + * + * The value set for this environment variable is interpreted as an + * int value and must be > 0. + */ +#define H5FD_IOC_THREAD_POOL_SIZE "H5FD_IOC_THREAD_POOL_SIZE" + +//! +/** + * \struct H5FD_ioc_config_t + * \brief Configuration structure for H5Pset_fapl_ioc() / H5Pget_fapl_ioc() + * + * \details H5FD_ioc_config_t is a public structure that is used to pass + * configuration data to the #H5FD_IOC driver via a File Access + * Property List. A pointer to an instance of this structure is + * a parameter to H5Pset_fapl_ioc() and H5Pget_fapl_ioc(). + * + * \var uint32_t H5FD_ioc_config_t::magic + * A somewhat unique number which distinguishes the #H5FD_IOC driver + * from other drivers. Used in combination with a version number, it + * can help to validate a user-generated File Access Property List. + * This field should be set to #H5FD_IOC_FAPL_MAGIC. + * + * \var uint32_t H5FD_ioc_config_t::version + * Version number of the H5FD_ioc_config_t structure. Any instance passed + * to H5Pset_fapl_ioc() / H5Pget_fapl_ioc() must have a recognized version + * number or an error will be raised. Currently, this field should be set + * to #H5FD_IOC_CURR_FAPL_VERSION. + * + * \var int32_t H5FD_ioc_config_t::thread_pool_size + * The number of I/O concentrator worker threads to use. + * + * This value can also be set or adjusted with the #H5FD_IOC_THREAD_POOL_SIZE + * environment variable. + * + */ +typedef struct H5FD_ioc_config_t { + uint32_t magic; /* Must be set to H5FD_IOC_FAPL_MAGIC */ + uint32_t version; /* Must be set to H5FD_IOC_CURR_FAPL_VERSION */ + int32_t thread_pool_size; /* Number of I/O concentrator worker threads to use */ +} H5FD_ioc_config_t; +//! + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Internal routine to initialize #H5FD_IOC driver. Not meant to be + * called directly by an HDF5 application + */ +H5_DLL hid_t H5FD_ioc_init(void); +/** + * \ingroup FAPL + * + * \brief Modifies the specified File Access Property List to use the #H5FD_IOC driver + * + * \fapl_id + * \param[in] vfd_config Pointer to #H5FD_IOC driver configuration structure. May be NULL. + * \returns \herr_t + * + * \details H5Pset_fapl_ioc() modifies the File Access Property List to use the + * #H5FD_IOC driver. + * + * The #H5FD_IOC driver is a reference implementation of an "I/O concentrator" + * file driver that works in conjunction with the #H5FD_SUBFILING driver and + * provides the I/O backend for servicing I/O requests to subfiles. + * + * Typically, an HDF5 application won't need to call this routine directly. + * The #H5FD_IOC driver is usually set up as a side effect of an HDF5 application + * using the #H5FD_SUBFILING driver, but this routine is provided in case the + * application wishes to manually configure the #H5FD_IOC driver. + * + * \note The \p vfd_config parameter may be NULL. In this case, the driver will + * be setup with default settings. Note that in this case, it is assumed + * the parent #H5FD_SUBFILING driver was also setup with default settings. + * If the two drivers differ in configuration settings, application behavior + * may not be as expected. + * + * \since 1.14.0 + * + */ +H5_DLL herr_t H5Pset_fapl_ioc(hid_t fapl_id, H5FD_ioc_config_t *vfd_config); +/** + * \ingroup FAPL + * + * \brief Queries a File Access Property List for #H5FD_IOC file driver properties + * + * \fapl_id + * \param[out] config_out Pointer to H5FD_ioc_config_t structure through which the + * #H5FD_IOC file driver properties will be returned. + * + * \returns \herr_t + * + * \details H5Pget_fapl_ioc() queries the specified File Access Property List for + * #H5FD_IOC driver properties as set by H5Pset_fapl_ioc(). If the #H5FD_IOC + * driver has not been set on the File Access Property List, a default + * configuration is returned. An HDF5 application may use this functionality + * to manually configure the #H5FD_IOC driver by calling H5Pget_fapl_ioc() + * on a newly-created File Access Property List, adjusting the default + * values and then calling H5Pset_fapl_ioc() with the configured + * H5FD_ioc_config_t structure. + * + * \since 1.14.0 + * + */ +H5_DLL herr_t H5Pget_fapl_ioc(hid_t fapl_id, H5FD_ioc_config_t *config_out); +/** + * \brief Internal routine for managing exclusive access to critical sections + * by the #H5FD_IOC driver's worker threads. Not meant to be called + * directly by an HDF5 application + */ +H5_DLL void H5FD_ioc_begin_thread_exclusive(void); +/** + * \brief Internal routine for managing exclusive access to critical sections + * by the #H5FD_IOC driver's worker threads. Not meant to be called + * directly by an HDF5 application + */ +H5_DLL void H5FD_ioc_end_thread_exclusive(void); + +#ifdef __cplusplus +} +#endif + +#endif /* H5_HAVE_IOC_VFD */ + +#endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDlog.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDlog.h index a916fec5e9..ae4e2d05e7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDlog.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDlog.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Monday, April 17, 2000 - * * Purpose: The public header file for the log driver. */ #ifndef H5FDlog_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDmodule.h index 728b4b8304..1e29ca912a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5FD package. Including this header means that the source file - * is part of the H5FD package. + * Purpose: This file contains declarations which define macros for the + * H5FD package. Including this header means that the source file + * is part of the H5FD package. */ #ifndef H5FDmodule_H #define H5FDmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDmpi.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDmpi.h index cf493015a0..9cee0e69b7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDmpi.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDmpi.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Friday, January 30, 2004 - * * Purpose: The public header file for common items for all MPI VFL drivers */ #ifndef H5FDmpi_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDmpio.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDmpio.h index 5ce98cabb6..36786016df 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDmpio.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDmpio.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Monday, August 2, 1999 - * * Purpose: The public header file for the mpio driver. */ #ifndef H5FDmpio_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDmulti.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDmulti.h index 7a01f4c992..23c37039c3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDmulti.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDmulti.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Monday, August 2, 1999 - * * Purpose: The public header file for the "multi" driver. */ #ifndef H5FDmulti_H @@ -227,17 +223,17 @@ H5_DLL herr_t H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid * * \par Example: * \code - * // Example 1: Both metadata and rawdata files are in the same + * // Example 1: Both metadata and raw data files are in the same * // directory. Use Station1-m.h5 and Station1-r.h5 as - * // the metadata and rawdata files. + * // the metadata and raw data files. * hid_t fapl, fid; * fapl = H5Pcreate(H5P_FILE_ACCESS); * H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT); * fid=H5Fcreate("Station1",H5F_ACC_TRUNC,H5P_DEFAULT,fapl); * - * // Example 2: metadata and rawdata files are in different + * // Example 2: metadata and raw data files are in different * // directories. Use PointA-m.h5 and /pfs/PointA-r.h5 as - * // the metadata and rawdata files. + * // the metadata and raw data files. * hid_t fapl, fid; * fapl = H5Pcreate(H5P_FILE_ACCESS); * H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "/pfs/%s-r.h5", H5P_DEFAULT); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion.h index cc767c6d56..09b290e2a9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion.h @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -21,117 +21,93 @@ #define H5FD_ONION (H5FDperform_init(H5FD_onion_init)) #define H5FD_ONION_VALUE H5_VFD_ONION -/* Current version of the fapl info struct */ +/** + * Current version of the onion VFD fapl info struct. + */ #define H5FD_ONION_FAPL_INFO_VERSION_CURR 1 -/* Flag to open a file that has a locked header (after crashes, for example) */ -#define H5FD_ONION_FAPL_INFO_FLAG_FORCE_OPEN 1 - -/* Flag to enable opening older revisions in write mode, creating a tree */ -#define H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_DIVERGENT_HISTORY 0x1 - -/* Flag to require page alignment of onion revision data */ -#define H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT 0x2 +#define H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT \ + (0x0001u) /**< \ + * Onion history metadata will align to page_size. \ + * Partial pages of unused space will occur in the file, \ + * but may improve read performance from the backing store \ + * on some systems. \ + * If disabled (0), padding will not be inserted to align \ + * to page boundaries. \ + */ -/* Max length of a comment - * The buffer is defined to be this size + 1 to handle the NUL +/** + * Max length of a comment. + * The buffer is defined to be this size + 1 to handle the NUL. */ #define H5FD_ONION_FAPL_INFO_COMMENT_MAX_LEN 255 -/* Indicates that you want the latest revision */ +/** + * Indicates that you want the latest revision. + */ #define H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST UINT64_MAX +/** + * Indicates how the new onion data will be stored. + */ typedef enum H5FD_onion_target_file_constant_t { - H5FD_ONION_STORE_TARGET_H5, /* Onion history as part of HDF5 file */ - H5FD_ONION_STORE_TARGET_ONION, /* Separate, single "onion" file */ + H5FD_ONION_STORE_TARGET_ONION, /**< + * Onion history is stored in a single, separate "onion + * file". Shares filename and path as hdf5 file (if any), + * with only a different filename extension. + */ } H5FD_onion_target_file_constant_t; -/*----------------------------------------------------------------------------- - * Structure H5FD_onion_fapl_info_t - * - * Purpose: Encapsulate info for the Onion driver FAPL entry. - * - * version: Future-proofing identifier. Informs struct membership. - * Must equal H5FD_ONION_FAPL_VERSION_CURR to be considered valid. - * - * backing_fapl_id: - * Backing or 'child' FAPL ID to handle I/O with the - * underlying backing store. If the onion data is stored as a - * separate file, it must use the same backing driver as the - * original file. - * - * page_size: Size of the amended data pages. If opening an existing file, - * must equal the existing page size or zero. If creating a new - * file or an initial revision of an existing file, must be a - * power of 2. - * - * store_target: - * Enumerated/defined value identifying where the history data is - * stored, either in the same file (appended to HDF5 data) or a - * separate file. Other options may be added in later versions. - * - * + H5FD_ONION_FAPL_STORE_MODE_SEPARATE_SINGLE (1) - * Onion history is stored in a single, separate "onion - * file". Shares filename and path as hdf5 file (if any), - * with only a different filename extension. - * - * revision_num: Which revision to open. Must be 0 (the original file) or the - * revision number of an existing revision. - * Revision ID -1 is reserved to open the most recently-created - * revision in history. - * - * force_write_open: - * Flag to ignore the write-lock flag in the onion data - * and attempt to open the file write-only anyway. - * This may be relevant if, for example, the library crashed - * while the file was open in write mode and the write-lock - * flag was not cleared. - * Must equal H5FD_ONION_FAPL_FLAG_FORCE_OPEN to enable. - * - * creation_flags: - * Flag used only when instantiating an Onion file. - * If the relevant bit is set to a nonzero value, its feature - * will be enabled. - * - * + H5FD_ONION_FAPL_CREATE_FLAG_ENABLE_DIVERGENT_HISTORY - * (1, bit 1) - * User will be allowed to open arbitrary revisions - * in write mode. - * If disabled (0), only the most recent revision may be - * opened for amendment. - * - * + H5FD_ONION_FAPL_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT (2, bit 2) - * Onion history metadata will align to page_size. - * Partial pages of unused space will occur in the file, - * but may improve read performance from the backing store - * on some systems. - * If disabled (0), padding will not be inserted to align - * to page boundaries. - * - * + - * - * comment: User-supplied NULL-terminated comment for a revision to be - * written. - * Cannot be longer than H5FD_ONION_FAPL_COMMENT_MAX_LEN. - * Ignored if part of a FAPL used to open in read mode. - * - * The comment for a revision may be modified prior to committing - * to the revision (closing the file and writing the record) - * with a call to H5FDfctl(). - * This H5FDfctl overwrite may be used to exceed constraints of - * maximum string length and the NULL-terminator requirement. - * - *----------------------------------------------------------------------------- +/** + * Stores fapl information for creating onion VFD files. */ typedef struct H5FD_onion_fapl_info_t { - uint8_t version; - hid_t backing_fapl_id; - uint32_t page_size; - H5FD_onion_target_file_constant_t store_target; - uint64_t revision_num; - uint8_t force_write_open; - uint8_t creation_flags; - char comment[H5FD_ONION_FAPL_INFO_COMMENT_MAX_LEN + 1]; + uint8_t version; /**< + * Future-proofing identifier. Informs struct membership. + * Must equal H5FD_ONION_FAPL_VERSION_CURR to be considered valid. + */ + hid_t backing_fapl_id; /**< + * Backing or 'child' FAPL ID to handle I/O with the + * underlying backing store. It must use the same backing driver as the + * original file. + */ + uint32_t page_size; /**< + * page_size: Size of the amended data pages. If opening an existing file, + * must equal the existing page size or zero. If creating a new + * file or an initial revision of an existing file, must be a + * power of 2. + * + */ + H5FD_onion_target_file_constant_t store_target; /**< + * Identifies where the history data is stored. + */ + uint64_t revision_num; /**< + * Which revision to open. Valid values are 0 (the original file) or the + * revision number of an existing revision. + * H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST refers to the most + * recently-created revision in the history. + */ + uint8_t force_write_open; /**< + * Flag to ignore the write-lock flag in the onion data + * and attempt to open the file write-only anyway. + * This may be relevant if, for example, the library crashed + * while the file was open in write mode and the write-lock + * flag was not cleared. + * Must equal H5FD_ONION_FAPL_FLAG_FORCE_OPEN to enable. + * + */ + uint8_t creation_flags; /**< + * Flag used only when instantiating an onion file. + * If the relevant bit is set to a nonzero value, its feature + * will be enabled. + */ + char comment[H5FD_ONION_FAPL_INFO_COMMENT_MAX_LEN + + 1]; /**< + * User-supplied NULL-terminated comment for a revision to be + * written. + * Cannot be longer than H5FD_ONION_FAPL_COMMENT_MAX_LEN. + * Ignored if part of a FAPL used to open in read mode. + */ } H5FD_onion_fapl_info_t; #ifdef __cplusplus @@ -142,11 +118,11 @@ H5_DLL hid_t H5FD_onion_init(void); /** * -------------------------------------------------------------------------- - * \ingroup H5P + * \ingroup FAPL * * \brief get the onion info from the file access property list * - * \param[in] fapl_id The ID of the file access property list + * \fapl_id * \param[out] fa_out The pointer to the structure H5FD_onion_fapl_info_t * * \return \herr_t @@ -154,16 +130,18 @@ H5_DLL hid_t H5FD_onion_init(void); * \details H5Pget_fapl_onion() retrieves the structure H5FD_onion_fapl_info_t * from the file access property list that is set for the onion VFD * driver. + * + * \since 1.14.0 */ H5_DLL herr_t H5Pget_fapl_onion(hid_t fapl_id, H5FD_onion_fapl_info_t *fa_out); /** * -------------------------------------------------------------------------- - * \ingroup H5P + * \ingroup FAPL * * \brief set the onion info for the file access property list * - * \param[in] fapl_id The ID of the file access property list + * \fapl_id * \param[in] fa The pointer to the structure H5FD_onion_fapl_info_t * * \return \herr_t @@ -171,6 +149,8 @@ H5_DLL herr_t H5Pget_fapl_onion(hid_t fapl_id, H5FD_onion_fapl_info_t *fa_out); * \details H5Pset_fapl_onion() sets the structure H5FD_onion_fapl_info_t * for the file access property list that is set for the onion VFD * driver. + * + * \since 1.14.0 */ H5_DLL herr_t H5Pset_fapl_onion(hid_t fapl_id, const H5FD_onion_fapl_info_t *fa); @@ -190,6 +170,8 @@ H5_DLL herr_t H5Pset_fapl_onion(hid_t fapl_id, const H5FD_onion_fapl_info_t *fa) * for an onion file. It takes the file name and file access property * list that is set for the onion VFD driver. * + * + * \since 1.14.0 */ H5_DLL herr_t H5FDonion_get_revision_count(const char *filename, hid_t fapl_id, uint64_t *revision_count); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_header.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_header.h index cb3941b8ac..f8dd739d13 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_header.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_header.h @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -23,11 +23,10 @@ #define H5FD_ONION_ENCODED_SIZE_HEADER 40 /* Flags must align exactly one per bit, up to 24 bits */ -#define H5FD_ONION_HEADER_FLAG_WRITE_LOCK 0x1 -#define H5FD_ONION_HEADER_FLAG_DIVERGENT_HISTORY 0x2 -#define H5FD_ONION_HEADER_FLAG_PAGE_ALIGNMENT 0x4 -#define H5FD_ONION_HEADER_SIGNATURE "OHDH" -#define H5FD_ONION_HEADER_VERSION_CURR 1 +#define H5FD_ONION_HEADER_FLAG_WRITE_LOCK 0x1 +#define H5FD_ONION_HEADER_FLAG_PAGE_ALIGNMENT 0x2 +#define H5FD_ONION_HEADER_SIGNATURE "OHDH" +#define H5FD_ONION_HEADER_VERSION_CURR 1 /* In-memory representation of the on-store onion history file header. */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_history.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_history.h index bf27e6a590..5980bf7e1a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_history.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_history.h @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_index.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_index.h index 16e461b262..0a9dd88016 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_index.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_index.h @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_priv.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_priv.h index 031c1326fd..907d39f668 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_priv.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDonion_priv.h @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDpkg.h index acbaf88777..b1d929c3e6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Thursday, January 3, 2008 - * - * Purpose: This file contains declarations which are visible only within - * the H5FD package. Source files outside the H5FD package should - * include H5FDprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5FD package. Source files outside the H5FD package should + * include H5FDprivate.h instead. */ #if !(defined H5FD_FRIEND || defined H5FD_MODULE) #error "Do not include this file outside the H5FD package!" diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDprivate.h index 080b4188de..6b8e2dac7f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,10 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Robb Matzke - * Monday, July 26, 1999 - */ #ifndef H5FDprivate_H #define H5FDprivate_H @@ -82,6 +77,10 @@ typedef struct { } \ } +#define SKIP_NO_CB 0x00u +#define SKIP_SELECTION_CB 0x01u +#define SKIP_VECTOR_CB 0x02u + /* Define structure to hold driver ID, info & configuration string for FAPLs */ typedef struct { hid_t driver_id; /* Driver's ID */ @@ -154,12 +153,27 @@ H5_DLL herr_t H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count H5_DLL herr_t H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, struct H5S_t **mem_spaces, struct H5S_t **file_spaces, haddr_t offsets[], size_t element_sizes[], const void *bufs[]); -H5_DLL herr_t H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], - hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], - void *bufs[] /* out */); -H5_DLL herr_t H5FD_write_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], +H5_DLL herr_t H5FD_read_selection_id(uint32_t skip_cb, H5FD_t *file, H5FD_mem_t type, uint32_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], + size_t element_sizes[], void *bufs[] /* out */); +H5_DLL herr_t H5FD_write_selection_id(uint32_t skip_cb, H5FD_t *file, H5FD_mem_t type, uint32_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], + size_t element_sizes[], const void *bufs[]); +H5_DLL herr_t H5FD_read_vector_from_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], + haddr_t offsets[], size_t element_sizes[], void *bufs[]); + +H5_DLL herr_t H5FD_write_vector_from_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], + haddr_t offsets[], size_t element_sizes[], const void *bufs[]); + +H5_DLL herr_t H5FD_read_from_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], - const void *bufs[]); + void *bufs[]); + +H5_DLL herr_t H5FD_write_from_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], + hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], + const void *bufs[]); H5_DLL herr_t H5FD_flush(H5FD_t *file, hbool_t closing); H5_DLL herr_t H5FD_truncate(H5FD_t *file, hbool_t closing); H5_DLL herr_t H5FD_lock(H5FD_t *file, hbool_t rw); @@ -176,6 +190,12 @@ H5_DLL herr_t H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t count haddr_t addrs[], size_t sizes[], H5_flexible_const_ptr_t bufs[], H5FD_mem_t **s_types_ptr, haddr_t **s_addrs_ptr, size_t **s_sizes_ptr, H5_flexible_const_ptr_t **s_bufs_ptr); + +H5_DLL herr_t H5FD_sort_selection_io_req(hbool_t *selection_was_sorted, size_t count, hid_t mem_space_ids[], + hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], + H5_flexible_const_ptr_t bufs[], hid_t **s_mem_space_ids, + hid_t **s_file_space_ids, haddr_t **s_offsets_ptr, + size_t **s_element_sizes_ptr, H5_flexible_const_ptr_t **s_bufs_ptr); H5_DLL herr_t H5FD_init(void); /* Function prototypes for MPI based VFDs*/ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDpublic.h index 51527a0803..0eceb2fa63 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,16 +10,12 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Robb Matzke - * Monday, July 26, 1999 - */ #ifndef H5FDpublic_H #define H5FDpublic_H -/* Public headers needed by this file */ -#include "H5public.h" /* Generic Functions */ -#include "H5Fpublic.h" /* Files */ +#include "H5public.h" /* Generic Functions */ +#include "H5Fpublic.h" /* Files */ +#include "H5Ipublic.h" /* Identifiers */ /*****************/ /* Public Macros */ @@ -319,6 +314,7 @@ typedef struct { /** * \param[in] dest Address of the destination buffer * \param[in] src Address of the source buffer + * \param[in] size Size in bytes of the file image buffer to allocate * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating * the operation being performed on the file image * when this callback is invoked @@ -331,6 +327,7 @@ typedef struct { //! /** * \param[in] ptr Pointer to the buffer being reallocated + * \param[in] size Size in bytes of the file image buffer to allocate * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating * the operation being performed on the file image * when this callback is invoked @@ -341,6 +338,10 @@ typedef struct { void *(*image_realloc)(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *udata); //! /** + * \param[in] ptr Pointer to the buffer being reallocated + * \param[in] file_image_op A value from #H5FD_file_image_op_t indicating + * the operation being performed on the file image + * when this callback is invoked * \param[in] udata Value passed in in the H5Pset_file_image_callbacks * parameter \p udata */ @@ -398,7 +399,27 @@ extern "C" { #endif /* Function prototypes */ -/* Allows querying a VFD ID for features before the file is opened */ + +/** + * \ingroup H5FD + * + * \brief Allows querying a VFD ID for features before the file is opened + * + * \param[in] driver_id Virtual File Driver (VFD) ID + * \param[out] flags VFD flags supported + * + * \return \herr_t + * + * \details Queries a virtual file driver (VFD) for feature flags. Takes a + * VFD hid_t so it can be used before the file is opened. For example, + * this could be used to check if a VFD supports SWMR. + * + * \note The flags obtained here are just those of the base driver and + * do not take any configuration options (e.g., set via a fapl + * call) into consideration. + * + * \since 1.10.2 + */ H5_DLL herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/); #ifdef __cplusplus diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDros3.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDros3.h index 4c9e77fdc9..0f2f31538a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDros3.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDros3.h @@ -13,9 +13,6 @@ /* * Read-Only S3 Virtual File Driver (VFD) * - * Programmer: John Mainzer - * 2017-10-10 - * * Purpose: The public header file for the ros3 driver. */ #ifndef H5FDros3_H @@ -73,12 +70,63 @@ * ****************************************************************************/ +/** + * \def H5FD_CURR_ROS3_FAPL_T_VERSION + * The version number of the H5FD_ros3_fapl_t configuration + * structure for the $H5FD_ROS3 driver. + */ #define H5FD_CURR_ROS3_FAPL_T_VERSION 1 -#define H5FD_ROS3_MAX_REGION_LEN 32 -#define H5FD_ROS3_MAX_SECRET_ID_LEN 128 +/** + * \def H5FD_ROS3_MAX_REGION_LEN + * Maximum string length for specifying the region of the S3 bucket. + */ +#define H5FD_ROS3_MAX_REGION_LEN 32 +/** + * \def H5FD_ROS3_MAX_SECRET_ID_LEN + * Maximum string length for specifying the security ID. + */ +#define H5FD_ROS3_MAX_SECRET_ID_LEN 128 +/** + * \def H5FD_ROS3_MAX_SECRET_KEY_LEN + * Maximum string length for specifying the security key. + */ #define H5FD_ROS3_MAX_SECRET_KEY_LEN 128 +/** + * \def H5FD_ROS3_MAX_SECRET_TOK_LEN + * Maximum string length for specifying the session/security token. + */ +#define H5FD_ROS3_MAX_SECRET_TOK_LEN 1024 +/** + *\struct H5FD_ros3_fapl_t + * \brief Configuration structure for H5Pset_fapl_ros3() / H5Pget_fapl_ros3(). + * + * \details H5FD_ros_fapl_t is a public structure that is used to pass + * configuration data to the #H5FD_ROS3 driver via a File Access + * Property List. A pointer to an instance of this structure is + * a parameter to H5Pset_fapl_ros3() and H5Pget_fapl_ros3(). + * + * \var int32_t H5FD_ros3_fapl_t::version + * Version number of the H5FD_ros3_fapl_t structure. Any instance passed + * to H5Pset_fapl_ros3() / H5Pget_fapl_ros3() must have a recognized version + * number or an error will be raised. Currently, this field should be set + * to #H5FD_CURR_ROS3_FAPL_T_VERSION. + * + * \var hbool_t H5FD_ros3_fapl_t::authenticate + * A boolean which specifies if security credentials should be used for + * accessing a S3 bucket. + * + * \var char H5FD_ros3_fapl_t::aws_region[H5FD_ROS3_MAX_REGION_LEN + 1] + * A string which specifies the AWS region of the S3 bucket. + * + * \var char H5FD_ros3_fapl_t::secret_id[H5FD_ROS3_MAX_SECRET_ID_LEN + 1] + * A string which specifies the security ID. + * + * \var char H5FD_ros3_fapl_t::secret_key[H5FD_ROS3_MAX_SECRET_KEY_LEN + 1] + * A string which specifies the security key. + * + */ typedef struct H5FD_ros3_fapl_t { int32_t version; hbool_t authenticate; @@ -91,22 +139,72 @@ typedef struct H5FD_ros3_fapl_t { extern "C" { #endif +/** + * \brief Internal routine to initialize #H5FD_ROS3 driver. Not meant to be + * called directly by an HDF5 application. + */ H5_DLL hid_t H5FD_ros3_init(void); /** * \ingroup FAPL * - * \todo Add missing documentation + * \brief Queries a File Access Property List for #H5FD_ROS3 file driver properties. + * + * \fapl_id + * \param[out] fa_out Pointer to #H5FD_ROS3 driver configuration structure. + * \returns \herr_t */ H5_DLL herr_t H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_out); /** * \ingroup FAPL * - * \todo Add missing documentation + * \brief Modifies the specified File Access Property List to use the #H5FD_ROS3 driver. + * + * \fapl_id + * \param[in] fa Pointer to #H5FD_ROS3 driver configuration structure. + * \returns \herr_t */ H5_DLL herr_t H5Pset_fapl_ros3(hid_t fapl_id, const H5FD_ros3_fapl_t *fa); +/** + * \ingroup FAPL + * + * \brief Queries a File Access Property List for #H5FD_ROS3 file driver session/security + * token. + * + * \fapl_id + * \param[in] size Size of the provided char array for storing the session/security token. + * \param[out] token Session/security token. + * \returns \herr_t + * + * \since 1.14.2 + */ +H5_DLL herr_t H5Pget_fapl_ros3_token(hid_t fapl_id, size_t size, char *token); + +/** + * \ingroup FAPL + * + * \brief Modifies the specified File Access Property List to use the #H5FD_ROS3 driver + * by adding the specified session/security token. + * + * \fapl_id + * \param[in] token Session/security token. + * \returns \herr_t + * + * \details H5Pset_fapl_ros3_token() modifies an existing File Access Property List which + * is used by #H5FD_ROS3 driver by adding or updating the session/security token + * of the property list. Be aware, to set the token first you need to create + * a proper File Access Property List using H5Pset_fapl_ros() and use this list + * as input argument of the function H5Pset_fapl_ros3_token(). + * + * Note, the session token is only needed when you want to access a S3 bucket + * using temporary security credentials. + * + * \since 1.14.2 + */ +H5_DLL herr_t H5Pset_fapl_ros3_token(hid_t fapl_id, const char *token); + #ifdef __cplusplus } #endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDs3comms.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDs3comms.h index aa354d9736..47857f66fb 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDs3comms.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDs3comms.h @@ -45,11 +45,6 @@ * ``` * ...in destination buffer. * - * TODO: put documentation in a consistent place and point to it from here. - * - * Programmer: Jacob Smith - * 2017-11-30 - * *****************************************************************************/ #include "H5private.h" /* Generic Functions */ @@ -483,6 +478,7 @@ typedef struct { char *region; char *secret_id; unsigned char *signing_key; + char *token; } s3r_t; #define S3COMMS_S3R_MAGIC 0x44d8d79 @@ -514,7 +510,7 @@ H5_DLL herr_t H5FD_s3comms_s3r_close(s3r_t *handle); H5_DLL size_t H5FD_s3comms_s3r_get_filesize(s3r_t *handle); H5_DLL s3r_t *H5FD_s3comms_s3r_open(const char url[], const char region[], const char id[], - const unsigned char signing_key[]); + const unsigned char signing_key[], const char token[]); H5_DLL herr_t H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDsec2.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDsec2.h index df4d4d40e6..56f45751d3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDsec2.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDsec2.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,10 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Monday, August 2, 1999 - * - * Purpose: The public header file for the sec2 driver. + * Purpose: The public header file for the sec2 driver */ #ifndef H5FDsec2_H #define H5FDsec2_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDstdio.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDstdio.h index 484c6eae15..e2e05a77d6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDstdio.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDstdio.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,10 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Monday, August 2, 1999 - * - * Purpose: The public header file for the sec2 driver. + * Purpose: The public header file for the C stdio driver */ #ifndef H5FDstdio_H #define H5FDstdio_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDsubfiling.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDsubfiling.h new file mode 100644 index 0000000000..b1cf53a645 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDsubfiling.h @@ -0,0 +1,405 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Purpose: The public header file for the subfiling driver. */ +#ifndef H5FDsubfiling_H +#define H5FDsubfiling_H + +#ifdef H5_HAVE_SUBFILING_VFD +/** + * \def H5FD_SUBFILING + * Macro that returns the identifier for the #H5FD_SUBFILING driver. \hid_t{file driver} + */ +#define H5FD_SUBFILING (H5FDperform_init(H5FD_subfiling_init)) +#else +#define H5FD_SUBFILING (H5I_INVALID_HID) +#endif + +/** + * \def H5FD_SUBFILING_NAME + * The canonical name for the #H5FD_SUBFILING driver + */ +#define H5FD_SUBFILING_NAME "subfiling" + +#ifdef H5_HAVE_SUBFILING_VFD + +#ifndef H5FD_SUBFILING_FAPL_MAGIC +/** + * \def H5FD_SUBFILING_CURR_FAPL_VERSION + * The version number of the H5FD_subfiling_config_t configuration + * structure for the #H5FD_SUBFILING driver + */ +#define H5FD_SUBFILING_CURR_FAPL_VERSION 1 +/** + * \def H5FD_SUBFILING_FAPL_MAGIC + * Unique number used to distinguish the #H5FD_SUBFILING driver from other HDF5 file drivers + */ +#define H5FD_SUBFILING_FAPL_MAGIC 0xFED01331 +#endif + +/** + * \def H5FD_SUBFILING_DEFAULT_STRIPE_SIZE + * The default stripe size (in bytes) for data stripes in subfiles + */ +#define H5FD_SUBFILING_DEFAULT_STRIPE_SIZE (32 * 1024 * 1024) + +/** + * \def H5FD_SUBFILING_DEFAULT_STRIPE_COUNT + * Macro for the default Subfiling stripe count value. The default + * is currently to use one subfile per node. + */ +#define H5FD_SUBFILING_DEFAULT_STRIPE_COUNT -1 + +/** + * \def H5FD_SUBFILING_FILENAME_TEMPLATE + * The basic template for a subfile filename. The format specifiers + * correspond to: + * + * %s -> base filename, e.g. "file.h5" + * %PRIu64 -> file inode, e.g. 11273556 + * %0*d -> number (starting at 1) signifying the Nth (out of total + * number of subfiles) subfile. Zero-padded according + * to the number of digits in the number of subfiles + * (calculated by log10(num_subfiles) + 1) + * %d -> number of subfiles + * + * yielding filenames such as: + * + * file.h5.subfile_11273556_01_of_10 + * file.h5.subfile_11273556_02_of_10 + * file.h5.subfile_11273556_10_of_10 + */ +#define H5FD_SUBFILING_FILENAME_TEMPLATE "%s.subfile_%" PRIu64 "_%0*d_of_%d" + +/** + * \def H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE + * The basic template for a #H5FD_SUBFILING driver configuration filename. + * The format specifiers correspond to: + * + * %s -> base filename, e.g. "file.h5" + * %PRIu64 -> file inode, e.g. 11273556 + * + * yielding a filename such as: + * + * file.h5.subfile_11273556.config + */ +#define H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE "%s.subfile_%" PRIu64 ".config" + +/* + * Environment variables interpreted by the HDF5 Subfiling feature + */ + +/** + * \def H5FD_SUBFILING_STRIPE_SIZE + * Macro for name of the environment variable that specifies the size + * (in bytes) for data stripes in subfiles + * + * The value set for this environment variable is interpreted as a + * long long value and must be > 0. + */ +#define H5FD_SUBFILING_STRIPE_SIZE "H5FD_SUBFILING_STRIPE_SIZE" +/** + * \def H5FD_SUBFILING_IOC_PER_NODE + * Macro for name of the environment variable that specifies the number + * of MPI ranks per node to use as I/O concentrators + * + * The value set for this environment variable is interpreted as a + * long value and must be > 0. + */ +#define H5FD_SUBFILING_IOC_PER_NODE "H5FD_SUBFILING_IOC_PER_NODE" +/** + * \def H5FD_SUBFILING_IOC_SELECTION_CRITERIA + * Macro for name of the environment variable that provides information + * for selection MPI ranks as I/O concentrators + * + * The value set for this environment variable is interpreted differently, + * depending on the IOC selection method chosen. + * + * For #SELECT_IOC_ONE_PER_NODE, this value is ignored. + * + * For #SELECT_IOC_EVERY_NTH_RANK, this value is interpreted as a + * long value and must be > 0. The value will correspond to the + * `N` value when selecting every `N`-th MPI rank as an I/O + * concentrator. + * + * For #SELECT_IOC_WITH_CONFIG, this value is ignored as that particular + * IOC selection method is not currently supported. + * + * For #SELECT_IOC_TOTAL, this value is interpreted as a long value + * and must be > 0. The value will correspond to the total number + * of I/O concentrators to be used. + */ +#define H5FD_SUBFILING_IOC_SELECTION_CRITERIA "H5FD_SUBFILING_IOC_SELECTION_CRITERIA" +/** + * \def H5FD_SUBFILING_SUBFILE_PREFIX + * Macro for name of the environment variable that specifies a prefix + * to apply to the filenames generated for subfiles + * + * The value set for this environment variable is interpreted as a + * pathname. + */ +#define H5FD_SUBFILING_SUBFILE_PREFIX "H5FD_SUBFILING_SUBFILE_PREFIX" +/** + * \def H5FD_SUBFILING_CONFIG_FILE_PREFIX + * Macro for name of the environment variable that specifies a prefix + * to apply to the subfiling configuration filename. Useful for cases + * where the application wants to place the configuration file in a + * different directory than the default of putting it alongside the + * generated subfiles. For example, when writing to node-local storage + * one may wish to place the configuration file on a scratch file + * system readable by all nodes, while the subfiles are initially + * written to the node-local storage. + * + * The value set for this environment variable is interpreted as a + * pathname that must already exist. + * + * NOTE: As this prefix string will be encoded in the driver info + * message that gets written to the file, there is an upper + * limit of about ~900 single-byte characters for this string, + * though possibly less due to other information the driver + * may encode. Avoid long prefix names where possible. + */ +#define H5FD_SUBFILING_CONFIG_FILE_PREFIX "H5FD_SUBFILING_CONFIG_FILE_PREFIX" + +/** + * \enum H5FD_subfiling_ioc_select_t + * This enum defines the various constants to allow different + * allocations of MPI ranks as I/O concentrators. + * + * \var SELECT_IOC_ONE_PER_NODE + * Default selection method. One MPI rank per node is used as an + * I/O concentrator. If this selection method is used, the number + * of I/O concentrators per node can be adjusted with the + * #H5FD_SUBFILING_IOC_PER_NODE environment variable. + * + * \var SELECT_IOC_EVERY_NTH_RANK + * Starting with MPI rank 0, a stride of 'N' is applied to the MPI + * rank values to determine the next I/O concentrator. The + * #H5FD_SUBFILING_IOC_SELECTION_CRITERIA environment variable must + * be set to the value desired for 'N'. + * + * \var SELECT_IOC_WITH_CONFIG + * Currently unsupported. Use a configuration file to determine + * the mapping from MPI ranks to I/O concentrators. The + * #H5FD_SUBFILING_IOC_SELECTION_CRITERIA environment variable must + * be set to the path to the configuration file. + * + * \var SELECT_IOC_TOTAL + * Specifies that a total of 'N' I/O concentrators should be used. + * Starting with MPI rank 0, a stride of 'MPI comm size' / 'N' is + * applied to the MPI rank values to determine the next I/O + * concentrator. The #H5FD_SUBFILING_IOC_SELECTION_CRITERIA + * environment variable must be set to the value desired for 'N'. + * + * \var ioc_selection_options + * Unused. Sentinel value + */ +typedef enum { + SELECT_IOC_ONE_PER_NODE = 0, /* Default */ + SELECT_IOC_EVERY_NTH_RANK, /* Starting at rank 0, select-next += N */ + SELECT_IOC_WITH_CONFIG, /* NOT IMPLEMENTED: Read-from-file */ + SELECT_IOC_TOTAL, /* Starting at rank 0, mpi_size / total */ + ioc_selection_options /* Sentinel value */ + /* NOTE: Add to the Fortran constants (H5f90global.F90) when adding new entries */ +} H5FD_subfiling_ioc_select_t; + +/** + * \struct H5FD_subfiling_params_t + * \brief Subfiling parameter structure that is shared between the #H5FD_SUBFILING + * and #H5FD_IOC drivers + * + * \var H5FD_subfiling_ioc_select_t H5FD_subfiling_params_t::ioc_selection + * The method to use for selecting MPI ranks to be I/O concentrators. The + * current default is to select one MPI rank per node to be an I/O concentrator. + * Refer to #H5FD_subfiling_ioc_select_t for a description of the algorithms + * available for use. + * + * \var int64_t H5FD_subfiling_params_t::stripe_size + * The stripe size defines the size (in bytes) of the data stripes in the + * subfiles for the logical HDF5 file. Data is striped across the subfiles + * in a round-robin wrap-around fashion in segments equal to the stripe size. + * + * For example, in an HDF5 file consisting of four subfiles with a 1MiB stripe + * size, the first and fifth 1MiB of data would reside in the first subfile, + * the second and sixth 1MiB of data would reside in the second subfile and so + * on. + * + * This value can also be set or adjusted with the #H5FD_SUBFILING_STRIPE_SIZE + * environment variable. + * + * \var int32_t H5FD_subfiling_params_t::stripe_count + * The target number of subfiles to use for the logical HDF5 file. The current + * default is to use one subfile per node, but it can be useful to set a + * different target number of subfiles, especially if the HDF5 application will + * pre-create the HDF5 file on a single MPI rank. In that particular case, the + * single rank will need to know how many subfiles the logical HDF5 file will + * consist of in order to properly pre-create the file. + * + * This value is used in conjunction with the IOC selection method to determine + * which MPI ranks will be assigned as I/O concentrators. Alternatively, the + * mapping between MPI ranks and I/O concentrators can be set or adjusted with a + * combination of the #ioc_selection field and the #H5FD_SUBFILING_IOC_PER_NODE + * and #H5FD_SUBFILING_IOC_SELECTION_CRITERIA environment variables. + */ +typedef struct H5FD_subfiling_params_t { + H5FD_subfiling_ioc_select_t ioc_selection; /* Method to select I/O concentrators */ + int64_t stripe_size; /* Size (in bytes) of data stripes in subfiles */ + int32_t stripe_count; /* Target number of subfiles to use */ +} H5FD_subfiling_params_t; + +//! +/** + * \struct H5FD_subfiling_config_t + * \brief Configuration structure for H5Pset_fapl_subfiling() / H5Pget_fapl_subfiling() + * + * \details H5FD_subfiling_config_t is a public structure that is used to pass + * subfiling configuration data to the #H5FD_SUBFILING driver via + * a File Access Property List. A pointer to an instance of this structure + * is a parameter to H5Pset_fapl_subfiling() and H5Pget_fapl_subfiling(). + * + * \var uint32_t H5FD_subfiling_config_t::magic + * A somewhat unique number which distinguishes the #H5FD_SUBFILING driver + * from other drivers. Used in combination with a version number, it can + * help to validate a user-generated File Access Property List. This field + * should be set to #H5FD_SUBFILING_FAPL_MAGIC. + * + * \var uint32_t H5FD_subfiling_config_t::version + * Version number of the H5FD_subfiling_config_t structure. Any instance + * passed to H5Pset_fapl_subfiling() / H5Pget_fapl_subfiling() must have + * a recognized version number or an error will be raised. Currently, this + * field should be set to #H5FD_SUBFILING_CURR_FAPL_VERSION. + * + * \var hid_t H5FD_subfiling_config_t::ioc_fapl_id + * The File Access Property List which is setup with the file driver that + * the #H5FD_SUBFILING driver will use for servicing I/O requests to the + * subfiles. Currently, the File Access Property List must be setup with + * the #H5FD_IOC driver by calling H5Pset_fapl_ioc(), but future development + * may allow other file drivers to be used. + * + * \var hbool_t H5FD_subfiling_config_t::require_ioc + * A boolean flag which indicates whether the #H5FD_SUBFILING driver should + * use the #H5FD_IOC driver for its I/O operations. This field should currently + * always be set to TRUE. + * + * \var H5FD_subfiling_params_t H5FD_subfiling_config_t::shared_cfg + * A structure which contains the subfiling parameters that are shared between + * the #H5FD_SUBFILING and #H5FD_IOC drivers. This includes the subfile stripe + * size, stripe count, IOC selection method, etc. + * + */ +typedef struct H5FD_subfiling_config_t { + uint32_t magic; /* Must be set to H5FD_SUBFILING_FAPL_MAGIC */ + uint32_t version; /* Must be set to H5FD_SUBFILING_CURR_FAPL_VERSION */ + hid_t ioc_fapl_id; /* The FAPL setup with the stacked VFD to use for I/O concentrators */ + hbool_t require_ioc; /* Whether to use the IOC VFD (currently must always be TRUE) */ + H5FD_subfiling_params_t shared_cfg; /* Subfiling/IOC parameters (stripe size, stripe count, etc.) */ +} H5FD_subfiling_config_t; +//! + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief Internal routine to initialize #H5FD_SUBFILING driver. Not meant to be + * called directly by an HDF5 application + */ +H5_DLL hid_t H5FD_subfiling_init(void); +/** + * \ingroup FAPL + * + * \brief Modifies the specified File Access Property List to use the #H5FD_SUBFILING driver + * + * \fapl_id + * \param[in] vfd_config Pointer to #H5FD_SUBFILING driver configuration structure. May be NULL. + * \returns \herr_t + * + * \details H5Pset_fapl_subfiling() modifies the File Access Property List to use the + * #H5FD_SUBFILING driver. + * + * The #H5FD_SUBFILING driver is an MPI-based file driver that allows an + * HDF5 application to distribute a logical HDF5 file across a collection + * of "subfiles" in equal-sized data segment "stripes". I/O to the logical + * HDF5 file is then directed to the appropriate "subfile" according to the + * #H5FD_SUBFILING configuration and a system of I/O concentrators, which + * are MPI ranks operating worker threads. + * + * By allowing a configurable stripe size, number of I/O concentrators and + * method for selecting MPI ranks as I/O concentrators, the #H5FD_SUBFILING + * driver aims to enable an HDF5 application to find a middle ground between + * the single shared file and file-per-process approaches to parallel file I/O + * for the particular machine the application is running on. In general, the + * goal is to avoid some of the complexity of the file-per-process approach + * while also minimizing the locking issues of the single shared file approach + * on a parallel file system. + * + * \note Since the #H5FD_SUBFILING driver is an MPI-based file driver, the HDF5 + * application should ensure that H5Pset_mpi_params() is called before this + * routine so that the appropriate MPI communicator and info objects will be + * setup for use by the #H5FD_SUBFILING and #H5FD_IOC drivers. + * + * \note The current architecture of the #H5FD_SUBFILING driver requires that the + * HDF5 application must have been initialized with MPI_Init_thread() using + * a value of MPI_THREAD_MULTIPLE for the thread support level. + * + * \note The \p vfd_config parameter may be NULL. In this case, the reference + * implementation I/O concentrator VFD will be used with the default settings + * of one I/O concentrator per node and a stripe size of 32MiB. Refer to the + * H5FD_subfiling_config_t documentation for information about configuration + * for the #H5FD_SUBFILING driver. + * + * \since 1.14.0 + * + */ +H5_DLL herr_t H5Pset_fapl_subfiling(hid_t fapl_id, const H5FD_subfiling_config_t *vfd_config); +/** + * \ingroup FAPL + * + * \brief Queries a File Access Property List for #H5FD_SUBFILING file driver properties + * + * \fapl_id + * \param[out] config_out Pointer to H5FD_subfiling_config_t structure through which the + * #H5FD_SUBFILING file driver properties will be returned. + * + * \returns \herr_t + * + * \details H5Pget_fapl_subfiling() queries the specified File Access Property List for + * #H5FD_SUBFILING driver properties as set by H5Pset_fapl_subfiling(). If the + * #H5FD_SUBFILING driver has not been set on the File Access Property List, a + * default configuration is returned. An HDF5 application may use this + * functionality to manually configure the #H5FD_SUBFILING driver by calling + * H5Pget_fapl_subfiling() on a newly-created File Access Property List, adjusting + * the default values and then calling H5Pset_fapl_subfiling() with the configured + * H5FD_subfiling_config_t structure. + * + * \note H5Pget_fapl_subfiling() returns the #H5FD_SUBFILING driver properties as they + * were initially set for the File Access Property List using H5Pset_fapl_subfiling(). + * Alternatively, the driver properties can be modified at runtime according to values + * set for the #H5FD_SUBFILING_STRIPE_SIZE, #H5FD_SUBFILING_IOC_PER_NODE and + * #H5FD_SUBFILING_IOC_SELECTION_CRITERIA environment variables. However, driver + * properties set through environment variables will not be reflected in what is + * returned by H5Pget_fapl_subfiling(), so an application may need to check those + * environment variables to get accurate values for the #H5FD_SUBFILING driver + * properties. + * + * \since 1.14.0 + * + */ +H5_DLL herr_t H5Pget_fapl_subfiling(hid_t fapl_id, H5FD_subfiling_config_t *config_out); + +#ifdef __cplusplus +} +#endif + +#endif /* H5_HAVE_SUBFILING_VFD */ + +#endif /* H5FDsubfiling_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FDwindows.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FDwindows.h index 79e73b66e1..14f698580f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FDwindows.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FDwindows.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,11 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Scott Wegner - * Based on code by Robb Matzke - * Thursday, May 24 2007 - * - * Purpose: The public header file for the windows driver. + * Purpose: The public header file for the Windows driver */ #ifndef H5FDwindows_H #define H5FDwindows_H @@ -49,7 +44,7 @@ extern "C" { * comes. * * Only the Windows driver is tested on Windows systems; other drivers - * are used at the application’s and the user’s risk. + * are used at the application's and the user's risk. * * Furthermore, the Windows driver is tested and available only on * Windows systems; it is not available on non-Windows systems. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FLmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FLmodule.h index 04856038c8..5e9f15733f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FLmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FLmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5FL package. Including this header means that the source file - * is part of the H5FL package. + * Purpose: This file contains declarations which define macros for the + * H5FL package. Including this header means that the source file + * is part of the H5FL package. */ #ifndef H5FLmodule_H #define H5FLmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FLprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FLprivate.h index 72e5f935a8..45ca751e9f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FLprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FLprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5FLprivate.h - * Mar 23 2000 - * Quincey Koziol * * Purpose: Private non-prototype header. * @@ -25,9 +22,6 @@ #define H5FLprivate_H /* Public headers needed by this file */ -#ifdef LATER -#include "H5FLpublic.h" /*API prototypes */ -#endif /* LATER */ /* Private headers needed by this file */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FOprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FOprivate.h index e20f54d32e..1f44ec839b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FOprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FOprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -17,10 +16,6 @@ #ifndef H5FOprivate_H #define H5FOprivate_H -#ifdef LATER -#include "H5FOpublic.h" -#endif /* LATER */ - /* Private headers needed by this file */ #include "H5private.h" /* Generic Functions */ #include "H5Fprivate.h" /* File access */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FSmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FSmodule.h index 841b8fde70..46bf8bf0c2 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FSmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FSmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5FS package. Including this header means that the source file - * is part of the H5FS package. + * Purpose: This file contains declarations which define macros for the + * H5FS package. Including this header means that the source file + * is part of the H5FS package. */ #ifndef H5FSmodule_H #define H5FSmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FSpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FSpkg.h index d051fff888..4ec7aafe6b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FSpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FSpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, May 2, 2006 - * * Purpose: This file contains declarations which are visible only within * the H5FS package. Source files outside the H5FS package should * include H5FSprivate.h instead. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FSprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FSprivate.h index 130e1e59e0..abd4b20d1a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FSprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FSprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5FSprivate.h - * May 2 2006 - * Quincey Koziol * * Purpose: Private header for library accessible file free space routines. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FaccProp.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FaccProp.h index 7d998e205d..27028a2bcc 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FaccProp.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FaccProp.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FcreatProp.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FcreatProp.h index ba0c2e6492..399db71d43 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FcreatProp.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FcreatProp.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5File.h b/externals/coda-oss/modules/drivers/hdf5/include/H5File.h index 38faeef36a..617adaadb4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5File.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5File.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5FloatType.h b/externals/coda-oss/modules/drivers/hdf5/include/H5FloatType.h index 387520f3bb..42437ec115 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5FloatType.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5FloatType.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Fmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Fmodule.h index 60476930db..0fcf4b8c0f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Fmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Fmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5F package. Including this header means that the source file - * is part of the H5F package. + * Purpose: This file contains declarations which define macros for the + * H5F package. Including this header means that the source file + * is part of the H5F package. */ #ifndef H5Fmodule_H #define H5Fmodule_H @@ -28,7 +25,1166 @@ #define H5_MY_PKG H5F #define H5_MY_PKG_ERR H5E_FILE -/**\defgroup H5F H5F +/** \page H5F_UG The HDF5 File + * + * \section sec_file The HDF5 File + * \subsection subsec_file_intro Introduction + * The purpose of this chapter is to describe how to work with HDF5 data files. + * + * If HDF5 data is to be written to or read from a file, the file must first be explicitly created or + * opened with the appropriate file driver and access privileges. Once all work with the file is + * complete, the file must be explicitly closed. + * + * This chapter discusses the following: + * \li File access modes + * \li Creating, opening, and closing files + * \li The use of file creation property lists + * \li The use of file access property lists + * \li The use of low-level file drivers + * + * This chapter assumes an understanding of the material presented in the data model chapter. For + * more information, @see @ref sec_data_model. + * + * \subsection subsec_file_access_modes File Access Modes + * There are two issues regarding file access: + *
  • What should happen when a new file is created but a file of the same name already + * exists? Should the create action fail, or should the existing file be overwritten?
  • + *
  • Is a file to be opened with read-only or read-write access?
+ * + * Four access modes address these concerns. Two of these modes can be used with #H5Fcreate, and + * two modes can be used with #H5Fopen. + * \li #H5Fcreate accepts #H5F_ACC_EXCL or #H5F_ACC_TRUNC + * \li #H5Fopen accepts #H5F_ACC_RDONLY or #H5F_ACC_RDWR + * + * The access modes are described in the table below. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Access flags and modes
Access FlagResulting Access Mode
#H5F_ACC_EXCLIf the file already exists, #H5Fcreate fails. If the file does not exist, + * it is created and opened with read-write access. (Default)
#H5F_ACC_TRUNCIf the file already exists, the file is opened with read-write access, + * and new data will overwrite any existing data. If the file does not exist, + * it is created and opened with read-write access.
#H5F_ACC_RDONLYAn existing file is opened with read-only access. If the file does not + * exist, #H5Fopen fails. (Default)
#H5F_ACC_RDWRAn existing file is opened with read-write access. If the file does not + * exist, #H5Fopen fails.
+ * + * By default, #H5Fopen opens a file for read-only access; passing #H5F_ACC_RDWR allows + * read-write access to the file. + * + * By default, #H5Fcreate fails if the file already exists; only passing #H5F_ACC_TRUNC allows + * the truncating of an existing file. + * + * \subsection subsec_file_creation_access File Creation and File Access Properties + * File creation and file access property lists control the more complex aspects of creating and + * accessing files. + * + * File creation property lists control the characteristics of a file such as the size of the userblock, + * a user-definable data block; the size of data address parameters; properties of the B-trees that are + * used to manage the data in the file; and certain HDF5 Library versioning information. + * + * For more information, @see @ref subsubsec_file_property_lists_props. + * + * This section has a more detailed discussion of file creation properties. If you have no special + * requirements for these file characteristics, you can simply specify #H5P_DEFAULT for the default + * file creation property list when a file creation property list is called for. + * + * File access property lists control properties and means of accessing a file such as data alignment + * characteristics, metadata block and cache sizes, data sieve buffer size, garbage collection + * settings, and parallel I/O. Data alignment, metadata block and cache sizes, and data sieve buffer + * size are factors in improving I/O performance. + * + * For more information, @see @ref subsubsec_file_property_lists_access. + * + * This section has a more detailed discussion of file access properties. If you have no special + * requirements for these file access characteristics, you can simply specify #H5P_DEFAULT for the + * default file access property list when a file access property list is called for. + * + * + * + * + * + * + *
Figure 10 - More sample file structures
+ * \image html UML_FileAndProps.gif "UML model for an HDF5 file and its property lists" + *
+ * + * \subsection subsec_file_drivers Low-level File Drivers + * The concept of an HDF5 file is actually rather abstract: the address space for what is normally + * thought of as an HDF5 file might correspond to any of the following at the storage level: + * \li Single file on a standard file system + * \li Multiple files on a standard file system + * \li Multiple files on a parallel file system + * \li Block of memory within an application's memory space + * \li More abstract situations such as virtual files + * + * This HDF5 address space is generally referred to as an HDF5 file regardless of its organization at + * the storage level. + * + * HDF5 accesses a file (the address space) through various types of low-level file drivers. The + * default HDF5 file storage layout is as an unbuffered permanent file which is a single, contiguous + * file on local disk. Alternative layouts are designed to suit the needs of a variety of systems, + * environments, and applications. + * + * \subsection subsec_file_program_model Programming Model for Files + * Programming models for creating, opening, and closing HDF5 files are described in the + * sub-sections below. + * + * \subsubsection subsubsec_file_program_model_create Creating a New File + * The programming model for creating a new HDF5 file can be summarized as follows: + * \li Define the file creation property list + * \li Define the file access property list + * \li Create the file + * + * First, consider the simple case where we use the default values for the property lists. See the + * example below. + * + * Creating an HDF5 file using property list defaults + * \code + * file_id = H5Fcreate ("SampleFile.h5", H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT) + * \endcode + * + * Note: The example above specifies that #H5Fcreate should fail if SampleFile.h5 already exists. + * + * A more complex case is shown in the example below. In this example, we define file creation + * and access property lists (though we do not assign any properties), specify that #H5Fcreate + * should fail if SampleFile.h5 already exists, and create a new file named SampleFile.h5. The example + * does not specify a driver, so the default driver, #H5FD_SEC2, will be used. + * + * Creating an HDF5 file using property lists + * \code + * fcplist_id = H5Pcreate (H5P_FILE_CREATE) + * <...set desired file creation properties...> + * faplist_id = H5Pcreate (H5P_FILE_ACCESS) + * <...set desired file access properties...> + * file_id = H5Fcreate ("SampleFile.h5", H5F_ACC_EXCL, fcplist_id, faplist_id) + * \endcode + * Notes: + * 1. A root group is automatically created in a file when the file is first created. + * + * 2. File property lists, once defined, can be reused when another file is created within the same + * application. + * + * \subsubsection subsubsec_file_program_model_open Opening an Existing File + * The programming model for opening an existing HDF5 file can be summarized as follows: + *
  • Define or modify the file access property list including a low-level file driver (optional)
  • + *
  • Open the file
+ * + * The code in the example below shows how to open an existing file with read-only access. + * + * Opening an HDF5 file + * \code + * faplist_id = H5Pcreate (H5P_FILE_ACCESS) + * status = H5Pset_fapl_stdio (faplist_id) + * file_id = H5Fopen ("SampleFile.h5", H5F_ACC_RDONLY, faplist_id) + * \endcode + * + * \subsubsection subsubsec_file_program_model_close Closing a File + * The programming model for closing an HDF5 file is very simple: + * \li Close file + * + * We close SampleFile.h5 with the code in the example below. + * + * Closing an HDF5 file + * \code + * status = H5Fclose (file_id) + * \endcode + * Note that #H5Fclose flushes all unwritten data to storage and that file_id is the identifier returned + * for SampleFile.h5 by #H5Fopen. + * + * More comprehensive discussions regarding all of these steps are provided below. + * + * \subsection subsec_file_h5dump Using h5dump to View a File + * h5dump is a command-line utility that is included in the HDF5 distribution. This program + * provides a straight-forward means of inspecting the contents of an HDF5 file. You can use + * h5dump to verify that a program is generating the intended HDF5 file. h5dump displays ASCII + * output formatted according to the HDF5 DDL grammar. + * + * The following h5dump command will display the contents of SampleFile.h5: + * \code + * h5dump SampleFile.h5 + * \endcode + * + * If no datasets or groups have been created in and no data has been written to the file, the output + * will look something like the following: + * \code + * HDF5 "SampleFile.h5" { + * GROUP "/" { + * } + * } + * \endcode + * + * Note that the root group, indicated above by /, was automatically created when the file was created. + * + * h5dump is described on the + * Tools + * page under + * + * Libraries and Tools Reference. + * The HDF5 DDL grammar is described in the document \ref DDLBNF110. + * + * \subsection subsec_file_summary File Function Summaries + * General library (\ref H5 functions and macros), (\ref H5F functions), file related + * (\ref H5P functions), and file driver (\ref H5P functions) are listed below. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
General library functions and macros
FunctionPurpose
#H5check_versionVerifies that HDF5 library versions are consistent.
#H5closeFlushes all data to disk, closes all open identifiers, and cleans up memory.
#H5dont_atexitInstructs the library not to install the atexit cleanup routine.
#H5garbage_collectPerforms garbage collection (GC) on all free-lists of all types.
#H5get_libversionReturns the HDF library release number.
#H5openInitializes the HDF5 library.
#H5set_free_list_limitsSets free-list size limits.
#H5_VERSION_GEDetermines whether the version of the library being used is greater than or equal + * to the specified version.
#H5_VERSION_LEDetermines whether the version of the library being used is less than or equal + * to the specified version.
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
File functions
FunctionPurpose
#H5Fclear_elink_file_cacheClears the external link open file cache for a file.
#H5FcloseCloses HDF5 file.
#H5FcreateCreates new HDF5 file.
#H5FflushFlushes data to HDF5 file on storage medium.
#H5Fget_access_plistReturns a file access property list identifier.
#H5Fget_create_plistReturns a file creation property list identifier.
#H5Fget_file_imageRetrieves a copy of the image of an existing, open file.
#H5Fget_filesizeReturns the size of an HDF5 file.
#H5Fget_freespaceReturns the amount of free space in a file.
#H5Fget_infoReturns global information for a file.
#H5Fget_intentDetermines the read/write or read-only status of a file.
#H5Fget_mdc_configObtains current metadata cache configuration for target file.
#H5Fget_mdc_hit_rateObtains target file's metadata cache hit rate.
#H5Fget_mdc_sizeObtains current metadata cache size data for specified file.
#H5Fget_mpi_atomicityRetrieves the atomicity mode in use.
#H5Fget_nameRetrieves the name of the file to which the object belongs.
#H5Fget_obj_countReturns the number of open object identifiers for an open file.
#H5Fget_obj_idsReturns a list of open object identifiers.
#H5Fget_vfd_handleReturns pointer to the file handle from the virtual file driver.
#H5Fis_hdf5Determines whether a file is in the HDF5 format.
#H5FmountMounts a file.
#H5FopenOpens an existing HDF5 file.
#H5FreopenReturns a new identifier for a previously-opened HDF5 file.
#H5Freset_mdc_hit_rate_statsResets hit rate statistics counters for the target file.
#H5Fset_mdc_configConfigures metadata cache of target file.
#H5Fset_mpi_atomicitySets the MPI atomicity mode.
#H5FunmountUnmounts a file.
+ * + * \anchor fcpl_table_tag File creation property list functions (H5P) + * \snippet{doc} tables/propertyLists.dox fcpl_table + * + * \anchor fapl_table_tag File access property list functions (H5P) + * \snippet{doc} tables/propertyLists.dox fapl_table + * + * \anchor fd_pl_table_tag File driver property list functions (H5P) + * \snippet{doc} tables/propertyLists.dox fd_pl_table + * + * + * \subsection subsec_file_create Creating or Opening an HDF5 File + * This section describes in more detail how to create and how to open files. + * + * New HDF5 files are created and opened with #H5Fcreate; existing files are opened with + * #H5Fopen. Both functions return an object identifier which must eventually be released by calling + * #H5Fclose. + * + * To create a new file, call #H5Fcreate: + * \code + * hid_t H5Fcreate (const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) + * \endcode + * + * #H5Fcreate creates a new file named name in the current directory. The file is opened with read + * and write access; if the #H5F_ACC_TRUNC flag is set, any pre-existing file of the same name in + * the same directory is truncated. If #H5F_ACC_TRUNC is not set or #H5F_ACC_EXCL is set and + * if a file of the same name exists, #H5Fcreate will fail. + * + * The new file is created with the properties specified in the property lists fcpl_id and fapl_id. + * fcpl is short for file creation property list. fapl is short for file access property list. Specifying + * #H5P_DEFAULT for either the creation or access property list will use the library's default + * creation or access properties. + * + * If #H5Fcreate successfully creates the file, it returns a file identifier for the new file. This + * identifier will be used by the application any time an object identifier, an OID, for the file is + * required. Once the application has finished working with a file, the identifier should be released + * and the file closed with #H5Fclose. + * + * To open an existing file, call #H5Fopen: + * \code + * hid_t H5Fopen (const char *name, unsigned flags, hid_t fapl_id) + * \endcode + * + * #H5Fopen opens an existing file with read-write access if #H5F_ACC_RDWR is set and read-only + * access if #H5F_ACC_RDONLY is set. + * + * fapl_id is the file access property list identifier. Alternatively, #H5P_DEFAULT indicates that the + * application relies on the default I/O access parameters. Creating and changing access property + * lists is documented further below. + * + * A file can be opened more than once via multiple #H5Fopen calls. Each such call returns a unique + * file identifier and the file can be accessed through any of these file identifiers as long as they + * remain valid. Each of these file identifiers must be released by calling #H5Fclose when it is no + * longer needed. + * + * For more information, @see @ref subsubsec_file_property_lists_access. + * For more information, @see @ref subsec_file_property_lists. + * + * \subsection subsec_file_closes Closing an HDF5 File + * #H5Fclose both closes a file and releases the file identifier returned by #H5Fopen or #H5Fcreate. + * #H5Fclose must be called when an application is done working with a file; while the HDF5 + * Library makes every effort to maintain file integrity, failure to call #H5Fclose may result in the + * file being abandoned in an incomplete or corrupted state. + * + * To close a file, call #H5Fclose: + * \code + * herr_t H5Fclose (hid_t file_id) + * \endcode + * This function releases resources associated with an open file. After closing a file, the file + * identifier, file_id, cannot be used again as it will be undefined. + * + * #H5Fclose fulfills three purposes: to ensure that the file is left in an uncorrupted state, to ensure + * that all data has been written to the file, and to release resources. Use #H5Fflush if you wish to + * ensure that all data has been written to the file but it is premature to close it. + * + * Note regarding serial mode behavior: When #H5Fclose is called in serial mode, it closes the file + * and terminates new access to it, but it does not terminate access to objects that remain + * individually open within the file. That is, if #H5Fclose is called for a file but one or more objects + * within the file remain open, those objects will remain accessible until they are individually + * closed. To illustrate, assume that a file, fileA, contains a dataset, data_setA, and that both are + * open when #H5Fclose is called for fileA. data_setA will remain open and accessible, including + * writable, until it is explicitly closed. The file will be automatically and finally closed once all + * objects within it have been closed. + * + * Note regarding parallel mode behavior: Once #H5Fclose has been called in parallel mode, access + * is no longer available to any object within the file. + * + * \subsection subsec_file_property_lists File Property Lists + * Additional information regarding file structure and access are passed to #H5Fcreate and + * #H5Fopen through property list objects. Property lists provide a portable and extensible method of + * modifying file properties via simple API functions. There are two kinds of file-related property + * lists: + * \li File creation property lists + * \li File access property lists + * + * In the following sub-sections, we discuss only one file creation property, userblock size, in detail + * as a model for the user. Other file creation and file access properties are mentioned and defined + * briefly, but the model is not expanded for each; complete syntax, parameter, and usage + * information for every property list function is provided in the \ref H5P + * section of the HDF5 Reference Manual. + * + * For more information, @see @ref sec_plist. + * + * \subsubsection subsubsec_file_property_lists_create Creating a Property List + * If you do not wish to rely on the default file creation and access properties, you must first create + * a property list with #H5Pcreate. + * \code + * hid_t H5Pcreate (hid_t cls_id) + * \endcode + * cls_id is the type of property list being created. In this case, the appropriate values are + * #H5P_FILE_CREATE for a file creation property list and #H5P_FILE_ACCESS for a file access + * property list. + * + * Thus, the following calls create a file creation property list and a file access property list with + * identifiers fcpl_id and fapl_id, respectively: + * \code + * fcpl_id = H5Pcreate (H5P_FILE_CREATE) + * fapl_id = H5Pcreate (H5P_FILE_ACCESS) + * \endcode + * + * Once the property lists have been created, the properties themselves can be modified via the + * functions described in the following sub-sections. + * + * \subsubsection subsubsec_file_property_lists_props File Creation Properties + * File creation property lists control the file metadata, which is maintained in the superblock of the + * file. These properties are used only when a file is first created. + * + *

Userblock Size

+ * \code + * herr_t H5Pset_userblock (hid_t plist, hsize_t size) + * herr_t H5Pget_userblock (hid_t plist, hsize_t *size) + * \endcode + * + * The userblock is a fixed-length block of data located at the beginning of the file and is ignored + * by the HDF5 library. This block is specifically set aside for any data or information that + * developers determine to be useful to their applications but that will not be used by the HDF5 + * library. The size of the userblock is defined in bytes and may be set to any power of two with a + * minimum size of 512 bytes. In other words, userblocks might be 512, 1024, or 2048 bytes in + * size. + * + * This property is set with #H5Pset_userblock and queried via #H5Pget_userblock. For example, if + * an application needed a 4K userblock, then the following function call could be used: + * \code + * status = H5Pset_userblock(fcpl_id, 4096) + * \endcode + * + * The property list could later be queried with: + * \code + * status = H5Pget_userblock(fcpl_id, size) + * \endcode + * and the value 4096 would be returned in the parameter size. + * + * Other properties, described below, are set and queried in exactly the same manner. Syntax and + * usage are detailed in the @ref H5P section of the HDF5 Reference Manual. + * + *

Offset and Length Sizes

+ * This property specifies the number of bytes used to store the offset and length of objects in the + * HDF5 file. Values of 2, 4, and 8 bytes are currently supported to accommodate 16-bit, 32-bit, + * and 64-bit file address spaces. + * + * These properties are set and queried via #H5Pset_sizes and #H5Pget_sizes. + * + *

Symbol Table Parameters

+ * The size of symbol table B-trees can be controlled by setting the 1/2-rank and 1/2-node size + * parameters of the B-tree. + * + * These properties are set and queried via #H5Pset_sym_k and #H5Pget_sym_k + * + *

Indexed Storage Parameters

+ * The size of indexed storage B-trees can be controlled by setting the 1/2-rank and 1/2-node size + * parameters of the B-tree. + * + * These properties are set and queried via #H5Pset_istore_k and #H5Pget_istore_k. + * + *

Version Information

+ * Various objects in an HDF5 file may over time appear in different versions. The HDF5 Library + * keeps track of the version of each object in the file. + * + * Version information is retrieved via #H5Pget_version. + * + * \subsubsection subsubsec_file_property_lists_access File Access Properties + * This section discusses file access properties that are not related to the low-level file drivers. File + * drivers are discussed separately later in this chapter. + * For more information, @see @ref subsec_file_alternate_drivers. + * + * File access property lists control various aspects of file I/O and structure. + * + *

Data Alignment

+ * Sometimes file access is faster if certain data elements are aligned in a specific manner. This can + * be controlled by setting alignment properties via the #H5Pset_alignment function. There are two + * values involved: + * \li A threshold value + * \li An alignment interval + * + * Any allocation request at least as large as the threshold will be aligned on an address that is a + * multiple of the alignment interval. + * + *

Metadata Block Allocation Size

+ * Metadata typically exists as very small chunks of data; storing metadata elements in a file + * without blocking them can result in hundreds or thousands of very small data elements in the + * file. This can result in a highly fragmented file and seriously impede I/O. By blocking metadata + * elements, these small elements can be grouped in larger sets, thus alleviating both problems. + * + * #H5Pset_meta_block_size sets the minimum size in bytes of metadata block allocations. + * #H5Pget_meta_block_size retrieves the current minimum metadata block allocation size. + * + *

Metadata Cache

+ * Metadata and raw data I/O speed are often governed by the size and frequency of disk reads and + * writes. In many cases, the speed can be substantially improved by the use of an appropriate + * cache. + * + * #H5Pset_cache sets the minimum cache size for both metadata and raw data and a preemption + * value for raw data chunks. #H5Pget_cache retrieves the current values. + * + *

Data Sieve Buffer Size

+ * Data sieve buffering is used by certain file drivers to speed data I/O and is most commonly when + * working with dataset hyperslabs. For example, using a buffer large enough to hold several pieces + * of a dataset as it is read in for hyperslab selections will boost performance noticeably. + * + * #H5Pset_sieve_buf_size sets the maximum size in bytes of the data sieve buffer. + * #H5Pget_sieve_buf_size retrieves the current maximum size of the data sieve buffer. + * + *

Garbage Collection References

+ * Dataset region references and other reference types use space in an HDF5 file's global heap. If + * garbage collection is on (1) and the user passes in an uninitialized value in a reference structure, + * the heap might become corrupted. When garbage collection is off (0), however, and the user reuses + * a reference, the previous heap block will be orphaned and not returned to the free heap + * space. When garbage collection is on, the user must initialize the reference structures to 0 or risk + * heap corruption. + * + * #H5Pset_gc_references sets the garbage collecting references flag. + * + * \subsection subsec_file_alternate_drivers Alternate File Storage Layouts and Low-level File Drivers + * The concept of an HDF5 file is actually rather abstract: the address space for what is normally + * thought of as an HDF5 file might correspond to any of the following: + * \li Single file on standard file system + * \li Multiple files on standard file system + * \li Multiple files on parallel file system + * \li Block of memory within application's memory space + * \li More abstract situations such as virtual files + * + * This HDF5 address space is generally referred to as an HDF5 file regardless of its organization at + * the storage level. + * + * HDF5 employs an extremely flexible mechanism called the virtual file layer, or VFL, for file + * I/O. A full understanding of the VFL is only necessary if you plan to write your own drivers + * @see \ref VFL in the HDF5 Technical Notes. + * + * For our + * purposes here, it is sufficient to know that the low-level drivers used for file I/O reside in the + * VFL, as illustrated in the following figure. Note that H5FD_STREAM is not available with 1.8.x + * and later versions of the library. + * + * + * + * + * + *
+ * \image html VFL_Drivers.gif "I/O path from application to VFL and low-level drivers to storage" + *
+ * + * As mentioned above, HDF5 applications access HDF5 files through various low-level file + * drivers. The default driver for that layout is the POSIX driver (also known as the SEC2 driver), + * #H5FD_SEC2. Alternative layouts and drivers are designed to suit the needs of a variety of + * systems, environments, and applications. The drivers are listed in the table below. + * + * \snippet{doc} tables/fileDriverLists.dox supported_file_driver_table + * + * For more information, see the HDF5 Reference Manual entries for the function calls shown in + * the column on the right in the table above. + * + * Note that the low-level file drivers manage alternative file storage layouts. Dataset storage + * layouts (chunking, compression, and external dataset storage) are managed independently of file + * storage layouts. + * + * If an application requires a special-purpose low-level driver, the VFL provides a public API for + * creating one. For more information on how to create a driver, + * @see @ref VFL in the HDF5 Technical Notes. + * + * \subsubsection subsubsec_file_alternate_drivers_id Identifying the Previously‐used File Driver + * When creating a new HDF5 file, no history exists, so the file driver must be specified if it is to be + * other than the default. + * + * When opening existing files, however, the application may need to determine which low-level + * driver was used to create the file. The function #H5Pget_driver is used for this purpose. See the + * example below. + * + * Identifying a driver + * \code + * hid_t H5Pget_driver (hid_t fapl_id) + * \endcode + * + * #H5Pget_driver returns a constant identifying the low-level driver for the access property list + * fapl_id. For example, if the file was created with the POSIX (aka SEC2) driver, + * #H5Pget_driver returns #H5FD_SEC2. + * + * If the application opens an HDF5 file without both determining the driver used to create the file + * and setting up the use of that driver, the HDF5 Library will examine the superblock and the + * driver definition block to identify the driver. + * See the HDF5 File Format Specification + * for detailed descriptions of the superblock and the driver definition block. + * + * \subsubsection subsubsec_file_alternate_drivers_sec2 The POSIX (aka SEC2) Driver + * The POSIX driver, #H5FD_SEC2, uses functions from section 2 of the POSIX manual to access + * unbuffered files stored on a local file system. This driver is also known as the SEC2 driver. The + * HDF5 Library buffers metadata regardless of the low-level driver, but using this driver prevents + * data from being buffered again by the lowest layers of the library. + * + * The function #H5Pset_fapl_sec2 sets the file access properties to use the POSIX driver. See the + * example below. + * + * Using the POSIX, aka SEC2, driver + * \code + * herr_t H5Pset_fapl_sec2 (hid_t fapl_id) + * \endcode + * + * Any previously-defined driver properties are erased from the property list. + * + * Additional parameters may be added to this function in the future. Since there are no additional + * variable settings associated with the POSIX driver, there is no H5Pget_fapl_sec2 function. + * + * \subsubsection subsubsec_file_alternate_drivers_direct The Direct Driver + * The Direct driver, #H5FD_DIRECT, functions like the POSIX driver except that data is written to + * or read from the file synchronously without being cached by the system. + * + * The functions #H5Pset_fapl_direct and #H5Pget_fapl_direct are used to manage file access properties. + * See the example below. + * + * Using the Direct driver + * \code + * herr_t H5Pset_fapl_direct(hid_t fapl_id, size_t alignment, size_t block_size, size_t cbuf_size) + * herr_t H5Pget_fapl_direct(hid_t fapl_id, size_t *alignment, size_t *block_size, size_t *cbuf_size) + * \endcode + * + * #H5Pset_fapl_direct sets the file access properties to use the Direct driver; any previously defined + * driver properties are erased from the property list. #H5Pget_fapl_direct retrieves the file access + * properties used with the Direct driver. fapl_id is the file access property list identifier. + * alignment is the memory alignment boundary. block_size is the file system block size. + * cbuf_size is the copy buffer size. + * + * Additional parameters may be added to this function in the future. + * + * \subsubsection subsubsec_file_alternate_drivers_log The Log Driver + * The Log driver, #H5FD_LOG, is designed for situations where it is necessary to log file access + * activity. + * + * The function #H5Pset_fapl_log is used to manage logging properties. See the example below. + * + * Logging file access + * \code + * herr_t H5Pset_fapl_log (hid_t fapl_id, const char *logfile, unsigned int flags, size_t buf_size) + * \endcode + * + * #H5Pset_fapl_log sets the file access property list to use the Log driver. File access characteristics + * are identical to access via the POSIX driver. Any previously defined driver properties are erased + * from the property list. + * + * Log records are written to the file logfile. + * + * The logging levels set with the verbosity parameter are shown in the table below. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Logging levels
LevelComments
0Performs no logging.
1Records where writes and reads occur in the file.
2Records where writes and reads occur in the file and what kind of data is written + * at each location. This includes raw data or any of several types of metadata + * (object headers, superblock, B-tree data, local headers, or global headers).
+ * + * There is no H5Pget_fapl_log function. + * + * Additional parameters may be added to this function in the future. + * + * \subsubsection subsubsec_file_alternate_drivers_win The Windows Driver + * The Windows driver, #H5FD_WINDOWS, was modified in HDF5-1.8.8 to be a wrapper of the + * POSIX driver, #H5FD_SEC2. In other words, if the Windows drivers is used, any file I/O will + * instead use the functionality of the POSIX driver. This change should be transparent to all user + * applications. The Windows driver used to be the default driver for Windows systems. The + * POSIX driver is now the default. + * + * The function #H5Pset_fapl_windows sets the file access properties to use the Windows driver. + * See the example below. + * + * Using the Windows driver + * \code + * herr_t H5Pset_fapl_windows (hid_t fapl_id) + * \endcode + * + * Any previously-defined driver properties are erased from the property list. + * + * Additional parameters may be added to this function in the future. Since there are no additional + * variable settings associated with the POSIX driver, there is no H5Pget_fapl_windows function. + * + * \subsubsection subsubsec_file_alternate_drivers_stdio The STDIO Driver + * The STDIO driver, #H5FD_STDIO, accesses permanent files in a local file system like the + * POSIX driver does. The STDIO driver also has an additional layer of buffering beneath the + * HDF5 Library. + * + * The function #H5Pset_fapl_stdio sets the file access properties to use the STDIO driver. See the + * example below. + * + * Using the STDIO driver + * \code + * herr_t H5Pset_fapl_stdio (hid_t fapl_id) + * \endcode + * + * Any previously defined driver properties are erased from the property list. + * + * Additional parameters may be added to this function in the future. Since there are no additional + * variable settings associated with the STDIO driver, there is no H5Pget_fapl_stdio function. + * + * \subsubsection subsubsec_file_alternate_drivers_mem The Memory (aka Core) Driver + * There are several situations in which it is reasonable, sometimes even required, to maintain a file + * entirely in system memory. You might want to do so if, for example, either of the following + * conditions apply: + *
  • Performance requirements are so stringent that disk latency is a limiting factor
  • + *
  • You are working with small, temporary files that will not be retained and, thus, + * need not be written to storage media
+ * + * The Memory driver, #H5FD_CORE, provides a mechanism for creating and managing such in memory files. + * The functions #H5Pset_fapl_core and #H5Pget_fapl_core manage file access + * properties. See the example below. + * + * Managing file access for in-memory files + * \code + * herr_t H5Pset_fapl_core (hid_t access_properties, size_t block_size, hbool_t backing_store) + * herr_t H5Pget_fapl_core (hid_t access_properties, size_t *block_size), hbool_t *backing_store) + * \endcode + * + * #H5Pset_fapl_core sets the file access property list to use the Memory driver; any previously + * defined driver properties are erased from the property list. + * + * Memory for the file will always be allocated in units of the specified block_size. + * + * The backing_store Boolean flag is set when the in-memory file is created. + * backing_store indicates whether to write the file contents to disk when the file is closed. If + * backing_store is set to 1 (TRUE), the file contents are flushed to a file with the same name as the + * in-memory file when the file is closed or access to the file is terminated in memory. If + * backing_store is set to 0 (FALSE), the file is not saved. + * + * The application is allowed to open an existing file with the #H5FD_CORE driver. While using + * #H5Fopen to open an existing file, if backing_store is set to 1 and the flag for #H5Fopen is set to + * #H5F_ACC_RDWR, changes to the file contents will be saved to the file when the file is closed. + * If backing_store is set to 0 and the flag for #H5Fopen is set to #H5F_ACC_RDWR, changes to the + * file contents will be lost when the file is closed. If the flag for #H5Fopen is set to + * #H5F_ACC_RDONLY, no change to the file will be allowed either in memory or on file. + * + * If the file access property list is set to use the Memory driver, #H5Pget_fapl_core will return + * block_size and backing_store with the relevant file access property settings. + * + * Note the following important points regarding in-memory files: + *
  • Local temporary files are created and accessed directly from memory without ever + * being written to disk
  • + *
  • Total file size must not exceed the available virtual memory
  • + *
  • Only one HDF5 file identifier can be opened for the file, the identifier returned by + * #H5Fcreate or #H5Fopen
  • + *
  • The changes to the file will be discarded when access is terminated unless + * backing_store is set to 1
+ * + * Additional parameters may be added to these functions in the future. + * + * @see + * HDF5 File Image Operations + * section for information on more advanced usage of the Memory file driver, and + * @see + * Modified Region Writes + * section for information on how to set write operations so that only modified regions are written + * to storage. + * + * \subsubsection subsubsec_file_alternate_drivers_family The Family Driver + * HDF5 files can become quite large, and this can create problems on systems that do not support + * files larger than 2 gigabytes. The HDF5 file family mechanism is designed to solve the problems + * this creates by splitting the HDF5 file address space across several smaller files. This structure + * does not affect how metadata and raw data are stored: they are mixed in the address space just as + * they would be in a single, contiguous file. + * + * HDF5 applications access a family of files via the Family driver, #H5FD_FAMILY. The + * functions #H5Pset_fapl_family and #H5Pget_fapl_family are used to manage file family + * properties. See the example below. + * + * Managing file family properties + * \code + * herr_t H5Pset_fapl_family (hid_t fapl_id, + * hsize_t memb_size, hid_t member_properties) + * herr_t H5Pget_fapl_family (hid_t fapl_id, + * hsize_t *memb_size, hid_t *member_properties) + * \endcode + * + * Each member of the family is the same logical size though the size and disk storage reported by + * file system listing tools may be substantially smaller. Examples of file system listing tools are + * \code + * ls -l + * \endcode + * on a Unix system or the detailed folder listing on an Apple or Microsoft Windows + * system. The name passed to #H5Fcreate or #H5Fopen should include a printf(3c)-style integer + * format specifier which will be replaced with the family member number. The first family + * member is numbered zero (0). + * + * #H5Pset_fapl_family sets the access properties to use the Family driver; any previously defined + * driver properties are erased from the property list. member_properties will serve as the file + * access property list for each member of the file family. memb_size specifies the logical size, in + * bytes, of each family member. memb_size is used only when creating a new file or truncating an + * existing file; otherwise the member size is determined by the size of the first member of the + * family being opened. Note: If the size of the off_t type is four bytes, the maximum family + * member size is usually 2^31-1 because the byte at offset 2,147,483,647 is generally inaccessible. + * + * #H5Pget_fapl_family is used to retrieve file family properties. If the file access property list is set + * to use the Family driver, member_properties will be returned with a pointer to a copy of the + * appropriate member access property list. If memb_size is non-null, it will contain the logical + * size, in bytes, of family members. + * + * Additional parameters may be added to these functions in the future. + * + *

Unix Tools and an HDF5 Utility

+ * It occasionally becomes necessary to repartition a file family. A command-line utility for this + * purpose, h5repart, is distributed with the HDF5 library. + * + * \code + * h5repart [-v] [-b block_size[suffix]] [-m member_size[suffix]] source destination + * \endcode + * + * h5repart repartitions an HDF5 file by copying the source file or file family to the destination file + * or file family, preserving holes in the underlying UNIX files. Families are used for the source + * and/or destination if the name includes a printf-style integer format such as %d. The -v switch + * prints input and output file names on the standard error stream for progress monitoring, -b sets + * the I/O block size (the default is 1KB), and -m sets the output member size if the destination is a + * family name (the default is 1GB). block_size and member_size may be suffixed with the letters + * g, m, or k for GB, MB, or KB respectively. + * + * The h5repart utility is described on the Tools page of the HDF5 Reference Manual. + * + * An existing HDF5 file can be split into a family of files by running the file through split(1) on a + * UNIX system and numbering the output files. However, the HDF5 Library is lazy about + * extending the size of family members, so a valid file cannot generally be created by + * concatenation of the family members. + * + * Splitting the file and rejoining the segments by concatenation (split(1) and cat(1) on UNIX + * systems) does not generate files with holes; holes are preserved only through the use of h5repart. + * + * \subsubsection subsubsec_file_alternate_drivers_multi The Multi Driver + * In some circumstances, it is useful to separate metadata from raw data and some types of + * metadata from other types of metadata. Situations that would benefit from use of the Multi driver + * include the following: + *
  • In networked situations where the small metadata files can be kept on local disks but + * larger raw data files must be stored on remote media
  • + *
  • In cases where the raw data is extremely large
  • + *
  • In situations requiring frequent access to metadata held in RAM while the raw data + * can be efficiently held on disk
+ * + * In either case, access to the metadata is substantially easier with the smaller, and possibly more + * localized, metadata files. This often results in improved application performance. + * + * The Multi driver, #H5FD_MULTI, provides a mechanism for segregating raw data and different + * types of metadata into multiple files. The functions #H5Pset_fapl_multi and + * #H5Pget_fapl_multi are used to manage access properties for these multiple files. See the example + * below. + * + * Managing access properties for multiple files + * \code + * herr_t H5Pset_fapl_multi (hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_fapl, + * const char * const *memb_name, const haddr_t *memb_addr, + * hbool_t relax) + * herr_t H5Pget_fapl_multi (hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_fapl, + * const char **memb_name, const haddr_t *memb_addr, hbool_t *relax) + * \endcode + * + * #H5Pset_fapl_multi sets the file access properties to use the Multi driver; any previously defined + * driver properties are erased from the property list. With the Multi driver invoked, the application + * will provide a base name to #H5Fopen or #H5Fcreate. The files will be named by that base name as + * modified by the rule indicated in memb_name. File access will be governed by the file access + * property list memb_properties. + * + * See #H5Pset_fapl_multi and #H5Pget_fapl_multi in the HDF5 Reference Manual for descriptions + * of these functions and their usage. + * + * Additional parameters may be added to these functions in the future. + * + * \subsubsection subsubsec_file_alternate_drivers_split The Split Driver + * The Split driver, H5FD_SPLIT, is a limited case of the Multi driver where only two files are + * created. One file holds metadata, and the other file holds raw data. + * The function #H5Pset_fapl_split is used to manage Split file access properties. See the example + * below. + * + * Managing access properties for split files + * \code + * herr_t H5Pset_fapl_split (hid_t access_properties, const char *meta_extension, + * hid_t meta_properties,const char *raw_extension, hid_t raw_properties) + * \endcode + * + * #H5Pset_fapl_split sets the file access properties to use the Split driver; any previously defined + * driver properties are erased from the property list. + * + * With the Split driver invoked, the application will provide a base file name such as file_name to + * #H5Fcreate or #H5Fopen. The metadata and raw data files in storage will then be named + * file_name.meta_extension and file_name.raw_extension, respectively. For example, if + * meta_extension is defined as .meta and raw_extension is defined as .raw, the final filenames will + * be file_name.meta and file_name.raw. + * + * Each file can have its own file access property list. This allows the creative use of other lowlevel + * file drivers. For instance, the metadata file can be held in RAM and accessed via the + * Memory driver while the raw data file is stored on disk and accessed via the POSIX driver. + * Metadata file access will be governed by the file access property list in meta_properties. Raw + * data file access will be governed by the file access property list in raw_properties. + * + * Additional parameters may be added to these functions in the future. Since there are no + * additional variable settings associated with the Split driver, there is no H5Pget_fapl_split + * function. + * + * \subsubsection subsubsec_file_alternate_drivers_par The Parallel Driver + * Parallel environments require a parallel low-level driver. HDF5's default driver for parallel + * systems is called the Parallel driver, #H5FD_MPIO. This driver uses the MPI standard for both + * communication and file I/O. + * + * The functions #H5Pset_fapl_mpio and #H5Pget_fapl_mpio are used to manage file access + * properties for the #H5FD_MPIO driver. See the example below. + * + * Managing parallel file access properties + * \code + * herr_t H5Pset_fapl_mpio (hid_t fapl_id, MPI_Comm comm, MPI_info info) + * herr_t H5Pget_fapl_mpio (hid_t fapl_id, MPI_Comm *comm, MPI_info *info) + * \endcode + * + * The file access properties managed by #H5Pset_fapl_mpio and retrieved by + * #H5Pget_fapl_mpio are the MPI communicator, comm, and the MPI info object, info. comm and + * info are used for file open. info is an information object much like an HDF5 property list. Both + * are defined in MPI_FILE_OPEN of MPI-2. + * + * The communicator and the info object are saved in the file access property list fapl_id. + * fapl_id can then be passed to MPI_FILE_OPEN to create and/or open the file. + * + * #H5Pset_fapl_mpio and #H5Pget_fapl_mpio are available only in the parallel HDF5 Library and + * are not collective functions. The Parallel driver is available only in the parallel HDF5 Library. + * + * Additional parameters may be added to these functions in the future. + * + * \subsection subsec_file_examples Code Examples for Opening and Closing Files + * \subsubsection subsubsec_file_examples_trunc Example Using the H5F_ACC_TRUNC Flag + * The following example uses the #H5F_ACC_TRUNC flag when it creates a new file. The default + * file creation and file access properties are also used. Using #H5F_ACC_TRUNC means the + * function will look for an existing file with the name specified by the function. In this case, that + * name is FILE. If the function does not find an existing file, it will create one. If it does find an + * existing file, it will empty the file in preparation for a new set of data. The identifier for the + * "new" file will be passed back to the application program. + * For more information, @see @ref subsec_file_access_modes. + * + * Creating a file with default creation and access properties + * \code + * hid_t file; // identifier + * + * // Create a new file using H5F_ACC_TRUNC access, default + * // file creation properties, and default file access + * // properties. + * file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + * + * // Close the file. + * status = H5Fclose(file); + * \endcode + * + * \subsubsection subsubsec_file_examples_props Example with the File Creation Property List + * The example below shows how to create a file with 64-bit object offsets and lengths. + * + * Creating a file with 64-bit offsets + * \code + * hid_t create_plist; + * hid_t file_id; + * + * create_plist = H5Pcreate(H5P_FILE_CREATE); + * H5Pset_sizes(create_plist, 8, 8); + * file_id = H5Fcreate(“test.h5”, H5F_ACC_TRUNC, create_plist, H5P_DEFAULT); + * . + * . + * . + * + * H5Fclose(file_id); + * \endcode + * + * \subsubsection subsubsec_file_examples_access Example with the File Access Property List + * This example shows how to open an existing file for independent datasets access by MPI parallel + * I/O: + * + * Opening an existing file for parallel I/O + * \code + * hid_t access_plist; + * hid_t file_id; + * + * access_plist = H5Pcreate(H5P_FILE_ACCESS); + * H5Pset_fapl_mpi(access_plist, MPI_COMM_WORLD, MPI_INFO_NULL); + * + * // H5Fopen must be called collectively + * file_id = H5Fopen(“test.h5”, H5F_ACC_RDWR, access_plist); + * . + * . + * . + * + * // H5Fclose must be called collectively + * H5Fclose(file_id); + * \endcode + * + * \subsection subsec_file_multiple Working with Multiple HDF5 Files + * Multiple HDF5 files can be associated so that the files can be worked with as though all the + * information is in a single HDF5 file. A temporary association can be set up by means of the + * #H5Fmount function. A permanent association can be set up by means of the external link + * function #H5Lcreate_external. + * + * The purpose of this section is to describe what happens when the #H5Fmount function is used to + * mount one file on another. + * + * When a file is mounted on another, the mounted file is mounted at a group, and the root group of + * the mounted file takes the place of that group until the mounted file is unmounted or until the + * files are closed. + * + * The figure below shows two files before one is mounted on the other. File1 has two groups and + * three datasets. The group that is the target of the A link has links, Z and Y, to two of the datasets. + * The group that is the target of the B link has a link, W, to the other dataset. File2 has three + * groups and three datasets. The groups in File2 are the targets of the AA, BB, and CC links. The + * datasets in File2 are the targets of the ZZ, YY, and WW links. + * + * + * + * + * + *
+ * \image html Files_fig3.gif "Two separate files" + *
+ * + * The figure below shows the two files after File2 has been mounted File1 at the group that is the + * target of the B link. + * + * + * + * + * + *
+ * \image html Files_fig4.gif "File2 mounted on File1" + *
+ * + * Note: In the figure above, the dataset that is the target of the W link is not shown. That dataset is + * masked by the mounted file. + * + * If a file is mounted on a group that has members, those members are hidden until the mounted + * file is unmounted. There are two ways around this if you need to work with a group member. + * One is to mount the file on an empty group. Another is to open the group member before you + * mount the file. Opening the group member will return an identifier that you can use to locate the + * group member. + * + * The example below shows how #H5Fmount might be used to mount File2 onto File1. + * + * Using H5Fmount + * \code + * status = H5Fmount(loc_id, "/B", child_id, plist_id) + * \endcode + * + * Note: In the code example above, loc_id is the file identifier for File1, /B is the link path to the + * group where File2 is mounted, child_id is the file identifier for File2, and plist_id is a property + * list identifier. + * For more information, @see @ref sec_group. + * + * See the entries for #H5Fmount, #H5Funmount, and #H5Lcreate_external in the HDF5 Reference Manual. + * + * Previous Chapter \ref sec_program - Next Chapter \ref sec_group + * + */ + +/** + * \defgroup H5F Files (H5F) * * Use the functions in this module to manage HDF5 files. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Fpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Fpkg.h index 575cc0b586..ead38721fd 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Fpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Fpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Thursday, September 28, 2000 - * - * Purpose: This file contains declarations which are visible only within - * the H5F package. Source files outside the H5F package should - * include H5Fprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5F package. Source files outside the H5F package should + * include H5Fprivate.h instead. */ #if !(defined H5F_FRIEND || defined H5F_MODULE) #error "Do not include this file outside the H5F package!" @@ -456,7 +452,7 @@ H5_DLL herr_t H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag); /* External file cache routines */ H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); -H5_DLL H5F_t *H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); +H5_DLL H5F_t *H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); H5_DLL unsigned H5F__efc_max_nfiles(H5F_efc_t *efc); H5_DLL herr_t H5F__efc_release(H5F_efc_t *efc); H5_DLL herr_t H5F__efc_destroy(H5F_efc_t *efc); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Fprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Fprivate.h index 01fa950cb2..aa62800fa4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Fprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Fprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -18,304 +17,25 @@ #ifndef H5Fprivate_H #define H5Fprivate_H -/* Early typedefs to avoid circular dependencies */ +/* This definition has to be early, before the other private headers, + * due to circular dependencies. + */ typedef struct H5F_t H5F_t; /* Include package's public header */ #include "H5Fpublic.h" /* Private headers needed by this file */ -#include "H5MMprivate.h" /* Memory management */ #include "H5FDprivate.h" /* File drivers */ #ifdef H5_HAVE_PARALLEL -#include "H5Pprivate.h" /* Property lists */ -#endif /* H5_HAVE_PARALLEL */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5Pprivate.h" /* Property lists */ +#endif #include "H5VLprivate.h" /* Virtual Object Layer */ /**************************/ /* Library Private Macros */ /**************************/ -/* - * Encode and decode macros for file meta-data. - * Currently, all file meta-data is little-endian. - */ - -#define INT16ENCODE(p, i) \ - { \ - *(p) = (uint8_t)((unsigned)(i)&0xff); \ - (p)++; \ - *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); \ - (p)++; \ - } - -#define UINT16ENCODE(p, i) \ - { \ - *(p) = (uint8_t)((unsigned)(i)&0xff); \ - (p)++; \ - *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); \ - (p)++; \ - } - -#define INT32ENCODE(p, i) \ - { \ - *(p) = (uint8_t)((uint32_t)(i)&0xff); \ - (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 8) & 0xff); \ - (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 16) & 0xff); \ - (p)++; \ - *(p) = (uint8_t)(((uint32_t)(i) >> 24) & 0xff); \ - (p)++; \ - } - -#define UINT32ENCODE(p, i) \ - { \ - *(p) = (uint8_t)((i)&0xff); \ - (p)++; \ - *(p) = (uint8_t)(((i) >> 8) & 0xff); \ - (p)++; \ - *(p) = (uint8_t)(((i) >> 16) & 0xff); \ - (p)++; \ - *(p) = (uint8_t)(((i) >> 24) & 0xff); \ - (p)++; \ - } - -/* Encode an unsigned integer into a variable-sized buffer */ -/* (Assumes that the high bits of the integer are zero) */ -#define ENCODE_VAR(p, typ, n, l) \ - { \ - typ _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t *)(p); \ - \ - for (_i = 0; _i < l; _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - (p) = (uint8_t *)(p) + l; \ - } - -/* Encode a 32-bit unsigned integer into a variable-sized buffer */ -/* (Assumes that the high bits of the integer are zero) */ -#define UINT32ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint32_t, n, l) - -#define INT64ENCODE(p, n) \ - { \ - int64_t _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t *)(p); \ - \ - for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - for (/*void*/; _i < 8; _i++) \ - *_p++ = (uint8_t)((n) < 0 ? 0xff : 0); \ - (p) = (uint8_t *)(p) + 8; \ - } - -#define UINT64ENCODE(p, n) \ - { \ - uint64_t _n = (n); \ - size_t _i; \ - uint8_t *_p = (uint8_t *)(p); \ - \ - for (_i = 0; _i < sizeof(uint64_t); _i++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - for (/*void*/; _i < 8; _i++) \ - *_p++ = 0; \ - (p) = (uint8_t *)(p) + 8; \ - } - -/* Encode a 64-bit unsigned integer into a variable-sized buffer */ -/* (Assumes that the high bits of the integer are zero) */ -#define UINT64ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint64_t, n, l) - -/* Encode a 64-bit unsigned integer and its length into a variable-sized buffer */ -/* (Assumes that the high bits of the integer are zero) */ -#define UINT64ENCODE_VARLEN(p, n) \ - { \ - uint64_t __n = (uint64_t)(n); \ - unsigned _s = H5VM_limit_enc_size(__n); \ - \ - *(p)++ = (uint8_t)_s; \ - UINT64ENCODE_VAR(p, __n, _s); \ - } - -#define H5_ENCODE_UNSIGNED(p, n) \ - { \ - HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ - UINT32ENCODE(p, n) \ - } - -/* Assumes the endianness of uint64_t is the same as double */ -#define H5_ENCODE_DOUBLE(p, n) \ - { \ - uint64_t _n; \ - size_t _u; \ - uint8_t *_p = (uint8_t *)(p); \ - \ - HDcompile_assert(sizeof(double) == 8); \ - HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ - H5MM_memcpy(&_n, &n, sizeof(double)); \ - for (_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ - *_p++ = (uint8_t)(_n & 0xff); \ - (p) = (uint8_t *)(p) + 8; \ - } - -/* DECODE converts little endian bytes pointed by p to integer values and store - * it in i. For signed values, need to do sign-extension when converting - * the last byte which carries the sign bit. - * The macros does not require i be of a certain byte sizes. It just requires - * i be big enough to hold the intended value range. E.g. INT16DECODE works - * correctly even if i is actually a 64bit int like in a Cray. - */ - -#define INT16DECODE(p, i) \ - { \ - (i) = (int16_t)((*(p)&0xff)); \ - (p)++; \ - (i) |= (int16_t)(((*(p)&0xff) << 8) | ((*(p)&0x80) ? ~0xffff : 0x0)); \ - (p)++; \ - } - -#define UINT16DECODE(p, i) \ - { \ - (i) = (uint16_t)(*(p)&0xff); \ - (p)++; \ - (i) |= (uint16_t)((*(p)&0xff) << 8); \ - (p)++; \ - } - -#define INT32DECODE(p, i) \ - { \ - (i) = ((int32_t)(*(p)&0xff)); \ - (p)++; \ - (i) |= ((int32_t)(*(p)&0xff) << 8); \ - (p)++; \ - (i) |= ((int32_t)(*(p)&0xff) << 16); \ - (p)++; \ - (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | ((*(p)&0x80) ? ~0xffffffffULL : 0x0ULL))); \ - (p)++; \ - } - -#define UINT32DECODE(p, i) \ - { \ - (i) = (uint32_t)(*(p)&0xff); \ - (p)++; \ - (i) |= ((uint32_t)(*(p)&0xff) << 8); \ - (p)++; \ - (i) |= ((uint32_t)(*(p)&0xff) << 16); \ - (p)++; \ - (i) |= ((uint32_t)(*(p)&0xff) << 24); \ - (p)++; \ - } - -/* Decode a variable-sized buffer */ -/* (Assumes that the high bits of the integer will be zero) */ -#define DECODE_VAR(p, n, l) \ - { \ - size_t _i; \ - \ - n = 0; \ - (p) += l; \ - for (_i = 0; _i < l; _i++) \ - n = (n << 8) | *(--p); \ - (p) += l; \ - } - -/* Decode a variable-sized buffer into a 32-bit unsigned integer */ -/* (Assumes that the high bits of the integer will be zero) */ -#define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) - -#define INT64DECODE(p, n) \ - { \ - /* WE DON'T CHECK FOR OVERFLOW! */ \ - size_t _i; \ - \ - n = 0; \ - (p) += 8; \ - for (_i = 0; _i < sizeof(int64_t); _i++) \ - n = (n << 8) | *(--p); \ - (p) += 8; \ - } - -#define UINT64DECODE(p, n) \ - { \ - /* WE DON'T CHECK FOR OVERFLOW! */ \ - size_t _i; \ - \ - n = 0; \ - (p) += 8; \ - for (_i = 0; _i < sizeof(uint64_t); _i++) \ - n = (n << 8) | *(--p); \ - (p) += 8; \ - } - -/* Decode a variable-sized buffer into a 64-bit unsigned integer */ -/* (Assumes that the high bits of the integer will be zero) */ -#define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) - -/* Decode a 64-bit unsigned integer and its length from a variable-sized buffer */ -/* (Assumes that the high bits of the integer will be zero) */ -#define UINT64DECODE_VARLEN(p, n) \ - { \ - unsigned _s = *(p)++; \ - \ - UINT64DECODE_VAR(p, n, _s); \ - } - -#define H5_DECODE_UNSIGNED(p, n) \ - { \ - HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ - UINT32DECODE(p, n) \ - } - -/* Assumes the endianness of uint64_t is the same as double */ -#define H5_DECODE_DOUBLE(p, n) \ - { \ - uint64_t _n; \ - size_t _u; \ - \ - HDcompile_assert(sizeof(double) == 8); \ - HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ - _n = 0; \ - (p) += 8; \ - for (_u = 0; _u < sizeof(uint64_t); _u++) \ - _n = (_n << 8) | *(--p); \ - H5MM_memcpy(&(n), &_n, sizeof(double)); \ - (p) += 8; \ - } - -/* clang-format off */ -/* Address-related macros */ -#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \ - HADDR_UNDEF==(X)+(haddr_t)(Z) || \ - (X)+(haddr_t)(Z)<(X)) -#define H5F_addr_defined(X) ((X)!=HADDR_UNDEF) -/* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making - * certain that X is not HADDR_UNDEF and then checking that X equals Y - */ -#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \ - (X)==(Y)) -#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y))) -#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)<(Y)) -#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)<=(Y)) -#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)>(Y)) -#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \ - (Y)!=HADDR_UNDEF && \ - (X)>=(Y)) -#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \ - (H5F_addr_lt((X), (Y)) ? -1 : 1)) -#define H5F_addr_pow2(N) ((haddr_t)1<<(N)) -#define H5F_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \ - ((O1) >= (O2) && (O1) < ((O2) + (L2)))) -/* clang-format on */ - /* If the module using this macro is allowed access to the private variables, access them directly */ #ifdef H5F_MODULE #define H5F_LOW_BOUND(F) ((F)->shared->low_bound) @@ -363,7 +83,7 @@ typedef struct H5F_t H5F_t; #define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared) #define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL) #define H5F_USE_TMP_SPACE(F) ((F)->shared->fs.use_tmp_space) -#define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->fs.tmp_addr, (ADDR))) +#define H5F_IS_TMP_ADDR(F, ADDR) (H5_addr_le((F)->shared->fs.tmp_addr, (ADDR))) #ifdef H5_HAVE_PARALLEL #define H5F_COLL_MD_READ(F) ((F)->shared->coll_md_read) #endif /* H5_HAVE_PARALLEL */ @@ -446,65 +166,8 @@ typedef struct H5F_t H5F_t; #endif /* H5F_MODULE */ /* Macros to encode/decode offset/length's for storing in the file */ -#define H5F_ENCODE_OFFSET(f, p, o) \ - switch (H5F_SIZEOF_ADDR(f)) { \ - case 4: \ - UINT32ENCODE(p, o); \ - break; \ - case 8: \ - UINT64ENCODE(p, o); \ - break; \ - case 2: \ - UINT16ENCODE(p, o); \ - break; \ - } - -#define H5F_DECODE_OFFSET(f, p, o) \ - switch (H5F_SIZEOF_ADDR(f)) { \ - case 4: \ - UINT32DECODE(p, o); \ - break; \ - case 8: \ - UINT64DECODE(p, o); \ - break; \ - case 2: \ - UINT16DECODE(p, o); \ - break; \ - } - -#define H5F_ENCODE_LENGTH_LEN(p, l, s) \ - switch (s) { \ - case 4: \ - UINT32ENCODE(p, l); \ - break; \ - case 8: \ - UINT64ENCODE(p, l); \ - break; \ - case 2: \ - UINT16ENCODE(p, l); \ - break; \ - default: \ - HDassert("bad sizeof size" && 0); \ - } - -#define H5F_ENCODE_LENGTH(f, p, l) H5F_ENCODE_LENGTH_LEN(p, l, H5F_SIZEOF_SIZE(f)) - -#define H5F_DECODE_LENGTH_LEN(p, l, s) \ - switch (s) { \ - case 4: \ - UINT32DECODE(p, l); \ - break; \ - case 8: \ - UINT64DECODE(p, l); \ - break; \ - case 2: \ - UINT16DECODE(p, l); \ - break; \ - default: \ - HDassert("bad sizeof size" && 0); \ - } - -#define H5F_DECODE_LENGTH(f, p, l) DECODE_VAR(p, l, H5F_SIZEOF_SIZE(f)) +#define H5F_ENCODE_LENGTH(f, p, l) H5_ENCODE_LENGTH_LEN(p, l, H5F_SIZEOF_SIZE(f)) +#define H5F_DECODE_LENGTH(f, p, l) H5_DECODE_LENGTH_LEN(p, l, H5F_SIZEOF_SIZE(f)) /* * Macros that check for overflows. These are somewhat dangerous to fiddle @@ -630,7 +293,7 @@ typedef struct H5F_t H5F_t; #define H5F_SIGNATURE "\211HDF\r\n\032\n" #define H5F_SIGNATURE_LEN 8 -/* Version #'s of the major components of the file format */ +/* Version number's of the major components of the file format */ #define HDF5_SUPERBLOCK_VERSION_DEF 0 /* The default super block format */ #define HDF5_SUPERBLOCK_VERSION_1 1 /* Version with non-default B-tree 'K' value */ #define HDF5_SUPERBLOCK_VERSION_2 2 /* Revised version with superblock extension and checksum */ @@ -907,6 +570,7 @@ H5_DLL haddr_t H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type); H5_DLL haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type); H5_DLL herr_t H5F_shared_get_file_driver(const H5F_shared_t *f_sh, H5FD_t **file_handle); H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle); +H5_DLL hbool_t H5F_has_vector_select_io(const H5F_t *f, hbool_t is_write); /* File mounting routines */ H5_DLL herr_t H5F_mount(const struct H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id); @@ -940,7 +604,6 @@ H5_DLL herr_t H5F_shared_vector_write(H5F_shared_t *f_sh, uint32_t count, H5FD_m /* Functions that flush or evict */ H5_DLL herr_t H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag); -H5_DLL herr_t H5F_evict_tagged_metadata(H5F_t *f, haddr_t tag); /* Functions that verify a piece of metadata with checksum */ H5_DLL herr_t H5F_get_checksums(const uint8_t *buf, size_t chk_size, uint32_t *s_chksum, uint32_t *c_chksum); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Fpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Fpublic.h index 6559bfaead..d326998677 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Fpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Fpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -17,10 +16,9 @@ #ifndef H5Fpublic_H #define H5Fpublic_H -/* Public header files needed by this file */ -#include "H5public.h" -#include "H5ACpublic.h" -#include "H5Ipublic.h" +#include "H5public.h" /* Generic Functions */ +#include "H5ACpublic.h" /* Metadata Cache */ +#include "H5Ipublic.h" /* Identifiers */ /* When this header is included from a private header, don't make calls to H5check() */ #undef H5CHECK @@ -126,17 +124,17 @@ typedef enum H5F_close_degree_t { //! typedef struct H5F_info2_t { struct { - unsigned version; /**< Superblock version # */ + unsigned version; /**< Superblock version number */ hsize_t super_size; /**< Superblock size */ hsize_t super_ext_size; /**< Superblock extension size */ } super; struct { - unsigned version; /**< Version # of file free space management */ + unsigned version; /**< Version number of file free space management */ hsize_t meta_size; /**< Free space manager metadata size */ hsize_t tot_space; /**< Amount of free space in the file */ } free; struct { - unsigned version; /**< Version # of shared object header info */ + unsigned version; /**< Version number of shared object header info */ hsize_t hdr_size; /**< Shared object header message header size */ H5_ih_info_t msgs_info; /**< Shared object header message index & heap size */ } sohm; @@ -357,8 +355,12 @@ H5_DLL hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_ * \ingroup ASYNC * \async_variant_of{H5Fcreate} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Fcreate_async(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t es_id); +#endif /** * \ingroup H5F * @@ -394,7 +396,7 @@ H5_DLL hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigne * opened. * * The \p fapl_id parameter specifies the file access property list. - * Use of #H5P_DEFAULT specifies that default I/O access properties + * The use of #H5P_DEFAULT specifies that default I/O access properties * are to be used. * * The \p flags parameter specifies whether the file will be opened in @@ -457,8 +459,12 @@ H5_DLL hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id); * \ingroup ASYNC * \async_variant_of{H5Fopen} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, const char *filename, unsigned flags, hid_t access_plist, hid_t es_id); +#else +H5_DLL hid_t H5Fopen_async(const char *filename, unsigned flags, hid_t access_plist, hid_t es_id); +#endif /** * \ingroup H5F * @@ -490,8 +496,12 @@ H5_DLL hid_t H5Freopen(hid_t file_id); * \ingroup ASYNC * \async_variant_of{H5Freopen} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, hid_t es_id); +#else +H5_DLL hid_t H5Freopen_async(hid_t file_id, hid_t es_id); +#endif /** * \ingroup H5F * @@ -518,7 +528,7 @@ H5_DLL hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigne * \snippet H5F_examples.c flush * * \attention HDF5 does not possess full control over buffering. H5Fflush() - * flushes the internal HDF5 buffers then asks the operating system + * flushes the internal HDF5 buffers and then asks the operating system * (the OS) to flush the system buffers for the open files. After * that, the OS is responsible for ensuring that the data is * actually flushed to disk. @@ -530,8 +540,12 @@ H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope); * \ingroup ASYNC * \async_variant_of{H5Fflush} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id, H5F_scope_t scope, hid_t es_id); +#else +H5_DLL herr_t H5Fflush_async(hid_t object_id, H5F_scope_t scope, hid_t es_id); +#endif /** * \ingroup H5F * @@ -552,7 +566,7 @@ H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigne * \snippet H5F_examples.c minimal * * \note \Bold{Delayed close:} Note the following deviation from the - * above-described behavior. If H5Fclose() is called for a file but one + * above-described behavior. If H5Fclose() is called for a file, but one * or more objects within the file remain open, those objects will remain * accessible until they are individually closed. Thus, if the dataset * \c data_sample is open when H5Fclose() is called for the file @@ -561,7 +575,7 @@ H5_DLL herr_t H5Fflush_async(const char *app_file, const char *app_func, unsigne * automatically closed once all objects in the file have been closed.\n * Be warned, however, that there are circumstances where it is not * possible to delay closing a file. For example, an MPI-IO file close is - * a collective call; all of the processes that opened the file must + * a collective call; all of the processes that open the file must * close it collectively. The file cannot be closed at some time in the * future by each process in an independent fashion. Another example is * that an application using an AFS token-based file access privilege may @@ -581,8 +595,12 @@ H5_DLL herr_t H5Fclose(hid_t file_id); * \ingroup ASYNC * \async_variant_of{H5Fclose} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, hid_t es_id); +#else +H5_DLL herr_t H5Fclose_async(hid_t file_id, hid_t es_id); +#endif /** * \ingroup H5F * @@ -938,7 +956,7 @@ H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); * \file_id * \param[out] buf_ptr Pointer to the buffer into which the image of the * HDF5 file is to be copied. If \p buf_ptr is NULL, - * no data will be copied but the function’s return value + * no data will be copied but the function's return value * will still indicate the buffer size required (or a * negative value on error). * \param[out] buf_len Size of the supplied buffer @@ -955,7 +973,7 @@ H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment); * file image. So if the file size is unknown, it can be safely * determined with an initial H5Fget_file_image() call with buf_ptr * set to NULL. The file image can then be retrieved with a second - * H5Fget_file_image() call with \p buf_len set to the initial call’s + * H5Fget_file_image() call with \p buf_len set to the initial call's * return value. * * While the current file size can also be retrieved with @@ -1153,7 +1171,7 @@ H5_DLL ssize_t H5Fget_name(hid_t obj_id, char *name, size_t size); /** * \ingroup H5F * - * \brief Retrieves name of file to which object belongs + * \brief Retrieves global file information * * \fgdta_obj_id * \param[out] file_info Buffer for global file information @@ -1301,7 +1319,7 @@ H5_DLL herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *i * on a system that is not atomic. * \li Turn off usage of the library's accumulator to avoid possible * ordering problem on a system that is not atomic. - * \li Perform a flush of the file’s data buffers and metadata to set + * \li Perform a flush of the file's data buffers and metadata to set * a consistent state for starting SWMR write operations. * * Library objects are groups, datasets, and committed datatypes. For @@ -1340,7 +1358,7 @@ H5_DLL herr_t H5Fstart_swmr_write(hid_t file_id); * \snippet this H5F_sect_info_t_snip * * This routine retrieves free-space section information for \p nsects - * sections or at most the maximum number of sections in the specified + * sections or, at most, the maximum number of sections in the specified * free-space manager. If the number of sections is not known, a * preliminary H5Fget_free_sections() call can be made by setting \p * sect_info to NULL and the total number of free-space sections for @@ -1371,7 +1389,7 @@ H5_DLL ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects * \return \herr_t * * \details H5Fclear_elink_file_cache() evicts all the cached child files in - * the specified file’s external file cache, causing them to be closed + * the specified file's external file cache, causing them to be closed * if there is nothing else holding them open. * * H5Fclear_elink_file_cache() does not close the cache itself; @@ -1642,7 +1660,7 @@ H5_DLL herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t * file_id. This setting is used to inform the library to create * minimized dataset object headers when \c TRUE. * - * The setting's value is returned in the boolean pointer minimize. + * The setting's value is returned in the boolean pointer minimized. * * \since 1.10.5 * @@ -1826,7 +1844,7 @@ typedef struct H5F_info1_t { /** * \ingroup H5F * - * \brief Retrieves name of file to which object belongs + * \brief Retrieves global file information * * \fgdta_obj_id * \param[out] file_info Buffer for global file information @@ -1868,7 +1886,7 @@ H5_DLL herr_t H5Fget_info1(hid_t obj_id, H5F_info1_t *file_info); /** * \ingroup H5F * - * \brief Sets thelatest version of the library to be used for writing objects + * \brief Sets the latest version of the library to be used for writing objects * * \file_id * \param[in] latest_format Latest format flag diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Gmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Gmodule.h index 93e7184a53..4c435eb2e6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Gmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Gmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5G package. Including this header means that the source file - * is part of the H5G package. + * Purpose: This file contains declarations which define macros for the + * H5G package. Including this header means that the source file + * is part of the H5G package. */ #ifndef H5Gmodule_H #define H5Gmodule_H @@ -28,7 +25,836 @@ #define H5_MY_PKG H5G #define H5_MY_PKG_ERR H5E_SYM -/** \defgroup H5G H5G +/** \page H5G_UG HDF5 Groups + * + * \section sec_group HDF5 Groups + * \subsection subsec_group_intro Introduction + * As suggested by the name Hierarchical Data Format, an HDF5 file is hierarchically structured. + * The HDF5 group and link objects implement this hierarchy. + * + * In the simple and most common case, the file structure is a tree structure; in the general case, the + * file structure may be a directed graph with a designated entry point. The tree structure is very + * similar to the file system structures employed on UNIX systems, directories and files, and on + * Apple and Microsoft Windows systems, folders and files. HDF5 groups are analogous + * to the directories and folders; HDF5 datasets are analogous to the files. + * + * The one very important difference between the HDF5 file structure and the above-mentioned file + * system analogs is that HDF5 groups are linked as a directed graph, allowing circular references; + * the file systems are strictly hierarchical, allowing no circular references. The figures below + * illustrate the range of possibilities. + * + * In the first figure below, the group structure is strictly hierarchical, identical to the file system + * analogs. + * + * In the next two figures below, the structure takes advantage of the directed graph's allowance of + * circular references. In the second figure, GroupA is not only a member of the root group, /, but a + * member of GroupC. Since Group C is a member of Group B and Group B is a member of Group + * A, Dataset1 can be accessed by means of the circular reference /Group A/Group B/Group + * C/Group A/Dataset1. The third figure below illustrates an extreme case in which GroupB is a + * member of itself, enabling a reference to a member dataset such as /Group A/Group B/Group + * B/Group B/Dataset2. + * + * + * + * + * + *
+ * \image html Groups_fig1.gif "A file with a strictly hierarchical group structure" + *
+ * + * + * + * + * + *
+ * \image html Groups_fig2.gif "A file with a circular reference" + *
+ * + * + * + * + * + *
+ * \image html Groups_fig3.gif "A file with one group as a member of itself" + *
+ * + * As becomes apparent upon reflection, directed graph structures can become quite complex; + * caution is advised! + * + * The balance of this chapter discusses the following topics: + * \li The HDF5 group object (or a group) and its structure in more detail + * \li HDF5 link objects (or links) + * \li The programming model for working with groups and links + * \li HDF5 functions provided for working with groups, group members, and links + * \li Retrieving information about objects in a group + * \li Discovery of the structure of an HDF5 file and the contained objects + * \li Examples of file structures + * + * \subsection subsec_group_descr Description of the Group Object + * \subsubsection subsubsec_group_descr_object The Group Object + * Abstractly, an HDF5 group contains zero or more objects and every object must be a member of + * at least one group. The root group, the sole exception, may not belong to any group. + * + * + * + * + * + *
+ * \image html Groups_fig4.gif "Abstract model of the HDF5 group object" + *
+ * + * Group membership is actually implemented via link objects. See the figure above. A link object + * is owned by a group and points to a named object. Each link has a name, and each link points to + * exactly one object. Each named object has at least one and possibly many links to it. + * + * There are three classes of named objects: group, dataset, and committed datatype (formerly + * called named datatype). See the figure below. Each of these objects is the member of at least one + * group, which means there is at least one link to it. + * + * + * + * + * + *
+ * \image html Groups_fig5.gif "Classes of named objects" + *
+ * + * The primary operations on a group are to add and remove members and to discover member + * objects. These abstract operations, as listed in the figure below, are implemented in the \ref H5G + * APIs. For more information, @see @ref subsec_group_function. + * + * To add and delete members of a group, links from the group to existing objects in the file are + * created and deleted with the link and unlink operations. When a new named object is created, the + * HDF5 Library executes the link operation in the background immediately after creating the + * object (in other words, a new object is added as a member of the group in which it is created + * without further user intervention). + * + * Given the name of an object, the get_object_info method retrieves a description of the object, + * including the number of references to it. The iterate method iterates through the members of the + * group, returning the name and type of each object. + * + * + * + * + * + *
+ * \image html Groups_fig6.gif "The group object" + *
+ * + * Every HDF5 file has a single root group, with the name /. The root group is identical to any other + * HDF5 group, except: + * \li The root group is automatically created when the HDF5 file is created (#H5Fcreate). + * \li The root group has no parent, but by convention has a reference count of 1. + * \li The root group cannot be deleted (in other words, unlinked)! + * + * \subsubsection subsubsec_group_descr_model The Hierarchy of Data Objects + * An HDF5 file is organized as a rooted, directed graph using HDF5 group objects. The named + * data objects are the nodes of the graph, and the links are the directed arcs. Each arc of the graph + * has a name, with the special name / reserved for the root group. New objects are created and then + * inserted into the graph with a link operation that is automatically executed by the library; + * existing objects are inserted into the graph with a link operation explicitly called by the user, + * which creates a named link from a group to the object. + * + * An object can be the target of more than one link. + * + * The names on the links must be unique within each group, but there may be many links with the + * same name in different groups. These are unambiguous, because some ancestor must have a + * different name, or else they are the same object. The graph is navigated with path names, + * analogous to Unix file systems. For more information, @see @ref subsubsec_group_descr_path. + * + * An object can be opened with a full path starting at the root group, or with a relative path and a + * starting point. That starting point is always a group, though it may be the current working group, + * another specified group, or the root group of the file. Note that all paths are relative to a single + * HDF5 file. In this sense, an HDF5 file is analogous to a single UNIX file system. + * + * It is important to note that, just like the UNIX file system, HDF5 objects do not have names, the + * names are associated with paths. An object has an object identifier that is unique within the file, + * but a single object may have many names because there may be many paths to the same object. + * An object can be renamed, or moved to another group, by adding and deleting links. In this case, + * the object itself never moves. For that matter, membership in a group has no implication for the + * physical location of the stored object. + * + * Deleting a link to an object does not necessarily delete the object. The object remains available + * as long as there is at least one link to it. After all links to an object are deleted, it can no longer + * be opened, and the storage may be reclaimed. + * + * It is also important to realize that the linking mechanism can be used to construct very complex + * graphs of objects. For example, it is possible for an object to be shared between several groups + * and even to have more than one name in the same group. It is also possible for a group to be a + * member of itself, or to create other cycles in the graph, such as in the case where a child group is + * linked to one of its ancestors. + * + * HDF5 also has soft links similar to UNIX soft links. A soft link is an object that has a name and + * a path name for the target object. The soft link can be followed to open the target of the link just + * like a regular or hard link. The differences are that the hard link cannot be created if the target + * object does not exist and it always points to the same object. A soft link can be created with any + * path name, whether or not the object exists; it may or may not, therefore, be possible to follow a + * soft link. Furthermore, a soft link's target object may be changed. + * + * \subsubsection subsubsec_group_descr_path HDF5 Path Names + * The structure of the HDF5 file constitutes the name space for the objects in the file. A path name + * is a string of components separated by slashes (/). Each component is the name of a hard or soft + * link which points to an object in the file. The slash not only separates the components, but + * indicates their hierarchical relationship; the component indicated by the link name following a + * slash is a always a member of the component indicated by the link name preceding that slash. + * + * The first component in the path name may be any of the following: + * \li The special character dot (., a period), indicating the current group + * \li The special character slash (/), indicating the root group + * \li Any member of the current group + * + * Component link names may be any string of ASCII characters not containing a slash or a dot + * (/ and ., which are reserved as noted above). However, users are advised to avoid the use of + * punctuation and non-printing characters, as they may create problems for other software. The + * figure below provides a BNF grammar for HDF5 path names. + * + * A BNF grammar for HDF5 path names + * \code + * PathName ::= AbsolutePathName | RelativePathName + * Separator ::= "/" ["/"]* + * AbsolutePathName ::= Separator [ RelativePathName ] + * RelativePathName ::= Component [ Separator RelativePathName ]* + * Component ::= "." | Characters + * Characters ::= Character+ - { "." } + * Character ::= {c: c Î { { legal ASCII characters } - {'/'} } + * \endcode + * + * An object can always be addressed by either a full or an absolute path name, starting at the root + * group, or by a relative path name, starting in a known location such as the current working + * group. As noted elsewhere, a given object may have multiple full and relative path names. + * + * Consider, for example, the file illustrated in the figure below. Dataset1 can be identified by either + * of these absolute path names: + * /GroupA/Dataset1 + * + * /GroupA/GroupB/GroupC/Dataset1 + * + * Since an HDF5 file is a directed graph structure, and is therefore not limited to a strict tree + * structure, and since this illustrated file includes the sort of circular reference that a directed graph + * enables, Dataset1 can also be identified by this absolute path name: + * /GroupA/GroupB/GroupC/GroupA/Dataset1 + * + * Alternatively, if the current working location is GroupB, Dataset1 can be identified by either of + * these relative path names: + * GroupC/Dataset1 + * + * GroupC/GroupA/Dataset1 + * + * Note that relative path names in HDF5 do not employ the ../ notation, the UNIX notation + * indicating a parent directory, to indicate a parent group. + * + * + * + * + * + *
+ * \image html Groups_fig2.gif "A file with a circular reference" + *
+ * + * \subsubsection subsubsec_group_descr_impl Group Implementations in HDF5 + * The original HDF5 group implementation provided a single indexed structure for link storage. A + * new group implementation, as of HDF5 Release 1.8.0, enables more efficient compact storage + * for very small groups, improved link indexing for large groups, and other advanced features. + *
    + *
  • The original indexed format remains the default. Links are stored in a B-tree in the + * group's local heap.
  • + *
  • Groups created in the new compact-or-indexed format, the implementation introduced + * with Release 1.8.0, can be tuned for performance, switching between the compact and + * indexed formats at thresholds set in the user application. + *
      + *
    • The compact format will conserve file space and processing overhead when + * working with small groups and is particularly valuable when a group contains + * no links. Links are stored as a list of messages in the group's header.
    • + *
    • The indexed format will yield improved performance when working with large + * groups. A large group may contain thousands to millions of members. Links + * are stored in a fractal heap and indexed with an improved B-tree.
    • + *
  • + *
  • The new implementation also enables the use of link names consisting of non-ASCII + * character sets (see #H5Pset_char_encoding) and is required for all link types other than + * hard or soft links; the link types other than hard or soft links are external links and + * user-defined links @see @ref H5L APIs.
  • + *
+ * + * The original group structure and the newer structures are not directly interoperable. By default, a + * group will be created in the original indexed format. An existing group can be changed to a + * compact-or-indexed format if the need arises; there is no capability to change back. As stated + * above, once in the compact-or-indexed format, a group can switch between compact and indexed + * as needed. + * + * Groups will be initially created in the compact-or-indexed format only when one or more of the + * following conditions is met: + *
    + *
  • The low version bound value of the library version bounds property has been set to + * Release 1.8.0 or later in the file access property list (see #H5Pset_libver_bounds). + * Currently, that would require an #H5Pset_libver_bounds call with the low parameter + * set to #H5F_LIBVER_LATEST. + * + * When this property is set for an HDF5 file, all objects in the file will be created using + * the latest available format; no effort will be made to create a file that can be read by + * older libraries.
  • + *
  • The creation order tracking property, #H5P_CRT_ORDER_TRACKED, has been set + * in the group creation property list (see #H5Pset_link_creation_order).
  • + *
+ * + * An existing group, currently in the original indexed format, will be converted to the compact-or- + * indexed format upon the occurrence of any of the following events: + *
    + *
  • An external or user-defined link is inserted into the group. + *
  • A link named with a string composed of non-ASCII characters is inserted into the + * group. + *
+ * + * The compact-or-indexed format offers performance improvements that will be most notable at + * the extremes (for example, in groups with zero members and in groups with tens of thousands of + * members). But measurable differences may sometimes appear at a threshold as low as eight + * group members. Since these performance thresholds and criteria differ from application to + * application, tunable settings are provided to govern the switch between the compact and indexed + * formats (see #H5Pset_link_phase_change). Optimal thresholds will depend on the application and + * the operating environment. + * + * Future versions of HDF5 will retain the ability to create, read, write, and manipulate all groups + * stored in either the original indexed format or the compact-or-indexed format. + * + * \subsection subsec_group_h5dump Using h5dump + * You can use h5dump, the command-line utility distributed with HDF5, to examine a file for + * purposes either of determining where to create an object within an HDF5 file or to verify that + * you have created an object in the intended place. + * + * In the case of the new group created later in this chapter, the following h5dump command will + * display the contents of FileA.h5: + * \code + * h5dump FileA.h5 + * \endcode + * + * For more information, @see @ref subsubsec_group_program_create. + * + * Assuming that the discussed objects, GroupA and GroupB are the only objects that exist in + * FileA.h5, the output will look something like the following: + * \code + * HDF5 "FileA.h5" { + * GROUP "/" { + * GROUP GroupA { + * GROUP GroupB { + * } + * } + * } + * } + * \endcode + * + * h5dump is described on the “HDF5 Tools” page of the \ref RM. + * + * The HDF5 DDL grammar is described in the @ref DDLBNF110. + * + * \subsection subsec_group_function Group Function Summaries + * Functions that can be used with groups (\ref H5G functions) and property list functions that can used + * with groups (\ref H5P functions) are listed below. A number of group functions have been + * deprecated. Most of these have become link (\ref H5L) or object (\ref H5O) functions. These replacement + * functions are also listed below. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Group functions
FunctionPurpose
#H5GcreateCreates a new empty group and gives it a name. The + * C function is a macro: \see \ref api-compat-macros.
#H5Gcreate_anonCreates a new empty group without linking it into the file structure.
#H5GopenOpens an existing group for modification and returns a group identifier for that group. + * The C function is a macro: \see \ref api-compat-macros.
#H5GcloseCloses the specified group.
#H5Gget_create_plistGets a group creation property list identifier.
#H5Gget_infoRetrieves information about a group. Use instead of H5Gget_num_objs.
#H5Gget_info_by_idxRetrieves information about a group according to the group's position within an index.
#H5Gget_info_by_nameRetrieves information about a group.
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Link and object functions
FunctionPurpose
#H5Lcreate_hardCreates a hard link to an object. Replaces H5Glink and H5Glink2.
#H5Lcreate_softCreates a soft link to an object. Replaces H5Glink and H5Glink2.
#H5Lcreate_externalCreates a soft link to an object in a different file. Replaces H5Glink and H5Glink2.
#H5Lcreate_udCreates a link of a user-defined type.
#H5Lget_valReturns the value of a symbolic link. Replaces H5Gget_linkval.
#H5LiterateIterates through links in a group. Replaces H5Giterate. + * See also #H5Ovisit and #H5Lvisit.
#H5Literate_by_nameIterates through links in a group.
#H5LvisitRecursively visits all links starting from a specified group.
#H5OvisitRecursively visits all objects accessible from a specified object.
#H5Lget_infoReturns information about a link. Replaces H5Gget_objinfo.
#H5Oget_infoRetrieves the metadata for an object specified by an identifier. Replaces H5Gget_objinfo.
#H5Lget_name_by_idxRetrieves name of the nth link in a group, according to the order within a specified field + * or index. Replaces H5Gget_objname_by_idx.
#H5Oget_info_by_idxRetrieves the metadata for an object, identifying the object by an index position. Replaces + * H5Gget_objtype_by_idx.
#H5Oget_info_by_nameRetrieves the metadata for an object, identifying the object by location and relative name.
#H5Oset_commentSets the comment for specified object. Replaces H5Gset_comment.
#H5Oget_commentGets the comment for specified object. Replaces H5Gget_comment.
#H5LdeleteRemoves a link from a group. Replaces H5Gunlink.
#H5LmoveRenames a link within an HDF5 file. Replaces H5Gmove and H5Gmove2.
+ * + * \snippet{doc} tables/propertyLists.dox gcpl_table + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Other external link functions
FunctionPurpose
#H5Pset_elink_file_cache_sizeSets the size of the external link open file cache from the specified + * file access property list.
#H5Pget_elink_file_cache_sizeRetrieves the size of the external link open file cache from the specified + * file access property list.
#H5Fclear_elink_file_cacheClears the external link open file cache for a file.
+ * + * \subsection subsec_group_program Programming Model for Groups + * The programming model for working with groups is as follows: + *
  1. Create a new group or open an existing one.
  2. + *
  3. Perform the desired operations on the group. + *
    • Create new objects in the group.
    • + *
    • Insert existing objects as group members.
    • + *
    • Delete existing members.
    • + *
    • Open and close member objects.
    • + *
    • Access information regarding member objects.
    • + *
    • Iterate across group members.
    • + *
    • Manipulate links.
    + *
  4. Terminate access to the group (Close the group).
+ * + * \subsubsection subsubsec_group_program_create Creating a Group + * To create a group, use #H5Gcreate, specifying the location and the path of the new group. The + * location is the identifier of the file or the group in a file with respect to which the new group is to + * be identified. The path is a string that provides either an absolute path or a relative path to the + * new group. For more information, @see @ref subsubsec_group_descr_path. + * + * A path that begins with a slash (/) is + * an absolute path indicating that it locates the new group from the root group of the HDF5 file. A + * path that begins with any other character is a relative path. When the location is a file, a relative + * path is a path from that file's root group; when the location is a group, a relative path is a path + * from that group. + * + * The sample code in the example below creates three groups. The group Data is created in the + * root directory; two groups are then created in /Data, one with absolute path, the other with a + * relative path. + * + * Creating three new groups + * \code + * hid_t file; + * file = H5Fopen(....); + * + * group = H5Gcreate(file, "/Data", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * group_new1 = H5Gcreate(file, "/Data/Data_new1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * group_new2 = H5Gcreate(group, "Data_new2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * The third #H5Gcreate parameter optionally specifies how much file space to reserve to store the + * names that will appear in this group. If a non-positive value is supplied, a default size is chosen. + * + * \subsubsection subsubsec_group_program_open Opening a Group and Accessing an Object in that Group + * Though it is not always necessary, it is often useful to explicitly open a group when working + * with objects in that group. Using the file created in the example above, the example below + * illustrates the use of a previously-acquired file identifier and a path relative to that file to open + * the group Data. + * + * Any object in a group can be also accessed by its absolute or relative path. To open an object + * using a relative path, an application must first open the group or file on which that relative path + * is based. To open an object using an absolute path, the application can use any location identifier + * in the same file as the target object; the file identifier is commonly used, but object identifier for + * any object in that file will work. Both of these approaches are illustrated in the example below. + * + * Using the file created in the examples above, the example below provides sample code + * illustrating the use of both relative and absolute paths to access an HDF5 data object. The first + * sequence (two function calls) uses a previously-acquired file identifier to open the group Data, + * and then uses the returned group identifier and a relative path to open the dataset CData. The + * second approach (one function call) uses the same previously-acquired file identifier and an + * absolute path to open the same dataset. + * + * Open a dataset with relative and absolute paths + * \code + * group = H5Gopen(file, "Data", H5P_DEFAULT); + * + * dataset1 = H5Dopen(group, "CData", H5P_DEFAULT); + * dataset2 = H5Dopen(file, "/Data/CData", H5P_DEFAULT); + * \endcode + * + * \subsubsection subsubsec_group_program_dataset Creating a Dataset in a Specific Group + * Any dataset must be created in a particular group. As with groups, a dataset may be created in a + * particular group by specifying its absolute path or a relative path. The example below illustrates + * both approaches to creating a dataset in the group /Data. + * + * Create a dataset with absolute and relative paths + * \code + * dataspace = H5Screate_simple(RANK, dims, NULL); + * dataset1 = H5Dcreate(file, "/Data/CData", H5T_NATIVE_INT, dataspace, + * H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * group = H5Gopen(file, "Data", H5P_DEFAULT); + * dataset2 = H5Dcreate(group, "Cdata2", H5T_NATIVE_INT, dataspace, + * H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * + * \subsubsection subsubsec_group_program_close Closing a Group + * To ensure the integrity of HDF5 objects and to release system resources, an application should + * always call the appropriate close function when it is through working with an HDF5 object. In + * the case of groups, H5Gclose ends access to the group and releases any resources the HDF5 + * library has maintained in support of that access, including the group identifier. + * + * As illustrated in the example below, all that is required for an H5Gclose call is the group + * identifier acquired when the group was opened; there are no relative versus absolute path + * considerations. + * + * Close a group + * \code + * herr_t status; + * + * status = H5Gclose(group); + * \endcode + * + * A non-negative return value indicates that the group was successfully closed and the resources + * released; a negative return value indicates that the attempt to close the group or release resources + * failed. + * + * \subsubsection subsubsec_group_program_links Creating Links + * As previously mentioned, every object is created in a specific group. Once created, an object can + * be made a member of additional groups by means of links created with one of the H5Lcreate_* + * functions. + * + * A link is, in effect, a path by which the target object can be accessed; it therefore has a name + * which functions as a single path component. A link can be removed with an #H5Ldelete call, + * effectively removing the target object from the group that contained the link (assuming, of + * course, that the removed link was the only link to the target object in the group). + * + *

Hard Links

+ * There are two kinds of links, hard links and symbolic links. Hard links are reference counted; + * symbolic links are not. When an object is created, a hard link is automatically created. An object + * can be deleted from the file by removing all the hard links to it. + * + * Working with the file from the previous examples, the code in the example below illustrates the + * creation of a hard link, named Data_link, in the root group, /, to the group Data. Once that link is + * created, the dataset Cdata can be accessed via either of two absolute paths, /Data/Cdata or + * /Data_Link/Cdata. + * + * Create a hard link + * \code + * status = H5Lcreate_hard(Data_loc_id, "Data", DataLink_loc_id, "Data_link", H5P_DEFAULT, H5P_DEFAULT); + * + * dataset1 = H5Dopen(file, "/Data_link/CData", H5P_DEFAULT); + * dataset2 = H5Dopen(file, "/Data/CData", H5P_DEFAULT); + * \endcode + * + * The example below shows example code to delete a link, deleting the hard link Data from the + * root group. The group /Data and its members are still in the file, but they can no longer be + * accessed via a path using the component /Data. + * + * Delete a link + * \code + * status = H5Ldelete(Data_loc_id, "Data", H5P_DEFAULT); + * + * dataset1 = H5Dopen(file, "/Data_link/CData", H5P_DEFAULT); + * // This call should succeed; all path components still exist + * dataset2 = H5Dopen(file, "/Data/CData", H5P_DEFAULT); + * // This call will fail; the path component '/Data' has been deleted. + * \endcode + * + * When the last hard link to an object is deleted, the object is no longer accessible. #H5Ldelete will + * not prevent you from deleting the last link to an object. To see if an object has only one link, use + * the #H5Oget_info function. If the value of the rc (reference count) field in the is greater than 1, + * then the link can be deleted without making the object inaccessible. + * + * The example below shows #H5Oget_info to the group originally called Data. + * + * Finding the number of links to an object + * \code + * status = H5Oget_info(Data_loc_id, object_info); + * \endcode + * + * It is possible to delete the last hard link to an object and not make the object inaccessible. + * Suppose your application opens a dataset, and then deletes the last hard link to the dataset. While + * the dataset is open, your application still has a connection to the dataset. If your application + * creates a hard link to the dataset before it closes the dataset, then the dataset will still be + * accessible. + * + *

Symbolic Links

+ * Symbolic links are objects that assign a name in a group to a path. Notably, the target object is + * determined only when the symbolic link is accessed, and may, in fact, not exist. Symbolic links + * are not reference counted, so there may be zero, one, or more symbolic links to an object. + * + * The major types of symbolic links are soft links and external links. Soft links are symbolic links + * within an HDF5 file and are created with the #H5Lcreate_soft function. Symbolic links to objects + * located in external files, in other words external links, can be created with the + * #H5Lcreate_external function. Symbolic links are removed with the #H5Ldelete function. + * + * The example below shows the creating two soft links to the group /Data. + * + * Create a soft link + * \code + * status = H5Lcreate_soft(path_to_target, link_loc_id, "Soft2", H5P_DEFAULT, H5P_DEFAULT); + * status = H5Lcreate_soft(path_to_target, link_loc_id, "Soft3", H5P_DEFAULT, H5P_DEFAULT); + * dataset = H5Dopen(file, "/Soft2/CData", H5P_DEFAULT); + * \endcode + * + * With the soft links defined in the example above, the dataset CData in the group /Data can now + * be opened with any of the names /Data/CData, /Soft2/CData, or /Soft3/CData. + * + * In release 1.8.7, a cache was added to hold the names of files accessed via external links. The + * size of this cache can be changed to help improve performance. For more information, see the + * entry in the \ref RM for the #H5Pset_elink_file_cache_size function call. + * + *

Note Regarding Hard Links and Soft Links

+ * Note that an object's existence in a file is governed by the presence of at least one hard link to + * that object. If the last hard link to an object is removed, the object is removed from the file and + * any remaining soft link becomes a dangling link, a link whose target object does not exist. + * + *

Moving or Renaming Objects, and a Warning

+ * An object can be renamed by changing the name of a link to it with #H5Lmove. This has the same + * effect as creating a new link with the new name and deleting the link with the old name. + * + * Exercise caution in the use of #H5Lmove and #H5Ldelete as these functions each include a step + * that unlinks a pointer to an HDF5 object. If the link that is removed is on the only path leading to + * an HDF5 object, that object will become permanently inaccessible in the file. + * + *
Scenario 1: Removing the Last Link
+ * To avoid removing the last link to an object or otherwise making an object inaccessible, use the + * #H5Oget_info function. Make sure that the value of the reference count field (rc) is greater than 1. + * + *
Scenario 2: Moving a Link that Isolates an Object
+ * Consider the following example: assume that the group group2 can only be accessed via the + * following path, where top_group is a member of the file's root group: + * /top_group/group1/group2/ + * + * Using #H5Lmove, top_group is renamed to be a member ofgroup2. At this point, since + * top_group was the only route from the root group to group1, there is no longer a path by which + * one can access group1, group2, or any member datasets. And since top_group is now a member + * of group2, top_group itself and any member datasets have thereby also become inaccessible. + * + *

Mounting a File

+ * An external link is a permanent connection between two files. A temporary connection can be set + * up with the #H5Fmount function. For more information, @see sec_file. + * For more information, see the #H5Fmount function in the \ref RM. + * + * \subsubsection subsubsec_group_program_info Discovering Information about Objects + * There is often a need to retrieve information about a particular object. The #H5Lget_info and + * #H5Oget_info functions fill this niche by returning a description of the object or link in an + * #H5L_info_t or #H5O_info_t structure. + * + * \subsubsection subsubsec_group_program_objs Discovering Objects in a Group + * To examine all the objects or links in a group, use the #H5Literate or #H5Ovisit functions to + * examine the objects, and use the #H5Lvisit function to examine the links. #H5Literate is useful + * both with a single group and in an iterative process that examines an entire file or section of a + * file (such as the contents of a group or the contents of all the groups that are members of that + * group) and acts on objects as they are encountered. #H5Ovisit recursively visits all objects + * accessible from a specified object. #H5Lvisit recursively visits all the links starting from a + * specified group. + * + * \subsubsection subsubsec_group_program_all Discovering All of the Objects in the File + * The structure of an HDF5 file is self-describing, meaning that an application can navigate an + * HDF5 file to discover and understand all the objects it contains. This is an iterative process + * wherein the structure is traversed as a graph, starting at one node and recursively visiting linked + * nodes. To explore the entire file, the traversal should start at the root group. + * + * \subsection subsec_group_examples Examples of File Structures + * This section presents several samples of HDF5 file structures. + * + * Figure 9 shows examples of the structure of a file with three groups and one dataset. The file in + * part a contains three groups: the root group and two member groups. In part b, the dataset + * dset1 has been created in /group1. In part c, a link named dset2 from /group2 to the dataset has + * been added. Note that there is only one copy of the dataset; there are two links to it and it can be + * accessed either as /group1/dset1 or as /group2/dset2. + * + * Part d illustrates that one of the two links to the dataset can be deleted. In this case, the link from + * /group1 + * has been removed. The dataset itself has not been deleted; it is still in the file but can only be + * accessed as + * /group2/dset2 + * + * + * + * + * + * + * + * + * + * + * + *
Figure 9 - Some file structures
+ * \image html Groups_fig9_a.gif "a) The file contains three groups: the root group, /group1, and /group2." + * + * \image html Groups_fig9_b.gif "b) The dataset dset1 (or /group1/dset1) is created in /group1." + *
+ * \image html Groups_fig9_aa.gif "c) A link named dset2 to the same dataset is created in /group2." + * + * \image html Groups_fig9_bb.gif "d) The link from /group1 to dset1 is removed. The dataset is + * still in the file, but can be accessed only as /group2/dset2." + *
+ * + * Figure 10 illustrates loops in an HDF5 file structure. The file in part a contains three groups + * and a dataset; group2 is a member of the root group and of the root group's other member group, + * group1. group2 thus can be accessed by either of two paths: /group2 or /group1/GXX. Similarly, + * the dataset can be accessed either as /group2/dset1 or as /group1/GXX/dset1. + * + * Part b illustrates a different case: the dataset is a member of a single group but with two links, or + * names, in that group. In this case, the dataset again has two names, /group1/dset1 and + * /group1/dset2. + * + * In part c, the dataset dset1 is a member of two groups, one of which can be accessed by either of + * two names. The dataset thus has three path names: /group1/dset1, /group2/dset2, and + * /group1/GXX/dset2. + * + * And in part d, two of the groups are members of each other and the dataset is a member of both + * groups. In this case, there are an infinite number of paths to the dataset because GXX and + * GYY can be traversed any number of times on the way from the root group, /, to the dataset. This + * can yield a path name such as /group1/GXX/GYY/GXX/GYY/GXX/dset2. + * + * + * + * + * + * + * + * + * + * + * + *
Figure 10 - More sample file structures
+ * \image html Groups_fig10_a.gif "a) dset1 has two names: /group2/dset1 and /group1/GXX/dset1." + * + * \image html Groups_fig10_b.gif "b) dset1 again has two names: /group1/dset1 and /group1/dset2." + *
+ * \image html Groups_fig10_c.gif "c) dset1 has three names: /group1/dset1, /group2/dset2, and + * /group1/GXX/dset2." + * + * \image html Groups_fig10_d.gif "d) dset1 has an infinite number of available path names." + *
+ * + * Figure 11 takes us into the realm of soft links. The original file, in part a, contains only three + * hard links. In part b, a soft link named dset2 from group2 to /group1/dset1 has been created, + * making this dataset accessible as /group2/dset2. + * + * In part c, another soft link has been created in group2. But this time the soft link, dset3, points + * to a target object that does not yet exist. That target object, dset, has been added in part d and is + * now accessible as either /group2/dset or /group2/dset3. + * + * It could be said that HDF5 extends the organizing concepts of a file system to the internal + * structure of a single file. + * + * + * + * + * + * + * + * + * + * + * + *
Figure 11 - Hard and soft links
+ * \image html Groups_fig11_a.gif "a) The file contains only hard links." + * + * \image html Groups_fig11_b.gif "b) A soft link is added from group2 to /group1/dset1." + *
+ * \image html Groups_fig11_c.gif "c) A soft link named dset3 is added with a target that does not yet exist." + * + * \image html Groups_fig11_d.gif "d) The target of the soft link is created or linked." + *
+ * + * Previous Chapter \ref sec_file - Next Chapter \ref sec_dataset + * + */ + +/** + * \defgroup H5G Groups (H5G) * * Use the functions in this module to manage HDF5 groups. * @@ -57,30 +883,30 @@ * objects appear in at least one group (with the possible exception of * the root object) and since objects can have names in more than one * group, the set of all objects in an HDF5 file is a directed - * graph. The internal nodes (nodes with out-degree greater than zero) - * must be groups while the leaf nodes (nodes with out-degree zero) are + * graph. The internal nodes (nodes with an out-degree greater than zero) + * must be groups, while the leaf nodes (nodes with an out-degree zero) are * either empty groups or objects of some other type. Exactly one * object in every non-empty file is the root object. The root object * always has a positive in-degree because it is pointed to by the file - * super block. + * superblock. * * \Bold{Locating objects in the HDF5 file hierarchy:} An object name * consists of one or more components separated from one another by - * slashes. An absolute name begins with a slash and the object is + * slashes. An absolute name begins with a slash, and the object is * located by looking for the first component in the root object, then * looking for the second component in the first object, etc., until * the entire name is traversed. A relative name does not begin with a - * slash and the traversal begins at the location specified by the + * slash, and the traversal begins at the location specified by the * create or access function. * * \Bold{Group implementations in HDF5:} The original HDF5 group - * implementation provided a single indexed structure for link + * implementation provided a single-indexed structure for link * storage. A new group implementation, in HDF5 Release 1.8.0, enables * more efficient compact storage for very small groups, improved link * indexing for large groups, and other advanced features. * * \li The \Emph{original indexed} format remains the default. Links - * are stored in a B-tree in the group’s local heap. + * are stored in a B-tree in the group's local heap. * \li Groups created in the new \Emph{compact-or-indexed} format, the * implementation introduced with Release 1.8.0, can be tuned for * performance, switching between the compact and indexed formats @@ -88,13 +914,13 @@ * - The \Emph{compact} format will conserve file space and processing * overhead when working with small groups and is particularly * valuable when a group contains no links. Links are stored - * as a list of messages in the group’s header. + * as a list of messages in the group's header. * - The \Emph{indexed} format will yield improved * performance when working with large groups, e.g., groups * containing thousands to millions of members. Links are stored in * a fractal heap and indexed with an improved B-tree. * \li The new implementation also enables the use of link names consisting of - * non-ASCII character sets (see H5Pset_char_encoding()) and is + * non-ASCII character sets (see #H5Pset_char_encoding) and is * required for all link types other than hard or soft links, e.g., * external and user-defined links (see the \ref H5L APIs). * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Gpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Gpkg.h index 75c7c893b4..fdc05ec6cc 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Gpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Gpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Thursday, September 18, 1997 - * * Purpose: This file contains declarations which are visible * only within the H5G package. Source files outside the * H5G package should include H5Gprivate.h instead. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Gprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Gprivate.h index 87cb8c69df..d6b93352a8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Gprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Gprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gprivate.h - * Jul 11 1997 - * Robb Matzke * * Purpose: Library-visible declarations. * @@ -249,7 +246,7 @@ H5_DLL herr_t H5G_node_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, i * These functions operate on group object locations. */ H5_DLL herr_t H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent); +H5_DLL herr_t H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, const uint8_t *p_end); /* * These functions operate on group hierarchy names. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Gpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Gpublic.h index ce36b84851..a21ffa2a84 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Gpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Gpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gpublic.h - * Jul 11 1997 - * Robb Matzke * * Purpose: Public declarations for the H5G package * @@ -24,14 +21,10 @@ #ifndef H5Gpublic_H #define H5Gpublic_H -/* System headers needed by this file */ -#include - -/* Public headers needed by this file */ -#include "H5public.h" /* Generic Functions */ -#include "H5Lpublic.h" /* Links */ -#include "H5Opublic.h" /* Object headers */ -#include "H5Tpublic.h" /* Datatypes */ +#include "H5public.h" /* Generic Functions */ +#include "H5Ipublic.h" /* Identifiers */ +#include "H5Lpublic.h" /* Links */ +#include "H5Opublic.h" /* Object Headers */ /*****************/ /* Public Macros */ @@ -120,7 +113,7 @@ extern "C" { * * \since 1.8.0 * - * \see H5Gopen2(), H5Gclose() + * \see H5Gopen2() * */ H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id); @@ -130,8 +123,13 @@ H5_DLL hid_t H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcp * \ingroup ASYNC * \async_variant_of{H5Gcreate} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Gcreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Gcreate_async(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, + hid_t es_id); +#endif /** *------------------------------------------------------------------------- @@ -150,7 +148,7 @@ H5_DLL hid_t H5Gcreate_async(const char *app_file, const char *app_func, unsigne * provides similar functionality to that provided by * H5Gcreate1(), with the differences described in the list below. * - * The new group’s creation and access properties are specified + * The new group's creation and access properties are specified * in \p gcpl_id and \p gapl_id, respectively. * * H5Gcreate_anon() returns a new group identifier. This identifier @@ -162,12 +160,12 @@ H5_DLL hid_t H5Gcreate_async(const char *app_file, const char *app_func, unsigne * * \li H5Gcreate1() does not provide for the use of custom property * lists; H5Gcreate1() always uses default properties. - * \li H5Gcreate_anon() neither provides the new group’s name + * \li H5Gcreate_anon() neither provides the new group's name * nor links it into the HDF5 file structure; those actions * must be performed separately through a call to H5Olink(), * which offers greater control over linking. * \li H5Gcreate_anon() does not directly provide a hint mechanism - * for the group’s heap size. Comparable information can be + * for the group's heap size. Comparable information can be * included in the group creation property list \p gcpl_id through * a H5Pset_local_heap_size_hint() call. * @@ -175,7 +173,7 @@ H5_DLL hid_t H5Gcreate_async(const char *app_file, const char *app_func, unsigne * H5Gclose() when the group is no longer needed so that resource * leaks will not develop. * - * \see H5Olink(), H5Dcreate(), Using Identifiers + * \see H5Olink(), H5Gcreate() * * \since 1.8.0 * @@ -207,7 +205,7 @@ H5_DLL hid_t H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id); * * \since 1.8.0 * - * \see H5Gcreate2(), H5Gclose() + * \see H5Gcreate2() * */ H5_DLL hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id); @@ -217,8 +215,12 @@ H5_DLL hid_t H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id); * \ingroup ASYNC * \async_variant_of{H5Gopen} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Gopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t gapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Gopen_async(hid_t loc_id, const char *name, hid_t gapl_id, hid_t es_id); +#endif /** *------------------------------------------------------------------------- @@ -234,12 +236,10 @@ H5_DLL hid_t H5Gopen_async(const char *app_file, const char *app_func, unsigned * property list associated with the group specified by \p group_id. * * The creation property list identifier should be released with - * H5Gclose() to prevent resource leaks. + * H5Pclose() to prevent resource leaks. * * \since 1.8.0 * - * \see H5Gcreate2(), H5Gclose() - * */ H5_DLL hid_t H5Gget_create_plist(hid_t group_id); @@ -266,8 +266,6 @@ H5_DLL hid_t H5Gget_create_plist(hid_t group_id); * * \since 1.8.0 * - * \see H5Gcreate2(), H5Gclose() - * */ H5_DLL herr_t H5Gget_info(hid_t loc_id, H5G_info_t *ginfo); @@ -276,8 +274,12 @@ H5_DLL herr_t H5Gget_info(hid_t loc_id, H5G_info_t *ginfo); * \ingroup ASYNC * \async_variant_of{H5Gget_info} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, H5G_info_t *ginfo /*out*/, hid_t es_id); +#else +H5_DLL herr_t H5Gget_info_async(hid_t loc_id, H5G_info_t *ginfo /*out*/, hid_t es_id); +#endif /** *------------------------------------------------------------------------- @@ -308,8 +310,6 @@ H5_DLL herr_t H5Gget_info_async(const char *app_file, const char *app_func, unsi * * \since 1.8.0 * - * \see H5Gcreate2(), H5Gclose() - * */ H5_DLL herr_t H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *ginfo, hid_t lapl_id); @@ -318,15 +318,20 @@ H5_DLL herr_t H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *gi * \ingroup ASYNC * \async_variant_of{H5Gget_info_by_name} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, H5G_info_t *ginfo /*out*/, hid_t lapl_id, hid_t es_id); +#else +H5_DLL herr_t H5Gget_info_by_name_async(hid_t loc_id, const char *name, H5G_info_t *ginfo /*out*/, + hid_t lapl_id, hid_t es_id); +#endif /** *------------------------------------------------------------------------- * \ingroup H5G * - * \brief Retrieves information about a group, according to the group’s + * \brief Retrieves information about a group, according to the group's * position within an index * * \fgdta_loc_id @@ -364,8 +369,6 @@ H5_DLL herr_t H5Gget_info_by_name_async(const char *app_file, const char *app_fu * * \since 1.8.0 * - * \see H5Gcreate2(), H5Gclose() - * */ H5_DLL herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *ginfo, hid_t lapl_id); @@ -375,10 +378,16 @@ H5_DLL herr_t H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_ * \ingroup ASYNC * \async_variant_of{H5Gget_info_by_idx} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *ginfo /*out*/, hid_t lapl_id, hid_t es_id); +#else +H5_DLL herr_t H5Gget_info_by_idx_async(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, H5G_info_t *ginfo /*out*/, + hid_t lapl_id, hid_t es_id); +#endif /** *------------------------------------------------------------------------- @@ -391,7 +400,7 @@ H5_DLL herr_t H5Gget_info_by_idx_async(const char *app_file, const char *app_fun * \return \herr_t * * \details H5Gflush() causes all buffers associated with a group to be - * immediately flushed to disk without removing the data from + * immediately flushed to the disk without removing the data from * the cache. * * \attention @@ -399,12 +408,10 @@ H5_DLL herr_t H5Gget_info_by_idx_async(const char *app_file, const char *app_fun * flushes the internal HDF5 buffers and then asks the operating * system (the OS) to flush the system buffers for the open * files. After that, the OS is responsible for ensuring that - * the data is actually flushed to disk. + * the data is actually flushed to the disk. * * \since 1.8.0 * - * \see H5Gcreate2(), H5Gclose() - * */ H5_DLL herr_t H5Gflush(hid_t group_id); @@ -422,14 +429,12 @@ H5_DLL herr_t H5Gflush(hid_t group_id); * cleared and immediately re-loaded with updated contents from disk. * * This function essentially closes the group, evicts all - * metadata associated with it from the cache, and then re-opens + * metadata associated with it from the cache, and then reopens * the group. The reopened group is automatically re-registered * with the same identifier. * * \since 1.8.0 * - * \see H5Gcreate2(), H5Gclose() - * */ H5_DLL herr_t H5Grefresh(hid_t group_id); @@ -443,7 +448,7 @@ H5_DLL herr_t H5Grefresh(hid_t group_id); * * \return \herr_t * - * \details H5Gclose() releases resources used by a group which was + * \details H5Gclose() releases resources used by a group that was * opened by H5Gcreate() or H5Gopen(). After closing a group, * \p group_id cannot be used again until another H5Gcreate() * or H5Gopen() is called on it. @@ -464,8 +469,12 @@ H5_DLL herr_t H5Gclose(hid_t group_id); * \ingroup ASYNC * \async_variant_of{H5Gclose} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id, hid_t es_id); +#else +H5_DLL herr_t H5Gclose_async(hid_t group_id, hid_t es_id); +#endif /// \cond DEV /* API Wrappers for async routines */ @@ -735,7 +744,7 @@ H5_DLL herr_t H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, * * \attention Exercise care in moving groups as it is possible to render data in * a file inaccessible with H5Gmove(). See The Group Interface in the - * HDF5 User's Guide. + * \ref UG. * * \version 1.8.0 Function deprecated in this release. * @@ -766,7 +775,7 @@ H5_DLL herr_t H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_na * * \attention Exercise care in moving groups as it is possible to render data in * a file inaccessible with H5Gmove2(). See The Group Interface in the - * HDF5 User's Guide. + * \ref UG. * * \version 1.8.0 Function deprecated in this release. * @@ -803,11 +812,11 @@ H5_DLL herr_t H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, * Note that space identified as freespace is available for re-use only * as long as the file remains open; once a file has been closed, the * HDF5 library loses track of freespace. See “Freespace Management” in - * the HDF5 User's Guide for further details. + * the \ref UG for further details. * * \attention Exercise care in moving groups as it is possible to render data in * a file inaccessible with H5Gunlink(). See The Group Interface in the - * HDF5 User's Guide. + * \ref UG. * * \version 1.8.0 Function deprecated in this release. * @@ -875,7 +884,7 @@ H5_DLL herr_t H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char * * \p loc_id can specify any object in the file. name can be one of the * following: * \li The name of the object relative to \p loc_id - * \li An absolute name of the object, starting from \c /, the file’s + * \li An absolute name of the object, starting from \c /, the file's * root group * \li A dot (\c .), if \p loc_id fully specifies the object * @@ -911,14 +920,14 @@ H5_DLL herr_t H5Gset_comment(hid_t loc_id, const char *name, const char *comment * \deprecated This function is deprecated in favor of the function * H5Oget_comment(). * - * \details H5Gget_comment() retrieves the comment for the the object specified + * \details H5Gget_comment() retrieves the comment for the object specified * by \p loc_id and \p name. The comment is returned in the buffer \p * buf. * * \p loc_id can specify any object in the file. name can be one of the * following: * \li The name of the object relative to \p loc_id - * \li An absolute name of the object, starting from \c /, the file’s + * \li An absolute name of the object, starting from \c /, the file's * root group * \li A dot (\c .), if \p loc_id fully specifies the object * @@ -972,7 +981,7 @@ H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char * * The operation receives the group identifier for the group being * iterated over, \p group, the name of the current object within * the group, \p name, and the pointer to the operator data - * passed in to H5Giterate(), \p op_data. + * passed into H5Giterate(), \p op_data. * * The return values from an operator are: * \li Zero causes the iterator to continue, returning zero when all @@ -993,7 +1002,10 @@ H5_DLL int H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char * * examine the members of \c subgroup_a. When recursive iteration is * required, the application must handle the recursion, explicitly * calling H5Giterate() on discovered subgroups. - + * + * \warning Adding or removing members to the group during iteration + * will lead to undefined behavior. + * * \version 1.8.0 Function deprecated in this release. * */ @@ -1081,7 +1093,7 @@ H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link *------------------------------------------------------------------------- * \ingroup H5G * - * \brief Returns a name of an object specified by an index + * \brief Returns the name of an object specified by an index * * \fg_loc_id * \param[in] idx Transient index identifying object @@ -1094,7 +1106,7 @@ H5_DLL herr_t H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link * * \deprecated This function is deprecated in favor of the function H5Lget_name_by_idx(). * - * \details H5Gget_objname_by_idx() returns a name of the object specified by + * \details H5Gget_objname_by_idx() returns the name of the object specified by * the index \p idx in the group \p loc_id. * * The group is specified by a group identifier \p loc_id. If diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Group.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Group.h index e72d65c833..cb9b0920f8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Group.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Group.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5HFmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5HFmodule.h index 818c3d4078..c4fb437d4f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5HFmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5HFmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5HF package. Including this header means that the source file - * is part of the H5HF package. + * Purpose: This file contains declarations which define macros for the + * H5HF package. Including this header means that the source file + * is part of the H5HF package. */ #ifndef H5HFmodule_H #define H5HFmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5HFpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5HFpkg.h index 81b4063cc9..e036cf0f4a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5HFpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5HFpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Friday, February 24, 2006 - * - * Purpose: This file contains declarations which are visible only within - * the H5HF package. Source files outside the H5HF package should - * include H5HFprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5HF package. Source files outside the H5HF package should + * include H5HFprivate.h instead. */ #if !(defined H5HF_FRIEND || defined H5HF_MODULE) #error "Do not include this file outside the H5HF package!" @@ -158,9 +154,11 @@ /* Decode a "managed" heap ID */ #define H5HF_MAN_ID_DECODE(i, h, f, o, l) \ - f = *(uint8_t *)i++; \ - UINT64DECODE_VAR((i), (o), (h)->heap_off_size); \ - UINT64DECODE_VAR((i), (l), (h)->heap_len_size) + do { \ + f = *(uint8_t *)i++; \ + UINT64DECODE_VAR((i), (o), (h)->heap_off_size); \ + UINT64DECODE_VAR((i), (l), (h)->heap_len_size); \ + } while (0) /* Free space section types for fractal heap */ /* (values stored in free space data structures in file) */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5HFprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5HFprivate.h index 3263b4efa7..f047b45dc0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5HFprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5HFprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFprivate.h - * Feb 24 2006 - * Quincey Koziol * * Purpose: Private header for library accessible fractal heap routines. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5HGmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5HGmodule.h index 412223e02b..772ebe6163 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5HGmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5HGmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5HG package. Including this header means that the source file - * is part of the H5HG package. + * Purpose: This file contains declarations which define macros for the + * H5HG package. Including this header means that the source file + * is part of the H5HG package. */ #ifndef H5HGmodule_H #define H5HGmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5HGpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5HGpkg.h index dcac6efaf0..99725d86f9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5HGpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5HGpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Wednesday, July 9, 2003 - * * Purpose: This file contains declarations which are visible * only within the H5HG package. Source files outside the * H5HG package should include H5HGprivate.h instead. @@ -107,27 +103,32 @@ H5FL_BLK_EXTERN(gheap_chunk); /****************************/ typedef struct H5HG_obj_t { - int nrefs; /* reference count */ - size_t size; /* total size of object */ - uint8_t *begin; /* ptr to object into heap->chunk */ + int nrefs; /* Reference count */ + size_t size; /* Total size of object */ + uint8_t *begin; /* Pointer to object into heap->chunk (INCLUDES header) */ } H5HG_obj_t; /* Forward declarations for fields */ struct H5F_shared_t; struct H5HG_heap_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ - /* first field in structure */ - haddr_t addr; /*collection address */ - size_t size; /*total size of collection */ - uint8_t *chunk; /*the collection, incl. header */ - size_t nalloc; /*numb object slots allocated */ - size_t nused; /*number of slots used */ - /* If this value is >65535 then all indices */ - /* have been used at some time and the */ - /* correct new index should be searched for */ - struct H5F_shared_t *shared; /* shared file */ - H5HG_obj_t *obj; /*array of object descriptions */ + H5AC_info_t cache_info; /* Information for H5AC cache functions, MUST be + * the first field in structure + */ + haddr_t addr; /* Collection address */ + size_t size; /* Total size of collection */ + uint8_t *chunk; /* Collection of elements - note that this + * INCLUDES the header, so it's not just + * the objects! + */ + size_t nalloc; /* # object slots allocated */ + size_t nused; /* # of slots used + * If this value is >65535 then all indices + * have been used at some time and the + * correct new index should be searched for + */ + struct H5F_shared_t *shared; /* Shared file */ + H5HG_obj_t *obj; /* Array of object descriptions */ }; /******************************/ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5HGprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5HGprivate.h index 28d0058d60..892a0c7326 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5HGprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5HGprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,10 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Robb Matzke - * Friday, March 27, 1998 - */ #ifndef H5HGprivate_H #define H5HGprivate_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5HLmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5HLmodule.h index 5432f1a68b..1a871abf74 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5HLmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5HLmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5HL package. Including this header means that the source file - * is part of the H5HL package. + * Purpose: This file contains declarations which define macros for the + * H5HL package. Including this header means that the source file + * is part of the H5HL package. */ #ifndef H5HLmodule_H #define H5HLmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5HLpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5HLpkg.h index 6228f24476..47c20603f5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5HLpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5HLpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Wednesday, July 9, 2003 - * * Purpose: This file contains declarations which are visible * only within the H5HL package. Source files outside the * H5HL package should include H5HLprivate.h instead. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5HLprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5HLprivate.h index f990563967..5d6959d486 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5HLprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5HLprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HLprivate.h - * Jul 16 1997 - * Robb Matzke * * Purpose: Private declarations for the H5HL (local heap) package. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5HLprivate2.h b/externals/coda-oss/modules/drivers/hdf5/include/H5HLprivate2.h new file mode 100644 index 0000000000..2bd8d01917 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5HLprivate2.h @@ -0,0 +1,25 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5HLprivate2_H +#define H5HLprivate2_H + +/* Public HDF5 header */ +#include "hdf5.h" + +/* Public High-Level header */ +#include "hdf5_hl.h" + +/* HDF5 private functions */ +#include "H5private.h" + +#endif /* H5HLprivate2_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5IMpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5IMpublic.h new file mode 100644 index 0000000000..81dbb62374 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5IMpublic.h @@ -0,0 +1,349 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5IMpublic_H +#define H5IMpublic_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** \page H5IM_UG The HDF5 High Level Images + * @todo Under Construction + */ + +/**\defgroup H5IM HDF5 Images API (H5IM) + * + * Creating and manipulating HDF5 datasets intended to be + * interpreted as images (H5IM) + * + * The specification for the Images API is presented in another + * document: \ref IMG + * This version of the API is primarily concerned with two dimensional raster + * data similar to HDF4 Raster Images. + * The HDF5 Images API uses the \ref H5LT. + * + * \note \Bold{Programming hints:} + * \note To use any of these functions or subroutines, + * you must first include the relevant include file (C) or + * module (Fortran) in your application. + * \note The following line includes the HDF5 Images package, H5IM, + * in C applications: + * \code #include "hdf5_hl.h" \endcode + * \note This line includes the H5IM module in Fortran applications: + * \code use h5im \endcode + * + * - \ref H5IMget_image_info + * \n Gets information about an image dataset (dimensions, + * interlace mode and number of associated palettes). + * - \ref H5IMget_npalettes + * \n Gets the number of palettes associated to an image. + * - \ref H5IMget_palette + * \n Gets the palette dataset. + * - \ref H5IMget_palette_info + * \n Gets information about a palette dataset (dimensions). + * - \ref H5IMis_image + * \n Inquires if a dataset is an image + * - \ref H5IMis_palette + * \n Inquires if a dataset is a palette. + * - \ref H5IMlink_palette + * \n Attaches a palette to an image. + * - \ref H5IMmake_image_8bit + * \n Creates and writes an image. + * - \ref H5IMmake_image_24bit + * \n Creates and writes a true color image. + * - \ref H5IMmake_palette + * \n Creates and writes a palette. + * - \ref H5IMread_image + * \n Reads image data from disk. + * - \ref H5IMunlink_palette + * \n Dettaches a palette from an image. + * + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Creates and writes an image. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[in] width The width of the image + * \param[in] height The height of the image + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5IMmake_image_8bit() creates and writes a dataset named + * \p dset_name attached to the file or group specified by the + * identifier \p loc_id. Attributes conforming to the HDF5 Image + * and Palette specification for an indexed image are attached to + * the dataset, thus identifying it as an image. The image data is + * of the type #H5T_NATIVE_UCHAR. An indexed image is an image in + * which each each pixel information storage is an index to a + * table palette. + * + */ +H5_HLDLL herr_t H5IMmake_image_8bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, + const unsigned char *buffer); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Creates and writes a true color image. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[in] width The width of the image + * \param[in] height The height of the image + * \param[in] interlace String defining the interlace mode + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5IMmake_image_24bit() creates and writes a dataset named + * \p dset_name attached to the file or group specified by the + * identifier \p loc_id. This function defines a true color image + * conforming to the HDF5 Image and Palette specification. + * The function assumes that the image data is of the type + * #H5T_NATIVE_UCHAR. + * + * A true color image is an image where the pixel storage contains + * several color planes. In a 24 bit RGB color model, these planes + * are red, green and blue. In a true color image the stream of bytes + * can be stored in several different ways, thus defining the + * interlace (or interleaving) mode. The 2 most used types of interlace mode + * are interlace by pixel and interlace by plane. In the 24 bit RGB color + * model example, interlace by plane means all the red components for the + * entire dataset are stored first, followed by all the green components, + * and then by all the blue components. Interlace by pixel in this example + * means that for each pixel the sequence red, green, blue is defined. + * In this function, the interlace mode is defined in the parameter + * \p interlace, a string that can have the values INTERLACE_PIXEL + * or INTERLACE_PLANE. + * + */ +H5_HLDLL herr_t H5IMmake_image_24bit(hid_t loc_id, const char *dset_name, hsize_t width, hsize_t height, + const char *interlace, const unsigned char *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Gets information about an image dataset + * (dimensions, interlace mode and number of associated palettes). + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset + * \param[out] width The width of the image + * \param[out] height The height of the image + * \param[out] planes The number of color planes of the image + * \param[out] interlace The interlace mode of the image + * \param[out] npals The number of palettes associated to the image + * + * \return \herr_t + * + * \details H5IMget_image_info() gets information about an image + * named \p dset_name attached to the file or group specified + * by the identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5IMget_image_info(hid_t loc_id, const char *dset_name, hsize_t *width, hsize_t *height, + hsize_t *planes, char *interlace, hssize_t *npals); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Reads image data from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[out] buffer Buffer with data to store the image + * + * \return \herr_t + * + * \details H5IMread_image() reads a dataset named \p dset_name + * attached to the file or group specified by the + * identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5IMread_image(hid_t loc_id, const char *dset_name, unsigned char *buffer); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Creates and writes a palette. + * + * \fg_loc_id + * \param[in] pal_name The name of the palette + * \param[in] pal_dims An array of the size of the palette dimensions + * \param[in] pal_data Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5IMmake_palette() creates and writes a dataset + * named \p pal_name. Attributes conforming to the HDF5 Image and + * Palette specification are attached to the dataset, thus + * identifying it as a palette. The palette data is of the + * type #H5T_NATIVE_UCHAR. + * + */ +H5_HLDLL herr_t H5IMmake_palette(hid_t loc_id, const char *pal_name, const hsize_t *pal_dims, + const unsigned char *pal_data); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Attaches a palette to an image. + * + * \fg_loc_id + * \param[in] image_name The name of the dataset to attach the palette to + * \param[in] pal_name The name of the palette + * + * \return \herr_t + * + * \details H5IMlink_palette() attaches a palette named \p pal_name + * to an image specified by \p image_name. The image dataset + * may or not already have an attached palette. If it has, + * the array of palette references is extended to hold the reference + * to the new palette. + * + */ +H5_HLDLL herr_t H5IMlink_palette(hid_t loc_id, const char *image_name, const char *pal_name); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Dettaches a palette from an image. + * + * \fg_loc_id + * \param[in] image_name The name of the image dataset + * \param[in] pal_name The name of the palette + * + * \return \herr_t + * + * \details H5IMunlink_palette() dettaches a palette from an image + * specified by \p image_name. + * + */ +H5_HLDLL herr_t H5IMunlink_palette(hid_t loc_id, const char *image_name, const char *pal_name); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Gets the number of palettes associated to an image. + * + * \fg_loc_id + * \param[in] image_name The name of the image dataset + * \param[out] npals The number of palettes + * + * \return \herr_t + * + * \details H5IMget_npalettes() gets the number of palettes associated to + * an image specified by \p image_name. + * + */ +H5_HLDLL herr_t H5IMget_npalettes(hid_t loc_id, const char *image_name, hssize_t *npals); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Gets information about a palette dataset (dimensions). + * + * \fg_loc_id + * \param[in] image_name The name of the image dataset + * \param[in] pal_number The zero based index that identifies + * the palette + * \param[out] pal_dims The dimensions of the palette dataset + * + * \return \herr_t + * + * \details H5IMget_palette_info() gets the dimensions of the palette + * dataset identified by \p pal_number (a zero based index) + * associated to an image specified by \p image_name. + * + */ +H5_HLDLL herr_t H5IMget_palette_info(hid_t loc_id, const char *image_name, int pal_number, hsize_t *pal_dims); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Gets the palette dataset. + * + * \fg_loc_id + * \param[in] image_name The name of the image dataset + * \param[in] pal_number The zero based index that identifies + * the palette + * \param[out] pal_data The palette dataset + * + * \return \herr_t + * + * \details H5IMget_palette() gets the palette dataset identified + * by \p pal_number (a zero based index) associated to an + * image specified by \p image_name. + * + */ +H5_HLDLL herr_t H5IMget_palette(hid_t loc_id, const char *image_name, int pal_number, + unsigned char *pal_data); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Inquires if a dataset is an image. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset + * + * \return \htri_t + * + * \details H5IMis_image() inquires if a dataset named \p dset_name, + * attached to the file or group specified by the identifier + * \p loc_id, is an image based on the HDF5 Image and Palette + * Specification. + * + */ +H5_HLDLL herr_t H5IMis_image(hid_t loc_id, const char *dset_name); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5IM + * + * \brief Inquires if a dataset is a palette + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset + * + * \return \htri_t + * + * \details H5IMis_palette() inquires if a dataset named \p dset_name, + * attached to the file or group specified by the + * identifier \p loc_id, is a palette based on the HDF5 + * Image and Palette Specification. + * + */ +H5_HLDLL herr_t H5IMis_palette(hid_t loc_id, const char *dset_name); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5IdComponent.h b/externals/coda-oss/modules/drivers/hdf5/include/H5IdComponent.h index 383d42d333..d64bdb5ab7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5IdComponent.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5IdComponent.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Idevelop.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Idevelop.h index 13e3a834bb..d0ff200ee6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Idevelop.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Idevelop.h @@ -2,10 +2,10 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Imodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Imodule.h index cd1cbcd3df..e6828506d1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Imodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Imodule.h @@ -11,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * * Purpose: This file contains declarations which define macros for the * H5I package. Including this header means that the source file * is part of the H5I package. @@ -28,7 +25,12 @@ #define H5_MY_PKG H5I #define H5_MY_PKG_ERR H5E_ID -/**\defgroup H5I H5I +/** \page H5I_UG The HDF5 Identifiers + * @todo Under Construction + */ + +/** + * \defgroup H5I Identifiers (H5I) * * Use the functions in this module to manage identifiers defined by the HDF5 * library. See \ref H5IUD for user-defined identifiers and identifier diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Include.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Include.h index e662d906f4..a55cbe4f4c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Include.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Include.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5IntType.h b/externals/coda-oss/modules/drivers/hdf5/include/H5IntType.h index d6d4c44245..170ed374d4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5IntType.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5IntType.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Ipkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Ipkg.h index e368ef4db1..1009ecb625 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Ipkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Ipkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Thursday, May 15, 2003 - * - * Purpose: This file contains declarations which are visible only within - * the H5I package. Source files outside the H5I package should - * include H5Iprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5I package. Source files outside the H5I package should + * include H5Iprivate.h instead. */ #if !(defined H5I_FRIEND || defined H5I_MODULE) #error "Do not include this file outside the H5I package!" diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Iprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Iprivate.h index 3eaa3de7db..e59f928426 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Iprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Iprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Ipublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Ipublic.h index d6892bb182..ce78ae3c0f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Ipublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Ipublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -18,8 +17,7 @@ #ifndef H5Ipublic_H #define H5Ipublic_H -/* Public headers needed by this file */ -#include "H5public.h" +#include "H5public.h" /* Generic Functions */ /** * Library type values. @@ -77,13 +75,15 @@ typedef int64_t hid_t; #define H5I_INVALID_HID (-1) /** - * A function for freeing objects. This function will be called with an object - * ID type number and a pointer to the object. The function should free the - * object and return non-negative to indicate that the object - * can be removed from the ID type. If the function returns negative - * (failure) then the object will remain in the ID type. + * A function for freeing objects. This function will be called with a pointer + * to the object and a pointer to a pointer to the asynchronous request object. + * The function should free the object and return non-negative to indicate that + * the object can be removed from the ID type. If the function returns negative + * (failure) then the object will remain in the ID type. For asynchronous + * operations and handling the request parameter, see the HDF5 user guide and + * VOL connector author guide. */ -typedef herr_t (*H5I_free_t)(void *, void **); +typedef herr_t (*H5I_free_t)(void *obj, void **request); /** * The type of a function to compare objects & keys @@ -144,7 +144,7 @@ H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object); * * \note H5Iobject_verify() does not change the ID it is called on in any way * (as opposed to H5Iremove_verify(), which removes the ID from its - * type’s hash table). + * type's hash table). * * \see H5Iregister() * @@ -234,7 +234,7 @@ H5_DLL hid_t H5Iget_file_id(hid_t id); * \brief Retrieves a name of an object based on the object identifier * * \obj_id{id} - * \param[out] name A buffer for thename associated with the identifier + * \param[out] name A buffer for the name associated with the identifier * \param[in] size The size of the \p name buffer; usually the size of * the name in bytes plus 1 for a NULL terminator * @@ -335,27 +335,27 @@ H5_DLL int H5Iinc_ref(hid_t id); * * The reference count for a newly created object will be 1. Reference * counts for objects may be explicitly modified with this function or - * with H5Iinc_ref(). When an object identifier’s reference count + * with H5Iinc_ref(). When an object identifier's reference count * reaches zero, the object will be closed. Calling an object - * identifier’s \c close function decrements the reference count for - * the identifier which normally closes the object, but if the + * identifier's \c close function decrements the reference count for + * the identifier, which normally closes the object, but if the * reference count for the identifier has been incremented with * H5Iinc_ref(), the object will only be closed when the reference * count reaches zero with further calls to this function or the - * object identifier’s \c close function. + * object identifier's \c close function. * * If the object ID was created by a collective parallel call (such as * H5Dcreate(), H5Gopen(), etc.), the reference count should be * modified by all the processes which have copies of the ID. - * Generally this means that group, dataset, attribute, file and named + * Generally, this means that group, dataset, attribute, file and named * datatype IDs should be modified by all the processes and that all * other types of IDs are safe to modify by individual processes. * - * This function is of particular value when an application is - * maintaining multiple copies of an object ID. The object ID can be + * This function is of particular value when an application + * maintains multiple copies of an object ID. The object ID can be * incremented when a copy is made. Each copy of the ID can then be * safely closed or decremented and the HDF5 object will be closed - * when the reference count for that that object drops to zero. + * when the reference count for that object drops to zero. * * \since 1.6.2 * @@ -454,9 +454,9 @@ H5_DLL herr_t H5Iclear_type(H5I_type_t type, hbool_t force); * identifiers of this type are destroyed and no new identifiers of * this type can be registered. * - * The type’s free function is called on all of the identifiers which + * The type's free function is called on all of the identifiers which * are deleted by this function, freeing their memory. In addition, - * all memory used by this type’s hash table is freed. + * all memory used by this type's hash table is freed. * * Since the H5I_type_t values of destroyed identifier types are * reused when new types are registered, it is a good idea to set the @@ -588,6 +588,9 @@ H5_DLL void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key); * to continue, as long as there are other identifiers remaining in * type. * + * \warning Adding or removing members of the identifier type during iteration + * will lead to undefined behavior. + * * \since 1.12.0 * */ @@ -642,7 +645,7 @@ H5_DLL htri_t H5Itype_exists(H5I_type_t type); * \details Valid identifiers are those that have been obtained by an * application and can still be used to access the original target. * Examples of invalid identifiers include: - * \li Out of range values: negative, for example + * \li Out-of-range values: negative, for example * \li Previously-valid identifiers that have been released: * for example, a dataset identifier for which the dataset has * been closed @@ -650,7 +653,7 @@ H5_DLL htri_t H5Itype_exists(H5I_type_t type); * H5Iis_valid() can be used with any type of identifier: object * identifier, property list identifier, attribute identifier, error * message identifier, etc. When necessary, a call to H5Iget_type() - * can determine the type of the object that \p id identifies. + * can determine the type of object that the \p id identifies. * * \since 1.8.3 * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5LDpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5LDpublic.h new file mode 100644 index 0000000000..1eee8b4f19 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5LDpublic.h @@ -0,0 +1,167 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5LDpublic_H +#define H5LDpublic_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Retrieves the current dimension sizes of a dataset. + * + * \param[in] did The dataset identifier + * \param[out] cur_dims The current dimension sizes of the dataset + * + * \return \herr_t + * + * \details H5LDget_dset_dims() retrieves the current dimension sizes + * for the dataset \p did through the parameter \p cur_dims. + * It will return failure if \p cur_dims is NULL. + * + * \note See Also: + * \note Dataset Watch functions (used with h5watch): + * - H5LDget_dset_dims() + * - H5LDget_dset_elmts() + * - H5LDget_dset_type_size() + * + * \par Example: + * See the example code in H5LDget_dset_elmts() for usage of this routine. + * + * \since 1.10.0 + * + */ +H5_HLDLL herr_t H5LDget_dset_dims(hid_t did, hsize_t *cur_dims); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Returns the size in bytes of the dataset's datatype + * + * \param[in] did The dataset identifier + * \param[in] fields The pointer to a comma-separated list of fields for a compound datatype + * + * \return If successful, returns the size in bytes of the + * dataset's datatype. Otherwise, returns 0. + * + * \details H5LDget_dset_type_size() allows the user to find out the datatype + * size for the dataset associated with \p did. If the + * parameter \p fields is NULL, this routine just returns the size + * of the dataset's datatype. If the dataset has a compound datatype + * and \p fields is non-NULL, this routine returns the size of the + * datatype(s) for the selected fields specified in \p fields. + * Note that ’,’ is the separator for the fields of a compound + * datatype while ’.’ (dot) is the separator for a nested field. + * Use a backslash ( \ ) to escape characters in field names that + * conflict with these two separators. + * + * \note See Also: + * \note Dataset Watch functions (used with h5watch): + * - H5LDget_dset_dims() + * - H5LDget_dset_elmts() + * - H5LDget_dset_type_size() + * + * \par Example: + * See the example code in H5LDget_dset_elmts() for usage of this routine. + * + * \since 1.10.0 + * + */ +H5_HLDLL size_t H5LDget_dset_type_size(hid_t did, const char *fields); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Retrieves selected data from the dataset + * + * \param[in] did The dataset identifier + * \param[in] prev_dims The previous dimension size of the dataset + * \param[in] cur_dims The current dimension sizes of the dataset + * \param[in] fields A string containing a comma-separated list + * of fields for a compound datatype + * \param[out] buf Buffer for storing data retrieved from the + * dataset + * + * \return \herr_t + * + * \details H5LDget_dset_dims() retrieves selected data of the dataset + * \p did and stores the data in the parameter \p buf. + * The difference between the parameters \p prev_dims and + * \p cur_dims indicates the dimension sizes of the data to be + * selected from the dataset. Note that \p cur_dims must have + * at least one dimension whose size is greater than the + * corresponding dimension in \p prev_dims. Users can + * determine the size of buf by multiplying the datatype + * size of the dataset by the number of selected elements. + * + * If the parameter \p fields is NULL, this routine returns + * data for the selected elements of the dataset. If \p fields + * is not NULL and the dataset has a compound datatype, \p fields + * is a string containing a comma-separated list of fields. + * Each name in \p fields specifies a field in the compound + * datatype, and this routine returns data of the selected fields + * for the dataset's selected elements. Note that ’,’ is the + * separator for the fields of a compound datatype while + * ’.’ is the separator for a nested field. Use backslash to + * escape characters in field names that conflict with these + * two separators. + * + * \note See Also: + * \note Dataset Watch functions (used with h5watch): + * - H5LDget_dset_dims() + * - H5LDget_dset_elmts() + * - H5LDget_dset_type_size() + * + * \par Examples: + * + * For the first example, \c DSET1 is a two-dimensional chunked dataset with atomic type defined below: + * \snippet H5LDget_dset_elmts.c first_declare + * + * The following coding sample illustrates the reading of + * data elements appended to the dataset \c DSET1: + * \snippet H5LDget_dset_elmts.c first_reading + * + * The output buffer will contain data elements selected from + * \c DSET1 as follows: + * \snippet H5LDget_dset_elmts.c first_output + * + * For the second example, DSET2 is a one-dimensional chunked dataset + * with compound type defined below: + * \snippet H5LDget_dset_elmts.c second_declare + * + * The following coding sample illustrates the reading of data elements + * appended to the dataset \c DSET2 with compound datatype. + * This example selects only 2 fields: the fourth field \c d and a + * subfield of the sixth field \c s2.c: + * \snippet H5LDget_dset_elmts.c second_reading + * + * The output buffer will contain data for \c d and \c s2.c + * selected from \c DSET2 as follows: + * \snippet H5LDget_dset_elmts.c second_output + * + * \since 1.10.0 + * + */ +H5_HLDLL herr_t H5LDget_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims, + const char *fields, void *buf); + +#ifdef __cplusplus +} +#endif + +#endif /* H5LDpublic_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5LTparse.h b/externals/coda-oss/modules/drivers/hdf5/include/H5LTparse.h new file mode 100644 index 0000000000..84c5fd0932 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5LTparse.h @@ -0,0 +1,142 @@ +/* A Bison parser, made by GNU Bison 3.8.2. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + +#ifndef YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED +# define YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif +#if YYDEBUG +extern int H5LTyydebug; +#endif + +/* Token kinds. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + H5T_STD_I8BE_TOKEN = 258, /* H5T_STD_I8BE_TOKEN */ + H5T_STD_I8LE_TOKEN = 259, /* H5T_STD_I8LE_TOKEN */ + H5T_STD_I16BE_TOKEN = 260, /* H5T_STD_I16BE_TOKEN */ + H5T_STD_I16LE_TOKEN = 261, /* H5T_STD_I16LE_TOKEN */ + H5T_STD_I32BE_TOKEN = 262, /* H5T_STD_I32BE_TOKEN */ + H5T_STD_I32LE_TOKEN = 263, /* H5T_STD_I32LE_TOKEN */ + H5T_STD_I64BE_TOKEN = 264, /* H5T_STD_I64BE_TOKEN */ + H5T_STD_I64LE_TOKEN = 265, /* H5T_STD_I64LE_TOKEN */ + H5T_STD_U8BE_TOKEN = 266, /* H5T_STD_U8BE_TOKEN */ + H5T_STD_U8LE_TOKEN = 267, /* H5T_STD_U8LE_TOKEN */ + H5T_STD_U16BE_TOKEN = 268, /* H5T_STD_U16BE_TOKEN */ + H5T_STD_U16LE_TOKEN = 269, /* H5T_STD_U16LE_TOKEN */ + H5T_STD_U32BE_TOKEN = 270, /* H5T_STD_U32BE_TOKEN */ + H5T_STD_U32LE_TOKEN = 271, /* H5T_STD_U32LE_TOKEN */ + H5T_STD_U64BE_TOKEN = 272, /* H5T_STD_U64BE_TOKEN */ + H5T_STD_U64LE_TOKEN = 273, /* H5T_STD_U64LE_TOKEN */ + H5T_NATIVE_CHAR_TOKEN = 274, /* H5T_NATIVE_CHAR_TOKEN */ + H5T_NATIVE_SCHAR_TOKEN = 275, /* H5T_NATIVE_SCHAR_TOKEN */ + H5T_NATIVE_UCHAR_TOKEN = 276, /* H5T_NATIVE_UCHAR_TOKEN */ + H5T_NATIVE_SHORT_TOKEN = 277, /* H5T_NATIVE_SHORT_TOKEN */ + H5T_NATIVE_USHORT_TOKEN = 278, /* H5T_NATIVE_USHORT_TOKEN */ + H5T_NATIVE_INT_TOKEN = 279, /* H5T_NATIVE_INT_TOKEN */ + H5T_NATIVE_UINT_TOKEN = 280, /* H5T_NATIVE_UINT_TOKEN */ + H5T_NATIVE_LONG_TOKEN = 281, /* H5T_NATIVE_LONG_TOKEN */ + H5T_NATIVE_ULONG_TOKEN = 282, /* H5T_NATIVE_ULONG_TOKEN */ + H5T_NATIVE_LLONG_TOKEN = 283, /* H5T_NATIVE_LLONG_TOKEN */ + H5T_NATIVE_ULLONG_TOKEN = 284, /* H5T_NATIVE_ULLONG_TOKEN */ + H5T_IEEE_F32BE_TOKEN = 285, /* H5T_IEEE_F32BE_TOKEN */ + H5T_IEEE_F32LE_TOKEN = 286, /* H5T_IEEE_F32LE_TOKEN */ + H5T_IEEE_F64BE_TOKEN = 287, /* H5T_IEEE_F64BE_TOKEN */ + H5T_IEEE_F64LE_TOKEN = 288, /* H5T_IEEE_F64LE_TOKEN */ + H5T_NATIVE_FLOAT_TOKEN = 289, /* H5T_NATIVE_FLOAT_TOKEN */ + H5T_NATIVE_DOUBLE_TOKEN = 290, /* H5T_NATIVE_DOUBLE_TOKEN */ + H5T_NATIVE_LDOUBLE_TOKEN = 291, /* H5T_NATIVE_LDOUBLE_TOKEN */ + H5T_STRING_TOKEN = 292, /* H5T_STRING_TOKEN */ + STRSIZE_TOKEN = 293, /* STRSIZE_TOKEN */ + STRPAD_TOKEN = 294, /* STRPAD_TOKEN */ + CSET_TOKEN = 295, /* CSET_TOKEN */ + CTYPE_TOKEN = 296, /* CTYPE_TOKEN */ + H5T_VARIABLE_TOKEN = 297, /* H5T_VARIABLE_TOKEN */ + H5T_STR_NULLTERM_TOKEN = 298, /* H5T_STR_NULLTERM_TOKEN */ + H5T_STR_NULLPAD_TOKEN = 299, /* H5T_STR_NULLPAD_TOKEN */ + H5T_STR_SPACEPAD_TOKEN = 300, /* H5T_STR_SPACEPAD_TOKEN */ + H5T_CSET_ASCII_TOKEN = 301, /* H5T_CSET_ASCII_TOKEN */ + H5T_CSET_UTF8_TOKEN = 302, /* H5T_CSET_UTF8_TOKEN */ + H5T_C_S1_TOKEN = 303, /* H5T_C_S1_TOKEN */ + H5T_FORTRAN_S1_TOKEN = 304, /* H5T_FORTRAN_S1_TOKEN */ + H5T_OPAQUE_TOKEN = 305, /* H5T_OPAQUE_TOKEN */ + OPQ_SIZE_TOKEN = 306, /* OPQ_SIZE_TOKEN */ + OPQ_TAG_TOKEN = 307, /* OPQ_TAG_TOKEN */ + H5T_COMPOUND_TOKEN = 308, /* H5T_COMPOUND_TOKEN */ + H5T_ENUM_TOKEN = 309, /* H5T_ENUM_TOKEN */ + H5T_ARRAY_TOKEN = 310, /* H5T_ARRAY_TOKEN */ + H5T_VLEN_TOKEN = 311, /* H5T_VLEN_TOKEN */ + STRING = 312, /* STRING */ + NUMBER = 313 /* NUMBER */ + }; + typedef enum yytokentype yytoken_kind_t; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +union YYSTYPE +{ +#line 68 "hl/src//H5LTparse.y" + + int ival; /*for integer token*/ + char *sval; /*for name string*/ + hid_t hid; /*for hid_t token*/ + +#line 128 "hl/src//H5LTparse.h" + +}; +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE H5LTyylval; + + +hid_t H5LTyyparse (void); + + +#endif /* !YY_H5LTYY_HL_SRC_H5LTPARSE_H_INCLUDED */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5LTprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5LTprivate.h new file mode 100644 index 0000000000..bea2e63c8e --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5LTprivate.h @@ -0,0 +1,30 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5LTprivate_H +#define H5LTprivate_H + +/* High-level library internal header file */ +#include "H5HLprivate2.h" + +/* public LT prototypes */ +#include "H5LTpublic.h" + +H5_HLDLL herr_t H5LT_get_attribute_disk(hid_t obj_id, const char *attr_name, void *data); +H5_HLDLL herr_t H5LT_set_attribute_numerical(hid_t loc_id, const char *obj_name, const char *attr_name, + size_t size, hid_t type_id, const void *data); +H5_HLDLL herr_t H5LT_set_attribute_string(hid_t dset_id, const char *name, const char *buf); +H5_HLDLL char *H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, + bool no_user_buf); +H5_HLDLL hid_t H5LTyyparse(void); + +#endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5LTpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5LTpublic.h new file mode 100644 index 0000000000..1ce5c81d3e --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5LTpublic.h @@ -0,0 +1,1643 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5LTpublic_H +#define H5LTpublic_H + +/* Flag definitions for H5LTopen_file_image() */ +#define H5LT_FILE_IMAGE_OPEN_RW 0x0001 /* Open image for read-write */ +#define H5LT_FILE_IMAGE_DONT_COPY 0x0002 /* The HDF5 lib won't copy */ +/* user supplied image buffer. The same image is open with the core driver. */ +#define H5LT_FILE_IMAGE_DONT_RELEASE 0x0004 /* The HDF5 lib won't */ +/* deallocate user supplied image buffer. The user application is responsible */ +/* for doing so. */ +#define H5LT_FILE_IMAGE_ALL 0x0007 + +typedef enum H5LT_lang_t { + H5LT_LANG_ERR = -1, /*this is the first*/ + H5LT_DDL = 0, /*for DDL*/ + H5LT_C = 1, /*for C*/ + H5LT_FORTRAN = 2, /*for Fortran*/ + H5LT_NO_LANG = 3 /*this is the last*/ +} H5LT_lang_t; + +#ifdef __cplusplus +extern "C" { +#endif + +/** \page H5LT_UG The HDF5 High Level Lite + * @todo Under Construction + */ + +/**\defgroup H5LT HDF5 Lite APIs (H5LT,H5LD) + * Functions used to simplify creating and manipulating datasets, + * attributes and other features (H5LT, H5LD) + * + * The HDF5 Lite API consists of higher-level functions which do + * more operations per call than the basic HDF5 interface. + * The purpose is to wrap intuitive functions around certain sets + * of features in the existing APIs. + * It has the following sets of functions listed below. + * + * \note \Bold{Programming hints:} + * \note To use any of these functions or subroutines, + * you must first include the relevant include file (C) or + * module (Fortran) in your application. + * \note The following line includes the HDF5 Lite package, H5LT, + * in C applications: + * \code #include "hdf5_hl.h" \endcode + * \note This line includes the H5LT module in Fortran applications: + * \code use h5lt \endcode + * + * + * + *
+ * + * - Dataset Functions + * - Make dataset functions + * - \ref H5LTmake_dataset + * - \ref H5LTmake_dataset_char + * - \ref H5LTmake_dataset_short + * - \ref H5LTmake_dataset_int + * - \ref H5LTmake_dataset_long + * - \ref H5LTmake_dataset_float + * - \ref H5LTmake_dataset_double + * - \ref H5LTmake_dataset_string + * + * - Read dataset functions + * - \ref H5LTread_dataset + * - \ref H5LTread_dataset_char + * - \ref H5LTread_dataset_short + * - \ref H5LTread_dataset_int + * - \ref H5LTread_dataset_long + * - \ref H5LTread_dataset_float + * - \ref H5LTread_dataset_double + * - \ref H5LTread_dataset_string + * + * - Query dataset functions + * - \ref H5LTfind_dataset + * - \ref H5LTget_dataset_ndims + * - \ref H5LTget_dataset_info + * + * - Dataset watch functions + * - \ref H5LDget_dset_dims + * - \ref H5LDget_dset_elmts + * - \ref H5LDget_dset_type_size + * + * + * + * - Attribute Functions + * - Set attribute functions + * - \ref H5LTset_attribute_string + * - \ref H5LTset_attribute_char + * - \ref H5LTset_attribute_uchar + * - \ref H5LTset_attribute_short + * - \ref H5LTset_attribute_ushort + * - \ref H5LTset_attribute_int + * - \ref H5LTset_attribute_uint + * - \ref H5LTset_attribute_long + * - \ref H5LTset_attribute_long_long + * - \ref H5LTset_attribute_ulong + * - \ref H5LTset_attribute_ullong + * - \ref H5LTset_attribute_float + * - \ref H5LTset_attribute_double + * - H5LTset_attribute_f (fortran ONLY) + * + * - Get attribute functions + * - \ref H5LTget_attribute + * - \ref H5LTget_attribute_string + * - \ref H5LTget_attribute_char + * - \ref H5LTget_attribute_uchar + * - \ref H5LTget_attribute_short + * - \ref H5LTget_attribute_ushort + * - \ref H5LTget_attribute_int + * - \ref H5LTget_attribute_uint + * - \ref H5LTget_attribute_long + * - \ref H5LTget_attribute_long_long + * - \ref H5LTget_attribute_ulong + * - \ref H5LTget_attribute_ullong + * - \ref H5LTget_attribute_float + * - \ref H5LTget_attribute_double + * + * - Query attribute functions + * - \ref H5LTfind_attribute + * - \ref H5LTget_attribute_info + * - \ref H5LTget_attribute_ndims + * + * + * + * - Datatype Functions + * - Datatype translation functions + * - \ref H5LTtext_to_dtype + * - \ref H5LTdtype_to_text + * + * - File image function + * - Open file image function + * - \ref H5LTopen_file_image + * + * - Path and object function + * - Query path and object function + * - \ref H5LTpath_valid + * + *
+ * + */ + +/*------------------------------------------------------------------------- + * + * Make dataset functions + * + *------------------------------------------------------------------------- + */ + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset of a type \p type_id. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] type_id Identifier of the datatype to use when creating the dataset + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset() creates and writes a dataset named + * \p dset_name attached to the object specified by the + * identifier \p loc_id. + * + * The parameter \p type_id can be any valid HDF5 Prdefined \ref PDTNAT; + * For example, setting \p type_id to #H5T_NATIVE_INT will result in a dataset + * of signed \e integer datatype. + * + * \version 1.10.0 Fortran 2003 subroutine added to accept a C address of the data buffer. + * \version 1.8.7 Fortran subroutine modified in this release to accommodate arrays + * with more than three dimensions. + * + */ +H5_HLDLL herr_t H5LTmake_dataset(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, + hid_t type_id, const void *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_char() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset's datatype will be \e character, #H5T_NATIVE_CHAR. + * + */ +H5_HLDLL herr_t H5LTmake_dataset_char(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, + const char *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_short() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset's datatype will be short signed integer, + * #H5T_NATIVE_SHORT. + * + */ +H5_HLDLL herr_t H5LTmake_dataset_short(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, + const short *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_int() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset's datatype will be native signed integer, + * #H5T_NATIVE_INT. + * + * \version Fortran subroutine modified in this release to accommodate + * arrays with more than three dimensions. + * + */ +H5_HLDLL herr_t H5LTmake_dataset_int(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, + const int *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_long() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset's datatype will be long signed integer, + * #H5T_NATIVE_LONG. + * + */ +H5_HLDLL herr_t H5LTmake_dataset_long(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, + const long *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_float() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset's datatype will be native floating point, + * #H5T_NATIVE_FLOAT. + * + * \version 1.8.7 Fortran subroutine modified in this release to accommodate + * arrays with more than three dimensions. + * + */ +H5_HLDLL herr_t H5LTmake_dataset_float(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, + const float *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset. + * + * \fg_loc_id + * \param[in] dset_name The Name of the dataset to create + * \param[in] rank Number of dimensions of dataspace + * \param[in] dims An array of the size of each dimension + * \param[in] buffer Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_double() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset's datatype will be + * native floating-point double, #H5T_NATIVE_DOUBLE. + * + * \version 1.8.7 Fortran subroutine modified in this release to accommodate + * arrays with more than three dimensions. + * + */ +H5_HLDLL herr_t H5LTmake_dataset_double(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, + const double *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a dataset with string datatype. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[in] buf Buffer with data to be written to the dataset + * + * \return \herr_t + * + * \details H5LTmake_dataset_string() creates and writes a dataset + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + * The dataset's datatype will be C string, #H5T_C_S1. + * + */ +H5_HLDLL herr_t H5LTmake_dataset_string(hid_t loc_id, const char *dset_name, const char *buf); + +/*------------------------------------------------------------------------- + * + * Read dataset functions + * + *------------------------------------------------------------------------- + */ + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[in] type_id Identifier of the datatype to use when reading + * the dataset + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * + * \version 1.10.0 Fortran 2003 subroutine added to accept a C + * address of the data buffer. + * \version 1.8.7 Fortran subroutine modified in this release to + * accommodate arrays with more than three dimensions. + * + */ +H5_HLDLL herr_t H5LTread_dataset(hid_t loc_id, const char *dset_name, hid_t type_id, void *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_char() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_CHAR. + * + */ +H5_HLDLL herr_t H5LTread_dataset_char(hid_t loc_id, const char *dset_name, char *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_short() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_SHORT. + * + */ +H5_HLDLL herr_t H5LTread_dataset_short(hid_t loc_id, const char *dset_name, short *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_int() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_INT. + * + * \version 1.8.7 Fortran subroutine modified in this release to + * accommodate arrays with more than three dimensions. + * + */ +H5_HLDLL herr_t H5LTread_dataset_int(hid_t loc_id, const char *dset_name, int *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_long() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_LONG. + * + */ +H5_HLDLL herr_t H5LTread_dataset_long(hid_t loc_id, const char *dset_name, long *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_float() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_FLOAT. + * + * \version 1.8.7 Fortran subroutine modified in this release to + * accommodate arrays with more than three dimensions. + */ +H5_HLDLL herr_t H5LTread_dataset_float(hid_t loc_id, const char *dset_name, float *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buffer Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_double() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_NATIVE_DOUBLE. + * + * \version 1.8.7 Fortran subroutine modified in this release to + * accommodate arrays with more than three dimensions. + */ +H5_HLDLL herr_t H5LTread_dataset_double(hid_t loc_id, const char *dset_name, double *buffer); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a dataset from disk. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] buf Buffer with data + * + * \return \herr_t + * + * \details H5LTread_dataset_string() reads a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * The HDF5 datatype is #H5T_C_S1. + * + */ +H5_HLDLL herr_t H5LTread_dataset_string(hid_t loc_id, const char *dset_name, char *buf); + +/*------------------------------------------------------------------------- + * + * Query dataset functions + * + *------------------------------------------------------------------------- + */ + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Gets the dimensionality of a dataset + * + * \param[in] loc_id Identifier of the object to + * locate the dataset within + * \param[in] dset_name The dataset name + * \param[out] rank The dimensionality of the dataset + * + * \return \herr_t + * + * \details H5LTget_dataset_ndims() gets the dimensionality of a dataset + * named \p dset_name exists attached to the object \p loc_id. + * + */ +H5_HLDLL herr_t H5LTget_dataset_ndims(hid_t loc_id, const char *dset_name, int *rank); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Retrieves information about a dataset + * + * \param[in] loc_id Identifier of the object to locate + * the dataset within + * \param[in] dset_name The dataset name + * \param[out] dims The dimensions of the dataset + * \param[out] type_class The class identifier. #H5T_class_t is defined in + * H5Tpublic.h. See H5Tget_class() for a list + * of class types. + * \param[out] type_size The size of the datatype in bytes + * + * \return \herr_t + * + * \details H5LTget_dataset_info() retrieves information about a dataset + * named \p dset_name attached to the object \p loc_id. + * + */ +H5_HLDLL herr_t H5LTget_dataset_info(hid_t loc_id, const char *dset_name, hsize_t *dims, + H5T_class_t *type_class, size_t *type_size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Determines whether a dataset exists. + * + * \param[in] loc_id Identifier of the group containing the dataset + * \param[in] name Dataset name + * + * \return \htri_t + * + * \details H5LTfind_dataset() determines whether a dataset named + * \p name exists in the group specified by \p loc_id. + * + * \p loc_id must be a group identifier and \p name must + * specify a dataset that is a member of that group. + * + */ +H5_HLDLL herr_t H5LTfind_dataset(hid_t loc_id, const char *name); + +/*------------------------------------------------------------------------- + * + * Set attribute functions + * + *------------------------------------------------------------------------- + */ + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes a string attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] attr_data Buffer with data to be written to the attribute + * + * \return \herr_t + * + * \details H5LTset_attribute_string() creates and writes a string attribute + * named \p attr_name and attaches it to the object specified by + * the name \p obj_name. If the attribute already exists, + * it is overwritten. + * + */ +H5_HLDLL herr_t H5LTset_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name, + const char *attr_data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_char() creates and writes a numerical attribute + * named \p attr_name and attaches it to the object specified by the + * name \p obj_name. The attribute has a dimensionality of 1. + * The HDF5 datatype of the attribute is #H5T_NATIVE_CHAR. + * + */ +H5_HLDLL herr_t H5LTset_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name, + const char *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_uchar() creates and writes a numerical attribute + * named \p attr_name and attaches it to the object specified by the + * name \p obj_name. The attribute has a dimensionality of 1. + * The HDF5 datatype of the attribute is #H5T_NATIVE_UCHAR. + * + */ +H5_HLDLL herr_t H5LTset_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name, + const unsigned char *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_short() creates and writes a numerical attribute + * named \p attr_name and attaches it to the object specified by the + * name \p obj_name. The attribute has a dimensionality of 1. + * The HDF5 datatype of the attribute is #H5T_NATIVE_SHORT. + * + */ +H5_HLDLL herr_t H5LTset_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name, + const short *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_ushort() creates and writes a numerical attribute + * named \p attr_name and attaches it to the object specified by the + * name \p obj_name. The attribute has a dimensionality of 1. + * The HDF5 datatype of the attribute is #H5T_NATIVE_USHORT. + * + */ +H5_HLDLL herr_t H5LTset_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name, + const unsigned short *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_int() creates and writes a numerical integer + * attribute named \p attr_name and attaches it to the object + * specified by the name \p obj_name. The attribute has a + * dimensionality of 1. The HDF5 datatype of the attribute + * is #H5T_NATIVE_INT. + * + */ +H5_HLDLL herr_t H5LTset_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name, + const int *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_uint() creates and writes a numerical integer + * attribute named \p attr_name and attaches it to the object specified + * by the name \p obj_name. The attribute has a dimensionality of 1. + * The HDF5 datatype of the attribute is #H5T_NATIVE_UINT. + * + */ +H5_HLDLL herr_t H5LTset_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name, + const unsigned int *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_long() creates and writes a numerical + * attribute named \p attr_name and attaches it to the object + * specified by the name \p obj_name. The attribute has a + * dimensionality of 1. The HDF5 datatype of the attribute + * is #H5T_NATIVE_LONG. + * + */ +H5_HLDLL herr_t H5LTset_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name, + const long *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Location of the object to which the attribute + * is to be attached + * \param[in] obj_name That object's name + * \param[in] attr_name Attribute name + * \param[in] buffer Attribute value + * \param[in] size Attribute size + * + * \return \herr_t + * + * \details H5LTset_attribute_long_long() creates and writes a numerical + * attribute named \p attr_name and attaches it to the object + * specified by the name \p obj_name. + * + * The attribute has a dimensionality of 1 and its HDF5 datatype + * is #H5T_NATIVE_LLONG. + * + */ +H5_HLDLL herr_t H5LTset_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name, + const long long *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_ulong() creates and writes a numerical + * attribute named \p attr_name and attaches it to the object + * specified by the name \p obj_name. The attribute has a + * dimensionality of 1. The HDF5 datatype of the attribute + * is #H5T_NATIVE_ULONG. + * + */ +H5_HLDLL herr_t H5LTset_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name, + const unsigned long *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Location of the object to which the attribute + * is to be attached + * \param[in] obj_name That object's name + * \param[in] attr_name Attribute name + * \param[in] buffer Attribute value + * \param[in] size Attribute size + * + * \return \herr_t + * + * \details H5LTset_attribute_ullong() creates and writes a numerical + * attribute named \p attr_name and attaches it to the object + * specified by the name \p obj_name. + * + * The attribute has a dimensionality of 1 and its HDF5 datatype + * is #H5T_NATIVE_ULLONG. + * + */ +H5_HLDLL herr_t H5LTset_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, + const unsigned long long *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_float() creates and writes a numerical + * floating point attribute named \p attr_name and attaches + * it to the object specified by the name \p obj_name. + * The attribute has a dimensionality of 1. The HDF5 datatype + * of the attribute is #H5T_NATIVE_FLOAT. + * + */ +H5_HLDLL herr_t H5LTset_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name, + const float *buffer, size_t size); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates and writes an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to create the attribute within + * \param[in] obj_name The name of the object to attach the attribute + * \param[in] attr_name The attribute name + * \param[in] buffer Buffer with data to be written to the attribute + * \param[in] size The size of the 1D array (one in the case of a + * scalar attribute). This value is used by + * H5Screate_simple() to create the dataspace. + * + * \return \herr_t + * + * \details H5LTset_attribute_double() creates and writes a numerical + * attribute named \p attr_name and attaches + * it to the object specified by the name \p obj_name. + * The attribute has a dimensionality of 1. The HDF5 datatype + * of the attribute is #H5T_NATIVE_DOUBLE. + * + */ +H5_HLDLL herr_t H5LTset_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name, + const double *buffer, size_t size); + +/*------------------------------------------------------------------------- + * + * Get attribute functions + * + *------------------------------------------------------------------------- + */ + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[in] mem_type_id Identifier of the memory datatype + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute() reads an attribute named + * \p attr_name with the memory type \p mem_type_id. + * + */ +H5_HLDLL herr_t H5LTget_attribute(hid_t loc_id, const char *obj_name, const char *attr_name, + hid_t mem_type_id, void *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_string() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The datatype is a string. + * + * \version 1.8.9 The content of the buffer returned by the Fortran + * subroutine has changed in this release:\n + * If the returned buffer requires padding, + * h5ltget_attribute_string_f() now employs space + * padding; this buffer was previously returned with a C NULL terminator. + * + */ +H5_HLDLL herr_t H5LTget_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name, + char *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_char() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The datatype of the attribute + * is #H5T_NATIVE_CHAR. + * + */ +H5_HLDLL herr_t H5LTget_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name, char *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_uchar() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_UCHAR + * + */ +H5_HLDLL herr_t H5LTget_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name, + unsigned char *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_short() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_SHORT + * + */ +H5_HLDLL herr_t H5LTget_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name, + short *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_ushort() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_USHORT. + * + */ +H5_HLDLL herr_t H5LTget_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name, + unsigned short *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_int() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_INT. + * + */ +H5_HLDLL herr_t H5LTget_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name, int *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_uint() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_INT. + * + */ +H5_HLDLL herr_t H5LTget_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name, + unsigned int *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_long() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_LONG. + * + */ +H5_HLDLL herr_t H5LTget_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name, long *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads a \e long \e long attribute. + * + * \param[in] loc_id Location of the object to which + * the attribute is attached + * \param[in] obj_name That object's name + * \param[in] attr_name Attribute name + * \param[out] data Attribute value + * + * \return \herr_t + * + * \details H5LTget_attribute_long_long() reads the attribute + * specified by \p loc_id and \p obj_name. + * + */ +H5_HLDLL herr_t H5LTget_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name, + long long *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_ulong() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_ULONG. + * + */ +H5_HLDLL herr_t H5LTget_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name, + unsigned long *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_ullong() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_ULLONG. + * + */ +H5_HLDLL herr_t H5LTget_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, + unsigned long long *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_float() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_FLOAT. + * + */ +H5_HLDLL herr_t H5LTget_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name, + float *data); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Reads an attribute from disk. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] data Buffer with data + * + * \return \herr_t + * + * \details H5LTget_attribute_double() reads an attribute named + * \p attr_name that is attached to the object specified + * by the name \p obj_name. The HDF5 datatype of the + * attribute is #H5T_NATIVE_DOUBLE. + * + */ +H5_HLDLL herr_t H5LTget_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name, + double *data); + +/*------------------------------------------------------------------------- + * + * Query attribute functions + * + *------------------------------------------------------------------------- + */ + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Gets the dimensionality of an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] rank The dimensionality of the attribute + * + * \return \herr_t + * + * \details H5LTget_attribute_ndims() gets the dimensionality of an attribute + * named \p attr_name that is attached to the object specified + * by the name \p obj_name. + * + */ +H5_HLDLL herr_t H5LTget_attribute_ndims(hid_t loc_id, const char *obj_name, const char *attr_name, int *rank); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Gets information about an attribute. + * + * \param[in] loc_id Identifier of the object (dataset or group) + * to read the attribute from + * \param[in] obj_name The name of the object that the attribute is + * attached to + * \param[in] attr_name The attribute name + * \param[out] dims The dimensions of the attribute + * \param[out] type_class The class identifier. #H5T_class_t is + * defined in H5Tpublic.h. For a list of valid class + * types see: H5Tget_class(). + * \param[out] type_size The size of the datatype in bytes + * + * \return \herr_t + * + * \details H5LTget_attribute_info() gets information about an attribute + * named \p attr_name attached to the object specified by + * the name \p obj_name. + * + * \par Example + * \snippet H5LT_examples.c get_attribute_info + * + */ +H5_HLDLL herr_t H5LTget_attribute_info(hid_t loc_id, const char *obj_name, const char *attr_name, + hsize_t *dims, H5T_class_t *type_class, size_t *type_size); + +/*------------------------------------------------------------------------- + * + * General functions + * + *------------------------------------------------------------------------- + */ + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates an HDF5 datatype given a text description. + * + * \param[in] text A character string containing a DDL + * definition of the datatype to be created + * \param[in] lang_type The language used to describe the datatype. + * The only currently supported language is + * #H5LT_DDL. + * + * \return Returns the datatype identifier(non-negative) if successful; + * otherwise returns a negative value. + * + * \details Given a text description of a datatype, this function creates + * an HDF5 datatype and returns the datatype identifier. + * The text description of the datatype has to comply with the + * \p lang_type definition of HDF5 datatypes. + * Currently, only the DDL(#H5LT_DDL) is supported. + * The complete DDL definition of HDF5 datatypes can be found in + * the last chapter of the + * + * HDF5 User's Guide. + * + * \par Example + * An example of DDL definition of \c enum type is shown as follows. + * \snippet H5LT_examples.c enum + * + */ +H5_HLDLL hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Creates a text description of an HDF5 datatype. + * + * \param[in] dtype Identifier of the datatype to be converted + * \param[out] str Buffer for the text description of the datatype + * \param[in] lang_type The language used to describe the datatype. + * The currently supported language is #H5LT_DDL. + * \param[out] len The size of buffer needed to store the text description + * + * \return \herr_t + * + * \details Given an HDF5 datatype identifier, this function creates + * a description of this datatype in \p lang_type language format. + * A preliminary H5LTdtype_to_text() call can be made to determine + * the size of the buffer needed with a NULL passed in for \p str. + * This value is returned as \p len. That value can then be assigned + * to len for a second H5Ttype_to_text() call, which will + * retrieve the actual text description for the datatype. + * + * If \p len is not big enough for the description, the text + * description will be truncated to fit in the buffer. + * + * Currently only DDL (#H5LT_DDL) is supported for \p lang_type. + * The complete DDL definition of HDF5 data types can be found in + * the last chapter of the + * + * HDF5 User's Guide. + * + * \par Example + * An example of DDL definition of \c enum type is shown as follows. + * \snippet H5LT_examples.c enum + * + */ +H5_HLDLL herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len); + +/*------------------------------------------------------------------------- + * + * Utility functions + * + *------------------------------------------------------------------------- + */ + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Determines whether an attribute exists. + * + * \param[in] loc_id Identifier of the object to which the attribute + * is expected to be attached + * \param[in] name Attribute name + * + * \return \htri_t + * + * \details H5LTfind_attribute() determines whether an attribute named + * \p name exists attached to the object specified + * by \p loc_id. + * + * \p loc_id must be an object identifier and \p name + * must specify an attribute that is expected to be attached + * to that object. + * + */ +H5_HLDLL herr_t H5LTfind_attribute(hid_t loc_id, const char *name); + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Determines whether an HDF5 path is valid and, optionally, + * whether the path resolves to an HDF5 object. + * + * \param[in] loc_id Identifier of an object in the file + * \param[in] path The path to the object to check; + * links in \p path may be of any type. + * \param[in] check_object_valid If TRUE, determine whether the final + * component of \p path resolves to + * an object; if FALSE, do not check. + * + * \return Upon success: + * \return If \p check_object_valid is set to \c FALSE: + * \return Returns \c TRUE if the path is valid; + * otherwise returns \c FALSE. + * \return If \p check_object_valid is set to \c TRUE: + * \return Returns \c TRUE if the path is valid and + * resolves to an HDF5 object; + * otherwise returns \c FALSE. + * + * \return Upon error, returns a negative value. + * + * \details H5LTpath_valid() checks the validity of \p path relative + * to the identifier of an object, \p loc_id. Optionally, + * \p check_object_valid can be set to determine whether the + * final component of \p path resolves to an HDF5 object; + * if not, the final component is a dangling link. + * + * The meaning of the function's return value depends on the + * value of \p check_object_valid: + * + * If \p check_object_valid is set to \c FALSE, H5LTpath_valid() + * will check all links in \p path to verify that they exist. + * If all the links in \p path exist, the function will + * return \c TRUE; otherwise the function will return \c FALSE. + * + * If \p check_object_valid is set to \c TRUE, + * H5LTpath_valid() will first check the links in \p path, + * as described above. If all the links exist, + * \p check_object_valid will then determine whether the final + * component of \p path resolves to an actual HDF5 object. + * H5LTpath_valid() will return \c TRUE if all the links in + * \p path exist and the final component resolves to an + * actual object; otherwise, it will return \c FALSE. + * + * \p path can be any one of the following: + * + * - An absolute path, which starts with a slash (\c /) + * indicating the file's root group, followed by the members + * - A relative path with respect to \p loc_id + * - A dot (\c .), if \p loc_id is the object identifier for + * the object itself. + * + * If \p path is an absolute path, then \p loc_id can be an + * identifier for any object in the file as it is used only to + * identify the file. If \p path is a relative path, then + * \p loc_id must be a file or a group identifier. + * + * \note + * Note on Behavior Change: + * The behavior of H5LTpath_valid() was changed in the 1.10.0 release + * in the case where the root group, “/”, is the value of path. + * This change is described below: + * - Let \p loc_id denote a valid HDF5 file identifier, and let + * \p check_object_valid be set to true or false. + * A call to H5LTpath_valid() with arguments \p loc_id, “/”, + * and \p check_object_valid returns a positive value; + * in other words, H5LTpath_valid(loc_id, "/", check_object_valid) + * returns a positive value. + * In HDF5 version 1.8.16, this function returns 0. + * - Let ‘root’ denote a valid HDF5 group identifier that refers + * to the root group of an HDF5 file, and let \p check_object_valid + * be set to true or false. + * A call to H5LTpath_valid() with arguments ‘root’, “/”, and + * \p check_object_valid returns a positive value; + * in other words, H5LTpath_valid(root, "/", check_object_valid) + * returns a positive value. + * In HDF5 version 1.8.16, this function returns 0. + * + * \version 1.10.0 Function behavior changed in this release. + * See the “Note on Behavior Change” section above. + * + */ +H5_HLDLL htri_t H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid); + +/*------------------------------------------------------------------------- + * + * File image operations functions + * + *------------------------------------------------------------------------- + */ + +/** + *------------------------------------------------------------------------- + * \ingroup H5LT + * + * \brief Opens an HDF5 file image in memory. + * + * \param[in] buf_ptr A pointer to the supplied initial image + * \param[in] buf_size Size of the supplied buffer + * \param[in] flags Flags specifying whether to open the image + * read-only or read/write, whether HDF5 is to + * take control of the buffer, and instruction + * regarding releasing the buffer. + * + * \return Returns a file identifier if successful; + * otherwise returns a negative value. + * \warning \Bold{Failure Modes:} + * \warning H5LTopen_file_image() will fail if either \p buf_ptr is NULL + * or \p buf_size equals 0 (zero). + * + * + * \details H5LTopen_file_image() opens the HDF5 file image that is + * located in system memory at the address indicated by + * \p buf_ptr of size \p buf_size. + * H5LTopen_file_image() opens a file image with the + * Core driver, #H5FD_CORE. + * + * A value of NULL for \p buf_ptr is invalid and will + * cause the function to fail. + * + * A value of 0 for \p buf_size is invalid and will cause + * the function to fail. + * + * The flags passed in \p flags specify whether to open the image + * read-only or read/write, whether HDF5 is to take control of the + * buffer, and instruction regarding releasing the buffer. + * Valid values are: + * - #H5LT_FILE_IMAGE_OPEN_RW + * - Specifies opening the file image in read/write mode. + * - Default without this flag: File image will be opened read-only. + * + * - #H5LT_FILE_IMAGE_DONT_COPY + * - Specifies to not copy the provided file image buffer; + * the buffer will be used directly. HDF5 will release the + * file image when finished. + * - Default without this flag: Copy the file image buffer and + * open the copied file image. + * + * - #H5LT_FILE_IMAGE_DONT_RELEASE + * - Specifies that HDF5 is not to release the buffer when + * the file opened with H5LTopen_file_image() is closed; + * releasing the buffer will be left to the application. + * - Default without this flag: HDF5 will automatically + * release the file image buffer after the file image is + * closed. This flag is valid only when used with + * #H5LT_FILE_IMAGE_DONT_COPY. + * + * \note **Motivation:** + * \note H5LTopen_file_image() and other elements of HDF5 + * are used to load an image of an HDF5 file into system memory + * and open that image as a regular HDF5 file. An application can + * then use the file without the overhead of disk I/O. + * + * \note **Recommended Reading:** + * \note This function is part of the file image operations feature set. + * It is highly recommended to study the guide + * + * HDF5 File Image Operations before using this feature set.\n + * See the “See Also” section below for links to other elements of + * HDF5 file image operations. + * + * \todo There is no "See Also" section??? + * + * \since 1.8.9 + */ +H5_HLDLL hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5LaccProp.h b/externals/coda-oss/modules/drivers/hdf5/include/H5LaccProp.h index accc7cd5b5..53389e2e68 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5LaccProp.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5LaccProp.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5LcreatProp.h b/externals/coda-oss/modules/drivers/hdf5/include/H5LcreatProp.h index 5570dbc2a1..233a98bd92 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5LcreatProp.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5LcreatProp.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Ldevelop.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Ldevelop.h index 04eb0ffd1c..148a5a5746 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Ldevelop.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Ldevelop.h @@ -2,10 +2,10 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -30,6 +30,16 @@ */ #define H5L_LINK_CLASS_T_VERS 1 +/** + * \brief Version of external link format + */ +#define H5L_EXT_VERSION 0 + +/** + * \brief Valid flags for external links + */ +#define H5L_EXT_FLAGS_ALL 0 + /*******************/ /* Public Typedefs */ /*******************/ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Library.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Library.h index 3df8d56d9b..3770639155 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Library.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Library.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Lmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Lmodule.h index d52690e919..26f9045334 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Lmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Lmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5L package. Including this header means that the source file - * is part of the H5L package. + * Purpose: This file contains declarations which define macros for the + * H5L package. Including this header means that the source file + * is part of the H5L package. */ #ifndef H5Lmodule_H #define H5Lmodule_H @@ -28,7 +25,12 @@ #define H5_MY_PKG H5L #define H5_MY_PKG_ERR H5E_LINK -/**\defgroup H5L H5L +/** \page H5L_UG The HDF5 Links + * @todo Under Construction + */ + +/** + * \defgroup H5L Links (H5L) * * Use the functions in this module to manage HDF5 links and link types. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Location.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Location.h index b08a252af8..ee45d679de 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Location.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Location.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Lpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Lpkg.h index 36a4d1242b..53737d1a3a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Lpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Lpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird - * Friday, December 1, 2005 - * * Purpose: This file contains declarations which are visible * only within the H5L package. Source files outside the * H5L package should include H5Lprivate.h instead. @@ -35,12 +31,6 @@ /* Package Private Macros */ /**************************/ -/* Version of external link format */ -#define H5L_EXT_VERSION 0 - -/* Valid flags for external links */ -#define H5L_EXT_FLAGS_ALL 0 - /****************************/ /* Package Private Typedefs */ /****************************/ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Lprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Lprivate.h index 8256a19250..cfdfb227b2 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Lprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Lprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Lpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Lpublic.h index ca5f6e6b36..bb5850c442 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Lpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Lpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Lpublic.h - * Dec 1 2005 - * James Laird * * Purpose: Public declarations for the H5L package (links) * @@ -24,11 +21,10 @@ #ifndef H5Lpublic_H #define H5Lpublic_H -/* Public headers needed by this file */ -#include "H5public.h" /* Generic Functions */ -#include "H5Ipublic.h" /* IDs */ -#include "H5Opublic.h" /* Object Headers */ -#include "H5Tpublic.h" /* Datatypes */ +#include "H5public.h" /* Generic Functions */ +#include "H5Ipublic.h" /* Identifiers */ +#include "H5Opublic.h" /* Object Headers */ +#include "H5Tpublic.h" /* Datatypes */ /*****************/ /* Public Macros */ @@ -202,7 +198,7 @@ H5_DLL herr_t H5Lmove(hid_t src_loc, const char *src_name, hid_t dst_loc, const * \p dst_name. * * If \p dst_loc_id is a file identifier, \p dst_name will be - * interpreted relative to that file’s root group. + * interpreted relative to that file's root group. * * The new link is created with the creation and access property lists * specified by \p lcpl_id and \p lapl_id. The interpretation of @@ -210,7 +206,7 @@ H5_DLL herr_t H5Lmove(hid_t src_loc, const char *src_name, hid_t dst_loc, const * * H5Lcopy() retains the creation time and the target of the original * link. However, since the link may be renamed, the character - * encoding is that specified in \p lcpl_id rather than that of the + * encoding is specified in \p lcpl_id rather than in that of the * original link. Other link creation properties are ignored. * * If the link is a soft link, also known as a symbolic link, its @@ -294,9 +290,14 @@ H5_DLL herr_t H5Lcreate_hard(hid_t cur_loc, const char *cur_name, hid_t dst_loc, * \ingroup ASYNC * \async_variant_of{H5Lcreate_hard} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_line, hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id, hid_t es_id); +#else +H5_DLL herr_t H5Lcreate_hard_async(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, + const char *new_name, hid_t lcpl_id, hid_t lapl_id, hid_t es_id); +#endif /** * \ingroup H5L * @@ -333,7 +334,7 @@ H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, u * * For instance, if target_path is \c ./foo, \p link_loc_id specifies * \c ./x/y/bar, and the name of the new link is \c new_link, then a - * subsequent request for \c ./x/y/bar/new_link will return same the + * subsequent request for \c ./x/y/bar/new_link will return the same * object as would be found at \c ./foo. * * \note H5Lcreate_soft() is for use only if the target object is in the @@ -341,7 +342,7 @@ H5_DLL herr_t H5Lcreate_hard_async(const char *app_file, const char *app_func, u * the new link, use H5Lcreate_external() to create an external link. * * \note Soft links and external links are also known as symbolic links as they - * use a name to point to an object; hard links employ an object’s + * use a name to point to an object; hard links employ an object's * address in the file. * * \note Unlike hard links, a soft link in an HDF5 file is allowed to dangle, @@ -366,9 +367,14 @@ H5_DLL herr_t H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const c * \ingroup ASYNC * \async_variant_of{H5Lcreate_soft} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Lcreate_soft_async(const char *app_file, const char *app_func, unsigned app_line, const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id, hid_t es_id); +#else +H5_DLL herr_t H5Lcreate_soft_async(const char *link_target, hid_t link_loc_id, const char *link_name, + hid_t lcpl_id, hid_t lapl_id, hid_t es_id); +#endif /** * \ingroup H5L * @@ -411,8 +417,12 @@ H5_DLL herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id); * \ingroup ASYNC * \async_variant_of{H5Ldelete} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Ldelete_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t lapl_id, hid_t es_id); +#else +H5_DLL herr_t H5Ldelete_async(hid_t loc_id, const char *name, hid_t lapl_id, hid_t es_id); +#endif /** * \ingroup H5L * @@ -446,9 +456,14 @@ H5_DLL herr_t H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t * \ingroup ASYNC * \async_variant_of{H5Ldelete_by_idx} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id); +#else +H5_DLL herr_t H5Ldelete_by_idx_async(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id); +#endif /** * \ingroup H5L * @@ -462,7 +477,7 @@ H5_DLL herr_t H5Ldelete_by_idx_async(const char *app_file, const char *app_func, * * \return \herr_t * - * \details H5Lget_val() returns the value of link \p name. For smbolic links, + * \details H5Lget_val() returns the value of link \p name. For symbolic links, * this is the path to which the link points, including the null * terminator. For external and user-defined links, it is the link * buffer. @@ -589,7 +604,7 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t * the link \c datasetD in the \c group group1/group2/softlink_to_group3/, * where \c group1 is a member of the group specified by \c loc_id: * - * 1. First use H5Lexists() to verify that \c group1 exists. + * 1. First, use H5Lexists() to verify that the \c group1 exists. * 2. If \c group1 exists, use H5Lexists() again, this time with name * set to \c group1/group2, to verify that \c group2 exists. * 3. If \c group2 exists, use H5Lexists() with name set to @@ -602,11 +617,11 @@ H5_DLL herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t * * If the link to be verified is specified with an absolute path, the * same approach should be used, but starting with the first link in - * the file’s root group. For instance, if \c datasetD were in + * the file's root group. For instance, if \c datasetD were in * \c /group1/group2/softlink_to_group3, the first call to H5Lexists() * would have name set to \c /group1. * - * Note that this is an outline and does not include all necessary + * Note that this is an outline and does not include all the necessary * details. Depending on circumstances, for example, you may need to * verify that an intermediate link points to a group and that a soft * link points to an existing target. @@ -652,8 +667,12 @@ H5_DLL htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id); * \ingroup ASYNC * \async_variant_of{H5Lexists} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hbool_t *exists, hid_t lapl_id, hid_t es_id); +#else +H5_DLL herr_t H5Lexists_async(hid_t loc_id, const char *name, hbool_t *exists, hid_t lapl_id, hid_t es_id); +#endif /** * \ingroup H5L * @@ -691,7 +710,7 @@ H5_DLL herr_t H5Lexists_async(const char *app_file, const char *app_func, unsign * There will be additional valid values if user-defined links have * been registered. * - * \p corder specifies the link’s creation order position while + * \p corder specifies the link's creation order position, while * \p corder_valid indicates whether the value in corder is valid. * * If \p corder_valid is \c TRUE, the value in \p corder is known to @@ -707,10 +726,10 @@ H5_DLL herr_t H5Lexists_async(const char *app_file, const char *app_func, unsign * \p cset specifies the character set in which the link name is * encoded. Valid values include the following: * \csets - * This value is set with H5Pset_char_encoding(). + * This value is set with #H5Pset_char_encoding. * * \c token is the location that a hard link points to, and - * \c val_size is the size of a soft link or user defined link value. + * \c val_size is the size of a soft link or user-defined link value. * H5O_token_t is used in the VOL layer. It is defined in H5public.h * as: * \snippet H5public.h H5O_token_t_snip @@ -862,10 +881,12 @@ H5_DLL ssize_t H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index * not been indexed by the index type, they will first be sorted by * that index then the iteration will begin; if the links have been * so indexed, the sorting step will be unnecessary, so the iteration - * may begin more quickly. + * may begin more quickly. Valid values include the following: + * \indexes * * \p order specifies the order in which objects are to be inspected - * along the index \p idx_type. + * along the index \p idx_type. Valid values include the following: + * \orders * * \p idx_p tracks the iteration and allows an iteration to be * resumed if it was stopped before all members were processed. It is @@ -901,11 +922,21 @@ H5_DLL herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t ord /** * -------------------------------------------------------------------------- * \ingroup ASYNC + * + * \warning The returned value of the callback routine op will not be set + * in the return value for H5Literate_async(), so the \p herr_t value + * should not be used for determining the return state of the callback routine. + * * \async_variant_of{H5Literate} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Literate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate2_t op, void *op_data, hid_t es_id); +#else +H5_DLL herr_t H5Literate_async(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, + H5L_iterate2_t op, void *op_data, hid_t es_id); +#endif /** * \ingroup TRAV * @@ -949,6 +980,12 @@ H5_DLL herr_t H5Literate_async(const char *app_file, const char *app_func, unsig * passed in by the application with a starting point and returned by * the library with the point at which the iteration stopped. * + * \warning H5Literate_by_name2() assumes that the membership of the group being + * iterated over remains unchanged through the iteration; if any of the + * links in the group change during the iteration, the function's + * behavior is undefined. Note, however, that objects pointed to by the + * links can be modified. + * * \note H5Literate_by_name2() is not recursive. In particular, if a member of * \p group_name is found to be a group, call it \c subgroup_a, * H5Literate_by_name2() does not examine the members of \c subgroup_a. @@ -956,12 +993,6 @@ H5_DLL herr_t H5Literate_async(const char *app_file, const char *app_func, unsig * recursion, explicitly calling H5Literate_by_name2() on discovered * subgroups. * - * \note H5Literate_by_name2() assumes that the membership of the group being - * iterated over remains unchanged through the iteration; if any of the - * links in the group change during the iteration, the function’s - * behavior is undefined. Note, however, that objects pointed to by the - * links can be modified. - * * \note H5Literate_by_name2() is the same as H5Literate2(), except that * H5Literate2() always proceeds in alphanumeric order. * @@ -1081,10 +1112,10 @@ H5_DLL herr_t H5Lvisit2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order * The group serving as the root of the iteration is specified by the * \p loc_id / \p group_name parameter pair. \p loc_id specifies a * file or group; group_name specifies either a group in the file - * (with an absolute name based in the file’s root group) or a group + * (with an absolute name based in the file's root group) or a group * relative to \p loc_id. If \p loc_id fully specifies the group that * is to serve as the root of the iteration, group_name should be '.' - * (a dot). (Note that when \p loc_id fully specifies the the group + * (a dot). (Note that when \p loc_id fully specifies the group * that is to serve as the root of the iteration, the user may wish to * consider using H5Lvisit2() instead of H5Lvisit_by_name2().) * @@ -1270,7 +1301,7 @@ H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval /*in*/, size_t link_si * \p file_name identifies the target file containing the target * object; \p obj_name specifies the path of the target object within * that file. \p obj_name must be an absolute pathname in - * \p file_name, i.e., it must start at the target file’s root group, + * \p file_name, i.e., it must start at the target file's root group, * but it is not interpreted until an application attempts to traverse * it. * @@ -1329,7 +1360,7 @@ H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval /*in*/, size_t link_si * If that target file does not exist, the new \p file_name after * stripping will be \c A.h5. * - For Windows, there are 6 cases: - * -# \p file_name is an absolute drive with absolute pathname. + * -# \p file_name is an absolute drive with an absolute pathname. * For example, consider a \p file_name of \c /tmp/A.h5. If that * target file does not exist, the new \p file_name after * stripping will be \c A.h5. @@ -1337,16 +1368,16 @@ H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval /*in*/, size_t link_si * name. For example, consider a \p file_name of \c /tmp/A.h5. * If that target file does not exist, the new \p file_name after * stripping will be \c A.h5. - * -# \p file_name is an absolute drive with relative pathname. + * -# \p file_name is an absolute drive with a relative pathname. * For example, consider a \p file_name of \c /tmp/A.h5. If that * target file does not exist, the new \p file_name after * stripping will be \c tmp\A.h5. * -# \p file_name is in UNC (Uniform Naming Convention) format with - * server name, share name, and pathname. For example, consider + * a server name, share name, and pathname. For example, consider * a \p file_name of \c /tmp/A.h5. If that target file does not * exist, the new \p file_name after stripping will be \c A.h5. * -# \p file_name is in Long UNC (Uniform Naming Convention) format - * with server name, share name, and pathname. For example, + * with a server name, share name, and pathname. For example, * consider a \p file_name of \c /tmp/A.h5. If that target file * does not exist, the new \p file_name after stripping will be * \c A.h5. @@ -1356,7 +1387,7 @@ H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval /*in*/, size_t link_si * does not exist, the new \p file_name after stripping will be * \c A.h5. * - * The library opens target file \p file_name with the file access + * The library opens the target file \p file_name with the file access * property list that is set via H5Pset_elink_fapl() when the external * link link_name is accessed. If no such property list is set, the * library uses the file access property list associated with the file @@ -1476,7 +1507,7 @@ typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_ * There will be additional valid values if user-defined links have * been registered. * - * \c corder specifies the link’s creation order position while + * \c corder specifies the link's creation order position while * \c corder_valid indicates whether the value in \c corder is valid. * * If \c corder_valid is \c TRUE, the value in \c corder is known to @@ -1485,7 +1516,7 @@ typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_ * * \c corder starts at zero (0) and is incremented by one (1) as new * links are created. But higher-numbered entries are not adjusted - * when a lower-numbered link is deleted; the deleted link’s creation + * when a lower-numbered link is deleted; the deleted link's creation * order position is simply left vacant. In such situations, the value * of \c corder for the last link created will be larger than the * number of links remaining in the group. @@ -1493,7 +1524,7 @@ typedef herr_t (*H5L_iterate1_t)(hid_t group, const char *name, const H5L_info1_ * \c cset specifies the character set in which the link name is * encoded. Valid values include the following: * \csets - * This value is set with H5Pset_char_encoding(). + * This value is set with #H5Pset_char_encoding. * * \c address and \c val_size are returned for hard and symbolic * links, respectively. Symbolic links include soft and external links @@ -1609,10 +1640,12 @@ H5_DLL herr_t H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index * not been indexed by the index type, they will first be sorted by * that index then the iteration will begin; if the links have been * so indexed, the sorting step will be unnecessary, so the iteration - * may begin more quickly. + * may begin more quickly. Valid values include the following: + * \indexes * * \p order specifies the order in which objects are to be inspected - * along the index \p idx_type. + * along the index \p idx_type. Valid values include the following: + * \orders * * \p idx_p tracks the iteration and allows an iteration to be * resumed if it was stopped before all members were processed. It is @@ -1637,7 +1670,6 @@ H5_DLL herr_t H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index * This does not limit the ability to change link destinations * while iterating, but caution is advised. * - * * \version 1.12.0 Function was deprecated in this release. * \since 1.8.0 * @@ -1694,6 +1726,12 @@ H5_DLL herr_t H5Literate1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t ord * passed in by the application with a starting point and returned by * the library with the point at which the iteration stopped. * + * \warning H5Literate_by_name1() assumes that the membership of the group being + * iterated over remains unchanged through the iteration; if any of the + * links in the group change during the iteration, the function's + * behavior is undefined. Note, however, that objects pointed to by the + * links can be modified. + * * \note H5Literate_by_name1() is not recursive. In particular, if a member of * \p group_name is found to be a group, call it \c subgroup_a, * H5Literate_by_name1() does not examine the members of \c subgroup_a. @@ -1701,12 +1739,6 @@ H5_DLL herr_t H5Literate1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t ord * recursion, explicitly calling H5Literate_by_name1() on discovered * subgroups. * - * \note H5Literate_by_name1() assumes that the membership of the group being - * iterated over remains unchanged through the iteration; if any of the - * links in the group change during the iteration, the function’s - * behavior is undefined. Note, however, that objects pointed to by the - * links can be modified. - * * \note H5Literate_by_name1() is the same as H5Giterate(), except that * H5Giterate() always proceeds in lexicographic order. * @@ -1840,10 +1872,10 @@ H5_DLL herr_t H5Lvisit1(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order * The group serving as the root of the iteration is specified by the * \p loc_id / \p group_name parameter pair. \p loc_id specifies a * file or group; group_name specifies either a group in the file - * (with an absolute name based in the file’s root group) or a group + * (with an absolute name based in the file's root group) or a group * relative to \p loc_id. If \p loc_id fully specifies the group that * is to serve as the root of the iteration, group_name should be '.' - * (a dot). (Note that when \p loc_id fully specifies the the group + * (a dot). (Note that when \p loc_id fully specifies the group * that is to serve as the root of the iteration, the user may wish to * consider using H5Lvisit1() instead of H5Lvisit_by_name1().) * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5MFmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5MFmodule.h index 3e806c68c7..dd32cdc210 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5MFmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5MFmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5MF package. Including this header means that the source file - * is part of the H5MF package. + * Purpose: This file contains declarations which define macros for the + * H5MF package. Including this header means that the source file + * is part of the H5MF package. */ #ifndef H5MFmodule_H #define H5MFmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5MFpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5MFpkg.h index 5119316bc1..a9be085f7e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5MFpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5MFpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * * Purpose: This file contains declarations which are visible only within * the H5MF package. Source files outside the H5MF package should * include H5MFprivate.h instead. @@ -71,14 +67,14 @@ /* Calculate the mis-aligned fragment */ #define H5MF_EOA_MISALIGN(F, E, A, FR) \ - { \ + do { \ hsize_t m; \ \ - if (H5F_addr_gt((E), 0) && ((m) = ((E) + H5F_BASE_ADDR(F)) % (A))) \ + if (H5_addr_gt((E), 0) && ((m) = ((E) + H5F_BASE_ADDR(F)) % (A))) \ (FR) = (A)-m; \ else \ (FR) = 0; \ - } + } while (0) /****************************/ /* Package Private Typedefs */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5MFprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5MFprivate.h index 65e6e94e4a..da6ef6d4c0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5MFprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5MFprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5MFprivate.h - * Jul 11 1997 - * Robb Matzke * * Purpose: Private header file for file memory management. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5MMprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5MMprivate.h index 0a5a011134..f94a433c14 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5MMprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5MMprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5MMprivate.h - * Jul 10 1997 - * Robb Matzke * * Purpose: Private header for memory management. * @@ -29,29 +26,19 @@ /* Private headers needed by this file */ #include "H5private.h" -#if defined H5_MEMORY_ALLOC_SANITY_CHECK -/*#define H5MM_PRINT_MEMORY_STATS */ -#define H5MM_free(Z) H5MM_xfree(Z) -#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ -#define H5MM_free(Z) HDfree(Z) -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ +#define H5MM_free(Z) free(Z) /* * Library prototypes... */ -H5_DLL void *H5MM_malloc(size_t size) H5_ATTR_MALLOC; -H5_DLL void *H5MM_calloc(size_t size) H5_ATTR_MALLOC; -H5_DLL void *H5MM_realloc(void *mem, size_t size); -H5_DLL char *H5MM_xstrdup(const char *s); -H5_DLL char *H5MM_strdup(const char *s); -H5_DLL char *H5MM_strndup(const char *s, size_t n); -H5_DLL void *H5MM_xfree(void *mem); -H5_DLL void *H5MM_xfree_const(const void *mem); -H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n); -H5_DLL herr_t H5MM_get_alloc_stats(H5_alloc_stats_t *stats); -#if defined H5_MEMORY_ALLOC_SANITY_CHECK -H5_DLL void H5MM_sanity_check_all(void); -H5_DLL void H5MM_final_sanity_check(void); -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ +H5_DLL void *H5MM_malloc(size_t size) H5_ATTR_MALLOC; +H5_DLL void *H5MM_calloc(size_t size) H5_ATTR_MALLOC; +H5_DLL void *H5MM_realloc(void *mem, size_t size); +H5_DLL char *H5MM_xstrdup(const char *s) H5_ATTR_MALLOC; +H5_DLL char *H5MM_strdup(const char *s) H5_ATTR_MALLOC; +H5_DLL char *H5MM_strndup(const char *s, size_t n) H5_ATTR_MALLOC; +H5_DLL void *H5MM_xfree(void *mem); +H5_DLL void *H5MM_xfree_const(const void *mem); +H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n); #endif /* H5MMprivate_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5MMpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5MMpublic.h index 70ac6445ea..62172c9ea0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5MMpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5MMpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5MMpublic.h - * Jul 10 1997 - * Robb Matzke * * Purpose: Public declarations for the H5MM (memory management) * package. @@ -25,8 +22,7 @@ #ifndef H5MMpublic_H #define H5MMpublic_H -/* Public headers needed by this file */ -#include "H5public.h" +#include "H5public.h" /* Generic Functions */ /* These typedefs are currently used for VL datatype allocation/freeing */ //! @@ -37,11 +33,4 @@ typedef void *(*H5MM_allocate_t)(size_t size, void *alloc_info); typedef void (*H5MM_free_t)(void *mem, void *free_info); //! -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __cplusplus -} -#endif #endif /* H5MMpublic_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Mmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Mmodule.h index e8d7c89e25..920ec3d158 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Mmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Mmodule.h @@ -25,10 +25,24 @@ #define H5_MY_PKG H5M #define H5_MY_PKG_ERR H5E_MAP -/**\defgroup H5M H5M +/** + * \page H5M_UG The HDF5 VOL Data Mapping + * \Bold{The HDF5 Data Mapping can only be used with the HDF5 VOL connectors that + * implement map objects.} The native HDF5 library does not support this feature. + * + * \section sec_map The HDF5 Map Object * * \todo Describe the map life cycle. * + * \todo How does MAPL fit into \ref subsubsec_plist_class. + * + * Previous Chapter \ref sec_async - Next Chapter \ref sec_addition + * + */ + +/** + * \defgroup H5M VOL Mapping (H5M) + * * \details \Bold{The interface can only be used with the HDF5 VOL connectors that * implement map objects.} The native HDF5 library does not support this * feature. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Mpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Mpkg.h index be6749b185..d6b86ffa6d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Mpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Mpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Mprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Mprivate.h index e62434a467..6dfb55641c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Mprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Mprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Mpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Mpublic.h index 0d6b1b211e..48625a5538 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Mpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Mpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -20,11 +19,11 @@ #ifndef H5Mpublic_H #define H5Mpublic_H -/* System headers needed by this file */ +#include "H5public.h" /* Generic Functions */ +#include "H5Ipublic.h" /* Identifiers */ +#include "H5VLpublic.h" /* Virtual Object Layer */ -/* Public headers needed by this file */ -#include "H5public.h" -#include "H5Ipublic.h" +/* Exposes VOL connector types, so it needs the connector header */ #include "H5VLconnector.h" /*****************/ @@ -212,7 +211,7 @@ extern "C" { * \details H5Mcreate() creates a new map object for storing key-value * pairs. The in-file datatype for keys is defined by \p key_type_id * and the in-file datatype for values is defined by \p val_type_id. \p - * loc_id specifies the location to create the the map object and \p + * loc_id specifies the location to create the map object and \p * name specifies the name of the link to the map object relative to * \p loc_id. * @@ -226,9 +225,14 @@ H5_DLL hid_t H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t * \ingroup ASYNC * \async_variant_of{H5Mcreate} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Mcreate_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Mcreate_async(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, + hid_t lcpl_id, hid_t mcpl_id, hid_t mapl_id, hid_t es_id); +#endif /** * \ingroup H5M @@ -266,8 +270,12 @@ H5_DLL hid_t H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id); * \ingroup ASYNC * \async_variant_of{H5Mopen} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Mopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t mapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Mopen_async(hid_t loc_id, const char *name, hid_t mapl_id, hid_t es_id); +#endif /** * \ingroup H5M @@ -292,8 +300,12 @@ H5_DLL herr_t H5Mclose(hid_t map_id); * \ingroup ASYNC * \async_variant_of{H5Mclose} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t map_id, hid_t es_id); +#else +H5_DLL herr_t H5Mclose_async(hid_t map_id, hid_t es_id); +#endif /** * \ingroup H5M @@ -340,6 +352,9 @@ H5_DLL hid_t H5Mget_val_type(hid_t map_id); * \details H5Mget_create_plist() returns an identifier for a copy of the * creation property list for a map object specified by \p map_id. * + * The creation property list identifier should be released with + * H5Pclose() to prevent resource leaks. + * * \since 1.12.0 * */ @@ -414,9 +429,14 @@ H5_DLL herr_t H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t * \ingroup ASYNC * \async_variant_of{H5Mput} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Mput_async(const char *app_file, const char *app_func, unsigned app_line, hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, const void *value, hid_t dxpl_id, hid_t es_id); +#else +H5_DLL herr_t H5Mput_async(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, + const void *value, hid_t dxpl_id, hid_t es_id); +#endif /** * \ingroup H5M @@ -455,9 +475,14 @@ H5_DLL herr_t H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t * \ingroup ASYNC * \async_variant_of{H5Mget} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Mget_async(const char *app_file, const char *app_func, unsigned app_line, hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, void *value, hid_t dxpl_id, hid_t es_id); +#else +H5_DLL herr_t H5Mget_async(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_id, + void *value, hid_t dxpl_id, hid_t es_id); +#endif /** * \ingroup H5M @@ -517,6 +542,9 @@ H5_DLL herr_t H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hb * * Any further options can be specified through the property list \p dxpl_id. * + * \warning Adding or removing key-value pairs to the map during iteration + * will lead to undefined behavior. + * * \since 1.12.0 * */ @@ -558,6 +586,9 @@ H5_DLL herr_t H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_ * * Any further options can be specified through the property list \p dxpl_id. * + * \warning Adding or removing key-value pairs to the map during iteration + * will lead to undefined behavior. + * * \since 1.12.0 * */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Object.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Object.h index 25ab4e85d4..1e93c0c826 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Object.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Object.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5OcreatProp.h b/externals/coda-oss/modules/drivers/hdf5/include/H5OcreatProp.h index 5e2bf495f9..6d752ed9c9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5OcreatProp.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5OcreatProp.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Omodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Omodule.h index 18e329ce86..c3c3496bf3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Omodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Omodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5O package. Including this header means that the source file - * is part of the H5O package. + * Purpose: This file contains declarations which define macros for the + * H5O package. Including this header means that the source file + * is part of the H5O package. */ #ifndef H5Omodule_H #define H5Omodule_H @@ -28,7 +25,12 @@ #define H5_MY_PKG H5O #define H5_MY_PKG_ERR H5E_OHDR -/**\defgroup H5O H5O +/** \page H5O_UG The HDF5 Objects + * @todo Under Construction + */ + +/** + * \defgroup H5O Objects (H5O) * * Use the functions in this module to manage HDF5 objects. * @@ -47,7 +49,7 @@ * * HDF5 objects are deleted as a side effect of rendering them unreachable * from the root group. The net effect is the diminution of the object's - * reference count to zero, which can (but should not usually) be effected + * reference count to zero, which can (but should not usually) be affected * by a function in this module. * * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Opkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Opkg.h index a81da00590..ee7104e30e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Opkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Opkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -167,10 +166,10 @@ unsigned ioflags = (IOF); \ \ /* Decode the message */ \ - HDassert(msg_type->decode); \ + assert(msg_type->decode); \ if (NULL == ((MSG)->native = (msg_type->decode)((F), (OH), (MSG)->flags, &ioflags, (MSG)->raw_size, \ (MSG)->raw))) \ - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message") \ + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, ERR, "unable to decode message"); \ \ /* Mark the message dirty if it was changed by decoding */ \ if ((ioflags & H5O_DECODEIO_DIRTY) && (H5F_get_intent((F)) & H5F_ACC_RDWR)) { \ @@ -182,7 +181,7 @@ \ /* Set the message's "shared info", if it's shareable */ \ if ((MSG)->flags & H5O_MSG_FLAG_SHAREABLE) { \ - HDassert(msg_type->share_flags &H5O_SHARE_IS_SHARABLE); \ + assert(msg_type->share_flags &H5O_SHARE_IS_SHARABLE); \ H5O_UPDATE_SHARED((H5O_shared_t *)(MSG)->native, H5O_SHARE_TYPE_HERE, (F), msg_type->id, \ (MSG)->crt_idx, (OH)->chunk[0].addr) \ } /* end if */ \ @@ -191,7 +190,7 @@ if (msg_type->set_crt_index) { \ /* Set the creation index for the message */ \ if ((msg_type->set_crt_index)((MSG)->native, (MSG)->crt_idx) < 0) \ - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, ERR, "unable to set creation index") \ + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, ERR, "unable to set creation index"); \ } /* end if */ \ } /* end if */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Oprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Oprivate.h index d5cf31c79b..2d05e54a8f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Oprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Oprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Oprivate.h - * Aug 5 1997 - * Robb Matzke * * Purpose: Object header private include file. * @@ -405,7 +402,7 @@ typedef struct H5O_efl_t { #define H5O_LAYOUT_ALL_CHUNK_FLAGS \ (H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS | H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) -/* Version # of encoded virtual dataset global heap blocks */ +/* Version number of encoded virtual dataset global heap blocks */ #define H5O_LAYOUT_VDS_GH_ENC_VERS 0 /* Initial version of the layout information. Used when space is allocated */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Opublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Opublic.h index ba352c85e5..4fdfcc60d0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Opublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Opublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,21 +13,17 @@ /*------------------------------------------------------------------------- * * Created: H5Opublic.h - * Aug 5 1997 - * Robb Matzke * * Purpose: Public declarations for the H5O (object header) - * package. + * package * *------------------------------------------------------------------------- */ #ifndef H5Opublic_H #define H5Opublic_H -/* Public headers needed by this file */ -#include "H5public.h" /* Generic Functions */ -#include "H5Ipublic.h" /* IDs */ -#include "H5Lpublic.h" /* Links */ +#include "H5public.h" /* Generic Functions */ +#include "H5Ipublic.h" /* Identifiers */ /*****************/ /* Public Macros */ @@ -99,7 +94,7 @@ //! /* Convenience macro to check if the token is the 'undefined' token value */ -#define H5O_IS_TOKEN_UNDEF(token) (!HDmemcmp(&(token), &(H5O_TOKEN_UNDEF), sizeof(H5O_token_t))) +#define H5O_IS_TOKEN_UNDEF(token) (!memcmp(&(token), &(H5O_TOKEN_UNDEF), sizeof(H5O_token_t))) /*******************/ /* Public Typedefs */ @@ -247,7 +242,7 @@ extern "C" { * * H5Oopen() cannot be used to open a dataspace, attribute, property list, or file. * - * Once an object of unknown type has been opened with H5Oopen(), + * Once an object of an unknown type has been opened with H5Oopen(), * the type of that object can be determined by means of an H5Iget_type() call. * * \p loc_id may be a file, group, dataset, named datatype, or attribute. @@ -274,8 +269,12 @@ H5_DLL hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id); * \ingroup ASYNC * \async_variant_of{H5Oopen} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Oopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, hid_t lapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Oopen_async(hid_t loc_id, const char *name, hid_t lapl_id, hid_t es_id); +#endif /** *------------------------------------------------------------------------- @@ -311,7 +310,7 @@ H5_DLL hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token); * * \return \hid_tv{object} * - * \details H5Open_by_idx() opens the nth object in the group specified by \p loc_id + * \details H5Oopen_by_idx() opens the nth object in the group specified by \p loc_id * and \p group_name. * * \p loc_id specifies a location identifier. @@ -358,9 +357,14 @@ H5_DLL hid_t H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx * \ingroup ASYNC * \async_variant_of{H5Oopen_by_idx} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Oopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Oopen_by_idx_async(hid_t loc_id, const char *group_name, H5_index_t idx_type, + H5_iter_order_t order, hsize_t n, hid_t lapl_id, hid_t es_id); +#endif /** *------------------------------------------------------------------------- @@ -376,7 +380,7 @@ H5_DLL hid_t H5Oopen_by_idx_async(const char *app_file, const char *app_func, un * the \p loc_id and \p name combination exists. * \return Returns 0 if the object pointed to by * the \p loc_id and \p name combination does not exist. - * \return Returns a negatvie value when the function fails. + * \return Returns a negative value when the function fails. * * \details H5Oexists_by_name() allows an application to determine whether * the link \p name in the group or file specified with \p loc_id @@ -400,22 +404,22 @@ H5_DLL hid_t H5Oopen_by_idx_async(const char *app_file, const char *app_func, un * where \c group1 is a member of the group specified by \c loc_id: * * \par - * - First use H5Lexists() to verify that a link named \c group1 exists. + * - First, use H5Lexists() to verify that a link named \c group1 exists. * - If \c group1 exists, use H5Oexists_by_name() to verify that the * link \c group1 resolves to an object. - * - If \c group1 exists, use H5Lexists() again, this time with name + * - If \c group1 exists, use H5Lexists() again, this time with the name * set to \c group1/group2, to verify that the link \c group2 exists * in \c group1. * - If the \c group2 link exists, use H5Oexists_by_name() to verify * that \c group1/group2 resolves to an object. - * - If \c group2 exists, use H5Lexists() again, this time with name + * - If \c group2 exists, use H5Lexists() again, this time with the name * set to \c group1/group2/softlink_to_group3, to verify that the * link \c softlink_to_group3 exists in \c group2. * - If the \c softlink_to_group3 link exists, use H5Oexists_by_name() * to verify that \c group1/group2/softlink_to_group3 resolves to * an object. * - If \c softlink_to_group3 exists, you can now safely use H5Lexists - * with name set to \c group1/group2/softlink_to_group3/datasetD to + * with the name set to \c group1/group2/softlink_to_group3/datasetD to * verify that the target link, \c datasetD, exists. * - And finally, if the link \c datasetD exists, use H5Oexists_by_name * to verify that \c group1/group2/softlink_to_group3/datasetD @@ -424,17 +428,17 @@ H5_DLL hid_t H5Oopen_by_idx_async(const char *app_file, const char *app_func, un * \par * If the link to be verified is specified with an absolute path, * the same approach should be used, but starting with the first - * link in the file’s root group. For instance, if \c datasetD + * link in the file's root group. For instance, if \c datasetD * were in \c /group1/group2/softlink_to_group3, the first call to * H5Lexists() would have name set to \c /group1. * * \par - * Note that this is an outline and does not include all necessary + * Note that this is an outline and does not include all the necessary * details. Depending on circumstances, for example, an application * may need to verify the type of an object also. * * \warning \Bold{Failure Modes:} - * \warning If \p loc_id and \p name both exist but the combination does not + * \warning If \p loc_id and \p name both exist, but the combination does not * resolve to an object, the function will return 0 (zero); * the function does not fail in this case. * \warning If either the location or the link specified by the \p loc_id @@ -484,7 +488,7 @@ H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id); * \note If you are iterating through a lot of different objects to * retrieve information via the H5Oget_info() family of routines, * you may see memory building up. This can be due to memory - * allocation for metadata such as object headers and messages + * allocation for metadata, such as object headers and messages, * when the iterated objects are put into the metadata cache. * \note * If the memory buildup is not desirable, you can configure a @@ -513,7 +517,7 @@ H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields); * * \return \herr_t * - * \details H5Oget_info_by_name3() specifies an object’s location and name, + * \details H5Oget_info_by_name3() specifies an object's location and name, * \p loc_id and \p name, respectively, and retrieves the metadata * describing that object in \p oinfo, an H5O_info2_t struct. * @@ -540,9 +544,14 @@ H5_DLL herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t * * \ingroup ASYNC * \async_variant_of{H5Oget_info_by_name} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, const char *name, H5O_info2_t *oinfo /*out*/, unsigned fields, hid_t lapl_id, hid_t es_id); +#else +H5_DLL herr_t H5Oget_info_by_name_async(hid_t loc_id, const char *name, H5O_info2_t *oinfo /*out*/, + unsigned fields, hid_t lapl_id, hid_t es_id); +#endif /** *------------------------------------------------------------------------- @@ -566,7 +575,7 @@ H5_DLL herr_t H5Oget_info_by_name_async(const char *app_file, const char *app_fu * object in the \c struct \p oinfo, as specified by the location, * \p loc_id, group name, \p group_name, the index by which objects * in that group are tracked, \p idx_type, the order by which the - * index is to be traversed, \p order, and an object’s position + * index is to be traversed, \p order, and an object's position * \p n within that index. * * If \p loc_id fully specifies the group in which the object resides, @@ -709,7 +718,7 @@ H5_DLL herr_t H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5 * * \details H5Olink() creates a new hard link to an object in an HDF5 file. * \p new_loc_id and \p \p new_link_name specify the location and name of the - * new link while \p object_id identifies the object that the link + * new link, while \p object_id identifies the object that the link * points to. * * H5Olink() is designed for two purposes: @@ -776,12 +785,12 @@ H5_DLL herr_t H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_ * an object by address is added. When the link is deleted, * H5Odecr_refcount() should be used. * - * An object’s reference count is the number of hard links in the + * An object's reference count is the number of hard links in the * file that point to that object. See the “Programming Model” - * section of the HDF5 Groups chapter in the -- HDF5 User’s Guide - * for a more complete discussion of reference counts. + * section of the HDF5 Groups chapter in the -- \ref UG + * for a complete discussion of reference counts. * - * If a user application needs to determine an object’s reference + * If a user application needs to determine an object's reference * count, an H5Oget_info() call is required; the reference count * is returned in the \c rc field of the #H5O_info_t \c struct. * @@ -811,12 +820,12 @@ H5_DLL herr_t H5Oincr_refcount(hid_t object_id); * an object by address is deleted. In general, H5Oincr_refcount() will have * been used previously, when the link was created. * - * An object’s reference count is the number of hard links in the + * An object's reference count is the number of hard links in the * file that point to that object. See the “Programming Model” - * section of the HDF5 Groups chapter in the HDF5 User’s Guide + * section of the HDF5 Groups chapter in the \ref UG * for a more complete discussion of reference counts. * - * If a user application needs to determine an object’s reference + * If a user application needs to determine an object's reference * count, an H5Oget_info() call is required; the reference count * is returned in the \c rc field of the #H5O_info_t \c struct. * @@ -854,13 +863,13 @@ H5_DLL herr_t H5Odecr_refcount(hid_t object_id); * The destination location, as specified in dst_loc_id, may * be a group in the current file or a location in a different * file. If dst_loc_id is a file identifier, the copy will be - * placed in that file’s root group. + * placed in that file's root group. * * The copy will be created with the path specified in \p dst_name, * which must not pre-exist in the destination location. If * \p dst_name already exists at the location \p dst_loc_id, * H5Ocopy() will fail. If \p dst_name is an absolute path, - * the copy will be created relative to the file’s root group. + * the copy will be created relative to the file's root group. * * The copy of the object is created with the property lists * specified by \p ocpypl_id and \p lcpl_id. #H5P_DEFAULT can be passed @@ -927,9 +936,14 @@ H5_DLL herr_t H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, * \ingroup ASYNC * \async_variant_of{H5Ocopy} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Ocopy_async(const char *app_file, const char *app_func, unsigned app_line, hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t es_id); +#else +H5_DLL herr_t H5Ocopy_async(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *dst_name, + hid_t ocpypl_id, hid_t lcpl_id, hid_t es_id); +#endif /** *------------------------------------------------------------------------- @@ -947,7 +961,7 @@ H5_DLL herr_t H5Ocopy_async(const char *app_file, const char *app_func, unsigned * is overwritten. * * The target object is specified by an identifier, \p obj_id. - * If \p comment is the empty string or a null pointer, any existing + * If \p comment is an empty string or a null pointer, any existing * comment message is removed from the object. * * Comments should be relatively short, null-terminated, ASCII strings. @@ -989,10 +1003,10 @@ H5_DLL herr_t H5Oset_comment(hid_t obj_id, const char *comment); * \p name can be one of the following: * * - The name of the object specified as a path relative to \p loc_id - * - An absolute name of the object, starting from \c /, the file’s root group + * - An absolute name of the object, starting from \c /, the file's root group * - A dot (\c .), if \p loc_id fully specifies the object * - * If \p comment is the empty string or a null pointer, any existing + * If \p comment is an empty string or a null pointer, any existing * comment message is removed from the object. * * Comments should be relatively short, null-terminated, ASCII strings. @@ -1046,7 +1060,7 @@ H5_DLL herr_t H5Oset_comment_by_name(hid_t loc_id, const char *name, const char * only \p bufsize bytes of the comment, without a \c NULL terminator, * are returned in \p comment. * - * If an object does not have a comment, the empty string is + * If an object does not have a comment, an empty string is * returned in \p comment. * * \version 1.8.11 Fortran subroutine introduced in this release. @@ -1081,7 +1095,7 @@ H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize); * \p name can be one of the following: * * - The name of the object relative to \p loc_id - * - An absolute name of the object, starting from \c /, the file’s root group + * - An absolute name of the object, starting from \c /, the file's root group * - A dot (\c .), if \p loc_id fully specifies the object * * The size in bytes of the comment, including the \c NULL terminator, @@ -1094,7 +1108,7 @@ H5_DLL ssize_t H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize); * only \p bufsize bytes of the comment, without a \c NULL terminator, * are returned in \p comment. * - * If an object does not have a comment, the empty string is + * If an object does not have a comment, an empty string is * returned in \p comment. * * \p lapl_id contains a link access property list identifier. A @@ -1143,7 +1157,7 @@ H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comm * * If \p obj_id is a group identifier, that group serves as the * root of a recursive iteration. If \p obj_id is a file identifier, - * that file’s root group serves as the root of the recursive + * that file's root group serves as the root of the recursive * iteration. If \p obj_id is an attribute identifier, * then the object where the attribute is attached will be iterated. * If \p obj_id is any other type of object, such as a dataset or @@ -1172,7 +1186,7 @@ H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comm * The H5Ovisit3() \p op_data parameter is a user-defined pointer to the data * required to process objects in the course of the iteration. This pointer * is passed back to each step of the iteration in the callback - * function’s \p op_data parameter. + * function's \p op_data parameter. * * The \p fields parameter contains flags to determine which fields will * be retrieved by the \p op callback function. These flags are defined @@ -1241,7 +1255,7 @@ H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order * a file or an object in a file; if \p loc_id is an attribute identifier, * the object where the attribute is attached will be used. * \p obj_name specifies either an object in the file (with an absolute - * name based in the file’s root group) or an object name relative + * name based on the file's root group) or an object name relative * to \p loc_id. If \p loc_id fully specifies the object that is to serve * as the root of the iteration, \p obj_name should be '\c .' (a dot). * (Note that when \p loc_id fully specifies the object that is to serve @@ -1271,7 +1285,7 @@ H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order * The H5Ovisit_by_name3() \p op_data parameter is a user-defined * pointer to the data required to process objects in the course * of the iteration. This pointer is passed back to each step of - * the iteration in the callback function’s \p op_data parameter. + * the iteration in the callback function's \p op_data parameter. * * \p lapl_id is a link access property list. In the general case, * when default link access properties are acceptable, this can @@ -1335,8 +1349,12 @@ H5_DLL herr_t H5Oclose(hid_t object_id); * \ingroup ASYNC * \async_variant_of{H5Oclose} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t object_id, hid_t es_id); +#else +H5_DLL herr_t H5Oclose_async(hid_t object_id, hid_t es_id); +#endif /** *------------------------------------------------------------------------- @@ -1352,7 +1370,10 @@ H5_DLL herr_t H5Oclose_async(const char *app_file, const char *app_func, unsigne * flushed to disk without removing the data from the cache. * * The object associated with \p object_id can be any named object in an - * HDF5 file including a dataset, a group, or a committed datatype. + * HDF5 file, including a dataset, a group, or a committed datatype. + * + * \warning H5Oflush doesn't work correctly with parallel. It causes an assertion + * failure in metadata cache during H5Fclose(). * * \note HDF5 does not possess full control over buffering. H5Oflush() * flushes the internal HDF5 buffers and then asks the operating @@ -1375,8 +1396,12 @@ H5_DLL herr_t H5Oflush(hid_t obj_id); * \ingroup ASYNC * \async_variant_of{H5Oflush} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Oflush_async(const char *app_file, const char *app_func, unsigned app_line, hid_t obj_id, hid_t es_id); +#else +H5_DLL herr_t H5Oflush_async(hid_t obj_id, hid_t es_id); +#endif /** *------------------------------------------------------------------------- * \ingroup H5O @@ -1407,8 +1432,12 @@ H5_DLL herr_t H5Orefresh(hid_t oid); * \ingroup ASYNC * \async_variant_of{H5Orefresh} */ +#ifndef H5_DOXYGEN H5_DLL herr_t H5Orefresh_async(const char *app_file, const char *app_func, unsigned app_line, hid_t oid, hid_t es_id); +#else +H5_DLL herr_t H5Orefresh_async(hid_t oid, hid_t es_id); +#endif /** *------------------------------------------------------------------------- @@ -1424,9 +1453,9 @@ H5_DLL herr_t H5Orefresh_async(const char *app_file, const char *app_func, unsig * * \details H5Odisable_mdc_flushes(), H5Oenable_mdc_flushes() and associated flush * functions can be used to control the flushing of entries from - * a file’s metadata cache. + * a file's metadata cache. * - * This function prevents an object’s or cache’s dirty metadata + * This function prevents an object's or cache's dirty metadata * entries from being flushed from the cache by the usual cache * eviction/flush policy. Instead, users must manually flush the * cache or entries for individual objects via the appropriate @@ -1457,7 +1486,7 @@ H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id); *------------------------------------------------------------------------- * \ingroup H5O * - * \brief Enables flushing of dirty metadata entries from a file’s metadata cache + * \brief Enables flushing of dirty metadata entries from a file's metadata cache * * \param[in] object_id Identifier of the object that will have flushes re-enabled; * may be a group, named datatype, or dataset identifier @@ -1466,9 +1495,9 @@ H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id); * * \details H5Oenable_mdc_flushes(), H5Odisable_mdc_flushes() * and associated flush functions can be used to control the flushing - * of entries from a file’s metadata cache. + * of entries from a file's metadata cache. * - * This function allows an object or cache’s dirty metadata entries to be + * This function allows an object or cache's dirty metadata entries to be * flushed from the cache by the usual cache eviction/flush policy. * * Metadata cache entries can be controlled at both the individual HDF5 @@ -1486,7 +1515,7 @@ H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id); * determined with H5Oare_mdc_flushes_disabled(). An object will be * returned to the default flush algorithm when it is closed. All objects * will be returned to the default flush algorithm when the file is - * closed. An object’s entries will not necessarily be flushed as a + * closed. An object's entries will not necessarily be flushed as a * result of calling this function. * * \since 1.10.0 @@ -1513,7 +1542,7 @@ H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id); * * The H5Oenable_mdc_flushes(), H5Odisable_mdc_flushes() and * associated flush functions can be used to control the flushing of - * entries from a file’s metadata cache. Metadata cache entries can be controlled + * entries from a file's metadata cache. Metadata cache entries can be controlled * at both the individual HDF5 object level (datasets, groups, * committed datatypes) and the entire metadata cache level. * @@ -1746,18 +1775,18 @@ typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t * * \p loc_id is a location identifier in the file. * - * The object’s address within the file, \p addr, is the byte offset of the first byte + * The object's address within the file, \p addr, is the byte offset of the first byte * of the object header from the beginning of the HDF5 file space, i.e., from the - * beginning of the super block (see the “HDF5 Storage Model” section of the The + * beginning of the superblock (see the “HDF5 Storage Model” section of the The * HDF5 Data Model and File Structure chapter of the HDF5 User's Guide.) * * \p addr can be obtained via either of two function calls. H5Gget_objinfo() returns - * the object’s address in the \c objno field of the H5G_stat_t \c struct; + * the object's address in the \c objno field of the H5G_stat_t \c struct; * H5Lget_info() returns the address in the \c address field of the #H5L_info_t \c struct. * * The address of the HDF5 file on a physical device has no effect on H5Oopen_by_addr(), * nor does the use of any file driver. As stated above, the object address is its - * offset within the HDF5 file; HDF5’s file drivers will transparently map this to an + * offset within the HDF5 file; HDF5's file drivers will transparently map this to an * address on a storage device. * * \warning This function must be used with care! @@ -1767,7 +1796,7 @@ typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t * overcome by retrieving the object address with H5Gget_objinfo() or H5Lget_info() * immediately before calling H5Oopen_by_addr(). The immediacy of the operation can be * important; if time has elapsed and the object has been deleted from the file, - * the address will be invalid and file corruption can result. + * the address will be invalid, and file corruption can result. * * \version 1.8.4 Fortran subroutine added in this release. * @@ -1796,7 +1825,7 @@ H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr); * \note If you are iterating through a lot of different objects to * retrieve information via the H5Oget_info() family of routines, * you may see memory building up. This can be due to memory - * allocation for metadata such as object headers and messages + * allocation for metadata, such as object headers and messages, * when the iterated objects are put into the metadata cache. * \note * If the memory buildup is not desirable, you can configure a @@ -1839,7 +1868,7 @@ H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo); * \deprecated As of HDF5-1.12 this function has been deprecated in favor of * the function H5Oget_info_by_name2() or the macro #H5Oget_info_by_name. * - * \details H5Oget_info_by_name1() specifies an object’s location and name, \p loc_id + * \details H5Oget_info_by_name1() specifies an object's location and name, \p loc_id * and \p name, respectively, and retrieves the metadata describing that object * in \p oinfo, an H5O_info1_t \c struct. * @@ -1885,7 +1914,7 @@ H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t * * object in the \c struct \p oinfo, as specified by the location, * \p loc_id, group name, \p group_name, the index by which objects * in that group are tracked, \p idx_type, the order by which the - * index is to be traversed, \p order, and an object’s position + * index is to be traversed, \p order, and an object's position * \p n within that index. * * If \p loc_id fully specifies the group in which the object resides, @@ -1934,7 +1963,7 @@ H5_DLL herr_t H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index * \note If you are iterating through a lot of different objects to * retrieve information via the H5Oget_info() family of routines, * you may see memory building up. This can be due to memory - * allocation for metadata such as object headers and messages + * allocation for metadata, such as object headers and messages, * when the iterated objects are put into the metadata cache. * \note * If the memory buildup is not desirable, you can configure a @@ -1966,7 +1995,7 @@ H5_DLL herr_t H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo, unsigned fields); * \deprecated As of HDF5-1.12 this function has been deprecated in favor of * the function H5Oget_info_by_name3() or the macro H5Oget_info_by_name(). * - * \details H5Oget_info_by_name2() specifies an object’s location and name, \p loc_id and + * \details H5Oget_info_by_name2() specifies an object's location and name, \p loc_id and * \p name, respectively, and retrieves the metadata describing * that object in \p oinfo, an H5O_info1_t \c struct. * @@ -2013,7 +2042,7 @@ H5_DLL herr_t H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t * * object in the \c struct \p oinfo, as specified by the location, * \p loc_id, group name, \p group_name, the index by which objects * in that group are tracked, \p idx_type, the order by which the - * index is to be traversed, \p order, and an object’s position + * index is to be traversed, \p order, and an object's position * \p n within that index. * * \p oinfo, in which the object information is returned, is a \c struct of @@ -2073,7 +2102,7 @@ H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index * * If \p obj_id is a group identifier, that group serves as the * root of a recursive iteration. If \p obj_id is a file identifier, - * that file’s root group serves as the root of the recursive + * that file's root group serves as the root of the recursive * iteration. If \p obj_id is an attribute identifier, * then the object where the attribute is attached will be iterated. * If \p obj_id is any other type of object, such as a dataset or @@ -2164,7 +2193,7 @@ H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order * a file or an object in a file; if \p loc_id is an attribute identifier, * the object where the attribute is attached will be used. * \p obj_name specifies either an object in the file (with an absolute - * name based in the file’s root group) or an object name relative + * name based on the file's root group) or an object name relative * to \p loc_id. If \p loc_id fully specifies the object that is to serve * as the root of the iteration, \p obj_name should be '\c .' (a dot). * (Note that when \p loc_id fully specifies the object that is to serve @@ -2192,7 +2221,7 @@ H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order * along the index specified in \p idx_type. * * The \p op callback function and the effect of the callback - * function’s return value on the application are described + * function's return value on the application are described * in H5Ovisit1(). * * The H5O_info1_t \c struct is defined in H5Opublic.h @@ -2201,7 +2230,7 @@ H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order * The H5Ovisit_by_name1() \p op_data parameter is a user-defined * pointer to the data required to process objects in the course * of the iteration. This pointer is passed back to each step of - * the iteration in the callback function’s \p op_data parameter. + * the iteration in the callback function's \p op_data parameter. * * \p lapl_id is a link access property list. In the general case, * when default link access properties are acceptable, this can @@ -2268,7 +2297,7 @@ H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t i * * If \p obj_id is a group identifier, that group serves as the * root of a recursive iteration. If \p obj_id is a file identifier, - * that file’s root group serves as the root of the recursive + * that file's root group serves as the root of the recursive * iteration. If \p obj_id is an attribute identifier, * then the object where the attribute is attached will be iterated. * If \p obj_id is any other type of object, such as a dataset or @@ -2361,7 +2390,7 @@ H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order * a file or an object in a file; if \p loc_id is an attribute identifier, * the object where the attribute is attached will be used. * \p obj_name specifies either an object in the file (with an absolute - * name based in the file’s root group) or an object name relative + * name based in the file's root group) or an object name relative * to \p loc_id. If \p loc_id fully specifies the object that is to serve * as the root of the iteration, \p obj_name should be '\c .' (a dot). * (Note that when \p loc_id fully specifies the object that is to serve @@ -2389,7 +2418,7 @@ H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order * along the index specified in \p idx_type. * * The \p op callback function and the effect of the callback - * function’s return value on the application are described + * function's return value on the application are described * in H5Ovisit2(). * * The H5O_info1_t \c struct is defined in H5Opublic.h @@ -2398,7 +2427,7 @@ H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order * The H5Ovisit_by_name2() \p op_data parameter is a user-defined * pointer to the data required to process objects in the course * of the iteration. This pointer is passed back to each step of - * the iteration in the callback function’s \p op_data parameter. + * the iteration in the callback function's \p op_data parameter. * * \p lapl_id is a link access property list. In the general case, * when default link access properties are acceptable, this can diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Oshared.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Oshared.h index d672032a16..a9c8c85384 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Oshared.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Oshared.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,16 +11,13 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Friday, January 19, 2007 - * * Purpose: This file contains inline definitions for "generic" routines - * supporting a "shared message interface" (ala Java) for object - * header messages that can be shared. This interface is - * dependent on a bunch of macros being defined which define - * the name of the interface and "real" methods which need to - * be implemented for each message class that supports the - * shared message interface. + * supporting a "shared message interface" (ala Java) for object + * header messages that can be shared. This interface is + * dependent on a bunch of macros being defined which define + * the name of the interface and "real" methods which need to + * be implemented for each message class that supports the + * shared message interface. */ #ifndef H5Oshared_H @@ -32,16 +28,12 @@ * * Purpose: Decode an object header message that may be shared. * - * Note: The actual name of this routine can be different in each source - * file that this header file is included in, and must be defined - * prior to including this header file. - * - * Return: Success: Pointer to the new message in native form - * Failure: NULL - * - * Programmer: Quincey Koziol - * Friday, January 19, 2007 + * Note: The actual name of this routine can be different in each source + * file that this header file is included in, and must be defined + * prior to including this header file. * + * Return: Success: Pointer to the new message in native form + * Failure: NULL *------------------------------------------------------------------------- */ static inline void * @@ -66,12 +58,12 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *iofla if (mesg_flags & H5O_MSG_FLAG_SHARED) { /* Retrieve native message info indirectly through shared message */ if (NULL == (ret_value = H5O__shared_decode(f, open_oh, ioflags, p, H5O_SHARED_TYPE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode shared message"); /* We currently do not support automatically fixing shared messages */ #ifdef H5_STRICT_FORMAT_CHECKS if (*ioflags & H5O_DECODEIO_DIRTY) - HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to mark shared message dirty") + HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to mark shared message dirty"); #else /* H5_STRICT_FORMAT_CHECKS */ *ioflags &= ~H5O_DECODEIO_DIRTY; #endif /* H5_STRICT_FORMAT_CHECKS */ @@ -79,7 +71,7 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *iofla else { /* Decode native message directly */ if (NULL == (ret_value = H5O_SHARED_DECODE_REAL(f, open_oh, mesg_flags, ioflags, p_size, p))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode native message"); } /* end else */ done: @@ -91,16 +83,11 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *iofla * * Purpose: Encode an object header message that may be shared. * - * Note: The actual name of this routine can be different in each source - * file that this header file is included in, and must be defined - * prior to including this header file. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Friday, January 19, 2007 + * Note: The actual name of this routine can be different in each source + * file that this header file is included in, and must be defined + * prior to including this header file. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static inline herr_t @@ -123,18 +110,18 @@ H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mes #endif /* H5O_SHARED_ENCODE_REAL */ /* Sanity check */ - HDassert(sh_mesg->type == H5O_SHARE_TYPE_UNSHARED || sh_mesg->msg_type_id == H5O_SHARED_TYPE->id); + assert(sh_mesg->type == H5O_SHARE_TYPE_UNSHARED || sh_mesg->msg_type_id == H5O_SHARED_TYPE->id); /* Check for message stored elsewhere */ if (H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) { /* Encode shared message into buffer */ if (H5O__shared_encode(f, p, sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode shared message"); } /* end if */ else { /* Encode native message directly */ if (H5O_SHARED_ENCODE_REAL(f, p, _mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode native message"); } /* end else */ done: @@ -144,18 +131,14 @@ H5O_SHARED_ENCODE(H5F_t *f, hbool_t disable_shared, uint8_t *p, const void *_mes /*------------------------------------------------------------------------- * Function: H5O_SHARED_SIZE * - * Purpose: Returns the length of an encoded message. + * Purpose: Returns the length of an encoded message. * - * Note: The actual name of this routine can be different in each source - * file that this header file is included in, and must be defined - * prior to including this header file. - * - * Return: Success: Length - * Failure: 0 - * - * Programmer: Quincey Koziol - * Friday, January 19, 2007 + * Note: The actual name of this routine can be different in each source + * file that this header file is included in, and must be defined + * prior to including this header file. * + * Return: Success: Length + * Failure: 0 *------------------------------------------------------------------------- */ static inline size_t @@ -181,12 +164,12 @@ H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg) if (H5O_IS_STORED_SHARED(sh_mesg->type) && !disable_shared) { /* Retrieve encoded size of shared message */ if (0 == (ret_value = H5O__shared_size(f, sh_mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of shared message"); } /* end if */ else { /* Retrieve size of native message directly */ if (0 == (ret_value = H5O_SHARED_SIZE_REAL(f, _mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, 0, "unable to retrieve encoded size of native message"); } /* end else */ done: @@ -199,16 +182,11 @@ H5O_SHARED_SIZE(const H5F_t *f, hbool_t disable_shared, const void *_mesg) * Purpose: Decrement reference count on any objects referenced by * message * - * Note: The actual name of this routine can be different in each source - * file that this header file is included in, and must be defined - * prior to including this header file. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Friday, January 19, 2007 + * Note: The actual name of this routine can be different in each source + * file that this header file is included in, and must be defined + * prior to including this header file. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static inline herr_t @@ -230,13 +208,13 @@ H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg) if (H5O_IS_TRACKED_SHARED(sh_mesg->type)) { /* Decrement the reference count on the shared message/object */ if (H5O__shared_delete(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for shared message"); } /* end if */ #ifdef H5O_SHARED_DELETE_REAL else { /* Decrement the reference count on the native message directly */ if (H5O_SHARED_DELETE_REAL(f, open_oh, _mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for native message"); } /* end else */ #endif /* H5O_SHARED_DELETE_REAL */ @@ -250,16 +228,11 @@ H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg) * Purpose: Increment reference count on any objects referenced by * message * - * Note: The actual name of this routine can be different in each source - * file that this header file is included in, and must be defined - * prior to including this header file. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Friday, January 19, 2007 + * Note: The actual name of this routine can be different in each source + * file that this header file is included in, and must be defined + * prior to including this header file. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static inline herr_t @@ -281,13 +254,13 @@ H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg) if (H5O_IS_TRACKED_SHARED(sh_mesg->type)) { /* Increment the reference count on the shared message/object */ if (H5O__shared_link(f, open_oh, H5O_SHARED_TYPE, sh_mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for shared message"); } /* end if */ #ifdef H5O_SHARED_LINK_REAL else { /* Increment the reference count on the native message directly */ if (H5O_SHARED_LINK_REAL(f, open_oh, _mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "unable to increment ref count for native message"); } /* end else */ #endif /* H5O_SHARED_LINK_REAL */ @@ -300,16 +273,11 @@ H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg) * * Purpose: Copies a message from _SRC to _DEST in file * - * Note: The actual name of this routine can be different in each source - * file that this header file is included in, and must be defined - * prior to including this header file. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Friday, January 19, 2007 + * Note: The actual name of this routine can be different in each source + * file that this header file is included in, and must be defined + * prior to including this header file. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static inline void * @@ -332,20 +300,20 @@ H5O_SHARED_COPY_FILE(H5F_t *file_src, void *_native_src, H5F_t *file_dst, hbool_ /* Call native message's copy file callback to copy the message */ if (NULL == (dst_mesg = H5O_SHARED_COPY_FILE_REAL(file_src, H5O_SHARED_TYPE, _native_src, file_dst, recompute_size, cpy_info, udata))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy native message to another file") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy native message to another file"); #else /* H5O_SHARED_COPY_FILE_REAL */ /* No copy file callback defined, just copy the message itself */ if (NULL == (dst_mesg = (H5O_SHARED_TYPE->copy)(_native_src, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy native message"); #endif /* H5O_SHARED_COPY_FILE_REAL */ /* Reset shared message info for new message */ - HDmemset(dst_mesg, 0, sizeof(H5O_shared_t)); + memset(dst_mesg, 0, sizeof(H5O_shared_t)); /* Handle sharing destination message */ if (H5O__shared_copy_file(file_src, file_dst, H5O_SHARED_TYPE, _native_src, dst_mesg, recompute_size, mesg_flags, cpy_info, udata) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "unable to determine if message should be shared") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "unable to determine if message should be shared"); /* Set return value */ ret_value = dst_mesg; @@ -367,12 +335,7 @@ H5O_SHARED_COPY_FILE(H5F_t *file_src, void *_native_src, H5F_t *file_dst, hbool_ * file that this header file is included in, and must be defined * prior to including this header file. * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Peter Cao - * May 25, 2007 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static inline herr_t @@ -386,11 +349,11 @@ H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const FUNC_ENTER_NOAPI_NOINIT - HDassert(oloc_src->file); - HDassert(oloc_dst->file); - HDassert(mesg_src); - HDassert(mesg_dst); - HDassert(cpy_info); + assert(oloc_src->file); + assert(oloc_dst->file); + assert(mesg_src); + assert(mesg_dst); + assert(cpy_info); #ifndef H5O_SHARED_TYPE #error "Need to define H5O_SHARED_TYPE macro!" @@ -402,7 +365,7 @@ H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const #ifdef H5O_SHARED_POST_COPY_FILE_REAL /* Call native message's post copy file callback to copy the message */ if (H5O_SHARED_POST_COPY_FILE_REAL(oloc_src, mesg_src, oloc_dst, mesg_dst, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy native message to another file") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy native message to another file"); #endif /* H5O_SHARED_POST_COPY_FILE_REAL */ /* Update shared message after the post copy - will short circuit in @@ -410,19 +373,18 @@ H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const * verifies that it is indeed the case */ if (H5O__shared_post_copy_file(oloc_dst->file, H5O_SHARED_TYPE, shared_src, shared_dst, mesg_flags, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to fix shared message in post copy") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to fix shared message in post copy"); #ifdef H5O_SHARED_POST_COPY_FILE_UPD /* Call native message's post copy file update callback to update the * message */ if (H5O_SHARED_POST_COPY_FILE_UPD(oloc_src, mesg_src, oloc_dst, mesg_dst, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to update native message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to update native message"); #endif /* H5O_SHARED_POST_COPY_FILE_UPD */ - /* Make sure that if the the source or destination is committed, both are + /* Make sure that if the source or destination is committed, both are * committed */ - HDassert((shared_src->type == H5O_SHARE_TYPE_COMMITTED) == - (shared_dst->type == H5O_SHARE_TYPE_COMMITTED)); + assert((shared_src->type == H5O_SHARE_TYPE_COMMITTED) == (shared_dst->type == H5O_SHARE_TYPE_COMMITTED)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -433,16 +395,11 @@ H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const * * Purpose: Prints debugging info for a potentially shared message. * - * Note: The actual name of this routine can be different in each source - * file that this header file is included in, and must be defined - * prior to including this header file. - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Quincey Koziol - * Saturday, February 3, 2007 + * Note: The actual name of this routine can be different in each source + * file that this header file is included in, and must be defined + * prior to including this header file. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static inline herr_t @@ -468,12 +425,12 @@ H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwid if (H5O_IS_STORED_SHARED(sh_mesg->type)) { /* Print shared message information */ if (H5O__shared_debug(sh_mesg, stream, indent, fwidth) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display shared message info"); } /* end if */ /* Call native message's debug callback */ if (H5O_SHARED_DEBUG_REAL(f, _mesg, stream, indent, fwidth) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display native message info") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display native message info"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PBmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PBmodule.h index 39db5d971f..3a353dbd0b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5PBmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PBmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5PB package. Including this header means that the source file - * is part of the H5PB package. + * Purpose: This file contains declarations which define macros for the + * H5PB package. Including this header means that the source file + * is part of the H5PB package. */ #ifndef H5PBmodule_H #define H5PBmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PBpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PBpkg.h index b603f03830..603f5652d1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5PBpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PBpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PBprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PBprivate.h index 0a255fc69a..aa7048b6d6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5PBprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PBprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5PBprivate.h - * June 2014 - * Mohamad Chaarawi * *------------------------------------------------------------------------- */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PLextern.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PLextern.h index 7f3df5e2f9..d136051bed 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5PLextern.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PLextern.h @@ -2,7 +2,7 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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://www.hdfgroup.org/licenses. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PLmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PLmodule.h index 4751a48540..3765486974 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5PLmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PLmodule.h @@ -26,7 +26,12 @@ #define H5_MY_PKG H5PL #define H5_MY_PKG_ERR H5E_PLUGIN -/**\defgroup H5PL H5PL +/** \page H5PL_UG The HDF5 Plugins + * @todo Under Construction + */ + +/** + * \defgroup H5PL Dynamically-loaded Plugins (H5PL) * * Use the functions in this module to manage the loading behavior of HDF5 * plugins. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PLpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PLpkg.h index cffc358ae0..9adbefa6e9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5PLpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PLpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PLprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PLprivate.h index 430f3d8c92..0c71b176b7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5PLprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PLprivate.h @@ -2,7 +2,7 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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://www.hdfgroup.org/licenses. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PLpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PLpublic.h index ab24bd5f27..ca99697748 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5PLpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PLpublic.h @@ -2,7 +2,7 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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://www.hdfgroup.org/licenses. * @@ -17,8 +17,7 @@ #ifndef H5PLpublic_H #define H5PLpublic_H -/* Public headers needed by this file */ -#include "H5public.h" /* Generic Functions */ +#include "H5public.h" /* Generic Functions */ /*******************/ /* Public Typedefs */ @@ -95,9 +94,9 @@ H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_control_mask); * \brief Queries the loadability of dynamic plugin types * * \param[out] plugin_control_mask List of dynamic plugin types that are enabled or disabled.\n - * A plugin bit set to 0 (zero) indicates that that the dynamic plugin type is + * A plugin bit set to 0 (zero) indicates that the dynamic plugin type is * disabled.\n - * A plugin bit set to 1 (one) indicates that that the dynamic plugin type is + * A plugin bit set to 1 (one) indicates that the dynamic plugin type is * enabled.\n * If the value of \p plugin_control_mask is negative, all dynamic plugin * types are enabled.\n @@ -105,7 +104,7 @@ H5_DLL herr_t H5PLset_loading_state(unsigned int plugin_control_mask); * are disabled. * \return \herr_t * - * \details H5PLget_loading_state() retrieves the bitmask that controls whether a certain type of plugins + * \details H5PLget_loading_state() retrieves the bitmask that controls whether a certain type of plugin * (e.g.: filters, VOL drivers) will be loaded by the HDF5 library. * * Bit positions allocated to date are specified in \ref H5PL_type_t as follows: diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PTpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PTpublic.h new file mode 100644 index 0000000000..3016e77ba6 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PTpublic.h @@ -0,0 +1,517 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5PTpublic_H +#define H5PTpublic_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** \page H5PT_UG The HDF5 High Level Packet Table + * @todo Under Construction + */ + +/**\defgroup H5PT HDF5 Packet Table APIs (H5PT) + * + * Creating and manipulating HDF5 datasets to support append- + * and read-only operations on table data (H5PT) + * + * The HDF5 Packet Table API is designed to allow records to be + * appended to and read from a table. Packet Table datasets are + * chunked, allowing them to grow as needed. + * + * The Packet Table API, with the H5PT prefix, is not to be confused with + * the H5TB Table API (H5TB prefix). The H5TB APIs are stateless + * (H5TB Tables do not need to be opened or closed) but H5PT Packet Tables + * require less performance overhead. Also, H5TB Tables support insertions + * and deletions, while H5PT Packet Tables support only append operations. + * H5TB functions should not be called on tables created with the + * H5PT API, or vice versa. + * + * Packet Tables are datasets in an HDF5 file, so while their contents + * should not be changed outside of the H5PT API calls, the datatypes of + * Packet Tables can be queried using \ref H5Dget_type. + * Packet Tables can also be given attributes using the normal HDF5 APIs. + * + * \note \Bold{Programming hints:} + * \note The following line includes the HDF5 Packet Table package, H5PT, + * in C applications: + * \code #include "hdf5_hl.h" \endcode + * Without this include, an application will not have access to + * these functions. + * + * - \ref H5PTappend + * \n Appends packets to the end of a packet table. + * - \ref H5PTclose + * \n Closes an open packet table. + * - \ref H5PTcreate + * \n Creates a packet table to store fixed-length + * or variable-length packets. + * - \ref H5PTcreate_fl + * \n Creates a packet table to store fixed-length packets. + * - \ref H5PTcreate_index + * \n Resets a packet table's index to the first packet. + * - \ref H5PTfree_vlen_buff + * \n Releases memory allocated in the process of + * reading variable-length packets. + * - \ref H5PTget_dataset + * \n Returns the backend dataset of this packet table. + * - \ref H5PTget_index + * \n Gets the current record index for a packet table + * - \ref H5PTget_next + * \n Reads packets from a packet table starting at the + * current index. + * - \ref H5PTget_num_packets + * \n Returns the number of packets in a packet table. + * - \ref H5PTget_type + * \n Returns the backend datatype of this packet table. + * - \ref H5PTis_valid + * \n Determines whether an identifier points to a packet table. + * - \ref H5PTis_varlen + * \n Determines whether a packet table contains variable-length + * or fixed-length packets. + * - \ref H5PTopen + * \n Opens an existing packet table. + * - \ref H5PTread_packets + * \n Reads a number of packets from a packet table. + * - \ref H5PTset_index + * \n Sets a packet table's index. + * + */ + +/*------------------------------------------------------------------------- + * Create/Open/Close functions + *------------------------------------------------------------------------- + */ +/* NOTE: H5PTcreate is replacing H5PTcreate_fl for better name due to the + removal of H5PTcreate_vl. H5PTcreate_fl may be retired in 1.8.19. */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Creates a packet table to store fixed-length or + * variable-length packets. + * + * \fg_loc_id + * \param[in] dset_name The name of the packet table to create + * \param[in] dtype_id The datatype of the packet + * \param[in] chunk_size The size in number of table entries per chunk + * \param[in] plist_id Identifier of the property list. Can be used to + * specify the compression of the packet table. + * + * \return Returns an identifier for the new packet table or + * #H5I_INVALID_HID on error. + * + * \details The H5PTcreate() creates and opens a packet table named + * \p dset_name attached to the object specified by the + * identifier \p loc_id. The created packet table should be closed + * with H5PTclose(), eventually. + * + * The datatype, \p dtype_id, may specify any datatype, including + * variable-length data. If \p dtype_id specifies a compound + * datatype, one or more fields in that compound type may be + * variable-length. + * + * \p chunk_size is the size in number of table entries per chunk. + * Packet table datasets use HDF5 chunked storage + * to allow them to grow. This value allows the user + * to set the size of a chunk. The chunk size affects + * performance. + * + * \since 1.10.0 and 1.8.17 + * + */ +H5_HLDLL hid_t H5PTcreate(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_size, + hid_t plist_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Opens an existing packet table. + * + * \fg_loc_id + * \param[in] dset_name The name of the packet table to open + * + * \return Returns an identifier for the packet table or + * #H5I_INVALID_HID on error. + * + * \details H5PTopen() opens an existing packet table in the file or group + * specified by \p loc_id. \p dset_name is the name of the packet + * table and is used to identify it in the file. This function is + * used to open both fixed-length packet tables and variable-length + * packet tables. The packet table should later be closed with + * H5PTclose(). + * + */ +H5_HLDLL hid_t H5PTopen(hid_t loc_id, const char *dset_name); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Closes an open packet table. + * + * \param[in] table_id Identifier of packet table to be closed + * + * \return \herr_t + * + * \details The H5PTclose() ends access to a packet table specified + * by \p table_id. + * + */ +H5_HLDLL herr_t H5PTclose(hid_t table_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Creates a packet table to store fixed-length packets + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[in] dtype_id The datatype of a packet. + * \param[in] chunk_size The size in number of table entries per + * chunk. + * \param[in] compression The compression level; + * a value of 0 through 9. + * + * \return Returns an identifier for the packet table or + * #H5I_INVALID_HID on error. + * + * \deprecated This function was deprecated in favor of the function + * H5PTcreate(). + * + * \details The H5PTcreate_fl() creates and opens a packet table + * named \p dset_name attached to the object specified by + * the identifier \p loc_id. It should be closed + * with H5PTclose(). + * + * The datatype, \p dtype_id, may specify any datatype, + * including variable-length data. If \p dtype_id specifies a + * compound datatype, one or more fields in that compound type + * may be variable-length. + * + * \p chunk_size is the size in number of table entries per chunk. + * Packet table datasets use HDF5 chunked storage + * to allow them to grow. This value allows the user + * to set the size of a chunk. The chunk size affects + * performance. + * + * \p compression is the compression level, a value of 0 through 9. + * Level 0 is faster but offers the least compression; + * level 9 is slower but offers maximum compression. + * A setting of -1 indicates that no compression is desired. + * + */ +/* This function may be removed from the packet table in release 1.8.19. */ +H5_HLDLL hid_t H5PTcreate_fl(hid_t loc_id, const char *dset_name, hid_t dtype_id, hsize_t chunk_size, + int compression); + +/*------------------------------------------------------------------------- + * Write functions + *------------------------------------------------------------------------- + */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Appends packets to the end of a packet table. + * + * \param[in] table_id Identifier of packet table to which + * packets should be appended + * \param[in] nrecords Number of packets to be appended + * \param[in] data Buffer holding data to write + * + * \return \herr_t + * + * \details The H5PTappend() writes \p nrecords packets to the end of a + * packet table specified by \p table_id. \p data is a buffer + * containing the data to be written. For a packet table holding + * fixed-length packets, this data should be in the packet + * table's datatype. For a variable-length packet table, + * the data should be in the form of #hvl_t structs. + * + */ +H5_HLDLL herr_t H5PTappend(hid_t table_id, size_t nrecords, const void *data); + +/*------------------------------------------------------------------------- + * Read functions + *------------------------------------------------------------------------- + */ +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Reads packets from a packet table starting at the current index. + * + * \param[in] table_id Identifier of packet table to read from + * \param[in] nrecords Number of packets to be read + * \param[out] data Buffer into which to read data + * + * \return \herr_t + * + * \details The H5PTget_next() reads \p nrecords packets starting with + * the "current index" from a packet table specified by \p table_id. + * The packet table's index is set and reset with H5PTset_index() + * and H5PTcreate_index(). \p data is a buffer into which the + * data should be read. + * + * For a packet table holding variable-length records, the data + * returned in the buffer will be in form of a #hvl_t struct + * containing the length of the data and a pointer to it in memory. + * The memory used by this data must be freed using H5PTfree_vlen_buff(). + * + */ +H5_HLDLL herr_t H5PTget_next(hid_t table_id, size_t nrecords, void *data); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Reads a number of packets from a packet table. + * + * \param[in] table_id Identifier of packet table to read from + * \param[in] start Packet to start reading from + * \param[in] nrecords Number of packets to be read + * \param[out] data Buffer into which to read data. + * + * \return \herr_t + * + * \details The H5PTread_packets() reads \p nrecords packets starting at + * packet number \p start from a packet table specified by + * \p table_id. \p data is a buffer into which the data should + * be read. + * + * For a packet table holding variable-length records, the data + * returned in the buffer will be in form of #hvl_t structs, + * each containing the length of the data and a pointer to it in + * memory. The memory used by this data must be freed using + * H5PTfree_vlen_buff(). + * + */ +H5_HLDLL herr_t H5PTread_packets(hid_t table_id, hsize_t start, size_t nrecords, void *data); + +/*------------------------------------------------------------------------- + * Inquiry functions + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Returns the number of packets in a packet table. + * + * \param[in] table_id Identifier of packet table to query + * \param[out] nrecords Number of packets in packet table + * + * \return \herr_t + * + * \details The H5PTget_num_packets() returns by reference the number + * of packets in a packet table specified by \p table_id. + * + */ +H5_HLDLL herr_t H5PTget_num_packets(hid_t table_id, hsize_t *nrecords); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Determines whether an identifier points to a packet table. + * + * \param[in] table_id Identifier to query + * + * \return Returns a non-negative value if \p table_id is + * a valid packet table, otherwise returns a negative value. + * + * \details The H5PTis_valid() returns a non-negative value if + * \p table_id corresponds to an open packet table, + * and returns a negative value otherwise. + * + */ +H5_HLDLL herr_t H5PTis_valid(hid_t table_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Determines whether a packet table contains + * variable-length or fixed-length packets. + * + * \param[in] table_id Packet table to query + * + * \return Returns 1 for a variable-length packet table, + * 0 for fixed-length, or a negative value on error. + * + * \details The H5PTis_varlen() returns 1 (TRUE) if \p table_id is + * a packet table containing variable-length records. + * It returns 0 (FALSE) if \p table_id is a packet table + * containing fixed-length records. If \p table_id is not a + * packet table, a negative value is returned. + * + * \version 1.10.0 and 1.8.17 Function re-introduced. + * Function had been removed in 1.8.3. + * + */ +H5_HLDLL herr_t H5PTis_varlen(hid_t table_id); + +/*------------------------------------------------------------------------- + * + * Accessor functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Returns the backend dataset of this packet table. + * + * \param[in] table_id Identifier of the packet table + * + * \return Returns a dataset identifier or H5I_INVALID_HID on error. + * + * \details The H5PTget_dataset() returns the identifier of the dataset + * storing the packet table \p table_id. This dataset identifier + * will be closed by H5PTclose(). + * + * \since 1.10.0 and 1.8.17 + * + */ +H5_HLDLL hid_t H5PTget_dataset(hid_t table_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Returns the backend datatype of this packet table. + * + * \param[in] table_id Identifier of the packet table + * + * \return Returns a datatype identifier or H5I_INVALID_HID on error. + * + * \details The H5PTget_type() returns the identifier of the datatype + * used by the packet table \p table_id. This datatype + * identifier will be closed by H5PTclose(). + * + * \since 1.10.0 and 1.8.17 + * + */ +H5_HLDLL hid_t H5PTget_type(hid_t table_id); + +/*------------------------------------------------------------------------- + * + * Packet Table "current index" functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Resets a packet table's index to the first packet. + * + * \param[in] table_id Identifier of packet table whose index + * should be initialized. + * + * \return \herr_t + * + * \details Each packet table keeps an index of the "current" packet + * so that \c get_next can iterate through the packets in order. + * H5PTcreate_index() initializes a packet table's index, and + * should be called before using \c get_next. The index must be + * initialized every time a packet table is created or opened; + * this information is lost when the packet table is closed. + * + */ +H5_HLDLL herr_t H5PTcreate_index(hid_t table_id); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Sets a packet table's index. + * + * \param[in] table_id Identifier of packet table whose index is to be set + * \param[in] pt_index The packet to which the index should point + * + * \return \herr_t + * + * \details Each packet table keeps an index of the "current" packet + * so that \c get_next can iterate through the packets in order. + * H5PTset_index() sets this index to point to a user-specified + * packet (the packets are zero-indexed). + * + */ +H5_HLDLL herr_t H5PTset_index(hid_t table_id, hsize_t pt_index); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Gets the current record index for a packet table. + * + * \param[in] table_id Table identifier + * \param[out] pt_index Current record index + * + * \return \herr_t + * + * \details The H5PTget_index() returns the current record index + * \p pt_index for the table identified by \p table_id. + * + * \since 1.8.0 + * + */ +H5_HLDLL herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index); + +/*------------------------------------------------------------------------- + * + * Memory Management functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5PT + * + * \brief Releases memory allocated in the process of reading + * variable-length packets. + * + * \param[in] table_id Packet table whose memory should be freed. + * \param[in] bufflen Size of \p buff + * \param[in] buff Buffer that was used to read in variable-length + * packets + * + * \return \herr_t + * + * \details When variable-length packets are read, memory is automatically + * allocated to hold them, and must be freed. H5PTfree_vlen_buff() + * frees this memory, and should be called whenever packets are + * read from a variable-length packet table. + * + * \version 1.10.0 and 1.8.17 Function re-introduced. + * Function had been removed in 1.8.3. + * + */ +H5_HLDLL herr_t H5PTfree_vlen_buff(hid_t table_id, size_t bufflen, void *buff); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Pmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Pmodule.h index d771e6e9f7..ea0b2de584 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Pmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Pmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5P package. Including this header means that the source file - * is part of the H5P package. + * Purpose: This file contains declarations which define macros for the + * H5P package. Including this header means that the source file + * is part of the H5P package. */ #ifndef H5Pmodule_H #define H5Pmodule_H @@ -28,10 +25,11 @@ #define H5_MY_PKG H5P #define H5_MY_PKG_ERR H5E_PLIST -/**\defgroup H5P H5P +/** \page H5P_UG Properties and Property Lists in HDF5 * - * Use the functions in this module to manage HDF5 property lists and property - * list classes. HDF5 property lists are the main vehicle to configure the + * \section sec_plist Properties and Property Lists in HDF5 + * + * HDF5 property lists are the main vehicle to configure the * behavior of HDF5 API functions. * * Typically, property lists are created by instantiating one of the built-in @@ -40,27 +38,903 @@ * or writing data. Property lists can be modified by adding or changing * properties. Property lists are deleted by closing the associated handles. * + * \subsection subsec_plist_intro Introduction + * + * HDF5 properties and property lists make it possible to shape or modify an HDF5 file, group, + * dataset, attribute, committed datatype, or even an I/O stream, in a number of ways. For example, + * you can do any of the following: + * \li Customize the storage layout of a file to suit a project or task. + * \li Create a chunked dataset. + * \li Apply compression or filters to raw data. + * \li Use either ASCII or UTF-8 character encodings. + * \li Create missing groups on the fly. + * \li Switch between serial and parallel I/O. + * \li Create consistency within a single file or across an international project. + * + * Some properties enable an HDF5 application to take advantage of the capabilities of a specific + * computing environment while others make a file more compact; some speed the reading or + * writing of data while others enable more record-keeping at a per-object level. HDF5 offers + * nearly one hundred specific properties that can be used in literally thousands of combinations to + * maximize the usability of HDF5-stored data. + * + * At the most basic level, a property list is a collection of properties, represented by name/value + * pairs that can be passed to various HDF5 functions, usually modifying default settings. A + * property list inherits a set of properties and values from a property list class. But that statement + * hardly provides a complete picture; in the rest of this section and in the next section, + * \ref subsec_plist_class , we will discuss these things in much more detail. + * After reading that material, the reader should have a reasonably complete understanding of how + * properties and property lists can be used in HDF5 applications. + * + *
+ * + * + * + *
+ * \image html PropListEcosystem.gif "The HDF5 property environment" + *
+ * + * The remaining sections in this chapter discuss the following topics: + * \li What are properties, property lists, and property list classes? + * \li Property list programming model + * \li Generic property functions + * \li Summary listings of property list functions + * \li Additional resources + * + * The discussions and function listings in this chapter focus on general property operations, object + * and link properties, and related functions. + * + * File, group, dataset, datatype, and attribute properties are discussed in the chapters devoted to + * those features, where that information will be most convenient to users. For example, \ref sec_dataset + * discusses dataset creation property lists and functions, dataset access property lists and + * functions, and dataset transfer property lists and functions. This chapter does not duplicate those + * discussions. + * + * Generic property operations are an advanced feature and are beyond the scope of this guide. + * + * This chapter assumes an understanding of the following chapters of this \ref UG + * \li \ref sec_data_model + * \li \ref sec_program + * + * \subsection subsec_plist_class Property List Classes, Property Lists, and Properties + * + * HDF5 property lists and the property list interface \ref H5P provide a mechanism for storing + * characteristics of objects in an HDF5 file and economically passing them around in an HDF5 + * application. In this capacity, property lists significantly reduce the burden of additional function + * parameters throughout the HDF5 API. Another advantage of property lists is that features can + * often be added to HDF5 by adding only property list functions to the API; this is particularly true + * when all other requirements of the feature can be accomplished internally to the library. + * + * For instance, a file creation operation needs to know several things about a file, such as the size + * of the userblock or the sizes of various file data structures. Bundling this information as a + * property list simplifies the interface by reducing the number of parameters to the function + * \ref H5Fcreate. + * + * As illustrated in the figure above ("The HDF5 property environment"), the HDF5 property + * environment is a three-level hierarchy: + * \li Property list classes + * \li Property lists + * \li Properties + * + * The following subsections discuss property list classes, property lists, and properties in more detail. + * + * \subsubsection subsubsec_plist_class Property List Classes + * + * A property list class defines the roles that property lists of that class can play. Each class includes + * all properties that are valid for that class with each property set to its default value. HDF5 offers + * a property lists class for each of the following situations. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Property list classes in HDF5
Property List ClassFor further discussion
+ * File creation (FCPL) + * + * \ref H5P_FILE_CREATE + * + * See various sections of \ref sec_file + *
+ * File access (FAPL) + * + * \ref H5P_FILE_ACCESS + * + * Used only as \ref H5P_DEFAULT. + *
+ * File mount (FMPL) + * + * \ref H5P_FILE_MOUNT + * + * For more information, see \ref FileMountProps "File Mount Properties" + *
+ * Object creation (OCPL) + * + * \ref H5P_OBJECT_CREATE + * + * See \ref OCPL + *
+ * Object copy (OCPYPL) + * + * \ref H5P_OBJECT_COPY + * + * + *
+ * Group creation (GCPL) + * + * \ref H5P_GROUP_CREATE + * + * See \ref subsec_group_program + *
+ * Group access (GAPL) + * + * \ref H5P_GROUP_ACCESS + * + * + *
+ * Link creation (LCPL) + * + * \ref H5P_LINK_CREATE + * + * See examples in \ref subsec_plist_program and \ref LCPL + *
+ * Link access (LAPL) + * + * \ref H5P_LINK_ACCESS + * + * + *
+ * Dataset creation (DCPL) + * + * \ref H5P_DATASET_CREATE + * + * See \ref subsec_dataset_program + *
+ * Dataset access (DAPL) + * + * \ref H5P_DATASET_ACCESS + * + * + *
+ * Dataset transfer (DXPL) + * + * \ref H5P_DATASET_XFER + * + * + *
+ * Datatype creation (TCPL) + * + * \ref H5P_DATATYPE_CREATE + * + * See various sections of \ref sec_datatype + *
+ * String creation (STRCPL) + * + * \ref H5P_STRING_CREATE + * + * See \ref subsec_dataset_program and \ref subsec_datatype_program + *
+ * Attribute creation (ACPL) + * + * \ref H5P_ATTRIBUTE_CREATE + * + * See \ref subsec_attribute_work. + *
+ * + * Note: In the table above, the abbreviations to the right of each property list class name in this + * table are widely used in both HDF5 programmer documentation and HDF5 source code. For + * example, \ref FCPL (FCPL) is the file creation property list, \ref OCPL (OCPL) is the object creation + * property list, \ref OCPYPL (OCPYPL) is object copy property list, and \ref STRCPL (STRCPL) is the string + * creation property list. These abbreviations may appear in either uppercase or lowercase. + * + * The “HDF5 property list class inheritance hierarchy” figure, immediately following, illustrates + * the inheritance hierarchy of HDF5's property list classes. Properties are defined at the root of the + * HDF5 property environment (\ref PLCR in the figure below). Property list + * classes then inherit properties from that root, either directly or indirectly through a parent class. + * In every case, a property list class inherits only the properties relevant to its role. For example, + * the \ref OCPL (OCPL) inherits all properties that are relevant to the + * creation of any object while the \ref GCPL (GCPL) inherits only those + * properties that are relevant to group creation. + * + * + * + * + * + *
+ * \image html PropListClassInheritance.gif "HDF5 property list class inheritance hierarchy" + *
+ * Note: In the figure above, property list classes displayed in black are directly accessible through + * the programming interface; the root of the property environment and the \ref STRCPL and \ref OCPL + * property list classes, in gray above, are not user-accessible. The red empty set symbol indicates + * that the \ref FMPL (FMPL) is an empty class; that is, it has no set table + * properties. For more information, see \ref FileMountProps "File Mount Properties". Abbreviations + * used in this figure are defined in the preceding table, \ref table_plist "Property list classes in HDF5". + * + * \subsubsection subsubsec_plist_lists Property Lists + * + * A property list is a collection of related properties that are used together in specific + * circumstances. A new property list created from a property list class inherits the properties of the + * property list class and each property's default value. A fresh dataset creation property list, for + * example, includes all of the HDF5 properties relevant to the creation of a new dataset. + * + * Property lists are implemented as containers holding a collection of name/value pairs. Each pair + * specifies a property name and a value for the property. A property list usually contains + * information for one to many properties. + * + * HDF5's default property values are designed to be reasonable for general use cases. Therefore, + * an application can often use a property list without modification. On the other hand, adjusting + * property list settings is a routine action and there are many reasons for an application to do so. + * + * A new property list may either be derived from a property list class or copied from an existing + * property list. When a property list is created from a property list class, it contains all the + * properties that are relevant to the class, with each property set to its default value. A new + * property list created by copying an existing property list will contain the same properties and + * property values as the original property list. In either case, the property values can be changed as + * needed through the HDF5 API. + * + * Property lists can be freely reused to create consistency. For example, a single set of file, group, + * and dataset creation property lists might be created at the beginning of a project and used to + * create hundreds, thousands, even millions, of consistent files, file structures, and datasets over + * the project's life. When such consistency is important to a project, this is an economical means + * of providing it. + * + * \subsubsection subsubsec_plist_props Properties + * + * A property is the basic element of the property list hierarchy. HDF5 offers nearly one hundred + * properties controlling things ranging from file access rights, to the storage layout of a dataset, + * through optimizing the use of a parallel computing environment. + * + * Further examples include the following: * - * + * + * + * + * + * + * + * + * + * + * * * + * * - * + * * * + * * * *
CreateRead
PurposeExamplesProperty List
+ * Specify the driver to be used to open a file + * + * A POSIX driver or an MPI IO driver + * + * \ref FAPL + *
+ * Specify filters to be applied to a dataset + * + * Gzip compression or checksum evaluation + * + * \ref DCPL + *
- * \snippet{lineno} H5P_examples.c create + * Specify whether to record key times associated with an object + * + * Creation time and/or last-modified time * - * \snippet{lineno} H5P_examples.c read + * \ref OCPL *
UpdateDelete
- * \snippet{lineno} H5P_examples.c update + * Specify the access mode for a file opened via an external link + * + * Read-only or read-write * - * \snippet{lineno} H5P_examples.c delete + * \ref LAPL *
* - * \defgroup ALCAPL Attribute and Link Creation Properties + * Each property is initialized with a default value. For each property, there are one or more + * dedicated H5Pset_*calls that can be used to change that value. + * + *

Creation, access, and transfer properties:

+ * + * Properties fall into one of several major categories: creation properties, access properties, and + * transfer properties. + * + * Creation properties control permanent object characteristics. These characteristics must be + * established when an object is created, cannot change through the life of the object (they are + * immutable), and the property setting usually has a permanent presence in the file. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Examples of creation properties include:
+ *

+ * Whether a dataset is stored in a compact, contiguous, or chunked layout
+ *
+ * The default for this dataset creation property (\ref H5Pset_layout) is that a dataset is + * stored in a contiguous block. This works well for datasets with a known size limit that + * will fit easily in system memory.
+ *
+ * A chunked layout is important if a dataset is to be compressed, to enable extending + * the dataset's size, or to enable caching during I/O.
+ *
+ * A compact layout is suitable only for very small datasets because the raw data is + * stored in the object header. + *

+ *
+ *

+ * Creation of intermediate groups when adding an object to an HDF5 file
+ *
+ * This link creation property, \ref H5Pset_create_intermediate_group, enables an + * application to add an object in a file without having to know that the group or group + * hierarchy containing that object already exists. With this property set, HDF5 + * automatically creates missing groups. If this property is not set, an application must + * verify that each group in the path exists, and create those that do not, before creating + * the new object; if any group is missing, the create operation will fail. + *

+ *
+ *

+ * Whether an HDF5 file is a single file or a set of tightly related files that form a virtual + * HDF5 file
+ *
+ * Certain file creation properties enable the application to select one of several file + * layouts. Examples of the available layouts include a standard POSIX-compliant + * layout (\ref H5Pset_fapl_sec2), a family of files (\ref H5Pset_fapl_family), and a split file + * layout that separates raw data and metadata into separate files (\ref H5Pset_fapl_split). + * These and other file layout options are discussed in \ref subsec_file_alternate_drivers. + *

+ *
+ *

+ * To enable error detection when creating a dataset
+ *
+ * In settings where data integrity is vulnerable, it may be desirable to set + * checksumming when datasets are created (\ref H5Pset_fletcher32). A subsequent + * application will then have a means to verify data integrity when reading the dataset. + *

+ *
+ * + * Access properties control transient object characteristics. These characteristics may change with + * the circumstances under which an object is accessed. + * + * + * + * + * + * + * + * + * + *
Examples of access properties include:
+ *

+ * The driver used to open a file
+ *
+ * For example, a file might be created with the MPI I/O driver (\ref H5Pset_fapl_mpio) + * during high-speed data acquisition in a parallel computing environment. The same + * file might later be analyzed in a serial computing environment with I/O access + * handled through the serial POSIX driver (\ref H5Pset_fapl_sec2). + *

+ *
+ *

+ * Optimization settings in specialized environments
+ *
+ * Optimizations differ across computing environments and according to the needs of + * the task being performed, so are transient by nature. + *

+ *
+ * + * Transfer properties apply only to datasets and control transient aspects of data I/O. These + * characteristics may change with the circumstances under which data is accessed. + * + * + * + * + * + * + * + * + * + *
Examples of dataset transfer properties include:
+ *

+ * To enable error detection when reading a dataset
+ *
+ * If checksumming has been set on a dataset (with \ref H5Pset_fletcher32, in the dataset + * creation property list), an application reading that dataset can choose whether to check + * for data integrity (\ref H5Pset_edc_check). + *

+ *
+ *

+ * Various properties to optimize chunked data I/O on parallel computing systems
+ *
+ * HDF5 provides several properties for tuning I/O of chunked datasets in a parallel + * computing environment (\ref H5Pset_dxpl_mpio_chunk_opt, \ref H5Pset_dxpl_mpio_chunk_opt_num, + * \ref H5Pset_dxpl_mpio_chunk_opt_ratio, and \ref H5Pget_mpio_actual_chunk_opt_mode).
+ *
+ * Optimal settings differ due to the characteristics of a computing environment and due + * to an application's data access patterns; even when working with the same file, these + * settings might change for every application and every platform. + *

+ *
+ * + * \subsection subsec_plist_program Programming Model for Properties and Property Lists + * + * The programming model for HDF5 property lists is actually quite simple: + * \li Create a property list. + * \li Modify the property list, if required. + * \li Use the property list. + * \li Close the property list. + * + * There are nuances, of course, but that is the basic process. + * + * In some cases, you will not have to define property lists at all. If the default property settings are + * sufficient for your application, you can tell HDF5 to use the default property list. + * + * The following sections first discuss the use of default property lists, then each step of the + * programming model, and finally a few less frequently used property list operations. + * + * \subsubsection subsubsec_plist_default Using Default Property Lists + * + * Default property lists can simplify many routine HDF5 tasks because you do not always have to + * create every property list you use. + * + * An application that would be well-served by HDF5's default property settings can use the default + * property lists simply by substituting the value \ref H5P_DEFAULT for a property list identifier. + * HDF5 will then apply the default property list for the appropriate property list class. + * + * For example, the function \ref H5Dcreate2 calls for a link creation property list, a dataset creation + * property list, and a dataset access property list. If the default properties are suitable for a dataset, + * this call can be made as + * \code + * dset_id = H5Dcreate2( loc_id, name, dtype_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT ); + * \endcode + * HDF5 will then apply the default link creation, dataset creation, and dataset access property lists + * correctly. + * + * Of course, you would not want to do this without considering where it is appropriate, as there + * may be unforeseen consequences. Consider, for example, the use of chunked datasets. Optimal + * chunking is quite dependent on the makeup of the dataset and the most common access patterns, + * both of which must be taken into account in setting up the size and shape of chunks. + * + * \subsubsection subsubsec_plist_basic Basic Steps of the Programming Model + * + * The steps of the property list programming model are described in the sub-sections below. + * + *

Create a Property List

+ * + * A new property list can be created either as an instance of a property list class or by copying an + * existing property list. Consider the following examples. A new dataset creation property list is + * first created "from scratch" with \ref H5Pcreate. A second dataset creation property list is then + * created by copying the first one with \ref H5Pcopy. + * + * \code + * dcplA_id = H5Pcreate (H5P_DATASET_CREATE); + * \endcode + * + * The new dataset creation property list is created as an instance of the property list class + * \ref H5P_DATASET_CREATE. + * + * The new dataset creation property list's identifier is returned in dcplA_id and the property list is + * initialized with default dataset creation property values. + * + * A list of valid classes appears in the table \ref table_plist "Property list classes in HDF5". + * + * \code + * dcplB_id = H5Pcopy (dcplA_id); + * \endcode + * + * A new dataset creation property list, dcplB_id, is created as a copy of dcplA_id and is initialized + * with dataset creation property values currently in dcplA_id. + * + * At this point, dcplA_id and dcplB_id are identical; they will both contain any modified property + * values that were changed in dcplA_id before dcplB_id was created. They may, however, diverge + * as additional property values are reset in each. + * + * While we are creating property lists, let's create a link creation property list; we will need this + * property list when the new dataset is linked into the file below: + * \code + * lcplAB_id = H5Pcreate (H5P_LINK_CREATE); + * \endcode + * + *

Change Property Values

+ * + * This section describes how to set property values. + * + * Later in this section, the dataset creation property lists dcplA_id and dcplB_id created in the + * section above will be used respectively to create chunked and contiguous datasets. To set this up, + * we must set the layout property in each property list. The following example sets dcplA_id for + * chunked datasets and dcplB_id for contiguous datasets: + * \code + * error = H5Pset_layout (dcplA_id, H5D_CHUNKED); + * error = H5Pset_layout (dcplB_id, H5D_CONTIGUOUS); + * \endcode + * + * Since dcplA_id specifies a chunked layout, we must also set the number of dimensions and the + * size of the chunks. The example below specifies that datasets created with dcplA_id will be + * 3-dimensional and that the chunk size will be 100 in each dimension: + * \code + * error = H5Pset_chunk (dcplA_id, 3, [100,100,100]); + * \endcode + * + * These datasets will be created with UTF-8 encoded names. To accomplish that, the following + * example sets the character encoding property in the link creation property list to create link + * names with UTF-8 encoding: + * \code + * error = H5Pset_char_encoding (lcplAB_id, H5T_CSET_UTF8); + * \endcode + * + * dcplA_id can now be used to create chunked datasets and dcplB_id to create contiguous datasets. + * And with the use of lcplAB_id, they will be created with UTF-8 encoded names. + * + *

Use the Property List

+ * + * Once the required property lists have been created, they can be used to control various HDF5 + * processes. For illustration, consider dataset creation. + * + * Assume that the datatype dtypeAB and the dataspaces dspaceA and dspaceB have been defined + * and that the location identifier locAB_id specifies the group AB in the current HDF5 file. We + * have already created the required link creation and dataset creation property lists. + * For the sake of illustration, we assume that the default dataset access property list meets our application + * requirements. The following calls would create the datasets dsetA and dsetB in the group AB. + * The raw data in dsetA will be contiguous while dsetB raw data will be chunked; both datasets + * will have UTF-8 encoded link names: + * + * \code + * dsetA_id = H5Dcreate2( locAB_id, dsetA, dtypeAB, dspaceA_id, + * lcplAB_id, dcplA_id, H5P_DEFAULT ); + * dsetB_id = H5Dcreate2( locAB_id, dsetB, dtypeAB, dspaceB_id, + * lcplAB_id, dcplB_id, H5P_DEFAULT ); + * \endcode + * + *

Close the Property List

+ * + * Generally, creating or opening anything in an HDF5 file results in an HDF5 identifier. These + * identifiers are of HDF5 type hid_t and include things like file identifiers, often expressed as + * file_id; dataset identifiers, dset_id; and property list identifiers, plist_id. To reduce the risk of + * memory leaks, all of these identifiers must be closed once they are no longer needed. + * + * Property list identifiers are no exception to this rule, and \ref H5Pclose is used for this purpose. The + * calls immediately following would close the property lists created and used in the examples above. + * + * \code + * error = H5Pclose (dcplA_id); + * error = H5Pclose (dcplB_id); + * error = H5Pclose (lcplAB_id); + * \endcode + * + * \subsubsection subsubsec_plist_additional Additional Property List Operations + * + * A few property list operations fall outside of the programming model described above. This + * section describes those operations. + * + *

Query the Class of an Existing Property List

+ * + * Occasionally an application will have a property list but not know the corresponding property list + * class. A call such as in the following example will retrieve the unknown class of a known property list: + * \code + * PList_Class = H5Pget_class (dcplA_id); + * \endcode + * + * Upon this function's return, PList_Class will contain the value \ref H5P_DATASET_CREATE indicating that + * dcplA_id is a dataset creation property list. + + *

Determine Current Creation Property List Settings in an Existing Object

+ * + * After a file has been created, another application may work on the file without knowing how the + * creation properties for the file were set up. Retrieving these property values is often unnecessary; + * HDF5 can read the data and knows how to deal with any properties it encounters. + * + * But sometimes an application must do something that requires knowing the creation property + * settings. HDF5 makes the acquisition of this information fairly straight-forward; for each + * property setting call, H5Pset_*, there is a corresponding H5Pget_*call to retrieve the property's + * current setting. + * + * Consider the following examples which illustrate the determination of dataset layout and chunking settings: + * + * The application must first identify the creation property list with the appropriate get creation property + * list call. There is one such call for each kind of object. + * + * \ref H5Dget_create_plist will return a property list identifier for the creation property list that was + * used to create the dataset. Call it DCPL1_id. + * + * \ref H5Pset_layout sets a dataset's layout to be compact, contiguous, or chunked. + * + * \ref H5Pget_layout called with DCPL1_id will return the dataset's layout, + * either \ref H5D_COMPACT, \ref H5D_CONTIGUOUS, or \ref H5D_CHUNKED. + * + * \ref H5Pset_chunk sets the rank of a dataset, that is the number of dimensions it will have, and the + * maximum size of each dimension. + * + * \ref H5Pget_chunk, also called with DCPL1_id, will return the rank of the dataset and the maximum + * size of each dimension. + * + * If a creation property value has not been explicitly set, these H5Pget_calls will return the + * property's default value. + * + *

Determine Access Property Settings

+ * + * Access property settings are quite different from creation properties. Since access property + * settings are not retained in an HDF5 file or object, there is normally no knowledge of the settings + * that were used in the past. On the other hand, since access properties do not affect characteristics + * of the file or object, this is not normally an issue. For more information, see "Access and + * Creation Property Exceptions." + * + * One circumstance under which an application might need to determine access property settings + * might be when a file or object is already open but the application does not know the property list + * settings. In that case, the application can use the appropriate get access property list + * call to retrieve a property list identifier. For example, if the dataset dsetA + * from the earlier examples is still open, the following call would return an identifier for the dataset + * access property list in use: + * \code + * dsetA_dacpl_id = H5Dget_access_plist( dsetA_id ); + * \endcode + * + * The application could then use the returned property list identifier to analyze the property settings + * + * \subsection subsec_plist_generic Generic Properties Interface and User-defined Properties + * + * HDF5's generic property interface provides tools for managing the entire property hierarchy and + * for the creation and management of user-defined property lists and properties. This interface also + * makes it possible for an application or a driver to create, modify, and manage custom properties, + * property lists, and property list classes. A comprehensive list of functions for this interface + * appears under "Generic Property Operations (Advanced)" in the "H5P: Property List Interface" + * section of the \ref RM. + * + * Further discussion of HDF5's generic property interface and user-defined properties and + * property lists is beyond the scope of this document. + * + * \subsection subsec_plist_H5P Property List Function Summaries + * + * General property functions, generic property functions and macros, property functions that are + * used with multiple types of objects, and object and link property functions are listed below. + * + * Property list functions that apply to a specific type of object are listed in the chapter that + * discusses that object. For example, the \ref sec_dataset chapter has two property list function listings: + * one for dataset creation property list functions and one for dataset access property list functions. + * As has been stated, this chapter is not intended to describe every property list function. + * + * \ref H5P reference manual + * + * \subsection subsec_plist_resources Additional Property List Resources + * Property lists are ubiquitous in an HDF5 environment and are therefore discussed in many places + * in HDF5 documentation. The following sections and listings in the \ref UG are of + * particular interest: + * \li In the \ref sec_data_model chapter, see \ref subsubsec_data_model_abstract_plist. + * \li In the \ref sec_file chapter, see the following sections and listings: + *
  • \ref subsec_file_creation_access
  • + *
  • \ref subsec_file_property_lists
  • + *
  • \ref subsubsec_file_examples_props
  • + *
  • \ref subsubsec_file_examples_access
  • + *
  • \ref dcpl_table_tag "Dataset creation property list functions (H5P)"
  • + *
  • \ref fapl_table_tag "File access property list functions (H5P)"
  • + *
  • \ref fd_pl_table_tag "File driver property list functions (H5P)"
+ * \li In the \ref sec_attribute chapter, see "Attribute creation property list functions (H5P)". + * \li In the \ref sec_group chapter, see "Group creation property list functions (H5P)". + * \li Property lists are discussed throughout \ref sec_dataset. + * + * All property list functions are described in the \ref H5P section of the + * \ref RM. The function index at the top of the page provides a categorized listing + * grouped by property list class. Those classes are listed below: + * \li \ref FCPL + * \li \ref FAPL + * \li \ref GCPL + * \li \ref DCPL + * \li \ref DAPL + * \li \ref DXPL + * \li \ref LCPL + * \li \ref LAPL + * \li \ref OCPL + * \li \ref OCPYPL + * + * Additional categories not related to the class structure are as follows: + * \li General property list operations + * \li Generic property list functions + * + * The general property functions can be used with any property list; the generic property functions + * constitute an advanced feature. + * + * The in-memory file image feature of HDF5 uses property lists in a manner that differs + * substantially from their use elsewhere in HDF5. Those who plan to use in-memory file images + * must study "File Image Operations" (PDF) in the Advanced Topics in HDF5collection. + * + * \subsection subsec_plist_notes Notes + * + * \anchor FileMountProps

File Mount Properties

+ * + * While the file mount property list class \ref H5P_FILE_MOUNT is a valid HDF5 property list class, + * no file mount properties are defined by the HDF5 Library. References to a file mount property + * list should always be expressed as \ref H5P_DEFAULT, meaning the default file mount property list. + * + *

Access and Creation Property Exceptions

+ * + * There are a small number of exceptions to the rule that creation properties are always retained in + * a file or object and access properties are never retained. + * + * The following properties are file access properties but they are not transient; they have + * permanent and different effects on a file. They could be validly classified as file creation + * properties as they must be set at creation time to properly create the file. But they are access + * properties because they must also be set when a file is reopened to properly access the file. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
PropertyRelated function
+ * Family file driver + * + * \ref H5Pset_fapl_family + *
+ * Split file driver + * + * \ref H5Pset_fapl_split + *
+ * Core file driver + * + * \ref H5Pset_fapl_core + *
+ * + * The following is a link creation property, but it is not relevant after an object has been created + * and is not retained in the file or object. + * + * + * + * + * + * + *
PropertyRelated function
+ * Create missing intermediate groups + * + * \ref H5Pset_create_intermediate_group + *
+ * + * Previous Chapter \ref sec_error - Next Chapter \ref sec_vol + * + * \defgroup H5P Property Lists (H5P) + * + * Use the functions in this module to manage HDF5 property lists and property + * list classes. HDF5 property lists are the main vehicle to configure the + * behavior of HDF5 API functions. + * + * Typically, property lists are created by instantiating one of the built-in + * or user-defined property list classes. After adding suitable properties, + * property lists are used when opening or creating HDF5 items, or when reading + * or writing data. Property lists can be modified by adding or changing + * properties. Property lists are deleted by closing the associated handles. + * + * \ref PLCR + * \snippet{doc} tables/propertyLists.dox plcr_table + * + * \ref PLCR + * \snippet{doc} tables/propertyLists.dox plcra_table + * + * \ref PLCR / \ref OCPL / \ref GCPL + * \snippet{doc} tables/propertyLists.dox fcpl_table + * + * \ref PLCR + * \snippet{doc} tables/propertyLists.dox fapl_table + * \snippet{doc} tables/propertyLists.dox fd_pl_table + * + * \ref PLCR + * \snippet{doc} tables/propertyLists.dox lapl_table + * + * \ref PLCR / \ref OCPL + * \snippet{doc} tables/propertyLists.dox dcpl_table + * + * \ref PLCR / \ref LAPL + * \snippet{doc} tables/propertyLists.dox dapl_table + * + * \ref PLCR / \ref OCPL + * \snippet{doc} tables/propertyLists.dox gcpl_table + * + * \ref PLCR / \ref LAPL + * \snippet{doc} tables/propertyLists.dox gapl_table + * + * \ref PLCR + * \snippet{doc} tables/propertyLists.dox ocpl_table + * + * \ref PLCR + * \snippet{doc} tables/propertyLists.dox ocpypl_table + * + * \ref PLCR + * \snippet{doc} tables/propertyLists.dox strcpl_table + * + * \ref PLCR / \ref STRCPL + * \snippet{doc} tables/propertyLists.dox lcpl_table + * + * \ref PLCR / \ref STRCPL + * \snippet{doc} tables/propertyLists.dox acpl_table + * + * + * \defgroup STRCPL String Creation Properties * \ingroup H5P * Currently, there are only two creation properties that you can use to control * the creation of HDF5 attributes and links. The first creation property, the @@ -68,8 +942,32 @@ * The second creation property applies to links only, and advises the library * to automatically create missing intermediate groups when creating new objects. * - * \defgroup DAPL Dataset Access Properties + * \snippet{doc} tables/propertyLists.dox strcpl_table + * + * \defgroup LCPL Link Creation Properties + * \ingroup STRCPL + * This creation property applies to links only, and advises the library + * to automatically create missing intermediate groups when creating new objects. + * + * \snippet{doc} tables/propertyLists.dox lcpl_table + * + * @see STRCPL + * + * \defgroup ACPL Attribute Creation Properties + * \ingroup STRCPL + * The creation property, the choice of a character encoding, applies to attributes. + * + * \snippet{doc} tables/propertyLists.dox acpl_table + * + * @see STRCPL + * + * \defgroup LAPL Link Access Properties * \ingroup H5P + * + * \snippet{doc} tables/propertyLists.dox lapl_table + * + * \defgroup DAPL Dataset Access Properties + * \ingroup LAPL * Use dataset access properties to modify the default behavior of the HDF5 * library when accessing datasets. The properties include adjusting the size * of the chunk cache, providing prefixes for external content and virtual @@ -77,14 +975,18 @@ * are \Emph{not} persisted with datasets, and can be adjusted at runtime before * a dataset is created or opened. * + * \snippet{doc} tables/propertyLists.dox dapl_table + * * \defgroup DCPL Dataset Creation Properties - * \ingroup H5P + * \ingroup OCPL * Use dataset creation properties to control aspects of dataset creation such * as fill time, storage layout, compression methods, etc. * Unlike dataset access and transfer properties, creation properties \Emph{are} * stored with the dataset, and cannot be changed once a dataset has been * created. * + * \snippet{doc} tables/propertyLists.dox dcpl_table + * * \defgroup DXPL Dataset Transfer Properties * \ingroup H5P * Use dataset transfer properties to customize certain aspects of reading @@ -92,6 +994,8 @@ * detection, etc. These properties are \Emph{not} persisted with datasets, * and can be adjusted at runtime before a dataset is read or written. * + * \snippet{doc} tables/propertyLists.dox dxpl_table + * * \defgroup FAPL File Access Properties * \ingroup H5P * Use file access properties to modify the default behavior of the HDF5 @@ -100,93 +1004,73 @@ * file locking, etc. These properties are \Emph{not} persisted with files, and * can be adjusted at runtime before a file is created or opened. * + * \snippet{doc} tables/propertyLists.dox fapl_table + * \snippet{doc} tables/propertyLists.dox fd_pl_table + * * \defgroup FCPL File Creation Properties - * \ingroup H5P + * \ingroup GCPL * Use file creation properties to control aspects of file creation such * as setting a file space management strategy or creating a user block. * Unlike file access properties, creation properties \Emph{are} * stored with the file, and cannot be changed once a file has been * created. * - * \defgroup GAPL General Access Properties - * \ingroup H5P - * The functions in this section can be applied to different kinds of property - * lists. + * \snippet{doc} tables/propertyLists.dox fcpl_table + * + * \defgroup GAPL Group Access Properties + * \ingroup LAPL + * The functions in this section can be applied to group property lists. + * + * \snippet{doc} tables/propertyLists.dox gapl_table * * \defgroup GCPL Group Creation Properties - * \ingroup H5P + * \ingroup OCPL * Use group creation properties to control aspects of group creation such * as storage layout, compression, and link creation order tracking. * Unlike file access properties, creation properties \Emph{are} * stored with the group, and cannot be changed once a group has been * created. * - * \defgroup GPLO General Property List Operations - * \ingroup H5P + * \snippet{doc} tables/propertyLists.dox gcpl_table * + * \defgroup PLCR Property List Class Root + * \ingroup H5P * Use the functions in this module to manage HDF5 property lists. * - * - * - * - * - * - * - * - * - * - * - *
CreateRead
- * \snippet{lineno} H5P_examples.c create - * - * \snippet{lineno} H5P_examples.c read - *
UpdateDelete
- * \snippet{lineno} H5P_examples.c update - * - * \snippet{lineno} H5P_examples.c delete - *
+ * \snippet{doc} tables/propertyLists.dox plcr_table * - * \defgroup GPLOA General Property List Operations (Advanced) + * \defgroup PLCRA Property List Class Root (Advanced) * \ingroup H5P - * * You can create and customize user-defined property list classes using the * functions described below. Arbitrary user-defined properties can also * be inserted into existing property lists as so-called temporary properties. * - * - * - * - * - * - * - * - * - * - * - * - *
CreateRead
- * \snippet{lineno} H5P_examples.c create_class - * - * \snippet{lineno} H5P_examples.c read_class - *
UpdateDelete
- * \snippet{lineno} H5P_examples.c update_class - * - * \snippet{lineno} H5P_examples.c delete_class - *
+ * \snippet{doc} tables/propertyLists.dox plcra_table * - * \defgroup LAPL Link Access Properties + * \defgroup OCPL Object Creation Properties * \ingroup H5P * + * \snippet{doc} tables/propertyLists.dox ocpl_table * - * \defgroup MAPL Map Access Properties - * \ingroup H5P - - * \defgroup OCPL Object Creation Properties + * \defgroup OCPYPL Object Copy Properties * \ingroup H5P * + * \snippet{doc} tables/propertyLists.dox ocpypl_table * - * \defgroup OCPPL Object Copy Properties + * \defgroup FMPL File Mount Properties * \ingroup H5P + * Empty property class. + * + * + * \defgroup TCPL Datatype Creation Properties + * \ingroup OCPL + * TCPL isn't supported yet. + * + * + * \defgroup TAPL Datatype Access Properties + * \ingroup LAPL + * TAPL isn't supported yet. + * * * */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Ppkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Ppkg.h index 0723e34367..9a58d0065f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Ppkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Ppkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Friday, November 16, 2001 - * - * Purpose: This file contains declarations which are visible only within - * the H5P package. Source files outside the H5P package should - * include H5Pprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5P package. Source files outside the H5P package should + * include H5Pprivate.h instead. */ #if !(defined H5P_FRIEND || defined H5P_MODULE) #error "Do not include this file outside the H5P package!" diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Pprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Pprivate.h index b74fcf950b..e26c81e97a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Pprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Pprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Ppublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Ppublic.h index 8c021f26fc..124f6614c7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Ppublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Ppublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -18,21 +17,18 @@ #ifndef H5Ppublic_H #define H5Ppublic_H -/* System headers needed by this file */ - -/* Public headers needed by this file */ -#include "H5public.h" -#include "H5ACpublic.h" /* Metadata cache */ +#include "H5public.h" /* Generic Functions */ +#include "H5ACpublic.h" /* Metadata Cache */ #include "H5Dpublic.h" /* Datasets */ #include "H5Fpublic.h" /* Files */ -#include "H5FDpublic.h" /* File drivers */ -#include "H5Ipublic.h" /* ID management */ +#include "H5FDpublic.h" /* (Virtual) File Drivers */ +#include "H5Ipublic.h" /* Identifiers */ #include "H5Lpublic.h" /* Links */ -#include "H5MMpublic.h" /* Memory management */ -#include "H5Opublic.h" /* Object headers */ +#include "H5MMpublic.h" /* Memory Management */ +#include "H5Opublic.h" /* Object Headers */ #include "H5Spublic.h" /* Dataspaces */ #include "H5Tpublic.h" /* Datatypes */ -#include "H5Zpublic.h" /* Data filters */ +#include "H5Zpublic.h" /* Data Filters */ /*****************/ /* Public Macros */ @@ -329,7 +325,6 @@ typedef enum H5D_mpio_actual_io_mode_t { H5D_MPIO_CHUNK_MIXED = 0x1 | 0x2, /**< HDF5 performed one the chunk collective optimization schemes and some chunks were accessed independently, some collectively. */ - /** \internal The contiguous case is separate from the bit field. */ H5D_MPIO_CONTIGUOUS_COLLECTIVE = 0x4 /**< Collective I/O was performed on a contiguous dataset */ } H5D_mpio_actual_io_mode_t; @@ -345,7 +340,8 @@ typedef enum H5D_mpio_no_collective_cause_t { H5D_MPIO_SET_INDEPENDENT = 0x01, /**< Collective I/O was not performed because independent I/O was requested */ H5D_MPIO_DATATYPE_CONVERSION = 0x02, - /**< Collective I/O was not performed because datatype conversions were required */ + /**< Collective I/O was not performed because datatype conversions were required and selection I/O was not + possible (see below) */ H5D_MPIO_DATA_TRANSFORMS = 0x04, /**< Collective I/O was not performed because data transforms needed to be applied */ H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED = 0x08, @@ -358,11 +354,72 @@ typedef enum H5D_mpio_no_collective_cause_t { /**< Collective I/O was not performed because parallel filtered writes are disabled */ H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE = 0x80, /**< Error */ - H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100 + H5D_MPIO_NO_SELECTION_IO = 0x100, + /**< Collective I/O would be supported by selection or vector I/O but that feature was disabled + (see causes via H5Pget_no_selection_io_cause()) */ + H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x200 /**< Sentinel */ } H5D_mpio_no_collective_cause_t; //! +/** + * Causes for H5Pget_no_selection_io_cause() property + */ +#define H5D_SEL_IO_DISABLE_BY_API \ + (0x0001u) /**< Selection I/O was not performed because \ + the feature was disabled by the API */ +#define H5D_SEL_IO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET \ + (0x0002u) /**< Selection I/O was not performed because the \ + dataset was neither contiguous nor chunked */ +#define H5D_SEL_IO_CONTIGUOUS_SIEVE_BUFFER \ + (0x0004u) /**< Selection I/O was not performed because of \ + sieve buffer for contiguous dataset */ +#define H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB \ + (0x0008u) /**< Selection I/O was not performed because the VFD \ + does not have vector or selection I/O callback */ +#define H5D_SEL_IO_PAGE_BUFFER \ + (0x0010u) /**< Selection I/O was not performed because of \ + page buffer */ +#define H5D_SEL_IO_DATASET_FILTER \ + (0x0020u) /**< Selection I/O was not performed because of \ + dataset filters */ +#define H5D_SEL_IO_CHUNK_CACHE \ + (0x0040u) /**< Selection I/O was not performed because of \ + chunk cache */ +#define H5D_SEL_IO_TCONV_BUF_TOO_SMALL \ + (0x0080u) /**< Selection I/O was not performed because the \ + type conversion buffer is too small */ +#define H5D_SEL_IO_BKG_BUF_TOO_SMALL \ + (0x0100u) /**< Selection I/O was not performed because the \ + type conversion background buffer is too small */ +#define H5D_SEL_IO_DEFAULT_OFF \ + (0x0200u) /**< Selection I/O was not performed because the \ + selection I/O mode is DEFAULT and the library \ + chose it to be off for this case */ + +/* Causes for H5D_MPIO_NO_SELECTION_IO */ +#define H5D_MPIO_NO_SELECTION_IO_CAUSES \ + (H5D_SEL_IO_DISABLE_BY_API | H5D_SEL_IO_TCONV_BUF_TOO_SMALL | H5D_SEL_IO_BKG_BUF_TOO_SMALL | \ + H5D_SEL_IO_DATASET_FILTER | H5D_SEL_IO_CHUNK_CACHE) + +//! +/** + * Selection I/O mode property + * + * \details The default value, #H5D_SELECTION_IO_MODE_DEFAULT, + * indicates selection I/O can be ON or OFF as + * determined by library internal. + */ +typedef enum H5D_selection_io_mode_t { + H5D_SELECTION_IO_MODE_DEFAULT = 0, + /**< Default selection I/O mode. */ + H5D_SELECTION_IO_MODE_OFF, + /**< Selection I/O is off. */ + H5D_SELECTION_IO_MODE_ON + /**< Selection I/O is on. */ +} H5D_selection_io_mode_t; +//! + /********************/ /* Public Variables */ /********************/ @@ -392,7 +449,7 @@ H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_VOL_INITIALIZE_ID_g; H5_DLLVAR hid_t H5P_CLS_REFERENCE_ACCESS_ID_g; -/* Default roperty list IDs */ +/* Default property list IDs */ /* (Internal to library, do not use! Use macros above) */ H5_DLLVAR hid_t H5P_LST_FILE_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_FILE_ACCESS_ID_g; @@ -421,7 +478,7 @@ H5_DLLVAR hid_t H5P_LST_REFERENCE_ACCESS_ID_g; /* Generic property list routines */ /** - * \ingroup GPLO + * \ingroup PLCR * * \brief Terminates access to a property list * @@ -439,7 +496,7 @@ H5_DLLVAR hid_t H5P_LST_REFERENCE_ACCESS_ID_g; */ H5_DLL herr_t H5Pclose(hid_t plist_id); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Closes an existing property list class * @@ -456,7 +513,7 @@ H5_DLL herr_t H5Pclose(hid_t plist_id); */ H5_DLL herr_t H5Pclose_class(hid_t plist_id); /** - * \ingroup GPLO + * \ingroup PLCR * * \brief Copies an existing property list to create a new property list * @@ -473,7 +530,7 @@ H5_DLL herr_t H5Pclose_class(hid_t plist_id); */ H5_DLL hid_t H5Pcopy(hid_t plist_id); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Copies a property from one list or class to another * @@ -509,7 +566,7 @@ H5_DLL hid_t H5Pcopy(hid_t plist_id); */ H5_DLL herr_t H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name); /** - * \ingroup GPLO + * \ingroup PLCR * * \brief Creates a new property list as an instance of a property list class * @@ -633,7 +690,7 @@ H5_DLL herr_t H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name); */ H5_DLL hid_t H5Pcreate(hid_t cls_id); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Creates a new property list class * @@ -676,7 +733,7 @@ H5_DLL hid_t H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func H5P_cls_copy_func_t copy, void *copy_data, H5P_cls_close_func_t close, void *close_data); /** - * \ingroup GPLO + * \ingroup PLCR * * \brief Decodes property list received in a binary object buffer and * returns a new property list identifier @@ -705,7 +762,7 @@ H5_DLL hid_t H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func */ H5_DLL hid_t H5Pdecode(const void *buf); /** - * \ingroup GPLO + * \ingroup PLCR * * \brief Encodes the property values in a property list into a binary * buffer @@ -759,7 +816,7 @@ H5_DLL hid_t H5Pdecode(const void *buf); */ H5_DLL herr_t H5Pencode2(hid_t plist_id, void *buf, size_t *nalloc, hid_t fapl_id); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Compares two property lists or classes for equality * @@ -779,7 +836,7 @@ H5_DLL herr_t H5Pencode2(hid_t plist_id, void *buf, size_t *nalloc, hid_t fapl_i */ H5_DLL htri_t H5Pequal(hid_t id1, hid_t id2); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Queries whether a property name exists in a property list or * class @@ -797,7 +854,7 @@ H5_DLL htri_t H5Pequal(hid_t id1, hid_t id2); */ H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Queries the value of a property * @@ -829,7 +886,7 @@ H5_DLL htri_t H5Pexist(hid_t plist_id, const char *name); */ H5_DLL herr_t H5Pget(hid_t plist_id, const char *name, void *value); /** - *\ingroup GPLO + * \ingroup PLCR * * \brief Returns the property list class identifier for a property list * @@ -892,7 +949,7 @@ H5_DLL herr_t H5Pget(hid_t plist_id, const char *name, void *value); */ H5_DLL hid_t H5Pget_class(hid_t plist_id); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Retrieves the name of a class * @@ -1036,7 +1093,7 @@ H5_DLL hid_t H5Pget_class(hid_t plist_id); */ H5_DLL char *H5Pget_class_name(hid_t pclass_id); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Retrieves the parent class of a property class * @@ -1052,7 +1109,7 @@ H5_DLL char *H5Pget_class_name(hid_t pclass_id); */ H5_DLL hid_t H5Pget_class_parent(hid_t pclass_id); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Queries the number of properties in a property list or class * @@ -1075,7 +1132,7 @@ H5_DLL hid_t H5Pget_class_parent(hid_t pclass_id); */ H5_DLL herr_t H5Pget_nprops(hid_t id, size_t *nprops); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Queries the size of a property value in bytes * @@ -1096,7 +1153,7 @@ H5_DLL herr_t H5Pget_nprops(hid_t id, size_t *nprops); */ H5_DLL herr_t H5Pget_size(hid_t id, const char *name, size_t *size); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Registers a temporary property with a property list * @@ -1346,7 +1403,7 @@ H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *va H5P_prp_get_func_t get, H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t copy, H5P_prp_compare_func_t compare, H5P_prp_close_func_t close); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Determines whether a property list is a member of a class * @@ -1366,7 +1423,7 @@ H5_DLL herr_t H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *va */ H5_DLL htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Iterates over properties in a property class or list * @@ -1402,7 +1459,7 @@ H5_DLL htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id); * and the pointer to the operator data passed in to H5Piterate(), * \p iter_data. * - * H5Piterate() assumes that the properties in the object + * \warning H5Piterate() assumes that the properties in the object * identified by \p id remain unchanged through the iteration. * If the membership changes during the iteration, the function's * behavior is undefined. @@ -1412,7 +1469,7 @@ H5_DLL htri_t H5Pisa_class(hid_t plist_id, hid_t pclass_id); */ H5_DLL int H5Piterate(hid_t id, int *idx, H5P_iterate_t iter_func, void *iter_data); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Registers a permanent property with a property list class * @@ -1693,7 +1750,7 @@ H5_DLL herr_t H5Pregister2(hid_t cls_id, const char *name, size_t size, void *de H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t copy, H5P_prp_compare_func_t compare, H5P_prp_close_func_t close); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Removes a property from a property list * @@ -1719,7 +1776,7 @@ H5_DLL herr_t H5Pregister2(hid_t cls_id, const char *name, size_t size, void *de */ H5_DLL herr_t H5Premove(hid_t plist_id, const char *name); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Sets a property list value * @@ -1751,7 +1808,7 @@ H5_DLL herr_t H5Premove(hid_t plist_id, const char *name); */ H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, const void *value); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Removes a property from a property list class * @@ -1770,8 +1827,6 @@ H5_DLL herr_t H5Pset(hid_t plist_id, const char *name, const void *value); */ H5_DLL herr_t H5Punregister(hid_t pclass_id, const char *name); -/* Object creation property list (OCPL) routines */ - /** * \ingroup DCPL * @@ -1791,6 +1846,9 @@ H5_DLL herr_t H5Punregister(hid_t pclass_id, const char *name); * */ H5_DLL htri_t H5Pall_filters_avail(hid_t plist_id); + +/* Object creation property list (OCPL) routines */ + /** * \ingroup OCPL * @@ -2321,10 +2379,13 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level); * (#H5Z_FILTER_DEFLATE) and the Fletcher32 error detection filter * (#H5Z_FILTER_FLETCHER32). * - * The array \p c_values contains \p cd_nelmts integers which are - * auxiliary data for the filter. The integer values will be - * stored in the dataset object header as part of the filter - * information. + * The array \p cd_values contains \p cd_nelmts unsigned integers + * which are auxiliary data for the filter. The values are typically + * used as parameters to control the filter. In a filter's + * \p set_local method (called from \p H5Dcreate), the values are + * interpreted and possibly modified before they are used to control + * the filter. These, possibly modified values, are then stored in + * the dataset object header as auxiliary data for the filter. * * The \p flags argument is a bit vector with the following * fields specifying certain general properties of the filter: @@ -2348,7 +2409,7 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level); * * #H5Z_FLAG_MANDATORY * If the filter is required, that is, set to mandatory, - * and the filter fails, the library’s behavior depends + * and the filter fails, the library's behavior depends * on whether the chunk cache is in use: * \li If the chunk cache is enabled, data chunks will * be flushed to the file during H5Dclose() and the @@ -2415,11 +2476,11 @@ H5_DLL herr_t H5Pset_deflate(hid_t plist_id, unsigned level); * property list, the group will be created with the new group file * format. The filters will come into play only when dense storage * is used (see H5Pset_link_phase_change()) and will be applied to - * the group’s fractal heap. The fractal heap will contain most of - * the the group’s link metadata, including link names. + * the group's fractal heap. The fractal heap will contain most of + * the group's link metadata, including link names. * * \note When working with group creation property lists, if you are - * adding a filter that is not in HDF5’s set of predefined filters, + * adding a filter that is not in HDF5's set of predefined filters, * i.e., a user-defined or third-party filter, you must first * determine that the filter will work for a group. See the * discussion of the set local and can apply callback functions @@ -3265,7 +3326,7 @@ H5_DLL herr_t H5Pget_cache(hid_t plist_id, int *mdc_nelmts, /* out */ * after the call to H5Pset_fapl_core(). It is an error to use this * function with any other VFD. * - * \note This function only applies to the backing store write operation + * \note This function only applies to the backing store write operation, * which typically occurs when the file is flushed or closed. This * function has no relationship to the increment parameter passed * to H5Pset_fapl_core(). @@ -3312,7 +3373,7 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz * * Direct * #H5FD_DIRECT - * This is the #H5FD_SEC2 driver except data is written to or + * This is the #H5FD_SEC2 driver, except data is written to or * read from the file synchronously without being cached by the * system. * H5Pset_fapl_direct() @@ -3352,9 +3413,9 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz * * Family * #H5FD_FAMILY - * With this driver, the HDF5 file’s address space is partitioned + * With this driver, the HDF5 file's address space is partitioned * into pieces and sent to separate storage files using an - * underlying driver of the user’s choice. This driver is for + * underlying driver of the user's choice. This driver is for * systems that do not support files larger than 2 gigabytes. * * H5Pset_fapl_family() @@ -3363,7 +3424,7 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz * Multi * #H5FD_MULTI * With this driver, data can be stored in multiple files - * according to the type of the data. I/O might work better if + * according to the type of data. I/O might work better if * data is stored in separate files based on the type of data. * The Split driver is a special case of this driver. * H5Pset_fapl_multi() @@ -3463,7 +3524,7 @@ H5_DLL const void *H5Pget_driver_info(hid_t plist_id); * string is simply returned. The caller can then allocate a buffer * of the appropriate size and call this routine again. * - * \version 1.12.1 Function publicized in this release. + * \version 1.14.0 Function publicized in this release. * */ H5_DLL ssize_t H5Pget_driver_config_str(hid_t fapl_id, char *config_buf, size_t buf_size); @@ -3584,7 +3645,7 @@ H5_DLL herr_t H5Pget_fclose_degree(hid_t fapl_id, H5F_close_degree_t *degree); * them when allocating and loading the buffer to return to the * application (see H5Pset_file_image_callbacks()). If file image * callbacks are not defined, the function will use \c malloc and \c - * memcpy. When \c malloc and \c memcpy are used, it is the caller’s + * memcpy. When \c malloc and \c memcpy are used, it is the caller's * responsibility to discard the returned buffer with a call to \c * free. * @@ -3944,7 +4005,7 @@ H5_DLL herr_t H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts); * for more information. * * The type of data returned in \p type will be one of those - * listed in the discussion of the \p type parameter in the the + * listed in the discussion of the \p type parameter in the * description of the function H5Pset_multi_type(). * * Use of this function is only appropriate for an HDF5 file @@ -4017,7 +4078,7 @@ H5_DLL herr_t H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size, unsigned * \brief Returns maximum data sieve buffer size * * \fapl_id{fapl_id} - * \param[in] size Maximum size, in bytes, of data sieve buffer + * \param[out] size Maximum size, in bytes, of data sieve buffer * * \return \herr_t * @@ -4103,7 +4164,7 @@ H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info); * \details H5Pset_alignment() sets the alignment properties of a * file access property list so that any file object greater * than or equal in size to \p threshold bytes will be aligned - * on an address which is a multiple of \p alignment. The + * on an address that is a multiple of \p alignment. The * addresses are relative to the end of the user block; the * alignment is calculated by subtracting the user block size * from the absolute file address and then adjusting the address @@ -4113,7 +4174,7 @@ H5_DLL herr_t H5Pget_vol_info(hid_t plist_id, void **vol_info); * implying no alignment. Generally the default values will * result in the best performance for single-process access to * the file. For MPI IO and other parallel systems, choose an - * alignment which is a multiple of the disk block size. + * alignment that is a multiple of the disk block size. * * If the file space handling strategy is set to * #H5F_FSPACE_STRATEGY_PAGE, then the alignment set via this @@ -4151,7 +4212,7 @@ H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignme * penalized when determining which chunks to flush * from cache. A value of 0 means fully read or * written chunks are treated no differently than - * other chunks (the preemption is strictly LRU) + * other chunks (the preemption is strictly LRU), * while a value of 1 means fully read or written * chunks are always preempted before other chunks. * If your application only reads or writes data once, @@ -4167,13 +4228,13 @@ H5_DLL herr_t H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignme * * \details H5Pset_cache() sets the number of elements, the total number of * bytes, and the preemption policy value for all datasets in a file - * on the file’s file access property list. + * on the file's file access property list. * * The raw data chunk cache inserts chunks into the cache by first * computing a hash value using the address of a chunk and then by - * using that hash value as the chunk’s index into the table of + * using that hash value as the chunk's index into the table of * cached chunks. In other words, the size of this hash table and the - * number of possible hash values is determined by the \p rdcc_nslots + * number of possible hash values are determined by the \p rdcc_nslots * parameter. If a different chunk in the cache has the same hash value, * a collision will occur, which will reduce efficiency. If inserting * the chunk into the cache would cause the cache to be too big, then @@ -4324,7 +4385,7 @@ H5_DLL herr_t H5Pset_driver(hid_t plist_id, hid_t driver_id, const void *driver_ * registered, an attempt will be made to load the driver as a * plugin. * - * \version 1.12.1 Function publicized in this release. + * \version 1.14.0 Function publicized in this release. * */ H5_DLL herr_t H5Pset_driver_by_name(hid_t plist_id, const char *driver_name, const char *driver_config); @@ -4349,7 +4410,7 @@ H5_DLL herr_t H5Pset_driver_by_name(hid_t plist_id, const char *driver_name, con * registered, an attempt will be made to load the driver as a * plugin. * - * \version 1.12.1 Function publicized in this release. + * \version 1.14.0 Function publicized in this release. * */ H5_DLL herr_t H5Pset_driver_by_value(hid_t plist_id, H5FD_class_value_t driver_value, @@ -4405,8 +4466,8 @@ H5_DLL herr_t H5Pset_driver_by_value(hid_t plist_id, H5FD_class_value_t driver_v * file open. * * Files opened through external links inherit the parent - * file’s file access property list by default, and therefore - * inherit the parent file’s external link open file cache + * file's file access property list by default, and therefore + * inherit the parent file's external link open file cache * setting. * * When child files contain external links of their own, the @@ -4648,7 +4709,7 @@ H5_DLL herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); * is released from use. * * Some file drivers allow the use of user-defined callback functions - * for allocating, freeing, and copying the driver’s internal buffer, + * for allocating, freeing, and copying the driver's internal buffer, * potentially allowing optimizations such as avoiding large \c malloc * and \c memcpy operations, or to perform detailed logging. * @@ -5329,16 +5390,16 @@ H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_i * \note The H5VL_CAP_FLAG_ASYNC flag can be checked to see if asynchronous * operations are supported by the VOL connector stack. * - * \since 1.13.0 + * \since 1.14.0 * */ -H5_DLL herr_t H5Pget_vol_cap_flags(hid_t plist_id, unsigned *cap_flags); +H5_DLL herr_t H5Pget_vol_cap_flags(hid_t plist_id, uint64_t *cap_flags); #ifdef H5_HAVE_PARALLEL /** * \ingroup GAPL * - * \brief Sets metadata I/O mode for read operations to collective or independent (default) + * \brief Sets metadata I/O mode for read operations to be collective or independent (default) * * \gacpl_id * \param[in] is_collective Boolean value indicating whether metadata reads are collective @@ -5369,7 +5430,7 @@ H5_DLL herr_t H5Pget_vol_cap_flags(hid_t plist_id, unsigned *cap_flags); * identifier will be issued collectively from all ranks irrespective * of the individual setting of a particular operation. If this * assumption is not adhered to, corruption will be introduced in the - * metadata cache and HDF5’s behavior will be undefined. + * metadata cache and HDF5's behavior will be undefined. * * Alternatively, a user may wish to avoid setting this property * globally on the file access property list, and individually set it @@ -5427,7 +5488,7 @@ H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collectiv /** * \ingroup FAPL * - * \brief Sets metadata write mode to collective or independent (default) + * \brief Sets metadata write mode to be collective or independent (default) * * \fapl_id{plist_id} * \param[out] is_collective Boolean value indicating whether metadata @@ -6206,12 +6267,12 @@ H5_DLL herr_t H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims* * dataset creation property list \p dcpl_id. * * The available option is detailed in the parameters section. - * Only chunks that are not completely filled by the dataset’s + * Only chunks that are not completely filled by the dataset's * dataspace are affected by this option. Such chunks are * referred to as partial edge chunks. * * \b Motivation: H5Pset_chunk_opts() is used to specify storage - * options for chunks on the edge of a dataset’s dataspace. This + * options for chunks on the edge of a dataset's dataspace. This * capability allows the user to tune performance in cases where * the dataset size may not be a multiple of the chunk size and * the handling of partial edge chunks can impact performance. @@ -6696,7 +6757,7 @@ H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, * Specifically, a dataset with a datatype that is 8-, 16-, 32-, or * 64-bit signed or unsigned integer; char; or 32- or 64-bit float * can be compressed with SZIP. See Note, below, for further - * discussion of the the SZIP \p bits_per_pixel setting. + * discussion of the SZIP \p bits_per_pixel setting. * * SZIP options are passed in an options mask, \p options_mask, * as follows. @@ -6758,7 +6819,7 @@ H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, * property list used to create a dataset containing a * non-allowed datatype, the call to H5Dcreate() will fail; the * conflict can be detected only when the property list is used. - * - Users should be aware that there are factors that affect one’s + * - Users should be aware that there are factors that affect one's * rights and ability to use SZIP compression by reviewing the * SZIP copyright notice. * @@ -6832,7 +6893,7 @@ H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels * \param[in] src_dset_name The path to the HDF5 dataset in the file specified by * \p src_file_name. The dataset might not exist yet. The dataset name * can be specified using a C-style \c printf statement as described below. - * \param[in] src_space_id The source dataset’s dataspace identifier with a + * \param[in] src_space_id The source dataset's dataspace identifier with a * selection applied, possibly an unlimited selection * \return \herr_t * @@ -6867,7 +6928,7 @@ H5_DLL herr_t H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels * * * If the printf form is used for the source file or dataset names, the - * selection in the source dataset’s dataspace must be fixed-size. + * selection in the source dataset's dataspace must be fixed-size. * * \par Source File Resolutions: * When a source dataset residing in a different file is accessed, the @@ -6971,7 +7032,7 @@ H5_DLL herr_t H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_fil * the corresponding value that is set in the property list. * * \p func is the user-defined callback function to invoke when - * a dataset’s appended dimension size reaches a boundary and + * a dataset's appended dimension size reaches a boundary and * \p udata is the user-defined input data for the callback * function. * @@ -7032,7 +7093,7 @@ H5_DLL herr_t H5Pget_chunk_cache(hid_t dapl_id, size_t *rdcc_nslots /*out*/, siz * \details H5Pget_efile_prefix() retrieves the file system path prefix * for locating external files associated with a dataset that * uses external storage. This will be the value set with - * H5Pset_efile_prefix() or the HDF5 library’s default. + * H5Pset_efile_prefix() or the HDF5 library's default. * * The value of \p size is the size in bytes of the prefix, * including the NULL terminator. If the size is unknown, a @@ -7136,7 +7197,7 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view); /** * \ingroup DAPL * - * \brief Sets two actions to perform when the size of a dataset’s + * \brief Sets two actions to perform when the size of a dataset's * dimension being appended reaches a specified boundary * * \dapl_id @@ -7157,7 +7218,7 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view); * property list * * When a user is appending data to a dataset via H5DOappend() - * and the dataset’s newly extended dimension size hits a + * and the dataset's newly extended dimension size hits a * specified boundary, the library will perform the first action * listed above. Upon return from the callback function, the * library will then perform the second action listed above and @@ -7167,7 +7228,7 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view); * The specified boundary is indicated by the parameter * \p boundary. It is a 1-dimensional array with \p ndims * elements, which should be the same as the rank of the - * dataset’s dataspace. While appending to a dataset along a + * dataset's dataspace. While appending to a dataset along a * particular dimension index via H5Dappend(), the library * determines a boundary is reached when the resulting dimension * size is divisible by \p boundary[index]. A zero value for @@ -7188,7 +7249,7 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view); * create or open if the following conditions are true: * * \li \p ndims, the number of elements for boundary, is not the - * same as the rank of the dataset’s dataspace. + * same as the rank of the dataset's dataspace. * \li A non-zero boundary value is specified for a non-extendible * dimension. * @@ -7200,7 +7261,7 @@ H5_DLL herr_t H5Pget_virtual_view(hid_t dapl_id, H5D_vds_view_t *view); * prototype, are defined as follows: * * \li \p dataset_id is the dataset identifier. - * \li \p cur_dims is the dataset’s current dimension sizes when + * \li \p cur_dims is the dataset's current dimension sizes when * a boundary is hit. * \li \p user_data is the user-defined input data. * @@ -7352,19 +7413,19 @@ H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_ * that uses external storage: * * \li The default behavior of the library is to search for the - * dataset’s external storage raw data files in the same + * dataset's external storage raw data files in the same * directory as the HDF5 file which contains the dataset. * \li If the prefix is set to an absolute path, the target - * directory will be searched for the dataset’s external + * directory will be searched for the dataset's external * storage raw data files. * \li If the prefix is set to a relative path, the target * directory, relative to the current working directory, will - * be searched for the dataset’s external storage raw data + * be searched for the dataset's external storage raw data * files. * \li If the prefix is set to a relative path that begins with * the special token ${ORIGIN}, that directory, relative to * the HDF5 file containing the dataset, will be searched for - * the dataset’s external storage raw data files. + * the dataset's external storage raw data files. * * The HDF5_EXTFILE_PREFIX environment variable can be used to * override the above behavior (the environment variable @@ -7391,7 +7452,7 @@ H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots, size_t rdcc_ * are unaware of the environment variable. * * \note On Windows, the prefix must be an ASCII string since the Windows - * standard C library’s I/O functions cannot handle UTF-8 file names. + * standard C library's I/O functions cannot handle UTF-8 file names. * * \since 1.10.0, 1.8.17 * @@ -7457,7 +7518,7 @@ H5_DLL herr_t H5Pset_virtual_prefix(hid_t dapl_id, const char *prefix); * then the virtual dataset will contain the data from * d-1, d-3, ..., d-N, ... . The blocks that are mapped to * d-2 and d-3 will be filled according to the virtual - * dataset’s fill value setting. + * dataset's fill value setting. * * \see_virtual * @@ -7484,7 +7545,7 @@ H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t dapl_id, hsize_t gap_size); * If \p view is set to #H5D_VDS_FIRST_MISSING, the view includes * all data before the first missing mapped data. This setting * provides a view containing only the continuous data starting - * with the dataset’s first data element. Any break in + * with the dataset's first data element. Any break in * continuity terminates the view. * * If \p view is set to #H5D_VDS_LAST_AVAILABLE, the view @@ -7685,11 +7746,11 @@ H5_DLL herr_t H5Pget_type_conv_cb(hid_t dxpl_id, H5T_conv_except_func_t *op, voi * * \param[in] plist_id Identifier for the dataset transfer property list * \param[out] alloc_func User's allocate routine, or NULL for system malloc - * \param[out] alloc_info Extra parameter for user’s allocation routine. + * \param[out] alloc_info Extra parameter for user's allocation routine. * Contents are ignored if preceding * parameter is NULL \param[out] free_func User's free routine, or NULL for * system free \param[out] free_info - * Extra parameter for user’s free routine. Contents are ignored if preceding + * Extra parameter for user's free routine. Contents are ignored if preceding * parameter is NULL * * \return \herr_t @@ -8194,16 +8255,198 @@ H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no * please see the documentation for that routine for details about * their use. * - * \since 1.13.0 + * \since 1.14.0 * */ H5_DLL herr_t H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]); -/* Link creation property list (LCPL) routines */ /** - * \ingroup ALCAPL + * + * \ingroup DXPL + * + * \brief Sets the selection I/O mode + * + * \dxpl_id{plist_id} + * \param[in] selection_io_mode The selection I/O mode to be set + * + * \return \herr_t + * + * \details H5Pset_selection_io() sets the selection I/O mode + * \p selection_io_mode in the dataset transfer property + * list \p plist_id. + * + * This can be used to enable collective I/O with type conversion, or + * with custom VFDs that support vector or selection I/O. + * + * Values that can be set in \p selection_io_mode: + * \snippet this H5D_selection_io_mode_t_snip + * \click4more + * + * \note The library may not perform selection I/O as it asks for if the + * layout callback determines that it is not feasible to do so. Please + * refer to H5Pget_no_selection_io_cause() for details. + * + * When used with type conversion, selection I/O requires the type + * conversion buffer (and the background buffer if applicable) be large + * enough to hold the entirety of the data involved in the I/O. For + * read operations, the library will use the application's read buffer + * as the type conversion buffer if the memory type is not smaller than + * the file type, eliminating the need for a separate type conversion + * buffer (a background buffer may still be required). For write + * operations, the library will similarly use the write buffer as a + * type conversion buffer, but only if H5Pset_modify_write_buf() is + * used to allow the library to modify the contents of the write + * buffer. + * + * \since 1.14.1 + * + */ +H5_DLL herr_t H5Pset_selection_io(hid_t plist_id, H5D_selection_io_mode_t selection_io_mode); + +/** + * + * \ingroup DXPL + * + * \brief Retrieves the selection I/O mode + * + * \dxpl_id{plist_id} + * \param[out] selection_io_mode The selection I/O mode + * + * \return \herr_t + * + * \details H5Pget_selection_io() queries the selection I/O mode set in + * in the dataset transfer property list \p plist_id. + * + * Values returned in \p selection_io_mode: + * \snippet this H5D_selection_io_mode_t_snip + * \click4more + * + * \note The library may not perform selection I/O as it asks for if the + * layout callback determines that it is not feasible to do so. Please + * refer to H5Pget_no_selection_io_cause() for details. + * + * \since 1.14.1 + * + */ +H5_DLL herr_t H5Pget_selection_io(hid_t plist_id, H5D_selection_io_mode_t *selection_io_mode); + +/** + * \ingroup DXPL + * + * \brief Retrieves the cause for not performing selection or vector I/O on the + * last parallel I/O call + * + * \dxpl_id{plist_id} + * \param[out] no_selection_io_cause A bitwise set value indicating the relevant + * causes that prevented selection I/O from + * being performed + * \return \herr_t + * + * \par Motivation: + * A user can request selection I/O to be performed via a data transfer + * property list (DXPL). This can be used to enable collective I/O with + * type conversion, or with custom VFDs that support vector or selection + * I/O. However, there are conditions that can cause HDF5 to forgo + * selection or vector I/O and perform legacy (scalar) I/O instead. + * + * \details H5Pget_no_selection_io_cause() can be used to determine whether + * selection or vector I/O was applied for the last preceding I/O call. + * If selection or vector I/O was not used, this function retrieves the + * cause(s) that prevent selection or vector I/O to be performed on + * that I/O call. The properties retrieved by this function are set + * before I/O takes place and are retained even when I/O fails. + * + * If a selection I/O request falls back to vector I/O, that is not + * considered "breaking" selection I/O by this function, since vector + * I/O still passes all information to the file driver in a single + * callback. + * + * Valid values returned in \p no_selection_io_cause are listed + * as follows. If there are multiple causes, it is a bitwise OR of + * the relevant causes. + * + * - #H5D_SEL_IO_DISABLE_BY_API + * Selection I/O was not performed because the feature was disabled by the API + * - #H5D_SEL_IO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET + * Selection I/O was not performed because the dataset was neither contiguous nor chunked + * - #H5D_SEL_IO_CONTIGUOUS_SIEVE_BUFFER + * Selection I/O was not performed because of sieve buffer for contiguous dataset + * - #H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB + * Selection I/O was not performed because the VFD does not have vector or selection I/O callback + * - #H5D_SEL_IO_PAGE_BUFFER + * Selection I/O was not performed because of page buffer + * - #H5D_SEL_IO_DATASET_FILTER + * Selection I/O was not performed because of dataset filters + * - #H5D_SEL_IO_CHUNK_CACHE + * Selection I/O was not performed because of chunk cache + * - #H5D_SEL_IO_TCONV_BUF_TOO_SMALL + * Selection I/O was not performed because the type conversion buffer is too small + * - #H5D_SEL_IO_BKG_BUF_TOO_SMALL + * Selection I/O was not performed because the type conversion background buffer is too small + * - #H5D_SEL_IO_DEFAULT_OFF + * Selection I/O was not performed because the selection I/O mode is DEFAULT and the library chose it + * to be off for this case + * + * \since 1.14.1 + * + */ +H5_DLL herr_t H5Pget_no_selection_io_cause(hid_t plist_id, uint32_t *no_selection_io_cause); + +/** + * + * \ingroup DXPL + * + * \brief Allows the library to modify the contents of the write buffer + * + * \dxpl_id{plist_id} + * \param[in] modify_write_buf Whether the library can modify the contents of the write buffer + * + * \return \herr_t + * + * \details H5Pset_modify_write_buf() sets whether the library is allowed to + * modify the contents of write buffers passed to HDF5 API routines + * that are passed the dataset transfer property list \p plist_id. The + * default value for modify_write_buf is FALSE. + * + * This function can be used to allow the library to perform in-place + * type conversion on write operations to save memory space. After making an + * API call with this parameter set to TRUE, the contents of the write buffer + * are undefined. + * + * \note When modify_write_buf is set to TRUE the library may violate the + * const qualifier on the API parameter for the write buffer. + * + * \since 1.14.1 + * + */ +H5_DLL herr_t H5Pset_modify_write_buf(hid_t plist_id, hbool_t modify_write_buf); + +/** + * + * \ingroup DXPL + * + * \brief Retrieves the "modify write buffer" property + * + * \dxpl_id{plist_id} + * \param[out] modify_write_buf Whether the library can modify the contents of the write buffer + * + * \return \herr_t + * + * \details H5Pget_modify_write_buf() gets the "modify write buffer" property + * from the dataset transfer property list \p plist_id. This property + * determines whether the library is allowed to modify the contents of + * write buffers passed to HDF5 API routines that are passed + * \p plist_id. The default value for modify_write_buf is FALSE. + * + * \since 1.14.1 + * + */ +H5_DLL herr_t H5Pget_modify_write_buf(hid_t plist_id, hbool_t *modify_write_buf); + +/** + * \ingroup LCPL * * \brief Determines whether property is set to enable creating missing * intermediate groups @@ -8234,7 +8477,7 @@ H5_DLL herr_t H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned ran */ H5_DLL herr_t H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd /*out*/); /** - * \ingroup ALCAPL + * \ingroup LCPL * * \brief Specifies in property list whether to create missing * intermediate groups @@ -8326,7 +8569,7 @@ H5_DLL herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_fla * to require before converting a group to a dense form. * * In the compact format, links are stored as messages in the - * group’s header. In the dense format, links are stored in a + * group's header. In the dense format, links are stored in a * fractal heap and indexed with a version 2 B-tree. * * \p max_compact is the maximum number of links to store as @@ -8341,7 +8584,7 @@ H5_DLL herr_t H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_fla * converted back to the compact format. * * In the compact format, links are stored as messages in the - * group’s header. In the dense format, links are stored in a + * group's header. In the dense format, links are stored in a * fractal heap and indexed with a version 2 B-tree. * * See H5Pset_link_phase_change() for a discussion of @@ -8537,7 +8780,7 @@ H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, uns * \par Motivation: * In situations where backward-compatibility is required, specifically, when * libraries prior to HDF5 Release 1.8.0 may be used to read the file, groups - * must be created and maintained in the original style. This is HDF5’s default + * must be created and maintained in the original style. This is HDF5's default * behavior. If backward compatibility with pre-1.8.0 libraries is not a concern, * greater efficiencies can be obtained with the new-format compact and indexed * groups. See Group @@ -8559,7 +8802,7 @@ H5_DLL herr_t H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, uns * of that metadata (and hence, the size of the local heap) can vary wildly from group * to group. To intelligently allocate space and to avoid unnecessary fragmentation of * the local heap, it can be valuable to provide the library with a hint as to the local - * heap’s likely eventual size. This can be particularly valuable when it is known that + * heap's likely eventual size. This can be particularly valuable when it is known that * a group will eventually have a great many members. It can also be useful in conserving * space in a file when it is known that certain groups will never have any members. * @@ -8616,9 +8859,8 @@ H5_DLL herr_t H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size size_t *key_alloc_size /*out*/); #endif /* H5_HAVE_MAP_API */ -/* String creation property list (STRCPL) routines */ /** - * \ingroup ALCAPL + * \ingroup ACPL * * \brief Retrieves the character encoding used to create a link or * attribute name @@ -8647,7 +8889,7 @@ H5_DLL herr_t H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size */ H5_DLL herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/); /** - * \ingroup ALCAPL + * \ingroup ACPL * * \brief Sets the character encoding used to encode link and attribute * names @@ -8688,7 +8930,6 @@ H5_DLL herr_t H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/) */ H5_DLL herr_t H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding); -/* Link access property list (LAPL) routines */ /** * \ingroup LAPL * @@ -9047,7 +9288,7 @@ H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks); /* Object copy property list (OCPYPL) routines */ /** - * \ingroup OCPPL + * \ingroup OCPYPL * * \brief Adds a path to the list of paths that will be searched in the * destination file for a matching committed datatype @@ -9085,7 +9326,7 @@ H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks); * must be identical. Two attributes are considered identical if * their datatype description, dataspace, and raw data values are * the same. However, if an attribute uses a committed datatype, - * that committed datatype’s attributes will not be compared. + * that committed datatype's attributes will not be compared. * * If a match is found, H5Ocopy() will perform the following in * the destination file: @@ -9095,7 +9336,7 @@ H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks); * will modify the copied dataset to use the found committed * datatype as its datatype. * \li For an object with an attribute of a committed datatype, - * the library will modify the copied object’s attribute to + * the library will modify the copied object's attribute to * use the found committed datatype as its datatype. * * If no match is found, H5Ocopy() will perform the following in @@ -9107,11 +9348,11 @@ H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks); * file by a unique path. * \li For a dataset that uses a committed datatype, the * library will copy the datatype as an anonymous - * committed datatype and use that as the dataset’s + * committed datatype and use that as the dataset's * datatype. * \li For an object with an attribute of a committed datatype, * the library will copy the datatype as an anonymous - * committed datatype and use that as the attribute’s + * committed datatype and use that as the attribute's * datatype. * * \b Motivation: H5Padd_merge_committed_dtype_path() provides a @@ -9162,7 +9403,7 @@ H5_DLL herr_t H5Pset_nlinks(hid_t plist_id, size_t nlinks); */ H5_DLL herr_t H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path); /** - * \ingroup OCPPL + * \ingroup OCPYPL * * \brief Clears the list of paths stored in the object copy property list * @@ -9213,7 +9454,7 @@ H5_DLL herr_t H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path */ H5_DLL herr_t H5Pfree_merge_committed_dtype_paths(hid_t plist_id); /** - * \ingroup OCPPL + * \ingroup OCPYPL * * \brief Retrieves the properties to be used when an object is copied * @@ -9238,7 +9479,7 @@ H5_DLL herr_t H5Pfree_merge_committed_dtype_paths(hid_t plist_id); */ H5_DLL herr_t H5Pget_copy_object(hid_t plist_id, unsigned *copy_options /*out*/); /** - * \ingroup OCPPL + * \ingroup OCPYPL * * \brief Retrieves the callback function from the specified object copy * property list @@ -9276,7 +9517,7 @@ H5_DLL herr_t H5Pget_copy_object(hid_t plist_id, unsigned *copy_options /*out*/) */ H5_DLL herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, void **op_data); /** - * \ingroup OCPPL + * \ingroup OCPYPL * * \brief Sets properties to be used when an object is copied * @@ -9341,10 +9582,10 @@ H5_DLL herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, * committed datatype. * If copied in a single H5Ocopy() operation, objects * that share a committed datatype in the source will - * share an anonymous committed dataype in the + * share an anonymous committed datatype in the * destination copy. Subsequent H5Ocopy() operations, * however, will be unaware of prior anonymous committed - * dataypes and will create new ones. + * datatypes and will create new ones. * * See the “See Also” section immediately below for * functions related to the use of this flag. @@ -9369,7 +9610,7 @@ H5_DLL herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, */ H5_DLL herr_t H5Pset_copy_object(hid_t plist_id, unsigned copy_options); /** - * \ingroup OCPPL + * \ingroup OCPYPL * * \brief Sets the callback function that H5Ocopy() will invoke before * searching the entire destination file for a matching committed @@ -9467,7 +9708,7 @@ H5_DLL herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, v /* Typedefs */ /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Registers a permanent property with a property list class * @@ -9597,7 +9838,7 @@ H5_DLL herr_t H5Pregister1(hid_t cls_id, const char *name, size_t size, void *de H5P_prp_get_func_t prp_get, H5P_prp_delete_func_t prp_del, H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close); /** - * \ingroup GPLOA + * \ingroup PLCRA * * \brief Registers a temporary property with a property list * @@ -9709,7 +9950,7 @@ H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *va H5P_prp_delete_func_t prp_delete, H5P_prp_copy_func_t prp_copy, H5P_prp_close_func_t prp_close); /** - * \ingroup GPLO + * \ingroup PLCRA * * \brief Encodes the property values in a property list into a binary * buffer diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PredType.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PredType.h index 45f20ab872..1e305fc00a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5PredType.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PredType.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5PropList.h b/externals/coda-oss/modules/drivers/hdf5/include/H5PropList.h index 5320699202..beef474f65 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5PropList.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5PropList.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5RSmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5RSmodule.h index 8cd033311a..ee6b7e80e5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5RSmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5RSmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, October 10, 2020 - * * Purpose: This file contains declarations which define macros for the - * H5RS package. Including this header means that the source file - * is part of the H5RS package. + * H5RS package. Including this header means that the source file + * is part of the H5RS package. */ #ifndef H5RSmodule_H #define H5RSmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5RSprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5RSprivate.h index 05daac2c3c..a38214039a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5RSprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5RSprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -20,9 +19,6 @@ /**************************************/ /* Public headers needed by this file */ /**************************************/ -#ifdef LATER -#include "H5RSpublic.h" -#endif /* LATER */ /***************************************/ /* Private headers needed by this file */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Rmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Rmodule.h index d9ab968c70..5e3affbfab 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Rmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Rmodule.h @@ -24,34 +24,17 @@ #define H5_MY_PKG H5R #define H5_MY_PKG_ERR H5E_REFERENCE +/** \page H5R_UG The HDF5 References + * @todo Under Construction + */ + /** - * \defgroup H5R H5R + * \defgroup H5R References (H5R) * * Use the functions in this module to manage HDF5 references. Referents can * be HDF5 objects, attributes, and selections on datasets a.k.a. dataset * regions. * - * - * - * - * - * - * - * - * - * - * - * - *
CreateRead
- * \snippet{lineno} H5R_examples.c create - * - * \snippet{lineno} H5R_examples.c read - *
UpdateDelete
- * \snippet{lineno} H5R_examples.c update - * - * \snippet{lineno} H5R_examples.c delete - *
- * */ #endif /* H5Rmodule_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Rpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Rpkg.h index eb6294b5f1..b4f1bbf144 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Rpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Rpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Rprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Rprivate.h index 59d2ed2295..43e476485f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Rprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Rprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Rpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Rpublic.h index ef798ea0bc..3f63d59742 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Rpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Rpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -17,10 +16,10 @@ #ifndef H5Rpublic_H #define H5Rpublic_H -/* Public headers needed by this file */ -#include "H5public.h" -#include "H5Gpublic.h" -#include "H5Ipublic.h" +#include "H5public.h" /* Generic Functions */ +#include "H5Gpublic.h" /* Groups */ +#include "H5Ipublic.h" /* Identifiers */ +#include "H5Opublic.h" /* Object Headers */ /*****************/ /* Public Macros */ @@ -260,7 +259,7 @@ H5_DLL herr_t H5Rdestroy(H5R_ref_t *ref_ptr); * \snippet this H5R_type_t_snip * * Note that #H5R_OBJECT1 and #H5R_DATASET_REGION1 can never be - * associated to an \ref H5R_ref_t reference and can therefore never be + * associated with an \ref H5R_ref_t reference and can, therefore, never be * returned through that function. * * \ref H5R_ref_t is defined in H5Rpublic.h as: @@ -303,7 +302,7 @@ H5_DLL htri_t H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr); * \return \herr_t * * \details H5Rcopy() creates a copy of an existing reference. - * \p src_ref_ptr points to the reference to copy and \p dst_ref_ptr is the + * \p src_ref_ptr points to the reference to copy, and \p dst_ref_ptr is the * pointer to the destination reference. * */ @@ -337,7 +336,7 @@ H5_DLL herr_t H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr); * * The object opened with this function should be closed when it * is no longer needed so that resource leaks will not develop. Use - * the appropriate close function such as H5Oclose() or H5Dclose() + * the appropriate close function, such as H5Oclose() or H5Dclose() * for datasets. * */ @@ -346,10 +345,15 @@ H5_DLL hid_t H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); /** * -------------------------------------------------------------------------- * \ingroup ASYNC - * \async_variant_of{H5Ropen} + * \async_variant_of{H5Ropen_object} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Ropen_object_async(const char *app_file, const char *app_func, unsigned app_line, H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Ropen_object_async(unsigned app_line, H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, + hid_t es_id); +#endif /** * -------------------------------------------------------------------------- @@ -389,8 +393,12 @@ H5_DLL hid_t H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id); * \ingroup ASYNC * \async_variant_of{H5Ropen_region} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Ropen_region_async(const char *app_file, const char *app_func, unsigned app_line, H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Ropen_region_async(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, hid_t es_id); +#endif /** * -------------------------------------------------------------------------- @@ -427,8 +435,12 @@ H5_DLL hid_t H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id); * \ingroup ASYNC * \async_variant_of{H5Ropen_attr} */ +#ifndef H5_DOXYGEN H5_DLL hid_t H5Ropen_attr_async(const char *app_file, const char *app_func, unsigned app_line, H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id, hid_t es_id); +#else +H5_DLL hid_t H5Ropen_attr_async(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id, hid_t es_id); +#endif /* Get type */ @@ -616,7 +628,7 @@ H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t siz * * A \Emph{reference type} is the type of reference, either an object * reference or a dataset region reference. An \Emph{object reference} - * points to an HDF5 object while a \Emph{dataset region reference} + * points to an HDF5 object, while a \Emph{dataset region reference} * points to a defined region within a dataset. * * The \Emph{referenced object} is the object the reference points @@ -635,10 +647,10 @@ H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t siz * that can be determined with three preliminary calls: * * \li Call H5Dget_type() on the dataset containing the reference to - * get a datatype identifier for the dataset’s datatype. + * get a datatype identifier for the dataset's datatype. * \li Using that datatype identifier, H5Tget_class() returns a datatype * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can - * then be used to determine whether the reference’s datatype is + * then be used to determine whether the reference's datatype is * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG: * - If the datatype is #H5T_STD_REF_OBJ, the reference object type * is #H5R_OBJECT. @@ -688,7 +700,7 @@ H5_DLL H5G_obj_t H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref * * The object opened with this function should be closed when it is no * longer needed so that resource leaks will not develop. Use the - * appropriate close function such as H5Oclose() or H5Dclose() for + * appropriate close function, such as H5Oclose() or H5Dclose() for * datasets. * * \version 1.10.0 Function H5Rdereference() renamed to H5Rdereference1() and @@ -772,10 +784,10 @@ H5_DLL herr_t H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t re * that can be determined with three preliminary calls: * * \li Call H5Dget_type() on the dataset containing the reference to - * get a datatype identifier for the dataset’s datatype. + * get a datatype identifier for the dataset's datatype. * \li Using that datatype identifier, H5Tget_class() returns a datatype * class.\n If the datatype class is #H5T_REFERENCE, H5Tequal() can - * then be used to determine whether the reference’s datatype is + * then be used to determine whether the reference's datatype is * #H5T_STD_REF_OBJ or #H5T_STD_REF_DSETREG: * - If the datatype is #H5T_STD_REF_OBJ, the reference object type * is #H5R_OBJECT. @@ -825,7 +837,7 @@ H5_DLL herr_t H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H * * The object opened with this function should be closed when it is no * longer needed so that resource leaks will not develop. Use the - * appropriate close function such as H5Oclose() or H5Dclose() for + * appropriate close function, such as H5Oclose() or H5Dclose() for * datasets. * * \since 1.10.0 @@ -893,7 +905,7 @@ H5_DLL hid_t H5Rget_region(hid_t dataset, H5R_type_t ref_type, const void *ref); * include the following: * \snippet this H5R_type_t_snip * - * \p ref is the reference for which the target object’s name is + * \p ref is the reference for which the target object's name is * sought. * * If \p ref is an object reference, \p name will be returned with a diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5SLmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5SLmodule.h index 606fa906fe..b0b3064f15 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5SLmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5SLmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5SL package. Including this header means that the source file - * is part of the H5SL package. + * Purpose: This file contains declarations which define macros for the + * H5SL package. Including this header means that the source file + * is part of the H5SL package. */ #ifndef H5SLmodule_H #define H5SLmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5SLprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5SLprivate.h index 0e29591306..d7eb5be8b8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5SLprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5SLprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -20,9 +19,6 @@ /**************************************/ /* Public headers needed by this file */ /**************************************/ -#ifdef LATER -#include "H5SLpublic.h" -#endif /* LATER */ /***************************************/ /* Private headers needed by this file */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5SMmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5SMmodule.h index 6308e145cb..1eaeea29e9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5SMmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5SMmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5SM package. Including this header means that the source file - * is part of the H5SM package. + * Purpose: This file contains declarations which define macros for the + * H5SM package. Including this header means that the source file + * is part of the H5SM package. */ #ifndef H5SMmodule_H #define H5SMmodule_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5SMpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5SMpkg.h index 3ec8109344..64f5c76937 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5SMpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5SMpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird - * Thursday, March 30, 2006 - * * Purpose: This file contains declarations which are visible only within * the H5SM shared object header messages package. Source files * outside the H5SM package should include H5SMprivate.h instead. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5SMprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5SMprivate.h index efe9355516..f6496f3988 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5SMprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5SMprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,11 +11,8 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: James Laird - * Thursday, March 2, 2006 - * - * Purpose: This file contains private declarations for the H5SM - * shared object header messages module. + * Purpose: This file contains private declarations for the H5SM + * shared object header messages module. */ #ifndef H5SMprivate_H #define H5SMprivate_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Smodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Smodule.h index 72d722a99f..d212d5dbf2 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Smodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Smodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5S package. Including this header means that the source file - * is part of the H5S package. + * Purpose: This file contains declarations which define macros for the + * H5S package. Including this header means that the source file + * is part of the H5S package. */ #ifndef H5Smodule_H #define H5Smodule_H @@ -28,7 +25,1494 @@ #define H5_MY_PKG H5S #define H5_MY_PKG_ERR H5E_DATASPACE -/**\defgroup H5S H5S +/** \page H5S_UG Dataspaces and Partial I/O + * + * + * \section sec_dataspace HDF5 Dataspaces and Partial I/O + * + * HDF5 dataspaces describe the \Emph{shape} of datasets in memory or in HDF5 + * files. Dataspaces can be empty (#H5S_NULL), a singleton (#H5S_SCALAR), or + * a multi-dimensional, regular grid (#H5S_SIMPLE). Dataspaces can be re-shaped. + * + * Subsets of dataspaces can be "book-marked" or used to restrict I/O operations + * using \Emph{selections}. Furthermore, certain set operations are supported + * for selections. + * + * \subsection subsec_dataspace_intro Introduction + * + * The HDF5 \Emph{dataspace} is a required component of an HDF5 dataset or attribute definition. The dataspace + * defines the size and shape of the dataset or attribute raw data. In other words, a dataspace defines the + * number of dimensions and the size of each dimension of the multidimensional array in which the raw data + * is represented. The dataspace must be defined when the dataset or attribute is created. + * + * The \Emph{dataspace} is also used during dataset I/O operations, defining the elements of the dataset that + * participate in the I/O operation. + * + * This chapter explains the \Emph{dataspace} object and its use in dataset and attribute creation and data + * transfer. It also describes selection operations on a dataspace used to implement sub‐setting, + * sub‐sampling, and scatter‐gather access to datasets. + * + * \subsection subsec_dataspace_function Dataspace Function Summaries + * @see H5S reference manual provides a reference list of dataspace functions, the H5S APIs. + * + * \subsection subsec_dataspace_program Definition of Dataspace Objects and the Dataspace Programming Model + * + * This section introduces the notion of the HDF5 dataspace object and a programming model for creating + * and working with dataspaces. + * + * \subsubsection subsubsec_dataspace_program_object Dataspace Objects + * + * An HDF5 dataspace is a required component of an HDF5 dataset or attribute. A dataspace defines the size + * and the shape of a dataset's or an attribute's raw data. Currently, HDF5 supports the following types of + * the dataspaces: + * \li Scalar dataspaces + * \li Simple dataspaces + * \li Null dataspaces + * + * A scalar dataspace, #H5S_SCALAR, represents just one element, a scalar. Note that the datatype of this one + * element may be very complex; example would be a compound structure with members being of any + * allowed HDF5 datatype, including multidimensional arrays, strings, and nested compound structures. By + * convention, the rank of a scalar dataspace is always 0 (zero); think of it geometrically as a single, + * dimensionless point, though that point may be complex. + * + * A simple dataspace, #H5S_SIMPLE , is a multidimensional array of elements. The dimensionality of the + * dataspace (or the rank of the array) is fixed and is defined at creation time. The size of each dimension + * can grow during the life time of the dataspace from the current size up to the maximum size. Both the + * current size and the maximum size are specified at creation time. The sizes of dimensions at any particular + * time in the life of a dataspace are called the current dimensions, or the dataspace extent. They can be + * queried along with the maximum sizes. + * + * A null dataspace, #H5S_NULL, contains no data elements. Note that no selections can be applied to a null + * dataset as there is nothing to select. + * + * As shown in the UML diagram in the figure below, an HDF5 simple dataspace object has three attributes: + * the rank or number of dimensions; the current sizes, expressed as an array of length rank with each element + * of the array denoting the current size of the corresponding dimension; and the maximum sizes, + * expressed as an array of length rank with each element of the array denoting the maximum size of the + * corresponding dimension. + * + * + * + * + * + *
+ * \image html Dspace_simple.gif "A simple dataspace" + *
+ * + * \em Note: A simple dataspace is defined by its rank, the current size of each dimension, and the maximum + * size of each dimension. + * + * The size of a current dimension cannot be greater than the maximum size, which can be unlimited, specified + * as #H5S_UNLIMITED. Note that while the HDF5 file format and library impose no maximum size on an + * unlimited dimension, practically speaking its size will always be limited to the biggest integer available + * on the particular system being used. + * + * Dataspace rank is restricted to 32, the standard limit in C on the rank of an array, in the current + * implementation of the HDF5 Library. The HDF5 file format, on the other hand, allows any rank up to the + * maximum integer value on the system, so the library restriction can be raised in the future if higher + * dimensionality is required. + * + * Note that most of the time Fortran applications calling HDF5 will work with dataspaces of rank less than + * or equal to seven, since seven is the maximum number of dimensions in a Fortran array. But dataspace rank + * is not limited to seven for Fortran applications. + * + * The current dimensions of a dataspace, also referred to as the dataspace extent, define the bounding box + * for dataset elements that can participate in I/O operations. + * + * \subsubsection subsubsec_dataspace_program_model Dataspace Programming Model + * + * The programming model for creating and working with HDF5 dataspaces can be summarized as follows: + * \li 1. Create a dataspace + * \li 2. Use the dataspace to create a dataset in the file or to describe a data array in memory + * \li 3. Modify the dataspace to define dataset elements that will participate in I/O operations + * \li 4. Use the modified dataspace while reading/writing dataset raw data or to create a region reference + * \li 5. Close the dataspace when no longer needed + * + * The rest of this section will address steps 1, 2, and 5 of the programming model; steps 3 and 4 will be + * discussed in later sections of this chapter. + * + *

Creating a Dataspace

+ * + * A dataspace can be created by calling the \ref H5Screate function. Since the + * definition of a simple dataspace requires the specification of dimensionality (or rank) and initial and + * maximum dimension sizes, the HDF5 Library provides a convenience API, \ref H5Screate_simple to create a + * simple dataspace in one step. + * + * The following examples illustrate the usage of these APIs. + * + *

Creating a Scalar Dataspace

+ * + * Creating a Scalar Dataspace + * \code + * hid_t space_id; + * . . . + * space_id = H5Screate(H5S_SCALAR); + * \endcode + * As mentioned above, the dataspace will contain only one element. Scalar dataspaces are used more often + * for describing attributes that have just one value. For example, the attribute temperature with the value + * Celsius is used to indicate that the dataset with this attribute stores temperature values using the + * Celsius scale. + * + *

Creating a Null Dataspace

+ * + * A null dataspace is created with the \ref H5Screate function. + * \code + * hid_t space_id; + * . . . + * space_id = H5Screate(H5S_NULL); + * \endcode + * As mentioned above, the dataspace will contain no elements. + * + *

Creating a Simple Dataspace

+ * + * Let's assume that an application wants to store a two‐dimensional array of data, A(20,100). During the + * life of the application, the first dimension of the array can grow up to 30; there is no restriction on + * the size of the second dimension. The following steps are used to declare a dataspace for the dataset + * in which the array data will be stored. + * \code + * hid_t space_id; + * int rank = 2; + * hsize_t current_dims[2] = {20, 100}; + * hsize_t max_dims[2] = {30, H5S_UNLIMITED}; + * . . . + * space_id = H5Screate(H5S_NULL); + * H5Sset_extent_simple(space_id, rank, current_dims, max_dims); + * \endcode + * + * Alternatively, the convenience APIs H5Screate_simple/h5screate_simple_f can replace the + * H5Screate/h5screate_f and H5Sset_extent_simple/h5sset_extent_simple_f calls. + * \code + * space_id = H5Screate_simple(rank, current_dims, max_dims); + * \endcode + * + * In this example, a dataspace with current dimensions of 20 by 100 is created. The first dimension can be + * extended only up to 30. The second dimension, however, is declared unlimited; it can be extended up to + * the largest available integer value on the system. + * + * Note that when there is a difference between the current dimensions and the maximum dimensions of an + * array, then chunking storage must be used. In other words, if the number of dimensions may change over + * the life of the dataset, then chunking must be used. If the array dimensions are fixed (if the number of + * current dimensions is equal to the maximum number of dimensions when the dataset is created), then + * contiguous storage can be used. For more information, see "Data Transfer". + * + * Maximum dimensions can be the same as current dimensions. In such a case, the sizes of dimensions + * cannot be changed during the life of the dataspace object. In C, \c NULL can be used to indicate to the + * \ref H5Screate_simple and \ref H5Sset_extent_simple functions that the maximum sizes of all dimensions + * are the same as the current sizes. + * \code + * space_id = H5Screate_simple(rank, current_dims, NULL); + * \endcode + * The created dataspace will have current and maximum dimensions of 20 and 100 correspondingly, and the + * sizes of those dimensions cannot be changed. + * + *

C versus Fortran Dataspaces

+ * + * Dataspace dimensions are numbered from 1 to rank. HDF5 uses C storage conventions, assuming that the + * last listed dimension is the fastest‐changing dimension and the first‐listed dimension is the slowest + * changing. The HDF5 file format storage layout specification adheres to the C convention and the HDF5 + * Library adheres to the same convention when storing dataspace dimensions in the file. This affects how + * C programs and tools interpret data written from Fortran programs and vice versa. The example below + * illustrates the issue. + * + * When a Fortran application describes a dataspace to store an array as A(20,100), it specifies the value of + * the first dimension to be 20 and the second to be 100. Since Fortran stores data by columns, the + * first‐listed dimension with the value 20 is the fastest‐changing dimension and the last‐listed dimension + * with the value 100 is the slowest‐changing. In order to adhere to the HDF5 storage convention, the HDF5 + * Fortran wrapper transposes dimensions, so the first dimension becomes the last. The dataspace dimensions + * stored in the file will be 100,20 instead of 20,100 in order to correctly describe the Fortran data that + * is stored in 100 columns, each containing 20 elements. + * + * When a Fortran application reads the data back, the HDF5 Fortran wrapper transposes the dimensions + * once more, returning the first dimension to be 20 and the second to be 100, describing correctly the sizes + * of the array that should be used to read data in the Fortran array A(20,100). + * + * When a C application reads data back, the dimensions will come out as 100 and 20, correctly describing + * the size of the array to read data into, since the data was written as 100 records of 20 elements each. + * Therefore C tools such as h5dump and h5ls always display transposed dimensions and values for the data + * written by a Fortran application. + * + * Consider the following simple example of equivalent C 3 x 5 and Fortran 5 x 3 arrays. As illustrated in + * the figure below, a C application will store a 3 x 5 2‐dimensional array as three 5‐element rows. In order + * to store the same data in the same order, a Fortran application must view the array as a 5 x 3 array with + * three 5‐element columns. The dataspace of this dataset, as written from Fortran, will therefore be + * described as 5 x 3 in the application but stored and described in the file according to the C convention + * as a 3 x 5 array. This ensures that C and Fortran applications will always read the data in the order in + * which it was written. The HDF5 Fortran interface handles this transposition automatically. + * \code + * // C + * \#define NX 3 // dataset dimensions + * \#define NY 5 + * . . . + * int data[NX][NY]; // data to write + * . . . + * // Data and output buffer initialization. + * for (j = 0; j < NX; j++) + * for (i = 0; i < NY; i++) + * data[j][i] = i + j; + * // + * // 1 2 3 4 5 + * // 6 7 8 9 10 + * // 11 12 13 14 15 + * // + * . . . + * dims[0] = NX; + * dims[1] = NY; + * dataspace = H5Screate_simple(RANK, dims, NULL); + * \endcode + * + * \code + * ! Fortran + * INTEGER, PARAMETER :: NX = 3 + * INTEGER, PARAMETER :: NX = 5 + * . . . + * INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/NY, NX/) ! Dataset dimensions + * . . . + * ! + * ! Initialize data + * ! + * do i = 1, NY + * do j = 1, NX + * data(i,j) = i + (j-1)*NY + * enddo + * enddo + * ! + * ! Data + * ! + * ! 1 6 11 + * ! 2 7 12 + * ! 3 8 13 + * ! 4 9 14 + * ! 5 10 15 + * . . . + * CALL h5screate_simple_f(rank, dims, dspace_id, error) + * \endcode + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Comparing C and Fortran dataspaces
+ * A dataset stored by a C program in a 3 x 5 array: + *
+ * \image html Dspace_CvsF1.gif + *
+ * The same dataset stored by a Fortran program in a 5 x 3 array: + *
+ * \image html Dspace_CvsF2.gif + *
+ * The first dataset above as written to an HDF5 file from C or the second dataset above as written + * from Fortran: + *
+ * \image html Dspace_CvsF3.gif + *
+ * The first dataset above as written to an HDF5 file from Fortran: + *
+ * \image html Dspace_CvsF4.gif + *
+ * + * Note: The HDF5 Library stores arrays along the fastest‐changing dimension. This approach is often + * referred to as being “in C order.” C, C++, and Java work with arrays in row‐major order. In other words, + * the row, or the last dimension, is the fastest‐changing dimension. Fortran, on the other hand, handles + * arrays in column‐major order making the column, or the first dimension, the fastest‐changing dimension. + * Therefore, the C and Fortran arrays illustrated in the top portion of this figure are stored identically + * in an HDF5 file. This ensures that data written by any language can be meaningfully read, interpreted, + * and manipulated by any other. + * + *

Finding Dataspace Characteristics

+ * + * The HDF5 Library provides several APIs designed to query the characteristics of a dataspace. + * + * The function \ref H5Sis_simple returns information about the type of a dataspace. + * This function is rarely used and currently supports only simple and scalar dataspaces. + * + * To find out the dimensionality, or rank, of a dataspace, use \ref H5Sget_simple_extent_ndims. + * \ref H5Sget_simple_extent_dims can also be used to find out the rank. See + * the example below. If both functions return 0 for the value of rank, then the dataspace is scalar. + * + * To query the sizes of the current and maximum dimensions, use \ref H5Sget_simple_extent_dims. + * + * The following example illustrates querying the rank and dimensions of a dataspace using these functions. + * \code + * hid_t space_id; + * int rank; + * hsize_t *current_dims; + * hsize_t *max_dims; + * . . . + * rank = H5Sget_simple_extent_ndims(space_id); + * // (or rank = H5Sget_simple_extent_dims(space_id, NULL, NULL);) + * current_dims = (hsize_t)malloc(rank * sizeof(hsize_t)); + * max_dims = (hsize_t)malloc(rank * sizeof(hsize_t)); + * H5Sget_simple_extent_dims(space_id, current_dims, max_dims); + * // Print values here + * \endcode + * + * \subsection subsec_dataspace_transfer Dataspaces and Data Transfer + * + * Read and write operations transfer data between an HDF5 file on disk and in memory. The shape that the + * array data takes in the file and in memory may be the same, but HDF5 also allows users the ability to + * represent data in memory in a different shape than in the file. If the shape of an array in the file and + * in memory will be the same, then the same dataspace definition can be used for both. If the shape of an + * array in memory needs to be different than the shape in the file, then the dataspace definition for the + * shape of the array in memory can be changed. During a read operation, the array will be read into the + * different shape in memory, and during a write operation, the array will be written to the file in the + * shape specified by the dataspace in the file. The only qualification is that the number of elements read + * or written must be the same in both the source and the destination dataspaces. + * + * Item a in the figure below shows a simple example of a read operation in which the data is stored as a 3 + * by 4 array in the file (item b) on disk, but the program wants it to be a 4 by 3 array in memory. This is + * accomplished by setting the memory dataspace to describe the desired memory layout, as in item c. The read + * operation reads the data in the file array into the memory array. + * + * + * + * + * + *
+ * \image html Dspace_read.gif "Data layout before and after a read operation" + *
+ * + * + * + * + * + *
+ * \image html Dspace_move.gif "Moving data from disk to memory" + *
+ + * Both the source and destination are stored as contiguous blocks of storage with the elements in the order + * specified by the dataspace. The figure above shows one way the elements might be organized. In item a, + * the elements are stored as 3 blocks of 4 elements. The destination is an array of 12 elements in memory + * (see item c). As the figure suggests, the transfer reads the disk blocks into a memory buffer (see item b), + * and then writes the elements to the correct locations in memory. A similar process occurs in reverse when + * data is written to disk. + * + * \subsubsection subsubsec_dataspace_transfer_select Data Selection + * + * In addition to rearranging data, the transfer may select the data elements from the source and destination. + * + * Data selection is implemented by creating a dataspace object that describes the selected elements (within + * the hyper rectangle) rather than the whole array. Two dataspace objects with selections can be used in + * data transfers to read selected elements from the source and write selected elements to the destination. + * When data is transferred using the dataspace object, only the selected elements will be transferred. + * + * This can be used to implement partial I/O, including: + * \li Sub‐setting ‐ reading part of a large dataset + * \li Sampling ‐ reading selected elements (for example, every second element) of a dataset + * \li Scatter‐gather ‐ read non‐contiguous elements into contiguous locations (gather) or read contiguous + * elements into non‐contiguous locations (scatter) or both + * + * To use selections, the following steps are followed: + * \li 1. Get or define the dataspace for the source and destination + * \li 2. Specify one or more selections for source and destination dataspaces + * \li 3. Transfer data using the dataspaces with selections + * + * A selection is created by applying one or more selections to a dataspace. A selection may override any + * other selections (#H5S_SELECT_SET) or may be “Ored” with previous selections on the same dataspace + * (#H5S_SELECT_OR). In the latter case, the resulting selection is the union of the selection and all + * previously selected selections. Arbitrary sets of points from a dataspace can be selected by specifying + * an appropriate set of selections. + * + * Two selections are used in data transfer, so the source and destination must be compatible, as described + * below. + * + * There are two forms of selection, hyperslab and point. A selection must be either a point selection or a + * set of hyperslab selections. Selections cannot be mixed. + * + * The definition of a selection within a dataspace, not the data in the selection, cannot be saved to the + * file unless the selection definition is saved as a region reference. For more information, + * see \ref subsec_dataspace_refer. + * + *

Hyperslab Selection

+ * + * A hyperslab is a selection of elements from a hyper rectangle. An HDF5 hyperslab is a rectangular pattern + * defined by four arrays. The four arrays are summarized in the table below. + * + * The offset defines the origin of the hyperslab in the original dataspace. + * + * The stride is the number of elements to increment between selected elements. A stride of ‘1’ is every + * element, a stride of ‘2’ is every second element, etc. Note that there may be a different stride for + * each dimen‐sion of the dataspace. The default stride is 1. + * + * The count is the number of elements in the hyperslab selection. When the stride is 1, the selection is a + * hyper rectangle with a corner at the offset and size count[0] by count[1] by.... When stride is greater + * than one, the hyperslab bounded by the offset and the corners defined by stride[n] * count[n]. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Hyperslab elements
+ * Parameter + * + * Description + *
+ * Offset + * + * The starting location for the hyperslab. + *
+ * Stride + * + * The number of elements to separate each element or block to be selected. + *
+ * Count + * + * The number of elements or blocks to select along each dimension. + *
+ * Block + * + * The size of the block selected from the dataspace. + *
+ * + * The block is a count on the number of repetitions of the hyperslab. The default block size is '1', which is + * one hyperslab. A block of 2 would be two hyperslabs in that dimension, with the second starting at + * offset[n] + (count[n] * stride[n]) + 1. + * + * A hyperslab can be used to access a sub‐set of a large dataset. The figure below shows an example of a + * hyperslab that reads a rectangle from the middle of a larger two dimensional array. The destination is the + * same shape as the source. + * + * + * + * + * + *
+ * \image html Dspace_subset.gif "Access a sub‐set of data with a hyperslab" + *
+ * + * Hyperslabs can be combined to select complex regions of the source and destination. The figure below + * shows an example of a transfer from one non‐rectangular region into another non‐rectangular region. The + * source is defined as the union of two hyperslabs, and the destination is the union of three hyperslabs. + * + * + * + * + * + *
+ * \image html Dspace_complex.gif "Build complex regions with hyperslab unions" + *
+ * + * Hyperslabs may also be used to collect or scatter data from regular patterns. The figure below shows an + * example where the source is a repeating pattern of blocks, and the destination is a single, one dimensional + * array. + * + * + * + * + * + *
+ * \image html Dspace_combine.gif "Use hyperslabs to combine or disperse data" + *
+ * + *

Select Points

+ * + * The second type of selection is an array of points such as coordinates. Essentially, this selection is a + * list of all the points to include. The figure below shows an example of a transfer of seven elements from + * a two dimensional dataspace to a three dimensional dataspace using a point selection to specify the points. + * + * + * + * + * + *
+ * \image html Dspace_point.gif "Point selection" + *
+ * + *

Rules for Defining Selections

+ * + * A selection must have the same number of dimensions (rank) as the dataspace it is applied to, although it + * may select from only a small region such as a plane from a 3D dataspace. Selections do not affect the + * extent of the dataspace, the selection may be larger than the dataspace. The boundaries of selections are + * reconciled with the extent at the time of the data transfer. + * + *

Data Transfer with Selections

+ * + * A data transfer (read or write) with selections is the same as any read or write, except the source + * and destination dataspace have compatible selections. + * + * During the data transfer, the following steps are executed by the library: + * \li The source and destination dataspaces are checked to assure that the selections are compatible. + *
  • Each selection must be within the current extent of the dataspace. A selection may be + * defined to extend outside the current extent of the dataspace, but the dataspace cannot be + * accessed if the selection is not valid at the time of the access.
  • + *
  • The total number of points selected in the source and destination must be the same. Note + * that the dimensionality of the source and destination can be different (for example, the + * source could be 2D, the destination 1D or 3D), and the shape can be different, but the number of + * elements selected must be the same.
+ * \li The data is transferred, element by element. + * + * Selections have an iteration order for the points selected, which can be any permutation of the dimensions + * involved (defaulting to 'C' array order) or a specific order for the selected points, for selections + * composed of single array elements with \ref H5Sselect_elements. + * + * The elements of the selections are transferred in row‐major, or C order. That is, it is assumed that the + * first dimension varies slowest, the second next slowest, and so forth. For hyperslab selections, the order + * can be any permutation of the dimensions involved (defaulting to ‘C’ array order). When multiple hyperslabs + * are combined, the hyperslabs are coalesced into contiguous reads and writes. + * + * In the case of point selections, the points are read and written in the order specified. + * + * \subsubsection subsubsec_dataspace_transfer_model Programming Model + * + *

Selecting Hyperslabs

+ * + * Suppose we want to read a 3x4 hyperslab from a dataset in a file beginning at the element <1,2> in the + * dataset, and read it into a 7 x 7 x 3 array in memory. See the figure below. In order to do this, we must + * create a dataspace that describes the overall rank and dimensions of the dataset in the file as well as + * the position and size of the hyperslab that we are extracting from that dataset. + * + * + * + * + * + *
+ * \image html Dspace_select.gif "Selecting a hyperslab" + *
+ * + * The code in the first example below illustrates the selection of the hyperslab in the file dataspace. + * The second example below shows the definition of the destination dataspace in memory. Since the in‐memory + * dataspace has three dimensions, the hyperslab is an array with three dimensions with the last dimension + * being 1: <3,4,1>. The third example below shows the read using the source and destination dataspaces + * with selections. + * + * Selecting a hyperslab + * \code + * //get the file dataspace. + * dataspace = H5Dget_space(dataset); // dataspace identifier + * + * // Define hyperslab in the dataset. + * offset[0] = 1; + * offset[1] = 2; + * count[0] = 3; + * count[1] = 4; + * status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL, count, NULL); + * \endcode + * + * Defining the destination memory + * \code + * // Define memory dataspace. + * dimsm[0] = 7; + * dimsm[1] = 7; + * dimsm[2] = 3; + * memspace = H5Screate_simple(3,dimsm,NULL); + * + * // Define memory hyperslab. + * offset_out[0] = 3; + * offset_out[1] = 0; + * offset_out[2] = 0; + * count_out[0] = 3; + * count_out[1] = 4; + * count_out[2] = 1; + * status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL, count_out, NULL); + * \endcode + * + * A sample read specifying source and destination dataspaces + * \code + * ret = H5Dread(dataset, H5T_NATIVE_INT, memspace,dataspace, H5P_DEFAULT, data); + * \endcode + * + *

Example with Strides and Blocks

+ * + * Consider an 8 x 12 dataspace into which we want to write eight 3 x 2 blocks in a two dimensional array + * from a source dataspace in memory that is a 50‐element one dimensional array. See the figure below. + * + * + * + * + * + *
+ * \image html Dspace_write1to2.gif "Write from a one dimensional array to a two dimensional array" + *
+ * + * The example below shows code to write 48 elements from the one dimensional array to the file dataset + * starting with the second element in vector. The destination hyperslab has the following parameters: + * offset=(0,1), stride=(4,3), count=(2,4), block=(3,2). The source has the parameters: offset=(1), + * stride=(1), count=(48), block=(1). After these operations, the file dataspace will have the values + * shown in item b in the figure above. Notice that the values are inserted in the file dataset in + * row‐major order. + * + * Write from a one dimensional array to a two dimensional array + * \code + * // Select hyperslab for the dataset in the file, using 3 x 2 blocks, (4,3) stride (2,4) + * // count starting at the position (0,1). + * offset[0] = 0; offset[1] = 1; + * stride[0] = 4; stride[1] = 3; + * count[0] = 2; count[1] = 4; + * block[0] = 3; block[1] = 2; + * ret = H5Sselect_hyperslab(fid, H5S_SELECT_SET, offset, stride, count, block); + * + * // Create dataspace for the first dataset. + * mid1 = H5Screate_simple(MSPACE1_RANK, dim1, NULL); + * + * // Select hyperslab. + * // We will use 48 elements of the vector buffer starting + * // at the second element. Selected elements are + * // 1 2 3 . . . 48 + * offset[0] = 1; + * stride[0] = 1; + * count[0] = 48; + * block[0] = 1; + * ret = H5Sselect_hyperslab(mid1, H5S_SELECT_SET, offset, stride, count, block); + * + * // Write selection from the vector buffer to the dataset in the file. + * ret = H5Dwrite(dataset, H5T_NATIVE_INT, midd1, fid, H5P_DEFAULT, vector) + * \endcode + * + *

Selecting a Union of Hyperslabs

+ * + * The HDF5 Library allows the user to select a union of hyperslabs and write or read the selection into + * another selection. The shapes of the two selections may differ, but the number of elements must be + * equal. + * + * + * + * + * + *
+ * \image html Dspace_transfer.gif "Transferring hyperslab unions" + *
+ * + * The figure above shows the transfer of a selection that is two overlapping hyperslabs from the dataset + * into a union of hyperslabs in the memory dataset. Note that the destination dataset has a different shape + * from the source dataset. Similarly, the selection in the memory dataset could have a different shape than + * the selected union of hyperslabs in the original file. For simplicity, the selection is that same shape + * at the destination. + * + * To implement this transfer, it is necessary to: + * \li 1. Get the source dataspace + * \li 2. Define one hyperslab selection for the source + * \li 3. Define a second hyperslab selection, unioned with the first + * \li 4. Get the destination dataspace + * \li 5. Define one hyperslab selection for the destination + * \li 6. Define a second hyperslab selection, unioned with the first + * \li 7. Execute the data transfer (H5Dread or H5Dwrite) using the source and destination dataspaces + * + * The example below shows example code to create the selections for the source dataspace (the file). The + * first hyperslab is size 3 x 4 and the left upper corner at the position (1,2). The hyperslab is a simple + * rectangle, so the stride and block are 1. The second hyperslab is 6 x 5 at the position (2,4). The second + * selection is a union with the first hyperslab (#H5S_SELECT_OR). + * + * Select source hyperslabs + * \code + * fid = H5Dget_space(dataset); + * + * // Select first hyperslab for the dataset in the file. + * offset[0] = 1; offset[1] = 2; + * block[0] = 1; block[1] = 1; + * stride[0] = 1; stride[1] = 1; + * count[0] = 3; count[1] = 4; + * ret = H5Sselect_hyperslab(fid, H5S_SELECT_SET, offset, stride, count, block); + * + * // Add second selected hyperslab to the selection. + * offset[0] = 2; offset[1] = 4; + * block[0] = 1; block[1] = 1; + * stride[0] = 1; stride[1] = 1; + * count[0] = 6; count[1] = 5; + * ret = H5Sselect_hyperslab(fid, H5S_SELECT_OR, offset, stride, count, block); + * \endcode + * + * The example below shows example code to create the selection for the destination in memory. The steps + * are similar. In this example, the hyperslabs are the same shape, but located in different positions in the + * dataspace. The first hyperslab is 3 x 4 and starts at (0,0), and the second is 6 x 5 and starts at (1,2). + * Finally, the H5Dread call transfers the selected data from the file dataspace to the selection in memory. + * In this example, the source and destination selections are two overlapping rectangles. In general, any + * number of rectangles can be OR’ed, and they do not have to be contiguous. The order of the selections + * does not matter, but the first should use #H5S_SELECT_SET ; subsequent selections are unioned using + * #H5S_SELECT_OR. + * + * It is important to emphasize that the source and destination do not have to be the same shape (or number + * of rectangles). As long as the two selections have the same number of elements, the data can be + * transferred. + * + * Select destination hyperslabs + * \code + * // Create memory dataspace. + * mid = H5Screate_simple(MSPACE_RANK, mdim, NULL); + * + * // Select two hyperslabs in memory. Hyperslabs has the + * // same size and shape as the selected hyperslabs for + * // the file dataspace. + * offset[0] = 0; offset[1] = 0; + * block[0] = 1; block[1] = 1; + * stride[0] = 1; stride[1] = 1; + * count[0] = 3; count[1] = 4; + * ret = H5Sselect_hyperslab(mid, H5S_SELECT_SET, offset, stride, count, block); + * + * offset[0] = 1; offset[1] = 2; + * block[0] = 1; block[1] = 1; + * stride[0] = 1; stride[1] = 1; + * count[0] = 6; count[1] = 5; + * ret = H5Sselect_hyperslab(mid, H5S_SELECT_OR, offset, stride, count, block); + * + * ret = H5Dread(dataset, H5T_NATIVE_INT, mid, fid, H5P_DEFAULT, matrix_out); + * \endcode + * + *

Selecting a List of Independent Points

+ * + * It is also possible to specify a list of elements to read or write using the function H5Sselect_elements. + * + * The procedure is similar to hyperslab selections. + * \li 1. Get the source dataspace + * \li 2. Set the selected points + * \li 3. Get the destination dataspace + * \li 4. Set the selected points + * \li 5. Transfer the data using the source and destination dataspaces + * + * The figure below shows an example where four values are to be written to four separate points in a two + * dimensional dataspace. The source dataspace is a one dimensional array with the values 53, 59, 61, 67. + * The destination dataspace is an 8 x 12 array. The elements are to be written to the points + * (0,0), (3,3), (3,5), and (5,6). In this example, the source does not require a selection. The example + * below the figure shows example code to implement this transfer. + * + * A point selection lists the exact points to be transferred and the order they will be transferred. The + * source and destination are required to have the same number of elements. A point selection can be used + * with a hyperslab (for example, the source could be a point selection and the destination a hyperslab, + * or vice versa), so long as the number of elements selected are the same. + * + * + * + * + * + *
+ * \image html Dspace_separate.gif "Write data to separate points" + *
+ * + * Write data to separate points + * \code + * hsize_t dim2[] = {4}; + * int values[] = {53, 59, 61, 67}; + * + * // file dataspace + * hssize_t coord[4][2]; + * + * // Create dataspace for the second dataset. + * mid2 = H5Screate_simple(1, dim2, NULL); + * + * // Select sequence of NPOINTS points in the file dataspace. + * coord[0][0] = 0; coord[0][1] = 0; + * coord[1][0] = 3; coord[1][1] = 3; + * coord[2][0] = 3; coord[2][1] = 5; + * coord[3][0] = 5; coord[3][1] = 6; + * + * ret = H5Sselect_elements(fid, H5S_SELECT_SET, NPOINTS, (const hssize_t **)coord); + * + * ret = H5Dwrite(dataset, H5T_NATIVE_INT, mid2, fid, H5P_DEFAULT, values); + * \endcode + * + *

Combinations of Selections

+ * + * Selections are a very flexible mechanism for reorganizing data during a data transfer. With different + * combinations of dataspaces and selections, it is possible to implement many kinds of data transfers + * including sub‐setting, sampling, and reorganizing the data. The table below gives some example combinations + * of source and destination, and the operations they implement. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Selection operations
+ *

Source

+ *
+ *

Destination

+ *
+ *

Operation

+ *
+ *

All

+ *
+ *

All

+ *
+ *

Copy whole array

+ *
+ *

All

+ *
+ *

All (different shape)

+ *
+ *

Copy and reorganize array

+ *
+ *

Hyperslab

+ *
+ *

All

+ *
+ *

Sub-set

+ *
+ *

Hyperslab

+ *
+ *

Hyperslab (same shape)

+ *
+ *

Selection

+ *
+ *

Hyperslab

+ *
+ *

Hyperslab (different shape)

+ *
+ *

Select and rearrange

+ *
+ *

Hyperslab with stride or block

+ *
+ *

All or hyperslab with stride 1

+ *
+ *

Sub-sample, scatter

+ *
+ *

Hyperslab

+ *
+ *

Points

+ *
+ *

Scatter

+ *
+ *

Points

+ *
+ *

Hyperslab or all

+ *
+ *

Gather

+ *
+ *

Points

+ *
+ *

Points (same)

+ *
+ *

Selection

+ *
+ *

Points

+ *
+ *

Points (different)

+ *
+ *

Reorder points

+ *
+ * + * \subsection subsec_dataspace_select Dataspace Selection Operations and Data Transfer + * + * This section is under construction. + * + * \subsection subsec_dataspace_refer References to Dataset Regions + * + * Another use of selections is to store a reference to a region of a dataset. An HDF5 object reference + * object is a pointer to an object (dataset, group, or committed datatype) in the file. A selection can + * be used to create a pointer to a set of selected elements of a dataset, called a region reference. The + * selection can be either a point selection or a hyperslab selection. + * + * A region reference is an object maintained by the HDF5 Library. The region reference can be stored in a + * dataset or attribute, and then read. The dataset or attribute is defined to have the special datatype, + * #H5T_STD_REF_DSETREG. + * + * To discover the elements and/or read the data, the region reference can be dereferenced. The + * #H5Rdereference call returns an identifier for the dataset, and then the selected dataspace can be + * retrieved with a call to #H5Rget_region(). The selected dataspace can be used to read the selected data + * elements. + * + * For more information, \see subsubsec_datatype_other_refs. + * + * \subsubsection subsubsec_dataspace_refer_use Example Uses for Region References + * + * Region references are used to implement stored pointers to data within a dataset. For example, features + * in a large dataset might be indexed by a table. See the figure below. This table could be stored as an + * HDF5 dataset with a compound datatype, for example, with a field for the name of the feature and a region + * reference to point to the feature in the dataset. See the second figure below. + * + * + * + * + * + *
+ * \image html Dspace_features.gif " Features indexed by a table" + *
+ * + * + * + * + * + *
+ * \image html Dspace_features_cmpd.gif "Storing the table with a compound datatype" + *
+ * + * + * \subsubsection subsubsec_dataspace_refer_create Creating References to Regions + * + * To create a region reference: + * \li 1. Create or open the dataset that contains the region + * \li 2. Get the dataspace for the dataset + * \li 3. Define a selection that specifies the region + * \li 4. Create a region reference using the dataset and dataspace with selection + * \li 5. Write the region reference(s) to the desired dataset or attribute + * + * The figure below shows a diagram of a file with three datasets. Dataset D1 and D2 are two dimensional + * arrays of integers. Dataset R1 is a one dimensional array of references to regions in D1 and D2. The + * regions can be any valid selection of the dataspace of the target dataset. + * + * + * + * + *
+ * \image html Dspace_three_datasets.gif "A file with three datasets" + *
+ * Note: In the figure above, R1 is a 1 D array of region pointers; each pointer refers to a selection + * in one dataset. + * + * The example below shows code to create the array of region references. The references are created in an + * array of type #hdset_reg_ref_t. Each region is defined as a selection on the dataspace of the dataset, + * and a reference is created using \ref H5Rcreate(). The call to \ref H5Rcreate() specifies the file, + * dataset, and the dataspace with selection. + * + * Create an array of region references + * \code + * // create an array of 4 region references + * hdset_reg_ref_t ref[4]; + * + * // Create a reference to the first hyperslab in the first Dataset. + * offset[0] = 1; offset[1] = 1; + * count[0] = 3; count[1] = 2; + * status = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, offset, NULL, count, NULL); + * status = H5Rcreate(&ref[0], file_id, "D1", H5R_DATASET_REGION, space_id); + * + * // The second reference is to a union of hyperslabs in the first Dataset + * offset[0] = 5; offset[1] = 3; + * count[0] = 1; count[1] = 4; + * status = H5Sselect_none(space_id); + * status = H5Sselect_hyperslab(space_id, H5S_SELECT_SET, offset, NULL, count, NULL); + * offset[0] = 6; offset[1] = 5; + * count[0] = 1; count[1] = 2; + * status = H5Sselect_hyperslab(space_id, H5S_SELECT_OR, offset, NULL, count, NULL); + * status = H5Rcreate(&ref[1], file_id, "D1", H5R_DATASET_REGION, space_id); + * + * // the fourth reference is to a selection of points in the first Dataset + * status = H5Sselect_none(space_id); + * coord[0][0] = 4; coord[0][1] = 4; + * coord[1][0] = 2; coord[1][1] = 6; + * coord[2][0] = 3; coord[2][1] = 7; + * coord[3][0] = 1; coord[3][1] = 5; + * coord[4][0] = 5; coord[4][1] = 8; + * + * status = H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hssize_t **)coord); + * status = H5Rcreate(&ref[3], file_id, "D1", H5R_DATASET_REGION, space_id); + * + * // the third reference is to a hyperslab in the second Dataset + * offset[0] = 0; offset[1] = 0; + * count[0] = 4; count[1] = 6; + * status = H5Sselect_hyperslab(space_id2, H5S_SELECT_SET, offset, NULL, count, NULL); + * status = H5Rcreate(&ref[2], file_id, "D2", H5R_DATASET_REGION, space_id2); + * \endcode + * + * When all the references are created, the array of references is written to the dataset R1. The + * dataset is declared to have datatype #H5T_STD_REF_DSETREG. See the example below. + * + * Write the array of references to a dataset + * \code + * Hsize_t dimsr[1]; + * dimsr[0] = 4; + * + * // Dataset with references. + * spacer_id = H5Screate_simple(1, dimsr, NULL); + * dsetr_id = H5Dcreate(file_id, "R1", H5T_STD_REF_DSETREG, spacer_id, H5P_DEFAULT, H5P_DEFAULT, + * H5P_DEFAULT); + * + * // Write dataset with the references. + * status = H5Dwrite(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref); + * + * \endcode + * + * When creating region references, the following rules are enforced. + * \li The selection must be a valid selection for the target dataset, just as when transferring data + * \li The dataset must exist in the file when the reference is created; #H5Rcreate + * \li The target dataset must be in the same file as the stored reference + * + * \subsubsection subsubsec_dataspace_refer_read Reading References to Regions + * + * To retrieve data from a region reference, the reference must be read from the file, and then the data can + * be retrieved. The steps are: + * \li 1. Open the dataset or attribute containing the reference objects + * \li 2. Read the reference object(s) + * \li 3. For each region reference, get the dataset (#H5Rdereference) and dataspace (#H5Rget_region) + * \li 4. Use the dataspace and datatype to discover what space is needed to store the data, allocate the + * correct storage and create a dataspace and datatype to define the memory data layout + * + * The example below shows code to read an array of region references from a dataset, and then read the + * data from the first selected region. Note that the region reference has information that records the + * dataset (within the file) and the selection on the dataspace of the dataset. After dereferencing the + * regions reference, the datatype, number of points, and some aspects of the selection can be discovered. + * (For a union of hyperslabs, it may not be possible to determine the exact set of hyperslabs that has been + * combined.) + * The table below the code example shows the inquiry functions. + * + * When reading data from a region reference, the following rules are enforced: + * \li The target dataset must be present and accessible in the file + * \li The selection must be a valid selection for the dataset + * + * Read an array of region references; read from the first selection + * \code + * dsetr_id = H5Dopen (file_id, "R1", H5P_DEFAULT); + * status = H5Dread(dsetr_id, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_out); + * + * // Dereference the first reference. + * // 1) get the dataset (H5Rdereference) + * // 2) get the selected dataspace (H5Rget_region) + * + * dsetv_id = H5Rdereference(dsetr_id, H5R_DATASET_REGION, &ref_out[0]); + * space_id = H5Rget_region(dsetr_id, H5R_DATASET_REGION, &ref_out[0]); + * + * // Discover how many points and shape of the data + * ndims = H5Sget_simple_extent_ndims(space_id); + * H5Sget_simple_extent_dims(space_id,dimsx,NULL); + * + * // Read and display hyperslab selection from the dataset. + * dimsy[0] = H5Sget_select_npoints(space_id); + * spacex_id = H5Screate_simple(1, dimsy, NULL); + * + * status = H5Dread(dsetv_id, H5T_NATIVE_INT, H5S_ALL, space_id, H5P_DEFAULT, data_out); + * printf("Selected hyperslab: "); + * for (i = 0; i < 8; i++) { + * printf("\n"); + * for (j = 0; j < 10; j++) + * printf("%d ", data_out[i][j]); + * } + * printf("\n"); + * \endcode + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
The inquiry functions
+ *

Function

+ *
+ *

Information

+ *
+ * @ref H5Sget_select_npoints + * + *

The number of elements in the selection (hyperslab or point selection).

+ *
+ * @ref H5Sget_select_bounds + * + *

The bounding box that encloses the selected points (hyperslab or point selection).

+ *
+ * @ref H5Sget_select_hyper_nblocks + * + *

The number of blocks in the selection.

+ *
+ * @ref H5Sget_select_hyper_blocklist + * + *

A list of the blocks in the selection.

+ *
+ * @ref H5Sget_select_elem_npoints + * + *

The number of points in the selection.

+ *
+ * @ref H5Sget_select_elem_pointlist + * + *

The points.

+ *
+ * + * + * \subsection subsec_dataspace_sample Sample Programs + * + * This section contains the full programs from which several of the code examples in this chapter were + * derived. The h5dump output from the program's output file immediately follows each program. + * + * h5_write.c + * \code + * #include "hdf5.h" + * + * #define H5FILE_NAME "SDS.h5" + * #define DATASETNAME "C Matrix" + * #define NX 3 + * #define NY 5 + * #define RANK 2 // dataset dimensions + * + * int + * main (void) + * { + * hid_t file, dataset; // file and dataset identifiers + * hid_t datatype, dataspace; // identifiers + * hsize_t dims[2]; // dataset dimensions + * herr_t status; + * int data[NX][NY]; // data to write + * int i, j; + * + * // + * // Data and output buffer initialization. + * for (j = 0; j < NX; j++) { + * for (i = 0; i < NY; i++) + * data[j][i] = i + 1 + j*NY; + * } + * // 1 2 3 4 5 + * // 6 7 8 9 10 + * // 11 12 13 14 15 + * + * // Create a new file using H5F_ACC_TRUNC access, + * // default file creation properties, and default file + * // access properties. + * file = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + * + * // Describe the size of the array and create the data space for fixed + * // size dataset. + * dims[0] = NX; + * dims[1] = NY; + * dataspace = H5Screate_simple(RANK, dims, NULL); + * + * // Create a new dataset within the file using defined dataspace and + * // datatype and default dataset creation properties. + * dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + * H5P_DEFAULT, H5P_DEFAULT); + * + * // Write the data to the dataset using default transfer properties. + * status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + * + * // Close/release resources. + * H5Sclose(dataspace); + * H5Dclose(dataset); + * H5Fclose(file); + * + * return 0; + * } + * + * SDS.out + * ------- + * HDF5 "SDS.h5" { + * GROUP "/" { + * DATASET "C Matrix" { + * DATATYPE H5T_STD_I32BE + * DATASPACE SIMPLE { ( 3, 5 ) / ( 3, 5 ) } + * DATA { + * 1, 2, 3, 4, 5, + * 6, 7, 8, 9, 10, + * 11, 12, 13, 14, 15 + * } + * } + * + * \endcode + * + * h5_write.f90 + * \code + * ---------- + * PROGRAM DSETEXAMPLE + * + * USE HDF5 ! This module contains all necessary modules + * + * IMPLICIT NONE + * + * CHARACTER(LEN=7), PARAMETER :: filename = "SDSf.h5" ! File name + * CHARACTER(LEN=14), PARAMETER :: dsetname = "Fortran Matrix" ! Dataset name + * INTEGER, PARAMETER :: NX = 3 + * INTEGER, PARAMETER :: NY = 5 + * + * INTEGER(HID_T) :: file_id ! File identifier + * INTEGER(HID_T) :: dset_id ! Dataset identifier + * INTEGER(HID_T) :: dspace_id ! Dataspace identifier + * + * INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/3,5/) ! Dataset dimensions + * INTEGER :: rank = 2 ! Dataset rank + * INTEGER :: data(NX,NY) + * INTEGER :: error ! Error flag + * INTEGER :: i, j + * + * ! + * ! Initialize data + * ! + * do i = 1, NX + * do j = 1, NY + * data(i,j) = j + (i-1)*NY + * enddo + * enddo + * ! + * ! Data + * ! + * ! 1 2 3 4 5 + * ! 6 7 8 9 10 + * ! 11 12 13 14 15 + * + * ! + * ! Initialize FORTRAN interface. + * ! + * CALLh5open_f(error) + * + * ! + * ! Create a new file using default properties. + * ! + * CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + * + * ! + * ! Create the dataspace. + * ! + * CALL h5screate_simple_f(rank, dims, dspace_id, error) + * + * ! + * ! Create and write dataset using default properties. + * ! + * CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & + * dset_id, error, H5P_DEFAULT_F, H5P_DEFAULT_F, & + * H5P_DEFAULT_F) + * + * CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, dims, error) + * + * ! + * ! End access to the dataset and release resources used by it. + * ! + * CALL h5dclose_f(dset_id, error) + * + * ! + * ! Terminate access to the data space. + * ! + * CALL h5sclose_f(dspace_id, error) + * + * ! + * ! Close the file. + * ! + * CALL h5fclose_f(file_id, error) + * + * ! + * ! Close FORTRAN interface. + * ! + * CALL h5close_f(error) + * + * END PROGRAM DSETEXAMPLE + * + * SDSf.out + * -------- + * HDF5 "SDSf.h5" { + * GROUP "/" { + * DATASET "Fortran Matrix" { + * DATATYPE H5T_STD_I32BE + * DATASPACE SIMPLE { ( 5, 3 ) / ( 5, 3 ) } + * DATA { + * 1, 6, 11, + * 2, 7, 12, + * 3, 8, 13, + * 4, 9, 14, + * 5, 10, 15 + * } + * } + * } + * } + * + * \endcode + * + * h5_write_tr.f90 + * \code + * PROGRAM DSETEXAMPLE + * + * USE HDF5 ! This module contains all necessary modules + * + * IMPLICIT NONE + * + * CHARACTER(LEN=10), PARAMETER :: filename = "SDSf_tr.h5" ! File name + * CHARACTER(LEN=24), PARAMETER :: dsetname = "Fortran Transpose Matrix"! Dataset name + * + * INTEGER, PARAMETER :: NX = 3 + * INTEGER, PARAMETER :: NY = 5 + * + * INTEGER(HID_T) :: file_id ! File identifier + * INTEGER(HID_T) :: dset_id ! Dataset identifier + * INTEGER(HID_T) :: dspace_id ! Dataspace identifier + * + * INTEGER(HSIZE_T), DIMENSION(2) :: dims = (/NY, NX/) ! Dataset dimensions + * INTEGER :: rank = 2 ! Dataset rank + * INTEGER :: data(NY,NX) + * + * INTEGER :: error ! Error flag + * INTEGER :: i, j + * + * ! + * ! Initialize data + * ! + * do i = 1, NY + * do j = 1, NX + * data(i,j) = i + (j-1)*NY + * enddo + * enddo + * + * ! + * ! Data + * ! + * ! 1 6 11 + * ! 2 7 12 + * ! 3 8 13 + * ! 4 9 14 + * ! 5 10 15 + * + * ! + * ! Initialize FORTRAN interface. + * ! + * CALL h5open_f(error) + * + * ! + * ! Create a new file using default properties. + * ! + * CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, error) + * + * ! + * ! Create the dataspace. + * ! + * CALL h5screate_simple_f(rank, dims, dspace_id, error) + * + * ! + * ! Create and write dataset using default properties. + * ! + * CALL h5dcreate_f(file_id, dsetname, H5T_NATIVE_INTEGER, dspace_id, & + * dset_id, error, H5P_DEFAULT_F, H5P_DEFAULT_F, & + * H5P_DEFAULT_F) + * CALL h5dwrite_f(dset_id, H5T_NATIVE_INTEGER, data, dims, error) + * + * ! + * ! End access to the dataset and release resources used by it. + * ! + * CALL h5dclose_f(dset_id, error) + * + * ! + * ! Terminate access to the data space. + * ! + * CALL h5sclose_f(dspace_id, error) + * + * ! + * ! Close the file. + * ! + * CALL h5fclose_f(file_id, error) + * + * ! + * ! Close FORTRAN interface. + * ! + * CALL h5close_f(error) + * + * END PROGRAM DSETEXAMPLE + * + * SDSf_tr.out + * ----------- + * HDF5 "SDSf_tr.h5" { + * GROUP "/" { + * DATASET "Fortran Transpose Matrix" { + * DATATYPE H5T_STD_I32LE + * DATASPACE SIMPLE { ( 3, 5 ) / ( 3, 5 ) } + * DATA { + * 1, 2, 3, 4, 5, + * 6, 7, 8, 9, 10, + * 11, 12, 13, 14, 15 + * } + * } + * } + * } + * + * \endcode + * + * Previous Chapter \ref sec_datatype - Next Chapter \ref sec_attribute + * + */ + +/** + * \defgroup H5S Dataspaces (H5S) * * Use the functions in this module to manage HDF5 dataspaces \Emph{and} selections. * @@ -40,6 +1524,7 @@ * using \Emph{selections}. Furthermore, certain set operations are supported * for selections. * + * */ #endif /* H5Smodule_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Spkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Spkg.h index a898d600d0..4367a4d3cd 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Spkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Spkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Thursday, September 28, 2000 - * - * Purpose: This file contains declarations which are visible only within - * the H5S package. Source files outside the H5S package should - * include H5Sprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5S package. Source files outside the H5S package should + * include H5Sprivate.h instead. */ #if !(defined H5S_FRIEND || defined H5S_MODULE) #error "Do not include this file outside the H5S package!" @@ -246,7 +242,8 @@ typedef hssize_t (*H5S_sel_serial_size_func_t)(H5S_t *space); /* Method to store current selection in "serialized" form (a byte sequence suitable for storing on disk) */ typedef herr_t (*H5S_sel_serialize_func_t)(H5S_t *space, uint8_t **p); /* Method to create selection from "serialized" form (a byte sequence suitable for storing on disk) */ -typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t **space, const uint8_t **p); +typedef herr_t (*H5S_sel_deserialize_func_t)(H5S_t **space, const uint8_t **p, const size_t p_size, + hbool_t skip); /* Method to determine smallest n-D bounding box containing the current selection */ typedef herr_t (*H5S_sel_bounds_func_t)(const H5S_t *space, hsize_t *start, hsize_t *end); /* Method to determine linear offset of initial element in selection within dataspace */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Sprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Sprivate.h index 3eab05ac30..ac46d9e362 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Sprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Sprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -191,7 +190,7 @@ typedef struct H5S_sel_iter_op_t { #define H5S_SELECT_SHAPE_SAME(S1, S2) (H5S_select_shape_same(S1, S2)) #define H5S_SELECT_INTERSECT_BLOCK(S, START, END) (H5S_select_intersect_block(S, START, END)) #define H5S_SELECT_RELEASE(S) (H5S_select_release(S)) -#define H5S_SELECT_DESERIALIZE(S, BUF) (H5S_select_deserialize(S, BUF)) +#define H5S_SELECT_DESERIALIZE(S, BUF, BUF_SIZE) (H5S_select_deserialize(S, BUF, BUF_SIZE)) /* Forward declaration of structs used below */ struct H5O_t; @@ -230,7 +229,7 @@ H5_DLL htri_t H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2); H5_DLL herr_t H5S_extent_copy(H5S_t *dst, const H5S_t *src); /* Operations on selections */ -H5_DLL herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p); +H5_DLL herr_t H5S_select_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size); H5_DLL H5S_sel_type H5S_get_select_type(const H5S_t *space); H5_DLL herr_t H5S_select_iterate(void *buf, const H5T_t *type, H5S_t *space, const H5S_sel_iter_op_t *op, void *op_data); @@ -261,6 +260,7 @@ H5_DLL herr_t H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, H5_DLL herr_t H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_intersect_space, H5S_t **new_space_ptr, hbool_t share_space); H5_DLL herr_t H5S_select_subtract(H5S_t *space, H5S_t *subtract_space); +H5_DLL herr_t H5S_select_contig_block(H5S_t *space, hbool_t *is_contig, hsize_t *off, size_t *len); /* Operations on all selections */ H5_DLL herr_t H5S_select_all(H5S_t *space, hbool_t rel_prev); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Spublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Spublic.h index 536f2906af..737e88ba13 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Spublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Spublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -17,14 +16,34 @@ #ifndef H5Spublic_H #define H5Spublic_H -/* Public headers needed by this file */ -#include "H5public.h" -#include "H5Ipublic.h" +#include "H5public.h" /* Generic Functions */ +#include "H5Ipublic.h" /* Identifiers */ /* Define special dataspaces for dataset I/O operations */ -#define H5S_ALL 0 /* (hid_t) */ -#define H5S_BLOCK 1 /* (hid_t) */ -#define H5S_PLIST 2 /* (hid_t) */ + +/** + * Used with @ref H5Dread and @ref H5Dwrite to indicate that the entire + * dataspace will be selected. In the case of a file dataspace, this means + * that the entire file dataspace, as defined by the dataset's dimensions, + * will be selected. In the case of a memory dataspace, this means that + * the specified file dataspace will also be used for the memory dataspace. + * Used in place of a file or memory dataspace @ref hid_t value. + */ +#define H5S_ALL 0 + +/** + * Indicates that the buffer provided in a call to @ref H5Dread or @ref H5Dwrite + * is a single contiguous block of memory, with the same number of elements + * as the file dataspace. Used in place of a memory dataspace @ref hid_t value. + */ +#define H5S_BLOCK 1 + +/** + * Used with @ref H5Dread and @ref H5Dwrite to indicate that the file dataspace + * selection was set via @ref H5Pset_dataset_io_hyperslab_selection calls. + * Used in place of a file dataspace @ref hid_t value. + */ +#define H5S_PLIST 2 #define H5S_UNLIMITED HSIZE_UNDEF /**< Value for 'unlimited' dimensions */ @@ -865,9 +884,9 @@ H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags) * * \space_id{sel_iter_id} * \param[in] maxseq Maximum number of sequences to retrieve - * \param[in] maxbytes Maximum number of bytes to retrieve in sequences + * \param[in] maxelmts Maximum number of elements to retrieve in sequences * \param[out] nseq Number of sequences retrieved - * \param[out] nbytes Number of bytes retrieved, in all sequences + * \param[out] nelmts Number of elements retrieved, in all sequences * \param[out] off Array of sequence offsets * \param[out] len Array of sequence lengths * @@ -884,9 +903,9 @@ H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags) * #H5S_SEL_ITER_GET_SEQ_LIST_SORTED flag is passed to * H5Ssel_iter_create() for a point selection. * - * \p maxseq and \p maxbytes specify the most sequences or bytes + * \p maxseq and \p maxelmts specify the most sequences or elements * possible to place into the \p off and \p len arrays. \p nseq and - * \p nbytes return the actual number of sequences and bytes put + * \p nelmts return the actual number of sequences and elements put * into the arrays. * * Each call to H5Ssel_iter_get_seq_list() will retrieve the next @@ -898,13 +917,13 @@ H5_DLL hid_t H5Ssel_iter_create(hid_t spaceid, size_t elmt_size, unsigned flags) * the iterator was created from (which can be retrieved with * H5Sget_select_npoints(). When there are no further sequences of * elements to retrieve, calls to this routine will set \p nseq - * and \p nbytes to zero. + * and \p nelmts to zero. * * \since 1.12.0 * */ -H5_DLL herr_t H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes, size_t *nseq, - size_t *nbytes, hsize_t *off, size_t *len); +H5_DLL herr_t H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxelmts, size_t *nseq, + size_t *nelmts, hsize_t *off, size_t *len); /** * \ingroup H5S * @@ -1007,7 +1026,7 @@ H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); * The \p coord parameter is a pointer to a buffer containing a * serialized 2-dimensional array of size \p num_elements by the * rank of the dataspace. The array lists dataset elements in the - * point selection; that is, it’s a list of of zero-based values + * point selection; that is, it's a list of zero-based values * specifying the coordinates in the dataset of the selected * elements. The order of the element coordinates in the \p coord * array specifies the order in which the array elements are @@ -1049,7 +1068,7 @@ H5_DLL herr_t H5Sselect_copy(hid_t dst_id, hid_t src_id); * * In the 1D case, we will be selecting five points and a 1D * dataspace has rank 1, so the selection will be described in a - * 5-by-1 array. To select the 1st, 14th, 17th, 23rd, 8th elements + * 5-by-1 array. To select the 1st, 14th, 17th, 23rd and 8th elements * of the dataset, the selection array would be as follows * (remembering that point coordinates are zero-based): * \n 0 @@ -1321,9 +1340,9 @@ H5_DLL herr_t H5Sset_extent_none(hid_t space_id); * \details H5Sset_extent_simple() sets or resets the size of an existing * dataspace. * - * \p dims is an array of size \p rank which contains the new size + * \p dims is an array of size \p rank that contains the new size * of each dimension in the dataspace. \p max is an array of size - * \p rank which contains the maximum size of each dimension in + * \p rank that contains the maximum size of each dimension in * the dataspace. * * Any previous extent is removed from the dataspace, the dataspace diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5StrType.h b/externals/coda-oss/modules/drivers/hdf5/include/H5StrType.h index 2dc3bdc480..ccae3e750d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5StrType.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5StrType.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5TBpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5TBpublic.h new file mode 100644 index 0000000000..42585cf012 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5TBpublic.h @@ -0,0 +1,676 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5TBpublic_H +#define H5TBpublic_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** \page H5TB_UG The HDF5 High Level Table + * @todo Under Construction + */ + +/**\defgroup H5TB HDF5 Table APIs (H5TB) + * + * Creating and manipulating HDF5 datasets intended to be + * interpreted as tables (H5TB) + * + * The HDF5 Table API defines a standard storage for HDF5 datasets + * that are intended to be interpreted as tables. A table is defined + * as a collection of records whose values are stored in fixed-length + * fields. All records have the same structure, and all values in + * each field have the same data type. + * + * \note \Bold{Programming hints:} + * \note To use any of these functions or subroutines, + * you must first include the relevant include file (C) or + * module (Fortran) in your application. + * \note The following line includes the HDF5 Table package, H5TB, + * in C applications: + * \code #include "hdf5_hl.h" \endcode + * \note To include the H5TB module in Fortran applications specify: + * \code use h5tb \endcode + * Fortran applications must also include \ref H5open before + * any HDF5 calls to initialize global variables and \ref H5close + * after all HDF5 calls to close the Fortran interface. + * + * + * + *
+ * + * - Creation + * - \ref H5TBmake_table + * - Storage + * - \ref H5TBappend_records (No Fortran) + * - \ref H5TBwrite_records (No Fortran) + * - \ref H5TBwrite_fields_name + * - \ref H5TBwrite_fields_index + * + * - Modification + * - \ref H5TBdelete_record (No Fortran) + * - \ref H5TBinsert_record (No Fortran) + * - \ref H5TBadd_records_from (No Fortran) + * - \ref H5TBcombine_tables (No Fortran) + * - \ref H5TBinsert_field + * - \ref H5TBdelete_field + * + * + * + * - Retrieval + * - \ref H5TBread_table + * - \ref H5TBread_records (No Fortran) + * - \ref H5TBread_fields_name + * - \ref H5TBread_fields_index + * + * - Query + * - \ref H5TBget_table_info + * - \ref H5TBget_field_info + * + * - Query Table Attributes + * - \ref H5TBAget_fill + * - \ref H5TBAget_title + * + *
+ * + */ + +/*------------------------------------------------------------------------- + * + * Create functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Creates and writes a table + * + * \param[in] table_title The title of the table + * \fg_loc_id + * \param[in] dset_name The name of the dataset to create + * \param[in] nfields The number of fields + * \param[in] nrecords The number of records + * \param[in] type_size The size in bytes of the structure + * associated with the table; + * This value is obtained with \c sizeof(). + * \param[in] field_names An array containing the names of + * the fields + * \param[in] field_offset An array containing the offsets of + * the fields + * \param[in] field_types An array containing the type of + * the fields + * \param[in] chunk_size The chunk size + * \param[in] fill_data Fill values data + * \param[in] compress Flag that turns compression on or off + * \param[in] buf Buffer with data to be written to the table + * + * \return \herr_t + * + * \details H5TBmake_table() creates and writes a dataset named + * \p dset_name attached to the object specified by the + * identifier loc_id. + * + */ +H5_HLDLL herr_t H5TBmake_table(const char *table_title, hid_t loc_id, const char *dset_name, hsize_t nfields, + hsize_t nrecords, size_t type_size, const char *field_names[], + const size_t *field_offset, const hid_t *field_types, hsize_t chunk_size, + void *fill_data, int compress, const void *buf); + +/*------------------------------------------------------------------------- + * + * Write functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Adds records to the end of the table + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to overwrite + * \param[in] nrecords The number of records to append + * \param[in] type_size The size of the structure type, + * as calculated by \c sizeof(). + * \param[in] field_offset An array containing the offsets of + * the fields. These offsets can be + * calculated with the #HOFFSET macro + * \param[in] dst_sizes An array containing the sizes of + * the fields + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBappend_records() adds records to the end of the table + * named \p dset_name attached to the object specified by the + * identifier \p loc_id. The dataset is extended to hold the + * new records. + * + */ +H5_HLDLL herr_t H5TBappend_records(hid_t loc_id, const char *dset_name, hsize_t nrecords, size_t type_size, + const size_t *field_offset, const size_t *dst_sizes, const void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Overwrites records + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to overwrite + * \param[in] start The zero index record to start writing + * \param[in] nrecords The number of records to write + * \param[in] type_size The size of the structure type, as + * calculated by \c sizeof(). + * \param[in] field_offset An array containing the offsets of + * the fields. These offsets can be + * calculated with the #HOFFSET macro + * \param[in] dst_sizes An array containing the sizes of + * the fields + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBwrite_records() overwrites records starting at the zero + * index position start of the table named \p dset_name attached + * to the object specified by the identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5TBwrite_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, + size_t type_size, const size_t *field_offset, const size_t *dst_sizes, + const void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Overwrites fields + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to overwrite + * \param[in] field_names The names of the fields to write + * \param[in] start The zero index record to start writing + * \param[in] nrecords The number of records to write + * \param[in] type_size The size of the structure type, as + * calculated by \c sizeof(). + * \param[in] field_offset An array containing the offsets of + * the fields. These offsets can be + * calculated with the #HOFFSET macro + * \param[in] dst_sizes An array containing the sizes of + * the fields + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBwrite_fields_name() overwrites one or several fields + * specified by \p field_names with data in \p buf from a + * dataset named \p dset_name attached to the object specified + * by the identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5TBwrite_fields_name(hid_t loc_id, const char *dset_name, const char *field_names, + hsize_t start, hsize_t nrecords, size_t type_size, + const size_t *field_offset, const size_t *dst_sizes, const void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Overwrites fields + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to overwrite + * \param[in] nfields The number of fields to overwrite. + * This parameter is also the size of the + * \p field_index array. + * \param[in] field_index The indexes of the fields to write + * \param[in] start The zero based index record to start writing + * \param[in] nrecords The number of records to write + * \param[in] type_size The size of the structure type, as + * calculated by \c sizeof(). + * \param[in] field_offset An array containing the offsets of + * the fields. These offsets can be + * calculated with the #HOFFSET macro + * \param[in] dst_sizes An array containing the sizes of + * the fields + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBwrite_fields_index() overwrites one or several fields + * specified by \p field_index with a buffer \p buf from a + * dataset named \p dset_name attached to the object + * specified by the identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5TBwrite_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, + const int *field_index, hsize_t start, hsize_t nrecords, + size_t type_size, const size_t *field_offset, const size_t *dst_sizes, + const void *buf); + +/*------------------------------------------------------------------------- + * + * Read functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Reads a table + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[in] dst_size The size of the structure type, + * as calculated by \c sizeof() + * \param[in] dst_offset An array containing the offsets of + * the fields. These offsets can be + * calculated with the #HOFFSET macro + * \param[in] dst_sizes An array containing the sizes of + * the fields. These sizes can be + * calculated with the sizeof() macro. + * \param[in] dst_buf Buffer with data + * + * \return \herr_t + * + * \details H5TBread_table() reads a table named + * \p dset_name attached to the object specified by + * the identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5TBread_table(hid_t loc_id, const char *dset_name, size_t dst_size, const size_t *dst_offset, + const size_t *dst_sizes, void *dst_buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * \brief Reads one or several fields. The fields are identified by name. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[in] field_names An array containing the names of the + * fields to read + * \param[in] start The start record to read from + * \param[in] nrecords The number of records to read + * \param[in] type_size The size in bytes of the structure associated + * with the table + * (This value is obtained with \c sizeof().) + * \param[in] field_offset An array containing the offsets of the fields + * \param[in] dst_sizes An array containing the size in bytes of + * the fields + * \param[out] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBread_fields_name() reads the fields identified + * by \p field_names from a dataset named \p dset_name + * attached to the object specified by the identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5TBread_fields_name(hid_t loc_id, const char *dset_name, const char *field_names, + hsize_t start, hsize_t nrecords, size_t type_size, + const size_t *field_offset, const size_t *dst_sizes, void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Reads one or several fields. The fields are identified by index. + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[in] nfields The number of fields to read + * (This parameter is also the size of the + * \p field_index array.) + * fields to read + * \param[in] field_index The indexes of the fields to read + * \param[in] start The start record to read from + * \param[in] nrecords The number of records to read + * \param[in] type_size The size in bytes of the structure associated + * with the table + * (This value is obtained with \c sizeof()) + * \param[in] field_offset An array containing the offsets of the fields + * \param[in] dst_sizes An array containing the size in bytes of + * the fields + * \param[out] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBread_fields_index() reads the fields identified + * by \p field_index from a dataset named \p dset_name attached + * to the object specified by the identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5TBread_fields_index(hid_t loc_id, const char *dset_name, hsize_t nfields, + const int *field_index, hsize_t start, hsize_t nrecords, + size_t type_size, const size_t *field_offset, const size_t *dst_sizes, + void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Reads records + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[in] start The start record to read from + * \param[in] nrecords The number of records to read + * \param[in] type_size The size of the structure type, + * as calculated by \c sizeof() + * \param[in] dst_offset An array containing the offsets of the + * fields. These offsets can be calculated + * with the #HOFFSET macro + * \param[in] dst_sizes An array containing the size in bytes of + * the fields + * \param[out] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBread_records() reads some records identified from a dataset + * named \p dset_name attached to the object specified by the + * identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5TBread_records(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, + size_t type_size, const size_t *dst_offset, const size_t *dst_sizes, + void *buf); + +/*------------------------------------------------------------------------- + * + * Inquiry functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Gets the table dimensions + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] nfields The number of fields + * \param[out] nrecords The number of records + * + * \return \herr_t + * + * \details H5TBget_table_info() retrieves the table dimensions from a + * dataset named \p dset_name attached to the object specified + * by the identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5TBget_table_info(hid_t loc_id, const char *dset_name, hsize_t *nfields, hsize_t *nrecords); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Gets information about a table + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset to read + * \param[out] field_names An array containing the names of the fields + * \param[out] field_sizes An array containing the size of the fields + * \param[out] field_offsets An array containing the offsets of the fields + * \param[out] type_size The size of the HDF5 datatype associated + * with the table. (More specifically, + * the size in bytes of the HDF5 compound + * datatype used to define a row, or record, + * in the table) + * + * \return \herr_t + * + * \details H5TBget_field_info() gets information about a dataset + * named \p dset_name attached to the object specified + * by the identifier \p loc_id. + * + */ +H5_HLDLL herr_t H5TBget_field_info(hid_t loc_id, const char *dset_name, char *field_names[], + size_t *field_sizes, size_t *field_offsets, size_t *type_size); + +/*------------------------------------------------------------------------- + * + * Manipulation functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Delete records + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset + * \param[in] start The start record to delete from + * \param[in] nrecords The number of records to delete + * + * \return \herr_t + * + * \details H5TBdelete_record() deletes nrecords number of records starting + * from \p start from the middle of the table \p dset_name + * ("pulling up" all the records after it). + * + */ +H5_HLDLL herr_t H5TBdelete_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Insert records + * + * \fg_loc_id + * \param[in] dset_name The name of the dataset + * \param[in] start The position to insert + * \param[in] nrecords The number of records to insert + * \param[in] dst_size The size in bytes of the structure + * associated with the table + * \param[in] dst_offset An array containing the offsets of the + * fields + * \param[in] dst_sizes An array containing the size in bytes of + * the fields + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBinsert_record() inserts records into the middle of the table + * ("pushing down" all the records after it) + * + */ +H5_HLDLL herr_t H5TBinsert_record(hid_t loc_id, const char *dset_name, hsize_t start, hsize_t nrecords, + size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes, + void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Add records from first table to second table + * + * \fg_loc_id + * \param[in] dset_name1 The name of the dataset to read the records + * \param[in] start1 The position to read the records from the + * first table + * \param[in] nrecords The number of records to read from the first + * table + * \param[in] dset_name2 The name of the dataset to write the records + * \param[in] start2 The position to write the records on the + * second table + * + * \return \herr_t + * + * \details H5TBadd_records_from() adds records from a dataset named + * \p dset_name1 to a dataset named \p dset_name2. Both tables + * are attached to the object specified by the identifier loc_id. + * + */ +H5_HLDLL herr_t H5TBadd_records_from(hid_t loc_id, const char *dset_name1, hsize_t start1, hsize_t nrecords, + const char *dset_name2, hsize_t start2); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Combines records from two tables into a third + * + * \param[in] loc_id1 Identifier of the file or group in which + * the first table is located + * \param[in] dset_name1 The name of the first table to combine + * \param[in] loc_id2 Identifier of the file or group in which + * the second table is located + * \param[in] dset_name2 The name of the second table to combine + * \param[in] dset_name3 The name of the new table + * + * \return \herr_t + * + * \details H5TBcombine_tables() combines records from two datasets named + * \p dset_name1 and \p dset_name2, to a new table named + * \p dset_name3. These tables can be located on different files, + * identified by \p loc_id1 and \p loc_id2 (identifiers obtained + * with H5Fcreate()). They can also be located on the same file. + * In this case one uses the same identifier for both parameters + * \p loc_id1 and \p loc_id2. If two files are used, the third + * table is written in the first file. + * + */ +H5_HLDLL herr_t H5TBcombine_tables(hid_t loc_id1, const char *dset_name1, hid_t loc_id2, + const char *dset_name2, const char *dset_name3); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Insert a new field into a table + * + * \fg_loc_id + * \param[in] dset_name The name of the table + * \param[in] field_name The name of the field to insert + * \param[in] field_type The data type of the field + * \param[in] position The zero based index position where to + * insert the field + * \param[in] fill_data Fill value data for the field. This parameter + * can be NULL + * \param[in] buf Buffer with data + * + * \return \herr_t + * + * \details H5TBinsert_field() inserts a new field named \p field_name into + * the table \p dset_name. Note: this function requires the table + * to be re-created and rewritten in its entirety, and this can result + * in some unused space in the file, and can also take a great deal of + * time if the table is large. + * + */ +H5_HLDLL herr_t H5TBinsert_field(hid_t loc_id, const char *dset_name, const char *field_name, + hid_t field_type, hsize_t position, const void *fill_data, const void *buf); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Deletes a field from a table + * + * \fg_loc_id + * \param[in] dset_name The name of the table + * \param[in] field_name The name of the field to delete + * + * \return \herr_t + * + * \details H5TBdelete_field() deletes a field named \p field_name from the + * table \p dset_name. Note: this function requires the table to be + * re-created and rewritten in its entirety, and this can result in + * some unused space in the file, and can also take a great deal of + * time if the table is large. + * + */ +H5_HLDLL herr_t H5TBdelete_field(hid_t loc_id, const char *dset_name, const char *field_name); + +/*------------------------------------------------------------------------- + * + * Table attribute functions + * + *------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Reads a table's title + * + * \fg_loc_id + * \param[out] table_title Buffer for title name + * + * \return \herr_t + * + * \details H5TBget_title() returns the title of the table identified + * by \p loc_id in a buffer \p table_title. + * + */ +H5_HLDLL herr_t H5TBAget_title(hid_t loc_id, char *table_title); + +/** + * -------------------------------------------------------------------------- + * \ingroup H5TB + * + * + * \brief Reads the table attribute fill values + * + * \fg_loc_id + * \param[in] dset_name Name of table + * \param[in] dset_id Table identifier + * \param[out] dst_buf Buffer of fill values for table fields + * + * \return + * \return A return value of 1 indicates that a fill value is present. + * \return A return value of 0 indicates a fill value is not present. + * \return A return value <0 indicates an error. + * + * \details H5TBget_fill() reads the table attribute fill values into + * the buffer \p dst_buf for the table specified by \p dset_id + * and \p dset_name located in \p loc_id. + * + * \par Example + * \include H5TBAget_fill.c + * + */ +H5_HLDLL htri_t H5TBAget_fill(hid_t loc_id, const char *dset_name, hid_t dset_id, unsigned char *dst_buf); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5TSdevelop.h b/externals/coda-oss/modules/drivers/hdf5/include/H5TSdevelop.h index 9e8f718ae8..c3e1a6a65b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5TSdevelop.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5TSdevelop.h @@ -2,7 +2,7 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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://www.hdfgroup.org/licenses. * @@ -39,7 +39,7 @@ extern "C" { #endif /* HDF5 global library lock routines */ -H5_DLL herr_t H5TSmutex_acquire(unsigned int lock_count, hbool_t *acquired); +H5_DLL herr_t H5TSmutex_acquire(unsigned int lock_count, bool *acquired); H5_DLL herr_t H5TSmutex_release(unsigned int *lock_count); H5_DLL herr_t H5TSmutex_get_attempt_count(unsigned int *count); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5TSprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5TSprivate.h index 5d69854aeb..e24c409437 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5TSprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5TSprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Tdevelop.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Tdevelop.h index b1d9f053eb..e571741ec2 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Tdevelop.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Tdevelop.h @@ -2,10 +2,10 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -154,9 +154,9 @@ H5_DLL herr_t H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t * the conversion function. * * If a user is trying to remove a conversion function he registered, - * all parameters can be used. If he is trying to remove a library’s + * all parameters can be used. If he is trying to remove a library's * default conversion function, there is no guarantee the \p name and - * \p func parameters will match the user’s chosen values. Passing in + * \p func parameters will match the user's chosen values. Passing in * some values may cause this function to fail. A good practice is to * pass in NULL as their values. * @@ -194,17 +194,17 @@ H5_DLL H5T_conv_t H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata); /** * \ingroup CONV * - * \brief Check whether the library’s default conversion is hard conversion + * \brief Check whether the library's default conversion is hard conversion * * \type_id{src_id} of source datatype * \type_id{dst_id} of destination datatype * * \return \htri_t * - * \details H5Tcompiler_conv() determines whether the library’s conversion + * \details H5Tcompiler_conv() determines whether the library's conversion * function from type \p src_id to type \p dst_id is a compiler (hard) - * conversion or not. A compiler conversion uses compiler’s casting; a - * library (soft) conversion uses the library’s own conversion + * conversion or not. A compiler conversion uses compiler's casting; a + * library (soft) conversion uses the library's own conversion * function. * * \since 1.8.0 diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Tmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Tmodule.h index 8f7d04d294..801d474cd2 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Tmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Tmodule.h @@ -11,24 +11,3849 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 + * Purpose: This file contains declarations which define macros for the + * H5T package. Including this header means that the source file + * is part of the H5T package. + */ +#ifndef H5Tmodule_H +#define H5Tmodule_H + +/* Define the proper control macros for the generic FUNC_ENTER/LEAVE and error + * reporting macros. + */ +#define H5T_MODULE +#define H5_MY_PKG H5T +#define H5_MY_PKG_ERR H5E_DATATYPE + +/** \page H5T_UG HDF5 Datatypes + * + * \section sec_datatype HDF5 Datatypes + * HDF5 datatypes describe the element type of HDF5 datasets and attributes. + * There's a large set of predefined datatypes, but users may find it useful + * to define new datatypes through a process called \Emph{derivation}. + * + * The element type is automatically persisted as part of the HDF5 metadata of + * attributes and datasets. Additionally, datatype definitions can be persisted + * to HDF5 files and linked to groups as HDF5 datatype objects or so-called + * \Emph{committed datatypes}. + * + * \subsection subsec_datatype_intro Introduction and Definitions + * + * An HDF5 dataset is an array of data elements, arranged according to the specifications + * of the dataspace. In general, a data element is the smallest addressable unit of storage + * in the HDF5 file. (Compound datatypes are the exception to this rule.) The HDF5 datatype + * defines the storage format for a single data element. See the figure below. + * + * The model for HDF5 attributes is extremely similar to datasets: an attribute has a dataspace + * and a data type, as shown in the figure below. The information in this chapter applies to both + * datasets and attributes. + * + * + * + * + * + *
+ * \image html Dtypes_fig1.gif "Datatypes, dataspaces, and datasets" + *
+ * + * Abstractly, each data element within the dataset is a sequence of bits, interpreted as a single + * value from a set of values (for example, a number or a character). For a given datatype, there is a + * standard or convention for representing the values as bits, and when the bits are represented in a + * particular storage the bits are laid out in a specific storage scheme such as 8-bit bytes with a + * specific ordering and alignment of bytes within the storage array. + * + * HDF5 datatypes implement a flexible, extensible, and portable mechanism for specifying and + * discovering the storage layout of the data elements, determining how to interpret the elements + * (for example, as floating point numbers), and for transferring data from different compatible + * layouts. + * + * An HDF5 datatype describes one specific layout of bits. A dataset has a single datatype which + * applies to every data element. When a dataset is created, the storage datatype is defined. After + * the dataset or attribute is created, the datatype cannot be changed. + * \li The datatype describes the storage layout of a singledata element + * \li All elements of the dataset must have the same type + * \li The datatype of a dataset is immutable + * + * When data is transferred (for example, a read or write), each end point of the transfer has a + * datatype, which describes the correct storage for the elements. The source and destination may + * have different (but compatible) layouts, in which case the data elements are automatically + * transformed during the transfer. + * + * HDF5 datatypes describe commonly used binary formats for numbers (integers + * and floating point) and characters (ASCII). A given computing architecture and programming language + * supports certain number and character representations. For example, a computer may support 8-, + * 16-, 32-, and 64-bit signed integers, stored in memory in little-endian byte order. These would + * presumably correspond to the C programming language types \Emph{char}, \Emph{short}, + * \Emph{int}, and \Emph{long}. + * + * When reading and writing from memory, the HDF5 library must know the appropriate datatype + * that describes the architecture specific layout. The HDF5 library provides the platform + * independent \Emph{NATIVE} types, which are mapped to an appropriate datatype for each platform. + * So the type #H5T_NATIVE_INT is an alias for the appropriate descriptor for each platform. + * + * Data in memory has a datatype: + * \li The storage layout in memory is architecture-specific + * \li The HDF5 \Emph{NATIVE} types are predefined aliases for the architecture-specific memory layout + * \li The memory datatype need not be the same as the stored datatype of the dataset + * + * In addition to numbers and characters, an HDF5 datatype can describe more abstract classes of + * types including enumerations, strings, bit strings, and references (pointers to objects in the HDF5 + * file). HDF5 supports several classes of composite datatypes which are combinations of one or + * more other datatypes. In addition to the standard predefined datatypes, users can define new + * datatypes within the datatype classes. + * + * The HDF5 datatype model is very general and flexible: + * \li For common simple purposes, only predefined types will be needed + * \li Datatypes can be combined to create complex structured datatypes + * \li If needed, users can define custom atomic datatypes + * \li Committed datatypes can be shared by datasets or attributes + * + * \subsection subsec_datatype_model Datatype Model + * The HDF5 library implements an object-oriented model of datatypes. HDF5 datatypes are + * organized as a logical set of base types, or datatype classes. Each datatype class defines + * a format for representing logical values as a sequence of bits. For example the #H5T_INTEGER + * class is a format for representing twos complement integers of various sizes. + * + * A datatype class is defined as a set of one or more datatype properties. A datatype property is + * a property of the bit string. The datatype properties are defined by the logical model of the + * datatype class. For example, the integer class (twos complement integers) has properties such as + * “signed or unsigned”, “length”, and “byte-order”. The float class (IEEE floating point numbers) + * has these properties, plus “exponent bits”, “exponent sign”, etc. + * + * A datatype is derived from one datatype class: a given datatype has a specific value for the + * datatype properties defined by the class. For example, for 32-bit signed integers, stored + * big-endian, the HDF5 datatype is a sub-type of integer with the properties set to + * signed=1, size=4(bytes), and byte-order=BE. + * + * The HDF5 datatype API (H5T functions) provides methods to create datatypes of different + * datatype classes, to set the datatype properties of a new datatype, and to discover the datatype + * properties of an existing datatype. + * + * The datatype for a dataset is stored in the HDF5 file as part of the metadata for the dataset. + * A datatype can be shared by more than one dataset in the file if the datatype is saved to the + * file with a name. This shareable datatype is known as a committed datatype. In the past, + * this kind of datatype was called a named datatype. + * + * When transferring data (for example, a read or write), the data elements of the source and + * destination storage must have compatible types. As a general rule, data elements with the same + * datatype class are compatible while elements from different datatype classes are not compatible. + * When transferring data of one datatype to another compatible datatype, the HDF5 Library uses + * the datatype properties of the source and destination to automatically transform each data + * element. For example, when reading from data stored as 32-bit signed integers, big + * endian into 32-bit signed integers, little-endian, the HDF5 Library will automatically swap the + * bytes. + * + * Thus, data transfer operations (\ref H5Dread, \ref H5Dwrite, \ref H5Aread, \ref H5Awrite) require + * a datatype for both the source and the destination. + * + * + * + * + * + *
+ * \image html Dtypes_fig2.gif "The datatype model" + *
+ * + * The HDF5 library defines a set of predefined datatypes, corresponding to commonly used + * storage formats, such as twos complement integers, IEEE Floating point numbers, etc., 4- + * and 8-byte sizes, big-endian and little-endian byte orders. In addition, a user can derive types with + * custom values for the properties. For example, a user program may create a datatype to describe + * a 6-bit integer, or a 600-bit floating point number. + * + * In addition to atomic datatypes, the HDF5 library supports composite datatypes. A composite + * datatype is an aggregation of one or more datatypes. Each class of composite datatypes has + * properties that describe the organization of the composite datatype. See the figure below. + * Composite datatypes include: + * \li Compound datatypes: structured records + * \li Array: a multidimensional array of a datatype + * \li Variable-length: a one-dimensional array of a datatype + * + * + * + * + * + *
+ * \image html Dtypes_fig3.gif "Composite datatypes" + *
+ * + * \subsubsection subsubsec_datatype_model_class Datatype Classes and Properties + * The figure below shows the HDF5 datatype classes. Each class is defined to have a set of + * properties which describe the layout of the data element and the interpretation of the bits. The + * table below lists the properties for the datatype classes. + * + * + * + * + * + *
+ * \image html Dtypes_fig4.gif "Datatype classes" + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Datatype classes and their properties
+ * Class + * + * Description + * + * Properties + * + * Notes + *
+ * Integer + * + * Twos complement integers + * + * Size (bytes), precision (bits), offset (bits), pad, byte order, signed/unsigned + * + *
+ * Float + * + * Floating Point numbers + * + * Size (bytes), precision (bits), offset (bits), pad, byte order, sign position, + * exponent position, exponent size (bits), exponent sign, exponent bias, mantissa position, + * mantissa (size) bits, mantissa sign, mantissa normalization, internal padding + * + * See IEEE 754 for a definition of these properties. These properties describe + * non-IEEE 754 floating point formats as well. + *
+ * Character + * + * Array of 1-byte character encoding + * + * Size (characters), Character set, byte order, pad/no pad, pad character + * + * Currently, ASCII and UTF-8 are supported. + *
+ * Bitfield + * + * String of bits + * + * Size (bytes), precision (bits), offset (bits), pad, byte order + * + * A sequence of bit values packed into one or more bytes. + *
+ * Opaque + * + * Uninterpreted data + * + * Size (bytes), precision (bits), offset (bits), pad, byte order, tag + * + * A sequence of bytes, stored and retrieved as a block. + * The ‘tag’ is a string that can be used to label the value. + *
+ * Enumeration + * + * A list of discrete values, with symbolic names in the form of strings. + * + * Number of elements, element names, element values + * + * Enumeration is a list of pairs (name, value). The name is a string; the + * value is an unsigned integer. + *
+ * Reference + * + * Reference to object or region within the HDF5 file + * + * + * + * @see H5R + *
+ * Array + * + * Array (1-4 dimensions) of data elements + * + * Number of dimensions, dimension sizes, base datatype + * + * The array is accessed atomically: no selection or sub-setting. + *
+ * Variable-length + * + * A variable-length 1-dimensional array of data elements + * + * Current size, base type + * + * + *
+ * Compound + * + * A Datatype of a sequence of Datatypes + * + * Number of members, member names, member types, member offset, member class, + * member size, byte order + * + * + *
+ * + * \subsubsection subsubsec_datatype_model_predefine Predefined Datatypes + * The HDF5 library predefines a modest number of commonly used datatypes. These types have + * standard symbolic names of the form H5T_arch_base where arch is an architecture name and + * base is a programming type name Table 2. New types can be derived from the predefined + * types by copying the predefined type \ref H5Tcopy() and then modifying the result. + * + * The base name of most types consists of a letter to indicate the class Table 3, a precision in + * bits, and an indication of the byte order Table 4. + * + * Table 5 shows examples of predefined datatypes. The full list can be found in the + * \ref PDT section of the \ref RM. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 2. Architectures used in predefined datatypes
+ * Architecture Name + * + * Description + *
+ * IEEE + * + * IEEE-754 standard floating point types in various byte orders. + *
+ * STD + * + * This is an architecture that contains semi-standard datatypes like signed + * two's complement integers, unsigned integers, and bitfields in various + * byte orders. + *
+ * C
FORTRAN + *
+ * Types which are specific to the C or Fortran programming languages + * are defined in these architectures. For instance, #H5T_C_S1 defines a + * base string type with null termination which can be used to derive string + * types of other lengths. + *
+ * NATIVE + * + * This architecture contains C-like datatypes for the machine for which + * the library was compiled. In order to be portable, applications should + * almost always use this architecture to describe things in memory. + *
+ * CRAY + * + * Cray architectures. These are word-addressable, big-endian systems + * with non-IEEE floating point. + *
+ * INTEL + * + * All Intel and compatible CPUs. + * These are little-endian systems with IEEE floating-point. + *
+ * MIPS + * + * All MIPS CPUs commonly used in SGI systems. These are big-endian + * systems with IEEE floating-point. + *
+ * ALPHA + * + * All DEC Alpha CPUs, little-endian systems with IEEE floating-point. + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 3. Base types
+ * Base + * + * Description + *
+ * B + * + * Bitfield + *
+ * F + * + * Floating point + *
+ * I + * + * Signed integer + *
+ * R + * + * References + *
+ * S + * + * Character string + *
+ * U + * + * Unsigned integer + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 4. Byte order
+ * Order + * + * Description + *
+ * BE + * + * Big-endian + *
+ * LE + * + * Little-endian + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 5. Some predefined datatypes
+ * Example + * + * Description + *
+ * #H5T_IEEE_F64LE + * + * Eight-byte, little-endian, IEEE floating-point + *
+ * #H5T_IEEE_F32BE + * + * Four-byte, big-endian, IEEE floating point + *
+ * #H5T_STD_I32LE + * + * Four-byte, little-endian, signed two's complement integer + *
+ * #H5T_STD_U16BE + * + * Two-byte, big-endian, unsigned integer + *
+ * #H5T_C_S1 + * + * One-byte,null-terminated string of eight-bit characters + *
+ * #H5T_INTEL_B64 + * + * Eight-byte bit field on an Intel CPU + *
+ * #H5T_STD_REF_OBJ + * + * Reference to an entire object in a file + *
+ * + * The HDF5 library predefines a set of \Emph{NATIVE} datatypes which are similar to C type names. + * The native types are set to be an alias for the appropriate HDF5 datatype for each platform. For + * example, #H5T_NATIVE_INT corresponds to a C int type. On an Intel based PC, this type is the same as + * #H5T_STD_I32LE, while on a MIPS system this would be equivalent to #H5T_STD_I32BE. Table 6 shows + * examples of \Emph{NATIVE} types and corresponding C types for a common 32-bit workstation. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 6. Native and 32-bit C datatypes
+ * Example + * + * Corresponding C Type + *
+ * #H5T_NATIVE_CHAR + * + * char + *
+ * #H5T_NATIVE_SCHAR + * + * signed char + *
+ * #H5T_NATIVE_UCHAR + * + * unsigned char + *
+ * #H5T_NATIVE_SHORT + * + * short + *
+ * #H5T_NATIVE_USHORT + * + * unsigned short + *
+ * #H5T_NATIVE_INT + * + * int + *
+ * #H5T_NATIVE_UINT + * + * unsigned + *
+ * #H5T_NATIVE_LONG + * + * long + *
+ * #H5T_NATIVE_ULONG + * + * unsigned long + *
+ * #H5T_NATIVE_LLONG + * + * long long + *
+ * #H5T_NATIVE_ULLONG + * + * unsigned long long + *
+ * #H5T_NATIVE_FLOAT + * + * float + *
+ * #H5T_NATIVE_DOUBLE + * + * double + *
+ * #H5T_NATIVE_LDOUBLE + * + * long double + *
+ * #H5T_NATIVE_HSIZE + * + * hsize_t + *
+ * #H5T_NATIVE_HSSIZE + * + * hssize_t + *
+ * #H5T_NATIVE_HERR + * + * herr_t + *
+ * #H5T_NATIVE_HBOOL + * + * hbool_t + *
+ * #H5T_NATIVE_B8 + * + * 8-bit unsigned integer or 8-bit buffer in memory + *
+ * #H5T_NATIVE_B16 + * + * 16-bit unsigned integer or 16-bit buffer in memory + *
+ * #H5T_NATIVE_B32 + * + * 32-bit unsigned integer or 32-bit buffer in memory + *
+ * #H5T_NATIVE_B64 + * + * 64-bit unsigned integer or 64-bit buffer in memory + *
+ * + * \subsection subsec_datatype_usage How Datatypes are Used + * + * \subsubsection subsubsec_datatype_usage_object The Datatype Object and the HDF5 Datatype API + * The HDF5 library manages datatypes as objects. The HDF5 datatype API manipulates the + * datatype objects through C function calls. New datatypes can be created from scratch or + * copied from existing datatypes. When a datatype is no longer needed its resources should be released by + * calling \ref H5Tclose(). + * + * The datatype object is used in several roles in the HDF5 data model and library. Essentially, a + * datatype is used whenever the form at of data elements is needed. There are four major uses of + * datatypes in the HDF5 library: at dataset creation, during data transfers, when discovering the + * contents of a file, and for specifying user-defined datatypes. See the table below. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 7. Datatype uses
+ * Use + * + * Description + *
+ * Dataset creation + * + * The datatype of the data elements must be declared when the dataset is created. + *
+ * Dataset transfer + * + * The datatype (format) of the data elements must be defined for both the source and destination. + *
+ * Discovery + * + * The datatype of a dataset can be interrogated to retrieve a complete description of the storage layout. + *
+ * Creating user-defined datatypes + * + * Users can define their own datatypes by creating datatype objects and setting their properties. + *
+ * + * \subsubsection subsubsec_datatype_usage_create Dataset Creation + * All the data elements of a dataset have the same datatype. When a dataset is created, the datatype + * for the data elements must be specified. The datatype of a dataset can never be changed. The + * example below shows the use of a datatype to create a dataset called “/dset”. In this example, the + * dataset will be stored as 32-bit signed integers in big-endian order. + * + * Using a datatype to create a dataset + * \code + * hid_t dt; + * + * dt = H5Tcopy(H5T_STD_I32BE); + * dataset_id = H5Dcreate(file_id, “/dset”, dt, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * + * \subsubsection subsubsec_datatype_usage_transfer Data Transfer (Read and Write) + * Probably the most common use of datatypes is to write or read data from a dataset or attribute. In + * these operations, each data element is transferred from the source to the destination (possibly + * rearranging the order of the elements). Since the source and destination do not need to be + * identical (in other words, one is disk and the other is memory), the transfer requires + * both the format of the source element and the destination element. Therefore, data transfers use two + * datatype objects, for the source and destination. + * + * When data is written, the source is memory and the destination is disk (file). The memory + * datatype describes the format of the data element in the machine memory, and the file datatype + * describes the desired format of the data element on disk. Similarly, when reading, the source + * datatype describes the format of the data element on disk, and the destination datatype describes + * the format in memory. + * + * In the most common cases, the file datatype is the datatype specified when + * the dataset was + * created, and the memory datatype should be the appropriate \Emph{NATIVE} type. + * The examples below show samples of writing data to and reading data from a dataset. The data + * in memory is declared C type ‘int’, and the datatype #H5T_NATIVE_INT corresponds to this + * type. The datatype of the dataset should be of datatype class #H5T_INTEGER. + * + * Writing to a dataset + * \code + * int dset_data[DATA_SIZE]; + * + * status = H5Dwrite(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); + * \endcode + * + * Reading from a dataset + * \code + * int dset_data[DATA_SIZE]; + * + * status = H5Dread(dataset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset_data); + * \endcode + * + * \subsubsection subsubsec_datatype_usage_discover Discovery of Data Format + * The HDF5 Library enables a program to + * determine the datatype class and properties for any + * datatype. In order to discover the storage format of data in a dataset, the datatype is obtained, and + * the properties are determined by queries to the datatype object. The example below shows code + * that analyzes the datatype for an integer and prints out a description of its storage properties + * (byte order, signed, size). + * + * Discovering datatype properties + * \code + * switch (H5Tget_class(type)) { + * case H5T_INTEGER: + * ord = H5Tget_order(type); + * sgn = H5Tget_sign(type); + * printf(“Integer ByteOrder= ”); + * switch (ord) { + * case H5T_ORDER_LE: + * printf(“LE”); + * break; + * case H5T_ORDER_BE: + * printf(“BE”); + * break; + * } + * printf(“ Sign= ”); + * switch (sgn) { + * case H5T_SGN_NONE: + * printf(“false”); + * break; + * case H5T_SGN_2: + * printf(“true”); + * break; + * } + * printf(“ Size= ”); + * sz = H5Tget_size(type); + * printf(“%d”, sz); + * printf(“\n”); + * break; + * case H5T_???? + * ... + * break; + * } + * \endcode + * + * \subsubsection subsubsec_datatype_usage_user Creating and Using User‐defined Datatypes + * Most programs will primarily use the predefined datatypes described above, possibly in + * composite data types such as compound or array datatypes. However, the HDF5 datatype model + * is extremely general; a user program can define a great variety of atomic datatypes (storage + * layouts). In particular, the datatype properties can define signed and unsigned integers of any + * size and byte order, and floating point numbers with different formats, size, and byte order. The + * HDF5 datatype API provides methods to set these properties. + * + * User-defined types can be used to define the layout of data in memory; examples might match + * some platform specific number format or application defined bit-field. The user-defined type can + * also describe data in the file such as an application-defined format. The user-defined types can be + * translated to and from standard types of the same class, as described above. + * + * \subsection subsec_datatype_function Datatype Function Summaries + * @see H5T reference manual provides a reference list of datatype functions, the H5T APIs. + * + * \subsection subsec_datatype_program Programming Model for Datatypes + * The HDF5 Library implements an object-oriented model of datatypes. HDF5 datatypes are + * organized as a logical set of base types, or datatype classes. The HDF5 Library manages + * datatypes as objects. The HDF5 datatype API manipulates the datatype objects through C + * function calls. The figure below shows the abstract view of the datatype object. The table below + * shows the methods (C functions) that operate on datatype objects. New datatypes can be created + * from scratch or copied from existing datatypes. + * + * + * + * + * + *
+ * \image html Dtypes_fig5.gif "The datatype object" + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 8. General operations on datatype objects
+ * API Function + * + * Description + *
+ * \ref hid_t \ref H5Tcreate (\ref H5T_class_t class, size_t size) + * + * Create a new datatype object of datatype class . The following datatype classes care supported + * with this function: + * \li #H5T_COMPOUND + * \li #H5T_OPAQUE + * \li #H5T_ENUM + * \li Other datatypes are created with \ref H5Tcopy(). + *
+ * \ref hid_t \ref H5Tcopy (\ref hid_t type) + * + * Obtain a modifiable transient datatype which is a copy of type. If type is a dataset identifier + * then the type returned is a modifiable transient copy of the datatype of the specified dataset. + *
+ * \ref hid_t \ref H5Topen (\ref hid_t location, const char *name, #H5P_DEFAULT) + * + * Open a committed datatype. The committed datatype returned by this function is read-only. + *
+ * \ref htri_t \ref H5Tequal (\ref hid_t type1, \ref hid_t type2) + * + * Determines if two types are equal. + *
+ * \ref herr_t \ref H5Tclose (\ref hid_t type) + * + * Releases resources associated with a datatype obtained from \ref H5Tcopy, \ref H5Topen, or + * \ref H5Tcreate. It is illegal to close an immutable transient datatype (for example, predefined types). + *
+ * \ref herr_t \ref H5Tcommit (\ref hid_t location, const char *name, hid_t type, + * #H5P_DEFAULT, #H5P_DEFAULT, #H5P_DEFAULT) + * + * Commit a transient datatype (not immutable) to a file to become a committed datatype. Committed + * datatypes can be shared. + *
+ * \ref htri_t \ref H5Tcommitted (\ref hid_t type) + * + * Test whether the datatype is transient or committed (named). + *
+ * \ref herr_t \ref H5Tlock (\ref hid_t type) + * + * Make a transient datatype immutable (read-only and not closable). Predefined types are locked. + *
+ * + * In order to use a datatype, the object must be created (\ref H5Tcreate), or a reference obtained by + * cloning from an existing type (\ref H5Tcopy), or opened (\ref H5Topen). In addition, a reference to the + * datatype of a dataset or attribute can be obtained with \ref H5Dget_type or \ref H5Aget_type. For + * composite datatypes a reference to the datatype for members or base types can be obtained + * (\ref H5Tget_member_type, \ref H5Tget_super). When the datatype object is no longer needed, the + * reference is discarded with \ref H5Tclose. + * + * Two datatype objects can be tested to see if they are the same with \ref H5Tequal. This function + * returns true if the two datatype references refer to the same datatype object. However, if two + * datatype objects define equivalent datatypes (the same datatype class and datatype properties), + * they will not be considered ‘equal’. + * + * A datatype can be written to the file as a first class object (\ref H5Tcommit). This is a committed + * datatype and can be used in thesame way as any other datatype. + * + * \subsubsection subsubsec_datatype_program_discover Discovery of Datatype Properties + * Any HDF5 datatype object can be queried to discover all of its datatype properties. For each + * datatype class, there are a set of API functions to retrieve the datatype properties for this class. + * + *

Properties of Atomic Datatypes

+ * Table 9 lists the functions to discover the properties of atomic datatypes. Table 10 lists the + * queries relevant to specific numeric types. Table 11 gives the properties for atomic string + * datatype, and Table 12 gives the property of the opaque datatype. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 9. Functions to discover properties of atomic datatypes
+ * API Function + * + * Description + *
+ * \ref H5T_class_t \ref H5Tget_class (\ref hid_t type) + * + * The datatype class: #H5T_INTEGER, #H5T_FLOAT, #H5T_STRING, #H5T_BITFIELD, #H5T_OPAQUE, #H5T_COMPOUND, + * #H5T_REFERENCE, #H5T_ENUM, #H5T_VLEN, #H5T_ARRAY + *
+ * size_t \ref H5Tget_size (\ref hid_t type) + * + * The total size of the element in bytes, including padding which may appear on either side of the + * actual value. + *
+ * \ref H5T_order_t \ref H5Tget_order (\ref hid_t type) + * + * The byte order describes how the bytes of the datatype are laid out in memory. If the lowest memory + * address contains the least significant byte of the datum then it is said to be little-endian or + * #H5T_ORDER_LE. If the bytes are in the opposite order then they are said to be big-endianor #H5T_ORDER_BE. + *
+ * size_t \ref H5Tget_precision (\ref hid_t type) + * + * The precision property identifies the number of significant bits of a datatype and the offset property + * (defined below) identifies its location. Some datatypes occupy more bytes than what is needed to store + * the value. For instance, a short on a Cray is 32 significant bits in an eight-byte field. + *
+ * int \ref H5Tget_offset (\ref hid_t type) + * + * The offset property defines the bit location of the least significant bit of a bit field whose length + * is precision. + *
+ * \ref herr_t \ref H5Tget_pad (\ref hid_t type, \ref H5T_pad_t *lsb, \ref H5T_pad_t *msb) + * + * Padding is the bits of a data element which are not significant as defined by the precision and offset + * properties. Padding in the low-numbered bits is lsb padding and padding in the high-numbered bits is msb + * padding. Padding bits can be set to zero (#H5T_PAD_ZERO) or one (#H5T_PAD_ONE). + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 10. Functions to discover properties of atomic datatypes
+ * API Function + * + * Description + *
+ * \ref H5T_sign_t \ref H5Tget_sign (\ref hid_t type) + * + * (INTEGER)Integer data can be signed two's complement (#H5T_SGN_2) or unsigned (#H5T_SGN_NONE). + *
+ * \ref herr_t \ref H5Tget_fields (\ref hid_t type, size_t *spos, size_t *epos, size_t *esize, + * size_t*mpos, size_t *msize) + * + * (FLOAT)A floating-point data element has bit fields which are the exponent and mantissa as well as a + * mantissa sign bit. These properties define the location (bit position of least significant bit of the + * field) and size (in bits) of each field. The sign bit is always of length one and none of the fields + * are allowed to overlap. + *
+ * size_t \ref H5Tget_ebias (\ref hid_t type) + * + * (FLOAT)A floating-point data element has bit fields which are the exponent and + * mantissa as well as a mantissa sign bit. These properties define the location (bit + * position of least significant bit of the field) and size (in bits) of + * each field. The sign bit is always of length one and none of the + * fields are allowed to overlap. + *
+ * \ref H5T_norm_t \ref H5Tget_norm (\ref hid_t type) + * + * (FLOAT)This property describes the normalization method of the mantissa. + *
  • #H5T_NORM_MSBSET: the mantissa is shifted left (if non-zero) until the first bit + * after the radix point is set and the exponent is adjusted accordingly. All bits of the + * mantissa after the radix point are stored.
  • + *
  • #H5T_NORM_IMPLIED: the mantissa is shifted left \(if non-zero) until the first + * bit after the radix point is set and the exponent is adjusted accordingly. The first + * bit after the radix point is not stored since it's always set.
  • + *
  • #H5T_NORM_NONE: the fractional part of the mantissa is stored without normalizing it.
+ *
+ * \ref H5T_pad_t \ref H5Tget_inpad (\ref hid_t type) + * + * (FLOAT)If any internal bits (that is, bits between the sign bit, the mantissa field, + * and the exponent field but within the precision field) are unused, then they will be + * filled according to the value of this property. The padding can be: + * #H5T_PAD_BACKGROUND, #H5T_PAD_ZERO,or #H5T_PAD_ONE. + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 11. Functions to discover properties of atomic string datatypes
+ * API Function + * + * Description + *
+ * \ref H5T_cset_t \ref H5Tget_cset (\ref hid_t type) + * + * Two character sets are currently supported: + * ASCII (#H5T_CSET_ASCII) and UTF-8 (#H5T_CSET_UTF8). + *
+ * \ref H5T_str_t \ref H5Tget_strpad (\ref hid_t type) + * + * The string datatype has a fixed length, but the string may be shorter than the length. + * This property defines the storage mechanism for the left over bytes. The options are: + * \li #H5T_STR_NULLTERM + * \li #H5T_STR_NULLPAD + * \li #H5T_STR_SPACEPAD. + *
+ * + * + * + * + * + * + * + * + * + * + * + *
Table 12. Functions to discover properties of atomic opaque datatypes
+ * API Function + * + * Description + *
+ * char* \ref H5Tget_tag(\ref hid_t type_id) + * + * A user-defined string. + *
+ * + *

Properties of Composite Datatypes

+ * The composite datatype classes can also be analyzed to discover their datatype properties and the + * datatypes that are members or base types of the composite datatype. The member or base type + * can, in turn, be analyzed. The table below lists the functions that can access the datatype + * properties of the different composite datatypes. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 13. Functions to discover properties of composite datatypes
+ * API Function + * + * Description + *
+ * int \ref H5Tget_nmembers(\ref hid_t type_id) + * + * (COMPOUND)The number of fields in the compound datatype. + *
+ * \ref H5T_class_t \ref H5Tget_member_class (\ref hid_t cdtype_id, unsigned member_no) + * + * (COMPOUND)The datatype class of compound datatype member member_no. + *
+ * char* \ref H5Tget_member_name (\ref hid_t type_id, unsigned field_idx) + * + * (COMPOUND)The name of field field_idx of a compound datatype. + *
+ * size_t \ref H5Tget_member_offset (\ref hid_t type_id, unsigned memb_no) + * + * (COMPOUND)The byte offset of the beginning of a field within a compound datatype. + *
+ * \ref hid_t \ref H5Tget_member_type (\ref hid_t type_id, unsigned field_idx) + * + * (COMPOUND)The datatype of the specified member. + *
+ * int \ref H5Tget_array_ndims (\ref hid_t adtype_id) + * + * (ARRAY)The number of dimensions (rank) of the array datatype object. + *
+ * int \ref H5Tget_array_dims (\ref hid_t adtype_id, hsize_t *dims[]) + * + * (ARRAY)The sizes of the dimensions and the dimension permutations of the array datatype object. + *
+ * \ref hid_t \ref H5Tget_super(\ref hid_t type) + * + * (ARRAY, VL, ENUM)The base datatype from which the datatype type is derived. + *
+ * \ref herr_t \ref H5Tenum_nameof(\ref hid_t type, const void *value, char *name, size_t size) + * + * (ENUM)The symbol name that corresponds to the specified value of the enumeration datatype. + *
+ * \ref herr_t \ref H5Tenum_valueof(\ref hid_t type, const char *name, void *value) + * + * (ENUM)The value that corresponds to the specified name of the enumeration datatype. + *
+ * \ref herr_t \ref H5Tget_member_value (\ref hid_t type unsigned memb_no, void *value) + * + * (ENUM)The value of the enumeration datatype member memb_no. + *
+ * + * \subsubsection subsubsec_datatype_program_define Definition of Datatypes + * The HDF5 library enables user programs to create and modify datatypes. The essential steps are: + *
  • 1. Create a new datatype object of a specific composite datatype class, or copy an existing + * atomic datatype object
  • + *
  • 2. Set properties of the datatype object
  • + *
  • 3. Use the datatype object
  • + *
  • 4. Close the datatype object
+ * + * To create a user-defined atomic datatype, the procedure is to clone a predefined datatype of the + * appropriate datatype class (\ref H5Tcopy), and then set the datatype properties appropriate to the + * datatype class. The table below shows how to create a datatype to describe a 1024-bit unsigned + * integer. + * + * Create a new datatype + * \code + * hid_t new_type = H5Tcopy (H5T_NATIVE_INT); + * + * H5Tset_precision(new_type, 1024); + * H5Tset_sign(new_type, H5T_SGN_NONE); + * \endcode + * + * Composite datatypes are created with a specific API call for each datatype class. The table below + * shows the creation method for each datatype class. A newly created datatype cannot be used until the + * datatype properties are set. For example, a newly created compound datatype has no members and cannot + * be used. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 14. Functions to create each datatype class
+ * Datatype Class + * + * Function to Create + *
+ * COMPOUND + * + * #H5Tcreate + *
+ * OPAQUE + * + * #H5Tcreate + *
+ * ENUM + * + * #H5Tenum_create + *
+ * ARRAY + * + * #H5Tarray_create + *
+ * VL + * + * #H5Tvlen_create + *
+ * + * Once the datatype is created and the datatype properties set, the datatype object can be used. + * + * Predefined datatypes are defined by the library during initialization using the same mechanisms + * as described here. Each predefined datatype is locked (\ref H5Tlock), so that it cannot be changed or + * destroyed. User-defined datatypes may also be locked using \ref H5Tlock. + * + *

User-defined Atomic Datatypes

+ * Table 15 summarizes the API methods that set properties of atomic types. Table 16 shows + * properties specific to numeric types, Table 17 shows properties specific to the string datatype + * class. Note that offset, pad, etc. do not apply to strings. Table 18 shows the specific property of + * the OPAQUE datatype class. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 15. API methods that set properties of atomic datatypes
+ * Functions + * + * Description + *
+ * \ref herr_t \ref H5Tset_size (\ref hid_t type, size_t size) + * + * Set the total size of the element in bytes. This includes padding which may appear on either + * side of the actual value. If this property is reset to a smaller value which would cause the + * significant part of the data to extend beyond the edge of the datatype, then the offset property + * is decremented a bit at a time. If the offset reaches zero and the significant part of the data + * still extends beyond the edge of the datatype then the precision property is decremented a bit at + * a time. Decreasing the size of a datatype may fail if the #H5T_FLOAT bit fields would extend beyond + * the significant part of the type. + *
+ * \ref herr_t \ref H5Tset_order (\ref hid_t type, \ref H5T_order_t order) + * + * Set the byte order to little-endian (#H5T_ORDER_LE) or big-endian (#H5T_ORDER_BE). + *
+ * \ref herr_t \ref H5Tset_precision (\ref hid_t type, size_t precision) + * + * Set the number of significant bits of a datatype. The offset property (defined below) identifies + * its location. The size property defined above represents the entire size (in bytes) of the datatype. + * If the precision is decreased then padding bits are inserted on the MSB side of the significant + * bits (this will fail for #H5T_FLOAT types if it results in the sign,mantissa, or exponent bit field + * extending beyond the edge of the significant bit field). On the other hand, if the precision is + * increased so that it “hangs over” the edge of the total size then the offset property is decremented + * a bit at a time. If the offset reaches zero and the significant bits still hang over the edge, then + * the total size is increased a byte at a time. + *
+ * \ref herr_t \ref H5Tset_offset (\ref hid_t type, size_t offset) + * + * Set the bit location of the least significant bit of a bit field whose length is precision. The + * bits of the entire data are numbered beginning at zero at the least significant bit of the least + * significant byte (the byte at the lowest memory address for a little-endian type or the byte at + * the highest address for a big-endian type). The offset property defines the bit location of the + * least significant bit of a bit field whose length is precision. If the offset is increased so the + * significant bits “hang over” the edge of the datum, then the size property is automatically incremented. + *
+ * \ref herr_t \ref H5Tset_pad (\ref hid_t type, \ref H5T_pad_t lsb, \ref H5T_pad_t msb) + * + * Set the padding to zeros (#H5T_PAD_ZERO) or ones (#H5T_PAD_ONE). Padding is the bits of a + * data element which are not significant as defined by the precision and offset properties. Padding + * in the low-numbered bits is lsb padding and padding in the high-numbered bits is msb padding. + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 16. API methods that set properties of numeric datatypes
+ * Functions + * + * Description + *
+ * \ref herr_t \ref H5Tset_sign (\ref hid_t type, \ref H5T_sign_t sign) + * + * (INTEGER)Integer data can be signed two's complement (#H5T_SGN_2) or unsigned (#H5T_SGN_NONE). + *
+ * \ref herr_t \ref H5Tset_fields (\ref hid_t type, size_t spos, size_t epos, size_t esize, + * size_t mpos, size_t msize) + * + * (FLOAT)Set the properties define the location (bit position of least significant bit of the field) + * and size (in bits) of each field. The sign bit is always of length one and none of the fields are + * allowed to overlap. + *
+ * \ref herr_t \ref H5Tset_ebias (\ref hid_t type, size_t ebias) + * + * (FLOAT)The exponent is stored as a non-negative value which is ebias larger than the true exponent. + *
+ * \ref herr_t \ref H5Tset_norm (\ref hid_t type, \ref H5T_norm_t norm) + * + * (FLOAT)This property describes the normalization method of the mantissa. + *
  • #H5T_NORM_MSBSET: the mantissa is shifted left (if non-zero) until the first bit + * after theradix point is set and the exponent is adjusted accordingly. All bits of the + * mantissa after the radix point are stored.
  • + *
  • #H5T_NORM_IMPLIED: the mantissa is shifted left (if non-zero) until the first bit + * after the radix point is set and the exponent is adjusted accordingly. The first bit after + * the radix point is not stored since it is always set.
  • + *
  • #H5T_NORM_NONE: the fractional part of the mantissa is stored without normalizing it.
+ *
+ * \ref herr_t \ref H5Tset_inpad (\ref hid_t type, \ref H5T_pad_t inpad) + * + * (FLOAT) +If any internal bits (that is, bits between the sign bit, the mantissa field, +and the exponent field but within the precision field) are unused, then they will be +filled according to the value of this property. The padding can be: + * \li #H5T_PAD_BACKGROUND + * \li #H5T_PAD_ZERO + * \li #H5T_PAD_ONE + *
+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 17. API methods that set properties of string datatypes
+ * Functions + * + * Description + *
+ * \ref herr_t \ref H5Tset_size (\ref hid_t type, size_t size) + * + * Set the length of the string, in bytes. The precision is automatically set to 8*size. + *
+ * \ref herr_t \ref H5Tset_precision (\ref hid_t type, size_t precision) + * + * The precision must be a multiple of 8. + *
+ * \ref herr_t \ref H5Tset_cset (\ref hid_t type_id, \ref H5T_cset_t cset) + * + * Two character sets are currently supported: + * \li ASCII (#H5T_CSET_ASCII) + * \li UTF-8 (#H5T_CSET_UTF8). + *
+ * \ref herr_t \ref H5Tset_strpad (\ref hid_t type_id, H5T_str_t strpad) + * + * The string datatype has a fixed length, but the string may be shorter than the length. This + * property defines the storage mechanism for the left over bytes. The method used to store + * character strings differs with the programming language: + * \li C usually null terminates strings + * \li Fortran left-justifies and space-pads strings + * + * Valid string padding values, as passed in the parameter strpad, are as follows: + * \li #H5T_STR_NULLTERM: Null terminate (as C does) + * \li #H5T_STR_NULLPAD: Pad with zeros + * \li #H5T_STR_SPACEPAD: Pad with spaces (as FORTRAN does) + *
+ * + * + * + * + * + * + * + * + * + * + * + *
Table 18. API methods that set properties of opaque datatypes
+ * Functions + * + * Description + *
+ * \ref herr_t \ref H5Tset_tag (\ref hid_t type_id, const char *tag) + * + * Tags the opaque datatype type_id with an ASCII identifier tag. + *
+ * + *

Examples

+ * The example below shows how to create a 128-bit little-endian signed integer type. Increasing + * the precision of a type automatically increases the total size. Note that the proper + * procedure is to begin from a type of the intended datatype class which in this case is a + * NATIVE INT. + * + * Create a new 128-bit little-endian signed integer datatype + * \code + * hid_t new_type = H5Tcopy (H5T_NATIVE_INT); + * H5Tset_precision (new_type, 128); + * H5Tset_order (new_type, H5T_ORDER_LE); + * \endcode + * + * The figure below shows the storage layout as the type is defined. The \ref H5Tcopy creates a + * datatype that is the same as #H5T_NATIVE_INT. In this example, suppose this is a 32-bit + * big-endian number (Figure a). The precision is set to 128 bits, which automatically extends + * the size to 8 bytes (Figure b). Finally, the byte order is set to little-endian (Figure c). + * + * + * + * + * + *
+ * \image html Dtypes_fig6.gif "The storage layout for a new 128-bit little-endian signed integer datatype" + *
+ * + * The significant bits of a data element can be offset from the beginning of the memory for that + * element by an amount of padding. The offset property specifies the number of bits of padding + * that appear to the “right of” the value. The table and figure below show how a 32-bit unsigned + * integer with 16-bits of precision having the value 0x1122 will be laid out in memory. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Table 19. Memory Layout for a 32-bit unsigned integer
+ * Byte Position + * + * Big-Endian
Offset=0 + *
+ * Big-Endian
Offset=16 + *
+ * Little-Endian
Offset=0 + *
+ * Little-Endian
Offset=16 + *
+ * 0: + * + * [pad] + * + * [0x11] + * + * [0x22] + * + * [pad] + *
+ * 1: + * + * [pad] + * + * [0x22] + * + * [0x11] + * + * [pad] + *
+ * 2: + * + * [0x11] + * + * [pad] + * + * [pad] + * + * [0x22] + *
+ * 3: + * + * [0x22] + * + * [pad] + * + * [pad] + * + * [0x11] + *
+ * + * + * + * + * + *
+ * \image html Dtypes_fig7.gif "Memory Layout for a 32-bit unsigned integer" + *
+ * + * If the offset is incremented then the total size is incremented also if necessary to prevent + * significant bits of the value from hanging over the edge of the datatype. + * + * The bits of the entire data are numbered beginning at zero at the least significant bit of the least + * significant byte (the byte at the lowest memory address for a little-endian type or the byte at the + * highest address for a big-endian type). The offset property defines the bit location of the least + * significant bit of a bit field whose length is precision. If the offset is increased so the significant + * bits “hang over” the edge of the datum, then the size property is automatically incremented. + * + * To illustrate the properties of the integer datatype class, the example below shows how to create + * a user-defined datatype that describes a 24-bit signed integer that starts on the third bit of a 32-bit + * word. The datatype is specialized from a 32-bit integer, the precision is set to 24 bits, and the + * offset is set to 3. + * + * A user-defined datatype with a 24-bit signed integer + * \code + * hid_t dt; + * + * dt = H5Tcopy(H5T_SDT_I32LE); + * H5Tset_precision(dt, 24); + * H5Tset_offset(dt,3); + * H5Tset_pad(dt, H5T_PAD_ZERO, H5T_PAD_ONE); + * \endcode + * + * The figure below shows the storage layout for a data element. Note that the unused bits in the + * offset will be set to zero and the unused bits at the end will be set to one, as specified in the + * \ref H5Tset_pad call. + * + * + * + * + *
+ * \image html Dtypes_fig8.gif "A user-defined integer datatype with a range of -1,048,583 to 1,048,584" + *
+ * + * To illustrate a user-defined floating point number, the example below shows how to create a 24-bit + * floating point number that starts 5 bits into a 4 byte word. The floating point number is defined to + * have a mantissa of 19 bits (bits 5-23), an exponent of 3 bits (25-27), and the sign bit is bit 28. + * (Note that this is an illustration of what can be done and is not necessarily a floating point + * format that a user would require.) + * + * A user-defined datatype with a 24-bit floating point datatype + * \code + * hid_t dt; + * + * dt = H5Tcopy(H5T_SDT_F32LE); + * H5Tset_precision(dt, 24); + * H5Tset_fields (dt, 28, 25, 3, 5, 19); + * H5Tset_pad(dt, H5T_PAD_ZERO, H5T_PAD_ONE); + * H5Tset_inpad(dt, H5T_PAD_ZERO); + * \endcode + * + * + * + * + * + *
+ * \image html Dtypes_fig9.gif "A user-defined floating point datatype" + *
+ * The figure above shows the storage layout of a data element for this datatype. Note that there is + * an unused bit (24) between the mantissa and the exponent. This bit is filled with the inpad value + * which in this case is 0. + * + * The sign bit is always of length one and none of the fields are allowed to overlap. When + * expanding a floating-point type one should set the precision first; when decreasing the size one + * should set the field positions and sizes first. + * + *

Composite Datatypes

+ * All composite datatypes must be user-defined; there are no predefined composite datatypes. + * + *

Compound Datatypes

+ * The subsections below describe how to create a compound datatype and how to write and read + * data of a compound datatype. + * + *

Defining Compound Datatypes

+ * + * Compound datatypes are conceptually similar to a C struct or Fortran derived types. The + * compound datatype defines a contiguous sequence of bytes, which are formatted using one up to + * 2^16 datatypes (members). A compound datatype may have any number of members, in any + * order, and the members may have any datatype, including compound. Thus, complex nested + * compound datatypes can be created. The total size of the compound datatype is greater than or + * equal to the sum of the size of its members, up to a maximum of 2^32 bytes. HDF5 does not + * support datatypes with distinguished records or the equivalent of C unions or Fortran + * EQUIVALENCE statements. + * + * Usually a C struct or Fortran derived type will be defined to hold a data point in memory, and the + * offsets of the members in memory will be the offsets of the struct members from the beginning + * of an instance of the struct. The HDF5 C library provides a macro #HOFFSET (s,m)to calculate + * the member's offset. The HDF5 Fortran applications have to calculate offsets by using sizes of + * members datatypes and by taking in consideration the order of members in the Fortran derived type. + * \code + * HOFFSET(s,m) + * \endcode + * This macro computes the offset of member m within a struct s + * \code + * offsetof(s,m) + * \endcode + * This macro defined in stddef.h does exactly the same thing as the HOFFSET()macro. + * + * Note for Fortran users: Offsets of Fortran structure members correspond to the offsets within a + * packed datatype (see explanation below) stored in an HDF5 file. + * + * Each member of a compound datatype must have a descriptive name which is the key used to + * uniquely identify the member within the compound datatype. A member name in an HDF5 + * datatype does not necessarily have to be the same as the name of the member in the C struct or + * Fortran derived type, although this is often the case. Nor does one need to define all members of + * the C struct or Fortran derived type in the HDF5 compound datatype (or vice versa). + * + * Unlike atomic datatypes which are derived from other atomic datatypes, compound datatypes are + * created from scratch. First, one creates an empty compound datatype and specifies its total size. + * Then members are added to the compound datatype in any order. Each member type is inserted + * at a designated offset. Each member has a name which is the key used to uniquely identify the + * member within the compound datatype. + * + * The example below shows a way of creating an HDF5 C compound datatype to describe a + * complex number. This is a structure with two components, “real” and “imaginary”, and each + * component is a double. An equivalent C struct whose type is defined by the complex_tstruct is + * shown. + * + * A compound datatype for complex numbers in C + * \code + * typedef struct { + * double re; //real part + * double im; //imaginary part + * } complex_t; + * + * hid_t complex_id = H5Tcreate (H5T_COMPOUND, sizeof (complex_t)); + * H5Tinsert (complex_id, “real”, HOFFSET(complex_t,re), + * H5T_NATIVE_DOUBLE); + * H5Tinsert (complex_id, “imaginary”, HOFFSET(complex_t,im), + * H5T_NATIVE_DOUBLE); + * \endcode + * + * The example below shows a way of creating an HDF5 Fortran compound datatype to describe a + * complex number. This is a Fortran derived type with two components, “real” and “imaginary”, + * and each component is DOUBLE PRECISION. An equivalent Fortran TYPE whose type is defined + * by the TYPE complex_t is shown. + * + * A compound datatype for complex numbers in Fortran + * \code + * TYPE complex_t + * DOUBLE PRECISION re ! real part + * DOUBLE PRECISION im; ! imaginary part + * END TYPE complex_t + * + * CALL h5tget_size_f(H5T_NATIVE_DOUBLE, re_size, error) + * CALL h5tget_size_f(H5T_NATIVE_DOUBLE, im_size, error) + * complex_t_size = re_size + im_size + * CALL h5tcreate_f(H5T_COMPOUND_F, complex_t_size, type_id) + * offset = 0 + * CALL h5tinsert_f(type_id, “real”, offset, H5T_NATIVE_DOUBLE, error) + * offset = offset + re_size + * CALL h5tinsert_f(type_id, “imaginary”, offset, H5T_NATIVE_DOUBLE, error) + * \endcode + * + * Important Note: The compound datatype is created with a size sufficient to hold all its members. + * In the C example above, the size of the C struct and the #HOFFSET macro are used as a + * convenient mechanism to determine the appropriate size and offset. Alternatively, the size and + * offset could be manually determined: the size can be set to 16 with “real” at offset 0 and + * “imaginary” at offset 8. However, different platforms and compilers have different sizes for + * “double” and may have alignment restrictions which require additional padding within the + * structure. It is much more portable to use the #HOFFSET macro which assures that the values will + * be correct for any platform. + * + * The figure below shows how the compound datatype would be laid out assuming that + * NATIVE_DOUBLE are 64-bit numbers and that there are no alignment requirements. The total + * size of the compound datatype will be 16 bytes, the “real” component will start at byte 0, and + * “imaginary” will start at byte 8. + * + * + * + * + * + *
+ * \image html Dtypes_fig10.gif "Layout of a compound datatype" + *
+ * + * The members of a compound datatype may be any HDF5 datatype including the compound, + * array, and variable-length (VL) types. The figure and example below show the memory layout + * and code which creates a compound datatype composed of two complex values, and each + * complex value is also a compound datatype as in the figure above. + * + * + * + * + * + *
+ * \image html Dtypes_fig11.gif "Layout of a compound datatype nested in a compound datatype" + *
+ * + * Code for a compound datatype nested in a compound datatype + * \code + * typedef struct { + * complex_t x; + * complex_t y; + * } surf_t; + * + * hid_t complex_id, surf_id; // hdf5 datatypes + * + * complex_id = H5Tcreate (H5T_COMPOUND, sizeof(complex_t)); + * H5Tinsert (complex_id, “re”, HOFFSET(complex_t, re), H5T_NATIVE_DOUBLE); + * H5Tinsert (complex_id, “im”, HOFFSET(complex_t, im), H5T_NATIVE_DOUBLE); + * + * surf_id = H5Tcreate (H5T_COMPOUND, sizeof(surf_t)); + * H5Tinsert (surf_id, “x”, HOFFSET(surf_t, x), complex_id); + * H5Tinsert (surf_id, “y”, HOFFSET(surf_t, y), complex_id); + * \endcode + * + * Note that a similar result could be accomplished by creating a compound datatype and inserting + * four fields. See the figure below. This results in the same layout as the figure above. The difference + * would be how the fields are addressed. In the first case, the real part of ‘y’ is called ‘y.re’; + * in the second case it is ‘y-re’. + * + * Another compound datatype nested in a compound datatype + * \code + * typedef struct { + * complex_t x; + * complex_t y; + * } surf_t; + * + * hid_t surf_id = H5Tcreate (H5T_COMPOUND, sizeof(surf_t)); + * H5Tinsert (surf_id, “x-re”, HOFFSET(surf_t, x.re), H5T_NATIVE_DOUBLE); + * H5Tinsert (surf_id, “x-im”, HOFFSET(surf_t, x.im), H5T_NATIVE_DOUBLE); + * H5Tinsert (surf_id, “y-re”, HOFFSET(surf_t, y.re), H5T_NATIVE_DOUBLE); + * H5Tinsert (surf_id, “y-im”, HOFFSET(surf_t, y.im), H5T_NATIVE_DOUBLE); + * \endcode + * + * The members of a compound datatype do not always fill all the bytes. The #HOFFSET macro + * assures that the members will be laid out according to the requirements of the platform and + * language. The example below shows an example of a C struct which requires extra bytes of + * padding on many platforms. The second element, ‘b’, is a 1-byte character followed by an 8 byte + * double, ‘c’. On many systems, the 8-byte value must be stored on a 4-or 8-byte boundary. This + * requires the struct to be larger than the sum of the size of its elements. + * + * In the example below, sizeof and #HOFFSET are used to assure that the members are inserted at + * the correct offset to match the memory conventions of the platform. The figure below shows how + * this data element would be stored in memory, assuming the double must start on a 4-byte + * boundary. Notice the extra bytes between ‘b’ and ‘c’. + * + * A compound datatype that requires padding + * \code + * typedef struct { + * int a; + * char b; + * double c; + * } s1_t; + * + * hid_t s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + * H5Tinsert (s1_tid, “x-im”, HOFFSET(s1_t, a), H5T_NATIVE_INT); + * H5Tinsert (s1_tid, “y-re”, HOFFSET(s1_t, b), H5T_NATIVE_CHAR); + * H5Tinsert (s1_tid, “y-im”, HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); + * \endcode + * + * + * + * + * + *
+ * \image html Dtypes_fig12.gif "Memory layout of a compound datatype that requires padding" + *
+ * + * However, data stored on disk does not require alignment, so unaligned versions of compound + * data structures can be created to improve space efficiency on disk. These unaligned compound + * datatypes can be created by computing offsets by hand to eliminate inter-member padding, or the + * members can be packed by calling #H5Tpack (which modifies a datatype directly, so it is usually + * preceded by a call to #H5Tcopy). + * + * The example below shows how to create a disk version of the compound datatype from the + * figure above in order to store data on disk in as compact a form as possible. Packed compound + * datatypes should generally not be used to describe memory as they may violate alignment + * constraints for the architecture being used. Note also that using a packed datatype for disk + * storage may involve a higher data conversion cost. + * + * Create a packed compound datatype in C + * \code + * hid_t s2_tid = H5Tcopy (s1_tid); + * H5Tpack (s2_tid); + * \endcode + * + * The example below shows the sequence of Fortran calls to create a packed compound datatype. + * An HDF5 Fortran compound datatype never describes a compound datatype in memory and + * compound data is ALWAYS written by fields as described in the next section. Therefore packing + * is not needed unless the offset of each consecutive member is not equal to the sum of the sizes of + * the previous members. + * + * Create a packed compound datatype in Fortran + * \code + * CALL h5tcopy_f(s1_id, s2_id, error) + * CALL h5tpack_f(s2_id, error) + * \endcode + * + *

Creating and Writing Datasets with Compound Datatypes

+ * + * Creating datasets with compound datatypes is similar to creating datasets with any other HDF5 + * datatypes. But writing and reading may be different since datasets that have compound datatypes + * can be written or read by a field (member) or subsets of fields (members). The compound + * datatype is the only composite datatype that supports “sub-setting” by the elements the datatype + * is built from. + * + * The example below shows a C example of creating and writing a dataset with a compound + * datatype. + * + * + * Create and write a dataset with a compound datatype in C + * \code + * typedef struct s1_t { + * int a; + * float b; + * double c; + * } s1_t; + * + * s1_t data[LENGTH]; + * + * // Initialize data + * for (i = 0; i < LENGTH; i++) { + * data[i].a = i; + * data[i].b = i*i; + * data[i].c = 1./(i+1); + * } + * + * ... + * + * s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + * H5Tinsert(s1_tid, “a_name”, HOFFSET(s1_t, a), H5T_NATIVE_INT); + * H5Tinsert(s1_tid, “b_name”, HOFFSET(s1_t, b), H5T_NATIVE_FLOAT); + * H5Tinsert(s1_tid, “c_name”, HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); + * + * ... + * + * dataset_id = H5Dcreate(file_id, “SDScompound.h5”, s1_t, + * space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * H5Dwrite (dataset_id, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + * \endcode + * + * The example below shows the content of the file written on a little-endian machine. + * Create and write a little-endian dataset with a compound datatype in C + * \code + * HDF5 “SDScompound.h5” { + * GROUP “/” { + * DATASET “ArrayOfStructures” { + * DATATYPE H5T_COMPOUND { + * H5T_STD_I32LE “a_name”; + * H5T_IEEE_F32LE “b_name”; + * H5T_IEEE_F64LE “c_name”; + * } + * DATASPACE SIMPLE { ( 3 ) / ( 3 ) } + * DATA { + * (0): { + * 0, + * 0, + * 1 + * }, + * (1): { + * 0, + * 1, + * 0.5 + * }, + * (2): { + * 0, + * 4, + * 0.333333 + * } + * } + * } + * } + * } + * \endcode + * + * It is not necessary to write the whole data at once. Datasets with compound datatypes can be + * written by field or by subsets of fields. In order to do this one has to remember to set the transfer + * property of the dataset using the H5Pset_preserve call and to define the memory datatype that + * corresponds to a field. The example below shows how float and double fields are written to the + * dataset. + * + * Writing floats and doubles to a dataset + * \code + * typedef struct sb_t { + * float b; + * double c; + * } sb_t; + * + * typedef struct sc_t { + * float b; + * double c; + * } sc_t; + * sb_t data1[LENGTH]; + * sc_t data2[LENGTH]; + * + * // Initialize data + * for (i = 0; i < LENGTH; i++) { + * data1.b = i * i; + * data2.c = 1./(i + 1); + * } + * + * ... + * + * // Create dataset as in example 15 + * + * ... + * + * // Create memory datatypes corresponding to float + * // and double datatype fields + * + * sb_tid = H5Tcreate (H5T_COMPOUND, sizeof(sb_t)); + * H5Tinsert(sb_tid, “b_name”, HOFFSET(sb_t, b), H5T_NATIVE_FLOAT); + * sc_tid = H5Tcreate (H5T_COMPOUND, sizeof(sc_t)); + * H5Tinsert(sc_tid, “c_name”, HOFFSET(sc_t, c), H5T_NATIVE_DOUBLE); + * + * ... + * + * // Set transfer property + * xfer_id = H5Pcreate(H5P_DATASET_XFER); + * H5Pset_preserve(xfer_id, 1); + * H5Dwrite (dataset_id, sb_tid, H5S_ALL, H5S_ALL, xfer_id, data1); + * H5Dwrite (dataset_id, sc_tid, H5S_ALL, H5S_ALL, xfer_id, data2); + * \endcode + * + * The figure below shows the content of the file written on a little-endian machine. Only float and + * double fields are written. The default fill value is used to initialize the unwritten integer field. + * Writing floats and doubles to a dataset on a little-endian system + * \code + * HDF5 “SDScompound.h5” { + * GROUP “/” { + * DATASET “ArrayOfStructures” { + * DATATYPE H5T_COMPOUND { + * H5T_STD_I32LE “a_name”; + * H5T_IEEE_F32LE “b_name”; + * H5T_IEEE_F64LE “c_name”; + * } + * DATASPACE SIMPLE { ( 3 ) / ( 3 ) } + * DATA { + * (0): { + * 0, + * 0, + * 1 + * }, + * (1): { + * 0, + * 1, + * 0.5 + * }, + * (2): { + * 0, + * 4, + * 0.333333 + * } + * } + * } + * } + * } + * \endcode + * + * The example below contains a Fortran example that creates and writes a dataset with a + * compound datatype. As this example illustrates, writing and reading compound datatypes in + * Fortran is always done by fields. The content of the written file is the same as shown in the + * example above. + * Create and write a dataset with a compound datatype in Fortran + * \code + * ! One cannot write an array of a derived datatype in + * ! Fortran. + * TYPE s1_t + * INTEGER a + * REAL b + * DOUBLE PRECISION c + * END TYPE s1_t + * TYPE(s1_t) d(LENGTH) + * ! Therefore, the following code initializes an array + * ! corresponding to each field in the derived datatype + * ! and writesthose arrays to the dataset + * + * INTEGER, DIMENSION(LENGTH) :: a + * REAL, DIMENSION(LENGTH) :: b + * DOUBLE PRECISION, DIMENSION(LENGTH) :: c + * + * ! Initialize data + * do i = 1, LENGTH + * a(i) = i-1 + * b(i) = (i-1) * (i-1) + * c(i) = 1./i + * enddo + * + * ... + * + * ! Set dataset transfer property to preserve partially + * ! initialized fields during write/read to/from dataset + * ! with compound datatype. + * ! + * CALL h5pcreate_f(H5P_DATASET_XFER_F, plist_id, error) + * CALL h5pset_preserve_f(plist_id, .TRUE., error) + * + * ... + * + * ! + * ! Create compound datatype. + * ! + * ! First calculate total size by calculating sizes of + * ! each member + * ! + * CALL h5tget_size_f(H5T_NATIVE_INTEGER, type_sizei, error) + * CALL h5tget_size_f(H5T_NATIVE_REAL, type_sizer, error) + * CALL h5tget_size_f(H5T_NATIVE_DOUBLE, type_sized, error) + * type_size = type_sizei + type_sizer + type_sized + * CALL h5tcreate_f(H5T_COMPOUND_F, type_size, dtype_id, error) + * ! + * ! Insert members + * ! + * ! + * ! INTEGER member + * ! + * offset = 0 + * CALL h5tinsert_f(dtype_id, “a_name”, offset, H5T_NATIVE_INTEGER, error) + * ! + * ! REAL member + * ! + * offset = offset + type_sizei + * CALL h5tinsert_f(dtype_id, “b_name”, offset, H5T_NATIVE_REAL, error) + * ! + * ! DOUBLE PRECISION member + * ! + * offset = offset + type_sizer + * CALL h5tinsert_f(dtype_id, “c_name”, offset, H5T_NATIVE_DOUBLE, error) + * ! + * ! Create the dataset with compound datatype. + * ! + * CALL h5dcreate_f(file_id, dsetname, dtype_id, dspace_id, &dset_id, error, H5P_DEFAULT_F, + * H5P_DEFAULT_F, H5P_DEFAULT_F) + * ! + * + * ... + * + * ! Create memory types. We have to create a compound + * ! datatype for each member we want to write. + * ! + * CALL h5tcreate_f(H5T_COMPOUND_F, type_sizei, dt1_id, error) + * offset = 0 + * CALL h5tinsert_f(dt1_id, “a_name”, offset, H5T_NATIVE_INTEGER, error) + * ! + * CALL h5tcreate_f(H5T_COMPOUND_F, type_sizer, dt2_id, error) + * offset = 0 + * CALL h5tinsert_f(dt2_id, “b_name”, offset, H5T_NATIVE_REAL, error) + * ! + * CALL h5tcreate_f(H5T_COMPOUND_F, type_sized, dt3_id, error) + * offset = 0 + * CALL h5tinsert_f(dt3_id, “c_name”, offset, H5T_NATIVE_DOUBLE, error) + * ! + * ! Write data by fields in the datatype. Fields order + * ! is not important. + * ! + * CALL h5dwrite_f(dset_id, dt3_id, c, data_dims, error, xfer_prp = plist_id) + * CALL h5dwrite_f(dset_id, dt2_id, b, data_dims, error, xfer_prp = plist_id) + * CALL h5dwrite_f(dset_id, dt1_id, a, data_dims, error, xfer_prp = plist_id) + * \endcode + * + *

Reading Datasets with Compound Datatypes

+ * + * Reading datasets with compound datatypes may be a challenge. For general applications there is + * no way to know a priori the corresponding C structure. Also, C structures cannot be allocated on + * the fly during discovery of the dataset's datatype. For general C, C++, Fortran and Java + * application the following steps will be required to read and to interpret data from the dataset with + * compound datatype: + * \li 1. Get the identifier of the compound datatype in the file with the #H5Dget_type call + * \li 2. Find the number of the compound datatype members with the #H5Tget_nmembers call + * \li 3. Iterate through compound datatype members + *
  • Get member class with the #H5Tget_member_class call
  • + *
  • Get member name with the #H5Tget_member_name call
  • + *
  • Check class type against predefined classes + *
    • #H5T_INTEGER
    • + *
    • #H5T_FLOAT
    • + *
    • #H5T_STRING
    • + *
    • #H5T_BITFIELD
    • + *
    • #H5T_OPAQUE
    • + *
    • #H5T_COMPOUND
    • + *
    • #H5T_REFERENCE
    • + *
    • #H5T_ENUM
    • + *
    • #H5T_VLEN
    • + *
    • #H5T_ARRAY
    + *
  • + *
  • If class is #H5T_COMPOUND, then go to step 2 and repeat all steps under step 3. If + * class is not #H5T_COMPOUND, then a member is of an atomic class and can be read + * to a corresponding buffer after discovering all necessary information specific to each + * atomic type (for example, size of the integer or floats, super class for enumerated and + * array datatype, and its sizes)
+ * + * The examples below show how to read a dataset with a known compound datatype. + * + * The first example below shows the steps needed to read data of a known structure. First, build a + * memory datatype the same way it was built when the dataset was created, and then second use + * the datatype in an #H5Dread call. + * + * Read a dataset using a memory datatype + * \code + * typedef struct s1_t { + * int a; + * float b; + * double c; + * } s1_t; + * + * s1_t *data; + * + * ... + * + * s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); + * H5Tinsert(s1_tid, “a_name”, HOFFSET(s1_t, a), H5T_NATIVE_INT); + * H5Tinsert(s1_tid, “b_name”, HOFFSET(s1_t, b), H5T_NATIVE_FLOAT); + * H5Tinsert(s1_tid, “c_name”, HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); + * + * ... + * + * dataset_id = H5Dopen(file_id, “SDScompound.h5”, H5P_DEFAULT); + * + * ... + * + * data = (s1_t *) malloc (sizeof(s1_t)*LENGTH); + * H5Dread(dataset_id, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + * \endcode + * + * Instead of building a memory datatype, the application could use the + * #H5Tget_native_type function. See the example below. + * + * Read a dataset using H5Tget_native_type + * \code + * typedef struct s1_t { + * int a; + * float b; + * double c; + * } s1_t; + * + * s1_t *data; + * hid_t file_s1_t, mem_s1_t; + * + * ... + * + * dataset_id = H5Dopen(file_id, “SDScompound.h5”, H5P_DEFAULT); + * // Discover datatype in the file + * file_s1_t = H5Dget_type(dataset_id); + * // Find corresponding memory datatype + * mem_s1_t = H5Tget_native_type(file_s1_t, H5T_DIR_DEFAULT); + * + * ... + * + * data = (s1_t *) malloc (sizeof(s1_t)*LENGTH); + * H5Dread (dataset_id,mem_s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + * \endcode + * + * The example below shows how to read just one float member of a compound datatype. + * + * Read one floating point member of a compound datatype + * \code + * typedef struct sf_t { + * float b; + * } sf_t; + * + * sf_t *data; + * + * ... + * + * sf_tid = H5Tcreate(H5T_COMPOUND, sizeof(sf_t)); + * H5Tinsert(sf_tid, “b_name”, HOFFSET(sf_t, b), H5T_NATIVE_FLOAT); + * + * ... + * + * dataset_id = H5Dopen(file_id, “SDScompound.h5”, H5P_DEFAULT); + * + * ... + * + * data = (sf_t *) malloc (sizeof(sf_t) * LENGTH); + * H5Dread(dataset_id, sf_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + * \endcode + * + * The example below shows how to read float and double members of a compound datatype into a + * structure that has those fields in a different order. Please notice that #H5Tinsert calls can be used + * in an order different from the order of the structure's members. + * + * Read float and double members of a compound datatype + * \code + * typedef struct sdf_t { + * double c; + * float b; + * } sdf_t; + * + * sdf_t *data; + * + * ... + * + * sdf_tid = H5Tcreate(H5T_COMPOUND, sizeof(sdf_t)); + * H5Tinsert(sdf_tid, “b_name”, HOFFSET(sdf_t, b), H5T_NATIVE_FLOAT); + * H5Tinsert(sdf_tid, “c_name”, HOFFSET(sdf_t, c), H5T_NATIVE_DOUBLE); + * + * ... + * + * dataset_id = H5Dopen(file_id, “SDScompound.h5”, H5P_DEFAULT); + * + * ... + * + * data = (sdf_t *) malloc (sizeof(sdf_t) * LENGTH); + * H5Dread(dataset_id, sdf_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + * \endcode + * + *

Array

+ * + * Many scientific datasets have multiple measurements for each point in a space. There are several + * natural ways to represent this data, depending on the variables and how they are used in + * computation. See the table and the figure below. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Representing data with multiple measurements
+ *

Storage Strategy

+ *
+ *

Stored as

+ *
+ *

Remarks

+ *
Multiple planes + * + * Several datasets with identical dataspaces + * + * This is optimal when variables are accessed individually, or when often uses only selected + * variables. + *
+ * Additional dimension + * + * One dataset, the last “dimension” is a vec-tor of variables + * + * This can give good performance, although selecting only a few variables may be slow. This may + * not reflect the science. + *
+ * Record with multiple values + * + * One dataset with compound datatype + * + * This enables the variables to be read all together or selected. Also handles “vectors” of + * heterogeneous data. + *
+ * Vector or Tensor value + * + * One dataset, each data element is a small array of values. + * + * This uses the same amount of space as the previous two, and may represent the science model + * better. + *
+ * + * + * + * + * + * + * + * + * + * + * + *
Figure 13 Representing data with multiple measurements
+ * \image html Dtypes_fig13a.gif + * + * \image html Dtypes_fig13b.gif + *
+ * \image html Dtypes_fig13c.gif + * + * \image html Dtypes_fig13d.gif + *
+ * + * The HDF5 #H5T_ARRAY datatype defines the data element to be a homogeneous, multi-dimensional array. + * See Figure 13 above. The elements of the array can be any HDF5 datatype + * (including compound and array), and the size of the datatype is the total size of the array. A + * dataset of array datatype cannot be subdivided for I/O within the data element: the entire array of + * the data element must be transferred. If the data elements need to be accessed separately, for + * example, by plane, then the array datatype should not be used. The table below shows + * advantages and disadvantages of various storage methods. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Storage method advantages and disadvantages
+ *

Method

+ *
+ *

Advantages

+ *
+ *

Disadvantages

+ *
+ * Multiple Datasets + * + * Easy to access each plane, can select any plane(s) + * + * Less efficient to access a ‘column’ through the planes + *
+ * N+1 Dimension + * + * All access patterns supported + * + * Must be homogeneous datatype
+ * The added dimension may not make sense in the scientific model + *
+ * Compound Datatype + * + * Can be heterogeneous datatype + * + * Planes must be named, selection is by plane
+ * Not a natural representation for a matrix + *
+ * Array + * + * A natural representation for vector or tensor data + * + * Cannot access elements separately (no access by plane) + *
+ * + * An array datatype may be multi-dimensional with 1 to #H5S_MAX_RANK(the maximum rank + * of a dataset is currently 32) dimensions. The dimensions can be any size greater than 0, but + * unlimited dimensions are not supported (although the datatype can be a variable-length datatype). + * + * An array datatype is created with the #H5Tarray_create call, which specifies the number of + * dimensions, the size of each dimension, and the base type of the array. The array datatype can + * then be used in any way that any datatype object is used. The example below shows the creation + * of a datatype that is a two-dimensional array of native integers, and this is then used to create a + * dataset. Note that the dataset can be a dataspace that is any number and size of dimensions. The figure + * below shows the layout in memory assuming that the native integers are 4 bytes. Each + * data element has 6 elements, for a total of 24 bytes. + * + * Create a two-dimensional array datatype + * \code + * hid_t file, dataset; + * hid_t datatype, dataspace; + * hsize_t adims[] = {3, 2}; + * + * datatype = H5Tarray_create(H5T_NATIVE_INT, 2, adims, NULL); + * + * dataset = H5Dcreate(file, datasetname, datatype, + * dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * + * + * + * + * + *
+ * \image html Dtypes_fig14.gif "Memory layout of a two-dimensional array datatype" + *
+ * + * @anchor h4_vlen_datatype

Variable-length Datatypes

+ * + * A variable-length (VL) datatype is a one-dimensional sequence of a datatype which are not fixed + * in length from one dataset location to another. In other words, each data element may have a + * different number of members. Variable-length datatypes cannot be divided;the entire data + * element must be transferred. + * + * VL datatypes are useful to the scientific community in many different ways, possibly including: + *
    + *
  • Ragged arrays: Multi-dimensional ragged arrays can be implemented with the last (fastest changing) + * dimension being ragged by using a VL datatype as the type of the element stored. + *
  • + *
  • Fractal arrays: A nested VL datatype can be used to implement ragged arrays of ragged arrays, to + * whatever nesting depth is required for the user. + *
  • + *
  • Polygon lists: A common storage requirement is to efficiently store arrays of polygons with + * different numbers of vertices. A VL datatype can be used to efficiently and succinctly describe + * an array of polygons with different numbers of vertices. + *
  • + *
  • Character strings: Perhaps the most common use of VL datatypes will be to store C-like VL + * character strings in dataset elements or as attributes of objects. + *
  • + *
  • Indices (for example, of objects within a file): An array of VL object references could be used + * as an index to all the objects in a file which contain a particular sequence of dataset values. + *
  • + *
  • Object Tracking: An array of VL dataset region references can be used as a method of tracking + * objects or features appearing in a sequence of datasets. + *
  • + *
+ * + * A VL datatype is created by calling #H5Tvlen_create which specifies the base datatype. The first + * example below shows an example of code that creates a VL datatype of unsigned integers. Each + * data element is a one-dimensional array of zero or more members and is stored in the + * hvl_t structure. See the second example below. + * + * Create a variable-length datatype of unsigned integers + * \code + * tid1 = H5Tvlen_create (H5T_NATIVE_UINT); + * + * dataset=H5Dcreate(fid1,“Dataset1”, tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * + * Data element storage for members of the VL datatype + * \code + * typedef struct + * { + * size_t len; // Length of VL data + * //(in base type units) + * void *p; // Pointer to VL data + * } hvl_t; + * \endcode + * + * The first example below shows how the VL data is written. For each of the 10 data elements, a + * length and data buffer must be allocated. Below the two examples is a figure that shows how the + * data is laid out in memory. + * + * An analogous procedure must be used to read the data. See the second example below. An + * appropriate array of vl_t must be allocated, and the data read. It is then traversed one data + * element at a time. The #H5Dvlen_reclaim call frees the data buffer for the buffer. With each + * element possibly being of different sequence lengths for a dataset with a VL datatype, the + * memory for the VL datatype must be dynamically allocated. Currently there are two methods of + * managing the memory for VL datatypes: the standard C malloc/free memory allocation routines + * or a method of calling user-defined memory management routines to allocate or free memory + * (set with #H5Pset_vlen_mem_manager). Since the memory allocated when reading (or writing) + * may be complicated to release, the #H5Dvlen_reclaim function is provided to traverse a memory + * buffer and free the VL datatype information without leaking memory. + * + * Write VL data + * \code + * hvl_t wdata[10]; // Information to write + * + * // Allocate and initialize VL data to write + * for(i = 0; i < 10; i++) { + * wdata[i].p = malloc((i + 1) * sizeof(unsigned int)); + * wdata[i].len = i + 1; + * for(j = 0; j < (i + 1); j++) + * ((unsigned int *)wdata[i].p)[j]=i * 10 + j; + * } + * ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); + * \endcode + * + * Read VL data + * \code + * hvl_t rdata[SPACE1_DIM1]; + * ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata); + * + * for(i = 0; i < SPACE1_DIM1; i++) { + * printf(“%d: len %d ”,rdata[i].len); + * for(j = 0; j < rdata[i].len; j++) { + * printf(“ value: %u\n”,((unsigned int *)rdata[i].p)[j]); + * } + * } + * ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata); + * \endcode + * + * + * + * + * + *
+ * \image html Dtypes_fig15.gif "Memory layout of a VL datatype" + *
+ * + * The user program must carefully manage these relatively complex data structures. The + * #H5Dvlen_reclaim function performs a standard traversal, freeing all the data. This function + * analyzes the datatype and dataspace objects, and visits each VL data element, recursing through + * nested types. By default, the system free is called for the pointer in each vl_t. Obviously, this + * call assumes that all of this memory was allocated with the system malloc. + * + * The user program may specify custom memory manager routines, one for allocating and one for + * freeing. These may be set with the #H5Pset_vlen_mem_manager, and must have the following + * prototypes: + *
    + *
  • + * \code + * typedef void *(*H5MM_allocate_t)(size_t size, void *info); + * \endcode + *
  • + *
  • + * \code + * typedef void (*H5MM_free_t)(void *mem, void *free_info); + * \endcode + *
  • + *
+ * The utility function #H5Dvlen_get_buf_size checks the number of bytes required to store the VL + * data from the dataset. This function analyzes the datatype and dataspace object to visit all the VL + * data elements, to determine the number of bytes required to store the data for the in the + * destination storage (memory). The size value is adjusted for data conversion and alignment in the + * destination. + * + * \subsection subsec_datatype_other Other Non-numeric Datatypes + * Several datatype classes define special types of objects. + * + * \subsubsection subsubsec_datatype_other_strings Strings + * Text data is represented by arrays of characters, called strings. Many programming languages + * support different conventions for storing strings, which may be fixed or variable-length, and may + * have different rules for padding unused storage. HDF5 can represent strings in several ways. See + * the figure below. + * + * The strings to store are “Four score” and “lazy programmers.” + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
A string stored as one-character elements in a one-dimensional array
+ * a) #H5T_NATIVE_CHAR: The dataset is a one-dimensional array with 29 elements, and each element + * is a single character. + *
+ * \image html Dtypes_fig16a.gif + *
+ * b) Fixed-length string: The dataset is a one-dimensional array with two elements, and each + * element is 20 characters. + *
+ * \image html Dtypes_fig16b.gif + *
+ * c) Variable-length string: The dataset is a one-dimensional array with two elements, and each + * element is a variable-length string. This is the same result when stored as a fixed-length + * string except that the first element of the array will need only 11 bytes for storage instead of 20. + *
+ * \image html Dtypes_fig16c.gif + *
+ * \image html Dtypes_fig16d.gif + *
+ * + * First, a dataset may have a dataset with datatype #H5T_NATIVE_CHAR with each character of + * the string as an element of the dataset. This will store an unstructured block of text data, but + * gives little indication of any structure in the text. See item a in the figure above. + * + * A second alternative is to store the data using the datatype class #H5T_STRING with each + * element a fixed length. See item b in the figure above. In this approach, each element might be a + * word or a sentence, addressed by the dataspace. The dataset reserves space for the specified + * number of characters, although some strings may be shorter. This approach is simple and usually + * is fast to access, but can waste storage space if the length of the Strings varies. + * + * A third alternative is to use a variable-length datatype. See item c in the figure above. This can + * be done using the standard mechanisms described above. The program would use vl_t structures + * to write and read the data. + * + * A fourth alternative is to use a special feature of the string datatype class to set the size of the + * datatype to #H5T_VARIABLE. See item c in the figure above. The example below shows a + * declaration of a datatype of type #H5T_C_S1 which is set to #H5T_VARIABLE. The HDF5 + * Library automatically translates between this and the vl_t structure. Note: the #H5T_VARIABLE + * size can only be used with string datatypes. + * Set the string datatype size to H5T_VARIABLE + * \code + * tid1 = H5Tcopy (H5T_C_S1); + * ret = H5Tset_size (tid1, H5T_VARIABLE); + * \endcode + * + * Variable-length strings can be read into C strings (in other words, pointers to zero terminated + * arrays of char). See the example below. + * Read variable-length strings into C strings + * \code + * char *rdata[SPACE1_DIM1]; + * + * ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, xfer_pid, rdata); + * + * for(i = 0; i < SPACE1_DIM1; i++) { + * printf(“%d: len: %d, str is: %s\n”, i, strlen(rdata[i]), rdata[i]); + * } + * + * ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata); + * \endcode + * + * \subsubsection subsubsec_datatype_other_refs Reference + * In HDF5, objects (groups, datasets, and committed datatypes) are usually accessed by name. + * There is another way to access stored objects - by reference. There are two reference datatypes: + * object reference and region reference. Object reference objects are created with #H5Rcreate and + * other calls (cross reference). These objects can be stored and retrieved in a dataset as elements + * with reference datatype. The first example below shows an example of code that creates + * references to four objects, and then writes the array of object references to a dataset. The second + * example below shows a dataset of datatype reference being read and one of the reference objects + * being dereferenced to obtain an object pointer. + * + * In order to store references to regions of a dataset, the datatype should be #H5T_STD_REF_DSETREG. + * Note that a data element must be either an object reference or a region reference: these are + * different types and cannot be mixed within a single array. + * + * A reference datatype cannot be divided for I/O: an element is read or written completely. + * + * Create object references and write to a dataset + * \code + * dataset= H5Dcreate (fid1, “Dataset3”, H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * + * // Create reference to dataset + * ret = H5Rcreate(&wbuf[0], fid1,“/Group1/Dataset1”, H5R_OBJECT, -1); + * + * // Create reference to dataset + * ret = H5Rcreate(&wbuf[1], fid1, “/Group1/Dataset2”, H5R_OBJECT, -1); + * + * // Create reference to group + * ret = H5Rcreate(&wbuf[2], fid1, “/Group1”, H5R_OBJECT, -1); + * + * // Create reference to committed datatype + * ret = H5Rcreate(&wbuf[3], fid1, “/Group1/Datatype1”, H5R_OBJECT, -1); + * + * // Write selection to disk + * ret=H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf); + * \endcode + * + * Read a dataset with a reference datatype + * \code + * rbuf = malloc(sizeof(hobj_ref_t)*SPACE1_DIM1); + * + * // Read selection from disk + * ret=H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf); + * + * // Open dataset object + * dset2 = H5Rdereference(dataset, H5R_OBJECT, &rbuf[0]); + * \endcode + * + * \subsubsection subsubsec_datatype_other_enum ENUM + * The enum datatype implements a set of (name, value) pairs, similar to C/C++ enum. The values + * are currently limited to native integer datatypes. Each name can be the name of only one value, + * and each value can have only one name. + * + * The data elements of the ENUMERATION are stored according to the datatype. An example + * would be as an array of integers. The example below shows an example of how to create an + * enumeration with five elements. The elements map symbolic names to 2-byte integers. See the + * table below. + * Create an enumeration with five elements + * \code + * hid_t hdf_en_colors; + * short val; + * + * hdf_en_colors = H5Tcreate(H5T_ENUM, sizeof(short)); + * H5Tenum_insert(hdf_en_colors, “RED”, (val=0, &val)); + * H5Tenum_insert(hdf_en_colors, “GREEN”, (val=1, &val)); + * H5Tenum_insert(hdf_en_colors, “BLUE”, (val=2, &val)); + * H5Tenum_insert(hdf_en_colors, “WHITE”, (val=3, &val)); + * H5Tenum_insert(hdf_en_colors, “BLACK”, (val=4, &val)); + * H5Dcreate(fileid, datasetname, hdf_en_colors, spaceid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
An enumeration with five elements
NameValue
RED0
GREEN1
BLUE2
WHITE3
BLACK4
+ * + * The figure below shows how an array of eight values might be stored. Conceptually, the array is + * an array of symbolic names [BLACK, RED, WHITE, BLUE, ...] See item a in the figure below. + * These are stored as the values and are short integers. So, the first 2 bytes are the value associated + * with “BLACK”, which is the number 4, and so on. See item b in the figure below. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Storing an enum array
+ * a) Logical data to be written - eight elements + *
+ * \image html Dtypes_fig17a.gif + *
+ * b) The storage layout. Total size of the array is 16 bytes, 2 bytes per element. + *
+ * \image html Dtypes_fig17b.gif + *
+ * + * The order that members are inserted into an enumeration type is unimportant; the important part + * is the associations between the symbol names and the values. Thus, two enumeration datatypes + * will be considered equal if and only if both types have the same symbol/value associations and + * both have equal underlying integer datatypes. Type equality is tested with the H5Tequal + * function. + * + * If a particular architecture type is required, a little-endian or big-endian datatype for example, + * use a native integer datatype as the ENUM base datatype and use #H5Tconvert on values as they + * are read from or written to a dataset. + * + * \subsubsection subsubsec_datatype_other_opaque Opaque + * In some cases, a user may have data objects that should be stored and retrieved as blobs with no + * attempt to interpret them. For example, an application might wish to store an array of encrypted + * certificates which are 100 bytes long. + * + * While an arbitrary block of data may always be stored as bytes, characters, integers, or whatever, + * this might mislead programs about the meaning of the data. The opaque datatype defines data + * elements which are uninterpreted by HDF5. The opaque data may be labeled with + * #H5Tset_tag with a string that might be used by an application. For example, the encrypted + * certificates might have a tag to indicate the encryption and the certificate standard. + * + * \subsubsection subsubsec_datatype_other_bitfield Bitfield + * Some data is represented as bits, where the number of bits is not an integral byte and the bits are + * not necessarily interpreted as a standard type. Some examples might include readings from + * machine registers (for example, switch positions), a cloud mask, or data structures with several + * small integers that should be store in a single byte. + * + * This data could be stored as integers, strings, or enumerations. However, these storage methods + * would likely result in considerable wasted space. For example, storing a cloud mask with one + * byte per value would use up to eight times the space of a packed array of bits. + * + * The HDF5 bitfield datatype class defines a data element that is a contiguous sequence of bits, + * which are stored on disk in a packed array. The programming model is the same as for unsigned + * integers: the datatype object is created by copying a predefined datatype, and then the precision, + * offset, and padding are set. + * + * While the use of the bitfield datatype will reduce storage space substantially, there will still be + * wasted space if the bitfield as a whole does not match the 1-, 2-, 4-, or 8-byte unit in which it is + * written. The remaining unused space can be removed by applying the N-bit filter to the dataset + * containing the bitfield data. For more information, see "Using the N-bit Filter." + * + * \subsection subsec_datatype_fill Fill Values + * The “fill value” for a dataset is the specification of the default value assigned to data elements + * that have not yet been written. In the case of a dataset with an atomic datatype, the fill value is a + * single value of the appropriate datatype, such as ‘0’ or ‘-1.0’. In the case of a dataset with a + * composite datatype, the fill value is a single data element of the appropriate type. For example, + * for an array or compound datatype, the fill value is a single data element with values for all the + * component elements of the array or compound datatype. + * + * The fill value is set (permanently) when the dataset is created. The fill value is set in the dataset + * creation properties in the #H5Dcreate call. Note that the #H5Dcreate call must also include the + * datatype of the dataset, and the value provided for the fill value will be interpreted as a single + * element of this datatype. The example below shows code which creates a dataset of integers with + * fill value -1. Any unwritten data elements will be set to -1. + * + * Create a dataset with a fill value of -1 + * \code + * hid_t plist_id; + * int filler; + * + * filler = -1; + * plist_id = H5Pcreate(H5P_DATASET_CREATE); + * H5Pset_fill_value(plist_id, H5T_NATIVE_INT, &filler); + * + * // Create the dataset with fill value ‘-1’. + * dataset_id = H5Dcreate(file_id, “/dset”, H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, plist_id, + * H5P_DEFAULT); + * \endcode + * + * Create a fill value for a compound datatype + * \code + * typedef struct s1_t { + * int a; + * char b; + * double c; + * } s1_t; + * s1_t filler; + * + * s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + * H5Tinsert(s1_tid, “a_name”, HOFFSET(s1_t, a), H5T_NATIVE_INT); + * H5Tinsert(s1_tid, “b_name”, HOFFSET(s1_t, b), H5T_NATIVE_CHAR); + * H5Tinsert(s1_tid, “c_name”, HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); + * + * filler.a = -1; + * filler.b = ‘*’; + * filler.c = -2.0; + * plist_id = H5Pcreate(H5P_DATASET_CREATE); + * H5Pset_fill_value(plist_id, s1_tid, &filler); + * + * // Create the dataset with fill value + * // (-1, ‘*’, -2.0). + * dataset = H5Dcreate(file, datasetname, s1_tid, space, H5P_DEFAULT, plist_id, H5P_DEFAULT); + * \endcode + * + * The code above shows how to create a fill value for a compound datatype. The procedure is the + * same as the previous example except the filler must be a structure with the correct fields. Each + * field is initialized to the desired fill value. + * + * The fill value for a dataset can be retrieved by reading the dataset creation properties of the + * dataset and then by reading the fill value with #H5Pget_fill_value. The data will be read into + * memory using the storage layout specified by the datatype. This transfer will convert data in the + * same way as #H5Dread. The example below shows how to get the fill value from the dataset + * created in the example "Create a dataset with a fill value of -1". + * + * Retrieve a fill value + * \code + * hid_t plist2; + * int filler; + * + * dataset_id = H5Dopen(file_id, “/dset”, H5P_DEFAULT); + * plist2 = H5Dget_create_plist(dataset_id); + * + * H5Pget_fill_value(plist2, H5T_NATIVE_INT, &filler); + * + * // filler has the fill value, ‘-1’ + * \endcode + * + * A similar procedure is followed for any datatype. The example below shows how to read the fill + * value for the compound datatype created in an example above. Note that the program must pass + * an element large enough to hold a fill value of the datatype indicated by the argument to + * #H5Pget_fill_value. Also, the program must understand the datatype in order to interpret its + * components. This may be difficult to determine without knowledge of the application that + * created the dataset. + * + * Read the fill value for a compound datatype + * \code + * char *fillbuf; + * int sz; + * + * dataset = H5Dopen( file, DATASETNAME, H5P_DEFAULT); + * + * s1_tid = H5Dget_type(dataset); + * + * sz = H5Tget_size(s1_tid); + * + * fillbuf = (char *)malloc(sz); + * + * plist_id = H5Dget_create_plist(dataset); + * + * H5Pget_fill_value(plist_id, s1_tid, fillbuf); + * + * printf(“filler.a: %d\n”,((s1_t *) fillbuf)->a); + * printf(“filler.b: %c\n”,((s1_t *) fillbuf)->b); + * printf(“filler.c: %f\n”,((s1_t *) fillbuf)->c); + * \endcode + * + * \subsection subsec_datatype_complex Complex Combinations of Datatypes + * Several composite datatype classes define collections of other datatypes, including other + * composite datatypes. In general, a datatype can be nested to any depth, with any combination of + * datatypes. + * + * For example, a compound datatype can have members that are other compound datatypes, arrays, + * VL datatypes. An array can be an array of array, an array of compound, or an array of VL. And a + * VL datatype can be a variable-length array of compound, array, or VL datatypes. + * + * These complicated combinations of datatypes form a logical tree, with a single root datatype, and + * leaves which must be atomic datatypes (predefined or user-defined). The figure below shows an + * example of a logical tree describing a compound datatype constructed from different datatypes. + * + * Recall that the datatype is a description of the layout of storage. The complicated compound + * datatype is constructed from component datatypes, each of which describes the layout of part of + * the storage. Any datatype can be used as a component of a compound datatype, with the + * following restrictions: + *
  • 1. No byte can be part of more than one component datatype (in other words, the fields cannot + * overlap within the compound datatype)
  • + *
  • 2. The total size of the components must be less than or equal to the total size of the compound + * datatype
+ * These restrictions are essentially the rules for C structures and similar record types familiar from + * programming languages. Multiple typing, such as a C union, is not allowed in HDF5 datatypes. + * + * + * + * + * + *
+ * \image html Dtypes_fig18.gif "A compound datatype built with different datatypes" + *
+ * + * \subsubsection subsubsec_datatype_complex_create Creating a Complicated Compound Datatype + * To construct a complicated compound datatype, each component is constructed, and then added + * to the enclosing datatype description. The example below shows how to create a compound + * datatype with four members: + * \li “T1”, a compound datatype with three members + * \li “T2”, a compound datatype with two members + * \li “T3”, a one-dimensional array of integers + * \li “T4”, a string + * + * Below the example code is a figure that shows this datatype as a logical tree. The output of the + * h5dump utility is shown in the example below the figure. + * + * Each datatype is created as a separate datatype object. Figure "The storage layout for the + * four member datatypes" below shows the storage layout + * for the four individual datatypes. Then the datatypes are inserted into the outer datatype at an + * appropriate offset. Figure "The storage layout of the combined four members" below shows the + * resulting storage layout. The combined record is 89 bytes long. + * + * The Dataset is created using the combined compound datatype. The dataset is declared to be a 4 + * by 3 array of compound data. Each data element is an instance of the 89-byte compound + * datatype. Figure "The layout of the dataset" below shows the layout of the dataset, and expands + * one of the elements to show the relative position of the component data elements. + * + * Each data element is a compound datatype, which can be written or read as a record, or each + * field may be read or written individually. The first field (“T1”) is itself a compound datatype + * with three fields (“T1.a”, “T1.b”, and “T1.c”). “T1” can be read or written as a record, or + * individual fields can be accessed. Similarly, the second filed is a compound datatype with two + * fields (“T2.f1”, “T2.f2”). + * + * The third field (“T3”) is an array datatype. Thus, “T3” should be accessed as an array of 40 + * integers. Array data can only be read or written as a single element, so all 40 integers must be + * read or written to the third field. The fourth field (“T4”) is a single string of length 25. + * + * Create a compound datatype with four members + * \code + * typedef struct s1_t { + * int a; + * char b; + * double c; + * } s1_t; + * typedef struct s2_t { + * float f1; + * float f2; + * } s2_t; + * hid_t s1_tid, s2_tid, s3_tid, s4_tid, s5_tid; + * + * // Create a datatype for s1 + * s1_tid = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + * H5Tinsert(s1_tid, “a_name”, HOFFSET(s1_t, a), H5T_NATIVE_INT); + * H5Tinsert(s1_tid, “b_name”, HOFFSET(s1_t, b), H5T_NATIVE_CHAR); + * H5Tinsert(s1_tid, “c_name”, HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); + * + * // Create a datatype for s2. + * s2_tid = H5Tcreate (H5T_COMPOUND, sizeof(s2_t)); + * H5Tinsert(s2_tid, “f1”, HOFFSET(s2_t, f1), H5T_NATIVE_FLOAT); + * H5Tinsert(s2_tid, “f2”, HOFFSET(s2_t, f2), H5T_NATIVE_FLOAT); + * + * // Create a datatype for an Array of integers + * s3_tid = H5Tarray_create(H5T_NATIVE_INT, RANK, dim); + * + * // Create a datatype for a String of 25 characters + * s4_tid = H5Tcopy(H5T_C_S1); + * H5Tset_size(s4_tid, 25); + * + * // Create a compound datatype composed of one of each of these types. + * // The total size is the sum of the size of each. + * sz = H5Tget_size(s1_tid) + H5Tget_size(s2_tid) + H5Tget_size(s3_tid) + H5Tget_size(s4_tid); + * s5_tid = H5Tcreate (H5T_COMPOUND, sz); + * + * // Insert the component types at the appropriate offsets. + * H5Tinsert(s5_tid, “T1”, 0, s1_tid); + * H5Tinsert(s5_tid, “T2”, sizeof(s1_t), s2_tid); + * H5Tinsert(s5_tid, “T3”, sizeof(s1_t) + sizeof(s2_t), s3_tid); + * H5Tinsert(s5_tid, “T4”, (sizeof(s1_t) + sizeof(s2_t) + H5Tget_size(s3_tid)), s4_tid); + * + * // Create the dataset with this datatype. + * dataset = H5Dcreate(file, DATASETNAME, s5_tid, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * + * + * + * + * + *
+ * \image html Dtypes_fig19.gif "Logical tree for the compound datatype with four members" + *
+ * + * Output from h5dump for the compound datatype + * \code + * DATATYPE H5T_COMPOUND { + * H5T_COMPOUND { + * H5T_STD_I32LE “a_name”; + * H5T_STD_I8LE “b_name”; + * H5T_IEEE_F64LE “c_name”; + * } “T1”; + * H5T_COMPOUND { + * H5T_IEEE_F32LE “f1”; + * H5T_IEEE_F32LE “f2”; + * } “T2”; + * H5T_ARRAY { [10] H5T_STD_I32LE } “T3”; + * H5T_STRING { + * STRSIZE 25; + * STRPAD H5T_STR_NULLTERM; + * CSET H5T_CSET_ASCII; + * CTYPE H5T_C_S1; + * } “T4”; + * } + * \endcode + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
The storage layout for the four member datatypes
+ * a) Compound type ‘s1_t’, size 16 bytes. + *
+ * \image html Dtypes_fig20a.gif + *
+ * b) Compound type ‘s2_t’, size 8 bytes. + *
+ * \image html Dtypes_fig20b.gif + *
+ * c) Array type ‘s3_tid’, 40 integers, total size 40 bytes. + *
+ * \image html Dtypes_fig20c.gif + *
+ * d) String type ‘s4_tid’, size 25 bytes. + *
+ * \image html Dtypes_fig20d.gif + *
+ * + * + * + * + * + *
+ * \image html Dtypes_fig21.gif "The storage layout of the combined four members" + *
+ * + * \li A 4 x 3 array of Compound Datatype + * \li Element [1,1] expanded + * + * + * + * + *
+ * \image html Dtypes_fig22.gif "The layout of the dataset" + *
+ * + * \subsubsection subsubsec_datatype_complex_analyze Analyzing and Navigating a Compound Datatype + * A complicated compound datatype can be analyzed piece by piece to discover the exact storage + * layout. In the example above, the outer datatype is analyzed to discover that it is a compound + * datatype with four members. Each member is analyzed in turn to construct a complete map of the + * storage layout. + * + * The example below shows an example of code that partially analyzes a nested compound + * datatype. The name and overall offset and size of the component datatype is discovered, and then + * its type is analyzed depending on the datatype class. Through this method, the complete storage + * layout can be discovered. + * + * Output from h5dump for the compound datatype + * \code + * s1_tid = H5Dget_type(dataset); + * + * if (H5Tget_class(s1_tid) == H5T_COMPOUND) { + * printf(“COMPOUND DATATYPE {\n”); + * sz = H5Tget_size(s1_tid); + * nmemb = H5Tget_nmembers(s1_tid); + * printf(“ %d bytes\n”,sz); + * printf(“ %d members\n”,nmemb); + * for (i =0; i < nmemb; i++) { + * s2_tid = H5Tget_member_type(s1_tid, i); + * if (H5Tget_class(s2_tid) == H5T_COMPOUND) { + * // recursively analyze the nested type. + * } + * else if (H5Tget_class(s2_tid) == H5T_ARRAY) { + * sz2 = H5Tget_size(s2_tid); + * printf(“ %s: NESTED ARRAY DATATYPE offset %d size %d + * {\n”, H5Tget_member_name(s1_tid, i), H5Tget_member_offset(s1_tid, i), sz2); + * H5Tget_array_dims(s2_tid, dim); + * s3_tid = H5Tget_super(s2_tid); + * // Etc., analyze the base type of the array + * } + * else { + * // analyze a simple type + * printf(“ %s: type code %d offset %d size %d\n”, H5Tget_member_name(s1_tid, i), + * H5Tget_class(s2_tid), H5Tget_member_offset(s1_tid, i), H5Tget_size(s2_tid)); + * } + * // and so on.... + * \endcode + * + * \subsection subsec_datatype_life Life Cycle of the Datatype Object + * Application programs access HDF5 datatypes through identifiers. Identifiers are obtained by + * creating a new datatype or by copying or opening an existing datatype. The identifier can be used + * until it is closed or until the library shuts down. See items a and b in the figure below. By default, + * a datatype is transient, and it disappears when it is closed. + * + * When a dataset or attribute is created (#H5Dcreate or #H5Acreate), its datatype is stored in the + * HDF5 file as part of the dataset or attribute object. See item c in the figure below. Once an object + * created, its datatype cannot be changed or deleted. The datatype can be accessed by calling + * #H5Dget_type, #H5Aget_type, #H5Tget_super, or #H5Tget_member_type. See item d in the figure + * below. These calls return an identifier to a transient copy of the datatype of the dataset or + * attribute unless the datatype is a committed datatype. + * Note that when an object is created, the stored datatype is a copy of the transient datatype. If two + * objects are created with the same datatype, the information is stored in each object with the same + * effect as if two different datatypes were created and used. + * + * A transient datatype can be stored using #H5Tcommit in the HDF5 file as an independent, named + * object, called a committed datatype. Committed datatypes were formerly known as named + * datatypes. See item e in the figure below. Subsequently, when a committed datatype is opened + * with #H5Topen (item f), or is obtained with #H5Tget_member_type or similar call (item k), the return + * is an identifier to a transient copy of the stored datatype. The identifier can be used in the + * same way as other datatype identifiers except that the committed datatype cannot be modified. When a + * committed datatype is copied with #H5Tcopy, the return is a new, modifiable, transient datatype + * object (item f). + * + * When an object is created using a committed datatype (#H5Dcreate, #H5Acreate), the stored + * datatype is used without copying it to the object. See item j in the figure below. In this case, if + * multiple objects are created using the same committed datatype, they all share the exact same + * datatype object. This saves space and makes clear that the datatype is shared. Note that a + * committed datatype can be shared by objects within the same HDF5 file, but not by objects in + * other files. For more information on copying committed datatypes to other HDF5 files, see the + * “Copying Committed Datatypes with H5Ocopy” topic in the “Additional Resources” chapter. + * + * A committed datatype can be deleted from the file by calling #H5Ldelete which replaces + * #H5Gunlink. See item i in the figure below. If one or more objects are still using the datatype, the + * committed datatype cannot be accessed with #H5Topen, but will not be removed from the file + * until it is no longer used. #H5Tget_member_type and similar calls will return a transient copy of the + * datatype. + * + * + * + * + * + *
+ * \image html Dtypes_fig23.gif "Life cycle of a datatype" + *
+ * + * Transient datatypes are initially modifiable. Note that when a datatype is copied or when it is + * written to the file (when an object is created) or the datatype is used to create a composite + * datatype, a copy of the current state of the datatype is used. If the datatype is then modified, the + * changes have no effect on datasets, attributes, or datatypes that have already been created. See + * the figure below. + * + * A transient datatype can be made read-only (#H5Tlock). Note that the datatype is still transient, + * and otherwise does not change. A datatype that is immutable is read-only but cannot be closed + * except when the entire library is closed. The predefined types such as #H5T_NATIVE_INT are + * immutable transient types. + * + * + * + * + * + *
+ * \image html Dtypes_fig24.gif "Transient datatype states: modifiable, read-only, and immutable" + *
+ * + * To create two or more datasets that share a common datatype, first commit the datatype, and then + * use that datatype to create the datasets. See the example below. + * Create a shareable datatype + * \code + * hid_t t1 = ...some transient type...; + * H5Tcommit (file, “shared_type”, t1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * hid_t dset1 = H5Dcreate (file, “dset1”, t1, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * hid_t dset2 = H5Dcreate (file, “dset2”, t1, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * + * hid_t dset1 = H5Dopen (file, “dset1”, H5P_DEFAULT); + * hid_t t2 = H5Dget_type (dset1); + * hid_t dset3 = H5Dcreate (file, “dset3”, t2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * hid_t dset4 = H5Dcreate (file, “dset4”, t2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Datatype APIs
FunctionDescription
+ * \code + * hid_t H5Topen (hid_t location, const char *name) + * \endcode + * + * A committed datatype can be opened by calling this function, which returns a datatype identifier. + * The identifier should eventually be released by calling #H5Tclose() to release resources. The + * committed datatype returned by this function is read-only or a negative value is returned for failure. + * The location is either a file or group identifier. + *
+ * \code + * herr_t H5Tcommit (hid_t location, const char *name, hid_t type, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) + * \endcode + * + * A transient datatype (not immutable) can be written to a file and turned into a committed datatype by + * calling this function. The location is either a file or group identifier and when combined with name + * refers to a new committed datatype. + *
+ * \code + * htri_t H5Tcommitted (hid_t type) + * \endcode + * + * A type can be queried to determine if it is a committed type or a transient type. If this function + * returns a positive value then the type is committed. Datasets which return committed datatypes with + * #H5Dget_type() are able to share the datatype with other datasets in the same file. + *
+ * + * \subsection subsec_datatype_transfer Data Transfer: Datatype Conversion and Selection + * When data is transferred (write or read), the storage layout of the data elements may be different. + * For example, an integer might be stored on disk in big-endian byte order and read into memory + * with little-endian byte order. In this case, each data element will be transformed by the HDF5 + * Library during the data transfer. + * + * The conversion of data elements is controlled by specifying the datatype of the source and + * specifying the intended datatype of the destination. The storage format on disk is the datatype + * specified when the dataset is created. The datatype of memory must be specified in the library + * call. + * + * In order to be convertible, the datatype of the source and destination must have the same + * datatype class (with the exception of enumeration type). Thus, integers can be converted to other + * integers, and floats to other floats, but integers cannot (yet) be converted to floats. For each + * atomic datatype class, the possible conversions are defined. An enumeration datatype can be + * converted to an integer or a floating-point number datatype. + * + * Basically, any datatype can be converted to another datatype of the same datatype class. The + * HDF5 Library automatically converts all properties. If the destination is too small to hold the + * source value then an overflow or underflow exception occurs. If a handler is defined with the + * #H5Pset_type_conv_cb function, it will be called. Otherwise, a default action will be performed. + * The table below summarizes the default actions. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Default actions for datatype conversion exceptions
Datatype ClassPossible ExceptionsDefault Action
IntegerSize, offset, pad
FloatSize, offset, pad, ebits
StringSizeTruncates, zero terminate if required.
EnumerationNo fieldAll bits set
+ * + * For example, when reading data from a dataset, the source datatype is the datatype set when the + * dataset was created, and the destination datatype is the description of the storage layout in + * memory. The destination datatype must be specified in the #H5Dread call. The example below + * shows an example of reading a dataset of 32-bit integers. The figure below the example shows + * the data transformation that is performed. + * Specify the destination datatype with H5Dread + * \code + * // Stored as H5T_STD_BE32 + * // Use the native memory order in the destination + * mem_type_id = H5Tcopy(H5T_NATIVE_INT); + * status = H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf); + * \endcode + * + * + * + * + * + * + *
Layout of a datatype conversion
+ * \image html Dtypes_fig25a.gif
+ * \image html Dtypes_fig25b.gif
+ * \image html Dtypes_fig25c.gif + *
+ * + * One thing to note in the example above is the use of the predefined native datatype + * #H5T_NATIVE_INT. Recall that in this example, the data was stored as a 4-bytes in big-endian + * order. The application wants to read this data into an array of integers in memory. Depending on + * the system, the storage layout of memory might be either big or little-endian, so the data may + * need to be transformed on some platforms and not on others. The #H5T_NATIVE_INT type is set + * by the HDF5 Library to be the correct type to describe the storage layout of the memory on the + * system. Thus, the code in the example above will work correctly on any platform, performing a + * transformation when needed. + * + * There are predefined native types for most atomic datatypes, and these can be combined in + * composite datatypes. In general, the predefined native datatypes should always be used for data + * stored in memory. + * Predefined native datatypes describe the storage properties of memory. + * + * + * + * + * + *
+ * \image html Dtypes_fig26.gif "An enum datatype conversion" + *
+ * + * Create an aligned and packed compound datatype + * \code + * // Stored as H5T_STD_BE32 + * // Use the native memory order in the destination + * mem_type_id = H5Tcopy(H5T_NATIVE_INT); + * status = H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf); + * \endcode + * + * + * + * + * + *
+ * \image html Dtypes_fig27.gif "Alignment of a compound datatype" + *
+ * + * Transfer some fields of a compound datatype + * \code + * // Stored as H5T_STD_BE32 + * // Use the native memory order in the destination + * mem_type_id = H5Tcopy(H5T_NATIVE_INT); + * status = H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf); + * \endcode + * + * + * + * + * + *
+ * \image html Dtypes_fig28.gif "Layout when an element is skipped" + *
+ * + * \subsection subsec_datatype_text Text Descriptions of Datatypes: Conversion to and from + * + * HDF5 provides a means for generating a portable and human-readable text description of a + * datatype and for generating a datatype from such a text description. This capability is particularly + * useful for creating complex datatypes in a single step, for creating a text description of a datatype + * for debugging purposes, and for creating a portable datatype definition that can then be used to + * recreate the datatype on many platforms or in other applications. + * + * These tasks are handled by two functions provided in the HDF5 Lite high-level library: + * \li #H5LTtext_to_dtype Creates an HDF5 datatype in a single step. + * \li #H5LTdtype_to_text Translates an HDF5 datatype into a text description. + * + * Note that this functionality requires that the HDF5 High-Level Library (H5LT) be installed. + * + * While #H5LTtext_to_dtype can be used to generate any sort of datatype, it is particularly useful + * for complex datatypes. + * + * #H5LTdtype_to_text is most likely to be used in two sorts of situations: when a datatype must be + * closely examined for debugging purpose or to create a portable text description of the datatype + * that can then be used to recreate the datatype on other platforms or in other applications. + * + * These two functions work for all valid HDF5 datatypes except time, bitfield, and reference + * datatypes. + * + * The currently supported text format used by #H5LTtext_to_dtype and #H5LTdtype_to_text is the + * data description language (DDL) and conforms to the \ref DDLBNF110. The portion of the + * \ref DDLBNF110 that defines HDF5 datatypes appears below. + * The definition of HDF5 datatypes from the HDF5 DDL + * \code + * ::= | | | + * + * ::= | |
+ * Registered VOL Connectors + * + * This list is incomplete and only includes the VOL connectors that have been registered with + * The HDF Group. + * + * Not every connector in this collection is actively maintained by The HDF Group. It simply serves as a + * single location where important VOL connectors can be found. See the documentation in a connector's + * repository to determine its development status and the parties responsible for it. + * + * A VOL template that contains build scripts (Autotools and CMake) and an empty VOL connector "shell" + * which can be copied and used as a starting point for building new connectors is located here: + * VOL Connector Template + * + * This template VOL connector is for use in constructing terminal VOL connectors that do not forward + * calls to an underlying connector. The external pass-through VOL connector listed on the registered + * connector page can be used as a starting point for pass-through connectors. + * + * The only current (non-test) internal VOL connector distributed with the library is the native file + * format connector (the "native VOL connector") which contains the code that handles native HDF5 (*.h5/hdf5) + * files. In other words, even the canonical HDF5 file format is implemented via the VOL, making it a core + * part of the HDF5 library and not an optional component which could be disabled. + * + * It has not been completely abstracted from the HDF5 library, though, and is treated as a special case. + * For example, it cannot be unloaded and is always present. + * + * \subsection subsec_vol_quickstart Quickstart + * The following steps summarize how one would go about using a VOL connector + * with an application. More information on particular steps can be found later + * on in this document. + * + * \subsubsection subsubsec_vol_quick_read Read The Documentation For The New VOL Connector + * Many VOL connectors will require specific setup and configuration of both the application and the + * storage. Specific permissions may have to be set, configuration files constructed, and + * connector-specific setup calls may need to be invoked in the application. In many cases, converting + * software to use a new VOL connector will be more than just a straightforward drop-in replacement done by + * specifying a name in the VOL plugin environment variable. + * + * \subsubsection subsubsec_vol_quick_use Use A VOL-Enabled HDF5 Library + * The virtual object layer was introduced in HDF5 1.12.0, however that version of the VOL is deprecated + * due to inadequate support for pass-through connectors. These deficiencies have been addressed + * in HDF5 1.14.0, so VOL users and connector authors should target the 1.14.0 VOL API. + * + * On Windows, it's probably best to use the same debug vs release configuration for the application and + * all libraries in order to avoid C runtime (CRT) issues. Pre-2015 versions of Visual Studio are not + * supported. + * + * \subsubsection subsubsec_vol_quick_set Determine How You Will Set The VOL Connector + * Fundamentally, setting a VOL connector involves modifying the file access property list (fapl) that will + * be used to open or create the file. + * + * There are essentially three ways to do this: + * \li Direct use of \ref H5Pset_vol() + * \li Library-specific API calls that call \ref H5Pset_vol() for you + * \li Use the VOL environment variable, which will also call \ref H5Pset_vol() for you + * + * Exactly how you go about setting a VOL connector in a fapl, will depend on + * the complexity of the VOL connector and how much control you have over the + * application's source code. Note that the environment variable method, though + * convenient, has some limitations in its implementation, which are discussed + * below. + * + * \subsubsection subsubsec_vol_quick_update If Needed: Update Your Code To Load And Use A VOL Connector + * There are two concerns when modifying the application: + *
  • It may be convenient to add connector-specific setup calls to the application.
  • + *
  • You will also need to protect any API calls which are only implemented in + * the native VOL connector as those calls will fail when using a non-native + * VOL connector. See the section \ref subsec_vol_adapt, below. + * A list of native VOL API calls has been included in \ref subsubsec_vol_compat_native.
+ * + * In some cases, using the VOL environment variable will work well for setting the + * connector and any associated storage setup and the application will not use API + * calls that are not supported by the VOL connector. In this case, no application + * modification will be necessary. + * + * \subsubsection subsubsec_vol_quick_plugin If Using A Plugin: Make Sure The VOL Connector Is In The Search + * Path The default location for all HDF5 plugins is set at configure time when building the HDF5 library. + * This is true for both CMake and the Autotools. The default locations for the plugins on both Windows and + * POSIX systems is listed further on in this document. + * + * \subsubsection subsubsec_vol_quick_opt Optional: Set The VOL Connector Via The Environment Variable + * In place of modifying the source code of your application, you may be able + * to simply set the #HDF5_VOL_CONNECTOR environment variable (see below). This + * will automatically use the specified VOL in place of the native VOL connector. + * + * \subsection subsec_vol_use Connector Use + * Before a VOL connector can be set in a fapl, it must be registered with the + * library (\ref H5Pset_vol requires the connector's #hid_t ID) and, if a plugin, it + * must be discoverable by the library at run time. + * + * \subsubsection subsubsec_vol_connect_register Registration + * Before a connector can be used, it must be registered. This loads the connector + * into the library and give it an HDF5 hid_t ID. The \ref H5VLregister_connector + * API calls are used for this. + * \code + * hid_t H5VLregister_connector_by_name(const char *connector_name, hid_t vipl_id) + * hid_t H5VLregister_connector_by_value(H5VL_class_value_t connector_value, hid_t vipl_id) + * \endcode + * When used with a plugin, these functions will check to see if an appropriate + * plugin with a matching name, value, etc. is already loaded and check the plugin + * path (see above) for matching plugins if this is not true. The functions return + * #H5I_INVALID_HID if they are unable to register the connector. Many VOL connectors will provide + * a connector-specific init call that will load and register the + * connector for you. + * + * Note the two ways that a VOL connector can be identified: by a name or by + * a connector-specific numerical value (#H5VL_class_value_t is typedef’d to an + * integer). The name and value for a connector can be found in the connector's + * documentation or public header file. + * + * Each call also takes a VOL initialization property list (vipl). The library adds + * no properties to this list, so it is entirely for use by connector authors. Set this + * to #H5P_DEFAULT unless instructed differently by the documentation for the VOL + * connector. + * + * As far as the library is concerned, connectors do not need to be explicitly unregistered as the + * library will unload the plugin and close the ID when the library is + * closed. If you want to close a VOL connector ID, either \ref H5VLunregister_connector() + * or \ref H5VLclose() can be used (they have the same internal code path). The library maintains a + * reference count on all open IDs and will not do the actual + * work of closing an ID until its reference count drops to zero, so it's safe to close + * IDs anytime after they are used, even while an HDF5 file that was opened with + * that connector is still open. + * + * Note that it's considered an error to unload the native VOL connector. The + * library will prevent this. This means that, for the time being, the native VOL + * connector will always be available. This may change in the future so that + * the memory footprint of the native VOL connector goes away when not in + * use. + * + * \subsubsection subsubsec_vol_connect_version Connector Versioning + * The VOL connector struct provides a \b conn_version field for versioning connectors. The library + * developers are working on some best practices for versioning connectors. + * + * \subsubsection subsubsec_vol_connect_reg_calls Connector-Specific Registration Calls + * Most connectors will provide a special API call which will set the connector + * in the fapl. These will often be in the form of \b H5Pset_fapl_(). For + * example, the DAOS VOL connector + * provides a \b H5Pset_fapl_daos() API call which will take MPI parameters and + * make this call. See the connector's documentation or public header file(s) for + * more information. + * + * \subsubsection subsubsec_vol_connect_set_vol H5Pset_vol() + * The is the main library API call for setting the VOL connector in a file access + * property list. Its signature is: + * \code + * herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void new_vol_info) + * \endcode + * + * It takes the ID of the file access property list, the ID of the registered VOL + * connector, and a pointer to whatever connector-specific data the connector is + * expecting. This will usually be a data struct specified in the connector's header + * or a NULL pointer if the connecter requires no special information (as in the + * native VOL connector). + * + * As mentioned above, many connectors will provide their own replacement for + * this call. See the connector's documentation for more information. + * + * \subsubsection subsubsec_vol_connect_search VOL Connector Search Path + * Dynamically loaded VOL connector plugins are discovered and loaded by the + * library using the same mechanism as dataset/group filter plugins. The default + * locations are: + * + * Default locations + * \code + * POSIX systems: /usr/local/hdf5/lib/plugin + * Windows: %ALLUSERSPROFILE%/hdf5/lib/plugin + * \endcode + * + * These default locations can be overridden by setting the #HDF5_PLUGIN_PATH + * environment variable. There are also public H5PL API calls which can be used + * to add, modify, and remove search paths. The library will only look for plugins + * in the specified plugin paths. By default, it will NOT find plugins that are + * simply located in the same directory as the executable. + * + * \subsubsection subsubsec_vol_connect_param Parameter Strings + * Each VOL connector is allowed to take in a parameter string which can be + * parsed via \ref H5VLconnector_str_to_info() to get an info struct which can be + * passed to \ref H5Pset_vol(). + * \code + * herr_t H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info) + * \endcode + * + * And the obtained info can be freed via: + * \code + * herr_t H5VLfree_connector_info(hid_t connector_id, void *vol_info) + * \endcode + * + * Most users will not need this functionality as they will be using either connector- + * specific setup calls which will handle registering and configuring the connector + * for them or they will be using the environment variable (see below). + * + * \subsubsection subsubsec_vol_connect_env Environment Variable + * The HDF5 library allows specifying a default VOL connector via an environment + * variable: #HDF5_VOL_CONNECTOR. The value of this environment variable should + * be set to ”vol connector name \”. + * + * This will perform the equivalent of: + *
    + *
  1. \ref H5VLregister_connector_by_name() using the specified connector name
  2. + *
  3. \ref H5VLconnector_str_to_info() using the specified parameters. This will + * go through the connector we got from the previous step and should return + * a VOL info struct from the parameter string in the environment variable.
  4. + *
  5. \ref H5Pset_vol() on the default fapl using the obtained ID and info.
  6. + *
+ * + * The environment variable is parsed once, at library startup. Since the environment variable scheme + * just changes the default connector, it can be overridden + * by subsequent calls to \ref H5Pset_vol(). The \ is optional, so for + * connectors which do not require any special configuration parameters you can + * just set the environment variable to the name. + * + * NOTE: Implementing the environment variable in this way means that setting + * the native VOL connector becomes somewhat awkward as there is no explicit + * HDF5 API call to do this. Instead you will need to get the native VOL connector's ID via + * \ref H5VLget_connector_id_by_value(#H5_VOL_NATIVE) and set it manually in the fapl + * using \ref H5Pset_vol(). + * + * \subsection subsec_vol_adapt Adapting HDF5 Software to Use the VOL + * The VOL was engineered to be as unobtrusive as possible and, when a connector + * which implements most/all of the data model functionality is in use, many applications + * will require little, if any, modification. As mentioned in the quick start + * section, most modifications will probably consist of connector setup code (which + * can usually be accomplished via the environment variable), adapting code to use + * the new token-based API calls, and protecting native-VOL-connector-specific + * functions. + * + * \subsubsection subsubsec_vol_adapt_token haddr_t → H5O_token_t + * Some HDF5 API calls and data structures refer to addresses in the HDF5 using + * the #haddr_t type. Unfortunately, the concept of an ”address” will make no + * sense for many connectors, though they may still have some sort of location key + * (e.g.: a key in a key-value pair store). + * + * As a part of the VOL work, the HDF5 API was updated to replace the #haddr_t + * type with a new #H5O_token_t type that represents a more generic object location. + * These tokens appear as an opaque byte array of #H5O_MAX_TOKEN_SIZE bytes + * that is only meaningful for a particular VOL connector. They are not intended + * for interpretation outside of a VOL connector, though a connector author may + * provide an API call to convert their tokens to something meaningful for the + * storage. + * \code + * typedef struct H5O_token_t { + * uint8_t __data[H5O_MAX_TOKEN_SIZE]; + * } H5O_token_t; + * \endcode + * + * As an example, in the native VOL connector, the token stores an #haddr_t address and + * addresses can be converted to and from tokens using #H5VLnative_addr_to_token() + * and #H5VLnative_token_to_addr(). + * + * \code + * herr_t H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token) + * herr_t H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr) + * \endcode + * + * Several API calls have also been added to compare tokens and convert tokens + * to and from strings. + * + * \code + * herr_t H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, + * int *cmp_value) + * herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str) + * herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token) + * \endcode + * + * \subsubsection subsubsec_vol_adapt_api Specific API Call Substitutions + *

H5Fis_hdf5() → H5Fis_accessible()

+ * \ref H5Fis_hdf5() does not take a file access property list (fapl). As this is where the + * VOL connector is specified, this call cannot be used with arbitrary connectors. + * As a VOL-enabled replacement, \ref H5Fis_accessible() has been added to the + * library. It has the same semantics as \ref H5Fis_hdf5(), but takes a fapl so it can + * work with any VOL connector. + * + * Note that, at this time, \ref H5Fis_hdf5() always uses the native VOL connector, + * regardless of the settings of environment variables, etc. + * \code + * htri_t H5Fis_accessible(const char *container_name, hid_t fapl_id) + * \endcode + * + *

H5Oget_info[1|2]() → H5Oget_info3() and H5Oget_native_info()

+ * The \ref H5Oget_info1() and \ref H5Oget_info2() family of HDF5 API calls are often + * used by user code to obtain information about an object in the file, however + * these calls returned a struct which contained native information and are thus + * unsuitable for use with arbitrary VOL connectors. + * + * A new \ref H5Oget_info3() family of API calls has been added to the library which + * only return data model information via a new \ref H5O_info2_t struct. This struct + * also returns #H5O_token_t tokens in place of #haddr_t addresses. + * \code + * H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields) + * + * herr_t H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo, + * unsigned fields, hid_t lapl_id) + * herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, + * H5_iter_order_t order, hsize_t n, H5O_info2_t *oinfo, + * unsigned fields, hid_t lapl_id) + * \endcode + * + * \code + * typedef struct H5O_info2_t { + * unsigned long fileno; // File number that object is located in + * H5O_token_t token; // Token representing the object + * H5O_type_t type; // Basic object type (group, dataset, etc.) + * unsigned rc; // Reference count of object + * time_t atime; // Access time + * time_t mtime; // Modification time + * time_t ctime; // Change time + * time_t btime; // Birth time + * hsize_t num_attrs; // # of attributes attached to object + * } H5O_info2_t; + * \endcode + * + * To return the native file format information, \ref H5Oget_native_info() calls have + * been added which can return such data separate from the data model data. + * \code + * herr_t H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigned fields) + * + * herr_t H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo, + * unsigned fields, hid_t lapl_id) + * + * herr_t H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, + * H5_iter_order_t order, hsize_t n, H5O_native_info_t *oinfo, + * unsigned fields, hid_t lapl_id) + * \endcode + * + * \code + * typedef struct H5O_native_info_t { + * H5O_hdr_info_t hdr; // Object header information + * // Extra metadata storage for obj & attributes + * struct { + * H5_ih_info_t obj; // v1/v2 B-tree & local/fractal heap for groups, + * // B-tree for chunked datasets + * H5_ih_info_t attr; // v2 B-tree & heap for attributes + * } meta_size; + * } H5O_native_info_t; + * \endcode + * + *

H5Ovisit[1|2]() → H5Ovisit3()

+ * The callback used in the \ref H5Ovisit() family of API calls took an H5O info t + * struct parameter. As in \ref H5Oget_info(), this both commingled data model and + * native file format information and also used native HDF5 file addresses. + * + * New \ref H5Ovisit3() API calls have been created which use the token-based, data-model-only + * #H5O_info_t struct in the callback. + * + * \code + * herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op, + * void *op_data, unsigned fields) + * + * herr_t H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, + * H5_iter_order_t order, H5O_iterate2_t op, void *op_data, + * unsigned fields, hid_t lapl_id) + * \endcode + * + * \code + * typedef herr_t (*H5O_iterate2_t)(hid_t obj, const char *name, const H5O_info2_t *info, void *op_data) + * \endcode + * + *

H5Lget_info() → H5Lget_info2()

+ * The \ref H5Lget_info() API calls were updated to use tokens instead of addresses + * in the #H5L_info_t struct. + * \code + * herr_t H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo, hid_t lapl_id) + * + * herr_t H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, + * H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo, hid_t lapl_id) + * \endcode + * + * \code + * typedef struct { + * H5L_type_t type; // Type of link + * hbool_t corder_valid; // Indicate if creation order is valid + * int64_t corder; // Creation order + * H5T_cset_t cset; // Character set of link name + * union { + * H5O_token_t token; // Token of location that hard link points to + * size_t val_size; // Size of a soft link or UD link value + * } u; + * } H5L_info2_t; + * \endcode + * + *

H5Literate() and H5Lvisit() → H5Literte2() and H5Lvisit2()

+ * The callback used in these API calls used the old #H5L_info_t struct, which used + * addresses instead of tokens. These callbacks were versioned in the C library and + * now take modified #H5L_iterate2_t callbacks which use the new token-based info + * structs. + * \code + * herr_t H5Literate2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, + * H5L_iterate2_t op, void *op_data) + * + * herr_t H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, + * H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, + * void *op_data, hid_t lapl_id) + * + * herr_t H5Lvisit2(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, + * void *op_data) + * + * herr_t H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, + * H5_iter_order_t order, H5L_iterate2_t op, void *op_data, hid_t lapl_id) + * \endcode + * + * \code + * typedef herr_t (*H5L_iterate2_t)(hid_t group, const char *name, const H5L_info2_t *info, + * void *op_data); + * \endcode + * + *

H5Oopen by addr() → H5Oopen by token()

+ * The new \ref H5Oopen_by_token() API call can be used to open objects by the + * tokens that are returned by the various ”get info”, et al. API calls. + * \code + * hid_t H5Oopen_by_token(hid_t loc_id, H5O_token_t token) + * \endcode + * + * \subsubsection subsubsec_vol_adapt_native Protect Native-Only API Calls + * In HDF5 1.14.0, a way to determine support for optional calls has been added. + * \code + * herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t *flags) + * \endcode + * + * The call takes an object that is VOL managed (i.e.; file, group, dataset, attribute, + * object, committed datatype), the VOL subclass (an enum documented + * in H5VLpublic.h), an operation ”type” (discussed below), and an out parameter for the + * bitwise capabilities flags (also discussed below). Code that needs + * to protect a VOL-specific API call can call the function to see if the API + * call is supported, which will be reported via the flags. Specifically, if the + * #H5VL_OPT_QUERY_SUPPORTED bit is set, the feature is supported. The other flags + * are more useful for VOL connector authors than end users. + * + * In the case of the native VOL connector, the opt type operations are documented in + * H5VLnative.h. The current list of native operations is given at the + * end of this document, along with a list of native-only connector calls. + * + * \subsection subsec_vol_lang Language Wrappers + * Due to the parameter type and callback changes that were required in the + * C library API regarding the update from #haddr_t addresses to #H5O_token_t + * tokens and the difficulty in versioning the wrapper APIs, it was decided to + * update all of the wrappers to use tokens instead of addresses. This will allow + * the language wrappers to make use of the VOL, but at the expense of backward + * compatibility. + * + * Information on the C API changes can be found above. + * + * Affected API calls, by language: + * + * \subsubsection subsubsec_vol_lang_c C++ + *
    + *
  • The \b visit_operator_t callback now uses a #H5O_info2_t parameter instead of #H5O_info1_t + * so the callback can be passed to \ref H5Ovisit3() internally. This affects the H5Object::visit() + * method.
  • + *
  • The H5Location::getObjinfo() methods now take #H5O_info2_t parameters.
  • + *
  • The H5Location::getLinkInfo() methods now return #H5L_info2_t structs.
  • + *
  • H5File::isHdf5 uses \ref H5Fis_accessible(), though it always passes #H5P_DEFAULT + * as the fapl. It will only work with arbitrary VOL connectors if the default + * VOL connector is changed via the environment variable.
  • + *
+ * + * The C++ wrappers do not allow opening HDF5 file objects by address or token. + * + * The public H5VL API calls found in H5VLpublic.h were NOT added to the C++ API. + * + * \subsubsection subsubsec_vol_lang_fort Fortran + * As in the C API, these API calls had their structs updated to the token version + * so the h5o_info_t, etc. structs no longer contain native file format information + * and the callbacks will need to match the non-deprecated, token-enabled versions. + *
    + *
  • h5lget_info_f
  • + *
  • h5lget_info_by_idx f
  • + *
  • h5literate_f
  • + *
  • h5literate_by_name_f
  • + *
  • h5oget_info_f
  • + *
  • h5oget_info_by_idx_f
  • + *
  • h5oget_info_by_name_f
  • + *
  • h5oopen_by_token_f
  • + *
  • h5ovisit_f
  • + *
  • h5ovisit_by_name_f
  • + *
+ * + * Additionally, h5fis_hdf5_f was updated to use \ref H5Fis_accessible internally, + * though with the same caveat as the C++ implementation: the default fapl is + * always passed in so arbitrary VOL connectors will only work if the default VOL + * connector is changed via the environment variable. + * + * The public H5VL API calls found in H5VLpublic.h were also added to the + * Fortran wrappers. + * + * \subsubsection subsubsec_vol_lang_java Java/JNI + *
    + *
  • \ref H5Fis_hdf5 Will fail when the library is built without deprecated symbols.
  • + *
  • \ref H5Fis_accessible is available and takes a fapl, allowing it to work with + * arbitrary VOL connectors.
  • + *
  • The H5(O|L)get_info, H5(O|L)visit, and \ref H5Literate calls were updated as in the C library.
  • + *
  • \ref H5Oget_native_info_by_name et al. were added and they work as in the + * C library (e.g.: essentially native VOL connector only).
  • + *
  • \ref H5Oopen_by_addr was replaced with \ref H5Oopen_by_token.
  • + *
  • The public API calls in H5VLpublic.h were added to the JNI.
  • + *
+ * + * \subsection subsec_vol_cl Using VOL Connectors With The HDF5 Command-Line Tools + * The following command-line tools are VOL-aware and can be used with arbitrary VOL connectors: + * \li (p)h5diff + * \li h5dump + * \li h5ls + * \li h5mkgrp + * \li h5repack + * + * The VOL connector can be set either using the #HDF5_VOL_CONNECTOR environment variable + * (see above) or via the command line. Each of the above tools + * takes command-line options to set the VOL connector by name or value and + * the VOL connector string, usually in the form of + * \code + * --vol-(name|value|info) + * \endcode + * See the individual tool's help for the options specific to that tool. + * + * \subsection subsec_vol_compat Compatibility + * + * \subsubsection subsubsec_vol_compat_native List of HDF5 Native VOL API Calls + * These API calls will probably fail when used with terminal VOL connectors + * other than the native HDF5 file format connector. Their use should be protected + * in code that uses arbitrary VOL connectors. Note that some connectors may, in + * fact, implement some of this functionality as it is possible to mimic the native + * HDF5 connector, however this will probably not be true for most non-native + * VOL connectors. + * \snippet{doc} tables/volAPIs.dox vol_native_table + * + * \subsubsection subsubsec_vol_compat_indep List of HDF5 VOL-Independent API Calls + * These HDF5 API calls do not depend on a particular VOL connector being loaded. + * \snippet{doc} tables/volAPIs.dox vol_independent_table + * + * \subsubsection subsubsec_vol_compat_opt List of Native VOL Optional Operation Values By Subclass + * These values can be passed to the opt type parameter of H5VLquery optional(). + * \snippet{doc} tables/volAPIs.dox vol_optional_table + * + * + * + * Previous Chapter \ref sec_plist - Next Chapter \ref sec_async + * + */ + +/** + *\defgroup H5VL VOL connector (H5VL) * * \todo Describe the VOL plugin life cycle. * * \defgroup ASYNC Asynchronous Functions - * \brief Asynchronous Functions + * \brief List of the asynchronous functions. + * \note The argument \p es_id associated with the asynchronous APIs is the \Emph{event set id}. See H5ES for + *context. * * \defgroup H5VLDEF Definitions * \ingroup H5VL diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5VLnative_private.h b/externals/coda-oss/modules/drivers/hdf5/include/H5VLnative_private.h index 7746e616f9..c80c114a67 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5VLnative_private.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5VLnative_private.h @@ -61,10 +61,10 @@ H5_DLL void *H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *lo hid_t dapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, void **req); -H5_DLL herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, void **req); +H5_DLL herr_t H5VL__native_dataset_read(size_t count, void *obj[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, void *buf[], void **req); +H5_DLL herr_t H5VL__native_dataset_write(size_t count, void *obj[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, const void *buf[], void **req); H5_DLL herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, void **req); @@ -138,7 +138,7 @@ H5_DLL herr_t H5VL__native_object_optional(void *obj, const H5VL_loc_params_t *l /* Connector/container introspection functions */ H5_DLL herr_t H5VL__native_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); -H5_DLL herr_t H5VL__native_introspect_get_cap_flags(const void *info, unsigned *cap_flags); +H5_DLL herr_t H5VL__native_introspect_get_cap_flags(const void *info, uint64_t *cap_flags); H5_DLL herr_t H5VL__native_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, uint64_t *flags); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5VLprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5VLprivate.h index 12d6804e2b..5f73e74f87 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5VLprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5VLprivate.h @@ -74,7 +74,7 @@ H5_DLL herr_t H5VL_conn_copy(H5VL_connector_prop_t *value); H5_DLL int64_t H5VL_conn_inc_rc(H5VL_t *connector); H5_DLL int64_t H5VL_conn_dec_rc(H5VL_t *connector); H5_DLL herr_t H5VL_conn_free(const H5VL_connector_prop_t *info); -H5_DLL herr_t H5VL_get_cap_flags(const H5VL_connector_prop_t *prop, unsigned *cap_flags); +H5_DLL herr_t H5VL_get_cap_flags(const H5VL_connector_prop_t *prop, uint64_t *cap_flags); /* Functions that deal with VOL connectors */ union H5PL_key_t; @@ -177,10 +177,18 @@ H5_DLL void *H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_p hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); H5_DLL void *H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t dxpl_id, void *buf, void **req); -H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req); +H5_DLL herr_t H5VL_dataset_read(size_t count, const H5VL_object_t *vol_obj[], hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, void *buf[], + void **req); +H5_DLL herr_t H5VL_dataset_read_direct(size_t count, void *obj[], H5VL_t *connector, hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, + void *buf[], void **req); +H5_DLL herr_t H5VL_dataset_write(size_t count, const H5VL_object_t *vol_obj[], hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, + const void *buf[], void **req); +H5_DLL herr_t H5VL_dataset_write_direct(size_t count, void *obj[], H5VL_t *connector, hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, + const void *buf[], void **req); H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_args_t *args, @@ -266,7 +274,7 @@ H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, const H5VL_loc_ /* Connector/container introspection functions */ H5_DLL herr_t H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); -H5_DLL herr_t H5VL_introspect_get_cap_flags(const void *info, const H5VL_class_t *cls, unsigned *cap_flags); +H5_DLL herr_t H5VL_introspect_get_cap_flags(const void *info, const H5VL_class_t *cls, uint64_t *cap_flags); H5_DLL herr_t H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, int opt_type, uint64_t *flags); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5VLpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5VLpublic.h index 543c3c8d06..30a2b5dd62 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5VLpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5VLpublic.h @@ -17,9 +17,8 @@ #ifndef H5VLpublic_H #define H5VLpublic_H -/* Public headers needed by this file */ -#include "H5public.h" /* Generic Functions */ -#include "H5Ipublic.h" /* IDs */ +#include "H5public.h" /* Generic Functions */ +#include "H5Ipublic.h" /* Identifiers */ /*****************/ /* Public Macros */ @@ -27,14 +26,14 @@ /** * \ingroup H5VLDEF - * \brief Version # of VOL class struct & callbacks + * \brief Version number of VOL class struct & callbacks * * \details Each VOL connector must set the 'version' field in the H5VL_class_t * struct to the version of the H5VL_class_t struct that the connector * implements. The HDF5 library will reject connectors with * incompatible structs. */ -#define H5VL_VERSION 2 +#define H5VL_VERSION 3 /* VOL connector identifier values * These are H5VL_class_value_t values, NOT hid_t values! @@ -60,24 +59,72 @@ */ #define H5_VOL_MAX 65535 -/* Flags to return from H5VLquery_optional API and 'opt_query' callbacks */ -/* Note: Operations which access multiple objects' data or metadata in a - * container should be registered as file-level optional operations. - * (e.g. "H5Dwrite_multi" takes a list of datasets to write data to, so - * a VOL connector that implemented it should register it as an optional - * file operation, and pass-through VOL connectors that are stacked above - * the connector that registered it should assume that dataset elements - * for _any_ dataset in the file could be written to) +/* + * Capability flags for VOL connectors */ -#define H5VL_OPT_QUERY_SUPPORTED 0x0001 /* VOL connector supports this operation */ -#define H5VL_OPT_QUERY_READ_DATA 0x0002 /* Operation reads data for object */ -#define H5VL_OPT_QUERY_WRITE_DATA 0x0004 /* Operation writes data for object */ -#define H5VL_OPT_QUERY_QUERY_METADATA 0x0008 /* Operation reads metadata for object */ -#define H5VL_OPT_QUERY_MODIFY_METADATA 0x0010 /* Operation modifies metadata for object */ +#define H5VL_CAP_FLAG_NONE 0x0000000000000000 /**< No special connector capabilities */ +#define H5VL_CAP_FLAG_THREADSAFE 0x0000000000000001 /**< Connector is threadsafe */ +#define H5VL_CAP_FLAG_ASYNC 0x0000000000000002 /**< Connector performs operations asynchronously*/ +#define H5VL_CAP_FLAG_NATIVE_FILES 0x0000000000000004 /**< Connector produces native file format */ +#define H5VL_CAP_FLAG_ATTR_BASIC 0x0000000000000008 /**< H5A create/delete/exists/open/close/read/write */ +#define H5VL_CAP_FLAG_ATTR_MORE 0x0000000000000010 /**< All other H5A API calls */ +#define H5VL_CAP_FLAG_DATASET_BASIC 0x0000000000000020 /**< H5D create/open/close/read/write */ +#define H5VL_CAP_FLAG_DATASET_MORE 0x0000000000000040 /**< All other H5D API calls */ +#define H5VL_CAP_FLAG_FILE_BASIC 0x0000000000000080 /**< H5F create/open/close/read/write */ +#define H5VL_CAP_FLAG_FILE_MORE 0x0000000000000100 /**< All other H5F API calls */ +#define H5VL_CAP_FLAG_GROUP_BASIC 0x0000000000000200 /**< H5G create/open/close */ +#define H5VL_CAP_FLAG_GROUP_MORE 0x0000000000000400 /**< All other H5G API calls*/ +#define H5VL_CAP_FLAG_LINK_BASIC 0x0000000000000800 /**< H5L exists/delete */ +#define H5VL_CAP_FLAG_LINK_MORE 0x0000000000001000 /**< All other H5L API calls */ +#define H5VL_CAP_FLAG_MAP_BASIC \ + 0x0000000000002000 /**< H5M create/open/close/get*type/get_count/put/get/exists/delete */ +#define H5VL_CAP_FLAG_MAP_MORE 0x0000000000004000 /**< All other H5M API calls */ +#define H5VL_CAP_FLAG_OBJECT_BASIC 0x0000000000008000 /**< H5O open/close/exists */ +#define H5VL_CAP_FLAG_OBJECT_MORE 0x0000000000010000 /**< All other H5O API calls */ +#define H5VL_CAP_FLAG_REF_BASIC 0x0000000000020000 /**< H5Rdestroy */ +#define H5VL_CAP_FLAG_REF_MORE 0x0000000000040000 /**< All other H5R API calls */ +#define H5VL_CAP_FLAG_OBJ_REF 0x0000000000080000 /**< Connector supports object references */ +#define H5VL_CAP_FLAG_REG_REF 0x0000000000100000 /**< Connector supports regional references */ +#define H5VL_CAP_FLAG_ATTR_REF 0x0000000000200000 /**< Connector supports attribute references */ +#define H5VL_CAP_FLAG_STORED_DATATYPES 0x0000000000400000 /**< Connector supports stored datatypes */ +#define H5VL_CAP_FLAG_CREATION_ORDER 0x0000000000800000 /**< Connector tracks creation order */ +#define H5VL_CAP_FLAG_ITERATE 0x0000000001000000 /**< Connector supports iteration functions */ +#define H5VL_CAP_FLAG_STORAGE_SIZE 0x0000000002000000 /**< Connector can return a meaningful storage size */ +#define H5VL_CAP_FLAG_BY_IDX 0x0000000004000000 /**< "by index" API calls are supported */ +#define H5VL_CAP_FLAG_GET_PLIST \ + 0x0000000008000000 /**< Connector can return the property lists used to create an object */ +#define H5VL_CAP_FLAG_FLUSH_REFRESH 0x0000000010000000 /**< flush/refresh calls are supported */ +#define H5VL_CAP_FLAG_EXTERNAL_LINKS 0x0000000020000000 /**< External links are supported */ +#define H5VL_CAP_FLAG_HARD_LINKS 0x0000000040000000 /**< Hard links are supported */ +#define H5VL_CAP_FLAG_SOFT_LINKS 0x0000000080000000 /**< Soft links are supported */ +#define H5VL_CAP_FLAG_UD_LINKS 0x0000000100000000 /**< User-defined links are supported */ +#define H5VL_CAP_FLAG_TRACK_TIMES 0x0000000200000000 /**< Connector tracks creation, etc. times */ +#define H5VL_CAP_FLAG_MOUNT 0x0000000400000000 /**< H5Fmount/unmount supported */ +#define H5VL_CAP_FLAG_FILTERS 0x0000000800000000 /**< Connector implements a filter pipeline */ +#define H5VL_CAP_FLAG_FILL_VALUES 0x0000001000000000 /**< Connector allows fill values to be set */ + +/** + * \ingroup H5VLDEF + * + * Flags to return from H5VLquery_optional API and 'opt_query' callbacks + * + * \details Operations which access multiple objects' data or metadata in a + * container should be registered as file-level optional operations. + * (e.g. "H5Dwrite_multi" takes a list of datasets to write data to, so + * a VOL connector that implemented it should register it as an optional + * file operation, and pass-through VOL connectors that are stacked above + * the connector that registered it should assume that dataset elements + * for _any_ dataset in the file could be written to) + */ +#define H5VL_OPT_QUERY_SUPPORTED 0x0001 /**< VOL connector supports this operation */ +#define H5VL_OPT_QUERY_READ_DATA 0x0002 /**< Operation reads data for object */ +#define H5VL_OPT_QUERY_WRITE_DATA 0x0004 /**< Operation writes data for object */ +#define H5VL_OPT_QUERY_QUERY_METADATA 0x0008 /**< Operation reads metadata for object */ +#define H5VL_OPT_QUERY_MODIFY_METADATA 0x0010 /**< Operation modifies metadata for object */ #define H5VL_OPT_QUERY_COLLECTIVE \ - 0x0020 /* Operation is collective (operations without this flag are assumed to be independent) */ -#define H5VL_OPT_QUERY_NO_ASYNC 0x0040 /* Operation may NOT be executed asynchronously */ -#define H5VL_OPT_QUERY_MULTI_OBJ 0x0080 /* Operation involves multiple objects */ + 0x0020 /**< Operation is collective (operations without this flag are assumed to be independent) */ +#define H5VL_OPT_QUERY_NO_ASYNC 0x0040 /**< Operation may NOT be executed asynchronously */ +#define H5VL_OPT_QUERY_MULTI_OBJ 0x0080 /**< Operation involves multiple objects */ /*******************/ /* Public Typedefs */ @@ -353,7 +400,7 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id); * \param[out] flags Operation flags * \return \herr_t * - * \since 1.12.0 + * \since 1.12.1 */ H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t *flags); /** @@ -361,12 +408,11 @@ H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_t * \brief Determines whether an object ID represents a native * VOL connector object. * - * \param[in] obj_id Object identifier - * \param[in] is_native Boolean determining whether object is a native - * VOL connector object + * \obj_id + * \param[out] is_native Boolean determining whether object is a native VOL connector object * \return \herr_t * - * \since 1.13.0 + * \since 1.12.2 */ H5_DLL herr_t H5VLobject_is_native(hid_t obj_id, hbool_t *is_native); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5VMprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5VMprivate.h index e22e55ab36..aa1c0f16bd 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5VMprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5VMprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,10 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Robb Matzke - * Friday, October 10, 1997 - */ #ifndef H5VMprivate_H #define H5VMprivate_H @@ -40,50 +35,50 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off, size_t len, /* Other functions */ #define H5VM_vector_cpy(N, DST, SRC) \ - { \ - HDassert(sizeof(*(DST)) == sizeof(*(SRC))); \ + do { \ + assert(sizeof(*(DST)) == sizeof(*(SRC))); \ if (SRC) \ H5MM_memcpy(DST, SRC, (N) * sizeof(*(DST))); \ else \ - HDmemset(DST, 0, (N) * sizeof(*(DST))); \ - } + memset(DST, 0, (N) * sizeof(*(DST))); \ + } while (0) -#define H5VM_vector_zero(N, DST) HDmemset(DST, 0, (N) * sizeof(*(DST))) +#define H5VM_vector_zero(N, DST) memset(DST, 0, (N) * sizeof(*(DST))) /* Given a coordinate offset array (COORDS) of type TYPE, move the unlimited * dimension (UNLIM_DIM) value to offset 0, sliding any intermediate values down * one position. */ #define H5VM_swizzle_coords(TYPE, COORDS, UNLIM_DIM) \ - { \ + do { \ /* COORDS must be an array of type TYPE */ \ - HDassert(sizeof(COORDS[0]) == sizeof(TYPE)); \ + assert(sizeof(COORDS[0]) == sizeof(TYPE)); \ \ /* Nothing to do when unlimited dimension is at position 0 */ \ if (0 != (UNLIM_DIM)) { \ TYPE _tmp = (COORDS)[UNLIM_DIM]; \ \ - HDmemmove(&(COORDS)[1], &(COORDS)[0], sizeof(TYPE) * (UNLIM_DIM)); \ + memmove(&(COORDS)[1], &(COORDS)[0], sizeof(TYPE) * (UNLIM_DIM)); \ (COORDS)[0] = _tmp; \ } /* end if */ \ - } + } while (0) /* Given a coordinate offset array (COORDS) of type TYPE, move the value at * offset 0 to offset of the unlimied dimension (UNLIM_DIM), sliding any * intermediate values up one position. Undoes the "swizzle_coords" operation. */ #define H5VM_unswizzle_coords(TYPE, COORDS, UNLIM_DIM) \ - { \ + do { \ /* COORDS must be an array of type TYPE */ \ - HDassert(sizeof(COORDS[0]) == sizeof(TYPE)); \ + assert(sizeof(COORDS[0]) == sizeof(TYPE)); \ \ /* Nothing to do when unlimited dimension is at position 0 */ \ if (0 != (UNLIM_DIM)) { \ TYPE _tmp = (COORDS)[0]; \ \ - HDmemmove(&(COORDS)[0], &(COORDS)[1], sizeof(TYPE) * (UNLIM_DIM)); \ + memmove(&(COORDS)[0], &(COORDS)[1], sizeof(TYPE) * (UNLIM_DIM)); \ (COORDS)[UNLIM_DIM] = _tmp; \ } /* end if */ \ - } + } while (0) /* A null pointer is equivalent to a zero vector */ #define H5VM_ZERO NULL @@ -134,13 +129,8 @@ H5_DLL ssize_t H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_s * only as an optimization and the naming (with a single underscore) * reflects its inclusion in a "private" header file. * - * Return: Success: Product of elements - * - * Failure: 1 if N is zero - * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * + * Return: Success: Product of elements + * Failure: 1 if N is zero *------------------------------------------------------------------------- */ static inline hsize_t H5_ATTR_UNUSED @@ -152,7 +142,7 @@ H5VM_vector_reduce_product(unsigned n, const hsize_t *v) FUNC_ENTER_NOAPI_NOINIT_NOERR if (n && !v) - HGOTO_DONE(0) + HGOTO_DONE(0); while (n--) ret_value *= *v++; @@ -169,14 +159,8 @@ H5VM_vector_reduce_product(unsigned n, const hsize_t *v) * only as an optimization and the naming (with a single underscore) * reflects its inclusion in a "private" header file. * - * Return: Success: TRUE if all elements are zero, - * FALSE otherwise - * - * Failure: TRUE if N is zero - * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * + * Return: Success: TRUE if all elements are zero, + * Failure: TRUE if N is zero *------------------------------------------------------------------------- */ static inline htri_t H5_ATTR_UNUSED @@ -188,10 +172,10 @@ H5VM_vector_zerop_u(int n, const hsize_t *v) FUNC_ENTER_NOAPI_NOINIT_NOERR if (!v) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); while (n--) if (*v++) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -206,14 +190,9 @@ H5VM_vector_zerop_u(int n, const hsize_t *v) * only as an optimization and the naming (with a single underscore) * reflects its inclusion in a "private" header file. * - * Return: Success: TRUE if all elements are zero, - * FALSE otherwise - * - * Failure: TRUE if N is zero - * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * + * Return: Success: TRUE if all elements are zero, + * FALSE otherwise + * Failure: TRUE if N is zero *------------------------------------------------------------------------- */ static inline htri_t H5_ATTR_UNUSED @@ -225,10 +204,10 @@ H5VM_vector_zerop_s(int n, const hssize_t *v) FUNC_ENTER_NOAPI_NOINIT_NOERR if (!v) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); while (n--) if (*v++) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -244,15 +223,11 @@ H5VM_vector_zerop_s(int n, const hssize_t *v) * only as an optimization and the naming (with a single underscore) * reflects its inclusion in a "private" header file. * - * Return: Success: -1 if V1 is less than V2 - * 0 if they are equal - * 1 if V1 is greater than V2 - * - * Failure: 0 if N is zero - * - * Programmer: Robb Matzke - * Friday, October 10, 1997 + * Return: Success: -1 if V1 is less than V2 + * 0 if they are equal + * 1 if V1 is greater than V2 * + * Failure: 0 if N is zero *------------------------------------------------------------------------- */ static inline int H5_ATTR_UNUSED @@ -264,16 +239,16 @@ H5VM_vector_cmp_u(unsigned n, const hsize_t *v1, const hsize_t *v2) FUNC_ENTER_NOAPI_NOINIT_NOERR if (v1 == v2) - HGOTO_DONE(0) + HGOTO_DONE(0); if (v1 == NULL) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (v2 == NULL) - HGOTO_DONE(1) + HGOTO_DONE(1); while (n--) { if (*v1 < *v2) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (*v1 > *v2) - HGOTO_DONE(1) + HGOTO_DONE(1); v1++; v2++; } @@ -292,15 +267,11 @@ H5VM_vector_cmp_u(unsigned n, const hsize_t *v1, const hsize_t *v2) * only as an optimization and the naming (with a single underscore) * reflects its inclusion in a "private" header file. * - * Return: Success: -1 if V1 is less than V2 - * 0 if they are equal - * 1 if V1 is greater than V2 - * - * Failure: 0 if N is zero - * - * Programmer: Robb Matzke - * Wednesday, April 8, 1998 + * Return: Success: -1 if V1 is less than V2 + * 0 if they are equal + * 1 if V1 is greater than V2 * + * Failure: 0 if N is zero *------------------------------------------------------------------------- */ static inline int H5_ATTR_UNUSED @@ -312,16 +283,16 @@ H5VM_vector_cmp_s(unsigned n, const hssize_t *v1, const hssize_t *v2) FUNC_ENTER_NOAPI_NOINIT_NOERR if (v1 == v2) - HGOTO_DONE(0) + HGOTO_DONE(0); if (v1 == NULL) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (v2 == NULL) - HGOTO_DONE(1) + HGOTO_DONE(1); while (n--) { if (*v1 < *v2) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (*v1 > *v2) - HGOTO_DONE(1) + HGOTO_DONE(1); v1++; v2++; } @@ -340,10 +311,6 @@ H5VM_vector_cmp_s(unsigned n, const hssize_t *v1, const hssize_t *v2) * reflects its inclusion in a "private" header file. * * Return: void - * - * Programmer: Robb Matzke - * Monday, October 13, 1997 - * *------------------------------------------------------------------------- */ static inline void H5_ATTR_UNUSED @@ -384,10 +351,6 @@ static const unsigned char LogTable256[] = { * reflects its inclusion in a "private" header file. * * Return: log2(n) (always - no failure condition) - * - * Programmer: Quincey Koziol - * Monday, March 6, 2006 - * *------------------------------------------------------------------------- */ static inline unsigned H5_ATTR_UNUSED @@ -433,17 +396,13 @@ static const unsigned MultiplyDeBruijnBitPosition[32] = {0, 1, 28, 2, 29, 14, * reflects its inclusion in a "private" header file. * * Return: log2(n) (always - no failure condition) - * - * Programmer: Quincey Koziol - * Monday, February 27, 2006 - * *------------------------------------------------------------------------- */ static inline H5_ATTR_PURE unsigned H5VM_log2_of2(uint32_t n) { #ifndef NDEBUG - HDassert(POWER_OF_TWO(n)); + assert(POWER_OF_TWO(n)); #endif /* NDEBUG */ return (MultiplyDeBruijnBitPosition[(n * (uint32_t)0x077CB531UL) >> 27]); } /* H5VM_log2_of2() */ @@ -451,16 +410,13 @@ H5VM_log2_of2(uint32_t n) /*------------------------------------------------------------------------- * Function: H5VM_power2up * - * Purpose: Round up a number to the next power of 2 + * Purpose: Round up a number to the next power of 2 * * Note: Although this routine is 'static' in this file, that's intended * only as an optimization and the naming (with a single underscore) * reflects its inclusion in a "private" header file. * - * Return: Return the number which is a power of 2 - * - * Programmer: Vailin Choi; Nov 2014 - * + * Return: Return the number which is a power of 2 *------------------------------------------------------------------------- */ static inline H5_ATTR_CONST hsize_t @@ -489,10 +445,6 @@ H5VM_power2up(hsize_t n) * reflects its inclusion in a "private" header file. * * Return: Number of bytes needed - * - * Programmer: Quincey Koziol - * Thursday, March 13, 2008 - * *------------------------------------------------------------------------- */ static inline unsigned H5_ATTR_UNUSED @@ -521,10 +473,6 @@ static const unsigned char H5VM_bit_clear_g[8] = {0x7F, 0xBF, 0xDF, 0xEF, 0xF7, * reflects its inclusion in a "private" header file. * * Return: TRUE/FALSE - * - * Programmer: Quincey Koziol - * Tuesday, November 25, 2008 - * *------------------------------------------------------------------------- */ static inline hbool_t H5_ATTR_UNUSED @@ -550,11 +498,7 @@ H5VM_bit_get(const unsigned char *buf, size_t offset) * only as an optimization and the naming (with a single underscore) * reflects its inclusion in a "private" header file. * - * Return: None - * - * Programmer: Quincey Koziol - * Tuesday, November 25, 2008 - * + * Return: void *------------------------------------------------------------------------- */ static inline void H5_ATTR_UNUSED diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5VarLenType.h b/externals/coda-oss/modules/drivers/hdf5/include/H5VarLenType.h index a8d05041cf..318681aca3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5VarLenType.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5VarLenType.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5WBprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5WBprivate.h index c1f74ee732..74b3900927 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5WBprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5WBprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5WBprivate.h - * Jun 26 2007 - * Quincey Koziol * * Purpose: Private header for library accessible wrapped buffer routines. * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Zdevelop.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Zdevelop.h index a7f332b1d3..736c2830ef 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Zdevelop.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Zdevelop.h @@ -2,10 +2,10 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -218,21 +218,21 @@ extern "C" { * used instead of the literal values. * * \c encoder_present is a library-defined value indicating whether - * the filter’s encoding capability is available to the application. + * the filter's encoding capability is available to the application. * * \c decoder_present is a library-defined value indicating whether - * the filter’s encoding capability is available to the application. + * the filter's encoding capability is available to the application. * * \c name is a descriptive comment used for debugging, may contain a * descriptive name for the filter, and may be the null pointer. * * \c can_apply, described in detail below, is a user-defined callback - * function which determines whether the combination of the dataset + * function that determines whether the combination of the dataset * creation property list values, the datatype, and the dataspace * represent a valid combination to apply this filter to. * * \c set_local, described in detail below, is a user-defined callback - * function which sets any parameters that are specific to this + * function that sets any parameters that are specific to this * dataset, based on the combination of the dataset creation property * list values, the datatype, and the dataspace. * @@ -242,9 +242,9 @@ extern "C" { * The statistics associated with a filter are not reset by this * function; they accumulate over the life of the library. * - * #H5Z_class_t is a macro which maps to either H5Z_class1_t or + * #H5Z_class_t is a macro that maps to either H5Z_class1_t or * H5Z_class2_t, depending on the needs of the application. To affect - * only this macro, H5Z_class_t_vers may be defined to either 1 or 2. + * only this macro, H5Z_class_t_vers may be defined as either 1 or 2. * Otherwise, it will behave in the same manner as other API * compatibility macros. See API Compatibility Macros in HDF5 for more * information. H5Z_class1_t matches the #H5Z_class_t structure that is @@ -261,15 +261,15 @@ extern "C" { * defined as described in the HDF5 library header file H5Zpublic.h. * * When a filter is applied to the fractal heap for a group (e.g., - * when compressing group metadata) and if the can apply and set local - * callback functions have been defined for that filter, HDF5 passes + * when compressing group metadata) and if they can apply and set local + * callback functions that have been defined for that filter, HDF5 passes * the value -1 for all parameters for those callback functions. This * is done to ensure that the filter will not be applied to groups if * it relies on these parameters, as they are not applicable to group * fractal heaps; to operate on group fractal heaps, a filter must be * capable of operating on an opaque block of binary data. * - * The \Emph{can apply} callback function must return a positive value + * The \Emph{can-apply} callback function must return a positive value * for a valid combination, zero for an invalid combination, and a * negative value for an error. * \snippet this H5Z_can_apply_func_t_snip @@ -302,9 +302,9 @@ extern "C" { * \Emph{set local} callback functions for any filters used in the * dataset creation property list are called. These callbacks receive * \c dcpl_id, the dataset's private copy of the dataset creation - * property list passed in to H5Dcreate() (i.e. not the actual - * property list passed in to H5Dcreate()); \c type_id, the datatype - * identifier passed in to H5Dcreate(), which is not copied and should + * property list passed into H5Dcreate() (i.e. not the actual + * property list passed into H5Dcreate()); \c type_id, the datatype + * identifier passed into H5Dcreate(), which is not copied and should * not be modified; and \c space_id, a dataspace describing the chunk * (for chunked dataset storage), which should also not be modified. * @@ -345,22 +345,13 @@ extern "C" { * will work in many cases, but if there is a mismatch between the * memory allocators used in the library and any filter that * reallocates a buffer, there could be problems. This is most often - * the case with Windows and/or when debug memory allocators are being + * the case with Windows and/or when debugging memory allocators are being * used. In both cases, the "state" of the memory allocator lies in * different libraries and will get corrupted if you allocate in one * library and free in another. Windows adds the C standard library - * via dlls that can vary with Visual Studio version and debug vs + * via dlls that can vary with Visual Studio version and debug vs. * release builds. Static links to the MSVC CRT can also introduce - * new memory allocator state. - * - * Note that the HDF5 library enabled memory sanity checks by default - * in debug builds for many years. The heap canaries introduced to - * buffers by this mechanism would cause problems when filters - * attempted to reallocate these buffers. The sanity checks are no - * longer enabled by default in any configuration. When in doubt, - * memory sanity checking can be disabled explicitly by configuring - * with `--disable-memory-alloc-sanity-check` in the Autotools or - * setting `HDF5_MEMORY_ALLOC_SANITY_CHECK` to `OFF` in CMake. + * a new memory allocator state. * * The library does provide H5allocate_memory() and H5free_memory() * functions that will use the library's allocation and free functions, @@ -407,7 +398,7 @@ H5_DLL herr_t H5Zregister(const void *cls); * sure that all cached data that may use this filter are written out. * * If the application is a parallel program, all processes that - * participate in collective data write should call this function to + * participate in collective data writing should call this function to * ensure that all data is flushed. * * After a call to H5Zunregister(), the filter specified in filter diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Zmodule.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Zmodule.h index 338242ebf8..8b1a0dedc4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Zmodule.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Zmodule.h @@ -11,12 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Saturday, September 12, 2015 - * - * Purpose: This file contains declarations which define macros for the - * H5Z package. Including this header means that the source file - * is part of the H5Z package. + * Purpose: This file contains declarations which define macros for the + * H5Z package. Including this header means that the source file + * is part of the H5Z package. */ #ifndef H5Zmodule_H #define H5Zmodule_H @@ -28,7 +25,12 @@ #define H5_MY_PKG H5Z #define H5_MY_PKG_ERR H5E_PLINE -/**\defgroup H5Z H5Z +/** \page H5Z_UG The HDF5 Filters + * @todo Under Construction + */ + +/** + * \defgroup H5Z Filters (H5Z) * * Use the functions in this module to manage HDF5 filters. * @@ -79,7 +81,7 @@ * * The HDF5 library does not support filters for contiguous datasets because of * the difficulty of implementing random access for partial I/O. Compact dataset - * filters are not supported because it would not produce significant results. + * filters are not supported because they would not produce significant results. * * Filter identifiers for the filters distributed with the HDF5 * Library are as follows: diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Zpkg.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Zpkg.h index 726478a088..e5660e70d3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Zpkg.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Zpkg.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Zprivate.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Zprivate.h index 764f4cc72c..166273805b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Zprivate.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Zprivate.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,10 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Thursday, April 16, 1998 - */ - #ifndef H5Zprivate_H #define H5Zprivate_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5Zpublic.h b/externals/coda-oss/modules/drivers/hdf5/include/H5Zpublic.h index 5d04c9a993..6d9b991422 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5Zpublic.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5Zpublic.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,15 +10,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Thursday, April 16, 1998 - */ - #ifndef H5Zpublic_H #define H5Zpublic_H -/* Public headers needed by this file */ -#include "H5public.h" +#include "H5public.h" /* Generic Functions */ /** * \brief Filter identifiers @@ -269,7 +263,7 @@ H5_DLL htri_t H5Zfilter_avail(H5Z_filter_t id); * \details H5Zget_filter_info() retrieves information about a filter. At * present, this means that the function retrieves a filter's * configuration flags, indicating whether the filter is configured to - * decode data, to encode data, neither, or both. + * decode data, encode data, neither, or both. * * If \p filter_config_flags is not set to NULL prior to the function * call, the returned parameter contains a bit field specifying the @@ -306,8 +300,8 @@ H5_DLL htri_t H5Zfilter_avail(H5Z_filter_t id); * to read an existing file encoded with that filter. * * This function should be called, and the returned \p - * filter_config_flags analyzed, before calling any other function, - * such as H5Pset_szip() , that might require a particular filter + * filter_config_flags should be analyzed, before calling any other function, + * such as H5Pset_szip(), that might require a particular filter * configuration. * * \since 1.6.3 diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5api_adpt.h b/externals/coda-oss/modules/drivers/hdf5/include/H5api_adpt.h index 53080b775a..a9c34ae253 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5api_adpt.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5api_adpt.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,7 +13,6 @@ /* * H5api_adpt.h * Used for the HDF5 dll project - * Created by Patrick Lu on 1/12/99 */ #ifndef H5API_ADPT_H #define H5API_ADPT_H diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5config.h b/externals/coda-oss/modules/drivers/hdf5/include/H5config.h new file mode 100644 index 0000000000..9b9c682ec3 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5config.h @@ -0,0 +1,626 @@ +/* src/H5config.h. Generated from H5config.h.in by configure. */ +/* src/H5config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define if this is a debug build. */ +/* #undef DEBUG_BUILD */ + +/* Define the default plugins path to compile */ +#define DEFAULT_PLUGINDIR "/usr/local/hdf5/lib/plugin" + +/* Define if dev_t is a scalar */ +#define DEV_T_IS_SCALAR 1 + +/* Define if new references for dimension scales were requested */ +/* #undef DIMENSION_SCALES_WITH_NEW_REF */ + +/* Define if your system is IBM ppc64le and cannot convert some long double + values correctly. */ +/* #undef DISABLE_SOME_LDOUBLE_CONV */ + +/* Define the examples directory */ +#define EXAMPLESDIR "${prefix}/share/hdf5_examples" + +/* Define to dummy `main' function (if any) required to link to the Fortran + libraries. */ +/* #undef FC_DUMMY_MAIN */ + +/* Define if F77 and FC dummy `main' functions are identical. */ +/* #undef FC_DUMMY_MAIN_EQ_F77 */ + +/* Define to a macro mangling the given C identifier (in lower and upper + case), which must not contain underscores, for linking with Fortran. */ +/* #undef FC_FUNC */ + +/* As FC_FUNC, but for C identifiers containing underscores. */ +/* #undef FC_FUNC_ */ + +/* Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE */ +/* #undef FORTRAN_C_LONG_DOUBLE_IS_UNIQUE */ + +/* Define if we have Fortran C_LONG_DOUBLE */ +/* #undef FORTRAN_HAVE_C_LONG_DOUBLE */ + +/* Define if we have Fortran intrinsic C_SIZEOF */ +/* #undef FORTRAN_HAVE_C_SIZEOF */ + +/* Define if we have Fortran intrinsic SIZEOF */ +/* #undef FORTRAN_HAVE_SIZEOF */ + +/* Define if we have Fortran intrinsic STORAGE_SIZE */ +/* #undef FORTRAN_HAVE_STORAGE_SIZE */ + +/* Determine the size of C long double */ +/* #undef FORTRAN_SIZEOF_LONG_DOUBLE */ + +/* Define Fortran compiler ID */ +/* #undef Fortran_COMPILER_ID */ + +/* Define valid Fortran INTEGER KINDs */ +/* #undef H5CONFIG_F_IKIND */ + +/* Define number of valid Fortran INTEGER KINDs */ +/* #undef H5CONFIG_F_NUM_IKIND */ + +/* Define number of valid Fortran REAL KINDs */ +/* #undef H5CONFIG_F_NUM_RKIND */ + +/* Define valid Fortran REAL KINDs */ +/* #undef H5CONFIG_F_RKIND */ + +/* Define valid Fortran REAL KINDs Sizeof */ +/* #undef H5CONFIG_F_RKIND_SIZEOF */ + +/* Define to 1 if you have the `alarm' function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the `asprintf' function. */ +#define HAVE_ASPRINTF 1 + +/* Define if the __attribute__(()) extension is present */ +#define HAVE_ATTRIBUTE 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define if has CLOCK_MONOTONIC_COARSE */ +/* #undef HAVE_CLOCK_MONOTONIC_COARSE */ + +/* Define if the function stack tracing code is to be compiled in */ +/* #undef HAVE_CODESTACK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_CURL_CURL_H */ + +/* Define if Darwin or Mac OS X */ +/* #undef HAVE_DARWIN */ + +/* Define if the direct I/O virtual file driver (VFD) should be compiled */ +/* #undef HAVE_DIRECT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define if library information should be embedded in the executables */ +#define HAVE_EMBEDDED_LIBINFO 1 + +/* Define to 1 if you have the `fcntl' function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FEATURES_H 1 + +/* Define if support for deflate (zlib) filter is enabled */ +#define HAVE_FILTER_DEFLATE 1 + +/* Define if support for szip filter is enabled */ +/* #undef HAVE_FILTER_SZIP */ + +/* Determine if __float128 is available */ +/* #undef HAVE_FLOAT128 */ + +/* Define to 1 if you have the `flock' function. */ +#define HAVE_FLOCK 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Determine if INTEGER*16 is available */ +/* #undef HAVE_Fortran_INTEGER_SIZEOF_16 */ + +/* Define to 1 if you have the `GetConsoleScreenBufferInfo' function. */ +/* #undef HAVE_GETCONSOLESCREENBUFFERINFO */ + +/* Define to 1 if you have the `gethostname' function. */ +#define HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have the `getpwuid' function. */ +#define HAVE_GETPWUID 1 + +/* Define to 1 if you have the `getrusage' function. */ +#define HAVE_GETRUSAGE 1 + +/* Define to 1 if you have the `gettextinfo' function. */ +/* #undef HAVE_GETTEXTINFO */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_HDFS_H */ + +/* Define if parallel library will contain instrumentation to detect correct + optimization operation */ +/* #undef HAVE_INSTRUMENTED_LIBRARY */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `ioctl' function. */ +#define HAVE_IOCTL 1 + +/* Define if the I/O Concentrator virtual file driver (VFD) should be compiled + */ +/* #undef HAVE_IOC_VFD */ + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +/* #undef HAVE_LIBCRYPTO */ + +/* Define to 1 if you have the `curl' library (-lcurl). */ +/* #undef HAVE_LIBCURL */ + +/* Define to 1 if you have the `dl' library (-ldl). */ +#define HAVE_LIBDL 1 + +/* Proceed to build with libhdfs */ +/* #undef HAVE_LIBHDFS */ + +/* Define to 1 if you have the `jvm' library (-ljvm). */ +/* #undef HAVE_LIBJVM */ + +/* Define to 1 if you have the `m' library (-lm). */ +#define HAVE_LIBM 1 + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +/* #undef HAVE_LIBPTHREAD */ + +/* Define to 1 if you have the `sz' library (-lsz). */ +/* #undef HAVE_LIBSZ */ + +/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ +/* #undef HAVE_LIBWS2_32 */ + +/* Define to 1 if you have the `z' library (-lz). */ +#define HAVE_LIBZ 1 + +/* Define if the map API (H5M) should be compiled */ +/* #undef HAVE_MAP_API */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MFU_H */ + +/* Define if using MinGW */ +/* #undef HAVE_MINGW */ + +/* Define whether the Mirror virtual file driver (VFD) will be compiled */ +/* #undef HAVE_MIRROR_VFD */ + +/* Define if MPI_Comm_c2f and MPI_Comm_f2c exist */ +/* #undef HAVE_MPI_MULTI_LANG_Comm */ + +/* Define if MPI_Info_c2f and MPI_Info_f2c exist */ +/* #undef HAVE_MPI_MULTI_LANG_Info */ + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_EVP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_HMAC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_SHA_H */ + +/* Define if we have parallel support */ +/* #undef HAVE_PARALLEL */ + +/* Define if we have support for writing to filtered datasets in parallel */ +/* #undef HAVE_PARALLEL_FILTERED_WRITES */ + +/* Define if both pread and pwrite exist. */ +#define HAVE_PREADWRITE 1 + +/* Define if has pthread_condattr_setclock() */ +/* #undef HAVE_PTHREAD_CONDATTR_SETCLOCK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PTHREAD_H */ + +/* Define if has PTHREAD_MUTEX_ADAPTIVE_NP */ +/* #undef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_QUADMATH_H */ + +/* Define to 1 if you have the `random' function. */ +#define HAVE_RANDOM 1 + +/* Define to 1 if you have the `rand_r' function. */ +#define HAVE_RAND_R 1 + +/* Define whether the Read-Only S3 virtual file driver (VFD) should be + compiled */ +/* #undef HAVE_ROS3_VFD */ + +/* Define if struct stat has the st_blocks field */ +#define HAVE_STAT_ST_BLOCKS 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_STDATOMIC_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasestr' function. */ +#define HAVE_STRCASESTR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if struct text_info is defined */ +/* #undef HAVE_STRUCT_TEXT_INFO */ + +/* Define if struct videoconfig is defined */ +/* #undef HAVE_STRUCT_VIDEOCONFIG */ + +/* Define if the subfiling I/O virtual file driver (VFD) should be compiled */ +/* #undef HAVE_SUBFILING_VFD */ + +/* Define to 1 if you have the `symlink' function. */ +#define HAVE_SYMLINK 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SZLIB_H */ + +/* Define if we have thread safe support */ +/* #undef HAVE_THREADSAFE */ + +/* Define if timezone is a global variable */ +#define HAVE_TIMEZONE 1 + +/* Define if the ioctl TIOCGETD is defined */ +#define HAVE_TIOCGETD 1 + +/* Define if the ioctl TIOGWINSZ is defined */ +#define HAVE_TIOCGWINSZ 1 + +/* Define to 1 if you have the `tmpfile' function. */ +#define HAVE_TMPFILE 1 + +/* Define if tm_gmtoff is a member of struct tm */ +#define HAVE_TM_GMTOFF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vasprintf' function. */ +#define HAVE_VASPRINTF 1 + +/* Define to 1 if you have the `waitpid' function. */ +#define HAVE_WAITPID 1 + +/* Define if on the Windows platform using the Win32 API */ +/* #undef HAVE_WIN32_API */ + +/* Define if this is a Windows machine */ +/* #undef HAVE_WINDOWS */ + +/* Define if your system has window style path name. */ +/* #undef HAVE_WINDOW_PATH */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ZLIB_H 1 + +/* Define to 1 if you have the `_getvideoconfig' function. */ +/* #undef HAVE__GETVIDEOCONFIG */ + +/* Define to 1 if you have the `_scrsize' function. */ +/* #undef HAVE__SCRSIZE */ + +/* Define if the library will ignore file locks when disabled */ +#define IGNORE_DISABLED_FILE_LOCKS 1 + +/* Define if the high-level library headers should be included in hdf5.h */ +#define INCLUDE_HL 1 + +/* Define if your system can convert long double to (unsigned) long long + values correctly. */ +#define LDOUBLE_TO_LLONG_ACCURATE 1 + +/* Define if your system converts long double to (unsigned) long values with + special algorithm. */ +/* #undef LDOUBLE_TO_LONG_SPECIAL */ + +/* Define if your system can convert (unsigned) long long to long double + values correctly. */ +#define LLONG_TO_LDOUBLE_CORRECT 1 + +/* Define if your system can convert (unsigned) long to long double values + with special algorithm. */ +/* #undef LONG_TO_LDOUBLE_SPECIAL */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#define LT_OBJDIR ".libs/" + +/* Define if deprecated public API symbols are disabled */ +/* #undef NO_DEPRECATED_SYMBOLS */ + +/* Name of package */ +#define PACKAGE "hdf5" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "help@hdfgroup.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "HDF5" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "HDF5 1.14.2" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "hdf5" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.14.2" + +/* Determine the maximum decimal precision in C */ +/* #undef PAC_C_MAX_REAL_PRECISION */ + +/* Define Fortran Maximum Real Decimal Precision */ +/* #undef PAC_FC_MAX_REAL_PRECISION */ + +/* The size of `bool', as computed by sizeof. */ +#define SIZEOF_BOOL 1 + +/* The size of `char', as computed by sizeof. */ +#define SIZEOF_CHAR 1 + +/* The size of `double', as computed by sizeof. */ +#define SIZEOF_DOUBLE 8 + +/* The size of `float', as computed by sizeof. */ +#define SIZEOF_FLOAT 4 + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `int16_t', as computed by sizeof. */ +#define SIZEOF_INT16_T 2 + +/* The size of `int32_t', as computed by sizeof. */ +#define SIZEOF_INT32_T 4 + +/* The size of `int64_t', as computed by sizeof. */ +#define SIZEOF_INT64_T 8 + +/* The size of `int8_t', as computed by sizeof. */ +#define SIZEOF_INT8_T 1 + +/* The size of `int_fast16_t', as computed by sizeof. */ +#define SIZEOF_INT_FAST16_T 8 + +/* The size of `int_fast32_t', as computed by sizeof. */ +#define SIZEOF_INT_FAST32_T 8 + +/* The size of `int_fast64_t', as computed by sizeof. */ +#define SIZEOF_INT_FAST64_T 8 + +/* The size of `int_fast8_t', as computed by sizeof. */ +#define SIZEOF_INT_FAST8_T 1 + +/* The size of `int_least16_t', as computed by sizeof. */ +#define SIZEOF_INT_LEAST16_T 2 + +/* The size of `int_least32_t', as computed by sizeof. */ +#define SIZEOF_INT_LEAST32_T 4 + +/* The size of `int_least64_t', as computed by sizeof. */ +#define SIZEOF_INT_LEAST64_T 8 + +/* The size of `int_least8_t', as computed by sizeof. */ +#define SIZEOF_INT_LEAST8_T 1 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of `long double', as computed by sizeof. */ +#define SIZEOF_LONG_DOUBLE 16 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `off_t', as computed by sizeof. */ +#define SIZEOF_OFF_T 8 + +/* The size of `ptrdiff_t', as computed by sizeof. */ +#define SIZEOF_PTRDIFF_T 8 + +/* The size of `short', as computed by sizeof. */ +#define SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* The size of `ssize_t', as computed by sizeof. */ +#define SIZEOF_SSIZE_T 8 + +/* The size of `time_t', as computed by sizeof. */ +#define SIZEOF_TIME_T 8 + +/* The size of `uint16_t', as computed by sizeof. */ +#define SIZEOF_UINT16_T 2 + +/* The size of `uint32_t', as computed by sizeof. */ +#define SIZEOF_UINT32_T 4 + +/* The size of `uint64_t', as computed by sizeof. */ +#define SIZEOF_UINT64_T 8 + +/* The size of `uint8_t', as computed by sizeof. */ +#define SIZEOF_UINT8_T 1 + +/* The size of `uint_fast16_t', as computed by sizeof. */ +#define SIZEOF_UINT_FAST16_T 8 + +/* The size of `uint_fast32_t', as computed by sizeof. */ +#define SIZEOF_UINT_FAST32_T 8 + +/* The size of `uint_fast64_t', as computed by sizeof. */ +#define SIZEOF_UINT_FAST64_T 8 + +/* The size of `uint_fast8_t', as computed by sizeof. */ +#define SIZEOF_UINT_FAST8_T 1 + +/* The size of `uint_least16_t', as computed by sizeof. */ +#define SIZEOF_UINT_LEAST16_T 2 + +/* The size of `uint_least32_t', as computed by sizeof. */ +#define SIZEOF_UINT_LEAST32_T 4 + +/* The size of `uint_least64_t', as computed by sizeof. */ +#define SIZEOF_UINT_LEAST64_T 8 + +/* The size of `uint_least8_t', as computed by sizeof. */ +#define SIZEOF_UINT_LEAST8_T 1 + +/* The size of `unsigned', as computed by sizeof. */ +#define SIZEOF_UNSIGNED 4 + +/* The size of `_Quad', as computed by sizeof. */ +/* #undef SIZEOF__QUAD */ + +/* The size of `__float128', as computed by sizeof. */ +/* #undef SIZEOF___FLOAT128 */ + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#define STDC_HEADERS 1 + +/* Define if strict file format checks are enabled */ +/* #undef STRICT_FORMAT_CHECKS */ + +/* Define if your system supports pthread_attr_setscope(&attribute, + PTHREAD_SCOPE_SYSTEM) call. */ +/* #undef SYSTEM_SCOPE_THREADS */ + +/* HDF5 testing intensity level */ +#define TEST_EXPRESS_LEVEL_DEFAULT 3 + +/* Define using v1.10 public API symbols by default */ +/* #undef USE_110_API_DEFAULT */ + +/* Define using v1.12 public API symbols by default */ +/* #undef USE_112_API_DEFAULT */ + +/* Define using v1.14 public API symbols by default */ +#define USE_114_API_DEFAULT 1 + +/* Define using v1.6 public API symbols by default */ +/* #undef USE_16_API_DEFAULT */ + +/* Define using v1.8 public API symbols by default */ +/* #undef USE_18_API_DEFAULT */ + +/* Define if the library will use file locking */ +#define USE_FILE_LOCKING 1 + +/* Define if a memory checking tool will be used on the library, to cause + library to be very picky about memory operations and also disable the + internal free list manager code. */ +/* #undef USING_MEMCHECKER */ + +/* Version number of package */ +#define VERSION "1.14.2" + +/* Data accuracy is preferred to speed during data conversions */ +#define WANT_DATA_ACCURACY 1 + +/* Check exception handling functions during data conversions */ +#define WANT_DCONV_EXCEPTION 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to `long int' if does not define. */ +/* #undef off_t */ + +/* Define to `long' if does not define. */ +/* #undef ssize_t */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5encode.h b/externals/coda-oss/modules/drivers/hdf5/include/H5encode.h new file mode 100644 index 0000000000..a9172ffc4e --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5encode.h @@ -0,0 +1,287 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * File-independent encode/decode routines + */ + +#ifndef H5encode_H +#define H5encode_H + +/**************************/ +/* Library Private Macros */ +/**************************/ + +/* + * Encode and decode macros for file meta-data. + * Currently, all file meta-data is little-endian. + */ + +#define INT16ENCODE(p, i) \ + do { \ + *(p) = (uint8_t)((unsigned)(i)&0xff); \ + (p)++; \ + *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); \ + (p)++; \ + } while (0) + +#define UINT16ENCODE(p, i) \ + do { \ + *(p) = (uint8_t)((unsigned)(i)&0xff); \ + (p)++; \ + *(p) = (uint8_t)(((unsigned)(i) >> 8) & 0xff); \ + (p)++; \ + } while (0) + +#define INT32ENCODE(p, i) \ + do { \ + *(p) = (uint8_t)((uint32_t)(i)&0xff); \ + (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 8) & 0xff); \ + (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 16) & 0xff); \ + (p)++; \ + *(p) = (uint8_t)(((uint32_t)(i) >> 24) & 0xff); \ + (p)++; \ + } while (0) + +#define UINT32ENCODE(p, i) \ + do { \ + *(p) = (uint8_t)((i)&0xff); \ + (p)++; \ + *(p) = (uint8_t)(((i) >> 8) & 0xff); \ + (p)++; \ + *(p) = (uint8_t)(((i) >> 16) & 0xff); \ + (p)++; \ + *(p) = (uint8_t)(((i) >> 24) & 0xff); \ + (p)++; \ + } while (0) + +/* Encode an unsigned integer into a variable-sized buffer */ +/* (Assumes that the high bits of the integer are zero) */ +#define ENCODE_VAR(p, typ, n, l) \ + do { \ + typ _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t *)(p); \ + \ + for (_i = 0; _i < l; _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + (p) = (uint8_t *)(p) + l; \ + } while (0) + +/* Encode a 32-bit unsigned integer into a variable-sized buffer */ +/* (Assumes that the high bits of the integer are zero) */ +#define UINT32ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint32_t, n, l) + +#define INT64ENCODE(p, n) \ + do { \ + int64_t _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t *)(p); \ + \ + for (_i = 0; _i < sizeof(int64_t); _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + for (/*void*/; _i < 8; _i++) \ + *_p++ = (uint8_t)((n) < 0 ? 0xff : 0); \ + (p) = (uint8_t *)(p) + 8; \ + } while (0) + +#define UINT64ENCODE(p, n) \ + do { \ + uint64_t _n = (n); \ + size_t _i; \ + uint8_t *_p = (uint8_t *)(p); \ + \ + for (_i = 0; _i < sizeof(uint64_t); _i++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + for (/*void*/; _i < 8; _i++) \ + *_p++ = 0; \ + (p) = (uint8_t *)(p) + 8; \ + } while (0) + +/* Encode a 64-bit unsigned integer into a variable-sized buffer */ +/* (Assumes that the high bits of the integer are zero) */ +#define UINT64ENCODE_VAR(p, n, l) ENCODE_VAR(p, uint64_t, n, l) + +#define H5_ENCODE_UNSIGNED(p, n) \ + do { \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32ENCODE(p, n); \ + } while (0) + +/* Assumes the endianness of uint64_t is the same as double */ +#define H5_ENCODE_DOUBLE(p, n) \ + do { \ + uint64_t _n; \ + size_t _u; \ + uint8_t *_p = (uint8_t *)(p); \ + \ + HDcompile_assert(sizeof(double) == 8); \ + HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ + memcpy(&_n, &n, sizeof(double)); \ + for (_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ + *_p++ = (uint8_t)(_n & 0xff); \ + (p) = (uint8_t *)(p) + 8; \ + } while (0) + +/* DECODE converts little endian bytes pointed by p to integer values and store + * it in i. For signed values, need to do sign-extension when converting + * the last byte which carries the sign bit. + * The macros does not require i be of a certain byte sizes. It just requires + * i be big enough to hold the intended value range. E.g. INT16DECODE works + * correctly even if i is actually a 64bit int like in a Cray. + */ + +#define INT16DECODE(p, i) \ + do { \ + (i) = (int16_t)((*(p)&0xff)); \ + (p)++; \ + (i) |= (int16_t)(((*(p)&0xff) << 8) | ((*(p)&0x80) ? ~0xffff : 0x0)); \ + (p)++; \ + } while (0) + +#define UINT16DECODE(p, i) \ + do { \ + (i) = (uint16_t)(*(p)&0xff); \ + (p)++; \ + (i) |= (uint16_t)((*(p)&0xff) << 8); \ + (p)++; \ + } while (0) + +#define INT32DECODE(p, i) \ + do { \ + (i) = ((int32_t)(*(p)&0xff)); \ + (p)++; \ + (i) |= ((int32_t)(*(p)&0xff) << 8); \ + (p)++; \ + (i) |= ((int32_t)(*(p)&0xff) << 16); \ + (p)++; \ + (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | ((*(p)&0x80) ? ~0xffffffffULL : 0x0ULL))); \ + (p)++; \ + } while (0) + +#define UINT32DECODE(p, i) \ + do { \ + (i) = (uint32_t)(*(p)&0xff); \ + (p)++; \ + (i) |= ((uint32_t)(*(p)&0xff) << 8); \ + (p)++; \ + (i) |= ((uint32_t)(*(p)&0xff) << 16); \ + (p)++; \ + (i) |= ((uint32_t)(*(p)&0xff) << 24); \ + (p)++; \ + } while (0) + +/* Decode a variable-sized buffer */ +/* (Assumes that the high bits of the integer will be zero) */ +#define DECODE_VAR(p, n, l) \ + do { \ + size_t _i; \ + \ + n = 0; \ + (p) += l; \ + for (_i = 0; _i < l; _i++) \ + n = (n << 8) | *(--p); \ + (p) += l; \ + } while (0) + +/* Decode a variable-sized buffer into a 32-bit unsigned integer */ +/* (Assumes that the high bits of the integer will be zero) */ +#define UINT32DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) + +#define INT64DECODE(p, n) \ + do { \ + /* WE DON'T CHECK FOR OVERFLOW! */ \ + size_t _i; \ + \ + n = 0; \ + (p) += 8; \ + for (_i = 0; _i < sizeof(int64_t); _i++) \ + n = (n << 8) | *(--p); \ + (p) += 8; \ + } while (0) + +#define UINT64DECODE(p, n) \ + do { \ + /* WE DON'T CHECK FOR OVERFLOW! */ \ + size_t _i; \ + \ + n = 0; \ + (p) += 8; \ + for (_i = 0; _i < sizeof(uint64_t); _i++) \ + n = (n << 8) | *(--p); \ + (p) += 8; \ + } while (0) + +/* Decode a variable-sized buffer into a 64-bit unsigned integer */ +/* (Assumes that the high bits of the integer will be zero) */ +#define UINT64DECODE_VAR(p, n, l) DECODE_VAR(p, n, l) + +#define H5_DECODE_UNSIGNED(p, n) \ + do { \ + HDcompile_assert(sizeof(unsigned) == sizeof(uint32_t)); \ + UINT32DECODE(p, n); \ + } while (0) + +/* Assumes the endianness of uint64_t is the same as double */ +#define H5_DECODE_DOUBLE(p, n) \ + do { \ + uint64_t _n; \ + size_t _u; \ + \ + HDcompile_assert(sizeof(double) == 8); \ + HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ + _n = 0; \ + (p) += 8; \ + for (_u = 0; _u < sizeof(uint64_t); _u++) \ + _n = (_n << 8) | *(--p); \ + memcpy(&(n), &_n, sizeof(double)); \ + (p) += 8; \ + } while (0) + +/* Macros to encode/decode offset/length's for storing in the file */ +#define H5_ENCODE_LENGTH_LEN(p, l, s) \ + do { \ + switch (s) { \ + case 4: \ + UINT32ENCODE(p, l); \ + break; \ + case 8: \ + UINT64ENCODE(p, l); \ + break; \ + case 2: \ + UINT16ENCODE(p, l); \ + break; \ + default: \ + assert("bad sizeof size" && 0); \ + } \ + } while (0) + +#define H5_DECODE_LENGTH_LEN(p, l, s) \ + do { \ + switch (s) { \ + case 4: \ + UINT32DECODE(p, l); \ + break; \ + case 8: \ + UINT64DECODE(p, l); \ + break; \ + case 2: \ + UINT16DECODE(p, l); \ + break; \ + default: \ + assert("bad sizeof size" && 0); \ + } \ + } while (0) + +#endif /* H5encode_H */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5module.h b/externals/coda-oss/modules/drivers/hdf5/include/H5module.h index 642683f778..0d2a0ba6ad 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5module.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5module.h @@ -25,7 +25,1409 @@ #define H5_MY_PKG H5 #define H5_MY_PKG_ERR H5E_LIB -/**\defgroup H5 H5 +/** \page H5DM_UG The HDF5 Data Model and File Structure + * + * \section sec_data_model The HDF5 Data Model and File Structure + * \subsection subsec_data_model_intro Introduction + * The Hierarchical Data Format (HDF) implements a model for managing and storing data. The + * model includes an abstract data model and an abstract storage model (the data format), and + * libraries to implement the abstract model and to map the storage model to different storage + * mechanisms. The HDF5 library provides a programming interface to a concrete implementation + * of the abstract models. The library also implements a model of data transfer, an efficient + * movement of data from one stored representation to another stored representation. The figure + * below illustrates the relationships between the models and implementations. This chapter + * explains these models in detail. + * + * + * + * + * + *
+ * \image html Dmodel_fig1.gif "HDF5 models and implementations" + *
+ * + * The Abstract Data Model is a conceptual model of data, data types, and data organization. The + * abstract data model is independent of storage medium or programming environment. The + * Storage Model is a standard representation for the objects of the abstract data model. The + * HDF5 File Format Specification + * defines the storage model. + * + * The Programming Model is a model of the computing environment and includes platforms from + * small single systems to large multiprocessors and clusters. The programming model manipulates + * (instantiates, populates, and retrieves) objects from the abstract data model. + * + * The Library is the concrete implementation of the programming model. The library exports the + * HDF5 APIs as its interface. In addition to implementing the objects of the abstract data model, + * the library manages data transfers from one stored form to another. Data transfer examples + * include reading from disk to memory and writing from memory to disk. + * + * Stored Data is the concrete implementation of the storage model. The Storage Model + * is mapped to several storage mechanisms including single disk files, multiple files (family of files), + * and memory representations. + * + * The HDF5 library is a C module that implements the programming model and abstract data + * model. The HDF5 library calls the operating system or other storage management software (for + * example, the MPI/IO Library) to store and retrieve persistent data. The HDF5 library may also + * link to other software such as filters for compression. The HDF5 library is linked to an + * application program which may be written in C, C++, Fortran, or Java. The application program + * implements problem specific algorithms and data structures and calls the HDF5 library to store + * and retrieve data. The figure below shows the dependencies of these modules. + * + * + * + * + * + *
+ * \image html Dmodel_fig2.gif "The library, the application program, and other modules" + *
+ * + * It is important to realize that each of the software components manages data using models and + * data structures that are appropriate to the component. When data is passed between layers + * (during storage or retrieval), it is transformed from one representation to another. The figure + * below suggests some of the kinds of data structures used in the different layers. + * + * The Application Program uses data structures that represent the problem and algorithms + * including variables, tables, arrays, and meshes among other data structures. Depending on its + * design and function, an application may have quite a few different kinds of data structures and + * different numbers and sizes of objects. + * + * The HDF5 Library implements the objects of the HDF5 abstract data model. Some of these + * objects include groups, datasets, and attributes. The application program maps the application + * data structures to a hierarchy of HDF5 objects. Each application will create a mapping best + * suited to its purposes. + * + * The objects of the HDF5 abstract data model are mapped to the objects of the HDF5 storage + * model, and stored in a storage medium. The stored objects include header blocks, free lists, data + * blocks, B-trees, and other objects. Each group or dataset is stored as one or more header and data + * blocks. + * @see HDF5 File Format Specification + * for more information on how these objects are organized. The HDF5 library can also use other + * libraries and modules such as compression. + * + * + * + * + * + * + * + * + *
Data structures in different layers
+ * \image html Dmodel_fig3_a.gif + * + * \image html Dmodel_fig2.gif + * + * \image html Dmodel_fig3_c.gif + *
+ * + * The important point to note is that there is not necessarily any simple correspondence between + * the objects of the application program, the abstract data model, and those of the Format + * Specification. The organization of the data of application program, and how it is mapped to the + * HDF5 abstract data model is up to the application developer. The application program only + * needs to deal with the library and the abstract data model. Most applications need not consider + * any details of the + * HDF5 File Format Specification + * or the details of how objects of abstract data model are translated to and from storage. + * + * \subsection subsec_data_model_abstract The Abstract Data Model + * The abstract data model (ADM) defines concepts for defining and describing complex data + * stored in files. The ADM is a very general model which is designed to conceptually cover many + * specific models. Many different kinds of data can be mapped to objects of the ADM, and + * therefore stored and retrieved using HDF5. The ADM is not, however, a model of any particular + * problem or application domain. Users need to map their data to the concepts of the ADM. + * + * The key concepts include: + *
  • @ref subsubsec_data_model_abstract_file - a contiguous string of bytes in a computer + * store (memory, disk, etc.), and the bytes represent zero or more objects of the model
  • + *
  • @ref subsubsec_data_model_abstract_group - a collection of objects (including groups)
  • + *
  • @ref subsubsec_data_model_abstract_dataset - a multidimensional array of data elements with + * attributes and other metadata
  • + *
  • @ref subsubsec_data_model_abstract_space - a description of the dimensions of a multidimensional + * array
  • + *
  • @ref subsubsec_data_model_abstract_type - a description of a specific class of data element + * including its storage layout as a pattern of bits
  • + *
  • @ref subsubsec_data_model_abstract_attr - a named data value associated with a group, + * dataset, or named datatype
  • + *
  • @ref subsubsec_data_model_abstract_plist - a collection of parameters (some permanent and + * some transient) controlling options in the library
  • + *
  • @ref subsubsec_data_model_abstract_link - the way objects are connected
+ * + * These key concepts are described in more detail below. + * + * \subsubsection subsubsec_data_model_abstract_file File + * Abstractly, an HDF5 file is a container for an organized collection of objects. The objects are + * groups, datasets, and other objects as defined below. The objects are organized as a rooted, + * directed graph. Every HDF5 file has at least one object, the root group. See the figure below. All + * objects are members of the root group or descendants of the root group. + * + * + * + * + * + * + * + * + * + *
The HDF5 file
+ * \image html Dmodel_fig4_b.gif + *
+ * \image html Dmodel_fig4_a.gif + *
+ * + * HDF5 objects have a unique identity within a single HDF5 file and can be accessed only by their + * names within the hierarchy of the file. HDF5 objects in different files do not necessarily have + * unique identities, and it is not possible to access a permanent HDF5 object except through a file. + * For more information, see \ref subsec_data_model_structure. + * + * When the file is created, the file creation properties specify settings for the file. The file creation + * properties include version information and parameters of global data structures. When the file is + * opened, the file access properties specify settings for the current access to the file. File access + * properties include parameters for storage drivers and parameters for caching and garbage + * collection. The file creation properties are set permanently for the life of the file, and the file + * access properties can be changed by closing and reopening the file. + * + * An HDF5 file can be “mounted” as part of another HDF5 file. This is analogous to Unix file + * system mounts. The root of the mounted file is attached to a group in the mounting file, and all + * the contents can be accessed as if the mounted file were part of the mounting file. + * + * @see @ref sec_file. + * + * \subsubsection subsubsec_data_model_abstract_group Group + * An HDF5 group is analogous to a file system directory. Abstractly, a group contains zero or + * more objects, and every object must be a member of at least one group. The root group is a + * special case; it may not be a member of any group. + * + * Group membership is actually implemented via link objects. See the figure below. A link object + * is owned by a group and points to a named object. Each link has a name, and each link points to + * exactly one object. Each named object has at least one and possibly many links to it. + * + * + * + * + * + *
+ * \image html Dmodel_fig5.gif "Group membership via link objects" + *
+ * + * There are three classes of named objects: group, dataset, and committed (named) datatype. See + * the figure below. Each of these objects is the member of at least one group, and this means there + * is at least one link to it. + * + * + * + * + * + *
+ * \image html Dmodel_fig6.gif "Classes of named objects" + *
+ * + * @see @ref sec_group. + * + * \subsubsection subsubsec_data_model_abstract_dataset Dataset + * An HDF5 dataset is a multidimensional (rectangular) array of data elements. See the figure + * below. The shape of the array (number of dimensions, size of each dimension) is described by + * the dataspace object (described in the next section below). + * + * A data element is a single unit of data which may be a number, a character, an array of numbers + * or characters, or a record of heterogeneous data elements. A data element is a set of bits. The + * layout of the bits is described by the datatype (see below). + * + * The dataspace and datatype are set when the dataset is created, and they cannot be changed for + * the life of the dataset. The dataset creation properties are set when the dataset is created. The + * dataset creation properties include the fill value and storage properties such as chunking and + * compression. These properties cannot be changed after the dataset is created. + * + * The dataset object manages the storage and access to the data. While the data is conceptually a + * contiguous rectangular array, it is physically stored and transferred in different ways depending + * on the storage properties and the storage mechanism used. The actual storage may be a set of + * compressed chunks, and the access may be through different storage mechanisms and caches. + * The dataset maps between the conceptual array of elements and the actual stored data. + * + * + * + * + * + *
+ * \image html Dmodel_fig7_b.gif "The dataset" + *
+ * + * @see @ref sec_dataset. + * + * \subsubsection subsubsec_data_model_abstract_space Dataspace + * The HDF5 dataspace describes the layout of the elements of a multidimensional array. + * Conceptually, the array is a hyper-rectangle with one to 32 dimensions. HDF5 dataspaces can be + * extendable. Therefore, each dimension has a current size and a maximum size, and the maximum + * may be unlimited. The dataspace describes this hyper-rectangle: it is a list of dimensions with + * the current and maximum (or unlimited) sizes. See the figure below. + * + * + * + * + * + *
+ * \image html Dmodel_fig8.gif "The dataspace" + *
+ * + * Dataspace objects are also used to describe hyperslab selections from a dataset. Any subset of the + * elements of a dataset can be selected for read or write by specifying a set of hyperslabs. A + * non-rectangular region can be selected by the union of several (rectangular) dataspaces. + * + * @see @ref sec_dataspace. + * + * \subsubsection subsubsec_data_model_abstract_type Datatype + * The HDF5 datatype object describes the layout of a single data element. A data element is a + * single element of the array; it may be a single number, a character, an array of numbers or + * carriers, or other data. The datatype object describes the storage layout of this data. + * + * Data types are categorized into 11 classes of datatype. Each class is interpreted according to a set + * of rules and has a specific set of properties to describe its storage. For instance, floating point + * numbers have exponent position and sizes which are interpreted according to appropriate + * standards for number representation. Thus, the datatype class tells what the element means, and + * the datatype describes how it is stored. + * + * The figure below shows the classification of datatypes. Atomic datatypes are indivisible. Each + * may be a single object such as a number or a string. Composite datatypes are composed of + * multiple elements of atomic datatypes. In addition to the standard types, users can define + * additional datatypes such as a 24-bit integer or a 16-bit float. + * A dataset or attribute has a single datatype object associated with it. See Figure 7 above. The + * datatype object may be used in the definition of several objects, but by default, a copy of the + * datatype object will be private to the dataset. + * + * Optionally, a datatype object can be stored in the HDF5 file. The datatype is linked into a group, + * and therefore given a name. A committed datatype (formerly called a named datatype) can be + * opened and used in any way that a datatype object can be used. + * + * + * + * + * + *
+ * \image html Dmodel_fig9.gif "Datatype classifications" + *
+ * + * @see @ref sec_datatype. + * + * \subsubsection subsubsec_data_model_abstract_attr Attribute + * Any HDF5 named data object (group, dataset, or named datatype) may have zero or more user + * defined attributes. Attributes are used to document the object. The attributes of an object are + * stored with the object. + * + * An HDF5 attribute has a name and data. The data portion is similar in structure to a dataset: a + * dataspace defines the layout of an array of data elements, and a datatype defines the storage + * layout and interpretation of the elements See the figure below. + * + * + * + * + * + *
+ * \image html Dmodel_fig10.gif "Attribute data elements" + *
+ * + * In fact, an attribute is very similar to a dataset with the following limitations: + *
  • An attribute can only be accessed via the object
  • + *
  • Attribute names are significant only within the object
  • + *
  • An attribute should be a small object
  • + *
  • The data of an attribute must be read or written in a single access (partial reading or + * writing is not allowed)
  • + *
  • Attributes do not have attributes
+ * + * Note that the value of an attribute can be an object reference. A shared attribute or an attribute + * that is a large array can be implemented as a reference to a dataset. + * + * The name, dataspace, and datatype of an attribute are specified when it is created and cannot be + * changed over the life of the attribute. An attribute can be opened by name, by index, or by + * iterating through all the attributes of the object. + * + * @see @ref sec_attribute. + * + * \subsubsection subsubsec_data_model_abstract_plist Property List + * HDF5 has a generic property list object. Each list is a collection of name-value pairs. Each class + * of property list has a specific set of properties. Each property has an implicit name, a datatype, + * and a value. See the figure below. A property list object is created and used in ways similar to + * the other objects of the HDF5 library. + * + * Property Lists are attached to the object in the library, and they can be used by any part of the + * library. Some properties are permanent (for example, the chunking strategy for a dataset), others + * are transient (for example, buffer sizes for data transfer). A common use of a Property List is to + * pass parameters from the calling program to a VFL driver or a module of the pipeline. + * + * Property lists are conceptually similar to attributes. Property lists are information relevant to the + * behavior of the library while attributes are relevant to the user's data and application. + * + * + * + * + * + *
+ * \image html Dmodel_fig11_b.gif "The property list" + *
+ * + * Property lists are used to control optional behavior for file creation, file access, dataset creation, + * dataset transfer (read, write), and file mounting. Some property list classes are shown in the table + * below. Details of the different property lists are explained in the relevant sections of this + * document. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Property list classes and their usage
Property List ClassUsedExamples
#H5P_FILE_CREATEProperties for file creation.Set size of user block.
#H5P_FILE_ACCESSProperties for file access.Set parameters for VFL driver. An example is MPI I/O.
#H5P_DATASET_CREATEProperties for dataset creation.Set chunking, compression, or fill value.
#H5P_DATASET_XFERProperties for raw data transfer (read and write).Tune buffer sizes or memory management.
#H5P_FILE_MOUNTProperties for file mounting.
+ * + * @see @ref sec_plist. + * + * \subsubsection subsubsec_data_model_abstract_link Link + * This section is under construction. + * + * \subsection subsec_data_model_storage The HDF5 Storage Model + * \subsubsection subsubsec_data_model_storage_spec The Abstract Storage Model: the HDF5 Format Specification + * The HDF5 File Format Specification + * defines how HDF5 objects and data are mapped to a linear + * address space. The address space is assumed to be a contiguous array of bytes stored on some + * random access medium. The format defines the standard for how the objects of the abstract data + * model are mapped to linear addresses. The stored representation is self-describing in the sense + * that the format defines all the information necessary to read and reconstruct the original objects + * of the abstract data model. + * + * The HDF5 File Format Specification is organized in three parts: + *
  • Level 0: File signature and super block
  • + *
  • Level 1: File infrastructure
  • + *
    • Level 1A: B-link trees and B-tree nodes
    • + *
    • Level 1B: Group
    • + *
    • Level 1C: Group entry
    • + *
    • Level 1D: Local heaps
    • + *
    • Level 1E: Global heap
    • + *
    • Level 1F: Free-space index
    + *
  • Level 2: Data object
  • + *
    • Level 2A: Data object headers
    • + *
    • Level 2B: Shared data object headers
    • + *
    • Level 2C: Data object data storage
+ * + * The Level 0 specification defines the header block for the file. Header block elements include a + * signature, version information, key parameters of the file layout (such as which VFL file drivers + * are needed), and pointers to the rest of the file. Level 1 defines the data structures used + * throughout the file: the B-trees, heaps, and groups. Level 2 defines the data structure for storing + * the data objects and data. In all cases, the data structures are completely specified so that every + * bit in the file can be faithfully interpreted. + * + * It is important to realize that the structures defined in the HDF5 file format are not the same as + * the abstract data model: the object headers, heaps, and B-trees of the file specification are not + * represented in the abstract data model. The format defines a number of objects for managing the + * storage including header blocks, B-trees, and heaps. The HDF5 File Format Specification defines + * how the abstract objects (for example, groups and datasets) are represented as headers, B-tree + * blocks, and other elements. + * + * The HDF5 library implements operations to write HDF5 objects to the linear format and to read + * from the linear format to create HDF5 objects. It is important to realize that a single HDF5 + * abstract object is usually stored as several objects. A dataset, for example, might be stored in a + * header and in one or more data blocks, and these objects might not be contiguous on the hard + * disk. + * + * \subsubsection subsubsec_data_model_storage_imple Concrete Storage Model + * The HDF5 file format defines an abstract linear address space. This can be implemented in + * different storage media such as a single file or multiple files on disk or in memory. The HDF5 + * Library defines an open interface called the Virtual File Layer (VFL). The VFL allows different + * concrete storage models to be selected. + * + * The VFL defines an abstract model, an API for random access storage, and an API to plug in + * alternative VFL driver modules. The model defines the operations that the VFL driver must and + * may support, and the plug-in API enables the HDF5 library to recognize the driver and pass it + * control and data. + * + * A number of VFL drivers have been defined in the HDF5 library. Some work with a single file, + * and some work with multiple files split in various ways. Some work in serial computing + * environments, and some work in parallel computing environments. Most work with disk copies + * of HDF5 files, but one works with a memory copy. These drivers are listed in the + * \ref table_file_drivers "Supported file drivers" table. + * + * @see @ref subsec_file_alternate_drivers. + * + * Each driver isolates the details of reading and writing storage so that the rest of the HDF5 library + * and user program can be almost the same for different storage methods. The exception to this + * rule is that some VFL drivers need information from the calling application. This information is + * passed using property lists. For example, the Parallel driver requires certain control information + * that must be provided by the application. + * + * \subsection subsec_data_model_structure The Structure of an HDF5 File + * \subsubsection subsubsec_data_model_structure_file Overall File Structure + * An HDF5 file is organized as a rooted, directed graph. Named data objects are the nodes of the + * graph, and links are the directed arcs. Each arc of the graph has a name, and the root group has + * the name “/”. Objects are created and then inserted into the graph with the link operation which + * creates a named link from a group to the object. For example, the figure below illustrates the + * structure of an HDF5 file when one dataset is created. An object can be the target of more than + * one link. The names on the links must be unique within each group, but there may be many links + * with the same name in different groups. Link names are unambiguous: some ancestor will have a + * different name, or they are the same object. The graph is navigated with path names similar to + * Unix file systems. An object can be opened with a full path starting at the root group or with a + * relative path and a starting node (group). Note that all paths are relative to a single HDF5 file. In + * this sense, an HDF5 file is analogous to a single Unix file system. + * + * + * + * + * + * + * + *
An HDF5 file with one dataset
+ * \image html Dmodel_fig12_a.gif + * + * \image html Dmodel_fig12_b.gif + *
+ * + * Note: In the figure above are two figures. The top figure represents a newly created file with one + * group, /. In the bottom figure, a dataset called /dset1 has been created. + * + * It is important to note that, just like the Unix file system, HDF5 objects do not have names. The + * names are associated with paths. An object has a unique (within the file) object identifier, but a + * single object may have many names because there may be many paths to the same object. An + * object can be renamed (moved to another group) by adding and deleting links. In this case, the + * object itself never moves. For that matter, membership in a group has no implication for the + * physical location of the stored object. + * + * Deleting a link to an object does not necessarily delete the object. The object remains available + * as long as there is at least one link to it. After all the links to an object are deleted, it can no + * longer be opened although the storage may or may not be reclaimed. + * + * It is important to realize that the linking mechanism can be used to construct very complex + * graphs of objects. For example, it is possible for an object to be shared between several groups + * and even to have more than one name in the same group. It is also possible for a group to be a + * member of itself or to be in a “cycle” in the graph. An example of a cycle is where a child is the + * parent of one of its own ancestors. + * + * \subsubsection subsubsec_data_model_structure_path HDF5 Path Names and Navigation + * The structure of the file constitutes the name space for the objects in the file. A path name is a + * string of components separated by ‘/’. Each component is the name of a link or the special + * character “.” for the current group. Link names (components) can be any string of ASCII + * characters not containing ‘/’ (except the string “.” which is reserved). However, users are advised + * to avoid the use of punctuation and non-printing characters because they may create problems for + * other software. The figure below gives a BNF grammar for HDF5 path names. + * + * A BNF grammar for path names + * \code + * PathName ::= AbsolutePathName | RelativePathName + * Separator ::= "/" ["/"]* + * AbsolutePathName ::= Separator [ RelativePathName ] + * RelativePathName ::= Component [ Separator RelativePathName ]* + * Component ::= "." | Name + * Name ::= Character+ - {"."} + * Character ::= {c: c in {{ legal ASCII characters } - {'/'}} + * \endcode + * + * An object can always be addressed by a full or absolute path which would start at the root group. + * As already noted, a given object can have more than one full path name. An object can also be + * addressed by a relative path which would start at a group and include the path to the object. + * + * The structure of an HDF5 file is “self-describing.” This means that it is possible to navigate the + * file to discover all the objects in the file. Basically, the structure is traversed as a graph starting at + * one node and recursively visiting the nodes of the graph. + * + * \subsubsection subsubsec_data_model_structure_example Examples of HDF5 File Structures + * The figures below show some possible HDF5 file structures with groups and datasets. The first + * figure shows the structure of a file with three groups. The second shows a dataset created in + * “/group1”. The third figure shows the structure after a dataset called dset2 has been added to the + * root group. The fourth figure shows the structure after another group and dataset have been + * added. + * + * + * + * + * + *
+ * \image html Dmodel_fig14_a.gif "An HDF5 file structure with groups" + *
+ * + * Note: The figure above shows three groups; /group1 and /group2 are members of the root group. + * + * + * + * + * + *
+ * \image html Dmodel_fig14_b.gif "An HDF5 file structure with groups and a dataset" + *
+ * + * Note: The figure above shows that a dataset has been created in /group1: /group1/dset1. + * + * + * + * + * + *
+ * \image html Dmodel_fig14_c.gif " An HDF5 file structure with groups and datasets" + *
+ * + * Note: In the figure above, another dataset has been added as a member of the root group: /dset2. + * + * + * + * + * + *
+ * \image html Dmodel_fig14_c.gif " Another HDF5 file structure with groups and datasets" + *
+ * + * Note: In the figure above, another group and dataset have been added reusing object names: + * /group2/group2/dset2. + *
  1. HDF5 requires random access to the linear address space. For this reason it is not + * well suited for some data media such as streams.
  2. + *
  3. It could be said that HDF5 extends the organizing concepts of a file system to the internal + * structure of a single file.
  4. + *
  5. As of HDF5-1.4, the storage used for an object is reclaimed, even if all links are + * deleted.
+ * + * Next Chapter \ref sec_program + * + */ + +/** \page H5_UG The HDF5 Library and Programming Model + * + * \section sec_program The HDF5 Library and Programming Model + * \subsection subsec_program_intro Introduction + * The HDF5 library implements the HDF5 abstract data model and storage model. These models + * were described in the preceding chapter. + * + * Two major objectives of the HDF5 products are to provide tools that can be used on as many + * computational platforms as possible (portability), and to provide a reasonably object-oriented + * data model and programming interface. + * + * To be as portable as possible, the HDF5 library is implemented in portable C. C is not an + * object-oriented language, but the library uses several mechanisms and conventions to implement an + * object model. + * + * One mechanism the HDF5 library uses is to implement the objects as data structures. To refer to + * an object, the HDF5 library implements its own pointers. These pointers are called identifiers. + * An identifier is then used to invoke operations on a specific instance of an object. For example, + * when a group is opened, the API returns a group identifier. This identifier is a reference to that + * specific group and will be used to invoke future operations on that group. The identifier is valid + * only within the context it is created and remains valid until it is closed or the file is closed. This + * mechanism is essentially the same as the mechanism that C++ or other object-oriented languages + * use to refer to objects except that the syntax is C. + * + * Similarly, object-oriented languages collect all the methods for an object in a single name space. + * An example is the methods of a C++ class. The C language does not have any such mechanism, + * but the HDF5 library simulates this through its API naming convention. API function names + * begin with a common prefix that is related to the class of objects that the function operates on. + * The table below lists the HDF5 objects and the standard prefixes used by the corresponding + * HDF5 APIs. For example, functions that operate on datatype objects all have names beginning + * with H5T. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Access flags and modes
PrefixOperates on
@ref H5AAttributes
@ref H5DDatasets
@ref H5EError reports
@ref H5FFiles
@ref H5GGroups
@ref H5IIdentifiers
@ref H5LLinks
@ref H5OObjects
@ref H5PProperty lists
@ref H5RReferences
@ref H5SDataspaces
@ref H5TDatatypes
@ref H5ZFilters
+ * + * \subsection subsec_program_model The HDF5 Programming Model + * In this section we introduce the HDF5 programming model by means of a series of short code + * samples. These samples illustrate a broad selection of common HDF5 tasks. More details are + * provided in the following chapters and in the HDF5 Reference Manual. + * + * \subsubsection subsubsec_program_model_create Creating an HDF5 File + * Before an HDF5 file can be used or referred to in any manner, it must be explicitly created or + * opened. When the need for access to a file ends, the file must be closed. The example below + * provides a C code fragment illustrating these steps. In this example, the values for the file + * creation property list and the file access property list are set to the defaults #H5P_DEFAULT. + * + * Creating and closing an HDF5 file + * \code + * hid_t file; // declare file identifier + * + * // Create a new file using H5F_ACC_TRUNC to truncate and overwrite + * // any file of the same name, default file creation properties, and + * // default file access properties. Then close the file. + * file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + * status = H5Fclose(file); + * \endcode + * + * Note: If there is a possibility that a file of the declared name already exists and you wish to open + * a new file regardless of that possibility, the flag #H5F_ACC_TRUNC will cause the operation to + * overwrite the previous file. If the operation should fail in such a circumstance, use the flag + * #H5F_ACC_EXCL instead. + * + * \subsubsection subsubsec_program_model_dset Creating and Initializing a Dataset + * The essential objects within a dataset are datatype and dataspace. These are independent objects + * and are created separately from any dataset to which they may be attached. Hence, creating a + * dataset requires, at a minimum, the following steps: + *
  1. Create and initialize a dataspace for the dataset
  2. + *
  3. Define a datatype for the dataset
  4. + *
  5. Create and initialize the dataset
+ * + * The code in the example below illustrates the execution of these steps. + * + * Create a dataset + * \code + * hid_t dataset, datatype, dataspace; // declare identifiers + * + * // Create a dataspace: Describe the size of the array and + * // create the dataspace for a fixed-size dataset. + * dimsf[0] = NX; + * dimsf[1] = NY; + * dataspace = H5Screate_simple(RANK, dimsf, NULL); + * + * // Define a datatype for the data in the dataset. + * // We will store little endian integers. + * datatype = H5Tcopy(H5T_NATIVE_INT); + * status = H5Tset_order(datatype, H5T_ORDER_LE); + * + * // Create a new dataset within the file using the defined + * // dataspace and datatype and default dataset creation + * // properties. + * // NOTE: H5T_NATIVE_INT can be used as the datatype if + * // conversion to little endian is not needed. + * dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * + * \subsubsection subsubsec_program_model_close Closing an Object + * An application should close an object such as a datatype, dataspace, or dataset once the object is + * no longer needed. Since each is an independent object, each must be released (or closed) + * separately. This action is frequently referred to as releasing the object's identifier. The code in + * the example below closes the datatype, dataspace, and dataset that were created in the preceding + * section. + * + * Close an object + * \code + * H5Tclose(datatype); + * H5Dclose(dataset); + * H5Sclose(dataspace); + * \endcode + * + * There is a long list of HDF5 library items that return a unique identifier when the item is created + * or opened. Each time that one of these items is opened, a unique identifier is returned. Closing a + * file does not mean that the groups, datasets, or other open items are also closed. Each opened + * item must be closed separately. + * + * For more information, + * @see Using Identifiers + * in the HDF5 Application Developer's Guide under General Topics in HDF5. + * + *

How Closing a File Effects Other Open Structural Elements

+ * Every structural element in an HDF5 file can be opened, and these elements can be opened more + * than once. Elements range in size from the entire file down to attributes. When an element is + * opened, the HDF5 library returns a unique identifier to the application. Every element that is + * opened must be closed. If an element was opened more than once, each identifier that was + * returned to the application must be closed. For example, if a dataset was opened twice, both + * dataset identifiers must be released (closed) before the dataset can be considered closed. Suppose + * an application has opened a file, a group in the file, and two datasets in the group. In order for + * the file to be totally closed, the file, group, and datasets must each be closed. Closing the file + * before the group or the datasets will not affect the state of the group or datasets: the group and + * datasets will still be open. + * + * There are several exceptions to the above general rule. One is when the #H5close function is used. + * #H5close causes a general shutdown of the library: all data is written to disk, all identifiers are + * closed, and all memory used by the library is cleaned up. Another exception occurs on parallel + * processing systems. Suppose on a parallel system an application has opened a file, a group in the + * file, and two datasets in the group. If the application uses the #H5Fclose function to close the file, + * the call will fail with an error. The open group and datasets must be closed before the file can be + * closed. A third exception is when the file access property list includes the property + * #H5F_CLOSE_STRONG. This property closes any open elements when the file is closed with + * #H5Fclose. For more information, see the #H5Pset_fclose_degree function in the HDF5 Reference + * Manual. + * + * \subsubsection subsubsec_program_model_data Writing or Reading a Dataset to or from a File + * Having created the dataset, the actual data can be written with a call to #H5Dwrite. See the + * example below. + * + * Writing a dataset + * \code + * // Write the data to the dataset using default transfer properties. + * status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data); + * \endcode + * + * Note that the third and fourth #H5Dwrite parameters in the above example describe the + * dataspaces in memory and in the file, respectively. For now, these are both set to + * #H5S_ALL which indicates that the entire dataset is to be written. The selection of partial datasets + * and the use of differing dataspaces in memory and in storage will be discussed later in this + * chapter and in more detail elsewhere in this guide. + * + * Reading the dataset from storage is similar to writing the dataset to storage. To read an entire + * dataset, substitute #H5Dread for #H5Dwrite in the above example. + * + * \subsubsection subsubsec_program_model_partial Reading and Writing a Portion of a Dataset + * The previous section described writing or reading an entire dataset. HDF5 also supports access to + * portions of a dataset. These parts of datasets are known as selections. + * + * The simplest type of selection is a simple hyperslab. This is an n-dimensional rectangular sub-set + * of a dataset where n is equal to the dataset's rank. Other available selections include a more + * complex hyperslab with user-defined stride and block size, a list of independent points, or the + * union of any of these. + * + * The figure below shows several sample selections. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
Dataset selections
+ * \image html Pmodel_fig5_a.gif + *
+ * \image html Pmodel_fig5_b.gif + *
+ * \image html Pmodel_fig5_c.gif + *
+ * \image html Pmodel_fig5_d.gif
+ * \image html Pmodel_fig5_e.gif + *
+ * + * Note: In the figure above, selections can take the form of a simple hyperslab, a hyperslab with + * user-defined stride and block, a selection of points, or a union of any of these forms. + * + * Selections and hyperslabs are portions of a dataset. As described above, a simple hyperslab is a + * rectangular array of data elements with the same rank as the dataset's dataspace. Thus, a simple + * hyperslab is a logically contiguous collection of points within the dataset. + * + * The more general case of a hyperslab can also be a regular pattern of points or blocks within the + * dataspace. Four parameters are required to describe a general hyperslab: the starting coordinates, + * the block size, the stride or space between blocks, and the number of blocks. These parameters + * are each expressed as a one-dimensional array with length equal to the rank of the dataspace and + * are described in the table below. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
ParameterDefinition
startThe coordinates of the starting location of the hyperslab in the dataset's dataspace.
blockThe size of each block to be selected from the dataspace. If the block parameter + * is set to NULL, the block size defaults to a single element in each dimension, as + * if the block array was set to all 1s (all ones). This will result in the selection of a + * uniformly spaced set of count points starting at start and on the interval defined + * by stride.
strideThe number of elements separating the starting point of each element or block to + * be selected. If the stride parameter is set to NULL, the stride size defaults to 1 + * (one) in each dimension and no elements are skipped.
countThe number of elements or blocks to select along each dimension.
+ * + *

Reading Data into a Differently Shaped Memory Block

+ * For maximum flexibility in user applications, a selection in storage can be mapped into a + * differently-shaped selection in memory. All that is required is that the two selections contain the + * same number of data elements. In this example, we will first define the selection to be read from + * the dataset in storage, and then we will define the selection as it will appear in application + * memory. + * + * Suppose we want to read a 3 x 4 hyperslab from a two-dimensional dataset in a file beginning at + * the dataset element <1,2>. The first task is to create the dataspace that describes the overall rank + * and dimensions of the dataset in the file and to specify the position and size of the in-file + * hyperslab that we are extracting from that dataset. See the code below. + * + * Define the selection to be read from storage + * \code + * // Define dataset dataspace in file. + * dataspace = H5Dget_space(dataset); // dataspace identifier + * rank = H5Sget_simple_extent_ndims(dataspace); + * + * status_n = H5Sget_simple_extent_dims(dataspace, dims_out, NULL); + * + * // Define hyperslab in the dataset. + * offset[0] = 1; + * offset[1] = 2; + * count[0] = 3; + * count[1] = 4; + * status = H5Sselect_hyperslab(dataspace, H5S_SELECT_SET, offset, NULL, count, NULL); + * \endcode + * + * The next task is to define a dataspace in memory. Suppose that we have in memory a + * three-dimensional 7 x 7 x 3 array into which we wish to read the two-dimensional 3 x 4 hyperslab + * described above and that we want the memory selection to begin at the element <3,0,0> and + * reside in the plane of the first two dimensions of the array. Since the in-memory dataspace is + * three-dimensional, we have to describe the in-memory selection as three-dimensional. Since we + * are keeping the selection in the plane of the first two dimensions of the in-memory dataset, the + * in-memory selection will be a 3 x 4 x 1 array defined as <3,4,1>. + * + * Notice that we must describe two things: the dimensions of the in-memory array, and the size + * and position of the hyperslab that we wish to read in. The code below illustrates how this would + * be done. + * + * Define the memory dataspace and selection + * \code + * // Define memory dataspace. + * dimsm[0] = 7; + * dimsm[1] = 7; + * dimsm[2] = 3; + * memspace = H5Screate_simple(RANK_OUT,dimsm,NULL); + * + * // Define memory hyperslab. + * offset_out[0] = 3; + * offset_out[1] = 0; + * offset_out[2] = 0; + * count_out[0] = 3; + * count_out[1] = 4; + * count_out[2] = 1; + * status = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, offset_out, NULL, count_out, NULL); + * \endcode + * + * The hyperslab defined in the code above has the following parameters: start=(3,0,0), + * count=(3,4,1), stride and block size are NULL. + * + *

Writing Data into a Differently Shaped Disk Storage Block

+ * Now let's consider the opposite process of writing a selection from memory to a selection in a + * dataset in a file. Suppose that the source dataspace in memory is a 50-element, one-dimensional + * array called vector and that the source selection is a 48-element simple hyperslab that starts at the + * second element of vector. See the figure below. + * + * + * + * + * + *
+ * \image html Pmodel_fig2.gif "A one-dimensional array" + *
+ * + * Further suppose that we wish to write this data to the file as a series of 3 x 2-element blocks in a + * two-dimensional dataset, skipping one row and one column between blocks. Since the source + * selection contains 48 data elements and each block in the destination selection contains 6 data + * elements, we must define the destination selection with 8 blocks. We will write 2 blocks in the + * first dimension and 4 in the second. The code below shows how to achieve this objective. + * + * The destination selection + * \code + * // Select the hyperslab for the dataset in the file, using + * // 3 x 2 blocks, a (4,3) stride, a (2,4) count, and starting + * // at the position (0,1). + * start[0] = 0; start[1] = 1; + * stride[0] = 4; stride[1] = 3; + * count[0] = 2; count[1] = 4; + * block[0] = 3; block[1] = 2; + * ret = H5Sselect_hyperslab(fid, H5S_SELECT_SET, start, stride, count, block); + * + * // Create dataspace for the first dataset. + * mid1 = H5Screate_simple(MSPACE1_RANK, dim1, NULL); + * + * // Select hyperslab. + * // We will use 48 elements of the vector buffer starting at the + * // second element. Selected elements are 1 2 3 . . . 48 + * start[0] = 1; + * stride[0] = 1; + * count[0] = 48; + * block[0] = 1; + * ret = H5Sselect_hyperslab(mid1, H5S_SELECT_SET, start, stride, count, block); + * + * // Write selection from the vector buffer to the dataset in the file. + * ret = H5Dwrite(dataset, H5T_NATIVE_INT, mid1, fid, H5P_DEFAULT, vector); + * \endcode + * + * \subsubsection subsubsec_program_model_info Getting Information about a Dataset + * Although reading is analogous to writing, it is often first necessary to query a file to obtain + * information about the dataset to be read. For instance, we often need to determine the datatype + * associated with a dataset, or its dataspace (in other words, rank and dimensions). As illustrated in + * the code example below, there are several get routines for obtaining this information. + * + * Routines to get dataset parameters + * \code + * // Get datatype and dataspace identifiers, + * // then query datatype class, order, and size, and + * // then query dataspace rank and dimensions. + * datatype = H5Dget_type (dataset); // datatype identifier + * class = H5Tget_class (datatype); + * if (class == H5T_INTEGER) + * printf("Dataset has INTEGER type \n"); + * + * order = H5Tget_order (datatype); + * if (order == H5T_ORDER_LE) + * printf("Little endian order \n"); + * + * size = H5Tget_size (datatype); + * printf ("Size is %d \n", size); + * + * dataspace = H5Dget_space (dataset); // dataspace identifier + * + * // Find rank and retrieve current and maximum dimension sizes. + * rank = H5Sget_simple_extent_dims (dataspace, dims, max_dims); + * \endcode + * + * \subsubsection subsubsec_program_model_compound Creating and Defining Compound Datatypes + * A compound datatype is a collection of one or more data elements. Each element might be an + * atomic type, a small array, or another compound datatype. + * + * The provision for nested compound datatypes allows these structures to become quite complex. + * An HDF5 compound datatype has some similarities to a C struct or a Fortran common block. + * Though not originally designed with databases in mind, HDF5 compound datatypes are + * sometimes used in a way that is similar to a database record. Compound datatypes can become + * either a powerful tool or a complex and difficult-to-debug construct. Reasonable caution is + * advised. + * + * To create and use a compound datatype, you need to create a datatype with class compound + * (#H5T_COMPOUND) and specify the total size of the data element in bytes. A compound + * datatype consists of zero or more uniquely named members. Members can be defined in any + * order but must occupy non-overlapping regions within the datum. The table below lists the + * properties of compound datatype members. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
ParameterDefinition
IndexAn index number between zero and N-1, where N is the number of + * members in the compound. The elements are indexed in the order of their + * location in the array of bytes.
NameA string that must be unique within the members of the same datatype.
DatatypeAn HDF5 datatype.
OffsetA fixed byte offset which defines the location of the first byte of that + * member in the compound datatype.
+ * + * Properties of the members of a compound datatype are defined when the member is added to the + * compound type. These properties cannot be modified later. + * + *

Defining Compound Datatypes

+ * Compound datatypes must be built out of other datatypes. To do this, you first create an empty + * compound datatype and specify its total size. Members are then added to the compound datatype + * in any order. + * + * Each member must have a descriptive name. This is the key used to uniquely identify the + * member within the compound datatype. A member name in an HDF5 datatype does not + * necessarily have to be the same as the name of the corresponding member in the C struct in + * memory although this is often the case. You also do not need to define all the members of the C + * struct in the HDF5 compound datatype (or vice versa). + * + * Usually a C struct will be defined to hold a data point in memory, and the offsets of the members + * in memory will be the offsets of the struct members from the beginning of an instance of the + * struct. The library defines the macro that computes the offset of member m within a struct + * variable s: + * \code + * HOFFSET(s,m) + * \endcode + * + * The code below shows an example in which a compound datatype is created to describe complex + * numbers whose type is defined by the complex_t struct. + * + * A compound datatype for complex numbers + * \code + * Typedef struct { + * double re; //real part + * double im; //imaginary part + * } complex_t; + * + * complex_t tmp; //used only to compute offsets + * hid_t complex_id = H5Tcreate (H5T_COMPOUND, sizeof tmp); + * H5Tinsert (complex_id, "real", HOFFSET(tmp,re), H5T_NATIVE_DOUBLE); + * H5Tinsert (complex_id, "imaginary", HOFFSET(tmp,im), H5T_NATIVE_DOUBLE); + * \endcode + * + * \subsubsection subsubsec_program_model_extend Creating and Writing Extendable Datasets + * An extendable dataset is one whose dimensions can grow. One can define an HDF5 dataset to + * have certain initial dimensions with the capacity to later increase the size of any of the initial + * dimensions. For example, the figure below shows a 3 x 3 dataset (a) which is later extended to + * be a 10 x 3 dataset by adding 7 rows (b), and further extended to be a 10 x 5 dataset by adding + * two columns (c). + * + * + * + * + * + *
+ * \image html Pmodel_fig3.gif "Extending a dataset" + *
+ * + * HDF5 requires the use of chunking when defining extendable datasets. Chunking makes it + * possible to extend datasets efficiently without having to reorganize contiguous storage + * excessively. + * + * To summarize, an extendable dataset requires two conditions: + *
  1. Define the dataspace of the dataset as unlimited in all dimensions that might eventually be + * extended
  2. + *
  3. Enable chunking in the dataset creation properties
+ * + * For example, suppose we wish to create a dataset similar to the one shown in the figure above. + * We want to start with a 3 x 3 dataset, and then later we will extend it. To do this, go through the + * steps below. + * + * First, declare the dataspace to have unlimited dimensions. See the code shown below. Note the + * use of the predefined constant #H5S_UNLIMITED to specify that a dimension is unlimited. + * + * Declaring a dataspace with unlimited dimensions + * \code + * // dataset dimensions at creation time + * hsize_t dims[2] = {3, 3}; + * hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; + * + * // Create the data space with unlimited dimensions. + * dataspace = H5Screate_simple(RANK, dims, maxdims); + * \endcode + * + * Next, set the dataset creation property list to enable chunking. See the code below. + * + * Enable chunking + * \code + * hid_t cparms; + * hsize_t chunk_dims[2] ={2, 5}; + * + * // Modify dataset creation properties to enable chunking. + * cparms = H5Pcreate (H5P_DATASET_CREATE); + * status = H5Pset_chunk(cparms, RANK, chunk_dims); + * \endcode + * + * The next step is to create the dataset. See the code below. + * + * Create a dataset + * \code + * // Create a new dataset within the file using cparms creation properties. + * dataset = H5Dcreate(file, DATASETNAME, H5T_NATIVE_INT, dataspace, H5P_DEFAULT, cparms, H5P_DEFAULT); + * \endcode + * + * Finally, when the time comes to extend the size of the dataset, invoke #H5Dextend. Extending the + * dataset along the first dimension by seven rows leaves the dataset with new dimensions of + * <10,3>. See the code below. + * + * Extend the dataset by seven rows + * \code + * // Extend the dataset. Dataset becomes 10 x 3. + * dims[0] = dims[0] + 7; + * size[0] = dims[0]; + * size[1] = dims[1]; + * + * status = H5Dextend (dataset, size); + * \endcode + * + * \subsubsection subsubsec_program_model_group Creating and Working with Groups + * Groups provide a mechanism for organizing meaningful and extendable sets of datasets within + * an HDF5 file. The @ref H5G API provides several routines for working with groups. + * + *

Creating a Group

+ * With no datatype, dataspace, or storage layout to define, creating a group is considerably simpler + * than creating a dataset. For example, the following code creates a group called Data in the root + * group of file. + * + * Create a group + * \code + * // Create a group in the file. + * grp = H5Gcreate(file, "/Data", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * + * A group may be created within another group by providing the absolute name of the group to the + * #H5Gcreate function or by specifying its location. For example, to create the group Data_new in + * the group Data, you might use the sequence of calls shown below. + * + * Create a group within a group + * \code + * // Create group "Data_new" in the group "Data" by specifying + * // absolute name of the group. + * grp_new = H5Gcreate(file, "/Data/Data_new", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * + * // or + * + * // Create group "Data_new" in the "Data" group. + * grp_new = H5Gcreate(grp, "Data_new", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + * \endcode + * + * This first parameter of #H5Gcreate is a location identifier. file in the first example specifies only + * the file. \em grp in the second example specifies a particular group in a particular file. Note that in + * this instance, the group identifier \em grp is used as the first parameter in the #H5Gcreate call so that + * the relative name of Data_new can be used. + * + * The third parameter of #H5Gcreate optionally specifies how much file space to reserve to store + * the names of objects that will be created in this group. If a non-positive value is supplied, the + * library provides a default size. + * + * Use #H5Gclose to close the group and release the group identifier. + * + *

Creating a Dataset within a Group

+ * As with groups, a dataset can be created in a particular group by specifying either its absolute + * name in the file or its relative name with respect to that group. The next code excerpt uses the + * absolute name. + * + * Create a dataset within a group using a relative name + * \code + * // Create the dataset "Compressed_Data" in the group Data using + * // the absolute name. The dataset creation property list is + * // modified to use GZIP compression with the compression + * // effort set to 6. Note that compression can be used only when + * // the dataset is chunked. + * dims[0] = 1000; + * dims[1] = 20; + * cdims[0] = 20; + * cdims[1] = 20; + * dataspace = H5Screate_simple(RANK, dims, NULL); + * + * plist = H5Pcreate(H5P_DATASET_CREATE); + * H5Pset_chunk(plist, 2, cdims); + * H5Pset_deflate(plist, 6); + * + * dataset = H5Dcreate(file, "/Data/Compressed_Data", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, + * plist, H5P_DEFAULT); + * \endcode + * + * Alternatively, you can first obtain an identifier for the group in which the dataset is to be + * created, and then create the dataset with a relative name. + * + * Create a dataset within a group using a relative name + * \code + * // Open the group. + * grp = H5Gopen(file, "Data", H5P_DEFAULT); + * + * // Create the dataset "Compressed_Data" in the "Data" group + * // by providing a group identifier and a relative dataset + * // name as parameters to the H5Dcreate function. + * dataset = H5Dcreate(grp, "Compressed_Data", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, plist, H5P_DEFAULT); + * \endcode + * + *

Accessing an Object in a Group

+ * Any object in a group can be accessed by its absolute or relative name. The first code snippet + * below illustrates the use of the absolute name to access the dataset Compressed_Data in the + * group Data created in the examples above. The second code snippet illustrates the use of the + * relative name. + * + * Accessing a group using its relative name + * \code + * // Open the dataset "Compressed_Data" in the "Data" group. + * dataset = H5Dopen(file, "/Data/Compressed_Data", H5P_DEFAULT); + * + * // Open the group "data" in the file. + * grp = H5Gopen(file, "Data", H5P_DEFAULT); + * + * // Access the "Compressed_Data" dataset in the group. + * dataset = H5Dopen(grp, "Compressed_Data", H5P_DEFAULT); + * \endcode + * + * \subsubsection subsubsec_program_model_attr Working with Attributes + * An attribute is a small dataset that is attached to a normal dataset or group. Attributes share many + * of the characteristics of datasets, so the programming model for working with attributes is + * similar in many ways to the model for working with datasets. The primary differences are that an + * attribute must be attached to a dataset or a group and sub-setting operations cannot be performed + * on attributes. + * + * To create an attribute belonging to a particular dataset or group, first create a dataspace for the + * attribute with the call to #H5Screate, and then create the attribute using #H5Acreate. For example, + * the code shown below creates an attribute called “Integer attribute” that is a member of a dataset + * whose identifier is dataset. The attribute identifier is attr2. #H5Awrite then sets the value of the + * attribute of that of the integer variable point. #H5Aclose then releases the attribute identifier. + * + * Create an attribute + * \code + * int point = 1; // Value of the scalar attribute + * + * // Create scalar attribute. + * aid2 = H5Screate(H5S_SCALAR); + * attr2 = H5Acreate(dataset, "Integer attribute", H5T_NATIVE_INT, aid2, H5P_DEFAULT, H5P_DEFAULT); + * + * // Write scalar attribute. + * ret = H5Awrite(attr2, H5T_NATIVE_INT, &point); + * + * // Close attribute dataspace. + * ret = H5Sclose(aid2); + * + * // Close attribute. + * ret = H5Aclose(attr2); + * \endcode + * + * Read a known attribute + * \code + * // Attach to the scalar attribute using attribute name, then + * // read and display its value. + * attr = H5Aopen_by_name(file_id, dataset_name, "Integer attribute", H5P_DEFAULT, H5P_DEFAULT); + * ret = H5Aread(attr, H5T_NATIVE_INT, &point_out); + * printf("The value of the attribute \"Integer attribute\" is %d \n", point_out); + * ret = H5Aclose(attr); + * \endcode + * + * To read a scalar attribute whose name and datatype are known, first open the attribute using + * #H5Aopen_by_name, and then use #H5Aread to get its value. For example, the code shown below + * reads a scalar attribute called “Integer attribute” whose datatype is a native integer and whose + * parent dataset has the identifier dataset. + * + * To read an attribute whose characteristics are not known, go through these steps. First, query the + * file to obtain information about the attribute such as its name, datatype, rank, and dimensions, + * and then read the attribute. The following code opens an attribute by its index value using + * #H5Aopen_by_idx, and then it reads in information about the datatype with #H5Aread. + * + * Read an unknown attribute + * \code + * // Attach to the string attribute using its index, then read and + * // display the value. + * attr = H5Aopen_by_idx(file_id, dataset_name, index_type, iter_order, 2, H5P_DEFAULT, H5P_DEFAULT); + * + * atype = H5Tcopy(H5T_C_S1); + * H5Tset_size(atype, 4); + * + * ret = H5Aread(attr, atype, string_out); + * printf("The value of the attribute with the index 2 is %s \n", string_out); + * \endcode + * + * In practice, if the characteristics of attributes are not known, the code involved in accessing and + * processing the attribute can be quite complex. For this reason, HDF5 includes a function called + * #H5Aiterate. This function applies a user-supplied function to each of a set of attributes. The + * user-supplied function can contain the code that interprets, accesses, and processes each attribute. + * + * \subsection subsec_program_transfer_pipeline The Data Transfer Pipeline + * The HDF5 library implements data transfers between different storage locations. At the lowest + * levels, the HDF5 Library reads and writes blocks of bytes to and from storage using calls to the + * virtual file layer (VFL) drivers. In addition to this, the HDF5 library manages caches of metadata + * and a data I/O pipeline. The data I/O pipeline applies compression to data blocks, transforms + * data elements, and implements selections. + * + * A substantial portion of the HDF5 library's work is in transferring data from one environment or + * media to another. This most often involves a transfer between system memory and a storage + * medium. Data transfers are affected by compression, encryption, machine-dependent differences + * in numerical representation, and other features. So, the bit-by-bit arrangement of a given dataset + * is often substantially different in the two environments. + * + * Consider the representation on disk of a compressed and encrypted little-endian array as + * compared to the same array after it has been read from disk, decrypted, decompressed, and + * loaded into memory on a big-endian system. HDF5 performs all of the operations necessary to + * make that transition during the I/O process with many of the operations being handled by the + * VFL and the data transfer pipeline. + * + * The figure below provides a simplified view of a sample data transfer with four stages. Note that + * the modules are used only when needed. For example, if the data is not compressed, the + * compression stage is omitted. + * + * + * + * + * + *
+ * \image html Pmodel_fig6.gif "A data transfer from storage to memory" + *
+ * + * For a given I/O request, different combinations of actions may be performed by the pipeline. The + * library automatically sets up the pipeline and passes data through the processing steps. For + * example, for a read request (from disk to memory), the library must determine which logical + * blocks contain the requested data elements and fetch each block into the library's cache. If the + * data needs to be decompressed, then the compression algorithm is applied to the block after it is + * read from disk. If the data is a selection, the selected elements are extracted from the data block + * after it is decompressed. If the data needs to be transformed (for example, byte swapped), then + * the data elements are transformed after decompression and selection. + * + * While an application must sometimes set up some elements of the pipeline, use of the pipeline is + * normally transparent to the user program. The library determines what must be done based on the + * metadata for the file, the object, and the specific request. An example of when an application + * might be required to set up some elements in the pipeline is if the application used a custom + * error-checking algorithm. + * + * In some cases, it is necessary to pass parameters to and from modules in the pipeline or among + * other parts of the library that are not directly called through the programming API. This is + * accomplished through the use of dataset transfer and data access property lists. + * + * The VFL provides an interface whereby user applications can add custom modules to the data + * transfer pipeline. For example, a custom compression algorithm can be used with the HDF5 + * Library by linking an appropriate module into the pipeline through the VFL. This requires + * creating an appropriate wrapper for the compression module and registering it with the library + * with #H5Zregister. The algorithm can then be applied to a dataset with an #H5Pset_filter call which + * will add the algorithm to the selected dataset's transfer property list. + * + * Previous Chapter \ref sec_data_model - Next Chapter \ref sec_file + * + */ + +/** + * \defgroup H5 Library General (H5) * * Use the functions in this module to manage the life cycle of HDF5 library * instances. diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5overflow.h b/externals/coda-oss/modules/drivers/hdf5/include/H5overflow.h index 833f5ca2f1..5003873227 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5overflow.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5overflow.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5private.h b/externals/coda-oss/modules/drivers/hdf5/include/H5private.h index 236de62540..b60cdd5862 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5private.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5private.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,14 +10,11 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Friday, October 30, 1998 - * - * Purpose: This file is included by all HDF5 library source files to - * define common things which are not defined in the HDF5 API. - * The configuration constants like H5_HAVE_UNISTD_H etc. are - * defined in H5config.h which is included by H5public.h. - * +/* + * Purpose: This file is included by all HDF5 library source files to + * define common things which are not defined in the HDF5 API. + * The configuration constants like H5_HAVE_UNISTD_H etc. are + * defined in H5config.h which is included by H5public.h. */ #ifndef H5private_H @@ -128,6 +124,8 @@ #include /* For _getcwd() */ #include /* POSIX I/O */ #include /* For GetUserName() */ +#include /* For StrStrIA */ +#pragma comment(lib, "shlwapi") #ifdef H5_HAVE_THREADSAFE #include /* For _beginthread() */ @@ -151,74 +149,6 @@ #define HASH_NONFATAL_OOM 1 /* Don't abort() on out-of-memory */ #include "uthash.h" -/* - * MPE Instrumentation support - */ -#ifdef H5_HAVE_MPE -/*------------------------------------------------------------------------ - * Purpose: Begin to collect MPE log information for a function. It should - * be ahead of the actual function's process. - * - * Programmer: Long Wang - * - *------------------------------------------------------------------------ - */ -#include "mpe.h" -/* - * #define eventa(func_name) h5_mpe_ ## func_name ## _a - * #define eventb(func_name) h5_mpe_ ## func_name ## _b - */ -#define eventa(func_name) h5_mpe_eventa -#define eventb(func_name) h5_mpe_eventb -#define MPE_LOG_VARS \ - static int eventa(__func__) = -1; \ - static int eventb(__func__) = -1; \ - char p_event_start[128]; - -/* Hardwire the color to "red", since that's what all the routines are using - * now. In the future, if we want to change that color for a given routine, - * we should define a "FUNC_ENTER_API_COLOR" macro which takes an extra 'color' - * parameter and then make additional FUNC_ENTER__COLOR macros to get that - * color information down to the BEGIN_MPE_LOG macro (which should have a new - * BEGIN_MPE_LOG_COLOR variant). -QAK - */ -#define BEGIN_MPE_LOG \ - if (H5_MPEinit_g) { \ - snprintf(p_event_start, sizeof(p_event_start), "start %s", __func__); \ - if (eventa(__func__) == -1 && eventb(__func__) == -1) { \ - const char *p_color = "red"; \ - eventa(__func__) = MPE_Log_get_event_number(); \ - eventb(__func__) = MPE_Log_get_event_number(); \ - MPE_Describe_state(eventa(__func__), eventb(__func__), __func__, p_color); \ - } \ - MPE_Log_event(eventa(__func__), 0, p_event_start); \ - } - -/*------------------------------------------------------------------------ - * Purpose: Finish the collection of MPE log information for a function. - * It should be after the actual function's process. - * - * Programmer: Long Wang - */ -#define FINISH_MPE_LOG \ - if (H5_MPEinit_g) { \ - MPE_Log_event(eventb(__func__), 0, __func__); \ - } - -#else /* H5_HAVE_MPE */ -#define MPE_LOG_VARS /* void */ -#define BEGIN_MPE_LOG /* void */ -#define FINISH_MPE_LOG /* void */ - -#endif /* H5_HAVE_MPE */ - -/* - * dmalloc (debugging malloc) support - */ -#ifdef H5_HAVE_DMALLOC_H -#include "dmalloc.h" -#endif /* H5_HAVE_DMALLOC_H */ - /* * NT doesn't define SIGBUS, but since NT only runs on processors * that do not have alignment constraints a SIGBUS would never be @@ -267,7 +197,7 @@ # define H5_ATTR_DEBUG_API_USED /*void*/ # else # define H5_ATTR_DEBUG_API_USED H5_ATTR_UNUSED -# endif /* H5_DEBUG_API */ +# endif # ifndef NDEBUG # define H5_ATTR_NDEBUG_UNUSED /*void*/ @@ -395,6 +325,20 @@ /* Raise an integer to a power of 2 */ #define H5_EXP2(n) (1 << (n)) +/* Check if a read of size bytes starting at ptr would overflow past + * the last valid byte, pointed to by buffer_end. + */ +#define H5_IS_BUFFER_OVERFLOW(ptr, size, buffer_end) (((ptr) + (size)-1) > (buffer_end)) + +/* Variant of H5_IS_BUFFER_OVERFLOW, used with functions such as H5Tdecode() + * that don't take a size parameter, where we need to skip the bounds checks. + * + * This is a separate macro since we don't want to inflict that behavior on + * the entire library. + */ +#define H5_IS_KNOWN_BUFFER_OVERFLOW(skip, ptr, size, buffer_end) \ + (skip ? FALSE : ((ptr) + (size)-1) > (buffer_end)) + /* * HDF Boolean type. */ @@ -472,6 +416,35 @@ */ #define H5_REQUEST_NULL NULL +/* clang-format off */ +/* Address-related macros */ +#define H5_addr_overflow(X,Z) (HADDR_UNDEF == (X) || \ + HADDR_UNDEF == (X) + (haddr_t)(Z) || \ + (X) + (haddr_t)(Z) < (X)) +#define H5_addr_defined(X) ((X) != HADDR_UNDEF) +/* The H5_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making + * certain that X is not HADDR_UNDEF and then checking that X equals Y + */ +#define H5_addr_eq(X,Y) ((X) != HADDR_UNDEF && (X) == (Y)) +#define H5_addr_ne(X,Y) (!H5_addr_eq((X),(Y))) +#define H5_addr_lt(X,Y) ((X) != HADDR_UNDEF && \ + (Y) != HADDR_UNDEF && \ + (X) < (Y)) +#define H5_addr_le(X,Y) ((X) != HADDR_UNDEF && \ + (Y) != HADDR_UNDEF && \ + (X) <= (Y)) +#define H5_addr_gt(X,Y) ((X) != HADDR_UNDEF && \ + (Y) != HADDR_UNDEF && \ + (X) > (Y)) +#define H5_addr_ge(X,Y) ((X) != HADDR_UNDEF && \ + (Y) != HADDR_UNDEF && \ + (X) >= (Y)) +#define H5_addr_cmp(X,Y) (H5_addr_eq((X), (Y)) ? 0 : \ + (H5_addr_lt((X), (Y)) ? -1 : 1)) +#define H5_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \ + ((O1) >= (O2) && (O1) < ((O2) + (L2)))) +/* clang-format on */ + /* * Methods to compare the equality of floating-point values: * @@ -595,6 +568,7 @@ H5_DLL herr_t H5_timer_stop(H5_timer_t *timer /*in,out*/); H5_DLL herr_t H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/); H5_DLL herr_t H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/); H5_DLL char *H5_timer_get_time_string(double seconds); +H5_DLL char *H5_strcasestr(const char *haystack, const char *needle); /* Depth of object copy */ typedef enum { @@ -640,156 +614,36 @@ typedef off_t h5_stat_size_t; #ifndef HDabort #define HDabort() abort() #endif -#ifndef HDabs -#define HDabs(X) abs(X) -#endif -#ifndef HDaccept -#define HDaccept(A, B, C) accept((A), (B), (C)) -#endif #ifndef HDaccess #define HDaccess(F, M) access(F, M) #endif -#ifndef HDacos -#define HDacos(X) acos(X) -#endif -#ifndef HDalarm -#define HDalarm(N) alarm(N) -#endif #ifndef HDasctime #define HDasctime(T) asctime(T) #endif -#ifndef HDasin -#define HDasin(X) asin(X) -#endif -#ifndef HDasprintf -#define HDasprintf asprintf /*varargs*/ -#endif -#ifndef HDassert -#define HDassert(X) assert(X) -#endif -#ifndef HDatan -#define HDatan(X) atan(X) -#endif -#ifndef HDatan2 -#define HDatan2(X, Y) atan2(X, Y) -#endif -#ifndef HDatexit -#define HDatexit(F) atexit(F) -#endif -#ifndef HDatof -#define HDatof(S) atof(S) -#endif -#ifndef HDatoi -#define HDatoi(S) atoi(S) -#endif -#ifndef HDatol -#define HDatol(S) atol(S) -#endif -#ifndef HDatoll -#define HDatoll(S) atoll(S) -#endif -#ifndef HDbind -#define HDbind(A, B, C) bind((A), (B), (C)) -#endif -#ifndef HDbsearch -#define HDbsearch(K, B, N, Z, F) bsearch(K, B, N, Z, F) -#endif -#ifndef HDcalloc -#define HDcalloc(N, Z) calloc(N, Z) -#endif #ifndef HDceil #define HDceil(X) ceil(X) #endif -#ifndef HDcfgetispeed -#define HDcfgetispeed(T) cfgetispeed(T) -#endif -#ifndef HDcfgetospeed -#define HDcfgetospeed(T) cfgetospeed(T) -#endif -#ifndef HDcfsetispeed -#define HDcfsetispeed(T, S) cfsetispeed(T, S) -#endif -#ifndef HDcfsetospeed -#define HDcfsetospeed(T, S) cfsetospeed(T, S) -#endif #ifndef HDchdir #define HDchdir(S) chdir(S) #endif -#ifndef HDchmod -#define HDchmod(S, M) chmod(S, M) -#endif -#ifndef HDchown -#define HDchown(S, O, G) chown(S, O, G) -#endif -#ifndef HDclearerr -#define HDclearerr(F) clearerr(F) -#endif #ifndef HDclock #define HDclock() clock() #endif -#ifndef HDclock_gettime -#define HDclock_gettime(CID, TS) clock_gettime(CID, TS) -#endif #ifndef HDclose #define HDclose(F) close(F) #endif #ifndef HDclosedir #define HDclosedir(D) closedir(D) #endif -#ifndef HDconnect -#define HDconnect(A, B, C) connect((A), (B), (C)) -#endif -#ifndef HDcos -#define HDcos(X) cos(X) -#endif -#ifndef HDcosh -#define HDcosh(X) cosh(X) -#endif #ifndef HDcreat #define HDcreat(S, M) creat(S, M) #endif -#ifndef HDctermid -#define HDctermid(S) ctermid(S) -#endif #ifndef HDctime #define HDctime(T) ctime(T) #endif -#ifndef HDcuserid -#define HDcuserid(S) cuserid(S) -#endif #ifndef HDdifftime #define HDdifftime(X, Y) difftime(X, Y) #endif -#ifndef HDdiv -#define HDdiv(X, Y) div(X, Y) -#endif -#ifndef HDdup -#define HDdup(F) dup(F) -#endif -#ifndef HDdup2 -#define HDdup2(F, I) dup2(F, I) -#endif -#ifndef HDexecv -#define HDexecv(S, AV) execv(S, AV) -#endif -#ifndef HDexecve -#define HDexecve(S, AV, E) execve(S, AV, E) -#endif -#ifndef HDexecvp -#define HDexecvp(S, AV) execvp(S, AV) -#endif -#ifndef HDexit -#define HDexit(N) exit(N) -#endif -#ifndef HD_exit -#define HD_exit(N) _exit(N) -#endif -#ifndef HDexp -#define HDexp(X) exp(X) -#endif -#ifndef HDexp2 -#define HDexp2(X) exp2(X) -#endif #ifndef HDfabs #define HDfabs(X) fabs(X) #endif @@ -799,30 +653,12 @@ typedef off_t h5_stat_size_t; #ifndef HDfabsl #define HDfabsl(X) fabsl(X) #endif -#ifndef HDfclose -#define HDfclose(F) fclose(F) -#endif -#ifndef HDfcntl -#define HDfcntl(F, C, ...) fcntl(F, C, __VA_ARGS__) -#endif #ifndef HDfdopen #define HDfdopen(N, S) fdopen(N, S) #endif -#ifndef HDfeof -#define HDfeof(F) feof(F) -#endif -#ifndef HDferror -#define HDferror(F) ferror(F) -#endif -#ifndef HDfflush -#define HDfflush(F) fflush(F) -#endif #ifndef HDfgetc #define HDfgetc(F) fgetc(F) #endif -#ifndef HDfgetpos -#define HDfgetpos(F, P) fgetpos(F, P) -#endif #ifndef HDfgets #define HDfgets(S, N, F) fgets(S, N, F) #endif @@ -858,36 +694,12 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDfloor #define HDfloor(X) floor(X) #endif -#ifndef HDfmod -#define HDfmod(X, Y) fmod(X, Y) -#endif -#ifndef HDfopen -#define HDfopen(S, M) fopen(S, M) -#endif -#ifndef HDfork -#define HDfork() fork() -#endif -#ifndef HDfprintf -#define HDfprintf fprintf -#endif -#ifndef HDfpathconf -#define HDfpathconf(F, N) fpathconf(F, N) -#endif #ifndef HDfputc #define HDfputc(C, F) fputc(C, F) #endif #ifndef HDfputs #define HDfputs(S, F) fputs(S, F) #endif -#ifndef HDfread -#define HDfread(M, Z, N, F) fread(M, Z, N, F) -#endif -#ifndef HDfree -#define HDfree(M) free(M) -#endif -#ifndef HDfreopen -#define HDfreopen(S, M, F) freopen(S, M, F) -#endif #ifndef HDfrexp #define HDfrexp(X, N) frexp(X, N) #endif @@ -903,9 +715,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDfseek #define HDfseek(F, O, W) fseeko(F, O, W) #endif -#ifndef HDfsetpos -#define HDfsetpos(F, P) fsetpos(F, P) -#endif #ifndef HDfstat #define HDfstat(F, B) fstat(F, B) #endif @@ -915,15 +724,9 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDftruncate #define HDftruncate(F, L) ftruncate(F, L) #endif -#ifndef HDfwrite -#define HDfwrite(M, Z, N, F) fwrite(M, Z, N, F) -#endif #ifndef HDgetc #define HDgetc(F) getc(F) #endif -#ifndef HDgetchar -#define HDgetchar() getchar() -#endif #ifndef HDgetcwd #define HDgetcwd(S, Z) getcwd(S, Z) #endif @@ -936,51 +739,12 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #define HDgetdrive() 0 #endif -#ifndef HDgetegid -#define HDgetegid() getegid() -#endif #ifndef HDgetenv #define HDgetenv(S) getenv(S) #endif -#ifndef HDgeteuid -#define HDgeteuid() geteuid() -#endif -#ifndef HDgetgid -#define HDgetgid() getgid() -#endif -#ifndef HDgetgrgid -#define HDgetgrgid(G) getgrgid(G) -#endif -#ifndef HDgetgrnam -#define HDgetgrnam(S) getgrnam(S) -#endif -#ifndef HDgetgroups -#define HDgetgroups(Z, G) getgroups(Z, G) -#endif -#ifndef HDgethostbyaddr -#define HDgethostbyaddr(A, B, C) gethostbyaddr((A), (B), (C)) -#endif -#ifndef HDgethostname -#define HDgethostname(N, L) gethostname(N, L) -#endif -#ifndef HDgetpgrp -#define HDgetpgrp() getpgrp() -#endif #ifndef HDgetpid #define HDgetpid() getpid() #endif -#ifndef HDgetppid -#define HDgetppid() getppid() -#endif -#ifndef HDgetpwnam -#define HDgetpwnam(S) getpwnam(S) -#endif -#ifndef HDgetpwuid -#define HDgetpwuid(U) getpwuid(U) -#endif -#ifndef HDgetrusage -#define HDgetrusage(X, S) getrusage(X, S) -#endif /* Don't define HDgets - gets() was deprecated in C99 and removed in C11 */ #ifdef HDgets @@ -990,81 +754,21 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDgettimeofday #define HDgettimeofday(S, P) gettimeofday(S, P) #endif -#ifndef HDgetuid -#define HDgetuid() getuid() -#endif #ifndef HDgmtime #define HDgmtime(T) gmtime(T) #endif -#ifndef HDhtonl -#define HDhtonl(X) htonl((X)) -#endif -#ifndef HDhtons -#define HDhtons(X) htons((X)) -#endif -#ifndef HDinet_addr -#define HDinet_addr(C) inet_addr((C)) -#endif -#ifndef HDinet_ntoa -#define HDinet_ntoa(C) inet_ntoa((C)) -#endif -#ifndef HDisalnum -#define HDisalnum(C) isalnum((int)(C)) /* Cast for Solaris warning */ -#endif -#ifndef HDisalpha -#define HDisalpha(C) isalpha((int)(C)) /* Cast for Solaris warning */ -#endif #ifndef HDisatty #define HDisatty(F) isatty(F) #endif -#ifndef HDiscntrl -#define HDiscntrl(C) iscntrl((int)(C)) /* Cast for solaris warning */ -#endif -#ifndef HDisdigit -#define HDisdigit(C) isdigit((int)(C)) /* Cast for Solaris warning */ -#endif -#ifndef HDisgraph -#define HDisgraph(C) isgraph((int)(C)) /* Cast for Solaris warning*/ -#endif -#ifndef HDislower -#define HDislower(C) islower((int)(C)) /* Cast for Solaris warning */ -#endif #ifndef HDisnan #define HDisnan(X) isnan(X) #endif -#ifndef HDisprint -#define HDisprint(C) isprint((int)(C)) /* Cast for Solaris warning */ -#endif -#ifndef HDispunct -#define HDispunct(C) ispunct((int)(C)) /* Cast for Solaris warning */ -#endif -#ifndef HDisspace -#define HDisspace(C) isspace((int)(C)) /* Cast for Solaris warning */ -#endif -#ifndef HDisupper -#define HDisupper(C) isupper((int)(C)) /* Cast for Solaris warning */ -#endif -#ifndef HDisxdigit -#define HDisxdigit(C) isxdigit((int)(C)) /* Cast for Solaris warning */ -#endif -#ifndef HDkill -#define HDkill(P, S) kill(P, S) -#endif #ifndef HDlabs #define HDlabs(X) labs(X) #endif #ifndef HDldexp #define HDldexp(X, N) ldexp(X, N) #endif -#ifndef HDldiv -#define HDldiv(X, Y) ldiv(X, Y) -#endif -#ifndef HDlink -#define HDlink(OLD, NEW) link(OLD, NEW) -#endif -#ifndef HDlisten -#define HDlisten(A, B) listen((A), (B)) -#endif #ifndef HDllround #define HDllround(V) llround(V) #endif @@ -1074,9 +778,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDllroundl #define HDllroundl(V) llroundl(V) #endif -#ifndef HDlocaleconv -#define HDlocaleconv() localeconv() -#endif #ifndef HDlocaltime #define HDlocaltime(T) localtime(T) #endif @@ -1089,9 +790,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDlog10 #define HDlog10(X) log10(X) #endif -#ifndef HDlongjmp -#define HDlongjmp(J, N) longjmp(J, N) -#endif #ifndef HDlround #define HDlround(V) lround(V) #endif @@ -1107,75 +805,24 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDlstat #define HDlstat(S, B) lstat(S, B) #endif -#ifndef HDmalloc -#define HDmalloc(Z) malloc(Z) -#endif -#ifndef HDposix_memalign -#define HDposix_memalign(P, A, Z) posix_memalign(P, A, Z) -#endif -#ifndef HDmblen -#define HDmblen(S, N) mblen(S, N) -#endif -#ifndef HDmbstowcs -#define HDmbstowcs(P, S, Z) mbstowcs(P, S, Z) -#endif -#ifndef HDmbtowc -#define HDmbtowc(P, S, Z) mbtowc(P, S, Z) -#endif -#ifndef HDmemchr -#define HDmemchr(S, C, Z) memchr(S, C, Z) -#endif -#ifndef HDmemcmp -#define HDmemcmp(X, Y, Z) memcmp(X, Y, Z) -#endif -#ifndef HDmemcpy -#define HDmemcpy(X, Y, Z) memcpy(X, Y, Z) -#endif -#ifndef HDmemmove -#define HDmemmove(X, Y, Z) memmove((char *)(X), (const char *)(Y), Z) -#endif -#ifndef HDmemset -#define HDmemset(X, C, Z) memset(X, C, Z) -#endif #ifndef HDmkdir #define HDmkdir(S, M) mkdir(S, M) #endif -#ifndef HDmkfifo -#define HDmkfifo(S, M) mkfifo(S, M) -#endif #ifndef HDmktime #define HDmktime(T) mktime(T) #endif -#ifndef HDmodf -#define HDmodf(X, Y) modf(X, Y) -#endif #ifndef HDnanosleep #define HDnanosleep(N, O) nanosleep(N, O) #endif -#ifndef HDntohl -#define HDntohl(A) ntohl((A)) -#endif -#ifndef HDntohs -#define HDntohs(A) ntohs((A)) -#endif #ifndef HDopen #define HDopen(F, ...) open(F, __VA_ARGS__) #endif #ifndef HDopendir #define HDopendir(S) opendir(S) #endif -#ifndef HDpathconf -#define HDpathconf(S, N) pathconf(S, N) -#endif -#ifndef HDpause -#define HDpause() pause() -#endif #ifndef HDperror #define HDperror(S) perror(S) #endif -#ifndef HDpipe -#define HDpipe(F) pipe(F) -#endif #ifndef HDpow #define HDpow(X, Y) pow(X, Y) #endif @@ -1185,9 +832,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDpread #define HDpread(F, B, C, O) pread(F, B, C, O) #endif -#ifndef HDprintf -#define HDprintf printf /*varargs*/ -#endif #ifndef HDputc #define HDputc(C, F) putc(C, F) #endif @@ -1200,12 +844,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDpwrite #define HDpwrite(F, B, C, O) pwrite(F, B, C, O) #endif -#ifndef HDqsort -#define HDqsort(M, N, Z, F) qsort(M, N, Z, F) -#endif -#ifndef HDraise -#define HDraise(N) raise(N) -#endif /* clang-format off */ #ifdef H5_HAVE_RAND_R @@ -1252,9 +890,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDreaddir #define HDreaddir(D) readdir(D) #endif -#ifndef HDrealloc -#define HDrealloc(M, Z) realloc(M, Z) -#endif #ifndef HDrealpath #define HDrealpath(F1, F2) realpath(F1, F2) #endif @@ -1267,9 +902,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDrewind #define HDrewind(F) rewind(F) #endif -#ifndef HDrewinddir -#define HDrewinddir(D) rewinddir(D) -#endif #ifndef HDround #define HDround(V) round(V) #endif @@ -1285,36 +917,12 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDscanf #define HDscanf scanf /*varargs*/ #endif -#ifndef HDselect -#define HDselect(N, RD, WR, ER, T) select(N, RD, WR, ER, T) -#endif #ifndef HDsetbuf #define HDsetbuf(F, S) setbuf(F, S) #endif #ifndef HDsetenv #define HDsetenv(N, V, O) setenv(N, V, O) #endif -#ifndef HDsetgid -#define HDsetgid(G) setgid(G) -#endif -#ifndef HDsetjmp -#define HDsetjmp(J) setjmp(J) -#endif -#ifndef HDsetlocale -#define HDsetlocale(N, S) setlocale(N, S) -#endif -#ifndef HDsetpgid -#define HDsetpgid(P, PG) setpgid(P, PG) -#endif -#ifndef HDsetsid -#define HDsetsid() setsid() -#endif -#ifndef HDsetsockopt -#define HDsetsockopt(A, B, C, D, E) setsockopt((A), (B), (C), (D), (E)) -#endif -#ifndef HDsetuid -#define HDsetuid(U) setuid(U) -#endif #ifndef HDsetvbuf #define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, Z) #endif @@ -1324,54 +932,18 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDsigaction #define HDsigaction(S, A, O) sigaction((S), (A), (O)) #endif -#ifndef HDsigaddset -#define HDsigaddset(S, N) sigaddset(S, N) -#endif -#ifndef HDsigdelset -#define HDsigdelset(S, N) sigdelset(S, N) -#endif #ifndef HDsigemptyset #define HDsigemptyset(S) sigemptyset(S) #endif -#ifndef HDsigfillset -#define HDsigfillset(S) sigfillset(S) -#endif -#ifndef HDsigismember -#define HDsigismember(S, N) sigismember(S, N) -#endif -#ifndef HDsiglongjmp -#define HDsiglongjmp(J, N) siglongjmp(J, N) -#endif #ifndef HDsignal #define HDsignal(N, F) signal(N, F) #endif -#ifndef HDsigpending -#define HDsigpending(S) sigpending(S) -#endif -#ifndef HDsigprocmask -#define HDsigprocmask(H, S, O) sigprocmask(H, S, O) -#endif -#ifndef HDsigsetjmp -#define HDsigsetjmp(J, N) sigsetjmp(J, N) -#endif -#ifndef HDsigsuspend -#define HDsigsuspend(S) sigsuspend(S) -#endif -#ifndef HDsin -#define HDsin(X) sin(X) -#endif -#ifndef HDsinh -#define HDsinh(X) sinh(X) -#endif #ifndef HDsleep #define HDsleep(N) sleep(N) #endif #ifndef HDsnprintf #define HDsnprintf snprintf /*varargs*/ #endif -#ifndef HDsocket -#define HDsocket(A, B, C) socket((A), (B), (C)) -#endif #ifndef HDsprintf #define HDsprintf sprintf /*varargs*/ #endif @@ -1387,6 +959,13 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDstrcat #define HDstrcat(X, Y) strcat(X, Y) #endif +#ifndef HDstrcasestr +#if defined(H5_HAVE_STRCASESTR) +#define HDstrcasestr(X, Y) strcasestr(X, Y) +#else +#define HDstrcasestr(X, Y) H5_strcasestr(X, Y) +#endif +#endif #ifndef HDstrchr #define HDstrchr(S, C) strchr(S, C) #endif @@ -1396,9 +975,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDstrcasecmp #define HDstrcasecmp(X, Y) strcasecmp(X, Y) #endif -#ifndef HDstrcoll -#define HDstrcoll(X, Y) strcoll(X, Y) -#endif #ifndef HDstrcpy #define HDstrcpy(X, Y) strcpy(X, Y) #endif @@ -1417,6 +993,9 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDstrlen #define HDstrlen(S) strlen(S) #endif +#ifndef HDstrnlen +#define HDstrnlen(S, L) strnlen(S, L) +#endif #ifndef HDstrncat #define HDstrncat(X, Y, Z) strncat(X, Y, Z) #endif @@ -1429,126 +1008,39 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #ifndef HDstrndup #define HDstrndup(S, N) strndup(S, N) #endif -#ifndef HDstrpbrk -#define HDstrpbrk(X, Y) strpbrk(X, Y) -#endif #ifndef HDstrrchr #define HDstrrchr(S, C) strrchr(S, C) #endif -#ifndef HDstrspn -#define HDstrspn(X, Y) strspn(X, Y) -#endif #ifndef HDstrstr #define HDstrstr(X, Y) strstr(X, Y) #endif -#ifndef HDstrtod -#define HDstrtod(S, R) strtod(S, R) -#endif #ifndef HDstrtok #define HDstrtok(X, Y) strtok(X, Y) #endif #ifndef HDstrtok_r #define HDstrtok_r(X, Y, Z) strtok_r(X, Y, Z) #endif -#ifndef HDstrtol -#define HDstrtol(S, R, N) strtol(S, R, N) -#endif -#ifndef HDstrtoll -#define HDstrtoll(S, R, N) strtoll(S, R, N) -#endif -#ifndef HDstrtoul -#define HDstrtoul(S, R, N) strtoul(S, R, N) -#endif -#ifndef HDstrtoull -#define HDstrtoull(S, R, N) strtoull(S, R, N) -#endif -#ifndef HDstrtoumax -#define HDstrtoumax(S, R, N) strtoumax(S, R, N) -#endif -#ifndef HDstrxfrm -#define HDstrxfrm(X, Y, Z) strxfrm(X, Y, Z) -#endif -#ifndef HDsymlink -#define HDsymlink(F1, F2) symlink(F1, F2) -#endif -#ifndef HDsysconf -#define HDsysconf(N) sysconf(N) -#endif -#ifndef HDsystem -#define HDsystem(S) system(S) -#endif -#ifndef HDtan -#define HDtan(X) tan(X) -#endif -#ifndef HDtanh -#define HDtanh(X) tanh(X) -#endif -#ifndef HDtcdrain -#define HDtcdrain(F) tcdrain(F) -#endif -#ifndef HDtcflow -#define HDtcflow(F, A) tcflow(F, A) -#endif -#ifndef HDtcflush -#define HDtcflush(F, N) tcflush(F, N) -#endif -#ifndef HDtcgetattr -#define HDtcgetattr(F, T) tcgetattr(F, T) -#endif -#ifndef HDtcgetpgrp -#define HDtcgetpgrp(F) tcgetpgrp(F) -#endif -#ifndef HDtcsendbreak -#define HDtcsendbreak(F, N) tcsendbreak(F, N) -#endif -#ifndef HDtcsetattr -#define HDtcsetattr(F, O, T) tcsetattr(F, O, T) -#endif -#ifndef HDtcsetpgrp -#define HDtcsetpgrp(F, N) tcsetpgrp(F, N) -#endif #ifndef HDtime #define HDtime(T) time(T) #endif -#ifndef HDtimes -#define HDtimes(T) times(T) -#endif #ifndef HDtmpfile #define HDtmpfile() tmpfile() #endif -#ifndef HDtmpnam -#define HDtmpnam(S) tmpnam(S) -#endif #ifndef HDtolower #define HDtolower(C) tolower(C) #endif #ifndef HDtoupper #define HDtoupper(C) toupper(C) #endif -#ifndef HDttyname -#define HDttyname(F) ttyname(F) -#endif #ifndef HDtzset #define HDtzset() tzset() #endif -#ifndef HDumask -#define HDumask(N) umask(N) -#endif -#ifndef HDuname -#define HDuname(S) uname(S) -#endif -#ifndef HDungetc -#define HDungetc(C, F) ungetc(C, F) -#endif #ifndef HDunlink #define HDunlink(S) unlink(S) #endif #ifndef HDunsetenv #define HDunsetenv(S) unsetenv(S) #endif -#ifndef HDutime -#define HDutime(S, T) utime(S, T) -#endif #ifndef HDvasprintf #ifdef H5_HAVE_VASPRINTF @@ -1558,18 +1050,6 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); #endif #endif -#ifndef HDva_arg -#define HDva_arg(A, T) va_arg(A, T) -#endif -#ifndef HDva_copy -#define HDva_copy(D, S) va_copy(D, S) -#endif -#ifndef HDva_end -#define HDva_end(A) va_end(A) -#endif -#ifndef HDva_start -#define HDva_start(A, P) va_start(A, P) -#endif #ifndef HDvfprintf #define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A) #endif @@ -1582,18 +1062,6 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); #ifndef HDvsnprintf #define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A) #endif -#ifndef HDwait -#define HDwait(W) wait(W) -#endif -#ifndef HDwaitpid -#define HDwaitpid(P, W, O) waitpid(P, W, O) -#endif -#ifndef HDwcstombs -#define HDwcstombs(S, P, Z) wcstombs(S, P, Z) -#endif -#ifndef HDwctomb -#define HDwctomb(S, C) wctomb(S, C) -#endif #ifndef HDwrite #define HDwrite(F, M, Z) write(F, M, Z) #endif @@ -1613,10 +1081,10 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); */ #ifndef NDEBUG #define H5_CHECK_OVERFLOW(var, vartype, casttype) \ - { \ + do { \ casttype _tmp_overflow = (casttype)(var); \ - HDassert((var) == (vartype)_tmp_overflow); \ - } + assert((var) == (vartype)_tmp_overflow); \ + } while (0) #else /* NDEBUG */ #define H5_CHECK_OVERFLOW(var, vartype, casttype) #endif /* NDEBUG */ @@ -1629,7 +1097,7 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); { \ srctype _tmp_src = (srctype)(src); \ dsttype _tmp_dst = (dsttype)(_tmp_src); \ - HDassert(_tmp_src == (srctype)_tmp_dst); \ + assert(_tmp_src == (srctype)_tmp_dst); \ (dst) = _tmp_dst; \ } @@ -1639,8 +1107,8 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); { \ srctype _tmp_src = (srctype)(src); \ dsttype _tmp_dst = (dsttype)(_tmp_src); \ - HDassert(_tmp_src >= 0); \ - HDassert(_tmp_src == (srctype)_tmp_dst); \ + assert(_tmp_src >= 0); \ + assert(_tmp_src == (srctype)_tmp_dst); \ (dst) = _tmp_dst; \ } @@ -1650,8 +1118,8 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); { \ srctype _tmp_src = (srctype)(src); \ dsttype _tmp_dst = (dsttype)(_tmp_src); \ - HDassert(_tmp_dst >= 0); \ - HDassert(_tmp_src == (srctype)_tmp_dst); \ + assert(_tmp_dst >= 0); \ + assert(_tmp_src == (srctype)_tmp_dst); \ (dst) = _tmp_dst; \ } @@ -1659,8 +1127,8 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); { \ srctype _tmp_src = (srctype)(src); \ dsttype _tmp_dst = (dsttype)(_tmp_src); \ - HDassert(_tmp_src >= 0); \ - HDassert(_tmp_src == (srctype)_tmp_dst); \ + assert(_tmp_src >= 0); \ + assert(_tmp_src == (srctype)_tmp_dst); \ (dst) = _tmp_dst; \ } @@ -1682,10 +1150,15 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); * that will always generate the expected name. */ #define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) \ - ASSIGN_##srctype##_TO_##dsttype(dst, dsttype, src, srctype) + do { \ + ASSIGN_##srctype##_TO_##dsttype(dst, dsttype, src, srctype) \ + } while (0) #else /* NDEBUG */ -#define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) (dst) = (dsttype)(src); +#define H5_CHECKED_ASSIGN(dst, dsttype, src, srctype) \ + do { \ + (dst) = (dsttype)(src); \ + } while (0) #endif /* NDEBUG */ #if defined(H5_HAVE_WINDOW_PATH) @@ -1695,8 +1168,8 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); #define H5_DIR_SEPC '\\' #define H5_DIR_SEPS "\\" #define H5_CHECK_DELIMITER(SS) ((SS == H5_DIR_SEPC) || (SS == H5_DIR_SLASH_SEPC)) -#define H5_CHECK_ABSOLUTE(NAME) ((HDisalpha(NAME[0])) && (NAME[1] == ':') && (H5_CHECK_DELIMITER(NAME[2]))) -#define H5_CHECK_ABS_DRIVE(NAME) ((HDisalpha(NAME[0])) && (NAME[1] == ':')) +#define H5_CHECK_ABSOLUTE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':') && (H5_CHECK_DELIMITER(NAME[2]))) +#define H5_CHECK_ABS_DRIVE(NAME) ((isalpha(NAME[0])) && (NAME[1] == ':')) #define H5_CHECK_ABS_PATH(NAME) (H5_CHECK_DELIMITER(NAME[0])) #define H5_GET_LAST_DELIMITER(NAME, ptr) \ @@ -1790,8 +1263,9 @@ extern hbool_t H5_coll_api_sanity_check_g; extern H5_debug_t H5_debug_g; #define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream) -/* Do not use const else AIX strings does not show it. */ -extern char H5libhdf5_settings[]; /* embedded library information */ + +/* Embedded build information */ +extern const char H5libhdf5_settings[]; /*------------------------------------------------------------------------- * Purpose: These macros are inserted automatically just after the @@ -1920,9 +1394,6 @@ H5_DLL herr_t H5_trace_args(struct H5RS_str_t *rs, const char *type, va_list ap) * use initializers that require special cleanup code to * execute if FUNC_ENTER() fails since a failing FUNC_ENTER() * returns immediately without branching to the `done' label. - * - * Programmer: Quincey Koziol - * *------------------------------------------------------------------------- */ @@ -1936,34 +1407,34 @@ H5_DLL herr_t H5_trace_args(struct H5RS_str_t *rs, const char *type, va_list ap) * Handles H5XY_. */ #define H5_IS_API(S) \ - ('_' != ((const char *)S)[2] /* underscore at position 2 */ \ - && '_' != ((const char *)S)[3] /* underscore at position 3 */ \ - && !( /* NOT */ \ - ((const char *)S)[4] /* pos 4 exists */ \ - && (HDisupper(S[3]) || HDisdigit(S[3])) /* pos 3 dig | uc */ \ - && '_' == ((const char *)S)[4] /* pos 4 underscore */ \ + ('_' != ((const char *)S)[2] /* underscore at position 2 */ \ + && '_' != ((const char *)S)[3] /* underscore at position 3 */ \ + && !( /* NOT */ \ + ((const char *)S)[4] /* pos 4 exists */ \ + && (isupper(S[3]) || isdigit(S[3])) /* pos 3 dig | uc */ \ + && '_' == ((const char *)S)[4] /* pos 4 underscore */ \ )) /* `S' is the name of a function which is being tested to check if it's */ /* a public API function */ #define H5_IS_PUB(S) \ - (((HDisdigit(S[1]) || HDisupper(S[1])) && HDislower(S[2])) || \ - ((HDisdigit(S[2]) || HDisupper(S[2])) && HDislower(S[3])) || \ - (!S[4] || ((HDisdigit(S[3]) || HDisupper(S[3])) && HDislower(S[4])))) + (((isdigit(S[1]) || isupper(S[1])) && islower(S[2])) || \ + ((isdigit(S[2]) || isupper(S[2])) && islower(S[3])) || \ + (!S[4] || ((isdigit(S[3]) || isupper(S[3])) && islower(S[4])))) /* `S' is the name of a function which is being tested to check if it's */ /* a private library function */ #define H5_IS_PRIV(S) \ - (((HDisdigit(S[1]) || HDisupper(S[1])) && '_' == S[2] && HDislower(S[3])) || \ - ((HDisdigit(S[2]) || HDisupper(S[2])) && '_' == S[3] && HDislower(S[4])) || \ - ((HDisdigit(S[3]) || HDisupper(S[3])) && '_' == S[4] && HDislower(S[5]))) + (((isdigit(S[1]) || isupper(S[1])) && '_' == S[2] && islower(S[3])) || \ + ((isdigit(S[2]) || isupper(S[2])) && '_' == S[3] && islower(S[4])) || \ + ((isdigit(S[3]) || isupper(S[3])) && '_' == S[4] && islower(S[5]))) /* `S' is the name of a function which is being tested to check if it's */ /* a package private function */ #define H5_IS_PKG(S) \ - (((HDisdigit(S[1]) || HDisupper(S[1])) && '_' == S[2] && '_' == S[3] && HDislower(S[4])) || \ - ((HDisdigit(S[2]) || HDisupper(S[2])) && '_' == S[3] && '_' == S[4] && HDislower(S[5])) || \ - ((HDisdigit(S[3]) || HDisupper(S[3])) && '_' == S[4] && '_' == S[5] && HDislower(S[6]))) + (((isdigit(S[1]) || isupper(S[1])) && '_' == S[2] && '_' == S[3] && islower(S[4])) || \ + ((isdigit(S[2]) || isupper(S[2])) && '_' == S[3] && '_' == S[4] && islower(S[5])) || \ + ((isdigit(S[3]) || isupper(S[3])) && '_' == S[4] && '_' == S[5] && islower(S[6]))) /* global library version information string */ extern char H5_lib_vers_info_g[]; @@ -1991,7 +1462,7 @@ typedef struct H5_api_struct { #define H5_FIRST_THREAD_INIT pthread_once(&H5TS_first_init_g, H5TS_pthread_first_thread_init); #endif -/* Macros for threadsafe HDF-5 Phase I locks */ +/* Macros for threadsafe HDF5 Phase I locks */ #define H5_API_LOCK H5TS_mutex_lock(&H5_g.init_lock); #define H5_API_UNLOCK H5TS_mutex_unlock(&H5_g.init_lock); @@ -2025,14 +1496,6 @@ extern hbool_t H5_libterm_g; /* Is the library being shutdown? */ #endif /* H5_HAVE_THREADSAFE */ -/* Extern global to determine if we should use selection I/O if available (this - * variable should be removed once selection I/O performs as well as the - * previous scalar I/O implementation - * - * NOTE: Must be exposed via H5_DLLVAR so parallel tests pass on Windows. - */ -H5_DLLVAR hbool_t H5_use_selection_io_g; - #ifdef H5_HAVE_CODESTACK /* Include required function stack header */ @@ -2045,10 +1508,6 @@ H5_DLLVAR hbool_t H5_use_selection_io_g; #define H5_POP_FUNC /* void */ #endif /* H5_HAVE_CODESTACK */ -#ifdef H5_HAVE_MPE -extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ -#endif - /* Forward declaration of H5CXpush() / H5CXpop() */ /* (Including H5CXprivate.h creates bad circular dependencies - QAK, 3/18/2018) */ H5_DLL herr_t H5CX_push(void); @@ -2061,9 +1520,9 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); \ if (!func_check) { \ /* Check function naming status */ \ - HDassert(asrt && \ - "Function naming conventions are incorrect - check H5_IS_API|PUB|PRIV|PKG macros in " \ - "H5private.h (this is usually due to an incorrect number of underscores)"); \ + assert(asrt && \ + "Function naming conventions are incorrect - check H5_IS_API|PUB|PRIV|PKG macros in " \ + "H5private.h (this is usually due to an incorrect number of underscores)"); \ \ /* Don't check again */ \ func_check = TRUE; \ @@ -2090,9 +1549,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); H5_API_LOCK /* Local variables for API routines */ -#define FUNC_ENTER_API_VARS \ - MPE_LOG_VARS \ - H5TRACE_DECL +#define FUNC_ENTER_API_VARS H5TRACE_DECL #define FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_VARS \ @@ -2103,7 +1560,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Initialize the library */ \ if (!H5_INIT_GLOBAL && !H5_TERM_GLOBAL) { \ if (H5_init_library() < 0) \ - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "library initialization failed") \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "library initialization failed"); \ } #define FUNC_ENTER_API_PUSH(err) \ @@ -2112,11 +1569,9 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); \ /* Push the API context */ \ if (H5CX_push() < 0) \ - HGOTO_ERROR(H5E_FUNC, H5E_CANTSET, err, "can't set API context") \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTSET, err, "can't set API context"); \ else \ - api_ctx_pushed = TRUE; \ - \ - BEGIN_MPE_LOG + api_ctx_pushed = TRUE; /* Use this macro for all "normal" API functions */ #define FUNC_ENTER_API(err) \ @@ -2158,7 +1613,6 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ FUNC_ENTER_API_COMMON \ H5_PUSH_FUNC \ - BEGIN_MPE_LOG \ { /* @@ -2176,13 +1630,12 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); FUNC_ENTER_API_VARS \ FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \ FUNC_ENTER_API_THREADSAFE; \ - BEGIN_MPE_LOG \ { /* * Use this macro for API functions that should only perform initialization * of the library or an interface, but not push any state (API context, - * function name, start MPE logging, etc) examples are: H5open. + * function name, etc.) examples are: H5open. * */ #define FUNC_ENTER_API_NOPUSH(err) \ @@ -2358,11 +1811,8 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); /*------------------------------------------------------------------------- - * Purpose: Register function exit for code profiling. This should be - * the last statement executed by a function. - * - * Programmer: Quincey Koziol - * + * Purpose: Register function exit for code profiling. This should be + * the last statement executed by a function. *------------------------------------------------------------------------- */ /* Threadsafety termination code for API routines */ @@ -2370,9 +1820,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); H5_API_UNLOCK \ H5_API_SET_CANCEL -#define FUNC_LEAVE_API_COMMON(ret_value) \ - FINISH_MPE_LOG \ - H5TRACE_RETURN(ret_value); +#define FUNC_LEAVE_API_COMMON(ret_value) H5TRACE_RETURN(ret_value); #define FUNC_LEAVE_API(ret_value) \ ; \ @@ -2506,12 +1954,17 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Union for const/non-const pointer for use by functions that manipulate * pointers but do not write to their targets or return pointers to const - * specified locations. This helps us avoid compiler warnings. */ + * specified locations. Also used for I/O functions that work for read and + * write - these functions are expected to never write to these locations in the + * write case. This helps us avoid compiler warnings. */ typedef union { void *vp; const void *cvp; } H5_flexible_const_ptr_t; +/* File-independent encode/decode routines */ +#include "H5encode.h" + /* Private functions, not part of the publicly documented API */ H5_DLL herr_t H5_init_library(void); H5_DLL void H5_term_library(void); diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf.h b/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf.h index 7d9ae6ad54..1af609970f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf.h @@ -1,27 +1,18 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* H5pubconf.h Generated By CMake during the configuration */ +/* src/H5config.h. Generated from H5config.h.in by configure. */ +/* src/H5config.h.in. Generated from configure.ac by autoheader. */ +#pragma once #ifndef H5pubconf_h_ #define H5pubconf_h_ -#pragma once #if defined(_WIN32) #include "H5pubconf_WIN32.h" -#else +#else #include #if defined(_POSIX_C_SOURCE) #include "H5pubconf_POSIX.h" + #else #error "Unknown platform." #endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf_POSIX.h b/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf_POSIX.h index 1aad33f85a..8c76e23dc4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf_POSIX.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf_POSIX.h @@ -14,13 +14,13 @@ #ifndef H5_CONFIG_H_ #define H5_CONFIG_H_ -/* Define if the Windows virtual file driver should be compiled */ +/* Define if this is a Windows machine */ /* #undef H5_HAVE_WINDOWS */ /* Define if using MinGW */ /* #undef H5_HAVE_MINGW */ -/* Define if on the Windows platform and default WIN32 API */ +/* Define if on the Windows platform and using the Win32 API */ /* #undef H5_HAVE_WIN32_API */ /* Define if using a Windows compiler (i.e. Visual Studio) */ @@ -101,6 +101,9 @@ /* Define to 1 if you have the `clock_gettime' function. */ #define H5_HAVE_CLOCK_GETTIME 1 +/* Define to 1 if CLOCK_MONOTONIC_COARSE is available */ +#define H5_HAVE_CLOCK_MONOTONIC_COARSE 1 + /* Define if the function stack tracing code is to be compiled in */ /* #undef H5_HAVE_CODESTACK */ @@ -119,9 +122,6 @@ /* Define to 1 if you have the header file. */ #define H5_HAVE_DLFCN_H 1 -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_DMALLOC_H */ - /* Define if library information should be embedded in the executables */ #define H5_HAVE_EMBEDDED_LIBINFO 1 @@ -138,7 +138,7 @@ /* #undef H5_HAVE_FILTER_SZIP */ /* Determine if __float128 is available */ -#define H5_HAVE_FLOAT128 1 +/* #undef H5_HAVE_FLOAT128 */ /* Define to 1 if you have the `flock' function. */ #define H5_HAVE_FLOCK 1 @@ -192,9 +192,6 @@ /* Define to 1 if you have the `dl' library (-ldl). */ #define H5_HAVE_LIBDL 1 -/* Define to 1 if you have the `dmalloc' library (-ldmalloc). */ -/* #undef H5_HAVE_LIBDMALLOC */ - /* Proceed to build with libhdfs */ /* #undef H5_HAVE_LIBHDFS */ @@ -204,9 +201,6 @@ /* Define to 1 if you have the `m' library (-lm). */ #define H5_HAVE_LIBM 1 -/* Define to 1 if you have the `mpe' library (-lmpe). */ -/* #undef H5_HAVE_LIBMPE */ - /* Define to 1 if you have the `pthread' library (-lpthread). */ /* #undef H5_HAVE_LIBPTHREAD */ @@ -217,29 +211,17 @@ /* #undef H5_HAVE_LIBWS2_32 */ /* Define to 1 if you have the `z' library (-lz). */ -/* #undef H5_HAVE_LIBZ */ +#define H5_HAVE_LIBZ 1 /* Define to 1 if you have the `lseek64' function. */ #define H5_HAVE_LSEEK64 1 -/* Define to 1 if you have the `lstat' function. */ -#define H5_HAVE_LSTAT 1 - /* Define if the map API (H5M) should be compiled */ /* #undef H5_HAVE_MAP_API */ -/* Define to 1 if you have the header file. */ -#define H5_HAVE_MEMORY_H 1 - /* Define whether the Mirror virtual file driver (VFD) will be compiled */ /* #undef H5_HAVE_MIRROR_VFD */ -/* Define if we have MPE support */ -/* #undef H5_HAVE_MPE */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_MPE_H */ - /* Define if MPI_Comm_c2f and MPI_Comm_f2c exist */ /* #undef H5_HAVE_MPI_MULTI_LANG_Comm */ @@ -273,6 +255,12 @@ /* Define to 1 if you have the header file. */ #define H5_HAVE_PTHREAD_H 1 +/* Define to 1 if 'pthread_condattr_setclock()' is available */ +/* #undef H5_HAVE_PTHREAD_CONDATTR_SETCLOCK */ + +/* Define to 1 if PTHREAD_MUTEX_ADAPTIVE_NP is available */ +/* #undef H5_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */ + /* Define to 1 if you have the header file. */ #define H5_HAVE_PWD_H 1 @@ -289,39 +277,18 @@ compiled */ /* #undef H5_HAVE_ROS3_VFD */ -/* Define to 1 if you have the `setsysinfo' function. */ -/* #undef H5_HAVE_SETSYSINFO */ - -/* Define to 1 if you have the `siglongjmp' function. */ -#define H5_HAVE_SIGLONGJMP 1 - -/* Define to 1 if you have the `sigprocmask' function. */ -#define H5_HAVE_SIGPROCMASK 1 - -/* Define to 1 if you have the `sigsetjmp' function. */ -#define H5_HAVE_SIGSETJMP 1 - -/* Define to 1 if you have the `srandom' function. */ -#define H5_HAVE_SRANDOM 1 - /* Define to 1 if you have the `stat64' function. */ #define H5_HAVE_STAT64 1 /* Define if struct stat has the st_blocks field */ #define H5_HAVE_STAT_ST_BLOCKS 1 -/* Define to 1 if you have the header file. */ -#define H5_HAVE_STDLIB_H 1 +/* Define to 1 if you have the `strcasestr' function. */ +#define H5_HAVE_STRCASESTR 1 /* Define to 1 if you have the `strdup' function. */ #define H5_HAVE_STRDUP 1 -/* Define to 1 if you have the header file. */ -#define H5_HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define H5_HAVE_STRING_H 1 - /* Define if struct text_info is defined */ /* #undef H5_HAVE_STRUCT_TEXT_INFO */ @@ -400,7 +367,7 @@ /* #undef H5_HAVE_WINDOW_PATH */ /* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_ZLIB_H */ +#define H5_HAVE_ZLIB_H 1 /* Define to 1 if you have the `_getvideoconfig' function. */ /* #undef H5_HAVE__GETVIDEOCONFIG */ @@ -436,9 +403,6 @@ /* Define to the sub-directory where libtool stores uninstalled libraries. */ /* #undef H5_LT_OBJDIR */ -/* Define to enable internal memory allocation sanity checking. */ -/* #undef H5_MEMORY_ALLOC_SANITY_CHECK */ - /* Define if deprecated public API symbols are disabled */ /* #undef H5_NO_DEPRECATED_SYMBOLS */ @@ -452,7 +416,7 @@ #define H5_PACKAGE_NAME "HDF5" /* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.13.2" +#define H5_PACKAGE_STRING "HDF5 1.14.2" /* Define to the one symbol short name of this package. */ #define H5_PACKAGE_TARNAME "hdf5" @@ -461,10 +425,10 @@ #define H5_PACKAGE_URL "http://www.hdfgroup.org" /* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.13.2" +#define H5_PACKAGE_VERSION "1.14.2" /* Determine the maximum decimal precision in C */ -#define H5_PAC_C_MAX_REAL_PRECISION 33 +#define H5_PAC_C_MAX_REAL_PRECISION /* Define Fortran Maximum Real Decimal Precision */ #define H5_PAC_FC_MAX_REAL_PRECISION @@ -623,10 +587,10 @@ #define H5_SIZEOF_UNSIGNED 4 /* The size of `_Quad', as computed by sizeof. */ -#define H5_SIZEOF__QUAD 0 +#define H5_SIZEOF__QUAD /* The size of `__float128', as computed by sizeof. */ -#define H5_SIZEOF___FLOAT128 16 +#define H5_SIZEOF___FLOAT128 /* Define if strict file format checks are enabled */ /* #undef H5_STRICT_FORMAT_CHECKS */ @@ -659,7 +623,7 @@ /* #undef H5_USING_MEMCHECKER */ /* Version number of package */ -#define H5_VERSION "1.13.2" +#define H5_VERSION "1.14.2" /* Data accuracy is preferred to speed during data conversions */ #define H5_WANT_DATA_ACCURACY 1 diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf_WIN32.h b/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf_WIN32.h index a4ee0872da..2831d4dec0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf_WIN32.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5pubconf_WIN32.h @@ -1,696 +1,660 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* H5pubconf.h Generated By CMake during the configuration */ - -#ifndef H5_CONFIG_H_ -#define H5_CONFIG_H_ - -/* Define if the Windows virtual file driver should be compiled */ -#define H5_HAVE_WINDOWS 1 - -/* Define if using MinGW */ -/* #undef H5_HAVE_MINGW */ - -/* Define if on the Windows platform and default WIN32 API */ -#define H5_HAVE_WIN32_API 1 - -/* Define if using a Windows compiler (i.e. Visual Studio) */ -#define H5_HAVE_VISUAL_STUDIO 1 - -/* Define the default plugins path to compile */ -#define H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%\\hdf5\\lib\\plugin" - -/* Define if dev_t is a scalar */ -/* #undef H5_DEV_T_IS_SCALAR */ - -/* Define if your system is IBM ppc64le and cannot convert some long double - values correctly. */ -/* #undef H5_DISABLE_SOME_LDOUBLE_CONV */ - -/* Define to dummy `main' function (if any) required to link to the Fortran - libraries. */ -/* #undef H5_FC_DUMMY_MAIN */ - -/* Define if F77 and FC dummy `main' functions are identical. */ -/* #undef H5_FC_DUMMY_MAIN_EQ_F77 */ - -/* Define to a macro mangling the given C identifier (in lower and upper - case), which must not contain underscores, for linking with Fortran. */ -#define H5_FC_FUNC(name,NAME) name ## _ - -/* As FC_FUNC, but for C identifiers containing underscores. */ -#define H5_FC_FUNC_(name,NAME) name ## _ - -/* Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE */ -#define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE - -/* Define if we have Fortran C_LONG_DOUBLE */ -#define H5_FORTRAN_HAVE_C_LONG_DOUBLE - -/* Define if we have Fortran intrinsic C_SIZEOF */ -/* #undef H5_FORTRAN_HAVE_C_SIZEOF */ - -/* Define if we have Fortran intrinsic SIZEOF */ -/* #undef H5_FORTRAN_HAVE_SIZEOF */ - -/* Define if we have Fortran intrinsic STORAGE_SIZE */ -/* #undef H5_FORTRAN_HAVE_STORAGE_SIZE */ - -/* Determine the size of C long double */ -/* #undef H5_FORTRAN_SIZEOF_LONG_DOUBLE */ - -/* Define Fortran compiler ID */ -#define H5_Fortran_COMPILER_ID - -/* Define number of valid Fortran INTEGER KINDs (must be defined before F_IKIND)*/ -/* #undef H5_H5CONFIG_F_NUM_IKIND */ - -/* Define valid Fortran INTEGER KINDs */ -/* #undef H5_H5CONFIG_F_IKIND */ - -/* Define number of valid Fortran REAL KINDs (must be defined before F_RKIND) */ -/* #undef H5_H5CONFIG_F_NUM_RKIND */ - -/* Define valid Fortran REAL KINDs */ -/* #undef H5_H5CONFIG_F_RKIND */ - -/* Define valid Fortran REAL KINDs Sizeof */ -/* #undef H5_H5CONFIG_F_RKIND_SIZEOF */ - -/* Define to 1 if you have the `alarm' function. */ -/* #undef H5_HAVE_ALARM */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_ARPA_INET_H */ - -/* Define to 1 if you have the `asprintf' function. */ -/* #undef H5_HAVE_ASPRINTF */ - -/* Define if the __attribute__(()) extension is present */ -/* #undef H5_HAVE_ATTRIBUTE */ - -/* Define to 1 if you have the `clock_gettime' function. */ -/* #undef H5_HAVE_CLOCK_GETTIME */ - -/* Define if the function stack tracing code is to be compiled in */ -/* #undef H5_HAVE_CODESTACK */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_CURL_CURL_H */ - -/* Define if Darwin or Mac OS X */ -/* #undef H5_HAVE_DARWIN */ - -/* Define if the direct I/O virtual file driver (VFD) should be compiled */ -/* #undef H5_HAVE_DIRECT */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_DIRENT_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_DLFCN_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_DMALLOC_H */ - -/* Define if library information should be embedded in the executables */ -#define H5_HAVE_EMBEDDED_LIBINFO 1 - -/* Define to 1 if you have the `fcntl' function. */ -/* #undef H5_HAVE_FCNTL */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_FEATURES_H */ - -/* Define if support for deflate (zlib) filter is enabled */ -/* #undef H5_HAVE_FILTER_DEFLATE */ - -/* Define if support for szip filter is enabled */ -/* #undef H5_HAVE_FILTER_SZIP */ - -/* Determine if __float128 is available */ -/* #undef H5_HAVE_FLOAT128 */ - -/* Define to 1 if you have the `flock' function. */ -/* #undef H5_HAVE_FLOCK */ - -/* Define to 1 if you have the `fork' function. */ -/* #undef H5_HAVE_FORK */ - -/* Define to 1 if you have the `fseeko' function. */ -/* #undef H5_HAVE_FSEEKO */ - -/* Determine if INTEGER*16 is available */ -/* #undef H5_HAVE_Fortran_INTEGER_SIZEOF_16 */ - -/* Define to 1 if you have the `GetConsoleScreenBufferInfo' function. */ -#define H5_HAVE_GETCONSOLESCREENBUFFERINFO 1 - -/* Define to 1 if you have the `gethostname' function. */ -#define H5_HAVE_GETHOSTNAME 1 - -/* Define to 1 if you have the `getpwuid' function. */ -/* #undef H5_HAVE_GETPWUID */ - -/* Define to 1 if you have the `getrusage' function. */ -/* #undef H5_HAVE_GETRUSAGE */ - -/* Define to 1 if you have the `gettextinfo' function. */ -/* #undef H5_HAVE_GETTEXTINFO */ - -/* Define to 1 if you have the `gettimeofday' function. */ -#define H5_HAVE_GETTIMEOFDAY 1 - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_HDFS_H */ - -/* Define if parallel library will contain instrumentation to detect correct - optimization operation */ -/* #undef H5_HAVE_INSTRUMENTED_LIBRARY */ - -/* Define if IOC VFD is built */ -/* #undef H5_HAVE_IOC_VFD */ - -/* Define to 1 if you have the `ioctl' function. */ -/* #undef H5_HAVE_IOCTL */ - -/* Define to 1 if you have the `crypto' library (-lcrypto). */ -/* #undef H5_HAVE_LIBCRYPTO */ - -/* Define to 1 if you have the `curl' library (-lcurl). */ -/* #undef H5_HAVE_LIBCURL */ - -/* Define to 1 if you have the `dl' library (-ldl). */ -/* #undef H5_HAVE_LIBDL */ - -/* Define to 1 if you have the `dmalloc' library (-ldmalloc). */ -/* #undef H5_HAVE_LIBDMALLOC */ - -/* Proceed to build with libhdfs */ -/* #undef H5_HAVE_LIBHDFS */ - -/* Define to 1 if you have the `jvm' library (-ljvm). */ -/* #undef H5_HAVE_LIBJVM */ - -/* Define to 1 if you have the `m' library (-lm). */ -#define H5_HAVE_LIBM 1 - -/* Define to 1 if you have the `mpe' library (-lmpe). */ -/* #undef H5_HAVE_LIBMPE */ - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -/* #undef H5_HAVE_LIBPTHREAD */ - -/* Define to 1 if you have the `sz' library (-lsz). */ -/* #undef H5_HAVE_LIBSZ */ - -/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ -#define H5_HAVE_LIBWS2_32 1 - -/* Define to 1 if you have the `z' library (-lz). */ -/* #undef H5_HAVE_LIBZ */ - -/* Define to 1 if you have the `lseek64' function. */ -/* #undef H5_HAVE_LSEEK64 */ - -/* Define to 1 if you have the `lstat' function. */ -/* #undef H5_HAVE_LSTAT */ - -/* Define if the map API (H5M) should be compiled */ -/* #undef H5_HAVE_MAP_API */ - -/* Define to 1 if you have the header file. */ -#define H5_HAVE_MEMORY_H 1 - -/* Define whether the Mirror virtual file driver (VFD) will be compiled */ -/* #undef H5_HAVE_MIRROR_VFD */ - -/* Define if we have MPE support */ -/* #undef H5_HAVE_MPE */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_MPE_H */ - -/* Define if MPI_Comm_c2f and MPI_Comm_f2c exist */ -/* #undef H5_HAVE_MPI_MULTI_LANG_Comm */ - -/* Define if MPI_Info_c2f and MPI_Info_f2c exist */ -/* #undef H5_HAVE_MPI_MULTI_LANG_Info */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_NETDB_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_NETINET_IN_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_OPENSSL_EVP_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_OPENSSL_HMAC_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_OPENSSL_SHA_H */ - -/* Define if we have parallel support */ -/* #undef H5_HAVE_PARALLEL */ - -/* Define if we have support for writing to filtered datasets in parallel */ -/* #undef H5_HAVE_PARALLEL_FILTERED_WRITES */ - -/* Define if both pread and pwrite exist. */ -/* #undef H5_HAVE_PREADWRITE */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_PTHREAD_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_PWD_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_QUADMATH_H */ - -/* Define to 1 if you have the `random' function. */ -/* #undef H5_HAVE_RANDOM */ - -/* Define to 1 if you have the `rand_r' function. */ -/* #undef H5_HAVE_RAND_R */ - -/* Define whether the Read-Only S3 virtual file driver (VFD) should be - compiled */ -/* #undef H5_HAVE_ROS3_VFD */ - -/* Define to 1 if you have the `setsysinfo' function. */ -/* #undef H5_HAVE_SETSYSINFO */ - -/* Define to 1 if you have the `siglongjmp' function. */ -/* #undef H5_HAVE_SIGLONGJMP */ - -/* Define to 1 if you have the `sigprocmask' function. */ -/* #undef H5_HAVE_SIGPROCMASK */ - -/* Define to 1 if you have the `sigsetjmp' function. */ -/* #undef H5_HAVE_SIGSETJMP */ - -/* Define to 1 if you have the `srandom' function. */ -/* #undef H5_HAVE_SRANDOM */ - -/* Define to 1 if you have the `stat64' function. */ -/* #undef H5_HAVE_STAT64 */ - -/* Define if struct stat has the st_blocks field */ -/* #undef H5_HAVE_STAT_ST_BLOCKS */ - -/* Define to 1 if you have the header file. */ -#define H5_HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strdup' function. */ -#define H5_HAVE_STRDUP 1 - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_STRINGS_H */ - -/* Define to 1 if you have the header file. */ -#define H5_HAVE_STRING_H 1 - -/* Define if struct text_info is defined */ -/* #undef H5_HAVE_STRUCT_TEXT_INFO */ - -/* Define if struct videoconfig is defined */ -/* #undef H5_HAVE_STRUCT_VIDEOCONFIG */ - -/* Define if Subfiling VFD is built */ -/* #undef H5_HAVE_SUBFILING_VFD */ - -/* Define if have stdatomic.h for Subfiling VFD */ -/* #undef H5_HAVE_STDATOMIC_H */ - -/* Define to 1 if you have the `symlink' function. */ -/* #undef H5_HAVE_SYMLINK */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_SYS_FILE_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_SYS_IOCTL_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_SYS_RESOURCE_H */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_SYS_SOCKET_H */ - -/* Define to 1 if you have the header file. */ -#define H5_HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_SYS_TIME_H */ - -/* Define to 1 if you have the header file. */ -#define H5_HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_SZLIB_H */ - -#if defined(_WIN32) && !defined(H5_BUILT_AS_DYNAMIC_LIB) -/* Not supported on WIN32 platforms with static linking */ -/* #undef H5_HAVE_THREADSAFE */ -#else -/* Define if we have thread safe support */ -/* #undef H5_HAVE_THREADSAFE */ -#endif - -/* Define if timezone is a global variable */ -#define H5_HAVE_TIMEZONE 1 - -/* Define if the ioctl TIOCGETD is defined */ -/* #undef H5_HAVE_TIOCGETD */ - -/* Define if the ioctl TIOGWINSZ is defined */ -/* #undef H5_HAVE_TIOCGWINSZ */ - -/* Define to 1 if you have the `tmpfile' function. */ -#define H5_HAVE_TMPFILE 1 - -/* Define if tm_gmtoff is a member of struct tm */ -/* #undef H5_HAVE_TM_GMTOFF */ - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_UNISTD_H */ - -/* Define to 1 if you have the `vasprintf' function. */ -/* #undef H5_HAVE_VASPRINTF */ - -/* Define to 1 if you have the `waitpid' function. */ -/* #undef H5_HAVE_WAITPID */ - -/* Define to 1 if you have the 'InitOnceExecuteOnce' function. */ -/* #undef H5_HAVE_WIN_THREADS */ - -/* Define if your system has window style path name. */ -#define H5_HAVE_WINDOW_PATH 1 - -/* Define to 1 if you have the header file. */ -/* #undef H5_HAVE_ZLIB_H */ - -/* Define to 1 if you have the `_getvideoconfig' function. */ -/* #undef H5_HAVE__GETVIDEOCONFIG */ - -/* Define to 1 if you have the `_scrsize' function. */ -/* #undef H5_HAVE__SCRSIZE */ - -/* Define if the library will ignore file locks when disabled */ -#define H5_IGNORE_DISABLED_FILE_LOCKS 1 - -/* Define if the high-level library headers should be included in hdf5.h */ -#define H5_INCLUDE_HL 1 - -/* Define if new-style references should be used with dimension scales */ -/* #undef H5_DIMENSION_SCALES_WITH_NEW_REF */ - -/* Define if your system can convert long double to (unsigned) long long - values correctly. */ -#define H5_LDOUBLE_TO_LLONG_ACCURATE 1 - -/* Define if your system converts long double to (unsigned) long values with - special algorithm. */ -/* #undef H5_LDOUBLE_TO_LONG_SPECIAL */ - -/* Define if your system can convert (unsigned) long long to long double - values correctly. */ -#define H5_LLONG_TO_LDOUBLE_CORRECT 1 - -/* Define if your system can convert (unsigned) long to long double values - with special algorithm. */ -/* #undef H5_LONG_TO_LDOUBLE_SPECIAL */ - -/* Define to the sub-directory where libtool stores uninstalled libraries. */ -/* #undef H5_LT_OBJDIR */ - -/* Define to enable internal memory allocation sanity checking. */ -/* #undef H5_MEMORY_ALLOC_SANITY_CHECK */ - -/* Define if deprecated public API symbols are disabled */ -/* #undef H5_NO_DEPRECATED_SYMBOLS */ - -/* Name of package */ -#define H5_PACKAGE "hdf5" - -/* Define to the address where bug reports for this package should be sent. */ -#define H5_PACKAGE_BUGREPORT "help@hdfgroup.org" - -/* Define to the full name of this package. */ -#define H5_PACKAGE_NAME "HDF5" - -/* Define to the full name and version of this package. */ -#define H5_PACKAGE_STRING "HDF5 1.13.2" - -/* Define to the one symbol short name of this package. */ -#define H5_PACKAGE_TARNAME "hdf5" - -/* Define to the home page for this package. */ -#define H5_PACKAGE_URL "http://www.hdfgroup.org" - -/* Define to the version of this package. */ -#define H5_PACKAGE_VERSION "1.13.2" - -/* Determine the maximum decimal precision in C */ -#define H5_PAC_C_MAX_REAL_PRECISION 15 - -/* Define Fortran Maximum Real Decimal Precision */ -#define H5_PAC_FC_MAX_REAL_PRECISION - -/* The size of `bool', as computed by sizeof. */ -#define H5_SIZEOF_BOOL 1 - -/* The size of `char', as computed by sizeof. */ -#define H5_SIZEOF_CHAR 1 - -/* The size of `double', as computed by sizeof. */ -#define H5_SIZEOF_DOUBLE 8 - -/* The size of `float', as computed by sizeof. */ -#define H5_SIZEOF_FLOAT 4 - -/* The size of `int', as computed by sizeof. */ -#define H5_SIZEOF_INT 4 - -/* The size of `int16_t', as computed by sizeof. */ -#define H5_SIZEOF_INT16_T 2 - -/* The size of `int32_t', as computed by sizeof. */ -#define H5_SIZEOF_INT32_T 4 - -/* The size of `int64_t', as computed by sizeof. */ -#define H5_SIZEOF_INT64_T 8 - -/* The size of `int8_t', as computed by sizeof. */ -#define H5_SIZEOF_INT8_T 1 - -/* The size of `int_fast16_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST16_T 4 - -/* The size of `int_fast32_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST32_T 4 - -/* The size of `int_fast64_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST64_T 8 - -/* The size of `int_fast8_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_FAST8_T 1 - -/* The size of `int_least16_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST16_T 2 - -/* The size of `int_least32_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST32_T 4 - -/* The size of `int_least64_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST64_T 8 - -/* The size of `int_least8_t', as computed by sizeof. */ -#define H5_SIZEOF_INT_LEAST8_T 1 - -#if !defined(__APPLE__) - -/* The size of `size_t', as computed by sizeof. */ -#define H5_SIZEOF_SIZE_T 8 - -/* The size of `ssize_t', as computed by sizeof. */ -/* #undef H5_SIZEOF_SSIZE_T */ - -/* The size of `long', as computed by sizeof. */ -#define H5_SIZEOF_LONG 4 - -/* The size of `long double', as computed by sizeof. */ -#define H5_SIZEOF_LONG_DOUBLE 8 - -#else - - /* On Apple, to support Universal Binaries (where multiple CPU - architectures exist in one library/executable), we can't assume - the machine doing the compiling has the same endianness or type - sizes as all the various architectures (PowerPC, Intel, ARM). */ - - # if defined(__LP64__) && __LP64__ - #define H5_SIZEOF_LONG 8 - #define H5_SIZEOF_SIZE_T 8 - #define H5_SIZEOF_SSIZE_T 8 - # else - #define H5_SIZEOF_LONG 4 - #define H5_SIZEOF_SIZE_T 4 - #define H5_SIZEOF_SSIZE_T 4 - # endif - - # if defined(__i386__) || defined(__x86_64__) - #define H5_SIZEOF_LONG_DOUBLE 16 - # elif defined(__aarch64__) - #define H5_SIZEOF_LONG_DOUBLE 8 - # else - #define H5_SIZEOF_LONG_DOUBLE 8 - # endif - -#endif - -/* The size of `long long', as computed by sizeof. */ -#if !defined(__APPLE__) - #define H5_SIZEOF_LONG_LONG 8 -#else - #define H5_SIZEOF_LONG_LONG 8 -#endif - -/* The size of `off64_t', as computed by sizeof. */ -/* #undef H5_SIZEOF_OFF64_T */ - -/* The size of `off_t', as computed by sizeof. */ -#define H5_SIZEOF_OFF_T 4 - -/* The size of `ptrdiff_t', as computed by sizeof. */ -/* #undef H5_SIZEOF_PTRDIFF_T */ - -/* The size of `short', as computed by sizeof. */ -#define H5_SIZEOF_SHORT 2 - -/* The size of `time_t', as computed by sizeof. */ -#define H5_SIZEOF_TIME_T 8 - -/* The size of `uint16_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT16_T 2 - -/* The size of `uint32_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT32_T 4 - -/* The size of `uint64_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT64_T 8 - -/* The size of `uint8_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT8_T 1 - -/* The size of `uint_fast16_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST16_T 4 - -/* The size of `uint_fast32_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST32_T 4 - -/* The size of `uint_fast64_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST64_T 8 - -/* The size of `uint_fast8_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_FAST8_T 1 - -/* The size of `uint_least16_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST16_T 2 - -/* The size of `uint_least32_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST32_T 4 - -/* The size of `uint_least64_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST64_T 8 - -/* The size of `uint_least8_t', as computed by sizeof. */ -#define H5_SIZEOF_UINT_LEAST8_T 1 - -/* The size of `unsigned', as computed by sizeof. */ -#define H5_SIZEOF_UNSIGNED 4 - -/* The size of `_Quad', as computed by sizeof. */ -#define H5_SIZEOF__QUAD 0 - -/* The size of `__float128', as computed by sizeof. */ -#define H5_SIZEOF___FLOAT128 0 - -/* Define if strict file format checks are enabled */ -/* #undef H5_STRICT_FORMAT_CHECKS */ - -/* Define if your system supports pthread_attr_setscope(&attribute, - PTHREAD_SCOPE_SYSTEM) call. */ -/* #undef H5_SYSTEM_SCOPE_THREADS */ - -/* Define using v1.6 public API symbols by default */ -/* #undef H5_USE_16_API_DEFAULT */ - -/* Define using v1.8 public API symbols by default */ -/* #undef H5_USE_18_API_DEFAULT */ - -/* Define using v1.10 public API symbols by default */ -/* #undef H5_USE_110_API_DEFAULT */ - -/* Define using v1.12 public API symbols by default */ -/* #undef H5_USE_112_API_DEFAULT */ - -/* Define using v1.14 public API symbols by default */ -#define H5_USE_114_API_DEFAULT 1 - -/* Define if the library will use file locking */ -#define H5_USE_FILE_LOCKING 1 - -/* Define if a memory checking tool will be used on the library, to cause - library to be very picky about memory operations and also disable the - internal free list manager code. */ -/* #undef H5_USING_MEMCHECKER */ - -/* Version number of package */ -#define H5_VERSION "1.13.2" - -/* Data accuracy is preferred to speed during data conversions */ -#define H5_WANT_DATA_ACCURACY 1 - -/* Check exception handling functions during data conversions */ -#define H5_WANT_DCONV_EXCEPTION 1 - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if !defined(__APPLE__) -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#else -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#endif - -/* #undef WORDS_BIGENDIAN */ - -/* Number of bits in a file offset, on hosts where this is settable. */ -/* #undef H5__FILE_OFFSET_BITS */ - -/* Define for large files, on AIX-style hosts. */ -/* #undef H5__LARGE_FILES */ - -/* Define to `long int' if does not define. */ -/* #undef H5_off_t */ - -/* Define to `long' if does not define. */ -/* #undef H5_ssize_t */ - -#endif +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* H5pubconf.h Generated By CMake during the configuration */ + +#ifndef H5_CONFIG_H_ +#define H5_CONFIG_H_ + +/* Define if this is a Windows machine */ +#define H5_HAVE_WINDOWS 1 + +/* Define if using MinGW */ +/* #undef H5_HAVE_MINGW */ + +/* Define if on the Windows platform and using the Win32 API */ +#define H5_HAVE_WIN32_API 1 + +/* Define if using a Windows compiler (i.e. Visual Studio) */ +#define H5_HAVE_VISUAL_STUDIO 1 + +/* Define the default plugins path to compile */ +#define H5_DEFAULT_PLUGINDIR "%ALLUSERSPROFILE%\\hdf5\\lib\\plugin" + +/* Define if dev_t is a scalar */ +/* #undef H5_DEV_T_IS_SCALAR */ + +/* Define if your system is IBM ppc64le and cannot convert some long double + values correctly. */ +/* #undef H5_DISABLE_SOME_LDOUBLE_CONV */ + +/* Define to dummy `main' function (if any) required to link to the Fortran + libraries. */ +/* #undef H5_FC_DUMMY_MAIN */ + +/* Define if F77 and FC dummy `main' functions are identical. */ +/* #undef H5_FC_DUMMY_MAIN_EQ_F77 */ + +/* Define to a macro mangling the given C identifier (in lower and upper + case), which must not contain underscores, for linking with Fortran. */ +#define H5_FC_FUNC(name,NAME) name ## _ + +/* As FC_FUNC, but for C identifiers containing underscores. */ +#define H5_FC_FUNC_(name,NAME) name ## _ + +/* Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE */ +#define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE + +/* Define if we have Fortran C_LONG_DOUBLE */ +#define H5_FORTRAN_HAVE_C_LONG_DOUBLE + +/* Define if we have Fortran intrinsic C_SIZEOF */ +/* #undef H5_FORTRAN_HAVE_C_SIZEOF */ + +/* Define if we have Fortran intrinsic SIZEOF */ +/* #undef H5_FORTRAN_HAVE_SIZEOF */ + +/* Define if we have Fortran intrinsic STORAGE_SIZE */ +/* #undef H5_FORTRAN_HAVE_STORAGE_SIZE */ + +/* Determine the size of C long double */ +/* #undef H5_FORTRAN_SIZEOF_LONG_DOUBLE */ + +/* Define Fortran compiler ID */ +#define H5_Fortran_COMPILER_ID + +/* Define number of valid Fortran INTEGER KINDs (must be defined before F_IKIND)*/ +/* #undef H5_H5CONFIG_F_NUM_IKIND */ + +/* Define valid Fortran INTEGER KINDs */ +/* #undef H5_H5CONFIG_F_IKIND */ + +/* Define number of valid Fortran REAL KINDs (must be defined before F_RKIND) */ +/* #undef H5_H5CONFIG_F_NUM_RKIND */ + +/* Define valid Fortran REAL KINDs */ +/* #undef H5_H5CONFIG_F_RKIND */ + +/* Define valid Fortran REAL KINDs Sizeof */ +/* #undef H5_H5CONFIG_F_RKIND_SIZEOF */ + +/* Define to 1 if you have the `alarm' function. */ +/* #undef H5_HAVE_ALARM */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_ARPA_INET_H */ + +/* Define to 1 if you have the `asprintf' function. */ +/* #undef H5_HAVE_ASPRINTF */ + +/* Define if the __attribute__(()) extension is present */ +/* #undef H5_HAVE_ATTRIBUTE */ + +/* Define to 1 if you have the `clock_gettime' function. */ +/* #undef H5_HAVE_CLOCK_GETTIME */ + +/* Define to 1 if CLOCK_MONOTONIC_COARSE is available */ +/* #undef H5_HAVE_CLOCK_MONOTONIC_COARSE */ + +/* Define if the function stack tracing code is to be compiled in */ +/* #undef H5_HAVE_CODESTACK */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_CURL_CURL_H */ + +/* Define if Darwin or Mac OS X */ +/* #undef H5_HAVE_DARWIN */ + +/* Define if the direct I/O virtual file driver (VFD) should be compiled */ +/* #undef H5_HAVE_DIRECT */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_DIRENT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_DLFCN_H */ + +/* Define if library information should be embedded in the executables */ +#define H5_HAVE_EMBEDDED_LIBINFO 1 + +/* Define to 1 if you have the `fcntl' function. */ +/* #undef H5_HAVE_FCNTL */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_FEATURES_H */ + +/* Define if support for deflate (zlib) filter is enabled */ +/* #undef H5_HAVE_FILTER_DEFLATE */ + +/* Define if support for szip filter is enabled */ +/* #undef H5_HAVE_FILTER_SZIP */ + +/* Determine if __float128 is available */ +/* #undef H5_HAVE_FLOAT128 */ + +/* Define to 1 if you have the `flock' function. */ +/* #undef H5_HAVE_FLOCK */ + +/* Define to 1 if you have the `fork' function. */ +/* #undef H5_HAVE_FORK */ + +/* Define to 1 if you have the `fseeko' function. */ +/* #undef H5_HAVE_FSEEKO */ + +/* Determine if INTEGER*16 is available */ +/* #undef H5_HAVE_Fortran_INTEGER_SIZEOF_16 */ + +/* Define to 1 if you have the `GetConsoleScreenBufferInfo' function. */ +#define H5_HAVE_GETCONSOLESCREENBUFFERINFO 1 + +/* Define to 1 if you have the `gethostname' function. */ +#define H5_HAVE_GETHOSTNAME 1 + +/* Define to 1 if you have the `getpwuid' function. */ +/* #undef H5_HAVE_GETPWUID */ + +/* Define to 1 if you have the `getrusage' function. */ +/* #undef H5_HAVE_GETRUSAGE */ + +/* Define to 1 if you have the `gettextinfo' function. */ +/* #undef H5_HAVE_GETTEXTINFO */ + +/* Define to 1 if you have the `gettimeofday' function. */ +#define H5_HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_HDFS_H */ + +/* Define if parallel library will contain instrumentation to detect correct + optimization operation */ +/* #undef H5_HAVE_INSTRUMENTED_LIBRARY */ + +/* Define if IOC VFD is built */ +/* #undef H5_HAVE_IOC_VFD */ + +/* Define to 1 if you have the `ioctl' function. */ +/* #undef H5_HAVE_IOCTL */ + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +/* #undef H5_HAVE_LIBCRYPTO */ + +/* Define to 1 if you have the `curl' library (-lcurl). */ +/* #undef H5_HAVE_LIBCURL */ + +/* Define to 1 if you have the `dl' library (-ldl). */ +/* #undef H5_HAVE_LIBDL */ + +/* Proceed to build with libhdfs */ +/* #undef H5_HAVE_LIBHDFS */ + +/* Define to 1 if you have the `jvm' library (-ljvm). */ +/* #undef H5_HAVE_LIBJVM */ + +/* Define to 1 if you have the `m' library (-lm). */ +#define H5_HAVE_LIBM 1 + +/* Define to 1 if you have the `pthread' library (-lpthread). */ +/* #undef H5_HAVE_LIBPTHREAD */ + +/* Define to 1 if you have the `sz' library (-lsz). */ +/* #undef H5_HAVE_LIBSZ */ + +/* Define to 1 if you have the `ws2_32' library (-lws2_32). */ +#define H5_HAVE_LIBWS2_32 1 + +/* Define to 1 if you have the `z' library (-lz). */ +/* #undef H5_HAVE_LIBZ */ + +/* Define to 1 if you have the `lseek64' function. */ +/* #undef H5_HAVE_LSEEK64 */ + +/* Define if the map API (H5M) should be compiled */ +/* #undef H5_HAVE_MAP_API */ + +/* Define whether the Mirror virtual file driver (VFD) will be compiled */ +/* #undef H5_HAVE_MIRROR_VFD */ + +/* Define if MPI_Comm_c2f and MPI_Comm_f2c exist */ +/* #undef H5_HAVE_MPI_MULTI_LANG_Comm */ + +/* Define if MPI_Info_c2f and MPI_Info_f2c exist */ +/* #undef H5_HAVE_MPI_MULTI_LANG_Info */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_NETDB_H */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_NETINET_IN_H */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_OPENSSL_EVP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_OPENSSL_HMAC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_OPENSSL_SHA_H */ + +/* Define if we have parallel support */ +/* #undef H5_HAVE_PARALLEL */ + +/* Define if we have support for writing to filtered datasets in parallel */ +/* #undef H5_HAVE_PARALLEL_FILTERED_WRITES */ + +/* Define if both pread and pwrite exist. */ +/* #undef H5_HAVE_PREADWRITE */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_PTHREAD_H */ + +/* Define to 1 if 'pthread_condattr_setclock()' is available */ +/* #undef H5_HAVE_PTHREAD_CONDATTR_SETCLOCK */ + +/* Define to 1 if PTHREAD_MUTEX_ADAPTIVE_NP is available */ +/* #undef H5_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_PWD_H */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_QUADMATH_H */ + +/* Define to 1 if you have the `random' function. */ +/* #undef H5_HAVE_RANDOM */ + +/* Define to 1 if you have the `rand_r' function. */ +/* #undef H5_HAVE_RAND_R */ + +/* Define whether the Read-Only S3 virtual file driver (VFD) should be + compiled */ +/* #undef H5_HAVE_ROS3_VFD */ + +/* Define to 1 if you have the `stat64' function. */ +/* #undef H5_HAVE_STAT64 */ + +/* Define if struct stat has the st_blocks field */ +/* #undef H5_HAVE_STAT_ST_BLOCKS */ + +/* Define to 1 if you have the `strcasestr' function. */ +/* #undef H5_HAVE_STRCASESTR */ + +/* Define to 1 if you have the `strdup' function. */ +#define H5_HAVE_STRDUP 1 + +/* Define if struct text_info is defined */ +/* #undef H5_HAVE_STRUCT_TEXT_INFO */ + +/* Define if struct videoconfig is defined */ +/* #undef H5_HAVE_STRUCT_VIDEOCONFIG */ + +/* Define if Subfiling VFD is built */ +/* #undef H5_HAVE_SUBFILING_VFD */ + +/* Define if have stdatomic.h for Subfiling VFD */ +/* #undef H5_HAVE_STDATOMIC_H */ + +/* Define to 1 if you have the `symlink' function. */ +/* #undef H5_HAVE_SYMLINK */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_SYS_FILE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_SYS_IOCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_SYS_RESOURCE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_SYS_SOCKET_H */ + +/* Define to 1 if you have the header file. */ +#define H5_HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_SYS_TIME_H */ + +/* Define to 1 if you have the header file. */ +#define H5_HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_SZLIB_H */ + +#if defined(_WIN32) && !defined(H5_BUILT_AS_DYNAMIC_LIB) +/* Not supported on WIN32 platforms with static linking */ +/* #undef H5_HAVE_THREADSAFE */ +#else +/* Define if we have thread safe support */ +/* #undef H5_HAVE_THREADSAFE */ +#endif + +/* Define if timezone is a global variable */ +#define H5_HAVE_TIMEZONE 1 + +/* Define if the ioctl TIOCGETD is defined */ +/* #undef H5_HAVE_TIOCGETD */ + +/* Define if the ioctl TIOGWINSZ is defined */ +/* #undef H5_HAVE_TIOCGWINSZ */ + +/* Define to 1 if you have the `tmpfile' function. */ +#define H5_HAVE_TMPFILE 1 + +/* Define if tm_gmtoff is a member of struct tm */ +/* #undef H5_HAVE_TM_GMTOFF */ + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_UNISTD_H */ + +/* Define to 1 if you have the `vasprintf' function. */ +/* #undef H5_HAVE_VASPRINTF */ + +/* Define to 1 if you have the `waitpid' function. */ +/* #undef H5_HAVE_WAITPID */ + +/* Define to 1 if you have the 'InitOnceExecuteOnce' function. */ +/* #undef H5_HAVE_WIN_THREADS */ + +/* Define if your system has window style path name. */ +#define H5_HAVE_WINDOW_PATH 1 + +/* Define to 1 if you have the header file. */ +/* #undef H5_HAVE_ZLIB_H */ + +/* Define to 1 if you have the `_getvideoconfig' function. */ +/* #undef H5_HAVE__GETVIDEOCONFIG */ + +/* Define to 1 if you have the `_scrsize' function. */ +/* #undef H5_HAVE__SCRSIZE */ + +/* Define if the library will ignore file locks when disabled */ +#define H5_IGNORE_DISABLED_FILE_LOCKS 1 + +/* Define if the high-level library headers should be included in hdf5.h */ +#define H5_INCLUDE_HL 1 + +/* Define if new-style references should be used with dimension scales */ +/* #undef H5_DIMENSION_SCALES_WITH_NEW_REF */ + +/* Define if your system can convert long double to (unsigned) long long + values correctly. */ +#define H5_LDOUBLE_TO_LLONG_ACCURATE 1 + +/* Define if your system converts long double to (unsigned) long values with + special algorithm. */ +/* #undef H5_LDOUBLE_TO_LONG_SPECIAL */ + +/* Define if your system can convert (unsigned) long long to long double + values correctly. */ +#define H5_LLONG_TO_LDOUBLE_CORRECT 1 + +/* Define if your system can convert (unsigned) long to long double values + with special algorithm. */ +/* #undef H5_LONG_TO_LDOUBLE_SPECIAL */ + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +/* #undef H5_LT_OBJDIR */ + +/* Define if deprecated public API symbols are disabled */ +/* #undef H5_NO_DEPRECATED_SYMBOLS */ + +/* Name of package */ +#define H5_PACKAGE "hdf5" + +/* Define to the address where bug reports for this package should be sent. */ +#define H5_PACKAGE_BUGREPORT "help@hdfgroup.org" + +/* Define to the full name of this package. */ +#define H5_PACKAGE_NAME "HDF5" + +/* Define to the full name and version of this package. */ +#define H5_PACKAGE_STRING "HDF5 1.14.2" + +/* Define to the one symbol short name of this package. */ +#define H5_PACKAGE_TARNAME "hdf5" + +/* Define to the home page for this package. */ +#define H5_PACKAGE_URL "http://www.hdfgroup.org" + +/* Define to the version of this package. */ +#define H5_PACKAGE_VERSION "1.14.2" + +/* Determine the maximum decimal precision in C */ +#define H5_PAC_C_MAX_REAL_PRECISION + +/* Define Fortran Maximum Real Decimal Precision */ +#define H5_PAC_FC_MAX_REAL_PRECISION + +/* The size of `bool', as computed by sizeof. */ +#define H5_SIZEOF_BOOL 1 + +/* The size of `char', as computed by sizeof. */ +#define H5_SIZEOF_CHAR 1 + +/* The size of `double', as computed by sizeof. */ +#define H5_SIZEOF_DOUBLE 8 + +/* The size of `float', as computed by sizeof. */ +#define H5_SIZEOF_FLOAT 4 + +/* The size of `int', as computed by sizeof. */ +#define H5_SIZEOF_INT 4 + +/* The size of `int16_t', as computed by sizeof. */ +#define H5_SIZEOF_INT16_T 2 + +/* The size of `int32_t', as computed by sizeof. */ +#define H5_SIZEOF_INT32_T 4 + +/* The size of `int64_t', as computed by sizeof. */ +#define H5_SIZEOF_INT64_T 8 + +/* The size of `int8_t', as computed by sizeof. */ +#define H5_SIZEOF_INT8_T 1 + +/* The size of `int_fast16_t', as computed by sizeof. */ +#define H5_SIZEOF_INT_FAST16_T 4 + +/* The size of `int_fast32_t', as computed by sizeof. */ +#define H5_SIZEOF_INT_FAST32_T 4 + +/* The size of `int_fast64_t', as computed by sizeof. */ +#define H5_SIZEOF_INT_FAST64_T 8 + +/* The size of `int_fast8_t', as computed by sizeof. */ +#define H5_SIZEOF_INT_FAST8_T 1 + +/* The size of `int_least16_t', as computed by sizeof. */ +#define H5_SIZEOF_INT_LEAST16_T 2 + +/* The size of `int_least32_t', as computed by sizeof. */ +#define H5_SIZEOF_INT_LEAST32_T 4 + +/* The size of `int_least64_t', as computed by sizeof. */ +#define H5_SIZEOF_INT_LEAST64_T 8 + +/* The size of `int_least8_t', as computed by sizeof. */ +#define H5_SIZEOF_INT_LEAST8_T 1 + +#if !defined(__APPLE__) + +/* The size of `size_t', as computed by sizeof. */ +#define H5_SIZEOF_SIZE_T 8 + +/* The size of `ssize_t', as computed by sizeof. */ +/* #undef H5_SIZEOF_SSIZE_T */ + +/* The size of `long', as computed by sizeof. */ +#define H5_SIZEOF_LONG 4 + +/* The size of `long double', as computed by sizeof. */ +#define H5_SIZEOF_LONG_DOUBLE 8 + +#else + + /* On Apple, to support Universal Binaries (where multiple CPU + architectures exist in one library/executable), we can't assume + the machine doing the compiling has the same endianness or type + sizes as all the various architectures (PowerPC, Intel, ARM). */ + + # if defined(__LP64__) && __LP64__ + #define H5_SIZEOF_LONG 8 + #define H5_SIZEOF_SIZE_T 8 + #define H5_SIZEOF_SSIZE_T 8 + # else + #define H5_SIZEOF_LONG 4 + #define H5_SIZEOF_SIZE_T 4 + #define H5_SIZEOF_SSIZE_T 4 + # endif + + # if defined(__i386__) || defined(__x86_64__) + #define H5_SIZEOF_LONG_DOUBLE 16 + # elif defined(__aarch64__) + #define H5_SIZEOF_LONG_DOUBLE 8 + # else + #define H5_SIZEOF_LONG_DOUBLE 8 + # endif + +#endif + +/* The size of `long long', as computed by sizeof. */ +#if !defined(__APPLE__) + #define H5_SIZEOF_LONG_LONG 8 +#else + #define H5_SIZEOF_LONG_LONG 8 +#endif + +/* The size of `off64_t', as computed by sizeof. */ +/* #undef H5_SIZEOF_OFF64_T */ + +/* The size of `off_t', as computed by sizeof. */ +#define H5_SIZEOF_OFF_T 4 + +/* The size of `ptrdiff_t', as computed by sizeof. */ +/* #undef H5_SIZEOF_PTRDIFF_T */ + +/* The size of `short', as computed by sizeof. */ +#define H5_SIZEOF_SHORT 2 + +/* The size of `time_t', as computed by sizeof. */ +#define H5_SIZEOF_TIME_T 8 + +/* The size of `uint16_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT16_T 2 + +/* The size of `uint32_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT32_T 4 + +/* The size of `uint64_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT64_T 8 + +/* The size of `uint8_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT8_T 1 + +/* The size of `uint_fast16_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT_FAST16_T 4 + +/* The size of `uint_fast32_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT_FAST32_T 4 + +/* The size of `uint_fast64_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT_FAST64_T 8 + +/* The size of `uint_fast8_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT_FAST8_T 1 + +/* The size of `uint_least16_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT_LEAST16_T 2 + +/* The size of `uint_least32_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT_LEAST32_T 4 + +/* The size of `uint_least64_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT_LEAST64_T 8 + +/* The size of `uint_least8_t', as computed by sizeof. */ +#define H5_SIZEOF_UINT_LEAST8_T 1 + +/* The size of `unsigned', as computed by sizeof. */ +#define H5_SIZEOF_UNSIGNED 4 + +/* The size of `_Quad', as computed by sizeof. */ +#define H5_SIZEOF__QUAD + +/* The size of `__float128', as computed by sizeof. */ +#define H5_SIZEOF___FLOAT128 + +/* Define if strict file format checks are enabled */ +/* #undef H5_STRICT_FORMAT_CHECKS */ + +/* Define if your system supports pthread_attr_setscope(&attribute, + PTHREAD_SCOPE_SYSTEM) call. */ +/* #undef H5_SYSTEM_SCOPE_THREADS */ + +/* Define using v1.6 public API symbols by default */ +/* #undef H5_USE_16_API_DEFAULT */ + +/* Define using v1.8 public API symbols by default */ +/* #undef H5_USE_18_API_DEFAULT */ + +/* Define using v1.10 public API symbols by default */ +/* #undef H5_USE_110_API_DEFAULT */ + +/* Define using v1.12 public API symbols by default */ +/* #undef H5_USE_112_API_DEFAULT */ + +/* Define using v1.14 public API symbols by default */ +#define H5_USE_114_API_DEFAULT 1 + +/* Define if the library will use file locking */ +#define H5_USE_FILE_LOCKING 1 + +/* Define if a memory checking tool will be used on the library, to cause + library to be very picky about memory operations and also disable the + internal free list manager code. */ +/* #undef H5_USING_MEMCHECKER */ + +/* Version number of package */ +#define H5_VERSION "1.14.2" + +/* Data accuracy is preferred to speed during data conversions */ +#define H5_WANT_DATA_ACCURACY 1 + +/* Check exception handling functions during data conversions */ +#define H5_WANT_DCONV_EXCEPTION 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if !defined(__APPLE__) +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#else +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#endif + +/* #undef WORDS_BIGENDIAN */ + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef H5__FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef H5__LARGE_FILES */ + +/* Define to `long int' if does not define. */ +/* #undef H5_off_t */ + +/* Define to `long' if does not define. */ +/* #undef H5_ssize_t */ + +#endif diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5public.h b/externals/coda-oss/modules/drivers/hdf5/include/H5public.h index 47e1a5fba0..a95a7f6e3b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5public.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5public.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -80,7 +79,7 @@ /** * For minor interface/format changes */ -#define H5_VERS_MINOR 13 +#define H5_VERS_MINOR 14 /** * For tweaks, bug-fixes, or development */ @@ -92,7 +91,7 @@ /** * Full version string */ -#define H5_VERS_INFO "HDF5 library version: 1.13.2" +#define H5_VERS_INFO "HDF5 library version: 1.14.2" #define H5check() H5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE) @@ -397,19 +396,6 @@ typedef struct H5O_token_t { } H5O_token_t; //! -/** - * Allocation statistics info struct - */ -typedef struct H5_alloc_stats_t { - unsigned long long total_alloc_bytes; /**< Running count of total # of bytes allocated */ - size_t curr_alloc_bytes; /**< Current # of bytes allocated */ - size_t peak_alloc_bytes; /**< Peak # of bytes allocated */ - size_t max_block_size; /**< Largest block allocated */ - size_t total_alloc_blocks_count; /**< Running count of total # of blocks allocated */ - size_t curr_alloc_blocks_count; /**< Current # of blocks allocated */ - size_t peak_alloc_blocks_count; /**< Peak # of blocks allocated */ -} H5_alloc_stats_t; - /** * Library shutdown callback, used by H5atclose(). */ @@ -435,7 +421,7 @@ extern "C" { * issued. If one finds that an HDF5 library function is failing * inexplicably, H5open() can be called first. It is safe to call * H5open() before an application issues any other function calls to - * the HDF5 library as there are no damaging side effects in calling + * the HDF5 library, as there are no damaging side effects in calling * it more than once. */ H5_DLL herr_t H5open(void); @@ -448,13 +434,13 @@ H5_DLL herr_t H5open(void); * * \details H5atclose() registers a callback that the HDF5 library will invoke * when closing. The full capabilities of the HDF5 library are - * available to callbacks invoked through this mechanism, library + * available to callbacks invoked through this mechanism, and library * shutdown will only begin in earnest when all callbacks have been * invoked and have returned. * * Registered callbacks are invoked in LIFO order, similar to the * Standard C 'atexit' routine. For example, if 'func1' is registered, - * then 'func2', when the library is closing 'func2' will + * then 'func2', when the library is closing 'func2', will * be invoked first, then 'func1'. * * The \p ctx pointer will be passed to \p func when it's invoked. @@ -463,7 +449,7 @@ H5_DLL herr_t H5open(void); * If the HDF5 library is initialized and closed more than once, the * \p func callback must be registered within each open/close cycle. * - * \since 1.13.0 + * \since 1.14.0 */ H5_DLL herr_t H5atclose(H5_atclose_func_t func, void *ctx); /** @@ -488,13 +474,13 @@ H5_DLL herr_t H5close(void); * function is in situations where the library is dynamically linked * into an application and is un-linked from the application before * exit() gets called. In those situations, a routine installed with - * atexit() would jump to a routine which was no longer in memory, + * atexit() would jump to a routine that was no longer in memory, * causing errors. * * \attention In order to be effective, this routine \Emph{must} be called * before any other HDF5 function calls, and must be called each * time the library is loaded/linked into the application (the first - * time and after it's been un-loaded). + * time and after it's been unloaded). */ H5_DLL herr_t H5dont_atexit(void); /** @@ -506,7 +492,7 @@ H5_DLL herr_t H5dont_atexit(void); * of the library, freeing any unused memory. * * It is not required that H5garbage_collect() be called at any - * particular time; it is only necessary in certain situations where + * particular time; it is only necessary for certain situations where * the application has performed actions that cause the library to * allocate many objects. The application should call * H5garbage_collect() if it eventually releases those objects and @@ -590,27 +576,6 @@ H5_DLL herr_t H5set_free_list_limits(int reg_global_lim, int reg_list_lim, int a * \since 1.10.7 */ H5_DLL herr_t H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, size_t *fac_size); -/** - * \ingroup H5 - * \brief Gets the memory allocation statistics for the library - * - * \param[out] stats Memory allocation statistics - * \return \herr_t - * - * \details H5get_alloc_stats() gets the memory allocation statistics for the - * library, if the \c --enable-memory-alloc-sanity-check option was - * given when building the library. Applications can check whether - * this option was enabled detecting if the - * \c H5_MEMORY_ALLOC_SANITY_CHECK macro is defined. This option is - * enabled by default for debug builds of the library and disabled by - * default for non-debug builds. If the option is not enabled, all the - * values returned with be 0. These statistics are global for the - * entire library, but do not include allocations from chunked dataset - * I/O filters or non-native VOL connectors. - * - * \since 1.10.7 - */ -H5_DLL herr_t H5get_alloc_stats(H5_alloc_stats_t *stats); /** * \ingroup H5 * \brief Returns the HDF library release number @@ -687,7 +652,7 @@ H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) * after it has been closed. The value of \p is_terminating is * undefined if this routine fails. * - * \since 1.13.0 + * \since 1.14.0 */ H5_DLL herr_t H5is_library_terminating(hbool_t *is_terminating); /** @@ -713,13 +678,13 @@ H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts); * \param[in] mem Buffer to be freed. Can be NULL * \return \herr_t * - * \details H5free_memory() frees memory that has been allocated by the caller + * \details H5free_memory() frees the memory that has been allocated by the caller * with H5allocate_memory() or by the HDF5 library on behalf of the * caller. * * H5Tget_member_name() provides an example of memory allocation on * behalf of the caller: The function returns a buffer containing the - * name of a compound datatype member. It is the caller’s + * name of a compound datatype member. It is the caller's * responsibility to eventually free that buffer with H5free_memory(). * * \attention It is especially important to use this function to free memory @@ -745,7 +710,7 @@ H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts); H5_DLL herr_t H5free_memory(void *mem); /** * \ingroup H5 - * \brief Frees memory allocated by the HDF5 library + * \brief Allocates memory that will be freed later internally. * * \param[in] size The size in bytes of the buffer to be allocated * \param[in] clear Flag whether the new buffer is to be initialized with 0 @@ -763,7 +728,7 @@ H5_DLL herr_t H5free_memory(void *mem); * initialized. * * This function is intended to have the semantics of malloc() and - * calloc(). However, unlike malloc() and calloc() which allow for a + * calloc(). However, unlike malloc() and calloc(), which allow for a * "special" pointer to be returned instead of NULL, this function * always returns NULL on failure or when size is set to 0 (zero). * @@ -775,7 +740,7 @@ H5_DLL herr_t H5free_memory(void *mem); * the same library that initially allocated it. In most cases, the * HDF5 API uses resources that are allocated and freed either * entirely by the user or entirely by the library, so this is not a - * problem. In rare cases, however, HDF5 API calls will free memory + * problem. In rare cases, however, HDF5 API calls will free the memory * that the user allocated. This function allows the user to safely * allocate this memory.\n * It is particularly important to use this function to allocate diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5version.h b/externals/coda-oss/modules/drivers/hdf5/include/H5version.h index 95ad74a3a9..945868be30 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5version.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5version.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/include/H5win32defs.h b/externals/coda-oss/modules/drivers/hdf5/include/H5win32defs.h index 1039f23fce..ba6028ae9d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/H5win32defs.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/H5win32defs.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,21 +10,22 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Purpose: This file is used to map HDF macros to Windows functions. This - * should get included H5private mappings, so as to override them. - * Any macro not mapped here, however, will receive a similar mapping - * inside H5private.h +/* Purpose: This file deals with Windows compatibility. MSVC is largely C99 + * compliant now, but we still need work-arounds for some POSIX + * things and MinGW. * + * This file must be included before the H5private.h HD mappings, so + * the definitions here will supersede them. */ -/* _MSC_VER = 192x VS2019 - * _MSC_VER = 191x VS2017 - * _MSC_VER = 1900 VS2015 - * _MSC_VER = 1800 VS2013 - * _MSC_VER = 1700 VS2012 - */ #ifdef H5_HAVE_WIN32_API +/* off_t exists on Windows, but is always a 32-bit long, even on 64-bit Windows, + * so we define HDoff_t to be __int64, which is the type of the st_size field + * of the _stati64 struct. + */ +#define HDoff_t __int64 + /* __int64 is the correct type for the st_size field of the _stati64 struct. * MSDN isn't very clear about this. */ @@ -33,38 +33,22 @@ typedef struct _stati64 h5_stat_t; typedef __int64 h5_stat_size_t; #ifdef H5_HAVE_VISUAL_STUDIO - struct timezone { int tz_minuteswest; int tz_dsttime; }; +#endif -#endif /* H5_HAVE_VISUAL_STUDIO */ - -#define HDaccess(F, M) _access(F, M) -#define HDchdir(S) _chdir(S) -#define HDclose(F) _close(F) #define HDcreat(S, M) Wopen_utf8(S, O_CREAT | O_TRUNC | O_RDWR, M) -#define HDdup(F) _dup(F) -#define HDfdopen(N, S) _fdopen(N, S) -#define HDfileno(F) _fileno(F) #define HDflock(F, L) Wflock(F, L) #define HDfstat(F, B) _fstati64(F, B) -#define HDgetcwd(S, Z) _getcwd(S, Z) #define HDgetdcwd(D, S, Z) _getdcwd(D, S, Z) #define HDgetdrive() _getdrive() #define HDgettimeofday(V, Z) Wgettimeofday(V, Z) -#define HDisatty(F) _isatty(F) #define HDlseek(F, O, W) _lseeki64(F, O, W) #define HDlstat(S, B) _lstati64(S, B) #define HDmkdir(S, M) _mkdir(S) -/* off_t exists on Windows, but is always a 32-bit long, even on 64-bit Windows, - * so we define HDoff_t to be __int64, which is the type of the st_size field - * of the _stati64 struct. - */ -#define HDoff_t __int64 - /* Note that the variadic HDopen macro is using a VC++ extension * where the comma is dropped if nothing is passed to the ellipsis. */ @@ -74,29 +58,25 @@ struct timezone { #define HDopen(S, F, ...) Wopen_utf8(S, F, ##__VA_ARGS__) #endif -#define HDread(F, M, Z) _read(F, M, Z) #define HDremove(S) Wremove_utf8(S) -#define HDrmdir(S) _rmdir(S) #define HDsetenv(N, V, O) Wsetenv(N, V, O) #define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, (Z > 1 ? Z : 2)) #define HDsleep(S) Sleep(S * 1000) #define HDstat(S, B) _stati64(S, B) #define HDstrcasecmp(A, B) _stricmp(A, B) +#define HDstrcasestr(A, B) Wstrcasestr_wrap(A, B) #define HDstrndup(S, N) H5_strndup(S, N) #define HDstrtok_r(X, Y, Z) strtok_s(X, Y, Z) -#define HDtzset() _tzset() -#define HDunlink(S) _unlink(S) #define HDunsetenv(N) Wsetenv(N, "", 1) -#define HDwrite(F, M, Z) _write(F, M, Z) #ifndef H5_HAVE_MINGW #define HDftruncate(F, L) _chsize_s(F, L) #define HDfseek(F, O, W) _fseeki64(F, O, W) -#endif /* H5_HAVE_MINGW */ +#endif #ifdef __cplusplus extern "C" { -#endif /* __cplusplus */ +#endif H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); H5_DLL int Wsetenv(const char *name, const char *value, int overwrite); H5_DLL int Wflock(int fd, int operation); @@ -106,8 +86,9 @@ H5_DLL int Wopen_utf8(const char *path, int oflag, ...); H5_DLL int Wremove_utf8(const char *path); H5_DLL int H5_get_win32_times(H5_timevals_t *tvs); H5_DLL char *H5_strndup(const char *s, size_t n); +H5_DLL char *Wstrcasestr_wrap(const char *haystack, const char *needle); #ifdef __cplusplus } -#endif /* __cplusplus */ +#endif #endif /* H5_HAVE_WIN32_API */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/hdf5.h b/externals/coda-oss/modules/drivers/hdf5/include/hdf5.h index b3efa0a970..5be0efe245 100644 --- a/externals/coda-oss/modules/drivers/hdf5/include/hdf5.h +++ b/externals/coda-oss/modules/drivers/hdf5/include/hdf5.h @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -72,8 +71,8 @@ #ifdef H5_HAVE_WINDOWS #include "H5FDwindows.h" /* Win32 I/O */ #endif -//#include "H5FDsubfiling.h" /* Subfiling VFD */ -//#include "H5FDioc.h" /* I/O Concentrator VFD */ +#include "H5FDsubfiling.h" /* Subfiling VFD */ +#include "H5FDioc.h" /* I/O Concentrator VFD */ /* Virtual object layer (VOL) connectors */ #include "H5VLnative.h" /* Native VOL connector */ diff --git a/externals/coda-oss/modules/drivers/hdf5/include/hdf5_hl.h b/externals/coda-oss/modules/drivers/hdf5/include/hdf5_hl.h new file mode 100644 index 0000000000..7757b392e1 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/include/hdf5_hl.h @@ -0,0 +1,31 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This is the main public HDF5 High Level include file. Put further + * information in a particular header file and include that here, don't + * fill this file with lots of gunk... + */ + +#ifndef HDF5_HL_H +#define HDF5_HL_H + +#include "hdf5.h" /* hdf5 main library */ +#include "H5DOpublic.h" /* dataset optimization */ +#include "H5DSpublic.h" /* dimension scales */ +#include "H5LTpublic.h" /* lite */ +#include "H5IMpublic.h" /* image */ +#include "H5TBpublic.h" /* table */ +#include "H5PTpublic.h" /* packet table */ +#include "H5LDpublic.h" /* lite dataset */ + +#endif /*HDF5_HL_H*/ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5.c b/externals/coda-oss/modules/drivers/hdf5/source/H5.c index c86a6447a6..10617bcf9a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -71,8 +70,8 @@ static int H5__mpi_delete_cb(MPI_Comm comm, int keyval, void *attr_val, int *fla /*****************************/ /* Library incompatible release versions, develop releases are incompatible by design */ -const unsigned VERS_RELEASE_EXCEPTIONS[] = {0, 1, 2}; -const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 3; +static const unsigned VERS_RELEASE_EXCEPTIONS[] = {0}; +static const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 0; /* statically initialize block for pthread_once call used in initializing */ /* the first global mutex */ @@ -83,12 +82,6 @@ hbool_t H5_libinit_g = FALSE; /* Library hasn't been initialized */ hbool_t H5_libterm_g = FALSE; /* Library isn't being shutdown */ #endif -hbool_t H5_use_selection_io_g = FALSE; - -#ifdef H5_HAVE_MPE -hbool_t H5_MPEinit_g = FALSE; /* MPE Library hasn't been initialized */ -#endif - char H5_lib_vers_info_g[] = H5_VERS_INFO; static hbool_t H5_dont_atexit_g = FALSE; H5_debug_t H5_debug_g; /* debugging info */ @@ -122,7 +115,7 @@ H5_default_vfd_init(void) * it has of initializing the default VFD. */ if (H5FD_sec2_init() == H5I_INVALID_HID) { - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to load default VFD ID") + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, "unable to load default VFD ID"); } done: FUNC_LEAVE_NOAPI(ret_value) @@ -146,14 +139,13 @@ herr_t H5_init_library(void) { size_t i; - char *env_use_select_io = NULL; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) /* Run the library initialization routine, if it hasn't already run */ if (H5_INIT_GLOBAL || H5_TERM_GLOBAL) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Set the 'library initialized' flag as early as possible, to avoid * possible re-entrancy. @@ -169,18 +161,6 @@ H5_init_library(void) MPI_Initialized(&mpi_initialized); MPI_Finalized(&mpi_finalized); -#ifdef H5_HAVE_MPE - /* Initialize MPE instrumentation library. */ - if (!H5_MPEinit_g) { - int mpe_code; - if (mpi_initialized && !mpi_finalized) { - mpe_code = MPE_Init_log(); - HDassert(mpe_code >= 0); - H5_MPEinit_g = TRUE; - } - } -#endif /*H5_HAVE_MPE*/ - /* add an attribute on MPI_COMM_SELF to call H5_term_library when it is destroyed, i.e. on MPI_Finalize */ if (mpi_initialized && !mpi_finalized) { @@ -203,7 +183,7 @@ H5_init_library(void) /* * Make sure the package information is updated. */ - HDmemset(&H5_debug_g, 0, sizeof H5_debug_g); + memset(&H5_debug_g, 0, sizeof H5_debug_g); H5_debug_g.pkg[H5_PKG_A].name = "a"; H5_debug_g.pkg[H5_PKG_AC].name = "ac"; H5_debug_g.pkg[H5_PKG_B].name = "b"; @@ -238,11 +218,11 @@ H5_init_library(void) * This must be entered before the library cleanup code so it's * executed in LIFO order (i.e., last). */ - (void)HDatexit(H5TS_win32_process_exit); + (void)atexit(H5TS_win32_process_exit); #endif /* H5_HAVE_THREADSAFE && H5_HAVE_WIN_THREADS */ /* Normal library termination code */ - (void)HDatexit(H5_term_library); + (void)atexit(H5_term_library); H5_dont_atexit_g = TRUE; } /* end if */ @@ -263,41 +243,35 @@ H5_init_library(void) * The dataspace interface needs to be initialized so that future IDs for * dataspaces work. */ - /* clang-format off */ - struct { - herr_t (*func)(void); - const char *descr; - } initializer[] = { - {H5E_init, "error"} - , {H5VL_init_phase1, "VOL"} - , {H5SL_init, "skip lists"} - , {H5FD_init, "VFD"} - , {H5_default_vfd_init, "default VFD"} - , {H5P_init_phase1, "property list"} - , {H5AC_init, "metadata caching"} - , {H5L_init, "link"} - , {H5S_init, "dataspace"} - , {H5PL_init, "plugins"} - /* Finish initializing interfaces that depend on the interfaces above */ - , {H5P_init_phase2, "property list"} - , {H5VL_init_phase2, "VOL"} - }; - - for (i = 0; i < NELMTS(initializer); i++) { - if (initializer[i].func() < 0) { - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, - "unable to initialize %s interface", initializer[i].descr) + { + /* clang-format off */ + struct { + herr_t (*func)(void); + const char *descr; + } initializer[] = { + {H5E_init, "error"} + , {H5VL_init_phase1, "VOL"} + , {H5SL_init, "skip lists"} + , {H5FD_init, "VFD"} + , {H5_default_vfd_init, "default VFD"} + , {H5P_init_phase1, "property list"} + , {H5AC_init, "metadata caching"} + , {H5L_init, "link"} + , {H5S_init, "dataspace"} + , {H5PL_init, "plugins"} + /* Finish initializing interfaces that depend on the interfaces above */ + , {H5P_init_phase2, "property list"} + , {H5VL_init_phase2, "VOL"} + }; + + for (i = 0; i < NELMTS(initializer); i++) { + if (initializer[i].func() < 0) { + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL, + "unable to initialize %s interface", initializer[i].descr); + } } + /* clang-format on */ } - /* clang-format on */ - - /* Check for HDF5_USE_SELECTION_IO env variable */ - env_use_select_io = HDgetenv("HDF5_USE_SELECTION_IO"); - if (NULL != env_use_select_io && HDstrcmp(env_use_select_io, "") && HDstrcmp(env_use_select_io, "0") && - HDstrcmp(env_use_select_io, "no") && HDstrcmp(env_use_select_io, "No") && - HDstrcmp(env_use_select_io, "NO") && HDstrcmp(env_use_select_io, "false") && - HDstrcmp(env_use_select_io, "False") && HDstrcmp(env_use_select_io, "FALSE")) - H5_use_selection_io_g = TRUE; /* Debugging? */ H5__debug_mask("-all"); @@ -377,175 +351,152 @@ H5_term_library(void) * way that would necessitate some cleanup work in the other interface. */ -#define TERMINATOR(module, wait) { \ - .func = H5##module##_term_package \ - , .name = #module \ - , .completed = false \ - , .await_prior = wait \ - } + { +#define TERMINATOR(module, wait) { \ + .func = H5##module##_term_package \ + , .name = #module \ + , .completed = false \ + , .await_prior = wait \ + } - /* - * Termination is ordered by the `terminator` table so the "higher" level - * packages are shut down before "lower" level packages that they - * rely on: - */ - struct { - int (*func)(void); /* function to terminate the module; returns 0 - * on success, >0 if termination was not - * completed and we should try to terminate - * some dependent modules, first. - */ - const char *name; /* name of the module */ - hbool_t completed; /* true iff this terminator was already - * completed - */ - const hbool_t await_prior; /* true iff all prior terminators in the - * list must complete before this - * terminator is attempted - */ - } terminator[] = { - /* Close the event sets first, so that all asynchronous operations - * complete before anything else attempts to shut down. - */ - TERMINATOR(ES, false) - /* Do not attempt to close down package L until after event sets - * have finished closing down. - */ - , TERMINATOR(L, true) - /* Close the "top" of various interfaces (IDs, etc) but don't shut - * down the whole interface yet, so that the object header messages - * get serialized correctly for entries in the metadata cache and the - * symbol table entry in the superblock gets serialized correctly, etc. - * all of which is performed in the 'F' shutdown. - * - * The tops of packages A, D, G, M, S, T do not need to wait for L - * or previous packages to finish closing down. - */ - , TERMINATOR(A_top, false) - , TERMINATOR(D_top, false) - , TERMINATOR(G_top, false) - , TERMINATOR(M_top, false) - , TERMINATOR(S_top, false) - , TERMINATOR(T_top, false) - /* Don't shut down the file code until objects in files are shut down */ - , TERMINATOR(F, true) - /* Don't shut down the property list code until all objects that might - * use property lists are shut down - */ - , TERMINATOR(P, true) - /* Wait to shut down the "bottom" of various interfaces until the - * files are closed, so pieces of the file can be serialized - * correctly. - * - * Shut down the "bottom" of the attribute, dataset, group, - * reference, dataspace, and datatype interfaces, fully closing - * out the interfaces now. - */ - , TERMINATOR(A, true) - , TERMINATOR(D, false) - , TERMINATOR(G, false) - , TERMINATOR(M, false) - , TERMINATOR(S, false) - , TERMINATOR(T, false) - /* Wait to shut down low-level packages like AC until after - * the preceding high-level packages have shut down. This prevents - * low-level objects from closing "out from underneath" their - * reliant high-level objects. - */ - , TERMINATOR(AC, true) - /* Shut down the "pluggable" interfaces, before the plugin framework */ - , TERMINATOR(Z, false) - , TERMINATOR(FD, false) - , TERMINATOR(VL, false) - /* Don't shut down the plugin code until all "pluggable" interfaces - * (Z, FD, PL) are shut down - */ - , TERMINATOR(PL, true) - /* Shut down the following packages in strictly the order given - * by the table. + /* + * Termination is ordered by the `terminator` table so the "higher" level + * packages are shut down before "lower" level packages that they + * rely on: */ - , TERMINATOR(E, true) - , TERMINATOR(I, true) - , TERMINATOR(SL, true) - , TERMINATOR(FL, true) - , TERMINATOR(CX, true) - }; - - do { - pending = 0; - for (i = 0; i < NELMTS(terminator); i++) { - if (terminator[i].completed) - continue; - if (pending != 0 && terminator[i].await_prior) - break; - if (terminator[i].func() == 0) { - terminator[i].completed = true; - continue; + struct { + int (*func)(void); /* function to terminate the module; returns 0 + * on success, >0 if termination was not + * completed and we should try to terminate + * some dependent modules, first. + */ + const char *name; /* name of the module */ + hbool_t completed; /* true iff this terminator was already + * completed + */ + const hbool_t await_prior; /* true iff all prior terminators in the + * list must complete before this + * terminator is attempted + */ + } terminator[] = { + /* Close the event sets first, so that all asynchronous operations + * complete before anything else attempts to shut down. + */ + TERMINATOR(ES, false) + /* Do not attempt to close down package L until after event sets + * have finished closing down. + */ + , TERMINATOR(L, true) + /* Close the "top" of various interfaces (IDs, etc) but don't shut + * down the whole interface yet, so that the object header messages + * get serialized correctly for entries in the metadata cache and the + * symbol table entry in the superblock gets serialized correctly, etc. + * all of which is performed in the 'F' shutdown. + * + * The tops of packages A, D, G, M, S, T do not need to wait for L + * or previous packages to finish closing down. + */ + , TERMINATOR(A_top, false) + , TERMINATOR(D_top, false) + , TERMINATOR(G_top, false) + , TERMINATOR(M_top, false) + , TERMINATOR(S_top, false) + , TERMINATOR(T_top, false) + /* Don't shut down the file code until objects in files are shut down */ + , TERMINATOR(F, true) + /* Don't shut down the property list code until all objects that might + * use property lists are shut down + */ + , TERMINATOR(P, true) + /* Wait to shut down the "bottom" of various interfaces until the + * files are closed, so pieces of the file can be serialized + * correctly. + * + * Shut down the "bottom" of the attribute, dataset, group, + * reference, dataspace, and datatype interfaces, fully closing + * out the interfaces now. + */ + , TERMINATOR(A, true) + , TERMINATOR(D, false) + , TERMINATOR(G, false) + , TERMINATOR(M, false) + , TERMINATOR(S, false) + , TERMINATOR(T, false) + /* Wait to shut down low-level packages like AC until after + * the preceding high-level packages have shut down. This prevents + * low-level objects from closing "out from underneath" their + * reliant high-level objects. + */ + , TERMINATOR(AC, true) + /* Shut down the "pluggable" interfaces, before the plugin framework */ + , TERMINATOR(Z, false) + , TERMINATOR(FD, false) + , TERMINATOR(VL, false) + /* Don't shut down the plugin code until all "pluggable" interfaces + * (Z, FD, PL) are shut down + */ + , TERMINATOR(PL, true) + /* Shut down the following packages in strictly the order given + * by the table. + */ + , TERMINATOR(E, true) + , TERMINATOR(I, true) + , TERMINATOR(SL, true) + , TERMINATOR(FL, true) + , TERMINATOR(CX, true) + }; + + do { + pending = 0; + for (i = 0; i < NELMTS(terminator); i++) { + if (terminator[i].completed) + continue; + if (pending != 0 && terminator[i].await_prior) + break; + if (terminator[i].func() == 0) { + terminator[i].completed = true; + continue; + } + + /* log a package when its terminator needs to be retried */ + pending++; + nprinted = HDsnprintf(next, nleft, "%s%s", + (next != loop) ? "," : "", terminator[i].name); + if (nprinted < 0) + continue; + if ((size_t)nprinted >= nleft) + nprinted = HDsnprintf(next, nleft, "..."); + if (nprinted < 0 || (size_t)nprinted >= nleft) + continue; + nleft -= (size_t)nprinted; + next += nprinted; } + } while (pending && ntries++ < 100); - /* log a package when its terminator needs to be retried */ - pending++; - nprinted = HDsnprintf(next, nleft, "%s%s", - (next != loop) ? "," : "", terminator[i].name); - if (nprinted < 0) - continue; - if ((size_t)nprinted >= nleft) - nprinted = HDsnprintf(next, nleft, "..."); - if (nprinted < 0 || (size_t)nprinted >= nleft) - continue; - nleft -= (size_t)nprinted; - next += nprinted; - } - } while (pending && ntries++ < 100); - - /* clang-format on */ + /* clang-format on */ - if (pending) { - /* Only display the error message if the user is interested in them. */ - if (func) { - HDfprintf(stderr, "HDF5: infinite loop closing library\n"); - HDfprintf(stderr, " %s\n", loop); + if (pending) { + /* Only display the error message if the user is interested in them. */ + if (func) { + fprintf(stderr, "HDF5: infinite loop closing library\n"); + fprintf(stderr, " %s\n", loop); #ifndef NDEBUG - HDabort(); -#endif /* NDEBUG */ - } /* end if */ - } /* end if */ - -#ifdef H5_HAVE_MPE - /* Close MPE instrumentation library. May need to move this - * down if any of the below code involves using the instrumentation code. - */ - if (H5_MPEinit_g) { - int mpi_initialized; - int mpi_finalized; - int mpe_code; - - MPI_Initialized(&mpi_initialized); - MPI_Finalized(&mpi_finalized); - - if (mpi_initialized && !mpi_finalized) { - mpe_code = MPE_Finish_log("h5log"); - HDassert(mpe_code >= 0); - } /* end if */ - H5_MPEinit_g = FALSE; /* turn it off no matter what */ - } /* end if */ -#endif + HDabort(); +#endif /* NDEBUG */ + } /* end if */ + } /* end if */ + } /* Free open debugging streams */ while (H5_debug_g.open_stream) { H5_debug_open_stream_t *tmp_open_stream; tmp_open_stream = H5_debug_g.open_stream; - (void)HDfclose(H5_debug_g.open_stream->stream); + (void)fclose(H5_debug_g.open_stream->stream); H5_debug_g.open_stream = H5_debug_g.open_stream->next; (void)H5MM_free(tmp_open_stream); } /* end while */ -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - /* Sanity check memory allocations */ - H5MM_final_sanity_check(); -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ - /* Reset flag indicating that the library is being shut down */ H5_TERM_GLOBAL = FALSE; @@ -625,7 +576,7 @@ H5garbage_collect(void) /* Call the garbage collection routines in the library */ if (H5FL_garbage_coll() < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect objects") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect objects"); done: FUNC_LEAVE_API(ret_value) @@ -671,7 +622,7 @@ H5set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim, /* Call the free list function to actually set the limits */ if (H5FL_set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim, blk_global_lim, blk_list_lim) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "can't set garbage collection limits") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSET, FAIL, "can't set garbage collection limits"); done: FUNC_LEAVE_API(ret_value) @@ -694,9 +645,6 @@ H5set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim, * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, March 6, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -710,52 +658,12 @@ H5get_free_list_sizes(size_t *reg_size /*out*/, size_t *arr_size /*out*/, size_t /* Call the free list function to actually get the sizes */ if (H5FL_get_free_list_sizes(reg_size, arr_size, blk_size, fac_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get garbage collection sizes") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get garbage collection sizes"); done: FUNC_LEAVE_API(ret_value) } /* end H5get_free_list_sizes() */ -/*------------------------------------------------------------------------- - * Function: H5get_alloc_stats - * - * Purpose: Gets the memory allocation statistics for the library, if the - * --enable-memory-alloc-sanity-check option was given when building the - * library. Applications can check whether this option was enabled by - * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This - * option is enabled by default for debug builds of the library and - * disabled by default for non-debug builds. If the option is not enabled, - * all the values returned with be 0. These statistics are global for the - * entire library, but don't include allocations from chunked dataset I/O - * filters or non-native VOL connectors. - * - * Parameters: - * H5_alloc_stats_t *stats; OUT: Memory allocation statistics - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Saturday, March 7, 2020 - * - *------------------------------------------------------------------------- - */ -herr_t -H5get_alloc_stats(H5_alloc_stats_t *stats /*out*/) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE1("e", "x", stats); - - /* Call the internal allocation stat routine to get the values */ - if (H5MM_get_alloc_stats(stats) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get allocation stats") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5get_alloc_stats() */ - /*------------------------------------------------------------------------- * Function: H5__debug_mask * @@ -789,7 +697,7 @@ H5__debug_mask(const char *s) while (s && *s) { - if (HDisalpha(*s) || '-' == *s || '+' == *s) { + if (isalpha(*s) || '-' == *s || '+' == *s) { /* Enable or Disable debugging? */ if ('-' == *s) { @@ -805,7 +713,7 @@ H5__debug_mask(const char *s) } /* end if */ /* Get the name */ - for (i = 0; HDisalpha(*s); i++, s++) + for (i = 0; isalpha(*s); i++, s++) if (i < sizeof pkg_name) pkg_name[i] = *s; pkg_name[MIN(sizeof(pkg_name) - 1, i)] = '\0'; @@ -834,11 +742,11 @@ H5__debug_mask(const char *s) } /* end if */ } /* end for */ if (i >= (size_t)H5_NPKGS) - HDfprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); + fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); } /* end if-else */ } - else if (HDisdigit(*s)) { - int fd = (int)HDstrtol(s, &rest, 0); + else if (isdigit(*s)) { + int fd = (int)strtol(s, &rest, 0); H5_debug_open_stream_t *open_stream; if ((stream = HDfdopen(fd, "w")) != NULL) { @@ -846,7 +754,7 @@ H5__debug_mask(const char *s) if (NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) { - (void)HDfclose(stream); + (void)fclose(stream); return; } /* end if */ @@ -973,7 +881,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) /* Don't check again, if we already have */ if (checked) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); { const char *s; /* Environment string for disabling version check */ @@ -981,23 +889,23 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) /* Allow different versions of the header files and library? */ s = HDgetenv("HDF5_DISABLE_VERSION_CHECK"); - if (s && HDisdigit(*s)) - disable_version_check = (unsigned int)HDstrtol(s, NULL, 0); + if (s && isdigit(*s)) + disable_version_check = (unsigned int)strtol(s, NULL, 0); } /* H5_VERS_MAJOR and H5_VERS_MINOR must match */ if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum) { switch (disable_version_check) { case 0: - HDfprintf(stderr, "%s%s", version_mismatch_warning, - "You can, at your own risk, disable this warning by setting the environment\n" - "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n" - "Setting it to 2 or higher will suppress the warning messages totally.\n"); + fprintf(stderr, "%s%s", version_mismatch_warning, + "You can, at your own risk, disable this warning by setting the environment\n" + "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n" + "Setting it to 2 or higher will suppress the warning messages totally.\n"); /* Mention the versions we are referring to */ - HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, relnum, - (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); + fprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, relnum, + (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); /* Show library settings if available */ - HDfprintf(stderr, "%s", H5libhdf5_settings); + fprintf(stderr, "%s", H5libhdf5_settings); /* Bail out now. */ HDfputs("Bye...\n", stderr); @@ -1005,16 +913,16 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) case 1: /* continue with a warning */ /* Note that the warning message is embedded in the format string.*/ - HDfprintf(stderr, - "%s'HDF5_DISABLE_VERSION_CHECK' " - "environment variable is set to %d, application will\n" - "continue at your own risk.\n", - version_mismatch_warning, disable_version_check); + fprintf(stderr, + "%s'HDF5_DISABLE_VERSION_CHECK' " + "environment variable is set to %d, application will\n" + "continue at your own risk.\n", + version_mismatch_warning, disable_version_check); /* Mention the versions we are referring to */ - HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, relnum, - (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); + fprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, relnum, + (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); /* Show library settings if available */ - HDfprintf(stderr, "%s", H5libhdf5_settings); + fprintf(stderr, "%s", H5libhdf5_settings); break; default: /* 2 or higher: continue silently */ @@ -1031,15 +939,13 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) if (VERS_RELEASE_EXCEPTIONS[i] == relnum || VERS_RELEASE_EXCEPTIONS[i] == H5_VERS_RELEASE) { switch (disable_version_check) { case 0: - HDfprintf( - stderr, "%s%s", release_mismatch_warning, - "You can, at your own risk, disable this warning by setting the environment\n" - "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n" - "Setting it to 2 or higher will suppress the warning messages totally.\n"); + fprintf(stderr, "%s%s", release_mismatch_warning, + "You can, at your own risk, disable this warning by setting the environment\n" + "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n" + "Setting it to 2 or higher will suppress the warning messages totally.\n"); /* Mention the versions we are referring to */ - HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, - relnum, (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, - (unsigned)H5_VERS_RELEASE); + fprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, relnum, + (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); /* Bail out now. */ HDfputs("Bye...\n", stderr); @@ -1047,15 +953,14 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) case 1: /* continue with a warning */ /* Note that the warning message is embedded in the format string.*/ - HDfprintf(stderr, - "%s'HDF5_DISABLE_VERSION_CHECK' " - "environment variable is set to %d, application will\n" - "continue at your own risk.\n", - release_mismatch_warning, disable_version_check); + fprintf(stderr, + "%s'HDF5_DISABLE_VERSION_CHECK' " + "environment variable is set to %d, application will\n" + "continue at your own risk.\n", + release_mismatch_warning, disable_version_check); /* Mention the versions we are referring to */ - HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, - relnum, (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, - (unsigned)H5_VERS_RELEASE); + fprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum, relnum, + (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE); break; default: /* 2 or higher: continue silently */ @@ -1088,11 +993,11 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum) "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of 1 " "will suppress\nthis warning.\n", stderr); - HDfprintf(stderr, - "Library version information are:\n" - "H5_VERS_MAJOR=%d, H5_VERS_MINOR=%d, H5_VERS_RELEASE=%d, " - "H5_VERS_SUBRELEASE=%s,\nH5_VERS_INFO=%s\n", - H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, H5_VERS_SUBRELEASE, H5_VERS_INFO); + fprintf(stderr, + "Library version information are:\n" + "H5_VERS_MAJOR=%d, H5_VERS_MINOR=%d, H5_VERS_RELEASE=%d, " + "H5_VERS_SUBRELEASE=%s,\nH5_VERS_INFO=%s\n", + H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, H5_VERS_SUBRELEASE, H5_VERS_INFO); } /* end if */ } @@ -1147,11 +1052,11 @@ H5atclose(H5_atclose_func_t func, void *ctx) /* Check arguments */ if (NULL == func) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL func pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL func pointer"); /* Allocate space for the 'atclose' node */ if (NULL == (new_atclose = H5FL_MALLOC(H5_atclose_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate 'atclose' node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate 'atclose' node"); /* Set up 'atclose' node */ new_atclose->func = func; @@ -1208,13 +1113,14 @@ H5close(void) * * Return: * - * Success: A pointer to the allocated buffer. + * Success: A pointer to the allocated buffer or NULL if the size + * parameter is zero. * - * Failure: NULL + * Failure: NULL (but may also be NULL w/ size 0!) * *------------------------------------------------------------------------- */ -void * +void *H5_ATTR_MALLOC H5allocate_memory(size_t size, hbool_t clear) { void *ret_value = NULL; @@ -1222,6 +1128,9 @@ H5allocate_memory(size_t size, hbool_t clear) FUNC_ENTER_API_NOINIT H5TRACE2("*x", "zb", size, clear); + if (0 == size) + return NULL; + if (clear) ret_value = H5MM_calloc(size); else @@ -1344,7 +1253,7 @@ H5is_library_terminating(hbool_t *is_terminating /*out*/) FUNC_ENTER_API_NOINIT H5TRACE1("e", "x", is_terminating); - HDassert(is_terminating); + assert(is_terminating); if (is_terminating) *is_terminating = H5_TERM_GLOBAL; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5A.c b/externals/coda-oss/modules/drivers/hdf5/source/H5A.c index 5f637c8ec8..cbb577d601 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5A.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5A.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -120,24 +119,24 @@ H5A__create_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(vol_obj); - HDassert(loc_params); - HDassert(attr_name); + assert(vol_obj); + assert(loc_params); + assert(attr_name); /* Create the attribute */ if (NULL == (attr = H5VL_attr_create(vol_obj, loc_params, attr_name, type_id, space_id, acpl_id, aapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute"); /* Register the new attribute and get an ID for it */ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID"); done: /* Cleanup on failure */ if (H5I_INVALID_HID == ret_value) if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__create_common() */ @@ -166,15 +165,15 @@ H5A__create_api_common(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute"); if (!attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be NULL"); if (!*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be an empty string"); /* Set up object access arguments */ if (H5VL_setup_acc_args(loc_id, H5P_CLS_AACC, TRUE, &aapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Get correct property list */ if (H5P_DEFAULT == acpl_id) @@ -183,7 +182,7 @@ H5A__create_api_common(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t /* Create the attribute */ if ((ret_value = H5A__create_common(*vol_obj_ptr, &loc_params, attr_name, type_id, space_id, acpl_id, aapl_id, token_ptr)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -233,7 +232,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, h /* Create the attribute synchronously */ if ((ret_value = H5A__create_api_common(loc_id, attr_name, type_id, space_id, acpl_id, aapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create attribute"); done: FUNC_LEAVE_API(ret_value) @@ -270,7 +269,7 @@ H5Acreate_async(const char *app_file, const char *app_func, unsigned app_line, h /* Create the attribute asynchronously */ if ((ret_value = H5A__create_api_common(loc_id, attr_name, type_id, space_id, acpl_id, aapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create attribute"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -279,8 +278,8 @@ H5Acreate_async(const char *app_file, const char *app_func, unsigned app_line, h H5ARG_TRACE10(__func__, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, attr_name, type_id, space_id, acpl_id, aapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID"); + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -312,20 +311,20 @@ H5A__create_by_name_api_common(hid_t loc_id, const char *obj_name, const char *a /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute"); if (!attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be NULL"); if (!*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "attr_name parameter cannot be an empty string"); /* obj_name is verified in H5VL_setup_name_args() */ /* Set up object access arguments */ if (H5VL_setup_name_args(loc_id, obj_name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info"); /* Get correct property list */ if (H5P_DEFAULT == acpl_id) @@ -334,7 +333,7 @@ H5A__create_by_name_api_common(hid_t loc_id, const char *obj_name, const char *a /* Create the attribute */ if ((ret_value = H5A__create_common(*vol_obj_ptr, &loc_params, attr_name, type_id, space_id, acpl_id, aapl_id, token_ptr)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -382,7 +381,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid /* Create the attribute synchronously */ if ((ret_value = H5A__create_by_name_api_common(loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create attribute"); done: FUNC_LEAVE_API(ret_value) @@ -419,7 +418,7 @@ H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app /* Create the attribute asynchronously */ if ((ret_value = H5A__create_by_name_api_common(loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create attribute"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -428,8 +427,8 @@ H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app H5ARG_TRACE12(__func__, "*s*sIui*s*siiiiii", app_file, app_func, app_line, loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID"); + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -456,23 +455,23 @@ H5A__open_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const ch FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(vol_obj); - HDassert(loc_params); + assert(vol_obj); + assert(loc_params); /* Open the attribute */ if (NULL == (attr = H5VL_attr_open(vol_obj, loc_params, attr_name, aapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name); /* Register the attribute and get an ID for it */ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID"); done: /* Cleanup on failure */ if (H5I_INVALID_HID == ret_value) if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_common() */ @@ -501,19 +500,19 @@ H5A__open_api_common(hid_t loc_id, const char *attr_name, hid_t aapl_id, void ** /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute"); if (!attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL"); if (!*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string"); /* Set up object access arguments */ if (H5VL_setup_acc_args(loc_id, H5P_CLS_AACC, FALSE, &aapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Open the attribute */ if ((ret_value = H5A__open_common(*vol_obj_ptr, &loc_params, attr_name, aapl_id, token_ptr)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name); done: FUNC_LEAVE_NOAPI(ret_value) @@ -548,7 +547,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) /* Open the attribute synchronously */ if ((ret_value = H5A__open_api_common(loc_id, attr_name, aapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously open attribute"); done: FUNC_LEAVE_API(ret_value) @@ -582,7 +581,7 @@ H5Aopen_async(const char *app_file, const char *app_func, unsigned app_line, hid /* Open the attribute asynchronously */ if ((ret_value = H5A__open_api_common(loc_id, attr_name, aapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously open attribute"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -591,8 +590,8 @@ H5Aopen_async(const char *app_file, const char *app_func, unsigned app_line, hid H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, attr_name, aapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID"); + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -623,23 +622,23 @@ H5A__open_by_name_api_common(hid_t loc_id, const char *obj_name, const char *att /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute"); if (!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no attribute name"); /* obj_name is verified in H5VL_setup_name_args() */ /* Set up object access arguments */ if (H5VL_setup_name_args(loc_id, obj_name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info"); /* Open the attribute */ if ((ret_value = H5A__open_common(*vol_obj_ptr, &loc_params, attr_name, aapl_id, token_ptr)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", attr_name); done: FUNC_LEAVE_NOAPI(ret_value) @@ -677,7 +676,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t /* Open the attribute by name asynchronously */ if ((ret_value = H5A__open_by_name_api_common(loc_id, obj_name, attr_name, aapl_id, lapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to synchronously open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to synchronously open attribute"); done: FUNC_LEAVE_API(ret_value) @@ -713,7 +712,7 @@ H5Aopen_by_name_async(const char *app_file, const char *app_func, unsigned app_l /* Open the attribute by name asynchronously */ if ((ret_value = H5A__open_by_name_api_common(loc_id, obj_name, attr_name, aapl_id, lapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to asynchronously open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to asynchronously open attribute"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -722,8 +721,8 @@ H5Aopen_by_name_async(const char *app_file, const char *app_func, unsigned app_l H5ARG_TRACE9(__func__, "*s*sIui*s*siii", app_file, app_func, app_line, loc_id, obj_name, attr_name, aapl_id, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID"); + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -755,26 +754,26 @@ H5A__open_by_idx_api_common(hid_t loc_id, const char *obj_name, H5_index_t idx_t /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute"); if (!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no object name"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified"); /* Set up object access arguments */ if (H5VL_setup_idx_args(loc_id, obj_name, idx_type, order, n, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set attribute access property list info"); /* Open the attribute */ if ((ret_value = H5A__open_common(*vol_obj_ptr, &loc_params, NULL, aapl_id, token_ptr)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -816,7 +815,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_ /* Open the attribute by idx synchronously */ if ((ret_value = H5A__open_by_idx_api_common(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously open attribute"); done: FUNC_LEAVE_API(ret_value) @@ -853,7 +852,7 @@ H5Aopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li /* Open the attribute by idx asynchronously */ if ((ret_value = H5A__open_by_idx_api_common(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously open attribute"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -862,8 +861,8 @@ H5Aopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li H5ARG_TRACE11(__func__, "*s*sIui*sIiIohiii", app_file, app_func, app_line, loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID"); + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -891,17 +890,17 @@ H5A__write_api_common(hid_t attr_id, hid_t type_id, const void *buf, void **toke /* Check arguments */ if (H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (NULL == buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL"); /* Get attribute pointer */ if (H5VL_setup_args(attr_id, H5I_ATTR, vol_obj_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get VOL object for attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get VOL object for attribute"); /* Write the attribute data */ if (H5VL_attr_write(*vol_obj_ptr, type_id, buf, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -933,7 +932,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) /* Synchronously write the data */ if (H5A__write_api_common(attr_id, dtype_id, buf, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "can't synchronously write data") + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "can't synchronously write data"); done: FUNC_LEAVE_API(ret_value) @@ -965,7 +964,7 @@ H5Awrite_async(const char *app_file, const char *app_func, unsigned app_line, hi /* Asynchronously write the data */ if (H5A__write_api_common(attr_id, dtype_id, buf, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "can't asynchronously write data") + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "can't asynchronously write data"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -973,7 +972,7 @@ H5Awrite_async(const char *app_file, const char *app_func, unsigned app_line, hi if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -999,17 +998,17 @@ H5A__read_api_common(hid_t attr_id, hid_t dtype_id, void *buf, void **token_ptr, /* Check arguments */ if (H5I_DATATYPE != H5I_get_type(dtype_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (NULL == buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf parameter can't be NULL"); /* Get attribute object pointer */ if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute"); /* Read the attribute data */ if (H5VL_attr_read(*vol_obj_ptr, dtype_id, buf, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") + HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1041,7 +1040,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf /*out*/) /* Synchronously read the data */ if (H5A__read_api_common(attr_id, dtype_id, buf, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't synchronously read data") + HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't synchronously read data"); done: FUNC_LEAVE_API(ret_value) @@ -1073,7 +1072,7 @@ H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid /* Asynchronously read the data */ if (H5A__read_api_common(attr_id, dtype_id, buf, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't asynchronously read data") + HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "can't asynchronously read data"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1081,7 +1080,7 @@ H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIuiixi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1115,7 +1114,7 @@ H5Aget_space(hid_t attr_id) /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_ATTR_GET_SPACE; @@ -1123,7 +1122,7 @@ H5Aget_space(hid_t attr_id) /* Get the dataspace */ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute"); /* Set the return value */ ret_value = vol_cb_args.args.get_space.space_id; @@ -1160,7 +1159,7 @@ H5Aget_type(hid_t attr_id) /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_ATTR_GET_TYPE; @@ -1168,7 +1167,7 @@ H5Aget_type(hid_t attr_id) /* Get the datatype */ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute"); /* Set the return value */ ret_value = vol_cb_args.args.get_type.type_id; @@ -1206,11 +1205,11 @@ H5Aget_create_plist(hid_t attr_id) FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", attr_id); - HDassert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1); + assert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1); /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_ATTR_GET_ACPL; @@ -1219,7 +1218,7 @@ H5Aget_create_plist(hid_t attr_id) /* Get the acpl */ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, - "unable to get creation property list for attribute") + "unable to get creation property list for attribute"); /* Set the return value */ ret_value = vol_cb_args.args.get_acpl.acpl_id; @@ -1262,9 +1261,9 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf /*out*/) /* check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an attribute"); if (!buf && buf_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_ATTR_GET_NAME; @@ -1276,7 +1275,7 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf /*out*/) /* Get the attribute name */ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name"); /* Set the return value */ ret_value = (ssize_t)attr_name_len; @@ -1297,9 +1296,6 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf /*out*/) * in NAME buffer * Failure: Negative * - * Programmer: Quincey Koziol - * February 8, 2007 - * *------------------------------------------------------------------------- */ ssize_t @@ -1316,23 +1312,23 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i /* Check args */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); if (!name && size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name cannot be NULL if size is non-zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name cannot be NULL if size is non-zero"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_ATTR_GET_NAME; @@ -1349,7 +1345,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i /* Get the name */ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name"); /* Set the return value */ ret_value = (ssize_t)attr_name_len; @@ -1370,9 +1366,6 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i * * Failure: Zero * - * Programmer: Raymond Lu - * October 23, 2002 - * *------------------------------------------------------------------------- */ hsize_t @@ -1388,7 +1381,7 @@ H5Aget_storage_size(hid_t attr_id) /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_ATTR_GET_STORAGE_SIZE; @@ -1396,7 +1389,7 @@ H5Aget_storage_size(hid_t attr_id) /* Get the storage size */ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get storage size") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get storage size"); /* Set the return value */ ret_value = storage_size; @@ -1413,9 +1406,6 @@ H5Aget_storage_size(hid_t attr_id) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * February 6, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1430,9 +1420,9 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute"); if (!ainfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "attribute_info parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "attribute_info parameter cannot be NULL"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_ATTR_GET_INFO; @@ -1443,7 +1433,7 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/) /* Get the attribute information */ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info"); done: FUNC_LEAVE_API(ret_value) @@ -1457,9 +1447,6 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * February 6, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1475,21 +1462,21 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H /* Check args */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name"); if (!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name"); if (NULL == ainfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_ATTR_GET_INFO; @@ -1502,7 +1489,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H /* Get the attribute information */ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info"); done: FUNC_LEAVE_API(ret_value) @@ -1517,9 +1504,6 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H * Return: Success: Non-negative with information in AINFO * Failure: Negative * - * Programmer: Quincey Koziol - * February 8, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1535,23 +1519,23 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i /* Check args */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (NULL == ainfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_ATTR_GET_INFO; @@ -1567,7 +1551,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i /* Get the attribute information */ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info"); done: FUNC_LEAVE_API(ret_value) @@ -1590,10 +1574,10 @@ H5A__rename_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(vol_obj); - HDassert(loc_params); - HDassert(old_name); - HDassert(new_name); + assert(vol_obj); + assert(loc_params); + assert(old_name); + assert(new_name); /* Avoid thrashing things if the names are the same */ if (HDstrcmp(old_name, new_name) != 0) { @@ -1607,7 +1591,7 @@ H5A__rename_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const /* Rename the attribute */ if (H5VL_attr_specific(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute from '%s' to '%s'", old_name, - new_name) + new_name); } done: @@ -1636,23 +1620,23 @@ H5A__rename_api_common(hid_t loc_id, const char *old_name, const char *new_name, /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!old_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be NULL"); if (!*old_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be an empty string"); if (!new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be NULL"); if (!*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be an empty string"); /* Set up object access arguments */ if (H5VL_setup_loc_args(loc_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Rename the attribute */ if (H5A__rename_common(*vol_obj_ptr, &loc_params, old_name, new_name, token_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1666,9 +1650,6 @@ H5A__rename_api_common(hid_t loc_id, const char *old_name, const char *new_name, * Return: Success: Non-negative * Failure: Negative * - * Programmer: Raymond Lu - * October 23, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -1681,7 +1662,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) /* Synchronously rename the attribute */ if (H5A__rename_api_common(loc_id, old_name, new_name, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't synchronously rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't synchronously rename attribute"); done: FUNC_LEAVE_API(ret_value) @@ -1713,7 +1694,7 @@ H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, h /* Asynchronously rename the attribute */ if (H5A__rename_api_common(loc_id, old_name, new_name, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't asynchronously rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't asynchronously rename attribute"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1721,7 +1702,7 @@ H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, h if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIui*s*si", app_file, app_func, app_line, loc_id, old_name, new_name, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1749,25 +1730,25 @@ H5A__rename_by_name_api_common(hid_t loc_id, const char *obj_name, const char *o /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!old_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be NULL"); if (!*old_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "old attribute name cannot be an empty string"); if (!new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be NULL"); if (!*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new attribute name cannot be an empty string"); /* obj_name is verified in H5VL_setup_name_args() */ /* Set up object access arguments */ if (H5VL_setup_name_args(loc_id, obj_name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Rename the attribute */ if (H5A__rename_common(*vol_obj_ptr, &loc_params, old_name, new_name, token_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1781,9 +1762,6 @@ H5A__rename_by_name_api_common(hid_t loc_id, const char *obj_name, const char *o * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * February 20, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1798,7 +1776,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, /* Synchronously rename the attribute */ if (H5A__rename_by_name_api_common(loc_id, obj_name, old_attr_name, new_attr_name, lapl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't synchronously rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't synchronously rename attribute"); done: FUNC_LEAVE_API(ret_value) @@ -1833,7 +1811,7 @@ H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app /* Asynchronously rename the attribute */ if (H5A__rename_by_name_api_common(loc_id, obj_name, old_attr_name, new_attr_name, lapl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't synchronously rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't synchronously rename attribute"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1841,7 +1819,7 @@ H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(__func__, "*s*sIui*s*s*sii", app_file, app_func, app_line, loc_id, obj_name, old_attr_name, new_attr_name, lapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1902,15 +1880,15 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *i /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); /* Get the loc object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set the location access parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1990,21 +1968,21 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info"); /* get the loc object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set the location access parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -2056,19 +2034,19 @@ H5Adelete(hid_t loc_id, const char *name) /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read"); /* Get the object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Set the location access parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -2080,7 +2058,7 @@ H5Adelete(hid_t loc_id, const char *name) /* Delete the attribute */ if (H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); done: FUNC_LEAVE_API(ret_value) @@ -2115,19 +2093,19 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name"); if (!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Set the location access parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -2141,7 +2119,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid /* Delete the attribute */ if (H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); done: FUNC_LEAVE_API(ret_value) @@ -2185,21 +2163,21 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_ite /* check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info"); /* get the object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Set the location access parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -2215,7 +2193,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_ite /* Delete the attribute */ if (H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); done: FUNC_LEAVE_API(ret_value) @@ -2242,13 +2220,13 @@ H5Aclose(hid_t attr_id) /* Check arguments */ if (H5I_ATTR != H5I_get_type(attr_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute ID"); /* Decrement the counter on the attribute ID. It will be freed if the count * reaches zero. */ if (H5I_dec_app_ref(attr_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "decrementing attribute ID failed") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "decrementing attribute ID failed"); done: FUNC_LEAVE_API(ret_value) @@ -2277,13 +2255,13 @@ H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hi /* Check arguments */ if (H5I_ATTR != H5I_get_type(attr_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a attribute ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a attribute ID"); /* Prepare for possible asynchronous operation */ if (H5ES_NONE != es_id) { /* Get attribute object's connector */ if (NULL == (vol_obj = H5VL_vol_object(attr_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get VOL object for attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get VOL object for attribute"); /* Increase connector's refcount, so it doesn't get closed if closing * the attribute closes the file */ @@ -2298,7 +2276,7 @@ H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hi * reaches zero. */ if (H5I_dec_app_ref_async(attr_id, token_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "decrementing attribute ID failed") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "decrementing attribute ID failed"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -2306,11 +2284,11 @@ H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, attr_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: if (connector && H5VL_conn_dec_rc(connector) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "can't decrement ref count on connector") + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "can't decrement ref count on connector"); FUNC_LEAVE_API(ret_value) } /* H5Aclose_async() */ @@ -2333,12 +2311,12 @@ H5A__exists_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(vol_obj); - HDassert(loc_params); + assert(vol_obj); + assert(loc_params); /* Check arguments */ if (!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_ATTR_EXISTS; @@ -2347,7 +2325,7 @@ H5A__exists_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const /* Check if the attribute exists */ if (H5VL_attr_specific(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2375,19 +2353,19 @@ H5A__exists_api_common(hid_t obj_id, const char *attr_name, hbool_t *attr_exists /* Check arguments */ if (H5I_ATTR == H5I_get_type(obj_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name"); if (NULL == attr_exists) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer for attribute existence") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer for attribute existence"); /* Set up object access arguments */ if (H5VL_setup_self_args(obj_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Check if the attribute exists */ if (H5A__exists_common(*vol_obj_ptr, &loc_params, attr_name, attr_exists, token_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2402,9 +2380,6 @@ H5A__exists_api_common(hid_t obj_id, const char *attr_name, hbool_t *attr_exists * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, November 1, 2007 - * *------------------------------------------------------------------------- */ htri_t @@ -2419,7 +2394,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) /* Synchronously check if an attribute exists */ exists = FALSE; if (H5A__exists_api_common(obj_id, attr_name, &exists, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't synchronously rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't synchronously check if attribute exists"); /* Set return value */ ret_value = (htri_t)exists; @@ -2454,7 +2429,7 @@ H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, h /* Asynchronously check if an attribute exists */ if (H5A__exists_api_common(obj_id, attr_name, attr_exists, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't asynchronously check if attribute exists") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't asynchronously check if attribute exists"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -2462,7 +2437,7 @@ H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, h if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIui*s*bi", app_file, app_func, app_line, obj_id, attr_name, attr_exists, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -2491,20 +2466,20 @@ H5A__exists_by_name_api_common(hid_t loc_id, const char *obj_name, const char *a /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute"); if (!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name"); if (NULL == attr_exists) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer for attribute existence") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer for attribute existence"); /* obj_name is verified in H5VL_setup_name_args() */ /* Set up object access arguments */ if (H5VL_setup_name_args(loc_id, obj_name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Check if the attribute exists */ if (H5A__exists_common(*vol_obj_ptr, &loc_params, attr_name, attr_exists, token_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2518,9 +2493,6 @@ H5A__exists_by_name_api_common(hid_t loc_id, const char *obj_name, const char *a * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, November 1, 2007 - * *------------------------------------------------------------------------- */ htri_t @@ -2535,7 +2507,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid /* Synchronously check if an attribute exists */ exists = FALSE; if (H5A__exists_by_name_api_common(loc_id, obj_name, attr_name, &exists, lapl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't synchronously rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't synchronously determine if attribute exists by name"); /* Set return value */ ret_value = (htri_t)exists; @@ -2573,7 +2545,8 @@ H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app /* Asynchronously check if an attribute exists */ if (H5A__exists_by_name_api_common(loc_id, obj_name, attr_name, attr_exists, lapl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't asynchronously rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, + "can't asynchronously determine if attribute exists by name"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -2581,7 +2554,7 @@ H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(__func__, "*s*sIui*s*s*bii", app_file, app_func, app_line, loc_id, obj_name, attr_name, attr_exists, lapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5AC.c b/externals/coda-oss/modules/drivers/hdf5/source/H5AC.c index 593193d276..f698bfe23f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5AC.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5AC.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5AC.c - * Jul 9 1997 - * Robb Matzke * * Purpose: Functions in this file implement a cache for * things which exist on disk. All "things" associated @@ -130,9 +127,6 @@ static const H5AC_class_t *const H5AC_class_s[] = { * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, January 18, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -150,8 +144,8 @@ H5AC_init(void) const char *s; /* String for environment variables */ s = HDgetenv("H5_COLL_API_SANITY_CHECK"); - if (s && HDisdigit(*s)) { - long env_val = HDstrtol(s, NULL, 0); + if (s && isdigit(*s)) { + long env_val = strtol(s, NULL, 0); H5_coll_api_sanity_check_g = (0 == env_val) ? FALSE : TRUE; } } @@ -169,9 +163,6 @@ H5AC_init(void) * affect other interfaces; zero otherwise. * Failure: Negative. * - * Programmer: Quincey Koziol - * Thursday, July 18, 2002 - * *------------------------------------------------------------------------- */ int @@ -195,8 +186,6 @@ H5AC_term_package(void) * * Return: TRUE if a cache image load is pending, and FALSE otherwise. * - * Programmer: John Mainzer, 1/10/17 - * *------------------------------------------------------------------------- */ hbool_t @@ -208,8 +197,8 @@ H5AC_cache_image_pending(const H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; ret_value = H5C_cache_image_pending(cache_ptr); @@ -229,9 +218,6 @@ H5AC_cache_image_pending(const H5F_t *f) * * Failure: Negative * - * Programmer: Robb Matzke - * Jul 9 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -247,19 +233,19 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(f); - HDassert(NULL == f->shared->cache); - HDassert(config_ptr != NULL); - HDassert(image_config_ptr != NULL); - HDassert(image_config_ptr->version == H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION); + assert(f); + assert(NULL == f->shared->cache); + assert(config_ptr != NULL); + assert(image_config_ptr != NULL); + assert(image_config_ptr->version == H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION); HDcompile_assert(NELMTS(H5AC_class_s) == H5AC_NTYPES); HDcompile_assert(H5C__MAX_NUM_TYPE_IDS == H5AC_NTYPES); /* Validate configurations */ if (H5AC_validate_config(config_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache configuration") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache configuration"); if (H5AC_validate_cache_image_config(image_config_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache image configuration") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache image configuration"); #ifdef H5_HAVE_PARALLEL if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { @@ -268,18 +254,17 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co int mpi_size; if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(f))) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator"); if ((mpi_rank = H5F_mpi_get_rank(f)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get mpi rank") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get mpi rank"); if ((mpi_size = H5F_mpi_get_size(f)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get mpi size") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get mpi size"); if (NULL == (aux_ptr = H5FL_CALLOC(H5AC_aux_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate H5AC auxiliary structure") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate H5AC auxiliary structure"); - aux_ptr->magic = H5AC__H5AC_AUX_T_MAGIC; aux_ptr->mpi_comm = mpi_comm; aux_ptr->mpi_rank = mpi_rank; aux_ptr->mpi_size = mpi_size; @@ -287,7 +272,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co aux_ptr->dirty_bytes_threshold = H5AC__DEFAULT_DIRTY_BYTES_THRESHOLD; aux_ptr->dirty_bytes = 0; aux_ptr->metadata_write_strategy = H5AC__DEFAULT_METADATA_WRITE_STRATEGY; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->dirty_bytes_propagations = 0; aux_ptr->unprotect_dirty_bytes = 0; aux_ptr->unprotect_dirty_bytes_updates = 0; @@ -307,18 +292,18 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co if (mpi_rank == 0) { if (NULL == (aux_ptr->d_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create dirtied entry list") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create dirtied entry list"); if (NULL == (aux_ptr->c_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cleaned entry list") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cleaned entry list"); } /* end if */ - /* construct the candidate slist for all processes. + /* construct the candidate skip list for all processes. * when the distributed strategy is selected as all processes * will use it in the case of a flush. */ if (NULL == (aux_ptr->candidate_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create candidate entry list") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create candidate entry list"); if (aux_ptr->mpi_rank == 0) f->shared->cache = H5C_create(H5AC__DEFAULT_MAX_CACHE_SIZE, H5AC__DEFAULT_MIN_CLEAN_SIZE, @@ -343,12 +328,12 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co #endif /* H5_HAVE_PARALLEL */ if (NULL == f->shared->cache) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed"); #ifdef H5_HAVE_PARALLEL if (aux_ptr != NULL) if (H5C_set_prefix(f->shared->cache, prefix) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "H5C_set_prefix() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "H5C_set_prefix() failed"); #endif /* H5_HAVE_PARALLEL */ /* Turn on metadata cache logging, if being used @@ -358,11 +343,11 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co if (H5F_USE_MDC_LOGGING(f)) if (H5C_log_set_up(f->shared->cache, H5F_MDC_LOG_LOCATION(f), H5C_LOG_STYLE_JSON, H5F_START_MDC_LOG_ON_ACCESS(f)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed"); /* Set the cache parameters */ if (H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "auto resize configuration failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "auto resize configuration failed"); /* Don't need to get the current H5C image config here since the * cache has just been created, and thus f->shared->cache->image_ctl @@ -375,13 +360,13 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co int_ci_config.save_resize_status = image_config_ptr->save_resize_status; int_ci_config.entry_ageout = image_config_ptr->entry_ageout; if (H5C_set_cache_image_config(f, f->shared->cache, &int_ci_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "auto resize configuration failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "auto resize configuration failed"); done: /* If currently logging, generate a message */ if (f->shared->cache->log_info->logging) if (H5C_log_write_create_cache_msg(f->shared->cache, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); #ifdef H5_HAVE_PARALLEL /* if there is a failure, try to tidy up the auxiliary structure */ @@ -393,8 +378,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co H5SL_close(aux_ptr->c_slist_ptr); if (aux_ptr->candidate_slist_ptr != NULL) H5SL_close(aux_ptr->candidate_slist_ptr); - aux_ptr->magic = 0; - aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr); + aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr); } /* end if */ } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -411,17 +395,6 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 9 1997 - * - * Changes: - * - * In the parallel case, added code to setup the MDC slist - * before the call to H5AC__flush_entries() and take it down - * afterwards. - * - * JRM -- 7/29/20 - * *------------------------------------------------------------------------- */ herr_t @@ -437,9 +410,9 @@ H5AC_dest(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); #if H5AC_DUMP_STATS_ON_CLOSE /* Dump debugging info */ @@ -448,37 +421,25 @@ H5AC_dest(H5F_t *f) /* Check if log messages are being emitted */ if (H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to get logging status") - if (log_enabled && curr_logging) { - - if (H5C_log_write_destroy_cache_msg(f->shared->cache) < 0) - - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") - } + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to get logging status"); /* Tear down logging */ if (log_enabled) { + if (curr_logging) + if (H5C_log_write_destroy_cache_msg(f->shared->cache) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); if (H5C_log_tear_down(f->shared->cache) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed") - } + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "metadata cache logging tear-down failed"); + } /* end if */ #ifdef H5_HAVE_PARALLEL - /* destroying the cache, so clear all collective entries */ if (H5C_clear_coll_entries(f->shared->cache, FALSE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't clear collective entries"); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); - if (aux_ptr) { - - /* Sanity check */ - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - /* If the file was opened R/W, attempt to flush all entries * from rank 0 & Bcast clean list to other ranks. * @@ -489,7 +450,7 @@ H5AC_dest(H5F_t *f) * H5AC__flush_entries() and disable it afterwards, as the * skip list will be disabled after the previous flush. * - * Note that H5C_dest() does slist setup and take down as well. + * Note that H5C_dest() does skip list setup and take down as well. * Unfortunately, we can't do the setup and take down just once, * as H5C_dest() is called directly in the test code. * @@ -497,59 +458,44 @@ H5AC_dest(H5F_t *f) * point, so the overhead should be minimal. */ if (H5F_ACC_RDWR & H5F_INTENT(f)) { - - /* enable and load the slist */ + /* enable and load the skip list */ if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't enable skip list"); if (H5AC__flush_entries(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush"); - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush") - - /* disable the slist -- should be empty */ + /* disable the skip list -- should be empty */ if (H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed") - } - } -#endif /* H5_HAVE_PARALLEL */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't disable skip list"); + } /* end if */ + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ /* Destroy the cache */ if (H5C_dest(f) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't destroy cache"); f->shared->cache = NULL; #ifdef H5_HAVE_PARALLEL - if (aux_ptr != NULL) { - if (aux_ptr->d_slist_ptr != NULL) { - - HDassert(H5SL_count(aux_ptr->d_slist_ptr) == 0); + assert(H5SL_count(aux_ptr->d_slist_ptr) == 0); H5SL_close(aux_ptr->d_slist_ptr); - } /* end if */ if (aux_ptr->c_slist_ptr != NULL) { - - HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0); + assert(H5SL_count(aux_ptr->c_slist_ptr) == 0); H5SL_close(aux_ptr->c_slist_ptr); - } /* end if */ if (aux_ptr->candidate_slist_ptr != NULL) { - - HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); + assert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); H5SL_close(aux_ptr->candidate_slist_ptr); - } /* end if */ - aux_ptr->magic = 0; - aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr); - + aux_ptr = H5FL_FREE(H5AC_aux_t, aux_ptr); } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -565,9 +511,6 @@ H5AC_dest(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Dec 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -578,19 +521,19 @@ H5AC_evict(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); /* Evict all entries in the cache except the pinned superblock entry */ if (H5C_evict(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't evict cache") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't evict cache"); done: /* If currently logging, generate a message */ if (f->shared->cache->log_info->logging) if (H5C_log_write_evict_cache_msg(f->shared->cache, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_evict() */ @@ -604,9 +547,6 @@ H5AC_evict(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 6/30/06 - * *------------------------------------------------------------------------- */ herr_t @@ -617,21 +557,21 @@ H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, unsigned fl FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - HDassert(type); - HDassert(type->serialize); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->shared); + assert(f->shared->cache); + assert(type); + assert(type->serialize); + assert(H5_addr_defined(addr)); if (H5C_expunge_entry(f, type, addr, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_expunge_entry() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_expunge_entry() failed"); done: /* If currently logging, generate a message */ if (f->shared->cache->log_info->logging) if (H5C_log_write_expunge_entry_msg(f->shared->cache, addr, type->id, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_expunge_entry() */ @@ -650,9 +590,6 @@ H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, unsigned fl * Return: Non-negative on success/Negative on failure if there was a * request to flush all items and something was protected. * - * Programmer: Robb Matzke - * Jul 9 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -663,30 +600,30 @@ H5AC_flush(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); #ifdef H5_HAVE_PARALLEL /* flushing the cache, so clear all collective entries */ if (H5C_clear_coll_entries(f->shared->cache, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed"); /* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */ if (H5AC__flush_entries(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush"); #endif /* H5_HAVE_PARALLEL */ /* Flush the cache */ /* (Again, in parallel - writes out the superblock) */ if (H5C_flush_cache(f, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache"); done: /* If currently logging, generate a message */ if (f->shared->cache->log_info->logging) if (H5C_log_write_flush_cache_msg(f->shared->cache, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_flush() */ @@ -707,9 +644,6 @@ H5AC_flush(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 4/27/06 - * *------------------------------------------------------------------------- */ herr_t @@ -727,12 +661,12 @@ H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned *status) FUNC_ENTER_NOAPI(FAIL) - if ((f == NULL) || (!H5F_addr_defined(addr)) || (status == NULL)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry") + if ((f == NULL) || (!H5_addr_defined(addr)) || (status == NULL)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry"); if (H5C_get_entry_status(f, addr, NULL, &in_cache, &is_dirty, &is_protected, &is_pinned, &is_corked, &is_flush_dep_parent, &is_flush_dep_child, &image_is_up_to_date) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_status() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_status() failed"); if (in_cache) { *status |= H5AC_ES__IN_CACHE; @@ -767,9 +701,6 @@ H5AC_get_entry_status(const H5F_t *f, haddr_t addr, unsigned *status) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 9 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -780,26 +711,26 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - HDassert(type); - HDassert(type->serialize); - HDassert(H5F_addr_defined(addr)); - HDassert(thing); + assert(f); + assert(f->shared); + assert(f->shared->cache); + assert(type); + assert(type->serialize); + assert(H5_addr_defined(addr)); + assert(thing); /* Check for invalid access request */ if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file"); #if H5AC_DO_TAGGING_SANITY_CHECKS if (!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Bad tag value") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Bad tag value"); #endif /* H5AC_DO_TAGGING_SANITY_CHECKS */ /* Insert entry into metadata cache */ if (H5C_insert_entry(f, type, addr, thing, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed"); #ifdef H5_HAVE_PARALLEL { @@ -808,12 +739,12 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, if (NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) { /* Log the new entry */ if (H5AC__log_inserted_entry((H5AC_info_t *)thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC__log_inserted_entry() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC__log_inserted_entry() failed"); /* Check if we should try to flush */ if (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) if (H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point"); } /* end if */ } #endif /* H5_HAVE_PARALLEL */ @@ -823,7 +754,7 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, if (f->shared->cache->log_info->logging) if (H5C_log_write_insert_entry_msg(f->shared->cache, addr, type->id, flags, ((H5C_cache_entry_t *)thing)->size, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_insert_entry() */ @@ -837,9 +768,6 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 7/6/15 - * *------------------------------------------------------------------------- */ herr_t @@ -850,12 +778,12 @@ H5AC_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); if (H5C_load_cache_image_on_next_protect(f, addr, len, rw) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "call to H5C_load_cache_image_on_next_protect failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "call to H5C_load_cache_image_on_next_protect failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -869,9 +797,6 @@ H5AC_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 5/16/06 - * *------------------------------------------------------------------------- */ herr_t @@ -884,7 +809,7 @@ H5AC_mark_entry_dirty(void *thing) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(thing); + assert(thing); /* Set up entry & cache pointers */ entry_ptr = (H5AC_info_t *)thing; @@ -898,19 +823,19 @@ H5AC_mark_entry_dirty(void *thing) if ((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) && (entry_ptr->is_pinned) && (NULL != aux_ptr)) if (H5AC__log_dirtied_entry(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry"); } #endif /* H5_HAVE_PARALLEL */ if (H5C_mark_entry_dirty(thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty") + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty"); done: /* If currently logging, generate a message */ if (cache_ptr != NULL && cache_ptr->log_info != NULL) if (cache_ptr->log_info->logging) if (H5C_log_write_mark_entry_dirty_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_dirty() */ @@ -923,9 +848,6 @@ H5AC_mark_entry_dirty(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * 7/23/16 - * *------------------------------------------------------------------------- */ herr_t @@ -938,7 +860,7 @@ H5AC_mark_entry_clean(void *thing) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(thing); + assert(thing); entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; @@ -951,19 +873,19 @@ H5AC_mark_entry_clean(void *thing) if ((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) && (entry_ptr->is_pinned) && (NULL != aux_ptr)) if (H5AC__log_cleaned_entry(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "can't log cleaned entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "can't log cleaned entry"); } #endif /* H5_HAVE_PARALLEL */ if (H5C_mark_entry_clean(thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "can't mark pinned or protected entry clean") + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "can't mark pinned or protected entry clean"); done: /* If currently logging, generate a message */ if (cache_ptr != NULL && cache_ptr->log_info != NULL) if (cache_ptr->log_info->logging) if (H5C_log_write_mark_entry_clean_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_clean() */ @@ -976,9 +898,6 @@ H5AC_mark_entry_clean(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * 12/22/16 - * *------------------------------------------------------------------------- */ herr_t @@ -991,21 +910,21 @@ H5AC_mark_entry_unserialized(void *thing) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(thing); + assert(thing); /* Set up entry & cache pointers */ entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; if (H5C_mark_entry_unserialized(thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKUNSERIALIZED, FAIL, "can't mark entry unserialized") + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKUNSERIALIZED, FAIL, "can't mark entry unserialized"); done: /* If currently logging, generate a message */ if (cache_ptr != NULL && cache_ptr->log_info != NULL) if (cache_ptr->log_info->logging) if (H5C_log_write_mark_unserialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_unserialized() */ @@ -1018,9 +937,6 @@ H5AC_mark_entry_unserialized(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * 12/22/16 - * *------------------------------------------------------------------------- */ herr_t @@ -1033,20 +949,20 @@ H5AC_mark_entry_serialized(void *thing) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(thing); + assert(thing); entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; if (H5C_mark_entry_serialized(thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "can't mark entry serialized") + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "can't mark entry serialized"); done: /* If currently logging, generate a message */ if (cache_ptr != NULL && cache_ptr->log_info != NULL) if (cache_ptr->log_info->logging) if (H5C_log_write_mark_serialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_mark_entry_serialized() */ @@ -1059,9 +975,6 @@ H5AC_mark_entry_serialized(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 9 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1075,35 +988,35 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared->cache); - HDassert(type); - HDassert(H5F_addr_defined(old_addr)); - HDassert(H5F_addr_defined(new_addr)); - HDassert(H5F_addr_ne(old_addr, new_addr)); + assert(f); + assert(f->shared->cache); + assert(type); + assert(H5_addr_defined(old_addr)); + assert(H5_addr_defined(new_addr)); + assert(H5_addr_ne(old_addr, new_addr)); #ifdef H5_HAVE_PARALLEL /* Log moving the entry */ if (NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) if (H5AC__log_moved_entry(f, old_addr, new_addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log moved entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log moved entry"); #endif /* H5_HAVE_PARALLEL */ if (H5C_move_entry(f->shared->cache, type, old_addr, new_addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "H5C_move_entry() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "H5C_move_entry() failed"); #ifdef H5_HAVE_PARALLEL /* Check if we should try to flush */ if (NULL != aux_ptr && aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) if (H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point"); #endif /* H5_HAVE_PARALLEL */ done: /* If currently logging, generate a message */ if (f->shared->cache->log_info->logging) if (H5C_log_write_move_entry_msg(f->shared->cache, old_addr, new_addr, type->id, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_move_entry() */ @@ -1116,9 +1029,6 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 4/27/06 - * *------------------------------------------------------------------------- */ herr_t @@ -1131,22 +1041,22 @@ H5AC_pin_protected_entry(void *thing) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(thing); + assert(thing); entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); + assert(cache_ptr); /* Pin entry */ if (H5C_pin_protected_entry(thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry"); done: /* If currently logging, generate a message */ if (cache_ptr != NULL && cache_ptr->log_info != NULL) if (cache_ptr->log_info->logging) if (H5C_log_write_pin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_pin_protected_entry() */ @@ -1164,9 +1074,6 @@ H5AC_pin_protected_entry(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 7/3/15 - * *------------------------------------------------------------------------- */ herr_t @@ -1177,12 +1084,12 @@ H5AC_prep_for_file_close(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); if (H5C_prep_for_file_close(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cache prep for file close failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cache prep for file close failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1192,13 +1099,12 @@ H5AC_prep_for_file_close(H5F_t *f) * * Function: H5AC_prep_for_file_flush * - * Purpose: This function should be called just prior to the first - * call to H5AC_flush() during a file flush. + * Purpose: Handle any setup required prior to metadata cache flush. * - * Its purpose is to handly any setup required prior to - * metadata cache flush. + * This function should be called just prior to the first + * call to H5AC_flush() during a file flush. * - * Initially, this means setting up the slist prior to the + * Initially, this means setting up the skip list prior to the * flush. We do this in a separate call because * H5F__flush_phase2() make repeated calls to H5AC_flush(). * Handling this detail in separate calls allows us to avoid @@ -1207,11 +1113,6 @@ H5AC_prep_for_file_close(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 5/5/20 - * - * Changes: None. - * *------------------------------------------------------------------------- */ herr_t @@ -1222,18 +1123,15 @@ H5AC_prep_for_file_flush(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist enabled failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't enable skip list"); done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_prep_for_file_flush() */ /*------------------------------------------------------------------------- @@ -1243,14 +1141,11 @@ H5AC_prep_for_file_flush(H5F_t *f) * Purpose: This function should be called just after the last * call to H5AC_flush() during a file flush. * - * Its purpose is to perform any necessary cleanup after the - * metadata cache flush. - * * The objective of the call is to allow the metadata cache * to do any necessary necessary cleanup work after a cache * flush. * - * Initially, this means taking down the slist after the + * Initially, this means taking down the skip list after the * flush. We do this in a separate call because * H5F__flush_phase2() make repeated calls to H5AC_flush(). * Handling this detail in separate calls allows us to avoid @@ -1259,11 +1154,6 @@ H5AC_prep_for_file_flush(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 5/5/20 - * - * Changes: None. - * *------------------------------------------------------------------------- */ herr_t @@ -1274,18 +1164,15 @@ H5AC_secure_from_file_flush(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); if (H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist enabled failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't disable skip list"); done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5AC_secure_from_file_flush() */ /*------------------------------------------------------------------------- @@ -1297,9 +1184,6 @@ H5AC_secure_from_file_flush(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * 3/24/09 - * *------------------------------------------------------------------------- */ herr_t @@ -1312,16 +1196,16 @@ H5AC_create_flush_dependency(void *parent_thing, void *child_thing) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(parent_thing); - HDassert(child_thing); + assert(parent_thing); + assert(child_thing); entry_ptr = (H5AC_info_t *)parent_thing; cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); + assert(cache_ptr); /* Create the flush dependency */ if (H5C_create_flush_dependency(parent_thing, child_thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed"); done: /* If currently logging, generate a message */ @@ -1329,7 +1213,7 @@ H5AC_create_flush_dependency(void *parent_thing, void *child_thing) if (cache_ptr->log_info->logging) if (H5C_log_write_create_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_create_flush_dependency() */ @@ -1352,9 +1236,6 @@ H5AC_create_flush_dependency(void *parent_thing, void *child_thing) * Return: Success: Ptr to the object. * Failure: NULL * - * Programmer: Robb Matzke - * Sep 2 1997 - * *------------------------------------------------------------------------- */ void * @@ -1366,34 +1247,34 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata, unsi FUNC_ENTER_NOAPI(NULL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - HDassert(type); - HDassert(type->serialize); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->shared); + assert(f->shared->cache); + assert(type); + assert(type->serialize); + assert(H5_addr_defined(addr)); /* Check for unexpected flags -- H5C__FLUSH_COLLECTIVELY_FLAG * only permitted in the parallel case. */ #ifdef H5_HAVE_PARALLEL - HDassert(0 == (flags & - (unsigned)(~(H5C__READ_ONLY_FLAG | H5C__FLUSH_LAST_FLAG | H5C__FLUSH_COLLECTIVELY_FLAG)))); + assert(0 == (flags & + (unsigned)(~(H5C__READ_ONLY_FLAG | H5C__FLUSH_LAST_FLAG | H5C__FLUSH_COLLECTIVELY_FLAG)))); #else /* H5_HAVE_PARALLEL */ - HDassert(0 == (flags & (unsigned)(~(H5C__READ_ONLY_FLAG | H5C__FLUSH_LAST_FLAG)))); + assert(0 == (flags & (unsigned)(~(H5C__READ_ONLY_FLAG | H5C__FLUSH_LAST_FLAG)))); #endif /* H5_HAVE_PARALLEL */ /* Check for invalid access request */ if ((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file"); #if H5AC_DO_TAGGING_SANITY_CHECKS if (!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Bad tag value") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Bad tag value"); #endif /* H5AC_DO_TAGGING_SANITY_CHECKS */ if (NULL == (thing = H5C_protect(f, type, addr, udata, flags))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_protect() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_protect() failed"); /* Set return value */ ret_value = thing; @@ -1406,7 +1287,7 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata, unsi if (f->shared->cache->log_info->logging) if (H5C_log_write_protect_entry_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, fake_ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, NULL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, NULL, "unable to emit log message"); } FUNC_LEAVE_NOAPI(ret_value) @@ -1419,9 +1300,6 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata, unsi * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 7/5/06 - * *------------------------------------------------------------------------- */ herr_t @@ -1434,11 +1312,11 @@ H5AC_resize_entry(void *thing, size_t new_size) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(thing); + assert(thing); entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); + assert(cache_ptr); #ifdef H5_HAVE_PARALLEL /* Log the generation of dirty bytes of metadata iff: @@ -1475,24 +1353,6 @@ H5AC_resize_entry(void *thing, size_t new_size) * amounts of dirty metadata creation in other areas -- which will * cause aux_ptr->dirty_bytes to be incremented. * - * The bottom line is that this code is probably OK, but the above - * points should be kept in mind. - * - * One final observation: This comment is occasioned by a bug caused - * by moving the call to H5AC__log_dirtied_entry() after the call to - * H5C_resize_entry(), and then only calling H5AC__log_dirtied_entry() - * if entry_ptr->is_dirty was false. - * - * Since H5C_resize_entry() marks the target entry dirty unless there - * is not change in size, this had the effect of not calling - * H5AC__log_dirtied_entry() when it should be, and corrupting - * the cleaned and dirtied lists used by rank 0 in the parallel - * version of the metadata cache. - * - * The point here is that you should be very careful when working with - * this code, and not modify it unless you fully understand it. - * - * JRM -- 2/28/22 */ if ((!entry_ptr->is_dirty) && (entry_ptr->size != new_size)) { @@ -1507,21 +1367,21 @@ H5AC_resize_entry(void *thing, size_t new_size) if (NULL != aux_ptr) { if (H5AC__log_dirtied_entry(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry"); } } #endif /* H5_HAVE_PARALLEL */ /* Resize the entry */ if (H5C_resize_entry(thing, new_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry"); done: /* If currently logging, generate a message */ if (cache_ptr != NULL && cache_ptr->log_info != NULL) if (cache_ptr->log_info->logging) if (H5C_log_write_resize_entry_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_resize_entry() */ @@ -1534,9 +1394,6 @@ H5AC_resize_entry(void *thing, size_t new_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 4/11/06 - * *------------------------------------------------------------------------- */ herr_t @@ -1549,22 +1406,22 @@ H5AC_unpin_entry(void *thing) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(thing); + assert(thing); entry_ptr = (H5AC_info_t *)thing; cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); + assert(cache_ptr); /* Unpin the entry */ if (H5C_unpin_entry(thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry"); done: /* If currently logging, generate a message */ if (cache_ptr != NULL && cache_ptr->log_info != NULL) if (cache_ptr->log_info->logging) if (H5C_log_write_unpin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_unpin_entry() */ @@ -1576,9 +1433,6 @@ H5AC_unpin_entry(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * 3/24/09 - * *------------------------------------------------------------------------- */ herr_t @@ -1591,16 +1445,16 @@ H5AC_destroy_flush_dependency(void *parent_thing, void *child_thing) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(parent_thing); - HDassert(child_thing); + assert(parent_thing); + assert(child_thing); entry_ptr = (H5AC_info_t *)parent_thing; cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); + assert(cache_ptr); /* Destroy the flush dependency */ if (H5C_destroy_flush_dependency(parent_thing, child_thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed"); done: /* If currently logging, generate a message */ @@ -1608,7 +1462,7 @@ H5AC_destroy_flush_dependency(void *parent_thing, void *child_thing) if (cache_ptr->log_info->logging) if (H5C_log_write_destroy_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_destroy_flush_dependency() */ @@ -1645,9 +1499,6 @@ H5AC_destroy_flush_dependency(void *parent_thing, void *child_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Sep 2 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1663,16 +1514,16 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, un FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - HDassert(type); - HDassert(type->deserialize); - HDassert(type->image_len); - HDassert(H5F_addr_defined(addr)); - HDassert(thing); - HDassert(((H5AC_info_t *)thing)->addr == addr); - HDassert(((H5AC_info_t *)thing)->type == type); + assert(f); + assert(f->shared); + assert(f->shared->cache); + assert(type); + assert(type->deserialize); + assert(type->image_len); + assert(H5_addr_defined(addr)); + assert(thing); + assert(((H5AC_info_t *)thing)->addr == addr); + assert(((H5AC_info_t *)thing)->type == type); dirtied = (hbool_t)(((flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG) || (((H5AC_info_t *)thing)->dirtied)); @@ -1685,44 +1536,44 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, un size_t curr_size = 0; if ((type->image_len)(thing, &curr_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "Can't get size of thing"); if (((H5AC_info_t *)thing)->size != curr_size) - HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, FAIL, "size of entry changed") + HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, FAIL, "size of entry changed"); } /* end if */ #ifdef H5_HAVE_PARALLEL if (NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) { if (dirtied && ((H5AC_info_t *)thing)->is_dirty == FALSE) if (H5AC__log_dirtied_entry((H5AC_info_t *)thing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry"); if (deleted && aux_ptr->mpi_rank == 0) { if (H5AC__log_deleted_entry((H5AC_info_t *)thing) < 0) { /* If we fail to log the deleted entry, push an error but still * participate in a possible sync point ahead */ - HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5AC__log_deleted_entry() failed") + HDONE_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5AC__log_deleted_entry() failed"); } } } /* end if */ #endif /* H5_HAVE_PARALLEL */ if (H5C_unprotect(f, addr, thing, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5C_unprotect() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "H5C_unprotect() failed"); #ifdef H5_HAVE_PARALLEL /* Check if we should try to flush */ if ((aux_ptr != NULL) && (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)) if (H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point"); #endif /* H5_HAVE_PARALLEL */ done: /* If currently logging, generate a message */ if (f->shared->cache->log_info->logging) if (H5C_log_write_unprotect_entry_msg(f->shared->cache, addr, type->id, flags, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_unprotect() */ @@ -1734,9 +1585,6 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing, un * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 3/10/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1751,22 +1599,13 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, H5AC_cache_config_t * /* Check args */ if ((cache_ptr == NULL) || (config_ptr == NULL) || (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or config_ptr on entry") -#ifdef H5_HAVE_PARALLEL - { - H5AC_aux_t *aux_ptr; - - aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - if ((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr on entry") - } -#endif /* H5_HAVE_PARALLEL */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or config_ptr on entry"); /* Retrieve the configuration */ if (H5C_get_cache_auto_resize_config((const H5C_t *)cache_ptr, &internal_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_auto_resize_config() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_auto_resize_config() failed"); if (H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_resize_enabled() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_resize_enabled() failed"); /* Set the information to return */ if (internal_config.rpt_fcn == NULL) @@ -1827,9 +1666,6 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, H5AC_cache_config_t * * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 3/11/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1842,7 +1678,7 @@ H5AC_get_cache_size(const H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_c if (H5C_get_cache_size((const H5C_t *)cache_ptr, max_size_ptr, min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_size() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_size() failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1855,9 +1691,6 @@ H5AC_get_cache_size(const H5AC_t *cache_ptr, size_t *max_size_ptr, size_t *min_c * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 3/11/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1868,7 +1701,7 @@ H5AC_get_cache_flush_in_progress(H5AC_t *cache_ptr, hbool_t *flush_in_progress_p FUNC_ENTER_NOAPI(FAIL) if (H5C_get_cache_flush_in_progress((H5C_t *)cache_ptr, flush_in_progress_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_flush_in_progress() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_flush_in_progress() failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1881,9 +1714,6 @@ H5AC_get_cache_flush_in_progress(H5AC_t *cache_ptr, hbool_t *flush_in_progress_p * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 3/10/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1894,7 +1724,7 @@ H5AC_get_cache_hit_rate(const H5AC_t *cache_ptr, double *hit_rate_ptr) FUNC_ENTER_NOAPI(FAIL) if (H5C_get_cache_hit_rate((const H5C_t *)cache_ptr, hit_rate_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_hit_rate() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_cache_hit_rate() failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1908,8 +1738,6 @@ H5AC_get_cache_hit_rate(const H5AC_t *cache_ptr, double *hit_rate_ptr) * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer, 3/10/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1920,7 +1748,7 @@ H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr) FUNC_ENTER_NOAPI(FAIL) if (H5C_reset_cache_hit_rate_stats((H5C_t *)cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats() failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1933,9 +1761,6 @@ H5AC_reset_cache_hit_rate_stats(H5AC_t *cache_ptr) * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 3/10/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1947,23 +1772,14 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, const H5AC_cache_config_t * FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache_ptr); + assert(cache_ptr); if (cache_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry") -#ifdef H5_HAVE_PARALLEL - { - H5AC_aux_t *aux_ptr; - - aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - if ((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr on entry") - } -#endif /* H5_HAVE_PARALLEL */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry"); /* Validate external configuration */ if (H5AC_validate_config(config_ptr) != SUCCEED) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache configuration") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache configuration"); /* If the cache config struct is being used to control logging, perform * the open/close operations. Note that this is the only place where the @@ -1973,7 +1789,7 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, const H5AC_cache_config_t * /* close */ if (config_ptr->close_trace_file) if (H5C_log_tear_down((H5C_t *)cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed"); /* open */ if (config_ptr->open_trace_file) { @@ -1982,18 +1798,18 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, const H5AC_cache_config_t * * output is generated when logging is controlled by the H5P calls. */ if (H5C_log_set_up((H5C_t *)cache_ptr, config_ptr->trace_file_name, H5C_LOG_STYLE_TRACE, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed"); } /* Convert external configuration to internal representation */ if (H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__ext_config_2_int_config() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__ext_config_2_int_config() failed"); /* Set configuration */ if (H5C_set_cache_auto_resize_config(cache_ptr, &internal_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_cache_auto_resize_config() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_cache_auto_resize_config() failed"); if (H5C_set_evictions_enabled(cache_ptr, config_ptr->evictions_enabled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_evictions_enabled() failed"); #ifdef H5_HAVE_PARALLEL { @@ -2012,7 +1828,7 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, const H5AC_cache_config_t * /* If currently logging, generate a message */ if (cache_ptr->log_info->logging) if (H5C_log_write_set_cache_config_msg(cache_ptr, config_ptr, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_set_cache_auto_resize_config() */ @@ -2034,9 +1850,6 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, const H5AC_cache_config_t * * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 4/6/05 - * *------------------------------------------------------------------------- */ herr_t @@ -2049,9 +1862,9 @@ H5AC_validate_config(const H5AC_cache_config_t *config_ptr) /* Check args */ if (config_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL config_ptr on entry") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL config_ptr on entry"); if (config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Unknown config version") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Unknown config version"); /* don't bother to test trace_file_name unless open_trace_file is TRUE */ if (config_ptr->open_trace_file) { @@ -2063,30 +1876,30 @@ H5AC_validate_config(const H5AC_cache_config_t *config_ptr) */ name_len = HDstrlen(config_ptr->trace_file_name); if (name_len == 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty"); else if (name_len > H5AC__MAX_TRACE_FILE_NAME_LEN) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name too long") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name too long"); } /* end if */ if ((config_ptr->evictions_enabled == FALSE) && ((config_ptr->incr_mode != H5C_incr__off) || (config_ptr->flash_incr_mode != H5C_flash_incr__off) || (config_ptr->decr_mode != H5C_decr__off))) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Can't disable evictions while auto-resize is enabled") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Can't disable evictions while auto-resize is enabled"); if (config_ptr->dirty_bytes_threshold < H5AC__MIN_DIRTY_BYTES_THRESHOLD) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too small") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too small"); else if (config_ptr->dirty_bytes_threshold > H5AC__MAX_DIRTY_BYTES_THRESHOLD) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too big") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "dirty_bytes_threshold too big"); if ((config_ptr->metadata_write_strategy != H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY) && (config_ptr->metadata_write_strategy != H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->metadata_write_strategy out of range") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->metadata_write_strategy out of range"); if (H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__ext_config_2_int_config() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__ext_config_2_int_config() failed"); if (H5C_validate_resize_config(&internal_config, H5C_RESIZE_CFG__VALIDATE_ALL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "error(s) in new config") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "error(s) in new config"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2110,9 +1923,6 @@ H5AC_validate_config(const H5AC_cache_config_t *config_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 6/25/15 - * *------------------------------------------------------------------------- */ herr_t @@ -2125,10 +1935,10 @@ H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr) /* Check args */ if (config_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL config_ptr on entry") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL config_ptr on entry"); if (config_ptr->version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Unknown image config version") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Unknown image config version"); /* don't need to get the current H5C image config here since the * default values of fields not in the H5AC config will always be @@ -2140,7 +1950,7 @@ H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr) internal_config.entry_ageout = config_ptr->entry_ageout; if (H5C_validate_cache_image_config(&internal_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "error(s) in new cache image config") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "error(s) in new cache image config"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2161,8 +1971,6 @@ H5AC_validate_cache_image_config(H5AC_cache_image_config_t *config_ptr) * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 5/15/04 - * *------------------------------------------------------------------------- */ static herr_t @@ -2182,13 +1990,11 @@ H5AC__check_if_write_permitted(const H5F_t #ifdef H5_HAVE_PARALLEL /* Sanity checks */ - HDassert(f != NULL); - HDassert(f->shared != NULL); - HDassert(f->shared->cache != NULL); + assert(f != NULL); + assert(f->shared != NULL); + assert(f->shared->cache != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); if (aux_ptr != NULL) { - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - if ((aux_ptr->mpi_rank == 0) || (aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED)) write_permitted = aux_ptr->write_permitted; @@ -2215,9 +2021,6 @@ H5AC__check_if_write_permitted(const H5F_t * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 1/26/06 - * *------------------------------------------------------------------------- */ static herr_t @@ -2229,7 +2032,7 @@ H5AC__ext_config_2_int_config(const H5AC_cache_config_t *ext_conf_ptr, H5C_auto_ if ((ext_conf_ptr == NULL) || (ext_conf_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION) || (int_conf_ptr == NULL)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad ext_conf_ptr or inf_conf_ptr on entry") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad ext_conf_ptr or inf_conf_ptr on entry"); int_conf_ptr->version = H5C__CURR_AUTO_SIZE_CTL_VER; if (ext_conf_ptr->rpt_fcn_enabled) @@ -2276,9 +2079,6 @@ H5AC__ext_config_2_int_config(const H5AC_cache_config_t *ext_conf_ptr, H5C_auto_ * * Return: SUCCEED on success, FAIL otherwise. * - * Programmer: Mike McGreevy - * December 1, 2009 - * *------------------------------------------------------------------------------ */ herr_t @@ -2289,13 +2089,13 @@ H5AC_ignore_tags(const H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); /* Set up a new metadata tag */ if (H5C_ignore_tags(f->shared->cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "H5C_ignore_tags() failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "H5C_ignore_tags() failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2308,9 +2108,6 @@ H5AC_ignore_tags(const H5F_t *f) * * Return: void * - * Programmer: Mike McGreevy - * December 1, 2009 - * *------------------------------------------------------------------------------ */ void @@ -2337,9 +2134,6 @@ H5AC_tag(haddr_t metadata_tag, haddr_t *prev_tag) * * Return: SUCCEED on success, FAIL otherwise. * - * Programmer: Mike McGreevy - * March 17, 2010 - * *------------------------------------------------------------------------------ */ herr_t @@ -2350,12 +2144,12 @@ H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Call cache-level function to re-tag entries with the COPIED tag */ if (H5C_retag_entries(f->shared->cache, H5AC__COPIED_TAG, metadata_tag) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "Can't retag metadata") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "Can't retag metadata"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2369,9 +2163,6 @@ H5AC_retag_copied_metadata(const H5F_t *f, haddr_t metadata_tag) * * Return: SUCCEED on success, FAIL otherwise. * - * Programmer: Mike McGreevy - * May 19, 2010 - * *------------------------------------------------------------------------------ */ herr_t @@ -2384,12 +2175,12 @@ H5AC_flush_tagged_metadata(H5F_t *f, haddr_t metadata_tag) FUNC_ENTER_NOAPI(FAIL) /* Assertions */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Call cache level function to flush metadata entries with specified tag */ if (H5C_flush_tagged_entries(f, metadata_tag) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot flush metadata") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot flush metadata"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2398,14 +2189,15 @@ H5AC_flush_tagged_metadata(H5F_t *f, haddr_t metadata_tag) /*------------------------------------------------------------------------------ * Function: H5AC_evict_tagged_metadata() * - * Purpose: Wrapper for cache level function which flushes all metadata + * Purpose: Wrapper for cache level function which evicts all metadata * that contains the specific tag. * - * Return: SUCCEED on success, FAIL otherwise. - * - * Programmer: Mike McGreevy - * May 19, 2010 + * The match_global parameter determines if the global file + * data (e.g., global heaps, shared object header messages) + * should be checked. This is false when closing objects + * and true when flushing. * + * Return: SUCCEED on success, FAIL otherwise. *------------------------------------------------------------------------------ */ herr_t @@ -2418,12 +2210,12 @@ H5AC_evict_tagged_metadata(H5F_t *f, haddr_t metadata_tag, hbool_t match_global) FUNC_ENTER_NOAPI(FAIL) /* Assertions */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Call cache level function to evict metadata entries with specified tag */ if (H5C_evict_tagged_entries(f, metadata_tag, match_global) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot evict metadata") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot evict metadata"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2437,8 +2229,6 @@ H5AC_evict_tagged_metadata(H5F_t *f, haddr_t metadata_tag, hbool_t match_global) * * Return: SUCCEED on success, FAIL otherwise. * - * Programmer: Vailin Choi; May 2016 - * *------------------------------------------------------------------------------ */ herr_t @@ -2451,12 +2241,12 @@ H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flag FUNC_ENTER_NOAPI(FAIL) /* Assertions */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Call cache level function to expunge entries with specified tag and type id */ if (H5C_expunge_tag_type_metadata(f, tag, type_id, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot expunge tagged type entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cannot expunge tagged type entries"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2469,9 +2259,6 @@ H5AC_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flag * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------------ */ herr_t @@ -2484,12 +2271,12 @@ H5AC_get_tag(const void *thing, haddr_t *tag) FUNC_ENTER_NOAPI(FAIL) /* Assertions */ - HDassert(thing); - HDassert(tag); + assert(thing); + assert(tag); /* Call cache level function to get the tag */ if (H5C_get_tag(thing, tag) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot get tag for metadata cache entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot get tag for metadata cache entry"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2502,8 +2289,6 @@ H5AC_get_tag(const void *thing, haddr_t *tag) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Jan 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -2514,11 +2299,11 @@ H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - HDassert(H5F_addr_defined(obj_addr)); - HDassert(action == H5AC__SET_CORK || action == H5AC__UNCORK || action == H5AC__GET_CORKED); + assert(f); + assert(f->shared); + assert(f->shared->cache); + assert(H5_addr_defined(obj_addr)); + assert(action == H5AC__SET_CORK || action == H5AC__UNCORK || action == H5AC__GET_CORKED); /* Skip the search on "tag_list" when there are no "corked" objects. * This is done to mitigate the slow down when closing objects. @@ -2526,15 +2311,15 @@ H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked) * in the future. */ if (action == H5AC__GET_CORKED) { - HDassert(corked); + assert(corked); if (H5C_get_num_objs_corked(f->shared->cache) == 0) { *corked = FALSE; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } } if (H5C_cork(f->shared->cache, obj_addr, action, corked) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Cannot perform the cork action") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Cannot perform the cork action"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2551,9 +2336,6 @@ H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked) * * Return: SUCCEED or FAIL. * - * Programmer: Mike McGreevy - * October 20, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -2569,7 +2351,7 @@ H5AC__verify_tag(const H5AC_class_t *type) /* Verify legal tag value */ if (H5C_verify_tag(type->id, tag) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "tag verification failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "tag verification failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2586,9 +2368,6 @@ H5AC__verify_tag(const H5AC_class_t *type) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * 9/8/15 - * *------------------------------------------------------------------------- */ herr_t @@ -2599,13 +2378,13 @@ H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(ring); + assert(f); + assert(H5_addr_defined(addr)); + assert(ring); /* Retrieve the ring value for the entry at address */ if (H5C_get_entry_ring(f, addr, ring) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "Can't retrieve ring for entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "Can't retrieve ring for entry"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2619,9 +2398,6 @@ H5AC_get_entry_ring(const H5F_t *f, haddr_t addr, H5AC_ring_t *ring) * * Return: void * - * Programmer: Quincey Koziol - * Tuesday, September 8, 2015 - * *------------------------------------------------------------------------- */ void @@ -2629,7 +2405,7 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring) { FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Note: orig_ring can be NULL so don't check it with HDassert() */ + /* Note: orig_ring can be NULL so don't check it with assert() */ /* Get the current ring value and return that (if orig_ring is NOT null) */ if (orig_ring) @@ -2664,9 +2440,6 @@ H5AC_set_ring(H5AC_ring_t ring, H5AC_ring_t *orig_ring) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -2678,11 +2451,11 @@ H5AC_unsettle_entry_ring(void *_entry) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(entry); + assert(entry); /* Unsettle the entry's ring */ if (H5C_unsettle_entry_ring(entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2710,9 +2483,6 @@ H5AC_unsettle_entry_ring(void *_entry) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 10/15/16 - * *------------------------------------------------------------------------- */ herr_t @@ -2723,7 +2493,7 @@ H5AC_unsettle_ring(H5F_t *f, H5C_ring_t ring) FUNC_ENTER_NOAPI(FAIL) if (FAIL == (ret_value = H5C_unsettle_ring(f, ring))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_unsettle_ring() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_unsettle_ring() failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2737,9 +2507,6 @@ H5AC_unsettle_ring(H5F_t *f, H5C_ring_t ring) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -2752,20 +2519,20 @@ H5AC_remove_entry(void *_entry) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(entry); + assert(entry); cache = entry->cache_ptr; - HDassert(cache); + assert(cache); /* Remove the entry from the cache*/ if (H5C_remove_entry(entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry"); done: /* If currently logging, generate a message */ if (cache != NULL && cache->log_info != NULL) if (cache->log_info->logging) if (H5C_log_write_remove_entry_msg(cache, entry, ret_value) < 0) - HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); FUNC_LEAVE_NOAPI(ret_value) } /* H5AC_remove_entry() */ @@ -2777,8 +2544,6 @@ H5AC_remove_entry(void *_entry) * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: Vailin Choi; March 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -2789,7 +2554,7 @@ H5AC_get_mdc_image_info(const H5AC_t *cache_ptr, haddr_t *image_addr, hsize_t *i FUNC_ENTER_NOAPI(FAIL) if (H5C_get_mdc_image_info((const H5C_t *)cache_ptr, image_addr, image_len) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve cache image info"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5ACdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5ACdbg.c index 97b0ba3500..914040f9b6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5ACdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5ACdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -69,9 +68,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, October 30, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -80,9 +76,9 @@ H5AC_stats(const H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); /* at present, this can't fail */ (void)H5C_stats(f->shared->cache, H5F_OPEN_NAME(f), FALSE); @@ -100,9 +96,6 @@ H5AC_stats(const H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * Sunday, October 10, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -113,12 +106,12 @@ H5AC_dump_cache(const H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); if (H5C_dump_cache(f->shared->cache, H5F_OPEN_NAME(f)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_dump_cache() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_dump_cache() failed."); done: FUNC_LEAVE_NOAPI(ret_value) @@ -160,8 +153,6 @@ H5AC_dump_cache(const H5F_t *f) * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: John Mainzer, 5/30/14 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -174,12 +165,12 @@ H5AC_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr, void **entry_ptr_ptr) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; if (H5C_get_entry_ptr_from_addr(cache_ptr, addr, entry_ptr_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_ptr_from_addr() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_ptr_from_addr() failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -206,9 +197,6 @@ H5AC_get_entry_ptr_from_addr(const H5F_t *f, haddr_t addr, void **entry_ptr_ptr) * Return: SUCCEED on success/FAIL on failure. Note that * *fd_exists_ptr is undefined on failure. * - * Programmer: John Mainzer - * 9/28/16 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -221,8 +209,8 @@ H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr, haddr_t child_addr, FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; ret_value = H5C_flush_dependency_exists(cache_ptr, parent_addr, child_addr, fd_exists_ptr); @@ -255,8 +243,6 @@ H5AC_flush_dependency_exists(H5F_t *f, haddr_t parent_addr, haddr_t child_addr, * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: John Mainzer, 5/30/14 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -270,12 +256,12 @@ H5AC_verify_entry_type(const H5F_t *f, haddr_t addr, const H5AC_class_t *expecte FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; if (H5C_verify_entry_type(cache_ptr, addr, expected_type, in_cache_ptr, type_ok_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_verify_entry_type() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_verify_entry_type() failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -290,9 +276,6 @@ H5AC_verify_entry_type(const H5F_t *f, haddr_t addr, const H5AC_class_t *expecte * * Return: Current value of cache_ptr->serialization_in_progress. * - * Programmer: John Mainzer - * 8/24/15 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -305,8 +288,8 @@ H5AC_get_serialization_in_progress(H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; /* Set return value */ @@ -329,8 +312,6 @@ H5AC_get_serialization_in_progress(H5F_t *f) * * Return: TRUE if the indicated ring(s) are clean, and FALSE otherwise. * - * Programmer: John Mainzer, 6/18/16 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -343,8 +324,8 @@ H5AC_cache_is_clean(const H5F_t *f, H5AC_ring_t inner_ring) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; ret_value = H5C_cache_is_clean(cache_ptr, inner_ring); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5ACmpio.c b/externals/coda-oss/modules/drivers/hdf5/source/H5ACmpio.c index a64c4a41f2..0a634c00cd 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5ACmpio.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5ACmpio.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5ACmpio.c - * Jun 20 2015 - * Quincey Koziol * * Purpose: Functions in this file implement support for parallel * I/O cache functionality @@ -131,9 +128,6 @@ H5FL_DEFINE_STATIC(H5AC_slist_entry_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 5/9/10 - * *------------------------------------------------------------------------- */ herr_t @@ -144,10 +138,9 @@ H5AC__set_sync_point_done_callback(H5C_t *cache_ptr, H5AC_sync_point_done_cb_t s FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(cache_ptr); + assert(cache_ptr); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); + assert(aux_ptr != NULL); aux_ptr->sync_point_done = sync_point_done; @@ -163,9 +156,6 @@ H5AC__set_sync_point_done_callback(H5C_t *cache_ptr, H5AC_sync_point_done_cb_t s * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 5/11/06 - * *------------------------------------------------------------------------- */ herr_t @@ -176,10 +166,9 @@ H5AC__set_write_done_callback(H5C_t *cache_ptr, H5AC_write_done_cb_t write_done) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(cache_ptr); + assert(cache_ptr); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); + assert(aux_ptr != NULL); aux_ptr->write_done = write_done; @@ -199,9 +188,6 @@ H5AC__set_write_done_callback(H5C_t *cache_ptr, H5AC_write_done_cb_t write_done) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 3/17/10 - * *------------------------------------------------------------------------- */ herr_t @@ -214,22 +200,21 @@ H5AC_add_candidate(H5AC_t *cache_ptr, haddr_t addr) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); - HDassert(aux_ptr->candidate_slist_ptr != NULL); + assert(aux_ptr != NULL); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); + assert(aux_ptr->candidate_slist_ptr != NULL); /* Construct an entry for the supplied address, and insert * it into the candidate slist. */ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate candidate slist entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate candidate slist entry"); slist_entry_ptr->addr = addr; if (H5SL_insert(aux_ptr->candidate_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist"); done: /* Clean up on error */ @@ -260,8 +245,6 @@ H5AC_add_candidate(H5AC_t *cache_ptr, haddr_t addr) * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 7/1/05 - * *------------------------------------------------------------------------- */ static herr_t @@ -276,17 +259,16 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr, had FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->mpi_rank == 0); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); - HDassert(aux_ptr->candidate_slist_ptr != NULL); - HDassert(num_entries_ptr != NULL); - HDassert(*num_entries_ptr == 0); - HDassert(haddr_buf_ptr_ptr != NULL); - HDassert(*haddr_buf_ptr_ptr == NULL); + assert(aux_ptr != NULL); + assert(aux_ptr->mpi_rank == 0); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); + assert(aux_ptr->candidate_slist_ptr != NULL); + assert(num_entries_ptr != NULL); + assert(*num_entries_ptr == 0); + assert(haddr_buf_ptr_ptr != NULL); + assert(*haddr_buf_ptr_ptr == NULL); /* First broadcast the number of entries in the list so that the * receivers can set up buffers to receive them. If there aren't @@ -306,10 +288,10 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr, had */ if (H5AC__copy_candidate_list_to_buffer(cache_ptr, &chk_num_entries, &haddr_buf_ptr) < 0) { /* Push an error, but still participate in following MPI_Bcast */ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate buffer.") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate buffer."); } - HDassert(chk_num_entries == num_entries); - HDassert(haddr_buf_ptr != NULL); + assert(chk_num_entries == num_entries); + assert(haddr_buf_ptr != NULL); /* Now broadcast the list of candidate entries */ buf_size = sizeof(haddr_t) * num_entries; @@ -342,8 +324,6 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, unsigned *num_entries_ptr, had * * Return: Non-negative on success/Negative on failure. * - * Programmer: Quincey Koziol, 6/12/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -356,8 +336,8 @@ H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_uda FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(slist_entry_ptr); - HDassert(udata); + assert(slist_entry_ptr); + assert(udata); /* Store the entry's address in the buffer */ addr = slist_entry_ptr->addr; @@ -393,8 +373,6 @@ H5AC__broadcast_clean_list_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_uda * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 7/1/05 - * *------------------------------------------------------------------------- */ static herr_t @@ -409,12 +387,11 @@ H5AC__broadcast_clean_list(H5AC_t *cache_ptr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->mpi_rank == 0); - HDassert(aux_ptr->c_slist_ptr != NULL); + assert(aux_ptr != NULL); + assert(aux_ptr->mpi_rank == 0); + assert(aux_ptr->c_slist_ptr != NULL); /* First broadcast the number of entries in the list so that the * receives can set up a buffer to receive them. If there aren't @@ -432,7 +409,7 @@ H5AC__broadcast_clean_list(H5AC_t *cache_ptr) buf_size = sizeof(haddr_t) * num_entries; if (NULL == (addr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) { /* Push an error, but still participate in following MPI_Bcast */ - HDONE_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for addr buffer") + HDONE_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for addr buffer"); } else { /* Set up user data for callback */ @@ -444,7 +421,7 @@ H5AC__broadcast_clean_list(H5AC_t *cache_ptr) /* (Callback also removes the matching entries from the dirtied list) */ if (H5SL_free(aux_ptr->c_slist_ptr, H5AC__broadcast_clean_list_cb, &udata) < 0) { /* Push an error, but still participate in following MPI_Bcast */ - HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "Can't build address list for clean entries") + HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "Can't build address list for clean entries"); } } @@ -482,9 +459,6 @@ H5AC__broadcast_clean_list(H5AC_t *cache_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 3/17/10 - * *------------------------------------------------------------------------- */ static herr_t @@ -496,33 +470,32 @@ H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUS FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache_ptr != NULL); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); - HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_CACHE) || (aux_ptr->mpi_rank == 0)); - HDassert(aux_ptr->d_slist_ptr != NULL); - HDassert(aux_ptr->c_slist_ptr != NULL); - HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0); - HDassert(aux_ptr->candidate_slist_ptr != NULL); - HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); - HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || - (sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_CACHE)); + assert(cache_ptr != NULL); + assert(aux_ptr != NULL); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); + assert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_CACHE) || (aux_ptr->mpi_rank == 0)); + assert(aux_ptr->d_slist_ptr != NULL); + assert(aux_ptr->c_slist_ptr != NULL); + assert(H5SL_count(aux_ptr->c_slist_ptr) == 0); + assert(aux_ptr->candidate_slist_ptr != NULL); + assert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); + assert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || + (sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_CACHE)); switch (sync_point_op) { case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN: if (H5C_construct_candidate_list__min_clean((H5C_t *)cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_construct_candidate_list__min_clean() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_construct_candidate_list__min_clean() failed."); break; case H5AC_SYNC_POINT_OP__FLUSH_CACHE: if (H5C_construct_candidate_list__clean_cache((H5C_t *)cache_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "H5C_construct_candidate_list__clean_cache() failed.") + "H5C_construct_candidate_list__clean_cache() failed."); break; default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown sync point operation.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown sync point operation."); break; } /* end switch */ @@ -539,8 +512,6 @@ H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t H5_ATTR_NDEBUG_UNUS * * Return: Return SUCCEED on success, and FAIL on failure. * - * Programmer: Quincey Koziol, 6/12/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -552,8 +523,8 @@ H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key, v FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(slist_entry_ptr); - HDassert(udata); + assert(slist_entry_ptr); + assert(udata); /* Store the entry's address in the buffer */ udata->addr_buf_ptr[udata->u] = slist_entry_ptr->addr; @@ -592,8 +563,6 @@ H5AC__copy_candidate_list_to_buffer_cb(void *_item, void H5_ATTR_UNUSED *_key, v * * Return: Return SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer, 4/19/10 - * *------------------------------------------------------------------------- */ static herr_t @@ -610,17 +579,16 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entri FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); - HDassert(aux_ptr->candidate_slist_ptr != NULL); - HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) > 0); - HDassert(num_entries_ptr != NULL); - HDassert(*num_entries_ptr == 0); - HDassert(haddr_buf_ptr_ptr != NULL); - HDassert(*haddr_buf_ptr_ptr == NULL); + assert(aux_ptr != NULL); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); + assert(aux_ptr->candidate_slist_ptr != NULL); + assert(H5SL_count(aux_ptr->candidate_slist_ptr) > 0); + assert(num_entries_ptr != NULL); + assert(*num_entries_ptr == 0); + assert(haddr_buf_ptr_ptr != NULL); + assert(*haddr_buf_ptr_ptr == NULL); num_entries = (unsigned)H5SL_count(aux_ptr->candidate_slist_ptr); @@ -629,7 +597,7 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entri */ buf_size = sizeof(haddr_t) * num_entries; if (NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer"); /* Set up user data for callback */ udata.aux_ptr = aux_ptr; @@ -638,7 +606,7 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entri /* Free all the candidate list entries, building the address list in the callback */ if (H5SL_free(aux_ptr->candidate_slist_ptr, H5AC__copy_candidate_list_to_buffer_cb, &udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "Can't build address list for candidate entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "Can't build address list for candidate entries"); /* Pass the number of entries and the buffer pointer * back to the caller. @@ -667,8 +635,6 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entri * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 6/29/05 - * *------------------------------------------------------------------------- */ herr_t @@ -682,16 +648,15 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(entry_ptr); + assert(entry_ptr); addr = entry_ptr->addr; cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->mpi_rank == 0); - HDassert(aux_ptr->d_slist_ptr != NULL); - HDassert(aux_ptr->c_slist_ptr != NULL); + assert(aux_ptr != NULL); + assert(aux_ptr->mpi_rank == 0); + assert(aux_ptr->d_slist_ptr != NULL); + assert(aux_ptr->c_slist_ptr != NULL); /* if the entry appears in the dirtied entry slist, remove it. */ if (NULL != (slist_entry_ptr = (H5AC_slist_entry_t *)H5SL_remove(aux_ptr->d_slist_ptr, (void *)(&addr)))) @@ -721,8 +686,6 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr) * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 6/29/05 - * *------------------------------------------------------------------------- */ herr_t @@ -735,35 +698,34 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(entry_ptr); - HDassert(entry_ptr->is_dirty == FALSE); + assert(entry_ptr); + assert(entry_ptr->is_dirty == FALSE); cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); + assert(aux_ptr != NULL); if (aux_ptr->mpi_rank == 0) { H5AC_slist_entry_t *slist_entry_ptr; haddr_t addr = entry_ptr->addr; /* Sanity checks */ - HDassert(aux_ptr->d_slist_ptr != NULL); - HDassert(aux_ptr->c_slist_ptr != NULL); + assert(aux_ptr->d_slist_ptr != NULL); + assert(aux_ptr->c_slist_ptr != NULL); if (NULL == H5SL_search(aux_ptr->d_slist_ptr, (void *)(&addr))) { /* insert the address of the entry in the dirty entry list, and * add its size to the dirty_bytes count. */ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry ."); slist_entry_ptr->addr = addr; if (H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist."); aux_ptr->dirty_bytes += entry_ptr->size; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->unprotect_dirty_bytes += entry_ptr->size; aux_ptr->unprotect_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -778,7 +740,7 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) } /* end if */ else { aux_ptr->dirty_bytes += entry_ptr->size; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->unprotect_dirty_bytes += entry_ptr->size; aux_ptr->unprotect_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -798,9 +760,6 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) * * Return: Non-negative on success/Negative on failure. * - * Programmer: Quincey Koziol - * 7/23/16 - * *------------------------------------------------------------------------- */ herr_t @@ -812,21 +771,20 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(entry_ptr); - HDassert(entry_ptr->is_dirty == FALSE); + assert(entry_ptr); + assert(entry_ptr->is_dirty == FALSE); cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); + assert(aux_ptr != NULL); if (aux_ptr->mpi_rank == 0) { H5AC_slist_entry_t *slist_entry_ptr; haddr_t addr = entry_ptr->addr; /* Sanity checks */ - HDassert(aux_ptr->d_slist_ptr != NULL); - HDassert(aux_ptr->c_slist_ptr != NULL); + assert(aux_ptr->d_slist_ptr != NULL); + assert(aux_ptr->c_slist_ptr != NULL); /* Remove it from both the cleaned list and the dirtied list. */ if (NULL != @@ -861,8 +819,6 @@ H5AC__log_cleaned_entry(const H5AC_info_t *entry_ptr) * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 6/29/05 - * *------------------------------------------------------------------------- */ herr_t @@ -876,12 +832,11 @@ H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, unsig FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->mpi_rank == 0); - HDassert(aux_ptr->c_slist_ptr != NULL); + assert(aux_ptr != NULL); + assert(aux_ptr->mpi_rank == 0); + assert(aux_ptr->c_slist_ptr != NULL); /* Set local flags */ cleared = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); @@ -901,11 +856,11 @@ H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, unsig if (NULL == H5SL_search(aux_ptr->c_slist_ptr, (void *)(&addr))) { /* insert the address of the entry in the clean entry list. */ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate clean slist entry .") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate clean slist entry ."); slist_entry_ptr->addr = addr; if (H5SL_insert(aux_ptr->c_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into clean entry slist.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into clean entry slist."); } /* end if */ } /* end else-if */ @@ -929,8 +884,6 @@ H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, unsig * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 6/30/05 - * *------------------------------------------------------------------------- */ herr_t @@ -943,40 +896,39 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(entry_ptr); + assert(entry_ptr); cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); + assert(aux_ptr != NULL); if (aux_ptr->mpi_rank == 0) { H5AC_slist_entry_t *slist_entry_ptr; - HDassert(aux_ptr->d_slist_ptr != NULL); - HDassert(aux_ptr->c_slist_ptr != NULL); + assert(aux_ptr->d_slist_ptr != NULL); + assert(aux_ptr->c_slist_ptr != NULL); /* Entry to insert should not be in dirty list currently */ if (NULL != H5SL_search(aux_ptr->d_slist_ptr, (const void *)(&entry_ptr->addr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Inserted entry already in dirty slist.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Inserted entry already in dirty slist."); /* insert the address of the entry in the dirty entry list, and * add its size to the dirty_bytes count. */ if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry ."); slist_entry_ptr->addr = entry_ptr->addr; if (H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist."); /* Entry to insert should not be in clean list either */ if (NULL != H5SL_search(aux_ptr->c_slist_ptr, (const void *)(&entry_ptr->addr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Inserted entry in clean slist.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Inserted entry in clean slist."); } /* end if */ aux_ptr->dirty_bytes += entry_ptr->size; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->insert_dirty_bytes += entry_ptr->size; aux_ptr->insert_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -1027,8 +979,6 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr) * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 6/30/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1044,26 +994,25 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = (H5AC_t *)f->shared->cache; - HDassert(cache_ptr); + assert(cache_ptr); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); + assert(aux_ptr != NULL); /* get entry status, size, etc here */ if (H5C_get_entry_status(f, old_addr, &entry_size, &entry_in_cache, &entry_dirty, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get entry status.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get entry status."); if (!entry_in_cache) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry not in cache.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry not in cache."); if (aux_ptr->mpi_rank == 0) { H5AC_slist_entry_t *slist_entry_ptr; - HDassert(aux_ptr->d_slist_ptr != NULL); - HDassert(aux_ptr->c_slist_ptr != NULL); + assert(aux_ptr->d_slist_ptr != NULL); + assert(aux_ptr->c_slist_ptr != NULL); /* if the entry appears in the cleaned entry slist, under its old * address, remove it. @@ -1086,14 +1035,14 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) * list under its old address implies that it must have * been clean to start with. */ - HDassert(!entry_dirty); + assert(!entry_dirty); if (NULL == (slist_entry_ptr = H5FL_MALLOC(H5AC_slist_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry .") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "Can't allocate dirty slist entry ."); slist_entry_ptr->addr = new_addr; aux_ptr->dirty_bytes += entry_size; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->move_dirty_bytes += entry_size; aux_ptr->move_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -1101,12 +1050,12 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) /* insert / reinsert the entry in the dirty slist */ if (H5SL_insert(aux_ptr->d_slist_ptr, slist_entry_ptr, &(slist_entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert entry into dirty entry slist."); } /* end if */ else if (!entry_dirty) { aux_ptr->dirty_bytes += entry_size; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->move_dirty_bytes += entry_size; aux_ptr->move_dirty_bytes_updates += 1; #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ @@ -1206,9 +1155,6 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) * * Failure: negative * - * Programmer: John Mainzer - * 3/17/10 - * *------------------------------------------------------------------------- */ static herr_t @@ -1224,13 +1170,12 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f != NULL); + assert(f != NULL); cache_ptr = f->shared->cache; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); + assert(aux_ptr != NULL); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); /* to prevent "messages from the future" we must synchronize all * processes before we write any entries. @@ -1240,13 +1185,13 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) if (aux_ptr->mpi_rank == 0) { if (H5AC__broadcast_candidate_list(cache_ptr, &num_candidates, &candidates_list_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast candidate slist.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast candidate slist."); - HDassert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); + assert(H5SL_count(aux_ptr->candidate_slist_ptr) == 0); } /* end if */ else { if (H5AC__receive_candidate_list(cache_ptr, &num_candidates, &candidates_list_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive candidate broadcast.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive candidate broadcast."); } /* end else */ if (num_candidates > 0) { @@ -1269,7 +1214,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) /* Check for error on the write operation */ if (result < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't apply candidate list.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't apply candidate list."); /* this code exists primarily for the test bed -- it allows us to * enforce posix semantics on the server that pretends to be a @@ -1289,7 +1234,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) */ if (aux_ptr->mpi_rank == 0) if (H5AC__tidy_cache_0_lists(cache_ptr, num_candidates, candidates_list_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't tidy up process 0 lists.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't tidy up process 0 lists."); } /* end if */ /* if it is defined, call the sync point done callback. Note @@ -1372,9 +1317,6 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f) * * Failure: negative * - * Programmer: John Mainzer - * July 5, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -1387,21 +1329,20 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f != NULL); + assert(f != NULL); cache_ptr = f->shared->cache; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); + assert(aux_ptr != NULL); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); if (aux_ptr->mpi_rank == 0) { if (H5AC__broadcast_clean_list(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast clean slist.") - HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast clean slist."); + assert(H5SL_count(aux_ptr->c_slist_ptr) == 0); } /* end if */ else if (H5AC__receive_and_apply_clean_list(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive and/or process clean slist broadcast.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive and/or process clean slist broadcast."); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1423,8 +1364,6 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f) * * Return: Non-negative on success/Negative on failure. * - * Programmer: Quincey Koziol, 6/11/2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1438,10 +1377,10 @@ H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, haddr_t * FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(num_entries_ptr != NULL); - HDassert(*num_entries_ptr == 0); - HDassert(haddr_buf_ptr_ptr != NULL); - HDassert(*haddr_buf_ptr_ptr == NULL); + assert(num_entries_ptr != NULL); + assert(*num_entries_ptr == 0); + assert(haddr_buf_ptr_ptr != NULL); + assert(*haddr_buf_ptr_ptr == NULL); /* First receive the number of entries in the list so that we * can set up a buffer to receive them. If there aren't @@ -1457,7 +1396,7 @@ H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, haddr_t * buf_size = sizeof(haddr_t) * num_entries; if (NULL == (haddr_buf_ptr = (haddr_t *)H5MM_malloc(buf_size))) { /* Push an error, but still participate in following MPI_Bcast */ - HDONE_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer") + HDONE_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for haddr buffer"); } /* Now receive the list of candidate entries */ @@ -1494,8 +1433,6 @@ H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, haddr_t * * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 7/4/05 - * *------------------------------------------------------------------------- */ static herr_t @@ -1510,22 +1447,21 @@ H5AC__receive_and_apply_clean_list(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f != NULL); + assert(f != NULL); cache_ptr = f->shared->cache; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->mpi_rank != 0); + assert(aux_ptr != NULL); + assert(aux_ptr->mpi_rank != 0); /* Retrieve the clean list from process 0 */ if (H5AC__receive_haddr_list(aux_ptr->mpi_comm, &num_entries, &haddr_buf_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list"); if (num_entries > 0) /* Mark the indicated entries as clean */ if (H5C_mark_entries_as_clean(f, num_entries, haddr_buf_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't mark entries clean.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't mark entries clean."); /* if it is defined, call the sync point done callback. Note * that this callback is defined purely for testing purposes, @@ -1557,8 +1493,6 @@ H5AC__receive_and_apply_clean_list(H5F_t *f) * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 3/17/10 - * *------------------------------------------------------------------------- */ static herr_t @@ -1570,20 +1504,19 @@ H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->mpi_rank != 0); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); - HDassert(num_entries_ptr != NULL); - HDassert(*num_entries_ptr == 0); - HDassert(haddr_buf_ptr_ptr != NULL); - HDassert(*haddr_buf_ptr_ptr == NULL); + assert(aux_ptr != NULL); + assert(aux_ptr->mpi_rank != 0); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); + assert(num_entries_ptr != NULL); + assert(*num_entries_ptr == 0); + assert(haddr_buf_ptr_ptr != NULL); + assert(*haddr_buf_ptr_ptr == NULL); /* Retrieve the candidate list from process 0 */ if (H5AC__receive_haddr_list(aux_ptr->mpi_comm, num_entries_ptr, haddr_buf_ptr_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't receive clean list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1633,9 +1566,6 @@ H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, * * Failure: negative * - * Programmer: John Mainzer - * April 28, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1651,19 +1581,18 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f != NULL); + assert(f != NULL); cache_ptr = f->shared->cache; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); + assert(aux_ptr != NULL); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); /* first construct the candidate list -- initially, this will be in the * form of a skip list. We will convert it later. */ if (H5C_construct_candidate_list__clean_cache(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list."); if (H5SL_count(aux_ptr->candidate_slist_ptr) > 0) { herr_t result; @@ -1672,7 +1601,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) * are used to receiving from process 0. */ if (H5AC__copy_candidate_list_to_buffer(cache_ptr, &num_entries, &haddr_buf_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate buffer.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate buffer."); /* Initial sync point barrier * @@ -1695,7 +1624,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) /* Check for error on the write operation */ if (result < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't apply candidate list.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't apply candidate list."); /* this code exists primarily for the test bed -- it allows us to * enforce posix semantics on the server that pretends to be a @@ -1713,7 +1642,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) */ if (aux_ptr->mpi_rank == 0) if (H5AC__tidy_cache_0_lists(cache_ptr, num_entries, haddr_buf_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't tidy up process 0 lists.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't tidy up process 0 lists."); } /* end if */ /* if it is defined, call the sync point done callback. Note @@ -1779,9 +1708,6 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f) * * Failure: negative * - * Programmer: John Mainzer - * April 28, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1795,17 +1721,16 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f != NULL); + assert(f != NULL); cache_ptr = f->shared->cache; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); + assert(aux_ptr != NULL); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); /* Query if evictions are allowed */ if (H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed."); if (evictions_enabled) { /* construct candidate list -- process 0 only */ @@ -1815,12 +1740,12 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f) */ if (H5AC__construct_candidate_list(cache_ptr, aux_ptr, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list.") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list."); } /* propagate and apply candidate list -- all processes */ if (H5AC__propagate_and_apply_candidate_list(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate and apply candidate list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate and apply candidate list."); } /* evictions enabled */ done: @@ -1858,11 +1783,6 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f) * * Failure: negative * - * Programmer: John Mainzer - * April 28, 2010 - * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t @@ -1876,13 +1796,12 @@ H5AC__rsp__p0_only__flush(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f != NULL); + assert(f != NULL); cache_ptr = f->shared->cache; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); + assert(aux_ptr != NULL); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); /* To prevent "messages from the future" we must * synchronize all processes before we start the flush. @@ -1891,12 +1810,9 @@ H5AC__rsp__p0_only__flush(H5F_t *f) * However, when flushing from within the close operation from a file, * it's possible to skip this barrier (on the second flush of the cache). */ - if (!H5CX_get_mpi_file_flushing()) { - + if (!H5CX_get_mpi_file_flushing()) if (MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) - } /* Flush data to disk, from rank 0 process */ if (aux_ptr->mpi_rank == 0) { @@ -1917,7 +1833,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f) * in collective operations during following cache entry * propagation */ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush."); } else { /* this code exists primarily for the test bed -- it allows us to @@ -1931,7 +1847,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f) /* Propagate cleaned entries to other ranks. */ if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list."); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1974,9 +1890,6 @@ H5AC__rsp__p0_only__flush(H5F_t *f) * * Failure: negative * - * Programmer: John Mainzer - * April 28, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1990,17 +1903,16 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f != NULL); + assert(f != NULL); cache_ptr = f->shared->cache; - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); + assert(aux_ptr != NULL); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); /* Query if evictions are allowed */ if (H5C_get_evictions_enabled((const H5C_t *)cache_ptr, &evictions_enabled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_get_evictions_enabled() failed."); /* Flush if evictions are allowed -- following call * will cause process 0 to flush to min clean size, @@ -2043,7 +1955,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) * in collective operations during following cache entry * propagation */ - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_flush_to_min_clean() failed.") + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_flush_to_min_clean() failed."); } else { /* this call exists primarily for the test code -- it is used @@ -2056,7 +1968,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) } /* end if */ if (H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list."); } /* end if */ done: @@ -2089,9 +2001,6 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) * * Failure: negative * - * Programmer: John Mainzer - * March 11, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -2104,34 +2013,30 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f != NULL); - + assert(f != NULL); cache_ptr = f->shared->cache; - - HDassert(cache_ptr != NULL); - + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || - (sync_point_op == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED)); - -#if H5AC_DEBUG_DIRTY_BYTES_CREATION - HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/m/mu) = %zu/%u/%zu/%u/%zu/%u\n", aux_ptr->mpi_rank, - aux_ptr->dirty_bytes_propagations, aux_ptr->unprotect_dirty_bytes, - aux_ptr->unprotect_dirty_bytes_updates, aux_ptr->insert_dirty_bytes, - aux_ptr->insert_dirty_bytes_updates, aux_ptr->move_dirty_bytes, - aux_ptr->move_dirty_bytes_updates); + assert(aux_ptr != NULL); + assert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || + (sync_point_op == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED)); + +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION + fprintf(stdout, "%d:%s...:%u: (u/uu/i/iu/m/mu) = %zu/%u/%zu/%u/%zu/%u\n", aux_ptr->mpi_rank, + __func__ aux_ptr->dirty_bytes_propagations, aux_ptr->unprotect_dirty_bytes, + aux_ptr->unprotect_dirty_bytes_updates, aux_ptr->insert_dirty_bytes, + aux_ptr->insert_dirty_bytes_updates, aux_ptr->move_dirty_bytes, + aux_ptr->move_dirty_bytes_updates); #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ - /* clear collective access flag on half of the entries in the - cache and mark them as independent in case they need to be - evicted later. All ranks are guaranteed to mark the same entries - since we don't modify the order of the collectively accessed - entries except through collective access. */ + /* Clear collective access flag on half of the entries in the cache and + * mark them as independent in case they need to be evicted later. All + * ranks are guaranteed to mark the same entries since we don't modify the + * order of the collectively accessed entries except through collective + * access. + */ if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed."); switch (aux_ptr->metadata_write_strategy) { case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: @@ -2139,12 +2044,12 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN: if (H5AC__rsp__p0_only__flush_to_min_clean(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, - "H5AC__rsp__p0_only__flush_to_min_clean() failed.") + "H5AC__rsp__p0_only__flush_to_min_clean() failed."); break; case H5AC_SYNC_POINT_OP__FLUSH_CACHE: if (H5AC__rsp__p0_only__flush(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__p0_only__flush() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__p0_only__flush() failed."); break; default: @@ -2158,12 +2063,13 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN: if (H5AC__rsp__dist_md_write__flush_to_min_clean(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, - "H5AC__rsp__dist_md_write__flush_to_min_clean() failed.") + "H5AC__rsp__dist_md_write__flush_to_min_clean() failed."); break; case H5AC_SYNC_POINT_OP__FLUSH_CACHE: if (H5AC__rsp__dist_md_write__flush(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__dist_md_write__flush() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, + "H5AC__rsp__dist_md_write__flush() failed."); break; default: @@ -2173,14 +2079,14 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) break; default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown metadata write strategy.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown metadata write strategy."); break; } /* end switch */ /* reset the dirty bytes count */ aux_ptr->dirty_bytes = 0; -#if H5AC_DEBUG_DIRTY_BYTES_CREATION +#ifdef H5AC_DEBUG_DIRTY_BYTES_CREATION aux_ptr->dirty_bytes_propagations += 1; aux_ptr->unprotect_dirty_bytes = 0; aux_ptr->unprotect_dirty_bytes_updates = 0; @@ -2191,7 +2097,6 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ done: - FUNC_LEAVE_NOAPI(ret_value) } /* H5AC__run_sync_point() */ @@ -2225,9 +2130,6 @@ H5AC__run_sync_point(H5F_t *f, int sync_point_op) * * Failure: negative * - * Programmer: John Mainzer - * 4/20/10 - * *------------------------------------------------------------------------- */ static herr_t @@ -2239,14 +2141,13 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, haddr_t *ca FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(cache_ptr != NULL); + assert(cache_ptr != NULL); aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); - HDassert(aux_ptr != NULL); - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); - HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); - HDassert(aux_ptr->mpi_rank == 0); - HDassert(num_candidates > 0); - HDassert(candidates_list_ptr != NULL); + assert(aux_ptr != NULL); + assert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); + assert(aux_ptr->mpi_rank == 0); + assert(num_candidates > 0); + assert(candidates_list_ptr != NULL); /* clean up dirtied and flushed and still clean lists by removing * all entries on the candidate list. Cleared entries should @@ -2286,9 +2187,6 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, haddr_t *ca * Return: Non-negative on success/Negative on failure if there was a * request to flush all items and something was protected. * - * Programmer: Quincey Koziol - * Aug 22 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -2299,13 +2197,13 @@ H5AC__flush_entries(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared->cache); + assert(f); + assert(f->shared->cache); /* Check if we have >1 ranks */ if (H5C_get_aux_ptr(f->shared->cache)) if (H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_CACHE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point."); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5ACproxy_entry.c b/externals/coda-oss/modules/drivers/hdf5/source/H5ACproxy_entry.c index 765a163372..1a968d69e8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5ACproxy_entry.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5ACproxy_entry.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -98,9 +97,6 @@ H5FL_DEFINE_STATIC(H5AC_proxy_entry_t); * Return: Success: Pointer to the new proxy entry object. * Failure: NULL * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ H5AC_proxy_entry_t * @@ -113,7 +109,7 @@ H5AC_proxy_entry_create(void) /* Allocate new proxy entry */ if (NULL == (pentry = H5FL_CALLOC(H5AC_proxy_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "can't allocate proxy entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "can't allocate proxy entry"); /* Set non-zero fields */ pentry->addr = HADDR_UNDEF; @@ -137,9 +133,6 @@ H5AC_proxy_entry_create(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -151,26 +144,26 @@ H5AC_proxy_entry_add_parent(H5AC_proxy_entry_t *pentry, void *_parent) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(parent); - HDassert(pentry); + assert(parent); + assert(pentry); /* Add parent to the list of parents */ if (NULL == pentry->parents) if (NULL == (pentry->parents = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, - "unable to create skip list for parents of proxy entry") + "unable to create skip list for parents of proxy entry"); /* Insert parent address into skip list */ if (H5SL_insert(pentry->parents, parent, &parent->addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert parent into proxy's skip list") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert parent into proxy's skip list"); /* Add flush dependency on parent */ if (pentry->nchildren > 0) { /* Sanity check */ - HDassert(H5F_addr_defined(pentry->addr)); + assert(H5_addr_defined(pentry->addr)); if (H5AC_create_flush_dependency(parent, pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "unable to set flush dependency on proxy entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "unable to set flush dependency on proxy entry"); } /* end if */ done: @@ -184,9 +177,6 @@ H5AC_proxy_entry_add_parent(H5AC_proxy_entry_t *pentry, void *_parent) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -199,30 +189,31 @@ H5AC_proxy_entry_remove_parent(H5AC_proxy_entry_t *pentry, void *_parent) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(pentry); - HDassert(pentry->parents); - HDassert(parent); + assert(pentry); + assert(pentry->parents); + assert(parent); /* Remove parent from skip list */ if (NULL == (rem_parent = (H5AC_info_t *)H5SL_remove(pentry->parents, &parent->addr))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "unable to remove proxy entry parent from skip list") - if (!H5F_addr_eq(rem_parent->addr, parent->addr)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "removed proxy entry parent not the same as real parent") + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "unable to remove proxy entry parent from skip list"); + if (!H5_addr_eq(rem_parent->addr, parent->addr)) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "removed proxy entry parent not the same as real parent"); /* Shut down the skip list, if this is the last parent */ if (0 == H5SL_count(pentry->parents)) { /* Sanity check */ - HDassert(0 == pentry->nchildren); + assert(0 == pentry->nchildren); if (H5SL_close(pentry->parents) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CLOSEERROR, FAIL, "can't close proxy parent skip list") + HGOTO_ERROR(H5E_CACHE, H5E_CLOSEERROR, FAIL, "can't close proxy parent skip list"); pentry->parents = NULL; } /* end if */ /* Remove flush dependency between the proxy entry and a parent */ if (pentry->nchildren > 0) if (H5AC_destroy_flush_dependency(parent, pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on proxy entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, + "unable to remove flush dependency on proxy entry"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -237,9 +228,6 @@ H5AC_proxy_entry_remove_parent(H5AC_proxy_entry_t *pentry, void *_parent) * Return: Success: Non-negative on success * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, September 22, 2016 - * *------------------------------------------------------------------------- */ static int @@ -254,7 +242,7 @@ H5AC__proxy_entry_add_child_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_ud /* Add flush dependency on parent for proxy entry */ if (H5AC_create_flush_dependency(parent, pentry) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, H5_ITER_ERROR, - "unable to set flush dependency for virtual entry") + "unable to set flush dependency for virtual entry"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -267,9 +255,6 @@ H5AC__proxy_entry_add_child_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_ud * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -280,39 +265,39 @@ H5AC_proxy_entry_add_child(H5AC_proxy_entry_t *pentry, H5F_t *f, void *child) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(pentry); - HDassert(child); + assert(pentry); + assert(child); /* Check for first child */ if (0 == pentry->nchildren) { /* Get an address, if the proxy doesn't already have one */ - if (!H5F_addr_defined(pentry->addr)) + if (!H5_addr_defined(pentry->addr)) if (HADDR_UNDEF == (pentry->addr = H5MF_alloc_tmp(f, 1))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "temporary file space allocation failed for proxy entry") + "temporary file space allocation failed for proxy entry"); /* Insert the proxy entry into the cache */ if (H5AC_insert_entry(f, H5AC_PROXY_ENTRY, pentry->addr, pentry, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to cache proxy entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to cache proxy entry"); /* Proxies start out clean (insertions are automatically marked dirty) */ if (H5AC_mark_entry_clean(pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCLEAN, FAIL, "can't mark proxy entry clean") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCLEAN, FAIL, "can't mark proxy entry clean"); /* Proxies start out serialized (insertions are automatically marked unserialized) */ if (H5AC_mark_entry_serialized(pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "can't mark proxy entry clean") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "can't mark proxy entry clean"); /* If there are currently parents, iterate over the list of parents, creating flush dependency on them */ if (pentry->parents) if (H5SL_iterate(pentry->parents, H5AC__proxy_entry_add_child_cb, pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "can't visit parents") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "can't visit parents"); } /* end if */ /* Add flush dependency on proxy entry */ if (H5AC_create_flush_dependency(pentry, child) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "unable to set flush dependency on proxy entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "unable to set flush dependency on proxy entry"); /* Increment count of children */ pentry->nchildren++; @@ -330,9 +315,6 @@ H5AC_proxy_entry_add_child(H5AC_proxy_entry_t *pentry, H5F_t *f, void *child) * Return: Success: Non-negative on success * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, September 22, 2016 - * *------------------------------------------------------------------------- */ static int @@ -347,7 +329,7 @@ H5AC__proxy_entry_remove_child_cb(void *_item, void H5_ATTR_UNUSED *_key, void * /* Remove flush dependency on parent for proxy entry */ if (H5AC_destroy_flush_dependency(parent, pentry) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, H5_ITER_ERROR, - "unable to remove flush dependency for proxy entry") + "unable to remove flush dependency for proxy entry"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -360,9 +342,6 @@ H5AC__proxy_entry_remove_child_cb(void *_item, void H5_ATTR_UNUSED *_key, void * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -373,12 +352,12 @@ H5AC_proxy_entry_remove_child(H5AC_proxy_entry_t *pentry, void *child) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(pentry); - HDassert(child); + assert(pentry); + assert(child); /* Remove flush dependency on proxy entry */ if (H5AC_destroy_flush_dependency(pentry, child) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on proxy entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "unable to remove flush dependency on proxy entry"); /* Decrement count of children */ pentry->nchildren--; @@ -389,15 +368,15 @@ H5AC_proxy_entry_remove_child(H5AC_proxy_entry_t *pentry, void *child) if (pentry->parents) /* Iterate over the list of parents, removing flush dependency on them */ if (H5SL_iterate(pentry->parents, H5AC__proxy_entry_remove_child_cb, pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "can't visit parents") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "can't visit parents"); /* Unpin proxy */ if (H5AC_unpin_entry(pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin proxy entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin proxy entry"); /* Remove proxy entry from cache */ if (H5AC_remove_entry(pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "unable to remove proxy entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "unable to remove proxy entry"); } /* end if */ done: @@ -411,9 +390,6 @@ H5AC_proxy_entry_remove_child(H5AC_proxy_entry_t *pentry, void *child) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -424,11 +400,11 @@ H5AC_proxy_entry_dest(H5AC_proxy_entry_t *pentry) FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(pentry); - HDassert(NULL == pentry->parents); - HDassert(0 == pentry->nchildren); - HDassert(0 == pentry->ndirty_children); - HDassert(0 == pentry->nunser_children); + assert(pentry); + assert(NULL == pentry->parents); + assert(0 == pentry->nchildren); + assert(0 == pentry->ndirty_children); + assert(0 == pentry->nunser_children); /* Free the proxy entry object */ pentry = H5FL_FREE(H5AC_proxy_entry_t, pentry); @@ -443,9 +419,6 @@ H5AC_proxy_entry_dest(H5AC_proxy_entry_t *pentry) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -454,7 +427,7 @@ H5AC__proxy_entry_image_len(const void H5_ATTR_UNUSED *thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image_len); + assert(image_len); /* Set the image length size to 1 byte */ *image_len = 1; @@ -471,9 +444,6 @@ H5AC__proxy_entry_image_len(const void H5_ATTR_UNUSED *thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -483,7 +453,7 @@ H5AC__proxy_entry_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED * FUNC_ENTER_PACKAGE_NOERR /* Yes, even though this pushes an error on the stack */ /* Should never be invoked */ - HDassert(0 && "Invalid callback?!?"); + assert(0 && "Invalid callback?!?"); HERROR(H5E_CACHE, H5E_CANTSERIALIZE, "called unreachable fcn."); @@ -497,9 +467,6 @@ H5AC__proxy_entry_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUSED * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -511,7 +478,7 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(pentry); + assert(pentry); switch (action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: @@ -519,38 +486,38 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_AFTER_LOAD: #ifdef NDEBUG - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid notify action from metadata cache") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid notify action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Invalid action?!?"); + assert(0 && "Invalid action?!?"); #endif /* NDEBUG */ break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: #ifdef NDEBUG - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid notify action from metadata cache") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid notify action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Invalid action?!?"); + assert(0 && "Invalid action?!?"); #endif /* NDEBUG */ break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Sanity checks */ - HDassert(0 == pentry->ndirty_children); - HDassert(0 == pentry->nunser_children); + assert(0 == pentry->ndirty_children); + assert(0 == pentry->nunser_children); /* No action */ break; case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: /* Sanity checks */ - HDassert(pentry->ndirty_children > 0); + assert(pentry->ndirty_children > 0); /* No action */ break; case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: /* Sanity checks */ - HDassert(0 == pentry->ndirty_children); + assert(0 == pentry->ndirty_children); /* No action */ break; @@ -562,12 +529,12 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing) /* Check for first dirty child */ if (1 == pentry->ndirty_children) if (H5AC_mark_entry_dirty(pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDIRTY, FAIL, "can't mark proxy entry dirty") + HGOTO_ERROR(H5E_CACHE, H5E_CANTDIRTY, FAIL, "can't mark proxy entry dirty"); break; case H5AC_NOTIFY_ACTION_CHILD_CLEANED: /* Sanity check */ - HDassert(pentry->ndirty_children > 0); + assert(pentry->ndirty_children > 0); /* Decrement # of dirty children */ pentry->ndirty_children--; @@ -575,7 +542,7 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing) /* Check for last dirty child */ if (0 == pentry->ndirty_children) if (H5AC_mark_entry_clean(pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCLEAN, FAIL, "can't mark proxy entry clean") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCLEAN, FAIL, "can't mark proxy entry clean"); break; case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: @@ -585,12 +552,12 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing) /* Check for first unserialized child */ if (1 == pentry->nunser_children) if (H5AC_mark_entry_unserialized(pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNSERIALIZE, FAIL, "can't mark proxy entry unserialized") + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNSERIALIZE, FAIL, "can't mark proxy entry unserialized"); break; case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: /* Sanity check */ - HDassert(pentry->nunser_children > 0); + assert(pentry->nunser_children > 0); /* Decrement # of unserialized children */ pentry->nunser_children--; @@ -598,14 +565,14 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing) /* Check for last unserialized child */ if (0 == pentry->nunser_children) if (H5AC_mark_entry_serialized(pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "can't mark proxy entry serialized") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "can't mark proxy entry serialized"); break; default: #ifdef NDEBUG - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown notify action from metadata cache") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown notify action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ @@ -621,9 +588,6 @@ H5AC__proxy_entry_notify(H5AC_notify_action_t action, void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 17, 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -636,7 +600,7 @@ H5AC__proxy_entry_free_icr(void *_thing) /* Destroy the proxy entry */ if (H5AC_proxy_entry_dest(pentry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to destroy proxy entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to destroy proxy entry"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5AbstractDs.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5AbstractDs.cpp deleted file mode 100644 index 70d8531653..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5AbstractDs.cpp +++ /dev/null @@ -1,340 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5FaccProp.h" -#include "H5FcreatProp.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5DxferProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataSpace.h" -#include "H5AbstractDs.h" -#include "H5Alltypes.h" - -namespace H5 { - -//-------------------------------------------------------------------------- -// Function: AbstractDs default constructor -///\brief Default constructor -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -AbstractDs::AbstractDs() -{ -} - -//-------------------------------------------------------------------------- -// Function: AbstractDs default constructor -///\brief Creates an AbstractDs instance using an existing id. -// Programmer Binh-Minh Ribler - 2000 -// -// *** Deprecation warning *** -// This constructor is no longer appropriate because the data member "id" had -// been moved to the sub-classes. It will be removed in 1.10 release. If its -// removal does not raise any problems in 1.10, it will be removed from 1.8 in -// subsequent releases. -//-------------------------------------------------------------------------- -// Mar 2016 -BMR, AbstractDs::AbstractDs(const hid_t ds_id){} - -//-------------------------------------------------------------------------- -// Function: AbstractDs::getTypeClass -///\brief Returns the class of the datatype that is used by this -/// object, which can be a dataset or an attribute. -///\return Datatype class identifier -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5T_class_t -AbstractDs::getTypeClass() const -{ - // Gets the datatype used by this dataset or attribute. - // p_get_type calls either H5Dget_type or H5Aget_type depending on - // which object invokes getTypeClass - hid_t datatype_id; - try { - datatype_id = p_get_type(); // returned value is already validated - } - catch (DataSetIException &E) { - throw DataTypeIException("DataSet::getTypeClass", E.getDetailMsg()); - } - catch (AttributeIException &E) { - throw DataTypeIException("Attribute::getTypeClass", E.getDetailMsg()); - } - - // Gets the class of the datatype and validate it before returning - H5T_class_t type_class = H5Tget_class(datatype_id); - - // Close temporary datatype_id - herr_t ret_value = H5Tclose(datatype_id); - if (ret_value < 0) { - if (fromClass() == "DataSet") - throw DataTypeIException("DataSet::getTypeClass", "H5Tclose failed"); - else if (fromClass() == "Attribute") - throw DataTypeIException("Attribute::getTypeClass", "H5Tclose failed"); - } - - // Check on the returned type_class - if (type_class == H5T_NO_CLASS) { - if (fromClass() == "DataSet") - throw DataTypeIException("DataSet::getTypeClass", "H5Tget_class returns H5T_NO_CLASS"); - else if (fromClass() == "Attribute") - throw DataTypeIException("Attribute::getTypeClass", "H5Tget_class returns H5T_NO_CLASS"); - } - return (type_class); -} - -//-------------------------------------------------------------------------- -// Function: AbstractDs::getDataType -///\brief Returns the generic datatype of this abstract dataset, which -/// can be a dataset or an attribute. -///\return DataType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataType -AbstractDs::getDataType() const -{ - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getDataType. Then, create and - // return the DataType object - try { - DataType datatype; - f_DataType_setId(&datatype, p_get_type()); - return (datatype); - } - catch (DataSetIException &E) { - throw DataTypeIException("DataSet::getDataType", E.getDetailMsg()); - } - catch (AttributeIException &E) { - throw DataTypeIException("Attribute::getDataType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: AbstractDs::getArrayType -///\brief Returns the array datatype of this abstract dataset which -/// can be a dataset or an attribute. -///\return ArrayType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -ArrayType -AbstractDs::getArrayType() const -{ - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getArrayType. Then, create and - // return the ArrayType object - try { - // Create ArrayType and set values this way to work around the - // problem described in the JIRA issue HDFFV-7947 - ArrayType arraytype; - f_DataType_setId(&arraytype, p_get_type()); - return (arraytype); - } - catch (DataSetIException &E) { - throw DataTypeIException("DataSet::getArrayType", E.getDetailMsg()); - } - catch (AttributeIException &E) { - throw DataTypeIException("Attribute::getArrayType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: AbstractDs::getCompType -///\brief Returns the compound datatype of this abstract dataset which -/// can be a dataset or an attribute. -///\return CompType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CompType -AbstractDs::getCompType() const -{ - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getCompType. Then, create and - // return the CompType object - try { - CompType comptype; - f_DataType_setId(&comptype, p_get_type()); - return (comptype); - } - catch (DataSetIException &E) { - throw DataTypeIException("DataSet::getCompType", E.getDetailMsg()); - } - catch (AttributeIException &E) { - throw DataTypeIException("Attribute::getCompType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: AbstractDs::getEnumType -///\brief Returns the enumeration datatype of this abstract dataset which -/// can be a dataset or an attribute. -///\return EnumType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType -AbstractDs::getEnumType() const -{ - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getEnumType. Then, create and - // return the EnumType object - try { - EnumType enumtype; - f_DataType_setId(&enumtype, p_get_type()); - return (enumtype); - } - catch (DataSetIException &E) { - throw DataTypeIException("DataSet::getEnumType", E.getDetailMsg()); - } - catch (AttributeIException &E) { - throw DataTypeIException("Attribute::getEnumType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: AbstractDs::getIntType -///\brief Returns the integer datatype of this abstract dataset which -/// can be a dataset or an attribute. -///\return IntType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IntType -AbstractDs::getIntType() const -{ - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getIntType. Then, create and - // return the IntType object - try { - IntType inttype; - f_DataType_setId(&inttype, p_get_type()); - return (inttype); - } - catch (DataSetIException &E) { - throw DataTypeIException("DataSet::getIntType", E.getDetailMsg()); - } - catch (AttributeIException &E) { - throw DataTypeIException("Attribute::getIntType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: AbstractDs::getFloatType -///\brief Returns the floating-point datatype of this abstract dataset, -/// which can be a dataset or an attribute. -///\return FloatType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FloatType -AbstractDs::getFloatType() const -{ - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getFloatType. Then, create and - // return the FloatType object - try { - FloatType floatype; - f_DataType_setId(&floatype, p_get_type()); - return (floatype); - } - catch (DataSetIException &E) { - throw DataTypeIException("DataSet::getFloatType", E.getDetailMsg()); - } - catch (AttributeIException &E) { - throw DataTypeIException("Attribute::getFloatType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: AbstractDs::getStrType -///\brief Returns the string datatype of this abstract dataset which -/// can be a dataset or an attribute. -///\return StrType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -StrType -AbstractDs::getStrType() const -{ - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getStrType. Then, create and - // return the StrType object - try { - StrType strtype; - f_DataType_setId(&strtype, p_get_type()); - return (strtype); - } - catch (DataSetIException &E) { - throw DataTypeIException("DataSet::getStrType", E.getDetailMsg()); - } - catch (AttributeIException &E) { - throw DataTypeIException("Attribute::getStrType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: AbstractDs::getVarLenType -///\brief Returns the variable length datatype of this abstract dataset, -/// which can be a dataset or an attribute. -///\return VarLenType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -VarLenType -AbstractDs::getVarLenType() const -{ - // Gets the id of the datatype used by this dataset or attribute using - // p_get_type. p_get_type calls either H5Dget_type or H5Aget_type - // depending on which object invokes getVarLenType. Then, create and - // return the VarLenType object - try { - VarLenType varlentype; - f_DataType_setId(&varlentype, p_get_type()); - return (varlentype); - } - catch (DataSetIException &E) { - throw DataTypeIException("DataSet::getVarLenType", E.getDetailMsg()); - } - catch (AttributeIException &E) { - throw DataTypeIException("Attribute::getVarLenType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: AbstractDs destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -AbstractDs::~AbstractDs() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Abtree2.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Abtree2.c index c8a5ad206d..a25cd34ff7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Abtree2.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Abtree2.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Abtree2.c - * Dec 4 2006 - * Quincey Koziol * * Purpose: v2 B-tree callbacks for indexing attributes on objects * @@ -139,9 +136,6 @@ const H5B2_class_t H5A_BT2_CORDER[1] = {{ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 4 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -157,7 +151,7 @@ H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) /* Decode attribute information */ if (NULL == (attr = (H5A_t *)H5O_msg_decode(udata->f, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode attribute") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode attribute"); /* Compare the string values */ udata->cmp = HDstrcmp(udata->name, attr->shared->name); @@ -173,7 +167,7 @@ H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) /* Make callback */ if ((udata->found_op)(attr, &took_ownership, udata->found_op_data) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPERATE, FAIL, "attribute found callback failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPERATE, FAIL, "attribute found callback failed"); } /* end if */ done: @@ -192,9 +186,6 @@ H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, December 4, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -223,9 +214,6 @@ H5A__dense_btree2_name_store(void *_nrecord, const void *_udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Quincey Koziol - * Monday, December 4, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -238,8 +226,8 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(bt2_udata); - HDassert(bt2_rec); + assert(bt2_udata); + assert(bt2_rec); /* Check hash value */ if (bt2_udata->name_hash < bt2_rec->hash) @@ -251,7 +239,7 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int H5HF_t *fheap; /* Fractal heap handle to use for finding object */ /* Sanity check */ - HDassert(bt2_udata->name_hash == bt2_rec->hash); + assert(bt2_udata->name_hash == bt2_rec->hash); /* Prepare user data for callback */ /* down */ @@ -269,11 +257,11 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int fheap = bt2_udata->shared_fheap; else fheap = bt2_udata->fheap; - HDassert(fheap); + assert(fheap); /* Check if the user's attribute and the B-tree's attribute have the same name */ if (H5HF_op(fheap, &bt2_rec->id, H5A__dense_fh_name_cmp, &fh_udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); /* Callback will set comparison value */ *result = fh_udata.cmp; @@ -291,9 +279,6 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, December 4, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -307,8 +292,8 @@ H5A__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_U H5MM_memcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN); raw += H5O_FHEAP_ID_LEN; *raw++ = nrecord->flags; - UINT32ENCODE(raw, nrecord->corder) - UINT32ENCODE(raw, nrecord->hash) + UINT32ENCODE(raw, nrecord->corder); + UINT32ENCODE(raw, nrecord->hash); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_name_encode() */ @@ -321,9 +306,6 @@ H5A__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_U * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, December 4, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -337,8 +319,8 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U H5MM_memcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN); raw += H5O_FHEAP_ID_LEN; nrecord->flags = *raw++; - UINT32DECODE(raw, nrecord->corder) - UINT32DECODE(raw, nrecord->hash) + UINT32DECODE(raw, nrecord->corder); + UINT32DECODE(raw, nrecord->hash); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_name_decode() */ @@ -351,9 +333,6 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, December 4, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -364,8 +343,8 @@ H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_ FUNC_ENTER_PACKAGE_NOERR - HDfprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u, %08" PRIx32 "}\n", indent, "", fwidth, - "Record:", nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder, nrecord->hash); + fprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u, %08" PRIx32 "}\n", indent, "", fwidth, + "Record:", nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder, nrecord->hash); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_name_debug() */ @@ -378,9 +357,6 @@ H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_ * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, February 6, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -408,9 +384,6 @@ H5A__dense_btree2_corder_store(void *_nrecord, const void *_udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Quincey Koziol - * Tuesday, February 6, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -422,8 +395,8 @@ H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, i FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(bt2_udata); - HDassert(bt2_rec); + assert(bt2_udata); + assert(bt2_rec); /* Check creation order value */ if (bt2_udata->corder < bt2_rec->corder) @@ -444,9 +417,6 @@ H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, i * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, February 6, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -460,7 +430,7 @@ H5A__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR H5MM_memcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN); raw += H5O_FHEAP_ID_LEN; *raw++ = nrecord->flags; - UINT32ENCODE(raw, nrecord->corder) + UINT32ENCODE(raw, nrecord->corder); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_corder_encode() */ @@ -473,9 +443,6 @@ H5A__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, February 6, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -489,7 +456,7 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR H5MM_memcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN); raw += H5O_FHEAP_ID_LEN; nrecord->flags = *raw++; - UINT32DECODE(raw, nrecord->corder) + UINT32DECODE(raw, nrecord->corder); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_corder_decode() */ @@ -502,9 +469,6 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, February 6, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -515,8 +479,8 @@ H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void FUNC_ENTER_PACKAGE_NOERR - HDfprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u}\n", indent, "", fwidth, - "Record:", nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder); + fprintf(stream, "%*s%-*s {%016" PRIx64 ", %02" PRIx8 ", %u}\n", indent, "", fwidth, + "Record:", nrecord->id.val, nrecord->flags, (unsigned)nrecord->corder); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_corder_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Adense.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Adense.c index f0b64d18b8..d96fd75061 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Adense.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Adense.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Adense.c - * Dec 4 2006 - * Quincey Koziol * * Purpose: Routines for operating on "dense" attribute storage * for an object. @@ -160,9 +157,6 @@ typedef struct H5A_bt2_ud_rmbi_t { * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 4 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -178,12 +172,12 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(ainfo); + assert(f); + assert(ainfo); /* Set fractal heap creation parameters */ /* XXX: Give some control of these to applications? */ - HDmemset(&fheap_cparam, 0, sizeof(fheap_cparam)); + memset(&fheap_cparam, 0, sizeof(fheap_cparam)); fheap_cparam.managed.width = H5O_FHEAP_MAN_WIDTH; fheap_cparam.managed.start_block_size = H5O_FHEAP_MAN_START_BLOCK_SIZE; fheap_cparam.managed.max_direct_size = H5O_FHEAP_MAN_MAX_DIRECT_SIZE; @@ -194,11 +188,11 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo) /* Create fractal heap for storing attributes */ if (NULL == (fheap = H5HF_create(f, &fheap_cparam))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create fractal heap"); /* Retrieve the heap's address in the file */ if (H5HF_get_heap_addr(fheap, &ainfo->fheap_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address"); #ifndef NDEBUG { @@ -206,13 +200,13 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo) /* Retrieve the heap's ID length in the file */ if (H5HF_get_id_len(fheap, &fheap_id_len) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length") - HDassert(fheap_id_len == H5O_FHEAP_ID_LEN); + HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length"); + assert(fheap_id_len == H5O_FHEAP_ID_LEN); } #endif /* NDEBUG */ /* Create the name index v2 B-tree */ - HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); + memset(&bt2_cparam, 0, sizeof(bt2_cparam)); bt2_cparam.cls = H5A_BT2_NAME; bt2_cparam.node_size = (size_t)H5A_NAME_BT2_NODE_SIZE; bt2_cparam.rrec_size = 4 + /* Name's hash value */ @@ -222,16 +216,16 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo) bt2_cparam.split_percent = H5A_NAME_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5A_NAME_BT2_MERGE_PERC; if (NULL == (bt2_name = H5B2_create(f, &bt2_cparam, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index"); /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(bt2_name, &ainfo->name_bt2_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get v2 B-tree address for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get v2 B-tree address for name index"); /* Check if we should create a creation order index v2 B-tree */ if (ainfo->index_corder) { /* Create the creation order index v2 B-tree */ - HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); + memset(&bt2_cparam, 0, sizeof(bt2_cparam)); bt2_cparam.cls = H5A_BT2_CORDER; bt2_cparam.node_size = (size_t)H5A_CORDER_BT2_NODE_SIZE; bt2_cparam.rrec_size = 4 + /* Creation order index */ @@ -240,21 +234,21 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo) bt2_cparam.split_percent = H5A_CORDER_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5A_CORDER_BT2_MERGE_PERC; if (NULL == (bt2_corder = H5B2_create(f, &bt2_cparam, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index"); /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(bt2_corder, &ainfo->corder_bt2_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get v2 B-tree address for creation order index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get v2 B-tree address for creation order index"); } /* end if */ done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_create() */ @@ -266,9 +260,6 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -280,9 +271,9 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(attr); - HDassert(user_attr); - HDassert(took_ownership); + assert(attr); + assert(user_attr); + assert(took_ownership); /* * If there is an attribute already stored in "user_attr", @@ -305,7 +296,7 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) /* Free any dynamically allocated items */ if (old_attr->shared) if (H5A__shared_free(old_attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info"); old_attr = H5FL_FREE(H5A_t, old_attr); } /* end if */ @@ -325,9 +316,6 @@ H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11 2006 - * *------------------------------------------------------------------------- */ H5A_t * @@ -344,17 +332,17 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(ainfo); - HDassert(name); + assert(f); + assert(ainfo); + assert(name); /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open fractal heap"); /* Check if attributes are shared in this file */ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't determine if attributes are shared") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't determine if attributes are shared"); /* Get handle for shared message heap, if attributes are shareable */ if (attr_sharable) { @@ -362,19 +350,19 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) /* Retrieve the address of the shared message's fractal heap */ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared message heap address") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared message heap address"); /* Check if there are any shared messages currently */ - if (H5F_addr_defined(shared_fheap_addr)) { + if (H5_addr_defined(shared_fheap_addr)) { /* Open the fractal heap for shared header messages */ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open fractal heap"); } /* end if */ } /* end if */ /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open v2 B-tree for name index"); /* Create the "udata" information for v2 B-tree record find */ udata.f = f; @@ -390,18 +378,18 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) /* Find & copy the attribute in the 'name' index */ attr_exists = FALSE; if (H5B2_find(bt2_name, &udata, &attr_exists, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't search for attribute in name index") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't search for attribute in name index"); if (attr_exists == FALSE) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't locate attribute in name index") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't locate attribute in name index"); done: /* Release resources */ if (shared_fheap && H5HF_close(shared_fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close fractal heap"); if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, NULL, "can't close v2 B-tree for name index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_open() */ @@ -413,9 +401,6 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 4 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -435,13 +420,13 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(ainfo); - HDassert(attr); + assert(f); + assert(ainfo); + assert(attr); /* Check if attributes are shared in this file */ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared"); /* Get handle for shared message heap, if attributes are shareable */ if (attr_sharable) { @@ -450,39 +435,39 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) /* Check if message is already shared */ if ((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error determining if message is shared") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error determining if message is shared"); else if (shared_mesg > 0) /* Mark the message as shared */ mesg_flags |= H5O_MSG_FLAG_SHARED; else { /* Should this attribute be written as a SOHM? */ if (H5SM_try_share(f, NULL, 0, H5O_ATTR_ID, attr, &mesg_flags) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared"); /* Attributes can't be "unique be shareable" yet */ - HDassert(!(mesg_flags & H5O_MSG_FLAG_SHAREABLE)); + assert(!(mesg_flags & H5O_MSG_FLAG_SHAREABLE)); } /* end else */ /* Retrieve the address of the shared message's fractal heap */ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address"); /* Check if there are any shared messages currently */ - if (H5F_addr_defined(shared_fheap_addr)) { + if (H5_addr_defined(shared_fheap_addr)) { /* Open the fractal heap for shared header messages */ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); } /* end if */ } /* end if */ /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Check for inserting shared attribute */ if (mesg_flags & H5O_MSG_FLAG_SHARED) { /* Sanity check */ - HDassert(attr_sharable); + assert(attr_sharable); /* Use heap ID for shared message heap */ udata.id = attr->sh_loc.u.heap_id; @@ -493,29 +478,29 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) /* Find out the size of buffer needed for serialized message */ if ((attr_size = H5O_msg_raw_size(f, H5O_ATTR_ID, FALSE, attr)) == 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get message size") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get message size"); /* Wrap the local buffer for serialized attributes */ if (NULL == (wb = H5WB_wrap(attr_buf, sizeof(attr_buf)))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't wrap buffer") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't wrap buffer"); /* Get a pointer to a buffer that's large enough for attribute */ if (NULL == (attr_ptr = H5WB_actual(wb, attr_size))) - HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "can't get actual buffer") + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "can't get actual buffer"); /* Create serialized form of attribute or shared message */ if (H5O_msg_encode(f, H5O_ATTR_ID, FALSE, (unsigned char *)attr_ptr, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute"); /* Insert the serialized attribute into the fractal heap */ /* (sets the heap ID in the user data) */ if (H5HF_insert(fheap, attr_size, attr_ptr, &udata.id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert attribute into fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert attribute into fractal heap"); } /* end else */ /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Create the callback information for v2 B-tree record insertion */ udata.common.f = f; @@ -531,32 +516,32 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) /* Insert attribute into 'name' tracking v2 B-tree */ if (H5B2_insert(bt2_name, &udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree"); /* Check if we should create a creation order index v2 B-tree record */ if (ainfo->index_corder) { /* Open the creation order index v2 B-tree */ - HDassert(H5F_addr_defined(ainfo->corder_bt2_addr)); + assert(H5_addr_defined(ainfo->corder_bt2_addr)); if (NULL == (bt2_corder = H5B2_open(f, ainfo->corder_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index"); /* Insert the record into the creation order index v2 B-tree */ if (H5B2_insert(bt2_corder, &udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree"); } /* end if */ done: /* Release resources */ if (shared_fheap && H5HF_close(shared_fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index"); if (wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_insert() */ @@ -569,9 +554,6 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, February 20, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -583,8 +565,8 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(record); - HDassert(new_heap_id); + assert(record); + assert(new_heap_id); /* Update record's heap ID */ record->id = *new_heap_id; @@ -602,9 +584,6 @@ H5A__dense_write_bt2_cb2(void *_record, void *_op_data, hbool_t *changed) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, December 5, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -620,26 +599,26 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(record); - HDassert(op_data); + assert(record); + assert(op_data); /* Check for modifying shared attribute */ if (record->flags & H5O_MSG_FLAG_SHARED) { /* Update the shared attribute in the SOHM info */ if (H5O__attr_update_shared(op_data->f, NULL, op_data->attr, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute in shared storage") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute in shared storage"); /* Update record's heap ID */ record->id = op_data->attr->sh_loc.u.heap_id; /* Check if we need to modify the creation order index with new heap ID */ - if (H5F_addr_defined(op_data->corder_bt2_addr)) { + if (H5_addr_defined(op_data->corder_bt2_addr)) { H5A_bt2_ud_common_t udata; /* User data for v2 B-tree modify */ /* Open the creation order index v2 B-tree */ if (NULL == (bt2_corder = H5B2_open(op_data->f, op_data->corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for creation order index") + "unable to open v2 B-tree for creation order index"); /* Create the "udata" information for v2 B-tree record modify */ udata.f = op_data->f; @@ -655,7 +634,7 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) /* Modify record for creation order index */ if (H5B2_modify(bt2_corder, &udata, H5A__dense_write_bt2_cb2, &op_data->attr->sh_loc.u.heap_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree"); } /* end if */ /* Note that the record changed */ @@ -667,19 +646,19 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) /* Find out the size of buffer needed for serialized attribute */ if ((attr_size = H5O_msg_raw_size(op_data->f, H5O_ATTR_ID, FALSE, op_data->attr)) == 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get attribute size") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get attribute size"); /* Wrap the local buffer for serialized attributes */ if (NULL == (wb = H5WB_wrap(attr_buf, sizeof(attr_buf)))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't wrap buffer") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't wrap buffer"); /* Get a pointer to a buffer that's large enough for attribute */ if (NULL == (attr_ptr = H5WB_actual(wb, attr_size))) - HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "can't get actual buffer") + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "can't get actual buffer"); /* Create serialized form of attribute */ if (H5O_msg_encode(op_data->f, H5O_ATTR_ID, FALSE, (unsigned char *)attr_ptr, op_data->attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute"); /* Sanity check */ #ifndef NDEBUG @@ -687,22 +666,22 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) size_t obj_len; /* Length of existing encoded attribute */ if (H5HF_get_obj_len(op_data->fheap, &record->id, &obj_len) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get object size") - HDassert(obj_len == attr_size); + HGOTO_ERROR(H5E_ATTR, H5E_CANTGETSIZE, FAIL, "can't get object size"); + assert(obj_len == attr_size); } #endif /* NDEBUG */ /* Update existing attribute in heap */ /* (might be more efficient as fractal heap 'op' callback, but leave that for later -QAK) */ if (H5HF_write(op_data->fheap, &record->id, changed, attr_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute in heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute in heap"); } /* end else */ done: /* Release resources */ if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index"); if (wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_write_bt2_cb() */ @@ -714,9 +693,6 @@ H5A__dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 4 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -733,15 +709,15 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(ainfo); - HDassert(H5F_addr_defined(ainfo->fheap_addr)); - HDassert(H5F_addr_defined(ainfo->name_bt2_addr)); - HDassert(attr); + assert(f); + assert(ainfo); + assert(H5_addr_defined(ainfo->fheap_addr)); + assert(H5_addr_defined(ainfo->name_bt2_addr)); + assert(attr); /* Check if attributes are shared in this file */ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared"); /* Get handle for shared message heap, if attributes are shareable */ if (attr_sharable) { @@ -749,23 +725,23 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) /* Retrieve the address of the shared message's fractal heap */ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address"); /* Check if there are any shared messages currently */ - if (H5F_addr_defined(shared_fheap_addr)) { + if (H5_addr_defined(shared_fheap_addr)) { /* Open the fractal heap for shared header messages */ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); } /* end if */ } /* end if */ /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Create the "udata" information for v2 B-tree record modify */ udata.f = f; @@ -787,16 +763,16 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) /* Modify attribute through 'name' tracking v2 B-tree */ if (H5B2_modify(bt2_name, &udata, H5A__dense_write_bt2_cb, &op_data) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree"); done: /* Release resources */ if (shared_fheap && H5HF_close(shared_fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_write() */ @@ -809,9 +785,6 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 5 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -831,7 +804,7 @@ H5A__dense_copy_fh_cb(const void *obj, size_t obj_len, void *_udata) */ if (NULL == (udata->attr = (H5A_t *)H5O_msg_decode(udata->f, NULL, H5O_ATTR_ID, obj_len, (const unsigned char *)obj))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, FAIL, "can't decode attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, FAIL, "can't decode attribute"); /* Set the creation order index for the attribute */ udata->attr->shared->crt_idx = udata->record->corder; @@ -851,9 +824,6 @@ H5A__dense_copy_fh_cb(const void *obj, size_t obj_len, void *_udata) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jan 3 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -873,14 +843,14 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(ainfo); - HDassert(old_name); - HDassert(new_name); + assert(f); + assert(ainfo); + assert(old_name); + assert(new_name); /* Check if attributes are shared in this file */ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared"); /* Get handle for shared message heap, if attributes are shareable */ if (attr_sharable) { @@ -888,23 +858,23 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons /* Retrieve the address of the shared message's fractal heap */ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address"); /* Check if there are any shared messages currently */ - if (H5F_addr_defined(shared_fheap_addr)) { + if (H5_addr_defined(shared_fheap_addr)) { /* Open the fractal heap for shared header messages */ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); } /* end if */ } /* end if */ /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Create the "udata" information for v2 B-tree record modify */ udata.f = f; @@ -920,14 +890,14 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons /* Get copy of attribute through 'name' tracking v2 B-tree */ attr_exists = FALSE; if (H5B2_find(bt2_name, &udata, &attr_exists, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index"); if (attr_exists == FALSE) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute in name index") - HDassert(attr_copy); + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute in name index"); + assert(attr_copy); /* Check if message is already shared */ if ((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr_copy)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error determining if message is shared") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error determining if message is shared"); else if (shared_mesg > 0) { /* Reset shared status of copy */ /* (so it will get shared again if necessary) */ @@ -940,23 +910,23 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons /* Recompute the version to encode the attribute with */ if (H5A__set_version(f, attr_copy) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "unable to update attribute version") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "unable to update attribute version"); /* Need to remove the attribute from the creation order index v2 B-tree */ if (ainfo->index_corder) { hbool_t corder_attr_exists; /* Attribute exists in v2 B-tree */ /* Open the creation order index v2 B-tree */ - HDassert(H5F_addr_defined(ainfo->corder_bt2_addr)); + assert(H5_addr_defined(ainfo->corder_bt2_addr)); if (NULL == (bt2_corder = H5B2_open(f, ainfo->corder_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation index"); /* Set up the creation order to search for */ udata.corder = attr_copy->shared->crt_idx; corder_attr_exists = FALSE; if (H5B2_find(bt2_corder, &udata, &corder_attr_exists, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index"); if (corder_attr_exists) { H5A_bt2_ud_rm_t rm_udata; @@ -967,14 +937,14 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons /* Remove the record from the creation order index v2 B-tree */ if (H5B2_remove(bt2_corder, &rm_udata, NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, - "unable to remove attribute from creation order index v2 B-tree") + "unable to remove attribute from creation order index v2 B-tree"); } } /* Insert renamed attribute back into dense storage */ /* (Possibly making it shared) */ if (H5A__dense_insert(f, ainfo, attr_copy) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to add to dense storage") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to add to dense storage"); /* Was this attribute shared? */ if ((shared_mesg = H5O_msg_is_shared(H5O_ATTR_ID, attr_copy)) > 0) { @@ -982,7 +952,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons /* Retrieve ref count for shared attribute */ if (H5SM_get_refcount(f, H5O_ATTR_ID, &attr_copy->sh_loc, &attr_rc) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") + 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 * components (ie. its reference count is 1), increment the reference @@ -994,32 +964,32 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons if (attr_rc == 1) { /* Increment reference count on attribute components */ if (H5O__attr_link(f, NULL, attr_copy) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count") + HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count"); } /* end if */ } /* end if */ else if (shared_mesg == 0) { /* Increment reference count on attribute components */ /* (so that they aren't deleted when the attribute is removed shortly) */ if (H5O__attr_link(f, NULL, attr_copy) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count") + HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count"); } /* end if */ else if (shared_mesg < 0) - HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "error determining if message should be shared"); /* Delete old attribute from dense storage */ if (H5A__dense_remove(f, ainfo, old_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage"); done: /* Release resources */ if (shared_fheap && H5HF_close(shared_fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index"); if (attr_copy) H5O_msg_free(H5O_ATTR_ID, attr_copy); @@ -1033,9 +1003,6 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons * * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * - * Programmer: Quincey Koziol - * Dec 5 2006 - * *------------------------------------------------------------------------- */ static int @@ -1069,7 +1036,7 @@ H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) /* Call fractal heap 'op' routine, to copy the attribute information */ if (H5HF_op(fheap, &record->id, H5A__dense_copy_fh_cb, &fh_udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, H5_ITER_ERROR, "heap op callback failed") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, H5_ITER_ERROR, "heap op callback failed"); /* Check which type of callback to make */ switch (bt2_udata->attr_op->op_type) { @@ -1078,7 +1045,7 @@ H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) /* Get the attribute information */ if (H5A__get_info(fh_udata.attr, &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5_ITER_ERROR, "unable to get attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5_ITER_ERROR, "unable to get attribute info"); /* Make the application callback */ ret_value = (bt2_udata->attr_op->u.app_op2)(bt2_udata->loc_id, fh_udata.attr->shared->name, @@ -1100,9 +1067,9 @@ H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) break; default: - HDassert("unknown attribute op type" && 0); + assert("unknown attribute op type" && 0); #ifdef NDEBUG - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unsupported attribute op type") + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unsupported attribute op type"); #endif /* NDEBUG */ } /* end switch */ @@ -1129,9 +1096,6 @@ H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 5 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1149,11 +1113,11 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(ainfo); - HDassert(H5F_addr_defined(ainfo->fheap_addr)); - HDassert(H5F_addr_defined(ainfo->name_bt2_addr)); - HDassert(attr_op); + assert(f); + assert(ainfo); + assert(H5_addr_defined(ainfo->fheap_addr)); + assert(H5_addr_defined(ainfo->name_bt2_addr)); + assert(attr_op); /* Determine the address of the index to use */ if (idx_type == H5_INDEX_NAME) { @@ -1162,14 +1126,14 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t * table and sorting it. */ if (order == H5_ITER_NATIVE) { - HDassert(H5F_addr_defined(ainfo->name_bt2_addr)); + assert(H5_addr_defined(ainfo->name_bt2_addr)); bt2_addr = ainfo->name_bt2_addr; } /* end if */ else bt2_addr = HADDR_UNDEF; } /* end if */ else { - HDassert(idx_type == H5_INDEX_CRT_ORDER); + assert(idx_type == H5_INDEX_CRT_ORDER); /* This address may not be defined if creation order is tracked, but * there's no index on it. If there's no v2 B-tree that indexes @@ -1179,17 +1143,17 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t } /* end else */ /* Check on iteration order */ - if (order == H5_ITER_NATIVE && H5F_addr_defined(bt2_addr)) { + if (order == H5_ITER_NATIVE && H5_addr_defined(bt2_addr)) { H5A_bt2_ud_it_t udata; /* User data for iterator callback */ htri_t attr_sharable; /* Flag indicating attributes are shareable */ /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Check if attributes are shared in this file */ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared"); /* Get handle for shared message heap, if attributes are shareable */ if (attr_sharable) { @@ -1197,19 +1161,19 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t /* Retrieve the address of the shared message's fractal heap */ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address"); /* Check if there are any shared messages currently */ - if (H5F_addr_defined(shared_fheap_addr)) { + if (H5_addr_defined(shared_fheap_addr)) { /* Open the fractal heap for shared header messages */ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); } /* end if */ } /* end if */ /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index"); /* Construct the user data for v2 B-tree iterator callback */ udata.f = f; @@ -1234,7 +1198,7 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t /* Build the table of attributes for this object */ /* (build table using the name index, but sort according to idx_type) */ if (H5A__dense_build_table(f, ainfo, idx_type, order, &atable) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error building table of attributes") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error building table of attributes"); /* Iterate over attributes in table */ if ((ret_value = H5A__attr_iterate_table(&atable, skip, last_attr, loc_id, attr_op, op_data)) < 0) @@ -1244,13 +1208,13 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t done: /* Release resources */ if (shared_fheap && H5HF_close(shared_fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index"); if (atable.attrs && H5A__attr_release_table(&atable) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_iterate() */ @@ -1262,9 +1226,6 @@ H5A__dense_iterate(H5F_t *f, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1279,10 +1240,10 @@ H5A__dense_remove_bt2_cb(const void *_record, void *_udata) FUNC_ENTER_PACKAGE /* Check for removing the link from the creation order index */ - if (H5F_addr_defined(udata->corder_bt2_addr)) { + if (H5_addr_defined(udata->corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ if (NULL == (bt2_corder = H5B2_open(udata->common.f, udata->corder_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index"); /* Set up the user data for the v2 B-tree 'record remove' callback */ udata->common.corder = attr->shared->crt_idx; @@ -1290,30 +1251,30 @@ H5A__dense_remove_bt2_cb(const void *_record, void *_udata) /* Remove the record from the creation order index v2 B-tree */ if (H5B2_remove(bt2_corder, udata, NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, - "unable to remove attribute from creation order index v2 B-tree") + "unable to remove attribute from creation order index v2 B-tree"); } /* end if */ /* Check for removing shared attribute */ if (record->flags & H5O_MSG_FLAG_SHARED) { /* Decrement the reference count on the shared attribute message */ if (H5SM_delete(udata->common.f, NULL, &(attr->sh_loc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute"); } /* end if */ else { /* Perform the deletion action on the attribute */ /* (takes care of shared & committed datatype/dataspace components) */ if (H5O__attr_delete(udata->common.f, NULL, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); /* Remove record from fractal heap */ if (H5HF_remove(udata->common.fheap, &record->id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from fractal heap"); } /* end else */ done: /* Release resources */ if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_remove_bt2_cb() */ @@ -1325,9 +1286,6 @@ H5A__dense_remove_bt2_cb(const void *_record, void *_udata) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1344,17 +1302,17 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(ainfo); - HDassert(name && *name); + assert(f); + assert(ainfo); + assert(name && *name); /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Check if attributes are shared in this file */ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared"); /* Get handle for shared message heap, if attributes are shareable */ if (attr_sharable) { @@ -1362,19 +1320,19 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) /* Retrieve the address of the shared message's fractal heap */ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address"); /* Check if there are any shared messages currently */ - if (H5F_addr_defined(shared_fheap_addr)) { + if (H5_addr_defined(shared_fheap_addr)) { /* Open the fractal heap for shared header messages */ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); } /* end if */ } /* end if */ /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Set up the user data for the v2 B-tree 'record remove' callback */ udata.common.f = f; @@ -1388,16 +1346,16 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) /* Remove the record from the name index v2 B-tree */ if (H5B2_remove(bt2_name, &udata, H5A__dense_remove_bt2_cb, &udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from name index v2 B-tree") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from name index v2 B-tree"); done: /* Release resources */ if (shared_fheap && H5HF_close(shared_fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); if (attr_copy) H5O_msg_free_real(H5O_MSG_ATTR, attr_copy); @@ -1411,9 +1369,6 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Feb 14 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -1442,11 +1397,11 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) fheap = bt2_udata->fheap; /* Check whether to make a copy of the attribute or just need the shared location info */ - if (H5F_addr_defined(bt2_udata->other_bt2_addr) || !(record->flags & H5O_MSG_FLAG_SHARED)) { + if (H5_addr_defined(bt2_udata->other_bt2_addr) || !(record->flags & H5O_MSG_FLAG_SHARED)) { /* Call fractal heap 'op' routine, to make copy of attribute to remove */ if (H5HF_op(fheap, &record->id, H5A__dense_copy_fh_cb, &fh_udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, FAIL, "attribute removal callback failed") - HDassert(fh_udata.attr); + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, FAIL, "attribute removal callback failed"); + assert(fh_udata.attr); /* Use the attribute's shared location */ use_sh_loc = FALSE; @@ -1460,7 +1415,7 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) } /* end else */ /* Check for removing the link from the "other" index (creation order, when name used and vice versa) */ - if (H5F_addr_defined(bt2_udata->other_bt2_addr)) { + if (H5_addr_defined(bt2_udata->other_bt2_addr)) { H5A_bt2_ud_common_t other_bt2_udata; /* Info for B-tree callbacks */ /* Determine the index being used */ @@ -1469,7 +1424,7 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) other_bt2_udata.corder = fh_udata.attr->shared->crt_idx; } /* end if */ else { - HDassert(bt2_udata->idx_type == H5_INDEX_CRT_ORDER); + assert(bt2_udata->idx_type == H5_INDEX_CRT_ORDER); /* Set up the user data for the v2 B-tree 'record remove' callback */ other_bt2_udata.f = bt2_udata->f; @@ -1484,14 +1439,14 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(bt2_udata->f, bt2_udata->other_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index"); /* Set the common information for the v2 B-tree remove operation */ /* Remove the record from the "other" index v2 B-tree */ if (H5B2_remove(bt2, &other_bt2_udata, NULL, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, - "unable to remove record from 'other' index v2 B-tree") + "unable to remove record from 'other' index v2 B-tree"); } /* end if */ /* Check for removing shared attribute */ @@ -1506,23 +1461,23 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) /* Decrement the reference count on the shared attribute message */ if (H5SM_delete(bt2_udata->f, NULL, sh_loc_ptr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute"); } /* end if */ else { /* Perform the deletion action on the attribute */ /* (takes care of shared & committed datatype/dataspace components) */ if (H5O__attr_delete(bt2_udata->f, NULL, fh_udata.attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); /* Remove record from fractal heap */ if (H5HF_remove(fheap, &record->id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from fractal heap"); } /* end else */ done: /* Release resources */ if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index"); if (fh_udata.attr) H5O_msg_free(H5O_ATTR_ID, fh_udata.attr); @@ -1537,9 +1492,6 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Feb 14 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1556,8 +1508,8 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(ainfo); + assert(f); + assert(ainfo); /* Determine the address of the index to use */ if (idx_type == H5_INDEX_NAME) { @@ -1567,13 +1519,13 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type */ if (order == H5_ITER_NATIVE) { bt2_addr = ainfo->name_bt2_addr; - HDassert(H5F_addr_defined(bt2_addr)); + assert(H5_addr_defined(bt2_addr)); } /* end if */ else bt2_addr = HADDR_UNDEF; } /* end if */ else { - HDassert(idx_type == H5_INDEX_CRT_ORDER); + assert(idx_type == H5_INDEX_CRT_ORDER); /* This address may not be defined if creation order is tracked, but * there's no index on it. If there's no v2 B-tree that indexes @@ -1583,17 +1535,17 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type } /* end else */ /* If there is an index defined for the field, use it */ - if (H5F_addr_defined(bt2_addr)) { + if (H5_addr_defined(bt2_addr)) { H5A_bt2_ud_rmbi_t udata; /* User data for v2 B-tree record removal */ htri_t attr_sharable; /* Flag indicating attributes are shareable */ /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Check if attributes are shared in this file */ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared"); /* Get handle for shared message heap, if attributes are shareable */ if (attr_sharable) { @@ -1601,19 +1553,19 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type /* Retrieve the address of the shared message's fractal heap */ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address"); /* Check if there are any shared messages currently */ - if (H5F_addr_defined(shared_fheap_addr)) { + if (H5_addr_defined(shared_fheap_addr)) { /* Open the fractal heap for shared header messages */ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); } /* end if */ } /* end if */ /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index"); /* Set up the user data for the v2 B-tree 'record remove' callback */ udata.f = f; @@ -1624,33 +1576,33 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type /* Remove the record from the name index v2 B-tree */ if (H5B2_remove_by_idx(bt2, order, n, H5A__dense_remove_by_idx_bt2_cb, &udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from v2 B-tree index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from v2 B-tree index"); } /* end if */ else { /* Build the table of attributes for this object */ /* (build table using the name index, but sort according to idx_type) */ if (H5A__dense_build_table(f, ainfo, idx_type, order, &atable) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error building table of attributes") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error building table of attributes"); /* Check for skipping too many attributes */ if (n >= atable.nattrs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified"); /* Delete appropriate attribute from dense storage */ if (H5A__dense_remove(f, ainfo, ((atable.attrs[n])->shared)->name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage"); } /* end else */ done: /* Release resources */ if (shared_fheap && H5HF_close(shared_fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index"); if (atable.attrs && H5A__attr_release_table(&atable) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_remove_by_idx() */ @@ -1663,9 +1615,6 @@ H5A__dense_remove_by_idx(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1681,18 +1630,18 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name, hbool_t FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(ainfo); - HDassert(name); - HDassert(attr_exists); + assert(f); + assert(ainfo); + assert(name); + assert(attr_exists); /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Check if attributes are shared in this file */ if ((attr_sharable = H5SM_type_shared(f, H5O_ATTR_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't determine if attributes are shared"); /* Get handle for shared message heap, if attributes are shareable */ if (attr_sharable) { @@ -1700,19 +1649,19 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name, hbool_t /* Retrieve the address of the shared message's fractal heap */ if (H5SM_get_fheap_addr(f, H5O_ATTR_ID, &shared_fheap_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get shared message heap address"); /* Check if there are any shared messages currently */ - if (H5F_addr_defined(shared_fheap_addr)) { + if (H5_addr_defined(shared_fheap_addr)) { /* Open the fractal heap for shared header messages */ if (NULL == (shared_fheap = H5HF_open(f, shared_fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); } /* end if */ } /* end if */ /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Create the "udata" information for v2 B-tree record 'find' */ udata.f = f; @@ -1727,16 +1676,16 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name, hbool_t /* Find the attribute in the 'name' index */ if (H5B2_find(bt2_name, &udata, attr_exists, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index"); done: /* Release resources */ if (shared_fheap && H5HF_close(shared_fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_exists() */ @@ -1748,9 +1697,6 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name, hbool_t * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jan 3 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -1773,7 +1719,7 @@ H5A__dense_delete_bt2_cb(const void *_record, void *_bt2_udata) /* Decrement the reference count on the shared attribute message */ if (H5SM_delete(bt2_udata->f, NULL, &sh_mesg) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute"); } /* end if */ else { H5A_fh_ud_cp_t fh_udata; /* User data for fractal heap 'op' callback */ @@ -1787,13 +1733,13 @@ H5A__dense_delete_bt2_cb(const void *_record, void *_bt2_udata) /* Call fractal heap 'op' routine, to copy the attribute information */ if (H5HF_op(bt2_udata->fheap, &record->id, H5A__dense_copy_fh_cb, &fh_udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, FAIL, "heap op callback failed") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPERATE, FAIL, "heap op callback failed"); attr = fh_udata.attr; /* Perform the deletion action on the attribute */ /* (takes care of shared/committed datatype & dataspace components) */ if (H5O__attr_delete(bt2_udata->f, NULL, fh_udata.attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); } /* end else */ done: @@ -1811,9 +1757,6 @@ H5A__dense_delete_bt2_cb(const void *_record, void *_bt2_udata) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 6 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1826,12 +1769,12 @@ H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(ainfo); + assert(f); + assert(ainfo); /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, ainfo->fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Create the "udata" information for v2 B-tree 'delete' */ udata.f = f; @@ -1845,31 +1788,32 @@ H5A__dense_delete(H5F_t *f, H5O_ainfo_t *ainfo) /* Delete name index v2 B-tree */ if (H5B2_delete(f, ainfo->name_bt2_addr, NULL, H5A__dense_delete_bt2_cb, &udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index"); ainfo->name_bt2_addr = HADDR_UNDEF; /* Release resources */ if (H5HF_close(fheap) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); fheap = NULL; /* Check if we should delete the creation order index v2 B-tree */ - if (H5F_addr_defined(ainfo->corder_bt2_addr)) { + if (H5_addr_defined(ainfo->corder_bt2_addr)) { /* Delete the creation order index, without adjusting the ref. count on the attributes */ if (H5B2_delete(f, ainfo->corder_bt2_addr, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, + "unable to delete v2 B-tree for creation order index"); ainfo->corder_bt2_addr = HADDR_UNDEF; } /* end if */ /* Delete fractal heap */ if (H5HF_delete(f, ainfo->fheap_addr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete fractal heap"); ainfo->fheap_addr = HADDR_UNDEF; done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_delete() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Adeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Adeprec.c index 6ec05b7ac8..e8fd3eaeee 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Adeprec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Adeprec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Adeprec.c - * November 27 2006 - * Quincey Koziol * * Purpose: Deprecated functions from the H5A interface. These * functions are here for compatibility purposes and may be @@ -116,13 +113,13 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read"); /* Get correct property list */ if (H5P_DEFAULT == acpl_id) @@ -134,23 +131,23 @@ H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Create the attribute */ if (NULL == (attr = H5VL_attr_create(vol_obj, &loc_params, name, type_id, space_id, acpl_id, H5P_ATTRIBUTE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to create attribute"); /* Register the new attribute and get an ID for it */ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute for ID"); done: /* Clean up on failure */ if (H5I_INVALID_HID == ret_value) if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute"); FUNC_LEAVE_API(ret_value) } /* end H5Acreate1() */ @@ -190,9 +187,9 @@ H5Aopen_name(hid_t loc_id, const char *name) /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -200,22 +197,22 @@ H5Aopen_name(hid_t loc_id, const char *name) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Open the attribute */ if (NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, name, H5P_ATTRIBUTE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute"); /* Register the attribute and get an ID for it */ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute handle") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute handle"); done: /* Clean up on failure */ if (H5I_INVALID_HID == ret_value) if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute"); FUNC_LEAVE_API(ret_value) } /* H5Aopen_name() */ @@ -255,7 +252,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) /* Check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "location is not valid for an attribute"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_IDX; @@ -268,22 +265,22 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Open the attribute */ if (NULL == (attr = H5VL_attr_open(vol_obj, &loc_params, NULL, H5P_ATTRIBUTE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute"); /* Register the attribute and get an ID for it */ if ((ret_value = H5VL_register(H5I_ATTR, attr, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute handle") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute handle"); done: /* Clean up on failure */ if (H5I_INVALID_HID == ret_value) if (attr && H5VL_attr_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute"); FUNC_LEAVE_API(ret_value) } /* H5Aopen_idx() */ @@ -323,7 +320,7 @@ H5Aget_num_attrs(hid_t loc_id) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO; @@ -332,7 +329,7 @@ H5Aget_num_attrs(hid_t loc_id) /* Get the number of attributes for the object */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object"); H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t); @@ -390,11 +387,11 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num /*in,out*/, H5A_operator1_t op, voi /* check arguments */ if (H5I_ATTR == H5I_get_type(loc_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "location is not valid for an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "location is not valid for an attribute"); /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") + HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier"); /* Set up VOL callback arguments */ attr_opt_args.iterate_old.loc_id = loc_id; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Aint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Aint.c index fb54f0c97b..f62449b4e3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Aint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Aint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Aint.c - * Dec 18 2006 - * Quincey Koziol * * Purpose: Internal routines for managing attributes. * @@ -157,7 +154,7 @@ H5A_init(void) * Create attribute ID type. */ if (H5I_register_type(H5I_ATTR_CLS) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to initialize interface"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -222,7 +219,7 @@ H5A_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(0 == H5I_nmembers(H5I_ATTR)); + assert(0 == H5I_nmembers(H5I_ATTR)); /* Destroy the attribute object id group */ n += (H5I_dec_type_ref(H5I_ATTR) > 0); @@ -237,9 +234,6 @@ H5A_term_package(void) * * Return: Attribute structure on success, NULL on Failure. * - * Programmer: Quincey Koziol - * April 2, 1998 - * *------------------------------------------------------------------------- */ H5A_t * @@ -254,10 +248,10 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, cons FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr) /* Check args */ - HDassert(loc); - HDassert(attr_name); - HDassert(type); - HDassert(space); + assert(loc); + assert(attr_name); + assert(type); + assert(space); /* Check for existing attribute with same name */ /* (technically, the "attribute create" operation will fail for a duplicated @@ -266,27 +260,27 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, cons */ exists = FALSE; if (H5O__attr_exists(loc->oloc, attr_name, &exists) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes"); if (exists) - HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists") + HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists"); /* Check if the dataspace has an extent set (or is NULL) */ if (!(H5S_has_extent(space))) - HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, NULL, "dataspace extent has not been set") + HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, NULL, "dataspace extent has not been set"); /* Check if the datatype is "sensible" for use in a dataset */ if (H5T_is_sensible(type) != TRUE) - HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, NULL, "datatype is not sensible") + HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, NULL, "datatype is not sensible"); /* Build the attribute information */ if (NULL == (attr = H5FL_CALLOC(H5A_t))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed for attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed for attribute info"); if (NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "can't allocate shared attr structure") + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "can't allocate shared attr structure"); /* If the creation property list is H5P_ATTRIBUTE_CREATE_DEFAULT, use the default character encoding */ - HDassert(acpl_id != H5P_DEFAULT); + assert(acpl_id != H5P_DEFAULT); if (acpl_id == H5P_ATTRIBUTE_CREATE_DEFAULT) attr->shared->encoding = H5F_DEFAULT_CSET; else { @@ -294,10 +288,10 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, cons /* Get a local copy of the attribute creation property list */ if (NULL == (ac_plist = (H5P_genplist_t *)H5I_object(acpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); if (H5P_get(ac_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &(attr->shared->encoding)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get character encoding flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get character encoding flag"); } /* end else */ /* Copy the attribute name */ @@ -305,43 +299,43 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, cons /* Copy datatype */ if (NULL == (attr->shared->dt = H5T_copy(type, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info"); /* Convert a datatype (if committed) to a transient type if the committed datatype's file location is different from the file location where the attribute will be created */ if (H5T_convert_committed_datatype(attr->shared->dt, loc->oloc->file) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't get shared datatype info"); /* Mark datatype as being on disk now */ if (H5T_set_loc(attr->shared->dt, H5F_VOL_OBJ(loc->oloc->file), H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location"); /* Set the version for datatype */ if (H5T_set_version(loc->oloc->file, attr->shared->dt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of datatype"); /* Copy the dataspace for the attribute */ attr->shared->ds = H5S_copy(space, FALSE, TRUE); /* Set the version for dataspace */ if (H5S_set_version(loc->oloc->file, attr->shared->ds) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set version of dataspace"); /* Copy the object header information */ if (H5O_loc_copy_deep(&(attr->oloc), loc->oloc) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to copy entry") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to copy entry"); /* Deep copy of the group hierarchy path */ if (H5G_name_copy(&(attr->path), loc->path, H5_COPY_DEEP) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy path") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy path"); /* Check if any of the pieces should be (or are already) shared in the * SOHM table */ if (H5SM_try_share(attr->oloc.file, NULL, 0, H5O_DTYPE_ID, attr->shared->dt, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share datatype failed"); if (H5SM_try_share(attr->oloc.file, NULL, 0, H5O_SDSPACE_ID, attr->shared->ds, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, NULL, "trying to share dataspace failed"); /* Check whether datatype is committed & increment ref count * (to maintain ref. count incr/decr similarity with "shared message" @@ -350,7 +344,7 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, cons if (H5T_is_named(attr->shared->dt)) /* Increment the reference count on the shared datatype */ if (H5T_link(attr->shared->dt, 1) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, NULL, "unable to adjust shared datatype link count") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, NULL, "unable to adjust shared datatype link count"); /* Compute the size of pieces on disk. This is either the size of the * datatype and dataspace messages themselves, or the size of the "shared" @@ -361,25 +355,25 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, cons /* Get # of elements for attribute's dataspace */ if ((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, NULL, "dataspace is invalid") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, NULL, "dataspace is invalid"); H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); - HDassert(attr->shared->dt_size > 0); - HDassert(attr->shared->ds_size > 0); + assert(attr->shared->dt_size > 0); + assert(attr->shared->ds_size > 0); attr->shared->data_size = nelmts * H5T_GET_SIZE(attr->shared->dt); /* Hold the symbol table entry (and file) open */ if (H5O_open(&(attr->oloc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open"); attr->obj_opened = TRUE; /* Set the version to encode the attribute with */ if (H5A__set_version(attr->oloc.file, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, NULL, "unable to update attribute version") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, NULL, "unable to update attribute version"); /* Insert the attribute into the object header */ if (H5O__attr_create(&(attr->oloc), attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, NULL, "unable to create attribute in object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, NULL, "unable to create attribute in object header"); /* Set return value */ ret_value = attr; @@ -387,7 +381,7 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, cons done: /* Cleanup on failure */ if (NULL == ret_value && attr && H5A__close(attr)) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5A__create() */ @@ -399,9 +393,6 @@ H5A__create(const H5G_loc_t *loc, const char *attr_name, const H5T_t *type, cons * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 6, 2017 - * *------------------------------------------------------------------------- */ H5A_t * @@ -418,9 +409,9 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr FUNC_ENTER_PACKAGE /* check args */ - HDassert(loc); - HDassert(obj_name); - HDassert(attr_name); + assert(loc); + assert(obj_name); + assert(attr_name); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -429,12 +420,12 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr /* Find the object's location */ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "object not found") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "object not found"); loc_found = TRUE; /* Go do the real work for attaching the attribute to the object */ if (NULL == (attr = H5A__create(&obj_loc, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute"); /* Set return value */ ret_value = attr; @@ -442,12 +433,12 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr done: /* Release resources */ if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location"); /* Cleanup on failure */ if (ret_value == NULL) if (attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__create_by_name() */ @@ -464,9 +455,6 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 18, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -477,30 +465,30 @@ H5A__open_common(const H5G_loc_t *loc, H5A_t *attr) FUNC_ENTER_PACKAGE /* check args */ - HDassert(loc); - HDassert(attr); + assert(loc); + assert(attr); #if defined(H5_USING_MEMCHECKER) || !defined(NDEBUG) /* Clear object location */ if (H5O_loc_reset(&(attr->oloc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to reset location") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to reset location"); #endif /* H5_USING_MEMCHECKER */ /* Free any previous group hier. path */ if (H5G_name_free(&(attr->path)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path"); /* Deep copy of the symbol table entry */ if (H5O_loc_copy_deep(&(attr->oloc), loc->oloc) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry"); /* Deep copy of the group hier. path */ if (H5G_name_copy(&(attr->path), loc->path, H5_COPY_DEEP) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "unable to copy entry") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "unable to copy entry"); /* Hold the symbol table entry (and file) open */ if (H5O_open(&(attr->oloc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open"); attr->obj_opened = TRUE; done: @@ -514,9 +502,6 @@ H5A__open_common(const H5G_loc_t *loc, H5A_t *attr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 9, 2017 - * *------------------------------------------------------------------------- */ H5A_t * @@ -528,17 +513,17 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name) FUNC_ENTER_PACKAGE /* check args */ - HDassert(loc); - HDassert(attr_name); + assert(loc); + assert(attr_name); /* Read in attribute from object header */ if (NULL == (attr = H5O__attr_open_by_name(loc->oloc, attr_name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, - "unable to load attribute info from object header for attribute: '%s'", attr_name) + "unable to load attribute info from object header for attribute: '%s'", attr_name); /* Finish initializing attribute */ if (H5A__open_common(loc, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute"); /* Set return value */ ret_value = attr; @@ -547,7 +532,7 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name) /* Cleanup on failure */ if (ret_value == NULL) if (attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open() */ @@ -559,9 +544,6 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * April 2, 1998 - * *------------------------------------------------------------------------- */ H5A_t * @@ -578,8 +560,8 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type FUNC_ENTER_PACKAGE /* check args */ - HDassert(loc); - HDassert(obj_name); + assert(loc); + assert(obj_name); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -588,16 +570,16 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type /* Find the object's location */ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "object not found") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "object not found"); loc_found = TRUE; /* Read in attribute from object header */ if (NULL == (attr = H5O__attr_open_by_idx(obj_loc.oloc, idx_type, order, n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to load attribute info from object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to load attribute info from object header"); /* Finish initializing attribute */ if (H5A__open_common(&obj_loc, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute"); /* Set return value */ ret_value = attr; @@ -605,12 +587,12 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type done: /* Release resources */ if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location"); /* Cleanup on failure */ if (ret_value == NULL) if (attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_idx() */ @@ -622,9 +604,6 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 11, 2006 - * *------------------------------------------------------------------------- */ H5A_t * @@ -640,9 +619,9 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n FUNC_ENTER_PACKAGE /* check args */ - HDassert(loc); - HDassert(obj_name); - HDassert(attr_name); + assert(loc); + assert(obj_name); + assert(attr_name); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -651,16 +630,16 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n /* Find the object's location */ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "object not found") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "object not found"); loc_found = TRUE; /* Read in attribute from object header */ if (NULL == (attr = H5O__attr_open_by_name(obj_loc.oloc, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to load attribute info from object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to load attribute info from object header"); /* Finish initializing attribute */ if (H5A__open_common(loc, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to initialize attribute"); /* Set return value */ ret_value = attr; @@ -668,12 +647,12 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n done: /* Release resources */ if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location"); /* Cleanup on failure */ if (ret_value == NULL) if (attr && H5A__close(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__open_by_name() */ @@ -710,17 +689,17 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) - HDassert(attr); - HDassert(mem_type); - HDassert(buf); + assert(attr); + assert(mem_type); + assert(buf); /* Patch the top level file pointer in attr->shared->dt->shared->u.vlen.f if needed */ if (H5T_patch_vlen_file(attr->shared->dt, H5F_VOL_OBJ(attr->oloc.file)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch VL datatype file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch VL datatype file pointer"); /* Create buffer for data to store on disk */ if ((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid"); H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); if (nelmts > 0) { @@ -730,41 +709,56 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) /* Check if the attribute has any data yet, if not, fill with zeroes */ if (attr->obj_opened && !attr->shared->data) - HDmemset(buf, 0, (dst_type_size * nelmts)); + memset(buf, 0, (dst_type_size * nelmts)); else { /* Attribute exists and has a value */ /* Convert memory buffer into disk buffer */ /* Set up type conversion function */ if (NULL == (tpath = H5T_path_find(attr->shared->dt, mem_type))) HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, - "unable to convert between src and dst datatypes") + "unable to convert between src and dst datatypes"); /* Check for type conversion required */ if (!H5T_path_noop(tpath)) { + H5T_bkg_t need_bkg; /* Background buffer type */ + if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0 || (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion"); /* Get the maximum buffer size needed and allocate it */ buf_size = nelmts * MAX(src_type_size, dst_type_size); if (NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") - if (NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Copy the attribute data into the buffer for conversion */ H5MM_memcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts)); + /* Check if we need a background buffer */ + need_bkg = H5T_path_bkg(tpath); + + if (need_bkg) { + /* Allocate background buffer */ + if (NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed"); + + /* Copy the application buffer into the background buffer if necessary */ + if (need_bkg == H5T_BKG_YES) { + assert(buf_size >= (dst_type_size * nelmts)); + H5MM_memcpy(bkg_buf, buf, dst_type_size * nelmts); + } + } + /* Perform datatype conversion. */ if (H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed"); /* Copy the converted data into the user's buffer */ H5MM_memcpy(buf, tconv_buf, (dst_type_size * nelmts)); } /* end if */ /* No type conversion necessary */ else { - HDassert(dst_type_size == src_type_size); + assert(dst_type_size == src_type_size); /* Copy the attribute data into the user's buffer */ H5MM_memcpy(buf, attr->shared->data, (dst_type_size * nelmts)); @@ -775,9 +769,9 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) done: /* Release resources */ if (src_id >= 0 && H5I_dec_ref(src_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object"); if (dst_id >= 0 && H5I_dec_ref(dst_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object"); if (tconv_buf) tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if (bkg_buf) @@ -804,9 +798,8 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) { - uint8_t *tconv_buf = NULL; /* datatype conv buffer */ - hbool_t tconv_owned = FALSE; /* Whether the datatype conv buffer is owned by attribute */ - uint8_t *bkg_buf = NULL; /* temp conversion buffer */ + uint8_t *tconv_buf = NULL; /* datatype conv buffer */ + uint8_t *bkg_buf = NULL; /* temp conversion buffer */ hssize_t snelmts; /* elements in attribute */ size_t nelmts; /* elements in attribute */ H5T_path_t *tpath = NULL; /* conversion information*/ @@ -818,13 +811,17 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr) - HDassert(attr); - HDassert(mem_type); - HDassert(buf); + assert(attr); + assert(mem_type); + assert(buf); + + /* Patch the top level file pointer in attr->shared->dt->shared->u.vlen.f if needed */ + if (H5T_patch_vlen_file(attr->shared->dt, H5F_VOL_OBJ(attr->oloc.file)) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't patch VL datatype file pointer"); /* Get # of elements for attribute's dataspace */ if ((snelmts = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid"); H5_CHECKED_ASSIGN(nelmts, size_t, snelmts, hssize_t); /* If there's actually data elements for the attribute, make a copy of the data passed in */ @@ -836,27 +833,50 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) /* Convert memory buffer into disk buffer */ /* Set up type conversion function */ if (NULL == (tpath = H5T_path_find(mem_type, attr->shared->dt))) - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes") + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dst datatypes"); /* Check for type conversion required */ if (!H5T_path_noop(tpath)) { + H5T_bkg_t need_bkg; /* Background buffer type */ + if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(mem_type, H5T_COPY_ALL), FALSE)) < 0 || (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(attr->shared->dt, H5T_COPY_ALL), FALSE)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + HGOTO_ERROR(H5E_ATTR, H5E_CANTREGISTER, FAIL, "unable to register types for conversion"); /* Get the maximum buffer size needed and allocate it */ buf_size = nelmts * MAX(src_type_size, dst_type_size); if (NULL == (tconv_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") - if (NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Copy the user's data into the buffer for conversion */ H5MM_memcpy(tconv_buf, buf, (src_type_size * nelmts)); + /* Check if we need a background buffer */ + if (H5T_detect_class(attr->shared->dt, H5T_VLEN, FALSE)) + need_bkg = H5T_BKG_YES; + else + need_bkg = H5T_path_bkg(tpath); + + if (need_bkg) { + /* Use the existing attribute data buffer, if present, as the background buffer, + * otherwise allocate one. Note we don't need to track which one it is since both + * use the "attr_buf" free list block. */ + if (attr->shared->data) { + bkg_buf = attr->shared->data; + attr->shared->data = NULL; + + /* Clear background buffer if it's not supposed to be initialized with file + * contents */ + if (need_bkg == H5T_BKG_TEMP) + memset(bkg_buf, 0, dst_type_size * nelmts); + } + else if (NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed"); + } + /* Perform datatype conversion */ if (H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed"); /* Free the previous attribute data buffer, if there is one */ if (attr->shared->data) @@ -864,16 +884,16 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) /* Set the pointer to the attribute data to the converted information */ attr->shared->data = tconv_buf; - tconv_owned = TRUE; + tconv_buf = NULL; } /* end if */ /* No type conversion necessary */ else { - HDassert(dst_type_size == src_type_size); + assert(dst_type_size == src_type_size); /* Allocate the attribute buffer, if there isn't one */ if (attr->shared->data == NULL) if (NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, dst_type_size * nelmts))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Copy the attribute data into the attribute data buffer */ H5MM_memcpy(attr->shared->data, buf, (dst_type_size * nelmts)); @@ -881,16 +901,16 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) /* Modify the attribute in the object header */ if (H5O__attr_write(&(attr->oloc), attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to modify attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to modify attribute"); } /* end if */ done: /* Release resources */ if (src_id >= 0 && H5I_dec_ref(src_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object"); if (dst_id >= 0 && H5I_dec_ref(dst_id) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object") - if (tconv_buf && !tconv_owned) + HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to close temporary object"); + if (tconv_buf) tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if (bkg_buf) bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); @@ -922,8 +942,8 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf, size_t *attr_name_len) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(attr); - HDassert(attr_name_len); + assert(attr); + assert(attr_name_len); /* Get the real attribute length */ nbytes = HDstrlen(attr->shared->name); @@ -964,19 +984,19 @@ H5A_get_space(H5A_t *attr) FUNC_ENTER_NOAPI_NOINIT - HDassert(attr); + assert(attr); /* Copy the attribute's dataspace */ if (NULL == (ds = H5S_copy(attr->shared->ds, FALSE, TRUE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace"); /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID"); done: if (H5I_INVALID_HID == ret_value && ds && H5S_close(ds) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataspace") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A_get_space() */ @@ -999,26 +1019,26 @@ H5A__get_type(H5A_t *attr) FUNC_ENTER_PACKAGE - HDassert(attr); + assert(attr); /* Patch the datatype's "top level" file pointer */ if (H5T_patch_file(attr->shared->dt, attr->oloc.file) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to patch datatype's file pointer") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to patch datatype's file pointer"); /* Copy the attribute's datatype. If the type is a named type then * reopen the type before returning it to the user. Make the type * read-only. */ if (NULL == (dt = H5T_copy_reopen(attr->shared->dt))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy datatype") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy datatype"); /* Mark any datatypes as being in memory now */ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "invalid datatype location"); /* Lock copied type */ if (H5T_lock(dt, FALSE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to lock transient datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to lock transient datatype"); /* Register */ if (H5T_is_named(dt)) { @@ -1027,17 +1047,17 @@ H5A__get_type(H5A_t *attr) * returned datatype */ if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle"); } else { if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype"); } done: if (H5I_INVALID_HID == ret_value) if (dt && H5T_close(dt) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_type() */ @@ -1066,17 +1086,17 @@ H5A__get_create_plist(H5A_t *attr) FUNC_ENTER_PACKAGE if (NULL == (plist = (H5P_genplist_t *)H5I_object(H5P_LST_ATTRIBUTE_CREATE_ID_g))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get default ACPL") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get default ACPL"); /* Create the property list object to return */ if ((new_plist_id = H5P_copy_plist(plist, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy attribute creation properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy attribute creation properties"); if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_plist_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list"); /* Set the character encoding on the new property list */ if (H5P_set(new_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &(attr->shared->encoding)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set character encoding") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set character encoding"); ret_value = new_plist_id; @@ -1092,9 +1112,6 @@ H5A__get_create_plist(H5A_t *attr) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * February 6, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1105,8 +1122,8 @@ H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo) FUNC_ENTER_NOAPI_NOERR /* Check args */ - HDassert(attr); - HDassert(ainfo); + assert(attr); + assert(ainfo); /* Set info for attribute */ ainfo->cset = attr->shared->encoding; @@ -1131,9 +1148,6 @@ H5A__get_info(const H5A_t *attr, H5A_info_t *ainfo) * Return: Success: Pointer to a new copy of the OLD_ATTR argument. * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 - * *------------------------------------------------------------------------- */ H5A_t * @@ -1146,12 +1160,12 @@ H5A__copy(H5A_t *_new_attr, const H5A_t *old_attr) FUNC_ENTER_PACKAGE /* check args */ - HDassert(old_attr); + assert(old_attr); /* Allocate attribute structure */ if (_new_attr == NULL) { if (NULL == (new_attr = H5FL_CALLOC(H5A_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); allocated_attr = TRUE; } /* end if */ else @@ -1162,7 +1176,7 @@ H5A__copy(H5A_t *_new_attr, const H5A_t *old_attr) /* Deep copy of the group hierarchy path */ if (H5G_name_copy(&(new_attr->path), &(old_attr->path), H5_COPY_DEEP) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy path") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "unable to copy path"); /* Share some attribute information */ new_attr->shared = old_attr->shared; @@ -1179,7 +1193,7 @@ H5A__copy(H5A_t *_new_attr, const H5A_t *old_attr) done: if (ret_value == NULL) if (allocated_attr && new_attr && H5A__close(new_attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__copy() */ @@ -1194,9 +1208,6 @@ H5A__copy(H5A_t *_new_attr, const H5A_t *old_attr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, November 15, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -1206,8 +1217,8 @@ H5A__shared_free(H5A_t *attr) FUNC_ENTER_PACKAGE - HDassert(attr); - HDassert(attr->shared); + assert(attr); + assert(attr->shared); /* Free dynamically allocated items. * When possible, keep trying to shut things down (via HDONE_ERROR). @@ -1218,12 +1229,12 @@ H5A__shared_free(H5A_t *attr) } if (attr->shared->dt) { if (H5T_close_real(attr->shared->dt) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release datatype info"); attr->shared->dt = NULL; } if (attr->shared->ds) { if (H5S_close(attr->shared->ds) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release dataspace info"); attr->shared->ds = NULL; } if (attr->shared->data) @@ -1252,15 +1263,15 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj, void **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(attr_vol_obj); + assert(attr_vol_obj); /* Close the attribute */ if (H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute"); /* Free the VOL object */ if (H5VL_free_object(attr_vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1273,9 +1284,6 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj, void **request) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Monday, December 8, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1285,19 +1293,19 @@ H5A__close(H5A_t *attr) FUNC_ENTER_PACKAGE - HDassert(attr); - HDassert(attr->shared); + assert(attr); + assert(attr->shared); /* Close the object's symbol-table entry */ if (attr->obj_opened && (H5O_close(&(attr->oloc), NULL) < 0)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release object header info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release object header info"); /* Reference count can be 0. It only happens when H5A__create fails. */ if (attr->shared->nrefs <= 1) { /* Free dynamically allocated items */ if (attr->shared) if (H5A__shared_free(attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info"); } /* end if */ else { /* There are other references to the shared part of the attribute. @@ -1307,7 +1315,7 @@ H5A__close(H5A_t *attr) /* Free group hierarchy path */ if (H5G_name_free(&(attr->path)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release group hier. path"); attr->shared = NULL; attr = H5FL_FREE(H5A_t, attr); @@ -1326,9 +1334,6 @@ H5A__close(H5A_t *attr) * Return: Success: Ptr to entry * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, August 6, 1998 - * *------------------------------------------------------------------------- */ H5O_loc_t * @@ -1338,7 +1343,7 @@ H5A_oloc(H5A_t *attr) FUNC_ENTER_NOAPI_NOERR - HDassert(attr); + assert(attr); /* Set return value */ ret_value = &(attr->oloc); @@ -1356,9 +1361,6 @@ H5A_oloc(H5A_t *attr) * Return: Success: Ptr to entry * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, September 12, 2005 - * *------------------------------------------------------------------------- */ H5G_name_t * @@ -1368,7 +1370,7 @@ H5A_nameof(H5A_t *attr) FUNC_ENTER_NOAPI_NOERR - HDassert(attr); + assert(attr); /* Set return value */ ret_value = &(attr->path); @@ -1384,9 +1386,6 @@ H5A_nameof(H5A_t *attr) * Return: Success: Ptr to entry * Failure: NULL * - * Programmer: Neil Fortner - * Friday, November 11, 2011 - * *------------------------------------------------------------------------- */ H5T_t * @@ -1396,7 +1395,7 @@ H5A_type(const H5A_t *attr) FUNC_ENTER_NOAPI_NOERR - HDassert(attr); + assert(attr); /* Set return value */ ret_value = attr->shared->dt; @@ -1411,9 +1410,6 @@ H5A_type(const H5A_t *attr) * * Return: TRUE/FALSE/FAIL * - * Programmer: Quincey Koziol - * Thursday, November 1, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1428,9 +1424,9 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(obj_name); - HDassert(attr_name); - HDassert(attr_exists); + assert(obj_name); + assert(attr_name); + assert(attr_exists); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1439,17 +1435,17 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, /* Find the object's location */ if (H5G_loc_find(&loc, obj_name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found"); loc_found = TRUE; /* Check if the attribute exists */ if (H5O__attr_exists(obj_loc.oloc, attr_name, attr_exists) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists"); done: /* Release resources */ if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__exists_by_name() */ @@ -1461,14 +1457,6 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name, * into table. * * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Dec 18 2006 - * - * Modification:Raymond Lu - * 24 June 2008 - * Changed the table of attribute objects to be the table of - * pointers to attribute objects for the ease of operation. *------------------------------------------------------------------------- */ static herr_t @@ -1481,7 +1469,7 @@ H5A__compact_build_table_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out* FUNC_ENTER_PACKAGE /* check args */ - HDassert(mesg); + assert(mesg); /* Re-allocate the table if necessary */ if (udata->curr_attr == udata->atable->nattrs) { @@ -1491,7 +1479,7 @@ H5A__compact_build_table_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out* /* Allocate larger table */ new_table_size = MAX(1, 2 * udata->atable->nattrs); if (NULL == (new_table = (H5A_t **)H5FL_SEQ_REALLOC(H5A_t_ptr, udata->atable->attrs, new_table_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "unable to extend attribute table") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "unable to extend attribute table"); /* Update table information in user data */ udata->atable->attrs = new_table; @@ -1500,7 +1488,7 @@ H5A__compact_build_table_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out* /* Copy attribute into table */ if (NULL == (udata->atable->attrs[udata->curr_attr] = H5A__copy(NULL, (const H5A_t *)mesg->native))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute"); /* Assign [somewhat arbitrary] creation order value, if requested */ if (udata->bogus_crt_idx) @@ -1524,9 +1512,6 @@ H5A__compact_build_table_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out* * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1540,9 +1525,9 @@ H5A__compact_build_table(H5F_t *f, H5O_t *oh, H5_index_t idx_type, H5_iter_order FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(oh); - HDassert(atable); + assert(f); + assert(oh); + assert(atable); /* Initialize table */ atable->attrs = NULL; @@ -1560,7 +1545,7 @@ H5A__compact_build_table(H5F_t *f, H5O_t *oh, H5_index_t idx_type, H5_iter_order op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5A__compact_build_table_cb; if (H5O__msg_iterate_real(f, oh, H5O_MSG_ATTR, &op, &udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error building attribute table") + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error building attribute table"); /* Correct # of attributes in table */ atable->nattrs = udata.curr_attr; @@ -1569,7 +1554,7 @@ H5A__compact_build_table(H5F_t *f, H5O_t *oh, H5_index_t idx_type, H5_iter_order if (atable->nattrs > 0) { /* Sort attribute table in correct iteration order */ if (H5A__attr_sort_table(atable, idx_type, order) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSORT, FAIL, "error sorting attribute table") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSORT, FAIL, "error sorting attribute table"); } /* end if */ done: @@ -1584,9 +1569,6 @@ H5A__compact_build_table(H5F_t *f, H5O_t *oh, H5_index_t idx_type, H5_iter_order * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1598,17 +1580,17 @@ H5A__dense_build_table_cb(const H5A_t *attr, void *_udata) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(attr); - HDassert(udata); - HDassert(udata->curr_attr < udata->atable->nattrs); + assert(attr); + assert(udata); + assert(udata->curr_attr < udata->atable->nattrs); /* Allocate attribute for entry in the table */ if (NULL == (udata->atable->attrs[udata->curr_attr] = H5FL_CALLOC(H5A_t))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate attribute"); /* Copy attribute information. Share the attribute object in copying. */ if (NULL == H5A__copy(udata->atable->attrs[udata->curr_attr], attr)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute"); /* Increment number of attributes stored */ udata->curr_attr++; @@ -1629,9 +1611,6 @@ H5A__dense_build_table_cb(const H5A_t *attr, void *_udata) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1645,20 +1624,20 @@ H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(ainfo); - HDassert(H5F_addr_defined(ainfo->fheap_addr)); - HDassert(H5F_addr_defined(ainfo->name_bt2_addr)); - HDassert(atable); + assert(f); + assert(ainfo); + assert(H5_addr_defined(ainfo->fheap_addr)); + assert(H5_addr_defined(ainfo->name_bt2_addr)); + assert(atable); /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Retrieve # of records in "name" B-tree */ /* (should be same # of records in all indices) */ if (H5B2_get_nrec(bt2_name, &nrec) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index"); /* Set size of table */ H5_CHECK_OVERFLOW(nrec, /* From: */ hsize_t, /* To: */ size_t); @@ -1671,7 +1650,7 @@ H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type, /* Allocate the table to store the attributes */ if ((atable->attrs = (H5A_t **)H5FL_SEQ_CALLOC(H5A_t_ptr, atable->nattrs)) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Set up user data for iteration */ udata.atable = atable; @@ -1684,11 +1663,11 @@ H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type, /* Iterate over the links in the group, building a table of the link messages */ if (H5A__dense_iterate(f, (hid_t)0, ainfo, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, &attr_op, &udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table"); /* Sort attribute table in correct iteration order */ if (H5A__attr_sort_table(atable, idx_type, order) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSORT, FAIL, "error sorting attribute table") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSORT, FAIL, "error sorting attribute table"); } /* end if */ else atable->attrs = NULL; @@ -1696,7 +1675,7 @@ H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type, done: /* Release resources */ if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_build_table() */ @@ -1713,9 +1692,6 @@ H5A__dense_build_table(H5F_t *f, const H5O_ainfo_t *ainfo, H5_index_t idx_type, * as equal, their order in the sorted array is undefined. * (i.e. same as strcmp()) * - * Programmer: Quincey Koziol - * Dec 11 2006 - * *------------------------------------------------------------------------- */ static int @@ -1739,9 +1715,6 @@ H5A__attr_cmp_name_inc(const void *attr1, const void *attr2) * as equal, their order in the sorted array is undefined. * (i.e. opposite of strcmp()) * - * Programmer: Quincey Koziol - * Feb 8 2007 - * *------------------------------------------------------------------------- */ static int @@ -1764,9 +1737,6 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2) * equal to, or greater than the second. If two members compare * as equal, their order in the sorted array is undefined. * - * Programmer: Quincey Koziol - * Feb 8 2007 - * *------------------------------------------------------------------------- */ static int @@ -1798,9 +1768,6 @@ H5A__attr_cmp_corder_inc(const void *attr1, const void *attr2) * equal to, or greater than the first. If two members compare * as equal, their order in the sorted array is undefined. * - * Programmer: Quincey Koziol - * Feb 8 2007 - * *------------------------------------------------------------------------- */ static int @@ -1828,9 +1795,6 @@ H5A__attr_cmp_corder_dec(const void *attr1, const void *attr2) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1839,25 +1803,25 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, H5_iter_orde FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(atable); + assert(atable); /* Pick appropriate comparison routine */ if (idx_type == H5_INDEX_NAME) { if (order == H5_ITER_INC) - HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_name_inc); + qsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_name_inc); else if (order == H5_ITER_DEC) - HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_name_dec); + qsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_name_dec); else - HDassert(order == H5_ITER_NATIVE); + assert(order == H5_ITER_NATIVE); } /* end if */ else { - HDassert(idx_type == H5_INDEX_CRT_ORDER); + assert(idx_type == H5_INDEX_CRT_ORDER); if (order == H5_ITER_INC) - HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_corder_inc); + qsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_corder_inc); else if (order == H5_ITER_DEC) - HDqsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_corder_dec); + qsort(atable->attrs, atable->nattrs, sizeof(H5A_t *), H5A__attr_cmp_corder_dec); else - HDassert(order == H5_ITER_NATIVE); + assert(order == H5_ITER_NATIVE); } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -1871,9 +1835,6 @@ H5A__attr_sort_table(H5A_attr_table_t *atable, H5_index_t idx_type, H5_iter_orde * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1886,15 +1847,15 @@ H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, hsize_t *l FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(atable); - HDassert(attr_op); + assert(atable); + assert(attr_op); /* Skip over attributes, if requested */ if (last_attr) *last_attr = skip; /* Iterate over attribute messages */ - H5_CHECKED_ASSIGN(u, size_t, skip, hsize_t) + H5_CHECKED_ASSIGN(u, size_t, skip, hsize_t); for (; u < atable->nattrs && !ret_value; u++) { /* Check which type of callback to make */ switch (attr_op->op_type) { @@ -1903,7 +1864,7 @@ H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, hsize_t *l /* Get the attribute information */ if (H5A__get_info(atable->attrs[u], &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5_ITER_ERROR, "unable to get attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5_ITER_ERROR, "unable to get attribute info"); /* Make the application callback */ ret_value = (attr_op->u.app_op2)(loc_id, ((atable->attrs[u])->shared)->name, &ainfo, op_data); @@ -1923,9 +1884,9 @@ H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, hsize_t *l break; default: - HDassert("unknown attribute op type" && 0); + assert("unknown attribute op type" && 0); #ifdef NDEBUG - HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unsupported attribute op type") + HGOTO_ERROR(H5E_ATTR, H5E_UNSUPPORTED, FAIL, "unsupported attribute op type"); #endif /* NDEBUG */ } /* end switch */ @@ -1949,9 +1910,6 @@ H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, hsize_t *l * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1962,7 +1920,7 @@ H5A__attr_release_table(H5A_attr_table_t *atable) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(atable); + assert(atable); /* Release attribute info, if any. */ if (atable->nattrs > 0) { @@ -1971,10 +1929,10 @@ H5A__attr_release_table(H5A_attr_table_t *atable) /* Free attribute message information */ for (u = 0; u < atable->nattrs; u++) if (atable->attrs[u] && H5A__close(atable->attrs[u]) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute"); } /* end if */ else - HDassert(atable->attrs == NULL); + assert(atable->attrs == NULL); atable->attrs = (H5A_t **)H5FL_SEQ_FREE(H5A_t_ptr, atable->attrs); @@ -1990,9 +1948,6 @@ H5A__attr_release_table(H5A_attr_table_t *atable) * * Return: TRUE/FALSE/FAIL * - * Programmer: Quincey Koziol - * Mar 11 2007 - * *------------------------------------------------------------------------- */ htri_t @@ -2004,30 +1959,30 @@ H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo) FUNC_ENTER_NOAPI_TAG(oh->cache_info.addr, FAIL) /* check arguments */ - HDassert(f); - HDassert(oh); - HDassert(ainfo); + assert(f); + assert(oh); + assert(ainfo); /* Check if the "attribute info" message exists */ if ((ret_value = H5O_msg_exists_oh(oh, H5O_AINFO_ID)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "unable to check object header") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "unable to check object header"); if (ret_value > 0) { /* Retrieve the "attribute info" structure */ if (NULL == H5O_msg_read_oh(f, oh, H5O_AINFO_ID, ainfo)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't read AINFO message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't read AINFO message"); /* Check if we don't know how many attributes there are */ if (ainfo->nattrs == HSIZET_MAX) { /* Check if we are using "dense" attribute storage */ - if (H5F_addr_defined(ainfo->fheap_addr)) { + if (H5_addr_defined(ainfo->fheap_addr)) { /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, ainfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Retrieve # of records in "name" B-tree */ /* (should be same # of records in all indices) */ if (H5B2_get_nrec(bt2_name, &ainfo->nattrs) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index"); } /* end if */ else /* Retrieve # of attributes from object header */ @@ -2038,7 +1993,7 @@ H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo) done: /* Release resources */ if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5A__get_ainfo() */ @@ -2052,9 +2007,6 @@ H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jul 17 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2068,8 +2020,8 @@ H5A__set_version(const H5F_t *f, H5A_t *attr) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); - HDassert(attr); + assert(f); + assert(attr); /* Check whether datatype and dataspace are shared */ if (H5O_msg_is_shared(H5O_DTYPE_ID, attr->shared->dt) > 0) @@ -2096,7 +2048,7 @@ H5A__set_version(const H5F_t *f, H5A_t *attr) /* Version bounds check */ if (version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_ATTR, H5E_BADRANGE, FAIL, "attribute version out of bounds") + HGOTO_ERROR(H5E_ATTR, H5E_BADRANGE, FAIL, "attribute version out of bounds"); /* Set the message version */ attr->shared->version = version; @@ -2120,9 +2072,6 @@ H5A__set_version(const H5F_t *f, H5A_t *attr) * * Failure: NULL * - * Programmer: Quincey Koziol - * November 1, 2005 - * *------------------------------------------------------------------------- */ H5A_t * @@ -2145,20 +2094,20 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s FUNC_ENTER_PACKAGE /* check args */ - HDassert(attr_src); - HDassert(file_dst); - HDassert(cpy_info); - HDassert(!cpy_info->copy_without_attr); + assert(attr_src); + assert(file_dst); + assert(cpy_info); + assert(!cpy_info->copy_without_attr); /* Allocate space for the destination message */ if (NULL == (attr_dst = H5FL_CALLOC(H5A_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy the top level of the attribute */ *attr_dst = *attr_src; if (NULL == (attr_dst->shared = H5FL_CALLOC(H5A_shared_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared attr structure") + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared attr structure"); /* Don't have an opened group location for copy */ H5O_loc_reset(&(attr_dst->oloc)); @@ -2170,18 +2119,18 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s /* Copy attribute's name */ attr_dst->shared->name = H5MM_strdup(attr_src->shared->name); - HDassert(attr_dst->shared->name); + assert(attr_dst->shared->name); attr_dst->shared->encoding = attr_src->shared->encoding; /* Copy attribute's datatype */ /* If source is named, we will keep dst as named, but we will not actually * copy the target and update the message until post copy */ if (NULL == (attr_dst->shared->dt = H5T_copy(attr_src->shared->dt, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "cannot copy datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "cannot copy datatype"); /* Set the location of the destination datatype */ if (H5T_set_loc(attr_dst->shared->dt, H5F_VOL_OBJ(file_dst), H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "cannot mark datatype on disk") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "cannot mark datatype on disk"); if (!H5T_is_named(attr_src->shared->dt)) { /* If the datatype is not named, it may have been shared in the @@ -2189,36 +2138,36 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s * it in the destination file below. */ if (H5O_msg_reset_share(H5O_DTYPE_ID, attr_dst->shared->dt) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset datatype sharing") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset datatype sharing"); } /* Copy the dataspace for the attribute. Make sure the maximal dimension is also copied. * Otherwise the comparison in the test may complain about it. SLU 2011/4/12 */ attr_dst->shared->ds = H5S_copy(attr_src->shared->ds, FALSE, TRUE); - HDassert(attr_dst->shared->ds); + assert(attr_dst->shared->ds); /* Reset the dataspace's sharing in the source file before trying to share * it in the destination. */ if (H5O_msg_reset_share(H5O_SDSPACE_ID, attr_dst->shared->ds) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset dataspace sharing") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to reset dataspace sharing"); /* Simulate trying to share both the datatype and dataset, to determine the * final size of the messages. This does nothing if the datatype is * committed or sharing is disabled. */ if (H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute datatype"); if (H5SM_try_share(file_dst, NULL, H5SM_DEFER, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "can't share attribute dataspace"); /* Compute the sizes of the datatype and dataspace. This is their raw * size unless they're shared. */ attr_dst->shared->dt_size = H5O_msg_raw_size(file_dst, H5O_DTYPE_ID, FALSE, attr_dst->shared->dt); - HDassert(attr_dst->shared->dt_size > 0); + assert(attr_dst->shared->dt_size > 0); attr_dst->shared->ds_size = H5O_msg_raw_size(file_dst, H5O_SDSPACE_ID, FALSE, attr_dst->shared->ds); - HDassert(attr_dst->shared->ds_size > 0); + assert(attr_dst->shared->ds_size > 0); /* Check whether to recompute the size of the attribute */ /* (happens when the datatype or dataspace changes sharing status) */ @@ -2228,12 +2177,12 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s /* Get # of elements for destination attribute's dataspace */ if ((sdst_nelmts = H5S_GET_EXTENT_NPOINTS(attr_dst->shared->ds)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, NULL, "dataspace is invalid") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, NULL, "dataspace is invalid"); H5_CHECKED_ASSIGN(dst_nelmts, size_t, sdst_nelmts, hssize_t); /* Get size of destination attribute's datatype */ if (0 == (dst_dt_size = H5T_get_size(attr_dst->shared->dt))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size"); /* Compute the size of the data */ attr_dst->shared->data_size = dst_nelmts * dst_dt_size; @@ -2241,7 +2190,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s /* Copy (& convert) the data, if necessary */ if (attr_src->shared->data) { if (NULL == (attr_dst->shared->data = H5FL_BLK_MALLOC(attr_buf, attr_dst->shared->data_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Check if we need to convert data */ if (H5T_detect_class(attr_src->shared->dt, H5T_VLEN, FALSE) > 0) { @@ -2257,40 +2206,40 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s /* Create datatype ID for src datatype */ if ((tid_src = H5I_register(H5I_DATATYPE, attr_src->shared->dt, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register source file datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register source file datatype"); /* create a memory copy of the variable-length datatype */ if (NULL == (dt_mem = H5T_copy(attr_src->shared->dt, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy"); if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register memory datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, "unable to register memory datatype"); /* create variable-length datatype at the destination file */ if ((tid_dst = H5I_register(H5I_DATATYPE, attr_dst->shared->dt, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, - "unable to register destination file datatype") + "unable to register destination file datatype"); /* Set up the conversion functions */ if (NULL == (tpath_src_mem = H5T_path_find(attr_src->shared->dt, dt_mem))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, - "unable to convert between src and mem datatypes") + "unable to convert between src and mem datatypes"); if (NULL == (tpath_mem_dst = H5T_path_find(dt_mem, attr_dst->shared->dt))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, - "unable to convert between mem and dst datatypes") + "unable to convert between mem and dst datatypes"); /* Determine largest datatype size */ if (0 == (src_dt_size = H5T_get_size(attr_src->shared->dt))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size"); if (0 == (tmp_dt_size = H5T_get_size(dt_mem))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size"); max_dt_size = MAX(src_dt_size, tmp_dt_size); if (0 == (tmp_dt_size = H5T_get_size(attr_dst->shared->dt))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to determine datatype size"); max_dt_size = MAX(max_dt_size, tmp_dt_size); /* Set number of whole elements that fit in buffer */ if (0 == (nelmts = attr_src->shared->data_size / src_dt_size)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "element size too large") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "element size too large"); /* Set up number of bytes to copy, and initial buffer size */ buf_size = nelmts * max_dt_size; @@ -2300,50 +2249,50 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s /* Create the space and set the initial extent */ if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace"); /* Register */ if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) { H5S_close(buf_space); - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, NULL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, NULL, "unable to register dataspace ID"); } /* end if */ /* Allocate memory for recclaim buf */ if (NULL == (reclaim_buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation NULLed for raw data chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation NULLed for raw data chunk"); /* Allocate memory for copying the chunk */ if (NULL == (buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation NULLed for raw data chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation NULLed for raw data chunk"); H5MM_memcpy(buf, attr_src->shared->data, attr_src->shared->data_size); /* Allocate background memory */ if (H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst)) if (NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Convert from source file to memory */ if (H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed"); H5MM_memcpy(reclaim_buf, buf, buf_size); /* Set background buffer to all zeros */ if (bkg_buf) - HDmemset(bkg_buf, 0, buf_size); + memset(bkg_buf, 0, buf_size); /* Convert from memory to destination file */ if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed"); H5MM_memcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size); if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "unable to reclaim variable-length data") + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "unable to reclaim variable-length data"); } /* end if */ else { - HDassert(attr_dst->shared->data_size == attr_src->shared->data_size); + assert(attr_dst->shared->data_size == attr_src->shared->data_size); H5MM_memcpy(attr_dst->shared->data, attr_src->shared->data, attr_src->shared->data_size); } /* end else */ } /* end if(attr_src->shared->data) */ @@ -2353,7 +2302,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s /* Recompute the version to encode the destination attribute */ if (H5A__set_version(file_dst, attr_dst) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, NULL, "unable to update attribute version") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, NULL, "unable to update attribute version"); /* Recompute the destination attribute's size, if it's a different version */ if (attr_src->shared->version != attr_dst->shared->version) @@ -2364,19 +2313,19 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s done: if (buf_sid > 0 && H5I_dec_ref(buf_sid) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary dataspace ID") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary dataspace ID"); if (tid_src > 0) /* Don't decrement ID, we want to keep underlying datatype */ if (NULL == H5I_remove(tid_src)) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID"); if (tid_dst > 0) /* Don't decrement ID, we want to keep underlying datatype */ if (NULL == H5I_remove(tid_dst)) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID"); if (tid_mem > 0) /* Decrement the memory datatype ID, it's transient */ if (H5I_dec_ref(tid_mem) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "Can't decrement temporary datatype ID"); if (buf) buf = H5FL_BLK_FREE(attr_buf, buf); if (reclaim_buf) @@ -2386,7 +2335,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s /* Release destination attribute information on failure */ if (!ret_value && attr_dst && H5A__close(attr_dst) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__attr_copy_file() */ @@ -2402,9 +2351,6 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s * * Return: SUCCEED/FAIL * - * Programmer: Peter Cao - * March 6, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -2417,16 +2363,16 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, H5O_l FUNC_ENTER_PACKAGE /* check args */ - HDassert(src_oloc); - HDassert(dst_oloc); - HDassert(attr_dst); - HDassert(attr_src); + assert(src_oloc); + assert(dst_oloc); + assert(attr_dst); + assert(attr_src); file_src = src_oloc->file; file_dst = dst_oloc->file; - HDassert(file_src); - HDassert(file_dst); + assert(file_src); + assert(file_dst); if (H5T_is_named(attr_src->shared->dt)) { H5O_loc_t *src_oloc_dt; /* Pointer to source datatype's object location */ @@ -2434,9 +2380,9 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, H5O_l /* Get group entries for source & destination */ src_oloc_dt = H5T_oloc(attr_src->shared->dt); - HDassert(src_oloc_dt); + assert(src_oloc_dt); dst_oloc_dt = H5T_oloc(attr_dst->shared->dt); - HDassert(dst_oloc_dt); + assert(dst_oloc_dt); /* Reset object location for new object */ H5O_loc_reset(dst_oloc_dt); @@ -2444,7 +2390,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, H5O_l /* Copy the shared object from source to destination */ if (H5O_copy_header_map(src_oloc_dt, dst_oloc_dt, cpy_info, FALSE, NULL, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); /* Update shared message info from named datatype info */ H5T_update_shared(attr_dst->shared->dt); @@ -2454,9 +2400,9 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, H5O_l * datatype is committed or sharing is disabled. */ if (H5SM_try_share(file_dst, NULL, H5SM_WAS_DEFERRED, H5O_DTYPE_ID, attr_dst->shared->dt, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "can't share attribute datatype") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "can't share attribute datatype"); if (H5SM_try_share(file_dst, NULL, H5SM_WAS_DEFERRED, H5O_SDSPACE_ID, attr_dst->shared->ds, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "can't share attribute dataspace") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "can't share attribute dataspace"); /* Only need to fix reference attribute with real data being copied to * another file. @@ -2473,11 +2419,11 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, H5O_l if (H5O_copy_expand_ref(file_src, H5I_INVALID_HID, attr_src->shared->dt, attr_src->shared->data, attr_src->shared->data_size, file_dst, attr_dst->shared->data, cpy_info) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "unable to copy reference attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "unable to copy reference attribute"); } /* end if */ else /* Reset value to zero */ - HDmemset(attr_dst->shared->data, 0, attr_dst->shared->data_size); + memset(attr_dst->shared->data, 0, attr_dst->shared->data_size); } /* end if */ done: @@ -2492,9 +2438,6 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, H5O_l * Return: Success: Non-negative * Failure: Negative * - * Programmer: Peter Cao - * July 20, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -2507,36 +2450,36 @@ H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(attr_src); - HDassert(udata); - HDassert(udata->ainfo); - HDassert(udata->file); - HDassert(udata->cpy_info); + assert(attr_src); + assert(udata); + assert(udata->ainfo); + assert(udata->file); + assert(udata->cpy_info); if (NULL == (attr_dst = H5A__attr_copy_file(attr_src, udata->file, udata->recompute_size, udata->cpy_info))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute"); if (H5A__attr_post_copy_file(udata->oloc_src, attr_src, udata->oloc_dst, attr_dst, udata->cpy_info) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute"); /* Reset shared location information */ if (H5O_msg_reset_share(H5O_ATTR_ID, attr_dst) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to reset attribute sharing") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to reset attribute sharing"); /* Set COPIED tag for destination object's metadata */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) /* Insert attribute into dense storage */ if (H5A__dense_insert(udata->file, udata->ainfo, attr_dst) < 0) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage"); /* Reset metadata tag */ H5_END_TAG done: if (attr_dst && H5A__close(attr_dst) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close destination attribute") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close destination attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__dense_post_copy_file_cb() */ @@ -2548,9 +2491,6 @@ H5A__dense_post_copy_file_cb(const H5A_t *attr_src, void *_udata) * * Return: SUCCEED/FAIL * - * Programmer: Peter Cao - * July 20, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2565,8 +2505,8 @@ H5A__dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainf FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(ainfo_src); - HDassert(ainfo_dst); + assert(ainfo_src); + assert(ainfo_dst); udata.ainfo = ainfo_dst; /* Destination dense information */ udata.file = dst_oloc->file; /* Destination file */ @@ -2580,7 +2520,7 @@ H5A__dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainf if (H5A__dense_iterate(src_oloc->file, (hid_t)0, ainfo_src, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, &attr_op, &udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2593,9 +2533,6 @@ H5A__dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainf * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * February 20, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2618,18 +2555,18 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na /* Find the object's location */ if (H5G_loc_find(&loc, obj_name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found"); loc_found = TRUE; /* Call attribute rename routine */ if (H5O__attr_rename(obj_loc.oloc, old_attr_name, new_attr_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute"); } /* end if */ done: /* Release resources */ if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__rename_by_name() */ @@ -2641,9 +2578,6 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 6, 2017 - * *------------------------------------------------------------------------- */ static herr_t @@ -2740,9 +2674,6 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5 * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 6, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -2781,9 +2712,6 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 6, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -2804,17 +2732,17 @@ H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr /* Find the object's location */ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found"); loc_found = TRUE; /* Delete the attribute from the location */ if (H5O__attr_remove(obj_loc.oloc, attr_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); done: /* Release resources */ if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_name() */ @@ -2826,9 +2754,6 @@ H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 6, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -2850,17 +2775,17 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty /* Find the object's location */ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found"); loc_found = TRUE; /* Delete the attribute from the location */ if (H5O__attr_remove_by_idx(obj_loc.oloc, idx_type, order, n) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); done: /* Release resources */ if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* H5A__delete_by_idx() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5ArrayType.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5ArrayType.cpp deleted file mode 100644 index 953c355105..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5ArrayType.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5ArrayType.h" - -namespace H5 { - -//-------------------------------------------------------------------------- -// Function: ArrayType default constructor -///\brief Default constructor: Creates a stub ArrayType -// Programmer Binh-Minh Ribler - May 2004 -//-------------------------------------------------------------------------- -ArrayType::ArrayType() : DataType() -{ -} - -//-------------------------------------------------------------------------- -// Function: ArrayType overloaded constructor -///\brief Creates an ArrayType object using an existing id. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 -//-------------------------------------------------------------------------- -ArrayType::ArrayType(const hid_t existing_id) : DataType(existing_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: ArrayType copy constructor -///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - May 2004 -//-------------------------------------------------------------------------- -ArrayType::ArrayType(const ArrayType &original) : DataType(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: ArrayType overloaded constructor -///\brief Creates a new array data type based on the specified -/// \a base_type. -///\param base_type - IN: Existing datatype -///\param ndims - IN: Rank of the array, [0..H5S_MAX_RANK] -///\param dims - IN: Size of each array dimension -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 -//-------------------------------------------------------------------------- -ArrayType::ArrayType(const DataType &base_type, int ndims, const hsize_t *dims) : DataType() -{ - if (ndims < 0 || ndims > H5S_MAX_RANK) - throw DataTypeIException("ArrayType constructor", "ndims not in range [0..H5S_MAX_RANK]"); - - // Call C API to create an array data type - hid_t new_type_id = H5Tarray_create2(base_type.getId(), static_cast(ndims), dims); - if (new_type_id < 0) - throw DataTypeIException("ArrayType constructor", "H5Tarray_create2 failed"); - - // Set the id for this object - id = new_type_id; -} - -//-------------------------------------------------------------------------- -// Function: ArrayType overloaded constructor -///\brief Creates an ArrayType instance by opening an HDF5 array datatype -/// given its name, provided as a C character string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Array type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openArrayType(const char*) to -// improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -ArrayType::ArrayType(const H5Location &loc, const char *dtype_name) : DataType() -{ - id = p_opentype(loc, dtype_name); -} - -//-------------------------------------------------------------------------- -// Function: ArrayType overloaded constructor -///\brief Creates an ArrayType instance by opening an HDF5 array datatype -/// given its name, provided as an \c H5std_string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Array type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openArrayType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -ArrayType::ArrayType(const H5Location &loc, const H5std_string &dtype_name) : DataType() -{ - id = p_opentype(loc, dtype_name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: ArrayType::operator= -///\brief Assignment operator -///\param rhs - IN: Reference to the existing array datatype -///\return Reference to ArrayType instance -///\exception H5::DataTypeIException -// Description -// Closes the id on the lhs object first with setId, then copies -// each data member from the rhs object. (Issue HDFFV-9562) -// Programmer Binh-Minh Ribler - Mar 2016 -//-------------------------------------------------------------------------- -ArrayType & -ArrayType::operator=(const ArrayType &rhs) -{ - if (this != &rhs) { - // handling references to this id - try { - setId(rhs.id); - // Note: a = b, so there are two objects with the same hdf5 id - // that's why incRefCount is needed, and it is called by setId - } - catch (Exception &close_error) { - throw DataTypeIException(inMemFunc("operator="), close_error.getDetailMsg()); - } - } - return (*this); -} - -//-------------------------------------------------------------------------- -// Function: ArrayType::decode -///\brief Returns an ArrayType object via DataType* by decoding the -/// binary object description of this type. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -DataType * -ArrayType::decode() const -{ - hid_t encoded_arrtype_id = H5I_INVALID_HID; - try { - encoded_arrtype_id = p_decode(); - } - catch (DataTypeIException &err) { - throw; - } - ArrayType *encoded_arrtype = new ArrayType; - encoded_arrtype->p_setId(encoded_arrtype_id); - return (encoded_arrtype); -} - -//-------------------------------------------------------------------------- -// Function: ArrayType::getArrayNDims -///\brief Returns the number of dimensions for an array datatype. -///\return Number of dimensions -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 -//-------------------------------------------------------------------------- -int -ArrayType::getArrayNDims() const -{ - // Get the rank of the array type specified by id from the C API - int ndims = H5Tget_array_ndims(id); - if (ndims < 0) { - throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed"); - } - - return (ndims); -} - -//-------------------------------------------------------------------------- -// Function: ArrayType::getArrayDims -///\brief Retrieves the size of all dimensions of an array datatype. -///\param dims - OUT: Sizes of dimensions -///\return Number of dimensions -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 -//-------------------------------------------------------------------------- -int -ArrayType::getArrayDims(hsize_t *dims) const -{ - // Get the dimensions - int ndims = H5Tget_array_dims2(id, dims); - if (ndims < 0) - throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed"); - - // Return the number of dimensions - return (ndims); -} - -//-------------------------------------------------------------------------- -// Function: ArrayType destructor -///\brief Properly terminates access to this array datatype. -// Programmer Binh-Minh Ribler - May 2004 -//-------------------------------------------------------------------------- -ArrayType::~ArrayType() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Atest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Atest.c index af183c415b..f66377dec9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Atest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Atest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -74,9 +73,6 @@ * * Return: TRUE/FALSE/FAIL * - * Programmer: Quincey Koziol - * Dec 19, 2006 - * *------------------------------------------------------------------------- */ htri_t @@ -89,7 +85,7 @@ H5A__is_shared_test(hid_t attr_id) /* Check arguments */ if (NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute"); /* Check if attribute is shared */ ret_value = H5O_msg_is_shared(H5O_ATTR_ID, attr); @@ -105,9 +101,6 @@ H5A__is_shared_test(hid_t attr_id) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 19, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -121,23 +114,23 @@ H5A__get_shared_rc_test(hid_t attr_id, hsize_t *ref_count) /* Check arguments */ if (NULL == (attr = (H5A_t *)H5VL_object_verify(attr_id, H5I_ATTR))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute"); /* Push API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Sanity check */ - HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr)); + assert(H5O_msg_is_shared(H5O_ATTR_ID, attr)); /* Retrieve ref count for shared or shareable attribute */ if (H5SM_get_refcount(attr->oloc.file, H5O_ATTR_ID, &attr->sh_loc, ref_count) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count"); done: if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_ATTR, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5A__get_shared_rc_test() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5AtomType.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5AtomType.cpp deleted file mode 100644 index 0b480464c9..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5AtomType.cpp +++ /dev/null @@ -1,304 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5AtomType.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: AtomType default constructor [protected] -// Purpose Default constructor: creates a stub atomic datatype. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -AtomType::AtomType() : DataType() -{ -} - -//-------------------------------------------------------------------------- -// Function: AtomType overloaded constructor [protected] -// Purpose Creates an AtomType object using an existing id. -// Parameter existing_id - IN: Id of an existing datatype -// Exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -AtomType::AtomType(const hid_t existing_id) : DataType(existing_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: AtomType copy constructor -///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -AtomType::AtomType(const AtomType &original) : DataType(original) -{ -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: AtomType::setSize -///\brief Sets the total size for an atomic datatype. -///\param size - IN: Size to set -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -AtomType::setSize(size_t size) const -{ - // Call C routine H5Tset_size to set the total size - herr_t ret_value = H5Tset_size(id, size); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("setSize"), "H5Tset_size failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: AtomType::getOrder -///\brief Returns the byte order of an atomic datatype. -///\return Byte order, which can be: -/// \li \c H5T_ORDER_LE -/// \li \c H5T_ORDER_BE -/// \li \c H5T_ORDER_VAX -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Mar, 2005 -//-------------------------------------------------------------------------- -H5T_order_t -AtomType::getOrder() const -{ - // Call C routine to get the byte ordering - H5T_order_t type_order = H5Tget_order(id); - - // return a byte order constant if successful - if (type_order == H5T_ORDER_ERROR) { - throw DataTypeIException(inMemFunc("getOrder"), "H5Tget_order returns H5T_ORDER_ERROR"); - } - return (type_order); -} - -//-------------------------------------------------------------------------- -// Function: AtomType::getOrder -///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c H5std_string for the buffer that -/// provide the text description of the returned byte order. -/// The text description can be either of the following: -/// "Little endian byte ordering (0)"; -/// "Big endian byte ordering (1)"; -/// "VAX mixed byte ordering (2)"; -///\param order_string - OUT: Text description of the returned byte order -///\return Byte order, which can be: -/// \li \c H5T_ORDER_LE -/// \li \c H5T_ORDER_BE -/// \li \c H5T_ORDER_VAX -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5T_order_t -AtomType::getOrder(H5std_string &order_string) const -{ - // Call the overloaded to get the type order without text - H5T_order_t type_order = getOrder(); - - // Then provide the text and return the type order - if (type_order == H5T_ORDER_LE) - order_string = "Little endian byte ordering (0)"; - else if (type_order == H5T_ORDER_BE) - order_string = "Big endian byte ordering (1)"; - else if (type_order == H5T_ORDER_VAX) - order_string = "VAX mixed byte ordering (2)"; - return (type_order); -} - -//-------------------------------------------------------------------------- -// Function: AtomType::setOrder -///\brief Sets the byte ordering of an atomic datatype. -///\param order - IN: Byte ordering constant, which can be: -/// \li \c H5T_ORDER_LE -/// \li \c H5T_ORDER_BE -/// \li \c H5T_ORDER_VAX -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -AtomType::setOrder(H5T_order_t order) const -{ - // Call C routine to set the byte ordering - herr_t ret_value = H5Tset_order(id, order); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("setOrder"), "H5Tset_order failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: AtomType::getPrecision -///\brief Returns the precision of an atomic datatype. -///\return Number of significant bits -///\exception H5::DataTypeIException -///\par Description -/// The precision is the number of significant bits which, -/// unless padding is present, is 8 times larger than the -/// value returned by \c DataType::getSize(). -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -size_t -AtomType::getPrecision() const -{ - size_t num_signi_bits = H5Tget_precision(id); // C routine - - // returns number of significant bits if successful - if (num_signi_bits == 0) { - throw DataTypeIException(inMemFunc("getPrecision"), - "H5Tget_precision returns invalid number of significant bits"); - } - return (num_signi_bits); -} - -//-------------------------------------------------------------------------- -// Function: AtomType::setPrecision -///\brief Sets the precision of an atomic datatype. -///\param precision - IN: Number of bits of precision -///\exception H5::DataTypeIException -///\par Description -/// For information, please refer to the H5Tset_precision API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -AtomType::setPrecision(size_t precision) const -{ - // Call C routine to set the datatype precision - herr_t ret_value = H5Tset_precision(id, precision); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("setPrecision"), "H5Tset_precision failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: AtomType::getOffset -///\brief Retrieves the bit offset of the first significant bit. -///\return Offset value -///\exception H5::DataTypeIException -///\par Description -/// For information, please refer to the H5Tget_offset API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// 12/05/00: due to C API change -// - return type changed from size_t to int -// - offset = -1 when failure occurs vs. 0 -//-------------------------------------------------------------------------- -int -AtomType::getOffset() const -{ - int offset = H5Tget_offset(id); // C routine - - // returns a non-negative offset value if successful - if (offset == -1) { - throw DataTypeIException(inMemFunc("getOffset"), "H5Tget_offset returns a negative offset value"); - } - return (offset); -} - -//-------------------------------------------------------------------------- -// Function: AtomType::setOffset -///\brief Sets the bit offset of the first significant bit. -///\param offset - IN: Offset of first significant bit -///\exception H5::DataTypeIException -///\par Description -/// For information, please refer to the H5Tset_offset API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -AtomType::setOffset(size_t offset) const -{ - // Call C routine to set the bit offset - herr_t ret_value = H5Tset_offset(id, offset); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("setOffset"), "H5Tset_offset failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: AtomType::getPad -///\brief Retrieves the padding type of the least and most-significant -/// bit padding. -///\param lsb - OUT: Least-significant bit padding type -///\param msb - OUT: Most-significant bit padding type -///\exception H5::DataTypeIException -///\par Description -/// Possible values for \a lsb and \a msb include: -/// \li \c H5T_PAD_ZERO (0) - Set background to zeros. -/// \li \c H5T_PAD_ONE (1) - Set background to ones. -/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -AtomType::getPad(H5T_pad_t &lsb, H5T_pad_t &msb) const -{ - // Call C routine to get the padding type - herr_t ret_value = H5Tget_pad(id, &lsb, &msb); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("getPad"), "H5Tget_pad failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: AtomType::setPad -///\brief Sets the least and most-significant bits padding types. -///\param lsb - IN: Least-significant bit padding type -///\param msb - IN: Most-significant bit padding type -///\exception H5::DataTypeIException -///\par Description -/// Valid values for \a lsb and \a msb include: -/// \li \c H5T_PAD_ZERO (0) - Set background to zeros. -/// \li \c H5T_PAD_ONE (1) - Set background to ones. -/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const -{ - // Call C routine to set the padding type - herr_t ret_value = H5Tset_pad(id, lsb, msb); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("setPad"), "H5Tset_pad failed"); - } -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: AtomType destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -AtomType::~AtomType() -{ -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Attribute.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5Attribute.cpp deleted file mode 100644 index 8fd25433fa..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Attribute.cpp +++ /dev/null @@ -1,631 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5FaccProp.h" -#include "H5FcreatProp.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5AbstractDs.h" -#include "H5DataType.h" -#include "H5DataSpace.h" -#include "H5Attribute.h" - -namespace H5 { -using std::cerr; -using std::endl; - -class H5Object; // forward declaration for UserData4Aiterate - -//-------------------------------------------------------------------------- -// Function: Attribute default constructor -///\brief Default constructor: Creates a stub attribute -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) -{ -} - -//-------------------------------------------------------------------------- -// Function: Attribute copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param original - IN: Original Attribute object to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute::Attribute(const Attribute &original) : AbstractDs(), H5Location(), id(original.id) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: Attribute overloaded constructor -///\brief Creates an Attribute object using the id of an existing -/// attribute. -///\param existing_id - IN: Id of an existing attribute -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(existing_id) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: Attribute::write -///\brief Writes data to this attribute. -///\param mem_type - IN: Attribute datatype (in memory) -///\param buf - IN: Data to be written -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Attribute::write(const DataType &mem_type, const void *buf) const -{ - herr_t ret_value = H5Awrite(id, mem_type.getId(), buf); - if (ret_value < 0) { - throw AttributeIException("Attribute::write", "H5Awrite failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: Attribute::write -///\brief This is an overloaded member function, provided for convenience. -/// It writes a \a H5std_string to this attribute. -///\param mem_type - IN: Attribute datatype (in memory) -///\param strg - IN: Data to be written -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Apr, 2003 -//-------------------------------------------------------------------------- -void -Attribute::write(const DataType &mem_type, const H5std_string &strg) const -{ - // Check if this attribute has variable-len string or fixed-len string and - // proceed appropriately. - htri_t is_variable_len = H5Tis_variable_str(mem_type.getId()); - if (is_variable_len < 0) { - throw AttributeIException("Attribute::write", "H5Tis_variable_str failed"); - } - // Convert string to C-string - const char *strg_C; - strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str - herr_t ret_value = 0; - - // Pass string in differently depends on variable or fixed length - if (!is_variable_len) { - ret_value = H5Awrite(id, mem_type.getId(), strg_C); - } - else { - // passing third argument by address - ret_value = H5Awrite(id, mem_type.getId(), &strg_C); - } - if (ret_value < 0) { - throw AttributeIException("Attribute::write", "H5Awrite failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: Attribute::read -///\brief Reads data from this attribute. -///\param mem_type - IN: Attribute datatype (in memory) -///\param buf - OUT: Buffer for read data -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Attribute::read(const DataType &mem_type, void *buf) const -{ - herr_t ret_value = H5Aread(id, mem_type.getId(), buf); - if (ret_value < 0) { - throw AttributeIException("Attribute::read", "H5Aread failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: Attribute::read -///\brief This is an overloaded member function, provided for convenience. -/// It reads a \a H5std_string from this attribute. -///\param mem_type - IN: Attribute datatype (in memory) -///\param strg - IN: Buffer for read string -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Apr, 2003 -// Modification -// Mar 2008 -// Corrected a misunderstanding that H5Aread would allocate -// space for the buffer. Obtained the attribute size and -// allocated memory properly. -BMR -// Apr 2009 -// Used getInMemDataSize to get attribute data size. -BMR -// Jul 2009 -// Divided into specific private functions for fixed- and -// variable-len string data: p_read_fixed_len and -// p_read_variable_len. This should improve readability. -BMR -//-------------------------------------------------------------------------- -void -Attribute::read(const DataType &mem_type, H5std_string &strg) const -{ - // Check if this attribute has variable-len string or fixed-len string and - // proceed appropriately. - htri_t is_variable_len = H5Tis_variable_str(mem_type.getId()); - if (is_variable_len < 0) { - throw AttributeIException("Attribute::read", "H5Tis_variable_str failed"); - } - - if (!is_variable_len) // only allocate for fixed-len string - { - p_read_fixed_len(mem_type, strg); - } - else { - p_read_variable_len(mem_type, strg); - } -} - -//-------------------------------------------------------------------------- -// Function: Attribute::getInMemDataSize -///\brief Gets the size in memory of the attribute's data. -///\return Size of data (in memory) -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Apr 2009 -//-------------------------------------------------------------------------- -size_t -Attribute::getInMemDataSize() const -{ - const char *func = "Attribute::getInMemDataSize"; - - // Get the data type of this attribute - hid_t mem_type_id = H5Aget_type(id); - if (mem_type_id < 0) { - throw AttributeIException(func, "H5Aget_type failed"); - } - - // Get the data type's size by first getting its native type then getting - // the native type's size. - hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT); - if (native_type < 0) { - throw AttributeIException(func, "H5Tget_native_type failed"); - } - size_t type_size = H5Tget_size(native_type); - if (type_size == 0) { - throw AttributeIException(func, "H5Tget_size failed"); - } - - // Close the native type and the datatype of this attribute. - if (H5Tclose(native_type) < 0) { - throw DataSetIException(func, "H5Tclose(native_type) failed"); - } - if (H5Tclose(mem_type_id) < 0) { - throw DataSetIException(func, "H5Tclose(mem_type_id) failed"); - } - - // Get number of elements of the attribute by first getting its dataspace - // then getting the number of elements in the dataspace - hid_t space_id = H5Aget_space(id); - if (space_id < 0) { - throw AttributeIException(func, "H5Aget_space failed"); - } - hssize_t num_elements = H5Sget_simple_extent_npoints(space_id); - if (num_elements < 0) { - throw AttributeIException(func, "H5Sget_simple_extent_npoints failed"); - } - - // Close the dataspace - if (H5Sclose(space_id) < 0) { - throw DataSetIException(func, "H5Sclose failed"); - } - - // Calculate and return the size of the data - size_t data_size = type_size * static_cast(num_elements); - - return data_size; -} - -//-------------------------------------------------------------------------- -// Function: Attribute::getSpace -///\brief Gets a copy of the dataspace for this attribute. -///\return Dataspace instance -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataSpace -Attribute::getSpace() const -{ - // Calls C function H5Aget_space to get the id of the dataspace - hid_t dataspace_id = H5Aget_space(id); - - // If the dataspace id is valid, create and return the DataSpace object - if (dataspace_id > 0) { - DataSpace dataspace; - f_DataSpace_setId(&dataspace, dataspace_id); - return (dataspace); - } - else { - throw AttributeIException("Attribute::getSpace", "H5Aget_space failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: Attribute::getName -///\brief Gets the name of this attribute, returning its length. -///\param attr_name - OUT: Buffer for the name string as char* -///\param buf_size - IN: Length of the buffer, default to 0 -///\return Actual length of the attribute name -///\exception H5::AttributeIException -///\par Description -/// This function retrieves \a buf_size chars of the attribute's -/// name including null termination. Thus, if the actual length -/// of the name is more than buf_size-1, the retrieved name will -/// be truncated to accommodate the null terminator. -/// To get length of the attribute's name for buffer allocation, -/// an application can call this function passing in NULL for the -/// first argument and ignore the second argument. -// Programmer Binh-Minh Ribler - Mar, 2014 -//-------------------------------------------------------------------------- -ssize_t -Attribute::getName(char *attr_name, size_t buf_size) const -{ - // H5Aget_name will get buf_size-1 chars of the name to null terminate it - ssize_t name_size = H5Aget_name(id, buf_size, attr_name); - - // If H5Aget_name returns a negative value, raise an exception - if (name_size < 0) { - throw AttributeIException("Attribute::getName", "H5Aget_name failed"); - } - else if (name_size == 0) { - throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0"); - } - // Return length of the name - return (name_size); -} - -//-------------------------------------------------------------------------- -// Function: Attribute::getName -///\brief Returns the name of this attribute as an \a H5std_string. -///\return Name of the attribute -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - May, 2004 -// Modification -// Mar 2014 - BMR -// Revised to use the modified getName() above -//-------------------------------------------------------------------------- -H5std_string -Attribute::getName() const -{ - H5std_string attr_name; // attribute name to return - - // Preliminary call to get the size of the attribute name - ssize_t name_size = H5Aget_name(id, 0, NULL); - - // If H5Aget_name failed, throw exception - if (name_size < 0) { - throw AttributeIException("Attribute::getName", "H5Aget_name failed"); - } - else if (name_size == 0) { - throw AttributeIException("Attribute::getName", "Attribute must have a name, name length is 0"); - } - // Attribute's name exists, retrieve it - else if (name_size > 0) { - // The actual size is the cast value + 1 for the terminal ASCII NUL - // (unfortunate in/out type sign mismatch) - size_t actual_name_size = static_cast(name_size) + 1; - - // Create buffer for C string - char *name_C = new char[actual_name_size](); - - // Use overloaded function - name_size = getName(name_C, actual_name_size); - - // Convert the C attribute name to return - attr_name = name_C; - - // Clean up resource - delete[] name_C; - } - - // Return attribute's name - return attr_name; -} - -//-------------------------------------------------------------------------- -// Function: Attribute::getName -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an integer -/// specifying a desired length to be retrieved of the name. -///\return Name (or part of name) of the attribute -///\param len - IN: Desired length of the name -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -// Modification -// Mar 2014 - BMR -// Revised to use the new getName() below -//-------------------------------------------------------------------------- -H5std_string -Attribute::getName(size_t len) const -{ - H5std_string attr_name; - ssize_t name_size = getName(attr_name, len); - if (name_size < 0) - return (""); - else - return (attr_name); -} - -//-------------------------------------------------------------------------- -// Function: Attribute::getName -///\brief Gets the name of this attribute, returning its length. -///\param attr_name - OUT: Buffer for the name string as \a H5std_string -///\param len - IN: Desired length of the name, default to 0 -///\return Actual length of the attribute name -///\exception H5::AttributeIException -///\par Description -/// This function retrieves the attribute's name as a string. The -/// buf_size can specify a specific length or default to 0, in -/// which case the entire name will be retrieved. -// Programmer Binh-Minh Ribler - Nov, 2001 -// Modification -// Mar 2014 - BMR -// Added to replace getName(size_t, H5std_string&) so that it'll -// allow the argument "len" to be skipped. -//-------------------------------------------------------------------------- -ssize_t -Attribute::getName(H5std_string &attr_name, size_t len) const -{ - ssize_t name_size = 0; - - // If no length is provided, get the entire attribute name - if (len == 0) { - attr_name = getName(); - name_size = static_cast(attr_name.length()); - } - // If length is provided, get that number of characters in name - else { - // Create buffer for C string - char *name_C = new char[len + 1](); - - // Use overloaded function - name_size = getName(name_C, len + 1); - - // Convert the C attribute name to return - attr_name = name_C; - - // Clean up resource - delete[] name_C; - } - // Otherwise, keep attr_name intact - - // Return name size - return name_size; -} - -//-------------------------------------------------------------------------- -// Function: Attribute::getName -// Purpose This function is replaced by the previous function, which -// provides more convenient prototype. It will be removed -// in future release. -// Param len - IN: Desired length of the name -// Param attr_name - OUT: Buffer for the name string -// Return Actual length of the attribute name -// Exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Nov, 2001 -// Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 -//-------------------------------------------------------------------------- -// ssize_t Attribute::getName(size_t len, H5std_string& attr_name) const -//{ -// return (getName(attr_name, len)); -//} - -//-------------------------------------------------------------------------- -// Function: Attribute::getStorageSize -///\brief Returns the amount of storage size required for this attribute. -///\return Size of the storage or 0, for no data -///\exception H5::AttributeIException -// Note: H5Dget_storage_size returns 0 when there is no data. This -// function should have no failure. (from SLU) -// Programmer Binh-Minh Ribler - Mar, 2005 -//-------------------------------------------------------------------------- -hsize_t -Attribute::getStorageSize() const -{ - hsize_t storage_size = H5Aget_storage_size(id); - return (storage_size); -} - -//-------------------------------------------------------------------------- -// Function: Attribute::getId -///\brief Get the id of this attribute -///\return Attribute identifier -// Description: -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 -// Modification -// Aug 2016 - BMR -// Note that Attribute is now inheriting from H5Location, because -// an attribute id can be used to specify a location in HDF5 -// library. -//-------------------------------------------------------------------------- -hid_t -Attribute::getId() const -{ - return (id); -} - -//-------------------------------------------------------------------------- -// Function: Attribute::p_get_type (private) -// Purpose Gets the datatype of this attribute. -// Return Id of the datatype -// Exception H5::AttributeIException -// Description -// This private function is used in AbstractDs. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -hid_t -Attribute::p_get_type() const -{ - hid_t type_id = H5Aget_type(id); - if (type_id > 0) - return (type_id); - else { - throw AttributeIException("", "H5Aget_type failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: Attribute::p_read_fixed_len (private) -// brief Reads a fixed length \a H5std_string from an attribute. -// param mem_type - IN: Attribute datatype (in memory) -// param strg - IN: Buffer for read string -// exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Jul, 2009 -// Modification -// Jul 2009 -// Separated the fixed length case from the original -// Attribute::read -//-------------------------------------------------------------------------- -void -Attribute::p_read_fixed_len(const DataType &mem_type, H5std_string &strg) const -{ - // Only allocate for fixed-len string. - - // Get the size of the attribute's data - size_t attr_size = getInMemDataSize(); - - // If there is data, allocate buffer and read it. - if (attr_size > 0) { - char *strg_C = new char[attr_size + 1]; - herr_t ret_value = H5Aread(id, mem_type.getId(), strg_C); - if (ret_value < 0) { - delete[] strg_C; // de-allocate for fixed-len string - throw AttributeIException("Attribute::read", "H5Aread failed"); - } - // Get string from the C char* and release resource allocated locally - strg_C[attr_size] = '\0'; - strg = strg_C; - delete[] strg_C; - } -} - -//-------------------------------------------------------------------------- -// Function: Attribute::p_read_variable_len (private) -// brief Reads a variable length \a H5std_string from an attribute. -// param mem_type - IN: Attribute datatype (in memory) -// param strg - IN: Buffer for read string -// exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Jul, 2009 -// Modification -// Jul 2009 -// Separated the variable length case from the original -// Attribute::read. -BMR -//-------------------------------------------------------------------------- -void -Attribute::p_read_variable_len(const DataType &mem_type, H5std_string &strg) const -{ - // Prepare and call C API to read attribute. - char *strg_C; - - // Read attribute, no allocation for variable-len string; C library will - herr_t ret_value = H5Aread(id, mem_type.getId(), &strg_C); - - if (ret_value < 0) { - throw AttributeIException("Attribute::read", "H5Aread failed"); - } - - // Get string from the C char* and release resource allocated by C API - strg = strg_C; - free(strg_C); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: Attribute::p_setId -///\brief Sets the identifier of this object to a new value. -/// -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails -// Description: -// The underlying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Attribute::p_setId(const hid_t new_id) -{ - // handling references to this old id - try { - close(); - } - catch (Exception &close_error) { - throw AttributeIException("Attribute::p_setId", close_error.getDetailMsg()); - } - // reset object's id to the given id - id = new_id; -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: Attribute::close -///\brief Closes this attribute. -/// -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 -//-------------------------------------------------------------------------- -void -Attribute::close() -{ - if (p_valid_id(id)) { - herr_t ret_value = H5Aclose(id); - if (ret_value < 0) { - throw AttributeIException("Attribute::close", "H5Aclose failed"); - } - // reset the id - id = H5I_INVALID_HID; - } -} - -//-------------------------------------------------------------------------- -// Function: Attribute destructor -///\brief Properly terminates access to this attribute. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -Attribute::~Attribute() -{ - try { - close(); - } - catch (Exception &close_error) { - cerr << "Attribute::~Attribute - " << close_error.getDetailMsg() << endl; - } -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5B.c b/externals/coda-oss/modules/drivers/hdf5/source/H5B.c index af64e51523..ad53043113 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5B.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5B.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5B.c - * Jul 10 1997 - * Robb Matzke * * Purpose: Implements balanced, sibling-linked, N-ary trees * capable of storing any type of data with unique key @@ -195,9 +192,6 @@ H5FL_SEQ_DEFINE_STATIC(size_t); * * Failure: Negative * - * Programmer: Robb Matzke - * Jun 23 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -212,36 +206,36 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p /*out /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(addr_p); + assert(f); + assert(type); + assert(addr_p); /* * Allocate file and memory data structures. */ if (NULL == (bt = H5FL_MALLOC(H5B_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node") - HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t)); + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node"); + memset(&bt->cache_info, 0, sizeof(H5AC_info_t)); bt->level = 0; bt->left = HADDR_UNDEF; bt->right = HADDR_UNDEF; bt->nchildren = 0; if (NULL == (bt->rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree node buffer") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree node buffer"); H5UC_INC(bt->rc_shared); shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared); - HDassert(shared); + assert(shared); if (NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node"); if (HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node"); /* * Cache the new B-tree node. */ if (H5AC_insert_entry(f, H5AC_BT, *addr_p, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree root node to cache"); #ifdef H5B_DEBUG H5B__assert(f, *addr_p, shared->type, udata); #endif @@ -255,7 +249,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p /*out if (bt) /* Destroy B-tree node */ if (H5B__node_dest(bt) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -278,9 +272,6 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p /*out * through the UDATA argument). Negative on failure (if not found, * UDATA is undefined). * - * Programmer: Robb Matzke - * Jun 23 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -299,18 +290,18 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, hbool_t *found, void * /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(type->decode); - HDassert(type->cmp3); - HDassert(type->found); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(type); + assert(type->decode); + assert(type->cmp3); + assert(type->found); + assert(H5_addr_defined(addr)); /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object"); shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* * Perform a binary search to locate the child which contains @@ -320,7 +311,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, hbool_t *found, void * cache_udata.type = type; cache_udata.rc_shared = rc_shared; if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node"); rt = bt->nchildren; while (lt < rt && cmp) { @@ -339,21 +330,21 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, hbool_t *found, void * /* * Follow the link to the subtree or to the data node. */ - HDassert(idx < bt->nchildren); + assert(idx < bt->nchildren); if (bt->level > 0) { if ((ret_value = H5B_find(f, type, bt->child[idx], found, udata)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in subtree") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in subtree"); } /* end if */ else { if ((ret_value = (type->found)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), found, udata)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't lookup key in leaf node"); } /* end else */ } /* end else */ done: if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_find() */ @@ -374,9 +365,6 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, hbool_t *found, void * * Return: Non-negative on success (The address of the new node is * returned through the NEW_ADDR argument). Negative on failure. * - * Programmer: Robb Matzke - * Jul 3 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -393,38 +381,38 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_ /* * Check arguments. */ - HDassert(f); - HDassert(bt_ud); - HDassert(bt_ud->bt); - HDassert(H5F_addr_defined(bt_ud->addr)); - HDassert(split_bt_ud); - HDassert(!split_bt_ud->bt); + assert(f); + assert(bt_ud); + assert(bt_ud->bt); + assert(H5_addr_defined(bt_ud->addr)); + assert(split_bt_ud); + assert(!split_bt_ud->bt); /* * Initialize variables. */ shared = (H5B_shared_t *)H5UC_GET_OBJ(bt_ud->bt->rc_shared); - HDassert(shared); - HDassert(bt_ud->bt->nchildren == shared->two_k); + assert(shared); + assert(bt_ud->bt->nchildren == shared->two_k); /* Get B-tree split ratios */ if (H5CX_get_btree_split_ratios(split_ratios) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree split ratios") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree split ratios"); #ifdef H5B_DEBUG if (H5DEBUG(B)) { const char *side; - if (!H5F_addr_defined(bt_ud->bt->left) && !H5F_addr_defined(bt_ud->bt->right)) + if (!H5_addr_defined(bt_ud->bt->left) && !H5_addr_defined(bt_ud->bt->right)) side = "ONLY"; - else if (!H5F_addr_defined(bt_ud->bt->right)) + else if (!H5_addr_defined(bt_ud->bt->right)) side = "RIGHT"; - else if (!H5F_addr_defined(bt_ud->bt->left)) + else if (!H5_addr_defined(bt_ud->bt->left)) side = "LEFT"; else side = "MIDDLE"; - HDfprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s", shared->two_k, split_ratios[0], - split_ratios[1], split_ratios[2], side); + fprintf(H5DEBUG(B), "H5B__split: %3u {%5.3f,%5.3f,%5.3f} %6s", shared->two_k, split_ratios[0], + split_ratios[1], split_ratios[2], side); } #endif @@ -432,9 +420,9 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_ * Decide how to split the children of the old node among the old node * and the new node. */ - if (!H5F_addr_defined(bt_ud->bt->right)) + if (!H5_addr_defined(bt_ud->bt->right)) nleft = (unsigned)((double)shared->two_k * split_ratios[2]); /*right*/ - else if (!H5F_addr_defined(bt_ud->bt->left)) + else if (!H5_addr_defined(bt_ud->bt->left)) nleft = (unsigned)((double)shared->two_k * split_ratios[0]); /*left*/ else nleft = (unsigned)((double)shared->two_k * split_ratios[1]); /*middle*/ @@ -451,20 +439,20 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_ nright = shared->two_k - nleft; #ifdef H5B_DEBUG if (H5DEBUG(B)) - HDfprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright); + fprintf(H5DEBUG(B), " split %3d/%-3d\n", nleft, nright); #endif /* * Create the new B-tree node. */ if (H5B_create(f, shared->type, udata, &split_bt_ud->addr /*out*/) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree"); cache_udata.f = f; cache_udata.type = shared->type; cache_udata.rc_shared = bt_ud->bt->rc_shared; if (NULL == (split_bt_ud->bt = (H5B_t *)H5AC_protect(f, H5AC_BT, split_bt_ud->addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree"); split_bt_ud->bt->level = bt_ud->bt->level; /* @@ -490,27 +478,27 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_ split_bt_ud->bt->left = bt_ud->addr; split_bt_ud->bt->right = bt_ud->bt->right; - if (H5F_addr_defined(bt_ud->bt->right)) { + if (H5_addr_defined(bt_ud->bt->right)) { H5B_t *tmp_bt; if (NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, H5AC_BT, bt_ud->bt->right, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load right sibling") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load right sibling"); tmp_bt->left = split_bt_ud->addr; if (H5AC_unprotect(f, H5AC_BT, bt_ud->bt->right, tmp_bt, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); } /* end if */ bt_ud->bt->right = split_bt_ud->addr; - HDassert(bt_ud->cache_flags & H5AC__DIRTIED_FLAG); + assert(bt_ud->cache_flags & H5AC__DIRTIED_FLAG); done: if (ret_value < 0) { if (split_bt_ud->bt && H5AC_unprotect(f, H5AC_BT, split_bt_ud->addr, split_bt_ud->bt, split_bt_ud->cache_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); split_bt_ud->bt = NULL; split_bt_ud->addr = HADDR_UNDEF; split_bt_ud->cache_flags = H5AC__NO_FLAGS_SET; @@ -526,9 +514,6 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, void *udata, H5B_ins_ud_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jun 23 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -557,16 +542,16 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(type->sizeof_nkey <= sizeof _lt_key); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(type); + assert(type->sizeof_nkey <= sizeof _lt_key); + assert(H5_addr_defined(addr)); /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object"); shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* Protect the root node */ cache_udata.f = f; @@ -574,22 +559,22 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) cache_udata.rc_shared = rc_shared; bt_ud.addr = addr; if (NULL == (bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to locate root of B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to locate root of B-tree"); /* Insert the object */ if ((int)(my_ins = H5B__insert_helper(f, &bt_ud, type, lt_key, <_key_changed, md_key, udata, rt_key, &rt_key_changed, &split_bt_ud /*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key"); /* Check if the root node split */ if (H5B_INS_NOOP == my_ins) { /* The root node did not split - just return */ - HDassert(!split_bt_ud.bt); - HGOTO_DONE(SUCCEED) + assert(!split_bt_ud.bt); + HGOTO_DONE(SUCCEED); } /* end if */ - HDassert(H5B_INS_RIGHT == my_ins); - HDassert(split_bt_ud.bt); - HDassert(H5F_addr_defined(split_bt_ud.addr)); + assert(H5B_INS_RIGHT == my_ins); + assert(split_bt_ud.bt); + assert(H5_addr_defined(split_bt_ud.addr)); /* Get level of old root */ level = bt_ud.bt->level; @@ -607,7 +592,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) */ H5_CHECK_OVERFLOW(shared->sizeof_rnode, size_t, hsize_t); if (HADDR_UNDEF == (old_root_addr = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move root"); /* * Move the node to the new location @@ -615,17 +600,17 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) /* Make a copy of the old root information */ if (NULL == (new_root_bt = H5B__copy(bt_ud.bt))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to copy old root") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to copy old root"); /* Unprotect the old root so we can move it. Also force it to be marked * dirty so it is written to the new location. */ if (H5AC_unprotect(f, H5AC_BT, bt_ud.addr, bt_ud.bt, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old root") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release old root"); bt_ud.bt = NULL; /* Make certain future references will be caught */ /* Move the location of the old root on the disk */ if (H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node"); bt_ud.addr = old_root_addr; /* Update the split b-tree's left pointer to point to the new location */ @@ -649,7 +634,7 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) /* Insert the modified copy of the old root into the file again */ if (H5AC_insert_entry(f, H5AC_BT, addr, new_root_bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to add old B-tree root node to cache") + HGOTO_ERROR(H5E_BTREE, H5E_CANTFLUSH, FAIL, "unable to add old B-tree root node to cache"); done: if (ret_value < 0) @@ -658,11 +643,11 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) if (bt_ud.bt) if (H5AC_unprotect(f, H5AC_BT, bt_ud.addr, bt_ud.bt, bt_ud.cache_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect old root") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect old root"); if (split_bt_ud.bt) if (H5AC_unprotect(f, H5AC_BT, split_bt_ud.addr, split_bt_ud.bt, split_bt_ud.cache_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect new child") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to unprotect new child"); #ifdef H5B_DEBUG if (ret_value >= 0) @@ -681,9 +666,6 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 8 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -695,12 +677,12 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5 FUNC_ENTER_PACKAGE_NOERR - HDassert(bt); - HDassert(bt_flags); - HDassert(H5F_addr_defined(child)); + assert(bt); + assert(bt_flags); + assert(H5_addr_defined(child)); shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared); - HDassert(shared); - HDassert(bt->nchildren < shared->two_k); + assert(shared); + assert(bt->nchildren < shared->two_k); /* Check for inserting right-most key into node (common when just appending * records to an unlimited dimension chunked dataset) @@ -721,7 +703,7 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5 } /* end if */ else { /* Make room for the new key */ - HDmemmove(base + shared->type->sizeof_nkey, base, (bt->nchildren - idx) * shared->type->sizeof_nkey); + memmove(base + shared->type->sizeof_nkey, base, (bt->nchildren - idx) * shared->type->sizeof_nkey); H5MM_memcpy(base, md_key, shared->type->sizeof_nkey); /* The MD_KEY is the left key of the new node */ @@ -729,7 +711,7 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5 idx++; /* Make room for the new child address */ - HDmemmove(bt->child + idx + 1, bt->child + idx, (bt->nchildren - idx) * sizeof(haddr_t)); + memmove(bt->child + idx + 1, bt->child + idx, (bt->nchildren - idx) * sizeof(haddr_t)); } /* end if */ bt->child[idx] = child; @@ -766,9 +748,6 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, haddr_t child, H5 * * Failure: H5B_INS_ERROR * - * Programmer: Robb Matzke - * Jul 9 1997 - * *------------------------------------------------------------------------- */ static H5B_ins_t @@ -792,22 +771,22 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 /* * Check arguments */ - HDassert(f); - HDassert(bt_ud); - HDassert(bt_ud->bt); - HDassert(H5F_addr_defined(bt_ud->addr)); - HDassert(type); - HDassert(type->decode); - HDassert(type->cmp3); - HDassert(type->new_node); - HDassert(lt_key); - HDassert(lt_key_changed); - HDassert(rt_key); - HDassert(rt_key_changed); - HDassert(split_bt_ud); - HDassert(!split_bt_ud->bt); - HDassert(!H5F_addr_defined(split_bt_ud->addr)); - HDassert(split_bt_ud->cache_flags == H5AC__NO_FLAGS_SET); + assert(f); + assert(bt_ud); + assert(bt_ud->bt); + assert(H5_addr_defined(bt_ud->addr)); + assert(type); + assert(type->decode); + assert(type->cmp3); + assert(type->new_node); + assert(lt_key); + assert(lt_key_changed); + assert(rt_key); + assert(rt_key_changed); + assert(split_bt_ud); + assert(!split_bt_ud->bt); + assert(!H5_addr_defined(split_bt_ud->addr)); + assert(split_bt_ud->cache_flags == H5AC__NO_FLAGS_SET); bt = bt_ud->bt; @@ -816,9 +795,10 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, + "can't retrieve B-tree's shared ref. count object"); shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* * Use a binary search to find the child that will receive the new @@ -845,10 +825,10 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 * The value being inserted will be the only value in this tree. We * must necessarily be at level zero. */ - HDassert(0 == bt->level); + assert(0 == bt->level); if ((type->new_node)(f, H5B_INS_FIRST, H5B_NKEY(bt, shared, 0), udata, H5B_NKEY(bt, shared, 1), bt->child + 0 /*out*/) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, H5B_INS_ERROR, "unable to create leaf node"); bt->nchildren = 1; bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; idx = 0; @@ -857,7 +837,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 if ((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud.addr /*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert first leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "unable to insert first leaf node"); } /* end if */ else my_ins = H5B_INS_NOOP; @@ -871,12 +851,12 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 child_bt_ud.addr = bt->child[idx]; if (NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node"); if ((int)(my_ins = H5B__insert_helper( f, &child_bt_ud, type, H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud /*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum subtree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum subtree"); } else if (type->follow_min) { /* @@ -887,7 +867,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 if ((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud.addr /*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node"); } else { /* @@ -899,15 +879,16 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 H5MM_memcpy(md_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey); if ((type->new_node)(f, H5B_INS_LEFT, H5B_NKEY(bt, shared, idx), udata, md_key, &new_child_bt_ud.addr /*out*/) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node"); *lt_key_changed = TRUE; } /* end else */ #ifdef H5_STRICT_FORMAT_CHECKS /* Since we are to the left of the leftmost key there must not be a left * sibling */ - if (H5F_addr_defined(bt->left)) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "internal error: likely corrupt key values") + if (H5_addr_defined(bt->left)) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "internal error: likely corrupt key values"); #endif /* H5_STRICT_FORMAT_CHECKS */ } else if (cmp > 0 && idx + 1 >= bt->nchildren) { @@ -920,12 +901,12 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 child_bt_ud.addr = bt->child[idx]; if (NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node"); if ((int)(my_ins = H5B__insert_helper( f, &child_bt_ud, type, H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud /*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum subtree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum subtree"); } else if (type->follow_max) { /* @@ -937,7 +918,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 if ((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud.addr /*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node"); } else { /* @@ -950,15 +931,16 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 H5MM_memcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); if ((type->new_node)(f, H5B_INS_RIGHT, md_key, udata, H5B_NKEY(bt, shared, idx + 1), &new_child_bt_ud.addr /*out*/) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node"); *rt_key_changed = TRUE; } /* end else */ #ifdef H5_STRICT_FORMAT_CHECKS /* Since we are to the right of the rightmost key there must not be a * right sibling */ - if (H5F_addr_defined(bt->right)) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "internal error: likely corrupt key values") + if (H5_addr_defined(bt->right)) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, + "internal error: likely corrupt key values"); #endif /* H5_STRICT_FORMAT_CHECKS */ } else if (cmp) { @@ -966,7 +948,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 * We couldn't figure out which branch to follow out of this node. THIS * IS A MAJOR PROBLEM THAT NEEDS TO BE FIXED --rpm. */ - HDassert("INTERNAL HDF5 ERROR (contact rpm)" && 0); + assert("INTERNAL HDF5 ERROR (contact rpm)" && 0); #ifdef NDEBUG HDabort(); #endif /* NDEBUG */ @@ -975,28 +957,28 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 /* * Follow a branch out of this node to another subtree. */ - HDassert(idx < bt->nchildren); + assert(idx < bt->nchildren); child_bt_ud.addr = bt->child[idx]; if (NULL == (child_bt_ud.bt = (H5B_t *)H5AC_protect(f, H5AC_BT, child_bt_ud.addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load node"); if ((int)(my_ins = H5B__insert_helper(f, &child_bt_ud, type, H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud /*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert subtree"); } else { /* * Follow a branch out of this node to a leaf node of some other type. */ - HDassert(idx < bt->nchildren); + assert(idx < bt->nchildren); if ((int)(my_ins = (type->insert)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, md_key, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed, &new_child_bt_ud.addr /*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert leaf node"); } - HDassert((int)my_ins >= 0); + assert((int)my_ins >= 0); /* * Update the left and right keys of the current node. @@ -1004,8 +986,8 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 if (*lt_key_changed) { bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; if (idx > 0) { - HDassert(type->critical_key == H5B_LEFT); - HDassert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins)); + assert(type->critical_key == H5B_LEFT); + assert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins)); *lt_key_changed = FALSE; } /* end if */ else @@ -1014,8 +996,8 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 if (*rt_key_changed) { bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; if (idx + 1 < bt->nchildren) { - HDassert(type->critical_key == H5B_RIGHT); - HDassert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins)); + assert(type->critical_key == H5B_RIGHT); + assert(!(H5B_INS_LEFT == my_ins || H5B_INS_RIGHT == my_ins)); *rt_key_changed = FALSE; } /* end if */ else @@ -1025,13 +1007,13 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 /* * Handle changes/additions to children */ - HDassert(!(bt->level == 0) != !(child_bt_ud.bt)); + assert(!(bt->level == 0) != !(child_bt_ud.bt)); if (H5B_INS_CHANGE == my_ins) { /* * The insertion simply changed the address for the child. */ - HDassert(!child_bt_ud.bt); - HDassert(bt->level == 0); + assert(!child_bt_ud.bt); + assert(bt->level == 0); bt->child[idx] = new_child_bt_ud.addr; bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; } @@ -1044,7 +1026,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 */ if (bt->nchildren == shared->two_k) { if (H5B__split(f, bt_ud, idx, udata, split_bt_ud /*out*/) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, H5B_INS_ERROR, "unable to split node"); if (idx < bt->nchildren) { tmp_bt = bt; tmp_bt_flags_ptr = &bt_ud->cache_flags; @@ -1062,7 +1044,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 /* Insert the child */ if (H5B__insert_child(tmp_bt, tmp_bt_flags_ptr, idx, new_child_bt_ud.addr, my_ins, md_key) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert child"); } /* end else-if */ /* @@ -1078,7 +1060,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 * in the new node. */ cmp = (type->cmp2)(H5B_NKEY(bt, shared, bt->nchildren), udata, H5B_NKEY(split_bt_ud->bt, shared, 0)); - HDassert(0 == cmp); + assert(0 == cmp); #endif } /* end if */ else @@ -1087,12 +1069,12 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 done: if (child_bt_ud.bt) if (H5AC_unprotect(f, H5AC_BT, child_bt_ud.addr, child_bt_ud.bt, child_bt_ud.cache_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to unprotect child") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to unprotect child"); if (new_child_bt_ud.bt) if (H5AC_unprotect(f, H5AC_BT, new_child_bt_ud.addr, new_child_bt_ud.bt, new_child_bt_ud.cache_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to unprotect new child") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to unprotect new child"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_insert_helper() */ @@ -1105,9 +1087,6 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, uint8 * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jun 23 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -1125,24 +1104,24 @@ H5B__iterate_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operato /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(H5F_addr_defined(addr)); - HDassert(op); - HDassert(udata); + assert(f); + assert(type); + assert(H5_addr_defined(addr)); + assert(op); + assert(udata); /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object"); shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* Protect the initial/current node */ cache_udata.f = f; cache_udata.type = type; cache_udata.rc_shared = rc_shared; if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load B-tree node"); /* Iterate over node's children */ for (u = 0; u < bt->nchildren && ret_value == H5_ITER_CONT; u++) { @@ -1156,7 +1135,7 @@ H5B__iterate_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operato done: if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B__iterate_helper() */ @@ -1169,9 +1148,6 @@ H5B__iterate_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operato * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jun 23 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1184,11 +1160,11 @@ H5B_iterate(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operator_t op, /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(H5F_addr_defined(addr)); - HDassert(op); - HDassert(udata); + assert(f); + assert(type); + assert(H5_addr_defined(addr)); + assert(op); + assert(udata); /* Iterate over the B-tree records */ if ((ret_value = H5B__iterate_helper(f, type, addr, op, udata)) < 0) @@ -1216,9 +1192,6 @@ H5B_iterate(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_operator_t op, * * Failure: H5B_INS_ERROR, a negative value. * - * Programmer: Robb Matzke - * Wednesday, September 16, 1998 - * *------------------------------------------------------------------------- */ static H5B_ins_t @@ -1237,20 +1210,21 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(type); - HDassert(type->decode); - HDassert(type->cmp3); - HDassert(lt_key && lt_key_changed); - HDassert(udata); - HDassert(rt_key && rt_key_changed); + assert(f); + assert(H5_addr_defined(addr)); + assert(type); + assert(type->decode); + assert(type->cmp3); + assert(lt_key && lt_key_changed); + assert(udata); + assert(rt_key && rt_key_changed); /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, H5B_INS_ERROR, + "can't retrieve B-tree's shared ref. count object"); shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* * Perform a binary search to locate the child which contains the thing @@ -1260,7 +1234,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u cache_udata.type = type; cache_udata.rc_shared = rc_shared; if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to load B-tree node"); rt = bt->nchildren; while (lt < rt && cmp) { @@ -1271,20 +1245,20 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u lt = idx + 1; } /* end while */ if (cmp) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "B-tree key not found") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "B-tree key not found"); /* * Follow the link to the subtree or to the data node. The return value * will be one of H5B_INS_ERROR, H5B_INS_NOOP, or H5B_INS_REMOVE. */ - HDassert(idx < bt->nchildren); + assert(idx < bt->nchildren); if (bt->level > 0) { /* We're at an internal node -- call recursively */ if ((int)(ret_value = H5B__remove_helper(f, bt->child[idx], type, level + 1, H5B_NKEY(bt, shared, idx) /*out*/, lt_key_changed /*out*/, udata, H5B_NKEY(bt, shared, idx + 1) /*out*/, rt_key_changed /*out*/)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in subtree") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in subtree"); } else if (type->remove) { /* @@ -1294,7 +1268,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u */ if ((int)(ret_value = (type->remove)(f, bt->child[idx], H5B_NKEY(bt, shared, idx), lt_key_changed, udata, H5B_NKEY(bt, shared, idx + 1), rt_key_changed)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in leaf node"); } else { /* @@ -1316,7 +1290,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u * our right key and indicate that it changed. */ if (*lt_key_changed) { - HDassert(type->critical_key == H5B_LEFT); + assert(type->critical_key == H5B_LEFT); bt_flags |= H5AC__DIRTIED_FLAG; if (idx > 0) @@ -1326,7 +1300,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey); } /* end if */ if (*rt_key_changed) { - HDassert(type->critical_key == H5B_RIGHT); + assert(type->critical_key == H5B_RIGHT); bt_flags |= H5AC__DIRTIED_FLAG; if (idx + 1 < bt->nchildren) /* Don't propagate change out of this B-tree node */ @@ -1343,8 +1317,8 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u /* Clients should not change keys when a node is removed. This function * will handle it as appropriate, based on the value of bt->critical_key */ - HDassert(!(*lt_key_changed)); - HDassert(!(*rt_key_changed)); + assert(!(*lt_key_changed)); + assert(!(*rt_key_changed)); if (1 == bt->nchildren) { /* @@ -1359,11 +1333,11 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u * between siblings. Overwrite the key that that is not * "critical" for any child in its node to maintain this * consistency (and avoid breaking key/child consistency) */ - if (H5F_addr_defined(bt->left)) { + if (H5_addr_defined(bt->left)) { if (NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, - "unable to load node from tree") + "unable to load node from tree"); /* Copy right-most key from deleted node to right-most key * in its left neighbor, but only if it is not the critical @@ -1376,14 +1350,14 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u if (H5AC_unprotect(f, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, - "unable to release node from tree") + "unable to release node from tree"); sibling = NULL; /* Make certain future references will be caught */ } /* end if */ - if (H5F_addr_defined(bt->right)) { + if (H5_addr_defined(bt->right)) { if (NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->right, &cache_udata, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, - "unable to unlink node from tree") + "unable to unlink node from tree"); /* Copy left-most key from deleted node to left-most key in * its right neighbor, but only if it is not the critical @@ -1395,7 +1369,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u if (H5AC_unprotect(f, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, - "unable to release node from tree") + "unable to release node from tree"); sibling = NULL; /* Make certain future references will be caught */ } /* end if */ @@ -1410,7 +1384,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u if (H5AC_unprotect(f, H5AC_BT, addr, bt, bt_flags | H5AC__DELETED_FLAG) < 0) { bt = NULL; bt_flags = H5AC__NO_FLAGS_SET; - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to free B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to free B-tree node"); } /* end if */ bt = NULL; bt_flags = H5AC__NO_FLAGS_SET; @@ -1431,8 +1405,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u */ if (type->critical_key == H5B_LEFT) { /* Slide all keys down 1, update lt_key */ - HDmemmove(H5B_NKEY(bt, shared, 0), H5B_NKEY(bt, shared, 1), - bt->nchildren * type->sizeof_nkey); + memmove(H5B_NKEY(bt, shared, 0), H5B_NKEY(bt, shared, 1), bt->nchildren * type->sizeof_nkey); H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey); *lt_key_changed = TRUE; } @@ -1440,10 +1413,10 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u /* Slide all but the leftmost 2 keys down, leaving the leftmost * key intact (the right key of the leftmost child is * overwritten) */ - HDmemmove(H5B_NKEY(bt, shared, 1), H5B_NKEY(bt, shared, 2), - (bt->nchildren - 1) * type->sizeof_nkey); + memmove(H5B_NKEY(bt, shared, 1), H5B_NKEY(bt, shared, 2), + (bt->nchildren - 1) * type->sizeof_nkey); - HDmemmove(bt->child, bt->child + 1, (bt->nchildren - 1) * sizeof(haddr_t)); + memmove(bt->child, bt->child + 1, (bt->nchildren - 1) * sizeof(haddr_t)); bt->nchildren -= 1; bt_flags |= H5AC__DIRTIED_FLAG; @@ -1458,8 +1431,8 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u if (type->critical_key == H5B_LEFT) /* Slide the rightmost key down one, overwriting the left key of * the deleted (rightmost) child */ - HDmemmove(H5B_NKEY(bt, shared, bt->nchildren - 1), H5B_NKEY(bt, shared, bt->nchildren), - type->sizeof_nkey); + memmove(H5B_NKEY(bt, shared, bt->nchildren - 1), H5B_NKEY(bt, shared, bt->nchildren), + type->sizeof_nkey); else { /* Just update rt_key */ H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1), type->sizeof_nkey); @@ -1479,13 +1452,13 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u * Return H5B_INS_NOOP. */ if (type->critical_key == H5B_LEFT) - HDmemmove(H5B_NKEY(bt, shared, idx), H5B_NKEY(bt, shared, idx + 1), - (bt->nchildren - idx) * type->sizeof_nkey); + memmove(H5B_NKEY(bt, shared, idx), H5B_NKEY(bt, shared, idx + 1), + (bt->nchildren - idx) * type->sizeof_nkey); else - HDmemmove(H5B_NKEY(bt, shared, idx + 1), H5B_NKEY(bt, shared, idx + 2), - (bt->nchildren - 1 - idx) * type->sizeof_nkey); + memmove(H5B_NKEY(bt, shared, idx + 1), H5B_NKEY(bt, shared, idx + 2), + (bt->nchildren - 1 - idx) * type->sizeof_nkey); - HDmemmove(bt->child + idx, bt->child + idx + 1, (bt->nchildren - 1 - idx) * sizeof(haddr_t)); + memmove(bt->child + idx, bt->child + idx + 1, (bt->nchildren - 1 - idx) * sizeof(haddr_t)); bt->nchildren -= 1; bt_flags |= H5AC__DIRTIED_FLAG; @@ -1496,40 +1469,40 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u ret_value = H5B_INS_NOOP; /* Patch keys in neighboring trees if necessary */ - if (*lt_key_changed && H5F_addr_defined(bt->left)) { - HDassert(type->critical_key == H5B_LEFT); - HDassert(level > 0); + if (*lt_key_changed && H5_addr_defined(bt->left)) { + assert(type->critical_key == H5B_LEFT); + assert(level > 0); /* Update the rightmost key in the left sibling */ if (NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node"); H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren), H5B_NKEY(bt, shared, 0), type->sizeof_nkey); if (H5AC_unprotect(f, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree"); sibling = NULL; /* Make certain future references will be caught */ } /* end if */ - else if (*rt_key_changed && H5F_addr_defined(bt->right)) { - HDassert(type->critical_key == H5B_RIGHT); - HDassert(level > 0); + else if (*rt_key_changed && H5_addr_defined(bt->right)) { + assert(type->critical_key == H5B_RIGHT); + assert(level > 0); /* Update the lefttmost key in the right sibling */ if (NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->right, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node"); H5MM_memcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey); if (H5AC_unprotect(f, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node from tree"); sibling = NULL; /* Make certain future references will be caught */ } /* end else */ done: if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, bt_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B__remove_helper() */ @@ -1545,9 +1518,6 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, u * Return: Non-negative on success/Negative on failure (failure includes * not being able to find the object which is to be removed). * - * Programmer: Robb Matzke - * Wednesday, September 16, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1564,15 +1534,15 @@ H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(f); - HDassert(type); - HDassert(type->sizeof_nkey <= sizeof _lt_key); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(type); + assert(type->sizeof_nkey <= sizeof _lt_key); + assert(H5_addr_defined(addr)); /* The actual removal */ if (H5B_INS_ERROR == H5B__remove_helper(f, addr, type, 0, lt_key, <_key_changed, udata, rt_key, &rt_key_changed)) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to remove entry from B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to remove entry from B-tree"); #ifdef H5B_DEBUG H5B__assert(f, addr, type, udata); @@ -1589,9 +1559,6 @@ H5B_remove(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1607,29 +1574,29 @@ H5B_delete(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(f); - HDassert(type); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(type); + assert(H5_addr_defined(addr)); /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object"); shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* Lock this B-tree node into memory for now */ cache_udata.f = f; cache_udata.type = type; cache_udata.rc_shared = rc_shared; if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node"); /* Iterate over all children in tree, deleting them */ if (bt->level > 0) { /* Iterate over all children in node, deleting them */ for (u = 0; u < bt->nchildren; u++) if (H5B_delete(f, type, bt->child[u], udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to delete B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to delete B-tree node"); } /* end if */ else { @@ -1642,14 +1609,14 @@ H5B_delete(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) /* Call user's callback for each entry */ if ((type->remove)(f, bt->child[u], H5B_NKEY(bt, shared, u), <_key_changed, udata, H5B_NKEY(bt, shared, u + 1), &rt_key_changed) < H5B_INS_NOOP) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't remove B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "can't remove B-tree node"); } /* end for */ } /* end if */ } /* end else */ done: if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node in cache") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node in cache"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_delete() */ @@ -1662,9 +1629,6 @@ H5B_delete(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) * Return: Success: non-NULL pointer to struct allocated * Failure: NULL * - * Programmer: Quincey Koziol - * May 27 2008 - * *------------------------------------------------------------------------- */ H5B_shared_t * @@ -1679,11 +1643,11 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) /* * Check arguments. */ - HDassert(type); + assert(type); /* Allocate space for the shared structure */ if (NULL == (shared = H5FL_CALLOC(H5B_shared_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for shared B-tree info") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for shared B-tree info"); /* Set up the "global" information for this file's groups */ shared->type = type; @@ -1691,20 +1655,20 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) shared->sizeof_addr = H5F_SIZEOF_ADDR(f); shared->sizeof_len = H5F_SIZEOF_SIZE(f); shared->sizeof_rkey = sizeof_rkey; - HDassert(shared->sizeof_rkey); + assert(shared->sizeof_rkey); shared->sizeof_keys = (shared->two_k + 1) * type->sizeof_nkey; shared->sizeof_rnode = ((size_t)H5B_SIZEOF_HDR(f) + /*node header */ shared->two_k * H5F_SIZEOF_ADDR(f) + /*child pointers */ (shared->two_k + 1) * shared->sizeof_rkey); /*keys */ - HDassert(shared->sizeof_rnode); + assert(shared->sizeof_rnode); /* Allocate and clear shared buffers */ if (NULL == (shared->page = H5FL_BLK_MALLOC(page, shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page") - HDmemset(shared->page, 0, shared->sizeof_rnode); + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page"); + memset(shared->page, 0, shared->sizeof_rnode); if (NULL == (shared->nkey = H5FL_SEQ_MALLOC(size_t, (size_t)(shared->two_k + 1)))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys"); /* Initialize the offsets into the native key buffer */ for (u = 0; u < (shared->two_k + 1); u++) @@ -1733,9 +1697,6 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, May 27, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -1766,9 +1727,6 @@ H5B_shared_free(void *_shared) * * Failure: NULL * - * Programmer: Quincey Koziol - * Apr 18 2000 - * *------------------------------------------------------------------------- */ static H5B_t * @@ -1783,23 +1741,23 @@ H5B__copy(const H5B_t *old_bt) /* * Check arguments. */ - HDassert(old_bt); + assert(old_bt); shared = (H5B_shared_t *)H5UC_GET_OBJ(old_bt->rc_shared); - HDassert(shared); + assert(shared); /* Allocate memory for the new H5B_t object */ if (NULL == (new_node = H5FL_MALLOC(H5B_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node"); /* Copy the main structure */ H5MM_memcpy(new_node, old_bt, sizeof(H5B_t)); /* Reset cache info */ - HDmemset(&new_node->cache_info, 0, sizeof(H5AC_info_t)); + memset(&new_node->cache_info, 0, sizeof(H5AC_info_t)); if (NULL == (new_node->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || NULL == (new_node->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node"); /* Copy the other structures */ H5MM_memcpy(new_node->native, old_bt->native, shared->sizeof_keys); @@ -1830,9 +1788,6 @@ H5B__copy(const H5B_t *old_bt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jun 3 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1853,18 +1808,18 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, const H5B_ /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(H5F_addr_defined(addr)); - HDassert(info_udata); - HDassert(info_udata->bt_info); - HDassert(info_udata->udata); + assert(f); + assert(type); + assert(H5_addr_defined(addr)); + assert(info_udata); + assert(info_udata->bt_info); + assert(info_udata->udata); /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, info_udata->udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object"); shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* Get the raw node size for iteration */ sizeof_rnode = shared->sizeof_rnode; @@ -1874,7 +1829,7 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, const H5B_ cache_udata.type = type; cache_udata.rc_shared = rc_shared; if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node"); /* Cache information from this node */ left_child = bt->child[0]; @@ -1887,18 +1842,18 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, const H5B_ /* Release current node */ if (H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); bt = NULL; /* * Follow the right-sibling pointer from node to node until we've * processed all nodes. */ - while (H5F_addr_defined(next_addr)) { + while (H5_addr_defined(next_addr)) { /* Protect the next node to the right */ addr = next_addr; if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "B-tree node"); /* Cache information from this node */ next_addr = bt->right; @@ -1909,7 +1864,7 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, const H5B_ /* Unprotect node */ if (H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); bt = NULL; } /* end while */ @@ -1917,12 +1872,12 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, const H5B_ if (level > 0) { /* Keep following the left-most child until we reach a leaf node. */ if (H5B__get_info_helper(f, type, left_child, info_udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to list B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "unable to list B-tree node"); } /* end if */ done: if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B__get_info_helper() */ @@ -1934,9 +1889,6 @@ H5B__get_info_helper(H5F_t *f, const H5B_class_t *type, haddr_t addr, const H5B_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * June 19, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1951,14 +1903,14 @@ H5B_get_info(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_info_t *bt_inf /* * Check arguments. */ - HDassert(f); - HDassert(type); - HDassert(bt_info); - HDassert(H5F_addr_defined(addr)); - HDassert(udata); + assert(f); + assert(type); + assert(bt_info); + assert(H5_addr_defined(addr)); + assert(udata); /* Portably initialize B-tree info struct */ - HDmemset(bt_info, 0, sizeof(*bt_info)); + memset(bt_info, 0, sizeof(*bt_info)); /* Set up internal user-data for the B-tree 'get info' helper routine */ info_udata.bt_info = bt_info; @@ -1966,7 +1918,7 @@ H5B_get_info(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_info_t *bt_inf /* Iterate over the B-tree nodes */ if (H5B__get_info_helper(f, type, addr, &info_udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_BADITER, FAIL, "B-tree iteration failed") + HGOTO_ERROR(H5E_BTREE, H5E_BADITER, FAIL, "B-tree iteration failed"); /* Iterate over the B-tree records, making any "leaf" callbacks */ /* (Only if operator defined) */ @@ -1985,9 +1937,6 @@ H5B_get_info(H5F_t *f, const H5B_class_t *type, haddr_t addr, H5B_info_t *bt_inf * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * March 17, 2009 - * *------------------------------------------------------------------------- */ htri_t @@ -2003,16 +1952,16 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) /* * Check arguments. */ - HDassert(f); - HDassert(type); + assert(f); + assert(type); - if (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "address is undefined") + if (!H5_addr_defined(addr)) + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "address is undefined"); /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, NULL))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") - HDassert(H5UC_GET_OBJ(rc_shared) != NULL); + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object"); + assert(H5UC_GET_OBJ(rc_shared) != NULL); /* * Load the tree node. @@ -2021,12 +1970,12 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) cache_udata.type = type; cache_udata.rc_shared = rc_shared; if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree node"); done: /* Release the node */ if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_valid() */ @@ -2039,9 +1988,6 @@ H5B_valid(H5F_t *f, const H5B_class_t *type, haddr_t addr) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * Mar 26, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -2050,8 +1996,8 @@ H5B__node_dest(H5B_t *bt) FUNC_ENTER_PACKAGE_NOERR /* check arguments */ - HDassert(bt); - HDassert(bt->rc_shared); + assert(bt); + assert(bt->rc_shared); bt->child = H5FL_SEQ_FREE(haddr_t, bt->child); bt->native = H5FL_BLK_FREE(native_block, bt->native); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5B2.c b/externals/coda-oss/modules/drivers/hdf5/source/H5B2.c index 0be772a1da..152a2d50a4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5B2.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5B2.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5B2.c - * Jan 31 2005 - * Quincey Koziol * * Purpose: Implements a B-tree, with several modifications from * the "standard" methods. @@ -115,9 +112,6 @@ H5FL_DEFINE_STATIC(H5B2_t); * Return: Non-negative on success (with address of new B-tree * filled in), negative on failure * - * Programmer: Quincey Koziol - * Jan 31 2005 - * *------------------------------------------------------------------------- */ H5B2_t * @@ -133,34 +127,34 @@ H5B2_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata) /* * Check arguments. */ - HDassert(f); - HDassert(cparam); + assert(f); + assert(cparam); /* H5B2 interface sanity check */ HDcompile_assert(H5B2_NUM_BTREE_ID == NELMTS(H5B2_client_class_g)); /* Create shared v2 B-tree header */ if (HADDR_UNDEF == (hdr_addr = H5B2__hdr_create(f, cparam, ctx_udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't create v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't create v2 B-tree header"); /* Create v2 B-tree wrapper */ if (NULL == (bt2 = H5FL_MALLOC(H5B2_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info"); /* Look up the B-tree header */ if (NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, ctx_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header"); /* Point v2 B-tree wrapper at header and bump it's ref count */ bt2->hdr = hdr; if (H5B2__hdr_incr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, - "can't increment reference count on shared v2 B-tree header") + "can't increment reference count on shared v2 B-tree header"); /* Increment # of files using this v2 B-tree header */ if (H5B2__hdr_fuse_incr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, - "can't increment file reference count on shared v2 B-tree header") + "can't increment file reference count on shared v2 B-tree header"); /* Set file pointer for this v2 B-tree open context */ bt2->f = f; @@ -170,10 +164,10 @@ H5B2_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata) done: if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header"); if (!ret_value && bt2) if (H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, NULL, "unable to close v2 B-tree") + HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, NULL, "unable to close v2 B-tree"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2_create() */ @@ -186,9 +180,6 @@ H5B2_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata) * Return: Pointer to v2 B-tree wrapper on success * NULL on failure * - * Programmer: Quincey Koziol - * Oct 15 2009 - * *------------------------------------------------------------------------- */ H5B2_t * @@ -201,31 +192,31 @@ H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata) FUNC_ENTER_NOAPI_NOINIT /* Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(H5_addr_defined(addr)); /* Look up the B-tree header */ if (NULL == (hdr = H5B2__hdr_protect(f, addr, ctx_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect v2 B-tree header"); /* Check for pending heap deletion */ if (hdr->pending_delete) - HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, NULL, "can't open v2 B-tree pending deletion") + HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, NULL, "can't open v2 B-tree pending deletion"); /* Create v2 B-tree info */ if (NULL == (bt2 = H5FL_MALLOC(H5B2_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for v2 B-tree info"); /* Point v2 B-tree wrapper at header */ bt2->hdr = hdr; if (H5B2__hdr_incr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, - "can't increment reference count on shared v2 B-tree header") + "can't increment reference count on shared v2 B-tree header"); /* Increment # of files using this v2 B-tree header */ if (H5B2__hdr_fuse_incr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, - "can't increment file reference count on shared v2 B-tree header") + "can't increment file reference count on shared v2 B-tree header"); /* Set file pointer for this v2 B-tree open context */ bt2->f = f; @@ -235,10 +226,10 @@ H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata) done: if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to release v2 B-tree header"); if (!ret_value && bt2) if (H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, NULL, "unable to close v2 B-tree") + HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, NULL, "unable to close v2 B-tree"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2_open() */ @@ -250,9 +241,6 @@ H5B2_open(H5F_t *f, haddr_t addr, void *ctx_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 2 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -264,8 +252,8 @@ H5B2_insert(H5B2_t *bt2, void *udata) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(bt2); - HDassert(udata); + assert(bt2); + assert(udata); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -275,7 +263,7 @@ H5B2_insert(H5B2_t *bt2, void *udata) /* Insert the record */ if (H5B2__insert(hdr, udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -291,9 +279,6 @@ H5B2_insert(H5B2_t *bt2, void *udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Dec 23 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -306,8 +291,8 @@ H5B2_update(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(bt2); - HDassert(udata); + assert(bt2); + assert(udata); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -316,39 +301,39 @@ H5B2_update(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) hdr = bt2->hdr; /* Check if the root node is allocated yet */ - if (!H5F_addr_defined(hdr->root.addr)) { + if (!H5_addr_defined(hdr->root.addr)) { /* Create root node as leaf node in B-tree */ if (H5B2__create_leaf(hdr, hdr, &(hdr->root)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node"); } /* end if */ /* Attempt to insert record into B-tree */ if (hdr->depth > 0) { if (H5B2__update_internal(hdr, hdr->depth, NULL, &hdr->root, &status, H5B2_POS_ROOT, hdr, udata, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in B-tree internal node"); } /* end if */ else { if (H5B2__update_leaf(hdr, &hdr->root, &status, H5B2_POS_ROOT, hdr, udata, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in B-tree leaf node"); } /* end else */ /* Sanity check */ - HDassert(H5B2_UPDATE_UNKNOWN != status); + assert(H5B2_UPDATE_UNKNOWN != status); /* Use insert algorithm if nodes to leaf full */ if (H5B2_UPDATE_INSERT_CHILD_FULL == status) { if (H5B2__insert(hdr, udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree"); } /* end if */ else if (H5B2_UPDATE_SHADOW_DONE == status || H5B2_UPDATE_INSERT_DONE == status) { /* Mark B-tree header as dirty */ if (H5B2__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") + HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty"); } /* end else-if */ else { /* Sanity check */ - HDassert(H5B2_UPDATE_MODIFY_DONE == status); + assert(H5B2_UPDATE_MODIFY_DONE == status); } /* end else */ done: @@ -362,9 +347,6 @@ H5B2_update(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Nov 5 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -375,8 +357,8 @@ H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr_p) /* * Check arguments. */ - HDassert(bt2); - HDassert(addr_p); + assert(bt2); + assert(addr_p); /* Retrieve the header address for this v2 B-tree */ *addr_p = bt2->hdr->addr; @@ -395,9 +377,6 @@ H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr_p) * * Return: Value from callback: non-negative on success, negative on error * - * Programmer: Quincey Koziol - * Feb 11 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -409,8 +388,8 @@ H5B2_iterate(H5B2_t *bt2, H5B2_operator_t op, void *op_data) FUNC_ENTER_NOAPI_NOERR /* Check arguments. */ - HDassert(bt2); - HDassert(op); + assert(bt2); + assert(op); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -444,9 +423,6 @@ H5B2_iterate(H5B2_t *bt2, H5B2_operator_t op, void *op_data) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Feb 23 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -464,8 +440,8 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(bt2); - HDassert(found); + assert(bt2); + assert(found); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -479,7 +455,7 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da /* Check for empty tree */ if (curr_node_ptr.node_nrec == 0) { *found = FALSE; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* Check record against min & max records in tree, to attempt to quickly @@ -487,32 +463,32 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da */ if (hdr->min_native_rec != NULL) { if ((hdr->cls->compare)(udata, hdr->min_native_rec, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp < 0) { *found = FALSE; /* Less than the least record--not found */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } else if (cmp == 0) { /* Record is found */ if (op && (op)(hdr->min_native_rec, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, - "'found' callback failed for B-tree find operation") + "'found' callback failed for B-tree find operation"); *found = TRUE; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ } /* end if */ if (hdr->max_native_rec != NULL) { if ((hdr->cls->compare)(udata, hdr->max_native_rec, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp > 0) { *found = FALSE; /* Greater than the largest record--not found */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } else if (cmp == 0) { /* Record is found */ if (op && (op)(hdr->max_native_rec, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, - "'found' callback failed for B-tree find operation") + "'found' callback failed for B-tree find operation"); *found = TRUE; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ } /* end if */ @@ -533,12 +509,12 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da /* Lock B-tree current node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node"); /* Unpin parent if necessary */ if (parent) { if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); parent = NULL; } /* end if */ @@ -547,7 +523,7 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da &cmp) < 0) { /* Unlock current node before failing */ H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET); - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); } /* end if */ if (cmp > 0) @@ -577,7 +553,7 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); /* Keep track of parent if necessary */ if (hdr->swmr_write) @@ -592,19 +568,19 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, - "'found' callback failed for B-tree find operation") + "'found' callback failed for B-tree find operation"); } /* end if */ /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); /* Indicate record found */ *found = TRUE; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end else */ /* Decrement depth we're at in B-tree */ @@ -616,12 +592,12 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da /* Lock B-tree leaf node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); /* Unpin parent if necessary */ if (parent) { if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); parent = NULL; } /* end if */ @@ -630,27 +606,27 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da 0) { /* Unlock current node before failing */ H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET); - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); } /* end if */ if (cmp != 0) { /* Unlock leaf node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); /* Record not found */ *found = FALSE; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ else { /* Make callback for current record */ if (op && (op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0) { /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, - "'found' callback failed for B-tree find operation") + "'found' callback failed for B-tree find operation"); } /* end if */ /* Check for record being the min or max for the tree */ @@ -661,7 +637,7 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da if (hdr->min_native_rec == NULL) if (NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, - "memory allocation failed for v2 B-tree min record info") + "memory allocation failed for v2 B-tree min record info"); H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ @@ -670,7 +646,7 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da if (hdr->max_native_rec == NULL) if (NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, - "memory allocation failed for v2 B-tree max record info") + "memory allocation failed for v2 B-tree max record info"); H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ @@ -679,7 +655,7 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); /* Indicate record found */ *found = TRUE; @@ -687,9 +663,9 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da done: if (parent) { - HDassert(ret_value < 0); + assert(ret_value < 0); if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -707,9 +683,6 @@ H5B2_find(H5B2_t *bt2, void *udata, hbool_t *found, H5B2_found_t op, void *op_da * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Feb 23 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -724,8 +697,8 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, voi FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(bt2); - HDassert(op); + assert(bt2); + assert(op); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -738,11 +711,11 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, voi /* Check for empty tree */ if (curr_node_ptr.node_nrec == 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records"); /* Check for index greater than the number of records in the tree */ if (idx >= curr_node_ptr.all_nrec) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree doesn't have that many records") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree doesn't have that many records"); /* Current depth of the tree */ depth = hdr->depth; @@ -764,12 +737,12 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, voi /* Lock B-tree current node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node"); /* Unpin parent if necessary */ if (parent) { if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); parent = NULL; } /* end if */ @@ -784,7 +757,7 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, voi if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); /* Keep track of parent if necessary */ if (hdr->swmr_write) @@ -804,16 +777,16 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, voi /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, - "'found' callback failed for B-tree find operation") + "'found' callback failed for B-tree find operation"); } /* end if */ /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); HGOTO_DONE(SUCCEED); } /* end if */ @@ -835,7 +808,7 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, voi if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); /* Keep track of parent if necessary */ if (hdr->swmr_write) @@ -846,7 +819,7 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, voi } /* end if */ else /* Index that is greater than the number of records in the tree? */ - HDassert(0 && "Index off end of tree??"); + assert(0 && "Index off end of tree??"); } /* end if */ /* Decrement depth we're at in B-tree */ @@ -858,37 +831,37 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, voi /* Lock B-tree leaf node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); /* Unpin parent if necessary */ if (parent) { if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); parent = NULL; } /* end if */ /* Sanity check index */ - HDassert(idx < leaf->nrec); + assert(idx < leaf->nrec); /* Make callback for correct record */ if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0) { /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation"); } /* end if */ /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); } /* end block */ done: if (parent) { - HDassert(ret_value < 0); + assert(ret_value < 0); if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -901,9 +874,6 @@ H5B2_index(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_found_t op, voi * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 25 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -915,7 +885,7 @@ H5B2_remove(H5B2_t *bt2, void *udata, H5B2_remove_t op, void *op_data) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(bt2); + assert(bt2); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -925,7 +895,7 @@ H5B2_remove(H5B2_t *bt2, void *udata, H5B2_remove_t op, void *op_data) /* Check for empty B-tree */ if (0 == hdr->root.all_nrec) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree"); /* Attempt to remove record from B-tree */ if (hdr->depth > 0) { @@ -933,7 +903,7 @@ H5B2_remove(H5B2_t *bt2, void *udata, H5B2_remove_t op, void *op_data) if (H5B2__remove_internal(hdr, &depth_decreased, NULL, NULL, hdr->depth, &(hdr->cache_info), NULL, H5B2_POS_ROOT, &hdr->root, udata, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node"); /* Check for decreasing the depth of the B-tree */ if (depth_decreased) { @@ -941,19 +911,19 @@ H5B2_remove(H5B2_t *bt2, void *udata, H5B2_remove_t op, void *op_data) if (hdr->node_info[hdr->depth].nat_rec_fac) if (H5FL_fac_term(hdr->node_info[hdr->depth].nat_rec_fac) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, - "can't destroy node's native record block factory") + "can't destroy node's native record block factory"); if (hdr->node_info[hdr->depth].node_ptr_fac) if (H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, - "can't destroy node's node pointer block factory") + "can't destroy node's node pointer block factory"); - HDassert((uint16_t)(hdr->depth - depth_decreased) < hdr->depth); + assert((uint16_t)(hdr->depth - depth_decreased) < hdr->depth); hdr->depth = (uint16_t)(hdr->depth - depth_decreased); } /* end for */ } /* end if */ else { if (H5B2__remove_leaf(hdr, &hdr->root, H5B2_POS_ROOT, hdr, udata, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node"); } /* end else */ /* Decrement # of records in B-tree */ @@ -961,7 +931,7 @@ H5B2_remove(H5B2_t *bt2, void *udata, H5B2_remove_t op, void *op_data) /* Mark B-tree header as dirty */ if (H5B2__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") + HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -974,9 +944,6 @@ H5B2_remove(H5B2_t *bt2, void *udata, H5B2_remove_t op, void *op_data) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -988,7 +955,7 @@ H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_remove_ FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(bt2); + assert(bt2); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -998,11 +965,11 @@ H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_remove_ /* Check for empty B-tree */ if (0 == hdr->root.all_nrec) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree"); /* Check for index greater than the number of records in the tree */ if (idx >= hdr->root.all_nrec) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree doesn't have that many records") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree doesn't have that many records"); /* Check for reverse indexing and map requested index to appropriate forward index */ if (H5_ITER_DEC == order) @@ -1014,7 +981,7 @@ H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_remove_ if (H5B2__remove_internal_by_idx(hdr, &depth_decreased, NULL, NULL, hdr->depth, &(hdr->cache_info), NULL, &hdr->root, H5B2_POS_ROOT, idx, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node"); /* Check for decreasing the depth of the B-tree */ if (depth_decreased) { @@ -1022,19 +989,19 @@ H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_remove_ if (hdr->node_info[hdr->depth].nat_rec_fac) if (H5FL_fac_term(hdr->node_info[hdr->depth].nat_rec_fac) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, - "can't destroy node's native record block factory") + "can't destroy node's native record block factory"); if (hdr->node_info[hdr->depth].node_ptr_fac) if (H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, - "can't destroy node's node pointer block factory") + "can't destroy node's node pointer block factory"); - HDassert((uint16_t)(hdr->depth - depth_decreased) < hdr->depth); + assert((uint16_t)(hdr->depth - depth_decreased) < hdr->depth); hdr->depth = (uint16_t)(hdr->depth - depth_decreased); } /* end for */ } /* end if */ else { if (H5B2__remove_leaf_by_idx(hdr, &hdr->root, H5B2_POS_ROOT, hdr, (unsigned)idx, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node"); } /* end else */ /* Decrement # of records in B-tree */ @@ -1042,7 +1009,7 @@ H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_remove_ /* Mark B-tree header as dirty */ if (H5B2__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") + HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1055,9 +1022,6 @@ H5B2_remove_by_idx(H5B2_t *bt2, H5_iter_order_t order, hsize_t idx, H5B2_remove_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 25 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1066,8 +1030,8 @@ H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(bt2); - HDassert(nrec); + assert(bt2); + assert(nrec); /* Get B-tree number of records */ *nrec = bt2->hdr->root.all_nrec; @@ -1094,9 +1058,6 @@ H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Mar 8 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1108,8 +1069,8 @@ H5B2_neighbor(H5B2_t *bt2, H5B2_compare_t range, void *udata, H5B2_found_t op, v FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(bt2); - HDassert(op); + assert(bt2); + assert(op); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -1118,18 +1079,18 @@ H5B2_neighbor(H5B2_t *bt2, H5B2_compare_t range, void *udata, H5B2_found_t op, v hdr = bt2->hdr; /* Check for empty tree */ - if (!H5F_addr_defined(hdr->root.addr)) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records") + if (!H5_addr_defined(hdr->root.addr)) + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records"); /* Attempt to find neighbor record in B-tree */ if (hdr->depth > 0) { if (H5B2__neighbor_internal(hdr, hdr->depth, &hdr->root, NULL, range, hdr, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, - "unable to find neighbor record in B-tree internal node") + "unable to find neighbor record in B-tree internal node"); } /* end if */ else { if (H5B2__neighbor_leaf(hdr, &hdr->root, NULL, range, hdr, udata, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node"); } /* end else */ done: @@ -1150,9 +1111,6 @@ H5B2_neighbor(H5B2_t *bt2, H5B2_compare_t range, void *udata, H5B2_found_t op, v * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Mar 10 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1170,8 +1128,8 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(bt2); - HDassert(op); + assert(bt2); + assert(op); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -1184,7 +1142,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) /* Check for empty tree */ if (0 == curr_node_ptr.node_nrec) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records"); /* Current depth of the tree */ depth = hdr->depth; @@ -1204,12 +1162,12 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) /* Lock B-tree current node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node"); /* Unpin parent if necessary */ if (parent) { if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); parent = NULL; } /* end if */ @@ -1218,7 +1176,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) &cmp) < 0) { /* Unlock current node before failing */ H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET); - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); } /* end if */ if (cmp > 0) @@ -1249,7 +1207,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); /* Keep track of parent if necessary */ if (hdr->swmr_write) @@ -1264,15 +1222,15 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) /* Make callback for current record */ if ((op)(H5B2_INT_NREC(internal, hdr, idx), op_data, &changed) < 0) { /* Make certain that the callback didn't modify the value if it failed */ - HDassert(changed == FALSE); + assert(changed == FALSE); /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, - "'modify' callback failed for B-tree find operation") + "'modify' callback failed for B-tree find operation"); } /* end if */ /* Mark the node as dirty if it changed */ @@ -1280,7 +1238,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, internal_flags) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); HGOTO_DONE(SUCCEED); } /* end else */ @@ -1296,12 +1254,12 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) /* Lock B-tree leaf node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); /* Unpin parent if necessary */ if (parent) { if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); parent = NULL; } /* end if */ @@ -1310,36 +1268,32 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) 0) { /* Unlock current node before failing */ H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET); - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); } /* end if */ if (cmp != 0) { /* Unlock leaf node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - - /* Note: don't push error on stack, leave that to next higher level, - * since many times the B-tree is searched in order to determine - * if an object exists in the B-tree or not. -QAK - */ -#ifdef OLD_WAY - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "key not found in leaf node") -#else /* OLD_WAY */ - HGOTO_DONE(FAIL) -#endif /* OLD_WAY */ - } /* end if */ + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); + + /* Note: don't push error on stack, leave that to next higher level, + * since many times the B-tree is searched in order to determine + * if an object exists in the B-tree or not. + */ + HGOTO_DONE(FAIL); + } else { /* Make callback for current record */ if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) { /* Make certain that the callback didn't modify the value if it failed */ - HDassert(changed == FALSE); + assert(changed == FALSE); /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, - "'modify' callback failed for B-tree find operation") + "'modify' callback failed for B-tree find operation"); } /* end if */ /* Check for modified record being the min or max for the tree */ @@ -1350,7 +1304,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) if (hdr->min_native_rec == NULL) if (NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, - "memory allocation failed for v2 B-tree min record info") + "memory allocation failed for v2 B-tree min record info"); H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ @@ -1359,7 +1313,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) if (hdr->max_native_rec == NULL) if (NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, - "memory allocation failed for v2 B-tree max record info") + "memory allocation failed for v2 B-tree max record info"); H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ @@ -1371,14 +1325,14 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_flags) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); } /* end block */ done: if (parent) { - HDassert(ret_value < 0); + assert(ret_value < 0); if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1391,9 +1345,6 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 15 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -1406,8 +1357,8 @@ H5B2_close(H5B2_t *bt2) FUNC_ENTER_NOAPI_NOINIT /* Check arguments. */ - HDassert(bt2); - HDassert(bt2->f); + assert(bt2); + assert(bt2->f); /* Decrement file reference & check if this is the last open v2 B-tree using the shared B-tree header */ if (0 == H5B2__hdr_fuse_decr(bt2->hdr)) { @@ -1429,7 +1380,7 @@ H5B2_close(H5B2_t *bt2) H5B2_hdr_t *hdr; /* Another pointer to v2 B-tree header */ /* Sanity check */ - HDassert(H5F_addr_defined(bt2_addr)); + assert(H5_addr_defined(bt2_addr)); #ifndef NDEBUG { @@ -1439,19 +1390,19 @@ H5B2_close(H5B2_t *bt2) if (H5AC_get_entry_status(bt2->f, bt2_addr, &hdr_status) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to check metadata cache status for v2 B-tree header, address = %llu", - (unsigned long long)bt2_addr) + (unsigned long long)bt2_addr); /* Sanity checks on header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PINNED); - HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED)); + assert(hdr_status & H5AC_ES__IN_CACHE); + assert(hdr_status & H5AC_ES__IS_PINNED); + assert(!(hdr_status & H5AC_ES__IS_PROTECTED)); } #endif /* NDEBUG */ /* Lock the v2 B-tree header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ if (NULL == (hdr = H5B2__hdr_protect(bt2->f, bt2_addr, NULL, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header"); /* Set the shared v2 B-tree header's file context for this operation */ hdr->f = bt2->f; @@ -1462,11 +1413,11 @@ H5B2_close(H5B2_t *bt2) */ if (H5B2__hdr_decr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared v2 B-tree header") + "can't decrement reference count on shared v2 B-tree header"); /* Delete v2 B-tree, starting with header (unprotects header) */ if (H5B2__hdr_delete(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree"); } /* end if */ else { /* Decrement the reference count on the B-tree header */ @@ -1475,7 +1426,7 @@ H5B2_close(H5B2_t *bt2) */ if (H5B2__hdr_decr(bt2->hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared v2 B-tree header") + "can't decrement reference count on shared v2 B-tree header"); } /* end else */ @@ -1502,9 +1453,6 @@ H5B2_close(H5B2_t *bt2) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Mar 9 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1516,12 +1464,12 @@ H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata, H5B2_remove_t op, void *op_ FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(H5_addr_defined(addr)); /* Lock the v2 B-tree header into memory */ if (NULL == (hdr = H5B2__hdr_protect(f, addr, ctx_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header"); /* Remember the callback & context for later */ hdr->remove_op = op; @@ -1536,14 +1484,14 @@ H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata, H5B2_remove_t op, void *op_ /* Delete v2 B-tree now, starting with header (unprotects header) */ if (H5B2__hdr_delete(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree"); hdr = NULL; } /* end if */ done: /* Unprotect the header, if an error occurred */ if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release v2 B-tree header") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release v2 B-tree header"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2_delete() */ @@ -1556,9 +1504,6 @@ H5B2_delete(H5F_t *f, haddr_t addr, void *ctx_udata, H5B2_remove_t op, void *op_ * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -1573,10 +1518,10 @@ H5B2_depend(H5B2_t *bt2, H5AC_proxy_entry_t *parent) /* * Check arguments. */ - HDassert(bt2); - HDassert(hdr); - HDassert(parent); - HDassert(hdr->parent == NULL || hdr->parent == parent); + assert(bt2); + assert(hdr); + assert(parent); + assert(hdr->parent == NULL || hdr->parent == parent); /* * Check to see if the flush dependency between the parent @@ -1585,14 +1530,14 @@ H5B2_depend(H5B2_t *bt2, H5AC_proxy_entry_t *parent) */ if (NULL == hdr->parent) { /* Sanity check */ - HDassert(hdr->top_proxy); + assert(hdr->top_proxy); /* Set the shared v2 B-tree header's file context for this operation */ hdr->f = bt2->f; /* Add the v2 B-tree as a child of the parent (proxy) */ if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, FAIL, "unable to add v2 B-tree as child of proxy") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, FAIL, "unable to add v2 B-tree as child of proxy"); hdr->parent = parent; } /* end if */ @@ -1620,8 +1565,8 @@ H5B2_patch_file(H5B2_t *bt2, H5F_t *f) /* * Check arguments. */ - HDassert(bt2); - HDassert(f); + assert(bt2); + assert(f); if (bt2->f != f || bt2->hdr->f != f) bt2->f = bt2->hdr->f = f; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5B2cache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5B2cache.c index 681cf04148..76aa73f372 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5B2cache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5B2cache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5B2cache.c - * Jan 31 2005 - * Quincey Koziol * - * Purpose: Implement v2 B-tree metadata cache methods. + * Purpose: Implement v2 B-tree metadata cache methods * *------------------------------------------------------------------------- */ @@ -31,10 +28,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5B2pkg.h" /* v2 B-trees */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata Cache */ +#include "H5B2pkg.h" /* B-Trees (Version 2) */ +#include "H5Eprivate.h" /* Error Handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MMprivate.h" /* Memory Management */ /****************/ /* Local Macros */ @@ -155,9 +155,6 @@ const H5AC_class_t H5AC_BT2_LEAF[1] = {{ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -168,9 +165,9 @@ H5B2__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->f); - HDassert(image_len); + assert(udata); + assert(udata->f); + assert(image_len); /* Set the image length size */ *image_len = H5B2_HEADER_SIZE_FILE(udata->f); @@ -187,8 +184,6 @@ H5B2__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -202,7 +197,7 @@ H5B2__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -221,9 +216,6 @@ H5B2__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE * Return: Success: Pointer to a new B-tree. * Failure: NULL * - * Programmer: Quincey Koziol - * Feb 1 2005 - * *------------------------------------------------------------------------- */ static void * @@ -242,26 +234,26 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); /* Allocate new B-tree header and reset cache info */ if (NULL == (hdr = H5B2__hdr_alloc(udata->f))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "allocation failed for B-tree header"); /* Magic number */ - if (HDmemcmp(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree header signature") + if (memcmp(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree header signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5B2_HDR_VERSION) - HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree header version") + HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree header version"); /* B-tree class */ id = (H5B2_subid_t)*image++; if (id >= H5B2_NUM_BTREE_ID) - HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type") + HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type"); /* Node size (in bytes) */ UINT32DECODE(image, cparam.node_size); @@ -287,18 +279,18 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == hdr->hdr_size); + assert((size_t)(image - (const uint8_t *)_image) == hdr->hdr_size); /* Initialize B-tree header info */ cparam.cls = H5B2_client_class_g[id]; if (H5B2__hdr_init(hdr, &cparam, udata->ctx_udata, depth) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't initialize B-tree header info"); /* Set the B-tree header's address */ hdr->addr = udata->addr; /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) <= len); + assert((size_t)(image - (const uint8_t *)_image) <= len); /* Set return value */ ret_value = hdr; @@ -306,7 +298,7 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void done: if (!ret_value && hdr) if (H5B2__hdr_free(hdr) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, NULL, "can't release v2 B-tree header") + HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, NULL, "can't release v2 B-tree header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__cache_hdr_deserialize() */ @@ -318,9 +310,6 @@ H5B2__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 20, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -331,8 +320,8 @@ H5B2__cache_hdr_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(hdr); - HDassert(image_len); + assert(hdr); + assert(image_len); /* Set the image length size */ *image_len = hdr->hdr_size; @@ -347,9 +336,6 @@ H5B2__cache_hdr_image_len(const void *_thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 1 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -362,9 +348,9 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le FUNC_ENTER_PACKAGE_NOERR /* check arguments */ - HDassert(f); - HDassert(image); - HDassert(hdr); + assert(f); + assert(image); + assert(hdr); /* Magic number */ H5MM_memcpy(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -374,7 +360,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_HDR_VERSION; /* B-tree type */ - HDassert(hdr->cls->id <= 255); + assert(hdr->cls->id <= 255); *image++ = (uint8_t)hdr->cls->id; /* Node size (in bytes) */ @@ -404,7 +390,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2__cache_hdr_serialize() */ @@ -416,9 +402,6 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Apr 24 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -432,7 +415,7 @@ H5B2__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Check if the file was opened with SWMR-write access */ if (hdr->swmr_write) { @@ -463,13 +446,13 @@ H5B2__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) */ if (hdr->parent) { /* Sanity check */ - HDassert(hdr->top_proxy); + assert(hdr->top_proxy); /* Destroy flush dependency on object header proxy */ if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, - "unable to destroy flush dependency between v2 B-tree and proxy") + "unable to destroy flush dependency between v2 B-tree and proxy"); hdr->parent = NULL; } /* end if */ @@ -478,21 +461,21 @@ H5B2__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0) HGOTO_ERROR( H5E_BTREE, H5E_CANTUNDEPEND, FAIL, - "unable to destroy flush dependency between header and v2 B-tree 'top' proxy") + "unable to destroy flush dependency between header and v2 B-tree 'top' proxy"); /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */ } /* end if */ break; default: #ifdef NDEBUG - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ } /* end if */ else - HDassert(NULL == hdr->parent); + assert(NULL == hdr->parent); done: FUNC_LEAVE_NOAPI(ret_value) @@ -506,9 +489,6 @@ H5B2__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mike McGreevy - * June 18, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -519,11 +499,11 @@ H5B2__cache_hdr_free_icr(void *thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(thing); + assert(thing); /* Destroy v2 B-tree header */ if (H5B2__hdr_free((H5B2_hdr_t *)thing) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -536,9 +516,6 @@ H5B2__cache_hdr_free_icr(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -549,9 +526,9 @@ H5B2__cache_int_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->hdr); - HDassert(image_len); + assert(udata); + assert(udata->hdr); + assert(image_len); /* Set the image length size */ *image_len = udata->hdr->node_size; @@ -568,8 +545,6 @@ H5B2__cache_int_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -585,8 +560,8 @@ H5B2__cache_int_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, voi FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); /* Internal node prefix header + records + child pointer triplets: size with checksum at the end */ chk_size = H5B2_INT_PREFIX_SIZE + (udata->nrec * udata->hdr->rrec_size) + @@ -609,9 +584,6 @@ H5B2__cache_int_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, voi * Return: Success: Pointer to a new B-tree internal node. * Failure: NULL * - * Programmer: Quincey Koziol - * Feb 2 2005 - * *------------------------------------------------------------------------- */ static void * @@ -631,16 +603,16 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); /* Allocate new internal node and reset cache info */ if (NULL == (internal = H5FL_CALLOC(H5B2_internal_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Increment ref. count on B-tree header */ if (H5B2__hdr_incr(udata->hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment ref. count on B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment ref. count on B-tree header"); /* Share B-tree information */ internal->hdr = udata->hdr; @@ -648,29 +620,29 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void internal->shadow_epoch = udata->hdr->shadow_epoch; /* Magic number */ - if (HDmemcmp(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node signature") + if (memcmp(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5B2_INT_VERSION) - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node version") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree internal node version"); /* B-tree type */ if (*image++ != (uint8_t)udata->hdr->cls->id) - HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type") + HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type"); /* Allocate space for the native keys in memory */ if (NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[udata->depth].nat_rec_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for B-tree internal native keys") + "memory allocation failed for B-tree internal native keys"); /* Allocate space for the node pointers in memory */ if (NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[udata->depth].node_ptr_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for B-tree internal node pointers") + "memory allocation failed for B-tree internal node pointers"); /* Set the number of records in the leaf & it's depth */ internal->nrec = udata->nrec; @@ -681,7 +653,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void for (u = 0; u < internal->nrec; u++) { /* Decode record */ if ((udata->hdr->cls->decode)(image, native, udata->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode B-tree record") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode B-tree record"); /* Move to next record */ image += udata->hdr->rrec_size; @@ -697,7 +669,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void H5_CHECKED_ASSIGN(int_node_ptr->node_nrec, uint16_t, node_nrec, int); if (udata->depth > 1) UINT64DECODE_VAR(image, int_node_ptr->all_nrec, - udata->hdr->node_info[udata->depth - 1].cum_max_nrec_size) + udata->hdr->node_info[udata->depth - 1].cum_max_nrec_size); else int_node_ptr->all_nrec = int_node_ptr->node_nrec; @@ -711,7 +683,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void UINT32DECODE(image, stored_chksum); /* Sanity check parsing */ - HDassert((size_t)(image - (const uint8_t *)_image) <= len); + assert((size_t)(image - (const uint8_t *)_image) <= len); /* Set return value */ ret_value = internal; @@ -719,7 +691,7 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void done: if (!ret_value && internal) if (H5B2__internal_free(internal) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree internal node") + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree internal node"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__cache_int_deserialize() */ @@ -731,9 +703,6 @@ H5B2__cache_int_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 20, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -745,9 +714,9 @@ H5B2__cache_int_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(internal); - HDassert(internal->hdr); - HDassert(image_len); + assert(internal); + assert(internal->hdr); + assert(image_len); /* Set the image length size */ *image_len = internal->hdr->node_size; @@ -762,9 +731,6 @@ H5B2__cache_int_image_len(const void *_thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 3 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -781,10 +747,10 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); - HDassert(image); - HDassert(internal); - HDassert(internal->hdr); + assert(f); + assert(image); + assert(internal); + assert(internal->hdr); /* Magic number */ H5MM_memcpy(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -794,16 +760,16 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5B2_INT_VERSION; /* B-tree type */ - HDassert(internal->hdr->cls->id <= 255); + assert(internal->hdr->cls->id <= 255); *image++ = (uint8_t)internal->hdr->cls->id; - HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); + assert((size_t)(image - (uint8_t *)_image) == (H5B2_INT_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for internal node */ native = internal->int_native; for (u = 0; u < internal->nrec; u++) { /* Encode record */ if ((internal->hdr->cls->encode)(image, native, internal->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record") + HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record"); /* Move to next record */ image += internal->hdr->rrec_size; @@ -831,10 +797,10 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) <= len); + assert((size_t)(image - (uint8_t *)_image) <= len); /* Clear rest of internal node */ - HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); + memset(image, 0, len - (size_t)(image - (uint8_t *)_image)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -847,9 +813,6 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Apr 25 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -863,8 +826,8 @@ H5B2__cache_int_notify(H5AC_notify_action_t action, void *_thing) /* * Check arguments. */ - HDassert(internal); - HDassert(internal->hdr); + assert(internal); + assert(internal->hdr); /* Check if the file was opened with SWMR-write access */ if (internal->hdr->swmr_write) { @@ -873,7 +836,7 @@ H5B2__cache_int_notify(H5AC_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on parent */ if (H5B2__create_flush_depend((H5AC_info_t *)internal->parent, (H5AC_info_t *)internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -889,28 +852,28 @@ H5B2__cache_int_notify(H5AC_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if (H5B2__destroy_flush_depend((H5AC_info_t *)internal->parent, (H5AC_info_t *)internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); /* Detach from 'top' proxy for v2 B-tree */ if (internal->top_proxy) { if (H5AC_proxy_entry_remove_child(internal->top_proxy, internal) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between internal node and v2 B-tree " - "'top' proxy") + "'top' proxy"); internal->top_proxy = NULL; } /* end if */ break; default: #ifdef NDEBUG - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ } /* end if */ else - HDassert(NULL == internal->top_proxy); + assert(NULL == internal->top_proxy); done: FUNC_LEAVE_NOAPI(ret_value) @@ -924,9 +887,6 @@ H5B2__cache_int_notify(H5AC_notify_action_t action, void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mike McGreevy - * June 18, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -938,11 +898,11 @@ H5B2__cache_int_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(internal); + assert(internal); /* Release v2 B-tree internal node */ if (H5B2__internal_free(internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree internal node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -955,9 +915,6 @@ H5B2__cache_int_free_icr(void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -968,9 +925,9 @@ H5B2__cache_leaf_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->hdr); - HDassert(image_len); + assert(udata); + assert(udata->hdr); + assert(image_len); /* Set the image length size */ *image_len = udata->hdr->node_size; @@ -987,8 +944,6 @@ H5B2__cache_leaf_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -1004,8 +959,8 @@ H5B2__cache_leaf_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); /* Leaf node prefix header + records: size with checksum at the end */ chk_size = H5B2_LEAF_PREFIX_SIZE + (udata->nrec * udata->hdr->rrec_size); @@ -1027,9 +982,6 @@ H5B2__cache_leaf_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo * Return: Success: Pointer to a new B-tree leaf node. * Failure: NULL * - * Programmer: Quincey Koziol - * Feb 2 2005 - * *------------------------------------------------------------------------- */ static void * @@ -1047,16 +999,16 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); /* Allocate new leaf node and reset cache info */ if (NULL == (leaf = H5FL_CALLOC(H5B2_leaf_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Increment ref. count on B-tree header */ if (H5B2__hdr_incr(udata->hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment ref. count on B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, NULL, "can't increment ref. count on B-tree header"); /* Share B-tree header information */ leaf->hdr = udata->hdr; @@ -1064,21 +1016,21 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void leaf->shadow_epoch = udata->hdr->shadow_epoch; /* Magic number */ - if (HDmemcmp(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree leaf node signature") + if (memcmp(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree leaf node signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5B2_LEAF_VERSION) - HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree leaf node version") + HGOTO_ERROR(H5E_BTREE, H5E_BADRANGE, NULL, "wrong B-tree leaf node version"); /* B-tree type */ if (*image++ != (uint8_t)udata->hdr->cls->id) - HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type") + HGOTO_ERROR(H5E_BTREE, H5E_BADTYPE, NULL, "incorrect B-tree type"); /* Allocate space for the native keys in memory */ if (NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(udata->hdr->node_info[0].nat_rec_fac))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree leaf native keys") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree leaf native keys"); /* Set the number of records in the leaf */ leaf->nrec = udata->nrec; @@ -1088,7 +1040,7 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void for (u = 0; u < leaf->nrec; u++) { /* Decode record */ if ((udata->hdr->cls->decode)(image, native, udata->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record") + HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, NULL, "unable to decode B-tree record"); /* Move to next record */ image += udata->hdr->rrec_size; @@ -1101,10 +1053,10 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void UINT32DECODE(image, stored_chksum); /* Sanity check parsing */ - HDassert((size_t)(image - (const uint8_t *)_image) <= udata->hdr->node_size); + assert((size_t)(image - (const uint8_t *)_image) <= udata->hdr->node_size); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) <= len); + assert((size_t)(image - (const uint8_t *)_image) <= len); /* Set return value */ ret_value = leaf; @@ -1112,7 +1064,7 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void done: if (!ret_value && leaf) if (H5B2__leaf_free(leaf) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree leaf node") + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree leaf node"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__cache_leaf_deserialize() */ @@ -1124,9 +1076,6 @@ H5B2__cache_leaf_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 20, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1137,9 +1086,9 @@ H5B2__cache_leaf_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(leaf); - HDassert(leaf->hdr); - HDassert(image_len); + assert(leaf); + assert(leaf->hdr); + assert(image_len); /* Set the image length size */ *image_len = leaf->hdr->node_size; @@ -1154,9 +1103,6 @@ H5B2__cache_leaf_image_len(const void *_thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 2 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -1173,10 +1119,10 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); - HDassert(image); - HDassert(leaf); - HDassert(leaf->hdr); + assert(f); + assert(image); + assert(leaf); + assert(leaf->hdr); /* magic number */ H5MM_memcpy(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -1186,16 +1132,16 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H *image++ = H5B2_LEAF_VERSION; /* B-tree type */ - HDassert(leaf->hdr->cls->id <= 255); + assert(leaf->hdr->cls->id <= 255); *image++ = (uint8_t)leaf->hdr->cls->id; - HDassert((size_t)(image - (uint8_t *)_image) == (H5B2_LEAF_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); + assert((size_t)(image - (uint8_t *)_image) == (H5B2_LEAF_PREFIX_SIZE - H5B2_SIZEOF_CHKSUM)); /* Serialize records for leaf node */ native = leaf->leaf_native; for (u = 0; u < leaf->nrec; u++) { /* Encode record */ if ((leaf->hdr->cls->encode)(image, native, leaf->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record") + HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree record"); /* Move to next record */ image += leaf->hdr->rrec_size; @@ -1210,10 +1156,10 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) <= len); + assert((size_t)(image - (uint8_t *)_image) <= len); /* Clear rest of leaf node */ - HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); + memset(image, 0, len - (size_t)(image - (uint8_t *)_image)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1226,9 +1172,6 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Apr 25 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1242,8 +1185,8 @@ H5B2__cache_leaf_notify(H5AC_notify_action_t action, void *_thing) /* * Check arguments. */ - HDassert(leaf); - HDassert(leaf->hdr); + assert(leaf); + assert(leaf->hdr); /* Check if the file was opened with SWMR-write access */ if (leaf->hdr->swmr_write) { @@ -1252,7 +1195,7 @@ H5B2__cache_leaf_notify(H5AC_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Create flush dependency on parent */ if (H5B2__create_flush_depend((H5AC_info_t *)leaf->parent, (H5AC_info_t *)leaf) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -1268,28 +1211,28 @@ H5B2__cache_leaf_notify(H5AC_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if (H5B2__destroy_flush_depend((H5AC_info_t *)leaf->parent, (H5AC_info_t *)leaf) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); /* Detach from 'top' proxy for v2 B-tree */ if (leaf->top_proxy) { if (H5AC_proxy_entry_remove_child(leaf->top_proxy, leaf) < 0) HGOTO_ERROR( H5E_BTREE, H5E_CANTUNDEPEND, FAIL, - "unable to destroy flush dependency between leaf node and v2 B-tree 'top' proxy") + "unable to destroy flush dependency between leaf node and v2 B-tree 'top' proxy"); leaf->top_proxy = NULL; } /* end if */ break; default: #ifdef NDEBUG - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ } /* end if */ else - HDassert(NULL == leaf->top_proxy); + assert(NULL == leaf->top_proxy); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1303,9 +1246,6 @@ H5B2__cache_leaf_notify(H5AC_notify_action_t action, void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mike McGreevy - * June 18, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1317,11 +1257,11 @@ H5B2__cache_leaf_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(leaf); + assert(leaf); /* Destroy v2 B-tree leaf node */ if (H5B2__leaf_free(leaf) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree leaf node"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5B2dbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5B2dbg.c index 330a923b8f..af558f2a45 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5B2dbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5B2dbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5B2dbg.c - * Feb 2 2005 - * Quincey Koziol * * Purpose: Dump debugging information about a v2 B-tree. * @@ -71,9 +68,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 2 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -90,55 +84,54 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(H5F_addr_defined(obj_addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(type); + assert(f); + assert(H5_addr_defined(addr)); + assert(H5_addr_defined(obj_addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(type); /* Load the B-tree header */ if (NULL == (hdr = H5B2__hdr_protect(f, addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header"); /* Set file pointer for this B-tree operation */ hdr->f = f; /* Print opening message */ - HDfprintf(stream, "%*sv2 B-tree Header...\n", indent, ""); + fprintf(stream, "%*sv2 B-tree Header...\n", indent, ""); /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Tree type ID:", hdr->cls->name, - (unsigned)hdr->cls->id); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of node:", (unsigned)hdr->node_size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Size of raw (disk) record:", (unsigned)hdr->rrec_size); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Dirty flag:", hdr->cache_info.is_dirty ? "True" : "False"); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Depth:", hdr->depth); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Number of records in tree:", hdr->root.all_nrec); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Number of records in root node:", hdr->root.node_nrec); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Address of root node:", hdr->root.addr); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Split percent:", hdr->split_percent); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Merge percent:", hdr->merge_percent); + fprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Tree type ID:", hdr->cls->name, + (unsigned)hdr->cls->id); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of node:", (unsigned)hdr->node_size); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Size of raw (disk) record:", (unsigned)hdr->rrec_size); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Dirty flag:", hdr->cache_info.is_dirty ? "True" : "False"); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Depth:", hdr->depth); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of records in tree:", hdr->root.all_nrec); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Number of records in root node:", hdr->root.node_nrec); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of root node:", hdr->root.addr); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Split percent:", hdr->split_percent); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Merge percent:", hdr->merge_percent); /* Print relevant node info */ - HDfprintf(stream, "%*sNode Info: (max_nrec/split_nrec/merge_nrec)\n", indent, ""); + fprintf(stream, "%*sNode Info: (max_nrec/split_nrec/merge_nrec)\n", indent, ""); for (u = 0; u < (unsigned)(hdr->depth + 1); u++) { HDsnprintf(temp_str, sizeof(temp_str), "Depth %u:", u); - HDfprintf(stream, "%*s%-*s (%u/%u/%u)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, - hdr->node_info[u].max_nrec, hdr->node_info[u].split_nrec, hdr->node_info[u].merge_nrec); + fprintf(stream, "%*s%-*s (%u/%u/%u)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str, + hdr->node_info[u].max_nrec, hdr->node_info[u].split_nrec, hdr->node_info[u].merge_nrec); } /* end for */ done: if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header") + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__hdr_debug() */ @@ -150,9 +143,6 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 4 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -171,19 +161,19 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(type); - HDassert(H5F_addr_defined(hdr_addr)); - HDassert(H5F_addr_defined(obj_addr)); - HDassert(nrec > 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(type); + assert(H5_addr_defined(hdr_addr)); + assert(H5_addr_defined(obj_addr)); + assert(nrec > 0); /* Load the B-tree header */ if (NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header"); /* Set file pointer for this B-tree operation */ hdr->f = f; @@ -193,53 +183,53 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co */ H5_CHECK_OVERFLOW(depth, unsigned, uint16_t); node_ptr.addr = addr; - H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned) + H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned); if (NULL == (internal = H5B2__protect_internal(hdr, NULL, &node_ptr, (uint16_t)depth, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node"); /* Print opening message */ - HDfprintf(stream, "%*sv2 B-tree Internal Node...\n", indent, ""); + fprintf(stream, "%*sv2 B-tree Internal Node...\n", indent, ""); /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Tree type ID:", hdr->cls->name, - (unsigned)hdr->cls->id); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of node:", (unsigned)hdr->node_size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Size of raw (disk) record:", (unsigned)hdr->rrec_size); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Dirty flag:", internal->cache_info.is_dirty ? "True" : "False"); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of records in node:", internal->nrec); + fprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Tree type ID:", hdr->cls->name, + (unsigned)hdr->cls->id); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of node:", (unsigned)hdr->node_size); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Size of raw (disk) record:", (unsigned)hdr->rrec_size); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Dirty flag:", internal->cache_info.is_dirty ? "True" : "False"); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of records in node:", internal->nrec); /* Print all node pointers and records */ for (u = 0; u < internal->nrec; u++) { /* Print node pointer */ HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); - HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3), - temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, - internal->node_ptrs[u].addr); + fprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3), + temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, + internal->node_ptrs[u].addr); /* Print record */ HDsnprintf(temp_str, sizeof(temp_str), "Record #%u:", u); - HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); - HDassert(H5B2_INT_NREC(internal, hdr, u)); + fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); + assert(H5B2_INT_NREC(internal, hdr, u)); (void)(type->debug)(stream, indent + 6, MAX(0, fwidth - 6), H5B2_INT_NREC(internal, hdr, u), hdr->cb_ctx); } /* end for */ /* Print final node pointer */ HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u); - HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3), - temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, - internal->node_ptrs[u].addr); + fprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3), + temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec, + internal->node_ptrs[u].addr); done: if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header") + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header"); if (internal && H5AC_unprotect(f, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node") + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__int_debug() */ @@ -251,9 +241,6 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 7 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -272,19 +259,19 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, c /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(type); - HDassert(H5F_addr_defined(hdr_addr)); - HDassert(H5F_addr_defined(obj_addr)); - HDassert(nrec > 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(type); + assert(H5_addr_defined(hdr_addr)); + assert(H5_addr_defined(obj_addr)); + assert(nrec > 0); /* Load the B-tree header */ if (NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header"); /* Set file pointer for this B-tree operation */ hdr->f = f; @@ -294,40 +281,40 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, c */ H5_CHECK_OVERFLOW(nrec, unsigned, uint16_t); node_ptr.addr = addr; - H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned) + H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned); if (NULL == (leaf = H5B2__protect_leaf(hdr, NULL, &node_ptr, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); /* Print opening message */ - HDfprintf(stream, "%*sv2 B-tree Leaf Node...\n", indent, ""); + fprintf(stream, "%*sv2 B-tree Leaf Node...\n", indent, ""); /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Tree type ID:", hdr->cls->name, - (unsigned)hdr->cls->id); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of node:", (unsigned)hdr->node_size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Size of raw (disk) record:", (unsigned)hdr->rrec_size); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Dirty flag:", leaf->cache_info.is_dirty ? "True" : "False"); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of records in node:", leaf->nrec); + fprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Tree type ID:", hdr->cls->name, + (unsigned)hdr->cls->id); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Size of node:", (unsigned)hdr->node_size); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Size of raw (disk) record:", (unsigned)hdr->rrec_size); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Dirty flag:", leaf->cache_info.is_dirty ? "True" : "False"); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of records in node:", leaf->nrec); /* Print all node pointers and records */ for (u = 0; u < leaf->nrec; u++) { /* Print record */ HDsnprintf(temp_str, sizeof(temp_str), "Record #%u:", u); - HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); - HDassert(H5B2_LEAF_NREC(leaf, hdr, u)); + fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); + assert(H5B2_LEAF_NREC(leaf, hdr, u)); (void)(type->debug)(stream, indent + 6, MAX(0, fwidth - 6), H5B2_LEAF_NREC(leaf, hdr, u), hdr->cb_ctx); } /* end for */ done: if (hdr && H5B2__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header"); if (leaf && H5AC_unprotect(f, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node") + HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__leaf_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5B2hdr.c b/externals/coda-oss/modules/drivers/hdf5/source/H5B2hdr.c index af592eb70b..c4ffea23ff 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5B2hdr.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5B2hdr.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5B2int.c - * Feb 27 2006 - * Quincey Koziol * * Purpose: Internal routines for managing v2 B-trees. * @@ -91,9 +88,6 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 2 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -109,16 +103,16 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, ui /* * Check arguments. */ - HDassert(hdr); - HDassert(cparam); - HDassert(cparam->cls); - HDassert((cparam->cls->crt_context && cparam->cls->dst_context) || - (NULL == cparam->cls->crt_context && NULL == cparam->cls->dst_context)); - HDassert(cparam->node_size > 0); - HDassert(cparam->rrec_size > 0); - HDassert(cparam->merge_percent > 0 && cparam->merge_percent <= 100); - HDassert(cparam->split_percent > 0 && cparam->split_percent <= 100); - HDassert(cparam->merge_percent < (cparam->split_percent / 2)); + assert(hdr); + assert(cparam); + assert(cparam->cls); + assert((cparam->cls->crt_context && cparam->cls->dst_context) || + (NULL == cparam->cls->crt_context && NULL == cparam->cls->dst_context)); + assert(cparam->node_size > 0); + assert(cparam->rrec_size > 0); + assert(cparam->merge_percent > 0 && cparam->merge_percent <= 100); + assert(cparam->split_percent > 0 && cparam->split_percent <= 100); + assert(cparam->merge_percent < (cparam->split_percent / 2)); /* Assign dynamic information */ hdr->depth = depth; @@ -134,29 +128,29 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, ui /* Allocate "page" for node I/O */ if (NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size))) - HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed") - HDmemset(hdr->page, 0, hdr->node_size); + HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed"); + memset(hdr->page, 0, hdr->node_size); /* Allocate array of node info structs */ if (NULL == (hdr->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(hdr->depth + 1)))) - HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize leaf node info */ sz_max_nrec = H5B2_NUM_LEAF_REC(hdr->node_size, hdr->rrec_size); - H5_CHECKED_ASSIGN(hdr->node_info[0].max_nrec, unsigned, sz_max_nrec, size_t) + H5_CHECKED_ASSIGN(hdr->node_info[0].max_nrec, unsigned, sz_max_nrec, size_t); hdr->node_info[0].split_nrec = (hdr->node_info[0].max_nrec * hdr->split_percent) / 100; hdr->node_info[0].merge_nrec = (hdr->node_info[0].max_nrec * hdr->merge_percent) / 100; hdr->node_info[0].cum_max_nrec = hdr->node_info[0].max_nrec; hdr->node_info[0].cum_max_nrec_size = 0; if (NULL == (hdr->node_info[0].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[0].max_nrec))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory"); hdr->node_info[0].node_ptr_fac = NULL; /* Allocate array of pointers to internal node native keys */ /* (uses leaf # of records because its the largest) */ if (NULL == (hdr->nat_off = H5FL_SEQ_MALLOC(size_t, (size_t)hdr->node_info[0].max_nrec))) - HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize offsets in native key block */ /* (uses leaf # of records because its the largest) */ @@ -166,15 +160,15 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, ui /* Compute size to store # of records in each node */ /* (uses leaf # of records because its the largest) */ u_max_nrec_size = H5VM_limit_enc_size((uint64_t)hdr->node_info[0].max_nrec); - H5_CHECKED_ASSIGN(hdr->max_nrec_size, uint8_t, u_max_nrec_size, unsigned) - HDassert(hdr->max_nrec_size <= H5B2_SIZEOF_RECORDS_PER_NODE); + H5_CHECKED_ASSIGN(hdr->max_nrec_size, uint8_t, u_max_nrec_size, unsigned); + assert(hdr->max_nrec_size <= H5B2_SIZEOF_RECORDS_PER_NODE); /* Initialize internal node info */ if (depth > 0) { for (u = 1; u < (unsigned)(depth + 1); u++) { sz_max_nrec = H5B2_NUM_INT_REC(hdr, u); - H5_CHECKED_ASSIGN(hdr->node_info[u].max_nrec, unsigned, sz_max_nrec, size_t) - HDassert(hdr->node_info[u].max_nrec <= hdr->node_info[u - 1].max_nrec); + H5_CHECKED_ASSIGN(hdr->node_info[u].max_nrec, unsigned, sz_max_nrec, size_t); + assert(hdr->node_info[u].max_nrec <= hdr->node_info[u - 1].max_nrec); hdr->node_info[u].split_nrec = (hdr->node_info[u].max_nrec * hdr->split_percent) / 100; hdr->node_info[u].merge_nrec = (hdr->node_info[u].max_nrec * hdr->merge_percent) / 100; @@ -183,15 +177,15 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, ui ((hdr->node_info[u].max_nrec + 1) * hdr->node_info[u - 1].cum_max_nrec) + hdr->node_info[u].max_nrec; u_max_nrec_size = H5VM_limit_enc_size((uint64_t)hdr->node_info[u].cum_max_nrec); - H5_CHECKED_ASSIGN(hdr->node_info[u].cum_max_nrec_size, uint8_t, u_max_nrec_size, unsigned) + H5_CHECKED_ASSIGN(hdr->node_info[u].cum_max_nrec_size, uint8_t, u_max_nrec_size, unsigned); if (NULL == (hdr->node_info[u].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[u].max_nrec))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create node native key block factory"); if (NULL == (hdr->node_info[u].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[u].max_nrec + 1)))) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, - "can't create internal 'branch' node node pointer block factory") + "can't create internal 'branch' node node pointer block factory"); } /* end for */ } /* end if */ @@ -205,12 +199,13 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, ui /* Create the callback context, if the callback exists */ if (hdr->cls->crt_context) if (NULL == (hdr->cb_ctx = (*hdr->cls->crt_context)(ctx_udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL, "unable to create v2 B-tree client callback context") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, FAIL, + "unable to create v2 B-tree client callback context"); done: if (ret_value < 0) if (H5B2__hdr_free(hdr) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free shared v2 B-tree info") + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free shared v2 B-tree info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__hdr_init() */ @@ -222,9 +217,6 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, ui * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 27 2009 - * *------------------------------------------------------------------------- */ H5B2_hdr_t * @@ -238,11 +230,11 @@ H5B2__hdr_alloc(H5F_t *f) /* * Check arguments. */ - HDassert(f); + assert(f); /* Allocate space for the shared information */ if (NULL == (hdr = H5FL_CALLOC(H5B2_hdr_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree header"); /* Assign non-zero information */ hdr->f = f; @@ -266,9 +258,6 @@ H5B2__hdr_alloc(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 21 2006 - * *------------------------------------------------------------------------- */ haddr_t @@ -283,57 +272,57 @@ H5B2__hdr_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata) /* * Check arguments. */ - HDassert(f); - HDassert(cparam); + assert(f); + assert(cparam); /* Allocate v2 B-tree header */ if (NULL == (hdr = H5B2__hdr_alloc(f))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header"); /* Initialize shared B-tree info */ if (H5B2__hdr_init(hdr, cparam, ctx_udata, (uint16_t)0) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info"); /* Allocate space for the header on disk */ if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)hdr->hdr_size))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header"); /* Create 'top' proxy for extensible array entries */ if (hdr->swmr_write) if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, HADDR_UNDEF, "can't create v2 B-tree proxy") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, HADDR_UNDEF, "can't create v2 B-tree proxy"); /* Cache the new B-tree node */ if (H5AC_insert_entry(f, H5AC_BT2_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, HADDR_UNDEF, "can't add B-tree header to cache") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, HADDR_UNDEF, "can't add B-tree header to cache"); inserted = TRUE; /* Add header as child of 'top' proxy */ if (hdr->top_proxy) if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, HADDR_UNDEF, - "unable to add v2 B-tree header as child of array proxy") + "unable to add v2 B-tree header as child of array proxy"); /* Set address of v2 B-tree header to return */ ret_value = hdr->addr; done: - if (!H5F_addr_defined(ret_value)) + if (!H5_addr_defined(ret_value)) if (hdr) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(hdr) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTREMOVE, HADDR_UNDEF, - "unable to remove v2 B-tree header from cache") + "unable to remove v2 B-tree header from cache"); /* Release header's disk space */ - if (H5F_addr_defined(hdr->addr) && + if (H5_addr_defined(hdr->addr) && H5MF_xfree(f, H5FD_MEM_BTREE, hdr->addr, (hsize_t)hdr->hdr_size) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, HADDR_UNDEF, "unable to free v2 B-tree header") + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, HADDR_UNDEF, "unable to free v2 B-tree header"); /* Destroy header */ if (H5B2__hdr_free(hdr) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, HADDR_UNDEF, "unable to release v2 B-tree header") + HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, HADDR_UNDEF, "unable to release v2 B-tree header"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -346,9 +335,6 @@ H5B2__hdr_create(H5F_t *f, const H5B2_create_t *cparam, void *ctx_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 13 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -359,12 +345,12 @@ H5B2__hdr_incr(H5B2_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(hdr); + assert(hdr); /* Mark header as un-evictable when a B-tree node is depending on it */ if (hdr->rc == 0) if (H5AC_pin_protected_entry(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPIN, FAIL, "unable to pin v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPIN, FAIL, "unable to pin v2 B-tree header"); /* Increment reference count on B-tree header */ hdr->rc++; @@ -380,9 +366,6 @@ H5B2__hdr_incr(H5B2_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 13 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -393,8 +376,8 @@ H5B2__hdr_decr(H5B2_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(hdr->rc > 0); + assert(hdr); + assert(hdr->rc > 0); /* Decrement reference count on B-tree header */ hdr->rc--; @@ -402,7 +385,7 @@ H5B2__hdr_decr(H5B2_hdr_t *hdr) /* Mark header as evictable again when no nodes depend on it */ if (hdr->rc == 0) if (H5AC_unpin_entry(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin v2 B-tree header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -415,9 +398,6 @@ H5B2__hdr_decr(H5B2_hdr_t *hdr) * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Oct 27 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -426,7 +406,7 @@ H5B2__hdr_fuse_incr(H5B2_hdr_t *hdr) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Increment file reference count on shared header */ hdr->file_rc++; @@ -441,9 +421,6 @@ H5B2__hdr_fuse_incr(H5B2_hdr_t *hdr) * * Return: The file's reference count after the decrement. (Can't fail) * - * Programmer: Quincey Koziol - * Oct 27 2009 - * *------------------------------------------------------------------------- */ size_t @@ -452,8 +429,8 @@ H5B2__hdr_fuse_decr(H5B2_hdr_t *hdr) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(hdr); - HDassert(hdr->file_rc); + assert(hdr); + assert(hdr->file_rc); /* Decrement file reference count on shared header */ hdr->file_rc--; @@ -468,9 +445,6 @@ H5B2__hdr_fuse_decr(H5B2_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 13 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -481,11 +455,11 @@ H5B2__hdr_dirty(H5B2_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Mark B-tree header as dirty in cache */ if (H5AC_mark_entry_dirty(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark v2 B-tree header as dirty") + HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark v2 B-tree header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -498,9 +472,6 @@ H5B2__hdr_dirty(H5B2_hdr_t *hdr) * * Return: Non-NULL pointer to header on success/NULL on failure * - * Programmer: Quincey Koziol - * Dec 18 2015 - * *------------------------------------------------------------------------- */ H5B2_hdr_t * @@ -513,11 +484,11 @@ H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(H5F_addr_defined(hdr_addr)); + assert(f); + assert(H5_addr_defined(hdr_addr)); /* only the H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up user data for cache callbacks */ udata.f = f; @@ -527,18 +498,18 @@ H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags) /* Protect the header */ if (NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, H5AC_BT2_HDR, hdr_addr, &udata, flags))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to load v2 B-tree header, address = %llu", - (unsigned long long)hdr_addr) + (unsigned long long)hdr_addr); hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ /* Create top proxy, if it doesn't exist */ if (hdr->swmr_write && NULL == hdr->top_proxy) { /* Create 'top' proxy for v2 B-tree entries */ if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, NULL, "can't create v2 B-tree proxy") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCREATE, NULL, "can't create v2 B-tree proxy"); /* Add header as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, "unable to add v2 B-tree header as child of proxy") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, "unable to add v2 B-tree header as child of proxy"); } /* end if */ /* Set return value */ @@ -550,7 +521,7 @@ H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags) /* Release the header, if it was protected */ if (hdr && H5AC_unprotect(hdr->f, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, - "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr_addr) + "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr_addr); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -563,9 +534,6 @@ H5B2__hdr_protect(H5F_t *f, haddr_t hdr_addr, void *ctx_udata, unsigned flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Dec 18 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -576,12 +544,12 @@ H5B2__hdr_unprotect(H5B2_hdr_t *hdr, unsigned cache_flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Unprotect the header */ if (H5AC_unprotect(hdr->f, H5AC_BT2_HDR, hdr->addr, hdr, cache_flags) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr->addr) + "unable to unprotect v2 B-tree header, address = %llu", (unsigned long long)hdr->addr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -594,9 +562,6 @@ H5B2__hdr_unprotect(H5B2_hdr_t *hdr, unsigned cache_flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 2 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -607,12 +572,12 @@ H5B2__hdr_free(H5B2_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Destroy the callback context */ if (hdr->cb_ctx) { if ((*hdr->cls->dst_context)(hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "can't destroy v2 B-tree client callback context") + HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "can't destroy v2 B-tree client callback context"); hdr->cb_ctx = NULL; } /* end if */ @@ -633,11 +598,11 @@ H5B2__hdr_free(H5B2_hdr_t *hdr) if (hdr->node_info[u].nat_rec_fac) if (H5FL_fac_term(hdr->node_info[u].nat_rec_fac) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, - "can't destroy node's native record block factory") + "can't destroy node's native record block factory"); if (hdr->node_info[u].node_ptr_fac) if (H5FL_fac_term(hdr->node_info[u].node_ptr_fac) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, - "can't destroy node's node pointer block factory") + "can't destroy node's node pointer block factory"); } /* end for */ /* Free the array of node info structs */ @@ -653,7 +618,7 @@ H5B2__hdr_free(H5B2_hdr_t *hdr) /* Destroy the 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to destroy v2 B-tree 'top' proxy") + HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to destroy v2 B-tree 'top' proxy"); hdr->top_proxy = NULL; } /* end if */ @@ -671,9 +636,6 @@ H5B2__hdr_free(H5B2_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 15 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -685,7 +647,7 @@ H5B2__hdr_delete(H5B2_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); #ifndef NDEBUG { @@ -694,18 +656,18 @@ H5B2__hdr_delete(H5B2_hdr_t *hdr) /* Check the v2 B-tree header's status in the metadata cache */ if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, - "unable to check metadata cache status for v2 B-tree header") + "unable to check metadata cache status for v2 B-tree header"); /* Sanity checks on v2 B-tree header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PROTECTED); + assert(hdr_status & H5AC_ES__IN_CACHE); + assert(hdr_status & H5AC_ES__IS_PROTECTED); } /* end block */ #endif /* NDEBUG */ /* Delete all nodes in B-tree */ - if (H5F_addr_defined(hdr->root.addr)) + if (H5_addr_defined(hdr->root.addr)) if (H5B2__delete_node(hdr, hdr->depth, &hdr->root, hdr, hdr->remove_op, hdr->remove_op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree nodes") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to delete B-tree nodes"); /* Indicate that the heap header should be deleted & file space freed */ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; @@ -713,7 +675,7 @@ H5B2__hdr_delete(H5B2_hdr_t *hdr) done: /* Unprotect the header with appropriate flags */ if (H5B2__hdr_unprotect(hdr, cache_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release v2 B-tree header") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release v2 B-tree header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__hdr_delete() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5B2int.c b/externals/coda-oss/modules/drivers/hdf5/source/H5B2int.c index 01acc5646d..269d7f7c2b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5B2int.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5B2int.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5B2int.c - * Feb 27 2006 - * Quincey Koziol * * Purpose: Internal routines for managing v2 B-trees. * @@ -86,9 +83,6 @@ H5FL_SEQ_EXTERN(H5B2_node_info_t); * being greater than value in *IDX (which should only happen when * record to locate is greater than all records to search). * - * Programmer: Quincey Koziol - * Feb 3 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -107,7 +101,7 @@ H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, co while (lo < hi && *cmp) { my_idx = (lo + hi) / 2; if ((type->compare)(udata, native + rec_off[my_idx], cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (*cmp < 0) hi = my_idx; else @@ -128,9 +122,6 @@ H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, co * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Aug 28 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -154,16 +145,16 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(internal); - HDassert(internal_flags_ptr); + assert(hdr); + assert(internal); + assert(internal_flags_ptr); /* Slide records in parent node up one space, to make room for promoted record */ if (idx < internal->nrec) { - HDmemmove(H5B2_INT_NREC(internal, hdr, idx + 1), H5B2_INT_NREC(internal, hdr, idx), - hdr->cls->nrec_size * (internal->nrec - idx)); - HDmemmove(&(internal->node_ptrs[idx + 2]), &(internal->node_ptrs[idx + 1]), - sizeof(H5B2_node_ptr_t) * (internal->nrec - idx)); + memmove(H5B2_INT_NREC(internal, hdr, idx + 1), H5B2_INT_NREC(internal, hdr, idx), + hdr->cls->nrec_size * (internal->nrec - idx)); + memmove(&(internal->node_ptrs[idx + 2]), &(internal->node_ptrs[idx + 1]), + sizeof(H5B2_node_ptr_t) * (internal->nrec - idx)); } /* end if */ /* Check for the kind of B-tree node to split */ @@ -173,7 +164,7 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, /* Create new internal node */ internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec = 0; if (H5B2__create_internal(hdr, internal, &(internal->node_ptrs[idx + 1]), (uint16_t)(depth - 1)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node"); /* Setup information for unlocking child nodes */ child_class = H5AC_BT2_INT; @@ -183,11 +174,11 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, if (NULL == (left_int = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); left_addr = internal->node_ptrs[idx].addr; if (NULL == (right_int = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1], (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); right_addr = internal->node_ptrs[idx + 1].addr; /* More setup for child nodes */ @@ -206,7 +197,7 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, /* Create new leaf node */ internal->node_ptrs[idx + 1].all_nrec = internal->node_ptrs[idx + 1].node_nrec = 0; if (H5B2__create_leaf(hdr, internal, &(internal->node_ptrs[idx + 1])) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new leaf node"); /* Setup information for unlocking child nodes */ child_class = H5AC_BT2_LEAF; @@ -215,11 +206,11 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, /* (Shadow the left node if doing SWMR writes) */ if (NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); left_addr = internal->node_ptrs[idx].addr; if (NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); right_addr = internal->node_ptrs[idx + 1].addr; /* More setup for child nodes */ @@ -299,7 +290,7 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, if (hdr->swmr_write && depth > 1) if (H5B2__update_child_flush_depends(hdr, depth, right_node_ptrs, 0, (unsigned)(*right_nrec + 1), left_child, right_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent"); #ifdef H5B2_DEBUG H5B2__assert_internal((hsize_t)0, hdr, internal); @@ -318,9 +309,9 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, done: /* Release child nodes (marked as dirty) */ if (left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node"); if (right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__split1() */ @@ -333,9 +324,6 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Feb 3 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -351,7 +339,7 @@ H5B2__split_root(H5B2_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); + assert(hdr); /* Update depth of B-tree */ hdr->depth++; @@ -359,25 +347,25 @@ H5B2__split_root(H5B2_hdr_t *hdr) /* Re-allocate array of node info structs */ if (NULL == (hdr->node_info = H5FL_SEQ_REALLOC(H5B2_node_info_t, hdr->node_info, (size_t)(hdr->depth + 1)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Update node info for new depth of tree */ sz_max_nrec = H5B2_NUM_INT_REC(hdr, hdr->depth); - H5_CHECKED_ASSIGN(hdr->node_info[hdr->depth].max_nrec, unsigned, sz_max_nrec, size_t) + H5_CHECKED_ASSIGN(hdr->node_info[hdr->depth].max_nrec, unsigned, sz_max_nrec, size_t); hdr->node_info[hdr->depth].split_nrec = (hdr->node_info[hdr->depth].max_nrec * hdr->split_percent) / 100; hdr->node_info[hdr->depth].merge_nrec = (hdr->node_info[hdr->depth].max_nrec * hdr->merge_percent) / 100; hdr->node_info[hdr->depth].cum_max_nrec = ((hdr->node_info[hdr->depth].max_nrec + 1) * hdr->node_info[hdr->depth - 1].cum_max_nrec) + hdr->node_info[hdr->depth].max_nrec; u_max_nrec_size = H5VM_limit_enc_size((uint64_t)hdr->node_info[hdr->depth].cum_max_nrec); - H5_CHECKED_ASSIGN(hdr->node_info[hdr->depth].cum_max_nrec_size, uint8_t, u_max_nrec_size, unsigned) + H5_CHECKED_ASSIGN(hdr->node_info[hdr->depth].cum_max_nrec_size, uint8_t, u_max_nrec_size, unsigned); if (NULL == (hdr->node_info[hdr->depth].nat_rec_fac = H5FL_fac_init(hdr->cls->nrec_size * hdr->node_info[hdr->depth].max_nrec))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create node native key block factory"); if (NULL == (hdr->node_info[hdr->depth].node_ptr_fac = H5FL_fac_init(sizeof(H5B2_node_ptr_t) * (hdr->node_info[hdr->depth].max_nrec + 1)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, - "can't create internal 'branch' node node pointer block factory") + "can't create internal 'branch' node node pointer block factory"); /* Keep old root node pointer info */ old_root_ptr = hdr->root; @@ -385,24 +373,24 @@ H5B2__split_root(H5B2_hdr_t *hdr) /* Create new internal node to use as root */ hdr->root.node_nrec = 0; if (H5B2__create_internal(hdr, hdr, &(hdr->root), hdr->depth) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node"); /* Protect new root node */ if (NULL == (new_root = H5B2__protect_internal(hdr, hdr, &hdr->root, hdr->depth, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); /* Set first node pointer in root node to old root node pointer info */ new_root->node_ptrs[0] = old_root_ptr; /* Split original root node */ if (H5B2__split1(hdr, hdr->depth, &(hdr->root), NULL, new_root, &new_root_flags, 0) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split old root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split old root node"); done: /* Release new root node (marked as dirty) */ if (new_root && H5AC_unprotect(hdr->f, H5AC_BT2_INT, hdr->root.addr, new_root, new_root_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree internal node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree internal node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__split_root() */ @@ -415,9 +403,6 @@ H5B2__split_root(H5B2_hdr_t *hdr) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Feb 9 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -438,8 +423,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(internal); + assert(hdr); + assert(internal); /* Check for the kind of B-tree node to redistribute */ if (depth > 1) { @@ -454,12 +439,12 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, if (NULL == (left_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); left_addr = internal->node_ptrs[idx].addr; if (NULL == (right_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); right_addr = internal->node_ptrs[idx + 1].addr; /* More setup for child nodes */ @@ -483,11 +468,11 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, /* (Shadow both nodes if doing SWMR writes) */ if (NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); left_addr = internal->node_ptrs[idx].addr; if (NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); right_addr = internal->node_ptrs[idx + 1].addr; /* More setup for child nodes */ @@ -536,8 +521,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, hdr->cls->nrec_size); /* Slide records in right node down */ - HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, move_nrec), - hdr->cls->nrec_size * new_right_nrec); + memmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, move_nrec), + hdr->cls->nrec_size * new_right_nrec); /* Handle node pointers, if we have an internal node */ if (depth > 1) { @@ -547,7 +532,7 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, /* Count the number of records being moved */ for (u = 0; u < move_nrec; u++) moved_nrec += right_node_ptrs[u].all_nrec; - H5_CHECKED_ASSIGN(left_moved_nrec, hssize_t, moved_nrec, hsize_t) + H5_CHECKED_ASSIGN(left_moved_nrec, hssize_t, moved_nrec, hsize_t); right_moved_nrec -= (hssize_t)moved_nrec; /* Copy node pointers from right node to left */ @@ -555,8 +540,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, sizeof(H5B2_node_ptr_t) * move_nrec); /* Slide node pointers in right node down */ - HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), - sizeof(H5B2_node_ptr_t) * (new_right_nrec + (unsigned)1)); + memmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), + sizeof(H5B2_node_ptr_t) * (new_right_nrec + (unsigned)1)); } /* end if */ /* Update flush dependencies for grandchildren, if using SWMR */ @@ -564,7 +549,7 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, if (H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs, (unsigned)(*left_nrec + 1), (unsigned)(*left_nrec + move_nrec + 1), right_child, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent"); /* Update number of records in child nodes */ *left_nrec = (uint16_t)(*left_nrec + move_nrec); @@ -583,11 +568,11 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, (uint16_t)(*left_nrec - new_left_nrec); /* Number of records to move from left node to right */ /* Sanity check */ - HDassert(*left_nrec > *right_nrec); + assert(*left_nrec > *right_nrec); /* Slide records in right node up */ - HDmemmove(H5B2_NAT_NREC(right_native, hdr, move_nrec), H5B2_NAT_NREC(right_native, hdr, 0), - hdr->cls->nrec_size * (*right_nrec)); + memmove(H5B2_NAT_NREC(right_native, hdr, move_nrec), H5B2_NAT_NREC(right_native, hdr, 0), + hdr->cls->nrec_size * (*right_nrec)); /* Copy record from parent node down into right child */ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), @@ -609,8 +594,8 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned u; /* Local index variable */ /* Slide node pointers in right node up */ - HDmemmove(&(right_node_ptrs[move_nrec]), &(right_node_ptrs[0]), - sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1)); + memmove(&(right_node_ptrs[move_nrec]), &(right_node_ptrs[0]), + sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1)); /* Copy node pointers from left node to right */ H5MM_memcpy(&(right_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), @@ -620,14 +605,14 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, for (u = 0; u < move_nrec; u++) moved_nrec += right_node_ptrs[u].all_nrec; left_moved_nrec -= (hssize_t)moved_nrec; - H5_CHECKED_ASSIGN(right_moved_nrec, hssize_t, moved_nrec, hsize_t) + H5_CHECKED_ASSIGN(right_moved_nrec, hssize_t, moved_nrec, hsize_t); } /* end if */ /* Update flush dependencies for grandchildren, if using SWMR */ if (hdr->swmr_write && depth > 1) if (H5B2__update_child_flush_depends(hdr, depth, right_node_ptrs, 0, (unsigned)move_nrec, left_child, right_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent"); /* Update number of records in child nodes */ *left_nrec = new_left_nrec; @@ -671,9 +656,9 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, done: /* Release child nodes (marked as dirty) */ if (left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); if (right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__redistribute2() */ @@ -686,9 +671,6 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Feb 9 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -717,9 +699,9 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(internal); - HDassert(internal_flags_ptr); + assert(hdr); + assert(internal); + assert(internal_flags_ptr); /* Check for the kind of B-tree node to redistribute */ if (depth > 1) { @@ -735,17 +717,17 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, if (NULL == (left_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx - 1], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); left_addr = internal->node_ptrs[idx - 1].addr; if (NULL == (middle_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); middle_addr = internal->node_ptrs[idx].addr; if (NULL == (right_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); right_addr = internal->node_ptrs[idx + 1].addr; /* More setup for child nodes */ @@ -774,15 +756,15 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, /* (Shadow all nodes if doing SWMR writes) */ if (NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx - 1], hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); left_addr = internal->node_ptrs[idx - 1].addr; if (NULL == (middle_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); middle_addr = internal->node_ptrs[idx].addr; if (NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); right_addr = internal->node_ptrs[idx + 1].addr; /* More setup for child nodes */ @@ -807,8 +789,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, uint16_t curr_middle_nrec = *middle_nrec; /* Sanity check rounding */ - HDassert(new_middle_nrec <= new_left_nrec); - HDassert(new_middle_nrec <= new_right_nrec); + assert(new_middle_nrec <= new_left_nrec); + assert(new_middle_nrec <= new_right_nrec); /* Move records into left node */ if (new_left_nrec > *left_nrec) { @@ -831,9 +813,9 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, moved_middle_nrec++; /* Slide records in middle node down */ - HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), - H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), - hdr->cls->nrec_size * (size_t)(*middle_nrec - moved_middle_nrec)); + memmove(H5B2_NAT_NREC(middle_native, hdr, 0), + H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), + hdr->cls->nrec_size * (size_t)(*middle_nrec - moved_middle_nrec)); /* Move node pointers also if this is an internal node */ if (depth > 1) { @@ -853,8 +835,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, middle_moved_nrec -= (hssize_t)(moved_nrec + move_nptrs); /* Slide the node pointers in middle node down */ - HDmemmove(&(middle_node_ptrs[0]), &(middle_node_ptrs[move_nptrs]), - sizeof(H5B2_node_ptr_t) * ((*middle_nrec - move_nptrs) + 1)); + memmove(&(middle_node_ptrs[0]), &(middle_node_ptrs[move_nptrs]), + sizeof(H5B2_node_ptr_t) * ((*middle_nrec - move_nptrs) + 1)); } /* end if */ /* Update flush dependencies for grandchildren, if using SWMR */ @@ -862,7 +844,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, if (H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs, (unsigned)(*left_nrec + 1), (unsigned)(*left_nrec + moved_middle_nrec + 1), middle_child, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, + "unable to update child nodes to new parent"); /* Update the current number of records in middle node */ curr_middle_nrec = (uint16_t)(curr_middle_nrec - moved_middle_nrec); @@ -878,8 +861,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, (unsigned)(new_right_nrec - *right_nrec); /* Number of records to move out of right node */ /* Slide records in right node up */ - HDmemmove(H5B2_NAT_NREC(right_native, hdr, right_nrec_move), H5B2_NAT_NREC(right_native, hdr, 0), - hdr->cls->nrec_size * (*right_nrec)); + memmove(H5B2_NAT_NREC(right_native, hdr, right_nrec_move), H5B2_NAT_NREC(right_native, hdr, 0), + hdr->cls->nrec_size * (*right_nrec)); /* Move right parent record down to right node */ H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), @@ -902,8 +885,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned u; /* Local index variable */ /* Slide the node pointers in right node up */ - HDmemmove(&(right_node_ptrs[right_nrec_move]), &(right_node_ptrs[0]), - sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1)); + memmove(&(right_node_ptrs[right_nrec_move]), &(right_node_ptrs[0]), + sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1)); /* Move middle node pointers into right node */ H5MM_memcpy(&(right_node_ptrs[0]), @@ -922,7 +905,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, if (H5B2__update_child_flush_depends(hdr, depth, right_node_ptrs, 0, (unsigned)right_nrec_move, middle_child, right_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, + "unable to update child nodes to new parent"); /* Update the current number of records in middle node */ curr_middle_nrec = (uint16_t)(curr_middle_nrec - right_nrec_move); @@ -938,8 +922,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, (unsigned)(*left_nrec - new_left_nrec); /* Number of records to move out of left node */ /* Slide middle records up */ - HDmemmove(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move), H5B2_NAT_NREC(middle_native, hdr, 0), - hdr->cls->nrec_size * curr_middle_nrec); + memmove(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move), H5B2_NAT_NREC(middle_native, hdr, 0), + hdr->cls->nrec_size * curr_middle_nrec); /* Move left parent record down to middle node */ H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), @@ -947,9 +931,9 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, /* Move left records to middle node */ if (left_nrec_move > 1) - HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), - H5B2_NAT_NREC(left_native, hdr, new_left_nrec + 1), - hdr->cls->nrec_size * (left_nrec_move - 1)); + memmove(H5B2_NAT_NREC(middle_native, hdr, 0), + H5B2_NAT_NREC(left_native, hdr, new_left_nrec + 1), + hdr->cls->nrec_size * (left_nrec_move - 1)); /* Move left parent record up from left node */ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), @@ -961,8 +945,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned u; /* Local index variable */ /* Slide the node pointers in middle node up */ - HDmemmove(&(middle_node_ptrs[left_nrec_move]), &(middle_node_ptrs[0]), - sizeof(H5B2_node_ptr_t) * (size_t)(curr_middle_nrec + 1)); + memmove(&(middle_node_ptrs[left_nrec_move]), &(middle_node_ptrs[0]), + sizeof(H5B2_node_ptr_t) * (size_t)(curr_middle_nrec + 1)); /* Move left node pointers into middle node */ H5MM_memcpy(&(middle_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), @@ -979,7 +963,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, if (hdr->swmr_write && depth > 1) if (H5B2__update_child_flush_depends(hdr, depth, middle_node_ptrs, 0, (unsigned)left_nrec_move, left_child, middle_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, + "unable to update child nodes to new parent"); /* Update the current number of records in middle node */ curr_middle_nrec = (uint16_t)(curr_middle_nrec + left_nrec_move); @@ -999,16 +984,16 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* Move right records to middle node */ - HDmemmove(H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec + 1)), - H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (right_nrec_move - 1)); + memmove(H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec + 1)), + H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (right_nrec_move - 1)); /* Move right parent record up from right node */ H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size); /* Slide right records down */ - HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, right_nrec_move), - hdr->cls->nrec_size * new_right_nrec); + memmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, right_nrec_move), + hdr->cls->nrec_size * new_right_nrec); /* Move node pointers also if this is an internal node */ if (depth > 1) { @@ -1026,8 +1011,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, middle_moved_nrec += (hssize_t)(moved_nrec + right_nrec_move); /* Slide the node pointers in right node down */ - HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[right_nrec_move]), - sizeof(H5B2_node_ptr_t) * (size_t)(new_right_nrec + 1)); + memmove(&(right_node_ptrs[0]), &(right_node_ptrs[right_nrec_move]), + sizeof(H5B2_node_ptr_t) * (size_t)(new_right_nrec + 1)); } /* end if */ /* Update flush dependencies for grandchildren, if using SWMR */ @@ -1035,7 +1020,8 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, if (H5B2__update_child_flush_depends( hdr, depth, middle_node_ptrs, (unsigned)(curr_middle_nrec + 1), (unsigned)(curr_middle_nrec + right_nrec_move + 1), right_child, middle_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, + "unable to update child nodes to new parent"); /* Mark nodes as dirty */ middle_child_flags |= H5AC__DIRTIED_FLAG; @@ -1093,12 +1079,12 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, done: /* Unlock child nodes (marked as dirty) */ if (left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); if (middle_child && H5AC_unprotect(hdr->f, child_class, middle_addr, middle_child, middle_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); if (right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__redistribute3() */ @@ -1112,9 +1098,6 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, * * Failure: Negative * - * Programmer: Quincey Koziol - * Mar 4 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1136,10 +1119,10 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(curr_node_ptr); - HDassert(internal); - HDassert(internal_flags_ptr); + assert(hdr); + assert(curr_node_ptr); + assert(internal); + assert(internal_flags_ptr); /* Check for the kind of B-tree node to split */ if (depth > 1) { @@ -1154,12 +1137,12 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, if (NULL == (left_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); left_addr = internal->node_ptrs[idx].addr; if (NULL == (right_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1], (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); right_addr = internal->node_ptrs[idx + 1].addr; /* More setup for accessing child node information */ @@ -1183,11 +1166,11 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, /* (Shadow the left node if doing SWMR writes) */ if (NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); left_addr = internal->node_ptrs[idx].addr; if (NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); right_addr = internal->node_ptrs[idx + 1].addr; /* More setup for accessing child node information */ @@ -1219,7 +1202,7 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, if (H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs, (unsigned)(*left_nrec + 1), (unsigned)(*left_nrec + *right_nrec + 2), right_child, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent"); /* Update # of records in left node */ *left_nrec = (uint16_t)(*left_nrec + *right_nrec + 1); @@ -1239,10 +1222,10 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, /* Slide records in parent node down, to eliminate demoted record */ if ((idx + 1) < internal->nrec) { - HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), - hdr->cls->nrec_size * (internal->nrec - (idx + 1))); - HDmemmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]), - sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1))); + memmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), + hdr->cls->nrec_size * (internal->nrec - (idx + 1))); + memmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]), + sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1))); } /* end if */ /* Update # of records in parent node */ @@ -1269,11 +1252,11 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, done: /* Unlock left node (marked as dirty) */ if (left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); /* Delete right node & remove from cache (marked as dirty) */ if (right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__merge2() */ @@ -1287,9 +1270,6 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, * * Failure: Negative * - * Programmer: Quincey Koziol - * Mar 4 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1318,10 +1298,10 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(curr_node_ptr); - HDassert(internal); - HDassert(internal_flags_ptr); + assert(hdr); + assert(curr_node_ptr); + assert(internal); + assert(internal_flags_ptr); /* Check for the kind of B-tree node to split */ if (depth > 1) { @@ -1337,17 +1317,17 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, if (NULL == (left_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx - 1], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); left_addr = internal->node_ptrs[idx - 1].addr; if (NULL == (middle_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); middle_addr = internal->node_ptrs[idx].addr; if (NULL == (right_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx + 1], (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); right_addr = internal->node_ptrs[idx + 1].addr; /* More setup for accessing child node information */ @@ -1376,15 +1356,15 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, /* (Shadow left and middle nodes if doing SWMR writes) */ if (NULL == (left_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx - 1], hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); left_addr = internal->node_ptrs[idx - 1].addr; if (NULL == (middle_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], hdr->swmr_write, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); middle_addr = internal->node_ptrs[idx].addr; if (NULL == (right_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx + 1], FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); right_addr = internal->node_ptrs[idx + 1].addr; /* More setup for accessing child node information */ @@ -1420,8 +1400,8 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size); /* Slide records in middle node down */ - HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, middle_nrec_move), - hdr->cls->nrec_size * (*middle_nrec - middle_nrec_move)); + memmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, middle_nrec_move), + hdr->cls->nrec_size * (*middle_nrec - middle_nrec_move)); /* Move node pointers also if this is an internal node */ if (depth > 1) { @@ -1436,8 +1416,8 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, middle_moved_nrec += middle_node_ptrs[u].all_nrec; /* Slide the node pointers in middle node down */ - HDmemmove(&(middle_node_ptrs[0]), &(middle_node_ptrs[middle_nrec_move]), - sizeof(H5B2_node_ptr_t) * (size_t)((unsigned)(*middle_nrec + 1) - middle_nrec_move)); + memmove(&(middle_node_ptrs[0]), &(middle_node_ptrs[middle_nrec_move]), + sizeof(H5B2_node_ptr_t) * (size_t)((unsigned)(*middle_nrec + 1) - middle_nrec_move)); } /* end if */ /* Update flush dependencies for grandchildren, if using SWMR */ @@ -1445,7 +1425,7 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, if (H5B2__update_child_flush_depends(hdr, depth, left_node_ptrs, (unsigned)(*left_nrec + 1), (unsigned)(*left_nrec + middle_nrec_move + 1), middle_child, left_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent"); /* Update # of records in left & middle nodes */ *left_nrec = (uint16_t)(*left_nrec + middle_nrec_move); @@ -1477,7 +1457,7 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, if (H5B2__update_child_flush_depends(hdr, depth, middle_node_ptrs, (unsigned)(*middle_nrec + 1), (unsigned)(*middle_nrec + *right_nrec + 2), right_child, middle_child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child nodes to new parent"); /* Update # of records in middle node */ *middle_nrec = (uint16_t)(*middle_nrec + (*right_nrec + 1)); @@ -1499,10 +1479,10 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, /* Slide records in parent node down, to eliminate demoted record */ if ((idx + 1) < internal->nrec) { - HDmemmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), - hdr->cls->nrec_size * (internal->nrec - (idx + 1))); - HDmemmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]), - sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1))); + memmove(H5B2_INT_NREC(internal, hdr, idx), H5B2_INT_NREC(internal, hdr, idx + 1), + hdr->cls->nrec_size * (internal->nrec - (idx + 1))); + memmove(&(internal->node_ptrs[idx + 1]), &(internal->node_ptrs[idx + 2]), + sizeof(H5B2_node_ptr_t) * (internal->nrec - (idx + 1))); } /* end if */ /* Update # of records in parent node */ @@ -1534,14 +1514,14 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, done: /* Unlock left & middle nodes (marked as dirty) */ if (left_child && H5AC_unprotect(hdr->f, child_class, left_addr, left_child, left_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); if (middle_child && H5AC_unprotect(hdr->f, child_class, middle_addr, middle_child, middle_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); /* Delete right node & remove from cache (marked as dirty) */ if (right_child && H5AC_unprotect(hdr->f, child_class, right_addr, right_child, right_child_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__merge3() */ @@ -1553,9 +1533,6 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Dec 23 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -1566,35 +1543,35 @@ H5B2__insert(H5B2_hdr_t *hdr, void *udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(udata); + assert(hdr); + assert(udata); /* Check if the root node is allocated yet */ - if (!H5F_addr_defined(hdr->root.addr)) { + if (!H5_addr_defined(hdr->root.addr)) { /* Create root node as leaf node in B-tree */ if (H5B2__create_leaf(hdr, hdr, &(hdr->root)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node"); } /* end if */ /* Check if we need to split the root node (equiv. to a 1->2 node split) */ else if (hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) { /* Split root node */ if (H5B2__split_root(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node"); } /* end if */ /* Attempt to insert record into B-tree */ if (hdr->depth > 0) { if (H5B2__insert_internal(hdr, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, hdr, udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node"); } /* end if */ else { if (H5B2__insert_leaf(hdr, &hdr->root, H5B2_POS_ROOT, hdr, udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node"); } /* end else */ /* Mark B-tree header as dirty */ if (H5B2__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") + HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1611,9 +1588,6 @@ H5B2__insert(H5B2_hdr_t *hdr, void *udata) * * Return: Value from callback, non-negative on success, negative on error * - * Programmer: Quincey Koziol - * Feb 11 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1632,9 +1606,9 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(curr_node); - HDassert(op); + assert(hdr); + assert(curr_node); + assert(op); /* Protect current node & set up variables */ if (depth > 0) { @@ -1643,7 +1617,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, /* Lock the current B-tree node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); /* Set up information about current node */ curr_node_class = H5AC_BT2_INT; @@ -1653,7 +1627,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, /* Allocate space for the node pointers in memory */ if (NULL == (node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for B-tree internal node pointers") + "memory allocation failed for B-tree internal node pointers"); /* Copy the node pointers */ H5MM_memcpy(node_ptrs, internal->node_ptrs, @@ -1665,7 +1639,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, /* Lock the current B-tree node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, (H5B2_node_ptr_t *)curr_node, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); /* Set up information about current node */ curr_node_class = H5AC_BT2_LEAF; @@ -1676,7 +1650,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, /* Allocate space for the native keys in memory */ if (NULL == (native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for B-tree internal native keys") + "memory allocation failed for B-tree internal native keys"); /* Copy the native keys */ H5MM_memcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec)); @@ -1684,7 +1658,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, /* Unlock the node */ if (H5AC_unprotect(hdr->f, curr_node_class, curr_node->addr, node, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); if (hdr->swmr_write) node_pinned = TRUE; else @@ -1713,7 +1687,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, done: /* Unpin the node if it was pinned */ if (node_pinned && H5AC_unpin_entry(node) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "can't unpin node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "can't unpin node"); /* Release the node pointers & native records, if they were copied */ if (node_ptrs) @@ -1732,9 +1706,6 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, * * Return: Value from callback, non-negative on success, negative on error * - * Programmer: Quincey Koziol - * Mar 9 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1749,8 +1720,8 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, v FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(curr_node); + assert(hdr); + assert(curr_node); if (depth > 0) { H5B2_internal_t *internal; /* Pointer to internal node */ @@ -1759,7 +1730,7 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, v /* Lock the current B-tree node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); /* Set up information about current node */ curr_node_class = H5AC_BT2_INT; @@ -1770,7 +1741,7 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, v for (u = 0; u < internal->nrec + (unsigned)1; u++) if (H5B2__delete_node(hdr, (uint16_t)(depth - 1), &(internal->node_ptrs[u]), internal, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node descent failed") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node descent failed"); } /* end if */ else { H5B2_leaf_t *leaf; /* Pointer to leaf node */ @@ -1778,7 +1749,7 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, v /* Lock the current B-tree node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, (H5B2_node_ptr_t *)curr_node, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); /* Set up information about current node */ curr_node_class = H5AC_BT2_LEAF; @@ -1794,7 +1765,7 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, v for (u = 0; u < curr_node->node_nrec; u++) { /* Make callback for each record */ if ((op)(H5B2_NAT_NREC(native, hdr, u), op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "iterator function failed"); } /* end for */ } /* end if */ @@ -1803,7 +1774,7 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, v if (node && H5AC_unprotect( hdr->f, curr_node_class, curr_node->addr, node, (unsigned)(H5AC__DELETED_FLAG | (hdr->swmr_write ? 0 : H5AC__FREE_FILE_SPACE_FLAG))) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__delete_node() */ @@ -1816,9 +1787,6 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, v * * Return: non-negative on success, negative on error * - * Programmer: Vailin Choi - * July 12 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1831,15 +1799,15 @@ H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, voi FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(curr_node); - HDassert(btree_size); - HDassert(depth > 0); + assert(hdr); + assert(curr_node); + assert(btree_size); + assert(depth > 0); /* Lock the current B-tree node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); /* Recursively descend into child nodes, if we are above the "twig" level in the B-tree */ if (depth > 1) { @@ -1849,7 +1817,7 @@ H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, voi for (u = 0; u < internal->nrec + (unsigned)1; u++) if (H5B2__node_size(hdr, (uint16_t)(depth - 1), &(internal->node_ptrs[u]), internal, btree_size) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed"); } /* end if */ else /* depth is 1: count all the leaf nodes from this node */ *btree_size += (hsize_t)(internal->nrec + 1) * hdr->node_size; @@ -1859,7 +1827,7 @@ H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, voi done: if (internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node->addr, internal, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__node_size() */ @@ -1871,9 +1839,6 @@ H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, voi * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -1884,12 +1849,12 @@ H5B2__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(parent_entry); - HDassert(child_entry); + assert(parent_entry); + assert(child_entry); /* Create a flush dependency between parent and child entry */ if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1902,9 +1867,6 @@ H5B2__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 1 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -1919,15 +1881,15 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(hdr); - HDassert(depth > 0); - HDassert(node_ptr); - HDassert(old_parent); - HDassert(new_parent); + assert(hdr); + assert(depth > 0); + assert(node_ptr); + assert(old_parent); + assert(new_parent); /* Check the node's entry status in the metadata cache */ if (H5AC_get_entry_status(hdr->f, node_ptr->addr, &node_status) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to check status of B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to check status of B-tree node"); /* If the node is in the cache, check for retargeting its parent */ if (node_status & H5AC_ES__IN_CACHE) { @@ -1941,7 +1903,7 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node /* Protect child */ if (NULL == (child_int = H5B2__protect_internal(hdr, new_parent, node_ptr, (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); child_class = H5AC_BT2_INT; child = child_int; @@ -1950,7 +1912,7 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node update_deps = TRUE; } /* end if */ else - HDassert(child_int->parent == new_parent); + assert(child_int->parent == new_parent); } /* end if */ else { H5B2_leaf_t *child_leaf; @@ -1958,7 +1920,7 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node /* Protect child */ if (NULL == (child_leaf = H5B2__protect_leaf(hdr, new_parent, (H5B2_node_ptr_t *)node_ptr, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); child_class = H5AC_BT2_LEAF; child = child_leaf; @@ -1967,20 +1929,20 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node update_deps = TRUE; } /* end if */ else - HDassert(child_leaf->parent == new_parent); + assert(child_leaf->parent == new_parent); } /* end else */ /* Update flush dependencies if necessary */ if (update_deps) { /* Sanity check */ - HDassert(parent_ptr); + assert(parent_ptr); /* Switch the flush dependency for the node */ if (H5B2__destroy_flush_depend((H5AC_info_t *)old_parent, (H5AC_info_t *)child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); *parent_ptr = new_parent; if (H5B2__create_flush_depend((H5AC_info_t *)new_parent, (H5AC_info_t *)child) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); } /* end if */ } /* end if */ @@ -1988,7 +1950,7 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node /* Unprotect the child */ if (child) if (H5AC_unprotect(hdr->f, child_class, node_ptr->addr, child, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__update_flush_depend() */ @@ -2000,9 +1962,6 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 1 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -2015,18 +1974,18 @@ H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(hdr); - HDassert(depth > 1); - HDassert(node_ptrs); - HDassert(start_idx <= end_idx); - HDassert(old_parent); - HDassert(new_parent); + assert(hdr); + assert(depth > 1); + assert(node_ptrs); + assert(start_idx <= end_idx); + assert(old_parent); + assert(new_parent); /* Loop over children */ for (u = start_idx; u < end_idx; u++) /* Update parent for children */ if (H5B2__update_flush_depend(hdr, depth - 1, &node_ptrs[u], old_parent, new_parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2039,9 +1998,6 @@ H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_ * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -2052,12 +2008,12 @@ H5B2__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(parent_entry); - HDassert(child_entry); + assert(parent_entry); + assert(child_entry); /* Destroy a flush dependency between parent and child entry */ if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5B2internal.c b/externals/coda-oss/modules/drivers/hdf5/source/H5B2internal.c index 05b4f9661d..399bcd2039 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5B2internal.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5B2internal.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5B2internal.c - * Dec 01 2016 - * Quincey Koziol * * Purpose: Routines for managing v2 B-tree internal nodes. * @@ -76,9 +73,6 @@ H5FL_DEFINE(H5B2_internal_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 3 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -91,17 +85,17 @@ H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(node_ptr); - HDassert(depth > 0); + assert(hdr); + assert(node_ptr); + assert(depth > 0); /* Allocate memory for internal node information */ if (NULL == (internal = H5FL_CALLOC(H5B2_internal_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal info") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal info"); /* Increment ref. count on B-tree header */ if (H5B2__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header"); /* Share B-tree header information */ internal->hdr = hdr; @@ -109,15 +103,15 @@ H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, /* Allocate space for the native keys in memory */ if (NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for B-tree internal native keys") - HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); + "memory allocation failed for B-tree internal native keys"); + memset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); /* Allocate space for the node pointers in memory */ if (NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for B-tree internal node pointers") - HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1)); + "memory allocation failed for B-tree internal node pointers"); + memset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1)); /* Set depth of the node */ internal->depth = depth; @@ -130,17 +124,17 @@ H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, /* Allocate space on disk for the internal node */ if (HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree internal node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree internal node"); /* Cache the new B-tree node */ if (H5AC_insert_entry(hdr->f, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree internal node to cache") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree internal node to cache"); inserted = TRUE; /* Add internal node as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, internal) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, FAIL, "unable to add v2 B-tree node as child of proxy") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, FAIL, "unable to add v2 B-tree node as child of proxy"); internal->top_proxy = hdr->top_proxy; } /* end if */ @@ -151,17 +145,17 @@ H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, if (inserted) if (H5AC_remove_entry(internal) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTREMOVE, FAIL, - "unable to remove v2 B-tree internal node from cache") + "unable to remove v2 B-tree internal node from cache"); /* Release internal node's disk space */ - if (H5F_addr_defined(node_ptr->addr) && + if (H5_addr_defined(node_ptr->addr) && H5MF_xfree(hdr->f, H5FD_MEM_BTREE, node_ptr->addr, (hsize_t)hdr->node_size) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, - "unable to release file space for v2 B-tree internal node") + "unable to release file space for v2 B-tree internal node"); /* Destroy internal node */ if (H5B2__internal_free(internal) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree internal node") + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree internal node"); } /* end if */ } /* end if */ @@ -175,9 +169,6 @@ H5B2__create_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, * * Return: Pointer to internal node on success/NULL on failure * - * Programmer: Quincey Koziol - * Aug 25 2006 - * *------------------------------------------------------------------------- */ H5B2_internal_t * @@ -191,13 +182,13 @@ H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(node_ptr); - HDassert(H5F_addr_defined(node_ptr->addr)); - HDassert(depth > 0); + assert(hdr); + assert(node_ptr); + assert(H5_addr_defined(node_ptr->addr)); + assert(depth > 0); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up user data for callback */ udata.f = hdr->f; @@ -209,21 +200,21 @@ H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, /* Protect the internal node */ if (NULL == (internal = (H5B2_internal_t *)H5AC_protect(hdr->f, H5AC_BT2_INT, node_ptr->addr, &udata, flags))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect B-tree internal node"); /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == internal->top_proxy) { /* Add internal node as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, internal) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, - "unable to add v2 B-tree internal node as child of proxy") + "unable to add v2 B-tree internal node as child of proxy"); internal->top_proxy = hdr->top_proxy; } /* end if */ /* Shadow the node, if requested */ if (shadow) if (H5B2__shadow_internal(internal, node_ptr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, NULL, "unable to shadow internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, NULL, "unable to shadow internal node"); /* Set return value */ ret_value = internal; @@ -238,7 +229,7 @@ H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, if (H5AC_proxy_entry_remove_child(internal->top_proxy, internal) < 0) HDONE_ERROR( H5E_BTREE, H5E_CANTUNDEPEND, NULL, - "unable to destroy flush dependency between internal node and v2 B-tree 'top' proxy") + "unable to destroy flush dependency between internal node and v2 B-tree 'top' proxy"); internal->top_proxy = NULL; } /* end if */ @@ -246,7 +237,7 @@ H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to unprotect v2 B-tree internal node, address = %llu", - (unsigned long long)node_ptr->addr) + (unsigned long long)node_ptr->addr); } /* end if */ } /* end if */ @@ -273,9 +264,6 @@ H5B2__protect_internal(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Mar 9 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -290,21 +278,21 @@ H5B2__neighbor_internal(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_n FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(depth > 0); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); - HDassert(op); + assert(hdr); + assert(depth > 0); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); + assert(op); /* Lock current B-tree node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); /* Locate node pointer for child */ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp > 0) idx++; @@ -314,7 +302,7 @@ H5B2__neighbor_internal(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_n neighbor_loc = H5B2_INT_NREC(internal, hdr, idx - 1); } /* end if */ else { - HDassert(comp == H5B2_COMPARE_GREATER); + assert(comp == H5B2_COMPARE_GREATER); if (idx < internal->nrec) neighbor_loc = H5B2_INT_NREC(internal, hdr, idx); @@ -325,19 +313,19 @@ H5B2__neighbor_internal(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_n if (H5B2__neighbor_internal(hdr, (uint16_t)(depth - 1), &internal->node_ptrs[idx], neighbor_loc, comp, internal, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, - "unable to find neighbor record in B-tree internal node") + "unable to find neighbor record in B-tree internal node"); } /* end if */ else { if (H5B2__neighbor_leaf(hdr, &internal->node_ptrs[idx], neighbor_loc, comp, internal, udata, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree leaf node"); } /* end else */ done: /* Release the B-tree internal node */ if (internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__neighbor_internal() */ @@ -349,9 +337,6 @@ H5B2__neighbor_internal(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_n * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 2 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -367,18 +352,18 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(depth > 0); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); + assert(hdr); + assert(depth > 0); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); /* Lock current B-tree node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); /* Sanity check number of records */ - HDassert(internal->nrec == curr_node_ptr->node_nrec); + assert(internal->nrec == curr_node_ptr->node_nrec); /* Split or redistribute child node pointers, if necessary */ { @@ -389,9 +374,9 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in /* Locate node pointer for child */ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp == 0) - HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree"); if (cmp > 0) idx++; @@ -413,24 +398,24 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in if (retries > 0 && (internal->node_ptrs[idx + 1].node_nrec < split_nrec)) { if (H5B2__redistribute2(hdr, depth, internal, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, - "unable to redistribute child node records") + "unable to redistribute child node records"); } /* end if */ else { if (H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node"); } /* end else */ } /* end if */ else if (idx == internal->nrec) { /* Right-most child */ if (retries > 0 && (internal->node_ptrs[idx - 1].node_nrec < split_nrec)) { if (H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, - "unable to redistribute child node records") + "unable to redistribute child node records"); } /* end if */ else { if (H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node"); } /* end else */ } /* end if */ else { /* Middle child */ @@ -438,12 +423,12 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in (internal->node_ptrs[idx - 1].node_nrec < split_nrec))) { if (H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, - "unable to redistribute child node records") + "unable to redistribute child node records"); } /* end if */ else { if (H5B2__split1(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node"); } /* end else */ } /* end else */ @@ -452,9 +437,9 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in */ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp == 0) - HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree"); if (cmp > 0) idx++; @@ -479,11 +464,11 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in if (depth > 1) { if (H5B2__insert_internal(hdr, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], next_pos, internal, udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node"); } /* end if */ else { if (H5B2__insert_leaf(hdr, &internal->node_ptrs[idx], next_pos, internal, udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node"); } /* end else */ /* Update record count for node pointer to current node */ @@ -498,11 +483,11 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in /* Shadow the node if doing SWMR writes */ if (hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG)) if (H5B2__shadow_internal(internal, curr_node_ptr) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node"); /* Unprotect node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -518,9 +503,6 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Dec 24 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -538,23 +520,23 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(depth > 0); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); + assert(hdr); + assert(depth > 0); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); /* Lock current B-tree node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); /* Sanity check number of records */ - HDassert(internal->nrec == curr_node_ptr->node_nrec); + assert(internal->nrec == curr_node_ptr->node_nrec); /* Locate node pointer for child */ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); /* Check for modifying existing record */ if (0 == cmp) { @@ -563,10 +545,10 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in /* Make callback for current record */ if ((op)(H5B2_INT_NREC(internal, hdr, idx), op_data, &changed) < 0) { /* Make certain that the callback didn't modify the value if it failed */ - HDassert(changed == FALSE); + assert(changed == FALSE); HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, - "'modify' callback failed for B-tree update operation") + "'modify' callback failed for B-tree update operation"); } /* end if */ /* Mark the node as dirty if it changed */ @@ -597,12 +579,12 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in if (H5B2__update_internal(hdr, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], status, next_pos, internal, udata, op, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, - "unable to update record in internal B-tree node") + "unable to update record in internal B-tree node"); } /* end if */ else { if (H5B2__update_leaf(hdr, &internal->node_ptrs[idx], status, next_pos, internal, udata, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in leaf B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in leaf B-tree node"); } /* end else */ /* Take actions based on child's status report */ @@ -667,7 +649,7 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, - "unable to release internal B-tree node") + "unable to release internal B-tree node"); internal = NULL; /* Punt back to caller */ @@ -677,7 +659,7 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in /* Release the internal B-tree node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node"); internal = NULL; /* Indicate that the record was inserted */ @@ -687,13 +669,13 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in if (H5B2__insert_internal(hdr, depth, parent_cache_info_flags_ptr, curr_node_ptr, curr_pos, parent, udata) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, - "unable to insert record into internal B-tree node") + "unable to insert record into internal B-tree node"); break; case H5B2_UPDATE_UNKNOWN: default: - HDassert(0 && "Invalid update status"); - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "invalid update status") + assert(0 && "Invalid update status"); + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "invalid update status"); } /* end switch */ } /* end else */ @@ -704,7 +686,7 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in if (hdr->swmr_write && (internal_flags & H5AC__DIRTIED_FLAG)) { /* Attempt to shadow the node if doing SWMR writes */ if (H5B2__shadow_internal(internal, curr_node_ptr) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal B-tree node"); /* Change the state to "shadowed" if only modified currently */ /* (Triggers parent to be marked dirty) */ @@ -714,7 +696,7 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in /* Unprotect node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -731,9 +713,6 @@ H5B2__update_internal(H5B2_hdr_t *hdr, uint16_t depth, unsigned *parent_cache_in * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Apr 27 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -747,12 +726,12 @@ H5B2__shadow_internal(H5B2_internal_t *internal, H5B2_node_ptr_t *curr_node_ptr) /* * Check arguments. */ - HDassert(internal); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); + assert(internal); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); hdr = internal->hdr; - HDassert(hdr); - HDassert(hdr->swmr_write); + assert(hdr); + assert(hdr->swmr_write); /* We only need to shadow the node if it has not been shadowed since the * last time the header was flushed, as otherwise it will be unreachable by @@ -769,11 +748,11 @@ H5B2__shadow_internal(H5B2_internal_t *internal, H5B2_node_ptr_t *curr_node_ptr) */ /* Allocate space for the cloned node */ if (HADDR_UNDEF == (new_node_addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move B-tree node"); /* Move the location of the node on the disk */ if (H5AC_move_entry(hdr->f, H5AC_BT2_INT, curr_node_ptr->addr, new_node_addr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTMOVE, FAIL, "unable to move B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTMOVE, FAIL, "unable to move B-tree node"); curr_node_ptr->addr = new_node_addr; /* Should free the space in the file, but this is not supported by @@ -795,9 +774,6 @@ H5B2__shadow_internal(H5B2_internal_t *internal, H5B2_node_ptr_t *curr_node_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 3 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -820,16 +796,16 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(depth > 0); - HDassert(parent_cache_info); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); + assert(hdr); + assert(depth > 0); + assert(parent_cache_info); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); /* Lock current B-tree node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent_cache_info, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); internal_addr = curr_node_ptr->addr; /* Determine the correct number of records to merge at */ @@ -843,7 +819,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, /* Merge children of root node */ if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node"); /* Let the cache know that the object is deleted */ internal_flags |= H5AC__DELETED_FLAG; @@ -857,7 +833,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, /* Update flush dependency for child, if using SWMR */ if (hdr->swmr_write) if (H5B2__update_flush_depend(hdr, depth, curr_node_ptr, internal, hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent"); /* Indicate that the level of the B-tree decreased */ *depth_decreased = TRUE; @@ -882,7 +858,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, /* Shadow the node if doing SWMR writes */ if (hdr->swmr_write) { if (H5B2__shadow_internal(internal, curr_node_ptr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node"); internal_addr = curr_node_ptr->addr; } /* end if */ @@ -892,7 +868,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, else { if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp >= 0) idx++; } /* end else */ @@ -918,24 +894,24 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, if (retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) { if (H5B2__redistribute2(hdr, depth, internal, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, - "unable to redistribute child node records") + "unable to redistribute child node records"); } /* end if */ else { if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node"); } /* end else */ } /* end if */ else if (idx == internal->nrec) { /* Right-most child */ if (retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) { if (H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, - "unable to redistribute child node records") + "unable to redistribute child node records"); } /* end if */ else { if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node"); } /* end else */ } /* end if */ else { /* Middle child */ @@ -943,12 +919,12 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, (internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) { if (H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, - "unable to redistribute child node records") + "unable to redistribute child node records"); } /* end if */ else { if (H5B2__merge3(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node"); } /* end else */ } /* end else */ @@ -960,7 +936,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, * re-searching */ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp >= 0) idx++; } /* end else */ @@ -978,7 +954,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, /* Swap record to delete with record from leaf, if we are the last internal node */ if (swap_loc && depth == 1) if (H5B2__swap_leaf(hdr, depth, internal, &internal_flags, idx, swap_loc) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "Can't swap records in B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "Can't swap records in B-tree"); /* Set pointers for advancing to child node */ new_cache_info_flags_ptr = &internal_flags; @@ -1003,11 +979,11 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, if (H5B2__remove_internal(hdr, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1), new_cache_info, new_cache_info_flags_ptr, next_pos, new_node_ptr, udata, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node"); } /* end if */ else { if (H5B2__remove_leaf(hdr, new_node_ptr, next_pos, new_cache_info, udata, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node"); } /* end else */ /* Update record count for node pointer to current node */ @@ -1026,7 +1002,7 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, done: /* Release the B-tree internal node */ if (internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__remove_internal() */ @@ -1039,9 +1015,6 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *swap_loc, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1064,19 +1037,19 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *sw FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(depth > 0); - HDassert(parent_cache_info); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); + assert(hdr); + assert(depth > 0); + assert(parent_cache_info); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); /* Lock current B-tree node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent_cache_info, curr_node_ptr, depth, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); internal_addr = curr_node_ptr->addr; - HDassert(internal->nrec == curr_node_ptr->node_nrec); - HDassert(depth == hdr->depth || internal->nrec > 1); + assert(internal->nrec == curr_node_ptr->node_nrec); + assert(depth == hdr->depth || internal->nrec > 1); /* Determine the correct number of records to merge at */ merge_nrec = hdr->node_info[depth - 1].merge_nrec; @@ -1085,12 +1058,12 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *sw /* (The root node is the only internal node allowed to have 1 record) */ if (internal->nrec == 1 && ((internal->node_ptrs[0].node_nrec + internal->node_ptrs[1].node_nrec) <= ((merge_nrec * 2) + 1))) { - HDassert(depth == hdr->depth); + assert(depth == hdr->depth); /* Merge children of root node */ if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, 0) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node"); /* Let the cache know that the object is deleted */ internal_flags |= H5AC__DELETED_FLAG; @@ -1104,7 +1077,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *sw /* Update flush dependency for child, if using SWMR */ if (hdr->swmr_write) if (H5B2__update_flush_depend(hdr, depth, curr_node_ptr, internal, hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update child node to new parent"); /* Indicate that the level of the B-tree decreased */ *depth_decreased = TRUE; @@ -1130,7 +1103,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *sw /* Shadow the node if doing SWMR writes */ if (hdr->swmr_write) { if (H5B2__shadow_internal(internal, curr_node_ptr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow internal node"); internal_addr = curr_node_ptr->addr; } /* end if */ @@ -1186,24 +1159,24 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *sw if (retries > 0 && (internal->node_ptrs[idx + 1].node_nrec > merge_nrec)) { if (H5B2__redistribute2(hdr, depth, internal, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, - "unable to redistribute child node records") + "unable to redistribute child node records"); } /* end if */ else { if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node"); } /* end else */ } /* end if */ else if (idx == internal->nrec) { /* Right-most child */ if (retries > 0 && (internal->node_ptrs[idx - 1].node_nrec > merge_nrec)) { if (H5B2__redistribute2(hdr, depth, internal, (idx - 1)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, - "unable to redistribute child node records") + "unable to redistribute child node records"); } /* end if */ else { if (H5B2__merge2(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, (idx - 1)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node"); } /* end else */ } /* end if */ else { /* Middle child */ @@ -1211,12 +1184,12 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *sw (internal->node_ptrs[idx - 1].node_nrec > merge_nrec))) { if (H5B2__redistribute3(hdr, depth, internal, &internal_flags, idx) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTREDISTRIBUTE, FAIL, - "unable to redistribute child node records") + "unable to redistribute child node records"); } /* end if */ else { if (H5B2__merge3(hdr, depth, curr_node_ptr, parent_cache_info_flags_ptr, internal, &internal_flags, idx) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to merge child node"); } /* end else */ } /* end else */ @@ -1272,7 +1245,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *sw /* Swap record to delete with record from leaf, if we are the last internal node */ if (swap_loc && depth == 1) if (H5B2__swap_leaf(hdr, depth, internal, &internal_flags, idx, swap_loc) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "can't swap records in B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSWAP, FAIL, "can't swap records in B-tree"); /* Set pointers for advancing to child node */ new_cache_info_flags_ptr = &internal_flags; @@ -1297,12 +1270,12 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *sw if (H5B2__remove_internal_by_idx(hdr, depth_decreased, swap_loc, swap_parent, (uint16_t)(depth - 1), new_cache_info, new_cache_info_flags_ptr, new_node_ptr, next_pos, n, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree internal node"); } /* end if */ else { if (H5B2__remove_leaf_by_idx(hdr, new_node_ptr, next_pos, new_cache_info, (unsigned)n, op, op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree leaf node"); } /* end else */ /* Update record count for node pointer to child node */ @@ -1321,7 +1294,7 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *sw done: /* Release the B-tree internal node */ if (internal && H5AC_unprotect(hdr->f, H5AC_BT2_INT, internal_addr, internal, internal_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__remove_internal_by_idx() */ @@ -1333,9 +1306,6 @@ H5B2__remove_internal_by_idx(H5B2_hdr_t *hdr, hbool_t *depth_decreased, void *sw * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 2 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1348,7 +1318,7 @@ H5B2__internal_free(H5B2_internal_t *internal) /* * Check arguments. */ - HDassert(internal); + assert(internal); /* Release internal node's native key buffer */ if (internal->int_native) @@ -1362,10 +1332,10 @@ H5B2__internal_free(H5B2_internal_t *internal) /* Decrement ref. count on B-tree header */ if (H5B2__hdr_decr(internal->hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header"); /* Sanity check */ - HDassert(NULL == internal->top_proxy); + assert(NULL == internal->top_proxy); /* Free B-tree internal node info */ internal = H5FL_FREE(H5B2_internal_t, internal); @@ -1383,9 +1353,6 @@ H5B2__internal_free(H5B2_internal_t *internal) * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Feb 19 2005 - * *------------------------------------------------------------------------- */ H5_ATTR_PURE herr_t @@ -1396,22 +1363,22 @@ H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_U uint16_t u, v; /* Local index variables */ /* General sanity checking on node */ - HDassert(internal->nrec <= hdr->node_info->split_nrec); + assert(internal->nrec <= hdr->node_info->split_nrec); /* Sanity checking on node pointers */ tot_all_nrec = internal->nrec; for (u = 0; u < internal->nrec + 1; u++) { tot_all_nrec += internal->node_ptrs[u].all_nrec; - HDassert(H5F_addr_defined(internal->node_ptrs[u].addr)); - HDassert(internal->node_ptrs[u].addr > 0); + assert(H5_addr_defined(internal->node_ptrs[u].addr)); + assert(internal->node_ptrs[u].addr > 0); for (v = 0; v < u; v++) - HDassert(internal->node_ptrs[u].addr != internal->node_ptrs[v].addr); + assert(internal->node_ptrs[u].addr != internal->node_ptrs[v].addr); } /* end for */ /* Sanity check all_nrec total in parent */ if (parent_all_nrec > 0) - HDassert(tot_all_nrec == parent_all_nrec); + assert(tot_all_nrec == parent_all_nrec); return (0); } /* end H5B2__assert_internal() */ @@ -1423,9 +1390,6 @@ H5B2__assert_internal(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_U * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Feb 19 2005 - * *------------------------------------------------------------------------- */ H5_ATTR_PURE herr_t @@ -1436,24 +1400,24 @@ H5B2__assert_internal2(hsize_t parent_all_nrec, const H5B2_hdr_t H5_ATTR_NDEBUG_ uint16_t u, v; /* Local index variables */ /* General sanity checking on node */ - HDassert(internal->nrec <= hdr->node_info->split_nrec); + assert(internal->nrec <= hdr->node_info->split_nrec); /* Sanity checking on node pointers */ tot_all_nrec = internal->nrec; for (u = 0; u < internal->nrec + 1; u++) { tot_all_nrec += internal->node_ptrs[u].all_nrec; - HDassert(H5F_addr_defined(internal->node_ptrs[u].addr)); - HDassert(internal->node_ptrs[u].addr > 0); + assert(H5_addr_defined(internal->node_ptrs[u].addr)); + assert(internal->node_ptrs[u].addr > 0); for (v = 0; v < u; v++) - HDassert(internal->node_ptrs[u].addr != internal->node_ptrs[v].addr); + assert(internal->node_ptrs[u].addr != internal->node_ptrs[v].addr); for (v = 0; v < internal2->nrec + 1; v++) - HDassert(internal->node_ptrs[u].addr != internal2->node_ptrs[v].addr); + assert(internal->node_ptrs[u].addr != internal2->node_ptrs[v].addr); } /* end for */ /* Sanity check all_nrec total in parent */ if (parent_all_nrec > 0) - HDassert(tot_all_nrec == parent_all_nrec); + assert(tot_all_nrec == parent_all_nrec); return (0); } /* end H5B2__assert_internal2() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5B2leaf.c b/externals/coda-oss/modules/drivers/hdf5/source/H5B2leaf.c index cc8c0894c4..23a7c4d385 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5B2leaf.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5B2leaf.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5B2leaf.c - * Dec 01 2016 - * Quincey Koziol * * Purpose: Routines for managing v2 B-tree leaf nodes. * @@ -77,9 +74,6 @@ H5FL_DEFINE(H5B2_leaf_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 2 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -92,24 +86,24 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(node_ptr); + assert(hdr); + assert(node_ptr); /* Allocate memory for leaf information */ if (NULL == (leaf = H5FL_CALLOC(H5B2_leaf_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf info") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf info"); /* Increment ref. count on B-tree header */ if (H5B2__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header"); /* Share B-tree header information */ leaf->hdr = hdr; /* Allocate space for the native keys in memory */ if (NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys") - HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys"); + memset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); /* Set parent */ leaf->parent = parent; @@ -119,17 +113,17 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr) /* Allocate space on disk for the leaf */ if (HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node"); /* Cache the new B-tree node */ if (H5AC_insert_entry(hdr->f, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache"); inserted = TRUE; /* Add leaf node as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, leaf) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, FAIL, "unable to add v2 B-tree node as child of proxy") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, FAIL, "unable to add v2 B-tree node as child of proxy"); leaf->top_proxy = hdr->top_proxy; } /* end if */ @@ -140,17 +134,17 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr) if (inserted) if (H5AC_remove_entry(leaf) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTREMOVE, FAIL, - "unable to remove v2 B-tree leaf node from cache") + "unable to remove v2 B-tree leaf node from cache"); /* Release leaf node's disk space */ - if (H5F_addr_defined(node_ptr->addr) && + if (H5_addr_defined(node_ptr->addr) && H5MF_xfree(hdr->f, H5FD_MEM_BTREE, node_ptr->addr, (hsize_t)hdr->node_size) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, - "unable to release file space for v2 B-tree leaf node") + "unable to release file space for v2 B-tree leaf node"); /* Destroy leaf node */ if (H5B2__leaf_free(leaf) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree leaf node") + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree leaf node"); } /* end if */ } /* end if */ @@ -164,9 +158,6 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr) * * Return: Pointer to leaf node on success/NULL on failure * - * Programmer: Quincey Koziol - * May 5 2010 - * *------------------------------------------------------------------------- */ H5B2_leaf_t * @@ -179,12 +170,12 @@ H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, hbo FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(node_ptr); - HDassert(H5F_addr_defined(node_ptr->addr)); + assert(hdr); + assert(node_ptr); + assert(H5_addr_defined(node_ptr->addr)); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up user data for callback */ udata.f = hdr->f; @@ -194,20 +185,20 @@ H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, hbo /* Protect the leaf node */ if (NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(hdr->f, H5AC_BT2_LEAF, node_ptr->addr, &udata, flags))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, NULL, "unable to protect B-tree leaf node"); /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == leaf->top_proxy) { /* Add leaf node as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, leaf) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, "unable to add v2 B-tree leaf node as child of proxy") + HGOTO_ERROR(H5E_BTREE, H5E_CANTSET, NULL, "unable to add v2 B-tree leaf node as child of proxy"); leaf->top_proxy = hdr->top_proxy; } /* end if */ /* Shadow the node, if requested */ if (shadow) if (H5B2__shadow_leaf(leaf, node_ptr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, NULL, "unable to shadow leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, NULL, "unable to shadow leaf node"); /* Set return value */ ret_value = leaf; @@ -222,7 +213,7 @@ H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, hbo if (H5AC_proxy_entry_remove_child(leaf->top_proxy, leaf) < 0) HDONE_ERROR( H5E_BTREE, H5E_CANTUNDEPEND, NULL, - "unable to destroy flush dependency between leaf node and v2 B-tree 'top' proxy") + "unable to destroy flush dependency between leaf node and v2 B-tree 'top' proxy"); leaf->top_proxy = NULL; } /* end if */ @@ -230,7 +221,7 @@ H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, hbo if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, NULL, "unable to unprotect v2 B-tree leaf node, address = %llu", - (unsigned long long)node_ptr->addr) + (unsigned long long)node_ptr->addr); } /* end if */ } /* end if */ @@ -257,9 +248,6 @@ H5B2__protect_leaf(H5B2_hdr_t *hdr, void *parent, H5B2_node_ptr_t *node_ptr, hbo * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Mar 9 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -274,18 +262,18 @@ H5B2__neighbor_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, void *neigh FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); - HDassert(op); + assert(hdr); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); + assert(op); /* Lock current B-tree node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); /* Locate node pointer for child */ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp > 0) idx++; else if (cmp == 0 && comp == H5B2_COMPARE_GREATER) @@ -297,7 +285,7 @@ H5B2__neighbor_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, void *neigh neighbor_loc = H5B2_LEAF_NREC(leaf, hdr, idx - 1); } /* end if */ else { - HDassert(comp == H5B2_COMPARE_GREATER); + assert(comp == H5B2_COMPARE_GREATER); if (idx < leaf->nrec) neighbor_loc = H5B2_LEAF_NREC(leaf, hdr, idx); @@ -308,15 +296,15 @@ H5B2__neighbor_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, void *neigh /* Make callback for current record */ if ((op)(neighbor_loc, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, - "'found' callback failed for B-tree neighbor operation") + "'found' callback failed for B-tree neighbor operation"); } /* end if */ else - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree"); done: /* Release the B-tree leaf node */ if (leaf && H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree leaf node"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__neighbor_leaf() */ @@ -328,9 +316,6 @@ H5B2__neighbor_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, void *neigh * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 3 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -346,20 +331,20 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); + assert(hdr); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); /* Lock current B-tree node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); /* Must have a leaf node with enough space to insert a record now */ - HDassert(curr_node_ptr->node_nrec < hdr->node_info[0].max_nrec); + assert(curr_node_ptr->node_nrec < hdr->node_info[0].max_nrec); /* Sanity check number of records */ - HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec); - HDassert(leaf->nrec == curr_node_ptr->node_nrec); + assert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec); + assert(leaf->nrec == curr_node_ptr->node_nrec); /* Check for inserting into empty leaf */ if (leaf->nrec == 0) @@ -367,21 +352,21 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ else { /* Find correct location to insert this record */ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp == 0) - HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree"); if (cmp > 0) idx++; /* Make room for new record */ if (idx < leaf->nrec) - HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), - hdr->cls->nrec_size * (leaf->nrec - idx)); + memmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), + hdr->cls->nrec_size * (leaf->nrec - idx)); } /* end else */ /* Make callback to store record in native form */ if ((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node"); /* Mark the node as dirty */ leaf_flags |= H5AC__DIRTIED_FLAG; @@ -401,7 +386,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ if (hdr->min_native_rec == NULL) if (NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, - "memory allocation failed for v2 B-tree min record info") + "memory allocation failed for v2 B-tree min record info"); H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ @@ -410,7 +395,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ if (hdr->max_native_rec == NULL) if (NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, - "memory allocation failed for v2 B-tree max record info") + "memory allocation failed for v2 B-tree max record info"); H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ @@ -422,11 +407,11 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ /* Shadow the node if doing SWMR writes */ if (hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG)) if (H5B2__shadow_leaf(leaf, curr_node_ptr) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf B-tree node"); /* Unprotect leaf node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -442,9 +427,6 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Dec 23 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -460,17 +442,17 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); + assert(hdr); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); /* Lock current B-tree node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); /* Sanity check number of records */ - HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec); - HDassert(leaf->nrec == curr_node_ptr->node_nrec); + assert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec); + assert(leaf->nrec == curr_node_ptr->node_nrec); /* Check for inserting into empty leaf */ if (leaf->nrec == 0) @@ -478,7 +460,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s else { /* Find correct location to insert this record */ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); /* Check for inserting a record */ if (0 != cmp) { @@ -488,7 +470,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s *status = H5B2_UPDATE_INSERT_CHILD_FULL; /* Let calling routine handle insertion */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Adjust index to leave room for record to insert */ @@ -497,8 +479,8 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s /* Make room for new record */ if (idx < leaf->nrec) - HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), - hdr->cls->nrec_size * (leaf->nrec - idx)); + memmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), + hdr->cls->nrec_size * (leaf->nrec - idx)); } /* end if */ } /* end else */ @@ -509,10 +491,10 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s /* Make callback for current record */ if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) { /* Make certain that the callback didn't modify the value if it failed */ - HDassert(changed == FALSE); + assert(changed == FALSE); HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, - "'modify' callback failed for B-tree update operation") + "'modify' callback failed for B-tree update operation"); } /* end if */ /* Mark the node as dirty if it changed */ @@ -523,11 +505,11 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s } /* end if */ else { /* Must have a leaf node with enough space to insert a record now */ - HDassert(curr_node_ptr->node_nrec < hdr->node_info[0].max_nrec); + assert(curr_node_ptr->node_nrec < hdr->node_info[0].max_nrec); /* Make callback to store record in native form */ if ((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node"); /* Mark the node as dirty */ leaf_flags |= H5AC__DIRTIED_FLAG; @@ -551,7 +533,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s if (hdr->min_native_rec == NULL) if (NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, - "memory allocation failed for v2 B-tree min record info") + "memory allocation failed for v2 B-tree min record info"); H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ @@ -560,7 +542,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s if (hdr->max_native_rec == NULL) if (NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, - "memory allocation failed for v2 B-tree max record info") + "memory allocation failed for v2 B-tree max record info"); H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ @@ -573,7 +555,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s if (hdr->swmr_write && (leaf_flags & H5AC__DIRTIED_FLAG)) { /* Attempt to shadow the node if doing SWMR writes */ if (H5B2__shadow_leaf(leaf, curr_node_ptr) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf B-tree node"); /* Change the state to "shadowed" if only modified currently */ /* (Triggers parent to be marked dirty) */ @@ -583,7 +565,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s /* Unprotect leaf node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -598,9 +580,6 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_update_s * * Failure: Negative * - * Programmer: Quincey Koziol - * Mar 4 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -616,10 +595,10 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsi FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(internal); - HDassert(internal_flags_ptr); - HDassert(idx <= internal->nrec); + assert(hdr); + assert(internal); + assert(internal_flags_ptr); + assert(idx <= internal->nrec); /* Check for the kind of B-tree node to swap */ if (depth > 1) { @@ -632,7 +611,7 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsi if (NULL == (child_internal = H5B2__protect_internal(hdr, internal, &internal->node_ptrs[idx], (uint16_t)(depth - 1), FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node"); child_addr = internal->node_ptrs[idx].addr; /* More setup for accessing child node information */ @@ -648,7 +627,7 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsi /* Lock B-tree child node */ if (NULL == (child_leaf = H5B2__protect_leaf(hdr, internal, &internal->node_ptrs[idx], FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); child_addr = internal->node_ptrs[idx].addr; /* More setup for accessing child node information */ @@ -675,7 +654,7 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsi done: /* Unlock child node */ if (child && H5AC_unprotect(hdr->f, child_class, child_addr, child, H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree child node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__swap_leaf() */ @@ -691,9 +670,6 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsi * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Apr 27 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -707,12 +683,12 @@ H5B2__shadow_leaf(H5B2_leaf_t *leaf, H5B2_node_ptr_t *curr_node_ptr) /* * Check arguments. */ - HDassert(leaf); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); + assert(leaf); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); hdr = leaf->hdr; - HDassert(hdr); - HDassert(hdr->swmr_write); + assert(hdr); + assert(hdr->swmr_write); /* We only need to shadow the node if it has not been shadowed since the * last time the header was flushed, as otherwise it will be unreachable by @@ -729,11 +705,11 @@ H5B2__shadow_leaf(H5B2_leaf_t *leaf, H5B2_node_ptr_t *curr_node_ptr) */ /* Allocate space for the cloned node */ if (HADDR_UNDEF == (new_node_addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, (hsize_t)hdr->node_size))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "unable to allocate file space to move B-tree node"); /* Move the location of the old child on the disk */ if (H5AC_move_entry(hdr->f, H5AC_BT2_LEAF, curr_node_ptr->addr, new_node_addr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTMOVE, FAIL, "unable to move B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTMOVE, FAIL, "unable to move B-tree node"); curr_node_ptr->addr = new_node_addr; /* Should free the space in the file, but this is not supported by @@ -755,9 +731,6 @@ H5B2__shadow_leaf(H5B2_leaf_t *leaf, H5B2_node_ptr_t *curr_node_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 3 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -774,24 +747,24 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); + assert(hdr); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); /* Lock current B-tree node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); leaf_addr = curr_node_ptr->addr; /* Sanity check number of records */ - HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec); - HDassert(leaf->nrec == curr_node_ptr->node_nrec); + assert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec); + assert(leaf->nrec == curr_node_ptr->node_nrec); /* Find correct location to remove this record */ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp != 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree"); /* Check for invalidating the min/max record for the tree */ if (H5B2_POS_MIDDLE != curr_pos) { @@ -813,7 +786,7 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ /* Make 'remove' callback if there is one */ if (op) if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record into leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record into leaf node"); /* Update number of records in node */ leaf->nrec--; @@ -822,14 +795,14 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ /* Shadow the node if doing SWMR writes */ if (hdr->swmr_write) { if (H5B2__shadow_leaf(leaf, curr_node_ptr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node"); leaf_addr = curr_node_ptr->addr; } /* end if */ /* Pack record out of leaf */ if (idx < leaf->nrec) - HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), - hdr->cls->nrec_size * (leaf->nrec - idx)); + memmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), + hdr->cls->nrec_size * (leaf->nrec - idx)); /* Mark leaf node as dirty also */ leaf_flags |= H5AC__DIRTIED_FLAG; @@ -850,7 +823,7 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ done: /* Release the B-tree leaf node */ if (leaf && H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__remove_leaf() */ @@ -863,9 +836,6 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -880,19 +850,19 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_n FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(curr_node_ptr); - HDassert(H5F_addr_defined(curr_node_ptr->addr)); + assert(hdr); + assert(curr_node_ptr); + assert(H5_addr_defined(curr_node_ptr->addr)); /* Lock B-tree leaf node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, curr_node_ptr, FALSE, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); leaf_addr = curr_node_ptr->addr; /* Sanity check number of records */ - HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec); - HDassert(leaf->nrec == curr_node_ptr->node_nrec); - HDassert(idx < leaf->nrec); + assert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec); + assert(leaf->nrec == curr_node_ptr->node_nrec); + assert(idx < leaf->nrec); /* Check for invalidating the min/max record for the tree */ if (H5B2_POS_MIDDLE != curr_pos) { @@ -914,7 +884,7 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_n /* Make 'remove' callback if there is one */ if (op) if ((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record into leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record into leaf node"); /* Update number of records in node */ leaf->nrec--; @@ -923,14 +893,14 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_n /* Shadow the node if doing SWMR writes */ if (hdr->swmr_write) { if (H5B2__shadow_leaf(leaf, curr_node_ptr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOPY, FAIL, "unable to shadow leaf node"); leaf_addr = curr_node_ptr->addr; } /* end if */ /* Pack record out of leaf */ if (idx < leaf->nrec) - HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), - hdr->cls->nrec_size * (leaf->nrec - idx)); + memmove(H5B2_LEAF_NREC(leaf, hdr, idx), H5B2_LEAF_NREC(leaf, hdr, (idx + 1)), + hdr->cls->nrec_size * (leaf->nrec - idx)); /* Mark leaf node as dirty also */ leaf_flags |= H5AC__DIRTIED_FLAG; @@ -951,7 +921,7 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_n done: /* Release the B-tree leaf node */ if (leaf && H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, leaf_addr, leaf, leaf_flags) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* H5B2__remove_leaf_by_idx() */ @@ -963,9 +933,6 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, H5B2_n * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 2 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -978,7 +945,7 @@ H5B2__leaf_free(H5B2_leaf_t *leaf) /* * Check arguments. */ - HDassert(leaf); + assert(leaf); /* Release leaf's native key buffer */ if (leaf->leaf_native) @@ -986,10 +953,10 @@ H5B2__leaf_free(H5B2_leaf_t *leaf) /* Decrement ref. count on B-tree header */ if (H5B2__hdr_decr(leaf->hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDEC, FAIL, "can't decrement ref. count on B-tree header"); /* Sanity check */ - HDassert(NULL == leaf->top_proxy); + assert(NULL == leaf->top_proxy); /* Free B-tree leaf node info */ leaf = H5FL_FREE(H5B2_leaf_t, leaf); @@ -1007,16 +974,13 @@ H5B2__leaf_free(H5B2_leaf_t *leaf) * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Feb 19 2005 - * *------------------------------------------------------------------------- */ H5_ATTR_PURE herr_t H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_leaf_t H5_ATTR_NDEBUG_UNUSED *leaf) { /* General sanity checking on node */ - HDassert(leaf->nrec <= hdr->node_info->split_nrec); + assert(leaf->nrec <= hdr->node_info->split_nrec); return (0); } /* end H5B2__assert_leaf() */ @@ -1028,9 +992,6 @@ H5B2__assert_leaf(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_leaf_t * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Feb 19 2005 - * *------------------------------------------------------------------------- */ H5_ATTR_PURE herr_t @@ -1038,7 +999,7 @@ H5B2__assert_leaf2(const H5B2_hdr_t H5_ATTR_NDEBUG_UNUSED *hdr, const H5B2_leaf_ const H5B2_leaf_t H5_ATTR_UNUSED *leaf2) { /* General sanity checking on node */ - HDassert(leaf->nrec <= hdr->node_info->split_nrec); + assert(leaf->nrec <= hdr->node_info->split_nrec); return (0); } /* end H5B2__assert_leaf2() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5B2stat.c b/externals/coda-oss/modules/drivers/hdf5/source/H5B2stat.c index 1a727a89d3..52af55417b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5B2stat.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5B2stat.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Monday, March 6, 2006 - * +/* * Purpose: v2 B-tree metadata statistics functions. * */ @@ -66,9 +63,6 @@ * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Monday, March 6, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -77,7 +71,7 @@ H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(info); + assert(info); /* Get information about the B-tree */ info->depth = bt2->hdr->depth; @@ -94,9 +88,6 @@ H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * June 19 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -108,8 +99,8 @@ H5B2_size(H5B2_t *bt2, hsize_t *btree_size) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(bt2); - HDassert(btree_size); + assert(bt2); + assert(btree_size); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -128,7 +119,7 @@ H5B2_size(H5B2_t *bt2, hsize_t *btree_size) else /* Iterate through nodes */ if (H5B2__node_size(hdr, hdr->depth, &hdr->root, hdr, btree_size) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed"); } /* end if */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5B2test.c b/externals/coda-oss/modules/drivers/hdf5/source/H5B2test.c index b8fb130015..3285d306c8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5B2test.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5B2test.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,10 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Thursday, February 3, 2005 - * - * Purpose: v2 B-tree testing functions. +/* + * Purpose: v2 B-tree testing functions * */ @@ -28,9 +25,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5B2pkg.h" /* v2 B-trees */ -#include "H5Eprivate.h" /* Error handling */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata Cache */ +#include "H5B2pkg.h" /* B-Trees (Version 2) */ +#include "H5Eprivate.h" /* Error Handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ /****************/ /* Local Macros */ @@ -122,9 +122,6 @@ H5FL_DEFINE_STATIC(H5B2_test_ctx_t); * Return: Success: non-NULL * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, November 26, 2009 - * *------------------------------------------------------------------------- */ static void * @@ -137,11 +134,11 @@ H5B2__test_crt_context(void *_f) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); + assert(f); /* Allocate callback context */ if (NULL == (ctx = H5FL_MALLOC(H5B2_test_ctx_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate callback context") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate callback context"); /* Determine the size of lengths in the file */ ctx->sizeof_size = H5F_SIZEOF_SIZE(f); @@ -161,9 +158,6 @@ H5B2__test_crt_context(void *_f) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, November 26, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -174,7 +168,7 @@ H5B2__test_dst_context(void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Release callback context */ ctx = H5FL_FREE(H5B2_test_ctx_t, ctx); @@ -190,9 +184,6 @@ H5B2__test_dst_context(void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, February 3, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -214,9 +205,6 @@ H5B2__test_store(void *nrecord, const void *udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Quincey Koziol - * Thursday, February 3, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -237,9 +225,6 @@ H5B2__test_compare(const void *rec1, const void *rec2, int *result) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, February 3, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -250,9 +235,9 @@ H5B2__test_encode(uint8_t *raw, const void *nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); - H5F_ENCODE_LENGTH_LEN(raw, *(const hsize_t *)nrecord, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, *(const hsize_t *)nrecord, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2__test_encode() */ @@ -265,9 +250,6 @@ H5B2__test_encode(uint8_t *raw, const void *nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, February 4, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -278,9 +260,9 @@ H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); - H5F_DECODE_LENGTH_LEN(raw, *(hsize_t *)nrecord, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, *(hsize_t *)nrecord, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2__test_decode() */ @@ -293,9 +275,6 @@ H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, February 4, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -303,9 +282,9 @@ H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, const { FUNC_ENTER_PACKAGE_NOERR - HDassert(record); + assert(record); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Record:", *(const hsize_t *)record); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Record:", *(const hsize_t *)record); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2__test_debug() */ @@ -318,9 +297,6 @@ H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, const * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, December 25, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -342,9 +318,6 @@ H5B2__test2_store(void *nrecord, const void *udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Quincey Koziol - * Friday, December 25, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -365,9 +338,6 @@ H5B2__test2_compare(const void *rec1, const void *rec2, int *result) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, December 25, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -378,10 +348,10 @@ H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); - H5F_ENCODE_LENGTH_LEN(raw, ((const H5B2_test_rec_t *)nrecord)->key, ctx->sizeof_size); - H5F_ENCODE_LENGTH_LEN(raw, ((const H5B2_test_rec_t *)nrecord)->val, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, ((const H5B2_test_rec_t *)nrecord)->key, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, ((const H5B2_test_rec_t *)nrecord)->val, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2__test2_encode() */ @@ -394,9 +364,6 @@ H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, December 25, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -407,10 +374,10 @@ H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); - H5F_DECODE_LENGTH_LEN(raw, ((H5B2_test_rec_t *)nrecord)->key, ctx->sizeof_size); - H5F_DECODE_LENGTH_LEN(raw, ((H5B2_test_rec_t *)nrecord)->val, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, ((H5B2_test_rec_t *)nrecord)->key, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, ((H5B2_test_rec_t *)nrecord)->val, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2__test2_decode() */ @@ -423,9 +390,6 @@ H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, December 25, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -433,10 +397,10 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, cons { FUNC_ENTER_PACKAGE_NOERR - HDassert(record); + assert(record); - HDfprintf(stream, "%*s%-*s (%" PRIuHSIZE ", %" PRIuHSIZE ")\n", indent, "", fwidth, - "Record:", ((const H5B2_test_rec_t *)record)->key, ((const H5B2_test_rec_t *)record)->val); + fprintf(stream, "%*s%-*s (%" PRIuHSIZE ", %" PRIuHSIZE ")\n", indent, "", fwidth, + "Record:", ((const H5B2_test_rec_t *)record)->key, ((const H5B2_test_rec_t *)record)->val); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2__test2_debug() */ @@ -448,9 +412,6 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, cons * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Saturday, February 26, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -459,8 +420,8 @@ H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(bt2); - HDassert(root_addr); + assert(bt2); + assert(root_addr); /* Get B-tree root addr */ *root_addr = bt2->hdr->root.addr; @@ -475,9 +436,6 @@ H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Thursday, August 31, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -494,7 +452,7 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(bt2); + assert(bt2); /* Set the shared v2 B-tree header's file context for this operation */ bt2->hdr->f = bt2->f; @@ -514,7 +472,7 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo) /* Check for empty tree */ if (0 == curr_node_ptr.node_nrec) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records"); /* Walk down B-tree to find record or leaf node where record is located */ cmp = -1; @@ -525,19 +483,19 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo) /* Lock B-tree current node */ if (NULL == (internal = H5B2__protect_internal(hdr, parent, &curr_node_ptr, depth, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node"); /* Unpin parent if necessary */ if (parent) { if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); parent = NULL; } /* end if */ /* Locate node pointer for child */ if (H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); if (cmp > 0) idx++; @@ -549,7 +507,7 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo) /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); /* Keep track of parent if necessary */ if (hdr->swmr_write) @@ -561,14 +519,14 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo) else { /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); /* Fill in information about the node */ ninfo->depth = depth; ninfo->nrec = curr_node_ptr.node_nrec; /* Indicate success */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end else */ /* Decrement depth we're at in B-tree */ @@ -580,26 +538,26 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo) /* Lock B-tree leaf node */ if (NULL == (leaf = H5B2__protect_leaf(hdr, parent, &curr_node_ptr, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node"); /* Unpin parent if necessary */ if (parent) { if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); parent = NULL; } /* end if */ /* Locate record */ if (H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); /* Unlock current node */ if (H5AC_unprotect(hdr->f, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); /* Indicate the depth that the record was found */ if (cmp != 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record not in B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record not in B-tree"); } /* end block */ /* Fill in information about the leaf node */ @@ -608,9 +566,9 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo) done: if (parent) { - HDassert(ret_value < 0); + assert(ret_value < 0); if (parent != hdr && H5AC_unpin_entry(parent) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPIN, FAIL, "unable to unpin parent entry"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -628,9 +586,6 @@ H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo) * * Failure: -1 * - * Programmer: Quincey Koziol - * Saturday, August 26, 2006 - * *------------------------------------------------------------------------- */ int @@ -642,11 +597,11 @@ H5B2__get_node_depth_test(H5B2_t *bt2, void *udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(bt2); + assert(bt2); /* Get information abou the node */ if (H5B2__get_node_info_test(bt2, udata, &ninfo) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, (-1), "error looking up node info") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, (-1), "error looking up node info"); /* Set return value */ ret_value = (int)ninfo.depth; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Bcache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Bcache.c index fd992c22ad..3426426ad5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Bcache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Bcache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5Bcache.c - * Oct 31 2005 - * Quincey Koziol * - * Purpose: Implement B-tree metadata cache methods. + * Purpose: Implement B-tree metadata cache methods * *------------------------------------------------------------------------- */ @@ -84,13 +81,9 @@ const H5AC_class_t H5AC_BT[1] = {{ /*------------------------------------------------------------------------- * Function: H5B__cache_get_initial_load_size * - * Purpose: Compute the size of the data structure on disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * May 18, 2010 + * Purpose: Compute the size of the data structure on disk * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -102,12 +95,12 @@ H5B__cache_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(image_len); + assert(udata); + assert(image_len); /* Get shared info for B-tree */ shared = (H5B_shared_t *)H5UC_GET_OBJ(udata->rc_shared); - HDassert(shared); + assert(shared); /* Set the image length size */ *image_len = shared->sizeof_rnode; @@ -118,24 +111,20 @@ H5B__cache_get_initial_load_size(void *_udata, size_t *image_len) /*------------------------------------------------------------------------- * Function: H5B__cache_deserialize * - * Purpose: Deserialize the data structure from disk. - * - * Return: Success: Pointer to a new B-tree node. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Mar 24, 2008 + * Purpose: Deserialize the data structure from disk * + * Return: Success: Pointer to a new B-tree node + * Failure: NULL *------------------------------------------------------------------------- */ static void * -H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5B__cache_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5B_t *bt = NULL; /* Pointer to the deserialized B-tree node */ H5B_cache_ud_t *udata = (H5B_cache_ud_t *)_udata; /* User data for callback */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into image buffer */ + const uint8_t *p_end = image + len - 1; /* End of image buffer */ uint8_t *native; /* Pointer to native keys */ unsigned u; /* Local index variable */ H5B_t *ret_value = NULL; /* Return value */ @@ -143,13 +132,13 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); /* Allocate the B-tree node in memory */ if (NULL == (bt = H5FL_MALLOC(H5B_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate B-tree struct") - HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t)); + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate B-tree struct"); + memset(&bt->cache_info, 0, sizeof(H5AC_info_t)); /* Set & increment the ref-counted "shared" B-tree information for the node */ bt->rc_shared = udata->rc_shared; @@ -157,57 +146,70 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda /* Get a pointer to the shared info, for convenience */ shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared); - HDassert(shared); + if (NULL == shared) + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, NULL, "can't get a pointer to shared data"); /* Allocate space for the native keys and child addresses */ if (NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for native keys") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for native keys"); if (NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for child addresses") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for child addresses"); - /* magic number */ - if (HDmemcmp(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree signature") + /* Magic number */ + if (H5_IS_BUFFER_OVERFLOW(image, H5_SIZEOF_MAGIC, p_end)) + HGOTO_ERROR(H5E_BTREE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + if (memcmp(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "wrong B-tree signature"); image += H5_SIZEOF_MAGIC; - /* node type and level */ + /* Node type and level */ + if (H5_IS_BUFFER_OVERFLOW(image, 2, p_end)) + HGOTO_ERROR(H5E_BTREE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (*image++ != (uint8_t)udata->type->id) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "incorrect B-tree node type"); bt->level = *image++; - /* entries used */ + /* Entries used */ + if (H5_IS_BUFFER_OVERFLOW(image, 2, p_end)) + HGOTO_ERROR(H5E_BTREE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(image, bt->nchildren); /* Check if bt->nchildren is greater than two_k */ if (bt->nchildren > shared->two_k) - HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "number of children is greater than maximum") + HGOTO_ERROR(H5E_BTREE, H5E_BADVALUE, NULL, "number of children is greater than maximum"); - /* sibling pointers */ + /* Sibling pointers */ + if (H5_IS_BUFFER_OVERFLOW(image, H5F_sizeof_addr(udata->f), p_end)) + HGOTO_ERROR(H5E_BTREE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(udata->f, (const uint8_t **)&image, &(bt->left)); + + if (H5_IS_BUFFER_OVERFLOW(image, H5F_sizeof_addr(udata->f), p_end)) + HGOTO_ERROR(H5E_BTREE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(udata->f, (const uint8_t **)&image, &(bt->right)); - /* the child/key pairs */ + /* Child/key pairs */ native = bt->native; for (u = 0; u < bt->nchildren; u++) { /* Decode native key value */ + if (H5_IS_BUFFER_OVERFLOW(image, shared->sizeof_rkey, p_end)) + HGOTO_ERROR(H5E_BTREE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if ((udata->type->decode)(shared, image, native) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key") + HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key"); image += shared->sizeof_rkey; native += udata->type->sizeof_nkey; /* Decode address value */ + if (H5_IS_BUFFER_OVERFLOW(image, H5F_sizeof_addr(udata->f), p_end)) + HGOTO_ERROR(H5E_BTREE, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(udata->f, (const uint8_t **)&image, bt->child + u); - } /* end for */ + } - /* Decode final key */ + /* Final key */ if (bt->nchildren > 0) { /* Decode native key value */ if ((udata->type->decode)(shared, image, native) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key") - } /* end if */ - - /* Sanity check */ - HDassert((size_t)((const uint8_t *)image - (const uint8_t *)_image) <= len); + HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, NULL, "unable to decode key"); + } /* Set return value */ ret_value = bt; @@ -215,7 +217,7 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda done: if (!ret_value && bt) if (H5B__node_dest(bt) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, NULL, "unable to destroy B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B__cache_deserialize() */ @@ -225,11 +227,7 @@ H5B__cache_deserialize(const void *_image, size_t H5_ATTR_UNUSED len, void *_uda * * Purpose: Compute the size of the data structure on disk. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * May 20, 2010 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -241,12 +239,12 @@ H5B__cache_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(bt); - HDassert(image_len); + assert(bt); + assert(image_len); /* Get shared info for B-tree */ shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared); - HDassert(shared); + assert(shared); /* Set the image length size */ *image_len = shared->sizeof_rnode; @@ -257,13 +255,9 @@ H5B__cache_image_len(const void *_thing, size_t *image_len) /*------------------------------------------------------------------------- * Function: H5B__cache_serialize * - * Purpose: Serialize the data structure for writing to disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Mar 24, 2008 + * Purpose: Serialize the data structure for writing to disk * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -279,13 +273,13 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, vo FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(image); - HDassert(bt); - HDassert(bt->rc_shared); + assert(image); + assert(bt); + assert(bt->rc_shared); shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared); - HDassert(shared); - HDassert(shared->type); - HDassert(shared->type->encode); + assert(shared); + assert(shared->type); + assert(shared->type->encode); /* magic number */ H5MM_memcpy(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -296,7 +290,7 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, vo /* 2^8 limit: only 1 byte is used to store node level */ if (bt->level >= HDpow(2, LEVEL_BITS)) - HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode node level") + HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode node level"); H5_CHECK_OVERFLOW(bt->level, unsigned, uint8_t); *image++ = (uint8_t)bt->level; @@ -313,7 +307,7 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, vo for (u = 0; u < bt->nchildren; ++u) { /* encode the key */ if (shared->type->encode(shared, image, native) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key") + HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key"); image += shared->sizeof_rkey; native += shared->type->sizeof_nkey; @@ -323,15 +317,15 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, vo if (bt->nchildren > 0) { /* Encode the final key */ if (shared->type->encode(shared, image, native) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key") + HGOTO_ERROR(H5E_BTREE, H5E_CANTENCODE, FAIL, "unable to encode B-tree key"); image += shared->sizeof_rkey; } /* end if */ /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) <= len); + assert((size_t)(image - (uint8_t *)_image) <= len); /* Clear rest of node */ - HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); + memset(image, 0, len - (size_t)(image - (uint8_t *)_image)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -342,11 +336,7 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, vo * * Purpose: Destroy/release an "in core representation" of a data structure * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Mar 26, 2008 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -357,11 +347,11 @@ H5B__cache_free_icr(void *thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(thing); + assert(thing); /* Destroy B-tree node */ if (H5B__node_dest((H5B_t *)thing) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Bdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Bdbg.c index 3b53317f7d..73eccecd0a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Bdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Bdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Bdbg.c - * Dec 11 2008 - * Quincey Koziol * * Purpose: Debugging routines for B-link tree package. * @@ -43,9 +40,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 4 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -63,21 +57,21 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5 /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(type); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(type); /* Currently does not support SWMR access */ - HDassert(!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)); + assert(!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)); /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object"); shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* * Load the tree node. @@ -86,43 +80,43 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5 cache_udata.type = type; cache_udata.rc_shared = rc_shared; if (NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node"); /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Tree type ID:", - ((shared->type->id) == H5B_SNODE_ID - ? "H5B_SNODE_ID" - : ((shared->type->id) == H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!"))); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of node:", shared->sizeof_rnode); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of raw (disk) key:", shared->sizeof_rkey); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Dirty flag:", bt->cache_info.is_dirty ? "True" : "False"); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Level:", bt->level); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of left sibling:", bt->left); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of right sibling:", bt->right); - HDfprintf(stream, "%*s%-*s %u (%u)\n", indent, "", fwidth, "Number of children (max):", bt->nchildren, - shared->two_k); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Tree type ID:", + ((shared->type->id) == H5B_SNODE_ID + ? "H5B_SNODE_ID" + : ((shared->type->id) == H5B_CHUNK_ID ? "H5B_CHUNK_ID" : "Unknown!"))); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of node:", shared->sizeof_rnode); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of raw (disk) key:", shared->sizeof_rkey); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Dirty flag:", bt->cache_info.is_dirty ? "True" : "False"); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Level:", bt->level); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of left sibling:", bt->left); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of right sibling:", bt->right); + fprintf(stream, "%*s%-*s %u (%u)\n", indent, "", fwidth, "Number of children (max):", bt->nchildren, + shared->two_k); /* * Print the child addresses */ for (u = 0; u < bt->nchildren; u++) { - HDfprintf(stream, "%*sChild %d...\n", indent, "", u); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(3, fwidth) - 3, - "Address:", bt->child[u]); + fprintf(stream, "%*sChild %d...\n", indent, "", u); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(3, fwidth) - 3, + "Address:", bt->child[u]); /* If there is a key debugging routine, use it to display the left & right keys */ if (type->debug_key) { /* Decode the 'left' key & print it */ - HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(3, fwidth) - 3, "Left Key:"); - HDassert(H5B_NKEY(bt, shared, u)); + fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(3, fwidth) - 3, "Left Key:"); + assert(H5B_NKEY(bt, shared, u)); (void)(type->debug_key)(stream, indent + 6, MAX(6, fwidth) - 6, H5B_NKEY(bt, shared, u), udata); /* Decode the 'right' key & print it */ - HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(3, fwidth) - 3, "Right Key:"); - HDassert(H5B_NKEY(bt, shared, u + 1)); + fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(3, fwidth) - 3, "Right Key:"); + assert(H5B_NKEY(bt, shared, u + 1)); (void)(type->debug_key)(stream, indent + 6, MAX(6, fwidth) - 6, H5B_NKEY(bt, shared, u + 1), udata); } /* end if */ @@ -130,7 +124,7 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5 done: if (bt && H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_debug() */ @@ -144,9 +138,6 @@ H5B_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, const H5 * * Failure: aborts if something is wrong. * - * Programmer: Robb Matzke - * Tuesday, November 4, 1997 - * *------------------------------------------------------------------------- */ #ifdef H5B_DEBUG @@ -173,31 +164,31 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata) if (0 == ncalls++) { if (H5DEBUG(B)) - HDfprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n"); + fprintf(H5DEBUG(B), "H5B: debugging B-trees (expensive)\n"); } /* end if */ /* Get shared info for B-tree */ if (NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object"); shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); - HDassert(shared); + assert(shared); /* Initialize the queue */ cache_udata.f = f; cache_udata.type = type; cache_udata.rc_shared = rc_shared; bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG); - HDassert(bt); + assert(bt); shared = (H5B_shared_t *)H5UC_GET_OBJ(bt->rc_shared); - HDassert(shared); + assert(shared); cur = (struct child_t *)H5MM_calloc(sizeof(struct child_t)); - HDassert(cur); + assert(cur); cur->addr = addr; cur->level = bt->level; head = tail = cur; status = H5AC_unprotect(f, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET); - HDassert(status >= 0); + assert(status >= 0); bt = NULL; /* Make certain future references will be caught */ /* @@ -208,18 +199,18 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata) */ for (ncell = 0; cur; ncell++) { bt = (H5B_t *)H5AC_protect(f, H5AC_BT, cur->addr, &cache_udata, H5AC__READ_ONLY_FLAG); - HDassert(bt); + assert(bt); /* Check node header */ - HDassert(bt->level == cur->level); + assert(bt->level == cur->level); if (cur->next && cur->next->level == bt->level) - HDassert(H5F_addr_eq(bt->right, cur->next->addr)); + assert(H5_addr_eq(bt->right, cur->next->addr)); else - HDassert(!H5F_addr_defined(bt->right)); + assert(!H5_addr_defined(bt->right)); if (prev && prev->level == bt->level) - HDassert(H5F_addr_eq(bt->left, prev->addr)); + assert(H5_addr_eq(bt->left, prev->addr)); else - HDassert(!H5F_addr_defined(bt->left)); + assert(!H5_addr_defined(bt->left)); if (cur->level > 0) { unsigned u; @@ -230,11 +221,11 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata) * have then the tree has a cycle. */ for (tmp = head; tmp; tmp = tmp->next) - HDassert(H5F_addr_ne(tmp->addr, bt->child[u])); + assert(H5_addr_ne(tmp->addr, bt->child[u])); /* Add the child node to the end of the queue */ tmp = (struct child_t *)H5MM_calloc(sizeof(struct child_t)); - HDassert(tmp); + assert(tmp); tmp->addr = bt->child[u]; tmp->level = bt->level - 1; tail->next = tmp; @@ -242,13 +233,13 @@ H5B__assert(H5F_t *f, haddr_t addr, const H5B_class_t *type, void *udata) /* Check that the keys are monotonically increasing */ cmp = (type->cmp2)(H5B_NKEY(bt, shared, u), udata, H5B_NKEY(bt, shared, u + 1)); - HDassert(cmp < 0); + assert(cmp < 0); } /* end for */ } /* end if */ /* Release node */ status = H5AC_unprotect(f, H5AC_BT, cur->addr, bt, H5AC__NO_FLAGS_SET); - HDassert(status >= 0); + assert(status >= 0); bt = NULL; /* Make certain future references will be caught */ /* Advance current location in queue */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5C.c b/externals/coda-oss/modules/drivers/hdf5/source/H5C.c index 907b0765f0..545154c853 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5C.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5C.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5C.c - * June 1 2004 - * John Mainzer * * Purpose: Functions in this file implement a generic cache for * things which exist on disk, and which may be @@ -62,87 +59,26 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5Cpkg.h" /* Cache */ -#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ #include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Pprivate.h" /* Property lists */ /****************/ /* Local Macros */ /****************/ -#if H5C_DO_MEMORY_SANITY_CHECKS -#define H5C_IMAGE_EXTRA_SPACE 8 -#define H5C_IMAGE_SANITY_VALUE "DeadBeef" -#else /* H5C_DO_MEMORY_SANITY_CHECKS */ -#define H5C_IMAGE_EXTRA_SPACE 0 -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ /******************/ /* Local Typedefs */ /******************/ -/* Alias for pointer to cache entry, for use when allocating sequences of them */ -typedef H5C_cache_entry_t *H5C_cache_entry_ptr_t; - /********************/ /* Local Prototypes */ /********************/ -static herr_t H5C__pin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr); - -static herr_t H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp); - -static herr_t H5C__unpin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp); - -static herr_t H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted); - -static herr_t H5C__autoadjust__ageout(H5F_t *f, double hit_rate, enum H5C_resize_status *status_ptr, - size_t *new_max_cache_size_ptr, hbool_t write_permitted); - -static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t *cache_ptr); - -static herr_t H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *f, hbool_t write_permitted); - -static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t *cache_ptr); - -static herr_t H5C__autoadjust__ageout__remove_all_markers(H5C_t *cache_ptr); - -static herr_t H5C__autoadjust__ageout__remove_excess_markers(H5C_t *cache_ptr); - -static herr_t H5C__flash_increase_cache_size(H5C_t *cache_ptr, size_t old_entry_size, size_t new_entry_size); - -static herr_t H5C__flush_invalidate_cache(H5F_t *f, unsigned flags); - -static herr_t H5C__flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags); - -static herr_t H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags); - -static void *H5C__load_entry(H5F_t *f, -#ifdef H5_HAVE_PARALLEL - hbool_t coll_access, -#endif /* H5_HAVE_PARALLEL */ - const H5C_class_t *type, haddr_t addr, void *udata); - -static herr_t H5C__mark_flush_dep_dirty(H5C_cache_entry_t *entry); - -static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t *entry); - -static herr_t H5C__serialize_ring(H5F_t *f, H5C_ring_t ring); -static herr_t H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr); -static herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr); -static herr_t H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr, size_t *len, - hbool_t actual); - -#ifndef NDEBUG -static void H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry, - const H5C_cache_entry_t *base_entry); -#endif /* NDEBUG */ - /*********************/ /* Package Variables */ /*********************/ @@ -161,9 +97,6 @@ H5FL_DEFINE(H5C_tag_info_t); /* Declare a free list to manage the H5C_t struct */ H5FL_DEFINE_STATIC(H5C_t); -/* Declare a free list to manage arrays of cache entries */ -H5FL_SEQ_DEFINE_STATIC(H5C_cache_entry_ptr_t); - /*------------------------------------------------------------------------- * Function: H5C_create * @@ -180,88 +113,8 @@ H5FL_SEQ_DEFINE_STATIC(H5C_cache_entry_ptr_t); * flag to determine whether writes are permitted. * * Return: Success: Pointer to the new instance. - * * Failure: NULL * - * Programmer: John Mainzer - * 6/2/04 - * - * Modifications: - * - * JRM -- 7/20/04 - * Updated for the addition of the hash table. - * - * JRM -- 10/5/04 - * Added call to H5C_reset_cache_hit_rate_stats(). Also - * added initialization for cache_is_full flag and for - * resize_ctl. - * - * JRM -- 11/12/04 - * Added initialization for the new size_decreased field. - * - * JRM -- 11/17/04 - * Added/updated initialization for the automatic cache - * size control data structures. - * - * JRM -- 6/24/05 - * Added support for the new write_permitted field of - * the H5C_t structure. - * - * JRM -- 7/5/05 - * Added the new log_flush parameter and supporting code. - * - * JRM -- 9/21/05 - * Added the new aux_ptr parameter and supporting code. - * - * JRM -- 1/20/06 - * Added initialization of the new prefix field in H5C_t. - * - * JRM -- 3/16/06 - * Added initialization for the pinned entry related fields. - * - * JRM -- 5/31/06 - * Added initialization for the trace_file_ptr field. - * - * JRM -- 8/19/06 - * Added initialization for the flush_in_progress field. - * - * JRM -- 8/25/06 - * Added initialization for the slist_len_increase and - * slist_size_increase fields. These fields are used - * for sanity checking in the flush process, and are not - * compiled in unless H5C_DO_SANITY_CHECKS is TRUE. - * - * JRM -- 3/28/07 - * Added initialization for the new is_read_only and - * ro_ref_count fields. - * - * JRM -- 7/27/07 - * Added initialization for the new evictions_enabled - * field of H5C_t. - * - * JRM -- 12/31/07 - * Added initialization for the new flash cache size increase - * related fields of H5C_t. - * - * JRM -- 11/5/08 - * Added initialization for the new clean_index_size and - * dirty_index_size fields of H5C_t. - * - * - * Missing entries? - * - * - * JRM -- 4/20/20 - * Added initialization for the slist_enabled field. Recall - * that the slist is used to flush metadata cache entries - * in (roughly) increasing address order. While this is - * needed at flush and close, it is not used elsewhere. - * The slist_enabled field exists to allow us to construct - * the slist when needed, and leave it empty otherwise -- thus - * avoiding the overhead of maintaining it. - * - * JRM -- 4/29/20 - * *------------------------------------------------------------------------- */ H5C_t * @@ -275,24 +128,24 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, FUNC_ENTER_NOAPI(NULL) - HDassert(max_cache_size >= H5C__MIN_MAX_CACHE_SIZE); - HDassert(max_cache_size <= H5C__MAX_MAX_CACHE_SIZE); - HDassert(min_clean_size <= max_cache_size); + assert(max_cache_size >= H5C__MIN_MAX_CACHE_SIZE); + assert(max_cache_size <= H5C__MAX_MAX_CACHE_SIZE); + assert(min_clean_size <= max_cache_size); - HDassert(max_type_id >= 0); - HDassert(max_type_id < H5C__MAX_NUM_TYPE_IDS); - HDassert(class_table_ptr); + assert(max_type_id >= 0); + assert(max_type_id < H5C__MAX_NUM_TYPE_IDS); + assert(class_table_ptr); for (i = 0; i <= max_type_id; i++) { - HDassert((class_table_ptr)[i]); - HDassert(HDstrlen((class_table_ptr)[i]->name) > 0); + assert((class_table_ptr)[i]); + assert(HDstrlen((class_table_ptr)[i]->name) > 0); } /* end for */ if (NULL == (cache_ptr = H5FL_CALLOC(H5C_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); if (NULL == (cache_ptr->slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, NULL, "can't create skip list"); cache_ptr->tag_list = NULL; @@ -300,12 +153,10 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, * the fields. */ - cache_ptr->magic = H5C__H5C_T_MAGIC; - cache_ptr->flush_in_progress = FALSE; if (NULL == (cache_ptr->log_info = (H5C_log_info_t *)H5MM_calloc(sizeof(H5C_log_info_t)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed"); cache_ptr->aux_ptr = aux_ptr; @@ -352,7 +203,7 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, cache_ptr->num_objs_corked = 0; /* slist field initializations */ - cache_ptr->slist_enabled = !H5C__SLIST_OPT_ENABLED; + cache_ptr->slist_enabled = FALSE; cache_ptr->slist_changed = FALSE; cache_ptr->slist_len = 0; cache_ptr->slist_size = (size_t)0; @@ -361,7 +212,7 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, * slist_ptr initialized above. */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS cache_ptr->slist_len_increase = 0; cache_ptr->slist_size_increase = 0; #endif /* H5C_DO_SANITY_CHECKS */ @@ -415,33 +266,33 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, cache_ptr->resize_in_progress = FALSE; cache_ptr->msic_in_progress = FALSE; - (cache_ptr->resize_ctl).version = H5C__CURR_AUTO_SIZE_CTL_VER; - (cache_ptr->resize_ctl).rpt_fcn = NULL; - (cache_ptr->resize_ctl).set_initial_size = FALSE; - (cache_ptr->resize_ctl).initial_size = H5C__DEF_AR_INIT_SIZE; - (cache_ptr->resize_ctl).min_clean_fraction = H5C__DEF_AR_MIN_CLEAN_FRAC; - (cache_ptr->resize_ctl).max_size = H5C__DEF_AR_MAX_SIZE; - (cache_ptr->resize_ctl).min_size = H5C__DEF_AR_MIN_SIZE; - (cache_ptr->resize_ctl).epoch_length = H5C__DEF_AR_EPOCH_LENGTH; - - (cache_ptr->resize_ctl).incr_mode = H5C_incr__off; - (cache_ptr->resize_ctl).lower_hr_threshold = H5C__DEF_AR_LOWER_THRESHHOLD; - (cache_ptr->resize_ctl).increment = H5C__DEF_AR_INCREMENT; - (cache_ptr->resize_ctl).apply_max_increment = TRUE; - (cache_ptr->resize_ctl).max_increment = H5C__DEF_AR_MAX_INCREMENT; - - (cache_ptr->resize_ctl).flash_incr_mode = H5C_flash_incr__off; - (cache_ptr->resize_ctl).flash_multiple = 1.0; - (cache_ptr->resize_ctl).flash_threshold = 0.25; - - (cache_ptr->resize_ctl).decr_mode = H5C_decr__off; - (cache_ptr->resize_ctl).upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD; - (cache_ptr->resize_ctl).decrement = H5C__DEF_AR_DECREMENT; - (cache_ptr->resize_ctl).apply_max_decrement = TRUE; - (cache_ptr->resize_ctl).max_decrement = H5C__DEF_AR_MAX_DECREMENT; - (cache_ptr->resize_ctl).epochs_before_eviction = H5C__DEF_AR_EPCHS_B4_EVICT; - (cache_ptr->resize_ctl).apply_empty_reserve = TRUE; - (cache_ptr->resize_ctl).empty_reserve = H5C__DEF_AR_EMPTY_RESERVE; + cache_ptr->resize_ctl.version = H5C__CURR_AUTO_SIZE_CTL_VER; + cache_ptr->resize_ctl.rpt_fcn = NULL; + cache_ptr->resize_ctl.set_initial_size = FALSE; + cache_ptr->resize_ctl.initial_size = H5C__DEF_AR_INIT_SIZE; + cache_ptr->resize_ctl.min_clean_fraction = H5C__DEF_AR_MIN_CLEAN_FRAC; + cache_ptr->resize_ctl.max_size = H5C__DEF_AR_MAX_SIZE; + cache_ptr->resize_ctl.min_size = H5C__DEF_AR_MIN_SIZE; + cache_ptr->resize_ctl.epoch_length = H5C__DEF_AR_EPOCH_LENGTH; + + cache_ptr->resize_ctl.incr_mode = H5C_incr__off; + cache_ptr->resize_ctl.lower_hr_threshold = H5C__DEF_AR_LOWER_THRESHHOLD; + cache_ptr->resize_ctl.increment = H5C__DEF_AR_INCREMENT; + cache_ptr->resize_ctl.apply_max_increment = TRUE; + cache_ptr->resize_ctl.max_increment = H5C__DEF_AR_MAX_INCREMENT; + + cache_ptr->resize_ctl.flash_incr_mode = H5C_flash_incr__off; + cache_ptr->resize_ctl.flash_multiple = 1.0; + cache_ptr->resize_ctl.flash_threshold = 0.25; + + cache_ptr->resize_ctl.decr_mode = H5C_decr__off; + cache_ptr->resize_ctl.upper_hr_threshold = H5C__DEF_AR_UPPER_THRESHHOLD; + cache_ptr->resize_ctl.decrement = H5C__DEF_AR_DECREMENT; + cache_ptr->resize_ctl.apply_max_decrement = TRUE; + cache_ptr->resize_ctl.max_decrement = H5C__DEF_AR_MAX_DECREMENT; + cache_ptr->resize_ctl.epochs_before_eviction = H5C__DEF_AR_EPCHS_B4_EVICT; + cache_ptr->resize_ctl.apply_empty_reserve = TRUE; + cache_ptr->resize_ctl.empty_reserve = H5C__DEF_AR_EMPTY_RESERVE; cache_ptr->epoch_markers_active = 0; @@ -451,13 +302,12 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, cache_ptr->epoch_marker_ringbuf_size = 0; /* Initialize all epoch marker entries' fields to zero/FALSE/NULL */ - HDmemset(cache_ptr->epoch_markers, 0, sizeof(cache_ptr->epoch_markers)); + memset(cache_ptr->epoch_markers, 0, sizeof(cache_ptr->epoch_markers)); /* Set non-zero/FALSE/NULL fields for epoch markers */ for (i = 0; i < H5C__MAX_EPOCH_MARKERS; i++) { - ((cache_ptr->epoch_markers)[i]).magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; - ((cache_ptr->epoch_markers)[i]).addr = (haddr_t)i; - ((cache_ptr->epoch_markers)[i]).type = H5AC_EPOCH_MARKER; + ((cache_ptr->epoch_markers)[i]).addr = (haddr_t)i; + ((cache_ptr->epoch_markers)[i]).type = H5AC_EPOCH_MARKER; } /* Initialize cache image generation on file close related fields. @@ -493,7 +343,7 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) /* this should be impossible... */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "H5C_reset_cache_hit_rate_stats failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "H5C_reset_cache_hit_rate_stats failed"); H5C_stats__reset(cache_ptr); @@ -501,7 +351,7 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, #ifndef NDEBUG cache_ptr->get_entry_ptr_from_addr_counter = 0; -#endif /* NDEBUG */ +#endif /* Set return value */ ret_value = cache_ptr; @@ -518,8 +368,7 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, if (cache_ptr->log_info != NULL) H5MM_xfree(cache_ptr->log_info); - cache_ptr->magic = 0; - cache_ptr = H5FL_FREE(H5C_t, cache_ptr); + cache_ptr = H5FL_FREE(H5C_t, cache_ptr); } } @@ -527,141 +376,6 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id, } /* H5C_create() */ /*------------------------------------------------------------------------- - * Function: H5C_def_auto_resize_rpt_fcn - * - * Purpose: Print results of a automatic cache resize. - * - * This function should only be used where HDprintf() behaves - * well -- i.e. not on Windows. - * - * Return: void - * - * Programmer: John Mainzer - * 10/27/04 - * - *------------------------------------------------------------------------- - */ -void -H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, -#ifndef NDEBUG - int32_t version, -#else /* NDEBUG */ - int32_t H5_ATTR_UNUSED version, -#endif /* NDEBUG */ - double hit_rate, enum H5C_resize_status status, size_t old_max_cache_size, - size_t new_max_cache_size, size_t old_min_clean_size, size_t new_min_clean_size) -{ - HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(version == H5C__CURR_AUTO_RESIZE_RPT_FCN_VER); - - switch (status) { - case in_spec: - HDfprintf(stdout, "%sAuto cache resize -- no change. (hit rate = %lf)\n", cache_ptr->prefix, - hit_rate); - break; - - case increase: - HDassert(hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold); - HDassert(old_max_cache_size < new_max_cache_size); - - HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n", - cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold); - - HDfprintf(stdout, "%scache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, - old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size); - break; - - case flash_increase: - HDassert(old_max_cache_size < new_max_cache_size); - - HDfprintf(stdout, "%sflash cache resize(%d) -- size threshold = %zu.\n", cache_ptr->prefix, - (int)((cache_ptr->resize_ctl).flash_incr_mode), - cache_ptr->flash_size_increase_threshold); - - HDfprintf(stdout, "%s cache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, - old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size); - break; - - case decrease: - HDassert(old_max_cache_size > new_max_cache_size); - - switch ((cache_ptr->resize_ctl).decr_mode) { - case H5C_decr__off: - HDfprintf(stdout, "%sAuto cache resize -- decrease off. HR = %lf\n", cache_ptr->prefix, - hit_rate); - break; - - case H5C_decr__threshold: - HDassert(hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold); - - HDfprintf(stdout, "%sAuto cache resize -- decrease by threshold. HR = %lf > %6.5lf\n", - cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).upper_hr_threshold); - - HDfprintf(stdout, "%sout of bounds high (%6.5lf).\n", cache_ptr->prefix, - (cache_ptr->resize_ctl).upper_hr_threshold); - break; - - case H5C_decr__age_out: - HDfprintf(stdout, "%sAuto cache resize -- decrease by ageout. HR = %lf\n", - cache_ptr->prefix, hit_rate); - break; - - case H5C_decr__age_out_with_threshold: - HDassert(hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold); - - HDfprintf(stdout, - "%sAuto cache resize -- decrease by ageout with threshold. HR = %lf > %6.5lf\n", - cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).upper_hr_threshold); - break; - - default: - HDfprintf(stdout, "%sAuto cache resize -- decrease by unknown mode. HR = %lf\n", - cache_ptr->prefix, hit_rate); - } - - HDfprintf(stdout, "%s cache size decreased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, - old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size); - break; - - case at_max_size: - HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n", - cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold); - HDfprintf(stdout, "%s cache already at maximum size so no change.\n", cache_ptr->prefix); - break; - - case at_min_size: - HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) -- can't decrease.\n", cache_ptr->prefix, - hit_rate); - HDfprintf(stdout, "%s cache already at minimum size.\n", cache_ptr->prefix); - break; - - case increase_disabled: - HDfprintf(stdout, "%sAuto cache resize -- increase disabled -- HR = %lf.", cache_ptr->prefix, - hit_rate); - break; - - case decrease_disabled: - HDfprintf(stdout, "%sAuto cache resize -- decrease disabled -- HR = %lf.\n", cache_ptr->prefix, - hit_rate); - break; - - case not_full: - HDassert(hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold); - - HDfprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n", - cache_ptr->prefix, hit_rate, (cache_ptr->resize_ctl).lower_hr_threshold); - HDfprintf(stdout, "%s cache not full so no increase in size.\n", cache_ptr->prefix); - break; - - default: - HDfprintf(stdout, "%sAuto cache resize -- unknown status code.\n", cache_ptr->prefix); - break; - } -} /* H5C_def_auto_resize_rpt_fcn() */ - -/*------------------------------------------------------------------------- - * * Function: H5C_prep_for_file_close * * Purpose: This function should be called just prior to the cache @@ -670,9 +384,6 @@ H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 7/3/15 - * *------------------------------------------------------------------------- */ herr_t @@ -685,31 +396,27 @@ H5C_prep_for_file_close(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); - /* For now at least, it is possible to receive the - * close warning more than once -- the following - * if statement handles this. - */ + /* It is possible to receive the close warning more than once */ if (cache_ptr->close_warning_received) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); cache_ptr->close_warning_received = TRUE; /* Make certain there aren't any protected entries */ - HDassert(cache_ptr->pl_len == 0); + assert(cache_ptr->pl_len == 0); /* Prepare cache image */ if (H5C__prep_image_for_file_close(f, &image_generated) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cache image") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create cache image"); #ifdef H5_HAVE_PARALLEL - if ((H5F_INTENT(f) & H5F_ACC_RDWR) && (!image_generated) && (cache_ptr->aux_ptr != NULL) && - (f->shared->fs_persist)) { + if ((H5F_INTENT(f) & H5F_ACC_RDWR) && !image_generated && cache_ptr->aux_ptr != NULL && + f->shared->fs_persist) { /* If persistent free space managers are enabled, flushing the * metadata cache may result in the deletion, insertion, and/or * dirtying of entries. @@ -744,7 +451,7 @@ H5C_prep_for_file_close(H5F_t *f) * deletions, insertion, or moves during the flush. */ if (H5C__serialize_cache(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialization of the cache failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialization of the cache failed"); } /* end if */ #endif /* H5_HAVE_PARALLEL */ @@ -760,79 +467,55 @@ H5C_prep_for_file_close(H5F_t *f) * This function fails if any object are protected since the * resulting file might not be consistent. * - * Note that *cache_ptr has been freed upon successful return. + * Note: *cache_ptr has been freed upon successful return. * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 6/2/04 - * - * Modifications: - * - * JRM -- 5/15/20 - * - * Updated the function to enable the slist prior to the - * call to H5C__flush_invalidate_cache(). - * - * Arguably, it shouldn't be necessary to re-enable the - * slist after the call to H5C__flush_invalidate_cache(), as - * the metadata cache should be discarded. However, in the - * test code, we make multiple calls to H5C_dest(). Thus - * we re-enable the slist on failure if it and the cache - * still exist. - * *------------------------------------------------------------------------- */ herr_t H5C_dest(H5F_t *f) { - H5C_t *cache_ptr = f->shared->cache; - herr_t ret_value = SUCCEED; /* Return value */ + H5C_t *cache_ptr = f->shared->cache; + H5C_tag_info_t *item = NULL; + H5C_tag_info_t *tmp = NULL; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->close_warning_received); + assert(cache_ptr); + assert(cache_ptr->close_warning_received); #if H5AC_DUMP_IMAGE_STATS_ON_CLOSE - if (H5C_image_stats(cache_ptr, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't display cache image stats") + if (H5C__image_stats(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't display cache image stats"); #endif /* H5AC_DUMP_IMAGE_STATS_ON_CLOSE */ /* Enable the slist, as it is needed in the flush */ if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed"); /* Flush and invalidate all cache entries */ if (H5C__flush_invalidate_cache(f, H5C__NO_FLAGS_SET) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache"); /* Generate & write cache image if requested */ - if (cache_ptr->image_ctl.generate_image) { - + if (cache_ptr->image_ctl.generate_image) if (H5C__generate_cache_image(f, cache_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "Can't generate metadata cache image") - } + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "Can't generate metadata cache image"); /* Question: Is it possible for cache_ptr->slist be non-null at this * point? If no, shouldn't this if statement be an assert? */ if (cache_ptr->slist_ptr != NULL) { - HDassert(cache_ptr->slist_len == 0); - HDassert(cache_ptr->slist_size == 0); + assert(cache_ptr->slist_len == 0); + assert(cache_ptr->slist_size == 0); H5SL_close(cache_ptr->slist_ptr); - cache_ptr->slist_ptr = NULL; } - H5C_tag_info_t *item = NULL; - H5C_tag_info_t *tmp = NULL; HASH_ITER(hh, cache_ptr->tag_list, item, tmp) { HASH_DELETE(hh, cache_ptr->tag_list, item); @@ -842,34 +525,26 @@ H5C_dest(H5F_t *f) if (cache_ptr->log_info != NULL) H5MM_xfree(cache_ptr->log_info); -#ifndef NDEBUG -#if H5C_DO_SANITY_CHECKS - - if (cache_ptr->get_entry_ptr_from_addr_counter > 0) { - - HDfprintf(stdout, "*** %" PRId64 " calls to H5C_get_entry_ptr_from_add(). ***\n", - cache_ptr->get_entry_ptr_from_addr_counter); - } +#ifdef H5C_DO_SANITY_CHECKS + if (cache_ptr->get_entry_ptr_from_addr_counter > 0) + fprintf(stdout, "*** %" PRId64 " calls to H5C_get_entry_ptr_from_add(). ***\n", + cache_ptr->get_entry_ptr_from_addr_counter); #endif /* H5C_DO_SANITY_CHECKS */ - cache_ptr->magic = 0; -#endif /* NDEBUG */ - cache_ptr = H5FL_FREE(H5C_t, cache_ptr); done: - - if ((ret_value < 0) && (cache_ptr) && (cache_ptr->slist_ptr)) { - - /* need this for test code -- see change note for details */ - + if (ret_value < 0 && cache_ptr && cache_ptr->slist_ptr) + /* Arguably, it shouldn't be necessary to re-enable the slist after + * the call to H5C__flush_invalidate_cache(), as the metadata cache + * should be discarded. However, in the test code, we make multiple + * calls to H5C_dest(). Thus we re-enable the slist on failure if it + * and the cache still exist. JRM -- 5/15/20 + */ if (H5C_set_slist_enabled(f->shared->cache, FALSE, FALSE) < 0) - - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist on flush dest failure failed") - } + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist on flush dest failure failed"); FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_dest() */ /*------------------------------------------------------------------------- @@ -879,17 +554,6 @@ H5C_dest(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Dec 2013 - * - * Modifications: - * - * JRM -- 5/5/20 - * - * Added code to enable the skip list prior to the call - * to H5C__flush_invalidate_cache(), and disable it - * afterwards. - * *------------------------------------------------------------------------- */ herr_t @@ -900,102 +564,24 @@ H5C_evict(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); + assert(f); /* Enable the slist, as it is needed in the flush */ if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed"); /* Flush and invalidate all cache entries except the pinned entries */ if (H5C__flush_invalidate_cache(f, H5C__EVICT_ALLOW_LAST_PINS_FLAG) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict entries in the cache") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict entries in the cache"); /* Disable the slist */ if (H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist disabled failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist disabled failed"); done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_evict() */ -/*------------------------------------------------------------------------- - * Function: H5C_expunge_entry - * - * Purpose: Use this function to tell the cache to expunge an entry - * from the cache without writing it to disk even if it is - * dirty. The entry may not be either pinned or protected. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 6/29/06 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flags) -{ - H5C_t *cache_ptr; - H5C_cache_entry_t *entry_ptr = NULL; - unsigned flush_flags = (H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG); - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(f); - HDassert(f->shared); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(type); - HDassert(H5F_addr_defined(addr)); - -#if H5C_DO_EXTREME_SANITY_CHECKS - if (H5C_validate_lru_list(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on entry") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - /* Look for entry in cache */ - H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) - if ((entry_ptr == NULL) || (entry_ptr->type != type)) - /* the target doesn't exist in the cache, so we are done. */ - HGOTO_DONE(SUCCEED) - - HDassert(entry_ptr->addr == addr); - HDassert(entry_ptr->type == type); - - /* Check for entry being pinned or protected */ - if (entry_ptr->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is protected") - if (entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is pinned") - - /* If we get this far, call H5C__flush_single_entry() with the - * H5C__FLUSH_INVALIDATE_FLAG and the H5C__FLUSH_CLEAR_ONLY_FLAG. - * This will clear the entry, and then delete it from the cache. - */ - - /* Pass along 'free file space' flag */ - flush_flags |= (flags & H5C__FREE_FILE_SPACE_FLAG); - - /* Delete the entry from the skip list on destroy */ - flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; - - if (H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "can't flush entry") - -done: -#if H5C_DO_EXTREME_SANITY_CHECKS - if (H5C_validate_lru_list(cache_ptr) < 0) - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on exit") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_expunge_entry() */ - /*------------------------------------------------------------------------- * Function: H5C_flush_cache * @@ -1008,45 +594,14 @@ H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flag * function returns failure. * * Return: Non-negative on success/Negative on failure or if there was - * a request to flush all items and something was protected. - * - * Programmer: John Mainzer - * 6/2/04 - * - * Changes: Modified function to test for slist chamges in - * pre_serialize and serialize callbacks, and re-start - * scans through the slist when such changes occur. - * - * This has been a potential problem for some time, - * and there has been code in this function to deal - * with elements of this issue. However the shift - * to the V3 cache in combination with the activities - * of some of the cache clients (in particular the - * free space manager and the fractal heap) have - * made this re-work necessary. - * - * JRM -- 12/13/14 - * - * Modified function to support rings. Basic idea is that - * every entry in the cache is assigned to a ring. Entries - * in the outermost ring are flushed first, followed by - * those in the next outermost ring, and so on until the - * innermost ring is flushed. See header comment on - * H5C_ring_t in H5Cprivate.h for a more detailed - * discussion. - * - * JRM -- 8/30/15 - * - * Modified function to call the free space manager - * settling functions. - * JRM -- 6/9/16 + * a request to flush all items and an entry was protected. * *------------------------------------------------------------------------- */ herr_t H5C_flush_cache(H5F_t *f, unsigned flags) { -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS int i; uint32_t index_len = 0; size_t index_size = (size_t)0; @@ -1062,20 +617,19 @@ H5C_flush_cache(H5F_t *f, unsigned flags) FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->slist_ptr); - -#if H5C_DO_SANITY_CHECKS - HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); - HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); - HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr); + assert(cache_ptr->slist_ptr); + +#ifdef H5C_DO_SANITY_CHECKS + assert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); + assert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); + assert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { index_len += cache_ptr->index_ring_len[i]; @@ -1087,29 +641,29 @@ H5C_flush_cache(H5F_t *f, unsigned flags) slist_size += cache_ptr->slist_ring_size[i]; } /* end for */ - HDassert(cache_ptr->index_len == index_len); - HDassert(cache_ptr->index_size == index_size); - HDassert(cache_ptr->clean_index_size == clean_index_size); - HDassert(cache_ptr->dirty_index_size == dirty_index_size); - HDassert(cache_ptr->slist_len == slist_len); - HDassert(cache_ptr->slist_size == slist_size); + assert(cache_ptr->index_len == index_len); + assert(cache_ptr->index_size == index_size); + assert(cache_ptr->clean_index_size == clean_index_size); + assert(cache_ptr->dirty_index_size == dirty_index_size); + assert(cache_ptr->slist_len == slist_len); + assert(cache_ptr->slist_size == slist_size); #endif /* H5C_DO_SANITY_CHECKS */ -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0); - HDassert(!(destroy && ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0))); - HDassert(!(cache_ptr->flush_in_progress)); + assert(!(destroy && ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0))); + assert(!(cache_ptr->flush_in_progress)); cache_ptr->flush_in_progress = TRUE; if (destroy) { if (H5C__flush_invalidate_cache(f, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate failed"); } /* end if */ else { /* flush each ring, starting from the outermost ring and @@ -1117,7 +671,6 @@ H5C_flush_cache(H5F_t *f, unsigned flags) */ ring = H5C_RING_USER; while (ring < H5C_RING_NTYPES) { - /* Only call the free space manager settle routines when close * warning has been received. */ @@ -1130,14 +683,14 @@ H5C_flush_cache(H5F_t *f, unsigned flags) /* Settle raw data FSM */ if (!cache_ptr->rdfsm_settled) if (H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed"); break; case H5C_RING_MDFSM: /* Settle metadata FSM */ if (!cache_ptr->mdfsm_settled) if (H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed"); break; case H5C_RING_SBE: @@ -1145,13 +698,13 @@ H5C_flush_cache(H5F_t *f, unsigned flags) break; default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!"); break; } /* end switch */ } /* end if */ if (H5C__flush_ring(f, ring, flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush ring failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush ring failed"); ring++; } /* end while */ } /* end else */ @@ -1181,9 +734,6 @@ H5C_flush_cache(H5F_t *f, unsigned flags) * Return: Non-negative on success/Negative on failure or if * write is not permitted. * - * Programmer: John Mainzer - * 9/16/05 - * *------------------------------------------------------------------------- */ herr_t @@ -1195,8040 +745,696 @@ H5C_flush_to_min_clean(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(f->shared); - + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); if (cache_ptr->check_write_permitted != NULL) { if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get write_permitted") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get write_permitted"); } /* end if */ else write_permitted = cache_ptr->write_permitted; if (!write_permitted) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cache write is not permitted!?!") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cache write is not permitted!?!"); if (H5C__make_space_in_cache(f, (size_t)0, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C__make_space_in_cache failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C__make_space_in_cache failed"); done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_flush_to_min_clean() */ /*------------------------------------------------------------------------- - * Function: H5C_insert_entry - * - * Purpose: Adds the specified thing to the cache. The thing need not - * exist on disk yet, but it must have an address and disk - * space reserved. - * - * Observe that this function cannot occasion a read. + * Function: H5C_reset_cache_hit_rate_stats() * - * Return: Non-negative on success/Negative on failure + * Purpose: Reset the cache hit rate computation fields. * - * Programmer: John Mainzer - * 6/2/04 + * Return: SUCCEED on success, and FAIL on failure. * *------------------------------------------------------------------------- */ herr_t -H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, unsigned int flags) +H5C_reset_cache_hit_rate_stats(H5C_t *cache_ptr) { - H5C_t *cache_ptr; - H5AC_ring_t ring = H5C_RING_UNDEFINED; - hbool_t insert_pinned; - hbool_t flush_last; -#ifdef H5_HAVE_PARALLEL - hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ -#endif /* H5_HAVE_PARALLEL */ - hbool_t set_flush_marker; - hbool_t write_permitted = TRUE; - size_t empty_space; - H5C_cache_entry_t *entry_ptr = NULL; - H5C_cache_entry_t *test_entry_ptr; - hbool_t entry_tagged = FALSE; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(f->shared); - - cache_ptr = f->shared->cache; + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry"); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(type); - HDassert(type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type); - HDassert(type->image_len); - HDassert(H5F_addr_defined(addr)); - HDassert(thing); - -#if H5C_DO_EXTREME_SANITY_CHECKS - /* no need to verify that entry is not already in the index as */ - /* we already make that check below. */ - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + cache_ptr->cache_hits = 0; + cache_ptr->cache_accesses = 0; - set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0); - insert_pinned = ((flags & H5C__PIN_ENTRY_FLAG) != 0); - flush_last = ((flags & H5C__FLUSH_LAST_FLAG) != 0); +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_reset_cache_hit_rate_stats() */ - /* Get the ring type from the API context */ - ring = H5CX_get_ring(); +/*------------------------------------------------------------------------- + * Function: H5C_set_cache_auto_resize_config + * + * Purpose: Set the cache automatic resize configuration to the + * provided values if they are in range, and fail if they + * are not. + * + * If the new configuration enables automatic cache resizing, + * coerce the cache max size and min clean size into agreement + * with the new policy and re-set the full cache hit rate + * stats. + * + * Return: SUCCEED on success, and FAIL on failure. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr) +{ + size_t new_max_cache_size; + size_t new_min_clean_size; + herr_t ret_value = SUCCEED; /* Return value */ - entry_ptr = (H5C_cache_entry_t *)thing; + FUNC_ENTER_NOAPI(FAIL) - /* verify that the new entry isn't already in the hash table -- scream - * and die if it is. - */ + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry"); + if (config_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry"); + if (config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown config version"); - H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) + /* check general configuration section of the config: */ + if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_GENERAL) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in general configuration fields of new config"); - if (test_entry_ptr != NULL) { - if (test_entry_ptr == entry_ptr) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "entry already in cache") - else - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "duplicate entry in cache") - } /* end if */ + /* check size increase control fields of the config: */ + if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INCREMENT) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size increase control fields of new config"); - entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; - entry_ptr->cache_ptr = cache_ptr; - entry_ptr->addr = addr; - entry_ptr->type = type; + /* check size decrease control fields of the config: */ + if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_DECREMENT) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size decrease control fields of new config"); - entry_ptr->image_ptr = NULL; - entry_ptr->image_up_to_date = FALSE; + /* check for conflicts between size increase and size decrease controls: */ + if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "conflicting threshold fields in new config"); - entry_ptr->is_protected = FALSE; - entry_ptr->is_read_only = FALSE; - entry_ptr->ro_ref_count = 0; + /* will set the increase possible fields to FALSE later if needed */ + cache_ptr->size_increase_possible = TRUE; + cache_ptr->flash_size_increase_possible = TRUE; + cache_ptr->size_decrease_possible = TRUE; - entry_ptr->is_pinned = insert_pinned; - entry_ptr->pinned_from_client = insert_pinned; - entry_ptr->pinned_from_cache = FALSE; - entry_ptr->flush_me_last = flush_last; + switch (config_ptr->incr_mode) { + case H5C_incr__off: + cache_ptr->size_increase_possible = FALSE; + break; - /* newly inserted entries are assumed to be dirty */ - entry_ptr->is_dirty = TRUE; + case H5C_incr__threshold: + if ((config_ptr->lower_hr_threshold <= 0.0) || (config_ptr->increment <= 1.0) || + ((config_ptr->apply_max_increment) && (config_ptr->max_increment <= 0))) + cache_ptr->size_increase_possible = FALSE; + break; - /* not protected, so can't be dirtied */ - entry_ptr->dirtied = FALSE; + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown incr_mode?!?!?"); + } /* end switch */ - /* Retrieve the size of the thing */ - if ((type->image_len)(thing, &(entry_ptr->size)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "can't get size of thing") - HDassert(entry_ptr->size > 0 && entry_ptr->size < H5C_MAX_ENTRY_SIZE); + /* logically, this is where configuration for flash cache size increases + * should go. However, this configuration depends on max_cache_size, so + * we wait until the end of the function, when this field is set. + */ - entry_ptr->in_slist = FALSE; + switch (config_ptr->decr_mode) { + case H5C_decr__off: + cache_ptr->size_decrease_possible = FALSE; + break; -#ifdef H5_HAVE_PARALLEL - entry_ptr->clear_on_unprotect = FALSE; - entry_ptr->flush_immediately = FALSE; -#endif /* H5_HAVE_PARALLEL */ + case H5C_decr__threshold: + if (config_ptr->upper_hr_threshold >= 1.0 || config_ptr->decrement >= 1.0 || + (config_ptr->apply_max_decrement && config_ptr->max_decrement <= 0)) + cache_ptr->size_decrease_possible = FALSE; + break; - entry_ptr->flush_in_progress = FALSE; - entry_ptr->destroy_in_progress = FALSE; + case H5C_decr__age_out: + if ((config_ptr->apply_empty_reserve && config_ptr->empty_reserve >= 1.0) || + (config_ptr->apply_max_decrement && config_ptr->max_decrement <= 0)) + cache_ptr->size_decrease_possible = FALSE; + break; - entry_ptr->ring = ring; - - /* Initialize flush dependency fields */ - entry_ptr->flush_dep_parent = NULL; - entry_ptr->flush_dep_nparents = 0; - entry_ptr->flush_dep_parent_nalloc = 0; - entry_ptr->flush_dep_nchildren = 0; - entry_ptr->flush_dep_ndirty_children = 0; - entry_ptr->flush_dep_nunser_children = 0; - - entry_ptr->ht_next = NULL; - entry_ptr->ht_prev = NULL; - entry_ptr->il_next = NULL; - entry_ptr->il_prev = NULL; + case H5C_decr__age_out_with_threshold: + if ((config_ptr->apply_empty_reserve && config_ptr->empty_reserve >= 1.0) || + (config_ptr->apply_max_decrement && config_ptr->max_decrement <= 0) || + config_ptr->upper_hr_threshold >= 1.0) + cache_ptr->size_decrease_possible = FALSE; + break; - entry_ptr->next = NULL; - entry_ptr->prev = NULL; + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown decr_mode?!?!?"); + } /* end switch */ -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - entry_ptr->aux_next = NULL; - entry_ptr->aux_prev = NULL; -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + if (config_ptr->max_size == config_ptr->min_size) { + cache_ptr->size_increase_possible = FALSE; + cache_ptr->flash_size_increase_possible = FALSE; + cache_ptr->size_decrease_possible = FALSE; + } /* end if */ -#ifdef H5_HAVE_PARALLEL - entry_ptr->coll_next = NULL; - entry_ptr->coll_prev = NULL; -#endif /* H5_HAVE_PARALLEL */ + /* flash_size_increase_possible is intentionally omitted from the + * following: + */ + cache_ptr->resize_enabled = cache_ptr->size_increase_possible || cache_ptr->size_decrease_possible; + cache_ptr->resize_ctl = *config_ptr; - /* initialize cache image related fields */ - entry_ptr->include_in_image = FALSE; - entry_ptr->lru_rank = 0; - entry_ptr->image_dirty = FALSE; - entry_ptr->fd_parent_count = 0; - entry_ptr->fd_parent_addrs = NULL; - entry_ptr->fd_child_count = 0; - entry_ptr->fd_dirty_child_count = 0; - entry_ptr->image_fd_height = 0; - entry_ptr->prefetched = FALSE; - entry_ptr->prefetch_type_id = 0; - entry_ptr->age = 0; - entry_ptr->prefetched_dirty = FALSE; -#ifndef NDEBUG /* debugging field */ - entry_ptr->serialization_count = 0; -#endif /* NDEBUG */ - - /* initialize tag list fields */ - entry_ptr->tl_next = NULL; - entry_ptr->tl_prev = NULL; - entry_ptr->tag_info = NULL; - - /* Apply tag to newly inserted entry */ - if (H5C__tag_entry(cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry") - entry_tagged = TRUE; - - H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) - - if (cache_ptr->flash_size_increase_possible && - (entry_ptr->size > cache_ptr->flash_size_increase_threshold)) - if (H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__flash_increase_cache_size failed") - - if (cache_ptr->index_size >= cache_ptr->max_cache_size) - empty_space = 0; + /* Resize the cache to the supplied initial value if requested, or as + * necessary to force it within the bounds of the current automatic + * cache resizing configuration. + * + * Note that the min_clean_fraction may have changed, so we + * go through the exercise even if the current size is within + * range and an initial size has not been provided. + */ + if (cache_ptr->resize_ctl.set_initial_size) + new_max_cache_size = cache_ptr->resize_ctl.initial_size; + else if (cache_ptr->max_cache_size > cache_ptr->resize_ctl.max_size) + new_max_cache_size = cache_ptr->resize_ctl.max_size; + else if (cache_ptr->max_cache_size < cache_ptr->resize_ctl.min_size) + new_max_cache_size = cache_ptr->resize_ctl.min_size; else - empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - - if (cache_ptr->evictions_enabled && - (((cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) || - (((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size)))) { - size_t space_needed; + new_max_cache_size = cache_ptr->max_cache_size; - if (empty_space <= entry_ptr->size) - cache_ptr->cache_full = TRUE; + new_min_clean_size = (size_t)((double)new_max_cache_size * (cache_ptr->resize_ctl.min_clean_fraction)); - if (cache_ptr->check_write_permitted != NULL) { - if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "Can't get write_permitted") - } /* end if */ - else - write_permitted = cache_ptr->write_permitted; - - HDassert(entry_ptr->size <= H5C_MAX_ENTRY_SIZE); - space_needed = entry_ptr->size; - if (space_needed > cache_ptr->max_cache_size) - space_needed = cache_ptr->max_cache_size; - - /* Note that space_needed is just the amount of space that - * needed to insert the new entry without exceeding the cache - * size limit. The subsequent call to H5C__make_space_in_cache() - * may evict the entries required to free more or less space - * depending on conditions. It MAY be less if the cache is - * currently undersized, or more if the cache is oversized. - * - * The cache can exceed its maximum size limit via the following - * mechanisms: - * - * First, it is possible for the cache to grow without - * bound as long as entries are protected and not unprotected. - * - * Second, when writes are not permitted it is also possible - * for the cache to grow without bound. - * - * Finally, we usually don't check to see if the cache is - * oversized at the end of an unprotect. As a result, it is - * possible to have a vastly oversized cache with no protected - * entries as long as all the protects precede the unprotects. - * - * Since items 1 and 2 are not changing any time soon, I see - * no point in worrying about the third. - */ + /* since new_min_clean_size is of type size_t, we have + * + * ( 0 <= new_min_clean_size ) + * + * by definition. + */ + assert(new_min_clean_size <= new_max_cache_size); + assert(cache_ptr->resize_ctl.min_size <= new_max_cache_size); + assert(new_max_cache_size <= cache_ptr->resize_ctl.max_size); - if (H5C__make_space_in_cache(f, space_needed, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__make_space_in_cache failed") - } /* end if */ + if (new_max_cache_size < cache_ptr->max_cache_size) + cache_ptr->size_decreased = TRUE; - H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL) + cache_ptr->max_cache_size = new_max_cache_size; + cache_ptr->min_clean_size = new_min_clean_size; - /* New entries are presumed to be dirty */ - HDassert(entry_ptr->is_dirty); - entry_ptr->flush_marker = set_flush_marker; - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) - H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL) + if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) + /* this should be impossible... */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed"); -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + /* remove excess epoch markers if any */ + if ((config_ptr->decr_mode == H5C_decr__age_out_with_threshold) || + (config_ptr->decr_mode == H5C_decr__age_out)) { + if (cache_ptr->epoch_markers_active > cache_ptr->resize_ctl.epochs_before_eviction) + if (H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers"); + } /* end if */ + else if (cache_ptr->epoch_markers_active > 0) { + if (H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers"); + } - /* If the entry's type has a 'notify' callback send a 'after insertion' - * notice now that the entry is fully integrated into the cache. + /* configure flash size increase facility. We wait until the + * end of the function, as we need the max_cache_size set before + * we start to keep things simple. + * + * If we haven't already ruled out flash cache size increases above, + * go ahead and configure it. */ - if (entry_ptr->type->notify && (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_INSERT, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry inserted into cache") + if (cache_ptr->flash_size_increase_possible) { + switch (config_ptr->flash_incr_mode) { + case H5C_flash_incr__off: + cache_ptr->flash_size_increase_possible = FALSE; + break; - H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_possible = TRUE; + cache_ptr->flash_size_increase_threshold = + (size_t)(((double)(cache_ptr->max_cache_size)) * (cache_ptr->resize_ctl.flash_threshold)); + break; -#ifdef H5_HAVE_PARALLEL - if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) - coll_access = H5F_get_coll_metadata_reads(f); - - entry_ptr->coll_access = coll_access; - if (coll_access) { - H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL) - - /* Make sure the size of the collective entries in the cache remain in check */ - if (H5P_USER_TRUE == H5F_COLL_MD_READ(f)) { - if (cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) { - if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries") - } /* end if */ - } /* end if */ - else { - if (cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) { - if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries") - } /* end if */ - } /* end else */ - } /* end if */ -#endif + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?"); + break; + } /* end switch */ + } /* end if */ done: -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - if (ret_value < 0 && entry_tagged) - if (H5C__untag_entry(cache_ptr, entry_ptr) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list") - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_insert_entry() */ +} /* H5C_set_cache_auto_resize_config() */ /*------------------------------------------------------------------------- - * Function: H5C_mark_entry_dirty - * - * Purpose: Mark a pinned or protected entry as dirty. The target entry - * MUST be either pinned or protected, and MAY be both. - * - * In the protected case, this call is the functional - * equivalent of setting the H5C__DIRTIED_FLAG on an unprotect - * call. - * - * In the pinned but not protected case, if the entry is not - * already dirty, the function places function marks the entry - * dirty and places it on the skip list. - * - * Return: Non-negative on success/Negative on failure + * Function: H5C_set_evictions_enabled() * - * Programmer: John Mainzer - * 5/15/06 + * Purpose: Set cache_ptr->evictions_enabled to the value of the + * evictions enabled parameter. * - * JRM -- 11/5/08 - * Added call to H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY() to - * update the new clean_index_size and dirty_index_size - * fields of H5C_t in the case that the entry was clean - * prior to this call, and is pinned and not protected. + * Return: SUCCEED on success, and FAIL on failure. * *------------------------------------------------------------------------- */ herr_t -H5C_mark_entry_dirty(void *thing) +H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled) { - H5C_t *cache_ptr; - H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)thing; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Sanity checks */ - HDassert(entry_ptr); - HDassert(H5F_addr_defined(entry_ptr->addr)); - cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - if (entry_ptr->is_protected) { - HDassert(!((entry_ptr)->is_read_only)); - - /* set the dirtied flag */ - entry_ptr->dirtied = TRUE; - - /* reset image_up_to_date */ - if (entry_ptr->image_up_to_date) { - entry_ptr->image_up_to_date = FALSE; - - if (entry_ptr->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "Can't propagate serialization status to fd parents") - } /* end if */ - } /* end if */ - else if (entry_ptr->is_pinned) { - hbool_t was_clean; /* Whether the entry was previously clean */ - hbool_t image_was_up_to_date; - - /* Remember previous dirty status */ - was_clean = !entry_ptr->is_dirty; - - /* Check if image is up to date */ - image_was_up_to_date = entry_ptr->image_up_to_date; - - /* Mark the entry as dirty if it isn't already */ - entry_ptr->is_dirty = TRUE; - entry_ptr->image_up_to_date = FALSE; - - /* Modify cache data structures */ - if (was_clean) - H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) - if (!entry_ptr->in_slist) - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry"); - /* Update stats for entry being marked dirty */ - H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) + /* There is no fundamental reason why we should not permit + * evictions to be disabled while automatic resize is enabled. + * However, allowing it would greatly complicate testing + * the feature. Hence the following: + */ + if ((evictions_enabled != TRUE) && ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) || + (cache_ptr->resize_ctl.decr_mode != H5C_decr__off))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled"); - /* Check for entry changing status and do notifications, etc. */ - if (was_clean) { - /* If the entry's type has a 'notify' callback send a 'entry dirtied' - * notice now that the entry is fully integrated into the cache. - */ - if (entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set") - - /* Propagate the dirty flag up the flush dependency chain if appropriate */ - if (entry_ptr->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_dirty(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") - } /* end if */ - if (image_was_up_to_date) - if (entry_ptr->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "Can't propagate serialization status to fd parents") - } /* end if */ - else - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is neither pinned nor protected??") + cache_ptr->evictions_enabled = evictions_enabled; done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_mark_entry_dirty() */ +} /* H5C_set_evictions_enabled() */ /*------------------------------------------------------------------------- - * Function: H5C_mark_entry_clean - * - * Purpose: Mark a pinned entry as clean. The target entry MUST be pinned. - * - * If the entry is not - * already clean, the function places function marks the entry - * clean and removes it from the skip list. - * - * Return: Non-negative on success/Negative on failure + * Function: H5C_set_slist_enabled() * - * Programmer: Quincey Koziol - * 7/23/16 + * Purpose: Enable or disable the slist as directed. * - *------------------------------------------------------------------------- - */ -herr_t -H5C_mark_entry_clean(void *_thing) -{ - H5C_t *cache_ptr; - H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_thing; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(entry_ptr); - HDassert(H5F_addr_defined(entry_ptr->addr)); - cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - /* Operate on pinned entry */ - if (entry_ptr->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "entry is protected") - else if (entry_ptr->is_pinned) { - hbool_t was_dirty; /* Whether the entry was previously dirty */ - - /* Remember previous dirty status */ - was_dirty = entry_ptr->is_dirty; - - /* Mark the entry as clean if it isn't already */ - entry_ptr->is_dirty = FALSE; - - /* Also reset the 'flush_marker' flag, since the entry shouldn't be flushed now */ - entry_ptr->flush_marker = FALSE; - - /* Modify cache data structures */ - if (was_dirty) - H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr) - if (entry_ptr->in_slist) - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE) - - /* Update stats for entry being marked clean */ - H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) - - /* Check for entry changing status and do notifications, etc. */ - if (was_dirty) { - /* If the entry's type has a 'notify' callback send a 'entry cleaned' - * notice now that the entry is fully integrated into the cache. - */ - if (entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify client about entry dirty flag cleared") - - /* Propagate the clean up the flush dependency chain, if appropriate */ - if (entry_ptr->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_clean(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "Can't propagate flush dep clean") - } /* end if */ - } /* end if */ - else - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "Entry is not pinned??") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_mark_entry_clean() */ - -/*------------------------------------------------------------------------- - * Function: H5C_mark_entry_unserialized + * The slist (skip list) is an address ordered list of + * dirty entries in the metadata cache. However, this + * list is only needed during flush and close, where we + * use it to write entries in more or less increasing + * address order. * - * Purpose: Mark a pinned or protected entry as unserialized. The target - * entry MUST be either pinned or protected, and MAY be both. + * This function sets up and enables further operations + * on the slist, or disable the slist. This in turn + * allows us to avoid the overhead of maintaining the + * slist when it is not needed. * - * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * 12/23/16 + * If the slist_enabled parameter is TRUE, the function * - *------------------------------------------------------------------------- - */ -herr_t -H5C_mark_entry_unserialized(void *thing) -{ - H5C_cache_entry_t *entry = (H5C_cache_entry_t *)thing; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(entry); - HDassert(H5F_addr_defined(entry->addr)); - - if (entry->is_protected || entry->is_pinned) { - HDassert(!entry->is_read_only); - - /* Reset image_up_to_date */ - if (entry->image_up_to_date) { - entry->image_up_to_date = FALSE; - - if (entry->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_unserialized(entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, - "Can't propagate serialization status to fd parents") - } /* end if */ - } /* end if */ - else - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKUNSERIALIZED, FAIL, - "Entry to unserialize is neither pinned nor protected??") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_mark_entry_unserialized() */ - -/*------------------------------------------------------------------------- - * Function: H5C_mark_entry_serialized + * 1) Verifies that the slist is empty. * - * Purpose: Mark a pinned entry as serialized. The target entry MUST be - * pinned. + * 2) Scans the index list, and inserts all dirty entries + * into the slist. * - * Return: Non-negative on success/Negative on failure + * 3) Sets cache_ptr->slist_enabled = TRUE. * - * Programmer: Quincey Koziol - * 12/23/16 + * Note that the clear_slist parameter is ignored if + * the slist_enabed parameter is TRUE. * - *------------------------------------------------------------------------- - */ -herr_t -H5C_mark_entry_serialized(void *_thing) -{ - H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_thing; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(entry); - HDassert(H5F_addr_defined(entry->addr)); - - /* Operate on pinned entry */ - if (entry->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "entry is protected") - else if (entry->is_pinned) { - /* Check for entry changing status and do notifications, etc. */ - if (!entry->image_up_to_date) { - /* Set the image_up_to_date flag */ - entry->image_up_to_date = TRUE; - - /* Propagate the serialize up the flush dependency chain, if appropriate */ - if (entry->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_serialized(entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, - "Can't propagate flush dep serialize") - } /* end if */ - } /* end if */ - else - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "Entry is not pinned??") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_mark_entry_serialized() */ - -/*------------------------------------------------------------------------- * - * Function: H5C_move_entry + * If the slist_enabled_parameter is FALSE, the function + * shuts down the slist. * - * Purpose: Use this function to notify the cache that an entry's - * file address changed. + * Normally the slist will be empty at this point, however + * that need not be the case if H5C_flush_cache() has been + * called with the H5C__FLUSH_MARKED_ENTRIES_FLAG. * - * Return: Non-negative on success/Negative on failure + * Thus shutdown proceeds as follows: * - * Programmer: John Mainzer - * 6/2/04 + * 1) Test to see if the slist is empty. If it is, proceed + * to step 3. * - *------------------------------------------------------------------------- - */ -herr_t -H5C_move_entry(H5C_t *cache_ptr, const H5C_class_t *type, haddr_t old_addr, haddr_t new_addr) -{ - H5C_cache_entry_t *entry_ptr = NULL; - H5C_cache_entry_t *test_entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(type); - HDassert(H5F_addr_defined(old_addr)); - HDassert(H5F_addr_defined(new_addr)); - HDassert(H5F_addr_ne(old_addr, new_addr)); - -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - H5C__SEARCH_INDEX(cache_ptr, old_addr, entry_ptr, FAIL) - - if (entry_ptr == NULL || entry_ptr->type != type) - /* the old item doesn't exist in the cache, so we are done. */ - HGOTO_DONE(SUCCEED) - - HDassert(entry_ptr->addr == old_addr); - HDassert(entry_ptr->type == type); - - /* Check for R/W status, otherwise error */ - /* (Moving a R/O entry would mark it dirty, which shouldn't - * happen. QAK - 2016/12/02) - */ - if (entry_ptr->is_read_only) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "can't move R/O entry") - - H5C__SEARCH_INDEX(cache_ptr, new_addr, test_entry_ptr, FAIL) - - if (test_entry_ptr != NULL) { /* we are hosed */ - if (test_entry_ptr->type == type) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "target already moved & reinserted???") - else - HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "new address already in use?") - } /* end if */ - - /* If we get this far we have work to do. Remove *entry_ptr from - * the hash table (and skip list if necessary), change its address to the - * new address, mark it as dirty (if it isn't already) and then re-insert. - * - * Update the replacement policy for a hit to avoid an eviction before - * the moved entry is touched. Update stats for a move. - * - * Note that we do not check the size of the cache, or evict anything. - * Since this is a simple re-name, cache size should be unaffected. - * - * Check to see if the target entry is in the process of being destroyed - * before we delete from the index, etc. If it is, all we do is - * change the addr. If the entry is only in the process of being flushed, - * don't mark it as dirty either, lest we confuse the flush call back. - */ - if (!entry_ptr->destroy_in_progress) { - H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL) - - if (entry_ptr->in_slist) { - HDassert(cache_ptr->slist_ptr); - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE) - } /* end if */ - } /* end if */ - - entry_ptr->addr = new_addr; - - if (!entry_ptr->destroy_in_progress) { - hbool_t was_dirty; /* Whether the entry was previously dirty */ - - /* Remember previous dirty status */ - was_dirty = entry_ptr->is_dirty; - - /* Mark the entry as dirty if it isn't already */ - entry_ptr->is_dirty = TRUE; - - /* This shouldn't be needed, but it keeps the test code happy */ - if (entry_ptr->image_up_to_date) { - entry_ptr->image_up_to_date = FALSE; - if (entry_ptr->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "Can't propagate serialization status to fd parents") - } /* end if */ - - /* Modify cache data structures */ - H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL) - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) - - /* Skip some actions if we're in the middle of flushing the entry */ - if (!entry_ptr->flush_in_progress) { - /* Update the replacement policy for the entry */ - H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, FAIL) - - /* Check for entry changing status and do notifications, etc. */ - if (!was_dirty) { - /* If the entry's type has a 'notify' callback send a 'entry dirtied' - * notice now that the entry is fully integrated into the cache. - */ - if (entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify client about entry dirty flag set") - - /* Propagate the dirty flag up the flush dependency chain if appropriate */ - if (entry_ptr->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_dirty(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, - "Can't propagate flush dep dirty flag") - } /* end if */ - } /* end if */ - } /* end if */ - - H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) - -done: -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_move_entry() */ - -/*------------------------------------------------------------------------- - * Function: H5C_resize_entry + * 2) Test to see if the clear_slist parameter is TRUE. * - * Purpose: Resize a pinned or protected entry. + * If it is, remove all entries from the slist. * - * Resizing an entry dirties it, so if the entry is not - * already dirty, the function places the entry on the - * skip list. + * If it isn't, throw an error. * - * Return: Non-negative on success/Negative on failure + * 3) set cache_ptr->slist_enabled = FALSE. * - * Programmer: John Mainzer - * 7/5/06 + * Return: SUCCEED on success, and FAIL on failure. * *------------------------------------------------------------------------- */ herr_t -H5C_resize_entry(void *thing, size_t new_size) +H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled, hbool_t clear_slist) { - H5C_t *cache_ptr; - H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)thing; + H5C_cache_entry_t *entry_ptr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Sanity checks */ - HDassert(entry_ptr); - HDassert(H5F_addr_defined(entry_ptr->addr)); - cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - /* Check for usage errors */ - if (new_size <= 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "New size is non-positive") - if (!(entry_ptr->is_pinned || entry_ptr->is_protected)) - HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "Entry isn't pinned or protected??") - -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - /* update for change in entry size if necessary */ - if (entry_ptr->size != new_size) { - hbool_t was_clean; - - /* make note of whether the entry was clean to begin with */ - was_clean = !entry_ptr->is_dirty; + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry"); - /* mark the entry as dirty if it isn't already */ - entry_ptr->is_dirty = TRUE; - - /* Reset the image up-to-date status */ - if (entry_ptr->image_up_to_date) { - entry_ptr->image_up_to_date = FALSE; - if (entry_ptr->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "Can't propagate serialization status to fd parents") - } /* end if */ + if (slist_enabled) { + if (cache_ptr->slist_enabled) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already enabled?"); + if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty?"); - /* Release the current image */ - if (entry_ptr->image_ptr) - entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); - - /* do a flash cache size increase if appropriate */ - if (cache_ptr->flash_size_increase_possible) { - - if (new_size > entry_ptr->size) { - size_t size_increase; - - size_increase = new_size - entry_ptr->size; - - if (size_increase >= cache_ptr->flash_size_increase_threshold) { - if (H5C__flash_increase_cache_size(cache_ptr, entry_ptr->size, new_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "flash cache increase failed") - } - } - } - - /* update the pinned and/or protected entry list */ - if (entry_ptr->is_pinned) { - H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pel_len), (cache_ptr->pel_size), (entry_ptr->size), - (new_size)) - } /* end if */ - if (entry_ptr->is_protected) { - H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->pl_len), (cache_ptr->pl_size), (entry_ptr->size), - (new_size)) - } /* end if */ - -#ifdef H5_HAVE_PARALLEL - if (entry_ptr->coll_access) { - H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->coll_list_len), (cache_ptr->coll_list_size), - (entry_ptr->size), (new_size)) - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - - /* update statistics just before changing the entry size */ - H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size); - - /* update the hash table */ - H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_size, entry_ptr, was_clean); - - /* if the entry is in the skip list, update that too */ - if (entry_ptr->in_slist) - H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_size); - - /* finally, update the entry size proper */ - entry_ptr->size = new_size; - - if (!entry_ptr->in_slist) - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) - - if (entry_ptr->is_pinned) - H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr) - - /* Check for entry changing status and do notifications, etc. */ - if (was_clean) { - /* If the entry's type has a 'notify' callback send a 'entry dirtied' - * notice now that the entry is fully integrated into the cache. - */ - if (entry_ptr->type->notify && - (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set") - - /* Propagate the dirty flag up the flush dependency chain if appropriate */ - if (entry_ptr->flush_dep_nparents > 0) - if (H5C__mark_flush_dep_dirty(entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") - } /* end if */ - } /* end if */ - -done: -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || (H5C_validate_pinned_entry_list(cache_ptr) < 0)) - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_resize_entry() */ - -/*------------------------------------------------------------------------- - * Function: H5C_pin_protected_entry() - * - * Purpose: Pin a protected cache entry. The entry must be protected - * at the time of call, and must be unpinned. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 4/26/06 - * - * Changes: Added extreme sanity checks on entry and exit. - * JRM -- 4/26/14 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_pin_protected_entry(void *thing) -{ - H5C_t *cache_ptr; - H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to pin */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(entry_ptr); - HDassert(H5F_addr_defined(entry_ptr->addr)); - cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - /* Only protected entries can be pinned */ - if (!entry_ptr->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Entry isn't protected") - - /* Pin the entry from a client */ - if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") - -done: -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_pin_protected_entry() */ - -/*------------------------------------------------------------------------- - * Function: H5C_protect - * - * Purpose: If the target entry is not in the cache, load it. If - * necessary, attempt to evict one or more entries to keep - * the cache within its maximum size. - * - * Mark the target entry as protected, and return its address - * to the caller. The caller must call H5C_unprotect() when - * finished with the entry. - * - * While it is protected, the entry may not be either evicted - * or flushed -- nor may it be accessed by another call to - * H5C_protect. Any attempt to do so will result in a failure. - * - * Return: Success: Ptr to the desired entry - * Failure: NULL - * - * Programmer: John Mainzer - 6/2/04 - * - *------------------------------------------------------------------------- - */ -void * -H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsigned flags) -{ - H5C_t *cache_ptr; - H5AC_ring_t ring = H5C_RING_UNDEFINED; - hbool_t hit; - hbool_t have_write_permitted = FALSE; - hbool_t read_only = FALSE; - hbool_t flush_last; -#ifdef H5_HAVE_PARALLEL - hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ -#endif /* H5_HAVE_PARALLEL */ - hbool_t write_permitted = FALSE; - hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */ - size_t empty_space; - void *thing; - H5C_cache_entry_t *entry_ptr; - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_NOAPI(NULL) - - /* check args */ - HDassert(f); - HDassert(f->shared); - - cache_ptr = f->shared->cache; - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(type); - HDassert(type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type); - HDassert(H5F_addr_defined(addr)); - -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on entry") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - /* Load the cache image, if requested */ - if (cache_ptr->load_image) { - cache_ptr->load_image = FALSE; - if (H5C__load_cache_image(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't load cache image") - } /* end if */ - - read_only = ((flags & H5C__READ_ONLY_FLAG) != 0); - flush_last = ((flags & H5C__FLUSH_LAST_FLAG) != 0); - - /* Get the ring type from the API context */ - ring = H5CX_get_ring(); - -#ifdef H5_HAVE_PARALLEL - if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) - coll_access = H5F_get_coll_metadata_reads(f); -#endif /* H5_HAVE_PARALLEL */ - - /* first check to see if the target is in cache */ - H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL) - - if (entry_ptr != NULL) { - if (entry_ptr->ring != ring) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occurred for cache entry") - - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - - if (entry_ptr->prefetched) { - /* This call removes the prefetched entry from the cache, - * and replaces it with an entry deserialized from the - * image of the prefetched entry. - */ - if (H5C__deserialize_prefetched_entry(f, cache_ptr, &entry_ptr, type, addr, udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't deserialize prefetched entry") - - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(!entry_ptr->prefetched); - HDassert(entry_ptr->addr == addr); - } /* end if */ - - /* Check for trying to load the wrong type of entry from an address */ - if (entry_ptr->type != type) - HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type") - - /* if this is a collective metadata read, the entry is not - marked as collective, and is clean, it is possible that - other processes will not have it in its cache and will - expect a bcast of the entry from process 0. So process 0 - will bcast the entry to all other ranks. Ranks that _do_ have - the entry in their cache still have to participate in the - bcast. */ -#ifdef H5_HAVE_PARALLEL - if (coll_access) { - if (!(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { - MPI_Comm comm; /* File MPI Communicator */ - int mpi_code; /* MPI error code */ - int buf_size; - - if (MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") - - if (entry_ptr->image_ptr == NULL) { - int mpi_rank; - - if ((mpi_rank = H5F_mpi_get_rank(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") - - if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, - "memory allocation failed for on disk image buffer") -#if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - if (0 == mpi_rank) { - if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0) { - /* If image generation fails, push an error but - * still participate in the following MPI_Bcast - */ - HDONE_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't generate entry's image") - } - } - } /* end if */ - HDassert(entry_ptr->image_ptr); - - H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t); - if (MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - - /* Mark the entry as collective and insert into the collective list */ - entry_ptr->coll_access = TRUE; - H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) - } /* end if */ - else if (entry_ptr->coll_access) { - H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) - } /* end else-if */ - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - -#if H5C_DO_TAGGING_SANITY_CHECKS - { - /* Verify tag value */ - if (cache_ptr->ignore_tags != TRUE) { - haddr_t tag; /* Tag value */ - - /* The entry is already in the cache, but make sure that the tag value - * is still legal. This will ensure that had the entry NOT been in the - * cache, tagging was still set up correctly and it would have received - * a legal tag value after getting loaded from disk. - */ - - /* Get the tag */ - tag = H5CX_get_tag(); - - if (H5C_verify_tag(entry_ptr->type->id, tag) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "tag verification failed") - } /* end if */ - } -#endif - - hit = TRUE; - thing = (void *)entry_ptr; - } - else { - - /* must try to load the entry from disk. */ - - hit = FALSE; - - if (NULL == (thing = H5C__load_entry(f, -#ifdef H5_HAVE_PARALLEL - coll_access, -#endif /* H5_HAVE_PARALLEL */ - type, addr, udata))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't load entry") - - entry_ptr = (H5C_cache_entry_t *)thing; - cache_ptr->entries_loaded_counter++; - - entry_ptr->ring = ring; -#ifdef H5_HAVE_PARALLEL - if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && entry_ptr->coll_access) - H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) -#endif /* H5_HAVE_PARALLEL */ - - /* Apply tag to newly protected entry */ - if (H5C__tag_entry(cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Cannot tag metadata entry") - - /* If the entry is very large, and we are configured to allow it, - * we may wish to perform a flash cache size increase. - */ - if ((cache_ptr->flash_size_increase_possible) && - (entry_ptr->size > cache_ptr->flash_size_increase_threshold)) { - - if (H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__flash_increase_cache_size failed") - } - - if (cache_ptr->index_size >= cache_ptr->max_cache_size) - empty_space = 0; - else - empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - - /* try to free up if necceary and if evictions are permitted. Note - * that if evictions are enabled, we will call H5C__make_space_in_cache() - * regardless if the min_free_space requirement is not met. - */ - if ((cache_ptr->evictions_enabled) && - (((cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) || - ((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size))) { - - size_t space_needed; - - if (empty_space <= entry_ptr->size) - cache_ptr->cache_full = TRUE; - - if (cache_ptr->check_write_permitted != NULL) { - if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 1") - else - have_write_permitted = TRUE; - } /* end if */ - else { - write_permitted = cache_ptr->write_permitted; - have_write_permitted = TRUE; - } /* end else */ - - HDassert(entry_ptr->size <= H5C_MAX_ENTRY_SIZE); - space_needed = entry_ptr->size; - if (space_needed > cache_ptr->max_cache_size) - space_needed = cache_ptr->max_cache_size; - - /* Note that space_needed is just the amount of space that - * needed to insert the new entry without exceeding the cache - * size limit. The subsequent call to H5C__make_space_in_cache() - * may evict the entries required to free more or less space - * depending on conditions. It MAY be less if the cache is - * currently undersized, or more if the cache is oversized. - * - * The cache can exceed its maximum size limit via the following - * mechanisms: - * - * First, it is possible for the cache to grow without - * bound as long as entries are protected and not unprotected. - * - * Second, when writes are not permitted it is also possible - * for the cache to grow without bound. - * - * Third, the user may choose to disable evictions -- causing - * the cache to grow without bound until evictions are - * re-enabled. - * - * Finally, we usually don't check to see if the cache is - * oversized at the end of an unprotect. As a result, it is - * possible to have a vastly oversized cache with no protected - * entries as long as all the protects precede the unprotects. - * - * Since items 1, 2, and 3 are not changing any time soon, I - * see no point in worrying about the fourth. - */ - - if (H5C__make_space_in_cache(f, space_needed, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__make_space_in_cache failed") - } /* end if */ - - /* Insert the entry in the hash table. It can't be dirty yet, so - * we don't even check to see if it should go in the skip list. - * - * This is no longer true -- due to a bug fix, we may modify - * data on load to repair a file. - * - * ******************************************* - * - * Set the flush_last field - * of the newly loaded entry before inserting it into the - * index. Must do this, as the index tracked the number of - * entries with the flush_last field set, but assumes that - * the field will not change after insertion into the index. - * - * Note that this means that the H5C__FLUSH_LAST_FLAG flag - * is ignored if the entry is already in cache. + /* set cache_ptr->slist_enabled to TRUE so that the slist + * maintenance macros will be enabled. */ - entry_ptr->flush_me_last = flush_last; - - H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, NULL) - - if ((entry_ptr->is_dirty) && (!(entry_ptr->in_slist))) { + cache_ptr->slist_enabled = TRUE; - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, NULL) + /* scan the index list and insert all dirty entries in the slist */ + entry_ptr = cache_ptr->il_head; + while (entry_ptr != NULL) { + if (entry_ptr->is_dirty) + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + entry_ptr = entry_ptr->il_next; } - /* insert the entry in the data structures used by the replacement - * policy. We are just going to take it out again when we update - * the replacement policy for a protect, but this simplifies the - * code. If we do this often enough, we may want to optimize this. + /* we don't maintain a dirty index len, so we can't do a cross + * check against it. Note that there is no point in cross checking + * against the dirty LRU size, as the dirty LRU may not be maintained, + * and in any case, there is no requirement that all dirty entries + * will reside on the dirty LRU. */ - H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, NULL) - - /* Record that the entry was loaded, to trigger a notify callback later */ - /* (After the entry is fully added to the cache) */ - was_loaded = TRUE; - } /* end else */ - - HDassert(entry_ptr->addr == addr); - HDassert(entry_ptr->type == type); - - if (entry_ptr->is_protected) { - if (read_only && entry_ptr->is_read_only) { - HDassert(entry_ptr->ro_ref_count > 0); - (entry_ptr->ro_ref_count)++; - } /* end if */ - else - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Target already protected & not read only?!?") - } /* end if */ - else { - H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, NULL) - - entry_ptr->is_protected = TRUE; - - if (read_only) { - entry_ptr->is_read_only = TRUE; - entry_ptr->ro_ref_count = 1; - } /* end if */ - - entry_ptr->dirtied = FALSE; - } /* end else */ - - H5C__UPDATE_CACHE_HIT_RATE_STATS(cache_ptr, hit) - - H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit) - - ret_value = thing; - - if ((cache_ptr->evictions_enabled) && - ((cache_ptr->size_decreased) || - ((cache_ptr->resize_enabled) && - (cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length)))) { - - if (!have_write_permitted) { - - if (cache_ptr->check_write_permitted != NULL) { - if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted") - else - have_write_permitted = TRUE; - } - else { - - write_permitted = cache_ptr->write_permitted; - - have_write_permitted = TRUE; - } - } - - if (cache_ptr->resize_enabled && - (cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length)) { - - if (H5C__auto_adjust_cache_size(f, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Cache auto-resize failed") - } /* end if */ - - if (cache_ptr->size_decreased) { - cache_ptr->size_decreased = FALSE; - - /* check to see if the cache is now oversized due to the cache - * size reduction. If it is, try to evict enough entries to - * bring the cache size down to the current maximum cache size. - * - * Also, if the min_clean_size requirement is not met, we - * should also call H5C__make_space_in_cache() to bring us - * into compliance. - */ - - if (cache_ptr->index_size >= cache_ptr->max_cache_size) - empty_space = 0; - else - empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - - if ((cache_ptr->index_size > cache_ptr->max_cache_size) || - ((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size)) { - - if (cache_ptr->index_size > cache_ptr->max_cache_size) - cache_ptr->cache_full = TRUE; - - if (H5C__make_space_in_cache(f, (size_t)0, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__make_space_in_cache failed") - } - } /* end if */ + assert(cache_ptr->dirty_index_size == cache_ptr->slist_size); } - - /* If we loaded the entry and the entry's type has a 'notify' callback, send - * an 'after load' notice now that the entry is fully integrated into - * the cache and protected. We must wait until it is protected so it is not - * evicted during the notify callback. - */ - if (was_loaded) { - /* If the entry's type has a 'notify' callback send a 'after load' - * notice now that the entry is fully integrated into the cache. - */ - if (entry_ptr->type->notify && (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_LOAD, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, NULL, - "can't notify client about entry inserted into cache") - } /* end if */ - -#ifdef H5_HAVE_PARALLEL - /* Make sure the size of the collective entries in the cache remain in check */ - if (coll_access) { - if (H5P_USER_TRUE == H5F_COLL_MD_READ(f)) { - if (cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) - if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries") - } /* end if */ - else { - if (cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) - if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries") - } /* end else */ - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - -done: -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_protect() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C_reset_cache_hit_rate_stats() - * - * Purpose: Reset the cache hit rate computation fields. - * - * Return: SUCCEED on success, and FAIL on failure. - * - * Programmer: John Mainzer, 10/5/04 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_reset_cache_hit_rate_stats(H5C_t *cache_ptr) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry") - - cache_ptr->cache_hits = 0; - cache_ptr->cache_accesses = 0; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_reset_cache_hit_rate_stats() */ - -/*------------------------------------------------------------------------- - * Function: H5C_set_cache_auto_resize_config - * - * Purpose: Set the cache automatic resize configuration to the - * provided values if they are in range, and fail if they - * are not. - * - * If the new configuration enables automatic cache resizing, - * coerce the cache max size and min clean size into agreement - * with the new policy and re-set the full cache hit rate - * stats. - * - * Return: SUCCEED on success, and FAIL on failure. - * - * Programmer: John Mainzer - * 10/8/04 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_set_cache_auto_resize_config(H5C_t *cache_ptr, H5C_auto_size_ctl_t *config_ptr) -{ - size_t new_max_cache_size; - size_t new_min_clean_size; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry") - if (config_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry") - if (config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown config version") - - /* check general configuration section of the config: */ - if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_GENERAL) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in general configuration fields of new config") - - /* check size increase control fields of the config: */ - if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INCREMENT) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size increase control fields of new config") - - /* check size decrease control fields of the config: */ - if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_DECREMENT) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "error in the size decrease control fields of new config") - - /* check for conflicts between size increase and size decrease controls: */ - if (H5C_validate_resize_config(config_ptr, H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "conflicting threshold fields in new config") - - /* will set the increase possible fields to FALSE later if needed */ - cache_ptr->size_increase_possible = TRUE; - cache_ptr->flash_size_increase_possible = TRUE; - cache_ptr->size_decrease_possible = TRUE; - - switch (config_ptr->incr_mode) { - case H5C_incr__off: - cache_ptr->size_increase_possible = FALSE; - break; - - case H5C_incr__threshold: - if ((config_ptr->lower_hr_threshold <= 0.0) || (config_ptr->increment <= 1.0) || - ((config_ptr->apply_max_increment) && (config_ptr->max_increment <= 0))) - cache_ptr->size_increase_possible = FALSE; - break; - - default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown incr_mode?!?!?") - } /* end switch */ - - /* logically, this is were configuration for flash cache size increases - * should go. However, this configuration depends on max_cache_size, so - * we wait until the end of the function, when this field is set. - */ - - switch (config_ptr->decr_mode) { - case H5C_decr__off: - cache_ptr->size_decrease_possible = FALSE; - break; - - case H5C_decr__threshold: - if ((config_ptr->upper_hr_threshold >= 1.0) || (config_ptr->decrement >= 1.0) || - ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0))) - cache_ptr->size_decrease_possible = FALSE; - break; - - case H5C_decr__age_out: - if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) || - ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0))) - cache_ptr->size_decrease_possible = FALSE; - break; - - case H5C_decr__age_out_with_threshold: - if (((config_ptr->apply_empty_reserve) && (config_ptr->empty_reserve >= 1.0)) || - ((config_ptr->apply_max_decrement) && (config_ptr->max_decrement <= 0)) || - (config_ptr->upper_hr_threshold >= 1.0)) - cache_ptr->size_decrease_possible = FALSE; - break; - - default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown decr_mode?!?!?") - } /* end switch */ - - if (config_ptr->max_size == config_ptr->min_size) { - cache_ptr->size_increase_possible = FALSE; - cache_ptr->flash_size_increase_possible = FALSE; - cache_ptr->size_decrease_possible = FALSE; - } /* end if */ - - /* flash_size_increase_possible is intentionally omitted from the - * following: - */ - cache_ptr->resize_enabled = cache_ptr->size_increase_possible || cache_ptr->size_decrease_possible; - - cache_ptr->resize_ctl = *config_ptr; - - /* Resize the cache to the supplied initial value if requested, or as - * necessary to force it within the bounds of the current automatic - * cache resizing configuration. - * - * Note that the min_clean_fraction may have changed, so we - * go through the exercise even if the current size is within - * range and an initial size has not been provided. - */ - if (cache_ptr->resize_ctl.set_initial_size) - new_max_cache_size = cache_ptr->resize_ctl.initial_size; - else if (cache_ptr->max_cache_size > cache_ptr->resize_ctl.max_size) - new_max_cache_size = cache_ptr->resize_ctl.max_size; - else if (cache_ptr->max_cache_size < cache_ptr->resize_ctl.min_size) - new_max_cache_size = cache_ptr->resize_ctl.min_size; - else - new_max_cache_size = cache_ptr->max_cache_size; - - new_min_clean_size = (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction)); - - /* since new_min_clean_size is of type size_t, we have - * - * ( 0 <= new_min_clean_size ) - * - * by definition. - */ - HDassert(new_min_clean_size <= new_max_cache_size); - HDassert(cache_ptr->resize_ctl.min_size <= new_max_cache_size); - HDassert(new_max_cache_size <= cache_ptr->resize_ctl.max_size); - - if (new_max_cache_size < cache_ptr->max_cache_size) - cache_ptr->size_decreased = TRUE; - - cache_ptr->max_cache_size = new_max_cache_size; - cache_ptr->min_clean_size = new_min_clean_size; - - if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) - /* this should be impossible... */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed") - - /* remove excess epoch markers if any */ - if ((config_ptr->decr_mode == H5C_decr__age_out_with_threshold) || - (config_ptr->decr_mode == H5C_decr__age_out)) { - if (cache_ptr->epoch_markers_active > cache_ptr->resize_ctl.epochs_before_eviction) - if (H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers") - } /* end if */ - else if (cache_ptr->epoch_markers_active > 0) { - if (H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers") - } - - /* configure flash size increase facility. We wait until the - * end of the function, as we need the max_cache_size set before - * we start to keep things simple. - * - * If we haven't already ruled out flash cache size increases above, - * go ahead and configure it. - */ - - if (cache_ptr->flash_size_increase_possible) { - switch (config_ptr->flash_incr_mode) { - case H5C_flash_incr__off: - cache_ptr->flash_size_increase_possible = FALSE; - break; - - case H5C_flash_incr__add_space: - cache_ptr->flash_size_increase_possible = TRUE; - cache_ptr->flash_size_increase_threshold = - (size_t)(((double)(cache_ptr->max_cache_size)) * - ((cache_ptr->resize_ctl).flash_threshold)); - break; - - default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") - break; - } /* end switch */ - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_set_cache_auto_resize_config() */ - -/*------------------------------------------------------------------------- - * Function: H5C_set_evictions_enabled() - * - * Purpose: Set cache_ptr->evictions_enabled to the value of the - * evictions enabled parameter. - * - * Return: SUCCEED on success, and FAIL on failure. - * - * Programmer: John Mainzer - * 7/27/07 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry") - - /* There is no fundamental reason why we should not permit - * evictions to be disabled while automatic resize is enabled. - * However, I can't think of any good reason why one would - * want to, and allowing it would greatly complicate testing - * the feature. Hence the following: - */ - if ((evictions_enabled != TRUE) && ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) || - (cache_ptr->resize_ctl.decr_mode != H5C_decr__off))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled") - - cache_ptr->evictions_enabled = evictions_enabled; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_set_evictions_enabled() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C_set_slist_enabled() - * - * Purpose: Enable or disable the slist as directed. - * - * The slist (skip list) is an address ordered list of - * dirty entries in the metadata cache. However, this - * list is only needed during flush and close, where we - * use it to write entries in more or less increasing - * address order. - * - * This function sets up and enables further operations - * on the slist, or disable the slist. This in turn - * allows us to avoid the overhead of maintaining the - * slist when it is not needed. - * - * - * If the slist_enabled parameter is TRUE, the function - * - * 1) Verifies that the slist is empty. - * - * 2) Scans the index list, and inserts all dirty entries - * into the slist. - * - * 3) Sets cache_ptr->slist_enabled = TRUE. - * - * Note that the clear_slist parameter is ignored if - * the slist_enabed parameter is TRUE. - * - * - * If the slist_enabled_parameter is FALSE, the function - * shuts down the slist. - * - * Normally the slist will be empty at this point, however - * that need not be the case if H5C_flush_cache() has been - * called with the H5C__FLUSH_MARKED_ENTRIES_FLAG. - * - * Thus shutdown proceeds as follows: - * - * 1) Test to see if the slist is empty. If it is, proceed - * to step 3. - * - * 2) Test to see if the clear_slist parameter is TRUE. - * - * If it is, remove all entries from the slist. - * - * If it isn't, throw an error. - * - * 3) set cache_ptr->slist_enabled = FALSE. - * - * Return: SUCCEED on success, and FAIL on failure. - * - * Programmer: John Mainzer - * 5/1/20 - * - * Modifications: - * - * None. - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_set_slist_enabled(H5C_t *cache_ptr, hbool_t slist_enabled, hbool_t clear_slist) -{ - H5C_cache_entry_t *entry_ptr; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry") - -#if H5C__SLIST_OPT_ENABLED - - if (slist_enabled) { - - if (cache_ptr->slist_enabled) { - - HDassert(FALSE); - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already enabled?") - } + else { /* take down the skip list */ + if (!cache_ptr->slist_enabled) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already disabled?"); if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)) { - - HDassert(FALSE); - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty (1)?") - } - - /* set cache_ptr->slist_enabled to TRUE so that the slist - * maintenance macros will be enabled. - */ - cache_ptr->slist_enabled = TRUE; - - /* scan the index list and insert all dirty entries in the slist */ - entry_ptr = cache_ptr->il_head; - - while (entry_ptr != NULL) { - - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - - if (entry_ptr->is_dirty) { - - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) - } - - entry_ptr = entry_ptr->il_next; - } - - /* we don't maintain a dirty index len, so we can't do a cross - * check against it. Note that there is no point in cross checking - * against the dirty LRU size, as the dirty LRU may not be maintained, - * and in any case, there is no requirement that all dirty entries - * will reside on the dirty LRU. - */ - HDassert(cache_ptr->dirty_index_size == cache_ptr->slist_size); - } - else { /* take down the skip list */ - - if (!cache_ptr->slist_enabled) { - - HDassert(FALSE); - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist already disabled?") - } - - if ((cache_ptr->slist_len != 0) || (cache_ptr->slist_size != 0)) { - if (clear_slist) { + H5SL_node_t *node_ptr; - H5SL_node_t *node_ptr; - - node_ptr = H5SL_first(cache_ptr->slist_ptr); - - while (node_ptr != NULL) { - - entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE); - - node_ptr = H5SL_first(cache_ptr->slist_ptr); - } - } - else { - - HDassert(FALSE); - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty (2)?") - } - } - - cache_ptr->slist_enabled = FALSE; - - HDassert(0 == cache_ptr->slist_len); - HDassert(0 == cache_ptr->slist_size); - } - -#else /* H5C__SLIST_OPT_ENABLED is FALSE */ - - HDassert(cache_ptr->slist_enabled); - -#endif /* H5C__SLIST_OPT_ENABLED is FALSE */ - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_set_slist_enabled() */ - -/*------------------------------------------------------------------------- - * Function: H5C_unpin_entry() - * - * Purpose: Unpin a cache entry. The entry can be either protected or - * unprotected at the time of call, but must be pinned. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 3/22/06 - * - * Changes: Added extreme sanity checks on entry and exit. - * JRM -- 4/26/14 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_unpin_entry(void *_entry_ptr) -{ - H5C_t *cache_ptr; - H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_entry_ptr; /* Pointer to entry to unpin */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity check */ - HDassert(entry_ptr); - cache_ptr = entry_ptr->cache_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - /* Unpin the entry */ - if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry from client") - -done: -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_unpin_entry() */ - -/*------------------------------------------------------------------------- - * Function: H5C_unprotect - * - * Purpose: Undo an H5C_protect() call -- specifically, mark the - * entry as unprotected, remove it from the protected list, - * and give it back to the replacement policy. - * - * The TYPE and ADDR arguments must be the same as those in - * the corresponding call to H5C_protect() and the THING - * argument must be the value returned by that call to - * H5C_protect(). - * - * Return: Non-negative on success/Negative on failure - * - * If the deleted flag is TRUE, simply remove the target entry - * from the cache, clear it, and free it without writing it to - * disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 6/2/04 - * - * Modifications: - * - * JRM -- 7/21/04 - * Updated for the addition of the hash table. - * - * JRM -- 10/28/04 - * Added code to set cache_full to TRUE whenever we try to - * make space in the cache. - * - * JRM -- 11/12/04 - * Added code to call to H5C_make_space_in_cache() after the - * call to H5C__auto_adjust_cache_size() if that function - * sets the size_decreased flag is TRUE. - * - * JRM -- 4/25/05 - * The size_decreased flag can also be set to TRUE in - * H5C_set_cache_auto_resize_config() if a new configuration - * forces an immediate reduction in cache size. Modified - * the code to deal with this eventuallity. - * - * JRM -- 6/24/05 - * Added support for the new write_permitted field of H5C_t. - * - * JRM -- 10/22/05 - * Hand optimizations. - * - * JRM -- 5/3/06 - * Added code to set the new dirtied field in - * H5C_cache_entry_t to FALSE prior to return. - * - * JRM -- 6/23/06 - * Modified code to allow dirty entries to be loaded from - * disk. This is necessary as a bug fix in the object - * header code requires us to modify a header as it is read. - * - * JRM -- 3/28/07 - * Added the flags parameter and supporting code. At least - * for now, this parameter is used to allow the entry to - * be protected read only, thus allowing multiple protects. - * - * Also added code to allow multiple read only protects - * of cache entries. - * - * JRM -- 7/27/07 - * Added code supporting the new evictions_enabled field - * in H5C_t. - * - * JRM -- 1/3/08 - * Added to do a flash cache size increase if appropriate - * when a large entry is loaded. - * - * JRM -- 11/13/08 - * Modified function to call H5C_make_space_in_cache() when - * the min_clean_size is violated, not just when there isn't - * enough space for and entry that has just been loaded. - * - * The purpose of this modification is to avoid "metadata - * blizzards" in the write only case. In such instances, - * the cache was allowed to fill with dirty metadata. When - * we finally needed to evict an entry to make space, we had - * to flush out a whole cache full of metadata -- which has - * interesting performance effects. We hope to avoid (or - * perhaps more accurately hide) this effect by maintaining - * the min_clean_size, which should force us to start flushing - * entries long before we actually have to evict something - * to make space. - * - * - * Missing entries? - * - * - * JRM -- 5/8/20 - * Updated for the possibility that the slist will be - * disabled. - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) -{ - H5C_t *cache_ptr; - hbool_t deleted; - hbool_t dirtied; - hbool_t set_flush_marker; - hbool_t pin_entry; - hbool_t unpin_entry; - hbool_t free_file_space; - hbool_t take_ownership; - hbool_t was_clean; -#ifdef H5_HAVE_PARALLEL - hbool_t clear_entry = FALSE; -#endif /* H5_HAVE_PARALLEL */ - H5C_cache_entry_t *entry_ptr; - H5C_cache_entry_t *test_entry_ptr; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - deleted = ((flags & H5C__DELETED_FLAG) != 0); - dirtied = ((flags & H5C__DIRTIED_FLAG) != 0); - set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0); - pin_entry = ((flags & H5C__PIN_ENTRY_FLAG) != 0); - unpin_entry = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0); - free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); - take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); - - HDassert(f); - HDassert(f->shared); - - cache_ptr = f->shared->cache; - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(H5F_addr_defined(addr)); - HDassert(thing); - HDassert(!(pin_entry && unpin_entry)); - - /* deleted flag must accompany free_file_space */ - HDassert((!free_file_space) || (deleted)); - - /* deleted flag must accompany take_ownership */ - HDassert((!take_ownership) || (deleted)); - - /* can't have both free_file_space & take_ownership */ - HDassert(!(free_file_space && take_ownership)); - - entry_ptr = (H5C_cache_entry_t *)thing; - - HDassert(entry_ptr->addr == addr); - - /* also set the dirtied variable if the dirtied field is set in - * the entry. - */ - dirtied |= entry_ptr->dirtied; - was_clean = !(entry_ptr->is_dirty); - -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - /* if the entry has multiple read only protects, just decrement - * the ro_ref_counter. Don't actually unprotect until the ref count - * drops to zero. - */ - if (entry_ptr->ro_ref_count > 1) { - - /* Sanity check */ - HDassert(entry_ptr->is_protected); - HDassert(entry_ptr->is_read_only); - - if (dirtied) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??") - - /* Reduce the RO ref count */ - (entry_ptr->ro_ref_count)--; - - /* Pin or unpin the entry as requested. */ - if (pin_entry) { - - /* Pin the entry from a client */ - if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") - } - else if (unpin_entry) { - - /* Unpin the entry from a client */ - if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client") - - } /* end if */ - } - else { - - if (entry_ptr->is_read_only) { - - /* Sanity check */ - HDassert(entry_ptr->ro_ref_count == 1); - - if (dirtied) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??") - - entry_ptr->is_read_only = FALSE; - entry_ptr->ro_ref_count = 0; - - } /* end if */ - -#ifdef H5_HAVE_PARALLEL - /* When the H5C code is used to implement the metadata cache in the - * PHDF5 case, only the cache on process 0 is allowed to write to file. - * All the other metadata caches must hold dirty entries until they - * are told that the entries are clean. - * - * The clear_on_unprotect flag in the H5C_cache_entry_t structure - * exists to deal with the case in which an entry is protected when - * its cache receives word that the entry is now clean. In this case, - * the clear_on_unprotect flag is set, and the entry is flushed with - * the H5C__FLUSH_CLEAR_ONLY_FLAG. - * - * All this is a bit awkward, but until the metadata cache entries - * are contiguous, with only one dirty flag, we have to let the supplied - * functions deal with the resetting the is_dirty flag. - */ - if (entry_ptr->clear_on_unprotect) { - /* Sanity check */ - HDassert(entry_ptr->is_dirty); - - entry_ptr->clear_on_unprotect = FALSE; - if (!dirtied) - clear_entry = TRUE; - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - - if (!entry_ptr->is_protected) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Entry already unprotected??") - - /* Mark the entry as dirty if appropriate */ - entry_ptr->is_dirty = (entry_ptr->is_dirty || dirtied); - - if (dirtied) { - - if (entry_ptr->image_up_to_date) { - - entry_ptr->image_up_to_date = FALSE; - - if (entry_ptr->flush_dep_nparents > 0) { - - if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "Can't propagate serialization status to fd parents") - - } /* end if */ - } /* end if */ - } /* end if */ - - /* Check for newly dirtied entry */ - if (was_clean && entry_ptr->is_dirty) { - - /* Update index for newly dirtied entry */ - H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr) - - /* If the entry's type has a 'notify' callback send a - * 'entry dirtied' notice now that the entry is fully - * integrated into the cache. - */ - if ((entry_ptr->type->notify) && - ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0)) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry dirty flag set") - - /* Propagate the flush dep dirty flag up the flush dependency chain - * if appropriate - */ - if (entry_ptr->flush_dep_nparents > 0) { - - if (H5C__mark_flush_dep_dirty(entry_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") - } - } /* end if */ - /* Check for newly clean entry */ - else if (!was_clean && !entry_ptr->is_dirty) { - - /* If the entry's type has a 'notify' callback send a - * 'entry cleaned' notice now that the entry is fully - * integrated into the cache. - */ - if ((entry_ptr->type->notify) && - ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0)) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify client about entry dirty flag cleared") - - /* Propagate the flush dep clean flag up the flush dependency chain - * if appropriate - */ - if (entry_ptr->flush_dep_nparents > 0) { - - if (H5C__mark_flush_dep_clean(entry_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag") - } - } /* end else-if */ - - /* Pin or unpin the entry as requested. */ - if (pin_entry) { - - /* Pin the entry from a client */ - if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client") - } - else if (unpin_entry) { - - /* Unpin the entry from a client */ - if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client") - } /* end if */ - - /* H5C__UPDATE_RP_FOR_UNPROTECT will place the unprotected entry on - * the pinned entry list if entry_ptr->is_pinned is TRUE. - */ - H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, FAIL) - - entry_ptr->is_protected = FALSE; - - /* if the entry is dirty, 'or' its flush_marker with the set flush flag, - * and then add it to the skip list if it isn't there already. - */ - if (entry_ptr->is_dirty) { - - entry_ptr->flush_marker |= set_flush_marker; - - if (!entry_ptr->in_slist) { - - /* this is a no-op if cache_ptr->slist_enabled is FALSE */ - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) - } - } /* end if */ - - /* this implementation of the "deleted" option is a bit inefficient, as - * we re-insert the entry to be deleted into the replacement policy - * data structures, only to remove them again. Depending on how often - * we do this, we may want to optimize a bit. - * - * On the other hand, this implementation is reasonably clean, and - * makes good use of existing code. - * JRM - 5/19/04 - */ - if (deleted) { - - unsigned flush_flags = (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_INVALIDATE_FLAG); - - /* verify that the target entry is in the cache. */ - H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) - - if (test_entry_ptr == NULL) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?") - - else if (test_entry_ptr != entry_ptr) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, - "hash table contains multiple entries for addr?!?") - - /* Set the 'free file space' flag for the flush, if needed */ - if (free_file_space) { - - flush_flags |= H5C__FREE_FILE_SPACE_FLAG; - } - - /* Set the "take ownership" flag for the flush, if needed */ - if (take_ownership) { - - flush_flags |= H5C__TAKE_OWNERSHIP_FLAG; - } - - /* Delete the entry from the skip list on destroy */ - flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; - - HDassert((!cache_ptr->slist_enabled) || (((!was_clean) || dirtied) == (entry_ptr->in_slist))); - - if (H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't flush entry") - - } /* end if */ -#ifdef H5_HAVE_PARALLEL - else if (clear_entry) { - - /* verify that the target entry is in the cache. */ - H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL) - - if (test_entry_ptr == NULL) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?") - - else if (test_entry_ptr != entry_ptr) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, - "hash table contains multiple entries for addr?!?") - - if (H5C__flush_single_entry(f, entry_ptr, - H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't clear entry") - - } /* end else if */ -#endif /* H5_HAVE_PARALLEL */ - } - - H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr) - -done: - -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - - HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C_unprotect() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C_unsettle_entry_ring - * - * Purpose: Advise the metadata cache that the specified entry's free space - * manager ring is no longer settled (if it was on entry). - * - * If the target free space manager ring is already - * unsettled, do nothing, and return SUCCEED. - * - * If the target free space manager ring is settled, and - * we are not in the process of a file shutdown, mark - * the ring as unsettled, and return SUCCEED. - * - * If the target free space manager is settled, and we - * are in the process of a file shutdown, post an error - * message, and return FAIL. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * January 3, 2017 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_unsettle_entry_ring(void *_entry) -{ - H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry whose ring to unsettle */ - H5C_t *cache; /* Cache for file */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(entry); - HDassert(entry->ring != H5C_RING_UNDEFINED); - HDassert((H5C_RING_USER == entry->ring) || (H5C_RING_RDFSM == entry->ring) || - (H5C_RING_MDFSM == entry->ring)); - cache = entry->cache_ptr; - HDassert(cache); - HDassert(cache->magic == H5C__H5C_T_MAGIC); - - switch (entry->ring) { - case H5C_RING_USER: - /* Do nothing */ - break; - - case H5C_RING_RDFSM: - if (cache->rdfsm_settled) { - if (cache->flush_in_progress || cache->close_warning_received) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle") - cache->rdfsm_settled = FALSE; - } /* end if */ - break; - - case H5C_RING_MDFSM: - if (cache->mdfsm_settled) { - if (cache->flush_in_progress || cache->close_warning_received) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle") - cache->mdfsm_settled = FALSE; - } /* end if */ - break; - - default: - HDassert(FALSE); /* this should be un-reachable */ - break; - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_unsettle_entry_ring() */ - -/*------------------------------------------------------------------------- - * Function: H5C_unsettle_ring() - * - * Purpose: Advise the metadata cache that the specified free space - * manager ring is no longer settled (if it was on entry). - * - * If the target free space manager ring is already - * unsettled, do nothing, and return SUCCEED. - * - * If the target free space manager ring is settled, and - * we are not in the process of a file shutdown, mark - * the ring as unsettled, and return SUCCEED. - * - * If the target free space manager is settled, and we - * are in the process of a file shutdown, post an error - * message, and return FAIL. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 10/15/16 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_unsettle_ring(H5F_t *f, H5C_ring_t ring) -{ - H5C_t *cache_ptr; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - HDassert((H5C_RING_RDFSM == ring) || (H5C_RING_MDFSM == ring)); - cache_ptr = f->shared->cache; - HDassert(H5C__H5C_T_MAGIC == cache_ptr->magic); - - switch (ring) { - case H5C_RING_RDFSM: - if (cache_ptr->rdfsm_settled) { - if (cache_ptr->close_warning_received) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle") - cache_ptr->rdfsm_settled = FALSE; - } /* end if */ - break; - - case H5C_RING_MDFSM: - if (cache_ptr->mdfsm_settled) { - if (cache_ptr->close_warning_received) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle") - cache_ptr->mdfsm_settled = FALSE; - } /* end if */ - break; - - default: - HDassert(FALSE); /* this should be un-reachable */ - break; - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_unsettle_ring() */ - -/*------------------------------------------------------------------------- - * Function: H5C_validate_resize_config() - * - * Purpose: Run a sanity check on the specified sections of the - * provided instance of struct H5C_auto_size_ctl_t. - * - * Do nothing and return SUCCEED if no errors are detected, - * and flag an error and return FAIL otherwise. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 3/23/05 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if (config_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry") - - if (config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version") - - if ((tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0) { - - if (config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big") - - if (config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small") - - if (config_ptr->min_size > config_ptr->max_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size") - - if (config_ptr->set_initial_size && ((config_ptr->initial_size < config_ptr->min_size) || - (config_ptr->initial_size > config_ptr->max_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "initial_size must be in the interval [min_size, max_size]") - - if ((config_ptr->min_clean_fraction < 0.0) || (config_ptr->min_clean_fraction > 1.0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_clean_fraction must be in the interval [0.0, 1.0]") - - if (config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small") - - if (config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big") - } /* H5C_RESIZE_CFG__VALIDATE_GENERAL */ - - if ((tests & H5C_RESIZE_CFG__VALIDATE_INCREMENT) != 0) { - if ((config_ptr->incr_mode != H5C_incr__off) && (config_ptr->incr_mode != H5C_incr__threshold)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode") - - if (config_ptr->incr_mode == H5C_incr__threshold) { - if ((config_ptr->lower_hr_threshold < 0.0) || (config_ptr->lower_hr_threshold > 1.0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "lower_hr_threshold must be in the range [0.0, 1.0]") - - if (config_ptr->increment < 1.0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0") - - /* no need to check max_increment, as it is a size_t, - * and thus must be non-negative. - */ - } /* H5C_incr__threshold */ - - switch (config_ptr->flash_incr_mode) { - case H5C_flash_incr__off: - /* nothing to do here */ - break; - - case H5C_flash_incr__add_space: - if ((config_ptr->flash_multiple < 0.1) || (config_ptr->flash_multiple > 10.0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "flash_multiple must be in the range [0.1, 10.0]") - if ((config_ptr->flash_threshold < 0.1) || (config_ptr->flash_threshold > 1.0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "flash_threshold must be in the range [0.1, 1.0]") - break; - - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid flash_incr_mode") - break; - } /* end switch */ - } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */ - - if ((tests & H5C_RESIZE_CFG__VALIDATE_DECREMENT) != 0) { - - if ((config_ptr->decr_mode != H5C_decr__off) && (config_ptr->decr_mode != H5C_decr__threshold) && - (config_ptr->decr_mode != H5C_decr__age_out) && - (config_ptr->decr_mode != H5C_decr__age_out_with_threshold)) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid decr_mode") - } - - if (config_ptr->decr_mode == H5C_decr__threshold) { - if (config_ptr->upper_hr_threshold > 1.0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0") - - if ((config_ptr->decrement > 1.0) || (config_ptr->decrement < 0.0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]") - - /* no need to check max_decrement as it is a size_t - * and thus must be non-negative. - */ - } /* H5C_decr__threshold */ - - if ((config_ptr->decr_mode == H5C_decr__age_out) || - (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) { - - if (config_ptr->epochs_before_eviction < 1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction must be positive") - if (config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big") - - if ((config_ptr->apply_empty_reserve) && - ((config_ptr->empty_reserve > 1.0) || (config_ptr->empty_reserve < 0.0))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]") - - /* no need to check max_decrement as it is a size_t - * and thus must be non-negative. - */ - } /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */ - - if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) { - if ((config_ptr->upper_hr_threshold > 1.0) || (config_ptr->upper_hr_threshold < 0.0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "upper_hr_threshold must be in the interval [0.0, 1.0]") - } /* H5C_decr__age_out_with_threshold */ - } /* H5C_RESIZE_CFG__VALIDATE_DECREMENT */ - - if ((tests & H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) != 0) { - if ((config_ptr->incr_mode == H5C_incr__threshold) && - ((config_ptr->decr_mode == H5C_decr__threshold) || - (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) && - (config_ptr->lower_hr_threshold >= config_ptr->upper_hr_threshold)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conflicting threshold fields in config") - } /* H5C_RESIZE_CFG__VALIDATE_INTERACTIONS */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_validate_resize_config() */ - -/*------------------------------------------------------------------------- - * Function: H5C_create_flush_dependency() - * - * Purpose: Initiates a parent<->child entry flush dependency. The parent - * entry must be pinned or protected at the time of call, and must - * have all dependencies removed before the cache can shut down. - * - * Note: Flush dependencies in the cache indicate that a child entry - * must be flushed to the file before its parent. (This is - * currently used to implement Single-Writer/Multiple-Reader (SWMR) - * I/O access for data structures in the file). - * - * Creating a flush dependency between two entries will also pin - * the parent entry. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 3/05/09 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_create_flush_dependency(void *parent_thing, void *child_thing) -{ - H5C_t *cache_ptr; - H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */ - H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(parent_entry); - HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(H5F_addr_defined(parent_entry->addr)); - HDassert(child_entry); - HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(H5F_addr_defined(child_entry->addr)); - cache_ptr = parent_entry->cache_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr == child_entry->cache_ptr); -#ifndef NDEBUG - /* Make sure the parent is not already a parent */ - { - unsigned u; - - for (u = 0; u < child_entry->flush_dep_nparents; u++) - HDassert(child_entry->flush_dep_parent[u] != parent_entry); - } /* end block */ -#endif /* NDEBUG */ - - /* More sanity checks */ - if (child_entry == parent_entry) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry flush dependency parent can't be itself") - if (!(parent_entry->is_protected || parent_entry->is_pinned)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected") - - /* Check for parent not pinned */ - if (!parent_entry->is_pinned) { - /* Sanity check */ - HDassert(parent_entry->flush_dep_nchildren == 0); - HDassert(!parent_entry->pinned_from_client); - HDassert(!parent_entry->pinned_from_cache); - - /* Pin the parent entry */ - parent_entry->is_pinned = TRUE; - H5C__UPDATE_STATS_FOR_PIN(cache_ptr, parent_entry) - } /* end else */ - - /* Mark the entry as pinned from the cache's action (possibly redundantly) */ - parent_entry->pinned_from_cache = TRUE; - - /* Check if we need to resize the child's parent array */ - if (child_entry->flush_dep_nparents >= child_entry->flush_dep_parent_nalloc) { - if (child_entry->flush_dep_parent_nalloc == 0) { - /* Array does not exist yet, allocate it */ - HDassert(!child_entry->flush_dep_parent); - - if (NULL == (child_entry->flush_dep_parent = - H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for flush dependency parent list") - child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT; - } /* end if */ - else { - /* Resize existing array */ - HDassert(child_entry->flush_dep_parent); - - if (NULL == (child_entry->flush_dep_parent = - H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, - 2 * child_entry->flush_dep_parent_nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for flush dependency parent list") - child_entry->flush_dep_parent_nalloc *= 2; - } /* end else */ - cache_ptr->entry_fd_height_change_counter++; - } /* end if */ - - /* Add the dependency to the child's parent array */ - child_entry->flush_dep_parent[child_entry->flush_dep_nparents] = parent_entry; - child_entry->flush_dep_nparents++; - - /* Increment parent's number of children */ - parent_entry->flush_dep_nchildren++; - - /* Adjust the number of dirty children */ - if (child_entry->is_dirty) { - /* Sanity check */ - HDassert(parent_entry->flush_dep_ndirty_children < parent_entry->flush_dep_nchildren); - - parent_entry->flush_dep_ndirty_children++; - - /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */ - if (parent_entry->type->notify && - (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, parent_entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry dirty flag set") - } /* end if */ - - /* adjust the parent's number of unserialized children. Note - * that it is possible for and entry to be clean and unserialized. - */ - if (!child_entry->image_up_to_date) { - HDassert(parent_entry->flush_dep_nunser_children < parent_entry->flush_dep_nchildren); - - parent_entry->flush_dep_nunser_children++; - - /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */ - if (parent_entry->type->notify && - (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, parent_entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry serialized flag reset") - } /* end if */ - - /* Post-conditions, for successful operation */ - HDassert(parent_entry->is_pinned); - HDassert(parent_entry->flush_dep_nchildren > 0); - HDassert(child_entry->flush_dep_parent); - HDassert(child_entry->flush_dep_nparents > 0); - HDassert(child_entry->flush_dep_parent_nalloc > 0); -#ifndef NDEBUG - H5C__assert_flush_dep_nocycle(parent_entry, child_entry); -#endif /* NDEBUG */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_create_flush_dependency() */ - -/*------------------------------------------------------------------------- - * Function: H5C_destroy_flush_dependency() - * - * Purpose: Terminates a parent<-> child entry flush dependency. The - * parent entry must be pinned. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 3/05/09 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_destroy_flush_dependency(void *parent_thing, void *child_thing) -{ - H5C_t *cache_ptr; - H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */ - H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Sanity checks */ - HDassert(parent_entry); - HDassert(parent_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(H5F_addr_defined(parent_entry->addr)); - HDassert(child_entry); - HDassert(child_entry->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(H5F_addr_defined(child_entry->addr)); - cache_ptr = parent_entry->cache_ptr; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr == child_entry->cache_ptr); - - /* Usage checks */ - if (!parent_entry->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't pinned") - if (NULL == child_entry->flush_dep_parent) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, - "Child entry doesn't have a flush dependency parent array") - if (0 == parent_entry->flush_dep_nchildren) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, - "Parent entry flush dependency ref. count has no child dependencies") - - /* Search for parent in child's parent array. This is a linear search - * because we do not expect large numbers of parents. If this changes, we - * may wish to change the parent array to a skip list */ - for (u = 0; u < child_entry->flush_dep_nparents; u++) - if (child_entry->flush_dep_parent[u] == parent_entry) - break; - if (u == child_entry->flush_dep_nparents) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, - "Parent entry isn't a flush dependency parent for child entry") - - /* Remove parent entry from child's parent array */ - if (u < (child_entry->flush_dep_nparents - 1)) - HDmemmove(&child_entry->flush_dep_parent[u], &child_entry->flush_dep_parent[u + 1], - (child_entry->flush_dep_nparents - u - 1) * sizeof(child_entry->flush_dep_parent[0])); - child_entry->flush_dep_nparents--; - - /* Adjust parent entry's nchildren and unpin parent if it goes to zero */ - parent_entry->flush_dep_nchildren--; - if (0 == parent_entry->flush_dep_nchildren) { - /* Sanity check */ - HDassert(parent_entry->pinned_from_cache); - - /* Check if we should unpin parent entry now */ - if (!parent_entry->pinned_from_client) - if (H5C__unpin_entry_real(cache_ptr, parent_entry, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry") - - /* Mark the entry as unpinned from the cache's action */ - parent_entry->pinned_from_cache = FALSE; - } /* end if */ - - /* Adjust parent entry's ndirty_children */ - if (child_entry->is_dirty) { - /* Sanity check */ - HDassert(parent_entry->flush_dep_ndirty_children > 0); - - parent_entry->flush_dep_ndirty_children--; - - /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */ - if (parent_entry->type->notify && - (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, parent_entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry dirty flag reset") - } /* end if */ - - /* adjust parent entry's number of unserialized children */ - if (!child_entry->image_up_to_date) { - HDassert(parent_entry->flush_dep_nunser_children > 0); - - parent_entry->flush_dep_nunser_children--; - - /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */ - if (parent_entry->type->notify && - (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, parent_entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry serialized flag set") - } /* end if */ - - /* Shrink or free the parent array if appropriate */ - if (child_entry->flush_dep_nparents == 0) { - child_entry->flush_dep_parent = H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent); - child_entry->flush_dep_parent_nalloc = 0; - } /* end if */ - else if (child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT && - child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) { - if (NULL == (child_entry->flush_dep_parent = - H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, - child_entry->flush_dep_parent_nalloc / 4))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for flush dependency parent list") - child_entry->flush_dep_parent_nalloc /= 4; - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_destroy_flush_dependency() */ - -/*************************************************************************/ -/**************************** Private Functions: *************************/ -/*************************************************************************/ - -/*------------------------------------------------------------------------- - * Function: H5C__pin_entry_from_client() - * - * Purpose: Internal routine to pin a cache entry from a client action. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 3/26/09 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__pin_entry_from_client(H5C_t -#if !H5C_COLLECT_CACHE_STATS - H5_ATTR_UNUSED -#endif - *cache_ptr, - H5C_cache_entry_t *entry_ptr) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(cache_ptr); - HDassert(entry_ptr); - HDassert(entry_ptr->is_protected); - - /* Check if the entry is already pinned */ - if (entry_ptr->is_pinned) { - /* Check if the entry was pinned through an explicit pin from a client */ - if (entry_ptr->pinned_from_client) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "entry is already pinned") - } /* end if */ - else { - entry_ptr->is_pinned = TRUE; - - H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr) - } /* end else */ - - /* Mark that the entry was pinned through an explicit pin from a client */ - entry_ptr->pinned_from_client = TRUE; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__pin_entry_from_client() */ - -/*------------------------------------------------------------------------- - * Function: H5C__unpin_entry_real() - * - * Purpose: Internal routine to unpin a cache entry. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 1/6/18 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp) -{ - herr_t ret_value = SUCCEED; /* Return value */ - -#if H5C_DO_SANITY_CHECKS - FUNC_ENTER_PACKAGE -#else - FUNC_ENTER_PACKAGE_NOERR -#endif - - /* Sanity checking */ - HDassert(cache_ptr); - HDassert(entry_ptr); - HDassert(entry_ptr->is_pinned); - - /* If requested, update the replacement policy if the entry is not protected */ - if (update_rp && !entry_ptr->is_protected) - H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, FAIL) - - /* Unpin the entry now */ - entry_ptr->is_pinned = FALSE; - - /* Update the stats for an unpin operation */ - H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr) - -#if H5C_DO_SANITY_CHECKS -done: -#endif - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__unpin_entry_real() */ - -/*------------------------------------------------------------------------- - * Function: H5C__unpin_entry_from_client() - * - * Purpose: Internal routine to unpin a cache entry from a client action. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * 3/24/09 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__unpin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp) -{ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checking */ - HDassert(cache_ptr); - HDassert(entry_ptr); - - /* Error checking (should be sanity checks?) */ - if (!entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry isn't pinned") - if (!entry_ptr->pinned_from_client) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry wasn't pinned by cache client") - - /* Check if the entry is not pinned from a flush dependency */ - if (!entry_ptr->pinned_from_cache) - if (H5C__unpin_entry_real(cache_ptr, entry_ptr, update_rp) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry") - - /* Mark the entry as explicitly unpinned by the client */ - entry_ptr->pinned_from_client = FALSE; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__unpin_entry_from_client() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__auto_adjust_cache_size - * - * Purpose: Obtain the current full cache hit rate, and compare it - * with the hit rate thresholds for modifying cache size. - * If one of the thresholds has been crossed, adjusts the - * size of the cache accordingly. - * - * The function then resets the full cache hit rate - * statistics, and exits. - * - * Return: Non-negative on success/Negative on failure or if there was - * an attempt to flush a protected item. - * - * - * Programmer: John Mainzer, 10/7/04 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted) -{ - H5C_t *cache_ptr = f->shared->cache; - hbool_t reentrant_call = FALSE; - hbool_t inserted_epoch_marker = FALSE; - size_t new_max_cache_size = 0; - size_t old_max_cache_size = 0; - size_t new_min_clean_size = 0; - size_t old_min_clean_size = 0; - double hit_rate; - enum H5C_resize_status status = in_spec; /* will change if needed */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->cache_accesses >= (cache_ptr->resize_ctl).epoch_length); - HDassert(0.0 <= (cache_ptr->resize_ctl).min_clean_fraction); - HDassert((cache_ptr->resize_ctl).min_clean_fraction <= 100.0); - - /* check to see if cache_ptr->resize_in_progress is TRUE. If it, this - * is a re-entrant call via a client callback called in the resize - * process. To avoid an infinite recursion, set reentrant_call to - * TRUE, and goto done. - */ - if (cache_ptr->resize_in_progress) { - reentrant_call = TRUE; - HGOTO_DONE(SUCCEED) - } /* end if */ - - cache_ptr->resize_in_progress = TRUE; - - if (!cache_ptr->resize_enabled) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Auto cache resize disabled") - - HDassert(((cache_ptr->resize_ctl).incr_mode != H5C_incr__off) || - ((cache_ptr->resize_ctl).decr_mode != H5C_decr__off)); - - if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate") - - HDassert((0.0 <= hit_rate) && (hit_rate <= 1.0)); - - switch ((cache_ptr->resize_ctl).incr_mode) { - case H5C_incr__off: - if (cache_ptr->size_increase_possible) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "size_increase_possible but H5C_incr__off?!?!?") - break; - - case H5C_incr__threshold: - if (hit_rate < (cache_ptr->resize_ctl).lower_hr_threshold) { - - if (!cache_ptr->size_increase_possible) { - - status = increase_disabled; - } - else if (cache_ptr->max_cache_size >= (cache_ptr->resize_ctl).max_size) { - - HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).max_size); - status = at_max_size; - } - else if (!cache_ptr->cache_full) { - - status = not_full; - } - else { - - new_max_cache_size = - (size_t)(((double)(cache_ptr->max_cache_size)) * (cache_ptr->resize_ctl).increment); - - /* clip to max size if necessary */ - if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) { - - new_max_cache_size = (cache_ptr->resize_ctl).max_size; - } - - /* clip to max increment if necessary */ - if (((cache_ptr->resize_ctl).apply_max_increment) && - ((cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment) < - new_max_cache_size)) { - - new_max_cache_size = - cache_ptr->max_cache_size + (cache_ptr->resize_ctl).max_increment; - } - - status = increase; - } - } - break; - - default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode") - } - - /* If the decr_mode is either age out or age out with threshold, we - * must run the marker maintenance code, whether we run the size - * reduction code or not. We do this in two places -- here we - * insert a new marker if the number of active epoch markers is - * is less than the the current epochs before eviction, and after - * the ageout call, we cycle the markers. - * - * However, we can't call the ageout code or cycle the markers - * unless there was a full complement of markers in place on - * entry. The inserted_epoch_marker flag is used to track this. - */ - - if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) || - ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) && - (cache_ptr->epoch_markers_active < (cache_ptr->resize_ctl).epochs_before_eviction)) { - - if (H5C__autoadjust__ageout__insert_new_marker(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't insert new epoch marker") - - inserted_epoch_marker = TRUE; - } - - /* don't run the cache size decrease code unless the cache size - * increase code is disabled, or the size increase code sees no need - * for action. In either case, status == in_spec at this point. - */ - - if (status == in_spec) { - - switch ((cache_ptr->resize_ctl).decr_mode) { - case H5C_decr__off: - break; - - case H5C_decr__threshold: - if (hit_rate > (cache_ptr->resize_ctl).upper_hr_threshold) { - - if (!cache_ptr->size_decrease_possible) { - - status = decrease_disabled; - } - else if (cache_ptr->max_cache_size <= (cache_ptr->resize_ctl).min_size) { - - HDassert(cache_ptr->max_cache_size == (cache_ptr->resize_ctl).min_size); - status = at_min_size; - } - else { - - new_max_cache_size = (size_t)(((double)(cache_ptr->max_cache_size)) * - (cache_ptr->resize_ctl).decrement); - - /* clip to min size if necessary */ - if (new_max_cache_size < (cache_ptr->resize_ctl).min_size) { - - new_max_cache_size = (cache_ptr->resize_ctl).min_size; - } - - /* clip to max decrement if necessary */ - if (((cache_ptr->resize_ctl).apply_max_decrement) && - (((cache_ptr->resize_ctl).max_decrement + new_max_cache_size) < - cache_ptr->max_cache_size)) { - - new_max_cache_size = - cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement; - } - - status = decrease; - } - } - break; - - case H5C_decr__age_out_with_threshold: - case H5C_decr__age_out: - if (!inserted_epoch_marker) { - if (!cache_ptr->size_decrease_possible) - status = decrease_disabled; - else { - if (H5C__autoadjust__ageout(f, hit_rate, &status, &new_max_cache_size, - write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ageout code failed") - } /* end else */ - } /* end if */ - break; - - default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode") - } - } - - /* cycle the epoch markers here if appropriate */ - if ((((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) || - ((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold)) && - (!inserted_epoch_marker)) { - - /* move last epoch marker to the head of the LRU list */ - if (H5C__autoadjust__ageout__cycle_epoch_marker(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error cycling epoch marker") - } - - if ((status == increase) || (status == decrease)) { - - old_max_cache_size = cache_ptr->max_cache_size; - old_min_clean_size = cache_ptr->min_clean_size; - - new_min_clean_size = - (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction)); - - /* new_min_clean_size is of size_t, and thus must be non-negative. - * Hence we have - * - * ( 0 <= new_min_clean_size ). - * - * by definition. - */ - HDassert(new_min_clean_size <= new_max_cache_size); - HDassert((cache_ptr->resize_ctl).min_size <= new_max_cache_size); - HDassert(new_max_cache_size <= (cache_ptr->resize_ctl).max_size); - - cache_ptr->max_cache_size = new_max_cache_size; - cache_ptr->min_clean_size = new_min_clean_size; - - if (status == increase) { - - cache_ptr->cache_full = FALSE; - } - else if (status == decrease) { - - cache_ptr->size_decreased = TRUE; - } - - /* update flash cache size increase fields as appropriate */ - if (cache_ptr->flash_size_increase_possible) { - - switch ((cache_ptr->resize_ctl).flash_incr_mode) { - case H5C_flash_incr__off: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "flash_size_increase_possible but H5C_flash_incr__off?!") - break; - - case H5C_flash_incr__add_space: - cache_ptr->flash_size_increase_threshold = - (size_t)(((double)(cache_ptr->max_cache_size)) * - ((cache_ptr->resize_ctl).flash_threshold)); - break; - - default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") - break; - } - } - } - - if ((cache_ptr->resize_ctl).rpt_fcn != NULL) { - (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate, status, - old_max_cache_size, new_max_cache_size, old_min_clean_size, - new_min_clean_size); - } - - if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) - /* this should be impossible... */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed") - -done: - /* Sanity checks */ - HDassert(cache_ptr->resize_in_progress); - if (!reentrant_call) - cache_ptr->resize_in_progress = FALSE; - HDassert((!reentrant_call) || (cache_ptr->resize_in_progress)); - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__auto_adjust_cache_size() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout - * - * Purpose: Implement the ageout automatic cache size decrement - * algorithm. Note that while this code evicts aged out - * entries, the code does not change the maximum cache size. - * Instead, the function simply computes the new value (if - * any change is indicated) and reports this value in - * *new_max_cache_size_ptr. - * - * Return: Non-negative on success/Negative on failure or if there was - * an attempt to flush a protected item. - * - * - * Programmer: John Mainzer, 11/18/04 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__autoadjust__ageout(H5F_t *f, double hit_rate, enum H5C_resize_status *status_ptr, - size_t *new_max_cache_size_ptr, hbool_t write_permitted) -{ - H5C_t *cache_ptr = f->shared->cache; - size_t test_size; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert((status_ptr) && (*status_ptr == in_spec)); - HDassert((new_max_cache_size_ptr) && (*new_max_cache_size_ptr == 0)); - - /* remove excess epoch markers if any */ - if (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) - if (H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers") - - if (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out) || - (((cache_ptr->resize_ctl).decr_mode == H5C_decr__age_out_with_threshold) && - (hit_rate >= (cache_ptr->resize_ctl).upper_hr_threshold))) { - - if (cache_ptr->max_cache_size > (cache_ptr->resize_ctl).min_size) { - - /* evict aged out cache entries if appropriate... */ - if (H5C__autoadjust__ageout__evict_aged_out_entries(f, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error flushing aged out entries") - - /* ... and then reduce cache size if appropriate */ - if (cache_ptr->index_size < cache_ptr->max_cache_size) { - - if ((cache_ptr->resize_ctl).apply_empty_reserve) { - - test_size = (size_t)(((double)cache_ptr->index_size) / - (1 - (cache_ptr->resize_ctl).empty_reserve)); - - if (test_size < cache_ptr->max_cache_size) { - - *status_ptr = decrease; - *new_max_cache_size_ptr = test_size; - } - } - else { - - *status_ptr = decrease; - *new_max_cache_size_ptr = cache_ptr->index_size; - } - - if (*status_ptr == decrease) { - - /* clip to min size if necessary */ - if (*new_max_cache_size_ptr < (cache_ptr->resize_ctl).min_size) { - - *new_max_cache_size_ptr = (cache_ptr->resize_ctl).min_size; - } - - /* clip to max decrement if necessary */ - if (((cache_ptr->resize_ctl).apply_max_decrement) && - (((cache_ptr->resize_ctl).max_decrement + *new_max_cache_size_ptr) < - cache_ptr->max_cache_size)) { - - *new_max_cache_size_ptr = - cache_ptr->max_cache_size - (cache_ptr->resize_ctl).max_decrement; - } - } - } - } - else { - - *status_ptr = at_min_size; - } - } - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__autoadjust__ageout() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout__cycle_epoch_marker - * - * Purpose: Remove the oldest epoch marker from the LRU list, - * and reinsert it at the head of the LRU list. Also - * remove the epoch marker's index from the head of the - * ring buffer, and re-insert it at the tail of the ring - * buffer. - * - * Return: SUCCEED on success/FAIL on failure. - * - * Programmer: John Mainzer, 11/22/04 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t *cache_ptr) -{ - int i; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - if (cache_ptr->epoch_markers_active <= 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "No active epoch markers on entry?!?!?") - - /* remove the last marker from both the ring buffer and the LRU list */ - - i = cache_ptr->epoch_marker_ringbuf[cache_ptr->epoch_marker_ringbuf_first]; - - cache_ptr->epoch_marker_ringbuf_first = - (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); - - if (cache_ptr->epoch_marker_ringbuf_size <= 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") - - cache_ptr->epoch_marker_ringbuf_size -= 1; - - if ((cache_ptr->epoch_marker_active)[i] != TRUE) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") - - H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, - (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL)) - - /* now, re-insert it at the head of the LRU list, and at the tail of - * the ring buffer. - */ - - HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); - HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); - HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); - - cache_ptr->epoch_marker_ringbuf_last = - (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1); - - (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i; - - if (cache_ptr->epoch_marker_ringbuf_size >= H5C__MAX_EPOCH_MARKERS) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow") - - cache_ptr->epoch_marker_ringbuf_size += 1; - - H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, - (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL)) -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__autoadjust__ageout__cycle_epoch_marker() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout__evict_aged_out_entries - * - * Purpose: Evict clean entries in the cache that haven't - * been accessed for at least - * (cache_ptr->resize_ctl).epochs_before_eviction epochs, - * and flush dirty entries that haven't been accessed for - * that amount of time. - * - * Depending on configuration, the function will either - * flush or evict all such entries, or all such entries it - * encounters until it has freed the maximum amount of space - * allowed under the maximum decrement. - * - * If we are running in parallel mode, writes may not be - * permitted. If so, the function simply skips any dirty - * entries it may encounter. - * - * The function makes no attempt to maintain the minimum - * clean size, as there is no guarantee that the cache size - * will be changed. - * - * If there is no cache size change, the minimum clean size - * constraint will be met through a combination of clean - * entries and free space in the cache. - * - * If there is a cache size reduction, the minimum clean size - * will be re-calculated, and will be enforced the next time - * we have to make space in the cache. - * - * Observe that this function cannot occasion a read. - * - * Return: Non-negative on success/Negative on failure. - * - * Programmer: John Mainzer, 11/22/04 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *f, hbool_t write_permitted) -{ - H5C_t *cache_ptr = f->shared->cache; - size_t eviction_size_limit; - size_t bytes_evicted = 0; - hbool_t prev_is_dirty = FALSE; - hbool_t restart_scan; - H5C_cache_entry_t *entry_ptr; - H5C_cache_entry_t *next_ptr; - H5C_cache_entry_t *prev_ptr; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - /* if there is a limit on the amount that the cache size can be decrease - * in any one round of the cache size reduction algorithm, load that - * limit into eviction_size_limit. Otherwise, set eviction_size_limit - * to the equivalent of infinity. The current size of the index will - * do nicely. - */ - if ((cache_ptr->resize_ctl).apply_max_decrement) { - - eviction_size_limit = (cache_ptr->resize_ctl).max_decrement; - } - else { - - eviction_size_limit = cache_ptr->index_size; /* i.e. infinity */ - } - - if (write_permitted) { - - restart_scan = FALSE; - entry_ptr = cache_ptr->LRU_tail_ptr; - - while ((entry_ptr != NULL) && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && - (bytes_evicted < eviction_size_limit)) { - hbool_t skipping_entry = FALSE; - - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(!(entry_ptr->is_protected)); - HDassert(!(entry_ptr->is_read_only)); - HDassert((entry_ptr->ro_ref_count) == 0); - - next_ptr = entry_ptr->next; - prev_ptr = entry_ptr->prev; - - if (prev_ptr != NULL) - prev_is_dirty = prev_ptr->is_dirty; - - if (entry_ptr->is_dirty) { - HDassert(!entry_ptr->prefetched_dirty); - - /* dirty corked entry is skipped */ - if (entry_ptr->tag_info && entry_ptr->tag_info->corked) - skipping_entry = TRUE; - else { - /* reset entries_removed_counter and - * last_entry_removed_ptr prior to the call to - * H5C__flush_single_entry() so that we can spot - * unexpected removals of entries from the cache, - * and set the restart_scan flag if proceeding - * would be likely to cause us to scan an entry - * that is no longer in the cache. - */ - cache_ptr->entries_removed_counter = 0; - cache_ptr->last_entry_removed_ptr = NULL; - - if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") - - if (cache_ptr->entries_removed_counter > 1 || - cache_ptr->last_entry_removed_ptr == prev_ptr) - restart_scan = TRUE; - } /* end else */ - } /* end if */ - else if (!entry_ptr->prefetched_dirty) { - - bytes_evicted += entry_ptr->size; - - if (H5C__flush_single_entry( - f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") - } /* end else-if */ - else { - HDassert(!entry_ptr->is_dirty); - HDassert(entry_ptr->prefetched_dirty); - - skipping_entry = TRUE; - } /* end else */ - - if (prev_ptr != NULL) { - if (skipping_entry) - entry_ptr = prev_ptr; - else if (restart_scan || (prev_ptr->is_dirty != prev_is_dirty) || - (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) || (prev_ptr->is_pinned)) { - /* Something has happened to the LRU -- start over - * from the tail. - */ - restart_scan = FALSE; - entry_ptr = cache_ptr->LRU_tail_ptr; - - H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) - } /* end else-if */ - else - entry_ptr = prev_ptr; - } /* end if */ - else - entry_ptr = NULL; - } /* end while */ - - /* for now at least, don't bother to maintain the minimum clean size, - * as the cache should now be less than its maximum size. Due to - * the vaguries of the cache size reduction algorithm, we may not - * reduce the size of the cache. - * - * If we do, we will calculate a new minimum clean size, which will - * be enforced the next time we try to make space in the cache. - * - * If we don't, no action is necessary, as we have just evicted and/or - * or flushed a bunch of entries and therefore the sum of the clean - * and free space in the cache must be greater than or equal to the - * min clean space requirement (assuming that requirement was met on - * entry). - */ - - } /* end if */ - else /* ! write_permitted */ { - /* Since we are not allowed to write, all we can do is evict - * any clean entries that we may encounter before we either - * hit the eviction size limit, or encounter the epoch marker. - * - * If we are operating read only, this isn't an issue, as there - * will not be any dirty entries. - * - * If we are operating in R/W mode, all the dirty entries we - * skip will be flushed the next time we attempt to make space - * when writes are permitted. This may have some local - * performance implications, but it shouldn't cause any net - * slowdown. - */ - HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS); - entry_ptr = cache_ptr->LRU_tail_ptr; - while (entry_ptr != NULL && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && - (bytes_evicted < eviction_size_limit)) { - HDassert(!(entry_ptr->is_protected)); - - prev_ptr = entry_ptr->prev; - - if (!(entry_ptr->is_dirty) && !(entry_ptr->prefetched_dirty)) - if (H5C__flush_single_entry( - f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry") - - /* just skip the entry if it is dirty, as we can't do - * anything with it now since we can't write. - * - * Since all entries are clean, serialize() will not be called, - * and thus we needn't test to see if the LRU has been changed - * out from under us. - */ - entry_ptr = prev_ptr; - } /* end while */ - } /* end else */ - - if (cache_ptr->index_size < cache_ptr->max_cache_size) - cache_ptr->cache_full = FALSE; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__autoadjust__ageout__evict_aged_out_entries() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout__insert_new_marker - * - * Purpose: Find an unused marker cache entry, mark it as used, and - * insert it at the head of the LRU list. Also add the - * marker's index in the epoch_markers array. - * - * Return: SUCCEED on success/FAIL on failure. - * - * Programmer: John Mainzer, 11/19/04 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__autoadjust__ageout__insert_new_marker(H5C_t *cache_ptr) -{ - int i; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - if (cache_ptr->epoch_markers_active >= (cache_ptr->resize_ctl).epochs_before_eviction) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Already have a full complement of markers") - - /* find an unused marker */ - i = 0; - while ((cache_ptr->epoch_marker_active)[i] && i < H5C__MAX_EPOCH_MARKERS) - i++; - - if (i >= H5C__MAX_EPOCH_MARKERS) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker") - - HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); - HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); - HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); - - (cache_ptr->epoch_marker_active)[i] = TRUE; - - cache_ptr->epoch_marker_ringbuf_last = - (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1); - - (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i; - - if (cache_ptr->epoch_marker_ringbuf_size >= H5C__MAX_EPOCH_MARKERS) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow") - } - - cache_ptr->epoch_marker_ringbuf_size += 1; - - H5C__DLL_PREPEND((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, - (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL)) - - cache_ptr->epoch_markers_active += 1; - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__autoadjust__ageout__insert_new_marker() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout__remove_all_markers - * - * Purpose: Remove all epoch markers from the LRU list and mark them - * as inactive. - * - * Return: SUCCEED on success/FAIL on failure. - * - * Programmer: John Mainzer, 11/22/04 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__autoadjust__ageout__remove_all_markers(H5C_t *cache_ptr) -{ - int ring_buf_index; - int i; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - while (cache_ptr->epoch_markers_active > 0) { - /* get the index of the last epoch marker in the LRU list - * and remove it from the ring buffer. - */ - - ring_buf_index = cache_ptr->epoch_marker_ringbuf_first; - i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index]; - - cache_ptr->epoch_marker_ringbuf_first = - (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); - - if (cache_ptr->epoch_marker_ringbuf_size <= 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") - - cache_ptr->epoch_marker_ringbuf_size -= 1; - - if ((cache_ptr->epoch_marker_active)[i] != TRUE) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") - - /* remove the epoch marker from the LRU list */ - H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, - (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, - (FAIL)) - - /* mark the epoch marker as unused. */ - (cache_ptr->epoch_marker_active)[i] = FALSE; - - HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); - HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); - HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); - - /* decrement the number of active epoch markers */ - cache_ptr->epoch_markers_active -= 1; - - HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size); - } - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__autoadjust__ageout__remove_all_markers() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__autoadjust__ageout__remove_excess_markers - * - * Purpose: Remove epoch markers from the end of the LRU list and - * mark them as inactive until the number of active markers - * equals the the current value of - * (cache_ptr->resize_ctl).epochs_before_eviction. - * - * Return: SUCCEED on success/FAIL on failure. - * - * Programmer: John Mainzer, 11/19/04 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__autoadjust__ageout__remove_excess_markers(H5C_t *cache_ptr) -{ - int ring_buf_index; - int i; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - if (cache_ptr->epoch_markers_active <= (cache_ptr->resize_ctl).epochs_before_eviction) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "no excess markers on entry") - - while (cache_ptr->epoch_markers_active > (cache_ptr->resize_ctl).epochs_before_eviction) { - /* get the index of the last epoch marker in the LRU list - * and remove it from the ring buffer. - */ - - ring_buf_index = cache_ptr->epoch_marker_ringbuf_first; - i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index]; - - cache_ptr->epoch_marker_ringbuf_first = - (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); - - if (cache_ptr->epoch_marker_ringbuf_size <= 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow") - - cache_ptr->epoch_marker_ringbuf_size -= 1; - - if ((cache_ptr->epoch_marker_active)[i] != TRUE) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?") - - /* remove the epoch marker from the LRU list */ - H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, - (cache_ptr)->LRU_tail_ptr, (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, - (FAIL)) - - /* mark the epoch marker as unused. */ - (cache_ptr->epoch_marker_active)[i] = FALSE; - - HDassert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); - HDassert(((cache_ptr->epoch_markers)[i]).next == NULL); - HDassert(((cache_ptr->epoch_markers)[i]).prev == NULL); - - /* decrement the number of active epoch markers */ - cache_ptr->epoch_markers_active -= 1; - - HDassert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size); - } - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__autoadjust__ageout__remove_excess_markers() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__flash_increase_cache_size - * - * Purpose: If there is not at least new_entry_size - old_entry_size - * bytes of free space in the cache and the current - * max_cache_size is less than (cache_ptr->resize_ctl).max_size, - * perform a flash increase in the cache size and then reset - * the full cache hit rate statistics, and exit. - * - * Return: Non-negative on success/Negative on failure. - * - * Programmer: John Mainzer, 12/31/07 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__flash_increase_cache_size(H5C_t *cache_ptr, size_t old_entry_size, size_t new_entry_size) -{ - size_t new_max_cache_size = 0; - size_t old_max_cache_size = 0; - size_t new_min_clean_size = 0; - size_t old_min_clean_size = 0; - size_t space_needed; - enum H5C_resize_status status = flash_increase; /* may change */ - double hit_rate; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->flash_size_increase_possible); - HDassert(new_entry_size > cache_ptr->flash_size_increase_threshold); - HDassert(old_entry_size < new_entry_size); - - if (old_entry_size >= new_entry_size) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "old_entry_size >= new_entry_size") - - space_needed = new_entry_size - old_entry_size; - - if (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) && - (cache_ptr->max_cache_size < (cache_ptr->resize_ctl).max_size)) { - - /* we have work to do */ - - switch ((cache_ptr->resize_ctl).flash_incr_mode) { - case H5C_flash_incr__off: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "flash_size_increase_possible but H5C_flash_incr__off?!") - break; - - case H5C_flash_incr__add_space: - if (cache_ptr->index_size < cache_ptr->max_cache_size) { - - HDassert((cache_ptr->max_cache_size - cache_ptr->index_size) < space_needed); - space_needed -= cache_ptr->max_cache_size - cache_ptr->index_size; - } - space_needed = (size_t)(((double)space_needed) * (cache_ptr->resize_ctl).flash_multiple); - - new_max_cache_size = cache_ptr->max_cache_size + space_needed; - - break; - - default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") - break; - } - - if (new_max_cache_size > (cache_ptr->resize_ctl).max_size) { - - new_max_cache_size = (cache_ptr->resize_ctl).max_size; - } - - HDassert(new_max_cache_size > cache_ptr->max_cache_size); - - new_min_clean_size = - (size_t)((double)new_max_cache_size * ((cache_ptr->resize_ctl).min_clean_fraction)); - - HDassert(new_min_clean_size <= new_max_cache_size); - - old_max_cache_size = cache_ptr->max_cache_size; - old_min_clean_size = cache_ptr->min_clean_size; - - cache_ptr->max_cache_size = new_max_cache_size; - cache_ptr->min_clean_size = new_min_clean_size; - - /* update flash cache size increase fields as appropriate */ - HDassert(cache_ptr->flash_size_increase_possible); - - switch ((cache_ptr->resize_ctl).flash_incr_mode) { - case H5C_flash_incr__off: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "flash_size_increase_possible but H5C_flash_incr__off?!") - break; - - case H5C_flash_incr__add_space: - cache_ptr->flash_size_increase_threshold = - (size_t)(((double)(cache_ptr->max_cache_size)) * - ((cache_ptr->resize_ctl).flash_threshold)); - break; - - default: /* should be unreachable */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?") - break; - } - - /* note that we don't cycle the epoch markers. We can - * argue either way as to whether we should, but for now - * we don't. - */ - - if ((cache_ptr->resize_ctl).rpt_fcn != NULL) { - - /* get the hit rate for the reporting function. Should still - * be good as we haven't reset the hit rate statistics. - */ - if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate") - - (*((cache_ptr->resize_ctl).rpt_fcn))(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate, - status, old_max_cache_size, new_max_cache_size, - old_min_clean_size, new_min_clean_size); - } - - if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) - /* this should be impossible... */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed") - } - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__flash_increase_cache_size() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__flush_invalidate_cache - * - * Purpose: Flush and destroy the entries contained in the target - * cache. - * - * If the cache contains protected entries, the function will - * fail, as protected entries cannot be either flushed or - * destroyed. However all unprotected entries should be - * flushed and destroyed before the function returns failure. - * - * While pinned entries can usually be flushed, they cannot - * be destroyed. However, they should be unpinned when all - * the entries that reference them have been destroyed (thus - * reduding the pinned entry's reference count to 0, allowing - * it to be unpinned). - * - * If pinned entries are present, the function makes repeated - * passes through the cache, flushing all dirty entries - * (including the pinned dirty entries where permitted) and - * destroying all unpinned entries. This process is repeated - * until either the cache is empty, or the number of pinned - * entries stops decreasing on each pass. - * - * Return: Non-negative on success/Negative on failure or if there was - * a request to flush all items and something was protected. - * - * Programmer: John Mainzer - * 3/24/065 - * - * Modifications: - * - * To support the fractal heap, the cache must now deal with - * entries being dirtied, resized, and/or renamed inside - * flush callbacks. Updated function to support this. - * - * -- JRM 8/27/06 - * - * Added code to detect and manage the case in which a - * flush callback changes the s-list out from under - * the function. The only way I can think of in which this - * can happen is if a flush function loads an entry - * into the cache that isn't there already. Quincey tells - * me that this will never happen, but I'm not sure I - * believe him. - * - * Note that this is a pretty bad scenario if it ever - * happens. The code I have added should allow us to - * handle the situation under all but the worst conditions, - * but one can argue that we should just scream and die if - * we ever detect the condition. - * - * -- JRM 10/13/07 - * - * Missing entries? - * - * - * Added support for the H5C__EVICT_ALLOW_LAST_PINS_FLAG. - * This flag is used to flush and evict all entries in - * the metadata cache that are not pinned -- typically, - * everything other than the superblock. - * - * ??? -- ??/??/?? - * - * Added sanity checks to verify that the skip list is - * enabled on entry. On the face of it, it would make - * sense to enable the slist on entry, and disable it - * on exit, as this function is not called repeatedly. - * However, since this function can be called from - * H5C_flush_cache(), this would create cases in the test - * code where we would have to check the flags to determine - * whether we must setup and take down the slist. - * - * JRM -- 5/5/20 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__flush_invalidate_cache(H5F_t *f, unsigned flags) -{ - H5C_t *cache_ptr; - H5C_ring_t ring; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - HDassert(f); - HDassert(f->shared); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->slist_ptr); - HDassert(cache_ptr->slist_enabled); - -#if H5C_DO_SANITY_CHECKS - { - int32_t i; - uint32_t index_len = 0; - uint32_t slist_len = 0; - size_t index_size = (size_t)0; - size_t clean_index_size = (size_t)0; - size_t dirty_index_size = (size_t)0; - size_t slist_size = (size_t)0; - - HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); - HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); - HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - - for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { - - index_len += cache_ptr->index_ring_len[i]; - index_size += cache_ptr->index_ring_size[i]; - clean_index_size += cache_ptr->clean_index_ring_size[i]; - dirty_index_size += cache_ptr->dirty_index_ring_size[i]; - - slist_len += cache_ptr->slist_ring_len[i]; - slist_size += cache_ptr->slist_ring_size[i]; - - } /* end for */ - - HDassert(cache_ptr->index_len == index_len); - HDassert(cache_ptr->index_size == index_size); - HDassert(cache_ptr->clean_index_size == clean_index_size); - HDassert(cache_ptr->dirty_index_size == dirty_index_size); - HDassert(cache_ptr->slist_len == slist_len); - HDassert(cache_ptr->slist_size == slist_size); - } -#endif /* H5C_DO_SANITY_CHECKS */ - - /* remove ageout markers if present */ - if (cache_ptr->epoch_markers_active > 0) { - - if (H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers") - } - - /* flush invalidate each ring, starting from the outermost ring and - * working inward. - */ - ring = H5C_RING_USER; - - while (ring < H5C_RING_NTYPES) { - - if (H5C__flush_invalidate_ring(f, ring, flags) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed") - ring++; - - } /* end while */ - - /* Invariants, after destroying all entries in the hash table */ - if (!(flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG)) { - - HDassert(cache_ptr->index_size == 0); - HDassert(cache_ptr->clean_index_size == 0); - HDassert(cache_ptr->pel_len == 0); - HDassert(cache_ptr->pel_size == 0); - - } /* end if */ - else { - - H5C_cache_entry_t *entry_ptr; /* Cache entry */ - unsigned u; /* Local index variable */ - - /* All rings except ring 4 should be empty now */ - /* (Ring 4 has the superblock) */ - for (u = H5C_RING_USER; u < H5C_RING_SB; u++) { - - HDassert(cache_ptr->index_ring_len[u] == 0); - HDassert(cache_ptr->index_ring_size[u] == 0); - HDassert(cache_ptr->clean_index_ring_size[u] == 0); - - } /* end for */ - - /* Check that any remaining pinned entries are in the superblock ring */ - - entry_ptr = cache_ptr->pel_head_ptr; - - while (entry_ptr) { - - /* Check ring */ - HDassert(entry_ptr->ring == H5C_RING_SB); - - /* Advance to next entry in pinned entry list */ - entry_ptr = entry_ptr->next; - - } /* end while */ - } /* end else */ - - HDassert(cache_ptr->dirty_index_size == 0); - HDassert(cache_ptr->slist_len == 0); - HDassert(cache_ptr->slist_size == 0); - HDassert(cache_ptr->pl_len == 0); - HDassert(cache_ptr->pl_size == 0); - HDassert(cache_ptr->LRU_list_len == 0); - HDassert(cache_ptr->LRU_list_size == 0); - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__flush_invalidate_cache() */ - -/*------------------------------------------------------------------------- - * Function: H5C__flush_invalidate_ring - * - * Purpose: Flush and destroy the entries contained in the target - * cache and ring. - * - * If the ring contains protected entries, the function will - * fail, as protected entries cannot be either flushed or - * destroyed. However all unprotected entries should be - * flushed and destroyed before the function returns failure. - * - * While pinned entries can usually be flushed, they cannot - * be destroyed. However, they should be unpinned when all - * the entries that reference them have been destroyed (thus - * reduding the pinned entry's reference count to 0, allowing - * it to be unpinned). - * - * If pinned entries are present, the function makes repeated - * passes through the cache, flushing all dirty entries - * (including the pinned dirty entries where permitted) and - * destroying all unpinned entries. This process is repeated - * until either the cache is empty, or the number of pinned - * entries stops decreasing on each pass. - * - * If flush dependencies appear in the target ring, the - * function makes repeated passes through the cache flushing - * entries in flush dependency order. - * - * Return: Non-negative on success/Negative on failure or if there was - * a request to flush all items and something was protected. - * - * Programmer: John Mainzer - * 9/1/15 - * - * Changes: Added support for the H5C__EVICT_ALLOW_LAST_PINS_FLAG. - * This flag is used to flush and evict all entries in - * the metadata cache that are not pinned -- typically, - * everything other than the superblock. - * - * ??? -- ??/??/?? - * - * A recent optimization turns off the slist unless a flush - * is in progress. This should not effect this function, as - * it is only called during a flush. Added an assertion to - * verify this. - * - * JRM -- 5/6/20 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) -{ - H5C_t *cache_ptr; - hbool_t restart_slist_scan; - uint32_t protected_entries = 0; - int32_t i; - uint32_t cur_ring_pel_len; - uint32_t old_ring_pel_len; - unsigned cooked_flags; - unsigned evict_flags; - H5SL_node_t *node_ptr = NULL; - H5C_cache_entry_t *entry_ptr = NULL; - H5C_cache_entry_t *next_entry_ptr = NULL; -#if H5C_DO_SANITY_CHECKS - uint32_t initial_slist_len = 0; - size_t initial_slist_size = 0; -#endif /* H5C_DO_SANITY_CHECKS */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - HDassert(f); - HDassert(f->shared); - - cache_ptr = f->shared->cache; - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->slist_enabled); - HDassert(cache_ptr->slist_ptr); - HDassert(ring > H5C_RING_UNDEFINED); - HDassert(ring < H5C_RING_NTYPES); - - HDassert(cache_ptr->epoch_markers_active == 0); - - /* Filter out the flags that are not relevant to the flush/invalidate. - */ - cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG; - evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG; - - /* The flush procedure here is a bit strange. - * - * In the outer while loop we make at least one pass through the - * cache, and then repeat until either all the pinned entries in - * the ring unpin themselves, or until the number of pinned entries - * in the ring stops declining. In this later case, we scream and die. - * - * Since the fractal heap can dirty, resize, and/or move entries - * in is flush callback, it is possible that the cache will still - * contain dirty entries at this point. If so, we must make more - * passes through the skip list to allow it to empty. - * - * Further, since clean entries can be dirtied, resized, and/or moved - * as the result of a flush call back (either the entries own, or that - * for some other cache entry), we can no longer promise to flush - * the cache entries in increasing address order. - * - * Instead, we just do the best we can -- making a pass through - * the skip list, and then a pass through the "clean" entries, and - * then repeating as needed. Thus it is quite possible that an - * entry will be evicted from the cache only to be re-loaded later - * in the flush process (From what Quincey tells me, the pin - * mechanism makes this impossible, but even it it is true now, - * we shouldn't count on it in the future.) - * - * The bottom line is that entries will probably be flushed in close - * to increasing address order, but there are no guarantees. - */ - - /* compute the number of pinned entries in this ring */ - - entry_ptr = cache_ptr->pel_head_ptr; - cur_ring_pel_len = 0; - - while (entry_ptr != NULL) { - - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring >= ring); - if (entry_ptr->ring == ring) - cur_ring_pel_len++; - - entry_ptr = entry_ptr->next; - - } /* end while */ - - old_ring_pel_len = cur_ring_pel_len; - - while (cache_ptr->index_ring_len[ring] > 0) { - - /* first, try to flush-destroy any dirty entries. Do this by - * making a scan through the slist. Note that new dirty entries - * may be created by the flush call backs. Thus it is possible - * that the slist will not be empty after we finish the scan. - */ - -#if H5C_DO_SANITY_CHECKS - /* Depending on circumstances, H5C__flush_single_entry() will - * remove dirty entries from the slist as it flushes them. - * Thus for sanity checks we must make note of the initial - * slist length and size before we do any flushes. - */ - initial_slist_len = cache_ptr->slist_len; - initial_slist_size = cache_ptr->slist_size; - - /* There is also the possibility that entries will be - * dirtied, resized, moved, and/or removed from the cache - * as the result of calls to the flush callbacks. We use - * the slist_len_increase and slist_size_increase increase - * fields in struct H5C_t to track these changes for purpose - * of sanity checking. - * - * To this end, we must zero these fields before we start - * the pass through the slist. - */ - cache_ptr->slist_len_increase = 0; - cache_ptr->slist_size_increase = 0; -#endif /* H5C_DO_SANITY_CHECKS */ - - /* Set the cache_ptr->slist_changed to false. - * - * This flag is set to TRUE by H5C__flush_single_entry if the slist - * is modified by a pre_serialize, serialize, or notify callback. - * - * H5C__flush_invalidate_ring() uses this flag to detect any - * modifications to the slist that might corrupt the scan of - * the slist -- and restart the scan in this event. - */ - cache_ptr->slist_changed = FALSE; - - /* this done, start the scan of the slist */ - restart_slist_scan = TRUE; - - while (restart_slist_scan || (node_ptr != NULL)) { - - if (restart_slist_scan) { - - restart_slist_scan = FALSE; - - /* Start at beginning of skip list */ - node_ptr = H5SL_first(cache_ptr->slist_ptr); - - if (node_ptr == NULL) - /* the slist is empty -- break out of inner loop */ - break; - - /* Get cache entry for this node */ - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if (NULL == next_entry_ptr) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - - HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(next_entry_ptr->is_dirty); - HDassert(next_entry_ptr->in_slist); - HDassert(next_entry_ptr->ring >= ring); - - } /* end if */ - - entry_ptr = next_entry_ptr; - - /* It is possible that entries will be dirtied, resized, - * flushed, or removed from the cache via the take ownership - * flag as the result of pre_serialize or serialized callbacks. - * - * This in turn can corrupt the scan through the slist. - * - * We test for slist modifications in the pre_serialize - * and serialize callbacks, and restart the scan of the - * slist if we find them. However, best we do some extra - * sanity checking just in case. - */ - HDassert(entry_ptr != NULL); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->in_slist); - HDassert(entry_ptr->is_dirty); - HDassert(entry_ptr->ring >= ring); - - /* increment node pointer now, before we delete its target - * from the slist. - */ - node_ptr = H5SL_next(node_ptr); - - if (node_ptr != NULL) { - - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if (NULL == next_entry_ptr) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - - HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(next_entry_ptr->is_dirty); - HDassert(next_entry_ptr->in_slist); - HDassert(next_entry_ptr->ring >= ring); - HDassert(entry_ptr != next_entry_ptr); - } /* end if */ - else { - - next_entry_ptr = NULL; - } - - /* Note that we now remove nodes from the slist as we flush - * the associated entries, instead of leaving them there - * until we are done, and then destroying all nodes in - * the slist. - * - * While this optimization used to be easy, with the possibility - * of new entries being added to the slist in the midst of the - * flush, we must keep the slist in canonical form at all - * times. - */ - if (((!entry_ptr->flush_me_last) || - ((entry_ptr->flush_me_last) && (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && - (entry_ptr->flush_dep_nchildren == 0) && (entry_ptr->ring == ring)) { - - if (entry_ptr->is_protected) { - - /* we have major problems -- but lets flush - * everything we can before we flag an error. - */ - protected_entries++; - - } /* end if */ - else if (entry_ptr->is_pinned) { - - if (H5C__flush_single_entry(f, entry_ptr, H5C__DURING_FLUSH_FLAG) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed") - - if (cache_ptr->slist_changed) { - - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_changed = FALSE; - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); - - } /* end if */ - } /* end else-if */ - else { - - if (H5C__flush_single_entry(f, entry_ptr, - (cooked_flags | H5C__DURING_FLUSH_FLAG | - H5C__FLUSH_INVALIDATE_FLAG | - H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed") - - if (cache_ptr->slist_changed) { - - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_changed = FALSE; - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - } /* end if */ - } /* end else */ - } /* end if */ - } /* end while loop scanning skip list */ - -#if H5C_DO_SANITY_CHECKS - /* It is possible that entries were added to the slist during - * the scan, either before or after scan pointer. The following - * asserts take this into account. - * - * Don't bother with the sanity checks if node_ptr != NULL, as - * in this case we broke out of the loop because it got changed - * out from under us. - */ - - if (node_ptr == NULL) { - - HDassert(cache_ptr->slist_len == - (uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase)); - - HDassert(cache_ptr->slist_size == - (size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase)); - } /* end if */ -#endif /* H5C_DO_SANITY_CHECKS */ - - /* Since we are doing a destroy, we must make a pass through - * the hash table and try to flush - destroy all entries that - * remain. - * - * It used to be that all entries remaining in the cache at - * this point had to be clean, but with the fractal heap mods - * this may not be the case. If so, we will flush entries out - * in increasing address order. - * - * Writes to disk are possible here. - */ - - /* reset the counters so that we can detect insertions, loads, - * and moves caused by the pre_serialize and serialize calls. - */ - cache_ptr->entries_loaded_counter = 0; - cache_ptr->entries_inserted_counter = 0; - cache_ptr->entries_relocated_counter = 0; - - next_entry_ptr = cache_ptr->il_head; - - while (next_entry_ptr != NULL) { - - entry_ptr = next_entry_ptr; - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring >= ring); - - next_entry_ptr = entry_ptr->il_next; - HDassert((next_entry_ptr == NULL) || (next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC)); - - if (((!entry_ptr->flush_me_last) || - (entry_ptr->flush_me_last && (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && - (entry_ptr->flush_dep_nchildren == 0) && (entry_ptr->ring == ring)) { - - if (entry_ptr->is_protected) { - - /* we have major problems -- but lets flush and - * destroy everything we can before we flag an - * error. - */ - protected_entries++; - - if (!entry_ptr->in_slist) { - - HDassert(!(entry_ptr->is_dirty)); - } - } /* end if */ - else if (!(entry_ptr->is_pinned)) { - - /* if *entry_ptr is dirty, it is possible - * that one or more other entries may be - * either removed from the cache, loaded - * into the cache, or moved to a new location - * in the file as a side effect of the flush. - * - * It's also possible that removing a clean - * entry will remove the last child of a proxy - * entry, allowing it to be removed also and - * invalidating the next_entry_ptr. - * - * If either of these happen, and one of the target - * or proxy entries happens to be the next entry in - * the hash bucket, we could either find ourselves - * either scanning a non-existent entry, scanning - * through a different bucket, or skipping an entry. - * - * Neither of these are good, so restart the - * the scan at the head of the hash bucket - * after the flush if we detect that the next_entry_ptr - * becomes invalid. - * - * This is not as inefficient at it might seem, - * as hash buckets typically have at most two - * or three entries. - */ - cache_ptr->entry_watched_for_removal = next_entry_ptr; - - if (H5C__flush_single_entry(f, entry_ptr, - (cooked_flags | H5C__DURING_FLUSH_FLAG | - H5C__FLUSH_INVALIDATE_FLAG | - H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed") - - /* Restart the index list scan if necessary. Must - * do this if the next entry is evicted, and also if - * one or more entries are inserted, loaded, or moved - * as these operations can result in part of the scan - * being skipped -- which can cause a spurious failure - * if this results in the size of the pinned entry - * failing to decline during the pass. - */ - if (((NULL != next_entry_ptr) && (NULL == cache_ptr->entry_watched_for_removal)) || - (cache_ptr->entries_loaded_counter > 0) || - (cache_ptr->entries_inserted_counter > 0) || - (cache_ptr->entries_relocated_counter > 0)) { - - next_entry_ptr = cache_ptr->il_head; - - cache_ptr->entries_loaded_counter = 0; - cache_ptr->entries_inserted_counter = 0; - cache_ptr->entries_relocated_counter = 0; - - H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr) - - } /* end if */ - else { - - cache_ptr->entry_watched_for_removal = NULL; - } - } /* end if */ - } /* end if */ - } /* end for loop scanning hash table */ - - /* We can't do anything if entries are pinned. The - * hope is that the entries will be unpinned as the - * result of destroys of entries that reference them. - * - * We detect this by noting the change in the number - * of pinned entries from pass to pass. If it stops - * shrinking before it hits zero, we scream and die. - */ - old_ring_pel_len = cur_ring_pel_len; - entry_ptr = cache_ptr->pel_head_ptr; - cur_ring_pel_len = 0; - - while (entry_ptr != NULL) { - - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring >= ring); - - if (entry_ptr->ring == ring) { - - cur_ring_pel_len++; - } - - entry_ptr = entry_ptr->next; - - } /* end while */ - - /* Check if the number of pinned entries in the ring is positive, and - * it is not declining. Scream and die if so. - */ - if ((cur_ring_pel_len > 0) && (cur_ring_pel_len >= old_ring_pel_len)) { - - /* Don't error if allowed to have pinned entries remaining */ - if (evict_flags) { - - HGOTO_DONE(TRUE) - } - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, - "Pinned entry count not decreasing, cur_ring_pel_len = %d, old_ring_pel_len = " - "%d, ring = %d", - (int)cur_ring_pel_len, (int)old_ring_pel_len, (int)ring) - } /* end if */ - - HDassert(protected_entries == cache_ptr->pl_len); - - if ((protected_entries > 0) && (protected_entries == cache_ptr->index_len)) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, - "Only protected entries left in cache, protected_entries = %d", - (int)protected_entries) - - } /* main while loop */ - - /* Invariants, after destroying all entries in the ring */ - for (i = (int)H5C_RING_UNDEFINED; i <= (int)ring; i++) { - - HDassert(cache_ptr->index_ring_len[i] == 0); - HDassert(cache_ptr->index_ring_size[i] == (size_t)0); - HDassert(cache_ptr->clean_index_ring_size[i] == (size_t)0); - HDassert(cache_ptr->dirty_index_ring_size[i] == (size_t)0); - - HDassert(cache_ptr->slist_ring_len[i] == 0); - HDassert(cache_ptr->slist_ring_size[i] == (size_t)0); - - } /* end for */ - - HDassert(protected_entries <= cache_ptr->pl_len); - - if (protected_entries > 0) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cache has protected entries") - } - else if (cur_ring_pel_len > 0) { - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries in ring") - } - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__flush_invalidate_ring() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__flush_ring - * - * Purpose: Flush the entries contained in the specified cache and - * ring. All entries in rings outside the specified ring - * must have been flushed on entry. - * - * If the cache contains protected entries in the specified - * ring, the function will fail, as protected entries cannot - * be flushed. However all unprotected entries in the target - * ring should be flushed before the function returns failure. - * - * If flush dependencies appear in the target ring, the - * function makes repeated passes through the slist flushing - * entries in flush dependency order. - * - * Return: Non-negative on success/Negative on failure or if there was - * a request to flush all items and something was protected. - * - * Programmer: John Mainzer - * 9/1/15 - * - * Changes: A recent optimization turns off the slist unless a flush - * is in progress. This should not effect this function, as - * it is only called during a flush. Added an assertion to - * verify this. - * - * JRM -- 5/6/20 - * - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) -{ - H5C_t *cache_ptr = f->shared->cache; - hbool_t flushed_entries_last_pass; - hbool_t flush_marked_entries; - hbool_t ignore_protected; - hbool_t tried_to_flush_protected_entry = FALSE; - hbool_t restart_slist_scan; - uint32_t protected_entries = 0; - H5SL_node_t *node_ptr = NULL; - H5C_cache_entry_t *entry_ptr = NULL; - H5C_cache_entry_t *next_entry_ptr = NULL; -#if H5C_DO_SANITY_CHECKS - uint32_t initial_slist_len = 0; - size_t initial_slist_size = 0; -#endif /* H5C_DO_SANITY_CHECKS */ - int i; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->slist_enabled); - HDassert(cache_ptr->slist_ptr); - HDassert((flags & H5C__FLUSH_INVALIDATE_FLAG) == 0); - HDassert(ring > H5C_RING_UNDEFINED); - HDassert(ring < H5C_RING_NTYPES); - -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - - ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0); - flush_marked_entries = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0); - - if (!flush_marked_entries) { - - for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) { - - HDassert(cache_ptr->slist_ring_len[i] == 0); - } - } - - HDassert(cache_ptr->flush_in_progress); - - /* When we are only flushing marked entries, the slist will usually - * still contain entries when we have flushed everything we should. - * Thus we track whether we have flushed any entries in the last - * pass, and terminate if we haven't. - */ - flushed_entries_last_pass = TRUE; - - /* Set the cache_ptr->slist_changed to false. - * - * This flag is set to TRUE by H5C__flush_single_entry if the - * slist is modified by a pre_serialize, serialize, or notify callback. - * H5C_flush_cache uses this flag to detect any modifications - * to the slist that might corrupt the scan of the slist -- and - * restart the scan in this event. - */ - cache_ptr->slist_changed = FALSE; - - while ((cache_ptr->slist_ring_len[ring] > 0) && (protected_entries == 0) && (flushed_entries_last_pass)) { - - flushed_entries_last_pass = FALSE; - -#if H5C_DO_SANITY_CHECKS - /* For sanity checking, try to verify that the skip list has - * the expected size and number of entries at the end of each - * internal while loop (see below). - * - * Doing this get a bit tricky, as depending on flags, we may - * or may not flush all the entries in the slist. - * - * To make things more entertaining, with the advent of the - * fractal heap, the entry serialize callback can cause entries - * to be dirtied, resized, and/or moved. Also, the - * pre_serialize callback can result in an entry being - * removed from the cache via the take ownership flag. - * - * To deal with this, we first make note of the initial - * skip list length and size: - */ - initial_slist_len = cache_ptr->slist_len; - initial_slist_size = cache_ptr->slist_size; - - /* As mentioned above, there is the possibility that - * entries will be dirtied, resized, flushed, or removed - * from the cache via the take ownership flag during - * our pass through the skip list. To capture the number - * of entries added, and the skip list size delta, - * zero the slist_len_increase and slist_size_increase of - * the cache's instance of H5C_t. These fields will be - * updated elsewhere to account for slist insertions and/or - * dirty entry size changes. - */ - cache_ptr->slist_len_increase = 0; - cache_ptr->slist_size_increase = 0; - - /* at the end of the loop, use these values to compute the - * expected slist length and size and compare this with the - * value recorded in the cache's instance of H5C_t. - */ -#endif /* H5C_DO_SANITY_CHECKS */ - - restart_slist_scan = TRUE; - - while ((restart_slist_scan) || (node_ptr != NULL)) { - - if (restart_slist_scan) { - - restart_slist_scan = FALSE; - - /* Start at beginning of skip list */ - node_ptr = H5SL_first(cache_ptr->slist_ptr); - - if (node_ptr == NULL) { - - /* the slist is empty -- break out of inner loop */ - break; - } - - /* Get cache entry for this node */ - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if (NULL == next_entry_ptr) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - - HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(next_entry_ptr->is_dirty); - HDassert(next_entry_ptr->in_slist); - - } /* end if */ - - entry_ptr = next_entry_ptr; - - /* With the advent of the fractal heap, the free space - * manager, and the version 3 cache, it is possible - * that the pre-serialize or serialize callback will - * dirty, resize, or take ownership of other entries - * in the cache. - * - * To deal with this, I have inserted code to detect any - * change in the skip list not directly under the control - * of this function. If such modifications are detected, - * we must re-start the scan of the skip list to avoid - * the possibility that the target of the next_entry_ptr - * may have been flushed or deleted from the cache. - * - * To verify that all such possibilities have been dealt - * with, we do a bit of extra sanity checking on - * entry_ptr. - */ - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->in_slist); - HDassert(entry_ptr->is_dirty); - - if ((!flush_marked_entries) || (entry_ptr->flush_marker)) { - - HDassert(entry_ptr->ring >= ring); - } - - /* Advance node pointer now, before we delete its target - * from the slist. - */ - node_ptr = H5SL_next(node_ptr); - - if (node_ptr != NULL) { - - next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - if (NULL == next_entry_ptr) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!") - - HDassert(next_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(next_entry_ptr->is_dirty); - HDassert(next_entry_ptr->in_slist); - - if (!flush_marked_entries || next_entry_ptr->flush_marker) { - - HDassert(next_entry_ptr->ring >= ring); - } - - HDassert(entry_ptr != next_entry_ptr); - - } /* end if */ - else { - - next_entry_ptr = NULL; - } - - if ((!flush_marked_entries || entry_ptr->flush_marker) && - ((!entry_ptr->flush_me_last) || - ((entry_ptr->flush_me_last) && ((cache_ptr->num_last_entries >= cache_ptr->slist_len) || - (flush_marked_entries && entry_ptr->flush_marker)))) && - ((entry_ptr->flush_dep_nchildren == 0) || (entry_ptr->flush_dep_ndirty_children == 0)) && - (entry_ptr->ring == ring)) { - - HDassert(entry_ptr->flush_dep_nunser_children == 0); - - if (entry_ptr->is_protected) { - - /* we probably have major problems -- but lets - * flush everything we can before we decide - * whether to flag an error. - */ - tried_to_flush_protected_entry = TRUE; - protected_entries++; - - } /* end if */ - else { - - if (H5C__flush_single_entry(f, entry_ptr, (flags | H5C__DURING_FLUSH_FLAG)) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry") - - if (cache_ptr->slist_changed) { - - /* The slist has been modified by something - * other than the simple removal of the - * of the flushed entry after the flush. - * - * This has the potential to corrupt the - * scan through the slist, so restart it. - */ - restart_slist_scan = TRUE; - cache_ptr->slist_changed = FALSE; - H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr) - - } /* end if */ - - flushed_entries_last_pass = TRUE; - - } /* end else */ - } /* end if */ - } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ - -#if H5C_DO_SANITY_CHECKS - /* Verify that the slist size and length are as expected. */ - HDassert((uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase) == - cache_ptr->slist_len); - HDassert((size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase) == - cache_ptr->slist_size); -#endif /* H5C_DO_SANITY_CHECKS */ - - } /* while */ - - HDassert(protected_entries <= cache_ptr->pl_len); - - if (((cache_ptr->pl_len > 0) && (!ignore_protected)) || (tried_to_flush_protected_entry)) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items") - -#if H5C_DO_SANITY_CHECKS - if (!flush_marked_entries) { - - HDassert(cache_ptr->slist_ring_len[ring] == 0); - HDassert(cache_ptr->slist_ring_size[ring] == 0); - - } /* end if */ -#endif /* H5C_DO_SANITY_CHECKS */ - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__flush_ring() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__flush_single_entry - * - * Purpose: Flush or clear (and evict if requested) the cache entry - * with the specified address and type. If the type is NULL, - * any unprotected entry at the specified address will be - * flushed (and possibly evicted). - * - * Attempts to flush a protected entry will result in an - * error. - * - * If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will - * be cleared and not flushed, and the call can't be part of a - * sequence of flushes. - * - * The function does nothing silently if there is no entry - * at the supplied address, or if the entry found has the - * wrong type. - * - * Return: Non-negative on success/Negative on failure or if there was - * an attempt to flush a protected item. - * - * Programmer: John Mainzer, 5/5/04 - * - * Modifications: - * - * JRM -- 7/21/04 - * Updated function for the addition of the hash table. - * - * QAK -- 11/26/04 - * Updated function for the switch from TBBTs to skip lists. - * - * JRM -- 1/6/05 - * Updated function to reset the flush_marker field. - * Also replace references to H5F_FLUSH_INVALIDATE and - * H5F_FLUSH_CLEAR_ONLY with references to - * H5C__FLUSH_INVALIDATE_FLAG and H5C__FLUSH_CLEAR_ONLY_FLAG - * respectively. - * - * JRM -- 6/24/05 - * Added code to remove dirty entries from the slist after - * they have been flushed. Also added a sanity check that - * will scream if we attempt a write when writes are - * completely disabled. - * - * JRM -- 7/5/05 - * Added code to call the new log_flush callback whenever - * a dirty entry is written to disk. Note that the callback - * is not called if the H5C__FLUSH_CLEAR_ONLY_FLAG is set, - * as there is no write to file in this case. - * - * JRM -- 8/21/06 - * Added code maintaining the flush_in_progress and - * destroy_in_progress fields in H5C_cache_entry_t. - * - * Also added flush_flags parameter to the call to - * type_ptr->flush() so that the flush routine can report - * whether the entry has been resized or renamed. Added - * code using the flush_flags variable to detect the case - * in which the target entry is resized during flush, and - * update the caches data structures accordingly. - * - * JRM -- 3/29/07 - * Added sanity checks on the new is_read_only and - * ro_ref_count fields. - * - * QAK -- 2/07/08 - * Separated "destroy entry" concept from "remove entry from - * cache" concept, by adding the 'take_ownership' flag and - * the "destroy_entry" variable. - * - * JRM -- 11/5/08 - * Added call to H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN() to - * maintain the new clean_index_size and clean_index_size - * fields of H5C_t. - * - * - * Missing entries?? - * - * - * JRM -- 5/8/20 - * Updated sanity checks for the possibility that the slist - * is disabled. - * - * Also updated main comment to conform more closely with - * the current state of the code. - * - *------------------------------------------------------------------------- - */ -herr_t -H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) -{ - H5C_t *cache_ptr; /* Cache for file */ - hbool_t destroy; /* external flag */ - hbool_t clear_only; /* external flag */ - hbool_t free_file_space; /* external flag */ - hbool_t take_ownership; /* external flag */ - hbool_t del_from_slist_on_destroy; /* external flag */ - hbool_t during_flush; /* external flag */ - hbool_t write_entry; /* internal flag */ - hbool_t destroy_entry; /* internal flag */ - hbool_t generate_image; /* internal flag */ - hbool_t update_page_buffer; /* internal flag */ - hbool_t was_dirty; - hbool_t suppress_image_entry_writes = FALSE; - hbool_t suppress_image_entry_frees = FALSE; - haddr_t entry_addr = HADDR_UNDEF; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - HDassert(f); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring != H5C_RING_UNDEFINED); - HDassert(entry_ptr->type); - - /* setup external flags from the flags parameter */ - destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0); - clear_only = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); - free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); - take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); - del_from_slist_on_destroy = ((flags & H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) != 0); - during_flush = ((flags & H5C__DURING_FLUSH_FLAG) != 0); - generate_image = ((flags & H5C__GENERATE_IMAGE_FLAG) != 0); - update_page_buffer = ((flags & H5C__UPDATE_PAGE_BUFFER_FLAG) != 0); - - /* Set the flag for destroying the entry, based on the 'take ownership' - * and 'destroy' flags - */ - if (take_ownership) { - - destroy_entry = FALSE; - } - else { - - destroy_entry = destroy; - } - - /* we will write the entry to disk if it exists, is dirty, and if the - * clear only flag is not set. - */ - if (entry_ptr->is_dirty && !clear_only) { - - write_entry = TRUE; - } - else { - - write_entry = FALSE; - } - - /* if we have received close warning, and we have been instructed to - * generate a metadata cache image, and we have actually constructed - * the entry images, set suppress_image_entry_frees to TRUE. - * - * Set suppress_image_entry_writes to TRUE if indicated by the - * image_ctl flags. - */ - if ((cache_ptr->close_warning_received) && (cache_ptr->image_ctl.generate_image) && - (cache_ptr->num_entries_in_image > 0) && (cache_ptr->image_entries != NULL)) { - - /* Sanity checks */ - HDassert(entry_ptr->image_up_to_date || !(entry_ptr->include_in_image)); - HDassert(entry_ptr->image_ptr || !(entry_ptr->include_in_image)); - HDassert((!clear_only) || !(entry_ptr->include_in_image)); - HDassert((!take_ownership) || !(entry_ptr->include_in_image)); - HDassert((!free_file_space) || !(entry_ptr->include_in_image)); - - suppress_image_entry_frees = TRUE; - - if (cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES) { - - suppress_image_entry_writes = TRUE; - - } /* end if */ - } /* end if */ - - /* run initial sanity checks */ -#if H5C_DO_SANITY_CHECKS - if (cache_ptr->slist_enabled) { - - if (entry_ptr->in_slist) { - - HDassert(entry_ptr->is_dirty); - - if ((entry_ptr->flush_marker) && (!entry_ptr->is_dirty)) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry in slist failed sanity checks") - } /* end if */ - else { - - HDassert(!entry_ptr->is_dirty); - HDassert(!entry_ptr->flush_marker); - - if ((entry_ptr->is_dirty) || (entry_ptr->flush_marker)) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry failed sanity checks") - - } /* end else */ - } - else { /* slist is disabled */ - - HDassert(!entry_ptr->in_slist); - - if (!entry_ptr->is_dirty) { - - if (entry_ptr->flush_marker) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flush marked clean entry?") - } - } -#endif /* H5C_DO_SANITY_CHECKS */ - - if (entry_ptr->is_protected) { - - HDassert(!entry_ptr->is_protected); - - /* Attempt to flush a protected entry -- scream and die. */ - HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry") - - } /* end if */ - - /* Set entry_ptr->flush_in_progress = TRUE and set - * entry_ptr->flush_marker = FALSE - * - * We will set flush_in_progress back to FALSE at the end if the - * entry still exists at that point. - */ - entry_ptr->flush_in_progress = TRUE; - entry_ptr->flush_marker = FALSE; - - /* Preserve current dirty state for later */ - was_dirty = entry_ptr->is_dirty; - - /* The entry is dirty, and we are doing a flush, a flush destroy or have - * been requested to generate an image. In those cases, serialize the - * entry. - */ - if (write_entry || generate_image) { - - HDassert(entry_ptr->is_dirty); - - if (NULL == entry_ptr->image_ptr) { - - if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "memory allocation failed for on disk image buffer") - -#if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - - } /* end if */ - - if (!(entry_ptr->image_up_to_date)) { - - /* Sanity check */ - HDassert(!entry_ptr->prefetched); - - /* Generate the entry's image */ - if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image") - - } /* end if ( ! (entry_ptr->image_up_to_date) ) */ - } /* end if */ - - /* Finally, write the image to disk. - * - * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the - * in the entry's type, we silently skip the write. This - * flag should only be used in test code. - */ - if (write_entry) { - - HDassert(entry_ptr->is_dirty); - -#if H5C_DO_SANITY_CHECKS - if ((cache_ptr->check_write_permitted) && (!(cache_ptr->write_permitted))) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Write when writes are always forbidden!?!?!") -#endif /* H5C_DO_SANITY_CHECKS */ - - /* Write the image to disk unless the write is suppressed. - * - * This happens if both suppress_image_entry_writes and - * entry_ptr->include_in_image are TRUE, or if the - * H5AC__CLASS_SKIP_WRITES is set in the entry's type. This - * flag should only be used in test code - */ - if (((!suppress_image_entry_writes) || (!entry_ptr->include_in_image)) && - (((entry_ptr->type->flags) & H5C__CLASS_SKIP_WRITES) == 0)) { - - H5FD_mem_t mem_type = H5FD_MEM_DEFAULT; - -#ifdef H5_HAVE_PARALLEL - if (cache_ptr->coll_write_list) { - - if (H5SL_insert(cache_ptr->coll_write_list, entry_ptr, &entry_ptr->addr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert skip list item") - } /* end if */ - else { -#endif /* H5_HAVE_PARALLEL */ - - if (entry_ptr->prefetched) { - - HDassert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); - - mem_type = cache_ptr->class_table_ptr[entry_ptr->prefetch_type_id]->mem_type; - } /* end if */ - else { - - mem_type = entry_ptr->type->mem_type; - } - - if (H5F_block_write(f, mem_type, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file") -#ifdef H5_HAVE_PARALLEL - } -#endif /* H5_HAVE_PARALLEL */ - - } /* end if */ - - /* if the entry has a notify callback, notify it that we have - * just flushed the entry. - */ - if ((entry_ptr->type->notify) && - ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_FLUSH, entry_ptr) < 0)) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client of entry flush") - - } /* if ( write_entry ) */ - - /* At this point, all pre-serialize and serialize calls have been - * made if it was appropriate to make them. Similarly, the entry - * has been written to disk if desired. - * - * Thus it is now safe to update the cache data structures for the - * flush. - */ - - /* start by updating the statistics */ - if (clear_only) { - - /* only log a clear if the entry was dirty */ - if (was_dirty) { - - H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr) - - } /* end if */ - } - else if (write_entry) { - - HDassert(was_dirty); - - /* only log a flush if we actually wrote to disk */ - H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr) - - } /* end else if */ - - /* Note that the algorithm below is (very) similar to the set of operations - * in H5C_remove_entry() and should be kept in sync with changes - * to that code. - QAK, 2016/11/30 - */ - - /* Update the cache internal data structures. */ - if (destroy) { - - /* Sanity checks */ - if (take_ownership) { - - HDassert(!destroy_entry); - } - else { - - HDassert(destroy_entry); - } - - HDassert(!entry_ptr->is_pinned); - - /* Update stats, while entry is still in the cache */ - H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership) - - /* If the entry's type has a 'notify' callback and the entry is about - * to be removed from the cache, send a 'before eviction' notice while - * the entry is still fully integrated in the cache. - */ - if ((entry_ptr->type->notify) && - ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry_ptr) < 0)) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict") - - /* Update the cache internal data structures as appropriate - * for a destroy. Specifically: - * - * 1) Delete it from the index - * - * 2) Delete it from the skip list if requested. - * - * 3) Delete it from the collective read access list. - * - * 4) Update the replacement policy for eviction - * - * 5) Remove it from the tag list for this object - * - * Finally, if the destroy_entry flag is set, discard the - * entry. - */ - H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL) - - if ((entry_ptr->in_slist) && (del_from_slist_on_destroy)) { - - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) - } - -#ifdef H5_HAVE_PARALLEL - /* Check for collective read access flag */ - if (entry_ptr->coll_access) { - - entry_ptr->coll_access = FALSE; - - H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - - H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL) - - /* Remove entry from tag list */ - if (H5C__untag_entry(cache_ptr, entry_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list") - - /* verify that the entry is no longer part of any flush dependencies */ - HDassert(entry_ptr->flush_dep_nparents == 0); - HDassert(entry_ptr->flush_dep_nchildren == 0); - - } /* end if */ - else { - - HDassert(clear_only || write_entry); - HDassert(entry_ptr->is_dirty); - HDassert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist)); - - /* We are either doing a flush or a clear. - * - * A clear and a flush are the same from the point of - * view of the replacement policy and the slist. - * Hence no differentiation between them. - * - * JRM -- 7/7/07 - */ - - H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, FAIL) - - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush) - - /* mark the entry as clean and update the index for - * entry clean. Also, call the clear callback - * if defined. - */ - entry_ptr->is_dirty = FALSE; - - H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr); - - /* Check for entry changing status and do notifications, etc. */ - if (was_dirty) { - - /* If the entry's type has a 'notify' callback send a - * 'entry cleaned' notice now that the entry is fully - * integrated into the cache. - */ - if ((entry_ptr->type->notify) && - ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0)) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify client about entry dirty flag cleared") - - /* Propagate the clean flag up the flush dependency chain - * if appropriate - */ - if (entry_ptr->flush_dep_ndirty_children != 0) { - - HDassert(entry_ptr->flush_dep_ndirty_children == 0); - } - - if (entry_ptr->flush_dep_nparents > 0) { - - if (H5C__mark_flush_dep_clean(entry_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "Can't propagate flush dep clean flag") - } - } /* end if */ - } /* end else */ - - /* reset the flush_in progress flag */ - entry_ptr->flush_in_progress = FALSE; - - /* capture the cache entry address for the log_flush call at the - * end before the entry_ptr gets freed - */ - entry_addr = entry_ptr->addr; - - /* Internal cache data structures should now be up to date, and - * consistent with the status of the entry. - * - * Now discard the entry if appropriate. - */ - if (destroy) { - - /* Sanity check */ - HDassert(0 == entry_ptr->flush_dep_nparents); - - /* if both suppress_image_entry_frees and entry_ptr->include_in_image - * are true, simply set entry_ptr->image_ptr to NULL, as we have - * another pointer to the buffer in an instance of H5C_image_entry_t - * in cache_ptr->image_entries. - * - * Otherwise, free the buffer if it exists. - */ - if (suppress_image_entry_frees && entry_ptr->include_in_image) { - - entry_ptr->image_ptr = NULL; - } - else if (entry_ptr->image_ptr != NULL) { - - entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); - } - - /* If the entry is not a prefetched entry, verify that the flush - * dependency parents addresses array has been transferred. - * - * If the entry is prefetched, the free_isr routine will dispose of - * the flush dependency parents addresses array if necessary. - */ - if (!entry_ptr->prefetched) { - - HDassert(0 == entry_ptr->fd_parent_count); - HDassert(NULL == entry_ptr->fd_parent_addrs); - - } /* end if */ - - /* Check whether we should free the space in the file that - * the entry occupies - */ - if (free_file_space) { - - hsize_t fsf_size; - - /* Sanity checks */ - HDassert(H5F_addr_defined(entry_ptr->addr)); - HDassert(!H5F_IS_TMP_ADDR(f, entry_ptr->addr)); -#ifndef NDEBUG - { - size_t curr_len; - - /* Get the actual image size for the thing again */ - entry_ptr->type->image_len((void *)entry_ptr, &curr_len); - HDassert(curr_len == entry_ptr->size); - } -#endif /* NDEBUG */ - - /* If the file space free size callback is defined, use - * it to get the size of the block of file space to free. - * Otherwise use entry_ptr->size. - */ - if (entry_ptr->type->fsf_size) { - - if ((entry_ptr->type->fsf_size)((void *)entry_ptr, &fsf_size) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to get file space free size") - - } /* end if */ - else { /* no file space free size callback -- use entry size */ - - fsf_size = entry_ptr->size; - } - - /* Release the space on disk */ - if (H5MF_xfree(f, entry_ptr->type->mem_type, entry_ptr->addr, fsf_size) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to free file space for cache entry") - - } /* end if ( free_file_space ) */ - - /* Reset the pointer to the cache the entry is within. -QAK */ - entry_ptr->cache_ptr = NULL; - - /* increment entries_removed_counter and set - * last_entry_removed_ptr. As we are likely abuut to - * free the entry, recall that last_entry_removed_ptr - * must NEVER be dereferenced. - * - * Recall that these fields are maintained to allow functions - * that perform scans of lists of entries to detect the - * unexpected removal of entries (via expunge, eviction, - * or take ownership at present), so that they can re-start - * their scans if necessary. - * - * Also check if the entry we are watching for removal is being - * removed (usually the 'next' entry for an iteration) and reset - * it to indicate that it was removed. - */ - cache_ptr->entries_removed_counter++; - cache_ptr->last_entry_removed_ptr = entry_ptr; - - if (entry_ptr == cache_ptr->entry_watched_for_removal) { - - cache_ptr->entry_watched_for_removal = NULL; - } - - /* Check for actually destroying the entry in memory */ - /* (As opposed to taking ownership of it) */ - if (destroy_entry) { - - if (entry_ptr->is_dirty) { - - /* Reset dirty flag */ - entry_ptr->is_dirty = FALSE; - - /* If the entry's type has a 'notify' callback send a - * 'entry cleaned' notice now that the entry is fully - * integrated into the cache. - */ - if ((entry_ptr->type->notify) && - ((entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0)) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify client about entry dirty flag cleared") - - } /* end if */ - - /* we are about to discard the in core representation -- - * set the magic field to bad magic so we can detect a - * freed entry if we see one. - */ - entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; - - /* verify that the image has been freed */ - HDassert(entry_ptr->image_ptr == NULL); - - if (entry_ptr->type->free_icr((void *)entry_ptr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed") - - } /* end if */ - else { - - HDassert(take_ownership); - - /* client is taking ownership of the entry. - * set bad magic here too so the cache will choke - * unless the entry is re-inserted properly - */ - entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; - - } /* end else */ - } /* if (destroy) */ - - /* Check if we have to update the page buffer with cleared entries - * so it doesn't go out of date - */ - if (update_page_buffer) { - - /* Sanity check */ - HDassert(!destroy); - HDassert(entry_ptr->image_ptr); - - if ((f->shared->page_buf) && (f->shared->page_buf->page_size >= entry_ptr->size)) { - - if (H5PB_update_entry(f->shared->page_buf, entry_ptr->addr, entry_ptr->size, - entry_ptr->image_ptr) > 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Failed to update PB with metadata cache") - } /* end if */ - } /* end if */ - - if (cache_ptr->log_flush) { - - if ((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed") - - } /* end if */ - -done: - - HDassert((ret_value != SUCCEED) || (destroy_entry) || (!entry_ptr->flush_in_progress)); - - HDassert((ret_value != SUCCEED) || (destroy_entry) || (take_ownership) || (!entry_ptr->is_dirty)); - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__flush_single_entry() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__verify_len_eoa - * - * Purpose: Verify that 'len' does not exceed eoa when 'actual' is - * false i.e. 'len" is the initial speculative length from - * get_load_size callback with null image pointer. - * If exceed, adjust 'len' accordingly. - * - * Verify that 'len' should not exceed eoa when 'actual' is - * true i.e. 'len' is the actual length from get_load_size - * callback with non-null image pointer. - * If exceed, return error. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: Vailin Choi - * 9/6/15 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr, size_t *len, hbool_t actual) -{ - H5FD_mem_t cooked_type; /* Modified type, accounting for switching global heaps */ - haddr_t eoa; /* End-of-allocation in the file */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces - * type to H5FD_MEM_DRAW via its call to H5F__accum_read(). - * Thus we do the same for purposes of computing the EOA - * for sanity checks. - */ - cooked_type = (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type; - - /* Get the file's end-of-allocation value */ - eoa = H5F_get_eoa(f, cooked_type); - if (!H5F_addr_defined(eoa)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid EOA address for file") - - /* Check for bad address in general */ - if (H5F_addr_gt(addr, eoa)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "address of object past end of allocation") - - /* Check if the amount of data to read will be past the EOA */ - if (H5F_addr_gt((addr + *len), eoa)) { - if (actual) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA") - else - /* Trim down the length of the metadata */ - *len = (size_t)(eoa - addr); - } /* end if */ - - if (*len <= 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__verify_len_eoa() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__load_entry - * - * Purpose: Attempt to load the entry at the specified disk address - * and with the specified type into memory. If successful. - * return the in memory address of the entry. Return NULL - * on failure. - * - * Note that this function simply loads the entry into - * core. It does not insert it into the cache. - * - * Return: Non-NULL on success / NULL on failure. - * - * Programmer: John Mainzer, 5/18/04 - * - *------------------------------------------------------------------------- - */ -static void * -H5C__load_entry(H5F_t *f, -#ifdef H5_HAVE_PARALLEL - hbool_t coll_access, -#endif /* H5_HAVE_PARALLEL */ - const H5C_class_t *type, haddr_t addr, void *udata) -{ - hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */ - uint8_t *image = NULL; /* Buffer for disk image */ - void *thing = NULL; /* Pointer to thing loaded */ - H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */ - size_t len; /* Size of image in file */ -#ifdef H5_HAVE_PARALLEL - int mpi_rank = 0; /* MPI process rank */ - MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */ - int mpi_code; /* MPI error code */ -#endif /* H5_HAVE_PARALLEL */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - HDassert(type); - HDassert(H5F_addr_defined(addr)); - HDassert(type->get_initial_load_size); - if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) - HDassert(type->get_final_load_size); - else - HDassert(NULL == type->get_final_load_size); - HDassert(type->deserialize); - - /* Can't see how skip reads could be usefully combined with - * the speculative read flag. Hence disallow. - */ - HDassert(!((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG))); - - /* Call the get_initial_load_size callback, to retrieve the initial size of image */ - if (type->get_initial_load_size(udata, &len) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image size") - HDassert(len > 0); - - /* Check for possible speculative read off the end of the file */ - if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) - if (H5C__verify_len_eoa(f, type, addr, &len, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid len with respect to EOA") - - /* Allocate the buffer for reading the on-disk entry image */ - if (NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") -#if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - -#ifdef H5_HAVE_PARALLEL - if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { - if ((mpi_rank = H5F_mpi_get_rank(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") - if ((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - - /* Get the on-disk entry image */ - if (0 == (type->flags & H5C__CLASS_SKIP_READS)) { - unsigned tries, max_tries; /* The # of read attempts */ - unsigned retries; /* The # of retries */ - htri_t chk_ret; /* return from verify_chksum callback */ - size_t actual_len = len; /* The actual length, after speculative reads have been resolved */ - uint64_t nanosec = 1; /* # of nanoseconds to sleep between retries */ - void *new_image; /* Pointer to image */ - hbool_t len_changed = TRUE; /* Whether to re-check speculative entries */ - - /* Get the # of read attempts */ - max_tries = tries = H5F_GET_READ_ATTEMPTS(f); - - /* - * This do/while loop performs the following till the metadata checksum - * is correct or the file's number of allowed read attempts are reached. - * --read the metadata - * --determine the actual size of the metadata - * --perform checksum verification - */ - do { - if (actual_len != len) { - if (NULL == (new_image = H5MM_realloc(image, len + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()") - image = (uint8_t *)new_image; -#if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - } /* end if */ - -#ifdef H5_HAVE_PARALLEL - if (!coll_access || 0 == mpi_rank) { -#endif /* H5_HAVE_PARALLEL */ - - if (H5F_block_read(f, type->mem_type, addr, len, image) < 0) { - -#ifdef H5_HAVE_PARALLEL - if (coll_access) { - /* Push an error, but still participate in following MPI_Bcast */ - HDmemset(image, 0, len); - HDONE_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") - } - else -#endif - HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") - } - -#ifdef H5_HAVE_PARALLEL - } /* end if */ - /* if the collective metadata read optimization is turned on, - * bcast the metadata read from process 0 to all ranks in the file - * communicator - */ - if (coll_access) { - int buf_size; - - H5_CHECKED_ASSIGN(buf_size, int, len, size_t); - if (MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - - /* If the entry could be read speculatively and the length is still - * changing, check for updating the actual size - */ - if ((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) && len_changed) { - /* Retrieve the actual length */ - actual_len = len; - if (type->get_final_load_size(image, len, udata, &actual_len) < 0) - continue; /* Transfer control to while() and count towards retries */ - - /* Check for the length changing */ - if (actual_len != len) { - /* Verify that the length isn't past the EOA for the file */ - if (H5C__verify_len_eoa(f, type, addr, &actual_len, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA") - - /* Expand buffer to new size */ - if (NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()") - image = (uint8_t *)new_image; -#if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - - if (actual_len > len) { -#ifdef H5_HAVE_PARALLEL - if (!coll_access || 0 == mpi_rank) { -#endif /* H5_HAVE_PARALLEL */ - /* If the thing's image needs to be bigger for a speculatively - * loaded thing, go get the on-disk image again (the extra portion). - */ - if (H5F_block_read(f, type->mem_type, addr + len, actual_len - len, image + len) < - 0) { - -#ifdef H5_HAVE_PARALLEL - if (coll_access) { - /* Push an error, but still participate in following MPI_Bcast */ - HDmemset(image + len, 0, actual_len - len); - HDONE_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't read image") - } - else -#endif - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't read image") - } - -#ifdef H5_HAVE_PARALLEL - } - /* If the collective metadata read optimization is turned on, - * Bcast the metadata read from process 0 to all ranks in the file - * communicator */ - if (coll_access) { - int buf_size; - - H5_CHECKED_ASSIGN(buf_size, int, actual_len - len, size_t); - if (MPI_SUCCESS != - (mpi_code = MPI_Bcast(image + len, buf_size, MPI_BYTE, 0, comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - } /* end if */ - } /* end if (actual_len != len) */ - else { - /* The length has stabilized */ - len_changed = FALSE; - - /* Set the final length */ - len = actual_len; - } /* else */ - } /* end if */ - - /* If there's no way to verify the checksum for a piece of metadata - * (usually because there's no checksum in the file), leave now - */ - if (type->verify_chksum == NULL) - break; - - /* Verify the checksum for the metadata image */ - if ((chk_ret = type->verify_chksum(image, actual_len, udata)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "failure from verify_chksum callback") - if (chk_ret == TRUE) - break; - - /* Sleep for some time */ - H5_nanosleep(nanosec); - nanosec *= 2; /* Double the sleep time next time */ - } while (--tries); - - /* Check for too many tries */ - if (tries == 0) - HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "incorrect metadata checksum after all read attempts") - - /* Calculate and track the # of retries */ - retries = max_tries - tries; - if (retries) /* Does not track 0 retry */ - if (H5F_track_metadata_read_retries(f, (unsigned)type->mem_type, retries) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "cannot track read tries = %u ", retries) - - /* Set the final length (in case it wasn't set earlier) */ - len = actual_len; - } /* end if !H5C__CLASS_SKIP_READS */ - - /* Deserialize the on-disk image into the native memory form */ - if (NULL == (thing = type->deserialize(image, len, udata, &dirty))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image") - - entry = (H5C_cache_entry_t *)thing; - - /* In general, an entry should be clean just after it is loaded. - * - * However, when this code is used in the metadata cache, it is - * possible that object headers will be dirty at this point, as - * the deserialize function will alter object headers if necessary to - * fix an old bug. - * - * In the following assert: - * - * HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) ); - * - * note that type ids 5 & 6 are associated with object headers in the - * metadata cache. - * - * When we get to using H5C for other purposes, we may wish to - * tighten up the assert so that the loophole only applies to the - * metadata cache. - */ - - HDassert((dirty == FALSE) || (type->id == 5 || type->id == 6)); - - entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; - entry->cache_ptr = f->shared->cache; - entry->addr = addr; - entry->size = len; - HDassert(entry->size < H5C_MAX_ENTRY_SIZE); - entry->image_ptr = image; - entry->image_up_to_date = !dirty; - entry->type = type; - entry->is_dirty = dirty; - entry->dirtied = FALSE; - entry->is_protected = FALSE; - entry->is_read_only = FALSE; - entry->ro_ref_count = 0; - entry->is_pinned = FALSE; - entry->in_slist = FALSE; - entry->flush_marker = FALSE; -#ifdef H5_HAVE_PARALLEL - entry->clear_on_unprotect = FALSE; - entry->flush_immediately = FALSE; - entry->coll_access = coll_access; -#endif /* H5_HAVE_PARALLEL */ - entry->flush_in_progress = FALSE; - entry->destroy_in_progress = FALSE; - - entry->ring = H5C_RING_UNDEFINED; - - /* Initialize flush dependency fields */ - entry->flush_dep_parent = NULL; - entry->flush_dep_nparents = 0; - entry->flush_dep_parent_nalloc = 0; - entry->flush_dep_nchildren = 0; - entry->flush_dep_ndirty_children = 0; - entry->flush_dep_nunser_children = 0; - entry->ht_next = NULL; - entry->ht_prev = NULL; - entry->il_next = NULL; - entry->il_prev = NULL; - - entry->next = NULL; - entry->prev = NULL; - -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - entry->aux_next = NULL; - entry->aux_prev = NULL; -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - -#ifdef H5_HAVE_PARALLEL - entry->coll_next = NULL; - entry->coll_prev = NULL; -#endif /* H5_HAVE_PARALLEL */ - - /* initialize cache image related fields */ - entry->include_in_image = FALSE; - entry->lru_rank = 0; - entry->image_dirty = FALSE; - entry->fd_parent_count = 0; - entry->fd_parent_addrs = NULL; - entry->fd_child_count = 0; - entry->fd_dirty_child_count = 0; - entry->image_fd_height = 0; - entry->prefetched = FALSE; - entry->prefetch_type_id = 0; - entry->age = 0; - entry->prefetched_dirty = FALSE; -#ifndef NDEBUG /* debugging field */ - entry->serialization_count = 0; -#endif /* NDEBUG */ - - /* initialize tag list fields */ - entry->tl_next = NULL; - entry->tl_prev = NULL; - entry->tag_info = NULL; - - H5C__RESET_CACHE_ENTRY_STATS(entry); - - ret_value = thing; - -done: - /* Cleanup on error */ - if (NULL == ret_value) { - /* Release resources */ - if (thing && type->free_icr(thing) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed") - if (image) - image = (uint8_t *)H5MM_xfree(image); - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__load_entry() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__make_space_in_cache - * - * Purpose: Attempt to evict cache entries until the index_size - * is at least needed_space below max_cache_size. - * - * In passing, also attempt to bring cLRU_list_size to a - * value greater than min_clean_size. - * - * Depending on circumstances, both of these goals may - * be impossible, as in parallel mode, we must avoid generating - * a write as part of a read (to avoid deadlock in collective - * I/O), and in all cases, it is possible (though hopefully - * highly unlikely) that the protected list may exceed the - * maximum size of the cache. - * - * Thus the function simply does its best, returning success - * unless an error is encountered. - * - * Observe that this function cannot occasion a read. - * - * Return: Non-negative on success/Negative on failure. - * - * Programmer: John Mainzer, 5/14/04 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C__make_space_in_cache(H5F_t *f, size_t space_needed, hbool_t write_permitted) -{ - H5C_t *cache_ptr = f->shared->cache; -#if H5C_COLLECT_CACHE_STATS - int32_t clean_entries_skipped = 0; - int32_t dirty_pf_entries_skipped = 0; - int32_t total_entries_scanned = 0; -#endif /* H5C_COLLECT_CACHE_STATS */ - uint32_t entries_examined = 0; - uint32_t initial_list_len; - size_t empty_space; - hbool_t reentrant_call = FALSE; - hbool_t prev_is_dirty = FALSE; - hbool_t didnt_flush_entry = FALSE; - hbool_t restart_scan; - H5C_cache_entry_t *entry_ptr; - H5C_cache_entry_t *prev_ptr; - H5C_cache_entry_t *next_ptr; - uint32_t num_corked_entries = 0; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size)); - - /* check to see if cache_ptr->msic_in_progress is TRUE. If it, this - * is a re-entrant call via a client callback called in the make - * space in cache process. To avoid an infinite recursion, set - * reentrant_call to TRUE, and goto done. - */ - if (cache_ptr->msic_in_progress) { - reentrant_call = TRUE; - HGOTO_DONE(SUCCEED); - } /* end if */ - - cache_ptr->msic_in_progress = TRUE; - - if (write_permitted) { - restart_scan = FALSE; - initial_list_len = cache_ptr->LRU_list_len; - entry_ptr = cache_ptr->LRU_tail_ptr; - - if (cache_ptr->index_size >= cache_ptr->max_cache_size) - empty_space = 0; - else - empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - - while ((((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) || - ((empty_space + cache_ptr->clean_index_size) < (cache_ptr->min_clean_size))) && - (entries_examined <= (2 * initial_list_len)) && (entry_ptr != NULL)) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(!(entry_ptr->is_protected)); - HDassert(!(entry_ptr->is_read_only)); - HDassert((entry_ptr->ro_ref_count) == 0); - - next_ptr = entry_ptr->next; - prev_ptr = entry_ptr->prev; - - if (prev_ptr != NULL) - prev_is_dirty = prev_ptr->is_dirty; - - if (entry_ptr->is_dirty && (entry_ptr->tag_info && entry_ptr->tag_info->corked)) { - - /* Skip "dirty" corked entries. */ - ++num_corked_entries; - didnt_flush_entry = TRUE; - } - else if (((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && (!entry_ptr->flush_in_progress) && - (!entry_ptr->prefetched_dirty)) { - - didnt_flush_entry = FALSE; - - if (entry_ptr->is_dirty) { - -#if H5C_COLLECT_CACHE_STATS - if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) { - - cache_ptr->entries_scanned_to_make_space++; - } -#endif /* H5C_COLLECT_CACHE_STATS */ - - /* reset entries_removed_counter and - * last_entry_removed_ptr prior to the call to - * H5C__flush_single_entry() so that we can spot - * unexpected removals of entries from the cache, - * and set the restart_scan flag if proceeding - * would be likely to cause us to scan an entry - * that is no longer in the cache. - */ - cache_ptr->entries_removed_counter = 0; - cache_ptr->last_entry_removed_ptr = NULL; - - if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") - - if ((cache_ptr->entries_removed_counter > 1) || - (cache_ptr->last_entry_removed_ptr == prev_ptr)) - - restart_scan = TRUE; - } - else if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size -#ifdef H5_HAVE_PARALLEL - && !(entry_ptr->coll_access) -#endif /* H5_HAVE_PARALLEL */ - ) { -#if H5C_COLLECT_CACHE_STATS - cache_ptr->entries_scanned_to_make_space++; -#endif /* H5C_COLLECT_CACHE_STATS */ - - if (H5C__flush_single_entry(f, entry_ptr, - H5C__FLUSH_INVALIDATE_FLAG | - H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") - } - else { - /* We have enough space so don't flush clean entry. */ -#if H5C_COLLECT_CACHE_STATS - clean_entries_skipped++; -#endif /* H5C_COLLECT_CACHE_STATS */ - didnt_flush_entry = TRUE; - } - -#if H5C_COLLECT_CACHE_STATS - total_entries_scanned++; -#endif /* H5C_COLLECT_CACHE_STATS */ - } - else { - - /* Skip epoch markers, entries that are in the process - * of being flushed, and entries marked as prefetched_dirty - * (occurs in the R/O case only). - */ - didnt_flush_entry = TRUE; - -#if H5C_COLLECT_CACHE_STATS - if (entry_ptr->prefetched_dirty) - dirty_pf_entries_skipped++; -#endif /* H5C_COLLECT_CACHE_STATS */ - } - - if (prev_ptr != NULL) { - - if (didnt_flush_entry) { - - /* epoch markers don't get flushed, and we don't touch - * entries that are in the process of being flushed. - * Hence no need for sanity checks, as we haven't - * flushed anything. Thus just set entry_ptr to prev_ptr - * and go on. - */ - entry_ptr = prev_ptr; - } - else if ((restart_scan) || (prev_ptr->is_dirty != prev_is_dirty) || - (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) || (prev_ptr->is_pinned)) { - - /* something has happened to the LRU -- start over - * from the tail. - */ - restart_scan = FALSE; - entry_ptr = cache_ptr->LRU_tail_ptr; - H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) - } - else { - - entry_ptr = prev_ptr; - } - } - else { - - entry_ptr = NULL; - } - - entries_examined++; - - if (cache_ptr->index_size >= cache_ptr->max_cache_size) { - - empty_space = 0; - } - else { - - empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; - } - - HDassert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size)); - } - -#if H5C_COLLECT_CACHE_STATS - cache_ptr->calls_to_msic++; - - cache_ptr->total_entries_skipped_in_msic += clean_entries_skipped; - cache_ptr->total_dirty_pf_entries_skipped_in_msic += dirty_pf_entries_skipped; - cache_ptr->total_entries_scanned_in_msic += total_entries_scanned; - - if (clean_entries_skipped > cache_ptr->max_entries_skipped_in_msic) { - - cache_ptr->max_entries_skipped_in_msic = clean_entries_skipped; - } - - if (dirty_pf_entries_skipped > cache_ptr->max_dirty_pf_entries_skipped_in_msic) - cache_ptr->max_dirty_pf_entries_skipped_in_msic = dirty_pf_entries_skipped; - - if (total_entries_scanned > cache_ptr->max_entries_scanned_in_msic) { - - cache_ptr->max_entries_scanned_in_msic = total_entries_scanned; - } -#endif /* H5C_COLLECT_CACHE_STATS */ - - /* NEED: work on a better assert for corked entries */ - HDassert((entries_examined > (2 * initial_list_len)) || - ((cache_ptr->pl_size + cache_ptr->pel_size + cache_ptr->min_clean_size) > - cache_ptr->max_cache_size) || - ((cache_ptr->clean_index_size + empty_space) >= cache_ptr->min_clean_size) || - ((num_corked_entries))); -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - - HDassert((entries_examined > (2 * initial_list_len)) || - (cache_ptr->cLRU_list_size <= cache_ptr->clean_index_size)); - HDassert((entries_examined > (2 * initial_list_len)) || - (cache_ptr->dLRU_list_size <= cache_ptr->dirty_index_size)); - -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - } - else { - - HDassert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS); - -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - initial_list_len = cache_ptr->cLRU_list_len; - entry_ptr = cache_ptr->cLRU_tail_ptr; - - while (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) && - (entries_examined <= initial_list_len) && (entry_ptr != NULL)) { - HDassert(!(entry_ptr->is_protected)); - HDassert(!(entry_ptr->is_read_only)); - HDassert((entry_ptr->ro_ref_count) == 0); - HDassert(!(entry_ptr->is_dirty)); - - prev_ptr = entry_ptr->aux_prev; - - if ((!(entry_ptr->prefetched_dirty)) -#ifdef H5_HAVE_PARALLEL - && (!(entry_ptr->coll_access)) -#endif /* H5_HAVE_PARALLEL */ - ) { - if (H5C__flush_single_entry( - f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") - - } /* end if */ - - /* we are scanning the clean LRU, so the serialize function - * will not be called on any entry -- thus there is no - * concern about the list being modified out from under - * this function. - */ - - entry_ptr = prev_ptr; - entries_examined++; - } -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - } - -done: - /* Sanity checks */ - HDassert(cache_ptr->msic_in_progress); - if (!reentrant_call) - cache_ptr->msic_in_progress = FALSE; - HDassert((!reentrant_call) || (cache_ptr->msic_in_progress)); - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__make_space_in_cache() */ - -/*------------------------------------------------------------------------- - * - * Function: H5C_validate_lru_list - * - * Purpose: Debugging function that scans the LRU list for errors. - * - * If an error is detected, the function generates a - * diagnostic and returns FAIL. If no error is detected, - * the function returns SUCCEED. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: John Mainzer, 7/14/05 - * - *------------------------------------------------------------------------- - */ -#if H5C_DO_EXTREME_SANITY_CHECKS -herr_t -H5C_validate_lru_list(H5C_t *cache_ptr) -{ - int32_t len = 0; - size_t size = 0; - H5C_cache_entry_t *entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - if (((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_tail_ptr == NULL)) && - (cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list head/tail check failed") - - if ((cache_ptr->LRU_list_len == 1) && - ((cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr) || (cache_ptr->LRU_head_ptr == NULL) || - (cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list sanity check failed") - - if ((cache_ptr->LRU_list_len >= 1) && - ((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->prev != NULL) || - (cache_ptr->LRU_tail_ptr == NULL) || (cache_ptr->LRU_tail_ptr->next != NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list sanity check failed") - - entry_ptr = cache_ptr->LRU_head_ptr; - while (entry_ptr != NULL) { - if ((entry_ptr != cache_ptr->LRU_head_ptr) && - ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") - - if ((entry_ptr != cache_ptr->LRU_tail_ptr) && - ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") - - if ((entry_ptr->is_pinned) || (entry_ptr->pinned_from_client) || (entry_ptr->pinned_from_cache)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "invalid entry 'pin origin' fields") - - len++; - size += entry_ptr->size; - entry_ptr = entry_ptr->next; - } - - if ((cache_ptr->LRU_list_len != (uint32_t)len) || (cache_ptr->LRU_list_size != size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list length/size check failed") - -done: - if (ret_value != SUCCEED) - HDassert(0); - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_validate_lru_list() */ -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - -/*------------------------------------------------------------------------- - * - * Function: H5C_validate_pinned_entry_list - * - * Purpose: Debugging function that scans the pinned entry list for - * errors. - * - * If an error is detected, the function generates a - * diagnostic and returns FAIL. If no error is detected, - * the function returns SUCCEED. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: John Mainzer, 4/25/14 - * - *------------------------------------------------------------------------- - */ -#if H5C_DO_EXTREME_SANITY_CHECKS -herr_t -H5C_validate_pinned_entry_list(H5C_t *cache_ptr) -{ - int32_t len = 0; - size_t size = 0; - H5C_cache_entry_t *entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - if (((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_tail_ptr == NULL)) && - (cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list head/tail check failed") - - if ((cache_ptr->pel_len == 1) && - ((cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr) || (cache_ptr->pel_head_ptr == NULL) || - (cache_ptr->pel_head_ptr->size != cache_ptr->pel_size))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list sanity check failed") - - if ((cache_ptr->pel_len >= 1) && - ((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_head_ptr->prev != NULL) || - (cache_ptr->pel_tail_ptr == NULL) || (cache_ptr->pel_tail_ptr->next != NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list sanity check failed") - - entry_ptr = cache_ptr->pel_head_ptr; - while (entry_ptr != NULL) { - if ((entry_ptr != cache_ptr->pel_head_ptr) && - ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") - - if ((entry_ptr != cache_ptr->pel_tail_ptr) && - ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") - - if (!entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list contains unpinned entry") - - if (!(entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "invalid entry 'pin origin' fields") - - len++; - size += entry_ptr->size; - entry_ptr = entry_ptr->next; - } - - if ((cache_ptr->pel_len != (uint32_t)len) || (cache_ptr->pel_size != size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list length/size check failed") - -done: - if (ret_value != SUCCEED) - HDassert(0); - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_validate_pinned_entry_list() */ -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - -/*------------------------------------------------------------------------- - * - * Function: H5C_validate_protected_entry_list - * - * Purpose: Debugging function that scans the protected entry list for - * errors. - * - * If an error is detected, the function generates a - * diagnostic and returns FAIL. If no error is detected, - * the function returns SUCCEED. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: John Mainzer, 4/25/14 - * - *------------------------------------------------------------------------- - */ -#if H5C_DO_EXTREME_SANITY_CHECKS -herr_t -H5C_validate_protected_entry_list(H5C_t *cache_ptr) -{ - int32_t len = 0; - size_t size = 0; - H5C_cache_entry_t *entry_ptr = NULL; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - if (((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL)) && - (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list head/tail check failed") - - if ((cache_ptr->pl_len == 1) && - ((cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr) || (cache_ptr->pl_head_ptr == NULL) || - (cache_ptr->pl_head_ptr->size != cache_ptr->pl_size))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list sanity check failed") - - if ((cache_ptr->pl_len >= 1) && - ((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_head_ptr->prev != NULL) || - (cache_ptr->pl_tail_ptr == NULL) || (cache_ptr->pl_tail_ptr->next != NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list sanity check failed") - - entry_ptr = cache_ptr->pl_head_ptr; - while (entry_ptr != NULL) { - if ((entry_ptr != cache_ptr->pl_head_ptr) && - ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") - - if ((entry_ptr != cache_ptr->pl_tail_ptr) && - ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers") - - if (!entry_ptr->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list contains unprotected entry") - - if (entry_ptr->is_read_only && (entry_ptr->ro_ref_count <= 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "read-only entry has non-positive ref count") - - len++; - size += entry_ptr->size; - entry_ptr = entry_ptr->next; - } - - if ((cache_ptr->pl_len != (uint32_t)len) || (cache_ptr->pl_size != size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list length/size check failed") - -done: - if (ret_value != SUCCEED) - HDassert(0); - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_validate_protected_entry_list() */ -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - -/*------------------------------------------------------------------------- - * - * Function: H5C_entry_in_skip_list - * - * Purpose: Debugging function that scans skip list to see if it - * is in present. We need this, as it is possible for - * an entry to be in the skip list twice. - * - * Return: FALSE if the entry is not in the skip list, and TRUE - * if it is. - * - * Programmer: John Mainzer, 11/1/14 - * - *------------------------------------------------------------------------- - */ -#if H5C_DO_SLIST_SANITY_CHECKS -hbool_t -H5C_entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr) -{ - H5SL_node_t *node_ptr; - hbool_t in_slist; - - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->slist_ptr); - - node_ptr = H5SL_first(cache_ptr->slist_ptr); - in_slist = FALSE; - while ((node_ptr != NULL) && (!in_slist)) { - H5C_cache_entry_t *entry_ptr; - - entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->is_dirty); - HDassert(entry_ptr->in_slist); - - if (entry_ptr == target_ptr) - in_slist = TRUE; - else - node_ptr = H5SL_next(node_ptr); - } - - return (in_slist); -} /* H5C_entry_in_skip_list() */ -#endif /* H5C_DO_SLIST_SANITY_CHECKS */ - -/*------------------------------------------------------------------------- - * - * Function: H5C__flush_marked_entries - * - * Purpose: Flushes all marked entries in the cache. - * - * Return: FAIL if error is detected, SUCCEED otherwise. - * - * Programmer: Mike McGreevy - * November 3, 2010 - * - * Changes: Modified function to setup the slist before calling - * H%C_flush_cache(), and take it down afterwards. Note - * that the slist need not be empty after the call to - * H5C_flush_cache() since we are only flushing marked - * entries. Thus must set the clear_slist parameter - * of H5C_set_slist_enabled to TRUE. - * - * JRM -- 5/6/20 - * - *------------------------------------------------------------------------- - */ - -herr_t -H5C__flush_marked_entries(H5F_t *f) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - /* Assertions */ - HDassert(f != NULL); - - /* Enable the slist, as it is needed in the flush */ - if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed") - - /* Flush all marked entries */ - if (H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache") - - /* Disable the slist. Set the clear_slist parameter to TRUE - * since we called H5C_flush_cache() with the - * H5C__FLUSH_MARKED_ENTRIES_FLAG. - */ - if (H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed") - -done: - - FUNC_LEAVE_NOAPI(ret_value) - -} /* H5C__flush_marked_entries */ - -/*------------------------------------------------------------------------- - * - * Function: H5C_cork - * - * Purpose: To cork/uncork/get cork status of an object depending on "action": - * H5C__SET_CORK: - * To cork the object - * Return error if the object is already corked - * H5C__UNCORK: - * To uncork the object - * Return error if the object is not corked - * H5C__GET_CORKED: - * To retrieve the cork status of an object in - * the parameter "corked" - * - * Return: Success: Non-negative - * Failure: Negative - * - * Programmer: Vailin Choi - * January 2014 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked) -{ - H5C_tag_info_t *tag_info = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - /* Assertions */ - HDassert(cache_ptr != NULL); - HDassert(H5F_addr_defined(obj_addr)); - HDassert(action == H5C__SET_CORK || action == H5C__UNCORK || action == H5C__GET_CORKED); - - /* Search the list of corked object addresses in the cache */ - HASH_FIND(hh, cache_ptr->tag_list, &obj_addr, sizeof(haddr_t), tag_info); - - if (H5C__GET_CORKED == action) { - HDassert(corked); - if (tag_info != NULL && tag_info->corked) - *corked = TRUE; - else - *corked = FALSE; - } - else { - /* Sanity check */ - HDassert(H5C__SET_CORK == action || H5C__UNCORK == action); - - /* Perform appropriate action */ - if (H5C__SET_CORK == action) { - /* Check if this is the first entry for this tagged object */ - if (NULL == tag_info) { - /* Allocate new tag info struct */ - if (NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry") - - /* Set the tag for all entries */ - tag_info->tag = obj_addr; - - /* Insert tag info into hash table */ - HASH_ADD(hh, cache_ptr->tag_list, tag, sizeof(haddr_t), tag_info); - } - else { - /* Check for object already corked */ - if (tag_info->corked) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCORK, FAIL, "object already corked") - HDassert(tag_info->entry_cnt > 0 && tag_info->head); - } - - /* Set the corked status for the entire object */ - tag_info->corked = TRUE; - cache_ptr->num_objs_corked++; - } - else { - /* Sanity check */ - if (NULL == tag_info) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNCORK, FAIL, "tag info pointer is NULL") - - /* Check for already uncorked */ - if (!tag_info->corked) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNCORK, FAIL, "object already uncorked") - - /* Set the corked status for the entire object */ - tag_info->corked = FALSE; - cache_ptr->num_objs_corked--; - - /* Remove the tag info from the tag list, if there's no more entries with this tag */ - if (0 == tag_info->entry_cnt) { - /* Sanity check */ - HDassert(NULL == tag_info->head); - - HASH_DELETE(hh, cache_ptr->tag_list, tag_info); - - /* Release the tag info */ - tag_info = H5FL_FREE(H5C_tag_info_t, tag_info); - } - else - HDassert(NULL != tag_info->head); - } - } - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_cork() */ - -/*------------------------------------------------------------------------- - * Function: H5C__mark_flush_dep_dirty() - * - * Purpose: Recursively propagate the flush_dep_ndirty_children flag - * up the dependency chain in response to entry either - * becoming dirty or having its flush_dep_ndirty_children - * increased from 0. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * 11/13/12 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__mark_flush_dep_dirty(H5C_cache_entry_t *entry) -{ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(entry); - - /* Iterate over the parent entries, if any */ - for (u = 0; u < entry->flush_dep_nparents; u++) { - /* Sanity check */ - HDassert(entry->flush_dep_parent[u]->flush_dep_ndirty_children < - entry->flush_dep_parent[u]->flush_dep_nchildren); - - /* Adjust the parent's number of dirty children */ - entry->flush_dep_parent[u]->flush_dep_ndirty_children++; - - /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */ - if (entry->flush_dep_parent[u]->type->notify && - (entry->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, - entry->flush_dep_parent[u]) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry dirty flag set") - } /* end for */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__mark_flush_dep_dirty() */ - -/*------------------------------------------------------------------------- - * Function: H5C__mark_flush_dep_clean() - * - * Purpose: Recursively propagate the flush_dep_ndirty_children flag - * up the dependency chain in response to entry either - * becoming clean or having its flush_dep_ndirty_children - * reduced to 0. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * 11/13/12 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__mark_flush_dep_clean(H5C_cache_entry_t *entry) -{ - int i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(entry); - - /* Iterate over the parent entries, if any */ - /* Note reverse iteration order, in case the callback removes the flush - * dependency - QAK, 2017/08/12 - */ - for (i = ((int)entry->flush_dep_nparents) - 1; i >= 0; i--) { - /* Sanity check */ - HDassert(entry->flush_dep_parent[i]->flush_dep_ndirty_children > 0); - - /* Adjust the parent's number of dirty children */ - entry->flush_dep_parent[i]->flush_dep_ndirty_children--; - - /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */ - if (entry->flush_dep_parent[i]->type->notify && - (entry->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, - entry->flush_dep_parent[i]) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry dirty flag reset") - } /* end for */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__mark_flush_dep_clean() */ - -/*------------------------------------------------------------------------- - * Function: H5C__mark_flush_dep_serialized() - * - * Purpose: Decrement the flush_dep_nunser_children fields of all the - * target entry's flush dependency parents in response to - * the target entry becoming serialized. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 8/30/16 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C__mark_flush_dep_serialized(H5C_cache_entry_t *entry_ptr) -{ - int i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(entry_ptr); - - /* Iterate over the parent entries, if any */ - /* Note reverse iteration order, in case the callback removes the flush - * dependency - QAK, 2017/08/12 - */ - for (i = ((int)entry_ptr->flush_dep_nparents) - 1; i >= 0; i--) { - /* Sanity checks */ - HDassert(entry_ptr->flush_dep_parent); - HDassert(entry_ptr->flush_dep_parent[i]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children > 0); - - /* decrement the parents number of unserialized children */ - entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children--; - - /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */ - if (entry_ptr->flush_dep_parent[i]->type->notify && - (entry_ptr->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, - entry_ptr->flush_dep_parent[i]) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry serialized flag set") - } /* end for */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__mark_flush_dep_serialized() */ - -/*------------------------------------------------------------------------- - * Function: H5C__mark_flush_dep_unserialized() - * - * Purpose: Increment the flush_dep_nunser_children fields of all the - * target entry's flush dependency parents in response to - * the target entry becoming unserialized. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 8/30/16 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C__mark_flush_dep_unserialized(H5C_cache_entry_t *entry_ptr) -{ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(entry_ptr); - - /* Iterate over the parent entries, if any */ - for (u = 0; u < entry_ptr->flush_dep_nparents; u++) { - /* Sanity check */ - HDassert(entry_ptr->flush_dep_parent); - HDassert(entry_ptr->flush_dep_parent[u]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children < - entry_ptr->flush_dep_parent[u]->flush_dep_nchildren); - - /* increment parents number of usserialized children */ - entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children++; - - /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */ - if (entry_ptr->flush_dep_parent[u]->type->notify && - (entry_ptr->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, - entry_ptr->flush_dep_parent[u]) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, - "can't notify parent about child entry serialized flag reset") - } /* end for */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__mark_flush_dep_unserialized() */ - -#ifndef NDEBUG -/*------------------------------------------------------------------------- - * Function: H5C__assert_flush_dep_nocycle() - * - * Purpose: Assert recursively that base_entry is not the same as - * entry, and perform the same assertion on all of entry's - * flush dependency parents. This is used to detect cycles - * created by flush dependencies. - * - * Return: void - * - * Programmer: Neil Fortner - * 12/10/12 - * - *------------------------------------------------------------------------- - */ -static void -H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry, const H5C_cache_entry_t *base_entry) -{ - unsigned u; /* Local index variable */ - - FUNC_ENTER_PACKAGE_NOERR - - /* Sanity checks */ - HDassert(entry); - HDassert(base_entry); - - /* Make sure the entries are not the same */ - HDassert(base_entry != entry); - - /* Iterate over entry's parents (if any) */ - for (u = 0; u < entry->flush_dep_nparents; u++) - H5C__assert_flush_dep_nocycle(entry->flush_dep_parent[u], base_entry); - - FUNC_LEAVE_NOAPI_VOID -} /* H5C__assert_flush_dep_nocycle() */ -#endif /* NDEBUG */ - -/*------------------------------------------------------------------------- - * Function: H5C__serialize_cache - * - * Purpose: Serialize (i.e. construct an on disk image) for all entries - * in the metadata cache including clean entries. - * - * Note that flush dependencies and "flush me last" flags - * must be observed in the serialization process. - * - * Note also that entries may be loaded, flushed, evicted, - * expunged, relocated, resized, or removed from the cache - * during this process, just as these actions may occur during - * a regular flush. - * - * However, we are given that the cache will contain no protected - * entries on entry to this routine (although entries may be - * briefly protected and then unprotected during the serialize - * process). - * - * The objective of this routine is serialize all entries and - * to force all entries into their actual locations on disk. - * - * The initial need for this routine is to settle all entries - * in the cache prior to construction of the metadata cache - * image so that the size of the cache image can be calculated. - * However, I gather that other uses for the routine are - * under consideration. - * - * Return: Non-negative on success/Negative on failure or if there was - * a request to flush all items and something was protected. - * - * Programmer: John Mainzer - * 7/22/15 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C__serialize_cache(H5F_t *f) -{ -#if H5C_DO_SANITY_CHECKS - int i; - uint32_t index_len = 0; - size_t index_size = (size_t)0; - size_t clean_index_size = (size_t)0; - size_t dirty_index_size = (size_t)0; - size_t slist_size = (size_t)0; - uint32_t slist_len = 0; -#endif /* H5C_DO_SANITY_CHECKS */ - H5C_ring_t ring; - H5C_t *cache_ptr; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->slist_ptr); - -#if H5C_DO_SANITY_CHECKS - HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); - HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); - HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - - for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { - index_len += cache_ptr->index_ring_len[i]; - index_size += cache_ptr->index_ring_size[i]; - clean_index_size += cache_ptr->clean_index_ring_size[i]; - dirty_index_size += cache_ptr->dirty_index_ring_size[i]; - - slist_len += cache_ptr->slist_ring_len[i]; - slist_size += cache_ptr->slist_ring_size[i]; - } /* end for */ - - HDassert(cache_ptr->index_len == index_len); - HDassert(cache_ptr->index_size == index_size); - HDassert(cache_ptr->clean_index_size == clean_index_size); - HDassert(cache_ptr->dirty_index_size == dirty_index_size); - HDassert(cache_ptr->slist_len == slist_len); - HDassert(cache_ptr->slist_size == slist_size); -#endif /* H5C_DO_SANITY_CHECKS */ - -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") -#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - -#ifndef NDEBUG - /* if this is a debug build, set the serialization_count field of - * each entry in the cache to zero before we start the serialization. - * This allows us to detect the case in which any entry is serialized - * more than once (a performance issues), and more importantly, the - * case is which any flush dependency parent is serializes more than - * once (a correctness issue). - */ - { - H5C_cache_entry_t *scan_ptr = NULL; - - scan_ptr = cache_ptr->il_head; - while (scan_ptr != NULL) { - HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - scan_ptr->serialization_count = 0; - scan_ptr = scan_ptr->il_next; - } /* end while */ - } /* end block */ -#endif /* NDEBUG */ - - /* set cache_ptr->serialization_in_progress to TRUE, and back - * to FALSE at the end of the function. Must maintain this flag - * to support H5C_get_serialization_in_progress(), which is in - * turn required to support sanity checking in some cache - * clients. - */ - HDassert(!cache_ptr->serialization_in_progress); - cache_ptr->serialization_in_progress = TRUE; - - /* Serialize each ring, starting from the outermost ring and - * working inward. - */ - ring = H5C_RING_USER; - while (ring < H5C_RING_NTYPES) { - HDassert(cache_ptr->close_warning_received); - switch (ring) { - case H5C_RING_USER: - break; - - case H5C_RING_RDFSM: - /* Settle raw data FSM */ - if (!cache_ptr->rdfsm_settled) - if (H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed") - break; - - case H5C_RING_MDFSM: - /* Settle metadata FSM */ - if (!cache_ptr->mdfsm_settled) - if (H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed") - break; - - case H5C_RING_SBE: - case H5C_RING_SB: - break; - - default: - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!") - break; - } /* end switch */ - - if (H5C__serialize_ring(f, ring) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialize ring failed") - - ring++; - } /* end while */ - -#ifndef NDEBUG - /* Verify that no entry has been serialized more than once. - * FD parents with multiple serializations should have been caught - * elsewhere, so no specific check for them here. - */ - { - H5C_cache_entry_t *scan_ptr = NULL; - - scan_ptr = cache_ptr->il_head; - while (scan_ptr != NULL) { - HDassert(scan_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(scan_ptr->serialization_count <= 1); - - scan_ptr = scan_ptr->il_next; - } /* end while */ - } /* end block */ -#endif /* NDEBUG */ - -done: - cache_ptr->serialization_in_progress = FALSE; - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__serialize_cache() */ - -/*------------------------------------------------------------------------- - * Function: H5C__serialize_ring - * - * Purpose: Serialize the entries contained in the specified cache and - * ring. All entries in rings outside the specified ring - * must have been serialized on entry. - * - * If the cache contains protected entries in the specified - * ring, the function will fail, as protected entries cannot - * be serialized. However all unprotected entries in the - * target ring should be serialized before the function - * returns failure. - * - * If flush dependencies appear in the target ring, the - * function makes repeated passes through the index list - * serializing entries in flush dependency order. - * - * All entries outside the H5C_RING_SBE are marked for - * inclusion in the cache image. Entries in H5C_RING_SBE - * and below are marked for exclusion from the image. - * - * Return: Non-negative on success/Negative on failure or if there was - * a request to flush all items and something was protected. - * - * Programmer: John Mainzer - * 9/11/15 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__serialize_ring(H5F_t *f, H5C_ring_t ring) -{ - hbool_t done = FALSE; - H5C_t *cache_ptr; - H5C_cache_entry_t *entry_ptr; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(ring > H5C_RING_UNDEFINED); - HDassert(ring < H5C_RING_NTYPES); - - HDassert(cache_ptr->serialization_in_progress); - - /* The objective here is to serialize all entries in the cache ring - * in flush dependency order. - * - * The basic algorithm is to scan the cache index list looking for - * unserialized entries that are either not in a flush dependency - * relationship, or which have no unserialized children. Any such - * entry is serialized and its flush dependency parents (if any) are - * informed -- allowing them to decrement their userialized child counts. - * - * However, this algorithm is complicated by the ability - * of client serialization callbacks to perform operations on - * on the cache which can result in the insertion, deletion, - * relocation, resize, dirty, flush, eviction, or removal (via the - * take ownership flag) of entries. Changes in the flush dependency - * structure are also possible. - * - * On the other hand, the algorithm is simplified by the fact that - * we are serializing, not flushing. Thus, as long as all entries - * are serialized correctly, it doesn't matter if we have to go back - * and serialize an entry a second time. - * - * These possible actions result in the following modifications to - * the basic algorithm: - * - * 1) In the event of an entry expunge, eviction or removal, we must - * restart the scan as it is possible that the next entry in our - * scan is no longer in the cache. Were we to examine this entry, - * we would be accessing deallocated memory. - * - * 2) A resize, dirty, or insertion of an entry may result in the - * the increment of a flush dependency parent's dirty and/or - * unserialized child count. In the context of serializing the - * the cache, this is a non-issue, as even if we have already - * serialized the parent, it will be marked dirty and its image - * marked out of date if appropriate when the child is serialized. - * - * However, this is a major issue for a flush, as were this to happen - * in a flush, it would violate the invariant that the flush dependency - * feature is intended to enforce. As the metadata cache has no - * control over the behavior of cache clients, it has no way of - * preventing this behaviour. However, it should detect it if at all - * possible. - * - * Do this by maintaining a count of the number of times each entry is - * serialized during a cache serialization. If any flush dependency - * parent is serialized more than once, throw an assertion failure. - * - * 3) An entry relocation will typically change the location of the - * entry in the index list. This shouldn't cause problems as we - * will scan the index list until we make a complete pass without - * finding anything to serialize -- making relocations of either - * the current or next entries irrelevant. - * - * Note that since a relocation may result in our skipping part of - * the index list, we must always do at least one more pass through - * the index list after an entry relocation. - * - * 4) Changes in the flush dependency structure are possible on - * entry insertion, load, expunge, evict, or remove. Destruction - * of a flush dependency has no effect, as it can only relax the - * flush dependencies. Creation of a flush dependency can create - * an unserialized child of a flush dependency parent where all - * flush dependency children were previously serialized. Should - * this child dirty the flush dependency parent when it is serialized, - * the parent will be re-serialized. - * - * Per the discussion of 2) above, this is a non issue for cache - * serialization, and a major problem for cache flush. Using the - * same detection mechanism, throw an assertion failure if this - * condition appears. - * - * Observe that either eviction or removal of entries as a result of - * a serialization is not a problem as long as the flush dependency - * tree does not change beyond the removal of a leaf. - */ - while (!done) { - /* Reset the counters so that we can detect insertions, loads, - * moves, and flush dependency height changes caused by the pre_serialize - * and serialize callbacks. - */ - cache_ptr->entries_loaded_counter = 0; - cache_ptr->entries_inserted_counter = 0; - cache_ptr->entries_relocated_counter = 0; - - done = TRUE; /* set to FALSE if any activity in inner loop */ - entry_ptr = cache_ptr->il_head; - while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - - /* Verify that either the entry is already serialized, or - * that it is assigned to either the target or an inner - * ring. - */ - HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date)); - - /* Skip flush me last entries or inner ring entries */ - if (!entry_ptr->flush_me_last && entry_ptr->ring == ring) { - - /* if we encounter an unserialized entry in the current - * ring that is not marked flush me last, we are not done. - */ - if (!entry_ptr->image_up_to_date) - done = FALSE; - - /* Serialize the entry if its image is not up to date - * and it has no unserialized flush dependency children. - */ - if (!entry_ptr->image_up_to_date && entry_ptr->flush_dep_nunser_children == 0) { - HDassert(entry_ptr->serialization_count == 0); - - /* Serialize the entry */ - if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed") - - HDassert(entry_ptr->flush_dep_nunser_children == 0); - HDassert(entry_ptr->serialization_count == 0); - -#ifndef NDEBUG - /* Increment serialization counter (to detect multiple serializations) */ - entry_ptr->serialization_count++; -#endif /* NDEBUG */ - } /* end if */ - } /* end if */ - - /* Check for the cache being perturbed during the entry serialize */ - if ((cache_ptr->entries_loaded_counter > 0) || (cache_ptr->entries_inserted_counter > 0) || - (cache_ptr->entries_relocated_counter > 0)) { - -#if H5C_COLLECT_CACHE_STATS - H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr); -#endif /* H5C_COLLECT_CACHE_STATS */ - - /* Reset the counters */ - cache_ptr->entries_loaded_counter = 0; - cache_ptr->entries_inserted_counter = 0; - cache_ptr->entries_relocated_counter = 0; - - /* Restart scan */ - entry_ptr = cache_ptr->il_head; - } /* end if */ + node_ptr = H5SL_first(cache_ptr->slist_ptr); + while (node_ptr != NULL) { + entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE, FAIL); + node_ptr = H5SL_first(cache_ptr->slist_ptr); + } + } else - /* Advance to next entry */ - entry_ptr = entry_ptr->il_next; - } /* while ( entry_ptr != NULL ) */ - } /* while ( ! done ) */ - - /* Reset the counters so that we can detect insertions, loads, - * moves, and flush dependency height changes caused by the pre_serialize - * and serialize callbacks. - */ - cache_ptr->entries_loaded_counter = 0; - cache_ptr->entries_inserted_counter = 0; - cache_ptr->entries_relocated_counter = 0; - - /* At this point, all entries not marked "flush me last" and in - * the current ring or outside it should be serialized and have up - * to date images. Scan the index list again to serialize the - * "flush me last" entries (if they are in the current ring) and to - * verify that all other entries have up to date images. - */ - entry_ptr = cache_ptr->il_head; - while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring > H5C_RING_UNDEFINED); - HDassert(entry_ptr->ring < H5C_RING_NTYPES); - HDassert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date)); - - if (entry_ptr->ring == ring) { - if (entry_ptr->flush_me_last) { - if (!entry_ptr->image_up_to_date) { - HDassert(entry_ptr->serialization_count == 0); - HDassert(entry_ptr->flush_dep_nunser_children == 0); - - /* Serialize the entry */ - if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed") - - /* Check for the cache changing */ - if ((cache_ptr->entries_loaded_counter > 0) || - (cache_ptr->entries_inserted_counter > 0) || - (cache_ptr->entries_relocated_counter > 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "flush_me_last entry serialization triggered restart") - - HDassert(entry_ptr->flush_dep_nunser_children == 0); - HDassert(entry_ptr->serialization_count == 0); -#ifndef NDEBUG - /* Increment serialization counter (to detect multiple serializations) */ - entry_ptr->serialization_count++; -#endif /* NDEBUG */ - } /* end if */ - } /* end if */ - else { - HDassert(entry_ptr->image_up_to_date); - HDassert(entry_ptr->serialization_count <= 1); - HDassert(entry_ptr->flush_dep_nunser_children == 0); - } /* end else */ - } /* if ( entry_ptr->ring == ring ) */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "slist not empty?"); + } + + cache_ptr->slist_enabled = FALSE; - entry_ptr = entry_ptr->il_next; - } /* while ( entry_ptr != NULL ) */ + assert(0 == cache_ptr->slist_len); + assert(0 == cache_ptr->slist_size); + } done: - HDassert(cache_ptr->serialization_in_progress); FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__serialize_ring() */ +} /* H5C_set_slist_enabled() */ /*------------------------------------------------------------------------- - * Function: H5C__serialize_single_entry + * Function: H5C_unsettle_ring() * - * Purpose: Serialize the cache entry pointed to by the entry_ptr - * parameter. + * Purpose: Advise the metadata cache that the specified free space + * manager ring is no longer settled (if it was on entry). * - * Return: Non-negative on success/Negative on failure + * If the target free space manager ring is already + * unsettled, do nothing, and return SUCCEED. + * + * If the target free space manager ring is settled, and + * we are not in the process of a file shutdown, mark + * the ring as unsettled, and return SUCCEED. + * + * If the target free space manager is settled, and we + * are in the process of a file shutdown, post an error + * message, and return FAIL. * - * Programmer: John Mainzer, 7/24/15 + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ -static herr_t -H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) +herr_t +H5C_unsettle_ring(H5F_t *f, H5C_ring_t ring) { + H5C_t *cache_ptr; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(!entry_ptr->prefetched); - HDassert(!entry_ptr->image_up_to_date); - HDassert(entry_ptr->is_dirty); - HDassert(!entry_ptr->is_protected); - HDassert(!entry_ptr->flush_in_progress); - HDassert(entry_ptr->type); - - /* Set entry_ptr->flush_in_progress to TRUE so the the target entry - * will not be evicted out from under us. Must set it back to FALSE - * when we are done. - */ - entry_ptr->flush_in_progress = TRUE; - - /* Allocate buffer for the entry image if required. */ - if (NULL == entry_ptr->image_ptr) { - HDassert(entry_ptr->size > 0); - if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") -#if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - } /* end if */ + assert(f); + assert(f->shared); + assert(f->shared->cache); + assert((H5C_RING_RDFSM == ring) || (H5C_RING_MDFSM == ring)); + cache_ptr = f->shared->cache; + + switch (ring) { + case H5C_RING_RDFSM: + if (cache_ptr->rdfsm_settled) { + if (cache_ptr->close_warning_received) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle"); + cache_ptr->rdfsm_settled = FALSE; + } /* end if */ + break; - /* Generate image for entry */ - if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "Can't generate image for cache entry") + case H5C_RING_MDFSM: + if (cache_ptr->mdfsm_settled) { + if (cache_ptr->close_warning_received) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle"); + cache_ptr->mdfsm_settled = FALSE; + } /* end if */ + break; - /* Reset the flush_in progress flag */ - entry_ptr->flush_in_progress = FALSE; + default: + assert(FALSE); /* this should be un-reachable */ + break; + } /* end switch */ done: - HDassert((ret_value != SUCCEED) || (!entry_ptr->flush_in_progress)); - HDassert((ret_value != SUCCEED) || (entry_ptr->image_up_to_date)); FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__serialize_single_entry() */ +} /* H5C_unsettle_ring() */ /*------------------------------------------------------------------------- - * Function: H5C__generate_image - * - * Purpose: Serialize an entry and generate its image. + * Function: H5C_validate_resize_config() * - * Note: This may cause the entry to be re-sized and/or moved in - * the cache. + * Purpose: Run a sanity check on the specified sections of the + * provided instance of struct H5C_auto_size_ctl_t. * - * As we will not update the metadata cache's data structures - * until we we finish the write, we must touch up these - * data structures for size and location changes even if we - * are about to delete the entry from the cache (i.e. on a - * flush destroy). + * Do nothing and return SUCCEED if no errors are detected, + * and flag an error and return FAIL otherwise. * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * 2/10/16 - * - * Changes: Updated sanity checks for the possibility that the skip - * list is disabled. - * JRM 5/16/20 - * *------------------------------------------------------------------------- */ -static herr_t -H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) +herr_t +H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr, unsigned int tests) { - haddr_t new_addr = HADDR_UNDEF; - haddr_t old_addr = HADDR_UNDEF; - size_t new_len = 0; - unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(f); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(!entry_ptr->image_up_to_date); - HDassert(entry_ptr->is_dirty); - HDassert(!entry_ptr->is_protected); - HDassert(entry_ptr->type); - - /* make note of the entry's current address */ - old_addr = entry_ptr->addr; - - /* Call client's pre-serialize callback, if there's one */ - if ((entry_ptr->type->pre_serialize) && - ((entry_ptr->type->pre_serialize)(f, (void *)entry_ptr, entry_ptr->addr, entry_ptr->size, &new_addr, - &new_len, &serialize_flags) < 0)) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry") - - /* Check for any flags set in the pre-serialize callback */ - if (serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { - - /* Check for unexpected flags from serialize callback */ - if (serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | H5C__SERIALIZE_MOVED_FLAG)) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)") - -#ifdef H5_HAVE_PARALLEL - /* In the parallel case, resizes and moves in - * the serialize operation can cause problems. - * If they occur, scream and die. - * - * At present, in the parallel case, the aux_ptr - * will only be set if there is more than one - * process. Thus we can use this to detect - * the parallel case. - * - * This works for now, but if we start using the - * aux_ptr for other purposes, we will have to - * change this test accordingly. - * - * NB: While this test detects entryies that attempt - * to resize or move themselves during a flush - * in the parallel case, it will not detect an - * entry that dirties, resizes, and/or moves - * other entries during its flush. - * - * From what Quincey tells me, this test is - * sufficient for now, as any flush routine that - * does the latter will also do the former. - * - * If that ceases to be the case, further - * tests will be necessary. - */ - if (cache_ptr->aux_ptr != NULL) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occurred in parallel case") -#endif - - /* If required, resize the buffer and update the entry and the cache - * data structures - */ - if (serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { - - /* Sanity check */ - HDassert(new_len > 0); + herr_t ret_value = SUCCEED; /* Return value */ - /* Allocate a new image buffer */ - if (NULL == - (entry_ptr->image_ptr = H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE))) + FUNC_ENTER_NOAPI(FAIL) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "memory allocation failed for on disk image buffer") + if (config_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL config_ptr on entry"); -#if H5C_DO_MEMORY_SANITY_CHECKS - H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + if (config_ptr->version != H5C__CURR_AUTO_SIZE_CTL_VER) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown config version"); - /* Update statistics for resizing the entry */ - H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); + if ((tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0) { + if (config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big"); + if (config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small"); + if (config_ptr->min_size > config_ptr->max_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size"); + if (config_ptr->set_initial_size && ((config_ptr->initial_size < config_ptr->min_size) || + (config_ptr->initial_size > config_ptr->max_size))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "initial_size must be in the interval [min_size, max_size]"); + if ((config_ptr->min_clean_fraction < 0.0) || (config_ptr->min_clean_fraction > 1.0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "min_clean_fraction must be in the interval [0.0, 1.0]"); + if (config_ptr->epoch_length < H5C__MIN_AR_EPOCH_LENGTH) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too small"); + if (config_ptr->epoch_length > H5C__MAX_AR_EPOCH_LENGTH) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epoch_length too big"); + } /* H5C_RESIZE_CFG__VALIDATE_GENERAL */ - /* Update the hash table for the size change */ - H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len, entry_ptr, - !(entry_ptr->is_dirty)); + if ((tests & H5C_RESIZE_CFG__VALIDATE_INCREMENT) != 0) { + if ((config_ptr->incr_mode != H5C_incr__off) && (config_ptr->incr_mode != H5C_incr__threshold)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid incr_mode"); - /* The entry can't be protected since we are in the process of - * flushing it. Thus we must update the replacement policy data - * structures for the size change. The macro deals with the pinned - * case. - */ - H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); + if (config_ptr->incr_mode == H5C_incr__threshold) { + if ((config_ptr->lower_hr_threshold < 0.0) || (config_ptr->lower_hr_threshold > 1.0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "lower_hr_threshold must be in the range [0.0, 1.0]"); + if (config_ptr->increment < 1.0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0"); - /* As we haven't updated the cache data structures for - * for the flush or flush destroy yet, the entry should - * be in the slist if the slist is enabled. Since - * H5C__UPDATE_SLIST_FOR_SIZE_CHANGE() is a no-op if the - * slist is enabled, call it un-conditionally. + /* no need to check max_increment, as it is a size_t, + * and thus must be non-negative. */ - HDassert(entry_ptr->is_dirty); - HDassert((entry_ptr->in_slist) || (!cache_ptr->slist_enabled)); - - H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len); - - /* Finally, update the entry for its new size */ - entry_ptr->size = new_len; - - } /* end if */ - - /* If required, udate the entry and the cache data structures - * for a move - */ - if (serialize_flags & H5C__SERIALIZE_MOVED_FLAG) { - - /* Update stats and entries relocated counter */ - H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) - - /* We must update cache data structures for the change in address */ - if (entry_ptr->addr == old_addr) { - - /* Delete the entry from the hash table and the slist */ - H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL); - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE); - - /* Update the entry for its new address */ - entry_ptr->addr = new_addr; - - /* And then reinsert in the index and slist */ - H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL); - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + } /* H5C_incr__threshold */ - } /* end if */ - else { /* move is already done for us -- just do sanity checks */ + switch (config_ptr->flash_incr_mode) { + case H5C_flash_incr__off: + /* nothing to do here */ + break; - HDassert(entry_ptr->addr == new_addr); - } - } /* end if */ - } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */ + case H5C_flash_incr__add_space: + if ((config_ptr->flash_multiple < 0.1) || (config_ptr->flash_multiple > 10.0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "flash_multiple must be in the range [0.1, 10.0]"); + if ((config_ptr->flash_threshold < 0.1) || (config_ptr->flash_threshold > 1.0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "flash_threshold must be in the range [0.1, 1.0]"); + break; - /* Serialize object into buffer */ - if (entry_ptr->type->serialize(f, entry_ptr->image_ptr, entry_ptr->size, (void *)entry_ptr) < 0) + default: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid flash_incr_mode"); + break; + } /* end switch */ + } /* H5C_RESIZE_CFG__VALIDATE_INCREMENT */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry") + if ((tests & H5C_RESIZE_CFG__VALIDATE_DECREMENT) != 0) { + if ((config_ptr->decr_mode != H5C_decr__off) && (config_ptr->decr_mode != H5C_decr__threshold) && + (config_ptr->decr_mode != H5C_decr__age_out) && + (config_ptr->decr_mode != H5C_decr__age_out_with_threshold)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid decr_mode"); -#if H5C_DO_MEMORY_SANITY_CHECKS - HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE)); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + if (config_ptr->decr_mode == H5C_decr__threshold) { + if (config_ptr->upper_hr_threshold > 1.0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "upper_hr_threshold must be <= 1.0"); + if ((config_ptr->decrement > 1.0) || (config_ptr->decrement < 0.0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "decrement must be in the interval [0.0, 1.0]"); - entry_ptr->image_up_to_date = TRUE; + /* no need to check max_decrement as it is a size_t + * and thus must be non-negative. + */ + } /* H5C_decr__threshold */ - /* Propagate the fact that the entry is serialized up the - * flush dependency chain if appropriate. Since the image must - * have been out of date for this function to have been called - * (see assertion on entry), no need to check that -- only check - * for flush dependency parents. - */ - HDassert(entry_ptr->flush_dep_nunser_children == 0); + if ((config_ptr->decr_mode == H5C_decr__age_out) || + (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) { + if (config_ptr->epochs_before_eviction < 1) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction must be positive"); + if (config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big"); + if (config_ptr->apply_empty_reserve && + (config_ptr->empty_reserve > 1.0 || config_ptr->empty_reserve < 0.0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]"); - if (entry_ptr->flush_dep_nparents > 0) { + /* no need to check max_decrement as it is a size_t + * and thus must be non-negative. + */ + } /* H5C_decr__age_out || H5C_decr__age_out_with_threshold */ - if (H5C__mark_flush_dep_serialized(entry_ptr) < 0) + if (config_ptr->decr_mode == H5C_decr__age_out_with_threshold) + if ((config_ptr->upper_hr_threshold > 1.0) || (config_ptr->upper_hr_threshold < 0.0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "upper_hr_threshold must be in the interval [0.0, 1.0]"); + } /* H5C_RESIZE_CFG__VALIDATE_DECREMENT */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "Can't propagate serialization status to fd parents") - } + if ((tests & H5C_RESIZE_CFG__VALIDATE_INTERACTIONS) != 0) { + if ((config_ptr->incr_mode == H5C_incr__threshold) && + ((config_ptr->decr_mode == H5C_decr__threshold) || + (config_ptr->decr_mode == H5C_decr__age_out_with_threshold)) && + (config_ptr->lower_hr_threshold >= config_ptr->upper_hr_threshold)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conflicting threshold fields in config"); + } /* H5C_RESIZE_CFG__VALIDATE_INTERACTIONS */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__generate_image */ +} /* H5C_validate_resize_config() */ /*------------------------------------------------------------------------- + * Function: H5C_cork * - * Function: H5C_remove_entry - * - * Purpose: Remove an entry from the cache. Must be not protected, pinned, - * dirty, involved in flush dependencies, etc. - * - * Return: Non-negative on success/Negative on failure + * Purpose: To cork/uncork/get cork status of an object depending on "action": + * H5C__SET_CORK: + * To cork the object + * Return error if the object is already corked + * H5C__UNCORK: + * To uncork the object + * Return error if the object is not corked + * H5C__GET_CORKED: + * To retrieve the cork status of an object in + * the parameter "corked" * - * Programmer: Quincey Koziol - * September 17, 2016 + * Return: Success: Non-negative + * Failure: Negative * *------------------------------------------------------------------------- */ herr_t -H5C_remove_entry(void *_entry) +H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked) { - H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry to remove */ - H5C_t *cache; /* Cache for file */ - herr_t ret_value = SUCCEED; /* Return value */ + H5C_tag_info_t *tag_info = NULL; + herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_NOAPI_NOINIT - /* Sanity checks */ - HDassert(entry); - HDassert(entry->ring != H5C_RING_UNDEFINED); - cache = entry->cache_ptr; - HDassert(cache); - HDassert(cache->magic == H5C__H5C_T_MAGIC); - - /* Check for error conditions */ - if (entry->is_dirty) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove dirty entry from cache") - if (entry->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove protected entry from cache") - if (entry->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove pinned entry from cache") - /* NOTE: If these two errors are getting tripped because the entry is - * in a flush dependency with a freedspace entry, move the checks - * after the "before evict" message is sent, and add the - * "child being evicted" message to the "before evict" notify - * section below. QAK - 2017/08/03 - */ - if (entry->flush_dep_nparents > 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, - "can't remove entry with flush dependency parents from cache") - if (entry->flush_dep_nchildren > 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, - "can't remove entry with flush dependency children from cache") - - /* Additional internal cache consistency checks */ - HDassert(!entry->in_slist); - HDassert(!entry->flush_marker); - HDassert(!entry->flush_in_progress); - - /* Note that the algorithm below is (very) similar to the set of operations - * in H5C__flush_single_entry() and should be kept in sync with changes - * to that code. - QAK, 2016/11/30 - */ + /* Assertions */ + assert(cache_ptr != NULL); + assert(H5_addr_defined(obj_addr)); + assert(action == H5C__SET_CORK || action == H5C__UNCORK || action == H5C__GET_CORKED); - /* Update stats, as if we are "destroying" and taking ownership of the entry */ - H5C__UPDATE_STATS_FOR_EVICTION(cache, entry, TRUE) + /* Search the list of corked object addresses in the cache */ + HASH_FIND(hh, cache_ptr->tag_list, &obj_addr, sizeof(haddr_t), tag_info); - /* If the entry's type has a 'notify' callback, send a 'before eviction' - * notice while the entry is still fully integrated in the cache. - */ - if (entry->type->notify && (entry->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict") - - /* Update the cache internal data structures as appropriate for a destroy. - * Specifically: - * 1) Delete it from the index - * 2) Delete it from the collective read access list - * 3) Update the replacement policy for eviction - * 4) Remove it from the tag list for this object - */ + if (H5C__GET_CORKED == action) { + assert(corked); + if (tag_info != NULL && tag_info->corked) + *corked = TRUE; + else + *corked = FALSE; + } + else { + /* Sanity check */ + assert(H5C__SET_CORK == action || H5C__UNCORK == action); - H5C__DELETE_FROM_INDEX(cache, entry, FAIL) + /* Perform appropriate action */ + if (H5C__SET_CORK == action) { + /* Check if this is the first entry for this tagged object */ + if (NULL == tag_info) { + /* Allocate new tag info struct */ + if (NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry"); -#ifdef H5_HAVE_PARALLEL - /* Check for collective read access flag */ - if (entry->coll_access) { - entry->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache, entry, FAIL) - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ + /* Set the tag for all entries */ + tag_info->tag = obj_addr; - H5C__UPDATE_RP_FOR_EVICTION(cache, entry, FAIL) + /* Insert tag info into hash table */ + HASH_ADD(hh, cache_ptr->tag_list, tag, sizeof(haddr_t), tag_info); + } + else { + /* Check for object already corked */ + if (tag_info->corked) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCORK, FAIL, "object already corked"); + assert(tag_info->entry_cnt > 0 && tag_info->head); + } - /* Remove entry from tag list */ - if (H5C__untag_entry(cache, entry) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list") + /* Set the corked status for the entire object */ + tag_info->corked = TRUE; + cache_ptr->num_objs_corked++; + } + else { + /* Sanity check */ + if (NULL == tag_info) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNCORK, FAIL, "tag info pointer is NULL"); - /* Increment entries_removed_counter and set last_entry_removed_ptr. - * As we me be about to free the entry, recall that last_entry_removed_ptr - * must NEVER be dereferenced. - * - * Recall that these fields are maintained to allow functions that perform - * scans of lists of entries to detect the unexpected removal of entries - * (via expunge, eviction, or take ownership at present), so that they can - * re-start their scans if necessary. - * - * Also check if the entry we are watching for removal is being - * removed (usually the 'next' entry for an iteration) and reset - * it to indicate that it was removed. - */ - cache->entries_removed_counter++; - cache->last_entry_removed_ptr = entry; - if (entry == cache->entry_watched_for_removal) - cache->entry_watched_for_removal = NULL; + /* Check for already uncorked */ + if (!tag_info->corked) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNCORK, FAIL, "object already uncorked"); - /* Internal cache data structures should now be up to date, and - * consistent with the status of the entry. - * - * Now clean up internal cache fields if appropriate. - */ + /* Set the corked status for the entire object */ + tag_info->corked = FALSE; + cache_ptr->num_objs_corked--; - /* Free the buffer for the on disk image */ - if (entry->image_ptr != NULL) - entry->image_ptr = H5MM_xfree(entry->image_ptr); + /* Remove the tag info from the tag list, if there's no more entries with this tag */ + if (0 == tag_info->entry_cnt) { + /* Sanity check */ + assert(NULL == tag_info->head); - /* Reset the pointer to the cache the entry is within */ - entry->cache_ptr = NULL; + HASH_DELETE(hh, cache_ptr->tag_list, tag_info); - /* Client is taking ownership of the entry. Set bad magic here so the - * cache will choke unless the entry is re-inserted properly - */ - entry->magic = H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC; + /* Release the tag info */ + tag_info = H5FL_FREE(H5C_tag_info_t, tag_info); + } + else + assert(NULL != tag_info->head); + } + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__remove_entry() */ +} /* H5C_cork() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5CS.c b/externals/coda-oss/modules/drivers/hdf5/source/H5CS.c index 17dc7a33bd..d8ee8d7f5b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5CS.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5CS.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -72,9 +71,6 @@ H5CS_t H5CS_stack_g[1]; * * Failure: NULL * - * Programmer: Quincey Koziol - * February 6, 2003 - * *------------------------------------------------------------------------- */ static H5CS_t * @@ -91,10 +87,10 @@ H5CS__get_stack(void) fstack = (H5CS_t *)LocalAlloc( LPTR, sizeof(H5CS_t)); /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ #else - fstack = (H5CS_t *)HDmalloc( - sizeof(H5CS_t)); /* Don't use H5MM_malloc() here, it causes infinite recursion */ + fstack = + (H5CS_t *)malloc(sizeof(H5CS_t)); /* Don't use H5MM_malloc() here, it causes infinite recursion */ #endif /* H5_HAVE_WIN_THREADS */ - HDassert(fstack); + assert(fstack); /* Set the thread-specific info */ fstack->nused = 0; @@ -119,9 +115,6 @@ H5CS__get_stack(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, February 6, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -134,21 +127,21 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream) FUNC_ENTER_NOAPI_NOERR_NOFS /* Sanity check */ - HDassert(fstack); + assert(fstack); /* Default to outputting information to stderr */ if (!stream) stream = stderr; - HDfprintf(stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g); + fprintf(stream, "HDF5-DIAG: Function stack from %s ", H5_lib_vers_info_g); /* try show the process or thread id in multiple processes cases*/ - HDfprintf(stream, "thread %" PRIu64 ".", H5TS_thread_id()); + fprintf(stream, "thread %" PRIu64 ".", H5TS_thread_id()); if (fstack && fstack->nused > 0) - HDfprintf(stream, " Back trace follows."); + fprintf(stream, " Back trace follows."); HDfputc('\n', stream); for (i = fstack->nused - 1; i >= 0; --i) - HDfprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->rec[i]); + fprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->rec[i]); FUNC_LEAVE_NOAPI_NOFS(SUCCEED) } /* end H5CS_print_stack() */ @@ -161,9 +154,6 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, February 6, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -175,19 +165,19 @@ H5CS_push(const char *func_name) FUNC_ENTER_NOAPI_NOERR_NOFS /* Sanity check */ - HDassert(fstack); - HDassert(fstack->nused <= fstack->nalloc); - HDassert(func_name); + assert(fstack); + assert(fstack->nused <= fstack->nalloc); + assert(func_name); /* Check if we need to expand the stack of records */ if (fstack->nused == fstack->nalloc) { size_t na = MAX((fstack->nalloc * 2), H5CS_MIN_NSLOTS); /* Don't use H5MM_realloc here */ - const char **x = (const char **)HDrealloc(fstack->rec, na * sizeof(const char *)); + const char **x = (const char **)realloc(fstack->rec, na * sizeof(const char *)); /* (Avoid returning an error from this routine, currently -QAK) */ - HDassert(x); + assert(x); fstack->rec = x; fstack->nalloc = na; } /* end if */ @@ -206,9 +196,6 @@ H5CS_push(const char *func_name) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, February 6, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -220,13 +207,13 @@ H5CS_pop(void) FUNC_ENTER_NOAPI_NOERR_NOFS /* Sanity check */ - HDassert(fstack); - HDassert(fstack->nused > 0); + assert(fstack); + assert(fstack->nused > 0); /* Pop the function. */ fstack->nused--; - FUNC_LEAVE_NOAPI_NOFS(SUCCEED); + FUNC_LEAVE_NOAPI_NOFS(SUCCEED) } /* end H5CS_pop() */ /*------------------------------------------------------------------------- @@ -236,9 +223,6 @@ H5CS_pop(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, August 9, 2005 - * *------------------------------------------------------------------------- */ H5CS_t * @@ -253,18 +237,18 @@ H5CS_copy_stack(void) FUNC_ENTER_NOAPI_NOFS /* Sanity check */ - HDassert(old_stack); + assert(old_stack); /* Allocate a new stack */ /* (Don't use library allocate code, since this code stack supports it) */ - if (NULL == (new_stack = HDcalloc(1, sizeof(H5CS_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack") - if (NULL == (new_stack->rec = HDcalloc(old_stack->nused, sizeof(const char *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack records") + if (NULL == (new_stack = calloc(1, sizeof(H5CS_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack"); + if (NULL == (new_stack->rec = calloc(old_stack->nused, sizeof(const char *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack records"); /* Copy pointers on old stack to new one */ /* (Strings don't need to be duplicated, they are statically allocated) */ - HDmemcpy(new_stack->rec, old_stack->rec, sizeof(char *) * old_stack->nused); + memcpy(new_stack->rec, old_stack->rec, sizeof(char *) * old_stack->nused); new_stack->nused = new_stack->nalloc = old_stack->nused; /* Set the return value */ @@ -281,9 +265,6 @@ H5CS_copy_stack(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, August 9, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -295,18 +276,18 @@ H5CS_close_stack(H5CS_t *stack) FUNC_ENTER_NOAPI_NOERR_NOFS /* Sanity check */ - HDassert(stack); + assert(stack); /* Free stack */ /* The function name string are statically allocated (by the compiler) * and are not allocated, so there's no need to free them. */ if (stack->rec) { - HDfree(stack->rec); + free(stack->rec); stack->rec = NULL; } /* end if */ if (stack) - HDfree(stack); + free(stack); FUNC_LEAVE_NOAPI_NOFS(SUCCEED) } /* end H5CS_close_stack() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5CX.c b/externals/coda-oss/modules/drivers/hdf5/source/H5CX.c index 24f10d9dca..49f2274591 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5CX.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5CX.c @@ -11,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Monday, February 19, 2018 - * * Purpose: * Keep a set of "psuedo-global" information for an API call. This * general corresponds to the DXPL for the call, along with cached @@ -67,7 +64,7 @@ if (NULL == (*head)->ctx.PL) \ /* Get the property list pointer */ \ if (NULL == ((*head)->ctx.PL = (H5P_genplist_t *)H5I_object((*head)->ctx.H5_GLUE(PL, _id)))) \ - HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, (FAILVAL), "can't get property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, (FAILVAL), "can't get property list"); /* Common macro for the duplicated code to retrieve properties from a property list */ #define H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \ @@ -81,7 +78,7 @@ \ /* Get the property */ \ if (H5P_get((*head)->ctx.PL, (PROP_NAME), &(*head)->ctx.PROP_FIELD) < 0) \ - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't retrieve value from API context") \ + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't retrieve value from API context"); \ } /* end else */ \ \ /* Mark the field as valid */ \ @@ -94,14 +91,12 @@ H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \ } /* end if */ -#ifdef H5_HAVE_PARALLEL /* Macro for the duplicated code to retrieve possibly set properties from a property list */ #define H5CX_RETRIEVE_PROP_VALID_SET(PL, DEF_PL, PROP_NAME, PROP_FIELD) \ /* Check if the value has been retrieved already */ \ if (!((*head)->ctx.H5_GLUE(PROP_FIELD, _valid) || (*head)->ctx.H5_GLUE(PROP_FIELD, _set))) { \ H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \ - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ + } /* end if */ #if defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY) /* Macro for the duplicated code to test and set properties for a property list */ @@ -115,7 +110,7 @@ H5CX_RETRIEVE_PLIST(dxpl, FAIL) \ \ if ((check_prop = H5P_exist_plist((*head)->ctx.dxpl, PROP_NAME)) < 0) \ - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error checking for property") \ + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error checking for property"); \ } /* end if */ \ \ /* If property was already set or exists (for first set), update it */ \ @@ -127,7 +122,6 @@ } #endif /* defined(H5_HAVE_PARALLEL) && defined(H5_HAVE_INSTRUMENTED_LIBRARY) */ -#ifdef H5_HAVE_PARALLEL /* Macro for the duplicated code to test and set properties for a property list */ #define H5CX_SET_PROP(PROP_NAME, PROP_FIELD) \ if ((*head)->ctx.H5_GLUE(PROP_FIELD, _set)) { \ @@ -136,9 +130,8 @@ \ /* Set the property */ \ if (H5P_set((*head)->ctx.dxpl, PROP_NAME, &(*head)->ctx.PROP_FIELD) < 0) \ - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting data xfer property") \ - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTSET, NULL, "error setting data xfer property"); \ + } /* end if */ /******************/ /* Local Typedefs */ @@ -242,16 +235,20 @@ typedef struct H5CX_t { unsigned mpio_chunk_opt_ratio; /* Collective chunk ratio (H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME) */ hbool_t mpio_chunk_opt_ratio_valid; /* Whether collective chunk ratio is valid */ #endif /* H5_HAVE_PARALLEL */ - H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */ - hbool_t err_detect_valid; /* Whether error detection info is valid */ - H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */ - hbool_t filter_cb_valid; /* Whether filter callback function is valid */ - H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */ - hbool_t data_transform_valid; /* Whether data transform info is valid */ - H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */ - hbool_t vl_alloc_info_valid; /* Whether VL datatype alloc info is valid */ - H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */ - hbool_t dt_conv_cb_valid; /* Whether datatype conversion struct is valid */ + H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */ + hbool_t err_detect_valid; /* Whether error detection info is valid */ + H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */ + hbool_t filter_cb_valid; /* Whether filter callback function is valid */ + H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */ + hbool_t data_transform_valid; /* Whether data transform info is valid */ + H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */ + hbool_t vl_alloc_info_valid; /* Whether VL datatype alloc info is valid */ + H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */ + hbool_t dt_conv_cb_valid; /* Whether datatype conversion struct is valid */ + H5D_selection_io_mode_t selection_io_mode; /* Selection I/O mode (H5D_XFER_SELECTION_IO_MODE_NAME) */ + hbool_t selection_io_mode_valid; /* Whether selection I/O mode is valid */ + hbool_t modify_write_buf; /* Whether the library can modify write buffers */ + hbool_t modify_write_buf_valid; /* Whether the modify_write_buf field is valid */ /* Return-only DXPL properties to return to application */ #ifdef H5_HAVE_PARALLEL @@ -297,9 +294,13 @@ typedef struct H5CX_t { hbool_t mpio_coll_rank0_bcast; /* Instrumented "collective chunk multi ratio ind" value (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */ hbool_t - mpio_coll_rank0_bcast_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */ -#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ -#endif /* H5_HAVE_PARALLEL */ + mpio_coll_rank0_bcast_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */ +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ +#endif /* H5_HAVE_PARALLEL */ + uint32_t no_selection_io_cause; /* Reason for not performing selection I/O + (H5D_XFER_NO_SELECTION_IO_CAUSE_NAME) */ + hbool_t no_selection_io_cause_set; /* Whether reason for not performing selection I/O is set */ + hbool_t no_selection_io_cause_valid; /* Whether reason for not performing selection I/O is valid */ /* Cached LCPL properties */ H5T_cset_t encoding; /* Link name character encoding */ @@ -370,15 +371,19 @@ typedef struct H5CX_dxpl_cache_t { uint32_t mpio_global_no_coll_cause; /* Global reason for breaking collective I/O (H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME) */ H5FD_mpio_chunk_opt_t - mpio_chunk_opt_mode; /* Collective chunk option (H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME) */ - unsigned mpio_chunk_opt_num; /* Collective chunk threshold (H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME) */ - unsigned mpio_chunk_opt_ratio; /* Collective chunk ratio (H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME) */ -#endif /* H5_HAVE_PARALLEL */ - H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */ - H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */ - H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */ - H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */ - H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */ + mpio_chunk_opt_mode; /* Collective chunk option (H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME) */ + unsigned mpio_chunk_opt_num; /* Collective chunk threshold (H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME) */ + unsigned mpio_chunk_opt_ratio; /* Collective chunk ratio (H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME) */ +#endif /* H5_HAVE_PARALLEL */ + H5Z_EDC_t err_detect; /* Error detection info (H5D_XFER_EDC_NAME) */ + H5Z_cb_t filter_cb; /* Filter callback function (H5D_XFER_FILTER_CB_NAME) */ + H5Z_data_xform_t *data_transform; /* Data transform info (H5D_XFER_XFORM_NAME) */ + H5T_vlen_alloc_info_t vl_alloc_info; /* VL datatype alloc info (H5D_XFER_VLEN_*_NAME) */ + H5T_conv_cb_t dt_conv_cb; /* Datatype conversion struct (H5D_XFER_CONV_CB_NAME) */ + H5D_selection_io_mode_t selection_io_mode; /* Selection I/O mode (H5D_XFER_SELECTION_IO_MODE_NAME) */ + uint32_t no_selection_io_cause; /* Reasons for not performing selection I/O + (H5D_XFER_NO_SELECTION_IO_CAUSE_NAME) */ + hbool_t modify_write_buf; /* Whether the library can modify write buffers */ } H5CX_dxpl_cache_t; /* Typedef for cached default link creation property list information */ @@ -483,168 +488,182 @@ H5CX_init(void) FUNC_ENTER_NOAPI(FAIL) /* Reset the "default DXPL cache" information */ - HDmemset(&H5CX_def_dxpl_cache, 0, sizeof(H5CX_dxpl_cache_t)); + memset(&H5CX_def_dxpl_cache, 0, sizeof(H5CX_dxpl_cache_t)); /* Get the default DXPL cache information */ /* Get the default dataset transfer property list */ if (NULL == (dx_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) - HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset transfer property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); /* Get B-tree split ratios */ if (H5P_get(dx_plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &H5CX_def_dxpl_cache.btree_split_ratio) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve B-tree split ratios"); /* Get maximum temporary buffer size value */ if (H5P_get(dx_plist, H5D_XFER_MAX_TEMP_BUF_NAME, &H5CX_def_dxpl_cache.max_temp_buf) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve maximum temporary buffer size"); /* Get temporary buffer pointer */ if (H5P_get(dx_plist, H5D_XFER_TCONV_BUF_NAME, &H5CX_def_dxpl_cache.tconv_buf) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve temporary buffer pointer"); /* Get background buffer pointer */ if (H5P_get(dx_plist, H5D_XFER_BKGR_BUF_NAME, &H5CX_def_dxpl_cache.bkgr_buf) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve background buffer pointer"); /* Get background buffer type */ if (H5P_get(dx_plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &H5CX_def_dxpl_cache.bkgr_buf_type) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve background buffer type") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve background buffer type"); /* Get I/O vector size */ if (H5P_get(dx_plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &H5CX_def_dxpl_cache.vec_size) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve I/O vector size"); #ifdef H5_HAVE_PARALLEL /* Collect Parallel I/O information for possible later use */ if (H5P_get(dx_plist, H5D_XFER_IO_XFER_MODE_NAME, &H5CX_def_dxpl_cache.io_xfer_mode) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method"); if (H5P_get(dx_plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &H5CX_def_dxpl_cache.mpio_coll_opt) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve collective transfer option") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve collective transfer option"); if (H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_mode) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization option") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization option"); if (H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_num) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization threshold") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization threshold"); if (H5P_get(dx_plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, &H5CX_def_dxpl_cache.mpio_chunk_opt_ratio) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization ratio") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve chunk optimization ratio"); /* Get the local & global reasons for breaking collective I/O values */ if (H5P_get(dx_plist, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, &H5CX_def_dxpl_cache.mpio_local_no_coll_cause) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve local cause for breaking collective I/O") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve local cause for breaking collective I/O"); if (H5P_get(dx_plist, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, &H5CX_def_dxpl_cache.mpio_global_no_coll_cause) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve global cause for breaking collective I/O") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, + "Can't retrieve global cause for breaking collective I/O"); #endif /* H5_HAVE_PARALLEL */ /* Get error detection properties */ if (H5P_get(dx_plist, H5D_XFER_EDC_NAME, &H5CX_def_dxpl_cache.err_detect) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve error detection info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve error detection info"); /* Get filter callback function */ if (H5P_get(dx_plist, H5D_XFER_FILTER_CB_NAME, &H5CX_def_dxpl_cache.filter_cb) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve filter callback function") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve filter callback function"); /* Look at the data transform property */ /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need * to copy it and free this in the H5CX terminate routine. -QAK) */ if (H5P_peek(dx_plist, H5D_XFER_XFORM_NAME, &H5CX_def_dxpl_cache.data_transform) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve data transform info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve data transform info"); /* Get VL datatype alloc info */ if (H5P_get(dx_plist, H5D_XFER_VLEN_ALLOC_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.alloc_func) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info"); if (H5P_get(dx_plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.alloc_info) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info"); if (H5P_get(dx_plist, H5D_XFER_VLEN_FREE_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_func) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info"); if (H5P_get(dx_plist, H5D_XFER_VLEN_FREE_INFO_NAME, &H5CX_def_dxpl_cache.vl_alloc_info.free_info) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info"); /* Get datatype conversion struct */ if (H5P_get(dx_plist, H5D_XFER_CONV_CB_NAME, &H5CX_def_dxpl_cache.dt_conv_cb) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve datatype conversion exception callback"); + + /* Get the selection I/O mode */ + if (H5P_get(dx_plist, H5D_XFER_SELECTION_IO_MODE_NAME, &H5CX_def_dxpl_cache.selection_io_mode) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve parallel transfer method"); + + /* Get the local & global reasons for breaking selection I/O values */ + if (H5P_get(dx_plist, H5D_XFER_NO_SELECTION_IO_CAUSE_NAME, &H5CX_def_dxpl_cache.no_selection_io_cause) < + 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve cause for no selection I/O"); + + /* Get the modify write buffer property */ + if (H5P_get(dx_plist, H5D_XFER_MODIFY_WRITE_BUF_NAME, &H5CX_def_dxpl_cache.modify_write_buf) < 0) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve modify write buffer property"); /* Reset the "default LCPL cache" information */ - HDmemset(&H5CX_def_lcpl_cache, 0, sizeof(H5CX_lcpl_cache_t)); + memset(&H5CX_def_lcpl_cache, 0, sizeof(H5CX_lcpl_cache_t)); /* Get the default LCPL cache information */ /* Get the default link creation property list */ if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_CREATE_DEFAULT))) - HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link creation property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link creation property list"); /* Get link name character encoding */ if (H5P_get(lc_plist, H5P_STRCRT_CHAR_ENCODING_NAME, &H5CX_def_lcpl_cache.encoding) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve link name encoding") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve link name encoding"); /* Get flag whether to create intermediate groups */ if (H5P_get(lc_plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &H5CX_def_lcpl_cache.intermediate_group) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve intermediate group creation flag") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve intermediate group creation flag"); /* Reset the "default LAPL cache" information */ - HDmemset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t)); + memset(&H5CX_def_lapl_cache, 0, sizeof(H5CX_lapl_cache_t)); /* Get the default LAPL cache information */ /* Get the default link access property list */ if (NULL == (la_plist = (H5P_genplist_t *)H5I_object(H5P_LINK_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link access property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a link access property list"); /* Get number of soft / UD links to traverse */ if (H5P_get(la_plist, H5L_ACS_NLINKS_NAME, &H5CX_def_lapl_cache.nlinks) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve number of soft / UD links to traverse") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve number of soft / UD links to traverse"); /* Reset the "default DCPL cache" information */ - HDmemset(&H5CX_def_dcpl_cache, 0, sizeof(H5CX_dcpl_cache_t)); + memset(&H5CX_def_dcpl_cache, 0, sizeof(H5CX_dcpl_cache_t)); /* Get the default DCPL cache information */ /* Get the default dataset creation property list */ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_CREATE_DEFAULT))) - HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list"); /* Get flag to indicate whether to minimize dataset object header */ if (H5P_get(dc_plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &H5CX_def_dcpl_cache.do_min_dset_ohdr) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag"); /* Get object header flags */ if (H5P_get(dc_plist, H5O_CRT_OHDR_FLAGS_NAME, &H5CX_def_dcpl_cache.ohdr_flags) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve object header flags") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve object header flags"); /* Reset the "default DAPL cache" information */ - HDmemset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t)); + memset(&H5CX_def_dapl_cache, 0, sizeof(H5CX_dapl_cache_t)); /* Get the default DAPL cache information */ /* Get the default dataset access property list */ if (NULL == (da_plist = (H5P_genplist_t *)H5I_object(H5P_DATASET_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list"); /* Get the prefix for the external file */ if (H5P_peek(da_plist, H5D_ACS_EFILE_PREFIX_NAME, &H5CX_def_dapl_cache.extfile_prefix) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for external file") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for external file"); /* Get the prefix for the VDS file */ if (H5P_peek(da_plist, H5D_ACS_VDS_PREFIX_NAME, &H5CX_def_dapl_cache.vds_prefix) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for VDS") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve prefix for VDS"); /* Reset the "default FAPL cache" information */ - HDmemset(&H5CX_def_fapl_cache, 0, sizeof(H5CX_fapl_cache_t)); + memset(&H5CX_def_fapl_cache, 0, sizeof(H5CX_fapl_cache_t)); /* Get the default FAPL cache information */ /* Get the default file access property list */ if (NULL == (fa_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a dataset create property list"); /* Get low_bound */ if (H5P_get(fa_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &H5CX_def_fapl_cache.low_bound) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag"); if (H5P_get(fa_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &H5CX_def_fapl_cache.high_bound) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve dataset minimize flag"); done: FUNC_LEAVE_NOAPI(ret_value) } @@ -658,9 +677,6 @@ H5CX_init(void) * affect other interfaces; zero otherwise. * Failure: Negative. * - * Programmer: Quincey Koziol - * Februrary 22, 2018 - * *------------------------------------------------------------------------- */ int @@ -675,8 +691,8 @@ H5CX_term_package(void) cnode = H5CX__pop_common(FALSE); /* Free the context node */ - /* (Allocated with HDmalloc() in H5CX_push_special() ) */ - HDfree(cnode); + /* (Allocated with malloc() in H5CX_push_special() ) */ + free(cnode); #ifndef H5_HAVE_THREADSAFE H5CX_head_g = NULL; @@ -695,9 +711,6 @@ H5CX_term_package(void) * Return: Success: Non-NULL pointer to head pointer of API context stack for thread * Failure: NULL * - * Programmer: Quincey Koziol - * March 12, 2018 - * *------------------------------------------------------------------------- */ static H5CX_node_t ** @@ -715,12 +728,12 @@ H5CX__get_context(void) /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ ctx = (H5CX_node_t **)LocalAlloc(LPTR, sizeof(H5CX_node_t *)); #else - /* Use HDmalloc here since this has to match the HDfree in the + /* Use malloc here since this has to match the free in the * destructor and we want to avoid the codestack there. */ - ctx = (H5CX_node_t **)HDmalloc(sizeof(H5CX_node_t *)); + ctx = (H5CX_node_t **)malloc(sizeof(H5CX_node_t *)); #endif /* H5_HAVE_WIN_THREADS */ - HDassert(ctx); + assert(ctx); /* Reset the thread-specific info */ *ctx = NULL; @@ -744,9 +757,6 @@ H5CX__get_context(void) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 22, 2018 - * *------------------------------------------------------------------------- */ static void @@ -757,9 +767,9 @@ H5CX__push_common(H5CX_node_t *cnode) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(cnode); + assert(cnode); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head); + assert(head); /* Set non-zero context info */ cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT; @@ -785,9 +795,6 @@ H5CX__push_common(H5CX_node_t *cnode) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 19, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -800,7 +807,7 @@ H5CX_push(void) /* Allocate & clear API context node */ if (NULL == (cnode = H5FL_CALLOC(H5CX_node_t))) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new struct") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new struct"); /* Set context info */ H5CX__push_common(cnode); @@ -818,9 +825,6 @@ H5CX_push(void) * * Return: * - * Programmer: Quincey Koziol - * Februrary 22, 2018 - * *------------------------------------------------------------------------- */ void @@ -831,8 +835,8 @@ H5CX_push_special(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Allocate & clear API context node, without using library API routines */ - cnode = (H5CX_node_t *)HDcalloc(1, sizeof(H5CX_node_t)); - HDassert(cnode); + cnode = (H5CX_node_t *)calloc(1, sizeof(H5CX_node_t)); + assert(cnode); /* Set context info */ H5CX__push_common(cnode); @@ -852,9 +856,6 @@ H5CX_push_special(void) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * January 8, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -867,12 +868,12 @@ H5CX_retrieve_state(H5CX_state_t **api_state) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(api_state); + assert(head && *head); + assert(api_state); /* Allocate & clear API context state */ if (NULL == (*api_state = H5FL_CALLOC(H5CX_state_t))) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new API context state") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new API context state"); /* Check for non-default DCPL */ if (H5P_DATASET_CREATE_DEFAULT != (*head)->ctx.dcpl_id) { @@ -881,7 +882,7 @@ H5CX_retrieve_state(H5CX_state_t **api_state) /* Copy the DCPL ID */ if (((*api_state)->dcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dcpl, FALSE)) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list"); } /* end if */ else (*api_state)->dcpl_id = H5P_DATASET_CREATE_DEFAULT; @@ -893,7 +894,7 @@ H5CX_retrieve_state(H5CX_state_t **api_state) /* Copy the DXPL ID */ if (((*api_state)->dxpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.dxpl, FALSE)) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list"); } /* end if */ else (*api_state)->dxpl_id = H5P_DATASET_XFER_DEFAULT; @@ -905,7 +906,7 @@ H5CX_retrieve_state(H5CX_state_t **api_state) /* Copy the LAPL ID */ if (((*api_state)->lapl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lapl, FALSE)) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list"); } /* end if */ else (*api_state)->lapl_id = H5P_LINK_ACCESS_DEFAULT; @@ -917,7 +918,7 @@ H5CX_retrieve_state(H5CX_state_t **api_state) /* Copy the LCPL ID */ if (((*api_state)->lcpl_id = H5P_copy_plist((H5P_genplist_t *)(*head)->ctx.lcpl, FALSE)) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "can't copy property list"); } /* end if */ else (*api_state)->lcpl_id = H5P_LINK_CREATE_DEFAULT; @@ -925,9 +926,9 @@ H5CX_retrieve_state(H5CX_state_t **api_state) /* Keep a reference to the current VOL wrapping context */ (*api_state)->vol_wrap_ctx = (*head)->ctx.vol_wrap_ctx; if (NULL != (*api_state)->vol_wrap_ctx) { - HDassert((*head)->ctx.vol_wrap_ctx_valid); + assert((*head)->ctx.vol_wrap_ctx_valid); if (H5VL_inc_vol_wrapper((*api_state)->vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "can't increment refcount on VOL wrapping context") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "can't increment refcount on VOL wrapping context"); } /* end if */ /* Keep a copy of the VOL connector property, if there is one */ @@ -946,18 +947,18 @@ H5CX_retrieve_state(H5CX_state_t **api_state) /* Retrieve the connector for the ID */ if (NULL == (connector = (H5VL_class_t *)H5I_object((*api_state)->vol_connector_prop.connector_id))) - HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Allocate and copy connector info */ if (H5VL_copy_connector_info(connector, &new_connector_info, (*api_state)->vol_connector_prop.connector_info) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "connector info copy failed") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTCOPY, FAIL, "connector info copy failed"); (*api_state)->vol_connector_prop.connector_info = new_connector_info; } /* end if */ /* Increment the refcount on the connector ID */ if (H5I_inc_ref((*api_state)->vol_connector_prop.connector_id, FALSE) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed"); } /* end if */ } /* end if */ @@ -972,7 +973,7 @@ H5CX_retrieve_state(H5CX_state_t **api_state) if (*api_state) { /* Release the (possibly partially allocated) API state struct */ if (H5CX_free_state(*api_state) < 0) - HDONE_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release API state") + HDONE_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release API state"); *api_state = NULL; } /* end if */ } /* end if */ @@ -992,9 +993,6 @@ H5CX_retrieve_state(H5CX_state_t **api_state) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * January 9, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1006,8 +1004,8 @@ H5CX_restore_state(const H5CX_state_t *api_state) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(api_state); + assert(head && *head); + assert(api_state); /* Restore the DCPL info */ (*head)->ctx.dcpl_id = api_state->dcpl_id; @@ -1052,9 +1050,6 @@ H5CX_restore_state(const H5CX_state_t *api_state) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * January 9, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1065,32 +1060,32 @@ H5CX_free_state(H5CX_state_t *api_state) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(api_state); + assert(api_state); /* Release the DCPL */ if (0 != api_state->dcpl_id && H5P_DATASET_CREATE_DEFAULT != api_state->dcpl_id) if (H5I_dec_ref(api_state->dcpl_id) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DCPL") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DCPL"); /* Release the DXPL */ if (0 != api_state->dxpl_id && H5P_DATASET_XFER_DEFAULT != api_state->dxpl_id) if (H5I_dec_ref(api_state->dxpl_id) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DXPL") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DXPL"); /* Release the LAPL */ if (0 != api_state->lapl_id && H5P_LINK_ACCESS_DEFAULT != api_state->lapl_id) if (H5I_dec_ref(api_state->lapl_id) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL"); /* Release the LCPL */ if (0 != api_state->lcpl_id && H5P_LINK_CREATE_DEFAULT != api_state->lcpl_id) if (H5I_dec_ref(api_state->lcpl_id) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LCPL") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LCPL"); /* Release the VOL wrapper context */ if (api_state->vol_wrap_ctx) if (H5VL_dec_vol_wrapper(api_state->vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on VOL wrapping context") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on VOL wrapping context"); /* Release the VOL connector property, if it was set */ if (api_state->vol_connector_prop.connector_id) { @@ -1098,10 +1093,11 @@ H5CX_free_state(H5CX_state_t *api_state) if (api_state->vol_connector_prop.connector_info) if (H5VL_free_connector_info(api_state->vol_connector_prop.connector_id, api_state->vol_connector_prop.connector_info) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, + "unable to release VOL connector info object"); /* Decrement connector ID */ if (H5I_dec_ref(api_state->vol_connector_prop.connector_id) < 0) - HDONE_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't close VOL connector ID") + HDONE_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't close VOL connector ID"); } /* end if */ /* Free the state */ @@ -1118,9 +1114,6 @@ H5CX_free_state(H5CX_state_t *api_state) * * Return: TRUE / FALSE (can't fail) * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ hbool_t @@ -1133,7 +1126,7 @@ H5CX_is_def_dxpl(void) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set return value */ is_def_dxpl = ((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT); @@ -1148,9 +1141,6 @@ H5CX_is_def_dxpl(void) * * Return: * - * Programmer: Quincey Koziol - * March 8, 2018 - * *------------------------------------------------------------------------- */ void @@ -1162,7 +1152,7 @@ H5CX_set_dxpl(hid_t dxpl_id) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context's DXPL to a new value */ (*head)->ctx.dxpl_id = dxpl_id; @@ -1177,9 +1167,6 @@ H5CX_set_dxpl(hid_t dxpl_id) * * Return: * - * Programmer: Quincey Koziol - * March 6, 2019 - * *------------------------------------------------------------------------- */ void @@ -1191,7 +1178,7 @@ H5CX_set_dcpl(hid_t dcpl_id) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context's DCPL to a new value */ (*head)->ctx.dcpl_id = dcpl_id; @@ -1207,9 +1194,6 @@ H5CX_set_dcpl(hid_t dcpl_id) * * Return: Non-negative on success / Negative on failure * - * Programmer: Vailin Choi - * March 27, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1222,7 +1206,7 @@ H5CX_set_libver_bounds(H5F_t *f) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context value */ (*head)->ctx.low_bound = (f == NULL) ? H5F_LIBVER_LATEST : H5F_LOW_BOUND(f); @@ -1242,9 +1226,6 @@ H5CX_set_libver_bounds(H5F_t *f) * * Return: * - * Programmer: Chris Hogan - * October 28, 2019 - * *------------------------------------------------------------------------- */ void @@ -1256,7 +1237,7 @@ H5CX_set_lcpl(hid_t lcpl_id) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context's LCPL to a new value */ (*head)->ctx.lcpl_id = lcpl_id; @@ -1271,9 +1252,6 @@ H5CX_set_lcpl(hid_t lcpl_id) * * Return: * - * Programmer: Quincey Koziol - * March 10, 2018 - * *------------------------------------------------------------------------- */ void @@ -1285,7 +1263,7 @@ H5CX_set_lapl(hid_t lapl_id) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context's LAPL to a new value */ (*head)->ctx.lapl_id = lapl_id; @@ -1301,9 +1279,6 @@ H5CX_set_lapl(hid_t lapl_id) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 19, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -1325,10 +1300,10 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(acspl_id); - HDassert(libclass); + assert(acspl_id); + assert(libclass); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set access plist to the default property list of the appropriate class if it's the generic default */ if (H5P_DEFAULT == *acspl_id) @@ -1344,24 +1319,24 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, #ifdef H5CX_DEBUG /* Sanity check the access property list class */ if (TRUE != H5P_isa_class(*acspl_id, *libclass->class_id)) - HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not the required access property list") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, "not the required access property list"); #endif /* H5CX_DEBUG*/ /* Check for link access property and set API context if so */ if ((is_lapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_LACC->pclass)) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for link access class") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for link access class"); else if (is_lapl) (*head)->ctx.lapl_id = *acspl_id; /* Check for dataset access property and set API context if so */ if ((is_dapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_DACC->pclass)) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for dataset access class") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for dataset access class"); else if (is_dapl) (*head)->ctx.dapl_id = *acspl_id; /* Check for file access property and set API context if so */ if ((is_fapl = H5P_class_isa(*libclass->pclass, *H5P_CLS_FACC->pclass)) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for file access class") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't check for file access class"); else if (is_fapl) (*head)->ctx.fapl_id = *acspl_id; @@ -1376,11 +1351,11 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, /* Get the plist structure for the access property list */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(*acspl_id))) - HGOTO_ERROR(H5E_CONTEXT, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_CONTEXT, H5E_BADID, FAIL, "can't find object for ID"); /* Get the collective metadata read flag */ if (H5P_peek(plist, H5_COLL_MD_READ_FLAG_NAME, &md_coll_read) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't get core collective metadata read flag") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "can't get core collective metadata read flag"); /* If collective metadata read requested, set collective metadata read flag */ if (H5P_USER_TRUE == md_coll_read) @@ -1404,7 +1379,7 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, /* Retrieve the MPI communicator from the loc_id or the fapl_id */ if (H5F_mpi_retrieve_comm(loc_id, *acspl_id, &mpi_comm) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator"); /* issue the barrier */ if (mpi_comm != MPI_COMM_NULL) @@ -1427,9 +1402,6 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass, * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 8, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -1447,7 +1419,7 @@ H5CX_set_loc(hid_t /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set collective metadata read flag */ (*head)->ctx.coll_metadata_read = TRUE; @@ -1461,7 +1433,7 @@ H5CX_set_loc(hid_t /* Retrieve the MPI communicator from the loc_id or the fapl_id */ if (H5F_mpi_retrieve_comm(loc_id, H5P_DEFAULT, &mpi_comm) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator"); /* issue the barrier */ if (mpi_comm != MPI_COMM_NULL) @@ -1484,9 +1456,6 @@ H5CX_set_loc(hid_t * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * October 14, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -1499,7 +1468,7 @@ H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context value */ (*head)->ctx.vol_wrap_ctx = vol_wrap_ctx; @@ -1517,9 +1486,6 @@ H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * January 3, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1532,7 +1498,7 @@ H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context value */ H5MM_memcpy(&(*head)->ctx.vol_connector_prop, vol_connector_prop, sizeof(H5VL_connector_prop_t)); @@ -1550,9 +1516,6 @@ H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 20, 2018 - * *------------------------------------------------------------------------- */ hid_t @@ -1565,7 +1528,7 @@ H5CX_get_dxpl(void) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set return value */ dxpl_id = (*head)->ctx.dxpl_id; @@ -1580,9 +1543,6 @@ H5CX_get_dxpl(void) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 10, 2018 - * *------------------------------------------------------------------------- */ hid_t @@ -1595,7 +1555,7 @@ H5CX_get_lapl(void) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set return value */ lapl_id = (*head)->ctx.lapl_id; @@ -1610,9 +1570,6 @@ H5CX_get_lapl(void) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * October 14, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -1621,12 +1578,20 @@ H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx) H5CX_node_t **head = NULL; /* Pointer to head of API context list */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOERR + FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_wrap_ctx); + assert(vol_wrap_ctx); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + + /* No error is expected at this point. But in case an application calls H5VLwrap_register + * which doesn't reset the API context and there is no context, returns a relevant error here + */ + if (!head) + HGOTO_ERROR(H5E_CONTEXT, H5E_UNINITIALIZED, FAIL, "the API context isn't available"); + + if (!(*head)) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "unable to get the current API context"); /* Check for value that was set */ if ((*head)->ctx.vol_wrap_ctx_valid) @@ -1635,6 +1600,7 @@ H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx) else *vol_wrap_ctx = NULL; +done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_get_vol_wrap_ctx() */ @@ -1645,9 +1611,6 @@ H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * January 3, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1659,16 +1622,16 @@ H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop) FUNC_ENTER_NOAPI_NOERR /* Sanity check */ - HDassert(vol_connector_prop); + assert(vol_connector_prop); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Check for value that was set */ if ((*head)->ctx.vol_connector_prop_valid) /* Get the value */ H5MM_memcpy(vol_connector_prop, &(*head)->ctx.vol_connector_prop, sizeof(H5VL_connector_prop_t)); else - HDmemset(vol_connector_prop, 0, sizeof(H5VL_connector_prop_t)); + memset(vol_connector_prop, 0, sizeof(H5VL_connector_prop_t)); FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_get_vol_connector_prop() */ @@ -1680,9 +1643,6 @@ H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 20, 2018 - * *------------------------------------------------------------------------- */ haddr_t @@ -1695,7 +1655,7 @@ H5CX_get_tag(void) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set return value */ tag = (*head)->ctx.tag; @@ -1710,9 +1670,6 @@ H5CX_get_tag(void) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 22, 2018 - * *------------------------------------------------------------------------- */ H5AC_ring_t @@ -1725,7 +1682,7 @@ H5CX_get_ring(void) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set return value */ ring = (*head)->ctx.ring; @@ -1742,9 +1699,6 @@ H5CX_get_ring(void) * * Return: TRUE / FALSE on success / * - * Programmer: Quincey Koziol - * Februrary 23, 2018 - * *------------------------------------------------------------------------- */ hbool_t @@ -1757,7 +1711,7 @@ H5CX_get_coll_metadata_read(void) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set return value */ coll_md_read = (*head)->ctx.coll_metadata_read; @@ -1774,9 +1728,6 @@ H5CX_get_coll_metadata_read(void) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 26, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -1788,10 +1739,10 @@ H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype) FUNC_ENTER_NOAPI_NOERR /* Sanity check */ - HDassert(btype); - HDassert(ftype); + assert(btype); + assert(ftype); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context values */ *btype = (*head)->ctx.btype; @@ -1807,9 +1758,6 @@ H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype) * * Return: TRUE / FALSE on success / * - * Programmer: Quincey Koziol - * March 17, 2018 - * *------------------------------------------------------------------------- */ hbool_t @@ -1822,7 +1770,7 @@ H5CX_get_mpi_file_flushing(void) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set return value */ flushing = (*head)->ctx.mpi_file_flushing; @@ -1838,9 +1786,6 @@ H5CX_get_mpi_file_flushing(void) * * Return: Non-negative on success / Negative on failure * - * Programmer: M. Breitenfeld - * December 31, 2018 - * *------------------------------------------------------------------------- */ hbool_t @@ -1853,7 +1798,7 @@ H5CX_get_mpio_rank0_bcast(void) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set return value */ do_rank0_bcast = (*head)->ctx.rank0_bcast; @@ -1869,9 +1814,6 @@ H5CX_get_mpio_rank0_bcast(void) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 23, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -1883,10 +1825,10 @@ H5CX_get_btree_split_ratios(double split_ratio[3]) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(split_ratio); + assert(split_ratio); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_BTREE_SPLIT_RATIO_NAME, btree_split_ratio) @@ -1905,9 +1847,6 @@ H5CX_get_btree_split_ratios(double split_ratio[3]) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 25, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -1919,10 +1858,10 @@ H5CX_get_max_temp_buf(size_t *max_temp_buf) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(max_temp_buf); + assert(max_temp_buf); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MAX_TEMP_BUF_NAME, max_temp_buf) @@ -1940,9 +1879,6 @@ H5CX_get_max_temp_buf(size_t *max_temp_buf) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 25, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -1954,10 +1890,10 @@ H5CX_get_tconv_buf(void **tconv_buf) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(tconv_buf); + assert(tconv_buf); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_TCONV_BUF_NAME, tconv_buf) @@ -1975,9 +1911,6 @@ H5CX_get_tconv_buf(void **tconv_buf) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 25, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -1989,10 +1922,10 @@ H5CX_get_bkgr_buf(void **bkgr_buf) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(bkgr_buf); + assert(bkgr_buf); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_BKGR_BUF_NAME, bkgr_buf) @@ -2010,9 +1943,6 @@ H5CX_get_bkgr_buf(void **bkgr_buf) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 25, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2024,10 +1954,10 @@ H5CX_get_bkgr_buf_type(H5T_bkg_t *bkgr_buf_type) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(bkgr_buf_type); + assert(bkgr_buf_type); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_BKGR_BUF_TYPE_NAME, bkgr_buf_type) @@ -2045,9 +1975,6 @@ H5CX_get_bkgr_buf_type(H5T_bkg_t *bkgr_buf_type) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 25, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2059,10 +1986,10 @@ H5CX_get_vec_size(size_t *vec_size) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vec_size); + assert(vec_size); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_HYPER_VECTOR_SIZE_NAME, vec_size) @@ -2082,9 +2009,6 @@ H5CX_get_vec_size(size_t *vec_size) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 25, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2096,10 +2020,10 @@ H5CX_get_io_xfer_mode(H5FD_mpio_xfer_t *io_xfer_mode) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(io_xfer_mode); + assert(io_xfer_mode); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_IO_XFER_MODE_NAME, io_xfer_mode) @@ -2117,9 +2041,6 @@ H5CX_get_io_xfer_mode(H5FD_mpio_xfer_t *io_xfer_mode) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 26, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2131,10 +2052,10 @@ H5CX_get_mpio_coll_opt(H5FD_mpio_collective_opt_t *mpio_coll_opt) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(mpio_coll_opt); + assert(mpio_coll_opt); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, mpio_coll_opt) @@ -2152,9 +2073,6 @@ H5CX_get_mpio_coll_opt(H5FD_mpio_collective_opt_t *mpio_coll_opt) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2166,10 +2084,10 @@ H5CX_get_mpio_local_no_coll_cause(uint32_t *mpio_local_no_coll_cause) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(mpio_local_no_coll_cause); + assert(mpio_local_no_coll_cause); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID_SET(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, mpio_local_no_coll_cause) @@ -2188,9 +2106,6 @@ H5CX_get_mpio_local_no_coll_cause(uint32_t *mpio_local_no_coll_cause) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2202,10 +2117,10 @@ H5CX_get_mpio_global_no_coll_cause(uint32_t *mpio_global_no_coll_cause) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(mpio_global_no_coll_cause); + assert(mpio_global_no_coll_cause); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID_SET(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, mpio_global_no_coll_cause) @@ -2224,9 +2139,6 @@ H5CX_get_mpio_global_no_coll_cause(uint32_t *mpio_global_no_coll_cause) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2238,10 +2150,10 @@ H5CX_get_mpio_chunk_opt_mode(H5FD_mpio_chunk_opt_t *mpio_chunk_opt_mode) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(mpio_chunk_opt_mode); + assert(mpio_chunk_opt_mode); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, mpio_chunk_opt_mode) @@ -2260,9 +2172,6 @@ H5CX_get_mpio_chunk_opt_mode(H5FD_mpio_chunk_opt_t *mpio_chunk_opt_mode) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2274,10 +2183,10 @@ H5CX_get_mpio_chunk_opt_num(unsigned *mpio_chunk_opt_num) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(mpio_chunk_opt_num); + assert(mpio_chunk_opt_num); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, mpio_chunk_opt_num) @@ -2296,9 +2205,6 @@ H5CX_get_mpio_chunk_opt_num(unsigned *mpio_chunk_opt_num) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2310,10 +2216,10 @@ H5CX_get_mpio_chunk_opt_ratio(unsigned *mpio_chunk_opt_ratio) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(mpio_chunk_opt_ratio); + assert(mpio_chunk_opt_ratio); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, mpio_chunk_opt_ratio) @@ -2333,9 +2239,6 @@ H5CX_get_mpio_chunk_opt_ratio(unsigned *mpio_chunk_opt_ratio) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 26, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2347,10 +2250,10 @@ H5CX_get_err_detect(H5Z_EDC_t *err_detect) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(err_detect); + assert(err_detect); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_EDC_NAME, err_detect) @@ -2368,9 +2271,6 @@ H5CX_get_err_detect(H5Z_EDC_t *err_detect) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 26, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2382,10 +2282,10 @@ H5CX_get_filter_cb(H5Z_cb_t *filter_cb) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(filter_cb); + assert(filter_cb); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_FILTER_CB_NAME, filter_cb) @@ -2403,9 +2303,6 @@ H5CX_get_filter_cb(H5Z_cb_t *filter_cb) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 26, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2417,10 +2314,10 @@ H5CX_get_data_transform(H5Z_data_xform_t **data_transform) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(data_transform); + assert(data_transform); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); /* Check if the value has been retrieved already */ if (!(*head)->ctx.data_transform_valid) { @@ -2433,14 +2330,14 @@ H5CX_get_data_transform(H5Z_data_xform_t **data_transform) /* Get the dataset transfer property list pointer */ if (NULL == ((*head)->ctx.dxpl = (H5P_genplist_t *)H5I_object((*head)->ctx.dxpl_id))) HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, - "can't get default dataset transfer property list") + "can't get default dataset transfer property list"); /* Get data transform info value */ /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need * to copy it and free this in the H5CX pop routine. -QAK) */ if (H5P_peek((*head)->ctx.dxpl, H5D_XFER_XFORM_NAME, &(*head)->ctx.data_transform) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve data transform info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve data transform info"); } /* end else */ /* Mark the value as valid */ @@ -2461,9 +2358,6 @@ H5CX_get_data_transform(H5Z_data_xform_t **data_transform) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 5, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2475,10 +2369,10 @@ H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vl_alloc_info); + assert(vl_alloc_info); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); /* Check if the value has been retrieved already */ if (!(*head)->ctx.vl_alloc_info_valid) { @@ -2491,21 +2385,21 @@ H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info) /* Get the dataset transfer property list pointer */ if (NULL == ((*head)->ctx.dxpl = (H5P_genplist_t *)H5I_object((*head)->ctx.dxpl_id))) HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, - "can't get default dataset transfer property list") + "can't get default dataset transfer property list"); /* Get VL datatype alloc info values */ if (H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_ALLOC_NAME, &(*head)->ctx.vl_alloc_info.alloc_func) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info"); if (H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_ALLOC_INFO_NAME, &(*head)->ctx.vl_alloc_info.alloc_info) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info"); if (H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_FREE_NAME, &(*head)->ctx.vl_alloc_info.free_func) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info"); if (H5P_get((*head)->ctx.dxpl, H5D_XFER_VLEN_FREE_INFO_NAME, &(*head)->ctx.vl_alloc_info.free_info) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VL datatype alloc info"); } /* end else */ /* Mark the value as valid */ @@ -2526,9 +2420,6 @@ H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 8, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2540,10 +2431,10 @@ H5CX_get_dt_conv_cb(H5T_conv_cb_t *dt_conv_cb) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dt_conv_cb); + assert(dt_conv_cb); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_CONV_CB_NAME, dt_conv_cb) @@ -2554,6 +2445,105 @@ H5CX_get_dt_conv_cb(H5T_conv_cb_t *dt_conv_cb) FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX_get_dt_conv_cb() */ +/*------------------------------------------------------------------------- + * Function: H5CX_get_selection_io_mode + * + * Purpose: Retrieves the selection I/O mode for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_selection_io_mode(H5D_selection_io_mode_t *selection_io_mode) +{ + H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + assert(selection_io_mode); + head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + + H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_SELECTION_IO_MODE_NAME, + selection_io_mode) + + /* Get the value */ + *selection_io_mode = (*head)->ctx.selection_io_mode; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_selection_io_mode() */ + +/*------------------------------------------------------------------------- + * Function: H5CX_get_no_selection_io_cause + * + * Purpose: Retrieves the cause for not performing selection I/O + * for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_no_selection_io_cause(uint32_t *no_selection_io_cause) +{ + H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + assert(no_selection_io_cause); + head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + + H5CX_RETRIEVE_PROP_VALID_SET(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_NO_SELECTION_IO_CAUSE_NAME, + no_selection_io_cause) + + /* Get the value */ + *no_selection_io_cause = (*head)->ctx.no_selection_io_cause; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_no_selection_io_cause() */ + +/*------------------------------------------------------------------------- + * Function: H5CX_get_modify_write_buf + * + * Purpose: Retrieves the modify write buffer property for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_get_modify_write_buf(hbool_t *modify_write_buf) +{ + H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + assert(modify_write_buf); + head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + + H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_MODIFY_WRITE_BUF_NAME, modify_write_buf) + + /* Get the value */ + *modify_write_buf = (*head)->ctx.modify_write_buf; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_get_selection_io_mode() */ + /*------------------------------------------------------------------------- * Function: H5CX_get_encoding * @@ -2561,9 +2551,6 @@ H5CX_get_dt_conv_cb(H5T_conv_cb_t *dt_conv_cb) * * Return: Non-negative on success / Negative on failure * - * Programmer: Gerd Heber - * October 21, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2575,10 +2562,10 @@ H5CX_get_encoding(H5T_cset_t *encoding) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(encoding); + assert(encoding); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.lcpl_id); H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5P_STRCRT_CHAR_ENCODING_NAME, encoding) @@ -2596,9 +2583,6 @@ H5CX_get_encoding(H5T_cset_t *encoding) * * Return: Non-negative on success / Negative on failure * - * Programmer: Gerd Heber - * October 21, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2610,10 +2594,10 @@ H5CX_get_intermediate_group(unsigned *crt_intermed_group) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(crt_intermed_group); + assert(crt_intermed_group); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.lcpl_id); H5CX_RETRIEVE_PROP_VALID(lcpl, H5P_LINK_CREATE_DEFAULT, H5L_CRT_INTERMEDIATE_GROUP_NAME, intermediate_group) @@ -2632,9 +2616,6 @@ H5CX_get_intermediate_group(unsigned *crt_intermed_group) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 10, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2646,10 +2627,10 @@ H5CX_get_nlinks(size_t *nlinks) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(nlinks); + assert(nlinks); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dxpl_id); H5CX_RETRIEVE_PROP_VALID(lapl, H5P_LINK_ACCESS_DEFAULT, H5L_ACS_NLINKS_NAME, nlinks) @@ -2667,9 +2648,6 @@ H5CX_get_nlinks(size_t *nlinks) * * Return: Non-negative on success / Negative on failure * - * Programmer: Vailin Choi - * March 27, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2681,11 +2659,11 @@ H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(low_bound); - HDassert(high_bound); + assert(low_bound); + assert(high_bound); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.fapl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.fapl_id); H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_LOW_BOUND_NAME, low_bound) H5CX_RETRIEVE_PROP_VALID(fapl, H5P_FILE_ACCESS_DEFAULT, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high_bound) @@ -2706,9 +2684,6 @@ H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2720,10 +2695,10 @@ H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dset_min_ohdr_flag); + assert(dset_min_ohdr_flag); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dcpl_id); H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, do_min_dset_ohdr) @@ -2742,9 +2717,6 @@ H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag) * * Return: Non-negative on success / Negative on failure * - * Programmer: Raymond Lu - * March 6, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2756,10 +2728,10 @@ H5CX_get_ext_file_prefix(const char **extfile_prefix) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(extfile_prefix); + assert(extfile_prefix); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dapl_id); /* Check if the value has been retrieved already */ if (!(*head)->ctx.extfile_prefix_valid) { @@ -2772,14 +2744,14 @@ H5CX_get_ext_file_prefix(const char **extfile_prefix) /* Get the dataset access property list pointer */ if (NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id))) HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, - "can't get default dataset access property list") + "can't get default dataset access property list"); /* Get the prefix for the external file */ /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need * to copy it and free this in the H5CX pop routine. -QAK) */ if (H5P_peek((*head)->ctx.dapl, H5D_ACS_EFILE_PREFIX_NAME, &(*head)->ctx.extfile_prefix) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve external file prefix") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve external file prefix"); } /* end else */ /* Mark the value as valid */ @@ -2800,9 +2772,6 @@ H5CX_get_ext_file_prefix(const char **extfile_prefix) * * Return: Non-negative on success / Negative on failure * - * Programmer: Raymond Lu - * March 6, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2814,10 +2783,10 @@ H5CX_get_vds_prefix(const char **vds_prefix) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vds_prefix); + assert(vds_prefix); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dapl_id); /* Check if the value has been retrieved already */ if (!(*head)->ctx.vds_prefix_valid) { @@ -2830,14 +2799,14 @@ H5CX_get_vds_prefix(const char **vds_prefix) /* Get the dataset access property list pointer */ if (NULL == ((*head)->ctx.dapl = (H5P_genplist_t *)H5I_object((*head)->ctx.dapl_id))) HGOTO_ERROR(H5E_CONTEXT, H5E_BADTYPE, FAIL, - "can't get default dataset access property list") + "can't get default dataset access property list"); /* Get the prefix for the VDS */ /* (Note: 'peek', not 'get' - if this turns out to be a problem, we may need * to copy it and free this in the H5CX pop routine. -QAK) */ if (H5P_peek((*head)->ctx.dapl, H5D_ACS_VDS_PREFIX_NAME, &(*head)->ctx.vds_prefix) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VDS prefix") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "Can't retrieve VDS prefix"); } /* end else */ /* Mark the value as valid */ @@ -2858,9 +2827,6 @@ H5CX_get_vds_prefix(const char **vds_prefix) * * Return: * - * Programmer: Quincey Koziol - * Februrary 20, 2018 - * *------------------------------------------------------------------------- */ void @@ -2872,7 +2838,7 @@ H5CX_set_tag(haddr_t tag) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); (*head)->ctx.tag = tag; @@ -2886,9 +2852,6 @@ H5CX_set_tag(haddr_t tag) * * Return: * - * Programmer: Quincey Koziol - * Februrary 20, 2018 - * *------------------------------------------------------------------------- */ void @@ -2900,7 +2863,7 @@ H5CX_set_ring(H5AC_ring_t ring) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); (*head)->ctx.ring = ring; @@ -2916,9 +2879,6 @@ H5CX_set_ring(H5AC_ring_t ring) * * Return: * - * Programmer: Quincey Koziol - * Februrary 23, 2018 - * *------------------------------------------------------------------------- */ void @@ -2930,7 +2890,7 @@ H5CX_set_coll_metadata_read(hbool_t cmdr) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); (*head)->ctx.coll_metadata_read = cmdr; @@ -2946,9 +2906,6 @@ H5CX_set_coll_metadata_read(hbool_t cmdr) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 26, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2962,7 +2919,7 @@ H5CX_set_mpi_coll_datatypes(MPI_Datatype btype, MPI_Datatype ftype) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context values */ (*head)->ctx.btype = btype; @@ -2978,9 +2935,6 @@ H5CX_set_mpi_coll_datatypes(MPI_Datatype btype, MPI_Datatype ftype) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 26, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -2993,7 +2947,7 @@ H5CX_set_io_xfer_mode(H5FD_mpio_xfer_t io_xfer_mode) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context value */ (*head)->ctx.io_xfer_mode = io_xfer_mode; @@ -3011,9 +2965,6 @@ H5CX_set_io_xfer_mode(H5FD_mpio_xfer_t io_xfer_mode) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 26, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -3026,7 +2977,7 @@ H5CX_set_mpio_coll_opt(H5FD_mpio_collective_opt_t mpio_coll_opt) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context value */ (*head)->ctx.mpio_coll_opt = mpio_coll_opt; @@ -3044,9 +2995,6 @@ H5CX_set_mpio_coll_opt(H5FD_mpio_collective_opt_t mpio_coll_opt) * * Return: * - * Programmer: Quincey Koziol - * March 170 2018 - * *------------------------------------------------------------------------- */ void @@ -3058,7 +3006,7 @@ H5CX_set_mpi_file_flushing(hbool_t flushing) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); (*head)->ctx.mpi_file_flushing = flushing; @@ -3073,9 +3021,6 @@ H5CX_set_mpi_file_flushing(hbool_t flushing) * * Return: * - * Programmer: M. Breitenfeld - * December 31, 2018 - * *------------------------------------------------------------------------- */ void @@ -3087,7 +3032,7 @@ H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast) /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); (*head)->ctx.rank0_bcast = rank0_bcast; @@ -3102,9 +3047,6 @@ H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -3117,7 +3059,7 @@ H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context value */ (*head)->ctx.vl_alloc_info.alloc_func = alloc_func; @@ -3138,9 +3080,6 @@ H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 10, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -3153,7 +3092,7 @@ H5CX_set_nlinks(size_t nlinks) /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Set the API context value */ (*head)->ctx.nlinks = nlinks; @@ -3173,9 +3112,6 @@ H5CX_set_nlinks(size_t nlinks) * * Return: * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ void @@ -3187,8 +3123,8 @@ H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chun /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); + assert(head && *head); + assert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); /* Cache the value for later, marking it to set in DXPL when context popped */ (*head)->ctx.mpio_actual_chunk_opt = mpio_actual_chunk_opt; @@ -3204,9 +3140,6 @@ H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chun * * Return: * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ void @@ -3218,8 +3151,8 @@ H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t mpio_actual_io_mode) /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); + assert(head && *head); + assert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); /* Cache the value for later, marking it to set in DXPL when context popped */ (*head)->ctx.mpio_actual_io_mode = mpio_actual_io_mode; @@ -3235,9 +3168,6 @@ H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t mpio_actual_io_mode) * * Return: * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ void @@ -3249,8 +3179,8 @@ H5CX_set_mpio_local_no_coll_cause(uint32_t mpio_local_no_coll_cause) /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert((*head)->ctx.dxpl_id != H5P_DEFAULT); + assert(head && *head); + assert((*head)->ctx.dxpl_id != H5P_DEFAULT); /* If we're using the default DXPL, don't modify it */ if ((*head)->ctx.dxpl_id != H5P_DATASET_XFER_DEFAULT) { @@ -3269,9 +3199,6 @@ H5CX_set_mpio_local_no_coll_cause(uint32_t mpio_local_no_coll_cause) * * Return: * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ void @@ -3283,8 +3210,8 @@ H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause) /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert((*head)->ctx.dxpl_id != H5P_DEFAULT); + assert(head && *head); + assert((*head)->ctx.dxpl_id != H5P_DEFAULT); /* If we're using the default DXPL, don't modify it */ if ((*head)->ctx.dxpl_id != H5P_DATASET_XFER_DEFAULT) { @@ -3307,9 +3234,6 @@ H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -3322,8 +3246,8 @@ H5CX_test_set_mpio_coll_chunk_link_hard(int mpio_coll_chunk_link_hard) /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); + assert(head && *head); + assert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, mpio_coll_chunk_link_hard) @@ -3340,9 +3264,6 @@ H5CX_test_set_mpio_coll_chunk_link_hard(int mpio_coll_chunk_link_hard) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -3355,8 +3276,8 @@ H5CX_test_set_mpio_coll_chunk_multi_hard(int mpio_coll_chunk_multi_hard) /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); + assert(head && *head); + assert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, mpio_coll_chunk_multi_hard) @@ -3373,9 +3294,6 @@ H5CX_test_set_mpio_coll_chunk_multi_hard(int mpio_coll_chunk_multi_hard) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -3388,8 +3306,8 @@ H5CX_test_set_mpio_coll_chunk_link_num_true(int mpio_coll_chunk_link_num_true) /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); + assert(head && *head); + assert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, mpio_coll_chunk_link_num_true) @@ -3407,9 +3325,6 @@ H5CX_test_set_mpio_coll_chunk_link_num_true(int mpio_coll_chunk_link_num_true) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -3422,8 +3337,8 @@ H5CX_test_set_mpio_coll_chunk_link_num_false(int mpio_coll_chunk_link_num_false) /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); + assert(head && *head); + assert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, mpio_coll_chunk_link_num_false) @@ -3441,9 +3356,6 @@ H5CX_test_set_mpio_coll_chunk_link_num_false(int mpio_coll_chunk_link_num_false) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -3456,8 +3368,8 @@ H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(int mpio_coll_chunk_multi_ratio_c /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); + assert(head && *head); + assert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, mpio_coll_chunk_multi_ratio_coll) @@ -3475,9 +3387,6 @@ H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(int mpio_coll_chunk_multi_ratio_c * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -3490,8 +3399,8 @@ H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_in /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); + assert(head && *head); + assert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); H5CX_TEST_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, mpio_coll_chunk_multi_ratio_ind) @@ -3508,9 +3417,6 @@ H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_in * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * January 2, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -3523,8 +3429,8 @@ H5CX_test_set_mpio_coll_rank0_bcast(hbool_t mpio_coll_rank0_bcast) /* Sanity checks */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); + assert(head && *head); + assert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT)); H5CX_TEST_SET_PROP(H5D_XFER_COLL_RANK0_BCAST_NAME, mpio_coll_rank0_bcast) @@ -3534,6 +3440,38 @@ H5CX_test_set_mpio_coll_rank0_bcast(hbool_t mpio_coll_rank0_bcast) #endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ #endif /* H5_HAVE_PARALLEL */ +/*------------------------------------------------------------------------- + * Function: H5CX_set_no_selecction_io_cause + * + * Purpose: Sets the reason for not performing selection I/O for + * the current API call context. + * + * Return: + * + *------------------------------------------------------------------------- + */ +void +H5CX_set_no_selection_io_cause(uint32_t no_selection_io_cause) +{ + H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity checks */ + head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + assert(head && *head); + assert((*head)->ctx.dxpl_id != H5P_DEFAULT); + + /* If we're using the default DXPL, don't modify it */ + if ((*head)->ctx.dxpl_id != H5P_DATASET_XFER_DEFAULT) { + /* Cache the value for later, marking it to set in DXPL when context popped */ + (*head)->ctx.no_selection_io_cause = no_selection_io_cause; + (*head)->ctx.no_selection_io_cause_set = TRUE; + } /* end if */ + + FUNC_LEAVE_NOAPI_VOID +} /* end H5CX_set_no_selectiion_io_cause() */ + /*------------------------------------------------------------------------- * Function: H5CX_get_ohdr_flags * @@ -3541,9 +3479,6 @@ H5CX_test_set_mpio_coll_rank0_bcast(hbool_t mpio_coll_rank0_bcast) * * Return: Non-negative on success / Negative on failure * - * Programmer: Chris Hogan - * November 15, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -3555,10 +3490,10 @@ H5CX_get_ohdr_flags(uint8_t *ohdr_flags) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(ohdr_flags); + assert(ohdr_flags); head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); - HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id); + assert(head && *head); + assert(H5P_DEFAULT != (*head)->ctx.dcpl_id); H5CX_RETRIEVE_PROP_VALID(dcpl, H5P_DATASET_CREATE_DEFAULT, H5O_CRT_OHDR_FLAGS_NAME, ohdr_flags) @@ -3576,9 +3511,6 @@ H5CX_get_ohdr_flags(uint8_t *ohdr_flags) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * March 6, 2018 - * *------------------------------------------------------------------------- */ static H5CX_node_t * @@ -3587,18 +3519,15 @@ H5CX__pop_common(hbool_t update_dxpl_props) H5CX_node_t **head = NULL; /* Pointer to head of API context list */ H5CX_node_t *ret_value = NULL; /* Return value */ -#ifdef H5_HAVE_PARALLEL FUNC_ENTER_PACKAGE -#else - FUNC_ENTER_PACKAGE_NOERR -#endif /* Sanity check */ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ - HDassert(head && *head); + assert(head && *head); /* Check for cached DXPL properties to return to application */ if (update_dxpl_props) { + H5CX_SET_PROP(H5D_XFER_NO_SELECTION_IO_CAUSE_NAME, no_selection_io_cause) #ifdef H5_HAVE_PARALLEL H5CX_SET_PROP(H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, mpio_actual_chunk_opt) H5CX_SET_PROP(H5D_MPIO_ACTUAL_IO_MODE_NAME, mpio_actual_io_mode) @@ -3620,9 +3549,7 @@ H5CX__pop_common(hbool_t update_dxpl_props) ret_value = (*head); (*head) = (*head)->next; -#ifdef H5_HAVE_PARALLEL done: -#endif /* H5_HAVE_PARALLEL */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5CX__pop_common() */ @@ -3633,9 +3560,6 @@ H5CX__pop_common(hbool_t update_dxpl_props) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Februrary 19, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -3648,7 +3572,7 @@ H5CX_pop(hbool_t update_dxpl_props) /* Perform common operations and get top context from stack */ if (NULL == (cnode = H5CX__pop_common(update_dxpl_props))) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error getting API context node") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "error getting API context node"); /* Free the context node */ cnode = H5FL_FREE(H5CX_node_t, cnode); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Cdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Cdbg.c index c0a3e33e82..c65d942a1b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Cdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Cdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Cdbg.c - * July 8 2016 - * Quincey Koziol * * Purpose: Debugging Routines for the generic cache structure or entries. * @@ -70,9 +67,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 10/10/10 - * *------------------------------------------------------------------------- */ herr_t @@ -86,13 +80,12 @@ H5C_dump_cache(H5C_t *cache_ptr, const char *cache_name) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_name != NULL); + assert(cache_ptr != NULL); + assert(cache_name != NULL); /* First, create a skip list */ if (NULL == (slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create skip list") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create skip list"); /* Next, scan the index, and insert all entries in the skip list. * Do this, as we want to display cache entries in increasing address @@ -102,9 +95,8 @@ H5C_dump_cache(H5C_t *cache_ptr, const char *cache_name) entry_ptr = cache_ptr->index[i]; while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); if (H5SL_insert(slist_ptr, entry_ptr, &(entry_ptr->addr)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "can't insert entry in skip list") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "can't insert entry in skip list"); entry_ptr = entry_ptr->ht_next; } /* end while */ @@ -114,40 +106,38 @@ H5C_dump_cache(H5C_t *cache_ptr, const char *cache_name) * skip list -- scan the skip list generating the desired output. */ - HDfprintf(stdout, "\n\nDump of metadata cache \"%s\"\n", cache_name); + fprintf(stdout, "\n\nDump of metadata cache \"%s\"\n", cache_name); /* Print header */ - HDfprintf(stdout, "Entry "); - HDfprintf(stdout, "| Address "); - HDfprintf(stdout, "| Tag "); - HDfprintf(stdout, "| Size "); - HDfprintf(stdout, "| Ring "); - HDfprintf(stdout, "| Type "); - HDfprintf(stdout, "| Prot/Pin/Dirty"); - HDfprintf(stdout, "\n"); - - HDfprintf(stdout, "--------------------------------------------------------------------------------------" - "--------------------------\n"); + fprintf(stdout, "Entry "); + fprintf(stdout, "| Address "); + fprintf(stdout, "| Tag "); + fprintf(stdout, "| Size "); + fprintf(stdout, "| Ring "); + fprintf(stdout, "| Type "); + fprintf(stdout, "| Prot/Pin/Dirty"); + fprintf(stdout, "\n"); + + fprintf(stdout, "--------------------------------------------------------------------------------------" + "--------------------------\n"); i = 0; entry_ptr = (H5C_cache_entry_t *)H5SL_remove_first(slist_ptr); while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - /* Print entry */ - HDfprintf(stdout, "%s%5d ", cache_ptr->prefix, i); - HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->addr)); + fprintf(stdout, "%s%5d ", cache_ptr->prefix, i); + fprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->addr)); if (NULL == entry_ptr->tag_info) - HDfprintf(stdout, " %16s ", "N/A"); + fprintf(stdout, " %16s ", "N/A"); else - HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->tag_info->tag)); - HDfprintf(stdout, " %5lld ", (long long)(entry_ptr->size)); - HDfprintf(stdout, " %d ", (int)(entry_ptr->ring)); - HDfprintf(stdout, " %2d %-32s ", (int)(entry_ptr->type->id), (entry_ptr->type->name)); - HDfprintf(stdout, " %d", (int)(entry_ptr->is_protected)); - HDfprintf(stdout, " %d", (int)(entry_ptr->is_pinned)); - HDfprintf(stdout, " %d", (int)(entry_ptr->is_dirty)); - HDfprintf(stdout, "\n"); + fprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->tag_info->tag)); + fprintf(stdout, " %5lld ", (long long)(entry_ptr->size)); + fprintf(stdout, " %d ", (int)(entry_ptr->ring)); + fprintf(stdout, " %2d %-32s ", (int)(entry_ptr->type->id), (entry_ptr->type->name)); + fprintf(stdout, " %d", (int)(entry_ptr->is_protected)); + fprintf(stdout, " %d", (int)(entry_ptr->is_pinned)); + fprintf(stdout, " %d", (int)(entry_ptr->is_dirty)); + fprintf(stdout, "\n"); /* remove the next (first) item in the skip list */ entry_ptr = (H5C_cache_entry_t *)H5SL_remove_first(slist_ptr); @@ -155,10 +145,10 @@ H5C_dump_cache(H5C_t *cache_ptr, const char *cache_name) i++; } /* end while */ - HDfprintf(stdout, "\n\n"); + fprintf(stdout, "\n\n"); /* Verify that all the entries were removed from the skip list */ - HDassert(H5SL_count(slist_ptr) == 0); + assert(H5SL_count(slist_ptr) == 0); done: /* Discard the skip list */ @@ -179,9 +169,6 @@ H5C_dump_cache(H5C_t *cache_ptr, const char *cache_name) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 10/10/10 - * *------------------------------------------------------------------------- */ herr_t @@ -193,62 +180,58 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name) FUNC_ENTER_NOAPI_NOERR /* Sanity check */ - HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_name != NULL); + assert(cache_ptr != NULL); + assert(cache_name != NULL); - HDfprintf(stdout, "\n\nDump of metadata cache LRU \"%s\"\n", cache_name); - HDfprintf(stdout, "LRU len = %d, LRU size = %d\n", cache_ptr->LRU_list_len, - (int)(cache_ptr->LRU_list_size)); - HDfprintf(stdout, "index_size = %d, max_cache_size = %d, delta = %d\n\n", (int)(cache_ptr->index_size), - (int)(cache_ptr->max_cache_size), - (int)(cache_ptr->max_cache_size) - (int)(cache_ptr->index_size)); + fprintf(stdout, "\n\nDump of metadata cache LRU \"%s\"\n", cache_name); + fprintf(stdout, "LRU len = %d, LRU size = %d\n", cache_ptr->LRU_list_len, + (int)(cache_ptr->LRU_list_size)); + fprintf(stdout, "index_size = %d, max_cache_size = %d, delta = %d\n\n", (int)(cache_ptr->index_size), + (int)(cache_ptr->max_cache_size), + (int)(cache_ptr->max_cache_size) - (int)(cache_ptr->index_size)); /* Print header */ - HDfprintf(stdout, "Entry "); - HDfprintf(stdout, "| Address "); - HDfprintf(stdout, "| Tag "); - HDfprintf(stdout, "| Size "); - HDfprintf(stdout, "| Ring "); - HDfprintf(stdout, "| Type "); - HDfprintf(stdout, "| Dirty"); - HDfprintf(stdout, "\n"); - - HDfprintf(stdout, "--------------------------------------------------------------------------------------" - "--------------------------\n"); + fprintf(stdout, "Entry "); + fprintf(stdout, "| Address "); + fprintf(stdout, "| Tag "); + fprintf(stdout, "| Size "); + fprintf(stdout, "| Ring "); + fprintf(stdout, "| Type "); + fprintf(stdout, "| Dirty"); + fprintf(stdout, "\n"); + + fprintf(stdout, "--------------------------------------------------------------------------------------" + "--------------------------\n"); entry_ptr = cache_ptr->LRU_head_ptr; while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - /* Print entry */ - HDfprintf(stdout, "%s%5d ", cache_ptr->prefix, i); - HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->addr)); + fprintf(stdout, "%s%5d ", cache_ptr->prefix, i); + fprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->addr)); if (NULL == entry_ptr->tag_info) - HDfprintf(stdout, " %16s ", "N/A"); + fprintf(stdout, " %16s ", "N/A"); else - HDfprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->tag_info->tag)); + fprintf(stdout, " 0x%16llx ", (long long)(entry_ptr->tag_info->tag)); - HDfprintf(stdout, " %5lld ", (long long)(entry_ptr->size)); - HDfprintf(stdout, " %d ", (int)(entry_ptr->ring)); - HDfprintf(stdout, " %2d %-32s ", (int)(entry_ptr->type->id), (entry_ptr->type->name)); - HDfprintf(stdout, " %d", (int)(entry_ptr->is_dirty)); - HDfprintf(stdout, "\n"); + fprintf(stdout, " %5lld ", (long long)(entry_ptr->size)); + fprintf(stdout, " %d ", (int)(entry_ptr->ring)); + fprintf(stdout, " %2d %-32s ", (int)(entry_ptr->type->id), (entry_ptr->type->name)); + fprintf(stdout, " %d", (int)(entry_ptr->is_dirty)); + fprintf(stdout, "\n"); i++; entry_ptr = entry_ptr->next; } /* end while */ - HDfprintf(stdout, "--------------------------------------------------------------------------------------" - "--------------------------\n"); + fprintf(stdout, "--------------------------------------------------------------------------------------" + "--------------------------\n"); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5C_dump_cache_LRU() */ #endif /* NDEBUG */ /*------------------------------------------------------------------------- - * * Function: H5C_dump_cache_skip_list * * Purpose: Debugging routine that prints a summary of the contents of @@ -257,15 +240,6 @@ H5C_dump_cache_LRU(H5C_t *cache_ptr, const char *cache_name) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 11/15/14 - * - * Changes: Updated function for the slist_enabled field in H5C_t. - * Recall that to minimize slist overhead, the slist is - * empty and not maintained if cache_ptr->slist_enabled is - * false. - * JRM -- 5/6/20 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -279,68 +253,50 @@ H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn) FUNC_ENTER_NOAPI_NOERR - HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(calling_fcn != NULL); + assert(cache_ptr != NULL); + assert(calling_fcn != NULL); - HDfprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", calling_fcn); - HDfprintf(stdout, " slist %s.\n", cache_ptr->slist_enabled ? "enabled" : "disabled"); - HDfprintf(stdout, " slist len = %" PRIu32 ".\n", cache_ptr->slist_len); - HDfprintf(stdout, " slist size = %zu.\n", cache_ptr->slist_size); + fprintf(stdout, "\n\nDumping metadata cache skip list from %s.\n", calling_fcn); + fprintf(stdout, " slist %s.\n", cache_ptr->slist_enabled ? "enabled" : "disabled"); + fprintf(stdout, " slist len = %" PRIu32 ".\n", cache_ptr->slist_len); + fprintf(stdout, " slist size = %zu.\n", cache_ptr->slist_size); if (cache_ptr->slist_len > 0) { /* If we get this far, all entries in the cache are listed in the * skip list -- scan the skip list generating the desired output. */ - HDfprintf(stdout, "Num: Addr: Len: Prot/Pind: Dirty: Type:\n"); + fprintf(stdout, "Num: Addr: Len: Prot/Pind: Dirty: Type:\n"); i = 0; node_ptr = H5SL_first(cache_ptr->slist_ptr); - - if (node_ptr != NULL) { - + if (node_ptr != NULL) entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - } - else { - + else entry_ptr = NULL; - } while (entry_ptr != NULL) { - - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - - HDfprintf(stdout, "%s%d 0x%016llx %4lld %d/%d %d %s\n", cache_ptr->prefix, i, - (long long)(entry_ptr->addr), (long long)(entry_ptr->size), - (int)(entry_ptr->is_protected), (int)(entry_ptr->is_pinned), (int)(entry_ptr->is_dirty), - entry_ptr->type->name); - - HDfprintf(stdout, " node_ptr = %p, item = %p\n", (void *)node_ptr, H5SL_item(node_ptr)); + fprintf(stdout, "%s%d 0x%016llx %4lld %d/%d %d %s\n", cache_ptr->prefix, i, + (long long)(entry_ptr->addr), (long long)(entry_ptr->size), + (int)(entry_ptr->is_protected), (int)(entry_ptr->is_pinned), (int)(entry_ptr->is_dirty), + entry_ptr->type->name); + fprintf(stdout, " node_ptr = %p, item = %p\n", (void *)node_ptr, H5SL_item(node_ptr)); /* increment node_ptr before we delete its target */ - node_ptr = H5SL_next(node_ptr); - - if (node_ptr != NULL) { - + if (node_ptr != NULL) entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); - } - else { - + else entry_ptr = NULL; - } i++; - } /* end while */ } /* end if */ - HDfprintf(stdout, "\n\n"); + fprintf(stdout, "\n\n"); FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_dump_cache_skip_list() */ #endif /* NDEBUG */ @@ -352,9 +308,6 @@ H5C_dump_cache_skip_list(H5C_t *cache_ptr, char *calling_fcn) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 1/20/06 - * *------------------------------------------------------------------------- */ herr_t @@ -364,9 +317,8 @@ H5C_set_prefix(H5C_t *cache_ptr, char *prefix) FUNC_ENTER_NOAPI(FAIL) - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC) || (prefix == NULL) || - (HDstrlen(prefix) >= H5C__PREFIX_LEN)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry") + if (cache_ptr == NULL || prefix == NULL || HDstrlen(prefix) >= H5C__PREFIX_LEN) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry"); HDstrncpy(&(cache_ptr->prefix[0]), prefix, (size_t)(H5C__PREFIX_LEN)); @@ -383,9 +335,6 @@ H5C_set_prefix(H5C_t *cache_ptr, char *prefix) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 6/2/04 - * *------------------------------------------------------------------------- */ herr_t @@ -439,13 +388,8 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name, FUNC_ENTER_NOAPI(FAIL) - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - - /* This would normally be an assert, but we need to use an HGOTO_ERROR - * call to shut up the compiler. - */ - if ((NULL == cache_ptr) || (cache_ptr->magic != H5C__H5C_T_MAGIC) || (NULL == cache_name)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or cache_name") + if (NULL == cache_ptr || NULL == cache_name) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr or cache_name"); #if H5C_COLLECT_CACHE_STATS for (i = 0; i <= cache_ptr->max_type_id; i++) { @@ -504,157 +448,154 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name, average_failed_search_depth = ((double)(cache_ptr->total_failed_ht_search_depth)) / ((double)(cache_ptr->failed_ht_searches)); - HDfprintf(stdout, "\n%sH5C: cache statistics for %s\n", cache_ptr->prefix, cache_name); + fprintf(stdout, "\n%sH5C: cache statistics for %s\n", cache_ptr->prefix, cache_name); - HDfprintf(stdout, "\n"); + fprintf(stdout, "\n"); - HDfprintf(stdout, "%s hash table insertion / deletions = %ld / %ld\n", cache_ptr->prefix, - (long)(cache_ptr->total_ht_insertions), (long)(cache_ptr->total_ht_deletions)); + fprintf(stdout, "%s hash table insertion / deletions = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->total_ht_insertions), (long)(cache_ptr->total_ht_deletions)); - HDfprintf(stdout, "%s HT successful / failed searches = %ld / %ld\n", cache_ptr->prefix, - (long)(cache_ptr->successful_ht_searches), (long)(cache_ptr->failed_ht_searches)); + fprintf(stdout, "%s HT successful / failed searches = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->successful_ht_searches), (long)(cache_ptr->failed_ht_searches)); - HDfprintf(stdout, "%s Av. HT suc / failed search depth = %f / %f\n", cache_ptr->prefix, - average_successful_search_depth, average_failed_search_depth); + fprintf(stdout, "%s Av. HT suc / failed search depth = %f / %f\n", cache_ptr->prefix, + average_successful_search_depth, average_failed_search_depth); - HDfprintf(stdout, "%s current (max) index size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, - (long)(cache_ptr->index_size), (long)(cache_ptr->max_index_size), - (unsigned long)(cache_ptr->index_len), (unsigned long)(cache_ptr->max_index_len)); + fprintf(stdout, "%s current (max) index size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, + (long)(cache_ptr->index_size), (long)(cache_ptr->max_index_size), + (unsigned long)(cache_ptr->index_len), (unsigned long)(cache_ptr->max_index_len)); - HDfprintf(stdout, "%s current (max) clean/dirty idx size = %ld (%ld) / %ld (%ld)\n", cache_ptr->prefix, - (long)(cache_ptr->clean_index_size), (long)(cache_ptr->max_clean_index_size), - (long)(cache_ptr->dirty_index_size), (long)(cache_ptr->max_dirty_index_size)); + fprintf(stdout, "%s current (max) clean/dirty idx size = %ld (%ld) / %ld (%ld)\n", cache_ptr->prefix, + (long)(cache_ptr->clean_index_size), (long)(cache_ptr->max_clean_index_size), + (long)(cache_ptr->dirty_index_size), (long)(cache_ptr->max_dirty_index_size)); - HDfprintf(stdout, "%s current (max) slist size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, - (long)(cache_ptr->slist_size), (long)(cache_ptr->max_slist_size), - (unsigned long)(cache_ptr->slist_len), (unsigned long)(cache_ptr->max_slist_len)); + fprintf(stdout, "%s current (max) slist size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, + (long)(cache_ptr->slist_size), (long)(cache_ptr->max_slist_size), + (unsigned long)(cache_ptr->slist_len), (unsigned long)(cache_ptr->max_slist_len)); - HDfprintf(stdout, "%s current (max) PL size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, - (long)(cache_ptr->pl_size), (long)(cache_ptr->max_pl_size), (unsigned long)(cache_ptr->pl_len), - (unsigned long)(cache_ptr->max_pl_len)); + fprintf(stdout, "%s current (max) PL size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, + (long)(cache_ptr->pl_size), (long)(cache_ptr->max_pl_size), (unsigned long)(cache_ptr->pl_len), + (unsigned long)(cache_ptr->max_pl_len)); - HDfprintf(stdout, "%s current (max) PEL size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, - (long)(cache_ptr->pel_size), (long)(cache_ptr->max_pel_size), - (unsigned long)(cache_ptr->pel_len), (unsigned long)(cache_ptr->max_pel_len)); + fprintf(stdout, "%s current (max) PEL size / length = %ld (%ld) / %lu (%lu)\n", cache_ptr->prefix, + (long)(cache_ptr->pel_size), (long)(cache_ptr->max_pel_size), (unsigned long)(cache_ptr->pel_len), + (unsigned long)(cache_ptr->max_pel_len)); - HDfprintf(stdout, "%s current LRU list size / length = %ld / %lu\n", cache_ptr->prefix, - (long)(cache_ptr->LRU_list_size), (unsigned long)(cache_ptr->LRU_list_len)); + fprintf(stdout, "%s current LRU list size / length = %ld / %lu\n", cache_ptr->prefix, + (long)(cache_ptr->LRU_list_size), (unsigned long)(cache_ptr->LRU_list_len)); #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - HDfprintf(stdout, "%s current clean LRU size / length = %ld / %lu\n", cache_ptr->prefix, - (long)(cache_ptr->cLRU_list_size), (unsigned long)(cache_ptr->cLRU_list_len)); + fprintf(stdout, "%s current clean LRU size / length = %ld / %lu\n", cache_ptr->prefix, + (long)(cache_ptr->cLRU_list_size), (unsigned long)(cache_ptr->cLRU_list_len)); - HDfprintf(stdout, "%s current dirty LRU size / length = %ld / %lu\n", cache_ptr->prefix, - (long)(cache_ptr->dLRU_list_size), (unsigned long)(cache_ptr->dLRU_list_len)); + fprintf(stdout, "%s current dirty LRU size / length = %ld / %lu\n", cache_ptr->prefix, + (long)(cache_ptr->dLRU_list_size), (unsigned long)(cache_ptr->dLRU_list_len)); #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ - HDfprintf(stdout, "%s Total hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix, - (long)total_hits, (long)total_misses, hit_rate); + fprintf(stdout, "%s Total hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix, + (long)total_hits, (long)total_misses, hit_rate); - HDfprintf(stdout, "%s Total write / read (max) protects = %ld / %ld (%ld)\n", cache_ptr->prefix, - (long)total_write_protects, (long)total_read_protects, (long)max_read_protects); + fprintf(stdout, "%s Total write / read (max) protects = %ld / %ld (%ld)\n", cache_ptr->prefix, + (long)total_write_protects, (long)total_read_protects, (long)max_read_protects); - HDfprintf(stdout, "%s Total clears / flushes = %ld / %ld\n", cache_ptr->prefix, - (long)total_clears, (long)total_flushes); + fprintf(stdout, "%s Total clears / flushes = %ld / %ld\n", cache_ptr->prefix, + (long)total_clears, (long)total_flushes); - HDfprintf(stdout, "%s Total evictions / take ownerships = %ld / %ld\n", cache_ptr->prefix, - (long)total_evictions, (long)total_take_ownerships); + fprintf(stdout, "%s Total evictions / take ownerships = %ld / %ld\n", cache_ptr->prefix, + (long)total_evictions, (long)total_take_ownerships); - HDfprintf(stdout, "%s Total insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix, - (long)total_insertions, (long)total_pinned_insertions, (long)total_moves); + fprintf(stdout, "%s Total insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix, + (long)total_insertions, (long)total_pinned_insertions, (long)total_moves); - HDfprintf(stdout, "%s Total entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix, - (long)total_entry_flush_moves, (long)total_cache_flush_moves); + fprintf(stdout, "%s Total entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix, + (long)total_entry_flush_moves, (long)total_cache_flush_moves); - HDfprintf(stdout, "%s Total entry size incrs / decrs = %ld / %ld\n", cache_ptr->prefix, - (long)total_size_increases, (long)total_size_decreases); + fprintf(stdout, "%s Total entry size incrs / decrs = %ld / %ld\n", cache_ptr->prefix, + (long)total_size_increases, (long)total_size_decreases); - HDfprintf(stdout, "%s Ttl entry/cache flush size changes = %ld / %ld\n", cache_ptr->prefix, - (long)total_entry_flush_size_changes, (long)total_cache_flush_size_changes); + fprintf(stdout, "%s Ttl entry/cache flush size changes = %ld / %ld\n", cache_ptr->prefix, + (long)total_entry_flush_size_changes, (long)total_cache_flush_size_changes); - HDfprintf(stdout, "%s Total entry pins (dirty) / unpins = %ld (%ld) / %ld\n", cache_ptr->prefix, - (long)total_pins, (long)total_dirty_pins, (long)total_unpins); + fprintf(stdout, "%s Total entry pins (dirty) / unpins = %ld (%ld) / %ld\n", cache_ptr->prefix, + (long)total_pins, (long)total_dirty_pins, (long)total_unpins); - HDfprintf(stdout, "%s Total pinned flushes / clears = %ld / %ld\n", cache_ptr->prefix, - (long)total_pinned_flushes, (long)total_pinned_clears); + fprintf(stdout, "%s Total pinned flushes / clears = %ld / %ld\n", cache_ptr->prefix, + (long)total_pinned_flushes, (long)total_pinned_clears); - HDfprintf(stdout, "%s MSIC: (make space in cache) calls = %lld\n", cache_ptr->prefix, - (long long)(cache_ptr->calls_to_msic)); + fprintf(stdout, "%s MSIC: (make space in cache) calls = %lld\n", cache_ptr->prefix, + (long long)(cache_ptr->calls_to_msic)); if (cache_ptr->calls_to_msic > 0) average_entries_skipped_per_calls_to_msic = (((double)(cache_ptr->total_entries_skipped_in_msic)) / ((double)(cache_ptr->calls_to_msic))); - HDfprintf(stdout, "%s MSIC: Average/max entries skipped = %lf / %ld\n", cache_ptr->prefix, - (double)average_entries_skipped_per_calls_to_msic, - (long)(cache_ptr->max_entries_skipped_in_msic)); + fprintf(stdout, "%s MSIC: Average/max entries skipped = %lf / %ld\n", cache_ptr->prefix, + (double)average_entries_skipped_per_calls_to_msic, + (long)(cache_ptr->max_entries_skipped_in_msic)); if (cache_ptr->calls_to_msic > 0) average_dirty_pf_entries_skipped_per_call_to_msic = (((double)(cache_ptr->total_dirty_pf_entries_skipped_in_msic)) / ((double)(cache_ptr->calls_to_msic))); - HDfprintf(stdout, "%s MSIC: Average/max dirty pf entries skipped = %lf / %ld\n", cache_ptr->prefix, - average_dirty_pf_entries_skipped_per_call_to_msic, - (long)(cache_ptr->max_dirty_pf_entries_skipped_in_msic)); + fprintf(stdout, "%s MSIC: Average/max dirty pf entries skipped = %lf / %ld\n", cache_ptr->prefix, + average_dirty_pf_entries_skipped_per_call_to_msic, + (long)(cache_ptr->max_dirty_pf_entries_skipped_in_msic)); if (cache_ptr->calls_to_msic > 0) average_entries_scanned_per_calls_to_msic = (((double)(cache_ptr->total_entries_scanned_in_msic)) / ((double)(cache_ptr->calls_to_msic))); - HDfprintf(stdout, "%s MSIC: Average/max entries scanned = %lf / %ld\n", cache_ptr->prefix, - (double)average_entries_scanned_per_calls_to_msic, - (long)(cache_ptr->max_entries_scanned_in_msic)); + fprintf(stdout, "%s MSIC: Average/max entries scanned = %lf / %ld\n", cache_ptr->prefix, + (double)average_entries_scanned_per_calls_to_msic, + (long)(cache_ptr->max_entries_scanned_in_msic)); - HDfprintf(stdout, "%s MSIC: Scanned to make space(evict) = %lld\n", cache_ptr->prefix, - (long long)(cache_ptr->entries_scanned_to_make_space)); + fprintf(stdout, "%s MSIC: Scanned to make space(evict) = %lld\n", cache_ptr->prefix, + (long long)(cache_ptr->entries_scanned_to_make_space)); - HDfprintf( - stdout, "%s MSIC: Scanned to satisfy min_clean = %lld\n", cache_ptr->prefix, - (long long)(cache_ptr->total_entries_scanned_in_msic - cache_ptr->entries_scanned_to_make_space)); + fprintf(stdout, "%s MSIC: Scanned to satisfy min_clean = %lld\n", cache_ptr->prefix, + (long long)(cache_ptr->total_entries_scanned_in_msic - cache_ptr->entries_scanned_to_make_space)); - HDfprintf(stdout, "%s slist/LRU/index scan restarts = %lld / %lld / %lld.\n", cache_ptr->prefix, - (long long)(cache_ptr->slist_scan_restarts), (long long)(cache_ptr->LRU_scan_restarts), - (long long)(cache_ptr->index_scan_restarts)); + fprintf(stdout, "%s slist/LRU/index scan restarts = %lld / %lld / %lld.\n", cache_ptr->prefix, + (long long)(cache_ptr->slist_scan_restarts), (long long)(cache_ptr->LRU_scan_restarts), + (long long)(cache_ptr->index_scan_restarts)); - HDfprintf(stdout, "%s cache image creations/reads/loads/size = %d / %d /%d / %" PRIuHSIZE "\n", - cache_ptr->prefix, cache_ptr->images_created, cache_ptr->images_read, cache_ptr->images_loaded, - cache_ptr->last_image_size); + fprintf(stdout, "%s cache image creations/reads/loads/size = %d / %d /%d / %" PRIuHSIZE "\n", + cache_ptr->prefix, cache_ptr->images_created, cache_ptr->images_read, cache_ptr->images_loaded, + cache_ptr->last_image_size); - HDfprintf(stdout, "%s prefetches / dirty prefetches = %lld / %lld\n", cache_ptr->prefix, - (long long)(cache_ptr->prefetches), (long long)(cache_ptr->dirty_prefetches)); + fprintf(stdout, "%s prefetches / dirty prefetches = %lld / %lld\n", cache_ptr->prefix, + (long long)(cache_ptr->prefetches), (long long)(cache_ptr->dirty_prefetches)); - HDfprintf(stdout, "%s prefetch hits/flushes/evictions = %lld / %lld / %lld\n", cache_ptr->prefix, - (long long)(cache_ptr->prefetch_hits), - (long long)(cache_ptr->flushes[H5AC_PREFETCHED_ENTRY_ID]), - (long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID])); + fprintf(stdout, "%s prefetch hits/flushes/evictions = %lld / %lld / %lld\n", cache_ptr->prefix, + (long long)(cache_ptr->prefetch_hits), (long long)(cache_ptr->flushes[H5AC_PREFETCHED_ENTRY_ID]), + (long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID])); if (cache_ptr->prefetches > 0) prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches)); else prefetch_use_rate = 0.0; - HDfprintf(stdout, "%s prefetched entry use rate = %lf\n", cache_ptr->prefix, prefetch_use_rate); + fprintf(stdout, "%s prefetched entry use rate = %lf\n", cache_ptr->prefix, prefetch_use_rate); #if H5C_COLLECT_CACHE_ENTRY_STATS - HDfprintf(stdout, "%s aggregate max / min accesses = %d / %d\n", cache_ptr->prefix, - (int)aggregate_max_accesses, (int)aggregate_min_accesses); + fprintf(stdout, "%s aggregate max / min accesses = %d / %d\n", cache_ptr->prefix, + (int)aggregate_max_accesses, (int)aggregate_min_accesses); - HDfprintf(stdout, "%s aggregate max_clears / max_flushes = %d / %d\n", cache_ptr->prefix, - (int)aggregate_max_clears, (int)aggregate_max_flushes); + fprintf(stdout, "%s aggregate max_clears / max_flushes = %d / %d\n", cache_ptr->prefix, + (int)aggregate_max_clears, (int)aggregate_max_flushes); - HDfprintf(stdout, "%s aggregate max_size / max_pins = %d / %d\n", cache_ptr->prefix, - (int)aggregate_max_size, (int)aggregate_max_pins); + fprintf(stdout, "%s aggregate max_size / max_pins = %d / %d\n", cache_ptr->prefix, + (int)aggregate_max_size, (int)aggregate_max_pins); #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ if (display_detailed_stats) { for (i = 0; i <= cache_ptr->max_type_id; i++) { - HDfprintf(stdout, "\n"); + fprintf(stdout, "\n"); - HDfprintf(stdout, "%s Stats on %s:\n", cache_ptr->prefix, - ((cache_ptr->class_table_ptr))[i]->name); + fprintf(stdout, "%s Stats on %s:\n", cache_ptr->prefix, ((cache_ptr->class_table_ptr))[i]->name); if ((cache_ptr->hits[i] > 0) || (cache_ptr->misses[i] > 0)) hit_rate = 100.0 * ((double)(cache_ptr->hits[i])) / @@ -662,56 +603,56 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name, else hit_rate = 0.0; - HDfprintf(stdout, "%s hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix, - (long)(cache_ptr->hits[i]), (long)(cache_ptr->misses[i]), hit_rate); + fprintf(stdout, "%s hits / misses / hit_rate = %ld / %ld / %f\n", cache_ptr->prefix, + (long)(cache_ptr->hits[i]), (long)(cache_ptr->misses[i]), hit_rate); - HDfprintf(stdout, "%s write / read (max) protects = %ld / %ld (%d)\n", cache_ptr->prefix, - (long)(cache_ptr->write_protects[i]), (long)(cache_ptr->read_protects[i]), - (int)(cache_ptr->max_read_protects[i])); + fprintf(stdout, "%s write / read (max) protects = %ld / %ld (%d)\n", cache_ptr->prefix, + (long)(cache_ptr->write_protects[i]), (long)(cache_ptr->read_protects[i]), + (int)(cache_ptr->max_read_protects[i])); - HDfprintf(stdout, "%s clears / flushes = %ld / %ld\n", cache_ptr->prefix, - (long)(cache_ptr->clears[i]), (long)(cache_ptr->flushes[i])); + fprintf(stdout, "%s clears / flushes = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->clears[i]), (long)(cache_ptr->flushes[i])); - HDfprintf(stdout, "%s evictions / take ownerships = %ld / %ld\n", cache_ptr->prefix, - (long)(cache_ptr->evictions[i]), (long)(cache_ptr->take_ownerships[i])); + fprintf(stdout, "%s evictions / take ownerships = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->evictions[i]), (long)(cache_ptr->take_ownerships[i])); - HDfprintf(stdout, "%s insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix, - (long)(cache_ptr->insertions[i]), (long)(cache_ptr->pinned_insertions[i]), - (long)(cache_ptr->moves[i])); + fprintf(stdout, "%s insertions(pinned) / moves = %ld(%ld) / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->insertions[i]), (long)(cache_ptr->pinned_insertions[i]), + (long)(cache_ptr->moves[i])); - HDfprintf(stdout, "%s entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix, - (long)(cache_ptr->entry_flush_moves[i]), (long)(cache_ptr->cache_flush_moves[i])); + fprintf(stdout, "%s entry / cache flush moves = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->entry_flush_moves[i]), (long)(cache_ptr->cache_flush_moves[i])); - HDfprintf(stdout, "%s size increases / decreases = %ld / %ld\n", cache_ptr->prefix, - (long)(cache_ptr->size_increases[i]), (long)(cache_ptr->size_decreases[i])); + fprintf(stdout, "%s size increases / decreases = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->size_increases[i]), (long)(cache_ptr->size_decreases[i])); - HDfprintf(stdout, "%s entry/cache flush size changes = %ld / %ld\n", cache_ptr->prefix, - (long)(cache_ptr->entry_flush_size_changes[i]), - (long)(cache_ptr->cache_flush_size_changes[i])); + fprintf(stdout, "%s entry/cache flush size changes = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->entry_flush_size_changes[i]), + (long)(cache_ptr->cache_flush_size_changes[i])); - HDfprintf(stdout, "%s entry pins / unpins = %ld / %ld\n", cache_ptr->prefix, - (long)(cache_ptr->pins[i]), (long)(cache_ptr->unpins[i])); + fprintf(stdout, "%s entry pins / unpins = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->pins[i]), (long)(cache_ptr->unpins[i])); - HDfprintf(stdout, "%s entry dirty pins/pin'd flushes = %ld / %ld\n", cache_ptr->prefix, - (long)(cache_ptr->dirty_pins[i]), (long)(cache_ptr->pinned_flushes[i])); + fprintf(stdout, "%s entry dirty pins/pin'd flushes = %ld / %ld\n", cache_ptr->prefix, + (long)(cache_ptr->dirty_pins[i]), (long)(cache_ptr->pinned_flushes[i])); #if H5C_COLLECT_CACHE_ENTRY_STATS - HDfprintf(stdout, "%s entry max / min accesses = %d / %d\n", cache_ptr->prefix, - cache_ptr->max_accesses[i], cache_ptr->min_accesses[i]); + fprintf(stdout, "%s entry max / min accesses = %d / %d\n", cache_ptr->prefix, + cache_ptr->max_accesses[i], cache_ptr->min_accesses[i]); - HDfprintf(stdout, "%s entry max_clears / max_flushes = %d / %d\n", cache_ptr->prefix, - cache_ptr->max_clears[i], cache_ptr->max_flushes[i]); + fprintf(stdout, "%s entry max_clears / max_flushes = %d / %d\n", cache_ptr->prefix, + cache_ptr->max_clears[i], cache_ptr->max_flushes[i]); - HDfprintf(stdout, "%s entry max_size / max_pins = %d / %d\n", cache_ptr->prefix, - (int)(cache_ptr->max_size[i]), (int)(cache_ptr->max_pins[i])); + fprintf(stdout, "%s entry max_size / max_pins = %d / %d\n", cache_ptr->prefix, + (int)(cache_ptr->max_size[i]), (int)(cache_ptr->max_pins[i])); #endif /* H5C_COLLECT_CACHE_ENTRY_STATS */ } /* end for */ } /* end if */ - HDfprintf(stdout, "\n"); + fprintf(stdout, "\n"); #endif /* H5C_COLLECT_CACHE_STATS */ @@ -720,15 +661,12 @@ H5C_stats(H5C_t *cache_ptr, const char *cache_name, } /* H5C_stats() */ /*------------------------------------------------------------------------- - * * Function: H5C_stats__reset * * Purpose: Reset the stats fields to their initial values. * * Return: void * - * Programmer: John Mainzer, 4/28/04 - * *------------------------------------------------------------------------- */ void @@ -736,7 +674,7 @@ void H5C_stats__reset(H5C_t *cache_ptr) #else /* NDEBUG */ #if H5C_COLLECT_CACHE_STATS -H5C_stats__reset(H5C_t *cache_ptr) +H5C_stats__reset(H5C_t *cache_ptr) #else /* H5C_COLLECT_CACHE_STATS */ H5C_stats__reset(H5C_t H5_ATTR_UNUSED *cache_ptr) #endif /* H5C_COLLECT_CACHE_STATS */ @@ -746,8 +684,7 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED *cache_ptr) int i; #endif /* H5C_COLLECT_CACHE_STATS */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); #if H5C_COLLECT_CACHE_STATS for (i = 0; i <= cache_ptr->max_type_id; i++) { @@ -853,9 +790,6 @@ H5C_stats__reset(H5C_t H5_ATTR_UNUSED *cache_ptr) * Return: SUCCEED on success/FAIL on failure. Note that * *fd_exists_ptr is undefined on failure. * - * Programmer: John Mainzer - * 9/28/16 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -870,29 +804,25 @@ H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child FUNC_ENTER_NOAPI(NULL) /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(H5F_addr_defined(parent_addr)); - HDassert(H5F_addr_defined(child_addr)); - HDassert(fd_exists_ptr); + assert(cache_ptr); + assert(H5_addr_defined(parent_addr)); + assert(H5_addr_defined(child_addr)); + assert(fd_exists_ptr); - H5C__SEARCH_INDEX(cache_ptr, parent_addr, parent_ptr, FAIL) - H5C__SEARCH_INDEX(cache_ptr, child_addr, child_ptr, FAIL) + H5C__SEARCH_INDEX(cache_ptr, parent_addr, parent_ptr, FAIL); + H5C__SEARCH_INDEX(cache_ptr, child_addr, child_ptr, FAIL); if (parent_ptr && child_ptr) { - HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(child_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - if (child_ptr->flush_dep_nparents > 0) { unsigned u; /* Local index variable */ - HDassert(child_ptr->flush_dep_parent); - HDassert(child_ptr->flush_dep_parent_nalloc >= child_ptr->flush_dep_nparents); + assert(child_ptr->flush_dep_parent); + assert(child_ptr->flush_dep_parent_nalloc >= child_ptr->flush_dep_nparents); for (u = 0; u < child_ptr->flush_dep_nparents; u++) { if (child_ptr->flush_dep_parent[u] == parent_ptr) { fd_exists = TRUE; - HDassert(parent_ptr->flush_dep_nchildren > 0); + assert(parent_ptr->flush_dep_nchildren > 0); break; } /* end if */ } /* end for */ @@ -907,7 +837,6 @@ H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child #endif /* NDEBUG */ /*------------------------------------------------------------------------- - * * Function: H5C_validate_index_list * * Purpose: Debugging function that scans the index list for errors. @@ -918,8 +847,6 @@ H5C_flush_dependency_exists(H5C_t *cache_ptr, haddr_t parent_addr, haddr_t child * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: John Mainzer, 9/16/16 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -941,8 +868,7 @@ H5C_validate_index_list(H5C_t *cache_ptr) FUNC_ENTER_NOAPI_NOINIT /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); for (i = 0; i < H5C_RING_NTYPES; i++) { index_ring_len[i] = 0; @@ -953,30 +879,30 @@ H5C_validate_index_list(H5C_t *cache_ptr) if (((cache_ptr->il_head == NULL) || (cache_ptr->il_tail == NULL)) && (cache_ptr->il_head != cache_ptr->il_tail)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointer validation failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointer validation failed"); if ((cache_ptr->index_len == 1) && ((cache_ptr->il_head != cache_ptr->il_tail) || (cache_ptr->il_head == NULL) || (cache_ptr->il_head->size != cache_ptr->index_size))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointer sanity checks failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointer sanity checks failed"); if ((cache_ptr->index_len >= 1) && ((cache_ptr->il_head == NULL) || (cache_ptr->il_head->il_prev != NULL) || (cache_ptr->il_tail == NULL) || (cache_ptr->il_tail->il_next != NULL))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list length sanity checks failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list length sanity checks failed"); entry_ptr = cache_ptr->il_head; while (entry_ptr != NULL) { if ((entry_ptr != cache_ptr->il_head) && ((entry_ptr->il_prev == NULL) || (entry_ptr->il_prev->il_next != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointers for entry are invalid") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointers for entry are invalid"); if ((entry_ptr != cache_ptr->il_tail) && ((entry_ptr->il_next == NULL) || (entry_ptr->il_next->il_prev != entry_ptr))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointers for entry are invalid") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index list pointers for entry are invalid"); - HDassert(entry_ptr->ring > 0); - HDassert(entry_ptr->ring < H5C_RING_NTYPES); + assert(entry_ptr->ring > 0); + assert(entry_ptr->ring < H5C_RING_NTYPES); len++; index_ring_len[entry_ptr->ring] += 1; @@ -999,7 +925,7 @@ H5C_validate_index_list(H5C_t *cache_ptr) if ((cache_ptr->index_len != len) || (cache_ptr->il_len != len) || (cache_ptr->index_size != size) || (cache_ptr->il_size != size) || (cache_ptr->clean_index_size != clean_size) || (cache_ptr->dirty_index_size != dirty_size) || (clean_size + dirty_size != size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index, clean and dirty sizes for cache are invalid") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index, clean and dirty sizes for cache are invalid"); size = 0; clean_size = 0; @@ -1012,18 +938,17 @@ H5C_validate_index_list(H5C_t *cache_ptr) if ((cache_ptr->index_size != size) || (cache_ptr->clean_index_size != clean_size) || (cache_ptr->dirty_index_size != dirty_size)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index, clean and dirty sizes for cache are invalid") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Index, clean and dirty sizes for cache are invalid"); done: if (ret_value != SUCCEED) - HDassert(0); + assert(0); FUNC_LEAVE_NOAPI(ret_value) } /* H5C_validate_index_list() */ #endif /* NDEBUG */ /*------------------------------------------------------------------------- - * * Function: H5C_get_entry_ptr_from_addr() * * Purpose: Debugging function that attempts to look up an entry in the @@ -1054,8 +979,6 @@ H5C_validate_index_list(H5C_t *cache_ptr) * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: John Mainzer, 5/30/14 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -1068,12 +991,11 @@ H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(H5F_addr_defined(addr)); - HDassert(entry_ptr_ptr); + assert(cache_ptr); + assert(H5_addr_defined(addr)); + assert(entry_ptr_ptr); - H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL); if (entry_ptr == NULL) /* the entry doesn't exist in the cache -- report this @@ -1100,9 +1022,6 @@ H5C_get_entry_ptr_from_addr(H5C_t *cache_ptr, haddr_t addr, void **entry_ptr_ptr * * Return: Current value of cache_ptr->serialization_in_progress. * - * Programmer: John Mainzer - * 8/24/15 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -1112,15 +1031,13 @@ H5C_get_serialization_in_progress(const H5C_t *cache_ptr) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); FUNC_LEAVE_NOAPI(cache_ptr->serialization_in_progress) } /* H5C_get_serialization_in_progress() */ #endif /* NDEBUG */ /*------------------------------------------------------------------------- - * * Function: H5C_cache_is_clean() * * Purpose: Debugging function that verifies that all rings in the @@ -1132,8 +1049,6 @@ H5C_get_serialization_in_progress(const H5C_t *cache_ptr) * * Return: TRUE if the indicated ring(s) are clean, and FALSE otherwise. * - * Programmer: John Mainzer, 6/18/16 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -1146,14 +1061,13 @@ H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(inner_ring >= H5C_RING_USER); - HDassert(inner_ring <= H5C_RING_SB); + assert(cache_ptr); + assert(inner_ring >= H5C_RING_USER); + assert(inner_ring <= H5C_RING_SB); while (ring <= inner_ring) { if (cache_ptr->dirty_index_ring_size[ring] > 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); ring++; } /* end while */ @@ -1164,7 +1078,6 @@ H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring) #endif /* NDEBUG */ /*------------------------------------------------------------------------- - * * Function: H5C_verify_entry_type() * * Purpose: Debugging function that attempts to look up an entry in the @@ -1184,8 +1097,6 @@ H5C_cache_is_clean(const H5C_t *cache_ptr, H5C_ring_t inner_ring) * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: John Mainzer, 5/30/14 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -1199,14 +1110,13 @@ H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, const H5C_class_t *expecte FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(H5F_addr_defined(addr)); - HDassert(expected_type); - HDassert(in_cache_ptr); - HDassert(type_ok_ptr); + assert(cache_ptr); + assert(H5_addr_defined(addr)); + assert(expected_type); + assert(in_cache_ptr); + assert(type_ok_ptr); - H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL); if (entry_ptr == NULL) /* the entry doesn't exist in the cache -- report this @@ -1226,3 +1136,457 @@ H5C_verify_entry_type(H5C_t *cache_ptr, haddr_t addr, const H5C_class_t *expecte FUNC_LEAVE_NOAPI(ret_value) } /* H5C_verify_entry_type() */ #endif /* NDEBUG */ + +/*------------------------------------------------------------------------- + * Function: H5C_def_auto_resize_rpt_fcn + * + * Purpose: Print results of a automatic cache resize. + * + * This function should only be used where printf() behaves + * well -- i.e. not on Windows. + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, +#ifndef NDEBUG + int32_t version, +#else + int32_t H5_ATTR_UNUSED version, +#endif + double hit_rate, enum H5C_resize_status status, size_t old_max_cache_size, + size_t new_max_cache_size, size_t old_min_clean_size, size_t new_min_clean_size) +{ + assert(cache_ptr != NULL); + assert(version == H5C__CURR_AUTO_RESIZE_RPT_FCN_VER); + + switch (status) { + case in_spec: + fprintf(stdout, "%sAuto cache resize -- no change. (hit rate = %lf)\n", cache_ptr->prefix, + hit_rate); + break; + + case increase: + assert(hit_rate < cache_ptr->resize_ctl.lower_hr_threshold); + assert(old_max_cache_size < new_max_cache_size); + + fprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n", + cache_ptr->prefix, hit_rate, cache_ptr->resize_ctl.lower_hr_threshold); + fprintf(stdout, "%scache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, + old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size); + break; + + case flash_increase: + assert(old_max_cache_size < new_max_cache_size); + + fprintf(stdout, "%sflash cache resize(%d) -- size threshold = %zu.\n", cache_ptr->prefix, + (int)(cache_ptr->resize_ctl.flash_incr_mode), cache_ptr->flash_size_increase_threshold); + fprintf(stdout, "%s cache size increased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, + old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size); + break; + + case decrease: + assert(old_max_cache_size > new_max_cache_size); + + switch (cache_ptr->resize_ctl.decr_mode) { + case H5C_decr__off: + fprintf(stdout, "%sAuto cache resize -- decrease off. HR = %lf\n", cache_ptr->prefix, + hit_rate); + break; + + case H5C_decr__threshold: + assert(hit_rate > cache_ptr->resize_ctl.upper_hr_threshold); + + fprintf(stdout, "%sAuto cache resize -- decrease by threshold. HR = %lf > %6.5lf\n", + cache_ptr->prefix, hit_rate, cache_ptr->resize_ctl.upper_hr_threshold); + fprintf(stdout, "%sout of bounds high (%6.5lf).\n", cache_ptr->prefix, + cache_ptr->resize_ctl.upper_hr_threshold); + break; + + case H5C_decr__age_out: + fprintf(stdout, "%sAuto cache resize -- decrease by ageout. HR = %lf\n", + cache_ptr->prefix, hit_rate); + break; + + case H5C_decr__age_out_with_threshold: + assert(hit_rate > cache_ptr->resize_ctl.upper_hr_threshold); + + fprintf(stdout, + "%sAuto cache resize -- decrease by ageout with threshold. HR = %lf > %6.5lf\n", + cache_ptr->prefix, hit_rate, cache_ptr->resize_ctl.upper_hr_threshold); + break; + + default: + fprintf(stdout, "%sAuto cache resize -- decrease by unknown mode. HR = %lf\n", + cache_ptr->prefix, hit_rate); + } + + fprintf(stdout, "%s cache size decreased from (%zu/%zu) to (%zu/%zu).\n", cache_ptr->prefix, + old_max_cache_size, old_min_clean_size, new_max_cache_size, new_min_clean_size); + break; + + case at_max_size: + fprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n", + cache_ptr->prefix, hit_rate, cache_ptr->resize_ctl.lower_hr_threshold); + fprintf(stdout, "%s cache already at maximum size so no change.\n", cache_ptr->prefix); + break; + + case at_min_size: + fprintf(stdout, "%sAuto cache resize -- hit rate (%lf) -- can't decrease.\n", cache_ptr->prefix, + hit_rate); + fprintf(stdout, "%s cache already at minimum size.\n", cache_ptr->prefix); + break; + + case increase_disabled: + fprintf(stdout, "%sAuto cache resize -- increase disabled -- HR = %lf.", cache_ptr->prefix, + hit_rate); + break; + + case decrease_disabled: + fprintf(stdout, "%sAuto cache resize -- decrease disabled -- HR = %lf.\n", cache_ptr->prefix, + hit_rate); + break; + + case not_full: + assert(hit_rate < cache_ptr->resize_ctl.lower_hr_threshold); + + fprintf(stdout, "%sAuto cache resize -- hit rate (%lf) out of bounds low (%6.5lf).\n", + cache_ptr->prefix, hit_rate, cache_ptr->resize_ctl.lower_hr_threshold); + fprintf(stdout, "%s cache not full so no increase in size.\n", cache_ptr->prefix); + break; + + default: + fprintf(stdout, "%sAuto cache resize -- unknown status code.\n", cache_ptr->prefix); + break; + } +} /* H5C_def_auto_resize_rpt_fcn() */ + +/*------------------------------------------------------------------------- + * Function: H5C__validate_lru_list + * + * Purpose: Debugging function that scans the LRU list for errors. + * + * If an error is detected, the function generates a + * diagnostic and returns FAIL. If no error is detected, + * the function returns SUCCEED. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + *------------------------------------------------------------------------- + */ +#ifdef H5C_DO_EXTREME_SANITY_CHECKS +herr_t +H5C__validate_lru_list(H5C_t *cache_ptr) +{ + int32_t len = 0; + size_t size = 0; + H5C_cache_entry_t *entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(cache_ptr); + + if (((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_tail_ptr == NULL)) && + (cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list head/tail check failed"); + + if ((cache_ptr->LRU_list_len == 1) && + ((cache_ptr->LRU_head_ptr != cache_ptr->LRU_tail_ptr) || (cache_ptr->LRU_head_ptr == NULL) || + (cache_ptr->LRU_head_ptr->size != cache_ptr->LRU_list_size))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list sanity check failed"); + + if ((cache_ptr->LRU_list_len >= 1) && + ((cache_ptr->LRU_head_ptr == NULL) || (cache_ptr->LRU_head_ptr->prev != NULL) || + (cache_ptr->LRU_tail_ptr == NULL) || (cache_ptr->LRU_tail_ptr->next != NULL))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list sanity check failed"); + + entry_ptr = cache_ptr->LRU_head_ptr; + while (entry_ptr != NULL) { + if ((entry_ptr != cache_ptr->LRU_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers"); + + if ((entry_ptr != cache_ptr->LRU_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers"); + + if (entry_ptr->is_pinned || entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "invalid entry 'pin origin' fields"); + + len++; + size += entry_ptr->size; + entry_ptr = entry_ptr->next; + } + + if ((cache_ptr->LRU_list_len != (uint32_t)len) || (cache_ptr->LRU_list_size != size)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU list length/size check failed"); + +done: + if (ret_value != SUCCEED) + assert(0); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__validate_lru_list() */ +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + +/*------------------------------------------------------------------------- + * Function: H5C__validate_pinned_entry_list + * + * Purpose: Debugging function that scans the pinned entry list for + * errors. + * + * If an error is detected, the function generates a + * diagnostic and returns FAIL. If no error is detected, + * the function returns SUCCEED. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + *------------------------------------------------------------------------- + */ +#ifdef H5C_DO_EXTREME_SANITY_CHECKS +herr_t +H5C__validate_pinned_entry_list(H5C_t *cache_ptr) +{ + int32_t len = 0; + size_t size = 0; + H5C_cache_entry_t *entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(cache_ptr); + + if (((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_tail_ptr == NULL)) && + (cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list head/tail check failed"); + + if ((cache_ptr->pel_len == 1) && + ((cache_ptr->pel_head_ptr != cache_ptr->pel_tail_ptr) || (cache_ptr->pel_head_ptr == NULL) || + (cache_ptr->pel_head_ptr->size != cache_ptr->pel_size))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list sanity check failed"); + + if ((cache_ptr->pel_len >= 1) && + ((cache_ptr->pel_head_ptr == NULL) || (cache_ptr->pel_head_ptr->prev != NULL) || + (cache_ptr->pel_tail_ptr == NULL) || (cache_ptr->pel_tail_ptr->next != NULL))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list sanity check failed"); + + entry_ptr = cache_ptr->pel_head_ptr; + while (entry_ptr != NULL) { + if ((entry_ptr != cache_ptr->pel_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers"); + + if ((entry_ptr != cache_ptr->pel_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers"); + + if (!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list contains unpinned entry"); + + if (!(entry_ptr->pinned_from_client || entry_ptr->pinned_from_cache)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "invalid entry 'pin origin' fields"); + + len++; + size += entry_ptr->size; + entry_ptr = entry_ptr->next; + } + + if ((cache_ptr->pel_len != (uint32_t)len) || (cache_ptr->pel_size != size)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "pinned list length/size check failed"); + +done: + if (ret_value != SUCCEED) + assert(0); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__validate_pinned_entry_list() */ +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + +/*------------------------------------------------------------------------- + * Function: H5C__validate_protected_entry_list + * + * Purpose: Debugging function that scans the protected entry list for + * errors. + * + * If an error is detected, the function generates a + * diagnostic and returns FAIL. If no error is detected, + * the function returns SUCCEED. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + *------------------------------------------------------------------------- + */ +#ifdef H5C_DO_EXTREME_SANITY_CHECKS +herr_t +H5C__validate_protected_entry_list(H5C_t *cache_ptr) +{ + int32_t len = 0; + size_t size = 0; + H5C_cache_entry_t *entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(cache_ptr); + + if (((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_tail_ptr == NULL)) && + (cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list head/tail check failed"); + + if ((cache_ptr->pl_len == 1) && + ((cache_ptr->pl_head_ptr != cache_ptr->pl_tail_ptr) || (cache_ptr->pl_head_ptr == NULL) || + (cache_ptr->pl_head_ptr->size != cache_ptr->pl_size))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list sanity check failed"); + + if ((cache_ptr->pl_len >= 1) && + ((cache_ptr->pl_head_ptr == NULL) || (cache_ptr->pl_head_ptr->prev != NULL) || + (cache_ptr->pl_tail_ptr == NULL) || (cache_ptr->pl_tail_ptr->next != NULL))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list sanity check failed"); + + entry_ptr = cache_ptr->pl_head_ptr; + while (entry_ptr != NULL) { + if ((entry_ptr != cache_ptr->pl_head_ptr) && + ((entry_ptr->prev == NULL) || (entry_ptr->prev->next != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers"); + + if ((entry_ptr != cache_ptr->pl_tail_ptr) && + ((entry_ptr->next == NULL) || (entry_ptr->next->prev != entry_ptr))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry has bad prev/next pointers"); + + if (!entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list contains unprotected entry"); + + if (entry_ptr->is_read_only && (entry_ptr->ro_ref_count <= 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "read-only entry has non-positive ref count"); + + len++; + size += entry_ptr->size; + entry_ptr = entry_ptr->next; + } + + if ((cache_ptr->pl_len != (uint32_t)len) || (cache_ptr->pl_size != size)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "protected list length/size check failed"); + +done: + if (ret_value != SUCCEED) + assert(0); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__validate_protected_entry_list() */ +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + +/*------------------------------------------------------------------------- + * Function: H5C__entry_in_skip_list + * + * Purpose: Debugging function that scans skip list to see if it + * is in present. We need this, as it is possible for + * an entry to be in the skip list twice. + * + * Return: FALSE if the entry is not in the skip list, and TRUE + * if it is. + * + *------------------------------------------------------------------------- + */ +#ifdef H5C_DO_SLIST_SANITY_CHECKS +hbool_t +H5C__entry_in_skip_list(H5C_t *cache_ptr, H5C_cache_entry_t *target_ptr) +{ + H5SL_node_t *node_ptr; + hbool_t in_slist; + hbool_t ret_value; + + FUNC_ENTER_PACKAGE + + /* Assertions */ + assert(cache_ptr); + assert(cache_ptr->slist_ptr); + + node_ptr = H5SL_first(cache_ptr->slist_ptr); + in_slist = FALSE; + while ((node_ptr != NULL) && (!in_slist)) { + H5C_cache_entry_t *entry_ptr; + + entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + + assert(entry_ptr); + assert(entry_ptr->is_dirty); + assert(entry_ptr->in_slist); + + if (entry_ptr == target_ptr) + in_slist = TRUE; + else + node_ptr = H5SL_next(node_ptr); + } + + /* Set return value */ + ret_value = in_slist; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__entry_in_skip_list() */ +#endif /* H5C_DO_SLIST_SANITY_CHECKS */ + +/*------------------------------------------------------------------------- + * Function: H5C__image_stats + * + * Purpose: Prints statistics specific to the cache image. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +#if H5C_COLLECT_CACHE_STATS +H5C__image_stats(H5C_t *cache_ptr, hbool_t print_header) +#else /* H5C_COLLECT_CACHE_STATS */ +H5C__image_stats(H5C_t *cache_ptr, hbool_t H5_ATTR_UNUSED print_header) +#endif /* H5C_COLLECT_CACHE_STATS */ +{ +#if H5C_COLLECT_CACHE_STATS + int i; + int64_t total_hits = 0; + int64_t total_misses = 0; + double hit_rate; + double prefetch_use_rate; +#endif /* H5C_COLLECT_CACHE_STATS */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + if (NULL == cache_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr"); + +#if H5C_COLLECT_CACHE_STATS + for (i = 0; i <= cache_ptr->max_type_id; i++) { + total_hits += cache_ptr->hits[i]; + total_misses += cache_ptr->misses[i]; + } /* end for */ + + if ((total_hits > 0) || (total_misses > 0)) + hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses)); + else + hit_rate = 0.0; + + if (cache_ptr->prefetches > 0) + prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches)); + else + prefetch_use_rate = 0.0; + + if (print_header) { + fprintf(stdout, "\nhit prefetches prefetch image pf hit\n"); + fprintf(stdout, "rate: total: dirty: hits: flshs: evct: size: rate:\n"); + } /* end if */ + + fprintf(stdout, "%3.1lf %5lld %5lld %5lld %5lld %5lld %5lld %3.1lf\n", hit_rate, + (long long)(cache_ptr->prefetches), (long long)(cache_ptr->dirty_prefetches), + (long long)(cache_ptr->prefetch_hits), (long long)(cache_ptr->flushes[H5AC_PREFETCHED_ENTRY_ID]), + (long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID]), + (long long)(cache_ptr->last_image_size), prefetch_use_rate); +#endif /* H5C_COLLECT_CACHE_STATS */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__image_stats() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Centry.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Centry.c new file mode 100644 index 0000000000..41fbe0cd9e --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Centry.c @@ -0,0 +1,4219 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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: H5Centry.c + * + * Purpose: Routines which operate on cache entries. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ +#define H5F_FRIEND /* suppress error about including H5Fpkg */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Cpkg.h" /* Cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ + +/****************/ +/* Local Macros */ +/****************/ +#if H5C_DO_MEMORY_SANITY_CHECKS +#define H5C_IMAGE_EXTRA_SPACE 8 +#define H5C_IMAGE_SANITY_VALUE "DeadBeef" +#else /* H5C_DO_MEMORY_SANITY_CHECKS */ +#define H5C_IMAGE_EXTRA_SPACE 0 +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Alias for pointer to cache entry, for use when allocating sequences of them */ +typedef H5C_cache_entry_t *H5C_cache_entry_ptr_t; + +/********************/ +/* Local Prototypes */ +/********************/ +static herr_t H5C__pin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr); +static herr_t H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp); +static herr_t H5C__unpin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp); +static herr_t H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr); +static herr_t H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr, size_t *len, + hbool_t actual); +static void *H5C__load_entry(H5F_t *f, +#ifdef H5_HAVE_PARALLEL + hbool_t coll_access, +#endif /* H5_HAVE_PARALLEL */ + const H5C_class_t *type, haddr_t addr, void *udata); +static herr_t H5C__mark_flush_dep_dirty(H5C_cache_entry_t *entry); +static herr_t H5C__mark_flush_dep_clean(H5C_cache_entry_t *entry); +static herr_t H5C__mark_flush_dep_serialized(H5C_cache_entry_t *entry); +static herr_t H5C__mark_flush_dep_unserialized(H5C_cache_entry_t *entry); +#ifndef NDEBUG +static void H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry, + const H5C_cache_entry_t *base_entry); +#endif +static herr_t H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr, H5C_cache_entry_t *pf_entry_ptr, + H5C_cache_entry_t **fd_children); +static herr_t H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t **entry_ptr_ptr, + const H5C_class_t *type, haddr_t addr, void *udata); + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Declare a free list to manage arrays of cache entries */ +H5FL_SEQ_DEFINE_STATIC(H5C_cache_entry_ptr_t); + +/*------------------------------------------------------------------------- + * Function: H5C__pin_entry_from_client() + * + * Purpose: Internal routine to pin a cache entry from a client action. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__pin_entry_from_client(H5C_t +#if !H5C_COLLECT_CACHE_STATS + H5_ATTR_UNUSED +#endif + *cache_ptr, + H5C_cache_entry_t *entry_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(cache_ptr); + assert(entry_ptr); + assert(entry_ptr->is_protected); + + /* Check if the entry is already pinned */ + if (entry_ptr->is_pinned) { + /* Check if the entry was pinned through an explicit pin from a client */ + if (entry_ptr->pinned_from_client) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "entry is already pinned"); + } /* end if */ + else { + entry_ptr->is_pinned = TRUE; + + H5C__UPDATE_STATS_FOR_PIN(cache_ptr, entry_ptr); + } /* end else */ + + /* Mark that the entry was pinned through an explicit pin from a client */ + entry_ptr->pinned_from_client = TRUE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__pin_entry_from_client() */ + +/*------------------------------------------------------------------------- + * Function: H5C__unpin_entry_real() + * + * Purpose: Internal routine to unpin a cache entry. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__unpin_entry_real(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp) +{ + herr_t ret_value = SUCCEED; /* Return value */ + +#ifdef H5C_DO_SANITY_CHECKS + FUNC_ENTER_PACKAGE +#else + FUNC_ENTER_PACKAGE_NOERR +#endif + + /* Sanity checking */ + assert(cache_ptr); + assert(entry_ptr); + assert(entry_ptr->is_pinned); + + /* If requested, update the replacement policy if the entry is not protected */ + if (update_rp && !entry_ptr->is_protected) + H5C__UPDATE_RP_FOR_UNPIN(cache_ptr, entry_ptr, FAIL); + + /* Unpin the entry now */ + entry_ptr->is_pinned = FALSE; + + /* Update the stats for an unpin operation */ + H5C__UPDATE_STATS_FOR_UNPIN(cache_ptr, entry_ptr); + +#ifdef H5C_DO_SANITY_CHECKS +done: +#endif + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__unpin_entry_real() */ + +/*------------------------------------------------------------------------- + * Function: H5C__unpin_entry_from_client() + * + * Purpose: Internal routine to unpin a cache entry from a client action. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__unpin_entry_from_client(H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, hbool_t update_rp) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checking */ + assert(cache_ptr); + assert(entry_ptr); + + /* Error checking (should be sanity checks?) */ + if (!entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry isn't pinned"); + if (!entry_ptr->pinned_from_client) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "entry wasn't pinned by cache client"); + + /* Check if the entry is not pinned from a flush dependency */ + if (!entry_ptr->pinned_from_cache) + if (H5C__unpin_entry_real(cache_ptr, entry_ptr, update_rp) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry"); + + /* Mark the entry as explicitly unpinned by the client */ + entry_ptr->pinned_from_client = FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__unpin_entry_from_client() */ + +/*------------------------------------------------------------------------- + * Function: H5C__generate_image + * + * Purpose: Serialize an entry and generate its image. + * + * Note: This may cause the entry to be re-sized and/or moved in + * the cache. + * + * As we will not update the metadata cache's data structures + * until we we finish the write, we must touch up these + * data structures for size and location changes even if we + * are about to delete the entry from the cache (i.e. on a + * flush destroy). + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) +{ + haddr_t new_addr = HADDR_UNDEF; + haddr_t old_addr = HADDR_UNDEF; + size_t new_len = 0; + unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + assert(f); + assert(cache_ptr); + assert(entry_ptr); + assert(!entry_ptr->image_up_to_date); + assert(entry_ptr->is_dirty); + assert(!entry_ptr->is_protected); + assert(entry_ptr->type); + + /* make note of the entry's current address */ + old_addr = entry_ptr->addr; + + /* Call client's pre-serialize callback, if there's one */ + if ((entry_ptr->type->pre_serialize) && + ((entry_ptr->type->pre_serialize)(f, (void *)entry_ptr, entry_ptr->addr, entry_ptr->size, &new_addr, + &new_len, &serialize_flags) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry"); + + /* Check for any flags set in the pre-serialize callback */ + if (serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { + /* Check for unexpected flags from serialize callback */ + if (serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | H5C__SERIALIZE_MOVED_FLAG)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)"); + +#ifdef H5_HAVE_PARALLEL + /* In the parallel case, resizes and moves in + * the serialize operation can cause problems. + * If they occur, scream and die. + * + * At present, in the parallel case, the aux_ptr + * will only be set if there is more than one + * process. Thus we can use this to detect + * the parallel case. + * + * This works for now, but if we start using the + * aux_ptr for other purposes, we will have to + * change this test accordingly. + * + * NB: While this test detects entryies that attempt + * to resize or move themselves during a flush + * in the parallel case, it will not detect an + * entry that dirties, resizes, and/or moves + * other entries during its flush. + */ + if (cache_ptr->aux_ptr != NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occurred in parallel case"); +#endif + + /* If required, resize the buffer and update the entry and the cache + * data structures + */ + if (serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { + /* Sanity check */ + assert(new_len > 0); + + /* Allocate a new image buffer */ + if (NULL == + (entry_ptr->image_ptr = H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, + "memory allocation failed for on disk image buffer"); + +#if H5C_DO_MEMORY_SANITY_CHECKS + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + + /* Update statistics for resizing the entry */ + H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); + + /* Update the hash table for the size change */ + H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len, entry_ptr, + !entry_ptr->is_dirty, FAIL); + + /* The entry can't be protected since we are in the process of + * flushing it. Thus we must update the replacement policy data + * structures for the size change. The macro deals with the pinned + * case. + */ + H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len, FAIL); + + /* As we haven't updated the cache data structures for + * for the flush or flush destroy yet, the entry should + * be in the slist if the slist is enabled. Since + * H5C__UPDATE_SLIST_FOR_SIZE_CHANGE() is a no-op if the + * slist is enabled, call it un-conditionally. + */ + assert(entry_ptr->is_dirty); + assert((entry_ptr->in_slist) || (!cache_ptr->slist_enabled)); + + H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len); + + /* Finally, update the entry for its new size */ + entry_ptr->size = new_len; + } /* end if */ + + /* If required, udate the entry and the cache data structures + * for a move + */ + if (serialize_flags & H5C__SERIALIZE_MOVED_FLAG) { + /* Update stats and entries relocated counter */ + H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr); + + /* We must update cache data structures for the change in address */ + if (entry_ptr->addr == old_addr) { + /* Delete the entry from the hash table and the slist */ + H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL); + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE, FAIL); + + /* Update the entry for its new address */ + entry_ptr->addr = new_addr; + + /* And then reinsert in the index and slist */ + H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL); + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + } /* end if */ + else /* move is already done for us -- just do sanity checks */ + assert(entry_ptr->addr == new_addr); + } /* end if */ + } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */ + + /* Serialize object into buffer */ + if (entry_ptr->type->serialize(f, entry_ptr->image_ptr, entry_ptr->size, (void *)entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry"); + +#if H5C_DO_MEMORY_SANITY_CHECKS + assert(0 == memcmp(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE)); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + + entry_ptr->image_up_to_date = TRUE; + + /* Propagate the fact that the entry is serialized up the + * flush dependency chain if appropriate. Since the image must + * have been out of date for this function to have been called + * (see assertion on entry), no need to check that -- only check + * for flush dependency parents. + */ + assert(entry_ptr->flush_dep_nunser_children == 0); + + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_serialized(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "Can't propagate serialization status to fd parents"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__generate_image */ + +/*------------------------------------------------------------------------- + * Function: H5C__flush_single_entry + * + * Purpose: Flush or clear (and evict if requested) the cache entry + * with the specified address and type. If the type is NULL, + * any unprotected entry at the specified address will be + * flushed (and possibly evicted). + * + * Attempts to flush a protected entry will result in an + * error. + * + * If the H5C__FLUSH_INVALIDATE_FLAG flag is set, the entry will + * be cleared and not flushed, and the call can't be part of a + * sequence of flushes. + * + * The function does nothing silently if there is no entry + * at the supplied address, or if the entry found has the + * wrong type. + * + * Return: Non-negative on success/Negative on failure or if there was + * an attempt to flush a protected item. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) +{ + H5C_t *cache_ptr; /* Cache for file */ + hbool_t destroy; /* external flag */ + hbool_t clear_only; /* external flag */ + hbool_t free_file_space; /* external flag */ + hbool_t take_ownership; /* external flag */ + hbool_t del_from_slist_on_destroy; /* external flag */ + hbool_t during_flush; /* external flag */ + hbool_t write_entry; /* internal flag */ + hbool_t destroy_entry; /* internal flag */ + hbool_t generate_image; /* internal flag */ + hbool_t update_page_buffer; /* internal flag */ + hbool_t was_dirty; + hbool_t suppress_image_entry_writes = FALSE; + hbool_t suppress_image_entry_frees = FALSE; + haddr_t entry_addr = HADDR_UNDEF; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(f); + cache_ptr = f->shared->cache; + assert(cache_ptr); + assert(entry_ptr); + assert(entry_ptr->ring != H5C_RING_UNDEFINED); + assert(entry_ptr->type); + + /* setup external flags from the flags parameter */ + destroy = ((flags & H5C__FLUSH_INVALIDATE_FLAG) != 0); + clear_only = ((flags & H5C__FLUSH_CLEAR_ONLY_FLAG) != 0); + free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); + take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); + del_from_slist_on_destroy = ((flags & H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) != 0); + during_flush = ((flags & H5C__DURING_FLUSH_FLAG) != 0); + generate_image = ((flags & H5C__GENERATE_IMAGE_FLAG) != 0); + update_page_buffer = ((flags & H5C__UPDATE_PAGE_BUFFER_FLAG) != 0); + + /* Set the flag for destroying the entry, based on the 'take ownership' + * and 'destroy' flags + */ + if (take_ownership) + destroy_entry = FALSE; + else + destroy_entry = destroy; + + /* we will write the entry to disk if it exists, is dirty, and if the + * clear only flag is not set. + */ + if (entry_ptr->is_dirty && !clear_only) + write_entry = TRUE; + else + write_entry = FALSE; + + /* if we have received close warning, and we have been instructed to + * generate a metadata cache image, and we have actually constructed + * the entry images, set suppress_image_entry_frees to TRUE. + * + * Set suppress_image_entry_writes to TRUE if indicated by the + * image_ctl flags. + */ + if (cache_ptr->close_warning_received && cache_ptr->image_ctl.generate_image && + cache_ptr->num_entries_in_image > 0 && cache_ptr->image_entries != NULL) { + + /* Sanity checks */ + assert(entry_ptr->image_up_to_date || !(entry_ptr->include_in_image)); + assert(entry_ptr->image_ptr || !(entry_ptr->include_in_image)); + assert((!clear_only) || !(entry_ptr->include_in_image)); + assert((!take_ownership) || !(entry_ptr->include_in_image)); + assert((!free_file_space) || !(entry_ptr->include_in_image)); + + suppress_image_entry_frees = TRUE; + + if (cache_ptr->image_ctl.flags & H5C_CI__SUPRESS_ENTRY_WRITES) + suppress_image_entry_writes = TRUE; + } /* end if */ + + /* run initial sanity checks */ +#ifdef H5C_DO_SANITY_CHECKS + if (cache_ptr->slist_enabled) { + if (entry_ptr->in_slist) { + assert(entry_ptr->is_dirty); + if (entry_ptr->flush_marker && !entry_ptr->is_dirty) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry in slist failed sanity checks"); + } /* end if */ + else { + assert(!entry_ptr->is_dirty); + assert(!entry_ptr->flush_marker); + if (entry_ptr->is_dirty || entry_ptr->flush_marker) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry failed sanity checks"); + } /* end else */ + } + else { /* slist is disabled */ + assert(!entry_ptr->in_slist); + if (!entry_ptr->is_dirty) + if (entry_ptr->flush_marker) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "flush marked clean entry?"); + } +#endif /* H5C_DO_SANITY_CHECKS */ + + if (entry_ptr->is_protected) + /* Attempt to flush a protected entry -- scream and die. */ + HGOTO_ERROR(H5E_CACHE, H5E_PROTECT, FAIL, "Attempt to flush a protected entry"); + + /* Set entry_ptr->flush_in_progress = TRUE and set + * entry_ptr->flush_marker = FALSE + * + * We will set flush_in_progress back to FALSE at the end if the + * entry still exists at that point. + */ + entry_ptr->flush_in_progress = TRUE; + entry_ptr->flush_marker = FALSE; + + /* Preserve current dirty state for later */ + was_dirty = entry_ptr->is_dirty; + + /* The entry is dirty, and we are doing a flush, a flush destroy or have + * been requested to generate an image. In those cases, serialize the + * entry. + */ + if (write_entry || generate_image) { + assert(entry_ptr->is_dirty); + if (NULL == entry_ptr->image_ptr) { + if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, + "memory allocation failed for on disk image buffer"); + +#if H5C_DO_MEMORY_SANITY_CHECKS + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + + } /* end if */ + + if (!entry_ptr->image_up_to_date) { + /* Sanity check */ + assert(!entry_ptr->prefetched); + + /* Generate the entry's image */ + if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image"); + } /* end if ( ! (entry_ptr->image_up_to_date) ) */ + } /* end if */ + + /* Finally, write the image to disk. + * + * Note that if the H5AC__CLASS_SKIP_WRITES flag is set in the + * in the entry's type, we silently skip the write. This + * flag should only be used in test code. + */ + if (write_entry) { + assert(entry_ptr->is_dirty); + +#ifdef H5C_DO_SANITY_CHECKS + if (cache_ptr->check_write_permitted && !cache_ptr->write_permitted) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Write when writes are always forbidden!?!?!"); +#endif /* H5C_DO_SANITY_CHECKS */ + + /* Write the image to disk unless the write is suppressed. + * + * This happens if both suppress_image_entry_writes and + * entry_ptr->include_in_image are TRUE, or if the + * H5AC__CLASS_SKIP_WRITES is set in the entry's type. This + * flag should only be used in test code + */ + if ((!suppress_image_entry_writes || !entry_ptr->include_in_image) && + ((entry_ptr->type->flags & H5C__CLASS_SKIP_WRITES) == 0)) { + H5FD_mem_t mem_type = H5FD_MEM_DEFAULT; + +#ifdef H5_HAVE_PARALLEL + if (cache_ptr->coll_write_list) { + if (H5SL_insert(cache_ptr->coll_write_list, entry_ptr, &entry_ptr->addr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert skip list item"); + } /* end if */ + else { +#endif /* H5_HAVE_PARALLEL */ + if (entry_ptr->prefetched) { + assert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); + mem_type = cache_ptr->class_table_ptr[entry_ptr->prefetch_type_id]->mem_type; + } /* end if */ + else + mem_type = entry_ptr->type->mem_type; + + if (H5F_block_write(f, mem_type, entry_ptr->addr, entry_ptr->size, entry_ptr->image_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write image to file"); +#ifdef H5_HAVE_PARALLEL + } +#endif /* H5_HAVE_PARALLEL */ + } /* end if */ + + /* if the entry has a notify callback, notify it that we have + * just flushed the entry. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_FLUSH, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client of entry flush"); + } /* if ( write_entry ) */ + + /* At this point, all pre-serialize and serialize calls have been + * made if it was appropriate to make them. Similarly, the entry + * has been written to disk if desired. + * + * Thus it is now safe to update the cache data structures for the + * flush. + */ + + /* start by updating the statistics */ + if (clear_only) { + /* only log a clear if the entry was dirty */ + if (was_dirty) + H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr); + } + else if (write_entry) { + assert(was_dirty); + + /* only log a flush if we actually wrote to disk */ + H5C__UPDATE_STATS_FOR_FLUSH(cache_ptr, entry_ptr); + } /* end else if */ + + /* Note that the algorithm below is (very) similar to the set of operations + * in H5C_remove_entry() and should be kept in sync with changes + * to that code. - QAK, 2016/11/30 + */ + + /* Update the cache internal data structures. */ + if (destroy) { + /* Sanity checks */ + if (take_ownership) + assert(!destroy_entry); + else + assert(destroy_entry); + + assert(!entry_ptr->is_pinned); + + /* Update stats, while entry is still in the cache */ + H5C__UPDATE_STATS_FOR_EVICTION(cache_ptr, entry_ptr, take_ownership); + + /* If the entry's type has a 'notify' callback and the entry is about + * to be removed from the cache, send a 'before eviction' notice while + * the entry is still fully integrated in the cache. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict"); + + /* Update the cache internal data structures as appropriate + * for a destroy. Specifically: + * + * 1) Delete it from the index + * + * 2) Delete it from the skip list if requested. + * + * 3) Delete it from the collective read access list. + * + * 4) Update the replacement policy for eviction + * + * 5) Remove it from the tag list for this object + * + * Finally, if the destroy_entry flag is set, discard the + * entry. + */ + H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL); + + if (entry_ptr->in_slist && del_from_slist_on_destroy) + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush, FAIL); + +#ifdef H5_HAVE_PARALLEL + /* Check for collective read access flag */ + if (entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL); + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + + H5C__UPDATE_RP_FOR_EVICTION(cache_ptr, entry_ptr, FAIL); + + /* Remove entry from tag list */ + if (H5C__untag_entry(cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list"); + + /* verify that the entry is no longer part of any flush dependencies */ + assert(entry_ptr->flush_dep_nparents == 0); + assert(entry_ptr->flush_dep_nchildren == 0); + } /* end if */ + else { + assert(clear_only || write_entry); + assert(entry_ptr->is_dirty); + assert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist)); + + /* We are either doing a flush or a clear. + * + * A clear and a flush are the same from the point of + * view of the replacement policy and the slist. + * Hence no differentiation between them. + */ + H5C__UPDATE_RP_FOR_FLUSH(cache_ptr, entry_ptr, FAIL); + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, during_flush, FAIL); + + /* mark the entry as clean and update the index for + * entry clean. Also, call the clear callback + * if defined. + */ + entry_ptr->is_dirty = FALSE; + + H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr, FAIL); + + /* Check for entry changing status and do notifications, etc. */ + if (was_dirty) { + /* If the entry's type has a 'notify' callback send a + * 'entry cleaned' notice now that the entry is fully + * integrated into the cache. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify client about entry dirty flag cleared"); + + /* Propagate the clean flag up the flush dependency chain + * if appropriate + */ + if (entry_ptr->flush_dep_ndirty_children != 0) + assert(entry_ptr->flush_dep_ndirty_children == 0); + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_clean(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "Can't propagate flush dep clean flag"); + } /* end if */ + } /* end else */ + + /* reset the flush_in progress flag */ + entry_ptr->flush_in_progress = FALSE; + + /* capture the cache entry address for the log_flush call at the + * end before the entry_ptr gets freed + */ + entry_addr = entry_ptr->addr; + + /* Internal cache data structures should now be up to date, and + * consistent with the status of the entry. + * + * Now discard the entry if appropriate. + */ + if (destroy) { + /* Sanity check */ + assert(0 == entry_ptr->flush_dep_nparents); + + /* if both suppress_image_entry_frees and entry_ptr->include_in_image + * are true, simply set entry_ptr->image_ptr to NULL, as we have + * another pointer to the buffer in an instance of H5C_image_entry_t + * in cache_ptr->image_entries. + * + * Otherwise, free the buffer if it exists. + */ + if (suppress_image_entry_frees && entry_ptr->include_in_image) + entry_ptr->image_ptr = NULL; + else if (entry_ptr->image_ptr != NULL) + entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); + + /* If the entry is not a prefetched entry, verify that the flush + * dependency parents addresses array has been transferred. + * + * If the entry is prefetched, the free_isr routine will dispose of + * the flush dependency parents addresses array if necessary. + */ + if (!entry_ptr->prefetched) { + assert(0 == entry_ptr->fd_parent_count); + assert(NULL == entry_ptr->fd_parent_addrs); + } /* end if */ + + /* Check whether we should free the space in the file that + * the entry occupies + */ + if (free_file_space) { + hsize_t fsf_size; + + /* Sanity checks */ + assert(H5_addr_defined(entry_ptr->addr)); + assert(!H5F_IS_TMP_ADDR(f, entry_ptr->addr)); +#ifndef NDEBUG + { + size_t curr_len; + + /* Get the actual image size for the thing again */ + entry_ptr->type->image_len((void *)entry_ptr, &curr_len); + assert(curr_len == entry_ptr->size); + } +#endif + + /* If the file space free size callback is defined, use + * it to get the size of the block of file space to free. + * Otherwise use entry_ptr->size. + */ + if (entry_ptr->type->fsf_size) { + if ((entry_ptr->type->fsf_size)((void *)entry_ptr, &fsf_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to get file space free size"); + } /* end if */ + else /* no file space free size callback -- use entry size */ + fsf_size = entry_ptr->size; + + /* Release the space on disk */ + if (H5MF_xfree(f, entry_ptr->type->mem_type, entry_ptr->addr, fsf_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "unable to free file space for cache entry"); + } /* end if ( free_file_space ) */ + + /* Reset the pointer to the cache the entry is within. -QAK */ + entry_ptr->cache_ptr = NULL; + + /* increment entries_removed_counter and set + * last_entry_removed_ptr. As we are likely abuut to + * free the entry, recall that last_entry_removed_ptr + * must NEVER be dereferenced. + * + * Recall that these fields are maintained to allow functions + * that perform scans of lists of entries to detect the + * unexpected removal of entries (via expunge, eviction, + * or take ownership at present), so that they can re-start + * their scans if necessary. + * + * Also check if the entry we are watching for removal is being + * removed (usually the 'next' entry for an iteration) and reset + * it to indicate that it was removed. + */ + cache_ptr->entries_removed_counter++; + cache_ptr->last_entry_removed_ptr = entry_ptr; + + if (entry_ptr == cache_ptr->entry_watched_for_removal) + cache_ptr->entry_watched_for_removal = NULL; + + /* Check for actually destroying the entry in memory */ + /* (As opposed to taking ownership of it) */ + if (destroy_entry) { + if (entry_ptr->is_dirty) { + /* Reset dirty flag */ + entry_ptr->is_dirty = FALSE; + + /* If the entry's type has a 'notify' callback send a + * 'entry cleaned' notice now that the entry is fully + * integrated into the cache. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify client about entry dirty flag cleared"); + } /* end if */ + + /* verify that the image has been freed */ + assert(entry_ptr->image_ptr == NULL); + + if (entry_ptr->type->free_icr((void *)entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed"); + } /* end if */ + else { + assert(take_ownership); + } /* end else */ + } /* if (destroy) */ + + /* Check if we have to update the page buffer with cleared entries + * so it doesn't go out of date + */ + if (update_page_buffer) { + /* Sanity check */ + assert(!destroy); + assert(entry_ptr->image_ptr); + + if (f->shared->page_buf && (f->shared->page_buf->page_size >= entry_ptr->size)) + if (H5PB_update_entry(f->shared->page_buf, entry_ptr->addr, entry_ptr->size, + entry_ptr->image_ptr) > 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Failed to update PB with metadata cache"); + } /* end if */ + + if (cache_ptr->log_flush) + if ((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed"); + +done: + assert((ret_value != SUCCEED) || (destroy_entry) || (!entry_ptr->flush_in_progress)); + assert((ret_value != SUCCEED) || (destroy_entry) || (take_ownership) || (!entry_ptr->is_dirty)); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flush_single_entry() */ + +/*------------------------------------------------------------------------- + * Function: H5C__verify_len_eoa + * + * Purpose: Verify that 'len' does not exceed eoa when 'actual' is + * false i.e. 'len" is the initial speculative length from + * get_load_size callback with null image pointer. + * If exceed, adjust 'len' accordingly. + * + * Verify that 'len' should not exceed eoa when 'actual' is + * true i.e. 'len' is the actual length from get_load_size + * callback with non-null image pointer. + * If exceed, return error. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__verify_len_eoa(H5F_t *f, const H5C_class_t *type, haddr_t addr, size_t *len, hbool_t actual) +{ + H5FD_mem_t cooked_type; /* Modified type, accounting for switching global heaps */ + haddr_t eoa; /* End-of-allocation in the file */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces + * type to H5FD_MEM_DRAW via its call to H5F__accum_read(). + * Thus we do the same for purposes of computing the EOA + * for sanity checks. + */ + cooked_type = (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type; + + /* Get the file's end-of-allocation value */ + eoa = H5F_get_eoa(f, cooked_type); + if (!H5_addr_defined(eoa)) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid EOA address for file"); + + /* Check for bad address in general */ + if (H5_addr_gt(addr, eoa)) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "address of object past end of allocation"); + + /* Check if the amount of data to read will be past the EOA */ + if (H5_addr_gt((addr + *len), eoa)) { + if (actual) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "actual len exceeds EOA"); + else + /* Trim down the length of the metadata */ + *len = (size_t)(eoa - addr); + } /* end if */ + + if (*len <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "len not positive after adjustment for EOA"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__verify_len_eoa() */ + +/*------------------------------------------------------------------------- + * Function: H5C__load_entry + * + * Purpose: Attempt to load the entry at the specified disk address + * and with the specified type into memory. If successful. + * return the in memory address of the entry. Return NULL + * on failure. + * + * Note that this function simply loads the entry into + * core. It does not insert it into the cache. + * + * Return: Non-NULL on success / NULL on failure. + * + *------------------------------------------------------------------------- + */ +void * +H5C__load_entry(H5F_t *f, +#ifdef H5_HAVE_PARALLEL + hbool_t coll_access, +#endif /* H5_HAVE_PARALLEL */ + const H5C_class_t *type, haddr_t addr, void *udata) +{ + hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */ + uint8_t *image = NULL; /* Buffer for disk image */ + void *thing = NULL; /* Pointer to thing loaded */ + H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */ + size_t len; /* Size of image in file */ +#ifdef H5_HAVE_PARALLEL + int mpi_rank = 0; /* MPI process rank */ + MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */ + int mpi_code; /* MPI error code */ +#endif /* H5_HAVE_PARALLEL */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(f); + assert(f->shared); + assert(f->shared->cache); + assert(type); + assert(H5_addr_defined(addr)); + assert(type->get_initial_load_size); + if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) + assert(type->get_final_load_size); + else + assert(NULL == type->get_final_load_size); + assert(type->deserialize); + + /* Can't see how skip reads could be usefully combined with + * the speculative read flag. Hence disallow. + */ + assert(!((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG))); + + /* Call the get_initial_load_size callback, to retrieve the initial size of image */ + if (type->get_initial_load_size(udata, &len) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image size"); + assert(len > 0); + + /* Check for possible speculative read off the end of the file */ + if (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) + if (H5C__verify_len_eoa(f, type, addr, &len, FALSE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid len with respect to EOA"); + + /* Allocate the buffer for reading the on-disk entry image */ + if (NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer"); +#if H5C_DO_MEMORY_SANITY_CHECKS + H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + +#ifdef H5_HAVE_PARALLEL + if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + if ((mpi_rank = H5F_mpi_get_rank(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank"); + if ((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed"); + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + + /* Get the on-disk entry image */ + if (0 == (type->flags & H5C__CLASS_SKIP_READS)) { + unsigned tries, max_tries; /* The # of read attempts */ + unsigned retries; /* The # of retries */ + htri_t chk_ret; /* return from verify_chksum callback */ + size_t actual_len = len; /* The actual length, after speculative reads have been resolved */ + uint64_t nanosec = 1; /* # of nanoseconds to sleep between retries */ + void *new_image; /* Pointer to image */ + hbool_t len_changed = TRUE; /* Whether to re-check speculative entries */ + + /* Get the # of read attempts */ + max_tries = tries = H5F_GET_READ_ATTEMPTS(f); + + /* + * This do/while loop performs the following till the metadata checksum + * is correct or the file's number of allowed read attempts are reached. + * --read the metadata + * --determine the actual size of the metadata + * --perform checksum verification + */ + do { + if (actual_len != len) { + if (NULL == (new_image = H5MM_realloc(image, len + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()"); + image = (uint8_t *)new_image; +#if H5C_DO_MEMORY_SANITY_CHECKS + H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + } /* end if */ + +#ifdef H5_HAVE_PARALLEL + if (!coll_access || 0 == mpi_rank) { +#endif /* H5_HAVE_PARALLEL */ + if (H5F_block_read(f, type->mem_type, addr, len, image) < 0) { +#ifdef H5_HAVE_PARALLEL + if (coll_access) { + /* Push an error, but still participate in following MPI_Bcast */ + memset(image, 0, len); + HDONE_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*"); + } + else +#endif + HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*"); + } + +#ifdef H5_HAVE_PARALLEL + } /* end if */ + /* if the collective metadata read optimization is turned on, + * bcast the metadata read from process 0 to all ranks in the file + * communicator + */ + if (coll_access) { + int buf_size; + + H5_CHECKED_ASSIGN(buf_size, int, len, size_t); + if (MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + + /* If the entry could be read speculatively and the length is still + * changing, check for updating the actual size + */ + if ((type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) && len_changed) { + /* Retrieve the actual length */ + actual_len = len; + if (type->get_final_load_size(image, len, udata, &actual_len) < 0) + continue; /* Transfer control to while() and count towards retries */ + + /* Check for the length changing */ + if (actual_len != len) { + /* Verify that the length isn't past the EOA for the file */ + if (H5C__verify_len_eoa(f, type, addr, &actual_len, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "actual_len exceeds EOA"); + + /* Expand buffer to new size */ + if (NULL == (new_image = H5MM_realloc(image, actual_len + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()"); + image = (uint8_t *)new_image; +#if H5C_DO_MEMORY_SANITY_CHECKS + H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + + if (actual_len > len) { +#ifdef H5_HAVE_PARALLEL + if (!coll_access || 0 == mpi_rank) { +#endif /* H5_HAVE_PARALLEL */ + /* If the thing's image needs to be bigger for a speculatively + * loaded thing, go get the on-disk image again (the extra portion). + */ + if (H5F_block_read(f, type->mem_type, addr + len, actual_len - len, image + len) < + 0) { +#ifdef H5_HAVE_PARALLEL + if (coll_access) { + /* Push an error, but still participate in following MPI_Bcast */ + memset(image + len, 0, actual_len - len); + HDONE_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't read image"); + } + else +#endif + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't read image"); + } + +#ifdef H5_HAVE_PARALLEL + } + /* If the collective metadata read optimization is turned on, + * Bcast the metadata read from process 0 to all ranks in the file + * communicator */ + if (coll_access) { + int buf_size; + + H5_CHECKED_ASSIGN(buf_size, int, actual_len - len, size_t); + if (MPI_SUCCESS != + (mpi_code = MPI_Bcast(image + len, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + } /* end if */ + } /* end if (actual_len != len) */ + else { + /* The length has stabilized */ + len_changed = FALSE; + + /* Set the final length */ + len = actual_len; + } /* else */ + } /* end if */ + + /* If there's no way to verify the checksum for a piece of metadata + * (usually because there's no checksum in the file), leave now + */ + if (type->verify_chksum == NULL) + break; + + /* Verify the checksum for the metadata image */ + if ((chk_ret = type->verify_chksum(image, actual_len, udata)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "failure from verify_chksum callback"); + if (chk_ret == TRUE) + break; + + /* Sleep for some time */ + H5_nanosleep(nanosec); + nanosec *= 2; /* Double the sleep time next time */ + } while (--tries); + + /* Check for too many tries */ + if (tries == 0) + HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, + "incorrect metadata checksum after all read attempts"); + + /* Calculate and track the # of retries */ + retries = max_tries - tries; + if (retries) /* Does not track 0 retry */ + if (H5F_track_metadata_read_retries(f, (unsigned)type->mem_type, retries) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "cannot track read tries = %u ", retries); + + /* Set the final length (in case it wasn't set earlier) */ + len = actual_len; + } /* end if !H5C__CLASS_SKIP_READS */ + + /* Deserialize the on-disk image into the native memory form */ + if (NULL == (thing = type->deserialize(image, len, udata, &dirty))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image"); + + entry = (H5C_cache_entry_t *)thing; + + /* In general, an entry should be clean just after it is loaded. + * + * However, when this code is used in the metadata cache, it is + * possible that object headers will be dirty at this point, as + * the deserialize function will alter object headers if necessary to + * fix an old bug. + * + * In the following assert: + * + * assert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) ); + * + * note that type ids 5 & 6 are associated with object headers in the + * metadata cache. + * + * When we get to using H5C for other purposes, we may wish to + * tighten up the assert so that the loophole only applies to the + * metadata cache. + */ + + assert((dirty == FALSE) || (type->id == 5 || type->id == 6)); + + entry->cache_ptr = f->shared->cache; + entry->addr = addr; + entry->size = len; + assert(entry->size < H5C_MAX_ENTRY_SIZE); + entry->image_ptr = image; + entry->image_up_to_date = !dirty; + entry->type = type; + entry->is_dirty = dirty; + entry->dirtied = FALSE; + entry->is_protected = FALSE; + entry->is_read_only = FALSE; + entry->ro_ref_count = 0; + entry->is_pinned = FALSE; + entry->in_slist = FALSE; + entry->flush_marker = FALSE; +#ifdef H5_HAVE_PARALLEL + entry->clear_on_unprotect = FALSE; + entry->flush_immediately = FALSE; + entry->coll_access = coll_access; +#endif /* H5_HAVE_PARALLEL */ + entry->flush_in_progress = FALSE; + entry->destroy_in_progress = FALSE; + + entry->ring = H5C_RING_UNDEFINED; + + /* Initialize flush dependency fields */ + entry->flush_dep_parent = NULL; + entry->flush_dep_nparents = 0; + entry->flush_dep_parent_nalloc = 0; + entry->flush_dep_nchildren = 0; + entry->flush_dep_ndirty_children = 0; + entry->flush_dep_nunser_children = 0; + entry->ht_next = NULL; + entry->ht_prev = NULL; + entry->il_next = NULL; + entry->il_prev = NULL; + + entry->next = NULL; + entry->prev = NULL; + +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS + entry->aux_next = NULL; + entry->aux_prev = NULL; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + +#ifdef H5_HAVE_PARALLEL + entry->coll_next = NULL; + entry->coll_prev = NULL; +#endif /* H5_HAVE_PARALLEL */ + + /* initialize cache image related fields */ + entry->include_in_image = FALSE; + entry->lru_rank = 0; + entry->image_dirty = FALSE; + entry->fd_parent_count = 0; + entry->fd_parent_addrs = NULL; + entry->fd_child_count = 0; + entry->fd_dirty_child_count = 0; + entry->image_fd_height = 0; + entry->prefetched = FALSE; + entry->prefetch_type_id = 0; + entry->age = 0; + entry->prefetched_dirty = FALSE; +#ifndef NDEBUG /* debugging field */ + entry->serialization_count = 0; +#endif + + /* initialize tag list fields */ + entry->tl_next = NULL; + entry->tl_prev = NULL; + entry->tag_info = NULL; + + H5C__RESET_CACHE_ENTRY_STATS(entry); + + ret_value = thing; + +done: + /* Cleanup on error */ + if (NULL == ret_value) { + /* Release resources */ + if (thing && type->free_icr(thing) < 0) + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed"); + if (image) + image = (uint8_t *)H5MM_xfree(image); + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__load_entry() */ + +/*------------------------------------------------------------------------- + * Function: H5C__mark_flush_dep_dirty() + * + * Purpose: Recursively propagate the flush_dep_ndirty_children flag + * up the dependency chain in response to entry either + * becoming dirty or having its flush_dep_ndirty_children + * increased from 0. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__mark_flush_dep_dirty(H5C_cache_entry_t *entry) +{ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(entry); + + /* Iterate over the parent entries, if any */ + for (u = 0; u < entry->flush_dep_nparents; u++) { + /* Sanity check */ + assert(entry->flush_dep_parent[u]->flush_dep_ndirty_children < + entry->flush_dep_parent[u]->flush_dep_nchildren); + + /* Adjust the parent's number of dirty children */ + entry->flush_dep_parent[u]->flush_dep_ndirty_children++; + + /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */ + if (entry->flush_dep_parent[u]->type->notify && + (entry->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, + entry->flush_dep_parent[u]) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry dirty flag set"); + } /* end for */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__mark_flush_dep_dirty() */ + +/*------------------------------------------------------------------------- + * Function: H5C__mark_flush_dep_clean() + * + * Purpose: Recursively propagate the flush_dep_ndirty_children flag + * up the dependency chain in response to entry either + * becoming clean or having its flush_dep_ndirty_children + * reduced to 0. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__mark_flush_dep_clean(H5C_cache_entry_t *entry) +{ + int i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(entry); + + /* Iterate over the parent entries, if any */ + /* Note reverse iteration order, in case the callback removes the flush + * dependency - QAK, 2017/08/12 + */ + for (i = ((int)entry->flush_dep_nparents) - 1; i >= 0; i--) { + /* Sanity check */ + assert(entry->flush_dep_parent[i]->flush_dep_ndirty_children > 0); + + /* Adjust the parent's number of dirty children */ + entry->flush_dep_parent[i]->flush_dep_ndirty_children--; + + /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */ + if (entry->flush_dep_parent[i]->type->notify && + (entry->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, + entry->flush_dep_parent[i]) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry dirty flag reset"); + } /* end for */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__mark_flush_dep_clean() */ + +/*------------------------------------------------------------------------- + * Function: H5C__mark_flush_dep_serialized() + * + * Purpose: Decrement the flush_dep_nunser_children fields of all the + * target entry's flush dependency parents in response to + * the target entry becoming serialized. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__mark_flush_dep_serialized(H5C_cache_entry_t *entry_ptr) +{ + int i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(entry_ptr); + + /* Iterate over the parent entries, if any */ + /* Note reverse iteration order, in case the callback removes the flush + * dependency - QAK, 2017/08/12 + */ + for (i = ((int)entry_ptr->flush_dep_nparents) - 1; i >= 0; i--) { + /* Sanity checks */ + assert(entry_ptr->flush_dep_parent); + assert(entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children > 0); + + /* decrement the parents number of unserialized children */ + entry_ptr->flush_dep_parent[i]->flush_dep_nunser_children--; + + /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */ + if (entry_ptr->flush_dep_parent[i]->type->notify && + (entry_ptr->flush_dep_parent[i]->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, + entry_ptr->flush_dep_parent[i]) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry serialized flag set"); + } /* end for */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__mark_flush_dep_serialized() */ + +/*------------------------------------------------------------------------- + * Function: H5C__mark_flush_dep_unserialized() + * + * Purpose: Increment the flush_dep_nunser_children fields of all the + * target entry's flush dependency parents in response to + * the target entry becoming unserialized. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__mark_flush_dep_unserialized(H5C_cache_entry_t *entry_ptr) +{ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(entry_ptr); + + /* Iterate over the parent entries, if any */ + for (u = 0; u < entry_ptr->flush_dep_nparents; u++) { + /* Sanity check */ + assert(entry_ptr->flush_dep_parent); + assert(entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children < + entry_ptr->flush_dep_parent[u]->flush_dep_nchildren); + + /* increment parents number of usserialized children */ + entry_ptr->flush_dep_parent[u]->flush_dep_nunser_children++; + + /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */ + if (entry_ptr->flush_dep_parent[u]->type->notify && + (entry_ptr->flush_dep_parent[u]->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, + entry_ptr->flush_dep_parent[u]) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry serialized flag reset"); + } /* end for */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__mark_flush_dep_unserialized() */ + +#ifndef NDEBUG +/*------------------------------------------------------------------------- + * Function: H5C__assert_flush_dep_nocycle() + * + * Purpose: Assert recursively that base_entry is not the same as + * entry, and perform the same assertion on all of entry's + * flush dependency parents. This is used to detect cycles + * created by flush dependencies. + * + * Return: void + * + *------------------------------------------------------------------------- + */ +static void +H5C__assert_flush_dep_nocycle(const H5C_cache_entry_t *entry, const H5C_cache_entry_t *base_entry) +{ + unsigned u; /* Local index variable */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + assert(entry); + assert(base_entry); + + /* Make sure the entries are not the same */ + assert(base_entry != entry); + + /* Iterate over entry's parents (if any) */ + for (u = 0; u < entry->flush_dep_nparents; u++) + H5C__assert_flush_dep_nocycle(entry->flush_dep_parent[u], base_entry); + + FUNC_LEAVE_NOAPI_VOID +} /* H5C__assert_flush_dep_nocycle() */ +#endif + +/*------------------------------------------------------------------------- + * Function: H5C__serialize_single_entry + * + * Purpose: Serialize the cache entry pointed to by the entry_ptr + * parameter. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(f); + assert(cache_ptr); + assert(entry_ptr); + assert(!entry_ptr->prefetched); + assert(!entry_ptr->image_up_to_date); + assert(entry_ptr->is_dirty); + assert(!entry_ptr->is_protected); + assert(!entry_ptr->flush_in_progress); + assert(entry_ptr->type); + + /* Set entry_ptr->flush_in_progress to TRUE so the target entry + * will not be evicted out from under us. Must set it back to FALSE + * when we are done. + */ + entry_ptr->flush_in_progress = TRUE; + + /* Allocate buffer for the entry image if required. */ + if (NULL == entry_ptr->image_ptr) { + assert(entry_ptr->size > 0); + if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer"); +#if H5C_DO_MEMORY_SANITY_CHECKS + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + } /* end if */ + + /* Generate image for entry */ + if (H5C__generate_image(f, cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "Can't generate image for cache entry"); + + /* Reset the flush_in progress flag */ + entry_ptr->flush_in_progress = FALSE; + +done: + assert((ret_value != SUCCEED) || (!entry_ptr->flush_in_progress)); + assert((ret_value != SUCCEED) || (entry_ptr->image_up_to_date)); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__serialize_single_entry() */ + +/*------------------------------------------------------------------------- + * Function: H5C__destroy_pf_entry_child_flush_deps() + * + * Purpose: Destroy all flush dependencies in this the supplied + * prefetched entry is the parent. Note that the children + * in these flush dependencies must be prefetched entries as + * well. + * + * As this action is part of the process of transferring all + * such flush dependencies to the deserialized version of the + * prefetched entry, ensure that the data necessary to complete + * the transfer is retained. + * + * Note: The current implementation of this function is + * quite inefficient -- mostly due to the current + * implementation of flush dependencies. This should + * be fixed at some point. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr, H5C_cache_entry_t *pf_entry_ptr, + H5C_cache_entry_t **fd_children) +{ + H5C_cache_entry_t *entry_ptr; +#ifndef NDEBUG + unsigned entries_visited = 0; +#endif + int fd_children_found = 0; + hbool_t found; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(cache_ptr); + assert(pf_entry_ptr); + assert(pf_entry_ptr->type); + assert(pf_entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); + assert(pf_entry_ptr->prefetched); + assert(pf_entry_ptr->fd_child_count > 0); + assert(fd_children); + + /* Scan each entry on the index list */ + entry_ptr = cache_ptr->il_head; + while (entry_ptr != NULL) { + /* Here we look at entry_ptr->flush_dep_nparents and not + * entry_ptr->fd_parent_count as it is possible that some + * or all of the prefetched flush dependency child relationships + * have already been destroyed. + */ + if (entry_ptr->prefetched && (entry_ptr->flush_dep_nparents > 0)) { + unsigned u; /* Local index variable */ + + /* Re-init */ + u = 0; + found = FALSE; + + /* Sanity checks */ + assert(entry_ptr->type); + assert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); + assert(entry_ptr->fd_parent_count >= entry_ptr->flush_dep_nparents); + assert(entry_ptr->fd_parent_addrs); + assert(entry_ptr->flush_dep_parent); + + /* Look for correct entry */ + while (!found && (u < entry_ptr->fd_parent_count)) { + /* Sanity check entry */ + assert(entry_ptr->flush_dep_parent[u]); + + /* Correct entry? */ + if (pf_entry_ptr == entry_ptr->flush_dep_parent[u]) + found = TRUE; + + u++; + } /* end while */ + + if (found) { + assert(NULL == fd_children[fd_children_found]); + + /* Remove flush dependency */ + fd_children[fd_children_found] = entry_ptr; + fd_children_found++; + if (H5C_destroy_flush_dependency(pf_entry_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, + "can't destroy pf entry child flush dependency"); + +#ifndef NDEBUG + /* Sanity check -- verify that the address of the parent + * appears in entry_ptr->fd_parent_addrs. Must do a search, + * as with flush dependency creates and destroys, + * entry_ptr->fd_parent_addrs and entry_ptr->flush_dep_parent + * can list parents in different order. + */ + found = FALSE; + u = 0; + while (!found && u < entry_ptr->fd_parent_count) { + if (pf_entry_ptr->addr == entry_ptr->fd_parent_addrs[u]) + found = TRUE; + u++; + } /* end while */ + assert(found); +#endif + } /* end if */ + } /* end if */ + +#ifndef NDEBUG + entries_visited++; +#endif + entry_ptr = entry_ptr->il_next; + } /* end while */ + + /* Post-op sanity checks */ + assert(NULL == fd_children[fd_children_found]); + assert((unsigned)fd_children_found == pf_entry_ptr->fd_child_count); + assert(entries_visited == cache_ptr->index_len); + assert(!pf_entry_ptr->is_pinned); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__destroy_pf_entry_child_flush_deps() */ + +/*------------------------------------------------------------------------- + * Function: H5C__deserialize_prefetched_entry() + * + * Purpose: Deserialize the supplied prefetched entry entry, and return + * a pointer to the deserialized entry in *entry_ptr_ptr. + * If successful, remove the prefetched entry from the cache, + * and free it. Insert the deserialized entry into the cache. + * + * Note that the on disk image of the entry is not freed -- + * a pointer to it is stored in the deserialized entries' + * image_ptr field, and its image_up_to_date field is set to + * TRUE unless the entry is dirtied by the deserialize call. + * + * If the prefetched entry is a flush dependency child, + * destroy that flush dependency prior to calling the + * deserialize callback. If appropriate, the flush dependency + * relationship will be recreated by the cache client. + * + * If the prefetched entry is a flush dependency parent, + * destroy the flush dependency relationship with all its + * children. As all these children must be prefetched entries, + * recreate these flush dependency relationships with + * deserialized entry after it is inserted in the cache. + * + * Since deserializing a prefetched entry is semantically + * equivalent to a load, issue an entry loaded nofification + * if the notify callback is defined. + * + * Return: SUCCEED on success, and FAIL on failure. + * + * Note that *entry_ptr_ptr is undefined on failure. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t **entry_ptr_ptr, + const H5C_class_t *type, haddr_t addr, void *udata) +{ + hbool_t dirty = FALSE; /* Flag indicating whether thing was + * dirtied during deserialize + */ + size_t len; /* Size of image in file */ + void *thing = NULL; /* Pointer to thing loaded */ + H5C_cache_entry_t *pf_entry_ptr; /* pointer to the prefetched entry */ + /* supplied in *entry_ptr_ptr. */ + H5C_cache_entry_t *ds_entry_ptr; /* Alias for thing loaded, as cache + * entry + */ + H5C_cache_entry_t **fd_children = NULL; /* Pointer to a dynamically */ + /* allocated array of pointers to */ + /* the flush dependency children of */ + /* the prefetched entry, or NULL if */ + /* that array does not exist. */ + unsigned flush_flags = (H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG); + int i; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* sanity checks */ + assert(f); + assert(f->shared); + assert(f->shared->cache); + assert(f->shared->cache == cache_ptr); + assert(entry_ptr_ptr); + assert(*entry_ptr_ptr); + pf_entry_ptr = *entry_ptr_ptr; + assert(pf_entry_ptr->type); + assert(pf_entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); + assert(pf_entry_ptr->prefetched); + assert(pf_entry_ptr->image_up_to_date); + assert(pf_entry_ptr->image_ptr); + assert(pf_entry_ptr->size > 0); + assert(pf_entry_ptr->addr == addr); + assert(type); + assert(type->id == pf_entry_ptr->prefetch_type_id); + assert(type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type); + + /* verify absence of prohibited or unsupported type flag combinations */ + assert(!(type->flags & H5C__CLASS_SKIP_READS)); + + /* Can't see how skip reads could be usefully combined with + * either the speculative read flag. Hence disallow. + */ + assert(!((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG))); + assert(H5_addr_defined(addr)); + assert(type->get_initial_load_size); + assert(type->deserialize); + + /* if *pf_entry_ptr is a flush dependency child, destroy all such + * relationships now. The client will restore the relationship(s) with + * the deserialized entry if appropriate. + */ + assert(pf_entry_ptr->fd_parent_count == pf_entry_ptr->flush_dep_nparents); + for (i = (int)(pf_entry_ptr->fd_parent_count) - 1; i >= 0; i--) { + assert(pf_entry_ptr->flush_dep_parent); + assert(pf_entry_ptr->flush_dep_parent[i]); + assert(pf_entry_ptr->flush_dep_parent[i]->flush_dep_nchildren > 0); + assert(pf_entry_ptr->fd_parent_addrs); + assert(pf_entry_ptr->flush_dep_parent[i]->addr == pf_entry_ptr->fd_parent_addrs[i]); + + if (H5C_destroy_flush_dependency(pf_entry_ptr->flush_dep_parent[i], pf_entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "can't destroy pf entry parent flush dependency"); + + pf_entry_ptr->fd_parent_addrs[i] = HADDR_UNDEF; + } /* end for */ + assert(pf_entry_ptr->flush_dep_nparents == 0); + + /* If *pf_entry_ptr is a flush dependency parent, destroy its flush + * dependency relationships with all its children (which must be + * prefetched entries as well). + * + * These flush dependency relationships will have to be restored + * after the deserialized entry is inserted into the cache in order + * to transfer these relationships to the new entry. Hence save the + * pointers to the flush dependency children of *pf_enty_ptr for later + * use. + */ + if (pf_entry_ptr->fd_child_count > 0) { + if (NULL == (fd_children = (H5C_cache_entry_t **)H5MM_calloc( + sizeof(H5C_cache_entry_t **) * (size_t)(pf_entry_ptr->fd_child_count + 1)))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for fd child ptr array"); + + if (H5C__destroy_pf_entry_child_flush_deps(cache_ptr, pf_entry_ptr, fd_children) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, + "can't destroy pf entry child flush dependency(s)."); + } /* end if */ + + /* Since the size of the on disk image is known exactly, there is + * no need for either a call to the get_initial_load_size() callback, + * or retries if the H5C__CLASS_SPECULATIVE_LOAD_FLAG flag is set. + * Similarly, there is no need to clamp possible reads beyond + * EOF. + */ + len = pf_entry_ptr->size; + + /* Deserialize the prefetched on-disk image of the entry into the + * native memory form + */ + if (NULL == (thing = type->deserialize(pf_entry_ptr->image_ptr, len, udata, &dirty))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "Can't deserialize image"); + ds_entry_ptr = (H5C_cache_entry_t *)thing; + + /* In general, an entry should be clean just after it is loaded. + * + * However, when this code is used in the metadata cache, it is + * possible that object headers will be dirty at this point, as + * the deserialize function will alter object headers if necessary to + * fix an old bug. + * + * In the following assert: + * + * assert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) ); + * + * note that type ids 5 & 6 are associated with object headers in the + * metadata cache. + * + * When we get to using H5C for other purposes, we may wish to + * tighten up the assert so that the loophole only applies to the + * metadata cache. + * + * Note that at present, dirty can't be set to true with prefetched + * entries. However this may change, so include this functionality + * against that possibility. + * + * Also, note that it is possible for a prefetched entry to be dirty -- + * hence the value assigned to ds_entry_ptr->is_dirty below. + */ + + assert((dirty == FALSE) || (type->id == 5 || type->id == 6)); + + ds_entry_ptr->cache_ptr = f->shared->cache; + ds_entry_ptr->addr = addr; + ds_entry_ptr->size = len; + assert(ds_entry_ptr->size < H5C_MAX_ENTRY_SIZE); + ds_entry_ptr->image_ptr = pf_entry_ptr->image_ptr; + ds_entry_ptr->image_up_to_date = !dirty; + ds_entry_ptr->type = type; + ds_entry_ptr->is_dirty = dirty | pf_entry_ptr->is_dirty; + ds_entry_ptr->dirtied = FALSE; + ds_entry_ptr->is_protected = FALSE; + ds_entry_ptr->is_read_only = FALSE; + ds_entry_ptr->ro_ref_count = 0; + ds_entry_ptr->is_pinned = FALSE; + ds_entry_ptr->in_slist = FALSE; + ds_entry_ptr->flush_marker = FALSE; +#ifdef H5_HAVE_PARALLEL + ds_entry_ptr->clear_on_unprotect = FALSE; + ds_entry_ptr->flush_immediately = FALSE; + ds_entry_ptr->coll_access = FALSE; +#endif /* H5_HAVE_PARALLEL */ + ds_entry_ptr->flush_in_progress = FALSE; + ds_entry_ptr->destroy_in_progress = FALSE; + + ds_entry_ptr->ring = pf_entry_ptr->ring; + + /* Initialize flush dependency height fields */ + ds_entry_ptr->flush_dep_parent = NULL; + ds_entry_ptr->flush_dep_nparents = 0; + ds_entry_ptr->flush_dep_parent_nalloc = 0; + ds_entry_ptr->flush_dep_nchildren = 0; + ds_entry_ptr->flush_dep_ndirty_children = 0; + ds_entry_ptr->flush_dep_nunser_children = 0; + + /* Initialize fields supporting the hash table: */ + ds_entry_ptr->ht_next = NULL; + ds_entry_ptr->ht_prev = NULL; + ds_entry_ptr->il_next = NULL; + ds_entry_ptr->il_prev = NULL; + + /* Initialize fields supporting replacement policies: */ + ds_entry_ptr->next = NULL; + ds_entry_ptr->prev = NULL; +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS + ds_entry_ptr->aux_next = NULL; + ds_entry_ptr->aux_prev = NULL; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ +#ifdef H5_HAVE_PARALLEL + pf_entry_ptr->coll_next = NULL; + pf_entry_ptr->coll_prev = NULL; +#endif /* H5_HAVE_PARALLEL */ + + /* Initialize cache image related fields */ + ds_entry_ptr->include_in_image = FALSE; + ds_entry_ptr->lru_rank = 0; + ds_entry_ptr->image_dirty = FALSE; + ds_entry_ptr->fd_parent_count = 0; + ds_entry_ptr->fd_parent_addrs = NULL; + ds_entry_ptr->fd_child_count = pf_entry_ptr->fd_child_count; + ds_entry_ptr->fd_dirty_child_count = 0; + ds_entry_ptr->image_fd_height = 0; + ds_entry_ptr->prefetched = FALSE; + ds_entry_ptr->prefetch_type_id = 0; + ds_entry_ptr->age = 0; + ds_entry_ptr->prefetched_dirty = pf_entry_ptr->prefetched_dirty; +#ifndef NDEBUG /* debugging field */ + ds_entry_ptr->serialization_count = 0; +#endif + + H5C__RESET_CACHE_ENTRY_STATS(ds_entry_ptr); + + /* Apply to to the newly deserialized entry */ + if (H5C__tag_entry(cache_ptr, ds_entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry"); + + /* We have successfully deserialized the prefetched entry. + * + * Before we return a pointer to the deserialized entry, we must remove + * the prefetched entry from the cache, discard it, and replace it with + * the deserialized entry. Note that we do not free the prefetched + * entries image, as that has been transferred to the deserialized + * entry. + * + * Also note that we have not yet restored any flush dependencies. This + * must wait until the deserialized entry is inserted in the cache. + * + * To delete the prefetched entry from the cache: + * + * 1) Set pf_entry_ptr->image_ptr to NULL. Since we have already + * transferred the buffer containing the image to *ds_entry_ptr, + * this is not a memory leak. + * + * 2) Call H5C__flush_single_entry() with the H5C__FLUSH_INVALIDATE_FLAG + * and H5C__FLUSH_CLEAR_ONLY_FLAG flags set. + */ + pf_entry_ptr->image_ptr = NULL; + + if (pf_entry_ptr->is_dirty) { + assert(((cache_ptr->slist_enabled) && (pf_entry_ptr->in_slist)) || + ((!cache_ptr->slist_enabled) && (!pf_entry_ptr->in_slist))); + + flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; + } /* end if */ + + if (H5C__flush_single_entry(f, pf_entry_ptr, flush_flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "can't expunge prefetched entry"); + +#ifndef NDEGUG /* verify deletion */ + H5C__SEARCH_INDEX(cache_ptr, addr, pf_entry_ptr, FAIL); + + assert(NULL == pf_entry_ptr); +#endif + + /* Insert the deserialized entry into the cache. */ + H5C__INSERT_IN_INDEX(cache_ptr, ds_entry_ptr, FAIL); + + assert(!ds_entry_ptr->in_slist); + if (ds_entry_ptr->is_dirty) + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, ds_entry_ptr, FAIL); + + H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, ds_entry_ptr, FAIL); + + /* Deserializing a prefetched entry is the conceptual equivalent of + * loading it from file. If the deserialized entry has a notify callback, + * send an "after load" notice now that the deserialized entry is fully + * integrated into the cache. + */ + if (ds_entry_ptr->type->notify && + (ds_entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_LOAD, ds_entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry loaded into cache"); + + /* Restore flush dependencies with the flush dependency children of + * of the prefetched entry. Note that we must protect *ds_entry_ptr + * before the call to avoid triggering sanity check failures, and + * then unprotect it afterwards. + */ + i = 0; + if (fd_children != NULL) { + H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, ds_entry_ptr, FAIL); + ds_entry_ptr->is_protected = TRUE; + while (fd_children[i] != NULL) { + /* Sanity checks */ + assert((fd_children[i])->prefetched); + assert((fd_children[i])->fd_parent_count > 0); + assert((fd_children[i])->fd_parent_addrs); + +#ifndef NDEBUG + { + int j; + hbool_t found; + + j = 0; + found = FALSE; + while ((j < (int)((fd_children[i])->fd_parent_count)) && (!found)) { + if ((fd_children[i])->fd_parent_addrs[j] == ds_entry_ptr->addr) + found = TRUE; + + j++; + } /* end while */ + assert(found); + } +#endif + + if (H5C_create_flush_dependency(ds_entry_ptr, fd_children[i]) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Can't restore child flush dependency"); + + i++; + } /* end while */ + + H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, ds_entry_ptr, FAIL); + ds_entry_ptr->is_protected = FALSE; + } /* end if ( fd_children != NULL ) */ + assert((unsigned)i == ds_entry_ptr->fd_child_count); + + ds_entry_ptr->fd_child_count = 0; + H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr); + + /* finally, pass ds_entry_ptr back to the caller */ + *entry_ptr_ptr = ds_entry_ptr; + +done: + if (fd_children) + fd_children = (H5C_cache_entry_t **)H5MM_xfree((void *)fd_children); + + /* Release resources on error */ + if (FAIL == ret_value) + if (thing && type->free_icr(thing) < 0) + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed"); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__deserialize_prefetched_entry() */ + +/*------------------------------------------------------------------------- + * Function: H5C_insert_entry + * + * Purpose: Adds the specified thing to the cache. The thing need not + * exist on disk yet, but it must have an address and disk + * space reserved. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *thing, unsigned int flags) +{ + H5C_t *cache_ptr; + H5AC_ring_t ring = H5C_RING_UNDEFINED; + hbool_t insert_pinned; + hbool_t flush_last; +#ifdef H5_HAVE_PARALLEL + hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ +#endif /* H5_HAVE_PARALLEL */ + hbool_t set_flush_marker; + hbool_t write_permitted = TRUE; + size_t empty_space; + H5C_cache_entry_t *entry_ptr = NULL; + H5C_cache_entry_t *test_entry_ptr; + hbool_t entry_tagged = FALSE; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + assert(f); + assert(f->shared); + + cache_ptr = f->shared->cache; + + assert(cache_ptr); + assert(type); + assert(type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type); + assert(type->image_len); + assert(H5_addr_defined(addr)); + assert(thing); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + /* no need to verify that entry is not already in the index as */ + /* we already make that check below. */ + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0); + insert_pinned = ((flags & H5C__PIN_ENTRY_FLAG) != 0); + flush_last = ((flags & H5C__FLUSH_LAST_FLAG) != 0); + + /* Get the ring type from the API context */ + ring = H5CX_get_ring(); + + entry_ptr = (H5C_cache_entry_t *)thing; + + /* verify that the new entry isn't already in the hash table -- scream + * and die if it is. + */ + + H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL); + + if (test_entry_ptr != NULL) { + if (test_entry_ptr == entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "entry already in cache"); + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "duplicate entry in cache"); + } /* end if */ + + entry_ptr->cache_ptr = cache_ptr; + entry_ptr->addr = addr; + entry_ptr->type = type; + + entry_ptr->image_ptr = NULL; + entry_ptr->image_up_to_date = FALSE; + + entry_ptr->is_protected = FALSE; + entry_ptr->is_read_only = FALSE; + entry_ptr->ro_ref_count = 0; + + entry_ptr->is_pinned = insert_pinned; + entry_ptr->pinned_from_client = insert_pinned; + entry_ptr->pinned_from_cache = FALSE; + entry_ptr->flush_me_last = flush_last; + + /* newly inserted entries are assumed to be dirty */ + entry_ptr->is_dirty = TRUE; + + /* not protected, so can't be dirtied */ + entry_ptr->dirtied = FALSE; + + /* Retrieve the size of the thing */ + if ((type->image_len)(thing, &(entry_ptr->size)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGETSIZE, FAIL, "can't get size of thing"); + assert(entry_ptr->size > 0 && entry_ptr->size < H5C_MAX_ENTRY_SIZE); + + entry_ptr->in_slist = FALSE; + +#ifdef H5_HAVE_PARALLEL + entry_ptr->clear_on_unprotect = FALSE; + entry_ptr->flush_immediately = FALSE; +#endif /* H5_HAVE_PARALLEL */ + + entry_ptr->flush_in_progress = FALSE; + entry_ptr->destroy_in_progress = FALSE; + + entry_ptr->ring = ring; + + /* Initialize flush dependency fields */ + entry_ptr->flush_dep_parent = NULL; + entry_ptr->flush_dep_nparents = 0; + entry_ptr->flush_dep_parent_nalloc = 0; + entry_ptr->flush_dep_nchildren = 0; + entry_ptr->flush_dep_ndirty_children = 0; + entry_ptr->flush_dep_nunser_children = 0; + + entry_ptr->ht_next = NULL; + entry_ptr->ht_prev = NULL; + entry_ptr->il_next = NULL; + entry_ptr->il_prev = NULL; + + entry_ptr->next = NULL; + entry_ptr->prev = NULL; + +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS + entry_ptr->aux_next = NULL; + entry_ptr->aux_prev = NULL; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + +#ifdef H5_HAVE_PARALLEL + entry_ptr->coll_next = NULL; + entry_ptr->coll_prev = NULL; +#endif /* H5_HAVE_PARALLEL */ + + /* initialize cache image related fields */ + entry_ptr->include_in_image = FALSE; + entry_ptr->lru_rank = 0; + entry_ptr->image_dirty = FALSE; + entry_ptr->fd_parent_count = 0; + entry_ptr->fd_parent_addrs = NULL; + entry_ptr->fd_child_count = 0; + entry_ptr->fd_dirty_child_count = 0; + entry_ptr->image_fd_height = 0; + entry_ptr->prefetched = FALSE; + entry_ptr->prefetch_type_id = 0; + entry_ptr->age = 0; + entry_ptr->prefetched_dirty = FALSE; +#ifndef NDEBUG /* debugging field */ + entry_ptr->serialization_count = 0; +#endif + + /* initialize tag list fields */ + entry_ptr->tl_next = NULL; + entry_ptr->tl_prev = NULL; + entry_ptr->tag_info = NULL; + + /* Apply tag to newly inserted entry */ + if (H5C__tag_entry(cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry"); + entry_tagged = TRUE; + + H5C__RESET_CACHE_ENTRY_STATS(entry_ptr); + + if (cache_ptr->flash_size_increase_possible && + (entry_ptr->size > cache_ptr->flash_size_increase_threshold)) + if (H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__flash_increase_cache_size failed"); + + if (cache_ptr->index_size >= cache_ptr->max_cache_size) + empty_space = 0; + else + empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; + + if (cache_ptr->evictions_enabled && + (((cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) || + (((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size)))) { + size_t space_needed; + + if (empty_space <= entry_ptr->size) + cache_ptr->cache_full = TRUE; + + if (cache_ptr->check_write_permitted != NULL) { + if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "Can't get write_permitted"); + } /* end if */ + else + write_permitted = cache_ptr->write_permitted; + + assert(entry_ptr->size <= H5C_MAX_ENTRY_SIZE); + space_needed = entry_ptr->size; + if (space_needed > cache_ptr->max_cache_size) + space_needed = cache_ptr->max_cache_size; + + /* Note that space_needed is just the amount of space that + * needed to insert the new entry without exceeding the cache + * size limit. The subsequent call to H5C__make_space_in_cache() + * may evict the entries required to free more or less space + * depending on conditions. It MAY be less if the cache is + * currently undersized, or more if the cache is oversized. + * + * The cache can exceed its maximum size limit via the following + * mechanisms: + * + * First, it is possible for the cache to grow without + * bound as long as entries are protected and not unprotected. + * + * Second, when writes are not permitted it is also possible + * for the cache to grow without bound. + * + * Finally, we usually don't check to see if the cache is + * oversized at the end of an unprotect. As a result, it is + * possible to have a vastly oversized cache with no protected + * entries as long as all the protects precede the unprotects. + */ + + if (H5C__make_space_in_cache(f, space_needed, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C__make_space_in_cache failed"); + } /* end if */ + + H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL); + + /* New entries are presumed to be dirty */ + assert(entry_ptr->is_dirty); + entry_ptr->flush_marker = set_flush_marker; + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, FAIL); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + /* If the entry's type has a 'notify' callback send a 'after insertion' + * notice now that the entry is fully integrated into the cache. + */ + if (entry_ptr->type->notify && (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_INSERT, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry inserted into cache"); + + H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr); + +#ifdef H5_HAVE_PARALLEL + if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) + coll_access = H5F_get_coll_metadata_reads(f); + + entry_ptr->coll_access = coll_access; + if (coll_access) { + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL); + + /* Make sure the size of the collective entries in the cache remain in check */ + if (H5P_USER_TRUE == H5F_COLL_MD_READ(f)) { + if (cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) { + if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries"); + } /* end if */ + } /* end if */ + else { + if (cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) { + if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries"); + } /* end if */ + } /* end else */ + } /* end if */ +#endif + +done: +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + if (ret_value < 0 && entry_tagged) + if (H5C__untag_entry(cache_ptr, entry_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list"); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_insert_entry() */ + +/*------------------------------------------------------------------------- + * Function: H5C_mark_entry_dirty + * + * Purpose: Mark a pinned or protected entry as dirty. The target entry + * MUST be either pinned or protected, and MAY be both. + * + * In the protected case, this call is the functional + * equivalent of setting the H5C__DIRTIED_FLAG on an unprotect + * call. + * + * In the pinned but not protected case, if the entry is not + * already dirty, the function places function marks the entry + * dirty and places it on the skip list. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_mark_entry_dirty(void *thing) +{ + H5C_t *cache_ptr; + H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)thing; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(entry_ptr); + assert(H5_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + assert(cache_ptr); + + if (entry_ptr->is_protected) { + assert(!((entry_ptr)->is_read_only)); + + /* set the dirtied flag */ + entry_ptr->dirtied = TRUE; + + /* reset image_up_to_date */ + if (entry_ptr->image_up_to_date) { + entry_ptr->image_up_to_date = FALSE; + + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "Can't propagate serialization status to fd parents"); + } /* end if */ + } /* end if */ + else if (entry_ptr->is_pinned) { + hbool_t was_clean; /* Whether the entry was previously clean */ + hbool_t image_was_up_to_date; + + /* Remember previous dirty status */ + was_clean = !entry_ptr->is_dirty; + + /* Check if image is up to date */ + image_was_up_to_date = entry_ptr->image_up_to_date; + + /* Mark the entry as dirty if it isn't already */ + entry_ptr->is_dirty = TRUE; + entry_ptr->image_up_to_date = FALSE; + + /* Modify cache data structures */ + if (was_clean) + H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr, FAIL); + if (!entry_ptr->in_slist) + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + + /* Update stats for entry being marked dirty */ + H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr); + + /* Check for entry changing status and do notifications, etc. */ + if (was_clean) { + /* If the entry's type has a 'notify' callback send a 'entry dirtied' + * notice now that the entry is fully integrated into the cache. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify client about entry dirty flag set"); + + /* Propagate the dirty flag up the flush dependency chain if appropriate */ + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_dirty(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag"); + } /* end if */ + if (image_was_up_to_date) + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "Can't propagate serialization status to fd parents"); + } /* end if */ + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Entry is neither pinned nor protected??"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_mark_entry_dirty() */ + +/*------------------------------------------------------------------------- + * Function: H5C_mark_entry_clean + * + * Purpose: Mark a pinned entry as clean. The target entry MUST be pinned. + * + * If the entry is not + * already clean, the function places function marks the entry + * clean and removes it from the skip list. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_mark_entry_clean(void *_thing) +{ + H5C_t *cache_ptr; + H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_thing; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(entry_ptr); + assert(H5_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + assert(cache_ptr); + + /* Operate on pinned entry */ + if (entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "entry is protected"); + else if (entry_ptr->is_pinned) { + hbool_t was_dirty; /* Whether the entry was previously dirty */ + + /* Remember previous dirty status */ + was_dirty = entry_ptr->is_dirty; + + /* Mark the entry as clean if it isn't already */ + entry_ptr->is_dirty = FALSE; + + /* Also reset the 'flush_marker' flag, since the entry shouldn't be flushed now */ + entry_ptr->flush_marker = FALSE; + + /* Modify cache data structures */ + if (was_dirty) + H5C__UPDATE_INDEX_FOR_ENTRY_CLEAN(cache_ptr, entry_ptr, FAIL); + if (entry_ptr->in_slist) + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE, FAIL); + + /* Update stats for entry being marked clean */ + H5C__UPDATE_STATS_FOR_CLEAR(cache_ptr, entry_ptr); + + /* Check for entry changing status and do notifications, etc. */ + if (was_dirty) { + /* If the entry's type has a 'notify' callback send a 'entry cleaned' + * notice now that the entry is fully integrated into the cache. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify client about entry dirty flag cleared"); + + /* Propagate the clean up the flush dependency chain, if appropriate */ + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_clean(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "Can't propagate flush dep clean"); + } /* end if */ + } /* end if */ + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "Entry is not pinned??"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_mark_entry_clean() */ + +/*------------------------------------------------------------------------- + * Function: H5C_mark_entry_unserialized + * + * Purpose: Mark a pinned or protected entry as unserialized. The target + * entry MUST be either pinned or protected, and MAY be both. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_mark_entry_unserialized(void *thing) +{ + H5C_cache_entry_t *entry = (H5C_cache_entry_t *)thing; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(entry); + assert(H5_addr_defined(entry->addr)); + + if (entry->is_protected || entry->is_pinned) { + assert(!entry->is_read_only); + + /* Reset image_up_to_date */ + if (entry->image_up_to_date) { + entry->image_up_to_date = FALSE; + + if (entry->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_unserialized(entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, + "Can't propagate serialization status to fd parents"); + } /* end if */ + } /* end if */ + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKUNSERIALIZED, FAIL, + "Entry to unserialize is neither pinned nor protected??"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_mark_entry_unserialized() */ + +/*------------------------------------------------------------------------- + * Function: H5C_mark_entry_serialized + * + * Purpose: Mark a pinned entry as serialized. The target entry MUST be + * pinned. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_mark_entry_serialized(void *_thing) +{ + H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_thing; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(entry); + assert(H5_addr_defined(entry->addr)); + + /* Operate on pinned entry */ + if (entry->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "entry is protected"); + else if (entry->is_pinned) { + /* Check for entry changing status and do notifications, etc. */ + if (!entry->image_up_to_date) { + /* Set the image_up_to_date flag */ + entry->image_up_to_date = TRUE; + + /* Propagate the serialize up the flush dependency chain, if appropriate */ + if (entry->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_serialized(entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, + "Can't propagate flush dep serialize"); + } /* end if */ + } /* end if */ + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "Entry is not pinned??"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_mark_entry_serialized() */ + +/*------------------------------------------------------------------------- + * Function: H5C_move_entry + * + * Purpose: Use this function to notify the cache that an entry's + * file address changed. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_move_entry(H5C_t *cache_ptr, const H5C_class_t *type, haddr_t old_addr, haddr_t new_addr) +{ + H5C_cache_entry_t *entry_ptr = NULL; + H5C_cache_entry_t *test_entry_ptr = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + assert(cache_ptr); + assert(type); + assert(H5_addr_defined(old_addr)); + assert(H5_addr_defined(new_addr)); + assert(H5_addr_ne(old_addr, new_addr)); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + H5C__SEARCH_INDEX(cache_ptr, old_addr, entry_ptr, FAIL); + + if (entry_ptr == NULL || entry_ptr->type != type) + /* the old item doesn't exist in the cache, so we are done. */ + HGOTO_DONE(SUCCEED); + + assert(entry_ptr->addr == old_addr); + assert(entry_ptr->type == type); + + /* Check for R/W status, otherwise error */ + /* (Moving a R/O entry would mark it dirty, which shouldn't + * happen. QAK - 2016/12/02) + */ + if (entry_ptr->is_read_only) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "can't move R/O entry"); + + H5C__SEARCH_INDEX(cache_ptr, new_addr, test_entry_ptr, FAIL); + + if (test_entry_ptr != NULL) { /* we are hosed */ + if (test_entry_ptr->type == type) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "target already moved & reinserted???"); + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTMOVE, FAIL, "new address already in use?"); + } /* end if */ + + /* If we get this far we have work to do. Remove *entry_ptr from + * the hash table (and skip list if necessary), change its address to the + * new address, mark it as dirty (if it isn't already) and then re-insert. + * + * Update the replacement policy for a hit to avoid an eviction before + * the moved entry is touched. Update stats for a move. + * + * Note that we do not check the size of the cache, or evict anything. + * Since this is a simple re-name, cache size should be unaffected. + * + * Check to see if the target entry is in the process of being destroyed + * before we delete from the index, etc. If it is, all we do is + * change the addr. If the entry is only in the process of being flushed, + * don't mark it as dirty either, lest we confuse the flush call back. + */ + if (!entry_ptr->destroy_in_progress) { + H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr, FAIL); + + if (entry_ptr->in_slist) { + assert(cache_ptr->slist_ptr); + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr, FALSE, FAIL); + } /* end if */ + } /* end if */ + + entry_ptr->addr = new_addr; + + if (!entry_ptr->destroy_in_progress) { + hbool_t was_dirty; /* Whether the entry was previously dirty */ + + /* Remember previous dirty status */ + was_dirty = entry_ptr->is_dirty; + + /* Mark the entry as dirty if it isn't already */ + entry_ptr->is_dirty = TRUE; + + /* This shouldn't be needed, but it keeps the test code happy */ + if (entry_ptr->image_up_to_date) { + entry_ptr->image_up_to_date = FALSE; + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "Can't propagate serialization status to fd parents"); + } /* end if */ + + /* Modify cache data structures */ + H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL); + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + + /* Skip some actions if we're in the middle of flushing the entry */ + if (!entry_ptr->flush_in_progress) { + /* Update the replacement policy for the entry */ + H5C__UPDATE_RP_FOR_MOVE(cache_ptr, entry_ptr, was_dirty, FAIL); + + /* Check for entry changing status and do notifications, etc. */ + if (!was_dirty) { + /* If the entry's type has a 'notify' callback send a 'entry dirtied' + * notice now that the entry is fully integrated into the cache. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify client about entry dirty flag set"); + + /* Propagate the dirty flag up the flush dependency chain if appropriate */ + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_dirty(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, + "Can't propagate flush dep dirty flag"); + } /* end if */ + } /* end if */ + } /* end if */ + + H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr); + +done: +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_move_entry() */ + +/*------------------------------------------------------------------------- + * Function: H5C_resize_entry + * + * Purpose: Resize a pinned or protected entry. + * + * Resizing an entry dirties it, so if the entry is not + * already dirty, the function places the entry on the + * skip list. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_resize_entry(void *thing, size_t new_size) +{ + H5C_t *cache_ptr; + H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)thing; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(entry_ptr); + assert(H5_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + assert(cache_ptr); + + /* Check for usage errors */ + if (new_size <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "New size is non-positive"); + if (!(entry_ptr->is_pinned || entry_ptr->is_protected)) + HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "Entry isn't pinned or protected??"); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + /* update for change in entry size if necessary */ + if (entry_ptr->size != new_size) { + hbool_t was_clean; + + /* make note of whether the entry was clean to begin with */ + was_clean = !entry_ptr->is_dirty; + + /* mark the entry as dirty if it isn't already */ + entry_ptr->is_dirty = TRUE; + + /* Reset the image up-to-date status */ + if (entry_ptr->image_up_to_date) { + entry_ptr->image_up_to_date = FALSE; + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "Can't propagate serialization status to fd parents"); + } /* end if */ + + /* Release the current image */ + if (entry_ptr->image_ptr) + entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); + + /* do a flash cache size increase if appropriate */ + if (cache_ptr->flash_size_increase_possible) { + if (new_size > entry_ptr->size) { + size_t size_increase; + + size_increase = new_size - entry_ptr->size; + if (size_increase >= cache_ptr->flash_size_increase_threshold) + if (H5C__flash_increase_cache_size(cache_ptr, entry_ptr->size, new_size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "flash cache increase failed"); + } + } + + /* update the pinned and/or protected entry list */ + if (entry_ptr->is_pinned) + H5C__DLL_UPDATE_FOR_SIZE_CHANGE(cache_ptr->pel_len, cache_ptr->pel_size, entry_ptr->size, + new_size, FAIL) + if (entry_ptr->is_protected) + H5C__DLL_UPDATE_FOR_SIZE_CHANGE(cache_ptr->pl_len, cache_ptr->pl_size, entry_ptr->size, new_size, + FAIL) + +#ifdef H5_HAVE_PARALLEL + if (entry_ptr->coll_access) + H5C__DLL_UPDATE_FOR_SIZE_CHANGE(cache_ptr->coll_list_len, cache_ptr->coll_list_size, + entry_ptr->size, new_size, FAIL) +#endif /* H5_HAVE_PARALLEL */ + + /* update statistics just before changing the entry size */ + H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_size); + + /* update the hash table */ + H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_size, entry_ptr, was_clean, FAIL); + + /* if the entry is in the skip list, update that too */ + if (entry_ptr->in_slist) + H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_size); + + /* finally, update the entry size proper */ + entry_ptr->size = new_size; + + if (!entry_ptr->in_slist) + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + + if (entry_ptr->is_pinned) + H5C__UPDATE_STATS_FOR_DIRTY_PIN(cache_ptr, entry_ptr); + + /* Check for entry changing status and do notifications, etc. */ + if (was_clean) { + /* If the entry's type has a 'notify' callback send a 'entry dirtied' + * notice now that the entry is fully integrated into the cache. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify client about entry dirty flag set"); + + /* Propagate the dirty flag up the flush dependency chain if appropriate */ + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_dirty(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag"); + } /* end if */ + } /* end if */ + +done: +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_resize_entry() */ + +/*------------------------------------------------------------------------- + * Function: H5C_pin_protected_entry() + * + * Purpose: Pin a protected cache entry. The entry must be protected + * at the time of call, and must be unpinned. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_pin_protected_entry(void *thing) +{ + H5C_t *cache_ptr; + H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)thing; /* Pointer to entry to pin */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(entry_ptr); + assert(H5_addr_defined(entry_ptr->addr)); + cache_ptr = entry_ptr->cache_ptr; + assert(cache_ptr); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + /* Only protected entries can be pinned */ + if (!entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Entry isn't protected"); + + /* Pin the entry from a client */ + if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client"); + +done: +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_pin_protected_entry() */ + +/*------------------------------------------------------------------------- + * Function: H5C_protect + * + * Purpose: If the target entry is not in the cache, load it. If + * necessary, attempt to evict one or more entries to keep + * the cache within its maximum size. + * + * Mark the target entry as protected, and return its address + * to the caller. The caller must call H5C_unprotect() when + * finished with the entry. + * + * While it is protected, the entry may not be either evicted + * or flushed -- nor may it be accessed by another call to + * H5C_protect. Any attempt to do so will result in a failure. + * + * Return: Success: Ptr to the desired entry + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +H5C_protect(H5F_t *f, const H5C_class_t *type, haddr_t addr, void *udata, unsigned flags) +{ + H5C_t *cache_ptr; + H5AC_ring_t ring = H5C_RING_UNDEFINED; + hbool_t hit; + hbool_t have_write_permitted = FALSE; + hbool_t read_only = FALSE; + hbool_t flush_last; +#ifdef H5_HAVE_PARALLEL + hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ +#endif /* H5_HAVE_PARALLEL */ + hbool_t write_permitted = FALSE; + hbool_t was_loaded = FALSE; /* Whether the entry was loaded as a result of the protect */ + size_t empty_space; + void *thing; + H5C_cache_entry_t *entry_ptr; + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_NOAPI(NULL) + + /* check args */ + assert(f); + assert(f->shared); + cache_ptr = f->shared->cache; + assert(cache_ptr); + assert(type); + assert(type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type); + assert(H5_addr_defined(addr)); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on entry"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + /* Load the cache image, if requested */ + if (cache_ptr->load_image) { + cache_ptr->load_image = FALSE; + if (H5C__load_cache_image(f) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't load cache image"); + } /* end if */ + + read_only = ((flags & H5C__READ_ONLY_FLAG) != 0); + flush_last = ((flags & H5C__FLUSH_LAST_FLAG) != 0); + + /* Get the ring type from the API context */ + ring = H5CX_get_ring(); + +#ifdef H5_HAVE_PARALLEL + if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) + coll_access = H5F_get_coll_metadata_reads(f); +#endif /* H5_HAVE_PARALLEL */ + + /* first check to see if the target is in cache */ + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL); + + if (entry_ptr != NULL) { + if (entry_ptr->ring != ring) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "ring type mismatch occurred for cache entry"); + + if (entry_ptr->prefetched) { + /* This call removes the prefetched entry from the cache, + * and replaces it with an entry deserialized from the + * image of the prefetched entry. + */ + if (H5C__deserialize_prefetched_entry(f, cache_ptr, &entry_ptr, type, addr, udata) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't deserialize prefetched entry"); + + assert(!entry_ptr->prefetched); + assert(entry_ptr->addr == addr); + } /* end if */ + + /* Check for trying to load the wrong type of entry from an address */ + if (entry_ptr->type != type) + HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type"); + +#ifdef H5_HAVE_PARALLEL + /* If this is a collective metadata read, the entry is not marked as + * collective, and is clean, it is possible that other processes will + * not have it in its cache and will expect a bcast of the entry from + * process 0. So process 0 will bcast the entry to all other ranks. + * Ranks that _do_ have the entry in their cache still have to + * participate in the bcast. + */ + if (coll_access) { + if (!entry_ptr->is_dirty && !entry_ptr->coll_access) { + MPI_Comm comm; /* File MPI Communicator */ + int mpi_code; /* MPI error code */ + int buf_size; + + if (MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed"); + + if (entry_ptr->image_ptr == NULL) { + int mpi_rank; + + if ((mpi_rank = H5F_mpi_get_rank(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank"); + + if (NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, + "memory allocation failed for on disk image buffer"); +#if H5C_DO_MEMORY_SANITY_CHECKS + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + if (0 == mpi_rank && H5C__generate_image(f, cache_ptr, entry_ptr) < 0) + /* If image generation fails, push an error but + * still participate in the following MPI_Bcast + */ + HDONE_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't generate entry's image"); + } /* end if */ + assert(entry_ptr->image_ptr); + + H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t); + if (MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + + /* Mark the entry as collective and insert into the collective list */ + entry_ptr->coll_access = TRUE; + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL); + } /* end if */ + else if (entry_ptr->coll_access) + H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL); + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + +#ifdef H5C_DO_TAGGING_SANITY_CHECKS + { + /* Verify tag value */ + if (cache_ptr->ignore_tags != TRUE) { + haddr_t tag; /* Tag value */ + + /* The entry is already in the cache, but make sure that the tag value + * is still legal. This will ensure that had the entry NOT been in the + * cache, tagging was still set up correctly and it would have received + * a legal tag value after getting loaded from disk. + */ + + /* Get the tag */ + tag = H5CX_get_tag(); + + if (H5C_verify_tag(entry_ptr->type->id, tag) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "tag verification failed"); + } /* end if */ + } +#endif + + hit = TRUE; + thing = (void *)entry_ptr; + } + else { + /* must try to load the entry from disk. */ + hit = FALSE; + if (NULL == (thing = H5C__load_entry(f, +#ifdef H5_HAVE_PARALLEL + coll_access, +#endif /* H5_HAVE_PARALLEL */ + type, addr, udata))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't load entry"); + + entry_ptr = (H5C_cache_entry_t *)thing; + cache_ptr->entries_loaded_counter++; + + entry_ptr->ring = ring; +#ifdef H5_HAVE_PARALLEL + if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && entry_ptr->coll_access) + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL); +#endif /* H5_HAVE_PARALLEL */ + + /* Apply tag to newly protected entry */ + if (H5C__tag_entry(cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Cannot tag metadata entry"); + + /* If the entry is very large, and we are configured to allow it, + * we may wish to perform a flash cache size increase. + */ + if (cache_ptr->flash_size_increase_possible && + (entry_ptr->size > cache_ptr->flash_size_increase_threshold)) + if (H5C__flash_increase_cache_size(cache_ptr, 0, entry_ptr->size) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__flash_increase_cache_size failed"); + + if (cache_ptr->index_size >= cache_ptr->max_cache_size) + empty_space = 0; + else + empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; + + /* try to free up if necceary and if evictions are permitted. Note + * that if evictions are enabled, we will call H5C__make_space_in_cache() + * regardless if the min_free_space requirement is not met. + */ + if (cache_ptr->evictions_enabled && + (((cache_ptr->index_size + entry_ptr->size) > cache_ptr->max_cache_size) || + ((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size))) { + + size_t space_needed; + + if (empty_space <= entry_ptr->size) + cache_ptr->cache_full = TRUE; + + if (cache_ptr->check_write_permitted != NULL) { + if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted 1"); + else + have_write_permitted = TRUE; + } /* end if */ + else { + write_permitted = cache_ptr->write_permitted; + have_write_permitted = TRUE; + } /* end else */ + + assert(entry_ptr->size <= H5C_MAX_ENTRY_SIZE); + space_needed = entry_ptr->size; + if (space_needed > cache_ptr->max_cache_size) + space_needed = cache_ptr->max_cache_size; + + /* Note that space_needed is just the amount of space that + * needed to insert the new entry without exceeding the cache + * size limit. The subsequent call to H5C__make_space_in_cache() + * may evict the entries required to free more or less space + * depending on conditions. It MAY be less if the cache is + * currently undersized, or more if the cache is oversized. + * + * The cache can exceed its maximum size limit via the following + * mechanisms: + * + * First, it is possible for the cache to grow without + * bound as long as entries are protected and not unprotected. + * + * Second, when writes are not permitted it is also possible + * for the cache to grow without bound. + * + * Third, the user may choose to disable evictions -- causing + * the cache to grow without bound until evictions are + * re-enabled. + * + * Finally, we usually don't check to see if the cache is + * oversized at the end of an unprotect. As a result, it is + * possible to have a vastly oversized cache with no protected + * entries as long as all the protects precede the unprotects. + */ + if (H5C__make_space_in_cache(f, space_needed, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__make_space_in_cache failed"); + } /* end if */ + + /* Insert the entry in the hash table. + * + * ******************************************* + * + * Set the flush_me_last field + * of the newly loaded entry before inserting it into the + * index. Must do this, as the index tracked the number of + * entries with the flush_last field set, but assumes that + * the field will not change after insertion into the index. + * + * Note that this means that the H5C__FLUSH_LAST_FLAG flag + * is ignored if the entry is already in cache. + */ + entry_ptr->flush_me_last = flush_last; + + H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, NULL); + if (entry_ptr->is_dirty && !entry_ptr->in_slist) + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, NULL); + + /* insert the entry in the data structures used by the replacement + * policy. We are just going to take it out again when we update + * the replacement policy for a protect, but this simplifies the + * code. If we do this often enough, we may want to optimize this. + */ + H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, entry_ptr, NULL); + + /* Record that the entry was loaded, to trigger a notify callback later */ + /* (After the entry is fully added to the cache) */ + was_loaded = TRUE; + } /* end else */ + + assert(entry_ptr->addr == addr); + assert(entry_ptr->type == type); + + if (entry_ptr->is_protected) { + if (read_only && entry_ptr->is_read_only) { + assert(entry_ptr->ro_ref_count > 0); + (entry_ptr->ro_ref_count)++; + } /* end if */ + else + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Target already protected & not read only?!?"); + } /* end if */ + else { + H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, entry_ptr, NULL); + + entry_ptr->is_protected = TRUE; + if (read_only) { + entry_ptr->is_read_only = TRUE; + entry_ptr->ro_ref_count = 1; + } /* end if */ + entry_ptr->dirtied = FALSE; + } /* end else */ + + H5C__UPDATE_CACHE_HIT_RATE_STATS(cache_ptr, hit); + H5C__UPDATE_STATS_FOR_PROTECT(cache_ptr, entry_ptr, hit); + + ret_value = thing; + + if (cache_ptr->evictions_enabled && + (cache_ptr->size_decreased || + (cache_ptr->resize_enabled && (cache_ptr->cache_accesses >= cache_ptr->resize_ctl.epoch_length)))) { + + if (!have_write_permitted) { + if (cache_ptr->check_write_permitted != NULL) { + if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Can't get write_permitted"); + else + have_write_permitted = TRUE; + } + else { + write_permitted = cache_ptr->write_permitted; + have_write_permitted = TRUE; + } + } + + if (cache_ptr->resize_enabled && (cache_ptr->cache_accesses >= cache_ptr->resize_ctl.epoch_length)) + if (H5C__auto_adjust_cache_size(f, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "Cache auto-resize failed"); + + if (cache_ptr->size_decreased) { + cache_ptr->size_decreased = FALSE; + + /* check to see if the cache is now oversized due to the cache + * size reduction. If it is, try to evict enough entries to + * bring the cache size down to the current maximum cache size. + * + * Also, if the min_clean_size requirement is not met, we + * should also call H5C__make_space_in_cache() to bring us + * into compliance. + */ + if (cache_ptr->index_size >= cache_ptr->max_cache_size) + empty_space = 0; + else + empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; + + if ((cache_ptr->index_size > cache_ptr->max_cache_size) || + ((empty_space + cache_ptr->clean_index_size) < cache_ptr->min_clean_size)) { + + if (cache_ptr->index_size > cache_ptr->max_cache_size) + cache_ptr->cache_full = TRUE; + + if (H5C__make_space_in_cache(f, (size_t)0, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C__make_space_in_cache failed"); + } + } /* end if */ + } + + /* If we loaded the entry and the entry's type has a 'notify' callback, send + * an 'after load' notice now that the entry is fully integrated into + * the cache and protected. We must wait until it is protected so it is not + * evicted during the notify callback. + */ + if (was_loaded) + /* If the entry's type has a 'notify' callback send a 'after load' + * notice now that the entry is fully integrated into the cache. + */ + if (entry_ptr->type->notify && (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_LOAD, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, NULL, + "can't notify client about entry inserted into cache"); + +#ifdef H5_HAVE_PARALLEL + /* Make sure the size of the collective entries in the cache remain in check */ + if (coll_access) { + if (H5P_USER_TRUE == H5F_COLL_MD_READ(f)) { + if (cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) + if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries"); + } /* end if */ + else { + if (cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) + if (H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries"); + } /* end else */ + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + +done: +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_protect() */ + +/*------------------------------------------------------------------------- + * Function: H5C_unpin_entry() + * + * Purpose: Unpin a cache entry. The entry can be either protected or + * unprotected at the time of call, but must be pinned. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_unpin_entry(void *_entry_ptr) +{ + H5C_t *cache_ptr; + H5C_cache_entry_t *entry_ptr = (H5C_cache_entry_t *)_entry_ptr; /* Pointer to entry to unpin */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + assert(entry_ptr); + cache_ptr = entry_ptr->cache_ptr; + assert(cache_ptr); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + /* Unpin the entry */ + if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry from client"); + +done: +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_unpin_entry() */ + +/*------------------------------------------------------------------------- + * Function: H5C_unprotect + * + * Purpose: Undo an H5C_protect() call -- specifically, mark the + * entry as unprotected, remove it from the protected list, + * and give it back to the replacement policy. + * + * The TYPE and ADDR arguments must be the same as those in + * the corresponding call to H5C_protect() and the THING + * argument must be the value returned by that call to + * H5C_protect(). + * + * Return: Non-negative on success/Negative on failure + * + * If the deleted flag is TRUE, simply remove the target entry + * from the cache, clear it, and free it without writing it to + * disk. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_unprotect(H5F_t *f, haddr_t addr, void *thing, unsigned flags) +{ + H5C_t *cache_ptr; + hbool_t deleted; + hbool_t dirtied; + hbool_t set_flush_marker; + hbool_t pin_entry; + hbool_t unpin_entry; + hbool_t free_file_space; + hbool_t take_ownership; + hbool_t was_clean; +#ifdef H5_HAVE_PARALLEL + hbool_t clear_entry = FALSE; +#endif /* H5_HAVE_PARALLEL */ + H5C_cache_entry_t *entry_ptr; + H5C_cache_entry_t *test_entry_ptr; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + deleted = ((flags & H5C__DELETED_FLAG) != 0); + dirtied = ((flags & H5C__DIRTIED_FLAG) != 0); + set_flush_marker = ((flags & H5C__SET_FLUSH_MARKER_FLAG) != 0); + pin_entry = ((flags & H5C__PIN_ENTRY_FLAG) != 0); + unpin_entry = ((flags & H5C__UNPIN_ENTRY_FLAG) != 0); + free_file_space = ((flags & H5C__FREE_FILE_SPACE_FLAG) != 0); + take_ownership = ((flags & H5C__TAKE_OWNERSHIP_FLAG) != 0); + + assert(f); + assert(f->shared); + + cache_ptr = f->shared->cache; + + assert(cache_ptr); + assert(H5_addr_defined(addr)); + assert(thing); + assert(!(pin_entry && unpin_entry)); + + /* deleted flag must accompany free_file_space */ + assert((!free_file_space) || (deleted)); + + /* deleted flag must accompany take_ownership */ + assert((!take_ownership) || (deleted)); + + /* can't have both free_file_space & take_ownership */ + assert(!(free_file_space && take_ownership)); + + entry_ptr = (H5C_cache_entry_t *)thing; + assert(entry_ptr->addr == addr); + + /* also set the dirtied variable if the dirtied field is set in + * the entry. + */ + dirtied |= entry_ptr->dirtied; + was_clean = !(entry_ptr->is_dirty); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + /* if the entry has multiple read only protects, just decrement + * the ro_ref_counter. Don't actually unprotect until the ref count + * drops to zero. + */ + if (entry_ptr->ro_ref_count > 1) { + /* Sanity check */ + assert(entry_ptr->is_protected); + assert(entry_ptr->is_read_only); + + if (dirtied) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??"); + + /* Reduce the RO ref count */ + (entry_ptr->ro_ref_count)--; + + /* Pin or unpin the entry as requested. */ + if (pin_entry) { + /* Pin the entry from a client */ + if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client"); + } + else if (unpin_entry) { + /* Unpin the entry from a client */ + if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client"); + } /* end if */ + } + else { + if (entry_ptr->is_read_only) { + /* Sanity check */ + assert(entry_ptr->ro_ref_count == 1); + + if (dirtied) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Read only entry modified??"); + + entry_ptr->is_read_only = FALSE; + entry_ptr->ro_ref_count = 0; + } /* end if */ + +#ifdef H5_HAVE_PARALLEL + /* When the H5C code is used to implement the metadata cache in the + * PHDF5 case, only the cache on process 0 is allowed to write to file. + * All the other metadata caches must hold dirty entries until they + * are told that the entries are clean. + * + * The clear_on_unprotect flag in the H5C_cache_entry_t structure + * exists to deal with the case in which an entry is protected when + * its cache receives word that the entry is now clean. In this case, + * the clear_on_unprotect flag is set, and the entry is flushed with + * the H5C__FLUSH_CLEAR_ONLY_FLAG. + * + * All this is a bit awkward, but until the metadata cache entries + * are contiguous, with only one dirty flag, we have to let the supplied + * functions deal with the resetting the is_dirty flag. + */ + if (entry_ptr->clear_on_unprotect) { + /* Sanity check */ + assert(entry_ptr->is_dirty); + + entry_ptr->clear_on_unprotect = FALSE; + if (!dirtied) + clear_entry = TRUE; + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + + if (!entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Entry already unprotected??"); + + /* Mark the entry as dirty if appropriate */ + entry_ptr->is_dirty = (entry_ptr->is_dirty || dirtied); + if (dirtied && entry_ptr->image_up_to_date) { + entry_ptr->image_up_to_date = FALSE; + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_unserialized(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "Can't propagate serialization status to fd parents"); + } /* end if */ + + /* Check for newly dirtied entry */ + if (was_clean && entry_ptr->is_dirty) { + /* Update index for newly dirtied entry */ + H5C__UPDATE_INDEX_FOR_ENTRY_DIRTY(cache_ptr, entry_ptr, FAIL); + + /* If the entry's type has a 'notify' callback send a + * 'entry dirtied' notice now that the entry is fully + * integrated into the cache. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_DIRTIED, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify client about entry dirty flag set"); + + /* Propagate the flush dep dirty flag up the flush dependency chain + * if appropriate + */ + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_dirty(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag"); + } /* end if */ + /* Check for newly clean entry */ + else if (!was_clean && !entry_ptr->is_dirty) { + + /* If the entry's type has a 'notify' callback send a + * 'entry cleaned' notice now that the entry is fully + * integrated into the cache. + */ + if (entry_ptr->type->notify && + (entry_ptr->type->notify)(H5C_NOTIFY_ACTION_ENTRY_CLEANED, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify client about entry dirty flag cleared"); + + /* Propagate the flush dep clean flag up the flush dependency chain + * if appropriate + */ + if (entry_ptr->flush_dep_nparents > 0) + if (H5C__mark_flush_dep_clean(entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "Can't propagate flush dep dirty flag"); + } /* end else-if */ + + /* Pin or unpin the entry as requested. */ + if (pin_entry) { + /* Pin the entry from a client */ + if (H5C__pin_entry_from_client(cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "Can't pin entry by client"); + } + else if (unpin_entry) { + /* Unpin the entry from a client */ + if (H5C__unpin_entry_from_client(cache_ptr, entry_ptr, FALSE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry by client"); + } /* end if */ + + /* H5C__UPDATE_RP_FOR_UNPROTECT will place the unprotected entry on + * the pinned entry list if entry_ptr->is_pinned is TRUE. + */ + H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, entry_ptr, FAIL); + + entry_ptr->is_protected = FALSE; + + /* if the entry is dirty, 'or' its flush_marker with the set flush flag, + * and then add it to the skip list if it isn't there already. + */ + if (entry_ptr->is_dirty) { + entry_ptr->flush_marker |= set_flush_marker; + if (!entry_ptr->in_slist) + /* this is a no-op if cache_ptr->slist_enabled is FALSE */ + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + } /* end if */ + + /* This implementation of the "deleted" option is a bit inefficient, as + * we re-insert the entry to be deleted into the replacement policy + * data structures, only to remove them again. Depending on how often + * we do this, we may want to optimize a bit. + */ + if (deleted) { + unsigned flush_flags = (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__FLUSH_INVALIDATE_FLAG); + + /* verify that the target entry is in the cache. */ + H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL); + + if (test_entry_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?"); + else if (test_entry_ptr != entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, + "hash table contains multiple entries for addr?!?"); + + /* Set the 'free file space' flag for the flush, if needed */ + if (free_file_space) + flush_flags |= H5C__FREE_FILE_SPACE_FLAG; + + /* Set the "take ownership" flag for the flush, if needed */ + if (take_ownership) + flush_flags |= H5C__TAKE_OWNERSHIP_FLAG; + + /* Delete the entry from the skip list on destroy */ + flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; + + assert((!cache_ptr->slist_enabled) || (((!was_clean) || dirtied) == (entry_ptr->in_slist))); + + if (H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't flush entry"); + } /* end if */ +#ifdef H5_HAVE_PARALLEL + else if (clear_entry) { + /* Verify that the target entry is in the cache. */ + H5C__SEARCH_INDEX(cache_ptr, addr, test_entry_ptr, FAIL); + + if (test_entry_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "entry not in hash table?!?"); + else if (test_entry_ptr != entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, + "hash table contains multiple entries for addr?!?"); + + if (H5C__flush_single_entry(f, entry_ptr, + H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't clear entry"); + } /* end else if */ +#endif /* H5_HAVE_PARALLEL */ + } + + H5C__UPDATE_STATS_FOR_UNPROTECT(cache_ptr); + +done: +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_unprotect() */ + +/*------------------------------------------------------------------------- + * Function: H5C_unsettle_entry_ring + * + * Purpose: Advise the metadata cache that the specified entry's free space + * manager ring is no longer settled (if it was on entry). + * + * If the target free space manager ring is already + * unsettled, do nothing, and return SUCCEED. + * + * If the target free space manager ring is settled, and + * we are not in the process of a file shutdown, mark + * the ring as unsettled, and return SUCCEED. + * + * If the target free space manager is settled, and we + * are in the process of a file shutdown, post an error + * message, and return FAIL. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_unsettle_entry_ring(void *_entry) +{ + H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry whose ring to unsettle */ + H5C_t *cache; /* Cache for file */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(entry); + assert(entry->ring != H5C_RING_UNDEFINED); + assert((H5C_RING_USER == entry->ring) || (H5C_RING_RDFSM == entry->ring) || + (H5C_RING_MDFSM == entry->ring)); + cache = entry->cache_ptr; + assert(cache); + + switch (entry->ring) { + case H5C_RING_USER: + /* Do nothing */ + break; + + case H5C_RING_RDFSM: + if (cache->rdfsm_settled) { + if (cache->flush_in_progress || cache->close_warning_received) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected rdfsm ring unsettle"); + cache->rdfsm_settled = FALSE; + } /* end if */ + break; + + case H5C_RING_MDFSM: + if (cache->mdfsm_settled) { + if (cache->flush_in_progress || cache->close_warning_received) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unexpected mdfsm ring unsettle"); + cache->mdfsm_settled = FALSE; + } /* end if */ + break; + + default: + assert(FALSE); /* this should be un-reachable */ + break; + } /* end switch */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_unsettle_entry_ring() */ + +/*------------------------------------------------------------------------- + * Function: H5C_create_flush_dependency() + * + * Purpose: Initiates a parent<->child entry flush dependency. The parent + * entry must be pinned or protected at the time of call, and must + * have all dependencies removed before the cache can shut down. + * + * Note: Flush dependencies in the cache indicate that a child entry + * must be flushed to the file before its parent. (This is + * currently used to implement Single-Writer/Multiple-Reader (SWMR) + * I/O access for data structures in the file). + * + * Creating a flush dependency between two entries will also pin + * the parent entry. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_create_flush_dependency(void *parent_thing, void *child_thing) +{ + H5C_t *cache_ptr; + H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent thing's entry */ + H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child thing's entry */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(parent_entry); + assert(H5_addr_defined(parent_entry->addr)); + assert(child_entry); + assert(H5_addr_defined(child_entry->addr)); + cache_ptr = parent_entry->cache_ptr; + assert(cache_ptr); + assert(cache_ptr == child_entry->cache_ptr); +#ifndef NDEBUG + /* Make sure the parent is not already a parent */ + { + unsigned u; + + for (u = 0; u < child_entry->flush_dep_nparents; u++) + assert(child_entry->flush_dep_parent[u] != parent_entry); + } /* end block */ +#endif + + /* More sanity checks */ + if (child_entry == parent_entry) + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Child entry flush dependency parent can't be itself"); + if (!(parent_entry->is_protected || parent_entry->is_pinned)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Parent entry isn't pinned or protected"); + + /* Check for parent not pinned */ + if (!parent_entry->is_pinned) { + /* Sanity check */ + assert(parent_entry->flush_dep_nchildren == 0); + assert(!parent_entry->pinned_from_client); + assert(!parent_entry->pinned_from_cache); + + /* Pin the parent entry */ + parent_entry->is_pinned = TRUE; + H5C__UPDATE_STATS_FOR_PIN(cache_ptr, parent_entry); + } /* end else */ + + /* Mark the entry as pinned from the cache's action (possibly redundantly) */ + parent_entry->pinned_from_cache = TRUE; + + /* Check if we need to resize the child's parent array */ + if (child_entry->flush_dep_nparents >= child_entry->flush_dep_parent_nalloc) { + if (child_entry->flush_dep_parent_nalloc == 0) { + /* Array does not exist yet, allocate it */ + assert(!child_entry->flush_dep_parent); + + if (NULL == (child_entry->flush_dep_parent = + H5FL_SEQ_MALLOC(H5C_cache_entry_ptr_t, H5C_FLUSH_DEP_PARENT_INIT))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for flush dependency parent list"); + child_entry->flush_dep_parent_nalloc = H5C_FLUSH_DEP_PARENT_INIT; + } /* end if */ + else { + /* Resize existing array */ + assert(child_entry->flush_dep_parent); + + if (NULL == (child_entry->flush_dep_parent = + H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, + 2 * child_entry->flush_dep_parent_nalloc))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for flush dependency parent list"); + child_entry->flush_dep_parent_nalloc *= 2; + } /* end else */ + cache_ptr->entry_fd_height_change_counter++; + } /* end if */ + + /* Add the dependency to the child's parent array */ + child_entry->flush_dep_parent[child_entry->flush_dep_nparents] = parent_entry; + child_entry->flush_dep_nparents++; + + /* Increment parent's number of children */ + parent_entry->flush_dep_nchildren++; + + /* Adjust the number of dirty children */ + if (child_entry->is_dirty) { + /* Sanity check */ + assert(parent_entry->flush_dep_ndirty_children < parent_entry->flush_dep_nchildren); + + parent_entry->flush_dep_ndirty_children++; + + /* If the parent has a 'notify' callback, send a 'child entry dirtied' notice */ + if (parent_entry->type->notify && + (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_DIRTIED, parent_entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry dirty flag set"); + } /* end if */ + + /* adjust the parent's number of unserialized children. Note + * that it is possible for and entry to be clean and unserialized. + */ + if (!child_entry->image_up_to_date) { + assert(parent_entry->flush_dep_nunser_children < parent_entry->flush_dep_nchildren); + + parent_entry->flush_dep_nunser_children++; + + /* If the parent has a 'notify' callback, send a 'child entry unserialized' notice */ + if (parent_entry->type->notify && + (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_UNSERIALIZED, parent_entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry serialized flag reset"); + } /* end if */ + + /* Post-conditions, for successful operation */ + assert(parent_entry->is_pinned); + assert(parent_entry->flush_dep_nchildren > 0); + assert(child_entry->flush_dep_parent); + assert(child_entry->flush_dep_nparents > 0); + assert(child_entry->flush_dep_parent_nalloc > 0); +#ifndef NDEBUG + H5C__assert_flush_dep_nocycle(parent_entry, child_entry); +#endif + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_create_flush_dependency() */ + +/*------------------------------------------------------------------------- + * Function: H5C_destroy_flush_dependency() + * + * Purpose: Terminates a parent<-> child entry flush dependency. The + * parent entry must be pinned. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_destroy_flush_dependency(void *parent_thing, void *child_thing) +{ + H5C_t *cache_ptr; + H5C_cache_entry_t *parent_entry = (H5C_cache_entry_t *)parent_thing; /* Ptr to parent entry */ + H5C_cache_entry_t *child_entry = (H5C_cache_entry_t *)child_thing; /* Ptr to child entry */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(parent_entry); + assert(H5_addr_defined(parent_entry->addr)); + assert(child_entry); + assert(H5_addr_defined(child_entry->addr)); + cache_ptr = parent_entry->cache_ptr; + assert(cache_ptr); + assert(cache_ptr == child_entry->cache_ptr); + + /* Usage checks */ + if (!parent_entry->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "Parent entry isn't pinned"); + if (NULL == child_entry->flush_dep_parent) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, + "Child entry doesn't have a flush dependency parent array"); + if (0 == parent_entry->flush_dep_nchildren) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, + "Parent entry flush dependency ref. count has no child dependencies"); + + /* Search for parent in child's parent array. This is a linear search + * because we do not expect large numbers of parents. If this changes, we + * may wish to change the parent array to a skip list */ + for (u = 0; u < child_entry->flush_dep_nparents; u++) + if (child_entry->flush_dep_parent[u] == parent_entry) + break; + if (u == child_entry->flush_dep_nparents) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, + "Parent entry isn't a flush dependency parent for child entry"); + + /* Remove parent entry from child's parent array */ + if (u < (child_entry->flush_dep_nparents - 1)) + memmove(&child_entry->flush_dep_parent[u], &child_entry->flush_dep_parent[u + 1], + (child_entry->flush_dep_nparents - u - 1) * sizeof(child_entry->flush_dep_parent[0])); + child_entry->flush_dep_nparents--; + + /* Adjust parent entry's nchildren and unpin parent if it goes to zero */ + parent_entry->flush_dep_nchildren--; + if (0 == parent_entry->flush_dep_nchildren) { + /* Sanity check */ + assert(parent_entry->pinned_from_cache); + + /* Check if we should unpin parent entry now */ + if (!parent_entry->pinned_from_client) + if (H5C__unpin_entry_real(cache_ptr, parent_entry, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "Can't unpin entry"); + + /* Mark the entry as unpinned from the cache's action */ + parent_entry->pinned_from_cache = FALSE; + } /* end if */ + + /* Adjust parent entry's ndirty_children */ + if (child_entry->is_dirty) { + /* Sanity check */ + assert(parent_entry->flush_dep_ndirty_children > 0); + + parent_entry->flush_dep_ndirty_children--; + + /* If the parent has a 'notify' callback, send a 'child entry cleaned' notice */ + if (parent_entry->type->notify && + (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_CLEANED, parent_entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry dirty flag reset"); + } /* end if */ + + /* adjust parent entry's number of unserialized children */ + if (!child_entry->image_up_to_date) { + assert(parent_entry->flush_dep_nunser_children > 0); + + parent_entry->flush_dep_nunser_children--; + + /* If the parent has a 'notify' callback, send a 'child entry serialized' notice */ + if (parent_entry->type->notify && + (parent_entry->type->notify)(H5C_NOTIFY_ACTION_CHILD_SERIALIZED, parent_entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, + "can't notify parent about child entry serialized flag set"); + } /* end if */ + + /* Shrink or free the parent array if appropriate */ + if (child_entry->flush_dep_nparents == 0) { + child_entry->flush_dep_parent = H5FL_SEQ_FREE(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent); + child_entry->flush_dep_parent_nalloc = 0; + } /* end if */ + else if (child_entry->flush_dep_parent_nalloc > H5C_FLUSH_DEP_PARENT_INIT && + child_entry->flush_dep_nparents <= (child_entry->flush_dep_parent_nalloc / 4)) { + if (NULL == (child_entry->flush_dep_parent = + H5FL_SEQ_REALLOC(H5C_cache_entry_ptr_t, child_entry->flush_dep_parent, + child_entry->flush_dep_parent_nalloc / 4))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for flush dependency parent list"); + child_entry->flush_dep_parent_nalloc /= 4; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_destroy_flush_dependency() */ + +/*------------------------------------------------------------------------- + * Function: H5C_expunge_entry + * + * Purpose: Expunge an entry from the cache without writing it to disk + * even if it is dirty. The entry may not be either pinned or + * protected. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_expunge_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr, unsigned flags) +{ + H5C_t *cache_ptr; + H5C_cache_entry_t *entry_ptr = NULL; + unsigned flush_flags = (H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + assert(f); + assert(f->shared); + cache_ptr = f->shared->cache; + assert(cache_ptr); + assert(type); + assert(H5_addr_defined(addr)); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on entry"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + /* Look for entry in cache */ + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL); + if ((entry_ptr == NULL) || (entry_ptr->type != type)) + /* the target doesn't exist in the cache, so we are done. */ + HGOTO_DONE(SUCCEED); + + assert(entry_ptr->addr == addr); + assert(entry_ptr->type == type); + + /* Check for entry being pinned or protected */ + if (entry_ptr->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is protected"); + if (entry_ptr->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is pinned"); + + /* If we get this far, call H5C__flush_single_entry() with the + * H5C__FLUSH_INVALIDATE_FLAG and the H5C__FLUSH_CLEAR_ONLY_FLAG. + * This will clear the entry, and then delete it from the cache. + */ + + /* Pass along 'free file space' flag */ + flush_flags |= (flags & H5C__FREE_FILE_SPACE_FLAG); + + /* Delete the entry from the skip list on destroy */ + flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; + + if (H5C__flush_single_entry(f, entry_ptr, flush_flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "can't flush entry"); + +done: +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_lru_list(cache_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "LRU extreme sanity check failed on exit"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_expunge_entry() */ + +/*------------------------------------------------------------------------- + * Function: H5C_remove_entry + * + * Purpose: Remove an entry from the cache. Must be not protected, pinned, + * dirty, involved in flush dependencies, etc. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_remove_entry(void *_entry) +{ + H5C_cache_entry_t *entry = (H5C_cache_entry_t *)_entry; /* Entry to remove */ + H5C_t *cache; /* Cache for file */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(entry); + assert(entry->ring != H5C_RING_UNDEFINED); + cache = entry->cache_ptr; + assert(cache); + + /* Check for error conditions */ + if (entry->is_dirty) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove dirty entry from cache"); + if (entry->is_protected) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove protected entry from cache"); + if (entry->is_pinned) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove pinned entry from cache"); + /* NOTE: If these two errors are getting tripped because the entry is + * in a flush dependency with a freedspace entry, move the checks + * after the "before evict" message is sent, and add the + * "child being evicted" message to the "before evict" notify + * section below. QAK - 2017/08/03 + */ + if (entry->flush_dep_nparents > 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, + "can't remove entry with flush dependency parents from cache"); + if (entry->flush_dep_nchildren > 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, + "can't remove entry with flush dependency children from cache"); + + /* Additional internal cache consistency checks */ + assert(!entry->in_slist); + assert(!entry->flush_marker); + assert(!entry->flush_in_progress); + + /* Note that the algorithm below is (very) similar to the set of operations + * in H5C__flush_single_entry() and should be kept in sync with changes + * to that code. - QAK, 2016/11/30 + */ + + /* Update stats, as if we are "destroying" and taking ownership of the entry */ + H5C__UPDATE_STATS_FOR_EVICTION(cache, entry, TRUE); + + /* If the entry's type has a 'notify' callback, send a 'before eviction' + * notice while the entry is still fully integrated in the cache. + */ + if (entry->type->notify && (entry->type->notify)(H5C_NOTIFY_ACTION_BEFORE_EVICT, entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry to evict"); + + /* Update the cache internal data structures as appropriate for a destroy. + * Specifically: + * 1) Delete it from the index + * 2) Delete it from the collective read access list + * 3) Update the replacement policy for eviction + * 4) Remove it from the tag list for this object + */ + + H5C__DELETE_FROM_INDEX(cache, entry, FAIL); + +#ifdef H5_HAVE_PARALLEL + /* Check for collective read access flag */ + if (entry->coll_access) { + entry->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache, entry, FAIL); + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + + H5C__UPDATE_RP_FOR_EVICTION(cache, entry, FAIL); + + /* Remove entry from tag list */ + if (H5C__untag_entry(cache, entry) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry from tag list"); + + /* Increment entries_removed_counter and set last_entry_removed_ptr. + * As we me be about to free the entry, recall that last_entry_removed_ptr + * must NEVER be dereferenced. + * + * Recall that these fields are maintained to allow functions that perform + * scans of lists of entries to detect the unexpected removal of entries + * (via expunge, eviction, or take ownership at present), so that they can + * re-start their scans if necessary. + * + * Also check if the entry we are watching for removal is being + * removed (usually the 'next' entry for an iteration) and reset + * it to indicate that it was removed. + */ + cache->entries_removed_counter++; + cache->last_entry_removed_ptr = entry; + if (entry == cache->entry_watched_for_removal) + cache->entry_watched_for_removal = NULL; + + /* Internal cache data structures should now be up to date, and + * consistent with the status of the entry. + * + * Now clean up internal cache fields if appropriate. + */ + + /* Free the buffer for the on disk image */ + if (entry->image_ptr != NULL) + entry->image_ptr = H5MM_xfree(entry->image_ptr); + + /* Reset the pointer to the cache the entry is within */ + entry->cache_ptr = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__remove_entry() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Cepoch.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Cepoch.c index 09faf98e40..ed161e8de6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Cepoch.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Cepoch.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,19 +13,26 @@ /*------------------------------------------------------------------------- * * Created: H5Cepoch.c - * June 5 2004 - * Quincey Koziol * - * Purpose: Metadata cache epoch callbacks. + * Purpose: Metadata cache epoch callbacks * *------------------------------------------------------------------------- */ +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ + /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata Cache */ +#include "H5Cpkg.h" /* Cache */ +#include "H5Eprivate.h" /* Error Handling */ +#include "H5Fprivate.h" /* Files */ /****************/ /* Local Macros */ @@ -46,7 +52,7 @@ * * As a strategy for automatic cache size reduction, the cache may insert * marker entries in the LRU list at the end of each epoch. These markers - * are then used to identify entries that have not been accessed for n + * are then used to identify entries that have not been accessed for 'n' * epochs so that they can be evicted from the cache. * ****************************************************************************/ @@ -99,7 +105,6 @@ const H5AC_class_t H5AC_EPOCH_MARKER[1] = { * * None of these functions should ever be called, so there is no point in * documenting them separately. - * JRM - 11/16/04 * ***************************************************************************/ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Cimage.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Cimage.c index da4ac33a80..87df542bde 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Cimage.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Cimage.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Cimage.c - * July 20, 2015 - * John Mainzer * * Purpose: Functions in this file are specific to the implementation * of the metadata cache image feature. @@ -74,13 +71,43 @@ #define H5C__MDCI_MAX_FD_CHILDREN USHRT_MAX #define H5C__MDCI_MAX_FD_PARENTS USHRT_MAX -/* Values for image entry magic field */ -#define H5C_IMAGE_ENTRY_T_MAGIC 0x005CAC08 -#define H5C_IMAGE_ENTRY_T_BAD_MAGIC 0xBeefDead - /* Maximum ring allowed in image */ #define H5C_MAX_RING_IN_IMAGE H5C_RING_MDFSM +/*********************************************************************** + * + * Stats collection macros + * + * The following macros must handle stats collection when collection + * is enabled, and evaluate to the empty string when it is not. + * + ***********************************************************************/ +#if H5C_COLLECT_CACHE_STATS +/* clang-format off */ +#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr) \ +do { \ + (cache_ptr)->images_created++; \ +} while (0) +#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr) \ +do { \ + /* make sure image len is still good */ \ + assert((cache_ptr)->image_len > 0); \ + (cache_ptr)->images_read++; \ +} while (0) +#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) \ +do { \ + /* make sure image len is still good */ \ + assert((cache_ptr)->image_len > 0); \ + (cache_ptr)->images_loaded++; \ + (cache_ptr)->last_image_size = (cache_ptr)->image_len; \ +} while (0) +/* clang-format on */ +#else /* H5C_COLLECT_CACHE_STATS */ +#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr) +#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr) +#define H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) +#endif /* H5C_COLLECT_CACHE_STATS */ + /******************/ /* Local Typedefs */ /******************/ @@ -96,9 +123,7 @@ static herr_t H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, c #ifndef NDEBUG /* only used in assertions */ static herr_t H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint8_t **buf, unsigned entry_num); -#endif /* NDEBUG */ /* only used in assertions */ -static herr_t H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr, H5C_cache_entry_t *pf_entry_ptr, - H5C_cache_entry_t **fd_children); +#endif static herr_t H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, uint8_t **buf); static herr_t H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigned entry_num); static herr_t H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr); @@ -130,7 +155,6 @@ H5FL_DEFINE(H5C_cache_entry_t); /*******************/ /*------------------------------------------------------------------------- - * * Function: H5C_cache_image_pending() * * Purpose: Tests to see if the load of a metadata cache image @@ -142,8 +166,6 @@ H5FL_DEFINE(H5C_cache_entry_t); * * Return: TRUE if a cache image load is pending, and FALSE otherwise. * - * Programmer: John Mainzer, 6/18/16 - * *------------------------------------------------------------------------- */ hbool_t @@ -154,8 +176,7 @@ H5C_cache_image_pending(const H5C_t *cache_ptr) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); ret_value = (cache_ptr->load_image && !cache_ptr->image_loaded); @@ -179,9 +200,6 @@ H5C_cache_image_pending(const H5C_t *cache_ptr) * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 12/29/16 - * *------------------------------------------------------------------------- */ herr_t @@ -192,13 +210,12 @@ H5C_cache_image_status(H5F_t *f, hbool_t *load_ci_ptr, hbool_t *write_ci_ptr) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(load_ci_ptr); - HDassert(write_ci_ptr); + assert(cache_ptr); + assert(load_ci_ptr); + assert(write_ci_ptr); *load_ci_ptr = cache_ptr->load_image || cache_ptr->image_loaded; *write_ci_ptr = cache_ptr->image_ctl.generate_image; @@ -217,9 +234,6 @@ H5C_cache_image_status(H5F_t *f, hbool_t *load_ci_ptr, hbool_t *write_ci_ptr) * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 8/5/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -233,33 +247,32 @@ H5C__construct_cache_image_buffer(H5F_t *f, H5C_t *cache_ptr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(cache_ptr == f->shared->cache); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->close_warning_received); - HDassert(cache_ptr->image_ctl.generate_image); - HDassert(cache_ptr->num_entries_in_image > 0); - HDassert(cache_ptr->index_len == 0); - HDassert(cache_ptr->image_data_len > 0); - HDassert(cache_ptr->image_data_len <= cache_ptr->image_len); + assert(f); + assert(f->shared); + assert(cache_ptr == f->shared->cache); + assert(cache_ptr); + assert(cache_ptr->close_warning_received); + assert(cache_ptr->image_ctl.generate_image); + assert(cache_ptr->num_entries_in_image > 0); + assert(cache_ptr->index_len == 0); + assert(cache_ptr->image_data_len > 0); + assert(cache_ptr->image_data_len <= cache_ptr->image_len); /* Allocate the buffer in which to construct the cache image block */ if (NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer"); /* Construct the cache image block header image */ p = (uint8_t *)cache_ptr->image_buffer; if (H5C__encode_cache_image_header(f, cache_ptr, &p) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTENCODE, FAIL, "header image construction failed") - HDassert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_data_len); + HGOTO_ERROR(H5E_CACHE, H5E_CANTENCODE, FAIL, "header image construction failed"); + assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_data_len); /* Construct the cache entry images */ for (u = 0; u < cache_ptr->num_entries_in_image; u++) if (H5C__encode_cache_image_entry(f, cache_ptr, &p, u) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTENCODE, FAIL, "entry image construction failed") - HDassert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_data_len); + HGOTO_ERROR(H5E_CACHE, H5E_CANTENCODE, FAIL, "entry image construction failed"); + assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_data_len); /* Construct the adaptive resize status image -- not yet */ @@ -267,8 +280,8 @@ H5C__construct_cache_image_buffer(H5F_t *f, H5C_t *cache_ptr) chksum = H5_checksum_metadata(cache_ptr->image_buffer, (size_t)(cache_ptr->image_data_len - H5F_SIZEOF_CHKSUM), 0); UINT32ENCODE(p, chksum); - HDassert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) == cache_ptr->image_data_len); - HDassert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) <= cache_ptr->image_len); + assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) == cache_ptr->image_data_len); + assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) <= cache_ptr->image_len); #ifndef NDEBUG /* validate the metadata cache image we just constructed by decoding it @@ -282,87 +295,84 @@ H5C__construct_cache_image_buffer(H5F_t *f, H5C_t *cache_ptr) herr_t status; /* Status from decoding */ fake_cache_ptr = (H5C_t *)H5MM_malloc(sizeof(H5C_t)); - HDassert(fake_cache_ptr); - fake_cache_ptr->magic = H5C__H5C_T_MAGIC; + assert(fake_cache_ptr); /* needed for sanity checks */ fake_cache_ptr->image_len = cache_ptr->image_len; q = (const uint8_t *)cache_ptr->image_buffer; status = H5C__decode_cache_image_header(f, fake_cache_ptr, &q); - HDassert(status >= 0); + assert(status >= 0); - HDassert(NULL != p); - HDassert(fake_cache_ptr->num_entries_in_image == cache_ptr->num_entries_in_image); + assert(NULL != p); + assert(fake_cache_ptr->num_entries_in_image == cache_ptr->num_entries_in_image); fake_cache_ptr->image_entries = (H5C_image_entry_t *)H5MM_malloc( sizeof(H5C_image_entry_t) * (size_t)(fake_cache_ptr->num_entries_in_image + 1)); - HDassert(fake_cache_ptr->image_entries); + assert(fake_cache_ptr->image_entries); for (u = 0; u < fake_cache_ptr->num_entries_in_image; u++) { - (fake_cache_ptr->image_entries)[u].magic = H5C_IMAGE_ENTRY_T_MAGIC; - (fake_cache_ptr->image_entries)[u].image_ptr = NULL; + fake_cache_ptr->image_entries[u].image_ptr = NULL; /* touch up f->shared->cache to satisfy sanity checks... */ f->shared->cache = fake_cache_ptr; status = H5C__decode_cache_image_entry(f, fake_cache_ptr, &q, u); - HDassert(status >= 0); + assert(status >= 0); /* ...and then return f->shared->cache to its correct value */ f->shared->cache = cache_ptr; /* verify expected contents */ - HDassert((cache_ptr->image_entries)[u].addr == (fake_cache_ptr->image_entries)[u].addr); - HDassert((cache_ptr->image_entries)[u].size == (fake_cache_ptr->image_entries)[u].size); - HDassert((cache_ptr->image_entries)[u].type_id == (fake_cache_ptr->image_entries)[u].type_id); - HDassert((cache_ptr->image_entries)[u].lru_rank == (fake_cache_ptr->image_entries)[u].lru_rank); - HDassert((cache_ptr->image_entries)[u].is_dirty == (fake_cache_ptr->image_entries)[u].is_dirty); + assert(cache_ptr->image_entries[u].addr == fake_cache_ptr->image_entries[u].addr); + assert(cache_ptr->image_entries[u].size == fake_cache_ptr->image_entries[u].size); + assert(cache_ptr->image_entries[u].type_id == fake_cache_ptr->image_entries[u].type_id); + assert(cache_ptr->image_entries[u].lru_rank == fake_cache_ptr->image_entries[u].lru_rank); + assert(cache_ptr->image_entries[u].is_dirty == fake_cache_ptr->image_entries[u].is_dirty); /* don't check image_fd_height as it is not stored in * the metadata cache image block. */ - HDassert((cache_ptr->image_entries)[u].fd_child_count == - (fake_cache_ptr->image_entries)[u].fd_child_count); - HDassert((cache_ptr->image_entries)[u].fd_dirty_child_count == - (fake_cache_ptr->image_entries)[u].fd_dirty_child_count); - HDassert((cache_ptr->image_entries)[u].fd_parent_count == - (fake_cache_ptr->image_entries)[u].fd_parent_count); + assert(cache_ptr->image_entries[u].fd_child_count == + fake_cache_ptr->image_entries[u].fd_child_count); + assert(cache_ptr->image_entries[u].fd_dirty_child_count == + fake_cache_ptr->image_entries[u].fd_dirty_child_count); + assert(cache_ptr->image_entries[u].fd_parent_count == + fake_cache_ptr->image_entries[u].fd_parent_count); - for (v = 0; v < (cache_ptr->image_entries)[u].fd_parent_count; v++) - HDassert((cache_ptr->image_entries)[u].fd_parent_addrs[v] == - (fake_cache_ptr->image_entries)[u].fd_parent_addrs[v]); + for (v = 0; v < cache_ptr->image_entries[u].fd_parent_count; v++) + assert(cache_ptr->image_entries[u].fd_parent_addrs[v] == + fake_cache_ptr->image_entries[u].fd_parent_addrs[v]); /* free the fd_parent_addrs array if it exists */ - if ((fake_cache_ptr->image_entries)[u].fd_parent_addrs) { - HDassert((fake_cache_ptr->image_entries)[u].fd_parent_count > 0); - (fake_cache_ptr->image_entries)[u].fd_parent_addrs = - (haddr_t *)H5MM_xfree((fake_cache_ptr->image_entries)[u].fd_parent_addrs); - (fake_cache_ptr->image_entries)[u].fd_parent_count = 0; + if (fake_cache_ptr->image_entries[u].fd_parent_addrs) { + assert(fake_cache_ptr->image_entries[u].fd_parent_count > 0); + fake_cache_ptr->image_entries[u].fd_parent_addrs = + (haddr_t *)H5MM_xfree(fake_cache_ptr->image_entries[u].fd_parent_addrs); + fake_cache_ptr->image_entries[u].fd_parent_count = 0; } /* end if */ else - HDassert((fake_cache_ptr->image_entries)[u].fd_parent_count == 0); + assert(fake_cache_ptr->image_entries[u].fd_parent_count == 0); - HDassert((cache_ptr->image_entries)[u].image_ptr); - HDassert((fake_cache_ptr->image_entries)[u].image_ptr); - HDassert(!HDmemcmp((cache_ptr->image_entries)[u].image_ptr, - (fake_cache_ptr->image_entries)[u].image_ptr, - (cache_ptr->image_entries)[u].size)); + assert(cache_ptr->image_entries[u].image_ptr); + assert(fake_cache_ptr->image_entries[u].image_ptr); + assert(!memcmp(cache_ptr->image_entries[u].image_ptr, fake_cache_ptr->image_entries[u].image_ptr, + cache_ptr->image_entries[u].size)); - (fake_cache_ptr->image_entries)[u].image_ptr = - H5MM_xfree((fake_cache_ptr->image_entries)[u].image_ptr); + fake_cache_ptr->image_entries[u].image_ptr = + H5MM_xfree(fake_cache_ptr->image_entries[u].image_ptr); } /* end for */ - HDassert((size_t)(q - (const uint8_t *)cache_ptr->image_buffer) == - cache_ptr->image_data_len - H5F_SIZEOF_CHKSUM); + assert((size_t)(q - (const uint8_t *)cache_ptr->image_buffer) == + cache_ptr->image_data_len - H5F_SIZEOF_CHKSUM); /* compute the checksum */ old_chksum = chksum; chksum = H5_checksum_metadata(cache_ptr->image_buffer, (size_t)(cache_ptr->image_data_len - H5F_SIZEOF_CHKSUM), 0); - HDassert(chksum == old_chksum); + assert(chksum == old_chksum); fake_cache_ptr->image_entries = (H5C_image_entry_t *)H5MM_xfree(fake_cache_ptr->image_entries); fake_cache_ptr = (H5C_t *)H5MM_xfree(fake_cache_ptr); - } /* end block */ -#endif /* NDEBUG */ + } /* end block */ +#endif done: FUNC_LEAVE_NOAPI(ret_value) @@ -376,9 +386,6 @@ H5C__construct_cache_image_buffer(H5F_t *f, H5C_t *cache_ptr) * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: Quincey Koziol - * 1/26/17 - * *------------------------------------------------------------------------- */ herr_t @@ -389,411 +396,35 @@ H5C__generate_cache_image(H5F_t *f, H5C_t *cache_ptr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(cache_ptr == f->shared->cache); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(f); + assert(f->shared); + assert(cache_ptr == f->shared->cache); + assert(cache_ptr); /* Construct cache image */ if (H5C__construct_cache_image_buffer(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't create metadata cache image") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't create metadata cache image"); /* Free image entries array */ if (H5C__free_image_entries_array(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't free image entries array") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't free image entries array"); /* Write cache image block if so configured */ if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK) { if (H5C__write_cache_image(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write metadata cache image block to file") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't write metadata cache image block to file"); H5C__UPDATE_STATS_FOR_CACHE_IMAGE_CREATE(cache_ptr); } /* end if */ /* Free cache image buffer */ - HDassert(cache_ptr->image_buffer); + assert(cache_ptr->image_buffer); cache_ptr->image_buffer = H5MM_xfree(cache_ptr->image_buffer); done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__generate_cache_image() */ -/*------------------------------------------------------------------------- - * Function: H5C__deserialize_prefetched_entry() - * - * Purpose: Deserialize the supplied prefetched entry entry, and return - * a pointer to the deserialized entry in *entry_ptr_ptr. - * If successful, remove the prefetched entry from the cache, - * and free it. Insert the deserialized entry into the cache. - * - * Note that the on disk image of the entry is not freed -- - * a pointer to it is stored in the deserialized entries' - * image_ptr field, and its image_up_to_date field is set to - * TRUE unless the entry is dirtied by the deserialize call. - * - * If the prefetched entry is a flush dependency child, - * destroy that flush dependency prior to calling the - * deserialize callback. If appropriate, the flush dependency - * relationship will be recreated by the cache client. - * - * If the prefetched entry is a flush dependency parent, - * destroy the flush dependency relationship with all its - * children. As all these children must be prefetched entries, - * recreate these flush dependency relationships with - * deserialized entry after it is inserted in the cache. - * - * Since deserializing a prefetched entry is semantically - * equivalent to a load, issue an entry loaded nofification - * if the notify callback is defined. - * - * Return: SUCCEED on success, and FAIL on failure. - * - * Note that *entry_ptr_ptr is undefined on failure. - * - * Programmer: John Mainzer, 8/10/15 - * - * Changes: Updated sanity checks for possibility that the slist - * is disabled. - * JRM -- 5/17/20 - * - *------------------------------------------------------------------------- - */ -herr_t -H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t **entry_ptr_ptr, - const H5C_class_t *type, haddr_t addr, void *udata) -{ - hbool_t dirty = FALSE; /* Flag indicating whether thing was - * dirtied during deserialize - */ - size_t len; /* Size of image in file */ - void *thing = NULL; /* Pointer to thing loaded */ - H5C_cache_entry_t *pf_entry_ptr; /* pointer to the prefetched entry */ - /* supplied in *entry_ptr_ptr. */ - H5C_cache_entry_t *ds_entry_ptr; /* Alias for thing loaded, as cache - * entry - */ - H5C_cache_entry_t **fd_children = NULL; /* Pointer to a dynamically */ - /* allocated array of pointers to */ - /* the flush dependency children of */ - /* the prefetched entry, or NULL if */ - /* that array does not exist. */ - unsigned flush_flags = (H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG); - int i; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); - HDassert(f->shared->cache == cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(entry_ptr_ptr); - HDassert(*entry_ptr_ptr); - pf_entry_ptr = *entry_ptr_ptr; - HDassert(pf_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(pf_entry_ptr->type); - HDassert(pf_entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); - HDassert(pf_entry_ptr->prefetched); - HDassert(pf_entry_ptr->image_up_to_date); - HDassert(pf_entry_ptr->image_ptr); - HDassert(pf_entry_ptr->size > 0); - HDassert(pf_entry_ptr->addr == addr); - HDassert(type); - HDassert(type->id == pf_entry_ptr->prefetch_type_id); - HDassert(type->mem_type == cache_ptr->class_table_ptr[type->id]->mem_type); - - /* verify absence of prohibited or unsupported type flag combinations */ - HDassert(!(type->flags & H5C__CLASS_SKIP_READS)); - - /* Can't see how skip reads could be usefully combined with - * either the speculative read flag. Hence disallow. - */ - HDassert(!((type->flags & H5C__CLASS_SKIP_READS) && (type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG))); - HDassert(H5F_addr_defined(addr)); - HDassert(type->get_initial_load_size); - HDassert(type->deserialize); - - /* if *pf_entry_ptr is a flush dependency child, destroy all such - * relationships now. The client will restore the relationship(s) with - * the deserialized entry if appropriate. - */ - HDassert(pf_entry_ptr->fd_parent_count == pf_entry_ptr->flush_dep_nparents); - for (i = (int)(pf_entry_ptr->fd_parent_count) - 1; i >= 0; i--) { - HDassert(pf_entry_ptr->flush_dep_parent); - HDassert(pf_entry_ptr->flush_dep_parent[i]); - HDassert(pf_entry_ptr->flush_dep_parent[i]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(pf_entry_ptr->flush_dep_parent[i]->flush_dep_nchildren > 0); - HDassert(pf_entry_ptr->fd_parent_addrs); - HDassert(pf_entry_ptr->flush_dep_parent[i]->addr == pf_entry_ptr->fd_parent_addrs[i]); - - if (H5C_destroy_flush_dependency(pf_entry_ptr->flush_dep_parent[i], pf_entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "can't destroy pf entry parent flush dependency") - - pf_entry_ptr->fd_parent_addrs[i] = HADDR_UNDEF; - } /* end for */ - HDassert(pf_entry_ptr->flush_dep_nparents == 0); - - /* If *pf_entry_ptr is a flush dependency parent, destroy its flush - * dependency relationships with all its children (which must be - * prefetched entries as well). - * - * These flush dependency relationships will have to be restored - * after the deserialized entry is inserted into the cache in order - * to transfer these relationships to the new entry. Hence save the - * pointers to the flush dependency children of *pf_enty_ptr for later - * use. - */ - if (pf_entry_ptr->fd_child_count > 0) { - if (NULL == (fd_children = (H5C_cache_entry_t **)H5MM_calloc( - sizeof(H5C_cache_entry_t **) * (size_t)(pf_entry_ptr->fd_child_count + 1)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for fd child ptr array") - - if (H5C__destroy_pf_entry_child_flush_deps(cache_ptr, pf_entry_ptr, fd_children) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, - "can't destroy pf entry child flush dependency(s).") - } /* end if */ - - /* Since the size of the on disk image is known exactly, there is - * no need for either a call to the get_initial_load_size() callback, - * or retries if the H5C__CLASS_SPECULATIVE_LOAD_FLAG flag is set. - * Similarly, there is no need to clamp possible reads beyond - * EOF. - */ - len = pf_entry_ptr->size; - - /* Deserialize the prefetched on-disk image of the entry into the - * native memory form - */ - if (NULL == (thing = type->deserialize(pf_entry_ptr->image_ptr, len, udata, &dirty))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "Can't deserialize image") - ds_entry_ptr = (H5C_cache_entry_t *)thing; - - /* In general, an entry should be clean just after it is loaded. - * - * However, when this code is used in the metadata cache, it is - * possible that object headers will be dirty at this point, as - * the deserialize function will alter object headers if necessary to - * fix an old bug. - * - * In the following assert: - * - * HDassert( ( dirty == FALSE ) || ( type->id == 5 || type->id == 6 ) ); - * - * note that type ids 5 & 6 are associated with object headers in the - * metadata cache. - * - * When we get to using H5C for other purposes, we may wish to - * tighten up the assert so that the loophole only applies to the - * metadata cache. - * - * Note that at present, dirty can't be set to true with prefetched - * entries. However this may change, so include this functionality - * against that possibility. - * - * Also, note that it is possible for a prefetched entry to be dirty -- - * hence the value assigned to ds_entry_ptr->is_dirty below. - */ - - HDassert((dirty == FALSE) || (type->id == 5 || type->id == 6)); - - ds_entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; - ds_entry_ptr->cache_ptr = f->shared->cache; - ds_entry_ptr->addr = addr; - ds_entry_ptr->size = len; - HDassert(ds_entry_ptr->size < H5C_MAX_ENTRY_SIZE); - ds_entry_ptr->image_ptr = pf_entry_ptr->image_ptr; - ds_entry_ptr->image_up_to_date = !dirty; - ds_entry_ptr->type = type; - ds_entry_ptr->is_dirty = dirty | pf_entry_ptr->is_dirty; - ds_entry_ptr->dirtied = FALSE; - ds_entry_ptr->is_protected = FALSE; - ds_entry_ptr->is_read_only = FALSE; - ds_entry_ptr->ro_ref_count = 0; - ds_entry_ptr->is_pinned = FALSE; - ds_entry_ptr->in_slist = FALSE; - ds_entry_ptr->flush_marker = FALSE; -#ifdef H5_HAVE_PARALLEL - ds_entry_ptr->clear_on_unprotect = FALSE; - ds_entry_ptr->flush_immediately = FALSE; - ds_entry_ptr->coll_access = FALSE; -#endif /* H5_HAVE_PARALLEL */ - ds_entry_ptr->flush_in_progress = FALSE; - ds_entry_ptr->destroy_in_progress = FALSE; - - ds_entry_ptr->ring = pf_entry_ptr->ring; - - /* Initialize flush dependency height fields */ - ds_entry_ptr->flush_dep_parent = NULL; - ds_entry_ptr->flush_dep_nparents = 0; - ds_entry_ptr->flush_dep_parent_nalloc = 0; - ds_entry_ptr->flush_dep_nchildren = 0; - ds_entry_ptr->flush_dep_ndirty_children = 0; - ds_entry_ptr->flush_dep_nunser_children = 0; - - /* Initialize fields supporting the hash table: */ - ds_entry_ptr->ht_next = NULL; - ds_entry_ptr->ht_prev = NULL; - ds_entry_ptr->il_next = NULL; - ds_entry_ptr->il_prev = NULL; - - /* Initialize fields supporting replacement policies: */ - ds_entry_ptr->next = NULL; - ds_entry_ptr->prev = NULL; -#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - ds_entry_ptr->aux_next = NULL; - ds_entry_ptr->aux_prev = NULL; -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ -#ifdef H5_HAVE_PARALLEL - pf_entry_ptr->coll_next = NULL; - pf_entry_ptr->coll_prev = NULL; -#endif /* H5_HAVE_PARALLEL */ - - /* Initialize cache image related fields */ - ds_entry_ptr->include_in_image = FALSE; - ds_entry_ptr->lru_rank = 0; - ds_entry_ptr->image_dirty = FALSE; - ds_entry_ptr->fd_parent_count = 0; - ds_entry_ptr->fd_parent_addrs = NULL; - ds_entry_ptr->fd_child_count = pf_entry_ptr->fd_child_count; - ds_entry_ptr->fd_dirty_child_count = 0; - ds_entry_ptr->image_fd_height = 0; - ds_entry_ptr->prefetched = FALSE; - ds_entry_ptr->prefetch_type_id = 0; - ds_entry_ptr->age = 0; - ds_entry_ptr->prefetched_dirty = pf_entry_ptr->prefetched_dirty; -#ifndef NDEBUG /* debugging field */ - ds_entry_ptr->serialization_count = 0; -#endif /* NDEBUG */ - - H5C__RESET_CACHE_ENTRY_STATS(ds_entry_ptr); - - /* Apply to to the newly deserialized entry */ - if (H5C__tag_entry(cache_ptr, ds_entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "Cannot tag metadata entry") - - /* We have successfully deserialized the prefetched entry. - * - * Before we return a pointer to the deserialized entry, we must remove - * the prefetched entry from the cache, discard it, and replace it with - * the deserialized entry. Note that we do not free the prefetched - * entries image, as that has been transferred to the deserialized - * entry. - * - * Also note that we have not yet restored any flush dependencies. This - * must wait until the deserialized entry is inserted in the cache. - * - * To delete the prefetched entry from the cache: - * - * 1) Set pf_entry_ptr->image_ptr to NULL. Since we have already - * transferred the buffer containing the image to *ds_entry_ptr, - * this is not a memory leak. - * - * 2) Call H5C__flush_single_entry() with the H5C__FLUSH_INVALIDATE_FLAG - * and H5C__FLUSH_CLEAR_ONLY_FLAG flags set. - */ - pf_entry_ptr->image_ptr = NULL; - - if (pf_entry_ptr->is_dirty) { - - HDassert(((cache_ptr->slist_enabled) && (pf_entry_ptr->in_slist)) || - ((!cache_ptr->slist_enabled) && (!pf_entry_ptr->in_slist))); - - flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; - - } /* end if */ - - if (H5C__flush_single_entry(f, pf_entry_ptr, flush_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "can't expunge prefetched entry") - -#ifndef NDEGUG /* verify deletion */ - H5C__SEARCH_INDEX(cache_ptr, addr, pf_entry_ptr, FAIL); - - HDassert(NULL == pf_entry_ptr); -#endif /* NDEBUG */ - - /* Insert the deserialized entry into the cache. */ - H5C__INSERT_IN_INDEX(cache_ptr, ds_entry_ptr, FAIL) - - HDassert(!ds_entry_ptr->in_slist); - if (ds_entry_ptr->is_dirty) - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, ds_entry_ptr, FAIL) - - H5C__UPDATE_RP_FOR_INSERTION(cache_ptr, ds_entry_ptr, FAIL) - - /* Deserializing a prefetched entry is the conceptual equivalent of - * loading it from file. If the deserialized entry has a notify callback, - * send an "after load" notice now that the deserialized entry is fully - * integrated into the cache. - */ - if (ds_entry_ptr->type->notify && - (ds_entry_ptr->type->notify)(H5C_NOTIFY_ACTION_AFTER_LOAD, ds_entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTNOTIFY, FAIL, "can't notify client about entry loaded into cache") - - /* Restore flush dependencies with the flush dependency children of - * of the prefetched entry. Note that we must protect *ds_entry_ptr - * before the call to avoid triggering sanity check failures, and - * then unprotect it afterwards. - */ - i = 0; - if (fd_children != NULL) { - H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, ds_entry_ptr, FAIL) - ds_entry_ptr->is_protected = TRUE; - while (fd_children[i] != NULL) { - /* Sanity checks */ - HDassert((fd_children[i])->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert((fd_children[i])->prefetched); - HDassert((fd_children[i])->fd_parent_count > 0); - HDassert((fd_children[i])->fd_parent_addrs); - -#ifndef NDEBUG - { - int j; - hbool_t found; - - j = 0; - found = FALSE; - while ((j < (int)((fd_children[i])->fd_parent_count)) && (!found)) { - if ((fd_children[i])->fd_parent_addrs[j] == ds_entry_ptr->addr) - found = TRUE; - - j++; - } /* end while */ - HDassert(found); - } -#endif /* NDEBUG */ - - if (H5C_create_flush_dependency(ds_entry_ptr, fd_children[i]) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Can't restore child flush dependency") - - i++; - } /* end while */ - - H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, ds_entry_ptr, FAIL); - ds_entry_ptr->is_protected = FALSE; - } /* end if ( fd_children != NULL ) */ - HDassert((unsigned)i == ds_entry_ptr->fd_child_count); - - ds_entry_ptr->fd_child_count = 0; - H5C__UPDATE_STATS_FOR_PREFETCH_HIT(cache_ptr) - - /* finally, pass ds_entry_ptr back to the caller */ - *entry_ptr_ptr = ds_entry_ptr; - -done: - if (fd_children) - fd_children = (H5C_cache_entry_t **)H5MM_xfree((void *)fd_children); - - /* Release resources on error */ - if (FAIL == ret_value) - if (thing && type->free_icr(thing) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "free_icr callback failed") - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__deserialize_prefetched_entry() */ - /*------------------------------------------------------------------------- * Function: H5C__free_image_entries_array * @@ -806,9 +437,6 @@ H5C__deserialize_prefetched_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 8/4/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -817,11 +445,10 @@ H5C__free_image_entries_array(H5C_t *cache_ptr) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->close_warning_received); - HDassert(cache_ptr->image_ctl.generate_image); - HDassert(cache_ptr->index_len == 0); + assert(cache_ptr); + assert(cache_ptr->close_warning_received); + assert(cache_ptr->image_ctl.generate_image); + assert(cache_ptr->index_len == 0); /* Check for entries to free */ if (cache_ptr->image_entries != NULL) { @@ -831,27 +458,23 @@ H5C__free_image_entries_array(H5C_t *cache_ptr) H5C_image_entry_t *ie_ptr; /* Image entry to release */ /* Get pointer to image entry */ - ie_ptr = &((cache_ptr->image_entries)[u]); + ie_ptr = &(cache_ptr->image_entries[u]); /* Sanity checks */ - HDassert(ie_ptr); - HDassert(ie_ptr->magic == H5C_IMAGE_ENTRY_T_MAGIC); - HDassert(ie_ptr->image_ptr); + assert(ie_ptr); + assert(ie_ptr->image_ptr); /* Free the parent addrs array if appropriate */ if (ie_ptr->fd_parent_addrs) { - HDassert(ie_ptr->fd_parent_count > 0); + assert(ie_ptr->fd_parent_count > 0); ie_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree(ie_ptr->fd_parent_addrs); } /* end if */ else - HDassert(ie_ptr->fd_parent_count == 0); + assert(ie_ptr->fd_parent_count == 0); /* Free the image */ ie_ptr->image_ptr = H5MM_xfree(ie_ptr->image_ptr); - - /* Set magic field to bad magic so we can detect freed entries */ - ie_ptr->magic = H5C_IMAGE_ENTRY_T_BAD_MAGIC; } /* end for */ /* Free the image entries array */ @@ -862,7 +485,7 @@ H5C__free_image_entries_array(H5C_t *cache_ptr) } /* H5C__free_image_entries_array() */ /*------------------------------------------------------------------------- - * Function: H5C_get_cache_image_config + * Function: H5C__get_cache_image_config * * Purpose: Copy the current configuration for cache image generation * on file close into the instance of H5C_cache_image_ctl_t @@ -870,94 +493,25 @@ H5C__free_image_entries_array(H5C_t *cache_ptr) * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 7/3/15 - * *------------------------------------------------------------------------- */ herr_t -H5C_get_cache_image_config(const H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr) +H5C__get_cache_image_config(const H5C_t *cache_ptr, H5C_cache_image_ctl_t *config_ptr) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache_ptr on entry") + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache_ptr on entry"); if (config_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad config_ptr on entry") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad config_ptr on entry"); *config_ptr = cache_ptr->image_ctl; done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_get_cache_image_config() */ - -/*------------------------------------------------------------------------- - * Function: H5C_image_stats - * - * Purpose: Prints statistics specific to the cache image. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 10/26/15 - * - *------------------------------------------------------------------------- - */ -herr_t -#if H5C_COLLECT_CACHE_STATS -H5C_image_stats(H5C_t *cache_ptr, hbool_t print_header) -#else /* H5C_COLLECT_CACHE_STATS */ -H5C_image_stats(H5C_t *cache_ptr, hbool_t H5_ATTR_UNUSED print_header) -#endif /* H5C_COLLECT_CACHE_STATS */ -{ -#if H5C_COLLECT_CACHE_STATS - int i; - int64_t total_hits = 0; - int64_t total_misses = 0; - double hit_rate; - double prefetch_use_rate; -#endif /* H5C_COLLECT_CACHE_STATS */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - if (!cache_ptr || cache_ptr->magic != H5C__H5C_T_MAGIC) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr") - -#if H5C_COLLECT_CACHE_STATS - for (i = 0; i <= cache_ptr->max_type_id; i++) { - total_hits += cache_ptr->hits[i]; - total_misses += cache_ptr->misses[i]; - } /* end for */ - - if ((total_hits > 0) || (total_misses > 0)) - hit_rate = 100.0 * ((double)(total_hits)) / ((double)(total_hits + total_misses)); - else - hit_rate = 0.0; - - if (cache_ptr->prefetches > 0) - prefetch_use_rate = 100.0 * ((double)(cache_ptr->prefetch_hits)) / ((double)(cache_ptr->prefetches)); - else - prefetch_use_rate = 0.0; - - if (print_header) { - HDfprintf(stdout, "\nhit prefetches prefetch image pf hit\n"); - HDfprintf(stdout, "rate: total: dirty: hits: flshs: evct: size: rate:\n"); - } /* end if */ - - HDfprintf(stdout, "%3.1lf %5lld %5lld %5lld %5lld %5lld %5lld %3.1lf\n", hit_rate, - (long long)(cache_ptr->prefetches), (long long)(cache_ptr->dirty_prefetches), - (long long)(cache_ptr->prefetch_hits), - (long long)(cache_ptr->flushes[H5AC_PREFETCHED_ENTRY_ID]), - (long long)(cache_ptr->evictions[H5AC_PREFETCHED_ENTRY_ID]), - (long long)(cache_ptr->last_image_size), prefetch_use_rate); -#endif /* H5C_COLLECT_CACHE_STATS */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_image_stats() */ +} /* H5C__get_cache_image_config() */ /*------------------------------------------------------------------------- * Function: H5C__read_cache_image @@ -967,9 +521,6 @@ H5C_image_stats(H5C_t *cache_ptr, hbool_t H5_ATTR_UNUSED print_header) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 8/16/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -980,20 +531,18 @@ H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(cache_ptr); - HDassert(H5F_addr_defined(cache_ptr->image_addr)); - HDassert(cache_ptr->image_len > 0); - HDassert(cache_ptr->image_buffer); + assert(f); + assert(cache_ptr); + assert(H5_addr_defined(cache_ptr->image_addr)); + assert(cache_ptr->image_len > 0); + assert(cache_ptr->image_buffer); #ifdef H5_HAVE_PARALLEL { H5AC_aux_t *aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr; int mpi_result; - if ((NULL == aux_ptr) || (aux_ptr->mpi_rank == 0)) { - - HDassert((NULL == aux_ptr) || (aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC)); + if (NULL == aux_ptr || aux_ptr->mpi_rank == 0) { #endif /* H5_HAVE_PARALLEL */ /* Read the buffer (if serial access, or rank 0 of parallel access) */ @@ -1002,27 +551,22 @@ H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr) */ if (H5F_block_read(f, H5FD_MEM_SUPER, cache_ptr->image_addr, cache_ptr->image_len, cache_ptr->image_buffer) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block") + HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block"); - H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr) + H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr); #ifdef H5_HAVE_PARALLEL if (aux_ptr) { - /* Broadcast cache image */ if (MPI_SUCCESS != (mpi_result = MPI_Bcast(cache_ptr->image_buffer, (int)cache_ptr->image_len, MPI_BYTE, 0, aux_ptr->mpi_comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) - } /* end if */ } /* end if */ else if (aux_ptr) { - /* Retrieve the contents of the metadata cache image from process 0 */ if (MPI_SUCCESS != (mpi_result = MPI_Bcast(cache_ptr->image_buffer, (int)cache_ptr->image_len, MPI_BYTE, 0, aux_ptr->mpi_comm))) - HMPI_GOTO_ERROR(FAIL, "can't receive cache image MPI_Bcast", mpi_result) } /* end else-if */ } /* end block */ @@ -1044,9 +588,6 @@ H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 7/6/15 - * *------------------------------------------------------------------------- */ herr_t @@ -1058,11 +599,10 @@ H5C__load_cache_image(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); /* If the image address is defined, load the image, decode it, * and insert its contents into the metadata cache. @@ -1073,22 +613,22 @@ H5C__load_cache_image(H5F_t *f) * no image exists, and that the load operation should be skipped * silently. */ - if (H5F_addr_defined(cache_ptr->image_addr)) { + if (H5_addr_defined(cache_ptr->image_addr)) { /* Sanity checks */ - HDassert(cache_ptr->image_len > 0); - HDassert(cache_ptr->image_buffer == NULL); + assert(cache_ptr->image_len > 0); + assert(cache_ptr->image_buffer == NULL); /* Allocate space for the image */ if (NULL == (cache_ptr->image_buffer = H5MM_malloc(cache_ptr->image_len + 1))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for cache image buffer"); /* Load the image from file */ if (H5C__read_cache_image(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block") + HGOTO_ERROR(H5E_CACHE, H5E_READERROR, FAIL, "Can't read metadata cache image block"); /* Reconstruct cache contents, from image */ if (H5C__reconstruct_cache_contents(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "Can't reconstruct cache contents from image block") + HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "Can't reconstruct cache contents from image block"); /* Free the image buffer */ cache_ptr->image_buffer = H5MM_xfree(cache_ptr->image_buffer); @@ -1096,7 +636,7 @@ H5C__load_cache_image(H5F_t *f) /* Update stats -- must do this now, as we are about * to discard the size of the cache image. */ - H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr) + H5C__UPDATE_STATS_FOR_CACHE_IMAGE_LOAD(cache_ptr); cache_ptr->image_loaded = TRUE; } /* end if */ @@ -1105,7 +645,7 @@ H5C__load_cache_image(H5F_t *f) if (cache_ptr->delete_image) { if (H5F__super_ext_remove_msg(f, H5O_MDCI_MSG_ID) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, - "can't remove metadata cache image message from superblock extension") + "can't remove metadata cache image message from superblock extension"); /* Reset image block values */ cache_ptr->image_len = 0; @@ -1140,9 +680,6 @@ H5C__load_cache_image(H5F_t *f) * * Return: SUCCEED * - * Programmer: John Mainzer - * 7/6/15 - * *------------------------------------------------------------------------- */ herr_t @@ -1153,11 +690,10 @@ H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_ FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); /* Set information needed to load cache image */ cache_ptr->image_addr = addr; @@ -1185,9 +721,6 @@ H5C_load_cache_image_on_next_protect(H5F_t *f, haddr_t addr, hsize_t len, hbool_ * first entry is considered to be respectively less than, * equal to, or greater than the second. * - * Programmer: Quincey Koziol - * 1/20/16 - * *------------------------------------------------------------------------- */ static int @@ -1202,8 +735,8 @@ H5C__image_entry_cmp(const void *_entry1, const void *_entry2) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(entry1); - HDassert(entry2); + assert(entry1); + assert(entry2); if (entry1->image_fd_height > entry2->image_fd_height) ret_value = -1; @@ -1211,8 +744,8 @@ H5C__image_entry_cmp(const void *_entry1, const void *_entry2) ret_value = 1; else { /* Sanity check */ - HDassert(entry1->lru_rank >= -1); - HDassert(entry2->lru_rank >= -1); + assert(entry1->lru_rank >= -1); + assert(entry2->lru_rank >= -1); if (entry1->lru_rank < entry2->lru_rank) ret_value = -1; @@ -1265,9 +798,6 @@ H5C__image_entry_cmp(const void *_entry1, const void *_entry2) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 7/3/15 - * *------------------------------------------------------------------------- */ herr_t @@ -1281,13 +811,12 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(image_generated); + assert(cache_ptr); + assert(image_generated); /* If the file is opened and closed without any access to * any group or data set, it is possible that the cache image (if @@ -1296,7 +825,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) if (cache_ptr->load_image) { cache_ptr->load_image = FALSE; if (H5C__load_cache_image(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "can't load cache image") + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, FAIL, "can't load cache image"); } /* end if */ /* Before we start to generate the cache image (if requested), verify @@ -1318,7 +847,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL; cache_ptr->image_ctl = default_image_ctl; - HDassert(!(cache_ptr->image_ctl.generate_image)); + assert(!(cache_ptr->image_ctl.generate_image)); } /* end if */ /* Generate the cache image, if requested */ @@ -1339,11 +868,11 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) */ if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDCI_SBE_MESG) if (H5C__write_cache_image_superblock_msg(f, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "creation of cache image SB mesg failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "creation of cache image SB mesg failed."); /* Serialize the cache */ if (H5C__serialize_cache(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "serialization of the cache failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "serialization of the cache failed"); /* Scan the cache and record data needed to construct the * cache image. In particular, for each entry we must record: @@ -1362,8 +891,8 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) * manager code, this size should be correct. */ if (H5C__prep_for_file_close__scan_entries(f, cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C__prep_for_file_close__scan_entries failed") - HDassert(HADDR_UNDEF == cache_ptr->image_addr); + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C__prep_for_file_close__scan_entries failed"); + assert(HADDR_UNDEF == cache_ptr->image_addr); #ifdef H5_HAVE_PARALLEL /* In the parallel case, overwrite the image_len with the @@ -1383,7 +912,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) (mpi_result = MPI_Bcast(&p0_image_len, 1, MPI_UNSIGNED, 0, aux_ptr->mpi_comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_result) - HDassert(p0_image_len == aux_ptr->p0_image_len); + assert(p0_image_len == aux_ptr->p0_image_len); } /* end if */ else { if (MPI_SUCCESS != @@ -1406,7 +935,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) (cache_ptr->image_addr = H5FD_alloc(f->shared->lf, H5FD_MEM_SUPER, f, (hsize_t)p0_image_len, &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, - "can't allocate file space for metadata cache image") + "can't allocate file space for metadata cache image"); } /* end if */ else #endif /* H5_HAVE_PARALLEL */ @@ -1418,16 +947,16 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) (hsize_t)(cache_ptr->image_data_len), &eoa_frag_addr, &eoa_frag_size))) HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, - "can't allocate file space for metadata cache image") + "can't allocate file space for metadata cache image"); /* Make note of the eoa after allocation of the cache image * block. This value is used for sanity checking when we * shutdown the self referential free space managers after * we destroy the metadata cache. */ - HDassert(HADDR_UNDEF == f->shared->eoa_post_mdci_fsalloc); + assert(HADDR_UNDEF == f->shared->eoa_post_mdci_fsalloc); if (HADDR_UNDEF == (f->shared->eoa_post_mdci_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size"); /* For now, drop any fragment left over from the allocation of the * image block on the ground. A fragment should only be returned @@ -1441,7 +970,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) * a fragment on a cache image allocation, leave the following * assertion in the code so we will find out. */ - HDassert((eoa_frag_size == 0) || (f->shared->alignment != 1)); + assert((eoa_frag_size == 0) || (f->shared->alignment != 1)); /* Eventually it will be possible for the length of the cache image * block on file to be greater than the size of the data it @@ -1460,7 +989,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) */ if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK) if (H5C__write_cache_image_superblock_msg(f, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "update of cache image SB mesg failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "update of cache image SB mesg failed"); /* At this point: * @@ -1498,14 +1027,14 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) */ if (cache_ptr->num_entries_in_image > 0) { if (H5C__prep_for_file_close__setup_image_entries_array(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINIT, FAIL, "can't setup image entries array.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINIT, FAIL, "can't setup image entries array."); /* Sort the entries */ - HDqsort(cache_ptr->image_entries, (size_t)cache_ptr->num_entries_in_image, - sizeof(H5C_image_entry_t), H5C__image_entry_cmp); + qsort(cache_ptr->image_entries, (size_t)cache_ptr->num_entries_in_image, + sizeof(H5C_image_entry_t), H5C__image_entry_cmp); } /* end if */ else { /* cancel creation of metadata cache image */ - HDassert(cache_ptr->image_entries == NULL); + assert(cache_ptr->image_entries == NULL); /* To avoid breaking the control flow tests, only delete * the mdci superblock extension message if the @@ -1515,7 +1044,7 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) if (cache_ptr->image_ctl.flags & H5C_CI__GEN_MDC_IMAGE_BLK) if (H5F__super_ext_remove_msg(f, H5O_MDCI_MSG_ID) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, - "can't remove MDC image msg from superblock ext") + "can't remove MDC image msg from superblock ext"); cache_ptr->image_ctl.generate_image = FALSE; } /* end else */ @@ -1551,9 +1080,6 @@ H5C__prep_image_for_file_close(H5F_t *f, hbool_t *image_generated) * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 7/3/15 - * *------------------------------------------------------------------------- */ herr_t @@ -1564,29 +1090,28 @@ H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_image_ctl FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache == f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache == f->shared->cache); /* Check arguments */ - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache_ptr on entry") + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache_ptr on entry"); /* Validate the config: */ if (H5C_validate_cache_image_config(config_ptr) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid cache image configuration") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid cache image configuration"); #ifdef H5_HAVE_PARALLEL /* The collective metadata write code is not currently compatible * with cache image. Until this is fixed, suppress cache image silently * if there is more than one process. - * JRM -- 11/8/16 */ if (cache_ptr->aux_ptr) { H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL; cache_ptr->image_ctl = default_image_ctl; - HDassert(!(cache_ptr->image_ctl.generate_image)); + assert(!(cache_ptr->image_ctl.generate_image)); } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ @@ -1608,7 +1133,7 @@ H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_image_ctl H5C_cache_image_ctl_t default_image_ctl = H5C__DEFAULT_CACHE_IMAGE_CTL; cache_ptr->image_ctl = default_image_ctl; - HDassert(!(cache_ptr->image_ctl.generate_image)); + assert(!(cache_ptr->image_ctl.generate_image)); } /* end else */ #ifdef H5_HAVE_PARALLEL } /* end else */ @@ -1629,9 +1154,6 @@ H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_image_ctl * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 6/15/15 - * *------------------------------------------------------------------------- */ herr_t @@ -1642,26 +1164,26 @@ H5C_validate_cache_image_config(H5C_cache_image_ctl_t *ctl_ptr) FUNC_ENTER_NOAPI(FAIL) if (ctl_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL ctl_ptr on entry") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "NULL ctl_ptr on entry"); if (ctl_ptr->version != H5C__CURR_CACHE_IMAGE_CTL_VER) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown cache image control version") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown cache image control version"); /* At present, we do not support inclusion of the adaptive resize * configuration in the cache image. Thus the save_resize_status * field must be FALSE. */ if (ctl_ptr->save_resize_status != FALSE) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unexpected value in save_resize_status field") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unexpected value in save_resize_status field"); /* At present, we do not support prefetched entry ageouts. Thus * the entry_ageout field must be set to * H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE. */ if (ctl_ptr->entry_ageout != H5AC__CACHE_IMAGE__ENTRY_AGEOUT__NONE) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unexpected value in entry_ageout field") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unexpected value in entry_ageout field"); if ((ctl_ptr->flags & ~H5C_CI__ALL_FLAGS) != 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown flag set") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "unknown flag set"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1680,9 +1202,6 @@ H5C_validate_cache_image_config(H5C_cache_image_ctl_t *ctl_ptr) * Return: Size of the header section of the metadata cache image * block in bytes. * - * Programmer: John Mainzer - * 7/27/15 - * *------------------------------------------------------------------------- */ static size_t @@ -1716,9 +1235,6 @@ H5C__cache_image_block_entry_header_size(const H5F_t *f) * Return: Size of the header section of the metadata cache image * block in bytes. * - * Programmer: John Mainzer - * 7/27/15 - * *------------------------------------------------------------------------- */ static size_t @@ -1748,9 +1264,6 @@ H5C__cache_image_block_header_size(const H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 8/6/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -1767,48 +1280,47 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t * FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(buf); - HDassert(*buf); + assert(cache_ptr); + assert(buf); + assert(*buf); /* Point to buffer to decode */ p = *buf; /* Check signature */ - if (HDmemcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN) != 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature") + if (memcmp(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN) != 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image header signature"); p += H5C__MDCI_BLOCK_SIGNATURE_LEN; /* Check version */ version = *p++; if (version != (uint8_t)H5C__MDCI_BLOCK_VERSION_0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image version") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image version"); /* Decode flags */ flags = *p++; if (flags & H5C__MDCI_HEADER_HAVE_RESIZE_STATUS) have_resize_status = TRUE; if (have_resize_status) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "MDC resize status not yet supported") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "MDC resize status not yet supported"); /* Read image data length */ H5F_DECODE_LENGTH(f, p, cache_ptr->image_data_len); /* For now -- will become <= eventually */ if (cache_ptr->image_data_len != cache_ptr->image_len) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image data length") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache image data length"); /* Read num entries */ UINT32DECODE(p, cache_ptr->num_entries_in_image); if (cache_ptr->num_entries_in_image == 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache entry count") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad metadata cache entry count"); /* Verify expected length of header */ actual_header_len = (size_t)(p - *buf); expected_header_len = H5C__cache_image_block_header_size(f); if (actual_header_len != expected_header_len) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad header image len") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad header image len"); /* Update buffer pointer */ *buf = p; @@ -1833,9 +1345,6 @@ H5C__decode_cache_image_header(const H5F_t *f, H5C_t *cache_ptr, const uint8_t * * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 8/6/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -1864,17 +1373,15 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(cache_ptr == f->shared->cache); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(buf); - HDassert(*buf); - HDassert(entry_num < cache_ptr->num_entries_in_image); - ie_ptr = &((cache_ptr->image_entries)[entry_num]); - HDassert(ie_ptr); - HDassert(ie_ptr->magic == H5C_IMAGE_ENTRY_T_MAGIC); + assert(f); + assert(f->shared); + assert(cache_ptr == f->shared->cache); + assert(cache_ptr); + assert(buf); + assert(*buf); + assert(entry_num < cache_ptr->num_entries_in_image); + ie_ptr = &(cache_ptr->image_entries[entry_num]); + assert(ie_ptr); /* Get pointer to buffer */ p = *buf; @@ -1895,42 +1402,42 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint /* Decode ring */ ring = *p++; - HDassert(ring > (uint8_t)(H5C_RING_UNDEFINED)); - HDassert(ring < (uint8_t)(H5C_RING_NTYPES)); + assert(ring > (uint8_t)(H5C_RING_UNDEFINED)); + assert(ring < (uint8_t)(H5C_RING_NTYPES)); /* Decode age */ age = *p++; /* Decode dependency child count */ UINT16DECODE(p, fd_child_count); - HDassert((is_fd_parent && fd_child_count > 0) || (!is_fd_parent && fd_child_count == 0)); + assert((is_fd_parent && fd_child_count > 0) || (!is_fd_parent && fd_child_count == 0)); /* Decode dirty dependency child count */ UINT16DECODE(p, fd_dirty_child_count); if (fd_dirty_child_count > fd_child_count) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid dirty flush dependency child count") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid dirty flush dependency child count"); /* Decode dependency parent count */ UINT16DECODE(p, fd_parent_count); - HDassert((is_fd_child && fd_parent_count > 0) || (!is_fd_child && fd_parent_count == 0)); + assert((is_fd_child && fd_parent_count > 0) || (!is_fd_child && fd_parent_count == 0)); /* Decode index in LRU */ INT32DECODE(p, lru_rank); - HDassert((in_lru && lru_rank >= 0) || (!in_lru && lru_rank == -1)); + assert((in_lru && lru_rank >= 0) || (!in_lru && lru_rank == -1)); /* Decode entry offset */ H5F_addr_decode(f, &p, &addr); - if (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid entry offset") + if (!H5_addr_defined(addr)) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid entry offset"); /* Decode entry length */ H5F_DECODE_LENGTH(f, p, size); if (size == 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid entry size") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid entry size"); /* Verify expected length of entry image */ if ((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f)) - HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, FAIL, "Bad entry image len") + HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, FAIL, "Bad entry image len"); /* If parent count greater than zero, allocate array for parent * addresses, and decode addresses into the array. @@ -1939,18 +1446,19 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint int i; /* Local index variable */ if (NULL == (fd_parent_addrs = (haddr_t *)H5MM_malloc((size_t)(fd_parent_count)*H5F_SIZEOF_ADDR(f)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for fd parent addrs buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, + "memory allocation failed for fd parent addrs buffer"); for (i = 0; i < fd_parent_count; i++) { H5F_addr_decode(f, &p, &(fd_parent_addrs[i])); - if (!H5F_addr_defined(fd_parent_addrs[i])) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid flush dependency parent offset") + if (!H5_addr_defined(fd_parent_addrs[i])) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "invalid flush dependency parent offset"); } /* end for */ } /* end if */ /* Allocate buffer for entry image */ if (NULL == (image_ptr = H5MM_malloc(size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer"); #if H5C_DO_MEMORY_SANITY_CHECKS H5MM_memcpy(((uint8_t *)image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); @@ -1980,135 +1488,7 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, const uint done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__decode_cache_image_entry() */ -#endif /* NDEBUG */ - -/*------------------------------------------------------------------------- - * Function: H5C__destroy_pf_entry_child_flush_deps() - * - * Purpose: Destroy all flush dependencies in this the supplied - * prefetched entry is the parent. Note that the children - * in these flush dependencies must be prefetched entries as - * well. - * - * As this action is part of the process of transferring all - * such flush dependencies to the deserialized version of the - * prefetched entry, ensure that the data necessary to complete - * the transfer is retained. - * - * Note: The current implementation of this function is - * quite inefficient -- mostly due to the current - * implementation of flush dependencies. This should - * be fixed at some point. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: John Mainzer - * 8/11/15 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr, H5C_cache_entry_t *pf_entry_ptr, - H5C_cache_entry_t **fd_children) -{ - H5C_cache_entry_t *entry_ptr; - unsigned entries_visited = 0; - int fd_children_found = 0; - hbool_t found; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(pf_entry_ptr); - HDassert(pf_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(pf_entry_ptr->type); - HDassert(pf_entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); - HDassert(pf_entry_ptr->prefetched); - HDassert(pf_entry_ptr->fd_child_count > 0); - HDassert(fd_children); - - /* Scan each entry on the index list */ - entry_ptr = cache_ptr->il_head; - while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - - /* Here we look at entry_ptr->flush_dep_nparents and not - * entry_ptr->fd_parent_count as it is possible that some - * or all of the prefetched flush dependency child relationships - * have already been destroyed. - */ - if (entry_ptr->prefetched && (entry_ptr->flush_dep_nparents > 0)) { - unsigned u; /* Local index variable */ - - /* Re-init */ - u = 0; - found = FALSE; - - /* Sanity checks */ - HDassert(entry_ptr->type); - HDassert(entry_ptr->type->id == H5AC_PREFETCHED_ENTRY_ID); - HDassert(entry_ptr->fd_parent_count >= entry_ptr->flush_dep_nparents); - HDassert(entry_ptr->fd_parent_addrs); - HDassert(entry_ptr->flush_dep_parent); - - /* Look for correct entry */ - while (!found && (u < entry_ptr->fd_parent_count)) { - /* Sanity check entry */ - HDassert(entry_ptr->flush_dep_parent[u]); - HDassert(entry_ptr->flush_dep_parent[u]->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - - /* Correct entry? */ - if (pf_entry_ptr == entry_ptr->flush_dep_parent[u]) - found = TRUE; - - u++; - } /* end while */ - - if (found) { - HDassert(NULL == fd_children[fd_children_found]); - - /* Remove flush dependency */ - fd_children[fd_children_found] = entry_ptr; - fd_children_found++; - if (H5C_destroy_flush_dependency(pf_entry_ptr, entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, - "can't destroy pf entry child flush dependency") - -#ifndef NDEBUG - /* Sanity check -- verify that the address of the parent - * appears in entry_ptr->fd_parent_addrs. Must do a search, - * as with flush dependency creates and destroys, - * entry_ptr->fd_parent_addrs and entry_ptr->flush_dep_parent - * can list parents in different order. - */ - found = FALSE; - u = 0; - while (!found && u < entry_ptr->fd_parent_count) { - if (pf_entry_ptr->addr == entry_ptr->fd_parent_addrs[u]) - found = TRUE; - u++; - } /* end while */ - HDassert(found); -#endif /* NDEBUG */ - } /* end if */ - } /* end if */ - - entries_visited++; - entry_ptr = entry_ptr->il_next; - } /* end while */ - - /* Post-op sanity checks */ - HDassert(NULL == fd_children[fd_children_found]); - HDassert((unsigned)fd_children_found == pf_entry_ptr->fd_child_count); - HDassert(entries_visited == cache_ptr->index_len); - HDassert(!pf_entry_ptr->is_pinned); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5C__destroy_pf_entry_child_flush_deps() */ +#endif /*------------------------------------------------------------------------- * Function: H5C__encode_cache_image_header() @@ -2119,9 +1499,6 @@ H5C__destroy_pf_entry_child_flush_deps(H5C_t *cache_ptr, H5C_cache_entry_t *pf_e * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 8/6/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -2136,15 +1513,14 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, uint8_t * FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->close_warning_received); - HDassert(cache_ptr->image_ctl.generate_image); - HDassert(cache_ptr->index_len == 0); - HDassert(cache_ptr->image_data_len > 0); - HDassert(cache_ptr->image_data_len <= cache_ptr->image_len); - HDassert(buf); - HDassert(*buf); + assert(cache_ptr); + assert(cache_ptr->close_warning_received); + assert(cache_ptr->image_ctl.generate_image); + assert(cache_ptr->index_len == 0); + assert(cache_ptr->image_data_len > 0); + assert(cache_ptr->image_data_len <= cache_ptr->image_len); + assert(buf); + assert(*buf); /* Set pointer into buffer */ p = *buf; @@ -2159,7 +1535,7 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, uint8_t * /* setup and write flags */ /* at present we don't support saving resize status */ - HDassert(!cache_ptr->image_ctl.save_resize_status); + assert(!cache_ptr->image_ctl.save_resize_status); if (cache_ptr->image_ctl.save_resize_status) flags |= H5C__MDCI_HEADER_HAVE_RESIZE_STATUS; @@ -2167,7 +1543,7 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, uint8_t * /* Encode image data length */ /* this must be true at present */ - HDassert(cache_ptr->image_len == cache_ptr->image_data_len); + assert(cache_ptr->image_len == cache_ptr->image_data_len); H5F_ENCODE_LENGTH(f, p, cache_ptr->image_data_len); /* write num entries */ @@ -2177,7 +1553,7 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, uint8_t * actual_header_len = (size_t)(p - *buf); expected_header_len = H5C__cache_image_block_header_size(f); if (actual_header_len != expected_header_len) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad header image len") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad header image len"); /* Update buffer pointer */ *buf = p; @@ -2195,9 +1571,6 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, uint8_t * * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 8/6/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -2212,26 +1585,24 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigne FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(cache_ptr == f->shared->cache); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->close_warning_received); - HDassert(cache_ptr->image_ctl.generate_image); - HDassert(cache_ptr->index_len == 0); - HDassert(buf); - HDassert(*buf); - HDassert(entry_num < cache_ptr->num_entries_in_image); - ie_ptr = &((cache_ptr->image_entries)[entry_num]); - HDassert(ie_ptr->magic == H5C_IMAGE_ENTRY_T_MAGIC); + assert(f); + assert(f->shared); + assert(cache_ptr == f->shared->cache); + assert(cache_ptr); + assert(cache_ptr->close_warning_received); + assert(cache_ptr->image_ctl.generate_image); + assert(cache_ptr->index_len == 0); + assert(buf); + assert(*buf); + assert(entry_num < cache_ptr->num_entries_in_image); + ie_ptr = &(cache_ptr->image_entries[entry_num]); /* Get pointer to buffer to encode into */ p = *buf; /* Encode type */ if ((ie_ptr->type_id < 0) || (ie_ptr->type_id > 255)) - HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "type_id out of range.") + HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "type_id out of range."); *p++ = (uint8_t)(ie_ptr->type_id); /* Compose and encode flags */ @@ -2253,17 +1624,17 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigne /* Validate and encode dependency child count */ if (ie_ptr->fd_child_count > H5C__MDCI_MAX_FD_CHILDREN) - HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_child_count out of range") + HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_child_count out of range"); UINT16ENCODE(p, (uint16_t)(ie_ptr->fd_child_count)); /* Validate and encode dirty dependency child count */ if (ie_ptr->fd_dirty_child_count > H5C__MDCI_MAX_FD_CHILDREN) - HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_dirty_child_count out of range") + HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_dirty_child_count out of range"); UINT16ENCODE(p, (uint16_t)(ie_ptr->fd_dirty_child_count)); /* Validate and encode dependency parent count */ if (ie_ptr->fd_parent_count > H5C__MDCI_MAX_FD_PARENTS) - HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_parent_count out of range") + HGOTO_ERROR(H5E_CACHE, H5E_BADRANGE, FAIL, "fd_parent_count out of range"); UINT16ENCODE(p, (uint16_t)(ie_ptr->fd_parent_count)); /* Encode index in LRU */ @@ -2277,7 +1648,7 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigne /* Verify expected length of entry image */ if ((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad entry image len") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad entry image len"); /* Encode dependency parent offsets -- if any */ for (u = 0; u < ie_ptr->fd_parent_count; u++) @@ -2297,22 +1668,7 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigne /*------------------------------------------------------------------------- * Function: H5C__prep_for_file_close__compute_fd_heights * - * Purpose: Recent modifications to flush dependency support in the - * metadata cache have removed the notion of flush dependency - * height. This is a problem for the cache image feature, - * as flush dependency height is used to order entries in the - * cache image so that flush dependency parents appear before - * flush dependency children. (Recall that the flush dependency - * height of an entry in a flush dependency relationship is the - * length of the longest path from the entry to a leaf entry -- - * that is an entry with flush dependency parents, but no - * flush dependency children. With the introduction of the - * possibility of multiple flush dependency parents, we have - * a flush partial dependency latice, not a flush dependency - * tree. But since the partial latice is acyclic, the concept - * of flush dependency height still makes sense. - * - * The purpose of this function is to compute the flush + * Purpose: The purpose of this function is to compute the flush * dependency height of all entries that appear in the cache * image. * @@ -2352,9 +1708,6 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, unsigne * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 9/6/16 - * *------------------------------------------------------------------------- */ static herr_t @@ -2362,18 +1715,19 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr) { H5C_cache_entry_t *entry_ptr; H5C_cache_entry_t *parent_ptr; - unsigned entries_removed_from_image = 0; - unsigned external_parent_fd_refs_removed = 0; - unsigned external_child_fd_refs_removed = 0; - hbool_t done = FALSE; - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; +#ifndef NDEBUG + unsigned entries_removed_from_image = 0; + unsigned external_parent_fd_refs_removed = 0; + unsigned external_child_fd_refs_removed = 0; +#endif + hbool_t done = FALSE; + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE /* sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); /* Remove from the cache image all dirty entries that are * flush dependency children of dirty entries that are not in the @@ -2387,23 +1741,22 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr) done = TRUE; entry_ptr = cache_ptr->il_head; while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - /* Should this entry be in the image */ if (entry_ptr->image_dirty && entry_ptr->include_in_image && (entry_ptr->fd_parent_count > 0)) { - HDassert(entry_ptr->flush_dep_parent != NULL); + assert(entry_ptr->flush_dep_parent != NULL); for (u = 0; u < entry_ptr->flush_dep_nparents; u++) { parent_ptr = entry_ptr->flush_dep_parent[u]; /* Sanity check parent */ - HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring == parent_ptr->ring); + assert(entry_ptr->ring == parent_ptr->ring); if (parent_ptr->is_dirty && !parent_ptr->include_in_image && entry_ptr->include_in_image) { /* Must remove child from image -- only do this once */ +#ifndef NDEBUG entries_removed_from_image++; +#endif entry_ptr->include_in_image = FALSE; } /* end if */ } /* for */ @@ -2419,7 +1772,7 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr) * so. Note that this will change when we start aging entries out * of the cache image. */ - HDassert(entries_removed_from_image == 0); + assert(entries_removed_from_image == 0); /* Next, remove from entries in the cache image, references to * flush dependency parents or children that are not in the cache image. @@ -2427,51 +1780,53 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr) entry_ptr = cache_ptr->il_head; while (entry_ptr != NULL) { if (!entry_ptr->include_in_image && entry_ptr->flush_dep_nparents > 0) { - HDassert(entry_ptr->flush_dep_parent != NULL); + assert(entry_ptr->flush_dep_parent != NULL); for (u = 0; u < entry_ptr->flush_dep_nparents; u++) { parent_ptr = entry_ptr->flush_dep_parent[u]; /* Sanity check parent */ - HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring == parent_ptr->ring); + assert(entry_ptr->ring == parent_ptr->ring); if (parent_ptr->include_in_image) { /* Must remove reference to child */ - HDassert(parent_ptr->fd_child_count > 0); + assert(parent_ptr->fd_child_count > 0); parent_ptr->fd_child_count--; if (entry_ptr->is_dirty) { - HDassert(parent_ptr->fd_dirty_child_count > 0); + assert(parent_ptr->fd_dirty_child_count > 0); parent_ptr->fd_dirty_child_count--; } /* end if */ +#ifndef NDEBUG external_child_fd_refs_removed++; +#endif } /* end if */ } /* for */ } /* end if */ else if (entry_ptr->include_in_image && entry_ptr->flush_dep_nparents > 0) { /* Sanity checks */ - HDassert(entry_ptr->flush_dep_parent != NULL); - HDassert(entry_ptr->flush_dep_nparents == entry_ptr->fd_parent_count); - HDassert(entry_ptr->fd_parent_addrs); + assert(entry_ptr->flush_dep_parent != NULL); + assert(entry_ptr->flush_dep_nparents == entry_ptr->fd_parent_count); + assert(entry_ptr->fd_parent_addrs); for (u = 0; u < entry_ptr->flush_dep_nparents; u++) { parent_ptr = entry_ptr->flush_dep_parent[u]; /* Sanity check parent */ - HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring == parent_ptr->ring); + assert(entry_ptr->ring == parent_ptr->ring); if (!parent_ptr->include_in_image) { /* Must remove reference to parent */ - HDassert(entry_ptr->fd_parent_count > 0); + assert(entry_ptr->fd_parent_count > 0); parent_ptr->fd_child_count--; - HDassert(parent_ptr->addr == entry_ptr->fd_parent_addrs[u]); + assert(parent_ptr->addr == entry_ptr->fd_parent_addrs[u]); entry_ptr->fd_parent_addrs[u] = HADDR_UNDEF; +#ifndef NDEBUG external_parent_fd_refs_removed++; +#endif } /* end if */ } /* for */ @@ -2487,7 +1842,7 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr) if (NULL == (entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_calloc( sizeof(haddr_t) * (size_t)(entry_ptr->fd_parent_addrs)))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "memory allocation failed for fd parent addr array") + "memory allocation failed for fd parent addr array"); v = 0; for (u = 0; u < entry_ptr->flush_dep_nparents; u++) { @@ -2497,7 +1852,7 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr) } /* end if */ } /* end for */ - HDassert(v == entry_ptr->fd_parent_count); + assert(v == entry_ptr->fd_parent_count); } /* end else-if */ } /* end else-if */ @@ -2508,8 +1863,8 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr) * should exist -- hence the following assertions. This will change * if we support ageout of entries in the cache image. */ - HDassert(external_child_fd_refs_removed == 0); - HDassert(external_parent_fd_refs_removed == 0); + assert(external_child_fd_refs_removed == 0); + assert(external_parent_fd_refs_removed == 0); /* At this point we should have removed all flush dependencies that * cross cache image boundaries. Now compute the flush dependency @@ -2527,7 +1882,6 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr) for (u = 0; u < entry_ptr->fd_parent_count; u++) { parent_ptr = entry_ptr->flush_dep_parent[u]; - HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); if (parent_ptr->include_in_image && parent_ptr->image_fd_height <= 0) H5C__prep_for_file_close__compute_fd_heights_real(parent_ptr, 1); } /* end for */ @@ -2583,9 +1937,6 @@ H5C__prep_for_file_close__compute_fd_heights(const H5C_t *cache_ptr) * * Return: void * - * Programmer: John Mainzer - * 9/6/16 - * *------------------------------------------------------------------------- */ static void @@ -2594,23 +1945,21 @@ H5C__prep_for_file_close__compute_fd_heights_real(H5C_cache_entry_t *entry_ptr, FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->include_in_image); - HDassert((entry_ptr->image_fd_height == 0) || (entry_ptr->image_fd_height < fd_height)); - HDassert(((fd_height == 0) && (entry_ptr->fd_child_count == 0)) || - ((fd_height > 0) && (entry_ptr->fd_child_count > 0))); + assert(entry_ptr); + assert(entry_ptr->include_in_image); + assert((entry_ptr->image_fd_height == 0) || (entry_ptr->image_fd_height < fd_height)); + assert(((fd_height == 0) && (entry_ptr->fd_child_count == 0)) || + ((fd_height > 0) && (entry_ptr->fd_child_count > 0))); entry_ptr->image_fd_height = fd_height; if (entry_ptr->flush_dep_nparents > 0) { unsigned u; - HDassert(entry_ptr->flush_dep_parent); + assert(entry_ptr->flush_dep_parent); for (u = 0; u < entry_ptr->fd_parent_count; u++) { H5C_cache_entry_t *parent_ptr; parent_ptr = entry_ptr->flush_dep_parent[u]; - HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); if (parent_ptr->include_in_image && parent_ptr->image_fd_height <= fd_height) H5C__prep_for_file_close__compute_fd_heights_real(parent_ptr, fd_height + 1); @@ -2629,38 +1978,35 @@ H5C__prep_for_file_close__compute_fd_heights_real(H5C_cache_entry_t *entry_ptr, * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 8/4/15 - * *------------------------------------------------------------------------- */ static herr_t H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr) { H5C_cache_entry_t *entry_ptr; - H5C_image_entry_t *image_entries = NULL; - uint32_t entries_visited = 0; - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5C_image_entry_t *image_entries = NULL; +#ifndef NDEBUG + uint32_t entries_visited = 0; +#endif + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->close_warning_received); - HDassert(cache_ptr->pl_len == 0); - HDassert(cache_ptr->num_entries_in_image > 0); - HDassert(cache_ptr->image_entries == NULL); + assert(cache_ptr); + assert(cache_ptr->close_warning_received); + assert(cache_ptr->pl_len == 0); + assert(cache_ptr->num_entries_in_image > 0); + assert(cache_ptr->image_entries == NULL); /* Allocate and initialize image_entries array */ if (NULL == (image_entries = (H5C_image_entry_t *)H5MM_calloc( sizeof(H5C_image_entry_t) * (size_t)(cache_ptr->num_entries_in_image + 1)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for image_entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for image_entries"); /* Initialize (non-zero/NULL/FALSE) fields */ for (u = 0; u <= cache_ptr->num_entries_in_image; u++) { - image_entries[u].magic = H5C_IMAGE_ENTRY_T_MAGIC; image_entries[u].addr = HADDR_UNDEF; image_entries[u].ring = H5C_RING_UNDEFINED; image_entries[u].type_id = -1; @@ -2670,15 +2016,13 @@ H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr) u = 0; entry_ptr = cache_ptr->il_head; while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - if (entry_ptr->include_in_image) { /* Since we have already serialized the cache, the following * should hold. */ - HDassert(entry_ptr->image_up_to_date); - HDassert(entry_ptr->image_ptr); - HDassert(entry_ptr->type); + assert(entry_ptr->image_up_to_date); + assert(entry_ptr->image_ptr); + assert(entry_ptr->type); image_entries[u].addr = entry_ptr->addr; image_entries[u].size = entry_ptr->size; @@ -2721,20 +2065,22 @@ H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr) u++; - HDassert(u <= cache_ptr->num_entries_in_image); + assert(u <= cache_ptr->num_entries_in_image); } /* end if */ +#ifndef NDEBUG entries_visited++; +#endif entry_ptr = entry_ptr->il_next; } /* end while */ /* Sanity checks */ - HDassert(entries_visited == cache_ptr->index_len); - HDassert(u == cache_ptr->num_entries_in_image); + assert(entries_visited == cache_ptr->index_len); + assert(u == cache_ptr->num_entries_in_image); - HDassert(image_entries[u].fd_parent_addrs == NULL); - HDassert(image_entries[u].image_ptr == NULL); + assert(image_entries[u].fd_parent_addrs == NULL); + assert(image_entries[u].image_ptr == NULL); cache_ptr->image_entries = image_entries; @@ -2767,9 +2113,6 @@ H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 7/21/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -2777,25 +2120,26 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) { H5C_cache_entry_t *entry_ptr; hbool_t include_in_image; - unsigned entries_visited = 0; - int lru_rank = 1; - uint32_t num_entries_tentatively_in_image = 0; - uint32_t num_entries_in_image = 0; - size_t image_len; - size_t entry_header_len; - size_t fd_parents_list_len; - herr_t ret_value = SUCCEED; /* Return value */ + int lru_rank = 1; +#ifndef NDEBUG + unsigned entries_visited = 0; + uint32_t num_entries_tentatively_in_image = 0; +#endif + uint32_t num_entries_in_image = 0; + size_t image_len; + size_t entry_header_len; + size_t fd_parents_list_len; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->sblock); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->close_warning_received); - HDassert(cache_ptr->pl_len == 0); + assert(f); + assert(f->shared); + assert(f->shared->sblock); + assert(cache_ptr); + assert(cache_ptr->close_warning_received); + assert(cache_ptr->pl_len == 0); /* Initialize image len to the size of the metadata cache image block * header. @@ -2806,13 +2150,11 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) /* Scan each entry on the index list */ entry_ptr = cache_ptr->il_head; while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - /* Since we have already serialized the cache, the following * should hold. */ - HDassert(entry_ptr->image_up_to_date); - HDassert(entry_ptr->image_ptr); + assert(entry_ptr->image_up_to_date); + assert(entry_ptr->image_ptr); /* Initially, we mark all entries in the rings included * in the cache image as being included in the in the @@ -2842,15 +2184,15 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) /* parent addresses array should already be allocated * and of the correct size. */ - HDassert(entry_ptr->fd_parent_addrs); + assert(entry_ptr->fd_parent_addrs); } /* end if */ else if (entry_ptr->fd_parent_count > 0) { - HDassert(entry_ptr->fd_parent_addrs); + assert(entry_ptr->fd_parent_addrs); entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree(entry_ptr->fd_parent_addrs); } /* end else-if */ else { - HDassert(entry_ptr->fd_parent_count == 0); - HDassert(entry_ptr->fd_parent_addrs == NULL); + assert(entry_ptr->fd_parent_count == 0); + assert(entry_ptr->fd_parent_addrs == NULL); } /* end else */ entry_ptr->fd_parent_count = entry_ptr->flush_dep_nparents; @@ -2858,19 +2200,19 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) if (NULL == (entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_malloc( sizeof(haddr_t) * (size_t)(entry_ptr->fd_parent_count)))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "memory allocation failed for fd parent addrs buffer") + "memory allocation failed for fd parent addrs buffer"); for (int i = 0; i < (int)(entry_ptr->fd_parent_count); i++) { entry_ptr->fd_parent_addrs[i] = entry_ptr->flush_dep_parent[i]->addr; - HDassert(H5F_addr_defined(entry_ptr->fd_parent_addrs[i])); + assert(H5_addr_defined(entry_ptr->fd_parent_addrs[i])); } /* end for */ } /* end if */ else if (entry_ptr->fd_parent_count > 0) { - HDassert(entry_ptr->fd_parent_addrs); + assert(entry_ptr->fd_parent_addrs); entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree(entry_ptr->fd_parent_addrs); } /* end else-if */ else - HDassert(entry_ptr->fd_parent_addrs == NULL); + assert(entry_ptr->fd_parent_addrs == NULL); /* Initially, all flush dependency children are included int * the count of flush dependency child relationships to be @@ -2879,19 +2221,23 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) */ if (entry_ptr->flush_dep_nchildren > 0) { if (!entry_ptr->is_pinned) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "encountered unpinned fd parent?!?") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "encountered unpinned fd parent?!?"); entry_ptr->fd_child_count = entry_ptr->flush_dep_nchildren; entry_ptr->fd_dirty_child_count = entry_ptr->flush_dep_ndirty_children; } /* end if */ +#ifndef NDEBUG num_entries_tentatively_in_image++; +#endif } /* end if */ +#ifndef NDEBUG entries_visited++; +#endif entry_ptr = entry_ptr->il_next; } /* end while */ - HDassert(entries_visited == cache_ptr->index_len); + assert(entries_visited == cache_ptr->index_len); /* Now compute the flush dependency heights of all flush dependency * relationships to be represented in the image. @@ -2917,17 +2263,17 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) * call, computation of the image size is delayed. */ if (H5C__prep_for_file_close__compute_fd_heights(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "computation of flush dependency heights failed?!?") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "computation of flush dependency heights failed?!?"); - /* At this point, all entries that will appear in the cache - * image should be marked correctly. Compute the size of the - * cache image. - */ + /* At this point, all entries that will appear in the cache + * image should be marked correctly. Compute the size of the + * cache image. + */ +#ifndef NDEBUG entries_visited = 0; - entry_ptr = cache_ptr->il_head; +#endif + entry_ptr = cache_ptr->il_head; while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - if (entry_ptr->include_in_image) { if (entry_ptr->fd_parent_count > 0) fd_parents_list_len = (size_t)(H5F_SIZEOF_ADDR(f) * entry_ptr->fd_parent_count); @@ -2938,23 +2284,29 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) num_entries_in_image++; } /* end if */ +#ifndef NDEBUG entries_visited++; +#endif entry_ptr = entry_ptr->il_next; } /* end while */ - HDassert(entries_visited == cache_ptr->index_len); - HDassert(num_entries_in_image <= num_entries_tentatively_in_image); + assert(entries_visited == cache_ptr->index_len); + assert(num_entries_in_image <= num_entries_tentatively_in_image); #ifndef NDEBUG - unsigned j = 0; - for (int i = H5C_MAX_RING_IN_IMAGE + 1; i <= H5C_RING_SB; i++) - j += cache_ptr->index_ring_len[i]; + { + unsigned j = 0; + for (int i = H5C_MAX_RING_IN_IMAGE + 1; i <= H5C_RING_SB; i++) + j += cache_ptr->index_ring_len[i]; - /* This will change */ - HDassert(entries_visited == (num_entries_tentatively_in_image + j)); + /* This will change */ + assert(entries_visited == (num_entries_tentatively_in_image + j)); + } #endif cache_ptr->num_entries_in_image = num_entries_in_image; - entries_visited = 0; +#ifndef NDEBUG + entries_visited = 0; +#endif /* Now scan the LRU list to set the lru_rank fields of all entries * on the LRU. @@ -2968,8 +2320,7 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) */ entry_ptr = cache_ptr->LRU_head_ptr; while (entry_ptr != NULL) { - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->type != NULL); + assert(entry_ptr->type != NULL); /* to avoid confusion, don't set lru_rank on epoch markers. * Note that we still increment the lru_rank, so that the holes @@ -2987,10 +2338,12 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) lru_rank++; } /* end else-if */ +#ifndef NDEBUG entries_visited++; +#endif entry_ptr = entry_ptr->next; } /* end while */ - HDassert(entries_visited == cache_ptr->LRU_list_len); + assert(entries_visited == cache_ptr->LRU_list_len); image_len += H5F_SIZEOF_CHKSUM; cache_ptr->image_data_len = image_len; @@ -3010,9 +2363,6 @@ H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr) * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 8/14/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -3027,24 +2377,23 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(cache_ptr == f->shared->cache); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->image_buffer); - HDassert(cache_ptr->image_len > 0); + assert(f); + assert(f->shared); + assert(cache_ptr == f->shared->cache); + assert(cache_ptr); + assert(cache_ptr->image_buffer); + assert(cache_ptr->image_len > 0); /* Decode metadata cache image header */ p = (uint8_t *)cache_ptr->image_buffer; if (H5C__decode_cache_image_header(f, cache_ptr, &p) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "cache image header decode failed") - HDassert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_len); + HGOTO_ERROR(H5E_CACHE, H5E_CANTDECODE, FAIL, "cache image header decode failed"); + assert((size_t)(p - (uint8_t *)cache_ptr->image_buffer) < cache_ptr->image_len); /* The image_data_len and # of entries should be defined now */ - HDassert(cache_ptr->image_data_len > 0); - HDassert(cache_ptr->image_data_len <= cache_ptr->image_len); - HDassert(cache_ptr->num_entries_in_image > 0); + assert(cache_ptr->image_data_len > 0); + assert(cache_ptr->image_data_len <= cache_ptr->image_len); + assert(cache_ptr->num_entries_in_image > 0); /* Reconstruct entries in image */ for (u = 0; u < cache_ptr->num_entries_in_image; u++) { @@ -3052,7 +2401,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) * entry in cache_ptr->image_entrise. */ if (NULL == (pf_entry_ptr = H5C__reconstruct_cache_entry(f, cache_ptr, &p))) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "reconstruction of cache entry failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "reconstruction of cache entry failed"); /* Note that we make no checks on available cache space before * inserting the reconstructed entry into the metadata cache. @@ -3063,48 +2412,47 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) */ /* Insert the prefetched entry in the index */ - H5C__INSERT_IN_INDEX(cache_ptr, pf_entry_ptr, FAIL) + H5C__INSERT_IN_INDEX(cache_ptr, pf_entry_ptr, FAIL); /* If dirty, insert the entry into the slist. */ if (pf_entry_ptr->is_dirty) - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, pf_entry_ptr, FAIL) + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, pf_entry_ptr, FAIL); /* Append the entry to the LRU */ - H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, pf_entry_ptr, FAIL) + H5C__UPDATE_RP_FOR_INSERT_APPEND(cache_ptr, pf_entry_ptr, FAIL); - H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, pf_entry_ptr->is_dirty) + H5C__UPDATE_STATS_FOR_PREFETCH(cache_ptr, pf_entry_ptr->is_dirty); /* If the prefetched entry is the child in one or more flush * dependency relationships, recreate those flush dependencies. */ for (v = 0; v < pf_entry_ptr->fd_parent_count; v++) { /* Sanity checks */ - HDassert(pf_entry_ptr->fd_parent_addrs); - HDassert(H5F_addr_defined(pf_entry_ptr->fd_parent_addrs[v])); + assert(pf_entry_ptr->fd_parent_addrs); + assert(H5_addr_defined(pf_entry_ptr->fd_parent_addrs[v])); /* Find the parent entry */ parent_ptr = NULL; - H5C__SEARCH_INDEX(cache_ptr, pf_entry_ptr->fd_parent_addrs[v], parent_ptr, FAIL) + H5C__SEARCH_INDEX(cache_ptr, pf_entry_ptr->fd_parent_addrs[v], parent_ptr, FAIL); if (parent_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "fd parent not in cache?!?") + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "fd parent not in cache?!?"); /* Sanity checks */ - HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(parent_ptr->addr == pf_entry_ptr->fd_parent_addrs[v]); - HDassert(parent_ptr->lru_rank == -1); + assert(parent_ptr->addr == pf_entry_ptr->fd_parent_addrs[v]); + assert(parent_ptr->lru_rank == -1); /* Must protect parent entry to set up a flush dependency. * Do this now, and then uprotect when done. */ - H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, parent_ptr, FAIL) + H5C__UPDATE_RP_FOR_PROTECT(cache_ptr, parent_ptr, FAIL); parent_ptr->is_protected = TRUE; /* Setup the flush dependency */ if (H5C_create_flush_dependency(parent_ptr, pf_entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Can't restore flush dependency") + HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "Can't restore flush dependency"); /* And now unprotect */ - H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, parent_ptr, FAIL) + H5C__UPDATE_RP_FOR_UNPROTECT(cache_ptr, parent_ptr, FAIL); parent_ptr->is_protected = FALSE; } /* end for */ } /* end for */ @@ -3115,24 +2463,22 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) */ pf_entry_ptr = cache_ptr->il_head; while (pf_entry_ptr != NULL) { - HDassert(pf_entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert((pf_entry_ptr->prefetched && pf_entry_ptr->type == H5AC_PREFETCHED_ENTRY) || - (!pf_entry_ptr->prefetched && pf_entry_ptr->type != H5AC_PREFETCHED_ENTRY)); + assert((pf_entry_ptr->prefetched && pf_entry_ptr->type == H5AC_PREFETCHED_ENTRY) || + (!pf_entry_ptr->prefetched && pf_entry_ptr->type != H5AC_PREFETCHED_ENTRY)); if (pf_entry_ptr->type == H5AC_PREFETCHED_ENTRY) - HDassert(pf_entry_ptr->fd_parent_count == pf_entry_ptr->flush_dep_nparents); + assert(pf_entry_ptr->fd_parent_count == pf_entry_ptr->flush_dep_nparents); for (v = 0; v < pf_entry_ptr->fd_parent_count; v++) { parent_ptr = pf_entry_ptr->flush_dep_parent[v]; - HDassert(parent_ptr); - HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(pf_entry_ptr->fd_parent_addrs); - HDassert(pf_entry_ptr->fd_parent_addrs[v] == parent_ptr->addr); - HDassert(parent_ptr->flush_dep_nchildren > 0); + assert(parent_ptr); + assert(pf_entry_ptr->fd_parent_addrs); + assert(pf_entry_ptr->fd_parent_addrs[v] == parent_ptr->addr); + assert(parent_ptr->flush_dep_nchildren > 0); } /* end for */ if (pf_entry_ptr->type == H5AC_PREFETCHED_ENTRY) { - HDassert(pf_entry_ptr->fd_child_count == pf_entry_ptr->flush_dep_nchildren); - HDassert(pf_entry_ptr->fd_dirty_child_count == pf_entry_ptr->flush_dep_ndirty_children); + assert(pf_entry_ptr->fd_child_count == pf_entry_ptr->flush_dep_nchildren); + assert(pf_entry_ptr->fd_dirty_child_count == pf_entry_ptr->flush_dep_ndirty_children); } /* end if */ pf_entry_ptr = pf_entry_ptr->il_next; @@ -3148,23 +2494,16 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) i = -1; entry_ptr = cache_ptr->LRU_head_ptr; - while (entry_ptr != NULL) { - - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->type != NULL); + assert(entry_ptr->type != NULL); if (entry_ptr->prefetched) { - - HDassert(entry_ptr->lru_rank != 0); - HDassert((entry_ptr->lru_rank == -1) || (entry_ptr->lru_rank > i)); + assert(entry_ptr->lru_rank != 0); + assert((entry_ptr->lru_rank == -1) || (entry_ptr->lru_rank > i)); if ((entry_ptr->lru_rank > 1) && (entry_ptr->lru_rank > i + 1)) - lru_rank_holes += entry_ptr->lru_rank - (i + 1); - i = entry_ptr->lru_rank; - } /* end if */ entry_ptr = entry_ptr->next; @@ -3176,9 +2515,9 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) * the following sanity check will have to be revised when * we add code to store and restore adaptive resize status. */ - HDassert(lru_rank_holes <= H5C__MAX_EPOCH_MARKERS); - } /* end block */ -#endif /* NDEBUG */ + assert(lru_rank_holes <= H5C__MAX_EPOCH_MARKERS); + } /* end block */ +#endif /* Check to see if the cache is oversize, and evict entries as * necessary to remain within limits. @@ -3189,15 +2528,13 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) */ hbool_t write_permitted = FALSE; - if (cache_ptr->check_write_permitted != NULL) { - if ((cache_ptr->check_write_permitted)(f, &write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "Can't get write_permitted") - } /* end if */ + if (cache_ptr->check_write_permitted && (cache_ptr->check_write_permitted)(f, &write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "Can't get write_permitted"); else write_permitted = cache_ptr->write_permitted; if (H5C__make_space_in_cache(f, 0, write_permitted) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "H5C__make_space_in_cache failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, FAIL, "H5C__make_space_in_cache failed"); } /* end if */ done: @@ -3216,9 +2553,6 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr) * Return: Pointer to the new instance of H5C_cache_entry on success, * or NULL on failure. * - * Programmer: John Mainzer - * 8/14/15 - * *------------------------------------------------------------------------- */ static H5C_cache_entry_t * @@ -3231,7 +2565,7 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b hbool_t in_lru = FALSE; hbool_t is_fd_parent = FALSE; hbool_t is_fd_child = FALSE; -#endif /* NDEBUG */ /* only used in assertions */ +#endif const uint8_t *p; hbool_t file_is_rw; H5C_cache_entry_t *ret_value = NULL; /* Return value */ @@ -3239,17 +2573,16 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->num_entries_in_image > 0); - HDassert(buf && *buf); + assert(cache_ptr); + assert(cache_ptr->num_entries_in_image > 0); + assert(buf && *buf); /* Key R/W access off of whether the image will be deleted */ file_is_rw = cache_ptr->delete_image; /* Allocate space for the prefetched cache entry */ if (NULL == (pf_entry_ptr = H5FL_CALLOC(H5C_cache_entry_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for prefetched cache entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for prefetched cache entry"); /* Get pointer to buffer */ p = *buf; @@ -3268,7 +2601,7 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b is_fd_parent = TRUE; if (flags & H5C__MDCI_ENTRY_IS_FD_CHILD_FLAG) is_fd_child = TRUE; -#endif /* NDEBUG */ /* only used in assertions */ +#endif /* Force dirty entries to clean if the file read only -- must do * this as otherwise the cache will attempt to write them on file @@ -3286,46 +2619,46 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b /* Decode ring */ pf_entry_ptr->ring = *p++; - HDassert(pf_entry_ptr->ring > (uint8_t)(H5C_RING_UNDEFINED)); - HDassert(pf_entry_ptr->ring < (uint8_t)(H5C_RING_NTYPES)); + assert(pf_entry_ptr->ring > (uint8_t)(H5C_RING_UNDEFINED)); + assert(pf_entry_ptr->ring < (uint8_t)(H5C_RING_NTYPES)); /* Decode age */ pf_entry_ptr->age = *p++; /* Decode dependency child count */ UINT16DECODE(p, pf_entry_ptr->fd_child_count); - HDassert((is_fd_parent && pf_entry_ptr->fd_child_count > 0) || - (!is_fd_parent && pf_entry_ptr->fd_child_count == 0)); + assert((is_fd_parent && pf_entry_ptr->fd_child_count > 0) || + (!is_fd_parent && pf_entry_ptr->fd_child_count == 0)); /* Decode dirty dependency child count */ UINT16DECODE(p, pf_entry_ptr->fd_dirty_child_count); if (!file_is_rw) pf_entry_ptr->fd_dirty_child_count = 0; if (pf_entry_ptr->fd_dirty_child_count > pf_entry_ptr->fd_child_count) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid dirty flush dependency child count") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid dirty flush dependency child count"); /* Decode dependency parent count */ UINT16DECODE(p, pf_entry_ptr->fd_parent_count); - HDassert((is_fd_child && pf_entry_ptr->fd_parent_count > 0) || - (!is_fd_child && pf_entry_ptr->fd_parent_count == 0)); + assert((is_fd_child && pf_entry_ptr->fd_parent_count > 0) || + (!is_fd_child && pf_entry_ptr->fd_parent_count == 0)); /* Decode index in LRU */ INT32DECODE(p, pf_entry_ptr->lru_rank); - HDassert((in_lru && pf_entry_ptr->lru_rank >= 0) || (!in_lru && pf_entry_ptr->lru_rank == -1)); + assert((in_lru && pf_entry_ptr->lru_rank >= 0) || (!in_lru && pf_entry_ptr->lru_rank == -1)); /* Decode entry offset */ H5F_addr_decode(f, &p, &pf_entry_ptr->addr); - if (!H5F_addr_defined(pf_entry_ptr->addr)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry offset") + if (!H5_addr_defined(pf_entry_ptr->addr)) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry offset"); /* Decode entry length */ H5F_DECODE_LENGTH(f, p, pf_entry_ptr->size); if (pf_entry_ptr->size == 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry size") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid entry size"); /* Verify expected length of entry image */ if ((size_t)(p - *buf) != H5C__cache_image_block_entry_header_size(f)) - HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, NULL, "Bad entry image len") + HGOTO_ERROR(H5E_CACHE, H5E_BADSIZE, NULL, "Bad entry image len"); /* If parent count greater than zero, allocate array for parent * addresses, and decode addresses into the array. @@ -3335,18 +2668,19 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b if (NULL == (pf_entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_malloc( (size_t)(pf_entry_ptr->fd_parent_count) * H5F_SIZEOF_ADDR(f)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for fd parent addrs buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, + "memory allocation failed for fd parent addrs buffer"); for (u = 0; u < pf_entry_ptr->fd_parent_count; u++) { H5F_addr_decode(f, &p, &(pf_entry_ptr->fd_parent_addrs[u])); - if (!H5F_addr_defined(pf_entry_ptr->fd_parent_addrs[u])) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid flush dependency parent offset") + if (!H5_addr_defined(pf_entry_ptr->fd_parent_addrs[u])) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "invalid flush dependency parent offset"); } /* end for */ } /* end if */ /* Allocate buffer for entry image */ if (NULL == (pf_entry_ptr->image_ptr = H5MM_malloc(pf_entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer"); #if H5C_DO_MEMORY_SANITY_CHECKS H5MM_memcpy(((uint8_t *)pf_entry_ptr->image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ @@ -3357,7 +2691,6 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b /* Initialize the rest of the fields in the prefetched entry */ /* (Only need to set non-zero/NULL/FALSE fields, due to calloc() above) */ - pf_entry_ptr->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; pf_entry_ptr->cache_ptr = cache_ptr; pf_entry_ptr->image_up_to_date = TRUE; pf_entry_ptr->type = H5AC_PREFETCHED_ENTRY; @@ -3365,7 +2698,7 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b pf_entry_ptr->prefetched_dirty = is_dirty && (!file_is_rw); /* Sanity checks */ - HDassert(pf_entry_ptr->size > 0 && pf_entry_ptr->size < H5C_MAX_ENTRY_SIZE); + assert(pf_entry_ptr->size > 0 && pf_entry_ptr->size < H5C_MAX_ENTRY_SIZE); /* Update buffer pointer */ *buf = p; @@ -3392,8 +2725,6 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, const uint8_t **b * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer, 7/4/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -3409,13 +2740,12 @@ H5C__write_cache_image_superblock_msg(H5F_t *f, hbool_t create) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->cache); + assert(f); + assert(f->shared); + assert(f->shared->cache); cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->close_warning_received); + assert(cache_ptr); + assert(cache_ptr->close_warning_received); /* Write data into the metadata cache image superblock extension message. * Note that this data will be bogus when we first create the message. @@ -3426,8 +2756,7 @@ H5C__write_cache_image_superblock_msg(H5F_t *f, hbool_t create) if (cache_ptr->aux_ptr) { /* we have multiple processes */ H5AC_aux_t *aux_ptr; - aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr; - HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); + aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr; mdci_msg.size = aux_ptr->p0_image_len; } /* end if */ else @@ -3437,7 +2766,7 @@ H5C__write_cache_image_superblock_msg(H5F_t *f, hbool_t create) /* Write metadata cache image message to superblock extension */ if (H5F__super_ext_write_msg(f, H5O_MDCI_MSG_ID, &mdci_msg, create, mesg_flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, - "can't write metadata cache image message to superblock extension") + "can't write metadata cache image message to superblock extension"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3451,9 +2780,6 @@ H5C__write_cache_image_superblock_msg(H5F_t *f, hbool_t create) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 8/26/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -3464,24 +2790,23 @@ H5C__write_cache_image(H5F_t *f, const H5C_t *cache_ptr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(cache_ptr); - HDassert(H5F_addr_defined(cache_ptr->image_addr)); - HDassert(cache_ptr->image_len > 0); - HDassert(cache_ptr->image_buffer); + assert(f); + assert(cache_ptr); + assert(H5_addr_defined(cache_ptr->image_addr)); + assert(cache_ptr->image_len > 0); + assert(cache_ptr->image_buffer); #ifdef H5_HAVE_PARALLEL { H5AC_aux_t *aux_ptr = (H5AC_aux_t *)cache_ptr->aux_ptr; - if ((NULL == aux_ptr) || (aux_ptr->mpi_rank == 0)) { - HDassert((NULL == aux_ptr) || (aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC)); + if (NULL == aux_ptr || aux_ptr->mpi_rank == 0) { #endif /* H5_HAVE_PARALLEL */ /* Write the buffer (if serial access, or rank 0 for parallel access) */ if (H5F_block_write(f, H5FD_MEM_SUPER, cache_ptr->image_addr, cache_ptr->image_len, cache_ptr->image_buffer) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't write metadata cache image block to file") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't write metadata cache image block to file"); #ifdef H5_HAVE_PARALLEL } /* end if */ } /* end block */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Cint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Cint.c new file mode 100644 index 0000000000..eb9b64cd74 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Cint.c @@ -0,0 +1,2508 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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: H5Centry.c + * + * Purpose: Routines which operate on cache entries. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ +#define H5F_FRIEND /* suppress error about including H5Fpkg */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Cpkg.h" /* Cache */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5MFprivate.h" /* File memory management */ + +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Local Prototypes */ +/********************/ +static herr_t H5C__autoadjust__ageout(H5F_t *f, double hit_rate, enum H5C_resize_status *status_ptr, + size_t *new_max_cache_size_ptr, hbool_t write_permitted); +static herr_t H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t *cache_ptr); +static herr_t H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *f, hbool_t write_permitted); +static herr_t H5C__autoadjust__ageout__insert_new_marker(H5C_t *cache_ptr); +static herr_t H5C__flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags); +static herr_t H5C__serialize_ring(H5F_t *f, H5C_ring_t ring); + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +/*------------------------------------------------------------------------- + * Function: H5C__auto_adjust_cache_size + * + * Purpose: Obtain the current full cache hit rate, and compare it + * with the hit rate thresholds for modifying cache size. + * If one of the thresholds has been crossed, adjusts the + * size of the cache accordingly. + * + * The function then resets the full cache hit rate + * statistics, and exits. + * + * Return: Non-negative on success/Negative on failure or if there was + * an attempt to flush a protected item. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__auto_adjust_cache_size(H5F_t *f, hbool_t write_permitted) +{ + H5C_t *cache_ptr = f->shared->cache; + hbool_t reentrant_call = FALSE; + hbool_t inserted_epoch_marker = FALSE; + size_t new_max_cache_size = 0; + size_t old_max_cache_size = 0; + size_t new_min_clean_size = 0; + size_t old_min_clean_size = 0; + double hit_rate; + enum H5C_resize_status status = in_spec; /* will change if needed */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(f); + assert(cache_ptr); + assert(cache_ptr->cache_accesses >= cache_ptr->resize_ctl.epoch_length); + assert(0.0 <= cache_ptr->resize_ctl.min_clean_fraction); + assert(cache_ptr->resize_ctl.min_clean_fraction <= 100.0); + + /* check to see if cache_ptr->resize_in_progress is TRUE. If it, this + * is a re-entrant call via a client callback called in the resize + * process. To avoid an infinite recursion, set reentrant_call to + * TRUE, and goto done. + */ + if (cache_ptr->resize_in_progress) { + reentrant_call = TRUE; + HGOTO_DONE(SUCCEED); + } /* end if */ + + cache_ptr->resize_in_progress = TRUE; + + if (!cache_ptr->resize_enabled) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Auto cache resize disabled"); + + assert((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) || + (cache_ptr->resize_ctl.decr_mode != H5C_decr__off)); + + if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate"); + + assert((0.0 <= hit_rate) && (hit_rate <= 1.0)); + + switch (cache_ptr->resize_ctl.incr_mode) { + case H5C_incr__off: + if (cache_ptr->size_increase_possible) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "size_increase_possible but H5C_incr__off?!?!?"); + break; + + case H5C_incr__threshold: + if (hit_rate < cache_ptr->resize_ctl.lower_hr_threshold) { + if (!cache_ptr->size_increase_possible) + status = increase_disabled; + else if (cache_ptr->max_cache_size >= cache_ptr->resize_ctl.max_size) { + assert(cache_ptr->max_cache_size == cache_ptr->resize_ctl.max_size); + status = at_max_size; + } + else if (!cache_ptr->cache_full) + status = not_full; + else { + new_max_cache_size = + (size_t)(((double)(cache_ptr->max_cache_size)) * cache_ptr->resize_ctl.increment); + + /* clip to max size if necessary */ + if (new_max_cache_size > cache_ptr->resize_ctl.max_size) + new_max_cache_size = cache_ptr->resize_ctl.max_size; + + /* clip to max increment if necessary */ + if (cache_ptr->resize_ctl.apply_max_increment && + ((cache_ptr->max_cache_size + cache_ptr->resize_ctl.max_increment) < + new_max_cache_size)) + new_max_cache_size = cache_ptr->max_cache_size + cache_ptr->resize_ctl.max_increment; + + status = increase; + } + } + break; + + default: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode"); + } + + /* If the decr_mode is either age out or age out with threshold, we + * must run the marker maintenance code, whether we run the size + * reduction code or not. We do this in two places -- here we + * insert a new marker if the number of active epoch markers is + * is less than the current epochs before eviction, and after + * the ageout call, we cycle the markers. + * + * However, we can't call the ageout code or cycle the markers + * unless there was a full complement of markers in place on + * entry. The inserted_epoch_marker flag is used to track this. + */ + + if (((cache_ptr->resize_ctl.decr_mode == H5C_decr__age_out) || + (cache_ptr->resize_ctl.decr_mode == H5C_decr__age_out_with_threshold)) && + (cache_ptr->epoch_markers_active < cache_ptr->resize_ctl.epochs_before_eviction)) { + + if (H5C__autoadjust__ageout__insert_new_marker(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't insert new epoch marker"); + + inserted_epoch_marker = TRUE; + } + + /* don't run the cache size decrease code unless the cache size + * increase code is disabled, or the size increase code sees no need + * for action. In either case, status == in_spec at this point. + */ + + if (status == in_spec) { + switch (cache_ptr->resize_ctl.decr_mode) { + case H5C_decr__off: + break; + + case H5C_decr__threshold: + if (hit_rate > cache_ptr->resize_ctl.upper_hr_threshold) { + if (!cache_ptr->size_decrease_possible) + status = decrease_disabled; + else if (cache_ptr->max_cache_size <= cache_ptr->resize_ctl.min_size) { + assert(cache_ptr->max_cache_size == cache_ptr->resize_ctl.min_size); + status = at_min_size; + } + else { + new_max_cache_size = + (size_t)(((double)(cache_ptr->max_cache_size)) * cache_ptr->resize_ctl.decrement); + + /* clip to min size if necessary */ + if (new_max_cache_size < cache_ptr->resize_ctl.min_size) + new_max_cache_size = cache_ptr->resize_ctl.min_size; + + /* clip to max decrement if necessary */ + if (cache_ptr->resize_ctl.apply_max_decrement && + ((cache_ptr->resize_ctl.max_decrement + new_max_cache_size) < + cache_ptr->max_cache_size)) + new_max_cache_size = + cache_ptr->max_cache_size - cache_ptr->resize_ctl.max_decrement; + + status = decrease; + } + } + break; + + case H5C_decr__age_out_with_threshold: + case H5C_decr__age_out: + if (!inserted_epoch_marker) { + if (!cache_ptr->size_decrease_possible) + status = decrease_disabled; + else { + if (H5C__autoadjust__ageout(f, hit_rate, &status, &new_max_cache_size, + write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ageout code failed"); + } /* end else */ + } /* end if */ + break; + + default: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unknown incr_mode"); + } + } + + /* cycle the epoch markers here if appropriate */ + if (((cache_ptr->resize_ctl.decr_mode == H5C_decr__age_out) || + (cache_ptr->resize_ctl.decr_mode == H5C_decr__age_out_with_threshold)) && + !inserted_epoch_marker) + /* move last epoch marker to the head of the LRU list */ + if (H5C__autoadjust__ageout__cycle_epoch_marker(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error cycling epoch marker"); + + if ((status == increase) || (status == decrease)) { + old_max_cache_size = cache_ptr->max_cache_size; + old_min_clean_size = cache_ptr->min_clean_size; + + new_min_clean_size = + (size_t)((double)new_max_cache_size * (cache_ptr->resize_ctl.min_clean_fraction)); + + /* new_min_clean_size is of size_t, and thus must be non-negative. + * Hence we have + * + * ( 0 <= new_min_clean_size ). + * + * by definition. + */ + assert(new_min_clean_size <= new_max_cache_size); + assert(cache_ptr->resize_ctl.min_size <= new_max_cache_size); + assert(new_max_cache_size <= cache_ptr->resize_ctl.max_size); + + cache_ptr->max_cache_size = new_max_cache_size; + cache_ptr->min_clean_size = new_min_clean_size; + + if (status == increase) + cache_ptr->cache_full = FALSE; + else if (status == decrease) + cache_ptr->size_decreased = TRUE; + + /* update flash cache size increase fields as appropriate */ + if (cache_ptr->flash_size_increase_possible) { + switch (cache_ptr->resize_ctl.flash_incr_mode) { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "flash_size_increase_possible but H5C_flash_incr__off?!"); + break; + + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_threshold = + (size_t)(((double)(cache_ptr->max_cache_size)) * + (cache_ptr->resize_ctl.flash_threshold)); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?"); + break; + } + } + } + + if (cache_ptr->resize_ctl.rpt_fcn != NULL) + (cache_ptr->resize_ctl.rpt_fcn)(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate, status, + old_max_cache_size, new_max_cache_size, old_min_clean_size, + new_min_clean_size); + + if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) + /* this should be impossible... */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed"); + +done: + /* Sanity checks */ + assert(cache_ptr->resize_in_progress); + if (!reentrant_call) + cache_ptr->resize_in_progress = FALSE; + assert((!reentrant_call) || (cache_ptr->resize_in_progress)); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__auto_adjust_cache_size() */ + +/*------------------------------------------------------------------------- + * Function: H5C__autoadjust__ageout + * + * Purpose: Implement the ageout automatic cache size decrement + * algorithm. Note that while this code evicts aged out + * entries, the code does not change the maximum cache size. + * Instead, the function simply computes the new value (if + * any change is indicated) and reports this value in + * *new_max_cache_size_ptr. + * + * Return: Non-negative on success/Negative on failure or if there was + * an attempt to flush a protected item. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__autoadjust__ageout(H5F_t *f, double hit_rate, enum H5C_resize_status *status_ptr, + size_t *new_max_cache_size_ptr, hbool_t write_permitted) +{ + H5C_t *cache_ptr = f->shared->cache; + size_t test_size; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(f); + assert(cache_ptr); + assert((status_ptr) && (*status_ptr == in_spec)); + assert((new_max_cache_size_ptr) && (*new_max_cache_size_ptr == 0)); + + /* remove excess epoch markers if any */ + if (cache_ptr->epoch_markers_active > cache_ptr->resize_ctl.epochs_before_eviction) + if (H5C__autoadjust__ageout__remove_excess_markers(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't remove excess epoch markers"); + + if ((cache_ptr->resize_ctl.decr_mode == H5C_decr__age_out) || + ((cache_ptr->resize_ctl.decr_mode == H5C_decr__age_out_with_threshold) && + (hit_rate >= cache_ptr->resize_ctl.upper_hr_threshold))) { + + if (cache_ptr->max_cache_size > cache_ptr->resize_ctl.min_size) { + /* evict aged out cache entries if appropriate... */ + if (H5C__autoadjust__ageout__evict_aged_out_entries(f, write_permitted) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error flushing aged out entries"); + + /* ... and then reduce cache size if appropriate */ + if (cache_ptr->index_size < cache_ptr->max_cache_size) { + if (cache_ptr->resize_ctl.apply_empty_reserve) { + test_size = + (size_t)(((double)cache_ptr->index_size) / (1 - cache_ptr->resize_ctl.empty_reserve)); + if (test_size < cache_ptr->max_cache_size) { + *status_ptr = decrease; + *new_max_cache_size_ptr = test_size; + } + } + else { + *status_ptr = decrease; + *new_max_cache_size_ptr = cache_ptr->index_size; + } + + if (*status_ptr == decrease) { + /* clip to min size if necessary */ + if (*new_max_cache_size_ptr < cache_ptr->resize_ctl.min_size) + *new_max_cache_size_ptr = cache_ptr->resize_ctl.min_size; + + /* clip to max decrement if necessary */ + if ((cache_ptr->resize_ctl.apply_max_decrement) && + ((cache_ptr->resize_ctl.max_decrement + *new_max_cache_size_ptr) < + cache_ptr->max_cache_size)) + *new_max_cache_size_ptr = + cache_ptr->max_cache_size - cache_ptr->resize_ctl.max_decrement; + } + } + } + else + *status_ptr = at_min_size; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__autoadjust__ageout() */ + +/*------------------------------------------------------------------------- + * Function: H5C__autoadjust__ageout__cycle_epoch_marker + * + * Purpose: Remove the oldest epoch marker from the LRU list, + * and reinsert it at the head of the LRU list. Also + * remove the epoch marker's index from the head of the + * ring buffer, and re-insert it at the tail of the ring + * buffer. + * + * Return: SUCCEED on success/FAIL on failure. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__autoadjust__ageout__cycle_epoch_marker(H5C_t *cache_ptr) +{ + int i; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(cache_ptr); + + if (cache_ptr->epoch_markers_active <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "No active epoch markers on entry?!?!?"); + + /* remove the last marker from both the ring buffer and the LRU list */ + i = cache_ptr->epoch_marker_ringbuf[cache_ptr->epoch_marker_ringbuf_first]; + cache_ptr->epoch_marker_ringbuf_first = + (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); + if (cache_ptr->epoch_marker_ringbuf_size <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow"); + + cache_ptr->epoch_marker_ringbuf_size -= 1; + if (cache_ptr->epoch_marker_active[i] != TRUE) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?"); + + H5C__DLL_REMOVE((&((cache_ptr->epoch_markers)[i])), (cache_ptr)->LRU_head_ptr, (cache_ptr)->LRU_tail_ptr, + (cache_ptr)->LRU_list_len, (cache_ptr)->LRU_list_size, (FAIL)) + + /* now, re-insert it at the head of the LRU list, and at the tail of + * the ring buffer. + */ + assert(cache_ptr->epoch_markers[i].addr == (haddr_t)i); + assert(cache_ptr->epoch_markers[i].next == NULL); + assert(cache_ptr->epoch_markers[i].prev == NULL); + + cache_ptr->epoch_marker_ringbuf_last = + (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1); + cache_ptr->epoch_marker_ringbuf[cache_ptr->epoch_marker_ringbuf_last] = i; + if (cache_ptr->epoch_marker_ringbuf_size >= H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow"); + + cache_ptr->epoch_marker_ringbuf_size += 1; + + H5C__DLL_PREPEND(&(cache_ptr->epoch_markers[i]), cache_ptr->LRU_head_ptr, cache_ptr->LRU_tail_ptr, + cache_ptr->LRU_list_len, cache_ptr->LRU_list_size, FAIL) +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5C__autoadjust__ageout__cycle_epoch_marker() */ + +/*------------------------------------------------------------------------- + * Function: H5C__autoadjust__ageout__evict_aged_out_entries + * + * Purpose: Evict clean entries in the cache that haven't + * been accessed for at least + * cache_ptr->resize_ctl.epochs_before_eviction epochs, + * and flush dirty entries that haven't been accessed for + * that amount of time. + * + * Depending on configuration, the function will either + * flush or evict all such entries, or all such entries it + * encounters until it has freed the maximum amount of space + * allowed under the maximum decrement. + * + * If we are running in parallel mode, writes may not be + * permitted. If so, the function simply skips any dirty + * entries it may encounter. + * + * The function makes no attempt to maintain the minimum + * clean size, as there is no guarantee that the cache size + * will be changed. + * + * If there is no cache size change, the minimum clean size + * constraint will be met through a combination of clean + * entries and free space in the cache. + * + * If there is a cache size reduction, the minimum clean size + * will be re-calculated, and will be enforced the next time + * we have to make space in the cache. + * + * Return: Non-negative on success/Negative on failure. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t *f, hbool_t write_permitted) +{ + H5C_t *cache_ptr = f->shared->cache; + size_t eviction_size_limit; + size_t bytes_evicted = 0; + hbool_t prev_is_dirty = FALSE; + hbool_t restart_scan; + H5C_cache_entry_t *entry_ptr; + H5C_cache_entry_t *next_ptr; + H5C_cache_entry_t *prev_ptr; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(f); + assert(cache_ptr); + + /* if there is a limit on the amount that the cache size can be decrease + * in any one round of the cache size reduction algorithm, load that + * limit into eviction_size_limit. Otherwise, set eviction_size_limit + * to the equivalent of infinity. The current size of the index will + * do nicely. + */ + if (cache_ptr->resize_ctl.apply_max_decrement) + eviction_size_limit = cache_ptr->resize_ctl.max_decrement; + else + eviction_size_limit = cache_ptr->index_size; /* i.e. infinity */ + + if (write_permitted) { + restart_scan = FALSE; + entry_ptr = cache_ptr->LRU_tail_ptr; + while (entry_ptr != NULL && entry_ptr->type->id != H5AC_EPOCH_MARKER_ID && + bytes_evicted < eviction_size_limit) { + hbool_t skipping_entry = FALSE; + + assert(!(entry_ptr->is_protected)); + assert(!(entry_ptr->is_read_only)); + assert((entry_ptr->ro_ref_count) == 0); + + next_ptr = entry_ptr->next; + prev_ptr = entry_ptr->prev; + + if (prev_ptr != NULL) + prev_is_dirty = prev_ptr->is_dirty; + + if (entry_ptr->is_dirty) { + assert(!entry_ptr->prefetched_dirty); + + /* dirty corked entry is skipped */ + if (entry_ptr->tag_info && entry_ptr->tag_info->corked) + skipping_entry = TRUE; + else { + /* reset entries_removed_counter and + * last_entry_removed_ptr prior to the call to + * H5C__flush_single_entry() so that we can spot + * unexpected removals of entries from the cache, + * and set the restart_scan flag if proceeding + * would be likely to cause us to scan an entry + * that is no longer in the cache. + */ + cache_ptr->entries_removed_counter = 0; + cache_ptr->last_entry_removed_ptr = NULL; + + if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry"); + + if (cache_ptr->entries_removed_counter > 1 || + cache_ptr->last_entry_removed_ptr == prev_ptr) + restart_scan = TRUE; + } /* end else */ + } /* end if */ + else if (!entry_ptr->prefetched_dirty) { + bytes_evicted += entry_ptr->size; + + if (H5C__flush_single_entry( + f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry"); + } /* end else-if */ + else { + assert(!entry_ptr->is_dirty); + assert(entry_ptr->prefetched_dirty); + + skipping_entry = TRUE; + } /* end else */ + + if (prev_ptr != NULL) { + if (skipping_entry) + entry_ptr = prev_ptr; + else if (restart_scan || (prev_ptr->is_dirty != prev_is_dirty) || + (prev_ptr->next != next_ptr) || (prev_ptr->is_protected) || (prev_ptr->is_pinned)) { + /* Something has happened to the LRU -- start over + * from the tail. + */ + restart_scan = FALSE; + entry_ptr = cache_ptr->LRU_tail_ptr; + + H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr); + } /* end else-if */ + else + entry_ptr = prev_ptr; + } /* end if */ + else + entry_ptr = NULL; + } /* end while */ + + /* for now at least, don't bother to maintain the minimum clean size, + * as the cache should now be less than its maximum size. Due to + * the vaguries of the cache size reduction algorithm, we may not + * reduce the size of the cache. + * + * If we do, we will calculate a new minimum clean size, which will + * be enforced the next time we try to make space in the cache. + * + * If we don't, no action is necessary, as we have just evicted and/or + * or flushed a bunch of entries and therefore the sum of the clean + * and free space in the cache must be greater than or equal to the + * min clean space requirement (assuming that requirement was met on + * entry). + */ + } /* end if */ + else /* ! write_permitted */ { + /* Since we are not allowed to write, all we can do is evict + * any clean entries that we may encounter before we either + * hit the eviction size limit, or encounter the epoch marker. + * + * If we are operating read only, this isn't an issue, as there + * will not be any dirty entries. + * + * If we are operating in R/W mode, all the dirty entries we + * skip will be flushed the next time we attempt to make space + * when writes are permitted. This may have some local + * performance implications, but it shouldn't cause any net + * slowdown. + */ + assert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS); + entry_ptr = cache_ptr->LRU_tail_ptr; + while (entry_ptr != NULL && ((entry_ptr->type)->id != H5AC_EPOCH_MARKER_ID) && + (bytes_evicted < eviction_size_limit)) { + assert(!(entry_ptr->is_protected)); + + prev_ptr = entry_ptr->prev; + + if (!(entry_ptr->is_dirty) && !(entry_ptr->prefetched_dirty)) + if (H5C__flush_single_entry( + f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry"); + + /* just skip the entry if it is dirty, as we can't do + * anything with it now since we can't write. + * + * Since all entries are clean, serialize() will not be called, + * and thus we needn't test to see if the LRU has been changed + * out from under us. + */ + entry_ptr = prev_ptr; + } /* end while */ + } /* end else */ + + if (cache_ptr->index_size < cache_ptr->max_cache_size) + cache_ptr->cache_full = FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__autoadjust__ageout__evict_aged_out_entries() */ + +/*------------------------------------------------------------------------- + * Function: H5C__autoadjust__ageout__insert_new_marker + * + * Purpose: Find an unused marker cache entry, mark it as used, and + * insert it at the head of the LRU list. Also add the + * marker's index in the epoch_markers array. + * + * Return: SUCCEED on success/FAIL on failure. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__autoadjust__ageout__insert_new_marker(H5C_t *cache_ptr) +{ + int i; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(cache_ptr); + + if (cache_ptr->epoch_markers_active >= cache_ptr->resize_ctl.epochs_before_eviction) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Already have a full complement of markers"); + + /* find an unused marker */ + i = 0; + while ((cache_ptr->epoch_marker_active)[i] && i < H5C__MAX_EPOCH_MARKERS) + i++; + if (i >= H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't find unused marker"); + + assert(((cache_ptr->epoch_markers)[i]).addr == (haddr_t)i); + assert(((cache_ptr->epoch_markers)[i]).next == NULL); + assert(((cache_ptr->epoch_markers)[i]).prev == NULL); + + (cache_ptr->epoch_marker_active)[i] = TRUE; + + cache_ptr->epoch_marker_ringbuf_last = + (cache_ptr->epoch_marker_ringbuf_last + 1) % (H5C__MAX_EPOCH_MARKERS + 1); + (cache_ptr->epoch_marker_ringbuf)[cache_ptr->epoch_marker_ringbuf_last] = i; + if (cache_ptr->epoch_marker_ringbuf_size >= H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer overflow"); + + cache_ptr->epoch_marker_ringbuf_size += 1; + + H5C__DLL_PREPEND(&(cache_ptr->epoch_markers[i]), cache_ptr->LRU_head_ptr, cache_ptr->LRU_tail_ptr, + cache_ptr->LRU_list_len, cache_ptr->LRU_list_size, FAIL) + + cache_ptr->epoch_markers_active += 1; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__autoadjust__ageout__insert_new_marker() */ + +/*------------------------------------------------------------------------- + * Function: H5C__autoadjust__ageout__remove_all_markers + * + * Purpose: Remove all epoch markers from the LRU list and mark them + * as inactive. + * + * Return: SUCCEED on success/FAIL on failure. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__autoadjust__ageout__remove_all_markers(H5C_t *cache_ptr) +{ + int ring_buf_index; + int i; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(cache_ptr); + + while (cache_ptr->epoch_markers_active > 0) { + /* get the index of the last epoch marker in the LRU list + * and remove it from the ring buffer. + */ + + ring_buf_index = cache_ptr->epoch_marker_ringbuf_first; + i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index]; + + cache_ptr->epoch_marker_ringbuf_first = + (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); + + if (cache_ptr->epoch_marker_ringbuf_size <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow"); + cache_ptr->epoch_marker_ringbuf_size -= 1; + + if (cache_ptr->epoch_marker_active[i] != TRUE) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?"); + + /* remove the epoch marker from the LRU list */ + H5C__DLL_REMOVE(&(cache_ptr->epoch_markers[i]), cache_ptr->LRU_head_ptr, cache_ptr->LRU_tail_ptr, + cache_ptr->LRU_list_len, cache_ptr->LRU_list_size, FAIL) + + /* mark the epoch marker as unused. */ + cache_ptr->epoch_marker_active[i] = FALSE; + + assert(cache_ptr->epoch_markers[i].addr == (haddr_t)i); + assert(cache_ptr->epoch_markers[i].next == NULL); + assert(cache_ptr->epoch_markers[i].prev == NULL); + + /* decrement the number of active epoch markers */ + cache_ptr->epoch_markers_active -= 1; + + assert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__autoadjust__ageout__remove_all_markers() */ + +/*------------------------------------------------------------------------- + * Function: H5C__autoadjust__ageout__remove_excess_markers + * + * Purpose: Remove epoch markers from the end of the LRU list and + * mark them as inactive until the number of active markers + * equals the current value of + * cache_ptr->resize_ctl.epochs_before_eviction. + * + * Return: SUCCEED on success/FAIL on failure. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__autoadjust__ageout__remove_excess_markers(H5C_t *cache_ptr) +{ + int ring_buf_index; + int i; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(cache_ptr); + + if (cache_ptr->epoch_markers_active <= cache_ptr->resize_ctl.epochs_before_eviction) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "no excess markers on entry"); + + while (cache_ptr->epoch_markers_active > cache_ptr->resize_ctl.epochs_before_eviction) { + /* get the index of the last epoch marker in the LRU list + * and remove it from the ring buffer. + */ + ring_buf_index = cache_ptr->epoch_marker_ringbuf_first; + i = (cache_ptr->epoch_marker_ringbuf)[ring_buf_index]; + + cache_ptr->epoch_marker_ringbuf_first = + (cache_ptr->epoch_marker_ringbuf_first + 1) % (H5C__MAX_EPOCH_MARKERS + 1); + + if (cache_ptr->epoch_marker_ringbuf_size <= 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "ring buffer underflow"); + cache_ptr->epoch_marker_ringbuf_size -= 1; + + if (cache_ptr->epoch_marker_active[i] != TRUE) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unused marker in LRU?!?"); + + /* remove the epoch marker from the LRU list */ + H5C__DLL_REMOVE(&(cache_ptr->epoch_markers[i]), cache_ptr->LRU_head_ptr, cache_ptr->LRU_tail_ptr, + cache_ptr->LRU_list_len, cache_ptr->LRU_list_size, FAIL) + + /* mark the epoch marker as unused. */ + cache_ptr->epoch_marker_active[i] = FALSE; + + assert(cache_ptr->epoch_markers[i].addr == (haddr_t)i); + assert(cache_ptr->epoch_markers[i].next == NULL); + assert(cache_ptr->epoch_markers[i].prev == NULL); + + /* decrement the number of active epoch markers */ + cache_ptr->epoch_markers_active -= 1; + + assert(cache_ptr->epoch_markers_active == cache_ptr->epoch_marker_ringbuf_size); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__autoadjust__ageout__remove_excess_markers() */ + +/*------------------------------------------------------------------------- + * Function: H5C__flash_increase_cache_size + * + * Purpose: If there is not at least new_entry_size - old_entry_size + * bytes of free space in the cache and the current + * max_cache_size is less than cache_ptr->resize_ctl.max_size, + * perform a flash increase in the cache size and then reset + * the full cache hit rate statistics, and exit. + * + * Return: Non-negative on success/Negative on failure. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__flash_increase_cache_size(H5C_t *cache_ptr, size_t old_entry_size, size_t new_entry_size) +{ + size_t new_max_cache_size = 0; + size_t old_max_cache_size = 0; + size_t new_min_clean_size = 0; + size_t old_min_clean_size = 0; + size_t space_needed; + enum H5C_resize_status status = flash_increase; /* may change */ + double hit_rate; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + assert(cache_ptr); + assert(cache_ptr->flash_size_increase_possible); + assert(new_entry_size > cache_ptr->flash_size_increase_threshold); + assert(old_entry_size < new_entry_size); + + if (old_entry_size >= new_entry_size) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "old_entry_size >= new_entry_size"); + + space_needed = new_entry_size - old_entry_size; + if (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) && + (cache_ptr->max_cache_size < cache_ptr->resize_ctl.max_size)) { + switch (cache_ptr->resize_ctl.flash_incr_mode) { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "flash_size_increase_possible but H5C_flash_incr__off?!"); + break; + + case H5C_flash_incr__add_space: + if (cache_ptr->index_size < cache_ptr->max_cache_size) { + assert((cache_ptr->max_cache_size - cache_ptr->index_size) < space_needed); + space_needed -= cache_ptr->max_cache_size - cache_ptr->index_size; + } + space_needed = (size_t)(((double)space_needed) * cache_ptr->resize_ctl.flash_multiple); + new_max_cache_size = cache_ptr->max_cache_size + space_needed; + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?"); + break; + } + + if (new_max_cache_size > cache_ptr->resize_ctl.max_size) + new_max_cache_size = cache_ptr->resize_ctl.max_size; + assert(new_max_cache_size > cache_ptr->max_cache_size); + + new_min_clean_size = (size_t)((double)new_max_cache_size * cache_ptr->resize_ctl.min_clean_fraction); + assert(new_min_clean_size <= new_max_cache_size); + + old_max_cache_size = cache_ptr->max_cache_size; + old_min_clean_size = cache_ptr->min_clean_size; + + cache_ptr->max_cache_size = new_max_cache_size; + cache_ptr->min_clean_size = new_min_clean_size; + + /* update flash cache size increase fields as appropriate */ + assert(cache_ptr->flash_size_increase_possible); + + switch (cache_ptr->resize_ctl.flash_incr_mode) { + case H5C_flash_incr__off: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "flash_size_increase_possible but H5C_flash_incr__off?!"); + break; + + case H5C_flash_incr__add_space: + cache_ptr->flash_size_increase_threshold = + (size_t)((double)cache_ptr->max_cache_size * cache_ptr->resize_ctl.flash_threshold); + break; + + default: /* should be unreachable */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown flash_incr_mode?!?!?"); + break; + } + + /* note that we don't cycle the epoch markers. We can + * argue either way as to whether we should, but for now + * we don't. + */ + + if (cache_ptr->resize_ctl.rpt_fcn != NULL) { + /* get the hit rate for the reporting function. Should still + * be good as we haven't reset the hit rate statistics. + */ + if (H5C_get_cache_hit_rate(cache_ptr, &hit_rate) != SUCCEED) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get hit rate"); + + (cache_ptr->resize_ctl.rpt_fcn)(cache_ptr, H5C__CURR_AUTO_RESIZE_RPT_FCN_VER, hit_rate, status, + old_max_cache_size, new_max_cache_size, old_min_clean_size, + new_min_clean_size); + } + + if (H5C_reset_cache_hit_rate_stats(cache_ptr) < 0) + /* this should be impossible... */ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_reset_cache_hit_rate_stats failed"); + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flash_increase_cache_size() */ + +/*------------------------------------------------------------------------- + * Function: H5C__flush_invalidate_cache + * + * Purpose: Flush and destroy the entries contained in the target + * cache. + * + * If the cache contains protected entries, the function will + * fail, as protected entries cannot be either flushed or + * destroyed. However all unprotected entries should be + * flushed and destroyed before the function returns failure. + * + * While pinned entries can usually be flushed, they cannot + * be destroyed. However, they should be unpinned when all + * the entries that reference them have been destroyed (thus + * reduding the pinned entry's reference count to 0, allowing + * it to be unpinned). + * + * If pinned entries are present, the function makes repeated + * passes through the cache, flushing all dirty entries + * (including the pinned dirty entries where permitted) and + * destroying all unpinned entries. This process is repeated + * until either the cache is empty, or the number of pinned + * entries stops decreasing on each pass. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__flush_invalidate_cache(H5F_t *f, unsigned flags) +{ + H5C_t *cache_ptr; + H5C_ring_t ring; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + assert(f); + assert(f->shared); + cache_ptr = f->shared->cache; + assert(cache_ptr); + assert(cache_ptr->slist_ptr); + assert(cache_ptr->slist_enabled); + +#ifdef H5C_DO_SANITY_CHECKS + { + int32_t i; + uint32_t index_len = 0; + uint32_t slist_len = 0; + size_t index_size = (size_t)0; + size_t clean_index_size = (size_t)0; + size_t dirty_index_size = (size_t)0; + size_t slist_size = (size_t)0; + + assert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); + assert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); + assert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + + for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { + index_len += cache_ptr->index_ring_len[i]; + index_size += cache_ptr->index_ring_size[i]; + clean_index_size += cache_ptr->clean_index_ring_size[i]; + dirty_index_size += cache_ptr->dirty_index_ring_size[i]; + + slist_len += cache_ptr->slist_ring_len[i]; + slist_size += cache_ptr->slist_ring_size[i]; + } /* end for */ + + assert(cache_ptr->index_len == index_len); + assert(cache_ptr->index_size == index_size); + assert(cache_ptr->clean_index_size == clean_index_size); + assert(cache_ptr->dirty_index_size == dirty_index_size); + assert(cache_ptr->slist_len == slist_len); + assert(cache_ptr->slist_size == slist_size); + } +#endif /* H5C_DO_SANITY_CHECKS */ + + /* remove ageout markers if present */ + if (cache_ptr->epoch_markers_active > 0) + if (H5C__autoadjust__ageout__remove_all_markers(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "error removing all epoch markers"); + + /* flush invalidate each ring, starting from the outermost ring and + * working inward. + */ + ring = H5C_RING_USER; + while (ring < H5C_RING_NTYPES) { + if (H5C__flush_invalidate_ring(f, ring, flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush invalidate ring failed"); + ring++; + } /* end while */ + +#ifndef NDEBUG + /* Invariants, after destroying all entries in the hash table */ + if (!(flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG)) { + assert(cache_ptr->index_size == 0); + assert(cache_ptr->clean_index_size == 0); + assert(cache_ptr->pel_len == 0); + assert(cache_ptr->pel_size == 0); + } /* end if */ + else { + H5C_cache_entry_t *entry_ptr; /* Cache entry */ + unsigned u; /* Local index variable */ + + /* All rings except ring 4 should be empty now */ + /* (Ring 4 has the superblock) */ + for (u = H5C_RING_USER; u < H5C_RING_SB; u++) { + assert(cache_ptr->index_ring_len[u] == 0); + assert(cache_ptr->index_ring_size[u] == 0); + assert(cache_ptr->clean_index_ring_size[u] == 0); + } /* end for */ + + /* Check that any remaining pinned entries are in the superblock ring */ + entry_ptr = cache_ptr->pel_head_ptr; + while (entry_ptr) { + /* Check ring */ + assert(entry_ptr->ring == H5C_RING_SB); + + /* Advance to next entry in pinned entry list */ + entry_ptr = entry_ptr->next; + } /* end while */ + } /* end else */ + + assert(cache_ptr->dirty_index_size == 0); + assert(cache_ptr->slist_len == 0); + assert(cache_ptr->slist_size == 0); + assert(cache_ptr->pl_len == 0); + assert(cache_ptr->pl_size == 0); + assert(cache_ptr->LRU_list_len == 0); + assert(cache_ptr->LRU_list_size == 0); +#endif + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flush_invalidate_cache() */ + +/*------------------------------------------------------------------------- + * Function: H5C__flush_invalidate_ring + * + * Purpose: Flush and destroy the entries contained in the target + * cache and ring. + * + * If the ring contains protected entries, the function will + * fail, as protected entries cannot be either flushed or + * destroyed. However all unprotected entries should be + * flushed and destroyed before the function returns failure. + * + * While pinned entries can usually be flushed, they cannot + * be destroyed. However, they should be unpinned when all + * the entries that reference them have been destroyed (thus + * reduding the pinned entry's reference count to 0, allowing + * it to be unpinned). + * + * If pinned entries are present, the function makes repeated + * passes through the cache, flushing all dirty entries + * (including the pinned dirty entries where permitted) and + * destroying all unpinned entries. This process is repeated + * until either the cache is empty, or the number of pinned + * entries stops decreasing on each pass. + * + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the cache flushing + * entries in flush dependency order. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__flush_invalidate_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) +{ + H5C_t *cache_ptr; + hbool_t restart_slist_scan; + uint32_t protected_entries = 0; + int32_t i; + uint32_t cur_ring_pel_len; + uint32_t old_ring_pel_len; + unsigned cooked_flags; + unsigned evict_flags; + H5SL_node_t *node_ptr = NULL; + H5C_cache_entry_t *entry_ptr = NULL; + H5C_cache_entry_t *next_entry_ptr = NULL; +#ifdef H5C_DO_SANITY_CHECKS + uint32_t initial_slist_len = 0; + size_t initial_slist_size = 0; +#endif /* H5C_DO_SANITY_CHECKS */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + assert(f); + assert(f->shared); + cache_ptr = f->shared->cache; + assert(cache_ptr); + assert(cache_ptr->slist_enabled); + assert(cache_ptr->slist_ptr); + assert(ring > H5C_RING_UNDEFINED); + assert(ring < H5C_RING_NTYPES); + + assert(cache_ptr->epoch_markers_active == 0); + + /* Filter out the flags that are not relevant to the flush/invalidate. + */ + cooked_flags = flags & H5C__FLUSH_CLEAR_ONLY_FLAG; + evict_flags = flags & H5C__EVICT_ALLOW_LAST_PINS_FLAG; + + /* The flush procedure here is a bit strange. + * + * In the outer while loop we make at least one pass through the + * cache, and then repeat until either all the pinned entries in + * the ring unpin themselves, or until the number of pinned entries + * in the ring stops declining. In this later case, we scream and die. + * + * Since the fractal heap can dirty, resize, and/or move entries + * in is flush callback, it is possible that the cache will still + * contain dirty entries at this point. If so, we must make more + * passes through the skip list to allow it to empty. + * + * Further, since clean entries can be dirtied, resized, and/or moved + * as the result of a flush call back (either the entries own, or that + * for some other cache entry), we can no longer promise to flush + * the cache entries in increasing address order. + * + * Instead, we make a pass through + * the skip list, and then a pass through the "clean" entries, and + * then repeating as needed. Thus it is quite possible that an + * entry will be evicted from the cache only to be re-loaded later + * in the flush process. + * + * The bottom line is that entries will probably be flushed in close + * to increasing address order, but there are no guarantees. + */ + + /* compute the number of pinned entries in this ring */ + entry_ptr = cache_ptr->pel_head_ptr; + cur_ring_pel_len = 0; + while (entry_ptr != NULL) { + assert(entry_ptr->ring >= ring); + if (entry_ptr->ring == ring) + cur_ring_pel_len++; + + entry_ptr = entry_ptr->next; + } /* end while */ + old_ring_pel_len = cur_ring_pel_len; + + while (cache_ptr->index_ring_len[ring] > 0) { + /* first, try to flush-destroy any dirty entries. Do this by + * making a scan through the slist. Note that new dirty entries + * may be created by the flush call backs. Thus it is possible + * that the slist will not be empty after we finish the scan. + */ + +#ifdef H5C_DO_SANITY_CHECKS + /* Depending on circumstances, H5C__flush_single_entry() will + * remove dirty entries from the slist as it flushes them. + * Thus for sanity checks we must make note of the initial + * slist length and size before we do any flushes. + */ + initial_slist_len = cache_ptr->slist_len; + initial_slist_size = cache_ptr->slist_size; + + /* There is also the possibility that entries will be + * dirtied, resized, moved, and/or removed from the cache + * as the result of calls to the flush callbacks. We use + * the slist_len_increase and slist_size_increase increase + * fields in struct H5C_t to track these changes for purpose + * of sanity checking. + * + * To this end, we must zero these fields before we start + * the pass through the slist. + */ + cache_ptr->slist_len_increase = 0; + cache_ptr->slist_size_increase = 0; +#endif /* H5C_DO_SANITY_CHECKS */ + + /* Set the cache_ptr->slist_changed to false. + * + * This flag is set to TRUE by H5C__flush_single_entry if the slist + * is modified by a pre_serialize, serialize, or notify callback. + * + * H5C__flush_invalidate_ring() uses this flag to detect any + * modifications to the slist that might corrupt the scan of + * the slist -- and restart the scan in this event. + */ + cache_ptr->slist_changed = FALSE; + + /* this done, start the scan of the slist */ + restart_slist_scan = TRUE; + while (restart_slist_scan || (node_ptr != NULL)) { + if (restart_slist_scan) { + restart_slist_scan = FALSE; + + /* Start at beginning of skip list */ + node_ptr = H5SL_first(cache_ptr->slist_ptr); + if (node_ptr == NULL) + /* the slist is empty -- break out of inner loop */ + break; + + /* Get cache entry for this node */ + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if (NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!"); + + assert(next_entry_ptr->is_dirty); + assert(next_entry_ptr->in_slist); + assert(next_entry_ptr->ring >= ring); + } /* end if */ + + entry_ptr = next_entry_ptr; + + /* It is possible that entries will be dirtied, resized, + * flushed, or removed from the cache via the take ownership + * flag as the result of pre_serialize or serialized callbacks. + * + * This in turn can corrupt the scan through the slist. + * + * We test for slist modifications in the pre_serialize + * and serialize callbacks, and restart the scan of the + * slist if we find them. However, best we do some extra + * sanity checking just in case. + */ + assert(entry_ptr != NULL); + assert(entry_ptr->in_slist); + assert(entry_ptr->is_dirty); + assert(entry_ptr->ring >= ring); + + /* increment node pointer now, before we delete its target + * from the slist. + */ + node_ptr = H5SL_next(node_ptr); + if (node_ptr != NULL) { + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if (NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!"); + + assert(next_entry_ptr->is_dirty); + assert(next_entry_ptr->in_slist); + assert(next_entry_ptr->ring >= ring); + assert(entry_ptr != next_entry_ptr); + } /* end if */ + else + next_entry_ptr = NULL; + + /* Note that we now remove nodes from the slist as we flush + * the associated entries, instead of leaving them there + * until we are done, and then destroying all nodes in + * the slist. + * + * While this optimization used to be easy, with the possibility + * of new entries being added to the slist in the midst of the + * flush, we must keep the slist in canonical form at all + * times. + */ + if (((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->flush_dep_nchildren == 0) && (entry_ptr->ring == ring)) { + if (entry_ptr->is_protected) { + /* We have major problems -- but lets flush + * everything we can before we flag an error. + */ + protected_entries++; + } /* end if */ + else if (entry_ptr->is_pinned) { + if (H5C__flush_single_entry(f, entry_ptr, H5C__DURING_FLUSH_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty pinned entry flush failed"); + + if (cache_ptr->slist_changed) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. + * + * This has the potential to corrupt the + * scan through the slist, so restart it. + */ + restart_slist_scan = TRUE; + cache_ptr->slist_changed = FALSE; + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); + } /* end if */ + } /* end else-if */ + else { + if (H5C__flush_single_entry(f, entry_ptr, + (cooked_flags | H5C__DURING_FLUSH_FLAG | + H5C__FLUSH_INVALIDATE_FLAG | + H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "dirty entry flush destroy failed"); + + if (cache_ptr->slist_changed) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. + * + * This has the potential to corrupt the + * scan through the slist, so restart it. + */ + restart_slist_scan = TRUE; + cache_ptr->slist_changed = FALSE; + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); + } /* end if */ + } /* end else */ + } /* end if */ + } /* end while loop scanning skip list */ + +#ifdef H5C_DO_SANITY_CHECKS + /* It is possible that entries were added to the slist during + * the scan, either before or after scan pointer. The following + * asserts take this into account. + * + * Don't bother with the sanity checks if node_ptr != NULL, as + * in this case we broke out of the loop because it got changed + * out from under us. + */ + + if (node_ptr == NULL) { + assert(cache_ptr->slist_len == + (uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase)); + assert(cache_ptr->slist_size == + (size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase)); + } /* end if */ +#endif /* H5C_DO_SANITY_CHECKS */ + + /* Since we are doing a destroy, we must make a pass through + * the hash table and try to flush - destroy all entries that + * remain. + * + * It used to be that all entries remaining in the cache at + * this point had to be clean, but with the fractal heap mods + * this may not be the case. If so, we will flush entries out + * in increasing address order. + * + * Writes to disk are possible here. + */ + + /* Reset the counters so that we can detect insertions, loads, + * and moves caused by the pre_serialize and serialize calls. + */ + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + next_entry_ptr = cache_ptr->il_head; + while (next_entry_ptr != NULL) { + entry_ptr = next_entry_ptr; + assert(entry_ptr->ring >= ring); + + next_entry_ptr = entry_ptr->il_next; + + if (((!entry_ptr->flush_me_last) || + (entry_ptr->flush_me_last && (cache_ptr->num_last_entries >= cache_ptr->slist_len))) && + (entry_ptr->flush_dep_nchildren == 0) && (entry_ptr->ring == ring)) { + + if (entry_ptr->is_protected) { + /* we have major problems -- but lets flush and + * destroy everything we can before we flag an + * error. + */ + protected_entries++; + + if (!entry_ptr->in_slist) + assert(!(entry_ptr->is_dirty)); + } /* end if */ + else if (!entry_ptr->is_pinned) { + /* if *entry_ptr is dirty, it is possible + * that one or more other entries may be + * either removed from the cache, loaded + * into the cache, or moved to a new location + * in the file as a side effect of the flush. + * + * It's also possible that removing a clean + * entry will remove the last child of a proxy + * entry, allowing it to be removed also and + * invalidating the next_entry_ptr. + * + * If either of these happen, and one of the target + * or proxy entries happens to be the next entry in + * the hash bucket, we could either find ourselves + * either scanning a non-existent entry, scanning + * through a different bucket, or skipping an entry. + * + * Neither of these are good, so restart the + * the scan at the head of the hash bucket + * after the flush if we detect that the next_entry_ptr + * becomes invalid. + * + * This is not as inefficient at it might seem, + * as hash buckets typically have at most two + * or three entries. + */ + cache_ptr->entry_watched_for_removal = next_entry_ptr; + if (H5C__flush_single_entry(f, entry_ptr, + (cooked_flags | H5C__DURING_FLUSH_FLAG | + H5C__FLUSH_INVALIDATE_FLAG | + H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Entry flush destroy failed"); + + /* Restart the index list scan if necessary. Must + * do this if the next entry is evicted, and also if + * one or more entries are inserted, loaded, or moved + * as these operations can result in part of the scan + * being skipped -- which can cause a spurious failure + * if this results in the size of the pinned entry + * failing to decline during the pass. + */ + if (((NULL != next_entry_ptr) && (NULL == cache_ptr->entry_watched_for_removal)) || + (cache_ptr->entries_loaded_counter > 0) || + (cache_ptr->entries_inserted_counter > 0) || + (cache_ptr->entries_relocated_counter > 0)) { + + next_entry_ptr = cache_ptr->il_head; + + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr); + } /* end if */ + else + cache_ptr->entry_watched_for_removal = NULL; + } /* end if */ + } /* end if */ + } /* end for loop scanning hash table */ + + /* We can't do anything if entries are pinned. The + * hope is that the entries will be unpinned as the + * result of destroys of entries that reference them. + * + * We detect this by noting the change in the number + * of pinned entries from pass to pass. If it stops + * shrinking before it hits zero, we scream and die. + */ + old_ring_pel_len = cur_ring_pel_len; + entry_ptr = cache_ptr->pel_head_ptr; + cur_ring_pel_len = 0; + + while (entry_ptr != NULL) { + assert(entry_ptr->ring >= ring); + + if (entry_ptr->ring == ring) + cur_ring_pel_len++; + + entry_ptr = entry_ptr->next; + } /* end while */ + + /* Check if the number of pinned entries in the ring is positive, and + * it is not declining. Scream and die if so. + */ + if ((cur_ring_pel_len > 0) && (cur_ring_pel_len >= old_ring_pel_len)) { + /* Don't error if allowed to have pinned entries remaining */ + if (evict_flags) + HGOTO_DONE(TRUE); + + HGOTO_ERROR( + H5E_CACHE, H5E_CANTFLUSH, FAIL, + "Pinned entry count not decreasing, cur_ring_pel_len = %d, old_ring_pel_len = %d, ring = %d", + (int)cur_ring_pel_len, (int)old_ring_pel_len, (int)ring); + } /* end if */ + + assert(protected_entries == cache_ptr->pl_len); + + if ((protected_entries > 0) && (protected_entries == cache_ptr->index_len)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, + "Only protected entries left in cache, protected_entries = %d", + (int)protected_entries); + } /* main while loop */ + + /* Invariants, after destroying all entries in the ring */ + for (i = (int)H5C_RING_UNDEFINED; i <= (int)ring; i++) { + assert(cache_ptr->index_ring_len[i] == 0); + assert(cache_ptr->index_ring_size[i] == (size_t)0); + assert(cache_ptr->clean_index_ring_size[i] == (size_t)0); + assert(cache_ptr->dirty_index_ring_size[i] == (size_t)0); + + assert(cache_ptr->slist_ring_len[i] == 0); + assert(cache_ptr->slist_ring_size[i] == (size_t)0); + } /* end for */ + + assert(protected_entries <= cache_ptr->pl_len); + + if (protected_entries > 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Cache has protected entries"); + else if (cur_ring_pel_len > 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't unpin all pinned entries in ring"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flush_invalidate_ring() */ + +/*------------------------------------------------------------------------- + * Function: H5C__flush_ring + * + * Purpose: Flush the entries contained in the specified cache and + * ring. All entries in rings outside the specified ring + * must have been flushed on entry. + * + * If the cache contains protected entries in the specified + * ring, the function will fail, as protected entries cannot + * be flushed. However all unprotected entries in the target + * ring should be flushed before the function returns failure. + * + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the slist flushing + * entries in flush dependency order. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__flush_ring(H5F_t *f, H5C_ring_t ring, unsigned flags) +{ + H5C_t *cache_ptr = f->shared->cache; + hbool_t flushed_entries_last_pass; + hbool_t flush_marked_entries; + hbool_t ignore_protected; + hbool_t tried_to_flush_protected_entry = FALSE; + hbool_t restart_slist_scan; + uint32_t protected_entries = 0; + H5SL_node_t *node_ptr = NULL; + H5C_cache_entry_t *entry_ptr = NULL; + H5C_cache_entry_t *next_entry_ptr = NULL; +#ifdef H5C_DO_SANITY_CHECKS + uint32_t initial_slist_len = 0; + size_t initial_slist_size = 0; +#endif /* H5C_DO_SANITY_CHECKS */ + int i; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + assert(cache_ptr); + assert(cache_ptr->slist_enabled); + assert(cache_ptr->slist_ptr); + assert((flags & H5C__FLUSH_INVALIDATE_FLAG) == 0); + assert(ring > H5C_RING_UNDEFINED); + assert(ring < H5C_RING_NTYPES); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + + ignore_protected = ((flags & H5C__FLUSH_IGNORE_PROTECTED_FLAG) != 0); + flush_marked_entries = ((flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0); + + if (!flush_marked_entries) + for (i = (int)H5C_RING_UNDEFINED; i < (int)ring; i++) + assert(cache_ptr->slist_ring_len[i] == 0); + + assert(cache_ptr->flush_in_progress); + + /* When we are only flushing marked entries, the slist will usually + * still contain entries when we have flushed everything we should. + * Thus we track whether we have flushed any entries in the last + * pass, and terminate if we haven't. + */ + flushed_entries_last_pass = TRUE; + + /* Set the cache_ptr->slist_changed to false. + * + * This flag is set to TRUE by H5C__flush_single_entry if the + * slist is modified by a pre_serialize, serialize, or notify callback. + * H5C_flush_cache uses this flag to detect any modifications + * to the slist that might corrupt the scan of the slist -- and + * restart the scan in this event. + */ + cache_ptr->slist_changed = FALSE; + + while ((cache_ptr->slist_ring_len[ring] > 0) && (protected_entries == 0) && (flushed_entries_last_pass)) { + flushed_entries_last_pass = FALSE; + +#ifdef H5C_DO_SANITY_CHECKS + /* For sanity checking, try to verify that the skip list has + * the expected size and number of entries at the end of each + * internal while loop (see below). + * + * Doing this get a bit tricky, as depending on flags, we may + * or may not flush all the entries in the slist. + * + * To make things more entertaining, with the advent of the + * fractal heap, the entry serialize callback can cause entries + * to be dirtied, resized, and/or moved. Also, the + * pre_serialize callback can result in an entry being + * removed from the cache via the take ownership flag. + * + * To deal with this, we first make note of the initial + * skip list length and size: + */ + initial_slist_len = cache_ptr->slist_len; + initial_slist_size = cache_ptr->slist_size; + + /* As mentioned above, there is the possibility that + * entries will be dirtied, resized, flushed, or removed + * from the cache via the take ownership flag during + * our pass through the skip list. To capture the number + * of entries added, and the skip list size delta, + * zero the slist_len_increase and slist_size_increase of + * the cache's instance of H5C_t. These fields will be + * updated elsewhere to account for slist insertions and/or + * dirty entry size changes. + */ + cache_ptr->slist_len_increase = 0; + cache_ptr->slist_size_increase = 0; + + /* at the end of the loop, use these values to compute the + * expected slist length and size and compare this with the + * value recorded in the cache's instance of H5C_t. + */ +#endif /* H5C_DO_SANITY_CHECKS */ + + restart_slist_scan = TRUE; + while ((restart_slist_scan) || (node_ptr != NULL)) { + if (restart_slist_scan) { + restart_slist_scan = FALSE; + + /* Start at beginning of skip list */ + node_ptr = H5SL_first(cache_ptr->slist_ptr); + if (node_ptr == NULL) + /* the slist is empty -- break out of inner loop */ + break; + + /* Get cache entry for this node */ + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if (NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!"); + + assert(next_entry_ptr->is_dirty); + assert(next_entry_ptr->in_slist); + } /* end if */ + + entry_ptr = next_entry_ptr; + + /* With the advent of the fractal heap, the free space + * manager, and the version 3 cache, it is possible + * that the pre-serialize or serialize callback will + * dirty, resize, or take ownership of other entries + * in the cache. + * + * To deal with this, there is code to detect any + * change in the skip list not directly under the control + * of this function. If such modifications are detected, + * we must re-start the scan of the skip list to avoid + * the possibility that the target of the next_entry_ptr + * may have been flushed or deleted from the cache. + * + * To verify that all such possibilities have been dealt + * with, we do a bit of extra sanity checking on + * entry_ptr. + */ + assert(entry_ptr->in_slist); + assert(entry_ptr->is_dirty); + + if (!flush_marked_entries || entry_ptr->flush_marker) + assert(entry_ptr->ring >= ring); + + /* Advance node pointer now, before we delete its target + * from the slist. + */ + node_ptr = H5SL_next(node_ptr); + if (node_ptr != NULL) { + next_entry_ptr = (H5C_cache_entry_t *)H5SL_item(node_ptr); + if (NULL == next_entry_ptr) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "next_entry_ptr == NULL ?!?!"); + + assert(next_entry_ptr->is_dirty); + assert(next_entry_ptr->in_slist); + + if (!flush_marked_entries || next_entry_ptr->flush_marker) + assert(next_entry_ptr->ring >= ring); + + assert(entry_ptr != next_entry_ptr); + } /* end if */ + else + next_entry_ptr = NULL; + + if ((!flush_marked_entries || entry_ptr->flush_marker) && + ((!entry_ptr->flush_me_last) || + ((entry_ptr->flush_me_last) && ((cache_ptr->num_last_entries >= cache_ptr->slist_len) || + (flush_marked_entries && entry_ptr->flush_marker)))) && + ((entry_ptr->flush_dep_nchildren == 0) || (entry_ptr->flush_dep_ndirty_children == 0)) && + (entry_ptr->ring == ring)) { + + assert(entry_ptr->flush_dep_nunser_children == 0); + + if (entry_ptr->is_protected) { + /* we probably have major problems -- but lets + * flush everything we can before we decide + * whether to flag an error. + */ + tried_to_flush_protected_entry = TRUE; + protected_entries++; + } /* end if */ + else { + if (H5C__flush_single_entry(f, entry_ptr, (flags | H5C__DURING_FLUSH_FLAG)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry"); + + if (cache_ptr->slist_changed) { + /* The slist has been modified by something + * other than the simple removal of the + * of the flushed entry after the flush. + * + * This has the potential to corrupt the + * scan through the slist, so restart it. + */ + restart_slist_scan = TRUE; + cache_ptr->slist_changed = FALSE; + H5C__UPDATE_STATS_FOR_SLIST_SCAN_RESTART(cache_ptr); + } /* end if */ + + flushed_entries_last_pass = TRUE; + } /* end else */ + } /* end if */ + } /* while ( ( restart_slist_scan ) || ( node_ptr != NULL ) ) */ + +#ifdef H5C_DO_SANITY_CHECKS + /* Verify that the slist size and length are as expected. */ + assert((uint32_t)((int32_t)initial_slist_len + cache_ptr->slist_len_increase) == + cache_ptr->slist_len); + assert((size_t)((ssize_t)initial_slist_size + cache_ptr->slist_size_increase) == + cache_ptr->slist_size); +#endif /* H5C_DO_SANITY_CHECKS */ + } /* while */ + + assert(protected_entries <= cache_ptr->pl_len); + + if (((cache_ptr->pl_len > 0) && !ignore_protected) || tried_to_flush_protected_entry) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "cache has protected items"); + +#ifdef H5C_DO_SANITY_CHECKS + if (!flush_marked_entries) { + assert(cache_ptr->slist_ring_len[ring] == 0); + assert(cache_ptr->slist_ring_size[ring] == 0); + } /* end if */ +#endif /* H5C_DO_SANITY_CHECKS */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flush_ring() */ + +/*------------------------------------------------------------------------- + * Function: H5C__make_space_in_cache + * + * Purpose: Attempt to evict cache entries until the index_size + * is at least needed_space below max_cache_size. + * + * In passing, also attempt to bring cLRU_list_size to a + * value greater than min_clean_size. + * + * Depending on circumstances, both of these goals may + * be impossible, as in parallel mode, we must avoid generating + * a write as part of a read (to avoid deadlock in collective + * I/O), and in all cases, it is possible (though hopefully + * highly unlikely) that the protected list may exceed the + * maximum size of the cache. + * + * Thus the function simply does its best, returning success + * unless an error is encountered. + * + * Observe that this function cannot occasion a read. + * + * Return: Non-negative on success/Negative on failure. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__make_space_in_cache(H5F_t *f, size_t space_needed, hbool_t write_permitted) +{ + H5C_t *cache_ptr = f->shared->cache; +#if H5C_COLLECT_CACHE_STATS + int32_t clean_entries_skipped = 0; + int32_t dirty_pf_entries_skipped = 0; + int32_t total_entries_scanned = 0; +#endif /* H5C_COLLECT_CACHE_STATS */ + uint32_t entries_examined = 0; + uint32_t initial_list_len; + size_t empty_space; + hbool_t reentrant_call = FALSE; + hbool_t prev_is_dirty = FALSE; + hbool_t didnt_flush_entry = FALSE; + hbool_t restart_scan; + H5C_cache_entry_t *entry_ptr; + H5C_cache_entry_t *prev_ptr; + H5C_cache_entry_t *next_ptr; +#ifndef NDEBUG + uint32_t num_corked_entries = 0; +#endif + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(f); + assert(cache_ptr); + assert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size)); + + /* check to see if cache_ptr->msic_in_progress is TRUE. If it, this + * is a re-entrant call via a client callback called in the make + * space in cache process. To avoid an infinite recursion, set + * reentrant_call to TRUE, and goto done. + */ + if (cache_ptr->msic_in_progress) { + reentrant_call = TRUE; + HGOTO_DONE(SUCCEED); + } /* end if */ + + cache_ptr->msic_in_progress = TRUE; + + if (write_permitted) { + restart_scan = FALSE; + initial_list_len = cache_ptr->LRU_list_len; + entry_ptr = cache_ptr->LRU_tail_ptr; + + if (cache_ptr->index_size >= cache_ptr->max_cache_size) + empty_space = 0; + else + empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; + + while ((((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) || + ((empty_space + cache_ptr->clean_index_size) < (cache_ptr->min_clean_size))) && + (entries_examined <= (2 * initial_list_len)) && (entry_ptr != NULL)) { + assert(!(entry_ptr->is_protected)); + assert(!(entry_ptr->is_read_only)); + assert((entry_ptr->ro_ref_count) == 0); + + next_ptr = entry_ptr->next; + prev_ptr = entry_ptr->prev; + + if (prev_ptr != NULL) + prev_is_dirty = prev_ptr->is_dirty; + + if (entry_ptr->is_dirty && (entry_ptr->tag_info && entry_ptr->tag_info->corked)) { + /* Skip "dirty" corked entries. */ +#ifndef NDEBUG + ++num_corked_entries; +#endif + didnt_flush_entry = TRUE; + } + else if ((entry_ptr->type->id != H5AC_EPOCH_MARKER_ID) && !entry_ptr->flush_in_progress && + !entry_ptr->prefetched_dirty) { + didnt_flush_entry = FALSE; + if (entry_ptr->is_dirty) { +#if H5C_COLLECT_CACHE_STATS + if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) + cache_ptr->entries_scanned_to_make_space++; +#endif /* H5C_COLLECT_CACHE_STATS */ + + /* reset entries_removed_counter and + * last_entry_removed_ptr prior to the call to + * H5C__flush_single_entry() so that we can spot + * unexpected removals of entries from the cache, + * and set the restart_scan flag if proceeding + * would be likely to cause us to scan an entry + * that is no longer in the cache. + */ + cache_ptr->entries_removed_counter = 0; + cache_ptr->last_entry_removed_ptr = NULL; + + if (H5C__flush_single_entry(f, entry_ptr, H5C__NO_FLAGS_SET) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry"); + + if ((cache_ptr->entries_removed_counter > 1) || + (cache_ptr->last_entry_removed_ptr == prev_ptr)) + + restart_scan = TRUE; + } + else if ((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size +#ifdef H5_HAVE_PARALLEL + && !(entry_ptr->coll_access) +#endif /* H5_HAVE_PARALLEL */ + ) { +#if H5C_COLLECT_CACHE_STATS + cache_ptr->entries_scanned_to_make_space++; +#endif /* H5C_COLLECT_CACHE_STATS */ + + if (H5C__flush_single_entry(f, entry_ptr, + H5C__FLUSH_INVALIDATE_FLAG | + H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry"); + } + else { + /* We have enough space so don't flush clean entry. */ +#if H5C_COLLECT_CACHE_STATS + clean_entries_skipped++; +#endif /* H5C_COLLECT_CACHE_STATS */ + didnt_flush_entry = TRUE; + } + +#if H5C_COLLECT_CACHE_STATS + total_entries_scanned++; +#endif /* H5C_COLLECT_CACHE_STATS */ + } + else { + + /* Skip epoch markers, entries that are in the process + * of being flushed, and entries marked as prefetched_dirty + * (occurs in the R/O case only). + */ + didnt_flush_entry = TRUE; + +#if H5C_COLLECT_CACHE_STATS + if (entry_ptr->prefetched_dirty) + dirty_pf_entries_skipped++; +#endif /* H5C_COLLECT_CACHE_STATS */ + } + + if (prev_ptr != NULL) { + if (didnt_flush_entry) + /* epoch markers don't get flushed, and we don't touch + * entries that are in the process of being flushed. + * Hence no need for sanity checks, as we haven't + * flushed anything. Thus just set entry_ptr to prev_ptr + * and go on. + */ + entry_ptr = prev_ptr; + else if (restart_scan || prev_ptr->is_dirty != prev_is_dirty || prev_ptr->next != next_ptr || + prev_ptr->is_protected || prev_ptr->is_pinned) { + /* something has happened to the LRU -- start over + * from the tail. + */ + restart_scan = FALSE; + entry_ptr = cache_ptr->LRU_tail_ptr; + H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr); + } + else + entry_ptr = prev_ptr; + } + else + entry_ptr = NULL; + + entries_examined++; + + if (cache_ptr->index_size >= cache_ptr->max_cache_size) + empty_space = 0; + else + empty_space = cache_ptr->max_cache_size - cache_ptr->index_size; + + assert(cache_ptr->index_size == (cache_ptr->clean_index_size + cache_ptr->dirty_index_size)); + } + +#if H5C_COLLECT_CACHE_STATS + cache_ptr->calls_to_msic++; + + cache_ptr->total_entries_skipped_in_msic += clean_entries_skipped; + cache_ptr->total_dirty_pf_entries_skipped_in_msic += dirty_pf_entries_skipped; + cache_ptr->total_entries_scanned_in_msic += total_entries_scanned; + + if (clean_entries_skipped > cache_ptr->max_entries_skipped_in_msic) + cache_ptr->max_entries_skipped_in_msic = clean_entries_skipped; + + if (dirty_pf_entries_skipped > cache_ptr->max_dirty_pf_entries_skipped_in_msic) + cache_ptr->max_dirty_pf_entries_skipped_in_msic = dirty_pf_entries_skipped; + + if (total_entries_scanned > cache_ptr->max_entries_scanned_in_msic) + cache_ptr->max_entries_scanned_in_msic = total_entries_scanned; +#endif /* H5C_COLLECT_CACHE_STATS */ + + /* NEED: work on a better assert for corked entries */ + assert((entries_examined > (2 * initial_list_len)) || + ((cache_ptr->pl_size + cache_ptr->pel_size + cache_ptr->min_clean_size) > + cache_ptr->max_cache_size) || + ((cache_ptr->clean_index_size + empty_space) >= cache_ptr->min_clean_size) || + ((num_corked_entries))); +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS + + assert((entries_examined > (2 * initial_list_len)) || + (cache_ptr->cLRU_list_size <= cache_ptr->clean_index_size)); + assert((entries_examined > (2 * initial_list_len)) || + (cache_ptr->dLRU_list_size <= cache_ptr->dirty_index_size)); + +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + } + else { + assert(H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS); + +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS + initial_list_len = cache_ptr->cLRU_list_len; + entry_ptr = cache_ptr->cLRU_tail_ptr; + + while (((cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size) && + (entries_examined <= initial_list_len) && (entry_ptr != NULL)) { + assert(!(entry_ptr->is_protected)); + assert(!(entry_ptr->is_read_only)); + assert((entry_ptr->ro_ref_count) == 0); + assert(!(entry_ptr->is_dirty)); + + prev_ptr = entry_ptr->aux_prev; + + if (!entry_ptr->prefetched_dirty +#ifdef H5_HAVE_PARALLEL + && !entry_ptr->coll_access +#endif /* H5_HAVE_PARALLEL */ + ) { + if (H5C__flush_single_entry( + f, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry"); + } /* end if */ + + /* we are scanning the clean LRU, so the serialize function + * will not be called on any entry -- thus there is no + * concern about the list being modified out from under + * this function. + */ + + entry_ptr = prev_ptr; + entries_examined++; + } +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + } + +done: + /* Sanity checks */ + assert(cache_ptr->msic_in_progress); + if (!reentrant_call) + cache_ptr->msic_in_progress = FALSE; + assert((!reentrant_call) || (cache_ptr->msic_in_progress)); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__make_space_in_cache() */ + +/*------------------------------------------------------------------------- + * Function: H5C__serialize_cache + * + * Purpose: Serialize (i.e. construct an on disk image) for all entries + * in the metadata cache including clean entries. + * + * Note that flush dependencies and "flush me last" flags + * must be observed in the serialization process. + * + * Note also that entries may be loaded, flushed, evicted, + * expunged, relocated, resized, or removed from the cache + * during this process, just as these actions may occur during + * a regular flush. + * + * However, we are given that the cache will contain no protected + * entries on entry to this routine (although entries may be + * briefly protected and then unprotected during the serialize + * process). + * + * The objective of this routine is serialize all entries and + * to force all entries into their actual locations on disk. + * + * The initial need for this routine is to settle all entries + * in the cache prior to construction of the metadata cache + * image so that the size of the cache image can be calculated. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + *------------------------------------------------------------------------- + */ +herr_t +H5C__serialize_cache(H5F_t *f) +{ +#ifdef H5C_DO_SANITY_CHECKS + int i; + uint32_t index_len = 0; + size_t index_size = (size_t)0; + size_t clean_index_size = (size_t)0; + size_t dirty_index_size = (size_t)0; + size_t slist_size = (size_t)0; + uint32_t slist_len = 0; +#endif /* H5C_DO_SANITY_CHECKS */ + H5C_ring_t ring; + H5C_t *cache_ptr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(f); + assert(f->shared); + cache_ptr = f->shared->cache; + assert(cache_ptr); + assert(cache_ptr->slist_ptr); + +#ifdef H5C_DO_SANITY_CHECKS + assert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); + assert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); + assert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + + for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { + index_len += cache_ptr->index_ring_len[i]; + index_size += cache_ptr->index_ring_size[i]; + clean_index_size += cache_ptr->clean_index_ring_size[i]; + dirty_index_size += cache_ptr->dirty_index_ring_size[i]; + + slist_len += cache_ptr->slist_ring_len[i]; + slist_size += cache_ptr->slist_ring_size[i]; + } /* end for */ + + assert(cache_ptr->index_len == index_len); + assert(cache_ptr->index_size == index_size); + assert(cache_ptr->clean_index_size == clean_index_size); + assert(cache_ptr->dirty_index_size == dirty_index_size); + assert(cache_ptr->slist_len == slist_len); + assert(cache_ptr->slist_size == slist_size); +#endif /* H5C_DO_SANITY_CHECKS */ + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); +#endif /* H5C_DO_EXTREME_SANITY_CHECKS */ + +#ifndef NDEBUG + /* if this is a debug build, set the serialization_count field of + * each entry in the cache to zero before we start the serialization. + * This allows us to detect the case in which any entry is serialized + * more than once (a performance issues), and more importantly, the + * case is which any flush dependency parent is serializes more than + * once (a correctness issue). + */ + { + H5C_cache_entry_t *scan_ptr = NULL; + + scan_ptr = cache_ptr->il_head; + while (scan_ptr != NULL) { + scan_ptr->serialization_count = 0; + scan_ptr = scan_ptr->il_next; + } /* end while */ + } /* end block */ +#endif + + /* set cache_ptr->serialization_in_progress to TRUE, and back + * to FALSE at the end of the function. Must maintain this flag + * to support H5C_get_serialization_in_progress(), which is in + * turn required to support sanity checking in some cache + * clients. + */ + assert(!cache_ptr->serialization_in_progress); + cache_ptr->serialization_in_progress = TRUE; + + /* Serialize each ring, starting from the outermost ring and + * working inward. + */ + ring = H5C_RING_USER; + while (ring < H5C_RING_NTYPES) { + assert(cache_ptr->close_warning_received); + switch (ring) { + case H5C_RING_USER: + break; + + case H5C_RING_RDFSM: + /* Settle raw data FSM */ + if (!cache_ptr->rdfsm_settled) + if (H5MF_settle_raw_data_fsm(f, &cache_ptr->rdfsm_settled) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "RD FSM settle failed"); + break; + + case H5C_RING_MDFSM: + /* Settle metadata FSM */ + if (!cache_ptr->mdfsm_settled) + if (H5MF_settle_meta_data_fsm(f, &cache_ptr->mdfsm_settled) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "MD FSM settle failed"); + break; + + case H5C_RING_SBE: + case H5C_RING_SB: + break; + + default: + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Unknown ring?!?!"); + break; + } /* end switch */ + + if (H5C__serialize_ring(f, ring) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "serialize ring failed"); + + ring++; + } /* end while */ + +#ifndef NDEBUG + /* Verify that no entry has been serialized more than once. + * FD parents with multiple serializations should have been caught + * elsewhere, so no specific check for them here. + */ + { + H5C_cache_entry_t *scan_ptr = NULL; + + scan_ptr = cache_ptr->il_head; + while (scan_ptr != NULL) { + assert(scan_ptr->serialization_count <= 1); + + scan_ptr = scan_ptr->il_next; + } /* end while */ + } /* end block */ +#endif + +done: + cache_ptr->serialization_in_progress = FALSE; + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__serialize_cache() */ + +/*------------------------------------------------------------------------- + * Function: H5C__serialize_ring + * + * Purpose: Serialize the entries contained in the specified cache and + * ring. All entries in rings outside the specified ring + * must have been serialized on entry. + * + * If the cache contains protected entries in the specified + * ring, the function will fail, as protected entries cannot + * be serialized. However all unprotected entries in the + * target ring should be serialized before the function + * returns failure. + * + * If flush dependencies appear in the target ring, the + * function makes repeated passes through the index list + * serializing entries in flush dependency order. + * + * All entries outside the H5C_RING_SBE are marked for + * inclusion in the cache image. Entries in H5C_RING_SBE + * and below are marked for exclusion from the image. + * + * Return: Non-negative on success/Negative on failure or if there was + * a request to flush all items and something was protected. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__serialize_ring(H5F_t *f, H5C_ring_t ring) +{ + hbool_t done = FALSE; + H5C_t *cache_ptr; + H5C_cache_entry_t *entry_ptr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(f); + assert(f->shared); + cache_ptr = f->shared->cache; + assert(cache_ptr); + assert(ring > H5C_RING_UNDEFINED); + assert(ring < H5C_RING_NTYPES); + + assert(cache_ptr->serialization_in_progress); + + /* The objective here is to serialize all entries in the cache ring + * in flush dependency order. + * + * The basic algorithm is to scan the cache index list looking for + * unserialized entries that are either not in a flush dependency + * relationship, or which have no unserialized children. Any such + * entry is serialized and its flush dependency parents (if any) are + * informed -- allowing them to decrement their userialized child counts. + * + * However, this algorithm is complicated by the ability + * of client serialization callbacks to perform operations on + * on the cache which can result in the insertion, deletion, + * relocation, resize, dirty, flush, eviction, or removal (via the + * take ownership flag) of entries. Changes in the flush dependency + * structure are also possible. + * + * On the other hand, the algorithm is simplified by the fact that + * we are serializing, not flushing. Thus, as long as all entries + * are serialized correctly, it doesn't matter if we have to go back + * and serialize an entry a second time. + * + * These possible actions result in the following modifications to + * the basic algorithm: + * + * 1) In the event of an entry expunge, eviction or removal, we must + * restart the scan as it is possible that the next entry in our + * scan is no longer in the cache. Were we to examine this entry, + * we would be accessing deallocated memory. + * + * 2) A resize, dirty, or insertion of an entry may result in the + * the increment of a flush dependency parent's dirty and/or + * unserialized child count. In the context of serializing the + * the cache, this is a non-issue, as even if we have already + * serialized the parent, it will be marked dirty and its image + * marked out of date if appropriate when the child is serialized. + * + * However, this is a major issue for a flush, as were this to happen + * in a flush, it would violate the invariant that the flush dependency + * feature is intended to enforce. As the metadata cache has no + * control over the behavior of cache clients, it has no way of + * preventing this behaviour. However, it should detect it if at all + * possible. + * + * Do this by maintaining a count of the number of times each entry is + * serialized during a cache serialization. If any flush dependency + * parent is serialized more than once, throw an assertion failure. + * + * 3) An entry relocation will typically change the location of the + * entry in the index list. This shouldn't cause problems as we + * will scan the index list until we make a complete pass without + * finding anything to serialize -- making relocations of either + * the current or next entries irrelevant. + * + * Note that since a relocation may result in our skipping part of + * the index list, we must always do at least one more pass through + * the index list after an entry relocation. + * + * 4) Changes in the flush dependency structure are possible on + * entry insertion, load, expunge, evict, or remove. Destruction + * of a flush dependency has no effect, as it can only relax the + * flush dependencies. Creation of a flush dependency can create + * an unserialized child of a flush dependency parent where all + * flush dependency children were previously serialized. Should + * this child dirty the flush dependency parent when it is serialized, + * the parent will be re-serialized. + * + * Per the discussion of 2) above, this is a non issue for cache + * serialization, and a major problem for cache flush. Using the + * same detection mechanism, throw an assertion failure if this + * condition appears. + * + * Observe that either eviction or removal of entries as a result of + * a serialization is not a problem as long as the flush dependency + * tree does not change beyond the removal of a leaf. + */ + while (!done) { + /* Reset the counters so that we can detect insertions, loads, + * moves, and flush dependency height changes caused by the pre_serialize + * and serialize callbacks. + */ + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + done = TRUE; /* set to FALSE if any activity in inner loop */ + entry_ptr = cache_ptr->il_head; + while (entry_ptr != NULL) { + /* Verify that either the entry is already serialized, or + * that it is assigned to either the target or an inner + * ring. + */ + assert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date)); + + /* Skip flush me last entries or inner ring entries */ + if (!entry_ptr->flush_me_last && entry_ptr->ring == ring) { + + /* if we encounter an unserialized entry in the current + * ring that is not marked flush me last, we are not done. + */ + if (!entry_ptr->image_up_to_date) + done = FALSE; + + /* Serialize the entry if its image is not up to date + * and it has no unserialized flush dependency children. + */ + if (!entry_ptr->image_up_to_date && entry_ptr->flush_dep_nunser_children == 0) { + assert(entry_ptr->serialization_count == 0); + + /* Serialize the entry */ + if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed"); + + assert(entry_ptr->flush_dep_nunser_children == 0); + assert(entry_ptr->serialization_count == 0); + +#ifndef NDEBUG + /* Increment serialization counter (to detect multiple serializations) */ + entry_ptr->serialization_count++; +#endif + } /* end if */ + } /* end if */ + + /* Check for the cache being perturbed during the entry serialize */ + if ((cache_ptr->entries_loaded_counter > 0) || (cache_ptr->entries_inserted_counter > 0) || + (cache_ptr->entries_relocated_counter > 0)) { + +#if H5C_COLLECT_CACHE_STATS + H5C__UPDATE_STATS_FOR_INDEX_SCAN_RESTART(cache_ptr); +#endif /* H5C_COLLECT_CACHE_STATS */ + + /* Reset the counters */ + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + /* Restart scan */ + entry_ptr = cache_ptr->il_head; + } /* end if */ + else + /* Advance to next entry */ + entry_ptr = entry_ptr->il_next; + } /* while ( entry_ptr != NULL ) */ + } /* while ( ! done ) */ + + /* Reset the counters so that we can detect insertions, loads, + * moves, and flush dependency height changes caused by the pre_serialize + * and serialize callbacks. + */ + cache_ptr->entries_loaded_counter = 0; + cache_ptr->entries_inserted_counter = 0; + cache_ptr->entries_relocated_counter = 0; + + /* At this point, all entries not marked "flush me last" and in + * the current ring or outside it should be serialized and have up + * to date images. Scan the index list again to serialize the + * "flush me last" entries (if they are in the current ring) and to + * verify that all other entries have up to date images. + */ + entry_ptr = cache_ptr->il_head; + while (entry_ptr != NULL) { + assert(entry_ptr->ring > H5C_RING_UNDEFINED); + assert(entry_ptr->ring < H5C_RING_NTYPES); + assert((entry_ptr->ring >= ring) || (entry_ptr->image_up_to_date)); + + if (entry_ptr->ring == ring) { + if (entry_ptr->flush_me_last) { + if (!entry_ptr->image_up_to_date) { + assert(entry_ptr->serialization_count == 0); + assert(entry_ptr->flush_dep_nunser_children == 0); + + /* Serialize the entry */ + if (H5C__serialize_single_entry(f, cache_ptr, entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSERIALIZE, FAIL, "entry serialization failed"); + + /* Check for the cache changing */ + if ((cache_ptr->entries_loaded_counter > 0) || + (cache_ptr->entries_inserted_counter > 0) || + (cache_ptr->entries_relocated_counter > 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "flush_me_last entry serialization triggered restart"); + + assert(entry_ptr->flush_dep_nunser_children == 0); + assert(entry_ptr->serialization_count == 0); +#ifndef NDEBUG + /* Increment serialization counter (to detect multiple serializations) */ + entry_ptr->serialization_count++; +#endif + } /* end if */ + } /* end if */ + else { + assert(entry_ptr->image_up_to_date); + assert(entry_ptr->serialization_count <= 1); + assert(entry_ptr->flush_dep_nunser_children == 0); + } /* end else */ + } /* if ( entry_ptr->ring == ring ) */ + + entry_ptr = entry_ptr->il_next; + } /* while ( entry_ptr != NULL ) */ + +done: + assert(cache_ptr->serialization_in_progress); + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__serialize_ring() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Clog.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Clog.c index 14b37d45a8..dfbc6998aa 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Clog.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Clog.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -70,9 +69,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -84,12 +80,12 @@ H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, h FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); - HDassert(log_location); + assert(cache); + assert(log_location); /* Check logging flags */ if (cache->log_info->enabled) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging already set up") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging already set up"); /* Get the rank when MPI is in use. Logging clients will usually * use that to create per-process logs. @@ -101,15 +97,15 @@ H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, h /* Set up logging */ if (H5C_LOG_STYLE_JSON == style) { - if (H5C_log_json_set_up(cache->log_info, log_location, mpi_rank) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up json logging") + if (H5C__log_json_set_up(cache->log_info, log_location, mpi_rank) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up json logging"); } else if (H5C_LOG_STYLE_TRACE == style) { - if (H5C_log_trace_set_up(cache->log_info, log_location, mpi_rank) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up trace logging") + if (H5C__log_trace_set_up(cache->log_info, log_location, mpi_rank) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up trace logging"); } else - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unknown logging style") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unknown logging style"); /* Set logging flags */ cache->log_info->enabled = TRUE; @@ -117,7 +113,7 @@ H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, h /* Start logging if requested */ if (start_immediately) if (H5C_start_logging(cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to start logging") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to start logging"); done: @@ -131,9 +127,6 @@ H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, h * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -144,21 +137,21 @@ H5C_log_tear_down(H5C_t *cache) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Check logging flags */ if (FALSE == cache->log_info->enabled) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled"); /* Stop logging if that's going on */ if (cache->log_info->logging) if (H5C_stop_logging(cache) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to stop logging") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to stop logging"); /* Tear down logging */ if (cache->log_info->cls->tear_down_logging) if (cache->log_info->cls->tear_down_logging(cache->log_info) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific tear down call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific tear down call failed"); /* Unset logging flags */ cache->log_info->enabled = FALSE; @@ -174,9 +167,6 @@ H5C_log_tear_down(H5C_t *cache) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -187,16 +177,16 @@ H5C_start_logging(H5C_t *cache) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Check logging flags */ if (FALSE == cache->log_info->enabled) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled"); /* Start logging */ if (cache->log_info->cls->start_logging) if (cache->log_info->cls->start_logging(cache->log_info) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific start call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific start call failed"); /* Set logging flags */ cache->log_info->logging = TRUE; @@ -204,7 +194,7 @@ H5C_start_logging(H5C_t *cache) /* Write a log message */ if (cache->log_info->cls->write_start_log_msg) if (cache->log_info->cls->write_start_log_msg(cache->log_info->udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write start call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write start call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -217,9 +207,6 @@ H5C_start_logging(H5C_t *cache) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -230,23 +217,23 @@ H5C_stop_logging(H5C_t *cache) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Check logging flags */ if (FALSE == cache->log_info->enabled) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled"); if (FALSE == cache->log_info->logging) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not in progress") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not in progress"); /* Write a log message */ if (cache->log_info->cls->write_stop_log_msg) if (cache->log_info->cls->write_stop_log_msg(cache->log_info->udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write stop call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write stop call failed"); /* Stop logging */ if (cache->log_info->cls->stop_logging) if (cache->log_info->cls->stop_logging(cache->log_info) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific stop call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific stop call failed"); /* Set logging flags */ cache->log_info->logging = FALSE; @@ -263,9 +250,6 @@ H5C_stop_logging(H5C_t *cache) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -274,9 +258,9 @@ H5C_get_logging_status(const H5C_t *cache, hbool_t *is_enabled, hbool_t *is_curr FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(cache); - HDassert(is_enabled); - HDassert(is_currently_logging); + assert(cache); + assert(is_enabled); + assert(is_currently_logging); /* Get logging flags */ *is_enabled = cache->log_info->enabled; @@ -292,9 +276,6 @@ H5C_get_logging_status(const H5C_t *cache, hbool_t *is_enabled, hbool_t *is_curr * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -305,12 +286,12 @@ H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ if (cache->log_info->cls->write_create_cache_log_msg) if (cache->log_info->cls->write_create_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write create cache call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write create cache call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -327,9 +308,6 @@ H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -340,12 +318,12 @@ H5C_log_write_destroy_cache_msg(H5C_t *cache) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ if (cache->log_info->cls->write_destroy_cache_log_msg) if (cache->log_info->cls->write_destroy_cache_log_msg(cache->log_info->udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write destroy cache call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write destroy cache call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -358,9 +336,6 @@ H5C_log_write_destroy_cache_msg(H5C_t *cache) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -371,12 +346,12 @@ H5C_log_write_evict_cache_msg(H5C_t *cache, herr_t fxn_ret_value) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ if (cache->log_info->cls->write_evict_cache_log_msg) if (cache->log_info->cls->write_evict_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write evict cache call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write evict cache call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -389,9 +364,6 @@ H5C_log_write_evict_cache_msg(H5C_t *cache, herr_t fxn_ret_value) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -402,13 +374,13 @@ H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address, int type_id, herr FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ if (cache->log_info->cls->write_expunge_entry_log_msg) if (cache->log_info->cls->write_expunge_entry_log_msg(cache->log_info->udata, address, type_id, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write expunge entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write expunge entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -421,9 +393,6 @@ H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address, int type_id, herr * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -434,12 +403,12 @@ H5C_log_write_flush_cache_msg(H5C_t *cache, herr_t fxn_ret_value) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ if (cache->log_info->cls->write_flush_cache_log_msg) if (cache->log_info->cls->write_flush_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific flush cache call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific flush cache call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -452,9 +421,6 @@ H5C_log_write_flush_cache_msg(H5C_t *cache, herr_t fxn_ret_value) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -466,13 +432,13 @@ H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsig FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ if (cache->log_info->cls->write_insert_entry_log_msg) if (cache->log_info->cls->write_insert_entry_log_msg(cache->log_info->udata, address, type_id, flags, size, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific insert entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific insert entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -485,9 +451,6 @@ H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsig * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -498,14 +461,14 @@ H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry, FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(entry); + assert(entry); if (cache->log_info->cls->write_mark_entry_dirty_log_msg) if (cache->log_info->cls->write_mark_entry_dirty_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark dirty entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark dirty entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -518,9 +481,6 @@ H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -531,14 +491,14 @@ H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry, FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(entry); + assert(entry); if (cache->log_info->cls->write_mark_entry_clean_log_msg) if (cache->log_info->cls->write_mark_entry_clean_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark clean entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark clean entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -551,9 +511,6 @@ H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -564,14 +521,14 @@ H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(entry); + assert(entry); if (cache->log_info->cls->write_mark_unserialized_entry_log_msg) if (cache->log_info->cls->write_mark_unserialized_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark unserialized entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark unserialized entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -584,9 +541,6 @@ H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -597,14 +551,14 @@ H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *e FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(entry); + assert(entry); if (cache->log_info->cls->write_mark_serialized_entry_log_msg) if (cache->log_info->cls->write_mark_serialized_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark serialized entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark serialized entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -617,9 +571,6 @@ H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *e * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -631,13 +582,13 @@ H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr, i FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ if (cache->log_info->cls->write_move_entry_log_msg) if (cache->log_info->cls->write_move_entry_log_msg(cache->log_info->udata, old_addr, new_addr, type_id, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific move entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific move entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -650,9 +601,6 @@ H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr, i * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -663,13 +611,13 @@ H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(entry); + assert(entry); if (cache->log_info->cls->write_pin_entry_log_msg) if (cache->log_info->cls->write_pin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific pin entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific pin entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -683,9 +631,6 @@ H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -697,15 +642,15 @@ H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(parent); - HDassert(child); + assert(parent); + assert(child); if (cache->log_info->cls->write_create_fd_log_msg) if (cache->log_info->cls->write_create_fd_log_msg(cache->log_info->udata, parent, child, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific create fd call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific create fd call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -718,9 +663,6 @@ H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -732,14 +674,14 @@ H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, in FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(entry); + assert(entry); if (cache->log_info->cls->write_protect_entry_log_msg) if (cache->log_info->cls->write_protect_entry_log_msg(cache->log_info->udata, entry, type_id, flags, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific protect entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific protect entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -752,9 +694,6 @@ H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, in * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -766,14 +705,14 @@ H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, siz FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(entry); + assert(entry); if (cache->log_info->cls->write_resize_entry_log_msg) if (cache->log_info->cls->write_resize_entry_log_msg(cache->log_info->udata, entry, new_size, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific resize entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific resize entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -786,9 +725,6 @@ H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, siz * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -799,13 +735,13 @@ H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(entry); + assert(entry); if (cache->log_info->cls->write_unpin_entry_log_msg) if (cache->log_info->cls->write_unpin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unpin entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unpin entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -819,9 +755,6 @@ H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -833,15 +766,15 @@ H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, cons FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(parent); - HDassert(child); + assert(parent); + assert(child); if (cache->log_info->cls->write_destroy_fd_log_msg) if (cache->log_info->cls->write_destroy_fd_log_msg(cache->log_info->udata, parent, child, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific destroy fd call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific destroy fd call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -854,9 +787,6 @@ H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, cons * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -868,13 +798,13 @@ H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address, int type_id, un FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ if (cache->log_info->cls->write_unprotect_entry_log_msg) if (cache->log_info->cls->write_unprotect_entry_log_msg(cache->log_info->udata, address, type_id, flags, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unprotect entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unprotect entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -887,9 +817,6 @@ H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address, int type_id, un * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -900,14 +827,14 @@ H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *conf FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(config); + assert(config); if (cache->log_info->cls->write_set_cache_config_log_msg) if (cache->log_info->cls->write_set_cache_config_log_msg(cache->log_info->udata, config, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific set cache config call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific set cache config call failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -920,9 +847,6 @@ H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *conf * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -933,14 +857,14 @@ H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, her FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache); + assert(cache); /* Write a log message */ - HDassert(entry); + assert(entry); if (cache->log_info->cls->write_remove_entry_log_msg) if (cache->log_info->cls->write_remove_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific remove entry call failed") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific remove entry call failed"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Clog_json.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Clog_json.c index 05b1533d0e..52154d30de 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Clog_json.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Clog_json.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -153,9 +152,6 @@ static const H5C_log_class_t H5C_json_log_class_g = {"json", * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -167,22 +163,22 @@ H5C__json_write_log_message(H5C_log_json_udata_t *json_udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->outfile); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->outfile); + assert(json_udata->message); /* Write the log message and flush */ n_chars = HDstrlen(json_udata->message); - if ((int)n_chars != HDfprintf(json_udata->outfile, "%s", json_udata->message)) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message") - HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char))); + if ((int)n_chars != fprintf(json_udata->outfile, "%s", json_udata->message)) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message"); + memset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char))); done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__json_write_log_message() */ /*------------------------------------------------------------------------- - * Function: H5C_log_json_set_up + * Function: H5C__log_json_set_up * * Purpose: Setup for metadata cache logging. * @@ -200,36 +196,33 @@ H5C__json_write_log_message(H5C_log_json_udata_t *json_udata) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t -H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank) +H5C__log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank) { H5C_log_json_udata_t *json_udata = NULL; char *file_name = NULL; size_t n_chars; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(log_info); - HDassert(log_location); + assert(log_info); + assert(log_location); /* Set up the class struct */ log_info->cls = &H5C_json_log_class_g; /* Allocate memory for the JSON-specific data */ if (NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_json_udata_t)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed"); json_udata = (H5C_log_json_udata_t *)(log_info->udata); /* Allocate memory for the message buffer */ if (NULL == (json_udata->message = (char *)H5MM_calloc(H5C_MAX_JSON_LOG_MSG_SIZE * sizeof(char)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Possibly fix up the log file name. * The extra 39 characters are for adding the rank to the file name @@ -241,7 +234,7 @@ H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi n_chars = 5 + 39 + 1 + HDstrlen(log_location) + 1; if (NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char)))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "can't allocate memory for mdc log file name manipulation") + "can't allocate memory for mdc log file name manipulation"); /* Add the rank to the log file name when MPI is in use */ if (-1 == mpi_rank) @@ -250,8 +243,8 @@ H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi HDsnprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location); /* Open log file and set it to be unbuffered */ - if (NULL == (json_udata->outfile = HDfopen(file_name, "w"))) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file") + if (NULL == (json_udata->outfile = fopen(file_name, "w"))) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file"); HDsetbuf(json_udata->outfile, NULL); done: @@ -272,7 +265,7 @@ H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi } FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_log_json_set_up() */ +} /* H5C__log_json_set_up() */ /*------------------------------------------------------------------------- * Function: H5C__json_tear_down_logging @@ -281,9 +274,6 @@ H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -295,7 +285,7 @@ H5C__json_tear_down_logging(H5C_log_info_t *log_info) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(log_info); + assert(log_info); /* Alias */ json_udata = (H5C_log_json_udata_t *)(log_info->udata); @@ -304,8 +294,8 @@ H5C__json_tear_down_logging(H5C_log_info_t *log_info) H5MM_xfree(json_udata->message); /* Close log file */ - if (EOF == HDfclose(json_udata->outfile)) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file") + if (EOF == fclose(json_udata->outfile)) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file"); json_udata->outfile = NULL; /* Fre the udata */ @@ -326,9 +316,6 @@ H5C__json_tear_down_logging(H5C_log_info_t *log_info) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -340,8 +327,8 @@ H5C__json_write_start_log_msg(void *udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->message); /* Create the log message string (opens the JSON array) */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -356,7 +343,7 @@ H5C__json_write_start_log_msg(void *udata) /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -369,9 +356,6 @@ H5C__json_write_start_log_msg(void *udata) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -383,8 +367,8 @@ H5C__json_write_stop_log_msg(void *udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->message); /* Create the log message string (closes the JSON array) */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -398,7 +382,7 @@ H5C__json_write_stop_log_msg(void *udata) /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -411,9 +395,6 @@ H5C__json_write_stop_log_msg(void *udata) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -425,8 +406,8 @@ H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->message); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -440,7 +421,7 @@ H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value) /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -453,9 +434,6 @@ H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -467,8 +445,8 @@ H5C__json_write_destroy_cache_log_msg(void *udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->message); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -481,7 +459,7 @@ H5C__json_write_destroy_cache_log_msg(void *udata) /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -494,9 +472,6 @@ H5C__json_write_destroy_cache_log_msg(void *udata) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -508,8 +483,8 @@ H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->message); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -523,7 +498,7 @@ H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value) /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -536,9 +511,6 @@ H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -550,8 +522,8 @@ H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->message); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -567,7 +539,7 @@ H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -580,9 +552,6 @@ H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -594,8 +563,8 @@ H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->message); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -609,7 +578,7 @@ H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value) /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -622,9 +591,6 @@ H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -637,8 +603,8 @@ H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->message); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -657,7 +623,7 @@ H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -670,9 +636,6 @@ H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -684,9 +647,9 @@ H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *e FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(entry); + assert(json_udata); + assert(json_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -701,7 +664,7 @@ H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *e /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -714,9 +677,6 @@ H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *e * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -728,9 +688,9 @@ H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *e FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(entry); + assert(json_udata); + assert(json_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -745,7 +705,7 @@ H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *e /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -758,9 +718,6 @@ H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *e * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -773,9 +730,9 @@ H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_ent FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(entry); + assert(json_udata); + assert(json_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -790,7 +747,7 @@ H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_ent /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -803,9 +760,6 @@ H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_ent * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -818,9 +772,9 @@ H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(entry); + assert(json_udata); + assert(json_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -835,7 +789,7 @@ H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -848,9 +802,6 @@ H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -863,8 +814,8 @@ H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_ad FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->message); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -882,7 +833,7 @@ H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_ad /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -895,9 +846,6 @@ H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_ad * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -909,9 +857,9 @@ H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, h FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(entry); + assert(json_udata); + assert(json_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -926,7 +874,7 @@ H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, h /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -940,9 +888,6 @@ H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, h * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -955,10 +900,10 @@ H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(parent); - HDassert(child); + assert(json_udata); + assert(json_udata->message); + assert(parent); + assert(child); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -975,7 +920,7 @@ H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -988,9 +933,6 @@ H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -1004,9 +946,9 @@ H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entr FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(entry); + assert(json_udata); + assert(json_udata->message); + assert(entry); if (H5C__READ_ONLY_FLAG == flags) HDstrcpy(rw_s, "READ"); @@ -1030,7 +972,7 @@ H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entr /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1043,9 +985,6 @@ H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entr * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -1058,9 +997,9 @@ H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(entry); + assert(json_udata); + assert(json_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -1076,7 +1015,7 @@ H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1089,9 +1028,6 @@ H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -1103,9 +1039,9 @@ H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(entry); + assert(json_udata); + assert(json_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -1120,7 +1056,7 @@ H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1134,9 +1070,6 @@ H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -1149,10 +1082,10 @@ H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(parent); - HDassert(child); + assert(json_udata); + assert(json_udata->message); + assert(parent); + assert(child); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -1169,7 +1102,7 @@ H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1182,9 +1115,6 @@ H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -1197,8 +1127,8 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_i FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); + assert(json_udata); + assert(json_udata->message); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -1215,7 +1145,7 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_i /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1228,9 +1158,6 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_i * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -1243,9 +1170,9 @@ H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(config); + assert(json_udata); + assert(json_udata->message); + assert(config); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -1259,7 +1186,7 @@ H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1272,9 +1199,6 @@ H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -1286,9 +1210,9 @@ H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(json_udata); - HDassert(json_udata->message); - HDassert(entry); + assert(json_udata); + assert(json_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\ @@ -1303,7 +1227,7 @@ H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry /* Write the log message to the file */ if (H5C__json_write_log_message(json_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Clog_trace.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Clog_trace.c index 7424c9dc63..ffa415fdb7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Clog_trace.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Clog_trace.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -148,9 +147,6 @@ static const H5C_log_class_t H5C_trace_log_class_g = {"trace", * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -162,22 +158,22 @@ H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->outfile); - HDassert(trace_udata->message); + assert(trace_udata); + assert(trace_udata->outfile); + assert(trace_udata->message); /* Write the log message and flush */ n_chars = HDstrlen(trace_udata->message); - if ((int)n_chars != HDfprintf(trace_udata->outfile, "%s", trace_udata->message)) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message") - HDmemset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char))); + if ((int)n_chars != fprintf(trace_udata->outfile, "%s", trace_udata->message)) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message"); + memset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char))); done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__trace_write_log_message() */ /*------------------------------------------------------------------------- - * Function: H5C_log_trace_set_up + * Function: H5C__log_trace_set_up * * Purpose: Setup for metadata cache logging. * @@ -195,36 +191,33 @@ H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ herr_t -H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank) +H5C__log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank) { H5C_log_trace_udata_t *trace_udata = NULL; char *file_name = NULL; size_t n_chars; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(log_info); - HDassert(log_location); + assert(log_info); + assert(log_location); /* Set up the class struct */ log_info->cls = &H5C_trace_log_class_g; /* Allocate memory for the JSON-specific data */ if (NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_trace_udata_t)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed"); trace_udata = (H5C_log_trace_udata_t *)(log_info->udata); /* Allocate memory for the message buffer */ if (NULL == (trace_udata->message = (char *)H5MM_calloc(H5C_MAX_TRACE_LOG_MSG_SIZE * sizeof(char)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Possibly fix up the log file name. * The extra 39 characters are for adding the rank to the file name @@ -236,7 +229,7 @@ H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mp n_chars = HDstrlen(log_location) + 1 + 39 + 1; if (NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char)))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, - "can't allocate memory for mdc log file name manipulation") + "can't allocate memory for mdc log file name manipulation"); /* Add the rank to the log file name when MPI is in use */ if (-1 == mpi_rank) @@ -245,12 +238,12 @@ H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mp HDsnprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank); /* Open log file and set it to be unbuffered */ - if (NULL == (trace_udata->outfile = HDfopen(file_name, "w"))) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file") + if (NULL == (trace_udata->outfile = fopen(file_name, "w"))) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file"); HDsetbuf(trace_udata->outfile, NULL); /* Write the header */ - HDfprintf(trace_udata->outfile, "### HDF5 metadata cache trace file version 1 ###\n"); + fprintf(trace_udata->outfile, "### HDF5 metadata cache trace file version 1 ###\n"); done: if (file_name) @@ -270,7 +263,7 @@ H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mp } FUNC_LEAVE_NOAPI(ret_value) -} /* H5C_log_trace_set_up() */ +} /* H5C__log_trace_set_up() */ /*------------------------------------------------------------------------- * Function: H5C__trace_tear_down_logging @@ -279,9 +272,6 @@ H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mp * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -293,7 +283,7 @@ H5C__trace_tear_down_logging(H5C_log_info_t *log_info) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(log_info); + assert(log_info); /* Alias */ trace_udata = (H5C_log_trace_udata_t *)(log_info->udata); @@ -302,8 +292,8 @@ H5C__trace_tear_down_logging(H5C_log_info_t *log_info) H5MM_xfree(trace_udata->message); /* Close log file */ - if (EOF == HDfclose(trace_udata->outfile)) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file") + if (EOF == fclose(trace_udata->outfile)) + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file"); trace_udata->outfile = NULL; /* Fre the udata */ @@ -324,9 +314,6 @@ H5C__trace_tear_down_logging(H5C_log_info_t *log_info) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -338,8 +325,8 @@ H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); + assert(trace_udata); + assert(trace_udata->message); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_expunge_entry 0x%lx %d %d\n", @@ -347,7 +334,7 @@ H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -360,9 +347,6 @@ H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -374,15 +358,15 @@ H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); + assert(trace_udata); + assert(trace_udata->message); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_flush %d\n", (int)fxn_ret_value); /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -395,9 +379,6 @@ H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -410,8 +391,8 @@ H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); + assert(trace_udata); + assert(trace_udata->message); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_insert_entry 0x%lx %d 0x%x %d %d\n", @@ -419,7 +400,7 @@ H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -432,9 +413,6 @@ H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -446,9 +424,9 @@ H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t * FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(entry); + assert(trace_udata); + assert(trace_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_dirty 0x%lx %d\n", @@ -456,7 +434,7 @@ H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t * /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -469,9 +447,6 @@ H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t * * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -483,9 +458,9 @@ H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t * FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(entry); + assert(trace_udata); + assert(trace_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_clean 0x%lx %d\n", @@ -493,7 +468,7 @@ H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t * /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -506,9 +481,6 @@ H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t * * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -521,9 +493,9 @@ H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_en FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(entry); + assert(trace_udata); + assert(trace_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_unserialized 0x%lx %d\n", @@ -531,7 +503,7 @@ H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_en /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -544,9 +516,6 @@ H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_en * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -559,9 +528,9 @@ H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entr FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(entry); + assert(trace_udata); + assert(trace_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_serialized 0x%lx %d\n", @@ -569,7 +538,7 @@ H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entr /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -582,9 +551,6 @@ H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entr * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -597,8 +563,8 @@ H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_a FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); + assert(trace_udata); + assert(trace_udata->message); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_move_entry 0x%lx 0x%lx %d %d\n", @@ -606,7 +572,7 @@ H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_a /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -619,9 +585,6 @@ H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_a * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -633,9 +596,9 @@ H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(entry); + assert(trace_udata); + assert(trace_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_pin_protected_entry 0x%lx %d\n", @@ -643,7 +606,7 @@ H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -657,9 +620,6 @@ H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -672,10 +632,10 @@ H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(parent); - HDassert(child); + assert(trace_udata); + assert(trace_udata->message); + assert(parent); + assert(child); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, @@ -684,7 +644,7 @@ H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -697,9 +657,6 @@ H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -712,9 +669,9 @@ H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *ent FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(entry); + assert(trace_udata); + assert(trace_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_protect 0x%lx %d 0x%x %d %d\n", @@ -722,7 +679,7 @@ H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *ent /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -735,9 +692,6 @@ H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *ent * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -750,9 +704,9 @@ H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entr FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(entry); + assert(trace_udata); + assert(trace_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_resize_entry 0x%lx %d %d\n", @@ -760,7 +714,7 @@ H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entr /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -773,9 +727,6 @@ H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entr * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -787,9 +738,9 @@ H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(entry); + assert(trace_udata); + assert(trace_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unpin_entry 0x%lx %d\n", @@ -797,7 +748,7 @@ H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -811,9 +762,6 @@ H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -826,10 +774,10 @@ H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(parent); - HDassert(child); + assert(trace_udata); + assert(trace_udata->message); + assert(parent); + assert(child); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, @@ -838,7 +786,7 @@ H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -851,9 +799,6 @@ H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -866,8 +811,8 @@ H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); + assert(trace_udata); + assert(trace_udata->message); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n", @@ -875,7 +820,7 @@ H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_ /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -888,9 +833,6 @@ H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_ * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -903,9 +845,9 @@ H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(config); + assert(trace_udata); + assert(trace_udata->message); + assert(config); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, @@ -925,7 +867,7 @@ H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -938,9 +880,6 @@ H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -952,9 +891,9 @@ H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entr FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(trace_udata); - HDassert(trace_udata->message); - HDassert(entry); + assert(trace_udata); + assert(trace_udata->message); + assert(entry); /* Create the log message string */ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_remove_entry 0x%lx %d\n", @@ -962,7 +901,7 @@ H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entr /* Write the log message to the file */ if (H5C__trace_write_log_message(trace_udata) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message") + HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Cmpio.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Cmpio.c index 8103989630..a7de3c8315 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Cmpio.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Cmpio.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Cmpio.c - * June 20 2015 - * Quincey Koziol * * Purpose: Functions in this file implement support for parallel I/O for * generic cache code. @@ -151,25 +148,24 @@ static herr_t H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned * * Failure: FAIL * - * Programmer: John Mainzer - * 3/17/10 - * *------------------------------------------------------------------------- */ herr_t H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr, int mpi_rank, int mpi_size) { - unsigned first_entry_to_flush; - unsigned last_entry_to_flush; - unsigned total_entries_to_clear = 0; - unsigned total_entries_to_flush = 0; + unsigned first_entry_to_flush; + unsigned last_entry_to_flush; +#ifndef NDEBUG + unsigned total_entries_to_clear = 0; + unsigned total_entries_to_flush = 0; +#endif unsigned *candidate_assignment_table = NULL; unsigned entries_to_flush[H5C_RING_NTYPES]; unsigned entries_to_clear[H5C_RING_NTYPES]; haddr_t addr; H5C_cache_entry_t *entry_ptr = NULL; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS haddr_t last_addr; #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_APPLY_CANDIDATE_LIST__DEBUG @@ -182,38 +178,37 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(num_candidates > 0); - HDassert((!cache_ptr->slist_enabled) || (num_candidates <= cache_ptr->slist_len)); - HDassert(candidates_list_ptr != NULL); - HDassert(0 <= mpi_rank); - HDassert(mpi_rank < mpi_size); + assert(cache_ptr != NULL); + assert(num_candidates > 0); + assert((!cache_ptr->slist_enabled) || (num_candidates <= cache_ptr->slist_len)); + assert(candidates_list_ptr != NULL); + assert(0 <= mpi_rank); + assert(mpi_rank < mpi_size); /* Initialize the entries_to_flush and entries_to_clear arrays */ - HDmemset(entries_to_flush, 0, sizeof(entries_to_flush)); - HDmemset(entries_to_clear, 0, sizeof(entries_to_clear)); + memset(entries_to_flush, 0, sizeof(entries_to_flush)); + memset(entries_to_clear, 0, sizeof(entries_to_clear)); #if H5C_APPLY_CANDIDATE_LIST__DEBUG - HDfprintf(stdout, "%s:%d: setting up candidate assignment table.\n", __func__, mpi_rank); + fprintf(stdout, "%s:%d: setting up candidate assignment table.\n", __func__, mpi_rank); - HDmemset(tbl_buf, 0, sizeof(tbl_buf)); + memset(tbl_buf, 0, sizeof(tbl_buf)); HDsnprintf(tbl_buf, sizeof(tbl_buf), "candidate list = "); for (u = 0; u < num_candidates; u++) HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u))); HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); - HDfprintf(stdout, "%s", tbl_buf); + fprintf(stdout, "%s", tbl_buf); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ if (f->shared->coll_md_write) { /* Sanity check */ - HDassert(NULL == cache_ptr->coll_write_list); + assert(NULL == cache_ptr->coll_write_list); /* Create skip list of entries for collective write */ if (NULL == (cache_ptr->coll_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "can't create skip list for entries"); } /* end if */ n = num_candidates / (unsigned)mpi_size; @@ -221,8 +216,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha if (NULL == (candidate_assignment_table = (unsigned *)H5MM_malloc(sizeof(unsigned) * (size_t)(mpi_size + 1)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for candidate assignment table") + HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, "memory allocation failed for candidate assignment table"); candidate_assignment_table[0] = 0; candidate_assignment_table[mpi_size] = num_candidates; @@ -244,9 +238,9 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha candidate_assignment_table[u] = candidate_assignment_table[u - 1] + n; } /* end else */ } /* end else */ - HDassert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates); + assert((candidate_assignment_table[mpi_size - 1] + n) == num_candidates); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS /* Verify that the candidate assignment table has the expected form */ for (u = 1; u < (unsigned)(mpi_size - 1); u++) { unsigned a, b; @@ -254,9 +248,9 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha a = candidate_assignment_table[u] - candidate_assignment_table[u - 1]; b = candidate_assignment_table[u + 1] - candidate_assignment_table[u]; - HDassert(n + 1 >= a); - HDassert(a >= b); - HDassert(b >= n); + assert(n + 1 >= a); + assert(a >= b); + assert(b >= n); } #endif /* H5C_DO_SANITY_CHECKS */ @@ -270,47 +264,46 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha for (u = 0; u <= (unsigned)mpi_size; u++) HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[u]); HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); - HDfprintf(stdout, "%s", tbl_buf); + fprintf(stdout, "%s", tbl_buf); - HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n", __func__, mpi_rank, first_entry_to_flush, - last_entry_to_flush); + fprintf(stdout, "%s:%d: flush entries [%u, %u].\n", __func__, mpi_rank, first_entry_to_flush, + last_entry_to_flush); - HDfprintf(stdout, "%s:%d: marking entries.\n", __func__, mpi_rank); + fprintf(stdout, "%s:%d: marking entries.\n", __func__, mpi_rank); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ for (u = 0; u < num_candidates; u++) { addr = candidates_list_ptr[u]; - HDassert(H5F_addr_defined(addr)); + assert(H5_addr_defined(addr)); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS if (u > 0) { if (last_addr == addr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "duplicate entry in cleaned list") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "duplicate entry in cleaned list"); else if (last_addr > addr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "candidate list not sorted") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "candidate list not sorted"); } /* end if */ last_addr = addr; #endif /* H5C_DO_SANITY_CHECKS */ - H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL); if (entry_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "listed candidate entry not in cache?!?!?") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "listed candidate entry not in cache?!?!?"); if (!entry_ptr->is_dirty) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?"); if (entry_ptr->is_protected) /* For now at least, we can't deal with protected entries. * If we encounter one, scream and die. If it becomes an * issue, we should be able to work around this. */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry is protected?!?!?") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry is protected?!?!?"); /* Sanity checks */ - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->ring >= H5C_RING_USER); - HDassert(entry_ptr->ring <= H5C_RING_SB); - HDassert(!entry_ptr->flush_immediately); - HDassert(!entry_ptr->clear_on_unprotect); + assert(entry_ptr->ring >= H5C_RING_USER); + assert(entry_ptr->ring <= H5C_RING_SB); + assert(!entry_ptr->flush_immediately); + assert(!entry_ptr->clear_on_unprotect); /* Determine whether the entry is to be cleared or flushed, * and mark it accordingly. We will scan the protected and @@ -318,12 +311,16 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha * markings. */ if (u >= first_entry_to_flush && u <= last_entry_to_flush) { +#ifndef NDEBUG total_entries_to_flush++; +#endif entries_to_flush[entry_ptr->ring]++; entry_ptr->flush_immediately = TRUE; } /* end if */ else { +#ifndef NDEBUG total_entries_to_clear++; +#endif entries_to_clear[entry_ptr->ring]++; entry_ptr->clear_on_unprotect = TRUE; } /* end else */ @@ -336,11 +333,11 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha */ if (entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL); } /* end if */ } /* end for */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS m = 0; n = 0; for (u = 0; u < H5C_RING_NTYPES; u++) { @@ -348,13 +345,13 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha n += entries_to_clear[u]; } /* end if */ - HDassert((unsigned)m == total_entries_to_flush); - HDassert(n == total_entries_to_clear); + assert((unsigned)m == total_entries_to_flush); + assert(n == total_entries_to_clear); #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_APPLY_CANDIDATE_LIST__DEBUG - HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n", __func__, mpi_rank, - num_candidates, total_entries_to_clear, total_entries_to_flush); + fprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n", __func__, mpi_rank, + num_candidates, total_entries_to_clear, total_entries_to_flush); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ /* We have now marked all the entries on the candidate list for @@ -368,16 +365,16 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha * noticeably poorer hit ratio as a result. */ if (H5C__flush_candidate_entries(f, entries_to_flush, entries_to_clear) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush candidates failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush candidates failed"); /* If we've deferred writing to do it collectively, take care of that now */ if (f->shared->coll_md_write) { /* Sanity check */ - HDassert(cache_ptr->coll_write_list); + assert(cache_ptr->coll_write_list); /* Write collective list */ if (H5C__collective_write(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "can't write metadata collectively") + HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "can't write metadata collectively"); } /* end if */ done: @@ -385,7 +382,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha candidate_assignment_table = (unsigned *)H5MM_xfree((void *)candidate_assignment_table); if (cache_ptr->coll_write_list) { if (H5SL_close(cache_ptr->coll_write_list) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list") + HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list"); cache_ptr->coll_write_list = NULL; } /* end if */ @@ -393,7 +390,6 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha } /* H5C_apply_candidate_list() */ /*------------------------------------------------------------------------- - * * Function: H5C_construct_candidate_list__clean_cache * * Purpose: Construct the list of entries that should be flushed to @@ -403,22 +399,8 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha * shouldn't be used elsewhere. * * Return: Success: SUCCEED - * * Failure: FAIL * - * Programmer: John Mainzer - * 3/17/10 - * - * Changes: With the slist optimization, the slist is not maintained - * unless a flush is in progress. Thus we can not longer use - * cache_ptr->slist_size to determine the total size of - * the entries we must insert in the candidate list. - * - * To address this, we now use cache_ptr->dirty_index_size - * instead. - * - * JRM -- 7/27/20 - * *------------------------------------------------------------------------- */ herr_t @@ -429,8 +411,7 @@ H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr) FUNC_ENTER_NOAPI(FAIL) - HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr != NULL); /* As a sanity check, set space needed to the dirty_index_size. This * should be the sum total of the sizes of all the dirty entries @@ -439,95 +420,79 @@ H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr) */ space_needed = cache_ptr->dirty_index_size; - HDassert((!cache_ptr->slist_enabled) || (space_needed == cache_ptr->slist_size)); + assert((!cache_ptr->slist_enabled) || (space_needed == cache_ptr->slist_size)); - /* Recall that while we shouldn't have any protected entries at this - * point, it is possible that some dirty entries may reside on the - * pinned list at this point. + /* We shouldn't have any protected entries at this point, but it is + * possible that some dirty entries may reside on the pinned list. */ - HDassert(cache_ptr->dirty_index_size <= (cache_ptr->dLRU_list_size + cache_ptr->pel_size)); - HDassert((!cache_ptr->slist_enabled) || - (cache_ptr->slist_len <= (cache_ptr->dLRU_list_len + cache_ptr->pel_len))); - - if (space_needed > 0) { /* we have work to do */ + assert(cache_ptr->dirty_index_size <= (cache_ptr->dLRU_list_size + cache_ptr->pel_size)); + assert((!cache_ptr->slist_enabled) || + (cache_ptr->slist_len <= (cache_ptr->dLRU_list_len + cache_ptr->pel_len))); + if (space_needed > 0) { H5C_cache_entry_t *entry_ptr; unsigned nominated_entries_count = 0; size_t nominated_entries_size = 0; haddr_t nominated_addr; - HDassert((!cache_ptr->slist_enabled) || (cache_ptr->slist_len > 0)); + assert((!cache_ptr->slist_enabled) || (cache_ptr->slist_len > 0)); /* Scan the dirty LRU list from tail forward and nominate sufficient * entries to free up the necessary space. */ entry_ptr = cache_ptr->dLRU_tail_ptr; - while ((nominated_entries_size < space_needed) && ((!cache_ptr->slist_enabled) || (nominated_entries_count < cache_ptr->slist_len)) && (entry_ptr != NULL)) { - - HDassert(!(entry_ptr->is_protected)); - HDassert(!(entry_ptr->is_read_only)); - HDassert(entry_ptr->ro_ref_count == 0); - HDassert(entry_ptr->is_dirty); - HDassert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist)); + assert(!(entry_ptr->is_protected)); + assert(!(entry_ptr->is_read_only)); + assert(entry_ptr->ro_ref_count == 0); + assert(entry_ptr->is_dirty); + assert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist)); nominated_addr = entry_ptr->addr; - if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed"); nominated_entries_size += entry_ptr->size; nominated_entries_count++; - entry_ptr = entry_ptr->aux_prev; + entry_ptr = entry_ptr->aux_prev; } /* end while */ - HDassert(entry_ptr == NULL); + assert(entry_ptr == NULL); /* it is possible that there are some dirty entries on the * protected entry list as well -- scan it too if necessary */ entry_ptr = cache_ptr->pel_head_ptr; - while ((nominated_entries_size < space_needed) && ((!cache_ptr->slist_enabled) || (nominated_entries_count < cache_ptr->slist_len)) && (entry_ptr != NULL)) { - if (entry_ptr->is_dirty) { - - HDassert(!(entry_ptr->is_protected)); - HDassert(!(entry_ptr->is_read_only)); - HDassert(entry_ptr->ro_ref_count == 0); - HDassert(entry_ptr->is_dirty); - HDassert(entry_ptr->in_slist); + assert(!(entry_ptr->is_protected)); + assert(!(entry_ptr->is_read_only)); + assert(entry_ptr->ro_ref_count == 0); + assert(entry_ptr->is_dirty); + assert(entry_ptr->in_slist); nominated_addr = entry_ptr->addr; - if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed"); nominated_entries_size += entry_ptr->size; nominated_entries_count++; - } /* end if */ entry_ptr = entry_ptr->next; - } /* end while */ - HDassert((!cache_ptr->slist_enabled) || (nominated_entries_count == cache_ptr->slist_len)); - HDassert(nominated_entries_size == space_needed); - + assert((!cache_ptr->slist_enabled) || (nominated_entries_count == cache_ptr->slist_len)); + assert(nominated_entries_size == space_needed); } /* end if */ done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_construct_candidate_list__clean_cache() */ /*------------------------------------------------------------------------- @@ -543,15 +508,6 @@ H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr) * * Failure: FAIL * - * Programmer: John Mainzer - * 3/17/10 - * - * Changes: With the slist optimization, the slist is not maintained - * unless a flush is in progress. Updated sanity checks to - * reflect this. - * - * JRM -- 7/27/20 - * *------------------------------------------------------------------------- */ herr_t @@ -562,8 +518,7 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr) FUNC_ENTER_NOAPI(FAIL) - HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr != NULL); /* compute the number of bytes (if any) that must be flushed to get the * cache back within its min clean constraints. @@ -571,68 +526,54 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr) if (cache_ptr->max_cache_size > cache_ptr->index_size) { if (((cache_ptr->max_cache_size - cache_ptr->index_size) + cache_ptr->cLRU_list_size) >= - cache_ptr->min_clean_size) { - + cache_ptr->min_clean_size) space_needed = 0; - } - else { - + else space_needed = cache_ptr->min_clean_size - ((cache_ptr->max_cache_size - cache_ptr->index_size) + cache_ptr->cLRU_list_size); - } } /* end if */ else { - - if (cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size) { - + if (cache_ptr->min_clean_size <= cache_ptr->cLRU_list_size) space_needed = 0; - } - else { - + else space_needed = cache_ptr->min_clean_size - cache_ptr->cLRU_list_size; - } } /* end else */ if (space_needed > 0) { /* we have work to do */ - H5C_cache_entry_t *entry_ptr; unsigned nominated_entries_count = 0; size_t nominated_entries_size = 0; - HDassert((!cache_ptr->slist_enabled) || (cache_ptr->slist_len > 0)); + assert((!cache_ptr->slist_enabled) || (cache_ptr->slist_len > 0)); /* Scan the dirty LRU list from tail forward and nominate sufficient * entries to free up the necessary space. */ entry_ptr = cache_ptr->dLRU_tail_ptr; - while ((nominated_entries_size < space_needed) && ((!cache_ptr->slist_enabled) || (nominated_entries_count < cache_ptr->slist_len)) && (entry_ptr != NULL) && (!entry_ptr->flush_me_last)) { - haddr_t nominated_addr; - HDassert(!(entry_ptr->is_protected)); - HDassert(!(entry_ptr->is_read_only)); - HDassert(entry_ptr->ro_ref_count == 0); - HDassert(entry_ptr->is_dirty); - HDassert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist)); + assert(!(entry_ptr->is_protected)); + assert(!(entry_ptr->is_read_only)); + assert(entry_ptr->ro_ref_count == 0); + assert(entry_ptr->is_dirty); + assert((!cache_ptr->slist_enabled) || (entry_ptr->in_slist)); nominated_addr = entry_ptr->addr; - if (H5AC_add_candidate((H5AC_t *)cache_ptr, nominated_addr) < 0) - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_add_candidate() failed"); nominated_entries_size += entry_ptr->size; nominated_entries_count++; - entry_ptr = entry_ptr->aux_prev; + entry_ptr = entry_ptr->aux_prev; } /* end while */ - HDassert((!cache_ptr->slist_enabled) || (nominated_entries_count <= cache_ptr->slist_len)); - HDassert(nominated_entries_size <= cache_ptr->dirty_index_size); - HDassert(nominated_entries_size >= space_needed); + assert((!cache_ptr->slist_enabled) || (nominated_entries_count <= cache_ptr->slist_len)); + assert(nominated_entries_size <= cache_ptr->dirty_index_size); + assert(nominated_entries_size >= space_needed); } /* end if */ done: @@ -640,7 +581,6 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr) } /* H5C_construct_candidate_list__min_clean() */ /*------------------------------------------------------------------------- - * * Function: H5C_mark_entries_as_clean * * Purpose: When the H5C code is used to implement the metadata caches @@ -665,9 +605,6 @@ H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 7/5/05 - * *------------------------------------------------------------------------- */ herr_t @@ -681,7 +618,7 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr unsigned initial_list_len; haddr_t addr; unsigned pinned_entries_marked = 0; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS unsigned protected_entries_marked = 0; unsigned other_entries_marked = 0; haddr_t last_addr; @@ -693,57 +630,55 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); - HDassert(ce_array_len > 0); - HDassert(ce_array_ptr != NULL); + assert(ce_array_len > 0); + assert(ce_array_ptr != NULL); -#if H5C_DO_EXTREME_SANITY_CHECKS - if (H5C_validate_protected_entry_list(cache_ptr) < 0 || H5C_validate_pinned_entry_list(cache_ptr) < 0 || - H5C_validate_lru_list(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ for (u = 0; u < ce_array_len; u++) { addr = ce_array_ptr[u]; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS if (u == 0) last_addr = addr; else { if (last_addr == addr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Duplicate entry in cleaned list") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Duplicate entry in cleaned list"); if (last_addr > addr) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cleaned list not sorted") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cleaned list not sorted"); } /* end else */ -#if H5C_DO_EXTREME_SANITY_CHECKS - if (H5C_validate_protected_entry_list(cache_ptr) < 0 || - H5C_validate_pinned_entry_list(cache_ptr) < 0 || H5C_validate_lru_list(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed in for loop") +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || + H5C__validate_pinned_entry_list(cache_ptr) < 0 || H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed in for loop"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ #endif /* H5C_DO_SANITY_CHECKS */ - HDassert(H5F_addr_defined(addr)); + assert(H5_addr_defined(addr)); - H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL); if (entry_ptr == NULL) { -#if H5C_DO_SANITY_CHECKS - HDfprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %" PRIuHADDR " not in cache.\n", u, - addr); +#ifdef H5C_DO_SANITY_CHECKS + fprintf(stdout, "H5C_mark_entries_as_clean: entry[%u] = %" PRIuHADDR " not in cache.\n", u, addr); #endif /* H5C_DO_SANITY_CHECKS */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not in cache?!?!?") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not in cache?!?!?"); } /* end if */ else if (!entry_ptr->is_dirty) { -#if H5C_DO_SANITY_CHECKS - HDfprintf(stdout, "H5C_mark_entries_as_clean: entry %" PRIuHADDR " is not dirty!?!\n", addr); +#ifdef H5C_DO_SANITY_CHECKS + fprintf(stdout, "H5C_mark_entries_as_clean: entry %" PRIuHADDR " is not dirty!?!\n", addr); #endif /* H5C_DO_SANITY_CHECKS */ - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Listed entry not dirty?!?!?"); } /* end else-if */ else { /* Mark the entry to be cleared on unprotect. We will @@ -755,13 +690,13 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr it so it can be cleared */ if (TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL); } /* end if */ entry_ptr->clear_on_unprotect = TRUE; if (entry_ptr->is_pinned) pinned_entries_marked++; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS else if (entry_ptr->is_protected) protected_entries_marked++; else @@ -786,14 +721,8 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr * resizes, or removals of other entries can occur as * a side effect of the flush. Hence, there is no need * for the checks for entry removal / status change - * that I ported to H5C_apply_candidate_list(). + * that are in H5C_apply_candidate_list(). * - * However, if (in addition to allowing such operations - * in the parallel case), we allow such operations outside - * of the pre_serialize / serialize routines, this may - * cease to be the case -- requiring a review of this - * point. - * JRM -- 4/7/15 */ entries_cleared = 0; entries_examined = 0; @@ -809,15 +738,15 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr if (H5C__flush_single_entry(f, clear_ptr, (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG | H5C__UPDATE_PAGE_BUFFER_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear entry"); } /* end if */ else entry_ptr = entry_ptr->prev; entries_examined++; } /* end while */ -#if H5C_DO_SANITY_CHECKS - HDassert(entries_cleared == other_entries_marked); +#ifdef H5C_DO_SANITY_CHECKS + assert(entries_cleared == other_entries_marked); #endif /* H5C_DO_SANITY_CHECKS */ /* It is also possible that some of the cleared entries are on the @@ -840,45 +769,42 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr if (H5C__flush_single_entry(f, clear_ptr, (H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__GENERATE_IMAGE_FLAG | H5C__UPDATE_PAGE_BUFFER_FLAG)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear entry"); } /* end if */ else entry_ptr = entry_ptr->next; } /* end while */ } /* end while */ -#if H5C_DO_SANITY_CHECKS - HDassert(entries_cleared == pinned_entries_marked + other_entries_marked); - HDassert(entries_cleared + protected_entries_marked == ce_array_len); +#ifdef H5C_DO_SANITY_CHECKS + assert(entries_cleared == pinned_entries_marked + other_entries_marked); + assert(entries_cleared + protected_entries_marked == ce_array_len); #endif /* H5C_DO_SANITY_CHECKS */ - HDassert((entries_cleared == ce_array_len) || ((ce_array_len - entries_cleared) <= cache_ptr->pl_len)); + assert((entries_cleared == ce_array_len) || ((ce_array_len - entries_cleared) <= cache_ptr->pl_len)); -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS u = 0; entry_ptr = cache_ptr->pl_head_ptr; while (entry_ptr != NULL) { - if (entry_ptr->clear_on_unprotect) { - + if (entry_ptr->clear_on_unprotect) u++; - } entry_ptr = entry_ptr->next; } - HDassert((entries_cleared + u) == ce_array_len); + assert((entries_cleared + u) == ce_array_len); #endif /* H5C_DO_SANITY_CHECKS */ done: -#if H5C_DO_EXTREME_SANITY_CHECKS - if (H5C_validate_protected_entry_list(cache_ptr) < 0 || H5C_validate_pinned_entry_list(cache_ptr) < 0 || - H5C_validate_lru_list(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit") +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HDONE_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) } /* H5C_mark_entries_as_clean() */ /*------------------------------------------------------------------------- - * * Function: H5C_clear_coll_entries * * Purpose: Clear half or the entire list of collective entries and @@ -886,9 +812,6 @@ H5C_mark_entries_as_clean(H5F_t *f, unsigned ce_array_len, haddr_t *ce_array_ptr * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Mohamad Chaarawi - * April, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -898,7 +821,7 @@ H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial) H5C_cache_entry_t *entry_ptr = NULL; herr_t ret_value = SUCCEED; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS FUNC_ENTER_NOAPI_NOINIT #else FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -910,11 +833,11 @@ H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial) H5C_cache_entry_t *prev_ptr = entry_ptr->coll_prev; /* Sanity check */ - HDassert(entry_ptr->coll_access); + assert(entry_ptr->coll_access); /* Mark entry as independent */ entry_ptr->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL); /* Decrement entry count */ clear_cnt--; @@ -923,23 +846,19 @@ H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial) entry_ptr = prev_ptr; } /* end while */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS done: #endif /* H5C_DO_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) } /* H5C_clear_coll_entries */ /*------------------------------------------------------------------------- - * * Function: H5C__collective_write * * Purpose: Perform a collective write of a list of metadata entries. * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Mohamad Chaarawi - * February, 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -958,18 +877,18 @@ H5C__collective_write(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f != NULL); + assert(f != NULL); cache_ptr = f->shared->cache; - HDassert(cache_ptr != NULL); - HDassert(cache_ptr->coll_write_list != NULL); + assert(cache_ptr != NULL); + assert(cache_ptr->coll_write_list != NULL); /* Get original transfer mode */ if (H5CX_get_io_xfer_mode(&orig_xfer_mode) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); /* Set transfer mode */ if (H5CX_set_io_xfer_mode(H5FD_MPIO_COLLECTIVE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode"); /* Get number of entries in collective write list */ count = H5SL_count(cache_ptr->coll_write_list); @@ -982,41 +901,49 @@ H5C__collective_write(H5F_t *f) int i; if (NULL == (addrs = H5MM_malloc(count * sizeof(*addrs)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "couldn't allocate address array") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "couldn't allocate address array"); if (NULL == (sizes = H5MM_malloc(count * sizeof(*sizes)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "couldn't allocate sizes array") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "couldn't allocate sizes array"); if (NULL == (bufs = H5MM_malloc(count * sizeof(*bufs)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "couldn't allocate buffers array") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "couldn't allocate buffers array"); if (NULL == (types = H5MM_malloc(count * sizeof(*types)))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "couldn't allocate types array") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "couldn't allocate types array"); /* Fill arrays */ node = H5SL_first(cache_ptr->coll_write_list); - HDassert(node); + assert(node); if (NULL == (entry_ptr = (H5C_cache_entry_t *)H5SL_item(node))) - HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item"); /* Set up initial array position & buffer base address */ - HDassert(entry_ptr->type); + assert(entry_ptr->type); base_buf = entry_ptr->image_ptr; addrs[0] = entry_ptr->addr; sizes[0] = entry_ptr->size; bufs[0] = base_buf; types[0] = entry_ptr->type->mem_type; + /* Treat global heap as raw data */ + if (types[0] == H5FD_MEM_GHEAP) + types[0] = H5FD_MEM_DRAW; + node = H5SL_next(node); i = 1; while (node) { if (NULL == (entry_ptr = (H5C_cache_entry_t *)H5SL_item(node))) - HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item"); /* Set up array position */ - HDassert(entry_ptr->type); + assert(entry_ptr->type); addrs[i] = entry_ptr->addr; sizes[i] = entry_ptr->size; bufs[i] = entry_ptr->image_ptr; types[i] = entry_ptr->type->mem_type; + /* Treat global heap as raw data */ + if (types[i] == H5FD_MEM_GHEAP) + types[i] = H5FD_MEM_DRAW; + /* Advance to next node & array location */ node = H5SL_next(node); i++; @@ -1025,11 +952,11 @@ H5C__collective_write(H5F_t *f) /* Pass buf type, file type to the file driver */ if (H5CX_set_mpi_coll_datatypes(MPI_BYTE, MPI_BYTE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O properties") + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O properties"); /* Make vector write call */ if (H5F_shared_vector_write(H5F_SHARED(f), count32, types, addrs, sizes, bufs) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write entries") + HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "unable to write entries"); done: H5MM_xfree(types); @@ -1040,9 +967,9 @@ H5C__collective_write(H5F_t *f) /* Reset transfer mode in API context, if changed */ if (orig_xfer_mode != H5FD_MPIO_COLLECTIVE) if (H5CX_set_io_xfer_mode(orig_xfer_mode) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode") + HDONE_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode"); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5C__collective_write() */ /*------------------------------------------------------------------------- @@ -1076,18 +1003,13 @@ H5C__collective_write(H5F_t *f) * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer - * 2/10/17 - * - * Changes: None. - * *------------------------------------------------------------------------- */ static herr_t H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES], unsigned entries_to_clear[H5C_RING_NTYPES]) { -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS int i; uint32_t index_len = 0; size_t index_size = (size_t)0; @@ -1102,25 +1024,22 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(f->shared); - + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; + assert(cache_ptr); + assert(cache_ptr->slist_ptr); - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->slist_ptr); - - HDassert(entries_to_flush[H5C_RING_UNDEFINED] == 0); - HDassert(entries_to_clear[H5C_RING_UNDEFINED] == 0); + assert(entries_to_flush[H5C_RING_UNDEFINED] == 0); + assert(entries_to_clear[H5C_RING_UNDEFINED] == 0); -#if H5C_DO_SANITY_CHECKS - HDassert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); - HDassert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); - HDassert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); - HDassert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); +#ifdef H5C_DO_SANITY_CHECKS + assert(cache_ptr->index_ring_len[H5C_RING_UNDEFINED] == 0); + assert(cache_ptr->index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->clean_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->dirty_index_ring_size[H5C_RING_UNDEFINED] == (size_t)0); + assert(cache_ptr->slist_ring_len[H5C_RING_UNDEFINED] == 0); + assert(cache_ptr->slist_ring_size[H5C_RING_UNDEFINED] == (size_t)0); for (i = H5C_RING_USER; i < H5C_RING_NTYPES; i++) { index_len += cache_ptr->index_ring_len[i]; @@ -1132,18 +1051,18 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES slist_size += cache_ptr->slist_ring_size[i]; } /* end for */ - HDassert(cache_ptr->index_len == index_len); - HDassert(cache_ptr->index_size == index_size); - HDassert(cache_ptr->clean_index_size == clean_index_size); - HDassert(cache_ptr->dirty_index_size == dirty_index_size); - HDassert(cache_ptr->slist_len == slist_len); - HDassert(cache_ptr->slist_size == slist_size); + assert(cache_ptr->index_len == index_len); + assert(cache_ptr->index_size == index_size); + assert(cache_ptr->clean_index_size == clean_index_size); + assert(cache_ptr->dirty_index_size == dirty_index_size); + assert(cache_ptr->slist_len == slist_len); + assert(cache_ptr->slist_size == slist_size); #endif /* H5C_DO_SANITY_CHECKS */ -#if H5C_DO_EXTREME_SANITY_CHECKS - if (H5C_validate_protected_entry_list(cache_ptr) < 0 || H5C_validate_pinned_entry_list(cache_ptr) < 0 || - H5C_validate_lru_list(cache_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if (H5C__validate_protected_entry_list(cache_ptr) < 0 || H5C__validate_pinned_entry_list(cache_ptr) < 0 || + H5C__validate_lru_list(cache_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ cache_ptr->flush_in_progress = TRUE; @@ -1154,7 +1073,7 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES ring = H5C_RING_USER; while (ring < H5C_RING_NTYPES) { if (H5C__flush_candidates_in_ring(f, ring, entries_to_flush[ring], entries_to_clear[ring]) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush candidates in ring failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "flush candidates in ring failed"); ring++; } /* end while */ @@ -1196,9 +1115,6 @@ H5C__flush_candidate_entries(H5F_t *f, unsigned entries_to_flush[H5C_RING_NTYPES * * Return: Non-negative on success/Negative on failure. * - * Programmer: John Mainzer - * 2/10/17 - * *------------------------------------------------------------------------- */ static herr_t @@ -1209,7 +1125,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu hbool_t restart_scan = FALSE; unsigned entries_flushed = 0; unsigned entries_cleared = 0; -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS unsigned init_index_len; #endif /* H5C_DO_SANITY_CHECKS */ unsigned clear_flags = @@ -1223,22 +1139,21 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(cache_ptr->slist_ptr); - HDassert(ring > H5C_RING_UNDEFINED); - HDassert(ring < H5C_RING_NTYPES); - -#if H5C_DO_EXTREME_SANITY_CHECKS - if ((H5C_validate_protected_entry_list(cache_ptr) < 0) || - (H5C_validate_pinned_entry_list(cache_ptr) < 0) || (H5C_validate_lru_list(cache_ptr) < 0)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry") + assert(cache_ptr); + assert(cache_ptr->slist_ptr); + assert(ring > H5C_RING_UNDEFINED); + assert(ring < H5C_RING_NTYPES); + +#ifdef H5C_DO_EXTREME_SANITY_CHECKS + if ((H5C__validate_protected_entry_list(cache_ptr) < 0) || + (H5C__validate_pinned_entry_list(cache_ptr) < 0) || (H5C__validate_lru_list(cache_ptr) < 0)) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on entry"); #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ -#if H5C_DO_SANITY_CHECKS +#ifdef H5C_DO_SANITY_CHECKS /* index len should not change */ init_index_len = cache_ptr->index_len; #endif /* H5C_DO_SANITY_CHECKS */ @@ -1260,7 +1175,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu H5C_cache_entry_t *next_ptr; /* Entries in the LRU must not have flush dependency children */ - HDassert(entry_ptr->flush_dep_nchildren == 0); + assert(entry_ptr->flush_dep_nchildren == 0); /* Remember dirty state of entry to advance to */ if (entry_ptr->prev != NULL) @@ -1270,7 +1185,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu if (entry_ptr->ring == ring) { /* If this process needs to clear this entry. */ if (entry_ptr->clear_on_unprotect) { - HDassert(entry_ptr->is_dirty); + assert(entry_ptr->is_dirty); /* Set entry and flags for operation */ op_ptr = entry_ptr; @@ -1284,7 +1199,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu entries_cleared++; } /* end if */ else if (entry_ptr->flush_immediately) { - HDassert(entry_ptr->is_dirty); + assert(entry_ptr->is_dirty); /* Set entry and flags for operation */ op_ptr = entry_ptr; @@ -1329,7 +1244,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu cache_ptr->last_entry_removed_ptr = NULL; if (H5C__flush_single_entry(f, op_ptr, op_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't flush entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't flush entry"); if (cache_ptr->entries_removed_counter != 0 || cache_ptr->last_entry_removed_ptr != NULL) restart_scan = TRUE; @@ -1357,18 +1272,18 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu * present. Hence the following assertion which should be * removed if the above changes. */ - HDassert(!restart_scan); - HDassert(entry_ptr->is_dirty == prev_is_dirty); - HDassert(entry_ptr->next == next_ptr); - HDassert(!entry_ptr->is_protected); - HDassert(!entry_ptr->is_pinned); + assert(!restart_scan); + assert(entry_ptr->is_dirty == prev_is_dirty); + assert(entry_ptr->next == next_ptr); + assert(!entry_ptr->is_protected); + assert(!entry_ptr->is_pinned); - HDassert(FALSE); /* see comment above */ + assert(FALSE); /* see comment above */ restart_scan = FALSE; entry_ptr = cache_ptr->LRU_tail_ptr; - H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr) + H5C__UPDATE_STATS_FOR_LRU_SCAN_RESTART(cache_ptr); } /* end if */ } /* end while */ @@ -1402,7 +1317,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu H5C_cache_entry_t *prev_ptr; hbool_t next_is_dirty = FALSE; - HDassert(entry_ptr->is_pinned); + assert(entry_ptr->is_pinned); /* Remember dirty state of entry to advance to */ if (entry_ptr->next != NULL) @@ -1410,7 +1325,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu if (entry_ptr->ring == ring && entry_ptr->flush_dep_ndirty_children == 0) { if (entry_ptr->clear_on_unprotect) { - HDassert(entry_ptr->is_dirty); + assert(entry_ptr->is_dirty); /* Set entry and flags for operation */ op_ptr = entry_ptr; @@ -1422,7 +1337,7 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu progress = TRUE; } /* end if */ else if (entry_ptr->flush_immediately) { - HDassert(entry_ptr->is_dirty); + assert(entry_ptr->is_dirty); /* Set entry and flags for operation */ op_ptr = entry_ptr; @@ -1457,15 +1372,11 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu cache_ptr->entries_removed_counter = 0; cache_ptr->last_entry_removed_ptr = NULL; - /* Add this entry to the list of entries to collectively write - * - * This comment is misleading -- the entry will be added to the - * collective write list only if said list exists. - * - * JRM -- 2/9/17 + /* Add this entry to the list of entries to collectively + * write, if the list exists. */ if (H5C__flush_single_entry(f, op_ptr, op_flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't flush entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't flush entry"); if (cache_ptr->entries_removed_counter != 0 || cache_ptr->last_entry_removed_ptr != NULL) restart_scan = TRUE; @@ -1484,21 +1395,21 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu entry_ptr->is_protected || !entry_ptr->is_pinned)) { /* Something has happened to the pinned entry list -- start * over from the head. - * - * Recall that this code should be un-reachable at present, + */ + + assert(!restart_scan); + assert(entry_ptr->is_dirty == next_is_dirty); + assert(entry_ptr->prev == prev_ptr); + assert(!entry_ptr->is_protected); + assert(entry_ptr->is_pinned); + + /* This code should be un-reachable at present, * as all the operations by entries on flush that could cause * it to be reachable are disallowed in the parallel case at * present. Hence the following assertion which should be * removed if the above changes. */ - - HDassert(!restart_scan); - HDassert(entry_ptr->is_dirty == next_is_dirty); - HDassert(entry_ptr->prev == prev_ptr); - HDassert(!entry_ptr->is_protected); - HDassert(entry_ptr->is_pinned); - - HDassert(FALSE); /* see comment above */ + assert(FALSE); restart_scan = FALSE; @@ -1521,19 +1432,19 @@ H5C__flush_candidates_in_ring(H5F_t *f, H5C_ring_t ring, unsigned entries_to_flu * ( progress ) ) */ -#if H5C_DO_SANITY_CHECKS - HDassert(init_index_len == cache_ptr->index_len); +#ifdef H5C_DO_SANITY_CHECKS + assert(init_index_len == cache_ptr->index_len); #endif /* H5C_DO_SANITY_CHECKS */ if (entries_flushed != entries_to_flush || entries_cleared != entries_to_clear) { entry_ptr = cache_ptr->il_head; while (entry_ptr != NULL) { - HDassert(!entry_ptr->clear_on_unprotect || (entry_ptr->ring > ring)); - HDassert(!entry_ptr->flush_immediately || (entry_ptr->ring > ring)); + assert(!entry_ptr->clear_on_unprotect || (entry_ptr->ring > ring)); + assert(!entry_ptr->flush_immediately || (entry_ptr->ring > ring)); entry_ptr = entry_ptr->il_next; } /* end while */ - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't flush/clear all entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't flush/clear all entries"); } /* end if */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5CommonFG.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5CommonFG.cpp deleted file mode 100644 index 8401b9c83b..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5CommonFG.cpp +++ /dev/null @@ -1,406 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5DataSpace.h" -#include "H5PropList.h" -#include "H5DxferProp.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5Alltypes.h" -#include "H5AbstractDs.h" -#include "H5DataSet.h" -#include "H5CommonFG.h" - -// There are a few comments that are common to most of the functions -// defined in this file so they are listed here. -// - getLocId is called by all functions, that call a C API, to get -// the location id, which can be either a file id or a group id. -// This function is pure virtual and it's up to H5File and Group -// to call the right getId() - although, as the structure of the -// library at this time, getId() is basically the IdComponent::getId() -// - when a failure returned by the C API, the functions will call -// throwException, which is a pure virtual function and is implemented -// by H5File to throw a FileIException and by Group to throw a -// GroupIException. -// December 2000 - -namespace H5 { - -//-------------------------------------------------------------------------- -// Function: CommonFG::openDataType -///\brief Opens the named generic datatype at this location. -///\param name - IN: Name of the datatype to open -///\return DataType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataType -CommonFG::openDataType(const char *name) const -{ - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if (type_id < 0) - throwException("openDataType", "H5Topen2 failed"); - - // No failure, create and return the DataType object - DataType data_type; - f_DataType_setId(&data_type, type_id); - return (data_type); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openDataType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataType -CommonFG::openDataType(const H5std_string &name) const -{ - return (openDataType(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openArrayType -///\brief Opens the named array datatype at this location. -///\param name - IN: Name of the array datatype to open -///\return ArrayType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -ArrayType -CommonFG::openArrayType(const char *name) const -{ - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if (type_id < 0) - throwException("openArrayType", "H5Topen2 failed"); - - // No failure, create and return the ArrayType object - ArrayType array_type; - f_DataType_setId(&array_type, type_id); - return (array_type); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openArrayType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -ArrayType -CommonFG::openArrayType(const H5std_string &name) const -{ - return (openArrayType(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openCompType -///\brief Opens the named compound datatype at this location. -///\param name - IN: Name of the compound datatype to open -///\return CompType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CompType -CommonFG::openCompType(const char *name) const -{ - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if (type_id < 0) - throwException("openCompType", "H5Topen2 failed"); - - // No failure, create and return the CompType object - CompType comp_type; - f_DataType_setId(&comp_type, type_id); - return (comp_type); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openCompType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CompType -CommonFG::openCompType(const H5std_string &name) const -{ - return (openCompType(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openEnumType -///\brief Opens the named enumeration datatype at this location. -///\param name - IN: Name of the enumeration datatype to open -///\return EnumType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType -CommonFG::openEnumType(const char *name) const -{ - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if (type_id < 0) - throwException("openEnumType", "H5Topen2 failed"); - - // No failure, create and return the EnumType object - EnumType enum_type; - f_DataType_setId(&enum_type, type_id); - return (enum_type); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openEnumType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType -CommonFG::openEnumType(const H5std_string &name) const -{ - return (openEnumType(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openIntType -///\brief Opens the named integer datatype at this location. -///\param name - IN: Name of the integer datatype to open -///\return IntType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IntType -CommonFG::openIntType(const char *name) const -{ - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if (type_id < 0) - throwException("openIntType", "H5Topen2 failed"); - - // No failure, create and return the IntType object - IntType int_type; - f_DataType_setId(&int_type, type_id); - return (int_type); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openIntType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IntType -CommonFG::openIntType(const H5std_string &name) const -{ - return (openIntType(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openFloatType -///\brief Opens the named floating-point datatype at this location. -///\param name - IN: Name of the floating-point datatype to open -///\return FloatType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FloatType -CommonFG::openFloatType(const char *name) const -{ - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if (type_id < 0) - throwException("openFloatType", "H5Topen2 failed"); - - // No failure, create and return the FloatType object - FloatType float_type; - f_DataType_setId(&float_type, type_id); - return (float_type); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openFloatType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FloatType -CommonFG::openFloatType(const H5std_string &name) const -{ - return (openFloatType(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openStrType -///\brief Opens the named string datatype at this location. -///\param name - IN: Name of the string datatype to open -///\return StrType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -StrType -CommonFG::openStrType(const char *name) const -{ - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if (type_id < 0) - throwException("openStrType", "H5Topen2 failed"); - - // No failure, create and return the StrType object - StrType str_type; - f_DataType_setId(&str_type, type_id); - return (str_type); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openStrType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -StrType -CommonFG::openStrType(const H5std_string &name) const -{ - return (openStrType(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openVarLenType -///\brief Opens the named variable length datatype at this location. -///\param name - IN: Name of the variable length datatype to open -///\return VarLenType instance -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -VarLenType -CommonFG::openVarLenType(const char *name) const -{ - // Call C function H5Topen2 to open the named datatype in this group, - // given either the file or group id - hid_t type_id = H5Topen2(getLocId(), name, H5P_DEFAULT); - - // If the datatype's opening failed, throw an exception - if (type_id < 0) - throwException("openVarLenType", "H5Topen2 failed"); - - // No failure, create and return the VarLenType object - VarLenType varlen_type; - f_DataType_setId(&varlen_type, type_id); - return (varlen_type); -} - -//-------------------------------------------------------------------------- -// Function: CommonFG::openVarLenType -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -VarLenType -CommonFG::openVarLenType(const H5std_string &name) const -{ - return (openVarLenType(name.c_str())); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: CommonFG default constructor -///\brief Default constructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CommonFG::CommonFG() -{ -} - -//-------------------------------------------------------------------------- -// Function: CommonFG destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CommonFG::~CommonFG() -{ -} - -//-------------------------------------------------------------------------- -// Function: f_DataType_setId - friend -// Purpose: This function is friend to class H5::DataType so that it -// can set DataType::id in order to work around a problem -// described in the JIRA issue HDFFV-7947. -// Applications shouldn't need to use it. -// param dtype - IN/OUT: DataType object to be changed -// param new_id - IN: New id to set -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -f_DataType_setId(DataType *dtype, hid_t new_id) -{ - dtype->p_setId(new_id); -} - -//-------------------------------------------------------------------------- -// Function: f_DataSet_setId - friend -// Purpose: This function is friend to class H5::DataSet so that it -// can set DataSet::id in order to work around a problem -// described in the JIRA issue HDFFV-7947. -// Applications shouldn't need to use it. -// param dset - IN/OUT: DataSet object to be changed -// param new_id - IN: New id to set -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -f_DataSet_setId(DataSet *dset, hid_t new_id) -{ - dset->p_setId(new_id); -} - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5CompType.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5CompType.cpp deleted file mode 100644 index 3b38c6d81c..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5CompType.cpp +++ /dev/null @@ -1,564 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5DxferProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5Alltypes.h" -#include "H5AbstractDs.h" -#include "H5DataSpace.h" -#include "H5DataSet.h" - -namespace H5 { - -//-------------------------------------------------------------------------- -// Function: CompType default constructor -///\brief Default constructor: Creates a stub compound datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CompType::CompType() : DataType() -{ -} - -//-------------------------------------------------------------------------- -// Function: CompType copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param original - IN: Original CompType instance -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CompType::CompType(const CompType &original) : DataType(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: CompType overloaded constructor -///\brief Creates a CompType object using the id of an existing datatype. -///\param existing_id - IN: Id of an existing compound datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CompType::CompType(const hid_t existing_id) : DataType(existing_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: CompType overloaded constructor -///\brief Creates an empty compound datatype given a size, in bytes. -///\param size - IN: Number of bytes in the datatype to create -///\exception H5::DataTypeIException -// Description -// The DataType constructor calls the C API H5Tcreate to create -// the compound datatype. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) -{ -} - -//-------------------------------------------------------------------------- -// Function: CompType overloaded constructor -///\brief Gets the compound datatype of the specified dataset. -///\param dataset - IN: Dataset that this enum datatype associates with -///\return CompType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CompType::CompType(const DataSet &dataset) : DataType() -{ - // Calls C function H5Dget_type to get the id of the datatype - id = H5Dget_type(dataset.getId()); - - // If the datatype id is invalid, throw exception - if (id < 0) { - throw DataSetIException("CompType constructor", "H5Dget_type failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType overloaded constructor -///\brief Creates an CompType instance by opening an HDF5 compound -/// given its name, provided as a C character string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Compound type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openCompType(const char*) to -// improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -CompType::CompType(const H5Location &loc, const char *dtype_name) : DataType() -{ - id = p_opentype(loc, dtype_name); -} - -//-------------------------------------------------------------------------- -// Function: CompType overloaded constructor -///\brief Creates an CompType instance by opening an HDF5 compound -/// datatype given its name, provided as an \c H5std_string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Compound type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openCompType(const H5Location&) -// to improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -CompType::CompType(const H5Location &loc, const H5std_string &dtype_name) : DataType() -{ - id = p_opentype(loc, dtype_name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: CompType::decode -///\brief Returns a CompType object via DataType* by decoding the -/// binary object description of this datatype. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -DataType * -CompType::decode() const -{ - hid_t encoded_cmptype_id = H5I_INVALID_HID; - try { - encoded_cmptype_id = p_decode(); - } - catch (DataTypeIException &err) { - throw; - } - CompType *encoded_cmptype = new CompType; - encoded_cmptype->p_setId(encoded_cmptype_id); - return (encoded_cmptype); -} - -//-------------------------------------------------------------------------- -// Function: CompType::getNmembers -///\brief Returns the number of members in this compound datatype. -///\return Number of members -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -CompType::getNmembers() const -{ - int num_members = H5Tget_nmembers(id); - if (num_members < 0) { - throw DataTypeIException("CompType::getNmembers", - "H5Tget_nmembers returns negative number of members"); - } - return (num_members); -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberName -///\brief Returns the name of a member in this compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return Name of member -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string -CompType::getMemberName(unsigned member_num) const -{ - char *member_name_C = H5Tget_member_name(id, member_num); - if (member_name_C == NULL) // NULL means failure - { - throw DataTypeIException("CompType::getMemberName", - "H5Tget_member_name returns NULL for member name"); - } - H5std_string member_name = H5std_string(member_name_C); // convert C string to string - H5free_memory(member_name_C); // free the C string - return (member_name); // return the member name string -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberIndex -///\brief Returns the index of a member in this compound datatype. -///\param name - IN: Name of the member -///\return Index of member -///\exception H5::DataTypeIException -///\par Description -/// Members are stored in no particular order with numbers 0 -/// through N-1, where N is the value returned by the member -/// function \c CompType::getNmembers. -// Programmer Binh-Minh Ribler - May 16, 2002 -//-------------------------------------------------------------------------- -int -CompType::getMemberIndex(const char *name) const -{ - int member_index = H5Tget_member_index(id, name); - if (member_index < 0) { - throw DataTypeIException("CompType::getMemberIndex", "H5Tget_member_index returns negative value"); - } - return (member_index); -} -int -CompType::getMemberIndex(const H5std_string &name) const -{ - return (getMemberIndex(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberOffset -///\brief Returns the byte offset of the beginning of a member with -/// respect to the beginning of the compound data type datum. -///\param member_num - IN: Zero-based index of the member -///\return Byte offset -// Programmer Binh-Minh Ribler - 2000 -// Description -/// Members are stored in no particular order with numbers 0 -/// through N-1, where N is the value returned by the member -/// function \c CompType::getNmembers. -// -// Note that byte offset being returned as 0 doesn't indicate -// a failure. (According to Quincey) -//-------------------------------------------------------------------------- -size_t -CompType::getMemberOffset(unsigned member_num) const -{ - size_t offset = H5Tget_member_offset(id, member_num); - return (offset); -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberClass -///\brief Gets the type class of the specified member. -///\param member_num - IN: Zero-based index of the member -///\return Type class of the member -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -// Modification -// Modified to use H5Tget_member_class instead. - Jul, 2005 -//-------------------------------------------------------------------------- -H5T_class_t -CompType::getMemberClass(unsigned member_num) const -{ - H5T_class_t member_class = H5Tget_member_class(id, member_num); - if (member_class == H5T_NO_CLASS) { - throw DataTypeIException("CompType::getMemberClass", "H5Tget_member_class returns H5T_NO_CLASS"); - } - return (member_class); -} - -// This private member function calls the C API to get the identifier -// of the specified member. It provides the id to construct appropriate -// sub-types in the functions getMemberXxxType below, where Xxx indicates -// the sub-types. -hid_t -CompType::p_get_member_type(unsigned member_num) const -{ - // get the id of the specified member first - hid_t member_type_id = H5Tget_member_type(id, member_num); - if (member_type_id > 0) - return (member_type_id); - else { - // p_get_member_type is private, caller will catch this exception - // then throw another with appropriate API name - throw DataTypeIException("", "H5Tget_member_type failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberDataType -///\brief Returns the generic datatype of the specified member in this -/// compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return DataType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataType -CompType::getMemberDataType(unsigned member_num) const -{ - try { - DataType datatype; - f_DataType_setId(&datatype, p_get_member_type(member_num)); - return (datatype); - } - catch (DataTypeIException &E) { - throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberArrayType -///\brief Returns the array datatype of the specified member in this -/// compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return ArrayType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -ArrayType -CompType::getMemberArrayType(unsigned member_num) const -{ - try { - ArrayType arraytype; - f_DataType_setId(&arraytype, p_get_member_type(member_num)); - return (arraytype); - } - catch (DataTypeIException &E) { - throw DataTypeIException("CompType::getMemberArrayType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberCompType -///\brief Returns the compound datatype of the specified member in this -/// compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return CompType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CompType -CompType::getMemberCompType(unsigned member_num) const -{ - try { - CompType comptype; - f_DataType_setId(&comptype, p_get_member_type(member_num)); - return (comptype); - } - catch (DataTypeIException &E) { - throw DataTypeIException("CompType::getMemberCompType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberEnumType -///\brief Returns the enumeration datatype of the specified member in -/// this compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return EnumType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType -CompType::getMemberEnumType(unsigned member_num) const -{ - try { - EnumType enumtype; - f_DataType_setId(&enumtype, p_get_member_type(member_num)); - return (enumtype); - } - catch (DataTypeIException &E) { - throw DataTypeIException("CompType::getMemberEnumType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberIntType -///\brief Returns the integer datatype of the specified member in this -/// compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return IntType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IntType -CompType::getMemberIntType(unsigned member_num) const -{ - try { - IntType inttype; - f_DataType_setId(&inttype, p_get_member_type(member_num)); - return (inttype); - } - catch (DataTypeIException &E) { - throw DataTypeIException("CompType::getMemberIntType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberFloatType -///\brief Returns the floating-point datatype of the specified member -/// in this compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return FloatType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FloatType -CompType::getMemberFloatType(unsigned member_num) const -{ - try { - FloatType floatype; - f_DataType_setId(&floatype, p_get_member_type(member_num)); - return (floatype); - } - catch (DataTypeIException &E) { - throw DataTypeIException("CompType::getMemberFloatType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberStrType -///\brief Returns the string datatype of the specified member in this -/// compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return StrType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -StrType -CompType::getMemberStrType(unsigned member_num) const -{ - try { - StrType strtype; - f_DataType_setId(&strtype, p_get_member_type(member_num)); - return (strtype); - } - catch (DataTypeIException &E) { - throw DataTypeIException("CompType::getMemberStrType", E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType::getMemberVarLenType -///\brief Returns the variable length datatype of the specified member -/// in this compound datatype. -///\param member_num - IN: Zero-based index of the member -///\return VarLenType instance -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -VarLenType -CompType::getMemberVarLenType(unsigned member_num) const -{ - try { - VarLenType varlentype; - f_DataType_setId(&varlentype, p_get_member_type(member_num)); - return (varlentype); - } - catch (DataTypeIException &E) { - throw DataTypeIException("CompType::getMemberVarLenType", E.getDetailMsg()); - } -} - -/* old style of getMemberType - using overloads; new style above - returns the appropriate datatypes but has different named functions. - In the old style, a datatype must be passed into the function. - May, 2004: These should be reconsidered to provide more convenience. -// Returns the datatype of the specified member in this compound datatype. -// Several overloading of getMemberType are for different datatypes -void CompType::getMemberType(unsigned member_num, EnumType& enumtype) const -{ - p_get_member_type(member_num, enumtype); -} - -void CompType::getMemberType(unsigned member_num, CompType& comptype) const -{ - p_get_member_type(member_num, comptype); -} - -void CompType::getMemberType(unsigned member_num, IntType& inttype) const -{ - p_get_member_type(member_num, inttype); -} - -void CompType::getMemberType(unsigned member_num, FloatType& floatype) const -{ - p_get_member_type(member_num, floatype); -} - -void CompType::getMemberType(unsigned member_num, StrType& strtype) const -{ - p_get_member_type(member_num, strtype); -} -// end of overloading of getMemberType -*/ - -//-------------------------------------------------------------------------- -// Function: CompType::insertMember -///\brief Inserts a new member to this compound datatype. -///\param name - IN: Name of the new member -///\param offset - IN: Offset in memory structure of the field to insert -///\param new_member - IN: New member to be inserted -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -CompType::insertMember(const H5std_string &name, size_t offset, const DataType &new_member) const -{ - // Convert string to C-string - const char *name_C; - name_C = name.c_str(); // name_C refers to the contents of name as a C-str - - hid_t new_member_id = new_member.getId(); // get new_member id for C API - - // Call C routine H5Tinsert to add the new member - herr_t ret_value = H5Tinsert(id, name_C, offset, new_member_id); - if (ret_value < 0) { - throw DataTypeIException("CompType::insertMember", "H5Tinsert failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType::pack -///\brief Recursively removes padding from within a compound datatype. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -CompType::pack() const -{ - // Calls C routine H5Tpack to remove padding - herr_t ret_value = H5Tpack(id); - if (ret_value < 0) { - throw DataTypeIException("CompType::pack", "H5Tpack failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType::setSize -///\brief Sets the total size for this compound datatype. -///\param size - IN: Size to set -///\exception H5::DataTypeIException -// Note -// H5Tset_size works on atom datatypes and compound datatypes only -// Programmer Binh-Minh Ribler - 2014 -//-------------------------------------------------------------------------- -void -CompType::setSize(size_t size) const -{ - // Call C routine H5Tset_size to set the total size - herr_t ret_value = H5Tset_size(id, size); - if (ret_value < 0) { - throw DataTypeIException("CompType::setSize", "H5Tset_size failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: CompType destructor -///\brief Properly terminates access to this compound datatype. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -CompType::~CompType() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Cprefetched.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Cprefetched.c index 04b6710cab..1e90b7ca63 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Cprefetched.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Cprefetched.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,21 +13,28 @@ /*------------------------------------------------------------------------- * * Created: H5Cprefetched.c - * December 28 2016 - * Quincey Koziol * - * Purpose: Metadata cache prefetched entry callbacks. + * Purpose: Metadata cache prefetched entry callbacks * *------------------------------------------------------------------------- */ +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Cmodule.h" /* This source code file is part of the H5C module */ + /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata Cache */ +#include "H5Cpkg.h" /* Cache */ +#include "H5Eprivate.h" /* Error Handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MMprivate.h" /* Memory Management */ /****************/ /* Local Macros */ @@ -196,9 +202,6 @@ H5C__prefetched_entry_serialize(const H5F_t H5_ATTR_UNUSED *f, void H5_ATTR_UNUS * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 8/13/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -211,9 +214,8 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(entry_ptr->prefetched); + assert(entry_ptr); + assert(entry_ptr->prefetched); switch (action) { case H5C_NOTIFY_ACTION_AFTER_INSERT: @@ -233,16 +235,15 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing) H5C_cache_entry_t *parent_ptr; /* Sanity checks */ - HDassert(entry_ptr->flush_dep_parent); + assert(entry_ptr->flush_dep_parent); parent_ptr = entry_ptr->flush_dep_parent[u]; - HDassert(parent_ptr); - HDassert(parent_ptr->magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(parent_ptr->flush_dep_nchildren > 0); + assert(parent_ptr); + assert(parent_ptr->flush_dep_nchildren > 0); /* Destroy flush dependency with flush dependency parent */ if (H5C_destroy_flush_dependency(parent_ptr, entry_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, - "unable to destroy prefetched entry flush dependency") + "unable to destroy prefetched entry flush dependency"); if (parent_ptr->prefetched) { /* In prefetched entries, the fd_child_count field is @@ -250,14 +251,14 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing) * field to reflect the destruction of the flush * dependency relationship. */ - HDassert(parent_ptr->fd_child_count > 0); + assert(parent_ptr->fd_child_count > 0); (parent_ptr->fd_child_count)--; } /* end if */ } /* end for */ break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); break; } /* end switch */ @@ -275,9 +276,6 @@ H5C__prefetched_entry_notify(H5C_notify_action_t action, void *_thing) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 8/13/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -289,20 +287,19 @@ H5C__prefetched_entry_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(entry_ptr); - HDassert(entry_ptr->magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(entry_ptr->prefetched); + assert(entry_ptr); + assert(entry_ptr->prefetched); /* Release array for flush dependency parent addresses */ if (entry_ptr->fd_parent_addrs != NULL) { - HDassert(entry_ptr->fd_parent_count > 0); + assert(entry_ptr->fd_parent_count > 0); entry_ptr->fd_parent_addrs = (haddr_t *)H5MM_xfree((void *)entry_ptr->fd_parent_addrs); } /* end if */ else - HDassert(entry_ptr->fd_parent_count == 0); + assert(entry_ptr->fd_parent_count == 0); if (entry_ptr->image_ptr != NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "prefetched entry image buffer still attached?") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "prefetched entry image buffer still attached?"); entry_ptr = H5FL_FREE(H5C_cache_entry_t, entry_ptr); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Cquery.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Cquery.c index 4be62d0e11..73e46d1756 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Cquery.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Cquery.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Cquery.c - * May 30 2016 - * Quincey Koziol * * Purpose: Routines which query different components of the generic * cache structure or entries. @@ -71,9 +68,6 @@ * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 10/8/04 - * *------------------------------------------------------------------------- */ herr_t @@ -83,10 +77,10 @@ H5C_get_cache_auto_resize_config(const H5C_t *cache_ptr, H5C_auto_size_ctl_t *co FUNC_ENTER_NOAPI(FAIL) - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry."); if (config_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad config_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad config_ptr on entry."); *config_ptr = cache_ptr->resize_ctl; @@ -108,9 +102,6 @@ H5C_get_cache_auto_resize_config(const H5C_t *cache_ptr, H5C_auto_size_ctl_t *co * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 10/8/04 - * *------------------------------------------------------------------------- */ herr_t @@ -121,8 +112,8 @@ H5C_get_cache_size(const H5C_t *cache_ptr, size_t *max_size_ptr, size_t *min_cle FUNC_ENTER_NOAPI(FAIL) - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry."); if (max_size_ptr != NULL) *max_size_ptr = cache_ptr->max_cache_size; @@ -157,8 +148,8 @@ H5C_get_cache_flush_in_progress(const H5C_t *cache_ptr, hbool_t *flush_in_progre FUNC_ENTER_NOAPI(FAIL) - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry."); if (flush_in_progress_ptr != NULL) *flush_in_progress_ptr = cache_ptr->flush_in_progress; @@ -178,9 +169,6 @@ H5C_get_cache_flush_in_progress(const H5C_t *cache_ptr, hbool_t *flush_in_progre * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 10/7/04 - * *------------------------------------------------------------------------- */ herr_t @@ -190,13 +178,13 @@ H5C_get_cache_hit_rate(const H5C_t *cache_ptr, double *hit_rate_ptr) FUNC_ENTER_NOAPI(FAIL) - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry."); if (hit_rate_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad hit_rate_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad hit_rate_ptr on entry."); - HDassert(cache_ptr->cache_hits >= 0); - HDassert(cache_ptr->cache_accesses >= cache_ptr->cache_hits); + assert(cache_ptr->cache_hits >= 0); + assert(cache_ptr->cache_accesses >= cache_ptr->cache_hits); if (cache_ptr->cache_accesses > 0) *hit_rate_ptr = ((double)(cache_ptr->cache_hits)) / ((double)(cache_ptr->cache_accesses)); @@ -208,7 +196,6 @@ H5C_get_cache_hit_rate(const H5C_t *cache_ptr, double *hit_rate_ptr) } /* H5C_get_cache_hit_rate() */ /*------------------------------------------------------------------------- - * * Function: H5C_get_entry_status * * Purpose: This function is used to determine whether the cache @@ -224,9 +211,6 @@ H5C_get_cache_hit_rate(const H5C_t *cache_ptr, double *hit_rate_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 7/1/05 - * *------------------------------------------------------------------------- */ herr_t @@ -242,23 +226,17 @@ H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t *size_ptr, hbool_t *in FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; + assert(cache_ptr != NULL); + assert(H5_addr_defined(addr)); + assert(in_cache_ptr != NULL); - HDassert(cache_ptr != NULL); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(H5F_addr_defined(addr)); - HDassert(in_cache_ptr != NULL); + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry."); - /* this test duplicates two of the above asserts, but we need an - * invocation of HGOTO_ERROR to keep the compiler happy. - */ - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") - - H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL); if (entry_ptr == NULL) { /* the entry doesn't exist in the cache -- report this @@ -298,9 +276,6 @@ H5C_get_entry_status(const H5F_t *f, haddr_t addr, size_t *size_ptr, hbool_t *in * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: John Mainzer - * 7/27/07 - * *------------------------------------------------------------------------- */ herr_t @@ -310,11 +285,11 @@ H5C_get_evictions_enabled(const H5C_t *cache_ptr, hbool_t *evictions_enabled_ptr FUNC_ENTER_NOAPI(FAIL) - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry."); if (evictions_enabled_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad evictions_enabled_ptr on entry.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad evictions_enabled_ptr on entry."); *evictions_enabled_ptr = cache_ptr->evictions_enabled; @@ -332,9 +307,6 @@ H5C_get_evictions_enabled(const H5C_t *cache_ptr, hbool_t *evictions_enabled_ptr * * Return: NULL/non-NULL (can't fail) * - * Programmer: Quincey Koziol - * 6/29/15 - * *------------------------------------------------------------------------- */ void * @@ -343,8 +315,7 @@ H5C_get_aux_ptr(const H5C_t *cache_ptr) FUNC_ENTER_NOAPI_NOERR /* Check arguments */ - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); + assert(cache_ptr); FUNC_LEAVE_NOAPI(cache_ptr->aux_ptr) } /* H5C_get_aux_ptr() */ @@ -359,9 +330,6 @@ H5C_get_aux_ptr(const H5C_t *cache_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * 9/8/15 - * *------------------------------------------------------------------------- */ herr_t @@ -374,17 +342,16 @@ H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache_ptr = f->shared->cache; - HDassert(cache_ptr); - HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC); - HDassert(H5F_addr_defined(addr)); + assert(cache_ptr); + assert(H5_addr_defined(addr)); /* Locate the entry at the address */ - H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL); if (entry_ptr == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't find entry in index") + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't find entry in index"); /* Return the ring value */ *ring = entry_ptr->ring; @@ -400,8 +367,6 @@ H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring) * * Return: SUCCEED on success, and FAIL on failure. * - * Programmer: Vailin Choi; March 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -411,8 +376,8 @@ H5C_get_mdc_image_info(const H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *ima FUNC_ENTER_NOAPI(FAIL) - if ((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry") + if (cache_ptr == NULL) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "bad cache_ptr on entry"); if (image_addr) *image_addr = cache_ptr->image_addr; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ctag.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ctag.c index 556d0e5868..082b57e54e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ctag.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ctag.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,11 +13,9 @@ /*------------------------------------------------------------------------- * * Created: H5Ctag.c - * June 5 2016 - * Quincey Koziol * * Purpose: Functions in this file operate on tags for metadata - * cache entries. + * cache entries * *------------------------------------------------------------------------- */ @@ -33,14 +30,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Cpkg.h" /* Cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* Files */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata Cache */ +#include "H5Cpkg.h" /* Cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error Handling */ +#include "H5Fpkg.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MMprivate.h" /* Memory management */ /****************/ /* Local Macros */ @@ -82,7 +79,9 @@ typedef struct { /********************/ /* Local Prototypes */ /********************/ +static herr_t H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, void *cb_ctx); static herr_t H5C__mark_tagged_entries(H5C_t *cache, haddr_t tag); +static herr_t H5C__flush_marked_entries(H5F_t *f); /*********************/ /* Package Variables */ @@ -100,7 +99,6 @@ H5FL_EXTERN(H5C_tag_info_t); /*******************/ /*------------------------------------------------------------------------- - * * Function: H5C_ignore_tags * * Purpose: Override all assertion frameworks associated with making @@ -116,9 +114,6 @@ H5FL_EXTERN(H5C_tag_info_t); * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Mike McGreevy - * December 1, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -127,8 +122,7 @@ H5C_ignore_tags(H5C_t *cache) FUNC_ENTER_NOAPI_NOERR /* Assertions */ - HDassert(cache != NULL); - HDassert(cache->magic == H5C__H5C_T_MAGIC); + assert(cache != NULL); /* Set variable to ignore tag values upon assignment */ cache->ignore_tags = TRUE; @@ -137,58 +131,48 @@ H5C_ignore_tags(H5C_t *cache) } /* H5C_ignore_tags */ /*------------------------------------------------------------------------- - * * Function: H5C_get_ignore_tags * * Purpose: Retrieve the 'ignore_tags' field for the cache * * Return: 'ignore_tags' value (can't fail) * - * Programmer: Quincey Koziol - * April 30, 2016 - * *------------------------------------------------------------------------- */ -hbool_t +H5_ATTR_PURE hbool_t H5C_get_ignore_tags(const H5C_t *cache) { FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(cache); - HDassert(cache->magic == H5C__H5C_T_MAGIC); + assert(cache); /* Return ignore tag value */ FUNC_LEAVE_NOAPI(cache->ignore_tags) } /* H5C_get_ignore_tags */ /*------------------------------------------------------------------------- - * * Function: H5C_get_num_objs_corked * * Purpose: Retrieve the 'num_objs_corked' field for the cache * * Return: 'num_objs_corked' value (can't fail) * - * Programmer: Vailin Choi; Feb 2019 - * *------------------------------------------------------------------------- */ -uint32_t +H5_ATTR_PURE uint32_t H5C_get_num_objs_corked(const H5C_t *cache) { FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(cache); - HDassert(cache->magic == H5C__H5C_T_MAGIC); + assert(cache); /* Return value for num_objs_corked */ FUNC_LEAVE_NOAPI(cache->num_objs_corked) } /* H5C_get_num_objs_corked */ /*------------------------------------------------------------------------- - * * Function: H5C__tag_entry * * Purpose: Tags an entry with the provided tag (contained in the API context). @@ -198,9 +182,6 @@ H5C_get_num_objs_corked(const H5C_t *cache) * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Mike McGreevy - * January 14, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -213,9 +194,8 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) FUNC_ENTER_PACKAGE /* Assertions */ - HDassert(cache != NULL); - HDassert(entry != NULL); - HDassert(cache->magic == H5C__H5C_T_MAGIC); + assert(cache != NULL); + assert(entry != NULL); /* Get the tag */ tag = H5CX_get_tag(); @@ -228,14 +208,14 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) arbitrarily set it to something for the sake of passing the tests. If the tag value is set, then we'll just let it get assigned without additional checking for correctness. */ - if (!H5F_addr_defined(tag)) + if (!H5_addr_defined(tag)) tag = H5AC__IGNORE_TAG; } -#if H5C_DO_TAGGING_SANITY_CHECKS +#ifdef H5C_DO_TAGGING_SANITY_CHECKS else { /* Perform some sanity checks to ensure that a correct tag is being applied */ if (H5C_verify_tag(entry->type->id, tag) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "tag verification failed") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "tag verification failed"); } #endif @@ -246,7 +226,7 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) if (NULL == tag_info) { /* Allocate new tag info struct */ if (NULL == (tag_info = H5FL_CALLOC(H5C_tag_info_t))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate tag info for cache entry"); /* Set the tag for all entries */ tag_info->tag = tag; @@ -255,12 +235,12 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) HASH_ADD(hh, cache->tag_list, tag, sizeof(haddr_t), tag_info); } else - HDassert(tag_info->corked || (tag_info->entry_cnt > 0 && tag_info->head)); + assert(tag_info->corked || (tag_info->entry_cnt > 0 && tag_info->head)); /* Sanity check entry, to avoid double insertions, etc */ - HDassert(entry->tl_next == NULL); - HDassert(entry->tl_prev == NULL); - HDassert(entry->tag_info == NULL); + assert(entry->tl_next == NULL); + assert(entry->tl_prev == NULL); + assert(entry->tag_info == NULL); /* Add the entry to the list for the tagged object */ entry->tl_next = tag_info->head; @@ -275,7 +255,6 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) } /* H5C__tag_entry */ /*------------------------------------------------------------------------- - * * Function: H5C__untag_entry * * Purpose: Removes an entry from a tag list, possibly removing the tag @@ -283,9 +262,6 @@ H5C__tag_entry(H5C_t *cache, H5C_cache_entry_t *entry) * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Quincey Koziol - * July 8, 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -297,9 +273,8 @@ H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry) FUNC_ENTER_PACKAGE_NOERR /* Assertions */ - HDassert(cache != NULL); - HDassert(entry != NULL); - HDassert(cache->magic == H5C__H5C_T_MAGIC); + assert(cache != NULL); + assert(entry != NULL); /* Get the entry's tag info struct */ if (NULL != (tag_info = entry->tag_info)) { @@ -320,30 +295,26 @@ H5C__untag_entry(H5C_t *cache, H5C_cache_entry_t *entry) /* Remove the tag info from the tag list, if there's no more entries with this tag */ if (!tag_info->corked && 0 == tag_info->entry_cnt) { /* Sanity check */ - HDassert(NULL == tag_info->head); + assert(NULL == tag_info->head); /* Release the tag info */ HASH_DELETE(hh, cache->tag_list, tag_info); tag_info = H5FL_FREE(H5C_tag_info_t, tag_info); } else - HDassert(tag_info->corked || NULL != tag_info->head); + assert(tag_info->corked || NULL != tag_info->head); } FUNC_LEAVE_NOAPI(ret_value) } /* H5C__untag_entry */ /*------------------------------------------------------------------------- - * * Function: H5C__iter_tagged_entries_real * * Purpose: Iterate over tagged entries, making a callback for matches * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Quincey Koziol - * June 7, 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -356,8 +327,7 @@ H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, v FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache != NULL); - HDassert(cache->magic == H5C__H5C_T_MAGIC); + assert(cache != NULL); /* Search the list of tagged object addresses in the cache */ HASH_FIND(hh, cache->tag_list, &tag, sizeof(haddr_t), tag_info); @@ -368,8 +338,8 @@ H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, v H5C_cache_entry_t *next_entry; /* Pointer to next entry in hash bucket chain */ /* Sanity check */ - HDassert(tag_info->head); - HDassert(tag_info->entry_cnt > 0); + assert(tag_info->head); + assert(tag_info->entry_cnt > 0); /* Iterate over the entries for this tag */ entry = tag_info->head; @@ -379,7 +349,7 @@ H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, v /* Make callback for entry */ if ((cb)(entry, cb_ctx) != H5_ITER_CONT) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "tagged entry iteration callback failed") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "tagged entry iteration callback failed"); /* Advance to next entry */ entry = next_entry; @@ -391,16 +361,12 @@ H5C__iter_tagged_entries_real(H5C_t *cache, haddr_t tag, H5C_tag_iter_cb_t cb, v } /* H5C__iter_tagged_entries_real() */ /*------------------------------------------------------------------------- - * * Function: H5C__iter_tagged_entries * * Purpose: Iterate over tagged entries, making a callback for matches * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Quincey Koziol - * June 7, 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -412,22 +378,21 @@ H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global, H5C_ta FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cache != NULL); - HDassert(cache->magic == H5C__H5C_T_MAGIC); + assert(cache != NULL); /* Iterate over the entries for this tag */ if (H5C__iter_tagged_entries_real(cache, tag, cb, cb_ctx) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed"); /* Check for iterating over global metadata */ if (match_global) { /* Iterate over the entries for SOHM entries */ if (H5C__iter_tagged_entries_real(cache, H5AC__SOHM_TAG, cb, cb_ctx) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed"); /* Iterate over the entries for global heap entries */ if (H5C__iter_tagged_entries_real(cache, H5AC__GLOBALHEAP_TAG, cb, cb_ctx) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed"); } /* end if */ done: @@ -435,16 +400,12 @@ H5C__iter_tagged_entries(H5C_t *cache, haddr_t tag, hbool_t match_global, H5C_ta } /* H5C__iter_tagged_entries() */ /*------------------------------------------------------------------------- - * * Function: H5C__evict_tagged_entries_cb * * Purpose: Callback for evicting tagged entries * * Return: H5_ITER_ERROR if error is detected, H5_ITER_CONT otherwise. * - * Programmer: Mike McGreevy - * August 19, 2010 - * *------------------------------------------------------------------------- */ static int @@ -457,14 +418,14 @@ H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx) FUNC_ENTER_PACKAGE /* Santify checks */ - HDassert(entry); - HDassert(ctx); + assert(entry); + assert(ctx); /* Attempt to evict entry */ if (entry->is_protected) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Cannot evict protected entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Cannot evict protected entry"); else if (entry->is_dirty) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Cannot evict dirty entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Cannot evict dirty entry"); else if (entry->is_pinned) /* Can't evict at this time, but let's note that we hit a pinned entry and we'll loop back around again (as evicting other @@ -475,7 +436,7 @@ H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx) if (H5C__flush_single_entry(ctx->f, entry, H5C__FLUSH_INVALIDATE_FLAG | H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Entry eviction failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, H5_ITER_ERROR, "Entry eviction failed."); ctx->evicted_entries_last_pass = TRUE; } else @@ -486,16 +447,12 @@ H5C__evict_tagged_entries_cb(H5C_cache_entry_t *entry, void *_ctx) } /* H5C__evict_tagged_entries_cb() */ /*------------------------------------------------------------------------- - * * Function: H5C_evict_tagged_entries * * Purpose: Evicts all entries with the specified tag from cache * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Mike McGreevy - * August 19, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -509,11 +466,10 @@ H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, hbool_t match_global) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache = f->shared->cache; /* Get cache pointer */ - HDassert(cache != NULL); - HDassert(cache->magic == H5C__H5C_T_MAGIC); + assert(cache != NULL); /* Construct context for iterator callbacks */ ctx.f = f; @@ -527,7 +483,7 @@ H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, hbool_t match_global) /* Iterate through entries in the cache */ if (H5C__iter_tagged_entries(cache, tag, match_global, H5C__evict_tagged_entries_cb, &ctx) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed"); /* Keep doing this until we have stopped evicted entries */ } while (TRUE == ctx.evicted_entries_last_pass); @@ -558,23 +514,19 @@ H5C_evict_tagged_entries(H5F_t *f, haddr_t tag, hbool_t match_global) * ctx.skipped_pf_dirty_entries is TRUE. */ if ((!ctx.skipped_pf_dirty_entries) && (ctx.pinned_entries_need_evicted)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Pinned entries still need evicted?!") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Pinned entries still need evicted?!"); done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_evict_tagged_entries() */ /*------------------------------------------------------------------------- - * * Function: H5C__mark_tagged_entries_cb * * Purpose: Callback to set the flush marker on dirty entries in the cache * * Return: H5_ITER_CONT (can't fail) * - * Programmer: Mike McGreevy - * September 9, 2010 - * *------------------------------------------------------------------------- */ static int @@ -584,7 +536,7 @@ H5C__mark_tagged_entries_cb(H5C_cache_entry_t *entry, void H5_ATTR_UNUSED *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(entry); + assert(entry); /* We only want to set the flush marker on entries that * actually need flushed (i.e., dirty ones) */ @@ -595,7 +547,6 @@ H5C__mark_tagged_entries_cb(H5C_cache_entry_t *entry, void H5_ATTR_UNUSED *_ctx) } /* H5C__mark_tagged_entries_cb() */ /*------------------------------------------------------------------------- - * * Function: H5C__mark_tagged_entries * * Purpose: Set the flush marker on dirty entries in the cache that have @@ -603,9 +554,6 @@ H5C__mark_tagged_entries_cb(H5C_cache_entry_t *entry, void H5_ATTR_UNUSED *_ctx) * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Mike McGreevy - * September 9, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -617,32 +565,65 @@ H5C__mark_tagged_entries(H5C_t *cache, haddr_t tag) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(cache); - HDassert(cache->magic == H5C__H5C_T_MAGIC); + assert(cache); /* Iterate through hash table entries, marking those with specified tag, as * well as any major global entries which should always be flushed * when flushing based on tag value */ if (H5C__iter_tagged_entries(cache, tag, TRUE, H5C__mark_tagged_entries_cb, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed"); done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__mark_tagged_entries() */ -#if H5C_DO_TAGGING_SANITY_CHECKS - /*------------------------------------------------------------------------- + * Function: H5C__flush_marked_entries + * + * Purpose: Flushes all marked entries in the cache. + * + * Return: FAIL if error is detected, SUCCEED otherwise. * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__flush_marked_entries(H5F_t *f) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Assertions */ + assert(f != NULL); + + /* Enable the slist, as it is needed in the flush */ + if (H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "set slist enabled failed"); + + /* Flush all marked entries */ + if (H5C_flush_cache(f, H5C__FLUSH_MARKED_ENTRIES_FLAG | H5C__FLUSH_IGNORE_PROTECTED_FLAG) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache"); + + /* Disable the slist. Set the clear_slist parameter to TRUE + * since we called H5C_flush_cache() with the + * H5C__FLUSH_MARKED_ENTRIES_FLAG. + */ + if (H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "disable slist failed"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__flush_marked_entries */ + +#ifdef H5C_DO_TAGGING_SANITY_CHECKS + +/*------------------------------------------------------------------------- * Function: H5C_verify_tag * * Purpose: Performs sanity checking on an entrytype/tag pair. * * Return: SUCCEED or FAIL. * - * Programmer: Mike McGreevy - * January 14, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -656,10 +637,10 @@ H5C_verify_tag(int id, haddr_t tag) * types require certain tag values, so check that these * constraints are met. */ if (tag == H5AC__IGNORE_TAG) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "cannot ignore a tag while doing verification.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "cannot ignore a tag while doing verification."); else if (tag == H5AC__INVALID_TAG) { if (id != H5AC_PROXY_ENTRY_ID) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "no metadata tag provided") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "no metadata tag provided"); } /* end else-if */ else { /* Perform some sanity checks on tag value. Certain entry @@ -669,32 +650,32 @@ H5C_verify_tag(int id, haddr_t tag) /* Superblock */ if ((id == H5AC_SUPERBLOCK_ID) || (id == H5AC_DRVRINFO_ID)) { if (tag != H5AC__SUPERBLOCK_TAG) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "superblock not tagged with H5AC__SUPERBLOCK_TAG") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "superblock not tagged with H5AC__SUPERBLOCK_TAG"); } /* end if */ else { if (tag == H5AC__SUPERBLOCK_TAG) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, - "H5AC__SUPERBLOCK_TAG applied to non-superblock entry") + "H5AC__SUPERBLOCK_TAG applied to non-superblock entry"); } /* end else */ /* Free Space Manager */ if (tag == H5AC__FREESPACE_TAG && ((id != H5AC_FSPACE_HDR_ID) && (id != H5AC_FSPACE_SINFO_ID))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__FREESPACE_TAG applied to non-freespace entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "H5AC__FREESPACE_TAG applied to non-freespace entry"); /* SOHM */ if ((id == H5AC_SOHM_TABLE_ID) || (id == H5AC_SOHM_LIST_ID)) if (tag != H5AC__SOHM_TAG) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "sohm entry not tagged with H5AC__SOHM_TAG") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "sohm entry not tagged with H5AC__SOHM_TAG"); /* Global Heap */ if (id == H5AC_GHEAP_ID) { if (tag != H5AC__GLOBALHEAP_TAG) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "global heap not tagged with H5AC__GLOBALHEAP_TAG") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "global heap not tagged with H5AC__GLOBALHEAP_TAG"); } /* end if */ else { if (tag == H5AC__GLOBALHEAP_TAG) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, - "H5AC__GLOBALHEAP_TAG applied to non-globalheap entry") + "H5AC__GLOBALHEAP_TAG applied to non-globalheap entry"); } /* end else */ } /* end else */ @@ -704,16 +685,12 @@ H5C_verify_tag(int id, haddr_t tag) #endif /*------------------------------------------------------------------------- - * * Function: H5C_flush_tagged_entries * * Purpose: Flushes all entries with the specified tag to disk. * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Mike McGreevy - * August 19, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -726,26 +703,25 @@ H5C_flush_tagged_entries(H5F_t *f, haddr_t tag) FUNC_ENTER_NOAPI(FAIL) /* Assertions */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Get cache pointer */ cache = f->shared->cache; /* Mark all entries with specified tag */ if (H5C__mark_tagged_entries(cache, tag) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't mark tagged entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't mark tagged entries"); /* Flush all marked entries */ if (H5C__flush_marked_entries(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush marked entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush marked entries"); done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_flush_tagged_entries */ /*------------------------------------------------------------------------- - * * Function: H5C_retag_entries * * Purpose: Searches through cache index for all entries with the @@ -754,9 +730,6 @@ H5C_flush_tagged_entries(H5F_t *f, haddr_t tag) * * Return: SUCCEED/FAIL * - * Programmer: Mike McGreevy - * March 17, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -768,7 +741,7 @@ H5C_retag_entries(H5C_t *cache, haddr_t src_tag, haddr_t dest_tag) FUNC_ENTER_NOAPI_NOERR /* Sanity check */ - HDassert(cache); + assert(cache); /* Remove tag info from tag list */ HASH_FIND(hh, cache->tag_list, &src_tag, sizeof(haddr_t), tag_info); @@ -787,7 +760,6 @@ H5C_retag_entries(H5C_t *cache, haddr_t src_tag, haddr_t dest_tag) } /* H5C_retag_entries() */ /*------------------------------------------------------------------------- - * * Function: H5C__expunge_tag_type_metadata_cb * * Purpose: Expunge from the cache entries associated @@ -795,9 +767,6 @@ H5C_retag_entries(H5C_t *cache, haddr_t src_tag, haddr_t dest_tag) * * Return: H5_ITER_ERROR if error is detected, H5_ITER_CONT otherwise. * - * Programmer: Vailin Choi - * May 2016 - * *------------------------------------------------------------------------- */ static int @@ -810,20 +779,19 @@ H5C__expunge_tag_type_metadata_cb(H5C_cache_entry_t *entry, void *_ctx) FUNC_ENTER_PACKAGE /* Santify checks */ - HDassert(entry); - HDassert(ctx); + assert(entry); + assert(ctx); /* Found one with the same tag and type id */ if (entry->type->id == ctx->type_id) if (H5C_expunge_entry(ctx->f, entry->type, entry->addr, ctx->flags) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, H5_ITER_ERROR, "can't expunge entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, H5_ITER_ERROR, "can't expunge entry"); done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__expunge_tag_type_metadata_cb() */ /*------------------------------------------------------------------------- - * * Function: H5C_expunge_tag_type_metadata * * Purpose: Search and expunge from the cache entries associated @@ -831,9 +799,6 @@ H5C__expunge_tag_type_metadata_cb(H5C_cache_entry_t *entry, void *_ctx) * * Return: FAIL if error is detected, SUCCEED otherwise. * - * Programmer: Vailin Choi - * May 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -847,11 +812,10 @@ H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); cache = f->shared->cache; /* Get cache pointer */ - HDassert(cache != NULL); - HDassert(cache->magic == H5C__H5C_T_MAGIC); + assert(cache != NULL); /* Construct context for iterator callbacks */ ctx.f = f; @@ -860,23 +824,19 @@ H5C_expunge_tag_type_metadata(H5F_t *f, haddr_t tag, int type_id, unsigned flags /* Iterate through hash table entries, expunge those with specified tag and type id */ if (H5C__iter_tagged_entries(cache, tag, FALSE, H5C__expunge_tag_type_metadata_cb, &ctx) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "Iteration of tagged entries failed"); done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_expunge_tag_type_metadata() */ /*------------------------------------------------------------------------- - * * Function: H5C_get_tag() * * Purpose: Get the tag for a metadata cache entry. * * Return: SUCCEED (can't fail) * - * Programmer: Dana Robinson - * Fall 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -886,9 +846,9 @@ H5C_get_tag(const void *thing, haddr_t *tag) FUNC_ENTER_NOAPI_NOERR - HDassert(entry); - HDassert(entry->tag_info); - HDassert(tag); + assert(entry); + assert(entry->tag_info); + assert(tag); /* Return the tag */ *tag = entry->tag_info->tag; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ctest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ctest.c index 915f28d4a6..d0e4917a9d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ctest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ctest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,11 +13,9 @@ /*------------------------------------------------------------------------- * * Created: H5Ctest.c - * June 7 2016 - * Quincey Koziol * * Purpose: Functions in this file support the metadata cache regression - * tests> + * tests * *------------------------------------------------------------------------- */ @@ -78,9 +75,6 @@ typedef struct { * * Return: SUCCEED on success, FAIL on error * - * Programmer: Vailin Choi - * Feb 2014 - * *------------------------------------------------------------------------- */ static int @@ -94,15 +88,15 @@ H5C__verify_cork_tag_test_cb(H5C_cache_entry_t *entry, void *_ctx) FUNC_ENTER_PACKAGE /* Santify checks */ - HDassert(entry); - HDassert(ctx); + assert(entry); + assert(ctx); /* Retrieve corked status for entry */ is_corked = entry->tag_info ? entry->tag_info->corked : FALSE; /* Verify corked status for entry */ if (is_corked != ctx->status) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, H5_ITER_ERROR, "bad cork status") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, H5_ITER_ERROR, "bad cork status"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -116,9 +110,6 @@ H5C__verify_cork_tag_test_cb(H5C_cache_entry_t *entry, void *_ctx) * * Return: SUCCEED on success, FAIL on error * - * Programmer: Vailin Choi - * Feb 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -135,12 +126,12 @@ H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status) /* Get file pointer */ if (NULL == (f = (H5F_t *)H5VL_object_verify(fid, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); /* Convert token to address */ tag = HADDR_UNDEF; if (H5VL_native_token_to_addr(f, H5I_FILE, tag_token, &tag) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get address for token") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't get address for token"); /* Get cache pointer */ cache = f->shared->cache; @@ -150,7 +141,7 @@ H5C__verify_cork_tag_test(hid_t fid, H5O_token_t tag_token, hbool_t status) /* Iterate through tagged entries in the cache */ if (H5C__iter_tagged_entries(cache, tag, FALSE, H5C__verify_cork_tag_test_cb, &ctx) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed") + HGOTO_ERROR(H5E_CACHE, H5E_BADITER, FAIL, "iteration of tagged entries failed"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5D.c b/externals/coda-oss/modules/drivers/hdf5/source/H5D.c index d9c75b247d..2b20a91d3a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5D.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5D.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -27,6 +26,7 @@ #include "H5ESprivate.h" /* Event Sets */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VLnative_private.h" /* Native VOL connector */ @@ -50,10 +50,11 @@ static hid_t H5D__create_api_common(hid_t loc_id, const char *name, hid_t type_ static hid_t H5D__open_api_common(hid_t loc_id, const char *name, hid_t dapl_id, void **token_ptr, H5VL_object_t **_vol_obj_ptr); static hid_t H5D__get_space_api_common(hid_t dset_id, void **token_ptr, H5VL_object_t **_vol_obj_ptr); -static herr_t H5D__read_api_common(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t dxpl_id, void *buf, void **token_ptr, H5VL_object_t **_vol_obj_ptr); -static herr_t H5D__write_api_common(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t dxpl_id, const void *buf, void **token_ptr, +static herr_t H5D__read_api_common(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, void *buf[], void **token_ptr, + H5VL_object_t **_vol_obj_ptr); +static herr_t H5D__write_api_common(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, const void *buf[], void **token_ptr, H5VL_object_t **_vol_obj_ptr); static herr_t H5D__set_extent_api_common(hid_t dset_id, const hsize_t size[], void **token_ptr, H5VL_object_t **_vol_obj_ptr); @@ -101,26 +102,26 @@ H5D__create_api_common(hid_t loc_id, const char *name, hid_t type_id, hid_t spac /* Check arguments */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string"); /* Set up object access arguments */ if (H5VL_setup_acc_args(loc_id, H5P_CLS_DACC, TRUE, &dapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Get link creation property list */ if (H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list"); /* Get dataset creation property list */ if (H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, - "dcpl_id is not a dataset create property list ID") + "dcpl_id is not a dataset create property list ID"); /* Set the DCPL for the API context */ H5CX_set_dcpl(dcpl_id); @@ -131,16 +132,16 @@ H5D__create_api_common(hid_t loc_id, const char *name, hid_t type_id, hid_t spac /* Create the dataset */ if (NULL == (dset = H5VL_dataset_create(*vol_obj_ptr, &loc_params, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create dataset"); /* Get an ID for the dataset */ if ((ret_value = H5VL_register(H5I_DATASET, dset, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset"); done: if (H5I_INVALID_HID == ret_value) if (dset && H5VL_dataset_close(*vol_obj_ptr, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__create_api_common() */ @@ -183,7 +184,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t /* Create the dataset synchronously */ if ((ret_value = H5D__create_api_common(loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create dataset"); done: FUNC_LEAVE_API(ret_value) @@ -219,7 +220,7 @@ H5Dcreate_async(const char *app_file, const char *app_func, unsigned app_line, h /* Create the dataset asynchronously */ if ((ret_value = H5D__create_api_common(loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create dataset"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -228,8 +229,8 @@ H5Dcreate_async(const char *app_file, const char *app_func, unsigned app_line, h H5ARG_TRACE11(__func__, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on dataset ID") - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on dataset ID"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -283,23 +284,23 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t if (H5P_DEFAULT == dcpl_id) dcpl_id = H5P_DATASET_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID"); if (H5P_DEFAULT == dapl_id) dapl_id = H5P_DATASET_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset access property list ID"); /* Set the DCPL for the API context */ H5CX_set_dcpl(dcpl_id); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&dapl_id, H5P_CLS_DACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -309,17 +310,17 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t if (NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, type_id, space_id, dcpl_id, dapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset"); /* Get an ID for the dataset */ if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset"); done: /* Cleanup on failure */ if (H5I_INVALID_HID == ret_value) if (dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset"); FUNC_LEAVE_API(ret_value) } /* end H5Dcreate_anon() */ @@ -349,27 +350,27 @@ H5D__open_api_common(hid_t loc_id, const char *name, hid_t dapl_id, void **token /* Check args */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string"); /* Set up object access arguments */ if (H5VL_setup_acc_args(loc_id, H5P_CLS_DACC, FALSE, &dapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Open the dataset */ if (NULL == (dset = H5VL_dataset_open(*vol_obj_ptr, &loc_params, name, dapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset"); /* Register an atom for the dataset */ if ((ret_value = H5VL_register(H5I_DATASET, dset, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset ID"); done: if (H5I_INVALID_HID == ret_value) if (dset && H5VL_dataset_close(*vol_obj_ptr, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset"); FUNC_LEAVE_NOAPI(ret_value) } /* H5D__open_api_common() */ @@ -399,7 +400,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) /* Open the dataset synchronously */ if ((ret_value = H5D__open_api_common(loc_id, name, dapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to synchronously open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to synchronously open dataset"); done: FUNC_LEAVE_API(ret_value) @@ -433,7 +434,7 @@ H5Dopen_async(const char *app_file, const char *app_func, unsigned app_line, hid /* Open the dataset asynchronously */ if ((ret_value = H5D__open_api_common(loc_id, name, dapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to asynchronously open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to asynchronously open dataset"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -442,8 +443,8 @@ H5Dopen_async(const char *app_file, const char *app_func, unsigned app_line, hid H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, dapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on dataset ID") - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on dataset ID"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -471,13 +472,13 @@ H5Dclose(hid_t dset_id) /* Check args */ if (H5I_DATASET != H5I_get_type(dset_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID"); /* Decrement the counter on the dataset. It will be freed if the count * reaches zero. */ if (H5I_dec_app_ref_always_close(dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID"); done: FUNC_LEAVE_API(ret_value) @@ -506,11 +507,11 @@ H5Dclose_async(const char *app_file, const char *app_func, unsigned app_line, hi /* Check args */ if (H5I_DATASET != H5I_get_type(dset_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID"); /* Get dataset object's connector */ if (NULL == (vol_obj = H5VL_vol_object(dset_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VOL object for dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VOL object for dataset"); /* Prepare for possible asynchronous operation */ if (H5ES_NONE != es_id) { @@ -527,7 +528,7 @@ H5Dclose_async(const char *app_file, const char *app_func, unsigned app_line, hi * reaches zero. */ if (H5I_dec_app_ref_always_close_async(dset_id, token_ptr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -535,11 +536,11 @@ H5Dclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: if (connector && H5VL_conn_dec_rc(connector) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement ref count on connector") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement ref count on connector"); FUNC_LEAVE_API(ret_value) } /* end H5Dclose_async() */ @@ -567,7 +568,7 @@ H5D__get_space_api_common(hid_t dset_id, void **token_ptr, H5VL_object_t **_vol_ /* Check args */ if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_GET_SPACE; @@ -575,7 +576,7 @@ H5D__get_space_api_common(hid_t dset_id, void **token_ptr, H5VL_object_t **_vol_ /* Get the dataspace */ if (H5VL_dataset_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace"); /* Set return value */ ret_value = vol_cb_args.args.get_space.space_id; @@ -607,7 +608,7 @@ H5Dget_space(hid_t dset_id) /* Get the dataset's dataspace synchronously */ if ((ret_value = H5D__get_space_api_common(dset_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to synchronously get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to synchronously get dataspace"); done: FUNC_LEAVE_API(ret_value) @@ -643,7 +644,7 @@ H5Dget_space_async(const char *app_file, const char *app_func, unsigned app_line /* Get the dataset's dataspace asynchronously */ if ((ret_value = H5D__get_space_api_common(dset_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to asynchronously get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to asynchronously get dataspace"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -653,8 +654,8 @@ H5Dget_space_async(const char *app_file, const char *app_func, unsigned app_line /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, - "can't decrement count on dataspace ID") - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + "can't decrement count on dataspace ID"); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -682,7 +683,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation /*out*/) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_GET_SPACE_STATUS; @@ -690,7 +691,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation /*out*/) /* Get dataspace status */ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status"); done: FUNC_LEAVE_API(ret_value) @@ -721,7 +722,7 @@ H5Dget_type(hid_t dset_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_GET_TYPE; @@ -729,7 +730,7 @@ H5Dget_type(hid_t dset_id) /* Get the datatype */ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype"); /* Set return value */ ret_value = vol_cb_args.args.get_type.type_id; @@ -749,9 +750,6 @@ H5Dget_type(hid_t dset_id) * * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Tuesday, February 3, 1998 - * *------------------------------------------------------------------------- */ hid_t @@ -766,7 +764,7 @@ H5Dget_create_plist(hid_t dset_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_GET_DCPL; @@ -774,7 +772,7 @@ H5Dget_create_plist(hid_t dset_id) /* Get the dataset creation property list */ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties"); /* Set return value */ ret_value = vol_cb_args.args.get_dcpl.dcpl_id; @@ -793,13 +791,13 @@ H5Dget_create_plist(hid_t dset_id) * * The chunk cache parameters in the returned property lists will be * those used by the dataset. If the properties in the file access - * property list were used to determine the dataset’s chunk cache + * property list were used to determine the dataset's chunk cache * configuration, then those properties will be present in the * returned dataset access property list. If the dataset does not * use a chunked layout, then the chunk cache properties will be set * to the default. The chunk cache properties in the returned list * are considered to be “set”, and any use of this list will override - * the corresponding properties in the file’s file access property + * the corresponding properties in the file's file access property * list. * * All link access properties in the returned list will be set to the @@ -811,9 +809,6 @@ H5Dget_create_plist(hid_t dset_id) * * Failure: H5I_INVALID_HID * - * Programmer: Neil Fortner - * Wednesday, October 29, 2008 - * *------------------------------------------------------------------------- */ hid_t @@ -828,7 +823,7 @@ H5Dget_access_plist(hid_t dset_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_GET_DAPL; @@ -836,7 +831,7 @@ H5Dget_access_plist(hid_t dset_id) /* Get the dataset access property list */ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties"); /* Set return value */ ret_value = vol_cb_args.args.get_dapl.dapl_id; @@ -873,7 +868,7 @@ H5Dget_storage_size(hid_t dset_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_GET_STORAGE_SIZE; @@ -881,7 +876,7 @@ H5Dget_storage_size(hid_t dset_id) /* Get the storage size */ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size"); /* Set return value */ ret_value = storage_size; @@ -915,7 +910,7 @@ H5Dget_offset(hid_t dset_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier"); /* Set up VOL callback arguments */ dset_opt_args.get_offset.offset = &dset_offset; @@ -924,7 +919,7 @@ H5Dget_offset(hid_t dset_id) /* Get the offset */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset"); /* Set return value */ ret_value = dset_offset; @@ -943,38 +938,80 @@ H5Dget_offset(hid_t dset_id) *------------------------------------------------------------------------- */ static herr_t -H5D__read_api_common(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, - void *buf, void **token_ptr, H5VL_object_t **_vol_obj_ptr) +H5D__read_api_common(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, void *buf[], void **token_ptr, + H5VL_object_t **_vol_obj_ptr) { H5VL_object_t *tmp_vol_obj = NULL; /* Object for loc_id */ H5VL_object_t **vol_obj_ptr = (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */ - herr_t ret_value = SUCCEED; /* Return value */ + void *obj_local; /* Local buffer for obj */ + void **obj = &obj_local; /* Array of object pointers */ + H5VL_t *connector; /* VOL connector pointer */ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Check arguments */ - if (mem_space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid memory dataspace ID") - if (file_space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file dataspace ID") - - /* Get dataset pointer */ - if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") + if (count == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "count must be greater than 0"); + if (!dset_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dset_id array not provided"); + if (!mem_type_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_type_id array not provided"); + if (!mem_space_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_space_id array not provided"); + if (!file_space_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_space_id array not provided"); + if (!buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf array not provided"); + + /* Allocate obj array if necessary */ + if (count > 1) + if (NULL == (obj = (void **)H5MM_malloc(count * sizeof(void *)))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate space for object array"); + + /* Get vol_obj_ptr (return just the first dataset to caller if requested) */ + if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id[0], H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID"); + + /* Save the connector of the first dataset. Unpack the connector and call + * the "direct" read function here to avoid allocating an array of count + * H5VL_object_ts. */ + connector = (*vol_obj_ptr)->connector; + + /* Build obj array */ + obj[0] = (*vol_obj_ptr)->data; + for (i = 1; i < count; i++) { + /* Get the object */ + if (NULL == (tmp_vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id[i], H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID"); + obj[i] = tmp_vol_obj->data; + + /* Make sure the class matches */ + if (tmp_vol_obj->connector->cls->value != connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "datasets are accessed through different VOL connectors and can't be used in the " + "same I/O call"); + } /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Read the data */ - if (H5VL_dataset_read(*vol_obj_ptr, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, token_ptr) < - 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") + if (H5VL_dataset_read_direct(count, obj, connector, mem_type_id, mem_space_id, file_space_id, dxpl_id, + buf, token_ptr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data"); done: + /* Free memory */ + if (obj != &obj_local) + H5MM_free(obj); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__read_api_common() */ @@ -1007,9 +1044,6 @@ H5D__read_api_common(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1022,8 +1056,9 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_i H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); /* Read the data */ - if (H5D__read_api_common(dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, NULL, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't synchronously read data") + if (H5D__read_api_common(1, &dset_id, &mem_type_id, &mem_space_id, &file_space_id, dxpl_id, &buf, NULL, + NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't synchronously read data"); done: FUNC_LEAVE_API(ret_value) @@ -1036,9 +1071,6 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_i * * Return: Non-negative on success/Negative on failure * - * Programmer: Houjun Tang - * Oct 15, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1059,9 +1091,9 @@ H5Dread_async(const char *app_file, const char *app_func, unsigned app_line, hid token_ptr = &token; /* Point at token for VOL connector to set up */ /* Read the data */ - if (H5D__read_api_common(dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, token_ptr, - &vol_obj) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't asynchronously read data") + if (H5D__read_api_common(1, &dset_id, &mem_type_id, &mem_space_id, &file_space_id, dxpl_id, &buf, + token_ptr, &vol_obj) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't asynchronously read data"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1069,12 +1101,88 @@ H5Dread_async(const char *app_file, const char *app_func, unsigned app_line, hid if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE10(__func__, "*s*sIuiiiiixi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) } /* end H5Dread_async() */ +/*------------------------------------------------------------------------- + * Function: H5Dread_multi + * + * Purpose: Multi-version of H5Dread(), which reads selections from + * multiple datasets from a file into application memory BUFS. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dread_multi(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], hid_t file_space_id[], + hid_t dxpl_id, void *buf[] /*out*/) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "z*i*i*i*iix", count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); + + if (count == 0) + HGOTO_DONE(SUCCEED); + + /* Read the data */ + if (H5D__read_api_common(count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, NULL, + NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't synchronously read data"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Dread_multi() */ + +/*------------------------------------------------------------------------- + * Function: H5Dread_multi_async + * + * Purpose: Asynchronously read dataset elements from multiple + * datasets. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dread_multi_async(const char *app_file, const char *app_func, unsigned app_line, size_t count, + hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], hid_t file_space_id[], + hid_t dxpl_id, void *buf[] /*out*/, hid_t es_id) +{ + H5VL_object_t *vol_obj = NULL; /* Dataset VOL object */ + void *token = NULL; /* Request token for async operation */ + void **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE11("e", "*s*sIuz*i*i*i*iixi", app_file, app_func, app_line, count, dset_id, mem_type_id, + mem_space_id, file_space_id, dxpl_id, buf, es_id); + + /* Set up request token pointer for asynchronous operation */ + if (H5ES_NONE != es_id) + token_ptr = &token; /* Point at token for VOL connector to set up */ + + /* Read the data */ + if (H5D__read_api_common(count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, + token_ptr, &vol_obj) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't asynchronously read data"); + + /* If a token was created, add the token to the event set */ + if (NULL != token) + /* clang-format off */ + if (H5ES_insert(es_id, vol_obj->connector, token, + H5ARG_TRACE11(__func__, "*s*sIuz*i*i*i*iixi", app_file, app_func, app_line, count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) + /* clang-format on */ + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Dread_multi_async() */ + /*------------------------------------------------------------------------- * Function: H5Dread_chunk * @@ -1082,9 +1190,6 @@ H5Dread_async(const char *app_file, const char *app_func, unsigned app_line, hid * * Return: Non-negative on success/Negative on failure * - * Programmer: Matthew Strong (GE Healthcare) - * 14 February 2016 - * *--------------------------------------------------------------------------- */ herr_t @@ -1100,19 +1205,19 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID"); if (!buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL"); if (!offset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL"); if (!filters) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filters cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filters cannot be NULL"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID"); /* Set up VOL callback arguments */ dset_opt_args.chunk_read.offset = offset; @@ -1123,7 +1228,7 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil /* Read the raw chunk */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data"); /* Set return value */ *filters = dset_opt_args.chunk_read.filters; @@ -1142,38 +1247,80 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil *------------------------------------------------------------------------- */ static herr_t -H5D__write_api_common(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t dxpl_id, const void *buf, void **token_ptr, H5VL_object_t **_vol_obj_ptr) +H5D__write_api_common(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, const void *buf[], void **token_ptr, + H5VL_object_t **_vol_obj_ptr) { H5VL_object_t *tmp_vol_obj = NULL; /* Object for loc_id */ H5VL_object_t **vol_obj_ptr = (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */ - herr_t ret_value = SUCCEED; /* Return value */ + void *obj_local; /* Local buffer for obj */ + void **obj = &obj_local; /* Array of object pointers */ + H5VL_t *connector; /* VOL connector pointer */ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Check arguments */ - if (mem_space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid memory dataspace ID") - if (file_space_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file dataspace ID") - - /* Get dataset pointer */ - if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID") + if (count == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "count must be greater than 0"); + if (!dset_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dset_id array not provided"); + if (!mem_type_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_type_id array not provided"); + if (!mem_space_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_space_id array not provided"); + if (!file_space_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_space_id array not provided"); + if (!buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf array not provided"); + + /* Allocate obj array if necessary */ + if (count > 1) + if (NULL == (obj = (void **)H5MM_malloc(count * sizeof(void *)))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate space for object array"); + + /* Get vol_obj_ptr (return just the first dataset to caller if requested) */ + if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id[0], H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID"); + + /* Save the connector of the first dataset. Unpack the connector and call + * the "direct" write function here to avoid allocating an array of count + * H5VL_object_ts. */ + connector = (*vol_obj_ptr)->connector; + + /* Build obj array */ + obj[0] = (*vol_obj_ptr)->data; + for (i = 1; i < count; i++) { + /* Get the object */ + if (NULL == (tmp_vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id[i], H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id is not a dataset ID"); + obj[i] = tmp_vol_obj->data; + + /* Make sure the class matches */ + if (tmp_vol_obj->connector->cls->value != connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "datasets are accessed through different VOL connectors and can't be used in the " + "same I/O call"); + } /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Write the data */ - if (H5VL_dataset_write(*vol_obj_ptr, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, token_ptr) < - 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") + if (H5VL_dataset_write_direct(count, obj, connector, mem_type_id, mem_space_id, file_space_id, dxpl_id, + buf, token_ptr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data"); done: + /* Free memory */ + if (obj != &obj_local) + H5MM_free(obj); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__write_api_common() */ @@ -1207,9 +1354,6 @@ H5D__write_api_common(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1222,9 +1366,9 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_ H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); /* Write the data */ - if (H5D__write_api_common(dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, NULL, NULL) < - 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't synchronously write data") + if (H5D__write_api_common(1, &dset_id, &mem_type_id, &mem_space_id, &file_space_id, dxpl_id, &buf, NULL, + NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't synchronously write data"); done: FUNC_LEAVE_API(ret_value) @@ -1237,9 +1381,6 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Houjun Tang - * Oct 15, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1261,9 +1402,9 @@ H5Dwrite_async(const char *app_file, const char *app_func, unsigned app_line, hi token_ptr = &token; /* Point at token for VOL connector to set up */ /* Write the data */ - if (H5D__write_api_common(dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, token_ptr, - &vol_obj) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't asynchronously write data") + if (H5D__write_api_common(1, &dset_id, &mem_type_id, &mem_space_id, &file_space_id, dxpl_id, &buf, + token_ptr, &vol_obj) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't asynchronously write data"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1271,12 +1412,88 @@ H5Dwrite_async(const char *app_file, const char *app_func, unsigned app_line, hi if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE10(__func__, "*s*sIuiiiii*xi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) } /* end H5Dwrite_async() */ +/*------------------------------------------------------------------------- + * Function: H5Dwrite_multi + * + * Purpose: Multi-version of H5Dwrite(), which writes selections from + * application memory BUFs into multiple datasets in a file. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dwrite_multi(size_t count, hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, const void *buf[]) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "z*i*i*i*ii**x", count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf); + + if (count == 0) + HGOTO_DONE(SUCCEED); + + /* Write the data */ + if (H5D__write_api_common(count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, NULL, + NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't synchronously write data"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Dwrite_multi() */ + +/*------------------------------------------------------------------------- + * Function: H5Dwrite_multi_async + * + * Purpose: Asynchronously write dataset elements to multiple + * datasets. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dwrite_multi_async(const char *app_file, const char *app_func, unsigned app_line, size_t count, + hid_t dset_id[], hid_t mem_type_id[], hid_t mem_space_id[], hid_t file_space_id[], + hid_t dxpl_id, const void *buf[], hid_t es_id) +{ + H5VL_object_t *vol_obj = NULL; /* Dataset VOL object */ + void *token = NULL; /* Request token for async operation */ + void **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE11("e", "*s*sIuz*i*i*i*ii**xi", app_file, app_func, app_line, count, dset_id, mem_type_id, + mem_space_id, file_space_id, dxpl_id, buf, es_id); + + /* Set up request token pointer for asynchronous operation */ + if (H5ES_NONE != es_id) + token_ptr = &token; /* Point at token for VOL connector to set up */ + + /* Write the data */ + if (H5D__write_api_common(count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, + token_ptr, &vol_obj) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't asynchronously write data"); + + /* If a token was created, add the token to the event set */ + if (NULL != token) + /* clang-format off */ + if (H5ES_insert(es_id, vol_obj->connector, token, + H5ARG_TRACE11(__func__, "*s*sIuz*i*i*i*ii**xi", app_file, app_func, app_line, count, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) + /* clang-format on */ + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Dwrite_multi_async() */ + /*------------------------------------------------------------------------- * Function: H5Dwrite_chunk * @@ -1284,9 +1501,6 @@ H5Dwrite_async(const char *app_file, const char *app_func, unsigned app_line, hi * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * 30 July 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -1304,24 +1518,24 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset ID"); if (!buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf cannot be NULL"); if (!offset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset cannot be NULL"); if (0 == data_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data_size cannot be zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "data_size cannot be zero"); /* Make sure data size is less than 4 GiB */ data_size_32 = (uint32_t)data_size; if (data_size != (size_t)data_size_32) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data_size - chunks cannot be > 4 GiB") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid data_size - chunks cannot be > 4 GiB"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID"); /* Set up VOL callback arguments */ dset_opt_args.chunk_write.offset = offset; @@ -1333,7 +1547,7 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of /* Write chunk */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data"); done: FUNC_LEAVE_API(ret_value) @@ -1350,9 +1564,6 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * 14 Jan 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -1374,53 +1585,53 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_ /* Check args */ if (op == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback function pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback function pointer"); if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (NULL == (dst_space = (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (dst_buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided"); /* Get datatype element size */ if (0 == (type_size = H5T_GET_SIZE(type))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size"); /* Get number of elements in dataspace */ if ((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(dst_space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection"); /* Allocate the selection iterator */ if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator"); /* Initialize selection iterator */ if (H5S_select_iter_init(iter, dst_space, type_size, 0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information"); iter_init = TRUE; /* Loop until all data has been scattered */ while (nelmts > 0) { /* Make callback to retrieve data */ if (op(&src_buf, &src_buf_nbytes, op_data) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure") + HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure"); /* Calculate number of elements */ nelmts_scatter = src_buf_nbytes / type_size; /* Check callback results */ if (!src_buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback did not return a buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback did not return a buffer"); if (src_buf_nbytes == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned a buffer size of 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned a buffer size of 0"); if (src_buf_nbytes % type_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size is not a multiple of datatype size") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size is not a multiple of datatype size"); if (nelmts_scatter > (size_t)nelmts) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned more elements than in selection") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback returned more elements than in selection"); /* Scatter data */ if (H5D__scatter_mem(src_buf, iter, nelmts_scatter, dst_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "scatter failed"); nelmts -= (hssize_t)nelmts_scatter; } /* end while */ @@ -1428,7 +1639,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_ done: /* Release selection iterator */ if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release selection iterator"); if (iter) iter = H5FL_FREE(H5S_sel_iter_t, iter); @@ -1446,9 +1657,6 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * 16 Jan 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -1470,42 +1678,42 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf /* Check args */ if (NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (src_buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source buffer provided") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source buffer provided"); if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (dst_buf_size == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer size is 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer size is 0"); if (dst_buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided"); /* Get datatype element size */ if (0 == (type_size = H5T_GET_SIZE(type))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype size"); /* Get number of elements in dst_buf_size */ dst_buf_nelmts = dst_buf_size / type_size; if (dst_buf_nelmts == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "destination buffer is not large enough to hold one element") + "destination buffer is not large enough to hold one element"); /* Get number of elements in dataspace */ if ((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(src_space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection"); /* If dst_buf is not large enough to hold all the elements, make sure there * is a callback */ if (((size_t)nelmts > dst_buf_nelmts) && (op == NULL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback supplied and destination buffer too small") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback supplied and destination buffer too small"); /* Allocate the selection iterator */ if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate selection iterator"); /* Initialize selection iterator */ if (H5S_select_iter_init(iter, src_space, type_size, 0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize selection iterator information"); iter_init = TRUE; /* Loop until all data has been scattered */ @@ -1513,21 +1721,21 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf /* Gather data */ if (0 == (nelmts_gathered = H5D__gather_mem(src_buf, iter, MIN(dst_buf_nelmts, (size_t)nelmts), dst_buf))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "gather failed") - HDassert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts)); + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "gather failed"); + assert(nelmts_gathered == MIN(dst_buf_nelmts, (size_t)nelmts)); /* Make callback to process dst_buf */ if (op && op(dst_buf, nelmts_gathered * type_size, op_data) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure") + HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure"); nelmts -= (hssize_t)nelmts_gathered; - HDassert(op || (nelmts == 0)); + assert(op || (nelmts == 0)); } /* end while */ done: /* Release selection iterator */ if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release selection iterator"); if (iter) iter = H5FL_FREE(H5S_sel_iter_t, iter); @@ -1570,17 +1778,17 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_ /* Check args */ if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer"); if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataspace"); if (NULL == (fill_type = (H5T_t *)H5I_object_verify(fill_type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype"); if (NULL == (buf_type = (H5T_t *)H5I_object_verify(buf_type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype"); /* Fill the selection in the memory buffer */ if (H5D__fill(fill, fill_type, buf, buf_type, space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed"); done: FUNC_LEAVE_API(ret_value) @@ -1640,9 +1848,6 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_ * or zero if all elements were processed. Otherwise returns a * negative value. * - * Programmer: Quincey Koziol - * Friday, June 11, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -1658,17 +1863,17 @@ H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *op /* Check args */ if (NULL == op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid operator") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid operator"); if (NULL == buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer"); if (H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype"); if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype"); if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace"); if (!(H5S_has_extent(space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set"); dset_op.op_type = H5S_SEL_ITER_OP_APP; dset_op.u.app_op.op = op; @@ -1691,9 +1896,6 @@ H5Diterate(void *buf, hid_t type_id, hid_t space_id, H5D_operator_t op, void *op * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Wednesday, August 11, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -1708,19 +1910,19 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *s /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(dataset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid datatype identifier"); if (H5I_DATASPACE != H5I_get_type(space_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace identifier"); if (size == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid 'size' pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid 'size' pointer"); /* Check if the 'get_vlen_buf_size' callback is supported */ supported = 0; if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_DATASET, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, &supported) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check for 'get vlen buf size' operation") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check for 'get vlen buf size' operation"); if (supported & H5VL_OPT_QUERY_SUPPORTED) { H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */ @@ -1734,12 +1936,12 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *s /* Make the 'get_vlen_buf_size' callback */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size"); } /* end if */ else { /* Perform a generic operation that will work with all VOL connectors */ if (H5D__vlen_get_buf_size_gen(vol_obj, type_id, space_id, size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size"); } /* end else */ done: @@ -1769,13 +1971,13 @@ H5D__set_extent_api_common(hid_t dset_id, const hsize_t size[], void **token_ptr /* Check args */ if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (!size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size array cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size array cannot be NULL"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_SET_EXTENT; @@ -1783,7 +1985,7 @@ H5D__set_extent_api_common(hid_t dset_id, const hsize_t size[], void **token_ptr /* Set the extent */ if (H5VL_dataset_specific(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1809,7 +2011,7 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) /* Change a datset's dimensions synchronously */ if ((ret_value = H5D__set_extent_api_common(dset_id, size, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to synchronously change a dataset's dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to synchronously change a dataset's dimensions"); done: FUNC_LEAVE_API(ret_value) @@ -1842,7 +2044,7 @@ H5Dset_extent_async(const char *app_file, const char *app_func, unsigned app_lin /* Change a datset's dimensions asynchronously */ if (H5D__set_extent_api_common(dset_id, size, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to asynchronously change a dataset's dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to asynchronously change a dataset's dimensions"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1850,7 +2052,7 @@ H5Dset_extent_async(const char *app_file, const char *app_func, unsigned app_lin if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE6(__func__, "*s*sIui*hi", app_file, app_func, app_line, dset_id, size, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1877,11 +2079,11 @@ H5Dflush(hid_t dset_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_FLUSH; @@ -1892,7 +2094,7 @@ H5Dflush(hid_t dset_id) * callback needs it and that's in the public API. */ if (H5VL_dataset_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset"); done: FUNC_LEAVE_API(ret_value) @@ -1919,11 +2121,11 @@ H5Drefresh(hid_t dset_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_REFRESH; @@ -1931,7 +2133,7 @@ H5Drefresh(hid_t dset_id) /* Refresh the dataset object */ if (H5VL_dataset_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset"); done: FUNC_LEAVE_API(ret_value) @@ -1949,9 +2151,6 @@ H5Drefresh(hid_t dset_id) * * Return: Non-negative on success, negative on failure * - * Programmer: Vailin Choi - * Feb 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -1966,11 +2165,11 @@ H5Dformat_convert(hid_t dset_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_NATIVE_DATASET_FORMAT_CONVERT; @@ -1978,7 +2177,7 @@ H5Dformat_convert(hid_t dset_id) /* Convert the dataset */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format") + HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format"); done: FUNC_LEAVE_API(ret_value) @@ -1991,9 +2190,6 @@ H5Dformat_convert(hid_t dset_id) * * Return: Non-negative on success, negative on failure * - * Programmer: Vailin Choi - * Feb 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -2009,9 +2205,9 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier"); if (NULL == idx_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL"); /* Set up VOL callback arguments */ dset_opt_args.get_chunk_idx_type.idx_type = idx_type; @@ -2020,7 +2216,7 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/) /* Get the chunk indexing type */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type"); done: FUNC_LEAVE_API(ret_value) @@ -2036,9 +2232,6 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/) * * Return: Non-negative on success, negative on failure * - * Programmer: Matthew Strong (GE Healthcare) - * 20 October 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -2054,11 +2247,11 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier"); if (NULL == offset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset parameter cannot be NULL"); if (NULL == chunk_nbytes) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL"); /* Set up VOL callback arguments */ dset_opt_args.get_chunk_storage_size.offset = offset; @@ -2068,10 +2261,10 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n /* Get the dataset creation property list */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk"); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Dget_chunk_storage_size() */ /*------------------------------------------------------------------------- @@ -2090,9 +2283,6 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n * * Return: Non-negative on success, negative on failure * - * Programmer: Binh-Minh Ribler - * May 2019 (HDFFV-10677) - * *------------------------------------------------------------------------- */ herr_t @@ -2108,9 +2298,9 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/) /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (NULL == nchunks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)"); /* Set up VOL callback arguments */ dset_opt_args.get_num_chunks.space_id = fspace_id; @@ -2120,10 +2310,10 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/) /* Get the number of written chunks */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks"); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Dget_num_chunks() */ /*------------------------------------------------------------------------- @@ -2135,7 +2325,7 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/) * hid_t dset_id; IN: Chunked dataset ID * hid_t fspace_id; IN: File dataspace ID * hsize_t index; IN: Index of written chunk - * hsize_t *offset OUT: Logical position of the chunk’s + * hsize_t *offset OUT: Logical position of the chunk's * first element in the dataspace * unsigned *filter_mask OUT: Mask for identifying the filters in use * haddr_t *addr OUT: Address of the chunk @@ -2143,9 +2333,6 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/) * * Return: Non-negative on success, negative on failure * - * Programmer: Binh-Minh Ribler - * May 2019 (HDFFV-10677) - * *------------------------------------------------------------------------- */ herr_t @@ -2164,9 +2351,9 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of /* Check arguments */ if (NULL == offset && NULL == filter_mask && NULL == addr && NULL == size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid arguments, must have at least one non-null output argument") + "invalid arguments, must have at least one non-null output argument"); if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); /* Set up VOL callback arguments */ dset_opt_args.get_num_chunks.space_id = fspace_id; @@ -2176,11 +2363,11 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of /* Get the number of written chunks to check range */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks"); /* Check range for chunk index */ if (chk_index >= nchunks) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk index is out of range") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk index is out of range"); /* Set up VOL callback arguments */ dset_opt_args.get_chunk_info_by_idx.space_id = fspace_id; @@ -2194,10 +2381,10 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of /* Call private function to get the chunk info given the chunk's index */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index"); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Dget_chunk_info() */ /*------------------------------------------------------------------------- @@ -2208,7 +2395,7 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of * * Parameters: * hid_t dset_id; IN: Chunked dataset ID - * hsize_t *offset IN: Logical position of the chunk’s + * hsize_t *offset IN: Logical position of the chunk's * first element in the dataspace * unsigned *filter_mask OUT: Mask for identifying the filters in use * haddr_t *addr OUT: Address of the chunk @@ -2216,9 +2403,6 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of * * Return: Non-negative on success, negative on failure * - * Programmer: Binh-Minh Ribler - * May 2019 (HDFFV-10677) - * *------------------------------------------------------------------------- */ herr_t @@ -2235,12 +2419,12 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (NULL == filter_mask && NULL == addr && NULL == size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid arguments, must have at least one non-null output argument") + "invalid arguments, must have at least one non-null output argument"); if (NULL == offset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)"); /* Set up VOL callback arguments */ dset_opt_args.get_chunk_info_by_coord.offset = offset; @@ -2252,7 +2436,7 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte /* Call private function to get the chunk info given the chunk's index */ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by its logical coordinates") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by its logical coordinates"); done: FUNC_LEAVE_API(ret_value) @@ -2269,37 +2453,8 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte * H5D_chunk_iter_op_t cb IN: User callback function, called for every chunk. * void *op_data IN/OUT: Optional user data passed on to user callback. * - * Callback information: - * H5D_chunk_iter_op_t is defined as: - * - * typedef int (*H5D_chunk_iter_op_t)( - * const hsize_t *offset, - * uint32_t filter_mask, - * haddr_t addr, - * uint32_t nbytes, - * void *op_data); - * - * H5D_chunk_iter_op_t parameters: - * hsize_t *offset; IN/OUT: Array of starting logical coordinates of chunk. - * uint32_t filter_mask; IN: Filter mask of chunk. - * haddr_t addr; IN: Offset in file of chunk data. - * uint32_t nbytes; IN: Size in number of bytes of chunk data in file. - * void *op_data; IN/OUT: Pointer to any user-defined data - * associated with the operation. - * - * The return values from an operator are: - * Zero (H5_ITER_CONT) causes the iterator to continue, returning zero when all - * elements have been processed. - * Positive (H5_ITER_STOP) causes the iterator to immediately return that positive - * value, indicating short-circuit success. - * Negative (H5_ITER_ERROR) causes the iterator to immediately return that value, - * indicating failure. - * * Return: Non-negative on success, negative on failure * - * Programmer: Gaute Hope - * August 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -2315,15 +2470,15 @@ H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t op, void *op_dat /* Check arguments */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); if (NULL == op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback to chunk iteration") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback to chunk iteration"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID"); /* Set up VOL callback arguments */ dset_opt_args.chunk_iter.op = op; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5DaccProp.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5DaccProp.cpp deleted file mode 100644 index 1905f277c0..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5DaccProp.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5DataSpace.h" -#include "H5PropList.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control -// the order of creation and deletion of the global constants. See Design Notes -// in "H5PredType.cpp" for information. - -// Initialize a pointer for the constant -DSetAccPropList *DSetAccPropList::DEFAULT_ = 0; - -//-------------------------------------------------------------------------- -// Function: DSetAccPropList::getConstant -// Purpose: Creates a DSetAccPropList object representing the HDF5 -// constant H5P_DATASET_ACCESS, pointed to by -// DSetAccPropList::DEFAULT_ -// exception H5::PropListIException -// Description -// If DSetAccPropList::DEFAULT_ already points to an allocated -// object, throw a PropListIException. This scenario should -// not happen. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -DSetAccPropList * -DSetAccPropList::getConstant() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the constant pointer is not allocated, allocate it. Otherwise, - // throw because it shouldn't be. - if (DEFAULT_ == 0) - DEFAULT_ = new DSetAccPropList(H5P_DATASET_ACCESS); - else - throw PropListIException("DSetAccPropList::getConstant", - "DSetAccPropList::getConstant is being invoked on an allocated DEFAULT_"); - return (DEFAULT_); -} - -//-------------------------------------------------------------------------- -// Function: DSetAccPropList::deleteConstants -// Purpose: Deletes the constant object that DSetAccPropList::DEFAULT_ -// points to. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -DSetAccPropList::deleteConstants() -{ - delete DEFAULT_; -} - -//-------------------------------------------------------------------------- -// Purpose Constant for dataset creation default property -//-------------------------------------------------------------------------- -const DSetAccPropList &DSetAccPropList::DEFAULT = *getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: DSetAccPropList default constructor -///\brief Default constructor: creates a stub dataset creation property list -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetAccPropList::DSetAccPropList() : LinkAccPropList(H5P_DATASET_ACCESS) -{ -} - -//-------------------------------------------------------------------------- -// Function: DSetAccPropList copy constructor -///\brief Copy constructor: same HDF5 object as \a original -/// DSetAccPropList object -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetAccPropList::DSetAccPropList(const DSetAccPropList &orig) : LinkAccPropList(orig) -{ -} - -//-------------------------------------------------------------------------- -// Function: DSetAccPropList overloaded constructor -///\brief Creates a DSetAccPropList object using the id of an -/// existing dataset creation property list. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetAccPropList::DSetAccPropList(const hid_t plist_id) : LinkAccPropList(plist_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: DSetAccPropList::setChunkCache -///\brief Sets the raw data chunk cache parameters. -///\param rdcc_nslots - IN: Number of chunk slots in the raw data chunk cache -///\param rdcc_nbytes - IN: Total size of the raw data chunk cache -///\param rdcc_w0 - IN: The chunk preemption policy for this dataset -///\exception H5::PropListIException -///\par Description -/// The raw data chunk cache parameters includes the number of -/// objects in the meta data cache and the maximum number of -/// chunks and bytes in the raw data chunk cache. Once set, -/// these values will override the values in the file access -/// property list. -/// -/// For information, please refer to the H5Pset_chunk_cache API in -/// the HDF5 C Reference Manual. -// July 2018 -//-------------------------------------------------------------------------- -void -DSetAccPropList::setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) const -{ - herr_t ret_value = H5Pset_chunk_cache(id, rdcc_nslots, rdcc_nbytes, rdcc_w0); - if (ret_value < 0) { - throw PropListIException("DSetAccPropList::setChunkCache", "H5Pset_chunk_cache failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetAccPropList::getChunkCache -///\brief Retrieves the raw data chunk cache parameters. -///\param rdcc_nslots - OUT: Number of chunk slots in the raw data chunk cache -///\param rdcc_nbytes - OUT: Total size of the raw data chunk cache -///\param rdcc_w0 - OUT: The chunk preemption policy for this dataset -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pget_chunk_cache API in -/// the HDF5 C Reference Manual. -// July 2018 -//-------------------------------------------------------------------------- -void -DSetAccPropList::getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) const -{ - herr_t ret_value = H5Pget_chunk_cache(id, &rdcc_nslots, &rdcc_nbytes, &rdcc_w0); - if (ret_value < 0) { - throw PropListIException("DSetAccPropList::getChunkCache", "H5Pget_chunk_cache failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetAccPropList destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetAccPropList::~DSetAccPropList() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5DataSet.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5DataSet.cpp deleted file mode 100644 index 3ee0ec5e22..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5DataSet.cpp +++ /dev/null @@ -1,848 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5FaccProp.h" -#include "H5FcreatProp.h" -#include "H5OcreatProp.h" -#include "H5DxferProp.h" -#include "H5DcreatProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5DataSpace.h" -#include "H5AbstractDs.h" -#include "H5Attribute.h" -#include "H5DataSet.h" - -namespace H5 { -using std::cerr; -using std::endl; - -//-------------------------------------------------------------------------- -// Function: DataSet default constructor -///\brief Default constructor: creates a stub DataSet. -//-------------------------------------------------------------------------- -DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) -{ -} - -//-------------------------------------------------------------------------- -// Function: DataSet overloaded constructor -///\brief Creates an DataSet object using the id of an existing dataset. -///\param existing_id - IN: Id of an existing dataset -// Description -// incRefCount() is needed here to prevent the id from being closed -// prematurely. That is, when application uses the id of an -// existing DataSet object to create another DataSet object. So, -// when one of those objects is deleted, the id will be closed if -// the reference counter is only 1. -//-------------------------------------------------------------------------- -DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs(), id(existing_id) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: DataSet copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param original - IN: DataSet instance to copy -//-------------------------------------------------------------------------- -DataSet::DataSet(const DataSet &original) : H5Object(), AbstractDs(), id(original.id) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: DataSet assignment operator -///\brief Assignment operator: same HDF5 object as \a original -///\param original - IN: DataSet instance to copy -//-------------------------------------------------------------------------- -DataSet & -DataSet::operator=(const DataSet &original) -{ - if (this != &original) { - setId(original.id); - } - return (*this); -} - -//-------------------------------------------------------------------------- -// Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 location, creates a -/// DataSet object -///\param loc - IN: Dataset reference object is in or location of -/// object that the dataset is located within. -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::DataSetIException -///\par Description -/// \c loc can be DataSet, Group, H5File, or named DataType, that -/// is a datatype that has been named by DataType::commit. -//-------------------------------------------------------------------------- -DataSet::DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist) - : H5Object(), AbstractDs(), id(H5I_INVALID_HID) -{ - id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereferenced"); -} - -//-------------------------------------------------------------------------- -// Function: DataSet overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 attribute, creates a -/// DataSet object -///\param attr - IN: Specifying location where the referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException -//-------------------------------------------------------------------------- -DataSet::DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type, const PropList &plist) - : H5Object(), AbstractDs(), id(H5I_INVALID_HID) -{ - id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); -} - -//-------------------------------------------------------------------------- -// Function: DataSet::getSpace -///\brief Gets a copy of the dataspace of this dataset. -///\return DataSpace instance -///\exception H5::DataSetIException -//-------------------------------------------------------------------------- -DataSpace -DataSet::getSpace() const -{ - // Calls C function H5Dget_space to get the id of the dataspace - hid_t dataspace_id = H5Dget_space(id); - - // If the dataspace id is invalid, throw an exception - if (dataspace_id < 0) { - throw DataSetIException("DataSet::getSpace", "H5Dget_space failed"); - } - // create dataspace object using the existing id then return the object - DataSpace data_space; - f_DataSpace_setId(&data_space, dataspace_id); - return (data_space); -} - -// This private member function calls the C API to get the identifier -// of the datatype that is used by this dataset. It is used -// by the various AbstractDs functions to get the specific datatype. -hid_t -DataSet::p_get_type() const -{ - hid_t type_id = H5Dget_type(id); - if (type_id > 0) - return (type_id); - else { - throw DataSetIException("", "H5Dget_type failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::getCreatePlist -///\brief Gets the dataset creation property list. -///\return DSetCreatPropList instance -///\exception H5::DataSetIException -//-------------------------------------------------------------------------- -DSetCreatPropList -DataSet::getCreatePlist() const -{ - hid_t create_plist_id = H5Dget_create_plist(id); - if (create_plist_id < 0) { - throw DataSetIException("DataSet::getCreatePlist", "H5Dget_create_plist failed"); - } - - // create and return the DSetCreatPropList object - DSetCreatPropList create_plist; - f_PropList_setId(&create_plist, create_plist_id); - return (create_plist); -} - -//-------------------------------------------------------------------------- -// Function: DataSet::getAccessPlist -///\brief Gets the dataset access property list. -///\return DSetAccPropList instance -///\exception H5::DataSetIException -// July 2018 -//-------------------------------------------------------------------------- -DSetAccPropList -DataSet::getAccessPlist() const -{ - hid_t access_plist_id = H5Dget_access_plist(id); - if (access_plist_id < 0) { - throw DataSetIException("DataSet::getAccessPlist", "H5Dget_access_plist failed"); - } - - // create and return the DSetCreatPropList object - DSetAccPropList access_plist; - f_PropList_setId(&access_plist, access_plist_id); - return (access_plist); -} - -//-------------------------------------------------------------------------- -// Function: DataSet::getStorageSize -///\brief Returns the amount of storage required for a dataset. -///\return Size of the storage or 0, for no data -///\exception H5::DataSetIException -// Note: H5Dget_storage_size returns 0 when there is no data. This -// function should have no failure. (from SLU) -//-------------------------------------------------------------------------- -hsize_t -DataSet::getStorageSize() const -{ - hsize_t storage_size = H5Dget_storage_size(id); - return (storage_size); -} - -//-------------------------------------------------------------------------- -// Function: DataSet::getInMemDataSize -///\brief Gets the size in memory of the dataset's data. -///\return Size of data (in memory) -///\exception H5::DataSetIException -//-------------------------------------------------------------------------- -size_t -DataSet::getInMemDataSize() const -{ - const char *func = "DataSet::getInMemDataSize"; - - // Get the data type of this dataset - hid_t mem_type_id = H5Dget_type(id); - if (mem_type_id < 0) { - throw DataSetIException(func, "H5Dget_type failed"); - } - - // Get the data type's size by first getting its native type then getting - // the native type's size. - hid_t native_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT); - if (native_type < 0) { - throw DataSetIException(func, "H5Tget_native_type failed"); - } - size_t type_size = H5Tget_size(native_type); - if (type_size == 0) { - throw DataSetIException(func, "H5Tget_size failed"); - } - - // Close the native type and the datatype of this dataset. - if (H5Tclose(native_type) < 0) { - throw DataSetIException(func, "H5Tclose(native_type) failed"); - } - if (H5Tclose(mem_type_id) < 0) { - throw DataSetIException(func, "H5Tclose(mem_type_id) failed"); - } - - // Get number of elements of the dataset by first getting its dataspace, - // then getting the number of elements in the dataspace - hid_t space_id = H5Dget_space(id); - if (space_id < 0) { - throw DataSetIException(func, "H5Dget_space failed"); - } - hssize_t num_elements = H5Sget_simple_extent_npoints(space_id); - if (num_elements < 0) { - throw DataSetIException(func, "H5Sget_simple_extent_npoints failed"); - } - - // Close the dataspace - if (H5Sclose(space_id) < 0) { - throw DataSetIException(func, "H5Sclose failed"); - } - - // Calculate and return the size of the data - // Note that large datasets can overflow a size_t - size_t data_size = type_size * static_cast(num_elements); - - return data_size; -} - -//-------------------------------------------------------------------------- -// Function: DataSet::getOffset -///\brief Returns the address of this dataset in the file. -///\return Address of dataset -///\exception H5::DataSetIException -//-------------------------------------------------------------------------- -haddr_t -DataSet::getOffset() const -{ - haddr_t ds_addr; // for address of dataset - - ds_addr = H5Dget_offset(id); - if (ds_addr == HADDR_UNDEF) { - throw DataSetIException("DataSet::getOffset", "H5Dget_offset returned HADDR_UNDEF"); - } - return (ds_addr); -} - -//-------------------------------------------------------------------------- -// Function: DataSet::getSpaceStatus -///\brief Determines whether space has been allocated for a dataset. -///\param status - OUT: Space allocation status -///\exception H5::DataSetIException -//-------------------------------------------------------------------------- -void -DataSet::getSpaceStatus(H5D_space_status_t &status) const -{ - herr_t ret_value = H5Dget_space_status(id, &status); - if (ret_value < 0) { - throw DataSetIException("DataSet::getSpaceStatus", "H5Dget_space_status failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::getVlenBufSize -///\brief Returns the number of bytes required to store VL data. -///\param type - IN: Datatype, which is the datatype for the buffer -///\param space - IN: Selection for the memory buffer -///\return Amount of storage -///\exception H5::DataSetIException -//-------------------------------------------------------------------------- -hsize_t -DataSet::getVlenBufSize(const DataType &type, const DataSpace &space) const -{ - // Obtain identifiers for C API - hid_t type_id = type.getId(); - hid_t space_id = space.getId(); - - hsize_t size; // for amount of storage - - herr_t ret_value = H5Dvlen_get_buf_size(id, type_id, space_id, &size); - if (ret_value < 0) { - throw DataSetIException("DataSet::getVlenBufSize", "H5Dvlen_get_buf_size failed"); - } - return (size); -} - -//-------------------------------------------------------------------------- -// Function: DataSet::getVlenBufSize -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Return Amount of storage -// Exception H5::DataSetIException -// Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 -//-------------------------------------------------------------------------- -// hsize_t DataSet::getVlenBufSize(DataType& type, DataSpace& space) const -//{ -// return(getVlenBufSize(type, space)); -//} - -//-------------------------------------------------------------------------- -// Function: DataSet::vlenReclaim -///\brief Reclaims VL datatype memory buffers. -///\param type - IN: Datatype, which is the datatype stored in the buffer -///\param space - IN: Selection for the memory buffer to free the -/// VL datatypes within -///\param xfer_plist - IN: Property list used to create the buffer -///\param buf - IN: Pointer to the buffer to be reclaimed -///\exception H5::DataSetIException -//-------------------------------------------------------------------------- -void -DataSet::vlenReclaim(const DataType &type, const DataSpace &space, const DSetMemXferPropList &xfer_plist, - void *buf) -{ - // Obtain identifiers for C API - hid_t type_id = type.getId(); - hid_t space_id = space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); - - herr_t ret_value = H5Treclaim(type_id, space_id, xfer_plist_id, buf); - if (ret_value < 0) { - throw DataSetIException("DataSet::vlenReclaim", "H5Treclaim failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::vlenReclaim -///\brief Reclaims VL datatype memory buffers. -///\param type - IN: Datatype, which is the datatype stored in the buffer -///\param space - IN: Selection for the memory buffer to free the -/// VL datatypes within -///\param xfer_plist - IN: Property list used to create the buffer -///\param buf - IN: Pointer to the buffer to be reclaimed -///\exception H5::DataSetIException -//\parDescription -// This function has better prototype for the users than the -// other, which might be removed at some point. BMR - 2006/12/20 -//-------------------------------------------------------------------------- -void -DataSet::vlenReclaim(void *buf, const DataType &type, const DataSpace &space, - const DSetMemXferPropList &xfer_plist) -{ - // Obtain identifiers for C API - hid_t type_id = type.getId(); - hid_t space_id = space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); - - herr_t ret_value = H5Treclaim(type_id, space_id, xfer_plist_id, buf); - if (ret_value < 0) { - throw DataSetIException("DataSet::vlenReclaim", "H5Treclaim failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::read -///\brief Reads raw data from the specified dataset. -///\param buf - IN: Buffer for read data -///\param mem_type - IN: Memory datatype -///\param mem_space - IN: Memory dataspace -///\param file_space - IN: Dataset's dataspace in the file -///\param xfer_plist - IN: Transfer property list for this I/O operation -///\exception H5::DataSetIException -///\par Description -/// This function reads raw data from this dataset into the -/// buffer \a buf, converting from file datatype and dataspace -/// to memory datatype \a mem_type and dataspace \a mem_space. -//-------------------------------------------------------------------------- -void -DataSet::read(void *buf, const DataType &mem_type, const DataSpace &mem_space, const DataSpace &file_space, - const DSetMemXferPropList &xfer_plist) const -{ - // Obtain identifiers for C API - hid_t mem_type_id = mem_type.getId(); - hid_t mem_space_id = mem_space.getId(); - hid_t file_space_id = file_space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); - - herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf); - if (ret_value < 0) { - throw DataSetIException("DataSet::read", "H5Dread failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::read -///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c H5std_string for the buffer. -///\param strg - IN: Buffer for read data string -///\param mem_type - IN: Memory datatype -///\param mem_space - IN: Memory dataspace -///\param file_space - IN: Dataset's dataspace in the file -///\param xfer_plist - IN: Transfer property list for this I/O operation -///\exception H5::DataSetIException -// Modification -// Jul 2009 -// Follow the change to Attribute::read and use the following -// private functions to read datasets with fixed- and -// variable-length string: -// DataSet::p_read_fixed_len and -// DataSet::p_read_variable_len -//-------------------------------------------------------------------------- -void -DataSet::read(H5std_string &strg, const DataType &mem_type, const DataSpace &mem_space, - const DataSpace &file_space, const DSetMemXferPropList &xfer_plist) const -{ - // Check if this dataset has variable-len string or fixed-len string and - // proceed appropriately. - htri_t is_variable_len = H5Tis_variable_str(mem_type.getId()); - if (is_variable_len < 0) { - throw DataSetIException("DataSet::read", "H5Tis_variable_str failed"); - } - - // Obtain identifiers for C API - hid_t mem_type_id = mem_type.getId(); - hid_t mem_space_id = mem_space.getId(); - hid_t file_space_id = file_space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); - - if (!is_variable_len) // only allocate for fixed-len string - { - p_read_fixed_len(mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg); - } - else { - p_read_variable_len(mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::write -///\brief Writes raw data from an application buffer to a dataset. -///\param buf - IN: Buffer containing data to be written -///\param mem_type - IN: Memory datatype -///\param mem_space - IN: Memory dataspace -///\param file_space - IN: Dataset's dataspace in the file -///\param xfer_plist - IN: Transfer property list for this I/O operation -///\exception H5::DataSetIException -///\par Description -/// This function writes raw data from an application buffer -/// \a buf to a dataset, converting from memory datatype -/// \a mem_type and dataspace \a mem_space to file datatype -/// and dataspace. -//-------------------------------------------------------------------------- -void -DataSet::write(const void *buf, const DataType &mem_type, const DataSpace &mem_space, - const DataSpace &file_space, const DSetMemXferPropList &xfer_plist) const -{ - // Obtain identifiers for C API - hid_t mem_type_id = mem_type.getId(); - hid_t mem_space_id = mem_space.getId(); - hid_t file_space_id = file_space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); - - herr_t ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf); - if (ret_value < 0) { - throw DataSetIException("DataSet::write", "H5Dwrite failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::write -///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c H5std_string for the buffer. -// Modification -// Jul 2009 -// Modified to pass the buffer into H5Dwrite properly depending -// whether the dataset has variable- or fixed-length string. -//-------------------------------------------------------------------------- -void -DataSet::write(const H5std_string &strg, const DataType &mem_type, const DataSpace &mem_space, - const DataSpace &file_space, const DSetMemXferPropList &xfer_plist) const -{ - // Check if this attribute has variable-len string or fixed-len string and - // proceed appropriately. - htri_t is_variable_len = H5Tis_variable_str(mem_type.getId()); - if (is_variable_len < 0) { - throw DataSetIException("DataSet::write", "H5Tis_variable_str failed"); - } - - // Obtain identifiers for C API - hid_t mem_type_id = mem_type.getId(); - hid_t mem_space_id = mem_space.getId(); - hid_t file_space_id = file_space.getId(); - hid_t xfer_plist_id = xfer_plist.getId(); - - // Convert string to C-string - const char *strg_C; - strg_C = strg.c_str(); // strg_C refers to the contents of strg as a C-str - herr_t ret_value = 0; - - // Pass string in differently depends on variable or fixed length - if (!is_variable_len) { - ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C); - } - else { - // passing string argument by address - ret_value = H5Dwrite(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C); - } - if (ret_value < 0) { - throw DataSetIException("DataSet::write", "H5Dwrite failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::iterateElems -///\brief Iterates over all selected elements in a dataspace. -///\param buf - IN/OUT: Pointer to the buffer in memory containing the -/// elements to iterate over -///\param type - IN: Datatype for the elements stored in \a buf -///\param space - IN: Dataspace for \a buf. Also contains the selection -/// to iterate over. -///\param op - IN: Function pointer to the routine to be called for -/// each element in \a buf iterated over -///\param op_data - IN/OUT: Pointer to any user-defined data associated -/// with the operation -///\exception H5::DataSetIException -///\note This function may not work correctly yet - it's still -/// under development. -//-------------------------------------------------------------------------- -int -DataSet::iterateElems(void *buf, const DataType &type, const DataSpace &space, H5D_operator_t op, - void *op_data) -{ - // Obtain identifiers for C API - hid_t type_id = type.getId(); - hid_t space_id = space.getId(); - herr_t ret_value = H5Diterate(buf, type_id, space_id, op, op_data); - if (ret_value >= 0) - return (ret_value); - else // raise exception when H5Diterate returns a negative value - { - throw DataSetIException("DataSet::iterateElems", "H5Diterate failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::extend -///\brief Extends a dataset with unlimited dimension. -///\param size - IN: Array containing the new magnitude of each dimension -///\exception H5::DataSetIException -///\par Description -/// For information, please refer to the H5Dset_extent API in -/// the HDF5 C Reference Manual. -//-------------------------------------------------------------------------- -void -DataSet::extend(const hsize_t *size) const -{ - herr_t ret_value = H5Dset_extent(id, size); - if (ret_value < 0) // raise exception when H5Dset_extent returns a neg value - throw DataSetIException("DataSet::extend", "H5Dset_extent failed"); -} - -//-------------------------------------------------------------------------- -// Function: DataSet::fillMemBuf -///\brief Fills a selection in memory with a value. -///\param fill - IN: Pointer to fill value to use - default NULL -///\param fill_type - IN: Datatype of the fill value -///\param buf - IN/OUT: Memory buffer to fill selection within -///\param buf_type - IN: Datatype of the elements in buffer -///\param space - IN: Dataspace describing memory buffer & containing selection to use -///\exception H5::DataSetIException -//-------------------------------------------------------------------------- -void -DataSet::fillMemBuf(const void *fill, const DataType &fill_type, void *buf, const DataType &buf_type, - const DataSpace &space) const -{ - hid_t fill_type_id = fill_type.getId(); - hid_t buf_type_id = buf_type.getId(); - hid_t space_id = space.getId(); - herr_t ret_value = H5Dfill(fill, fill_type_id, buf, buf_type_id, space_id); - if (ret_value < 0) { - throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::fillMemBuf -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Param fill - IN: Pointer to fill value to use - default NULL -// Param fill_type - IN: Datatype of the fill value -// Param buf - IN/OUT: Memory buffer to fill selection within -// Param buf_type - IN: Datatype of the elements in buffer -// Param space - IN: Dataspace describing memory buffer & containing selection to use -// Exception H5::DataSetIException -// Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 -//-------------------------------------------------------------------------- -// void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& -// space) -//{ -// fillMemBuf(fill, (const DataType)fill_type, buf, (const DataType)buf_type, (const DataSpace)space); -//} - -//-------------------------------------------------------------------------- -// Function: DataSet::fillMemBuf -///\brief Fills a selection in memory with 0. -///\param buf - IN/OUT: Memory buffer to fill selection within -///\param buf_type - IN: Datatype of the elements in buffer -///\param space - IN: Dataspace describing memory buffer & containing selection to use -///\exception H5::DataSetIException -//-------------------------------------------------------------------------- -void -DataSet::fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) const -{ - hid_t buf_type_id = buf_type.getId(); - hid_t space_id = space.getId(); - herr_t ret_value = H5Dfill(NULL, buf_type_id, buf, buf_type_id, space_id); - if (ret_value < 0) { - throw DataSetIException("DataSet::fillMemBuf", "H5Dfill failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::fillMemBuf -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Param buf - IN/OUT: Memory buffer to fill selection within -// Param buf_type - IN: Datatype of the elements in buffer -// Param space - IN: Dataspace describing memory buffer & containing selection to use -// Exception H5::DataSetIException -// Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 -//-------------------------------------------------------------------------- -// void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space) -//{ -// fillMemBuf(buf, (const DataType)buf_type, (const DataSpace)space); -//} - -//-------------------------------------------------------------------------- -// Function: DataSet::getId -///\brief Get the id of this dataset. -///\return DataSet identifier -// Description: -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDs and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. -//-------------------------------------------------------------------------- -hid_t -DataSet::getId() const -{ - return (id); -} - -//-------------------------------------------------------------------------- -// Function: DataSet::p_read_fixed_len (private) -// brief Reads a fixed length \a H5std_string from a dataset. -// param mem_type - IN: DataSet datatype (in memory) -// param strg - IN: Buffer for read string -// exceptio n H5::DataSetIException -// Modification -// Jul 2009 -// Added in follow to the change in Attribute::read -//-------------------------------------------------------------------------- -void -DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, - const hid_t xfer_plist_id, H5std_string &strg) const -{ - // Only allocate for fixed-len string. - - // Get the size of the dataset's data - size_t data_size = getInMemDataSize(); - - // If there is data, allocate buffer and read it. - if (data_size > 0) { - // Create buffer for C string - char *strg_C = new char[data_size + 1](); - - herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, strg_C); - - if (ret_value < 0) { - delete[] strg_C; // de-allocate for fixed-len string - throw DataSetIException("DataSet::read", "H5Dread failed for fixed length string"); - } - - // Get string from the C char* and release resource allocated locally - strg = strg_C; - delete[] strg_C; - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet::p_read_variable_len (private) -// brief Reads a variable length \a H5std_string from an dataset. -// param mem_type - IN: DataSet datatype (in memory) -// param strg - IN: Buffer for read string -// exception H5::DataSetIException -// Modification -// Jul 2009 -// Added in follow to the change in Attribute::read -//-------------------------------------------------------------------------- -void -DataSet::p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, - const hid_t xfer_plist_id, H5std_string &strg) const -{ - // Prepare and call C API to read dataset. - char *strg_C; - - // Read dataset, no allocation for variable-len string; C library will - herr_t ret_value = H5Dread(id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, &strg_C); - - if (ret_value < 0) { - throw DataSetIException("DataSet::read", "H5Dread failed for variable length string"); - } - - // Get string from the C char* and release resource allocated by C API - strg = strg_C; - free(strg_C); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: DataSet::p_setId (protected) -///\brief Sets the identifier of this dataset to a new value. -/// -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails -// Description: -// The underlying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. -//-------------------------------------------------------------------------- -void -DataSet::p_setId(const hid_t new_id) -{ - // handling references to this old id - try { - close(); - } - catch (Exception &close_error) { - throw DataSetIException(inMemFunc("p_setId"), close_error.getDetailMsg()); - } - // reset object's id to the given id - id = new_id; -} - -//-------------------------------------------------------------------------- -// Function: f_PropList_setId - friend -// Purpose: This function is friend to class H5::PropList so that it -// can set PropList::id in order to work around a problem -// described in the JIRA issue HDFFV-7947. -// Applications shouldn't need to use it. -// param dset - IN/OUT: DataSet object to be changed -// param new_id - IN: New id to set -//-------------------------------------------------------------------------- -void -f_PropList_setId(PropList *plist, hid_t new_id) -{ - plist->p_setId(new_id); -} - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: DataSet::close -///\brief Closes this dataset. -/// -///\exception H5::DataSetIException -//-------------------------------------------------------------------------- -void -DataSet::close() -{ - if (p_valid_id(id)) { - herr_t ret_value = H5Dclose(id); - if (ret_value < 0) { - throw DataSetIException("DataSet::close", "H5Dclose failed"); - } - // reset the id - id = H5I_INVALID_HID; - } -} - -//-------------------------------------------------------------------------- -// Function: DataSet destructor -///\brief Properly terminates access to this dataset. -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -DataSet::~DataSet() -{ - try { - close(); - } - catch (Exception &close_error) { - cerr << "DataSet::~DataSet - " << close_error.getDetailMsg() << endl; - } -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5DataSpace.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5DataSpace.cpp deleted file mode 100644 index e4aef837e0..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5DataSpace.cpp +++ /dev/null @@ -1,693 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5DataSpace.h" - -namespace H5 { -using std::cerr; -using std::endl; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control -// the order of creation and deletion of the global constants. See Design Notes -// in "H5PredType.cpp" for information. - -// Initialize a pointer for the constant -DataSpace *DataSpace::ALL_ = 0; - -//-------------------------------------------------------------------------- -// Function: DataSpace::getConstant -// Creates a DataSpace object representing the HDF5 constant -// H5S_ALL, pointed to by DataSpace::ALL_ -// Exception H5::DataSpaceIException -// Description -// If DataSpace::ALL_ already points to an allocated object, throw -// a DataSpaceIException. This scenario should not happen. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -DataSpace * -DataSpace::getConstant() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the constant pointer is not allocated, allocate it. Otherwise, - // throw because it shouldn't be. - if (ALL_ == 0) - ALL_ = new DataSpace(H5S_ALL); - else - throw DataSpaceIException("DataSpace::getConstant", - "DataSpace::getConstant is being invoked on an allocated ALL_"); - return (ALL_); -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::deleteConstants -// Purpose: Deletes the constant object that DataSpace::ALL_ points to -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -DataSpace::deleteConstants() -{ - delete ALL_; -} - -//-------------------------------------------------------------------------- -// Purpose Constant for default dataspace. -//-------------------------------------------------------------------------- -const DataSpace &DataSpace::ALL = *getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: DataSpace constructor -///\brief Creates a new dataspace given a dataspace type. -///\param type - IN: Type of the dataspace to be created, which -/// currently can be either \c H5S_SCALAR or \c H5S_SIMPLE; -/// default to \c H5S_SCALAR. -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataSpace::DataSpace(H5S_class_t type) : IdComponent(), id{H5Screate(type)} -{ - if (id < 0) { - throw DataSpaceIException("DataSpace constructor", "H5Screate failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace overloaded constructor -///\brief Creates a new simple dataspace. -///\param rank - IN: Number of dimensions of dataspace. -///\param dims - IN: An array of the size of each dimension. -///\param maxdims - IN: An array of the maximum size of each dimension. -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataSpace::DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims) - : IdComponent(), id{H5Screate_simple(rank, dims, maxdims)} -{ - if (id < 0) { - throw DataSpaceIException("DataSpace constructor", "H5Screate_simple failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace overloaded constructor -///\brief Creates a DataSpace object using the id of an existing -/// dataspace. -///\param existing_id - IN: Id of an existing dataspace -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataSpace::DataSpace(const hid_t existing_id) : IdComponent(), id(existing_id) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: DataSpace copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param original - IN: DataSpace object to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataSpace::DataSpace(const DataSpace &original) : IdComponent(), id(original.id) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::copy -///\brief Makes a copy of an existing dataspace. -///\param like_space - IN: Dataspace to be copied -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -void -DataSpace::copy(const DataSpace &like_space) -{ - // If this object has an hdf5 valid id, close it - if (id != H5S_ALL) { - try { - close(); - } - catch (Exception &close_error) { - throw DataSpaceIException("DataSpace::copy", close_error.getDetailMsg()); - } - } // end if - - // call C routine to copy the dataspace - id = H5Scopy(like_space.getId()); - - if (id < 0) - throw DataSpaceIException("DataSpace::copy", "H5Scopy failed"); -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::operator= -///\brief Assignment operator. -///\param rhs - IN: Reference to the existing dataspace -///\return Reference to DataSpace instance -///\exception H5::DataSpaceIException -// Description -// Makes a copy of the type on the right hand side and stores -// the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataSpace & -DataSpace::operator=(const DataSpace &rhs) -{ - if (this != &rhs) - copy(rhs); - return (*this); -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::isSimple -///\brief Determines whether this dataspace is a simple dataspace. -///\return \c true if the dataspace is a simple dataspace, and \c false, -/// otherwise -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -bool -DataSpace::isSimple() const -{ - htri_t simple = H5Sis_simple(id); - if (simple > 0) - return true; - else if (simple == 0) - return false; - else { - throw DataSpaceIException("DataSpace::isSimple", "H5Sis_simple returns negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::offsetSimple -///\brief Sets the offset of this simple dataspace. -///\param offset - IN: Offset to position the selection at -///\exception H5::DataSpaceIException -///\par Description -/// This function creates an offset for the selection within -/// an extent, allowing the same shaped selection to be moved -/// to different locations within a dataspace without requiring -/// it to be re-defined. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::offsetSimple(const hssize_t *offset) const -{ - herr_t ret_value = H5Soffset_simple(id, offset); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::offsetSimple", "H5Soffset_simple failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getSimpleExtentDims -///\brief Retrieves dataspace dimension size and maximum size. -///\param dims - IN: Name of the new member -///\param maxdims - IN: Pointer to the value of the new member -///\return Number of dimensions, the same value as returned by -/// \c DataSpace::getSimpleExtentNdims() -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -DataSpace::getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims) const -{ - int ndims = H5Sget_simple_extent_dims(id, dims, maxdims); - if (ndims < 0) { - throw DataSpaceIException("DataSpace::getSimpleExtentDims", - "H5Sget_simple_extent_dims returns negative number of dimensions"); - } - return (ndims); -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getSimpleExtentNdims -///\brief Returns the dimensionality of a dataspace. -///\return Number of dimensions -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -DataSpace::getSimpleExtentNdims() const -{ - int ndims = H5Sget_simple_extent_ndims(id); - if (ndims < 0) { - throw DataSpaceIException( - "DataSpace::getSimpleExtentNdims", - "H5Sget_simple_extent_ndims returns negative value for dimensionality of the dataspace"); - } - return (ndims); -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getSimpleExtentNpoints -///\brief Returns the number of elements in a dataspace. -///\return Number of elements -///\exception H5::DataSpaceIException -// Modification -// 12/05/00: due to C API change -// return type hssize_t vs. hsize_t -// num_elements = -1 when failure occurs vs. 0 -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -hssize_t -DataSpace::getSimpleExtentNpoints() const -{ - hssize_t num_elements = H5Sget_simple_extent_npoints(id); - if (num_elements > -1) - return (num_elements); - else { - throw DataSpaceIException("DataSpace::getSimpleExtentNpoints", - "H5Sget_simple_extent_npoints returns negative value for the number of " - "elements in the dataspace"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getSimpleExtentType -///\brief Returns the current class of a dataspace. -///\return Class of the dataspace -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5S_class_t -DataSpace::getSimpleExtentType() const -{ - H5S_class_t class_name = H5Sget_simple_extent_type(id); - if (class_name == H5S_NO_CLASS) { - throw DataSpaceIException("DataSpace::getSimpleExtentType", - "H5Sget_simple_extent_type returns H5S_NO_CLASS"); - } - return (class_name); -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::extentCopy -///\brief Copies the extent of a dataspace. -///\param dest_space - IN: Dataspace to copy from -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::extentCopy(const DataSpace &dest_space) const -{ - hid_t dest_space_id = dest_space.getId(); - herr_t ret_value = H5Sextent_copy(dest_space_id, id); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::extentCopy", "H5Sextent_copy failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::extentCopy -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const. This wrapper will be removed in future release. -// Param dest_space - IN: Dataspace to copy from -// Exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -// Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 -//-------------------------------------------------------------------------- -// void DataSpace::extentCopy(DataSpace& dest_space) const -//{ -// extentCopy(dest_space); -//} - -//-------------------------------------------------------------------------- -// Function: DataSpace::setExtentSimple -///\brief Sets or resets the size of an existing dataspace. -///\param rank - IN: Rank of the dataspace -///\param current_size - IN: Array containing current size of dataspace -///\param maximum_size - IN: Array containing maximum size of dataspace -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size) const -{ - herr_t ret_value; - ret_value = H5Sset_extent_simple(id, rank, current_size, maximum_size); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::setExtentSimple", "H5Sset_extent_simple failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::setExtentNone -///\brief Removes the extent from a dataspace. -/// -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::setExtentNone() const -{ - herr_t ret_value = H5Sset_extent_none(id); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::setExtentNone", "H5Sset_extent_none failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getSelectNpoints -///\brief Returns the number of elements in a dataspace selection. -///\return Number of elements -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -hssize_t -DataSpace::getSelectNpoints() const -{ - hssize_t num_elements = H5Sget_select_npoints(id); - if (num_elements < 0) { - throw DataSpaceIException( - "DataSpace::getSelectNpoints", - "H5Sget_select_npoints returns negative value for number of elements in the dataspace selection"); - } - return (num_elements); -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getSelectHyperNblocks -///\brief Returns number of hyperslab blocks. -///\return Number of hyperslab blocks -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -hssize_t -DataSpace::getSelectHyperNblocks() const -{ - hssize_t num_blocks = H5Sget_select_hyper_nblocks(id); - if (num_blocks < 0) { - throw DataSpaceIException( - "DataSpace::getSelectHyperNblocks", - "H5Sget_select_hyper_nblocks returns negative value for the number of hyperslab blocks"); - } - return (num_blocks); -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getSelectHyperBlocklist -///\brief Gets the list of hyperslab blocks currently selected -///\param startblock - IN: Hyperslab block to start with -///\param numblocks - IN: Number of hyperslab blocks to get -///\param buf - IN: List of hyperslab blocks selected -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const -{ - herr_t ret_value; - ret_value = H5Sget_select_hyper_blocklist(id, startblock, numblocks, buf); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::getSelectHyperBlocklist", - "H5Sget_select_hyper_blocklist failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getSelectElemNpoints -///\brief Returns the number of element points in the current selection. -///\return Number of element points -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -hssize_t -DataSpace::getSelectElemNpoints() const -{ - hssize_t num_points = H5Sget_select_elem_npoints(id); - if (num_points < 0) { - throw DataSpaceIException("DataSpace::getSelectElemNpoints", "H5Sget_select_elem_npoints failed"); - } - return (num_points); -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getSelectElemPointlist -///\brief Gets the list of element points currently selected -///\param startpoint - IN: Element point to start with -///\param numpoints - IN: Number of element points to get -///\param buf - IN: List of element points selected -///\exception H5::DataSpaceIException -///\par Description -/// For information, please refer to the C API -/// H5Sget_select_elem_pointlist in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const -{ - herr_t ret_value; - ret_value = H5Sget_select_elem_pointlist(id, startpoint, numpoints, buf); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::getSelectElemPointlist", "H5Sget_select_elem_pointlist failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getSelectBounds -///\brief Gets the bounding box containing the current selection. -///\param start - IN: Starting coordinates of the bounding box -///\param end - IN: Ending coordinates of the bounding box, i.e., -/// the coordinates of the diagonally opposite corner -///\exception H5::DataSpaceIException -///\par Description -/// For information, please refer to the H5Sget_select_bounds API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::getSelectBounds(hsize_t *start, hsize_t *end) const -{ - herr_t ret_value = H5Sget_select_bounds(id, start, end); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::getSelectBounds", "H5Sget_select_bounds failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::selectElements -///\brief Selects array elements to be included in the selection for -/// this dataspace. -///\param op - IN: Operator specifying how the new selection is to be -/// combined with the existing selection for the dataspace -///\param num_elements - IN: Number of elements to be selected -///\param coord - IN: A 2-dimensional array of 0-based values -/// specifying the coordinates of the elements being selected -///\exception H5::DataSpaceIException -///\par Description -/// For information, please refer to the H5Sselect_elements API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const -{ - herr_t ret_value; - ret_value = H5Sselect_elements(id, op, num_elements, coord); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::selectElements", "H5Sselect_elements failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::selectAll -///\brief Selects the entire dataspace. -/// -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::selectAll() const -{ - herr_t ret_value = H5Sselect_all(id); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::selectAll", "H5Sselect_all failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::selectNone -///\brief Resets the selection region to include no elements. -/// -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::selectNone() const -{ - herr_t ret_value = H5Sselect_none(id); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::selectNone", "H5Sselect_none failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::selectValid -///\brief Verifies that the selection is within the extent of the -/// dataspace. -///\return \c true if the selection is within the extent of the -/// dataspace, and \c false, otherwise -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -bool -DataSpace::selectValid() const -{ - htri_t ret_value = H5Sselect_valid(id); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else { - throw DataSpaceIException("DataSpace::selectValid", "H5Sselect_valid returns negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::selectHyperslab -///\brief Selects a hyperslab region to add to the current selected region. -///\param op - IN: Operation to perform on current selection -///\param count - IN: Number of blocks included in the hyperslab -///\param start - IN: Offset of the start of hyperslab -///\param stride - IN: Hyperslab stride - default to \c NULL -///\param block - IN: Size of block in the hyperslab - default to \c NULL -///\exception H5::DataSpaceIException -///\par Description -/// For information, please refer to the H5Sselect_hyperslab API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, - const hsize_t *stride, const hsize_t *block) const -{ - herr_t ret_value; - ret_value = H5Sselect_hyperslab(id, op, start, stride, count, block); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::selectHyperslab", "H5Sselect_hyperslab failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace::getId -///\brief Get the id of this dataspace -///\return Dataspace identifier -// Modification: -// May 2008 - BMR -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 -//-------------------------------------------------------------------------- -hid_t -DataSpace::getId() const -{ - return (id); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: DataSpace::p_setId -///\brief Sets the identifier of this object to a new value. -/// -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails -// Description: -// The underlying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataSpace::p_setId(const hid_t new_id) -{ - // handling references to this old id - try { - close(); - } - catch (Exception &close_error) { - throw DataSpaceIException(inMemFunc("p_setId"), close_error.getDetailMsg()); - } - // reset object's id to the given id - id = new_id; -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: DataSpace::close -///\brief Closes this dataspace. -/// -///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 -//-------------------------------------------------------------------------- -void -DataSpace::close() -{ - // check if id is a valid hdf5 object id before trying to close it - if (p_valid_id(id)) { - herr_t ret_value = H5Sclose(id); - if (ret_value < 0) { - throw DataSpaceIException("DataSpace::close", "H5Sclose failed"); - } - // reset the id - id = H5I_INVALID_HID; - } -} - -//-------------------------------------------------------------------------- -// Function: DataSpace destructor -///\brief Properly terminates access to this dataspace. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -DataSpace::~DataSpace() -{ - try { - close(); - } - catch (Exception &close_error) { - cerr << "DataSpace::~DataSpace - " << close_error.getDetailMsg() << endl; - } -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5DataType.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5DataType.cpp deleted file mode 100644 index d889f135c9..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5DataType.cpp +++ /dev/null @@ -1,1005 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5DataSpace.h" -#include "H5PropList.h" -#include "H5FaccProp.h" -#include "H5FcreatProp.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5DxferProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5AtomType.h" -#include "H5PredType.h" -#include "H5AbstractDs.h" -#include "H5DataSet.h" -#include "H5Attribute.h" - -namespace H5 { -using std::cerr; -using std::endl; - -//-------------------------------------------------------------------------- -// Function: DataType default constructor -///\brief Default constructor: Creates a stub datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataType::DataType() : H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0) -{ -} - -//-------------------------------------------------------------------------- -// Function: DataType overloaded constructor -///\brief Creates a datatype using an existing datatype's id -///\param existing_id - IN: Id of the existing datatype -// Description -// Constructor creates a copy of an existing DataType using -// its id. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// Dec, 2005 -// Removed second argument, "predefined", after changing to the -// new ref counting mechanism that relies on C's ref counting. -//-------------------------------------------------------------------------- -DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id), encoded_buf(NULL), buf_size(0) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: DataType overloaded constructor -///\brief Creates a object given its class and size -///\param type_class - IN: Class of datatype to create -///\param size - IN: Number of bytes in the datatype to create -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataType::DataType(const H5T_class_t type_class, size_t size) - : H5Object(), id{H5Tcreate(type_class, size)}, encoded_buf(NULL), buf_size(0) -{ - if (id < 0) { - throw DataTypeIException("DataType constructor", "H5Tcreate failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 group, creates a -/// DataType object -///\param loc - IN: Location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -//-------------------------------------------------------------------------- -DataType::DataType(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist) - : H5Object(), id{H5Location::p_dereference(loc.getId(), ref, ref_type, plist, - "constructor - by dereference")}, - encoded_buf(NULL), buf_size(0) -{ -} - -//-------------------------------------------------------------------------- -// Function: DataType overload constructor - dereference -// brief Given a reference, ref, to an hdf5 group, creates a -// DataType object -// param attr - IN: Specifying location where the referenced object is in -// param ref - IN: Reference pointer -// param ref_type - IN: Reference type - default to H5R_OBJECT -// param plist - IN: Property list - default to PropList::DEFAULT -// exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// Jul, 2008 -// Added for application convenience. -//-------------------------------------------------------------------------- -/* DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& plist) : -H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0) -{ - id = H5Location::p_dereference(attr.getId(), ref, ref_type, plist, "constructor - by dereference"); -} -*/ - -//-------------------------------------------------------------------------- -// Function: DataType copy constructor -///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataType::DataType(const DataType &original) : H5Object(), id(original.id), encoded_buf(NULL), buf_size(0) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: DataType overloaded constructor -///\brief Creates a DataType instance using a predefined type -///\param pred_type - IN: Predefined datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2015 -// Description -// Copying the type so that when a predefined type is passed in, -// a copy of it is made, not just a duplicate of the HDF5 id. -// Note: calling DataType::copy will invoke DataType::close() -// unnecessarily and will produce undefined behavior. -// -BMR, Apr 2015 -//-------------------------------------------------------------------------- -DataType::DataType(const PredType &pred_type) - : H5Object(), id{H5Tcopy(pred_type.getId())}, encoded_buf(NULL), buf_size(0) -{ - if (id < 0) - throw DataTypeIException("DataType constructor", "H5Tcopy failed"); -} - -//-------------------------------------------------------------------------- -// Function: DataType overloaded constructor -///\brief Creates a DataType instance by opening an HDF5 datatype given -/// its name as a char*. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Datatype name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openDataType(const char*) to -// improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -DataType::DataType(const H5Location &loc, const char *dtype_name) - : H5Object(), id{p_opentype(loc, dtype_name)}, encoded_buf(NULL), buf_size(0) -{ -} - -//-------------------------------------------------------------------------- -// Function: DataType overloaded constructor -///\brief Creates a DataType instance by opening an HDF5 datatype given -/// its name as an \c H5std_string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Datatype name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openDataType(const H5std_string&) to -// improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -DataType::DataType(const H5Location &loc, const H5std_string &dtype_name) - : H5Object(), id{p_opentype(loc, dtype_name.c_str())}, encoded_buf(NULL), buf_size(0) -{ -} - -//-------------------------------------------------------------------------- -// Function: DataType::copy -///\brief Copies an existing datatype to this datatype object -///\param like_type - IN: Datatype to be copied -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -void -DataType::copy(const DataType &like_type) -{ - // close the current data type before copying like_type to this object - try { - close(); - } - catch (Exception &close_error) { - throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg()); - } - - // call C routine to copy the datatype - id = H5Tcopy(like_type.getId()); - if (id < 0) - throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed"); -} - -//-------------------------------------------------------------------------- -// Function: DataType::copy -///\brief Copies the datatype of the given dataset to this datatype object -///\param dset - IN: Dataset -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 -///\par Description -/// The resulted dataset will be transient and modifiable. -//-------------------------------------------------------------------------- -void -DataType::copy(const DataSet &dset) -{ - // close the current data type before copying dset's datatype to this object - try { - close(); - } - catch (Exception &close_error) { - throw DataTypeIException(inMemFunc("copy"), close_error.getDetailMsg()); - } - - // call C routine to copy the datatype - id = H5Tcopy(dset.getId()); - if (id < 0) - throw DataTypeIException(inMemFunc("copy"), "H5Tcopy failed"); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: DataType::p_decode -// Purpose Returns an id of a type by decoding the binary object -/// description of this datatype. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -hid_t -DataType::p_decode() const -{ - // Make sure that the buffer can be decoded - if (encoded_buf == NULL) { - throw DataTypeIException("DataType::p_decode", "No encoded buffer"); - } - - // Call C function to decode the binary object description - hid_t encoded_dtype_id = H5Tdecode(encoded_buf); - - // If H5Tdecode fails, raise exception - if (encoded_dtype_id < 0) { - throw DataTypeIException("DataType::p_decode", "H5Tdecode failed"); - } - else { - return (encoded_dtype_id); - } -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: DataType::decode -///\brief Returns a DataType instance by decoding the binary object -/// description of this datatype. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -DataType * -DataType::decode() const -{ - hid_t encoded_dtype_id = H5I_INVALID_HID; - try { - encoded_dtype_id = p_decode(); - } - catch (DataTypeIException &err) { - throw; - } - DataType *encoded_dtype = new DataType; - encoded_dtype->p_setId(encoded_dtype_id); - return (encoded_dtype); -} - -//-------------------------------------------------------------------------- -// Function: DataType::encode -///\brief Creates a binary object description of this datatype. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -void -DataType::encode() -{ - // Call H5Tencode passing in null to determine the size of the buffer - herr_t ret_value = H5Tencode(id, NULL, &buf_size); - if (ret_value < 0) { - throw DataTypeIException("DataType::encode", "Failed to get buf_size"); - } - - // Allocate buffer and call C function again to encode - if (buf_size > 0) { - encoded_buf = new unsigned char[buf_size](); - - ret_value = H5Tencode(id, encoded_buf, &buf_size); - if (ret_value < 0) { - throw DataTypeIException("DataType::encode", "H5Tencode failed"); - } - } - else { - throw DataTypeIException("DataType::encode", "Failed to allocate buffer for encoding"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::hasBinaryDesc -///\brief Determines whether this datatype has a binary object -/// description. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -bool -DataType::hasBinaryDesc() const -{ - return encoded_buf != NULL; -} - -//-------------------------------------------------------------------------- -// Function: DataType::operator= -///\brief Assignment operator -///\param rhs - IN: Reference to the existing datatype -///\return Reference to DataType instance -///\exception H5::DataTypeIException -// Description -// Makes a copy of the type on the right hand side and stores -// the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// Changed operator= to simply copy the id of rhs instead of -// calling H5Tcopy because, when the operator= is invoked, a -// different datatype id is created and it won't have the same -// characteristics as the original one, specifically, if the -// rhs represents a named datatype, "this" would still be a -// transient datatype. -// BMR - Mar, 2015 -//-------------------------------------------------------------------------- -DataType & -DataType::operator=(const DataType &rhs) -{ - if (this != &rhs) { - setId(rhs.id); - } - return (*this); -} - -//-------------------------------------------------------------------------- -// Function: DataType::operator== -///\brief Compares this DataType against the given one to determines -/// whether the two objects refer to the same actual datatype. -///\param compared_type - IN: Reference to the datatype to compare -///\return true if the datatypes are equal, and false, otherwise. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -bool -DataType::operator==(const DataType &compared_type) const -{ - // Call C routine H5Tequal to determines whether two datatype - // identifiers refer to the same datatype - htri_t ret_value = H5Tequal(id, compared_type.getId()); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else { - throw DataTypeIException(inMemFunc("operator=="), "H5Tequal returns negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::operator!= -///\brief Compares this DataType against the given one to determines -/// whether the two objects refer to different actual datatypes. -///\param compared_type - IN: Reference to the datatype to compare -///\return true if the datatypes are not equal, and false, otherwise. -///\exception H5::DataTypeIException -// July, 2018 -//-------------------------------------------------------------------------- -bool -DataType::operator!=(const DataType &compared_type) const -{ - return !operator==(compared_type); -} - -//-------------------------------------------------------------------------- -// Function: DataType::p_commit (private) -//\brief Commits a transient datatype to a file, creating a new -// named datatype -//\param loc_id - IN: The id of either a file, group, dataset, named -// datatype, or attribute. -//\param name - IN: Name of the datatype -//\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -// Modification: -// Copied from DataType::commit and made into private function -// to be commonly used by several overloads of DataType::commit. -// BMR - Jan, 2007 -//-------------------------------------------------------------------------- -void -DataType::p_commit(hid_t loc_id, const char *name) -{ - // Call C routine to commit the transient datatype - herr_t ret_value = H5Tcommit2(loc_id, name, id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - if (ret_value < 0) - throw DataTypeIException(inMemFunc("p_commit"), "H5Tcommit2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: DataType::commit -///\brief Commits a transient datatype to a file, creating a new -/// named datatype -///\param loc - IN: A location (file, dataset, datatype, or group) -///\param name - IN: Name of the datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 -//-------------------------------------------------------------------------- -void -DataType::commit(const H5Location &loc, const char *name) -{ - p_commit(loc.getId(), name); -} - -//-------------------------------------------------------------------------- -// Function: DataType::commit -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Param loc - IN: A location (file, dataset, datatype, or group) -// Param name - IN: Name of the datatype -// Exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 -// Modification -// Planned for removal. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 -//-------------------------------------------------------------------------- -// void DataType::commit(H5Location& loc, const char* name) -//{ -// p_commit(loc.getId(), name); -//} - -//-------------------------------------------------------------------------- -// Function: DataType::commit -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of the -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataType::commit(const H5Location &loc, const H5std_string &name) -{ - p_commit(loc.getId(), name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: DataType::commit -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Param loc - IN: A location (file, dataset, datatype, or group) -// Param name - IN: Name of the datatype -// Exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 -// Modification -// Planned for removal. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 -//-------------------------------------------------------------------------- -// void DataType::commit(H5Location& loc, const H5std_string& name) -//{ -// p_commit(loc.getId(), name.c_str()); -//} - -//-------------------------------------------------------------------------- -// Function: DataType::committed -///\brief Determines whether a datatype is a named type or a -/// transient type. -///\return \c true if the datatype is a named type, and \c false, -/// otherwise. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -bool -DataType::committed() const -{ - // Call C function to determine if a datatype is a named one - htri_t is_committed = H5Tcommitted(id); - if (is_committed > 0) - return true; - else if (is_committed == 0) - return false; - else { - throw DataTypeIException(inMemFunc("committed"), "H5Tcommitted return negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::find -///\brief Finds a conversion function that can handle a conversion -/// from this datatype to the specified datatype, \a dest. -///\param dest - IN: Destination datatype -///\param pcdata - IN: Pointer to type conversion data -///\return Pointer to a suitable conversion function -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5T_conv_t -DataType::find(const DataType &dest, H5T_cdata_t **pcdata) const -{ - // Call C routine to find the conversion function - H5T_conv_t func = H5Tfind(id, dest.getId(), pcdata); - if (func == NULL) { - throw DataTypeIException(inMemFunc("find"), "H5Tfind returns a NULL function"); - } - return (func); -} - -//-------------------------------------------------------------------------- -// Function: DataType::convert -///\brief Converts data from this datatype to the specified datatypes. -///\param dest - IN: Destination datatype -///\param nelmts - IN: Size of array \a buf -///\param buf - IN/OUT: Array containing pre- and post-conversion -/// values -///\param background - IN: Optional background buffer -///\param plist - IN: Property list - default to PropList::DEFAULT -///\return Pointer to a suitable conversion function -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataType::convert(const DataType &dest, size_t nelmts, void *buf, void *background, - const PropList &plist) const -{ - // Get identifiers for C API - hid_t dest_id = dest.getId(); - hid_t plist_id = plist.getId(); - - // Call C routine H5Tconvert to convert the data - herr_t ret_value; - ret_value = H5Tconvert(id, dest_id, nelmts, buf, background, plist_id); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("convert"), "H5Tconvert failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::lock -///\brief Locks a datatype, making it read-only and non-destructible. -/// -///\exception H5::DataTypeIException -///\par Description -/// This is normally done by the library for predefined data -/// types so the application doesn't inadvertently change or -/// delete a predefined type. -/// -/// Once a data type is locked it can never be unlocked unless -/// the entire library is closed. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataType::lock() const -{ - // Call C routine to lock the datatype - herr_t ret_value = H5Tlock(id); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("lock"), "H5Tlock failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::getClass -///\brief Returns the datatype class identifier. -///\return Datatype class identifier -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5T_class_t -DataType::getClass() const -{ - H5T_class_t type_class = H5Tget_class(id); - - // Return datatype class identifier if successful - if (type_class == H5T_NO_CLASS) { - throw DataTypeIException(inMemFunc("getClass"), "H5Tget_class returns H5T_NO_CLASS"); - } - return (type_class); -} - -//-------------------------------------------------------------------------- -// Function: DataType::getSize -///\brief Returns the size of a datatype. -///\return Datatype size in bytes -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -size_t -DataType::getSize() const -{ - // Call C routine to get the datatype size - size_t type_size = H5Tget_size(id); - if (type_size <= 0) // valid data types are never zero size - { - throw DataTypeIException(inMemFunc("getSize"), "H5Tget_size returns invalid datatype size"); - } - return (type_size); -} - -//-------------------------------------------------------------------------- -// Function: DataType::getSuper -///\brief Returns the base datatype from which a datatype is derived. -///\return DataType object -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DataType -DataType::getSuper() const -{ - // Call C routine to get the base datatype from which the specified - // datatype is derived. - hid_t base_type_id = H5Tget_super(id); - - // If H5Tget_super returns a valid datatype id, create and return - // the base type, otherwise, raise exception - if (base_type_id > 0) { - DataType base_type; - base_type.p_setId(base_type_id); - return (base_type); - } - else { - throw DataTypeIException(inMemFunc("getSuper"), "H5Tget_super failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::registerFunc -///\brief Registers the specified conversion function. -///\param pers - IN: Conversion option -/// \li \c H5T_PERS_HARD for hard conversion functions -/// \li \c H5T_PERS_SOFT for soft conversion functions. -///\param name - IN: Name displayed in diagnostic output. -///\param dest - IN: Destination datatype. -///\param func - IN: Function to convert between source and -/// destination datatypes. -///\exception H5::DataTypeIException -///\par Description -/// For information, please refer to the H5Tregister API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataType::registerFunc(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const -{ - hid_t dest_id = dest.getId(); // get id of the destination datatype - - // Call C routine H5Tregister to register the conversion function - herr_t ret_value = H5Tregister(pers, name, id, dest_id, func); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("registerFunc"), "H5Tregister failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::registerFunc -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of the -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataType::registerFunc(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const -{ - registerFunc(pers, name.c_str(), dest, func); -} - -//-------------------------------------------------------------------------- -// Function: DataType::unregister -///\brief Removes a conversion function from all conversion paths. -///\param pers - IN: Conversion option -/// \li \c H5T_PERS_HARD for hard conversion functions -/// \li \c H5T_PERS_SOFT for soft conversion functions. -///\param name - IN: Name displayed in diagnostic output. -///\param dest - IN: Destination datatype. -///\param func - IN: Function to convert between source and -/// destination datatypes. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataType::unregister(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const -{ - hid_t dest_id = dest.getId(); // get id of the dest datatype for C API - - // Call C routine H5Tunregister to remove the conversion function - herr_t ret_value = H5Tunregister(pers, name, id, dest_id, func); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("unregister"), "H5Tunregister failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::unregister -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of the -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataType::unregister(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const -{ - unregister(pers, name.c_str(), dest, func); -} - -//-------------------------------------------------------------------------- -// Function: DataType::setTag -///\brief Tags an opaque datatype. -///\param tag - IN: Descriptive ASCII string with which the opaque -/// datatype is to be tagged. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataType::setTag(const char *tag) const -{ - // Call C routine H5Tset_tag to tag an opaque datatype. - herr_t ret_value = H5Tset_tag(id, tag); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("setTag"), "H5Tset_tag failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::setTag -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of the -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataType::setTag(const H5std_string &tag) const -{ - setTag(tag.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: DataType::getTag -///\brief Gets the tag associated with an opaque datatype. -///\return Tag associated with the opaque datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string -DataType::getTag() const -{ - char *tag_Cstr = H5Tget_tag(id); - - // if the tag C-string returned is not NULL, convert it to C++ string - // and return it, otherwise, raise an exception - if (tag_Cstr != NULL) { - H5std_string tag = H5std_string(tag_Cstr); // C string to string object - H5free_memory(tag_Cstr); // free the C string - return (tag); // return the tag - } - else { - throw DataTypeIException(inMemFunc("getTag"), "H5Tget_tag returns NULL for tag"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::detectClass -///\brief Checks whether a datatype contains (or is) a certain type of -/// datatype. -///\return true if this datatype contains or is the specified type, -/// and false, otherwise. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -bool -DataType::detectClass(H5T_class_t cls) const -{ - htri_t ret_value = H5Tdetect_class(id, cls); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else { - throw DataTypeIException(inMemFunc("detectClass"), "H5Tdetect_class returns negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::detectClass (static) -///\brief Checks whether a predtype is a certain class of datatype. -///\return true if this predtype is the specified type class, and false, -/// otherwise. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - August, 2017 -//-------------------------------------------------------------------------- -bool -DataType::detectClass(const PredType &pred_type, H5T_class_t cls) -{ - htri_t ret_value = H5Tdetect_class(pred_type.getId(), cls); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else { - throw DataTypeIException("detectClass on PredType", "H5Tdetect_class returns negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::isVariableStr -///\brief Check whether this datatype is a variable-length string. -///\return true if this datatype is a variable-length string, and -/// false, otherwise. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -bool -DataType::isVariableStr() const -{ - htri_t is_varlen_str = H5Tis_variable_str(id); - if (is_varlen_str == 1) - return true; - else if (is_varlen_str == 0) - return false; - else { - throw DataTypeIException(inMemFunc("isVariableStr"), "H5Tis_variable_str returns negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: DataType::getCreatePlist -///\brief Returns a copy of the property list, which is for datatype -/// creation. -///\return A property list object -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - March, 2017 -// Description -// Currently, there is no datatype creation property list class -// in the C++ API because there is no associated functionality. -//-------------------------------------------------------------------------- -PropList -DataType::getCreatePlist() const -{ - hid_t create_plist_id = H5Tget_create_plist(id); - if (create_plist_id < 0) { - throw DataTypeIException(inMemFunc("getCreatePlist"), "H5Tget_create_plist returns negative value"); - } - // create and return the DSetCreatPropList object - PropList create_plist; - f_PropList_setId(&create_plist, create_plist_id); - return (create_plist); -} - -//-------------------------------------------------------------------------- -// Function: DataType::getId -///\brief Get the id of this datatype -///\return Datatype identifier -// Modification: -// May 2008 - BMR -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 -//-------------------------------------------------------------------------- -hid_t -DataType::getId() const -{ - return (id); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: DataType::p_opentype (private) -///\brief Opens an HDF5 datatype given its name -///\param loc - IN: Location of the type -///\param dtype_name - IN: Datatype name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// This function was introduced in 1.10.1 to be used by the new -// XxxType constructors that open a datatype. -BMR, Dec 2016 -//-------------------------------------------------------------------------- -hid_t -DataType::p_opentype(const H5Location &loc, const char *dtype_name) const -{ - // Call C function to open the named datatype at this location - hid_t ret_value = H5Topen2(loc.getId(), dtype_name, H5P_DEFAULT); - if (ret_value < 0) - throw DataTypeIException(inMemFunc("constructor"), "H5Topen2 failed"); - return (ret_value); -} - -//-------------------------------------------------------------------------- -// Function: DataType::p_setId -///\brief Sets the identifier of this object to a new value. -/// -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails -// Description: -// The underlying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DataType::p_setId(const hid_t new_id) -{ - // handling references to this old id - try { - close(); - } - catch (Exception &close_error) { - throw DataTypeIException(inMemFunc("p_setId"), close_error.getDetailMsg()); - } - // reset object's id to the given id - id = new_id; -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: DataType::close -///\brief Closes the datatype if it is not a predefined type. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 -//-------------------------------------------------------------------------- -void -DataType::close() -{ - if (p_valid_id(id)) { - herr_t ret_value = H5Tclose(id); - if (ret_value < 0) { - throw DataTypeIException(inMemFunc("close"), "H5Tclose failed"); - } - // Reset the id - id = H5I_INVALID_HID; - - // Free and reset buffer of encoded object description if it's been used - if (encoded_buf != NULL) { - delete[] encoded_buf; - buf_size = 0; - } - } -} - -//-------------------------------------------------------------------------- -// Function: DataType destructor -///\brief Properly terminates access to this datatype. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -// - Added the use of H5CPP_EXITED to terminate the HDF5 library -// and eliminate previous memory leaks. See comments in the -// header file "H5PredType.h" for details. - BMR, Mar 30, 2012 -// - Major re-implementation of the global constants was done -// to avoid relying on the order of the creation and deletion -// of the global constants. Hence, H5CPP_EXITED was removed. -// See Design Notes in "H5PredType.cpp" for details. -// - BMR, Sep 30, 2015 -//-------------------------------------------------------------------------- -DataType::~DataType() -{ - try { - close(); - } - catch (Exception &close_error) { - cerr << inMemFunc("~DataType - ") << close_error.getDetailMsg() << endl; - } -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dbtree.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dbtree.c index 46ea256913..cb7aa1dec1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dbtree.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dbtree.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,13 +10,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Wednesday, October 8, 1997 - * - * Purpose: v1 B-tree indexed (chunked) I/O functions. The chunks are +/* Purpose: v1 B-tree indexed (chunked) I/O functions. The chunks are * given a multi-dimensional index which is used as a lookup key * in a B-tree that maps chunk index to disk address. - * */ /****************/ @@ -162,7 +157,7 @@ const H5D_chunk_ops_t H5D_COPS_BTREE[1] = {{ /*****************************/ /* inherits B-tree like properties from H5B */ -H5B_class_t H5B_BTREE[1] = {{ +static H5B_class_t H5B_BTREE[1] = {{ H5B_CHUNK_ID, /*id */ sizeof(H5D_btree_key_t), /*sizeof_nkey */ H5D__btree_get_shared, /*get_shared */ @@ -196,9 +191,6 @@ H5FL_DEFINE_STATIC(H5O_layout_chunk_t); * * Failure: Can't fail * - * Programmer: Quincey Koziol - * Monday, July 5, 2004 - * *------------------------------------------------------------------------- */ static H5UC_t * @@ -208,10 +200,10 @@ H5D__btree_get_shared(const H5F_t H5_ATTR_UNUSED *f, const void *_udata) FUNC_ENTER_PACKAGE_NOERR - HDassert(udata); - HDassert(udata->storage); - HDassert(udata->storage->idx_type == H5D_CHUNK_IDX_BTREE); - HDassert(udata->storage->u.btree.shared); + assert(udata); + assert(udata->storage); + assert(udata->storage->idx_type == H5D_CHUNK_IDX_BTREE); + assert(udata->storage->u.btree.shared); /* Return the pointer to the ref-count object */ FUNC_LEAVE_NOAPI(udata->storage->u.btree.shared) @@ -230,9 +222,6 @@ H5D__btree_get_shared(const H5F_t H5_ATTR_UNUSED *f, const void *_udata) * * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, October 14, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -248,16 +237,16 @@ H5D__btree_new_node(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5B_ins_t op, void *_lt_key, FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(lt_key); - HDassert(rt_key); - HDassert(udata); - HDassert(udata->common.layout->ndims > 0 && udata->common.layout->ndims < H5O_LAYOUT_NDIMS); - HDassert(addr_p); + assert(f); + assert(lt_key); + assert(rt_key); + assert(udata); + assert(udata->common.layout->ndims > 0 && udata->common.layout->ndims < H5O_LAYOUT_NDIMS); + assert(addr_p); /* Set address */ - HDassert(H5F_addr_defined(udata->chunk_block.offset)); - HDassert(udata->chunk_block.length > 0); + assert(H5_addr_defined(udata->chunk_block.offset)); + assert(udata->chunk_block.length > 0); *addr_p = udata->chunk_block.offset; /* @@ -277,7 +266,7 @@ H5D__btree_new_node(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5B_ins_t op, void *_lt_key, rt_key->nbytes = 0; rt_key->filter_mask = 0; for (u = 0; u < udata->common.layout->ndims; u++) { - HDassert(udata->common.scaled[u] + 1 > udata->common.scaled[u]); + assert(udata->common.scaled[u] + 1 > udata->common.scaled[u]); rt_key->scaled[u] = udata->common.scaled[u] + 1; } /* end if */ } /* end if */ @@ -299,9 +288,6 @@ H5D__btree_new_node(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5B_ins_t op, void *_lt_key, * * Failure: FAIL (same as LT_KEYlayout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); + assert(lt_key); + assert(rt_key); + assert(udata); + assert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); /* Compare the offsets but ignore the other fields */ ret_value = H5VM_vector_cmp_u(udata->layout->ndims, lt_key->scaled, rt_key->scaled); @@ -347,9 +333,6 @@ H5D__btree_cmp2(void *_lt_key, void *_udata, void *_rt_key) * * Failure: FAIL (same as UDATA < LT_KEY) * - * Programmer: Robb Matzke - * Wednesday, October 8, 1997 - * *------------------------------------------------------------------------- */ static int @@ -362,10 +345,10 @@ H5D__btree_cmp3(void *_lt_key, void *_udata, void *_rt_key) FUNC_ENTER_PACKAGE_NOERR - HDassert(lt_key); - HDassert(rt_key); - HDassert(udata); - HDassert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); + assert(lt_key); + assert(rt_key); + assert(udata); + assert(udata->layout->ndims > 0 && udata->layout->ndims <= H5O_LAYOUT_NDIMS); /* Special case for faster checks on 1-D chunks */ /* (Checking for ndims==2 because last dimension is the datatype size) */ @@ -411,9 +394,6 @@ H5D__btree_cmp3(void *_lt_key, void *_udata, void *_rt_key) * chunk returned through the UDATA argument, if *FOUND is true. * Negative on failure. * - * Programmer: Robb Matzke - * Thursday, October 9, 1997 - * *------------------------------------------------------------------------- */ static htri_t @@ -427,21 +407,21 @@ H5D__btree_found(H5F_t H5_ATTR_UNUSED *f, haddr_t addr, const void *_lt_key, hbo FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(lt_key); - HDassert(found); - HDassert(udata); + assert(f); + assert(H5_addr_defined(addr)); + assert(lt_key); + assert(found); + assert(udata); /* Is this *really* the requested chunk? */ for (u = 0; u < udata->common.layout->ndims; u++) if (udata->common.scaled[u] >= (lt_key->scaled[u] + 1)) { *found = FALSE; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* Initialize return values */ - HDassert(lt_key->nbytes > 0); + assert(lt_key->nbytes > 0); udata->chunk_block.offset = addr; udata->chunk_block.length = lt_key->nbytes; udata->filter_mask = lt_key->filter_mask; @@ -459,9 +439,6 @@ H5D__btree_found(H5F_t H5_ATTR_UNUSED *f, haddr_t addr, const void *_lt_key, hbo * Return: Success: FALSE if they are not disjoint. * TRUE if they are disjoint. * - * Programmer: Quincey Koziol - * Wednesday, May 6, 2015 - * * Note: Assumes that the chunk offsets are scaled coordinates * *------------------------------------------------------------------------- @@ -475,14 +452,14 @@ H5D__chunk_disjoint(unsigned n, const hsize_t *scaled1, const hsize_t *scaled2) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(n); - HDassert(scaled1); - HDassert(scaled2); + assert(n); + assert(scaled1); + assert(scaled2); /* Loop over two chunks, detecting disjointness and getting out quickly */ for (u = 0; u < n; u++) if ((scaled1[u] + 1) <= scaled2[u] || (scaled2[u] + 1) <= scaled1[u]) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -511,9 +488,6 @@ H5D__chunk_disjoint(unsigned n, const hsize_t *scaled1, const hsize_t *scaled2) * * Failure: H5B_INS_ERROR * - * Programmer: Robb Matzke - * Thursday, October 9, 1997 - * *------------------------------------------------------------------------- */ static H5B_ins_t @@ -532,21 +506,21 @@ H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(lt_key); - HDassert(lt_key_changed); - HDassert(md_key); - HDassert(udata); - HDassert(rt_key); - HDassert(new_node_p); + assert(f); + assert(H5_addr_defined(addr)); + assert(lt_key); + assert(lt_key_changed); + assert(md_key); + assert(udata); + assert(rt_key); + assert(new_node_p); cmp = H5D__btree_cmp3(lt_key, udata, rt_key); - HDassert(cmp <= 0); + assert(cmp <= 0); if (cmp < 0) { /* Negative indices not supported yet */ - HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error") + HGOTO_ERROR(H5E_STORAGE, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error"); } else if (H5VM_vector_eq_u(udata->common.layout->ndims, udata->common.scaled, lt_key->scaled) && lt_key->nbytes > 0) { @@ -556,7 +530,7 @@ H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED */ if (lt_key->nbytes != udata->chunk_block.length) { /* Set node's address (already re-allocated by main chunk routines) */ - HDassert(H5F_addr_defined(udata->chunk_block.offset)); + assert(H5_addr_defined(udata->chunk_block.offset)); *new_node_p = udata->chunk_block.offset; H5_CHECKED_ASSIGN(lt_key->nbytes, uint32_t, udata->chunk_block.length, hsize_t); lt_key->filter_mask = udata->filter_mask; @@ -565,12 +539,12 @@ H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED } else { /* Already have address in udata, from main chunk routines */ - HDassert(H5F_addr_defined(udata->chunk_block.offset)); + assert(H5_addr_defined(udata->chunk_block.offset)); ret_value = H5B_INS_NOOP; } } else if (H5D__chunk_disjoint(udata->common.layout->ndims, lt_key->scaled, udata->common.scaled)) { - HDassert(H5D__chunk_disjoint(udata->common.layout->ndims, rt_key->scaled, udata->common.scaled)); + assert(H5D__chunk_disjoint(udata->common.layout->ndims, rt_key->scaled, udata->common.scaled)); /* * Split this node, inserting the new new node to the right of the * current node. The MD_KEY is where the split occurs. @@ -580,12 +554,12 @@ H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED for (u = 0; u < udata->common.layout->ndims; u++) md_key->scaled[u] = udata->common.scaled[u]; - HDassert(H5F_addr_defined(udata->chunk_block.offset)); + assert(H5_addr_defined(udata->chunk_block.offset)); *new_node_p = udata->chunk_block.offset; ret_value = H5B_INS_RIGHT; } else { - HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error") + HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, H5B_INS_ERROR, "internal error"); } done: @@ -599,9 +573,6 @@ H5D__btree_insert(H5F_t H5_ATTR_NDEBUG_UNUSED *f, haddr_t H5_ATTR_NDEBUG_UNUSED * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente - * March 28, 2002 - * *------------------------------------------------------------------------- */ static H5B_ins_t @@ -617,7 +588,7 @@ H5D__btree_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out */, hbool_t *lt /* Remove raw data chunk from file */ H5_CHECK_OVERFLOW(lt_key->nbytes, uint32_t, hsize_t); if (H5MF_xfree(f, H5FD_MEM_DRAW, addr, (hsize_t)lt_key->nbytes) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk") + HGOTO_ERROR(H5E_STORAGE, H5E_CANTFREE, H5B_INS_ERROR, "unable to free chunk"); /* Mark keys as unchanged */ *lt_key_changed = FALSE; @@ -628,15 +599,11 @@ H5D__btree_remove(H5F_t *f, haddr_t addr, void *_lt_key /*in,out */, hbool_t *lt } /* end H5D__btree_remove() */ /*------------------------------------------------------------------------- - * Function: H5D__btree_decode_key + * Function: H5D__btree_decode_key * - * Purpose: Decodes a raw key into a native key for the B-tree - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Friday, October 10, 1997 + * Purpose: Decodes a raw key into a native key for the B-tree * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -645,33 +612,33 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key const H5O_layout_chunk_t *layout; /* Chunk layout description */ H5D_btree_key_t *key = (H5D_btree_key_t *)_key; /* Pointer to decoded key */ hsize_t tmp_offset; /* Temporary coordinate offset, from file */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(shared); - HDassert(raw); - HDassert(key); + assert(shared); + assert(raw); + assert(key); layout = (const H5O_layout_chunk_t *)shared->udata; - HDassert(layout); - HDassert(layout->ndims > 0 && layout->ndims <= H5O_LAYOUT_NDIMS); + assert(layout); + + if (layout->ndims > H5O_LAYOUT_NDIMS) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "bad number of dimensions"); - /* decode */ UINT32DECODE(raw, key->nbytes); UINT32DECODE(raw, key->filter_mask); - for (u = 0; u < layout->ndims; u++) { + for (unsigned u = 0; u < layout->ndims; u++) { if (layout->dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u); /* Retrieve coordinate offset */ UINT64DECODE(raw, tmp_offset); - HDassert(0 == (tmp_offset % layout->dim[u])); + if (0 != (tmp_offset % layout->dim[u])) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "bad coordinate offset"); /* Convert to a scaled offset */ key->scaled[u] = tmp_offset / layout->dim[u]; - } /* end for */ + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -684,9 +651,6 @@ H5D__btree_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -700,12 +664,12 @@ H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(shared); - HDassert(raw); - HDassert(key); + assert(shared); + assert(raw); + assert(key); layout = (const H5O_layout_chunk_t *)shared->udata; - HDassert(layout); - HDassert(layout->ndims > 0 && layout->ndims <= H5O_LAYOUT_NDIMS); + assert(layout); + assert(layout->ndims > 0 && layout->ndims <= H5O_LAYOUT_NDIMS); /* encode */ UINT32ENCODE(raw, key->nbytes); @@ -726,9 +690,6 @@ H5D__btree_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, April 16, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -740,13 +701,13 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, con FUNC_ENTER_PACKAGE_NOERR - HDassert(key); + assert(key); - HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)key->nbytes); - HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", key->filter_mask); - HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); + fprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)key->nbytes); + fprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", key->filter_mask); + fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for (u = 0; u < udata->ndims; u++) - HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", (key->scaled[u] * udata->common.layout->dim[u])); + fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", (key->scaled[u] * udata->common.layout->dim[u])); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -759,9 +720,6 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, con * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, May 7, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -777,7 +735,7 @@ H5D__btree_shared_free(void *_shared) /* Chain up to the generic B-tree shared info free routine */ if (H5B_shared_free(shared) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't free shared B-tree info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't free shared B-tree info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -790,9 +748,6 @@ H5D__btree_shared_free(void *_shared) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, September 27, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -812,17 +767,17 @@ H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store, const H5O_l /* Allocate & initialize global info for the shared structure */ if (NULL == (shared = H5B_shared_new(f, H5B_BTREE, sizeof_rkey))) - HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info") + HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info"); /* Set up the "local" information for this dataset's chunks */ if (NULL == (my_layout = H5FL_MALLOC(H5O_layout_chunk_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk layout") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk layout"); H5MM_memcpy(my_layout, layout, sizeof(H5O_layout_chunk_t)); shared->udata = my_layout; /* Make shared B-tree info reference counted */ if (NULL == (store->u.btree.shared = H5UC_create(shared, H5D__btree_shared_free))) - HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info") + HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info"); done: if (ret_value < 0) @@ -839,9 +794,6 @@ H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store, const H5O_l * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, May 18, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -853,18 +805,18 @@ H5D__btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNUS FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(dset_ohdr_addr)); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(dset_ohdr_addr)); idx_info->storage->u.btree.dset_ohdr_addr = dset_ohdr_addr; /* Allocate the shared structure */ if (H5D__btree_shared_create(idx_info->f, idx_info->storage, idx_info->layout) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -883,9 +835,6 @@ H5D__btree_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNUS * Return: Non-negative on success (with the LAYOUT argument initialized * and ready to write to an object header). Negative on failure. * - * Programmer: Robb Matzke - * Tuesday, October 21, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -897,12 +846,12 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(!H5_addr_defined(idx_info->storage->idx_addr)); /* Initialize "user" data for B-tree callbacks, etc. */ udata.layout = idx_info->layout; @@ -910,7 +859,7 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info) /* Create the v1 B-tree for the chunk index */ if (H5B_create(idx_info->f, H5B_BTREE, &udata, &(idx_info->storage->idx_addr) /*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create B-tree"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -923,9 +872,6 @@ H5D__btree_idx_create(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 15, 2009 - * *------------------------------------------------------------------------- */ static hbool_t @@ -934,9 +880,9 @@ H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); + assert(storage); - FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) + FUNC_LEAVE_NOAPI((hbool_t)H5_addr_defined(storage->idx_addr)) } /* end H5D__btree_idx_is_space_alloc() */ /*------------------------------------------------------------------------- @@ -946,9 +892,6 @@ H5D__btree_idx_is_space_alloc(const H5O_storage_chunk_t *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -959,20 +902,20 @@ H5D__btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, FUNC_ENTER_PACKAGE - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* * Create the chunk it if it doesn't exist, or reallocate the chunk if * its size changed. */ if (H5B_insert(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to allocate chunk"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -987,9 +930,6 @@ H5D__btree_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, * * Return: Non-negative on success/Negative on failure * - * Programmer: Albert Cheng - * June 27, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -1000,19 +940,19 @@ H5D__btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat FUNC_ENTER_PACKAGE - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->layout->ndims > 0); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->layout->ndims > 0); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* Go get the chunk information from the B-tree */ found = FALSE; if (H5B_find(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, &found, udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFIND, FAIL, "can't check for chunk in B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFIND, FAIL, "can't check for chunk in B-tree"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1028,9 +968,6 @@ H5D__btree_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udat * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, May 20, 2008 - * *------------------------------------------------------------------------- */ static int @@ -1071,9 +1008,6 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, const void *_lt_key, haddr_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, May 20, 2008 - * *------------------------------------------------------------------------- */ static int @@ -1084,17 +1018,17 @@ H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t c FUNC_ENTER_PACKAGE_NOERR - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(chunk_cb); - HDassert(chunk_udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(chunk_cb); + assert(chunk_udata); /* Initialize userdata */ - HDmemset(&udata, 0, sizeof udata); + memset(&udata, 0, sizeof udata); udata.common.layout = idx_info->layout; udata.common.storage = idx_info->storage; udata.cb = chunk_cb; @@ -1115,9 +1049,6 @@ H5D__btree_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t c * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, May 22, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1127,19 +1058,19 @@ H5D__btree_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t FUNC_ENTER_PACKAGE - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* Remove the chunk from the v1 B-tree index and release the space for the * chunk (in the B-tree callback). */ if (H5B_remove(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to remove chunk entry"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1154,9 +1085,6 @@ H5D__btree_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t * Return: Success: Non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, March 20, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -1167,14 +1095,14 @@ H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); /* Check if the index data structure has been allocated */ - if (H5F_addr_defined(idx_info->storage->idx_addr)) { + if (H5_addr_defined(idx_info->storage->idx_addr)) { H5O_storage_chunk_t tmp_storage; /* Local copy of storage info */ H5D_chunk_common_ud_t udata; /* User data for B-tree operations */ @@ -1183,22 +1111,22 @@ H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info) /* Set up the shared structure */ if (H5D__btree_shared_create(idx_info->f, &tmp_storage, idx_info->layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info"); /* Set up B-tree user data */ - HDmemset(&udata, 0, sizeof udata); + memset(&udata, 0, sizeof udata); udata.layout = idx_info->layout; udata.storage = &tmp_storage; /* Delete entire B-tree */ if (H5B_delete(idx_info->f, H5B_BTREE, tmp_storage.idx_addr, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk B-tree"); /* Release the shared B-tree page */ if (NULL == tmp_storage.u.btree.shared) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "ref-counted page nil") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "ref-counted page nil"); if (H5UC_DEC(tmp_storage.u.btree.shared) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page"); } /* end if */ done: @@ -1212,9 +1140,6 @@ H5D__btree_idx_delete(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, May 29, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1224,29 +1149,29 @@ H5D__btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_ FUNC_ENTER_PACKAGE_TAG(H5AC__COPIED_TAG) - HDassert(idx_info_src); - HDassert(idx_info_src->f); - HDassert(idx_info_src->pline); - HDassert(idx_info_src->layout); - HDassert(idx_info_src->storage); - HDassert(idx_info_dst); - HDassert(idx_info_dst->f); - HDassert(idx_info_dst->pline); - HDassert(idx_info_dst->layout); - HDassert(idx_info_dst->storage); - HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); + assert(idx_info_src); + assert(idx_info_src->f); + assert(idx_info_src->pline); + assert(idx_info_src->layout); + assert(idx_info_src->storage); + assert(idx_info_dst); + assert(idx_info_dst->f); + assert(idx_info_dst->pline); + assert(idx_info_dst->layout); + assert(idx_info_dst->storage); + assert(!H5_addr_defined(idx_info_dst->storage->idx_addr)); /* Create shared B-tree info for each file */ if (H5D__btree_shared_create(idx_info_src->f, idx_info_src->storage, idx_info_src->layout) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for source shared B-tree info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for source shared B-tree info"); if (H5D__btree_shared_create(idx_info_dst->f, idx_info_dst->storage, idx_info_dst->layout) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, - "can't create wrapper for destination shared B-tree info") + "can't create wrapper for destination shared B-tree info"); /* Create the root of the B-tree that describes chunked storage in the dest. file */ if (H5D__btree_idx_create(idx_info_dst) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") - HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage"); + assert(H5_addr_defined(idx_info_dst->storage->idx_addr)); done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -1259,9 +1184,6 @@ H5D__btree_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, May 29, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1271,14 +1193,14 @@ H5D__btree_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chunk FUNC_ENTER_PACKAGE - HDassert(storage_src); - HDassert(storage_dst); + assert(storage_src); + assert(storage_dst); /* Decrement refcount on shared B-tree info */ if (H5UC_DEC(storage_src->u.btree.shared) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref-counted page") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref-counted page"); if (H5UC_DEC(storage_dst->u.btree.shared) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref-counted page") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement ref-counted page"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1292,9 +1214,6 @@ H5D__btree_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chunk * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi - * June 8, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -1307,21 +1226,21 @@ H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(index_size); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(index_size); /* Initialize B-tree node user-data */ - HDmemset(&udata, 0, sizeof udata); + memset(&udata, 0, sizeof udata); udata.layout = idx_info->layout; udata.storage = idx_info->storage; /* Get metadata information for B-tree */ if (H5B_get_info(idx_info->f, H5B_BTREE, idx_info->storage->idx_addr, &bt_info, NULL, &udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to iterate over chunk B-tree") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to iterate over chunk B-tree"); /* Set the size of the B-tree */ *index_size = bt_info.size; @@ -1337,9 +1256,6 @@ H5D__btree_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 15, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1347,7 +1263,7 @@ H5D__btree_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) { FUNC_ENTER_PACKAGE_NOERR - HDassert(storage); + assert(storage); /* Reset index info */ if (reset_addr) @@ -1364,9 +1280,6 @@ H5D__btree_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 15, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1374,10 +1287,10 @@ H5D__btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) { FUNC_ENTER_PACKAGE_NOERR - HDassert(storage); - HDassert(stream); + assert(storage); + assert(stream); - HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); + fprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__btree_idx_dump() */ @@ -1389,9 +1302,6 @@ H5D__btree_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -1401,17 +1311,17 @@ H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); /* Free the raw B-tree node buffer */ if (NULL == idx_info->storage->u.btree.shared) - HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil") + HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted page nil"); if (H5UC_DEC(idx_info->storage->u.btree.shared) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page") + HGOTO_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted page"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1424,9 +1334,6 @@ H5D__btree_idx_dest(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, April 16, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1443,18 +1350,18 @@ H5D_btree_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, un FUNC_ENTER_NOAPI(FAIL) /* Reset "fake" storage info */ - HDmemset(&storage, 0, sizeof(storage)); + memset(&storage, 0, sizeof(storage)); storage.idx_type = H5D_CHUNK_IDX_BTREE; /* Reset "fake" layout info */ - HDmemset(&layout, 0, sizeof(layout)); + memset(&layout, 0, sizeof(layout)); layout.ndims = ndims; for (u = 0; u < ndims; u++) layout.dim[u] = dim[u]; /* Allocate the shared structure */ if (H5D__btree_shared_create(f, &storage, &layout) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't create wrapper for shared B-tree info"); shared_init = TRUE; /* Set up user data for callback */ @@ -1470,9 +1377,9 @@ H5D_btree_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, un if (shared_init) { /* Free the raw B-tree node buffer */ if (NULL == storage.u.btree.shared) - HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted shared info nil") + HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "ref-counted shared info nil"); else if (H5UC_DEC(storage.u.btree.shared) < 0) - HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted shared info") + HDONE_ERROR(H5E_IO, H5E_CANTFREE, FAIL, "unable to decrement ref-counted shared info"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dbtree2.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dbtree2.c index a5b527ca9a..7fe83976bb 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dbtree2.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dbtree2.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -207,8 +206,6 @@ H5FL_ARR_DEFINE_STATIC(uint32_t, H5O_LAYOUT_NDIMS); * Return: Success: non-NULL * Failure: NULL * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static void * @@ -222,13 +219,13 @@ H5D__bt2_crt_context(void *_udata) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(udata); - HDassert(udata->f); - HDassert(udata->ndims > 0 && udata->ndims < H5O_LAYOUT_NDIMS); + assert(udata); + assert(udata->f); + assert(udata->ndims > 0 && udata->ndims < H5O_LAYOUT_NDIMS); /* Allocate callback context */ if (NULL == (ctx = H5FL_MALLOC(H5D_bt2_ctx_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate callback context") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate callback context"); /* Determine the size of addresses and set the chunk size and # of dimensions for the dataset */ ctx->sizeof_addr = H5F_SIZEOF_ADDR(udata->f); @@ -237,7 +234,7 @@ H5D__bt2_crt_context(void *_udata) /* Set up the "local" information for this dataset's chunk dimension sizes */ if (NULL == (my_dim = (uint32_t *)H5FL_ARR_MALLOC(uint32_t, H5O_LAYOUT_NDIMS))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims"); H5MM_memcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t)); ctx->dim = my_dim; @@ -264,8 +261,6 @@ H5D__bt2_crt_context(void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -276,7 +271,7 @@ H5D__bt2_dst_context(void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Free array for chunk dimension sizes */ if (ctx->dim) @@ -296,8 +291,6 @@ H5D__bt2_dst_context(void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -322,8 +315,6 @@ H5D__bt2_store(void *record, const void *_udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -337,8 +328,8 @@ H5D__bt2_compare(const void *_udata, const void *_rec2, int *result) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(rec1); - HDassert(rec2); + assert(rec1); + assert(rec2); /* Compare the offsets but ignore the other fields */ *result = H5VM_vector_cmp_u(udata->ndims, rec1->scaled, rec2->scaled); @@ -355,8 +346,6 @@ H5D__bt2_compare(const void *_udata, const void *_rec2, int *result) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -369,7 +358,7 @@ H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Encode the record's fields */ H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr); @@ -389,8 +378,6 @@ H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -403,7 +390,7 @@ H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Decode the record's fields */ H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr); @@ -423,8 +410,6 @@ H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -437,15 +422,15 @@ H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, const void *_record, FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(record); - HDassert(ctx->chunk_size == record->nbytes); - HDassert(0 == record->filter_mask); + assert(record); + assert(ctx->chunk_size == record->nbytes); + assert(0 == record->filter_mask); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); - HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); + fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for (u = 0; u < ctx->ndims; u++) - HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]); + fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -460,8 +445,6 @@ H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, const void *_record, * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -474,10 +457,10 @@ H5D__bt2_filt_encode(uint8_t *raw, const void *_record, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); - HDassert(record); - HDassert(H5F_addr_defined(record->chunk_addr)); - HDassert(0 != record->nbytes); + assert(ctx); + assert(record); + assert(H5_addr_defined(record->chunk_addr)); + assert(0 != record->nbytes); /* Encode the record's fields */ H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr); @@ -498,8 +481,6 @@ H5D__bt2_filt_encode(uint8_t *raw, const void *_record, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -512,8 +493,8 @@ H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); - HDassert(record); + assert(ctx); + assert(record); /* Decode the record's fields */ H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr); @@ -523,8 +504,8 @@ H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx) UINT64DECODE(raw, record->scaled[u]); /* Sanity checks */ - HDassert(H5F_addr_defined(record->chunk_addr)); - HDassert(0 != record->nbytes); + assert(H5_addr_defined(record->chunk_addr)); + assert(0 != record->nbytes); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5D__bt2_filt_decode() */ @@ -537,8 +518,6 @@ H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -551,17 +530,17 @@ H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, const void *_record, c FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(record); - HDassert(H5F_addr_defined(record->chunk_addr)); - HDassert(0 != record->nbytes); + assert(record); + assert(H5_addr_defined(record->chunk_addr)); + assert(0 != record->nbytes); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); - HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)record->nbytes); - HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", record->filter_mask); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); + fprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)record->nbytes); + fprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", record->filter_mask); - HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); + fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); for (u = 0; u < ctx->ndims; u++) - HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]); + fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]); HDfputs("}\n", stream); FUNC_LEAVE_NOAPI(SUCCEED) @@ -574,9 +553,6 @@ H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, const void *_record, c * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Wednesday, May 23, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -586,7 +562,7 @@ H5D__bt2_idx_init(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, const H5S_t FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(H5F_addr_defined(dset_ohdr_addr)); + assert(H5_addr_defined(dset_ohdr_addr)); idx_info->storage->u.btree2.dset_ohdr_addr = dset_ohdr_addr; @@ -602,9 +578,6 @@ H5D__bt2_idx_init(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, const H5S_t * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, December 18, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -618,16 +591,16 @@ H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_BT2 == idx_info->layout->idx_type); - HDassert(idx_info->storage); - HDassert(H5D_CHUNK_IDX_BT2 == idx_info->storage->idx_type); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(idx_info->storage->u.btree2.bt2); + assert(idx_info); + assert(idx_info->f); + assert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); + assert(idx_info->pline); + assert(idx_info->layout); + assert(H5D_CHUNK_IDX_BT2 == idx_info->layout->idx_type); + assert(idx_info->storage); + assert(H5D_CHUNK_IDX_BT2 == idx_info->storage->idx_type); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(idx_info->storage->u.btree2.bt2); /* Set up object header location for dataset */ H5O_loc_reset(&oloc); @@ -636,21 +609,21 @@ H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info) /* Get header */ if (NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect object header"); /* Retrieve the dataset's object header proxy */ if (NULL == (oh_proxy = H5O_get_proxy(oh))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataset object header proxy") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataset object header proxy"); /* Make the v2 B-tree a child flush dependency of the dataset's object header proxy */ if (H5B2_depend(idx_info->storage->u.btree2.bt2, oh_proxy) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, - "unable to create flush dependency on object header proxy") + "unable to create flush dependency on object header proxy"); done: /* Release the object header from the cache */ if (oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__btree2_idx_depend() */ @@ -668,8 +641,6 @@ H5D__btree2_idx_depend(const H5D_chk_idx_info_t *idx_info) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -681,14 +652,14 @@ H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_BT2 == idx_info->layout->idx_type); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(NULL == idx_info->storage->u.btree2.bt2); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(H5D_CHUNK_IDX_BT2 == idx_info->layout->idx_type); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(NULL == idx_info->storage->u.btree2.bt2); /* Set up the user data */ u_ctx.f = idx_info->f; @@ -699,13 +670,13 @@ H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info) /* Open v2 B-tree for the chunk index */ if (NULL == (idx_info->storage->u.btree2.bt2 = H5B2_open(idx_info->f, idx_info->storage->idx_addr, &u_ctx))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open v2 B-tree for tracking chunked dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open v2 B-tree for tracking chunked dataset"); /* Check for SWMR writes to the file */ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) if (H5D__btree2_idx_depend(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, - "unable to create flush dependency on object header") + "unable to create flush dependency on object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -718,8 +689,6 @@ H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -732,12 +701,12 @@ H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(!H5_addr_defined(idx_info->storage->idx_addr)); bt2_cparam.rrec_size = H5F_SIZEOF_ADDR(idx_info->f) /* Address of chunk */ + (idx_info->layout->ndims - 1) * 8; /* # of dimensions x 64-bit chunk offsets */ @@ -771,18 +740,18 @@ H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info) /* Create the v2 B-tree for the chunked dataset */ if (NULL == (idx_info->storage->u.btree2.bt2 = H5B2_create(idx_info->f, &bt2_cparam, &u_ctx))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking chunked dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking chunked dataset"); /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(idx_info->storage->u.btree2.bt2, &(idx_info->storage->idx_addr)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "can't get v2 B-tree address for tracking chunked dataset") + "can't get v2 B-tree address for tracking chunked dataset"); /* Check for SWMR writes to the file */ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) if (H5D__btree2_idx_depend(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, - "unable to create flush dependency on object header") + "unable to create flush dependency on object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -795,8 +764,6 @@ H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static hbool_t @@ -805,9 +772,9 @@ H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); + assert(storage); - FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) + FUNC_LEAVE_NOAPI((hbool_t)H5_addr_defined(storage->idx_addr)) } /* end H5D__bt2_idx_is_space_alloc() */ /*------------------------------------------------------------------------- @@ -820,8 +787,6 @@ H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -838,7 +803,7 @@ H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed) unsigned u; /* Local index variable */ for (u = 0; u < op_data->ndims; u++) - HDassert(record->scaled[u] == op_data->rec.scaled[u]); + assert(record->scaled[u] == op_data->rec.scaled[u]); } #endif /* NDEBUG */ @@ -865,8 +830,6 @@ H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -881,24 +844,24 @@ H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); - HDassert(H5F_addr_defined(udata->chunk_block.offset)); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); + assert(H5_addr_defined(udata->chunk_block.offset)); /* Check if the v2 B-tree is open yet */ if (NULL == idx_info->storage->u.btree2.bt2) { /* Open existing v2 B-tree */ if (H5D__bt2_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree"); } /* end if */ else /* Patch the top level file pointer contained in bt2 if needed */ if (H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer"); /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -919,7 +882,7 @@ H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, /* Update record for v2 B-tree (could be insert or modify) */ if (H5B2_update(bt2, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTUPDATE, FAIL, "unable to update record in v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTUPDATE, FAIL, "unable to update record in v2 B-tree"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -935,8 +898,6 @@ H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -958,8 +919,6 @@ H5D__bt2_found_cb(const void *nrecord, void *op_data) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -975,24 +934,24 @@ H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->layout->ndims > 0); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->layout->ndims > 0); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* Check if the v2 B-tree is open yet */ if (NULL == idx_info->storage->u.btree2.bt2) { /* Open existing v2 B-tree */ if (H5D__bt2_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree"); } /* end if */ else /* Patch the top level file pointer contained in bt2 if needed */ if (H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer"); /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1013,12 +972,12 @@ H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) /* Go get chunk information from v2 B-tree */ found = FALSE; if (H5B2_find(bt2, &bt2_udata, &found, H5D__bt2_found_cb, &found_rec) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFIND, FAIL, "can't check for chunk in v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFIND, FAIL, "can't check for chunk in v2 B-tree"); /* Check if chunk was found */ if (found) { /* Sanity check */ - HDassert(0 != found_rec.nbytes); + assert(0 != found_rec.nbytes); /* Set common info for the chunk */ udata->chunk_block.offset = found_rec.chunk_addr; @@ -1055,8 +1014,6 @@ H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static int @@ -1083,8 +1040,6 @@ H5D__bt2_idx_iterate_cb(const void *_record, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static int @@ -1097,24 +1052,24 @@ H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chu FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(chunk_cb); - HDassert(chunk_udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(chunk_cb); + assert(chunk_udata); /* Check if the v2 B-tree is open yet */ if (NULL == idx_info->storage->u.btree2.bt2) { /* Open existing v2 B-tree */ if (H5D__bt2_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree"); } /* end if */ else /* Patch the top level file pointer contained in bt2 if needed */ if (H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer"); /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1142,8 +1097,6 @@ H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t chu * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1156,12 +1109,12 @@ H5D__bt2_remove_cb(const void *_record, void *_udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); + assert(f); /* Free the space in the file for the object being removed */ H5_CHECK_OVERFLOW(record->nbytes, uint32_t, hsize_t); if (H5MF_xfree(f, H5FD_MEM_DRAW, record->chunk_addr, (hsize_t)record->nbytes) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1174,8 +1127,6 @@ H5D__bt2_remove_cb(const void *_record, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1189,23 +1140,23 @@ H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *u FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* Check if the v2 B-tree is open yet */ if (NULL == idx_info->storage->u.btree2.bt2) { /* Open existing v2 B-tree */ if (H5D__bt2_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree"); } /* end if */ else /* Patch the top level file pointer contained in bt2 if needed */ if (H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer"); /* Set convenience pointer to v2 B-tree structure */ bt2 = idx_info->storage->u.btree2.bt2; @@ -1222,7 +1173,7 @@ H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *u if (H5B2_remove(bt2, &bt2_udata, (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) ? NULL : H5D__bt2_remove_cb, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1237,8 +1188,6 @@ H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *u * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1251,14 +1200,14 @@ H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); /* Check if the index data structure has been allocated */ - if (H5F_addr_defined(idx_info->storage->idx_addr)) { + if (H5_addr_defined(idx_info->storage->idx_addr)) { /* Set up user data for creating context */ u_ctx.f = idx_info->f; u_ctx.ndims = idx_info->layout->ndims - 1; @@ -1274,7 +1223,7 @@ H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info) /* Delete the v2 B-tree */ /*(space in the file for each object is freed in the 'remove' callback) */ if (H5B2_delete(idx_info->f, idx_info->storage->idx_addr, &u_ctx, remove_op, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree"); idx_info->storage->idx_addr = HADDR_UNDEF; } /* end if */ @@ -1290,8 +1239,6 @@ H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1302,32 +1249,32 @@ H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_id FUNC_ENTER_PACKAGE /* Source file */ - HDassert(idx_info_src); - HDassert(idx_info_src->f); - HDassert(idx_info_src->pline); - HDassert(idx_info_src->layout); - HDassert(idx_info_src->storage); + assert(idx_info_src); + assert(idx_info_src->f); + assert(idx_info_src->pline); + assert(idx_info_src->layout); + assert(idx_info_src->storage); /* Destination file */ - HDassert(idx_info_dst); - HDassert(idx_info_dst->f); - HDassert(idx_info_dst->pline); - HDassert(idx_info_dst->layout); - HDassert(idx_info_dst->storage); - HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); + assert(idx_info_dst); + assert(idx_info_dst->f); + assert(idx_info_dst->pline); + assert(idx_info_dst->layout); + assert(idx_info_dst->storage); + assert(!H5_addr_defined(idx_info_dst->storage->idx_addr)); /* Check if the source v2 B-tree is open yet */ if (NULL == idx_info_src->storage->u.btree2.bt2) if (H5D__bt2_idx_open(idx_info_src) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree"); /* Set copied metadata tag */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) /* Create v2 B-tree that describes the chunked dataset in the destination file */ if (H5D__bt2_idx_create(idx_info_dst) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") - HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage"); + assert(H5_addr_defined(idx_info_dst->storage->idx_addr)); /* Reset metadata tag */ H5_END_TAG @@ -1343,8 +1290,6 @@ H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk_id * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1355,19 +1300,19 @@ H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chunk_t FUNC_ENTER_PACKAGE /* Check args */ - HDassert(storage_src); - HDassert(storage_src->u.btree2.bt2); - HDassert(storage_dst); - HDassert(storage_dst->u.btree2.bt2); + assert(storage_src); + assert(storage_src->u.btree2.bt2); + assert(storage_dst); + assert(storage_dst->u.btree2.bt2); /* Close v2 B-tree for source file */ if (H5B2_close(storage_src->u.btree2.bt2) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree"); storage_src->u.btree2.bt2 = NULL; /* Close v2 B-tree for destination file */ if (H5B2_close(storage_dst->u.btree2.bt2) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree"); storage_dst->u.btree2.bt2 = NULL; done: @@ -1382,8 +1327,6 @@ H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chunk_t * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1395,29 +1338,29 @@ H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(index_size); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(index_size); /* Open v2 B-tree */ if (H5D__bt2_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree"); /* Set convenience pointer to v2 B-tree structure */ bt2_cdset = idx_info->storage->u.btree2.bt2; /* Get v2 B-tree size for indexing chunked dataset */ if (H5B2_size(bt2_cdset, index_size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve v2 B-tree storage info for chunked dataset") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve v2 B-tree storage info for chunked dataset"); done: /* Close v2 B-tree index */ if (bt2_cdset && H5B2_close(bt2_cdset) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for tracking chunked dataset") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for tracking chunked dataset"); idx_info->storage->u.btree2.bt2 = NULL; FUNC_LEAVE_NOAPI(ret_value) @@ -1430,8 +1373,6 @@ H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1440,7 +1381,7 @@ H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(storage); + assert(storage); /* Reset index info */ if (reset_addr) @@ -1457,8 +1398,6 @@ H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1467,10 +1406,10 @@ H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(storage); - HDassert(stream); + assert(storage); + assert(stream); - HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); + fprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__bt2_idx_dump() */ @@ -1482,8 +1421,6 @@ H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1494,20 +1431,20 @@ H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->storage); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->storage); /* Check if the v2-btree is open */ if (idx_info->storage->u.btree2.bt2) { /* Patch the top level file pointer contained in bt2 if needed */ if (H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer"); /* Close v2 B-tree */ if (H5B2_close(idx_info->storage->u.btree2.bt2) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree"); idx_info->storage->u.btree2.bt2 = NULL; } /* end if */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dchunk.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dchunk.c index 256b441c13..8f34c2f429 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dchunk.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dchunk.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,31 +10,28 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Thursday, April 24, 2008 - * - * Purpose: Abstract indexed (chunked) I/O functions. The logical - * multi-dimensional dataspace is regularly partitioned into - * same-sized "chunks", the first of which is aligned with the - * logical origin. The chunks are indexed by different methods, - * that map a chunk index to disk address. Each chunk can be - * compressed independently and the chunks may move around in the - * file as their storage requirements change. - * - * Cache: Disk I/O is performed in units of chunks and H5MF_alloc() - * contains code to optionally align chunks on disk block - * boundaries for performance. - * - * The chunk cache is an extendible hash indexed by a function - * of storage B-tree address and chunk N-dimensional offset - * within the dataset. Collisions are not resolved -- one of - * the two chunks competing for the hash slot must be preempted - * from the cache. All entries in the hash also participate in - * a doubly-linked list and entries are penalized by moving them - * toward the front of the list. When a new chunk is about to - * be added to the cache the heap is pruned by preempting - * entries near the front of the list to make room for the new - * entry which is added to the end of the list. +/* Purpose: Abstract indexed (chunked) I/O functions. The logical + * multi-dimensional dataspace is regularly partitioned into + * same-sized "chunks", the first of which is aligned with the + * logical origin. The chunks are indexed by different methods, + * that map a chunk index to disk address. Each chunk can be + * compressed independently and the chunks may move around in the + * file as their storage requirements change. + * + * Cache: Disk I/O is performed in units of chunks and H5MF_alloc() + * contains code to optionally align chunks on disk block + * boundaries for performance. + * + * The chunk cache is an extendible hash indexed by a function + * of storage B-tree address and chunk N-dimensional offset + * within the dataset. Collisions are not resolved -- one of + * the two chunks competing for the hash slot must be preempted + * from the cache. All entries in the hash also participate in + * a doubly-linked list and entries are penalized by moving them + * toward the front of the list. When a new chunk is about to + * be added to the cache the heap is pruned by preempting + * entries near the front of the list to make room for the new + * entry which is added to the end of the list. */ /****************/ @@ -67,21 +63,30 @@ /****************/ /* Macros for iterating over chunks to operate on */ -#define H5D_CHUNK_GET_FIRST_NODE(map) (map->use_single ? (H5SL_node_t *)(1) : H5SL_first(map->sel_chunks)) -#define H5D_CHUNK_GET_NODE_INFO(map, node) \ - (map->use_single ? map->single_chunk_info : (H5D_chunk_info_t *)H5SL_item(node)) -#define H5D_CHUNK_GET_NEXT_NODE(map, node) (map->use_single ? (H5SL_node_t *)NULL : H5SL_next(node)) -#define H5D_CHUNK_GET_NODE_COUNT(map) (map->use_single ? (size_t)1 : H5SL_count(map->sel_chunks)) +#define H5D_CHUNK_GET_FIRST_NODE(dinfo) \ + (dinfo->layout_io_info.chunk_map->use_single \ + ? (H5SL_node_t *)(1) \ + : H5SL_first(dinfo->layout_io_info.chunk_map->dset_sel_pieces)) +#define H5D_CHUNK_GET_NODE_INFO(dinfo, node) \ + (dinfo->layout_io_info.chunk_map->use_single ? dinfo->layout_io_info.chunk_map->single_piece_info \ + : (H5D_piece_info_t *)H5SL_item(node)) +#define H5D_CHUNK_GET_NEXT_NODE(dinfo, node) \ + (dinfo->layout_io_info.chunk_map->use_single ? (H5SL_node_t *)NULL : H5SL_next(node)) +#define H5D_CHUNK_GET_NODE_COUNT(dinfo) \ + (dinfo->layout_io_info.chunk_map->use_single \ + ? (size_t)1 \ + : H5SL_count(dinfo->layout_io_info.chunk_map->dset_sel_pieces)) /* Sanity check on chunk index types: commonly used by a lot of routines in this file */ #define H5D_CHUNK_STORAGE_INDEX_CHK(storage) \ - HDassert((H5D_CHUNK_IDX_EARRAY == (storage)->idx_type && H5D_COPS_EARRAY == (storage)->ops) || \ - (H5D_CHUNK_IDX_FARRAY == (storage)->idx_type && H5D_COPS_FARRAY == (storage)->ops) || \ - (H5D_CHUNK_IDX_BT2 == (storage)->idx_type && H5D_COPS_BT2 == (storage)->ops) || \ - (H5D_CHUNK_IDX_BTREE == (storage)->idx_type && H5D_COPS_BTREE == (storage)->ops) || \ - (H5D_CHUNK_IDX_SINGLE == (storage)->idx_type && H5D_COPS_SINGLE == (storage)->ops) || \ - (H5D_CHUNK_IDX_NONE == (storage)->idx_type && H5D_COPS_NONE == (storage)->ops)); - + do { \ + assert((H5D_CHUNK_IDX_EARRAY == (storage)->idx_type && H5D_COPS_EARRAY == (storage)->ops) || \ + (H5D_CHUNK_IDX_FARRAY == (storage)->idx_type && H5D_COPS_FARRAY == (storage)->ops) || \ + (H5D_CHUNK_IDX_BT2 == (storage)->idx_type && H5D_COPS_BT2 == (storage)->ops) || \ + (H5D_CHUNK_IDX_BTREE == (storage)->idx_type && H5D_COPS_BTREE == (storage)->ops) || \ + (H5D_CHUNK_IDX_SINGLE == (storage)->idx_type && H5D_COPS_SINGLE == (storage)->ops) || \ + (H5D_CHUNK_IDX_NONE == (storage)->idx_type && H5D_COPS_NONE == (storage)->ops)); \ + } while (0) /* * Feature: If this constant is defined then every cache preemption and load * causes a character to be printed on the standard error stream: @@ -143,6 +148,7 @@ typedef struct H5D_chunk_it_ud1_t { H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */ const H5D_chk_idx_info_t *idx_info; /* Chunked index info */ const H5D_io_info_t *io_info; /* I/O info for dataset operation */ + const H5D_dset_io_info_t *dset_info; /* Dataset specific I/O info */ const hsize_t *space_dim; /* New dataset dimensions */ const hbool_t *shrunk_dim; /* Dimensions which have been shrunk */ H5S_t *chunk_space; /* Dataspace for a chunk */ @@ -231,14 +237,6 @@ typedef struct H5D_chunk_info_iter_ud_t { hbool_t found; /* Whether the chunk was found */ } H5D_chunk_info_iter_ud_t; -/* Callback info for file selection iteration */ -typedef struct H5D_chunk_file_iter_ud_t { - H5D_chunk_map_t *fm; /* File->memory chunk mapping info */ -#ifdef H5_HAVE_PARALLEL - const H5D_io_info_t *io_info; /* I/O info for operation */ -#endif /* H5_HAVE_PARALLEL */ -} H5D_chunk_file_iter_ud_t; - #ifdef H5_HAVE_PARALLEL /* information to construct a collective I/O operation for filling chunks */ typedef struct H5D_chunk_coll_fill_info_t { @@ -264,16 +262,13 @@ typedef struct H5D_chunk_iter_ud_t { /* Chunked layout operation callbacks */ static herr_t H5D__chunk_construct(H5F_t *f, H5D_t *dset); static herr_t H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id); -static herr_t H5D__chunk_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm); -static herr_t H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5D_chunk_map_t *fm); -static herr_t H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm); -static herr_t H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm); +static herr_t H5D__chunk_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); +static herr_t H5D__chunk_io_init_selections(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); +static herr_t H5D__chunk_mdio_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); +static herr_t H5D__chunk_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); +static herr_t H5D__chunk_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); static herr_t H5D__chunk_flush(H5D_t *dset); -static herr_t H5D__chunk_io_term(const H5D_chunk_map_t *fm); +static herr_t H5D__chunk_io_term(H5D_io_info_t *io_info, H5D_dset_io_info_t *di); static herr_t H5D__chunk_dest(H5D_t *dset); /* Chunk query operation callbacks */ @@ -283,8 +278,8 @@ static int H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, voi static int H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata); /* "Nonexistent" layout operation callback */ -static ssize_t H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, - size_t *chunk_curr_seq, size_t chunk_len_arr[], +static ssize_t H5D__nonexistent_readvv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); @@ -297,24 +292,23 @@ static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned nd static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); static herr_t H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *udata); static hbool_t H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *udata); -static herr_t H5D__free_chunk_info(void *item, void *key, void *opdata); -static herr_t H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); -static herr_t H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); -static herr_t H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t *io_info); -static herr_t H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm); -static herr_t H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm); -static herr_t H5D__chunk_file_cb(void *elem, const H5T_t *type, unsigned ndims, const hsize_t *coords, - void *fm); -static herr_t H5D__chunk_mem_cb(void *elem, const H5T_t *type, unsigned ndims, const hsize_t *coords, - void *fm); -static htri_t H5D__chunk_may_use_select_io(const H5D_io_info_t *io_info); +static herr_t H5D__create_piece_map_single(H5D_dset_io_info_t *di, H5D_io_info_t *io_info); +static herr_t H5D__create_piece_file_map_all(H5D_dset_io_info_t *di, H5D_io_info_t *io_info); +static herr_t H5D__create_piece_file_map_hyper(H5D_dset_io_info_t *di, H5D_io_info_t *io_info); +static herr_t H5D__create_piece_mem_map_1d(const H5D_dset_io_info_t *di); +static herr_t H5D__create_piece_mem_map_hyper(const H5D_dset_io_info_t *di); +static herr_t H5D__piece_file_cb(void *elem, const H5T_t *type, unsigned ndims, const hsize_t *coords, + void *_opdata); +static herr_t H5D__piece_mem_cb(void *elem, const H5T_t *type, unsigned ndims, const hsize_t *coords, + void *_opdata); +static herr_t H5D__chunk_may_use_select_io(H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info); static unsigned H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled); static herr_t H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset); static herr_t H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush); -static void *H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t relax, - hbool_t prev_unfilt_chunk); -static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, hbool_t dirty, - void *chunk, uint32_t naccessed); +static void *H5D__chunk_lock(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk); +static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, uint32_t naccessed); static herr_t H5D__chunk_cache_prune(const H5D_t *dset, size_t size); static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk); #ifdef H5_HAVE_PARALLEL @@ -337,17 +331,14 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{ H5D__chunk_is_space_alloc, /* is_space_alloc */ H5D__chunk_is_data_cached, /* is_data_cached */ H5D__chunk_io_init, /* io_init */ + H5D__chunk_mdio_init, /* mdio_init */ H5D__chunk_read, /* ser_read */ H5D__chunk_write, /* ser_write */ -#ifdef H5_HAVE_PARALLEL - H5D__chunk_collective_read, /* par_read */ - H5D__chunk_collective_write, /* par_write */ -#endif - NULL, /* readvv */ - NULL, /* writevv */ - H5D__chunk_flush, /* flush */ - H5D__chunk_io_term, /* io_term */ - H5D__chunk_dest /* dest */ + NULL, /* readvv */ + NULL, /* writevv */ + H5D__chunk_flush, /* flush */ + H5D__chunk_io_term, /* io_term */ + H5D__chunk_dest /* dest */ }}; /*******************/ @@ -355,11 +346,8 @@ const H5D_layout_ops_t H5D_LOPS_CHUNK[1] = {{ /*******************/ /* "nonexistent" storage layout I/O ops */ -const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = {{NULL, NULL, NULL, NULL, NULL, NULL, NULL, -#ifdef H5_HAVE_PARALLEL - NULL, NULL, -#endif /* H5_HAVE_PARALLEL */ - H5D__nonexistent_readvv, NULL, NULL, NULL, NULL}}; +static const H5D_layout_ops_t H5D_LOPS_NONEXISTENT[1] = { + {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, H5D__nonexistent_readvv, NULL, NULL, NULL, NULL}}; /* Declare a free list to manage the H5F_rdcc_ent_ptr_t sequence information */ H5FL_SEQ_DEFINE_STATIC(H5D_rdcc_ent_ptr_t); @@ -368,7 +356,10 @@ H5FL_SEQ_DEFINE_STATIC(H5D_rdcc_ent_ptr_t); H5FL_DEFINE_STATIC(H5D_rdcc_ent_t); /* Declare a free list to manage the H5D_chunk_info_t struct */ -H5FL_DEFINE(H5D_chunk_info_t); +H5FL_DEFINE_STATIC(H5D_chunk_map_t); + +/* Declare a free list to manage the H5D_piece_info_t struct */ +H5FL_DEFINE(H5D_piece_info_t); /* Declare a free list to manage the chunk sequence information */ H5FL_BLK_DEFINE_STATIC(chunk); @@ -383,14 +374,10 @@ H5FL_EXTERN(H5S_sel_iter_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * 30 July 2012 - * *------------------------------------------------------------------------- */ herr_t -H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, uint32_t data_size, - const void *buf) +H5D__chunk_direct_write(H5D_t *dset, uint32_t filters, hsize_t *offset, uint32_t data_size, const void *buf) { const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ H5D_chunk_ud_t udata; /* User data for querying chunk info */ @@ -403,19 +390,12 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, ui FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Sanity checks */ - HDassert(layout->type == H5D_CHUNKED); + assert(layout->type == H5D_CHUNKED); /* Allocate dataspace and initialize it if it hasn't been. */ - if (!H5D__chunk_is_space_alloc(&layout->storage)) { - H5D_io_info_t io_info; /* to hold the dset info */ - - io_info.dset = dset; - io_info.f_sh = H5F_SHARED(dset->oloc.file); - - /* Allocate storage */ - if (H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") - } + if (!H5D__chunk_is_space_alloc(&layout->storage)) + if (H5D__alloc_storage(dset, H5D_ALLOC_WRITE, FALSE, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage"); /* Calculate the index of this chunk */ H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, scaled); @@ -423,11 +403,11 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, ui /* Find out the file address of the chunk (if any) */ if (H5D__chunk_lookup(dset, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); /* Sanity check */ - HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || - (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + assert((H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || + (!H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); /* Set the file block information for the old chunk */ /* (Which is only defined when overwriting an existing chunk) */ @@ -447,7 +427,7 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, ui /* Set up the size of chunk for user data */ udata.chunk_block.length = data_size; - if (0 == idx_info.pline->nused && H5F_addr_defined(old_chunk.offset)) + if (0 == idx_info.pline->nused && H5_addr_defined(old_chunk.offset)) /* If there are no filters and we are overwriting the chunk we can just set values */ need_insert = FALSE; else { @@ -455,15 +435,15 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, ui * if its size has changed. */ if (H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk"); /* Cache the new chunk information */ H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, &udata); } /* end else */ /* Make sure the address of the chunk is returned. */ - if (!H5F_addr_defined(udata.chunk_block.offset)) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk address isn't defined") + if (!H5_addr_defined(udata.chunk_block.offset)) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk address isn't defined"); /* Evict the (old) entry from the cache if present, but do not flush * it to disk */ @@ -471,13 +451,13 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, ui const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ if (H5D__chunk_cache_evict(dset, rdcc->slot[udata.idx_hint], FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk"); } /* end if */ /* Write the data to the file */ if (H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); /* Insert the chunk record into the index */ if (need_insert && layout->storage.u.chunk.ops->insert) { @@ -485,7 +465,7 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, ui udata.filter_mask = filters; if ((layout->storage.u.chunk.ops->insert)(&idx_info, &udata, dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index"); } /* end if */ done: @@ -499,9 +479,6 @@ H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset, ui * * Return: Non-negative on success/Negative on failure * - * Programmer: Matthew Strong (GE Healthcare) - * 14 February 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -516,16 +493,16 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t *filters, vo FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ - HDassert(dset && H5D_CHUNKED == layout->type); - HDassert(offset); - HDassert(filters); - HDassert(buf); + assert(dset && H5D_CHUNKED == layout->type); + assert(offset); + assert(filters); + assert(buf); *filters = 0; /* Allocate dataspace and initialize it if it hasn't been. */ if (!H5D__chunk_is_space_alloc(&layout->storage) && !H5D__chunk_is_data_cached(dset->shared)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "storage is not initialized") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "storage is not initialized"); /* Calculate the index of this chunk */ H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, scaled); @@ -539,11 +516,11 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t *filters, vo /* Find out the file address of the chunk */ if (H5D__chunk_lookup(dset, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); /* Sanity check */ - HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || - (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + assert((H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || + (!H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); /* Check if the requested chunk exists in the chunk cache */ if (UINT_MAX != udata.idx_hint) { @@ -551,14 +528,14 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t *filters, vo hbool_t flush; /* Sanity checks */ - HDassert(udata.idx_hint < rdcc->nslots); - HDassert(rdcc->slot[udata.idx_hint]); + assert(udata.idx_hint < rdcc->nslots); + assert(rdcc->slot[udata.idx_hint]); flush = (ent->dirty == TRUE) ? TRUE : FALSE; /* Flush the chunk to disk and clear the cache entry */ if (H5D__chunk_cache_evict(dset, rdcc->slot[udata.idx_hint], flush) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk"); /* Reset fields about the chunk we are looking for */ udata.filter_mask = 0; @@ -568,17 +545,17 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t *filters, vo /* Get the new file address / chunk size after flushing */ if (H5D__chunk_lookup(dset, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); } /* Make sure the address of the chunk is returned. */ - if (!H5F_addr_defined(udata.chunk_block.offset)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined") + if (!H5_addr_defined(udata.chunk_block.offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined"); /* Read the chunk data into the supplied buffer */ if (H5F_shared_block_read(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, udata.chunk_block.length, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk"); /* Return the filter mask */ *filters = udata.filter_mask; @@ -594,9 +571,6 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t *filters, vo * * Return: Non-negative on success/Negative on failure * - * Programmer: Matthew Strong (GE Healthcare) - * 20 October 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -611,13 +585,13 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ - HDassert(dset && H5D_CHUNKED == layout->type); - HDassert(offset); - HDassert(storage_size); + assert(dset && H5D_CHUNKED == layout->type); + assert(offset); + assert(storage_size); /* Allocate dataspace and initialize it if it hasn't been. */ if (!(*layout->ops->is_space_alloc)(&layout->storage)) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Calculate the index of this chunk */ H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, scaled); @@ -630,15 +604,15 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage /* Find out the file address of the chunk */ if (H5D__chunk_lookup(dset, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); /* Sanity check */ - HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || - (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + assert((H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || + (!H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); /* The requested chunk is not in cache or on disk */ - if (!H5F_addr_defined(udata.chunk_block.offset) && UINT_MAX == udata.idx_hint) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk storage is not allocated") + if (!H5_addr_defined(udata.chunk_block.offset) && UINT_MAX == udata.idx_hint) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk storage is not allocated"); /* Check if there are filters registered to the dataset */ if (dset->shared->dcpl_cache.pline.nused > 0) { @@ -647,14 +621,14 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage H5D_rdcc_ent_t *ent = rdcc->slot[udata.idx_hint]; /* Sanity checks */ - HDassert(udata.idx_hint < rdcc->nslots); - HDassert(rdcc->slot[udata.idx_hint]); + assert(udata.idx_hint < rdcc->nslots); + assert(rdcc->slot[udata.idx_hint]); /* If the cached chunk is dirty, it must be flushed to get accurate size */ if (ent->dirty == TRUE) { /* Flush the chunk to disk and clear the cache entry */ if (H5D__chunk_cache_evict(dset, rdcc->slot[udata.idx_hint], TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk"); /* Reset fields about the chunk we are looking for */ udata.chunk_block.offset = HADDR_UNDEF; @@ -663,13 +637,13 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage /* Get the new file address / chunk size after flushing */ if (H5D__chunk_lookup(dset, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); } } /* Make sure the address of the chunk is returned. */ - if (!H5F_addr_defined(udata.chunk_block.offset)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined") + if (!H5_addr_defined(udata.chunk_block.offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined"); /* Return the chunk size on disk */ *storage_size = udata.chunk_block.length; @@ -685,31 +659,30 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage /*------------------------------------------------------------------------- * Function: H5D__chunk_set_info_real * - * Purpose: Internal routine to set the information about chunks for a dataset - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, June 30, 2009 + * Purpose: Internal routine to set the information about chunks for a dataset * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims, const hsize_t *max_dims) { - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity checks */ - HDassert(layout); - HDassert(ndims > 0); - HDassert(curr_dims); + assert(layout); + assert(curr_dims); + + /* Can happen when corrupt files are parsed */ + if (ndims == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "number of dimensions cannot be zero"); /* Compute the # of chunks in dataset dimensions */ - for (u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) { + layout->nchunks = 1; + layout->max_nchunks = 1; + for (unsigned u = 0; u < ndims; u++) { /* Round up to the next integer # of chunks, to accommodate partial chunks */ layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; if (H5S_UNLIMITED == max_dims[u]) @@ -717,7 +690,7 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize else { /* Sanity check */ if (layout->dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimension size must be > 0, dim = %u ", u) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimension size must be > 0, dim = %u ", u); layout->max_chunks[u] = ((max_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; } @@ -725,7 +698,7 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize /* Accumulate the # of chunks */ layout->nchunks *= layout->chunks[u]; layout->max_nchunks *= layout->max_chunks[u]; - } /* end for */ + } /* Get the "down" sizes for each dimension */ H5VM_array_down(ndims, layout->chunks, layout->down_chunks); @@ -742,9 +715,6 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, June 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -755,17 +725,17 @@ H5D__chunk_set_info(const H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(dset); + assert(dset); /* Set the base layout information */ if (H5D__chunk_set_info_real(&dset->shared->layout.u.chunk, dset->shared->ndims, dset->shared->curr_dims, dset->shared->max_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info"); /* Call the index's "resize" callback */ if (dset->shared->layout.storage.u.chunk.ops->resize && (dset->shared->layout.storage.u.chunk.ops->resize)(&dset->shared->layout.u.chunk) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to resize chunk index information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to resize chunk index information"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -778,9 +748,6 @@ H5D__chunk_set_info(const H5D_t *dset) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * December 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -794,7 +761,7 @@ H5D__chunk_set_sizes(H5D_t *dset) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(dset); + assert(dset); /* Increment # of chunk dimensions, to account for datatype size as last element */ dset->shared->layout.u.chunk.ndims++; @@ -815,7 +782,7 @@ H5D__chunk_set_sizes(H5D_t *dset) if (enc_bytes_per_dim > max_enc_bytes_per_dim) max_enc_bytes_per_dim = enc_bytes_per_dim; } /* end for */ - HDassert(max_enc_bytes_per_dim > 0 && max_enc_bytes_per_dim <= 8); + assert(max_enc_bytes_per_dim > 0 && max_enc_bytes_per_dim <= 8); dset->shared->layout.u.chunk.enc_bytes_per_dim = max_enc_bytes_per_dim; /* Compute and store the total size of a chunk */ @@ -827,7 +794,7 @@ H5D__chunk_set_sizes(H5D_t *dset) /* Check for chunk larger than can be represented in 32-bits */ /* (Chunk size is encoded in 32-bit value in v1 B-tree records) */ if (chunk_size > (uint64_t)0xffffffff) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be < 4GB") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be < 4GB"); H5_CHECKED_ASSIGN(dset->shared->layout.u.chunk.size, uint32_t, chunk_size, uint64_t); @@ -842,9 +809,6 @@ H5D__chunk_set_sizes(H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, May 22, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -856,29 +820,29 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(dset); + assert(f); + assert(dset); /* Check for invalid chunk dimension rank */ if (0 == dset->shared->layout.u.chunk.ndims) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "no chunk information set?") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "no chunk information set?"); if (dset->shared->layout.u.chunk.ndims != dset->shared->ndims) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimensionality of chunks doesn't match the dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimensionality of chunks doesn't match the dataspace"); /* Set chunk sizes */ if (H5D__chunk_set_sizes(dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes") - HDassert((unsigned)(dset->shared->layout.u.chunk.ndims) <= NELMTS(dset->shared->layout.u.chunk.dim)); + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes"); + assert((unsigned)(dset->shared->layout.u.chunk.ndims) <= NELMTS(dset->shared->layout.u.chunk.dim)); /* Chunked storage is not compatible with external storage (currently) */ if (dset->shared->dcpl_cache.efl.nused > 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "external storage not supported with chunked layout") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "external storage not supported with chunked layout"); /* Sanity check dimensions */ for (u = 0; u < dset->shared->layout.u.chunk.ndims - 1; u++) { /* Don't allow zero-sized chunk dimensions */ if (0 == dset->shared->layout.u.chunk.dim[u]) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be > 0, dim = %u ", u) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be > 0, dim = %u ", u); /* * The chunk size of a dimension with a fixed size cannot exceed @@ -888,12 +852,12 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset) if (dset->shared->curr_dims[u] && dset->shared->max_dims[u] != H5S_UNLIMITED && dset->shared->max_dims[u] < dset->shared->layout.u.chunk.dim[u]) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "chunk size must be <= maximum dimension size for fixed-sized dimensions") + "chunk size must be <= maximum dimension size for fixed-sized dimensions"); } /* end for */ /* Reset address and pointer of the array struct for the chunked storage index */ if (H5D_chunk_idx_reset(&dset->shared->layout.storage.u.chunk, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -907,9 +871,6 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, May 18, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -919,31 +880,32 @@ H5D__chunk_init(H5F_t *f, const H5D_t *const dset, hid_t dapl_id) H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Convenience pointer to dataset's chunk cache */ H5P_genplist_t *dapl; /* Data access property list object pointer */ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); + bool idx_init = false; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(dset); + assert(f); + assert(dset); H5D_CHUNK_STORAGE_INDEX_CHK(sc); if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for fapl ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for fapl ID"); /* Use the properties in dapl_id if they have been set, otherwise use the properties from the file */ if (H5P_get(dapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc->nslots) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get data cache number of slots") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get data cache number of slots"); if (rdcc->nslots == H5D_CHUNK_CACHE_NSLOTS_DEFAULT) rdcc->nslots = H5F_RDCC_NSLOTS(f); if (H5P_get(dapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc->nbytes_max) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get data cache byte size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get data cache byte size"); if (rdcc->nbytes_max == H5D_CHUNK_CACHE_NBYTES_DEFAULT) rdcc->nbytes_max = H5F_RDCC_NBYTES(f); if (H5P_get(dapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc->w0) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get preempt read chunks") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get preempt read chunks"); if (rdcc->w0 < 0) rdcc->w0 = H5F_RDCC_W0(f); @@ -953,7 +915,7 @@ H5D__chunk_init(H5F_t *f, const H5D_t *const dset, hid_t dapl_id) else { rdcc->slot = H5FL_SEQ_CALLOC(H5D_rdcc_ent_ptr_t, rdcc->nslots); if (NULL == rdcc->slot) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Reset any cached chunk info for this dataset */ H5D__chunk_cinfo_cache_reset(&(rdcc->last)); @@ -968,14 +930,14 @@ H5D__chunk_init(H5F_t *f, const H5D_t *const dset, hid_t dapl_id) /* Initial scaled dimension sizes */ if (dset->shared->layout.u.chunk.dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u); /* Round up to the next integer # of chunks, to accommodate partial chunks */ rdcc->scaled_dims[u] = (dset->shared->curr_dims[u] + dset->shared->layout.u.chunk.dim[u] - 1) / dset->shared->layout.u.chunk.dim[u]; if (!(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u]))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2"); /* Initial 'power2up' values for scaled dimensions */ rdcc->scaled_power2up[u] = scaled_power2up; @@ -993,13 +955,21 @@ H5D__chunk_init(H5F_t *f, const H5D_t *const dset, hid_t dapl_id) /* Allocate any indexing structures */ if (sc->ops->init && (sc->ops->init)(&idx_info, dset->shared->space, dset->oloc.addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information"); + idx_init = true; /* Set the number of chunks in dataset, etc. */ if (H5D__chunk_set_info(dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set # of chunks for dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set # of chunks for dataset"); done: + if (FAIL == ret_value) { + if (rdcc->slot) + rdcc->slot = H5FL_SEQ_FREE(H5D_rdcc_ent_ptr_t, rdcc->slot); + + if (idx_init && sc->ops->dest && (sc->ops->dest)(&idx_info) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info"); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_init() */ @@ -1010,9 +980,6 @@ H5D__chunk_init(H5F_t *f, const H5D_t *const dset, hid_t dapl_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 15, 2009 - * *------------------------------------------------------------------------- */ hbool_t @@ -1024,7 +991,7 @@ H5D__chunk_is_space_alloc(const H5O_storage_t *storage) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(storage); + assert(storage); H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Query index layer */ @@ -1040,9 +1007,6 @@ H5D__chunk_is_space_alloc(const H5O_storage_t *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Wednesday, March 6, 2016 - * *------------------------------------------------------------------------- */ hbool_t @@ -1051,7 +1015,7 @@ H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(shared_dset); + assert(shared_dset); FUNC_LEAVE_NOAPI(shared_dset->cache.chunk.nused > 0) } /* end H5D__chunk_is_data_cached() */ @@ -1063,33 +1027,43 @@ H5D__chunk_is_data_cached(const H5D_shared_t *shared_dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2008 - * *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm) +H5D__chunk_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo) { - const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */ - hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */ - htri_t file_space_normalized = FALSE; /* File dataspace was normalized */ - unsigned f_ndims; /* The number of dimensions of the file's dataspace */ - int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */ - htri_t use_selection_io = FALSE; /* Whether to use selection I/O */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5D_t *dataset = dinfo->dset; /* Local pointer to dataset info */ + H5D_chunk_map_t *fm; /* Convenience pointer to chunk map */ + hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */ + htri_t file_space_normalized = FALSE; /* File dataspace was normalized */ + unsigned f_ndims; /* The number of dimensions of the file's dataspace */ + int sm_ndims; /* The number of dimensions of the memory buffer's dataspace (signed) */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE + /* Allocate chunk map */ + if (NULL == (dinfo->layout_io_info.chunk_map = H5FL_MALLOC(H5D_chunk_map_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk map"); + fm = dinfo->layout_io_info.chunk_map; + /* Get layout for dataset */ - fm->layout = &(dataset->shared->layout); - fm->nelmts = nelmts; + dinfo->layout = &(dataset->shared->layout); + + /* Initialize "last chunk" information */ + fm->last_index = (hsize_t)-1; + fm->last_piece_info = NULL; + + /* Clear other fields */ + fm->mchunk_tmpl = NULL; + fm->dset_sel_pieces = NULL; + fm->single_space = NULL; + fm->single_piece_info = NULL; /* Check if the memory space is scalar & make equivalent memory space */ - if ((sm_ndims = H5S_GET_EXTENT_NDIMS(mem_space)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number") + if ((sm_ndims = H5S_GET_EXTENT_NDIMS(dinfo->mem_space)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number"); /* Set the number of dimensions for the memory dataspace */ H5_CHECKED_ASSIGN(fm->m_ndims, unsigned, sm_ndims, int); @@ -1102,50 +1076,48 @@ H5D__chunk_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsi * speed up hyperslab calculations by removing the extra checks and/or * additions involving the offset and the hyperslab selection -QAK) */ - if ((file_space_normalized = H5S_hyper_normalize_offset(file_space, old_offset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to normalize selection") + if ((file_space_normalized = H5S_hyper_normalize_offset(dinfo->file_space, old_offset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to normalize selection"); /* Decide the number of chunks in each dimension */ for (u = 0; u < f_ndims; u++) /* Keep the size of the chunk dimensions as hsize_t for various routines */ - fm->chunk_dim[u] = fm->layout->u.chunk.dim[u]; + fm->chunk_dim[u] = dinfo->layout->u.chunk.dim[u]; -#ifdef H5_HAVE_PARALLEL - /* Calculate total chunk in file map*/ - fm->select_chunk = NULL; - if (io_info->using_mpi_vfd) { - H5_CHECK_OVERFLOW(fm->layout->u.chunk.nchunks, hsize_t, size_t); - if (fm->layout->u.chunk.nchunks) - if (NULL == (fm->select_chunk = (H5D_chunk_info_t **)H5MM_calloc( - (size_t)fm->layout->u.chunk.nchunks * sizeof(H5D_chunk_info_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info") - } /* end if */ -#endif /* H5_HAVE_PARALLEL */ + if (H5D__chunk_io_init_selections(io_info, dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file and memory chunk selections"); - /* Initialize "last chunk" information */ - fm->last_index = (hsize_t)-1; - fm->last_chunk_info = NULL; + /* Check if we're performing selection I/O and save the result if it hasn't + * been disabled already */ + if (io_info->use_select_io != H5D_SELECTION_IO_MODE_OFF) + if (H5D__chunk_may_use_select_io(io_info, dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if selection I/O is possible"); - /* Point at the dataspaces */ - fm->file_space = file_space; - fm->mem_space = mem_space; + /* Calculate type conversion buffer size if necessary. Currently only implemented for selection I/O. */ + if (io_info->use_select_io != H5D_SELECTION_IO_MODE_OFF && + !(dinfo->type_info.is_xform_noop && dinfo->type_info.is_conv_noop)) { + H5SL_node_t *chunk_node; /* Current node in chunk skip list */ - if (H5D__chunk_io_init_selections(io_info, type_info, fm) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file and memory chunk selections") + /* Iterate through nodes in chunk skip list */ + chunk_node = H5D_CHUNK_GET_FIRST_NODE(dinfo); + while (chunk_node) { + H5D_piece_info_t *piece_info; /* Chunk information */ - /* Check if we're performing selection I/O and save the result */ - if ((use_selection_io = H5D__chunk_may_use_select_io(io_info)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if selection I/O is possible") - io_info->use_select_io = (hbool_t)use_selection_io; + /* Get the actual chunk information from the skip list node */ + piece_info = H5D_CHUNK_GET_NODE_INFO(dinfo, chunk_node); -done: - /* Reset the global dataspace info */ - fm->file_space = NULL; - fm->mem_space = NULL; + /* Handle type conversion buffer */ + H5D_INIT_PIECE_TCONV(io_info, dinfo, piece_info) + /* Advance to next chunk in list */ + chunk_node = H5D_CHUNK_GET_NEXT_NODE(dinfo, chunk_node); + } + } + +done: if (file_space_normalized == TRUE) - if (H5S_hyper_denormalize_offset(file_space, old_offset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection") + if (H5S_hyper_denormalize_offset(dinfo->file_space, old_offset) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't denormalize selection"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_io_init() */ @@ -1157,67 +1129,74 @@ H5D__chunk_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsi * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2008 - * *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5D_chunk_map_t *fm) +H5D__chunk_io_init_selections(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo) { - const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */ - const H5T_t *mem_type = type_info->mem_type; /* Local pointer to memory datatype */ - H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */ - H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */ - hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ - char bogus; /* "bogus" buffer to pass to selection iterator */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_chunk_map_t *fm; /* Convenience pointer to chunk map */ + const H5D_t *dataset; /* Local pointer to dataset info */ + const H5T_t *mem_type; /* Local pointer to memory datatype */ + H5S_t *tmp_mspace = NULL; /* Temporary memory dataspace */ + H5T_t *file_type = NULL; /* Temporary copy of file datatype for iteration */ + hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ + char bogus; /* "bogus" buffer to pass to selection iterator */ + H5D_io_info_wrap_t io_info_wrap; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE + assert(io_info); + assert(dinfo); + + /* Set convenience pointers */ + fm = dinfo->layout_io_info.chunk_map; + assert(fm); + dataset = dinfo->dset; + mem_type = dinfo->type_info.mem_type; + /* Special case for only one element in selection */ /* (usually appending a record) */ - if (fm->nelmts == 1 + if (dinfo->nelmts == 1 #ifdef H5_HAVE_PARALLEL && !(io_info->using_mpi_vfd) #endif /* H5_HAVE_PARALLEL */ - && H5S_SEL_ALL != H5S_GET_SELECT_TYPE(fm->file_space)) { + && H5S_SEL_ALL != H5S_GET_SELECT_TYPE(dinfo->file_space)) { /* Initialize skip list for chunk selections */ - fm->sel_chunks = NULL; fm->use_single = TRUE; /* Initialize single chunk dataspace */ if (NULL == dataset->shared->cache.chunk.single_space) { /* Make a copy of the dataspace for the dataset */ - if ((dataset->shared->cache.chunk.single_space = H5S_copy(fm->file_space, TRUE, FALSE)) == NULL) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space") + if ((dataset->shared->cache.chunk.single_space = H5S_copy(dinfo->file_space, TRUE, FALSE)) == + NULL) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file space"); /* Resize chunk's dataspace dimensions to size of chunk */ if (H5S_set_extent_real(dataset->shared->cache.chunk.single_space, fm->chunk_dim) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust chunk dimensions") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust chunk dimensions"); /* Set the single chunk dataspace to 'all' selection */ if (H5S_select_all(dataset->shared->cache.chunk.single_space, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to set all selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to set all selection"); } /* end if */ fm->single_space = dataset->shared->cache.chunk.single_space; - HDassert(fm->single_space); + assert(fm->single_space); /* Allocate the single chunk information */ - if (NULL == dataset->shared->cache.chunk.single_chunk_info) - if (NULL == (dataset->shared->cache.chunk.single_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info") - fm->single_chunk_info = dataset->shared->cache.chunk.single_chunk_info; - HDassert(fm->single_chunk_info); + if (NULL == dataset->shared->cache.chunk.single_piece_info) + if (NULL == (dataset->shared->cache.chunk.single_piece_info = H5FL_MALLOC(H5D_piece_info_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info"); + fm->single_piece_info = dataset->shared->cache.chunk.single_piece_info; + assert(fm->single_piece_info); /* Reset chunk template information */ fm->mchunk_tmpl = NULL; /* Set up chunk mapping for single element */ - if (H5D__create_chunk_map_single(fm, io_info) < 0) + if (H5D__create_piece_map_single(dinfo, io_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to create chunk selections for single element") + "unable to create chunk selections for single element"); } /* end if */ else { hbool_t sel_hyper_flag; /* Whether file selection is a hyperslab */ @@ -1225,18 +1204,18 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ /* Initialize skip list for chunk selections */ if (NULL == dataset->shared->cache.chunk.sel_chunks) if (NULL == (dataset->shared->cache.chunk.sel_chunks = H5SL_create(H5SL_TYPE_HSIZE, NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for chunk selections") - fm->sel_chunks = dataset->shared->cache.chunk.sel_chunks; - HDassert(fm->sel_chunks); + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for chunk selections"); + fm->dset_sel_pieces = dataset->shared->cache.chunk.sel_chunks; + assert(fm->dset_sel_pieces); /* We are not using single element mode */ fm->use_single = FALSE; /* Get type of selection on disk & in memory */ - if ((fm->fsel_type = H5S_GET_SELECT_TYPE(fm->file_space)) < H5S_SEL_NONE) - HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection") - if ((fm->msel_type = H5S_GET_SELECT_TYPE(fm->mem_space)) < H5S_SEL_NONE) - HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection") + if ((fm->fsel_type = H5S_GET_SELECT_TYPE(dinfo->file_space)) < H5S_SEL_NONE) + HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection"); + if ((fm->msel_type = H5S_GET_SELECT_TYPE(dinfo->mem_space)) < H5S_SEL_NONE) + HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection"); /* If the selection is NONE or POINTS, set the flag to FALSE */ if (fm->fsel_type == H5S_SEL_POINTS || fm->fsel_type == H5S_SEL_NONE) @@ -1248,70 +1227,66 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ if (sel_hyper_flag) { /* Build the file selection for each chunk */ if (H5S_SEL_ALL == fm->fsel_type) { - if (H5D__create_chunk_file_map_all(fm, io_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") + if (H5D__create_piece_file_map_all(dinfo, io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections"); } /* end if */ else { /* Sanity check */ - HDassert(fm->fsel_type == H5S_SEL_HYPERSLABS); + assert(fm->fsel_type == H5S_SEL_HYPERSLABS); - if (H5D__create_chunk_file_map_hyper(fm, io_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") + if (H5D__create_piece_file_map_hyper(dinfo, io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections"); } /* end else */ } /* end if */ else { - H5S_sel_iter_op_t iter_op; /* Operator for iteration */ - H5D_chunk_file_iter_ud_t udata; /* User data for iteration */ + H5S_sel_iter_op_t iter_op; /* Operator for iteration */ /* Create temporary datatypes for selection iteration */ if (NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype") - - /* Initialize the user data */ - udata.fm = fm; -#ifdef H5_HAVE_PARALLEL - udata.io_info = io_info; -#endif /* H5_HAVE_PARALLEL */ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype"); - iter_op.op_type = H5S_SEL_ITER_OP_LIB; - iter_op.u.lib_op = H5D__chunk_file_cb; + /* set opdata for H5D__piece_mem_cb */ + io_info_wrap.io_info = io_info; + io_info_wrap.dinfo = dinfo; + iter_op.op_type = H5S_SEL_ITER_OP_LIB; + iter_op.u.lib_op = H5D__piece_file_cb; /* Spaces might not be the same shape, iterate over the file selection directly */ - if (H5S_select_iterate(&bogus, file_type, fm->file_space, &iter_op, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") + if (H5S_select_iterate(&bogus, file_type, dinfo->file_space, &iter_op, &io_info_wrap) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections"); - /* Reset "last chunk" info */ + /* Reset "last piece" info */ fm->last_index = (hsize_t)-1; - fm->last_chunk_info = NULL; + fm->last_piece_info = NULL; } /* end else */ /* Build the memory selection for each chunk */ - if (sel_hyper_flag && H5S_SELECT_SHAPE_SAME(fm->file_space, fm->mem_space) == TRUE) { + if (sel_hyper_flag && H5S_SELECT_SHAPE_SAME(dinfo->file_space, dinfo->mem_space) == TRUE) { /* Reset chunk template information */ fm->mchunk_tmpl = NULL; - /* If the selections are the same shape, use the file chunk information - * to generate the memory chunk information quickly. + /* If the selections are the same shape, use the file chunk + * information to generate the memory chunk information quickly. */ - if (H5D__create_chunk_mem_map_hyper(fm) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections") + if (H5D__create_piece_mem_map_hyper(dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections"); } /* end if */ else if (sel_hyper_flag && fm->f_ndims == 1 && fm->m_ndims == 1 && - H5S_SELECT_IS_REGULAR(fm->mem_space) && H5S_SELECT_IS_SINGLE(fm->mem_space)) { - if (H5D__create_chunk_mem_map_1d(fm) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections") + H5S_SELECT_IS_REGULAR(dinfo->mem_space) && H5S_SELECT_IS_SINGLE(dinfo->mem_space)) { + if (H5D__create_piece_mem_map_1d(dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create file chunk selections"); } /* end else-if */ else { H5S_sel_iter_op_t iter_op; /* Operator for iteration */ size_t elmt_size; /* Memory datatype size */ /* Make a copy of equivalent memory space */ - if ((tmp_mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") + if ((tmp_mspace = H5S_copy(dinfo->mem_space, TRUE, FALSE)) == NULL) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space"); /* De-select the mem space copy */ if (H5S_select_none(tmp_mspace) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select memory space") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select memory space"); /* Save chunk template information */ fm->mchunk_tmpl = tmp_mspace; @@ -1319,21 +1294,24 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ /* Create temporary datatypes for selection iteration */ if (!file_type) if (NULL == (file_type = H5T_copy(dataset->shared->type, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy file datatype"); /* Create selection iterator for memory selection */ if (0 == (elmt_size = H5T_get_size(mem_type))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid") - if (H5S_select_iter_init(&(fm->mem_iter), fm->mem_space, elmt_size, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid"); + if (H5S_select_iter_init(&(fm->mem_iter), dinfo->mem_space, elmt_size, 0) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); iter_init = TRUE; /* Selection iteration info has been initialized */ - iter_op.op_type = H5S_SEL_ITER_OP_LIB; - iter_op.u.lib_op = H5D__chunk_mem_cb; + /* set opdata for H5D__piece_mem_cb */ + io_info_wrap.io_info = io_info; + io_info_wrap.dinfo = dinfo; + iter_op.op_type = H5S_SEL_ITER_OP_LIB; + iter_op.u.lib_op = H5D__piece_mem_cb; /* Spaces aren't the same shape, iterate over the memory selection directly */ - if (H5S_select_iterate(&bogus, file_type, fm->file_space, &iter_op, fm) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections") + if (H5S_select_iterate(&bogus, file_type, dinfo->file_space, &iter_op, &io_info_wrap) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create memory chunk selections"); } /* end else */ } /* end else */ @@ -1343,15 +1321,15 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ if (tmp_mspace && !fm->mchunk_tmpl) if (H5S_close(tmp_mspace) < 0) HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, - "can't release memory chunk dataspace template") - if (H5D__chunk_io_term(fm) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping") + "can't release memory chunk dataspace template"); + if (H5D__chunk_io_term(io_info, dinfo) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release chunk mapping"); } /* end if */ if (iter_init && H5S_SELECT_ITER_RELEASE(&(fm->mem_iter)) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); if (file_type && (H5T_close_real(file_type) < 0)) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Can't free temporary datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "Can't free temporary datatype"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_io_init_selections() */ @@ -1365,9 +1343,6 @@ H5D__chunk_io_init_selections(const H5D_io_info_t *io_info, const H5D_type_info_ * * Return: Pointer to memory for chunk on success/NULL on failure * - * Programmer: Quincey Koziol - * April 22, 2004 - * *------------------------------------------------------------------------- */ void * @@ -1378,7 +1353,7 @@ H5D__chunk_mem_alloc(size_t size, void *pline) FUNC_ENTER_PACKAGE_NOERR - HDassert(size); + assert(size); if (_pline && _pline->nused) ret_value = H5MM_malloc(size); @@ -1397,9 +1372,6 @@ H5D__chunk_mem_alloc(size_t size, void *pline) * * Return: NULL (never fails) * - * Programmer: Quincey Koziol - * April 22, 2004 - * *------------------------------------------------------------------------- */ void * @@ -1441,9 +1413,6 @@ H5D__chunk_mem_free(void *chk, void *pline) * * Return: Pointer to memory for chunk on success/NULL on failure * - * Programmer: Neil Fortner - * May 3, 2010 - * *------------------------------------------------------------------------- */ void * @@ -1453,8 +1422,8 @@ H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline) FUNC_ENTER_PACKAGE_NOERR - HDassert(size); - HDassert(pline); + assert(size); + assert(pline); if (pline->nused > 0) ret_value = H5MM_realloc(chk, size); @@ -1466,14 +1435,17 @@ H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline) /*-------------------------------------------------------------------------- NAME - H5D__free_chunk_info + H5D__free_piece_info PURPOSE - Internal routine to destroy a chunk info node + Performs initialization before any sort of I/O on the raw data + This was derived from H5D__free_chunk_info for multi-dset work. USAGE - void H5D__free_chunk_info(chunk_info) + herr_t H5D__free_piece_info(chunk_info, key, opdata) void *chunk_info; IN: Pointer to chunk info to destroy + void *key; Unused + void *opdata; Unused RETURNS - No return value + Non-negative on success, negative on failure DESCRIPTION Releases all the memory for a chunk info node. Called by H5SL_free GLOBAL VARIABLES @@ -1481,51 +1453,47 @@ H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static herr_t -H5D__free_chunk_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *opdata) +herr_t +H5D__free_piece_info(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *opdata) { - H5D_chunk_info_t *chunk_info = (H5D_chunk_info_t *)item; + H5D_piece_info_t *piece_info = (H5D_piece_info_t *)item; FUNC_ENTER_PACKAGE_NOERR - HDassert(chunk_info); + assert(piece_info); - /* Close the chunk's file dataspace, if it's not shared */ - if (!chunk_info->fspace_shared) - (void)H5S_close(chunk_info->fspace); + /* Close the piece's file dataspace, if it's not shared */ + if (!piece_info->fspace_shared) + (void)H5S_close(piece_info->fspace); else - H5S_select_all(chunk_info->fspace, TRUE); + H5S_select_all(piece_info->fspace, TRUE); - /* Close the chunk's memory dataspace, if it's not shared */ - if (!chunk_info->mspace_shared && chunk_info->mspace) - (void)H5S_close(chunk_info->mspace); + /* Close the piece's memory dataspace, if it's not shared */ + if (!piece_info->mspace_shared && piece_info->mspace) + (void)H5S_close((H5S_t *)piece_info->mspace); - /* Free the actual chunk info */ - chunk_info = H5FL_FREE(H5D_chunk_info_t, chunk_info); + /* Free the actual piece info */ + piece_info = H5FL_FREE(H5D_piece_info_t, piece_info); FUNC_LEAVE_NOAPI(0) -} /* H5D__free_chunk_info() */ +} /* H5D__free_piece_info() */ /*------------------------------------------------------------------------- - * Function: H5D__create_chunk_map_single + * Function: H5D__create_piece_map_single * - * Purpose: Create chunk selections when appending a single record + * Purpose: Create piece selections when appending a single record + * This was derived from H5D__create_chunk_map_single for + * multi-dset work. * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 20, 2007 - * *------------------------------------------------------------------------- */ static herr_t -H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t -#ifndef H5_HAVE_PARALLEL - H5_ATTR_UNUSED -#endif /* H5_HAVE_PARALLEL */ - *io_info) +H5D__create_piece_map_single(H5D_dset_io_info_t *di, H5D_io_info_t *io_info) { - H5D_chunk_info_t *chunk_info; /* Chunk information to insert into skip list */ + H5D_chunk_map_t *fm; /* Convenience pointer to chunk map */ + H5D_piece_info_t *piece_info; /* Piece information to insert into skip list */ hsize_t coords[H5O_LAYOUT_NDIMS]; /* Coordinates of chunk */ hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ @@ -1534,90 +1502,92 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(fm->f_ndims > 0); + /* Set convenience pointer */ + fm = di->layout_io_info.chunk_map; + + /* Sanity checks */ + assert(fm); + assert(fm->f_ndims > 0); /* Get coordinate for selection */ - if (H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info") + if (H5S_SELECT_BOUNDS(di->file_space, sel_start, sel_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info"); - /* Initialize the 'single chunk' file & memory chunk information */ - chunk_info = fm->single_chunk_info; - chunk_info->chunk_points = 1; + /* Initialize the 'single piece' file & memory piece information */ + piece_info = fm->single_piece_info; + piece_info->piece_points = 1; /* Set chunk location & hyperslab size */ for (u = 0; u < fm->f_ndims; u++) { /* Validate this chunk dimension */ - if (fm->layout->u.chunk.dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) - HDassert(sel_start[u] == sel_end[u]); - chunk_info->scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u]; - coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u]; + if (di->layout->u.chunk.dim[u] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u); + assert(sel_start[u] == sel_end[u]); + piece_info->scaled[u] = sel_start[u] / di->layout->u.chunk.dim[u]; + coords[u] = piece_info->scaled[u] * di->layout->u.chunk.dim[u]; } /* end for */ - chunk_info->scaled[fm->f_ndims] = 0; + piece_info->scaled[fm->f_ndims] = 0; /* Calculate the index of this chunk */ - chunk_info->index = - H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, chunk_info->scaled); + piece_info->index = + H5VM_array_offset_pre(fm->f_ndims, di->layout->u.chunk.down_chunks, piece_info->scaled); /* Copy selection for file's dataspace into chunk dataspace */ - if (H5S_select_copy(fm->single_space, fm->file_space, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection") + if (H5S_select_copy(fm->single_space, di->file_space, FALSE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy file selection"); /* Move selection back to have correct offset in chunk */ if (H5S_SELECT_ADJUST_U(fm->single_space, coords) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection") - -#ifdef H5_HAVE_PARALLEL - /* store chunk selection information */ - if (io_info->using_mpi_vfd) - fm->select_chunk[chunk_info->index] = chunk_info; -#endif /* H5_HAVE_PARALLEL */ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't adjust chunk selection"); /* Set the file dataspace for the chunk to the shared 'single' dataspace */ - chunk_info->fspace = fm->single_space; + piece_info->fspace = fm->single_space; /* Indicate that the chunk's file dataspace is shared */ - chunk_info->fspace_shared = TRUE; + piece_info->fspace_shared = TRUE; /* Just point at the memory dataspace & selection */ - chunk_info->mspace = fm->mem_space; + piece_info->mspace = di->mem_space; /* Indicate that the chunk's memory dataspace is shared */ - chunk_info->mspace_shared = TRUE; + piece_info->mspace_shared = TRUE; + + /* Initialize in-place type conversion info. Start with it disabled. */ + piece_info->in_place_tconv = FALSE; + piece_info->buf_off = 0; + + /* make connection to related dset info from this piece_info */ + piece_info->dset_info = di; + + /* Add piece to global piece_count */ + io_info->piece_count++; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__create_chunk_map_single() */ +} /* end H5D__create_piece_map_single() */ /*------------------------------------------------------------------------- - * Function: H5D__create_chunk_file_map_all + * Function: H5D__create_piece_file_map_all * * Purpose: Create all chunk selections in file, for an "all" selection. * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, January 21, 2019 - * *------------------------------------------------------------------------- */ static herr_t -H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t -#ifndef H5_HAVE_PARALLEL - H5_ATTR_UNUSED -#endif /* H5_HAVE_PARALLEL */ - *io_info) +H5D__create_piece_file_map_all(H5D_dset_io_info_t *di, H5D_io_info_t *io_info) { - H5S_t *tmp_fchunk = NULL; /* Temporary file dataspace */ - hsize_t file_dims[H5S_MAX_RANK]; /* File dataspace dims */ - hsize_t sel_points; /* Number of elements in file selection */ - hsize_t zeros[H5S_MAX_RANK]; /* All zero vector (for start parameter to setting hyperslab on partial - chunks) */ - hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */ - hsize_t end[H5S_MAX_RANK]; /* Final coordinates of chunk */ - hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ - hsize_t chunk_index; /* "Index" of chunk */ + H5D_chunk_map_t *fm; /* Convenience pointer to chunk map */ + H5S_t *tmp_fchunk = NULL; /* Temporary file dataspace */ + hsize_t file_dims[H5S_MAX_RANK]; /* File dataspace dims */ + hsize_t sel_points; /* Number of elements in file selection */ + hsize_t zeros[H5S_MAX_RANK]; /* All zero vector (for start parameter to setting hyperslab on partial + chunks) */ + hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */ + hsize_t end[H5S_MAX_RANK]; /* Final coordinates of chunk */ + hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ + hsize_t chunk_index; /* "Index" of chunk */ hsize_t curr_partial_clip[H5S_MAX_RANK]; /* Current partial dimension sizes to clip against */ hsize_t partial_dim_size[H5S_MAX_RANK]; /* Size of a partial dimension */ hbool_t is_partial_dim[H5S_MAX_RANK]; /* Whether a dimension is currently a partial chunk */ @@ -1627,23 +1597,27 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(fm->f_ndims > 0); + /* Set convenience pointer */ + fm = di->layout_io_info.chunk_map; + + /* Sanity checks */ + assert(fm); + assert(fm->f_ndims > 0); /* Get number of elements selected in file */ - sel_points = fm->nelmts; + sel_points = di->nelmts; /* Get dataspace dimensions */ - if (H5S_get_simple_extent_dims(fm->file_space, file_dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info") + if (H5S_get_simple_extent_dims(di->file_space, file_dims, NULL) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info"); /* Set initial chunk location, partial dimensions, etc */ num_partial_dims = 0; - HDmemset(zeros, 0, sizeof(zeros)); + memset(zeros, 0, sizeof(zeros)); for (u = 0; u < fm->f_ndims; u++) { /* Validate this chunk dimension */ - if (fm->layout->u.chunk.dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) + if (di->layout->u.chunk.dim[u] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u); /* Set up start / end coordinates for first chunk */ scaled[u] = 0; @@ -1668,58 +1642,62 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t /* Create "temporary" chunk for selection operations (copy file space) */ if (NULL == (tmp_fchunk = H5S_create_simple(fm->f_ndims, fm->chunk_dim, NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk"); /* Iterate through each chunk in the dataset */ while (sel_points) { - H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */ + H5D_piece_info_t *new_piece_info; /* Piece information to insert into skip list */ hsize_t chunk_points; /* Number of elements in chunk selection */ - /* Add temporary chunk to the list of chunks */ + /* Add temporary chunk to the list of pieces */ /* Allocate the file & memory chunk information */ - if (NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk info") + if (NULL == (new_piece_info = H5FL_MALLOC(H5D_piece_info_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate piece info"); /* Initialize the chunk information */ /* Set the chunk index */ - new_chunk_info->index = chunk_index; - -#ifdef H5_HAVE_PARALLEL - /* Store chunk selection information, for multi-chunk I/O */ - if (io_info->using_mpi_vfd) - fm->select_chunk[chunk_index] = new_chunk_info; -#endif /* H5_HAVE_PARALLEL */ + new_piece_info->index = chunk_index; /* Set the file chunk dataspace */ - if (NULL == (new_chunk_info->fspace = H5S_copy(tmp_fchunk, TRUE, FALSE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy chunk dataspace") - new_chunk_info->fspace_shared = FALSE; + if (NULL == (new_piece_info->fspace = H5S_copy(tmp_fchunk, TRUE, FALSE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy chunk dataspace"); + new_piece_info->fspace_shared = FALSE; /* If there are partial dimensions for this chunk, set the hyperslab for them */ if (num_partial_dims > 0) - if (H5S_select_hyperslab(new_chunk_info->fspace, H5S_SELECT_SET, zeros, NULL, curr_partial_clip, + if (H5S_select_hyperslab(new_piece_info->fspace, H5S_SELECT_SET, zeros, NULL, curr_partial_clip, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk selection"); /* Set the memory chunk dataspace */ - new_chunk_info->mspace = NULL; - new_chunk_info->mspace_shared = FALSE; + new_piece_info->mspace = NULL; + new_piece_info->mspace_shared = FALSE; /* Copy the chunk's scaled coordinates */ - H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); - new_chunk_info->scaled[fm->f_ndims] = 0; + H5MM_memcpy(new_piece_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + new_piece_info->scaled[fm->f_ndims] = 0; + + /* make connection to related dset info from this piece_info */ + new_piece_info->dset_info = di; + + /* Initialize in-place type conversion info. Start with it disabled. */ + new_piece_info->in_place_tconv = FALSE; + new_piece_info->buf_off = 0; /* Insert the new chunk into the skip list */ - if (H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) { - H5D__free_chunk_info(new_chunk_info, NULL, NULL); - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert chunk into skip list") + if (H5SL_insert(fm->dset_sel_pieces, new_piece_info, &new_piece_info->index) < 0) { + H5D__free_piece_info(new_piece_info, NULL, NULL); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert chunk into skip list"); } /* end if */ + /* Add piece to global piece_count*/ + io_info->piece_count++; + /* Get number of elements selected in chunk */ - chunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace); - H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, chunk_points, hsize_t); + chunk_points = H5S_GET_SELECT_NPOINTS(new_piece_info->fspace); + new_piece_info->piece_points = chunk_points; /* Decrement # of points left in file selection */ sel_points -= chunk_points; @@ -1750,7 +1728,7 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t /* Check for previous partial chunk in this dimension */ if (is_partial_dim[curr_dim] && end[curr_dim] < file_dims[curr_dim]) { /* Sanity check */ - HDassert(num_partial_dims > 0); + assert(num_partial_dims > 0); /* Reset partial chunk information for this dimension */ curr_partial_clip[curr_dim] = fm->chunk_dim[curr_dim]; @@ -1781,7 +1759,7 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t num_partial_dims++; /* Sanity check */ - HDassert(num_partial_dims <= fm->f_ndims); + assert(num_partial_dims <= fm->f_ndims); } /* end if */ } /* end if */ } /* end if */ @@ -1790,138 +1768,142 @@ H5D__create_chunk_file_map_all(H5D_chunk_map_t *fm, const H5D_io_info_t done: /* Clean up */ if (tmp_fchunk && H5S_close(tmp_fchunk) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release temporary dataspace") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release temporary dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__create_chunk_file_map_all() */ /*------------------------------------------------------------------------- - * Function: H5D__create_chunk_file_map_hyper + * Function: H5D__create_piece_file_map_hyper * - * Purpose: Create all chunk selections in file, for a hyperslab selection. + * Purpose: Create all chunk selections in file. + * This was derived from H5D__create_chunk_file_map_hyper for + * multi-dset work. * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, May 29, 2003 - * *------------------------------------------------------------------------- */ static herr_t -H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t -#ifndef H5_HAVE_PARALLEL - H5_ATTR_UNUSED -#endif /* H5_HAVE_PARALLEL */ - *io_info) +H5D__create_piece_file_map_hyper(H5D_dset_io_info_t *dinfo, H5D_io_info_t *io_info) { - H5S_t *tmp_fchunk = NULL; /* Temporary file dataspace */ - hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ - hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ - hsize_t sel_points; /* Number of elements in file selection */ - hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */ - hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ - hsize_t end[H5O_LAYOUT_NDIMS]; /* Final coordinates of chunk */ - hsize_t chunk_index; /* Index of chunk */ - hsize_t start_scaled[H5S_MAX_RANK]; /* Starting scaled coordinates of selection */ - hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ - int curr_dim; /* Current dimension to increment */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_chunk_map_t *fm; /* Convenience pointer to chunk map */ + H5S_t *tmp_fchunk = NULL; /* Temporary file dataspace */ + hsize_t sel_start[H5O_LAYOUT_NDIMS]; /* Offset of low bound of file selection */ + hsize_t sel_end[H5O_LAYOUT_NDIMS]; /* Offset of high bound of file selection */ + hsize_t sel_points; /* Number of elements in file selection */ + hsize_t start_coords[H5O_LAYOUT_NDIMS]; /* Starting coordinates of selection */ + hsize_t coords[H5O_LAYOUT_NDIMS]; /* Current coordinates of chunk */ + hsize_t end[H5O_LAYOUT_NDIMS]; /* Final coordinates of chunk */ + hsize_t chunk_index; /* Index of chunk */ + hsize_t start_scaled[H5S_MAX_RANK]; /* Starting scaled coordinates of selection */ + hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ + int curr_dim; /* Current dimension to increment */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(fm->f_ndims > 0); + /* Set convenience pointer */ + fm = dinfo->layout_io_info.chunk_map; + + /* Sanity checks */ + assert(fm); + assert(fm->f_ndims > 0); /* Get number of elements selected in file */ - sel_points = fm->nelmts; + sel_points = dinfo->nelmts; /* Get bounding box for selection (to reduce the number of chunks to iterate over) */ - if (H5S_SELECT_BOUNDS(fm->file_space, sel_start, sel_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info") + if (H5S_SELECT_BOUNDS(dinfo->file_space, sel_start, sel_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info"); /* Set initial chunk location & hyperslab size */ for (u = 0; u < fm->f_ndims; u++) { /* Validate this chunk dimension */ - if (fm->layout->u.chunk.dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u) - scaled[u] = start_scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u]; - coords[u] = start_coords[u] = scaled[u] * fm->layout->u.chunk.dim[u]; + if (dinfo->layout->u.chunk.dim[u] == 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u); + scaled[u] = start_scaled[u] = sel_start[u] / dinfo->layout->u.chunk.dim[u]; + coords[u] = start_coords[u] = scaled[u] * dinfo->layout->u.chunk.dim[u]; end[u] = (coords[u] + fm->chunk_dim[u]) - 1; } /* end for */ /* Calculate the index of this chunk */ - chunk_index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, scaled); + chunk_index = H5VM_array_offset_pre(fm->f_ndims, dinfo->layout->u.chunk.down_chunks, scaled); /* Iterate through each chunk in the dataset */ while (sel_points) { /* Check for intersection of current chunk and file selection */ - if (TRUE == H5S_SELECT_INTERSECT_BLOCK(fm->file_space, coords, end)) { - H5D_chunk_info_t *new_chunk_info; /* chunk information to insert into skip list */ + if (TRUE == H5S_SELECT_INTERSECT_BLOCK(dinfo->file_space, coords, end)) { + H5D_piece_info_t *new_piece_info; /* chunk information to insert into skip list */ hsize_t chunk_points; /* Number of elements in chunk selection */ /* Create dataspace for chunk, 'AND'ing the overall selection with * the current chunk. */ - if (H5S_combine_hyperslab(fm->file_space, H5S_SELECT_AND, coords, NULL, fm->chunk_dim, NULL, + if (H5S_combine_hyperslab(dinfo->file_space, H5S_SELECT_AND, coords, NULL, fm->chunk_dim, NULL, &tmp_fchunk) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, - "unable to combine file space selection with chunk block") + "unable to combine file space selection with chunk block"); /* Resize chunk's dataspace dimensions to size of chunk */ if (H5S_set_extent_real(tmp_fchunk, fm->chunk_dim) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't adjust chunk dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't adjust chunk dimensions"); /* Move selection back to have correct offset in chunk */ if (H5S_SELECT_ADJUST_U(tmp_fchunk, coords) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't adjust chunk selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't adjust chunk selection"); /* Add temporary chunk to the list of chunks */ /* Allocate the file & memory chunk information */ - if (NULL == (new_chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk info") + if (NULL == (new_piece_info = H5FL_MALLOC(H5D_piece_info_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk info"); /* Initialize the chunk information */ /* Set the chunk index */ - new_chunk_info->index = chunk_index; - -#ifdef H5_HAVE_PARALLEL - /* Store chunk selection information, for multi-chunk I/O */ - if (io_info->using_mpi_vfd) - fm->select_chunk[chunk_index] = new_chunk_info; -#endif /* H5_HAVE_PARALLEL */ + new_piece_info->index = chunk_index; /* Set the file chunk dataspace */ - new_chunk_info->fspace = tmp_fchunk; - new_chunk_info->fspace_shared = FALSE; + new_piece_info->fspace = tmp_fchunk; + new_piece_info->fspace_shared = FALSE; tmp_fchunk = NULL; /* Set the memory chunk dataspace */ - new_chunk_info->mspace = NULL; - new_chunk_info->mspace_shared = FALSE; + new_piece_info->mspace = NULL; + new_piece_info->mspace_shared = FALSE; /* Copy the chunk's scaled coordinates */ - H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); - new_chunk_info->scaled[fm->f_ndims] = 0; + H5MM_memcpy(new_piece_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + new_piece_info->scaled[fm->f_ndims] = 0; - /* Insert the new chunk into the skip list */ - if (H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) { - H5D__free_chunk_info(new_chunk_info, NULL, NULL); - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert chunk into skip list") + /* make connection to related dset info from this piece_info */ + new_piece_info->dset_info = dinfo; + + /* Initialize in-place type conversion info. Start with it disabled. */ + new_piece_info->in_place_tconv = FALSE; + new_piece_info->buf_off = 0; + + /* Add piece to global piece_count */ + io_info->piece_count++; + + /* Insert the new piece into the skip list */ + if (H5SL_insert(fm->dset_sel_pieces, new_piece_info, &new_piece_info->index) < 0) { + H5D__free_piece_info(new_piece_info, NULL, NULL); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert piece into skip list"); } /* end if */ /* Get number of elements selected in chunk */ - chunk_points = H5S_GET_SELECT_NPOINTS(new_chunk_info->fspace); - H5_CHECKED_ASSIGN(new_chunk_info->chunk_points, uint32_t, chunk_points, hsize_t); + chunk_points = H5S_GET_SELECT_NPOINTS(new_piece_info->fspace); + new_piece_info->piece_points = chunk_points; /* Decrement # of points left in file selection */ sel_points -= chunk_points; /* Leave if we are done */ if (sel_points == 0) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Increment chunk index */ @@ -1957,7 +1939,7 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t } while (curr_dim >= 0 && (coords[curr_dim] > sel_end[curr_dim])); /* Re-calculate the index of this chunk */ - chunk_index = H5VM_array_offset_pre(fm->f_ndims, fm->layout->u.chunk.down_chunks, scaled); + chunk_index = H5VM_array_offset_pre(fm->f_ndims, dinfo->layout->u.chunk.down_chunks, scaled); } /* end if */ } /* end while */ @@ -1965,31 +1947,30 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t /* Clean up on failure */ if (ret_value < 0) if (tmp_fchunk && H5S_close(tmp_fchunk) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release temporary dataspace") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't release temporary dataspace"); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__create_chunk_file_map_hyper() */ +} /* end H5D__create_piece_file_map_hyper() */ /*------------------------------------------------------------------------- - * Function: H5D__create_chunk_mem_map_hyper + * Function: H5D__create_piece_mem_map_hyper * - * Purpose: Create all chunk selections in memory by copying the file + * Purpose: Create all chunk selections in memory by copying the file * chunk selections and adjusting their offsets to be correct - * for the memory. - * - * Return: Non-negative on success/Negative on failure + * or the memory. + * This was derived from H5D__create_chunk_mem_map_hyper for + * multi-dset work. * - * Programmer: Quincey Koziol - * Thursday, May 29, 2003 + * Return: Non-negative on success/Negative on failure * * Assumptions: That the file and memory selections are the same shape. - * *------------------------------------------------------------------------- */ static herr_t -H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) +H5D__create_piece_mem_map_hyper(const H5D_dset_io_info_t *dinfo) { - H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */ + H5D_chunk_map_t *fm; /* Convenience pointer to chunk map */ + H5D_piece_info_t *piece_info; /* Pointer to piece information */ H5SL_node_t *curr_node; /* Current node in skip list */ hsize_t file_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ hsize_t file_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ @@ -2002,34 +1983,37 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(fm->f_ndims > 0); + assert(dinfo->layout_io_info.chunk_map->f_ndims > 0); + + /* Set convenience pointer */ + fm = dinfo->layout_io_info.chunk_map; /* Check for all I/O going to a single chunk */ - if (H5SL_count(fm->sel_chunks) == 1) { + if (H5SL_count(fm->dset_sel_pieces) == 1) { /* Get the node */ - curr_node = H5SL_first(fm->sel_chunks); + curr_node = H5SL_first(fm->dset_sel_pieces); - /* Get pointer to chunk's information */ - chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node); - HDassert(chunk_info); + /* Get pointer to piece's information */ + piece_info = (H5D_piece_info_t *)H5SL_item(curr_node); + assert(piece_info); /* Just point at the memory dataspace & selection */ - chunk_info->mspace = fm->mem_space; + piece_info->mspace = dinfo->mem_space; - /* Indicate that the chunk's memory space is shared */ - chunk_info->mspace_shared = TRUE; + /* Indicate that the piece's memory space is shared */ + piece_info->mspace_shared = TRUE; } /* end if */ else { /* Get bounding box for file selection */ - if (H5S_SELECT_BOUNDS(fm->file_space, file_sel_start, file_sel_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info") + if (H5S_SELECT_BOUNDS(dinfo->file_space, file_sel_start, file_sel_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info"); /* Get bounding box for memory selection */ - if (H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info") + if (H5S_SELECT_BOUNDS(dinfo->mem_space, mem_sel_start, mem_sel_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info"); /* Calculate the adjustment for memory selection from file selection */ - HDassert(fm->m_ndims == fm->f_ndims); + assert(fm->m_ndims == fm->f_ndims); for (u = 0; u < fm->f_ndims; u++) { H5_CHECK_OVERFLOW(file_sel_start[u], hsize_t, hssize_t); H5_CHECK_OVERFLOW(mem_sel_start[u], hsize_t, hssize_t); @@ -2037,29 +2021,30 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) } /* end for */ /* Iterate over each chunk in the chunk list */ - curr_node = H5SL_first(fm->sel_chunks); + assert(fm->dset_sel_pieces); + curr_node = H5SL_first(fm->dset_sel_pieces); while (curr_node) { hsize_t coords[H5S_MAX_RANK]; /* Current coordinates of chunk */ - hssize_t chunk_adjust[H5S_MAX_RANK]; /* Adjustment to make to a particular chunk */ + hssize_t piece_adjust[H5S_MAX_RANK]; /* Adjustment to make to a particular chunk */ H5S_sel_type chunk_sel_type; /* Chunk's selection type */ - /* Get pointer to chunk's information */ - chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node); - HDassert(chunk_info); + /* Get pointer to piece's information */ + piece_info = (H5D_piece_info_t *)H5SL_item(curr_node); + assert(piece_info); /* Compute the chunk coordinates from the scaled coordinates */ for (u = 0; u < fm->f_ndims; u++) - coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u]; + coords[u] = piece_info->scaled[u] * dinfo->layout->u.chunk.dim[u]; /* Copy the information */ /* Copy the memory dataspace */ - if ((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") + if ((piece_info->mspace = H5S_copy(dinfo->mem_space, TRUE, FALSE)) == NULL) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space"); /* Get the chunk's selection type */ - if ((chunk_sel_type = H5S_GET_SELECT_TYPE(chunk_info->fspace)) < H5S_SEL_NONE) - HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection") + if ((chunk_sel_type = H5S_GET_SELECT_TYPE(piece_info->fspace)) < H5S_SEL_NONE) + HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to get type of selection"); /* Set memory selection for "all" chunk selections */ if (H5S_SEL_ALL == chunk_sel_type) { @@ -2068,107 +2053,109 @@ H5D__create_chunk_mem_map_hyper(const H5D_chunk_map_t *fm) coords[u] = (hsize_t)((hssize_t)coords[u] - adjust[u]); /* Set to same shape as chunk */ - if (H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, coords, NULL, fm->chunk_dim, + if (H5S_select_hyperslab(piece_info->mspace, H5S_SELECT_SET, coords, NULL, fm->chunk_dim, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection"); } /* end if */ else { /* Sanity check */ - HDassert(H5S_SEL_HYPERSLABS == chunk_sel_type); + assert(H5S_SEL_HYPERSLABS == chunk_sel_type); /* Copy the file chunk's selection */ - if (H5S_SELECT_COPY(chunk_info->mspace, chunk_info->fspace, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection") + if (H5S_SELECT_COPY(piece_info->mspace, piece_info->fspace, FALSE) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy selection"); /* Compute the adjustment for this chunk */ for (u = 0; u < fm->f_ndims; u++) { /* Compensate for the chunk offset */ H5_CHECK_OVERFLOW(coords[u], hsize_t, hssize_t); - chunk_adjust[u] = adjust[u] - (hssize_t)coords[u]; + piece_adjust[u] = adjust[u] - (hssize_t)coords[u]; } /* end for */ /* Adjust the selection */ - if (H5S_SELECT_ADJUST_S(chunk_info->mspace, chunk_adjust) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection") + if (H5S_SELECT_ADJUST_S(piece_info->mspace, piece_adjust) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to adjust selection"); } /* end else */ - /* Get the next chunk node in the skip list */ + /* Get the next piece node in the skip list */ curr_node = H5SL_next(curr_node); } /* end while */ } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__create_chunk_mem_map_hyper() */ +} /* end H5D__create_piece_mem_map_hyper() */ /*------------------------------------------------------------------------- - * Function: H5D__create_mem_map_1d + * Function: H5D__create_piece_mem_map_1d * * Purpose: Create all chunk selections for 1-dimensional regular memory space * that has only one single block in the selection * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Sept 18, 2019 - * *------------------------------------------------------------------------- */ static herr_t -H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) +H5D__create_piece_mem_map_1d(const H5D_dset_io_info_t *dinfo) { - H5D_chunk_info_t *chunk_info; /* Pointer to chunk information */ + H5D_chunk_map_t *fm; /* Convenience pointer to chunk map */ + H5D_piece_info_t *piece_info; /* Pointer to chunk information */ H5SL_node_t *curr_node; /* Current node in skip list */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(fm->f_ndims > 0); + assert(dinfo->layout_io_info.chunk_map->f_ndims > 0); + + /* Set convenience pointer */ + fm = dinfo->layout_io_info.chunk_map; + assert(fm); /* Check for all I/O going to a single chunk */ - if (H5SL_count(fm->sel_chunks) == 1) { + if (H5SL_count(fm->dset_sel_pieces) == 1) { /* Get the node */ - curr_node = H5SL_first(fm->sel_chunks); + curr_node = H5SL_first(fm->dset_sel_pieces); /* Get pointer to chunk's information */ - chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node); - HDassert(chunk_info); + piece_info = (H5D_piece_info_t *)H5SL_item(curr_node); + assert(piece_info); /* Just point at the memory dataspace & selection */ - chunk_info->mspace = fm->mem_space; + piece_info->mspace = dinfo->mem_space; /* Indicate that the chunk's memory space is shared */ - chunk_info->mspace_shared = TRUE; + piece_info->mspace_shared = TRUE; } /* end if */ else { hsize_t mem_sel_start[H5S_MAX_RANK]; /* Offset of low bound of file selection */ hsize_t mem_sel_end[H5S_MAX_RANK]; /* Offset of high bound of file selection */ - HDassert(fm->m_ndims == 1); + assert(fm->m_ndims == 1); - if (H5S_SELECT_BOUNDS(fm->mem_space, mem_sel_start, mem_sel_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info") + if (H5S_SELECT_BOUNDS(dinfo->mem_space, mem_sel_start, mem_sel_end) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get file selection bound info"); /* Iterate over each chunk in the chunk list */ - curr_node = H5SL_first(fm->sel_chunks); + curr_node = H5SL_first(fm->dset_sel_pieces); while (curr_node) { hsize_t chunk_points; /* Number of elements in chunk selection */ hsize_t tmp_count = 1; /* Get pointer to chunk's information */ - chunk_info = (H5D_chunk_info_t *)H5SL_item(curr_node); - HDassert(chunk_info); + piece_info = (H5D_piece_info_t *)H5SL_item(curr_node); + assert(piece_info); /* Copy the memory dataspace */ - if ((chunk_info->mspace = H5S_copy(fm->mem_space, TRUE, FALSE)) == NULL) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space") + if ((piece_info->mspace = H5S_copy(dinfo->mem_space, TRUE, FALSE)) == NULL) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space"); - chunk_points = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); + chunk_points = H5S_GET_SELECT_NPOINTS(piece_info->fspace); - if (H5S_select_hyperslab(chunk_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, + if (H5S_select_hyperslab(piece_info->mspace, H5S_SELECT_SET, mem_sel_start, NULL, &tmp_count, &chunk_points) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't create chunk memory selection"); mem_sel_start[0] += chunk_points; @@ -2179,200 +2166,266 @@ H5D__create_chunk_mem_map_1d(const H5D_chunk_map_t *fm) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__create_chunk_mem_map_1d() */ +} /* end H5D__create_piece_mem_map_1d() */ /*------------------------------------------------------------------------- - * Function: H5D__chunk_file_cb + * Function: H5D__piece_file_cb * - * Purpose: Callback routine for file selection iterator. Used when + * Purpose: Callback routine for file selection iterator. Used when * creating selections in file for each point selected. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Wednesday, July 23, 2003 + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims, - const hsize_t *coords, void *_udata) +H5D__piece_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims, + const hsize_t *coords, void *_opdata) { - H5D_chunk_file_iter_ud_t *udata = (H5D_chunk_file_iter_ud_t *)_udata; /* User data for operation */ - H5D_chunk_map_t *fm = udata->fm; /* File<->memory chunk mapping info */ - H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */ - hsize_t coords_in_chunk[H5O_LAYOUT_NDIMS]; /* Coordinates of element in chunk */ - hsize_t chunk_index; /* Chunk index */ - hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_io_info_wrap_t *opdata = (H5D_io_info_wrap_t *)_opdata; + H5D_io_info_t *io_info = (H5D_io_info_t *)opdata->io_info; /* io info for multi dset */ + H5D_dset_io_info_t *dinfo = (H5D_dset_io_info_t *)opdata->dinfo; /* File<->memory piece mapping info */ + H5D_chunk_map_t *fm; /* Convenience pointer to chunk map */ + H5D_piece_info_t *piece_info; /* Chunk information for current piece */ + hsize_t coords_in_chunk[H5O_LAYOUT_NDIMS]; /* Coordinates of element in chunk */ + hsize_t chunk_index; /* Chunk index */ + hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE + /* Set convenience pointer */ + fm = dinfo->layout_io_info.chunk_map; + /* Calculate the index of this chunk */ - chunk_index = H5VM_chunk_index_scaled(ndims, coords, fm->layout->u.chunk.dim, - fm->layout->u.chunk.down_chunks, scaled); + chunk_index = H5VM_chunk_index_scaled(ndims, coords, dinfo->layout->u.chunk.dim, + dinfo->layout->u.chunk.down_chunks, scaled); /* Find correct chunk in file & memory skip list */ if (chunk_index == fm->last_index) { /* If the chunk index is the same as the last chunk index we used, * get the cached info to operate on. */ - chunk_info = fm->last_chunk_info; + piece_info = fm->last_piece_info; } /* end if */ else { /* If the chunk index is not the same as the last chunk index we used, - * find the chunk in the skip list. - */ - /* Get the chunk node from the skip list */ - if (NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_index))) { + * find the chunk in the skip list. If we do not find it, create + * a new node. */ + if (NULL == (piece_info = (H5D_piece_info_t *)H5SL_search(fm->dset_sel_pieces, &chunk_index))) { H5S_t *fspace; /* Memory chunk's dataspace */ /* Allocate the file & memory chunk information */ - if (NULL == (chunk_info = H5FL_MALLOC(H5D_chunk_info_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info") + if (NULL == (piece_info = H5FL_MALLOC(H5D_piece_info_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info"); /* Initialize the chunk information */ /* Set the chunk index */ - chunk_info->index = chunk_index; + piece_info->index = chunk_index; /* Create a dataspace for the chunk */ if ((fspace = H5S_create_simple(fm->f_ndims, fm->chunk_dim, NULL)) == NULL) { - chunk_info = H5FL_FREE(H5D_chunk_info_t, chunk_info); - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk") + piece_info = H5FL_FREE(H5D_piece_info_t, piece_info); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace for chunk"); } /* end if */ /* De-select the chunk space */ if (H5S_select_none(fspace) < 0) { (void)H5S_close(fspace); - chunk_info = H5FL_FREE(H5D_chunk_info_t, chunk_info); - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select dataspace") + piece_info = H5FL_FREE(H5D_piece_info_t, piece_info); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to de-select dataspace"); } /* end if */ /* Set the file chunk dataspace */ - chunk_info->fspace = fspace; - chunk_info->fspace_shared = FALSE; + piece_info->fspace = fspace; + piece_info->fspace_shared = FALSE; /* Set the memory chunk dataspace */ - chunk_info->mspace = NULL; - chunk_info->mspace_shared = FALSE; + piece_info->mspace = NULL; + piece_info->mspace_shared = FALSE; /* Set the number of selected elements in chunk to zero */ - chunk_info->chunk_points = 0; + piece_info->piece_points = 0; /* Set the chunk's scaled coordinates */ - H5MM_memcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); - chunk_info->scaled[fm->f_ndims] = 0; + H5MM_memcpy(piece_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + piece_info->scaled[fm->f_ndims] = 0; + + /* Initialize in-place type conversion info. Start with it disabled. */ + piece_info->in_place_tconv = FALSE; + piece_info->buf_off = 0; + + /* Make connection to related dset info from this piece_info */ + piece_info->dset_info = dinfo; /* Insert the new chunk into the skip list */ - if (H5SL_insert(fm->sel_chunks, chunk_info, &chunk_info->index) < 0) { - H5D__free_chunk_info(chunk_info, NULL, NULL); - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert chunk into skip list") + if (H5SL_insert(fm->dset_sel_pieces, piece_info, &piece_info->index) < 0) { + H5D__free_piece_info(piece_info, NULL, NULL); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert chunk into dataset skip list"); } /* end if */ - } /* end if */ -#ifdef H5_HAVE_PARALLEL - /* Store chunk selection information, for collective multi-chunk I/O */ - if (udata->io_info->using_mpi_vfd) - fm->select_chunk[chunk_index] = chunk_info; -#endif /* H5_HAVE_PARALLEL */ + /* Add piece to global piece_count */ + io_info->piece_count++; + } /* end if */ /* Update the "last chunk seen" information */ fm->last_index = chunk_index; - fm->last_chunk_info = chunk_info; + fm->last_piece_info = piece_info; } /* end else */ /* Get the offset of the element within the chunk */ for (u = 0; u < fm->f_ndims; u++) - coords_in_chunk[u] = coords[u] - (scaled[u] * fm->layout->u.chunk.dim[u]); + coords_in_chunk[u] = coords[u] - (scaled[u] * dinfo->layout->u.chunk.dim[u]); /* Add point to file selection for chunk */ - if (H5S_select_elements(chunk_info->fspace, H5S_SELECT_APPEND, (size_t)1, coords_in_chunk) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element") + if (H5S_select_elements(piece_info->fspace, H5S_SELECT_APPEND, (size_t)1, coords_in_chunk) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "unable to select element"); /* Increment the number of elemented selected in chunk */ - chunk_info->chunk_points++; + piece_info->piece_points++; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__chunk_file_cb() */ +} /* end H5D__piece_file_cb */ /*------------------------------------------------------------------------- - * Function: H5D__chunk_mem_cb + * Function: H5D__piece_mem_cb * - * Purpose: Callback routine for file selection iterator. Used when - * creating selections in memory for each chunk. + * Purpose: Callback routine for file selection iterator. Used when + * creating selections in memory for each piece. + * This was derived from H5D__chunk_mem_cb for multi-dset + * work. * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Thursday, April 10, 2003 - * *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims, - const hsize_t *coords, void *_fm) +H5D__piece_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, unsigned ndims, + const hsize_t *coords, void *_opdata) { - H5D_chunk_map_t *fm = (H5D_chunk_map_t *)_fm; /* File<->memory chunk mapping info */ - H5D_chunk_info_t *chunk_info; /* Chunk information for current chunk */ - hsize_t coords_in_mem[H5S_MAX_RANK]; /* Coordinates of element in memory */ - hsize_t chunk_index; /* Chunk index */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_io_info_wrap_t *opdata = (H5D_io_info_wrap_t *)_opdata; + H5D_dset_io_info_t *dinfo = (H5D_dset_io_info_t *)opdata->dinfo; /* File<->memory chunk mapping info */ + H5D_piece_info_t *piece_info; /* Chunk information for current chunk */ + H5D_chunk_map_t *fm; /* Convenience pointer to chunk map */ + hsize_t coords_in_mem[H5S_MAX_RANK]; /* Coordinates of element in memory */ + hsize_t chunk_index; /* Chunk index */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE + /* Set convenience pointer */ + fm = dinfo->layout_io_info.chunk_map; + /* Calculate the index of this chunk */ - chunk_index = H5VM_chunk_index(ndims, coords, fm->layout->u.chunk.dim, fm->layout->u.chunk.down_chunks); + chunk_index = + H5VM_chunk_index(ndims, coords, dinfo->layout->u.chunk.dim, dinfo->layout->u.chunk.down_chunks); /* Find correct chunk in file & memory skip list */ if (chunk_index == fm->last_index) { /* If the chunk index is the same as the last chunk index we used, * get the cached spaces to operate on. */ - chunk_info = fm->last_chunk_info; + piece_info = fm->last_piece_info; } /* end if */ else { /* If the chunk index is not the same as the last chunk index we used, - * find the chunk in the skip list. + * find the chunk in the dataset skip list. */ /* Get the chunk node from the skip list */ - if (NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_search(fm->sel_chunks, &chunk_index))) - HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, H5_ITER_ERROR, "can't locate chunk in skip list") + if (NULL == (piece_info = (H5D_piece_info_t *)H5SL_search(fm->dset_sel_pieces, &chunk_index))) + HGOTO_ERROR(H5E_DATASPACE, H5E_NOTFOUND, H5_ITER_ERROR, + "can't locate piece in dataset skip list"); /* Check if the chunk already has a memory space */ - if (NULL == chunk_info->mspace) + if (NULL == piece_info->mspace) /* Copy the template memory chunk dataspace */ - if (NULL == (chunk_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy file space") + if (NULL == (piece_info->mspace = H5S_copy(fm->mchunk_tmpl, FALSE, FALSE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy file space"); /* Update the "last chunk seen" information */ fm->last_index = chunk_index; - fm->last_chunk_info = chunk_info; + fm->last_piece_info = piece_info; } /* end else */ /* Get coordinates of selection iterator for memory */ if (H5S_SELECT_ITER_COORDS(&fm->mem_iter, coords_in_mem) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, H5_ITER_ERROR, "unable to get iterator coordinates") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, H5_ITER_ERROR, "unable to get iterator coordinates"); /* Add point to memory selection for chunk */ if (fm->msel_type == H5S_SEL_POINTS) { - if (H5S_select_elements(chunk_info->mspace, H5S_SELECT_APPEND, (size_t)1, coords_in_mem) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element") + if (H5S_select_elements(piece_info->mspace, H5S_SELECT_APPEND, (size_t)1, coords_in_mem) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element"); } /* end if */ else { - if (H5S_hyper_add_span_element(chunk_info->mspace, fm->m_ndims, coords_in_mem) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element") + if (H5S_hyper_add_span_element(piece_info->mspace, fm->m_ndims, coords_in_mem) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, H5_ITER_ERROR, "unable to select element"); } /* end else */ /* Move memory selection iterator to next element in selection */ if (H5S_SELECT_ITER_NEXT(&fm->mem_iter, (size_t)1) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, H5_ITER_ERROR, "unable to move to next iterator location") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, H5_ITER_ERROR, "unable to move to next iterator location"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__piece_mem_cb() */ + +/*------------------------------------------------------------------------- + * Function: H5D__chunk_mdio_init + * + * Purpose: Performs second phase of initialization for multi-dataset + * I/O. Currently looks up chunk addresses and adds chunks to + * sel_pieces. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__chunk_mdio_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo) +{ + H5SL_node_t *piece_node; /* Current node in chunk skip list */ + H5D_piece_info_t *piece_info; /* Piece information for current piece */ + H5D_chunk_ud_t udata; /* Chunk data from index */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Get first node in skip list. Note we don't check for failure since NULL + * simply indicates an empty skip list. */ + piece_node = H5D_CHUNK_GET_FIRST_NODE(dinfo); + + /* Iterate over skip list */ + while (piece_node) { + /* Get piece info */ + if (NULL == (piece_info = (H5D_piece_info_t *)H5D_CHUNK_GET_NODE_INFO(dinfo, piece_node))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get piece info from list"); + + /* Get the info for the chunk in the file */ + if (H5D__chunk_lookup(dinfo->dset, piece_info->scaled, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); + + /* Save chunk file address */ + piece_info->faddr = udata.chunk_block.offset; + + /* Add piece to MDIO operation if it has a file address */ + if (H5_addr_defined(piece_info->faddr)) { + assert(io_info->sel_pieces); + assert(io_info->pieces_added < io_info->piece_count); + + /* Add to sel_pieces and update pieces_added */ + io_info->sel_pieces[io_info->pieces_added++] = piece_info; + } + + /* Advance to next skip list node */ + piece_node = H5D_CHUNK_GET_NEXT_NODE(dinfo, piece_node); + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__chunk_mem_cb() */ +} /* end H5D__chunk_mdio_init() */ /*------------------------------------------------------------------------- * Function: H5D__chunk_cacheable @@ -2382,32 +2435,31 @@ H5D__chunk_mem_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, u * * Return: TRUE or FALSE * - * Programmer: Raymond Lu - * 17 July 2007 - * *------------------------------------------------------------------------- */ htri_t -H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_op) +H5D__chunk_cacheable(const H5D_io_info_t H5_ATTR_PARALLEL_USED *io_info, H5D_dset_io_info_t *dset_info, + haddr_t caddr, hbool_t write_op) { - const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */ - hbool_t has_filters = FALSE; /* Whether there are filters on the chunk or not */ - htri_t ret_value = FAIL; /* Return value */ + const H5D_t *dataset = NULL; /* Local pointer to dataset info */ + hbool_t has_filters = FALSE; /* Whether there are filters on the chunk or not */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(dataset); + assert(dset_info); + dataset = dset_info->dset; + assert(dataset); /* Must bring the whole chunk in if there are any filters on the chunk. * Make sure to check if filters are on the dataset but disabled for the * chunk because it is a partial edge chunk. */ if (dataset->shared->dcpl_cache.pline.nused > 0) { if (dataset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { - has_filters = !H5D__chunk_is_partial_edge_chunk( - io_info->dset->shared->ndims, io_info->dset->shared->layout.u.chunk.dim, - io_info->store->chunk.scaled, io_info->dset->shared->curr_dims); + has_filters = + !H5D__chunk_is_partial_edge_chunk(dataset->shared->ndims, dataset->shared->layout.u.chunk.dim, + dset_info->store->chunk.scaled, dataset->shared->curr_dims); } /* end if */ else has_filters = TRUE; @@ -2432,13 +2484,13 @@ H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_ */ H5_CHECK_OVERFLOW(dataset->shared->layout.u.chunk.size, uint32_t, size_t); if ((size_t)dataset->shared->layout.u.chunk.size > dataset->shared->cache.chunk.nbytes_max) { - if (write_op && !H5F_addr_defined(caddr)) { + if (write_op && !H5_addr_defined(caddr)) { const H5O_fill_t *fill = &(dataset->shared->dcpl_cache.fill); /* Fill value info */ H5D_fill_value_t fill_status; /* Fill value status */ /* Revtrieve the fill value status */ if (H5P_is_fill_value_defined(fill, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined"); /* If the fill value needs to be written then we will need * to use the cache to write the fill value */ @@ -2472,40 +2524,39 @@ H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_ * * Return: TRUE or FALSE * - * Programmer: Neil Fortner - * 4 May 2021 - * *------------------------------------------------------------------------- */ -static htri_t -H5D__chunk_may_use_select_io(const H5D_io_info_t *io_info) +static herr_t +H5D__chunk_may_use_select_io(H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info) { - const H5D_t *dataset = NULL; /* Local pointer to dataset info */ - htri_t ret_value = FAIL; /* Return value */ + const H5D_t *dataset = NULL; /* Local pointer to dataset info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); + assert(io_info); + assert(dset_info); - dataset = io_info->dset; - HDassert(dataset); + dataset = dset_info->dset; + assert(dataset); - /* Don't use selection I/O if it's globally disabled, there is a type - * conversion, or if there are filters on the dataset (for now) */ - if (!H5_use_selection_io_g || io_info->io_ops.single_read != H5D__select_read || - dataset->shared->dcpl_cache.pline.nused > 0) - ret_value = FALSE; + /* Don't use selection I/O if there are filters on the dataset (for now) */ + if (dataset->shared->dcpl_cache.pline.nused > 0) { + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_DATASET_FILTER; + } else { hbool_t page_buf_enabled; - HDassert(io_info->io_ops.single_write == H5D__select_write); - /* Check if the page buffer is enabled */ if (H5PB_enabled(io_info->f_sh, H5FD_MEM_DRAW, &page_buf_enabled) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if page buffer is enabled") - if (page_buf_enabled) - ret_value = FALSE; + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if page buffer is enabled"); + if (page_buf_enabled) { + /* Note that page buffer is disabled in parallel */ + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_PAGE_BUFFER; + } else { /* Check if chunks in this dataset may be cached, if so don't use * selection I/O (for now). Note that chunks temporarily cached for @@ -2516,16 +2567,14 @@ H5D__chunk_may_use_select_io(const H5D_io_info_t *io_info) * must bypass the chunk-cache scheme because other MPI processes * could be writing to other elements in the same chunk. */ - if (io_info->using_mpi_vfd && (H5F_ACC_RDWR & H5F_INTENT(dataset->oloc.file))) - ret_value = TRUE; - else { + if (!(io_info->using_mpi_vfd && (H5F_ACC_RDWR & H5F_INTENT(dataset->oloc.file)))) { #endif /* H5_HAVE_PARALLEL */ /* Check if the chunk is too large to keep in the cache */ H5_CHECK_OVERFLOW(dataset->shared->layout.u.chunk.size, uint32_t, size_t); - if ((size_t)dataset->shared->layout.u.chunk.size > dataset->shared->cache.chunk.nbytes_max) - ret_value = TRUE; - else - ret_value = FALSE; + if ((size_t)dataset->shared->layout.u.chunk.size <= dataset->shared->cache.chunk.nbytes_max) { + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_CHUNK_CACHE; + } #ifdef H5_HAVE_PARALLEL } /* end else */ #endif /* H5_HAVE_PARALLEL */ @@ -2543,46 +2592,47 @@ H5D__chunk_may_use_select_io(const H5D_io_info_t *io_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Thursday, April 10, 2003 - * *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t H5_ATTR_UNUSED nelmts, - H5S_t H5_ATTR_UNUSED *file_space, H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm) +H5D__chunk_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info) { - H5SL_node_t *chunk_node; /* Current node in chunk skip list */ - H5D_io_info_t nonexistent_io_info; /* "nonexistent" I/O info object */ - uint32_t src_accessed_bytes = 0; /* Total accessed size in a chunk */ - hbool_t skip_missing_chunks = FALSE; /* Whether to skip missing chunks */ - H5S_t **chunk_mem_spaces = NULL; /* Array of chunk memory spaces */ - H5S_t *chunk_mem_spaces_static[8]; /* Static buffer for chunk_mem_spaces */ - H5S_t **chunk_file_spaces = NULL; /* Array of chunk file spaces */ - H5S_t *chunk_file_spaces_static[8]; /* Static buffer for chunk_file_spaces */ - haddr_t *chunk_addrs = NULL; /* Array of chunk addresses */ - haddr_t chunk_addrs_static[8]; /* Static buffer for chunk_addrs */ - herr_t ret_value = SUCCEED; /*return value */ + H5SL_node_t *chunk_node; /* Current node in chunk skip list */ + H5D_io_info_t nonexistent_io_info; /* "nonexistent" I/O info object */ + H5D_dset_io_info_t nonexistent_dset_info; /* "nonexistent" I/O dset info object */ + H5D_dset_io_info_t ctg_dset_info; /* Contiguous I/O dset info object */ + H5D_dset_io_info_t cpt_dset_info; /* Compact I/O dset info object */ + uint32_t src_accessed_bytes = 0; /* Total accessed size in a chunk */ + hbool_t skip_missing_chunks = FALSE; /* Whether to skip missing chunks */ + H5S_t **chunk_mem_spaces = NULL; /* Array of chunk memory spaces */ + H5S_t *chunk_mem_spaces_local[8]; /* Local buffer for chunk_mem_spaces */ + H5S_t **chunk_file_spaces = NULL; /* Array of chunk file spaces */ + H5S_t *chunk_file_spaces_local[8]; /* Local buffer for chunk_file_spaces */ + haddr_t *chunk_addrs = NULL; /* Array of chunk addresses */ + haddr_t chunk_addrs_local[8]; /* Local buffer for chunk_addrs */ + herr_t ret_value = SUCCEED; /*return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(io_info->u.rbuf); - HDassert(type_info); - HDassert(fm); + assert(io_info); + assert(dset_info); + assert(dset_info->buf.vp); /* Set up "nonexistent" I/O info object */ H5MM_memcpy(&nonexistent_io_info, io_info, sizeof(nonexistent_io_info)); - nonexistent_io_info.layout_ops = *H5D_LOPS_NONEXISTENT; + H5MM_memcpy(&nonexistent_dset_info, dset_info, sizeof(nonexistent_dset_info)); + nonexistent_dset_info.layout_ops = *H5D_LOPS_NONEXISTENT; + nonexistent_io_info.dsets_info = &nonexistent_dset_info; + nonexistent_io_info.count = 1; { - const H5O_fill_t *fill = &(io_info->dset->shared->dcpl_cache.fill); /* Fill value info */ - H5D_fill_value_t fill_status; /* Fill value status */ + const H5O_fill_t *fill = &(dset_info->dset->shared->dcpl_cache.fill); /* Fill value info */ + H5D_fill_value_t fill_status; /* Fill value status */ /* Check the fill value status */ if (H5P_is_fill_value_defined(fill, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined"); /* If we are never to return fill values, or if we would return them * but they aren't set, set the flag to skip missing chunks. @@ -2594,100 +2644,143 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_ } /* Different blocks depending on whether we're using selection I/O */ - if (io_info->use_select_io) { - size_t num_chunks; - size_t element_sizes[2] = {type_info->dst_type_size, 0}; - void *bufs[2] = {io_info->u.rbuf, NULL}; - - /* Cache number of chunks */ - num_chunks = H5D_CHUNK_GET_NODE_COUNT(fm); - - /* Allocate arrays of dataspaces and offsets for use with selection I/O, - * or point to static buffers */ - HDassert(sizeof(chunk_mem_spaces_static) / sizeof(chunk_mem_spaces_static[0]) == - sizeof(chunk_file_spaces_static) / sizeof(chunk_file_spaces_static[0])); - HDassert(sizeof(chunk_mem_spaces_static) / sizeof(chunk_mem_spaces_static[0]) == - sizeof(chunk_addrs_static) / sizeof(chunk_addrs_static[0])); - if (num_chunks > (sizeof(chunk_mem_spaces_static) / sizeof(chunk_mem_spaces_static[0]))) { - if (NULL == (chunk_mem_spaces = H5MM_malloc(num_chunks * sizeof(H5S_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for memory space list") - if (NULL == (chunk_file_spaces = H5MM_malloc(num_chunks * sizeof(H5S_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for file space list") - if (NULL == (chunk_addrs = H5MM_malloc(num_chunks * sizeof(haddr_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for chunk address list") - } /* end if */ - else { - chunk_mem_spaces = chunk_mem_spaces_static; - chunk_file_spaces = chunk_file_spaces_static; - chunk_addrs = chunk_addrs_static; - } /* end else */ + if (io_info->use_select_io == H5D_SELECTION_IO_MODE_ON) { + size_t num_chunks = 0; + size_t element_sizes[2] = {dset_info->type_info.src_type_size, 0}; + void *bufs[2] = {dset_info->buf.vp, NULL}; + + /* Only create selection I/O arrays if not performing multi dataset I/O, + * otherwise the higher level will handle it */ + if (H5D_LAYOUT_CB_PERFORM_IO(io_info)) { + /* Cache number of chunks */ + num_chunks = H5D_CHUNK_GET_NODE_COUNT(dset_info); + + /* Allocate arrays of dataspaces and offsets for use with selection I/O, + * or point to local buffers */ + assert(sizeof(chunk_mem_spaces_local) / sizeof(chunk_mem_spaces_local[0]) == + sizeof(chunk_file_spaces_local) / sizeof(chunk_file_spaces_local[0])); + assert(sizeof(chunk_mem_spaces_local) / sizeof(chunk_mem_spaces_local[0]) == + sizeof(chunk_addrs_local) / sizeof(chunk_addrs_local[0])); + if (num_chunks > (sizeof(chunk_mem_spaces_local) / sizeof(chunk_mem_spaces_local[0]))) { + if (NULL == (chunk_mem_spaces = H5MM_malloc(num_chunks * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for memory space list"); + if (NULL == (chunk_file_spaces = H5MM_malloc(num_chunks * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for file space list"); + if (NULL == (chunk_addrs = H5MM_malloc(num_chunks * sizeof(haddr_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for chunk address list"); + } /* end if */ + else { + chunk_mem_spaces = chunk_mem_spaces_local; + chunk_file_spaces = chunk_file_spaces_local; + chunk_addrs = chunk_addrs_local; + } /* end else */ - /* Reset num_chunks */ - num_chunks = 0; + /* Reset num_chunks */ + num_chunks = 0; + } /* end if */ /* Iterate through nodes in chunk skip list */ - chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm); + chunk_node = H5D_CHUNK_GET_FIRST_NODE(dset_info); while (chunk_node) { - H5D_chunk_info_t *chunk_info; /* Chunk information */ + H5D_piece_info_t *chunk_info; /* Chunk information */ H5D_chunk_ud_t udata; /* Chunk index pass-through */ /* Get the actual chunk information from the skip list node */ - chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); + chunk_info = H5D_CHUNK_GET_NODE_INFO(dset_info, chunk_node); /* Get the info for the chunk in the file */ - if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + if (H5D__chunk_lookup(dset_info->dset, chunk_info->scaled, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); /* There should be no chunks cached */ - HDassert(UINT_MAX == udata.idx_hint); + assert(UINT_MAX == udata.idx_hint); /* Sanity check */ - HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || - (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + assert((H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || + (!H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); /* Check for non-existent chunk & skip it if appropriate */ - if (H5F_addr_defined(udata.chunk_block.offset)) { - /* Add chunk to list for selection I/O */ - chunk_mem_spaces[num_chunks] = chunk_info->mspace; - chunk_file_spaces[num_chunks] = chunk_info->fspace; - chunk_addrs[num_chunks] = udata.chunk_block.offset; - num_chunks++; + if (H5_addr_defined(udata.chunk_block.offset)) { + /* Add chunk to list for selection I/O, if not performing multi dataset I/O */ + if (H5D_LAYOUT_CB_PERFORM_IO(io_info)) { + chunk_mem_spaces[num_chunks] = chunk_info->mspace; + chunk_file_spaces[num_chunks] = chunk_info->fspace; + chunk_addrs[num_chunks] = udata.chunk_block.offset; + num_chunks++; + } /* end if */ + else { + /* Add to mdset selection I/O arrays */ + assert(io_info->mem_spaces); + assert(io_info->file_spaces); + assert(io_info->addrs); + assert(io_info->element_sizes); + assert(io_info->rbufs); + assert(io_info->pieces_added < io_info->piece_count); + + io_info->mem_spaces[io_info->pieces_added] = chunk_info->mspace; + io_info->file_spaces[io_info->pieces_added] = chunk_info->fspace; + io_info->addrs[io_info->pieces_added] = udata.chunk_block.offset; + io_info->element_sizes[io_info->pieces_added] = element_sizes[0]; + io_info->rbufs[io_info->pieces_added] = bufs[0]; + if (io_info->sel_pieces) + io_info->sel_pieces[io_info->pieces_added] = chunk_info; + io_info->pieces_added++; + } } /* end if */ else if (!skip_missing_chunks) { + /* Set up nonexistent dataset info for (fill value) read from nonexistent chunk */ + nonexistent_dset_info.layout_io_info.contig_piece_info = chunk_info; + nonexistent_dset_info.file_space = chunk_info->fspace; + nonexistent_dset_info.mem_space = chunk_info->mspace; + nonexistent_dset_info.nelmts = chunk_info->piece_points; + + /* Set request_nelmts. This is not normally set by the upper layers because selection I/O + * usually does not use strip mining (H5D__scatgath_write), and instead allocates buffers + * large enough for the entire I/O. Set request_nelmts to be large enough for all selected + * elements in this chunk because it must be at least that large */ + nonexistent_dset_info.type_info.request_nelmts = nonexistent_dset_info.nelmts; + /* Perform the actual read operation from the nonexistent chunk */ - if ((io_info->io_ops.single_read)(&nonexistent_io_info, type_info, - (hsize_t)chunk_info->chunk_points, chunk_info->fspace, - chunk_info->mspace) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed") + if ((dset_info->io_ops.single_read)(&nonexistent_io_info, &nonexistent_dset_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed"); } /* end if */ /* Advance to next chunk in list */ - chunk_node = H5D_CHUNK_GET_NEXT_NODE(fm, chunk_node); + chunk_node = H5D_CHUNK_GET_NEXT_NODE(dset_info, chunk_node); } /* end while */ - /* Issue selection I/O call (we can skip the page buffer because we've - * already verified it won't be used, and the metadata accumulator - * because this is raw data) */ - if (H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks, - chunk_mem_spaces, chunk_file_spaces, chunk_addrs, element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunk selection read failed") - - /* Clean up memory */ - if (chunk_mem_spaces != chunk_mem_spaces_static) { - HDassert(chunk_mem_spaces); - HDassert(chunk_file_spaces != chunk_file_spaces_static); - HDassert(chunk_addrs != chunk_addrs_static); - H5MM_free(chunk_mem_spaces); - chunk_mem_spaces = NULL; - H5MM_free(chunk_file_spaces); - chunk_file_spaces = NULL; - H5MM_free(chunk_addrs); - chunk_addrs = NULL; - } /* end if */ - } /* end if */ + /* Only perform I/O if not performing multi dataset I/O or type conversion, otherwise the + * higher level will handle it after all datasets have been processed */ + if (H5D_LAYOUT_CB_PERFORM_IO(io_info)) { + /* Issue selection I/O call (we can skip the page buffer because we've + * already verified it won't be used, and the metadata accumulator + * because this is raw data) */ + H5_CHECK_OVERFLOW(num_chunks, size_t, uint32_t); + if (H5F_shared_select_read(H5F_SHARED(dset_info->dset->oloc.file), H5FD_MEM_DRAW, + (uint32_t)num_chunks, chunk_mem_spaces, chunk_file_spaces, chunk_addrs, + element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunk selection read failed"); + + /* Clean up memory */ + if (chunk_mem_spaces != chunk_mem_spaces_local) { + assert(chunk_file_spaces != chunk_file_spaces_local); + assert(chunk_addrs != chunk_addrs_local); + chunk_mem_spaces = H5MM_xfree(chunk_mem_spaces); + chunk_file_spaces = H5MM_xfree(chunk_file_spaces); + chunk_addrs = H5MM_xfree(chunk_addrs); + } /* end if */ + } /* end if */ + +#ifdef H5_HAVE_PARALLEL + /* Report that collective chunk I/O was used (will only be set on the DXPL if collective I/O was + * requested) */ + io_info->actual_io_mode |= H5D_MPIO_CHUNK_COLLECTIVE; +#endif /* H5_HAVE_PARALLEL */ + } /* end if */ else { H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */ H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */ @@ -2697,61 +2790,70 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_ /* Set up contiguous I/O info object */ H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); - ctg_io_info.store = &ctg_store; - ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; + memcpy(&ctg_dset_info, dset_info, sizeof(ctg_dset_info)); + ctg_dset_info.store = &ctg_store; + ctg_dset_info.layout_ops = *H5D_LOPS_CONTIG; + ctg_io_info.dsets_info = &ctg_dset_info; + ctg_io_info.count = 1; /* Initialize temporary contiguous storage info */ - H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, + H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, dset_info->dset->shared->layout.u.chunk.size, uint32_t); /* Set up compact I/O info object */ H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); - cpt_io_info.store = &cpt_store; - cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; + memcpy(&cpt_dset_info, dset_info, sizeof(cpt_dset_info)); + cpt_dset_info.store = &cpt_store; + cpt_dset_info.layout_ops = *H5D_LOPS_COMPACT; + cpt_io_info.dsets_info = &cpt_dset_info; + cpt_io_info.count = 1; /* Initialize temporary compact storage info */ cpt_store.compact.dirty = &cpt_dirty; /* Iterate through nodes in chunk skip list */ - chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm); + chunk_node = H5D_CHUNK_GET_FIRST_NODE(dset_info); while (chunk_node) { - H5D_chunk_info_t *chunk_info; /* Chunk information */ + H5D_piece_info_t *chunk_info; /* Chunk information */ H5D_chunk_ud_t udata; /* Chunk index pass-through */ htri_t cacheable; /* Whether the chunk is cacheable */ /* Get the actual chunk information from the skip list node */ - chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); + chunk_info = H5D_CHUNK_GET_NODE_INFO(dset_info, chunk_node); /* Get the info for the chunk in the file */ - if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + if (H5D__chunk_lookup(dset_info->dset, chunk_info->scaled, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); /* Sanity check */ - HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || - (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + assert((H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || + (!H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); /* Check for non-existent chunk & skip it if appropriate */ - if (H5F_addr_defined(udata.chunk_block.offset) || UINT_MAX != udata.idx_hint || + if (H5_addr_defined(udata.chunk_block.offset) || UINT_MAX != udata.idx_hint || !skip_missing_chunks) { H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */ void *chunk = NULL; /* Pointer to locked chunk buffer */ /* Set chunk's [scaled] coordinates */ - io_info->store->chunk.scaled = chunk_info->scaled; + dset_info->store->chunk.scaled = chunk_info->scaled; /* Determine if we should use the chunk cache */ - if ((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable") + if ((cacheable = H5D__chunk_cacheable(io_info, dset_info, udata.chunk_block.offset, FALSE)) < + 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable"); if (cacheable) { /* Load the chunk into cache and lock it. */ /* Compute # of bytes accessed in chunk */ - H5_CHECK_OVERFLOW(type_info->src_type_size, /*From:*/ size_t, /*To:*/ uint32_t); - src_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->src_type_size; + H5_CHECK_OVERFLOW(dset_info->type_info.src_type_size, /*From:*/ size_t, /*To:*/ uint32_t); + H5_CHECK_OVERFLOW(chunk_info->piece_points, /*From:*/ size_t, /*To:*/ uint32_t); + src_accessed_bytes = + (uint32_t)chunk_info->piece_points * (uint32_t)dset_info->type_info.src_type_size; /* Lock the chunk into the cache */ - if (NULL == (chunk = H5D__chunk_lock(io_info, &udata, FALSE, FALSE))) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") + if (NULL == (chunk = H5D__chunk_lock(io_info, dset_info, &udata, FALSE, FALSE))) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk"); /* Set up the storage buffer information for this chunk */ cpt_store.compact.buf = chunk; @@ -2759,7 +2861,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_ /* Point I/O info at contiguous I/O info for this chunk */ chk_io_info = &cpt_io_info; } /* end if */ - else if (H5F_addr_defined(udata.chunk_block.offset)) { + else if (H5_addr_defined(udata.chunk_block.offset)) { /* Set up the storage address information for this chunk */ ctg_store.contig.dset_addr = udata.chunk_block.offset; @@ -2772,35 +2874,40 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_ } /* end else */ /* Perform the actual read operation */ - if ((io_info->io_ops.single_read)(chk_io_info, type_info, (hsize_t)chunk_info->chunk_points, - chunk_info->fspace, chunk_info->mspace) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed") + assert(chk_io_info->count == 1); + chk_io_info->dsets_info[0].layout_io_info.contig_piece_info = chunk_info; + chk_io_info->dsets_info[0].file_space = chunk_info->fspace; + chk_io_info->dsets_info[0].mem_space = chunk_info->mspace; + chk_io_info->dsets_info[0].nelmts = chunk_info->piece_points; + if ((dset_info->io_ops.single_read)(chk_io_info, &chk_io_info->dsets_info[0]) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked read failed"); /* Release the cache lock on the chunk. */ - if (chunk && H5D__chunk_unlock(io_info, &udata, FALSE, chunk, src_accessed_bytes) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") + if (chunk && + H5D__chunk_unlock(io_info, dset_info, &udata, FALSE, chunk, src_accessed_bytes) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk"); } /* end if */ /* Advance to next chunk in list */ - chunk_node = H5D_CHUNK_GET_NEXT_NODE(fm, chunk_node); + chunk_node = H5D_CHUNK_GET_NEXT_NODE(dset_info, chunk_node); } /* end while */ } /* end else */ done: /* Cleanup on failure */ if (ret_value < 0) { - if (chunk_mem_spaces != chunk_mem_spaces_static) + if (chunk_mem_spaces != chunk_mem_spaces_local) chunk_mem_spaces = H5MM_xfree(chunk_mem_spaces); - if (chunk_file_spaces != chunk_file_spaces_static) + if (chunk_file_spaces != chunk_file_spaces_local) chunk_file_spaces = H5MM_xfree(chunk_file_spaces); - if (chunk_addrs != chunk_addrs_static) + if (chunk_addrs != chunk_addrs_local) chunk_addrs = H5MM_xfree(chunk_addrs); } /* end if */ /* Make sure we cleaned up */ - HDassert(!chunk_mem_spaces || chunk_mem_spaces == chunk_mem_spaces_static); - HDassert(!chunk_file_spaces || chunk_file_spaces == chunk_file_spaces_static); - HDassert(!chunk_addrs || chunk_addrs == chunk_addrs_static); + assert(!chunk_mem_spaces || chunk_mem_spaces == chunk_mem_spaces_local); + assert(!chunk_file_spaces || chunk_file_spaces == chunk_file_spaces_local); + assert(!chunk_addrs || chunk_addrs == chunk_addrs_local); FUNC_LEAVE_NOAPI(ret_value) } /* H5D__chunk_read() */ @@ -2812,118 +2919,126 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Thursday, April 10, 2003 - * *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t H5_ATTR_UNUSED nelmts, - H5S_t H5_ATTR_UNUSED *file_space, H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm) +H5D__chunk_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info) { - H5SL_node_t *chunk_node; /* Current node in chunk skip list */ - H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */ - H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */ - H5D_io_info_t cpt_io_info; /* Compact I/O info object */ - H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */ - hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */ - uint32_t dst_accessed_bytes = 0; /* Total accessed size in a chunk */ - H5S_t **chunk_mem_spaces = NULL; /* Array of chunk memory spaces */ - H5S_t *chunk_mem_spaces_static[8]; /* Static buffer for chunk_mem_spaces */ - H5S_t **chunk_file_spaces = NULL; /* Array of chunk file spaces */ - H5S_t *chunk_file_spaces_static[8]; /* Static buffer for chunk_file_spaces */ - haddr_t *chunk_addrs = NULL; /* Array of chunk addresses */ - haddr_t chunk_addrs_static[8]; /* Static buffer for chunk_addrs */ - herr_t ret_value = SUCCEED; /* Return value */ + H5SL_node_t *chunk_node; /* Current node in chunk skip list */ + H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */ + H5D_dset_io_info_t ctg_dset_info; /* Contiguous I/O dset info object */ + H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */ + H5D_io_info_t cpt_io_info; /* Compact I/O info object */ + H5D_dset_io_info_t cpt_dset_info; /* Compact I/O dset info object */ + H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */ + hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */ + uint32_t dst_accessed_bytes = 0; /* Total accessed size in a chunk */ + H5S_t **chunk_mem_spaces = NULL; /* Array of chunk memory spaces */ + H5S_t *chunk_mem_spaces_local[8]; /* Local buffer for chunk_mem_spaces */ + H5S_t **chunk_file_spaces = NULL; /* Array of chunk file spaces */ + H5S_t *chunk_file_spaces_local[8]; /* Local buffer for chunk_file_spaces */ + haddr_t *chunk_addrs = NULL; /* Array of chunk addresses */ + haddr_t chunk_addrs_local[8]; /* Local buffer for chunk_addrs */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(io_info->u.wbuf); - HDassert(type_info); - HDassert(fm); + assert(io_info); + assert(dset_info); + assert(dset_info->buf.cvp); /* Set up contiguous I/O info object */ H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); - ctg_io_info.store = &ctg_store; - ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; + memcpy(&ctg_dset_info, dset_info, sizeof(ctg_dset_info)); + ctg_dset_info.store = &ctg_store; + ctg_dset_info.layout_ops = *H5D_LOPS_CONTIG; + ctg_io_info.dsets_info = &ctg_dset_info; + ctg_io_info.count = 1; /* Initialize temporary contiguous storage info */ - H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, + H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, dset_info->dset->shared->layout.u.chunk.size, uint32_t); /* Set up compact I/O info object */ H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); - cpt_io_info.store = &cpt_store; - cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; + memcpy(&cpt_dset_info, dset_info, sizeof(cpt_dset_info)); + cpt_dset_info.store = &cpt_store; + cpt_dset_info.layout_ops = *H5D_LOPS_COMPACT; + cpt_io_info.dsets_info = &cpt_dset_info; + cpt_io_info.count = 1; /* Initialize temporary compact storage info */ cpt_store.compact.dirty = &cpt_dirty; /* Different blocks depending on whether we're using selection I/O */ - if (io_info->use_select_io) { - size_t num_chunks; - size_t element_sizes[2] = {type_info->dst_type_size, 0}; - const void *bufs[2] = {io_info->u.wbuf, NULL}; - - /* Cache number of chunks */ - num_chunks = H5D_CHUNK_GET_NODE_COUNT(fm); - - /* Allocate arrays of dataspaces and offsets for use with selection I/O, - * or point to static buffers */ - HDassert(sizeof(chunk_mem_spaces_static) / sizeof(chunk_mem_spaces_static[0]) == - sizeof(chunk_file_spaces_static) / sizeof(chunk_file_spaces_static[0])); - HDassert(sizeof(chunk_mem_spaces_static) / sizeof(chunk_mem_spaces_static[0]) == - sizeof(chunk_addrs_static) / sizeof(chunk_addrs_static[0])); - if (num_chunks > (sizeof(chunk_mem_spaces_static) / sizeof(chunk_mem_spaces_static[0]))) { - if (NULL == (chunk_mem_spaces = H5MM_malloc(num_chunks * sizeof(H5S_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for memory space list") - if (NULL == (chunk_file_spaces = H5MM_malloc(num_chunks * sizeof(H5S_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for file space list") - if (NULL == (chunk_addrs = H5MM_malloc(num_chunks * sizeof(haddr_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for chunk address list") - } /* end if */ - else { - chunk_mem_spaces = chunk_mem_spaces_static; - chunk_file_spaces = chunk_file_spaces_static; - chunk_addrs = chunk_addrs_static; - } /* end else */ + if (io_info->use_select_io == H5D_SELECTION_IO_MODE_ON) { + size_t num_chunks = 0; + size_t element_sizes[2] = {dset_info->type_info.dst_type_size, 0}; + const void *bufs[2] = {dset_info->buf.cvp, NULL}; + + /* Only create selection I/O arrays if not performing multi dataset I/O, + * otherwise the higher level will handle it */ + if (H5D_LAYOUT_CB_PERFORM_IO(io_info)) { + /* Cache number of chunks */ + num_chunks = H5D_CHUNK_GET_NODE_COUNT(dset_info); + + /* Allocate arrays of dataspaces and offsets for use with selection I/O, + * or point to local buffers */ + assert(sizeof(chunk_mem_spaces_local) / sizeof(chunk_mem_spaces_local[0]) == + sizeof(chunk_file_spaces_local) / sizeof(chunk_file_spaces_local[0])); + assert(sizeof(chunk_mem_spaces_local) / sizeof(chunk_mem_spaces_local[0]) == + sizeof(chunk_addrs_local) / sizeof(chunk_addrs_local[0])); + if (num_chunks > (sizeof(chunk_mem_spaces_local) / sizeof(chunk_mem_spaces_local[0]))) { + if (NULL == (chunk_mem_spaces = H5MM_malloc(num_chunks * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for memory space list"); + if (NULL == (chunk_file_spaces = H5MM_malloc(num_chunks * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for file space list"); + if (NULL == (chunk_addrs = H5MM_malloc(num_chunks * sizeof(haddr_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for chunk address list"); + } /* end if */ + else { + chunk_mem_spaces = chunk_mem_spaces_local; + chunk_file_spaces = chunk_file_spaces_local; + chunk_addrs = chunk_addrs_local; + } /* end else */ - /* Reset num_chunks */ - num_chunks = 0; + /* Reset num_chunks */ + num_chunks = 0; + } /* end if */ /* Iterate through nodes in chunk skip list */ - chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm); + chunk_node = H5D_CHUNK_GET_FIRST_NODE(dset_info); while (chunk_node) { - H5D_chunk_info_t *chunk_info; /* Chunk information */ + H5D_piece_info_t *chunk_info; /* Chunk information */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_chunk_ud_t udata; /* Index pass-through */ htri_t cacheable; /* Whether the chunk is cacheable */ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ /* Get the actual chunk information from the skip list node */ - chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); + chunk_info = H5D_CHUNK_GET_NODE_INFO(dset_info, chunk_node); /* Get the info for the chunk in the file */ - if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + if (H5D__chunk_lookup(dset_info->dset, chunk_info->scaled, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); /* There should be no chunks cached */ - HDassert(UINT_MAX == udata.idx_hint); + assert(UINT_MAX == udata.idx_hint); /* Sanity check */ - HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || - (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + assert((H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || + (!H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); /* Set chunk's [scaled] coordinates */ - io_info->store->chunk.scaled = chunk_info->scaled; + dset_info->store->chunk.scaled = chunk_info->scaled; /* Determine if we should use the chunk cache */ - if ((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable") + if ((cacheable = H5D__chunk_cacheable(io_info, dset_info, udata.chunk_block.offset, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable"); if (cacheable) { /* Load the chunk into cache. But if the whole chunk is written, * simply allocate space instead of load the chunk. */ @@ -2931,101 +3046,142 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */ /* Compute # of bytes accessed in chunk */ - H5_CHECK_OVERFLOW(type_info->dst_type_size, /*From:*/ size_t, /*To:*/ uint32_t); - dst_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->dst_type_size; + H5_CHECK_OVERFLOW(dset_info->type_info.dst_type_size, /*From:*/ size_t, /*To:*/ uint32_t); + H5_CHECK_OVERFLOW(chunk_info->piece_points, /*From:*/ size_t, /*To:*/ uint32_t); + dst_accessed_bytes = + (uint32_t)chunk_info->piece_points * (uint32_t)dset_info->type_info.dst_type_size; /* Determine if we will access all the data in the chunk */ if (dst_accessed_bytes != ctg_store.contig.dset_size || - (chunk_info->chunk_points * type_info->src_type_size) != ctg_store.contig.dset_size || - fm->fsel_type == H5S_SEL_POINTS) + (chunk_info->piece_points * dset_info->type_info.src_type_size) != + ctg_store.contig.dset_size || + dset_info->layout_io_info.chunk_map->fsel_type == H5S_SEL_POINTS) entire_chunk = FALSE; /* Lock the chunk into the cache */ - if (NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk, FALSE))) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") + if (NULL == (chunk = H5D__chunk_lock(io_info, dset_info, &udata, entire_chunk, FALSE))) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk"); /* Set up the storage buffer information for this chunk */ cpt_store.compact.buf = chunk; + /* Set up compact dataset info for write to cached chunk */ + cpt_dset_info.layout_io_info.contig_piece_info = chunk_info; + cpt_dset_info.file_space = chunk_info->fspace; + cpt_dset_info.mem_space = chunk_info->mspace; + cpt_dset_info.nelmts = chunk_info->piece_points; + + /* Set request_nelmts. This is not normally set by the upper layers because selection I/O + * usually does not use strip mining (H5D__scatgath_write), and instead allocates buffers + * large enough for the entire I/O. Set request_nelmts to be large enough for all selected + * elements in this chunk because it must be at least that large */ + cpt_dset_info.type_info.request_nelmts = cpt_dset_info.nelmts; + /* Perform the actual write operation */ - if ((io_info->io_ops.single_write)(&cpt_io_info, type_info, (hsize_t)chunk_info->chunk_points, - chunk_info->fspace, chunk_info->mspace) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed") + if ((dset_info->io_ops.single_write)(&cpt_io_info, &cpt_dset_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed"); /* Release the cache lock on the chunk */ - if (H5D__chunk_unlock(io_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") + if (H5D__chunk_unlock(io_info, dset_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk"); } /* end if */ else { /* If the chunk hasn't been allocated on disk, do so now. */ - if (!H5F_addr_defined(udata.chunk_block.offset)) { + if (!H5_addr_defined(udata.chunk_block.offset)) { /* Compose chunked index info struct */ - idx_info.f = io_info->dset->oloc.file; - idx_info.pline = &(io_info->dset->shared->dcpl_cache.pline); - idx_info.layout = &(io_info->dset->shared->layout.u.chunk); - idx_info.storage = &(io_info->dset->shared->layout.storage.u.chunk); + idx_info.f = dset_info->dset->oloc.file; + idx_info.pline = &(dset_info->dset->shared->dcpl_cache.pline); + idx_info.layout = &(dset_info->dset->shared->layout.u.chunk); + idx_info.storage = &(dset_info->dset->shared->layout.storage.u.chunk); /* Set up the size of chunk for user data */ - udata.chunk_block.length = io_info->dset->shared->layout.u.chunk.size; + udata.chunk_block.length = dset_info->dset->shared->layout.u.chunk.size; /* Allocate the chunk */ if (H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, chunk_info->scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, - "unable to insert/resize chunk on chunk level") + "unable to insert/resize chunk on chunk level"); /* Make sure the address of the chunk is returned. */ - if (!H5F_addr_defined(udata.chunk_block.offset)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined") + if (!H5_addr_defined(udata.chunk_block.offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined"); /* Cache the new chunk information */ - H5D__chunk_cinfo_cache_update(&io_info->dset->shared->cache.chunk.last, &udata); + H5D__chunk_cinfo_cache_update(&dset_info->dset->shared->cache.chunk.last, &udata); /* Insert chunk into index */ - if (need_insert && io_info->dset->shared->layout.storage.u.chunk.ops->insert) - if ((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, - NULL) < 0) + if (need_insert && dset_info->dset->shared->layout.storage.u.chunk.ops->insert) + if ((dset_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, + NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, - "unable to insert chunk addr into index") + "unable to insert chunk addr into index"); } /* end if */ - /* Add chunk to list for selection I/O */ - chunk_mem_spaces[num_chunks] = chunk_info->mspace; - chunk_file_spaces[num_chunks] = chunk_info->fspace; - chunk_addrs[num_chunks] = udata.chunk_block.offset; - num_chunks++; + /* Add chunk to list for selection I/O, if not performing multi dataset I/O */ + if (H5D_LAYOUT_CB_PERFORM_IO(io_info)) { + chunk_mem_spaces[num_chunks] = chunk_info->mspace; + chunk_file_spaces[num_chunks] = chunk_info->fspace; + chunk_addrs[num_chunks] = udata.chunk_block.offset; + num_chunks++; + } /* end if */ + else { + /* Add to mdset selection I/O arrays */ + assert(io_info->mem_spaces); + assert(io_info->file_spaces); + assert(io_info->addrs); + assert(io_info->element_sizes); + assert(io_info->wbufs); + assert(io_info->pieces_added < io_info->piece_count); + + io_info->mem_spaces[io_info->pieces_added] = chunk_info->mspace; + io_info->file_spaces[io_info->pieces_added] = chunk_info->fspace; + io_info->addrs[io_info->pieces_added] = udata.chunk_block.offset; + io_info->element_sizes[io_info->pieces_added] = element_sizes[0]; + io_info->wbufs[io_info->pieces_added] = bufs[0]; + if (io_info->sel_pieces) + io_info->sel_pieces[io_info->pieces_added] = chunk_info; + io_info->pieces_added++; + } } /* end else */ /* Advance to next chunk in list */ - chunk_node = H5D_CHUNK_GET_NEXT_NODE(fm, chunk_node); + chunk_node = H5D_CHUNK_GET_NEXT_NODE(dset_info, chunk_node); } /* end while */ - /* Issue selection I/O call (we can skip the page buffer because we've - * already verified it won't be used, and the metadata accumulator - * because this is raw data) */ - if (H5F_shared_select_write(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, (uint32_t)num_chunks, - chunk_mem_spaces, chunk_file_spaces, chunk_addrs, element_sizes, - bufs) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunk selection read failed") - - /* Clean up memory */ - if (chunk_mem_spaces != chunk_mem_spaces_static) { - HDassert(chunk_mem_spaces); - HDassert(chunk_file_spaces != chunk_file_spaces_static); - HDassert(chunk_addrs != chunk_addrs_static); - H5MM_free(chunk_mem_spaces); - chunk_mem_spaces = NULL; - H5MM_free(chunk_file_spaces); - chunk_file_spaces = NULL; - H5MM_free(chunk_addrs); - chunk_addrs = NULL; - } /* end if */ - } /* end if */ + /* Only perform I/O if not performing multi dataset I/O or type conversion, otherwise the + * higher level will handle it after all datasets have been processed */ + if (H5D_LAYOUT_CB_PERFORM_IO(io_info)) { + /* Issue selection I/O call (we can skip the page buffer because we've + * already verified it won't be used, and the metadata accumulator + * because this is raw data) */ + H5_CHECK_OVERFLOW(num_chunks, size_t, uint32_t); + if (H5F_shared_select_write(H5F_SHARED(dset_info->dset->oloc.file), H5FD_MEM_DRAW, + (uint32_t)num_chunks, chunk_mem_spaces, chunk_file_spaces, + chunk_addrs, element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "chunk selection write failed"); + + /* Clean up memory */ + if (chunk_mem_spaces != chunk_mem_spaces_local) { + assert(chunk_file_spaces != chunk_file_spaces_local); + assert(chunk_addrs != chunk_addrs_local); + chunk_mem_spaces = H5MM_xfree(chunk_mem_spaces); + chunk_file_spaces = H5MM_xfree(chunk_file_spaces); + chunk_addrs = H5MM_xfree(chunk_addrs); + } /* end if */ + } /* end if */ + +#ifdef H5_HAVE_PARALLEL + /* Report that collective chunk I/O was used (will only be set on the DXPL if collective I/O was + * requested) */ + io_info->actual_io_mode |= H5D_MPIO_CHUNK_COLLECTIVE; +#endif /* H5_HAVE_PARALLEL */ + } /* end if */ else { /* Iterate through nodes in chunk skip list */ - chunk_node = H5D_CHUNK_GET_FIRST_NODE(fm); + chunk_node = H5D_CHUNK_GET_FIRST_NODE(dset_info); while (chunk_node) { - H5D_chunk_info_t *chunk_info; /* Chunk information */ + H5D_piece_info_t *chunk_info; /* Chunk information */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_io_info_t *chk_io_info; /* Pointer to I/O info object for this chunk */ void *chunk; /* Pointer to locked chunk buffer */ @@ -3034,40 +3190,43 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ /* Get the actual chunk information from the skip list node */ - chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); + chunk_info = H5D_CHUNK_GET_NODE_INFO(dset_info, chunk_node); /* Look up the chunk */ - if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + if (H5D__chunk_lookup(dset_info->dset, chunk_info->scaled, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); /* Sanity check */ - HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || - (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + assert((H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || + (!H5_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); /* Set chunk's [scaled] coordinates */ - io_info->store->chunk.scaled = chunk_info->scaled; + dset_info->store->chunk.scaled = chunk_info->scaled; /* Determine if we should use the chunk cache */ - if ((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable") + if ((cacheable = H5D__chunk_cacheable(io_info, dset_info, udata.chunk_block.offset, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable"); if (cacheable) { /* Load the chunk into cache. But if the whole chunk is written, * simply allocate space instead of load the chunk. */ hbool_t entire_chunk = TRUE; /* Whether whole chunk is selected */ /* Compute # of bytes accessed in chunk */ - H5_CHECK_OVERFLOW(type_info->dst_type_size, /*From:*/ size_t, /*To:*/ uint32_t); - dst_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->dst_type_size; + H5_CHECK_OVERFLOW(dset_info->type_info.dst_type_size, /*From:*/ size_t, /*To:*/ uint32_t); + H5_CHECK_OVERFLOW(chunk_info->piece_points, /*From:*/ size_t, /*To:*/ uint32_t); + dst_accessed_bytes = + (uint32_t)chunk_info->piece_points * (uint32_t)dset_info->type_info.dst_type_size; /* Determine if we will access all the data in the chunk */ if (dst_accessed_bytes != ctg_store.contig.dset_size || - (chunk_info->chunk_points * type_info->src_type_size) != ctg_store.contig.dset_size || - fm->fsel_type == H5S_SEL_POINTS) + (chunk_info->piece_points * dset_info->type_info.src_type_size) != + ctg_store.contig.dset_size || + dset_info->layout_io_info.chunk_map->fsel_type == H5S_SEL_POINTS) entire_chunk = FALSE; /* Lock the chunk into the cache */ - if (NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk, FALSE))) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") + if (NULL == (chunk = H5D__chunk_lock(io_info, dset_info, &udata, entire_chunk, FALSE))) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk"); /* Set up the storage buffer information for this chunk */ cpt_store.compact.buf = chunk; @@ -3077,28 +3236,28 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize } /* end if */ else { /* If the chunk hasn't been allocated on disk, do so now. */ - if (!H5F_addr_defined(udata.chunk_block.offset)) { + if (!H5_addr_defined(udata.chunk_block.offset)) { /* Compose chunked index info struct */ - idx_info.f = io_info->dset->oloc.file; - idx_info.pline = &(io_info->dset->shared->dcpl_cache.pline); - idx_info.layout = &(io_info->dset->shared->layout.u.chunk); - idx_info.storage = &(io_info->dset->shared->layout.storage.u.chunk); + idx_info.f = dset_info->dset->oloc.file; + idx_info.pline = &(dset_info->dset->shared->dcpl_cache.pline); + idx_info.layout = &(dset_info->dset->shared->layout.u.chunk); + idx_info.storage = &(dset_info->dset->shared->layout.storage.u.chunk); /* Set up the size of chunk for user data */ - udata.chunk_block.length = io_info->dset->shared->layout.u.chunk.size; + udata.chunk_block.length = dset_info->dset->shared->layout.u.chunk.size; /* Allocate the chunk */ if (H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, chunk_info->scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, - "unable to insert/resize chunk on chunk level") + "unable to insert/resize chunk on chunk level"); /* Make sure the address of the chunk is returned. */ - if (!H5F_addr_defined(udata.chunk_block.offset)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined") + if (!H5_addr_defined(udata.chunk_block.offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk address isn't defined"); /* Cache the new chunk information */ - H5D__chunk_cinfo_cache_update(&io_info->dset->shared->cache.chunk.last, &udata); + H5D__chunk_cinfo_cache_update(&dset_info->dset->shared->cache.chunk.last, &udata); } /* end if */ /* Set up the storage address information for this chunk */ @@ -3112,43 +3271,47 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize } /* end else */ /* Perform the actual write operation */ - if ((io_info->io_ops.single_write)(chk_io_info, type_info, (hsize_t)chunk_info->chunk_points, - chunk_info->fspace, chunk_info->mspace) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed") + assert(chk_io_info->count == 1); + chk_io_info->dsets_info[0].layout_io_info.contig_piece_info = chunk_info; + chk_io_info->dsets_info[0].file_space = chunk_info->fspace; + chk_io_info->dsets_info[0].mem_space = chunk_info->mspace; + chk_io_info->dsets_info[0].nelmts = chunk_info->piece_points; + if ((dset_info->io_ops.single_write)(chk_io_info, &chk_io_info->dsets_info[0]) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "chunked write failed"); /* Release the cache lock on the chunk, or insert chunk into index. */ if (chunk) { - if (H5D__chunk_unlock(io_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk") + if (H5D__chunk_unlock(io_info, dset_info, &udata, TRUE, chunk, dst_accessed_bytes) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to unlock raw data chunk"); } /* end if */ else { - if (need_insert && io_info->dset->shared->layout.storage.u.chunk.ops->insert) - if ((io_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, NULL) < - 0) + if (need_insert && dset_info->dset->shared->layout.storage.u.chunk.ops->insert) + if ((dset_info->dset->shared->layout.storage.u.chunk.ops->insert)(&idx_info, &udata, + NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, - "unable to insert chunk addr into index") + "unable to insert chunk addr into index"); } /* end else */ /* Advance to next chunk in list */ - chunk_node = H5D_CHUNK_GET_NEXT_NODE(fm, chunk_node); + chunk_node = H5D_CHUNK_GET_NEXT_NODE(dset_info, chunk_node); } /* end while */ } /* end else */ done: /* Cleanup on failure */ if (ret_value < 0) { - if (chunk_mem_spaces != chunk_mem_spaces_static) + if (chunk_mem_spaces != chunk_mem_spaces_local) chunk_mem_spaces = H5MM_xfree(chunk_mem_spaces); - if (chunk_file_spaces != chunk_file_spaces_static) + if (chunk_file_spaces != chunk_file_spaces_local) chunk_file_spaces = H5MM_xfree(chunk_file_spaces); - if (chunk_addrs != chunk_addrs_static) + if (chunk_addrs != chunk_addrs_local) chunk_addrs = H5MM_xfree(chunk_addrs); } /* end if */ /* Make sure we cleaned up */ - HDassert(!chunk_mem_spaces || chunk_mem_spaces == chunk_mem_spaces_static); - HDassert(!chunk_file_spaces || chunk_file_spaces == chunk_file_spaces_static); - HDassert(!chunk_addrs || chunk_addrs == chunk_addrs_static); + assert(!chunk_mem_spaces || chunk_mem_spaces == chunk_mem_spaces_local); + assert(!chunk_file_spaces || chunk_file_spaces == chunk_file_spaces_local); + assert(!chunk_addrs || chunk_addrs == chunk_addrs_local); FUNC_LEAVE_NOAPI(ret_value) } /* H5D__chunk_write() */ @@ -3161,9 +3324,6 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -3177,7 +3337,7 @@ H5D__chunk_flush(H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); + assert(dset); /* Loop over all entries in the chunk cache */ for (ent = rdcc->head; ent; ent = next) { @@ -3186,7 +3346,7 @@ H5D__chunk_flush(H5D_t *dset) nerrors++; } /* end for */ if (nerrors) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3199,44 +3359,55 @@ H5D__chunk_flush(H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, May 17, 2003 - * *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_io_term(const H5D_chunk_map_t *fm) +H5D__chunk_io_term(H5D_io_info_t H5_ATTR_UNUSED *io_info, H5D_dset_io_info_t *di) { - herr_t ret_value = SUCCEED; /*return value */ + H5D_chunk_map_t *fm; /* Convenience pointer to chunk map */ + herr_t ret_value = SUCCEED; /*return value */ FUNC_ENTER_PACKAGE + assert(di); + + /* Set convenience pointer */ + fm = di->layout_io_info.chunk_map; + /* Single element I/O vs. multiple element I/O cleanup */ if (fm->use_single) { /* Sanity checks */ - HDassert(fm->sel_chunks == NULL); - HDassert(fm->single_chunk_info); - HDassert(fm->single_chunk_info->fspace_shared); - HDassert(fm->single_chunk_info->mspace_shared); + assert(fm->dset_sel_pieces == NULL); + assert(fm->last_piece_info == NULL); + assert(fm->single_piece_info); + assert(fm->single_piece_info->fspace_shared); + assert(fm->single_piece_info->mspace_shared); /* Reset the selection for the single element I/O */ H5S_select_all(fm->single_space, TRUE); } /* end if */ else { - /* Release the nodes on the list of selected chunks */ - if (fm->sel_chunks) - if (H5SL_free(fm->sel_chunks, H5D__free_chunk_info, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTNEXT, FAIL, "can't iterate over chunks") - } /* end else */ + /* Release the nodes on the list of selected pieces, or the last (only) + * piece if the skiplist is not available */ + if (fm->dset_sel_pieces) { + if (H5SL_free(fm->dset_sel_pieces, H5D__free_piece_info, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTNEXT, FAIL, "can't free dataset skip list"); + } /* end if */ + else if (fm->last_piece_info) { + if (H5D__free_piece_info(fm->last_piece_info, NULL, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't free piece info"); + fm->last_piece_info = NULL; + } /* end if */ + } /* end else */ - /* Free the memory chunk dataspace template */ + /* Free the memory piece dataspace template */ if (fm->mchunk_tmpl) if (H5S_close(fm->mchunk_tmpl) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "can't release memory chunk dataspace template") -#ifdef H5_HAVE_PARALLEL - if (fm->select_chunk) - H5MM_xfree(fm->select_chunk); -#endif /* H5_HAVE_PARALLEL */ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, + "can't release memory chunk dataspace template"); + + /* Free chunk map */ + di->layout_io_info.chunk_map = H5FL_FREE(H5D_chunk_map_t, di->layout_io_info.chunk_map); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3250,9 +3421,6 @@ H5D__chunk_io_term(const H5D_chunk_map_t *fm) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -3268,7 +3436,7 @@ H5D__chunk_dest(H5D_t *dset) FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Sanity checks */ - HDassert(dset); + assert(dset); H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Flush all the cached chunks */ @@ -3280,12 +3448,12 @@ H5D__chunk_dest(H5D_t *dset) /* Continue even if there are failures. */ if (nerrors) - HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks"); /* Release cache structures */ if (rdcc->slot) rdcc->slot = H5FL_SEQ_FREE(H5D_rdcc_ent_ptr_t, rdcc->slot); - HDmemset(rdcc, 0, sizeof(H5D_rdcc_t)); + memset(rdcc, 0, sizeof(H5D_rdcc_t)); /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -3295,7 +3463,7 @@ H5D__chunk_dest(H5D_t *dset) /* Free any index structures */ if (sc->ops->dest && (sc->ops->dest)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info"); done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -3308,9 +3476,6 @@ H5D__chunk_dest(H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 15, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -3321,13 +3486,13 @@ H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(storage); - HDassert(storage->ops); + assert(storage); + assert(storage->ops); H5D_CHUNK_STORAGE_INDEX_CHK(storage); /* Reset index structures */ if ((storage->ops->reset)(storage, reset_addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset chunk index info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3340,9 +3505,6 @@ H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 27, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -3351,7 +3513,7 @@ H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(last); + assert(last); /* Indicate that the cached info is not valid */ last->valid = FALSE; @@ -3366,9 +3528,6 @@ H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 27, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -3377,10 +3536,10 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(last); - HDassert(udata); - HDassert(udata->common.layout); - HDassert(udata->common.scaled); + assert(last); + assert(udata); + assert(udata->common.layout); + assert(udata->common.scaled); /* Stored the information to cache */ H5MM_memcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims); @@ -3402,9 +3561,6 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud * * Return: TRUE/FALSE/FAIL * - * Programmer: Quincey Koziol - * November 27, 2007 - * *------------------------------------------------------------------------- */ static hbool_t @@ -3415,10 +3571,10 @@ H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *uda FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(last); - HDassert(udata); - HDassert(udata->common.layout); - HDassert(udata->common.scaled); + assert(last); + assert(udata); + assert(udata->common.layout); + assert(udata->common.scaled); /* Check if the cached information is what is desired */ if (last->valid) { @@ -3427,7 +3583,7 @@ H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *uda /* Check that the scaled offset is the same */ for (u = 0; u < udata->common.layout->ndims; u++) if (last->scaled[u] != udata->common.scaled[u]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Retrieve the information from the cache */ udata->chunk_block.offset = last->addr; @@ -3436,7 +3592,7 @@ H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *uda udata->filter_mask = last->filter_mask; /* Indicate that the data was found */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ done: @@ -3453,9 +3609,6 @@ H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *uda * Return: Non-negative on success (with the layout information initialized * and ready to write to an object header). Negative on failure. * - * Programmer: Quincey Koziol - * Thursday, May 22, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -3468,10 +3621,9 @@ H5D__chunk_create(const H5D_t *dset /*in,out*/) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dset); - HDassert(H5D_CHUNKED == dset->shared->layout.type); - HDassert(dset->shared->layout.u.chunk.ndims > 0 && - dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS); + assert(dset); + assert(H5D_CHUNKED == dset->shared->layout.type); + assert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS); H5D_CHUNK_STORAGE_INDEX_CHK(sc); #ifndef NDEBUG @@ -3479,7 +3631,7 @@ H5D__chunk_create(const H5D_t *dset /*in,out*/) unsigned u; /* Local index variable */ for (u = 0; u < dset->shared->layout.u.chunk.ndims; u++) - HDassert(dset->shared->layout.u.chunk.dim[u] > 0); + assert(dset->shared->layout.u.chunk.dim[u] > 0); } #endif @@ -3491,7 +3643,7 @@ H5D__chunk_create(const H5D_t *dset /*in,out*/) /* Create the index for the chunks */ if ((sc->ops->create)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3505,8 +3657,6 @@ H5D__chunk_create(const H5D_t *dset /*in,out*/) * * Return: Hash value index * - * Programmer: Vailin Choi; Nov 2014 - * *------------------------------------------------------------------------- */ static unsigned @@ -3520,8 +3670,8 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(shared); - HDassert(scaled); + assert(shared); + assert(scaled); /* If the fastest changing dimension doesn't have enough entropy, use * other dimensions too @@ -3546,9 +3696,6 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled) * * Return: Non-negative on success/Negative on failure * - * Programmer: Albert Cheng - * June 27, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -3568,11 +3715,11 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(dset); - HDassert(dset->shared->layout.u.chunk.ndims > 0); + assert(dset); + assert(dset->shared->layout.u.chunk.ndims > 0); H5D_CHUNK_STORAGE_INDEX_CHK(sc); - HDassert(scaled); - HDassert(udata); + assert(scaled); + assert(udata); /* Initialize the query information about the chunk we are looking for */ udata->common.layout = &(dset->shared->layout.u.chunk); @@ -3612,8 +3759,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat udata->idx_hint = idx; udata->chunk_block.offset = ent->chunk_block.offset; udata->chunk_block.length = ent->chunk_block.length; - ; - udata->chunk_idx = ent->chunk_idx; + udata->chunk_idx = ent->chunk_idx; } /* end if */ else { /* Invalidate idx_hint, to signal that the chunk is not in cache */ @@ -3644,7 +3790,7 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat /* Go get the chunk information */ if ((sc->ops->get_addr)(&idx_info, udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address"); /* * Cache the information retrieved. @@ -3701,9 +3847,6 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -3716,11 +3859,11 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) FUNC_ENTER_PACKAGE - HDassert(dset); - HDassert(dset->shared); + assert(dset); + assert(dset->shared); H5D_CHUNK_STORAGE_INDEX_CHK(sc); - HDassert(ent); - HDassert(!ent->locked); + assert(ent); + assert(!ent->locked); buf = ent->chunk; if (ent->dirty) { @@ -3747,9 +3890,9 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) /* Retrieve filter settings from API context */ if (H5CX_get_err_detect(&err_detect) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info"); if (H5CX_get_filter_cb(&filter_cb) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function"); if (!reset) { /* @@ -3758,7 +3901,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) * for later. */ if (NULL == (buf = H5MM_malloc(alloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline"); H5MM_memcpy(buf, ent->chunk, alloc); } /* end if */ else { @@ -3775,18 +3918,18 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) H5_CHECKED_ASSIGN(nbytes, size_t, udata.chunk_block.length, hsize_t); if (H5Z_pipeline(&(dset->shared->dcpl_cache.pline), 0, &(udata.filter_mask), err_detect, filter_cb, &nbytes, &alloc, &buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, FAIL, "output pipeline failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, FAIL, "output pipeline failed"); #if H5_SIZEOF_SIZE_T > 4 /* Check for the chunk expanding too much to encode in a 32-bit value */ if (nbytes > ((size_t)0xffffffff)) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length"); #endif /* H5_SIZEOF_SIZE_T > 4 */ H5_CHECKED_ASSIGN(udata.chunk_block.length, hsize_t, nbytes, size_t); /* Indicate that the chunk must be allocated */ must_alloc = TRUE; } /* end if */ - else if (!H5F_addr_defined(udata.chunk_block.offset)) { + else if (!H5_addr_defined(udata.chunk_block.offset)) { /* Indicate that the chunk must be allocated */ must_alloc = TRUE; @@ -3805,7 +3948,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) ent->edge_chunk_state &= ~H5D_RDCC_NEWLY_DISABLED_FILTERS; } /* end else */ - HDassert(!(ent->edge_chunk_state & H5D_RDCC_NEWLY_DISABLED_FILTERS)); + assert(!(ent->edge_chunk_state & H5D_RDCC_NEWLY_DISABLED_FILTERS)); /* Check if the chunk needs to be allocated (it also could exist already * and the chunk alloc operation could resize it) @@ -3822,7 +3965,8 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) */ if (H5D__chunk_file_alloc(&idx_info, &(ent->chunk_block), &udata.chunk_block, &need_insert, ent->scaled) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, + "unable to insert/resize chunk on chunk level"); /* Update the chunk entry's info, in case it was allocated or relocated */ ent->chunk_block.offset = udata.chunk_block.offset; @@ -3830,16 +3974,16 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) } /* end if */ /* Write the data to the file */ - HDassert(H5F_addr_defined(udata.chunk_block.offset)); + assert(H5_addr_defined(udata.chunk_block.offset)); H5_CHECK_OVERFLOW(udata.chunk_block.length, hsize_t, size_t); if (H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); /* Insert the chunk record into the index */ if (need_insert && sc->ops->insert) if ((sc->ops->insert)(&idx_info, &udata, dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index"); /* Cache the chunk's info, in case it's accessed again shortly */ H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, &udata); @@ -3892,9 +4036,6 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -3906,15 +4047,15 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(dset); - HDassert(ent); - HDassert(!ent->locked); - HDassert(ent->idx < rdcc->nslots); + assert(dset); + assert(ent); + assert(!ent->locked); + assert(ent->idx < rdcc->nslots); if (flush) { /* Flush */ if (H5D__chunk_flush_entry(dset, ent, TRUE) < 0) - HDONE_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + HDONE_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); } /* end if */ else { /* Don't flush, just free chunk */ @@ -3938,7 +4079,7 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush) /* Unlink from temporary list */ if (ent->tmp_prev) { - HDassert(rdcc->tmp_head->tmp_next); + assert(rdcc->tmp_head->tmp_next); ent->tmp_prev->tmp_next = ent->tmp_next; if (ent->tmp_next) { ent->tmp_next->tmp_prev = ent->tmp_prev; @@ -3952,7 +4093,7 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush) rdcc->slot[ent->idx] = NULL; /* Remove from cache */ - HDassert(rdcc->slot[ent->idx] != ent); + assert(rdcc->slot[ent->idx] != ent); ent->idx = UINT_MAX; rdcc->nbytes_used -= dset->shared->layout.u.chunk.size; --rdcc->nused; @@ -3972,9 +4113,6 @@ H5D__chunk_cache_evict(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t flush) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -4065,7 +4203,7 @@ H5D__chunk_cache_prune(const H5D_t *dset, size_t size) } /* end while */ if (nerrors) - HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry") + HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to preempt one or more raw data cache entry"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4093,26 +4231,22 @@ H5D__chunk_cache_prune(const H5D_t *dset, size_t size) * * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ static void * -H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk) +H5D__chunk_lock(const H5D_io_info_t H5_ATTR_NDEBUG_UNUSED *io_info, const H5D_dset_io_info_t *dset_info, + H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk) { - const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ - H5O_pline_t *pline = - &(dset->shared->dcpl_cache - .pline); /* I/O pipeline info - always equal to the pline passed to H5D__chunk_mem_alloc */ - H5O_pline_t *old_pline = pline; /* Old pipeline, i.e. pipeline used to read the chunk */ - const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ - const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */ - H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */ - hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */ - H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache*/ - H5D_rdcc_ent_t *ent; /*cache entry */ - size_t chunk_size; /*size of a chunk */ + const H5D_t *dset; /* Convenience pointer to the dataset */ + H5O_pline_t *pline; /* I/O pipeline info - always equal to the pline passed to H5D__chunk_mem_alloc */ + H5O_pline_t *old_pline; /* Old pipeline, i.e. pipeline used to read the chunk */ + const H5O_layout_t *layout; /* Dataset layout */ + const H5O_fill_t *fill; /* Fill value info */ + H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */ + hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */ + H5D_rdcc_t *rdcc; /*raw data chunk cache*/ + H5D_rdcc_ent_t *ent; /*cache entry */ + size_t chunk_size; /*size of a chunk */ hbool_t disable_filters = FALSE; /* Whether to disable filters (when adding to cache) */ void *chunk = NULL; /*the file chunk */ void *ret_value = NULL; /* Return value */ @@ -4120,22 +4254,32 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(io_info); - HDassert(io_info->store); - HDassert(udata); - HDassert(dset); - HDassert(!(udata->new_unfilt_chunk && prev_unfilt_chunk)); - HDassert(!rdcc->tmp_head); + assert(io_info); + assert(dset_info); + assert(dset_info->store); + dset = dset_info->dset; + assert(dset); + assert(udata); + assert(!(udata->new_unfilt_chunk && prev_unfilt_chunk)); + + /* Set convenience pointers */ + pline = &(dset->shared->dcpl_cache.pline); + old_pline = pline; + layout = &(dset->shared->layout); + fill = &(dset->shared->dcpl_cache.fill); + rdcc = &(dset->shared->cache.chunk); + + assert(!rdcc->tmp_head); /* Get the chunk's size */ - HDassert(layout->u.chunk.size > 0); + assert(layout->u.chunk.size > 0); H5_CHECKED_ASSIGN(chunk_size, size_t, layout->u.chunk.size, uint32_t); /* Check if the chunk is in the cache */ if (UINT_MAX != udata->idx_hint) { /* Sanity check */ - HDassert(udata->idx_hint < rdcc->nslots); - HDassert(rdcc->slot[udata->idx_hint]); + assert(udata->idx_hint < rdcc->nslots); + assert(rdcc->slot[udata->idx_hint]); /* Get the entry */ ent = rdcc->slot[udata->idx_hint]; @@ -4146,7 +4290,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel /* Make sure this is the right chunk */ for (u = 0; u < layout->u.chunk.ndims - 1; u++) - HDassert(io_info->store->chunk.scaled[u] == ent->scaled[u]); + assert(dset_info->store->chunk.scaled[u] == ent->scaled[u]); } #endif /* NDEBUG */ @@ -4163,9 +4307,9 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel /* If this flag is set then partial chunk filters must be * disabled, and the chunk must not have previously been a * partial chunk (with disabled filters) */ - HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); - HDassert(!(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)); - HDassert(old_pline->nused); + assert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + assert(!(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)); + assert(old_pline->nused); /* Disable filters. Set pline to NULL instead of just the * default pipeline to make a quick failure more likely if the @@ -4176,7 +4320,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel */ if (NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for raw data chunk") + "memory allocation failed for raw data chunk"); H5MM_memcpy(chunk, ent->chunk, chunk_size); ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline); ent->chunk = (uint8_t *)chunk; @@ -4191,9 +4335,9 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel /* If this flag is set then partial chunk filters must be * disabled, and the chunk must have previously been a partial * chunk (with disabled filters) */ - HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); - HDassert((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)); - HDassert(pline->nused); + assert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + assert((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)); + assert(pline->nused); /* Mark the old pipeline as having been disabled */ old_pline = NULL; @@ -4202,7 +4346,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel */ if (NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for raw data chunk") + "memory allocation failed for raw data chunk"); H5MM_memcpy(chunk, ent->chunk, chunk_size); ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline); @@ -4245,14 +4389,14 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel /* Check if we should disable filters on this chunk */ if (pline->nused) { if (udata->new_unfilt_chunk) { - HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + assert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); /* Disable the filters for writing */ disable_filters = TRUE; pline = NULL; } /* end if */ else if (prev_unfilt_chunk) { - HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + assert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); /* Mark the filters as having been previously disabled (for the * chunk as currently on disk) - disable the filters for reading @@ -4261,9 +4405,9 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel } /* end if */ else if (layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { /* Check if this is an edge chunk */ - if (H5D__chunk_is_partial_edge_chunk(io_info->dset->shared->ndims, layout->u.chunk.dim, - io_info->store->chunk.scaled, - io_info->dset->shared->curr_dims)) { + if (H5D__chunk_is_partial_edge_chunk(dset->shared->ndims, layout->u.chunk.dim, + dset_info->store->chunk.scaled, + dset->shared->curr_dims)) { /* Disable the filters for both writing and reading */ disable_filters = TRUE; old_pline = NULL; @@ -4282,11 +4426,11 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel rdcc->stats.nhits++; if (NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk"); /* In the case that some dataset functions look through this data, * clear it to all 0s. */ - HDmemset(chunk, 0, chunk_size); + memset(chunk, 0, chunk_size); } /* end if */ else { /* @@ -4295,7 +4439,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel */ /* Check if the chunk exists on disk */ - if (H5F_addr_defined(chunk_addr)) { + if (H5_addr_defined(chunk_addr)) { size_t my_chunk_alloc = chunk_alloc; /* Allocated buffer size */ size_t buf_alloc = chunk_alloc; /* [Re-]allocated buffer size */ @@ -4304,10 +4448,10 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel if (NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, (udata->new_unfilt_chunk ? old_pline : pline)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for raw data chunk") + "memory allocation failed for raw data chunk"); if (H5F_shared_block_read(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, chunk) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk") + HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk"); if (old_pline && old_pline->nused) { H5Z_EDC_t err_detect; /* Error detection info */ @@ -4315,13 +4459,13 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel /* Retrieve filter settings from API context */ if (H5CX_get_err_detect(&err_detect) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get error detection info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get error detection info"); if (H5CX_get_filter_cb(&filter_cb) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get I/O filter callback function") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get I/O filter callback function"); if (H5Z_pipeline(old_pline, H5Z_FLAG_REVERSE, &(udata->filter_mask), err_detect, filter_cb, &my_chunk_alloc, &buf_alloc, &chunk) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, NULL, "data pipeline read failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, NULL, "data pipeline read failed"); /* Reallocate chunk if necessary */ if (udata->new_unfilt_chunk) { @@ -4330,7 +4474,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel if (NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, pline))) { (void)H5D__chunk_mem_xfree(tmp_chunk, old_pline); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for raw data chunk") + "memory allocation failed for raw data chunk"); } /* end if */ H5MM_memcpy(chunk, tmp_chunk, chunk_size); (void)H5D__chunk_mem_xfree(tmp_chunk, old_pline); @@ -4344,16 +4488,16 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel H5D_fill_value_t fill_status; /* Sanity check */ - HDassert(fill->alloc_time != H5D_ALLOC_TIME_EARLY); + assert(fill->alloc_time != H5D_ALLOC_TIME_EARLY); /* Chunk size on disk isn't [likely] the same size as the final chunk * size in memory, so allocate memory big enough. */ if (NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for raw data chunk") + "memory allocation failed for raw data chunk"); if (H5P_is_fill_value_defined(fill, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't tell if fill value defined"); if (fill->fill_time == H5D_FILL_TIME_ALLOC || (fill->fill_time == H5D_FILL_TIME_IFSET && @@ -4368,17 +4512,17 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel if (H5D__fill_init(&fb_info, chunk, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, (size_t)0, chunk_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't initialize fill buffer info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't initialize fill buffer info"); fb_info_init = TRUE; /* Check for VL datatype & non-default fill value */ if (fb_info.has_vlen_fill_type) /* Fill the buffer with VL datatype fill values */ if (H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "can't refill fill value buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "can't refill fill value buffer"); } /* end if */ else - HDmemset(chunk, 0, chunk_size); + memset(chunk, 0, chunk_size); /* Increment # of creations */ rdcc->stats.ninits++; @@ -4388,22 +4532,22 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel /* See if the chunk can be cached */ if (rdcc->nslots > 0 && chunk_size <= rdcc->nbytes_max) { /* Calculate the index */ - udata->idx_hint = H5D__chunk_hash_val(io_info->dset->shared, udata->common.scaled); + udata->idx_hint = H5D__chunk_hash_val(dset->shared, udata->common.scaled); /* Add the chunk to the cache only if the slot is not already locked */ ent = rdcc->slot[udata->idx_hint]; if (!ent || !ent->locked) { /* Preempt enough things from the cache to make room */ if (ent) { - if (H5D__chunk_cache_evict(io_info->dset, ent, TRUE) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache") + if (H5D__chunk_cache_evict(dset, ent, TRUE) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache"); } /* end if */ - if (H5D__chunk_cache_prune(io_info->dset, chunk_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache") + if (H5D__chunk_cache_prune(dset, chunk_size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache"); /* Create a new entry */ if (NULL == (ent = H5FL_CALLOC(H5D_rdcc_ent_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate raw data chunk entry") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate raw data chunk entry"); ent->edge_chunk_state = disable_filters ? H5D_RDCC_DISABLE_FILTERS : 0; if (udata->new_unfilt_chunk) @@ -4419,7 +4563,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel ent->chunk = (uint8_t *)chunk; /* Add it to the cache */ - HDassert(NULL == rdcc->slot[udata->idx_hint]); + assert(NULL == rdcc->slot[udata->idx_hint]); rdcc->slot[udata->idx_hint] = ent; ent->idx = udata->idx_hint; rdcc->nbytes_used += chunk_size; @@ -4447,7 +4591,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel /* Lock the chunk into the cache */ if (ent) { - HDassert(!ent->locked); + assert(!ent->locked); ent->locked = TRUE; chunk = ent->chunk; } /* end if */ @@ -4465,7 +4609,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel done: /* Release the fill buffer info, if it's been initialized */ if (fb_info_init && H5D__fill_term(&fb_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, NULL, "Can't release fill buffer info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, NULL, "Can't release fill buffer info"); /* Release the chunk allocated, on error */ if (!ret_value) @@ -4492,24 +4636,28 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t rel * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, - uint32_t naccessed) +H5D__chunk_unlock(const H5D_io_info_t H5_ATTR_NDEBUG_UNUSED *io_info, const H5D_dset_io_info_t *dset_info, + const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, uint32_t naccessed) { - const H5O_layout_t *layout = &(io_info->dset->shared->layout); /* Dataset layout */ - const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk); + const H5O_layout_t *layout; /* Dataset layout */ + const H5D_rdcc_t *rdcc; + const H5D_t *dset; /* Local pointer to the dataset info */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(udata); + assert(io_info); + assert(dset_info); + assert(udata); + + /* Set convenience pointers */ + layout = &(dset_info->dset->shared->layout); + rdcc = &(dset_info->dset->shared->cache.chunk); + dset = dset_info->dset; if (UINT_MAX == udata->idx_hint) { /* @@ -4520,55 +4668,55 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, hbo /* Check if we should disable filters on this chunk */ if (udata->new_unfilt_chunk) { - HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + assert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); is_unfiltered_edge_chunk = TRUE; } /* end if */ else if (layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { /* Check if the chunk is an edge chunk, and disable filters if so */ - is_unfiltered_edge_chunk = H5D__chunk_is_partial_edge_chunk( - io_info->dset->shared->ndims, layout->u.chunk.dim, io_info->store->chunk.scaled, - io_info->dset->shared->curr_dims); + is_unfiltered_edge_chunk = + H5D__chunk_is_partial_edge_chunk(dset->shared->ndims, layout->u.chunk.dim, + dset_info->store->chunk.scaled, dset->shared->curr_dims); } /* end if */ if (dirty) { H5D_rdcc_ent_t fake_ent; /* "fake" chunk cache entry */ - HDmemset(&fake_ent, 0, sizeof(fake_ent)); + memset(&fake_ent, 0, sizeof(fake_ent)); fake_ent.dirty = TRUE; if (is_unfiltered_edge_chunk) fake_ent.edge_chunk_state = H5D_RDCC_DISABLE_FILTERS; if (udata->new_unfilt_chunk) fake_ent.edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS; H5MM_memcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); - HDassert(layout->u.chunk.size > 0); + assert(layout->u.chunk.size > 0); fake_ent.chunk_idx = udata->chunk_idx; fake_ent.chunk_block.offset = udata->chunk_block.offset; fake_ent.chunk_block.length = udata->chunk_block.length; fake_ent.chunk = (uint8_t *)chunk; - if (H5D__chunk_flush_entry(io_info->dset, &fake_ent, TRUE) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + if (H5D__chunk_flush_entry(dset, &fake_ent, TRUE) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); } /* end if */ else { if (chunk) chunk = H5D__chunk_mem_xfree( - chunk, (is_unfiltered_edge_chunk ? NULL : &(io_info->dset->shared->dcpl_cache.pline))); + chunk, (is_unfiltered_edge_chunk ? NULL : &(dset->shared->dcpl_cache.pline))); } /* end else */ } /* end if */ else { H5D_rdcc_ent_t *ent; /* Chunk's entry in the cache */ /* Sanity check */ - HDassert(udata->idx_hint < rdcc->nslots); - HDassert(rdcc->slot[udata->idx_hint]); - HDassert(rdcc->slot[udata->idx_hint]->chunk == chunk); + assert(udata->idx_hint < rdcc->nslots); + assert(rdcc->slot[udata->idx_hint]); + assert(rdcc->slot[udata->idx_hint]->chunk == chunk); /* * It's in the cache so unlock it. */ ent = rdcc->slot[udata->idx_hint]; - HDassert(ent->locked); + assert(ent->locked); if (dirty) { ent->dirty = TRUE; ent->wr_count -= MIN(ent->wr_count, naccessed); @@ -4590,9 +4738,6 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, hbo * Return: Success: Non-negative * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, April 21, 1999 - * *------------------------------------------------------------------------- */ static int @@ -4616,9 +4761,6 @@ H5D__chunk_allocated_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) * Return: Success: Number of bytes stored in all chunks. * Failure: 0 * - * Programmer: Quincey Koziol - * Tuesday, May 20, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -4633,15 +4775,15 @@ H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes) FUNC_ENTER_PACKAGE - HDassert(dset); - HDassert(dset->shared); + assert(dset); + assert(dset->shared); H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Search for cached chunks that haven't been written out */ for (ent = rdcc->head; ent; ent = ent->next) /* Flush the chunk out to disk, to make certain the size is correct later */ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -4652,7 +4794,7 @@ H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes) /* Iterate over the chunks */ if ((sc->ops->iterate)(&idx_info, H5D__chunk_allocated_cb, &chunk_bytes) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to retrieve allocated chunk information from index") + "unable to retrieve allocated chunk information from index"); /* Set number of bytes for caller */ *nbytes = chunk_bytes; @@ -4670,15 +4812,11 @@ H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes) * * Return: Non-negative on success/Negative on failure * - * Programmer: Albert Cheng - * June 26, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const hsize_t old_dim[]) +H5D__chunk_allocate(const H5D_t *dset, hbool_t full_overwrite, const hsize_t old_dim[]) { - const H5D_t *dset = io_info->dset; /* the dataset pointer */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ const H5D_chunk_ops_t *ops = dset->shared->layout.storage.u.chunk.ops; /* Chunk operations */ hsize_t min_unalloc[H5O_LAYOUT_NDIMS]; /* First chunk in each dimension that is unallocated (in scaled @@ -4722,8 +4860,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dset && H5D_CHUNKED == layout->type); - HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + assert(dset && H5D_CHUNKED == layout->type); + assert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Retrieve the dataset dimensions */ @@ -4739,7 +4877,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const if (space_dim[op_dim] == 0) { /* Reset any cached chunk info for this dataset */ H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last); - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ #ifdef H5_HAVE_PARALLEL @@ -4761,7 +4899,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const for (op_dim = 0; op_dim < space_ndims; op_dim++) { /* Validate this chunk dimension */ if (chunk_dim[op_dim] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim); min_unalloc[op_dim] = (old_dim[op_dim] + chunk_dim[op_dim] - 1) / chunk_dim[op_dim]; max_unalloc[op_dim] = (space_dim[op_dim] - 1) / chunk_dim[op_dim]; @@ -4783,7 +4921,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const /* Check the dataset's fill-value status */ if (H5P_is_fill_value_defined(fill, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined"); /* If we are filling the dataset on allocation or "if set" and * the fill value _is_ set, _and_ we are not overwriting the new blocks, @@ -4804,7 +4942,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const if (H5D__fill_init(&fb_info, NULL, H5D__chunk_mem_alloc, pline, H5D__chunk_mem_free, pline, &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, (size_t)0, orig_chunk_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info"); fb_info_init = TRUE; /* Initialize the fill_buf pointer to the buffer in fb_info. If edge @@ -4826,24 +4964,24 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const if (has_unfilt_edge_chunks) { if (NULL == (unfilt_fill_buf = H5D__chunk_mem_alloc(orig_chunk_size, &def_pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for raw data chunk") + "memory allocation failed for raw data chunk"); H5MM_memcpy(unfilt_fill_buf, fb_info.fill_buf, orig_chunk_size); } /* end if */ /* Retrieve filter settings from API context */ if (H5CX_get_err_detect(&err_detect) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info"); if (H5CX_get_filter_cb(&filter_cb) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function"); /* Push the chunk through the filters */ if (H5Z_pipeline(pline, 0, &filter_mask, err_detect, filter_cb, &orig_chunk_size, &buf_size, &fb_info.fill_buf) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed") + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed"); #if H5_SIZEOF_SIZE_T > 4 /* Check for the chunk expanding too much to encode in a 32-bit value */ if (orig_chunk_size > ((size_t)0xffffffff)) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length"); #endif /* H5_SIZEOF_SIZE_T > 4 */ } /* end if */ } /* end if */ @@ -4886,7 +5024,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const continue; else { /* Reset the chunk offset indices */ - HDmemset(scaled, 0, (space_ndims * sizeof(scaled[0]))); + memset(scaled, 0, (space_ndims * sizeof(scaled[0]))); scaled[op_dim] = min_unalloc[op_dim]; if (has_unfilt_edge_chunks) { @@ -4898,8 +5036,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const /* Initialize chunk_size and fill_buf */ if (should_fill && !fb_info.has_vlen_fill_type) { - HDassert(fb_info_init); - HDassert(unfilt_fill_buf); + assert(fb_info_init); + assert(unfilt_fill_buf); if (nunfilt_edge_chunk_dims) { fill_buf = &unfilt_fill_buf; chunk_size = layout->u.chunk.size; @@ -4919,11 +5057,11 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const /* Look up this chunk */ if (H5D__chunk_lookup(dset, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); #ifndef NDEBUG /* None of the chunks should be allocated */ if (H5D_CHUNK_IDX_NONE != sc->idx_type) - HDassert(!H5F_addr_defined(udata.chunk_block.offset)); + assert(!H5_addr_defined(udata.chunk_block.offset)); /* Make sure the chunk is really in the dataset and outside the * original dimensions */ @@ -4932,21 +5070,21 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const hbool_t outside_orig = FALSE; for (v = 0; v < space_ndims; v++) { - HDassert((scaled[v] * chunk_dim[v]) < space_dim[v]); + assert((scaled[v] * chunk_dim[v]) < space_dim[v]); if ((scaled[v] * chunk_dim[v]) >= old_dim[v]) outside_orig = TRUE; } /* end for */ - HDassert(outside_orig); + assert(outside_orig); } /* end block */ #endif /* NDEBUG */ /* Check for VL datatype & non-default fill value */ if (fb_info_init && fb_info.has_vlen_fill_type) { /* Sanity check */ - HDassert(should_fill); - HDassert(!unfilt_fill_buf); + assert(should_fill); + assert(!unfilt_fill_buf); #ifdef H5_HAVE_PARALLEL - HDassert(!using_mpi); /* Can't write VL datatypes in parallel currently */ + assert(!using_mpi); /* Can't write VL datatypes in parallel currently */ #endif /* Check to make sure the buffer is large enough. It is @@ -4957,13 +5095,13 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const if (NULL == (fb_info.fill_buf = H5D__chunk_mem_realloc(fb_info.fill_buf, orig_chunk_size, pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory reallocation failed for raw data chunk") + "memory reallocation failed for raw data chunk"); fb_info.fill_buf_size = orig_chunk_size; } /* end if */ /* Fill the buffer with VL datatype fill values */ if (H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer"); /* Check if there are filters which need to be applied to the chunk */ if ((pline->nused > 0) && !nunfilt_edge_chunk_dims) { @@ -4973,19 +5111,19 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const /* Retrieve filter settings from API context */ if (H5CX_get_err_detect(&err_detect) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info"); if (H5CX_get_filter_cb(&filter_cb) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function"); /* Push the chunk through the filters */ if (H5Z_pipeline(pline, 0, &filter_mask, err_detect, filter_cb, &nbytes, &fb_info.fill_buf_size, &fb_info.fill_buf) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed") + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed"); #if H5_SIZEOF_SIZE_T > 4 /* Check for the chunk expanding too much to encode in a 32-bit value */ if (nbytes > ((size_t)0xffffffff)) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length"); #endif /* H5_SIZEOF_SIZE_T > 4 */ /* Keep the number of bytes the chunk turned in to */ @@ -4994,7 +5132,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const else chunk_size = layout->u.chunk.size; - HDassert(*fill_buf == fb_info.fill_buf); + assert(*fill_buf == fb_info.fill_buf); } /* end if */ /* Initialize the chunk information */ @@ -5007,14 +5145,15 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const /* Allocate the chunk (with all processes) */ if (H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, scaled) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") - HDassert(H5F_addr_defined(udata.chunk_block.offset)); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, + "unable to insert/resize chunk on chunk level"); + assert(H5_addr_defined(udata.chunk_block.offset)); /* Check if fill values should be written to chunks */ if (should_fill) { /* Sanity check */ - HDassert(fb_info_init); - HDassert(udata.chunk_block.length == chunk_size); + assert(fb_info_init); + assert(udata.chunk_block.length == chunk_size); #ifdef H5_HAVE_PARALLEL /* Check if this file is accessed with an MPI-capable file driver */ @@ -5030,7 +5169,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const (chunk_fill_info.num_chunks + 1024) * sizeof(struct chunk_coll_fill_info)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "memory allocation failed for chunk fill info") + "memory allocation failed for chunk fill info"); chunk_fill_info.chunk_info = tmp_realloc; } @@ -5049,7 +5188,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const #endif /* H5_HAVE_PARALLEL */ if (H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, *fill_buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); #ifdef H5_HAVE_PARALLEL } /* end else */ #endif /* H5_HAVE_PARALLEL */ @@ -5058,7 +5197,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const /* Insert the chunk record into the index */ if (need_insert && ops->insert) if ((ops->insert)(&idx_info, &udata, dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index"); /* Increment indices and adjust the edge chunk state */ carry = TRUE; @@ -5075,7 +5214,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const scaled[i] < edge_chunk_scaled[i]) { nunfilt_edge_chunk_dims--; if (should_fill && nunfilt_edge_chunk_dims == 0 && !fb_info.has_vlen_fill_type) { - HDassert( + assert( !H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim)); fill_buf = &fb_info.fill_buf; chunk_size = orig_chunk_size; @@ -5085,10 +5224,10 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const else { /* Check if we just entered the edge in this dimension */ if (unfilt_edge_chunk_dim[i] && scaled[i] == edge_chunk_scaled[i]) { - HDassert(edge_chunk_scaled[i] == max_unalloc[i]); + assert(edge_chunk_scaled[i] == max_unalloc[i]); nunfilt_edge_chunk_dims++; if (should_fill && nunfilt_edge_chunk_dims == 1 && !fb_info.has_vlen_fill_type) { - HDassert( + assert( H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim)); fill_buf = &unfilt_fill_buf; chunk_size = layout->u.chunk.size; @@ -5114,7 +5253,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const /* do final collective I/O */ if (using_mpi && blocks_written) if (H5D__chunk_collective_fill(dset, &chunk_fill_info, fb_info.fill_buf, unfilt_fill_buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); #endif /* H5_HAVE_PARALLEL */ /* Reset any cached chunk info for this dataset */ @@ -5123,7 +5262,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const done: /* Release the fill buffer info, if it's been initialized */ if (fb_info_init && H5D__fill_term(&fb_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info"); /* Free the unfiltered fill value buffer */ unfilt_fill_buf = H5D__chunk_mem_xfree(unfilt_fill_buf, &def_pline); @@ -5147,9 +5286,6 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * April 14, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -5170,6 +5306,7 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) H5D_io_info_t chk_io_info; /* Chunked I/O info object */ H5D_chunk_ud_t chk_udata; /* User data for locking chunk */ H5D_storage_t chk_store; /* Chunk storage information */ + H5D_dset_io_info_t chk_dset_info; /* Chunked I/O dset info object */ void *chunk; /* The file chunk */ hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5177,11 +5314,11 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dset && H5D_CHUNKED == layout->type); - HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + assert(dset && H5D_CHUNKED == layout->type); + assert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); H5D_CHUNK_STORAGE_INDEX_CHK(&layout->storage.u.chunk); - HDassert(dset->shared->dcpl_cache.pline.nused > 0); - HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + assert(dset->shared->dcpl_cache.pline.nused > 0); + assert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); /* Retrieve the dataset dimensions */ space_dim = dset->shared->curr_dims; @@ -5196,14 +5333,20 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) if ((space_dim[op_dim] < chunk_dim[op_dim]) || old_dim[op_dim] == 0) { /* Reset any cached chunk info for this dataset */ H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last); - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Set up chunked I/O info object, for operations on chunks (in callback). * Note that we only need to set chunk_offset once, as the array's address * will never change. */ chk_store.chunk.scaled = chunk_sc; - H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, &chk_store, NULL); + + chk_io_info.op_type = H5D_IO_OP_READ; + + chk_dset_info.dset = dset; + chk_dset_info.store = &chk_store; + chk_dset_info.buf.vp = NULL; + chk_io_info.dsets_info = &chk_dset_info; /* * Determine the edges of the dataset which need to be modified @@ -5214,7 +5357,7 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) /* Validate this chunk dimension */ if (chunk_dim[op_dim] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim); /* Calculate offset of first previously incomplete chunk in this * dimension */ @@ -5243,10 +5386,10 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) if (!new_full_dim[op_dim]) continue; else { - HDassert(max_edge_chunk_sc[op_dim] == old_edge_chunk_sc[op_dim]); + assert(max_edge_chunk_sc[op_dim] == old_edge_chunk_sc[op_dim]); /* Reset the chunk offset indices */ - HDmemset(chunk_sc, 0, (space_ndims * sizeof(chunk_sc[0]))); + memset(chunk_sc, 0, (space_ndims * sizeof(chunk_sc[0]))); chunk_sc[op_dim] = old_edge_chunk_sc[op_dim]; carry = FALSE; @@ -5256,24 +5399,25 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) int i; /* Local index variable */ /* Make sure the chunk is really a former edge chunk */ - HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, old_dim) && - !H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, space_dim)); + assert(H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, old_dim) && + !H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, chunk_sc, space_dim)); /* Lookup the chunk */ if (H5D__chunk_lookup(dset, chunk_sc, &chk_udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); /* If this chunk does not exist in cache or on disk, no need to do * anything */ - if (H5F_addr_defined(chk_udata.chunk_block.offset) || (UINT_MAX != chk_udata.idx_hint)) { + if (H5_addr_defined(chk_udata.chunk_block.offset) || (UINT_MAX != chk_udata.idx_hint)) { /* Lock the chunk into cache. H5D__chunk_lock will take care of * updating the chunk to no longer be an edge chunk. */ - if (NULL == (chunk = (void *)H5D__chunk_lock(&chk_io_info, &chk_udata, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to lock raw data chunk") + if (NULL == + (chunk = (void *)H5D__chunk_lock(&chk_io_info, &chk_dset_info, &chk_udata, FALSE, TRUE))) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to lock raw data chunk"); /* Unlock the chunk */ - if (H5D__chunk_unlock(&chk_io_info, &chk_udata, TRUE, chunk, (uint32_t)0) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk") + if (H5D__chunk_unlock(&chk_io_info, &chk_dset_info, &chk_udata, TRUE, chunk, (uint32_t)0) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk"); } /* end if */ /* Increment indices */ @@ -5318,9 +5462,6 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[]) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * July 30, 2014 - * *------------------------------------------------------------------------- */ static herr_t @@ -5351,23 +5492,23 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ * that the "don't filter partial edge chunks" flag is set. */ if (partial_chunk_fill_buf) - HDassert(dset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + assert(dset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); /* Get the MPI communicator */ if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file))) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator") + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator"); /* Get the MPI rank */ if ((mpi_rank = H5F_mpi_get_rank(dset->oloc.file)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank") + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); /* Get the MPI size */ if ((mpi_size = H5F_mpi_get_size(dset->oloc.file)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size") + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size"); /* Distribute evenly the number of blocks between processes. */ if (mpi_size == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero"); num_blocks = (size_t)(chunk_fill_info->num_chunks / (size_t)mpi_size); /* value should be the same on all procs */ @@ -5387,7 +5528,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ /* Allocate buffers */ if (NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc((size_t)(blocks + 1) * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file displacement buffer"); if (partial_chunk_fill_buf) { MPI_Aint fill_buf_addr; @@ -5413,7 +5554,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ * unfiltered fill buffer. */ if (NULL == (block_disps = (MPI_Aint *)H5MM_calloc((size_t)(blocks + 1) * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate block displacements buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate block displacements buffer"); } /* @@ -5430,13 +5571,13 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ } if (need_sort) - HDqsort(chunk_fill_info->chunk_info, chunk_fill_info->num_chunks, - sizeof(struct chunk_coll_fill_info), H5D__chunk_cmp_coll_fill_info); + qsort(chunk_fill_info->chunk_info, chunk_fill_info->num_chunks, + sizeof(struct chunk_coll_fill_info), H5D__chunk_cmp_coll_fill_info); /* Allocate buffer for block lengths if necessary */ if (!all_same_block_len) if (NULL == (block_lens = (int *)H5MM_malloc((size_t)(blocks + 1) * sizeof(int)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk lengths buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk lengths buffer"); for (i = 0; i < (size_t)blocks; i++) { size_t idx = i + (size_t)(mpi_rank * blocks); @@ -5448,7 +5589,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ H5_CHECKED_ASSIGN(block_lens[i], int, chunk_fill_info->chunk_info[idx].chunk_size, size_t); if (chunk_fill_info->chunk_info[idx].unfiltered_partial_chunk) { - HDassert(partial_chunk_fill_buf); + assert(partial_chunk_fill_buf); block_disps[i] = partial_fill_buf_disp; } } /* end for */ @@ -5467,7 +5608,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ size_t); if (chunk_fill_info->chunk_info[(blocks * mpi_size) + mpi_rank].unfiltered_partial_chunk) { - HDassert(partial_chunk_fill_buf); + assert(partial_chunk_fill_buf); block_disps[blocks] = partial_fill_buf_disp; } @@ -5508,9 +5649,9 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ * Currently, different block lengths implies that there are partial * edge chunks and the "don't filter partial edge chunks" flag is set. */ - HDassert(partial_chunk_fill_buf); - HDassert(block_lens); - HDassert(block_disps); + assert(partial_chunk_fill_buf); + assert(block_lens); + assert(block_disps); mpi_code = MPI_Type_create_hindexed(blocks, block_lens, chunk_disp_array, MPI_BYTE, &file_type); if (mpi_code != MPI_SUCCESS) @@ -5531,21 +5672,21 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ /* Set MPI datatypes for operation */ if (H5CX_set_mpi_coll_datatypes(mem_type, file_type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O properties") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O properties"); /* Get current transfer mode */ if (H5CX_get_io_xfer_mode(&prev_xfer_mode) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode"); have_xfer_mode = TRUE; /* Set transfer mode */ if (H5CX_set_io_xfer_mode(H5FD_MPIO_COLLECTIVE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode"); /* Low-level write (collective) */ if (H5F_shared_block_write(H5F_SHARED(dset->oloc.file), H5FD_MEM_DRAW, (haddr_t)0, (blocks) ? (size_t)1 : (size_t)0, fill_buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file"); /* Barrier so processes don't race ahead */ if (MPI_SUCCESS != (mpi_code = MPI_Barrier(mpi_comm))) @@ -5555,7 +5696,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_fill_info_t *chunk_ if (have_xfer_mode) /* Set transfer mode */ if (H5CX_set_io_xfer_mode(prev_xfer_mode) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode") + HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set transfer mode"); /* free things */ if (MPI_BYTE != file_type) @@ -5582,7 +5723,7 @@ H5D__chunk_cmp_coll_fill_info(const void *_entry1, const void *_entry2) entry1 = (const struct chunk_coll_fill_info *)_entry1; entry2 = (const struct chunk_coll_fill_info *)_entry2; - FUNC_LEAVE_NOAPI(H5F_addr_cmp(entry1->addr, entry2->addr)) + FUNC_LEAVE_NOAPI(H5_addr_cmp(entry1->addr, entry2->addr)) } /* end H5D__chunk_cmp_coll_fill_info() */ #endif /* H5_HAVE_PARALLEL */ @@ -5594,16 +5735,13 @@ H5D__chunk_cmp_coll_fill_info(const void *_entry1, const void *_entry2) * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente - * March 26, 2002 - * *------------------------------------------------------------------------- */ static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk) { const H5D_io_info_t *io_info = udata->io_info; /* Local pointer to I/O info */ - const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ + const H5D_t *dset = udata->dset_info->dset; /* Local pointer to the dataset info */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */ unsigned rank = udata->common.layout->ndims - 1; /* Dataset rank */ const hsize_t *scaled = udata->common.scaled; /* Scaled chunk offset */ @@ -5621,17 +5759,17 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk) FUNC_ENTER_PACKAGE /* Get the chunk's size */ - HDassert(layout->u.chunk.size > 0); + assert(layout->u.chunk.size > 0); H5_CHECKED_ASSIGN(chunk_size, size_t, layout->u.chunk.size, uint32_t); /* Get the info for the chunk in the file */ if (H5D__chunk_lookup(dset, scaled, &chk_udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); chk_udata.new_unfilt_chunk = new_unfilt_chunk; /* If this chunk does not exist in cache or on disk, no need to do anything */ - if (!H5F_addr_defined(chk_udata.chunk_block.offset) && UINT_MAX == chk_udata.idx_hint) - HGOTO_DONE(SUCCEED) + if (!H5_addr_defined(chk_udata.chunk_block.offset) && UINT_MAX == chk_udata.idx_hint) + HGOTO_DONE(SUCCEED); /* Initialize the fill value buffer, if necessary */ if (!udata->fb_info_init) { @@ -5639,27 +5777,27 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk) if (H5D__fill_init(&udata->fb_info, NULL, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, (size_t)udata->elmts_per_chunk, chunk_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info"); udata->fb_info_init = TRUE; } /* end if */ /* Compute the # of elements to leave with existing value, in each dimension */ for (u = 0; u < rank; u++) { count[u] = MIN(layout->u.chunk.dim[u], (udata->space_dim[u] - (scaled[u] * layout->u.chunk.dim[u]))); - HDassert(count[u] > 0); + assert(count[u] > 0); } /* end for */ /* Select all elements in chunk, to begin with */ if (H5S_select_all(udata->chunk_space, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to select space") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to select space"); /* "Subtract out" the elements to keep */ if (H5S_select_hyperslab(udata->chunk_space, H5S_SELECT_NOTB, udata->hyper_start, NULL, count, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to select hyperslab") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to select hyperslab"); /* Lock the chunk into the cache, to get a pointer to the chunk buffer */ - if (NULL == (chunk = (void *)H5D__chunk_lock(io_info, &chk_udata, FALSE, FALSE))) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to lock raw data chunk") + if (NULL == (chunk = (void *)H5D__chunk_lock(io_info, udata->dset_info, &chk_udata, FALSE, FALSE))) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to lock raw data chunk"); /* Fill the selection in the memory buffer */ /* Use the size of the elements in the chunk directly instead of */ @@ -5674,20 +5812,20 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk) if (udata->fb_info.has_vlen_fill_type) /* Re-fill the buffer to use for this I/O operation */ if (H5D__fill_refill_vl(&udata->fb_info, (size_t)sel_nelmts) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer"); /* Allocate the chunk selection iterator */ if (NULL == (chunk_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk selection iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk selection iterator"); /* Create a selection iterator for scattering the elements to memory buffer */ if (H5S_select_iter_init(chunk_iter, udata->chunk_space, layout->u.chunk.dim[rank], 0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunk selection information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunk selection information"); chunk_iter_init = TRUE; /* Scatter the data into memory */ if (H5D__scatter_mem(udata->fb_info.fill_buf, chunk_iter, (size_t)sel_nelmts, chunk /*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed"); /* The number of bytes accessed in the chunk */ /* (i.e. the bytes replaced with fill values) */ @@ -5695,13 +5833,13 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk) bytes_accessed = (uint32_t)sel_nelmts * layout->u.chunk.dim[rank]; /* Release lock on chunk */ - if (H5D__chunk_unlock(io_info, &chk_udata, TRUE, chunk, bytes_accessed) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk") + if (H5D__chunk_unlock(io_info, udata->dset_info, &chk_udata, TRUE, chunk, bytes_accessed) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to unlock raw data chunk"); done: /* Release the selection iterator */ if (chunk_iter_init && H5S_SELECT_ITER_RELEASE(chunk_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); if (chunk_iter) chunk_iter = H5FL_FREE(H5S_sel_iter_t, chunk_iter); @@ -5716,10 +5854,6 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk) * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente - * Algorithm: Robb Matzke - * March 27, 2002 - * * The algorithm is: * * For chunks that are no longer necessary: @@ -5822,6 +5956,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) unfiltered */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_io_info_t chk_io_info; /* Chunked I/O info object */ + H5D_dset_io_info_t chk_dset_info; /* Chunked I/O dset info object */ H5D_storage_t chk_store; /* Chunk storage information */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset's layout */ const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ @@ -5846,8 +5981,8 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dset && H5D_CHUNKED == layout->type); - HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + assert(dset && H5D_CHUNKED == layout->type); + assert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Go get the rank & dimensions (including the element size) */ @@ -5862,7 +5997,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) if (old_dim[op_dim] == 0) { /* Reset any cached chunk info for this dataset */ H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last); - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Round up to the next integer # of chunks, to accommodate partial chunks */ @@ -5879,17 +6014,24 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) /* Create a dataspace for a chunk & set the extent */ if (NULL == (chunk_space = H5S_create_simple(space_ndims, chunk_dim, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); /* Reset hyperslab start array */ /* (hyperslabs will always start from origin) */ - HDmemset(hyper_start, 0, sizeof(hyper_start)); + memset(hyper_start, 0, sizeof(hyper_start)); /* Set up chunked I/O info object, for operations on chunks (in callback) * Note that we only need to set scaled once, as the array's address * will never change. */ chk_store.chunk.scaled = scaled; - H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, &chk_store, NULL); + + chk_io_info.op_type = H5D_IO_OP_READ; + + chk_dset_info.dset = dset; + chk_dset_info.store = &chk_store; + chk_dset_info.buf.vp = NULL; + chk_io_info.dsets_info = &chk_dset_info; + chk_io_info.count = 1; /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -5898,11 +6040,12 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) idx_info.storage = &dset->shared->layout.storage.u.chunk; /* Initialize the user data for the iteration */ - HDmemset(&udata, 0, sizeof udata); + memset(&udata, 0, sizeof udata); udata.common.layout = &layout->u.chunk; udata.common.storage = sc; udata.common.scaled = scaled; udata.io_info = &chk_io_info; + udata.dset_info = &chk_dset_info; udata.idx_info = &idx_info; udata.space_dim = space_dim; udata.shrunk_dim = shrunk_dim; @@ -5922,12 +6065,12 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) /* * Determine the chunks which need to be filled or removed */ - HDmemset(min_mod_chunk_sc, 0, sizeof(min_mod_chunk_sc)); - HDmemset(max_mod_chunk_sc, 0, sizeof(max_mod_chunk_sc)); + memset(min_mod_chunk_sc, 0, sizeof(min_mod_chunk_sc)); + memset(max_mod_chunk_sc, 0, sizeof(max_mod_chunk_sc)); for (op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) { /* Validate this chunk dimension */ if (chunk_dim[op_dim] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim); /* Calculate the largest offset of chunks that might need to be * modified in this dimension */ @@ -5986,10 +6129,10 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) if (!shrunk_dim[op_dim]) continue; else { - HDassert(max_mod_chunk_sc[op_dim] >= min_mod_chunk_sc[op_dim]); + assert(max_mod_chunk_sc[op_dim] >= min_mod_chunk_sc[op_dim]); /* Reset the chunk offset indices */ - HDmemset(scaled, 0, (space_ndims * sizeof(scaled[0]))); + memset(scaled, 0, (space_ndims * sizeof(scaled[0]))); scaled[op_dim] = min_mod_chunk_sc[op_dim]; /* Initialize "dims_outside_fill" array */ @@ -6010,12 +6153,11 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) udata.common.scaled = scaled; if (0 == ndims_outside_fill) { - HDassert(fill_dim[op_dim]); - HDassert(scaled[op_dim] == min_mod_chunk_sc[op_dim]); + assert(fill_dim[op_dim]); + assert(scaled[op_dim] == min_mod_chunk_sc[op_dim]); /* Make sure this is an edge chunk */ - HDassert( - H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, space_dim)); + assert(H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, space_dim)); /* Determine if the chunk just became an unfiltered chunk */ if (new_unfilt_dim[op_dim]) { @@ -6029,14 +6171,14 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) /* Make sure that, if we think this is a new unfiltered chunk, * it was previously not an edge chunk */ - HDassert(!new_unfilt_dim[op_dim] || - (!new_unfilt_chunk != !H5D__chunk_is_partial_edge_chunk( - space_ndims, layout->u.chunk.dim, scaled, old_dim))); - HDassert(!new_unfilt_chunk || new_unfilt_dim[op_dim]); + assert(!new_unfilt_dim[op_dim] || + (!new_unfilt_chunk != !H5D__chunk_is_partial_edge_chunk( + space_ndims, layout->u.chunk.dim, scaled, old_dim))); + assert(!new_unfilt_chunk || new_unfilt_dim[op_dim]); /* Fill the unused parts of the chunk */ if (H5D__chunk_prune_fill(&udata, new_unfilt_chunk) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write fill value") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write fill value"); } /* end if */ else { H5D_chunk_ud_t chk_udata; /* User data for getting chunk info */ @@ -6051,29 +6193,29 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) outside_dim = TRUE; break; } /* end if */ - HDassert(outside_dim); + assert(outside_dim); } /* end block */ #endif /* NDEBUG */ /* Check if the chunk exists in cache or on disk */ if (H5D__chunk_lookup(dset, scaled, &chk_udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk"); /* Evict the entry from the cache if present, but do not flush * it to disk */ if (UINT_MAX != chk_udata.idx_hint) if (H5D__chunk_cache_evict(dset, rdcc->slot[chk_udata.idx_hint], FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk"); /* Remove the chunk from disk, if present */ - if (H5F_addr_defined(chk_udata.chunk_block.offset)) { + if (H5_addr_defined(chk_udata.chunk_block.offset)) { /* Update the offset in idx_udata */ idx_udata.scaled = udata.common.scaled; /* Remove the chunk from disk */ if ((sc->ops->remove)(&idx_info, &idx_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, - "unable to remove chunk entry from index") + "unable to remove chunk entry from index"); } /* end if */ } /* end else */ @@ -6128,10 +6270,10 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) done: /* Release resources */ if (chunk_space && H5S_close(chunk_space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace"); if (udata_init) if (udata.fb_info_init && H5D__fill_term(&udata.fb_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_prune_by_extent() */ @@ -6146,9 +6288,6 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Kent Yang - * Tuesday, November 15, 2005 - * *------------------------------------------------------------------------- */ static int @@ -6177,29 +6316,26 @@ H5D__chunk_addrmap_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) * Return: Success: Non-negative on succeed. * Failure: negative value * - * Programmer: Kent Yang - * November 15, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]) +H5D__chunk_addrmap(const H5D_t *dset, haddr_t chunk_addr[]) { - H5D_chk_idx_info_t idx_info; /* Chunked index info */ - const H5D_t *dset = io_info->dset; /* Local pointer to dataset info */ - H5D_chunk_it_ud2_t udata; /* User data for iteration callback */ - H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); + H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5D_chunk_it_ud2_t udata; /* User data for iteration callback */ + H5O_storage_chunk_t *sc; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - HDassert(dset); - HDassert(dset->shared); + assert(dset); + assert(dset->shared); + sc = &(dset->shared->layout.storage.u.chunk); H5D_CHUNK_STORAGE_INDEX_CHK(sc); - HDassert(chunk_addr); + assert(chunk_addr); /* Set up user data for B-tree callback */ - HDmemset(&udata, 0, sizeof(udata)); + memset(&udata, 0, sizeof(udata)); udata.common.layout = &dset->shared->layout.u.chunk; udata.common.storage = sc; udata.chunk_addr = chunk_addr; @@ -6212,7 +6348,8 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]) /* Iterate over chunks to build mapping of chunk addresses */ if ((sc->ops->iterate)(&idx_info, H5D__chunk_addrmap_cb, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to iterate over chunk index to build address map") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, + "unable to iterate over chunk index to build address map"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6227,9 +6364,6 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]) * Return: Success: Non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, March 20, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -6246,32 +6380,32 @@ H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(oh); - HDassert(storage); + assert(f); + assert(oh); + assert(storage); H5D_CHUNK_STORAGE_INDEX_CHK(&storage->u.chunk); /* Check for I/O pipeline message */ if ((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message"); else if (exists) { if (NULL == H5O_msg_read_oh(f, oh, H5O_PLINE_ID, &pline)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O pipeline message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O pipeline message"); pline_read = TRUE; } /* end else if */ else - HDmemset(&pline, 0, sizeof(pline)); + memset(&pline, 0, sizeof(pline)); /* Retrieve dataset layout message */ if ((exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to check for object header message"); else if (exists) { if (NULL == H5O_msg_read_oh(f, oh, H5O_LAYOUT_ID, &layout)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout message"); layout_read = TRUE; } /* end else if */ else - HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "can't find layout message") + HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "can't find layout message"); /* Compose chunked index info struct */ idx_info.f = f; @@ -6281,16 +6415,16 @@ H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage) /* Delete the chunked storage information in the file */ if ((storage->u.chunk.ops->idx_delete)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk index") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk index"); done: /* Clean up any messages read in */ if (pline_read) if (H5O_msg_reset(H5O_PLINE_ID, &pline) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message") + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message"); if (layout_read) if (H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout message") + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout message"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_delete() */ @@ -6304,9 +6438,6 @@ H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *storage) * Return: Success: Non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, May 29, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -6321,15 +6452,14 @@ H5D__chunk_update_cache(H5D_t *dset) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dset && H5D_CHUNKED == dset->shared->layout.type); - HDassert(dset->shared->layout.u.chunk.ndims > 0 && - dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS); + assert(dset && H5D_CHUNKED == dset->shared->layout.type); + assert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS); /* Check the rank */ - HDassert((dset->shared->layout.u.chunk.ndims - 1) > 1); + assert((dset->shared->layout.u.chunk.ndims - 1) > 1); /* Add temporary entry list to rdcc */ - (void)HDmemset(&tmp_head, 0, sizeof(tmp_head)); + (void)memset(&tmp_head, 0, sizeof(tmp_head)); rdcc->tmp_head = &tmp_head; tmp_tail = &tmp_head; @@ -6350,14 +6480,14 @@ H5D__chunk_update_cache(H5D_t *dset) /* Check if there is already a chunk at this chunk's new location */ old_ent = rdcc->slot[ent->idx]; if (old_ent != NULL) { - HDassert(old_ent->locked == FALSE); - HDassert(old_ent->deleted == FALSE); + assert(old_ent->locked == FALSE); + assert(old_ent->deleted == FALSE); /* Insert the old entry into the temporary list, but do not * evict (yet). Make sure we do not make any calls to the index * until all chunks have updated indices! */ - HDassert(!old_ent->tmp_next); - HDassert(!old_ent->tmp_prev); + assert(!old_ent->tmp_next); + assert(!old_ent->tmp_prev); tmp_tail->tmp_next = old_ent; old_ent->tmp_prev = tmp_tail; tmp_tail = old_ent; @@ -6370,15 +6500,15 @@ H5D__chunk_update_cache(H5D_t *dset) * not in the hash table, remove it from the temporary list. * Otherwise clear the old hash table slot. */ if (ent->tmp_prev) { - HDassert(tmp_head.tmp_next); - HDassert(tmp_tail != &tmp_head); + assert(tmp_head.tmp_next); + assert(tmp_tail != &tmp_head); ent->tmp_prev->tmp_next = ent->tmp_next; if (ent->tmp_next) { ent->tmp_next->tmp_prev = ent->tmp_prev; ent->tmp_next = NULL; } /* end if */ else { - HDassert(tmp_tail == ent); + assert(tmp_tail == ent); tmp_tail = ent->tmp_prev; } /* end else */ ent->tmp_prev = NULL; @@ -6398,7 +6528,7 @@ H5D__chunk_update_cache(H5D_t *dset) /* Remove the old entry from the cache */ if (H5D__chunk_cache_evict(dset, ent, TRUE) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks"); } /* end while */ done: @@ -6416,9 +6546,6 @@ H5D__chunk_update_cache(H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * August 20, 2005 - * *------------------------------------------------------------------------- */ static int @@ -6469,7 +6596,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) (udata->file_src != udata->idx_info_dst->f)) fix_ref = TRUE; else - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy dataset elements") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy dataset elements"); } /* end if */ /* Resize the buf if it is too small to hold the data */ @@ -6479,15 +6606,15 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Re-allocate memory for copying the chunk */ if (NULL == (new_buf = H5MM_realloc(udata->buf, nbytes))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, - "memory allocation failed for raw data chunk") + "memory allocation failed for raw data chunk"); udata->buf = new_buf; if (udata->bkg) { if (NULL == (new_buf = H5MM_realloc(udata->bkg, nbytes))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, - "memory allocation failed for raw data chunk") + "memory allocation failed for raw data chunk"); udata->bkg = new_buf; if (!udata->cpy_info->expand_ref) - HDmemset((uint8_t *)udata->bkg + buf_size, 0, (size_t)(nbytes - buf_size)); + memset((uint8_t *)udata->bkg + buf_size, 0, (size_t)(nbytes - buf_size)); bkg = udata->bkg; } /* end if */ @@ -6497,7 +6624,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) } /* end if */ if (udata->chunk_in_cache && udata->chunk) { - HDassert(!H5F_addr_defined(chunk_rec->chunk_addr)); + assert(!H5_addr_defined(chunk_rec->chunk_addr)); H5MM_memcpy(buf, udata->chunk, nbytes); udata->chunk = NULL; } @@ -6530,10 +6657,10 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if (udata->chunk_in_cache) { if (NULL == ent) - HGOTO_ERROR(H5E_IO, H5E_BADVALUE, H5_ITER_ERROR, "NULL chunk entry pointer") + HGOTO_ERROR(H5E_IO, H5E_BADVALUE, H5_ITER_ERROR, "NULL chunk entry pointer"); - HDassert(H5F_addr_defined(chunk_rec->chunk_addr)); - HDassert(H5F_addr_defined(ent->chunk_block.offset)); + assert(H5_addr_defined(chunk_rec->chunk_addr)); + assert(H5_addr_defined(ent->chunk_block.offset)); H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t); H5MM_memcpy(buf, ent->chunk, nbytes); @@ -6541,7 +6668,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) else { /* read chunk data from the source file */ if (H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk") + HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk"); } } @@ -6552,7 +6679,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if (H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &buf_size, &buf) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "data pipeline read failed") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "data pipeline read failed"); } /* end if */ /* Perform datatype conversion, if necessary */ @@ -6570,21 +6697,21 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5_CHECK_OVERFLOW(udata->nelmts, uint32_t, size_t); if (H5T_convert(tpath_src_mem, tid_src, tid_mem, (size_t)udata->nelmts, (size_t)0, (size_t)0, buf, bkg) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed"); /* Copy into another buffer, to reclaim memory later */ H5MM_memcpy(reclaim_buf, buf, reclaim_buf_size); /* Set background buffer to all zeros */ - HDmemset(bkg, 0, buf_size); + memset(bkg, 0, buf_size); /* Convert from memory to destination file */ if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, udata->nelmts, (size_t)0, (size_t)0, buf, bkg) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed"); /* Reclaim space from variable length data */ if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, H5_ITER_ERROR, "unable to reclaim variable-length data") + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, H5_ITER_ERROR, "unable to reclaim variable-length data"); } /* end if */ else if (fix_ref) { /* Check for expanding references */ @@ -6593,7 +6720,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Copy the reference elements */ if (H5O_copy_expand_ref(udata->file_src, udata->tid_src, udata->dt_src, buf, nbytes, udata->idx_info_dst->f, bkg, udata->cpy_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy reference attribute") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy reference attribute"); } /* end if */ /* After fix ref, copy the new reference elements to the buffer to write out */ @@ -6613,11 +6740,11 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if (must_filter && (is_vlen || fix_ref || udata->chunk_in_cache)) { if (H5Z_pipeline(pline, 0, &(udata_dst.filter_mask), H5Z_NO_EDC, filter_cb, &nbytes, &buf_size, &buf) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed"); #if H5_SIZEOF_SIZE_T > 4 /* Check for the chunk expanding too much to encode in a 32-bit value */ if (nbytes > ((size_t)0xffffffff)) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, H5_ITER_ERROR, "chunk too large for 32-bit length") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, H5_ITER_ERROR, "chunk too large for 32-bit length"); #endif /* H5_SIZEOF_SIZE_T > 4 */ H5_CHECKED_ASSIGN(udata_dst.chunk_block.length, uint32_t, nbytes, size_t); udata->buf = buf; @@ -6633,21 +6760,21 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Allocate chunk in the file */ if (H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert, udata_dst.common.scaled) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level"); /* Write chunk data to destination file */ - HDassert(H5F_addr_defined(udata_dst.chunk_block.offset)); + assert(H5_addr_defined(udata_dst.chunk_block.offset)); if (H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.chunk_block.offset, nbytes, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file"); /* Set metadata tag in API context */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) /* Insert chunk record into index */ if (need_insert && udata->idx_info_dst->storage->ops->insert) if ((udata->idx_info_dst->storage->ops->insert)(udata->idx_info_dst, &udata_dst, NULL) < 0) HGOTO_ERROR_TAG(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, - "unable to insert chunk addr into index") + "unable to insert chunk addr into index"); /* Reset metadata tag in API context */ H5_END_TAG @@ -6664,9 +6791,6 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) * Return: Success: Non-negative * Failure: negative * - * Programmer: Peter Cao - * August 20, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -6701,19 +6825,19 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f_src); - HDassert(storage_src); + assert(f_src); + assert(storage_src); H5D_CHUNK_STORAGE_INDEX_CHK(storage_src); - HDassert(layout_src); - HDassert(f_dst); - HDassert(storage_dst); + assert(layout_src); + assert(f_dst); + assert(storage_dst); H5D_CHUNK_STORAGE_INDEX_CHK(storage_dst); - HDassert(ds_extent_src); - HDassert(dt_src); + assert(ds_extent_src); + assert(dt_src); /* Initialize the temporary pipeline info */ if (NULL == pline_src) { - HDmemset(&_pline, 0, sizeof(_pline)); + memset(&_pline, 0, sizeof(_pline)); pline = &_pline; } /* end if */ else @@ -6721,7 +6845,7 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk /* Layout is not created in the destination file, reset index address */ if (H5D_chunk_idx_reset(storage_dst, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index in dest"); /* Initialize layout information */ { @@ -6729,12 +6853,12 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk /* Get the dim info for dataset */ if ((sndims = H5S_extent_get_dims(ds_extent_src, curr_dims, max_dims)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions"); H5_CHECKED_ASSIGN(ndims, unsigned, sndims, int); /* Set the source layout chunk information */ if (H5D__chunk_set_info_real(layout_src, ndims, curr_dims, max_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info"); } /* end block */ /* Compose source & dest chunked index info structs */ @@ -6751,12 +6875,12 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk /* Call the index-specific "copy setup" routine */ if ((storage_src->ops->copy_setup)(&idx_info_src, &idx_info_dst) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to set up index-specific chunk copying information") + "unable to set up index-specific chunk copying information"); copy_setup_done = TRUE; /* Create datatype ID for src datatype */ if ((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype"); /* If there's a VLEN source datatype, set up type conversion information */ if (H5T_detect_class(dt_src, H5T_VLEN, FALSE) > 0) { @@ -6770,38 +6894,38 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk /* create a memory copy of the variable-length datatype */ if (NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy"); if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) { (void)H5T_close_real(dt_mem); - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype"); } /* end if */ /* create variable-length datatype at the destination file */ if (NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy"); if (H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) { (void)H5T_close_real(dt_dst); - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk"); } /* end if */ if ((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) { (void)H5T_close_real(dt_dst); - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype"); } /* end if */ /* Set up the conversion functions */ if (NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes"); if (NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes"); /* Determine largest datatype size */ if (0 == (max_dt_size = H5T_get_size(dt_src))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size"); if (0 == (mem_dt_size = H5T_get_size(dt_mem))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size"); max_dt_size = MAX(max_dt_size, mem_dt_size); if (0 == (tmp_dt_size = H5T_get_size(dt_dst))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size"); max_dt_size = MAX(max_dt_size, tmp_dt_size); /* Compute the number of elements per chunk */ @@ -6812,12 +6936,12 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk /* Create the space and set the initial extent */ buf_dim = nelmts; if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); /* Register */ if ((sid_buf = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) { (void)H5S_close(buf_space); - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); } /* end if */ /* Set initial buffer sizes */ @@ -6826,7 +6950,7 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk /* Allocate memory for reclaim buf */ if (NULL == (reclaim_buf = H5MM_malloc(reclaim_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk"); /* Indicate that type conversion should be performed */ do_convert = TRUE; @@ -6845,20 +6969,20 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk if (do_convert) { /* Allocate background memory for converting the chunk */ if (NULL == (bkg = H5MM_malloc(buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk"); /* Check for reference datatype and no expanding references & clear background buffer */ if (!cpy_info->expand_ref && ((H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) && (f_src != f_dst))) /* Reset value to zero */ - HDmemset(bkg, 0, buf_size); + memset(bkg, 0, buf_size); } /* end if */ /* Allocate memory for copying the chunk */ if (NULL == (buf = H5MM_malloc(buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk"); /* Initialize the callback structure for the source */ - HDmemset(&udata, 0, sizeof udata); + memset(&udata, 0, sizeof udata); udata.common.layout = layout_src; udata.common.storage = storage_src; udata.file_src = f_src; @@ -6886,7 +7010,7 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk /* Iterate over chunks to copy data */ if ((storage_src->ops->iterate)(&idx_info_src, H5D__chunk_copy_cb, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to copy data") + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to copy data"); /* Iterate over the chunk cache to copy data for chunks with undefined address */ if (udata.cpy_info->shared_fo) { @@ -6899,12 +7023,12 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk chunk_rec.chunk_addr = HADDR_UNDEF; for (ent = shared_fo->cache.chunk.head; ent; ent = next) { - if (!H5F_addr_defined(ent->chunk_block.offset)) { + if (!H5_addr_defined(ent->chunk_block.offset)) { H5MM_memcpy(chunk_rec.scaled, ent->scaled, sizeof(chunk_rec.scaled)); udata.chunk = ent->chunk; udata.chunk_in_cache = TRUE; if (H5D__chunk_copy_cb(&chunk_rec, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy chunk data in cache") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy chunk data in cache"); } next = ent->next; } /* end for */ @@ -6916,13 +7040,13 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk done: if (sid_buf > 0 && H5I_dec_ref(sid_buf) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID"); if (tid_src > 0 && H5I_dec_ref(tid_src) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (tid_dst > 0 && H5I_dec_ref(tid_dst) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (tid_mem > 0 && H5I_dec_ref(tid_mem) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (buf) H5MM_xfree(buf); if (bkg) @@ -6934,7 +7058,7 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk if (copy_setup_done) if (storage_src->ops->copy_shutdown && (storage_src->ops->copy_shutdown)(storage_src, storage_dst) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to shut down index copying info") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to shut down index copying info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_copy() */ @@ -6947,9 +7071,6 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5O_layout_chunk * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi - * June 8, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -6967,23 +7088,23 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, hsize_ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(layout); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(layout); H5D_CHUNK_STORAGE_INDEX_CHK(sc); - HDassert(index_size); + assert(index_size); /* Check for I/O pipeline message */ if ((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header"); else if (exists) { if (NULL == H5O_msg_read_oh(loc->file, oh, H5O_PLINE_ID, &pline)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't find I/O pipeline message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't find I/O pipeline message"); pline_read = TRUE; } /* end else if */ else - HDmemset(&pline, 0, sizeof(pline)); + memset(&pline, 0, sizeof(pline)); /* Compose chunked index info struct */ idx_info.f = loc->file; @@ -6993,25 +7114,25 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, hsize_ /* Get the dataspace for the dataset */ if (NULL == (space = H5S_read(loc))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header"); /* Allocate any indexing structures */ if (sc->ops->init && (sc->ops->init)(&idx_info, space, loc->addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information"); idx_info_init = TRUE; /* Get size of index structure */ if (sc->ops->size && (sc->ops->size)(&idx_info, index_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve chunk index info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve chunk index info"); done: /* Free resources, if they've been initialized */ if (idx_info_init && sc->ops->dest && (sc->ops->dest)(&idx_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info"); if (pline_read && H5O_msg_reset(H5O_PLINE_ID, &pline) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message") + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset I/O pipeline message"); if (space && H5S_close(space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_bh_info() */ @@ -7026,9 +7147,6 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, hsize_ * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, April 21, 1999 - * *------------------------------------------------------------------------- */ static int @@ -7043,20 +7161,19 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Print header if not already displayed */ if (!udata->header_displayed) { - HDfprintf(udata->stream, " Flags Bytes Address Logical Offset\n"); - HDfprintf(udata->stream, - " ========== ======== ========== ==============================\n"); + fprintf(udata->stream, " Flags Bytes Address Logical Offset\n"); + fprintf(udata->stream, " ========== ======== ========== ==============================\n"); /* Set flag that the headers has been printed */ udata->header_displayed = TRUE; } /* end if */ /* Print information about this chunk */ - HDfprintf(udata->stream, " 0x%08x %8" PRIu32 " %10" PRIuHADDR " [", chunk_rec->filter_mask, - chunk_rec->nbytes, chunk_rec->chunk_addr); + fprintf(udata->stream, " 0x%08x %8" PRIu32 " %10" PRIuHADDR " [", chunk_rec->filter_mask, + chunk_rec->nbytes, chunk_rec->chunk_addr); for (u = 0; u < udata->ndims; u++) - HDfprintf(udata->stream, "%s%" PRIuHSIZE, (u ? ", " : ""), - (chunk_rec->scaled[u] * udata->chunk_dim[u])); + fprintf(udata->stream, "%s%" PRIuHSIZE, (u ? ", " : ""), + (chunk_rec->scaled[u] * udata->chunk_dim[u])); HDfputs("]\n", udata->stream); } /* end if */ @@ -7072,9 +7189,6 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) * Return: Success: Non-negative * Failure: negative * - * Programmer: Robb Matzke - * Wednesday, April 28, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -7086,7 +7200,7 @@ H5D__chunk_dump_index(H5D_t *dset, FILE *stream) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); + assert(dset); H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Only display info if stream is defined */ @@ -7096,7 +7210,7 @@ H5D__chunk_dump_index(H5D_t *dset, FILE *stream) /* Display info for index */ if ((sc->ops->dump)(sc, stream) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to dump chunk index info") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to dump chunk index info"); /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -7113,7 +7227,7 @@ H5D__chunk_dump_index(H5D_t *dset, FILE *stream) /* Iterate over index and dump chunk info */ if ((sc->ops->iterate)(&idx_info, H5D__chunk_dump_index_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, - "unable to iterate over chunk index to dump chunk info") + "unable to iterate over chunk index to dump chunk info"); } /* end if */ done: @@ -7131,9 +7245,6 @@ H5D__chunk_dump_index(H5D_t *dset, FILE *stream) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -7147,14 +7258,14 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers) FUNC_ENTER_PACKAGE_NOERR if (!H5DEBUG(AC)) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); if (headers) { - HDfprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n"); - HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n", "Layer", "Hits", "Misses", "MissRate", - "Inits", "Flushes"); - HDfprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n", "-----", "----", "------", "--------", - "-----", "-------"); + fprintf(H5DEBUG(AC), "H5D: raw data cache statistics\n"); + fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n", "Layer", "Hits", "Misses", "MissRate", + "Inits", "Flushes"); + fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n", "-----", "----", "------", "--------", + "-----", "-------"); } #ifdef H5AC_DEBUG @@ -7176,9 +7287,9 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers) HDsnprintf(ascii, sizeof(ascii), "%7.2f%%", miss_rate); } - HDfprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n", "raw data chunks", rdcc->stats.nhits, - rdcc->stats.nmisses, ascii, rdcc->stats.ninits, - (long)(rdcc->stats.nflushes) - (long)(rdcc->stats.ninits)); + fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n", "raw data chunks", rdcc->stats.nhits, + rdcc->stats.nmisses, ascii, rdcc->stats.ninits, + (long)(rdcc->stats.nflushes) - (long)(rdcc->stats.ninits)); } done: @@ -7199,9 +7310,6 @@ H5D__chunk_stats(const H5D_t *dset, hbool_t headers) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * 30 Sep 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -7218,17 +7326,17 @@ H5D__nonexistent_readvv_cb(hsize_t H5_ATTR_UNUSED dst_off, hsize_t src_off, size if (H5D__fill_init(&fb_info, (udata->rbuf + src_off), NULL, NULL, NULL, NULL, &udata->dset->shared->dcpl_cache.fill, udata->dset->shared->type, udata->dset->shared->type_id, (size_t)0, len) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info"); fb_info_init = TRUE; /* Check for VL datatype & fill the buffer with VL datatype fill values */ if (fb_info.has_vlen_fill_type && H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer"); done: /* Release the fill buffer info, if it's been initialized */ if (fb_info_init && H5D__fill_term(&fb_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info"); FUNC_LEAVE_NOAPI(ret_value) } /* H5D__nonexistent_readvv_cb() */ @@ -7248,13 +7356,11 @@ H5D__nonexistent_readvv_cb(hsize_t H5_ATTR_UNUSED dst_off, hsize_t src_off, size * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * 6 Feb 2009 - * *------------------------------------------------------------------------- */ static ssize_t -H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, size_t *chunk_curr_seq, +H5D__nonexistent_readvv(const H5D_io_info_t H5_ATTR_NDEBUG_UNUSED *io_info, + const H5D_dset_io_info_t *dset_info, size_t chunk_max_nseq, size_t *chunk_curr_seq, size_t chunk_len_arr[], hsize_t chunk_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { @@ -7264,23 +7370,23 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, siz FUNC_ENTER_PACKAGE /* Check args */ - HDassert(io_info); - HDassert(chunk_curr_seq); - HDassert(chunk_len_arr); - HDassert(chunk_off_arr); - HDassert(mem_curr_seq); - HDassert(mem_len_arr); - HDassert(mem_off_arr); + assert(io_info); + assert(chunk_curr_seq); + assert(chunk_len_arr); + assert(chunk_off_arr); + assert(mem_curr_seq); + assert(mem_len_arr); + assert(mem_off_arr); /* Set up user data for H5VM_opvv() */ - udata.rbuf = (unsigned char *)io_info->u.rbuf; - udata.dset = io_info->dset; + udata.rbuf = (unsigned char *)dset_info->buf.vp; + udata.dset = dset_info->dset; /* Call generic sequence operation routine */ if ((ret_value = H5VM_opvv(chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__nonexistent_readvv_cb, &udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized fill value init") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized fill value init"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7295,9 +7401,6 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, size_t chunk_max_nseq, siz * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * 19 Nov 2009 - * *------------------------------------------------------------------------- */ hbool_t @@ -7310,10 +7413,10 @@ H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint32_t *chunk_dims FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(scaled); - HDassert(dset_ndims > 0); - HDassert(dset_dims); - HDassert(chunk_dims); + assert(scaled); + assert(dset_ndims > 0); + assert(dset_dims); + assert(chunk_dims); /* check if this is a partial edge chunk */ for (u = 0; u < dset_ndims; u++) @@ -7334,8 +7437,6 @@ H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint32_t *chunk_dims * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -7348,20 +7449,20 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(new_chunk); - HDassert(need_insert); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(new_chunk); + assert(need_insert); *need_insert = FALSE; /* Check for filters on chunks */ if (idx_info->pline->nused > 0) { /* Sanity/error checking block */ - HDassert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE); + assert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE); { unsigned allow_chunk_size_len; /* Allowed size of encoded chunk size */ unsigned new_chunk_size_len; /* Size of encoded chunk size */ @@ -7376,17 +7477,16 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old /* Compute encoded size of chunk */ new_chunk_size_len = (H5VM_log2_gen((uint64_t)(new_chunk->length)) + 8) / 8; if (new_chunk_size_len > 8) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "encoded chunk size is more than 8 bytes?!?") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "encoded chunk size is more than 8 bytes?!?"); /* Check if the chunk became too large to be encoded */ if (new_chunk_size_len > allow_chunk_size_len) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk size can't be encoded"); } /* end block */ - if (old_chunk && H5F_addr_defined(old_chunk->offset)) { + if (old_chunk && H5_addr_defined(old_chunk->offset)) { /* Sanity check */ - HDassert(!H5F_addr_defined(new_chunk->offset) || - H5F_addr_eq(new_chunk->offset, old_chunk->offset)); + assert(!H5_addr_defined(new_chunk->offset) || H5_addr_eq(new_chunk->offset, old_chunk->offset)); /* Check for chunk being same size */ if (new_chunk->length != old_chunk->length) { @@ -7397,23 +7497,23 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old */ if (!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, old_chunk->offset, old_chunk->length) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk"); alloc_chunk = TRUE; } /* end if */ else { /* Don't need to reallocate chunk, but send its address back up */ - if (!H5F_addr_defined(new_chunk->offset)) + if (!H5_addr_defined(new_chunk->offset)) new_chunk->offset = old_chunk->offset; } /* end else */ } /* end if */ else { - HDassert(!H5F_addr_defined(new_chunk->offset)); + assert(!H5_addr_defined(new_chunk->offset)); alloc_chunk = TRUE; } /* end else */ } /* end if */ else { - HDassert(!H5F_addr_defined(new_chunk->offset)); - HDassert(new_chunk->length == idx_info->layout->size); + assert(!H5_addr_defined(new_chunk->offset)); + assert(new_chunk->length == idx_info->layout->size); alloc_chunk = TRUE; } /* end else */ @@ -7425,9 +7525,9 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old udata.common.scaled = scaled; if ((idx_info->storage->ops->get_addr)(idx_info, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address"); new_chunk->offset = udata.chunk_block.offset; - HDassert(new_chunk->length == udata.chunk_block.length); + assert(new_chunk->length == udata.chunk_block.length); break; } @@ -7436,22 +7536,22 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old case H5D_CHUNK_IDX_BT2: case H5D_CHUNK_IDX_BTREE: case H5D_CHUNK_IDX_SINGLE: - HDassert(new_chunk->length > 0); + assert(new_chunk->length > 0); H5_CHECK_OVERFLOW(new_chunk->length, /*From: */ uint32_t, /*To: */ hsize_t); new_chunk->offset = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, (hsize_t)new_chunk->length); - if (!H5F_addr_defined(new_chunk->offset)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed") + if (!H5_addr_defined(new_chunk->offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed"); *need_insert = TRUE; break; case H5D_CHUNK_IDX_NTYPES: default: - HDassert(0 && "This should never be executed!"); + assert(0 && "This should never be executed!"); break; } /* end switch */ } /* end if */ - HDassert(H5F_addr_defined(new_chunk->offset)); + assert(H5_addr_defined(new_chunk->offset)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7466,9 +7566,6 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi - * Feb 2015 - * *------------------------------------------------------------------------- */ static int @@ -7501,7 +7598,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) H5Z_cb_t filter_cb; /* Filter failure callback struct */ size_t read_size = nbytes; /* Bytes to read */ - HDassert(read_size == new_idx_info->layout->size); + assert(read_size == new_idx_info->layout->size); /* Initialize the filter callback struct */ filter_cb.op_data = NULL; @@ -7510,31 +7607,31 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Allocate buffer for chunk data */ if (NULL == (buf = H5MM_malloc(read_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, - "memory allocation failed for raw data chunk") + "memory allocation failed for raw data chunk"); /* Read the non-filtered edge chunk */ if (H5F_block_read(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, read_size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk") + HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk"); /* Pass the chunk through the pipeline */ if (H5Z_pipeline(new_idx_info->pline, 0, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &read_size, &buf) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "output pipeline failed"); #if H5_SIZEOF_SIZE_T > 4 /* Check for the chunk expanding too much to encode in a 32-bit value */ if (nbytes > ((size_t)0xffffffff)) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, H5_ITER_ERROR, "chunk too large for 32-bit length") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, H5_ITER_ERROR, "chunk too large for 32-bit length"); #endif /* H5_SIZEOF_SIZE_T > 4 */ /* Allocate space for the filtered chunk */ if ((chunk_addr = H5MF_alloc(new_idx_info->f, H5FD_MEM_DRAW, (hsize_t)nbytes)) == HADDR_UNDEF) - HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, H5_ITER_ERROR, "file allocation failed for filtered chunk") - HDassert(H5F_addr_defined(chunk_addr)); + HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, H5_ITER_ERROR, "file allocation failed for filtered chunk"); + assert(H5_addr_defined(chunk_addr)); /* Write the filtered chunk to disk */ if (H5F_block_write(new_idx_info->f, H5FD_MEM_DRAW, chunk_addr, nbytes, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file"); } /* end if */ /* Set up chunk information for insertion to chunk index */ @@ -7547,7 +7644,7 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Insert chunk into the v1 B-tree chunk index */ if ((new_idx_info->storage->ops->insert)(new_idx_info, &insert_udata, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk addr into index") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert chunk addr into index"); done: if (buf) @@ -7564,9 +7661,6 @@ H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Feb 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -7578,7 +7672,7 @@ H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info, H5D_chk_idx FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dset); + assert(dset); /* Set up user data */ udata.new_idx_info = new_idx_info; @@ -7588,7 +7682,7 @@ H5D__chunk_format_convert(H5D_t *dset, H5D_chk_idx_info_t *idx_info, H5D_chk_idx /* Iterate over the chunks in the current index and insert the chunk addresses into version 1 B-tree index */ if ((idx_info->storage->ops->iterate)(idx_info, H5D__chunk_format_convert_cb, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk index to chunk info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7644,18 +7738,18 @@ H5D__chunk_index_empty(const H5D_t *dset, hbool_t *empty) FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) - HDassert(dset); - HDassert(dset->shared); - HDassert(empty); + assert(dset); + assert(dset->shared); + assert(empty); rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */ - HDassert(rdcc); + assert(rdcc); /* Search for cached chunks that haven't been written out */ for (ent = rdcc->head; ent; ent = ent->next) /* Flush the chunk out to disk, to make certain the size is correct later */ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -7665,12 +7759,12 @@ H5D__chunk_index_empty(const H5D_t *dset, hbool_t *empty) *empty = TRUE; - if (H5F_addr_defined(idx_info.storage->idx_addr)) { + if (H5_addr_defined(idx_info.storage->idx_addr)) { /* Iterate over the allocated chunks */ if ((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_index_empty_cb, empty) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to retrieve allocated chunk information from index") + "unable to retrieve allocated chunk information from index"); } done: @@ -7688,9 +7782,6 @@ H5D__chunk_index_empty(const H5D_t *dset, hbool_t *empty) * * Return: H5_ITER_CONT * - * Programmer: Binh-Minh Ribler - * June 2019 (HDFFV-10677) - * *------------------------------------------------------------------------- */ static int @@ -7701,7 +7792,7 @@ H5D__get_num_chunks_cb(const H5D_chunk_rec_t H5_ATTR_UNUSED *chunk_rec, void *_u FUNC_ENTER_PACKAGE_NOERR - HDassert(num_chunks); + assert(num_chunks); (*num_chunks)++; @@ -7719,9 +7810,6 @@ H5D__get_num_chunks_cb(const H5D_chunk_rec_t H5_ATTR_UNUSED *chunk_rec, void *_u * Return: Success: Non-negative * Failure: Negative * - * Programmer: Binh-Minh Ribler - * June 2019 (HDFFV-10677) - * *------------------------------------------------------------------------- */ herr_t @@ -7735,19 +7823,19 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) - HDassert(dset); - HDassert(dset->shared); - HDassert(space); - HDassert(nchunks); + assert(dset); + assert(dset->shared); + assert(space); + assert(nchunks); rdcc = &(dset->shared->cache.chunk); /* raw data chunk cache */ - HDassert(rdcc); + assert(rdcc); /* Search for cached chunks that haven't been written out */ for (ent = rdcc->head; ent; ent = ent->next) /* Flush the chunk out to disk, to make certain the size is correct later */ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -7756,14 +7844,14 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ idx_info.storage = &dset->shared->layout.storage.u.chunk; /* If the dataset is not written, number of chunks will be 0 */ - if (!H5F_addr_defined(idx_info.storage->idx_addr)) + if (!H5_addr_defined(idx_info.storage->idx_addr)) *nchunks = 0; else { /* Iterate over the allocated chunks */ if ((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_num_chunks_cb, &num_chunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to retrieve allocated chunk information from index") + "unable to retrieve allocated chunk information from index"); *nchunks = num_chunks; } @@ -7780,9 +7868,6 @@ H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ * H5_ITER_STOP indicates the queried chunk is found * Failure: Negative (H5_ITER_ERROR) * - * Programmer: Binh-Minh Ribler - * June 2019 (HDFFV-10677) - * *------------------------------------------------------------------------- */ static int @@ -7794,8 +7879,8 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(chunk_rec); - HDassert(chunk_info); + assert(chunk_rec); + assert(chunk_info); /* If this is the queried chunk, retrieve its info and stop iterating */ if (chunk_info->curr_idx == chunk_info->chunk_idx) { @@ -7831,9 +7916,6 @@ H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Binh-Minh Ribler - * June 2019 (HDFFV-10677) - * *------------------------------------------------------------------------- */ herr_t @@ -7849,19 +7931,19 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) - HDassert(dset); - HDassert(dset->shared); - HDassert(space); + assert(dset); + assert(dset->shared); + assert(space); /* Get the raw data chunk cache */ rdcc = &(dset->shared->cache.chunk); - HDassert(rdcc); + assert(rdcc); /* Search for cached chunks that haven't been written out */ for (ent = rdcc->head; ent; ent = ent->next) /* Flush the chunk out to disk, to make certain the size is correct later */ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -7876,7 +7958,7 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ *size = 0; /* If the chunk is written, get its info, otherwise, return without error */ - if (H5F_addr_defined(idx_info.storage->idx_addr)) { + if (H5_addr_defined(idx_info.storage->idx_addr)) { /* Initialize before iteration */ udata.chunk_idx = chk_index; udata.curr_idx = 0; @@ -7890,7 +7972,7 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ if ((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_chunk_info_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to retrieve allocated chunk information from index") + "unable to retrieve allocated chunk information from index"); /* Obtain requested info if the chunk is found */ if (udata.found) { @@ -7904,7 +7986,7 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ for (ii = 0; ii < udata.ndims; ii++) offset[ii] = udata.scaled[ii] * dset->shared->layout.u.chunk.dim[ii]; } /* end if */ - } /* end if H5F_addr_defined */ + } /* end if H5_addr_defined */ done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -7919,9 +8001,6 @@ H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_ * Return: Success: H5_ITER_CONT or H5_ITER_STOP * Failure: Negative (H5_ITER_ERROR) * - * Programmer: Binh-Minh Ribler - * June 2019 (HDFFV-10677) - * *------------------------------------------------------------------------- */ static int @@ -7935,8 +8014,8 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(chunk_rec); - HDassert(chunk_info); + assert(chunk_rec); + assert(chunk_info); /* Going through the scaled, stop when a mismatch is found */ for (ii = 0; ii < chunk_info->ndims && !different; ii++) @@ -7966,9 +8045,6 @@ H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Binh-Minh Ribler - * June 2019 (HDFFV-10677) - * *------------------------------------------------------------------------- */ herr_t @@ -7985,22 +8061,22 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ - HDassert(dset); - HDassert(dset->shared); - HDassert(offset); + assert(dset); + assert(dset->shared); + assert(offset); /* Get dataset layout and raw data chunk cache */ layout = &(dset->shared->layout); rdcc = &(dset->shared->cache.chunk); - HDassert(layout); - HDassert(rdcc); - HDassert(H5D_CHUNKED == layout->type); + assert(layout); + assert(rdcc); + assert(H5D_CHUNKED == layout->type); /* Search for cached chunks that haven't been written out */ for (ent = rdcc->head; ent; ent = ent->next) /* Flush the chunk out to disk, to make certain the size is correct later */ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer"); /* Set addr & size for when dset is not written or queried chunk is not found */ if (addr) @@ -8015,7 +8091,7 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned idx_info.storage = &dset->shared->layout.storage.u.chunk; /* If the dataset is not written, return without errors */ - if (H5F_addr_defined(idx_info.storage->idx_addr)) { + if (H5_addr_defined(idx_info.storage->idx_addr)) { /* Calculate the scaled of this chunk */ H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, udata.scaled); udata.scaled[dset->shared->ndims] = 0; @@ -8031,7 +8107,7 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned if ((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_chunk_info_by_coord_cb, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to retrieve information of the chunk by its scaled coordinates") + "unable to retrieve information of the chunk by its scaled coordinates"); /* Obtain requested info if the chunk is found */ if (udata.found) { @@ -8042,7 +8118,7 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned if (size) *size = udata.nbytes; } /* end if */ - } /* end if H5F_addr_defined */ + } /* end if H5_addr_defined */ done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -8058,9 +8134,6 @@ H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned * Return: Success: H5_ITER_CONT or H5_ITER_STOP * Failure: Negative (H5_ITER_ERROR) * - * Programmer: Gaute Hope - * August 2020 - * *------------------------------------------------------------------------- */ static int @@ -8079,8 +8152,8 @@ H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata) FUNC_ENTER_PACKAGE_NOERR /* Check for callback failure and pass along return value */ - if ((ret_value = (data->op)(offset, chunk_rec->filter_mask, chunk_rec->chunk_addr, chunk_rec->nbytes, - data->op_data)) < 0) + if ((ret_value = (data->op)(offset, (unsigned)chunk_rec->filter_mask, chunk_rec->chunk_addr, + (hsize_t)chunk_rec->nbytes, data->op_data)) < 0) HERROR(H5E_DATASET, H5E_CANTNEXT, "iteration operator failed"); FUNC_LEAVE_NOAPI(ret_value) @@ -8094,9 +8167,6 @@ H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Gaute Hope - * August 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -8111,21 +8181,21 @@ H5D__chunk_iter(H5D_t *dset, H5D_chunk_iter_op_t op, void *op_data) FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ - HDassert(dset); - HDassert(dset->shared); + assert(dset); + assert(dset->shared); /* Get dataset layout and raw data chunk cache */ layout = &(dset->shared->layout); rdcc = &(dset->shared->cache.chunk); - HDassert(layout); - HDassert(rdcc); - HDassert(H5D_CHUNKED == layout->type); + assert(layout); + assert(rdcc); + assert(H5D_CHUNKED == layout->type); /* Search for cached chunks that haven't been written out */ for (ent = rdcc->head; ent; ent = ent->next) /* Flush the chunk out to disk, to make certain the size is correct later */ if (H5D__chunk_flush_entry(dset, ent, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "cannot flush indexed storage buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "cannot flush indexed storage buffer"); /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -8134,7 +8204,7 @@ H5D__chunk_iter(H5D_t *dset, H5D_chunk_iter_op_t op, void *op_data) idx_info.storage = &layout->storage.u.chunk; /* If the dataset is not written, return without errors */ - if (H5F_addr_defined(idx_info.storage->idx_addr)) { + if (H5_addr_defined(idx_info.storage->idx_addr)) { H5D_chunk_iter_ud_t ud; /* Set up info for iteration callback */ @@ -8145,7 +8215,7 @@ H5D__chunk_iter(H5D_t *dset, H5D_chunk_iter_op_t op, void *op_data) /* Iterate over the allocated chunks calling the iterator callback */ if ((ret_value = (layout->storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_iter_cb, &ud)) < 0) HERROR(H5E_DATASET, H5E_CANTNEXT, "chunk iteration failed"); - } /* end if H5F_addr_defined */ + } /* end if H5_addr_defined */ done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -8172,24 +8242,24 @@ H5D__chunk_get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *of FUNC_ENTER_NOAPI(FAIL) - HDassert(dset); - HDassert(offset); - HDassert(offset_copy); + assert(dset); + assert(offset); + assert(offset_copy); /* The library's chunking code requires the offset to terminate with a zero. * So transfer the offset array to an internal offset array that we * can properly terminate (handled via the memset call). */ - HDmemset(offset_copy, 0, H5O_LAYOUT_NDIMS * sizeof(hsize_t)); + memset(offset_copy, 0, H5O_LAYOUT_NDIMS * sizeof(hsize_t)); for (u = 0; u < dset->shared->ndims; u++) { /* Make sure the offset doesn't exceed the dataset's dimensions */ if (offset[u] > dset->shared->curr_dims[u]) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "offset exceeds dimensions of dataset") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "offset exceeds dimensions of dataset"); /* Make sure the offset fall right on a chunk's boundary */ if (offset[u] % dset->shared->layout.u.chunk.dim[u]) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "offset doesn't fall on chunks's boundary") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "offset doesn't fall on chunks's boundary"); offset_copy[u] = offset[u]; } diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dcompact.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dcompact.c index 8ac1f0a1ee..c16b24ba90 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dcompact.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dcompact.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu - * August 5, 2002 - * * Purpose: Compact dataset I/O functions. These routines are similar * H5D_contig_* and H5D_chunk_*. */ @@ -63,15 +59,16 @@ typedef struct H5D_compact_iovv_memmanage_ud_t { /* Layout operation callbacks */ static herr_t H5D__compact_construct(H5F_t *f, H5D_t *dset); static hbool_t H5D__compact_is_space_alloc(const H5O_storage_t *storage); -static herr_t H5D__compact_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm); +static herr_t H5D__compact_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); static herr_t H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata); -static ssize_t H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, - size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]); -static ssize_t H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, - size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]); +static ssize_t H5D__compact_readvv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], + hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, + size_t mem_size_arr[], hsize_t mem_offset_arr[]); +static ssize_t H5D__compact_writevv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_size_arr[], + hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, + size_t mem_size_arr[], hsize_t mem_offset_arr[]); static herr_t H5D__compact_flush(H5D_t *dset); static herr_t H5D__compact_dest(H5D_t *dset); @@ -86,17 +83,14 @@ const H5D_layout_ops_t H5D_LOPS_COMPACT[1] = {{ H5D__compact_is_space_alloc, /* is_space_alloc */ NULL, /* is_data_cached */ H5D__compact_io_init, /* io_init */ + NULL, /* mdio_init */ H5D__contig_read, /* ser_read */ H5D__contig_write, /* ser_write */ -#ifdef H5_HAVE_PARALLEL - NULL, /* par_read */ - NULL, /* par_write */ -#endif - H5D__compact_readvv, /* readvv */ - H5D__compact_writevv, /* writevv */ - H5D__compact_flush, /* flush */ - NULL, /* io_term */ - H5D__compact_dest /* dest */ + H5D__compact_readvv, /* readvv */ + H5D__compact_writevv, /* writevv */ + H5D__compact_flush, /* flush */ + NULL, /* io_term */ + H5D__compact_dest /* dest */ }}; /*******************/ @@ -113,9 +107,6 @@ H5FL_BLK_EXTERN(type_conv); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 6, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -128,29 +119,29 @@ H5D__compact_fill(const H5D_t *dset) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dset && H5D_COMPACT == dset->shared->layout.type); - HDassert(dset->shared->layout.storage.u.compact.buf); - HDassert(dset->shared->type); - HDassert(dset->shared->space); + assert(dset && H5D_COMPACT == dset->shared->layout.type); + assert(dset->shared->layout.storage.u.compact.buf); + assert(dset->shared->type); + assert(dset->shared->space); /* Initialize the fill value buffer */ /* (use the compact dataset storage buffer as the fill value buffer) */ if (H5D__fill_init(&fb_info, dset->shared->layout.storage.u.compact.buf, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, (size_t)0, dset->shared->layout.storage.u.compact.size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info"); fb_info_init = TRUE; /* Check for VL datatype & non-default fill value */ if (fb_info.has_vlen_fill_type) /* Fill the buffer with VL datatype fill values */ if (H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer"); done: /* Release the fill buffer info, if it's been initialized */ if (fb_info_init && H5D__fill_term(&fb_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__compact_fill() */ @@ -162,9 +153,6 @@ H5D__compact_fill(const H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, May 22, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -179,22 +167,22 @@ H5D__compact_construct(H5F_t *f, H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(dset); + assert(f); + assert(dset); /* Check for invalid dataset dimensions */ for (u = 0; u < dset->shared->ndims; u++) if (dset->shared->max_dims[u] > dset->shared->curr_dims[u]) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible compact dataset not allowed") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "extendible compact dataset not allowed"); /* * Compact dataset is stored in dataset object header message of * layout. */ stmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space); - HDassert(stmp_size >= 0); + assert(stmp_size >= 0); tmp_size = H5T_get_size(dset->shared->type); - HDassert(tmp_size > 0); + assert(tmp_size > 0); tmp_size = tmp_size * (hsize_t)stmp_size; H5_CHECKED_ASSIGN(dset->shared->layout.storage.u.compact.size, size_t, tmp_size, hssize_t); @@ -204,7 +192,7 @@ H5D__compact_construct(H5F_t *f, H5D_t *dset) max_comp_data_size = H5O_MESG_MAX_SIZE - H5D__layout_meta_size(f, &(dset->shared->layout), FALSE); if (dset->shared->layout.storage.u.compact.size > max_comp_data_size) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "compact dataset size is bigger than header message maximum size") + "compact dataset size is bigger than header message maximum size"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -217,9 +205,6 @@ H5D__compact_construct(H5F_t *f, H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 15, 2009 - * *------------------------------------------------------------------------- */ static hbool_t @@ -228,7 +213,7 @@ H5D__compact_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(storage); + assert(storage); /* Compact storage is currently always allocated */ FUNC_LEAVE_NOAPI(TRUE) @@ -241,20 +226,20 @@ H5D__compact_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2008 - * *------------------------------------------------------------------------- */ static herr_t -H5D__compact_io_init(H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info, - hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space, - H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm) +H5D__compact_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo) { FUNC_ENTER_PACKAGE_NOERR - io_info->store->compact.buf = io_info->dset->shared->layout.storage.u.compact.buf; - io_info->store->compact.dirty = &io_info->dset->shared->layout.storage.u.compact.dirty; + dinfo->store->compact.buf = dinfo->dset->shared->layout.storage.u.compact.buf; + dinfo->store->compact.dirty = &dinfo->dset->shared->layout.storage.u.compact.dirty; + dinfo->layout_io_info.contig_piece_info = NULL; + + /* Disable selection I/O */ + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__compact_io_init() */ @@ -282,7 +267,7 @@ H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, voi /* Retrieve pointer to file driver structure for ctl call */ if (H5F_shared_get_file_driver(udata->f_sh, &file_handle) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "can't get file handle") + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "can't get file handle"); /* Setup operation flags and arguments */ op_flags = H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG | H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; @@ -295,7 +280,7 @@ H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, voi /* Make request to file driver */ if (H5FD_ctl(file_handle, H5FD_CTL_MEM_COPY, op_flags, &op_args, NULL) < 0) - HGOTO_ERROR(H5E_IO, H5E_FCNTL, FAIL, "VFD memcpy request failed") + HGOTO_ERROR(H5E_IO, H5E_FCNTL, FAIL, "VFD memcpy request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -311,24 +296,23 @@ H5D__compact_iovv_memmanage_cb(hsize_t dst_off, hsize_t src_off, size_t len, voi * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 7, 2003 - * * Notes: * Offsets in the sequences must be monotonically increasing * *------------------------------------------------------------------------- */ static ssize_t -H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, - size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]) +H5D__compact_readvv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, size_t dset_max_nseq, + size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], + size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], + hsize_t mem_offset_arr[]) { ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE - HDassert(io_info); + assert(io_info); + assert(dset_info); /* Check if file driver wishes to do its own memory management */ if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_MEMMANAGE)) { @@ -336,21 +320,21 @@ H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t * /* Set up udata for memory copy operation */ udata.f_sh = io_info->f_sh; - udata.dstbuf = io_info->u.rbuf; - udata.srcbuf = io_info->store->compact.buf; + udata.dstbuf = dset_info->buf.vp; + udata.srcbuf = dset_info->store->compact.buf; /* Request that file driver does the memory copy */ if ((ret_value = H5VM_opvv(mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr, dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr, H5D__compact_iovv_memmanage_cb, &udata)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); } else { /* Use the vectorized memory copy routine to do actual work */ - if ((ret_value = H5VM_memcpyvv(io_info->u.rbuf, mem_max_nseq, mem_curr_seq, mem_size_arr, - mem_offset_arr, io_info->store->compact.buf, dset_max_nseq, + if ((ret_value = H5VM_memcpyvv(dset_info->buf.vp, mem_max_nseq, mem_curr_seq, mem_size_arr, + mem_offset_arr, dset_info->store->compact.buf, dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); } done: @@ -370,24 +354,23 @@ H5D__compact_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 2, 2003 - * * Notes: * Offsets in the sequences must be monotonically increasing * *------------------------------------------------------------------------- */ static ssize_t -H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_size_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, - size_t *mem_curr_seq, size_t mem_size_arr[], hsize_t mem_offset_arr[]) +H5D__compact_writevv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, size_t dset_max_nseq, + size_t *dset_curr_seq, size_t dset_size_arr[], hsize_t dset_offset_arr[], + size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_size_arr[], + hsize_t mem_offset_arr[]) { ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE - HDassert(io_info); + assert(io_info); + assert(dset_info); /* Check if file driver wishes to do its own memory management */ if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_MEMMANAGE)) { @@ -395,25 +378,25 @@ H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t /* Set up udata for memory copy operation */ udata.f_sh = io_info->f_sh; - udata.dstbuf = io_info->store->compact.buf; - udata.srcbuf = io_info->u.wbuf; + udata.dstbuf = dset_info->store->compact.buf; + udata.srcbuf = dset_info->buf.cvp; /* Request that file driver does the memory copy */ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_size_arr, dset_offset_arr, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr, H5D__compact_iovv_memmanage_cb, &udata)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); } else { /* Use the vectorized memory copy routine to do actual work */ - if ((ret_value = H5VM_memcpyvv(io_info->store->compact.buf, dset_max_nseq, dset_curr_seq, - dset_size_arr, dset_offset_arr, io_info->u.wbuf, mem_max_nseq, + if ((ret_value = H5VM_memcpyvv(dset_info->store->compact.buf, dset_max_nseq, dset_curr_seq, + dset_size_arr, dset_offset_arr, dset_info->buf.cvp, mem_max_nseq, mem_curr_seq, mem_size_arr, mem_offset_arr)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); } /* Mark the compact dataset's buffer as dirty */ - *io_info->store->compact.dirty = TRUE; + *dset_info->store->compact.dirty = TRUE; done: FUNC_LEAVE_NOAPI(ret_value) @@ -426,9 +409,6 @@ H5D__compact_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -439,14 +419,14 @@ H5D__compact_flush(H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); + assert(dset); /* Check if the buffered compact information is dirty */ if (dset->shared->layout.storage.u.compact.dirty) { dset->shared->layout.storage.u.compact.dirty = FALSE; if (H5O_msg_write(&(dset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dset->shared->layout)) < 0) { dset->shared->layout.storage.u.compact.dirty = TRUE; - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message"); } } /* end if */ @@ -461,9 +441,6 @@ H5D__compact_flush(H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, Sept 3, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -472,7 +449,7 @@ H5D__compact_dest(H5D_t *dset) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(dset); + assert(dset); /* Free the buffer for the raw data for compact datasets */ dset->shared->layout.storage.u.compact.buf = H5MM_xfree(dset->shared->layout.storage.u.compact.buf); @@ -487,9 +464,6 @@ H5D__compact_dest(H5D_t *dset) * * Return: Non-negative on success, negative on failure. * - * Programmer: Peter Cao - * December 11, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -511,12 +485,12 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f_src); - HDassert(storage_src); - HDassert(f_dst); - HDassert(storage_dst); - HDassert(storage_dst->buf); - HDassert(dt_src); + assert(f_src); + assert(storage_src); + assert(f_dst); + assert(storage_dst); + assert(storage_dst->buf); + assert(dt_src); /* If the dataset is open in the file, point to "layout" in the shared struct */ if (shared_fo != NULL) @@ -524,7 +498,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds /* Create datatype ID for src datatype, so it gets freed */ if ((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register source file datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register source file datatype"); /* If there's a VLEN source datatype, do type conversion information */ if (H5T_detect_class(dt_src, H5T_VLEN, FALSE) > 0) { @@ -541,43 +515,43 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds /* create a memory copy of the variable-length datatype */ if (NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy"); if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) { (void)H5T_close_real(dt_mem); - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype"); } /* end if */ /* create variable-length datatype at the destination file */ if (NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy"); if (H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) { (void)H5T_close_real(dt_dst); - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk"); } /* end if */ if ((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) { (void)H5T_close_real(dt_dst); - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype"); } /* end if */ /* Set up the conversion functions */ if (NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes"); if (NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes"); /* Determine largest datatype size */ if (0 == (src_dt_size = H5T_get_size(dt_src))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size"); if (0 == (tmp_dt_size = H5T_get_size(dt_mem))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size"); max_dt_size = MAX(src_dt_size, tmp_dt_size); if (0 == (tmp_dt_size = H5T_get_size(dt_dst))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to determine datatype size"); max_dt_size = MAX(max_dt_size, tmp_dt_size); /* Set number of whole elements that fit in buffer */ if (0 == (nelmts = storage_src->size / src_dt_size)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large"); /* Set up number of bytes to copy, and initial buffer size */ buf_size = nelmts * max_dt_size; @@ -587,46 +561,46 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds /* Create the space and set the initial extent */ if (NULL == (buf_space = H5S_create_simple((unsigned)1, &buf_dim, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); /* Register */ if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) { H5S_close(buf_space); - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); } /* end if */ /* Allocate memory for recclaim buf */ if (NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Allocate memory for copying the chunk */ if (NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); H5MM_memcpy(buf, storage_src->buf, storage_src->size); /* allocate temporary bkg buff for data conversion */ if (NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Convert from source file to memory */ if (H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); /* Copy into another buffer, to reclaim memory later */ H5MM_memcpy(reclaim_buf, buf, buf_size); /* Set background buffer to all zeros */ - HDmemset(bkg, 0, buf_size); + memset(bkg, 0, buf_size); /* Convert from memory to destination file */ if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); H5MM_memcpy(storage_dst->buf, buf, storage_dst->size); if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data") + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data"); } /* end if */ else if (H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) { if (f_src != f_dst) { @@ -636,11 +610,11 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds */ if (H5O_copy_expand_ref(f_src, tid_src, dt_src, storage_src->buf, storage_src->size, f_dst, storage_dst->buf, cpy_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute"); } /* end if */ else /* Reset value to zero */ - HDmemset(storage_dst->buf, 0, storage_src->size); + memset(storage_dst->buf, 0, storage_src->size); } /* end if */ else /* Type conversion not necessary */ @@ -655,13 +629,13 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds done: if (buf_sid > 0 && H5I_dec_ref(buf_sid) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID"); if (tid_src > 0 && H5I_dec_ref(tid_src) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (tid_dst > 0 && H5I_dec_ref(tid_dst) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (tid_mem > 0 && H5I_dec_ref(tid_mem) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (buf) buf = H5FL_BLK_FREE(type_conv, buf); if (reclaim_buf) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dcontig.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dcontig.c index 6408aaf043..4624d8365e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dcontig.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dcontig.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Thursday, September 28, 2000 - * * Purpose: * Contiguous dataset I/O functions. These routines are similar to * the H5D_chunk_* routines and really only an abstract way of dealing @@ -91,19 +87,24 @@ typedef struct H5D_contig_writevv_ud_t { /* Layout operation callbacks */ static herr_t H5D__contig_construct(H5F_t *f, H5D_t *dset); static herr_t H5D__contig_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id); -static herr_t H5D__contig_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm); -static ssize_t H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, - size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); -static ssize_t H5D__contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, - size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); +static herr_t H5D__contig_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); +static herr_t H5D__contig_mdio_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); +static ssize_t H5D__contig_readvv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dinfo, + size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], + hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, + size_t mem_len_arr[], hsize_t mem_offset_arr[]); +static ssize_t H5D__contig_writevv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dinfo, + size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], + hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, + size_t mem_len_arr[], hsize_t mem_offset_arr[]); static herr_t H5D__contig_flush(H5D_t *dset); +static herr_t H5D__contig_io_term(H5D_io_info_t *io_info, H5D_dset_io_info_t *di); /* Helper routines */ -static herr_t H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset, size_t size); -static htri_t H5D__contig_may_use_select_io(const H5D_io_info_t *io_info, H5D_io_op_type_t op_type); +static herr_t H5D__contig_write_one(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, hsize_t offset, + size_t size); +static herr_t H5D__contig_may_use_select_io(H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + H5D_io_op_type_t op_type); /*********************/ /* Package Variables */ @@ -116,17 +117,14 @@ const H5D_layout_ops_t H5D_LOPS_CONTIG[1] = {{ H5D__contig_is_space_alloc, /* is_space_alloc */ H5D__contig_is_data_cached, /* is_data_cached */ H5D__contig_io_init, /* io_init */ + H5D__contig_mdio_init, /* mdio_init */ H5D__contig_read, /* ser_read */ H5D__contig_write, /* ser_write */ -#ifdef H5_HAVE_PARALLEL - H5D__contig_collective_read, /* par_read */ - H5D__contig_collective_write, /* par_write */ -#endif - H5D__contig_readvv, /* readvv */ - H5D__contig_writevv, /* writevv */ - H5D__contig_flush, /* flush */ - NULL, /* io_term */ - NULL /* dest */ + H5D__contig_readvv, /* readvv */ + H5D__contig_writevv, /* writevv */ + H5D__contig_flush, /* flush */ + H5D__contig_io_term, /* io_term */ + NULL /* dest */ }}; /*******************/ @@ -139,6 +137,9 @@ H5FL_BLK_DEFINE(sieve_buf); /* Declare extern the free list to manage blocks of type conversion data */ H5FL_BLK_EXTERN(type_conv); +/* Declare extern the free list to manage the H5D_piece_info_t struct */ +H5FL_EXTERN(H5D_piece_info_t); + /*------------------------------------------------------------------------- * Function: H5D__contig_alloc * @@ -146,9 +147,6 @@ H5FL_BLK_EXTERN(type_conv); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * April 19, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -159,12 +157,12 @@ H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage /*out */) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(storage); + assert(f); + assert(storage); /* Allocate space for the contiguous data */ if (HADDR_UNDEF == (storage->addr = H5MF_alloc(f, H5FD_MEM_DRAW, storage->size))) - HGOTO_ERROR(H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space") + HGOTO_ERROR(H5E_IO, H5E_NOSPACE, FAIL, "unable to reserve file space"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -177,21 +175,18 @@ H5D__contig_alloc(H5F_t *f, H5O_storage_contig_t *storage /*out */) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 22, 2002 - * *------------------------------------------------------------------------- */ herr_t -H5D__contig_fill(const H5D_io_info_t *io_info) +H5D__contig_fill(H5D_t *dset) { - const H5D_t *dset = io_info->dset; /* the dataset pointer */ - H5D_io_info_t ioinfo; /* Dataset I/O info */ - H5D_storage_t store; /* Union of storage info for dataset */ - hssize_t snpoints; /* Number of points in space (for error checking) */ - size_t npoints; /* Number of points in space */ - hsize_t offset; /* Offset of dataset */ - size_t max_temp_buf; /* Maximum size of temporary buffer */ + H5D_io_info_t ioinfo; /* Dataset I/O info */ + H5D_dset_io_info_t dset_info; /* Dset info */ + H5D_storage_t store; /* Union of storage info for dataset */ + hssize_t snpoints; /* Number of points in space (for error checking) */ + size_t npoints; /* Number of points in space */ + hsize_t offset; /* Offset of dataset */ + size_t max_temp_buf; /* Maximum size of temporary buffer */ #ifdef H5_HAVE_PARALLEL MPI_Comm mpi_comm = MPI_COMM_NULL; /* MPI communicator for file */ int mpi_rank = (-1); /* This process's rank */ @@ -207,22 +202,22 @@ H5D__contig_fill(const H5D_io_info_t *io_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dset && H5D_CONTIGUOUS == dset->shared->layout.type); - HDassert(H5F_addr_defined(dset->shared->layout.storage.u.contig.addr)); - HDassert(dset->shared->layout.storage.u.contig.size > 0); - HDassert(dset->shared->space); - HDassert(dset->shared->type); + assert(dset && H5D_CONTIGUOUS == dset->shared->layout.type); + assert(H5_addr_defined(dset->shared->layout.storage.u.contig.addr)); + assert(dset->shared->layout.storage.u.contig.size > 0); + assert(dset->shared->space); + assert(dset->shared->type); #ifdef H5_HAVE_PARALLEL /* Retrieve MPI parameters */ if (H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI)) { /* Get the MPI communicator */ if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(dset->oloc.file))) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator") + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI communicator"); /* Get the MPI rank */ if ((mpi_rank = H5F_mpi_get_rank(dset->oloc.file)) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank") + HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI rank"); /* Set the MPI-capable file driver flag */ using_mpi = TRUE; @@ -235,24 +230,31 @@ H5D__contig_fill(const H5D_io_info_t *io_info) /* Get the number of elements in the dataset's dataspace */ if ((snpoints = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "dataset has negative number of elements") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "dataset has negative number of elements"); H5_CHECKED_ASSIGN(npoints, size_t, snpoints, hssize_t); /* Get the maximum size of temporary buffers */ if (H5CX_get_max_temp_buf(&max_temp_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve max. temp. buf size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve max. temp. buf size"); /* Initialize the fill value buffer */ if (H5D__fill_init(&fb_info, NULL, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, npoints, max_temp_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info"); fb_info_init = TRUE; /* Start at the beginning of the dataset */ offset = 0; /* Simple setup for dataset I/O info struct */ - H5D_BUILD_IO_INFO_WRT(&ioinfo, dset, &store, fb_info.fill_buf); + ioinfo.op_type = H5D_IO_OP_WRITE; + + dset_info.dset = (H5D_t *)dset; + dset_info.store = &store; + dset_info.buf.cvp = fb_info.fill_buf; + dset_info.mem_space = NULL; + ioinfo.dsets_info = &dset_info; + ioinfo.f_sh = H5F_SHARED(dset->oloc.file); /* * Fill the entire current extent with the fill value. We can do @@ -273,7 +275,7 @@ H5D__contig_fill(const H5D_io_info_t *io_info) if (fb_info.has_vlen_fill_type) /* Re-fill the buffer to use for this I/O operation */ if (H5D__fill_refill_vl(&fb_info, curr_points) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer"); #ifdef H5_HAVE_PARALLEL /* Check if this file is accessed with an MPI-capable file driver */ @@ -281,12 +283,12 @@ H5D__contig_fill(const H5D_io_info_t *io_info) /* Write the chunks out from only one process */ /* !! Use the internal "independent" DXPL!! -QAK */ if (H5_PAR_META_WRITE == mpi_rank) { - if (H5D__contig_write_one(&ioinfo, offset, size) < 0) { + if (H5D__contig_write_one(&ioinfo, &dset_info, offset, size) < 0) { /* If writing fails, push an error and stop writing, but * still participate in following MPI_Barrier. */ blocks_written = TRUE; - HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset") + HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset"); break; } } @@ -297,8 +299,8 @@ H5D__contig_fill(const H5D_io_info_t *io_info) else { #endif /* H5_HAVE_PARALLEL */ H5_CHECK_OVERFLOW(size, size_t, hsize_t); - if (H5D__contig_write_one(&ioinfo, offset, size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset") + if (H5D__contig_write_one(&ioinfo, &dset_info, offset, size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to write fill value to dataset"); #ifdef H5_HAVE_PARALLEL } /* end else */ #endif /* H5_HAVE_PARALLEL */ @@ -323,7 +325,7 @@ H5D__contig_fill(const H5D_io_info_t *io_info) done: /* Release the fill buffer info, if it's been initialized */ if (fb_info_init && H5D__fill_term(&fb_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__contig_fill() */ @@ -335,9 +337,6 @@ H5D__contig_fill(const H5D_io_info_t *io_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * March 20, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -348,12 +347,12 @@ H5D__contig_delete(H5F_t *f, const H5O_storage_t *storage) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(storage); + assert(f); + assert(storage); /* Free the file space for the chunk */ if (H5MF_xfree(f, H5FD_MEM_DRAW, storage->u.contig.addr, storage->u.contig.size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free contiguous storage space") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free contiguous storage space"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -366,9 +365,6 @@ H5D__contig_delete(H5F_t *f, const H5O_storage_t *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, May 22, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -385,8 +381,8 @@ H5D__contig_construct(H5F_t *f, H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(dset); + assert(f); + assert(dset); /* * The maximum size of the dataset cannot exceed the storage size. @@ -398,23 +394,23 @@ H5D__contig_construct(H5F_t *f, H5D_t *dset) for (u = 0; u < dset->shared->ndims; u++) if (dset->shared->max_dims[u] > dset->shared->curr_dims[u]) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, - "extendible contiguous non-external dataset not allowed") + "extendible contiguous non-external dataset not allowed"); /* Retrieve the number of elements in the dataspace */ if ((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace"); nelmts = (hsize_t)snelmts; /* Get the datatype's size */ if (0 == (dt_size = H5T_GET_SIZE(dset->shared->type))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype"); /* Compute the size of the dataset's contiguous storage */ tmp_size = nelmts * dt_size; /* Check for overflow during multiplication */ if (nelmts != (tmp_size / dt_size)) - HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed"); /* Assign the dataset's contiguous storage size */ dset->shared->layout.storage.u.contig.size = tmp_size; @@ -441,9 +437,6 @@ H5D__contig_construct(H5F_t *f, H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, August 28, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -456,8 +449,8 @@ H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset, hid_t H5_ATTR_UNUSE FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(dset); + assert(f); + assert(dset); /* Compute the size of the contiguous storage for versions of the * layout message less than version 3 because versions 1 & 2 would @@ -470,19 +463,19 @@ H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset, hid_t H5_ATTR_UNUSE /* Retrieve the number of elements in the dataspace */ if ((snelmts = H5S_GET_EXTENT_NPOINTS(dset->shared->space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve number of elements in dataspace"); nelmts = (hsize_t)snelmts; /* Get the datatype's size */ if (0 == (dt_size = H5T_GET_SIZE(dset->shared->type))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve size of datatype"); /* Compute the size of the dataset's contiguous storage */ tmp_size = nelmts * dt_size; /* Check for overflow during multiplication */ if (nelmts != (tmp_size / dt_size)) - HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed") + HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed"); /* Assign the dataset's contiguous storage size */ dset->shared->layout.storage.u.contig.size = tmp_size; @@ -511,9 +504,6 @@ H5D__contig_init(H5F_t H5_ATTR_UNUSED *f, const H5D_t *dset, hid_t H5_ATTR_UNUSE * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 15, 2009 - * *------------------------------------------------------------------------- */ hbool_t @@ -524,10 +514,10 @@ H5D__contig_is_space_alloc(const H5O_storage_t *storage) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(storage); + assert(storage); /* Set return value */ - ret_value = (hbool_t)H5F_addr_defined(storage->u.contig.addr); + ret_value = (hbool_t)H5_addr_defined(storage->u.contig.addr); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__contig_is_space_alloc() */ @@ -539,9 +529,6 @@ H5D__contig_is_space_alloc(const H5O_storage_t *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Wednesday, March 6, 2016 - * *------------------------------------------------------------------------- */ hbool_t @@ -550,7 +537,7 @@ H5D__contig_is_data_cached(const H5D_shared_t *shared_dset) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(shared_dset); + assert(shared_dset); FUNC_LEAVE_NOAPI(shared_dset->cache.contig.sieve_size > 0) } /* end H5D__contig_is_data_cached() */ @@ -562,33 +549,166 @@ H5D__contig_is_data_cached(const H5D_shared_t *shared_dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2008 - * *------------------------------------------------------------------------- */ static herr_t -H5D__contig_io_init(H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info, - hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space, - H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm) +H5D__contig_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo) { - htri_t use_selection_io = FALSE; /* Whether to use selection I/O */ - htri_t ret_value = SUCCEED; /* Return value */ + H5D_t *dataset = dinfo->dset; /* Local pointer to dataset info */ + + hssize_t old_offset[H5O_LAYOUT_NDIMS]; /* Old selection offset */ + htri_t file_space_normalized = FALSE; /* File dataspace was normalized */ + + int sf_ndims; /* The number of dimensions of the file dataspace (signed) */ + + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - io_info->store->contig.dset_addr = io_info->dset->shared->layout.storage.u.contig.addr; - io_info->store->contig.dset_size = io_info->dset->shared->layout.storage.u.contig.size; + dinfo->store->contig.dset_addr = dataset->shared->layout.storage.u.contig.addr; + dinfo->store->contig.dset_size = dataset->shared->layout.storage.u.contig.size; + + /* Initialize piece info */ + dinfo->layout_io_info.contig_piece_info = NULL; + + /* Get layout for dataset */ + dinfo->layout = &(dataset->shared->layout); + + /* Get dim number and dimensionality for each dataspace */ + if ((sf_ndims = H5S_GET_EXTENT_NDIMS(dinfo->file_space)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimension number"); + + /* Normalize hyperslab selections by adjusting them by the offset */ + /* (It might be worthwhile to normalize both the file and memory dataspaces + * before any (contiguous, chunked, etc) file I/O operation, in order to + * speed up hyperslab calculations by removing the extra checks and/or + * additions involving the offset and the hyperslab selection -QAK) + */ + if ((file_space_normalized = H5S_hyper_normalize_offset(dinfo->file_space, old_offset)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset"); + + /* if selected elements exist */ + if (dinfo->nelmts) { + int u; + H5D_piece_info_t *new_piece_info; /* piece information to insert into skip list */ + + /* Get copy of dset file_space, so it can be changed temporarily + * purpose + * This tmp_fspace allows multiple write before close dset */ + H5S_t *tmp_fspace; /* Temporary file dataspace */ + + /* Create "temporary" chunk for selection operations (copy file space) */ + if (NULL == (tmp_fspace = H5S_copy(dinfo->file_space, TRUE, FALSE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy memory space"); + + /* Add temporary chunk to the list of pieces */ + /* collect piece_info into Skip List */ + /* Allocate the file & memory chunk information */ + if (NULL == (new_piece_info = H5FL_MALLOC(H5D_piece_info_t))) { + (void)H5S_close(tmp_fspace); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate chunk info"); + } /* end if */ + + /* Set the piece index */ + new_piece_info->index = 0; + + /* Set the file chunk dataspace */ + new_piece_info->fspace = tmp_fspace; + new_piece_info->fspace_shared = FALSE; + + /* Set the memory chunk dataspace */ + /* same as one chunk, just use dset mem space */ + new_piece_info->mspace = dinfo->mem_space; + + /* set true for sharing mem space with dset, which means + * fspace gets free by application H5Sclose(), and + * doesn't require providing layout_ops.io_term() for H5D_LOPS_CONTIG. + */ + new_piece_info->mspace_shared = TRUE; + + /* Set the number of points */ + new_piece_info->piece_points = dinfo->nelmts; + + /* Copy the piece's coordinates */ + for (u = 0; u < sf_ndims; u++) + new_piece_info->scaled[u] = 0; + new_piece_info->scaled[sf_ndims] = 0; + + /* make connection to related dset info from this piece_info */ + new_piece_info->dset_info = dinfo; + + /* get dset file address for piece */ + new_piece_info->faddr = dinfo->dset->shared->layout.storage.u.contig.addr; + + /* Initialize in-place type conversion info. Start with it disabled. */ + new_piece_info->in_place_tconv = FALSE; + new_piece_info->buf_off = 0; + + /* Calculate type conversion buffer size and check for in-place conversion if necessary. Currently + * only implemented for selection I/O. */ + if (io_info->use_select_io != H5D_SELECTION_IO_MODE_OFF && + !(dinfo->type_info.is_xform_noop && dinfo->type_info.is_conv_noop)) + H5D_INIT_PIECE_TCONV(io_info, dinfo, new_piece_info) + + /* Save piece to dataset info struct so it is freed at the end of the + * operation */ + dinfo->layout_io_info.contig_piece_info = new_piece_info; - /* Check if we're performing selection I/O */ - if ((use_selection_io = H5D__contig_may_use_select_io(io_info, H5D_IO_OP_READ)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if selection I/O is possible") - io_info->use_select_io = (hbool_t)use_selection_io; + /* Add piece to piece_count */ + io_info->piece_count++; + } /* end if */ + + /* Check if we're performing selection I/O if it hasn't been disabled + * already */ + if (io_info->use_select_io != H5D_SELECTION_IO_MODE_OFF) + if (H5D__contig_may_use_select_io(io_info, dinfo, io_info->op_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if selection I/O is possible"); done: + if (ret_value < 0) { + if (H5D__contig_io_term(io_info, dinfo) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataset I/O info"); + } /* end if */ + + if (file_space_normalized) { + /* (Casting away const OK -QAK) */ + if (H5S_hyper_denormalize_offset(dinfo->file_space, old_offset) < 0) + HDONE_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset"); + } /* end if */ + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__contig_io_init() */ +/*------------------------------------------------------------------------- + * Function: H5D__contig_mdio_init + * + * Purpose: Performs second phase of initialization for multi-dataset + * I/O. Currently just adds data block to sel_pieces. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__contig_mdio_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Add piece if it exists */ + if (dinfo->layout_io_info.contig_piece_info) { + assert(io_info->sel_pieces); + assert(io_info->pieces_added < io_info->piece_count); + + /* Add contiguous data block to sel_pieces */ + io_info->sel_pieces[io_info->pieces_added] = dinfo->layout_io_info.contig_piece_info; + + /* Update pieces_added */ + io_info->pieces_added++; + } + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__contig_mdio_init() */ + /*------------------------------------------------------------------------- * Function: H5D__contig_may_use_select_io * @@ -597,47 +717,52 @@ H5D__contig_io_init(H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED * * Return: TRUE/FALSE/FAIL * - * Programmer: Neil Fortner - * 3 August 2021 - * *------------------------------------------------------------------------- */ -static htri_t -H5D__contig_may_use_select_io(const H5D_io_info_t *io_info, H5D_io_op_type_t op_type) +static herr_t +H5D__contig_may_use_select_io(H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + H5D_io_op_type_t op_type) { - const H5D_t *dataset = NULL; /* Local pointer to dataset info */ - htri_t ret_value = FAIL; /* Return value */ + const H5D_t *dataset = NULL; /* Local pointer to dataset info */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(io_info->dset); - HDassert(op_type == H5D_IO_OP_READ || op_type == H5D_IO_OP_WRITE); - - dataset = io_info->dset; - - /* Don't use selection I/O if it's globally disabled, if there is a type - * conversion, or if it's not a contiguous dataset, or if the sieve buffer - * exists (write) or is dirty (read) */ - if (!H5_use_selection_io_g || io_info->io_ops.single_read != H5D__select_read || - io_info->layout_ops.readvv != H5D__contig_readvv || - (op_type == H5D_IO_OP_READ && dataset->shared->cache.contig.sieve_dirty) || - (op_type == H5D_IO_OP_WRITE && dataset->shared->cache.contig.sieve_buf)) - ret_value = FALSE; + assert(io_info); + assert(dset_info); + assert(dset_info->dset); + assert(op_type == H5D_IO_OP_READ || op_type == H5D_IO_OP_WRITE); + + dataset = dset_info->dset; + + /* None of the reasons this function might disable selection I/O are relevant to parallel, so no need to + * update no_selection_io_cause since we're only keeping track of the reason for no selection I/O in + * parallel (for now) */ + + /* Don't use selection I/O if it's globally disabled, if it's not a contiguous dataset, or if the sieve + * buffer exists (write) or is dirty (read) */ + if (dset_info->layout_ops.readvv != H5D__contig_readvv) { + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; + } + else if ((op_type == H5D_IO_OP_READ && dataset->shared->cache.contig.sieve_dirty) || + (op_type == H5D_IO_OP_WRITE && dataset->shared->cache.contig.sieve_buf)) { + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_CONTIGUOUS_SIEVE_BUFFER; + } else { hbool_t page_buf_enabled; - HDassert(io_info->io_ops.single_write == H5D__select_write); - HDassert(io_info->layout_ops.writevv == H5D__contig_writevv); + assert(dset_info->layout_ops.writevv == H5D__contig_writevv); /* Check if the page buffer is enabled */ if (H5PB_enabled(io_info->f_sh, H5FD_MEM_DRAW, &page_buf_enabled) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if page buffer is enabled") - if (page_buf_enabled) - ret_value = FALSE; - else - ret_value = TRUE; + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if page buffer is enabled"); + if (page_buf_enabled) { + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_PAGE_BUFFER; + } } /* end else */ done: @@ -651,41 +776,68 @@ H5D__contig_may_use_select_io(const H5D_io_info_t *io_info, H5D_io_op_type_t op_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Thursday, April 10, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, H5S_t *file_space, - H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm) +H5D__contig_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(io_info->u.rbuf); - HDassert(type_info); - HDassert(mem_space); - HDassert(file_space); - - if (io_info->use_select_io) { - size_t dst_type_size = type_info->dst_type_size; - - /* Issue selection I/O call (we can skip the page buffer because we've - * already verified it won't be used, and the metadata accumulator - * because this is raw data) */ - if (H5F_shared_select_read(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, nelmts > 0 ? 1 : 0, - &mem_space, &file_space, &(io_info->store->contig.dset_addr), - &dst_type_size, &(io_info->u.rbuf)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "contiguous selection read failed") - } /* end if */ + assert(io_info); + assert(dinfo); + assert(dinfo->buf.vp); + assert(dinfo->mem_space); + assert(dinfo->file_space); + + if (io_info->use_select_io == H5D_SELECTION_IO_MODE_ON) { + /* Only perform I/O if not performing multi dataset I/O or type conversion, + * otherwise the higher level will handle it after all datasets + * have been processed */ + if (H5D_LAYOUT_CB_PERFORM_IO(io_info)) { + size_t dst_type_size = dinfo->type_info.dst_type_size; + + /* Issue selection I/O call (we can skip the page buffer because we've + * already verified it won't be used, and the metadata accumulator + * because this is raw data) */ + if (H5F_shared_select_read(H5F_SHARED(dinfo->dset->oloc.file), H5FD_MEM_DRAW, + dinfo->nelmts > 0 ? 1 : 0, &dinfo->mem_space, &dinfo->file_space, + &(dinfo->store->contig.dset_addr), &dst_type_size, + &(dinfo->buf.vp)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "contiguous selection read failed"); + } + else { + if (dinfo->layout_io_info.contig_piece_info) { + /* Add to mdset selection I/O arrays */ + assert(io_info->mem_spaces); + assert(io_info->file_spaces); + assert(io_info->addrs); + assert(io_info->element_sizes); + assert(io_info->rbufs); + assert(io_info->pieces_added < io_info->piece_count); + + io_info->mem_spaces[io_info->pieces_added] = dinfo->mem_space; + io_info->file_spaces[io_info->pieces_added] = dinfo->file_space; + io_info->addrs[io_info->pieces_added] = dinfo->store->contig.dset_addr; + io_info->element_sizes[io_info->pieces_added] = dinfo->type_info.src_type_size; + io_info->rbufs[io_info->pieces_added] = dinfo->buf.vp; + if (io_info->sel_pieces) + io_info->sel_pieces[io_info->pieces_added] = dinfo->layout_io_info.contig_piece_info; + io_info->pieces_added++; + } + } + +#ifdef H5_HAVE_PARALLEL + /* Report that collective contiguous I/O was used */ + io_info->actual_io_mode |= H5D_MPIO_CONTIGUOUS_COLLECTIVE; +#endif /* H5_HAVE_PARALLEL */ + } /* end if */ else /* Read data through legacy (non-selection I/O) pathway */ - if ((io_info->io_ops.single_read)(io_info, type_info, nelmts, file_space, mem_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "contiguous read failed") + if ((dinfo->io_ops.single_read)(io_info, dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "contiguous read failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -698,41 +850,68 @@ H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Thursday, April 10, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, H5S_t *file_space, - H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm) +H5D__contig_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(io_info->u.wbuf); - HDassert(type_info); - HDassert(mem_space); - HDassert(file_space); - - if (io_info->use_select_io) { - size_t dst_type_size = type_info->dst_type_size; - - /* Issue selection I/O call (we can skip the page buffer because we've - * already verified it won't be used, and the metadata accumulator - * because this is raw data) */ - if (H5F_shared_select_write(H5F_SHARED(io_info->dset->oloc.file), H5FD_MEM_DRAW, nelmts > 0 ? 1 : 0, - &mem_space, &file_space, &(io_info->store->contig.dset_addr), - &dst_type_size, &(io_info->u.wbuf)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "contiguous selection write failed") - } /* end if */ + assert(io_info); + assert(dinfo); + assert(dinfo->buf.cvp); + assert(dinfo->mem_space); + assert(dinfo->file_space); + + if (io_info->use_select_io == H5D_SELECTION_IO_MODE_ON) { + /* Only perform I/O if not performing multi dataset I/O or type conversion, + * otherwise the higher level will handle it after all datasets + * have been processed */ + if (H5D_LAYOUT_CB_PERFORM_IO(io_info)) { + size_t dst_type_size = dinfo->type_info.dst_type_size; + + /* Issue selection I/O call (we can skip the page buffer because we've + * already verified it won't be used, and the metadata accumulator + * because this is raw data) */ + if (H5F_shared_select_write(H5F_SHARED(dinfo->dset->oloc.file), H5FD_MEM_DRAW, + dinfo->nelmts > 0 ? 1 : 0, &dinfo->mem_space, &dinfo->file_space, + &(dinfo->store->contig.dset_addr), &dst_type_size, + &(dinfo->buf.cvp)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "contiguous selection write failed"); + } + else { + if (dinfo->layout_io_info.contig_piece_info) { + /* Add to mdset selection I/O arrays */ + assert(io_info->mem_spaces); + assert(io_info->file_spaces); + assert(io_info->addrs); + assert(io_info->element_sizes); + assert(io_info->wbufs); + assert(io_info->pieces_added < io_info->piece_count); + + io_info->mem_spaces[io_info->pieces_added] = dinfo->mem_space; + io_info->file_spaces[io_info->pieces_added] = dinfo->file_space; + io_info->addrs[io_info->pieces_added] = dinfo->store->contig.dset_addr; + io_info->element_sizes[io_info->pieces_added] = dinfo->type_info.dst_type_size; + io_info->wbufs[io_info->pieces_added] = dinfo->buf.cvp; + if (io_info->sel_pieces) + io_info->sel_pieces[io_info->pieces_added] = dinfo->layout_io_info.contig_piece_info; + io_info->pieces_added++; + } + } + +#ifdef H5_HAVE_PARALLEL + /* Report that collective contiguous I/O was used */ + io_info->actual_io_mode |= H5D_MPIO_CONTIGUOUS_COLLECTIVE; +#endif /* H5_HAVE_PARALLEL */ + } /* end if */ else /* Write data through legacy (non-selection I/O) pathway */ - if ((io_info->io_ops.single_write)(io_info, type_info, nelmts, file_space, mem_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "contiguous write failed") + if ((dinfo->io_ops.single_write)(io_info, dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "contiguous write failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -747,13 +926,10 @@ H5D__contig_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsiz * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, September 28, 2000 - * *------------------------------------------------------------------------- */ static herr_t -H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset, size_t size) +H5D__contig_write_one(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, hsize_t offset, size_t size) { hsize_t dset_off = offset; /* Offset in dataset */ size_t dset_len = size; /* Length in dataset */ @@ -765,11 +941,11 @@ H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset, size_t size) FUNC_ENTER_PACKAGE - HDassert(io_info); + assert(io_info); - if (H5D__contig_writevv(io_info, (size_t)1, &dset_curr_seq, &dset_len, &dset_off, (size_t)1, + if (H5D__contig_writevv(io_info, dset_info, (size_t)1, &dset_curr_seq, &dset_len, &dset_off, (size_t)1, &mem_curr_seq, &mem_len, &mem_off) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -782,9 +958,6 @@ H5D__contig_write_one(H5D_io_info_t *io_info, hsize_t offset, size_t size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, Sept 30, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -826,19 +999,19 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void * /* Check if we can actually hold the I/O request in the sieve buffer */ if (len > dset_contig->sieve_buf_size) { if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed"); } /* end if */ else { /* Allocate room for the data sieve buffer */ if (NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Determine the new sieve buffer size & location */ dset_contig->sieve_loc = addr; /* Make certain we don't read off the end of the file */ if (HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size"); /* Set up the buffer parameters */ max_data = store_contig->dset_size - dst_off; @@ -850,7 +1023,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void * /* Read the new sieve buffer */ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed"); /* Grab the data out of the buffer (must be first piece of data in buffer ) */ H5MM_memcpy(buf, dset_contig->sieve_buf, len); @@ -882,7 +1055,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void * /* Write to file */ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed"); /* Reset sieve buffer dirty flag */ dset_contig->sieve_dirty = FALSE; @@ -891,7 +1064,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void * /* Read directly into the user's buffer */ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed"); } /* end if */ /* Element size fits within the buffer size */ else { @@ -900,7 +1073,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void * /* Write to file */ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed"); /* Reset sieve buffer dirty flag */ dset_contig->sieve_dirty = FALSE; @@ -911,7 +1084,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void * /* Make certain we don't read off the end of the file */ if (HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size"); /* Only need this when resizing sieve buffer */ max_data = store_contig->dset_size - dst_off; @@ -927,7 +1100,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void * /* Read the new sieve buffer */ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed"); /* Grab the data out of the buffer (must be first piece of data in buffer ) */ H5MM_memcpy(buf, dset_contig->sieve_buf, len); @@ -949,9 +1122,6 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, Sept 30, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -965,7 +1135,7 @@ H5D__contig_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata /* Write data */ if (H5F_shared_block_read(udata->f_sh, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len, (udata->rbuf + src_off)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -981,31 +1151,29 @@ H5D__contig_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, May 3, 2001 - * * Notes: * Offsets in the sequences must be monotonically increasing * *------------------------------------------------------------------------- */ static ssize_t -H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, - size_t mem_len_arr[], hsize_t mem_off_arr[]) +H5D__contig_readvv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, size_t dset_max_nseq, + size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, + size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(io_info); - HDassert(dset_curr_seq); - HDassert(dset_len_arr); - HDassert(dset_off_arr); - HDassert(mem_curr_seq); - HDassert(mem_len_arr); - HDassert(mem_off_arr); + assert(io_info); + assert(dset_info); + assert(dset_curr_seq); + assert(dset_len_arr); + assert(dset_off_arr); + assert(mem_curr_seq); + assert(mem_len_arr); + assert(mem_off_arr); /* Check if data sieving is enabled */ if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_DATA_SIEVE)) { @@ -1013,29 +1181,29 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *d /* Set up user data for H5VM_opvv() */ udata.f_sh = io_info->f_sh; - udata.dset_contig = &(io_info->dset->shared->cache.contig); - udata.store_contig = &(io_info->store->contig); - udata.rbuf = (unsigned char *)io_info->u.rbuf; + udata.dset_contig = &(dset_info->dset->shared->cache.contig); + udata.store_contig = &(dset_info->store->contig); + udata.rbuf = (unsigned char *)dset_info->buf.vp; /* Call generic sequence operation routine */ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_readvv_sieve_cb, &udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized sieve buffer read") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized sieve buffer read"); } /* end if */ else { H5D_contig_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ /* Set up user data for H5VM_opvv() */ udata.f_sh = io_info->f_sh; - udata.dset_addr = io_info->store->contig.dset_addr; - udata.rbuf = (unsigned char *)io_info->u.rbuf; + udata.dset_addr = dset_info->store->contig.dset_addr; + udata.rbuf = (unsigned char *)dset_info->buf.vp; /* Call generic sequence operation routine */ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_readvv_cb, &udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized read") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized read"); } /* end else */ done: @@ -1049,9 +1217,6 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *d * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, Sept 30, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1093,23 +1258,23 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void /* Check if we can actually hold the I/O request in the sieve buffer */ if (len > dset_contig->sieve_buf_size) { if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed"); } /* end if */ else { /* Allocate room for the data sieve buffer */ if (NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Clear memory */ if (dset_contig->sieve_size > len) - HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len)); + memset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len)); /* Determine the new sieve buffer size & location */ dset_contig->sieve_loc = addr; /* Make certain we don't read off the end of the file */ if (HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size"); /* Set up the buffer parameters */ max_data = store_contig->dset_size - dst_off; @@ -1123,7 +1288,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void /* Read the new sieve buffer */ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed"); } /* end if */ /* Grab the data out of the buffer (must be first piece of data in buffer ) */ @@ -1164,7 +1329,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void /* Write to file */ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed"); /* Reset sieve buffer dirty flag */ dset_contig->sieve_dirty = FALSE; @@ -1177,7 +1342,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void /* Write directly from the user's buffer */ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, addr, len, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed"); } /* end if */ /* Element size fits within the buffer size */ else { @@ -1187,8 +1352,8 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void /* Prepend to existing sieve buffer */ if ((addr + len) == sieve_start) { /* Move existing sieve information to correct location */ - HDmemmove(dset_contig->sieve_buf + len, dset_contig->sieve_buf, - dset_contig->sieve_size); + memmove(dset_contig->sieve_buf + len, dset_contig->sieve_buf, + dset_contig->sieve_size); /* Copy in new information (must be first in sieve buffer) */ H5MM_memcpy(dset_contig->sieve_buf, buf, len); @@ -1213,7 +1378,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void /* Write to file */ if (H5F_shared_block_write(f_sh, H5FD_MEM_DRAW, sieve_start, sieve_size, dset_contig->sieve_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed"); /* Reset sieve buffer dirty flag */ dset_contig->sieve_dirty = FALSE; @@ -1224,7 +1389,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void /* Make certain we don't read off the end of the file */ if (HADDR_UNDEF == (rel_eoa = H5F_shared_get_eoa(f_sh, H5FD_MEM_DRAW))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine file size"); /* Only need this when resizing sieve buffer */ max_data = store_contig->dset_size - dst_off; @@ -1242,7 +1407,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void /* Read the new sieve buffer */ if (H5F_shared_block_read(f_sh, H5FD_MEM_DRAW, dset_contig->sieve_loc, dset_contig->sieve_size, dset_contig->sieve_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed"); } /* end if */ /* Grab the data out of the buffer (must be first piece of data in buffer ) */ @@ -1266,9 +1431,6 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, void * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, Sept 30, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1283,7 +1445,7 @@ H5D__contig_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udat /* Write data */ if (H5F_shared_block_write(udata->f_sh, H5FD_MEM_DRAW, (udata->dset_addr + dst_off), len, (udata->wbuf + src_off)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "block write failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1299,31 +1461,29 @@ H5D__contig_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udat * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, May 2, 2003 - * * Notes: * Offsets in the sequences must be monotonically increasing * *------------------------------------------------------------------------- */ static ssize_t -H5D__contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, - size_t mem_len_arr[], hsize_t mem_off_arr[]) +H5D__contig_writevv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, size_t dset_max_nseq, + size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, + size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { ssize_t ret_value = -1; /* Return value (Size of sequence in bytes) */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(io_info); - HDassert(dset_curr_seq); - HDassert(dset_len_arr); - HDassert(dset_off_arr); - HDassert(mem_curr_seq); - HDassert(mem_len_arr); - HDassert(mem_off_arr); + assert(io_info); + assert(dset_info); + assert(dset_curr_seq); + assert(dset_len_arr); + assert(dset_off_arr); + assert(mem_curr_seq); + assert(mem_len_arr); + assert(mem_off_arr); /* Check if data sieving is enabled */ if (H5F_SHARED_HAS_FEATURE(io_info->f_sh, H5FD_FEAT_DATA_SIEVE)) { @@ -1331,29 +1491,29 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t * /* Set up user data for H5VM_opvv() */ udata.f_sh = io_info->f_sh; - udata.dset_contig = &(io_info->dset->shared->cache.contig); - udata.store_contig = &(io_info->store->contig); - udata.wbuf = (const unsigned char *)io_info->u.wbuf; + udata.dset_contig = &(dset_info->dset->shared->cache.contig); + udata.store_contig = &(dset_info->store->contig); + udata.wbuf = (const unsigned char *)dset_info->buf.cvp; /* Call generic sequence operation routine */ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_writevv_sieve_cb, &udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized sieve buffer write") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized sieve buffer write"); } /* end if */ else { H5D_contig_writevv_ud_t udata; /* User data for H5VM_opvv() operator */ /* Set up user data for H5VM_opvv() */ udata.f_sh = io_info->f_sh; - udata.dset_addr = io_info->store->contig.dset_addr; - udata.wbuf = (const unsigned char *)io_info->u.wbuf; + udata.dset_addr = dset_info->store->contig.dset_addr; + udata.wbuf = (const unsigned char *)dset_info->buf.cvp; /* Call generic sequence operation routine */ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__contig_writevv_cb, &udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized read") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized read"); } /* end else */ done: @@ -1367,9 +1527,6 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1380,16 +1537,45 @@ H5D__contig_flush(H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); + assert(dset); /* Flush any data in sieve buffer */ if (H5D__flush_sieve_buf(dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush sieve buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush sieve buffer"); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__contig_flush() */ +/*------------------------------------------------------------------------- + * Function: H5D__contig_io_term + * + * Purpose: Destroy I/O operation information. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__contig_io_term(H5D_io_info_t H5_ATTR_UNUSED *io_info, H5D_dset_io_info_t *di) +{ + herr_t ret_value = SUCCEED; /*return value */ + + FUNC_ENTER_PACKAGE + + assert(di); + + /* Free piece info */ + if (di->layout_io_info.contig_piece_info) { + if (H5D__free_piece_info(di->layout_io_info.contig_piece_info, NULL, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't free piece info"); + di->layout_io_info.contig_piece_info = NULL; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__contig_io_term() */ + /*------------------------------------------------------------------------- * Function: H5D__contig_copy * @@ -1397,9 +1583,6 @@ H5D__contig_flush(H5D_t *dset) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Monday, November 21, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1442,15 +1625,15 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f_src); - HDassert(storage_src); - HDassert(f_dst); - HDassert(storage_dst); - HDassert(dt_src); + assert(f_src); + assert(storage_src); + assert(f_dst); + assert(storage_dst); + assert(dt_src); /* Allocate space for destination raw data */ if (H5D__contig_alloc(f_dst, storage_dst) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to allocate contiguous storage") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to allocate contiguous storage"); /* Set up number of bytes to copy, and initial buffer size */ /* (actually use the destination size, which has been fixed up, if necessary) */ @@ -1462,49 +1645,49 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f * but this ensures that the src datatype will be freed. */ if ((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register source file datatype"); /* If there's a VLEN source datatype, set up type conversion information */ if (H5T_detect_class(dt_src, H5T_VLEN, FALSE) > 0) { /* create a memory copy of the variable-length datatype */ if (NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy"); if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) { (void)H5T_close_real(dt_mem); - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register memory datatype"); } /* end if */ /* create variable-length datatype at the destination file */ if (NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy"); if (H5T_set_loc(dt_dst, H5F_VOL_OBJ(f_dst), H5T_LOC_DISK) < 0) { (void)H5T_close_real(dt_dst); - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "cannot mark datatype on disk"); } /* end if */ if ((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) { (void)H5T_close_real(dt_dst); - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype"); } /* end if */ /* Set up the conversion functions */ if (NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes"); if (NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes"); /* Determine largest datatype size */ if (0 == (src_dt_size = H5T_get_size(dt_src))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size"); if (0 == (mem_dt_size = H5T_get_size(dt_mem))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size"); max_dt_size = MAX(src_dt_size, mem_dt_size); if (0 == (dst_dt_size = H5T_get_size(dt_dst))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size"); max_dt_size = MAX(max_dt_size, dst_dt_size); /* Set maximum number of whole elements that fit in buffer */ if (0 == (nelmts = buf_size / max_dt_size)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "element size too large"); /* Set the number of bytes to transfer */ src_nbytes = nelmts * src_dt_size; @@ -1519,12 +1702,12 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f /* Create the space and set the initial extent */ if (NULL == (buf_space = H5S_create_simple((unsigned)1, buf_dim, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); /* Register */ if ((buf_sid = H5I_register(H5I_DATASPACE, buf_space, FALSE)) < 0) { H5S_close(buf_space); - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); } /* end if */ /* Set flag to do type conversion */ @@ -1543,18 +1726,18 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f } /* end else */ /* Allocate space for copy buffer */ - HDassert(buf_size); + assert(buf_size); if (NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer"); /* Need extra buffer for datatype conversions, to prevent stranding/leaking memory */ if (is_vlen || fix_ref) { if (NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer"); /* allocate temporary bkg buff for data conversion */ if (NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer"); } /* end if */ /* Loop over copying data */ @@ -1587,7 +1770,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f /* Adjust size of buffer's dataspace */ if (H5S_set_extent_real(buf_space, buf_dim) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to change buffer dataspace size") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to change buffer dataspace size"); } /* end if */ else /* Adjust destination & memory bytes to transfer */ @@ -1603,46 +1786,46 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f else /* Read raw data from source file */ if (H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data"); /* Perform datatype conversion, if necessary */ if (is_vlen) { /* Convert from source file to memory */ if (H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); /* Copy into another buffer, to reclaim memory later */ H5MM_memcpy(reclaim_buf, buf, mem_nbytes); /* Set background buffer to all zeros */ - HDmemset(bkg, 0, buf_size); + memset(bkg, 0, buf_size); /* Convert from memory to destination file */ if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); /* Reclaim space from variable length data */ if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data") + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data"); } /* end if */ else if (fix_ref) { /* Check for expanding references */ if (cpy_info->expand_ref) { /* Copy the reference elements */ if (H5O_copy_expand_ref(f_src, tid_src, dt_src, buf, buf_size, f_dst, bkg, cpy_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute"); /* After fix ref, copy the new reference elements to the buffer to write out */ H5MM_memcpy(buf, bkg, buf_size); } /* end if */ else /* Reset value to zero */ - HDmemset(buf, 0, src_nbytes); + memset(buf, 0, src_nbytes); } /* end if */ /* Write raw data to destination file */ if (H5F_block_write(f_dst, H5FD_MEM_DRAW, addr_dst, dst_nbytes, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data"); /* Adjust loop variables */ addr_src += src_nbytes; @@ -1652,13 +1835,13 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, H5F_t *f done: if (buf_sid > 0 && H5I_dec_ref(buf_sid) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't decrement temporary dataspace ID"); if (tid_src > 0 && H5I_dec_ref(tid_src) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (tid_dst > 0 && H5I_dec_ref(tid_dst) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (tid_mem > 0 && H5I_dec_ref(tid_mem) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (buf) buf = H5FL_BLK_FREE(type_conv, buf); if (reclaim_buf) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5DcreatProp.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5DcreatProp.cpp deleted file mode 100644 index 97c6ddbbfc..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5DcreatProp.cpp +++ /dev/null @@ -1,799 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5DataSpace.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control -// the order of creation and deletion of the global constants. See Design Notes -// in "H5PredType.cpp" for information. - -// Initialize a pointer for the constant -DSetCreatPropList *DSetCreatPropList::DEFAULT_ = 0; - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getConstant -// Purpose: Creates a DSetCreatPropList object representing the HDF5 -// constant H5P_DATASET_CREATE, pointed to by -// DSetCreatPropList::DEFAULT_ -// exception H5::PropListIException -// Description -// If DSetCreatPropList::DEFAULT_ already points to an allocated -// object, throw a PropListIException. This scenario should -// not happen. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -DSetCreatPropList * -DSetCreatPropList::getConstant() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the constant pointer is not allocated, allocate it. Otherwise, - // throw because it shouldn't be. - if (DEFAULT_ == 0) - DEFAULT_ = new DSetCreatPropList(H5P_DATASET_CREATE); - else - throw PropListIException("DSetCreatPropList::getConstant", - "DSetCreatPropList::getConstant is being invoked on an allocated DEFAULT_"); - return (DEFAULT_); -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::deleteConstants -// Purpose: Deletes the constant object that DSetCreatPropList::DEFAULT_ -// points to. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::deleteConstants() -{ - delete DEFAULT_; -} - -//-------------------------------------------------------------------------- -// Purpose Constant for dataset creation default property -//-------------------------------------------------------------------------- -const DSetCreatPropList &DSetCreatPropList::DEFAULT = *getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList default constructor -///\brief Default constructor: creates a stub dataset creation property list -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) -{ -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList copy constructor -///\brief Copy constructor: same HDF5 object as \a original -/// DSetCreatPropList object -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList &orig) : ObjCreatPropList(orig) -{ -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList overloaded constructor -///\brief Creates a DSetCreatPropList object using the id of an -/// existing dataset creation property list. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : ObjCreatPropList(plist_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setChunk -///\brief Sets the size of the chunks used to store a chunked layout -/// dataset. -///\param ndims - IN: Number of dimensions of each chunk -///\param dim - IN: Array containing the size of each chunk -///\exception H5::PropListIException -///\par Description -/// The \a ndims parameter currently must have the same value as -/// the rank of the dataset. The values of the \a dim array -/// define the size of the chunks to store the dataset's raw -/// data. As a side-effect, the layout of the dataset will be -/// changed to \c H5D_CHUNKED, if it is not so already. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setChunk(int ndims, const hsize_t *dim) const -{ - herr_t ret_value = H5Pset_chunk(id, ndims, dim); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setChunk", "H5Pset_chunk failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getChunk -///\brief Retrieves the size of the chunks used to store a chunked -/// layout dataset. -///\param max_ndims - IN: Size of \a dim array -///\param dim - OUT: Array to store the chunk dimensions -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -DSetCreatPropList::getChunk(int max_ndims, hsize_t *dim) const -{ - int chunk_size = H5Pget_chunk(id, max_ndims, dim); - if (chunk_size < 0) { - throw PropListIException("DSetCreatPropList::getChunk", "H5Pget_chunk returns negative chunk size"); - } - return (chunk_size); -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setLayout -///\brief Sets the type of storage used store the raw data for a dataset. -///\param layout - IN: Type of storage layout for raw data -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_layout API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setLayout(H5D_layout_t layout) const -{ - herr_t ret_value = H5Pset_layout(id, layout); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setLayout", "H5Pset_layout failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getLayout -///\brief Retrieves the layout type of this property list -///\return Layout type, which can be: -/// \li \c H5D_COMPACT - raw data is stored in the object -/// header in the file. -/// \li \c H5D_CONTIGUOUS - raw data is stored separately from the -/// object header in one contiguous chunk in -/// the file. -/// \li \c H5D_CHUNKED - raw data is stored separately from the -/// object header in chunks in separate locations -/// in the file. -///\exception H5::PropListIException -///\par Description -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5D_layout_t -DSetCreatPropList::getLayout() const -{ - H5D_layout_t layout = H5Pget_layout(id); - if (layout == H5D_LAYOUT_ERROR) { - throw PropListIException("DSetCreatPropList::getLayout", "H5Pget_layout returns H5D_LAYOUT_ERROR"); - } - return layout; -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setDeflate -///\brief Sets compression method and compression level -///\param level - IN: Compression level, should [0..9], inclusive -///\exception H5::PropListIException -///\par Description -/// The function sets the compression method for this property -/// list to \c H5D_COMPRESS_DEFLATE and the compression level to -/// \a level. Lower compression levels are faster but result in -/// less compression. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setDeflate(int level) const -{ - if (level < 0) { - throw PropListIException("DSetCreatPropList::setDeflate", "level can't be negative"); - } - - herr_t ret_value = H5Pset_deflate(id, static_cast(level)); - - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setDeflate", "H5Pset_deflate failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setSzip -///\brief Sets up for the use of the SZIP compression filter. -///\param options_mask - IN: A bit-mask conveying the desired SZIP -/// options. Valid values are H5_SZIP_EC_OPTION_MASK -/// and H5_SZIP_NN_OPTION_MASK. -///\param pixels_per_block - IN: Number of pixels or data elements in -/// each data block. -///\exception H5::PropListIException -///\par Description -/// The associate C function sets an SZIP compression filter, -/// H5Z_FILTER_SZIP, for a dataset. For more information about -/// SZIP and usage, please refer to the H5Pset_szip API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - Jan, 2007 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_block) const -{ - herr_t ret_value = H5Pset_szip(id, options_mask, pixels_per_block); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setSzip", "H5Pset_szip failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setNbit -///\brief Sets up for the use of the Nbit compression filter. -///\exception H5::PropListIException -/// -///\par Description -/// The associate C function sets an Nbit compression filter, -/// H5Z_FILTER_NBIT, for a dataset. For more information about -/// Nbit compression, please refer to the H5Pset_nbit API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - Apr, 2016 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setNbit() const -{ - herr_t ret_value = H5Pset_nbit(id); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setNbit", "H5Pset_nbit failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setFillValue -///\brief Sets a dataset fill value -///\param fvalue_type - IN: Data type for the value passed via \a value -///\param value - IN: Pointer to buffer containing the fill value -///\exception H5::PropListIException -///\par Description -/// The datatype may differ from that of the dataset, but it must -/// be one that the HDF5 library is able to convert \a value to -/// the dataset datatype when the dataset is created. -/// The default fill value is 0 (zero,) which is interpreted -/// according to the actual dataset datatype. -///\par -/// For information on setting fill value, please refer to the -/// H5Pset_fill_value API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setFillValue(const DataType &fvalue_type, const void *value) const -{ - herr_t ret_value = H5Pset_fill_value(id, fvalue_type.getId(), value); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setFillValue", "H5Pset_fill_value failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getFillValue -///\brief Retrieves a dataset fill value -///\param fvalue_type - IN: Data type for the value passed via \a value -///\param value - OUT: Pointer to buffer to hold the retrieved fill value -///\exception H5::PropListIException -///\par Description -/// The fill value is returned through \a value pointer -/// and the memory is allocated by the caller. The fill -/// value will be converted from its current data type to the -/// specified by \a fvalue_type. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::getFillValue(const DataType &fvalue_type, void *value) const -{ - herr_t ret_value = H5Pget_fill_value(id, fvalue_type.getId(), value); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::getFillValue", "H5Pget_fill_value failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::isFillValueDefined -///\brief Check if fill value has been defined for this property -///\return -/// \li \c H5D_FILL_VALUE_UNDEFINED =0, -/// \li \c H5D_FILL_VALUE_DEFAULT =1, -/// \li \c H5D_FILL_VALUE_USER_DEFINED =2 -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5D_fill_value_t -DSetCreatPropList::isFillValueDefined() const -{ - H5D_fill_value_t status; - herr_t ret_value = H5Pfill_value_defined(id, &status); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::isFillValueDefined", - "H5Pfill_value_defined returned H5D_FILL_VALUE_ERROR (-1)"); - } - else - return (status); -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setFilter -///\brief Adds a filter to the filter pipeline -///\param filter_id - IN: Filter to add -///\param flags - IN: Specifies general properties of the filter -///\param cd_nelmts - IN: Number of elements in cd_values -///\param cd_values - IN: Auxiliary data for the filter -///\exception H5::PropListIException -///\par Description -/// The \a flags argument is a bit vector of the field: -/// \c H5Z_FLAG_OPTIONAL(0x0001) -///\par -/// If this bit is set then the filter is optional. If the filter -/// fails during a \c DataSet::write() operation then the filter -/// is just excluded from the pipeline for the chunk for which it -/// failed; the filter will not participate in the pipeline -/// during a \c DataSet::read() of the chunk. If this bit is clear -/// and the filter fails then the entire I/O operation fails. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, - const unsigned int cd_values[]) const -{ - herr_t ret_value = H5Pset_filter(id, filter_id, flags, cd_nelmts, cd_values); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setFilter", "H5Pset_filter failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::removeFilter -///\brief Removes one or more filters -///\param filter_id - IN: Filter to remove -///\exception H5::PropListIException -///\par Description -/// Deletes a filter from the dataset creation property list; -/// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const -{ - herr_t ret_value = H5Premove_filter(id, filter_id); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::removeFilter", "H5Premove_filter failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getNfilters -///\brief Returns the number of filters in the pipeline -///\return Number of filters -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -DSetCreatPropList::getNfilters() const -{ - int num_filters = H5Pget_nfilters(id); - if (num_filters < 0) { - throw PropListIException("DSetCreatPropList::getNfilters", - "H5Pget_nfilters returned negative number of filters"); - } - else - return (num_filters); -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getFilter -///\brief Returns information about a filter in a pipeline -///\param filter_number - IN: Filter to get, range [0..N-1], where -/// N is returned by H5Pget_nfilters() -///\param flags - OUT: General properties of the filter -///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number -/// of values defined by the filter -///\param cd_values - OUT: Array to hold the data; allocated by the user -///\param namelen - IN: Length of \a name -///\param name - OUT: Name of the filter -///\param filter_config - OUT: Flags indicating whether filter can encode/decode -///\return Filter id -///\exception H5::PropListIException -///\par Description -/// Failure occurs when \a filter_number is out of range. -// Note: the first argument was mistakenly typed as int instead -// of unsigned int, but for backward compatibility, it cannot be -// changed. -BMR (2014/04/15) -//-------------------------------------------------------------------------- -H5Z_filter_t -DSetCreatPropList::getFilter(int filter_number, unsigned int &flags, size_t &cd_nelmts, - unsigned int *cd_values, size_t namelen, char name[], - unsigned int &filter_config) const -{ - if (filter_number < 0) - throw PropListIException("DSetCreatPropList::getFilter", "filter_number can't be negative"); - - H5Z_filter_t filter_id = H5Pget_filter2(id, static_cast(filter_number), &flags, &cd_nelmts, - cd_values, namelen, name, &filter_config); - if (filter_id == H5Z_FILTER_ERROR) - throw PropListIException("DSetCreatPropList::getFilter", "H5Pget_filter2 returned H5Z_FILTER_ERROR"); - else - return filter_id; -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getFilterById -///\brief Returns information about a filter in a pipeline given the -/// filter id -///\param filter_id - IN: Filter to get -///\param flags - OUT: General properties of the filter -///\param cd_nelmts - IN/OUT: Number of elements in \a cd_values /Number -/// of values defined by the filter -///\param cd_values - OUT: Array to hold the data; allocated by the user -///\param namelen - IN: Length of \a name -///\param name - OUT: Name of the filter -///\param filter_config - OUT: Flags indicating whether filter can encode/decode -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, - unsigned int *cd_values, size_t namelen, char name[], - unsigned int &filter_config) const -{ - herr_t ret_value = - H5Pget_filter_by_id2(id, filter_id, &flags, &cd_nelmts, cd_values, namelen, name, &filter_config); - if (ret_value < 0) - throw PropListIException("DSetCreatPropList::getFilterById", "H5Pget_filter_by_id2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::modifyFilter -///\brief Modifies the specified filter -///\param filter_id - IN: Filter to get -///\param flags - OUT: General properties of the filter -///\param cd_nelmts - IN: Number of elements in \a cd_values -/// \n OUT: Number of values defined by the filter -///\param cd_values - OUT: Array to hold the data; allocated by the user -///\exception H5::PropListIException -///\par Description -/// The \a flags argument is a bit vector of the field: -/// \c H5Z_FLAG_OPTIONAL(0x0001) -///\par -/// If this bit is set then the filter is optional. If the filter -/// fails during a DataSet::write() operation then the filter -/// is just excluded from the pipeline for the chunk for which it -/// failed; the filter will not participate in the pipeline -/// during a DataSet::read() of the chunk. If this bit is clear -/// and the filter fails then the entire I/O operation fails. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, - const unsigned int cd_values[]) const -{ - herr_t ret_value = H5Pmodify_filter(id, filter_id, flags, cd_nelmts, cd_values); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::modifyFilter", "H5Pmodify_filter failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::allFiltersAvail -///\brief Queries whether all the filters set in this property list -/// are available currently. -///\return true if all filters available, and false if one or more -/// filters not currently available -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -bool -DSetCreatPropList::allFiltersAvail() const -{ - htri_t ret_value = H5Pall_filters_avail(id); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else // Raise exception when H5Pall_filters_avail returns a negative value - { - throw PropListIException("DSetCreatPropList::allFiltersAvail", - "H5Pall_filters_avail returned negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setShuffle -///\brief Sets method of the shuffle filter -/// -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_shuffle API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setShuffle() const -{ - herr_t ret_value = H5Pset_shuffle(id); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setShuffle", "H5Pset_shuffle failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getAllocTime -///\brief Get space allocation time for this property. -///\return Space allocation time. -///\exception H5::PropListIException -///\par Description -/// The values of space allocation time can be one of the -/// following: -/// \li \c H5D_ALLOC_TIME_DEFAULT -/// \li \c H5D_ALLOC_TIME_EARLY -/// \li \c H5D_ALLOC_TIME_LATE -/// \li \c H5D_ALLOC_TIME_INCR -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5D_alloc_time_t -DSetCreatPropList::getAllocTime() const -{ - H5D_alloc_time_t alloc_time; - herr_t ret_value = H5Pget_alloc_time(id, &alloc_time); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::getAllocTime", "H5Pget_alloc_time failed"); - } - else - return (alloc_time); -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getFillTime -///\brief Gets fill value writing time. -///\return Fill value writing time -///\exception H5::PropListIException -///\par Description -/// Valid values for fill value writing time include -/// \li \c H5D_FILL_TIME_NEVER -/// \li \c H5D_FILL_TIME_ALLOC. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5D_fill_time_t -DSetCreatPropList::getFillTime() const -{ - H5D_fill_time_t fill_time; - herr_t ret_value = H5Pget_fill_time(id, &fill_time); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::getFillTime", "H5Pget_fill_time failed"); - } - else - return (fill_time); -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setAllocTime -///\brief Sets space allocation time for dataset during creation. -///\param alloc_time - IN: Allocation time -///\exception H5::PropListIException -///\par Description -/// Valid values for space allocation time include: -/// \li \c H5D_ALLOC_TIME_DEFAULT -/// \li \c H5D_ALLOC_TIME_EARLY -/// \li \c H5D_ALLOC_TIME_LATE -/// \li \c H5D_ALLOC_TIME_INCR -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const -{ - herr_t ret_value = H5Pset_alloc_time(id, alloc_time); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setAllocTime", "H5Pset_alloc_time failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setFillTime -///\brief Sets fill value writing time for dataset. -///\return Fill value writing time -///\exception H5::PropListIException -///\par Description -/// Valid values for fill value writing time include -/// \li \c H5D_FILL_TIME_NEVER -/// \li \c H5D_FILL_TIME_ALLOC. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const -{ - herr_t ret_value = H5Pset_fill_time(id, fill_time); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setFillTime", "H5Pset_fill_time failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setFletcher32 -///\brief Sets Fletcher32 checksum of EDC for this property list. -/// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setFletcher32() const -{ - herr_t ret_value = H5Pset_fletcher32(id); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setFletcher32", "H5Pset_fletcher32 failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setExternal -///\brief Adds an external file to the list of external files -///\param name - IN: Name of the external file -///\param offset - IN: Location where the data starts in the file -///\param size - IN: Number of bytes reserved in the file for the data -///\exception H5::PropListIException -///\par Description -/// If a dataset is split across multiple files then the files -/// should be defined in order. The total size of the dataset is -/// the sum of the \a size arguments for all the external files. If -/// the total size is larger than the size of a dataset then the -/// dataset can be extended (provided the data space also allows -/// the extending). -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setExternal(const char *name, off_t offset, hsize_t size) const -{ - herr_t ret_value = H5Pset_external(id, name, offset, size); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setExternal", "H5Pset_external failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getExternalCount -///\brief Returns the number of external files for a dataset -///\return Number of external files -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -DSetCreatPropList::getExternalCount() const -{ - int num_ext_files = H5Pget_external_count(id); - if (num_ext_files < 0) { - throw PropListIException("DSetCreatPropList::getExternalCount", - "H5Pget_external_count returns negative number of external files"); - } - else - return (num_ext_files); -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::getExternal -///\brief Returns information about an external file -///\param idx - IN: Index of the external file, ranges [0-(N-1)] and -/// returned by getExternalCount() -///\param name_size - IN: Maximum length of \a name -///\param name - OUT: Name of the external file -///\param offset - OUT: Location to return an offset value -///\param size - OUT: Location to return the size of the external file data -///\exception H5::PropListIException -///\par Description -/// The parameter \a idx ranges [0..N-1] where N is returned by -/// getExternalCount(). At most \a name_size characters are copied -/// into the name array. If the external file name is longer than -/// name_size with the null terminator, the return value is not -/// null terminated (similar to strncpy()). -/// If \a name_size is zero or \a name is a null pointer, the -/// external file name will not be returned. If \a offset or -/// \a size are null pointers then the corresponding information -/// will not be returned. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, off_t &offset, hsize_t &size) const -{ - herr_t ret_value = H5Pget_external(id, idx, name_size, name, &offset, &size); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::getExternal", "H5Pget_external failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setVirtual -///\brief Maps elements of a virtual dataset to elements of the source -/// dataset. -///\param vspace - IN: Dataspace the virtual dataset, possibly an -/// unlimited selection -///\param src_fname - IN: Name of the HDF5 file where the source dataset -/// is located (\a char*) -///\param src_dsname - IN: Path to the dataset in the file specified by -/// \a src_file_name (\a char*) -///\param sspace - IN: Dataspace with a selection applied, possibly -/// an unlimited selection -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_virtual API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - Mar, 2017 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setVirtual(const DataSpace &vspace, const char *src_fname, const char *src_dsname, - const DataSpace &sspace) const -{ - herr_t ret_value = H5Pset_virtual(id, vspace.getId(), src_fname, src_dsname, sspace.getId()); - if (ret_value < 0) { - throw PropListIException("DSetCreatPropList::setVirtual", "H5Pset_virtual failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList::setVirtual -///\brief Maps elements of a virtual dataset to elements of the source -/// dataset. -///\param vspace - IN: Dataspace the virtual dataset, possibly an -/// unlimited selection -///\param src_fname - IN: Name of the HDF5 file where the source dataset -/// is located (\a H5std_string) -///\param src_dsname - IN: Path to the dataset in the file specified by -/// \a src_file_name (\a H5std_string) -///\param sspace - IN: Dataspace with a selection applied, possibly -/// an unlimited selection -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_virtual API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - Mar, 2017 -//-------------------------------------------------------------------------- -void -DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string src_fname, - const H5std_string src_dsname, const DataSpace &sspace) const -{ - setVirtual(vspace, src_fname.c_str(), src_dsname.c_str(), sspace); -} - -//-------------------------------------------------------------------------- -// Function: DSetCreatPropList destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetCreatPropList::~DSetCreatPropList() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ddbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ddbg.c index d39d357f41..22777b434c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ddbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ddbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -72,14 +71,13 @@ H5Ddebug(hid_t dset_id) /* Check args */ if (NULL == (dset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); /* Print B-tree information */ if (H5D_CHUNKED == dset->shared->layout.type) (void)H5D__chunk_dump_index(dset, stdout); else if (H5D_CONTIGUOUS == dset->shared->layout.type) - HDfprintf(stdout, " %-10s %" PRIuHADDR "\n", - "Address:", dset->shared->layout.storage.u.contig.addr); + fprintf(stdout, " %-10s %" PRIuHADDR "\n", "Address:", dset->shared->layout.storage.u.contig.addr); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ddeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ddeprec.c new file mode 100644 index 0000000000..d8c19c0e30 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ddeprec.c @@ -0,0 +1,339 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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: H5Ddeprec.c + * + * Purpose: Deprecated functions from the H5D interface. These + * functions are here for compatibility purposes and may be + * removed in the future. Applications should switch to the + * newer APIs. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5VLprivate.h" /* Virtual Object Layer */ + +/****************/ +/* Local Macros */ +/****************/ + +/******************/ +/* Local Typedefs */ +/******************/ + +/********************/ +/* Package Typedefs */ +/********************/ + +/********************/ +/* Local Prototypes */ +/********************/ + +/*********************/ +/* Package Variables */ +/*********************/ + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/*******************/ +/* Local Variables */ +/*******************/ + +#ifndef H5_NO_DEPRECATED_SYMBOLS + +/*------------------------------------------------------------------------- + * Function: H5Dcreate1 + * + * Purpose: Creates a new dataset named NAME at LOC_ID, opens the + * dataset for access, and associates with that dataset constant + * and initial persistent properties including the type of each + * datapoint as stored in the file (TYPE_ID), the size of the + * dataset (SPACE_ID), and other initial miscellaneous + * properties (DCPL_ID). + * + * All arguments are copied into the dataset, so the caller is + * allowed to derive new types, data spaces, and creation + * parameters from the old ones and reuse them in calls to + * create other datasets. + * + * Return: Success: The object ID of the new dataset. At this + * point, the dataset is ready to receive its + * raw data. Attempting to read raw data from + * the dataset will probably return the fill + * value. The dataset should be closed when + * the caller is no longer interested in it. + * + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, hid_t dcpl_id) +{ + void *dset = NULL; /* dset object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE5("i", "i*siii", loc_id, name, type_id, space_id, dcpl_id); + + /* Check arguments */ + if (!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL"); + if (!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string"); + + /* Set up collective metadata if appropriate */ + if (H5CX_set_loc(loc_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read"); + + if (H5P_DEFAULT == dcpl_id) + dcpl_id = H5P_DATASET_CREATE_DEFAULT; + else if (TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not dataset create property list ID"); + + /* Set the DCPL for the API context */ + H5CX_set_dcpl(dcpl_id); + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); + + /* Create the dataset */ + if (NULL == (dset = H5VL_dataset_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, type_id, + space_id, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to create dataset"); + + /* Register the new dataset to get an ID for it */ + if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataset"); + +done: + if (H5I_INVALID_HID == ret_value) + if (dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset"); + + FUNC_LEAVE_API(ret_value) +} /* end H5Dcreate1() */ + +/*------------------------------------------------------------------------- + * Function: H5Dopen1 + * + * Purpose: Finds a dataset named NAME at LOC_ID, opens it, and returns + * its ID. The dataset should be close when the caller is no + * longer interested in it. + * + * Note: Deprecated in favor of H5Dopen2 + * + * Return: Success: A new dataset ID + * Failure: H5I_INVALID_HID + * + *------------------------------------------------------------------------- + */ +hid_t +H5Dopen1(hid_t loc_id, const char *name) +{ + void *dset = NULL; /* dset object from VOL connector */ + H5VL_object_t *vol_obj = NULL; /* object of loc_id */ + H5VL_loc_params_t loc_params; + hid_t ret_value = H5I_INVALID_HID; /* Return value */ + + FUNC_ENTER_API(H5I_INVALID_HID) + H5TRACE2("i", "i*s", loc_id, name); + + /* Check args */ + if (!name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL"); + if (!*name) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string"); + + /* Set location parameters */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(loc_id); + + /* get the location object */ + if (NULL == (vol_obj = H5VL_vol_object(loc_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); + + /* Open the dataset */ + if (NULL == (dset = H5VL_dataset_open(vol_obj, &loc_params, name, H5P_DATASET_ACCESS_DEFAULT, + H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open dataset"); + + /* Get an ID for the dataset */ + if ((ret_value = H5VL_register(H5I_DATASET, dset, vol_obj->connector, TRUE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register dataset ID"); + +done: + if (H5I_INVALID_HID == ret_value) + if (dset && H5VL_dataset_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release dataset"); + + FUNC_LEAVE_API(ret_value) +} /* end H5Dopen1() */ + +/*------------------------------------------------------------------------- + * Function: H5Dextend + * + * Purpose: This function makes sure that the dataset is at least of size + * SIZE. The dimensionality of SIZE is the same as the data + * space of the dataset being changed. + * + * Note: Deprecated in favor of H5Dset_extent + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dextend(hid_t dset_id, const hsize_t size[]) +{ + H5VL_object_t *vol_obj; /* Object for loc_id */ + H5VL_dataset_get_args_t vol_get_cb_args; /* Arguments to VOL callback */ + H5VL_dataset_specific_args_t vol_spec_cb_args; /* Arguments to VOL callback */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + H5S_t *ds = NULL; /* Dataspace struct */ + int ndims; /* Dataset/space rank */ + hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */ + int i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*h", dset_id, size); + + /* Check args */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier"); + if (!size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified"); + + /* Set up VOL callback arguments */ + vol_get_cb_args.op_type = H5VL_DATASET_GET_SPACE; + vol_get_cb_args.args.get_space.space_id = H5I_INVALID_HID; + + /* Get the dataspace pointer for the dataset */ + if (H5VL_dataset_get(vol_obj, &vol_get_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace"); + sid = vol_get_cb_args.args.get_space.space_id; + if (H5I_INVALID_HID == sid) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset"); + if (NULL == (ds = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get dataspace structure from ID"); + + /* Get the dataset's current extent */ + if (H5S_get_simple_extent_dims(ds, dset_dims, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions"); + + /* Get the dataset dimensions */ + ndims = H5S_GET_EXTENT_NDIMS(ds); + + /* Make certain that the dataset dimensions don't decrease in any dimension. + * + * (Shrinking dimensions is possible with H5Dset_extent, but not H5Dextend) + * + * XXX (VOL_MERGE): I feel like we should fail here instead of just silently + * not doing what we're supposed to do. + */ + for (i = 0; i < ndims; i++) + if (size[i] > dset_dims[i]) + dset_dims[i] = size[i]; + + /* Set up collective metadata if appropriate */ + if (H5CX_set_loc(dset_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info"); + + /* Set up VOL callback arguments */ + vol_spec_cb_args.op_type = H5VL_DATASET_SET_EXTENT; + vol_spec_cb_args.args.set_extent.size = dset_dims; + + /* Increase size */ + if (H5VL_dataset_specific(vol_obj, &vol_spec_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset"); + +done: + /* Close the dataspace */ + if (sid != H5I_INVALID_HID && H5I_dec_app_ref(sid) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close dataspace"); + + FUNC_LEAVE_API(ret_value) +} /* end H5Dextend() */ + +/*------------------------------------------------------------------------- + * Function: H5Dvlen_reclaim + * + * Purpose: Frees the buffers allocated for storing variable-length data + * in memory. Only frees the VL data in the selection defined in the + * dataspace. The dataset transfer property list is required to find the + * correct allocation/free methods for the VL data in the buffer. + * + * Return: Non-negative on success, negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf) +{ + H5S_t *space; /* Dataspace for iteration */ + herr_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "iii*x", type_id, space_id, dxpl_id, buf); + + /* Check args */ + if (H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument"); + if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace"); + if (!(H5S_has_extent(space))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set"); + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) + dxpl_id = H5P_DATASET_XFER_DEFAULT; + else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); + + /* Set DXPL for operation */ + H5CX_set_dxpl(dxpl_id); + + /* Call internal routine */ + ret_value = H5T_reclaim(type_id, space, buf); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Dvlen_reclaim() */ + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dearray.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dearray.c index ad7c347121..93535acb9c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dearray.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dearray.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,14 +10,11 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Tuesday, January 27, 2009 - * +/* * Purpose: Extensible array indexed (chunked) I/O functions. The chunks * are given a single-dimensional index which is used as the * offset in an extensible array that maps a chunk coordinate to * a disk address. - * */ /****************/ @@ -207,9 +203,6 @@ H5FL_DEFINE_STATIC(H5D_earray_ctx_ud_t); * Return: Success: non-NULL * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 - * *------------------------------------------------------------------------- */ static void * @@ -222,14 +215,14 @@ H5D__earray_crt_context(void *_udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(udata); - HDassert(udata->f); - HDassert(udata->chunk_size > 0); + assert(udata); + assert(udata->f); + assert(udata->chunk_size > 0); /* Allocate new context structure */ if (NULL == (ctx = H5FL_MALLOC(H5D_earray_ctx_t))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, - "can't allocate extensible array client callback context") + "can't allocate extensible array client callback context"); /* Initialize the context */ ctx->file_addr_len = H5F_SIZEOF_ADDR(udata->f); @@ -256,9 +249,6 @@ H5D__earray_crt_context(void *_udata) * Return: Success: non-NULL * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -269,7 +259,7 @@ H5D__earray_dst_context(void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(ctx); + assert(ctx); /* Release context structure */ ctx = H5FL_FREE(H5D_earray_ctx_t, ctx); @@ -285,9 +275,6 @@ H5D__earray_dst_context(void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, January 27, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -298,8 +285,8 @@ H5D__earray_fill(void *nat_blk, size_t nelmts) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(nat_blk); - HDassert(nelmts); + assert(nat_blk); + assert(nelmts); H5VM_array_fill(nat_blk, &fill_val, H5EA_CLS_CHUNK->nat_elmt_size, nelmts); @@ -314,9 +301,6 @@ H5D__earray_fill(void *nat_blk, size_t nelmts) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, January 27, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -328,10 +312,10 @@ H5D__earray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); - HDassert(ctx); + assert(raw); + assert(elmt); + assert(nelmts); + assert(ctx); /* Encode native elements into raw elements */ while (nelmts) { @@ -357,9 +341,6 @@ H5D__earray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -372,9 +353,9 @@ H5D__earray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); + assert(raw); + assert(elmt); + assert(nelmts); /* Decode raw elements into native elements */ while (nelmts) { @@ -400,9 +381,6 @@ H5D__earray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -413,12 +391,12 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(stream); - HDassert(elmt); + assert(stream); + assert(elmt); /* Print element */ HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__earray_debug() */ @@ -431,9 +409,6 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -444,9 +419,9 @@ H5D__earray_filt_fill(void *nat_blk, size_t nelmts) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(nat_blk); - HDassert(nelmts); - HDassert(sizeof(fill_val) == H5EA_CLS_FILT_CHUNK->nat_elmt_size); + assert(nat_blk); + assert(nelmts); + assert(sizeof(fill_val) == H5EA_CLS_FILT_CHUNK->nat_elmt_size); H5VM_array_fill(nat_blk, &fill_val, H5EA_CLS_FILT_CHUNK->nat_elmt_size, nelmts); @@ -461,9 +436,6 @@ H5D__earray_filt_fill(void *nat_blk, size_t nelmts) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -477,10 +449,10 @@ H5D__earray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); - HDassert(ctx); + assert(raw); + assert(elmt); + assert(nelmts); + assert(ctx); /* Encode native elements into raw elements */ while (nelmts) { @@ -508,9 +480,6 @@ H5D__earray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -524,9 +493,9 @@ H5D__earray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); + assert(raw); + assert(elmt); + assert(nelmts); /* Decode raw elements into native elements */ while (nelmts) { @@ -554,9 +523,6 @@ H5D__earray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -569,13 +535,13 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(stream); - HDassert(elmt); + assert(stream); + assert(elmt); /* Print element */ HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); - HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, - elmt->nbytes, elmt->filter_mask); + fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, + elmt->nbytes, elmt->filter_mask); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__earray_filt_debug() */ @@ -589,8 +555,6 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const * Return: Success: non-NULL * Failure: NULL * - * Programmer: Vailin Choi; July 2010 - * *------------------------------------------------------------------------- */ static void * @@ -605,13 +569,13 @@ H5D__earray_crt_dbg_context(H5F_t *f, haddr_t obj_addr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(H5F_addr_defined(obj_addr)); + assert(f); + assert(H5_addr_defined(obj_addr)); /* Allocate context for debugging callback */ if (NULL == (dbg_ctx = H5FL_MALLOC(H5D_earray_ctx_ud_t))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, - "can't allocate extensible array client callback context") + "can't allocate extensible array client callback context"); /* Set up the object header location info */ H5O_loc_reset(&obj_loc); @@ -620,16 +584,16 @@ H5D__earray_crt_dbg_context(H5F_t *f, haddr_t obj_addr) /* Open the object header where the layout message resides */ if (H5O_open(&obj_loc) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header"); obj_opened = TRUE; /* Read the layout message */ if (NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info"); /* close the object header */ if (H5O_close(&obj_loc, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header"); /* Create user data */ dbg_ctx->f = f; @@ -648,7 +612,7 @@ H5D__earray_crt_dbg_context(H5F_t *f, haddr_t obj_addr) /* Close object header */ if (obj_opened) if (H5O_close(&obj_loc, NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header") + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -663,8 +627,6 @@ H5D__earray_crt_dbg_context(H5F_t *f, haddr_t obj_addr) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; July 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -676,7 +638,7 @@ H5D__earray_dst_dbg_context(void *_dbg_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(dbg_ctx); + assert(dbg_ctx); /* Release context structure */ dbg_ctx = H5FL_FREE(H5D_earray_ctx_ud_t, dbg_ctx); @@ -693,9 +655,6 @@ H5D__earray_dst_dbg_context(void *_dbg_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, June 2, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -709,16 +668,16 @@ H5D__earray_idx_depend(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->idx_type); - HDassert(idx_info->storage); - HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->storage->idx_type); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(idx_info->storage->u.earray.ea); + assert(idx_info); + assert(idx_info->f); + assert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); + assert(idx_info->pline); + assert(idx_info->layout); + assert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->idx_type); + assert(idx_info->storage); + assert(H5D_CHUNK_IDX_EARRAY == idx_info->storage->idx_type); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(idx_info->storage->u.earray.ea); /* Set up object header location for dataset */ H5O_loc_reset(&oloc); @@ -727,21 +686,21 @@ H5D__earray_idx_depend(const H5D_chk_idx_info_t *idx_info) /* Get header */ if (NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect object header"); /* Retrieve the dataset's object header proxy */ if (NULL == (oh_proxy = H5O_get_proxy(oh))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataset object header proxy") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataset object header proxy"); /* Make the extensible array a child flush dependency of the dataset's object header */ if (H5EA_depend(idx_info->storage->u.earray.ea, oh_proxy) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, - "unable to create flush dependency on object header proxy") + "unable to create flush dependency on object header proxy"); done: /* Release the object header from the cache */ if (oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__earray_idx_depend() */ @@ -759,9 +718,6 @@ H5D__earray_idx_depend(const H5D_chk_idx_info_t *idx_info) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -773,15 +729,15 @@ H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->idx_type); - HDassert(idx_info->storage); - HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->storage->idx_type); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(NULL == idx_info->storage->u.earray.ea); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->idx_type); + assert(idx_info->storage); + assert(H5D_CHUNK_IDX_EARRAY == idx_info->storage->idx_type); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(NULL == idx_info->storage->u.earray.ea); /* Set up the user data */ udata.f = idx_info->f; @@ -790,13 +746,13 @@ H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info) /* Open the extensible array for the chunk index */ if (NULL == (idx_info->storage->u.earray.ea = H5EA_open(idx_info->f, idx_info->storage->idx_addr, &udata))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open extensible array"); /* Check for SWMR writes to the file */ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) if (H5D__earray_idx_depend(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, - "unable to create flush dependency on object header") + "unable to create flush dependency on object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -809,9 +765,6 @@ H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, May 27, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -827,17 +780,17 @@ H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, had FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(space); - HDassert(H5F_addr_defined(dset_ohdr_addr)); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(space); + assert(H5_addr_defined(dset_ohdr_addr)); /* Get the dim info for dataset */ if ((sndims = H5S_get_simple_extent_dims(space, NULL, max_dims)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions"); H5_CHECKED_ASSIGN(ndims, unsigned, sndims, int); /* Find the rank of the unlimited dimension */ @@ -847,7 +800,7 @@ H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, had if (H5S_UNLIMITED == max_dims[u]) { /* Check if we've already found an unlimited dimension */ if (unlim_dim >= 0) - HGOTO_ERROR(H5E_DATASET, H5E_ALREADYINIT, FAIL, "already found unlimited dimension") + HGOTO_ERROR(H5E_DATASET, H5E_ALREADYINIT, FAIL, "already found unlimited dimension"); /* Set the unlimited dimension */ unlim_dim = (int)u; @@ -856,7 +809,7 @@ H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, had /* Check if we didn't find an unlimited dimension */ if (unlim_dim < 0) - HGOTO_ERROR(H5E_DATASET, H5E_UNINITIALIZED, FAIL, "didn't find unlimited dimension") + HGOTO_ERROR(H5E_DATASET, H5E_UNINITIALIZED, FAIL, "didn't find unlimited dimension"); /* Set the unlimited dimension for the layout's future use */ idx_info->layout->u.earray.unlim_dim = (unsigned)unlim_dim; @@ -881,9 +834,6 @@ H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, had * Return: Non-negative on success (with the LAYOUT argument initialized * and ready to write to an object header). Negative on failure. * - * Programmer: Quincey Koziol - * Tuesday, January 27, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -896,13 +846,13 @@ H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(NULL == idx_info->storage->u.earray.ea); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(!H5_addr_defined(idx_info->storage->idx_addr)); + assert(NULL == idx_info->storage->u.earray.ea); /* General parameters */ if (idx_info->pline->nused > 0) { @@ -923,15 +873,15 @@ H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info) cparam.raw_elmt_size = (uint8_t)H5F_SIZEOF_ADDR(idx_info->f); } /* end else */ cparam.max_nelmts_bits = idx_info->layout->u.earray.cparam.max_nelmts_bits; - HDassert(cparam.max_nelmts_bits > 0); + assert(cparam.max_nelmts_bits > 0); cparam.idx_blk_elmts = idx_info->layout->u.earray.cparam.idx_blk_elmts; - HDassert(cparam.idx_blk_elmts > 0); + assert(cparam.idx_blk_elmts > 0); cparam.sup_blk_min_data_ptrs = idx_info->layout->u.earray.cparam.sup_blk_min_data_ptrs; - HDassert(cparam.sup_blk_min_data_ptrs > 0); + assert(cparam.sup_blk_min_data_ptrs > 0); cparam.data_blk_min_elmts = idx_info->layout->u.earray.cparam.data_blk_min_elmts; - HDassert(cparam.data_blk_min_elmts > 0); + assert(cparam.data_blk_min_elmts > 0); cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.earray.cparam.max_dblk_page_nelmts_bits; - HDassert(cparam.max_dblk_page_nelmts_bits > 0); + assert(cparam.max_dblk_page_nelmts_bits > 0); /* Set up the user data */ udata.f = idx_info->f; @@ -939,17 +889,17 @@ H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info) /* Create the extensible array for the chunk index */ if (NULL == (idx_info->storage->u.earray.ea = H5EA_create(idx_info->f, &cparam, &udata))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create extensible array"); /* Get the address of the extensible array in file */ if (H5EA_get_addr(idx_info->storage->u.earray.ea, &(idx_info->storage->idx_addr)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array address"); /* Check for SWMR writes to the file */ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) if (H5D__earray_idx_depend(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, - "unable to create flush dependency on object header") + "unable to create flush dependency on object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -962,9 +912,6 @@ H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 - * *------------------------------------------------------------------------- */ static hbool_t @@ -973,9 +920,9 @@ H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); + assert(storage); - FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) + FUNC_LEAVE_NOAPI((hbool_t)H5_addr_defined(storage->idx_addr)) } /* end H5D__earray_idx_is_space_alloc() */ /*------------------------------------------------------------------------- @@ -985,8 +932,6 @@ H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; May 2014 - * *------------------------------------------------------------------------- */ static herr_t @@ -999,19 +944,19 @@ H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* Check if the extensible array is open yet */ if (NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if (H5D__earray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array"); } else /* Patch the top level file pointer contained in ea if needed */ H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); @@ -1019,10 +964,10 @@ H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata /* Set convenience pointer to extensible array structure */ ea = idx_info->storage->u.earray.ea; - if (!H5F_addr_defined(udata->chunk_block.offset)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already") + if (!H5_addr_defined(udata->chunk_block.offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already"); if (udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */ - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32"); /* Check for filters on chunks */ if (idx_info->pline->nused > 0) { @@ -1034,12 +979,12 @@ H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata /* Set the info for the chunk */ if (H5EA_set(ea, udata->chunk_idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info"); } /* end if */ else { /* Set the address for the chunk */ if (H5EA_set(ea, udata->chunk_idx, &udata->chunk_block.offset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address"); } /* end else */ done: @@ -1055,9 +1000,6 @@ H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1070,19 +1012,19 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* Check if the extensible array is open yet */ if (NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if (H5D__earray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array"); } else /* Patch the top level file pointer contained in ea if needed */ H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); @@ -1120,7 +1062,7 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda /* Get the information for the chunk */ if (H5EA_get(ea, idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info"); /* Set the info for the chunk */ udata->chunk_block.offset = elmt.addr; @@ -1130,14 +1072,14 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda else { /* Get the address for the chunk */ if (H5EA_get(ea, idx, &udata->chunk_block.offset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address"); /* Update the other (constant) information for the chunk */ udata->chunk_block.length = idx_info->layout->size; udata->filter_mask = 0; } /* end else */ - if (!H5F_addr_defined(udata->chunk_block.offset)) + if (!H5_addr_defined(udata->chunk_block.offset)) udata->chunk_block.length = 0; done: @@ -1152,9 +1094,6 @@ H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 23, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1163,7 +1102,7 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(layout); + assert(layout); /* "Swizzle" constant dimensions for this dataset */ if (layout->u.earray.unlim_dim > 0) { @@ -1201,8 +1140,6 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Feb 2015 - * *------------------------------------------------------------------------- */ static int @@ -1227,13 +1164,13 @@ H5D__earray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void * udata->chunk_rec.chunk_addr = *(const haddr_t *)_elmt; /* Make "generic chunk" callback */ - if (H5F_addr_defined(udata->chunk_rec.chunk_addr)) + if (H5_addr_defined(udata->chunk_rec.chunk_addr)) if ((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0) HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); /* Update coordinates of chunk in dataset */ ndims = udata->common.layout->ndims - 1; - HDassert(ndims > 0); + assert(ndims > 0); curr_dim = (int)(ndims - 1); while (curr_dim >= 0) { /* Increment coordinate in current dimension */ @@ -1264,9 +1201,6 @@ H5D__earray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 - * *------------------------------------------------------------------------- */ static int @@ -1279,20 +1213,20 @@ H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(chunk_cb); - HDassert(chunk_udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(chunk_cb); + assert(chunk_udata); /* Check if the extensible array is open yet */ if (NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if (H5D__earray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array"); } else /* Patch the top level file pointer contained in ea if needed */ H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); @@ -1302,16 +1236,16 @@ H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t /* Get the extensible array statistics */ if (H5EA_get_stats(ea, &ea_stat) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics"); if (ea_stat.stored.max_idx_set > 0) { H5D_earray_it_ud_t udata; /* User data for iteration callback */ /* Initialize userdata */ - HDmemset(&udata, 0, sizeof udata); + memset(&udata, 0, sizeof udata); udata.common.layout = idx_info->layout; udata.common.storage = idx_info->storage; - HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec)); + memset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec)); udata.filtered = (idx_info->pline->nused > 0); if (!udata.filtered) { udata.chunk_rec.nbytes = idx_info->layout->size; @@ -1336,9 +1270,6 @@ H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1351,23 +1282,23 @@ H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* Check if the extensible array is open yet */ if (NULL == idx_info->storage->u.earray.ea) { /* Open the extensible array in file */ if (H5D__earray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array"); } else /* Patch the top level file pointer contained in ea if needed */ if (H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch earray file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch earray file pointer"); /* Set convenience pointer to extensible array structure */ ea = idx_info->storage->u.earray.ea; @@ -1400,14 +1331,14 @@ H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t /* Get the info about the chunk for the index */ if (H5EA_get(ea, idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info"); /* Remove raw data chunk from file if not doing SWMR writes */ - HDassert(H5F_addr_defined(elmt.addr)); + assert(H5_addr_defined(elmt.addr)); if (!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) { H5_CHECK_OVERFLOW(elmt.nbytes, /*From: */ uint32_t, /*To: */ hsize_t); if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, elmt.addr, (hsize_t)elmt.nbytes) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk"); } /* end if */ /* Reset the info about the chunk for the index */ @@ -1415,27 +1346,27 @@ H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t elmt.nbytes = 0; elmt.filter_mask = 0; if (H5EA_set(ea, idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk info"); } /* end if */ else { haddr_t addr = HADDR_UNDEF; /* Chunk address */ /* Get the address of the chunk for the index */ if (H5EA_get(ea, idx, &addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address"); /* Remove raw data chunk from file if not doing SWMR writes */ - HDassert(H5F_addr_defined(addr)); + assert(H5_addr_defined(addr)); if (!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) { H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */ uint32_t, /*To: */ hsize_t); if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, addr, (hsize_t)idx_info->layout->size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk"); } /* end if */ /* Reset the address of the chunk for the index */ addr = HADDR_UNDEF; if (H5EA_set(ea, idx, &addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk address"); } /* end else */ done: @@ -1450,9 +1381,6 @@ H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t * Return: Success: Non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static int @@ -1464,15 +1392,15 @@ H5D__earray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(chunk_rec); - HDassert(H5F_addr_defined(chunk_rec->chunk_addr)); - HDassert(chunk_rec->nbytes > 0); - HDassert(f); + assert(chunk_rec); + assert(H5_addr_defined(chunk_rec->chunk_addr)); + assert(chunk_rec->nbytes > 0); + assert(f); /* Remove raw data chunk from file */ H5_CHECK_OVERFLOW(chunk_rec->nbytes, /*From: */ uint32_t, /*To: */ hsize_t); if (H5MF_xfree(f, H5FD_MEM_DRAW, chunk_rec->chunk_addr, (hsize_t)chunk_rec->nbytes) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free chunk"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1491,9 +1419,6 @@ H5D__earray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) * Return: Success: Non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, January 29, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1504,23 +1429,23 @@ H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); /* Check if the index data structure has been allocated */ - if (H5F_addr_defined(idx_info->storage->idx_addr)) { + if (H5_addr_defined(idx_info->storage->idx_addr)) { H5D_earray_ctx_ud_t ctx_udata; /* User data for extensible array open call */ /* Iterate over the chunk addresses in the extensible array, deleting each chunk */ if (H5D__earray_idx_iterate(idx_info, H5D__earray_idx_delete_cb, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses") + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses"); /* Close extensible array */ if (H5EA_close(idx_info->storage->u.earray.ea) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array"); idx_info->storage->u.earray.ea = NULL; /* Set up the context user data */ @@ -1529,11 +1454,11 @@ H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info) /* Delete extensible array */ if (H5EA_delete(idx_info->f, idx_info->storage->idx_addr, &ctx_udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk extensible array"); idx_info->storage->idx_addr = HADDR_UNDEF; } /* end if */ else - HDassert(NULL == idx_info->storage->u.earray.ea); + assert(NULL == idx_info->storage->u.earray.ea); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1546,9 +1471,6 @@ H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1559,31 +1481,31 @@ H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info_src); - HDassert(idx_info_src->f); - HDassert(idx_info_src->pline); - HDassert(idx_info_src->layout); - HDassert(idx_info_src->storage); - HDassert(idx_info_dst); - HDassert(idx_info_dst->f); - HDassert(idx_info_dst->pline); - HDassert(idx_info_dst->layout); - HDassert(idx_info_dst->storage); - HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); + assert(idx_info_src); + assert(idx_info_src->f); + assert(idx_info_src->pline); + assert(idx_info_src->layout); + assert(idx_info_src->storage); + assert(idx_info_dst); + assert(idx_info_dst->f); + assert(idx_info_dst->pline); + assert(idx_info_dst->layout); + assert(idx_info_dst->storage); + assert(!H5_addr_defined(idx_info_dst->storage->idx_addr)); /* Check if the source extensible array is open yet */ if (NULL == idx_info_src->storage->u.earray.ea) /* Open the extensible array in file */ if (H5D__earray_idx_open(idx_info_src) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array"); /* Set copied metadata tag */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) /* Create the extensible array that describes chunked storage in the dest. file */ if (H5D__earray_idx_create(idx_info_dst) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") - HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage"); + assert(H5_addr_defined(idx_info_dst->storage->idx_addr)); /* Reset metadata tag */ H5_END_TAG @@ -1599,9 +1521,6 @@ H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1612,17 +1531,17 @@ H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chun FUNC_ENTER_PACKAGE /* Check args */ - HDassert(storage_src); - HDassert(storage_src->u.earray.ea); - HDassert(storage_dst); - HDassert(storage_dst->u.earray.ea); + assert(storage_src); + assert(storage_src->u.earray.ea); + assert(storage_dst); + assert(storage_dst->u.earray.ea); /* Close extensible arrays */ if (H5EA_close(storage_src->u.earray.ea) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array"); storage_src->u.earray.ea = NULL; if (H5EA_close(storage_dst->u.earray.ea) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array"); storage_dst->u.earray.ea = NULL; done: @@ -1637,9 +1556,6 @@ H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chun * Return: Success: Non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1652,24 +1568,24 @@ H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(index_size); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(index_size); /* Open the extensible array in file */ if (H5D__earray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array"); /* Set convenience pointer to extensible array structure */ ea = idx_info->storage->u.earray.ea; /* Get the extensible array statistics */ if (H5EA_get_stats(ea, &ea_stat) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics"); /* Set the size of the extensible array */ *index_size = ea_stat.computed.hdr_size + ea_stat.computed.index_blk_size + @@ -1678,7 +1594,7 @@ H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) done: if (idx_info->storage->u.earray.ea) { if (H5EA_close(idx_info->storage->u.earray.ea) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array"); idx_info->storage->u.earray.ea = NULL; } /* end if */ @@ -1692,9 +1608,6 @@ H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1703,7 +1616,7 @@ H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); + assert(storage); /* Reset index info */ if (reset_addr) { @@ -1722,9 +1635,6 @@ H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1733,10 +1643,10 @@ H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); - HDassert(stream); + assert(storage); + assert(stream); - HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); + fprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__earray_idx_dump() */ @@ -1748,9 +1658,6 @@ H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, January 31, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1761,20 +1668,20 @@ H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->storage); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->storage); /* Check if the extensible array is open */ if (idx_info->storage->u.earray.ea) { /* Patch the top level file pointer contained in ea if needed */ if (H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch earray file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch earray file pointer"); /* Close extensible array */ if (H5EA_close(idx_info->storage->u.earray.ea) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array"); idx_info->storage->u.earray.ea = NULL; } /* end if */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Defl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Defl.c index d81ed13440..84f00ede31 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Defl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Defl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,11 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Quincey Koziol - * Thursday, September 30, 2004 - */ - /****************/ /* Module Setup */ /****************/ @@ -61,14 +55,15 @@ typedef struct H5D_efl_writevv_ud_t { /* Layout operation callbacks */ static herr_t H5D__efl_construct(H5F_t *f, H5D_t *dset); -static herr_t H5D__efl_io_init(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *cm); -static ssize_t H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, - size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); -static ssize_t H5D__efl_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_len_arr[], hsize_t dset_offset_arr[], size_t mem_max_nseq, - size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); +static herr_t H5D__efl_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); +static ssize_t H5D__efl_readvv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], + hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, + size_t mem_len_arr[], hsize_t mem_offset_arr[]); +static ssize_t H5D__efl_writevv(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], + hsize_t dset_offset_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, + size_t mem_len_arr[], hsize_t mem_offset_arr[]); /* Helper routines */ static herr_t H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, uint8_t *buf); @@ -86,17 +81,14 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{ H5D__efl_is_space_alloc, /* is_space_alloc */ NULL, /* is_data_cached */ H5D__efl_io_init, /* io_init */ + NULL, /* mdio_init */ H5D__contig_read, /* ser_read */ H5D__contig_write, /* ser_write */ -#ifdef H5_HAVE_PARALLEL - NULL, /* par_read */ - NULL, /* par_write */ -#endif - H5D__efl_readvv, /* readvv */ - H5D__efl_writevv, /* writevv */ - NULL, /* flush */ - NULL, /* io_term */ - NULL /* dest */ + H5D__efl_readvv, /* readvv */ + H5D__efl_writevv, /* writevv */ + NULL, /* flush */ + NULL, /* io_term */ + NULL /* dest */ }}; /*******************/ @@ -110,9 +102,6 @@ const H5D_layout_ops_t H5D_LOPS_EFL[1] = {{ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, May 22, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -129,8 +118,8 @@ H5D__efl_construct(H5F_t *f, H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(dset); + assert(f); + assert(dset); /* * The maximum size of the dataset cannot exceed the storage size. @@ -141,27 +130,27 @@ H5D__efl_construct(H5F_t *f, H5D_t *dset) /* Check for invalid dataset dimensions */ for (u = 1; u < dset->shared->ndims; u++) if (dset->shared->max_dims[u] > dset->shared->curr_dims[u]) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "only the first dimension can be extendible") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "only the first dimension can be extendible"); /* Retrieve the size of the dataset's datatype */ if (0 == (dt_size = H5T_get_size(dset->shared->type))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to determine datatype size"); /* Check for storage overflows */ max_points = H5S_get_npoints_max(dset->shared->space); max_storage = H5O_efl_total_size(&dset->shared->dcpl_cache.efl); if (H5S_UNLIMITED == max_points) { if (H5O_EFL_UNLIMITED != max_storage) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unlimited dataspace but finite storage") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unlimited dataspace but finite storage"); } /* end if */ else if ((max_points * dt_size) < max_points) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataspace * type size overflowed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataspace * type size overflowed"); else if ((max_points * dt_size) > max_storage) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataspace size exceeds external storage size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataspace size exceeds external storage size"); /* Compute the total size of dataset */ stmp_size = H5S_GET_EXTENT_NPOINTS(dset->shared->space); - HDassert(stmp_size >= 0); + assert(stmp_size >= 0); tmp_size = (hsize_t)stmp_size * dt_size; H5_CHECKED_ASSIGN(dset->shared->layout.storage.u.contig.size, hsize_t, tmp_size, hssize_t); @@ -179,9 +168,6 @@ H5D__efl_construct(H5F_t *f, H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 15, 2009 - * *------------------------------------------------------------------------- */ hbool_t @@ -190,7 +176,7 @@ H5D__efl_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(storage); + assert(storage); /* EFL storage is currently always treated as allocated */ FUNC_LEAVE_NOAPI(TRUE) @@ -203,19 +189,21 @@ H5D__efl_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2008 - * *------------------------------------------------------------------------- */ static herr_t -H5D__efl_io_init(H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info, - hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space, - H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *cm) +H5D__efl_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo) { FUNC_ENTER_PACKAGE_NOERR - H5MM_memcpy(&io_info->store->efl, &(io_info->dset->shared->dcpl_cache.efl), sizeof(H5O_efl_t)); + H5MM_memcpy(&dinfo->store->efl, &(dinfo->dset->shared->dcpl_cache.efl), sizeof(H5O_efl_t)); + + /* No "pieces" selected */ + dinfo->layout_io_info.contig_piece_info = NULL; + + /* Disable selection I/O */ + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__efl_io_init() */ @@ -230,9 +218,6 @@ H5D__efl_io_init(H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *t * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Wednesday, March 4, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -253,10 +238,10 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size FUNC_ENTER_PACKAGE /* Check args */ - HDassert(efl && efl->nused > 0); - HDassert(H5F_addr_defined(addr)); - HDassert(size < SIZE_MAX); - HDassert(buf || 0 == size); + assert(efl && efl->nused > 0); + assert(H5_addr_defined(addr)); + assert(size < SIZE_MAX); + assert(buf || 0 == size); /* Find the first efl member from which to read */ for (u = 0, cur = 0; u < efl->nused; u++) { @@ -269,17 +254,17 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size /* Read the data */ while (size) { - HDassert(buf); + assert(buf); if (u >= efl->nused) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file"); if (H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip)) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed"); if (H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) - HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") + HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name"); if ((fd = HDopen(full_name, O_RDONLY)) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file"); if (HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0) - HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") + HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file"); #ifndef NDEBUG tempto_read = MIN((size_t)(efl->slot[u].size - skip), (hsize_t)size); H5_CHECK_OVERFLOW(tempto_read, hsize_t, size_t); @@ -288,9 +273,9 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size to_read = MIN((size_t)(efl->slot[u].size - skip), (hsize_t)size); #endif /* NDEBUG */ if ((n = HDread(fd, buf, to_read)) < 0) - HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file") + HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file"); else if ((size_t)n < to_read) - HDmemset(buf + n, 0, to_read - (size_t)n); + memset(buf + n, 0, to_read - (size_t)n); full_name = (char *)H5MM_xfree(full_name); HDclose(fd); fd = -1; @@ -319,9 +304,6 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, March 4, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -341,10 +323,10 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz FUNC_ENTER_PACKAGE /* Check args */ - HDassert(efl && efl->nused > 0); - HDassert(H5F_addr_defined(addr)); - HDassert(size < SIZE_MAX); - HDassert(buf || 0 == size); + assert(efl && efl->nused > 0); + assert(H5_addr_defined(addr)); + assert(size < SIZE_MAX); + assert(buf || 0 == size); /* Find the first efl member in which to write */ for (u = 0, cur = 0; u < efl->nused; u++) { @@ -357,21 +339,21 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz /* Write the data */ while (size) { - HDassert(buf); + assert(buf); if (u >= efl->nused) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file") + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file"); if (H5F_OVERFLOW_HSIZET2OFFT((hsize_t)efl->slot[u].offset + skip)) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed"); if (H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) - HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") + HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name"); if ((fd = HDopen(full_name, O_CREAT | O_RDWR, H5_POSIX_CREATE_MODE_RW)) < 0) { if (HDaccess(full_name, F_OK) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist") + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist"); else - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file"); } /* end if */ if (HDlseek(fd, (HDoff_t)(efl->slot[u].offset + (HDoff_t)skip), SEEK_SET) < 0) - HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") + HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file"); #ifndef NDEBUG tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size); H5_CHECK_OVERFLOW(tempto_write, hsize_t, size_t); @@ -380,7 +362,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz to_write = MIN((size_t)(efl->slot[u].size - skip), size); #endif /* NDEBUG */ if ((size_t)HDwrite(fd, buf, to_write) != to_write) - HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file") + HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file"); full_name = (char *)H5MM_xfree(full_name); HDclose(fd); fd = -1; @@ -406,9 +388,6 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, Sept 30, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -421,7 +400,7 @@ H5D__efl_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) /* Read data */ if (H5D__efl_read(udata->efl, udata->dset, dst_off, len, (udata->rbuf + src_off)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "EFL read failed") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "EFL read failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -437,15 +416,12 @@ H5D__efl_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, May 7, 2003 - * *------------------------------------------------------------------------- */ static ssize_t -H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, - size_t mem_len_arr[], hsize_t mem_off_arr[]) +H5D__efl_readvv(const H5D_io_info_t H5_ATTR_NDEBUG_UNUSED *io_info, const H5D_dset_io_info_t *dset_info, + size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[], + size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { H5D_efl_readvv_ud_t udata; /* User data for H5VM_opvv() operator */ ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */ @@ -453,27 +429,28 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset FUNC_ENTER_PACKAGE /* Check args */ - HDassert(io_info); - HDassert(io_info->store->efl.nused > 0); - HDassert(io_info->u.rbuf); - HDassert(io_info->dset); - HDassert(io_info->dset->shared); - HDassert(dset_curr_seq); - HDassert(dset_len_arr); - HDassert(dset_off_arr); - HDassert(mem_curr_seq); - HDassert(mem_len_arr); - HDassert(mem_off_arr); + assert(io_info); + assert(dset_info); + assert(dset_info->store->efl.nused > 0); + assert(dset_info->buf.vp); + assert(dset_info->dset); + assert(dset_info->dset->shared); + assert(dset_curr_seq); + assert(dset_len_arr); + assert(dset_off_arr); + assert(mem_curr_seq); + assert(mem_len_arr); + assert(mem_off_arr); /* Set up user data for H5VM_opvv() */ - udata.efl = &(io_info->store->efl); - udata.dset = io_info->dset; - udata.rbuf = (unsigned char *)io_info->u.rbuf; + udata.efl = &(dset_info->store->efl); + udata.dset = dset_info->dset; + udata.rbuf = (unsigned char *)dset_info->buf.vp; /* Call generic sequence operation routine */ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__efl_readvv_cb, &udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized EFL read") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized EFL read"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -486,9 +463,6 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, Sept 30, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -501,7 +475,7 @@ H5D__efl_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) /* Write data */ if (H5D__efl_write(udata->efl, udata->dset, dst_off, len, (udata->wbuf + src_off)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "EFL write failed") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "EFL write failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -517,15 +491,12 @@ H5D__efl_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, May 2, 2003 - * *------------------------------------------------------------------------- */ static ssize_t -H5D__efl_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dset_curr_seq, - size_t dset_len_arr[], hsize_t dset_off_arr[], size_t mem_max_nseq, size_t *mem_curr_seq, - size_t mem_len_arr[], hsize_t mem_off_arr[]) +H5D__efl_writevv(const H5D_io_info_t H5_ATTR_NDEBUG_UNUSED *io_info, const H5D_dset_io_info_t *dset_info, + size_t dset_max_nseq, size_t *dset_curr_seq, size_t dset_len_arr[], hsize_t dset_off_arr[], + size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_off_arr[]) { H5D_efl_writevv_ud_t udata; /* User data for H5VM_opvv() operator */ ssize_t ret_value = -1; /* Return value (Total size of sequence in bytes) */ @@ -533,27 +504,28 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dse FUNC_ENTER_PACKAGE /* Check args */ - HDassert(io_info); - HDassert(io_info->store->efl.nused > 0); - HDassert(io_info->u.wbuf); - HDassert(io_info->dset); - HDassert(io_info->dset->shared); - HDassert(dset_curr_seq); - HDassert(dset_len_arr); - HDassert(dset_off_arr); - HDassert(mem_curr_seq); - HDassert(mem_len_arr); - HDassert(mem_off_arr); + assert(io_info); + assert(dset_info); + assert(dset_info->store->efl.nused > 0); + assert(dset_info->buf.cvp); + assert(dset_info->dset); + assert(dset_info->dset->shared); + assert(dset_curr_seq); + assert(dset_len_arr); + assert(dset_off_arr); + assert(mem_curr_seq); + assert(mem_len_arr); + assert(mem_off_arr); /* Set up user data for H5VM_opvv() */ - udata.efl = &(io_info->store->efl); - udata.dset = io_info->dset; - udata.wbuf = (const unsigned char *)io_info->u.wbuf; + udata.efl = &(dset_info->store->efl); + udata.dset = dset_info->dset; + udata.wbuf = (const unsigned char *)dset_info->buf.cvp; /* Call generic sequence operation routine */ if ((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, mem_max_nseq, mem_curr_seq, mem_len_arr, mem_off_arr, H5D__efl_writevv_cb, &udata)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized EFL write") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "can't perform vectorized EFL write"); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__efl_writevv() */ @@ -567,8 +539,6 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, size_t dset_max_nseq, size_t *dse * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi; August 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -579,14 +549,14 @@ H5D__efl_bh_info(H5F_t *f, H5O_efl_t *efl, hsize_t *heap_size) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(efl); - HDassert(H5F_addr_defined(efl->heap_addr)); - HDassert(heap_size); + assert(f); + assert(efl); + assert(H5_addr_defined(efl->heap_addr)); + assert(heap_size); /* Get the size of the local heap for EFL's file list */ if (H5HL_heapsize(f, efl->heap_addr, heap_size) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, FAIL, "unable to retrieve local heap info") + HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, FAIL, "unable to retrieve local heap info"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dfarray.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dfarray.c index 8c0e85ec91..9235ecd95d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dfarray.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dfarray.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,13 +10,10 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Vailin Choi - * Thursday, April 30, 2009 - * +/* * Purpose: Fixed array indexed (chunked) I/O functions. * The chunk coordinate is mapped as an index into an array of * disk addresses for the chunks. - * */ /****************/ @@ -206,9 +202,6 @@ H5FL_DEFINE_STATIC(H5D_farray_ctx_ud_t); * Return: Success: non-NULL * Failure: NULL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static void * @@ -221,13 +214,13 @@ H5D__farray_crt_context(void *_udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(udata); - HDassert(udata->f); - HDassert(udata->chunk_size > 0); + assert(udata); + assert(udata->f); + assert(udata->chunk_size > 0); /* Allocate new context structure */ if (NULL == (ctx = H5FL_MALLOC(H5D_farray_ctx_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context"); /* Initialize the context */ ctx->file_addr_len = H5F_SIZEOF_ADDR(udata->f); @@ -254,9 +247,6 @@ H5D__farray_crt_context(void *_udata) * Return: Success: non-NULL * Failure: NULL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -267,7 +257,7 @@ H5D__farray_dst_context(void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(ctx); + assert(ctx); /* Release context structure */ ctx = H5FL_FREE(H5D_farray_ctx_t, ctx); @@ -283,9 +273,6 @@ H5D__farray_dst_context(void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -296,8 +283,8 @@ H5D__farray_fill(void *nat_blk, size_t nelmts) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(nat_blk); - HDassert(nelmts); + assert(nat_blk); + assert(nelmts); H5VM_array_fill(nat_blk, &fill_val, H5FA_CLS_CHUNK->nat_elmt_size, nelmts); @@ -312,9 +299,6 @@ H5D__farray_fill(void *nat_blk, size_t nelmts) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -326,10 +310,10 @@ H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); - HDassert(ctx); + assert(raw); + assert(elmt); + assert(nelmts); + assert(ctx); /* Encode native elements into raw elements */ while (nelmts) { @@ -355,9 +339,6 @@ H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -370,9 +351,9 @@ H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); + assert(raw); + assert(elmt); + assert(nelmts); /* Decode raw elements into native elements */ while (nelmts) { @@ -398,9 +379,6 @@ H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -411,12 +389,12 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(stream); - HDassert(elmt); + assert(stream); + assert(elmt); /* Print element */ HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__farray_debug() */ @@ -430,9 +408,6 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void * Return: Success: non-NULL * Failure: NULL * - * Programmer: Vailin Choi - * 5th August, 2009 - * *------------------------------------------------------------------------- */ static void * @@ -447,12 +422,12 @@ H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(H5F_addr_defined(obj_addr)); + assert(f); + assert(H5_addr_defined(obj_addr)); /* Allocate context for debugging callback */ if (NULL == (dbg_ctx = H5FL_MALLOC(H5D_farray_ctx_ud_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context"); /* Set up the object header location info */ H5O_loc_reset(&obj_loc); @@ -461,16 +436,16 @@ H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr) /* Open the object header where the layout message resides */ if (H5O_open(&obj_loc) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header"); obj_opened = TRUE; /* Read the layout message */ if (NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info"); /* close the object header */ if (H5O_close(&obj_loc, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header"); /* Create user data */ dbg_ctx->f = f; @@ -489,7 +464,7 @@ H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr) /* Close object header */ if (obj_opened) if (H5O_close(&obj_loc, NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header") + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -504,9 +479,6 @@ H5D__farray_crt_dbg_context(H5F_t *f, haddr_t obj_addr) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * 24th September, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -517,7 +489,7 @@ H5D__farray_dst_dbg_context(void *_dbg_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(dbg_ctx); + assert(dbg_ctx); /* Release context structure */ dbg_ctx = H5FL_FREE(H5D_farray_ctx_ud_t, dbg_ctx); @@ -533,9 +505,6 @@ H5D__farray_dst_dbg_context(void *_dbg_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -546,9 +515,9 @@ H5D__farray_filt_fill(void *nat_blk, size_t nelmts) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(nat_blk); - HDassert(nelmts); - HDassert(sizeof(fill_val) == H5FA_CLS_FILT_CHUNK->nat_elmt_size); + assert(nat_blk); + assert(nelmts); + assert(sizeof(fill_val) == H5FA_CLS_FILT_CHUNK->nat_elmt_size); H5VM_array_fill(nat_blk, &fill_val, H5FA_CLS_FILT_CHUNK->nat_elmt_size, nelmts); @@ -563,9 +532,6 @@ H5D__farray_filt_fill(void *nat_blk, size_t nelmts) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -579,10 +545,10 @@ H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); - HDassert(ctx); + assert(raw); + assert(elmt); + assert(nelmts); + assert(ctx); /* Encode native elements into raw elements */ while (nelmts) { @@ -610,9 +576,6 @@ H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -626,9 +589,9 @@ H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); + assert(raw); + assert(elmt); + assert(nelmts); /* Decode raw elements into native elements */ while (nelmts) { @@ -656,9 +619,6 @@ H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -671,13 +631,13 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(stream); - HDassert(elmt); + assert(stream); + assert(elmt); /* Print element */ HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx); - HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, - elmt->nbytes, elmt->filter_mask); + fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr, + elmt->nbytes, elmt->filter_mask); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__farray_filt_debug() */ @@ -691,9 +651,6 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -707,16 +664,16 @@ H5D__farray_idx_depend(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->idx_type); - HDassert(idx_info->storage); - HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->storage->idx_type); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(idx_info->storage->u.farray.fa); + assert(idx_info); + assert(idx_info->f); + assert(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE); + assert(idx_info->pline); + assert(idx_info->layout); + assert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->idx_type); + assert(idx_info->storage); + assert(H5D_CHUNK_IDX_FARRAY == idx_info->storage->idx_type); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(idx_info->storage->u.farray.fa); /* Set up object header location for dataset */ H5O_loc_reset(&oloc); @@ -725,21 +682,21 @@ H5D__farray_idx_depend(const H5D_chk_idx_info_t *idx_info) /* Get header */ if (NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect object header"); /* Retrieve the dataset's object header proxy */ if (NULL == (oh_proxy = H5O_get_proxy(oh))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataset object header proxy") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataset object header proxy"); /* Make the fixed array a child flush dependency of the dataset's object header proxy */ if (H5FA_depend(idx_info->storage->u.farray.fa, oh_proxy) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, - "unable to create flush dependency on object header proxy") + "unable to create flush dependency on object header proxy"); done: /* Release the object header from the cache */ if (oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__farray_idx_depend() */ @@ -751,9 +708,6 @@ H5D__farray_idx_depend(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Wednensday, May 23, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -763,9 +717,9 @@ H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNU FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(idx_info); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(dset_ohdr_addr)); + assert(idx_info); + assert(idx_info->storage); + assert(H5_addr_defined(dset_ohdr_addr)); idx_info->storage->u.farray.dset_ohdr_addr = dset_ohdr_addr; @@ -781,9 +735,6 @@ H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNU * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -795,15 +746,15 @@ H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->idx_type); - HDassert(idx_info->storage); - HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->storage->idx_type); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(NULL == idx_info->storage->u.farray.fa); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->idx_type); + assert(idx_info->storage); + assert(H5D_CHUNK_IDX_FARRAY == idx_info->storage->idx_type); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(NULL == idx_info->storage->u.farray.fa); /* Set up the user data */ udata.f = idx_info->f; @@ -812,13 +763,13 @@ H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info) /* Open the fixed array for the chunk index */ if (NULL == (idx_info->storage->u.farray.fa = H5FA_open(idx_info->f, idx_info->storage->idx_addr, &udata))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open fixed array"); /* Check for SWMR writes to the file */ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) if (H5D__farray_idx_depend(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, - "unable to create flush dependency on object header") + "unable to create flush dependency on object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -837,9 +788,6 @@ H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info) * Return: Non-negative on success (with the LAYOUT argument initialized * and ready to write to an object header). Negative on failure. * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -852,14 +800,14 @@ H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(NULL == idx_info->storage->u.farray.fa); - HDassert(idx_info->layout->nchunks); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(!H5_addr_defined(idx_info->storage->idx_addr)); + assert(NULL == idx_info->storage->u.farray.fa); + assert(idx_info->layout->nchunks); /* General parameters */ if (idx_info->pline->nused > 0) { @@ -880,7 +828,7 @@ H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info) cparam.raw_elmt_size = (uint8_t)H5F_SIZEOF_ADDR(idx_info->f); } /* end else */ cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.farray.cparam.max_dblk_page_nelmts_bits; - HDassert(cparam.max_dblk_page_nelmts_bits > 0); + assert(cparam.max_dblk_page_nelmts_bits > 0); cparam.nelmts = idx_info->layout->max_nchunks; /* Set up the user data */ @@ -889,17 +837,17 @@ H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info) /* Create the fixed array for the chunk index */ if (NULL == (idx_info->storage->u.farray.fa = H5FA_create(idx_info->f, &cparam, &udata))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create fixed array"); /* Get the address of the fixed array in file */ if (H5FA_get_addr(idx_info->storage->u.farray.fa, &(idx_info->storage->idx_addr)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array address"); /* Check for SWMR writes to the file */ if (H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE) if (H5D__farray_idx_depend(idx_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEPEND, FAIL, - "unable to create flush dependency on object header") + "unable to create flush dependency on object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -912,9 +860,6 @@ H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static hbool_t @@ -923,9 +868,9 @@ H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); + assert(storage); - FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) + FUNC_LEAVE_NOAPI((hbool_t)H5_addr_defined(storage->idx_addr)) } /* end H5D__farray_idx_is_space_alloc() */ /*------------------------------------------------------------------------- @@ -935,8 +880,6 @@ H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; 5 May 2014 - * *------------------------------------------------------------------------- */ static herr_t @@ -949,19 +892,19 @@ H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* Check if the fixed array is open yet */ if (NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if (H5D__farray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array"); } else /* Patch the top level file pointer contained in fa if needed */ H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); @@ -969,10 +912,10 @@ H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata /* Set convenience pointer to fixed array structure */ fa = idx_info->storage->u.farray.fa; - if (!H5F_addr_defined(udata->chunk_block.offset)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already") + if (!H5_addr_defined(udata->chunk_block.offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already"); if (udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */ - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32"); /* Check for filters on chunks */ if (idx_info->pline->nused > 0) { @@ -984,12 +927,12 @@ H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata /* Set the info for the chunk */ if (H5FA_set(fa, udata->chunk_idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info"); } /* end if */ else { /* Set the address for the chunk */ if (H5FA_set(fa, udata->chunk_idx, &udata->chunk_block.offset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address"); } /* end else */ done: @@ -1005,9 +948,6 @@ H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1020,19 +960,19 @@ H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* Check if the fixed array is open yet */ if (NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if (H5D__farray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array"); } else /* Patch the top level file pointer contained in fa if needed */ H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); @@ -1052,7 +992,7 @@ H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda /* Get the information for the chunk */ if (H5FA_get(fa, idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info"); /* Set the info for the chunk */ udata->chunk_block.offset = elmt.addr; @@ -1062,14 +1002,14 @@ H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda else { /* Get the address for the chunk */ if (H5FA_get(fa, idx, &udata->chunk_block.offset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address"); /* Update the other (constant) information for the chunk */ udata->chunk_block.length = idx_info->layout->size; udata->filter_mask = 0; } /* end else */ - if (!H5F_addr_defined(udata->chunk_block.offset)) + if (!H5_addr_defined(udata->chunk_block.offset)) udata->chunk_block.length = 0; done: @@ -1083,9 +1023,6 @@ H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static int @@ -1110,13 +1047,13 @@ H5D__farray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void * udata->chunk_rec.chunk_addr = *(const haddr_t *)_elmt; /* Make "generic chunk" callback */ - if (H5F_addr_defined(udata->chunk_rec.chunk_addr)) + if (H5_addr_defined(udata->chunk_rec.chunk_addr)) if ((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0) HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); /* Update coordinates of chunk in dataset */ ndims = udata->common.layout->ndims - 1; - HDassert(ndims > 0); + assert(ndims > 0); curr_dim = (int)(ndims - 1); while (curr_dim >= 0) { /* Increment coordinate in current dimension */ @@ -1143,9 +1080,6 @@ H5D__farray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void * * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static int @@ -1158,20 +1092,20 @@ H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(chunk_cb); - HDassert(chunk_udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(chunk_cb); + assert(chunk_udata); /* Check if the fixed array is open yet */ if (NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if (H5D__farray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array"); } else /* Patch the top level file pointer contained in fa if needed */ H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); @@ -1181,17 +1115,17 @@ H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t /* Get the fixed array statistics */ if (H5FA_get_stats(fa, &fa_stat) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics"); /* Check if there are any array elements */ if (fa_stat.nelmts > 0) { H5D_farray_it_ud_t udata; /* User data for iteration callback */ /* Initialize userdata */ - HDmemset(&udata, 0, sizeof udata); + memset(&udata, 0, sizeof udata); udata.common.layout = idx_info->layout; udata.common.storage = idx_info->storage; - HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec)); + memset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec)); udata.filtered = (idx_info->pline->nused > 0); if (!udata.filtered) { udata.chunk_rec.nbytes = idx_info->layout->size; @@ -1216,9 +1150,6 @@ H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1231,23 +1162,23 @@ H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(udata); /* Check if the fixed array is open yet */ if (NULL == idx_info->storage->u.farray.fa) { /* Open the fixed array in file */ if (H5D__farray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array"); } else /* Patch the top level file pointer contained in fa if needed */ if (H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer"); /* Set convenience pointer to fixed array structure */ fa = idx_info->storage->u.farray.fa; @@ -1262,14 +1193,14 @@ H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t /* Get the info about the chunk for the index */ if (H5FA_get(fa, idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info"); /* Remove raw data chunk from file if not doing SWMR writes */ - HDassert(H5F_addr_defined(elmt.addr)); + assert(H5_addr_defined(elmt.addr)); if (!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) { H5_CHECK_OVERFLOW(elmt.nbytes, /*From: */ uint32_t, /*To: */ hsize_t); if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, elmt.addr, (hsize_t)elmt.nbytes) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk"); } /* end if */ /* Reset the info about the chunk for the index */ @@ -1277,27 +1208,27 @@ H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t elmt.nbytes = 0; elmt.filter_mask = 0; if (H5FA_set(fa, idx, &elmt) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk info"); } /* end if */ else { haddr_t addr = HADDR_UNDEF; /* Chunk address */ /* Get the address of the chunk for the index */ if (H5FA_get(fa, idx, &addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address"); /* Remove raw data chunk from file if not doing SWMR writes */ - HDassert(H5F_addr_defined(addr)); + assert(H5_addr_defined(addr)); if (!(H5F_INTENT(idx_info->f) & H5F_ACC_SWMR_WRITE)) { H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */ uint32_t, /*To: */ hsize_t); if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, addr, (hsize_t)idx_info->layout->size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk"); } /* end if */ /* Reset the address of the chunk for the index */ addr = HADDR_UNDEF; if (H5FA_set(fa, idx, &addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk address"); } /* end else */ done: @@ -1312,9 +1243,6 @@ H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static int @@ -1326,15 +1254,15 @@ H5D__farray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(chunk_rec); - HDassert(H5F_addr_defined(chunk_rec->chunk_addr)); - HDassert(chunk_rec->nbytes > 0); - HDassert(f); + assert(chunk_rec); + assert(H5_addr_defined(chunk_rec->chunk_addr)); + assert(chunk_rec->nbytes > 0); + assert(f); /* Remove raw data chunk from file */ H5_CHECK_OVERFLOW(chunk_rec->nbytes, /*From: */ uint32_t, /*To: */ hsize_t); if (H5MF_xfree(f, H5FD_MEM_DRAW, chunk_rec->chunk_addr, (hsize_t)chunk_rec->nbytes) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free chunk"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1349,9 +1277,6 @@ H5D__farray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1362,23 +1287,23 @@ H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); /* Check if the index data structure has been allocated */ - if (H5F_addr_defined(idx_info->storage->idx_addr)) { + if (H5_addr_defined(idx_info->storage->idx_addr)) { H5D_farray_ctx_ud_t ctx_udata; /* User data for fixed array open call */ /* Iterate over the chunk addresses in the fixed array, deleting each chunk */ if (H5D__farray_idx_iterate(idx_info, H5D__farray_idx_delete_cb, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses") + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses"); /* Close fixed array */ if (H5FA_close(idx_info->storage->u.farray.fa) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array"); idx_info->storage->u.farray.fa = NULL; /* Set up the user data */ @@ -1387,11 +1312,11 @@ H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info) /* Delete fixed array */ if (H5FA_delete(idx_info->f, idx_info->storage->idx_addr, &ctx_udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk fixed array"); idx_info->storage->idx_addr = HADDR_UNDEF; } /* end if */ else - HDassert(NULL == idx_info->storage->u.farray.fa); + assert(NULL == idx_info->storage->u.farray.fa); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1404,9 +1329,6 @@ H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1417,31 +1339,31 @@ H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info_src); - HDassert(idx_info_src->f); - HDassert(idx_info_src->pline); - HDassert(idx_info_src->layout); - HDassert(idx_info_src->storage); - HDassert(idx_info_dst); - HDassert(idx_info_dst->f); - HDassert(idx_info_dst->pline); - HDassert(idx_info_dst->layout); - HDassert(idx_info_dst->storage); - HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); + assert(idx_info_src); + assert(idx_info_src->f); + assert(idx_info_src->pline); + assert(idx_info_src->layout); + assert(idx_info_src->storage); + assert(idx_info_dst); + assert(idx_info_dst->f); + assert(idx_info_dst->pline); + assert(idx_info_dst->layout); + assert(idx_info_dst->storage); + assert(!H5_addr_defined(idx_info_dst->storage->idx_addr)); /* Check if the source fixed array is open yet */ if (NULL == idx_info_src->storage->u.farray.fa) /* Open the fixed array in file */ if (H5D__farray_idx_open(idx_info_src) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array"); /* Set copied metadata tag */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) /* Create the fixed array that describes chunked storage in the dest. file */ if (H5D__farray_idx_create(idx_info_dst) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") - HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage"); + assert(H5_addr_defined(idx_info_dst->storage->idx_addr)); /* Reset metadata tag */ H5_END_TAG @@ -1457,9 +1379,6 @@ H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, const H5D_chk * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1470,17 +1389,17 @@ H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chun FUNC_ENTER_PACKAGE /* Check args */ - HDassert(storage_src); - HDassert(storage_src->u.farray.fa); - HDassert(storage_dst); - HDassert(storage_dst->u.farray.fa); + assert(storage_src); + assert(storage_src->u.farray.fa); + assert(storage_dst); + assert(storage_dst->u.farray.fa); /* Close fixed arrays */ if (H5FA_close(storage_src->u.farray.fa) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array"); storage_src->u.farray.fa = NULL; if (H5FA_close(storage_dst->u.farray.fa) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array"); storage_dst->u.farray.fa = NULL; done: @@ -1495,9 +1414,6 @@ H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, H5O_storage_chun * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1510,24 +1426,24 @@ H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); - HDassert(index_size); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); + assert(index_size); /* Open the fixed array in file */ if (H5D__farray_idx_open(idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array"); /* Set convenience pointer to fixed array structure */ fa = idx_info->storage->u.farray.fa; /* Get the fixed array statistics */ if (H5FA_get_stats(fa, &fa_stat) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics"); *index_size = fa_stat.hdr_size; *index_size += fa_stat.dblk_size; @@ -1535,7 +1451,7 @@ H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) done: if (idx_info->storage->u.farray.fa) { if (H5FA_close(idx_info->storage->u.farray.fa) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array"); idx_info->storage->u.farray.fa = NULL; } /* end if */ @@ -1549,9 +1465,6 @@ H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1560,7 +1473,7 @@ H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); + assert(storage); /* Reset index info */ if (reset_addr) @@ -1577,9 +1490,6 @@ H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1588,10 +1498,10 @@ H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); - HDassert(stream); + assert(storage); + assert(stream); - HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); + fprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__farray_idx_dump() */ @@ -1603,9 +1513,6 @@ H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1616,20 +1523,20 @@ H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->storage); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->storage); /* Check if the fixed array is open */ if (idx_info->storage->u.farray.fa) { /* Patch the top level file pointer contained in fa if needed */ if (H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch fixed array file pointer"); /* Close fixed array */ if (H5FA_close(idx_info->storage->u.farray.fa) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array"); idx_info->storage->u.farray.fa = NULL; } /* end if */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dfill.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dfill.c index b2ec46db6d..ed1ac3e90b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dfill.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dfill.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Dfill.c - * Jun 19 2007 - * Quincey Koziol * * Purpose: Fill value operations for datasets * @@ -105,7 +102,6 @@ H5FL_EXTERN(H5S_sel_iter_t); If "fill" parameter is NULL, use all zeros as fill value. EXAMPLES REVISION LOG - Raymond Lu - 20 March 2007 If there's VL type of data, the address of the data is copied multiple times into the buffer, causing some trouble when the data is released. Instead, make multiple copies of fill value first, then do conversion @@ -129,14 +125,14 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(fill_type); - HDassert(buf); - HDassert(buf_type); - HDassert(space); + assert(fill_type); + assert(buf); + assert(buf_type); + assert(space); /* Make sure the dataspace has an extent set (or is NULL) */ if (!(H5S_has_extent(space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace extent has not been set") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace extent has not been set"); /* Get the memory datatype size */ dst_type_size = H5T_get_size(buf_type); @@ -147,15 +143,15 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_ /* Wrap the local buffer for elements */ if (NULL == (elem_wb = H5WB_wrap(elem_buf, sizeof(elem_buf)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't wrap buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't wrap buffer"); /* Get a pointer to a buffer that's large enough for element */ if (NULL == (elem_ptr = H5WB_actual_clear(elem_wb, dst_type_size))) - HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer") + HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer"); /* Fill the selection in the memory buffer */ if (H5S_select_fill(elem_ptr, dst_type_size, space, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed"); } /* end if */ else { H5T_path_t *tpath; /* Conversion path information */ @@ -170,15 +166,16 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_ /* Set up type conversion function */ if (NULL == (tpath = H5T_path_find(fill_type, buf_type))) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "unable to convert between src and dest datatype"); /* Construct source & destination datatype IDs, if we will need them */ if (!H5T_path_noop(tpath)) { if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill_type, H5T_COPY_ALL), FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion"); if ((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(buf_type, H5T_COPY_ALL), FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register types for conversion"); } /* end if */ /* If there's VL type of data, make multiple copies of fill value first, @@ -194,12 +191,12 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_ /* Allocate a temporary buffer */ if (NULL == (tmp_buf = H5FL_BLK_MALLOC(type_conv, (size_t)nelmts * buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Allocate a background buffer, if necessary */ if (H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, (size_t)nelmts * buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Replicate the file's fill value into the temporary buffer */ H5VM_array_fill(tmp_buf, fill, src_type_size, (size_t)nelmts); @@ -207,21 +204,21 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_ /* Convert from file's fill value into memory form */ if (H5T_convert(tpath, src_id, dst_id, (size_t)nelmts, (size_t)0, (size_t)0, tmp_buf, bkg_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed"); /* Allocate the chunk selection iterator */ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory selection iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory selection iterator"); /* Create a selection iterator for scattering the elements to memory buffer */ if (H5S_select_iter_init(mem_iter, space, dst_type_size, 0) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize memory selection information") + "unable to initialize memory selection information"); mem_iter_init = TRUE; /* Scatter the data into memory */ if (H5D__scatter_mem(tmp_buf, mem_iter, (size_t)nelmts, buf /*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed"); } /* end if */ else { const uint8_t *fill_buf; /* Buffer to use for writing fill values */ @@ -233,11 +230,11 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_ /* Wrap the local buffer for elements */ if (NULL == (elem_wb = H5WB_wrap(elem_buf, sizeof(elem_buf)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't wrap buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't wrap buffer"); /* Get a pointer to a buffer that's large enough for element */ if (NULL == (elem_ptr = H5WB_actual(elem_wb, buf_size))) - HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer") + HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer"); /* Copy the user's data into the buffer for conversion */ H5MM_memcpy(elem_ptr, fill, src_type_size); @@ -247,17 +244,17 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_ if (H5T_path_bkg(tpath)) { /* Wrap the local buffer for background elements */ if (NULL == (bkg_elem_wb = H5WB_wrap(bkg_elem_buf, sizeof(bkg_elem_buf)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't wrap buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't wrap buffer"); /* Get a pointer to a buffer that's large enough for element */ if (NULL == (bkg_ptr = H5WB_actual_clear(bkg_elem_wb, buf_size))) - HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer") + HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer"); } /* end if */ /* Perform datatype conversion */ if (H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, elem_ptr, bkg_ptr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed"); /* Point at element buffer */ fill_buf = (const uint8_t *)elem_ptr; @@ -267,25 +264,25 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_ /* Fill the selection in the memory buffer */ if (H5S_select_fill(fill_buf, dst_type_size, space, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed"); } /* end else */ } /* end else */ done: if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); if (mem_iter) mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter); if (src_id != (-1) && H5I_dec_ref(src_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (dst_id != (-1) && H5I_dec_ref(dst_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (tmp_buf) tmp_buf = H5FL_BLK_FREE(type_conv, tmp_buf); if (elem_wb && H5WB_unwrap(elem_wb) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer"); if (bkg_elem_wb && H5WB_unwrap(bkg_elem_wb) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") + HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer"); if (bkg_buf) bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); @@ -299,9 +296,6 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, const H5T_t *buf_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * June 21, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -314,13 +308,13 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat FUNC_ENTER_PACKAGE /* Check args */ - HDassert(fb_info); - HDassert(fill); - HDassert(dset_type); - HDassert(dset_type_id > 0); + assert(fb_info); + assert(fill); + assert(dset_type); + assert(dset_type_id > 0); /* Reset fill buffer information */ - HDmemset(fb_info, 0, sizeof(*fb_info)); + memset(fb_info, 0, sizeof(*fb_info)); /* Cache constant information from the dataset */ fb_info->fill = fill; @@ -337,22 +331,22 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat /* Detect whether the datatype has a VL component */ if ((has_vlen_type = H5T_detect_class(dset_type, H5T_VLEN, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to detect vlen datatypes?") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to detect vlen datatypes?"); fb_info->has_vlen_fill_type = (hbool_t)has_vlen_type; /* If necessary, convert fill value datatypes (which copies VL components, etc.) */ if (fb_info->has_vlen_fill_type) { /* Create temporary datatype for conversion operation */ if (NULL == (fb_info->mem_type = H5T_copy(dset_type, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy file datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy file datatype"); if ((fb_info->mem_tid = H5I_register(H5I_DATATYPE, fb_info->mem_type, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register memory datatype"); /* Retrieve sizes of memory & file datatypes */ fb_info->mem_elmt_size = H5T_get_size(fb_info->mem_type); - HDassert(fb_info->mem_elmt_size > 0); + assert(fb_info->mem_elmt_size > 0); fb_info->file_elmt_size = H5T_get_size(dset_type); - HDassert(fb_info->file_elmt_size == (size_t)fill->size); + assert(fb_info->file_elmt_size == (size_t)fill->size); /* If fill value is not library default, use it to set the element size */ fb_info->max_elmt_size = MAX(fb_info->mem_elmt_size, fb_info->file_elmt_size); @@ -362,7 +356,7 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat fb_info->elmts_per_buf = MIN(total_nelmts, MAX(1, (max_buf_size / fb_info->max_elmt_size))); else fb_info->elmts_per_buf = max_buf_size / fb_info->max_elmt_size; - HDassert(fb_info->elmts_per_buf > 0); + assert(fb_info->elmts_per_buf > 0); /* Compute the buffer size to use */ fb_info->fill_buf_size = MIN(max_buf_size, (fb_info->elmts_per_buf * fb_info->max_elmt_size)); @@ -378,18 +372,18 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat else fb_info->fill_buf = H5FL_BLK_MALLOC(non_zero_fill, fb_info->fill_buf_size); if (NULL == fb_info->fill_buf) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer"); } /* end else */ /* Get the datatype conversion path for this operation */ if (NULL == (fb_info->fill_to_mem_tpath = H5T_path_find(dset_type, fb_info->mem_type))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, - "unable to convert between src and dst datatypes") + "unable to convert between src and dst datatypes"); /* Get the inverse datatype conversion path for this operation */ if (NULL == (fb_info->mem_to_dset_tpath = H5T_path_find(fb_info->mem_type, dset_type))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, - "unable to convert between src and dst datatypes") + "unable to convert between src and dst datatypes"); /* Check if we need to allocate a background buffer */ if (H5T_path_bkg(fb_info->fill_to_mem_tpath) || H5T_path_bkg(fb_info->mem_to_dset_tpath)) { @@ -402,12 +396,12 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat /* Allocate the background buffer */ if (NULL == (fb_info->bkg_buf = H5FL_BLK_MALLOC(type_conv, fb_info->bkg_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } /* end if */ } /* end if */ else { /* If fill value is not library default, use it to set the element size */ - HDassert(fill->size >= 0); + assert(fill->size >= 0); fb_info->max_elmt_size = fb_info->file_elmt_size = fb_info->mem_elmt_size = (size_t)fill->size; /* Compute the number of elements that fit within a buffer to write */ @@ -415,7 +409,7 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat fb_info->elmts_per_buf = MIN(total_nelmts, MAX(1, (max_buf_size / fb_info->max_elmt_size))); else fb_info->elmts_per_buf = max_buf_size / fb_info->max_elmt_size; - HDassert(fb_info->elmts_per_buf > 0); + assert(fb_info->elmts_per_buf > 0); /* Compute the buffer size to use */ fb_info->fill_buf_size = MIN(max_buf_size, fb_info->elmts_per_buf * fb_info->max_elmt_size); @@ -431,7 +425,7 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat else fb_info->fill_buf = H5FL_BLK_MALLOC(non_zero_fill, fb_info->fill_buf_size); if (NULL == fb_info->fill_buf) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer"); } /* end else */ /* Replicate the fill value into the cached buffer */ @@ -441,14 +435,14 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat else { /* Fill the buffer with the default fill value */ /* Retrieve size of elements */ fb_info->max_elmt_size = fb_info->file_elmt_size = fb_info->mem_elmt_size = H5T_get_size(dset_type); - HDassert(fb_info->max_elmt_size > 0); + assert(fb_info->max_elmt_size > 0); /* Compute the number of elements that fit within a buffer to write */ if (total_nelmts > 0) fb_info->elmts_per_buf = MIN(total_nelmts, MAX(1, (max_buf_size / fb_info->max_elmt_size))); else fb_info->elmts_per_buf = max_buf_size / fb_info->max_elmt_size; - HDassert(fb_info->elmts_per_buf > 0); + assert(fb_info->elmts_per_buf > 0); /* Compute the buffer size to use */ fb_info->fill_buf_size = MIN(max_buf_size, (fb_info->elmts_per_buf * fb_info->max_elmt_size)); @@ -458,19 +452,19 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat fb_info->fill_buf = caller_fill_buf; fb_info->use_caller_fill_buf = TRUE; - HDmemset(fb_info->fill_buf, 0, fb_info->fill_buf_size); + memset(fb_info->fill_buf, 0, fb_info->fill_buf_size); } /* end if */ else { if (alloc_func) { fb_info->fill_buf = alloc_func(fb_info->fill_buf_size, alloc_info); - HDmemset(fb_info->fill_buf, 0, fb_info->fill_buf_size); + memset(fb_info->fill_buf, 0, fb_info->fill_buf_size); } /* end if */ else { htri_t buf_avail = H5FL_BLK_AVAIL( zero_fill, fb_info->fill_buf_size); /* Check if there is an already zeroed out buffer available */ - HDassert(buf_avail != FAIL); + assert(buf_avail != FAIL); /* Allocate temporary buffer (zeroing it if no buffer is available) */ if (!buf_avail) @@ -479,7 +473,7 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat fb_info->fill_buf = H5FL_BLK_MALLOC(zero_fill, fb_info->fill_buf_size); } /* end else */ if (fb_info->fill_buf == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fill buffer"); } /* end else */ } /* end else */ @@ -487,7 +481,7 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat /* Cleanup on error */ if (ret_value < 0) if (H5D__fill_term(fb_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__fill_init() */ @@ -499,9 +493,6 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * June 21, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -513,21 +504,21 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(fb_info); - HDassert(fb_info->has_vlen_fill_type); - HDassert(fb_info->fill_buf); + assert(fb_info); + assert(fb_info->has_vlen_fill_type); + assert(fb_info->fill_buf); /* Make a copy of the (disk-based) fill value into the buffer */ H5MM_memcpy(fb_info->fill_buf, fb_info->fill->buf, fb_info->file_elmt_size); /* Reset first element of background buffer, if necessary */ if (H5T_path_bkg(fb_info->fill_to_mem_tpath)) - HDmemset(fb_info->bkg_buf, 0, fb_info->max_elmt_size); + memset(fb_info->bkg_buf, 0, fb_info->max_elmt_size); /* Type convert the dataset buffer, to copy any VL components */ if (H5T_convert(fb_info->fill_to_mem_tpath, fb_info->file_tid, fb_info->mem_tid, (size_t)1, (size_t)0, (size_t)0, fb_info->fill_buf, fb_info->bkg_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed"); /* Replicate the fill value into the cached buffer */ if (nelmts > 1) @@ -536,7 +527,7 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts) /* Reset the entire background buffer, if necessary */ if (H5T_path_bkg(fb_info->mem_to_dset_tpath)) - HDmemset(fb_info->bkg_buf, 0, fb_info->bkg_buf_size); + memset(fb_info->bkg_buf, 0, fb_info->bkg_buf_size); /* Make a copy of the fill buffer so we can free dynamic elements after conversion */ if (fb_info->fill_alloc_func) @@ -544,25 +535,25 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts) else buf = H5FL_BLK_MALLOC(non_zero_fill, fb_info->fill_buf_size); if (!buf) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary fill buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary fill buffer"); H5MM_memcpy(buf, fb_info->fill_buf, fb_info->fill_buf_size); /* Type convert the dataset buffer, to copy any VL components */ if (H5T_convert(fb_info->mem_to_dset_tpath, fb_info->mem_tid, fb_info->file_tid, nelmts, (size_t)0, (size_t)0, fb_info->fill_buf, fb_info->bkg_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "data type conversion failed"); done: if (buf) { /* Free dynamically allocated VL elements in fill buffer */ if (fb_info->fill->type) { if (H5T_vlen_reclaim_elmt(buf, fb_info->fill->type) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't reclaim vlen element") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't reclaim vlen element"); } /* end if */ else { if (H5T_vlen_reclaim_elmt(buf, fb_info->mem_type) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't reclaim vlen element") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't reclaim vlen element"); } /* end else */ /* Free temporary fill buffer */ @@ -582,9 +573,6 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * June 22, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -593,8 +581,8 @@ H5D__fill_release(H5D_fill_buf_info_t *fb_info) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(fb_info); - HDassert(fb_info->fill); + assert(fb_info); + assert(fb_info->fill); /* Free the buffer for fill values */ if (!fb_info->use_caller_fill_buf && fb_info->fill_buf) { @@ -619,9 +607,6 @@ H5D__fill_release(H5D_fill_buf_info_t *fb_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * June 21, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -630,7 +615,7 @@ H5D__fill_term(H5D_fill_buf_info_t *fb_info) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(fb_info); + assert(fb_info); /* Free the buffer for fill values */ H5D__fill_release(fb_info); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dint.c index 9d80654ae4..e6a709ed86 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -31,6 +30,7 @@ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ #include "H5VLprivate.h" /* Virtual Object Layer */ +#include "H5VMprivate.h" /* Vector Functions */ /****************/ /* Local Macros */ @@ -61,7 +61,7 @@ typedef struct { /* Internal data structure for computing variable-length dataset's total size */ /* (Used for generic 'get vlen buf size' operation) */ typedef struct { - H5VL_object_t *dset_vol_obj; /* VOL object for the dataset */ + const H5VL_object_t *dset_vol_obj; /* VOL object for the dataset */ hid_t fspace_id; /* Dataset dataspace ID of the dataset we are working on */ H5S_t *fspace; /* Dataset's dataspace for operation */ hid_t mspace_id; /* Memory dataspace ID of the dataset we are working on */ @@ -81,7 +81,7 @@ static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t static herr_t H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id); static herr_t H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **file_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id); -static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); +static herr_t H5D__init_storage(H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[]); static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id); static herr_t H5D__close_cb(H5VL_object_t *dset_vol_obj, void **request); static herr_t H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize); @@ -119,8 +119,8 @@ H5FL_DEFINE_STATIC(H5D_shared_t); /* Declare the external PQ free list for the sieve buffer information */ H5FL_BLK_EXTERN(sieve_buf); -/* Declare the external free list to manage the H5D_chunk_info_t struct */ -H5FL_EXTERN(H5D_chunk_info_t); +/* Declare the external free list to manage the H5D_piece_info_t struct */ +H5FL_EXTERN(H5D_piece_info_t); /* Declare extern the free list to manage blocks of type conversion data */ H5FL_BLK_EXTERN(type_conv); @@ -164,10 +164,10 @@ H5D_init(void) /* Initialize the ID group for the dataset IDs */ if (H5I_register_type(H5I_DATASET_CLS) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface"); /* Reset the "default dataset" information */ - HDmemset(&H5D_def_dset, 0, sizeof(H5D_shared_t)); + memset(&H5D_def_dset, 0, sizeof(H5D_shared_t)); H5D_def_dset.type_id = H5I_INVALID_HID; H5D_def_dset.dapl_id = H5I_INVALID_HID; H5D_def_dset.dcpl_id = H5I_INVALID_HID; @@ -176,19 +176,19 @@ H5D_init(void) * default dataset with them. */ if (NULL == (def_dcpl = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_CREATE_ID_g))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get default dataset creation property list") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get default dataset creation property list"); /* Get the default data storage layout */ if (H5P_get(def_dcpl, H5D_CRT_LAYOUT_NAME, &H5D_def_dset.layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout"); /* Get the default dataset creation properties */ if (H5P_get(def_dcpl, H5D_CRT_EXT_FILE_LIST_NAME, &H5D_def_dset.dcpl_cache.efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve external file list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve external file list"); if (H5P_get(def_dcpl, H5D_CRT_FILL_VALUE_NAME, &H5D_def_dset.dcpl_cache.fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve fill value"); if (H5P_get(def_dcpl, H5O_CRT_PIPELINE_NAME, &H5D_def_dset.dcpl_cache.pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter"); /* Retrieve the prefixes of VDS and external file from the environment variable */ H5D_prefix_vds_env = HDgetenv("HDF5_VDS_PREFIX"); @@ -266,7 +266,7 @@ H5D_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(0 == H5I_nmembers(H5I_DATASET)); + assert(0 == H5I_nmembers(H5I_DATASET)); /* Destroy the dataset object id group */ n += (H5I_dec_type_ref(H5I_DATASET) > 0); @@ -291,7 +291,7 @@ H5D__close_cb(H5VL_object_t *dset_vol_obj, void **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset_vol_obj); + assert(dset_vol_obj); /* Close the dataset */ if (H5VL_dataset_close(dset_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0) @@ -326,13 +326,13 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, const H FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - HDassert(type_id != H5P_DEFAULT); - HDassert(space); - HDassert(lcpl_id != H5P_DEFAULT); - HDassert(dcpl_id != H5P_DEFAULT); - HDassert(dapl_id != H5P_DEFAULT); + assert(loc); + assert(name && *name); + assert(type_id != H5P_DEFAULT); + assert(space); + assert(lcpl_id != H5P_DEFAULT); + assert(dcpl_id != H5P_DEFAULT); + assert(dapl_id != H5P_DEFAULT); /* Set up dataset creation info */ dcrt_info.type_id = type_id; @@ -347,8 +347,8 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id, const H /* Create the new dataset and link it to its parent group */ if (H5L_link_object(loc, name, &ocrt_info, lcpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create and link to dataset") - HDassert(ocrt_info.new_obj); + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create and link to dataset"); + assert(ocrt_info.new_obj); /* Set the return value */ ret_value = (H5D_t *)ocrt_info.new_obj; @@ -374,7 +374,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) FUNC_ENTER_PACKAGE - HDassert(dset); + assert(dset); /* Check for chunked layout */ if (dset->shared->layout.type == H5D_CHUNKED) { @@ -383,9 +383,9 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation) if (H5D__get_num_chunks(dset, dset->shared->space, &n_chunks_alloc) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to retrieve number of allocated chunks in dataset") + "unable to retrieve number of allocated chunks in dataset"); - HDassert(n_chunks_alloc <= n_chunks_total); + assert(n_chunks_alloc <= n_chunks_total); if (n_chunks_alloc == 0) *allocation = H5D_SPACE_STATUS_NOT_ALLOCATED; @@ -427,7 +427,7 @@ H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type) /* Allocate new shared dataset structure */ if (NULL == (new_dset = H5FL_MALLOC(H5D_shared_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy the default dataset information */ H5MM_memcpy(new_dset, &H5D_def_dset, sizeof(H5D_shared_t)); @@ -437,26 +437,26 @@ H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type) */ if (!vl_type && creating && dcpl_id == H5P_DATASET_CREATE_DEFAULT) { if (H5I_inc_ref(dcpl_id, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DCPL ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DCPL ID"); new_dset->dcpl_id = dcpl_id; } /* end if */ else { /* Get the property list */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); new_dset->dcpl_id = H5P_copy_plist(plist, FALSE); } /* end else */ if (!vl_type && creating && dapl_id == H5P_DATASET_ACCESS_DEFAULT) { if (H5I_inc_ref(dapl_id, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DAPL ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DAPL ID"); new_dset->dapl_id = dapl_id; } /* end if */ else { /* Get the property list */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(dapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); new_dset->dapl_id = H5P_copy_plist(plist, FALSE); } /* end else */ @@ -468,9 +468,9 @@ H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type) if (ret_value == NULL) if (new_dset != NULL) { if (new_dset->dcpl_id != 0 && H5I_dec_ref(new_dset->dcpl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID"); if (new_dset->dapl_id != 0 && H5I_dec_ref(new_dset->dapl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "can't decrement temporary datatype ID"); new_dset = H5FL_FREE(H5D_shared_t, new_dset); } /* end if */ @@ -498,17 +498,17 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type) FUNC_ENTER_PACKAGE /* Sanity checking */ - HDassert(file); - HDassert(dset); - HDassert(type); + assert(file); + assert(dset); + assert(type); /* Check whether the datatype is relocatable */ if ((relocatable = H5T_is_relocatable(type)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?"); /* Check whether the datatype is immutable */ if ((immutable = H5T_is_immutable(type)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?"); /* To use at least v18 format versions or not */ use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18); @@ -517,30 +517,30 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, H5T_t *type) if (!immutable || relocatable || use_at_least_v18) { /* Copy datatype for dataset */ if ((dset->shared->type = H5T_copy(type, H5T_COPY_ALL)) == NULL) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy datatype"); /* Convert a datatype (if committed) to a transient type if the committed datatype's file * location is different from the file location where the dataset will be created. */ if (H5T_convert_committed_datatype(dset->shared->type, file) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't get shared datatype info"); /* Mark any datatypes as being on disk now */ if (H5T_set_loc(dset->shared->type, H5F_VOL_OBJ(file), H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't set datatype location") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't set datatype location"); /* Set the version for datatype */ if (H5T_set_version(file, dset->shared->type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype"); /* Get a datatype ID for the dataset's datatype */ if ((dset->shared->type_id = H5I_register(H5I_DATATYPE, dset->shared->type, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type"); } /* end if */ /* Not a custom datatype, just use it directly */ else { if (H5I_inc_ref(type_id, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, FAIL, "Can't increment datatype ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, FAIL, "Can't increment datatype ID"); /* Use existing datatype */ dset->shared->type_id = type_id; @@ -570,12 +570,12 @@ H5D__cache_dataspace_info(const H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity checking */ - HDassert(dset); + assert(dset); /* Cache info for dataset's dataspace */ if ((sndims = H5S_get_simple_extent_dims(dset->shared->space, dset->shared->curr_dims, dset->shared->max_dims)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't cache dataspace dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't cache dataspace dimensions"); dset->shared->ndims = (unsigned)sndims; /* Compute the initial 'power2up' values */ @@ -583,7 +583,7 @@ H5D__cache_dataspace_info(const H5D_t *dset) hsize_t scaled_power2up; /* Scaled value, rounded to next power of 2 */ if (!(scaled_power2up = H5VM_power2up(dset->shared->curr_dims[u]))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2"); dset->shared->curr_power2up[u] = scaled_power2up; } @@ -609,25 +609,25 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space) FUNC_ENTER_PACKAGE /* Sanity checking */ - HDassert(file); - HDassert(dset); - HDassert(space); + assert(file); + assert(dset); + assert(space); /* Copy dataspace for dataset */ if (NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataspace"); /* Cache the dataset's dataspace info */ if (H5D__cache_dataspace_info(dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info"); /* Set the version for dataspace */ if (H5S_set_version(file, dset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype"); /* Set the dataset's dataspace to 'all' selection */ if (H5S_select_all(dset->shared->space, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set all selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set all selection"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -643,8 +643,6 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space) * Return: Success: SUCCEED (0) (non-negative value) * Failure: FAIL (-1) (negative value) * - * Programmer: Jacob Smith - * 16 August 2018 *------------------------------------------------------------------------- */ static herr_t @@ -654,13 +652,13 @@ H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize) FUNC_ENTER_PACKAGE - HDassert(file); - HDassert(minimize); + assert(file); + assert(minimize); /* Get the dataset object header minimize flag for this call */ if (H5CX_get_dset_min_ohdr_flag(minimize) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "can't get dataset object header minimize flag from API context") + "can't get dataset object header minimize flag from API context"); if (FALSE == *minimize) *minimize = H5F_get_min_dset_ohdr(file); @@ -668,7 +666,7 @@ H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize) done: if (FAIL == ret_value) *minimize = FALSE; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5D__use_minimized_dset_headers */ /*------------------------------------------------------------------------- @@ -679,8 +677,6 @@ H5D__use_minimized_dset_headers(H5F_t *file, hbool_t *minimize) * Return: Success: Positive value > 0 * Failure: 0 * - * Programmer: Jacob Smith - * 16 August 2018 *------------------------------------------------------------------------- */ static size_t @@ -695,9 +691,9 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr) FUNC_ENTER_PACKAGE - HDassert(file); - HDassert(dset); - HDassert(ohdr); + assert(file); + assert(dset); + assert(ohdr); type = dset->shared->type; fill_prop = &(dset->shared->dcpl_cache.fill); @@ -706,25 +702,25 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr) /* Datatype message size */ get_value = H5O_msg_size_oh(file, ohdr, H5O_DTYPE_ID, type, 0); if (get_value == 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "Can't get size of datatype message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "Can't get size of datatype message"); ret_value += get_value; /* Shared Dataspace message size */ get_value = H5O_msg_size_oh(file, ohdr, H5O_SDSPACE_ID, dset->shared->space, 0); if (get_value == 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataspace message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataspace message"); ret_value += get_value; /* "Layout" message size */ get_value = H5O_msg_size_oh(file, ohdr, H5O_LAYOUT_ID, &dset->shared->layout, 0); if (get_value == 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of layout message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of layout message"); ret_value += get_value; /* Fill Value message size */ get_value = H5O_msg_size_oh(file, ohdr, H5O_FILL_NEW_ID, fill_prop, 0); if (get_value == 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of fill value message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of fill value message"); ret_value += get_value; /* "Continuation" message size */ @@ -733,7 +729,7 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr) */ get_value = H5O_msg_size_oh(file, ohdr, H5O_CONT_ID, continuation, 0); if (get_value == 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of continuation message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of continuation message"); ret_value += get_value; /* Fill Value (backwards compatibility) message size */ @@ -745,12 +741,12 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr) H5MM_memcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop)); if (H5O_msg_reset_share(H5O_FILL_ID, &old_fill_prop) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't reset the copied fill property") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't reset the copied fill property"); get_value = H5O_msg_size_oh(file, ohdr, H5O_FILL_ID, &old_fill_prop, 0); if (get_value == 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, - "can't get size of fill value (backwards compat) message") + "can't get size of fill value (backwards compat) message"); ret_value += get_value; } @@ -760,7 +756,7 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr) if (pline->nused > 0) { get_value = H5O_msg_size_oh(file, ohdr, H5O_PLINE_ID, pline, 0); if (get_value == 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of filter message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of filter message"); ret_value += get_value; } } @@ -769,26 +765,26 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr) if (dset->shared->dcpl_cache.efl.nused > 0) { get_value = H5O_msg_size_oh(file, ohdr, H5O_EFL_ID, &dset->shared->dcpl_cache.efl, 0); if (get_value == 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of external file link message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of external file link message"); ret_value += get_value; } /* Modification Time message size */ if (H5O_HDR_STORE_TIMES & H5O_OH_GET_FLAGS(ohdr)) { - HDassert(H5O_OH_GET_VERSION(ohdr) >= 1); /* 1 :: H5O_VERSION_1 (H5Opkg.h) */ + assert(H5O_OH_GET_VERSION(ohdr) >= 1); /* 1 :: H5O_VERSION_1 (H5Opkg.h) */ if (H5O_OH_GET_VERSION(ohdr) == 1) { /* v1 object headers store modification time as a message */ time_t mtime; get_value = H5O_msg_size_oh(file, ohdr, H5O_MTIME_NEW_ID, &mtime, 0); if (get_value == 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of modification time message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of modification time message"); ret_value += get_value; } } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5D__calculate_minimum_header_size */ /*------------------------------------------------------------------------- @@ -800,8 +796,6 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr) * Return: Success: SUCCEED (0) (non-negative value) * Failure: FAIL (-1) (negative value) * - * Programmer: Jacob Smith - * 16 August 2018 *------------------------------------------------------------------------- */ static herr_t @@ -813,24 +807,24 @@ H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc) FUNC_ENTER_PACKAGE - HDassert(file); - HDassert(dset); - HDassert(oloc); + assert(file); + assert(dset); + assert(oloc); oh = H5O_create_ohdr(file, dset->shared->dcpl_id); if (NULL == oh) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't instantiate object header") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't instantiate object header"); ohdr_size = H5D__calculate_minimum_header_size(file, dset, oh); if (ohdr_size == 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "computed header size is invalid") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "computed header size is invalid"); /* Special allocation of space for compact datasets is handled by the call here. */ if (H5O_apply_ohdr(file, oh, dset->shared->dcpl_id, ohdr_size, (size_t)1, oloc) == FAIL) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't apply object header to file") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't apply object header to file"); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5D__prepare_minimized_oh */ /*------------------------------------------------------------------------- @@ -861,8 +855,8 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) FUNC_ENTER_PACKAGE /* Sanity checking */ - HDassert(file); - HDassert(dset); + assert(file); + assert(dset); /* Set some local variables, for convenience */ oloc = &dset->oloc; @@ -875,7 +869,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) /* Retrieve "defined" status of fill value */ if (H5P_is_fill_value_defined(fill_prop, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined"); /* Special case handling for variable-length types */ if (H5T_detect_class(type, H5T_VLEN, FALSE)) { @@ -891,47 +885,47 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) /* Don't allow never writing fill values with variable-length types */ if (fill_prop->fill_time == H5D_FILL_TIME_NEVER) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, - "Dataset doesn't support VL datatype when fill value is not defined") + "Dataset doesn't support VL datatype when fill value is not defined"); } /* end if */ /* Determine whether fill value is defined or not */ if (fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) { /* Convert fill value buffer to dataset's datatype */ if (fill_prop->buf && fill_prop->size > 0 && H5O_fill_convert(fill_prop, type, &fill_changed) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to convert fill value to dataset type"); fill_prop->fill_defined = TRUE; } else if (fill_status == H5D_FILL_VALUE_UNDEFINED) fill_prop->fill_defined = FALSE; else - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine if fill value is defined") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to determine if fill value is defined"); /* Check for invalid fill & allocation time setting */ if (fill_prop->fill_defined == FALSE && fill_prop->fill_time == H5D_FILL_TIME_ALLOC) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "fill value writing on allocation set, but no fill value defined") + "fill value writing on allocation set, but no fill value defined"); /* Check if the fill value info changed */ if (fill_changed) { H5P_genplist_t *dc_plist; /* Dataset's creation property list */ /* Get dataset's property list object */ - HDassert(dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT); + assert(dset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT); if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list"); /* Update dataset creation property */ if (H5P_set(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value info"); } /* end if */ if (H5D__use_minimized_dset_headers(file, &use_minimized_header) == FAIL) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get minimize settings") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get minimize settings"); if (TRUE == use_minimized_header) { if (H5D__prepare_minimized_oh(file, dset, oloc) == FAIL) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create minimized dataset object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create minimized dataset object header"); } /* end if */ else { /* Add the dataset's raw data size to the size of the header, if the @@ -942,26 +936,26 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) /* Create an object header for the dataset */ if (H5O_create(file, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc /*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header"); } /* if using default/minimized object headers */ - HDassert(file == dset->oloc.file); + assert(file == dset->oloc.file); /* Pin the object header */ if (NULL == (oh = H5O_pin(oloc))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header"); /* Write the dataspace header message */ if (H5S_append(file, oh, dset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update dataspace header message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update dataspace header message"); /* Write the datatype header message */ if (H5O_msg_append_oh(file, oh, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT, 0, type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update datatype header message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update datatype header message"); /* Write new fill value message */ if (H5O_msg_append_oh(file, oh, H5O_FILL_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, fill_prop) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message"); /* If there is valid information for the old fill value struct, add it */ /* (only if we aren't using v18 format versions and above */ @@ -977,12 +971,12 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) /* Write old fill value */ if (H5O_msg_append_oh(file, oh, H5O_FILL_ID, H5O_MSG_FLAG_CONSTANT, 0, &old_fill_prop) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update old fill value header message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update old fill value header message"); } /* end if */ /* Update/create the layout (and I/O pipeline & EFL) messages */ if (H5D__layout_oh_create(file, oh, dset, dapl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout/pline/efl header message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout/pline/efl header message"); /* Indicate that the layout information was initialized */ layout_init = TRUE; @@ -993,7 +987,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) /* Get dataset's property list object */ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list"); /* Check whether to add a "bogus" message */ if ((H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME) > 0) && @@ -1004,38 +998,38 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) /* Retrieve "bogus" message ID */ if (H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options"); /* Retrieve "bogus" message flags */ if (H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options"); /* Add a "bogus" message (for error testing). */ if (H5O_bogus_oh(file, oh, bogus_id, (unsigned)bogus_flags) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message"); } /* end if */ } #endif /* H5O_ENABLE_BOGUS */ /* Add a modification time message, if using older format. */ - /* (If using v18 format versions and above, the the modification time is part of the object + /* (If using v18 format versions and above, the modification time is part of the object * header and doesn't use a separate message -QAK) */ if (!use_at_least_v18) if (H5O_touch_oh(file, oh, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message"); done: /* Release pointer to object header itself */ if (oh != NULL) if (H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") + HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header"); /* Error cleanup */ if (ret_value < 0) if (layout_init) /* Destroy the layout information for the dataset */ if (dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__update_oh_info() */ @@ -1063,10 +1057,10 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char ** FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(dset); - HDassert(dset->oloc.file); + assert(dset); + assert(dset->oloc.file); filepath = H5F_EXTPATH(dset->oloc.file); - HDassert(filepath); + assert(filepath); /* XXX: Future thread-safety note - getenv is not required * to be reentrant. @@ -1076,7 +1070,7 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char ** if (prefix == NULL || *prefix == '\0') { if (H5CX_get_vds_prefix(&prefix) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for vds file") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for vds file"); } } else if (H5F_PREFIX_EFILE == prefix_type) { @@ -1084,11 +1078,11 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char ** if (prefix == NULL || *prefix == '\0') { if (H5CX_get_ext_file_prefix(&prefix) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for the external file") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get the prefix for the external file"); } } else - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "prefix name is not sensible") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "prefix name is not sensible"); /* Prefix has to be checked for NULL / empty string again because the * code above might have updated it. @@ -1107,12 +1101,12 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char ** file_prefix_len = filepath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; if (NULL == (*file_prefix = (char *)H5MM_malloc(file_prefix_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer"); HDsnprintf(*file_prefix, file_prefix_len, "%s%s", filepath, prefix + HDstrlen("${ORIGIN}")); } /* end if */ else { if (NULL == (*file_prefix = (char *)H5MM_strdup(prefix))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } /* end else */ } /* end else */ @@ -1154,21 +1148,21 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t FUNC_ENTER_PACKAGE /* check args */ - HDassert(file); - HDassert(H5I_DATATYPE == H5I_get_type(type_id)); - HDassert(space); - HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); + assert(file); + assert(H5I_DATATYPE == H5I_get_type(type_id)); + assert(space); + assert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); /* Get the dataset's datatype */ if (NULL == (dt = (H5T_t *)H5I_object(type_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype"); /* If this is a named datatype, get the pointer via the VOL plugin */ type = H5T_get_actual_type(dt); /* Check if the datatype is "sensible" for use in a dataset */ if (H5T_is_sensible(type) != TRUE) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible"); /* Check if the datatype is/contains a VL-type */ if (H5T_detect_class(type, H5T_VLEN, FALSE)) @@ -1176,11 +1170,11 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t /* Check if the dataspace has an extent set (or is NULL) */ if (!H5S_has_extent(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "dataspace extent has not been set.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "dataspace extent has not been set."); /* Initialize the dataset object */ if (NULL == (new_dset = H5FL_CALLOC(H5D_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Set up & reset dataset location */ dset_loc.oloc = &(new_dset->oloc); @@ -1189,15 +1183,15 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t /* Initialize the shared dataset space */ if (NULL == (new_dset->shared = H5D__new(dcpl_id, dapl_id, TRUE, has_vl_type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy & initialize datatype for dataset */ if (H5D__init_type(file, new_dset, type_id, type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy datatype"); /* Copy & initialize dataspace for dataset */ if (H5D__init_space(file, new_dset, space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't copy dataspace"); /* Set the dataset's checked_filters flag to enable writing */ new_dset->shared->checked_filters = TRUE; @@ -1211,72 +1205,72 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t htri_t ignore_filters = FALSE; /* Ignore optional filters or not */ if ((ignore_filters = H5Z_ignore_filters(new_dset->shared->dcpl_id, dt, space)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "H5Z_has_optional_filter() failed") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "H5Z_has_optional_filter() failed"); if (FALSE == ignore_filters) { /* Check if the filters in the DCPL can be applied to this dataset */ if (H5Z_can_apply(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "I/O filters can't operate on this dataset") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, NULL, "I/O filters can't operate on this dataset"); /* Make the "set local" filter callbacks for this dataset */ if (H5Z_set_local(new_dset->shared->dcpl_id, new_dset->shared->type_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set local filter parameters") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set local filter parameters"); } /* ignore_filters */ /* Get new dataset's property list object */ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(new_dset->shared->dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "can't get dataset creation property list"); /* Retrieve the properties we need */ pline = &new_dset->shared->dcpl_cache.pline; if (H5P_get(dc_plist, H5O_CRT_PIPELINE_NAME, pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve pipeline filter") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve pipeline filter"); pline_copied = TRUE; layout = &new_dset->shared->layout; if (H5P_get(dc_plist, H5D_CRT_LAYOUT_NAME, layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve layout") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve layout"); layout_copied = TRUE; fill = &new_dset->shared->dcpl_cache.fill; if (H5P_get(dc_plist, H5D_CRT_FILL_VALUE_NAME, fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve fill value info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve fill value info"); fill_copied = TRUE; efl = &new_dset->shared->dcpl_cache.efl; if (H5P_get(dc_plist, H5D_CRT_EXT_FILE_LIST_NAME, efl) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve external file list") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't retrieve external file list"); efl_copied = TRUE; if (FALSE == ignore_filters) { /* Check that chunked layout is used if filters are enabled */ if (pline->nused > 0 && H5D_CHUNKED != layout->type) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "filters can only be used with chunked layout"); } /* Check if the alloc_time is the default and error out */ if (fill->alloc_time == H5D_ALLOC_TIME_DEFAULT) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "invalid space allocation state") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "invalid space allocation state"); /* Don't allow compact datasets to allocate space later */ if (layout->type == H5D_COMPACT && fill->alloc_time != H5D_ALLOC_TIME_EARLY) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "compact dataset must have early space allocation"); } /* end if */ /* Set the version for the I/O pipeline message */ if (H5O_pline_set_version(file, &new_dset->shared->dcpl_cache.pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline"); /* Set the version for the fill message */ if (H5O_fill_set_version(file, &new_dset->shared->dcpl_cache.fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value"); /* Set the latest version for the layout message */ if (H5D__layout_set_version(file, &new_dset->shared->layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout"); if (new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) { /* Use latest indexing type for layout message version >= 4 */ if (H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing"); } /* end if */ /* Check if the file driver would like to force early space allocation */ @@ -1294,37 +1288,37 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t /* Set the dataset's I/O operations */ if (H5D__layout_set_io_ops(new_dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize I/O operations") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize I/O operations"); /* Create the layout information for the new dataset */ if (new_dset->shared->layout.ops->construct && (new_dset->shared->layout.ops->construct)(file, new_dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to construct layout information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to construct layout information"); /* Update the dataset's object header info. */ if (H5D__update_oh_info(file, new_dset, new_dset->shared->dapl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't update the metadata cache"); /* Indicate that the layout information was initialized */ layout_init = TRUE; /* Set up append flush parameters for the dataset */ if (H5D__append_flush_setup(new_dset, new_dset->shared->dapl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to set up flush append property"); /* Set the external file prefix */ if (H5D__build_file_prefix(new_dset, H5F_PREFIX_EFILE, &new_dset->shared->extfile_prefix) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix"); /* Set the VDS file prefix */ if (H5D__build_file_prefix(new_dset, H5F_PREFIX_VDS, &new_dset->shared->vds_prefix) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix"); /* Add the dataset to the list of opened objects in the file */ if (H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count"); if (H5FO_insert(new_dset->oloc.file, new_dset->oloc.addr, new_dset->shared, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, NULL, "can't insert dataset into list of open objects") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, NULL, "can't insert dataset into list of open objects"); new_dset->shared->fo_count = 1; /* Success */ @@ -1335,48 +1329,48 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, hid_t if (new_dset->shared) { if (layout_init) if (new_dset->shared->layout.ops->dest && (new_dset->shared->layout.ops->dest)(new_dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "unable to destroy layout info") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "unable to destroy layout info"); if (pline_copied) if (H5O_msg_reset(H5O_PLINE_ID, &new_dset->shared->dcpl_cache.pline) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset I/O pipeline info") + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset I/O pipeline info"); if (layout_copied) if (H5O_msg_reset(H5O_LAYOUT_ID, &new_dset->shared->layout) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset layout info") + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset layout info"); if (fill_copied) if (H5O_msg_reset(H5O_FILL_ID, &new_dset->shared->dcpl_cache.fill) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset fill-value info") + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset fill-value info"); if (efl_copied) if (H5O_msg_reset(H5O_EFL_ID, &new_dset->shared->dcpl_cache.efl) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset external file list info") + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, NULL, "unable to reset external file list info"); if (new_dset->shared->space && H5S_close(new_dset->shared->space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataspace"); if (new_dset->shared->type) { if (new_dset->shared->type_id > 0) { if (H5I_dec_ref(new_dset->shared->type_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype"); } /* end if */ else { if (H5T_close_real(new_dset->shared->type) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release datatype"); } /* end else */ } /* end if */ - if (H5F_addr_defined(new_dset->oloc.addr)) { + if (H5_addr_defined(new_dset->oloc.addr)) { if (H5O_dec_rc_by_loc(&(new_dset->oloc)) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, - "unable to decrement refcount on newly created object") + "unable to decrement refcount on newly created object"); if (H5O_close(&(new_dset->oloc), NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release object header") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release object header"); if (file) { if (H5O_delete(file, new_dset->oloc.addr) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDELETE, NULL, "unable to delete object header") + HDONE_ERROR(H5E_DATASET, H5E_CANTDELETE, NULL, "unable to delete object header"); } /* end if */ } /* end if */ if (new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list"); if (new_dset->shared->dapl_id != 0 && H5I_dec_ref(new_dset->shared->dapl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list"); new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix); new_dset->shared->vds_prefix = (char *)H5MM_xfree(new_dset->shared->vds_prefix); new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared); @@ -1411,8 +1405,8 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(loc); - HDassert(name); + assert(loc); + assert(name); /* Set up dataset location to fill in */ dset_loc.oloc = &oloc; @@ -1421,18 +1415,18 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id) /* Find the dataset object */ if (H5G_loc_find(loc, name, &dset_loc) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, NULL, "not found") + HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, NULL, "not found"); loc_found = TRUE; /* Check that the object found is the correct type */ if (H5O_obj_type(&oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get object type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get object type"); if (obj_type != H5O_TYPE_DATASET) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, NULL, "not a dataset") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, NULL, "not a dataset"); /* Open the dataset */ if (NULL == (dset = H5D_open(&dset_loc, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't open dataset"); /* Set return value */ ret_value = dset; @@ -1440,7 +1434,7 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id) done: if (!ret_value) if (loc_found && H5G_loc_free(&dset_loc) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__open_name() */ @@ -1468,27 +1462,27 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id) FUNC_ENTER_NOAPI(NULL) /* check args */ - HDassert(loc); + assert(loc); /* Allocate the dataset structure */ if (NULL == (dataset = H5FL_CALLOC(H5D_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Shallow copy (take ownership) of the object location object */ if (H5O_loc_copy_shallow(&(dataset->oloc), loc->oloc) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy object location") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy object location"); /* Shallow copy (take ownership) of the group hier. path */ if (H5G_name_copy(&(dataset->path), loc->path, H5_COPY_SHALLOW) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path"); /* Get the external file prefix */ if (H5D__build_file_prefix(dataset, H5F_PREFIX_EFILE, &extfile_prefix) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix"); /* Get the VDS prefix */ if (H5D__build_file_prefix(dataset, H5F_PREFIX_VDS, &vds_prefix) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize VDS prefix"); /* Check if dataset was already open */ if (NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) { @@ -1497,17 +1491,17 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id) /* Open the dataset object */ if (H5D__open_oid(dataset, dapl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, NULL, "not found") + HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, NULL, "not found"); /* Add the dataset to the list of opened objects in the file */ if (H5FO_insert(dataset->oloc.file, dataset->oloc.addr, dataset->shared, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, NULL, "can't insert dataset into list of open objects") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, NULL, "can't insert dataset into list of open objects"); /* Increment object count for the object in the top file */ if (H5FO_top_incr(dataset->oloc.file, dataset->oloc.addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment object count") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment object count"); - /* We're the first dataset to use the the shared info */ + /* We're the first dataset to use the shared info */ dataset->shared->fo_count = 1; /* Set the external file prefix */ @@ -1535,25 +1529,25 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id) if (HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0) HGOTO_ERROR( H5E_DATASET, H5E_CANTOPENOBJ, NULL, - "new external file prefix does not match external file prefix of already open dataset") + "new external file prefix does not match external file prefix of already open dataset"); } else { if (extfile_prefix || dataset->shared->extfile_prefix) HGOTO_ERROR( H5E_DATASET, H5E_CANTOPENOBJ, NULL, - "new external file prefix does not match external file prefix of already open dataset") + "new external file prefix does not match external file prefix of already open dataset"); } /* Check if the object has been opened through the top file yet */ if (H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) { /* Open the object through this top file */ if (H5O_open(&(dataset->oloc)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open object header"); } /* end if */ /* Increment object count for the object in the top file */ if (H5FO_top_incr(dataset->oloc.file, dataset->oloc.addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment object count") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment object count"); } /* end else */ /* Set the dataset to return */ @@ -1601,11 +1595,11 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dset); - HDassert(dset->shared); + assert(dset); + assert(dset->shared); /* Set default append flush values */ - HDmemset(&dset->shared->append_flush, 0, sizeof(dset->shared->append_flush)); + memset(&dset->shared->append_flush, 0, sizeof(dset->shared->append_flush)); /* If the dataset is chunked and there is a non-default DAPL */ if (dapl_id != H5P_DATASET_ACCESS_DEFAULT && dset->shared->layout.type == H5D_CHUNKED) { @@ -1621,7 +1615,7 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) /* Get append flush property */ if (H5P_get(dapl, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get append flush info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get append flush info"); if (info.ndims > 0) { hsize_t curr_dims[H5S_MAX_RANK]; /* current dimension sizes */ hsize_t max_dims[H5S_MAX_RANK]; /* current dimension sizes */ @@ -1630,10 +1624,10 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) /* Get dataset rank */ if ((rank = H5S_get_simple_extent_dims(dset->shared->space, curr_dims, max_dims)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset dimensions"); if (info.ndims != (unsigned)rank) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, - "boundary dimension rank does not match dataset rank") + "boundary dimension rank does not match dataset rank"); /* Validate boundary sizes */ for (u = 0; u < info.ndims; u++) @@ -1644,7 +1638,7 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) /* At least one boundary dimension is not extendible */ if (u != info.ndims) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension is not valid") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "boundary dimension is not valid"); /* Copy append flush settings */ dset->shared->append_flush.ndims = info.ndims; @@ -1680,66 +1674,94 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* check args */ - HDassert(dataset); + assert(dataset); /* (Set the 'vl_type' parameter to FALSE since it doesn't matter from here) */ if (NULL == (dataset->shared = H5D__new(H5P_DATASET_CREATE_DEFAULT, dapl_id, FALSE, FALSE))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Open the dataset object */ if (H5O_open(&(dataset->oloc)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open"); /* Get the type and space */ if (NULL == (dataset->shared->type = (H5T_t *)H5O_msg_read(&(dataset->oloc), H5O_DTYPE_ID, NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load type info from dataset header"); if (H5T_set_loc(dataset->shared->type, H5F_VOL_OBJ(dataset->oloc.file), H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); if (NULL == (dataset->shared->space = H5S_read(&(dataset->oloc)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header"); /* Cache the dataset's dataspace info */ if (H5D__cache_dataspace_info(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info"); /* Get a datatype ID for the dataset's datatype */ if ((dataset->shared->type_id = H5I_register(H5I_DATATYPE, dataset->shared->type, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register type"); /* Get dataset creation property list object */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(dataset->shared->dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list"); /* Get the layout/pline/efl message information */ if (H5D__layout_oh_read(dataset, dapl_id, plist) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout/pline/efl info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout/pline/efl info"); /* Indicate that the layout information was initialized */ layout_init = TRUE; + /* + * Now that we've read the dataset's datatype, dataspace and + * layout information, perform a quick check for compact datasets + * to ensure that the size of the internal buffer that was + * allocated for the dataset's raw data matches the size of + * the data. A corrupted file can cause a mismatch between the + * two, which might result in buffer overflows during future + * I/O to the dataset. + */ + if (H5D_COMPACT == dataset->shared->layout.type) { + hssize_t dset_nelemts = 0; + size_t dset_type_size = H5T_GET_SIZE(dataset->shared->type); + size_t dset_data_size = 0; + + assert(H5D_COMPACT == dataset->shared->layout.storage.type); + + if ((dset_nelemts = H5S_GET_EXTENT_NPOINTS(dataset->shared->space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, + "can't get number of elements in dataset's dataspace"); + + dset_data_size = (size_t)dset_nelemts * dset_type_size; + + if (dataset->shared->layout.storage.u.compact.size != dset_data_size) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, + "bad value from dataset header - size of compact dataset's data buffer doesn't match " + "size of dataset data"); + } + /* Set up flush append property */ if (H5D__append_flush_setup(dataset, dapl_id)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set up flush append property") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set up flush append property"); /* Point at dataset's copy, to cache it for later */ fill_prop = &dataset->shared->dcpl_cache.fill; /* Try to get the new fill value message from the object header */ if ((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_NEW_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists"); if (msg_exists) { if (NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_NEW_ID, fill_prop)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message"); } /* end if */ else { /* For backward compatibility, try to retrieve the old fill value message */ if ((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_FILL_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists"); if (msg_exists) { if (NULL == H5O_msg_read(&(dataset->oloc), H5O_FILL_ID, fill_prop)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message"); } /* end if */ else { /* Set the space allocation time appropriately, based on the type of dataset storage */ @@ -1763,7 +1785,7 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "not implemented yet") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "not implemented yet"); } /* end switch */ /*lint !e788 All appropriate cases are covered */ } /* end else */ @@ -1781,9 +1803,9 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) /* Set revised fill value properties, if they are different from the defaults */ if (H5P_fill_value_cmp(&H5D_def_dset.dcpl_cache.fill, fill_prop, sizeof(H5O_fill_t))) { if (H5P_set(plist, H5D_CRT_FILL_VALUE_NAME, fill_prop) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set fill value") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set fill value"); if (H5P_set(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set allocation time state") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set allocation time state"); } /* end if */ /* @@ -1793,33 +1815,28 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id) */ if ((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) && !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) && - H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY)) { - H5D_io_info_t io_info; - - io_info.dset = dataset; - - if (H5D__alloc_storage(&io_info, H5D_ALLOC_OPEN, FALSE, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage") - } /* end if */ + H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY)) + if (H5D__alloc_storage(dataset, H5D_ALLOC_OPEN, FALSE, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage"); done: if (ret_value < 0) { - if (H5F_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc), NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") + if (H5_addr_defined(dataset->oloc.addr) && H5O_close(&(dataset->oloc), NULL) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header"); if (dataset->shared) { if (layout_init) if (dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info"); if (dataset->shared->space && H5S_close(dataset->shared->space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace"); if (dataset->shared->type) { if (dataset->shared->type_id > 0) { if (H5I_dec_ref(dataset->shared->type_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype"); } /* end if */ else { if (H5T_close_real(dataset->shared->type) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype"); } /* end else */ } /* end if */ } /* end if */ @@ -1849,8 +1866,8 @@ H5D_close(H5D_t *dataset) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(dataset && dataset->oloc.file && dataset->shared); - HDassert(dataset->shared->fo_count > 0); + assert(dataset && dataset->oloc.file && dataset->shared); + assert(dataset->shared->fo_count > 0); /* Dump debugging info */ #ifdef H5D_CHUNK_DEBUG @@ -1862,7 +1879,7 @@ H5D_close(H5D_t *dataset) /* Flush the dataset's information. Continue to close even if it fails. */ if (H5D__flush_real(dataset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info") + HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info"); /* Set a flag to indicate the dataset is closing, before we start freeing things */ /* (Avoids problems with flushing datasets twice, when one is holding @@ -1882,7 +1899,7 @@ H5D_close(H5D_t *dataset) case H5D_CHUNKED: /* Check for skip list for iterating over chunks during I/O to close */ if (dataset->shared->cache.chunk.sel_chunks) { - HDassert(H5SL_count(dataset->shared->cache.chunk.sel_chunks) == 0); + assert(H5SL_count(dataset->shared->cache.chunk.sel_chunks) == 0); H5SL_close(dataset->shared->cache.chunk.sel_chunks); dataset->shared->cache.chunk.sel_chunks = NULL; } /* end if */ @@ -1894,10 +1911,10 @@ H5D_close(H5D_t *dataset) } /* end if */ /* Check for cached single element chunk info */ - if (dataset->shared->cache.chunk.single_chunk_info) { - dataset->shared->cache.chunk.single_chunk_info = - H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info); - dataset->shared->cache.chunk.single_chunk_info = NULL; + if (dataset->shared->cache.chunk.single_piece_info) { + dataset->shared->cache.chunk.single_piece_info = + H5FL_FREE(H5D_piece_info_t, dataset->shared->cache.chunk.single_piece_info); + dataset->shared->cache.chunk.single_piece_info = NULL; } /* end if */ break; @@ -1908,28 +1925,28 @@ H5D_close(H5D_t *dataset) case H5D_VIRTUAL: { size_t i, j; - HDassert(dataset->shared->layout.storage.u.virt.list || - (dataset->shared->layout.storage.u.virt.list_nused == 0)); + assert(dataset->shared->layout.storage.u.virt.list || + (dataset->shared->layout.storage.u.virt.list_nused == 0)); /* Close source datasets */ for (i = 0; i < dataset->shared->layout.storage.u.virt.list_nused; i++) { /* Close source dataset */ if (dataset->shared->layout.storage.u.virt.list[i].source_dset.dset) { - HDassert(dataset->shared->layout.storage.u.virt.list[i].source_dset.dset != dataset); + assert(dataset->shared->layout.storage.u.virt.list[i].source_dset.dset != dataset); if (H5D_close(dataset->shared->layout.storage.u.virt.list[i].source_dset.dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close source dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close source dataset"); dataset->shared->layout.storage.u.virt.list[i].source_dset.dset = NULL; } /* end if */ /* Close sub datasets */ for (j = 0; j < dataset->shared->layout.storage.u.virt.list[i].sub_dset_nused; j++) if (dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset) { - HDassert(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset != - dataset); + assert(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset != + dataset); if (H5D_close(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to close source dataset") + "unable to close source dataset"); dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset = NULL; } /* end if */ } /* end for */ @@ -1939,15 +1956,15 @@ H5D_close(H5D_t *dataset) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HDassert("not implemented yet" && 0); + assert("not implemented yet" && 0); #ifdef NDEBUG - HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout") + HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout"); #endif /* NDEBUG */ } /* end switch */ /*lint !e788 All appropriate cases are covered */ /* Destroy any cached layout information for the dataset */ if (dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info"); /* Free the external file prefix */ dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); @@ -1964,10 +1981,10 @@ H5D_close(H5D_t *dataset) /* Uncork cache entries with object address tag */ if (H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__GET_CORKED, &corked) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") + HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status"); if (corked) if (H5AC_cork(dataset->oloc.file, dataset->oloc.addr, H5AC__UNCORK, NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object") + HDONE_ERROR(H5E_DATASET, H5E_CANTUNCORK, FAIL, "unable to uncork an object"); /* Release datatype, dataspace, and creation and access property lists -- there isn't * much we can do if one of these fails, so we just continue. @@ -1978,27 +1995,27 @@ H5D_close(H5D_t *dataset) /* Remove the dataset from the list of opened objects in the file */ if (H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object"); if (H5FO_delete(dataset->oloc.file, dataset->oloc.addr) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't remove dataset from list of open objects") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't remove dataset from list of open objects"); /* Close the dataset object */ /* (This closes the file, if this is the last object open) */ if (H5O_close(&(dataset->oloc), &file_closed) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release object header"); /* Evict dataset metadata if evicting on close */ if (!file_closed && H5F_SHARED(dataset->oloc.file) && H5F_EVICT_ON_CLOSE(dataset->oloc.file)) { if (H5AC_flush_tagged_metadata(dataset->oloc.file, dataset->oloc.addr) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata"); if (H5AC_evict_tagged_metadata(dataset->oloc.file, dataset->oloc.addr, FALSE) < 0) - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata"); } /* end if */ /* * Free memory. Before freeing the memory set the file pointer to NULL. * We always check for a null file pointer in other H5D functions to be - * sure we're not accessing an already freed dataset (see the HDassert() + * sure we're not accessing an already freed dataset (see the assert() * above). */ dataset->oloc.file = NULL; @@ -2008,17 +2025,17 @@ H5D_close(H5D_t *dataset) else { /* Decrement the ref. count for this object in the top file */ if (H5FO_top_decr(dataset->oloc.file, dataset->oloc.addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object") + HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object"); /* Check reference count for this object in the top file */ if (H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) { if (H5O_close(&(dataset->oloc), NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to close") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to close"); } /* end if */ else /* Free object location (i.e. "unhold" the file if appropriate) */ if (H5O_loc_free(&(dataset->oloc)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "problem attempting to free location") + HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "problem attempting to free location"); } /* end else */ /* Release the dataset's path info */ @@ -2031,7 +2048,7 @@ H5D_close(H5D_t *dataset) /* Check if anything failed in the middle... */ if (free_failed) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "couldn't free a component of the dataset, but the dataset was freed anyway.") + "couldn't free a component of the dataset, but the dataset was freed anyway."); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2055,13 +2072,13 @@ H5D_mult_refresh_close(hid_t dset_id) FUNC_ENTER_NOAPI(FAIL) if (NULL == (dataset = (H5D_t *)H5VL_object_verify(dset_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); /* check args */ - HDassert(dataset); - HDassert(dataset->oloc.file); - HDassert(dataset->shared); - HDassert(dataset->shared->fo_count > 0); + assert(dataset); + assert(dataset->oloc.file); + assert(dataset->shared); + assert(dataset->shared->fo_count > 0); if (dataset->shared->fo_count > 1) { /* Free cached information for each kind of dataset */ @@ -2076,7 +2093,7 @@ H5D_mult_refresh_close(hid_t dset_id) case H5D_CHUNKED: /* Check for skip list for iterating over chunks during I/O to close */ if (dataset->shared->cache.chunk.sel_chunks) { - HDassert(H5SL_count(dataset->shared->cache.chunk.sel_chunks) == 0); + assert(H5SL_count(dataset->shared->cache.chunk.sel_chunks) == 0); H5SL_close(dataset->shared->cache.chunk.sel_chunks); dataset->shared->cache.chunk.sel_chunks = NULL; } /* end if */ @@ -2088,10 +2105,10 @@ H5D_mult_refresh_close(hid_t dset_id) } /* end if */ /* Check for cached single element chunk info */ - if (dataset->shared->cache.chunk.single_chunk_info) { - dataset->shared->cache.chunk.single_chunk_info = - H5FL_FREE(H5D_chunk_info_t, dataset->shared->cache.chunk.single_chunk_info); - dataset->shared->cache.chunk.single_chunk_info = NULL; + if (dataset->shared->cache.chunk.single_piece_info) { + dataset->shared->cache.chunk.single_piece_info = + H5FL_FREE(H5D_piece_info_t, dataset->shared->cache.chunk.single_piece_info); + dataset->shared->cache.chunk.single_piece_info = NULL; } /* end if */ break; @@ -2103,15 +2120,15 @@ H5D_mult_refresh_close(hid_t dset_id) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HDassert("not implemented yet" && 0); + assert("not implemented yet" && 0); #ifdef NDEBUG - HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout") + HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout"); #endif /* NDEBUG */ } /* end switch */ /*lint !e788 All appropriate cases are covered */ /* Destroy any cached layout information for the dataset */ if (dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info"); } /* end if */ done: @@ -2135,29 +2152,29 @@ H5D_mult_refresh_reopen(H5D_t *dataset) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(dataset && dataset->oloc.file && dataset->shared); - HDassert(dataset->shared->fo_count > 0); + assert(dataset && dataset->oloc.file && dataset->shared); + assert(dataset->shared->fo_count > 0); if (dataset->shared->fo_count > 1) { /* Release dataspace info */ if (H5S_close(dataset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); /* Re-load dataspace info */ if (NULL == (dataset->shared->space = H5S_read(&(dataset->oloc)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to load dataspace info from dataset header"); /* Cache the dataset's dataspace info */ if (H5D__cache_dataspace_info(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't cache dataspace info"); /* Release layout info */ if (H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info"); /* Re-load layout message info */ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message"); } /* end if */ done: @@ -2209,11 +2226,9 @@ H5D_nameof(H5D_t *dataset) *------------------------------------------------------------------------- */ herr_t -H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, - hsize_t old_dim[]) +H5D__alloc_storage(H5D_t *dset, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]) { - const H5D_t *dset = io_info->dset; /* The dataset object */ - H5F_t *f = dset->oloc.file; /* The dataset's file pointer */ + H5F_t *f; /* The dataset's file pointer */ H5O_layout_t *layout; /* The dataset's layout information */ hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */ hbool_t addr_set = FALSE; /* Flag to indicate that the dataset's storage address was set */ @@ -2222,8 +2237,9 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hb FUNC_ENTER_PACKAGE /* check args */ - HDassert(dset); - HDassert(f); + assert(dset); + f = dset->oloc.file; + assert(f); /* If the data is stored in external files, don't set an address for the layout * We assume that external storage is already @@ -2240,7 +2256,8 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hb if (layout->storage.u.contig.size > 0) { /* Reserve space in the file for the entire array */ if (H5D__contig_alloc(f, &layout->storage.u.contig /*out*/) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, + "unable to initialize contiguous storage"); /* Indicate that we should initialize storage space */ must_init_space = TRUE; @@ -2257,7 +2274,7 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hb if (!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) { /* Create the root of the index that manages chunked storage */ if (H5D__chunk_create(dset /*in,out*/) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage"); /* Indicate that we set the storage addr */ addr_set = TRUE; @@ -2286,9 +2303,9 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hb if (NULL == (layout->storage.u.compact.buf = H5MM_malloc(layout->storage.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "unable to allocate memory for compact dataset") + "unable to allocate memory for compact dataset"); if (!full_overwrite) - HDmemset(layout->storage.u.compact.buf, 0, layout->storage.u.compact.size); + memset(layout->storage.u.compact.buf, 0, layout->storage.u.compact.size); layout->storage.u.compact.dirty = TRUE; /* Indicate that we should initialize storage space */ @@ -2313,9 +2330,9 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hb case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HDassert("not implemented yet" && 0); + assert("not implemented yet" && 0); #ifdef NDEBUG - HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout") + HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout"); #endif /* NDEBUG */ } /* end switch */ /*lint !e788 All appropriate cases are covered */ @@ -2333,25 +2350,25 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hb */ if (!(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_INCR && time_alloc == H5D_ALLOC_WRITE)) - if (H5D__init_storage(io_info, full_overwrite, old_dim) < 0) + if (H5D__init_storage(dset, full_overwrite, old_dim) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize dataset with fill value") + "unable to initialize dataset with fill value"); } /* end if */ else { H5D_fill_value_t fill_status; /* The fill value status */ /* Check the dataset's fill-value status */ if (H5P_is_fill_value_defined(&dset->shared->dcpl_cache.fill, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined"); /* If we are filling the dataset on allocation or "if set" and * the fill value _is_ set, do that now */ if (dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC || (dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)) - if (H5D__init_storage(io_info, full_overwrite, old_dim) < 0) + if (H5D__init_storage(dset, full_overwrite, old_dim) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize dataset with fill value") + "unable to initialize dataset with fill value"); } /* end else */ } /* end if */ @@ -2365,7 +2382,7 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hb if (time_alloc != H5D_ALLOC_CREATE && addr_set) /* Mark the layout as dirty, for later writing to the file */ if (H5D__mark(dset, H5D_MARK_LAYOUT) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty"); } /* end if */ done: @@ -2383,14 +2400,13 @@ H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hb *------------------------------------------------------------------------- */ static herr_t -H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]) +H5D__init_storage(H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[]) { - const H5D_t *dset = io_info->dset; /* dataset pointer */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - HDassert(dset); + assert(dset); switch (dset->shared->layout.type) { case H5D_COMPACT: @@ -2399,7 +2415,7 @@ H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t /* Fill the compact dataset storage */ if (H5D__compact_fill(dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize compact dataset storage") + "unable to initialize compact dataset storage"); } /* end if */ break; @@ -2408,8 +2424,8 @@ H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t /* If we will be immediately overwriting the values, don't bother to clear them */ if ((dset->shared->dcpl_cache.efl.nused == 0 || dset->shared->dcpl_cache.fill.buf) && !full_overwrite) - if (H5D__contig_fill(io_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset") + if (H5D__contig_fill(dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset"); break; case H5D_CHUNKED: @@ -2424,8 +2440,8 @@ H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t if (old_dim == NULL) old_dim = zero_dim; - if (H5D__chunk_allocate(io_info, full_overwrite, old_dim) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset") + if (H5D__chunk_allocate(dset, full_overwrite, old_dim) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset"); break; } /* end block */ @@ -2435,9 +2451,9 @@ H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HDassert("not implemented yet" && 0); + assert("not implemented yet" && 0); #ifdef NDEBUG - HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout") + HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout"); #endif /* NDEBUG */ } /* end switch */ /*lint !e788 All appropriate cases are covered */ @@ -2466,7 +2482,7 @@ H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size) if ((*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) { if (H5D__chunk_allocated(dset, storage_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "can't retrieve chunked dataset allocated size") + "can't retrieve chunked dataset allocated size"); } /* end if */ else *storage_size = 0; @@ -2493,7 +2509,7 @@ H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset type"); } /*lint !e788 All appropriate cases are covered */ done: @@ -2519,7 +2535,7 @@ H5D__get_offset(const H5D_t *dset) FUNC_ENTER_PACKAGE - HDassert(dset); + assert(dset); switch (dset->shared->layout.type) { case H5D_VIRTUAL: @@ -2532,7 +2548,7 @@ H5D__get_offset(const H5D_t *dset) * an external file, the value will be HADDR_UNDEF. */ if (dset->shared->dcpl_cache.efl.nused == 0 || - H5F_addr_defined(dset->shared->layout.storage.u.contig.addr)) + H5_addr_defined(dset->shared->layout.storage.u.contig.addr)) /* Return the absolute dataset offset from the beginning of file. */ ret_value = dset->shared->layout.storage.u.contig.addr + H5F_BASE_ADDR(dset->oloc.file); break; @@ -2540,7 +2556,7 @@ H5D__get_offset(const H5D_t *dset) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "unknown dataset layout type"); } done: @@ -2571,7 +2587,7 @@ H5D__vlen_get_buf_size_alloc(size_t size, void *info) if (size > vlen_bufsize_com->vl_tbuf_size) { if (NULL == (vlen_bufsize_com->vl_tbuf = H5FL_BLK_REALLOC(vlen_vl_buf, vlen_bufsize_com->vl_tbuf, size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't reallocate temporary VL data buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't reallocate temporary VL data buffer"); vlen_bufsize_com->vl_tbuf_size = size; } /* end if */ @@ -2599,23 +2615,31 @@ H5D__vlen_get_buf_size_cb(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ const hsize_t *point, void *op_data) { H5D_vlen_bufsize_native_t *vlen_bufsize = (H5D_vlen_bufsize_native_t *)op_data; - herr_t ret_value = H5_ITER_CONT; /* Return value */ + H5D_dset_io_info_t dset_info; /* Internal multi-dataset info placeholder */ + herr_t ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(H5I_DATATYPE == H5I_get_type(type_id)); - HDassert(point); - HDassert(op_data); + assert(H5I_DATATYPE == H5I_get_type(type_id)); + assert(point); + assert(op_data); /* Select point to read in */ if (H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5_ITER_ERROR, "can't select point") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, H5_ITER_ERROR, "can't select point"); - /* Read in the point (with the custom VL memory allocator) */ - if (H5D__read(vlen_bufsize->dset, type_id, vlen_bufsize->mspace, vlen_bufsize->fspace, - vlen_bufsize->common.fl_tbuf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, H5_ITER_ERROR, "can't read point") + { + dset_info.dset = vlen_bufsize->dset; + dset_info.mem_space = vlen_bufsize->mspace; + dset_info.file_space = vlen_bufsize->fspace; + dset_info.buf.vp = vlen_bufsize->common.fl_tbuf; + dset_info.mem_type_id = type_id; + + /* Read in the point (with the custom VL memory allocator) */ + if (H5D__read(1, &dset_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -2640,9 +2664,6 @@ H5D__vlen_get_buf_size_cb(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned H5_ * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Wednesday, August 11, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -2661,35 +2682,35 @@ H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size /* Check args */ if (NULL == (type = (H5T_t *)H5I_object(type_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype"); if (NULL == (space = (H5S_t *)H5I_object(space_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace"); if (!(H5S_has_extent(space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set"); /* Save the dataset */ vlen_bufsize.dset = dset; /* Get a copy of the dataset's dataspace */ if (NULL == (fspace = H5S_copy(dset->shared->space, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to get dataspace"); vlen_bufsize.fspace = fspace; /* Create a scalar for the memory dataspace */ if (NULL == (mspace = H5S_create(H5S_SCALAR))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace"); vlen_bufsize.mspace = mspace; /* Grab the temporary buffers required */ if (NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available"); if (NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "no temporary buffers available"); vlen_bufsize.common.vl_tbuf_size = 1; /* Set the memory manager to the special allocation routine */ if (H5CX_set_vlen_alloc_info(H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine"); /* Set the initial number of bytes required */ vlen_bufsize.common.size = 0; @@ -2707,9 +2728,9 @@ H5D__vlen_get_buf_size(H5D_t *dset, hid_t type_id, hid_t space_id, hsize_t *size done: if (fspace && H5S_close(fspace) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); if (mspace && H5S_close(mspace) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); if (vlen_bufsize.common.fl_tbuf != NULL) vlen_bufsize.common.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.common.fl_tbuf); if (vlen_bufsize.common.vl_tbuf != NULL) @@ -2750,27 +2771,27 @@ H5D__vlen_get_buf_size_gen_cb(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(point); - HDassert(op_data); + assert(point); + assert(op_data); /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object(type_id))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a datatype"); /* Make certain there is enough fixed-length buffer available */ if (NULL == (vlen_bufsize->common.fl_tbuf = H5FL_BLK_REALLOC(vlen_fl_buf, vlen_bufsize->common.fl_tbuf, H5T_get_size(dt)))) - HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf") + HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't resize tbuf"); /* Select point to read in */ if (H5S_select_elements(vlen_bufsize->fspace, H5S_SELECT_SET, (size_t)1, point) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't select point"); /* Read in the point (with the custom VL memory allocator) */ - if (H5VL_dataset_read(vlen_bufsize->dset_vol_obj, type_id, vlen_bufsize->mspace_id, - vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, vlen_bufsize->common.fl_tbuf, + if (H5VL_dataset_read(1, &vlen_bufsize->dset_vol_obj, &type_id, &vlen_bufsize->mspace_id, + &vlen_bufsize->fspace_id, vlen_bufsize->dxpl_id, &vlen_bufsize->common.fl_tbuf, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read point"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2784,9 +2805,6 @@ H5D__vlen_get_buf_size_gen_cb(void H5_ATTR_UNUSED *elem, hid_t type_id, unsigned * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Friday, December 20, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2807,14 +2825,14 @@ H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id /* Check args */ if (NULL == (type = (H5T_t *)H5I_object(type_id))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not an valid datatype") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not an valid datatype"); if (NULL == (space = (H5S_t *)H5I_object(space_id))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "invalid dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "invalid dataspace"); if (!(H5S_has_extent(space))) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dataspace does not have extent set") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dataspace does not have extent set"); /* Save the dataset */ - vlen_bufsize.dset_vol_obj = vol_obj; + vlen_bufsize.dset_vol_obj = (const H5VL_object_t *)vol_obj; /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_GET_SPACE; @@ -2822,33 +2840,33 @@ H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id /* Get a copy of the dataset's dataspace */ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace"); vlen_bufsize.fspace_id = vol_cb_args.args.get_space.space_id; if (NULL == (vlen_bufsize.fspace = (H5S_t *)H5I_object(vlen_bufsize.fspace_id))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataspace"); /* Create a scalar for the memory dataspace */ if (NULL == (mspace = H5S_create(H5S_SCALAR))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create dataspace"); if ((vlen_bufsize.mspace_id = H5I_register(H5I_DATASPACE, mspace, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); /* Grab the temporary buffers required */ if (NULL == (vlen_bufsize.common.fl_tbuf = H5FL_BLK_MALLOC(vlen_fl_buf, H5T_get_size(type)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available"); if (NULL == (vlen_bufsize.common.vl_tbuf = H5FL_BLK_MALLOC(vlen_vl_buf, (size_t)1))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "no temporary buffers available"); vlen_bufsize.common.vl_tbuf_size = 1; /* Set the VL allocation callbacks on a DXPL */ if (NULL == (dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get default DXPL"); if ((vlen_bufsize.dxpl_id = H5P_copy_plist(dxpl, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy property list"); if (NULL == (dxpl = (H5P_genplist_t *)H5I_object(vlen_bufsize.dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get copied DXPL"); if (H5P_set_vlen_mem_manager(dxpl, H5D__vlen_get_buf_size_alloc, &vlen_bufsize.common, NULL, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VL data allocation routine on DXPL"); /* Set the initial number of bytes required */ vlen_bufsize.common.size = 0; @@ -2867,29 +2885,29 @@ H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id done: if (vlen_bufsize.fspace_id >= 0) { if (H5I_dec_app_ref(vlen_bufsize.fspace_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id"); vlen_bufsize.fspace = NULL; } /* end if */ if (vlen_bufsize.fspace && H5S_close(vlen_bufsize.fspace) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); if (vlen_bufsize.mspace_id >= 0) { if (H5I_dec_app_ref(vlen_bufsize.mspace_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "problem freeing id"); mspace = NULL; } /* end if */ if (mspace && H5S_close(mspace) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); if (vlen_bufsize.common.fl_tbuf != NULL) vlen_bufsize.common.fl_tbuf = H5FL_BLK_FREE(vlen_fl_buf, vlen_bufsize.common.fl_tbuf); if (vlen_bufsize.common.vl_tbuf != NULL) vlen_bufsize.common.vl_tbuf = H5FL_BLK_FREE(vlen_vl_buf, vlen_bufsize.common.vl_tbuf); if (vlen_bufsize.dxpl_id != H5I_INVALID_HID) { if (H5I_dec_app_ref(vlen_bufsize.dxpl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close property list"); dxpl = NULL; } /* end if */ if (dxpl && H5P_close(dxpl) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release DXPL") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release DXPL"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__vlen_get_buf_size_gen() */ @@ -2911,7 +2929,7 @@ H5D__check_filters(H5D_t *dataset) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dataset); + assert(dataset); /* Check if the filters in the DCPL will need to encode, and if so, can they? * @@ -2924,7 +2942,7 @@ H5D__check_filters(H5D_t *dataset) /* Retrieve the "defined" status of the fill value */ if (H5P_is_fill_value_defined(fill, &fill_status) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Couldn't retrieve fill value from dataset.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Couldn't retrieve fill value from dataset."); /* See if we can check the filter status */ if (fill_status == H5D_FILL_VALUE_DEFAULT || fill_status == H5D_FILL_VALUE_USER_DEFINED) { @@ -2932,7 +2950,7 @@ H5D__check_filters(H5D_t *dataset) (fill->fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)) { /* Filters must have encoding enabled. Ensure that all filters can be applied */ if (H5Z_can_apply(dataset->shared->dcpl_id, dataset->shared->type_id) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "can't apply filters") + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "can't apply filters"); dataset->shared->checked_filters = TRUE; } /* end if */ @@ -2964,23 +2982,23 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Check args */ - HDassert(dset); - HDassert(size); + assert(dset); + assert(size); /* Check if we are allowed to modify this file */ if (0 == (H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file"); /* Check if we are allowed to modify the space; only datasets with chunked and external storage are * allowed to be modified */ if (H5D_COMPACT == dset->shared->layout.type) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataset has compact storage") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "dataset has compact storage"); if (H5D_CONTIGUOUS == dset->shared->layout.type && 0 == dset->shared->dcpl_cache.efl.nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "dataset has contiguous storage") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "dataset has contiguous storage"); /* Check if the filters in the DCPL will need to encode, and if so, can they? */ if (H5D__check_filters(dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't apply filters") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't apply filters"); /* Keep the current dataspace dimensions for later */ HDcompile_assert(sizeof(curr_dims) == sizeof(dset->shared->curr_dims)); @@ -2988,7 +3006,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) /* Modify the size of the dataspace */ if ((changed = H5S_set_extent(dset->shared->space, size)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace"); /* Don't bother updating things, unless they've changed */ if (changed) { @@ -3010,7 +3028,8 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) /* Compute the scaled dimension size value */ if (dset->shared->layout.u.chunk.dim[dim_idx] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", dim_idx) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", + dim_idx); scaled = size[dim_idx] / dset->shared->layout.u.chunk.dim[dim_idx]; @@ -3030,7 +3049,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) update_chunks = TRUE; if (!(scaled_power2up = H5VM_power2up(scaled))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2"); /* Check if the number of bits required to encode the scaled size value changed */ if (dset->shared->cache.chunk.scaled_power2up[dim_idx] != scaled_power2up) { @@ -3057,13 +3076,13 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) if (H5D_CHUNKED == dset->shared->layout.type) { /* Set the cached chunk info */ if (H5D__chunk_set_info(dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to update # of chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to update # of chunks"); /* Check if updating the chunk cache indices is necessary */ if (update_chunks) /* Update the chunk cache indices */ if (H5D__chunk_update_cache(dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update cached chunk indices"); } /* end if */ /* Operations for virtual datasets */ @@ -3072,21 +3091,21 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) if (H5D_virtual_check_min_dims(dset) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "virtual dataset dimensions not large enough to contain all limited dimensions " - "in all selections") + "in all selections"); /* Patch the virtual selection dataspaces */ for (u = 0; u < dset->shared->layout.storage.u.virt.list_nused; u++) { /* Patch extent */ if (H5S_set_extent(dset->shared->layout.storage.u.virt.list[u].source_dset.virtual_select, size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace"); dset->shared->layout.storage.u.virt.list[u].virtual_space_status = H5O_VIRTUAL_STATUS_CORRECT; /* Patch sub-source datasets */ for (v = 0; v < dset->shared->layout.storage.u.virt.list[u].sub_dset_nused; v++) if (H5S_set_extent(dset->shared->layout.storage.u.virt.list[u].sub_dset[v].virtual_select, size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace"); } /* end for */ /* Mark virtual datasets as not fully initialized so internal @@ -3095,14 +3114,10 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) } /* end if */ /* Allocate space for the new parts of the dataset, if appropriate */ - if (expand && dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY) { - H5D_io_info_t io_info; + if (expand && dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY) + if (H5D__alloc_storage(dset, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage"); - io_info.dset = dset; - - if (H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage") - } /*------------------------------------------------------------------------- * Remove chunk information in the case of chunked datasets * This removal takes place only in case we are shrinking the dataset @@ -3115,7 +3130,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) (*dset->shared->layout.ops->is_data_cached)(dset->shared)))) /* Remove excess chunks */ if (H5D__chunk_prune_by_extent(dset, curr_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks"); /* Update chunks that are no longer edge chunks as a result of * expansion */ @@ -3123,12 +3138,12 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) (dset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) && (dset->shared->dcpl_cache.pline.nused > 0)) if (H5D__chunk_update_old_edge_chunks(dset, curr_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to do update old edge chunks") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to do update old edge chunks"); } /* end if */ /* Mark the dataspace as dirty, for later writing to the file */ if (H5D__mark(dset, H5D_MARK_SPACE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty"); } /* end if */ done: @@ -3152,18 +3167,18 @@ H5D__flush_sieve_buf(H5D_t *dataset) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dataset); + assert(dataset); /* Flush the raw data buffer, if we have a dirty one */ if (dataset->shared->cache.contig.sieve_buf && dataset->shared->cache.contig.sieve_dirty) { - HDassert(dataset->shared->layout.type != - H5D_COMPACT); /* We should never have a sieve buffer for compact storage */ + assert(dataset->shared->layout.type != + H5D_COMPACT); /* We should never have a sieve buffer for compact storage */ /* Write dirty data sieve buffer to file */ if (H5F_shared_block_write( H5F_SHARED(dataset->oloc.file), H5FD_MEM_DRAW, dataset->shared->cache.contig.sieve_loc, dataset->shared->cache.contig.sieve_size, dataset->shared->cache.contig.sieve_buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "block write failed"); /* Reset sieve buffer dirty flag */ dataset->shared->cache.contig.sieve_dirty = FALSE; @@ -3190,14 +3205,14 @@ H5D__flush_real(H5D_t *dataset) FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* Check args */ - HDassert(dataset); - HDassert(dataset->shared); + assert(dataset); + assert(dataset->shared); /* Avoid flushing the dataset (again) if it's closing */ if (!dataset->shared->closing) /* Flush cached raw data for each kind of dataset layout */ if (dataset->shared->layout.ops->flush && (dataset->shared->layout.ops->flush)(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush raw data") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush raw data"); done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -3220,21 +3235,21 @@ H5D__flush(H5D_t *dset, hid_t dset_id) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dset); - HDassert(dset->shared); + assert(dset); + assert(dset->shared); /* Currently, H5Oflush causes H5Fclose to trigger an assertion failure in metadata cache. * Leave this situation for the future solution */ if (H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI)) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "H5Oflush isn't supported for parallel") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "H5Oflush isn't supported for parallel"); /* Flush any dataset information still cached in memory */ if (H5D__flush_real(dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush cached dataset info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush cached dataset info"); /* Flush object's metadata to file */ if (H5O_flush_common(&dset->oloc, dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset and object flush callback") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset and object flush callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3264,14 +3279,14 @@ H5D__format_convert(H5D_t *dataset) FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) /* Check args */ - HDassert(dataset); + assert(dataset); switch (dataset->shared->layout.type) { case H5D_CHUNKED: - HDassert(dataset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE); + assert(dataset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE); if (NULL == (newlayout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer"); /* Set up the current index info */ idx_info.f = dataset->oloc.file; @@ -3299,38 +3314,38 @@ H5D__format_convert(H5D_t *dataset) if (new_idx_info.storage->ops->init && (new_idx_info.storage->ops->init)(&new_idx_info, dataset->shared->space, dataset->oloc.addr) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize indexing information"); init_new_index = TRUE; /* If the current chunk index exists */ - if (H5F_addr_defined(idx_info.storage->idx_addr)) { + if (H5_addr_defined(idx_info.storage->idx_addr)) { /* Create v1 B-tree chunk index */ if ((new_idx_info.storage->ops->create)(&new_idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create chunk index"); /* Iterate over the chunks in the current index and insert the chunk addresses * into the version 1 B-tree chunk index */ if (H5D__chunk_format_convert(dataset, &idx_info, &new_idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate/convert chunk index") + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate/convert chunk index"); } /* end if */ /* Delete the old "current" layout message */ if (H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message"); delete_old_layout = TRUE; /* Append the new layout message to the object header */ if (H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, newlayout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout header message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout header message"); add_new_layout = TRUE; /* Release the old (current) chunk index */ if (idx_info.storage->ops->dest && (idx_info.storage->ops->dest)(&idx_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info"); /* Copy the new layout to the dataset's layout */ H5MM_memcpy(&dataset->shared->layout, newlayout, sizeof(H5O_layout_t)); @@ -3339,22 +3354,22 @@ H5D__format_convert(H5D_t *dataset) case H5D_CONTIGUOUS: case H5D_COMPACT: - HDassert(dataset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT); + assert(dataset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT); dataset->shared->layout.version = H5O_LAYOUT_VERSION_DEFAULT; if (H5O_msg_write(&(dataset->oloc), H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &(dataset->shared->layout)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message"); break; case H5D_VIRTUAL: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "virtual dataset layout not supported") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "virtual dataset layout not supported"); case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type"); default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type"); } /* end switch */ done: @@ -3362,30 +3377,30 @@ H5D__format_convert(H5D_t *dataset) /* Remove new layout message */ if (add_new_layout) if (H5O_msg_remove(&dataset->oloc, H5O_LAYOUT_ID, H5O_ALL, FALSE) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message") + HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete layout message"); /* Add back old layout message */ if (delete_old_layout) if (H5O_msg_create(&dataset->oloc, H5O_LAYOUT_ID, 0, H5O_UPDATE_TIME, &dataset->shared->layout) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to add layout header message") + HDONE_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to add layout header message"); /* Clean up v1 b-tree chunk index */ if (init_new_index) { - if (H5F_addr_defined(new_idx_info.storage->idx_addr)) { + if (H5_addr_defined(new_idx_info.storage->idx_addr)) { /* Check for valid address i.e. tag */ - if (!H5F_addr_defined(dataset->oloc.addr)) - HDONE_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "address undefined") + if (!H5_addr_defined(dataset->oloc.addr)) + HDONE_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "address undefined"); /* Expunge from cache all v1 B-tree type entries associated with tag */ if (H5AC_expunge_tag_type_metadata(dataset->oloc.file, dataset->oloc.addr, H5AC_BT_ID, H5AC__NO_FLAGS_SET)) - HDONE_ERROR(H5E_DATASET, H5E_CANTEXPUNGE, FAIL, "unable to expunge index metadata") + HDONE_ERROR(H5E_DATASET, H5E_CANTEXPUNGE, FAIL, "unable to expunge index metadata"); } /* end if */ /* Delete v1 B-tree chunk index */ if (new_idx_info.storage->ops->dest && (new_idx_info.storage->ops->dest)(&new_idx_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info"); } /* end if */ } /* end if */ @@ -3413,8 +3428,8 @@ H5D__mark(const H5D_t *dataset, unsigned flags) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dataset); - HDassert(!(flags & (unsigned)~(H5D_MARK_SPACE | H5D_MARK_LAYOUT))); + assert(dataset); + assert(!(flags & (unsigned)~(H5D_MARK_SPACE | H5D_MARK_LAYOUT))); /* Mark aspects of the dataset as dirty */ if (flags) { @@ -3422,12 +3437,12 @@ H5D__mark(const H5D_t *dataset, unsigned flags) /* Pin the object header */ if (NULL == (oh = H5O_pin(&dataset->oloc))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTPIN, FAIL, "unable to pin dataset object header"); /* Update the layout on disk, if it's been changed */ if (flags & H5D_MARK_LAYOUT) { if (H5D__layout_oh_write(dataset, oh, update_flags) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout info") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout info"); /* Reset the "update the modification time" flag, so we only do it once */ update_flags = 0; @@ -3436,21 +3451,21 @@ H5D__mark(const H5D_t *dataset, unsigned flags) /* Update the dataspace on disk, if it's been changed */ if (flags & H5D_MARK_SPACE) { if (H5S_write(dataset->oloc.file, oh, update_flags, dataset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update file with new dataspace"); /* Reset the "update the modification time" flag, so we only do it once */ update_flags = 0; } /* end if */ /* _Somebody_ should have update the modification time! */ - HDassert(update_flags == 0); + assert(update_flags == 0); } /* end if */ done: /* Release pointer to object header */ if (oh != NULL) if (H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header") + HDONE_ERROR(H5E_DATASET, H5E_CANTUNPIN, FAIL, "unable to unpin dataset object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__mark() */ @@ -3474,14 +3489,14 @@ H5D__flush_all_cb(void *_dataset, hid_t H5_ATTR_UNUSED id, void *_udata) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dataset); - HDassert(f); + assert(dataset); + assert(f); /* Check for dataset in same file */ if (f == dataset->oloc.file) /* Flush the dataset's information */ if (H5D__flush_real(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to flush cached dataset info") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to flush cached dataset info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3504,11 +3519,11 @@ H5D_flush_all(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(f); + assert(f); /* Iterate over all the open datasets */ if (H5I_iterate(H5I_DATASET, H5D__flush_all_cb, f, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to flush cached dataset info") + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to flush cached dataset info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3528,11 +3543,11 @@ H5D_flush_all(H5F_t *f) hid_t H5D_get_create_plist(const H5D_t *dset) { - H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */ - H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */ - H5O_layout_t copied_layout; /* Layout to tweak */ - H5O_fill_t copied_fill; /* Fill value to tweak */ - H5O_efl_t copied_efl; /* External file list to tweak */ + H5P_genplist_t *dcpl_plist; /* Dataset's DCPL */ + H5P_genplist_t *new_plist; /* Copy of dataset's DCPL */ + H5O_layout_t copied_layout; /* Layout to tweak */ + H5O_fill_t copied_fill = {0}; /* Fill value to tweak */ + H5O_efl_t copied_efl; /* External file list to tweak */ hid_t new_dcpl_id = FAIL; hid_t ret_value = H5I_INVALID_HID; /* Return value */ @@ -3540,28 +3555,28 @@ H5D_get_create_plist(const H5D_t *dset) /* Check args */ if (NULL == (dcpl_plist = (H5P_genplist_t *)H5I_object(dset->shared->dcpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list"); /* Copy the creation property list */ if ((new_dcpl_id = H5P_copy_plist(dcpl_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to copy the creation property list") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to copy the creation property list"); if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dcpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list"); /* Retrieve any object creation properties */ if (H5O_get_create_plist(&dset->oloc, new_plist) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object creation info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object creation info"); /* Get the layout property */ if (H5P_peek(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get layout"); /* Reset layout values set when dataset is created */ copied_layout.ops = NULL; switch (copied_layout.type) { case H5D_COMPACT: copied_layout.storage.u.compact.buf = H5MM_xfree(copied_layout.storage.u.compact.buf); - HDmemset(&copied_layout.storage.u.compact, 0, sizeof(copied_layout.storage.u.compact)); + memset(&copied_layout.storage.u.compact, 0, sizeof(copied_layout.storage.u.compact)); break; case H5D_CONTIGUOUS: @@ -3578,7 +3593,7 @@ H5D_get_create_plist(const H5D_t *dset) /* Reset address and pointer of the array struct for the chunked storage index */ if (H5D_chunk_idx_reset(&copied_layout.storage.u.chunk, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to reset chunked storage index in dest") + "unable to reset chunked storage index in dest"); /* Reset chunk index ops */ copied_layout.storage.u.chunk.ops = NULL; @@ -3592,16 +3607,16 @@ H5D_get_create_plist(const H5D_t *dset) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HDassert(0 && "Unknown layout type!"); + assert(0 && "Unknown layout type!"); } /* end switch */ /* Set back the (possibly modified) layout property to property list */ if (H5P_poke(new_plist, H5D_CRT_LAYOUT_NAME, &copied_layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set layout") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set layout"); /* Get the fill value property */ if (H5P_peek(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fill value"); /* Check if there is a fill value, but no type yet */ if (copied_fill.buf != NULL && copied_fill.type == NULL) { @@ -3609,12 +3624,12 @@ H5D_get_create_plist(const H5D_t *dset) /* Copy the dataset type into the fill value message */ if (NULL == (copied_fill.type = H5T_copy(dset->shared->type, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy dataset datatype for fill value") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy dataset datatype for fill value"); /* Set up type conversion function */ if (NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, - "unable to convert between src and dest data types") + "unable to convert between src and dest data types"); /* Convert disk form of fill value into memory form */ if (!H5T_path_noop(tpath)) { @@ -3625,11 +3640,11 @@ H5D_get_create_plist(const H5D_t *dset) /* Wrap copies of types to convert */ dst_id = H5I_register(H5I_DATATYPE, H5T_copy(copied_fill.type, H5T_COPY_TRANSIENT), FALSE); if (dst_id < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy/register datatype"); src_id = H5I_register(H5I_DATATYPE, H5T_copy(dset->shared->type, H5T_COPY_ALL), FALSE); if (src_id < 0) { H5I_dec_ref(dst_id); - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy/register datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy/register datatype"); } /* end if */ /* Allocate a background buffer */ @@ -3637,7 +3652,7 @@ H5D_get_create_plist(const H5D_t *dset) if (H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) { H5I_dec_ref(src_id); H5I_dec_ref(dst_id); - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed"); } /* end if */ /* Convert fill value */ @@ -3647,14 +3662,14 @@ H5D_get_create_plist(const H5D_t *dset) H5I_dec_ref(dst_id); if (bkg_buf) bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); } /* end if */ /* Release local resources */ if (H5I_dec_ref(src_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object"); if (H5I_dec_ref(dst_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object"); if (bkg_buf) bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); } /* end if */ @@ -3662,11 +3677,11 @@ H5D_get_create_plist(const H5D_t *dset) /* Set back the (possibly modified) fill value property to property list */ if (H5P_poke(new_plist, H5D_CRT_FILL_VALUE_NAME, &copied_fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set fill value") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set fill value"); /* Get the fill value property */ if (H5P_peek(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &copied_efl) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get external file list") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get external file list"); /* Reset efl name_offset and heap_addr, these are the values when the dataset is created */ if (copied_efl.slot) { @@ -3679,16 +3694,20 @@ H5D_get_create_plist(const H5D_t *dset) /* Set back the (possibly modified) external file list property to property list */ if (H5P_poke(new_plist, H5D_CRT_EXT_FILE_LIST_NAME, &copied_efl) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set external file list") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set external file list"); /* Set the return value */ ret_value = new_dcpl_id; done: - if (ret_value < 0) + if (ret_value < 0) { if (new_dcpl_id > 0) if (H5I_dec_app_ref(new_dcpl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to close temporary object"); + + if (copied_fill.type && (H5T_close_real(copied_fill.type) < 0)) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't free temporary datatype"); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_get_create_plist() */ @@ -3720,87 +3739,87 @@ H5D_get_access_plist(const H5D_t *dset) /* Make a copy of the dataset's dataset access property list */ if (NULL == (old_plist = (H5P_genplist_t *)H5I_object(dset->shared->dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list"); if ((new_dapl_id = H5P_copy_plist(old_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy dataset access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't copy dataset access property list"); if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_dapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* If the dataset is chunked then copy the rdcc & append flush parameters. * Otherwise, use the default values. */ if (dset->shared->layout.type == H5D_CHUNKED) { if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(dset->shared->cache.chunk.nslots)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots"); if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(dset->shared->cache.chunk.nbytes_max)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size"); if (H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &(dset->shared->cache.chunk.w0)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks"); if (H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &dset->shared->append_flush) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set append flush property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set append flush property"); } else { /* Get the default FAPL */ if (NULL == (def_dapl = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a property list"); /* Set the data cache number of slots to the value of the default FAPL */ if (H5P_get(def_dapl, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data number of slots"); if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, &def_chunk_info.nslots) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache number of slots") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache number of slots"); /* Set the data cache byte size to the value of the default FAPL */ if (H5P_get(def_dapl, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data cache byte size"); if (H5P_set(new_plist, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, &def_chunk_info.nbytes_max) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache byte size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set data cache byte size"); /* Set the preempt read chunks property to the value of the default FAPL */ if (H5P_get(def_dapl, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get preempt read chunks"); if (H5P_set(new_plist, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, &def_chunk_info.w0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set preempt read chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set preempt read chunks"); /* Set the append flush property to its default value */ if (H5P_set(new_plist, H5D_ACS_APPEND_FLUSH_NAME, &def_append_flush_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set append flush property") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set append flush property"); } /* end if-else */ /* If the dataset is virtual then copy the VDS view & printf gap options. * Otherwise, use the default values. */ if (dset->shared->layout.type == H5D_VIRTUAL) { if (H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &(dset->shared->layout.storage.u.virt.view)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS view") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS view"); if (H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &(dset->shared->layout.storage.u.virt.printf_gap)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap"); } else { /* Get the default FAPL if necessary */ if (!def_dapl && NULL == (def_dapl = (H5P_genplist_t *)H5I_object(H5P_LST_DATASET_ACCESS_ID_g))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a property list"); /* Set the data cache number of slots to the value of the default FAPL */ if (H5P_get(def_dapl, H5D_ACS_VDS_VIEW_NAME, &def_vds_view) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS view"); if (H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &def_vds_view) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VDS view") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VDS view"); /* Set the data cache byte size to the value of the default FAPL */ if (H5P_get(def_dapl, H5D_ACS_VDS_PRINTF_GAP_NAME, &def_vds_gap) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS printf gap"); if (H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &def_vds_gap) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VDS printf gap") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set VDS printf gap"); } /* Set the vds prefix option */ if (H5P_set(new_plist, H5D_ACS_VDS_PREFIX_NAME, &(dset->shared->vds_prefix)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vds prefix") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set vds prefix"); /* Set the external file prefix option */ if (H5P_set(new_plist, H5D_ACS_EFILE_PREFIX_NAME, &(dset->shared->extfile_prefix)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file prefix") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file prefix"); /* Set the return value */ ret_value = new_dapl_id; @@ -3809,7 +3828,7 @@ H5D_get_access_plist(const H5D_t *dset) if (ret_value < 0) if (new_dapl_id > 0) if (H5I_dec_app_ref(new_dapl_id) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't free") + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't free"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_get_access_plist() */ @@ -3834,21 +3853,21 @@ H5D__get_space(const H5D_t *dset) /* If the layout is virtual, update the extent */ if (dset->shared->layout.type == H5D_VIRTUAL) if (H5D__virtual_set_extent_unlim(dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update virtual dataset extent") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update virtual dataset extent"); /* Read the dataspace message and return a dataspace object */ if (NULL == (space = H5S_copy(dset->shared->space, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get dataspace"); /* Create an ID */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace"); done: if (ret_value < 0) if (space != NULL) if (H5S_close(space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__get_space() */ @@ -3873,19 +3892,19 @@ H5D__get_type(const H5D_t *dset) /* Patch the datatype's "top level" file pointer */ if (H5T_patch_file(dset->shared->type, dset->oloc.file) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to patch datatype's file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to patch datatype's file pointer"); /* Copy the dataset's datatype */ if (NULL == (dt = H5T_copy_reopen(dset->shared->type))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy datatype"); /* Mark any datatypes as being in memory now */ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); /* Lock copied type */ if (H5T_lock(dt, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to lock transient datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to lock transient datatype"); /* Create an ID */ if (H5T_is_named(dt)) { @@ -3894,15 +3913,15 @@ H5D__get_type(const H5D_t *dset) * returned datatype. */ if ((ret_value = H5VL_wrap_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register datatype") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register datatype"); } /* end if */ else if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register datatype") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register datatype"); done: if (ret_value < 0) if (dt && H5T_close(dt) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__get_type() */ @@ -3925,30 +3944,30 @@ H5D__refresh(H5D_t *dset, hid_t dset_id) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); - HDassert(dset->shared); + assert(dset); + assert(dset->shared); /* If the layout is virtual... */ if (dset->shared->layout.type == H5D_VIRTUAL) { /* Hold open the source datasets' files */ if (H5D__virtual_hold_source_dset_files(dset, &head) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, FAIL, "unable to hold VDS source files open") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, FAIL, "unable to hold VDS source files open"); virt_dsets_held = TRUE; /* Refresh source datasets for virtual dataset */ if (H5D__virtual_refresh_source_dsets(dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh VDS source datasets") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh VDS source datasets"); } /* end if */ /* Refresh dataset object */ if ((H5O_refresh_metadata(&dset->oloc, dset_id)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh dataset"); done: /* Release hold on (source) virtual datasets' files */ if (virt_dsets_held) if (H5D__virtual_release_source_dset_files(head) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__refresh() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dio.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dio.c index c1427d150c..b978139a8a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dio.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dio.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -44,15 +43,16 @@ /********************/ /* Setup/teardown routines */ -static herr_t H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info, H5D_storage_t *store, +static herr_t H5D__ioinfo_init(size_t count, H5D_io_op_type_t op_type, H5D_dset_io_info_t *dset_info, H5D_io_info_t *io_info); -static herr_t H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, - H5D_type_info_t *type_info); +static herr_t H5D__dset_ioinfo_init(H5D_t *dset, H5D_dset_io_info_t *dset_info, H5D_storage_t *store); +static herr_t H5D__typeinfo_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, hid_t mem_type_id); +static herr_t H5D__typeinfo_init_phase2(H5D_io_info_t *io_info); +static herr_t H5D__typeinfo_init_phase3(H5D_io_info_t *io_info); #ifdef H5_HAVE_PARALLEL -static herr_t H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_space, - const H5S_t *mem_space, const H5D_type_info_t *type_info); +static herr_t H5D__ioinfo_adjust(H5D_io_info_t *io_info); #endif /* H5_HAVE_PARALLEL */ -static herr_t H5D__typeinfo_term(const H5D_type_info_t *type_info); +static herr_t H5D__typeinfo_term(H5D_io_info_t *io_info); /*********************/ /* Package Variables */ @@ -65,538 +65,939 @@ static herr_t H5D__typeinfo_term(const H5D_type_info_t *type_info); /* Declare a free list to manage blocks of type conversion data */ H5FL_BLK_DEFINE(type_conv); -/* Declare a free list to manage the H5D_chunk_map_t struct */ -H5FL_DEFINE(H5D_chunk_map_t); - /*------------------------------------------------------------------------- * Function: H5D__read * - * Purpose: Reads (part of) a DATASET into application memory BUF. See - * H5Dread() for complete details. + * Purpose: Reads multiple (parts of) DATASETs into application memory BUFs. + * See H5Dread_multi() for complete details. * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 - * *------------------------------------------------------------------------- */ herr_t -H5D__read(H5D_t *dataset, hid_t mem_type_id, H5S_t *mem_space, H5S_t *file_space, void *buf /*out*/) +H5D__read(size_t count, H5D_dset_io_info_t *dset_info) { - H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */ - H5D_io_info_t io_info; /* Dataset I/O info */ - H5D_type_info_t type_info; /* Datatype info for operation */ - H5D_layout_t layout_type; /* Dataset's layout type (contig, chunked, compact, etc.) */ - hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */ - H5S_t *projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */ - /* projection of the supplied mem_space to a new */ - /* dataspace with rank equal to that of */ - /* file_space. */ - /* */ - /* This field is only used if */ - /* H5S_select_shape_same() returns TRUE when */ - /* comparing the mem_space and the data_space, */ - /* and the mem_space have different rank. */ - /* */ - /* Note that if this variable is used, the */ - /* projected mem space must be discarded at the */ - /* end of the function to avoid a memory leak. */ - H5D_storage_t store; /* union of EFL and chunk pointer in file space */ - hsize_t nelmts; /* total number of elmts */ - hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */ - char fake_char; /* Temporary variable for NULL buffer pointers */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) + H5D_io_info_t io_info; /* Dataset I/O info for multi dsets */ + H5S_t *orig_mem_space_local; /* Local buffer for orig_mem_space */ + H5S_t **orig_mem_space = NULL; /* If not NULL, ptr to an array of dataspaces */ + /* containing the original memory spaces contained */ + /* in dset_info. This is needed in order to */ + /* restore the original state of dset_info if we */ + /* replaced any mem spaces with equivalents */ + /* projected to a rank equal to that of file_space. */ + /* */ + /* This field is only used if */ + /* H5S_select_shape_same() returns TRUE when */ + /* comparing at least one mem_space and data_space, */ + /* and the mem_space has a different rank. */ + /* */ + /* Note that this is a temporary variable - the */ + /* projected memory space is stored in dset_info, */ + /* and will be freed when that structure is */ + /* freed. */ + H5D_storage_t store_local; /* Local buffer for store */ + H5D_storage_t *store = &store_local; /* Union of EFL and chunk pointer in file space */ + size_t io_op_init = 0; /* Number I/O ops that have been initialized */ + size_t io_skipped = + 0; /* Number I/O ops that have been skipped (due to the dataset not being allocated) */ + size_t i; /* Local index variable */ + char fake_char; /* Temporary variable for NULL buffer pointers */ + herr_t ret_value = SUCCEED; /* Return value */ - /* check args */ - HDassert(dataset && dataset->oloc.file); - HDassert(file_space); - HDassert(mem_space); + FUNC_ENTER_NOAPI(FAIL) - layout_type = dataset->shared->layout.type; + /* Init io_info */ + if (H5D__ioinfo_init(count, H5D_IO_OP_READ, dset_info, &io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info"); - /* Set up datatype info for operation */ - if (H5D__typeinfo_init(dataset, mem_type_id, FALSE, &type_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info") - type_info_init = TRUE; + /* Allocate store buffer if necessary */ + if (count > 1) + if (NULL == (store = (H5D_storage_t *)H5MM_malloc(count * sizeof(H5D_storage_t)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate dset storage info array buffer"); #ifdef H5_HAVE_PARALLEL - /* Check for non-MPI-based VFD */ - if (!(H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI))) { + /* Check for non-MPI-based VFD. Only need to check first dataset since all + * share the same file. */ + if (!(H5F_HAS_FEATURE(dset_info[0].dset->oloc.file, H5FD_FEAT_HAS_MPI))) { H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */ /* Get I/O transfer mode */ if (H5CX_get_io_xfer_mode(&io_xfer_mode) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); /* Collective access is not permissible without a MPI based VFD */ if (io_xfer_mode == H5FD_MPIO_COLLECTIVE) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based drivers only"); } /* end if */ #endif /*H5_HAVE_PARALLEL*/ - /* Make certain that the number of elements in each selection is the same */ - nelmts = H5S_GET_SELECT_NPOINTS(mem_space); - if (nelmts != H5S_GET_SELECT_NPOINTS(file_space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "src and dest dataspaces have different number of elements selected") - - /* Check for a NULL buffer */ - if (NULL == buf) { - /* Check for any elements selected (which is invalid) */ - if (nelmts > 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer") - - /* If the buffer is nil, and 0 element is selected, make a fake buffer. - * This is for some MPI package like ChaMPIon on NCSA's tungsten which - * doesn't support this feature. + /* iterate over all dsets and construct I/O information necessary to do I/O */ + for (i = 0; i < count; i++) { + haddr_t prev_tag = HADDR_UNDEF; + + /* check args */ + if (NULL == dset_info[i].dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); + if (NULL == dset_info[i].dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); + + /* set metadata tagging with dset oheader addr */ + H5AC_tag(dset_info[i].dset->oloc.addr, &prev_tag); + + /* Set up datatype info for operation */ + if (H5D__typeinfo_init(&io_info, &(dset_info[i]), dset_info[i].mem_type_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info"); + + /* Make certain that the number of elements in each selection is the same, and cache nelmts in + * dset_info */ + dset_info[i].nelmts = H5S_GET_SELECT_NPOINTS(dset_info[i].mem_space); + if (dset_info[i].nelmts != H5S_GET_SELECT_NPOINTS(dset_info[i].file_space)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "src and dest dataspaces have different number of elements selected"); + + /* Check for a NULL buffer */ + if (NULL == dset_info[i].buf.vp) { + /* Check for any elements selected (which is invalid) */ + if (dset_info[i].nelmts > 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer"); + + /* If the buffer is nil, and 0 element is selected, make a fake buffer. + * This is for some MPI package like ChaMPIon on NCSA's tungsten which + * doesn't support this feature. + */ + dset_info[i].buf.vp = &fake_char; + } /* end if */ + + /* Make sure that both selections have their extents set */ + if (!(H5S_has_extent(dset_info[i].file_space))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set"); + if (!(H5S_has_extent(dset_info[i].mem_space))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set"); + + /* H5S_select_shape_same() has been modified to accept topologically identical + * selections with different rank as having the same shape (if the most + * rapidly changing coordinates match up), but the I/O code still has + * difficulties with the notion. + * + * To solve this, we check to see if H5S_select_shape_same() returns true, + * and if the ranks of the mem and file spaces are different. If they are, + * construct a new mem space that is equivalent to the old mem space, and + * use that instead. + * + * Note that in general, this requires us to touch up the memory buffer as + * well. */ - buf = &fake_char; - } /* end if */ + if (dset_info[i].nelmts > 0 && + TRUE == H5S_SELECT_SHAPE_SAME(dset_info[i].mem_space, dset_info[i].file_space) && + H5S_GET_EXTENT_NDIMS(dset_info[i].mem_space) != H5S_GET_EXTENT_NDIMS(dset_info[i].file_space)) { + ptrdiff_t buf_adj = 0; + + /* Allocate original memory space buffer if necessary */ + if (!orig_mem_space) { + if (count > 1) { + /* Allocate buffer */ + if (NULL == (orig_mem_space = (H5S_t **)H5MM_calloc(count * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, + "couldn't allocate original memory space array buffer"); + } + else + /* Use local buffer */ + orig_mem_space = &orig_mem_space_local; + } - /* Make sure that both selections have their extents set */ - if (!(H5S_has_extent(file_space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set") - if (!(H5S_has_extent(mem_space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set") - - /* H5S_select_shape_same() has been modified to accept topologically identical - * selections with different rank as having the same shape (if the most - * rapidly changing coordinates match up), but the I/O code still has - * difficulties with the notion. - * - * To solve this, we check to see if H5S_select_shape_same() returns true, - * and if the ranks of the mem and file spaces are different. If they are, - * construct a new mem space that is equivalent to the old mem space, and - * use that instead. - * - * Note that in general, this requires us to touch up the memory buffer as - * well. - */ - if (nelmts > 0 && TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) && - H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) { - ptrdiff_t buf_adj = 0; - - /* Attempt to construct projected dataspace for memory dataspace */ - if (H5S_select_construct_projection(mem_space, &projected_mem_space, - (unsigned)H5S_GET_EXTENT_NDIMS(file_space), - type_info.dst_type_size, &buf_adj) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to construct projected memory dataspace") - HDassert(projected_mem_space); - - /* Adjust the buffer by the given amount */ - buf = (void *)(((uint8_t *)buf) + buf_adj); - - /* Switch to using projected memory dataspace & adjusted buffer */ - mem_space = projected_mem_space; - } /* end if */ + /* Save original memory space */ + orig_mem_space[i] = dset_info[i].mem_space; + dset_info[i].mem_space = NULL; - /* Retrieve dataset properties */ - /* */ + /* Attempt to construct projected dataspace for memory dataspace */ + if (H5S_select_construct_projection(orig_mem_space[i], &dset_info[i].mem_space, + (unsigned)H5S_GET_EXTENT_NDIMS(dset_info[i].file_space), + (hsize_t)dset_info[i].type_info.dst_type_size, &buf_adj) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to construct projected memory dataspace"); + assert(dset_info[i].mem_space); - /* If space hasn't been allocated and not using external storage, - * return fill value to buffer if fill time is upon allocation, or - * do nothing if fill time is never. If the dataset is compact and - * fill time is NEVER, there is no way to tell whether part of data - * has been overwritten. So just proceed in reading. - */ - if (nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 && - !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) && - !(dataset->shared->layout.ops->is_data_cached && - (*dataset->shared->layout.ops->is_data_cached)(dataset->shared))) { - H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */ - - /* Retrieve dataset's fill-value properties */ - if (H5P_is_fill_value_defined(&dataset->shared->dcpl_cache.fill, &fill_status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined") - - /* Should be impossible, but check anyway... */ - if (fill_status == H5D_FILL_VALUE_UNDEFINED && - (dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC || - dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET)) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, - "read failed: dataset doesn't exist, no data can be read") - - /* If we're never going to fill this dataset, just leave the junk in the user's buffer */ - if (dataset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_NEVER) - HGOTO_DONE(SUCCEED) - - /* Go fill the user's selection with the dataset's fill value */ - if (H5D__fill(dataset->shared->dcpl_cache.fill.buf, dataset->shared->type, buf, type_info.mem_type, - mem_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed") - else - HGOTO_DONE(SUCCEED) - } /* end if */ + /* Adjust the buffer by the given amount */ + dset_info[i].buf.vp = (void *)(((uint8_t *)dset_info[i].buf.vp) + buf_adj); + } /* end if */ - /* Set up I/O operation */ - io_info.op_type = H5D_IO_OP_READ; - io_info.u.rbuf = buf; - if (H5D__ioinfo_init(dataset, &type_info, &store, &io_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation") - - /* Sanity check that space is allocated, if there are elements */ - if (nelmts > 0) - HDassert((*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) || - (dataset->shared->layout.ops->is_data_cached && - (*dataset->shared->layout.ops->is_data_cached)(dataset->shared)) || - dataset->shared->dcpl_cache.efl.nused > 0 || layout_type == H5D_COMPACT); - - /* Allocate the chunk map */ - if (H5D_CONTIGUOUS != layout_type && H5D_COMPACT != layout_type) { - if (NULL == (fm = H5FL_CALLOC(H5D_chunk_map_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk map") - } + /* If space hasn't been allocated and not using external storage, + * return fill value to buffer if fill time is upon allocation, or + * do nothing if fill time is never. If the dataset is compact and + * fill time is NEVER, there is no way to tell whether part of data + * has been overwritten. So just proceed in reading. + */ + if (dset_info[i].nelmts > 0 && dset_info[i].dset->shared->dcpl_cache.efl.nused == 0 && + !(*dset_info[i].dset->shared->layout.ops->is_space_alloc)( + &dset_info[i].dset->shared->layout.storage) && + !(dset_info[i].dset->shared->layout.ops->is_data_cached && + (*dset_info[i].dset->shared->layout.ops->is_data_cached)(dset_info[i].dset->shared))) { + H5D_fill_value_t fill_status; /* Whether/How the fill value is defined */ + + /* Retrieve dataset's fill-value properties */ + if (H5P_is_fill_value_defined(&dset_info[i].dset->shared->dcpl_cache.fill, &fill_status) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined"); + + /* Should be impossible, but check anyway... */ + if (fill_status == H5D_FILL_VALUE_UNDEFINED && + (dset_info[i].dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC || + dset_info[i].dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET)) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, + "read failed: dataset doesn't exist, no data can be read"); + + /* If we're never going to fill this dataset, just leave the junk in the user's buffer */ + if (dset_info[i].dset->shared->dcpl_cache.fill.fill_time != H5D_FILL_TIME_NEVER) + /* Go fill the user's selection with the dataset's fill value */ + if (H5D__fill(dset_info[i].dset->shared->dcpl_cache.fill.buf, dset_info[i].dset->shared->type, + dset_info[i].buf.vp, dset_info[i].type_info.mem_type, + dset_info[i].mem_space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed"); + + /* No need to perform any more I/O for this dataset */ + dset_info[i].skip_io = TRUE; + io_skipped++; + } /* end if */ + else { + /* Set up I/O operation */ + if (H5D__dset_ioinfo_init(dset_info[i].dset, &(dset_info[i]), &(store[i])) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation"); + + /* Sanity check that space is allocated, if there are elements */ + if (dset_info[i].nelmts > 0) + assert( + (*dset_info[i].dset->shared->layout.ops->is_space_alloc)( + &dset_info[i].dset->shared->layout.storage) || + (dset_info[i].dset->shared->layout.ops->is_data_cached && + (*dset_info[i].dset->shared->layout.ops->is_data_cached)(dset_info[i].dset->shared)) || + dset_info[i].dset->shared->dcpl_cache.efl.nused > 0 || + dset_info[i].dset->shared->layout.type == H5D_COMPACT); + + /* Call storage method's I/O initialization routine */ + if (dset_info[i].layout_ops.io_init && + (dset_info[i].layout_ops.io_init)(&io_info, &(dset_info[i])) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info"); + dset_info[i].skip_io = FALSE; + io_op_init++; + + /* Reset metadata tagging */ + H5AC_tag(prev_tag, NULL); + } + } /* end of for loop */ + + assert(io_op_init + io_skipped == count); + + /* If no datasets have I/O, we're done */ + if (io_op_init == 0) + HGOTO_DONE(SUCCEED); + + /* Perform second phase of type info initialization */ + if (H5D__typeinfo_init_phase2(&io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info (second phase)"); + +#ifdef H5_HAVE_PARALLEL + /* Adjust I/O info for any parallel or selection I/O */ + if (H5D__ioinfo_adjust(&io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to adjust I/O info for parallel or selection I/O"); +#endif /* H5_HAVE_PARALLEL */ + + /* Perform third phase of type info initialization */ + if (H5D__typeinfo_init_phase3(&io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info (third phase)"); + + H5CX_set_no_selection_io_cause(io_info.no_selection_io_cause); + + /* If multi dataset I/O callback is not provided, perform read IO via + * single-dset path with looping */ + if (io_info.md_io_ops.multi_read_md) { + /* Create sel_pieces array if any pieces are selected */ + if (io_info.piece_count > 0) { + assert(!io_info.sel_pieces); + assert(io_info.pieces_added == 0); + + /* Allocate sel_pieces array */ + if (NULL == + (io_info.sel_pieces = H5MM_malloc(io_info.piece_count * sizeof(io_info.sel_pieces[0])))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate array of selected pieces"); + } + + /* MDIO-specific second phase initialization */ + for (i = 0; i < count; i++) + if (dset_info[i].layout_ops.mdio_init) { + haddr_t prev_tag = HADDR_UNDEF; + + /* set metadata tagging with dset oheader addr */ + H5AC_tag(dset_info[i].dset->oloc.addr, &prev_tag); - /* Call storage method's I/O initialization routine */ - if (io_info.layout_ops.io_init && - (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info") - io_op_init = TRUE; + /* Make second phase IO init call */ + if ((dset_info[i].layout_ops.mdio_init)(&io_info, &(dset_info[i])) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't populate array of selected pieces"); + + /* Reset metadata tagging */ + H5AC_tag(prev_tag, NULL); + } + + /* Invoke correct "high level" I/O routine */ + if ((*io_info.md_io_ops.multi_read_md)(&io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data"); + } /* end if */ + else { + haddr_t prev_tag = HADDR_UNDEF; + + /* Allocate selection I/O parameter arrays if necessary */ + if (!H5D_LAYOUT_CB_PERFORM_IO(&io_info) && io_info.piece_count > 0) { + if (NULL == (io_info.mem_spaces = H5MM_malloc(io_info.piece_count * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for memory space list"); + if (NULL == (io_info.file_spaces = H5MM_malloc(io_info.piece_count * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for file space list"); + if (NULL == (io_info.addrs = H5MM_malloc(io_info.piece_count * sizeof(haddr_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for piece address list"); + if (NULL == (io_info.element_sizes = H5MM_malloc(io_info.piece_count * sizeof(size_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for element size list"); + if (NULL == (io_info.rbufs = H5MM_malloc(io_info.piece_count * sizeof(void *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for read buffer list"); + if (io_info.max_tconv_type_size > 0) + if (NULL == + (io_info.sel_pieces = H5MM_malloc(io_info.piece_count * sizeof(io_info.sel_pieces[0])))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "unable to allocate array of selected pieces"); + } + + /* Loop with serial & single-dset read IO path */ + for (i = 0; i < count; i++) { + /* Check for skipped I/O */ + if (dset_info[i].skip_io) + continue; + + /* set metadata tagging with dset oheader addr */ + H5AC_tag(dset_info[i].dset->oloc.addr, &prev_tag); + + /* Invoke correct "high level" I/O routine */ + if ((*dset_info[i].io_ops.multi_read)(&io_info, &dset_info[i]) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data"); + + /* Reset metadata tagging */ + H5AC_tag(prev_tag, NULL); + } + + /* Make final selection I/O call if the multi_read callbacks did not perform the actual I/O + * (if using selection I/O and either multi dataset or type conversion) */ + if (!H5D_LAYOUT_CB_PERFORM_IO(&io_info)) { + /* Check for type conversion */ + if (io_info.max_tconv_type_size > 0) { + /* Type conversion pathway */ + if (H5D__scatgath_read_select(&io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "type conversion selection read failed"); + } + else { + /* Call selection I/O directly */ + H5_CHECK_OVERFLOW(io_info.pieces_added, size_t, uint32_t); + if (H5F_shared_select_read(io_info.f_sh, H5FD_MEM_DRAW, (uint32_t)io_info.pieces_added, + io_info.mem_spaces, io_info.file_spaces, io_info.addrs, + io_info.element_sizes, io_info.rbufs) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "selection read failed"); + } + } #ifdef H5_HAVE_PARALLEL - /* Adjust I/O info for any parallel I/O */ - if (H5D__ioinfo_adjust(&io_info, dataset, file_space, mem_space, &type_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to adjust I/O info for parallel I/O") -#endif /*H5_HAVE_PARALLEL*/ + /* Report the actual I/O mode to the application if appropriate */ + if (io_info.using_mpi_vfd) { + H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request */ + + /* Get the parallel I/O transfer mode */ + if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); + + /* Only report the collective I/O mode if we're actually performing collective I/O */ + if (xfer_mode == H5FD_MPIO_COLLECTIVE) { + H5CX_set_mpio_actual_io_mode(io_info.actual_io_mode); - /* Invoke correct "high level" I/O routine */ - if ((*io_info.io_ops.multi_read)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") + /* If we did selection I/O, report that we used "link chunk" mode, since that's the most + * analogous to what selection I/O does */ + if (io_info.use_select_io == H5D_SELECTION_IO_MODE_ON) + H5CX_set_mpio_actual_chunk_opt(H5D_MPIO_LINK_CHUNK); + } + } +#endif /* H5_HAVE_PARALLEL */ + } done: /* Shut down the I/O op information */ - if (io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(fm) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info") - if (fm) - fm = H5FL_FREE(H5D_chunk_map_t, fm); + for (i = 0; i < io_op_init; i++) + if (!dset_info[i].skip_io && dset_info[i].layout_ops.io_term && + (*dset_info[i].layout_ops.io_term)(&io_info, &(dset_info[i])) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info"); /* Shut down datatype info for operation */ - if (type_info_init && H5D__typeinfo_term(&type_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info") + if (H5D__typeinfo_term(&io_info) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info"); + + /* Discard projected mem spaces and restore originals */ + if (orig_mem_space) { + for (i = 0; i < count; i++) + if (orig_mem_space[i]) { + if (H5S_close(dset_info[i].mem_space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, + "unable to shut down projected memory dataspace"); + dset_info[i].mem_space = orig_mem_space[i]; + } + + /* Free orig_mem_space array if it was allocated */ + if (orig_mem_space != &orig_mem_space_local) + H5MM_free(orig_mem_space); + } + + /* Free global piece array */ + H5MM_xfree(io_info.sel_pieces); - /* discard projected mem space if it was created */ - if (NULL != projected_mem_space) - if (H5S_close(projected_mem_space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down projected memory dataspace") + /* Free selection I/O arrays */ + H5MM_xfree(io_info.mem_spaces); + H5MM_xfree(io_info.file_spaces); + H5MM_xfree(io_info.addrs); + H5MM_xfree(io_info.element_sizes); + H5MM_xfree(io_info.rbufs); - FUNC_LEAVE_NOAPI_TAG(ret_value) + /* Free store array if it was allocated */ + if (store != &store_local) + H5MM_free(store); + + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__read() */ /*------------------------------------------------------------------------- * Function: H5D__write * - * Purpose: Writes (part of) a DATASET to a file from application memory - * BUF. See H5Dwrite() for complete details. + * Purpose: Writes multiple (part of) DATASETs to a file from application + * memory BUFs. See H5Dwrite_multi() for complete details. * - * Return: Non-negative on success/Negative on failure + * This was referred from H5D__write for multi-dset work. * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ herr_t -H5D__write(H5D_t *dataset, hid_t mem_type_id, H5S_t *mem_space, H5S_t *file_space, const void *buf) +H5D__write(size_t count, H5D_dset_io_info_t *dset_info) { - H5D_chunk_map_t *fm = NULL; /* Chunk file<->memory mapping */ - H5D_io_info_t io_info; /* Dataset I/O info */ - H5D_type_info_t type_info; /* Datatype info for operation */ - H5D_layout_t layout_type; /* Dataset's layout type (contig, chunked, compact, etc.) */ - hbool_t type_info_init = FALSE; /* Whether the datatype info has been initialized */ - hbool_t should_alloc_space = FALSE; /* Whether or not to initialize dataset's storage */ - H5S_t *projected_mem_space = NULL; /* If not NULL, ptr to dataspace containing a */ - /* projection of the supplied mem_space to a new */ - /* dataspace with rank equal to that of */ - /* file_space. */ - /* */ - /* This field is only used if */ - /* H5S_select_shape_same() returns TRUE when */ - /* comparing the mem_space and the data_space, */ - /* and the mem_space have different rank. */ - /* */ - /* Note that if this variable is used, the */ - /* projected mem space must be discarded at the */ - /* end of the function to avoid a memory leak. */ - H5D_storage_t store; /* union of EFL and chunk pointer in file space */ - hsize_t nelmts; /* total number of elmts */ - hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */ - char fake_char; /* Temporary variable for NULL buffer pointers */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr) + H5D_io_info_t io_info; /* Dataset I/O info for multi dsets */ + H5S_t *orig_mem_space_local; /* Local buffer for orig_mem_space */ + H5S_t **orig_mem_space = NULL; /* If not NULL, ptr to an array of dataspaces */ + /* containing the original memory spaces contained */ + /* in dset_info. This is needed in order to */ + /* restore the original state of dset_info if we */ + /* replaced any mem spaces with equivalents */ + /* projected to a rank equal to that of file_space. */ + /* */ + /* This field is only used if */ + /* H5S_select_shape_same() returns TRUE when */ + /* comparing at least one mem_space and data_space, */ + /* and the mem_space has a different rank. */ + /* */ + /* Note that this is a temporary variable - the */ + /* projected memory space is stored in dset_info, */ + /* and will be freed when that structure is */ + /* freed. */ + H5D_storage_t store_local; /* Local buffer for store */ + H5D_storage_t *store = &store_local; /* Union of EFL and chunk pointer in file space */ + size_t io_op_init = 0; /* Number I/O ops that have been initialized */ + size_t i; /* Local index variable */ + char fake_char; /* Temporary variable for NULL buffer pointers */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Init io_info */ + if (H5D__ioinfo_init(count, H5D_IO_OP_WRITE, dset_info, &io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info"); + + /* Allocate store buffer if necessary */ + if (count > 1) + if (NULL == (store = (H5D_storage_t *)H5MM_malloc(count * sizeof(H5D_storage_t)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate dset storage info array buffer"); + + /* iterate over all dsets and construct I/O information */ + for (i = 0; i < count; i++) { + hbool_t should_alloc_space = FALSE; /* Whether or not to initialize dataset's storage */ + haddr_t prev_tag = HADDR_UNDEF; + + /* check args */ + if (NULL == dset_info[i].dset) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); + if (NULL == dset_info[i].dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); + + /* set metadata tagging with dset oheader addr */ + H5AC_tag(dset_info[i].dset->oloc.addr, &prev_tag); + + /* All filters in the DCPL must have encoding enabled. */ + if (!dset_info[i].dset->shared->checked_filters) { + if (H5Z_can_apply(dset_info[i].dset->shared->dcpl_id, dset_info[i].dset->shared->type_id) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "can't apply filters"); + + dset_info[i].dset->shared->checked_filters = TRUE; + } /* end if */ - /* check args */ - HDassert(dataset && dataset->oloc.file); - HDassert(file_space); - HDassert(mem_space); + /* Check if we are allowed to write to this file */ + if (0 == (H5F_INTENT(dset_info[i].dset->oloc.file) & H5F_ACC_RDWR)) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file"); - layout_type = dataset->shared->layout.type; + /* Set up datatype info for operation */ + if (H5D__typeinfo_init(&io_info, &(dset_info[i]), dset_info[i].mem_type_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info"); - /* All filters in the DCPL must have encoding enabled. */ - if (!dataset->shared->checked_filters) { - if (H5Z_can_apply(dataset->shared->dcpl_id, dataset->shared->type_id) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "can't apply filters") + /* Various MPI based checks */ +#ifdef H5_HAVE_PARALLEL + if (H5F_HAS_FEATURE(dset_info[i].dset->oloc.file, H5FD_FEAT_HAS_MPI)) { + /* If MPI based VFD is used, no VL or region reference datatype support yet. */ + /* This is because they use the global heap in the file and we don't */ + /* support parallel access of that yet */ + if (H5T_is_vl_storage(dset_info[i].type_info.mem_type) > 0) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "Parallel IO does not support writing VL or region reference datatypes yet"); + } /* end if */ + else { + H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */ + + /* Get I/O transfer mode */ + if (H5CX_get_io_xfer_mode(&io_xfer_mode) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); + + /* Collective access is not permissible without a MPI based VFD */ + if (io_xfer_mode == H5FD_MPIO_COLLECTIVE) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, + "collective access for MPI-based driver only"); + } /* end else */ +#endif /*H5_HAVE_PARALLEL*/ + + /* Make certain that the number of elements in each selection is the same, and cache nelmts in + * dset_info */ + dset_info[i].nelmts = H5S_GET_SELECT_NPOINTS(dset_info[i].mem_space); + if (dset_info[i].nelmts != H5S_GET_SELECT_NPOINTS(dset_info[i].file_space)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "src and dest dataspaces have different number of elements selected"); + + /* Check for a NULL buffer */ + if (NULL == dset_info[i].buf.cvp) { + /* Check for any elements selected (which is invalid) */ + if (dset_info[i].nelmts > 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer"); + + /* If the buffer is nil, and 0 element is selected, make a fake buffer. + * This is for some MPI package like ChaMPIon on NCSA's tungsten which + * doesn't support this feature. + */ + dset_info[i].buf.cvp = &fake_char; + } /* end if */ - dataset->shared->checked_filters = TRUE; - } /* end if */ + /* Make sure that both selections have their extents set */ + if (!(H5S_has_extent(dset_info[i].file_space))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set"); + if (!(H5S_has_extent(dset_info[i].mem_space))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set"); + + /* H5S_select_shape_same() has been modified to accept topologically + * identical selections with different rank as having the same shape + * (if the most rapidly changing coordinates match up), but the I/O + * code still has difficulties with the notion. + * + * To solve this, we check to see if H5S_select_shape_same() returns + * true, and if the ranks of the mem and file spaces are different. + * If they are, construct a new mem space that is equivalent to the + * old mem space, and use that instead. + * + * Note that in general, this requires us to touch up the memory buffer + * as well. + */ + if (dset_info[i].nelmts > 0 && + TRUE == H5S_SELECT_SHAPE_SAME(dset_info[i].mem_space, dset_info[i].file_space) && + H5S_GET_EXTENT_NDIMS(dset_info[i].mem_space) != H5S_GET_EXTENT_NDIMS(dset_info[i].file_space)) { + ptrdiff_t buf_adj = 0; + + /* Allocate original memory space buffer if necessary */ + if (!orig_mem_space) { + if (count > 1) { + /* Allocate buffer */ + if (NULL == (orig_mem_space = (H5S_t **)H5MM_calloc(count * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, + "couldn't allocate original memory space array buffer"); + } + else + /* Use local buffer */ + orig_mem_space = &orig_mem_space_local; + } - /* Check if we are allowed to write to this file */ - if (0 == (H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "no write intent on file") + /* Save original memory space */ + orig_mem_space[i] = dset_info[i].mem_space; + dset_info[i].mem_space = NULL; - /* Set up datatype info for operation */ - if (H5D__typeinfo_init(dataset, mem_type_id, TRUE, &type_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info") - type_info_init = TRUE; + /* Attempt to construct projected dataspace for memory dataspace */ + if (H5S_select_construct_projection(orig_mem_space[i], &dset_info[i].mem_space, + (unsigned)H5S_GET_EXTENT_NDIMS(dset_info[i].file_space), + dset_info[i].type_info.src_type_size, &buf_adj) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to construct projected memory dataspace"); + assert(dset_info[i].mem_space); - /* Various MPI based checks */ -#ifdef H5_HAVE_PARALLEL - if (H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI)) { - /* If MPI based VFD is used, no VL or region reference datatype support yet. */ - /* This is because they use the global heap in the file and we don't */ - /* support parallel access of that yet */ - if (H5T_is_vl_storage(type_info.mem_type) > 0) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, - "Parallel IO does not support writing VL or region reference datatypes yet") - } /* end if */ - else { - H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */ + /* Adjust the buffer by the given amount */ + dset_info[i].buf.cvp = (const void *)(((const uint8_t *)dset_info[i].buf.cvp) + buf_adj); + } /* end if */ - /* Get I/O transfer mode */ - if (H5CX_get_io_xfer_mode(&io_xfer_mode) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + /* Retrieve dataset properties */ + /* */ - /* Collective access is not permissible without a MPI based VFD */ - if (io_xfer_mode == H5FD_MPIO_COLLECTIVE) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "collective access for MPI-based driver only") - } /* end else */ -#endif /*H5_HAVE_PARALLEL*/ + /* Set up I/O operation */ + if (H5D__dset_ioinfo_init(dset_info[i].dset, &(dset_info[i]), &(store[i])) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up I/O operation"); + + /* Allocate dataspace and initialize it if it hasn't been. */ + should_alloc_space = dset_info[i].dset->shared->dcpl_cache.efl.nused == 0 && + !(*dset_info[i].dset->shared->layout.ops->is_space_alloc)( + &dset_info[i].dset->shared->layout.storage); - /* Make certain that the number of elements in each selection is the same */ - nelmts = H5S_GET_SELECT_NPOINTS(mem_space); - if (nelmts != H5S_GET_SELECT_NPOINTS(file_space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "src and dest dataspaces have different number of elements selected") - - /* Check for a NULL buffer */ - if (NULL == buf) { - /* Check for any elements selected (which is invalid) */ - if (nelmts > 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer") - - /* If the buffer is nil, and 0 element is selected, make a fake buffer. - * This is for some MPI package like ChaMPIon on NCSA's tungsten which - * doesn't support this feature. + /* + * If not using an MPI-based VFD, we only need to allocate + * and initialize storage if there's a selection in the + * dataset's dataspace. Otherwise, we always need to participate + * in the storage allocation since this may use collective + * operations and we will hang if we don't participate. */ - buf = &fake_char; - } /* end if */ + if (!H5F_HAS_FEATURE(dset_info[i].dset->oloc.file, H5FD_FEAT_HAS_MPI)) + should_alloc_space = should_alloc_space && (dset_info[i].nelmts > 0); - /* Make sure that both selections have their extents set */ - if (!(H5S_has_extent(file_space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file dataspace does not have extent set") - if (!(H5S_has_extent(mem_space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "memory dataspace does not have extent set") - - /* H5S_select_shape_same() has been modified to accept topologically - * identical selections with different rank as having the same shape - * (if the most rapidly changing coordinates match up), but the I/O - * code still has difficulties with the notion. - * - * To solve this, we check to see if H5S_select_shape_same() returns - * true, and if the ranks of the mem and file spaces are different. - * If the are, construct a new mem space that is equivalent to the - * old mem space, and use that instead. - * - * Note that in general, this requires us to touch up the memory buffer - * as well. - */ - if (nelmts > 0 && TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) && - H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) { - ptrdiff_t buf_adj = 0; - - /* Attempt to construct projected dataspace for memory dataspace */ - if (H5S_select_construct_projection(mem_space, &projected_mem_space, - (unsigned)H5S_GET_EXTENT_NDIMS(file_space), - type_info.src_type_size, &buf_adj) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to construct projected memory dataspace") - HDassert(projected_mem_space); - - /* Adjust the buffer by the given amount */ - buf = (const void *)(((const uint8_t *)buf) + buf_adj); - - /* Switch to using projected memory dataspace & adjusted buffer */ - mem_space = projected_mem_space; - } /* end if */ + if (should_alloc_space) { + hssize_t file_nelmts; /* Number of elements in file dataset's dataspace */ + hbool_t full_overwrite; /* Whether we are over-writing all the elements */ - /* Retrieve dataset properties */ - /* */ - - /* Set up I/O operation */ - io_info.op_type = H5D_IO_OP_WRITE; - io_info.u.wbuf = buf; - if (H5D__ioinfo_init(dataset, &type_info, &store, &io_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up I/O operation") - - /* Allocate dataspace and initialize it if it hasn't been. */ - should_alloc_space = dataset->shared->dcpl_cache.efl.nused == 0 && - !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage); - - /* - * If not using an MPI-based VFD, we only need to allocate - * and initialize storage if there's a selection in the - * dataset's dataspace. Otherwise, we always need to participate - * in the storage allocation since this may use collective - * operations and we will hang if we don't participate. - */ - if (!H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI)) - should_alloc_space = should_alloc_space && (nelmts > 0); - - if (should_alloc_space) { - hssize_t file_nelmts; /* Number of elements in file dataset's dataspace */ - hbool_t full_overwrite; /* Whether we are over-writing all the elements */ - - /* Get the number of elements in file dataset's dataspace */ - if ((file_nelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "can't retrieve number of elements in file dataset") - - /* Always allow fill values to be written if the dataset has a VL datatype */ - if (H5T_detect_class(dataset->shared->type, H5T_VLEN, FALSE)) - full_overwrite = FALSE; - else - full_overwrite = (hbool_t)((hsize_t)file_nelmts == nelmts ? TRUE : FALSE); - - /* Allocate storage */ - if (H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, full_overwrite, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") - } /* end if */ + /* Get the number of elements in file dataset's dataspace */ + if ((file_nelmts = H5S_GET_EXTENT_NPOINTS(dset_info[i].file_space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, + "can't retrieve number of elements in file dataset"); - /* Allocate the chunk map */ - if (H5D_CONTIGUOUS != layout_type && H5D_COMPACT != layout_type) { - if (NULL == (fm = H5FL_CALLOC(H5D_chunk_map_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk map") - } + /* Always allow fill values to be written if the dataset has a VL datatype */ + if (H5T_detect_class(dset_info[i].dset->shared->type, H5T_VLEN, FALSE)) + full_overwrite = FALSE; + else + full_overwrite = (hbool_t)((hsize_t)file_nelmts == dset_info[i].nelmts ? TRUE : FALSE); + + /* Allocate storage */ + if (H5D__alloc_storage(dset_info[i].dset, H5D_ALLOC_WRITE, full_overwrite, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage"); + } /* end if */ + + /* Call storage method's I/O initialization routine */ + /* Init io_info.dset_info[] and generate piece_info in skip list */ + if (dset_info[i].layout_ops.io_init && + (*dset_info[i].layout_ops.io_init)(&io_info, &(dset_info[i])) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info"); + dset_info[i].skip_io = FALSE; + io_op_init++; + + /* Reset metadata tagging */ + H5AC_tag(prev_tag, NULL); + } /* end of for loop */ - /* Call storage method's I/O initialization routine */ - if (io_info.layout_ops.io_init && - (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize I/O info") - io_op_init = TRUE; + assert(io_op_init == count); + + /* Perform second phase of type info initialization */ + if (H5D__typeinfo_init_phase2(&io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info (second phase)"); #ifdef H5_HAVE_PARALLEL - /* Adjust I/O info for any parallel I/O */ - if (H5D__ioinfo_adjust(&io_info, dataset, file_space, mem_space, &type_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to adjust I/O info for parallel I/O") -#endif /*H5_HAVE_PARALLEL*/ + /* Adjust I/O info for any parallel or selection I/O */ + if (H5D__ioinfo_adjust(&io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to adjust I/O info for parallel or selection I/O"); +#endif /* H5_HAVE_PARALLEL */ - /* Invoke correct "high level" I/O routine */ - if ((*io_info.io_ops.multi_write)(&io_info, &type_info, nelmts, file_space, mem_space, fm) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") - -#ifdef OLD_WAY - /* - * This was taken out because it can be called in a parallel program with - * independent access, causing the metadata cache to get corrupted. Its been - * disabled for all types of access (serial as well as parallel) to make the - * modification time consistent for all programs. -QAK - * - * We should set a value in the dataset's shared information instead and flush - * it to the file when the dataset is being closed. -QAK - */ - /* - * Update modification time. We have to do this explicitly because - * writing to a dataset doesn't necessarily change the object header. - */ - if (H5O_touch(&(dataset->oloc), FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time") -#endif /* OLD_WAY */ + /* Perform third phase of type info initialization */ + if (H5D__typeinfo_init_phase3(&io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up type info (third phase)"); + + H5CX_set_no_selection_io_cause(io_info.no_selection_io_cause); + + /* If multi dataset I/O callback is not provided, perform write IO via + * single-dset path with looping */ + if (io_info.md_io_ops.multi_write_md) { + /* Create sel_pieces array if any pieces are selected */ + if (io_info.piece_count > 0) { + assert(!io_info.sel_pieces); + assert(io_info.pieces_added == 0); + + /* Allocate sel_pieces array */ + if (NULL == + (io_info.sel_pieces = H5MM_malloc(io_info.piece_count * sizeof(io_info.sel_pieces[0])))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate array of selected pieces"); + } + + /* MDIO-specific second phase initialization */ + for (i = 0; i < count; i++) + if (dset_info[i].layout_ops.mdio_init) { + haddr_t prev_tag = HADDR_UNDEF; + + /* set metadata tagging with dset oheader addr */ + H5AC_tag(dset_info[i].dset->oloc.addr, &prev_tag); + + /* Make second phase IO init call */ + if ((dset_info[i].layout_ops.mdio_init)(&io_info, &(dset_info[i])) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't populate array of selected pieces"); + + /* Reset metadata tagging */ + H5AC_tag(prev_tag, NULL); + } + + /* Invoke correct "high level" I/O routine */ + if ((*io_info.md_io_ops.multi_write_md)(&io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data"); + } /* end if */ + else { + haddr_t prev_tag = HADDR_UNDEF; + + /* Allocate selection I/O parameter arrays if necessary */ + if (!H5D_LAYOUT_CB_PERFORM_IO(&io_info) && io_info.piece_count > 0) { + if (NULL == (io_info.mem_spaces = H5MM_malloc(io_info.piece_count * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for memory space list"); + if (NULL == (io_info.file_spaces = H5MM_malloc(io_info.piece_count * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for file space list"); + if (NULL == (io_info.addrs = H5MM_malloc(io_info.piece_count * sizeof(haddr_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for piece address list"); + if (NULL == (io_info.element_sizes = H5MM_malloc(io_info.piece_count * sizeof(size_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for element size list"); + if (NULL == (io_info.wbufs = H5MM_malloc(io_info.piece_count * sizeof(const void *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for write buffer list"); + if (io_info.max_tconv_type_size > 0) + if (NULL == + (io_info.sel_pieces = H5MM_malloc(io_info.piece_count * sizeof(io_info.sel_pieces[0])))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "unable to allocate array of selected pieces"); + } + + /* loop with serial & single-dset write IO path */ + for (i = 0; i < count; i++) { + assert(!dset_info[i].skip_io); + + /* set metadata tagging with dset oheader addr */ + H5AC_tag(dset_info->dset->oloc.addr, &prev_tag); + + /* Invoke correct "high level" I/O routine */ + if ((*dset_info[i].io_ops.multi_write)(&io_info, &dset_info[i]) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data"); + + /* Reset metadata tagging */ + H5AC_tag(prev_tag, NULL); + } + + /* Make final selection I/O call if the multi_write callbacks did not perform the actual I/O + * (if using selection I/O and either multi dataset or type conversion) */ + if (!H5D_LAYOUT_CB_PERFORM_IO(&io_info)) { + /* Check for type conversion */ + if (io_info.max_tconv_type_size > 0) { + /* Type conversion pathway */ + if (H5D__scatgath_write_select(&io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "type conversion selection write failed"); + } + else { + /* Call selection I/O directly */ + H5_CHECK_OVERFLOW(io_info.pieces_added, size_t, uint32_t); + if (H5F_shared_select_write(io_info.f_sh, H5FD_MEM_DRAW, (uint32_t)io_info.pieces_added, + io_info.mem_spaces, io_info.file_spaces, io_info.addrs, + io_info.element_sizes, io_info.wbufs) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "selection write failed"); + } + } + +#ifdef H5_HAVE_PARALLEL + /* Report the actual I/O mode to the application if appropriate */ + if (io_info.using_mpi_vfd) { + H5FD_mpio_xfer_t xfer_mode; /* Parallel transfer for this request */ + + /* Get the parallel I/O transfer mode */ + if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); + + /* Only report the collective I/O mode if we're actually performing collective I/O */ + if (xfer_mode == H5FD_MPIO_COLLECTIVE) { + H5CX_set_mpio_actual_io_mode(io_info.actual_io_mode); + + /* If we did selection I/O, report that we used "link chunk" mode, since that's the most + * analogous to what selection I/O does */ + if (io_info.use_select_io == H5D_SELECTION_IO_MODE_ON) + H5CX_set_mpio_actual_chunk_opt(H5D_MPIO_LINK_CHUNK); + } + } +#endif /* H5_HAVE_PARALLEL */ + } done: /* Shut down the I/O op information */ - if (io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(fm) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info") - if (fm) - fm = H5FL_FREE(H5D_chunk_map_t, fm); + for (i = 0; i < io_op_init; i++) { + assert(!dset_info[i].skip_io); + if (dset_info[i].layout_ops.io_term && + (*dset_info[i].layout_ops.io_term)(&io_info, &(dset_info[i])) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info"); + } /* Shut down datatype info for operation */ - if (type_info_init && H5D__typeinfo_term(&type_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info") + if (H5D__typeinfo_term(&io_info) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info"); + + /* Discard projected mem spaces and restore originals */ + if (orig_mem_space) { + for (i = 0; i < count; i++) + if (orig_mem_space[i]) { + if (H5S_close(dset_info[i].mem_space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, + "unable to shut down projected memory dataspace"); + dset_info[i].mem_space = orig_mem_space[i]; + } + + /* Free orig_mem_space array if it was allocated */ + if (orig_mem_space != &orig_mem_space_local) + H5MM_free(orig_mem_space); + } - /* discard projected mem space if it was created */ - if (NULL != projected_mem_space) - if (H5S_close(projected_mem_space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down projected memory dataspace") + /* Free global piece array */ + H5MM_xfree(io_info.sel_pieces); - FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5D__write() */ + /* Free selection I/O arrays */ + H5MM_xfree(io_info.mem_spaces); + H5MM_xfree(io_info.file_spaces); + H5MM_xfree(io_info.addrs); + H5MM_xfree(io_info.element_sizes); + H5MM_xfree(io_info.wbufs); + + /* Free store array if it was allocated */ + if (store != &store_local) + H5MM_free(store); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__write */ /*------------------------------------------------------------------------- * Function: H5D__ioinfo_init * - * Purpose: Routine for determining correct I/O operations for - * each I/O action. + * Purpose: General setup for H5D_io_info_t struct * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, September 30, 2004 + *------------------------------------------------------------------------- + */ +static herr_t +H5D__ioinfo_init(size_t count, H5D_io_op_type_t op_type, H5D_dset_io_info_t *dset_info, + H5D_io_info_t *io_info) +{ + H5D_selection_io_mode_t selection_io_mode; + + FUNC_ENTER_PACKAGE_NOERR + + /* check args */ + assert(count > 0); + assert(dset_info); + assert(dset_info[0].dset->oloc.file); + assert(io_info); + + /* Zero out struct */ + memset(io_info, 0, sizeof(*io_info)); + + /* Set up simple fields */ + io_info->op_type = op_type; + io_info->f_sh = count > 0 ? H5F_SHARED(dset_info[0].dset->oloc.file) : NULL; + io_info->count = count; + + /* Start without multi-dataset I/O ops. If we're not using the collective + * I/O path then we will call the single dataset callbacks in a loop. */ + + /* Use provided dset_info */ + io_info->dsets_info = dset_info; + + /* Start with selection I/O mode from property list. If enabled, layout callback will turn it off if it + * is not supported by the layout. Handling of H5D_SELECTION_IO_MODE_AUTO occurs in H5D__ioinfo_adjust. + */ + H5CX_get_selection_io_mode(&selection_io_mode); + io_info->use_select_io = selection_io_mode; + + /* Record no selection I/O cause if it was disabled by the API */ + if (selection_io_mode == H5D_SELECTION_IO_MODE_OFF) + io_info->no_selection_io_cause = H5D_SEL_IO_DISABLE_BY_API; + +#ifdef H5_HAVE_PARALLEL + + /* Determine if the file was opened with an MPI VFD */ + if (count > 0) + io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset_info[0].dset->oloc.file, H5FD_FEAT_HAS_MPI); +#endif /* H5_HAVE_PARALLEL */ + + /* Check if we could potentially use in-place type conversion */ + if (op_type == H5D_IO_OP_READ) + /* Always on for read (modulo other restrictions that are handled in layout callbacks) */ + io_info->may_use_in_place_tconv = TRUE; + else + /* Only enable in-place type conversion if we're allowed to modify the write buffer */ + H5CX_get_modify_write_buf(&io_info->may_use_in_place_tconv); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__ioinfo_init() */ + +/*------------------------------------------------------------------------- + * Function: H5D__dset_ioinfo_init + * + * Purpose: Routine for determining correct I/O operations for each I/O action. + * + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ static herr_t -H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info, H5D_storage_t *store, H5D_io_info_t *io_info) +H5D__dset_ioinfo_init(H5D_t *dset, H5D_dset_io_info_t *dset_info, H5D_storage_t *store) { FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(dset); - HDassert(dset->oloc.file); - HDassert(type_info); - HDassert(type_info->tpath); - HDassert(io_info); + assert(dset); + assert(dset->oloc.file); + assert(dset_info->type_info.tpath); /* Set up "normal" I/O fields */ - io_info->dset = dset; - io_info->f_sh = H5F_SHARED(dset->oloc.file); - io_info->store = store; + dset_info->dset = dset; + dset_info->store = store; /* Set I/O operations to initial values */ - io_info->layout_ops = *dset->shared->layout.ops; + dset_info->layout_ops = *dset->shared->layout.ops; /* Set the "high-level" I/O operations for the dataset */ - io_info->io_ops.multi_read = dset->shared->layout.ops->ser_read; - io_info->io_ops.multi_write = dset->shared->layout.ops->ser_write; + dset_info->io_ops.multi_read = dset->shared->layout.ops->ser_read; + dset_info->io_ops.multi_write = dset->shared->layout.ops->ser_write; /* Set the I/O operations for reading/writing single blocks on disk */ - if (type_info->is_xform_noop && type_info->is_conv_noop) { + if (dset_info->type_info.is_xform_noop && dset_info->type_info.is_conv_noop) { /* - * If there is no data transform or type conversion then read directly into - * the application's buffer. This saves at least one mem-to-mem copy. + * If there is no data transform or type conversion then read directly + * into the application's buffer. + * This saves at least one mem-to-mem copy. */ - io_info->io_ops.single_read = H5D__select_read; - io_info->io_ops.single_write = H5D__select_write; + dset_info->io_ops.single_read = H5D__select_read; + dset_info->io_ops.single_write = H5D__select_write; } /* end if */ else { /* * This is the general case (type conversion, usually). */ - io_info->io_ops.single_read = H5D__scatgath_read; - io_info->io_ops.single_write = H5D__scatgath_write; + dset_info->io_ops.single_read = H5D__scatgath_read; + dset_info->io_ops.single_write = H5D__scatgath_write; } /* end else */ - /* Start with selection I/O off, layout callback will turn it on if - * appropriate */ - io_info->use_select_io = FALSE; - -#ifdef H5_HAVE_PARALLEL - /* Determine if the file was opened with an MPI VFD */ - io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI); -#endif /* H5_HAVE_PARALLEL */ - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5D__ioinfo_init() */ +} /* end H5D__dset_ioinfo_init() */ /*------------------------------------------------------------------------- * Function: H5D__typeinfo_init @@ -606,14 +1007,13 @@ H5D__ioinfo_init(H5D_t *dset, const H5D_type_info_t *type_info, H5D_storage_t *s * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, March 4, 2008 - * *------------------------------------------------------------------------- */ static herr_t -H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, H5D_type_info_t *type_info) +H5D__typeinfo_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, hid_t mem_type_id) { + H5D_type_info_t *type_info; + const H5D_t *dset; const H5T_t *src_type; /* Source datatype */ const H5T_t *dst_type; /* Destination datatype */ H5Z_data_xform_t *data_transform; /* Data transform info */ @@ -622,22 +1022,27 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, H5D_t FUNC_ENTER_PACKAGE /* check args */ - HDassert(type_info); - HDassert(dset); + assert(io_info); + assert(dset_info); + + /* Set convenience pointers */ + type_info = &dset_info->type_info; + dset = dset_info->dset; + assert(dset); /* Patch the top level file pointer for dt->shared->u.vlen.f if needed */ if (H5T_patch_vlen_file(dset->shared->type, H5F_VOL_OBJ(dset->oloc.file)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch VL datatype file pointer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch VL datatype file pointer"); /* Initialize type info safely */ - HDmemset(type_info, 0, sizeof(*type_info)); + memset(type_info, 0, sizeof(*type_info)); /* Get the memory & dataset datatypes */ if (NULL == (type_info->mem_type = (const H5T_t *)H5I_object_verify(mem_type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); type_info->dset_type = dset->shared->type; - if (do_write) { + if (io_info->op_type == H5D_IO_OP_WRITE) { src_type = type_info->mem_type; dst_type = dset->shared->type; type_info->src_type_id = mem_type_id; @@ -658,16 +1063,15 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, H5D_t * turns off background preservation. */ if (NULL == (type_info->tpath = H5T_path_find(src_type, dst_type))) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest datatype"); /* Retrieve info from API context */ if (H5CX_get_data_transform(&data_transform) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info"); /* Precompute some useful information */ type_info->src_type_size = H5T_get_size(src_type); type_info->dst_type_size = H5T_get_size(dst_type); - type_info->max_type_size = MAX(type_info->src_type_size, type_info->dst_type_size); type_info->is_conv_noop = H5T_path_noop(type_info->tpath); type_info->is_xform_noop = H5Z_xform_noop(data_transform); if (type_info->is_xform_noop && type_info->is_conv_noop) { @@ -675,27 +1079,21 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, H5D_t type_info->need_bkg = H5T_BKG_NO; } /* end if */ else { - void *tconv_buf; /* Temporary conversion buffer pointer */ - void *bkgr_buf; /* Background conversion buffer pointer */ - size_t max_temp_buf; /* Maximum temporary buffer size */ H5T_bkg_t bkgr_buf_type; /* Background buffer type */ - size_t target_size; /* Desired buffer size */ /* Get info from API context */ - if (H5CX_get_max_temp_buf(&max_temp_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve max. temp. buf size") - if (H5CX_get_tconv_buf(&tconv_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve temp. conversion buffer pointer") - if (H5CX_get_bkgr_buf(&bkgr_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve background conversion buffer pointer") if (H5CX_get_bkgr_buf_type(&bkgr_buf_type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve background buffer type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve background buffer type"); /* Check if the datatypes are compound subsets of one another */ type_info->cmpd_subset = H5T_path_compound_subset(type_info->tpath); + /* Update io_info->max_tconv_type_size */ + io_info->max_tconv_type_size = + MAX3(io_info->max_tconv_type_size, type_info->src_type_size, type_info->dst_type_size); + /* Check if we need a background buffer */ - if (do_write && H5T_detect_class(dset->shared->type, H5T_VLEN, FALSE)) + if ((io_info->op_type == H5D_IO_OP_WRITE) && H5T_detect_class(dset->shared->type, H5T_VLEN, FALSE)) type_info->need_bkg = H5T_BKG_YES; else { H5T_bkg_t path_bkg; /* Type conversion's background info */ @@ -708,97 +1106,124 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write, H5D_t else type_info->need_bkg = H5T_BKG_NO; /*never needed even if app says yes*/ } /* end else */ + } /* end else */ - /* Set up datatype conversion/background buffers */ - - target_size = max_temp_buf; +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__typeinfo_init() */ - /* If the buffer is too small to hold even one element, try to make it bigger */ - if (target_size < type_info->max_type_size) { - hbool_t default_buffer_info; /* Whether the buffer information are the defaults */ +/*------------------------------------------------------------------------- + * Function: H5D__typeinfo_init_phase2 + * + * Purpose: Continue initializing type info for all datasets after + * calculating the max type size across all datasets, and + * before final determination of collective/independent in + * H5D__ioinfo_adjust(). Currently just checks to see if + * selection I/O can be used with type conversion, and sets + * no_collective_cause flags related to selection I/O. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__typeinfo_init_phase2(H5D_io_info_t *io_info) +{ + herr_t ret_value = SUCCEED; /* Return value */ - /* Detect if we have all default settings for buffers */ - default_buffer_info = - (hbool_t)((H5D_TEMP_BUF_SIZE == max_temp_buf) && (NULL == tconv_buf) && (NULL == bkgr_buf)); + FUNC_ENTER_PACKAGE - /* Check if we are using the default buffer info */ - if (default_buffer_info) - /* OK to get bigger for library default settings */ - target_size = type_info->max_type_size; - else - /* Don't get bigger than the application has requested */ - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small") - } /* end if */ + /* check args */ + assert(io_info); + + /* If selection I/O mode is default (auto), enable it here if the VFD supports it (it will be turned off + * later if something else conflicts), otherwise disable it */ + if (io_info->use_select_io == H5D_SELECTION_IO_MODE_DEFAULT) { + if (H5F_has_vector_select_io(io_info->dsets_info[0].dset->oloc.file, + io_info->op_type == H5D_IO_OP_WRITE)) + io_info->use_select_io = H5D_SELECTION_IO_MODE_ON; + else { + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_DEFAULT_OFF; + } + } - /* Compute the number of elements that will fit into buffer */ - type_info->request_nelmts = target_size / type_info->max_type_size; + /* If we're doing type conversion and we might be doing selection I/O, check if the buffers are large + * enough to handle the whole I/O */ + if (io_info->max_tconv_type_size && io_info->use_select_io != H5D_SELECTION_IO_MODE_OFF) { + size_t max_temp_buf; /* Maximum temporary buffer size */ + size_t i; /* Local index variable */ - /* Sanity check elements in temporary buffer */ - if (type_info->request_nelmts == 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small") + /* Collective I/O, conversion buffer must be large enough for entire I/O (for now) */ - /* Get a temporary buffer for type conversion unless the app has already - * supplied one through the xfer properties. Instead of allocating a - * buffer which is the exact size, we allocate the target size. + /* Calculate size of background buffer (tconv buf size was calculated in layout io_init callbacks) */ - if (NULL == (type_info->tconv_buf = (uint8_t *)tconv_buf)) { - /* Allocate temporary buffer */ - if (NULL == (type_info->tconv_buf = H5FL_BLK_CALLOC(type_conv, target_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") - type_info->tconv_buf_allocated = TRUE; - } /* end if */ - if (type_info->need_bkg && NULL == (type_info->bkg_buf = (uint8_t *)bkgr_buf)) { - size_t bkg_size; /* Desired background buffer size */ - - /* Compute the background buffer size */ - /* (don't try to use buffers smaller than the default size) */ - bkg_size = type_info->request_nelmts * type_info->dst_type_size; - if (bkg_size < max_temp_buf) - bkg_size = max_temp_buf; - - /* Allocate background buffer */ - /* (Need calloc()-like call since memory needs to be initialized) */ - if (NULL == (type_info->bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for background conversion") - type_info->bkg_buf_allocated = TRUE; - } /* end if */ - } /* end else */ + for (i = 0; i < io_info->count; i++) { + H5D_type_info_t *type_info = &io_info->dsets_info[i].type_info; + + /* Check for background buffer */ + if (type_info->need_bkg) { + /* Add size of this dataset's background buffer to the global background buffer size + */ + io_info->bkg_buf_size += io_info->dsets_info[i].nelmts * type_info->dst_type_size; + + /* Check if we need to fill the background buffer with the destination contents */ + if (type_info->need_bkg == H5T_BKG_YES) + io_info->must_fill_bkg = TRUE; + } + } + + /* Get max temp buffer size from API context */ + if (H5CX_get_max_temp_buf(&max_temp_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve max. temp. buf size"); + + /* Check if the needed type conversion or background buffer size is too big */ + if (io_info->tconv_buf_size > max_temp_buf) { + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_TCONV_BUF_TOO_SMALL; + io_info->tconv_buf_size = 0; + io_info->bkg_buf_size = 0; + io_info->must_fill_bkg = FALSE; + } + if (io_info->bkg_buf_size > max_temp_buf) { + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_BKG_BUF_TOO_SMALL; + io_info->tconv_buf_size = 0; + io_info->bkg_buf_size = 0; + io_info->must_fill_bkg = FALSE; + } + } done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__typeinfo_init() */ +} /* end H5D__typeinfo_init_phase2() */ #ifdef H5_HAVE_PARALLEL - /*------------------------------------------------------------------------- - * Function: H5D__ioinfo_adjust - * - * Purpose: Adjust operation's I/O info for any parallel I/O + * Function: H5D__ioinfo_adjust * - * Return: Non-negative on success/Negative on failure + * Purpose: Adjust operation's I/O info for any parallel I/O, also + * handle decision on selection I/O even in serial case * - * Programmer: Quincey Koziol - * Thursday, March 27, 2008 + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ static herr_t -H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_space, const H5S_t *mem_space, - const H5D_type_info_t *type_info) +H5D__ioinfo_adjust(H5D_io_info_t *io_info) { + H5D_t *dset0; /* only the first dset , also for single dsets case */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* check args */ - HDassert(dset); - HDassert(dset->oloc.file); - HDassert(mem_space); - HDassert(file_space); - HDassert(type_info); - HDassert(type_info->tpath); - HDassert(io_info); + assert(io_info); + + /* check the first dset, should exist either single or multi dset cases */ + assert(io_info->dsets_info[0].dset); + dset0 = io_info->dsets_info[0].dset; + assert(dset0->oloc.file); /* Reset the actual io mode properties to the default values in case * the DXPL (if it's non-default) was previously used in a collective @@ -816,15 +1241,15 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_ /* Get the original state of parallel I/O transfer mode */ if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); /* Get MPI communicator */ - if (MPI_COMM_NULL == (io_info->comm = H5F_mpi_get_comm(dset->oloc.file))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve MPI communicator") + if (MPI_COMM_NULL == (io_info->comm = H5F_mpi_get_comm(dset0->oloc.file))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve MPI communicator"); /* Check if we can set direct MPI-IO read/write functions */ - if ((opt = H5D__mpio_opt_possible(io_info, file_space, mem_space, type_info)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "invalid check for direct IO dataspace ") + if ((opt = H5D__mpio_opt_possible(io_info)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "invalid check for direct IO dataspace "); /* Check if we can use the optimized parallel I/O routines */ if (opt == TRUE) { @@ -832,11 +1257,11 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_ * selection I/O is to be used - in this case the file driver will * handle collective I/O */ /* Check for selection/vector support in file driver? -NAF */ - if (!io_info->use_select_io) { - io_info->io_ops.multi_read = dset->shared->layout.ops->par_read; - io_info->io_ops.multi_write = dset->shared->layout.ops->par_write; - io_info->io_ops.single_read = H5D__mpio_select_read; - io_info->io_ops.single_write = H5D__mpio_select_write; + if (io_info->use_select_io == H5D_SELECTION_IO_MODE_OFF) { + io_info->md_io_ops.multi_read_md = H5D__collective_read; + io_info->md_io_ops.multi_write_md = H5D__collective_write; + io_info->md_io_ops.single_read_md = H5D__mpio_select_read; + io_info->md_io_ops.single_write_md = H5D__mpio_select_write; } /* end if */ } /* end if */ else { @@ -844,12 +1269,12 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_ if (io_info->op_type == H5D_IO_OP_WRITE) { hbool_t mpi_file_sync_required = FALSE; if (H5F_shared_get_mpi_file_sync_required(io_info->f_sh, &mpi_file_sync_required) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI file_sync_required flag") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI file_sync_required flag"); if (mpi_file_sync_required) HGOTO_ERROR( H5E_DATASET, H5E_NO_INDEPENDENT, FAIL, - "Can't perform independent write when MPI_File_sync is required by ROMIO driver.") + "Can't perform independent write when MPI_File_sync is required by ROMIO driver."); } /* Check if there are any filters in the pipeline. If there are, @@ -857,28 +1282,38 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_ * with multiple ranks involved; otherwise, there will be metadata * inconsistencies in the file. */ - if (io_info->op_type == H5D_IO_OP_WRITE && io_info->dset->shared->dcpl_cache.pline.nused > 0) { - int comm_size = 0; - - /* Retrieve size of MPI communicator used for file */ - if ((comm_size = H5F_shared_mpi_get_size(io_info->f_sh)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator size") - - if (comm_size > 1) { - char local_no_coll_cause_string[512]; - char global_no_coll_cause_string[512]; - - if (H5D__mpio_get_no_coll_cause_strings(local_no_coll_cause_string, 512, - global_no_coll_cause_string, 512) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "can't get reasons for breaking collective I/O") - - HGOTO_ERROR(H5E_IO, H5E_NO_INDEPENDENT, FAIL, - "Can't perform independent write with filters in pipeline.\n" - " The following caused a break from collective I/O:\n" - " Local causes: %s\n" - " Global causes: %s", - local_no_coll_cause_string, global_no_coll_cause_string); + if (io_info->op_type == H5D_IO_OP_WRITE) { + size_t i; + + /* Check all datasets for filters */ + for (i = 0; i < io_info->count; i++) + if (io_info->dsets_info[i].dset->shared->dcpl_cache.pline.nused > 0) + break; + + /* If the above loop didn't complete at least one dataset has a filter */ + if (i < io_info->count) { + int comm_size = 0; + + /* Retrieve size of MPI communicator used for file */ + if ((comm_size = H5F_shared_mpi_get_size(io_info->f_sh)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator size"); + + if (comm_size > 1) { + char local_no_coll_cause_string[512]; + char global_no_coll_cause_string[512]; + + if (H5D__mpio_get_no_coll_cause_strings(local_no_coll_cause_string, 512, + global_no_coll_cause_string, 512) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, + "can't get reasons for breaking collective I/O"); + + HGOTO_ERROR(H5E_IO, H5E_NO_INDEPENDENT, FAIL, + "Can't perform independent write with filters in pipeline.\n" + " The following caused a break from collective I/O:\n" + " Local causes: %s\n" + " Global causes: %s", + local_no_coll_cause_string, global_no_coll_cause_string); + } } } @@ -888,7 +1323,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_ if (xfer_mode == H5FD_MPIO_COLLECTIVE) { /* Change the xfer_mode to independent for handling the I/O */ if (H5CX_set_io_xfer_mode(H5FD_MPIO_INDEPENDENT) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O transfer mode"); } /* end if */ } /* end else */ } /* end if */ @@ -899,30 +1334,159 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_ #endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- - * Function: H5D__typeinfo_term + * Function: H5D__typeinfo_init_phase3 * - * Purpose: Common logic for terminating a type info object + * Purpose: Finish initializing type info for all datasets after + * calculating the max type size across all datasets. And + * after final collective/independent determination in + * H5D__ioinfo_adjust(). * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__typeinfo_init_phase3(H5D_io_info_t *io_info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* check args */ + assert(io_info); + + /* Check if we need to allocate a shared type conversion buffer */ + if (io_info->max_tconv_type_size) { + void *tconv_buf; /* Temporary conversion buffer pointer */ + void *bkgr_buf; /* Background conversion buffer pointer */ + + /* Get provided buffers from API context */ + if (H5CX_get_tconv_buf(&tconv_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve temp. conversion buffer pointer"); + if (H5CX_get_bkgr_buf(&bkgr_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, + "can't retrieve background conversion buffer pointer"); + + /* Check if we're doing selection I/O */ + if (io_info->use_select_io == H5D_SELECTION_IO_MODE_ON) { + /* Selection I/O, conversion buffers must be large enough for entire I/O (for now) */ + + /* Allocate global type conversion buffer (if any, could be none if datasets in this + * I/O have 0 elements selected) */ + /* Allocating large buffers here will blow out all other type conversion buffers + * on the free list. Should we change this to a regular malloc? Would require + * keeping track of which version of free() to call. -NAF */ + if (io_info->tconv_buf_size > 0) { + if (NULL == (io_info->tconv_buf = H5FL_BLK_MALLOC(type_conv, io_info->tconv_buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for type conversion"); + io_info->tconv_buf_allocated = TRUE; + } + + /* Allocate global background buffer (if any) */ + if (io_info->bkg_buf_size > 0) { + if (NULL == (io_info->bkg_buf = H5FL_BLK_MALLOC(type_conv, io_info->bkg_buf_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for type conversion"); + io_info->bkg_buf_allocated = TRUE; + } + } + else { + /* No selection I/O, only need to make sure it's big enough for one element */ + size_t max_temp_buf; /* Maximum temporary buffer size */ + size_t target_size; /* Desired buffer size */ + size_t i; + + /* Make sure selection I/O is disabled (DEFAULT should have been handled by now) */ + assert(io_info->use_select_io == H5D_SELECTION_IO_MODE_OFF); + + /* Get max buffer size from API context */ + if (H5CX_get_max_temp_buf(&max_temp_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve max. temp. buf size"); + + /* Set up datatype conversion/background buffers */ + target_size = max_temp_buf; + + /* If the buffer is too small to hold even one element (in the dataset with the largest , try to + * make it bigger */ + if (target_size < io_info->max_tconv_type_size) { + hbool_t default_buffer_info; /* Whether the buffer information are the defaults */ + + /* Detect if we have all default settings for buffers */ + default_buffer_info = (hbool_t)((H5D_TEMP_BUF_SIZE == max_temp_buf) && (NULL == tconv_buf) && + (NULL == bkgr_buf)); + + /* Check if we are using the default buffer info */ + if (default_buffer_info) + /* OK to get bigger for library default settings */ + target_size = io_info->max_tconv_type_size; + else + /* Don't get bigger than the application has requested */ + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small"); + } /* end if */ + + /* Get a temporary buffer for type conversion unless the app has already + * supplied one through the xfer properties. Instead of allocating a + * buffer which is the exact size, we allocate the target size. This + * buffer is shared among all datasets in the operation. */ + if (NULL == (io_info->tconv_buf = (uint8_t *)tconv_buf)) { + /* Allocate temporary buffer */ + if (NULL == (io_info->tconv_buf = H5FL_BLK_MALLOC(type_conv, target_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for type conversion"); + io_info->tconv_buf_allocated = TRUE; + } /* end if */ + + /* Iterate over datasets */ + for (i = 0; i < io_info->count; i++) { + H5D_type_info_t *type_info = &io_info->dsets_info[i].type_info; + + /* Compute the number of elements that will fit into buffer */ + type_info->request_nelmts = + target_size / MAX(type_info->src_type_size, type_info->dst_type_size); + + /* Check if we need a background buffer and one hasn't been allocated yet */ + if (type_info->need_bkg && (NULL == io_info->bkg_buf) && + (NULL == (io_info->bkg_buf = (uint8_t *)bkgr_buf))) { + /* Allocate background buffer with the same size as the type conversion buffer. We can do + * this since the number of elements that fit in the type conversion buffer will never be + * larger than the number that could fit in a background buffer of equal size, since the + * tconv element size is max(src, dst) and the bkg element size is dst */ + if (NULL == (io_info->bkg_buf = H5FL_BLK_MALLOC(type_conv, target_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for background conversion"); + io_info->bkg_buf_allocated = TRUE; + } + } + } + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__typeinfo_init_phase3() */ + +/*------------------------------------------------------------------------- + * Function: H5D__typeinfo_term + * + * Purpose: Common logic for terminating a type info object * - * Programmer: Quincey Koziol - * Thursday, March 6, 2008 + * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ static herr_t -H5D__typeinfo_term(const H5D_type_info_t *type_info) +H5D__typeinfo_term(H5D_io_info_t *io_info) { FUNC_ENTER_PACKAGE_NOERR /* Check for releasing datatype conversion & background buffers */ - if (type_info->tconv_buf_allocated) { - HDassert(type_info->tconv_buf); - (void)H5FL_BLK_FREE(type_conv, type_info->tconv_buf); + if (io_info->tconv_buf_allocated) { + assert(io_info->tconv_buf); + (void)H5FL_BLK_FREE(type_conv, io_info->tconv_buf); } /* end if */ - if (type_info->bkg_buf_allocated) { - HDassert(type_info->bkg_buf); - (void)H5FL_BLK_FREE(type_conv, type_info->bkg_buf); + if (io_info->bkg_buf_allocated) { + assert(io_info->bkg_buf); + (void)H5FL_BLK_FREE(type_conv, io_info->bkg_buf); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dlayout.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dlayout.c index fd7e5b9918..225c48ad2b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dlayout.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dlayout.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -43,11 +42,12 @@ /* Format version bounds for layout */ const unsigned H5O_layout_ver_bounds[] = { - H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */ - H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */ - H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */ - H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V112 */ - H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */ + H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */ + H5O_LAYOUT_VERSION_3, + /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */ + H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */ + H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V112 */ + H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; /*****************************/ @@ -66,9 +66,6 @@ const unsigned H5O_layout_ver_bounds[] = { * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -79,7 +76,7 @@ H5D__layout_set_io_ops(const H5D_t *dataset) FUNC_ENTER_PACKAGE /* check args */ - HDassert(dataset); + assert(dataset); /* Set the I/O functions for each layout type */ switch (dataset->shared->layout.type) { @@ -121,8 +118,8 @@ H5D__layout_set_io_ops(const H5D_t *dataset) case H5D_CHUNK_IDX_NTYPES: default: - HDassert(0 && "Unknown chunk index method!"); - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown chunk index method") + assert(0 && "Unknown chunk index method!"); + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown chunk index method"); } /* end switch */ break; @@ -137,7 +134,7 @@ H5D__layout_set_io_ops(const H5D_t *dataset) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown storage method") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown storage method"); } /* end switch */ /*lint !e788 All appropriate cases are covered */ done: @@ -154,9 +151,6 @@ H5D__layout_set_io_ops(const H5D_t *dataset) * Return: Success: Message data size in bytes * Failure: 0 * - * Programmer: Raymond Lu - * August 14, 2002 - * *------------------------------------------------------------------------- */ size_t @@ -167,8 +161,8 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(layout); + assert(f); + assert(layout); ret_value = 1 + /* Version number */ 1; /* layout class type */ @@ -191,7 +185,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ case H5D_CHUNKED: if (layout->version < H5O_LAYOUT_VERSION_4) { /* Number of dimensions (1 byte) */ - HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + assert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); ret_value++; /* B-tree address */ @@ -205,11 +199,11 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ ret_value++; /* Number of dimensions (1 byte) */ - HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + assert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); ret_value++; /* Encoded # of bytes for each chunk dimension */ - HDassert(layout->u.chunk.enc_bytes_per_dim > 0 && layout->u.chunk.enc_bytes_per_dim <= 8); + assert(layout->u.chunk.enc_bytes_per_dim > 0 && layout->u.chunk.enc_bytes_per_dim <= 8); ret_value++; /* Dimension sizes */ @@ -221,7 +215,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ switch (layout->u.chunk.idx_type) { case H5D_CHUNK_IDX_BTREE: HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, 0, - "v1 B-tree index type found for layout message >v3") + "v1 B-tree index type found for layout message >v3"); case H5D_CHUNK_IDX_NONE: /* nothing */ @@ -252,7 +246,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ case H5D_CHUNK_IDX_NTYPES: default: - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid chunk index type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid chunk index type"); } /* end switch */ /* Chunk index address */ @@ -268,7 +262,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid layout class") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid layout class"); } /* end switch */ done: @@ -282,9 +276,6 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; December 2017 - * - *------------------------------------------------------------------------- */ herr_t H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout) @@ -295,15 +286,15 @@ H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(layout); - HDassert(f); + assert(layout); + assert(f); /* Upgrade to the version indicated by the file's low bound if higher */ version = MAX(layout->version, H5O_layout_ver_bounds[H5F_LOW_BOUND(f)]); /* Version bounds check */ if (version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "layout version out of bounds") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "layout version out of bounds"); /* Set the message version */ layout->version = version; @@ -319,9 +310,6 @@ H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 15, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -332,9 +320,9 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, const FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(layout); - HDassert(space); - HDassert(dcpl_cache); + assert(layout); + assert(space); + assert(dcpl_cache); /* The indexing methods only apply to chunked datasets (currently) */ if (layout->type == H5D_CHUNKED) { @@ -343,7 +331,7 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, const /* Query the dimensionality of the dataspace */ if ((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "invalid dataspace rank") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "invalid dataspace rank"); ndims = (unsigned)sndims; /* Avoid scalar/null dataspace */ @@ -356,7 +344,7 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, const /* Query the dataspace's dimensions */ if (H5S_get_simple_extent_dims(space, cur_dims, max_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions"); /* Spin through the max. dimensions, looking for unlimited dimensions */ for (u = 0; u < ndims; u++) { @@ -443,9 +431,6 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, const * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -460,9 +445,9 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr) /* Sanity checking */ - HDassert(file); - HDassert(oh); - HDassert(dset); + assert(file); + assert(oh); + assert(dset); /* Set some local variables, for convenience */ layout = &dset->shared->layout; @@ -475,12 +460,12 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) pline = &dset->shared->dcpl_cache.pline; if (pline->nused > 0 && H5O_msg_append_oh(file, oh, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update filter header message"); } /* end if */ /* Initialize the layout information for the new dataset */ if (dset->shared->layout.ops->init && (dset->shared->layout.ops->init)(file, dset, dapl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information"); /* Indicate that the layout information was initialized */ layout_init = TRUE; @@ -489,14 +474,9 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) * Allocate storage if space allocate time is early; otherwise delay * allocation until later. */ - if (fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY) { - H5D_io_info_t io_info; - - io_info.dset = dset; - - if (H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") - } + if (fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY) + if (H5D__alloc_storage(dset, H5D_ALLOC_CREATE, FALSE, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage"); /* Update external storage message, if it's used */ if (dset->shared->dcpl_cache.efl.nused > 0) { @@ -512,16 +492,16 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) /* Create the heap for the EFL file names */ if (H5HL_create(file, heap_size, &efl->heap_addr /*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create EFL file name heap") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create EFL file name heap"); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(file, efl->heap_addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect EFL file name heap") + HGOTO_ERROR(H5E_DATASET, H5E_CANTPROTECT, FAIL, "unable to protect EFL file name heap"); /* Insert "empty" name first */ if (H5HL_insert(file, heap, (size_t)1, "", &name_offset) < 0) { H5HL_unprotect(heap); - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap"); } for (u = 0; u < efl->nused; ++u) { @@ -529,7 +509,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) if (H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name, &name_offset) < 0) { H5HL_unprotect(heap); - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap"); } /* Store EFL file name offset */ @@ -538,12 +518,12 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) /* Release the heap */ if (H5HL_unprotect(heap) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to unprotect EFL file name heap") + HGOTO_ERROR(H5E_DATASET, H5E_CANTUNPROTECT, FAIL, "unable to unprotect EFL file name heap"); heap = NULL; /* Insert EFL message into dataset object header */ if (H5O_msg_append_oh(file, oh, H5O_EFL_ID, H5O_MSG_FLAG_CONSTANT, 0, efl) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update external file list message"); } /* end if */ /* Create layout message */ @@ -559,11 +539,11 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) /* Store VDS info in global heap */ if (H5D_VIRTUAL == layout->type) if (H5D__virtual_store_layout(file, layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info"); /* Create layout message */ if (H5O_msg_append_oh(file, oh, H5O_LAYOUT_ID, layout_mesg_flags, 0, layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update layout"); done: /* Error cleanup */ @@ -571,7 +551,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) if (layout_init) /* Destroy any cached layout information for the dataset */ if (dset->shared->layout.ops->dest && (dset->shared->layout.ops->dest)(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__layout_oh_create() */ @@ -584,35 +564,34 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 - * *------------------------------------------------------------------------- */ herr_t H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist) { htri_t msg_exists; /* Whether a particular type of message exists */ + hbool_t pline_copied = FALSE; /* Flag to indicate that dcpl_cache.pline's message was copied */ hbool_t layout_copied = FALSE; /* Flag to indicate that layout message was copied */ + hbool_t efl_copied = FALSE; /* Flag to indicate that the EFL message was copied */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity checking */ - HDassert(dataset); - HDassert(plist); + assert(dataset); + assert(plist); /* Get the optional filters message */ if ((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_PLINE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists"); if (msg_exists) { /* Retrieve the I/O pipeline message */ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message") - + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message"); + pline_copied = TRUE; /* Set the I/O pipeline info in the property list */ if (H5P_set(plist, H5O_CRT_PIPELINE_NAME, &dataset->shared->dcpl_cache.pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set pipeline") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set pipeline"); } /* end if */ /* @@ -622,32 +601,33 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist) * them. */ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_LAYOUT_ID, &(dataset->shared->layout))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read data layout message"); layout_copied = TRUE; /* Check for external file list message (which might not exist) */ if ((msg_exists = H5O_msg_exists(&(dataset->oloc), H5O_EFL_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check if message exists"); if (msg_exists) { /* Retrieve the EFL message */ if (NULL == H5O_msg_read(&(dataset->oloc), H5O_EFL_ID, &dataset->shared->dcpl_cache.efl)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve message"); + efl_copied = TRUE; /* Set the EFL info in the property list */ if (H5P_set(plist, H5D_CRT_EXT_FILE_LIST_NAME, &dataset->shared->dcpl_cache.efl) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set external file list") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set external file list"); /* Set the dataset's I/O operations */ dataset->shared->layout.ops = H5D_LOPS_EFL; } /* end if */ /* Sanity check that the layout operations are set up */ - HDassert(dataset->shared->layout.ops); + assert(dataset->shared->layout.ops); /* Initialize the layout information for the dataset */ if (dataset->shared->layout.ops->init && (dataset->shared->layout.ops->init)(dataset->oloc.file, dataset, dapl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize layout information"); /* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */ if (H5D_CHUNKED == dataset->shared->layout.type) @@ -655,18 +635,25 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist) /* Copy layout to the DCPL */ if (H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout"); /* Set chunk sizes */ if (H5D_CHUNKED == dataset->shared->layout.type) if (H5D__chunk_set_sizes(dataset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes"); done: - if (ret_value < 0 && layout_copied) - if (H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info") - + if (ret_value < 0) { + if (pline_copied) + if (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset pipeline info"); + if (layout_copied) + if (H5O_msg_reset(H5O_LAYOUT_ID, &dataset->shared->layout) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset layout info"); + if (efl_copied) + if (H5O_msg_reset(H5O_EFL_ID, &dataset->shared->dcpl_cache.efl) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset efl message"); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_oh_read() */ @@ -678,9 +665,6 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dapl_id, H5P_genplist_t *plist) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -692,17 +676,17 @@ H5D__layout_oh_write(const H5D_t *dataset, H5O_t *oh, unsigned update_flags) FUNC_ENTER_PACKAGE /* Sanity checking */ - HDassert(dataset); - HDassert(oh); + assert(dataset); + assert(oh); /* Check if the layout message has been added to the dataset's header */ if ((msg_exists = H5O_msg_exists_oh(oh, H5O_LAYOUT_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to check if layout message exists") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to check if layout message exists"); if (msg_exists) { /* Write the layout message to the dataset's header */ if (H5O_msg_write_oh(dataset->oloc.file, oh, H5O_LAYOUT_ID, 0, update_flags, &dataset->shared->layout) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout message") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to update layout message"); } /* end if */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dmpio.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dmpio.c index 17ae0e5654..82bcf02437 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dmpio.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dmpio.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,13 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: rky 980813 - * KY 2005 revised the code and made the change to support and optimize - * collective IO support. * Purpose: Functions to read/write directly between app buffer and file. - * - * Beware of the ifdef'ed print statements. - * I didn't make them portable. */ /****************/ @@ -56,26 +49,6 @@ #define H5D_ONE_LINK_CHUNK_IO_MORE_OPT 2 #define H5D_MULTI_CHUNK_IO_MORE_OPT 3 -/***** Macros for One linked collective IO case. *****/ -/* The default value to do one linked collective IO for all chunks. - If the average number of chunks per process is greater than this value, - the library will create an MPI derived datatype to link all chunks to do collective IO. - The user can set this value through an API. */ - -/* Macros to represent options on how to obtain chunk address for one linked-chunk IO case */ -#define H5D_OBTAIN_ONE_CHUNK_ADDR_IND 0 -#define H5D_OBTAIN_ALL_CHUNK_ADDR_COL 2 - -/* Macros to define the default ratio of obtaining all chunk addresses for one linked-chunk IO case */ -#define H5D_ALL_CHUNK_ADDR_THRES_COL 30 -#define H5D_ALL_CHUNK_ADDR_THRES_COL_NUM 10000 - -/***** Macros for multi-chunk collective IO case. *****/ -/* The default value of the threshold to do collective IO for this chunk. - If the average number of processes per chunk is greater than the default value, - collective IO is done for this chunk. -*/ - /* Macros to represent different IO modes(NONE, Independent or collective)for multiple chunk IO case */ #define H5D_CHUNK_IO_MODE_COL 1 @@ -107,12 +80,12 @@ * structure, given a pointer to a H5D_io_info_t * structure */ -#define H5D_MPIO_INIT_CHUNK_IDX_INFO(index_info, io_info_ptr) \ +#define H5D_MPIO_INIT_CHUNK_IDX_INFO(index_info, dset) \ do { \ - index_info.f = (io_info_ptr)->dset->oloc.file; \ - index_info.pline = &((io_info_ptr)->dset->shared->dcpl_cache.pline); \ - index_info.layout = &((io_info_ptr)->dset->shared->layout.u.chunk); \ - index_info.storage = &((io_info_ptr)->dset->shared->layout.storage.u.chunk); \ + index_info.f = (dset)->oloc.file; \ + index_info.pline = &((dset)->shared->dcpl_cache.pline); \ + index_info.layout = &((dset)->shared->layout.u.chunk); \ + index_info.storage = &((dset)->shared->layout.storage.u.chunk); \ } while (0) /* @@ -121,7 +94,7 @@ */ #define H5D_MPIO_INIT_CHUNK_UD_INFO(chunk_ud, index_info_ptr) \ do { \ - HDmemset(&chunk_ud, 0, sizeof(H5D_chunk_ud_t)); \ + memset(&chunk_ud, 0, sizeof(H5D_chunk_ud_t)); \ chunk_ud.common.layout = (index_info_ptr)->layout; \ chunk_ud.common.storage = (index_info_ptr)->storage; \ } while (0) @@ -130,10 +103,12 @@ /* Local Typedefs */ /******************/ -/* Combine chunk address and chunk info into a struct for better performance. */ +/* Combine chunk/piece address and chunk/piece info into a struct for + * better performance. */ typedef struct H5D_chunk_addr_info_t { - haddr_t chunk_addr; - H5D_chunk_info_t chunk_info; + /* piece for multi-dset */ + haddr_t piece_addr; + H5D_piece_info_t piece_info; } H5D_chunk_addr_info_t; /* Rank 0 Bcast values */ @@ -187,7 +162,7 @@ typedef struct H5D_chunk_index_info_t { * need_insert - A flag which determines whether or not a chunk needs to be re-inserted into * the chunk index after the write operation. * - * chunk_info - A pointer to the chunk's H5D_chunk_info_t structure, which contains useful + * chunk_info - A pointer to the chunk's H5D_piece_info_t structure, which contains useful * information like the dataspaces containing the selection in the chunk. * * chunk_current - The address in the file and size of this chunk before the filtering @@ -238,10 +213,10 @@ typedef struct H5D_chunk_index_info_t { * hh - A handle for hash tables provided by the uthash.h header * */ -typedef struct H5D_filtered_collective_io_info_t { +typedef struct H5D_filtered_collective_chunk_info_t { H5D_chunk_index_info_t index_info; - H5D_chunk_info_t *chunk_info; + H5D_piece_info_t *chunk_info; H5F_block_t chunk_current; H5F_block_t chunk_new; hbool_t need_read; @@ -254,6 +229,46 @@ typedef struct H5D_filtered_collective_io_info_t { void *buf; UT_hash_handle hh; +} H5D_filtered_collective_chunk_info_t; + +/* + * Top-level structure that contains an array of H5D_filtered_collective_chunk_info_t + * chunk info structures for collective filtered I/O, as well as other useful information. + * The struct's fields are as follows: + * + * chunk_infos - An array of H5D_filtered_collective_chunk_info_t structures that each + * contain information about a single chunk when performing collective filtered + * I/O. + * + * chunk_hash_table - A hash table storing H5D_filtered_collective_chunk_info_t structures + * that is populated when chunk modification data has to be shared between + * MPI processes during collective filtered I/O. This hash table facilitates + * quicker and easier lookup of a particular chunk by its "chunk index" + * value when applying chunk data modification messages from another MPI + * process. Each modification message received from another MPI process + * will contain the chunk's "chunk index" value that can be used for chunk + * lookup operations. + * + * num_chunks_infos - The number of entries in the `chunk_infos` array. + * + * num_chunks_to_read - The number of entries (or chunks) in the `chunk_infos` array that + * will need to be read in the case of a read operation (which can + * occur during dataset reads or during dataset writes when a chunk + * has to go through a read - modify - write cycle). The value for + * this field is based on a chunk's `need_read` field in its particular + * H5D_filtered_collective_chunk_info_t structure, but may be adjusted + * later depending on file space allocation timing and other factors. + * + * This field can be helpful to avoid needing to scan through the list + * of chunk info structures to determine how big of I/O vectors to + * allocate during read operations, as an example. + * + */ +typedef struct H5D_filtered_collective_io_info_t { + H5D_filtered_collective_chunk_info_t *chunk_infos; + H5D_filtered_collective_chunk_info_t *chunk_hash_table; + size_t num_chunk_infos; + size_t num_chunks_to_read; } H5D_filtered_collective_io_info_t; /* @@ -281,76 +296,55 @@ typedef struct H5D_chunk_insert_info_t { /********************/ /* Local Prototypes */ /********************/ -static herr_t H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5D_chunk_map_t *fm); -static herr_t H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5D_chunk_map_t *fm, int mpi_rank, int mpi_size); -static herr_t H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, +static herr_t H5D__piece_io(H5D_io_info_t *io_info); +static herr_t H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, + int mpi_rank, int mpi_size); +static herr_t H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, int mpi_rank, int mpi_size); -static herr_t H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5D_chunk_map_t *fm, int sum_chunk, int mpi_rank, int mpi_size); -static herr_t H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5D_chunk_map_t *fm, int mpi_rank, int mpi_size); -static herr_t H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, +static herr_t H5D__link_piece_collective_io(H5D_io_info_t *io_info, int mpi_rank); +static herr_t H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, + int mpi_rank, int mpi_size); +static herr_t H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_dset_io_info_t *di, H5S_t *file_space, H5S_t *mem_space); -static herr_t H5D__final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t nelmts, MPI_Datatype mpi_file_type, MPI_Datatype mpi_buf_type); -static herr_t H5D__sort_chunk(H5D_io_info_t *io_info, const H5D_chunk_map_t *fm, - H5D_chunk_addr_info_t chunk_addr_info_array[], int many_chunk_opt, int mpi_rank, - int mpi_size); -static herr_t H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm, uint8_t assign_io_mode[], +static herr_t H5D__final_collective_io(H5D_io_info_t *io_info, hsize_t mpi_buf_count, + MPI_Datatype mpi_file_type, MPI_Datatype mpi_buf_type); +static herr_t H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_dset_io_info_t *di, uint8_t assign_io_mode[], haddr_t chunk_addr[], int mpi_rank, int mpi_size); -static herr_t H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info, const H5D_chunk_map_t *fm, - int *sum_chunkf); -static herr_t H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, - const H5D_chunk_map_t *fm, - H5D_filtered_collective_io_info_t **chunk_list, - size_t *num_entries, int mpi_rank); +static herr_t H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info, int *sum_chunkf); +static herr_t H5D__mpio_get_sum_chunk_dset(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + int *sum_chunkf); +static herr_t H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, + const H5D_dset_io_info_t *di, int mpi_rank, + H5D_filtered_collective_io_info_t *chunk_list); static herr_t H5D__mpio_redistribute_shared_chunks(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, - const H5D_io_info_t *io_info, const H5D_chunk_map_t *fm, - int mpi_rank, int mpi_size, + const H5D_io_info_t *io_info, int mpi_rank, int mpi_size, size_t **rank_chunks_assigned_map); static herr_t H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chunk_list, - size_t *num_chunks_assigned_map, - hbool_t all_ranks_involved, - const H5D_io_info_t *io_info, - const H5D_chunk_map_t *fm, int mpi_rank, int mpi_size); + size_t *num_chunks_assigned_map, + hbool_t all_ranks_involved, + const H5D_io_info_t *io_info, int mpi_rank, + int mpi_size); static herr_t H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk_list, - size_t *chunk_list_num_entries, H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, int mpi_rank, - int mpi_size, - H5D_filtered_collective_io_info_t **chunk_hash_table, - unsigned char ***chunk_msg_bufs, - int *chunk_msg_bufs_len); -static herr_t H5D__mpio_collective_filtered_chunk_common_io(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, - const H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, int mpi_size); + H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, + int mpi_rank, int H5_ATTR_NDEBUG_UNUSED mpi_size, + unsigned char ***chunk_msg_bufs, + int *chunk_msg_bufs_len); static herr_t H5D__mpio_collective_filtered_chunk_read(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, - const H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, int mpi_rank, - int mpi_size); + const H5D_io_info_t *io_info, + const H5D_dset_io_info_t *di, int mpi_rank); static herr_t H5D__mpio_collective_filtered_chunk_update(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, - H5D_filtered_collective_io_info_t *chunk_hash_table, unsigned char **chunk_msg_bufs, int chunk_msg_bufs_len, const H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, int mpi_rank, - int mpi_size); + const H5D_dset_io_info_t *di, + int H5_ATTR_NDEBUG_UNUSED mpi_rank); static herr_t H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, size_t *num_chunks_assigned_map, H5D_io_info_t *io_info, H5D_chk_idx_info_t *idx_info, int mpi_rank, int mpi_size); static herr_t H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, - size_t *num_chunks_assigned_map, - H5D_io_info_t *io_info, + size_t *num_chunks_assigned_map, + H5D_io_info_t *io_info, H5D_dset_io_info_t *di, H5D_chk_idx_info_t *idx_info, int mpi_rank, int mpi_size); static herr_t H5D__mpio_get_chunk_redistribute_info_types(MPI_Datatype *contig_type, @@ -362,11 +356,9 @@ static herr_t H5D__mpio_get_chunk_alloc_info_types(MPI_Datatype *contig_type, hb static herr_t H5D__mpio_get_chunk_insert_info_types(MPI_Datatype *contig_type, hbool_t *contig_type_derived, MPI_Datatype *resized_type, hbool_t *resized_type_derived); -static herr_t H5D__mpio_collective_filtered_io_type(H5D_filtered_collective_io_info_t *chunk_list, - size_t num_entries, H5D_io_op_type_t op_type, - MPI_Datatype *new_mem_type, hbool_t *mem_type_derived, - MPI_Datatype *new_file_type, hbool_t *file_type_derived); -static int H5D__cmp_chunk_addr(const void *chunk_addr_info1, const void *chunk_addr_info2); +static herr_t H5D__mpio_collective_filtered_vec_io(const H5D_filtered_collective_io_info_t *chunk_list, + H5F_shared_t *f_sh, H5D_io_op_type_t op_type); +static int H5D__cmp_piece_addr(const void *chunk_addr_info1, const void *chunk_addr_info2); static int H5D__cmp_filtered_collective_io_info_entry(const void *filtered_collective_io_info_entry1, const void *filtered_collective_io_info_entry2); static int H5D__cmp_chunk_redistribute_info(const void *entry1, const void *entry2); @@ -375,7 +367,7 @@ static int H5D__cmp_chunk_redistribute_info_orig_owner(const void *entry1, co #ifdef H5Dmpio_DEBUG static herr_t H5D__mpio_debug_init(void); static herr_t H5D__mpio_dump_collective_filtered_chunk_list(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, int mpi_rank); + int mpi_rank); #endif /*********************/ @@ -436,8 +428,8 @@ static FILE *debug_stream = NULL; #define H5D_MPIO_DEBUG(rank, string) \ do { \ if (debug_stream && H5D_MPIO_DEBUG_THIS_RANK(rank)) { \ - HDfprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank); \ - HDfflush(debug_stream); \ + fprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank); \ + fflush(debug_stream); \ } \ } while (0) @@ -445,8 +437,8 @@ static FILE *debug_stream = NULL; #define H5D_MPIO_DEBUG_VA(rank, string, ...) \ do { \ if (debug_stream && H5D_MPIO_DEBUG_THIS_RANK(rank)) { \ - HDfprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank, __VA_ARGS__); \ - HDfflush(debug_stream); \ + fprintf(debug_stream, "%*s(Rank %d) " string "\n", debug_indent, "", rank, __VA_ARGS__); \ + fflush(debug_stream); \ } \ } while (0) @@ -501,7 +493,7 @@ H5D__mpio_parse_debug_str(const char *s) { FUNC_ENTER_PACKAGE_NOERR - HDassert(s); + assert(s); while (*s) { int c = (int)(*s); @@ -548,10 +540,10 @@ H5D__mpio_debug_init(void) FUNC_ENTER_PACKAGE_NOERR - HDassert(!H5D_mpio_debug_inited); + assert(!H5D_mpio_debug_inited); /* Clear the debug flag buffer */ - HDmemset(H5D_mpio_debug_flags_s, 0, sizeof(H5D_mpio_debug_flags_s)); + memset(H5D_mpio_debug_flags_s, 0, sizeof(H5D_mpio_debug_flags_s)); /* Retrieve and parse the H5Dmpio debug string */ debug_str = HDgetenv("H5D_mpio_Debug"); @@ -572,34 +564,40 @@ H5D__mpio_debug_init(void) * Function: H5D__mpio_opt_possible * * Purpose: Checks if an direct I/O transfer is possible between memory and - * the file. + * the file. + * + * This was derived from H5D__mpio_opt_possible for + * multi-dset work. * * Return: Success: Non-negative: TRUE or FALSE * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, April 3, 2002 - * *------------------------------------------------------------------------- */ htri_t -H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, const H5S_t *mem_space, - const H5D_type_info_t *type_info) +H5D__mpio_opt_possible(H5D_io_info_t *io_info) { - H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */ + H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */ + size_t i; + H5D_t *dset; + const H5S_t *file_space; + const H5S_t *mem_space; + H5D_type_info_t *type_info; unsigned local_cause[2] = {0, 0}; /* [0] Local reason(s) for breaking collective mode */ /* [1] Flag if dataset is both: H5S_ALL and small */ unsigned global_cause[2] = {0, 0}; /* Global reason(s) for breaking collective mode */ - htri_t is_vl_storage; /* Whether the dataset's datatype is stored in a variable-length form */ - htri_t ret_value = SUCCEED; /* Return value */ + htri_t is_vl_storage; /* Whether the dataset's datatype is stored in a variable-length form */ + htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(io_info); - HDassert(mem_space); - HDassert(file_space); - HDassert(type_info); + assert(io_info); + + for (i = 0; i < io_info->count; i++) { + assert(io_info->dsets_info[i].file_space); + assert(io_info->dsets_info[i].mem_space); + } /* For independent I/O, get out quickly and don't try to form consensus */ if (H5CX_get_io_xfer_mode(&io_xfer_mode) < 0) @@ -608,90 +606,119 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, co if (io_xfer_mode == H5FD_MPIO_INDEPENDENT) local_cause[0] |= H5D_MPIO_SET_INDEPENDENT; - /* Optimized MPI types flag must be set */ - /* (based on 'HDF5_MPI_OPT_TYPES' environment variable) */ - if (!H5FD_mpi_opt_types_g) - local_cause[0] |= H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED; - - /* Don't allow collective operations if datatype conversions need to happen */ - if (!type_info->is_conv_noop) - local_cause[0] |= H5D_MPIO_DATATYPE_CONVERSION; - - /* Don't allow collective operations if data transform operations should occur */ - if (!type_info->is_xform_noop) - local_cause[0] |= H5D_MPIO_DATA_TRANSFORMS; - - /* Check whether these are both simple or scalar dataspaces */ - if (!((H5S_SIMPLE == H5S_GET_EXTENT_TYPE(mem_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(mem_space)) && - (H5S_SIMPLE == H5S_GET_EXTENT_TYPE(file_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(file_space)))) - local_cause[0] |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES; - - /* Dataset storage must be contiguous or chunked */ - if (!(io_info->dset->shared->layout.type == H5D_CONTIGUOUS || - io_info->dset->shared->layout.type == H5D_CHUNKED)) - local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; - - /* check if external-file storage is used */ - if (io_info->dset->shared->dcpl_cache.efl.nused > 0) - local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; - - /* The handling of memory space is different for chunking and contiguous - * storage. For contiguous storage, mem_space and file_space won't change - * when it it is doing disk IO. For chunking storage, mem_space will - * change for different chunks. So for chunking storage, whether we can - * use collective IO will defer until each chunk IO is reached. - */ + for (i = 0; i < io_info->count; i++) { + /* Check for skipped I/O */ + if (io_info->dsets_info[i].skip_io) + continue; + + /* Set convenience pointers */ + dset = io_info->dsets_info[i].dset; + file_space = io_info->dsets_info[i].file_space; + mem_space = io_info->dsets_info[i].mem_space; + type_info = &io_info->dsets_info[i].type_info; + + /* Optimized MPI types flag must be set */ + /* (based on 'HDF5_MPI_OPT_TYPES' environment variable) */ + if (!H5FD_mpi_opt_types_g) + local_cause[0] |= H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED; + + /* Decision on whether to use selection I/O should have been made by now */ + assert(io_info->use_select_io != H5D_SELECTION_IO_MODE_DEFAULT); + + /* Datatype conversions and transformations are allowed with selection I/O. If the selection I/O mode + * is auto (default), disable collective for now and re-enable later if we can */ + if (io_info->use_select_io != H5D_SELECTION_IO_MODE_ON) { + /* Don't allow collective operations if datatype conversions need to happen */ + if (!type_info->is_conv_noop) + local_cause[0] |= H5D_MPIO_DATATYPE_CONVERSION; + + /* Don't allow collective operations if data transform operations should occur */ + if (!type_info->is_xform_noop) + local_cause[0] |= H5D_MPIO_DATA_TRANSFORMS; + } + + /* Check whether these are both simple or scalar dataspaces */ + if (!((H5S_SIMPLE == H5S_GET_EXTENT_TYPE(mem_space) || + H5S_SCALAR == H5S_GET_EXTENT_TYPE(mem_space)) && + (H5S_SIMPLE == H5S_GET_EXTENT_TYPE(file_space) || + H5S_SCALAR == H5S_GET_EXTENT_TYPE(file_space)))) + local_cause[0] |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES; + + /* Dataset storage must be contiguous or chunked */ + if (!(dset->shared->layout.type == H5D_CONTIGUOUS || dset->shared->layout.type == H5D_CHUNKED)) + local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; + + /* check if external-file storage is used */ + if (dset->shared->dcpl_cache.efl.nused > 0) + local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; + + /* The handling of memory space is different for chunking and contiguous + * storage. For contiguous storage, mem_space and file_space won't change + * when it it is doing disk IO. For chunking storage, mem_space will + * change for different chunks. So for chunking storage, whether we can + * use collective IO will defer until each chunk IO is reached. + */ #ifndef H5_HAVE_PARALLEL_FILTERED_WRITES - /* Don't allow writes to filtered datasets if the functionality is disabled */ - if (io_info->op_type == H5D_IO_OP_WRITE && io_info->dset->shared->dcpl_cache.pline.nused > 0) - local_cause[0] |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED; + /* Don't allow writes to filtered datasets if the functionality is disabled */ + if (io_info->op_type == H5D_IO_OP_WRITE && dset->shared->dcpl_cache.pline.nused > 0) + local_cause[0] |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED; #endif - /* Check if we are able to do a MPI_Bcast of the data from one rank - * instead of having all the processes involved in the collective I/O call. - */ + /* Check if we would be able to perform collective if we could use selection I/O. If so add reasons + * for not using selection I/O to local_cause[0] */ + if ((io_info->use_select_io == H5D_SELECTION_IO_MODE_OFF) && local_cause[0] && + !(local_cause[0] & + ~((unsigned)H5D_MPIO_DATATYPE_CONVERSION | (unsigned)H5D_MPIO_DATA_TRANSFORMS))) { + assert(io_info->no_selection_io_cause & H5D_MPIO_NO_SELECTION_IO_CAUSES); + local_cause[0] |= H5D_MPIO_NO_SELECTION_IO; + } - /* Check to see if the process is reading the entire dataset */ - if (H5S_GET_SELECT_TYPE(file_space) != H5S_SEL_ALL) - local_cause[1] |= H5D_MPIO_RANK0_NOT_H5S_ALL; - /* Only perform this optimization for contiguous datasets, currently */ - else if (H5D_CONTIGUOUS != io_info->dset->shared->layout.type) - /* Flag to do a MPI_Bcast of the data from one proc instead of - * having all the processes involved in the collective I/O. + /* Check if we are able to do a MPI_Bcast of the data from one rank + * instead of having all the processes involved in the collective I/O call. */ - local_cause[1] |= H5D_MPIO_RANK0_NOT_CONTIGUOUS; - else if ((is_vl_storage = H5T_is_vl_storage(type_info->dset_type)) < 0) - local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE; - else if (is_vl_storage) - local_cause[1] |= H5D_MPIO_RANK0_NOT_FIXED_SIZE; - else { - size_t type_size; /* Size of dataset's datatype */ - /* Retrieve the size of the dataset's datatype */ - if (0 == (type_size = H5T_GET_SIZE(type_info->dset_type))) + /* Check to see if the process is reading the entire dataset */ + if (H5S_GET_SELECT_TYPE(file_space) != H5S_SEL_ALL) + local_cause[1] |= H5D_MPIO_RANK0_NOT_H5S_ALL; + /* Only perform this optimization for contiguous datasets, currently */ + else if (H5D_CONTIGUOUS != dset->shared->layout.type) + /* Flag to do a MPI_Bcast of the data from one proc instead of + * having all the processes involved in the collective I/O. + */ + local_cause[1] |= H5D_MPIO_RANK0_NOT_CONTIGUOUS; + else if ((is_vl_storage = H5T_is_vl_storage(type_info->dset_type)) < 0) local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE; + else if (is_vl_storage) + local_cause[1] |= H5D_MPIO_RANK0_NOT_FIXED_SIZE; else { - hssize_t snelmts; /* [Signed] # of elements in dataset's dataspace */ + size_t type_size; /* Size of dataset's datatype */ /* Retrieve the size of the dataset's datatype */ - if ((snelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0) + if (0 == (type_size = H5T_GET_SIZE(type_info->dset_type))) local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE; else { - hsize_t dset_size; + hssize_t snelmts; /* [Signed] # of elements in dataset's dataspace */ - /* Determine dataset size */ - dset_size = ((hsize_t)snelmts) * type_size; + /* Retrieve the size of the dataset's datatype */ + if ((snelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0) + local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE; + else { + hsize_t dset_size; - /* If the size of the dataset is less than 2GB then do an MPI_Bcast - * of the data from one process instead of having all the processes - * involved in the collective I/O. - */ - if (dset_size > ((hsize_t)(2.0F * H5_GB) - 1)) - local_cause[1] |= H5D_MPIO_RANK0_GREATER_THAN_2GB; - } /* end else */ - } /* end else */ - } /* end else */ + /* Determine dataset size */ + dset_size = ((hsize_t)snelmts) * type_size; + + /* If the size of the dataset is less than 2GB then do an MPI_Bcast + * of the data from one process instead of having all the processes + * involved in the collective I/O. + */ + if (dset_size > ((hsize_t)(2.0F * H5_GB) - 1)) + local_cause[1] |= H5D_MPIO_RANK0_GREATER_THAN_2GB; + } /* end else */ + } /* end else */ + } /* end else */ + } /* end for loop */ /* Check for independent I/O */ if (local_cause[0] & H5D_MPIO_SET_INDEPENDENT) @@ -753,13 +780,13 @@ H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, c FUNC_ENTER_PACKAGE - HDassert((local_cause && local_cause_len > 0) || (global_cause && global_cause_len > 0)); + assert((local_cause && local_cause_len > 0) || (global_cause && global_cause_len > 0)); /* * Use compile-time assertion so this routine is updated * when any new "no collective cause" values are added */ - HDcompile_assert(H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE == (H5D_mpio_no_collective_cause_t)256); + HDcompile_assert(H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE == (H5D_mpio_no_collective_cause_t)0x200); /* Initialize output buffers */ if (local_cause) @@ -769,9 +796,9 @@ H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, c /* Retrieve the local and global cause flags from the API context */ if (H5CX_get_mpio_local_no_coll_cause(&local_no_coll_cause) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "unable to get local no collective cause value") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "unable to get local no collective cause value"); if (H5CX_get_mpio_global_no_coll_cause(&global_no_coll_cause) < 0) - HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "unable to get global no collective cause value") + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTGET, FAIL, "unable to get global no collective cause value"); /* * Append each of the "reason for breaking collective I/O" @@ -812,10 +839,15 @@ H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, c case H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE: cause_str = "an error occurred while checking if collective I/O was possible"; break; + case H5D_MPIO_NO_SELECTION_IO: + cause_str = "collective I/O may be supported by selection or vector I/O but that feature was " + "not possible (see causes via H5Pget_no_selection_io_cause())"; + break; + case H5D_MPIO_COLLECTIVE: case H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE: default: - HDassert(0 && "invalid no collective cause reason"); + assert(0 && "invalid no collective cause reason"); break; } @@ -875,27 +907,30 @@ H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, c * * Purpose: MPI-IO function to read directly from app buffer to file. * - * Return: non-negative on success, negative on failure. + * This was referred from H5D__mpio_select_read for + * multi-dset work. * - * Programmer: + * Return: non-negative on success, negative on failure. * *------------------------------------------------------------------------- */ herr_t -H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info, - hsize_t mpi_buf_count, H5S_t H5_ATTR_UNUSED *file_space, +H5D__mpio_select_read(const H5D_io_info_t *io_info, hsize_t mpi_buf_count, H5S_t H5_ATTR_UNUSED *file_space, H5S_t H5_ATTR_UNUSED *mem_space) { - const H5D_contig_storage_t *store_contig = - &(io_info->store->contig); /* Contiguous storage info for this I/O operation */ + void *rbuf = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE + /* memory addr from a piece with lowest file addr */ + rbuf = io_info->base_maddr.vp; + + /*OKAY: CAST DISCARDS CONST QUALIFIER*/ H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t); - if (H5F_shared_block_read(io_info->f_sh, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, - io_info->u.rbuf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't finish collective parallel read") + if (H5F_shared_block_read(io_info->f_sh, H5FD_MEM_DRAW, io_info->store_faddr, (size_t)mpi_buf_count, + rbuf) < 0) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't finish collective parallel read"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -906,28 +941,30 @@ H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATT * * Purpose: MPI-IO function to write directly from app buffer to file. * - * Return: non-negative on success, negative on failure. + * This was referred from H5D__mpio_select_write for + * multi-dset work. * - * Programmer: + * Return: non-negative on success, negative on failure. * *------------------------------------------------------------------------- */ herr_t -H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNUSED *type_info, - hsize_t mpi_buf_count, H5S_t H5_ATTR_UNUSED *file_space, +H5D__mpio_select_write(const H5D_io_info_t *io_info, hsize_t mpi_buf_count, H5S_t H5_ATTR_UNUSED *file_space, H5S_t H5_ATTR_UNUSED *mem_space) { - const H5D_contig_storage_t *store_contig = - &(io_info->store->contig); /* Contiguous storage info for this I/O operation */ - herr_t ret_value = SUCCEED; + const void *wbuf = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE + /* memory addr from a piece with lowest file addr */ + wbuf = io_info->base_maddr.cvp; + /*OKAY: CAST DISCARDS CONST QUALIFIER*/ H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t); - if (H5F_shared_block_write(io_info->f_sh, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, - io_info->u.wbuf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't finish collective parallel write") + if (H5F_shared_block_write(io_info->f_sh, H5FD_MEM_DRAW, io_info->store_faddr, (size_t)mpi_buf_count, + wbuf) < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't finish collective parallel write"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -937,17 +974,15 @@ H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t H5_AT * Function: H5D__mpio_get_sum_chunk * * Purpose: Routine for obtaining total number of chunks to cover - * hyperslab selection selected by all processors. + * hyperslab selection selected by all processors. Operates + * on all datasets in the operation. * * Return: Non-negative on success/Negative on failure * - * Programmer: Muqun Yang - * Monday, Feb. 13th, 2006 - * *------------------------------------------------------------------------- */ static herr_t -H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info, const H5D_chunk_map_t *fm, int *sum_chunkf) +H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info, int *sum_chunkf) { int num_chunkf; /* Number of chunks to iterate over */ size_t ori_num_chunkf; @@ -958,7 +993,7 @@ H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info, const H5D_chunk_map_t *fm, /* Get the number of chunks to perform I/O on */ num_chunkf = 0; - ori_num_chunkf = H5SL_count(fm->sel_chunks); + ori_num_chunkf = io_info->pieces_added; H5_CHECKED_ASSIGN(num_chunkf, int, ori_num_chunkf, size_t); /* Determine the summation of number of chunks for all processes */ @@ -971,85 +1006,47 @@ H5D__mpio_get_sum_chunk(const H5D_io_info_t *io_info, const H5D_chunk_map_t *fm, } /* end H5D__mpio_get_sum_chunk() */ /*------------------------------------------------------------------------- - * Function: H5D__contig_collective_read - * - * Purpose: Reads directly from contiguous data in file into application - * memory using collective I/O. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Tuesday, March 4, 2008 + * Function: H5D__mpio_get_sum_chunk_dset * - *------------------------------------------------------------------------- - */ -herr_t -H5D__contig_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t H5_ATTR_UNUSED nelmts, H5S_t *file_space, H5S_t *mem_space, - H5D_chunk_map_t H5_ATTR_UNUSED *fm) -{ - H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_CONTIGUOUS_COLLECTIVE; - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Sanity check */ - HDassert(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_HAS_MPI)); - - /* Call generic internal collective I/O routine */ - if (H5D__inter_collective_io(io_info, type_info, file_space, mem_space) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't finish shared collective MPI-IO") - - /* Set the actual I/O mode property. internal_collective_io will not break to - * independent I/O, so we set it here. - */ - H5CX_set_mpio_actual_io_mode(actual_io_mode); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__contig_collective_read() */ - -/*------------------------------------------------------------------------- - * Function: H5D__contig_collective_write - * - * Purpose: Write directly to contiguous data in file from application - * memory using collective I/O. + * Purpose: Routine for obtaining total number of chunks to cover + * hyperslab selection selected by all processors. Operates + * on a single dataset. * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, March 4, 2008 - * *------------------------------------------------------------------------- */ -herr_t -H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t H5_ATTR_UNUSED nelmts, H5S_t *file_space, H5S_t *mem_space, - H5D_chunk_map_t H5_ATTR_UNUSED *fm) +static herr_t +H5D__mpio_get_sum_chunk_dset(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + int *sum_chunkf) { - H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_CONTIGUOUS_COLLECTIVE; - herr_t ret_value = SUCCEED; /* Return value */ + int num_chunkf; /* Number of chunks to iterate over */ + size_t ori_num_chunkf; + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_HAS_MPI)); + /* Check for non-chunked dataset, in this case we know the number of "chunks" + * is simply the mpi size */ + assert(dset_info->layout->type == H5D_CHUNKED); - /* Call generic internal collective I/O routine */ - if (H5D__inter_collective_io(io_info, type_info, file_space, mem_space) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't finish shared collective MPI-IO") + /* Get the number of chunks to perform I/O on */ + num_chunkf = 0; + ori_num_chunkf = H5SL_count(dset_info->layout_io_info.chunk_map->dset_sel_pieces); + H5_CHECKED_ASSIGN(num_chunkf, int, ori_num_chunkf, size_t); - /* Set the actual I/O mode property. internal_collective_io will not break to - * independent I/O, so we set it here. - */ - H5CX_set_mpio_actual_io_mode(actual_io_mode); + /* Determine the summation of number of chunks for all processes */ + if (MPI_SUCCESS != + (mpi_code = MPI_Allreduce(&num_chunkf, sum_chunkf, 1, MPI_INT, MPI_SUM, io_info->comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__contig_collective_write() */ +} /* end H5D__mpio_get_sum_chunk_dset() */ /*------------------------------------------------------------------------- - * Function: H5D__chunk_collective_io + * Function: H5D__piece_io * * Purpose: Routine for * 1) choose an IO option: @@ -1072,53 +1069,43 @@ H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type * 4. DO IO * * Return: Non-negative on success/Negative on failure - * - * Programmer: Muqun Yang - * Monday, Feb. 13th, 2006 - * - * Modification: - * - Refctore to remove multi-chunk-without-opimization feature and update for - * multi-chunk-io accordingly - * Programmer: Jonathan Kim - * Date: 2012-10-10 - * *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_chunk_map_t *fm) +H5D__piece_io(H5D_io_info_t *io_info) { H5FD_mpio_chunk_opt_t chunk_opt_mode; #ifdef H5Dmpio_DEBUG hbool_t log_file_flag = FALSE; FILE *debug_log_file = NULL; #endif -#ifdef H5_HAVE_INSTRUMENTED_LIBRARY - htri_t temp_not_link_io = FALSE; -#endif - int io_option = H5D_MULTI_CHUNK_IO_MORE_OPT; - int sum_chunk = -1; - int mpi_rank; - int mpi_size; - herr_t ret_value = SUCCEED; + int io_option = H5D_MULTI_CHUNK_IO_MORE_OPT; + hbool_t recalc_io_option = FALSE; + hbool_t use_multi_dset = FALSE; + unsigned one_link_chunk_io_threshold; /* Threshold to use single collective I/O for all chunks */ + int sum_chunk = -1; + int mpi_rank; + int mpi_size; + size_t i; + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(io_info); - HDassert(io_info->using_mpi_vfd); - HDassert(type_info); - HDassert(fm); + assert(io_info); + assert(io_info->using_mpi_vfd); + assert(io_info->count > 0); /* Obtain the current rank of the process and the number of ranks */ - if ((mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file)) < 0) - HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain MPI rank") - if ((mpi_size = H5F_mpi_get_size(io_info->dset->oloc.file)) < 0) - HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain MPI size") + if ((mpi_rank = H5F_mpi_get_rank(io_info->dsets_info[0].dset->oloc.file)) < 0) + HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain MPI rank"); + if ((mpi_size = H5F_mpi_get_size(io_info->dsets_info[0].dset->oloc.file)) < 0) + HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain MPI size"); #ifdef H5Dmpio_DEBUG /* Initialize file-level debugging if not initialized */ if (!H5D_mpio_debug_inited && H5D__mpio_debug_init() < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize H5Dmpio debugging") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize H5Dmpio debugging"); /* Open file for debugging if necessary */ log_file_flag = H5D_mpio_debug_flags_s[(int)'f']; @@ -1128,355 +1115,433 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf HDsnprintf(debug_log_filename, 1024, "H5Dmpio_debug.rank%d", mpi_rank); - if (NULL == (debug_log_file = HDfopen(debug_log_filename, "a"))) - HGOTO_ERROR(H5E_IO, H5E_OPENERROR, FAIL, "couldn't open debugging log file") + if (NULL == (debug_log_file = fopen(debug_log_filename, "a"))) + HGOTO_ERROR(H5E_IO, H5E_OPENERROR, FAIL, "couldn't open debugging log file"); /* Print a short header for this I/O operation */ time_now = HDtime(NULL); - HDfprintf(debug_log_file, "##### %s", HDasctime(HDlocaltime(&time_now))); + fprintf(debug_log_file, "##### %s", HDasctime(HDlocaltime(&time_now))); debug_stream = debug_log_file; } #endif - /* Check the optional property list for the collective chunk IO optimization option */ + /* Check the optional property list for the collective chunk IO optimization option. + * Only set here if it's a static option, if it needs to be calculated using the + * number of chunks per process delay that calculation until later. */ if (H5CX_get_mpio_chunk_opt_mode(&chunk_opt_mode) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get chunk optimization option") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get chunk optimization option"); if (H5FD_MPIO_CHUNK_ONE_IO == chunk_opt_mode) io_option = H5D_ONE_LINK_CHUNK_IO; /*no opt*/ /* direct request to multi-chunk-io */ else if (H5FD_MPIO_CHUNK_MULTI_IO == chunk_opt_mode) io_option = H5D_MULTI_CHUNK_IO; - /* via default path. branch by num threshold */ - else { - unsigned one_link_chunk_io_threshold; /* Threshold to use single collective I/O for all chunks */ - - if (H5D__mpio_get_sum_chunk(io_info, fm, &sum_chunk) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSWAP, FAIL, - "unable to obtain the total chunk number of all processes"); - - /* Get the chunk optimization option threshold */ - if (H5CX_get_mpio_chunk_opt_num(&one_link_chunk_io_threshold) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "couldn't get chunk optimization option threshold value") - - /* step 1: choose an IO option */ - /* If the average number of chunk per process is greater than a threshold, we will do one link chunked - * IO. */ - if ((unsigned)sum_chunk / (unsigned)mpi_size >= one_link_chunk_io_threshold) - io_option = H5D_ONE_LINK_CHUNK_IO_MORE_OPT; -#ifdef H5_HAVE_INSTRUMENTED_LIBRARY - else - temp_not_link_io = TRUE; -#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ - } /* end else */ + else + recalc_io_option = TRUE; + /* Check if we can and should use multi dataset path */ + if (io_info->count > 1 && (io_option == H5D_ONE_LINK_CHUNK_IO || recalc_io_option)) { + /* Use multi dataset path for now */ + use_multi_dset = TRUE; + + /* Check for filtered datasets */ + for (i = 0; i < io_info->count; i++) + if (io_info->dsets_info[i].dset->shared->dcpl_cache.pline.nused > 0) { + use_multi_dset = FALSE; + break; + } + + /* Check if this I/O exceeds one linked chunk threshold */ + if (recalc_io_option && use_multi_dset) { + /* Get the chunk optimization option threshold */ + if (H5CX_get_mpio_chunk_opt_num(&one_link_chunk_io_threshold) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, + "couldn't get chunk optimization option threshold value"); + + /* If the threshold is 0, no need to check number of chunks */ + if (one_link_chunk_io_threshold > 0) { + /* Get number of chunks for all processes */ + if (H5D__mpio_get_sum_chunk(io_info, &sum_chunk) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSWAP, FAIL, + "unable to obtain the total chunk number of all processes"); + + /* If the average number of chunk per process is less than the threshold, we will do multi + * chunk IO. If this threshold is not exceeded for all datasets, no need to check it again + * for each individual dataset. */ + if ((unsigned)sum_chunk / (unsigned)mpi_size < one_link_chunk_io_threshold) { + recalc_io_option = FALSE; + use_multi_dset = FALSE; + } + } + } + + /* Perform multi dataset I/O if appropriate */ + if (use_multi_dset) { #ifdef H5_HAVE_INSTRUMENTED_LIBRARY - { - /*** Set collective chunk user-input optimization APIs. ***/ - if (H5D_ONE_LINK_CHUNK_IO == io_option) { - if (H5CX_test_set_mpio_coll_chunk_link_hard(0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value") - } /* end if */ - else if (H5D_MULTI_CHUNK_IO == io_option) { - if (H5CX_test_set_mpio_coll_chunk_multi_hard(0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value") - } /* end else-if */ - else if (H5D_ONE_LINK_CHUNK_IO_MORE_OPT == io_option) { - if (H5CX_test_set_mpio_coll_chunk_link_num_true(0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value") - } /* end if */ - else if (temp_not_link_io) { - if (H5CX_test_set_mpio_coll_chunk_link_num_false(0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value") - } /* end if */ + /*** Set collective chunk user-input optimization API. ***/ + if (H5D_ONE_LINK_CHUNK_IO == io_option) { + if (H5CX_test_set_mpio_coll_chunk_link_hard(0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value"); + } /* end if */ +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + + /* Perform unfiltered link chunk collective IO */ + if (H5D__link_piece_collective_io(io_info, mpi_rank) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish linked chunk MPI-IO"); + } } -#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ - /* step 2: Go ahead to do IO.*/ - switch (io_option) { - case H5D_ONE_LINK_CHUNK_IO: - case H5D_ONE_LINK_CHUNK_IO_MORE_OPT: - /* Check if there are any filters in the pipeline */ - if (io_info->dset->shared->dcpl_cache.pline.nused > 0) { - if (H5D__link_chunk_filtered_collective_io(io_info, type_info, fm, mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish filtered linked chunk MPI-IO") - } /* end if */ - else - /* Perform unfiltered link chunk collective IO */ - if (H5D__link_chunk_collective_io(io_info, type_info, fm, sum_chunk, mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish linked chunk MPI-IO") - break; + if (!use_multi_dset) { + /* Loop over datasets */ + for (i = 0; i < io_info->count; i++) { + if (io_info->dsets_info[i].layout->type == H5D_CONTIGUOUS) { + /* Contiguous: call H5D__inter_collective_io() directly */ + H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_CONTIGUOUS_COLLECTIVE; - case H5D_MULTI_CHUNK_IO: /* direct request to do multi-chunk IO */ - default: /* multiple chunk IO via threshold */ - /* Check if there are any filters in the pipeline */ - if (io_info->dset->shared->dcpl_cache.pline.nused > 0) { - if (H5D__multi_chunk_filtered_collective_io(io_info, type_info, fm, mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, - "couldn't finish optimized multiple filtered chunk MPI-IO") - } /* end if */ - else - /* Perform unfiltered multi chunk collective IO */ - if (H5D__multi_chunk_collective_io(io_info, type_info, fm, mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish optimized multiple chunk MPI-IO") - break; - } /* end switch */ + io_info->store_faddr = io_info->dsets_info[i].store->contig.dset_addr; + io_info->base_maddr = io_info->dsets_info[i].buf; + + if (H5D__inter_collective_io(io_info, &io_info->dsets_info[i], + io_info->dsets_info[i].file_space, + io_info->dsets_info[i].mem_space) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish shared collective MPI-IO"); + + /* Set the actual I/O mode property. internal_collective_io will not break to + * independent I/O, so we set it here. + */ + H5CX_set_mpio_actual_io_mode(actual_io_mode); + } + else { + /* Chunked I/O path */ + assert(io_info->dsets_info[i].layout->type == H5D_CHUNKED); + + /* Recalculate io_option if necessary */ + if (recalc_io_option) { + /* Get the chunk optimization option threshold */ + if (H5CX_get_mpio_chunk_opt_num(&one_link_chunk_io_threshold) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, + "couldn't get chunk optimization option threshold value"); + + /* If the threshold is 0, no need to check number of chunks */ + if (one_link_chunk_io_threshold == 0) { + io_option = H5D_ONE_LINK_CHUNK_IO_MORE_OPT; + recalc_io_option = FALSE; + } + else { + /* Get number of chunks for all processes */ + if (H5D__mpio_get_sum_chunk_dset(io_info, &io_info->dsets_info[i], &sum_chunk) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSWAP, FAIL, + "unable to obtain the total chunk number of all processes"); + + /* step 1: choose an IO option */ + /* If the average number of chunk per process is greater than a threshold, we will do + * one link chunked IO. */ + if ((unsigned)sum_chunk / (unsigned)mpi_size >= one_link_chunk_io_threshold) + io_option = H5D_ONE_LINK_CHUNK_IO_MORE_OPT; + else + io_option = H5D_MULTI_CHUNK_IO_MORE_OPT; + } + } + + /* step 2: Go ahead to do IO.*/ + switch (io_option) { + case H5D_ONE_LINK_CHUNK_IO: + case H5D_ONE_LINK_CHUNK_IO_MORE_OPT: + /* Check if there are any filters in the pipeline */ + if (io_info->dsets_info[i].dset->shared->dcpl_cache.pline.nused > 0) { + if (H5D__link_chunk_filtered_collective_io(io_info, &io_info->dsets_info[i], + mpi_rank, mpi_size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, + "couldn't finish filtered linked chunk MPI-IO"); + } /* end if */ + else { + /* If there is more than one dataset we cannot make the multi dataset call here, + * fall back to multi chunk */ + if (io_info->count > 1) { + io_option = H5D_MULTI_CHUNK_IO_MORE_OPT; + recalc_io_option = TRUE; + + if (H5D__multi_chunk_collective_io(io_info, &io_info->dsets_info[i], mpi_rank, + mpi_size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, + "couldn't finish optimized multiple chunk MPI-IO"); + } + else { + /* Perform unfiltered link chunk collective IO */ + if (H5D__link_piece_collective_io(io_info, mpi_rank) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, + "couldn't finish linked chunk MPI-IO"); + } + } + + break; + + case H5D_MULTI_CHUNK_IO: /* direct request to do multi-chunk IO */ + default: /* multiple chunk IO via threshold */ + /* Check if there are any filters in the pipeline */ + if (io_info->dsets_info[i].dset->shared->dcpl_cache.pline.nused > 0) { + if (H5D__multi_chunk_filtered_collective_io(io_info, &io_info->dsets_info[i], + mpi_rank, mpi_size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, + "couldn't finish optimized multiple filtered chunk MPI-IO"); + } /* end if */ + else { + /* Perform unfiltered multi chunk collective IO */ + if (H5D__multi_chunk_collective_io(io_info, &io_info->dsets_info[i], mpi_rank, + mpi_size) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, + "couldn't finish optimized multiple chunk MPI-IO"); + } + + break; + } /* end switch */ + +#ifdef H5_HAVE_INSTRUMENTED_LIBRARY + { + /*** Set collective chunk user-input optimization APIs. ***/ + if (H5D_ONE_LINK_CHUNK_IO == io_option) { + if (H5CX_test_set_mpio_coll_chunk_link_hard(0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value"); + } /* end if */ + else if (H5D_MULTI_CHUNK_IO == io_option) { + if (H5CX_test_set_mpio_coll_chunk_multi_hard(0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value"); + } /* end else-if */ + else if (H5D_ONE_LINK_CHUNK_IO_MORE_OPT == io_option) { + if (H5CX_test_set_mpio_coll_chunk_link_num_true(0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value"); + } /* end if */ + else if (H5D_MULTI_CHUNK_IO_MORE_OPT == io_option) { + if (H5CX_test_set_mpio_coll_chunk_link_num_false(0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value"); + } /* end if */ + } +#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */ + } + } + } done: #ifdef H5Dmpio_DEBUG /* Close debugging log file */ if (debug_log_file) { - HDfprintf(debug_log_file, "##############\n\n"); - if (EOF == HDfclose(debug_log_file)) - HDONE_ERROR(H5E_IO, H5E_CLOSEERROR, FAIL, "couldn't close debugging log file") + fprintf(debug_log_file, "##############\n\n"); + if (EOF == fclose(debug_log_file)) + HDONE_ERROR(H5E_IO, H5E_CLOSEERROR, FAIL, "couldn't close debugging log file"); debug_stream = H5DEBUG(D); } #endif FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__chunk_collective_io */ +} /* end H5D__piece_io */ /*------------------------------------------------------------------------- - * Function: H5D__chunk_collective_read + * Function: H5D__collective_read * - * Purpose: Reads directly from chunks in file into application memory - * using collective I/O. + * Purpose: Read directly from pieces (chunks/contig) in file into + * application memory using collective I/O. * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, March 4, 2008 - * *------------------------------------------------------------------------- */ herr_t -H5D__chunk_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space, - H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm) +H5D__collective_read(H5D_io_info_t *io_info) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Call generic selection operation */ - if (H5D__chunk_collective_io(io_info, type_info, fm) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error") + if (H5D__piece_io(io_info) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error"); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__chunk_collective_read() */ +} /* end H5D__collective_read() */ /*------------------------------------------------------------------------- - * Function: H5D__chunk_collective_write + * Function: H5D__collective_write * - * Purpose: Write directly to chunks in file from application memory - * using collective I/O. + * Purpose: Write directly to pieces (chunks/contig) in file into + * application memory using collective I/O. * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, March 4, 2008 - * *------------------------------------------------------------------------- */ herr_t -H5D__chunk_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - hsize_t H5_ATTR_UNUSED nelmts, H5S_t H5_ATTR_UNUSED *file_space, - H5S_t H5_ATTR_UNUSED *mem_space, H5D_chunk_map_t *fm) +H5D__collective_write(H5D_io_info_t *io_info) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Call generic selection operation */ - if (H5D__chunk_collective_io(io_info, type_info, fm) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error") + if (H5D__piece_io(io_info) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error"); done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__chunk_collective_write() */ +} /* end H5D__collective_write() */ /*------------------------------------------------------------------------- - * Function: H5D__link_chunk_collective_io + * Function: H5D__link_piece_collective_io * - * Purpose: Routine for one collective IO with one MPI derived datatype to link with all chunks + * Purpose: Routine for single collective IO with one MPI derived datatype + * to link with all pieces (chunks + contig) * - * 1. Sort the chunk address and chunk info - * 2. Build up MPI derived datatype for each chunk - * 3. Build up the final MPI derived datatype - * 4. Use common collective IO routine to do MPI-IO + * 1. Use the piece addresses and piece info sorted in skiplist + * 2. Build up MPI derived datatype for each chunk + * 3. Build up the final MPI derived datatype + * 4. Use common collective IO routine to do MPI-IO * * Return: Non-negative on success/Negative on failure * - * Programmer: Muqun Yang - * Monday, Feb. 13th, 2006 - * *------------------------------------------------------------------------- */ static herr_t -H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, - int sum_chunk, int mpi_rank, int mpi_size) +#ifdef H5Dmpio_DEBUG +H5D__link_piece_collective_io(H5D_io_info_t *io_info, int mpi_rank) +#else +H5D__link_piece_collective_io(H5D_io_info_t *io_info, int H5_ATTR_UNUSED mpi_rank) +#endif { - H5D_chunk_addr_info_t *chunk_addr_info_array = NULL; - MPI_Datatype chunk_final_mtype; /* Final memory MPI datatype for all chunks with selection */ - hbool_t chunk_final_mtype_is_derived = FALSE; - MPI_Datatype chunk_final_ftype; /* Final file MPI datatype for all chunks with selection */ - hbool_t chunk_final_ftype_is_derived = FALSE; - H5D_storage_t ctg_store; /* Storage info for "fake" contiguous dataset */ - size_t total_chunks; - MPI_Datatype *chunk_mtype = NULL; - MPI_Datatype *chunk_ftype = NULL; - MPI_Aint *chunk_disp_array = NULL; - MPI_Aint *chunk_mem_disp_array = NULL; - hbool_t *chunk_mft_is_derived_array = + MPI_Datatype chunk_final_mtype; /* Final memory MPI datatype for all chunks with selection */ + hbool_t chunk_final_mtype_is_derived = FALSE; + MPI_Datatype chunk_final_ftype; /* Final file MPI datatype for all chunks with selection */ + hbool_t chunk_final_ftype_is_derived = FALSE; + H5D_storage_t ctg_store; /* Storage info for "fake" contiguous dataset */ + MPI_Datatype *chunk_mtype = NULL; + MPI_Datatype *chunk_ftype = NULL; + MPI_Aint *chunk_file_disp_array = NULL; + MPI_Aint *chunk_mem_disp_array = NULL; + hbool_t *chunk_mft_is_derived_array = NULL; /* Flags to indicate each chunk's MPI file datatype is derived */ hbool_t *chunk_mbt_is_derived_array = - NULL; /* Flags to indicate each chunk's MPI memory datatype is derived */ - int *chunk_mpi_file_counts = NULL; /* Count of MPI file datatype for each chunk */ - int *chunk_mpi_mem_counts = NULL; /* Count of MPI memory datatype for each chunk */ - int mpi_code; /* MPI return code */ - herr_t ret_value = SUCCEED; + NULL; /* Flags to indicate each chunk's MPI memory datatype is derived */ + int *chunk_mpi_file_counts = NULL; /* Count of MPI file datatype for each chunk */ + int *chunk_mpi_mem_counts = NULL; /* Count of MPI memory datatype for each chunk */ + int mpi_code; /* MPI return code */ + H5D_mpio_actual_chunk_opt_mode_t actual_chunk_opt_mode = H5D_MPIO_LINK_CHUNK; + H5D_mpio_actual_io_mode_t actual_io_mode = 0; + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE + /* set actual_io_mode */ + for (i = 0; i < io_info->count; i++) { + assert(io_info->dsets_info[i].dset->shared->dcpl_cache.pline.nused == 0); + if (io_info->dsets_info[i].layout->type == H5D_CHUNKED) + actual_io_mode |= H5D_MPIO_CHUNK_COLLECTIVE; + else if (io_info->dsets_info[i].layout->type == H5D_CONTIGUOUS) + actual_io_mode |= H5D_MPIO_CONTIGUOUS_COLLECTIVE; + else + HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout"); + } + /* Set the actual-chunk-opt-mode property. */ - H5CX_set_mpio_actual_chunk_opt(H5D_MPIO_LINK_CHUNK); + H5CX_set_mpio_actual_chunk_opt(actual_chunk_opt_mode); /* Set the actual-io-mode property. * Link chunk I/O does not break to independent, so can set right away */ - H5CX_set_mpio_actual_io_mode(H5D_MPIO_CHUNK_COLLECTIVE); - - /* Get the sum # of chunks, if not already available */ - if (sum_chunk < 0) { - if (H5D__mpio_get_sum_chunk(io_info, fm, &sum_chunk) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSWAP, FAIL, - "unable to obtain the total chunk number of all processes"); - } /* end if */ - - /* Retrieve total # of chunks in dataset */ - H5_CHECKED_ASSIGN(total_chunks, size_t, fm->layout->u.chunk.nchunks, hsize_t); - - /* Handle special case when dataspace dimensions only allow one chunk in - * the dataset. [This sometimes is used by developers who want the - * equivalent of compressed contiguous datasets - QAK] - */ - if (total_chunks == 1) { - H5SL_node_t *chunk_node; /* Pointer to chunk node for selection */ - H5S_t *fspace; /* Dataspace describing chunk & selection in it */ - H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */ - - /* Check for this process having selection in this chunk */ - chunk_node = H5SL_first(fm->sel_chunks); - - if (chunk_node == NULL) { - /* Set the dataspace info for I/O to NULL, this process doesn't have any I/O to perform */ - fspace = mspace = NULL; - - /* Initialize chunk address */ - ctg_store.contig.dset_addr = 0; - } /* end if */ - else { - H5D_chunk_ud_t udata; /* User data for querying chunk info */ - H5D_chunk_info_t *chunk_info; /* Info for chunk in skiplist */ - - /* Get the chunk info, for the selection in the chunk */ - if (NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node))) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skip list") - - /* Set the dataspace info for I/O */ - fspace = chunk_info->fspace; - mspace = chunk_info->mspace; - - /* Look up address of chunk */ - if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk address") - ctg_store.contig.dset_addr = udata.chunk_block.offset; - } /* end else */ - - /* Set up the base storage address for this chunk */ - io_info->store = &ctg_store; - -#ifdef H5Dmpio_DEBUG - H5D_MPIO_DEBUG(mpi_rank, "before inter_collective_io for total chunk = 1"); -#endif + H5CX_set_mpio_actual_io_mode(actual_io_mode); - /* Perform I/O */ - if (H5D__inter_collective_io(io_info, type_info, fspace, mspace) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't finish shared collective MPI-IO") - } /* end if */ - else { + /* Code block for actual actions (Build a MPI Type, IO) */ + { hsize_t mpi_buf_count; /* Number of MPI types */ size_t num_chunk; /* Number of chunks for this process */ - size_t u; /* Local index variable */ + + H5D_piece_info_t *piece_info; + + /* local variable for base address for buffer */ + H5_flexible_const_ptr_t base_buf_addr; + base_buf_addr.cvp = NULL; /* Get the number of chunks with a selection */ - num_chunk = H5SL_count(fm->sel_chunks); + num_chunk = io_info->pieces_added; H5_CHECK_OVERFLOW(num_chunk, size_t, int); #ifdef H5Dmpio_DEBUG - H5D_MPIO_DEBUG_VA(mpi_rank, "total_chunks = %zu, num_chunk = %zu", total_chunks, num_chunk); + H5D_MPIO_DEBUG_VA(mpi_rank, "num_chunk = %zu\n", num_chunk); #endif /* Set up MPI datatype for chunks selected */ if (num_chunk) { + hbool_t need_sort = FALSE; + + /* Check if sel_pieces array is sorted */ + assert(io_info->sel_pieces[0]->faddr != HADDR_UNDEF); + for (i = 1; i < num_chunk; i++) { + assert(io_info->sel_pieces[i]->faddr != HADDR_UNDEF); + + if (io_info->sel_pieces[i]->faddr < io_info->sel_pieces[i - 1]->faddr) { + need_sort = TRUE; + break; + } + } + + /* Sort sel_pieces if necessary */ + if (need_sort) + qsort(io_info->sel_pieces, io_info->pieces_added, sizeof(io_info->sel_pieces[0]), + H5D__cmp_piece_addr); + /* Allocate chunking information */ - if (NULL == (chunk_addr_info_array = - (H5D_chunk_addr_info_t *)H5MM_malloc(num_chunk * sizeof(H5D_chunk_addr_info_t)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk array buffer") if (NULL == (chunk_mtype = (MPI_Datatype *)H5MM_malloc(num_chunk * sizeof(MPI_Datatype)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "couldn't allocate chunk memory datatype buffer") + "couldn't allocate chunk memory datatype buffer"); if (NULL == (chunk_ftype = (MPI_Datatype *)H5MM_malloc(num_chunk * sizeof(MPI_Datatype)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file datatype buffer") - if (NULL == (chunk_disp_array = (MPI_Aint *)H5MM_malloc(num_chunk * sizeof(MPI_Aint)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file datatype buffer"); + if (NULL == (chunk_file_disp_array = (MPI_Aint *)H5MM_malloc(num_chunk * sizeof(MPI_Aint)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "couldn't allocate chunk file displacement buffer") + "couldn't allocate chunk file displacement buffer"); if (NULL == (chunk_mem_disp_array = (MPI_Aint *)H5MM_calloc(num_chunk * sizeof(MPI_Aint)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "couldn't allocate chunk memory displacement buffer") + "couldn't allocate chunk memory displacement buffer"); if (NULL == (chunk_mpi_mem_counts = (int *)H5MM_calloc(num_chunk * sizeof(int)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk memory counts buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk memory counts buffer"); if (NULL == (chunk_mpi_file_counts = (int *)H5MM_calloc(num_chunk * sizeof(int)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file counts buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk file counts buffer"); if (NULL == (chunk_mbt_is_derived_array = (hbool_t *)H5MM_calloc(num_chunk * sizeof(hbool_t)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "couldn't allocate chunk memory is derived datatype flags buffer") + "couldn't allocate chunk memory is derived datatype flags buffer"); if (NULL == (chunk_mft_is_derived_array = (hbool_t *)H5MM_calloc(num_chunk * sizeof(hbool_t)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "couldn't allocate chunk file is derived datatype flags buffer") + "couldn't allocate chunk file is derived datatype flags buffer"); -#ifdef H5Dmpio_DEBUG - H5D_MPIO_DEBUG(mpi_rank, "before sorting chunk addresses"); -#endif + /* save lowest file address */ + ctg_store.contig.dset_addr = io_info->sel_pieces[0]->faddr; - /* Sort the chunk address */ - if (H5D__sort_chunk(io_info, fm, chunk_addr_info_array, sum_chunk, mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSWAP, FAIL, "unable to sort chunk address") - ctg_store.contig.dset_addr = chunk_addr_info_array[0].chunk_addr; + /* save base mem addr of piece for read/write */ + base_buf_addr = io_info->sel_pieces[0]->dset_info->buf; #ifdef H5Dmpio_DEBUG - H5D_MPIO_DEBUG(mpi_rank, "after sorting chunk addresses"); + H5D_MPIO_DEBUG(mpi_rank, "before iterate over selected pieces\n"); #endif - /* Obtain MPI derived datatype from all individual chunks */ - for (u = 0; u < num_chunk; u++) { + /* Obtain MPI derived datatype from all individual pieces */ + /* Iterate over selected pieces for this process */ + for (i = 0; i < num_chunk; i++) { hsize_t *permute_map = NULL; /* array that holds the mapping from the old, out-of-order displacements to the in-order displacements of the MPI datatypes of the point selection of the file space */ hbool_t is_permuted = FALSE; + /* Assign convenience pointer to piece info */ + piece_info = io_info->sel_pieces[i]; + /* Obtain disk and memory MPI derived datatype */ /* NOTE: The permute_map array can be allocated within H5S_mpio_space_type * and will be fed into the next call to H5S_mpio_space_type * where it will be freed. */ - if (H5S_mpio_space_type(chunk_addr_info_array[u].chunk_info.fspace, type_info->src_type_size, - &chunk_ftype[u], /* OUT: datatype created */ - &chunk_mpi_file_counts[u], /* OUT */ - &(chunk_mft_is_derived_array[u]), /* OUT */ + if (H5S_mpio_space_type(piece_info->fspace, piece_info->dset_info->type_info.src_type_size, + &chunk_ftype[i], /* OUT: datatype created */ + &chunk_mpi_file_counts[i], /* OUT */ + &(chunk_mft_is_derived_array[i]), /* OUT */ TRUE, /* this is a file space, so permute the datatype if the point @@ -1487,13 +1552,14 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ selected in case they are out of order */ &is_permuted /* OUT */) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI file type") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI file type"); + /* Sanity check */ if (is_permuted) - HDassert(permute_map); - if (H5S_mpio_space_type(chunk_addr_info_array[u].chunk_info.mspace, type_info->dst_type_size, - &chunk_mtype[u], &chunk_mpi_mem_counts[u], - &(chunk_mbt_is_derived_array[u]), FALSE, /* this is a memory + assert(permute_map); + if (H5S_mpio_space_type(piece_info->mspace, piece_info->dset_info->type_info.dst_type_size, + &chunk_mtype[i], &chunk_mpi_mem_counts[i], + &(chunk_mbt_is_derived_array[i]), FALSE, /* this is a memory space, so if the file space is not permuted, there is no @@ -1507,24 +1573,32 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ and applied to the memory selection */ &is_permuted /* IN */) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI buf type") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI buf type"); /* Sanity check */ if (is_permuted) - HDassert(!permute_map); + assert(!permute_map); - /* Chunk address relative to the first chunk */ - chunk_addr_info_array[u].chunk_addr -= ctg_store.contig.dset_addr; + /* Piece address relative to the first piece addr + * Assign piece address to MPI displacement + * (assume MPI_Aint big enough to hold it) */ + chunk_file_disp_array[i] = (MPI_Aint)piece_info->faddr - (MPI_Aint)ctg_store.contig.dset_addr; - /* Assign chunk address to MPI displacement */ - /* (assume MPI_Aint big enough to hold it) */ - chunk_disp_array[u] = (MPI_Aint)chunk_addr_info_array[u].chunk_addr; + if (io_info->op_type == H5D_IO_OP_WRITE) { + chunk_mem_disp_array[i] = + (MPI_Aint)piece_info->dset_info->buf.cvp - (MPI_Aint)base_buf_addr.cvp; + } + else if (io_info->op_type == H5D_IO_OP_READ) { + chunk_mem_disp_array[i] = + (MPI_Aint)piece_info->dset_info->buf.vp - (MPI_Aint)base_buf_addr.vp; + } } /* end for */ /* Create final MPI derived datatype for the file */ if (MPI_SUCCESS != - (mpi_code = MPI_Type_create_struct((int)num_chunk, chunk_mpi_file_counts, chunk_disp_array, - chunk_ftype, &chunk_final_ftype))) + (mpi_code = MPI_Type_create_struct((int)num_chunk, chunk_mpi_file_counts, + chunk_file_disp_array, chunk_ftype, &chunk_final_ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code) + if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(&chunk_final_ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) chunk_final_ftype_is_derived = TRUE; @@ -1539,13 +1613,13 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ chunk_final_mtype_is_derived = TRUE; /* Free the file & memory MPI datatypes for each chunk */ - for (u = 0; u < num_chunk; u++) { - if (chunk_mbt_is_derived_array[u]) - if (MPI_SUCCESS != (mpi_code = MPI_Type_free(chunk_mtype + u))) + for (i = 0; i < num_chunk; i++) { + if (chunk_mbt_is_derived_array[i]) + if (MPI_SUCCESS != (mpi_code = MPI_Type_free(chunk_mtype + i))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if (chunk_mft_is_derived_array[u]) - if (MPI_SUCCESS != (mpi_code = MPI_Type_free(chunk_ftype + u))) + if (chunk_mft_is_derived_array[i]) + if (MPI_SUCCESS != (mpi_code = MPI_Type_free(chunk_ftype + i))) HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) } /* end for */ @@ -1555,6 +1629,9 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ else { /* no selection at all for this process */ ctg_store.contig.dset_addr = 0; + /* just provide a valid mem address. no actual IO occur */ + base_buf_addr = io_info->dsets_info[0].buf; + /* Set the MPI datatype */ chunk_final_ftype = MPI_BYTE; chunk_final_mtype = MPI_BYTE; @@ -1566,15 +1643,14 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ #ifdef H5Dmpio_DEBUG H5D_MPIO_DEBUG(mpi_rank, "before coming to final collective I/O"); #endif - - /* Set up the base storage address for this chunk */ - io_info->store = &ctg_store; + /* Set up the base storage address for this piece */ + io_info->store_faddr = ctg_store.contig.dset_addr; + io_info->base_maddr = base_buf_addr; /* Perform final collective I/O operation */ - if (H5D__final_collective_io(io_info, type_info, mpi_buf_count, chunk_final_ftype, - chunk_final_mtype) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish MPI-IO") - } /* end else */ + if (H5D__final_collective_io(io_info, mpi_buf_count, chunk_final_ftype, chunk_final_mtype) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish MPI-IO"); + } done: #ifdef H5Dmpio_DEBUG @@ -1583,14 +1659,12 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ #endif /* Release resources */ - if (chunk_addr_info_array) - H5MM_xfree(chunk_addr_info_array); if (chunk_mtype) H5MM_xfree(chunk_mtype); if (chunk_ftype) H5MM_xfree(chunk_ftype); - if (chunk_disp_array) - H5MM_xfree(chunk_disp_array); + if (chunk_file_disp_array) + H5MM_xfree(chunk_file_disp_array); if (chunk_mem_disp_array) H5MM_xfree(chunk_mem_disp_array); if (chunk_mpi_mem_counts) @@ -1609,7 +1683,7 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__link_chunk_collective_io */ +} /* end H5D__link_piece_collective_io */ /*------------------------------------------------------------------------- * Function: H5D__link_chunk_filtered_collective_io @@ -1665,7 +1739,7 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ * * TODO: Note that steps D. and F. here are both collective * operations that partially share data from the - * H5D_filtered_collective_io_info_t structure. To + * H5D_filtered_collective_chunk_info_t structure. To * try to conserve on memory a bit, the distributed * arrays these operations create are discarded after * each operation is performed. If memory consumption @@ -1680,29 +1754,18 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ *------------------------------------------------------------------------- */ static herr_t -H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5D_chunk_map_t *fm, int mpi_rank, int mpi_size) +H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, int mpi_rank, + int mpi_size) { - H5D_filtered_collective_io_info_t *chunk_list = NULL; /* The list of chunks being read/written */ - H5D_filtered_collective_io_info_t *chunk_hash_table = NULL; - unsigned char **chunk_msg_bufs = NULL; - H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */ - MPI_Datatype mem_type = MPI_BYTE; - MPI_Datatype file_type = MPI_BYTE; - hbool_t mem_type_is_derived = FALSE; - hbool_t file_type_is_derived = FALSE; - size_t *rank_chunks_assigned_map = NULL; - size_t chunk_list_num_entries; - size_t i; - int chunk_msg_bufs_len = 0; - int mpi_code; - herr_t ret_value = SUCCEED; + H5D_filtered_collective_io_info_t chunk_list = {0}; + unsigned char **chunk_msg_bufs = NULL; + size_t *rank_chunks_assigned_map = NULL; + int chunk_msg_bufs_len = 0; + herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_TAG(dset_info->dset->oloc.addr) - HDassert(io_info); - HDassert(type_info); - HDassert(fm); + assert(io_info); #ifdef H5Dmpio_DEBUG H5D_MPIO_TRACE_ENTER(mpi_rank); @@ -1720,36 +1783,33 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in H5CX_set_mpio_actual_io_mode(H5D_MPIO_CHUNK_COLLECTIVE); /* Build a list of selected chunks in the collective io operation */ - if (H5D__mpio_collective_filtered_chunk_io_setup(io_info, type_info, fm, &chunk_list, - &chunk_list_num_entries, mpi_rank) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list") + + if (H5D__mpio_collective_filtered_chunk_io_setup(io_info, dset_info, mpi_rank, &chunk_list) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list"); if (io_info->op_type == H5D_IO_OP_READ) { /* Filtered collective read */ - if (H5D__mpio_collective_filtered_chunk_read(chunk_list, chunk_list_num_entries, io_info, type_info, - mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't read filtered chunks") + if (H5D__mpio_collective_filtered_chunk_read(&chunk_list, io_info, dset_info, mpi_rank) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't read filtered chunks"); } else { /* Filtered collective write */ H5D_chk_idx_info_t index_info; - hsize_t mpi_buf_count; - H5D_MPIO_INIT_CHUNK_IDX_INFO(index_info, io_info); + H5D_MPIO_INIT_CHUNK_IDX_INFO(index_info, dset_info->dset); if (mpi_size > 1) { /* Redistribute shared chunks being written to */ - if (H5D__mpio_redistribute_shared_chunks(chunk_list, chunk_list_num_entries, io_info, fm, - mpi_rank, mpi_size, &rank_chunks_assigned_map) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to redistribute shared chunks") + if (H5D__mpio_redistribute_shared_chunks(&chunk_list, io_info, mpi_rank, mpi_size, + &rank_chunks_assigned_map) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to redistribute shared chunks"); /* Send any chunk modification messages for chunks this rank no longer owns */ - if (H5D__mpio_share_chunk_modification_data(chunk_list, &chunk_list_num_entries, io_info, - type_info, mpi_rank, mpi_size, &chunk_hash_table, + if (H5D__mpio_share_chunk_modification_data(&chunk_list, io_info, dset_info, mpi_rank, mpi_size, &chunk_msg_bufs, &chunk_msg_bufs_len) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, - "unable to send chunk modification data between MPI ranks") + "unable to send chunk modification data between MPI ranks"); /* Make sure the local chunk list was updated correctly */ - HDassert(chunk_list_num_entries == rank_chunks_assigned_map[mpi_rank]); + assert(chunk_list.num_chunk_infos == rank_chunks_assigned_map[mpi_rank]); } /* Proceed to update all the chunks this rank owns with its own @@ -1757,96 +1817,57 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in * the chunks. As chunk reads are done collectively here, all ranks * must participate. */ - if (H5D__mpio_collective_filtered_chunk_update(chunk_list, chunk_list_num_entries, chunk_hash_table, - chunk_msg_bufs, chunk_msg_bufs_len, io_info, type_info, - mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't update modified chunks") + if (H5D__mpio_collective_filtered_chunk_update(&chunk_list, chunk_msg_bufs, chunk_msg_bufs_len, + io_info, dset_info, mpi_rank) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't update modified chunks"); /* Free up resources used by chunk hash table now that we're done updating chunks */ - HASH_CLEAR(hh, chunk_hash_table); + HASH_CLEAR(hh, chunk_list.chunk_hash_table); /* All ranks now collectively re-allocate file space for all chunks */ - if (H5D__mpio_collective_filtered_chunk_reallocate(chunk_list, chunk_list_num_entries, - rank_chunks_assigned_map, io_info, &index_info, - mpi_rank, mpi_size) < 0) + if (H5D__mpio_collective_filtered_chunk_reallocate(&chunk_list, rank_chunks_assigned_map, io_info, + &index_info, mpi_rank, mpi_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, - "couldn't collectively re-allocate file space for chunks") + "couldn't collectively re-allocate file space for chunks"); - /* If this rank has any chunks selected, create a MPI type for collectively - * writing out the chunks to file. Otherwise, the rank contributes to the - * collective write with a none type. - */ - if (H5D__mpio_collective_filtered_io_type(chunk_list, chunk_list_num_entries, io_info->op_type, - &mem_type, &mem_type_is_derived, &file_type, - &file_type_is_derived) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "couldn't create MPI type for writing filtered chunks") - - mpi_buf_count = (file_type_is_derived || mem_type_is_derived) ? 1 : 0; - - /* Setup contig storage info for I/O operation */ - if (chunk_list_num_entries) { - /* - * Override the write buffer to point to the first - * chunk's data buffer - */ - io_info->u.wbuf = chunk_list[0].buf; - - /* - * Setup the base storage address for this operation - * to be the first chunk's file address - */ - ctg_store.contig.dset_addr = chunk_list[0].chunk_new.offset; - } - else - ctg_store.contig.dset_addr = 0; - - /* Perform I/O */ - io_info->store = &ctg_store; - if (H5D__final_collective_io(io_info, type_info, mpi_buf_count, file_type, mem_type) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish MPI-IO") + /* Perform vector I/O on chunks */ + if (H5D__mpio_collective_filtered_vec_io(&chunk_list, io_info->f_sh, io_info->op_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't perform vector I/O on filtered chunks"); /* Free up resources in anticipation of following collective operation */ - for (i = 0; i < chunk_list_num_entries; i++) { - if (chunk_list[i].buf) { - H5MM_free(chunk_list[i].buf); - chunk_list[i].buf = NULL; + for (size_t i = 0; i < chunk_list.num_chunk_infos; i++) { + if (chunk_list.chunk_infos[i].buf) { + H5MM_free(chunk_list.chunk_infos[i].buf); + chunk_list.chunk_infos[i].buf = NULL; } } /* Participate in the collective re-insertion of all chunks modified * into the chunk index */ - if (H5D__mpio_collective_filtered_chunk_reinsert(chunk_list, chunk_list_num_entries, - rank_chunks_assigned_map, io_info, &index_info, - mpi_rank, mpi_size) < 0) + if (H5D__mpio_collective_filtered_chunk_reinsert(&chunk_list, rank_chunks_assigned_map, io_info, + dset_info, &index_info, mpi_rank, mpi_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, - "couldn't collectively re-insert modified chunks into chunk index") + "couldn't collectively re-insert modified chunks into chunk index"); } done: - /* Free the MPI buf and file types, if they were derived */ - if (mem_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if (file_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if (chunk_msg_bufs) { - for (i = 0; i < (size_t)chunk_msg_bufs_len; i++) + for (size_t i = 0; i < (size_t)chunk_msg_bufs_len; i++) H5MM_free(chunk_msg_bufs[i]); H5MM_free(chunk_msg_bufs); } - HASH_CLEAR(hh, chunk_hash_table); + HASH_CLEAR(hh, chunk_list.chunk_hash_table); /* Free resources used by a rank which had some selection */ - if (chunk_list) { - for (i = 0; i < chunk_list_num_entries; i++) - if (chunk_list[i].buf) - H5MM_free(chunk_list[i].buf); + if (chunk_list.chunk_infos) { + for (size_t i = 0; i < chunk_list.num_chunk_infos; i++) + if (chunk_list.chunk_infos[i].buf) + H5MM_free(chunk_list.chunk_infos[i].buf); - H5MM_free(chunk_list); + H5MM_free(chunk_list.chunk_infos); } /* end if */ if (rank_chunks_assigned_map) @@ -1857,7 +1878,7 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in H5D_MPIO_TRACE_EXIT(mpi_rank); #endif - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__link_chunk_filtered_collective_io() */ /*------------------------------------------------------------------------- @@ -1872,40 +1893,43 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in * * Return: Non-negative on success/Negative on failure * - * Programmer: Muqun Yang - * Monday, Feb. 13th, 2006 - * *------------------------------------------------------------------------- */ static herr_t -H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5D_chunk_map_t *fm, - int mpi_rank, int mpi_size) +H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, int mpi_rank, + int mpi_size) { - H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */ - H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */ - H5D_io_info_t cpt_io_info; /* Compact I/O info object */ - H5D_storage_t cpt_store; /* Chunk storage information as compact dataset */ - hbool_t cpt_dirty; /* Temporary placeholder for compact storage "dirty" flag */ uint8_t *chunk_io_option = NULL; haddr_t *chunk_addr = NULL; H5D_storage_t store; /* union of EFL and chunk pointer in file space */ H5FD_mpio_collective_opt_t last_coll_opt_mode = H5FD_MPIO_COLLECTIVE_IO; /* Last parallel transfer with independent IO or collective IO with this mode */ + H5FD_mpio_collective_opt_t orig_coll_opt_mode = + H5FD_MPIO_COLLECTIVE_IO; /* Original parallel transfer property on entering this function */ size_t total_chunk; /* Total # of chunks in dataset */ - size_t u; /* Local index variable */ + size_t num_chunk; /* Number of chunks for this process */ + H5SL_node_t *piece_node = NULL; /* Current node in chunk skip list */ + H5D_piece_info_t *next_chunk_info = NULL; /* Chunk info for next selected chunk */ + size_t u; /* Local index variable */ H5D_mpio_actual_io_mode_t actual_io_mode = H5D_MPIO_NO_COLLECTIVE; /* Local variable for tracking the I/O mode used. */ herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_TAG(dset_info->dset->oloc.addr) + + assert(dset_info->layout->type == H5D_CHUNKED); + + /* Get the current I/O collective opt mode so we can restore it later */ + if (H5CX_get_mpio_coll_opt(&orig_coll_opt_mode) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property"); /* Set the actual chunk opt mode property */ H5CX_set_mpio_actual_chunk_opt(H5D_MPIO_MULTI_CHUNK); /* Retrieve total # of chunks in dataset */ - H5_CHECKED_ASSIGN(total_chunk, size_t, fm->layout->u.chunk.nchunks, hsize_t); - HDassert(total_chunk != 0); + H5_CHECKED_ASSIGN(total_chunk, size_t, dset_info->layout->u.chunk.nchunks, hsize_t); + assert(total_chunk != 0); /* Allocate memories */ chunk_io_option = (uint8_t *)H5MM_calloc(total_chunk); @@ -1916,47 +1940,62 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty #endif /* Obtain IO option for each chunk */ - if (H5D__obtain_mpio_mode(io_info, fm, chunk_io_option, chunk_addr, mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRECV, FAIL, "unable to obtain MPIO mode") - - /* Set up contiguous I/O info object */ - H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); - ctg_io_info.store = &ctg_store; - ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; - - /* Initialize temporary contiguous storage info */ - ctg_store.contig.dset_size = (hsize_t)io_info->dset->shared->layout.u.chunk.size; - - /* Set up compact I/O info object */ - H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); - cpt_io_info.store = &cpt_store; - cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; + if (H5D__obtain_mpio_mode(io_info, dset_info, chunk_io_option, chunk_addr, mpi_rank, mpi_size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTRECV, FAIL, "unable to obtain MPIO mode"); - /* Initialize temporary compact storage info */ - cpt_store.compact.dirty = &cpt_dirty; + /* Set memory buffers */ + io_info->base_maddr = dset_info->buf; /* Set dataset storage for I/O info */ - io_info->store = &store; + dset_info->store = &store; + + /* Get the number of chunks with a selection */ + num_chunk = H5SL_count(dset_info->layout_io_info.chunk_map->dset_sel_pieces); + + if (num_chunk) { + /* Start at the beginning of the chunk map skiplist. Since these chunks are + * stored in index order and since we're iterating in index order we can + * just check for each chunk being selected in order */ + if (NULL == (piece_node = H5SL_first(dset_info->layout_io_info.chunk_map->dset_sel_pieces))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get piece node from skip list"); + if (NULL == (next_chunk_info = (H5D_piece_info_t *)H5SL_item(piece_node))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get piece info from skip list"); + } /* Loop over _all_ the chunks */ for (u = 0; u < total_chunk; u++) { - H5D_chunk_info_t *chunk_info; /* Chunk info for current chunk */ + H5D_piece_info_t *chunk_info; /* Chunk info for current chunk */ H5S_t *fspace; /* Dataspace describing chunk & selection in it */ H5S_t *mspace; /* Dataspace describing selection in memory corresponding to this chunk */ #ifdef H5Dmpio_DEBUG H5D_MPIO_DEBUG_VA(mpi_rank, "mpi_rank = %d, chunk index = %zu", mpi_rank, u); #endif - /* Get the chunk info for this chunk, if there are elements selected */ - chunk_info = fm->select_chunk[u]; - /* Set the storage information for chunks with selections */ - if (chunk_info) { - HDassert(chunk_info->index == u); + /* Check if this chunk is the next chunk in the skip list, if there are + * selected chunks left to process */ + assert(!num_chunk || next_chunk_info); + assert(!num_chunk || next_chunk_info->index >= u); + if (num_chunk && next_chunk_info->index == u) { + /* Next chunk is this chunk */ + chunk_info = next_chunk_info; + + /* One less chunk to process */ + num_chunk--; + + /* Advance next chunk to next node in skip list, if there are more chunks selected */ + if (num_chunk) { + if (NULL == (piece_node = H5SL_next(piece_node))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "chunk skip list terminated early"); + if (NULL == (next_chunk_info = (H5D_piece_info_t *)H5SL_item(piece_node))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get piece info from skip list"); + } /* Pass in chunk's coordinates in a union. */ store.chunk.scaled = chunk_info->scaled; - } /* end if */ + } + else + chunk_info = NULL; /* Collective IO for this chunk, * Note: even there is no selection for this process, the process still @@ -1989,16 +2028,16 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty /* Switch back to collective I/O */ if (last_coll_opt_mode != H5FD_MPIO_COLLECTIVE_IO) { if (H5CX_set_mpio_coll_opt(H5FD_MPIO_COLLECTIVE_IO) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't switch to collective I/O") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't switch to collective I/O"); last_coll_opt_mode = H5FD_MPIO_COLLECTIVE_IO; } /* end if */ /* Initialize temporary contiguous storage address */ - ctg_store.contig.dset_addr = chunk_addr[u]; + io_info->store_faddr = chunk_addr[u]; /* Perform the I/O */ - if (H5D__inter_collective_io(&ctg_io_info, type_info, fspace, mspace) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish shared collective MPI-IO") + if (H5D__inter_collective_io(io_info, dset_info, fspace, mspace) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish shared collective MPI-IO"); } /* end if */ else { /* possible independent IO for this chunk */ #ifdef H5Dmpio_DEBUG @@ -2006,7 +2045,7 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty u); #endif - HDassert(chunk_io_option[u] == 0); + assert(chunk_io_option[u] == 0); /* Set the file & memory dataspaces */ if (chunk_info) { @@ -2023,16 +2062,16 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty /* Using independent I/O with file setview.*/ if (last_coll_opt_mode != H5FD_MPIO_INDIVIDUAL_IO) { if (H5CX_set_mpio_coll_opt(H5FD_MPIO_INDIVIDUAL_IO) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't switch to individual I/O") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't switch to individual I/O"); last_coll_opt_mode = H5FD_MPIO_INDIVIDUAL_IO; } /* end if */ /* Initialize temporary contiguous storage address */ - ctg_store.contig.dset_addr = chunk_addr[u]; + io_info->store_faddr = chunk_addr[u]; /* Perform the I/O */ - if (H5D__inter_collective_io(&ctg_io_info, type_info, fspace, mspace) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish shared collective MPI-IO") + if (H5D__inter_collective_io(io_info, dset_info, fspace, mspace) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish shared collective MPI-IO"); #ifdef H5Dmpio_DEBUG H5D_MPIO_DEBUG(mpi_rank, "after inter collective IO"); #endif @@ -2043,12 +2082,17 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty H5CX_set_mpio_actual_io_mode(actual_io_mode); done: + /* Reset collective opt mode */ + if (H5CX_set_mpio_coll_opt(orig_coll_opt_mode) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't reset MPI-I/O collective_op property"); + + /* Free memory */ if (chunk_io_option) H5MM_xfree(chunk_io_option); if (chunk_addr) H5MM_xfree(chunk_addr); - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__multi_chunk_collective_io */ /*------------------------------------------------------------------------- @@ -2115,7 +2159,7 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty * * TODO: Note that steps E. and G. here are both collective * operations that partially share data from the - * H5D_filtered_collective_io_info_t structure. To + * H5D_filtered_collective_chunk_info_t structure. To * try to conserve on memory a bit, the distributed * arrays these operations create are discarded after * each operation is performed. If memory consumption @@ -2130,31 +2174,20 @@ H5D__multi_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *ty *------------------------------------------------------------------------- */ static herr_t -H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5D_chunk_map_t *fm, int mpi_rank, int mpi_size) +H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, H5D_dset_io_info_t *dset_info, int mpi_rank, + int mpi_size) { - H5D_filtered_collective_io_info_t *chunk_list = NULL; /* The list of chunks being read/written */ - H5D_filtered_collective_io_info_t *chunk_hash_table = NULL; - unsigned char **chunk_msg_bufs = NULL; - H5D_io_info_t ctg_io_info; /* Contiguous I/O info object */ - H5D_storage_t ctg_store; /* Chunk storage information as contiguous dataset */ - MPI_Datatype mem_type = MPI_BYTE; - MPI_Datatype file_type = MPI_BYTE; - hbool_t mem_type_is_derived = FALSE; - hbool_t file_type_is_derived = FALSE; - hbool_t have_chunk_to_process; - size_t chunk_list_num_entries; - size_t i; - size_t max_num_chunks; - int chunk_msg_bufs_len = 0; - int mpi_code; - herr_t ret_value = SUCCEED; + H5D_filtered_collective_io_info_t chunk_list = {0}; + unsigned char **chunk_msg_bufs = NULL; + hbool_t have_chunk_to_process; + size_t max_num_chunks; + int chunk_msg_bufs_len = 0; + int mpi_code; + herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_TAG(dset_info->dset->oloc.addr) - HDassert(io_info); - HDassert(type_info); - HDassert(fm); + assert(io_info); #ifdef H5Dmpio_DEBUG H5D_MPIO_TRACE_ENTER(mpi_rank); @@ -2172,12 +2205,11 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i H5CX_set_mpio_actual_io_mode(H5D_MPIO_CHUNK_COLLECTIVE); /* Build a list of selected chunks in the collective IO operation */ - if (H5D__mpio_collective_filtered_chunk_io_setup(io_info, type_info, fm, &chunk_list, - &chunk_list_num_entries, mpi_rank) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list") + if (H5D__mpio_collective_filtered_chunk_io_setup(io_info, dset_info, mpi_rank, &chunk_list) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list"); /* Retrieve the maximum number of chunks selected for any rank */ - if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&chunk_list_num_entries, &max_num_chunks, 1, + if (MPI_SUCCESS != (mpi_code = MPI_Allreduce(&chunk_list.num_chunk_infos, &max_num_chunks, 1, MPI_UNSIGNED_LONG_LONG, MPI_MAX, io_info->comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code) @@ -2185,160 +2217,137 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i if (0 == max_num_chunks) HGOTO_DONE(SUCCEED); - /* Set up contiguous I/O info object */ - H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); - ctg_io_info.store = &ctg_store; - ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; - - /* Initialize temporary contiguous storage info */ - ctg_store.contig.dset_size = (hsize_t)io_info->dset->shared->layout.u.chunk.size; - if (io_info->op_type == H5D_IO_OP_READ) { /* Filtered collective read */ - for (i = 0; i < max_num_chunks; i++) { + for (size_t i = 0; i < max_num_chunks; i++) { + H5D_filtered_collective_io_info_t single_chunk_list = {0}; + /* Check if this rank has a chunk to work on for this iteration */ - have_chunk_to_process = (i < chunk_list_num_entries); + have_chunk_to_process = (i < chunk_list.num_chunk_infos); + + /* + * Setup a chunk list structure for either 1 or 0 chunks, depending + * on whether this rank has a chunk to work on for this iteration + */ + if (have_chunk_to_process) { + single_chunk_list.chunk_infos = &chunk_list.chunk_infos[i]; + single_chunk_list.num_chunk_infos = 1; + single_chunk_list.num_chunks_to_read = chunk_list.chunk_infos[i].need_read ? 1 : 0; + } + else { + single_chunk_list.chunk_infos = NULL; + single_chunk_list.num_chunk_infos = 0; + single_chunk_list.num_chunks_to_read = 0; + } - if (H5D__mpio_collective_filtered_chunk_read(have_chunk_to_process ? &chunk_list[i] : NULL, - have_chunk_to_process ? 1 : 0, io_info, type_info, - mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't read filtered chunks") + if (H5D__mpio_collective_filtered_chunk_read(&single_chunk_list, io_info, dset_info, mpi_rank) < + 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't read filtered chunks"); - if (have_chunk_to_process && chunk_list[i].buf) { - H5MM_free(chunk_list[i].buf); - chunk_list[i].buf = NULL; + if (have_chunk_to_process && chunk_list.chunk_infos[i].buf) { + H5MM_free(chunk_list.chunk_infos[i].buf); + chunk_list.chunk_infos[i].buf = NULL; } } } else { /* Filtered collective write */ H5D_chk_idx_info_t index_info; - hsize_t mpi_buf_count; /* Construct chunked index info */ - H5D_MPIO_INIT_CHUNK_IDX_INFO(index_info, io_info); + H5D_MPIO_INIT_CHUNK_IDX_INFO(index_info, dset_info->dset); if (mpi_size > 1) { /* Redistribute shared chunks being written to */ - if (H5D__mpio_redistribute_shared_chunks(chunk_list, chunk_list_num_entries, io_info, fm, - mpi_rank, mpi_size, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to redistribute shared chunks") + if (H5D__mpio_redistribute_shared_chunks(&chunk_list, io_info, mpi_rank, mpi_size, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to redistribute shared chunks"); /* Send any chunk modification messages for chunks this rank no longer owns */ - if (H5D__mpio_share_chunk_modification_data(chunk_list, &chunk_list_num_entries, io_info, - type_info, mpi_rank, mpi_size, &chunk_hash_table, + if (H5D__mpio_share_chunk_modification_data(&chunk_list, io_info, dset_info, mpi_rank, mpi_size, &chunk_msg_bufs, &chunk_msg_bufs_len) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, - "unable to send chunk modification data between MPI ranks") + "unable to send chunk modification data between MPI ranks"); } /* Iterate over the max number of chunks among all ranks, as this rank could * have no chunks left to work on, but it still needs to participate in the * collective re-allocation and re-insertion of chunks modified by other ranks. */ - for (i = 0; i < max_num_chunks; i++) { + for (size_t i = 0; i < max_num_chunks; i++) { + H5D_filtered_collective_io_info_t single_chunk_list = {0}; + /* Check if this rank has a chunk to work on for this iteration */ - have_chunk_to_process = (i < chunk_list_num_entries) && (mpi_rank == chunk_list[i].new_owner); + have_chunk_to_process = + (i < chunk_list.num_chunk_infos) && (mpi_rank == chunk_list.chunk_infos[i].new_owner); + + /* + * Setup a chunk list structure for either 1 or 0 chunks, depending + * on whether this rank has a chunk to work on for this iteration + */ + if (have_chunk_to_process) { + single_chunk_list.chunk_infos = &chunk_list.chunk_infos[i]; + single_chunk_list.chunk_hash_table = chunk_list.chunk_hash_table; + single_chunk_list.num_chunk_infos = 1; + single_chunk_list.num_chunks_to_read = chunk_list.chunk_infos[i].need_read ? 1 : 0; + } + else { + single_chunk_list.chunk_infos = NULL; + single_chunk_list.chunk_hash_table = chunk_list.chunk_hash_table; + single_chunk_list.num_chunk_infos = 0; + single_chunk_list.num_chunks_to_read = 0; + } /* Proceed to update the chunk this rank owns (if any left) with its * own modification data and data from other ranks, before re-filtering * the chunks. As chunk reads are done collectively here, all ranks * must participate. */ - if (H5D__mpio_collective_filtered_chunk_update(have_chunk_to_process ? &chunk_list[i] : NULL, - have_chunk_to_process ? 1 : 0, chunk_hash_table, - chunk_msg_bufs, chunk_msg_bufs_len, io_info, - type_info, mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't update modified chunks") + if (H5D__mpio_collective_filtered_chunk_update( + &single_chunk_list, chunk_msg_bufs, chunk_msg_bufs_len, io_info, dset_info, mpi_rank) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't update modified chunks"); /* All ranks now collectively re-allocate file space for all chunks */ - if (H5D__mpio_collective_filtered_chunk_reallocate(have_chunk_to_process ? &chunk_list[i] : NULL, - have_chunk_to_process ? 1 : 0, NULL, io_info, - &index_info, mpi_rank, mpi_size) < 0) + if (H5D__mpio_collective_filtered_chunk_reallocate(&single_chunk_list, NULL, io_info, &index_info, + mpi_rank, mpi_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, - "couldn't collectively re-allocate file space for chunks") - - /* - * If this rank has a chunk to work on, create a MPI type - * for writing out the chunk. Otherwise, the rank will - * use MPI_BYTE for the file and memory type and specify - * a count of 0. - */ - if (H5D__mpio_collective_filtered_io_type( - have_chunk_to_process ? &chunk_list[i] : NULL, have_chunk_to_process ? 1 : 0, - io_info->op_type, &mem_type, &mem_type_is_derived, &file_type, &file_type_is_derived) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "couldn't create MPI type for writing filtered chunks") - - mpi_buf_count = (file_type_is_derived || mem_type_is_derived) ? 1 : 0; - - /* Override the write buffer to point to the chunk data buffer */ - if (have_chunk_to_process) { - /* - * Override the write buffer to point to the - * chunk's data buffer - */ - ctg_io_info.u.wbuf = chunk_list[i].buf; - - /* - * Setup the base storage address for this - * operation to be the chunk's file address - */ - ctg_store.contig.dset_addr = chunk_list[i].chunk_new.offset; - } - else - ctg_store.contig.dset_addr = 0; + "couldn't collectively re-allocate file space for chunks"); - /* Perform the I/O */ - if (H5D__final_collective_io(&ctg_io_info, type_info, mpi_buf_count, file_type, mem_type) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish MPI-IO") + /* Perform vector I/O on chunks */ + if (H5D__mpio_collective_filtered_vec_io(&single_chunk_list, io_info->f_sh, io_info->op_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, + "couldn't perform vector I/O on filtered chunks"); /* Free up resources in anticipation of following collective operation */ - if (have_chunk_to_process && chunk_list[i].buf) { - H5MM_free(chunk_list[i].buf); - chunk_list[i].buf = NULL; + if (have_chunk_to_process && chunk_list.chunk_infos[i].buf) { + H5MM_free(chunk_list.chunk_infos[i].buf); + chunk_list.chunk_infos[i].buf = NULL; } /* Participate in the collective re-insertion of all chunks modified * in this iteration into the chunk index */ - if (H5D__mpio_collective_filtered_chunk_reinsert(have_chunk_to_process ? &chunk_list[i] : NULL, - have_chunk_to_process ? 1 : 0, NULL, io_info, + if (H5D__mpio_collective_filtered_chunk_reinsert(&single_chunk_list, NULL, io_info, dset_info, &index_info, mpi_rank, mpi_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, - "couldn't collectively re-insert modified chunks into chunk index") - - /* Free the MPI types, if they were derived */ - if (mem_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - mem_type_is_derived = FALSE; - if (file_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - file_type_is_derived = FALSE; + "couldn't collectively re-insert modified chunks into chunk index"); } /* end for */ } done: - /* Free the MPI buf and file types, if they were derived */ - if (mem_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if (file_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if (chunk_msg_bufs) { - for (i = 0; i < (size_t)chunk_msg_bufs_len; i++) + for (size_t i = 0; i < (size_t)chunk_msg_bufs_len; i++) H5MM_free(chunk_msg_bufs[i]); H5MM_free(chunk_msg_bufs); } - HASH_CLEAR(hh, chunk_hash_table); + HASH_CLEAR(hh, chunk_list.chunk_hash_table); /* Free resources used by a rank which had some selection */ - if (chunk_list) { - for (i = 0; i < chunk_list_num_entries; i++) - if (chunk_list[i].buf) - H5MM_free(chunk_list[i].buf); + if (chunk_list.chunk_infos) { + for (size_t i = 0; i < chunk_list.num_chunk_infos; i++) + if (chunk_list.chunk_infos[i].buf) + H5MM_free(chunk_list.chunk_infos[i].buf); - H5MM_free(chunk_list); + H5MM_free(chunk_list.chunk_infos); } /* end if */ #ifdef H5Dmpio_DEBUG @@ -2346,7 +2355,7 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i H5D_MPIO_TRACE_EXIT(mpi_rank); #endif - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5D__multi_chunk_filtered_collective_io() */ /*------------------------------------------------------------------------- @@ -2357,13 +2366,10 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i * * Return: Non-negative on success/Negative on failure * - * Programmer: Muqun Yang - * Monday, Feb. 13th, 2006 - * *------------------------------------------------------------------------- */ static herr_t -H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5S_t *file_space, +H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_dset_io_info_t *di, H5S_t *file_space, H5S_t *mem_space) { int mpi_buf_count; /* # of MPI types */ @@ -2379,13 +2385,15 @@ H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf FUNC_ENTER_PACKAGE #ifdef H5Dmpio_DEBUG - mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file); + mpi_rank = H5F_mpi_get_rank(di->dset->oloc.file); H5D_MPIO_TRACE_ENTER(mpi_rank); H5D_MPIO_TIME_START(mpi_rank, "Inter collective I/O"); if (mpi_rank < 0) - HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain MPI rank") + HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain MPI rank"); #endif + assert(io_info); + if ((file_space != NULL) && (mem_space != NULL)) { int mpi_file_count; /* Number of file "objects" to transfer */ hsize_t *permute_map = NULL; /* array that holds the mapping from the old, @@ -2394,12 +2402,14 @@ H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf point selection of the file space */ hbool_t is_permuted = FALSE; + assert(di); + /* Obtain disk and memory MPI derived datatype */ /* NOTE: The permute_map array can be allocated within H5S_mpio_space_type * and will be fed into the next call to H5S_mpio_space_type * where it will be freed. */ - if (H5S_mpio_space_type(file_space, type_info->src_type_size, &mpi_file_type, &mpi_file_count, + if (H5S_mpio_space_type(file_space, di->type_info.src_type_size, &mpi_file_type, &mpi_file_count, &mft_is_derived, /* OUT: datatype created */ TRUE, /* this is a file space, so permute the datatype if the @@ -2411,11 +2421,11 @@ H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf case they are out of order */ &is_permuted /* OUT */) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI file type") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI file type"); /* Sanity check */ if (is_permuted) - HDassert(permute_map); - if (H5S_mpio_space_type(mem_space, type_info->src_type_size, &mpi_buf_type, &mpi_buf_count, + assert(permute_map); + if (H5S_mpio_space_type(mem_space, di->type_info.src_type_size, &mpi_buf_type, &mpi_buf_count, &mbt_is_derived, /* OUT: datatype created */ FALSE, /* this is a memory space, so if the file space is not @@ -2430,10 +2440,10 @@ H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf memory selection */ , &is_permuted /* IN */) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI buffer type") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI buffer type"); /* Sanity check */ if (is_permuted) - HDassert(!permute_map); + assert(!permute_map); } /* end if */ else { /* For non-selection, participate with a none MPI derived datatype, the count is 0. */ @@ -2449,8 +2459,8 @@ H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf #endif /* Perform final collective I/O operation */ - if (H5D__final_collective_io(io_info, type_info, (hsize_t)mpi_buf_count, mpi_file_type, mpi_buf_type) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish collective MPI-IO") + if (H5D__final_collective_io(io_info, (hsize_t)mpi_buf_count, mpi_file_type, mpi_buf_type) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "couldn't finish collective MPI-IO"); done: /* Free the MPI buf and file types, if they were derived */ @@ -2475,14 +2485,11 @@ H5D__inter_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf * * Return: Non-negative on success/Negative on failure * - * Programmer: Muqun Yang - * Monday, Feb. 13th, 2006 - * *------------------------------------------------------------------------- */ static herr_t -H5D__final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t mpi_buf_count, - MPI_Datatype mpi_file_type, MPI_Datatype mpi_buf_type) +H5D__final_collective_io(H5D_io_info_t *io_info, hsize_t mpi_buf_count, MPI_Datatype mpi_file_type, + MPI_Datatype mpi_buf_type) { #ifdef H5Dmpio_DEBUG int mpi_rank; @@ -2492,24 +2499,24 @@ H5D__final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf FUNC_ENTER_PACKAGE #ifdef H5Dmpio_DEBUG - mpi_rank = H5F_mpi_get_rank(io_info->dset->oloc.file); + mpi_rank = H5F_mpi_get_rank(io_info->dsets_info[0].dset->oloc.file); H5D_MPIO_TRACE_ENTER(mpi_rank); H5D_MPIO_TIME_START(mpi_rank, "Final collective I/O"); if (mpi_rank < 0) - HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain MPI rank") + HGOTO_ERROR(H5E_IO, H5E_MPI, FAIL, "unable to obtain MPI rank"); #endif /* Pass buf type, file type to the file driver. */ if (H5CX_set_mpi_coll_datatypes(mpi_buf_type, mpi_file_type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O collective I/O datatypes") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set MPI-I/O collective I/O datatypes"); if (io_info->op_type == H5D_IO_OP_WRITE) { - if ((io_info->io_ops.single_write)(io_info, type_info, mpi_buf_count, NULL, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "optimized write failed") + if ((io_info->md_io_ops.single_write_md)(io_info, mpi_buf_count, NULL, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "optimized write failed"); } /* end if */ else { - if ((io_info->io_ops.single_read)(io_info, type_info, mpi_buf_count, NULL, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "optimized read failed") + if ((io_info->md_io_ops.single_read_md)(io_info, mpi_buf_count, NULL, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "optimized read failed"); } /* end else */ done: @@ -2523,30 +2530,28 @@ H5D__final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf } /* end H5D__final_collective_io */ /*------------------------------------------------------------------------- - * Function: H5D__cmp_chunk_addr + * Function: H5D__cmp_piece_addr * - * Purpose: Routine to compare chunk addresses + * Purpose: Routine to compare piece addresses * - * Description: Callback for qsort() to compare chunk addresses + * Description: Callback for qsort() to compare piece addresses * * Return: -1, 0, 1 * - * Programmer: Muqun Yang - * Monday, Feb. 13th, 2006 - * *------------------------------------------------------------------------- */ static int -H5D__cmp_chunk_addr(const void *chunk_addr_info1, const void *chunk_addr_info2) +H5D__cmp_piece_addr(const void *piece_info1, const void *piece_info2) { - haddr_t addr1 = HADDR_UNDEF, addr2 = HADDR_UNDEF; + haddr_t addr1; + haddr_t addr2; FUNC_ENTER_PACKAGE_NOERR - addr1 = ((const H5D_chunk_addr_info_t *)chunk_addr_info1)->chunk_addr; - addr2 = ((const H5D_chunk_addr_info_t *)chunk_addr_info2)->chunk_addr; + addr1 = (*((const H5D_piece_info_t *const *)piece_info1))->faddr; + addr2 = (*((const H5D_piece_info_t *const *)piece_info2))->faddr; - FUNC_LEAVE_NOAPI(H5F_addr_cmp(addr1, addr2)) + FUNC_LEAVE_NOAPI(H5_addr_cmp(addr1, addr2)) } /* end H5D__cmp_chunk_addr() */ /*------------------------------------------------------------------------- @@ -2566,38 +2571,38 @@ static int H5D__cmp_filtered_collective_io_info_entry(const void *filtered_collective_io_info_entry1, const void *filtered_collective_io_info_entry2) { - const H5D_filtered_collective_io_info_t *entry1; - const H5D_filtered_collective_io_info_t *entry2; - haddr_t addr1 = HADDR_UNDEF; - haddr_t addr2 = HADDR_UNDEF; - int ret_value; + const H5D_filtered_collective_chunk_info_t *entry1; + const H5D_filtered_collective_chunk_info_t *entry2; + haddr_t addr1 = HADDR_UNDEF; + haddr_t addr2 = HADDR_UNDEF; + int ret_value; FUNC_ENTER_PACKAGE_NOERR - entry1 = (const H5D_filtered_collective_io_info_t *)filtered_collective_io_info_entry1; - entry2 = (const H5D_filtered_collective_io_info_t *)filtered_collective_io_info_entry2; + entry1 = (const H5D_filtered_collective_chunk_info_t *)filtered_collective_io_info_entry1; + entry2 = (const H5D_filtered_collective_chunk_info_t *)filtered_collective_io_info_entry2; addr1 = entry1->chunk_new.offset; addr2 = entry2->chunk_new.offset; /* - * If both chunk addresses are defined, H5F_addr_cmp is safe to use. + * If both chunk addresses are defined, H5_addr_cmp is safe to use. * Otherwise, if both addresses aren't defined, compared chunk * entries based on their chunk index. Finally, if only one chunk * address is defined, return the appropriate value based on which * is defined. */ - if (H5F_addr_defined(addr1) && H5F_addr_defined(addr2)) { - ret_value = H5F_addr_cmp(addr1, addr2); + if (H5_addr_defined(addr1) && H5_addr_defined(addr2)) { + ret_value = H5_addr_cmp(addr1, addr2); } - else if (!H5F_addr_defined(addr1) && !H5F_addr_defined(addr2)) { + else if (!H5_addr_defined(addr1) && !H5_addr_defined(addr2)) { hsize_t chunk_idx1 = entry1->index_info.chunk_idx; hsize_t chunk_idx2 = entry2->index_info.chunk_idx; ret_value = (chunk_idx1 > chunk_idx2) - (chunk_idx1 < chunk_idx2); } else - ret_value = H5F_addr_defined(addr1) ? 1 : -1; + ret_value = H5_addr_defined(addr1) ? 1 : -1; FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__cmp_filtered_collective_io_info_entry() */ @@ -2632,249 +2637,77 @@ H5D__cmp_chunk_redistribute_info(const void *_entry1, const void *_entry2) chunk_index1 = entry1->chunk_idx; chunk_index2 = entry2->chunk_idx; - if (chunk_index1 == chunk_index2) { - int orig_owner1 = entry1->orig_owner; - int orig_owner2 = entry2->orig_owner; - - ret_value = (orig_owner1 > orig_owner2) - (orig_owner1 < orig_owner2); - } - else - ret_value = (chunk_index1 > chunk_index2) - (chunk_index1 < chunk_index2); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__cmp_chunk_redistribute_info() */ - -/*------------------------------------------------------------------------- - * Function: H5D__cmp_chunk_redistribute_info_orig_owner - * - * Purpose: Routine to compare the original owning MPI rank for two - * H5D_chunk_redistribute_info_t structures - * - * Description: Callback for qsort() to compare the original owning MPI - * rank for two H5D_chunk_redistribute_info_t - * structures - * - * Return: -1, 0, 1 - * - *------------------------------------------------------------------------- - */ -static int -H5D__cmp_chunk_redistribute_info_orig_owner(const void *_entry1, const void *_entry2) -{ - const H5D_chunk_redistribute_info_t *entry1; - const H5D_chunk_redistribute_info_t *entry2; - int owner1 = -1; - int owner2 = -1; - int ret_value; - - FUNC_ENTER_PACKAGE_NOERR - - entry1 = (const H5D_chunk_redistribute_info_t *)_entry1; - entry2 = (const H5D_chunk_redistribute_info_t *)_entry2; - - owner1 = entry1->orig_owner; - owner2 = entry2->orig_owner; - - if (owner1 == owner2) { - haddr_t addr1 = entry1->chunk_block.offset; - haddr_t addr2 = entry2->chunk_block.offset; - - /* - * If both chunk addresses are defined, H5F_addr_cmp is safe to use. - * Otherwise, if both addresses aren't defined, compared chunk - * entries based on their chunk index. Finally, if only one chunk - * address is defined, return the appropriate value based on which - * is defined. - */ - if (H5F_addr_defined(addr1) && H5F_addr_defined(addr2)) { - ret_value = H5F_addr_cmp(addr1, addr2); - } - else if (!H5F_addr_defined(addr1) && !H5F_addr_defined(addr2)) { - hsize_t chunk_idx1 = entry1->chunk_idx; - hsize_t chunk_idx2 = entry2->chunk_idx; - - ret_value = (chunk_idx1 > chunk_idx2) - (chunk_idx1 < chunk_idx2); - } - else - ret_value = H5F_addr_defined(addr1) ? 1 : -1; - } - else - ret_value = (owner1 > owner2) - (owner1 < owner2); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__cmp_chunk_redistribute_info_orig_owner() */ - -/*------------------------------------------------------------------------- - * Function: H5D__sort_chunk - * - * Purpose: Routine to sort chunks in increasing order of chunk address - * Each chunk address is also obtained. - * - * Description: - * For most cases, the chunk address has already been sorted in increasing order. - * The special sorting flag is used to optimize this common case. - * quick sort is used for necessary sorting. - * - * Parameters: - * Input: H5D_io_info_t* io_info, - * H5D_chunk_map_t *fm(global chunk map struct) - * Input/Output: H5D_chunk_addr_info_t chunk_addr_info_array[] : array to store chunk address - *and information many_chunk_opt : flag to optimize the way to obtain chunk addresses - * for many chunks - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Muqun Yang - * Monday, Feb. 13th, 2006 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__sort_chunk(H5D_io_info_t *io_info, const H5D_chunk_map_t *fm, - H5D_chunk_addr_info_t chunk_addr_info_array[], int sum_chunk, int mpi_rank, int mpi_size) -{ - H5SL_node_t *chunk_node; /* Current node in chunk skip list */ - H5D_chunk_info_t *chunk_info; /* Current chunking info. of this node. */ - haddr_t chunk_addr; /* Current chunking address of this node */ - haddr_t *total_chunk_addr_array = NULL; /* The array of chunk address for the total number of chunk */ - H5P_coll_md_read_flag_t md_reads_file_flag; - hbool_t md_reads_context_flag; - hbool_t restore_md_reads_state = FALSE; - hbool_t do_sort = FALSE; /* Whether the addresses need to be sorted */ - int bsearch_coll_chunk_threshold; - int many_chunk_opt = H5D_OBTAIN_ONE_CHUNK_ADDR_IND; - int mpi_code; /* MPI return code */ - int i; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE - - /* Calculate the actual threshold to obtain all chunk addresses collectively - * The bigger this number is, the more possible the use of obtaining chunk - * address collectively. - */ - /* For non-optimization one-link IO, actual bsearch threshold is always - * 0, we would always want to obtain the chunk addresses individually - * for each process. - */ - bsearch_coll_chunk_threshold = (sum_chunk * 100) / ((int)fm->layout->u.chunk.nchunks * mpi_size); - if ((bsearch_coll_chunk_threshold > H5D_ALL_CHUNK_ADDR_THRES_COL) && - ((sum_chunk / mpi_size) >= H5D_ALL_CHUNK_ADDR_THRES_COL_NUM)) - many_chunk_opt = H5D_OBTAIN_ALL_CHUNK_ADDR_COL; - -#ifdef H5Dmpio_DEBUG - H5D_MPIO_DEBUG_VA(mpi_rank, "many_chunk_opt = %d", many_chunk_opt); -#endif - - /* If we need to optimize the way to obtain the chunk address */ - if (many_chunk_opt != H5D_OBTAIN_ONE_CHUNK_ADDR_IND) { -#ifdef H5Dmpio_DEBUG - H5D_MPIO_DEBUG(mpi_rank, "Coming inside H5D_OBTAIN_ALL_CHUNK_ADDR_COL"); -#endif - /* Allocate array for chunk addresses */ - if (NULL == (total_chunk_addr_array = - (haddr_t *)H5MM_malloc(sizeof(haddr_t) * (size_t)fm->layout->u.chunk.nchunks))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory chunk address array") - - if (mpi_rank == 0) { - herr_t result; - - /* - * If enabled, disable collective metadata reads here. - * Since the chunk address mapping is done on rank 0 - * only here, it will cause problems if collective - * metadata reads are enabled. - */ - if (H5F_get_coll_metadata_reads(io_info->dset->oloc.file)) { - md_reads_file_flag = H5P_FORCE_FALSE; - md_reads_context_flag = FALSE; - H5F_set_coll_metadata_reads(io_info->dset->oloc.file, &md_reads_file_flag, - &md_reads_context_flag); - restore_md_reads_state = TRUE; - } - - result = H5D__chunk_addrmap(io_info, total_chunk_addr_array); - - /* Ensure that we restore the old collective metadata reads state */ - if (restore_md_reads_state) { - H5F_set_coll_metadata_reads(io_info->dset->oloc.file, &md_reads_file_flag, - &md_reads_context_flag); - restore_md_reads_state = FALSE; - } - - if (result < 0) { - size_t u; - - /* Clear total chunk address array */ - for (u = 0; u < (size_t)fm->layout->u.chunk.nchunks; u++) - total_chunk_addr_array[u] = HADDR_UNDEF; - - /* Push error, but still participate in following MPI_Bcast */ - HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") - } - } /* end if */ - - /* Broadcasting the MPI_IO option info. and chunk address info. */ - if (MPI_SUCCESS != (mpi_code = MPI_Bcast(total_chunk_addr_array, - (int)(sizeof(haddr_t) * fm->layout->u.chunk.nchunks), - MPI_BYTE, (int)0, io_info->comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code) - } /* end if */ - - /* Start at first node in chunk skip list */ - i = 0; - if (NULL == (chunk_node = H5SL_first(fm->sel_chunks))) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk node from skipped list") - - /* Iterate over all chunks for this process */ - while (chunk_node) { - if (NULL == (chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node))) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list") - - if (many_chunk_opt == H5D_OBTAIN_ONE_CHUNK_ADDR_IND) { - H5D_chunk_ud_t udata; /* User data for querying chunk info */ + if (chunk_index1 == chunk_index2) { + int orig_owner1 = entry1->orig_owner; + int orig_owner2 = entry2->orig_owner; - /* Get address of chunk */ - if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0) - HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list") - chunk_addr = udata.chunk_block.offset; - } /* end if */ - else - chunk_addr = total_chunk_addr_array[chunk_info->index]; + ret_value = (orig_owner1 > orig_owner2) - (orig_owner1 < orig_owner2); + } + else + ret_value = (chunk_index1 > chunk_index2) - (chunk_index1 < chunk_index2); - /* Check if chunk addresses are not in increasing order in the file */ - if (i > 0 && chunk_addr < chunk_addr_info_array[i - 1].chunk_addr) - do_sort = TRUE; + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__cmp_chunk_redistribute_info() */ - /* Set the address & info for this chunk */ - chunk_addr_info_array[i].chunk_addr = chunk_addr; - chunk_addr_info_array[i].chunk_info = *chunk_info; +/*------------------------------------------------------------------------- + * Function: H5D__cmp_chunk_redistribute_info_orig_owner + * + * Purpose: Routine to compare the original owning MPI rank for two + * H5D_chunk_redistribute_info_t structures + * + * Description: Callback for qsort() to compare the original owning MPI + * rank for two H5D_chunk_redistribute_info_t + * structures + * + * Return: -1, 0, 1 + * + *------------------------------------------------------------------------- + */ +static int +H5D__cmp_chunk_redistribute_info_orig_owner(const void *_entry1, const void *_entry2) +{ + const H5D_chunk_redistribute_info_t *entry1; + const H5D_chunk_redistribute_info_t *entry2; + int owner1 = -1; + int owner2 = -1; + int ret_value; - /* Advance to next chunk in list */ - i++; - chunk_node = H5SL_next(chunk_node); - } /* end while */ + FUNC_ENTER_PACKAGE_NOERR -#ifdef H5Dmpio_DEBUG - H5D_MPIO_DEBUG(mpi_rank, "before Qsort"); -#endif + entry1 = (const H5D_chunk_redistribute_info_t *)_entry1; + entry2 = (const H5D_chunk_redistribute_info_t *)_entry2; - if (do_sort) { - size_t num_chunks = H5SL_count(fm->sel_chunks); + owner1 = entry1->orig_owner; + owner2 = entry2->orig_owner; - HDqsort(chunk_addr_info_array, num_chunks, sizeof(chunk_addr_info_array[0]), H5D__cmp_chunk_addr); - } /* end if */ + if (owner1 == owner2) { + haddr_t addr1 = entry1->chunk_block.offset; + haddr_t addr2 = entry2->chunk_block.offset; -done: - /* Re-enable collective metadata reads if we disabled them */ - if (restore_md_reads_state) - H5F_set_coll_metadata_reads(io_info->dset->oloc.file, &md_reads_file_flag, &md_reads_context_flag); + /* + * If both chunk addresses are defined, H5_addr_cmp is safe to use. + * Otherwise, if both addresses aren't defined, compared chunk + * entries based on their chunk index. Finally, if only one chunk + * address is defined, return the appropriate value based on which + * is defined. + */ + if (H5_addr_defined(addr1) && H5_addr_defined(addr2)) { + ret_value = H5_addr_cmp(addr1, addr2); + } + else if (!H5_addr_defined(addr1) && !H5_addr_defined(addr2)) { + hsize_t chunk_idx1 = entry1->chunk_idx; + hsize_t chunk_idx2 = entry2->chunk_idx; - if (total_chunk_addr_array) - H5MM_xfree(total_chunk_addr_array); + ret_value = (chunk_idx1 > chunk_idx2) - (chunk_idx1 < chunk_idx2); + } + else + ret_value = H5_addr_defined(addr1) ? 1 : -1; + } + else + ret_value = (owner1 > owner2) - (owner1 < owner2); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__sort_chunk() */ +} /* end H5D__cmp_chunk_redistribute_info_orig_owner() */ /*------------------------------------------------------------------------- * Function: H5D__obtain_mpio_mode @@ -2902,19 +2735,16 @@ H5D__sort_chunk(H5D_io_info_t *io_info, const H5D_chunk_map_t *fm, * Parameters: * * Input: H5D_io_info_t* io_info, - * H5D_chunk_map_t *fm,(global chunk map struct) + * H5D_dset_io_info_t *di,(dataset info struct) * Output: uint8_t assign_io_mode[], : IO mode, collective, independent or none * haddr_t chunk_addr[], : chunk address array for each chunk * * Return: Non-negative on success/Negative on failure * - * Programmer: Muqun Yang - * Monday, Feb. 13th, 2006 - * *------------------------------------------------------------------------- */ static herr_t -H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm, uint8_t assign_io_mode[], +H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_dset_io_info_t *di, uint8_t assign_io_mode[], haddr_t chunk_addr[], int mpi_rank, int mpi_size) { size_t total_chunks; @@ -2924,7 +2754,7 @@ H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm, uint8_t assig uint8_t *mergebuf = NULL; uint8_t *tempbuf; H5SL_node_t *chunk_node; - H5D_chunk_info_t *chunk_info; + H5D_piece_info_t *chunk_info; H5P_coll_md_read_flag_t md_reads_file_flag; hbool_t md_reads_context_flag; hbool_t restore_md_reads_state = FALSE; @@ -2936,47 +2766,49 @@ H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm, uint8_t assig FUNC_ENTER_PACKAGE + assert(di->layout->type == H5D_CHUNKED); + /* Assign the rank 0 to the root */ root = 0; comm = io_info->comm; /* Setup parameters */ - H5_CHECKED_ASSIGN(total_chunks, size_t, fm->layout->u.chunk.nchunks, hsize_t); + H5_CHECKED_ASSIGN(total_chunks, size_t, di->layout->u.chunk.nchunks, hsize_t); if (H5CX_get_mpio_chunk_opt_ratio(&percent_nproc_per_chunk) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get percent nproc per chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get percent nproc per chunk"); /* if ratio is 0, perform collective io */ if (0 == percent_nproc_per_chunk) { - if (H5D__chunk_addrmap(io_info, chunk_addr) < 0) + if (H5D__chunk_addrmap(di->dset, chunk_addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address"); for (ic = 0; ic < total_chunks; ic++) assign_io_mode[ic] = H5D_CHUNK_IO_MODE_COL; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ threshold_nproc_per_chunk = (unsigned)mpi_size * percent_nproc_per_chunk / 100; /* Allocate memory */ if (NULL == (io_mode_info = (uint8_t *)H5MM_calloc(total_chunks))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate I/O mode info buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate I/O mode info buffer"); if (NULL == (mergebuf = (uint8_t *)H5MM_malloc((sizeof(haddr_t) + 1) * total_chunks))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate mergebuf buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate mergebuf buffer"); tempbuf = mergebuf + total_chunks; if (mpi_rank == root) if (NULL == (recv_io_mode_info = (uint8_t *)H5MM_malloc(total_chunks * (size_t)mpi_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate recv I/O mode info buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate recv I/O mode info buffer"); /* Obtain the regularity and selection information for all chunks in this process. */ - chunk_node = H5SL_first(fm->sel_chunks); + chunk_node = H5SL_first(di->layout_io_info.chunk_map->dset_sel_pieces); while (chunk_node) { - chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node); + chunk_info = (H5D_piece_info_t *)H5SL_item(chunk_node); io_mode_info[chunk_info->index] = H5D_CHUNK_SELECT_REG; /* this chunk is selected and is "regular" */ chunk_node = H5SL_next(chunk_node); } /* end while */ /* Gather all the information */ - H5_CHECK_OVERFLOW(total_chunks, size_t, int) + H5_CHECK_OVERFLOW(total_chunks, size_t, int); if (MPI_SUCCESS != (mpi_code = MPI_Gather(io_mode_info, (int)total_chunks, MPI_BYTE, recv_io_mode_info, (int)total_chunks, MPI_BYTE, root, comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Gather failed", mpi_code) @@ -2992,23 +2824,22 @@ H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm, uint8_t assig * only here, it will cause problems if collective * metadata reads are enabled. */ - if (H5F_get_coll_metadata_reads(io_info->dset->oloc.file)) { + if (H5F_get_coll_metadata_reads(di->dset->oloc.file)) { md_reads_file_flag = H5P_FORCE_FALSE; md_reads_context_flag = FALSE; - H5F_set_coll_metadata_reads(io_info->dset->oloc.file, &md_reads_file_flag, - &md_reads_context_flag); + H5F_set_coll_metadata_reads(di->dset->oloc.file, &md_reads_file_flag, &md_reads_context_flag); restore_md_reads_state = TRUE; } /* pre-computing: calculate number of processes and regularity of the selection occupied in each chunk */ if (NULL == (nproc_per_chunk = (unsigned *)H5MM_calloc(total_chunks * sizeof(unsigned)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate nproc_per_chunk buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate nproc_per_chunk buffer"); /* calculating the chunk address */ - if (H5D__chunk_addrmap(io_info, chunk_addr) < 0) { + if (H5D__chunk_addrmap(di->dset, chunk_addr) < 0) { H5MM_free(nproc_per_chunk); - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address"); } /* end if */ /* checking for number of process per chunk and regularity of the selection*/ @@ -3039,7 +2870,7 @@ H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm, uint8_t assig /* Broadcasting the MPI_IO option info. and chunk address info. */ if ((sizeof(haddr_t) + 1) * total_chunks > INT_MAX) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "result overflow") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "result overflow"); if (MPI_SUCCESS != (mpi_code = MPI_Bcast(mergebuf, (int)((sizeof(haddr_t) + 1) * total_chunks), MPI_BYTE, root, comm))) HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code) @@ -3054,28 +2885,28 @@ H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm, uint8_t assig for (ic = 0; ic < total_chunks; ic++) if (assign_io_mode[ic] == H5D_CHUNK_IO_MODE_COL) { if (H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value"); coll_op = TRUE; break; } /* end if */ if (!coll_op) if (H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set property value"); } #endif done: /* Re-enable collective metadata reads if we disabled them */ if (restore_md_reads_state) - H5F_set_coll_metadata_reads(io_info->dset->oloc.file, &md_reads_file_flag, &md_reads_context_flag); + H5F_set_coll_metadata_reads(di->dset->oloc.file, &md_reads_file_flag, &md_reads_context_flag); if (io_mode_info) H5MM_free(io_mode_info); if (mergebuf) H5MM_free(mergebuf); if (recv_io_mode_info) { - HDassert(mpi_rank == root); + assert(mpi_rank == root); H5MM_free(recv_io_mode_info); } /* end if */ @@ -3098,25 +2929,22 @@ H5D__obtain_mpio_mode(H5D_io_info_t *io_info, H5D_chunk_map_t *fm, uint8_t assig *------------------------------------------------------------------------- */ static herr_t -H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - const H5D_chunk_map_t *fm, - H5D_filtered_collective_io_info_t **chunk_list, - size_t *num_entries, int mpi_rank) +H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *di, + int mpi_rank, H5D_filtered_collective_io_info_t *chunk_list) { - H5D_filtered_collective_io_info_t *local_info_array = NULL; - H5D_chunk_ud_t udata; - hbool_t filter_partial_edge_chunks; - size_t num_chunks_selected; - size_t i; - herr_t ret_value = SUCCEED; + H5D_filtered_collective_chunk_info_t *local_info_array = NULL; + H5D_chunk_ud_t udata; + hbool_t filter_partial_edge_chunks; + size_t num_chunks_selected; + size_t num_chunks_to_read = 0; + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - HDassert(io_info); - HDassert(type_info); - HDassert(fm); - HDassert(chunk_list); - HDassert(num_entries); + assert(io_info); + assert(di); + assert(di->layout->type == H5D_CHUNKED); + assert(chunk_list); #ifdef H5Dmpio_DEBUG H5D_MPIO_TRACE_ENTER(mpi_rank); @@ -3124,26 +2952,26 @@ H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const #endif /* Each rank builds a local list of the chunks they have selected */ - if ((num_chunks_selected = H5SL_count(fm->sel_chunks))) { - H5D_chunk_info_t *chunk_info; + if ((num_chunks_selected = H5SL_count(di->layout_io_info.chunk_map->dset_sel_pieces))) { + H5D_piece_info_t *chunk_info; H5SL_node_t *chunk_node; hsize_t select_npoints; hbool_t need_sort = FALSE; /* Determine whether partial edge chunks should be filtered */ - filter_partial_edge_chunks = !(io_info->dset->shared->layout.u.chunk.flags & - H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + filter_partial_edge_chunks = + !(di->dset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); if (NULL == (local_info_array = H5MM_malloc(num_chunks_selected * sizeof(*local_info_array)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate local io info array buffer") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate local io info array buffer"); - chunk_node = H5SL_first(fm->sel_chunks); - for (i = 0; chunk_node; i++) { - chunk_info = (H5D_chunk_info_t *)H5SL_item(chunk_node); + chunk_node = H5SL_first(di->layout_io_info.chunk_map->dset_sel_pieces); + for (size_t i = 0; chunk_node; i++) { + chunk_info = (H5D_piece_info_t *)H5SL_item(chunk_node); /* Obtain this chunk's address */ - if (H5D__chunk_lookup(io_info->dset, chunk_info->scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + if (H5D__chunk_lookup(di->dset, chunk_info->scaled, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); /* Initialize rank-local chunk info */ local_info_array[i].chunk_info = chunk_info; @@ -3154,7 +2982,7 @@ H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const local_info_array[i].buf = NULL; select_npoints = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); - local_info_array[i].io_size = (size_t)select_npoints * type_info->dst_type_size; + local_info_array[i].io_size = (size_t)select_npoints * di->type_info.dst_type_size; /* * Determine whether this chunk will need to be read from the file. If this is @@ -3204,18 +3032,21 @@ H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const local_info_array[i].need_read = TRUE; else { local_info_array[i].need_read = - local_info_array[i].io_size < (size_t)io_info->dset->shared->layout.u.chunk.size; + local_info_array[i].io_size < (size_t)di->dset->shared->layout.u.chunk.size; } + if (local_info_array[i].need_read) + num_chunks_to_read++; + local_info_array[i].skip_filter_pline = FALSE; if (!filter_partial_edge_chunks) { /* * If this is a partial edge chunk and the "don't filter partial edge * chunks" flag is set, make sure not to apply filters to the chunk. */ - if (H5D__chunk_is_partial_edge_chunk(io_info->dset->shared->ndims, - io_info->dset->shared->layout.u.chunk.dim, - chunk_info->scaled, io_info->dset->shared->curr_dims)) + if (H5D__chunk_is_partial_edge_chunk(di->dset->shared->ndims, + di->dset->shared->layout.u.chunk.dim, chunk_info->scaled, + di->dset->shared->curr_dims)) local_info_array[i].skip_filter_pline = TRUE; } @@ -3232,7 +3063,7 @@ H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const haddr_t curr_chunk_offset = local_info_array[i].chunk_current.offset; haddr_t prev_chunk_offset = local_info_array[i - 1].chunk_current.offset; - if (!H5F_addr_defined(prev_chunk_offset) || !H5F_addr_defined(curr_chunk_offset) || + if (!H5_addr_defined(prev_chunk_offset) || !H5_addr_defined(curr_chunk_offset) || (curr_chunk_offset < prev_chunk_offset)) need_sort = TRUE; } @@ -3244,7 +3075,7 @@ H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const * extensible array code calculated instead of what was calculated * in the chunk file mapping. */ - if (io_info->dset->shared->layout.u.chunk.idx_type == H5D_CHUNK_IDX_EARRAY) + if (di->dset->shared->layout.u.chunk.idx_type == H5D_CHUNK_IDX_EARRAY) local_info_array[i].index_info.chunk_idx = udata.chunk_idx; else local_info_array[i].index_info.chunk_idx = chunk_info->index; @@ -3257,14 +3088,10 @@ H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const /* Ensure the chunk list is sorted in ascending order of offset in the file */ if (need_sort) - HDqsort(local_info_array, num_chunks_selected, sizeof(H5D_filtered_collective_io_info_t), - H5D__cmp_filtered_collective_io_info_entry); - -#ifdef H5Dmpio_DEBUG - H5D__mpio_dump_collective_filtered_chunk_list(local_info_array, num_chunks_selected, mpi_rank); -#endif + qsort(local_info_array, num_chunks_selected, sizeof(H5D_filtered_collective_chunk_info_t), + H5D__cmp_filtered_collective_io_info_entry); } - else if (H5F_get_coll_metadata_reads(io_info->dset->oloc.file)) { + else if (H5F_get_coll_metadata_reads(di->dset->oloc.file)) { hsize_t scaled[H5O_LAYOUT_NDIMS] = {0}; /* @@ -3281,14 +3108,23 @@ H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const * callback that can be used to ensure collectivity between ranks * in a more natural way, but this hack should suffice for now. */ - if (H5D__chunk_lookup(io_info->dset, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + if (H5D__chunk_lookup(di->dset, scaled, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address"); } - *chunk_list = local_info_array; - *num_entries = num_chunks_selected; + chunk_list->chunk_infos = local_info_array; + chunk_list->num_chunk_infos = num_chunks_selected; + chunk_list->num_chunks_to_read = num_chunks_to_read; + +#ifdef H5Dmpio_DEBUG + H5D__mpio_dump_collective_filtered_chunk_list(chunk_list, mpi_rank); +#endif done: + if (ret_value < 0) { + H5MM_free(local_info_array); + } + #ifdef H5Dmpio_DEBUG H5D_MPIO_TIME_STOP(mpi_rank); H5D_MPIO_TRACE_EXIT(mpi_rank); @@ -3319,8 +3155,7 @@ H5D__mpio_collective_filtered_chunk_io_setup(const H5D_io_info_t *io_info, const */ static herr_t H5D__mpio_redistribute_shared_chunks(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, const H5D_io_info_t *io_info, - const H5D_chunk_map_t *fm, int mpi_rank, int mpi_size, + const H5D_io_info_t *io_info, int mpi_rank, int mpi_size, size_t **rank_chunks_assigned_map) { hbool_t redistribute_on_all_ranks; @@ -3332,10 +3167,9 @@ H5D__mpio_redistribute_shared_chunks(H5D_filtered_collective_io_info_t *chunk_li FUNC_ENTER_PACKAGE - HDassert(chunk_list || 0 == chunk_list_num_entries); - HDassert(io_info); - HDassert(fm); - HDassert(mpi_size > 1); /* No chunk sharing is possible for MPI Comm size of 1 */ + assert(chunk_list); + assert(io_info); + assert(mpi_size > 1); /* No chunk sharing is possible for MPI Comm size of 1 */ #ifdef H5Dmpio_DEBUG H5D_MPIO_TRACE_ENTER(mpi_rank); @@ -3348,10 +3182,10 @@ H5D__mpio_redistribute_shared_chunks(H5D_filtered_collective_io_info_t *chunk_li * MPI communication. */ if (NULL == (num_chunks_map = H5MM_malloc((size_t)mpi_size * sizeof(*num_chunks_map)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate assigned chunks array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate assigned chunks array"); /* Perform initial Allgather to determine the collective chunk list size */ - if (MPI_SUCCESS != (mpi_code = MPI_Allgather(&chunk_list_num_entries, 1, H5_SIZE_T_AS_MPI_TYPE, + if (MPI_SUCCESS != (mpi_code = MPI_Allgather(&chunk_list->num_chunk_infos, 1, H5_SIZE_T_AS_MPI_TYPE, num_chunks_map, 1, H5_SIZE_T_AS_MPI_TYPE, io_info->comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Allgather failed", mpi_code) @@ -3368,8 +3202,8 @@ H5D__mpio_redistribute_shared_chunks(H5D_filtered_collective_io_info_t *chunk_li redistribute_on_all_ranks = coll_chunk_list_size < H5D_CHUNK_REDISTRIBUTE_THRES; if (H5D__mpio_redistribute_shared_chunks_int(chunk_list, num_chunks_map, redistribute_on_all_ranks, - io_info, fm, mpi_rank, mpi_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREDISTRIBUTE, FAIL, "can't redistribute shared chunks") + io_info, mpi_rank, mpi_size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREDISTRIBUTE, FAIL, "can't redistribute shared chunks"); /* * If the caller provided a pointer for the mapping from @@ -3458,9 +3292,7 @@ H5D__mpio_redistribute_shared_chunks(H5D_filtered_collective_io_info_t *chunk_li static herr_t H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chunk_list, size_t *num_chunks_assigned_map, hbool_t all_ranks_involved, - const H5D_io_info_t *io_info, - const H5D_chunk_map_t H5_ATTR_NDEBUG_UNUSED *fm, int mpi_rank, - int mpi_size) + const H5D_io_info_t *io_info, int mpi_rank, int mpi_size) { MPI_Datatype struct_type; MPI_Datatype packed_type; @@ -3478,11 +3310,10 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun FUNC_ENTER_PACKAGE - HDassert(num_chunks_assigned_map); - HDassert(chunk_list || 0 == num_chunks_assigned_map[mpi_rank]); - HDassert(io_info); - HDassert(fm); - HDassert(mpi_size > 1); + assert(chunk_list); + assert(num_chunks_assigned_map); + assert(io_info); + assert(mpi_size > 1); #ifdef H5Dmpio_DEBUG H5D_MPIO_TRACE_ENTER(mpi_rank); @@ -3512,7 +3343,7 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun if (NULL == (counts_disps_array = H5MM_malloc(2 * (size_t)mpi_size * sizeof(*counts_disps_array)))) { /* Push an error, but still participate in collective gather operation */ HDONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "couldn't allocate receive counts and displacements array") + "couldn't allocate receive counts and displacements array"); } else { /* Set the receive counts from the assigned chunks map */ @@ -3537,14 +3368,14 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun if (H5D__mpio_get_chunk_redistribute_info_types(&packed_type, &packed_type_derived, &struct_type, &struct_type_derived) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "can't create derived datatypes for chunk redistribution info") + "can't create derived datatypes for chunk redistribution info"); /* Perform gather operation */ - if (H5_mpio_gatherv_alloc(chunk_list, num_chunks_int, struct_type, counts_ptr, displacements_ptr, - packed_type, all_ranks_involved, 0, io_info->comm, mpi_rank, mpi_size, - &coll_chunk_list, &coll_chunk_list_num_entries) < 0) + if (H5_mpio_gatherv_alloc(chunk_list->chunk_infos, num_chunks_int, struct_type, counts_ptr, + displacements_ptr, packed_type, all_ranks_involved, 0, io_info->comm, mpi_rank, + mpi_size, &coll_chunk_list, &coll_chunk_list_num_entries) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, - "can't gather chunk redistribution info to involved ranks") + "can't gather chunk redistribution info to involved ranks"); /* * If all ranks are redistributing shared chunks, we no @@ -3567,11 +3398,11 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun int new_chunk_owner; /* Clear the mapping from rank value -> number of assigned chunks */ - HDmemset(num_chunks_assigned_map, 0, (size_t)mpi_size * sizeof(*num_chunks_assigned_map)); + memset(num_chunks_assigned_map, 0, (size_t)mpi_size * sizeof(*num_chunks_assigned_map)); /* Sort collective chunk list according to chunk index */ - HDqsort(coll_chunk_list, coll_chunk_list_num_entries, sizeof(H5D_chunk_redistribute_info_t), - H5D__cmp_chunk_redistribute_info); + qsort(coll_chunk_list, coll_chunk_list_num_entries, sizeof(H5D_chunk_redistribute_info_t), + H5D__cmp_chunk_redistribute_info); /* * Process all chunks in the collective chunk list. @@ -3620,7 +3451,7 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun } while (++i < coll_chunk_list_num_entries && chunk_entry->chunk_idx == curr_chunk_idx); /* We should never have more writers to a chunk than the number of MPI ranks */ - HDassert(num_writers <= mpi_size); + assert(num_writers <= mpi_size); /* Set all processed chunk entries' "new_owner" and "num_writers" fields */ for (; set_begin_index < i; set_begin_index++) { @@ -3652,8 +3483,8 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun * algorithm may be devised that doesn't rely on frail sorting, * but the current implementation is a quick and naive approach. */ - HDqsort(coll_chunk_list, coll_chunk_list_num_entries, sizeof(H5D_chunk_redistribute_info_t), - H5D__cmp_chunk_redistribute_info_orig_owner); + qsort(coll_chunk_list, coll_chunk_list_num_entries, sizeof(H5D_chunk_redistribute_info_t), + H5D__cmp_chunk_redistribute_info_orig_owner); } if (all_ranks_involved) { @@ -3671,8 +3502,19 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun coll_entry = &((H5D_chunk_redistribute_info_t *)coll_chunk_list)[i++]; - chunk_list[j].new_owner = coll_entry->new_owner; - chunk_list[j].num_writers = coll_entry->num_writers; + chunk_list->chunk_infos[j].new_owner = coll_entry->new_owner; + chunk_list->chunk_infos[j].num_writers = coll_entry->num_writers; + + /* + * Check if the chunk list struct's `num_chunks_to_read` field + * needs to be updated + */ + if (chunk_list->chunk_infos[j].need_read && (chunk_list->chunk_infos[j].new_owner != mpi_rank)) { + chunk_list->chunk_infos[j].need_read = FALSE; + + assert(chunk_list->num_chunks_to_read > 0); + chunk_list->num_chunks_to_read--; + } } } else { @@ -3682,13 +3524,27 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun * local chunk lists get updated */ if (MPI_SUCCESS != - (mpi_code = MPI_Scatterv(coll_chunk_list, counts_ptr, displacements_ptr, packed_type, chunk_list, - num_chunks_int, struct_type, 0, io_info->comm))) + (mpi_code = MPI_Scatterv(coll_chunk_list, counts_ptr, displacements_ptr, packed_type, + chunk_list->chunk_infos, num_chunks_int, struct_type, 0, io_info->comm))) HMPI_GOTO_ERROR(FAIL, "unable to scatter shared chunks info buffer", mpi_code) + + /* + * Now that chunks have been redistributed, each rank must update + * their chunk list struct's `num_chunks_to_read` field since it + * may now be out of date. + */ + for (i = 0; i < chunk_list->num_chunk_infos; i++) { + if ((chunk_list->chunk_infos[i].new_owner != mpi_rank) && chunk_list->chunk_infos[i].need_read) { + chunk_list->chunk_infos[i].need_read = FALSE; + + assert(chunk_list->num_chunks_to_read > 0); + chunk_list->num_chunks_to_read--; + } + } } #ifdef H5Dmpio_DEBUG - H5D__mpio_dump_collective_filtered_chunk_list(chunk_list, num_chunks_assigned_map[mpi_rank], mpi_rank); + H5D__mpio_dump_collective_filtered_chunk_list(chunk_list, mpi_rank); #endif done: @@ -3787,41 +3643,38 @@ H5D__mpio_redistribute_shared_chunks_int(H5D_filtered_collective_io_info_t *chun *------------------------------------------------------------------------- */ static herr_t -H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk_list, - size_t *chunk_list_num_entries, H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, int mpi_rank, - int H5_ATTR_NDEBUG_UNUSED mpi_size, - H5D_filtered_collective_io_info_t **chunk_hash_table, - unsigned char ***chunk_msg_bufs, int *chunk_msg_bufs_len) +H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk_list, H5D_io_info_t *io_info, + H5D_dset_io_info_t *dset_info, int mpi_rank, + int H5_ATTR_NDEBUG_UNUSED mpi_size, unsigned char ***chunk_msg_bufs, + int *chunk_msg_bufs_len) { #if H5_CHECK_MPI_VERSION(3, 0) - H5D_filtered_collective_io_info_t *chunk_table = NULL; - H5S_sel_iter_t *mem_iter = NULL; - unsigned char **msg_send_bufs = NULL; - unsigned char **msg_recv_bufs = NULL; - MPI_Request *send_requests = NULL; - MPI_Request *recv_requests = NULL; - MPI_Request ibarrier = MPI_REQUEST_NULL; - hbool_t mem_iter_init = FALSE; - hbool_t ibarrier_posted = FALSE; - size_t send_bufs_nalloc = 0; - size_t num_send_requests = 0; - size_t num_recv_requests = 0; - size_t num_msgs_incoming = 0; - size_t last_assigned_idx; - size_t i; - int mpi_code; - herr_t ret_value = SUCCEED; + H5D_filtered_collective_chunk_info_t *chunk_table = NULL; + H5S_sel_iter_t *mem_iter = NULL; + unsigned char **msg_send_bufs = NULL; + unsigned char **msg_recv_bufs = NULL; + MPI_Request *send_requests = NULL; + MPI_Request *recv_requests = NULL; + MPI_Request ibarrier = MPI_REQUEST_NULL; + hbool_t mem_iter_init = FALSE; + hbool_t ibarrier_posted = FALSE; + size_t send_bufs_nalloc = 0; + size_t num_send_requests = 0; + size_t num_recv_requests = 0; + size_t num_msgs_incoming = 0; + size_t last_assigned_idx; + size_t i; + int mpi_code; + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - HDassert(chunk_list_num_entries); - HDassert(chunk_list || 0 == *chunk_list_num_entries); - HDassert(io_info); - HDassert(type_info); - HDassert(mpi_size > 1); - HDassert(chunk_msg_bufs); - HDassert(chunk_msg_bufs_len); + assert(chunk_list); + assert(io_info); + assert(dset_info); + assert(mpi_size > 1); + assert(chunk_msg_bufs); + assert(chunk_msg_bufs_len); #ifdef H5Dmpio_DEBUG H5D_MPIO_TRACE_ENTER(mpi_rank); @@ -3831,10 +3684,10 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk /* Set to latest format for encoding dataspace */ H5CX_set_libver_bounds(NULL); - if (*chunk_list_num_entries) { + if (chunk_list->num_chunk_infos > 0) { /* Allocate a selection iterator for iterating over chunk dataspaces */ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate dataspace selection iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate dataspace selection iterator"); /* * Allocate send buffer and MPI_Request arrays for non-blocking @@ -3843,10 +3696,10 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk send_bufs_nalloc = H5D_CHUNK_NUM_SEND_MSGS_INIT; if (NULL == (msg_send_bufs = H5MM_malloc(send_bufs_nalloc * sizeof(*msg_send_bufs)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "couldn't allocate chunk modification message buffer array") + "couldn't allocate chunk modification message buffer array"); if (NULL == (send_requests = H5MM_malloc(send_bufs_nalloc * sizeof(*send_requests)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate send requests array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate send requests array"); } /* @@ -3863,8 +3716,8 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk * synchronous sends to send the data this rank is writing to * the rank that does own the chunk. */ - for (i = 0, last_assigned_idx = 0; i < *chunk_list_num_entries; i++) { - H5D_filtered_collective_io_info_t *chunk_entry = &chunk_list[i]; + for (i = 0, last_assigned_idx = 0; i < chunk_list->num_chunk_infos; i++) { + H5D_filtered_collective_chunk_info_t *chunk_entry = &chunk_list->chunk_infos[i]; if (mpi_rank == chunk_entry->new_owner) { num_msgs_incoming += (size_t)(chunk_entry->num_writers - 1); @@ -3874,7 +3727,7 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk * does own, since it has sent the necessary data and is no longer * interested in the chunks it doesn't own. */ - chunk_list[last_assigned_idx] = chunk_list[i]; + chunk_list->chunk_infos[last_assigned_idx] = chunk_list->chunk_infos[i]; /* * Since, at large scale, a chunk's index value may be larger than @@ -3886,12 +3739,13 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk * message itself will contain the chunk's index so we can update * the correct chunk with the received data. */ - HASH_ADD(hh, chunk_table, index_info.chunk_idx, sizeof(hsize_t), &chunk_list[last_assigned_idx]); + HASH_ADD(hh, chunk_table, index_info.chunk_idx, sizeof(hsize_t), + &chunk_list->chunk_infos[last_assigned_idx]); last_assigned_idx++; } else { - H5D_chunk_info_t *chunk_info = chunk_entry->chunk_info; + H5D_piece_info_t *chunk_info = chunk_entry->chunk_info; unsigned char *mod_data_p = NULL; hsize_t iter_nelmts; size_t mod_data_size = 0; @@ -3902,39 +3756,39 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk /* Determine size of serialized chunk file dataspace */ if (H5S_encode(chunk_info->fspace, &mod_data_p, &space_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get encoded dataspace size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get encoded dataspace size"); mod_data_size += space_size; /* Determine size of data being written */ iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace); H5_CHECK_OVERFLOW(iter_nelmts, hsize_t, size_t); - mod_data_size += (size_t)iter_nelmts * type_info->src_type_size; + mod_data_size += (size_t)iter_nelmts * dset_info->type_info.src_type_size; if (NULL == (msg_send_bufs[num_send_requests] = H5MM_malloc(mod_data_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "couldn't allocate chunk modification message buffer") + "couldn't allocate chunk modification message buffer"); mod_data_p = msg_send_bufs[num_send_requests]; /* Store the chunk's index into the buffer */ - HDmemcpy(mod_data_p, &chunk_entry->index_info.chunk_idx, sizeof(hsize_t)); + memcpy(mod_data_p, &chunk_entry->index_info.chunk_idx, sizeof(hsize_t)); mod_data_p += sizeof(hsize_t); /* Serialize the chunk's file dataspace into the buffer */ if (H5S_encode(chunk_info->fspace, &mod_data_p, &mod_data_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to encode dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "unable to encode dataspace"); /* Initialize iterator for memory selection */ - if (H5S_select_iter_init(mem_iter, chunk_info->mspace, type_info->src_type_size, + if (H5S_select_iter_init(mem_iter, chunk_info->mspace, dset_info->type_info.src_type_size, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize memory selection information") + "unable to initialize memory selection information"); mem_iter_init = TRUE; /* Collect the modification data into the buffer */ - if (0 == H5D__gather_mem(io_info->u.wbuf, mem_iter, (size_t)iter_nelmts, mod_data_p)) - HGOTO_ERROR(H5E_IO, H5E_CANTGATHER, FAIL, "couldn't gather from write buffer") + if (0 == H5D__gather_mem(dset_info->buf.cvp, mem_iter, (size_t)iter_nelmts, mod_data_p)) + HGOTO_ERROR(H5E_IO, H5E_CANTGATHER, FAIL, "couldn't gather from write buffer"); /* * Ensure that the size of the chunk data being sent can be @@ -3945,7 +3799,7 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk * future, this may become a problem and derived datatypes * will need to be used. */ - H5_CHECK_OVERFLOW(mod_data_size, size_t, int) + H5_CHECK_OVERFLOW(mod_data_size, size_t, int); /* Send modification data to new owner */ if (MPI_SUCCESS != @@ -3965,17 +3819,17 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk if (NULL == (tmp_alloc = H5MM_realloc(msg_send_bufs, send_bufs_nalloc * sizeof(*msg_send_bufs)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "couldn't resize chunk modification message buffer array") + "couldn't resize chunk modification message buffer array"); msg_send_bufs = tmp_alloc; if (NULL == (tmp_alloc = H5MM_realloc(send_requests, send_bufs_nalloc * sizeof(*send_requests)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't resize send requests array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't resize send requests array"); send_requests = tmp_alloc; } if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release memory selection iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release memory selection iterator"); mem_iter_init = FALSE; } } @@ -3983,10 +3837,10 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk /* Check if the number of send or receive requests will overflow an int (MPI requirement) */ if (num_send_requests > INT_MAX || num_msgs_incoming > INT_MAX) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, - "too many shared chunks in parallel filtered write operation") + "too many shared chunks in parallel filtered write operation"); - H5_CHECK_OVERFLOW(num_send_requests, size_t, int) - H5_CHECK_OVERFLOW(num_msgs_incoming, size_t, int) + H5_CHECK_OVERFLOW(num_send_requests, size_t, int); + H5_CHECK_OVERFLOW(num_msgs_incoming, size_t, int); /* * Allocate receive buffer and MPI_Request arrays for non-blocking @@ -3995,10 +3849,10 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk if (num_msgs_incoming) { if (NULL == (msg_recv_bufs = H5MM_malloc(num_msgs_incoming * sizeof(*msg_recv_bufs)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "couldn't allocate chunk modification message buffer array") + "couldn't allocate chunk modification message buffer array"); if (NULL == (recv_requests = H5MM_malloc(num_msgs_incoming * sizeof(*recv_requests)))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate receive requests array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate receive requests array"); } /* Process any incoming messages until everyone is done */ @@ -4022,7 +3876,7 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&status, MPI_BYTE, &msg_size))) HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements_x failed", mpi_code) - H5_CHECK_OVERFLOW(msg_size, MPI_Count, int) + H5_CHECK_OVERFLOW(msg_size, MPI_Count, int); #else int msg_size = 0; @@ -4031,13 +3885,13 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk #endif if (msg_size <= 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "invalid chunk modification message size") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "invalid chunk modification message size"); - HDassert((num_recv_requests + 1) <= num_msgs_incoming); + assert((num_recv_requests + 1) <= num_msgs_incoming); if (NULL == (msg_recv_bufs[num_recv_requests] = H5MM_malloc((size_t)msg_size * sizeof(unsigned char)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "couldn't allocate chunk modification message receive buffer") + "couldn't allocate chunk modification message receive buffer"); if (MPI_SUCCESS != (mpi_code = MPI_Irecv(msg_recv_bufs[num_recv_requests], (int)msg_size, MPI_BYTE, status.MPI_SOURCE, H5D_CHUNK_MOD_DATA_TAG, @@ -4116,10 +3970,12 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk H5_GCC_DIAG_ON("stringop-overflow") /* Set the new number of locally-selected chunks */ - *chunk_list_num_entries = last_assigned_idx; + chunk_list->num_chunk_infos = last_assigned_idx; + + /* Set chunk hash table pointer for future use */ + chunk_list->chunk_hash_table = chunk_table; /* Return chunk message buffers if any were received */ - *chunk_hash_table = chunk_table; *chunk_msg_bufs = msg_recv_bufs; *chunk_msg_bufs_len = (int)num_recv_requests; @@ -4170,7 +4026,7 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk if (mem_iter) { if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release dataspace selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release dataspace selection iterator"); mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter); } @@ -4189,144 +4045,13 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk #endif } /* end H5D__mpio_share_chunk_modification_data() */ -/*------------------------------------------------------------------------- - * Function: H5D__mpio_collective_filtered_chunk_common_io - * - * Purpose: This routine performs the common part of collective I/O - * when reading or writing filtered chunks collectively. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -static herr_t -H5D__mpio_collective_filtered_chunk_common_io(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, const H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, int mpi_size) -{ - H5D_io_info_t coll_io_info; - H5D_storage_t ctg_store; - MPI_Datatype file_type = MPI_DATATYPE_NULL; - MPI_Datatype mem_type = MPI_DATATYPE_NULL; - hbool_t mem_type_is_derived = FALSE; - hbool_t file_type_is_derived = FALSE; - hsize_t mpi_buf_count; - haddr_t base_read_offset = HADDR_UNDEF; - size_t num_chunks; - size_t i; - char fake_buf; /* Used as a fake buffer for ranks with no chunks, thus a NULL buf pointer */ - int mpi_code; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - HDassert(chunk_list || 0 == chunk_list_num_entries); - HDassert(io_info); - HDassert(type_info); - - /* Initialize temporary I/O info */ - coll_io_info = *io_info; - - /* - * Construct MPI derived datatype for collective I/O on chunks - */ - if (H5D__mpio_collective_filtered_io_type(chunk_list, chunk_list_num_entries, io_info->op_type, &mem_type, - &mem_type_is_derived, &file_type, &file_type_is_derived) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "couldn't create MPI I/O type for chunk I/O") - - /* - * For reads, determine how many chunks are actually being read. - * Note that if this is a read during a write operation - * (read chunk -> unfilter -> modify -> write back), some - * chunks may not need to be read if they're being fully - * overwritten during a write operation. - */ - if (io_info->op_type == H5D_IO_OP_READ) { - for (i = 0, num_chunks = 0; i < chunk_list_num_entries; i++) { - HDassert(chunk_list[i].buf); - - if (chunk_list[i].need_read) { - if (!H5F_addr_defined(base_read_offset)) - base_read_offset = chunk_list[i].chunk_current.offset; - - num_chunks++; - } - } - } - else - num_chunks = chunk_list_num_entries; - - /* - * If this rank doesn't have a selection, it can - * skip I/O if independent I/O was requested at - * the low level, or if the MPI communicator size - * is 1. - * - * Otherwise, this rank has to participate in - * collective I/O, but probably has a NULL buf - * pointer, so override to a fake buffer since our - * write/read function expects one. - */ - if (num_chunks == 0) { - H5FD_mpio_collective_opt_t coll_opt_mode; - - /* Get the collective_opt property to check whether the application wants to do IO individually. */ - if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_opt property") - - if ((mpi_size == 1) || (H5FD_MPIO_INDIVIDUAL_IO == coll_opt_mode)) { - HGOTO_DONE(SUCCEED) - } - else { - if (io_info->op_type == H5D_IO_OP_WRITE) - coll_io_info.u.wbuf = &fake_buf; - else - coll_io_info.u.rbuf = &fake_buf; - } - } - - /* - * Setup for I/O operation - */ - - mpi_buf_count = (num_chunks) ? 1 : 0; - - if (num_chunks) { - /* - * Setup the base storage address for this operation - * to be the first chunk's file address - */ - if (io_info->op_type == H5D_IO_OP_WRITE) - ctg_store.contig.dset_addr = chunk_list[0].chunk_new.offset; - else - ctg_store.contig.dset_addr = base_read_offset; - } - else - ctg_store.contig.dset_addr = 0; - - ctg_store.contig.dset_size = (hsize_t)io_info->dset->shared->layout.u.chunk.size; - coll_io_info.store = &ctg_store; - - /* Perform I/O */ - if (H5D__final_collective_io(&coll_io_info, type_info, mpi_buf_count, file_type, mem_type) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't finish MPI I/O") - -done: - /* Free the MPI buf and file types, if they were derived */ - if (mem_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&mem_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - if (file_type_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&file_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__mpio_collective_filtered_chunk_common_io() */ - /*------------------------------------------------------------------------- * Function: H5D__mpio_collective_filtered_chunk_read * * Purpose: This routine coordinates a collective read across all ranks * of the chunks they have selected. Each rank will then go - * and + * and unfilter their read chunks as necessary and scatter + * the data into the provided read buffer. * * Return: Non-negative on success/Negative on failure * @@ -4334,29 +4059,26 @@ H5D__mpio_collective_filtered_chunk_common_io(H5D_filtered_collective_io_info_t */ static herr_t H5D__mpio_collective_filtered_chunk_read(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, const H5D_io_info_t *io_info, - const H5D_type_info_t *type_info, int mpi_rank, int mpi_size) + const H5D_io_info_t *io_info, const H5D_dset_io_info_t *di, + int mpi_rank) { H5D_fill_buf_info_t fb_info; - H5D_chunk_info_t *chunk_info = NULL; - H5D_io_info_t coll_io_info; H5Z_EDC_t err_detect; /* Error detection info */ H5Z_cb_t filter_cb; /* I/O filter callback function */ hsize_t file_chunk_size = 0; hsize_t iter_nelmts; /* Number of points to iterate over for the chunk IO operation */ - hbool_t should_fill = FALSE; - hbool_t fb_info_init = FALSE; - hbool_t index_empty = FALSE; - size_t i; + hbool_t should_fill = FALSE; + hbool_t fb_info_init = FALSE; + hbool_t index_empty = FALSE; H5S_t *fill_space = NULL; void *base_read_buf = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - HDassert(chunk_list || 0 == chunk_list_num_entries); - HDassert(io_info); - HDassert(type_info); + assert(chunk_list); + assert(io_info); + assert(di); #ifdef H5Dmpio_DEBUG H5D_MPIO_TRACE_ENTER(mpi_rank); @@ -4365,24 +4087,20 @@ H5D__mpio_collective_filtered_chunk_read(H5D_filtered_collective_io_info_t *chun (void)mpi_rank; #endif - /* Initialize temporary I/O info */ - coll_io_info = *io_info; - coll_io_info.u.rbuf = NULL; - - if (chunk_list_num_entries) { + if (chunk_list->num_chunk_infos) { /* Retrieve filter settings from API context */ if (H5CX_get_err_detect(&err_detect) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info"); if (H5CX_get_filter_cb(&filter_cb) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function"); /* Set size of full chunks in dataset */ - file_chunk_size = io_info->dset->shared->layout.u.chunk.size; + file_chunk_size = di->dset->shared->layout.u.chunk.size; /* Determine if fill values should be "read" for unallocated chunks */ - should_fill = (io_info->dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC) || - ((io_info->dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET) && - io_info->dset->shared->dcpl_cache.fill.fill_defined); + should_fill = (di->dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC) || + ((di->dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET) && + di->dset->shared->dcpl_cache.fill.fill_defined); } /* @@ -4398,14 +4116,16 @@ H5D__mpio_collective_filtered_chunk_read(H5D_filtered_collective_io_info_t *chun * size; reading into a (smaller) buffer of size equal to the unfiltered * chunk size would of course be bad. */ - for (i = 0; i < chunk_list_num_entries; i++) { - HDassert(chunk_list[i].need_read); + for (size_t i = 0; i < chunk_list->num_chunk_infos; i++) { + H5D_filtered_collective_chunk_info_t *chunk_entry = &chunk_list->chunk_infos[i]; - chunk_list[i].chunk_buf_size = MAX(chunk_list[i].chunk_current.length, file_chunk_size); + assert(chunk_entry->need_read); - if (NULL == (chunk_list[i].buf = H5MM_malloc(chunk_list[i].chunk_buf_size))) { + chunk_entry->chunk_buf_size = MAX(chunk_entry->chunk_current.length, file_chunk_size); + + if (NULL == (chunk_entry->buf = H5MM_malloc(chunk_entry->chunk_buf_size))) { /* Push an error, but participate in collective read */ - HDONE_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk data buffer") + HDONE_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk data buffer"); break; } @@ -4414,54 +4134,58 @@ H5D__mpio_collective_filtered_chunk_read(H5D_filtered_collective_io_info_t *chun * read it from the file. Instead, just fill the chunk buffer * with the fill value if necessary. */ - if (H5F_addr_defined(chunk_list[i].chunk_current.offset)) { + if (H5_addr_defined(chunk_entry->chunk_current.offset)) { /* Set first read buffer */ if (!base_read_buf) - base_read_buf = chunk_list[i].buf; + base_read_buf = chunk_entry->buf; /* Set chunk's new length for eventual filter pipeline calls */ - if (chunk_list[i].skip_filter_pline) - chunk_list[i].chunk_new.length = file_chunk_size; + if (chunk_entry->skip_filter_pline) + chunk_entry->chunk_new.length = file_chunk_size; else - chunk_list[i].chunk_new.length = chunk_list[i].chunk_current.length; + chunk_entry->chunk_new.length = chunk_entry->chunk_current.length; } else { - chunk_list[i].need_read = FALSE; + chunk_entry->need_read = FALSE; + + /* Update field keeping track of number of chunks to read */ + assert(chunk_list->num_chunks_to_read > 0); + chunk_list->num_chunks_to_read--; /* Set chunk's new length for eventual filter pipeline calls */ - chunk_list[i].chunk_new.length = file_chunk_size; + chunk_entry->chunk_new.length = file_chunk_size; if (should_fill) { /* Initialize fill value buffer if not already initialized */ if (!fb_info_init) { hsize_t chunk_dims[H5S_MAX_RANK]; - HDassert(io_info->dset->shared->ndims == io_info->dset->shared->layout.u.chunk.ndims - 1); - for (size_t j = 0; j < io_info->dset->shared->layout.u.chunk.ndims - 1; j++) - chunk_dims[j] = (hsize_t)io_info->dset->shared->layout.u.chunk.dim[j]; + assert(di->dset->shared->ndims == di->dset->shared->layout.u.chunk.ndims - 1); + for (size_t j = 0; j < di->dset->shared->layout.u.chunk.ndims - 1; j++) + chunk_dims[j] = (hsize_t)di->dset->shared->layout.u.chunk.dim[j]; /* Get a dataspace for filling chunk memory buffers */ - if (NULL == (fill_space = H5S_create_simple( - io_info->dset->shared->layout.u.chunk.ndims - 1, chunk_dims, NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create chunk fill dataspace") + if (NULL == (fill_space = H5S_create_simple(di->dset->shared->layout.u.chunk.ndims - 1, + chunk_dims, NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create chunk fill dataspace"); /* Initialize fill value buffer */ - if (H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, - (void *)&io_info->dset->shared->dcpl_cache.pline, - (H5MM_free_t)H5D__chunk_mem_free, - (void *)&io_info->dset->shared->dcpl_cache.pline, - &io_info->dset->shared->dcpl_cache.fill, io_info->dset->shared->type, - io_info->dset->shared->type_id, 0, file_chunk_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill value buffer") + if (H5D__fill_init( + &fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, + (void *)&di->dset->shared->dcpl_cache.pline, (H5MM_free_t)H5D__chunk_mem_free, + (void *)&di->dset->shared->dcpl_cache.pline, &di->dset->shared->dcpl_cache.fill, + di->dset->shared->type, di->dset->shared->type_id, 0, file_chunk_size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill value buffer"); fb_info_init = TRUE; } /* Write fill value to memory buffer */ - HDassert(fb_info.fill_buf); - if (H5D__fill(fb_info.fill_buf, io_info->dset->shared->type, chunk_list[i].buf, - type_info->mem_type, fill_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't fill chunk buffer with fill value") + assert(fb_info.fill_buf); + if (H5D__fill(fb_info.fill_buf, di->dset->shared->type, chunk_entry->buf, + di->type_info.mem_type, fill_space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "couldn't fill chunk buffer with fill value"); } } } @@ -4472,62 +4196,55 @@ H5D__mpio_collective_filtered_chunk_read(H5D_filtered_collective_io_info_t *chun * read of chunks is essentially a no-op, so avoid it here. */ index_empty = FALSE; - if (io_info->dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_INCR) - if (H5D__chunk_index_empty(io_info->dset, &index_empty) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't determine if chunk index is empty") + if (di->dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_INCR) + if (H5D__chunk_index_empty(di->dset, &index_empty) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't determine if chunk index is empty"); if (!index_empty) { - /* - * Override the read buffer to point to the address of - * the first chunk data buffer being read into - */ - if (base_read_buf) - coll_io_info.u.rbuf = base_read_buf; - - /* Perform collective chunk read */ - if (H5D__mpio_collective_filtered_chunk_common_io(chunk_list, chunk_list_num_entries, &coll_io_info, - type_info, mpi_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't finish collective filtered chunk read") + /* Perform collective vector read */ + if (H5D__mpio_collective_filtered_vec_io(chunk_list, io_info->f_sh, H5D_IO_OP_READ) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't perform vector I/O on filtered chunks"); } /* * Iterate through all the read chunks, unfiltering them and scattering their * data out to the application's read buffer. */ - for (i = 0; i < chunk_list_num_entries; i++) { - chunk_info = chunk_list[i].chunk_info; + for (size_t i = 0; i < chunk_list->num_chunk_infos; i++) { + H5D_filtered_collective_chunk_info_t *chunk_entry = &chunk_list->chunk_infos[i]; + H5D_piece_info_t *chunk_info = chunk_entry->chunk_info; /* Unfilter the chunk, unless we didn't read it from the file */ - if (chunk_list[i].need_read && !chunk_list[i].skip_filter_pline) { - if (H5Z_pipeline(&io_info->dset->shared->dcpl_cache.pline, H5Z_FLAG_REVERSE, - &(chunk_list[i].index_info.filter_mask), err_detect, filter_cb, - (size_t *)&chunk_list[i].chunk_new.length, &chunk_list[i].chunk_buf_size, - &chunk_list[i].buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, FAIL, "couldn't unfilter chunk for modifying") + if (chunk_entry->need_read && !chunk_entry->skip_filter_pline) { + if (H5Z_pipeline(&di->dset->shared->dcpl_cache.pline, H5Z_FLAG_REVERSE, + &(chunk_entry->index_info.filter_mask), err_detect, filter_cb, + (size_t *)&chunk_entry->chunk_new.length, &chunk_entry->chunk_buf_size, + &chunk_entry->buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, FAIL, "couldn't unfilter chunk for modifying"); } /* Scatter the chunk data to the read buffer */ iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->fspace); - if (H5D_select_io_mem(io_info->u.rbuf, chunk_info->mspace, chunk_list[i].buf, chunk_info->fspace, - type_info->src_type_size, (size_t)iter_nelmts) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't copy chunk data to read buffer") + if (H5D_select_io_mem(di->buf.vp, chunk_info->mspace, chunk_entry->buf, chunk_info->fspace, + di->type_info.src_type_size, (size_t)iter_nelmts) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't copy chunk data to read buffer"); } done: /* Free all resources used by entries in the chunk list */ - for (i = 0; i < chunk_list_num_entries; i++) { - if (chunk_list[i].buf) { - H5MM_free(chunk_list[i].buf); - chunk_list[i].buf = NULL; + for (size_t i = 0; i < chunk_list->num_chunk_infos; i++) { + if (chunk_list->chunk_infos[i].buf) { + H5MM_free(chunk_list->chunk_infos[i].buf); + chunk_list->chunk_infos[i].buf = NULL; } } /* Release the fill buffer info, if it's been initialized */ if (fb_info_init && H5D__fill_term(&fb_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info"); if (fill_space && (H5S_close(fill_space) < 0)) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close fill space") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close fill space"); #ifdef H5Dmpio_DEBUG H5D_MPIO_TIME_STOP(mpi_rank); @@ -4551,56 +4268,57 @@ H5D__mpio_collective_filtered_chunk_read(H5D_filtered_collective_io_info_t *chun */ static herr_t H5D__mpio_collective_filtered_chunk_update(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, - H5D_filtered_collective_io_info_t *chunk_hash_table, unsigned char **chunk_msg_bufs, int chunk_msg_bufs_len, - const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - int H5_ATTR_NDEBUG_UNUSED mpi_rank, int mpi_size) + const H5D_io_info_t *io_info, const H5D_dset_io_info_t *di, + int H5_ATTR_NDEBUG_UNUSED mpi_rank) { - H5D_fill_buf_info_t fb_info; - H5D_chunk_info_t *chunk_info = NULL; - H5S_sel_iter_t *sel_iter = NULL; /* Dataspace selection iterator for H5D__scatter_mem */ - H5D_io_info_t coll_io_info; - H5Z_EDC_t err_detect; /* Error detection info */ - H5Z_cb_t filter_cb; /* I/O filter callback function */ - hsize_t file_chunk_size = 0; - hsize_t iter_nelmts; /* Number of points to iterate over for the chunk IO operation */ - hbool_t should_fill = FALSE; - hbool_t fb_info_init = FALSE; - hbool_t sel_iter_init = FALSE; - hbool_t index_empty = FALSE; - size_t i; - H5S_t *dataspace = NULL; - H5S_t *fill_space = NULL; - void *base_read_buf = NULL; - herr_t ret_value = SUCCEED; + const H5D_type_info_t *type_info = NULL; + H5D_fill_buf_info_t fb_info; + H5S_sel_iter_t *sel_iter = NULL; /* Dataspace selection iterator for H5D__scatter_mem */ + H5Z_EDC_t err_detect; /* Error detection info */ + H5Z_cb_t filter_cb; /* I/O filter callback function */ + hsize_t file_chunk_size = 0; + hsize_t iter_nelmts; /* Number of points to iterate over for the chunk IO operation */ + hbool_t should_fill = FALSE; + hbool_t fb_info_init = FALSE; + hbool_t sel_iter_init = FALSE; + hbool_t index_empty = FALSE; + size_t i; + H5S_t *dataspace = NULL; + H5S_t *fill_space = NULL; + void *base_read_buf = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - HDassert(chunk_list || 0 == chunk_list_num_entries); - HDassert((chunk_msg_bufs && chunk_hash_table) || 0 == chunk_msg_bufs_len); - HDassert(io_info); - HDassert(type_info); + assert(chunk_list); + assert((chunk_msg_bufs && chunk_list->chunk_hash_table) || 0 == chunk_msg_bufs_len); + assert(io_info); + assert(di); #ifdef H5Dmpio_DEBUG H5D_MPIO_TRACE_ENTER(mpi_rank); H5D_MPIO_TIME_START(mpi_rank, "Filtered collective chunk update"); #endif - if (chunk_list_num_entries) { + /* Set convenience pointers */ + type_info = &(di->type_info); + assert(type_info); + + if (chunk_list->num_chunk_infos > 0) { /* Retrieve filter settings from API context */ if (H5CX_get_err_detect(&err_detect) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get error detection info"); if (H5CX_get_filter_cb(&filter_cb) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get I/O filter callback function"); /* Set size of full chunks in dataset */ - file_chunk_size = io_info->dset->shared->layout.u.chunk.size; + file_chunk_size = di->dset->shared->layout.u.chunk.size; /* Determine if fill values should be written to chunks */ - should_fill = (io_info->dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC) || - ((io_info->dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET) && - io_info->dset->shared->dcpl_cache.fill.fill_defined); + should_fill = (di->dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC) || + ((di->dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET) && + di->dset->shared->dcpl_cache.fill.fill_defined); } /* @@ -4622,91 +4340,96 @@ H5D__mpio_collective_filtered_chunk_update(H5D_filtered_collective_io_info_t *ch * size; reading into a (smaller) buffer of size equal to the unfiltered * chunk size would of course be bad. */ - for (i = 0; i < chunk_list_num_entries; i++) { - HDassert(mpi_rank == chunk_list[i].new_owner); + for (i = 0; i < chunk_list->num_chunk_infos; i++) { + H5D_filtered_collective_chunk_info_t *chunk_entry = &chunk_list->chunk_infos[i]; - chunk_list[i].chunk_buf_size = MAX(chunk_list[i].chunk_current.length, file_chunk_size); + assert(mpi_rank == chunk_entry->new_owner); + + chunk_entry->chunk_buf_size = MAX(chunk_entry->chunk_current.length, file_chunk_size); /* * If this chunk hasn't been allocated yet and we aren't writing * out fill values to it, make sure to 0-fill its memory buffer * so we don't use uninitialized memory. */ - if (!H5F_addr_defined(chunk_list[i].chunk_current.offset) && !should_fill) - chunk_list[i].buf = H5MM_calloc(chunk_list[i].chunk_buf_size); + if (!H5_addr_defined(chunk_entry->chunk_current.offset) && !should_fill) + chunk_entry->buf = H5MM_calloc(chunk_entry->chunk_buf_size); else - chunk_list[i].buf = H5MM_malloc(chunk_list[i].chunk_buf_size); + chunk_entry->buf = H5MM_malloc(chunk_entry->chunk_buf_size); - if (NULL == chunk_list[i].buf) { + if (NULL == chunk_entry->buf) { /* Push an error, but participate in collective read */ - HDONE_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk data buffer") + HDONE_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate chunk data buffer"); break; } /* Set chunk's new length for eventual filter pipeline calls */ - if (chunk_list[i].need_read) { + if (chunk_entry->need_read) { /* * Check if chunk is currently allocated. If not, don't try to * read it from the file. Instead, just fill the chunk buffer * with the fill value if fill values are to be written. */ - if (H5F_addr_defined(chunk_list[i].chunk_current.offset)) { + if (H5_addr_defined(chunk_entry->chunk_current.offset)) { /* Set first read buffer */ if (!base_read_buf) - base_read_buf = chunk_list[i].buf; + base_read_buf = chunk_entry->buf; /* Set chunk's new length for eventual filter pipeline calls */ - if (chunk_list[i].skip_filter_pline) - chunk_list[i].chunk_new.length = file_chunk_size; + if (chunk_entry->skip_filter_pline) + chunk_entry->chunk_new.length = file_chunk_size; else - chunk_list[i].chunk_new.length = chunk_list[i].chunk_current.length; + chunk_entry->chunk_new.length = chunk_entry->chunk_current.length; } else { - chunk_list[i].need_read = FALSE; + chunk_entry->need_read = FALSE; + + /* Update field keeping track of number of chunks to read */ + assert(chunk_list->num_chunks_to_read > 0); + chunk_list->num_chunks_to_read--; /* Set chunk's new length for eventual filter pipeline calls */ - chunk_list[i].chunk_new.length = file_chunk_size; + chunk_entry->chunk_new.length = file_chunk_size; if (should_fill) { /* Initialize fill value buffer if not already initialized */ if (!fb_info_init) { hsize_t chunk_dims[H5S_MAX_RANK]; - HDassert(io_info->dset->shared->ndims == - io_info->dset->shared->layout.u.chunk.ndims - 1); - for (size_t j = 0; j < io_info->dset->shared->layout.u.chunk.ndims - 1; j++) - chunk_dims[j] = (hsize_t)io_info->dset->shared->layout.u.chunk.dim[j]; + assert(di->dset->shared->ndims == di->dset->shared->layout.u.chunk.ndims - 1); + for (size_t j = 0; j < di->dset->shared->layout.u.chunk.ndims - 1; j++) + chunk_dims[j] = (hsize_t)di->dset->shared->layout.u.chunk.dim[j]; /* Get a dataspace for filling chunk memory buffers */ if (NULL == (fill_space = H5S_create_simple( - io_info->dset->shared->layout.u.chunk.ndims - 1, chunk_dims, NULL))) + di->dset->shared->layout.u.chunk.ndims - 1, chunk_dims, NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to create chunk fill dataspace") + "unable to create chunk fill dataspace"); /* Initialize fill value buffer */ if (H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, - (void *)&io_info->dset->shared->dcpl_cache.pline, + (void *)&di->dset->shared->dcpl_cache.pline, (H5MM_free_t)H5D__chunk_mem_free, - (void *)&io_info->dset->shared->dcpl_cache.pline, - &io_info->dset->shared->dcpl_cache.fill, - io_info->dset->shared->type, io_info->dset->shared->type_id, 0, - file_chunk_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill value buffer") + (void *)&di->dset->shared->dcpl_cache.pline, + &di->dset->shared->dcpl_cache.fill, di->dset->shared->type, + di->dset->shared->type_id, 0, file_chunk_size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "can't initialize fill value buffer"); fb_info_init = TRUE; } /* Write fill value to memory buffer */ - HDassert(fb_info.fill_buf); - if (H5D__fill(fb_info.fill_buf, io_info->dset->shared->type, chunk_list[i].buf, + assert(fb_info.fill_buf); + if (H5D__fill(fb_info.fill_buf, di->dset->shared->type, chunk_entry->buf, type_info->mem_type, fill_space) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "couldn't fill chunk buffer with fill value") + "couldn't fill chunk buffer with fill value"); } } } else - chunk_list[i].chunk_new.length = file_chunk_size; + chunk_entry->chunk_new.length = file_chunk_size; } /* @@ -4715,29 +4438,14 @@ H5D__mpio_collective_filtered_chunk_update(H5D_filtered_collective_io_info_t *ch * read of chunks is essentially a no-op, so avoid it here. */ index_empty = FALSE; - if (io_info->dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_INCR) - if (H5D__chunk_index_empty(io_info->dset, &index_empty) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't determine if chunk index is empty") + if (di->dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_INCR) + if (H5D__chunk_index_empty(di->dset, &index_empty) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't determine if chunk index is empty"); if (!index_empty) { - /* - * Setup for I/O operation - */ - - /* Initialize temporary I/O info */ - coll_io_info = *io_info; - coll_io_info.op_type = H5D_IO_OP_READ; - - /* Override the read buffer to point to the address of the first - * chunk data buffer being read into - */ - if (base_read_buf) - coll_io_info.u.rbuf = base_read_buf; - - /* Read all chunks that need to be read from the file */ - if (H5D__mpio_collective_filtered_chunk_common_io(chunk_list, chunk_list_num_entries, &coll_io_info, - type_info, mpi_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't finish collective filtered chunk read") + /* Perform collective vector read */ + if (H5D__mpio_collective_filtered_vec_io(chunk_list, io_info->f_sh, H5D_IO_OP_READ) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "couldn't perform vector I/O on filtered chunks"); } /* @@ -4746,49 +4454,52 @@ H5D__mpio_collective_filtered_chunk_update(H5D_filtered_collective_io_info_t *ch */ /* Process all chunks with data from the owning rank first */ - for (i = 0; i < chunk_list_num_entries; i++) { - HDassert(mpi_rank == chunk_list[i].new_owner); + for (i = 0; i < chunk_list->num_chunk_infos; i++) { + H5D_filtered_collective_chunk_info_t *chunk_entry = &chunk_list->chunk_infos[i]; + H5D_piece_info_t *chunk_info = chunk_entry->chunk_info; - chunk_info = chunk_list[i].chunk_info; + assert(mpi_rank == chunk_entry->new_owner); /* * If this chunk wasn't being fully overwritten, we read it from * the file, so we need to unfilter it */ - if (chunk_list[i].need_read && !chunk_list[i].skip_filter_pline) { - if (H5Z_pipeline(&io_info->dset->shared->dcpl_cache.pline, H5Z_FLAG_REVERSE, - &(chunk_list[i].index_info.filter_mask), err_detect, filter_cb, - (size_t *)&chunk_list[i].chunk_new.length, &chunk_list[i].chunk_buf_size, - &chunk_list[i].buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, FAIL, "couldn't unfilter chunk for modifying") + if (chunk_entry->need_read && !chunk_entry->skip_filter_pline) { + if (H5Z_pipeline(&di->dset->shared->dcpl_cache.pline, H5Z_FLAG_REVERSE, + &(chunk_entry->index_info.filter_mask), err_detect, filter_cb, + (size_t *)&chunk_entry->chunk_new.length, &chunk_entry->chunk_buf_size, + &chunk_entry->buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFILTER, FAIL, "couldn't unfilter chunk for modifying"); } iter_nelmts = H5S_GET_SELECT_NPOINTS(chunk_info->mspace); - if (H5D_select_io_mem(chunk_list[i].buf, chunk_info->fspace, io_info->u.wbuf, chunk_info->mspace, + if (H5D_select_io_mem(chunk_entry->buf, chunk_info->fspace, di->buf.cvp, chunk_info->mspace, type_info->dst_type_size, (size_t)iter_nelmts) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't copy chunk data to write buffer") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't copy chunk data to write buffer"); } /* Allocate iterator for memory selection */ if (NULL == (sel_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate memory iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate memory iterator"); /* Now process all received chunk message buffers */ for (i = 0; i < (size_t)chunk_msg_bufs_len; i++) { - H5D_filtered_collective_io_info_t *chunk_entry = NULL; - const unsigned char *msg_ptr = chunk_msg_bufs[i]; - hsize_t chunk_idx; + H5D_filtered_collective_chunk_info_t *chunk_entry = NULL; + const unsigned char *msg_ptr = chunk_msg_bufs[i]; + hsize_t chunk_idx; if (msg_ptr) { /* Retrieve the chunk's index value */ - HDmemcpy(&chunk_idx, msg_ptr, sizeof(hsize_t)); + memcpy(&chunk_idx, msg_ptr, sizeof(hsize_t)); msg_ptr += sizeof(hsize_t); /* Find the chunk entry according to its chunk index */ - HASH_FIND(hh, chunk_hash_table, &chunk_idx, sizeof(hsize_t), chunk_entry); - HDassert(chunk_entry); - HDassert(mpi_rank == chunk_entry->new_owner); + HASH_FIND(hh, chunk_list->chunk_hash_table, &chunk_idx, sizeof(hsize_t), chunk_entry); + if (chunk_entry == NULL) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFIND, FAIL, "unable to find chunk entry"); + if (mpi_rank != chunk_entry->new_owner) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk owner set to incorrect MPI rank"); /* * Only process the chunk if its data buffer is allocated. @@ -4801,27 +4512,27 @@ H5D__mpio_collective_filtered_chunk_update(H5D_filtered_collective_io_info_t *ch else { /* Decode the chunk file dataspace from the message */ if (NULL == (dataspace = H5S_decode(&msg_ptr))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, FAIL, "unable to decode dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDECODE, FAIL, "unable to decode dataspace"); if (H5S_select_iter_init(sel_iter, dataspace, type_info->dst_type_size, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, - "unable to initialize memory selection information") + "unable to initialize memory selection information"); sel_iter_init = TRUE; iter_nelmts = H5S_GET_SELECT_NPOINTS(dataspace); /* Update the chunk data with the received modification data */ if (H5D__scatter_mem(msg_ptr, sel_iter, (size_t)iter_nelmts, chunk_entry->buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't scatter to write buffer") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "couldn't scatter to write buffer"); if (H5S_SELECT_ITER_RELEASE(sel_iter) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator"); sel_iter_init = FALSE; if (dataspace) { if (H5S_close(dataspace) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace"); dataspace = NULL; } @@ -4832,43 +4543,43 @@ H5D__mpio_collective_filtered_chunk_update(H5D_filtered_collective_io_info_t *ch } /* Finally, filter all the chunks */ - for (i = 0; i < chunk_list_num_entries; i++) { - if (!chunk_list[i].skip_filter_pline) { - if (H5Z_pipeline(&io_info->dset->shared->dcpl_cache.pline, 0, - &(chunk_list[i].index_info.filter_mask), err_detect, filter_cb, - (size_t *)&chunk_list[i].chunk_new.length, &chunk_list[i].chunk_buf_size, - &chunk_list[i].buf) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "output pipeline failed") + for (i = 0; i < chunk_list->num_chunk_infos; i++) { + if (!chunk_list->chunk_infos[i].skip_filter_pline) { + if (H5Z_pipeline(&di->dset->shared->dcpl_cache.pline, 0, + &(chunk_list->chunk_infos[i].index_info.filter_mask), err_detect, filter_cb, + (size_t *)&chunk_list->chunk_infos[i].chunk_new.length, + &chunk_list->chunk_infos[i].chunk_buf_size, &chunk_list->chunk_infos[i].buf) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "output pipeline failed"); } #if H5_SIZEOF_SIZE_T > 4 /* Check for the chunk expanding too much to encode in a 32-bit value */ - if (chunk_list[i].chunk_new.length > ((size_t)0xffffffff)) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length") + if (chunk_list->chunk_infos[i].chunk_new.length > ((size_t)0xffffffff)) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk too large for 32-bit length"); #endif } done: if (sel_iter) { if (sel_iter_init && H5S_SELECT_ITER_RELEASE(sel_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "couldn't release selection iterator"); sel_iter = H5FL_FREE(H5S_sel_iter_t, sel_iter); } if (dataspace && (H5S_close(dataspace) < 0)) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace"); if (fill_space && (H5S_close(fill_space) < 0)) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close fill space") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close fill space"); /* Release the fill buffer info, if it's been initialized */ if (fb_info_init && H5D__fill_term(&fb_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info"); /* On failure, try to free all resources used by entries in the chunk list */ if (ret_value < 0) { - for (i = 0; i < chunk_list_num_entries; i++) { - if (chunk_list[i].buf) { - H5MM_free(chunk_list[i].buf); - chunk_list[i].buf = NULL; + for (i = 0; i < chunk_list->num_chunk_infos; i++) { + if (chunk_list->chunk_infos[i].buf) { + H5MM_free(chunk_list->chunk_infos[i].buf); + chunk_list->chunk_infos[i].buf = NULL; } } } @@ -4896,9 +4607,8 @@ H5D__mpio_collective_filtered_chunk_update(H5D_filtered_collective_io_info_t *ch */ static herr_t H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, size_t *num_chunks_assigned_map, - H5D_io_info_t *io_info, H5D_chk_idx_info_t *idx_info, - int mpi_rank, int mpi_size) + size_t *num_chunks_assigned_map, H5D_io_info_t *io_info, + H5D_chk_idx_info_t *idx_info, int mpi_rank, int mpi_size) { H5D_chunk_alloc_info_t *collective_list = NULL; MPI_Datatype send_type; @@ -4918,10 +4628,10 @@ H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t FUNC_ENTER_PACKAGE - HDassert(chunk_list || 0 == chunk_list_num_entries); - HDassert(io_info); - HDassert(idx_info); - HDassert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE); + assert(chunk_list); + assert(io_info); + assert(idx_info); + assert(idx_info->storage->idx_type != H5D_CHUNK_IDX_NONE); #ifdef H5Dmpio_DEBUG H5D_MPIO_TRACE_ENTER(mpi_rank); @@ -4932,13 +4642,13 @@ H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t * Make sure it's safe to cast this rank's number * of chunks to be sent into an int for MPI */ - H5_CHECK_OVERFLOW(chunk_list_num_entries, size_t, int); + H5_CHECK_OVERFLOW(chunk_list->num_chunk_infos, size_t, int); /* Create derived datatypes for the chunk file space info needed */ if (H5D__mpio_get_chunk_alloc_info_types(&recv_type, &recv_type_derived, &send_type, &send_type_derived) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "can't create derived datatypes for chunk file space info") + "can't create derived datatypes for chunk file space info"); /* * Gather the new chunk sizes to all ranks for a collective reallocation @@ -4954,7 +4664,7 @@ H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t if (NULL == (counts_disps_array = H5MM_malloc(2 * (size_t)mpi_size * sizeof(*counts_disps_array)))) { /* Push an error, but still participate in collective gather operation */ HDONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "couldn't allocate receive counts and displacements array") + "couldn't allocate receive counts and displacements array"); } else { /* Set the receive counts from the assigned chunks map */ @@ -4972,10 +4682,11 @@ H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t } /* Perform gather operation */ - if (H5_mpio_gatherv_alloc(chunk_list, (int)chunk_list_num_entries, send_type, counts_ptr, - displacements_ptr, recv_type, TRUE, 0, io_info->comm, mpi_rank, mpi_size, - &gathered_array, &collective_num_entries) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "can't gather chunk file space info to/from ranks") + if (H5_mpio_gatherv_alloc(chunk_list->chunk_infos, (int)chunk_list->num_chunk_infos, send_type, + counts_ptr, displacements_ptr, recv_type, TRUE, 0, io_info->comm, mpi_rank, + mpi_size, &gathered_array, &collective_num_entries) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, + "can't gather chunk file space info to/from ranks"); } else { /* @@ -4985,10 +4696,11 @@ H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t * contributing before performing the actual gather operation. Use * the 'simple' MPI_Allgatherv wrapper for this. */ - if (H5_mpio_gatherv_alloc_simple(chunk_list, (int)chunk_list_num_entries, send_type, recv_type, TRUE, - 0, io_info->comm, mpi_rank, mpi_size, &gathered_array, - &collective_num_entries) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, "can't gather chunk file space info to/from ranks") + if (H5_mpio_gatherv_alloc_simple(chunk_list->chunk_infos, (int)chunk_list->num_chunk_infos, send_type, + recv_type, TRUE, 0, io_info->comm, mpi_rank, mpi_size, + &gathered_array, &collective_num_entries) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, + "can't gather chunk file space info to/from ranks"); } /* Collectively re-allocate the modified chunks (from each rank) in the file */ @@ -5000,25 +4712,25 @@ H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t if (H5D__chunk_file_alloc(idx_info, &coll_entry->chunk_current, &coll_entry->chunk_new, &need_insert, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk"); /* * If we just re-allocated a chunk that is local to this * rank, make sure to update the chunk entry in the local * chunk list */ - update_local_chunk = - (num_local_chunks_processed < chunk_list_num_entries) && - (coll_entry->chunk_idx == chunk_list[num_local_chunks_processed].index_info.chunk_idx); + update_local_chunk = (num_local_chunks_processed < chunk_list->num_chunk_infos) && + (coll_entry->chunk_idx == + chunk_list->chunk_infos[num_local_chunks_processed].index_info.chunk_idx); if (update_local_chunk) { - H5D_filtered_collective_io_info_t *local_chunk; + H5D_filtered_collective_chunk_info_t *local_chunk; - local_chunk = &chunk_list[num_local_chunks_processed]; + local_chunk = &chunk_list->chunk_infos[num_local_chunks_processed]; /* Sanity check that this chunk is actually local */ - HDassert(mpi_rank == local_chunk->orig_owner); - HDassert(mpi_rank == local_chunk->new_owner); + assert(mpi_rank == local_chunk->orig_owner); + assert(mpi_rank == local_chunk->new_owner); local_chunk->chunk_new = coll_entry->chunk_new; local_chunk->index_info.need_insert = need_insert; @@ -5030,9 +4742,10 @@ H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t */ if (num_local_chunks_processed) { haddr_t curr_chunk_offset = local_chunk->chunk_new.offset; - haddr_t prev_chunk_offset = chunk_list[num_local_chunks_processed - 1].chunk_new.offset; + haddr_t prev_chunk_offset = + chunk_list->chunk_infos[num_local_chunks_processed - 1].chunk_new.offset; - HDassert(H5F_addr_defined(prev_chunk_offset) && H5F_addr_defined(curr_chunk_offset)); + assert(H5_addr_defined(prev_chunk_offset) && H5_addr_defined(curr_chunk_offset)); if (curr_chunk_offset < prev_chunk_offset) need_sort = TRUE; } @@ -5041,15 +4754,15 @@ H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t } } - HDassert(chunk_list_num_entries == num_local_chunks_processed); + assert(chunk_list->num_chunk_infos == num_local_chunks_processed); /* * Ensure this rank's local chunk list is sorted in * ascending order of offset in the file */ if (need_sort) - HDqsort(chunk_list, chunk_list_num_entries, sizeof(H5D_filtered_collective_io_info_t), - H5D__cmp_filtered_collective_io_info_entry); + qsort(chunk_list->chunk_infos, chunk_list->num_chunk_infos, + sizeof(H5D_filtered_collective_chunk_info_t), H5D__cmp_filtered_collective_io_info_entry); done: H5MM_free(gathered_array); @@ -5087,8 +4800,8 @@ H5D__mpio_collective_filtered_chunk_reallocate(H5D_filtered_collective_io_info_t */ static herr_t H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, size_t *num_chunks_assigned_map, - H5D_io_info_t *io_info, H5D_chk_idx_info_t *idx_info, + size_t *num_chunks_assigned_map, H5D_io_info_t *io_info, + H5D_dset_io_info_t *di, H5D_chk_idx_info_t *idx_info, int mpi_rank, int mpi_size) { H5D_chunk_ud_t chunk_ud; @@ -5108,9 +4821,10 @@ H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t * FUNC_ENTER_PACKAGE - HDassert(chunk_list || 0 == chunk_list_num_entries); - HDassert(io_info); - HDassert(idx_info); + assert(chunk_list); + assert(io_info); + assert(di); + assert(idx_info); #ifdef H5Dmpio_DEBUG H5D_MPIO_TRACE_ENTER(mpi_rank); @@ -5125,13 +4839,13 @@ H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t * * Make sure it's safe to cast this rank's number * of chunks to be sent into an int for MPI */ - H5_CHECK_OVERFLOW(chunk_list_num_entries, size_t, int); + H5_CHECK_OVERFLOW(chunk_list->num_chunk_infos, size_t, int); /* Create derived datatypes for the chunk re-insertion info needed */ if (H5D__mpio_get_chunk_insert_info_types(&recv_type, &recv_type_derived, &send_type, &send_type_derived) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "can't create derived datatypes for chunk re-insertion info") + "can't create derived datatypes for chunk re-insertion info"); /* * Gather information to all ranks for a collective re-insertion @@ -5147,7 +4861,7 @@ H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t * if (NULL == (counts_disps_array = H5MM_malloc(2 * (size_t)mpi_size * sizeof(*counts_disps_array)))) { /* Push an error, but still participate in collective gather operation */ HDONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "couldn't allocate receive counts and displacements array") + "couldn't allocate receive counts and displacements array"); } else { /* Set the receive counts from the assigned chunks map */ @@ -5165,11 +4879,11 @@ H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t * } /* Perform gather operation */ - if (H5_mpio_gatherv_alloc(chunk_list, (int)chunk_list_num_entries, send_type, counts_ptr, - displacements_ptr, recv_type, TRUE, 0, io_info->comm, mpi_rank, mpi_size, - &gathered_array, &collective_num_entries) < 0) + if (H5_mpio_gatherv_alloc(chunk_list->chunk_infos, (int)chunk_list->num_chunk_infos, send_type, + counts_ptr, displacements_ptr, recv_type, TRUE, 0, io_info->comm, mpi_rank, + mpi_size, &gathered_array, &collective_num_entries) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, - "can't gather chunk index re-insertion info to/from ranks") + "can't gather chunk index re-insertion info to/from ranks"); } else { /* @@ -5179,11 +4893,11 @@ H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t * * contributing before performing the actual gather operation. Use * the 'simple' MPI_Allgatherv wrapper for this. */ - if (H5_mpio_gatherv_alloc_simple(chunk_list, (int)chunk_list_num_entries, send_type, recv_type, TRUE, - 0, io_info->comm, mpi_rank, mpi_size, &gathered_array, - &collective_num_entries) < 0) + if (H5_mpio_gatherv_alloc_simple(chunk_list->chunk_infos, (int)chunk_list->num_chunk_infos, send_type, + recv_type, TRUE, 0, io_info->comm, mpi_rank, mpi_size, + &gathered_array, &collective_num_entries) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGATHER, FAIL, - "can't gather chunk index re-insertion info to/from ranks") + "can't gather chunk index re-insertion info to/from ranks"); } /* Initialize static chunk udata fields from chunk index info */ @@ -5219,17 +4933,17 @@ H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t * * callback that accepts a chunk index and provides the * caller with the scaled coordinates for that chunk. */ - H5VM_array_calc_pre(chunk_ud.chunk_idx, io_info->dset->shared->ndims, + H5VM_array_calc_pre(chunk_ud.chunk_idx, di->dset->shared->ndims, idx_info->layout->u.earray.swizzled_down_chunks, scaled_coords); H5VM_unswizzle_coords(hsize_t, scaled_coords, idx_info->layout->u.earray.unlim_dim); } else { - H5VM_array_calc_pre(chunk_ud.chunk_idx, io_info->dset->shared->ndims, - io_info->dset->shared->layout.u.chunk.down_chunks, scaled_coords); + H5VM_array_calc_pre(chunk_ud.chunk_idx, di->dset->shared->ndims, + di->dset->shared->layout.u.chunk.down_chunks, scaled_coords); } - scaled_coords[io_info->dset->shared->ndims] = 0; + scaled_coords[di->dset->shared->ndims] = 0; #ifndef NDEBUG /* @@ -5240,20 +4954,21 @@ H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t * * the calculated coordinates above to make sure * they match. */ - for (size_t dbg_idx = 0; dbg_idx < chunk_list_num_entries; dbg_idx++) { - if (coll_entry->index_info.chunk_idx == chunk_list[dbg_idx].index_info.chunk_idx) { - hbool_t coords_match = !HDmemcmp(scaled_coords, chunk_list[dbg_idx].chunk_info->scaled, - io_info->dset->shared->ndims * sizeof(hsize_t)); - - HDassert(coords_match && "Calculated scaled coordinates for chunk didn't match " - "chunk's actual scaled coordinates!"); + for (size_t dbg_idx = 0; dbg_idx < chunk_list->num_chunk_infos; dbg_idx++) { + if (coll_entry->index_info.chunk_idx == chunk_list->chunk_infos[dbg_idx].index_info.chunk_idx) { + hbool_t coords_match = + !memcmp(scaled_coords, chunk_list->chunk_infos[dbg_idx].chunk_info->scaled, + di->dset->shared->ndims * sizeof(hsize_t)); + + assert(coords_match && "Calculated scaled coordinates for chunk didn't match " + "chunk's actual scaled coordinates!"); break; } } #endif - if ((idx_info->storage->ops->insert)(idx_info, &chunk_ud, io_info->dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk address into index") + if ((idx_info->storage->ops->insert)(idx_info, &chunk_ud, di->dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk address into index"); } done: @@ -5281,7 +4996,7 @@ H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t * * Function: H5D__mpio_get_chunk_redistribute_info_types * * Purpose: Constructs MPI derived datatypes for communicating the - * info from a H5D_filtered_collective_io_info_t structure + * info from a H5D_filtered_collective_chunk_info_t structure * that is necessary for redistributing shared chunks during a * collective write of filtered chunks. * @@ -5291,7 +5006,7 @@ H5D__mpio_collective_filtered_chunk_reinsert(H5D_filtered_collective_io_info_t * * type. * * The datatype returned through `resized_type` has an extent - * equal to the size of an H5D_filtered_collective_io_info_t + * equal to the size of an H5D_filtered_collective_chunk_info_t * structure. This makes it suitable for sending an array of * those structures, while extracting out just the info * necessary for the chunk redistribution operation during @@ -5318,20 +5033,20 @@ H5D__mpio_get_chunk_redistribute_info_types(MPI_Datatype *contig_type, hbool_t * FUNC_ENTER_PACKAGE - HDassert(contig_type); - HDassert(contig_type_derived); - HDassert(resized_type); - HDassert(resized_type_derived); + assert(contig_type); + assert(contig_type_derived); + assert(resized_type); + assert(resized_type_derived); *contig_type_derived = FALSE; *resized_type_derived = FALSE; /* Create struct type for the inner H5F_block_t structure */ if (H5F_mpi_get_file_block_type(FALSE, &chunk_block_type, &chunk_block_type_derived) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't create derived type for chunk file description") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't create derived type for chunk file description"); field_count = 5; - HDassert(field_count == (sizeof(types) / sizeof(MPI_Datatype))); + assert(field_count == (sizeof(types) / sizeof(MPI_Datatype))); /* * Create structure type to pack chunk H5F_block_t structure @@ -5362,7 +5077,7 @@ H5D__mpio_get_chunk_redistribute_info_types(MPI_Datatype *contig_type, hbool_t * HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) /* Create struct type to extract the chunk_current, chunk_idx, orig_owner, - * new_owner and num_writers fields from a H5D_filtered_collective_io_info_t + * new_owner and num_writers fields from a H5D_filtered_collective_chunk_info_t * structure */ block_lengths[0] = 1; @@ -5370,11 +5085,11 @@ H5D__mpio_get_chunk_redistribute_info_types(MPI_Datatype *contig_type, hbool_t * block_lengths[2] = 1; block_lengths[3] = 1; block_lengths[4] = 1; - displacements[0] = offsetof(H5D_filtered_collective_io_info_t, chunk_current); - displacements[1] = offsetof(H5D_filtered_collective_io_info_t, index_info.chunk_idx); - displacements[2] = offsetof(H5D_filtered_collective_io_info_t, orig_owner); - displacements[3] = offsetof(H5D_filtered_collective_io_info_t, new_owner); - displacements[4] = offsetof(H5D_filtered_collective_io_info_t, num_writers); + displacements[0] = offsetof(H5D_filtered_collective_chunk_info_t, chunk_current); + displacements[1] = offsetof(H5D_filtered_collective_chunk_info_t, index_info.chunk_idx); + displacements[2] = offsetof(H5D_filtered_collective_chunk_info_t, orig_owner); + displacements[3] = offsetof(H5D_filtered_collective_chunk_info_t, new_owner); + displacements[4] = offsetof(H5D_filtered_collective_chunk_info_t, num_writers); types[0] = chunk_block_type; types[1] = HSIZE_AS_MPI_TYPE; types[2] = MPI_INT; @@ -5386,7 +5101,7 @@ H5D__mpio_get_chunk_redistribute_info_types(MPI_Datatype *contig_type, hbool_t * struct_type_derived = TRUE; if (MPI_SUCCESS != (mpi_code = MPI_Type_create_resized( - struct_type, 0, sizeof(H5D_filtered_collective_io_info_t), resized_type))) + struct_type, 0, sizeof(H5D_filtered_collective_chunk_info_t), resized_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_resized failed", mpi_code) *resized_type_derived = TRUE; @@ -5423,16 +5138,16 @@ H5D__mpio_get_chunk_redistribute_info_types(MPI_Datatype *contig_type, hbool_t * * Function: H5D__mpio_get_chunk_alloc_info_types * * Purpose: Constructs MPI derived datatypes for communicating the info - * from a H5D_filtered_collective_io_info_t structure that is - * necessary for re-allocating file space during a collective - * write of filtered chunks. + * from a H5D_filtered_collective_chunk_info_t structure that + * is necessary for re-allocating file space during a + * collective write of filtered chunks. * * The datatype returned through `contig_type` has an extent * equal to the size of an H5D_chunk_alloc_info_t structure * and is suitable for communicating that structure type. * * The datatype returned through `resized_type` has an extent - * equal to the size of an H5D_filtered_collective_io_info_t + * equal to the size of an H5D_filtered_collective_chunk_info_t * structure. This makes it suitable for sending an array of * those structures, while extracting out just the info * necessary for the chunk file space reallocation operation @@ -5459,20 +5174,20 @@ H5D__mpio_get_chunk_alloc_info_types(MPI_Datatype *contig_type, hbool_t *contig_ FUNC_ENTER_PACKAGE - HDassert(contig_type); - HDassert(contig_type_derived); - HDassert(resized_type); - HDassert(resized_type_derived); + assert(contig_type); + assert(contig_type_derived); + assert(resized_type); + assert(resized_type_derived); *contig_type_derived = FALSE; *resized_type_derived = FALSE; /* Create struct type for the inner H5F_block_t structure */ if (H5F_mpi_get_file_block_type(FALSE, &chunk_block_type, &chunk_block_type_derived) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't create derived type for chunk file description") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't create derived type for chunk file description"); field_count = 3; - HDassert(field_count == (sizeof(types) / sizeof(MPI_Datatype))); + assert(field_count == (sizeof(types) / sizeof(MPI_Datatype))); /* * Create structure type to pack both chunk H5F_block_t structures @@ -5497,14 +5212,14 @@ H5D__mpio_get_chunk_alloc_info_types(MPI_Datatype *contig_type, hbool_t *contig_ /* * Create struct type to extract the chunk_current, chunk_new and chunk_idx - * fields from a H5D_filtered_collective_io_info_t structure + * fields from a H5D_filtered_collective_chunk_info_t structure */ block_lengths[0] = 1; block_lengths[1] = 1; block_lengths[2] = 1; - displacements[0] = offsetof(H5D_filtered_collective_io_info_t, chunk_current); - displacements[1] = offsetof(H5D_filtered_collective_io_info_t, chunk_new); - displacements[2] = offsetof(H5D_filtered_collective_io_info_t, index_info.chunk_idx); + displacements[0] = offsetof(H5D_filtered_collective_chunk_info_t, chunk_current); + displacements[1] = offsetof(H5D_filtered_collective_chunk_info_t, chunk_new); + displacements[2] = offsetof(H5D_filtered_collective_chunk_info_t, index_info.chunk_idx); types[0] = chunk_block_type; types[1] = chunk_block_type; types[2] = HSIZE_AS_MPI_TYPE; @@ -5514,7 +5229,7 @@ H5D__mpio_get_chunk_alloc_info_types(MPI_Datatype *contig_type, hbool_t *contig_ struct_type_derived = TRUE; if (MPI_SUCCESS != (mpi_code = MPI_Type_create_resized( - struct_type, 0, sizeof(H5D_filtered_collective_io_info_t), resized_type))) + struct_type, 0, sizeof(H5D_filtered_collective_chunk_info_t), resized_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_resized failed", mpi_code) *resized_type_derived = TRUE; @@ -5554,7 +5269,7 @@ H5D__mpio_get_chunk_alloc_info_types(MPI_Datatype *contig_type, hbool_t *contig_ * information necessary when reinserting chunks into a * dataset's chunk index. This includes the chunk's new offset * and size (H5F_block_t) and the inner `index_info` structure - * of a H5D_filtered_collective_io_info_t structure. + * of a H5D_filtered_collective_chunk_info_t structure. * * The datatype returned through `contig_type` has an extent * equal to the size of an H5D_chunk_insert_info_t structure @@ -5562,9 +5277,9 @@ H5D__mpio_get_chunk_alloc_info_types(MPI_Datatype *contig_type, hbool_t *contig_ * * The datatype returned through `resized_type` has an extent * equal to the size of the encompassing - * H5D_filtered_collective_io_info_t structure. This makes it - * suitable for sending an array of - * H5D_filtered_collective_io_info_t structures, while + * H5D_filtered_collective_chunk_info_t structure. This makes + * it suitable for sending an array of + * H5D_filtered_collective_chunk_info_t structures, while * extracting out just the information needed during * communication. * @@ -5590,20 +5305,20 @@ H5D__mpio_get_chunk_insert_info_types(MPI_Datatype *contig_type, hbool_t *contig FUNC_ENTER_PACKAGE - HDassert(contig_type); - HDassert(contig_type_derived); - HDassert(resized_type); - HDassert(resized_type_derived); + assert(contig_type); + assert(contig_type_derived); + assert(resized_type); + assert(resized_type_derived); *contig_type_derived = FALSE; *resized_type_derived = FALSE; /* Create struct type for an H5F_block_t structure */ if (H5F_mpi_get_file_block_type(FALSE, &chunk_block_type, &chunk_block_type_derived) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't create derived type for chunk file description") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't create derived type for chunk file description"); field_count = 4; - HDassert(field_count == (sizeof(types) / sizeof(MPI_Datatype))); + assert(field_count == (sizeof(types) / sizeof(MPI_Datatype))); /* * Create struct type to pack information into memory as follows: @@ -5643,20 +5358,20 @@ H5D__mpio_get_chunk_insert_info_types(MPI_Datatype *contig_type, hbool_t *contig /* * Create struct type to correctly extract all needed - * information from a H5D_filtered_collective_io_info_t + * information from a H5D_filtered_collective_chunk_info_t * structure. */ - displacements[0] = offsetof(H5D_filtered_collective_io_info_t, chunk_new); - displacements[1] = offsetof(H5D_filtered_collective_io_info_t, index_info.chunk_idx); - displacements[2] = offsetof(H5D_filtered_collective_io_info_t, index_info.filter_mask); - displacements[3] = offsetof(H5D_filtered_collective_io_info_t, index_info.need_insert); + displacements[0] = offsetof(H5D_filtered_collective_chunk_info_t, chunk_new); + displacements[1] = offsetof(H5D_filtered_collective_chunk_info_t, index_info.chunk_idx); + displacements[2] = offsetof(H5D_filtered_collective_chunk_info_t, index_info.filter_mask); + displacements[3] = offsetof(H5D_filtered_collective_chunk_info_t, index_info.need_insert); if (MPI_SUCCESS != (mpi_code = MPI_Type_create_struct(field_count, block_lengths, displacements, types, &struct_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code) struct_type_derived = TRUE; if (MPI_SUCCESS != (mpi_code = MPI_Type_create_resized( - struct_type, 0, sizeof(H5D_filtered_collective_io_info_t), resized_type))) + struct_type, 0, sizeof(H5D_filtered_collective_chunk_info_t), resized_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_resized failed", mpi_code) *resized_type_derived = TRUE; @@ -5690,276 +5405,151 @@ H5D__mpio_get_chunk_insert_info_types(MPI_Datatype *contig_type, hbool_t *contig } /* end H5D__mpio_get_chunk_insert_info_types() */ /*------------------------------------------------------------------------- - * Function: H5D__mpio_collective_filtered_io_type + * Function: H5D__mpio_collective_filtered_vec_io * - * Purpose: Constructs a MPI derived datatype for both the memory and - * the file for a collective I/O operation on filtered chunks. - * The datatype contains the chunk offsets and lengths in the - * file and the locations of the chunk data buffers to read - * into/write from. + * Purpose: Given a pointer to a H5D_filtered_collective_io_info_t + * structure with information about collective filtered chunk + * I/O, populates I/O vectors and performs vector I/O on those + * chunks. * * Return: Non-negative on success/Negative on failure * *------------------------------------------------------------------------- */ static herr_t -H5D__mpio_collective_filtered_io_type(H5D_filtered_collective_io_info_t *chunk_list, size_t num_entries, - H5D_io_op_type_t op_type, MPI_Datatype *new_mem_type, - hbool_t *mem_type_derived, MPI_Datatype *new_file_type, - hbool_t *file_type_derived) +H5D__mpio_collective_filtered_vec_io(const H5D_filtered_collective_io_info_t *chunk_list, H5F_shared_t *f_sh, + H5D_io_op_type_t op_type) { - MPI_Aint *io_buf_array = NULL; /* Relative displacements of filtered chunk data buffers */ - MPI_Aint *file_offset_array = NULL; /* Chunk offsets in the file */ - int *length_array = NULL; /* Filtered Chunk lengths */ - int mpi_code; - herr_t ret_value = SUCCEED; + const void **io_wbufs = NULL; + void **io_rbufs = NULL; + H5FD_mem_t io_types[2]; + uint32_t iovec_count = 0; + haddr_t *io_addrs = NULL; + size_t *io_sizes = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - HDassert(chunk_list || 0 == num_entries); - HDassert(new_mem_type); - HDassert(mem_type_derived); - HDassert(new_file_type); - HDassert(file_type_derived); + assert(chunk_list); + assert(f_sh); - *mem_type_derived = FALSE; - *file_type_derived = FALSE; - *new_mem_type = MPI_BYTE; - *new_file_type = MPI_BYTE; + if (op_type == H5D_IO_OP_WRITE) + iovec_count = (uint32_t)chunk_list->num_chunk_infos; + else { + assert(chunk_list->num_chunks_to_read <= chunk_list->num_chunk_infos); + iovec_count = (uint32_t)chunk_list->num_chunks_to_read; + } - if (num_entries > 0) { - H5F_block_t *chunk_block; - size_t last_valid_idx = 0; - size_t i; - int chunk_count; + if (iovec_count > 0) { + if (chunk_list->num_chunk_infos > UINT32_MAX) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, + "number of chunk entries in I/O operation exceeds UINT32_MAX"); - /* - * Determine number of chunks for I/O operation and - * setup for derived datatype creation if I/O operation - * includes multiple chunks - */ - if (num_entries == 1) { - /* Set last valid index to 0 for contiguous datatype creation */ - last_valid_idx = 0; + if (NULL == (io_addrs = H5MM_malloc(iovec_count * sizeof(*io_addrs)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "couldn't allocate space for I/O addresses vector"); + if (NULL == (io_sizes = H5MM_malloc(iovec_count * sizeof(*io_sizes)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate space for I/O sizes vector"); - if (op_type == H5D_IO_OP_WRITE) - chunk_count = 1; - else - chunk_count = chunk_list[0].need_read ? 1 : 0; + if (op_type == H5D_IO_OP_WRITE) { + if (NULL == (io_wbufs = H5MM_malloc(iovec_count * sizeof(*io_wbufs)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "couldn't allocate space for I/O buffers vector"); } else { - MPI_Aint chunk_buf; - MPI_Aint base_buf; - haddr_t base_offset = HADDR_UNDEF; + if (NULL == (io_rbufs = H5MM_malloc(iovec_count * sizeof(*io_rbufs)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "couldn't allocate space for I/O buffers vector"); + } + + /* + * Since all I/O will be raw data, we can save on memory a bit by + * making use of H5FD_MEM_NOLIST to signal that all the memory types + * are the same across the I/O vectors + */ + io_types[0] = H5FD_MEM_DRAW; + io_types[1] = H5FD_MEM_NOLIST; - H5_CHECK_OVERFLOW(num_entries, size_t, int); + for (size_t i = 0, vec_idx = 0; i < chunk_list->num_chunk_infos; i++) { + H5F_block_t *chunk_block; - /* Allocate arrays */ - if (NULL == (length_array = H5MM_malloc((size_t)num_entries * sizeof(int)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for filtered collective I/O length array") - if (NULL == (io_buf_array = H5MM_malloc((size_t)num_entries * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for filtered collective I/O buf length array") - if (NULL == (file_offset_array = H5MM_malloc((size_t)num_entries * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for filtered collective I/O offset array") + if (op_type == H5D_IO_OP_READ && !chunk_list->chunk_infos[i].need_read) + continue; /* - * If doing a write, we can set the base chunk offset - * and base chunk data buffer right away. - * - * If doing a read, some chunks may be skipped over - * for reading if they aren't yet allocated in the - * file. Therefore, we have to find the first chunk - * actually being read in order to set the base chunk - * offset and base chunk data buffer. + * Check that we aren't going to accidentally try to write past the + * allocated memory for the I/O vector buffers in case bookkeeping + * wasn't done properly for the chunk list struct's `num_chunks_to_read` + * field. */ - if (op_type == H5D_IO_OP_WRITE) { -#if H5_CHECK_MPI_VERSION(3, 0) - if (MPI_SUCCESS != (mpi_code = MPI_Get_address(chunk_list[0].buf, &base_buf))) - HMPI_GOTO_ERROR(FAIL, "MPI_Get_address failed", mpi_code) -#else - base_buf = (MPI_Aint)chunk_list[0].buf; -#endif + assert(vec_idx < iovec_count); - base_offset = chunk_list[0].chunk_new.offset; - } + /* Set convenience pointer for current chunk block */ + chunk_block = (op_type == H5D_IO_OP_READ) ? &chunk_list->chunk_infos[i].chunk_current + : &chunk_list->chunk_infos[i].chunk_new; - for (i = 0, chunk_count = 0; i < num_entries; i++) { - if (op_type == H5D_IO_OP_READ) { - /* - * If this chunk isn't being read, don't add it - * to the MPI type we're building up for I/O - */ - if (!chunk_list[i].need_read) - continue; + assert(H5_addr_defined(chunk_block->offset)); + io_addrs[vec_idx] = chunk_block->offset; - /* - * If this chunk is being read, go ahead and - * set the base chunk offset and base chunk - * data buffer if we haven't already - */ - if (!H5F_addr_defined(base_offset)) { -#if H5_CHECK_MPI_VERSION(3, 0) - if (MPI_SUCCESS != (mpi_code = MPI_Get_address(chunk_list[i].buf, &base_buf))) - HMPI_GOTO_ERROR(FAIL, "MPI_Get_address failed", mpi_code) -#else - base_buf = (MPI_Aint)chunk_list[i].buf; + /* + * Ensure the chunk list is sorted in ascending ordering of + * offset in the file. Note that we only compare that the + * current address is greater than the previous address and + * not equal to it; file addresses should only appear in the + * chunk list once. + */ +#ifndef NDEBUG + if (vec_idx > 0) + assert(io_addrs[vec_idx] > io_addrs[vec_idx - 1]); #endif - base_offset = chunk_list[i].chunk_current.offset; - } - } - - /* Set convenience pointer for current chunk block */ - chunk_block = - (op_type == H5D_IO_OP_READ) ? &chunk_list[i].chunk_current : &chunk_list[i].chunk_new; - - /* - * Set the current chunk entry's offset in the file, relative to - * the first chunk entry - */ - HDassert(H5F_addr_defined(chunk_block->offset)); - file_offset_array[chunk_count] = (MPI_Aint)(chunk_block->offset - base_offset); - - /* - * Ensure the chunk list is sorted in ascending ordering of - * offset in the file - */ - if (chunk_count) - HDassert(file_offset_array[chunk_count] > file_offset_array[chunk_count - 1]); - - /* Set the current chunk entry's size for the I/O operation */ - H5_CHECK_OVERFLOW(chunk_block->length, hsize_t, int); - length_array[chunk_count] = (int)chunk_block->length; - - /* - * Set the displacement of the chunk entry's chunk data buffer, - * relative to the first entry's data buffer - */ -#if H5_CHECK_MPI_VERSION(3, 1) - if (MPI_SUCCESS != (mpi_code = MPI_Get_address(chunk_list[i].buf, &chunk_buf))) - HMPI_GOTO_ERROR(FAIL, "MPI_Get_address failed", mpi_code) - - io_buf_array[chunk_count] = MPI_Aint_diff(chunk_buf, base_buf); -#else - chunk_buf = (MPI_Aint)chunk_list[i].buf; - io_buf_array[chunk_count] = chunk_buf - base_buf; -#endif + io_sizes[vec_idx] = (size_t)chunk_block->length; - /* - * Set last valid index in case only a single chunk will - * be involved in the I/O operation - */ - last_valid_idx = i; + if (op_type == H5D_IO_OP_WRITE) + io_wbufs[vec_idx] = chunk_list->chunk_infos[i].buf; + else + io_rbufs[vec_idx] = chunk_list->chunk_infos[i].buf; - chunk_count++; - } /* end for */ + vec_idx++; } + } - /* - * Create derived datatypes for the chunk list if this - * rank has any chunks to work on - */ - if (chunk_count > 0) { - if (chunk_count == 1) { - int chunk_len; - - /* Single chunk - use a contiguous type for both memory and file */ - - /* Ensure that we can cast chunk size to an int for MPI */ - chunk_block = (op_type == H5D_IO_OP_READ) ? &chunk_list[last_valid_idx].chunk_current - : &chunk_list[last_valid_idx].chunk_new; - H5_CHECKED_ASSIGN(chunk_len, int, chunk_block->length, hsize_t); - - if (MPI_SUCCESS != (mpi_code = MPI_Type_contiguous(chunk_len, MPI_BYTE, new_file_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code) - *new_mem_type = *new_file_type; - - /* - * Since we use the same datatype for both memory and file, only - * mark the file type as derived so the caller doesn't try to - * free the same type twice - */ - *mem_type_derived = FALSE; - *file_type_derived = TRUE; - - if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_file_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - } - else { - HDassert(file_offset_array); - HDassert(length_array); - HDassert(io_buf_array); - - /* Multiple chunks - use an hindexed type for both memory and file */ - - /* Create memory MPI type */ - if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed( - chunk_count, length_array, io_buf_array, MPI_BYTE, new_mem_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) - *mem_type_derived = TRUE; - - if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_mem_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - - /* Create file MPI type */ - if (MPI_SUCCESS != - (mpi_code = MPI_Type_create_hindexed(chunk_count, length_array, file_offset_array, - MPI_BYTE, new_file_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) - *file_type_derived = TRUE; - - if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_file_type))) - HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - } - } - } /* end if */ + if (op_type == H5D_IO_OP_WRITE) { + if (H5F_shared_vector_write(f_sh, iovec_count, io_types, io_addrs, io_sizes, io_wbufs) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "vector write call failed"); + } + else { + if (H5F_shared_vector_read(f_sh, iovec_count, io_types, io_addrs, io_sizes, io_rbufs) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "vector read call failed"); + } done: - if (file_offset_array) - H5MM_free(file_offset_array); - if (io_buf_array) - H5MM_free(io_buf_array); - if (length_array) - H5MM_free(length_array); - - if (ret_value < 0) { - if (*file_type_derived) { - if (MPI_SUCCESS != (mpi_code = MPI_Type_free(new_file_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - *file_type_derived = FALSE; - } - if (*mem_type_derived) { - if (MPI_SUCCESS != (mpi_code = MPI_Type_free(new_mem_type))) - HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) - *mem_type_derived = FALSE; - } - } + H5MM_free(io_wbufs); + H5MM_free(io_rbufs); + H5MM_free(io_sizes); + H5MM_free(io_addrs); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5D__mpio_collective_filtered_io_type() */ +} #ifdef H5Dmpio_DEBUG static herr_t -H5D__mpio_dump_collective_filtered_chunk_list(H5D_filtered_collective_io_info_t *chunk_list, - size_t chunk_list_num_entries, int mpi_rank) +H5D__mpio_dump_collective_filtered_chunk_list(H5D_filtered_collective_io_info_t *chunk_list, int mpi_rank) { - H5D_filtered_collective_io_info_t *chunk_entry; - size_t i; - herr_t ret_value = SUCCEED; + H5D_filtered_collective_chunk_info_t *chunk_entry; + size_t i; + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE_NOERR H5D_MPIO_DEBUG(mpi_rank, "CHUNK LIST: ["); - for (i = 0; i < chunk_list_num_entries; i++) { + for (i = 0; i < chunk_list->num_chunk_infos; i++) { unsigned chunk_rank; - chunk_entry = &chunk_list[i]; + chunk_entry = &chunk_list->chunk_infos[i]; - HDassert(chunk_entry->chunk_info); + assert(chunk_entry->chunk_info); chunk_rank = (unsigned)H5S_GET_EXTENT_NDIMS(chunk_entry->chunk_info->fspace); H5D_MPIO_DEBUG(mpi_rank, " {"); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dnone.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dnone.c index e157d6e308..181016d98a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dnone.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dnone.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,17 +10,16 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Vailin Choi - * September 2010 - * +/* * Purpose: Implicit (Non Index) chunked I/O functions. - * This is used when the dataset is: - * extendible but with fixed max. dims - * with early allocation - * without filter - * The chunk coordinate is mapped into the actual disk addresses - * for the chunk without indexing. * + * This is used when the dataset is: + * - extendible but with fixed max. dims + * - with early allocation + * - without filter + * + * The chunk coordinate is mapped into the actual disk addresses + * for the chunk without indexing. */ /****************/ @@ -106,8 +104,6 @@ const H5D_chunk_ops_t H5D_COPS_NONE[1] = {{ * Return: Non-negative on success * Negative on failure. * - * Programmer: Vailin Choi; September 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -120,22 +116,22 @@ H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->pline->nused == 0); /* Shouldn't have filter defined on entering here */ - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(idx_info->layout->max_nchunks); - HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); /* address of data shouldn't be defined */ + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->pline->nused == 0); /* Shouldn't have filter defined on entering here */ + assert(idx_info->layout); + assert(idx_info->storage); + assert(idx_info->layout->max_nchunks); + assert(!H5_addr_defined(idx_info->storage->idx_addr)); /* address of data shouldn't be defined */ /* Calculate size of max dataset chunks */ nbytes = idx_info->layout->max_nchunks * idx_info->layout->size; /* Allocate space for max dataset chunks */ addr = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, nbytes); - if (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed") + if (!H5_addr_defined(addr)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed"); /* This is the address of the dataset chunks */ idx_info->storage->idx_addr = addr; @@ -151,8 +147,6 @@ H5D__none_idx_create(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; September 2010 - * *------------------------------------------------------------------------- */ static hbool_t @@ -161,9 +155,9 @@ H5D__none_idx_is_space_alloc(const H5O_storage_chunk_t *storage) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); + assert(storage); - FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) + FUNC_LEAVE_NOAPI((hbool_t)H5_addr_defined(storage->idx_addr)) } /* end H5D__none_idx_is_space_alloc() */ /*------------------------------------------------------------------------- @@ -174,8 +168,6 @@ H5D__none_idx_is_space_alloc(const H5O_storage_chunk_t *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -184,14 +176,14 @@ H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->pline->nused == 0); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(udata); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->pline->nused == 0); + assert(idx_info->layout); + assert(idx_info->storage); + assert(udata); + assert(H5_addr_defined(idx_info->storage->idx_addr)); /* Calculate the index of this chunk */ udata->chunk_idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, @@ -215,8 +207,6 @@ H5D__none_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; September 2010 - * *------------------------------------------------------------------------- */ static int @@ -232,23 +222,23 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t ch FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(!idx_info->pline->nused); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(chunk_cb); - HDassert(chunk_udata); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(!idx_info->pline->nused); + assert(idx_info->layout); + assert(idx_info->storage); + assert(chunk_cb); + assert(chunk_udata); + assert(H5_addr_defined(idx_info->storage->idx_addr)); /* Initialize generic chunk record */ - HDmemset(&chunk_rec, 0, sizeof(chunk_rec)); + memset(&chunk_rec, 0, sizeof(chunk_rec)); chunk_rec.nbytes = idx_info->layout->size; chunk_rec.filter_mask = 0; ndims = idx_info->layout->ndims - 1; - HDassert(ndims > 0); + assert(ndims > 0); /* Iterate over all the chunks in the dataset's dataspace */ for (u = 0; u < idx_info->layout->nchunks && ret_value == H5_ITER_CONT; u++) { @@ -261,7 +251,7 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t ch /* Make "generic chunk" callback */ if ((ret_value = (*chunk_cb)(&chunk_rec, chunk_udata)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, H5_ITER_ERROR, - "failure in generic chunk iterator callback") + "failure in generic chunk iterator callback"); /* Update coordinates of chunk in dataset */ curr_dim = (int)(ndims - 1); @@ -295,8 +285,6 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t ch * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -318,8 +306,6 @@ H5D__none_idx_remove(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi; Sept 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -331,18 +317,18 @@ H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(!idx_info->pline->nused); /* Shouldn't have filter defined on entering here */ - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); /* should be defined */ + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(!idx_info->pline->nused); /* Shouldn't have filter defined on entering here */ + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); /* should be defined */ /* chunk size * max # of chunks */ nbytes = idx_info->layout->max_nchunks * idx_info->layout->size; if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->storage->idx_addr, nbytes) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free dataset chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free dataset chunks"); idx_info->storage->idx_addr = HADDR_UNDEF; @@ -357,8 +343,6 @@ H5D__none_idx_delete(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -370,27 +354,27 @@ H5D__none_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_inf FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info_src); - HDassert(idx_info_src->f); - HDassert(idx_info_src->pline); - HDassert(!idx_info_src->pline->nused); - HDassert(idx_info_src->layout); - HDassert(idx_info_src->storage); - HDassert(H5F_addr_defined(idx_info_src->storage->idx_addr)); - - HDassert(idx_info_dst); - HDassert(idx_info_dst->f); - HDassert(idx_info_dst->pline); - HDassert(!idx_info_dst->pline->nused); - HDassert(idx_info_dst->layout); - HDassert(idx_info_dst->storage); + assert(idx_info_src); + assert(idx_info_src->f); + assert(idx_info_src->pline); + assert(!idx_info_src->pline->nused); + assert(idx_info_src->layout); + assert(idx_info_src->storage); + assert(H5_addr_defined(idx_info_src->storage->idx_addr)); + + assert(idx_info_dst); + assert(idx_info_dst->f); + assert(idx_info_dst->pline); + assert(!idx_info_dst->pline->nused); + assert(idx_info_dst->layout); + assert(idx_info_dst->storage); /* Set copied metadata tag */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) /* Allocate dataset chunks in the dest. file */ if (H5D__none_idx_create(idx_info_dst) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage"); /* Reset metadata tag */ H5_END_TAG @@ -407,8 +391,6 @@ H5D__none_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_inf * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi; Sept 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -417,7 +399,7 @@ H5D__none_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *i FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(index_size); + assert(index_size); *index_size = 0; @@ -431,8 +413,6 @@ H5D__none_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t *i * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -441,7 +421,7 @@ H5D__none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); + assert(storage); /* Reset index info */ if (reset_addr) @@ -457,8 +437,6 @@ H5D__none_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; September 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -467,10 +445,10 @@ H5D__none_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); - HDassert(stream); + assert(storage); + assert(stream); - HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); + fprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__none_idx_dump() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Doh.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Doh.c index ae88bb3f37..f4a993491e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Doh.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Doh.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -89,9 +88,6 @@ H5FL_DEFINE(H5D_copy_file_ud_t); * * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, November 21, 2005 - * *------------------------------------------------------------------------- */ static void * @@ -103,7 +99,7 @@ H5O__dset_get_copy_file_udata(void) /* Allocate space for the 'copy file' user data for copying datasets */ if (NULL == (ret_value = H5FL_CALLOC(H5D_copy_file_ud_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -117,9 +113,6 @@ H5O__dset_get_copy_file_udata(void) * * Return: * - * Programmer: Quincey Koziol - * Monday, November 21, 2005 - * *------------------------------------------------------------------------- */ static void @@ -130,7 +123,7 @@ H5O__dset_free_copy_file_udata(void *_udata) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(udata); + assert(udata); /* Release copy of dataset's dataspace extent, if it was set */ if (udata->src_space_extent) @@ -162,9 +155,6 @@ H5O__dset_free_copy_file_udata(void *_udata) * Failure: FAIL if the existence of certain messages * cannot be determined. * - * Programmer: Robb Matzke - * Monday, November 2, 1998 - * *------------------------------------------------------------------------- */ static htri_t @@ -175,19 +165,19 @@ H5O__dset_isa(const H5O_t *oh) FUNC_ENTER_PACKAGE - HDassert(oh); + assert(oh); /* Datatype */ if ((exists = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header"); else if (!exists) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Layout */ if ((exists = H5O_msg_exists_oh(oh, H5O_SDSPACE_ID)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to read object header"); else if (!exists) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -201,9 +191,6 @@ H5O__dset_isa(const H5O_t *oh) * Return: Success: Open object identifier * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static void * @@ -215,7 +202,7 @@ H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) FUNC_ENTER_PACKAGE - HDassert(obj_loc); + assert(obj_loc); *opened_type = H5I_DATASET; @@ -233,9 +220,9 @@ H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) /* Check class of LAPL from API context */ if ((is_lapl = H5P_isa_class(dapl_id, H5P_LINK_ACCESS)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get LAPL status") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get LAPL status"); if ((is_dapl = H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get DAPL status") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get DAPL status"); /* Switch to default DAPL if not an actual DAPL in the API context */ if (!is_dapl && is_lapl) @@ -244,14 +231,14 @@ H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) /* Open the dataset */ if (NULL == (dset = H5D_open(obj_loc, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset"); ret_value = (void *)dset; done: if (NULL == ret_value) if (dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataset"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dset_open() */ @@ -264,9 +251,6 @@ H5O__dset_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) * Return: Success: Pointer to the dataset data structure * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, April 11, 2007 - * *------------------------------------------------------------------------- */ static void * @@ -279,20 +263,20 @@ H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(crt_info); - HDassert(obj_loc); + assert(f); + assert(crt_info); + assert(obj_loc); - /* Create the the dataset */ + /* Create the dataset */ if (NULL == (dset = H5D__create(f, crt_info->type_id, crt_info->space, crt_info->dcpl_id, crt_info->dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset"); /* Set up the new dataset's location */ if (NULL == (obj_loc->oloc = H5D_oloc(dset))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get object location of dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get object location of dataset"); if (NULL == (obj_loc->path = H5D_nameof(dset))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get path of dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get path of dataset"); /* Set the return value */ ret_value = dset; @@ -300,7 +284,7 @@ H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) done: if (ret_value == NULL) if (dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release dataset"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dset_create() */ @@ -313,9 +297,6 @@ H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) * Return: Success: Pointer to object header location * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static H5O_loc_t * @@ -328,11 +309,11 @@ H5O__dset_get_oloc(hid_t obj_id) /* Get the dataset */ if (NULL == (dset = (H5D_t *)H5VL_object(obj_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID") + HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID"); /* Get the dataset's object header location */ if (NULL == (ret_value = H5D_oloc(dset))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -347,9 +328,6 @@ H5O__dset_get_oloc(hid_t obj_id) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * July 11, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -365,22 +343,22 @@ H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(oh); - HDassert(bh_info); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(oh); + assert(bh_info); /* Get the layout message from the object header */ if (NULL == H5O_msg_read_oh(loc->file, oh, H5O_LAYOUT_ID, &layout)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find layout message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find layout message"); layout_read = TRUE; /* Check for chunked dataset storage */ if (layout.type == H5D_CHUNKED && H5D__chunk_is_space_alloc(&layout.storage)) { /* Get size of chunk index */ if (H5D__chunk_bh_info(loc, oh, &layout, &(bh_info->index_size)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info"); } /* end if */ else if (layout.type == H5D_VIRTUAL && (layout.storage.u.virt.serial_list_hobjid.addr != HADDR_UNDEF)) { size_t virtual_heap_size; @@ -388,7 +366,7 @@ H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info) /* Get size of global heap object for virtual dataset */ if (H5HG_get_obj_size(loc->file, &(layout.storage.u.virt.serial_list_hobjid), &virtual_heap_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "can't get global heap size for virtual dataset mapping") + "can't get global heap size for virtual dataset mapping"); /* Return heap size */ bh_info->heap_size = (hsize_t)virtual_heap_size; @@ -396,28 +374,28 @@ H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info) /* Check for External File List message in the object header */ if ((exists = H5O_msg_exists_oh(oh, H5O_EFL_ID)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for EFL message") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for EFL message"); if (exists && H5D__efl_is_space_alloc(&layout.storage)) { /* Start with clean EFL info */ - HDmemset(&efl, 0, sizeof(efl)); + memset(&efl, 0, sizeof(efl)); /* Get External File List message from the object header */ if (NULL == H5O_msg_read_oh(loc->file, oh, H5O_EFL_ID, &efl)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find EFL message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't find EFL message"); efl_read = TRUE; /* Get size of local heap for EFL message's file list */ if (H5D__efl_bh_info(loc->file, &efl, &(bh_info->heap_size)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine EFL heap info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine EFL heap info"); } /* end if */ done: /* Free messages, if they've been read in */ if (layout_read && H5O_msg_reset(H5O_LAYOUT_ID, &layout) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset data storage layout message") + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset data storage layout message"); if (efl_read && H5O_msg_reset(H5O_EFL_ID, &efl) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset external file list message") + HDONE_ERROR(H5E_DATASET, H5E_CANTRESET, FAIL, "unable to reset external file list message"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dset_bh_info() */ @@ -430,9 +408,6 @@ H5O__dset_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi - * February 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -444,17 +419,17 @@ H5O__dset_flush(void *_obj_ptr) FUNC_ENTER_PACKAGE - HDassert(dset); - HDassert(&dset->oloc); + assert(dset); + assert(&dset->oloc); /* Check that the object found is the correct type */ if (H5O_obj_type(&dset->oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type"); if (obj_type != H5O_TYPE_DATASET) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset"); if (H5D__flush_real(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info") + HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dscatgath.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dscatgath.c index 45c7bff062..cf6b4fd453 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dscatgath.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dscatgath.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -32,6 +31,17 @@ /* Local Macros */ /****************/ +/* Macro to determine if we're using H5D__compound_opt_read() */ +#define H5D__SCATGATH_USE_CMPD_OPT_READ(DSET_INFO, IN_PLACE_TCONV) \ + ((DSET_INFO)->type_info.cmpd_subset && H5T_SUBSET_FALSE != (DSET_INFO)->type_info.cmpd_subset->subset && \ + !(IN_PLACE_TCONV)) + +/* Macro to determine if we're using H5D__compound_opt_write() */ +#define H5D__SCATGATH_USE_CMPD_OPT_WRITE(DSET_INFO, IN_PLACE_TCONV) \ + ((DSET_INFO)->type_info.cmpd_subset && H5T_SUBSET_DST == (DSET_INFO)->type_info.cmpd_subset->subset && \ + (DSET_INFO)->type_info.dst_type_size == (DSET_INFO)->type_info.cmpd_subset->copy_size && \ + !(IN_PLACE_TCONV)) + /******************/ /* Local Typedefs */ /******************/ @@ -39,13 +49,13 @@ /********************/ /* Local Prototypes */ /********************/ -static herr_t H5D__scatter_file(const H5D_io_info_t *io_info, H5S_sel_iter_t *file_iter, size_t nelmts, - const void *buf); -static size_t H5D__gather_file(const H5D_io_info_t *io_info, H5S_sel_iter_t *file_iter, size_t nelmts, - void *buf); +static herr_t H5D__scatter_file(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + H5S_sel_iter_t *file_iter, size_t nelmts, const void *buf); +static size_t H5D__gather_file(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + H5S_sel_iter_t *file_iter, size_t nelmts, void *buf); static herr_t H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_t *type_info, - void *user_buf /*out*/); -static herr_t H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info); + uint8_t *tconv_buf, void *user_buf /*out*/); +static herr_t H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info, void *tconv_buf); /*********************/ /* Package Variables */ @@ -75,43 +85,47 @@ H5FL_SEQ_EXTERN(hsize_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, June 20, 2002 - * *------------------------------------------------------------------------- */ static herr_t -H5D__scatter_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter, size_t nelmts, const void *_buf) +H5D__scatter_file(const H5D_io_info_t *_io_info, const H5D_dset_io_info_t *_dset_info, H5S_sel_iter_t *iter, + size_t nelmts, const void *_buf) { - H5D_io_info_t tmp_io_info; /* Temporary I/O info object */ - hsize_t *off = NULL; /* Pointer to sequence offsets */ - hsize_t mem_off; /* Offset in memory */ - size_t mem_curr_seq; /* "Current sequence" in memory */ - size_t dset_curr_seq; /* "Current sequence" in dataset */ - size_t *len = NULL; /* Array to store sequence lengths */ - size_t orig_mem_len, mem_len; /* Length of sequence in memory */ - size_t nseq; /* Number of sequences generated */ - size_t nelem; /* Number of elements used in sequences */ - size_t dxpl_vec_size; /* Vector length from API context's DXPL */ - size_t vec_size; /* Vector length */ - herr_t ret_value = SUCCEED; /* Return value */ + H5D_io_info_t tmp_io_info; /* Temporary I/O info object */ + H5D_dset_io_info_t tmp_dset_info; /* Temporary I/O info object */ + hsize_t *off = NULL; /* Pointer to sequence offsets */ + hsize_t mem_off; /* Offset in memory */ + size_t mem_curr_seq; /* "Current sequence" in memory */ + size_t dset_curr_seq; /* "Current sequence" in dataset */ + size_t *len = NULL; /* Array to store sequence lengths */ + size_t orig_mem_len, mem_len; /* Length of sequence in memory */ + size_t nseq; /* Number of sequences generated */ + size_t nelem; /* Number of elements used in sequences */ + size_t dxpl_vec_size; /* Vector length from API context's DXPL */ + size_t vec_size; /* Vector length */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(_io_info); - HDassert(iter); - HDassert(nelmts > 0); - HDassert(_buf); + assert(_io_info); + assert(_dset_info); + assert(_dset_info->dset); + assert(_dset_info->store); + assert(iter); + assert(nelmts > 0); + assert(_buf); /* Set up temporary I/O info object */ H5MM_memcpy(&tmp_io_info, _io_info, sizeof(*_io_info)); - tmp_io_info.op_type = H5D_IO_OP_WRITE; - tmp_io_info.u.wbuf = _buf; + memcpy(&tmp_dset_info, _dset_info, sizeof(*_dset_info)); + tmp_io_info.op_type = H5D_IO_OP_WRITE; + tmp_dset_info.buf.cvp = _buf; + tmp_io_info.dsets_info = &tmp_dset_info; /* Get info from API context */ if (H5CX_get_vec_size(&dxpl_vec_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size"); /* Allocate the vector I/O arrays */ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE) @@ -119,15 +133,15 @@ H5D__scatter_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter, size_t ne else vec_size = H5D_IO_VECTOR_SIZE; if (NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array"); if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array"); /* Loop until all elements are written */ while (nelmts > 0) { /* Get list of sequences for selection to write */ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Reset the current sequence information */ mem_curr_seq = dset_curr_seq = 0; @@ -135,12 +149,12 @@ H5D__scatter_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter, size_t ne mem_off = 0; /* Write sequence list out */ - if ((*tmp_io_info.layout_ops.writevv)(&tmp_io_info, nseq, &dset_curr_seq, len, off, (size_t)1, - &mem_curr_seq, &mem_len, &mem_off) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error") + if ((*tmp_dset_info.layout_ops.writevv)(&tmp_io_info, &tmp_dset_info, nseq, &dset_curr_seq, len, off, + (size_t)1, &mem_curr_seq, &mem_len, &mem_off) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error"); /* Update buffer */ - tmp_io_info.u.wbuf = (const uint8_t *)tmp_io_info.u.wbuf + orig_mem_len; + tmp_dset_info.buf.cvp = (const uint8_t *)tmp_dset_info.buf.cvp + orig_mem_len; /* Decrement number of elements left to process */ nelmts -= nelem; @@ -172,45 +186,47 @@ H5D__scatter_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter, size_t ne * Return: Success: Number of elements copied. * Failure: 0 * - * Programmer: Quincey Koziol - * Monday, June 24, 2002 - * *------------------------------------------------------------------------- */ static size_t -H5D__gather_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter, size_t nelmts, void *_buf /*out*/) +H5D__gather_file(const H5D_io_info_t *_io_info, const H5D_dset_io_info_t *_dset_info, H5S_sel_iter_t *iter, + size_t nelmts, void *_buf /*out*/) { - H5D_io_info_t tmp_io_info; /* Temporary I/O info object */ - hsize_t *off = NULL; /* Pointer to sequence offsets */ - hsize_t mem_off; /* Offset in memory */ - size_t mem_curr_seq; /* "Current sequence" in memory */ - size_t dset_curr_seq; /* "Current sequence" in dataset */ - size_t *len = NULL; /* Pointer to sequence lengths */ - size_t orig_mem_len, mem_len; /* Length of sequence in memory */ - size_t nseq; /* Number of sequences generated */ - size_t nelem; /* Number of elements used in sequences */ - size_t dxpl_vec_size; /* Vector length from API context's DXPL */ - size_t vec_size; /* Vector length */ - size_t ret_value = nelmts; /* Return value */ + H5D_io_info_t tmp_io_info; /* Temporary I/O info object */ + H5D_dset_io_info_t tmp_dset_info; /* Temporary I/O info object */ + hsize_t *off = NULL; /* Pointer to sequence offsets */ + hsize_t mem_off; /* Offset in memory */ + size_t mem_curr_seq; /* "Current sequence" in memory */ + size_t dset_curr_seq; /* "Current sequence" in dataset */ + size_t *len = NULL; /* Pointer to sequence lengths */ + size_t orig_mem_len, mem_len; /* Length of sequence in memory */ + size_t nseq; /* Number of sequences generated */ + size_t nelem; /* Number of elements used in sequences */ + size_t dxpl_vec_size; /* Vector length from API context's DXPL */ + size_t vec_size; /* Vector length */ + size_t ret_value = nelmts; /* Return value */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(_io_info); - HDassert(_io_info->dset); - HDassert(_io_info->store); - HDassert(iter); - HDassert(nelmts > 0); - HDassert(_buf); + assert(_io_info); + assert(_dset_info); + assert(_dset_info->dset); + assert(_dset_info->store); + assert(iter); + assert(nelmts > 0); + assert(_buf); /* Set up temporary I/O info object */ H5MM_memcpy(&tmp_io_info, _io_info, sizeof(*_io_info)); - tmp_io_info.op_type = H5D_IO_OP_READ; - tmp_io_info.u.rbuf = _buf; + memcpy(&tmp_dset_info, _dset_info, sizeof(*_dset_info)); + tmp_io_info.op_type = H5D_IO_OP_READ; + tmp_dset_info.buf.vp = _buf; + tmp_io_info.dsets_info = &tmp_dset_info; /* Get info from API context */ if (H5CX_get_vec_size(&dxpl_vec_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't retrieve I/O vector size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't retrieve I/O vector size"); /* Allocate the vector I/O arrays */ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE) @@ -218,15 +234,15 @@ H5D__gather_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter, size_t nel else vec_size = H5D_IO_VECTOR_SIZE; if (NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O length vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O length vector array"); if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O offset vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O offset vector array"); /* Loop until all elements are read */ while (nelmts > 0) { /* Get list of sequences for selection to read */ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Reset the current sequence information */ mem_curr_seq = dset_curr_seq = 0; @@ -234,12 +250,12 @@ H5D__gather_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter, size_t nel mem_off = 0; /* Read sequence list in */ - if ((*tmp_io_info.layout_ops.readvv)(&tmp_io_info, nseq, &dset_curr_seq, len, off, (size_t)1, - &mem_curr_seq, &mem_len, &mem_off) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error") + if ((*tmp_dset_info.layout_ops.readvv)(&tmp_io_info, &tmp_dset_info, nseq, &dset_curr_seq, len, off, + (size_t)1, &mem_curr_seq, &mem_len, &mem_off) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, 0, "read error"); /* Update buffer */ - tmp_io_info.u.rbuf = (uint8_t *)tmp_io_info.u.rbuf + orig_mem_len; + tmp_dset_info.buf.vp = (uint8_t *)tmp_dset_info.buf.vp + orig_mem_len; /* Decrement number of elements left to process */ nelmts -= nelem; @@ -265,9 +281,6 @@ H5D__gather_file(const H5D_io_info_t *_io_info, H5S_sel_iter_t *iter, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, July 8, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -288,14 +301,14 @@ H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts, vo FUNC_ENTER_PACKAGE /* Check args */ - HDassert(tscat_buf); - HDassert(iter); - HDassert(nelmts > 0); - HDassert(buf); + assert(tscat_buf); + assert(iter); + assert(nelmts > 0); + assert(buf); /* Get info from API context */ if (H5CX_get_vec_size(&dxpl_vec_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size"); /* Allocate the vector I/O arrays */ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE) @@ -303,15 +316,15 @@ H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts, vo else vec_size = H5D_IO_VECTOR_SIZE; if (NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array"); if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array"); /* Loop until all elements are written */ while (nelmts > 0) { /* Get list of sequences for selection to write */ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Loop, while sequences left to process */ for (curr_seq = 0; curr_seq < nseq; curr_seq++) { @@ -350,9 +363,6 @@ H5D__scatter_mem(const void *_tscat_buf, H5S_sel_iter_t *iter, size_t nelmts, vo * Return: Success: Number of elements copied. * Failure: 0 * - * Programmer: Quincey Koziol - * Monday, June 24, 2002 - * *------------------------------------------------------------------------- */ size_t @@ -373,14 +383,14 @@ H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts, void *_tg FUNC_ENTER_PACKAGE /* Check args */ - HDassert(buf); - HDassert(iter); - HDassert(nelmts > 0); - HDassert(tgath_buf); + assert(buf); + assert(iter); + assert(nelmts > 0); + assert(tgath_buf); /* Get info from API context */ if (H5CX_get_vec_size(&dxpl_vec_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't retrieve I/O vector size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't retrieve I/O vector size"); /* Allocate the vector I/O arrays */ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE) @@ -388,15 +398,15 @@ H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts, void *_tg else vec_size = H5D_IO_VECTOR_SIZE; if (NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O length vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O length vector array"); if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O offset vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, 0, "can't allocate I/O offset vector array"); /* Loop until all elements are written */ while (nelmts > 0) { /* Get list of sequences for selection to write */ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &nelem, off, len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Loop, while sequences left to process */ for (curr_seq = 0; curr_seq < nseq; curr_seq++) { @@ -430,17 +440,14 @@ H5D__gather_mem(const void *_buf, H5S_sel_iter_t *iter, size_t nelmts, void *_tg * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 6, 2008 - * *------------------------------------------------------------------------- */ herr_t -H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space) +H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info) { - void *buf = io_info->u.rbuf; /* Local pointer to application buffer */ - H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/ + void *buf; /* Local pointer to application buffer */ + void *tmp_buf; /* Buffer to use for type conversion */ + H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */ H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/ hbool_t bkg_iter_init = FALSE; /* Background iteration info has been initialized */ @@ -448,48 +455,81 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */ hsize_t smine_start; /* Strip mine start loc */ size_t smine_nelmts; /* Elements per strip */ + hbool_t in_place_tconv; /* Whether to perform in-place type_conversion */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(type_info); - HDassert(mem_space); - HDassert(file_space); - HDassert(buf); + assert(io_info); + assert(dset_info); + assert(dset_info->mem_space); + assert(dset_info->file_space); + assert(dset_info->buf.vp); + + /* Set buf pointer */ + buf = dset_info->buf.vp; /* Check for NOOP read */ - if (nelmts == 0) - HGOTO_DONE(SUCCEED) + if (dset_info->nelmts == 0) + HGOTO_DONE(SUCCEED); + + /* Check for in-place type conversion */ + in_place_tconv = dset_info->layout_io_info.contig_piece_info && + dset_info->layout_io_info.contig_piece_info->in_place_tconv; /* Allocate the iterators */ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator"); if (NULL == (bkg_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate background iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate background iterator"); if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator"); /* Figure out the strip mine size. */ - if (H5S_select_iter_init(file_iter, file_space, type_info->src_type_size, + if (H5S_select_iter_init(file_iter, dset_info->file_space, dset_info->type_info.src_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information"); file_iter_init = TRUE; /*file selection iteration info has been initialized */ - if (H5S_select_iter_init(mem_iter, mem_space, type_info->dst_type_size, 0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") + if (H5S_select_iter_init(mem_iter, dset_info->mem_space, dset_info->type_info.dst_type_size, 0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information"); mem_iter_init = TRUE; /*file selection iteration info has been initialized */ - if (H5S_select_iter_init(bkg_iter, mem_space, type_info->dst_type_size, 0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information") + if (H5S_select_iter_init(bkg_iter, dset_info->mem_space, dset_info->type_info.dst_type_size, 0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information"); bkg_iter_init = TRUE; /*file selection iteration info has been initialized */ /* Start strip mining... */ - for (smine_start = 0; smine_start < nelmts; smine_start += smine_nelmts) { + for (smine_start = 0; smine_start < dset_info->nelmts; smine_start += smine_nelmts) { size_t n; /* Elements operated on */ - /* Go figure out how many elements to read from the file */ - HDassert(H5S_SELECT_ITER_NELMTS(file_iter) == (nelmts - smine_start)); - smine_nelmts = (size_t)MIN(type_info->request_nelmts, (nelmts - smine_start)); + assert(H5S_SELECT_ITER_NELMTS(file_iter) == (dset_info->nelmts - smine_start)); + + /* Determine strip mine size. First check if we're doing in-place type conversion */ + if (in_place_tconv) { + /* If this is not a selection I/O operation and there is a background buffer, we cannot exceed + * request_nelmts. It could be part of a selection I/O operation if this read is used to fill in + * a nonexistent chunk */ + assert(!H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, in_place_tconv)); + if (dset_info->type_info.need_bkg && (io_info->use_select_io != H5D_SELECTION_IO_MODE_ON)) + smine_nelmts = + (size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start)); + else { + assert(smine_start == 0); + smine_nelmts = dset_info->nelmts; + } + + /* Calculate buffer position in user buffer */ + tmp_buf = (uint8_t *)buf + dset_info->layout_io_info.contig_piece_info->buf_off + + (smine_start * dset_info->type_info.dst_type_size); + } + else { + /* Do type conversion using intermediate buffer */ + tmp_buf = io_info->tconv_buf; + + /* Go figure out how many elements to read from the file */ + smine_nelmts = + (size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start)); + } /* * Gather the data from disk into the datatype conversion @@ -497,66 +537,71 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf * if necessary. */ + /* Fill background buffer here unless we will use H5D__compound_opt_read(). Must do this before + * the read so the read buffer doesn't get wiped out if we're using in-place type conversion */ + if ((H5T_BKG_YES == dset_info->type_info.need_bkg) && + !H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, in_place_tconv)) { + n = H5D__gather_mem(buf, bkg_iter, smine_nelmts, io_info->bkg_buf /*out*/); + if (n != smine_nelmts) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed"); + } + /* * Gather data */ - n = H5D__gather_file(io_info, file_iter, smine_nelmts, type_info->tconv_buf /*out*/); + n = H5D__gather_file(io_info, dset_info, file_iter, smine_nelmts, tmp_buf /*out*/); if (n != smine_nelmts) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed"); /* If the source and destination are compound types and subset of each other * and no conversion is needed, copy the data directly into user's buffer and * bypass the rest of steps. */ - if (type_info->cmpd_subset && H5T_SUBSET_FALSE != type_info->cmpd_subset->subset) { - if (H5D__compound_opt_read(smine_nelmts, mem_iter, type_info, buf /*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed") + if (H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, in_place_tconv)) { + if (H5D__compound_opt_read(smine_nelmts, mem_iter, &dset_info->type_info, tmp_buf, buf /*out*/) < + 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed"); } /* end if */ else { - if (H5T_BKG_YES == type_info->need_bkg) { - n = H5D__gather_mem(buf, bkg_iter, smine_nelmts, type_info->bkg_buf /*out*/); - if (n != smine_nelmts) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed") - } /* end if */ - /* * Perform datatype conversion. */ - if (H5T_convert(type_info->tpath, type_info->src_type_id, type_info->dst_type_id, smine_nelmts, - (size_t)0, (size_t)0, type_info->tconv_buf, type_info->bkg_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") + if (H5T_convert(dset_info->type_info.tpath, dset_info->type_info.src_type_id, + dset_info->type_info.dst_type_id, smine_nelmts, (size_t)0, (size_t)0, tmp_buf, + io_info->bkg_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); /* Do the data transform after the conversion (since we're using type mem_type) */ - if (!type_info->is_xform_noop) { + if (!dset_info->type_info.is_xform_noop) { H5Z_data_xform_t *data_transform; /* Data transform info */ /* Retrieve info from API context */ if (H5CX_get_data_transform(&data_transform) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info"); - if (H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < - 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform") + if (H5Z_xform_eval(data_transform, tmp_buf, smine_nelmts, dset_info->type_info.mem_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform"); } - /* Scatter the data into memory */ - if (H5D__scatter_mem(type_info->tconv_buf, mem_iter, smine_nelmts, buf /*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed") + /* Scatter the data into memory if this was not an in-place conversion */ + if (!in_place_tconv) + if (H5D__scatter_mem(tmp_buf, mem_iter, smine_nelmts, buf /*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed"); } /* end else */ } /* end for */ done: /* Release selection iterators */ if (file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); if (file_iter) file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter); if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); if (mem_iter) mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter); if (bkg_iter_init && H5S_SELECT_ITER_RELEASE(bkg_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); if (bkg_iter) bkg_iter = H5FL_FREE(H5S_sel_iter_t, bkg_iter); @@ -570,17 +615,14 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 6, 2008 - * *------------------------------------------------------------------------- */ herr_t -H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space) +H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info) { - const void *buf = io_info->u.wbuf; /* Local pointer to application buffer */ - H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/ + const void *buf; /* Local pointer to application buffer */ + void *tmp_buf; /* Buffer to use for type conversion */ + H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info*/ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */ H5S_sel_iter_t *bkg_iter = NULL; /* Background iteration info*/ hbool_t bkg_iter_init = FALSE; /* Background iteration info has been initialized */ @@ -588,124 +630,706 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in hbool_t file_iter_init = FALSE; /* File selection iteration info has been initialized */ hsize_t smine_start; /* Strip mine start loc */ size_t smine_nelmts; /* Elements per strip */ + hbool_t in_place_tconv; /* Whether to perform in-place type_conversion */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(type_info); - HDassert(mem_space); - HDassert(file_space); - HDassert(buf); + assert(io_info); + assert(dset_info); + assert(dset_info->mem_space); + assert(dset_info->file_space); + assert(dset_info->buf.cvp); + + /* Set buf pointer */ + buf = dset_info->buf.cvp; /* Check for NOOP write */ - if (nelmts == 0) - HGOTO_DONE(SUCCEED) + if (dset_info->nelmts == 0) + HGOTO_DONE(SUCCEED); + + /* Check for in-place type conversion */ + in_place_tconv = dset_info->layout_io_info.contig_piece_info && + dset_info->layout_io_info.contig_piece_info->in_place_tconv; /* Allocate the iterators */ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator"); if (NULL == (bkg_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate background iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate background iterator"); if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator"); /* Figure out the strip mine size. */ - if (H5S_select_iter_init(file_iter, file_space, type_info->dst_type_size, + if (H5S_select_iter_init(file_iter, dset_info->file_space, dset_info->type_info.dst_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file selection information"); file_iter_init = TRUE; /*file selection iteration info has been initialized */ - if (H5S_select_iter_init(mem_iter, mem_space, type_info->src_type_size, 0) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information") + if (H5S_select_iter_init(mem_iter, dset_info->mem_space, dset_info->type_info.src_type_size, 0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize memory selection information"); mem_iter_init = TRUE; /*file selection iteration info has been initialized */ - if (H5S_select_iter_init(bkg_iter, file_space, type_info->dst_type_size, + if (H5S_select_iter_init(bkg_iter, dset_info->file_space, dset_info->type_info.dst_type_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize background selection information"); bkg_iter_init = TRUE; /*file selection iteration info has been initialized */ /* Start strip mining... */ - for (smine_start = 0; smine_start < nelmts; smine_start += smine_nelmts) { + for (smine_start = 0; smine_start < dset_info->nelmts; smine_start += smine_nelmts) { size_t n; /* Elements operated on */ - /* Go figure out how many elements to read from the file */ - HDassert(H5S_SELECT_ITER_NELMTS(file_iter) == (nelmts - smine_start)); - smine_nelmts = (size_t)MIN(type_info->request_nelmts, (nelmts - smine_start)); + assert(H5S_SELECT_ITER_NELMTS(file_iter) == (dset_info->nelmts - smine_start)); + + /* Determine strip mine size. First check if we're doing in-place type conversion */ + if (in_place_tconv) { + /* If this is not a selection I/O operation and there is a background buffer, we cannot exceed + * request_nelmts. It could be part of a selection I/O operation if this is used to write the + * fill value to a cached chunk that will immediately be evicted. */ + assert(!H5D__SCATGATH_USE_CMPD_OPT_WRITE(dset_info, in_place_tconv)); + if (dset_info->type_info.need_bkg && (io_info->use_select_io != H5D_SELECTION_IO_MODE_ON)) + smine_nelmts = + (size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start)); + else { + assert(smine_start == 0); + smine_nelmts = dset_info->nelmts; + } - /* - * Gather data from application buffer into the datatype conversion - * buffer. Also gather data from the file into the background buffer - * if necessary. - */ - n = H5D__gather_mem(buf, mem_iter, smine_nelmts, type_info->tconv_buf /*out*/); - if (n != smine_nelmts) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed") + /* Calculate buffer position in user buffer */ + /* Use "vp" field of union to twiddle away const. OK because if we're doing this it means the + * user explicitly allowed us to modify this buffer via H5Pset_modify_write_buf(). */ + tmp_buf = (uint8_t *)dset_info->buf.vp + dset_info->layout_io_info.contig_piece_info->buf_off + + (smine_start * dset_info->type_info.dst_type_size); + } + else { + /* Do type conversion using intermediate buffer */ + tmp_buf = io_info->tconv_buf; + + /* Go figure out how many elements to read from the file */ + smine_nelmts = + (size_t)MIN(dset_info->type_info.request_nelmts, (dset_info->nelmts - smine_start)); + + /* + * Gather data from application buffer into the datatype conversion + * buffer. Also gather data from the file into the background buffer + * if necessary. + */ + n = H5D__gather_mem(buf, mem_iter, smine_nelmts, tmp_buf /*out*/); + if (n != smine_nelmts) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed"); + } /* If the source and destination are compound types and the destination is * is a subset of the source and no conversion is needed, copy the data - * directly into user's buffer and bypass the rest of steps. If the source + * directly from user's buffer and bypass the rest of steps. If the source * is a subset of the destination, the optimization is done in conversion * function H5T_conv_struct_opt to protect the background data. */ - if (type_info->cmpd_subset && H5T_SUBSET_DST == type_info->cmpd_subset->subset && - type_info->dst_type_size == type_info->cmpd_subset->copy_size) { - if (H5D__compound_opt_write(smine_nelmts, type_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed") + if (H5D__SCATGATH_USE_CMPD_OPT_WRITE(dset_info, in_place_tconv)) { + if (H5D__compound_opt_write(smine_nelmts, &dset_info->type_info, tmp_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed"); + } /* end if */ else { - if (H5T_BKG_YES == type_info->need_bkg) { - n = H5D__gather_file(io_info, bkg_iter, smine_nelmts, type_info->bkg_buf /*out*/); + if (H5T_BKG_YES == dset_info->type_info.need_bkg) { + n = H5D__gather_file(io_info, dset_info, bkg_iter, smine_nelmts, io_info->bkg_buf /*out*/); if (n != smine_nelmts) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file gather failed"); } /* end if */ /* Do the data transform before the type conversion (since * transforms must be done in the memory type). */ - if (!type_info->is_xform_noop) { + if (!dset_info->type_info.is_xform_noop) { H5Z_data_xform_t *data_transform; /* Data transform info */ /* Retrieve info from API context */ if (H5CX_get_data_transform(&data_transform) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info"); - if (H5Z_xform_eval(data_transform, type_info->tconv_buf, smine_nelmts, type_info->mem_type) < - 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform") + if (H5Z_xform_eval(data_transform, tmp_buf, smine_nelmts, dset_info->type_info.mem_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform"); } /* * Perform datatype conversion. */ - if (H5T_convert(type_info->tpath, type_info->src_type_id, type_info->dst_type_id, smine_nelmts, - (size_t)0, (size_t)0, type_info->tconv_buf, type_info->bkg_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") + if (H5T_convert(dset_info->type_info.tpath, dset_info->type_info.src_type_id, + dset_info->type_info.dst_type_id, smine_nelmts, (size_t)0, (size_t)0, tmp_buf, + io_info->bkg_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); } /* end else */ /* * Scatter the data out to the file. */ - if (H5D__scatter_file(io_info, file_iter, smine_nelmts, type_info->tconv_buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed") + if (H5D__scatter_file(io_info, dset_info, file_iter, smine_nelmts, tmp_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "scatter failed"); } /* end for */ done: /* Release selection iterators */ if (file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); if (file_iter) file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter); if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); if (mem_iter) mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter); if (bkg_iter_init && H5S_SELECT_ITER_RELEASE(bkg_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); if (bkg_iter) bkg_iter = H5FL_FREE(H5S_sel_iter_t, bkg_iter); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__scatgath_write() */ +/*------------------------------------------------------------------------- + * Function: H5D__scatgath_read_select + * + * Purpose: Perform scatter/gather read from a list of dataset pieces + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__scatgath_read_select(H5D_io_info_t *io_info) +{ + H5S_t **tmp_mem_spaces = NULL; /* Memory spaces to use for read from disk */ + H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */ + hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */ + void **tmp_bufs = NULL; /* Buffers to use for read from disk */ + void *tmp_bkg_buf = NULL; /* Temporary background buffer pointer */ + size_t tconv_bytes_used = 0; /* Number of bytes used so far in conversion buffer */ + size_t bkg_bytes_used = 0; /* Number of bytes used so far in background buffer */ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + assert(io_info); + assert(io_info->count > 0); + assert(io_info->mem_spaces || io_info->pieces_added == 0); + assert(io_info->file_spaces || io_info->pieces_added == 0); + assert(io_info->addrs || io_info->pieces_added == 0); + assert(io_info->element_sizes || io_info->pieces_added == 0); + assert(io_info->rbufs || io_info->pieces_added == 0); + + /* Allocate list of buffers (within the tconv buf) */ + if (NULL == (tmp_bufs = H5MM_malloc(io_info->pieces_added * sizeof(void *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary buffer list"); + + /* Allocate the iterator */ + if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator"); + + /* Allocate list of block memory spaces */ + /*!FIXME delay doing this until we find the first mem space that is non-contiguous or doesn't start at 0 + */ + if (NULL == (tmp_mem_spaces = H5MM_malloc(io_info->pieces_added * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for temporary memory space list"); + + /* Build read operation to tconv buffer */ + for (i = 0; i < io_info->pieces_added; i++) { + H5D_dset_io_info_t *dset_info = io_info->sel_pieces[i]->dset_info; + + assert(io_info->sel_pieces[i]->piece_points > 0); + + /* Check if this piece is involved in type conversion */ + if (dset_info->type_info.is_xform_noop && dset_info->type_info.is_conv_noop) { + /* No type conversion, just copy the mem space and buffer */ + tmp_mem_spaces[i] = io_info->mem_spaces[i]; + tmp_bufs[i] = io_info->rbufs[i]; + } + else { + /* Create block memory space */ + if (NULL == + (tmp_mem_spaces[i] = H5S_create_simple(1, &io_info->sel_pieces[i]->piece_points, NULL))) { + memset(&tmp_mem_spaces[i], 0, (io_info->pieces_added - i) * sizeof(tmp_mem_spaces[0])); + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create simple memory dataspace"); + } + + /* Check for in-place type conversion */ + if (io_info->sel_pieces[i]->in_place_tconv) + /* Set buffer to point to read buffer + offset */ + tmp_bufs[i] = (uint8_t *)(io_info->rbufs[i]) + io_info->sel_pieces[i]->buf_off; + else { + /* Set buffer to point into type conversion buffer */ + tmp_bufs[i] = io_info->tconv_buf + tconv_bytes_used; + tconv_bytes_used += + io_info->sel_pieces[i]->piece_points * + MAX(dset_info->type_info.src_type_size, dset_info->type_info.dst_type_size); + assert(tconv_bytes_used <= io_info->tconv_buf_size); + } + + /* Fill background buffer here unless we will use H5D__compound_opt_read(). Must do this before + * the read so the read buffer doesn't get wiped out if we're using in-place type conversion */ + if (!H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, io_info->sel_pieces[i]->in_place_tconv)) { + /* Check for background buffer */ + if (dset_info->type_info.need_bkg) { + assert(io_info->bkg_buf); + + /* Calculate background buffer position */ + tmp_bkg_buf = io_info->bkg_buf + bkg_bytes_used; + bkg_bytes_used += + io_info->sel_pieces[i]->piece_points * dset_info->type_info.dst_type_size; + assert(bkg_bytes_used <= io_info->bkg_buf_size); + + /* Gather data from read buffer to background buffer if necessary */ + if (H5T_BKG_YES == dset_info->type_info.need_bkg) { + /* Initialize memory iterator */ + assert(!mem_iter_init); + if (H5S_select_iter_init(mem_iter, io_info->mem_spaces[i], + dset_info->type_info.dst_type_size, 0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to initialize memory selection information"); + mem_iter_init = TRUE; /* Memory selection iteration info has been initialized */ + + if ((size_t)io_info->sel_pieces[i]->piece_points != + H5D__gather_mem(io_info->rbufs[i], mem_iter, + (size_t)io_info->sel_pieces[i]->piece_points, + tmp_bkg_buf /*out*/)) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "mem gather failed"); + + /* Reset selection iterator */ + assert(mem_iter_init); + if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); + mem_iter_init = FALSE; + } + } + } + } + } + + /* Read data from all pieces */ + H5_CHECK_OVERFLOW(io_info->pieces_added, size_t, uint32_t); + if (H5F_shared_select_read(io_info->f_sh, H5FD_MEM_DRAW, (uint32_t)io_info->pieces_added, tmp_mem_spaces, + io_info->file_spaces, io_info->addrs, io_info->element_sizes, tmp_bufs) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "selection read failed"); + + /* Reset bkg_bytes_used */ + bkg_bytes_used = 0; + + /* Perform type conversion and scatter data to memory buffers for datasets that need this */ + for (i = 0; i < io_info->pieces_added; i++) { + H5D_dset_io_info_t *dset_info = io_info->sel_pieces[i]->dset_info; + + assert(tmp_mem_spaces[i]); + + /* Check if this piece is involved in type conversion */ + if (tmp_mem_spaces[i] != io_info->mem_spaces[i]) { + H5_CHECK_OVERFLOW(io_info->sel_pieces[i]->piece_points, hsize_t, size_t); + + /* Initialize memory iterator */ + assert(!mem_iter_init); + if (H5S_select_iter_init(mem_iter, io_info->mem_spaces[i], dset_info->type_info.dst_type_size, + 0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to initialize memory selection information"); + mem_iter_init = TRUE; /* Memory selection iteration info has been initialized */ + + /* If the source and destination are compound types and subset of each other + * and no conversion is needed, copy the data directly into user's buffer and + * bypass the rest of steps. + */ + if (H5D__SCATGATH_USE_CMPD_OPT_READ(dset_info, io_info->sel_pieces[i]->in_place_tconv)) { + if (H5D__compound_opt_read((size_t)io_info->sel_pieces[i]->piece_points, mem_iter, + &dset_info->type_info, tmp_bufs[i], io_info->rbufs[i] /*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed"); + } + else { + /* Check for background buffer */ + if (dset_info->type_info.need_bkg) { + assert(io_info->bkg_buf); + + /* Calculate background buffer position */ + tmp_bkg_buf = io_info->bkg_buf + bkg_bytes_used; + bkg_bytes_used += + io_info->sel_pieces[i]->piece_points * dset_info->type_info.dst_type_size; + assert(bkg_bytes_used <= io_info->bkg_buf_size); + } + + /* + * Perform datatype conversion. + */ + if (H5T_convert(dset_info->type_info.tpath, dset_info->type_info.src_type_id, + dset_info->type_info.dst_type_id, + (size_t)io_info->sel_pieces[i]->piece_points, (size_t)0, (size_t)0, + tmp_bufs[i], tmp_bkg_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); + + /* Do the data transform after the conversion (since we're using type mem_type) */ + if (!dset_info->type_info.is_xform_noop) { + H5Z_data_xform_t *data_transform; /* Data transform info */ + + /* Retrieve info from API context */ + if (H5CX_get_data_transform(&data_transform) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info"); + + if (H5Z_xform_eval(data_transform, tmp_bufs[i], + (size_t)io_info->sel_pieces[i]->piece_points, + dset_info->type_info.mem_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform"); + } + + /* Scatter the data into memory if this was not an in-place conversion */ + if (!io_info->sel_pieces[i]->in_place_tconv) + if (H5D__scatter_mem(tmp_bufs[i], mem_iter, (size_t)io_info->sel_pieces[i]->piece_points, + io_info->rbufs[i] /*out*/) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "scatter failed"); + } + + /* Release selection iterator */ + assert(mem_iter_init); + if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); + mem_iter_init = FALSE; + } + } + +done: + /* Release and free selection iterator */ + if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); + if (mem_iter) + mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter); + + /* Free tmp_bufs */ + H5MM_free(tmp_bufs); + tmp_bufs = NULL; + + /* Clear and free tmp_mem_spaces */ + if (tmp_mem_spaces) { + for (i = 0; i < io_info->pieces_added; i++) + if (tmp_mem_spaces[i] != io_info->mem_spaces[i] && tmp_mem_spaces[i] && + H5S_close(tmp_mem_spaces[i]) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "Can't close dataspace"); + H5MM_free(tmp_mem_spaces); + tmp_mem_spaces = NULL; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__scatgath_read_select() */ + +/*------------------------------------------------------------------------- + * Function: H5D__scatgath_write_select + * + * Purpose: Perform scatter/gather write to a list of dataset pieces. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__scatgath_write_select(H5D_io_info_t *io_info) +{ + H5S_t **write_mem_spaces = NULL; /* Memory spaces to use for write to disk */ + size_t spaces_added = 0; /* Number of spaces added to write_mem_spaces */ + H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */ + hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */ + const void **write_bufs = NULL; /* Buffers to use for write to disk */ + size_t tconv_bytes_used = 0; /* Number of bytes used so far in conversion buffer */ + size_t bkg_bytes_used = 0; /* Number of bytes used so far in background buffer */ + H5S_t **bkg_mem_spaces = NULL; /* Array of memory spaces for read to background buffer */ + H5S_t **bkg_file_spaces = NULL; /* Array of file spaces for read to background buffer */ + haddr_t *bkg_addrs = NULL; /* Array of file addresses for read to background buffer */ + size_t *bkg_element_sizes = NULL; /* Array of element sizes for read to background buffer */ + void **bkg_bufs = NULL; /* Array background buffers for read of existing file contents */ + size_t bkg_pieces = 0; /* Number of pieces that need to read the background data from disk */ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + assert(io_info); + assert(io_info->count > 0); + assert(io_info->mem_spaces || io_info->pieces_added == 0); + assert(io_info->file_spaces || io_info->pieces_added == 0); + assert(io_info->addrs || io_info->pieces_added == 0); + assert(io_info->element_sizes || io_info->pieces_added == 0); + assert(io_info->wbufs || io_info->pieces_added == 0); + + /* Allocate list of buffers (within the tconv buf) */ + if (NULL == (write_bufs = (const void **)H5MM_malloc(io_info->pieces_added * sizeof(const void *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary buffer list"); + + /* Allocate the iterator */ + if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator"); + + /* Allocate list of block memory spaces */ + /*!FIXME delay doing this until we find the first mem space that is non-contiguous or doesn't start at 0 + */ + if (NULL == (write_mem_spaces = H5MM_malloc(io_info->pieces_added * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for temporary memory space list"); + + /* Build operations to read data to background buffer and to write data */ + for (i = 0; i < io_info->pieces_added; i++) { + H5D_dset_io_info_t *dset_info = io_info->sel_pieces[i]->dset_info; + + assert(io_info->sel_pieces[i]->piece_points > 0); + + /* Check if this piece is involved in type conversion */ + if (dset_info->type_info.is_xform_noop && dset_info->type_info.is_conv_noop) { + /* No type conversion, just copy the mem space and buffer */ + write_mem_spaces[i] = io_info->mem_spaces[i]; + spaces_added++; + write_bufs[i] = io_info->wbufs[i]; + } + else { + void *tmp_write_buf; /* To sidestep const warnings */ + void *tmp_bkg_buf = NULL; + + H5_CHECK_OVERFLOW(io_info->sel_pieces[i]->piece_points, hsize_t, size_t); + + /* Initialize memory iterator */ + assert(!mem_iter_init); + if (H5S_select_iter_init(mem_iter, io_info->mem_spaces[i], dset_info->type_info.src_type_size, + 0) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to initialize memory selection information"); + mem_iter_init = TRUE; /* Memory selection iteration info has been initialized */ + + /* Create block memory space */ + if (NULL == + (write_mem_spaces[i] = H5S_create_simple(1, &io_info->sel_pieces[i]->piece_points, NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create simple memory dataspace"); + spaces_added++; + + /* Check for in-place type conversion */ + if (io_info->sel_pieces[i]->in_place_tconv) { + H5_flexible_const_ptr_t flex_buf; + + /* Set buffer to point to write buffer + offset */ + /* Use cast to union to twiddle away const. OK because if we're doing this it means the user + * explicitly allowed us to modify this buffer via H5Pset_modify_write_buf(). */ + flex_buf.cvp = io_info->wbufs[i]; + tmp_write_buf = (uint8_t *)flex_buf.vp + io_info->sel_pieces[i]->buf_off; + } + else { + /* Set buffer to point into type conversion buffer */ + tmp_write_buf = io_info->tconv_buf + tconv_bytes_used; + tconv_bytes_used += + io_info->sel_pieces[i]->piece_points * + MAX(dset_info->type_info.src_type_size, dset_info->type_info.dst_type_size); + assert(tconv_bytes_used <= io_info->tconv_buf_size); + + /* Gather data from application buffer into the datatype conversion buffer */ + if ((size_t)io_info->sel_pieces[i]->piece_points != + H5D__gather_mem(io_info->wbufs[i], mem_iter, (size_t)io_info->sel_pieces[i]->piece_points, + tmp_write_buf /*out*/)) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "mem gather failed"); + } + + /* Set buffer for writing to disk (from type conversion buffer) */ + write_bufs[i] = (const void *)tmp_write_buf; + + /* If the source and destination are compound types and the destination is a subset of + * the source and no conversion is needed, copy the data directly into the type + * conversion buffer and bypass the rest of steps. If the source is a subset of the + * destination, the optimization is done in conversion function H5T_conv_struct_opt to + * protect the background data. + */ + if (H5D__SCATGATH_USE_CMPD_OPT_WRITE(dset_info, io_info->sel_pieces[i]->in_place_tconv)) { + if (H5D__compound_opt_write((size_t)io_info->sel_pieces[i]->piece_points, + &dset_info->type_info, tmp_write_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "datatype conversion failed"); + + } /* end if */ + else { + /* Check for background buffer */ + if (dset_info->type_info.need_bkg) { + assert(io_info->bkg_buf); + + /* Calculate background buffer position */ + tmp_bkg_buf = io_info->bkg_buf + bkg_bytes_used; + bkg_bytes_used += + io_info->sel_pieces[i]->piece_points * dset_info->type_info.dst_type_size; + assert(bkg_bytes_used <= io_info->bkg_buf_size); + } + + /* Set up background buffer read operation if necessary */ + if (H5T_BKG_YES == dset_info->type_info.need_bkg) { + assert(io_info->must_fill_bkg); + + /* Allocate arrays of parameters for selection read to background buffer if necessary */ + if (!bkg_mem_spaces) { + assert(!bkg_file_spaces && !bkg_addrs && !bkg_element_sizes && !bkg_bufs); + if (NULL == (bkg_mem_spaces = H5MM_malloc(io_info->pieces_added * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for memory space list"); + if (NULL == (bkg_file_spaces = H5MM_malloc(io_info->pieces_added * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for file space list"); + if (NULL == (bkg_addrs = H5MM_malloc(io_info->pieces_added * sizeof(haddr_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for piece address list"); + if (NULL == (bkg_element_sizes = H5MM_malloc(io_info->pieces_added * sizeof(size_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for element size list"); + if (NULL == (bkg_bufs = H5MM_malloc(io_info->pieces_added * sizeof(const void *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for write buffer list"); + } + + /* Use same (block) memory space, file space, address, and element size as write operation + */ + assert(bkg_mem_spaces && bkg_file_spaces && bkg_addrs && bkg_element_sizes && bkg_bufs); + bkg_mem_spaces[bkg_pieces] = write_mem_spaces[i]; + bkg_file_spaces[bkg_pieces] = io_info->file_spaces[i]; + bkg_addrs[bkg_pieces] = io_info->addrs[i]; + bkg_element_sizes[bkg_pieces] = io_info->element_sizes[i]; + + /* Use previously calculated background buffer position */ + bkg_bufs[bkg_pieces] = tmp_bkg_buf; + + /* Add piece */ + bkg_pieces++; + } + else { + /* Perform type conversion here to avoid second loop if no dsets use the background buffer + */ + /* Do the data transform before the type conversion (since + * transforms must be done in the memory type). */ + if (!dset_info->type_info.is_xform_noop) { + H5Z_data_xform_t *data_transform; /* Data transform info */ + + /* Retrieve info from API context */ + if (H5CX_get_data_transform(&data_transform) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info"); + + if (H5Z_xform_eval(data_transform, tmp_write_buf, + (size_t)io_info->sel_pieces[i]->piece_points, + dset_info->type_info.mem_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform"); + } + + /* + * Perform datatype conversion. + */ + if (H5T_convert(dset_info->type_info.tpath, dset_info->type_info.src_type_id, + dset_info->type_info.dst_type_id, + (size_t)io_info->sel_pieces[i]->piece_points, (size_t)0, (size_t)0, + tmp_write_buf, tmp_bkg_buf) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); + } + } + + /* Release selection iterator */ + assert(mem_iter_init); + if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); + mem_iter_init = FALSE; + } + } + + assert(spaces_added == io_info->pieces_added); + + /* Gather data to background buffer if necessary */ + if (io_info->must_fill_bkg) { + size_t j = 0; /* Index into array of background buffers */ + + /* Read data */ + H5_CHECK_OVERFLOW(bkg_pieces, size_t, uint32_t); + if (H5F_shared_select_read(io_info->f_sh, H5FD_MEM_DRAW, (uint32_t)bkg_pieces, bkg_mem_spaces, + bkg_file_spaces, bkg_addrs, bkg_element_sizes, bkg_bufs) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "selection read to background buffer failed"); + + /* Perform type conversion on pieces with background buffers that were just read */ + for (i = 0; i < io_info->pieces_added; i++) { + H5D_dset_io_info_t *dset_info = io_info->sel_pieces[i]->dset_info; + + if ((H5T_BKG_YES == dset_info->type_info.need_bkg) && + !H5D__SCATGATH_USE_CMPD_OPT_WRITE(dset_info, io_info->sel_pieces[i]->in_place_tconv)) { + /* Non-const write_buf[i]. Use pointer math here to avoid const warnings. When + * there's a background buffer write_buf[i] always points inside the non-const tconv + * buf so this is OK. */ + void *tmp_write_buf = + (void *)((uint8_t *)io_info->tconv_buf + + ((const uint8_t *)write_bufs[i] - (const uint8_t *)io_info->tconv_buf)); + + /* Do the data transform before the type conversion (since + * transforms must be done in the memory type). */ + if (!dset_info->type_info.is_xform_noop) { + H5Z_data_xform_t *data_transform; /* Data transform info */ + + /* Retrieve info from API context */ + if (H5CX_get_data_transform(&data_transform) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get data transform info"); + + if (H5Z_xform_eval(data_transform, tmp_write_buf, + (size_t)io_info->sel_pieces[i]->piece_points, + dset_info->type_info.mem_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Error performing data transform"); + } + + /* + * Perform datatype conversion. + */ + assert(j < bkg_pieces); + if (H5T_convert(dset_info->type_info.tpath, dset_info->type_info.src_type_id, + dset_info->type_info.dst_type_id, + (size_t)io_info->sel_pieces[i]->piece_points, (size_t)0, (size_t)0, + tmp_write_buf, bkg_bufs[j]) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); + + /* Advance to next background buffer */ + j++; + } + } + + assert(j == bkg_pieces); + } + + /* Write data to disk */ + H5_CHECK_OVERFLOW(io_info->pieces_added, size_t, uint32_t); + if (H5F_shared_select_write(io_info->f_sh, H5FD_MEM_DRAW, (uint32_t)io_info->pieces_added, + write_mem_spaces, io_info->file_spaces, io_info->addrs, + io_info->element_sizes, write_bufs) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "selection write failed"); + +done: + /* Release and free selection iterator */ + if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); + if (mem_iter) + mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter); + + /* Free write_bufs */ + H5MM_free(write_bufs); + write_bufs = NULL; + + /* Clear and free write_mem_spaces */ + if (write_mem_spaces) { + for (i = 0; i < spaces_added; i++) { + assert(write_mem_spaces[i]); + if (write_mem_spaces[i] != io_info->mem_spaces[i] && H5S_close(write_mem_spaces[i]) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "Can't close dataspace"); + } + H5MM_free(write_mem_spaces); + write_mem_spaces = NULL; + } + + /* Free bakcground buffer parameter arrays */ + H5MM_free(bkg_mem_spaces); + bkg_mem_spaces = NULL; + H5MM_free(bkg_file_spaces); + bkg_file_spaces = NULL; + H5MM_free(bkg_addrs); + bkg_addrs = NULL; + H5MM_free(bkg_element_sizes); + bkg_element_sizes = NULL; + H5MM_free(bkg_bufs); + bkg_bufs = NULL; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__scatgath_write_select() */ + /*------------------------------------------------------------------------- * Function: H5D__compound_opt_read * @@ -733,14 +1357,11 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * 11 June 2007 - * *------------------------------------------------------------------------- */ static herr_t H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_t *type_info, - void *user_buf /*out*/) + uint8_t *tconv_buf, void *user_buf /*out*/) { uint8_t *ubuf = (uint8_t *)user_buf; /* Cast for pointer arithmetic */ uint8_t *xdbuf; /* Pointer into dataset buffer */ @@ -754,17 +1375,17 @@ H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(nelmts > 0); - HDassert(iter); - HDassert(type_info); - HDassert(type_info->cmpd_subset); - HDassert(H5T_SUBSET_SRC == type_info->cmpd_subset->subset || - H5T_SUBSET_DST == type_info->cmpd_subset->subset); - HDassert(user_buf); + assert(nelmts > 0); + assert(iter); + assert(type_info); + assert(type_info->cmpd_subset); + assert(H5T_SUBSET_SRC == type_info->cmpd_subset->subset || + H5T_SUBSET_DST == type_info->cmpd_subset->subset); + assert(user_buf); /* Get info from API context */ if (H5CX_get_vec_size(&dxpl_vec_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size"); /* Allocate the vector I/O arrays */ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE) @@ -772,9 +1393,9 @@ H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_ else vec_size = H5D_IO_VECTOR_SIZE; if (NULL == (len = H5FL_SEQ_MALLOC(size_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array"); if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array"); /* Get source & destination strides */ src_stride = type_info->src_type_size; @@ -784,7 +1405,7 @@ H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_ copy_size = type_info->cmpd_subset->copy_size; /* Loop until all elements are written */ - xdbuf = type_info->tconv_buf; + xdbuf = tconv_buf; while (nelmts > 0) { size_t nseq; /* Number of sequences generated */ size_t curr_seq; /* Current sequence being processed */ @@ -792,7 +1413,7 @@ H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_ /* Get list of sequences for selection to write */ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, vec_size, nelmts, &nseq, &elmtno, off, len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, 0, "sequence length generation failed"); /* Loop, while sequences left to process */ for (curr_seq = 0; curr_seq < nseq; curr_seq++) { @@ -813,7 +1434,7 @@ H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_ /* Copy the data into the right place. */ for (i = 0; i < curr_nelmts; i++) { - HDmemmove(xubuf, xdbuf, copy_size); + memmove(xubuf, xdbuf, copy_size); /* Update pointers */ xdbuf += src_stride; @@ -863,13 +1484,10 @@ H5D__compound_opt_read(size_t nelmts, H5S_sel_iter_t *iter, const H5D_type_info_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * 11 June 2007 - * *------------------------------------------------------------------------- */ static herr_t -H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info) +H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info, void *tconv_buf) { uint8_t *xsbuf, *xdbuf; /* Source & destination pointers into dataset buffer */ size_t src_stride, dst_stride; /* Strides through source & destination datatypes */ @@ -878,18 +1496,18 @@ H5D__compound_opt_write(size_t nelmts, const H5D_type_info_t *type_info) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(nelmts > 0); - HDassert(type_info); + assert(nelmts > 0); + assert(type_info); /* Initialize values for loop */ src_stride = type_info->src_type_size; dst_stride = type_info->dst_type_size; /* Loop until all elements are written */ - xsbuf = (uint8_t *)type_info->tconv_buf; - xdbuf = (uint8_t *)type_info->tconv_buf; + xsbuf = tconv_buf; + xdbuf = tconv_buf; for (i = 0; i < nelmts; i++) { - HDmemmove(xdbuf, xsbuf, dst_stride); + memmove(xdbuf, xsbuf, dst_stride); /* Update pointers */ xsbuf += src_stride; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dselect.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dselect.c index b16dd5a7d5..06bb6968fd 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dselect.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dselect.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Thursday, September 30, 2004 - * +/* * Purpose: Dataspace I/O functions. */ @@ -26,11 +23,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5VMprivate.h" /* Vector Functions */ /****************/ /* Local Macros */ @@ -44,8 +42,8 @@ /* Local Prototypes */ /********************/ -static herr_t H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5S_t *file_space, - H5S_t *mem_space); +static herr_t H5D__select_io(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, + size_t elmt_size); /*********************/ /* Package Variables */ @@ -71,14 +69,10 @@ H5FL_EXTERN(H5S_sel_iter_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 27, 2007 - * *------------------------------------------------------------------------- */ static herr_t -H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5S_t *file_space, - H5S_t *mem_space) +H5D__select_io(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info, size_t elmt_size) { H5S_sel_iter_t *mem_iter = NULL; /* Memory selection iteration info */ hbool_t mem_iter_init = FALSE; /* Memory selection iteration info has been initialized */ @@ -95,18 +89,22 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5 size_t dxpl_vec_size; /* Vector length from API context's DXPL */ size_t vec_size; /* Vector length */ ssize_t tmp_file_len; /* Temporary number of bytes in file sequence */ + size_t nelmts; /* Number of elements to process */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(io_info); - HDassert(io_info->dset); - HDassert(io_info->store); - HDassert(io_info->u.rbuf); + assert(io_info); + assert(dset_info->dset); + assert(dset_info->store); + assert(dset_info->buf.vp); if (elmt_size == 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "invalid elmt_size of 0") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "invalid elmt_size of 0"); + + /* Initialize nelmts */ + nelmts = dset_info->nelmts; /* Check for only one element in selection */ if (nelmts == 1) { @@ -116,10 +114,10 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5 size_t single_file_len; /* Length in the file */ /* Get offset of first element in selections */ - if (H5S_SELECT_OFFSET(file_space, &single_file_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "can't retrieve file selection offset") - if (H5S_SELECT_OFFSET(mem_space, &single_mem_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "can't retrieve memory selection offset") + if (H5S_SELECT_OFFSET(dset_info->file_space, &single_file_off) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "can't retrieve file selection offset"); + if (H5S_SELECT_OFFSET(dset_info->mem_space, &single_mem_off) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "can't retrieve memory selection offset"); /* Set up necessary information for I/O operation */ file_nseq = mem_nseq = 1; @@ -130,21 +128,21 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5 /* Perform I/O on memory and file sequences */ if (io_info->op_type == H5D_IO_OP_READ) { - if ((tmp_file_len = (*io_info->layout_ops.readvv)( - io_info, file_nseq, &curr_file_seq, &single_file_len, &single_file_off, mem_nseq, - &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error") + if ((tmp_file_len = (*dset_info->layout_ops.readvv)( + io_info, dset_info, file_nseq, &curr_file_seq, &single_file_len, &single_file_off, + mem_nseq, &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error"); } /* end if */ else { - HDassert(io_info->op_type == H5D_IO_OP_WRITE); - if ((tmp_file_len = (*io_info->layout_ops.writevv)( - io_info, file_nseq, &curr_file_seq, &single_file_len, &single_file_off, mem_nseq, - &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error") + assert(io_info->op_type == H5D_IO_OP_WRITE); + if ((tmp_file_len = (*dset_info->layout_ops.writevv)( + io_info, dset_info, file_nseq, &curr_file_seq, &single_file_len, &single_file_off, + mem_nseq, &curr_mem_seq, &single_mem_len, &single_mem_off)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error"); } /* end else */ /* Decrement number of elements left to process */ - HDassert(((size_t)tmp_file_len % elmt_size) == 0); + assert(((size_t)tmp_file_len % elmt_size) == 0); } /* end if */ else { size_t mem_nelem; /* Number of elements used in memory sequences */ @@ -152,7 +150,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5 /* Get info from API context */ if (H5CX_get_vec_size(&dxpl_vec_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve I/O vector size"); /* Allocate the vector I/O arrays */ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE) @@ -160,28 +158,29 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5 else vec_size = H5D_IO_VECTOR_SIZE; if (NULL == (mem_len = H5FL_SEQ_MALLOC(size_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array"); if (NULL == (mem_off = H5FL_SEQ_MALLOC(hsize_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array"); if (NULL == (file_len = H5FL_SEQ_MALLOC(size_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array"); if (NULL == (file_off = H5FL_SEQ_MALLOC(hsize_t, vec_size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array"); /* Allocate the iterators */ if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate memory iterator"); if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate file iterator"); /* Initialize file iterator */ - if (H5S_select_iter_init(file_iter, file_space, elmt_size, H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + if (H5S_select_iter_init(file_iter, dset_info->file_space, elmt_size, + H5S_SEL_ITER_GET_SEQ_LIST_SORTED) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); file_iter_init = 1; /* File selection iteration info has been initialized */ /* Initialize memory iterator */ - if (H5S_select_iter_init(mem_iter, mem_space, elmt_size, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + if (H5S_select_iter_init(mem_iter, dset_info->mem_space, elmt_size, 0) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); mem_iter_init = 1; /* Memory selection iteration info has been initialized */ /* Initialize sequence counts */ @@ -195,7 +194,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5 /* Get sequences for file selection */ if (H5S_SELECT_ITER_GET_SEQ_LIST(file_iter, vec_size, nelmts, &file_nseq, &file_nelem, file_off, file_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ curr_file_seq = 0; @@ -206,7 +205,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5 /* Get sequences for memory selection */ if (H5S_SELECT_ITER_GET_SEQ_LIST(mem_iter, vec_size, nelmts, &mem_nseq, &mem_nelem, mem_off, mem_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ curr_mem_seq = 0; @@ -214,21 +213,21 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5 /* Perform I/O on memory and file sequences */ if (io_info->op_type == H5D_IO_OP_READ) { - if ((tmp_file_len = - (*io_info->layout_ops.readvv)(io_info, file_nseq, &curr_file_seq, file_len, file_off, - mem_nseq, &curr_mem_seq, mem_len, mem_off)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error") + if ((tmp_file_len = (*dset_info->layout_ops.readvv)( + io_info, dset_info, file_nseq, &curr_file_seq, file_len, file_off, mem_nseq, + &curr_mem_seq, mem_len, mem_off)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error"); } /* end if */ else { - HDassert(io_info->op_type == H5D_IO_OP_WRITE); - if ((tmp_file_len = (*io_info->layout_ops.writevv)(io_info, file_nseq, &curr_file_seq, - file_len, file_off, mem_nseq, - &curr_mem_seq, mem_len, mem_off)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error") + assert(io_info->op_type == H5D_IO_OP_WRITE); + if ((tmp_file_len = (*dset_info->layout_ops.writevv)( + io_info, dset_info, file_nseq, &curr_file_seq, file_len, file_off, mem_nseq, + &curr_mem_seq, mem_len, mem_off)) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error"); } /* end else */ /* Decrement number of elements left to process */ - HDassert(((size_t)tmp_file_len % elmt_size) == 0); + assert(((size_t)tmp_file_len % elmt_size) == 0); nelmts -= ((size_t)tmp_file_len / elmt_size); } /* end while */ } /* end else */ @@ -236,11 +235,11 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, size_t nelmts, H5 done: /* Release selection iterators */ if (file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); if (file_iter) file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter); if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); if (mem_iter) mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter); @@ -296,13 +295,13 @@ H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *s FUNC_ENTER_NOAPI(FAIL) - HDassert(dst_buf); - HDassert(dst_space); - HDassert(src_buf); - HDassert(src_space); + assert(dst_buf); + assert(dst_space); + assert(src_buf); + assert(src_space); if (elmt_size == 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "invalid elmt_size of 0") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "invalid elmt_size of 0"); /* Check for only one element in selection */ if (nelmts == 1) { @@ -313,9 +312,9 @@ H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *s /* Get offset of first element in selections */ if (H5S_SELECT_OFFSET(dst_space, &single_dst_off) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve destination selection offset") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve destination selection offset"); if (H5S_SELECT_OFFSET(src_space, &single_src_off) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve source selection offset") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve source selection offset"); /* Set up necessary information for I/O operation */ dst_nseq = src_nseq = 1; @@ -328,9 +327,9 @@ H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *s if ((bytes_copied = H5VM_memcpyvv(dst_buf, dst_nseq, &curr_dst_seq, &single_dst_len, &single_dst_off, src_buf, src_nseq, &curr_src_seq, &single_src_len, &single_src_off)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); - HDassert(((size_t)bytes_copied % elmt_size) == 0); + assert(((size_t)bytes_copied % elmt_size) == 0); } else { unsigned sel_iter_flags = H5S_SEL_ITER_GET_SEQ_LIST_SORTED | H5S_SEL_ITER_SHARE_WITH_DATASPACE; @@ -339,7 +338,7 @@ H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *s /* Get info from API context */ if (H5CX_get_vec_size(&dxpl_vec_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "can't retrieve I/O vector size") + HGOTO_ERROR(H5E_IO, H5E_CANTGET, FAIL, "can't retrieve I/O vector size"); /* Allocate the vector I/O arrays */ if (dxpl_vec_size > H5D_IO_VECTOR_SIZE) @@ -348,28 +347,28 @@ H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *s vec_size = H5D_IO_VECTOR_SIZE; if (NULL == (dst_len = H5FL_SEQ_MALLOC(size_t, vec_size))) - HGOTO_ERROR(H5E_IO, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array") + HGOTO_ERROR(H5E_IO, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array"); if (NULL == (dst_off = H5FL_SEQ_MALLOC(hsize_t, vec_size))) - HGOTO_ERROR(H5E_IO, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array") + HGOTO_ERROR(H5E_IO, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array"); if (NULL == (src_len = H5FL_SEQ_MALLOC(size_t, vec_size))) - HGOTO_ERROR(H5E_IO, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array") + HGOTO_ERROR(H5E_IO, H5E_CANTALLOC, FAIL, "can't allocate I/O length vector array"); if (NULL == (src_off = H5FL_SEQ_MALLOC(hsize_t, vec_size))) - HGOTO_ERROR(H5E_IO, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array") + HGOTO_ERROR(H5E_IO, H5E_CANTALLOC, FAIL, "can't allocate I/O offset vector array"); /* Allocate the dataspace selection iterators */ if (NULL == (dst_sel_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate destination selection iterator"); if (NULL == (src_sel_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate source selection iterator"); /* Initialize destination selection iterator */ if (H5S_select_iter_init(dst_sel_iter, dst_space, elmt_size, sel_iter_flags) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); dst_sel_iter_init = TRUE; /* Destination selection iteration info has been initialized */ /* Initialize source selection iterator */ if (H5S_select_iter_init(src_sel_iter, src_space, elmt_size, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); src_sel_iter_init = TRUE; /* Source selection iteration info has been initialized */ /* Initialize sequence counts */ @@ -383,7 +382,7 @@ H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *s /* Get sequences for destination selection */ if (H5S_SELECT_ITER_GET_SEQ_LIST(dst_sel_iter, vec_size, nelmts, &dst_nseq, &dst_nelem, dst_off, dst_len) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "sequence length generation failed") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ curr_dst_seq = 0; @@ -394,7 +393,7 @@ H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *s /* Get sequences for source selection */ if (H5S_SELECT_ITER_GET_SEQ_LIST(src_sel_iter, vec_size, nelmts, &src_nseq, &src_nelem, src_off, src_len) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "sequence length generation failed") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "sequence length generation failed"); /* Start at the beginning of the sequences again */ curr_src_seq = 0; @@ -403,10 +402,10 @@ H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *s /* Perform vectorized memcpy from src_buf to dst_buf */ if ((bytes_copied = H5VM_memcpyvv(dst_buf, dst_nseq, &curr_dst_seq, dst_len, dst_off, src_buf, src_nseq, &curr_src_seq, src_len, src_off)) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vectorized memcpy failed"); /* Decrement number of elements left to process */ - HDassert(((size_t)bytes_copied % elmt_size) == 0); + assert(((size_t)bytes_copied % elmt_size) == 0); nelmts -= ((size_t)bytes_copied / elmt_size); } } @@ -415,13 +414,13 @@ H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *s /* Release selection iterators */ if (src_sel_iter) { if (src_sel_iter_init && H5S_SELECT_ITER_RELEASE(src_sel_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); src_sel_iter = H5FL_FREE(H5S_sel_iter_t, src_sel_iter); } if (dst_sel_iter) { if (dst_sel_iter_init && H5S_SELECT_ITER_RELEASE(dst_sel_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); dst_sel_iter = H5FL_FREE(H5S_sel_iter_t, dst_sel_iter); } @@ -446,23 +445,18 @@ H5D_select_io_mem(void *dst_buf, H5S_t *dst_space, const void *src_buf, H5S_t *s * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, July 23, 2002 - * *------------------------------------------------------------------------- */ herr_t -H5D__select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space) +H5D__select_read(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Call generic selection operation */ - H5_CHECK_OVERFLOW(nelmts, hsize_t, size_t); - if (H5D__select_io(io_info, type_info->src_type_size, (size_t)nelmts, file_space, mem_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error") + if (H5D__select_io(io_info, dset_info, dset_info->type_info.src_type_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_READERROR, FAIL, "read error"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -475,23 +469,18 @@ H5D__select_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, July 23, 2002 - * *------------------------------------------------------------------------- */ herr_t -H5D__select_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space) +H5D__select_write(const H5D_io_info_t *io_info, const H5D_dset_io_info_t *dset_info) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Call generic selection operation */ - H5_CHECK_OVERFLOW(nelmts, hsize_t, size_t); - if (H5D__select_io(io_info, type_info->dst_type_size, (size_t)nelmts, file_space, mem_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error") + if (H5D__select_io(io_info, dset_info, dset_info->type_info.dst_type_size) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_WRITEERROR, FAIL, "write error"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dsingle.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dsingle.c index 8c4748e8c2..926c78afcf 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dsingle.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dsingle.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,15 +10,12 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Vailin Choi - * May 2011; updated 10/2015 - * - * Purpose: Single Chunk I/O functions. - * This is used when the dataset has only 1 chunk (with or without filter): - * cur_dims[] is equal to max_dims[] is equal to the chunk dims[] - * non-filter chunk record: [address of the chunk] - * filtered chunk record: [address of the chunk, chunk size, filter mask] - * +/* + * Purpose: Single Chunk I/O functions. + * This is used when the dataset has only 1 chunk (with or without filter): + * cur_dims[] is equal to max_dims[] is equal to the chunk dims[] + * non-filter chunk record: [address of the chunk] + * filtered chunk record: [address of the chunk, chunk size, filter mask] */ /****************/ @@ -107,9 +103,6 @@ const H5D_chunk_ops_t H5D_COPS_SINGLE[1] = {{ * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * July, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -119,16 +112,16 @@ H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNU FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); if (idx_info->pline->nused) { idx_info->layout->flags |= H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER; - if (!H5F_addr_defined(idx_info->storage->idx_addr)) { + if (!H5_addr_defined(idx_info->storage->idx_addr)) { idx_info->storage->u.single.nbytes = 0; idx_info->storage->u.single.filter_mask = 0; } @@ -147,8 +140,6 @@ H5D__single_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNU * Return: Non-negative on success * Negative on failure. * - * Programmer: Vailin Choi; July 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -157,19 +148,19 @@ H5D__single_idx_create(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(idx_info->layout->max_nchunks == idx_info->layout->nchunks); - HDassert(idx_info->layout->nchunks == 1); - HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(idx_info->layout->max_nchunks == idx_info->layout->nchunks); + assert(idx_info->layout->nchunks == 1); + assert(!H5_addr_defined(idx_info->storage->idx_addr)); if (idx_info->pline->nused) - HDassert(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER); + assert(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER); else - HDassert(!(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER)); + assert(!(idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__single_idx_create() */ @@ -181,8 +172,6 @@ H5D__single_idx_create(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; July 2011 - * *------------------------------------------------------------------------- */ static hbool_t @@ -191,9 +180,9 @@ H5D__single_idx_is_space_alloc(const H5O_storage_chunk_t *storage) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); + assert(storage); - FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) + FUNC_LEAVE_NOAPI((hbool_t)H5_addr_defined(storage->idx_addr)) } /* end H5D__single_idx_is_space_alloc() */ /*------------------------------------------------------------------------- @@ -203,8 +192,6 @@ H5D__single_idx_is_space_alloc(const H5O_storage_chunk_t *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; July 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -215,17 +202,17 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(idx_info->layout->nchunks == 1); - HDassert(idx_info->layout->max_nchunks == 1); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(idx_info->layout->nchunks == 1); + assert(idx_info->layout->max_nchunks == 1); + assert(udata); /* Set the address for the chunk */ - HDassert(H5F_addr_defined(udata->chunk_block.offset)); + assert(H5_addr_defined(udata->chunk_block.offset)); idx_info->storage->idx_addr = udata->chunk_block.offset; if (idx_info->pline->nused > 0) { @@ -237,7 +224,7 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata if (dset->shared->dcpl_cache.fill.alloc_time != H5D_ALLOC_TIME_EARLY || idx_info->pline->nused > 0) /* Mark the layout dirty so that the address of the single chunk will be flushed later */ if (H5D__mark(dset, H5D_MARK_LAYOUT) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark layout as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -251,8 +238,6 @@ H5D__single_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; July 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -261,14 +246,14 @@ H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(idx_info->layout->nchunks == 1); - HDassert(idx_info->layout->max_nchunks == 1); - HDassert(udata); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(idx_info->layout->nchunks == 1); + assert(idx_info->layout->max_nchunks == 1); + assert(udata); udata->chunk_block.offset = idx_info->storage->idx_addr; if (idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { @@ -279,7 +264,7 @@ H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda udata->chunk_block.length = idx_info->layout->size; udata->filter_mask = 0; } /* end else */ - if (!H5F_addr_defined(udata->chunk_block.offset)) + if (!H5_addr_defined(udata->chunk_block.offset)) udata->chunk_block.length = 0; FUNC_LEAVE_NOAPI(SUCCEED) @@ -292,8 +277,6 @@ H5D__single_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *uda * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; July 2010 - * *------------------------------------------------------------------------- */ static int @@ -305,17 +288,17 @@ H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(chunk_cb); - HDassert(chunk_udata); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(chunk_cb); + assert(chunk_udata); + assert(H5_addr_defined(idx_info->storage->idx_addr)); /* Initialize generic chunk record */ - HDmemset(&chunk_rec, 0, sizeof(chunk_rec)); + memset(&chunk_rec, 0, sizeof(chunk_rec)); chunk_rec.chunk_addr = idx_info->storage->idx_addr; if (idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { @@ -341,8 +324,6 @@ H5D__single_idx_iterate(const H5D_chk_idx_info_t *idx_info, H5D_chunk_cb_func_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; July 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -354,12 +335,12 @@ H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); - HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); + assert(H5_addr_defined(idx_info->storage->idx_addr)); if (idx_info->layout->flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) nbytes = idx_info->storage->u.single.nbytes; @@ -367,7 +348,7 @@ H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t nbytes = idx_info->layout->size; if (H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->storage->idx_addr, nbytes) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free dataset chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free dataset chunks"); idx_info->storage->idx_addr = HADDR_UNDEF; @@ -383,8 +364,6 @@ H5D__single_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi; Sept 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -395,16 +374,16 @@ H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(idx_info); - HDassert(idx_info->f); - HDassert(idx_info->pline); - HDassert(idx_info->layout); - HDassert(idx_info->storage); + assert(idx_info); + assert(idx_info->f); + assert(idx_info->pline); + assert(idx_info->layout); + assert(idx_info->storage); - if (H5F_addr_defined(idx_info->storage->idx_addr)) + if (H5_addr_defined(idx_info->storage->idx_addr)) ret_value = H5D__single_idx_remove(idx_info, NULL); else - HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); + assert(!H5_addr_defined(idx_info->storage->idx_addr)); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__single_idx_delete() */ @@ -416,8 +395,6 @@ H5D__single_idx_delete(const H5D_chk_idx_info_t *idx_info) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -429,25 +406,25 @@ H5D__single_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_i FUNC_ENTER_PACKAGE /* Check args */ - HDassert(idx_info_src); - HDassert(idx_info_src->f); - HDassert(idx_info_src->pline); - HDassert(idx_info_src->layout); - HDassert(idx_info_src->storage); - HDassert(H5F_addr_defined(idx_info_src->storage->idx_addr)); - - HDassert(idx_info_dst); - HDassert(idx_info_dst->f); - HDassert(idx_info_dst->pline); - HDassert(idx_info_dst->layout); - HDassert(idx_info_dst->storage); + assert(idx_info_src); + assert(idx_info_src->f); + assert(idx_info_src->pline); + assert(idx_info_src->layout); + assert(idx_info_src->storage); + assert(H5_addr_defined(idx_info_src->storage->idx_addr)); + + assert(idx_info_dst); + assert(idx_info_dst->f); + assert(idx_info_dst->pline); + assert(idx_info_dst->layout); + assert(idx_info_dst->storage); /* Set copied metadata tag */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) /* Set up information at the destination file */ if (H5D__single_idx_create(idx_info_dst) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage"); /* Reset metadata tag */ H5_END_TAG @@ -464,8 +441,6 @@ H5D__single_idx_copy_setup(const H5D_chk_idx_info_t H5_ATTR_NDEBUG_UNUSED *idx_i * Return: Success: Non-negative * Failure: negative * - * Programmer: Vailin Choi; Sept 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -474,7 +449,7 @@ H5D__single_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(index_size); + assert(index_size); *index_size = 0; @@ -488,8 +463,6 @@ H5D__single_idx_size(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, hsize_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -498,7 +471,7 @@ H5D__single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); + assert(storage); /* Reset index info */ if (reset_addr) @@ -514,8 +487,6 @@ H5D__single_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; September 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -524,10 +495,10 @@ H5D__single_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(storage); - HDassert(stream); + assert(storage); + assert(stream); - HDfprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); + fprintf(stream, " Address: %" PRIuHADDR "\n", storage->idx_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__single_idx_dump() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dtest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dtest.c index f37682d3c3..0038d98393 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dtest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dtest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Thursday, May 27, 2004 - * +/* * Purpose: Dataset testing functions. */ @@ -82,7 +79,7 @@ H5D__layout_version_test(hid_t did, unsigned *version) /* Check args */ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset"); if (version) *version = dset->shared->layout.version; @@ -120,10 +117,10 @@ H5D__layout_contig_size_test(hid_t did, hsize_t *size) /* Check args */ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset"); if (size) { - HDassert(dset->shared->layout.type == H5D_CONTIGUOUS); + assert(dset->shared->layout.type == H5D_CONTIGUOUS); *size = dset->shared->layout.storage.u.contig.size; } /* end if */ @@ -160,10 +157,10 @@ H5D__layout_compact_dirty_test(hid_t did, hbool_t *dirty) /* Check args */ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset"); if (dirty) { - HDassert(dset->shared->layout.type == H5D_COMPACT); + assert(dset->shared->layout.type == H5D_COMPACT); *dirty = dset->shared->layout.storage.u.compact.dirty; } /* end if */ @@ -198,11 +195,11 @@ H5D__layout_type_test(hid_t did, H5D_layout_t *layout_type) FUNC_ENTER_PACKAGE - HDassert(layout_type); + assert(layout_type); /* Check args */ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); if (layout_type) *layout_type = dset->shared->layout.type; @@ -240,9 +237,9 @@ H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type) /* Check args */ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); if (dset->shared->layout.type != H5D_CHUNKED) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked"); if (idx_type) *idx_type = dset->shared->layout.u.chunk.idx_type; @@ -280,15 +277,15 @@ H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused) /* Check args */ if (NULL == (dset = (H5D_t *)H5VL_object_verify(did, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset"); if (nbytes_used) { - HDassert(dset->shared->layout.type == H5D_CHUNKED); + assert(dset->shared->layout.type == H5D_CHUNKED); *nbytes_used = dset->shared->cache.chunk.nbytes_used; } /* end if */ if (nused) { - HDassert(dset->shared->layout.type == H5D_CHUNKED); + assert(dset->shared->layout.type == H5D_CHUNKED); *nused = dset->shared->cache.chunk.nused; } /* end if */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Dvirtual.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Dvirtual.c index 04981c2923..64f1bfe45d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Dvirtual.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Dvirtual.c @@ -11,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Neil Fortner - * Wednesday, January 28, 2015 - * * Purpose: * Virtual Dataset (VDS) functions. Creates a layout type which allows * definition of a virtual dataset, where the actual dataset is stored in @@ -83,10 +80,9 @@ /* Layout operation callbacks */ static hbool_t H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset); -static herr_t H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm); -static herr_t H5D__virtual_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t *fm); +static herr_t H5D__virtual_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); +static herr_t H5D__virtual_read(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); +static herr_t H5D__virtual_write(H5D_io_info_t *io_info, H5D_dset_io_info_t *dinfo); static herr_t H5D__virtual_flush(H5D_t *dset); /* Other functions */ @@ -103,13 +99,13 @@ static herr_t H5D__virtual_build_source_name(char size_t static_strlen, size_t nsubs, hsize_t blockno, char **built_name); static herr_t H5D__virtual_init_all(const H5D_t *dset); -static herr_t H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_t *file_space, - H5S_t *mem_space, hsize_t *tot_nelmts); +static herr_t H5D__virtual_pre_io(H5D_dset_io_info_t *dset_info, H5O_storage_virtual_t *storage, + H5S_t *file_space, H5S_t *mem_space, hsize_t *tot_nelmts); static herr_t H5D__virtual_post_io(H5O_storage_virtual_t *storage); -static herr_t H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5S_t *file_space, H5O_storage_virtual_srcdset_t *source_dset); -static herr_t H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, - H5S_t *file_space, H5O_storage_virtual_srcdset_t *source_dset); +static herr_t H5D__virtual_read_one(H5D_dset_io_info_t *dset_info, + H5O_storage_virtual_srcdset_t *source_dset); +static herr_t H5D__virtual_write_one(H5D_dset_io_info_t *dset_info, + H5O_storage_virtual_srcdset_t *source_dset); /*********************/ /* Package Variables */ @@ -121,18 +117,15 @@ const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{ H5D__virtual_init, /* init */ H5D__virtual_is_space_alloc, /* is_space_alloc */ H5D__virtual_is_data_cached, /* is_data_cached */ - NULL, /* io_init */ + H5D__virtual_io_init, /* io_init */ + NULL, /* mdio_init */ H5D__virtual_read, /* ser_read */ H5D__virtual_write, /* ser_write */ -#ifdef H5_HAVE_PARALLEL - NULL, /* par_read */ - NULL, /* par_write */ -#endif - NULL, /* readvv */ - NULL, /* writevv */ - H5D__virtual_flush, /* flush */ - NULL, /* io_term */ - NULL /* dest */ + NULL, /* readvv */ + NULL, /* writevv */ + H5D__virtual_flush, /* flush */ + NULL, /* io_term */ + NULL /* dest */ }}; /*******************/ @@ -154,9 +147,6 @@ H5FL_DEFINE_STATIC(H5D_virtual_held_file_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * August 12, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -172,15 +162,15 @@ H5D_virtual_check_mapping_pre(const H5S_t *vspace, const H5S_t *src_space, /* Check for point selections (currently unsupported) */ if (H5S_SEL_ERROR == (select_type = H5S_GET_SELECT_TYPE(vspace))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get selection type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get selection type"); if (select_type == H5S_SEL_POINTS) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, - "point selections not currently supported with virtual datasets") + "point selections not currently supported with virtual datasets"); if (H5S_SEL_ERROR == (select_type = H5S_GET_SELECT_TYPE(src_space))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get selection type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get selection type"); if (select_type == H5S_SEL_POINTS) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, - "point selections not currently supported with virtual datasets") + "point selections not currently supported with virtual datasets"); /* Get number of elements in spaces */ nelmts_vs = (hsize_t)H5S_GET_SELECT_NPOINTS(vspace); @@ -200,14 +190,14 @@ H5D_virtual_check_mapping_pre(const H5S_t *vspace, const H5S_t *src_space, */ if (H5S_get_select_num_elem_non_unlim(vspace, &nenu_vs) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, - "can't get number of elements in non-unlimited dimension") + "can't get number of elements in non-unlimited dimension"); if (H5S_get_select_num_elem_non_unlim(src_space, &nenu_ss) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, - "can't get number of elements in non-unlimited dimension") + "can't get number of elements in non-unlimited dimension"); if (nenu_vs != nenu_ss) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "numbers of elements in the non-unlimited dimensions is different for source and " - "virtual spaces") + "virtual spaces"); } /* end if */ /* We will handle the printf case after parsing the source names */ } /* end if */ @@ -215,7 +205,7 @@ H5D_virtual_check_mapping_pre(const H5S_t *vspace, const H5S_t *src_space, /* Limited selections. Check number of points is the same. */ if (nelmts_vs != nelmts_ss) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "virtual and source space selections have different numbers of elements") + "virtual and source space selections have different numbers of elements"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -229,9 +219,6 @@ H5D_virtual_check_mapping_pre(const H5S_t *vspace, const H5S_t *src_space, * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * August 12, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -255,12 +242,12 @@ H5D_virtual_check_mapping_post(const H5O_storage_virtual_ent_t *ent) if ((ent->psfn_nsubs == 0) && (ent->psdn_nsubs == 0)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unlimited virtual selection, limited source selection, and no printf specifiers in " - "source names") + "source names"); /* Make sure virtual space uses hyperslab selection */ if (H5S_GET_SELECT_TYPE(ent->source_dset.virtual_select) != H5S_SEL_HYPERSLABS) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, - "virtual selection with printf mapping must be hyperslab") + "virtual selection with printf mapping must be hyperslab"); /* Check that the number of elements in one block in the virtual * selection matches the total number of elements in the source @@ -269,14 +256,14 @@ H5D_virtual_check_mapping_post(const H5O_storage_virtual_ent_t *ent) if (ent->source_space_status != H5O_VIRTUAL_STATUS_INVALID) { /* Get first block in virtual selection */ if (NULL == (tmp_space = H5S_hyper_get_unlim_block(ent->source_dset.virtual_select, (hsize_t)0))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get first block in virtual selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get first block in virtual selection"); /* Check number of points */ nelmts_vs = (hsize_t)H5S_GET_SELECT_NPOINTS(tmp_space); if (nelmts_vs != nelmts_ss) HGOTO_ERROR( H5E_ARGS, H5E_BADVALUE, FAIL, - "virtual (single block) and source space selections have different numbers of elements") + "virtual (single block) and source space selections have different numbers of elements"); } /* end if */ } /* end if */ else @@ -284,13 +271,13 @@ H5D_virtual_check_mapping_post(const H5O_storage_virtual_ent_t *ent) if ((ent->psfn_nsubs > 0) || (ent->psdn_nsubs > 0)) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "printf specifier(s) in source name(s) without an unlimited virtual selection and " - "limited source selection") + "limited source selection"); done: /* Free temporary space */ if (tmp_space) if (H5S_close(tmp_space) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "can't close dataspace") + HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "can't close dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D_virtual_check_mapping_post() */ @@ -305,9 +292,6 @@ H5D_virtual_check_mapping_post(const H5O_storage_virtual_ent_t *ent) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * February 10, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -324,25 +308,25 @@ H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx) FUNC_ENTER_NOAPI(FAIL) - HDassert(layout); - HDassert(layout->type == H5D_VIRTUAL); - HDassert(idx < virt->list_nalloc); + assert(layout); + assert(layout->type == H5D_VIRTUAL); + assert(idx < virt->list_nalloc); /* Get type of selection */ if (H5S_SEL_ERROR == (sel_type = H5S_GET_SELECT_TYPE(ent->source_dset.virtual_select))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection type") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection type"); /* Do not update min_dims for "all" or "none" selections */ if ((sel_type == H5S_SEL_ALL) || (sel_type == H5S_SEL_NONE)) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Get rank of vspace */ if ((rank = H5S_GET_EXTENT_NDIMS(ent->source_dset.virtual_select)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions"); /* Get selection bounds */ if (H5S_SELECT_BOUNDS(ent->source_dset.virtual_select, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds"); /* Update min_dims */ for (i = 0; i < rank; i++) @@ -362,9 +346,6 @@ H5D_virtual_update_min_dims(H5O_layout_t *layout, size_t idx) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * August 13, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -377,24 +358,24 @@ H5D_virtual_check_min_dims(const H5D_t *dset) FUNC_ENTER_NOAPI(FAIL) - HDassert(dset); - HDassert(dset->shared); - HDassert(dset->shared->layout.type == H5D_VIRTUAL); + assert(dset); + assert(dset->shared); + assert(dset->shared->layout.type == H5D_VIRTUAL); /* Get rank of dataspace */ if ((rank = H5S_GET_EXTENT_NDIMS(dset->shared->space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions"); /* Get VDS dimensions */ if (H5S_get_simple_extent_dims(dset->shared->space, dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions"); /* Verify that dimensions are larger than min_dims */ for (i = 0; i < rank; i++) if (dims[i] < dset->shared->layout.storage.u.virt.min_dims[i]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "virtual dataset dimensions not large enough to contain all limited dimensions in " - "all selections") + "all selections"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -412,9 +393,6 @@ H5D_virtual_check_min_dims(const H5D_t *dset) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * Sunday, Feberuary 11, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -433,9 +411,9 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) FUNC_ENTER_PACKAGE /* Sanity checking */ - HDassert(f); - HDassert(layout); - HDassert(virt->serial_list_hobjid.addr == HADDR_UNDEF); + assert(f); + assert(layout); + assert(virt->serial_list_hobjid.addr == HADDR_UNDEF); /* Create block if # of used entries > 0 */ if (virt->list_nused > 0) { @@ -445,7 +423,7 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) /* Allocate array for caching results of strlen */ if (NULL == (str_size = (size_t *)H5MM_malloc(2 * virt->list_nused * sizeof(size_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate string length array") + HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate string length array"); /* * Calculate heap block size @@ -459,10 +437,10 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) H5O_storage_virtual_ent_t *ent = &virt->list[i]; hssize_t select_serial_size; /* Size of serialized selection */ - HDassert(ent->source_file_name); - HDassert(ent->source_dset_name); - HDassert(ent->source_select); - HDassert(ent->source_dset.virtual_select); + assert(ent->source_file_name); + assert(ent->source_dset_name); + assert(ent->source_select); + assert(ent->source_dset.virtual_select); /* Source file name */ str_size[2 * i] = HDstrlen(ent->source_file_name) + (size_t)1; @@ -474,12 +452,12 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) /* Source selection */ if ((select_serial_size = H5S_SELECT_SERIAL_SIZE(ent->source_select)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size"); block_size += (size_t)select_serial_size; /* Virtual dataset selection */ if ((select_serial_size = H5S_SELECT_SERIAL_SIZE(ent->source_dset.virtual_select)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to check dataspace selection size"); block_size += (size_t)select_serial_size; } /* end for */ @@ -488,7 +466,7 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) /* Allocate heap block */ if (NULL == (heap_block = (uint8_t *)H5MM_malloc(block_size))) - HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate heap block") + HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, FAIL, "unable to allocate heap block"); /* * Encode heap block @@ -500,7 +478,7 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) /* Number of entries */ tmp_nentries = (hsize_t)virt->list_nused; - H5F_ENCODE_LENGTH(f, heap_block_p, tmp_nentries) + H5F_ENCODE_LENGTH(f, heap_block_p, tmp_nentries); /* Encode each entry */ for (i = 0; i < virt->list_nused; i++) { @@ -515,20 +493,20 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) /* Source selection */ if (H5S_SELECT_SERIALIZE(ent->source_select, &heap_block_p) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize source selection"); /* Virtual selection */ if (H5S_SELECT_SERIALIZE(ent->source_dset.virtual_select, &heap_block_p) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to serialize virtual selection"); } /* end for */ /* Checksum */ chksum = H5_checksum_metadata(heap_block, block_size - (size_t)4, 0); - UINT32ENCODE(heap_block_p, chksum) + UINT32ENCODE(heap_block_p, chksum); /* Insert block into global heap */ if (H5HG_insert(f, block_size, heap_block, &(virt->serial_list_hobjid)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to insert virtual dataset heap block") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to insert virtual dataset heap block"); } /* end if */ done: @@ -548,9 +526,6 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * February 10, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -566,8 +541,8 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) FUNC_ENTER_PACKAGE - HDassert(layout); - HDassert(layout->type == H5D_VIRTUAL); + assert(layout); + assert(layout->type == H5D_VIRTUAL); /* Save original entry list and top-level property lists and reset in layout * so the originals aren't closed on error */ @@ -580,12 +555,12 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) /* Copy entry list */ if (virt->list_nused > 0) { - HDassert(orig_list); + assert(orig_list); /* Allocate memory for the list */ if (NULL == (virt->list = H5MM_calloc(virt->list_nused * sizeof(virt->list[0])))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, - "unable to allocate memory for virtual dataset entry list") + "unable to allocate memory for virtual dataset entry list"); virt->list_nalloc = virt->list_nused; /* Copy the list entries, though set source_dset.dset and sub_dset to @@ -596,17 +571,17 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) /* Copy virtual selection */ if (NULL == (ent->source_dset.virtual_select = H5S_copy(orig_list[i].source_dset.virtual_select, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection"); /* Copy original source names */ if (NULL == (ent->source_file_name = H5MM_strdup(orig_list[i].source_file_name))) - HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name") + HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name"); if (NULL == (ent->source_dset_name = H5MM_strdup(orig_list[i].source_dset_name))) - HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name") + HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name"); /* Copy source selection */ if (NULL == (ent->source_select = H5S_copy(orig_list[i].source_select, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection"); /* Initialize clipped selections */ if (orig_list[i].unlim_dim_virtual < 0) { @@ -617,12 +592,12 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) /* Copy parsed names */ if (H5D__virtual_copy_parsed_name(&ent->parsed_source_file_name, orig_list[i].parsed_source_file_name) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy parsed source file name") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy parsed source file name"); ent->psfn_static_strlen = orig_list[i].psfn_static_strlen; ent->psfn_nsubs = orig_list[i].psfn_nsubs; if (H5D__virtual_copy_parsed_name(&ent->parsed_source_dset_name, orig_list[i].parsed_source_dset_name) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy parsed source dataset name") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy parsed source dataset name"); ent->psdn_static_strlen = orig_list[i].psdn_static_strlen; ent->psdn_nsubs = orig_list[i].psdn_nsubs; @@ -634,13 +609,13 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) else if (orig_list[i].parsed_source_file_name && (orig_list[i].source_dset.file_name != orig_list[i].parsed_source_file_name->name_segment)) { - HDassert(ent->parsed_source_file_name); - HDassert(ent->parsed_source_file_name->name_segment); + assert(ent->parsed_source_file_name); + assert(ent->parsed_source_file_name->name_segment); ent->source_dset.file_name = ent->parsed_source_file_name->name_segment; } /* end if */ else if (NULL == (ent->source_dset.file_name = H5MM_strdup(orig_list[i].source_dset.file_name))) - HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name") + HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name"); } /* end if */ if (orig_list[i].source_dset.dset_name) { if (orig_list[i].source_dset.dset_name == orig_list[i].source_dset_name) @@ -648,13 +623,13 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) else if (orig_list[i].parsed_source_dset_name && (orig_list[i].source_dset.dset_name != orig_list[i].parsed_source_dset_name->name_segment)) { - HDassert(ent->parsed_source_dset_name); - HDassert(ent->parsed_source_dset_name->name_segment); + assert(ent->parsed_source_dset_name); + assert(ent->parsed_source_dset_name->name_segment); ent->source_dset.dset_name = ent->parsed_source_dset_name->name_segment; } /* end if */ else if (NULL == (ent->source_dset.dset_name = H5MM_strdup(orig_list[i].source_dset.dset_name))) - HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name") + HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name"); } /* end if */ /* Copy other fields in entry */ @@ -677,15 +652,15 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) /* Copy property lists */ if (orig_source_fapl >= 0) { if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(orig_source_fapl, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if ((virt->source_fapl = H5P_copy_plist(plist, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy fapl") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy fapl"); } /* end if */ if (orig_source_dapl >= 0) { if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(orig_source_dapl, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if ((virt->source_dapl = H5P_copy_plist(plist, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dapl") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dapl"); } /* end if */ /* New layout is not fully initialized */ @@ -695,7 +670,7 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) /* Release allocated resources on failure */ if (ret_value < 0) if (H5D__virtual_reset_layout(layout) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset virtual layout") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset virtual layout"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_copy_layout() */ @@ -711,9 +686,6 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * February 11, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -725,8 +697,8 @@ H5D__virtual_reset_layout(H5O_layout_t *layout) FUNC_ENTER_PACKAGE - HDassert(layout); - HDassert(layout->type == H5D_VIRTUAL); + assert(layout); + assert(layout->type == H5D_VIRTUAL); /* Free the list entries. Note we always attempt to free everything even in * the case of a failure. Because of this, and because we free the list @@ -735,7 +707,7 @@ H5D__virtual_reset_layout(H5O_layout_t *layout) H5O_storage_virtual_ent_t *ent = &virt->list[i]; /* Free source_dset */ if (H5D__virtual_reset_source_dset(ent, &ent->source_dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset"); /* Free original source names */ (void)H5MM_xfree(ent->source_file_name); @@ -744,13 +716,13 @@ H5D__virtual_reset_layout(H5O_layout_t *layout) /* Free sub_dset */ for (j = 0; j < ent->sub_dset_nalloc; j++) if (H5D__virtual_reset_source_dset(ent, &ent->sub_dset[j]) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset"); ent->sub_dset = H5MM_xfree(ent->sub_dset); /* Free source_select */ if (ent->source_select) if (H5S_close(ent->source_select) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection"); /* Free parsed_source_file_name */ H5D_virtual_free_parsed_name(ent->parsed_source_file_name); @@ -763,17 +735,17 @@ H5D__virtual_reset_layout(H5O_layout_t *layout) virt->list = H5MM_xfree(virt->list); virt->list_nalloc = (size_t)0; virt->list_nused = (size_t)0; - (void)HDmemset(virt->min_dims, 0, sizeof(virt->min_dims)); + (void)memset(virt->min_dims, 0, sizeof(virt->min_dims)); /* Close access property lists */ if (virt->source_fapl >= 0) { if (H5I_dec_ref(virt->source_fapl) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source fapl") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source fapl"); virt->source_fapl = -1; } if (virt->source_dapl >= 0) { if (H5I_dec_ref(virt->source_dapl) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source dapl") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't close source dapl"); virt->source_dapl = -1; } @@ -792,9 +764,6 @@ H5D__virtual_reset_layout(H5O_layout_t *layout) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * February 6, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -809,7 +778,7 @@ H5D__virtual_copy(H5F_t *f_dst, H5O_layout_t *layout_dst) if (f_dst == f_src) { /* Increase reference count on global heap object */ if ((heap_rc = H5HG_link(f_dst, (H5HG_t *)&(layout_dst->u.virt.serial_list_hobjid), 1)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap reference count") + HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap reference count"); } /* end if */ else #endif /* NOT_YET */ @@ -820,7 +789,7 @@ H5D__virtual_copy(H5F_t *f_dst, H5O_layout_t *layout_dst) /* Write the VDS data to destination file's heap */ if (H5D__virtual_store_layout(f_dst, layout_dst) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to store VDS info"); } /* end block/else */ done: @@ -834,9 +803,6 @@ H5D__virtual_copy(H5F_t *f_dst, H5O_layout_t *layout_dst) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * February 6, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -850,21 +816,21 @@ H5D__virtual_delete(H5F_t *f, H5O_storage_t *storage) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(storage); - HDassert(storage->type == H5D_VIRTUAL); + assert(f); + assert(storage); + assert(storage->type == H5D_VIRTUAL); /* Check for global heap block */ if (storage->u.virt.serial_list_hobjid.addr != HADDR_UNDEF) { #ifdef NOT_YET /* Unlink the global heap block */ if ((heap_rc = H5HG_link(f, (H5HG_t *)&(storage->u.virt.serial_list_hobjid), -1)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap reference count") + HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap reference count"); if (heap_rc == 0) #endif /* NOT_YET */ /* Delete the global heap block */ if (H5HG_remove(f, (H5HG_t *)&(storage->u.virt.serial_list_hobjid)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to remove heap object") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to remove heap object"); } /* end if */ /* Clear global heap ID in storage */ @@ -882,9 +848,6 @@ H5D__virtual_delete(H5F_t *f, H5O_storage_t *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * March 6, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -898,11 +861,11 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(vdset); - HDassert(source_dset); - HDassert(!source_dset->dset); - HDassert(source_dset->file_name); - HDassert(source_dset->dset_name); + assert(vdset); + assert(source_dset); + assert(!source_dset->dset); + assert(source_dset->file_name); + assert(source_dset->dset_name); /* Check if we need to open the source file */ if (HDstrcmp(source_dset->file_name, ".") != 0) { @@ -932,9 +895,9 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir /* Set up the root group in the destination file */ if (NULL == (src_root_loc.oloc = H5G_oloc(H5G_rootof(src_file)))) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to get object location for root group") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to get object location for root group"); if (NULL == (src_root_loc.path = H5G_nameof(H5G_rootof(src_file)))) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to get path for root group") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to get path for root group"); /* Try opening the source dataset */ source_dset->dset = H5D__open_name(&src_root_loc, source_dset->dset_name, @@ -954,7 +917,7 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir /* Patch the source selection if necessary */ if (virtual_ent->source_space_status != H5O_VIRTUAL_STATUS_CORRECT) { if (H5S_extent_copy(virtual_ent->source_select, source_dset->dset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy source dataspace extent") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy source dataspace extent"); virtual_ent->source_space_status = H5O_VIRTUAL_STATUS_CORRECT; } /* end if */ } /* end else */ @@ -964,7 +927,7 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir /* Release resources */ if (src_file_open) if (H5F_efc_close(vdset->oloc.file, src_file) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, FAIL, "can't close source file") + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, FAIL, "can't close source file"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_open_source_dset() */ @@ -976,9 +939,6 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * May 20, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -990,12 +950,12 @@ H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t *virtual_ent, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(source_dset); + assert(source_dset); /* Free dataset */ if (source_dset->dset) { if (H5D_close(source_dset->dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close source dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close source dataset"); source_dset->dset = NULL; } /* end if */ @@ -1004,33 +964,33 @@ H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t *virtual_ent, (source_dset->file_name != virtual_ent->parsed_source_file_name->name_segment)) source_dset->file_name = (char *)H5MM_xfree(source_dset->file_name); else - HDassert((source_dset->file_name == virtual_ent->source_file_name) || - (virtual_ent->parsed_source_file_name && - (source_dset->file_name == virtual_ent->parsed_source_file_name->name_segment)) || - !source_dset->file_name); + assert((source_dset->file_name == virtual_ent->source_file_name) || + (virtual_ent->parsed_source_file_name && + (source_dset->file_name == virtual_ent->parsed_source_file_name->name_segment)) || + !source_dset->file_name); /* Free dataset name */ if (virtual_ent->parsed_source_dset_name && (source_dset->dset_name != virtual_ent->parsed_source_dset_name->name_segment)) source_dset->dset_name = (char *)H5MM_xfree(source_dset->dset_name); else - HDassert((source_dset->dset_name == virtual_ent->source_dset_name) || - (virtual_ent->parsed_source_dset_name && - (source_dset->dset_name == virtual_ent->parsed_source_dset_name->name_segment)) || - !source_dset->dset_name); + assert((source_dset->dset_name == virtual_ent->source_dset_name) || + (virtual_ent->parsed_source_dset_name && + (source_dset->dset_name == virtual_ent->parsed_source_dset_name->name_segment)) || + !source_dset->dset_name); /* Free clipped virtual selection */ if (source_dset->clipped_virtual_select) { if (source_dset->clipped_virtual_select != source_dset->virtual_select) if (H5S_close(source_dset->clipped_virtual_select) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped virtual selection") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped virtual selection"); source_dset->clipped_virtual_select = NULL; } /* end if */ /* Free virtual selection */ if (source_dset->virtual_select) { if (H5S_close(source_dset->virtual_select) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release virtual selection") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release virtual selection"); source_dset->virtual_select = NULL; } /* end if */ @@ -1038,13 +998,13 @@ H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t *virtual_ent, if (source_dset->clipped_source_select) { if (source_dset->clipped_source_select != virtual_ent->source_select) if (H5S_close(source_dset->clipped_source_select) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped source selection") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release clipped source selection"); source_dset->clipped_source_select = NULL; } /* end if */ /* The projected memory space should never exist when this function is * called */ - HDassert(!source_dset->projected_mem_space); + assert(!source_dset->projected_mem_space); /* Note the lack of a done: label. This is because there are no HGOTO_ERROR * calls. If one is added, a done: label must also be added */ @@ -1059,9 +1019,6 @@ H5D__virtual_reset_source_dset(H5O_storage_virtual_ent_t *virtual_ent, * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * May 19, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1072,21 +1029,21 @@ H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf, s FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(src); - HDassert(src_len > 0); - HDassert(p); - HDassert(buf); - HDassert(*p >= *buf); - HDassert(buf_size); + assert(src); + assert(src_len > 0); + assert(p); + assert(buf); + assert(*p >= *buf); + assert(buf_size); /* Allocate or extend buffer if necessary */ if (!*buf) { - HDassert(!*p); - HDassert(*buf_size == 0); + assert(!*p); + assert(*buf_size == 0); /* Allocate buffer */ if (NULL == (*buf = (char *)H5MM_malloc(src_len + (size_t)1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct"); *buf_size = src_len + (size_t)1; *p = *buf; } /* end if */ @@ -1103,7 +1060,7 @@ H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf, s /* Reallocate buffer */ if (NULL == (tmp_buf = (char *)H5MM_realloc(*buf, tmp_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to reallocate name segment buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to reallocate name segment buffer"); *buf = tmp_buf; *buf_size = tmp_buf_size; *p = *buf + p_offset; @@ -1121,7 +1078,7 @@ H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf, s **p = '\0'; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_str_append() */ /*------------------------------------------------------------------------- @@ -1131,9 +1088,6 @@ H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf, s * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * May 18, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -1154,10 +1108,10 @@ H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(source_name); - HDassert(parsed_name); - HDassert(static_strlen); - HDassert(nsubs); + assert(source_name); + assert(parsed_name); + assert(static_strlen); + assert(nsubs); /* Initialize p and tmp_static_strlen */ p = source_name; @@ -1167,12 +1121,12 @@ H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_ /* Note this will not work with UTF-8! We should support this eventually * -NAF 5/18/2015 */ while ((pct = HDstrchr(p, '%'))) { - HDassert(pct >= p); + assert(pct >= p); /* Allocate name segment struct if necessary */ if (!*tmp_parsed_name_p) if (NULL == (*tmp_parsed_name_p = H5FL_CALLOC(H5O_storage_virtual_name_seg_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct"); /* Check for type of format specifier */ if (pct[1] == 'b') { @@ -1181,7 +1135,7 @@ H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_ /* Append string to name segment */ if (H5D__virtual_str_append(p, (size_t)(pct - p), &name_seg_p, &(*tmp_parsed_name_p)->name_segment, &name_seg_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to append name segment") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to append name segment"); /* Update other variables */ tmp_parsed_name_p = &(*tmp_parsed_name_p)->next; @@ -1194,13 +1148,13 @@ H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_ /* Append string to name segment (include first '%') */ if (H5D__virtual_str_append(p, (size_t)(pct - p) + (size_t)1, &name_seg_p, &(*tmp_parsed_name_p)->name_segment, &name_seg_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to append name segment") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to append name segment"); /* Update other variables */ tmp_static_strlen -= 1; } /* end else */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid format specifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid format specifier"); p = pct + 2; } /* end while */ @@ -1208,21 +1162,21 @@ H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_ /* Copy last segment of name, if any, unless the parsed name was not * allocated */ if (tmp_parsed_name) { - HDassert(p >= source_name); + assert(p >= source_name); if (*p == '\0') - HDassert((size_t)(p - source_name) == tmp_strlen); + assert((size_t)(p - source_name) == tmp_strlen); else { - HDassert((size_t)(p - source_name) < tmp_strlen); + assert((size_t)(p - source_name) < tmp_strlen); /* Allocate name segment struct if necessary */ if (!*tmp_parsed_name_p) if (NULL == (*tmp_parsed_name_p = H5FL_CALLOC(H5O_storage_virtual_name_seg_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct"); /* Append string to name segment */ if (H5D__virtual_str_append(p, tmp_strlen - (size_t)(p - source_name), &name_seg_p, &(*tmp_parsed_name_p)->name_segment, &name_seg_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to append name segment") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to append name segment"); } /* end else */ } /* end if */ @@ -1234,7 +1188,7 @@ H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_ done: if (tmp_parsed_name) { - HDassert(ret_value < 0); + assert(ret_value < 0); H5D_virtual_free_parsed_name(tmp_parsed_name); } /* end if */ @@ -1248,9 +1202,6 @@ H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * May 19, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1264,18 +1215,18 @@ H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst, H5O_storage_ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dst); + assert(dst); /* Walk over parsed name, duplicating it */ while (p_src) { /* Allocate name segment struct */ if (NULL == (*p_dst = H5FL_CALLOC(H5O_storage_virtual_name_seg_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct"); /* Duplicate name segment */ if (p_src->name_segment) { if (NULL == ((*p_dst)->name_segment = H5MM_strdup(p_src->name_segment))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to duplicate name segment") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to duplicate name segment"); } /* end if */ /* Advance pointers */ @@ -1289,7 +1240,7 @@ H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst, H5O_storage_ done: if (tmp_dst) { - HDassert(ret_value < 0); + assert(ret_value < 0); H5D_virtual_free_parsed_name(tmp_dst); } /* end if */ @@ -1303,9 +1254,6 @@ H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst, H5O_storage_ * * Return: void * - * Programmer: Neil Fortner - * May 19, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -1334,9 +1282,6 @@ H5D_virtual_free_parsed_name(H5O_storage_virtual_name_seg_t *name_seg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * May 18, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1349,8 +1294,8 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(source_name); - HDassert(built_name); + assert(source_name); + assert(built_name); /* Check for static name */ if (nsubs == 0) { @@ -1369,7 +1314,7 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name size_t seg_len; size_t nsubs_rem = nsubs; - HDassert(parsed_name); + assert(parsed_name); /* Calculate length of printed block number */ do { @@ -1384,7 +1329,7 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name /* Allocate name buffer */ if (NULL == (tmp_name = (char *)H5MM_malloc(name_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name buffer"); p = tmp_name; /* Build name */ @@ -1392,8 +1337,8 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name /* Add name segment */ if (name_seg->name_segment) { seg_len = HDstrlen(name_seg->name_segment); - HDassert(seg_len > 0); - HDassert(seg_len < name_len_rem); + assert(seg_len > 0); + assert(seg_len < name_len_rem); HDstrncpy(p, name_seg->name_segment, name_len_rem); name_len_rem -= seg_len; p += seg_len; @@ -1401,9 +1346,9 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name /* Add block number */ if (nsubs_rem > 0) { - HDassert(blockno_len < name_len_rem); + assert(blockno_len < name_len_rem); if (HDsnprintf(p, name_len_rem, "%llu", (long long unsigned)blockno) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write block number to string") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write block number to string"); name_len_rem -= blockno_len; p += blockno_len; nsubs_rem--; @@ -1420,7 +1365,7 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name done: if (tmp_name) { - HDassert(ret_value < 0); + assert(ret_value < 0); H5MM_free(tmp_name); } /* end if */ @@ -1437,9 +1382,6 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * April 22, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -1457,14 +1399,14 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); - HDassert(dset->shared->layout.storage.type == H5D_VIRTUAL); + assert(dset); + assert(dset->shared->layout.storage.type == H5D_VIRTUAL); storage = &dset->shared->layout.storage.u.virt; - HDassert((storage->view == H5D_VDS_FIRST_MISSING) || (storage->view == H5D_VDS_LAST_AVAILABLE)); + assert((storage->view == H5D_VDS_FIRST_MISSING) || (storage->view == H5D_VDS_LAST_AVAILABLE)); /* Get rank of VDS */ if ((rank = H5S_GET_EXTENT_NDIMS(dset->shared->space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions"); /* Initialize new_dims to HSIZE_UNDEF */ for (i = 0; i < (size_t)rank; i++) @@ -1481,7 +1423,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) if (!storage->list[i].source_dset.dset) if (H5D__virtual_open_source_dset(dset, &storage->list[i], &storage->list[i].source_dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset"); /* Check if source dataset is open */ if (storage->list[i].source_dset.dset) { @@ -1489,11 +1431,11 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) */ if (H5S_extent_copy(storage->list[i].source_select, storage->list[i].source_dset.dset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy source dataspace extent") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy source dataspace extent"); /* Get source space dimensions */ if (H5S_get_simple_extent_dims(storage->list[i].source_select, curr_dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get source space dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get source space dimensions"); /* Check if the source extent in the unlimited dimension * changed since the last time the VDS extent/mapping @@ -1522,47 +1464,47 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) /* Close previous clipped virtual selection, if * any */ if (storage->list[i].source_dset.clipped_virtual_select) { - HDassert(storage->list[i].source_dset.clipped_virtual_select != - storage->list[i].source_dset.virtual_select); + assert(storage->list[i].source_dset.clipped_virtual_select != + storage->list[i].source_dset.virtual_select); if (H5S_close(storage->list[i].source_dset.clipped_virtual_select) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to release clipped virtual dataspace") + "unable to release clipped virtual dataspace"); } /* end if */ /* Copy virtual selection */ if (NULL == (storage->list[i].source_dset.clipped_virtual_select = H5S_copy( storage->list[i].source_dset.virtual_select, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, - "unable to copy virtual selection") + "unable to copy virtual selection"); /* Clip virtual selection */ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select, clip_size)) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, - "failed to clip unlimited selection") + "failed to clip unlimited selection"); } /* end if */ /* Close previous clipped source selection, if any */ if (storage->list[i].source_dset.clipped_source_select) { - HDassert(storage->list[i].source_dset.clipped_source_select != - storage->list[i].source_select); + assert(storage->list[i].source_dset.clipped_source_select != + storage->list[i].source_select); if (H5S_close(storage->list[i].source_dset.clipped_source_select) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to release clipped source dataspace") + "unable to release clipped source dataspace"); } /* end if */ /* Copy source selection */ if (NULL == (storage->list[i].source_dset.clipped_source_select = H5S_copy(storage->list[i].source_select, FALSE, TRUE))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, - "unable to copy source selection") + "unable to copy source selection"); /* Clip source selection */ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select, curr_dims[storage->list[i].unlim_dim_source])) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, - "failed to clip unlimited selection") + "failed to clip unlimited selection"); } /* end if */ /* Update cached values unlim_extent_source and @@ -1580,7 +1522,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) 0; /* First missing dataset in the current block of missing datasets */ /* Search for source datasets */ - HDassert(storage->printf_gap != HSIZE_UNDEF); + assert(storage->printf_gap != HSIZE_UNDEF); for (j = 0; j <= (storage->printf_gap + first_missing); j++) { /* Check for running out of space in sub_dset array */ if (j >= (hsize_t)storage->list[i].sub_dset_nalloc) { @@ -1590,7 +1532,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) (storage->list[i].sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_calloc( H5D_VIRTUAL_DEF_SUB_DSET_SIZE * sizeof(H5O_storage_virtual_srcdset_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "unable to allocate sub dataset array") + "unable to allocate sub dataset array"); storage->list[i].sub_dset_nalloc = H5D_VIRTUAL_DEF_SUB_DSET_SIZE; } /* end if */ else { @@ -1602,13 +1544,13 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) storage->list[i].sub_dset, 2 * storage->list[i].sub_dset_nalloc * sizeof(H5O_storage_virtual_srcdset_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "unable to extend sub dataset array") + "unable to extend sub dataset array"); storage->list[i].sub_dset = tmp_sub_dset; /* Clear new space in sub_dset */ - (void)HDmemset(&storage->list[i].sub_dset[storage->list[i].sub_dset_nalloc], 0, - storage->list[i].sub_dset_nalloc * - sizeof(H5O_storage_virtual_srcdset_t)); + (void)memset(&storage->list[i].sub_dset[storage->list[i].sub_dset_nalloc], 0, + storage->list[i].sub_dset_nalloc * + sizeof(H5O_storage_virtual_srcdset_t)); /* Update sub_dset_nalloc */ storage->list[i].sub_dset_nalloc *= 2; @@ -1627,7 +1569,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) storage->list[i].psfn_nsubs, j, &storage->list[i].sub_dset[j].file_name) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to build source file name") + "unable to build source file name"); /* Resolve dset name */ if (!storage->list[i].sub_dset[j].dset_name) @@ -1637,7 +1579,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) storage->list[i].psdn_nsubs, j, &storage->list[i].sub_dset[j].dset_name) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to build source dataset name") + "unable to build source dataset name"); /* Resolve virtual selection for block */ if (!storage->list[i].sub_dset[j].virtual_select) @@ -1645,7 +1587,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) (storage->list[i].sub_dset[j].virtual_select = H5S_hyper_get_unlim_block( storage->list[i].source_dset.virtual_select, j))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to get block in unlimited selection") + "unable to get block in unlimited selection"); /* Initialize clipped selections */ if (!storage->list[i].sub_dset[j].clipped_source_select) @@ -1658,7 +1600,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) /* Open source dataset */ if (H5D__virtual_open_source_dset(dset, &storage->list[i], &storage->list[i].sub_dset[j]) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset"); if (storage->list[i].sub_dset[j].dset) { /* Update first_missing */ @@ -1668,7 +1610,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) * numbers of datasets open */ if (H5D_close(storage->list[i].sub_dset[j].dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to close source dataset") + "unable to close source dataset"); storage->list[i].sub_dset[j].dset = NULL; } /* end if */ } /* end else */ @@ -1694,7 +1636,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) if (H5S_SELECT_BOUNDS( storage->list[i].sub_dset[first_missing - (hsize_t)1].virtual_select, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds"); /* Set clip_size to bounds_end in unlimited * dimension */ @@ -1705,7 +1647,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) */ if (H5S_SELECT_BOUNDS(storage->list[i].sub_dset[first_missing].virtual_select, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds"); /* Set clip_size to bounds_start in unlimited * dimension */ @@ -1729,7 +1671,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) /* Get current VDS dimensions */ if (H5S_get_simple_extent_dims(dset->shared->space, curr_dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions"); /* Calculate new extent */ for (i = 0; i < (size_t)rank; i++) { @@ -1745,12 +1687,12 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) if (changed) { /* Update VDS extent */ if (H5S_set_extent(dset->shared->space, new_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace"); /* Mark the space as dirty, for later writing to the file */ if (H5F_INTENT(dset->oloc.file) & H5F_ACC_RDWR) if (H5D__mark(dset, H5D_MARK_SPACE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty"); } /* end if */ /* If we did not change the VDS dimensions, there is nothing more to update @@ -1770,22 +1712,22 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) /* Non-printf mapping */ /* Close previous clipped virtual selection, if any */ if (storage->list[i].source_dset.clipped_virtual_select) { - HDassert(storage->list[i].source_dset.clipped_virtual_select != - storage->list[i].source_dset.virtual_select); + assert(storage->list[i].source_dset.clipped_virtual_select != + storage->list[i].source_dset.virtual_select); if (H5S_close(storage->list[i].source_dset.clipped_virtual_select) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to release clipped virtual dataspace") + "unable to release clipped virtual dataspace"); } /* end if */ /* Copy virtual selection */ if (NULL == (storage->list[i].source_dset.clipped_virtual_select = H5S_copy(storage->list[i].source_dset.virtual_select, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection"); /* Clip space to virtual extent */ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select, new_dims[storage->list[i].unlim_dim_source])) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection"); /* Get size that source selection will be clipped to to * match size of virtual selection */ @@ -1797,22 +1739,23 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) if (clip_size != storage->list[i].clip_size_source) { /* Close previous clipped source selection, if any */ if (storage->list[i].source_dset.clipped_source_select) { - HDassert(storage->list[i].source_dset.clipped_source_select != - storage->list[i].source_select); + assert(storage->list[i].source_dset.clipped_source_select != + storage->list[i].source_select); if (H5S_close(storage->list[i].source_dset.clipped_source_select) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to release clipped source dataspace") + "unable to release clipped source dataspace"); } /* end if */ /* Copy source selection */ if (NULL == (storage->list[i].source_dset.clipped_source_select = H5S_copy(storage->list[i].source_select, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection"); /* Clip source selection */ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select, clip_size)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, + "failed to clip unlimited selection"); /* Update cached value clip_size_source */ storage->list[i].clip_size_source = clip_size; @@ -1837,7 +1780,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) if (storage->list[i].sub_dset[j].clipped_source_select) if (H5S_close(storage->list[i].sub_dset[j].clipped_source_select) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to release clipped source dataspace") + "unable to release clipped source dataspace"); /* Initialize clipped source selection to point to * base source selection */ @@ -1851,7 +1794,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) if (storage->list[i].sub_dset[j].clipped_virtual_select) if (H5S_close(storage->list[i].sub_dset[j].clipped_virtual_select) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to release clipped virtual dataspace") + "unable to release clipped virtual dataspace"); /* Initialize clipped virtual selection to point to * unclipped virtual selection */ @@ -1880,27 +1823,28 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) /* Update top level virtual_select and clipped_virtual_select * extents */ if (H5S_set_extent(storage->list[i].source_dset.virtual_select, new_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace"); if ((storage->list[i].source_dset.clipped_virtual_select != storage->list[i].source_dset.virtual_select) && storage->list[i].source_dset.clipped_virtual_select) if (H5S_set_extent(storage->list[i].source_dset.clipped_virtual_select, new_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace"); /* Update sub dataset virtual_select and clipped_virtual_select * extents */ for (j = 0; j < storage->list[i].sub_dset_nalloc; j++) if (storage->list[i].sub_dset[j].virtual_select) { if (H5S_set_extent(storage->list[i].sub_dset[j].virtual_select, new_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace"); if ((storage->list[i].sub_dset[j].clipped_virtual_select != storage->list[i].sub_dset[j].virtual_select) && storage->list[i].sub_dset[j].clipped_virtual_select) if (H5S_set_extent(storage->list[i].sub_dset[j].clipped_virtual_select, new_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to modify size of dataspace"); } /* end if */ else - HDassert(!storage->list[i].sub_dset[j].clipped_virtual_select); + assert(!storage->list[i].sub_dset[j].clipped_virtual_select); } /* end for */ } /* end if */ @@ -1921,9 +1865,6 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * August 10, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1939,14 +1880,14 @@ H5D__virtual_init_all(const H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); - HDassert(dset->shared->layout.storage.type == H5D_VIRTUAL); + assert(dset); + assert(dset->shared->layout.storage.type == H5D_VIRTUAL); storage = &dset->shared->layout.storage.u.virt; - HDassert((storage->view == H5D_VDS_FIRST_MISSING) || (storage->view == H5D_VDS_LAST_AVAILABLE)); + assert((storage->view == H5D_VDS_FIRST_MISSING) || (storage->view == H5D_VDS_LAST_AVAILABLE)); /* Get current VDS dimensions */ if (H5S_get_simple_extent_dims(dset->shared->space, virtual_dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions"); /* Iterate over mappings */ for (i = 0; i < storage->list_nused; i++) @@ -1959,7 +1900,7 @@ H5D__virtual_init_all(const H5D_t *dset) if (!storage->list[i].source_dset.dset) if (H5D__virtual_open_source_dset(dset, &storage->list[i], &storage->list[i].source_dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset"); /* Check if source dataset is open */ if (storage->list[i].source_dset.dset) { @@ -1967,11 +1908,11 @@ H5D__virtual_init_all(const H5D_t *dset) */ if (H5S_extent_copy(storage->list[i].source_select, storage->list[i].source_dset.dset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy source dataspace extent") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy source dataspace extent"); /* Get source space dimensions */ if (H5S_get_simple_extent_dims(storage->list[i].source_select, source_dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get source space dimensions") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get source space dimensions"); /* Get size that source selection would be clipped to to * match size of virtual selection */ @@ -1981,31 +1922,31 @@ H5D__virtual_init_all(const H5D_t *dset) /* Close previous clipped virtual selection, if any */ if (storage->list[i].source_dset.clipped_virtual_select) { - HDassert(storage->list[i].source_dset.clipped_virtual_select != - storage->list[i].source_dset.virtual_select); + assert(storage->list[i].source_dset.clipped_virtual_select != + storage->list[i].source_dset.virtual_select); if (H5S_close(storage->list[i].source_dset.clipped_virtual_select) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to release clipped virtual dataspace") + "unable to release clipped virtual dataspace"); } /* end if */ /* Copy virtual selection */ if (NULL == (storage->list[i].source_dset.clipped_virtual_select = H5S_copy(storage->list[i].source_dset.virtual_select, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection"); /* Close previous clipped source selection, if any */ if (storage->list[i].source_dset.clipped_source_select) { - HDassert(storage->list[i].source_dset.clipped_source_select != - storage->list[i].source_select); + assert(storage->list[i].source_dset.clipped_source_select != + storage->list[i].source_select); if (H5S_close(storage->list[i].source_dset.clipped_source_select) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to release clipped source dataspace") + "unable to release clipped source dataspace"); } /* end if */ /* Copy source selection */ if (NULL == (storage->list[i].source_dset.clipped_source_select = H5S_copy(storage->list[i].source_select, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy source selection"); /* Check if the clip size is within the current extent of * the source dataset */ @@ -2013,12 +1954,14 @@ H5D__virtual_init_all(const H5D_t *dset) /* Clip virtual selection to extent */ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select, virtual_dims[storage->list[i].unlim_dim_virtual])) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, + "failed to clip unlimited selection"); /* Clip source selection to clip_size */ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select, clip_size)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, + "failed to clip unlimited selection"); } /* end if */ else { /* Get size that virtual selection will be clipped to to @@ -2031,17 +1974,19 @@ H5D__virtual_init_all(const H5D_t *dset) /* Clip virtual selection to clip_size */ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_virtual_select, clip_size)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, + "failed to clip unlimited selection"); /* Clip source selection to extent */ if (H5S_hyper_clip_unlim(storage->list[i].source_dset.clipped_source_select, source_dims[storage->list[i].unlim_dim_source])) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, + "failed to clip unlimited selection"); } /* end else */ } /* end if */ else { - HDassert(!storage->list[i].source_dset.clipped_virtual_select); - HDassert(!storage->list[i].source_dset.clipped_source_select); + assert(!storage->list[i].source_dset.clipped_virtual_select); + assert(!storage->list[i].source_dset.clipped_source_select); } /* end else */ } /* end if */ else { @@ -2061,7 +2006,8 @@ H5D__virtual_init_all(const H5D_t *dset) /* Allocate sub_dset array */ if (NULL == (storage->list[i].sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_calloc( sub_dset_max * sizeof(H5O_storage_virtual_srcdset_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate sub dataset array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "unable to allocate sub dataset array"); /* Update sub_dset_nalloc */ storage->list[i].sub_dset_nalloc = sub_dset_max; @@ -2073,13 +2019,13 @@ H5D__virtual_init_all(const H5D_t *dset) if (NULL == (tmp_sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_realloc( storage->list[i].sub_dset, sub_dset_max * sizeof(H5O_storage_virtual_srcdset_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to extend sub dataset array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to extend sub dataset array"); storage->list[i].sub_dset = tmp_sub_dset; /* Clear new space in sub_dset */ - (void)HDmemset(&storage->list[i].sub_dset[storage->list[i].sub_dset_nalloc], 0, - (sub_dset_max - storage->list[i].sub_dset_nalloc) * - sizeof(H5O_storage_virtual_srcdset_t)); + (void)memset(&storage->list[i].sub_dset[storage->list[i].sub_dset_nalloc], 0, + (sub_dset_max - storage->list[i].sub_dset_nalloc) * + sizeof(H5O_storage_virtual_srcdset_t)); /* Update sub_dset_nalloc */ storage->list[i].sub_dset_nalloc = sub_dset_max; @@ -2093,7 +2039,7 @@ H5D__virtual_init_all(const H5D_t *dset) storage->list[i].source_file_name, storage->list[i].parsed_source_file_name, storage->list[i].psfn_static_strlen, storage->list[i].psfn_nsubs, j, &storage->list[i].sub_dset[j].file_name) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to build source file name") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to build source file name"); /* Resolve dset name */ if (!storage->list[i].sub_dset[j].dset_name) @@ -2101,14 +2047,15 @@ H5D__virtual_init_all(const H5D_t *dset) storage->list[i].source_dset_name, storage->list[i].parsed_source_dset_name, storage->list[i].psdn_static_strlen, storage->list[i].psdn_nsubs, j, &storage->list[i].sub_dset[j].dset_name) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to build source dataset name") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, + "unable to build source dataset name"); /* Resolve virtual selection for block */ if (!storage->list[i].sub_dset[j].virtual_select) if (NULL == (storage->list[i].sub_dset[j].virtual_select = H5S_hyper_get_unlim_block( storage->list[i].source_dset.virtual_select, j))) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to get block in unlimited selection") + "unable to get block in unlimited selection"); /* Close previous clipped source selection, if any */ if (storage->list[i].sub_dset[j].clipped_source_select != @@ -2116,7 +2063,7 @@ H5D__virtual_init_all(const H5D_t *dset) if (storage->list[i].sub_dset[j].clipped_source_select) if (H5S_close(storage->list[i].sub_dset[j].clipped_source_select) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to release clipped source dataspace") + "unable to release clipped source dataspace"); /* Initialize clipped source selection to point to base * source selection */ @@ -2129,7 +2076,7 @@ H5D__virtual_init_all(const H5D_t *dset) if (storage->list[i].sub_dset[j].clipped_virtual_select) if (H5S_close(storage->list[i].sub_dset[j].clipped_virtual_select) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "unable to release clipped virtual dataspace") + "unable to release clipped virtual dataspace"); /* Initialize clipped virtual selection to point to * unclipped virtual selection */ @@ -2157,8 +2104,8 @@ H5D__virtual_init_all(const H5D_t *dset) else { /* Limited mapping, just make sure the clipped selections were * already set. Again, no need to open the source file. */ - HDassert(storage->list[i].source_dset.clipped_virtual_select); - HDassert(storage->list[i].source_dset.clipped_source_select); + assert(storage->list[i].source_dset.clipped_virtual_select); + assert(storage->list[i].source_dset.clipped_source_select); } /* end else */ /* Mark layout as fully initialized */ @@ -2176,9 +2123,6 @@ H5D__virtual_init_all(const H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Thursday, April 30, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -2193,15 +2137,15 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); + assert(dset); storage = &dset->shared->layout.storage.u.virt; - HDassert(storage->list || (storage->list_nused == 0)); + assert(storage->list || (storage->list_nused == 0)); /* Check that the dimensions of the VDS are large enough */ if (H5D_virtual_check_min_dims(dset) < 0) - HGOTO_ERROR( - H5E_ARGS, H5E_BADVALUE, FAIL, - "virtual dataset dimensions not large enough to contain all limited dimensions in all selections") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "virtual dataset dimensions not large enough to contain all limited dimensions in all " + "selections"); /* Patch the virtual selection dataspaces. Note we always patch the space * status because this layout could be from an old version held in the @@ -2212,11 +2156,11 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) * source_space_status and virtual_space_status because others will be based * on these and should therefore already have been normalized. */ for (i = 0; i < storage->list_nused; i++) { - HDassert(storage->list[i].sub_dset_nalloc == 0); + assert(storage->list[i].sub_dset_nalloc == 0); /* Patch extent */ if (H5S_extent_copy(storage->list[i].source_dset.virtual_select, dset->shared->space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy virtual dataspace extent") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy virtual dataspace extent"); storage->list[i].virtual_space_status = H5O_VIRTUAL_STATUS_CORRECT; /* Mark source extent as invalid */ @@ -2224,23 +2168,23 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) /* Normalize offsets, toss out old offset values */ if (H5S_hyper_normalize_offset(storage->list[i].source_dset.virtual_select, old_offset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset") + HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset"); if (H5S_hyper_normalize_offset(storage->list[i].source_select, old_offset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset") + HGOTO_ERROR(H5E_DATASET, H5E_BADSELECT, FAIL, "unable to normalize dataspace by offset"); } /* end for */ /* Get dataset access property list */ if (NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for dapl ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for dapl ID"); /* Get view option */ if (H5P_get(dapl, H5D_ACS_VDS_VIEW_NAME, &storage->view) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get virtual view option") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get virtual view option"); /* Get printf gap if view is H5D_VDS_LAST_AVAILABLE, otherwise set to 0 */ if (storage->view == H5D_VDS_LAST_AVAILABLE) { if (H5P_get(dapl, H5D_ACS_VDS_PRINTF_GAP_NAME, &storage->printf_gap) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get virtual printf gap") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get virtual printf gap"); } /* end if */ else storage->printf_gap = (hsize_t)0; @@ -2251,15 +2195,15 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) H5F_close_degree_t close_degree = H5F_CLOSE_WEAK; /* Close degree for source files */ if ((storage->source_fapl = H5F_get_access_plist(f, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fapl") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get fapl"); /* Get property list pointer */ if (NULL == (source_fapl = (H5P_genplist_t *)H5I_object(storage->source_fapl))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); /* Source files must always be opened with H5F_CLOSE_WEAK close degree */ if (H5P_set(source_fapl, H5F_ACS_CLOSE_DEGREE_NAME, &close_degree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree"); } /* end if */ #ifndef NDEBUG else { @@ -2268,20 +2212,20 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) /* Get property list pointer */ if (NULL == (source_fapl = (H5P_genplist_t *)H5I_object(storage->source_fapl))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); /* Verify H5F_CLOSE_WEAK close degree is set */ if (H5P_get(source_fapl, H5F_ACS_CLOSE_DEGREE_NAME, &close_degree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree"); - HDassert(close_degree == H5F_CLOSE_WEAK); + assert(close_degree == H5F_CLOSE_WEAK); } /* end else */ #endif /* NDEBUG */ /* Copy DAPL to layout */ if (storage->source_dapl <= 0) if ((storage->source_dapl = H5P_copy_plist(dapl, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dapl") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dapl"); /* Mark layout as not fully initialized (must be done prior to I/O for * unlimited/printf selections) */ @@ -2300,9 +2244,6 @@ H5D__virtual_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id) * FALSE if it is not * Negative on failure * - * Programmer: Neil Fortner - * February 6, 2015 - * *------------------------------------------------------------------------- */ hbool_t @@ -2329,9 +2270,6 @@ H5D__virtual_is_space_alloc(const H5O_storage_t H5_ATTR_UNUSED *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Wednesday, March 6, 2016 - * *------------------------------------------------------------------------- */ static hbool_t @@ -2344,7 +2282,7 @@ H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(shared_dset); + assert(shared_dset); storage = &shared_dset->layout.storage.u.virt; /* Iterate over mappings */ @@ -2370,6 +2308,27 @@ H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset) FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_is_data_cached() */ +/*------------------------------------------------------------------------- + * Function: H5D__virtual_io_init + * + * Purpose: Performs initialization before any sort of I/O on the raw data + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__virtual_io_init(H5D_io_info_t *io_info, H5D_dset_io_info_t H5_ATTR_UNUSED *dinfo) +{ + FUNC_ENTER_PACKAGE_NOERR + + /* Disable selection I/O */ + io_info->use_select_io = H5D_SELECTION_IO_MODE_OFF; + io_info->no_selection_io_cause |= H5D_SEL_IO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__virtual_io_init() */ + /*------------------------------------------------------------------------- * Function: H5D__virtual_pre_io * @@ -2380,35 +2339,33 @@ H5D__virtual_is_data_cached(const H5D_shared_t *shared_dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * June 3, 2015 - * *------------------------------------------------------------------------- */ static herr_t -H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_t *file_space, +H5D__virtual_pre_io(H5D_dset_io_info_t *dset_info, H5O_storage_virtual_t *storage, H5S_t *file_space, H5S_t *mem_space, hsize_t *tot_nelmts) { - hssize_t select_nelmts; /* Number of elements in selection */ - hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */ - hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds end */ - int rank = 0; - hbool_t bounds_init = FALSE; /* Whether bounds_start, bounds_end, and rank are valid */ - size_t i, j, k; /* Local index variables */ - herr_t ret_value = SUCCEED; /* Return value */ + const H5D_t *dset = dset_info->dset; /* Local pointer to dataset info */ + hssize_t select_nelmts; /* Number of elements in selection */ + hsize_t bounds_start[H5S_MAX_RANK]; /* Selection bounds start */ + hsize_t bounds_end[H5S_MAX_RANK]; /* Selection bounds end */ + int rank = 0; + hbool_t bounds_init = FALSE; /* Whether bounds_start, bounds_end, and rank are valid */ + size_t i, j, k; /* Local index variables */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(storage); - HDassert(mem_space); - HDassert(file_space); - HDassert(tot_nelmts); + assert(storage); + assert(mem_space); + assert(file_space); + assert(tot_nelmts); /* Initialize layout if necessary */ if (!storage->init) - if (H5D__virtual_init_all(io_info->dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize virtual layout") + if (H5D__virtual_init_all(dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize virtual layout"); /* Initialize tot_nelmts */ *tot_nelmts = 0; @@ -2416,23 +2373,23 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ /* Iterate over mappings */ for (i = 0; i < storage->list_nused; i++) { /* Sanity check that the virtual space has been patched by now */ - HDassert(storage->list[i].virtual_space_status == H5O_VIRTUAL_STATUS_CORRECT); + assert(storage->list[i].virtual_space_status == H5O_VIRTUAL_STATUS_CORRECT); /* Check for "printf" source dataset resolution */ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) { hbool_t partial_block; - HDassert(storage->list[i].unlim_dim_virtual >= 0); + assert(storage->list[i].unlim_dim_virtual >= 0); /* Get selection bounds if necessary */ if (!bounds_init) { /* Get rank of VDS */ - if ((rank = H5S_GET_EXTENT_NDIMS(io_info->dset->shared->space)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions") + if ((rank = H5S_GET_EXTENT_NDIMS(dset->shared->space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get number of dimensions"); /* Get selection bounds */ if (H5S_SELECT_BOUNDS(file_space, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds"); /* Adjust bounds_end to represent the extent just enclosing them * (add 1) */ @@ -2463,15 +2420,15 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ if (!storage->list[i].sub_dset[j].clipped_virtual_select) { hsize_t start[H5S_MAX_RANK]; /* This should only be NULL if this is a partial block */ - HDassert((j == (storage->list[i].sub_dset_io_end - 1)) && partial_block); + assert((j == (storage->list[i].sub_dset_io_end - 1)) && partial_block); /* If the source space status is not correct, we must try to * open the source dataset to patch it */ if (storage->list[i].source_space_status != H5O_VIRTUAL_STATUS_CORRECT) { - HDassert(!storage->list[i].sub_dset[j].dset); - if (H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], + assert(!storage->list[i].sub_dset[j].dset); + if (H5D__virtual_open_source_dset(dset, &storage->list[i], &storage->list[i].sub_dset[j]) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset"); } /* end if */ /* If we obtained a valid source space, we must create @@ -2486,9 +2443,9 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ /* Get bounds of virtual selection */ if (H5S_SELECT_BOUNDS(storage->list[i].sub_dset[j].virtual_select, tmp_dims, vbounds_end) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds"); - HDassert(bounds_init); + assert(bounds_init); /* Convert bounds to extent (add 1) */ for (k = 0; k < (size_t)rank; k++) @@ -2496,22 +2453,23 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ /* Temporarily set extent of virtual selection to bounds */ if (H5S_set_extent(storage->list[i].sub_dset[j].virtual_select, vbounds_end) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to modify size of dataspace"); /* Get current VDS dimensions */ - if (H5S_get_simple_extent_dims(io_info->dset->shared->space, tmp_dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions") + if (H5S_get_simple_extent_dims(dset->shared->space, tmp_dims, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get VDS dimensions"); /* Copy virtual selection */ if (NULL == (storage->list[i].sub_dset[j].clipped_virtual_select = H5S_copy(storage->list[i].sub_dset[j].virtual_select, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy virtual selection"); /* Clip virtual selection to real virtual extent */ - (void)HDmemset(start, 0, sizeof(start)); + (void)memset(start, 0, sizeof(start)); if (H5S_select_hyperslab(storage->list[i].sub_dset[j].clipped_virtual_select, H5S_SELECT_AND, start, NULL, tmp_dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to clip hyperslab") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to clip hyperslab"); /* Project intersection of virtual space and clipped * virtual space onto source space (create @@ -2521,14 +2479,16 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].clipped_source_select, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, - "can't project virtual intersection onto memory space") + "can't project virtual intersection onto memory space"); /* Set extents of virtual_select and * clipped_virtual_select to virtual extent */ if (H5S_set_extent(storage->list[i].sub_dset[j].virtual_select, tmp_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to modify size of dataspace"); if (H5S_set_extent(storage->list[i].sub_dset[j].clipped_virtual_select, tmp_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of dataspace") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, + "unable to modify size of dataspace"); } /* end if */ } /* end if */ @@ -2541,23 +2501,23 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ file_space, mem_space, storage->list[i].sub_dset[j].clipped_virtual_select, &storage->list[i].sub_dset[j].projected_mem_space, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, - "can't project virtual intersection onto memory space") + "can't project virtual intersection onto memory space"); /* Check number of elements selected */ if ((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS( storage->list[i].sub_dset[j].projected_mem_space)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, - "unable to get number of elements in selection") + "unable to get number of elements in selection"); /* Check if anything is selected */ if (select_nelmts > (hssize_t)0) { /* Open source dataset */ if (!storage->list[i].sub_dset[j].dset) /* Try to open dataset */ - if (H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], + if (H5D__virtual_open_source_dset(dset, &storage->list[i], &storage->list[i].sub_dset[j]) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, - "unable to open source dataset") + "unable to open source dataset"); /* If the source dataset is not open, mark the selected * elements as zero so projected_mem_space is freed */ @@ -2570,7 +2530,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ if (select_nelmts == (hssize_t)0) { if (H5S_close(storage->list[i].sub_dset[j].projected_mem_space) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, - "can't close projected memory space") + "can't close projected memory space"); storage->list[i].sub_dset[j].projected_mem_space = NULL; } /* end if */ else @@ -2586,22 +2546,22 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ file_space, mem_space, storage->list[i].source_dset.clipped_virtual_select, &storage->list[i].source_dset.projected_mem_space, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, - "can't project virtual intersection onto memory space") + "can't project virtual intersection onto memory space"); /* Check number of elements selected, add to tot_nelmts */ if ((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS( storage->list[i].source_dset.projected_mem_space)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, - "unable to get number of elements in selection") + "unable to get number of elements in selection"); /* Check if anything is selected */ if (select_nelmts > (hssize_t)0) { /* Open source dataset */ if (!storage->list[i].source_dset.dset) /* Try to open dataset */ - if (H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], + if (H5D__virtual_open_source_dset(dset, &storage->list[i], &storage->list[i].source_dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset"); /* If the source dataset is not open, mark the selected elements * as zero so projected_mem_space is freed */ @@ -2613,7 +2573,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ * projected_mem_space, otherwise update tot_nelmts */ if (select_nelmts == (hssize_t)0) { if (H5S_close(storage->list[i].source_dset.projected_mem_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space") + HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space"); storage->list[i].source_dset.projected_mem_space = NULL; } /* end if */ else @@ -2625,8 +2585,8 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ * H5Dget_space(). Do not attempt to open it as this might * affect the extent and we are not going to recalculate it * here. */ - HDassert(storage->list[i].unlim_dim_virtual >= 0); - HDassert(!storage->list[i].source_dset.dset); + assert(storage->list[i].unlim_dim_virtual >= 0); + assert(!storage->list[i].source_dset.dset); } /* end else */ } /* end else */ } /* end for */ @@ -2642,9 +2602,6 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, H5O_storage_virtual_t *storage, H5S_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * June 4, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -2656,7 +2613,7 @@ H5D__virtual_post_io(H5O_storage_virtual_t *storage) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(storage); + assert(storage); /* Iterate over mappings */ for (i = 0; i < storage->list_nused; i++) @@ -2667,7 +2624,7 @@ H5D__virtual_post_io(H5O_storage_virtual_t *storage) /* Close projected memory space */ if (storage->list[i].sub_dset[j].projected_mem_space) { if (H5S_close(storage->list[i].sub_dset[j].projected_mem_space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close temporary space") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close temporary space"); storage->list[i].sub_dset[j].projected_mem_space = NULL; } /* end if */ } /* end if */ @@ -2675,7 +2632,7 @@ H5D__virtual_post_io(H5O_storage_virtual_t *storage) /* Close projected memory space */ if (storage->list[i].source_dset.projected_mem_space) { if (H5S_close(storage->list[i].source_dset.projected_mem_space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close temporary space") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close temporary space"); storage->list[i].source_dset.projected_mem_space = NULL; } /* end if */ @@ -2691,54 +2648,59 @@ H5D__virtual_post_io(H5O_storage_virtual_t *storage) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * May 15, 2015 - * *------------------------------------------------------------------------- */ static herr_t -H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5S_t *file_space, - H5O_storage_virtual_srcdset_t *source_dset) +H5D__virtual_read_one(H5D_dset_io_info_t *dset_info, H5O_storage_virtual_srcdset_t *source_dset) { - H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */ - herr_t ret_value = SUCCEED; /* Return value */ + H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */ + H5D_dset_io_info_t source_dinfo; /* Dataset info for source dataset read */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - HDassert(source_dset); + assert(source_dset); /* Only perform I/O if there is a projected memory space, otherwise there * were no elements in the projection or the source dataset could not be * opened */ if (source_dset->projected_mem_space) { - HDassert(source_dset->dset); - HDassert(source_dset->clipped_source_select); + assert(source_dset->dset); + assert(source_dset->clipped_source_select); /* Project intersection of file space and mapping virtual space onto * mapping source space */ if (H5S_select_project_intersection(source_dset->clipped_virtual_select, - source_dset->clipped_source_select, file_space, + source_dset->clipped_source_select, dset_info->file_space, &projected_src_space, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, - "can't project virtual intersection onto source space") + "can't project virtual intersection onto source space"); + + { + /* Initialize source_dinfo */ + source_dinfo.dset = source_dset->dset; + source_dinfo.mem_space = source_dset->projected_mem_space; + source_dinfo.file_space = projected_src_space; + source_dinfo.buf.vp = dset_info->buf.vp; + source_dinfo.mem_type_id = dset_info->type_info.dst_type_id; - /* Perform read on source dataset */ - if (H5D__read(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, - projected_src_space, io_info->u.rbuf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read source dataset") + /* Read in the point (with the custom VL memory allocator) */ + if (H5D__read(1, &source_dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read source dataset"); + } /* Close projected_src_space */ if (H5S_close(projected_src_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space") + HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space"); projected_src_space = NULL; } /* end if */ done: - /* Release allocated resources on failure */ + /* Release allocated resources */ if (projected_src_space) { - HDassert(ret_value < 0); + assert(ret_value < 0); if (H5S_close(projected_src_space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -2751,59 +2713,59 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * February 6, 2015 - * *------------------------------------------------------------------------- */ static herr_t -H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, H5S_t *file_space, - H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm) +H5D__virtual_read(H5D_io_info_t H5_ATTR_NDEBUG_UNUSED *io_info, H5D_dset_io_info_t *dset_info) { H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */ hsize_t tot_nelmts; /* Total number of elements mapped to mem_space */ H5S_t *fill_space = NULL; /* Space to fill with fill value */ + size_t nelmts; /* Number of elements to process */ size_t i, j; /* Local index variables */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(io_info->u.rbuf); - HDassert(type_info); - HDassert(mem_space); - HDassert(file_space); + assert(io_info); + assert(dset_info); + assert(dset_info->buf.vp); + assert(dset_info->mem_space); + assert(dset_info->file_space); - storage = &io_info->dset->shared->layout.storage.u.virt; - HDassert((storage->view == H5D_VDS_FIRST_MISSING) || (storage->view == H5D_VDS_LAST_AVAILABLE)); + storage = &(dset_info->dset->shared->layout.storage.u.virt); + assert((storage->view == H5D_VDS_FIRST_MISSING) || (storage->view == H5D_VDS_LAST_AVAILABLE)); + + /* Initialize nelmts */ + nelmts = H5S_GET_SELECT_NPOINTS(dset_info->file_space); #ifdef H5_HAVE_PARALLEL /* Parallel reads are not supported (yet) */ - if (H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_HAS_MPI)) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "parallel reads not supported on virtual datasets") + if (H5F_HAS_FEATURE(dset_info->dset->oloc.file, H5FD_FEAT_HAS_MPI)) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "parallel reads not supported on virtual datasets"); #endif /* H5_HAVE_PARALLEL */ /* Prepare for I/O operation */ - if (H5D__virtual_pre_io(io_info, storage, file_space, mem_space, &tot_nelmts) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to prepare for I/O operation") + if (H5D__virtual_pre_io(dset_info, storage, dset_info->file_space, dset_info->mem_space, &tot_nelmts) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to prepare for I/O operation"); /* Iterate over mappings */ for (i = 0; i < storage->list_nused; i++) { /* Sanity check that the virtual space has been patched by now */ - HDassert(storage->list[i].virtual_space_status == H5O_VIRTUAL_STATUS_CORRECT); + assert(storage->list[i].virtual_space_status == H5O_VIRTUAL_STATUS_CORRECT); /* Check for "printf" source dataset resolution */ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) { /* Iterate over sub-source dsets */ for (j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++) - if (H5D__virtual_read_one(io_info, type_info, file_space, &storage->list[i].sub_dset[j]) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read source dataset") + if (H5D__virtual_read_one(dset_info, &storage->list[i].sub_dset[j]) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read source dataset"); } /* end if */ else /* Read from source dataset */ - if (H5D__virtual_read_one(io_info, type_info, file_space, &storage->list[i].source_dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read source dataset") + if (H5D__virtual_read_one(dset_info, &storage->list[i].source_dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read source dataset"); } /* end for */ /* Fill unmapped part of buffer with fill value */ @@ -2811,14 +2773,14 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsiz H5D_fill_value_t fill_status; /* Fill value status */ /* Check the fill value status */ - if (H5P_is_fill_value_defined(&io_info->dset->shared->dcpl_cache.fill, &fill_status) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if fill value defined") + if (H5P_is_fill_value_defined(&dset_info->dset->shared->dcpl_cache.fill, &fill_status) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if fill value defined"); /* Always write fill value to memory buffer unless it is undefined */ if (fill_status != H5D_FILL_VALUE_UNDEFINED) { /* Start with fill space equal to memory space */ - if (NULL == (fill_space = H5S_copy(mem_space, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy memory selection") + if (NULL == (fill_space = H5S_copy(dset_info->mem_space, FALSE, TRUE))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy memory selection"); /* Iterate over mappings */ for (i = 0; i < storage->list_nused; i++) @@ -2829,17 +2791,17 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsiz if (storage->list[i].sub_dset[j].projected_mem_space) if (H5S_select_subtract(fill_space, storage->list[i].sub_dset[j].projected_mem_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection"); } /* end if */ else if (storage->list[i].source_dset.projected_mem_space) /* Subtract projected memory space from fill space */ if (H5S_select_subtract(fill_space, storage->list[i].source_dset.projected_mem_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection"); /* Write fill values to memory buffer */ - if (H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, - io_info->u.rbuf, type_info->mem_type, fill_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "filling buf failed") + if (H5D__fill(dset_info->dset->shared->dcpl_cache.fill.buf, dset_info->dset->shared->type, + dset_info->buf.vp, dset_info->type_info.mem_type, fill_space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "filling buf failed"); #ifndef NDEBUG /* Make sure the total number of elements written (including fill @@ -2850,12 +2812,12 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsiz /* Get number of elements in fill dataspace */ if ((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(fill_space)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, - "unable to get number of elements in selection") + "unable to get number of elements in selection"); /* Verify number of elements is correct. Note that since we * don't check for overlap we can't assert that these are equal */ - HDassert((tot_nelmts + (hsize_t)select_nelmts) >= nelmts); + assert((tot_nelmts + (hsize_t)select_nelmts) >= nelmts); } /* end block */ #endif /* NDEBUG */ } /* end if */ @@ -2864,12 +2826,12 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsiz done: /* Cleanup I/O operation */ if (H5D__virtual_post_io(storage) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't cleanup I/O operation") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't cleanup I/O operation"); /* Close fill space */ if (fill_space) if (H5S_close(fill_space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close fill space") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close fill space"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_read() */ @@ -2881,27 +2843,24 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsiz * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * May 15, 2015 - * *------------------------------------------------------------------------- */ static herr_t -H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5S_t *file_space, - H5O_storage_virtual_srcdset_t *source_dset) +H5D__virtual_write_one(H5D_dset_io_info_t *dset_info, H5O_storage_virtual_srcdset_t *source_dset) { - H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */ - herr_t ret_value = SUCCEED; /* Return value */ + H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */ + H5D_dset_io_info_t source_dinfo; /* Dataset info for source dataset write */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - HDassert(source_dset); + assert(source_dset); /* Only perform I/O if there is a projected memory space, otherwise there * were no elements in the projection */ if (source_dset->projected_mem_space) { - HDassert(source_dset->dset); - HDassert(source_dset->clipped_source_select); + assert(source_dset->dset); + assert(source_dset->clipped_source_select); /* In the future we may wish to extent this implementation to extend * source datasets if a write to a virtual dataset goes past the current @@ -2909,28 +2868,36 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, /* Project intersection of file space and mapping virtual space onto * mapping source space */ if (H5S_select_project_intersection(source_dset->clipped_virtual_select, - source_dset->clipped_source_select, file_space, + source_dset->clipped_source_select, dset_info->file_space, &projected_src_space, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, - "can't project virtual intersection onto source space") + "can't project virtual intersection onto source space"); - /* Perform write on source dataset */ - if (H5D__write(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, - projected_src_space, io_info->u.wbuf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write to source dataset") + { + /* Initialize source_dinfo */ + source_dinfo.dset = source_dset->dset; + source_dinfo.mem_space = source_dset->projected_mem_space; + source_dinfo.file_space = projected_src_space; + source_dinfo.buf.cvp = dset_info->buf.cvp; + source_dinfo.mem_type_id = dset_info->type_info.dst_type_id; + + /* Read in the point (with the custom VL memory allocator) */ + if (H5D__write(1, &source_dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read source dataset"); + } /* Close projected_src_space */ if (H5S_close(projected_src_space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space") + HGOTO_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space"); projected_src_space = NULL; } /* end if */ done: - /* Release allocated resources on failure */ + /* Release allocated resources */ if (projected_src_space) { - HDassert(ret_value < 0); + assert(ret_value < 0); if (H5S_close(projected_src_space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -2943,70 +2910,70 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * February 6, 2015 - * *------------------------------------------------------------------------- */ static herr_t -H5D__virtual_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, - H5S_t *file_space, H5S_t *mem_space, H5D_chunk_map_t H5_ATTR_UNUSED *fm) +H5D__virtual_write(H5D_io_info_t H5_ATTR_NDEBUG_UNUSED *io_info, H5D_dset_io_info_t *dset_info) { H5O_storage_virtual_t *storage; /* Convenient pointer into layout struct */ hsize_t tot_nelmts; /* Total number of elements mapped to mem_space */ + size_t nelmts; /* Number of elements to process */ size_t i, j; /* Local index variables */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(io_info); - HDassert(io_info->u.wbuf); - HDassert(type_info); - HDassert(mem_space); - HDassert(file_space); + assert(io_info); + assert(dset_info); + assert(dset_info->buf.cvp); + assert(dset_info->mem_space); + assert(dset_info->file_space); + + storage = &(dset_info->dset->shared->layout.storage.u.virt); + assert((storage->view == H5D_VDS_FIRST_MISSING) || (storage->view == H5D_VDS_LAST_AVAILABLE)); - storage = &io_info->dset->shared->layout.storage.u.virt; - HDassert((storage->view == H5D_VDS_FIRST_MISSING) || (storage->view == H5D_VDS_LAST_AVAILABLE)); + /* Initialize nelmts */ + nelmts = H5S_GET_SELECT_NPOINTS(dset_info->file_space); #ifdef H5_HAVE_PARALLEL /* Parallel writes are not supported (yet) */ - if (H5F_HAS_FEATURE(io_info->dset->oloc.file, H5FD_FEAT_HAS_MPI)) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "parallel writes not supported on virtual datasets") + if (H5F_HAS_FEATURE(dset_info->dset->oloc.file, H5FD_FEAT_HAS_MPI)) + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "parallel writes not supported on virtual datasets"); #endif /* H5_HAVE_PARALLEL */ /* Prepare for I/O operation */ - if (H5D__virtual_pre_io(io_info, storage, file_space, mem_space, &tot_nelmts) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to prepare for I/O operation") + if (H5D__virtual_pre_io(dset_info, storage, dset_info->file_space, dset_info->mem_space, &tot_nelmts) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to prepare for I/O operation"); /* Fail if there are unmapped parts of the selection as they would not be * written */ if (tot_nelmts != nelmts) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, - "write requested to unmapped portion of virtual dataset") + "write requested to unmapped portion of virtual dataset"); /* Iterate over mappings */ for (i = 0; i < storage->list_nused; i++) { /* Sanity check that virtual space has been patched by now */ - HDassert(storage->list[i].virtual_space_status == H5O_VIRTUAL_STATUS_CORRECT); + assert(storage->list[i].virtual_space_status == H5O_VIRTUAL_STATUS_CORRECT); /* Check for "printf" source dataset resolution */ if (storage->list[i].psfn_nsubs || storage->list[i].psdn_nsubs) { /* Iterate over sub-source dsets */ for (j = storage->list[i].sub_dset_io_start; j < storage->list[i].sub_dset_io_end; j++) - if (H5D__virtual_write_one(io_info, type_info, file_space, &storage->list[i].sub_dset[j]) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write to source dataset") + if (H5D__virtual_write_one(dset_info, &storage->list[i].sub_dset[j]) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write to source dataset"); } /* end if */ else /* Write to source dataset */ - if (H5D__virtual_write_one(io_info, type_info, file_space, &storage->list[i].source_dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write to source dataset") + if (H5D__virtual_write_one(dset_info, &storage->list[i].source_dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write to source dataset"); } /* end for */ done: /* Cleanup I/O operation */ if (H5D__virtual_post_io(storage) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't cleanup I/O operation") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't cleanup I/O operation"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_write() */ @@ -3018,9 +2985,6 @@ H5D__virtual_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsi * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * February 6, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -3033,7 +2997,7 @@ H5D__virtual_flush(H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); + assert(dset); storage = &dset->shared->layout.storage.u.virt; @@ -3046,12 +3010,12 @@ H5D__virtual_flush(H5D_t *dset) if (storage->list[i].sub_dset[j].dset) /* Flush source dataset */ if (H5D__flush_real(storage->list[i].sub_dset[j].dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush source dataset"); } /* end if */ else if (storage->list[i].source_dset.dset) /* Flush source dataset */ if (H5D__flush_real(storage->list[i].source_dset.dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to flush source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to flush source dataset"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3064,9 +3028,6 @@ H5D__virtual_flush(H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 7, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -3080,8 +3041,8 @@ H5D__virtual_hold_source_dset_files(const H5D_t *dset, H5D_virtual_held_file_t * FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); - HDassert(head && NULL == *head); + assert(dset); + assert(head && NULL == *head); /* Set the convenience pointer */ storage = &dset->shared->layout.storage.u.virt; @@ -3100,7 +3061,7 @@ H5D__virtual_hold_source_dset_files(const H5D_t *dset, H5D_virtual_held_file_t * /* Allocate a node for this file */ if (NULL == (tmp = H5FL_MALLOC(H5D_virtual_held_file_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate held file node") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate held file node"); /* Set up node & connect to list */ tmp->file = storage->list[i].sub_dset[j].dset->oloc.file; @@ -3114,7 +3075,7 @@ H5D__virtual_hold_source_dset_files(const H5D_t *dset, H5D_virtual_held_file_t * /* Allocate a node for this file */ if (NULL == (tmp = H5FL_MALLOC(H5D_virtual_held_file_t))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate held file node") + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate held file node"); /* Set up node & connect to list */ tmp->file = storage->list[i].source_dset.dset->oloc.file; @@ -3126,7 +3087,7 @@ H5D__virtual_hold_source_dset_files(const H5D_t *dset, H5D_virtual_held_file_t * if (ret_value < 0) /* Release hold on files and delete list on error */ if (*head && H5D__virtual_release_source_dset_files(*head) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release source datasets' files held open") + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release source datasets' files held open"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_hold_source_dset_files() */ @@ -3138,9 +3099,6 @@ H5D__virtual_hold_source_dset_files(const H5D_t *dset, H5D_virtual_held_file_t * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 7, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -3153,26 +3111,26 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset && *dset); + assert(dset && *dset); /* Get a temporary identifier for this source dataset */ if ((temp_id = H5VL_wrap_register(H5I_DATASET, *dset, FALSE)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID"); /* Refresh source dataset */ if (H5D__refresh(*dset, temp_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset"); /* Discard the identifier & replace the dataset */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_remove(temp_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't unregister source dataset ID"); if (NULL == (*dset = (H5D_t *)H5VL_object_unwrap(vol_obj))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't retrieve library object from VOL object"); vol_obj->data = NULL; done: if (vol_obj && H5VL_free_object(vol_obj) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to free VOL object"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__virtual_refresh_source_dset() */ @@ -3184,9 +3142,6 @@ H5D__virtual_refresh_source_dset(H5D_t **dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Dana Robinson - * November, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -3199,7 +3154,7 @@ H5D__virtual_refresh_source_dsets(H5D_t *dset) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dset); + assert(dset); /* Set convenience pointer */ storage = &dset->shared->layout.storage.u.virt; @@ -3216,14 +3171,14 @@ H5D__virtual_refresh_source_dsets(H5D_t *dset) if (storage->list[i].sub_dset[j].dset) /* Refresh sub-source dataset */ if (H5D__virtual_refresh_source_dset(&storage->list[i].sub_dset[j].dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset"); } /* end if */ else /* Check if source dataset is open */ if (storage->list[i].source_dset.dset) /* Refresh source dataset */ if (H5D__virtual_refresh_source_dset(&storage->list[i].source_dset.dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3236,9 +3191,6 @@ H5D__virtual_refresh_source_dsets(H5D_t *dset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 7, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -3261,7 +3213,7 @@ H5D__virtual_release_source_dset_files(H5D_virtual_held_file_t *head) * opened through an API routine -QAK) */ if (H5F_try_close(head->file, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close"); /* Delete node */ (void)H5FL_FREE(H5D_virtual_held_file_t, head); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5DxferProp.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5DxferProp.cpp deleted file mode 100644 index ccb49be821..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5DxferProp.cpp +++ /dev/null @@ -1,567 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5DxferProp.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control -// the order of creation and deletion of the global constants. See Design Notes -// in "H5PredType.cpp" for information. - -// Initialize a pointer for the constant -DSetMemXferPropList *DSetMemXferPropList::DEFAULT_ = 0; - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getConstant -// Creates a DSetMemXferPropList object representing the HDF5 -// constant H5P_DATASET_XFER, pointed to by -// DSetMemXferPropList::DEFAULT_ -// exception H5::PropListIException -// Description -// If DSetMemXferPropList::DEFAULT_ already points to an allocated -// object, throw a PropListIException. This scenario should not -// happen. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -DSetMemXferPropList * -DSetMemXferPropList::getConstant() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the constant pointer is not allocated, allocate it. Otherwise, - // throw because it shouldn't be. - if (DEFAULT_ == 0) - DEFAULT_ = new DSetMemXferPropList(H5P_DATASET_XFER); - else - throw PropListIException( - "DSetMemXferPropList::getConstant", - "DSetMemXferPropList::getConstant is being invoked on an allocated DEFAULT_"); - return (DEFAULT_); -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::deleteConstants -// Purpose: Deletes the constant object that DSetMemXferPropList::DEFAULT_ -// points to. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::deleteConstants() -{ - delete DEFAULT_; -} - -//-------------------------------------------------------------------------- -// Purpose Constant for default dataset memory and transfer property list. -//-------------------------------------------------------------------------- -const DSetMemXferPropList &DSetMemXferPropList::DEFAULT = *getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function DSetMemXferPropList default constructor -///\brief Default constructor: creates a stub dataset memory and -/// transfer property list object. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) -{ -} - -//-------------------------------------------------------------------------- -// Function DSetMemXferPropList constructor -///\brief Creates a dataset transfer property list with transform -/// expression. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetMemXferPropList::DSetMemXferPropList(const char *exp) : PropList(H5P_DATASET_XFER) -{ - setDataTransform(exp); -} - -//-------------------------------------------------------------------------- -// Function DSetMemXferPropList copy constructor -///\brief Copy constructor: same HDF5 object as \a original -/// DSetMemXferPropList object -///\param original - IN: Original dataset memory and transfer property -/// list object to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList &original) : PropList(original) -{ -} - -//-------------------------------------------------------------------------- -// Function DSetMemXferPropList overloaded constructor -///\brief Creates a DSetMemXferPropList object using the id of an -/// existing DSetMemXferPropList. -///\param plist_id - IN: Id of an existing dataset memory and transfer -/// property list -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setBuffer -///\brief Sets type conversion and background buffers. -///\param size - IN: Size, in bytes, of the type conversion and background buffers -///\param tconv - IN: Pointer to application-allocated type conversion buffer -///\param bkg - IN: Pointer to application-allocated background buffer -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setBuffer(size_t size, void *tconv, void *bkg) const -{ - herr_t ret_value = H5Pset_buffer(id, size, tconv, bkg); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::setBuffer", "H5Pset_buffer failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getBuffer -///\brief Reads buffer settings. -///\param tconv - OUT: Pointer to application-allocated type conversion buf -///\param bkg - OUT: Pointer to application-allocated background buffer -///\return Buffer size, in bytes -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -size_t -DSetMemXferPropList::getBuffer(void **tconv, void **bkg) const -{ - size_t buffer_size = H5Pget_buffer(id, tconv, bkg); - if (buffer_size == 0) { - throw PropListIException("DSetMemXferPropList::getBuffer", - "H5Pget_buffer returned 0 for buffer size - failure"); - } - return (buffer_size); -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setPreserve -///\brief Sets the dataset transfer property list status to true or false. -///\param status - IN: Status to set, true or false -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setPreserve(bool status) const -{ - herr_t ret_value = H5Pset_preserve(id, static_cast(status)); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::setPreserve", "H5Pset_preserve failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getPreserve -///\brief Checks status of the dataset transfer property list. -///\return Status of the dataset transfer property list -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -bool -DSetMemXferPropList::getPreserve() const -{ - int ret_value = H5Pget_preserve(id); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else { - throw PropListIException("DSetMemXferPropList::getPreserve", - "H5Pget_preserve returned negative value for status"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setBtreeRatios -///\brief Sets B-tree split ratios for a dataset transfer property list. -///\param left - IN: B-tree split ratio for left-most nodes -///\param middle - IN: B-tree split ratio for right-most nodes and lone nodes -///\param right - IN: B-tree split ratio for all other nodes -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setBtreeRatios(double left, double middle, double right) const -{ - herr_t ret_value = H5Pset_btree_ratios(id, left, middle, right); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::setBtreeRatios", "H5Pset_btree_ratios failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getBtreeRatios -///\brief Gets B-tree split ratios for a dataset transfer property list. -///\param left - OUT: B-tree split ratio for left-most nodes -///\param middle - OUT: B-tree split ratio for right-most nodes and lone nodes -///\param right - OUT: B-tree split ratio for all other nodes -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::getBtreeRatios(double &left, double &middle, double &right) const -{ - herr_t ret_value = H5Pget_btree_ratios(id, &left, &middle, &right); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::getBtreeRatios", "H5Pget_btree_ratios failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setDataTransform -///\brief Sets data transform expression. -///\param expression - IN: null-terminated data transform expression (char*) -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar, 2014 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setDataTransform(const char *expression) const -{ - herr_t ret_value = H5Pset_data_transform(id, expression); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::setDataTransform", "H5Pset_data_transform failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setDataTransform -///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c H5std_string for the expression. -///\param expression - IN: H5std_string data transform expression -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar, 2014 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setDataTransform(const H5std_string &expression) const -{ - setDataTransform(expression.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getDataTransform -///\brief Sets data transform expression. -///\param exp - OUT: buffer for data transform expression (char*) -///\param buf_size - IN: size of buffer for expression, including the -/// null terminator -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar, 2014 -//-------------------------------------------------------------------------- -ssize_t -DSetMemXferPropList::getDataTransform(char *exp, size_t buf_size) const -{ - // H5Pget_data_transform will get buf_size characters of the expression - // including the null terminator - ssize_t exp_len; - exp_len = H5Pget_data_transform(id, exp, buf_size); - - // H5Pget_data_transform returns a negative value, raise an exception - if (exp_len < 0) { - throw PropListIException("DSetMemXferPropList::getDataTransform", "H5Pget_data_transform failed"); - } - - // H5Pget_data_transform will put a null terminator at the end of the - // expression or at [buf_size-1] if the expression is at least the size - // of the buffer. - - // Return the expression length, which might be different from buf_size - return (exp_len); -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getDataTransform -///\brief This is an overloaded member function, provided for convenience. -/// It takes no parameter and returns a \c H5std_string for the expression. -/// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar, 2014 -//-------------------------------------------------------------------------- -H5std_string -DSetMemXferPropList::getDataTransform() const -{ - // Initialize string to "", so that if there is no expression, the returned - // string will be empty - H5std_string expression; - - // Preliminary call to get the expression's length - ssize_t exp_len = H5Pget_data_transform(id, NULL, 0); - - // If H5Pget_data_transform returns a negative value, raise an exception - if (exp_len < 0) { - throw PropListIException("DSetMemXferPropList::getDataTransform", "H5Pget_data_transform failed"); - } - - // If expression exists, calls C routine again to get it - else if (exp_len > 0) { - - // The actual size is the cast value + 1 for the terminal ASCII NUL - // (unfortunate in/out type sign mismatch) - size_t actual_exp_len = static_cast(exp_len) + 1; - - // Temporary buffer for char* expression - char *exp_C = new char[actual_exp_len](); - - // Used overloaded function - exp_len = getDataTransform(exp_C, actual_exp_len); - - // Convert the C expression to return - expression = exp_C; - - // Clean up resource - delete[] exp_C; - } - // Return the string expression - return (expression); -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getTypeConvCB -///\brief Sets an exception handling callback for datatype conversion -/// for a dataset transfer property list. -///\param op - IN: User's function -///\param user_data - IN: User's data -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const -{ - herr_t ret_value = H5Pset_type_conv_cb(id, op, user_data); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::setTypeConvCB", "H5Pset_type_conv_cb failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getTypeConvCB -///\brief Gets the exception handling callback function and data. -///\param op - IN: Retrieved user function -///\param user_data - IN: Retrieved user data -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const -{ - herr_t ret_value = H5Pget_type_conv_cb(id, op, user_data); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::getTypeConvCB", "H5Pget_type_conv_cb failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setVlenMemManager -///\brief Sets the memory manager for variable-length datatype allocation. -///\param alloc_func - IN: User's allocate routine -///\param alloc_info - IN: User's allocation parameters -///\param free_func - IN: User's free routine -///\param free_info - IN: User's free parameters -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, - void *free_info) const -{ - herr_t ret_value = H5Pset_vlen_mem_manager(id, alloc_func, alloc_info, free_func, free_info); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::setVlenMemManager", "H5Pset_vlen_mem_manager failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setVlenMemManager -///\brief Sets the memory manager for variable-length datatype -/// allocation - system \c malloc and \c free will be used. -/// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setVlenMemManager() const -{ - setVlenMemManager(NULL, NULL, NULL, NULL); -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getVlenMemManager -///\brief Gets the memory manager for variable-length datatype allocation -///\param alloc_func - OUT: User's allocate routine -///\param alloc_info - OUT: User's allocation parameters -///\param free_func - OUT: User's free routine -///\param free_info - OUT: User's free parameters -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t &alloc_func, void **alloc_info, H5MM_free_t &free_func, - void **free_info) const -{ - herr_t ret_value = H5Pget_vlen_mem_manager(id, &alloc_func, alloc_info, &free_func, free_info); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::getVlenMemManager", "H5Pget_vlen_mem_manager failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setSmallDataBlockSize -///\brief Sets the size of a contiguous block reserved for small data. -///\param size - IN: Maximum size, in bytes, of the small data block. -///\exception H5::PropListIException -///\par Description -/// For detail, please refer to the H5Pset_small_data_block_size -/// API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const -{ - herr_t ret_value = H5Pset_small_data_block_size(id, size); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::setSmallDataBlockSize", - "H5Pset_small_data_block_size failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getSmallDataBlockSize -///\brief Returns the current small data block size setting. -///\return Size of the small data block, in bytes -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -hsize_t -DSetMemXferPropList::getSmallDataBlockSize() const -{ - hsize_t size; - herr_t ret_value = H5Pget_small_data_block_size(id, &size); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::getSmallDataBlockSize", - "H5Pget_small_data_block_size failed"); - } - return (size); -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setHyperVectorSize -///\brief Sets number of I/O vectors to be read/written in hyperslab I/O. -/// -///\exception H5::PropListIException -///\par Description -/// For detail, please refer to the H5Pset_hyper_vector_size -/// API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const -{ - herr_t ret_value = H5Pset_hyper_vector_size(id, vector_size); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::setHyperVectorSize", - "H5Pset_hyper_vector_size failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getHyperVectorSize -///\brief Returns the number of I/O vectors to be read/written in -/// hyperslab I/O. -///\return Number of I/O vectors -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -size_t -DSetMemXferPropList::getHyperVectorSize() const -{ - size_t vector_size; - herr_t ret_value = H5Pget_hyper_vector_size(id, &vector_size); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::getHyperVectorSize", - "H5Pget_hyper_vector_size failed"); - } - return (vector_size); -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::setEDCCheck -///\brief Enables or disables error-detecting for a dataset reading -/// process. -///\param check - IN: Specifies whether error detection is enabled or -/// disabled -///\exception H5::PropListIException -///\par Description -/// The error detection algorithm used is the algorithm previously -/// specified in the corresponding dataset creation property -/// list. This function does not affect the use of error -/// detection in the writing process. -///\par -/// Valid values are as follows: -/// \li \c H5Z_ENABLE_EDC (default) -/// \li \c H5Z_DISABLE_EDC -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const -{ - herr_t ret_value = H5Pset_edc_check(id, check); - if (ret_value < 0) { - throw PropListIException("DSetMemXferPropList::setEDCCheck", "H5Pset_edc_check failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList::getEDCCheck -///\brief Determines whether error-detection is enabled for dataset reads. -///\return \c H5Z_ENABLE_EDC or \c H5Z_DISABLE_EDC -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -H5Z_EDC_t -DSetMemXferPropList::getEDCCheck() const -{ - H5Z_EDC_t check = H5Pget_edc_check(id); - if (check < 0) { - throw PropListIException("DSetMemXferPropList::getEDCCheck", "H5Pget_edc_check failed"); - } - return (check); -} - -//-------------------------------------------------------------------------- -// Function: DSetMemXferPropList destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -DSetMemXferPropList::~DSetMemXferPropList() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5E.c b/externals/coda-oss/modules/drivers/hdf5/source/H5E.c index 62625ea4e4..ea6f201214 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5E.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5E.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -154,15 +153,15 @@ H5E_init(void) /* Initialize the ID group for the error class IDs */ if (H5I_register_type(H5I_ERRCLS_CLS) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); /* Initialize the ID group for the major error IDs */ if (H5I_register_type(H5I_ERRMSG_CLS) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); /* Initialize the ID group for the error stacks */ if (H5I_register_type(H5I_ERRSTK_CLS) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); #ifndef H5_HAVE_THREADSAFE H5E_stack_g[0].nused = 0; @@ -170,13 +169,13 @@ H5E_init(void) #endif /* H5_HAVE_THREADSAFE */ /* Allocate the HDF5 error class */ - HDassert(H5E_ERR_CLS_g == (-1)); + assert(H5E_ERR_CLS_g == (-1)); HDsnprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE, (HDstrlen(H5_VERS_SUBRELEASE) > 0 ? "-" H5_VERS_SUBRELEASE : "")); if (NULL == (cls = H5E__register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "class initialization failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "class initialization failed"); if ((H5E_ERR_CLS_g = H5I_register(H5I_ERROR_CLASS, cls, FALSE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error class"); /* Include the automatically generated error code initialization */ #include "H5Einit.h" @@ -195,9 +194,6 @@ H5E_init(void) * * Failure: Negative * - * Programmer: Raymond Lu - * Tuesday, July 22, 2003 - * *------------------------------------------------------------------------- */ int @@ -274,9 +270,6 @@ H5E_term_package(void) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Thursday, November 1, 2007 - * *-------------------------------------------------------------------------- */ static herr_t @@ -314,9 +307,6 @@ H5E__set_default_auto(H5E_t *stk) * * Failure: NULL * - * Programmer: Chee Wai LEE - * April 24, 2000 - * *------------------------------------------------------------------------- */ H5E_t * @@ -334,12 +324,12 @@ H5E__get_stack(void) /* Win32 has to use LocalAlloc to match the LocalFree in DllMain */ estack = (H5E_t *)LocalAlloc(LPTR, sizeof(H5E_t)); #else - /* Use HDmalloc here since this has to match the HDfree in the + /* Use malloc here since this has to match the free in the * destructor and we want to avoid the codestack there. */ - estack = (H5E_t *)HDmalloc(sizeof(H5E_t)); + estack = (H5E_t *)malloc(sizeof(H5E_t)); #endif /* H5_HAVE_WIN_THREADS */ - HDassert(estack); + assert(estack); /* Set the thread-specific info */ estack->nused = 0; @@ -364,9 +354,6 @@ H5E__get_stack(void) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Friday, January 22, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -375,7 +362,7 @@ H5E__free_class(H5E_cls_t *cls) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(cls); + assert(cls); /* Free error class structure */ cls->cls_name = (char *)H5MM_xfree((void *)cls->cls_name); @@ -394,9 +381,6 @@ H5E__free_class(H5E_cls_t *cls) * Return: Success: An ID for the error class * Failure: H5I_INVALID_HID * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ hid_t @@ -410,15 +394,15 @@ H5Eregister_class(const char *cls_name, const char *lib_name, const char *versio /* Check arguments */ if (cls_name == NULL || lib_name == NULL || version == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid string"); /* Create the new error class object */ if (NULL == (cls = H5E__register_class(cls_name, lib_name, version))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error class"); /* Register the new error class to get an ID for it */ if ((ret_value = H5I_register(H5I_ERROR_CLASS, cls, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error class"); done: FUNC_LEAVE_API(ret_value) @@ -432,9 +416,6 @@ H5Eregister_class(const char *cls_name, const char *lib_name, const char *versio * Return: Success: Pointer to an error class struct * Failure: NULL * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ static H5E_cls_t * @@ -446,21 +427,21 @@ H5E__register_class(const char *cls_name, const char *lib_name, const char *vers FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(cls_name); - HDassert(lib_name); - HDassert(version); + assert(cls_name); + assert(lib_name); + assert(version); /* Allocate space for new error class */ if (NULL == (cls = H5FL_CALLOC(H5E_cls_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Duplicate string information */ if (NULL == (cls->cls_name = H5MM_xstrdup(cls_name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); if (NULL == (cls->lib_name = H5MM_xstrdup(lib_name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); if (NULL == (cls->lib_vers = H5MM_xstrdup(version))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Set the return value */ ret_value = cls; @@ -468,7 +449,7 @@ H5E__register_class(const char *cls_name, const char *lib_name, const char *vers done: if (!ret_value) if (cls && H5E__free_class(cls) < 0) - HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class") + HDONE_ERROR(H5E_ERROR, H5E_CANTRELEASE, NULL, "unable to free error class"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5E__register_class() */ @@ -480,9 +461,6 @@ H5E__register_class(const char *cls_name, const char *lib_name, const char *vers * * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -495,14 +473,14 @@ H5Eunregister_class(hid_t class_id) /* Check arguments */ if (H5I_ERROR_CLASS != H5I_get_type(class_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error class"); /* * Decrement the counter on the dataset. It will be freed if the count * reaches zero. */ if (H5I_dec_app_ref(class_id) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class"); done: FUNC_LEAVE_API(ret_value) @@ -515,9 +493,6 @@ H5Eunregister_class(hid_t class_id) * * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -528,15 +503,15 @@ H5E__unregister_class(H5E_cls_t *cls, void H5_ATTR_UNUSED **request) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(cls); + assert(cls); /* Iterate over all the messages and delete those in this error class */ if (H5I_iterate(H5I_ERROR_MSG, H5E__close_msg_cb, cls, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_BADITER, FAIL, "unable to free all messages in this error class") + HGOTO_ERROR(H5E_ERROR, H5E_BADITER, FAIL, "unable to free all messages in this error class"); /* Free error class structure */ if (H5E__free_class(cls) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "unable to free error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "unable to free error class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -550,9 +525,6 @@ H5E__unregister_class(H5E_cls_t *cls, void H5_ATTR_UNUSED **request) * Return: Success: Name length (zero means no name) * Failure: -1 * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ ssize_t @@ -566,11 +538,11 @@ H5Eget_class_name(hid_t class_id, char *name /*out*/, size_t size) /* Get the error class */ if (NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error class ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error class ID"); /* Retrieve the class name */ if ((ret_value = H5E__get_class_name(cls, name, size)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error class name") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error class name"); done: FUNC_LEAVE_API(ret_value) @@ -584,9 +556,6 @@ H5Eget_class_name(hid_t class_id, char *name /*out*/, size_t size) * Return: Success: Name length (zero means no name) * Failure: -1 * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ static ssize_t @@ -597,7 +566,7 @@ H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(cls); + assert(cls); /* Get the class's name */ len = (ssize_t)HDstrlen(cls->cls_name); @@ -622,9 +591,6 @@ H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size) * Return: Success: H5_ITER_CONT (0) * Failure: H5_ITER_ERROR (-1) * - * Programmer: Raymond Lu - * July 14, 2003 - * *------------------------------------------------------------------------- */ static int @@ -637,14 +603,14 @@ H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(err_msg); + assert(err_msg); /* Close the message if it is in the class being closed */ if (err_msg->cls == cls) { if (H5E__close_msg(err_msg, NULL) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "unable to close error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "unable to close error message"); if (NULL == H5I_remove(obj_id)) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove error message"); } /* end if */ done: @@ -658,9 +624,6 @@ H5E__close_msg_cb(void *obj_ptr, hid_t obj_id, void *udata) * * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -673,11 +636,11 @@ H5Eclose_msg(hid_t err_id) /* Check arguments */ if (H5I_ERROR_MSG != H5I_get_type(err_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an error class"); /* Decrement the counter. It will be freed if the count reaches zero. */ if (H5I_dec_app_ref(err_id) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message"); done: FUNC_LEAVE_API(ret_value) @@ -690,9 +653,6 @@ H5Eclose_msg(hid_t err_id) * * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -701,7 +661,7 @@ H5E__close_msg(H5E_msg_t *err, void H5_ATTR_UNUSED **request) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(err); + assert(err); /* Release message */ err->msg = (char *)H5MM_xfree((void *)err->msg); @@ -719,9 +679,6 @@ H5E__close_msg(H5E_msg_t *err, void H5_ATTR_UNUSED **request) * Return: Success: An error ID * Failure: H5I_INVALID_HID * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ hid_t @@ -736,21 +693,21 @@ H5Ecreate_msg(hid_t class_id, H5E_type_t msg_type, const char *msg_str) /* Check arguments */ if (msg_type != H5E_MAJOR && msg_type != H5E_MINOR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "not a valid message type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "not a valid message type"); if (msg_str == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "message is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "message is NULL"); /* Get the error class */ if (NULL == (cls = (H5E_cls_t *)H5I_object_verify(class_id, H5I_ERROR_CLASS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an error class ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an error class ID"); /* Create the new error message object */ if (NULL == (msg = H5E__create_msg(cls, msg_type, msg_str))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error message"); /* Register the new error class to get an ID for it */ if ((ret_value = H5I_register(H5I_ERROR_MSG, msg, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register error message"); done: FUNC_LEAVE_API(ret_value) @@ -764,9 +721,6 @@ H5Ecreate_msg(hid_t class_id, H5E_type_t msg_type, const char *msg_str) * Return: Success: Pointer to a message struct * Failure: NULL * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ static H5E_msg_t * @@ -778,19 +732,19 @@ H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(cls); - HDassert(msg_type == H5E_MAJOR || msg_type == H5E_MINOR); - HDassert(msg_str); + assert(cls); + assert(msg_type == H5E_MAJOR || msg_type == H5E_MINOR); + assert(msg_str); /* Allocate new message object */ if (NULL == (msg = H5FL_MALLOC(H5E_msg_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Fill new message object */ msg->cls = cls; msg->type = msg_type; if (NULL == (msg->msg = H5MM_xstrdup(msg_str))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Set return value */ ret_value = msg; @@ -798,7 +752,7 @@ H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) done: if (!ret_value) if (msg && H5E__close_msg(msg, NULL) < 0) - HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message") + HDONE_ERROR(H5E_ERROR, H5E_CANTCLOSEOBJ, NULL, "unable to close error message"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5E__create_msg() */ @@ -811,9 +765,6 @@ H5E__create_msg(H5E_cls_t *cls, H5E_type_t msg_type, const char *msg_str) * Return: Success: Message length (zero means no message) * Failure: -1 * - * Programmer: Raymond Lu - * Friday, July 14, 2003 - * *------------------------------------------------------------------------- */ ssize_t @@ -827,11 +778,11 @@ H5Eget_msg(hid_t msg_id, H5E_type_t *type /*out*/, char *msg_str /*out*/, size_t /* Get the message object */ if (NULL == (msg = (H5E_msg_t *)H5I_object_verify(msg_id, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error message ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a error message ID"); /* Get the message's text */ if ((ret_value = H5E__get_msg(msg, type, msg_str, size)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error message text") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get error message text"); done: FUNC_LEAVE_API(ret_value) @@ -845,9 +796,6 @@ H5Eget_msg(hid_t msg_id, H5E_type_t *type /*out*/, char *msg_str /*out*/, size_t * Return: Success: An error stack ID * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol - * Thursday, November 1, 2007 - * *------------------------------------------------------------------------- */ hid_t @@ -861,14 +809,14 @@ H5Ecreate_stack(void) /* Allocate a new error stack */ if (NULL == (stk = H5FL_CALLOC(H5E_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed"); /* Set the "automatic" error reporting info to the library default */ H5E__set_default_auto(stk); /* Register the stack */ if ((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack"); done: FUNC_LEAVE_API(ret_value) @@ -883,9 +831,6 @@ H5Ecreate_stack(void) * Return: Success: An error stack ID * Failure: H5I_INVALID_HID * - * Programmer: Raymond Lu - * Friday, July 14, 2003 - * *------------------------------------------------------------------------- */ hid_t @@ -900,11 +845,11 @@ H5Eget_current_stack(void) /* Get the current stack */ if (NULL == (stk = H5E__get_current_stack())) - HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTCREATE, H5I_INVALID_HID, "can't create error stack"); /* Register the stack */ if ((ret_value = H5I_register(H5I_ERROR_STACK, stk, TRUE)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, H5I_INVALID_HID, "can't create error stack"); done: FUNC_LEAVE_API(ret_value) @@ -918,9 +863,6 @@ H5Eget_current_stack(void) * Return: Success: Pointer to an error class struct * Failure: NULL * - * Programmer: Raymond Lu - * Friday, July 11, 2003 - * *------------------------------------------------------------------------- */ static H5E_t * @@ -936,11 +878,11 @@ H5E__get_current_stack(void) /* Get a pointer to the current error stack */ if (NULL == (current_stack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack"); /* Allocate a new error stack */ if (NULL == (estack_copy = H5FL_CALLOC(H5E_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Make a copy of current error stack */ estack_copy->nused = current_stack->nused; @@ -953,13 +895,13 @@ H5E__get_current_stack(void) /* Increment the IDs to indicate that they are used in this stack */ if (H5I_inc_ref(current_error->cls_id, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error class"); new_error->cls_id = current_error->cls_id; if (H5I_inc_ref(current_error->maj_num, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error message"); new_error->maj_num = current_error->maj_num; if (H5I_inc_ref(current_error->min_num, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error message"); new_error->min_num = current_error->min_num; /* The 'func' & 'file' strings are statically allocated (by the compiler) * there's no need to duplicate them. @@ -968,7 +910,7 @@ H5E__get_current_stack(void) new_error->file_name = current_error->file_name; new_error->line = current_error->line; if (NULL == (new_error->desc = H5MM_xstrdup(current_error->desc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } /* end for */ /* Copy the "automatic" error reporting information */ @@ -997,9 +939,6 @@ H5E__get_current_stack(void) * * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, July 15, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1013,18 +952,18 @@ H5Eset_current_stack(hid_t err_stack) if (err_stack != H5E_DEFAULT) { if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); /* Set the current error stack */ if (H5E__set_current_stack(estack) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "unable to set error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "unable to set error stack"); /* * Decrement the counter on the error stack. It will be freed if the count * reaches zero. */ if (H5I_dec_app_ref(err_stack) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error stack"); } /* end if */ done: @@ -1038,9 +977,6 @@ H5Eset_current_stack(hid_t err_stack) * * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Friday, July 15, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -1053,12 +989,12 @@ H5E__set_current_stack(H5E_t *estack) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(estack); + assert(estack); /* Get a pointer to the current error stack */ if (NULL == (current_stack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); /* Empty current error stack */ H5E_clear_stack(current_stack); @@ -1074,13 +1010,13 @@ H5E__set_current_stack(H5E_t *estack) /* Increment the IDs to indicate that they are used in this stack */ if (H5I_inc_ref(new_error->cls_id, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class"); current_error->cls_id = new_error->cls_id; if (H5I_inc_ref(new_error->maj_num, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class"); current_error->maj_num = new_error->maj_num; if (H5I_inc_ref(new_error->min_num, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class"); current_error->min_num = new_error->min_num; /* The 'func' & 'file' strings are statically allocated (by the compiler) * there's no need to duplicate them. @@ -1089,7 +1025,7 @@ H5E__set_current_stack(H5E_t *estack) current_error->file_name = new_error->file_name; current_error->line = new_error->line; if (NULL == (current_error->desc = H5MM_xstrdup(new_error->desc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } /* end for */ done: @@ -1103,9 +1039,6 @@ H5E__set_current_stack(H5E_t *estack) * * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, July 14, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1119,14 +1052,14 @@ H5Eclose_stack(hid_t stack_id) if (H5E_DEFAULT != stack_id) { /* Check arguments */ if (H5I_ERROR_STACK != H5I_get_type(stack_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); /* * Decrement the counter on the error stack. It will be freed if the count * reaches zero. */ if (H5I_dec_app_ref(stack_id) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error stack"); } /* end if */ done: @@ -1140,9 +1073,6 @@ H5Eclose_stack(hid_t stack_id) * * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Friday, July 14, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -1151,7 +1081,7 @@ H5E__close_stack(H5E_t *estack, void H5_ATTR_UNUSED **request) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(estack); + assert(estack); /* Release the stack's error information */ H5E_clear_stack(estack); @@ -1170,9 +1100,6 @@ H5E__close_stack(H5E_t *estack, void H5_ATTR_UNUSED **request) * Return: Success: The number of errors * Failure: -1 * - * Programmer: Raymond Lu - * Friday, July 15, 2003 - * *------------------------------------------------------------------------- */ ssize_t @@ -1189,7 +1116,7 @@ H5Eget_num(hid_t error_stack_id) if (error_stack_id == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get current error stack"); } /* end if */ else { /* Only clear the error stack if it's not the default stack */ @@ -1197,12 +1124,12 @@ H5Eget_num(hid_t error_stack_id) /* Get the error stack to operate on */ if (NULL == (estack = (H5E_t *)H5I_object_verify(error_stack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not an error stack ID"); } /* end else */ /* Get the number of errors on stack */ if ((ret_value = H5E__get_num(estack)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get number of errors") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get number of errors"); done: FUNC_LEAVE_API(ret_value) @@ -1216,9 +1143,6 @@ H5Eget_num(hid_t error_stack_id) * Return: Success: The number of errors * Failure: -1 (can't fail at this time) * - * Programmer: Raymond Lu - * Friday, July 15, 2003 - * *------------------------------------------------------------------------- */ static ssize_t @@ -1226,7 +1150,7 @@ H5E__get_num(const H5E_t *estack) { FUNC_ENTER_PACKAGE_NOERR - HDassert(estack); + assert(estack); FUNC_LEAVE_NOAPI((ssize_t)estack->nused) } /* end H5E__get_num() */ @@ -1238,9 +1162,6 @@ H5E__get_num(const H5E_t *estack) * * Return: Non-negative value on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, July 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1257,7 +1178,7 @@ H5Epop(hid_t err_stack, size_t count) if (err_stack == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); } /* end if */ else { /* Only clear the error stack if it's not the default stack */ @@ -1265,7 +1186,7 @@ H5Epop(hid_t err_stack, size_t count) /* Get the error stack to operate on */ if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ /* Range limit the number of errors to pop off stack */ @@ -1274,7 +1195,7 @@ H5Epop(hid_t err_stack, size_t count) /* Pop the errors off the stack */ if (H5E__pop(estack, count) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't pop errors from stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't pop errors from stack"); done: FUNC_LEAVE_API(ret_value) @@ -1293,9 +1214,6 @@ H5Epop(hid_t err_stack, size_t count) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, October 18, 1999 - * * Notes: Basically a new public API wrapper around the H5E__push_stack * function. * @@ -1324,7 +1242,7 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid /* Get the error stack to operate on */ if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ /* Note that the variable-argument parsing for the format is identical in @@ -1333,25 +1251,25 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid */ /* Format the description */ - HDva_start(ap, fmt); + va_start(ap, fmt); va_started = TRUE; /* Use the vasprintf() routine, since it does what we're trying to do below */ if (HDvasprintf(&tmp, fmt, ap) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Push the error on the stack */ if (H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack"); done: if (va_started) - HDva_end(ap); + va_end(ap); /* Memory was allocated with HDvasprintf so it needs to be freed - * with HDfree + * with free */ if (tmp) - HDfree(tmp); + free(tmp); FUNC_LEAVE_API(ret_value) } /* end H5Epush2() */ @@ -1363,9 +1281,6 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, hid * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, July 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1386,12 +1301,12 @@ H5Eclear2(hid_t err_stack) H5E_clear_stack(NULL); if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ /* Clear the error stack */ if (H5E_clear_stack(estack) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack"); done: FUNC_LEAVE_API(ret_value) @@ -1407,9 +1322,6 @@ H5Eclear2(hid_t err_stack) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, February 27, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1423,7 +1335,7 @@ H5Eprint2(hid_t err_stack, FILE *stream) /* Print error stack */ if ((ret_value = H5E__print2(err_stack, stream)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack"); done: FUNC_LEAVE_API(ret_value) @@ -1450,19 +1362,19 @@ H5E__print2(hid_t err_stack, FILE *stream) if (err_stack == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); } /* end if */ else { /* Only clear the error stack if it's not the default stack */ H5E_clear_stack(NULL); if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ /* Print error stack */ if (H5E__print(estack, stream, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1476,9 +1388,6 @@ H5E__print2(hid_t err_stack, FILE *stream) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, February 27, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1496,14 +1405,14 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi if (err_stack == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); } /* end if */ else { /* Only clear the error stack if it's not the default stack */ H5E_clear_stack(NULL); if (NULL == (estack = (H5E_t *)H5I_object_verify(err_stack, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ /* Walk the error stack */ @@ -1526,9 +1435,6 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi * * Return: Non-negative value on success/Negative on failure * - * Programmer: Robb Matzke - * Saturday, February 28, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1545,24 +1451,24 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*ou if (estack_id == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); } /* end if */ else { /* Only clear the error stack if it's not the default stack */ H5E_clear_stack(NULL); if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ /* Get the automatic error reporting information */ if (H5E__get_auto(estack, &op, client_data) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info"); #ifndef H5_NO_DEPRECATED_SYMBOLS /* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto1 */ if (!op.is_default && op.vers == 1) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto1 has been called") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto1 has been called"); #endif /* H5_NO_DEPRECATED_SYMBOLS */ if (func) @@ -1589,9 +1495,6 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*ou * * Return: Non-negative value on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, February 27, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1608,20 +1511,20 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) if (estack_id == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); } /* end if */ else { /* Only clear the error stack if it's not the default stack */ H5E_clear_stack(NULL); if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ #ifndef H5_NO_DEPRECATED_SYMBOLS /* Get the automatic error reporting information */ if (H5E__get_auto(estack, &op, NULL) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info"); /* Set the automatic error reporting information */ if (func != op.func2_default) @@ -1636,7 +1539,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) op.func2 = func; if (H5E__set_auto(estack, &op, client_data) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info"); done: FUNC_LEAVE_API(ret_value) @@ -1652,9 +1555,6 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data) * * Return: Non-negative value on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, September 8, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -1670,14 +1570,14 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) if (estack_id == H5E_DEFAULT) { if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); } /* end if */ else { /* Only clear the error stack if it's not the default stack */ H5E_clear_stack(NULL); if (NULL == (estack = (H5E_t *)H5I_object_verify(estack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a error stack ID"); } /* end else */ /* Check if the error stack reporting function is the "newer" stack type */ @@ -1700,9 +1600,6 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack) * * Return: Non-negative value on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, October 7, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -1717,13 +1614,13 @@ H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_sta /* Check args */ if (NULL == (dst_stack = (H5E_t *)H5I_object_verify(dst_stack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst_stack_id not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst_stack_id not a error stack ID"); if (NULL == (src_stack = (H5E_t *)H5I_object_verify(src_stack_id, H5I_ERROR_STACK))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "src_stack_id not a error stack ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "src_stack_id not a error stack ID"); /* Append the source stack to the destination stack */ if (H5E__append_stack(dst_stack, src_stack) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTAPPEND, FAIL, "can't append stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTAPPEND, FAIL, "can't append stack"); /* Close source error stack, if requested */ if (close_source_stack) @@ -1731,7 +1628,7 @@ H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_sta * count reaches zero. */ if (H5I_dec_app_ref(src_stack_id) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on source error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on source error stack"); done: FUNC_LEAVE_API(ret_value) @@ -1744,9 +1641,6 @@ H5Eappend_stack(hid_t dst_stack_id, hid_t src_stack_id, hbool_t close_source_sta * * Return: Non-negative value on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, October 7, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -1758,8 +1652,8 @@ H5E__append_stack(H5E_t *dst_stack, const H5E_t *src_stack) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(dst_stack); - HDassert(src_stack); + assert(dst_stack); + assert(src_stack); /* Copy the errors from the source stack to the destination stack */ for (u = 0; u < src_stack->nused; u++) { @@ -1772,13 +1666,13 @@ H5E__append_stack(H5E_t *dst_stack, const H5E_t *src_stack) /* Increment the IDs to indicate that they are used in this stack */ if (H5I_inc_ref(src_error->cls_id, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class"); dst_error->cls_id = src_error->cls_id; if (H5I_inc_ref(src_error->maj_num, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error message"); dst_error->maj_num = src_error->maj_num; if (H5I_inc_ref(src_error->min_num, FALSE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error message"); dst_error->min_num = src_error->min_num; /* The 'func' & 'file' strings are statically allocated (by the compiler) * there's no need to duplicate them. @@ -1787,7 +1681,7 @@ H5E__append_stack(H5E_t *dst_stack, const H5E_t *src_stack) dst_error->file_name = src_error->file_name; dst_error->line = src_error->line; if (NULL == (dst_error->desc = H5MM_xstrdup(src_error->desc))) - HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Increment # of errors in destination stack */ dst_stack->nused++; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EA.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EA.c index e5d11faec5..4b0446ba58 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EA.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EA.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EA.c - * Jun 17 2008 - * Quincey Koziol * * Purpose: Implements an "extensible array" for storing elements * in an array whose high bounds can extend and shrink. @@ -98,7 +95,7 @@ const H5EA_class_t *const H5EA_client_class_g[] = { H5FL_DEFINE_STATIC(H5EA_t); /* Declare a PQ free list to manage the element */ -H5FL_BLK_DEFINE(ea_native_elmt); +H5FL_BLK_DEFINE_STATIC(ea_native_elmt); /*------------------------------------------------------------------------- * Function: H5EA__new @@ -108,9 +105,6 @@ H5FL_BLK_DEFINE(ea_native_elmt); * Return: Pointer to earray wrapper success * NULL on failure * - * Programmer: Quincey Koziol - * Oct 10 2016 - * *------------------------------------------------------------------------- */ static H5EA_t * @@ -123,30 +117,30 @@ H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(ea_addr)); + assert(f); + assert(H5_addr_defined(ea_addr)); /* Allocate extensible array wrapper */ if (NULL == (ea = H5FL_CALLOC(H5EA_t))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for extensible array info") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for extensible array info"); /* Lock the array header into memory */ if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, "unable to load extensible array header"); /* Check for pending array deletion */ if (from_open && hdr->pending_delete) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTOPENOBJ, NULL, "can't open extensible array pending deletion") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTOPENOBJ, NULL, "can't open extensible array pending deletion"); /* Point extensible array wrapper at header and bump it's ref count */ ea->hdr = hdr; if (H5EA__hdr_incr(ea->hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header"); /* Increment # of files using this array header */ if (H5EA__hdr_fuse_incr(ea->hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, - "can't increment file reference count on shared array header") + "can't increment file reference count on shared array header"); /* Set file pointer for this array open context */ ea->f = f; @@ -157,10 +151,10 @@ H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata) done: if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, "unable to release extensible array header"); if (!ret_value) if (ea && H5EA_close(ea) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array") + HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__new() */ @@ -173,9 +167,6 @@ H5EA__new(H5F_t *f, haddr_t ea_addr, hbool_t from_open, void *ctx_udata) * Return: Pointer to earray wrapper on success * NULL on failure * - * Programmer: Quincey Koziol - * Jun 17 2008 - * *------------------------------------------------------------------------- */ H5EA_t * @@ -188,20 +179,20 @@ H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata) FUNC_ENTER_NOAPI(NULL) /* Check arguments */ - HDassert(f); - HDassert(cparam); + assert(f); + assert(cparam); /* H5EA interface sanity check */ HDcompile_assert(H5EA_NUM_CLS_ID == NELMTS(H5EA_client_class_g)); /* Create extensible array header */ if (HADDR_UNDEF == (ea_addr = H5EA__hdr_create(f, cparam, ctx_udata))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "can't create extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "can't create extensible array header"); /* Allocate and initialize new extensible array wrapper */ if (NULL == (ea = H5EA__new(f, ea_addr, FALSE, ctx_udata))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, - "allocation and/or initialization failed for extensible array wrapper") + "allocation and/or initialization failed for extensible array wrapper"); /* Set the return value */ ret_value = ea; @@ -209,7 +200,7 @@ H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata) done: if (!ret_value) if (ea && H5EA_close(ea) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array") + HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA_create() */ @@ -222,9 +213,6 @@ H5EA_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata) * Return: Pointer to array wrapper on success * NULL on failure * - * Programmer: Quincey Koziol - * Aug 28 2008 - * *------------------------------------------------------------------------- */ H5EA_t * @@ -236,13 +224,13 @@ H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata) FUNC_ENTER_NOAPI(NULL) /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(ea_addr)); + assert(f); + assert(H5_addr_defined(ea_addr)); /* Allocate and initialize new extensible array wrapper */ if (NULL == (ea = H5EA__new(f, ea_addr, TRUE, ctx_udata))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, - "allocation and/or initialization failed for extensible array wrapper") + "allocation and/or initialization failed for extensible array wrapper"); /* Set the return value */ ret_value = ea; @@ -250,7 +238,7 @@ H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata) done: if (!ret_value) if (ea && H5EA_close(ea) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array") + HDONE_ERROR(H5E_EARRAY, H5E_CLOSEERROR, NULL, "unable to close extensible array"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA_open() */ @@ -262,9 +250,6 @@ H5EA_open(H5F_t *f, haddr_t ea_addr, void *ctx_udata) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 21 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -273,8 +258,8 @@ H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts) FUNC_ENTER_NOAPI_NOERR /* Check arguments */ - HDassert(ea); - HDassert(nelmts); + assert(ea); + assert(nelmts); /* Retrieve the max. index set */ *nelmts = ea->hdr->stats.stored.max_idx_set; @@ -289,9 +274,6 @@ H5EA_get_nelmts(const H5EA_t *ea, hsize_t *nelmts) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 21 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -300,9 +282,9 @@ H5EA_get_addr(const H5EA_t *ea, haddr_t *addr) FUNC_ENTER_NOAPI_NOERR /* Check arguments */ - HDassert(ea); - HDassert(ea->hdr); - HDassert(addr); + assert(ea); + assert(ea->hdr); + assert(addr); /* Retrieve the address of the extensible array's header */ *addr = ea->hdr->addr; @@ -318,9 +300,6 @@ H5EA_get_addr(const H5EA_t *ea, haddr_t *addr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 9 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -342,14 +321,14 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(ea); - HDassert(hdr); - HDassert(thing); - HDassert(thing_elmt_buf); - HDassert(thing_unprot_func); + assert(ea); + assert(hdr); + assert(thing); + assert(thing_elmt_buf); + assert(thing_unprot_func); /* only the H5AC__READ_ONLY_FLAG may be set in thing_acc */ - HDassert((thing_acc & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((thing_acc & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set the shared array header's file context for this operation */ hdr->f = ea->f; @@ -361,24 +340,24 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t *thing_unprot_func = (H5EA__unprotect_func_t)NULL; /* Check if we should create the index block */ - if (!H5F_addr_defined(hdr->idx_blk_addr)) { + if (!H5_addr_defined(hdr->idx_blk_addr)) { /* Check if we are allowed to create the thing */ if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ /* Create the index block */ hdr->idx_blk_addr = H5EA__iblock_create(hdr, &stats_changed); - if (!H5F_addr_defined(hdr->idx_blk_addr)) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, "unable to create index block") + if (!H5_addr_defined(hdr->idx_blk_addr)) + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, "unable to create index block"); hdr_dirty = TRUE; } /* end if */ else - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Protect index block */ if (NULL == (iblock = H5EA__iblock_protect(hdr, thing_acc))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) + (unsigned long long)hdr->idx_blk_addr); /* Check if element is in index block */ if (idx < hdr->cparam.idx_blk_elmts) { @@ -404,10 +383,10 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t /* Compute the data block index in index block */ dblk_idx = (size_t)(hdr->sblk_info[sblk_idx].start_dblk + (elmt_idx / hdr->sblk_info[sblk_idx].dblk_nelmts)); - HDassert(dblk_idx < iblock->ndblk_addrs); + assert(dblk_idx < iblock->ndblk_addrs); /* Check if the data block has been allocated on disk yet */ - if (!H5F_addr_defined(iblock->dblk_addrs[dblk_idx])) { + if (!H5_addr_defined(iblock->dblk_addrs[dblk_idx])) { /* Check if we are allowed to create the thing */ if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ haddr_t dblk_addr; /* Address of data block created */ @@ -418,16 +397,16 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts); dblk_addr = H5EA__dblock_create(hdr, iblock, &stats_changed, dblk_off, hdr->sblk_info[sblk_idx].dblk_nelmts); - if (!H5F_addr_defined(dblk_addr)) + if (!H5_addr_defined(dblk_addr)) HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, - "unable to create extensible array data block") + "unable to create extensible array data block"); /* Set data block address in index block */ iblock->dblk_addrs[dblk_idx] = dblk_addr; iblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Protect data block */ @@ -435,7 +414,7 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t hdr->sblk_info[sblk_idx].dblk_nelmts, thing_acc))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect extensible array data block, address = %llu", - (unsigned long long)iblock->dblk_addrs[dblk_idx]) + (unsigned long long)iblock->dblk_addrs[dblk_idx]); /* Adjust index to offset in data block */ elmt_idx %= hdr->sblk_info[sblk_idx].dblk_nelmts; @@ -446,7 +425,7 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t HGOTO_ERROR( H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block and header, index = %llu", - (unsigned long long)idx) + (unsigned long long)idx); dblock->has_hdr_depend = TRUE; } /* end if */ @@ -463,23 +442,23 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t sblk_off = sblk_idx - iblock->nsblks; /* Check if the super block has been allocated on disk yet */ - if (!H5F_addr_defined(iblock->sblk_addrs[sblk_off])) { + if (!H5_addr_defined(iblock->sblk_addrs[sblk_off])) { /* Check if we are allowed to create the thing */ if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ haddr_t sblk_addr; /* Address of data block created */ /* Create super block */ sblk_addr = H5EA__sblock_create(hdr, iblock, &stats_changed, sblk_idx); - if (!H5F_addr_defined(sblk_addr)) + if (!H5_addr_defined(sblk_addr)) HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, - "unable to create extensible array super block") + "unable to create extensible array super block"); /* Set super block address in index block */ iblock->sblk_addrs[sblk_off] = sblk_addr; iblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Protect super block */ @@ -487,14 +466,14 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t thing_acc))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect extensible array super block, address = %llu", - (unsigned long long)iblock->sblk_addrs[sblk_off]) + (unsigned long long)iblock->sblk_addrs[sblk_off]); /* Compute the data block index in super block */ dblk_idx = (size_t)(elmt_idx / sblock->dblk_nelmts); - HDassert(dblk_idx < sblock->ndblks); + assert(dblk_idx < sblock->ndblks); /* Check if the data block has been allocated on disk yet */ - if (!H5F_addr_defined(sblock->dblk_addrs[dblk_idx])) { + if (!H5_addr_defined(sblock->dblk_addrs[dblk_idx])) { /* Check if we are allowed to create the thing */ if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ haddr_t dblk_addr; /* Address of data block created */ @@ -505,9 +484,9 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t (dblk_idx * hdr->sblk_info[sblk_idx].dblk_nelmts); dblk_addr = H5EA__dblock_create(hdr, sblock, &stats_changed, dblk_off, sblock->dblk_nelmts); - if (!H5F_addr_defined(dblk_addr)) + if (!H5_addr_defined(dblk_addr)) HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, - "unable to create extensible array data block") + "unable to create extensible array data block"); /* Set data block address in index block */ sblock->dblk_addrs[dblk_idx] = dblk_addr; @@ -521,12 +500,12 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between super block and header, address " "= %llu", - (unsigned long long)sblock->addr) + (unsigned long long)sblock->addr); sblock->has_hdr_depend = TRUE; } /* end if */ } /* end if */ else - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Adjust index to offset in data block */ @@ -557,21 +536,21 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t if (0 == (thing_acc & H5AC__READ_ONLY_FLAG)) { /* i.e. r/w access */ /* Create the data block page */ if (H5EA__dblk_page_create(hdr, sblock, dblk_page_addr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, "unable to create data block page") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, "unable to create data block page"); /* Mark data block page as initialized in super block */ H5VM_bit_set(sblock->page_init, page_init_idx, TRUE); sblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Protect data block page */ if (NULL == (dblk_page = H5EA__dblk_page_protect(hdr, sblock, dblk_page_addr, thing_acc))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect extensible array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + (unsigned long long)dblk_page_addr); /* Check if there is already a dependency on the header */ if (will_extend && !dblk_page->has_hdr_depend) { @@ -579,7 +558,7 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block page and header, " "index = %llu", - (unsigned long long)idx) + (unsigned long long)idx); dblk_page->has_hdr_depend = TRUE; } /* end if */ @@ -595,7 +574,7 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t sblock->dblk_nelmts, thing_acc))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect extensible array data block, address = %llu", - (unsigned long long)sblock->dblk_addrs[dblk_idx]) + (unsigned long long)sblock->dblk_addrs[dblk_idx]); /* Check if there is already a dependency on the header */ if (will_extend && !dblock->has_hdr_depend) { @@ -603,7 +582,7 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t HGOTO_ERROR( H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block and header, index = %llu", - (unsigned long long)idx) + (unsigned long long)idx); dblock->has_hdr_depend = TRUE; } /* end if */ @@ -617,8 +596,8 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t } /* end else */ /* Sanity checks */ - HDassert(*thing != NULL); - HDassert(*thing_unprot_func != NULL); + assert(*thing != NULL); + assert(*thing_unprot_func != NULL); done: /* Reset 'thing' info on error */ @@ -637,18 +616,19 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t if (hdr_dirty) if (H5EA__hdr_modified(hdr) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL, - "unable to mark extensible array header as modified") + "unable to mark extensible array header as modified"); /* Release resources */ if (iblock && *thing != iblock && H5EA__iblock_unprotect(iblock, iblock_cache_flags) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block"); /* (Note: super blocks don't contain elements, so don't have a '*thing != sblock' check) */ if (sblock && H5EA__sblock_unprotect(sblock, sblock_cache_flags) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block"); if (dblock && *thing != dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block"); if (dblk_page && *thing != dblk_page && H5EA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block page") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, + "unable to release extensible array data block page"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__lookup_elmt() */ @@ -660,9 +640,6 @@ H5EA__lookup_elmt(const H5EA_t *ea, hsize_t idx, hbool_t will_extend, unsigned t * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 9 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -680,8 +657,8 @@ H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(ea); - HDassert(hdr); + assert(ea); + assert(hdr); /* Set the shared array header's file context for this operation */ hdr->f = ea->f; @@ -690,12 +667,12 @@ H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt) will_extend = (idx >= hdr->stats.stored.max_idx_set); if (H5EA__lookup_elmt(ea, idx, will_extend, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect array metadata") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect array metadata"); /* Sanity check */ - HDassert(thing); - HDassert(thing_elmt_buf); - HDassert(thing_unprot_func); + assert(thing); + assert(thing_elmt_buf); + assert(thing_unprot_func); /* Set element in thing's element buffer */ H5MM_memcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt, @@ -708,13 +685,13 @@ H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt) hdr->stats.stored.max_idx_set = idx + 1; if (H5EA__hdr_modified(hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL, - "unable to mark extensible array header as modified") + "unable to mark extensible array header as modified"); } done: /* Release resources */ if (thing && (thing_unprot_func)(thing, thing_cache_flags) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array metadata") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array metadata"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA_set() */ @@ -726,9 +703,6 @@ H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 11 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -743,14 +717,14 @@ H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(ea); - HDassert(hdr); + assert(ea); + assert(hdr); /* Check for element beyond max. element in array */ if (idx >= hdr->stats.stored.max_idx_set) { /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value"); } /* end if */ else { uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ @@ -762,13 +736,13 @@ H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt) /* Look up the array metadata containing the element we want to set */ if (H5EA__lookup_elmt(ea, idx, FALSE, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect array metadata") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect array metadata"); /* Check if the thing holding the element has been created yet */ if (NULL == thing) { /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value"); } /* end if */ else /* Get element from thing's element buffer */ @@ -779,7 +753,7 @@ H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt) done: /* Release thing */ if (thing && (thing_unprot_func)(thing, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array metadata") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array metadata"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA_get() */ @@ -792,9 +766,6 @@ H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 27 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -806,9 +777,9 @@ H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(ea); - HDassert(hdr); - HDassert(parent); + assert(ea); + assert(hdr); + assert(parent); /* * Check to see if a flush dependency between the extensible array @@ -817,14 +788,14 @@ H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent) */ if (NULL == hdr->parent) { /* Sanity check */ - HDassert(hdr->top_proxy); + assert(hdr->top_proxy); /* Set the shared array header's file context for this operation */ hdr->f = ea->f; /* Add the extensible array as a child of the parent (proxy) */ if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "unable to add extensible array as child of proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, "unable to add extensible array as child of proxy"); hdr->parent = parent; } @@ -839,9 +810,6 @@ H5EA_depend(H5EA_t *ea, H5AC_proxy_entry_t *parent) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 21 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -854,7 +822,7 @@ H5EA_close(H5EA_t *ea) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(ea); + assert(ea); /* Close the header, if it was set */ if (ea->hdr) { @@ -887,19 +855,19 @@ H5EA_close(H5EA_t *ea) /* Check the header's status in the metadata cache */ if (H5AC_get_entry_status(ea->f, ea_addr, &hdr_status) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, - "unable to check metadata cache status for extensible array header") + "unable to check metadata cache status for extensible array header"); /* Sanity checks on header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PINNED); - HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED)); + assert(hdr_status & H5AC_ES__IN_CACHE); + assert(hdr_status & H5AC_ES__IS_PINNED); + assert(!(hdr_status & H5AC_ES__IS_PROTECTED)); } #endif /* NDEBUG */ /* Lock the array header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ if (NULL == (hdr = H5EA__hdr_protect(ea->f, ea_addr, NULL, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTLOAD, FAIL, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTLOAD, FAIL, "unable to load extensible array header"); /* Set the shared array header's file context for this operation */ hdr->f = ea->f; @@ -910,11 +878,11 @@ H5EA_close(H5EA_t *ea) */ if (H5EA__hdr_decr(ea->hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared array header") + "can't decrement reference count on shared array header"); /* Delete array, starting with header (unprotects header) */ if (H5EA__hdr_delete(hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array"); } /* end if */ else { /* Decrement the reference count on the array header */ @@ -923,7 +891,7 @@ H5EA_close(H5EA_t *ea) */ if (H5EA__hdr_decr(ea->hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared array header") + "can't decrement reference count on shared array header"); } /* end else */ } /* end if */ @@ -941,9 +909,6 @@ H5EA_close(H5EA_t *ea) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 28 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -955,13 +920,13 @@ H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(ea_addr)); + assert(f); + assert(H5_addr_defined(ea_addr)); /* Lock the array header into memory */ if (NULL == (hdr = H5EA__hdr_protect(f, ea_addr, ctx_udata, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, - "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr) + "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr); /* Check for files using shared array header */ if (hdr->file_rc) @@ -972,14 +937,14 @@ H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata) /* Delete array now, starting with header (unprotects header) */ if (H5EA__hdr_delete(hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array"); hdr = NULL; } done: /* Unprotect the header if an error occurred */ if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA_delete() */ @@ -992,8 +957,6 @@ H5EA_delete(H5F_t *f, haddr_t ea_addr, void *ctx_udata) * * Return: H5_ITER_CONT/H5_ITER_ERROR * - * Programmer: Vailin Choi; Feb 2015 - * *------------------------------------------------------------------------- */ int @@ -1006,20 +969,20 @@ H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata) FUNC_ENTER_NOAPI(H5_ITER_ERROR) /* Check arguments */ - HDassert(ea); - HDassert(op); - HDassert(udata); + assert(ea); + assert(op); + assert(udata); /* Allocate space for a native array element */ if (NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, H5_ITER_ERROR, - "memory allocation failed for extensible array element") + "memory allocation failed for extensible array element"); /* Iterate over all elements in array */ for (u = 0; u < ea->hdr->stats.stored.max_idx_set && ret_value == H5_ITER_CONT; u++) { /* Get array element */ if (H5EA_get(ea, u, elmt) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, H5_ITER_ERROR, "unable to delete fixed array") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, H5_ITER_ERROR, "unable to delete fixed array"); /* Make callback */ if ((ret_value = (*op)(u, elmt, udata)) < 0) { @@ -1053,8 +1016,8 @@ H5EA_patch_file(H5EA_t *ea, H5F_t *f) FUNC_ENTER_NOAPI_NOERR /* Check arguments */ - HDassert(ea); - HDassert(f); + assert(ea); + assert(f); if (ea->f != f || ea->hdr->f != f) ea->f = ea->hdr->f = f; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EAcache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EAcache.c index 68e927f430..d482141e40 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EAcache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EAcache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EAcache.c - * Aug 26 2008 - * Quincey Koziol * * Purpose: Implement extensible array metadata cache methods. * @@ -216,9 +213,6 @@ const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1] = {{ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 16, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -229,9 +223,9 @@ H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->f); - HDassert(image_len); + assert(udata); + assert(udata->f); + assert(image_len); /* Set the image length size */ *image_len = (size_t)H5EA_HEADER_SIZE_FILE(udata->f); @@ -248,8 +242,6 @@ H5EA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -263,7 +255,7 @@ H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -271,7 +263,7 @@ H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE if (stored_chksum != computed_chksum) ret_value = FALSE; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__cache_hdr_verify_chksum() */ /*------------------------------------------------------------------------- @@ -282,9 +274,6 @@ H5EA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE * Return: Success: Pointer to a new B-tree. * Failure: NULL * - * Programmer: Quincey Koziol - * July 16, 2013 - * *------------------------------------------------------------------------- */ static void * @@ -300,32 +289,32 @@ H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(udata); - HDassert(udata->f); - HDassert(H5F_addr_defined(udata->addr)); + assert(image); + assert(udata); + assert(udata->f); + assert(H5_addr_defined(udata->addr)); /* Allocate space for the extensible array data structure */ if (NULL == (hdr = H5EA__hdr_alloc(udata->f))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for extensible array shared header") + "memory allocation failed for extensible array shared header"); /* Set the extensible array header's address */ hdr->addr = udata->addr; /* Magic number */ - if (HDmemcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header signature") + if (memcmp(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_HDR_VERSION) - HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array header version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array header version"); /* Extensible array class */ id = (H5EA_cls_id_t)*image++; if (id >= H5EA_NUM_CLS_ID) - HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class"); hdr->cparam.cls = H5EA_client_class_g[id]; /* General array creation/configuration information */ @@ -352,7 +341,7 @@ H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ H5F_addr_decode(udata->f, &image, &hdr->idx_blk_addr); /* Address of index block */ /* Index block statistics */ - if (H5F_addr_defined(hdr->idx_blk_addr)) { + if (H5_addr_defined(hdr->idx_blk_addr)) { H5EA_iblock_t iblock; /* Fake index block for computing size */ /* Set index block count for file */ @@ -374,7 +363,7 @@ H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); + assert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); /* checksum verification already done in verify_chksum cb */ @@ -382,12 +371,12 @@ H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == len); + assert((size_t)(image - (const uint8_t *)_image) == len); /* Finish initializing extensible array header */ if (H5EA__hdr_init(hdr, udata->ctx_udata) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "initialization failed for extensible array header") - HDassert(hdr->size == len); + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "initialization failed for extensible array header"); + assert(hdr->size == len); /* Set return value */ ret_value = hdr; @@ -396,7 +385,7 @@ H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ /* Release resources */ if (!ret_value) if (hdr && H5EA__hdr_dest(hdr) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__cache_hdr_deserialize() */ @@ -408,9 +397,6 @@ H5EA__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 16, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -421,8 +407,8 @@ H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(hdr); - HDassert(image_len); + assert(hdr); + assert(image_len); /* Set the image length size */ *image_len = hdr->size; @@ -437,9 +423,6 @@ H5EA__cache_hdr_image_len(const void *_thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 16, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -452,9 +435,9 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le FUNC_ENTER_PACKAGE_NOERR /* check arguments */ - HDassert(f); - HDassert(image); - HDassert(hdr); + assert(f); + assert(image); + assert(hdr); /* Magic number */ H5MM_memcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -464,7 +447,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5EA_HDR_VERSION; /* Extensible array type */ - HDassert(hdr->cparam.cls->id <= 255); + assert(hdr->cparam.cls->id <= 255); *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ @@ -496,7 +479,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5EA__cache_hdr_serialize() */ @@ -508,9 +491,6 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 11/30/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -522,7 +502,7 @@ H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Check if the file was opened with SWMR-write access */ if (hdr->swmr_write) { @@ -546,13 +526,13 @@ H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) */ if (hdr->parent) { /* Sanity check */ - HDassert(hdr->top_proxy); + assert(hdr->top_proxy); /* Destroy flush dependency on object header proxy */ if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, - "unable to destroy flush dependency between extensible array and proxy") + "unable to destroy flush dependency between extensible array and proxy"); hdr->parent = NULL; } /* end if */ @@ -561,21 +541,21 @@ H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between header and " - "extensible array 'top' proxy") + "extensible array 'top' proxy"); /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */ } /* end if */ break; default: #ifdef NDEBUG - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ } /* end if */ else - HDassert(NULL == hdr->parent); + assert(NULL == hdr->parent); done: FUNC_LEAVE_NOAPI(ret_value) @@ -589,9 +569,6 @@ H5EA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 16, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -602,11 +579,11 @@ H5EA__cache_hdr_free_icr(void *thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(thing); + assert(thing); /* Release the extensible array header */ if (H5EA__hdr_dest((H5EA_hdr_t *)thing) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -619,9 +596,6 @@ H5EA__cache_hdr_free_icr(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -633,11 +607,11 @@ H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(hdr); - HDassert(image_len); + assert(hdr); + assert(image_len); /* Set up fake index block for computing size on disk */ - HDmemset(&iblock, 0, sizeof(iblock)); + memset(&iblock, 0, sizeof(iblock)); iblock.hdr = (H5EA_hdr_t *)hdr; iblock.nsblks = H5EA_SBLK_FIRST_IDX(hdr->cparam.sup_blk_min_data_ptrs); iblock.ndblk_addrs = 2 * ((size_t)hdr->cparam.sup_blk_min_data_ptrs - 1); @@ -658,8 +632,6 @@ H5EA__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -673,7 +645,7 @@ H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -692,9 +664,6 @@ H5EA__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN * Return: Success: Pointer to a new B-tree. * Failure: NULL * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static void * @@ -711,34 +680,34 @@ H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbo FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(hdr); + assert(image); + assert(hdr); /* Allocate the extensible array index block */ if (NULL == (iblock = H5EA__iblock_alloc(hdr))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for extensible array index block") + "memory allocation failed for extensible array index block"); /* Set the extensible array index block's address */ iblock->addr = hdr->idx_blk_addr; /* Magic number */ - if (HDmemcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array index block signature") + if (memcmp(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array index block signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_IBLOCK_VERSION) - HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array index block version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array index block version"); /* Extensible array type */ if (*image++ != (uint8_t)hdr->cparam.cls->id) - HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class"); /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(hdr->f, &image, &arr_addr); - if (H5F_addr_ne(arr_addr, hdr->addr)) - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address") + if (H5_addr_ne(arr_addr, hdr->addr)) + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address"); /* Internal information */ @@ -747,7 +716,7 @@ H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbo /* Convert from raw elements on disk into native elements in memory */ if ((hdr->cparam.cls->decode)(image, iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts, hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array index elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array index elements"); image += (hdr->cparam.idx_blk_elmts * hdr->cparam.raw_elmt_size); } /* end if */ @@ -767,7 +736,7 @@ H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbo /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); + assert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); /* Save the index block's size */ iblock->size = len; @@ -778,7 +747,7 @@ H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbo UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == iblock->size); + assert((size_t)(image - (const uint8_t *)_image) == iblock->size); /* Set return value */ ret_value = iblock; @@ -787,7 +756,7 @@ H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbo /* Release resources */ if (!ret_value) if (iblock && H5EA__iblock_dest(iblock) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__cache_iblock_deserialize() */ @@ -799,9 +768,6 @@ H5EA__cache_iblock_deserialize(const void *_image, size_t len, void *_udata, hbo * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -812,8 +778,8 @@ H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(iblock); - HDassert(image_len); + assert(iblock); + assert(image_len); /* Set the image length size */ *image_len = iblock->size; @@ -828,9 +794,6 @@ H5EA__cache_iblock_image_len(const void *_thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -844,10 +807,10 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); - HDassert(image); - HDassert(iblock); - HDassert(iblock->hdr); + assert(f); + assert(image); + assert(iblock); + assert(iblock->hdr); /* Get temporary pointer to serialized info */ @@ -859,7 +822,7 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_IBLOCK_VERSION; /* Extensible array type */ - HDassert(iblock->hdr->cparam.cls->id <= 255); + assert(iblock->hdr->cparam.cls->id <= 255); *image++ = (uint8_t)iblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ @@ -872,7 +835,7 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED /* Convert from native elements in memory into raw elements on disk */ if ((iblock->hdr->cparam.cls->encode)(image, iblock->elmts, (size_t)iblock->hdr->cparam.idx_blk_elmts, iblock->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array index elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array index elements"); image += (iblock->hdr->cparam.idx_blk_elmts * iblock->hdr->cparam.raw_elmt_size); } /* end if */ @@ -901,7 +864,7 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -914,9 +877,6 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -928,7 +888,7 @@ H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(iblock); + assert(iblock); /* Determine which action to take */ switch (action) { @@ -939,7 +899,7 @@ H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between index block and header, address = %llu", - (unsigned long long)iblock->addr) + (unsigned long long)iblock->addr); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -958,23 +918,23 @@ H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between index block and header, address = %llu", - (unsigned long long)iblock->addr) + (unsigned long long)iblock->addr); /* Detach from 'top' proxy for extensible array */ if (iblock->top_proxy) { if (H5AC_proxy_entry_remove_child(iblock->top_proxy, iblock) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between index block and " - "extensible array 'top' proxy") + "extensible array 'top' proxy"); iblock->top_proxy = NULL; } /* end if */ break; default: #ifdef NDEBUG - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ @@ -990,9 +950,6 @@ H5EA__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1003,11 +960,11 @@ H5EA__cache_iblock_free_icr(void *thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(thing); + assert(thing); /* Release the extensible array index block */ if (H5EA__iblock_dest((H5EA_iblock_t *)thing) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array index block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1020,9 +977,6 @@ H5EA__cache_iblock_free_icr(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1034,15 +988,15 @@ H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->hdr); - HDassert(udata->sblk_idx > 0); - HDassert(H5F_addr_defined(udata->sblk_addr)); - HDassert(image_len); + assert(udata); + assert(udata->hdr); + assert(udata->sblk_idx > 0); + assert(H5_addr_defined(udata->sblk_addr)); + assert(image_len); /* Set up fake super block for computing size on disk */ /* (Note: extracted from H5EA__sblock_alloc) */ - HDmemset(&sblock, 0, sizeof(sblock)); + memset(&sblock, 0, sizeof(sblock)); sblock.hdr = udata->hdr; sblock.ndblks = udata->hdr->sblk_info[udata->sblk_idx].ndblks; sblock.dblk_nelmts = udata->hdr->sblk_info[udata->sblk_idx].dblk_nelmts; @@ -1053,14 +1007,14 @@ H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len) sblock.dblk_npages = sblock.dblk_nelmts / udata->hdr->dblk_page_nelmts; /* Sanity check that we have at least 2 pages in data block */ - HDassert(sblock.dblk_npages > 1); + assert(sblock.dblk_npages > 1); /* Sanity check for integer truncation */ - HDassert((sblock.dblk_npages * udata->hdr->dblk_page_nelmts) == sblock.dblk_nelmts); + assert((sblock.dblk_npages * udata->hdr->dblk_page_nelmts) == sblock.dblk_nelmts); /* Compute size of buffer for each data block's 'page init' bitmask */ sblock.dblk_page_init_size = ((sblock.dblk_npages) + 7) / 8; - HDassert(sblock.dblk_page_init_size > 0); + assert(sblock.dblk_page_init_size > 0); } /* end if */ /* Set the image length size */ @@ -1078,8 +1032,6 @@ H5EA__cache_sblock_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -1093,7 +1045,7 @@ H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -1112,9 +1064,6 @@ H5EA__cache_sblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN * Return: Success: Pointer to a new B-tree. * Failure: NULL * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static void * @@ -1131,37 +1080,37 @@ H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, hbo FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(udata); - HDassert(udata->hdr); - HDassert(udata->parent); - HDassert(udata->sblk_idx > 0); - HDassert(H5F_addr_defined(udata->sblk_addr)); + assert(udata); + assert(udata->hdr); + assert(udata->parent); + assert(udata->sblk_idx > 0); + assert(H5_addr_defined(udata->sblk_addr)); /* Allocate the extensible array super block */ if (NULL == (sblock = H5EA__sblock_alloc(udata->hdr, udata->parent, udata->sblk_idx))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for extensible array super block") + "memory allocation failed for extensible array super block"); /* Set the extensible array super block's address */ sblock->addr = udata->sblk_addr; /* Magic number */ - if (HDmemcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array super block signature") + if (memcmp(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array super block signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_SBLOCK_VERSION) - HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array super block version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array super block version"); /* Extensible array type */ if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class"); /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->hdr->f, &image, &arr_addr); - if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address") + if (H5_addr_ne(arr_addr, udata->hdr->addr)) + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address"); /* Offset of block within the array's address space */ UINT64DECODE_VAR(image, sblock->block_off, udata->hdr->arr_off_size); @@ -1184,7 +1133,7 @@ H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, hbo /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); + assert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); /* Save the super block's size */ sblock->size = len; @@ -1195,7 +1144,7 @@ H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, hbo UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == sblock->size); + assert((size_t)(image - (const uint8_t *)_image) == sblock->size); /* Set return value */ ret_value = sblock; @@ -1204,7 +1153,7 @@ H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, hbo /* Release resources */ if (!ret_value) if (sblock && H5EA__sblock_dest(sblock) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__cache_sblock_deserialize() */ @@ -1216,9 +1165,6 @@ H5EA__cache_sblock_deserialize(const void *_image, size_t len, void *_udata, hbo * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1229,8 +1175,8 @@ H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(sblock); - HDassert(image_len); + assert(sblock); + assert(image_len); /* Set the image length size */ *image_len = sblock->size; @@ -1245,9 +1191,6 @@ H5EA__cache_sblock_image_len(const void *_thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1261,10 +1204,10 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED FUNC_ENTER_PACKAGE_NOERR /* check arguments */ - HDassert(f); - HDassert(image); - HDassert(sblock); - HDassert(sblock->hdr); + assert(f); + assert(image); + assert(sblock); + assert(sblock->hdr); /* Magic number */ H5MM_memcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -1274,7 +1217,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_SBLOCK_VERSION; /* Extensible array type */ - HDassert(sblock->hdr->cparam.cls->id <= 255); + assert(sblock->hdr->cparam.cls->id <= 255); *image++ = (uint8_t)sblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ @@ -1306,7 +1249,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5EA__cache_sblock_serialize() */ @@ -1318,9 +1261,6 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 31 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1332,7 +1272,7 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(sblock); + assert(sblock); /* Determine which action to take */ switch (action) { @@ -1343,7 +1283,7 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between super block and index block, address = %llu", - (unsigned long long)sblock->addr) + (unsigned long long)sblock->addr); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -1353,7 +1293,7 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between super block and header, address = %llu", - (unsigned long long)sblock->addr) + (unsigned long long)sblock->addr); sblock->has_hdr_depend = FALSE; } /* end if */ break; @@ -1364,7 +1304,7 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between super block and index block, address = %llu", - (unsigned long long)sblock->addr) + (unsigned long long)sblock->addr); /* Destroy flush dependency on extensible array header, if set */ if (sblock->has_hdr_depend) { @@ -1372,7 +1312,7 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between super block and header, address = %llu", - (unsigned long long)sblock->addr) + (unsigned long long)sblock->addr); sblock->has_hdr_depend = FALSE; } /* end if */ @@ -1381,7 +1321,7 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing) if (H5AC_proxy_entry_remove_child(sblock->top_proxy, sblock) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between super block and " - "extensible array 'top' proxy") + "extensible array 'top' proxy"); sblock->top_proxy = NULL; } /* end if */ break; @@ -1397,9 +1337,9 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing) default: #ifdef NDEBUG - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ @@ -1415,9 +1355,6 @@ H5EA__cache_sblock_notify(H5AC_notify_action_t action, void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1428,11 +1365,11 @@ H5EA__cache_sblock_free_icr(void *thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(thing); + assert(thing); /* Release the extensible array super block */ if (H5EA__sblock_dest((H5EA_sblock_t *)thing) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array super block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array super block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1445,9 +1382,6 @@ H5EA__cache_sblock_free_icr(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1459,14 +1393,14 @@ H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->hdr); - HDassert(udata->nelmts > 0); - HDassert(image_len); + assert(udata); + assert(udata->hdr); + assert(udata->nelmts > 0); + assert(image_len); /* Set up fake data block for computing size on disk */ /* (Note: extracted from H5EA__dblock_alloc) */ - HDmemset(&dblock, 0, sizeof(dblock)); + memset(&dblock, 0, sizeof(dblock)); /* need to set: * @@ -1483,7 +1417,7 @@ H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len) if (udata->nelmts > udata->hdr->dblk_page_nelmts) { /* Set the # of pages in the direct block */ dblock.npages = udata->nelmts / udata->hdr->dblk_page_nelmts; - HDassert(udata->nelmts == (dblock.npages * udata->hdr->dblk_page_nelmts)); + assert(udata->nelmts == (dblock.npages * udata->hdr->dblk_page_nelmts)); } /* end if */ /* Set the image length size */ @@ -1504,8 +1438,6 @@ H5EA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -1519,7 +1451,7 @@ H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -1538,9 +1470,6 @@ H5EA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN * Return: Success: Pointer to a new B-tree. * Failure: NULL * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static void * @@ -1557,40 +1486,40 @@ H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(udata); - HDassert(udata->hdr); - HDassert(udata->parent); - HDassert(udata->nelmts > 0); - HDassert(H5F_addr_defined(udata->dblk_addr)); + assert(udata); + assert(udata->hdr); + assert(udata->parent); + assert(udata->nelmts > 0); + assert(H5_addr_defined(udata->dblk_addr)); /* Allocate the extensible array data block */ if (NULL == (dblock = H5EA__dblock_alloc(udata->hdr, udata->parent, udata->nelmts))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for extensible array data block") + "memory allocation failed for extensible array data block"); - HDassert(((!dblock->npages) && (len == H5EA_DBLOCK_SIZE(dblock))) || - (len == H5EA_DBLOCK_PREFIX_SIZE(dblock))); + assert(((!dblock->npages) && (len == H5EA_DBLOCK_SIZE(dblock))) || + (len == H5EA_DBLOCK_PREFIX_SIZE(dblock))); /* Set the extensible array data block's information */ dblock->addr = udata->dblk_addr; /* Magic number */ - if (HDmemcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array data block signature") + if (memcmp(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array data block signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5EA_DBLOCK_VERSION) - HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array data block version") + HGOTO_ERROR(H5E_EARRAY, H5E_VERSION, NULL, "wrong extensible array data block version"); /* Extensible array type */ if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class") + HGOTO_ERROR(H5E_EARRAY, H5E_BADTYPE, NULL, "incorrect extensible array class"); /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->hdr->f, &image, &arr_addr); - if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address") + if (H5_addr_ne(arr_addr, udata->hdr->addr)) + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, NULL, "wrong extensible array header address"); /* Offset of block within the array's address space */ UINT64DECODE_VAR(image, dblock->block_off, udata->hdr->arr_off_size); @@ -1602,13 +1531,13 @@ H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Decode elements in data block */ /* Convert from raw elements on disk into native elements in memory */ if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements"); image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size); } /* end if */ /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); + assert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); /* Set the data block's size */ /* (Note: This is not the same as the image length, for paged data blocks) */ @@ -1620,7 +1549,7 @@ H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == len); + assert((size_t)(image - (const uint8_t *)_image) == len); /* Set return value */ ret_value = dblock; @@ -1630,9 +1559,9 @@ H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Release resources */ if (!ret_value) if (dblock && H5EA__dblock_dest(dblock) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block"); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__cache_dblock_deserialize() */ /*------------------------------------------------------------------------- @@ -1642,9 +1571,6 @@ H5EA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1655,8 +1581,8 @@ H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(dblock); - HDassert(image_len); + assert(dblock); + assert(image_len); /* Set the image length size */ if (!dblock->npages) @@ -1674,9 +1600,6 @@ H5EA__cache_dblock_image_len(const void *_thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1690,10 +1613,10 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); - HDassert(image); - HDassert(dblock); - HDassert(dblock->hdr); + assert(f); + assert(image); + assert(dblock); + assert(dblock->hdr); /* Magic number */ H5MM_memcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -1703,7 +1626,7 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5EA_DBLOCK_VERSION; /* Extensible array type */ - HDassert(dblock->hdr->cparam.cls->id <= 255); + assert(dblock->hdr->cparam.cls->id <= 255); *image++ = (uint8_t)dblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ @@ -1720,7 +1643,7 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED /* Convert from native elements in memory into raw elements on disk */ if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, dblock->nelmts, dblock->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements"); image += (dblock->nelmts * dblock->hdr->cparam.raw_elmt_size); } /* end if */ @@ -1731,7 +1654,7 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1744,9 +1667,6 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 31 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -1758,7 +1678,7 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(dblock); + assert(dblock); /* Determine which action to take */ switch (action) { @@ -1768,7 +1688,7 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) if (H5EA__create_flush_depend((H5AC_info_t *)dblock->parent, (H5AC_info_t *)dblock) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block and parent, address = %llu", - (unsigned long long)dblock->addr) + (unsigned long long)dblock->addr); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -1778,7 +1698,7 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between direct block and header, address = %llu", - (unsigned long long)dblock->addr) + (unsigned long long)dblock->addr); dblock->has_hdr_depend = FALSE; } /* end if */ break; @@ -1789,7 +1709,7 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block and parent, address = %llu", - (unsigned long long)dblock->addr) + (unsigned long long)dblock->addr); /* Destroy flush dependency on extensible array header, if set */ if (dblock->has_hdr_depend) { @@ -1797,7 +1717,7 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block and header, address = %llu", - (unsigned long long)dblock->addr) + (unsigned long long)dblock->addr); dblock->has_hdr_depend = FALSE; } /* end if */ @@ -1806,7 +1726,7 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block and " - "extensible array 'top' proxy") + "extensible array 'top' proxy"); dblock->top_proxy = NULL; } /* end if */ break; @@ -1822,9 +1742,9 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) default: #ifdef NDEBUG - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ @@ -1840,9 +1760,6 @@ H5EA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1853,11 +1770,11 @@ H5EA__cache_dblock_free_icr(void *thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(thing); + assert(thing); /* Release the extensible array data block */ if (H5EA__dblock_dest((H5EA_dblock_t *)thing) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1887,9 +1804,6 @@ H5EA__cache_dblock_free_icr(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 12/5/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1900,10 +1814,9 @@ H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(dblock); - HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblock->cache_info.type == H5AC_EARRAY_DBLOCK); - HDassert(fsf_size); + assert(dblock); + assert(dblock->cache_info.type == H5AC_EARRAY_DBLOCK); + assert(fsf_size); *fsf_size = dblock->size; @@ -1917,9 +1830,6 @@ H5EA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1930,9 +1840,9 @@ H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->hdr); - HDassert(image_len); + assert(udata); + assert(udata->hdr); + assert(image_len); /* Set the image length size */ *image_len = (size_t)H5EA_DBLK_PAGE_SIZE(udata->hdr); @@ -1949,8 +1859,6 @@ H5EA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -1964,7 +1872,7 @@ H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -1983,9 +1891,6 @@ H5EA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR * Return: Success: Pointer to a new B-tree. * Failure: NULL * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static void * @@ -2001,15 +1906,15 @@ H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(udata); - HDassert(udata->hdr); - HDassert(udata->parent); - HDassert(H5F_addr_defined(udata->dblk_page_addr)); + assert(udata); + assert(udata->hdr); + assert(udata->parent); + assert(H5_addr_defined(udata->dblk_page_addr)); /* Allocate the extensible array data block page */ if (NULL == (dblk_page = H5EA__dblk_page_alloc(udata->hdr, udata->parent))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for extensible array data block page") + "memory allocation failed for extensible array data block page"); /* Set the extensible array data block page's information */ dblk_page->addr = udata->dblk_page_addr; @@ -2020,12 +1925,12 @@ H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, /* Convert from raw elements on disk into native elements in memory */ if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->hdr->dblk_page_nelmts, udata->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDECODE, NULL, "can't decode extensible array data elements"); image += (udata->hdr->dblk_page_nelmts * udata->hdr->cparam.raw_elmt_size); /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); + assert((size_t)(image - (const uint8_t *)_image) == (len - H5EA_SIZEOF_CHKSUM)); /* Set the data block page's size */ dblk_page->size = len; @@ -2036,7 +1941,7 @@ H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == dblk_page->size); + assert((size_t)(image - (const uint8_t *)_image) == dblk_page->size); /* Set return value */ ret_value = dblk_page; @@ -2045,7 +1950,7 @@ H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, /* Release resources */ if (!ret_value) if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__cache_dblk_page_deserialize() */ @@ -2056,9 +1961,6 @@ H5EA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -2069,8 +1971,8 @@ H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(dblk_page); - HDassert(image_len); + assert(dblk_page); + assert(image_len); /* Set the image length size */ *image_len = dblk_page->size; @@ -2085,9 +1987,6 @@ H5EA__cache_dblk_page_image_len(const void *_thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -2102,10 +2001,10 @@ H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_ima FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(dblk_page); - HDassert(dblk_page->hdr); + assert(f); + assert(image); + assert(dblk_page); + assert(dblk_page->hdr); /* Internal information */ @@ -2114,7 +2013,7 @@ H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_ima /* Convert from native elements in memory into raw elements on disk */ if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->hdr->dblk_page_nelmts, dblk_page->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTENCODE, FAIL, "can't encode extensible array data elements"); image += (dblk_page->hdr->dblk_page_nelmts * dblk_page->hdr->cparam.raw_elmt_size); /* Compute metadata checksum */ @@ -2124,7 +2023,7 @@ H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_ima UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2137,9 +2036,6 @@ H5EA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_ima * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 31 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -2151,7 +2047,7 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblk_page); + assert(dblk_page); /* Determine which action to take */ switch (action) { @@ -2162,7 +2058,7 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block page and parent, address = %llu", - (unsigned long long)dblk_page->addr) + (unsigned long long)dblk_page->addr); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -2172,7 +2068,7 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block page and header, " "address = %llu", - (unsigned long long)dblk_page->addr) + (unsigned long long)dblk_page->addr); dblk_page->has_hdr_depend = FALSE; } /* end if */ break; @@ -2183,7 +2079,7 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block page and parent, address = %llu", - (unsigned long long)dblk_page->addr) + (unsigned long long)dblk_page->addr); /* Destroy flush dependency on extensible array header, if set */ if (dblk_page->has_hdr_depend) { @@ -2191,7 +2087,7 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block page and header, " "address = %llu", - (unsigned long long)dblk_page->addr) + (unsigned long long)dblk_page->addr); dblk_page->has_hdr_depend = FALSE; } /* end if */ @@ -2200,7 +2096,7 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block page and " - "extensible array 'top' proxy") + "extensible array 'top' proxy"); dblk_page->top_proxy = NULL; } /* end if */ break; @@ -2216,9 +2112,9 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) default: #ifdef NDEBUG - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ @@ -2234,9 +2130,6 @@ H5EA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 17, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -2247,11 +2140,11 @@ H5EA__cache_dblk_page_free_icr(void *thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(thing); + assert(thing); /* Release the extensible array data block page */ if (H5EA__dblk_page_dest((H5EA_dblk_page_t *)thing) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block page") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, "can't free extensible array data block page"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EAdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EAdbg.c index c3489dc3ef..318448aa7b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EAdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EAdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EAdbg.c - * Sep 11 2008 - * Quincey Koziol * * Purpose: Dump debugging information about an extensible array. * @@ -74,9 +71,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 11 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -91,60 +85,61 @@ H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(H5F_addr_defined(obj_addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(cls); + assert(f); + assert(H5_addr_defined(addr)); + assert(H5_addr_defined(obj_addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(cls); /* Check for debugging context callback available */ if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context"); /* Load the extensible array header */ if (NULL == (hdr = H5EA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header"); /* Print opening message */ - HDfprintf(stream, "%*sExtensible Array Header...\n", indent, ""); + fprintf(stream, "%*sExtensible Array Header...\n", indent, ""); /* Print the values */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Log2(Max. # of elements in array):", (unsigned)hdr->cparam.max_nelmts_bits); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "# of elements in index block:", (unsigned)hdr->cparam.idx_blk_elmts); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Min. # of elements per data block:", (unsigned)hdr->cparam.data_blk_min_elmts); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Min. # of data block pointers for a super block:", - (unsigned)hdr->cparam.sup_blk_min_data_ptrs); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Log2(Max. # of elements in data block page):", - (unsigned)hdr->cparam.max_dblk_page_nelmts_bits); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Highest element index stored (+1):", hdr->stats.stored.max_idx_set); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Number of super blocks created:", hdr->stats.stored.nsuper_blks); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Number of data blocks created:", hdr->stats.stored.ndata_blks); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Number of elements 'realized':", hdr->stats.stored.nelmts); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Index Block Address:", hdr->idx_blk_addr); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Log2(Max. # of elements in array):", (unsigned)hdr->cparam.max_nelmts_bits); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "# of elements in index block:", (unsigned)hdr->cparam.idx_blk_elmts); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Min. # of elements per data block:", (unsigned)hdr->cparam.data_blk_min_elmts); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Min. # of data block pointers for a super block:", (unsigned)hdr->cparam.sup_blk_min_data_ptrs); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Log2(Max. # of elements in data block page):", (unsigned)hdr->cparam.max_dblk_page_nelmts_bits); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Highest element index stored (+1):", hdr->stats.stored.max_idx_set); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of super blocks created:", hdr->stats.stored.nsuper_blks); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of data blocks created:", hdr->stats.stored.ndata_blks); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of elements 'realized':", hdr->stats.stored.nelmts); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Index Block Address:", hdr->idx_blk_addr); done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context") + HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, + "unable to release extensible array debugging context"); if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__hdr_debug() */ @@ -156,9 +151,6 @@ H5EA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 11 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -174,57 +166,57 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(cls); - HDassert(H5F_addr_defined(hdr_addr)); - HDassert(H5F_addr_defined(obj_addr)); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(cls); + assert(H5_addr_defined(hdr_addr)); + assert(H5_addr_defined(obj_addr)); /* Check for debugging context callback available */ if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context"); /* Load the extensible array header */ if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header"); /* Sanity check */ - HDassert(H5F_addr_eq(hdr->idx_blk_addr, addr)); + assert(H5_addr_eq(hdr->idx_blk_addr, addr)); /* Protect index block */ if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) + (unsigned long long)hdr->idx_blk_addr); /* Print opening message */ - HDfprintf(stream, "%*sExtensible Array Index Block...\n", indent, ""); + fprintf(stream, "%*sExtensible Array Index Block...\n", indent, ""); /* Print the values */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Index Block size:", iblock->size); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "# of data block addresses in index block:", iblock->ndblk_addrs); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "# of super block addresses in index block:", iblock->nsblk_addrs); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Index Block size:", iblock->size); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "# of data block addresses in index block:", iblock->ndblk_addrs); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "# of super block addresses in index block:", iblock->nsblk_addrs); /* Check if there are any elements in index block */ if (hdr->cparam.idx_blk_elmts > 0) { unsigned u; /* Local index variable */ /* Print the elements in the index block */ - HDfprintf(stream, "%*sElements in Index Block:\n", indent, ""); + fprintf(stream, "%*sElements in Index Block:\n", indent, ""); for (u = 0; u < hdr->cparam.idx_blk_elmts; u++) { /* Call the class's 'debug' callback */ if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)iblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "can't get element for debugging") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "can't get element for debugging"); } /* end for */ } /* end if */ @@ -234,12 +226,12 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde unsigned u; /* Local index variable */ /* Print the data block addresses in the index block */ - HDfprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, ""); + fprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, ""); for (u = 0; u < iblock->ndblk_addrs; u++) { /* Print address */ HDsnprintf(temp_str, sizeof(temp_str), "Address #%u:", u); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, - iblock->dblk_addrs[u]); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, + iblock->dblk_addrs[u]); } /* end for */ } /* end if */ @@ -249,22 +241,23 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde unsigned u; /* Local index variable */ /* Print the super block addresses in the index block */ - HDfprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, ""); + fprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, ""); for (u = 0; u < iblock->nsblk_addrs; u++) { /* Print address */ HDsnprintf(temp_str, sizeof(temp_str), "Address #%u:", u); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, - iblock->sblk_addrs[u]); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, + iblock->sblk_addrs[u]); } /* end for */ } /* end if */ done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context") + HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, + "unable to release extensible array debugging context"); if (iblock && H5EA__iblock_unprotect(iblock, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block"); if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__iblock_debug() */ @@ -276,9 +269,6 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 30 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -294,24 +284,24 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(cls); - HDassert(H5F_addr_defined(hdr_addr)); - HDassert(H5F_addr_defined(obj_addr)); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(cls); + assert(H5_addr_defined(hdr_addr)); + assert(H5_addr_defined(obj_addr)); /* Check for debugging context callback available */ if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context"); /* Load the extensible array header */ if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header"); /* Protect super block */ /* (Note: setting parent of super block to 'hdr' for this operation should be OK -QAK) */ @@ -319,18 +309,18 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, (sblock = H5EA__sblock_protect(hdr, (H5EA_iblock_t *)hdr, addr, sblk_idx, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect extensible array super block, address = %llu", - (unsigned long long)addr) + (unsigned long long)addr); /* Print opening message */ - HDfprintf(stream, "%*sExtensible Array Super Block...\n", indent, ""); + fprintf(stream, "%*sExtensible Array Super Block...\n", indent, ""); /* Print the values */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Super Block size:", sblock->size); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "# of data block addresses in super block:", sblock->ndblks); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "# of elements in data blocks from this super block:", sblock->dblk_nelmts); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Super Block size:", sblock->size); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "# of data block addresses in super block:", sblock->ndblks); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "# of elements in data blocks from this super block:", sblock->dblk_nelmts); /* Check if there are any data block addresses in super block */ if (sblock->ndblks > 0) { @@ -338,22 +328,23 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, unsigned u; /* Local index variable */ /* Print the data block addresses in the super block */ - HDfprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, ""); + fprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, ""); for (u = 0; u < sblock->ndblks; u++) { /* Print address */ HDsnprintf(temp_str, sizeof(temp_str), "Address #%u:", u); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, - sblock->dblk_addrs[u]); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str, + sblock->dblk_addrs[u]); } /* end for */ } /* end if */ done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context") + HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, + "unable to release extensible array debugging context"); if (sblock && H5EA__sblock_unprotect(sblock, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block"); if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__sblock_debug() */ @@ -365,9 +356,6 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 22 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -384,55 +372,56 @@ H5EA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(cls); - HDassert(H5F_addr_defined(hdr_addr)); - HDassert(H5F_addr_defined(obj_addr)); - HDassert(dblk_nelmts > 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(cls); + assert(H5_addr_defined(hdr_addr)); + assert(H5_addr_defined(obj_addr)); + assert(dblk_nelmts > 0); /* Check for debugging context callback available */ if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to create extensible array debugging context"); /* Load the extensible array header */ if (NULL == (hdr = H5EA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to load extensible array header"); /* Protect data block */ /* (Note: setting parent of data block to 'hdr' for this operation should be OK -QAK) */ if (NULL == (dblock = H5EA__dblock_protect(hdr, hdr, addr, dblk_nelmts, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, - "unable to protect extensible array data block, address = %" PRIuHADDR, addr) + "unable to protect extensible array data block, address = %" PRIuHADDR, addr); /* Print opening message */ - HDfprintf(stream, "%*sExtensible Array data Block...\n", indent, ""); + fprintf(stream, "%*sExtensible Array data Block...\n", indent, ""); /* Print the values */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data Block size:", dblock->size); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data Block size:", dblock->size); /* Print the elements in the index block */ - HDfprintf(stream, "%*sElements:\n", indent, ""); + fprintf(stream, "%*sElements:\n", indent, ""); for (u = 0; u < dblk_nelmts; u++) { /* Call the class's 'debug' callback */ if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "can't get element for debugging") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "can't get element for debugging"); } /* end for */ done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to release extensible array debugging context") + HDONE_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, + "unable to release extensible array debugging context"); if (dblock && H5EA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block"); if (hdr && H5EA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__dblock_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EAdblkpage.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EAdblkpage.c index 8d0934120f..3ebbcd753e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EAdblkpage.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EAdblkpage.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EAdblkpage.c - * Nov 20 2008 - * Quincey Koziol * * Purpose: Data block page routines for extensible arrays. * @@ -79,9 +76,6 @@ H5FL_DEFINE_STATIC(H5EA_dblk_page_t); * * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Quincey Koziol - * Nov 20 2008 - * *------------------------------------------------------------------------- */ H5EA_dblk_page_t * @@ -93,16 +87,16 @@ H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(hdr); + assert(hdr); /* Allocate memory for the data block */ if (NULL == (dblk_page = H5FL_CALLOC(H5EA_dblk_page_t))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for extensible array data block page") + "memory allocation failed for extensible array data block page"); /* Share common array information */ if (H5EA__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header"); dblk_page->hdr = hdr; /* Set non-zero internal fields */ @@ -111,7 +105,7 @@ H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent) /* Allocate buffer for elements in data block page */ if (NULL == (dblk_page->elmts = H5EA__hdr_alloc_elmts(hdr, hdr->dblk_page_nelmts))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for data block page element buffer") + "memory allocation failed for data block page element buffer"); /* Set the return value */ ret_value = dblk_page; @@ -119,7 +113,7 @@ H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent) done: if (!ret_value) if (dblk_page && H5EA__dblk_page_dest(dblk_page) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block page"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__dblk_page_alloc() */ @@ -131,9 +125,6 @@ H5EA__dblk_page_alloc(H5EA_hdr_t *hdr, H5EA_sblock_t *parent) * * Return: Valid file address on success/HADDR_UNDEF on failure * - * Programmer: Quincey Koziol - * Nov 20 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -146,12 +137,12 @@ H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Allocate the data block page */ if (NULL == (dblk_page = H5EA__dblk_page_alloc(hdr, parent))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, FAIL, - "memory allocation failed for extensible array data block page") + "memory allocation failed for extensible array data block page"); /* Set info about data block page on disk */ dblk_page->addr = addr; @@ -160,18 +151,18 @@ H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr) /* Clear any elements in data block page to fill value */ if ((hdr->cparam.cls->fill)(dblk_page->elmts, (size_t)hdr->dblk_page_nelmts) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, - "can't set extensible array data block page elements to class's fill value") + "can't set extensible array data block page elements to class's fill value"); /* Cache the new extensible array data block page */ if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, FAIL, "can't add extensible array data block page to cache") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, FAIL, "can't add extensible array data block page to cache"); inserted = TRUE; /* Add data block page as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, FAIL, - "unable to add extensible array entry as child of array proxy") + "unable to add extensible array entry as child of array proxy"); dblk_page->top_proxy = hdr->top_proxy; } /* end if */ @@ -182,12 +173,12 @@ H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr) if (inserted) if (H5AC_remove_entry(dblk_page) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, FAIL, - "unable to remove extensible array data block page from cache") + "unable to remove extensible array data block page from cache"); /* Destroy data block page */ if (H5EA__dblk_page_dest(dblk_page) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, - "unable to destroy extensible array data block page") + "unable to destroy extensible array data block page"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -201,9 +192,6 @@ H5EA__dblk_page_create(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t addr) * * Return: Non-NULL pointer to data block page on success/NULL on failure * - * Programmer: Quincey Koziol - * Nov 20 2008 - * *------------------------------------------------------------------------- */ H5EA_dblk_page_t * @@ -216,11 +204,11 @@ H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_pag FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(H5F_addr_defined(dblk_page_addr)); + assert(hdr); + assert(H5_addr_defined(dblk_page_addr)); /* only the H5AC__READ_ONLY_FLAG may be set */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up user data */ udata.hdr = hdr; @@ -232,14 +220,14 @@ H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_pag &udata, flags))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, "unable to protect extensible array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + (unsigned long long)dblk_page_addr); /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == dblk_page->top_proxy) { /* Add data block page as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL, - "unable to add extensible array entry as child of array proxy") + "unable to add extensible array entry as child of array proxy"); dblk_page->top_proxy = hdr->top_proxy; } /* end if */ @@ -254,7 +242,7 @@ H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_pag H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, "unable to unprotect extensible array data block page, address = %llu", - (unsigned long long)dblk_page->addr) + (unsigned long long)dblk_page->addr); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__dblk_page_protect() */ @@ -267,9 +255,6 @@ H5EA__dblk_page_protect(H5EA_hdr_t *hdr, H5EA_sblock_t *parent, haddr_t dblk_pag * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 20 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -280,13 +265,13 @@ H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblk_page); + assert(dblk_page); /* Unprotect the data block page */ if (H5AC_unprotect(dblk_page->hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to unprotect extensible array data block page, address = %llu", - (unsigned long long)dblk_page->addr) + (unsigned long long)dblk_page->addr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -299,9 +284,6 @@ H5EA__dblk_page_unprotect(H5EA_dblk_page_t *dblk_page, unsigned cache_flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 20 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -312,8 +294,8 @@ H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblk_page); - HDassert(!dblk_page->has_hdr_depend); + assert(dblk_page); + assert(!dblk_page->has_hdr_depend); /* Check if header field has been initialized */ if (dblk_page->hdr) { @@ -322,19 +304,19 @@ H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page) /* Free buffer for data block page elements */ if (H5EA__hdr_free_elmts(dblk_page->hdr, dblk_page->hdr->dblk_page_nelmts, dblk_page->elmts) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, - "unable to free extensible array data block element buffer") + "unable to free extensible array data block element buffer"); dblk_page->elmts = NULL; } /* end if */ /* Decrement reference count on shared info */ if (H5EA__hdr_decr(dblk_page->hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared array header") + "can't decrement reference count on shared array header"); dblk_page->hdr = NULL; } /* end if */ /* Sanity check */ - HDassert(NULL == dblk_page->top_proxy); + assert(NULL == dblk_page->top_proxy); /* Free the data block page itself */ dblk_page = H5FL_FREE(H5EA_dblk_page_t, dblk_page); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EAdblock.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EAdblock.c index 8de3b5cc38..64b01ed9e3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EAdblock.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EAdblock.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EAdblock.c - * Sep 11 2008 - * Quincey Koziol * * Purpose: Data block routines for extensible arrays. * @@ -80,9 +77,6 @@ H5FL_DEFINE_STATIC(H5EA_dblock_t); * * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Quincey Koziol - * Sep 11 2008 - * *------------------------------------------------------------------------- */ H5EA_dblock_t * @@ -94,18 +88,18 @@ H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(hdr); - HDassert(parent); - HDassert(nelmts > 0); + assert(hdr); + assert(parent); + assert(nelmts > 0); /* Allocate memory for the data block */ if (NULL == (dblock = H5FL_CALLOC(H5EA_dblock_t))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for extensible array data block") + "memory allocation failed for extensible array data block"); /* Share common array information */ if (H5EA__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header"); dblock->hdr = hdr; /* Set non-zero internal fields */ @@ -116,13 +110,13 @@ H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts) if (nelmts > hdr->dblk_page_nelmts) { /* Set the # of pages in the direct block */ dblock->npages = nelmts / hdr->dblk_page_nelmts; - HDassert(nelmts == (dblock->npages * hdr->dblk_page_nelmts)); + assert(nelmts == (dblock->npages * hdr->dblk_page_nelmts)); } /* end if */ else { /* Allocate buffer for elements in data block */ if (NULL == (dblock->elmts = H5EA__hdr_alloc_elmts(hdr, nelmts))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for data block element buffer") + "memory allocation failed for data block element buffer"); } /* end else */ /* Set the return value */ @@ -131,7 +125,7 @@ H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts) done: if (!ret_value) if (dblock && H5EA__dblock_dest(dblock) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array data block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__dblock_alloc() */ @@ -143,9 +137,6 @@ H5EA__dblock_alloc(H5EA_hdr_t *hdr, void *parent, size_t nelmts) * * Return: Valid file address on success/HADDR_UNDEF on failure * - * Programmer: Quincey Koziol - * Sep 9 2008 - * *------------------------------------------------------------------------- */ haddr_t @@ -159,14 +150,14 @@ H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(stats_changed); - HDassert(nelmts > 0); + assert(hdr); + assert(stats_changed); + assert(nelmts > 0); /* Allocate the data block */ if (NULL == (dblock = H5EA__dblock_alloc(hdr, parent, nelmts))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "memory allocation failed for extensible array data block") + "memory allocation failed for extensible array data block"); /* Set size of data block on disk */ dblock->size = H5EA_DBLOCK_SIZE(dblock); @@ -177,7 +168,7 @@ H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize /* Allocate space for the data block on disk */ if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_DBLOCK, (hsize_t)dblock->size))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "file allocation failed for extensible array data block") + "file allocation failed for extensible array data block"); dblock->addr = dblock_addr; /* Don't initialize elements if paged */ @@ -185,18 +176,19 @@ H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize /* Clear any elements in data block to fill value */ if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)dblock->nelmts) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, - "can't set extensible array data block elements to class's fill value") + "can't set extensible array data block elements to class's fill value"); /* Cache the new extensible array data block */ if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add extensible array data block to cache") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, + "can't add extensible array data block to cache"); inserted = TRUE; /* Add data block as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, - "unable to add extensible array entry as child of array proxy") + "unable to add extensible array entry as child of array proxy"); dblock->top_proxy = hdr->top_proxy; } /* end if */ @@ -214,24 +206,24 @@ H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize ret_value = dblock_addr; done: - if (!H5F_addr_defined(ret_value)) + if (!H5_addr_defined(ret_value)) if (dblock) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(dblock) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF, - "unable to remove extensible array data block from cache") + "unable to remove extensible array data block from cache"); /* Release data block's disk space */ - if (H5F_addr_defined(dblock->addr) && + if (H5_addr_defined(dblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, - "unable to release extensible array data block") + "unable to release extensible array data block"); /* Destroy data block */ if (H5EA__dblock_dest(dblock) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, - "unable to destroy extensible array data block") + "unable to destroy extensible array data block"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -245,9 +237,6 @@ H5EA__dblock_create(H5EA_hdr_t *hdr, void *parent, hbool_t *stats_changed, hsize * * Return: Super block index on success/Can't fail * - * Programmer: Quincey Koziol - * Sep 11 2008 - * *------------------------------------------------------------------------- */ unsigned @@ -258,8 +247,8 @@ H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(hdr); - HDassert(idx >= hdr->cparam.idx_blk_elmts); + assert(hdr); + assert(idx >= hdr->cparam.idx_blk_elmts); /* Adjust index for elements in index block */ idx -= hdr->cparam.idx_blk_elmts; @@ -278,9 +267,6 @@ H5EA__dblock_sblk_idx(const H5EA_hdr_t *hdr, hsize_t idx) * * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Quincey Koziol - * Sep 18 2008 - * *------------------------------------------------------------------------- */ H5EA_dblock_t * @@ -293,12 +279,12 @@ H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t db FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(H5F_addr_defined(dblk_addr)); - HDassert(dblk_nelmts); + assert(hdr); + assert(H5_addr_defined(dblk_addr)); + assert(dblk_nelmts); /* only the H5AC__READ_ONLY_FLAG may be set */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up user data */ udata.hdr = hdr; @@ -311,14 +297,14 @@ H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t db (dblock = (H5EA_dblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_DBLOCK, dblk_addr, &udata, flags))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, "unable to protect extensible array data block, address = %llu", - (unsigned long long)dblk_addr) + (unsigned long long)dblk_addr); /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == dblock->top_proxy) { /* Add data block as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL, - "unable to add extensible array entry as child of array proxy") + "unable to add extensible array entry as child of array proxy"); dblock->top_proxy = hdr->top_proxy; } @@ -334,7 +320,7 @@ H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t db H5AC_unprotect(hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, "unable to unprotect extensible array data block, address = %llu", - (unsigned long long)dblock->addr) + (unsigned long long)dblock->addr); } FUNC_LEAVE_NOAPI(ret_value) @@ -347,9 +333,6 @@ H5EA__dblock_protect(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t db * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 11 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -360,13 +343,13 @@ H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblock); + assert(dblock); /* Unprotect the data block */ if (H5AC_unprotect(dblock->hdr->f, H5AC_EARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to unprotect extensible array data block, address = %llu", - (unsigned long long)dblock->addr) + (unsigned long long)dblock->addr); done: @@ -380,9 +363,6 @@ H5EA__dblock_unprotect(H5EA_dblock_t *dblock, unsigned cache_flags) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 22 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -394,16 +374,16 @@ H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dbl FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(parent); - HDassert(H5F_addr_defined(dblk_addr)); - HDassert(dblk_nelmts > 0); + assert(hdr); + assert(parent); + assert(H5_addr_defined(dblk_addr)); + assert(dblk_nelmts > 0); /* Protect data block */ if (NULL == (dblock = H5EA__dblock_protect(hdr, parent, dblk_addr, dblk_nelmts, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect extensible array data block, address = %llu", - (unsigned long long)dblk_addr) + (unsigned long long)dblk_addr); /* Check if this is a paged data block */ if (dblk_nelmts > hdr->dblk_page_nelmts) { @@ -422,7 +402,7 @@ H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dbl /* (OK to call if it doesn't exist in the cache) */ if (H5AC_expunge_entry(hdr->f, H5AC_EARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTEXPUNGE, FAIL, - "unable to remove array data block page from metadata cache") + "unable to remove array data block page from metadata cache"); /* Advance to next page address */ dblk_page_addr += dblk_page_size; @@ -433,7 +413,7 @@ H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dbl /* Finished deleting data block in metadata cache */ if (dblock && H5EA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array data block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__dblock_delete() */ @@ -445,9 +425,6 @@ H5EA__dblock_delete(H5EA_hdr_t *hdr, void *parent, haddr_t dblk_addr, size_t dbl * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 11 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -458,18 +435,18 @@ H5EA__dblock_dest(H5EA_dblock_t *dblock) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblock); - HDassert(!dblock->has_hdr_depend); + assert(dblock); + assert(!dblock->has_hdr_depend); /* Check if shared header field has been initialized */ if (dblock->hdr) { /* Check if we've got elements in the data block */ if (dblock->elmts && !dblock->npages) { /* Free buffer for data block elements */ - HDassert(dblock->nelmts > 0); + assert(dblock->nelmts > 0); if (H5EA__hdr_free_elmts(dblock->hdr, dblock->nelmts, dblock->elmts) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTFREE, FAIL, - "unable to free extensible array data block element buffer") + "unable to free extensible array data block element buffer"); dblock->elmts = NULL; dblock->nelmts = 0; } /* end if */ @@ -477,12 +454,12 @@ H5EA__dblock_dest(H5EA_dblock_t *dblock) /* Decrement reference count on shared info */ if (H5EA__hdr_decr(dblock->hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared array header") + "can't decrement reference count on shared array header"); dblock->hdr = NULL; } /* end if */ /* Sanity check */ - HDassert(NULL == dblock->top_proxy); + assert(NULL == dblock->top_proxy); /* Free the data block itself */ dblock = H5FL_FREE(H5EA_dblock_t, dblock); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EAhdr.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EAhdr.c index daf4d6e557..1364d7b335 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EAhdr.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EAhdr.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EAhdr.c - * Aug 26 2008 - * Quincey Koziol * * Purpose: Array header routines for extensible arrays. * @@ -97,9 +94,6 @@ H5FL_SEQ_DEFINE_STATIC(H5EA_sblk_info_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 26 2008 - * *------------------------------------------------------------------------- */ H5EA_hdr_t * @@ -111,12 +105,12 @@ H5EA__hdr_alloc(H5F_t *f) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); + assert(f); /* Allocate space for the shared information */ if (NULL == (hdr = H5FL_CALLOC(H5EA_hdr_t))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for extensible array shared header") + "memory allocation failed for extensible array shared header"); /* Set non-zero internal fields */ hdr->addr = HADDR_UNDEF; @@ -133,7 +127,7 @@ H5EA__hdr_alloc(H5F_t *f) done: if (!ret_value) if (hdr && H5EA__hdr_dest(hdr) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__hdr_alloc() */ @@ -168,9 +162,6 @@ H5EA__hdr_alloc(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 18 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -184,10 +175,10 @@ H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(hdr->cparam.max_nelmts_bits); - HDassert(hdr->cparam.data_blk_min_elmts); - HDassert(hdr->cparam.sup_blk_min_data_ptrs); + assert(hdr); + assert(hdr->cparam.max_nelmts_bits); + assert(hdr->cparam.data_blk_min_elmts); + assert(hdr->cparam.sup_blk_min_data_ptrs); /* Compute general information */ hdr->nsblks = 1 + (hdr->cparam.max_nelmts_bits - H5VM_log2_of2(hdr->cparam.data_blk_min_elmts)); @@ -196,7 +187,7 @@ H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata) /* Allocate information for each super block */ if (NULL == (hdr->sblk_info = H5FL_SEQ_MALLOC(H5EA_sblk_info_t, hdr->nsblks))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, FAIL, "memory allocation failed for super block info array") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, FAIL, "memory allocation failed for super block info array"); /* Compute information about each super block */ start_idx = 0; @@ -219,7 +210,7 @@ H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata) if (hdr->cparam.cls->crt_context) { if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, FAIL, - "unable to create extensible array client callback context") + "unable to create extensible array client callback context"); } done: @@ -233,9 +224,6 @@ H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata) * * Return: Non-NULL pointer to buffer for elements on success/NULL on failure * - * Programmer: Quincey Koziol - * Sep 16 2008 - * *------------------------------------------------------------------------- */ void * @@ -248,8 +236,8 @@ H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(hdr); - HDassert(nelmts > 0); + assert(hdr); + assert(nelmts > 0); /* Compute the index of the element buffer factory */ H5_CHECK_OVERFLOW(nelmts, /*From:*/ size_t, /*To:*/ uint32_t); @@ -264,11 +252,11 @@ H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts) /* Re-allocate array of element factories */ if (NULL == (new_fac = H5FL_SEQ_REALLOC(H5FL_fac_head_ptr_t, hdr->elmt_fac.fac, new_nalloc))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for data block data element buffer factory array") + "memory allocation failed for data block data element buffer factory array"); /* Zero out new elements allocated */ - HDmemset(new_fac + hdr->elmt_fac.nalloc, 0, - (new_nalloc - hdr->elmt_fac.nalloc) * sizeof(H5FL_fac_head_ptr_t)); + memset(new_fac + hdr->elmt_fac.nalloc, 0, + (new_nalloc - hdr->elmt_fac.nalloc) * sizeof(H5FL_fac_head_ptr_t)); /* Update information about element factories in header */ hdr->elmt_fac.nalloc = new_nalloc; @@ -278,13 +266,14 @@ H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts) /* Check for un-initialized factory at index */ if (NULL == hdr->elmt_fac.fac[idx]) { if (NULL == (hdr->elmt_fac.fac[idx] = H5FL_fac_init(nelmts * (size_t)hdr->cparam.cls->nat_elmt_size))) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, "can't create data block data element buffer factory") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, NULL, + "can't create data block data element buffer factory"); } /* end if */ /* Allocate buffer for elements in index block */ if (NULL == (elmts = H5FL_FAC_MALLOC(hdr->elmt_fac.fac[idx]))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for data block data element buffer") + "memory allocation failed for data block data element buffer"); /* Set the return value */ ret_value = elmts; @@ -304,9 +293,6 @@ H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 18 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -317,17 +303,17 @@ H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(hdr); - HDassert(nelmts > 0); - HDassert(elmts); + assert(hdr); + assert(nelmts > 0); + assert(elmts); /* Compute the index of the element buffer factory */ H5_CHECK_OVERFLOW(nelmts, /*From:*/ size_t, /*To:*/ uint32_t); idx = H5VM_log2_of2((uint32_t)nelmts) - H5VM_log2_of2((uint32_t)hdr->cparam.data_blk_min_elmts); /* Free buffer for elements in index block */ - HDassert(idx < hdr->elmt_fac.nalloc); - HDassert(hdr->elmt_fac.fac[idx]); + assert(idx < hdr->elmt_fac.nalloc); + assert(hdr->elmt_fac.fac[idx]); elmts = H5FL_FAC_FREE(hdr->elmt_fac.fac[idx], elmts); FUNC_LEAVE_NOAPI(SUCCEED) @@ -341,9 +327,6 @@ H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts) * Return: Success: Address of new header in the file * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol - * Jun 17 2008 - * *------------------------------------------------------------------------- */ haddr_t @@ -356,8 +339,8 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(cparam); + assert(f); + assert(cparam); #ifndef NDEBUG { @@ -367,26 +350,27 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata) /* Check for valid parameters */ if (cparam->raw_elmt_size == 0) - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, "element size must be greater than zero") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, "element size must be greater than zero"); if (cparam->max_nelmts_bits == 0) HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, - "max. # of elements bits must be greater than zero") + "max. # of elements bits must be greater than zero"); if (cparam->max_nelmts_bits > H5EA_MAX_NELMTS_IDX_MAX) HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, "max. # of elements bits must be <= %u", - (unsigned)H5EA_MAX_NELMTS_IDX_MAX) + (unsigned)H5EA_MAX_NELMTS_IDX_MAX); if (cparam->sup_blk_min_data_ptrs < 2) HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, - "min # of data block pointers in super block must be >= two") + "min # of data block pointers in super block must be >= two"); if (!POWER_OF_TWO(cparam->sup_blk_min_data_ptrs)) HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, - "min # of data block pointers in super block must be power of two") + "min # of data block pointers in super block must be power of two"); if (!POWER_OF_TWO(cparam->data_blk_min_elmts)) HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, - "min # of elements per data block must be power of two") + "min # of elements per data block must be power of two"); dblk_page_nelmts = (size_t)1 << cparam->max_dblk_page_nelmts_bits; if (dblk_page_nelmts < cparam->idx_blk_elmts) - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, - "# of elements per data block page must be greater than # of elements in index block") + HGOTO_ERROR( + H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, + "# of elements per data block page must be greater than # of elements in index block"); /* Compute the number of elements in data blocks for first actual super block */ sblk_idx = H5EA_SBLK_FIRST_IDX(cparam->sup_blk_min_data_ptrs); @@ -394,18 +378,18 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata) if (dblk_page_nelmts < dblk_nelmts) HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, "max. # of elements per data block page bits must be > # of elements in " - "first data block from super block") + "first data block from super block"); if (cparam->max_dblk_page_nelmts_bits > cparam->max_nelmts_bits) HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, HADDR_UNDEF, - "max. # of elements per data block page bits must be <= max. # of elements bits") + "max. # of elements per data block page bits must be <= max. # of elements bits"); } #endif /* NDEBUG */ /* Allocate space for the shared information */ if (NULL == (hdr = H5EA__hdr_alloc(f))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "memory allocation failed for extensible array shared header") + "memory allocation failed for extensible array shared header"); /* Set the internal parameters for the array */ hdr->idx_blk_addr = HADDR_UNDEF; @@ -416,50 +400,50 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata) /* Finish initializing extensible array header */ if (H5EA__hdr_init(hdr, ctx_udata) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTINIT, HADDR_UNDEF, - "initialization failed for extensible array header") + "initialization failed for extensible array header"); /* Allocate space for the header on disk */ if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_EARRAY_HDR, (hsize_t)hdr->size))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "file allocation failed for extensible array header") + "file allocation failed for extensible array header"); /* Create 'top' proxy for extensible array entries */ if (hdr->swmr_write) if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create extensible array entry proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create extensible array entry proxy"); /* Cache the new extensible array header */ if (H5AC_insert_entry(f, H5AC_EARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add extensible array header to cache") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add extensible array header to cache"); inserted = TRUE; /* Add header as child of 'top' proxy */ if (hdr->top_proxy) if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, - "unable to add extensible array entry as child of array proxy") + "unable to add extensible array entry as child of array proxy"); /* Set address of array header to return */ ret_value = hdr->addr; done: - if (!H5F_addr_defined(ret_value)) + if (!H5_addr_defined(ret_value)) if (hdr) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(hdr) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF, - "unable to remove extensible array header from cache") + "unable to remove extensible array header from cache"); /* Release header's disk space */ - if (H5F_addr_defined(hdr->addr) && + if (H5_addr_defined(hdr->addr) && H5MF_xfree(f, H5FD_MEM_EARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to free extensible array header") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to free extensible array header"); /* Destroy header */ if (H5EA__hdr_dest(hdr) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, - "unable to destroy extensible array header") + "unable to destroy extensible array header"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -472,9 +456,6 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 26 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -485,12 +466,12 @@ H5EA__hdr_incr(H5EA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Mark header as un-evictable when something is depending on it */ if (hdr->rc == 0) if (H5AC_pin_protected_entry(hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTPIN, FAIL, "unable to pin extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTPIN, FAIL, "unable to pin extensible array header"); /* Increment reference count on shared header */ hdr->rc++; @@ -506,9 +487,6 @@ H5EA__hdr_incr(H5EA_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 26 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -519,17 +497,17 @@ H5EA__hdr_decr(H5EA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(hdr->rc); + assert(hdr); + assert(hdr->rc); /* Decrement reference count on shared header */ hdr->rc--; /* Mark header as evictable again when nothing depend on it */ if (hdr->rc == 0) { - HDassert(hdr->file_rc == 0); + assert(hdr->file_rc == 0); if (H5AC_unpin_entry(hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin extensible array header"); } done: @@ -543,9 +521,6 @@ H5EA__hdr_decr(H5EA_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 26 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -554,7 +529,7 @@ H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Increment file reference count on shared header */ hdr->file_rc++; @@ -570,9 +545,6 @@ H5EA__hdr_fuse_incr(H5EA_hdr_t *hdr) * Return: Success: The reference count of the header * Failure: Can't fail * - * Programmer: Quincey Koziol - * Aug 26 2008 - * *------------------------------------------------------------------------- */ size_t @@ -583,8 +555,8 @@ H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(hdr); - HDassert(hdr->file_rc); + assert(hdr); + assert(hdr->file_rc); /* Decrement file reference count on shared header */ hdr->file_rc--; @@ -602,9 +574,6 @@ H5EA__hdr_fuse_decr(H5EA_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 9 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -615,12 +584,12 @@ H5EA__hdr_modified(H5EA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(hdr->f); + assert(hdr); + assert(hdr->f); /* Mark header as dirty in cache */ if (H5AC_mark_entry_dirty(hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark extensible array header as dirty") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark extensible array header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -633,9 +602,6 @@ H5EA__hdr_modified(H5EA_hdr_t *hdr) * * Return: Non-NULL pointer to header on success/NULL on failure * - * Programmer: Quincey Koziol - * Jul 31 2013 - * *------------------------------------------------------------------------- */ H5EA_hdr_t * @@ -648,11 +614,11 @@ H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(H5F_addr_defined(ea_addr)); + assert(f); + assert(H5_addr_defined(ea_addr)); /* only the H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up user data for cache callbacks */ udata.f = f; @@ -662,19 +628,19 @@ H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags) /* Protect the header */ if (NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, H5AC_EARRAY_HDR, ea_addr, &udata, flags))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, - "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr) + "unable to protect extensible array header, address = %llu", (unsigned long long)ea_addr); hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ /* Create top proxy, if it doesn't exist */ if (hdr->swmr_write && NULL == hdr->top_proxy) { /* Create 'top' proxy for extensible array entries */ if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, NULL, "can't create extensible array entry proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTCREATE, NULL, "can't create extensible array entry proxy"); /* Add header as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL, - "unable to add extensible array entry as child of array proxy") + "unable to add extensible array entry as child of array proxy"); } /* end if */ /* Set return value */ @@ -691,9 +657,6 @@ H5EA__hdr_protect(H5F_t *f, haddr_t ea_addr, void *ctx_udata, unsigned flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 1 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -704,12 +667,13 @@ H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Unprotect the header */ if (H5AC_unprotect(hdr->f, H5AC_EARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect extensible array hdr, address = %llu", (unsigned long long)hdr->addr) + "unable to unprotect extensible array hdr, address = %llu", + (unsigned long long)hdr->addr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -722,9 +686,6 @@ H5EA__hdr_unprotect(H5EA_hdr_t *hdr, unsigned cache_flags) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 26 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -736,26 +697,26 @@ H5EA__hdr_delete(H5EA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(!hdr->file_rc); + assert(hdr); + assert(!hdr->file_rc); #ifndef NDEBUG unsigned hdr_status = 0; /* Array header's status in the metadata cache */ /* Check the array header's status in the metadata cache */ if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header"); /* Sanity checks on array header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PROTECTED); + assert(hdr_status & H5AC_ES__IN_CACHE); + assert(hdr_status & H5AC_ES__IS_PROTECTED); #endif /* NDEBUG */ /* Check for index block */ - if (H5F_addr_defined(hdr->idx_blk_addr)) { + if (H5_addr_defined(hdr->idx_blk_addr)) { /* Delete index block */ if (H5EA__iblock_delete(hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array index block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array index block"); } /* end if */ /* Set flags to finish deleting header on unprotect */ @@ -765,7 +726,7 @@ H5EA__hdr_delete(H5EA_hdr_t *hdr) /* Unprotect the header, deleting it if an error hasn't occurred */ if (H5EA__hdr_unprotect(hdr, cache_flags) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__hdr_delete() */ @@ -777,9 +738,6 @@ H5EA__hdr_delete(H5EA_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 11 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -790,14 +748,14 @@ H5EA__hdr_dest(H5EA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(hdr); - HDassert(hdr->rc == 0); + assert(hdr); + assert(hdr->rc == 0); /* Destroy the callback context */ if (hdr->cb_ctx) { if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, - "unable to destroy extensible array client callback context") + "unable to destroy extensible array client callback context"); } /* end if */ hdr->cb_ctx = NULL; @@ -806,7 +764,7 @@ H5EA__hdr_dest(H5EA_hdr_t *hdr) unsigned u; /* Local index variable */ /* Sanity check */ - HDassert(hdr->elmt_fac.nalloc > 0); + assert(hdr->elmt_fac.nalloc > 0); /* Iterate over factories, shutting them down */ for (u = 0; u < hdr->elmt_fac.nalloc; u++) { @@ -814,7 +772,7 @@ H5EA__hdr_dest(H5EA_hdr_t *hdr) if (hdr->elmt_fac.fac[u]) { if (H5FL_fac_term(hdr->elmt_fac.fac[u]) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, - "unable to destroy extensible array header factory") + "unable to destroy extensible array header factory"); hdr->elmt_fac.fac[u] = NULL; } /* end if */ } /* end for */ @@ -830,7 +788,7 @@ H5EA__hdr_dest(H5EA_hdr_t *hdr) /* Destroy the 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to destroy extensible array 'top' proxy") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTRELEASE, FAIL, "unable to destroy extensible array 'top' proxy"); hdr->top_proxy = NULL; } /* end if */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EAiblock.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EAiblock.c index 5afb28a421..28ffcc3b05 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EAiblock.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EAiblock.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EAiblock.c - * Sep 9 2008 - * Quincey Koziol * * Purpose: Index block routines for extensible arrays. * @@ -86,9 +83,6 @@ H5FL_SEQ_DEFINE_STATIC(haddr_t); * * Return: Non-NULL pointer to index block on success/NULL on failure * - * Programmer: Quincey Koziol - * Sep 9 2008 - * *------------------------------------------------------------------------- */ H5EA_iblock_t * @@ -100,16 +94,16 @@ H5EA__iblock_alloc(H5EA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(hdr); + assert(hdr); /* Allocate memory for the index block */ if (NULL == (iblock = H5FL_CALLOC(H5EA_iblock_t))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for extensible array index block") + "memory allocation failed for extensible array index block"); /* Share common array information */ if (H5EA__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header"); iblock->hdr = hdr; /* Set non-zero internal fields */ @@ -126,19 +120,19 @@ H5EA__iblock_alloc(H5EA_hdr_t *hdr) (iblock->elmts = H5FL_BLK_MALLOC( idx_blk_elmt_buf, (size_t)(hdr->cparam.idx_blk_elmts * hdr->cparam.cls->nat_elmt_size)))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for index block data element buffer") + "memory allocation failed for index block data element buffer"); /* Allocate buffer for data block addresses in index block */ if (iblock->ndblk_addrs > 0) if (NULL == (iblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->ndblk_addrs))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for index block data block addresses") + "memory allocation failed for index block data block addresses"); /* Allocate buffer for super block addresses in index block */ if (iblock->nsblk_addrs > 0) if (NULL == (iblock->sblk_addrs = H5FL_SEQ_MALLOC(haddr_t, iblock->nsblk_addrs))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for index block super block addresses") + "memory allocation failed for index block super block addresses"); /* Set the return value */ ret_value = iblock; @@ -146,7 +140,7 @@ H5EA__iblock_alloc(H5EA_hdr_t *hdr) done: if (!ret_value) if (iblock && H5EA__iblock_dest(iblock) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array index block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__iblock_alloc() */ @@ -157,9 +151,6 @@ H5EA__iblock_alloc(H5EA_hdr_t *hdr) * * Return: Valid file address on success/HADDR_UNDEF on failure * - * Programmer: Quincey Koziol - * Sep 9 2008 - * *------------------------------------------------------------------------- */ haddr_t @@ -173,13 +164,13 @@ H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(stats_changed); + assert(hdr); + assert(stats_changed); /* Allocate the index block */ if (NULL == (iblock = H5EA__iblock_alloc(hdr))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "memory allocation failed for extensible array index block") + "memory allocation failed for extensible array index block"); /* Set size of index block on disk */ iblock->size = H5EA_IBLOCK_SIZE(iblock); @@ -187,7 +178,7 @@ H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed) /* Allocate space for the index block on disk */ if (HADDR_UNDEF == (iblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_IBLOCK, (hsize_t)iblock->size))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "file allocation failed for extensible array index block") + "file allocation failed for extensible array index block"); iblock->addr = iblock_addr; /* Clear any elements in index block to fill value */ @@ -195,7 +186,7 @@ H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed) /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(iblock->elmts, (size_t)hdr->cparam.idx_blk_elmts) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, - "can't set extensible array index block elements to class's fill value") + "can't set extensible array index block elements to class's fill value"); } /* end if */ /* Reset any data block addresses in the index block */ @@ -217,20 +208,20 @@ H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed) /* Cache the new extensible array index block */ if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_IBLOCK, iblock_addr, iblock, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, - "can't add extensible array index block to cache") + "can't add extensible array index block to cache"); inserted = TRUE; /* Add index block as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, - "unable to add extensible array entry as child of array proxy") + "unable to add extensible array entry as child of array proxy"); iblock->top_proxy = hdr->top_proxy; } /* end if */ /* Update extensible array index block statistics */ - HDassert(0 == hdr->stats.computed.nindex_blks); - HDassert(0 == hdr->stats.computed.index_blk_size); + assert(0 == hdr->stats.computed.nindex_blks); + assert(0 == hdr->stats.computed.index_blk_size); hdr->stats.computed.nindex_blks = 1; hdr->stats.computed.index_blk_size = iblock->size; @@ -244,24 +235,24 @@ H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed) ret_value = iblock_addr; done: - if (!H5F_addr_defined(ret_value)) + if (!H5_addr_defined(ret_value)) if (iblock) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(iblock) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF, - "unable to remove extensible array index block from cache") + "unable to remove extensible array index block from cache"); /* Release index block's disk space */ - if (H5F_addr_defined(iblock->addr) && + if (H5_addr_defined(iblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_IBLOCK, iblock->addr, (hsize_t)iblock->size) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, - "unable to release file space for extensible array index block") + "unable to release file space for extensible array index block"); /* Destroy index block */ if (H5EA__iblock_dest(iblock) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, - "unable to destroy extensible array index block") + "unable to destroy extensible array index block"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -274,9 +265,6 @@ H5EA__iblock_create(H5EA_hdr_t *hdr, hbool_t *stats_changed) * * Return: Non-NULL pointer to index block on success/NULL on failure * - * Programmer: Quincey Koziol - * Sep 9 2008 - * *------------------------------------------------------------------------- */ H5EA_iblock_t * @@ -288,24 +276,24 @@ H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* only the H5AC__READ_ONLY_FLAG may be set */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Protect the index block */ if (NULL == (iblock = (H5EA_iblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_IBLOCK, hdr->idx_blk_addr, hdr, flags))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) + (unsigned long long)hdr->idx_blk_addr); /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == iblock->top_proxy) { /* Add index block as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, iblock) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL, - "unable to add extensible array entry as child of array proxy") + "unable to add extensible array entry as child of array proxy"); iblock->top_proxy = hdr->top_proxy; } /* end if */ @@ -320,7 +308,7 @@ H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags) H5AC_unprotect(hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, "unable to unprotect extensible array index block, address = %llu", - (unsigned long long)iblock->addr) + (unsigned long long)iblock->addr); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -333,9 +321,6 @@ H5EA__iblock_protect(H5EA_hdr_t *hdr, unsigned flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 9 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -346,13 +331,13 @@ H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(iblock); + assert(iblock); /* Unprotect the index block */ if (H5AC_unprotect(iblock->hdr->f, H5AC_EARRAY_IBLOCK, iblock->addr, iblock, cache_flags) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to unprotect extensible array index block, address = %llu", - (unsigned long long)iblock->addr) + (unsigned long long)iblock->addr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -365,9 +350,6 @@ H5EA__iblock_unprotect(H5EA_iblock_t *iblock, unsigned cache_flags) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 9 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -379,14 +361,14 @@ H5EA__iblock_delete(H5EA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(H5F_addr_defined(hdr->idx_blk_addr)); + assert(hdr); + assert(H5_addr_defined(hdr->idx_blk_addr)); /* Protect index block */ if (NULL == (iblock = H5EA__iblock_protect(hdr, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect extensible array index block, address = %llu", - (unsigned long long)hdr->idx_blk_addr) + (unsigned long long)hdr->idx_blk_addr); /* Check for index block having data block pointers */ if (iblock->ndblk_addrs > 0) { @@ -398,12 +380,12 @@ H5EA__iblock_delete(H5EA_hdr_t *hdr) sblk_idx = dblk_idx = 0; for (u = 0; u < iblock->ndblk_addrs; u++) { /* Check for data block existing */ - if (H5F_addr_defined(iblock->dblk_addrs[u])) { + if (H5_addr_defined(iblock->dblk_addrs[u])) { /* Delete data block */ if (H5EA__dblock_delete(hdr, iblock, iblock->dblk_addrs[u], hdr->sblk_info[sblk_idx].dblk_nelmts) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, - "unable to delete extensible array data block") + "unable to delete extensible array data block"); iblock->dblk_addrs[u] = HADDR_UNDEF; } /* end if */ @@ -425,12 +407,12 @@ H5EA__iblock_delete(H5EA_hdr_t *hdr) /* Iterate over super blocks */ for (u = 0; u < iblock->nsblk_addrs; u++) { /* Check for data block existing */ - if (H5F_addr_defined(iblock->sblk_addrs[u])) { + if (H5_addr_defined(iblock->sblk_addrs[u])) { /* Delete super block */ if (H5EA__sblock_delete(hdr, iblock, iblock->sblk_addrs[u], (unsigned)(u + iblock->nsblks)) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, - "unable to delete extensible array super block") + "unable to delete extensible array super block"); iblock->sblk_addrs[u] = HADDR_UNDEF; } } @@ -440,7 +422,7 @@ H5EA__iblock_delete(H5EA_hdr_t *hdr) /* Finished deleting index block in metadata cache */ if (iblock && H5EA__iblock_unprotect(iblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array index block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__iblock_delete() */ @@ -452,9 +434,6 @@ H5EA__iblock_delete(H5EA_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 11 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -465,21 +444,21 @@ H5EA__iblock_dest(H5EA_iblock_t *iblock) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(iblock); + assert(iblock); /* Check if shared header field has been initialized */ if (iblock->hdr) { /* Check if we've got elements in the index block */ if (iblock->elmts) { /* Free buffer for index block elements */ - HDassert(iblock->hdr->cparam.idx_blk_elmts > 0); + assert(iblock->hdr->cparam.idx_blk_elmts > 0); iblock->elmts = H5FL_BLK_FREE(idx_blk_elmt_buf, iblock->elmts); } /* end if */ /* Check if we've got data block addresses in the index block */ if (iblock->dblk_addrs) { /* Free buffer for index block data block addresses */ - HDassert(iblock->ndblk_addrs > 0); + assert(iblock->ndblk_addrs > 0); iblock->dblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->dblk_addrs); iblock->ndblk_addrs = 0; } /* end if */ @@ -487,7 +466,7 @@ H5EA__iblock_dest(H5EA_iblock_t *iblock) /* Check if we've got super block addresses in the index block */ if (iblock->sblk_addrs) { /* Free buffer for index block super block addresses */ - HDassert(iblock->nsblk_addrs > 0); + assert(iblock->nsblk_addrs > 0); iblock->sblk_addrs = H5FL_SEQ_FREE(haddr_t, iblock->sblk_addrs); iblock->nsblk_addrs = 0; } /* end if */ @@ -495,12 +474,12 @@ H5EA__iblock_dest(H5EA_iblock_t *iblock) /* Decrement reference count on shared info */ if (H5EA__hdr_decr(iblock->hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared array header") + "can't decrement reference count on shared array header"); iblock->hdr = NULL; } /* end if */ /* Sanity check */ - HDassert(NULL == iblock->top_proxy); + assert(NULL == iblock->top_proxy); /* Free the index block itself */ iblock = H5FL_FREE(H5EA_iblock_t, iblock); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EAint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EAint.c index af7ff4c8fe..8ca3bc7515 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EAint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EAint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EAint.c - * Jun 17 2008 - * Quincey Koziol * * Purpose: Internal routines for extnsible arrays. * @@ -74,9 +71,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 26 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -87,12 +81,12 @@ H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(parent_entry); - HDassert(child_entry); + assert(parent_entry); + assert(child_entry); /* Create a flush dependency between parent and child entry */ if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -105,9 +99,6 @@ H5EA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 26 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -118,12 +109,12 @@ H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(parent_entry); - HDassert(child_entry); + assert(parent_entry); + assert(child_entry); /* Destroy a flush dependency between parent and child entry */ if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EAsblock.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EAsblock.c index 152e32a17a..aeab902e8e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EAsblock.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EAsblock.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EAsblock.c - * Sep 30 2008 - * Quincey Koziol * * Purpose: Super block routines for extensible arrays. * @@ -86,9 +83,6 @@ H5FL_BLK_DEFINE(page_init); * * Return: Non-NULL pointer to super block on success/NULL on failure * - * Programmer: Quincey Koziol - * Sep 30 2008 - * *------------------------------------------------------------------------- */ H5EA_sblock_t * @@ -100,16 +94,16 @@ H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(hdr); + assert(hdr); /* Allocate memory for the index block */ if (NULL == (sblock = H5FL_CALLOC(H5EA_sblock_t))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for extensible array super block") + "memory allocation failed for extensible array super block"); /* Share common array information */ if (H5EA__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header"); sblock->hdr = hdr; /* Set non-zero internal fields */ @@ -119,13 +113,13 @@ H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx) /* Compute/cache information */ sblock->idx = sblk_idx; sblock->ndblks = hdr->sblk_info[sblk_idx].ndblks; - HDassert(sblock->ndblks); + assert(sblock->ndblks); sblock->dblk_nelmts = hdr->sblk_info[sblk_idx].dblk_nelmts; /* Allocate buffer for data block addresses in super block */ if (NULL == (sblock->dblk_addrs = H5FL_SEQ_MALLOC(haddr_t, sblock->ndblks))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for super block data block addresses") + "memory allocation failed for super block data block addresses"); /* Check if # of elements in data blocks requires paging */ if (sblock->dblk_nelmts > hdr->dblk_page_nelmts) { @@ -133,20 +127,20 @@ H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx) sblock->dblk_npages = sblock->dblk_nelmts / hdr->dblk_page_nelmts; /* Sanity check that we have at least 2 pages in data block */ - HDassert(sblock->dblk_npages > 1); + assert(sblock->dblk_npages > 1); /* Sanity check for integer truncation */ - HDassert((sblock->dblk_npages * hdr->dblk_page_nelmts) == sblock->dblk_nelmts); + assert((sblock->dblk_npages * hdr->dblk_page_nelmts) == sblock->dblk_nelmts); /* Compute size of buffer for each data block's 'page init' bitmask */ sblock->dblk_page_init_size = ((sblock->dblk_npages) + 7) / 8; - HDassert(sblock->dblk_page_init_size > 0); + assert(sblock->dblk_page_init_size > 0); /* Allocate buffer for all 'page init' bitmasks in super block */ if (NULL == (sblock->page_init = H5FL_BLK_CALLOC(page_init, sblock->ndblks * sblock->dblk_page_init_size))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for super block page init bitmask") + "memory allocation failed for super block page init bitmask"); /* Compute data block page size */ sblock->dblk_page_size = (hdr->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5EA_SIZEOF_CHKSUM; @@ -158,7 +152,7 @@ H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx) done: if (!ret_value) if (sblock && H5EA__sblock_dest(sblock) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, NULL, "unable to destroy extensible array super block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__sblock_alloc() */ @@ -170,9 +164,6 @@ H5EA__sblock_alloc(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, unsigned sblk_idx) * * Return: Valid file address on success/HADDR_UNDEF on failure * - * Programmer: Quincey Koziol - * Sep 30 2008 - * *------------------------------------------------------------------------- */ haddr_t @@ -187,13 +178,13 @@ H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_chang FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(stats_changed); + assert(hdr); + assert(stats_changed); /* Allocate the super block */ if (NULL == (sblock = H5EA__sblock_alloc(hdr, parent, sblk_idx))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "memory allocation failed for extensible array super block") + "memory allocation failed for extensible array super block"); /* Set size of super block on disk */ sblock->size = H5EA_SBLOCK_SIZE(sblock); @@ -204,7 +195,7 @@ H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_chang /* Allocate space for the super block on disk */ if (HADDR_UNDEF == (sblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_EARRAY_SBLOCK, (hsize_t)sblock->size))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "file allocation failed for extensible array super block") + "file allocation failed for extensible array super block"); sblock->addr = sblock_addr; /* Reset data block addresses to "undefined" address value */ @@ -213,14 +204,14 @@ H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_chang /* Cache the new extensible array super block */ if (H5AC_insert_entry(hdr->f, H5AC_EARRAY_SBLOCK, sblock_addr, sblock, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTINSERT, HADDR_UNDEF, - "can't add extensible array super block to cache") + "can't add extensible array super block to cache"); inserted = TRUE; /* Add super block as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, HADDR_UNDEF, - "unable to add extensible array entry as child of array proxy") + "unable to add extensible array entry as child of array proxy"); sblock->top_proxy = hdr->top_proxy; } /* end if */ @@ -235,24 +226,24 @@ H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_chang ret_value = sblock_addr; done: - if (!H5F_addr_defined(ret_value)) + if (!H5_addr_defined(ret_value)) if (sblock) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(sblock) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTREMOVE, HADDR_UNDEF, - "unable to remove extensible array super block from cache") + "unable to remove extensible array super block from cache"); /* Release super block's disk space */ - if (H5F_addr_defined(sblock->addr) && + if (H5_addr_defined(sblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_EARRAY_SBLOCK, sblock->addr, (hsize_t)sblock->size) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, - "unable to release extensible array super block") + "unable to release extensible array super block"); /* Destroy super block */ if (H5EA__sblock_dest(sblock) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTFREE, HADDR_UNDEF, - "unable to destroy extensible array super block") + "unable to destroy extensible array super block"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -265,9 +256,6 @@ H5EA__sblock_create(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, hbool_t *stats_chang * * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Quincey Koziol - * Sep 30 2008 - * *------------------------------------------------------------------------- */ H5EA_sblock_t * @@ -281,11 +269,11 @@ H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(H5F_addr_defined(sblk_addr)); + assert(hdr); + assert(H5_addr_defined(sblk_addr)); /* only the H5AC__READ_ONLY_FLAG may be set */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up user data */ udata.hdr = hdr; @@ -298,14 +286,14 @@ H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, (sblock = (H5EA_sblock_t *)H5AC_protect(hdr->f, H5AC_EARRAY_SBLOCK, sblk_addr, &udata, flags))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, NULL, "unable to protect extensible array super block, address = %llu", - (unsigned long long)sblk_addr) + (unsigned long long)sblk_addr); /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == sblock->top_proxy) { /* Add super block as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, sblock) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTSET, NULL, - "unable to add extensible array entry as child of array proxy") + "unable to add extensible array entry as child of array proxy"); sblock->top_proxy = hdr->top_proxy; } @@ -320,7 +308,7 @@ H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, H5AC_unprotect(hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, NULL, "unable to unprotect extensible array super block, address = %llu", - (unsigned long long)sblock->addr) + (unsigned long long)sblock->addr); } FUNC_LEAVE_NOAPI(ret_value) @@ -333,9 +321,6 @@ H5EA__sblock_protect(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 30 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -346,13 +331,13 @@ H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(sblock); + assert(sblock); /* Unprotect the super block */ if (H5AC_unprotect(sblock->hdr->f, H5AC_EARRAY_SBLOCK, sblock->addr, sblock, cache_flags) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to unprotect extensible array super block, address = %llu", - (unsigned long long)sblock->addr) + (unsigned long long)sblock->addr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -365,9 +350,6 @@ H5EA__sblock_unprotect(H5EA_sblock_t *sblock, unsigned cache_flags) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 30 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -380,22 +362,22 @@ H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, u FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(H5F_addr_defined(sblk_addr)); + assert(hdr); + assert(H5_addr_defined(sblk_addr)); /* Protect super block */ if (NULL == (sblock = H5EA__sblock_protect(hdr, parent, sblk_addr, sblk_idx, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTPROTECT, FAIL, "unable to protect extensible array super block, address = %llu", - (unsigned long long)sblk_addr) + (unsigned long long)sblk_addr); /* Iterate over data blocks */ for (u = 0; u < sblock->ndblks; u++) { /* Check for data block existing */ - if (H5F_addr_defined(sblock->dblk_addrs[u])) { + if (H5_addr_defined(sblock->dblk_addrs[u])) { /* Delete data block */ if (H5EA__dblock_delete(hdr, sblock, sblock->dblk_addrs[u], sblock->dblk_nelmts) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array data block") + HGOTO_ERROR(H5E_EARRAY, H5E_CANTDELETE, FAIL, "unable to delete extensible array data block"); sblock->dblk_addrs[u] = HADDR_UNDEF; } /* end if */ } /* end for */ @@ -404,7 +386,7 @@ H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, u /* Finished deleting super block in metadata cache */ if (sblock && H5EA__sblock_unprotect(sblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block") + HDONE_ERROR(H5E_EARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release extensible array super block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5EA__sblock_delete() */ @@ -416,9 +398,6 @@ H5EA__sblock_delete(H5EA_hdr_t *hdr, H5EA_iblock_t *parent, haddr_t sblk_addr, u * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 30 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -429,8 +408,8 @@ H5EA__sblock_dest(H5EA_sblock_t *sblock) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(sblock); - HDassert(!sblock->has_hdr_depend); + assert(sblock); + assert(!sblock->has_hdr_depend); /* Check if shared header field has been initialized */ if (sblock->hdr) { @@ -440,19 +419,19 @@ H5EA__sblock_dest(H5EA_sblock_t *sblock) /* Free buffer for super block 'page init' bitmask, if there is one */ if (sblock->page_init) { - HDassert(sblock->dblk_npages > 0); + assert(sblock->dblk_npages > 0); sblock->page_init = H5FL_BLK_FREE(page_init, sblock->page_init); } /* end if */ /* Decrement reference count on shared info */ if (H5EA__hdr_decr(sblock->hdr) < 0) HGOTO_ERROR(H5E_EARRAY, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared array header") + "can't decrement reference count on shared array header"); sblock->hdr = NULL; } /* end if */ /* Sanity check */ - HDassert(NULL == sblock->top_proxy); + assert(NULL == sblock->top_proxy); /* Free the super block itself */ sblock = H5FL_FREE(H5EA_sblock_t, sblock); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EAstat.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EAstat.c index 5705cb8d92..a564455c0e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EAstat.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EAstat.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5EAstat.c - * Sep 11 2008 - * Quincey Koziol * * Purpose: Extensible array metadata statistics functions. * @@ -75,9 +72,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 21 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -86,8 +80,8 @@ H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats) FUNC_ENTER_NOAPI_NOERR /* Check arguments */ - HDassert(ea); - HDassert(stats); + assert(ea); + assert(stats); /* Copy extensible array statistics */ H5MM_memcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats)); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EAtest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5EAtest.c index f3bfa05744..3f44e71ad6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EAtest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5EAtest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Thursday, August 28, 2008 - * +/* * Purpose: Extensible array testing functions. * */ @@ -114,9 +111,6 @@ H5FL_DEFINE_STATIC(H5EA__ctx_cb_t); * Return: Success: non-NULL * Failure: NULL * - * Programmer: Quincey Koziol - * Tuesday, January 27, 2009 - * *------------------------------------------------------------------------- */ static void * @@ -131,7 +125,7 @@ H5EA__test_crt_context(void *_udata) /* Allocate new context structure */ if (NULL == (ctx = H5FL_MALLOC(H5EA__test_ctx_t))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "can't allocate extensible array client callback context") + "can't allocate extensible array client callback context"); /* Initialize the context */ ctx->bogus = H5EA__TEST_BOGUS_VAL; @@ -152,9 +146,6 @@ H5EA__test_crt_context(void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, January 27, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -165,7 +156,7 @@ H5EA__test_dst_context(void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); + assert(H5EA__TEST_BOGUS_VAL == ctx->bogus); /* Release context structure */ ctx = H5FL_FREE(H5EA__test_ctx_t, ctx); @@ -181,9 +172,6 @@ H5EA__test_dst_context(void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, August 28, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -194,8 +182,8 @@ H5EA__test_fill(void *nat_blk, size_t nelmts) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(nat_blk); - HDassert(nelmts); + assert(nat_blk); + assert(nelmts); H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); @@ -210,9 +198,6 @@ H5EA__test_fill(void *nat_blk, size_t nelmts) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, August 28, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -225,15 +210,15 @@ H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); - HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); + assert(raw); + assert(elmt); + assert(nelmts); + assert(H5EA__TEST_BOGUS_VAL == ctx->bogus); /* Check for callback action */ if (ctx->cb) { if ((*ctx->cb->encode)(elmt, nelmts, ctx->cb->udata) < 0) - HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "extensible array testing callback action failed") + HGOTO_ERROR(H5E_EARRAY, H5E_BADVALUE, FAIL, "extensible array testing callback action failed"); } /* Encode native elements into raw elements */ @@ -260,9 +245,6 @@ H5EA__test_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, August 28, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -277,10 +259,10 @@ H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDE FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); - HDassert(H5EA__TEST_BOGUS_VAL == ctx->bogus); + assert(raw); + assert(elmt); + assert(nelmts); + assert(H5EA__TEST_BOGUS_VAL == ctx->bogus); /* Decode raw elements into native elements */ while (nelmts) { @@ -305,9 +287,6 @@ H5EA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_NDE * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, August 28, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -318,13 +297,13 @@ H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void * FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(stream); - HDassert(elmt); + assert(stream); + assert(elmt); /* Print element */ HDsnprintf(temp_str, sizeof(temp_str), "Element #%llu:", (unsigned long long)idx); - HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, - (unsigned long long)*(const uint64_t *)elmt); + fprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, + (unsigned long long)*(const uint64_t *)elmt); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5EA__test_debug() */ @@ -337,8 +316,6 @@ H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void * * Return: Success: non-NULL * Failure: NULL * - * Programmer: Vailin Choi; August 2010 - * *------------------------------------------------------------------------- */ static void * @@ -352,7 +329,7 @@ H5EA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_a /* Allocate new context structure */ if (NULL == (ctx = H5FL_MALLOC(H5EA__ctx_cb_t))) HGOTO_ERROR(H5E_EARRAY, H5E_CANTALLOC, NULL, - "can't allocate extensible array client callback context") + "can't allocate extensible array client callback context"); /* Set return value */ ret_value = ctx; @@ -369,8 +346,6 @@ H5EA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_a * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; August 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -380,7 +355,7 @@ H5EA__test_dst_dbg_context(void *_ctx) FUNC_ENTER_PACKAGE_NOERR - HDassert(_ctx); + assert(_ctx); /* Release context structure */ ctx = H5FL_FREE(H5EA__ctx_cb_t, ctx); @@ -396,9 +371,6 @@ H5EA__test_dst_dbg_context(void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, August 28, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -407,8 +379,8 @@ H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam) FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(ea); - HDassert(cparam); + assert(ea); + assert(cparam); /* Get extensible array creation parameters */ cparam->raw_elmt_size = ea->hdr->cparam.raw_elmt_size; @@ -429,9 +401,6 @@ H5EA__get_cparam_test(const H5EA_t *ea, H5EA_create_t *cparam) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, August 28, 2008 - * *------------------------------------------------------------------------- */ int @@ -442,39 +411,39 @@ H5EA__cmp_cparam_test(const H5EA_create_t *cparam1, const H5EA_create_t *cparam2 FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(cparam1); - HDassert(cparam2); + assert(cparam1); + assert(cparam2); /* Compare creation parameters for array */ if (cparam1->raw_elmt_size < cparam2->raw_elmt_size) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->raw_elmt_size > cparam2->raw_elmt_size) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->max_nelmts_bits < cparam2->max_nelmts_bits) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->max_nelmts_bits > cparam2->max_nelmts_bits) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->idx_blk_elmts < cparam2->idx_blk_elmts) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->idx_blk_elmts > cparam2->idx_blk_elmts) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->sup_blk_min_data_ptrs < cparam2->sup_blk_min_data_ptrs) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->sup_blk_min_data_ptrs > cparam2->sup_blk_min_data_ptrs) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->data_blk_min_elmts < cparam2->data_blk_min_elmts) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->data_blk_min_elmts > cparam2->data_blk_min_elmts) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->max_dblk_page_nelmts_bits < cparam2->max_dblk_page_nelmts_bits) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->max_dblk_page_nelmts_bits > cparam2->max_dblk_page_nelmts_bits) - HGOTO_DONE(1) + HGOTO_DONE(1); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5ES.c b/externals/coda-oss/modules/drivers/hdf5/source/H5ES.c index ad42000de0..0faedf2b05 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5ES.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5ES.c @@ -13,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5ES.c - * Apr 6 2020 - * Quincey Koziol * * Purpose: Implements an "event set" for managing asynchronous * operations. @@ -77,9 +75,6 @@ * Return: Success: An ID for the event set * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol - * Wednesday, April 8, 2020 - * *------------------------------------------------------------------------- */ hid_t @@ -93,11 +88,11 @@ H5EScreate(void) /* Create the new event set object */ if (NULL == (es = H5ES__create())) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, H5I_INVALID_HID, "can't create event set") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, H5I_INVALID_HID, "can't create event set"); /* Register the new event set to get an ID for it */ if ((ret_value = H5I_register(H5I_EVENTSET, es, TRUE)) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register event set") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register event set"); done: FUNC_LEAVE_API(ret_value) @@ -113,9 +108,6 @@ H5EScreate(void) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, December 11, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -130,24 +122,24 @@ H5ESinsert_request(hid_t es_id, hid_t connector_id, void *request) /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); if (NULL == request) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL request pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL request pointer"); /* Create new VOL connector object, using the connector ID */ if (NULL == (connector = H5VL_new_connector(connector_id))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, FAIL, "can't create VOL connector object") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, FAIL, "can't create VOL connector object"); /* Insert request into event set */ if (H5ES__insert_request(es, connector, request) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "can't insert request into event set") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "can't insert request into event set"); done: /* Clean up on error */ if (ret_value < 0) /* Release newly created connector */ if (connector && H5VL_conn_dec_rc(connector) < 0) - HDONE_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector") + HDONE_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector"); FUNC_LEAVE_API(ret_value) } /* end H5ESinsert_request() */ @@ -161,9 +153,6 @@ H5ESinsert_request(hid_t es_id, hid_t connector_id, void *request) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Wednesday, April 8, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -180,7 +169,7 @@ H5ESget_count(hid_t es_id, size_t *count /*out*/) /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); /* Retrieve the count, if non-NULL */ if (count) @@ -205,9 +194,6 @@ H5ESget_count(hid_t es_id, size_t *count /*out*/) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Fiiday, November 6, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -224,7 +210,7 @@ H5ESget_op_counter(hid_t es_id, uint64_t *op_counter /*out*/) /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); /* Retrieve the operation counter, if non-NULL */ if (op_counter) @@ -256,9 +242,6 @@ H5ESget_op_counter(hid_t es_id, uint64_t *op_counter /*out*/) * * Return: SUCCEED / FAIL * - * Programmer: Neil Fortner - * Tuesday, November 23, 2021 - * *------------------------------------------------------------------------- */ herr_t @@ -273,14 +256,14 @@ H5ESget_requests(hid_t es_id, H5_iter_order_t order, hid_t *connector_ids, void /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); /* Call internal routine */ if (array_len > 0 && (requests || connector_ids)) if (H5ES__get_requests(es, order, connector_ids, requests, array_len) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't get requests") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't get requests"); /* Retrieve the count, if non-NULL */ if (count) @@ -313,9 +296,6 @@ H5ESget_requests(hid_t es_id, H5_iter_order_t order, hid_t *connector_ids, void * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Monday, July 13, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -332,15 +312,15 @@ H5ESwait(hid_t es_id, uint64_t timeout, size_t *num_in_progress /*out*/, hbool_t /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); if (NULL == num_in_progress) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL num_in_progress pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL num_in_progress pointer"); if (NULL == op_failed) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL op_failed pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL op_failed pointer"); /* Wait for operations */ if (H5ES__wait(es, timeout, num_in_progress, op_failed) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTWAIT, FAIL, "can't wait on operations") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTWAIT, FAIL, "can't wait on operations"); } /* end if */ done: @@ -356,9 +336,6 @@ H5ESwait(hid_t es_id, uint64_t timeout, size_t *num_in_progress /*out*/, hbool_t * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Thursday, December 10, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -375,15 +352,15 @@ H5EScancel(hid_t es_id, size_t *num_not_canceled /*out*/, hbool_t *op_failed /*o /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); if (NULL == num_not_canceled) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL num_not_canceled pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL num_not_canceled pointer"); if (NULL == op_failed) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL op_failed pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL op_failed pointer"); /* Cancel operations */ if (H5ES__cancel(es, num_not_canceled, op_failed) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCANCEL, FAIL, "can't cancel operations") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCANCEL, FAIL, "can't cancel operations"); } /* end if */ done: @@ -399,9 +376,6 @@ H5EScancel(hid_t es_id, size_t *num_not_canceled /*out*/, hbool_t *op_failed /*o * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Thursday, October 15, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -418,7 +392,7 @@ H5ESget_err_status(hid_t es_id, hbool_t *err_status /*out*/) /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); /* Retrieve the error flag, if non-NULL */ if (err_status) @@ -441,9 +415,6 @@ H5ESget_err_status(hid_t es_id, hbool_t *err_status /*out*/) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Thursday, October 15, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -460,7 +431,7 @@ H5ESget_err_count(hid_t es_id, size_t *num_errs /*out*/) /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); /* Retrieve the error flag, if non-NULL */ if (num_errs) { @@ -487,9 +458,6 @@ H5ESget_err_count(hid_t es_id, size_t *num_errs /*out*/) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, November 6, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -507,17 +475,17 @@ H5ESget_err_info(hid_t es_id, size_t num_err_info, H5ES_err_info_t err_info[] /* /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); if (0 == num_err_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "err_info array size is 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "err_info array size is 0"); if (NULL == err_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL err_info array pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL err_info array pointer"); if (NULL == num_cleared) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL errors cleared pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL errors cleared pointer"); /* Retrieve the error information */ if (H5ES__get_err_info(es, num_err_info, err_info, num_cleared) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't retrieve error info for failed operation(s)") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't retrieve error info for failed operation(s)"); } /* end if */ done: @@ -531,9 +499,6 @@ H5ESget_err_info(hid_t es_id, size_t num_err_info, H5ES_err_info_t err_info[] /* * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, March 5, 2021 - * *------------------------------------------------------------------------- */ herr_t @@ -547,9 +512,9 @@ H5ESfree_err_info(size_t num_err_info, H5ES_err_info_t err_info[]) /* Check arguments */ if (0 == num_err_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "err_info array size is 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "err_info array size is 0"); if (NULL == err_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL err_info array pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL err_info array pointer"); /* Iterate over array, releasing error information */ for (u = 0; u < num_err_info; u++) { @@ -558,7 +523,7 @@ H5ESfree_err_info(size_t num_err_info, H5ES_err_info_t err_info[]) H5MM_xfree(err_info[u].app_file_name); H5MM_xfree(err_info[u].app_func_name); if (H5I_dec_app_ref(err_info[u].err_stack_id) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "can't close error stack for err_info #%zu", u) + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "can't close error stack for err_info #%zu", u); } /* end for */ done: @@ -578,9 +543,6 @@ H5ESfree_err_info(size_t num_err_info, H5ES_err_info_t err_info[]) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, December 11, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -597,9 +559,9 @@ H5ESregister_insert_func(hid_t es_id, H5ES_event_insert_func_t func, void *ctx) /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); if (NULL == func) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL function callback pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL function callback pointer"); /* Set the event set's insert callback */ es->ins_func = func; @@ -623,9 +585,6 @@ H5ESregister_insert_func(hid_t es_id, H5ES_event_insert_func_t func, void *ctx) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, December 11, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -642,9 +601,9 @@ H5ESregister_complete_func(hid_t es_id, H5ES_event_complete_func_t func, void *c /* Check arguments */ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier"); if (NULL == func) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL function callback pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL function callback pointer"); /* Set the event set's completion callback */ es->comp_func = func; @@ -666,9 +625,6 @@ H5ESregister_complete_func(hid_t es_id, H5ES_event_complete_func_t func, void *c * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Wednesday, April 8, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -683,14 +639,14 @@ H5ESclose(hid_t es_id) if (H5ES_NONE != es_id) { /* Check arguments */ if (H5I_EVENTSET != H5I_get_type(es_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an event set") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an event set"); /* * Decrement the counter on the object. It will be freed if the count * reaches zero. */ if (H5I_dec_app_ref(es_id) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "unable to decrement ref count on event set") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "unable to decrement ref count on event set"); } /* end if */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5ESevent.c b/externals/coda-oss/modules/drivers/hdf5/source/H5ESevent.c index abd7fbf80a..3286424ff1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5ESevent.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5ESevent.c @@ -13,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5ESevent.c - * Nov 7 2020 - * Quincey Koziol * * Purpose: Operations on "events" for managing asynchronous * operations. @@ -78,9 +76,6 @@ H5FL_DEFINE_STATIC(H5ES_event_t); * * Return: Non-NULL pointer to new event on success, NULL on failure * - * Programmer: Quincey Koziol - * Saturday, November 7, 2020 - * *------------------------------------------------------------------------- */ H5ES_event_t * @@ -93,19 +88,19 @@ H5ES__event_new(H5VL_t *connector, void *token) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(connector); - HDassert(token); + assert(connector); + assert(token); /* Create vol object for token */ if (NULL == (request = H5VL_create_object(token, connector))) { if (H5VL_request_free(token) < 0) - HDONE_ERROR(H5E_EVENTSET, H5E_CANTFREE, NULL, "can't free request") - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINIT, NULL, "can't create vol object for request token") + HDONE_ERROR(H5E_EVENTSET, H5E_CANTFREE, NULL, "can't free request"); + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINIT, NULL, "can't create vol object for request token"); } /* end if */ /* Allocate space for new event */ if (NULL == (ev = H5FL_CALLOC(H5ES_event_t))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, NULL, "can't allocate event object") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, NULL, "can't allocate event object"); /* Set request for event */ ev->request = request; @@ -114,7 +109,7 @@ H5ES__event_new(H5VL_t *connector, void *token) ret_value = ev; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5ES__event_new() */ /*------------------------------------------------------------------------- @@ -124,9 +119,6 @@ H5ES__event_new(H5VL_t *connector, void *token) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Saturday, November 7, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -137,7 +129,7 @@ H5ES__event_free(H5ES_event_t *ev) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(ev); + assert(ev); /* The 'app_func_name', 'app_file_name', and 'api_name' strings are statically allocated (by the compiler) * and are not allocated, so there's no need to free them. @@ -150,11 +142,11 @@ H5ES__event_free(H5ES_event_t *ev) if (ev->request) { /* Free the request */ if (H5VL_request_free(ev->request) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTFREE, FAIL, "unable to free request") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTFREE, FAIL, "unable to free request"); /* Free the VOL object for the request */ if (H5VL_free_object(ev->request) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "can't free VOL request object") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "can't free VOL request object"); } /* end if */ H5FL_FREE(H5ES_event_t, ev); @@ -170,9 +162,6 @@ H5ES__event_free(H5ES_event_t *ev) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Sunday, November 8, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -183,14 +172,14 @@ H5ES__event_completed(H5ES_event_t *ev, H5ES_event_list_t *el) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(ev); + assert(ev); /* Remove the event from the event list */ H5ES__list_remove(el, ev); /* Free the event */ if (H5ES__event_free(ev) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTFREE, FAIL, "unable to free event") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTFREE, FAIL, "unable to free event"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5ESint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5ESint.c index f82085022b..e1481329b8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5ESint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5ESint.c @@ -13,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5ESint.c - * Apr 8 2020 - * Quincey Koziol * * Purpose: Internal "event set" routines for managing asynchronous * operations. @@ -141,7 +139,7 @@ H5ES_init(void) /* Initialize the ID group for the event set IDs */ if (H5I_register_type(H5I_EVENTSET_CLS) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINIT, FAIL, "unable to initialize interface"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -156,9 +154,6 @@ H5ES_init(void) * affect other interfaces; zero otherwise. * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, April 6, 2020 - * *------------------------------------------------------------------------- */ int @@ -181,9 +176,6 @@ H5ES_term_package(void) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Monday, April 6, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -195,7 +187,7 @@ H5ES__close_cb(void *_es, void H5_ATTR_UNUSED **rt) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(es); + assert(es); /* Close the event set object */ if (H5ES__close(es) < 0) @@ -213,9 +205,6 @@ H5ES__close_cb(void *_es, void H5_ATTR_UNUSED **rt) * Return: Success: Pointer to an event set struct * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, April 8, 2020 - * *------------------------------------------------------------------------- */ H5ES_t * @@ -228,7 +217,7 @@ H5ES__create(void) /* Allocate space for new event set */ if (NULL == (es = H5FL_CALLOC(H5ES_t))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, NULL, "can't allocate event set object") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, NULL, "can't allocate event set object"); /* Set the return value */ ret_value = es; @@ -236,7 +225,7 @@ H5ES__create(void) done: if (!ret_value) if (es && H5ES__close(es) < 0) - HDONE_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, NULL, "unable to free event set") + HDONE_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, NULL, "unable to free event set"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5ES__create() */ @@ -248,9 +237,6 @@ H5ES__create(void) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, December 11, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -264,11 +250,11 @@ H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(es); + assert(es); /* Create new event */ if (NULL == (ev = H5ES__event_new(connector, request_token))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, FAIL, "can't create event object") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, FAIL, "can't create event object"); /* Copy the app source information */ /* The 'app_func' & 'app_file' strings are statically allocated (by the compiler) @@ -291,9 +277,9 @@ H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app * there's no need to duplicate it. */ ev->op_info.api_name = caller; - HDassert(ev->op_info.api_args == NULL); + assert(ev->op_info.api_args == NULL); if (api_args && NULL == (ev->op_info.api_args = H5MM_xstrdup(api_args))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy API routine arguments") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy API routine arguments"); /* Append fully initialized event onto the event set's 'active' list */ H5ES__list_append(&es->active, ev); @@ -302,7 +288,7 @@ H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app /* Invoke the event set's 'insert' callback, if present */ if (es->ins_func) if ((es->ins_func)(&ev->op_info, es->ins_ctx) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'insert' callback for event set failed") + HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'insert' callback for event set failed"); done: /* Release resources on error */ @@ -311,7 +297,7 @@ H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app if (ev_inserted) H5ES__list_remove(&es->active, ev); if (H5ES__event_free(ev) < 0) - HDONE_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "unable to release event") + HDONE_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "unable to release event"); } FUNC_LEAVE_NOAPI(ret_value) @@ -324,9 +310,6 @@ H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Wednesday, April 8, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -345,51 +328,51 @@ H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, con FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(connector); - HDassert(token); - HDassert(caller); - HDassert(caller_args); + assert(connector); + assert(token); + assert(caller); + assert(caller_args); /* Get event set */ if (NULL == (es = (H5ES_t *)H5I_object_verify(es_id, H5I_EVENTSET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an event set") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an event set"); /* Check for errors in event set */ if (es->err_occurred) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations"); /* Start working on the API routines arguments */ - HDva_start(ap, caller_args); + va_start(ap, caller_args); arg_started = TRUE; /* Copy the app source information */ - (void)HDva_arg(ap, char *); /* Toss the 'app_file' parameter name */ - app_file = HDva_arg(ap, char *); - (void)HDva_arg(ap, char *); /* Toss the 'app_func' parameter name */ - app_func = HDva_arg(ap, char *); - (void)HDva_arg(ap, char *); /* Toss the 'app_line' parameter name */ - app_line = HDva_arg(ap, unsigned); + (void)va_arg(ap, char *); /* Toss the 'app_file' parameter name */ + app_file = va_arg(ap, char *); + (void)va_arg(ap, char *); /* Toss the 'app_func' parameter name */ + app_func = va_arg(ap, char *); + (void)va_arg(ap, char *); /* Toss the 'app_line' parameter name */ + app_line = va_arg(ap, unsigned); /* Create the string for the API routine's arguments */ if (NULL == (rs = H5RS_create(NULL))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't allocate ref-counted string") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't allocate ref-counted string"); /* Copy the string for the API routine's arguments */ /* (skip the six characters from the app's file, function and line # arguments) */ - HDassert(0 == HDstrncmp(caller_args, "*s*sIu", 6)); + assert(0 == HDstrncmp(caller_args, "*s*sIu", 6)); if (H5_trace_args(rs, caller_args + 6, ap) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, FAIL, "can't create formatted API arguments") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, FAIL, "can't create formatted API arguments"); if (NULL == (api_args = H5RS_get_str(rs))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't get pointer to formatted API arguments") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't get pointer to formatted API arguments"); /* Insert the operation into the event set */ if (H5ES__insert(es, connector, token, app_file, app_func, app_line, caller, api_args) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations"); done: /* Clean up */ if (arg_started) - HDva_end(ap); + va_end(ap); if (rs) H5RS_decr(rs); @@ -403,9 +386,6 @@ H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, con * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, December 11, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -416,13 +396,13 @@ H5ES__insert_request(H5ES_t *es, H5VL_t *connector, void *token) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(es); - HDassert(connector); - HDassert(token); + assert(es); + assert(connector); + assert(token); /* Insert an 'anonymous' operation into the event set */ if (H5ES__insert(es, connector, token, NULL, NULL, 0, NULL, NULL) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -436,9 +416,6 @@ H5ES__insert_request(H5ES_t *es, H5VL_t *connector, void *token) * * Return: SUCCEED / FAIL * - * Programmer: Neil Fortner - * Tuesday, November 23, 2021 - * *------------------------------------------------------------------------- */ static int @@ -450,9 +427,9 @@ H5ES__get_requests_cb(H5ES_event_t *ev, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ev); - HDassert(ctx); - HDassert(ctx->i < ctx->array_len); + assert(ev); + assert(ctx); + assert(ctx->i < ctx->array_len); /* Get the connector ID for the event */ if (ctx->connector_ids) @@ -476,9 +453,6 @@ H5ES__get_requests_cb(H5ES_event_t *ev, void *_ctx) * * Return: SUCCEED / FAIL * - * Programmer: Neil Fortner - * Tuesday, November 23, 2021 - * *------------------------------------------------------------------------- */ herr_t @@ -490,9 +464,9 @@ H5ES__get_requests(H5ES_t *es, H5_iter_order_t order, hid_t *connector_ids, void FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(es); - HDassert(array_len > 0); - HDassert(requests || connector_ids); + assert(es); + assert(array_len > 0); + assert(requests || connector_ids); /* Set up context for iterator callbacks */ ctx.connector_ids = connector_ids; @@ -502,7 +476,7 @@ H5ES__get_requests(H5ES_t *es, H5_iter_order_t order, hid_t *connector_ids, void /* Iterate over the events in the set */ if (H5ES__list_iterate(&es->active, order, H5ES__get_requests_cb, &ctx) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed") + HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -515,9 +489,6 @@ H5ES__get_requests(H5ES_t *es, H5_iter_order_t order, hid_t *connector_ids, void * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Thursday, October 15, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -526,9 +497,9 @@ H5ES__handle_fail(H5ES_t *es, H5ES_event_t *ev) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(es); - HDassert(es->active.head); - HDassert(ev); + assert(es); + assert(es->active.head); + assert(ev); /* Set error flag for event set */ es->err_occurred = TRUE; @@ -549,9 +520,6 @@ H5ES__handle_fail(H5ES_t *es, H5ES_event_t *ev) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, December 11, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -564,10 +532,10 @@ H5ES__op_complete(H5ES_t *es, H5ES_event_t *ev, H5VL_request_status_t ev_status) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(es); - HDassert(ev); - HDassert(H5VL_REQUEST_STATUS_SUCCEED == ev_status || H5VL_REQUEST_STATUS_FAIL == ev_status || - H5VL_REQUEST_STATUS_CANCELED == ev_status); + assert(es); + assert(ev); + assert(H5VL_REQUEST_STATUS_SUCCEED == ev_status || H5VL_REQUEST_STATUS_FAIL == ev_status || + H5VL_REQUEST_STATUS_CANCELED == ev_status); /* Handle each form of event completion */ if (H5VL_REQUEST_STATUS_SUCCEED == ev_status || H5VL_REQUEST_STATUS_CANCELED == ev_status) { @@ -588,19 +556,19 @@ H5ES__op_complete(H5ES_t *es, H5ES_event_t *ev, H5VL_request_status_t ev_status) /* Retrieve the execution time info */ if (H5VL_request_specific(ev->request, &vol_cb_args) < 0) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, - "unable to retrieve execution time info for operation") + "unable to retrieve execution time info for operation"); } else /* Translate status */ op_status = H5ES_STATUS_CANCELED; if ((es->comp_func)(&ev->op_info, op_status, H5I_INVALID_HID, es->comp_ctx) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'complete' callback for event set failed") + HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'complete' callback for event set failed"); } /* end if */ /* Event success or cancellation */ if (H5ES__event_completed(ev, &es->active) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "unable to release completed event") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "unable to release completed event"); } /* end if */ else if (H5VL_REQUEST_STATUS_FAIL == ev_status) { /* Invoke the event set's 'complete' callback, if present */ @@ -611,21 +579,21 @@ H5ES__op_complete(H5ES_t *es, H5ES_event_t *ev, H5VL_request_status_t ev_status) /* Retrieve the error stack for the operation */ if (H5VL_request_specific(ev->request, &vol_cb_args) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "unable to retrieve error stack for operation") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "unable to retrieve error stack for operation"); /* Set values */ err_stack_id = vol_cb_args.args.get_err_stack.err_stack_id; if ((es->comp_func)(&ev->op_info, H5ES_STATUS_FAIL, err_stack_id, es->comp_ctx) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'complete' callback for event set failed") + HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'complete' callback for event set failed"); } /* end if */ /* Handle failure */ if (H5ES__handle_fail(es, ev) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, FAIL, "unable to handle failed event") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, FAIL, "unable to handle failed event"); } /* end else-if */ else - HGOTO_ERROR(H5E_EVENTSET, H5E_BADVALUE, FAIL, "unknown event status?!?") + HGOTO_ERROR(H5E_EVENTSET, H5E_BADVALUE, FAIL, "unknown event status?!?"); done: /* Clean up */ @@ -644,9 +612,6 @@ H5ES__op_complete(H5ES_t *es, H5ES_event_t *ev, H5VL_request_status_t ev_status) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Sunday, November 7, 2020 - * *------------------------------------------------------------------------- */ static int @@ -660,14 +625,14 @@ H5ES__wait_cb(H5ES_event_t *ev, void *_ctx) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(ev); - HDassert(ctx); + assert(ev); + assert(ctx); /* Wait on the request */ if (ctx->timeout != H5ES_WAIT_NONE && ctx->timeout != H5ES_WAIT_FOREVER) start_time = H5_now_usec(); if (H5VL_request_wait(ev->request, ctx->timeout, &ev_status) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTWAIT, H5_ITER_ERROR, "unable to test operation") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTWAIT, H5_ITER_ERROR, "unable to test operation"); if (ctx->timeout != H5ES_WAIT_NONE && ctx->timeout != H5ES_WAIT_FOREVER) elapsed_time = H5_now_usec() - start_time; @@ -675,7 +640,7 @@ H5ES__wait_cb(H5ES_event_t *ev, void *_ctx) if (ev_status == H5VL_REQUEST_STATUS_FAIL) { /* Handle event completion */ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event"); /* Record the error */ *ctx->op_failed = TRUE; @@ -686,15 +651,15 @@ H5ES__wait_cb(H5ES_event_t *ev, void *_ctx) else if (ev_status == H5VL_REQUEST_STATUS_SUCCEED || ev_status == H5VL_REQUEST_STATUS_CANCELED) { /* Handle event completion */ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event"); } /* end else-if */ else if (ev_status == H5VL_REQUEST_STATUS_CANT_CANCEL) /* Should never get a status of 'can't cancel' back from test / wait operation */ HGOTO_ERROR(H5E_EVENTSET, H5E_BADVALUE, H5_ITER_ERROR, - "received \"can't cancel\" status for operation") + "received \"can't cancel\" status for operation"); else { /* Sanity check */ - HDassert(ev_status == H5VL_REQUEST_STATUS_IN_PROGRESS); + assert(ev_status == H5VL_REQUEST_STATUS_IN_PROGRESS); /* Increment "in progress operation" counter */ (*ctx->num_in_progress)++; @@ -722,9 +687,6 @@ H5ES__wait_cb(H5ES_event_t *ev, void *_ctx) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Monday, July 13, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -736,9 +698,9 @@ H5ES__wait(H5ES_t *es, uint64_t timeout, size_t *num_in_progress, hbool_t *op_fa FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(es); - HDassert(num_in_progress); - HDassert(op_failed); + assert(es); + assert(num_in_progress); + assert(op_failed); /* Set user's parameters to known values */ *num_in_progress = 0; @@ -752,7 +714,7 @@ H5ES__wait(H5ES_t *es, uint64_t timeout, size_t *num_in_progress, hbool_t *op_fa /* Iterate over the events in the set, waiting for them to complete */ if (H5ES__list_iterate(&es->active, H5_ITER_NATIVE, H5ES__wait_cb, &ctx) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed") + HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -765,9 +727,6 @@ H5ES__wait(H5ES_t *es, uint64_t timeout, size_t *num_in_progress, hbool_t *op_fa * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Thursday, December 10, 2020 - * *------------------------------------------------------------------------- */ static int @@ -780,18 +739,18 @@ H5ES__cancel_cb(H5ES_event_t *ev, void *_ctx) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(ev); - HDassert(ctx); + assert(ev); + assert(ctx); /* Attempt to cancel the request */ if (H5VL_request_cancel(ev->request, &ev_status) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCANCEL, H5_ITER_ERROR, "unable to cancel operation") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCANCEL, H5_ITER_ERROR, "unable to cancel operation"); /* Check for status values that indicate we should break out of the loop */ if (ev_status == H5VL_REQUEST_STATUS_FAIL) { /* Handle event completion */ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, H5_ITER_ERROR, "unable to handle failed event") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, H5_ITER_ERROR, "unable to handle failed event"); /* Record the error */ *ctx->op_failed = TRUE; @@ -805,7 +764,7 @@ H5ES__cancel_cb(H5ES_event_t *ev, void *_ctx) /* Handle event completion */ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event"); } /* end else-if */ else if (ev_status == H5VL_REQUEST_STATUS_CANT_CANCEL || ev_status == H5VL_REQUEST_STATUS_IN_PROGRESS) { /* Increment "not canceled" counter */ @@ -813,11 +772,11 @@ H5ES__cancel_cb(H5ES_event_t *ev, void *_ctx) } /* end else-if */ else { /* Sanity check */ - HDassert(ev_status == H5VL_REQUEST_STATUS_CANCELED); + assert(ev_status == H5VL_REQUEST_STATUS_CANCELED); /* Handle event completion */ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event"); } /* end else */ done: @@ -831,9 +790,6 @@ H5ES__cancel_cb(H5ES_event_t *ev, void *_ctx) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Thursday, December 10, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -845,9 +801,9 @@ H5ES__cancel(H5ES_t *es, size_t *num_not_canceled, hbool_t *op_failed) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(es); - HDassert(num_not_canceled); - HDassert(op_failed); + assert(es); + assert(num_not_canceled); + assert(op_failed); /* Set user's parameters to known values */ *num_not_canceled = 0; @@ -860,7 +816,7 @@ H5ES__cancel(H5ES_t *es, size_t *num_not_canceled, hbool_t *op_failed) /* Iterate over the events in the set, attempting to cancel them */ if (H5ES__list_iterate(&es->active, H5_ITER_NATIVE, H5ES__cancel_cb, &ctx) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed") + HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -873,9 +829,6 @@ H5ES__cancel(H5ES_t *es, size_t *num_not_canceled, hbool_t *op_failed) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Monday, November 11, 2020 - * *------------------------------------------------------------------------- */ static int @@ -888,8 +841,8 @@ H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(ev); - HDassert(ctx); + assert(ev); + assert(ctx); /* Copy operation info for event */ /* The 'app_func_name', 'app_file_name', and 'api_name' strings are statically allocated (by the compiler) @@ -897,13 +850,13 @@ H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx) * here, when they are given back to the user. */ if (NULL == (ctx->curr_err_info->api_name = H5MM_xstrdup(ev->op_info.api_name))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine name") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine name"); if (NULL == (ctx->curr_err_info->api_args = H5MM_xstrdup(ev->op_info.api_args))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine arguments") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine arguments"); if (NULL == (ctx->curr_err_info->app_file_name = H5MM_xstrdup(ev->op_info.app_file_name))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application file name") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application file name"); if (NULL == (ctx->curr_err_info->app_func_name = H5MM_xstrdup(ev->op_info.app_func_name))) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application function name") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application function name"); ctx->curr_err_info->app_line_num = ev->op_info.app_line_num; ctx->curr_err_info->op_ins_count = ev->op_info.op_ins_count; ctx->curr_err_info->op_ins_ts = ev->op_info.op_ins_ts; @@ -916,7 +869,7 @@ H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx) /* Get error stack for event */ if (H5VL_request_specific(ev->request, &vol_cb_args) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, H5_ITER_ERROR, "unable to retrieve error stack for operation") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, H5_ITER_ERROR, "unable to retrieve error stack for operation"); /* Set value */ ctx->curr_err_info->err_stack_id = vol_cb_args.args.get_err_stack.err_stack_id; @@ -926,7 +879,7 @@ H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx) /* Free event node */ if (H5ES__event_free(ev) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release failed event") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release failed event"); /* Advance to next element of err_info[] array */ ctx->curr_err++; @@ -947,9 +900,6 @@ H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, November 6, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -961,10 +911,10 @@ H5ES__get_err_info(H5ES_t *es, size_t num_err_info, H5ES_err_info_t err_info[], FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(es); - HDassert(num_err_info); - HDassert(err_info); - HDassert(num_cleared); + assert(es); + assert(num_err_info); + assert(err_info); + assert(num_cleared); /* Set up context for iterator callbacks */ ctx.es = es; @@ -974,7 +924,7 @@ H5ES__get_err_info(H5ES_t *es, size_t num_err_info, H5ES_err_info_t err_info[], /* Iterate over the failed events in the set, copying their error info */ if (H5ES__list_iterate(&es->failed, H5_ITER_NATIVE, H5ES__get_err_info_cb, &ctx) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed") + HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed"); /* Set # of failed events cleared from event set's failed list */ *num_cleared = ctx.curr_err; @@ -990,9 +940,6 @@ H5ES__get_err_info(H5ES_t *es, size_t num_err_info, H5ES_err_info_t err_info[], * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Monday, November 11, 2020 - * *------------------------------------------------------------------------- */ static int @@ -1004,15 +951,15 @@ H5ES__close_failed_cb(H5ES_event_t *ev, void *_ctx) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(ev); - HDassert(es); + assert(ev); + assert(es); /* Remove event from event set's failed list */ H5ES__list_remove(&es->failed, ev); /* Free event node */ if (H5ES__event_free(ev) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release failed event") + HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release failed event"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1025,9 +972,6 @@ H5ES__close_failed_cb(H5ES_event_t *ev, void *_ctx) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Monday, April 6, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -1038,17 +982,17 @@ H5ES__close(H5ES_t *es) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(es); + assert(es); /* Fail if active operations still present */ if (H5ES__list_count(&es->active) > 0) HGOTO_ERROR( H5E_EVENTSET, H5E_CANTCLOSEOBJ, FAIL, - "can't close event set while unfinished operations are present (i.e. wait on event set first)") + "can't close event set while unfinished operations are present (i.e. wait on event set first)"); /* Iterate over the failed events in the set, releasing them */ if (H5ES__list_iterate(&es->failed, H5_ITER_NATIVE, H5ES__close_failed_cb, (void *)es) < 0) - HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed") + HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed"); /* Release the event set */ es = H5FL_FREE(H5ES_t, es); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5ESlist.c b/externals/coda-oss/modules/drivers/hdf5/source/H5ESlist.c index 61a9dd1beb..1022e639f1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5ESlist.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5ESlist.c @@ -13,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5ESlist.c - * Nov 7 2020 - * Quincey Koziol * * Purpose: Operations on "event lists" for managing asynchronous * operations. @@ -74,9 +72,6 @@ * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Saturday, November 7, 2020 - * *------------------------------------------------------------------------- */ void @@ -85,8 +80,8 @@ H5ES__list_append(H5ES_event_list_t *el, H5ES_event_t *ev) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(el); - HDassert(ev); + assert(el); + assert(ev); ev->next = NULL; @@ -112,9 +107,6 @@ H5ES__list_append(H5ES_event_list_t *el, H5ES_event_t *ev) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Saturday, November 7, 2020 - * *------------------------------------------------------------------------- */ H5_ATTR_PURE size_t @@ -123,7 +115,7 @@ H5ES__list_count(const H5ES_event_list_t *el) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(el); + assert(el); FUNC_LEAVE_NOAPI(el->count) } /* end H5ES__list_count() */ @@ -142,9 +134,6 @@ H5ES__list_count(const H5ES_event_list_t *el) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Saturday, November 7, 2020 - * *------------------------------------------------------------------------- */ int @@ -156,8 +145,8 @@ H5ES__list_iterate(H5ES_event_list_t *el, H5_iter_order_t order, H5ES_list_iter_ FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(el); - HDassert(cb); + assert(el); + assert(cb); /* Iterate over events in list */ ev = (order == H5_ITER_DEC) ? el->tail : el->head; @@ -188,9 +177,6 @@ H5ES__list_iterate(H5ES_event_list_t *el, H5_iter_order_t order, H5ES_list_iter_ * * Return: SUCCEED / FAIL * - * Programmer: Houjun Tang - * Thursday, July 30, 2020 - * *------------------------------------------------------------------------- */ void @@ -199,9 +185,9 @@ H5ES__list_remove(H5ES_event_list_t *el, const H5ES_event_t *ev) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(el); - HDassert(el->head); - HDassert(ev); + assert(el); + assert(el->head); + assert(ev); /* Stitch event out of list */ if (ev == el->head) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Edeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Edeprec.c index 860279af87..bb2954e394 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Edeprec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Edeprec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Edeprec.c - * April 11 2007 - * Quincey Koziol * * Purpose: Deprecated functions from the H5E interface. These * functions are here for compatibility purposes and may be @@ -77,9 +74,6 @@ * Return: Success: Pointer to the message * Failure: NULL * - * Programmer: Raymond Lu - * Friday, July 14, 2003 - * *------------------------------------------------------------------------- */ char * @@ -96,13 +90,13 @@ H5Eget_major(H5E_major_t maj) /* Get the message object */ if (NULL == (msg = (H5E_msg_t *)H5I_object_verify(maj, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID"); /* Get the size & type of the message's text */ if ((size = H5E__get_msg(msg, &type, NULL, (size_t)0)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text"); if (type != H5E_MAJOR) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a major one"); /* Application will free this */ size++; @@ -110,7 +104,7 @@ H5Eget_major(H5E_major_t maj) /* Get the text for the message */ if (H5E__get_msg(msg, NULL, msg_str, (size_t)size) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text"); ret_value = msg_str; @@ -129,9 +123,6 @@ H5Eget_major(H5E_major_t maj) * Return: Success: Pointer to the message * Failure: NULL * - * Programmer: Raymond Lu - * Friday, July 14, 2003 - * *------------------------------------------------------------------------- */ char * @@ -148,13 +139,13 @@ H5Eget_minor(H5E_minor_t min) /* Get the message object */ if (NULL == (msg = (H5E_msg_t *)H5I_object_verify(min, H5I_ERROR_MSG))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a error message ID"); /* Get the size & type of the message's text */ if ((size = H5E__get_msg(msg, &type, NULL, (size_t)0)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text"); if (type != H5E_MINOR) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "Error message isn't a minor one"); /* Application will free this */ size++; @@ -162,7 +153,7 @@ H5Eget_minor(H5E_minor_t min) /* Get the text for the message */ if (H5E__get_msg(msg, NULL, msg_str, (size_t)size) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get error message text"); ret_value = msg_str; @@ -188,9 +179,6 @@ H5Eget_minor(H5E_minor_t min) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, Sep 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -204,7 +192,7 @@ H5Epush1(const char *file, const char *func, unsigned line, H5E_major_t maj, H5E /* Push the error on the default error stack */ if (H5E__push_stack(NULL, file, func, line, H5E_ERR_CLS_g, maj, min, str) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't push error on stack"); done: FUNC_LEAVE_API(ret_value) @@ -218,9 +206,6 @@ H5Epush1(const char *file, const char *func, unsigned line, H5E_major_t maj, H5E * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, July 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -234,7 +219,7 @@ H5Eclear1(void) /* Clear the default error stack */ if (H5E_clear_stack(NULL) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack"); done: FUNC_LEAVE_API(ret_value) @@ -251,9 +236,6 @@ H5Eclear1(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Sep 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -268,11 +250,11 @@ H5Eprint1(FILE *stream) if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); /* Print error stack */ if (H5E__print(estack, stream, TRUE) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't display error stack"); done: FUNC_LEAVE_API(ret_value) @@ -287,9 +269,6 @@ H5Eprint1(FILE *stream) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Sep 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -305,13 +284,13 @@ H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data) if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); /* Walk the error stack */ walk_op.vers = 1; walk_op.u.func1 = func; if (H5E__walk(estack, direction, &walk_op, client_data) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack"); done: FUNC_LEAVE_API(ret_value) @@ -328,9 +307,6 @@ H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Sep 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -346,15 +322,15 @@ H5Eget_auto1(H5E_auto1_t *func /*out*/, void **client_data /*out*/) /* Retrieve default error stack */ if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); /* Get the automatic error reporting information */ if (H5E__get_auto(estack, &auto_op, client_data) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info"); /* Fail if the printing function isn't the default(user-set) and set through H5Eset_auto2 */ if (!auto_op.is_default && auto_op.vers == 2) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto2 has been called") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "wrong API function, H5Eset_auto2 has been called"); if (func) *func = auto_op.func1; @@ -381,9 +357,6 @@ H5Eget_auto1(H5E_auto1_t *func /*out*/, void **client_data /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Sep 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -399,11 +372,11 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); /* Get the automatic error reporting information */ if (H5E__get_auto(estack, &auto_op, NULL) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get automatic error info"); /* Set the automatic error reporting information */ auto_op.vers = 1; @@ -414,7 +387,7 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data) auto_op.func1 = func; if (H5E__set_auto(estack, &auto_op, client_data) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info") + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't set automatic error info"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Eint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Eint.c index 6d8e576560..9db4e39d3d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Eint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Eint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Eint.c - * April 11 2007 - * Quincey Koziol * * Purpose: General use, "internal" routines for error handling. * @@ -109,9 +106,6 @@ int H5E_mpi_error_str_len; * Return: Success: Message length (zero means no message) * Failure: -1 * - * Programmer: Raymond Lu - * Friday, July 14, 2003 - * *------------------------------------------------------------------------- */ ssize_t @@ -122,7 +116,7 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(msg); + assert(msg); /* Get the length of the message string */ len = (ssize_t)HDstrlen(msg->msg); @@ -172,9 +166,6 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size) * * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Thursday, May 11, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -193,7 +184,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(err_desc); + assert(err_desc); /* If no client data was passed, output to stderr */ if (!client_data) @@ -207,7 +198,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) /* Check for bad pointer(s), but can't issue error, just leave */ if (!maj_ptr || !min_ptr) - HGOTO_DONE(FAIL) + HGOTO_DONE(FAIL); if (maj_ptr->msg) maj_str = maj_ptr->msg; @@ -227,10 +218,10 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) if (cls_ptr->lib_vers) eprint->cls.lib_vers = cls_ptr->lib_vers; - HDfprintf(stream, "%s-DIAG: Error detected in %s (%s) ", - (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"), - (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"), - (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)")); + fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", + (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"), + (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"), + (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)")); /* try show the process or thread id in multiple processes cases*/ #ifdef H5_HAVE_PARALLEL @@ -242,15 +233,15 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) if (mpi_initialized && !mpi_finalized) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - HDfprintf(stream, "MPI-process %d", mpi_rank); + fprintf(stream, "MPI-process %d", mpi_rank); } /* end if */ else - HDfprintf(stream, "thread 0"); + fprintf(stream, "thread 0"); } /* end block */ #else - HDfprintf(stream, "thread %" PRIu64, H5TS_thread_id()); + fprintf(stream, "thread %" PRIu64, H5TS_thread_id()); #endif - HDfprintf(stream, ":\n"); + fprintf(stream, ":\n"); } /* end if */ /* Check for "real" error description - used to format output more nicely */ @@ -258,11 +249,10 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) have_desc = 0; /* Print error message */ - HDfprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, - err_desc->line, err_desc->func_name, (have_desc ? ": " : ""), - (have_desc ? err_desc->desc : "")); - HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); - HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); + fprintf(stream, "%*s#%03d: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, + err_desc->line, err_desc->func_name, (have_desc ? ": " : ""), (have_desc ? err_desc->desc : "")); + fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); + fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); done: FUNC_LEAVE_NOAPI(ret_value) @@ -295,9 +285,6 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Friday, December 12, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -316,7 +303,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(err_desc); + assert(err_desc); /* If no client data was passed, output to stderr */ if (!client_data) @@ -330,7 +317,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) /* Check for bad pointer(s), but can't issue error, just leave */ if (!maj_ptr || !min_ptr) - HGOTO_DONE(FAIL) + HGOTO_DONE(FAIL); if (maj_ptr->msg) maj_str = maj_ptr->msg; @@ -343,7 +330,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) /* Check for bad pointer(s), but can't issue error, just leave */ if (!cls_ptr) - HGOTO_DONE(FAIL) + HGOTO_DONE(FAIL); /* Print error class header if new class */ if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) { @@ -355,10 +342,10 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) if (cls_ptr->lib_vers) eprint->cls.lib_vers = cls_ptr->lib_vers; - HDfprintf(stream, "%s-DIAG: Error detected in %s (%s) ", - (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"), - (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"), - (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)")); + fprintf(stream, "%s-DIAG: Error detected in %s (%s) ", + (cls_ptr->cls_name ? cls_ptr->cls_name : "(null)"), + (cls_ptr->lib_name ? cls_ptr->lib_name : "(null)"), + (cls_ptr->lib_vers ? cls_ptr->lib_vers : "(null)")); /* try show the process or thread id in multiple processes cases*/ #ifdef H5_HAVE_PARALLEL @@ -370,15 +357,15 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) if (mpi_initialized && !mpi_finalized) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); - HDfprintf(stream, "MPI-process %d", mpi_rank); + fprintf(stream, "MPI-process %d", mpi_rank); } /* end if */ else - HDfprintf(stream, "thread 0"); + fprintf(stream, "thread 0"); } /* end block */ #else - HDfprintf(stream, "thread %" PRIu64, H5TS_thread_id()); + fprintf(stream, "thread %" PRIu64, H5TS_thread_id()); #endif - HDfprintf(stream, ":\n"); + fprintf(stream, ":\n"); } /* end if */ /* Check for "real" error description - used to format output more nicely */ @@ -386,11 +373,10 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) have_desc = 0; /* Print error message */ - HDfprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, - err_desc->line, err_desc->func_name, (have_desc ? ": " : ""), - (have_desc ? err_desc->desc : "")); - HDfprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); - HDfprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); + fprintf(stream, "%*s#%03u: %s line %u in %s()%s%s\n", H5E_INDENT, "", n, err_desc->file_name, + err_desc->line, err_desc->func_name, (have_desc ? ": " : ""), (have_desc ? err_desc->desc : "")); + fprintf(stream, "%*smajor: %s\n", (H5E_INDENT * 2), "", maj_str); + fprintf(stream, "%*sminor: %s\n", (H5E_INDENT * 2), "", min_str); done: FUNC_LEAVE_NOAPI(ret_value) @@ -407,9 +393,6 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Friday, February 27, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -422,7 +405,7 @@ H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(estack); + assert(estack); /* If no stream was given, use stderr */ if (!stream) @@ -431,7 +414,7 @@ H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) eprint.stream = stream; /* Reset the original error class information */ - HDmemset(&eprint.cls, 0, sizeof(H5E_cls_t)); + memset(&eprint.cls, 0, sizeof(H5E_cls_t)); /* Walk the error stack */ if (bk_compatible) { @@ -439,16 +422,16 @@ H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) walk_op.vers = 1; walk_op.u.func1 = H5E__walk1_cb; if (H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void *)&eprint) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack"); #else /* H5_NO_DEPRECATED_SYMBOLS */ - HDassert(0 && "version 1 error stack print without deprecated symbols!"); + assert(0 && "version 1 error stack print without deprecated symbols!"); #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ else { walk_op.vers = 2; walk_op.u.func2 = H5E__walk2_cb; if (H5E__walk(estack, H5E_WALK_DOWNWARD, &walk_op, (void *)&eprint) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack"); } /* end else */ done: @@ -480,9 +463,6 @@ H5E__print(const H5E_t *estack, FILE *stream, hbool_t bk_compatible) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Friday, December 12, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -494,8 +474,8 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(estack); - HDassert(op); + assert(estack); + assert(op); /* check args, but rather than failing use some default value */ if (direction != H5E_WALK_UPWARD && direction != H5E_WALK_DOWNWARD) @@ -540,11 +520,11 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack"); } /* end if */ #else /* H5_NO_DEPRECATED_SYMBOLS */ - HDassert(0 && "version 1 error stack walk without deprecated symbols!"); + assert(0 && "version 1 error stack walk without deprecated symbols!"); #endif /* H5_NO_DEPRECATED_SYMBOLS */ } /* end if */ else { - HDassert(op->vers == 2); + assert(op->vers == 2); if (op->u.func2) { ret_value = SUCCEED; if (H5E_WALK_UPWARD == direction) { @@ -576,9 +556,6 @@ H5E__walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *o * * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * July 18, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -586,7 +563,7 @@ H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) { FUNC_ENTER_PACKAGE_NOERR - HDassert(estack); + assert(estack); /* Retrieve the requested information */ if (op) @@ -615,9 +592,6 @@ H5E__get_auto(const H5E_t *estack, H5E_auto_op_t *op, void **client_data) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Friday, February 27, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -625,7 +599,7 @@ H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) { FUNC_ENTER_PACKAGE_NOERR - HDassert(estack); + assert(estack); /* Set the automatic error reporting info */ estack->auto_op = *op; @@ -641,9 +615,6 @@ H5E__set_auto(H5E_t *estack, const H5E_auto_op_t *op, void *client_data) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, August 12, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -665,10 +636,10 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(cls_id > 0); - HDassert(maj_id > 0); - HDassert(min_id > 0); - HDassert(fmt); + assert(cls_id > 0); + assert(maj_id > 0); + assert(min_id > 0); + assert(fmt); /* Note that the variable-argument parsing for the format is identical in * the H5Epush2() routine - correct errors and make changes in both @@ -676,25 +647,25 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin */ /* Start the variable-argument parsing */ - HDva_start(ap, fmt); + va_start(ap, fmt); va_started = TRUE; /* Use the vasprintf() routine, since it does what we're trying to do below */ if (HDvasprintf(&tmp, fmt, ap) < 0) - HGOTO_DONE(FAIL) + HGOTO_DONE(FAIL); /* Push the error on the stack */ if (H5E__push_stack(estack, file, func, line, cls_id, maj_id, min_id, tmp) < 0) - HGOTO_DONE(FAIL) + HGOTO_DONE(FAIL); done: if (va_started) - HDva_end(ap); + va_end(ap); /* Memory was allocated with HDvasprintf so it needs to be freed - * with HDfree + * with free */ if (tmp) - HDfree(tmp); + free(tmp); FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_printf_stack() */ @@ -714,9 +685,6 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Friday, December 12, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -735,15 +703,15 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(cls_id > 0); - HDassert(maj_id > 0); - HDassert(min_id > 0); + assert(cls_id > 0); + assert(maj_id > 0); + assert(min_id > 0); /* Check for 'default' error stack */ if (estack == NULL) if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_DONE(FAIL) + HGOTO_DONE(FAIL); /* * Don't fail if arguments are bad. Instead, substitute some default @@ -759,18 +727,18 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line /* * Push the error if there's room. Otherwise just forget it. */ - HDassert(estack); + assert(estack); if (estack->nused < H5E_NSLOTS) { /* Increment the IDs to indicate that they are used in this stack */ if (H5I_inc_ref(cls_id, FALSE) < 0) - HGOTO_DONE(FAIL) + HGOTO_DONE(FAIL); estack->slot[estack->nused].cls_id = cls_id; if (H5I_inc_ref(maj_id, FALSE) < 0) - HGOTO_DONE(FAIL) + HGOTO_DONE(FAIL); estack->slot[estack->nused].maj_num = maj_id; if (H5I_inc_ref(min_id, FALSE) < 0) - HGOTO_DONE(FAIL) + HGOTO_DONE(FAIL); estack->slot[estack->nused].min_num = min_id; /* The 'func' & 'file' strings are statically allocated (by the compiler) * there's no need to duplicate them. @@ -779,7 +747,7 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line estack->slot[estack->nused].file_name = file; estack->slot[estack->nused].line = line; if (NULL == (estack->slot[estack->nused].desc = H5MM_xstrdup(desc))) - HGOTO_DONE(FAIL) + HGOTO_DONE(FAIL); estack->nused++; } /* end if */ @@ -795,9 +763,6 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, August 6, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -810,8 +775,8 @@ H5E__clear_entries(H5E_t *estack, size_t nentries) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(estack); - HDassert(estack->nused >= nentries); + assert(estack); + assert(estack->nused >= nentries); /* Empty the error stack from the top down */ for (u = 0; nentries > 0; nentries--, u++) { @@ -820,11 +785,11 @@ H5E__clear_entries(H5E_t *estack, size_t nentries) /* Decrement the IDs to indicate that they are no longer used by this stack */ /* (In reverse order that they were incremented, so that reference counts work well) */ if (H5I_dec_ref(error->min_num) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message"); if (H5I_dec_ref(error->maj_num) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message") + HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error message"); if (H5I_dec_ref(error->cls_id) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class") + HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class"); /* Release strings */ /* The 'func' & 'file' strings are statically allocated (by the compiler) @@ -851,9 +816,6 @@ H5E__clear_entries(H5E_t *estack, size_t nentries) * * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Wednesday, July 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -867,13 +829,13 @@ H5E_clear_stack(H5E_t *estack) if (estack == NULL) if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in non-threaded case */ - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack"); /* Empty the error stack */ - HDassert(estack); + assert(estack); if (estack->nused) if (H5E__clear_entries(estack, estack->nused) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTSET, FAIL, "can't clear error stack"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -887,9 +849,6 @@ H5E_clear_stack(H5E_t *estack) * * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Friday, July 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -900,12 +859,12 @@ H5E__pop(H5E_t *estack, size_t count) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(estack); - HDassert(estack->nused >= count); + assert(estack); + assert(estack->nused >= count); /* Remove the entries from the error stack */ if (H5E__clear_entries(estack, count) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't remove errors from stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, FAIL, "can't remove errors from stack"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -920,9 +879,6 @@ H5E__pop(H5E_t *estack, size_t count) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, August 6, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -936,7 +892,7 @@ H5E_dump_api_stack(hbool_t is_api) if (is_api) { H5E_t *estack = H5E__get_my_stack(); - HDassert(estack); + assert(estack); #ifdef H5_NO_DEPRECATED_SYMBOLS if (estack->auto_op.func2) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5EnumType.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5EnumType.cpp deleted file mode 100644 index 2073365efd..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5EnumType.cpp +++ /dev/null @@ -1,348 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5DxferProp.h" -#include "H5DataSpace.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5AbstractDs.h" -#include "H5DataType.h" -#include "H5DataSet.h" -#include "H5AtomType.h" -#include "H5IntType.h" -#include "H5EnumType.h" - -namespace H5 { - -//-------------------------------------------------------------------------- -// Function: EnumType default constructor -///\brief Default constructor: Creates a stub datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType::EnumType() : DataType() -{ -} - -//-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Creates an EnumType object using the id of an existing datatype. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType::EnumType(const hid_t existing_id) : DataType(existing_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: EnumType copy constructor -///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType::EnumType(const EnumType &original) : DataType(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Creates an empty enumeration datatype given a size, in bytes. -///\param size - IN: Number of bytes in the datatype to create -///\exception H5::DataTypeIException -// Description -// The DataType constructor calls the C API H5Tcreate to create -// the enum datatype. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType::EnumType(size_t size) : DataType(H5T_ENUM, size) -{ -} - -//-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Gets the enum datatype of the specified dataset. -///\param dataset - IN: Dataset that this enum datatype associates with -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType::EnumType(const DataSet &dataset) : DataType() -{ - // Calls C function H5Dget_type to get the id of the datatype - id = H5Dget_type(dataset.getId()); - - // If the datatype id is not valid, throw an exception - if (id < 0) { - throw DataSetIException("EnumType constructor", "H5Dget_type failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Creates a new enum datatype based on an integer datatype. -///\param data_type - IN: Base datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType::EnumType(const IntType &data_type) : DataType() -{ - // Calls C function H5Tenum_create to get the id of the datatype - id = H5Tenum_create(data_type.getId()); - - // If the datatype id is not valid, throw an exception - if (id < 0) { - throw DataSetIException("EnumType constructor", "H5Tenum_create failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Creates an EnumType instance by opening an HDF5 enum datatype -/// given its name, provided as a C character string. -///\param dtype_name - IN: Enum datatype name -///\param loc - IN: Location of the type -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openEnumType(const char*) to -// improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -EnumType::EnumType(const H5Location &loc, const char *dtype_name) : DataType() -{ - id = p_opentype(loc, dtype_name); -} - -//-------------------------------------------------------------------------- -// Function: EnumType overloaded constructor -///\brief Creates an EnumType instance by opening an HDF5 enum datatype -/// given its name, provided as an \c H5std_string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Enum datatype name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openEnumType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -EnumType::EnumType(const H5Location &loc, const H5std_string &dtype_name) : DataType() -{ - id = p_opentype(loc, dtype_name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: EnumType::decode -///\brief Returns an EnumType object via DataType* by decoding the -/// binary object description of this type. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -DataType * -EnumType::decode() const -{ - hid_t encoded_enumtype_id = H5I_INVALID_HID; - try { - encoded_enumtype_id = p_decode(); - } - catch (DataTypeIException &err) { - throw; - } - EnumType *encoded_enumtype = new EnumType; - encoded_enumtype->p_setId(encoded_enumtype_id); - return (encoded_enumtype); -} - -//-------------------------------------------------------------------------- -// Function: EnumType::insert -///\brief Inserts a new member to this enumeration datatype. -///\param name - IN: Name of the new member -///\param value - IN: Pointer to the value of the new member -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -EnumType::insert(const char *name, void *value) const -{ - // Calls C routine H5Tenum_insert to insert the new enum datatype member. - herr_t ret_value = H5Tenum_insert(id, name, value); - if (ret_value < 0) { - throw DataTypeIException("EnumType::insert", "H5Tenum_insert failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: EnumType::insert -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -EnumType::insert(const H5std_string &name, void *value) const -{ - insert(name.c_str(), value); -} - -//-------------------------------------------------------------------------- -// Function: EnumType::nameOf -///\brief Returns the symbol name corresponding to a specified member -/// of this enumeration datatype. -///\param value - IN: Pointer to the value of the enum datatype -///\param size - IN: Size for the name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string -EnumType::nameOf(void *value, size_t size) const -{ - char *name_C = new char[size + 1](); // temporary C-string for C API - - // Calls C routine H5Tenum_nameof to get the name of the specified enum type - herr_t ret_value = H5Tenum_nameof(id, value, name_C, size); - - // If H5Tenum_nameof returns a negative value, raise an exception, - if (ret_value < 0) { - delete[] name_C; - throw DataTypeIException("EnumType::nameOf", "H5Tenum_nameof failed"); - } - // otherwise, create the string to hold the datatype name and return it - H5std_string name(name_C); - delete[] name_C; - return (name); -} - -//-------------------------------------------------------------------------- -// Function: EnumType::valueOf -///\brief Retrieves the value corresponding to a member of this -/// enumeration datatype, given the member's name. -///\param name - IN: Name of the queried member -///\param value - OUT: Pointer to the retrieved value -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -EnumType::valueOf(const char *name, void *value) const -{ - // Calls C routine H5Tenum_valueof to get the enum datatype value - herr_t ret_value = H5Tenum_valueof(id, name, value); - if (ret_value < 0) { - throw DataTypeIException("EnumType::valueOf", "H5Tenum_valueof failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: EnumType::valueOf -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of -/// argument \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -EnumType::valueOf(const H5std_string &name, void *value) const -{ - valueOf(name.c_str(), value); -} - -//-------------------------------------------------------------------------- -// Function: EnumType::getMemberIndex -///\brief Returns the index of a member in this enumeration datatype. -///\param name - IN: Name of the queried member -///\return Index of the member if it exists. Index will have the value -/// between 0 and \c N-1, where \c N is the value returned by the -/// member function \c EnumType::getNmembers. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 16, 2002 -//-------------------------------------------------------------------------- -int -EnumType::getMemberIndex(const char *name) const -{ - int member_index = H5Tget_member_index(id, name); - if (member_index < 0) { - throw DataTypeIException("EnumType::getMemberIndex", "H5Tget_member_index returns negative value"); - } - return (member_index); -} - -//-------------------------------------------------------------------------- -// Function: EnumType::getMemberIndex -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in the type of -/// argument \a name. -// Programmer Binh-Minh Ribler - May 16, 2002 -//-------------------------------------------------------------------------- -int -EnumType::getMemberIndex(const H5std_string &name) const -{ - return (EnumType::getMemberIndex(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: EnumType::getNmembers -///\brief Returns the number of members in this enumeration datatype. -///\return Number of members -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -int -EnumType::getNmembers() const -{ - int num_members = H5Tget_nmembers(id); - if (num_members < 0) { - throw DataTypeIException("EnumType::getNmembers", - "H5Tget_nmembers returns negative number of members"); - } - return (num_members); -} - -//-------------------------------------------------------------------------- -// Function: EnumType::getMemberValue -///\brief Retrieves the value of a member in this enumeration datatype, -/// given the member's index. -///\param memb_no - IN: Index of the queried member -///\param value - OUT: Pointer to the retrieved value -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -EnumType::getMemberValue(unsigned memb_no, void *value) const -{ - // Call C routine H5Tget_member_value to get the datatype member's value - hid_t ret_value = H5Tget_member_value(id, memb_no, value); - if (ret_value < 0) { - throw DataTypeIException("EnumType::getMemberValue", "H5Tget_member_value failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: EnumType destructor -///\brief Properly terminates access to this enum datatype. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -EnumType::~EnumType() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Exception.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5Exception.cpp deleted file mode 100644 index 91ab3311b4..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Exception.cpp +++ /dev/null @@ -1,719 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" - -namespace H5 { - -const char Exception::DEFAULT_MSG[] = "No detailed information provided"; - -//-------------------------------------------------------------------------- -// Function: Exception default constructor -///\brief Default constructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Exception::Exception() : detail_message{""}, func_name{""} -{ -} - -//-------------------------------------------------------------------------- -// Function: Exception overloaded constructor -///\brief Creates an exception with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Exception::Exception(const H5std_string &func, const H5std_string &message) - : detail_message(message), func_name(func) -{ -} - -//-------------------------------------------------------------------------- -// Function: Exception copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param orig - IN: Exception instance to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Exception::Exception(const Exception &orig) : detail_message(orig.detail_message), func_name(orig.func_name) -{ -} - -//-------------------------------------------------------------------------- -// Function: Exception::getMajorString -///\brief Returns a text string that describes the error -/// specified by a major error number. -///\param err_major - IN: Major error number -///\return Major error string -///\par Description -/// In the failure case, the string "Invalid major error number" -/// will be returned. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string -Exception::getMajorString(hid_t err_major) const -{ - // Preliminary call to H5Eget_msg() to get the length of the message - ssize_t mesg_size = H5Eget_msg(err_major, NULL, NULL, 0); - - // If H5Eget_msg() returns a negative value, raise an exception, - if (mesg_size < 0) - throw IdComponentException("Exception::getMajorString", "H5Eget_msg failed"); - - // The actual message size is the cast value + 1 for the terminal ASCII NUL - // (unfortunate in/out type sign mismatch) - size_t actual_mesg_size = static_cast(mesg_size) + 1; - - // Call H5Eget_msg again to get the actual message - char *mesg_C = new char[actual_mesg_size]; // temporary C-string for C API - - mesg_size = H5Eget_msg(err_major, NULL, mesg_C, actual_mesg_size); - - // Check for failure again - if (mesg_size < 0) { - delete[] mesg_C; - throw IdComponentException("Exception::getMajorString", "H5Eget_msg failed"); - } - - // Convert the C error description and return - H5std_string major_str(mesg_C); - delete[] mesg_C; - return (major_str); -} - -//-------------------------------------------------------------------------- -// Function: Exception::getMinorString -///\brief Returns a text string that describes the error -/// specified by a minor error number. -///\param err_minor - IN: Minor error number -///\return Minor error string -///\par Description -/// In the failure case, the string "Invalid minor error number" -/// will be returned. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string -Exception::getMinorString(hid_t err_minor) const -{ - // Preliminary call to H5Eget_msg() to get the length of the message - ssize_t mesg_size = H5Eget_msg(err_minor, NULL, NULL, 0); - - // If H5Eget_msg() returns a negative value, raise an exception, - if (mesg_size < 0) - throw IdComponentException("Exception::getMinorString", "H5Eget_msg failed"); - - // The actual message size is the cast value + 1 for the terminal ASCII NUL - // (unfortunate in/out type sign mismatch) - size_t actual_mesg_size = static_cast(mesg_size) + 1; - - // Call H5Eget_msg again to get the actual message - char *mesg_C = new char[actual_mesg_size]; // temporary C-string for C API - - mesg_size = H5Eget_msg(err_minor, NULL, mesg_C, actual_mesg_size); - - // Check for failure again - if (mesg_size < 0) { - delete[] mesg_C; - throw IdComponentException("Exception::getMinorString", "H5Eget_msg failed"); - } - - // Convert the C error description and return - H5std_string minor_str(mesg_C); - delete[] mesg_C; - return (minor_str); -} - -//-------------------------------------------------------------------------- -// Function: Exception::setAutoPrint -///\brief Turns on the automatic error printing. -///\param func - IN: Function to be called upon an error condition -///\param client_data - IN: Data passed to the error function -///\par Description -/// When the library is first initialized the auto printing -/// function, \a func, is set to the C API \c H5Eprint and -/// \a client_data is the standard error stream pointer, \c stderr. -/// Automatic stack traversal is always in the \c H5E_WALK_DOWNWARD -/// direction. -///\par -/// Users are encouraged to write their own more specific error -/// handlers -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Exception::setAutoPrint(H5E_auto2_t &func, void *client_data) -{ - // calls the C API routine H5Eset_auto to set the auto printing to - // the specified function. - herr_t ret_value = H5Eset_auto2(H5E_DEFAULT, func, client_data); - if (ret_value < 0) - throw Exception("Exception::setAutoPrint", "H5Eset_auto failed"); -} - -//-------------------------------------------------------------------------- -// Function: Exception::dontPrint -///\brief Turns off the automatic error printing from the C library. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Exception::dontPrint() -{ - // calls the C API routine H5Eset_auto with NULL parameters to turn - // off the automatic error printing. - herr_t ret_value = H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - if (ret_value < 0) - throw Exception("Exception::dontPrint", "H5Eset_auto failed"); -} - -//-------------------------------------------------------------------------- -// Function: Exception::getAutoPrint -///\brief Retrieves the current settings for the automatic error -/// stack traversal function and its data. -///\param func - OUT: Current setting for the function to be -/// called upon an error condition -///\param client_data - OUT: Current setting for the data passed to -/// the error function -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Exception::getAutoPrint(H5E_auto2_t &func, void **client_data) -{ - // calls the C API routine H5Eget_auto to get the current setting of - // the automatic error printing - herr_t ret_value = H5Eget_auto2(H5E_DEFAULT, &func, client_data); - if (ret_value < 0) - throw Exception("Exception::getAutoPrint", "H5Eget_auto failed"); -} - -//-------------------------------------------------------------------------- -// Function: Exception::clearErrorStack -///\brief Clears the error stack for the current thread. -///\par Description -/// The stack is also cleared whenever a C API function is -/// called, with certain exceptions (for instance, \c H5Eprint). -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Exception::clearErrorStack() -{ - // calls the C API routine H5Eclear to clear the error stack - herr_t ret_value = H5Eclear2(H5E_DEFAULT); - if (ret_value < 0) - throw Exception("Exception::clearErrorStack", "H5Eclear failed"); -} - -//-------------------------------------------------------------------------- -// Function: Exception::walkErrorStack -///\brief Walks the error stack for the current thread, calling the -/// specified function. -///\param direction - IN: Direction in which the error stack is to be walked -///\param func - IN: Function to be called for each error encountered -///\param client_data - IN: Data passed to the error function -///\par Description -/// Valid values for \a direction include: -/// \li \c H5E_WALK_UPWARD - begin with the most specific error -/// and end at the API -/// \li \c H5E_WALK_DOWNWARD - begin at the API and end at the -/// inner-most function where the error was first detected -///\par -/// The function specified by \a func will be called for each -/// error in the error stack. The \c H5E_walk_t prototype is as -/// follows: -///\code -/// typedef herr_t (*H5E_walk_t)(int n, H5E_error_t *err_desc, void *client_data) -/// int n - Indexed position of the error in the stack; it begins at zero -/// regardless of stack traversal direction -/// H5E_error_t *err_desc - Pointer to a data structure describing the -/// error. This structure is listed below. -/// void *client_data - Pointer to client data in the format expected by -/// the user-defined function. -///\endcode -///\par -/// Data structure to describe the error: -///\code -/// typedef struct H5E_error2_t { -/// hid_t cls_id; //class ID -/// hid_t maj_num; //major error ID -/// hid_t min_num; //minor error number -/// const char *func_name; //function in which error occurred -/// const char *file_name; //file in which error occurred -/// unsigned line; //line in file where error occurs -/// const char *desc; //optional supplied description -/// } H5E_error2_t; -///\endcode -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void *client_data) -{ - // calls the C API routine H5Ewalk to walk the error stack - herr_t ret_value = H5Ewalk2(H5E_DEFAULT, direction, func, client_data); - if (ret_value < 0) - throw Exception("Exception::walkErrorStack", "H5Ewalk failed"); -} - -//-------------------------------------------------------------------------- -// Function: Exception::getDetailMsg -///\brief Returns the detailed message set at the time the exception -/// is thrown. -///\return Text message - \c H5std_string -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string -Exception::getDetailMsg() const -{ - return (detail_message); -} - -//-------------------------------------------------------------------------- -// Function: Exception::getCDetailMsg -///\brief Returns the detailed message set at the time the exception -/// is thrown. -///\return Text message - \c char pointer -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -const char * -Exception::getCDetailMsg() const -{ - return (detail_message.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: Exception::getFuncName -///\brief Returns the name of the function, where the exception is thrown. -///\return Text message - \c H5std_string -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string -Exception::getFuncName() const -{ - return (func_name); -} - -//-------------------------------------------------------------------------- -// Function: Exception::getCFuncName -///\brief Returns the name of the function, where the exception is thrown. -///\return Text message - \c char pointer -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -const char * -Exception::getCFuncName() const -{ - return (func_name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: Exception::printErrorStack (static) -///\brief Prints the error stack in a default manner. -///\param stream - IN: File pointer, default to stderr -///\param err_stack - IN: Error stack ID, default to H5E_DEFAULT(0) -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Exception::printErrorStack(FILE *stream, hid_t err_stack) -{ - herr_t ret_value = H5Eprint2(err_stack, stream); - if (ret_value < 0) - throw Exception("Printing error stack", "H5Eprint2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: Exception::printError -// Purpose: Prints the error stack in a default manner. This member -// function is replaced by the static function printErrorStack -// and will be removed from the next major release. -// Parameter stream - IN: File pointer -// Programmer Binh-Minh Ribler - 2000 -// Description: -// This function can be removed in next major release. -// -BMR, 2014/04/24 -// Removed from documentation. -BMR, 2016/03/23 -// Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2 -//-------------------------------------------------------------------------- -// void Exception::printError(FILE* stream) const -//{ -// Exception::printErrorStack(stream, H5E_DEFAULT); -//} - -//-------------------------------------------------------------------------- -// Function: Exception destructor -///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Exception::~Exception() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: FileIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: FileIException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -FileIException::FileIException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: FileIException overloaded constructor -///\brief Creates a FileIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -FileIException::FileIException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: FileIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -FileIException::~FileIException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: GroupIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: GroupIException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -GroupIException::GroupIException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: GroupIException overloaded constructor -///\brief Creates a GroupIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -GroupIException::GroupIException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: GroupIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -GroupIException::~GroupIException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: DataSpaceIException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -DataSpaceIException::DataSpaceIException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: DataSpaceIException overloaded constructor -///\brief Creates a DataSpaceIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -DataSpaceIException::DataSpaceIException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: DataSpaceIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -DataSpaceIException::~DataSpaceIException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: DataTypeIException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -DataTypeIException::DataTypeIException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: DataTypeIException overloaded constructor -///\brief Creates a DataTypeIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -DataTypeIException::DataTypeIException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: DataTypeIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -DataTypeIException::~DataTypeIException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: ObjHeaderIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: ObjHeaderIException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -ObjHeaderIException::ObjHeaderIException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: ObjHeaderIException overloaded constructor -///\brief Creates an ObjHeaderIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -ObjHeaderIException::ObjHeaderIException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: ObjHeaderIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -ObjHeaderIException::~ObjHeaderIException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: PropListIException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -PropListIException::PropListIException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: PropListIException overloaded constructor -///\brief Creates a PropListIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -PropListIException::PropListIException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: PropListIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -PropListIException::~PropListIException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: DataSetIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: DataSetIException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -DataSetIException::DataSetIException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: DataSetIException overloaded constructor -///\brief Creates a DataSetIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -DataSetIException::DataSetIException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: DataSetIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -DataSetIException::~DataSetIException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: AttributeIException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -AttributeIException::AttributeIException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: AttributeIException overloaded constructor -///\brief Creates an AttributeIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -AttributeIException::AttributeIException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: AttributeIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -AttributeIException::~AttributeIException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: ReferenceException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: ReferenceException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -ReferenceException::ReferenceException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: ReferenceException overloaded constructor -///\brief Creates a ReferenceException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -ReferenceException::ReferenceException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: ReferenceException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -ReferenceException::~ReferenceException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: LibraryIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: LibraryIException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -LibraryIException::LibraryIException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: LibraryIException overloaded constructor -///\brief Creates a LibraryIException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -LibraryIException::LibraryIException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: LibraryIException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -LibraryIException::~LibraryIException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: LocationException -// Programmer Binh-Minh Ribler - 2014 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: LocationException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -LocationException::LocationException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: LocationException overloaded constructor -///\brief Creates a LocationException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -LocationException::LocationException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: LocationException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -LocationException::~LocationException() noexcept -{ -} - -//-------------------------------------------------------------------------- -// Subclass: IdComponentException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -//-------------------------------------------------------------------------- -// Function: IdComponentException default constructor -///\brief Default constructor. -//-------------------------------------------------------------------------- -IdComponentException::IdComponentException() : Exception() -{ -} -//-------------------------------------------------------------------------- -// Function: IdComponentException overloaded constructor -///\brief Creates a IdComponentException with the name of the function, -/// in which the failure occurs, and an optional detailed message. -///\param func - IN: Name of the function where failure occurs -///\param message - IN: Message on the failure -//-------------------------------------------------------------------------- -IdComponentException::IdComponentException(const H5std_string &func, const H5std_string &message) - : Exception(func, message) -{ -} -//-------------------------------------------------------------------------- -// Function: IdComponentException destructor -///\brief Noop destructor. -//-------------------------------------------------------------------------- -IdComponentException::~IdComponentException() noexcept -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5F.c b/externals/coda-oss/modules/drivers/hdf5/source/H5F.c index be709d23f5..692331eee4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5F.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5F.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -121,7 +120,7 @@ H5Fget_create_plist(hid_t file_id) /* check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_GET_FCPL; @@ -129,7 +128,7 @@ H5Fget_create_plist(hid_t file_id) /* Retrieve the file creation property list */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties"); /* Set return value */ ret_value = vol_cb_args.args.get_fcpl.fcpl_id; @@ -168,7 +167,7 @@ H5Fget_access_plist(hid_t file_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_GET_FAPL; @@ -176,7 +175,7 @@ H5Fget_access_plist(hid_t file_id) /* Retrieve the file's access property list */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list"); /* Set return value */ ret_value = vol_cb_args.args.get_fapl.fapl_id; @@ -231,7 +230,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) /* Check arguments */ if (0 == (types & H5F_OBJ_ALL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type"); /* Perform the query */ /* If the 'special' ID wasn't passed in, just make a normal call to @@ -244,7 +243,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) /* Get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_GET_OBJ_COUNT; @@ -253,7 +252,7 @@ H5Fget_obj_count(hid_t file_id, unsigned types) /* Get the count */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)"); /* Set return value */ ret_value = (ssize_t)count; @@ -270,19 +269,19 @@ H5Fget_obj_count(hid_t file_id, unsigned types) if (types & H5F_OBJ_FILE) if (H5I_iterate(H5I_FILE, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed"); if (types & H5F_OBJ_DATASET) if (H5I_iterate(H5I_DATASET, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed"); if (types & H5F_OBJ_GROUP) if (H5I_iterate(H5I_GROUP, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed"); if (types & H5F_OBJ_DATATYPE) if (H5I_iterate(H5I_DATATYPE, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed"); if (types & H5F_OBJ_ATTR) if (H5I_iterate(H5I_ATTR, H5F__get_all_count_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed"); /* Set return value */ ret_value = (ssize_t)udata.obj_count; @@ -349,9 +348,9 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list / /* Check arguments */ if (0 == (types & H5F_OBJ_ALL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not an object type"); if (!oid_list) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "object ID list cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "object ID list cannot be NULL"); /* Perform the query */ /* If the 'special' ID wasn't passed in, just make a normal VOL call to @@ -364,7 +363,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list / /* get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_GET_OBJ_IDS; @@ -375,7 +374,7 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list / /* Get the IDs */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)"); /* Set return value */ ret_value = (ssize_t)count; @@ -397,19 +396,19 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list / if (types & H5F_OBJ_FILE) if (H5I_iterate(H5I_FILE, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over file IDs failed"); if (types & H5F_OBJ_DATASET) if (H5I_iterate(H5I_DATASET, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over dataset IDs failed"); if (types & H5F_OBJ_GROUP) if (H5I_iterate(H5I_GROUP, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over group IDs failed"); if (types & H5F_OBJ_DATATYPE) if (H5I_iterate(H5I_DATATYPE, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over datatype IDs failed"); if (types & H5F_OBJ_ATTR) if (H5I_iterate(H5I_ATTR, H5F__get_all_ids_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, (-1), "iteration over attribute IDs failed"); /* Set return value */ ret_value = (ssize_t)udata.obj_count; @@ -442,11 +441,11 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle /*out*/) /* Check args */ if (!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file handle pointer"); /* Get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ file_opt_args.get_vfd_handle.fapl_id = fapl_id; @@ -456,7 +455,7 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle /*out*/) /* Retrieve the VFD handle for the file */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle"); done: FUNC_LEAVE_API(ret_value) @@ -484,13 +483,13 @@ H5Fis_accessible(const char *filename, hid_t fapl_id) /* Check args */ if (!filename || !*filename) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified"); /* Check the file access property list */ if (H5P_DEFAULT == fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE; @@ -500,7 +499,7 @@ H5Fis_accessible(const char *filename, hid_t fapl_id) /* Check if file is accessible */ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5"); /* Set return value */ ret_value = (htri_t)is_accessible; @@ -529,7 +528,7 @@ H5F__post_open_api_common(H5VL_object_t *vol_obj, void **token_ptr) /* Check for 'post open' callback */ supported = 0; if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't check for 'post open' operation") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't check for 'post open' operation"); if (supported & H5VL_OPT_QUERY_SUPPORTED) { H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ @@ -539,7 +538,7 @@ H5F__post_open_api_common(H5VL_object_t *vol_obj, void **token_ptr) /* Make the 'post open' callback */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to make file 'post open' callback") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to make file 'post open' callback"); } /* end if */ done: @@ -567,39 +566,39 @@ H5F__create_api_common(const char *filename, unsigned flags, hid_t fcpl_id, hid_ /* Check/fix arguments */ if (!filename || !*filename) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name"); /* In this routine, we only accept the following flags: * H5F_ACC_EXCL, H5F_ACC_TRUNC and H5F_ACC_SWMR_WRITE */ if (flags & ~(H5F_ACC_EXCL | H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid flags"); /* The H5F_ACC_EXCL and H5F_ACC_TRUNC flags are mutually exclusive */ if ((flags & H5F_ACC_EXCL) && (flags & H5F_ACC_TRUNC)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "mutually exclusive flags for file creation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "mutually exclusive flags for file creation"); /* Check file creation property list */ if (H5P_DEFAULT == fcpl_id) fcpl_id = H5P_FILE_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file create property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not file create property list"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list"); if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info"); /* Stash a copy of the "top-level" connector property, before any pass-through * connectors modify or unwrap it. */ if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context"); /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for @@ -612,11 +611,11 @@ H5F__create_api_common(const char *filename, unsigned flags, hid_t fcpl_id, hid_ /* Create a new file or truncate an existing file through the VOL */ if (NULL == (new_file = H5VL_file_create(&connector_prop, filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file"); /* Get an ID for the file */ if ((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -658,15 +657,15 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the file synchronously */ if ((ret_value = H5F__create_api_common(filename, flags, fcpl_id, fapl_id, NULL)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create file"); /* Get the file object */ if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier"); /* Perform 'post open' operation */ if (H5F__post_open_api_common(vol_obj, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed"); done: FUNC_LEAVE_API(ret_value) @@ -701,11 +700,11 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c /* Create the file, possibly asynchronously */ if ((ret_value = H5F__create_api_common(filename, flags, fcpl_id, fapl_id, token_ptr)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create file"); /* Get the file object */ if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -714,8 +713,8 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ /* Reset token for 'post open' operation */ @@ -724,7 +723,7 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c /* Perform 'post open' operation */ if (H5F__post_open_api_common(vol_obj, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -732,7 +731,7 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -761,44 +760,44 @@ H5F__open_api_common(const char *filename, unsigned flags, hid_t fapl_id, void * /* Check arguments */ if (!filename || !*filename) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file name"); /* Reject undefined flags (~H5F_ACC_PUBLIC_FLAGS) and the H5F_ACC_TRUNC & H5F_ACC_EXCL flags */ if ((flags & ~H5F_ACC_PUBLIC_FLAGS) || (flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags"); /* XXX (VOL MERGE): Might want to move SWMR flag checks to H5F_open() */ /* Asking for SWMR write access on a read-only file is invalid */ if ((flags & H5F_ACC_SWMR_WRITE) && 0 == (flags & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, - "SWMR write access on a file open for read-only access is not allowed") + "SWMR write access on a file open for read-only access is not allowed"); /* Asking for SWMR read access on a non-read-only file is invalid */ if ((flags & H5F_ACC_SWMR_READ) && (flags & H5F_ACC_RDWR)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, - "SWMR read access on a file open for read-write access is not allowed") + "SWMR read access on a file open for read-write access is not allowed"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list"); if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info"); /* Stash a copy of the "top-level" connector property, before any pass-through * connectors modify or unwrap it. */ if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context"); /* Open the file through the VOL layer */ if (NULL == (new_file = H5VL_file_open(&connector_prop, filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file"); /* Get an ID for the file */ if ((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -834,15 +833,15 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) /* Open the file synchronously */ if ((ret_value = H5F__open_api_common(filename, flags, fapl_id, NULL)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to synchronously open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to synchronously open file"); /* Get the file object */ if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier"); /* Perform 'post open' operation */ if (H5F__post_open_api_common(vol_obj, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed"); done: FUNC_LEAVE_API(ret_value) @@ -878,11 +877,11 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con /* Open the file, possibly asynchronously */ if ((ret_value = H5F__open_api_common(filename, flags, fapl_id, token_ptr)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to asynchronously open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to asynchronously open file"); /* Get the file object */ if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -891,8 +890,8 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ /* Reset token for 'post open' operation */ @@ -901,7 +900,7 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con /* Perform 'post open' operation */ if (H5F__post_open_api_common(vol_obj, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -909,7 +908,7 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -940,11 +939,11 @@ H5F__flush_api_common(hid_t object_id, H5F_scope_t scope, void **token_ptr, H5VL obj_type = H5I_get_type(object_id); if (H5I_FILE != obj_type && H5I_GROUP != obj_type && H5I_DATATYPE != obj_type && H5I_DATASET != obj_type && H5I_ATTR != obj_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Get the file object */ if (NULL == (*vol_obj_ptr = H5VL_vol_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_FLUSH; @@ -953,7 +952,7 @@ H5F__flush_api_common(hid_t object_id, H5F_scope_t scope, void **token_ptr, H5VL /* Flush the object */ if (H5VL_file_specific(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -980,7 +979,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope) /* Flush the file synchronously */ if (H5F__flush_api_common(object_id, scope, NULL, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to synchronously flush file") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to synchronously flush file"); done: FUNC_LEAVE_API(ret_value) @@ -1014,7 +1013,7 @@ H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hi /* Flush the file asynchronously */ if (H5F__flush_api_common(object_id, scope, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to asynchronously flush file") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to asynchronously flush file"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1022,7 +1021,7 @@ H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hi if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE6(__func__, "*s*sIuiFsi", app_file, app_func, app_line, object_id, scope, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1052,13 +1051,13 @@ H5Fclose(hid_t file_id) /* Check arguments */ if (H5I_FILE != H5I_get_type(file_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID"); /* Synchronously decrement reference count on ID. * When it reaches zero the file will be closed. */ if (H5I_dec_app_ref(file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed"); done: FUNC_LEAVE_API(ret_value) @@ -1087,13 +1086,13 @@ H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hi /* Check arguments */ if (H5I_FILE != H5I_get_type(file_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file ID"); /* Prepare for possible asynchronous operation */ if (H5ES_NONE != es_id) { /* Get file object's connector */ if (NULL == (vol_obj = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL object for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL object for file"); /* Increase connector's refcount, so it doesn't get closed if closing * this file ID closes the file */ @@ -1108,7 +1107,7 @@ H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hi * When it reaches zero the file will be closed. */ if (H5I_dec_app_ref_async(file_id, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "decrementing file ID failed"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1116,11 +1115,11 @@ H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: if (connector && H5VL_conn_dec_rc(connector) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't decrement ref count on connector") + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't decrement ref count on connector"); FUNC_LEAVE_API(ret_value) } /* end H5Fclose_async() */ @@ -1148,23 +1147,23 @@ H5Fdelete(const char *filename, hid_t fapl_id) /* Check args */ if (!filename || !*filename) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(fapl_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info"); /* Stash a copy of the "top-level" connector property, before any pass-through * connectors modify or unwrap it. */ if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL connector info in API context") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL connector info in API context"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE; @@ -1174,9 +1173,9 @@ H5Fdelete(const char *filename, hid_t fapl_id) /* Make sure this is HDF5 storage for this VOL connector */ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5") + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5"); if (!is_accessible) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "not an HDF5 file") + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "not an HDF5 file"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_DELETE; @@ -1185,7 +1184,7 @@ H5Fdelete(const char *filename, hid_t fapl_id) /* Delete the file */ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "unable to delete the file") + HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "unable to delete the file"); done: FUNC_LEAVE_API(ret_value) @@ -1218,21 +1217,21 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) /* Check arguments */ loc_type = H5I_get_type(loc_id); if (H5I_FILE != loc_type && H5I_GROUP != loc_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc_id parameter not a file or group ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc_id parameter not a file or group ID"); if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string"); if (H5I_FILE != H5I_get_type(child_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "child_id parameter not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "child_id parameter not a file ID"); if (H5P_DEFAULT == plist_id) plist_id = H5P_FILE_MOUNT_DEFAULT; else if (TRUE != H5P_isa_class(plist_id, H5P_FILE_MOUNT)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "plist_id is not a file mount property list ID"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Get the location object */ /* Need to open the root group of a file, if a file ID was given as the @@ -1244,7 +1243,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1253,28 +1252,29 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) /* Open the root group object */ if (NULL == (grp = H5VL_group_open(vol_obj, &loc_params, "/", H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open group"); /* Create a VOL object for the root group */ if (NULL == (loc_vol_obj = H5VL_create_object(grp, vol_obj->connector))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "can't create VOL object for root group") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "can't create VOL object for root group"); } /* end if */ else { - HDassert(H5I_GROUP == loc_type); + assert(H5I_GROUP == loc_type); if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object"); } /* end else */ /* Get the child object */ if (NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object"); /* Check if both objects are associated with the same VOL connector */ if (H5VL_cmp_connector_cls(&same_connector, loc_vol_obj->connector->cls, child_vol_obj->connector->cls) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes"); if (same_connector) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't mount file onto object from different VOL connector") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "can't mount file onto object from different VOL connector"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_GROUP_MOUNT; @@ -1288,16 +1288,16 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id) * the 'mount' operation, instead of mixing files and groups) */ if (H5VL_group_specific(loc_vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file"); done: /* Clean up if we temporarily opened the root group for a file */ if (grp) { - HDassert(loc_vol_obj); + assert(loc_vol_obj); if (H5VL_group_close(loc_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "unable to release group") + HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "unable to release group"); if (H5VL_free_object(loc_vol_obj) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object"); } /* end if */ FUNC_LEAVE_API(ret_value) @@ -1334,15 +1334,15 @@ H5Funmount(hid_t loc_id, const char *name) /* Check arguments */ loc_type = H5I_get_type(loc_id); if (H5I_FILE != loc_type && H5I_GROUP != loc_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc_id parameter not a file or group ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc_id parameter not a file or group ID"); if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Get the location object */ /* Need to open the root group of a file, if a file ID was given as the @@ -1354,7 +1354,7 @@ H5Funmount(hid_t loc_id, const char *name) /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1363,16 +1363,16 @@ H5Funmount(hid_t loc_id, const char *name) /* Open the root group object */ if (NULL == (grp = H5VL_group_open(vol_obj, &loc_params, "/", H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open group"); /* Create a VOL object for the root group */ if (NULL == (loc_vol_obj = H5VL_create_object(grp, vol_obj->connector))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "can't create VOL object for root group") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "can't create VOL object for root group"); } /* end if */ else { - HDassert(H5I_GROUP == loc_type); + assert(H5I_GROUP == loc_type); if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object"); } /* end else */ /* Set up VOL callback arguments */ @@ -1384,16 +1384,16 @@ H5Funmount(hid_t loc_id, const char *name) * the 'unmount' operation, instead of mixing files and groups) */ if (H5VL_group_specific(loc_vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file"); done: /* Clean up if we temporarily opened the root group for a file */ if (grp) { - HDassert(loc_vol_obj); + assert(loc_vol_obj); if (H5VL_group_close(loc_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "unable to release group") + HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "unable to release group"); if (H5VL_free_object(loc_vol_obj) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object"); } /* end if */ FUNC_LEAVE_API(ret_value) @@ -1422,7 +1422,7 @@ H5F__reopen_api_common(hid_t file_id, void **token_ptr) /* Get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_REOPEN; @@ -1430,15 +1430,15 @@ H5F__reopen_api_common(hid_t file_id, void **token_ptr) /* Reopen the file */ if (H5VL_file_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL connector") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL connector"); /* Make sure that worked */ if (NULL == reopen_file) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file"); /* Get an ID for the file */ if ((ret_value = H5VL_register(H5I_FILE, reopen_file, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1470,15 +1470,15 @@ H5Freopen(hid_t file_id) /* Reopen the file synchronously */ if ((ret_value = H5F__reopen_api_common(file_id, NULL)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to synchronously reopen file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to synchronously reopen file"); /* Get the file object */ if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get handle for re-opened file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get handle for re-opened file"); /* Perform 'post open' operation */ if (H5F__post_open_api_common(vol_obj, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed"); done: /* XXX (VOL MERGE): If registration fails, file will not be closed */ @@ -1514,11 +1514,11 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h /* Reopen the file, possibly asynchronously */ if ((ret_value = H5F__reopen_api_common(file_id, token_ptr)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to asynchronously reopen file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to asynchronously reopen file"); /* Get the file object */ if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get handle for re-opened file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get handle for re-opened file"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1527,8 +1527,8 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID"); + HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ /* Reset token for 'post open' operation */ @@ -1537,7 +1537,7 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h /* Perform 'post open' operation */ if (H5F__post_open_api_common(vol_obj, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1545,7 +1545,7 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1576,7 +1576,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags /*out*/) /* Get the internal file structure */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_GET_INTENT; @@ -1584,7 +1584,7 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags /*out*/) /* Get the flags */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags"); } /* end if */ done: @@ -1616,7 +1616,7 @@ H5Fget_fileno(hid_t file_id, unsigned long *fnumber /*out*/) /* Get the internal file structure */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_GET_FILENO; @@ -1624,7 +1624,7 @@ H5Fget_fileno(hid_t file_id, unsigned long *fnumber /*out*/) /* Get the 'file number' */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's 'file number'") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's 'file number'"); } /* end if */ done: @@ -1654,7 +1654,7 @@ H5Fget_freespace(hid_t file_id) /* Get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier"); /* Set up VOL callback arguments */ file_opt_args.get_freespace.size = &file_freespace; @@ -1663,7 +1663,7 @@ H5Fget_freespace(hid_t file_id) /* Get the amount of free space in the file */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space"); /* Set return value */ ret_value = (hssize_t)file_freespace; @@ -1696,9 +1696,9 @@ H5Fget_filesize(hid_t file_id, hsize_t *size /*out*/) /* Check args */ if (!size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size parameter cannot be NULL"); if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up VOL callback arguments */ file_opt_args.get_size.size = size; @@ -1707,7 +1707,7 @@ H5Fget_filesize(hid_t file_id, hsize_t *size /*out*/) /* Get the file size */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size"); done: FUNC_LEAVE_API(ret_value) @@ -1764,7 +1764,7 @@ H5Fget_file_image(hid_t file_id, void *buf /*out*/, size_t buf_len) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID"); /* Set up VOL callback arguments */ file_opt_args.get_file_image.buf_size = buf_len; @@ -1775,7 +1775,7 @@ H5Fget_file_image(hid_t file_id, void *buf /*out*/, size_t buf_len) /* Get the file image */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image"); /* Set return value */ ret_value = (ssize_t)image_len; @@ -1811,11 +1811,11 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config /*out*/) /* Check args */ if ((NULL == config) || (config->version != H5AC__CURR_CACHE_CONFIG_VERSION)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config ptr") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config ptr"); /* Get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ file_opt_args.get_mdc_config.config = config; @@ -1824,7 +1824,7 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config /*out*/) /* Get the metadata cache configuration */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration"); done: FUNC_LEAVE_API(ret_value) @@ -1854,7 +1854,7 @@ H5Fset_mdc_config(hid_t file_id, const H5AC_cache_config_t *config_ptr) /* Get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ file_opt_args.set_mdc_config.config = config_ptr; @@ -1863,7 +1863,7 @@ H5Fset_mdc_config(hid_t file_id, const H5AC_cache_config_t *config_ptr) /* Set the metadata cache configuration */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration"); done: FUNC_LEAVE_API(ret_value) @@ -1894,9 +1894,9 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate /*out*/) /* Check args */ if (NULL == hit_rate) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer"); if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up VOL callback arguments */ file_opt_args.get_mdc_hit_rate.hit_rate = hit_rate; @@ -1905,7 +1905,7 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate /*out*/) /* Get the current hit rate */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate"); done: FUNC_LEAVE_API(ret_value) @@ -1939,7 +1939,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size /*out*/, size_t *min_clean_size /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up VOL callback arguments */ file_opt_args.get_mdc_size.max_size = max_size; @@ -1951,7 +1951,7 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size /*out*/, size_t *min_clean_size /* Get the size data */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size"); /* Set mis-matched return value */ if (cur_num_entries) @@ -1989,7 +1989,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) /* Get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE; @@ -1997,7 +1997,7 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id) /* Reset the hit rate statistic */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate"); done: FUNC_LEAVE_API(ret_value) @@ -2038,11 +2038,11 @@ H5Fget_name(hid_t obj_id, char *name /*out*/, size_t size) type = H5I_get_type(obj_id); if (H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file or file object"); /* Get the file object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_GET_NAME; @@ -2053,7 +2053,7 @@ H5Fget_name(hid_t obj_id, char *name /*out*/, size_t size) /* Get the filename via the VOL */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name"); /* Set the return value */ ret_value = (ssize_t)file_name_len; @@ -2089,17 +2089,17 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo /*out*/) /* Check args */ if (!finfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file info pointer can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file info pointer can't be NULL"); /* Check the type */ type = H5I_get_type(obj_id); if (H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Get the file object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Set up VOL callback arguments */ file_opt_args.get_info.type = type; @@ -2109,7 +2109,7 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo /*out*/) /* Get the file information */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info"); done: FUNC_LEAVE_API(ret_value) @@ -2138,11 +2138,11 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info /*out*/) /* Check args */ if (!info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct"); /* Get the file pointer */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up VOL callback arguments */ file_opt_args.get_metadata_read_retry_info.info = info; @@ -2151,7 +2151,7 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info /*out*/) /* Get the retry info */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata read retry info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata read retry info"); done: FUNC_LEAVE_API(ret_value) @@ -2183,9 +2183,9 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier"); if (sect_info && nsects == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0"); /* Set up VOL callback arguments */ file_opt_args.get_free_sections.type = type; @@ -2197,7 +2197,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info /* Get the free-space section information in the file */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections"); /* Set return value */ ret_value = (ssize_t)sect_count; @@ -2229,7 +2229,7 @@ H5Fclear_elink_file_cache(hid_t file_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE; @@ -2237,7 +2237,7 @@ H5Fclear_elink_file_cache(hid_t file_id) /* Release the EFC */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache"); done: FUNC_LEAVE_API(ret_value) @@ -2289,11 +2289,11 @@ H5Fstart_swmr_write(hid_t file_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_NATIVE_FILE_START_SWMR_WRITE; @@ -2301,7 +2301,7 @@ H5Fstart_swmr_write(hid_t file_id) /* Start SWMR writing */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing") + HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing"); done: FUNC_LEAVE_API(ret_value) @@ -2329,7 +2329,7 @@ H5Fstart_mdc_logging(hid_t file_id) /* Sanity check */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_NATIVE_FILE_START_MDC_LOGGING; @@ -2337,7 +2337,7 @@ H5Fstart_mdc_logging(hid_t file_id) /* Call mdc logging function */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging") + HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging"); done: FUNC_LEAVE_API(ret_value) @@ -2366,7 +2366,7 @@ H5Fstop_mdc_logging(hid_t file_id) /* Sanity check */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_NATIVE_FILE_STOP_MDC_LOGGING; @@ -2374,7 +2374,7 @@ H5Fstop_mdc_logging(hid_t file_id) /* Call mdc logging function */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging") + HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging"); done: FUNC_LEAVE_API(ret_value) @@ -2404,7 +2404,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled /*out*/, hbool_t *i /* Sanity check */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up VOL callback arguments */ file_opt_args.get_mdc_logging_status.is_enabled = is_enabled; @@ -2414,7 +2414,7 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled /*out*/, hbool_t *i /* Call mdc logging function */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status") + HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status"); done: FUNC_LEAVE_API(ret_value) @@ -2445,11 +2445,11 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set up VOL callback arguments */ file_opt_args.set_libver_bounds.low = low; @@ -2459,7 +2459,7 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high) /* Set the library's version bounds */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds"); done: FUNC_LEAVE_API(ret_value) @@ -2488,11 +2488,11 @@ H5Fformat_convert(hid_t file_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_NATIVE_FILE_FORMAT_CONVERT; @@ -2500,7 +2500,7 @@ H5Fformat_convert(hid_t file_id) /* Convert the format */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") + HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format"); done: FUNC_LEAVE_API(ret_value) @@ -2527,7 +2527,7 @@ H5Freset_page_buffering_stats(hid_t file_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS; @@ -2535,7 +2535,7 @@ H5Freset_page_buffering_stats(hid_t file_id) /* Reset the statistics */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering"); done: FUNC_LEAVE_API(ret_value) @@ -2565,9 +2565,9 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2] /*out*/, unsigne /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID"); if (NULL == accesses || NULL == hits || NULL == misses || NULL == evictions || NULL == bypasses) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats"); /* Set up VOL callback arguments */ file_opt_args.get_page_buffering_stats.accesses = accesses; @@ -2580,7 +2580,7 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2] /*out*/, unsigne /* Get the statistics */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering"); done: FUNC_LEAVE_API(ret_value) @@ -2612,7 +2612,7 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr /*out*/, hsize_t *image /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up VOL callback arguments */ file_opt_args.get_mdc_image_info.addr = image_addr; @@ -2622,7 +2622,7 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr /*out*/, hsize_t *image /* Go get the address and size of the cache image */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info"); done: FUNC_LEAVE_API(ret_value) @@ -2650,7 +2650,7 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa /*out*/) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Only do work if valid pointer to fill in */ if (eoa) { @@ -2664,7 +2664,7 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa /*out*/) /* Retrieve the EOA for the file */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA"); } /* end if */ done: @@ -2693,7 +2693,7 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID"); /* Set up VOL callback arguments */ file_opt_args.increment_filesize.increment = increment; @@ -2702,7 +2702,7 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment) /* Increment the file size */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size"); done: FUNC_LEAVE_API(ret_value) @@ -2731,9 +2731,9 @@ H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize /*out*/) /* Check args */ if (NULL == minimize) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "out pointer 'minimize' cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "out pointer 'minimize' cannot be NULL"); if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ file_opt_args.get_min_dset_ohdr_flag.minimize = minimize; @@ -2742,7 +2742,7 @@ H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize /*out*/) /* Get the dataset object header minimum size flag */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag"); done: FUNC_LEAVE_API(ret_value) @@ -2771,7 +2771,7 @@ H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Set up VOL callback arguments */ file_opt_args.set_min_dset_ohdr_flag.minimize = minimize; @@ -2780,7 +2780,7 @@ H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize) /* Set the 'minimize dataset object headers flag' */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FA.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FA.c index e516a0c777..cf4a1d9830 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FA.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FA.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5FA.c - * April 2009 - * Vailin Choi * * Purpose: Implements a Fixed Array for storing elements * of datasets with fixed dimensions. @@ -97,9 +94,6 @@ H5FL_BLK_DEFINE(fa_native_elmt); * Return: Pointer to farray wrapper success * NULL on failure * - * Programmer: Quincey Koziol - * Oct 17 2016 - * *------------------------------------------------------------------------- */ static H5FA_t * @@ -112,30 +106,30 @@ H5FA__new(H5F_t *f, haddr_t fa_addr, hbool_t from_open, void *ctx_udata) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(fa_addr)); + assert(f); + assert(H5_addr_defined(fa_addr)); /* Allocate fixed array wrapper */ if (NULL == (fa = H5FL_CALLOC(H5FA_t))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array info") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array info"); /* Lock the array header into memory */ if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to load fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to load fixed array header"); /* Check for pending array deletion */ if (from_open && hdr->pending_delete) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTOPENOBJ, NULL, "can't open fixed array pending deletion") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTOPENOBJ, NULL, "can't open fixed array pending deletion"); /* Point fixed array wrapper at header and bump it's ref count */ fa->hdr = hdr; if (H5FA__hdr_incr(fa->hdr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header"); /* Increment # of files using this array header */ if (H5FA__hdr_fuse_incr(fa->hdr) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, - "can't increment file reference count on shared array header") + "can't increment file reference count on shared array header"); /* Set file pointer for this array open context */ fa->f = f; @@ -145,10 +139,10 @@ H5FA__new(H5F_t *f, haddr_t fa_addr, hbool_t from_open, void *ctx_udata) done: if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL, "unable to release fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL, "unable to release fixed array header"); if (!ret_value) if (fa && H5FA_close(fa) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array") + HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__new() */ @@ -161,9 +155,6 @@ H5FA__new(H5F_t *f, haddr_t fa_addr, hbool_t from_open, void *ctx_udata) * Return: Pointer to fixed array wrapper on success * NULL on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ H5FA_t * @@ -176,20 +167,20 @@ H5FA_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) FUNC_ENTER_NOAPI(NULL) /* Check arguments */ - HDassert(f); - HDassert(cparam); + assert(f); + assert(cparam); /* H5FA interface sanity check */ HDcompile_assert(H5FA_NUM_CLS_ID == NELMTS(H5FA_client_class_g)); /* Create fixed array header */ if (HADDR_UNDEF == (fa_addr = H5FA__hdr_create(f, cparam, ctx_udata))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, "can't create fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, "can't create fixed array header"); /* Allocate and initialize new fixed array wrapper */ if (NULL == (fa = H5FA__new(f, fa_addr, FALSE, ctx_udata))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, - "allocation and/or initialization failed for fixed array wrapper") + "allocation and/or initialization failed for fixed array wrapper"); /* Set the return value */ ret_value = fa; @@ -197,7 +188,7 @@ H5FA_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) done: if (!ret_value) if (fa && H5FA_close(fa) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array") + HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA_create() */ @@ -210,9 +201,6 @@ H5FA_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) * Return: Pointer to array wrapper on success * NULL on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ H5FA_t * @@ -224,13 +212,13 @@ H5FA_open(H5F_t *f, haddr_t fa_addr, void *ctx_udata) FUNC_ENTER_NOAPI(NULL) /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(fa_addr)); + assert(f); + assert(H5_addr_defined(fa_addr)); /* Allocate and initialize new fixed array wrapper */ if (NULL == (fa = H5FA__new(f, fa_addr, TRUE, ctx_udata))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, - "allocation and/or initialization failed for fixed array wrapper") + "allocation and/or initialization failed for fixed array wrapper"); /* Set the return value */ ret_value = fa; @@ -238,7 +226,7 @@ H5FA_open(H5F_t *f, haddr_t fa_addr, void *ctx_udata) done: if (!ret_value) if (fa && H5FA_close(fa) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array") + HDONE_ERROR(H5E_FARRAY, H5E_CLOSEERROR, NULL, "unable to close fixed array"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA_open() */ @@ -250,9 +238,6 @@ H5FA_open(H5F_t *f, haddr_t fa_addr, void *ctx_udata) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -261,8 +246,8 @@ H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts) FUNC_ENTER_NOAPI_NOERR /* Check arguments */ - HDassert(fa); - HDassert(nelmts); + assert(fa); + assert(nelmts); /* Retrieve the current number of elements in the fixed array */ *nelmts = fa->hdr->stats.nelmts; @@ -277,9 +262,6 @@ H5FA_get_nelmts(const H5FA_t *fa, hsize_t *nelmts) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -288,9 +270,9 @@ H5FA_get_addr(const H5FA_t *fa, haddr_t *addr) FUNC_ENTER_NOAPI_NOERR /* Check arguments */ - HDassert(fa); - HDassert(fa->hdr); - HDassert(addr); + assert(fa); + assert(fa->hdr); + assert(addr); /* Retrieve the address of the fixed array's header */ *addr = fa->hdr->addr; @@ -305,9 +287,6 @@ H5FA_get_addr(const H5FA_t *fa, haddr_t *addr) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -325,27 +304,27 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(fa); - HDassert(fa->hdr); + assert(fa); + assert(fa->hdr); /* Set the shared array header's file context for this operation */ hdr->f = fa->f; /* Check if we need to create the fixed array data block */ - if (!H5F_addr_defined(hdr->dblk_addr)) { + if (!H5_addr_defined(hdr->dblk_addr)) { /* Create the data block */ hdr->dblk_addr = H5FA__dblock_create(hdr, &hdr_dirty); - if (!H5F_addr_defined(hdr->dblk_addr)) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, "unable to create fixed array data block") + if (!H5_addr_defined(hdr->dblk_addr)) + HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, "unable to create fixed array data block"); } - HDassert(idx < hdr->cparam.nelmts); + assert(idx < hdr->cparam.nelmts); /* Protect data block */ if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to protect fixed array data block, address = %llu", - (unsigned long long)hdr->dblk_addr) + (unsigned long long)hdr->dblk_addr); /* Check for paging data block */ if (!dblock->npages) { @@ -378,7 +357,7 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt) if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { /* Create the data block page */ if (H5FA__dblk_page_create(hdr, dblk_page_addr, dblk_page_nelmts) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, "unable to create data block page") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, "unable to create data block page"); /* Mark data block page as initialized in data block */ H5VM_bit_set(dblock->dblk_page_init, page_idx, TRUE); @@ -390,7 +369,7 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt) (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + (unsigned long long)dblk_page_addr); /* Set the element in the data block page */ H5MM_memcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, @@ -402,13 +381,13 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt) /* Check for header modified */ if (hdr_dirty) if (H5FA__hdr_modified(hdr) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as modified") + HDONE_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as modified"); /* Release resources */ if (dblock && H5FA__dblock_unprotect(dblock, dblock_cache_flags) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block"); if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, dblk_page_cache_flags) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block page") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block page"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA_set() */ @@ -420,9 +399,6 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -436,25 +412,25 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(fa); - HDassert(fa->hdr); + assert(fa); + assert(fa->hdr); /* Set the shared array header's file context for this operation */ hdr->f = fa->f; /* Check if the fixed array data block has been allocated on disk yet */ - if (!H5F_addr_defined(hdr->dblk_addr)) { + if (!H5_addr_defined(hdr->dblk_addr)) { /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value"); } /* end if */ else { /* Get the data block */ - HDassert(H5F_addr_defined(hdr->dblk_addr)); + assert(H5_addr_defined(hdr->dblk_addr)); if (NULL == (dblock = H5FA__dblock_protect(hdr, hdr->dblk_addr, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to protect fixed array data block, address = %llu", - (unsigned long long)hdr->dblk_addr) + (unsigned long long)hdr->dblk_addr); /* Check for paged data block */ if (!dblock->npages) @@ -471,10 +447,10 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt) if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { /* Call the class's 'fill' callback */ if ((hdr->cparam.cls->fill)(elmt, (size_t)1) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "can't set element to class's fill value"); /* We've retrieved the value, leave now */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ else { /* get the page */ size_t dblk_page_nelmts; /* # of elements in a data block page */ @@ -499,7 +475,7 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt) H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + (unsigned long long)dblk_page_addr); /* Retrieve element from data block */ H5MM_memcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), @@ -510,9 +486,9 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt) done: if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block"); if (dblk_page && H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block page") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block page"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA_get() */ @@ -524,9 +500,6 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -539,7 +512,7 @@ H5FA_close(H5FA_t *fa) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(fa); + assert(fa); /* Close the header if it was set */ if (fa->hdr) { @@ -572,19 +545,19 @@ H5FA_close(H5FA_t *fa) /* Check the header's status in the metadata cache */ if (H5AC_get_entry_status(fa->f, fa_addr, &hdr_status) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, - "unable to check metadata cache status for fixed array header") + "unable to check metadata cache status for fixed array header"); /* Sanity checks on header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PINNED); - HDassert(!(hdr_status & H5AC_ES__IS_PROTECTED)); + assert(hdr_status & H5AC_ES__IN_CACHE); + assert(hdr_status & H5AC_ES__IS_PINNED); + assert(!(hdr_status & H5AC_ES__IS_PROTECTED)); } #endif /* NDEBUG */ /* Lock the array header into memory */ /* (OK to pass in NULL for callback context, since we know the header must be in the cache) */ if (NULL == (hdr = H5FA__hdr_protect(fa->f, fa_addr, NULL, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTLOAD, FAIL, "unable to load fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTLOAD, FAIL, "unable to load fixed array header"); /* Set the shared array header's file context for this operation */ hdr->f = fa->f; @@ -595,11 +568,11 @@ H5FA_close(H5FA_t *fa) */ if (H5FA__hdr_decr(fa->hdr) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared array header") + "can't decrement reference count on shared array header"); /* Delete array, starting with header (unprotects header) */ if (H5FA__hdr_delete(hdr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array"); } /* end if */ else { /* Decrement the reference count on the array header */ @@ -608,7 +581,7 @@ H5FA_close(H5FA_t *fa) */ if (H5FA__hdr_decr(fa->hdr) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared array header") + "can't decrement reference count on shared array header"); } /* end else */ } /* end if */ @@ -626,9 +599,6 @@ H5FA_close(H5FA_t *fa) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -640,13 +610,13 @@ H5FA_delete(H5F_t *f, haddr_t fa_addr, void *ctx_udata) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(fa_addr)); + assert(f); + assert(H5_addr_defined(fa_addr)); /* Lock the array header into memory */ if (NULL == (hdr = H5FA__hdr_protect(f, fa_addr, ctx_udata, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to protect fixed array header, address = %llu", - (unsigned long long)fa_addr) + (unsigned long long)fa_addr); /* Check for files using shared array header */ if (hdr->file_rc) @@ -657,14 +627,14 @@ H5FA_delete(H5F_t *f, haddr_t fa_addr, void *ctx_udata) /* Delete array now, starting with header (unprotects header) */ if (H5FA__hdr_delete(hdr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array"); hdr = NULL; } done: /* Unprotect the header if an error occurred */ if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA_delete() */ @@ -679,9 +649,6 @@ H5FA_delete(H5F_t *f, haddr_t fa_addr, void *ctx_udata) * * Return: H5_ITER_CONT/H5_ITER_ERROR * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ int @@ -694,20 +661,20 @@ H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata) FUNC_ENTER_NOAPI(H5_ITER_ERROR) /* Check arguments */ - HDassert(fa); - HDassert(op); - HDassert(udata); + assert(fa); + assert(op); + assert(udata); /* Allocate space for a native array element */ if (NULL == (elmt = H5FL_BLK_MALLOC(fa_native_elmt, fa->hdr->cparam.cls->nat_elmt_size))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, H5_ITER_ERROR, - "memory allocation failed for fixed array element") + "memory allocation failed for fixed array element"); /* Iterate over all elements in array */ for (u = 0; u < fa->hdr->stats.nelmts && ret_value == H5_ITER_CONT; u++) { /* Get array element */ if (H5FA_get(fa, u, elmt) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, H5_ITER_ERROR, "unable to delete fixed array") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, H5_ITER_ERROR, "unable to delete fixed array"); /* Invoke callback */ if ((ret_value = (*op)(u, elmt, udata)) < 0) { @@ -731,9 +698,6 @@ H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -745,9 +709,9 @@ H5FA_depend(H5FA_t *fa, H5AC_proxy_entry_t *parent) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(fa); - HDassert(hdr); - HDassert(parent); + assert(fa); + assert(hdr); + assert(parent); /* * Check to see if a flush dependency between the fixed array @@ -756,14 +720,14 @@ H5FA_depend(H5FA_t *fa, H5AC_proxy_entry_t *parent) */ if (NULL == hdr->parent) { /* Sanity check */ - HDassert(hdr->top_proxy); + assert(hdr->top_proxy); /* Set the shared array header's file context for this operation */ hdr->f = fa->f; /* Add the fixed array as a child of the parent (proxy) */ if (H5AC_proxy_entry_add_child(parent, hdr->f, hdr->top_proxy) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "unable to add fixed array as child of proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, "unable to add fixed array as child of proxy"); hdr->parent = parent; } @@ -789,8 +753,8 @@ H5FA_patch_file(H5FA_t *fa, H5F_t *f) FUNC_ENTER_NOAPI_NOERR /* Check arguments */ - HDassert(fa); - HDassert(f); + assert(fa); + assert(f); if (fa->f != f || fa->hdr->f != f) fa->f = fa->hdr->f = f; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FAcache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FAcache.c index 24c546a027..d61436068a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FAcache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FAcache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5FAcache.c - * Jul 2 2009 - * Quincey Koziol * * Purpose: Implement fixed array metadata cache methods. * @@ -162,9 +159,6 @@ const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1] = {{ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 31, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -175,9 +169,9 @@ H5FA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->f); - HDassert(image_len); + assert(udata); + assert(udata->f); + assert(image_len); /* Set the image length size */ *image_len = (size_t)H5FA_HEADER_SIZE_FILE(udata->f); @@ -194,8 +188,6 @@ H5FA__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -209,7 +201,7 @@ H5FA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -228,9 +220,6 @@ H5FA__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE * Return: Success: Pointer to a new Fixed array * Failure: NULL * - * Programmer: Quincey Koziol - * August 12, 2013 - * *------------------------------------------------------------------------- */ static void * @@ -247,30 +236,31 @@ H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(udata); - HDassert(udata->f); - HDassert(H5F_addr_defined(udata->addr)); + assert(udata); + assert(udata->f); + assert(H5_addr_defined(udata->addr)); /* Allocate space for the fixed array data structure */ if (NULL == (hdr = H5FA__hdr_alloc(udata->f))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array shared header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for fixed array shared header"); /* Set the fixed array header's address */ hdr->addr = udata->addr; /* Magic number */ - if (HDmemcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array header signature") + if (memcmp(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array header signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5FA_HDR_VERSION) - HGOTO_ERROR(H5E_FARRAY, H5E_VERSION, NULL, "wrong fixed array header version") + HGOTO_ERROR(H5E_FARRAY, H5E_VERSION, NULL, "wrong fixed array header version"); /* Fixed array class */ id = (H5FA_cls_id_t)*image++; if (id >= H5FA_NUM_CLS_ID) - HGOTO_ERROR(H5E_FARRAY, H5E_BADTYPE, NULL, "incorrect fixed array class") + HGOTO_ERROR(H5E_FARRAY, H5E_BADTYPE, NULL, "incorrect fixed array class"); hdr->cparam.cls = H5FA_client_class_g[id]; /* General array creation/configuration information */ @@ -286,7 +276,7 @@ H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len H5F_addr_decode(udata->f, &image, &hdr->dblk_addr); /* Address of index block */ /* Check for data block */ - if (H5F_addr_defined(hdr->dblk_addr)) { + if (H5_addr_defined(hdr->dblk_addr)) { H5FA_dblock_t dblock; /* Fake data block for computing size */ size_t dblk_page_nelmts; /* # of elements per data block page */ @@ -306,7 +296,7 @@ H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); + assert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); /* checksum verification already done in verify_chksum cb */ @@ -314,12 +304,12 @@ H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == len); + assert((size_t)(image - (const uint8_t *)_image) == len); /* Finish initializing fixed array header */ if (H5FA__hdr_init(hdr, udata->ctx_udata) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, "initialization failed for fixed array header") - HDassert(hdr->size == len); + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, NULL, "initialization failed for fixed array header"); + assert(hdr->size == len); /* Set return value */ ret_value = hdr; @@ -328,7 +318,7 @@ H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len /* Release resources */ if (!ret_value) if (hdr && H5FA__hdr_dest(hdr) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__cache_hdr_deserialize() */ @@ -340,9 +330,6 @@ H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 12, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -353,8 +340,8 @@ H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(hdr); - HDassert(image_len); + assert(hdr); + assert(image_len); /* Set the image length size */ *image_len = hdr->size; @@ -369,9 +356,6 @@ H5FA__cache_hdr_image_len(const void *_thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 12, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -384,9 +368,9 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(hdr); + assert(f); + assert(image); + assert(hdr); /* Magic number */ H5MM_memcpy(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -396,7 +380,7 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le *image++ = H5FA_HDR_VERSION; /* Fixed array type */ - HDassert(hdr->cparam.cls->id <= 255); + assert(hdr->cparam.cls->id <= 255); *image++ = (uint8_t)hdr->cparam.cls->id; /* General array creation/configuration information */ @@ -418,7 +402,7 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FA__cache_hdr_serialize() */ @@ -430,9 +414,6 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le * * Return: Non-negative on success/Negative on failure * - * Programmer: Dana Robinson - * December 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -444,7 +425,7 @@ H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Check if the file was opened with SWMR-write access */ if (hdr->swmr_write) { @@ -468,13 +449,13 @@ H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) */ if (hdr->parent) { /* Sanity check */ - HDassert(hdr->top_proxy); + assert(hdr->top_proxy); /* Destroy flush dependency on object header proxy */ if (H5AC_proxy_entry_remove_child((H5AC_proxy_entry_t *)hdr->parent, (void *)hdr->top_proxy) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, - "unable to destroy flush dependency between fixed array and proxy") + "unable to destroy flush dependency between fixed array and proxy"); hdr->parent = NULL; } /* end if */ @@ -483,21 +464,21 @@ H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) if (H5AC_proxy_entry_remove_child(hdr->top_proxy, hdr) < 0) HGOTO_ERROR( H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, - "unable to destroy flush dependency between header and fixed array 'top' proxy") + "unable to destroy flush dependency between header and fixed array 'top' proxy"); /* Don't reset hdr->top_proxy here, it's destroyed when the header is freed -QAK */ } /* end if */ break; default: #ifdef NDEBUG - HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ } /* end if */ else - HDassert(NULL == hdr->parent); + assert(NULL == hdr->parent); done: @@ -512,9 +493,6 @@ H5FA__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * August 12, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -525,11 +503,11 @@ H5FA__cache_hdr_free_icr(void *thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(thing); + assert(thing); /* Release the extensible array header */ if (H5FA__hdr_dest((H5FA_hdr_t *)thing) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -542,9 +520,6 @@ H5FA__cache_hdr_free_icr(void *thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 12, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -557,13 +532,13 @@ H5FA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->hdr); - HDassert(image_len); + assert(udata); + assert(udata->hdr); + assert(image_len); /* Set up fake data block for computing size on disk */ /* (Note: extracted from H5FA__dblock_alloc) */ - HDmemset(&dblock, 0, sizeof(dblock)); + memset(&dblock, 0, sizeof(dblock)); /* Set up fake data block for computing size on disk * @@ -596,8 +571,6 @@ H5FA__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -611,7 +584,7 @@ H5FA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -630,9 +603,6 @@ H5FA__cache_dblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN * Return: Success: Pointer to a new B-tree. * Failure: NULL * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static void * @@ -649,36 +619,36 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(udata); - HDassert(udata->hdr); + assert(udata); + assert(udata->hdr); /* Allocate the fixed array data block */ if (NULL == (dblock = H5FA__dblock_alloc(udata->hdr))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array data block") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array data block"); - HDassert(((!dblock->npages) && (len == (size_t)H5FA_DBLOCK_SIZE(dblock))) || - (len == (size_t)H5FA_DBLOCK_PREFIX_SIZE(dblock))); + assert(((!dblock->npages) && (len == (size_t)H5FA_DBLOCK_SIZE(dblock))) || + (len == (size_t)H5FA_DBLOCK_PREFIX_SIZE(dblock))); /* Set the fixed array data block's information */ dblock->addr = udata->dblk_addr; /* Magic number */ - if (HDmemcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array data block signature") + if (memcmp(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array data block signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5FA_DBLOCK_VERSION) - HGOTO_ERROR(H5E_FARRAY, H5E_VERSION, NULL, "wrong fixed array data block version") + HGOTO_ERROR(H5E_FARRAY, H5E_VERSION, NULL, "wrong fixed array data block version"); /* Fixed array type */ if (*image++ != (uint8_t)udata->hdr->cparam.cls->id) - HGOTO_ERROR(H5E_FARRAY, H5E_BADTYPE, NULL, "incorrect fixed array class") + HGOTO_ERROR(H5E_FARRAY, H5E_BADTYPE, NULL, "incorrect fixed array class"); /* Address of header for array that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->hdr->f, &image, &arr_addr); - if (H5F_addr_ne(arr_addr, udata->hdr->addr)) - HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array header address") + if (H5_addr_ne(arr_addr, udata->hdr->addr)) + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, NULL, "wrong fixed array header address"); /* Page initialization flags */ if (dblock->npages > 0) { @@ -692,13 +662,13 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Convert from raw elements on disk into native elements in memory */ if ((udata->hdr->cparam.cls->decode)(image, dblock->elmts, (size_t)udata->hdr->cparam.nelmts, udata->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTDECODE, NULL, "can't decode fixed array data elements") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDECODE, NULL, "can't decode fixed array data elements"); image += (udata->hdr->cparam.nelmts * udata->hdr->cparam.raw_elmt_size); } /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); + assert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); /* Set the data block's size */ dblock->size = H5FA_DBLOCK_SIZE(dblock); @@ -709,7 +679,7 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == len); + assert((size_t)(image - (const uint8_t *)_image) == len); /* Set return value */ ret_value = dblock; @@ -718,7 +688,7 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Release resources */ if (!ret_value) if (dblock && H5FA__dblock_dest(dblock) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__cache_dblock_deserialize() */ @@ -730,9 +700,6 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -743,8 +710,8 @@ H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(dblock); - HDassert(image_len); + assert(dblock); + assert(image_len); /* Set the image length size */ if (!dblock->npages) @@ -762,9 +729,6 @@ H5FA__cache_dblock_image_len(const void *_thing, size_t *image_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -778,10 +742,10 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(dblock); - HDassert(dblock->hdr); + assert(f); + assert(image); + assert(dblock); + assert(dblock->hdr); /* Magic number */ H5MM_memcpy(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -791,7 +755,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED *image++ = H5FA_DBLOCK_VERSION; /* Fixed array type */ - HDassert(dblock->hdr->cparam.cls->id <= 255); + assert(dblock->hdr->cparam.cls->id <= 255); *image++ = (uint8_t)dblock->hdr->cparam.cls->id; /* Address of array header for array which owns this block */ @@ -812,7 +776,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED H5_CHECK_OVERFLOW(dblock->hdr->cparam.nelmts, /* From: */ hsize_t, /* To: */ size_t); if ((dblock->hdr->cparam.cls->encode)(image, dblock->elmts, (size_t)dblock->hdr->cparam.nelmts, dblock->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTENCODE, FAIL, "can't encode fixed array data elements") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTENCODE, FAIL, "can't encode fixed array data elements"); image += (dblock->hdr->cparam.nelmts * dblock->hdr->cparam.raw_elmt_size); } @@ -823,7 +787,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -836,9 +800,6 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -850,7 +811,7 @@ H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblock); + assert(dblock); /* Check if the file was opened with SWMR-write access */ if (dblock->hdr->swmr_write) { @@ -863,7 +824,7 @@ H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_FARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block and header, address = %llu", - (unsigned long long)dblock->addr) + (unsigned long long)dblock->addr); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -878,23 +839,23 @@ H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if (H5FA__destroy_flush_depend((H5AC_info_t *)dblock->hdr, (H5AC_info_t *)dblock) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); /* Detach from 'top' proxy for fixed array */ if (dblock->top_proxy) { if (H5AC_proxy_entry_remove_child(dblock->top_proxy, dblock) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block " - "and fixed array 'top' proxy") + "and fixed array 'top' proxy"); dblock->top_proxy = NULL; } break; default: #ifdef NDEBUG - HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif } /* end switch */ } /* end if */ @@ -911,9 +872,6 @@ H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -925,11 +883,11 @@ H5FA__cache_dblock_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(dblock); + assert(dblock); /* Release the fixed array data block */ if (H5FA__dblock_dest(dblock) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array data block") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array data block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -959,9 +917,6 @@ H5FA__cache_dblock_free_icr(void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 12/5/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -972,10 +927,9 @@ H5FA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(dblock); - HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblock->cache_info.type == H5AC_FARRAY_DBLOCK); - HDassert(fsf_size); + assert(dblock); + assert(dblock->cache_info.type == H5AC_FARRAY_DBLOCK); + assert(fsf_size); *fsf_size = dblock->size; @@ -989,9 +943,6 @@ H5FA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1002,10 +953,10 @@ H5FA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->hdr); - HDassert(udata->nelmts > 0); - HDassert(image_len); + assert(udata); + assert(udata->hdr); + assert(udata->nelmts > 0); + assert(image_len); /* Set the image length size */ *image_len = (size_t)H5FA_DBLK_PAGE_SIZE(udata->hdr, udata->nelmts); @@ -1022,8 +973,6 @@ H5FA__cache_dblk_page_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -1037,7 +986,7 @@ H5FA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -1056,9 +1005,6 @@ H5FA__cache_dblk_page_verify_chksum(const void *_image, size_t len, void H5_ATTR * Return: Success: Pointer to a new B-tree. * Failure: NULL * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static void * @@ -1074,15 +1020,15 @@ H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, /* Sanity check */ FUNC_ENTER_PACKAGE - HDassert(udata); - HDassert(udata->hdr); - HDassert(udata->nelmts > 0); - HDassert(H5F_addr_defined(udata->dblk_page_addr)); + assert(udata); + assert(udata->hdr); + assert(udata->nelmts > 0); + assert(H5_addr_defined(udata->dblk_page_addr)); /* Allocate the fixed array data block page */ if (NULL == (dblk_page = H5FA__dblk_page_alloc(udata->hdr, udata->nelmts))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for fixed array data block page") + "memory allocation failed for fixed array data block page"); /* Set the fixed array data block's information */ dblk_page->addr = udata->dblk_page_addr; @@ -1092,12 +1038,12 @@ H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, /* Decode elements in data block page */ /* Convert from raw elements on disk into native elements in memory */ if ((udata->hdr->cparam.cls->decode)(image, dblk_page->elmts, udata->nelmts, udata->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTDECODE, NULL, "can't decode fixed array data elements") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDECODE, NULL, "can't decode fixed array data elements"); image += (udata->nelmts * udata->hdr->cparam.raw_elmt_size); /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); + assert((size_t)(image - (const uint8_t *)_image) == (len - H5FA_SIZEOF_CHKSUM)); /* Set the data block page's size */ dblk_page->size = len; @@ -1108,7 +1054,7 @@ H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == dblk_page->size); + assert((size_t)(image - (const uint8_t *)_image) == dblk_page->size); /* Set return value */ ret_value = dblk_page; @@ -1118,7 +1064,7 @@ H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, /* Release resources */ if (!ret_value) if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block page") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block page"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__cache_dblk_page_deserialize() */ @@ -1130,9 +1076,6 @@ H5FA__cache_dblk_page_deserialize(const void *_image, size_t len, void *_udata, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1143,8 +1086,8 @@ H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(dblk_page); - HDassert(image_len); + assert(dblk_page); + assert(image_len); /* Set the image length size */ *image_len = dblk_page->size; @@ -1159,9 +1102,6 @@ H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1176,10 +1116,10 @@ H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_ima FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(image); - HDassert(dblk_page); - HDassert(dblk_page->hdr); + assert(f); + assert(image); + assert(dblk_page); + assert(dblk_page->hdr); /* Internal information */ @@ -1188,7 +1128,7 @@ H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_ima /* Convert from native elements in memory into raw elements on disk */ if ((dblk_page->hdr->cparam.cls->encode)(image, dblk_page->elmts, dblk_page->nelmts, dblk_page->hdr->cb_ctx) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTENCODE, FAIL, "can't encode fixed array data elements") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTENCODE, FAIL, "can't encode fixed array data elements"); image += (dblk_page->nelmts * dblk_page->hdr->cparam.raw_elmt_size); /* Compute metadata checksum */ @@ -1198,7 +1138,7 @@ H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_ima UINT32ENCODE(image, metadata_chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1211,9 +1151,6 @@ H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_ima * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 17 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -1225,7 +1162,7 @@ H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblk_page); + assert(dblk_page); /* Determine which action to take */ switch (action) { @@ -1241,7 +1178,7 @@ H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) if (H5AC_proxy_entry_remove_child(dblk_page->top_proxy, dblk_page) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency between data block page " - "and fixed array 'top' proxy") + "and fixed array 'top' proxy"); dblk_page->top_proxy = NULL; } /* end if */ break; @@ -1257,9 +1194,9 @@ H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) default: #ifdef NDEBUG - HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ @@ -1275,9 +1212,6 @@ H5FA__cache_dblk_page_notify(H5AC_notify_action_t action, void *_thing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1288,11 +1222,11 @@ H5FA__cache_dblk_page_free_icr(void *thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(thing); + assert(thing); /* Release the fixed array data block page */ if (H5FA__dblk_page_dest((H5FA_dblk_page_t *)thing) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array data block page") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "can't free fixed array data block page"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FAdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FAdbg.c index 9588787019..e28f67887b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FAdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FAdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -74,9 +73,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -91,49 +87,49 @@ H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(H5F_addr_defined(obj_addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(cls); + assert(f); + assert(H5_addr_defined(addr)); + assert(H5_addr_defined(obj_addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(cls); /* Check for debugging context callback available */ if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context"); /* Load the fixed array header */ if (NULL == (hdr = H5FA__hdr_protect(f, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to load fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to load fixed array header"); /* Print opening message */ - HDfprintf(stream, "%*sFixed Array Header...\n", indent, ""); + fprintf(stream, "%*sFixed Array Header...\n", indent, ""); /* Print the values */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. # of elements in data block page:", - (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. # of elements in data block page:", + (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Number of elements in Fixed Array:", hdr->stats.nelmts); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of elements in Fixed Array:", hdr->stats.nelmts); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Fixed Array Data Block Address:", hdr->dblk_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Fixed Array Data Block Address:", hdr->dblk_addr); done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to release fixed array debugging context") + HDONE_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to release fixed array debugging context"); if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__hdr_debug() */ @@ -145,9 +141,6 @@ H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -164,49 +157,49 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(cls); - HDassert(H5F_addr_defined(hdr_addr)); - HDassert(H5F_addr_defined(obj_addr)); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(cls); + assert(H5_addr_defined(hdr_addr)); + assert(H5_addr_defined(obj_addr)); /* Check for debugging context callback available */ if (cls->crt_dbg_ctx) /* Create debugging context */ if (NULL == (dbg_ctx = cls->crt_dbg_ctx(f, obj_addr))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to create fixed array debugging context"); /* Load the fixed array header */ if (NULL == (hdr = H5FA__hdr_protect(f, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to load fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to load fixed array header"); /* Protect data block */ if (NULL == (dblock = H5FA__dblock_protect(hdr, addr, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, - "unable to protect fixed array data block, address = %llu", (unsigned long long)addr) + "unable to protect fixed array data block, address = %llu", (unsigned long long)addr); /* Print opening message */ - HDfprintf(stream, "%*sFixed Array data Block...\n", indent, ""); + fprintf(stream, "%*sFixed Array data Block...\n", indent, ""); /* Print the values */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Data Block size:", dblock->size); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Number of elements in Data Block:", hdr->cparam.nelmts); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Number of pages in Data Block:", dblock->npages); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "Number of elements per Data Block page:", dblock->dblk_page_nelmts); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Data Block size:", dblock->size); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of elements in Data Block:", hdr->cparam.nelmts); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Number of pages in Data Block:", dblock->npages); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "Number of elements per Data Block page:", dblock->dblk_page_nelmts); if (dblock->npages) { /* paging */ size_t dblk_page_nelmts; /* # of elements in a data block page */ haddr_t dblk_page_addr; /* Address of a data block page */ size_t page_idx; /* Page index within data block */ - HDfprintf(stream, "%*sPaging:\n", indent, ""); + fprintf(stream, "%*sPaging:\n", indent, ""); /* Iterate over the pages */ dblk_page_addr = dblock->addr + H5FA_DBLOCK_PREFIX_SIZE(dblock); @@ -215,7 +208,7 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Read and print each page's elements in the data block */ for (page_idx = 0; page_idx < dblock->npages; page_idx++) { if (!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { - HDfprintf(stream, "%*s%-*s %zu %s\n", indent, "", fwidth, "Page %zu:", page_idx, "empty"); + fprintf(stream, "%*s%-*s %zu %s\n", indent, "", fwidth, "Page %zu:", page_idx, "empty"); } /* end if */ else { /* get the page */ @@ -231,19 +224,19 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + (unsigned long long)dblk_page_addr); - HDfprintf(stream, "%*sElements in page %zu:\n", indent, "", page_idx); + fprintf(stream, "%*sElements in page %zu:\n", indent, "", page_idx); for (u = 0; u < dblk_page_nelmts; u++) { /* Call the class's 'debug' callback */ if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "can't get element for debugging") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "can't get element for debugging"); } /* end for */ if (H5FA__dblk_page_unprotect(dblk_page, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, - "unable to release fixed array data block page") + "unable to release fixed array data block page"); /* Advance to next page address */ dblk_page_addr += dblock->dblk_page_size; @@ -252,23 +245,23 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, } /* end if */ else { /* not paging */ /* Print the elements in the data block */ - HDfprintf(stream, "%*sElements:\n", indent, ""); + fprintf(stream, "%*sElements:\n", indent, ""); for (u = 0; u < hdr->cparam.nelmts; u++) { /* Call the class's 'debug' callback */ if ((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "can't get element for debugging") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "can't get element for debugging"); } /* end for */ } /* end else */ done: if (dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to release fixed array debugging context") + HDONE_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to release fixed array debugging context"); if (dblock && H5FA__dblock_unprotect(dblock, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block"); if (hdr && H5FA__hdr_unprotect(hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__dblock_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FAdblkpage.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FAdblkpage.c index e9482d7fe1..d51f31a869 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FAdblkpage.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FAdblkpage.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -79,9 +78,6 @@ H5FL_BLK_DEFINE(page_elmts); * * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ H5FA_dblk_page_t * @@ -93,16 +89,16 @@ H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(hdr); + assert(hdr); /* Allocate memory for the data block */ if (NULL == (dblk_page = H5FL_CALLOC(H5FA_dblk_page_t))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for fixed array data block page") + "memory allocation failed for fixed array data block page"); /* Share common array information */ if (H5FA__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header"); dblk_page->hdr = hdr; /* Set non-zero internal fields */ @@ -111,7 +107,7 @@ H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts) /* Allocate buffer for elements in data block page */ if (NULL == (dblk_page->elmts = H5FL_BLK_MALLOC(page_elmts, nelmts * hdr->cparam.cls->nat_elmt_size))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for data block page element buffer") + "memory allocation failed for data block page element buffer"); /* Set the return value */ ret_value = dblk_page; @@ -120,7 +116,7 @@ H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts) if (!ret_value) if (dblk_page && H5FA__dblk_page_dest(dblk_page) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block page") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block page"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__dblk_page_alloc() */ @@ -132,9 +128,6 @@ H5FA__dblk_page_alloc(H5FA_hdr_t *hdr, size_t nelmts) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -147,39 +140,39 @@ H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts) FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called, addr = %" PRIuHADDR "\n", __func__, addr); + fprintf(stderr, "%s: Called, addr = %" PRIuHADDR "\n", __func__, addr); #endif /* H5FA_DEBUG */ /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Allocate the data block page */ if (NULL == (dblk_page = H5FA__dblk_page_alloc(hdr, nelmts))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, FAIL, - "memory allocation failed for fixed array data block page") + "memory allocation failed for fixed array data block page"); /* Set info about data block page on disk */ dblk_page->addr = addr; dblk_page->size = H5FA_DBLK_PAGE_SIZE(hdr, nelmts); #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", __func__, dblk_page->size); + fprintf(stderr, "%s: dblk_page->size = %Zu\n", __func__, dblk_page->size); #endif /* H5FA_DEBUG */ /* Clear any elements in data block page to fill value */ if ((hdr->cparam.cls->fill)(dblk_page->elmts, nelmts) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, - "can't set fixed array data block page elements to class's fill value") + "can't set fixed array data block page elements to class's fill value"); /* Cache the new fixed array data block page */ if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, FAIL, "can't add fixed array data block page to cache") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, FAIL, "can't add fixed array data block page to cache"); inserted = TRUE; /* Add data block page as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, FAIL, - "unable to add fixed array entry as child of array proxy") + "unable to add fixed array entry as child of array proxy"); dblk_page->top_proxy = hdr->top_proxy; } /* end if */ @@ -190,11 +183,11 @@ H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts) if (inserted) if (H5AC_remove_entry(dblk_page) < 0) HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, FAIL, - "unable to remove fixed array data block page from cache") + "unable to remove fixed array data block page from cache"); /* Destroy data block page */ if (H5FA__dblk_page_dest(dblk_page) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "unable to destroy fixed array data block page") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, FAIL, "unable to destroy fixed array data block page"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -208,9 +201,6 @@ H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts) * * Return: Non-NULL pointer to data block page on success/NULL on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ H5FA_dblk_page_t * @@ -223,15 +213,15 @@ H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_pag FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called\n", __func__); + fprintf(stderr, "%s: Called\n", __func__); #endif /* H5FA_DEBUG */ /* Sanity check */ - HDassert(hdr); - HDassert(H5F_addr_defined(dblk_page_addr)); + assert(hdr); + assert(H5_addr_defined(dblk_page_addr)); /* only the H5AC__READ_ONLY_FLAG is permitted */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up user data */ udata.hdr = hdr; @@ -243,14 +233,14 @@ H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_pag &udata, flags))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to protect fixed array data block page, address = %llu", - (unsigned long long)dblk_page_addr) + (unsigned long long)dblk_page_addr); /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == dblk_page->top_proxy) { /* Add data block page as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblk_page) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL, - "unable to add fixed array entry as child of array proxy") + "unable to add fixed array entry as child of array proxy"); dblk_page->top_proxy = hdr->top_proxy; } /* end if */ @@ -266,7 +256,7 @@ H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_pag H5AC_unprotect(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, NULL, "unable to unprotect fixed array data block page, address = %llu", - (unsigned long long)dblk_page->addr) + (unsigned long long)dblk_page->addr); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -280,9 +270,6 @@ H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_pag * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -293,17 +280,17 @@ H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags) FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called\n", __func__); + fprintf(stderr, "%s: Called\n", __func__); #endif /* H5FA_DEBUG */ /* Sanity check */ - HDassert(dblk_page); + assert(dblk_page); /* Unprotect the data block page */ if (H5AC_unprotect(dblk_page->hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page->addr, dblk_page, cache_flags) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to unprotect fixed array data block page, address = %llu", - (unsigned long long)dblk_page->addr) + (unsigned long long)dblk_page->addr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -316,9 +303,6 @@ H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -329,7 +313,7 @@ H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblk_page); + assert(dblk_page); /* Check if header field has been initialized */ if (dblk_page->hdr) { @@ -342,12 +326,12 @@ H5FA__dblk_page_dest(H5FA_dblk_page_t *dblk_page) /* Decrement reference count on shared info */ if (H5FA__hdr_decr(dblk_page->hdr) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared array header") + "can't decrement reference count on shared array header"); dblk_page->hdr = NULL; } /* end if */ /* Sanity check */ - HDassert(NULL == dblk_page->top_proxy); + assert(NULL == dblk_page->top_proxy); /* Free the data block page itself */ dblk_page = H5FL_FREE(H5FA_dblk_page_t, dblk_page); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FAdblock.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FAdblock.c index dabd51358a..e8cff4fdfc 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FAdblock.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FAdblock.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -83,9 +82,6 @@ H5FL_BLK_DEFINE(fa_page_init); * * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ H5FA_dblock_t * @@ -97,16 +93,16 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(hdr); - HDassert(hdr->cparam.nelmts > 0); + assert(hdr); + assert(hdr->cparam.nelmts > 0); /* Allocate memory for the data block */ if (NULL == (dblock = H5FL_CALLOC(H5FA_dblock_t))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array data block") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for fixed array data block"); /* Share common array information */ if (H5FA__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINC, NULL, "can't increment reference count on shared array header"); dblock->hdr = hdr; /* Set non-zero internal fields */ @@ -121,15 +117,15 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr) H5_CHECKED_ASSIGN(dblock->npages, size_t, npages, hsize_t); /* Sanity check that we have at least 1 page */ - HDassert(dblock->npages > 0); + assert(dblock->npages > 0); /* Compute size of 'page init' flag array, in bytes */ dblock->dblk_page_init_size = (dblock->npages + 7) / 8; - HDassert(dblock->dblk_page_init_size > 0); + assert(dblock->dblk_page_init_size > 0); /* Allocate space for 'page init' flags */ if (NULL == (dblock->dblk_page_init = H5FL_BLK_CALLOC(fa_page_init, dblock->dblk_page_init_size))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for page init bitmask") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for page init bitmask"); /* Compute data block page size */ dblock->dblk_page_size = (dblock->dblk_page_nelmts * hdr->cparam.raw_elmt_size) + H5FA_SIZEOF_CHKSUM; @@ -147,7 +143,7 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr) H5_CHECK_OVERFLOW(dblk_size, /* From: */ hsize_t, /* To: */ size_t); if (NULL == (dblock->elmts = H5FL_BLK_MALLOC(chunk_elmts, (size_t)dblk_size))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, - "memory allocation failed for data block element buffer") + "memory allocation failed for data block element buffer"); } /* end else */ /* Set the return value */ @@ -156,7 +152,7 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr) done: if (!ret_value) if (dblock && H5FA__dblock_dest(dblock) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array data block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__dblock_alloc() */ @@ -168,9 +164,6 @@ H5FA__dblock_alloc(H5FA_hdr_t *hdr) * * Return: Valid file address on success/HADDR_UNDEF on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ haddr_t @@ -184,13 +177,13 @@ H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(hdr_dirty); + assert(hdr); + assert(hdr_dirty); /* Allocate the data block */ if (NULL == (dblock = H5FA__dblock_alloc(hdr))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "memory allocation failed for fixed array data block") + "memory allocation failed for fixed array data block"); /* Set size of data block on disk */ hdr->stats.dblk_size = dblock->size = H5FA_DBLOCK_SIZE(dblock); @@ -198,7 +191,7 @@ H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty) /* Allocate space for the data block on disk */ if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FARRAY_DBLOCK, (hsize_t)dblock->size))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "file allocation failed for fixed array data block") + "file allocation failed for fixed array data block"); dblock->addr = dblock_addr; /* Don't initialize elements if paged */ @@ -206,18 +199,18 @@ H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty) /* Clear any elements in data block to fill value */ if ((hdr->cparam.cls->fill)(dblock->elmts, (size_t)hdr->cparam.nelmts) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF, - "can't set fixed array data block elements to class's fill value") + "can't set fixed array data block elements to class's fill value"); /* Cache the new fixed array data block */ if (H5AC_insert_entry(hdr->f, H5AC_FARRAY_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add fixed array data block to cache") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add fixed array data block to cache"); inserted = TRUE; /* Add data block as child of 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF, - "unable to add fixed array entry as child of array proxy") + "unable to add fixed array entry as child of array proxy"); dblock->top_proxy = hdr->top_proxy; } /* end if */ @@ -229,22 +222,24 @@ H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty) done: - if (!H5F_addr_defined(ret_value)) + if (!H5_addr_defined(ret_value)) if (dblock) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(dblock) < 0) HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, HADDR_UNDEF, - "unable to remove fixed array data block from cache") + "unable to remove fixed array data block from cache"); /* Release data block's disk space */ - if (H5F_addr_defined(dblock->addr) && + if (H5_addr_defined(dblock->addr) && H5MF_xfree(hdr->f, H5FD_MEM_FARRAY_DBLOCK, dblock->addr, (hsize_t)dblock->size) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to release fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, + "unable to release fixed array data block"); /* Destroy data block */ if (H5FA__dblock_dest(dblock) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, + "unable to destroy fixed array data block"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -257,9 +252,6 @@ H5FA__dblock_create(H5FA_hdr_t *hdr, hbool_t *hdr_dirty) * * Return: Non-NULL pointer to data block on success/NULL on failure * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ H5FA_dblock_t * @@ -272,11 +264,11 @@ H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(H5F_addr_defined(dblk_addr)); + assert(hdr); + assert(H5_addr_defined(dblk_addr)); /* only the H5AC__READ_ONLY_FLAG flag is permitted */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up user data */ udata.hdr = hdr; @@ -286,14 +278,15 @@ H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags) if (NULL == (dblock = (H5FA_dblock_t *)H5AC_protect(hdr->f, H5AC_FARRAY_DBLOCK, dblk_addr, &udata, flags))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, - "unable to protect fixed array data block, address = %llu", (unsigned long long)dblk_addr) + "unable to protect fixed array data block, address = %llu", + (unsigned long long)dblk_addr); /* Create top proxy, if it doesn't exist */ if (hdr->top_proxy && NULL == dblock->top_proxy) { /* Add data block as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, hdr->f, dblock) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL, - "unable to add fixed array entry as child of array proxy") + "unable to add fixed array entry as child of array proxy"); dblock->top_proxy = hdr->top_proxy; } /* end if */ @@ -320,9 +313,6 @@ H5FA__dblock_protect(H5FA_hdr_t *hdr, haddr_t dblk_addr, unsigned flags) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -333,13 +323,13 @@ H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblock); + assert(dblock); /* Unprotect the data block */ if (H5AC_unprotect(dblock->hdr->f, H5AC_FARRAY_DBLOCK, dblock->addr, dblock, cache_flags) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to unprotect fixed array data block, address = %llu", - (unsigned long long)dblock->addr) + (unsigned long long)dblock->addr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -352,9 +342,6 @@ H5FA__dblock_unprotect(H5FA_dblock_t *dblock, unsigned cache_flags) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -366,13 +353,14 @@ H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(H5F_addr_defined(dblk_addr)); + assert(hdr); + assert(H5_addr_defined(dblk_addr)); /* Protect data block */ if (NULL == (dblock = H5FA__dblock_protect(hdr, dblk_addr, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, FAIL, - "unable to protect fixed array data block, address = %llu", (unsigned long long)dblk_addr) + "unable to protect fixed array data block, address = %llu", + (unsigned long long)dblk_addr); /* Check if data block is paged */ if (dblock->npages) { @@ -388,7 +376,7 @@ H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr) /* (OK to call if it doesn't exist in the cache) */ if (H5AC_expunge_entry(hdr->f, H5AC_FARRAY_DBLK_PAGE, dblk_page_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTEXPUNGE, FAIL, - "unable to remove array data block page from metadata cache") + "unable to remove array data block page from metadata cache"); /* Advance to next page address */ dblk_page_addr += dblock->dblk_page_size; @@ -399,7 +387,7 @@ H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr) /* Finished deleting data block in metadata cache */ if (dblock && H5FA__dblock_unprotect(dblock, H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array data block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__dblock_delete() */ @@ -411,9 +399,6 @@ H5FA__dblock_delete(H5FA_hdr_t *hdr, haddr_t dblk_addr) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -424,21 +409,21 @@ H5FA__dblock_dest(H5FA_dblock_t *dblock) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblock); + assert(dblock); /* Check if shared header field has been initialized */ if (dblock->hdr) { /* Check if we've got elements in the data block */ if (dblock->elmts && !dblock->npages) { /* Free buffer for data block elements */ - HDassert(dblock->hdr->cparam.nelmts > 0); + assert(dblock->hdr->cparam.nelmts > 0); dblock->elmts = H5FL_BLK_FREE(chunk_elmts, dblock->elmts); } /* end if */ /* Check if data block is paged */ if (dblock->npages) { /* Free buffer for 'page init' bitmask, if there is one */ - HDassert(dblock->dblk_page_init_size > 0); + assert(dblock->dblk_page_init_size > 0); if (dblock->dblk_page_init) dblock->dblk_page_init = H5FL_BLK_FREE(fa_page_init, dblock->dblk_page_init); } /* end if */ @@ -446,12 +431,12 @@ H5FA__dblock_dest(H5FA_dblock_t *dblock) /* Decrement reference count on shared info */ if (H5FA__hdr_decr(dblock->hdr) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared array header") + "can't decrement reference count on shared array header"); dblock->hdr = NULL; } /* end if */ /* Sanity check */ - HDassert(NULL == dblock->top_proxy); + assert(NULL == dblock->top_proxy); /* Free the data block itself */ dblock = H5FL_FREE(H5FA_dblock_t, dblock); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FAhdr.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FAhdr.c index e1b3983d68..37d3e39de8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FAhdr.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FAhdr.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -77,9 +76,6 @@ H5FL_DEFINE_STATIC(H5FA_hdr_t); * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ H5FA_hdr_t * @@ -91,11 +87,12 @@ H5FA__hdr_alloc(H5F_t *f) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); + assert(f); /* Allocate space for the shared information */ if (NULL == (hdr = H5FL_CALLOC(H5FA_hdr_t))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "memory allocation failed for Fixed Array shared header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, + "memory allocation failed for Fixed Array shared header"); /* Set non-zero internal fields */ hdr->addr = HADDR_UNDEF; @@ -112,7 +109,7 @@ H5FA__hdr_alloc(H5F_t *f) done: if (!ret_value) if (hdr && H5FA__hdr_dest(hdr) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, NULL, "unable to destroy fixed array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__hdr_alloc() */ @@ -123,9 +120,6 @@ H5FA__hdr_alloc(H5F_t *f) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sunday, November 15, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -136,7 +130,7 @@ H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(hdr); + assert(hdr); /* Set size of header on disk (locally and in statistics) */ hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE_HDR(hdr); @@ -148,7 +142,7 @@ H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata) if (hdr->cparam.cls->crt_context) if (NULL == (hdr->cb_ctx = (*hdr->cparam.cls->crt_context)(ctx_udata))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, FAIL, - "unable to create fixed array client callback context") + "unable to create fixed array client callback context"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -162,9 +156,6 @@ H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata) * Return: Success: Address of new header in the file * Failure: HADDR_UNDEF * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ haddr_t @@ -177,26 +168,26 @@ H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(cparam); + assert(f); + assert(cparam); #ifndef NDEBUG { /* Check for valid parameters */ if (cparam->raw_elmt_size == 0) - HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "element size must be greater than zero") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "element size must be greater than zero"); if (cparam->max_dblk_page_nelmts_bits == 0) HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, - "max. # of elements bits must be greater than zero") + "max. # of elements bits must be greater than zero"); if (cparam->nelmts == 0) - HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "# of elements must be greater than zero") + HGOTO_ERROR(H5E_FARRAY, H5E_BADVALUE, HADDR_UNDEF, "# of elements must be greater than zero"); } #endif /* NDEBUG */ /* Allocate space for the shared information */ if (NULL == (hdr = H5FA__hdr_alloc(f))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, - "memory allocation failed for Fixed Array shared header") + "memory allocation failed for Fixed Array shared header"); hdr->dblk_addr = HADDR_UNDEF; @@ -205,48 +196,48 @@ H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) /* Finish initializing fixed array header */ if (H5FA__hdr_init(hdr, ctx_udata) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, HADDR_UNDEF, "initialization failed for fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINIT, HADDR_UNDEF, "initialization failed for fixed array header"); /* Allocate space for the header on disk */ if (HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_FARRAY_HDR, (hsize_t)hdr->size))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for Fixed Array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for Fixed Array header"); /* Create 'top' proxy for extensible array entries */ if (hdr->swmr_write) if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create fixed array entry proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, HADDR_UNDEF, "can't create fixed array entry proxy"); /* Cache the new Fixed Array header */ if (H5AC_insert_entry(f, H5AC_FARRAY_HDR, hdr->addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add fixed array header to cache") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTINSERT, HADDR_UNDEF, "can't add fixed array header to cache"); inserted = TRUE; /* Add header as child of 'top' proxy */ if (hdr->top_proxy) if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, HADDR_UNDEF, - "unable to add fixed array entry as child of array proxy") + "unable to add fixed array entry as child of array proxy"); /* Set address of array header to return */ ret_value = hdr->addr; done: - if (!H5F_addr_defined(ret_value)) + if (!H5_addr_defined(ret_value)) if (hdr) { /* Remove from cache, if inserted */ if (inserted) if (H5AC_remove_entry(hdr) < 0) HDONE_ERROR(H5E_FARRAY, H5E_CANTREMOVE, HADDR_UNDEF, - "unable to remove fixed array header from cache") + "unable to remove fixed array header from cache"); /* Release header's disk space */ - if (H5F_addr_defined(hdr->addr) && + if (H5_addr_defined(hdr->addr) && H5MF_xfree(f, H5FD_MEM_FARRAY_HDR, hdr->addr, (hsize_t)hdr->size) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to free Fixed Array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to free Fixed Array header"); /* Destroy header */ if (H5FA__hdr_dest(hdr) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy Fixed Array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy Fixed Array header"); } FUNC_LEAVE_NOAPI(ret_value) @@ -259,9 +250,6 @@ H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -272,12 +260,12 @@ H5FA__hdr_incr(H5FA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Mark header as un-evictable when something is depending on it */ if (hdr->rc == 0) if (H5AC_pin_protected_entry(hdr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTPIN, FAIL, "unable to pin fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTPIN, FAIL, "unable to pin fixed array header"); /* Increment reference count on shared header */ hdr->rc++; @@ -293,9 +281,6 @@ H5FA__hdr_incr(H5FA_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -306,17 +291,17 @@ H5FA__hdr_decr(H5FA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(hdr->rc); + assert(hdr); + assert(hdr->rc); /* Decrement reference count on shared header */ hdr->rc--; /* Mark header as evictable again when nothing depend on it */ if (hdr->rc == 0) { - HDassert(hdr->file_rc == 0); + assert(hdr->file_rc == 0); if (H5AC_unpin_entry(hdr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin fixed array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPIN, FAIL, "unable to unpin fixed array header"); } done: @@ -330,9 +315,6 @@ H5FA__hdr_decr(H5FA_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -341,7 +323,7 @@ H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Increment file reference count on shared header */ hdr->file_rc++; @@ -357,9 +339,6 @@ H5FA__hdr_fuse_incr(H5FA_hdr_t *hdr) * Return: Success: The reference count of the header * Failure: Can't fail * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ size_t @@ -370,8 +349,8 @@ H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(hdr); - HDassert(hdr->file_rc); + assert(hdr); + assert(hdr->file_rc); /* Decrement file reference count on shared header */ hdr->file_rc--; @@ -389,9 +368,6 @@ H5FA__hdr_fuse_decr(H5FA_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -402,11 +378,11 @@ H5FA__hdr_modified(H5FA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Mark header as dirty in cache */ if (H5AC_mark_entry_dirty(hdr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as dirty") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTMARKDIRTY, FAIL, "unable to mark fixed array header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -419,9 +395,6 @@ H5FA__hdr_modified(H5FA_hdr_t *hdr) * * Return: Non-NULL pointer to header on success/NULL on failure * - * Programmer: Quincey Koziol - * Aug 12 2013 - * *------------------------------------------------------------------------- */ H5FA_hdr_t * @@ -434,11 +407,11 @@ H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(H5F_addr_defined(fa_addr)); + assert(f); + assert(H5_addr_defined(fa_addr)); /* only the H5AC__READ_ONLY_FLAG is permitted */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up user data for cache callbacks */ udata.f = f; @@ -448,19 +421,19 @@ H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags) /* Protect the header */ if (NULL == (hdr = (H5FA_hdr_t *)H5AC_protect(f, H5AC_FARRAY_HDR, fa_addr, &udata, flags))) HGOTO_ERROR(H5E_FARRAY, H5E_CANTPROTECT, NULL, "unable to protect fixed array header, address = %llu", - (unsigned long long)fa_addr) + (unsigned long long)fa_addr); hdr->f = f; /* (Must be set again here, in case the header was already in the cache -QAK) */ /* Create top proxy, if it doesn't exist */ if (hdr->swmr_write && NULL == hdr->top_proxy) { /* Create 'top' proxy for fixed array entries */ if (NULL == (hdr->top_proxy = H5AC_proxy_entry_create())) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, NULL, "can't create fixed array entry proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTCREATE, NULL, "can't create fixed array entry proxy"); /* Add header as child of 'top' proxy */ if (H5AC_proxy_entry_add_child(hdr->top_proxy, f, hdr) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTSET, NULL, - "unable to add fixed array entry as child of array proxy") + "unable to add fixed array entry as child of array proxy"); } /* Set return value */ @@ -477,9 +450,6 @@ H5FA__hdr_protect(H5F_t *f, haddr_t fa_addr, void *ctx_udata, unsigned flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 12 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -490,12 +460,12 @@ H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Unprotect the header */ if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect fixed array hdr, address = %llu", (unsigned long long)hdr->addr) + "unable to unprotect fixed array hdr, address = %llu", (unsigned long long)hdr->addr); done: FUNC_LEAVE_NOAPI(ret_value) @@ -508,9 +478,6 @@ H5FA__hdr_unprotect(H5FA_hdr_t *hdr, unsigned cache_flags) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -522,8 +489,8 @@ H5FA__hdr_delete(H5FA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(!hdr->file_rc); + assert(hdr); + assert(!hdr->file_rc); #ifndef NDEBUG @@ -531,19 +498,19 @@ H5FA__hdr_delete(H5FA_hdr_t *hdr) /* Check the array header's status in the metadata cache */ if (H5AC_get_entry_status(hdr->f, hdr->addr, &hdr_status) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTGET, FAIL, "unable to check metadata cache status for array header"); /* Sanity checks on array header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PROTECTED); + assert(hdr_status & H5AC_ES__IN_CACHE); + assert(hdr_status & H5AC_ES__IS_PROTECTED); #endif /* NDEBUG */ /* Check for Fixed Array Data block */ - if (H5F_addr_defined(hdr->dblk_addr)) { + if (H5_addr_defined(hdr->dblk_addr)) { /* Delete Fixed Array Data block */ if (H5FA__dblock_delete(hdr, hdr->dblk_addr) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array data block") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDELETE, FAIL, "unable to delete fixed array data block"); } /* Set flags to finish deleting header on unprotect */ @@ -552,7 +519,7 @@ H5FA__hdr_delete(H5FA_hdr_t *hdr) done: /* Unprotect the header, deleting it if an error hasn't occurred */ if (H5AC_unprotect(hdr->f, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) - HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header") + HDONE_ERROR(H5E_FARRAY, H5E_CANTUNPROTECT, FAIL, "unable to release fixed array header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__hdr_delete() */ @@ -564,9 +531,6 @@ H5FA__hdr_delete(H5FA_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -577,21 +541,21 @@ H5FA__hdr_dest(H5FA_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(hdr); - HDassert(hdr->rc == 0); + assert(hdr); + assert(hdr->rc == 0); /* Destroy the callback context */ if (hdr->cb_ctx) { if ((*hdr->cparam.cls->dst_context)(hdr->cb_ctx) < 0) HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, - "unable to destroy fixed array client callback context") + "unable to destroy fixed array client callback context"); } hdr->cb_ctx = NULL; /* Destroy the 'top' proxy */ if (hdr->top_proxy) { if (H5AC_proxy_entry_dest(hdr->top_proxy) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to destroy fixed array 'top' proxy") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTRELEASE, FAIL, "unable to destroy fixed array 'top' proxy"); hdr->top_proxy = NULL; } diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FAint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FAint.c index 220690191b..f4070ee03a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FAint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FAint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5FAint.c - * Fall 2012 - * Dana Robinson * * Purpose: Internal routines for fixed arrays. * @@ -74,9 +71,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -87,12 +81,12 @@ H5FA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(parent_entry); - HDassert(child_entry); + assert(parent_entry); + assert(child_entry); /* Create a flush dependency between parent and child entry */ if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -105,9 +99,6 @@ H5FA__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -118,12 +109,12 @@ H5FA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(parent_entry); - HDassert(child_entry); + assert(parent_entry); + assert(child_entry); /* Destroy a flush dependency between parent and child entry */ if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FAstat.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FAstat.c index f7d1b907aa..4ea4177045 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FAstat.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FAstat.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -73,9 +72,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -84,12 +80,12 @@ H5FA_get_stats(const H5FA_t *fa, H5FA_stat_t *stats) FUNC_ENTER_NOAPI_NOERR #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called\n", __func__); + fprintf(stderr, "%s: Called\n", __func__); #endif /* H5FA_DEBUG */ /* Check arguments */ - HDassert(fa); - HDassert(stats); + assert(fa); + assert(stats); /* Copy fixed array statistics */ H5MM_memcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats)); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FAtest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FAtest.c index 9165bef381..abd9388c1a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FAtest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FAtest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -107,9 +106,6 @@ H5FL_DEFINE_STATIC(H5FA__test_ctx_t); * Return: Success: non-NULL * Failure: NULL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static void * @@ -122,7 +118,7 @@ H5FA__test_crt_context(void H5_ATTR_UNUSED *udata) /* Allocate new context structure */ if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context"); /* Initialize the context */ ctx->bogus = H5FA__TEST_BOGUS_VAL; @@ -141,9 +137,6 @@ H5FA__test_crt_context(void H5_ATTR_UNUSED *udata) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -154,7 +147,7 @@ H5FA__test_dst_context(void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus); + assert(H5FA__TEST_BOGUS_VAL == ctx->bogus); /* Release context structure */ ctx = H5FL_FREE(H5FA__test_ctx_t, ctx); @@ -169,9 +162,6 @@ H5FA__test_dst_context(void *_ctx) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -182,8 +172,8 @@ H5FA__test_fill(void *nat_blk, size_t nelmts) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(nat_blk); - HDassert(nelmts); + assert(nat_blk); + assert(nelmts); H5VM_array_fill(nat_blk, &fill_val, sizeof(uint64_t), nelmts); @@ -197,9 +187,6 @@ H5FA__test_fill(void *nat_blk, size_t nelmts) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -213,10 +200,10 @@ H5FA__test_encode(void *raw, const void *_elmt, size_t nelmts, void H5_ATTR_UNUS FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); - HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus); + assert(raw); + assert(elmt); + assert(nelmts); + assert(H5FA__TEST_BOGUS_VAL == ctx->bogus); /* Encode native elements into raw elements */ while (nelmts) { @@ -241,9 +228,6 @@ H5FA__test_encode(void *raw, const void *_elmt, size_t nelmts, void H5_ATTR_UNUS * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -258,10 +242,10 @@ H5FA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_UNU FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(raw); - HDassert(elmt); - HDassert(nelmts); - HDassert(H5FA__TEST_BOGUS_VAL == ctx->bogus); + assert(raw); + assert(elmt); + assert(nelmts); + assert(H5FA__TEST_BOGUS_VAL == ctx->bogus); /* Decode raw elements into native elements */ while (nelmts) { @@ -286,9 +270,6 @@ H5FA__test_decode(const void *_raw, void *_elmt, size_t nelmts, void H5_ATTR_UNU * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -299,13 +280,13 @@ H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void * FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(stream); - HDassert(elmt); + assert(stream); + assert(elmt); /* Print element */ HDsnprintf(temp_str, sizeof(temp_str), "Element #%llu:", (unsigned long long)idx); - HDfprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, - (unsigned long long)*(const uint64_t *)elmt); + fprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str, + (unsigned long long)*(const uint64_t *)elmt); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FA__test_debug() */ @@ -318,9 +299,6 @@ H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void * * Return: Success: non-NULL * Failure: NULL * - * Programmer: Quincey Koziol - * Tuesday, December 1, 2009 - * *------------------------------------------------------------------------- */ static void * @@ -333,7 +311,7 @@ H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_a /* Allocate new context structure */ if (NULL == (ctx = H5FL_MALLOC(H5FA__test_ctx_t))) - HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context") + HGOTO_ERROR(H5E_FARRAY, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context"); /* Initialize the context */ ctx->bogus = H5FA__TEST_BOGUS_VAL; @@ -342,7 +320,7 @@ H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_a ret_value = ctx; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FA__test_crt_dbg_context() */ /*------------------------------------------------------------------------- @@ -352,9 +330,6 @@ H5FA__test_crt_dbg_context(H5F_t H5_ATTR_UNUSED *f, haddr_t H5_ATTR_UNUSED obj_a * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -363,14 +338,14 @@ H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam) FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(fa); - HDassert(cparam); + assert(fa); + assert(cparam); /* Get fixed array creation parameters */ cparam->raw_elmt_size = fa->hdr->cparam.raw_elmt_size; cparam->nelmts = fa->hdr->cparam.nelmts; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FA__get_cparam_test() */ /*------------------------------------------------------------------------- @@ -380,9 +355,6 @@ H5FA__get_cparam_test(const H5FA_t *fa, H5FA_create_t *cparam) * * Return: An integer value like strcmp * - * Programmer: Vailin Choi - * Thursday, April 30, 2009 - * *------------------------------------------------------------------------- */ int @@ -393,8 +365,8 @@ H5FA__cmp_cparam_test(const H5FA_create_t *cparam1, const H5FA_create_t *cparam2 FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(cparam1); - HDassert(cparam2); + assert(cparam1); + assert(cparam2); /* Compare creation parameters for array */ if (cparam1->raw_elmt_size < cparam2->raw_elmt_size) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FD.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FD.c index 7b57166482..e2c32c6df1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FD.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FD.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -108,7 +107,7 @@ H5FD_init(void) FUNC_ENTER_NOAPI(FAIL) if (H5I_register_type(H5I_VFL_CLS) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize interface"); /* Reset the file serial numbers */ H5FD_file_serial_no_g = 0; @@ -170,7 +169,7 @@ H5FD__free_cls(H5FD_class_t *cls, void H5_ATTR_UNUSED **request) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(cls); + assert(cls); /* If the file driver has a terminate callback, call it to give the file * driver a chance to free singletons or other resources which will become @@ -178,7 +177,7 @@ H5FD__free_cls(H5FD_class_t *cls, void H5_ATTR_UNUSED **request) */ if (cls->terminate && cls->terminate() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEOBJ, FAIL, "virtual file driver '%s' did not terminate cleanly", - cls->name) + cls->name); H5MM_xfree(cls); @@ -213,27 +212,27 @@ H5FDregister(const H5FD_class_t *cls) /* Check arguments */ if (!cls) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null class pointer is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null class pointer is disallowed"); if (cls->version != H5FD_CLASS_VERSION) - HGOTO_ERROR(H5E_ARGS, H5E_VERSION, H5I_INVALID_HID, "wrong file driver version #") + HGOTO_ERROR(H5E_ARGS, H5E_VERSION, H5I_INVALID_HID, "wrong file driver version #"); if (!cls->open || !cls->close) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, - "'open' and/or 'close' methods are not defined") + "'open' and/or 'close' methods are not defined"); if (!cls->get_eoa || !cls->set_eoa) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, - "'get_eoa' and/or 'set_eoa' methods are not defined") + "'get_eoa' and/or 'set_eoa' methods are not defined"); if (!cls->get_eof) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eof' method is not defined") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "'get_eof' method is not defined"); if (!cls->read || !cls->write) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, - "'read' and/or 'write' method is not defined") + "'read' and/or 'write' method is not defined"); for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) if (cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid free-list mapping") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid free-list mapping"); /* Create the new class ID */ if ((ret_value = H5FD_register(cls, sizeof(H5FD_class_t), TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID"); done: FUNC_LEAVE_API(ret_value) @@ -266,24 +265,24 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref) FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Sanity checks */ - HDassert(cls); - HDassert(cls->open && cls->close); - HDassert(cls->get_eoa && cls->set_eoa); - HDassert(cls->get_eof); - HDassert(cls->read && cls->write); + assert(cls); + assert(cls->open && cls->close); + assert(cls->get_eoa && cls->set_eoa); + assert(cls->get_eof); + assert(cls->read && cls->write); for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { - HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES); + assert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES); } /* Copy the class structure so the caller can reuse or free it */ if (NULL == (saved = (H5FD_class_t *)H5MM_malloc(size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, - "memory allocation failed for file driver class struct") + "memory allocation failed for file driver class struct"); H5MM_memcpy(saved, cls, size); /* Create the new class ID */ if ((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file driver ID"); done: if (H5I_INVALID_HID == ret_value) @@ -315,7 +314,7 @@ H5FDis_driver_registered_by_name(const char *driver_name) /* Check if driver with this name is registered */ if ((ret_value = H5FD_is_driver_registered_by_name(driver_name, NULL)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFD is registered") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFD is registered"); done: FUNC_LEAVE_API(ret_value) @@ -343,7 +342,7 @@ H5FDis_driver_registered_by_value(H5FD_class_value_t driver_value) /* Check if driver with this value is registered */ if ((ret_value = H5FD_is_driver_registered_by_value(driver_value, NULL)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFD is registered") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFD is registered"); done: FUNC_LEAVE_API(ret_value) @@ -371,11 +370,11 @@ H5FDunregister(hid_t driver_id) /* Check arguments */ if (NULL == H5I_object_verify(driver_id, H5I_VFL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver"); /* The H5FD_class_t struct will be freed by this function */ if (H5I_dec_app_ref(driver_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "unable to unregister file driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "unable to unregister file driver"); done: FUNC_LEAVE_API(ret_value) @@ -412,17 +411,17 @@ H5FD_get_class(hid_t id) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, NULL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, NULL, "can't find object for ID"); if (TRUE == H5P_isa_class(id, H5P_FILE_ACCESS)) { H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info"); ret_value = H5FD_get_class(driver_prop.driver_id); } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id or file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a driver id or file access property list"); } /* end if */ done: @@ -450,8 +449,8 @@ H5FD_sb_size(H5FD_t *file) FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Dispatch to driver */ if (file->cls->sb_size) @@ -482,12 +481,12 @@ H5FD_sb_encode(H5FD_t *file, char *name /*out*/, uint8_t *buf) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Dispatch to driver */ if (file->cls->sb_encode && (file->cls->sb_encode)(file, name /*out*/, buf /*out*/) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_encode request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -510,12 +509,12 @@ H5FD__sb_decode(H5FD_t *file, const char *name, const uint8_t *buf) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Dispatch to driver */ if (file->cls->sb_decode && (file->cls->sb_decode)(file, name, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver sb_decode request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -538,20 +537,20 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Check if driver matches driver information saved. Unfortunately, we can't push this * function to each specific driver because we're checking if the driver is correct. */ if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family") != 0) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used"); if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi") != 0) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used"); /* Decode driver information */ if (H5FD__sb_decode(file, name, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode driver information") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode driver information"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -587,8 +586,8 @@ H5FD_fapl_get(H5FD_t *file) FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Dispatch to driver */ if (file->cls->fapl_get) @@ -618,14 +617,14 @@ H5FD_free_driver_info(hid_t driver_id, const void *driver_info) /* Retrieve the driver for the ID */ if (NULL == (driver = (H5FD_class_t *)H5I_object(driver_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID"); /* Allow driver to free info or do it ourselves */ if (driver->fapl_free) { /* Free the const pointer */ /* Cast through uintptr_t to de-const memory */ if ((driver->fapl_free)((void *)(uintptr_t)driver_info) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed"); } else driver_info = H5MM_xfree_const(driver_info); @@ -697,11 +696,11 @@ H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if (H5P_DEFAULT == fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); /* Call private function */ if (NULL == (ret_value = H5FD_open(name, flags, fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to open file"); done: FUNC_LEAVE_API(ret_value) @@ -733,41 +732,41 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Sanity checks */ if (0 == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "zero format address range"); /* Get file access property list */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); /* Get the VFD to open the file with */ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver ID & info"); /* Get driver info */ if (NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid driver ID in file access property list"); if (NULL == driver->open) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file driver has no `open' method"); /* Query driver flag */ if (H5FD_driver_query(driver, &driver_flags) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't query VFD flags") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't query VFD flags"); /* Get initial file image info */ if (H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file image info"); /* If an image is provided, make sure the driver supports this feature */ - HDassert(((file_image_info.buffer != NULL) && (file_image_info.size > 0)) || - ((file_image_info.buffer == NULL) && (file_image_info.size == 0))); + assert(((file_image_info.buffer != NULL) && (file_image_info.size > 0)) || + ((file_image_info.buffer == NULL) && (file_image_info.size == 0))); if ((file_image_info.buffer != NULL) && !(driver_flags & H5FD_FEAT_ALLOW_FILE_IMAGE)) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file image set, but not supported.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "file image set, but not supported."); /* Dispatch to file driver */ if (HADDR_UNDEF == maxaddr) maxaddr = driver->maxaddr; if (NULL == (file = (driver->open)(name, flags, fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "open failed"); /* Set the file access flags */ file->access_flags = flags; @@ -777,22 +776,22 @@ H5FD_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) */ file->driver_id = driver_prop.driver_id; if (H5I_inc_ref(file->driver_id, FALSE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver"); file->cls = driver; file->maxaddr = maxaddr; if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(file->threshold)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold"); if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &(file->alignment)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment"); /* Retrieve the VFL driver feature flags */ if (H5FD__query(file, &(file->feature_flags)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to query file driver"); /* Increment the global serial number & assign it to this H5FD_t object */ if (++H5FD_file_serial_no_g == 0) { /* (Just error out if we wrap around for now...) */ - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to get file serial number") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "unable to get file serial number"); } /* end if */ file->fileno = H5FD_file_serial_no_g; @@ -831,13 +830,13 @@ H5FDclose(H5FD_t *file) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); /* Call private function */ if (H5FD_close(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); done: FUNC_LEAVE_API(ret_value) @@ -861,20 +860,20 @@ H5FD_close(H5FD_t *file) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Prepare to close file by clearing all public fields */ driver = file->cls; if (H5I_dec_ref(file->driver_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") + HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID"); /* Dispatch to the driver for actual close. If the driver fails to * close the file then the file will be in an unusable state. */ - HDassert(driver->close); + assert(driver->close); if ((driver->close)(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "close failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "close failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -930,26 +929,26 @@ H5FD_cmp(const H5FD_t *f1, const H5FD_t *f2) { int ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_NOERR; /* return value is arbitrary */ + FUNC_ENTER_NOAPI_NOERR /* return value is arbitrary */ if ((!f1 || !f1->cls) && (!f2 || !f2->cls)) - HGOTO_DONE(0) + HGOTO_DONE(0); if (!f1 || !f1->cls) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (!f2 || !f2->cls) - HGOTO_DONE(1) + HGOTO_DONE(1); if (f1->cls < f2->cls) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->cls > f2->cls) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Files are same driver; no cmp callback */ if (!f1->cls->cmp) { if (f1 < f2) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1 > f2) - HGOTO_DONE(1) - HGOTO_DONE(0) + HGOTO_DONE(1); + HGOTO_DONE(0); } /* Dispatch to driver */ @@ -979,15 +978,15 @@ H5FDquery(const H5FD_t *file, unsigned long *flags /*out*/) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "file class pointer cannot be NULL"); if (!flags) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "flags parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "flags parameter cannot be NULL"); /* Call private function */ if (H5FD__query(file, flags) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "unable to query feature flags") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, (-1), "unable to query feature flags"); done: FUNC_LEAVE_API(ret_value) @@ -1010,14 +1009,14 @@ H5FD__query(const H5FD_t *file, unsigned long *flags /*out*/) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert(flags); + assert(file); + assert(file->cls); + assert(flags); /* Dispatch to driver (if available) */ if (file->cls->query) { if ((file->cls->query)(file, flags) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to query feature flags") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to query feature flags"); } else *flags = 0; @@ -1072,24 +1071,24 @@ H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL"); if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid request type"); if (size == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "zero-size request"); if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "not a data transfer property list"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); /* Call private function */ if (HADDR_UNDEF == (ret_value = H5FD__alloc_real(file, type, size, NULL, NULL))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file memory"); /* (Note compensating for base address subtraction in internal routine) */ ret_value += file->base_addr; @@ -1122,15 +1121,15 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request type"); if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -1138,7 +1137,7 @@ H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t siz /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if (H5FD__free_real(file, type, addr - file->base_addr, size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "file deallocation request failed"); done: FUNC_LEAVE_API(ret_value) @@ -1165,15 +1164,15 @@ H5FDget_eoa(H5FD_t *file, H5FD_mem_t type) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL"); if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "invalid file type"); /* Call private function */ if (HADDR_UNDEF == (ret_value = H5FD_get_eoa(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eoa request failed"); /* (Note compensating for base address subtraction in internal routine) */ ret_value += file->base_addr; @@ -1213,18 +1212,18 @@ H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if (type < H5FD_MEM_DEFAULT || type >= H5FD_MEM_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file type") - if (!H5F_addr_defined(addr) || addr > file->maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file type"); + if (!H5_addr_defined(addr) || addr > file->maxaddr) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid end-of-address value"); /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if (H5FD_set_eoa(file, type, addr - file->base_addr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "file set eoa request failed"); done: FUNC_LEAVE_API(ret_value) @@ -1261,13 +1260,13 @@ H5FDget_eof(H5FD_t *file, H5FD_mem_t type) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, HADDR_UNDEF, "file class pointer cannot be NULL"); /* Call private function */ if (HADDR_UNDEF == (ret_value = H5FD_get_eof(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "file get eof request failed"); /* (Note compensating for base address subtraction in internal routine) */ ret_value += file->base_addr; @@ -1294,7 +1293,7 @@ H5FD_get_maxaddr(const H5FD_t *file) FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(file); + assert(file); /* Set return value */ ret_value = file->maxaddr; @@ -1317,8 +1316,8 @@ H5FD_get_feature_flags(const H5FD_t *file, unsigned long *feature_flags) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(file); - HDassert(feature_flags); + assert(file); + assert(feature_flags); /* Set feature flags to return */ *feature_flags = file->feature_flags; @@ -1341,7 +1340,7 @@ H5FD_set_feature_flags(H5FD_t *file, unsigned long feature_flags) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(file); + assert(file); /* Set the file's feature flags */ file->feature_flags = feature_flags; @@ -1366,15 +1365,15 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert(type_map); + assert(file); + assert(file->cls); + assert(type_map); /* Check for VFD class providing a type map retrieval routine */ if (file->cls->get_type_map) { /* Retrieve type mapping for this file */ if ((file->cls->get_type_map)(file, type_map) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get type map failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get type map failed"); } /* end if */ else /* Copy class's default free space type mapping */ @@ -1411,17 +1410,17 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if (!buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -1429,7 +1428,7 @@ H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if (H5FD_read(file, type, addr - file->base_addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file read request failed"); done: FUNC_LEAVE_API(ret_value) @@ -1457,17 +1456,17 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if (!buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "result buffer parameter can't be NULL"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -1475,7 +1474,7 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if (H5FD_write(file, type, addr - file->base_addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file write request failed"); done: FUNC_LEAVE_API(ret_value) @@ -1500,10 +1499,6 @@ H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t siz * Failure: FAIL * The contents of supplied buffers are undefined. * - * Programmer: JRM -- 6/10/20 - * - * Changes: None. - * *------------------------------------------------------------------------- */ herr_t @@ -1517,28 +1512,28 @@ H5FDread_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[], /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if ((!types) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "types parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "types parameter can't be NULL if count is positive"); if ((!addrs) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addrs parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addrs parameter can't be NULL if count is positive"); if ((!sizes) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes parameter can't be NULL if count is positive"); if ((!bufs) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive"); if ((count > 0) && (sizes[0] == 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0"); if ((count > 0) && (types[0] == H5FD_MEM_NOLIST)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "count[0] can't be H5FD_MEM_NOLIST") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "count[0] can't be H5FD_MEM_NOLIST"); /* Get the default dataset transfer property list if the user * didn't provide one @@ -1548,7 +1543,7 @@ H5FDread_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[], } else { if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); } /* Set DXPL for operation */ @@ -1557,7 +1552,7 @@ H5FDread_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[], /* Call private function */ /* (Note compensating for base addresses addition in internal routine) */ if (H5FD_read_vector(file, count, types, addrs, sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file vector read request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file vector read request failed"); done: FUNC_LEAVE_API(ret_value) @@ -1580,10 +1575,6 @@ H5FDread_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[], * Failure: FAIL * One or more of the writes failed. * - * Programmer: JRM -- 6/10/20 - * - * Changes: None. - * *------------------------------------------------------------------------- */ herr_t @@ -1597,28 +1588,28 @@ H5FDwrite_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[] /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if ((!types) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "types parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "types parameter can't be NULL if count is positive"); if ((!addrs) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addrs parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addrs parameter can't be NULL if count is positive"); if ((!sizes) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes parameter can't be NULL if count is positive"); if ((!bufs) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive"); if ((count > 0) && (sizes[0] == 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0"); if ((count > 0) && (types[0] == H5FD_MEM_NOLIST)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "count[0] can't be H5FD_MEM_NOLIST") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "count[0] can't be H5FD_MEM_NOLIST"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) { @@ -1626,7 +1617,7 @@ H5FDwrite_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[] } else { if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); } /* Set DXPL for operation */ @@ -1635,7 +1626,7 @@ H5FDwrite_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[] /* Call private function */ /* (Note compensating for base address addition in internal routine) */ if (H5FD_write_vector(file, count, types, addrs, sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file vector write request failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file vector write request failed"); done: FUNC_LEAVE_API(ret_value) @@ -1677,10 +1668,6 @@ H5FDwrite_vector(H5FD_t *file, hid_t dxpl_id, uint32_t count, H5FD_mem_t types[] * Failure: FAIL * The contents of supplied buffers are undefined. * - * Programmer: NAF -- 5/19/21 - * - * Changes: None. - * *------------------------------------------------------------------------- */ herr_t @@ -1695,32 +1682,32 @@ H5FDread_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if ((!mem_space_ids) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_spaces parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_spaces parameter can't be NULL if count is positive"); if ((!file_space_ids) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_spaces parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_spaces parameter can't be NULL if count is positive"); if ((!offsets) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offsets parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offsets parameter can't be NULL if count is positive"); if ((!element_sizes) && (count > 0)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "element_sizes parameter can't be NULL if count is positive") + "element_sizes parameter can't be NULL if count is positive"); if ((!bufs) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive"); if ((count > 0) && (element_sizes[0] == 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0"); if ((count > 0) && (bufs[0] == NULL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs[0] can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs[0] can't be NULL"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) { @@ -1728,7 +1715,7 @@ H5FDread_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, } else { if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); } /* Set DXPL for operation */ @@ -1736,9 +1723,9 @@ H5FDread_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, /* Call private function */ /* (Note compensating for base address addition in internal routine) */ - if (H5FD_read_selection_id(file, type, count, mem_space_ids, file_space_ids, offsets, element_sizes, - bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file selection read request failed") + if (H5FD_read_selection_id(SKIP_NO_CB, file, type, count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file selection read request failed"); done: FUNC_LEAVE_API(ret_value) @@ -1778,10 +1765,6 @@ H5FDread_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, * Failure: FAIL * One or more of the writes failed. * - * Programmer: NAF -- 5/14/21 - * - * Changes: None. - * *------------------------------------------------------------------------- */ herr_t @@ -1796,32 +1779,32 @@ H5FDwrite_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if ((!mem_space_ids) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_spaces parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_spaces parameter can't be NULL if count is positive"); if ((!file_space_ids) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_spaces parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_spaces parameter can't be NULL if count is positive"); if ((!offsets) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offsets parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offsets parameter can't be NULL if count is positive"); if ((!element_sizes) && (count > 0)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "element_sizes parameter can't be NULL if count is positive") + "element_sizes parameter can't be NULL if count is positive"); if ((!bufs) && (count > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive"); if ((count > 0) && (element_sizes[0] == 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0"); if ((count > 0) && (bufs[0] == NULL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs[0] can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs[0] can't be NULL"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) { @@ -1829,7 +1812,7 @@ H5FDwrite_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count } else { if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); } /* Set DXPL for operation */ @@ -1837,14 +1820,408 @@ H5FDwrite_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count /* Call private function */ /* (Note compensating for base address addition in internal routine) */ - if (H5FD_write_selection_id(file, type, count, mem_space_ids, file_space_ids, offsets, element_sizes, - bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file selection write request failed") + + if (H5FD_write_selection_id(SKIP_NO_CB, file, type, count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file selection write request failed"); done: FUNC_LEAVE_API(ret_value) } /* end H5FDwrite_selection() */ +/*------------------------------------------------------------------------- + * Purpose: This is similar to H5FDread_selection() with the + * exception noted below. + * + * Perform count reads from the specified file at the + * locations selected in the dataspaces in the file_spaces + * array, with each of those dataspaces starting at the file + * address specified by the corresponding element of the + * offsets array, and with the size of each element in the + * dataspace specified by the corresponding element of the + * element_sizes array. The memory type provided by type is + * the same for all selections. Data read is returned in + * the locations selected in the dataspaces in the + * mem_spaces array, within the buffers provided in the + * corresponding elements of the bufs array. + * + * If i > 0 and element_sizes[i] == 0, presume + * element_sizes[n] = element_sizes[i-1] for all n >= i and + * < count. + * + * Note: + * It will skip selection read call whether the underlying VFD + * supports selection reads or not. + * + * It will translate the selection read to a vector read call + * if vector reads are supported, or a series of scalar read + * calls otherwise. + * + * All reads are done according to the data transfer property + * list dxpl_id (which may be the constant H5P_DEFAULT). + * + * Return: Success: SUCCEED + * All reads have completed successfully, and + * the results have been written into the supplied + * buffers. + * + * Failure: FAIL + * The contents of supplied buffers are undefined. + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDread_vector_from_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], + size_t element_sizes[], void *bufs[] /* out */) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE9("e", "*#MtiIu*i*i*a*zx", file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs); + + /* Check arguments */ + if (!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); + + if (!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); + + if ((!mem_space_ids) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_spaces parameter can't be NULL if count is positive"); + + if ((!file_space_ids) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_spaces parameter can't be NULL if count is positive"); + + if ((!offsets) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offsets parameter can't be NULL if count is positive"); + + if ((!element_sizes) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "element_sizes parameter can't be NULL if count is positive"); + + if ((!bufs) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive"); + + if ((count > 0) && (element_sizes[0] == 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0"); + + if ((count > 0) && (bufs[0] == NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs[0] can't be NULL"); + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) { + dxpl_id = H5P_DATASET_XFER_DEFAULT; + } + else { + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); + } + + /* Call private function */ + /* (Note compensating for base address addition in internal routine) */ + if (H5FD_read_vector_from_selection(file, type, count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file selection read request failed"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDread_vector_from_selection() */ + +/*------------------------------------------------------------------------- + * Purpose: This is similar to H5FDwrite_selection() with the + * exception noted below. + * + * Perform count writes to the specified file at the + * locations selected in the dataspaces in the file_spaces + * array, with each of those dataspaces starting at the file + * address specified by the corresponding element of the + * offsets array, and with the size of each element in the + * dataspace specified by the corresponding element of the + * element_sizes array. The memory type provided by type is + * the same for all selections. Data write is from + * the locations selected in the dataspaces in the + * mem_spaces array, within the buffers provided in the + * corresponding elements of the bufs array. + * + * If i > 0 and element_sizes[i] == 0, presume + * element_sizes[n] = element_sizes[i-1] for all n >= i and + * < count. + * + * Note: + * It will skip selection write call whether the underlying VFD + * supports selection writes or not. + * + * It will translate the selection write to a vector write call + * if vector writes are supported, or a series of scalar write + * calls otherwise. + * + * All writes are done according to the data transfer property + * list dxpl_id (which may be the constant H5P_DEFAULT). + * + * Return: Success: SUCCEED + * All writes have completed successfully + * + * Failure: FAIL + * One or more of the writes failed. + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDwrite_vector_from_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], + size_t element_sizes[], const void *bufs[]) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE9("e", "*#MtiIu*i*i*a*z**x", file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs); + + /* Check arguments */ + if (!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); + + if (!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); + + if ((!mem_space_ids) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_spaces parameter can't be NULL if count is positive"); + + if ((!file_space_ids) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_spaces parameter can't be NULL if count is positive"); + + if ((!offsets) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offsets parameter can't be NULL if count is positive"); + + if ((!element_sizes) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "element_sizes parameter can't be NULL if count is positive"); + + if ((!bufs) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive"); + + if ((count > 0) && (element_sizes[0] == 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0"); + + if ((count > 0) && (bufs[0] == NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs[0] can't be NULL"); + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) { + dxpl_id = H5P_DATASET_XFER_DEFAULT; + } + else { + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); + } + + /* Call private function */ + /* (Note compensating for base address addition in internal routine) */ + if (H5FD_write_vector_from_selection(file, type, count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file selection write request failed"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDwrite_vector_from_selection() */ + +/*------------------------------------------------------------------------- + * Purpose: This is similar to H5FDread_selection() with the + * exception noted below. + * + * Perform count reads from the specified file at the + * locations selected in the dataspaces in the file_spaces + * array, with each of those dataspaces starting at the file + * address specified by the corresponding element of the + * offsets array, and with the size of each element in the + * dataspace specified by the corresponding element of the + * element_sizes array. The memory type provided by type is + * the same for all selections. Data read is returned in + * the locations selected in the dataspaces in the + * mem_spaces array, within the buffers provided in the + * corresponding elements of the bufs array. + * + * If i > 0 and element_sizes[i] == 0, presume + * element_sizes[n] = element_sizes[i-1] for all n >= i and + * < count. + * + * Note: + * It will skip selection and vector read calls whether the underlying + * VFD supports selection and vector reads or not. + * + * It will translate the selection read to a series of + * scalar read calls. + * + * All reads are done according to the data transfer property + * list dxpl_id (which may be the constant H5P_DEFAULT). + * + * Return: Success: SUCCEED + * All reads have completed successfully, and + * the results have been written into the supplied + * buffers. + * + * Failure: FAIL + * The contents of supplied buffers are undefined. + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDread_from_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, hid_t mem_space_ids[], + hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], void *bufs[]) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE9("e", "*#MtiIu*i*i*a*z**x", file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs); + + /* Check arguments */ + if (!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); + + if (!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); + + if ((!mem_space_ids) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_spaces parameter can't be NULL if count is positive"); + + if ((!file_space_ids) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_spaces parameter can't be NULL if count is positive"); + + if ((!offsets) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offsets parameter can't be NULL if count is positive"); + + if ((!element_sizes) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "element_sizes parameter can't be NULL if count is positive"); + + if ((!bufs) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive"); + + if ((count > 0) && (element_sizes[0] == 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0"); + + if ((count > 0) && (bufs[0] == NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs[0] can't be NULL"); + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) { + dxpl_id = H5P_DATASET_XFER_DEFAULT; + } + else { + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); + } + + /* Call private function */ + /* (Note compensating for base address addition in internal routine) */ + if (H5FD_read_from_selection(file, type, count, mem_space_ids, file_space_ids, offsets, element_sizes, + bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file selection read request failed"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDread_from_selection() */ + +/*------------------------------------------------------------------------- + * Purpose: This is similar to H5FDwrite_selection() with the + * exception noted below. + * + * Perform count writes to the specified file at the + * locations selected in the dataspaces in the file_spaces + * array, with each of those dataspaces starting at the file + * address specified by the corresponding element of the + * offsets array, and with the size of each element in the + * dataspace specified by the corresponding element of the + * element_sizes array. The memory type provided by type is + * the same for all selections. Data write is from + * the locations selected in the dataspaces in the + * mem_spaces array, within the buffers provided in the + * corresponding elements of the bufs array. + * + * If i > 0 and element_sizes[i] == 0, presume + * element_sizes[n] = element_sizes[i-1] for all n >= i and + * < count. + * + * Note: + * It will skip selection and vector write calls whether the underlying + * VFD supports selection and vector writes or not. + * + * It will translate the selection write to a series of + * scalar write calls. + * + * All writes are done according to the data transfer property + * list dxpl_id (which may be the constant H5P_DEFAULT). + * + * Return: Success: SUCCEED + * All writes have completed successfully + * + * Failure: FAIL + * One or more of the writes failed. + * + *------------------------------------------------------------------------- + */ +herr_t +H5FDwrite_from_selection(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, hid_t mem_space_ids[], + hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], + const void *bufs[]) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE9("e", "*#MtiIu*i*i*a*z**x", file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs); + + /* Check arguments */ + if (!file) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); + + if (!file->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); + + if ((!mem_space_ids) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_spaces parameter can't be NULL if count is positive"); + + if ((!file_space_ids) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_spaces parameter can't be NULL if count is positive"); + + if ((!offsets) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offsets parameter can't be NULL if count is positive"); + + if ((!element_sizes) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "element_sizes parameter can't be NULL if count is positive"); + + if ((!bufs) && (count > 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs parameter can't be NULL if count is positive"); + + if ((count > 0) && (element_sizes[0] == 0)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sizes[0] can't be 0"); + + if ((count > 0) && (bufs[0] == NULL)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bufs[0] can't be NULL"); + + /* Get the default dataset transfer property list if the user didn't provide one */ + if (H5P_DEFAULT == dxpl_id) { + dxpl_id = H5P_DATASET_XFER_DEFAULT; + } + else { + if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); + } + + /* Call private function */ + /* (Note compensating for base address addition in internal routine) */ + if (H5FD_write_from_selection(file, type, count, mem_space_ids, file_space_ids, offsets, element_sizes, + bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file selection write request failed"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5FDwrite_from_selection() */ + /*------------------------------------------------------------------------- * Function: H5FDflush * @@ -1865,21 +2242,21 @@ H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); /* Call private function */ if (H5FD_flush(file, closing) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "file flush request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "file flush request failed"); done: FUNC_LEAVE_API(ret_value) @@ -1902,12 +2279,12 @@ H5FD_flush(H5FD_t *file, hbool_t closing) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Dispatch to driver */ if (file->cls->flush && (file->cls->flush)(file, H5CX_get_dxpl(), closing) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1932,20 +2309,20 @@ H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); /* Call private function */ if (H5FD_truncate(file, closing) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "file flush request failed"); done: FUNC_LEAVE_API(ret_value) @@ -1968,12 +2345,12 @@ H5FD_truncate(H5FD_t *file, hbool_t closing) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Dispatch to driver */ if (file->cls->truncate && (file->cls->truncate)(file, H5CX_get_dxpl(), closing) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver truncate request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "driver truncate request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1998,13 +2375,13 @@ H5FDlock(H5FD_t *file, hbool_t rw) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); /* Call private function */ if (H5FD_lock(file, rw) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "file lock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "file lock request failed"); done: FUNC_LEAVE_API(ret_value) @@ -2027,12 +2404,12 @@ H5FD_lock(H5FD_t *file, hbool_t rw) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Dispatch to driver */ if (file->cls->lock && (file->cls->lock)(file, rw) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "driver lock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "driver lock request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2057,13 +2434,13 @@ H5FDunlock(H5FD_t *file) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); /* Call private function */ if (H5FD_unlock(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "file unlock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "file unlock request failed"); done: FUNC_LEAVE_API(ret_value) @@ -2086,12 +2463,12 @@ H5FD_unlock(H5FD_t *file) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Dispatch to driver */ if (file->cls->unlock && (file->cls->unlock)(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "driver unlock request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "driver unlock request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2113,8 +2490,6 @@ H5FD_unlock(H5FD_t *file) * * Return: Non-negative on success/Negative on failure * - * Programmer: JRM -- 8/3/21 - * *------------------------------------------------------------------------- */ herr_t @@ -2127,10 +2502,10 @@ H5FDctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); /* Don't attempt to validate the op code. If appropriate, that will * be done by the underlying VFD callback, along with the input and @@ -2139,7 +2514,7 @@ H5FDctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void /* Call private function */ if (H5FD_ctl(file, op_code, flags, input, output) < 0) - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed"); done: @@ -2163,8 +2538,6 @@ H5FDctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void * * Return: Non-negative on success/Negative on failure * - * Programmer: JRM -- 8/3/21 - * *------------------------------------------------------------------------- */ herr_t @@ -2175,8 +2548,8 @@ H5FD_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); + assert(file); + assert(file->cls); /* Dispatch to driver if the ctl function exists. * @@ -2188,12 +2561,12 @@ H5FD_ctl(H5FD_t *file, uint64_t op_code, uint64_t flags, const void *input, void if ((file->cls->ctl)(file, op_code, flags, input, output) < 0) - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed"); } else if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) { HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, - "VFD ctl request failed (no ctl callback and fail if unknown flag is set)") + "VFD ctl request failed (no ctl callback and fail if unknown flag is set)"); } done: @@ -2219,8 +2592,8 @@ H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(file); - HDassert(filenum); + assert(file); + assert(filenum); /* Retrieve the file's serial number */ *filenum = file->fileno; @@ -2248,17 +2621,17 @@ H5FDget_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle /*out*/) /* Check arguments */ if (!file) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file pointer cannot be NULL"); if (!file->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file class pointer cannot be NULL"); if (FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fapl_id parameter is not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fapl_id parameter is not a file access property list"); if (!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle parameter cannot be NULL"); /* Call private function */ if (H5FD_get_vfd_handle(file, fapl_id, file_handle) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver"); done: if (FAIL == ret_value) { @@ -2286,15 +2659,15 @@ H5FD_get_vfd_handle(H5FD_t *file, hid_t fapl_id, void **file_handle) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert(file_handle); + assert(file); + assert(file->cls); + assert(file_handle); /* Dispatch to driver */ if (NULL == file->cls->get_handle) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `get_vfd_handle' method") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no `get_vfd_handle' method"); if ((file->cls->get_handle)(file, fapl_id, file_handle) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2315,8 +2688,8 @@ H5FD_set_base_addr(H5FD_t *file, haddr_t base_addr) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(file); - HDassert(H5F_addr_defined(base_addr)); + assert(file); + assert(H5_addr_defined(base_addr)); /* Set the file's base address */ file->base_addr = base_addr; @@ -2340,7 +2713,7 @@ H5FD_get_base_addr(const H5FD_t *file) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(file); + assert(file); /* Return the file's base address */ FUNC_LEAVE_NOAPI(file->base_addr) @@ -2361,7 +2734,7 @@ H5FD_set_paged_aggr(H5FD_t *file, hbool_t paged) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(file); + assert(file); /* Indicate whether paged aggregation for handling file space is enabled or not */ file->paged_aggr = paged; @@ -2392,13 +2765,13 @@ H5FDdriver_query(hid_t driver_id, unsigned long *flags /*out*/) /* Check arguments */ if (NULL == flags) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flags parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "flags parameter cannot be NULL"); /* Check for the driver to query and then query it */ if (NULL == (driver = (H5FD_class_t *)H5I_object_verify(driver_id, H5I_VFL))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a VFL ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a VFL ID"); if (H5FD_driver_query(driver, flags) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "driver flag query failed") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "driver flag query failed"); done: FUNC_LEAVE_API(ret_value) @@ -2423,16 +2796,16 @@ H5FDdelete(const char *filename, hid_t fapl_id) /* Check arguments */ if (!filename || !*filename) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified"); if (H5P_DEFAULT == fapl_id) fapl_id = H5P_FILE_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); /* Call private function */ if (H5FD_delete(filename, fapl_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDcore.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDcore.c index dd47e397aa..a48a31416f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDcore.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDcore.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Tuesday, August 10, 1999 - * * Purpose: A driver which stores the HDF5 data in main memory using * only the HDF5 public API. This driver is useful for fast * access to small, temporary hdf5 files. @@ -225,9 +221,9 @@ H5FD__core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) FUNC_ENTER_PACKAGE - HDassert(file); - HDassert(file->dirty_list); - HDassert(start <= end); + assert(file); + assert(file->dirty_list); + assert(start <= end); /* Adjust the dirty region to the nearest block boundaries */ if (start % file->bstore_page_size != 0) @@ -291,7 +287,7 @@ H5FD__core_add_dirty_region(H5FD_core_t *file, haddr_t start, haddr_t end) item->end = end; if (H5SL_insert(file->dirty_list, item, &item->start) < 0) HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, FAIL, "can't insert new dirty region: (%llu, %llu)\n", - (unsigned long long)start, (unsigned long long)end) + (unsigned long long)start, (unsigned long long)end); } /* end if */ else { /* Store the new item endpoint if it's bigger */ @@ -324,7 +320,7 @@ H5FD__core_destroy_dirty_list(H5FD_core_t *file) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); /* Destroy the list, including any remaining list elements */ if (file->dirty_list) { @@ -334,7 +330,7 @@ H5FD__core_destroy_dirty_list(H5FD_core_t *file) region = H5FL_FREE(H5FD_core_region_t, region); if (H5SL_close(file->dirty_list) < 0) - HGOTO_ERROR(H5E_SLIST, H5E_CLOSEERROR, FAIL, "can't close core vfd dirty list") + HGOTO_ERROR(H5E_SLIST, H5E_CLOSEERROR, FAIL, "can't close core vfd dirty list"); file->dirty_list = NULL; } /* end if */ @@ -362,12 +358,12 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); #ifndef H5_HAVE_PREADWRITE /* Seek to the correct location (if we don't have pwrite) */ if ((HDoff_t)addr != HDlseek(file->fd, (off_t)addr, SEEK_SET)) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "error seeking in backing store") + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "error seeking in backing store"); #endif /* H5_HAVE_PREADWRITE */ while (size > 0) { @@ -408,8 +404,8 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ - HDassert(bytes_wrote > 0); - HDassert((size_t)bytes_wrote <= size); + assert(bytes_wrote > 0); + assert((size_t)bytes_wrote <= size); size -= (size_t)bytes_wrote; ptr = (unsigned char *)ptr + bytes_wrote; @@ -455,9 +451,6 @@ H5FD__core_get_default_config(void) * Return: Success: The driver ID for the core driver * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ hid_t @@ -493,9 +486,6 @@ H5FD_core_init(void) * * Returns: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Friday, Jan 30, 2004 - * *--------------------------------------------------------------------------- */ static herr_t @@ -517,9 +507,6 @@ H5FD__core_term(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: Dana Robinson - * Tuesday, April 8, 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -535,18 +522,18 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size) /* The page size cannot be zero */ if (page_size == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page_size cannot be zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page_size cannot be zero"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID"); if (H5FD_CORE != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if (NULL == (old_fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) old_fa = H5FD__core_get_default_config(); /* Set VFD info values */ - HDmemset(&fa, 0, sizeof(H5FD_core_fapl_t)); + memset(&fa, 0, sizeof(H5FD_core_fapl_t)); fa.increment = old_fa->increment; fa.backing_store = old_fa->backing_store; fa.write_tracking = is_enabled; @@ -554,7 +541,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size) /* Set the property values & the driver for the FAPL */ if (H5P_set_driver(plist, H5FD_CORE, &fa, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver"); done: FUNC_LEAVE_API(ret_value) @@ -568,9 +555,6 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Dana Robinson - * Tuesday, April 8, 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -585,11 +569,11 @@ H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled /*out*/, size_t * /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID"); if (H5FD_CORE != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if (NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); /* Get values */ if (is_enabled) @@ -610,9 +594,6 @@ H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled /*out*/, size_t * * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, February 19, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -627,10 +608,10 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store) /* Check argument */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); /* Set VFD info values */ - HDmemset(&fa, 0, sizeof(H5FD_core_fapl_t)); + memset(&fa, 0, sizeof(H5FD_core_fapl_t)); fa.increment = increment; fa.backing_store = backing_store; fa.write_tracking = H5FD_CORE_WRITE_TRACKING_FLAG; @@ -638,7 +619,7 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store) /* Set the property values & the driver for the FAPL */ if (H5P_set_driver(plist, H5FD_CORE, &fa, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set core VFD as driver"); done: FUNC_LEAVE_API(ret_value) @@ -651,9 +632,6 @@ H5Pset_fapl_core(hid_t fapl_id, size_t increment, hbool_t backing_store) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Tuesday, August 10, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -667,11 +645,11 @@ H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_stor H5TRACE3("e", "ixx", fapl_id, increment, backing_store); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5FD_CORE != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if (NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); if (increment) *increment = fa->increment; @@ -690,9 +668,6 @@ H5Pget_fapl_core(hid_t fapl_id, size_t *increment /*out*/, hbool_t *backing_stor * Return: Success: Ptr to new file access properties. * Failure: NULL * - * Programmer: Robb Matzke - * Friday, August 13, 1999 - * *------------------------------------------------------------------------- */ static void * @@ -705,7 +680,7 @@ H5FD__core_fapl_get(H5FD_t *_file) FUNC_ENTER_PACKAGE if (NULL == (fa = (H5FD_core_fapl_t *)H5MM_calloc(sizeof(H5FD_core_fapl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); fa->increment = file->increment; fa->backing_store = (hbool_t)(file->fd >= 0); @@ -729,9 +704,6 @@ H5FD__core_fapl_get(H5FD_t *_file) * caller, which is always H5FD_open(). * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -753,14 +725,14 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); if (ADDR_OVERFLOW(maxaddr)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "maxaddr overflow") - HDassert(H5P_DEFAULT != fapl_id); + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "maxaddr overflow"); + assert(H5P_DEFAULT != fapl_id); if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); if (NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) fa = H5FD__core_get_default_config(); @@ -775,15 +747,15 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* Retrieve initial file image info */ if (H5P_peek(plist, H5F_ACS_FILE_IMAGE_INFO_NAME, &file_image_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial file image info"); /* If the file image exists and this is an open, make sure the file doesn't exist */ - HDassert(((file_image_info.buffer != NULL) && (file_image_info.size > 0)) || - ((file_image_info.buffer == NULL) && (file_image_info.size == 0))); - HDmemset(&sb, 0, sizeof(sb)); + assert(((file_image_info.buffer != NULL) && (file_image_info.size > 0)) || + ((file_image_info.buffer == NULL) && (file_image_info.size == 0))); + memset(&sb, 0, sizeof(sb)); if ((file_image_info.buffer != NULL) && !(H5F_ACC_CREAT & flags)) { if (HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW) >= 0) - HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file already exists") + HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file already exists"); /* If backing store is requested, create and stat the file * Note: We are forcing the O_CREAT flag here, even though this is @@ -791,7 +763,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr */ if (fa->backing_store) { if ((fd = HDopen(name, o_flags | O_CREAT, H5_POSIX_CREATE_MODE_RW)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file"); if (HDfstat(fd, &sb) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file") } /* end if */ @@ -801,14 +773,14 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr * on. */ else if (fa->backing_store || !(H5F_ACC_CREAT & flags)) { if ((fd = HDopen(name, o_flags, H5_POSIX_CREATE_MODE_RW)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file"); if (HDfstat(fd, &sb) < 0) HSYS_GOTO_ERROR(H5E_FILE, H5E_BADFILE, NULL, "unable to fstat file") } /* end if */ /* Create the new file struct */ if (NULL == (file = (H5FD_core_t *)H5MM_calloc(sizeof(H5FD_core_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct"); file->fd = fd; if (name && *name) file->name = H5MM_xstrdup(name); @@ -832,7 +804,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr else { /* Use the value in the property list */ if (H5P_get(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &file->ignore_disabled_file_locks) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property"); } if (fd >= 0) { @@ -840,10 +812,10 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr #ifdef H5_HAVE_WIN32_API file->hFile = (HANDLE)_get_osfhandle(fd); if (INVALID_HANDLE_VALUE == file->hFile) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file handle"); if (!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo)) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file information") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file information"); file->nFileIndexHigh = fileinfo.nFileIndexHigh; file->nFileIndexLow = fileinfo.nFileIndexLow; @@ -870,11 +842,11 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr if (file->fi_callbacks.image_malloc) { if (NULL == (file->mem = (unsigned char *)file->fi_callbacks.image_malloc( size, H5FD_FILE_IMAGE_OP_FILE_OPEN, file->fi_callbacks.udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "image malloc callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "image malloc callback failed"); } /* end if */ else { if (NULL == (file->mem = (unsigned char *)H5MM_malloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "unable to allocate memory block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "unable to allocate memory block"); } /* end else */ /* Set up data structures */ @@ -886,7 +858,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr if (file->mem != file->fi_callbacks.image_memcpy(file->mem, file_image_info.buffer, size, H5FD_FILE_IMAGE_OP_FILE_OPEN, file->fi_callbacks.udata)) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, NULL, "image_memcpy callback failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, NULL, "image_memcpy callback failed"); } /* end if */ else H5MM_memcpy(file->mem, file_image_info.buffer, size); @@ -938,8 +910,8 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr (unsigned long long)bytes_read, (unsigned long long)offset); } /* end if */ - HDassert(bytes_read >= 0); - HDassert((size_t)bytes_read <= size); + assert(bytes_read >= 0); + assert((size_t)bytes_read <= size); mem += bytes_read; size -= (size_t)bytes_read; @@ -994,9 +966,6 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1009,12 +978,12 @@ H5FD__core_close(H5FD_t *_file) /* Flush any changed buffers */ if (H5FD__core_flush(_file, (hid_t)-1, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush core vfd backing store") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush core vfd backing store"); /* Destroy the dirty region list */ if (file->dirty_list) if (H5FD__core_destroy_dirty_list(file) != SUCCEED) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free core vfd dirty region list") + HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free core vfd dirty region list"); /* Release resources */ if (file->fd >= 0) @@ -1026,12 +995,12 @@ H5FD__core_close(H5FD_t *_file) if (file->fi_callbacks.image_free) { if (file->fi_callbacks.image_free(file->mem, H5FD_FILE_IMAGE_OP_FILE_CLOSE, file->fi_callbacks.udata) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "image_free callback failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "image_free callback failed"); } /* end if */ else H5MM_xfree(file->mem); } /* end if */ - HDmemset(file, 0, sizeof(H5FD_core_t)); + memset(file, 0, sizeof(H5FD_core_t)); H5MM_xfree(file); done: @@ -1050,9 +1019,6 @@ H5FD__core_close(H5FD_t *_file) * Failure: never fails (arguments were checked by the * caller). * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static int @@ -1068,57 +1034,57 @@ H5FD__core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) /* Compare low level file information for backing store */ #ifdef H5_HAVE_WIN32_API if (f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->dwVolumeSerialNumber > f2->dwVolumeSerialNumber) - HGOTO_DONE(1) + HGOTO_DONE(1); if (f1->nFileIndexHigh < f2->nFileIndexHigh) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->nFileIndexHigh > f2->nFileIndexHigh) - HGOTO_DONE(1) + HGOTO_DONE(1); if (f1->nFileIndexLow < f2->nFileIndexLow) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->nFileIndexLow > f2->nFileIndexLow) - HGOTO_DONE(1) + HGOTO_DONE(1); #else #ifdef H5_DEV_T_IS_SCALAR if (f1->device < f2->device) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->device > f2->device) - HGOTO_DONE(1) + HGOTO_DONE(1); #else /* H5_DEV_T_IS_SCALAR */ /* If dev_t isn't a scalar value on this system, just use memcmp to * determine if the values are the same or not. The actual return value * shouldn't really matter... */ - if (HDmemcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0) - HGOTO_DONE(-1) - if (HDmemcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0) - HGOTO_DONE(1) + if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0) + HGOTO_DONE(-1); + if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0) + HGOTO_DONE(1); #endif /* H5_DEV_T_IS_SCALAR */ if (f1->inode < f2->inode) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->inode > f2->inode) - HGOTO_DONE(1) + HGOTO_DONE(1); #endif /*H5_HAVE_WIN32_API*/ } /* end if */ else { if (NULL == f1->name && NULL == f2->name) { if (f1 < f2) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1 > f2) - HGOTO_DONE(1) - HGOTO_DONE(0) + HGOTO_DONE(1); + HGOTO_DONE(0); } /* end if */ if (NULL == f1->name) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (NULL == f2->name) - HGOTO_DONE(1) + HGOTO_DONE(1); ret_value = HDstrcmp(f1->name, f2->name); } /* end else */ @@ -1135,9 +1101,6 @@ H5FD__core_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Tuesday, October 7, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1178,9 +1141,6 @@ H5FD__core_query(const H5FD_t *_file, unsigned long *flags /* out */) * * Return: The end-of-address marker. (Can't fail) * - * Programmer: Robb Matzke - * Monday, August 2, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1202,9 +1162,6 @@ H5FD__core_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1216,7 +1173,7 @@ H5FD__core_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_ENTER_PACKAGE if (ADDR_OVERFLOW(addr)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "address overflow") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "address overflow"); file->eoa = addr; @@ -1235,9 +1192,6 @@ H5FD__core_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) * the end of the "file", either the memory * or the HDF5 file. (Can't fail) * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1257,9 +1211,6 @@ H5FD__core_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Returns: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Sept. 16, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -1272,7 +1223,7 @@ H5FD__core_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) /* Check args */ if (!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); /* Check for non-default FAPL */ if (H5P_FILE_ACCESS_DEFAULT != fapl && H5P_DEFAULT != fapl) { @@ -1280,7 +1231,7 @@ H5FD__core_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) /* Get the FAPL */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl))) - HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, FAIL, "not a file access property list"); /* Check if private property for retrieving the backing store POSIX * file descriptor is set. (This should not be set except within the @@ -1291,7 +1242,7 @@ H5FD__core_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) /* Get property */ if (H5P_get(plist, H5F_ACS_WANT_POSIX_FD_NAME, &want_posix_fd) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get property of retrieving file descriptor") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get property of retrieving file descriptor"); /* If property is set, pass back the file descriptor instead of the memory address */ if (want_posix_fd) @@ -1320,9 +1271,6 @@ H5FD__core_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) * buffer BUF. * Failure: FAIL, Contents of buffer BUF are undefined. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1334,14 +1282,14 @@ H5FD__core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU FUNC_ENTER_PACKAGE - HDassert(file && file->pub.cls); - HDassert(buf); + assert(file && file->pub.cls); + assert(buf); /* Check for overflow conditions */ if (HADDR_UNDEF == addr) - HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed") + HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed"); if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed") + HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed"); /* Read the part which is before the EOF marker */ if (addr < file->eof) { @@ -1364,7 +1312,7 @@ H5FD__core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU /* Read zeros for the part which is after the EOF markers */ if (size > 0) - HDmemset(buf, 0, size); + memset(buf, 0, size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1379,9 +1327,6 @@ H5FD__core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1393,12 +1338,12 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN FUNC_ENTER_PACKAGE - HDassert(file && file->pub.cls); - HDassert(buf); + assert(file && file->pub.cls); + assert(buf); /* Check for overflow conditions */ if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed") + HGOTO_ERROR(H5E_IO, H5E_OVERFLOW, FAIL, "file address overflowed"); /* * Allocate more memory if necessary, careful of overflow. Also, if the @@ -1421,15 +1366,15 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN file->mem, new_eof, H5FD_FILE_IMAGE_OP_FILE_RESIZE, file->fi_callbacks.udata))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate memory block of %llu bytes with callback", - (unsigned long long)new_eof) + (unsigned long long)new_eof); } /* end if */ else { if (NULL == (x = (unsigned char *)H5MM_realloc(file->mem, new_eof))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "unable to allocate memory block of %llu bytes", (unsigned long long)new_eof) + "unable to allocate memory block of %llu bytes", (unsigned long long)new_eof); } /* end else */ - HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); + memset(x + file->eof, 0, (size_t)(new_eof - file->eof)); file->mem = x; file->eof = new_eof; @@ -1444,7 +1389,7 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN HGOTO_ERROR( H5E_VFL, H5E_CANTINSERT, FAIL, "unable to add core VFD dirty region during write call - addresses: start=%llu end=%llu", - (unsigned long long)start, (unsigned long long)end) + (unsigned long long)start, (unsigned long long)end); } /* Write from BUF to memory */ @@ -1465,9 +1410,6 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Friday, October 15, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1498,7 +1440,7 @@ H5FD__core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UN size = (size_t)((item->end - item->start) + 1); if (H5FD__core_write_to_bstore(file, item->start, size) != SUCCEED) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store"); } /* end if */ item = H5FL_FREE(H5FD_core_region_t, item); @@ -1508,7 +1450,7 @@ H5FD__core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UN /* Otherwise, write the entire file out at once */ else { if (H5FD__core_write_to_bstore(file, (haddr_t)0, (size_t)file->eof) != SUCCEED) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write to backing store"); } /* end else */ file->dirty = FALSE; @@ -1548,9 +1490,6 @@ H5FD__core_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_UN * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, October 7, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1562,7 +1501,7 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); /* if we are closing and not using backing store, do nothing */ if (!closing || file->backing_store) { @@ -1576,7 +1515,7 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing } /* end else */ /* Extend the file to make sure it's large enough */ - if (!H5F_addr_eq(file->eof, (haddr_t)new_eof)) { + if (!H5_addr_eq(file->eof, (haddr_t)new_eof)) { unsigned char *x; /* Pointer to new buffer for file data */ /* (Re)allocate memory for the file buffer, using callback if available */ @@ -1585,15 +1524,15 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing (x = (unsigned char *)file->fi_callbacks.image_realloc( file->mem, new_eof, H5FD_FILE_IMAGE_OP_FILE_RESIZE, file->fi_callbacks.udata))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "unable to allocate memory block with callback") + "unable to allocate memory block with callback"); } /* end if */ else { if (NULL == (x = (unsigned char *)H5MM_realloc(file->mem, new_eof))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate memory block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate memory block"); } /* end else */ if (file->eof < new_eof) - HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); + memset(x + file->eof, 0, (size_t)(new_eof - file->eof)); file->mem = x; /* Update backing store, if using it and if closing */ @@ -1618,12 +1557,12 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing if (INVALID_SET_FILE_POINTER == dwPtrLow) { dwError = GetLastError(); if (dwError != NO_ERROR) - HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer") + HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer"); } bError = SetEndOfFile(file->hFile); if (0 == bError) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly"); #else /* H5_HAVE_WIN32_API */ if (-1 == HDftruncate(file->fd, (HDoff_t)new_eof)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") @@ -1650,8 +1589,6 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; May 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1663,7 +1600,7 @@ H5FD__core_lock(H5FD_t *_file, hbool_t rw) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); /* Only set the lock if there is a file descriptor. If no file * descriptor, this is a no-op. @@ -1696,8 +1633,6 @@ H5FD__core_lock(H5FD_t *_file, hbool_t rw) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; May 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1708,7 +1643,7 @@ H5FD__core_unlock(H5FD_t *_file) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); if (file->fd >= 0) if (HDflock(file->fd, LOCK_UN) < 0) { @@ -1744,10 +1679,10 @@ H5FD__core_delete(const char *filename, hid_t fapl_id) FUNC_ENTER_PACKAGE - HDassert(filename); + assert(filename); if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (NULL == (fa = (const H5FD_core_fapl_t *)H5P_peek_driver_info(plist))) fa = H5FD__core_get_default_config(); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDdirect.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDdirect.c index 99bf97417a..30a3c90ab7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDdirect.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDdirect.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 - * * Purpose: The Direct I/O file driver forces the data to be written to * the file directly without being copied into system kernel * buffer. The main system support this feature is Linux. @@ -196,9 +192,6 @@ H5FL_DEFINE_STATIC(H5FD_direct_t); * Return: Success: The driver ID for the direct driver * Failure: H5I_INVALID_HID * - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 - * *------------------------------------------------------------------------- */ hid_t @@ -238,9 +231,6 @@ H5FD_direct_init(void) * * Returns: Non-negative on success or negative on failure * - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 - * *--------------------------------------------------------------------------- */ static herr_t @@ -263,9 +253,6 @@ H5FD__direct_term(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -279,10 +266,10 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu H5TRACE4("e", "izzz", fapl_id, boundary, block_size, cbuf_size); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5FD__direct_populate_config(boundary, block_size, cbuf_size, &fa) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info"); ret_value = H5P_set_driver(plist, H5FD_DIRECT, &fa, NULL); @@ -300,9 +287,6 @@ H5Pset_fapl_direct(hid_t fapl_id, size_t boundary, size_t block_size, size_t cbu * * Failure: Negative * - * Programmer: Raymond Lu - * Wednesday, October 18, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -317,11 +301,11 @@ H5Pget_fapl_direct(hid_t fapl_id, size_t *boundary /*out*/, size_t *block_size / H5TRACE4("e", "ixxx", fapl_id, boundary, block_size, cbuf_size); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); if (H5FD_DIRECT != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if (NULL == (fa = H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); if (boundary) *boundary = fa->mboundary; if (block_size) @@ -350,9 +334,9 @@ H5FD__direct_populate_config(size_t boundary, size_t block_size, size_t cbuf_siz FUNC_ENTER_PACKAGE - HDassert(fa_out); + assert(fa_out); - HDmemset(fa_out, 0, sizeof(H5FD_direct_fapl_t)); + memset(fa_out, 0, sizeof(H5FD_direct_fapl_t)); if (boundary != 0) fa_out->mboundary = boundary; @@ -374,7 +358,7 @@ H5FD__direct_populate_config(size_t boundary, size_t block_size, size_t cbuf_siz /* Copy buffer size must be a multiple of file block size */ if (fa_out->cbsize % fa_out->fbsize != 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "copy buffer size must be a multiple of block size") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "copy buffer size must be a multiple of block size"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -392,9 +376,6 @@ H5FD__direct_populate_config(size_t boundary, size_t block_size, size_t cbuf_siz * * Failure: NULL * - * Programmer: Raymond Lu - * Wednesday, 18 October 2006 - * *------------------------------------------------------------------------- */ static void * @@ -420,9 +401,6 @@ H5FD__direct_fapl_get(H5FD_t *_file) * * Failure: NULL * - * Programmer: Raymond Lu - * Wednesday, 18 October 2006 - * *------------------------------------------------------------------------- */ static void * @@ -433,7 +411,7 @@ H5FD__direct_fapl_copy(const void *_old_fa) FUNC_ENTER_PACKAGE_NOERR - HDassert(new_fa); + assert(new_fa); /* Copy the general information */ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t)); @@ -452,9 +430,6 @@ H5FD__direct_fapl_copy(const void *_old_fa) * * Failure: NULL * - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -477,15 +452,15 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad FUNC_ENTER_PACKAGE /* Sanity check on file offsets */ - HDassert(sizeof(HDoff_t) >= sizeof(size_t)); + assert(sizeof(HDoff_t) >= sizeof(size_t)); /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); if (ADDR_OVERFLOW(maxaddr)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr"); /* Build the open flags */ o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY; @@ -508,14 +483,14 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad /* Create the new file struct */ if (NULL == (file = H5FL_CALLOC(H5FD_direct_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct"); /* Get the driver specific information */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); if (NULL == (fa = (const H5FD_direct_fapl_t *)H5P_peek_driver_info(plist))) { if (H5FD__direct_populate_config(0, 0, 0, &default_fa) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't initialize driver configuration info") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't initialize driver configuration info"); fa = &default_fa; } @@ -543,24 +518,24 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad else { /* Use the value in the property list */ if (H5P_get(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &file->ignore_disabled_file_locks) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property"); } /* Try to decide if data alignment is required. The reason to check it here * is to handle correctly the case that the file is in a different file system * than the one where the program is running. */ - /* NOTE: Use HDmalloc and HDfree here to ensure compatibility with - * HDposix_memalign. + /* NOTE: Use malloc and free here to ensure compatibility with + * posix_memalign(). */ - buf1 = HDmalloc(sizeof(int)); - if (HDposix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "HDposix_memalign failed") + buf1 = malloc(sizeof(int)); + if (posix_memalign(&buf2, file->fa.mboundary, file->fa.fbsize) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "posix_memalign failed"); if (o_flags & O_CREAT) { if (HDwrite(file->fd, buf1, sizeof(int)) < 0) { if (HDwrite(file->fd, buf2, file->fa.fbsize) < 0) - HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, NULL, "file system may not support Direct I/O") + HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, NULL, "file system may not support Direct I/O"); else file->fa.must_align = TRUE; } @@ -573,7 +548,7 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad else { if (HDread(file->fd, buf1, sizeof(int)) < 0) { if (HDread(file->fd, buf2, file->fa.fbsize) < 0) - HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "file system may not support Direct I/O") + HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "file system may not support Direct I/O"); else file->fa.must_align = TRUE; } @@ -592,9 +567,9 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad } if (buf1) - HDfree(buf1); + free(buf1); if (buf2) - HDfree(buf2); + free(buf2); /* Set return value */ ret_value = (H5FD_t *)file; @@ -617,9 +592,6 @@ H5FD__direct_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad * * Failure: -1, file not closed. * - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -650,9 +622,6 @@ H5FD__direct_close(H5FD_t *_file) * Failure: never fails (arguments were checked by the * caller). * - * Programmer: Raymond Lu - * Thursday, 21 September 2006 - * *------------------------------------------------------------------------- */ static int @@ -666,36 +635,36 @@ H5FD__direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) #ifdef H5_HAVE_WIN32_API if (f1->fileindexhi < f2->fileindexhi) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->fileindexhi > f2->fileindexhi) - HGOTO_DONE(1) + HGOTO_DONE(1); if (f1->fileindexlo < f2->fileindexlo) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->fileindexlo > f2->fileindexlo) - HGOTO_DONE(1) + HGOTO_DONE(1); #else #ifdef H5_DEV_T_IS_SCALAR if (f1->device < f2->device) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->device > f2->device) - HGOTO_DONE(1) + HGOTO_DONE(1); #else /* H5_DEV_T_IS_SCALAR */ /* If dev_t isn't a scalar value on this system, just use memcmp to * determine if the values are the same or not. The actual return value * shouldn't really matter... */ - if (HDmemcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0) - HGOTO_DONE(-1) - if (HDmemcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0) - HGOTO_DONE(1) + if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0) + HGOTO_DONE(-1); + if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0) + HGOTO_DONE(1); #endif /* H5_DEV_T_IS_SCALAR */ if (f1->inode < f2->inode) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->inode > f2->inode) - HGOTO_DONE(1) + HGOTO_DONE(1); #endif @@ -713,9 +682,6 @@ H5FD__direct_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * * Failure: negative * - * Programmer: Raymond Lu - * Thursday, 21 September 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -748,9 +714,6 @@ H5FD__direct_query(const H5FD_t H5_ATTR_UNUSED *_f, unsigned long *flags /* out * * Failure: HADDR_UNDEF * - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 - * *------------------------------------------------------------------------- */ static haddr_t @@ -774,9 +737,6 @@ H5FD__direct_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Failure: -1 * - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -804,9 +764,6 @@ H5FD__direct_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr * * Failure: HADDR_UNDEF * - * Programmer: Raymond Lu - * Wednesday, 20 September 2006 - * *------------------------------------------------------------------------- */ static haddr_t @@ -826,9 +783,6 @@ H5FD__direct_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Returns: Non-negative if succeed or negative if fails. * - * Programmer: Raymond Lu - * 21 September 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -840,7 +794,7 @@ H5FD__direct_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_ha FUNC_ENTER_PACKAGE if (!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); *file_handle = &(file->fd); done: @@ -859,9 +813,6 @@ H5FD__direct_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_ha * * Failure: -1, Contents of buffer BUF are undefined. * - * Programmer: Raymond Lu - * Thursday, 21 September 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -883,14 +834,14 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U FUNC_ENTER_PACKAGE - HDassert(file && file->pub.cls); - HDassert(buf); + assert(file && file->pub.cls); + assert(buf); /* Check for overflow conditions */ if (HADDR_UNDEF == addr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined"); if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow"); /* If the system doesn't require data to be aligned, read the data in * the same way as sec2 driver. @@ -922,11 +873,11 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U HSYS_GOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") if (0 == nbytes) { /* end of file but not end of format address space */ - HDmemset(buf, 0, size); + memset(buf, 0, size); break; } - HDassert(nbytes >= 0); - HDassert((size_t)nbytes <= size); + assert(nbytes >= 0); + assert((size_t)nbytes <= size); H5_CHECK_OVERFLOW(nbytes, ssize_t, size_t); size -= (size_t)nbytes; H5_CHECK_OVERFLOW(nbytes, ssize_t, haddr_t); @@ -944,12 +895,12 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; if (alloc_size > _cbsize) alloc_size = _cbsize; - HDassert(!(alloc_size % _fbsize)); - if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") + assert(!(alloc_size % _fbsize)); + if (posix_memalign(©_buf, _boundary, alloc_size) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "posix_memalign failed"); /* look for the aligned position for reading the data */ - HDassert(!(((addr / _fbsize) * _fbsize) % _fbsize)); + assert(!(((addr / _fbsize) * _fbsize) % _fbsize)); if (HDlseek(file->fd, (HDoff_t)((addr / _fbsize) * _fbsize), SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") @@ -964,7 +915,7 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U * system calls and partial results like sec2 driver does because the * data may no longer be aligned. It's especially true when the data in * file is smaller than ALLOC_SIZE. */ - HDmemset(copy_buf, 0, alloc_size); + memset(copy_buf, 0, alloc_size); /* Calculate how much data we have to read in this iteration * (including unused parts of blocks) */ @@ -973,7 +924,7 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U else read_size = alloc_size; - HDassert(!(read_size % _fbsize)); + assert(!(read_size % _fbsize)); do { nbytes = HDread(file->fd, copy_buf, read_size); } while (-1 == nbytes && EINTR == errno); @@ -1004,8 +955,8 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U addr = (haddr_t)(((addr + size - 1) / _fbsize + 1) * _fbsize); if (copy_buf) { - /* Free with HDfree since it came from posix_memalign */ - HDfree(copy_buf); + /* Free with free since it came from posix_memalign */ + free(copy_buf); copy_buf = NULL; } /* end if */ } @@ -1016,9 +967,9 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U done: if (ret_value < 0) { - /* Free with HDfree since it came from posix_memalign */ + /* Free with free since it came from posix_memalign */ if (copy_buf) - HDfree(copy_buf); + free(copy_buf); /* Reset last file I/O information */ file->pos = HADDR_UNDEF; @@ -1039,9 +990,6 @@ H5FD__direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U * * Failure: -1 * - * Programmer: Raymond Lu - * Thursday, 21 September 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1066,14 +1014,14 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ FUNC_ENTER_PACKAGE - HDassert(file && file->pub.cls); - HDassert(buf); + assert(file && file->pub.cls); + assert(buf); /* Check for overflow conditions */ if (HADDR_UNDEF == addr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined"); if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow"); /* If the system doesn't require data to be aligned, read the data in * the same way as sec2 driver. @@ -1102,8 +1050,8 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ } while (-1 == nbytes && EINTR == errno); if (-1 == nbytes) /* error */ HSYS_GOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") - HDassert(nbytes > 0); - HDassert((size_t)nbytes <= size); + assert(nbytes > 0); + assert((size_t)nbytes <= size); H5_CHECK_OVERFLOW(nbytes, ssize_t, size_t); size -= (size_t)nbytes; H5_CHECK_OVERFLOW(nbytes, ssize_t, haddr_t); @@ -1124,10 +1072,10 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ alloc_size = ((copy_offset + size - 1) / _fbsize + 1) * _fbsize; if (alloc_size > _cbsize) alloc_size = _cbsize; - HDassert(!(alloc_size % _fbsize)); + assert(!(alloc_size % _fbsize)); - if (HDposix_memalign(©_buf, _boundary, alloc_size) != 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "HDposix_memalign failed") + if (posix_memalign(©_buf, _boundary, alloc_size) != 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "posix_memalign failed"); /* look for the right position for reading or writing the data */ if (HDlseek(file->fd, (HDoff_t)write_addr, SEEK_SET) < 0) @@ -1151,11 +1099,11 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ * both ends are misaligned, otherwise only read the block on the * misaligned end. */ - HDmemset(copy_buf, 0, _fbsize); + memset(copy_buf, 0, _fbsize); if (copy_offset > 0) { if ((write_addr + write_size) > (addr + size)) { - HDassert((write_addr + write_size) - (addr + size) < _fbsize); + assert((write_addr + write_size) - (addr + size) < _fbsize); read_size = write_size; p1 = copy_buf; } /* end if */ @@ -1165,12 +1113,12 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ } /* end else */ } /* end if */ else if ((write_addr + write_size) > (addr + size)) { - HDassert((write_addr + write_size) - (addr + size) < _fbsize); + assert((write_addr + write_size) - (addr + size) < _fbsize); read_size = _fbsize; p1 = (unsigned char *)copy_buf + write_size - _fbsize; /* Seek to the last block, for reading */ - HDassert(!((write_addr + write_size - _fbsize) % _fbsize)); + assert(!((write_addr + write_size - _fbsize) % _fbsize)); if (HDlseek(file->fd, (HDoff_t)(write_addr + write_size - _fbsize), SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") } /* end if */ @@ -1178,7 +1126,7 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ p1 = NULL; if (p1) { - HDassert(!(read_size % _fbsize)); + assert(!(read_size % _fbsize)); do { nbytes = HDread(file->fd, p1, read_size); } while (-1 == nbytes && EINTR == errno); @@ -1206,7 +1154,7 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ } /* end else */ /*look for the aligned position for writing the data*/ - HDassert(!(write_addr % _fbsize)); + assert(!(write_addr % _fbsize)); if (HDlseek(file->fd, (HDoff_t)write_addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") @@ -1214,7 +1162,7 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ * Write the data. It doesn't truncate the extra data introduced by * alignment because that step is done in H5FD_direct_flush. */ - HDassert(!(write_size % _fbsize)); + assert(!(write_size % _fbsize)); do { nbytes = HDwrite(file->fd, copy_buf, write_size); } while (-1 == nbytes && EINTR == errno); @@ -1231,8 +1179,8 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ buf = (const char *)buf + size; if (copy_buf) { - /* Free with HDfree since it came from posix_memalign */ - HDfree(copy_buf); + /* Free with free since it came from posix_memalign */ + free(copy_buf); copy_buf = NULL; } /* end if */ } @@ -1245,9 +1193,9 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ done: if (ret_value < 0) { - /* Free with HDfree since it came from posix_memalign */ + /* Free with free since it came from posix_memalign */ if (copy_buf) - HDfree(copy_buf); + free(copy_buf); /* Reset last file I/O information */ file->pos = HADDR_UNDEF; @@ -1267,9 +1215,6 @@ H5FD__direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_ * * Failure: Negative * - * Programmer: Raymond Lu - * Thursday, 21 September 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1280,7 +1225,7 @@ H5FD__direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_AT FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); /* Extend the file to make sure it's large enough */ if (file->eoa != file->eof) { @@ -1296,7 +1241,7 @@ H5FD__direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_AT li.QuadPart = (LONGLONG)file->eoa; (void)SetFilePointer((HANDLE)filehandle, li.LowPart, &li.HighPart, FILE_BEGIN); if (SetEndOfFile((HANDLE)filehandle) == 0) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly"); #else /* H5_HAVE_WIN32_API */ if (-1 == HDftruncate(file->fd, (HDoff_t)file->eoa)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") @@ -1331,8 +1276,6 @@ H5FD__direct_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_AT * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; May 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1344,7 +1287,7 @@ H5FD__direct_lock(H5FD_t *_file, hbool_t rw) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); /* Set exclusive or shared lock based on rw status */ lock_flags = rw ? LOCK_EX : LOCK_SH; @@ -1372,8 +1315,6 @@ H5FD__direct_lock(H5FD_t *_file, hbool_t rw) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; May 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1384,7 +1325,7 @@ H5FD__direct_unlock(H5FD_t *_file) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); if (HDflock(file->fd, LOCK_UN) < 0) { if (file->ignore_disabled_file_locks && ENOSYS == errno) { @@ -1417,7 +1358,7 @@ H5FD__direct_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id) FUNC_ENTER_PACKAGE - HDassert(filename); + assert(filename); if (HDremove(filename) < 0) HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDfamily.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDfamily.c index 617f68bca2..8d1ed4888a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDfamily.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDfamily.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Monday, November 10, 1997 - * * Purpose: Implements a family of files that acts as a single hdf5 * file. The purpose is to be able to split a huge file on a * 64-bit platform, transfer all the <2GB members to a 32-bit @@ -173,7 +169,7 @@ H5FD__family_get_default_config(H5FD_family_fapl_t *fa_out) FUNC_ENTER_PACKAGE - HDassert(fa_out); + assert(fa_out); fa_out->memb_size = H5FD_FAM_DEF_MEM_SIZE; @@ -183,18 +179,18 @@ H5FD__family_get_default_config(H5FD_family_fapl_t *fa_out) * would cause recursion badness in the child members. */ if (NULL == (def_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if ((fa_out->memb_fapl_id = H5P_copy_plist(def_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list") + HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list"); if (NULL == (plist = (H5P_genplist_t *)H5I_object(fa_out->memb_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5P_set_driver_by_value(plist, H5_VFD_SEC2, NULL, TRUE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on member FAPL") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on member FAPL"); done: if (ret_value < 0 && fa_out->memb_fapl_id >= 0) { if (H5I_dec_ref(fa_out->memb_fapl_id) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement ref. count on member FAPL ID") + HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement ref. count on member FAPL ID"); } FUNC_LEAVE_NOAPI(ret_value) @@ -227,15 +223,15 @@ H5FD__family_get_default_printf_filename(const char *old_filename) FUNC_ENTER_PACKAGE - HDassert(old_filename); + assert(old_filename); old_filename_len = HDstrlen(old_filename); if (0 == old_filename_len) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid filename") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid filename"); new_filename_len = old_filename_len + HDstrlen(suffix) + 1; if (NULL == (tmp_buffer = H5MM_malloc(new_filename_len))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate new filename buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate new filename buffer"); /* Determine if filename contains a ".h5" extension. */ if ((file_extension = HDstrstr(old_filename, ".h5"))) { @@ -279,9 +275,6 @@ H5FD__family_get_default_printf_filename(const char *old_filename) * Return: Success: The driver ID for the family driver * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ hid_t @@ -307,9 +300,6 @@ H5FD_family_init(void) * * Returns: Non-negative on success or negative on failure * - * Programmer: Quincey Koziol - * Friday, Jan 30, 2004 - * *--------------------------------------------------------------------------- */ static herr_t @@ -336,9 +326,6 @@ H5FD__family_term(void) * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -353,14 +340,14 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) /* Check arguments */ if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5P_DEFAULT == memb_fapl_id) { /* Get default configuration for member FAPL */ if (H5FD__family_get_default_config(&fa) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default driver configuration info") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default driver configuration info"); } else if (TRUE != H5P_isa_class(memb_fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); /* Initialize driver specific information. */ fa.memb_size = msize; @@ -368,7 +355,7 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) fa.memb_fapl_id = memb_fapl_id; if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); ret_value = H5P_set_driver(plist, H5FD_FAMILY, &fa, NULL); done: @@ -385,9 +372,6 @@ H5Pset_fapl_family(hid_t fapl_id, hsize_t msize, hid_t memb_fapl_id) * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -401,16 +385,16 @@ H5Pget_fapl_family(hid_t fapl_id, hsize_t *msize /*out*/, hid_t *memb_fapl_id /* H5TRACE3("e", "ixx", fapl_id, msize, memb_fapl_id); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); if (H5FD_FAMILY != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); if (msize) *msize = fa->memb_size; if (memb_fapl_id) { if (NULL == (plist = (H5P_genplist_t *)H5I_object(fa->memb_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); *memb_fapl_id = H5P_copy_plist(plist, TRUE); } /* end if */ @@ -428,9 +412,6 @@ H5Pget_fapl_family(hid_t fapl_id, hsize_t *msize /*out*/, hid_t *memb_fapl_id /* * * Failure: NULL * - * Programmer: Robb Matzke - * Friday, August 13, 1999 - * *------------------------------------------------------------------------- */ static void * @@ -444,11 +425,11 @@ H5FD__family_fapl_get(H5FD_t *_file) FUNC_ENTER_PACKAGE if (NULL == (fa = (H5FD_family_fapl_t *)H5MM_calloc(sizeof(H5FD_family_fapl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); fa->memb_size = file->memb_size; if (NULL == (plist = (H5P_genplist_t *)H5I_object(file->memb_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); fa->memb_fapl_id = H5P_copy_plist(plist, FALSE); /* Set return value */ @@ -471,9 +452,6 @@ H5FD__family_fapl_get(H5FD_t *_file) * * Failure: NULL * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static void * @@ -487,7 +465,7 @@ H5FD__family_fapl_copy(const void *_old_fa) FUNC_ENTER_PACKAGE if (NULL == (new_fa = (H5FD_family_fapl_t *)H5MM_malloc(sizeof(H5FD_family_fapl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy the fields of the structure */ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t)); @@ -495,11 +473,11 @@ H5FD__family_fapl_copy(const void *_old_fa) /* Deep copy the property list objects in the structure */ if (old_fa->memb_fapl_id == H5P_FILE_ACCESS_DEFAULT) { if (H5I_inc_ref(new_fa->memb_fapl_id, FALSE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver"); } /* end if */ else { if (NULL == (plist = (H5P_genplist_t *)H5I_object(old_fa->memb_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); new_fa->memb_fapl_id = H5P_copy_plist(plist, FALSE); } /* end else */ @@ -523,9 +501,6 @@ H5FD__family_fapl_copy(const void *_old_fa) * * Failure: -1 * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -537,7 +512,7 @@ H5FD__family_fapl_free(void *_fa) FUNC_ENTER_PACKAGE if (H5I_dec_ref(fa->memb_fapl_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") + HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID"); H5MM_xfree(fa); done: @@ -554,9 +529,6 @@ H5FD__family_fapl_free(void *_fa) * * Failure: never fails * - * Programmer: Raymond Lu - * Tuesday, May 10, 2005 - * *------------------------------------------------------------------------- */ static hsize_t @@ -582,9 +554,6 @@ H5FD__family_sb_size(H5FD_t H5_ATTR_UNUSED *_file) * * Failure: -1 * - * Programmer: Raymond Lu - * Tuesday, May 10, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -624,9 +593,6 @@ H5FD__family_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*o * * Failure: -1 * - * Programmer: Raymond Lu - * Tuesday, May 10, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -656,7 +622,7 @@ H5FD__family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const uns if (msize != file->pmem_size) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Family member size should be %lu. But the size from file access property is %lu", - (unsigned long)msize, (unsigned long)file->pmem_size) + (unsigned long)msize, (unsigned long)file->pmem_size); /* Update member file size to the size saved in the superblock. * That's the size intended to be. */ @@ -678,9 +644,6 @@ H5FD__family_sb_decode(H5FD_t *_file, const char H5_ATTR_UNUSED *name, const uns * * Failure: NULL * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ /* Disable warning for "format not a string literal" here -QAK */ @@ -704,19 +667,19 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); /* Initialize file from file access properties */ if (NULL == (file = (H5FD_family_t *)H5MM_calloc(sizeof(H5FD_family_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct"); if (H5P_FILE_ACCESS_DEFAULT == fapl_id) { H5FD_family_fapl_t default_fa; /* Get default configuration */ if (H5FD__family_get_default_config(&default_fa) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default driver configuration info") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default driver configuration info"); file->memb_fapl_id = default_fa.memb_fapl_id; file->memb_size = H5FD_FAM_DEF_MEM_SIZE; /* Actual member size to be updated later */ @@ -731,10 +694,10 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad H5FD_family_fapl_t default_fa; if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) { if (H5FD__family_get_default_config(&default_fa) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default family VFD configuration") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default family VFD configuration"); fa = &default_fa; default_config = TRUE; } @@ -743,7 +706,7 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad if (H5P_exist_plist(plist, H5F_ACS_FAMILY_NEWSIZE_NAME) > 0) { /* Get the new family file size */ if (H5P_get(plist, H5F_ACS_FAMILY_NEWSIZE_NAME, &file->mem_newsize) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get new family member size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get new family member size"); /* Set flag for later */ file->repart_members = TRUE; @@ -751,28 +714,28 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad if (fa->memb_fapl_id == H5P_FILE_ACCESS_DEFAULT) { if (H5I_inc_ref(fa->memb_fapl_id, FALSE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, NULL, "unable to increment ref count on VFL driver"); file->memb_fapl_id = fa->memb_fapl_id; } /* end if */ else { if (NULL == (plist = (H5P_genplist_t *)H5I_object(fa->memb_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); file->memb_fapl_id = H5P_copy_plist(plist, FALSE); } /* end else */ file->memb_size = fa->memb_size; /* Actual member size to be updated later */ file->pmem_size = fa->memb_size; /* Member size passed in through property */ if (default_config && H5I_dec_ref(fa->memb_fapl_id) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTDEC, NULL, "can't decrement ref. count on member FAPL") + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, NULL, "can't decrement ref. count on member FAPL"); } /* end else */ file->name = H5MM_strdup(name); file->flags = flags; /* Allocate space for the string buffers */ if (NULL == (memb_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate member name") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate member name"); if (NULL == (temp = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate temporary member name") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate temporary member name"); /* Check that names are unique */ HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 0); @@ -781,11 +744,11 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad if (default_config) { temp = H5MM_xfree(temp); if (NULL == (temp = H5FD__family_get_default_printf_filename(name))) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default printf-style filename") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get default printf-style filename"); name = temp; } else - HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique") + HGOTO_ERROR(H5E_FILE, H5E_FILEEXISTS, NULL, "file names not unique"); } /* Open all the family members */ @@ -797,9 +760,9 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad unsigned n = MAX(64, 2 * file->amembs); H5FD_t **x; - HDassert(n > 0); + assert(n > 0); if (NULL == (x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to reallocate members") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to reallocate members"); file->amembs = n; file->memb = x; } /* end if */ @@ -814,10 +777,10 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad file->memb[file->nmembs] = H5FDopen(memb_name, (0 == file->nmembs ? flags : t_flags), file->memb_fapl_id, HADDR_UNDEF); } - H5E_END_TRY; + H5E_END_TRY if (!file->memb[file->nmembs]) { if (0 == file->nmembs) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open member file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open member file"); H5E_clear_stack(NULL); break; } @@ -852,12 +815,12 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad if (H5FD_close(file->memb[u]) < 0) nerrors++; if (nerrors) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "unable to close member files") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "unable to close member files"); if (file->memb) H5MM_xfree(file->memb); if (H5I_dec_ref(file->memb_fapl_id) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTDEC, NULL, "can't close driver ID") + HDONE_ERROR(H5E_VFL, H5E_CANTDEC, NULL, "can't close driver ID"); if (file->name) H5MM_xfree(file->name); H5MM_xfree(file); @@ -878,9 +841,6 @@ H5_GCC_CLANG_DIAG_ON("format-nonliteral") * possible. The only subsequent operation * permitted on the file is a close operation. * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -905,12 +865,12 @@ H5FD__family_close(H5FD_t *_file) } /* end for */ if (nerrors) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close member files") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close member files"); /* Clean up other stuff */ if (H5I_dec_ref(file->memb_fapl_id) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID") + HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close driver ID"); H5MM_xfree(file->memb); H5MM_xfree(file->name); H5MM_xfree(file); @@ -929,9 +889,6 @@ H5FD__family_close(H5FD_t *_file) * Failure: never fails (arguments were checked by the * caller). * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static int @@ -943,8 +900,8 @@ H5FD__family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_PACKAGE_NOERR - HDassert(f1->nmembs >= 1 && f1->memb[0]); - HDassert(f2->nmembs >= 1 && f2->memb[0]); + assert(f1->nmembs >= 1 && f1->memb[0]); + assert(f2->nmembs >= 1 && f2->memb[0]); ret_value = H5FDcmp(f1->memb[0], f2->memb[0]); @@ -960,9 +917,6 @@ H5FD__family_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, August 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -1000,9 +954,6 @@ H5FD__family_query(const H5FD_t *_file, unsigned long *flags /* out */) * * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1024,9 +975,6 @@ H5FD__family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Failure: -1 * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ /* Disable warning for "format not a string literal" here -QAK */ @@ -1049,7 +997,7 @@ H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) /* Allocate space for the member name buffer */ if (NULL == (memb_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate member name") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate member name"); for (u = 0; addr || u < file->nmembs; u++) { @@ -1059,7 +1007,7 @@ H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) H5FD_t **x = (H5FD_t **)H5MM_realloc(file->memb, n * sizeof(H5FD_t *)); if (!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block"); file->amembs = n; file->memb = x; file->nmembs = u; @@ -1075,9 +1023,9 @@ H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) file->memb[u] = H5FDopen(memb_name, file->flags | H5F_ACC_CREAT, file->memb_fapl_id, (haddr_t)file->memb_size); } - H5E_END_TRY; + H5E_END_TRY if (NULL == file->memb[u]) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open member file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open member file"); } /* end if */ /* Set the EOA marker for the member */ @@ -1085,12 +1033,12 @@ H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa) H5_CHECK_OVERFLOW(file->memb_size, hsize_t, haddr_t); if (addr > (haddr_t)file->memb_size) { if (H5FD_set_eoa(file->memb[u], type, ((haddr_t)file->memb_size - file->pub.base_addr)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set file eoa") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set file eoa"); addr -= file->memb_size; } /* end if */ else { if (H5FD_set_eoa(file->memb[u], type, (addr - file->pub.base_addr)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set file eoa") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set file eoa"); addr = 0; } /* end else */ } /* end for */ @@ -1118,9 +1066,6 @@ H5_GCC_CLANG_DIAG_ON("format-nonliteral") * * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1138,7 +1083,7 @@ H5FD__family_get_eof(const H5FD_t *_file, H5FD_mem_t type) * with `i' equal to that member. If all members have zero EOF then exit * loop with i==0. */ - HDassert(file->nmembs > 0); + assert(file->nmembs > 0); for (i = (int)file->nmembs - 1; i >= 0; --i) { if ((eof = H5FD_get_eof(file->memb[i], type)) != 0) break; @@ -1168,9 +1113,6 @@ H5FD__family_get_eof(const H5FD_t *_file, H5FD_mem_t type) * * Returns: Non-negative if succeed or negative if fails. * - * Programmer: Raymond Lu - * Sept. 16, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -1186,12 +1128,12 @@ H5FD__family_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) /* Get the plist structure and family offset */ if (NULL == (plist = H5P_object_verify(fapl, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get offset for family driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get offset for family driver"); if (offset > (file->memb_size * file->nmembs)) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "offset is bigger than file size") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "offset is bigger than file size"); memb = (int)(offset / file->memb_size); ret_value = H5FD_get_vfd_handle(file->memb[memb], fapl, file_handle); @@ -1212,9 +1154,6 @@ H5FD__family_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) * * Failure: -1, contents of buffer BUF are undefined. * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1237,7 +1176,7 @@ H5FD__family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s * list does not belong to this driver then assume defaults */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); /* Read from each member */ while (size > 0) { @@ -1253,10 +1192,10 @@ H5FD__family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s tempreq = SIZE_MAX; req = MIN(size, (size_t)tempreq); - HDassert(u < file->nmembs); + assert(u < file->nmembs); if (H5FDread(file->memb[u], type, dxpl_id, sub, req, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "member file read failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "member file read failed"); addr += req; buf += req; @@ -1278,9 +1217,6 @@ H5FD__family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s * * Failure: -1 * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1302,7 +1238,7 @@ H5FD__family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, * list does not belong to this driver then assume defaults. */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); /* Write to each member */ while (size > 0) { @@ -1318,10 +1254,10 @@ H5FD__family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, tempreq = SIZE_MAX; req = MIN(size, (size_t)tempreq); - HDassert(u < file->nmembs); + assert(u < file->nmembs); if (H5FDwrite(file->memb[u], type, dxpl_id, sub, req, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "member file write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "member file write failed"); addr += req; buf += req; @@ -1340,9 +1276,6 @@ H5FD__family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, * Return: Success: 0 * Failure: -1, as many files flushed as possible. * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1359,7 +1292,7 @@ H5FD__family_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) nerrors++; if (nerrors) - HGOTO_ERROR(H5E_IO, H5E_BADVALUE, FAIL, "unable to flush member files") + HGOTO_ERROR(H5E_IO, H5E_BADVALUE, FAIL, "unable to flush member files"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1374,9 +1307,6 @@ H5FD__family_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) * * Failure: -1, as many files truncated as possible. * - * Programmer: Quincey Koziol - * Saturday, February 23, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1393,7 +1323,7 @@ H5FD__family_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closi nerrors++; if (nerrors) - HGOTO_ERROR(H5E_IO, H5E_BADVALUE, FAIL, "unable to flush member files") + HGOTO_ERROR(H5E_IO, H5E_BADVALUE, FAIL, "unable to flush member files"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1409,8 +1339,6 @@ H5FD__family_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closi * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; May 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1437,9 +1365,9 @@ H5FD__family_lock(H5FD_t *_file, hbool_t rw) for (v = 0; v < u; v++) { if (H5FD_unlock(file->memb[v]) < 0) /* Push error, but keep going */ - HDONE_ERROR(H5E_IO, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock member files") + HDONE_ERROR(H5E_IO, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock member files"); } /* end for */ - HGOTO_ERROR(H5E_IO, H5E_CANTLOCKFILE, FAIL, "unable to lock member files") + HGOTO_ERROR(H5E_IO, H5E_CANTLOCKFILE, FAIL, "unable to lock member files"); } /* end if */ done: @@ -1453,8 +1381,6 @@ H5FD__family_lock(H5FD_t *_file, hbool_t rw) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; May 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1470,7 +1396,7 @@ H5FD__family_unlock(H5FD_t *_file) for (u = 0; u < file->nmembs; u++) if (file->memb[u]) if (H5FD_unlock(file->memb[u]) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock member files") + HGOTO_ERROR(H5E_IO, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock member files"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1501,23 +1427,23 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) FUNC_ENTER_PACKAGE - HDassert(filename); + assert(filename); /* Get the driver info (for the member fapl) * The family_open call accepts H5P_DEFAULT, so we'll accept that here, too. */ if (H5P_FILE_ACCESS_DEFAULT == fapl_id) { if (H5FD__family_get_default_config(&default_fa) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default family VFD configuration") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default family VFD configuration"); memb_fapl_id = default_fa.memb_fapl_id; default_config = TRUE; } else { if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (NULL == (fa = (const H5FD_family_fapl_t *)H5P_peek_driver_info(plist))) { if (H5FD__family_get_default_config(&default_fa) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default family VFD configuration") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default family VFD configuration"); fa = &default_fa; default_config = TRUE; } @@ -1526,9 +1452,9 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) /* Allocate space for the string buffers */ if (NULL == (member_name = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate member name") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate member name"); if (NULL == (temp = (char *)H5MM_malloc(H5FD_FAM_MEMB_NAME_BUF_SIZE))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate temporary member name") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate temporary member name"); /* Sanity check to make sure that generated names are unique */ H5_GCC_CLANG_DIAG_OFF("format-nonliteral") @@ -1540,12 +1466,12 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) if (default_config) { temp = H5MM_xfree(temp); if (NULL == (temp = H5FD__family_get_default_printf_filename(filename))) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default printf-style filename") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get default printf-style filename"); filename = temp; } else HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, - "provided file name cannot generate unique sub-files") + "provided file name cannot generate unique sub-files"); } /* Delete all the family members */ @@ -1567,10 +1493,10 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) { delete_error = H5FD_delete(member_name, memb_fapl_id); } - H5E_END_TRY; + H5E_END_TRY if (FAIL == delete_error) { if (0 == current_member) - HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete member file") + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete member file"); else H5E_clear_stack(NULL); break; @@ -1586,7 +1512,7 @@ H5FD__family_delete(const char *filename, hid_t fapl_id) /* Only close memb_fapl_id if we created one from the default configuration */ if (default_fa.memb_fapl_id >= 0 && H5I_dec_ref(default_fa.memb_fapl_id) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement ref. count on member FAPL ID") + HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't decrement ref. count on member FAPL ID"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__family_delete() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDhdfs.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDhdfs.c index d81e8a59a9..7dcd1947ba 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDhdfs.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDhdfs.c @@ -11,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Jacob Smith - * 2018-04-23 - * * Purpose: Provide read-only access to files on the Hadoop Distributed * File System (HDFS). */ @@ -112,10 +109,6 @@ static unsigned long long hdfs_stats_boundaries[HDFS_STATS_BIN_COUNT]; * * Largest read size in this bin. * - * - * - * Programmer: Jacob Smith - * ***************************************************************************/ typedef struct { unsigned long long count; @@ -161,11 +154,6 @@ typedef struct { * * A libhdfs file handle. * - * - * - * Programmer: Jacob Smith - * May 2018 - * *************************************************************************** */ typedef struct { @@ -227,10 +215,6 @@ typedef struct { * * *** end HDFS_STATS *** * - * - * - * Programmer: Jacob Smith - * ***************************************************************************/ typedef struct H5FD_hdfs_t { H5FD_t pub; @@ -332,8 +316,6 @@ H5FL_DEFINE_STATIC(H5FD_hdfs_t); * Return: Success: The driver ID for the hdfs driver. * Failure: Negative * - * Programmer: Jacob Smith, 2018 - * *------------------------------------------------------------------------- */ hid_t @@ -347,7 +329,7 @@ H5FD_hdfs_init(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif if (H5I_VFL != H5I_get_type(H5FD_HDFS_g)) @@ -377,9 +359,6 @@ H5FD_hdfs_init(void) * * Returns: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Friday, Jan 30, 2004 - * *--------------------------------------------------------------------------- */ static herr_t @@ -388,7 +367,7 @@ H5FD__hdfs_term(void) FUNC_ENTER_PACKAGE_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif /* Reset VFL ID */ @@ -405,9 +384,6 @@ H5FD__hdfs_term(void) * Return: Success: Pointer to HDFS container/handle of opened file. * Failure: NULL * - * Programmer: Gerd Herber - * May 2018 - * *-------------------------------------------------------------------------- */ static hdfs_t * @@ -422,21 +398,21 @@ H5FD__hdfs_handle_open(const char *path, const char *namenode_name, const int32_ FUNC_ENTER_PACKAGE #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif if (path == NULL || path[0] == '\0') - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "path cannot be null") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "path cannot be null"); if (namenode_name == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode name cannot be null") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode name cannot be null"); if (namenode_port < 0 || namenode_port > 65535) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode port must be non-negative and <= 65535") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "namenode port must be non-negative and <= 65535"); if (stream_buffer_size < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "buffer size must non-negative") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "buffer size must non-negative"); handle = (hdfs_t *)H5MM_malloc(sizeof(hdfs_t)); if (handle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle") + HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "could not malloc space for handle"); handle->magic = (unsigned long)HDFS_HDFST_MAGIC; handle->filesystem = NULL; /* TODO: not a pointer; NULL may cause bug */ @@ -445,7 +421,7 @@ H5FD__hdfs_handle_open(const char *path, const char *namenode_name, const int32_ builder = hdfsNewBuilder(); if (!builder) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) failed to create builder") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) failed to create builder"); hdfsBuilderSetNameNode(builder, namenode_name); hdfsBuilderSetNameNodePort(builder, (tPort)namenode_port); if (user_name != NULL && user_name[0] != '\0') @@ -456,29 +432,29 @@ H5FD__hdfs_handle_open(const char *path, const char *namenode_name, const int32_ /* Call to `hdfsBuilderConnect` releases builder, regardless of success. */ handle->filesystem = hdfsBuilderConnect(builder); if (!handle->filesystem) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) could not connect to default namenode") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "(hdfs) could not connect to default namenode"); handle->fileinfo = hdfsGetPathInfo(handle->filesystem, path); if (!handle->fileinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "hdfsGetPathInfo failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "hdfsGetPathInfo failed"); handle->file = hdfsOpenFile(handle->filesystem, path, O_RDONLY, stream_buffer_size, 0, 0); if (!handle->file) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "(hdfs) could not open") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "(hdfs) could not open"); ret_value = handle; done: if (ret_value == NULL && handle != NULL) { /* error; clean up */ - HDassert(handle->magic == HDFS_HDFST_MAGIC); + assert(handle->magic == HDFS_HDFST_MAGIC); handle->magic++; if (handle->file != NULL) if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close hdfs file handle") + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close hdfs file handle"); if (handle->fileinfo != NULL) hdfsFreeFileInfo(handle->fileinfo, 1); if (handle->filesystem != NULL) if (FAIL == (hdfsDisconnect(handle->filesystem))) - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to disconnect from hdfs") + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to disconnect from hdfs"); H5MM_xfree(handle); } @@ -494,9 +470,6 @@ H5FD__hdfs_handle_open(const char *path, const char *namenode_name, const int32_ * Return: Success: `SUCCEED` (0) * Failure: `FAIL` (-1) * - * Programmer: Gerd Herber - * May 2018 - * *-------------------------------------------------------------------------- */ static herr_t @@ -507,23 +480,23 @@ H5FD__hdfs_handle_close(hdfs_t *handle) FUNC_ENTER_PACKAGE #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif if (handle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be null"); if (handle->magic != HDFS_HDFST_MAGIC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic"); handle->magic++; if (handle->file != NULL) if (FAIL == (hdfsCloseFile(handle->filesystem, handle->file))) - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close hdfs file handle") + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close hdfs file handle"); if (handle->fileinfo != NULL) hdfsFreeFileInfo(handle->fileinfo, 1); if (handle->filesystem != NULL) if (FAIL == (hdfsDisconnect(handle->filesystem))) - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to disconnect hdfs file system") + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to disconnect hdfs file system"); H5MM_xfree(handle); @@ -546,9 +519,6 @@ H5FD__hdfs_handle_close(hdfs_t *handle) * Return: SUCCEED if instance of H5FD_hdfs_fapl_t contains internally * consistent data, FAIL otherwise. * - * Programmer: Jacob Smith - * 9/10/17 - * *------------------------------------------------------------------------- */ static herr_t @@ -558,7 +528,7 @@ H5FD__hdfs_validate_config(const H5FD_hdfs_fapl_t *fa) FUNC_ENTER_PACKAGE - HDassert(fa != NULL); + assert(fa != NULL); if (fa->version != H5FD__CURR_HDFS_FAPL_T_VERSION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_hdfs_fapl_t version"); @@ -581,9 +551,6 @@ H5FD__hdfs_validate_config(const H5FD_hdfs_fapl_t *fa) * * Return: SUCCEED/FAIL * - * Programmer: John Mainzer - * 9/10/17 - * *------------------------------------------------------------------------- */ herr_t @@ -595,17 +562,17 @@ H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*#", fapl_id, fa); - HDassert(fa != NULL); + assert(fa != NULL); #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); if (plist == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (FAIL == H5FD__hdfs_validate_config(fa)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid hdfs config") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid hdfs config"); ret_value = H5P_set_driver(plist, H5FD_HDFS, (void *)fa, NULL); @@ -623,9 +590,6 @@ H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) * * Failure: Negative * - * Programmer: John Mainzer - * 9/10/17 - * *------------------------------------------------------------------------- */ herr_t @@ -639,21 +603,21 @@ H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_dst /*out*/) H5TRACE2("e", "ix", fapl_id, fa_dst); #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif if (fa_dst == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst ptr is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst ptr is NULL"); plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); if (plist == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); if (H5FD_HDFS != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); fa_src = (const H5FD_hdfs_fapl_t *)H5P_peek_driver_info(plist); if (fa_src == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); /* Copy the hdfs fapl data out */ H5MM_memcpy(fa_dst, fa_src, sizeof(H5FD_hdfs_fapl_t)); @@ -672,9 +636,6 @@ H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_dst /*out*/) * * Failure: NULL * - * Programmer: John Mainzer - * 9/8/17 - * *------------------------------------------------------------------------- */ static void * @@ -688,7 +649,7 @@ H5FD__hdfs_fapl_get(H5FD_t *_file) fa = (H5FD_hdfs_fapl_t *)H5MM_calloc(sizeof(H5FD_hdfs_fapl_t)); if (fa == NULL) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Copy the fields of the structure */ H5MM_memcpy(fa, &(file->fa), sizeof(H5FD_hdfs_fapl_t)); @@ -711,9 +672,6 @@ H5FD__hdfs_fapl_get(H5FD_t *_file) * * Failure: NULL * - * Programmer: John Mainzer - * 9/8/17 - * *------------------------------------------------------------------------- */ static void * @@ -727,7 +685,7 @@ H5FD__hdfs_fapl_copy(const void *_old_fa) new_fa = (H5FD_hdfs_fapl_t *)H5MM_malloc(sizeof(H5FD_hdfs_fapl_t)); if (new_fa == NULL) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "memory allocation failed"); H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_hdfs_fapl_t)); ret_value = new_fa; @@ -746,9 +704,6 @@ H5FD__hdfs_fapl_copy(const void *_old_fa) * * Return: SUCCEED (cannot fail) * - * Programmer: John Mainzer - * 9/8/17 - * *------------------------------------------------------------------------- */ static herr_t @@ -758,7 +713,7 @@ H5FD__hdfs_fapl_free(void *_fa) FUNC_ENTER_PACKAGE_NOERR - HDassert(fa != NULL); /* sanity check */ + assert(fa != NULL); /* sanity check */ H5MM_xfree(fa); @@ -782,9 +737,6 @@ H5FD__hdfs_fapl_free(void *_fa) * - FAILURE: `FAIL` * - Occurs if the file is invalid somehow * - * Programmer: Jacob Smith - * 2017-12-08 - * *---------------------------------------------------------------------------- */ static herr_t @@ -796,11 +748,11 @@ hdfs__reset_stats(H5FD_hdfs_t *file) FUNC_ENTER_PACKAGE #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif if (file == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file was null"); for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { file->raw[i].bytes = 0; @@ -815,7 +767,7 @@ hdfs__reset_stats(H5FD_hdfs_t *file) } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* hdfs__reset_stats */ #endif /* HDFS_STATS */ @@ -838,9 +790,6 @@ hdfs__reset_stats(H5FD_hdfs_t *file) * * Failure: NULL * - * Programmer: Jacob Smith - * 2017-11-02 - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -854,7 +803,7 @@ H5FD__hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr FUNC_ENTER_PACKAGE #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ /* Sanity check on file offsets */ @@ -862,35 +811,35 @@ H5FD__hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* Check arguments */ if (!path || !*path) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); if (ADDR_OVERFLOW(maxaddr)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr"); if (flags != H5F_ACC_RDONLY) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "only Read-Only access allowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "only Read-Only access allowed"); if (fapl_id == H5P_DEFAULT || fapl_id == H5P_FILE_ACCESS_DEFAULT) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "fapl cannot be H5P_DEFAULT") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "fapl cannot be H5P_DEFAULT"); if (FAIL == H5Pget_fapl_hdfs(fapl_id, &fa)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get property list"); handle = H5FD__hdfs_handle_open(path, fa.namenode_name, fa.namenode_port, fa.user_name, fa.kerberos_ticket_cache, fa.stream_buffer_size); if (handle == NULL) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "could not open"); - HDassert(handle->magic == HDFS_HDFST_MAGIC); + assert(handle->magic == HDFS_HDFST_MAGIC); /* Create new file struct */ file = H5FL_CALLOC(H5FD_hdfs_t); if (file == NULL) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct"); file->hdfs_handle = handle; H5MM_memcpy(&(file->fa), &fa, sizeof(H5FD_hdfs_fapl_t)); #if HDFS_STATS if (FAIL == hdfs__reset_stats(file)) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics"); #endif /* HDFS_STATS */ ret_value = (H5FD_t *)file; @@ -899,7 +848,7 @@ H5FD__hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr if (ret_value == NULL) { if (handle != NULL) if (FAIL == H5FD__hdfs_handle_close(handle)) - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close HDFS file handle") + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close HDFS file handle"); if (file != NULL) file = H5FL_FREE(H5FD_hdfs_t, file); } /* end if null return value (error) */ @@ -924,7 +873,7 @@ H5FD__hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr * or "meta" (any other flag) * * Prints filename and listing of total number of reads and bytes read, - * both as a grand total and separate meta- and rawdata reads. + * both as a grand total and separate meta- and raw data reads. * * If any reads were done, prints out two tables: * @@ -959,8 +908,6 @@ H5FD__hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr * - occurs if the file passed in is invalid * - TODO: if stream is invalid? how can we check this? * - * Programmer: Jacob Smith - * *---------------------------------------------------------------------------- */ static herr_t @@ -986,13 +933,13 @@ hdfs__fprint_stats(FILE *stream, const H5FD_hdfs_t *file) FUNC_ENTER_PACKAGE if (stream == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file stream cannot be null"); if (file == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file cannot be null"); if (file->hdfs_handle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle cannot be null") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle cannot be null"); if (file->hdfs_handle->magic != HDFS_HDFST_MAGIC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle has invalid magic") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hdfs handle has invalid magic"); /******************* * AGGREGATE STATS * @@ -1025,10 +972,10 @@ hdfs__fprint_stats(FILE *stream, const H5FD_hdfs_t *file) * PRINT OVERVIEW * ******************/ - HDfprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", count_raw + count_meta, count_meta, - count_raw); - HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, - bytes_raw); + fprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", count_raw + count_meta, count_meta, + count_raw); + fprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, + bytes_raw); if (count_raw + count_meta == 0) goto done; @@ -1037,60 +984,60 @@ hdfs__fprint_stats(FILE *stream, const H5FD_hdfs_t *file) * PRINT AGGREGATE STATS * *************************/ - HDfprintf(stream, "SIZES meta raw\n"); - HDfprintf(stream, " min "); + fprintf(stream, "SIZES meta raw\n"); + fprintf(stream, " min "); if (count_meta == 0) - HDfprintf(stream, " 0.000 "); + fprintf(stream, " 0.000 "); else { re_dub = (double)min_meta; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); } if (count_raw == 0) - HDfprintf(stream, " 0.000 \n"); + fprintf(stream, " 0.000 \n"); else { re_dub = (double)min_raw; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); } - HDfprintf(stream, " avg "); + fprintf(stream, " avg "); re_dub = (double)average_meta; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)average_raw; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); - HDfprintf(stream, " max "); + fprintf(stream, " max "); re_dub = (double)max_meta; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)max_raw; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); /****************************** * PRINT INDIVIDUAL BIN STATS * ******************************/ - HDfprintf(stream, "BINS # of reads total bytes average size\n"); - HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); + fprintf(stream, "BINS # of reads total bytes average size\n"); + fprintf(stream, " up-to meta raw meta raw meta raw\n"); for (i = 0; i <= HDFS_STATS_BIN_COUNT; i++) { const hdfs_statsbin *m; @@ -1114,55 +1061,55 @@ hdfs__fprint_stats(FILE *stream, const H5FD_hdfs_t *file) if (i == HDFS_STATS_BIN_COUNT) { range_end = hdfs_stats_boundaries[i - 1]; - HDfprintf(stream, ">"); + fprintf(stream, ">"); } else - HDfprintf(stream, " "); + fprintf(stream, " "); bm_val = (double)m->bytes; for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) bm_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); + assert(suffix_i < sizeof(suffixes)); bm_suffix = suffixes[suffix_i]; br_val = (double)r->bytes; for (suffix_i = 0; br_val >= 1024.0; suffix_i++) br_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); + assert(suffix_i < sizeof(suffixes)); br_suffix = suffixes[suffix_i]; if (m->count > 0) am_val = (double)(m->bytes) / (double)(m->count); for (suffix_i = 0; am_val >= 1024.0; suffix_i++) am_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); + assert(suffix_i < sizeof(suffixes)); am_suffix = suffixes[suffix_i]; if (r->count > 0) ar_val = (double)(r->bytes) / (double)(r->count); for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) ar_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); + assert(suffix_i < sizeof(suffixes)); ar_suffix = suffixes[suffix_i]; re_dub = (double)range_end; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - - HDfprintf(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, - suffixes[suffix_i], /* bin ceiling */ - m->count, /* metadata reads */ - r->count, /* rawdata reads */ - bm_val, bm_suffix, /* metadata bytes */ - br_val, br_suffix, /* rawdata bytes */ - am_val, am_suffix, /* metadata average */ - ar_val, ar_suffix); /* rawdata average */ - HDfflush(stream); + assert(suffix_i < sizeof(suffixes)); + + fprintf(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, + suffixes[suffix_i], /* bin ceiling */ + m->count, /* metadata reads */ + r->count, /* raw data reads */ + bm_val, bm_suffix, /* metadata bytes */ + br_val, br_suffix, /* raw data bytes */ + am_val, am_suffix, /* metadata average */ + ar_val, ar_suffix); /* raw data average */ + fflush(stream); } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* hdfs__fprint_stats */ #endif /* HDFS_STATS */ @@ -1178,9 +1125,6 @@ hdfs__fprint_stats(FILE *stream, const H5FD_hdfs_t *file) * * SUCCEED/FAIL * - * Programmer: Jacob Smith - * 2017-11-02 - * *------------------------------------------------------------------------- */ static herr_t @@ -1192,23 +1136,23 @@ H5FD__hdfs_close(H5FD_t *_file) FUNC_ENTER_PACKAGE #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif /* Sanity checks */ - HDassert(file != NULL); - HDassert(file->hdfs_handle != NULL); - HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); + assert(file != NULL); + assert(file->hdfs_handle != NULL); + assert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); /* Close the underlying request handle */ if (file->hdfs_handle != NULL) if (FAIL == H5FD__hdfs_handle_close(file->hdfs_handle)) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close HDFS file handle") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close HDFS file handle"); #if HDFS_STATS /* TODO: mechanism to re-target stats printout */ if (FAIL == hdfs__fprint_stats(stdout, file)) - HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics") + HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics"); #endif /* HDFS_STATS */ /* Release the file info */ @@ -1231,9 +1175,6 @@ H5FD__hdfs_close(H5FD_t *_file) * Equivalent: 0 * Not Equivalent: -1 * - * Programmer: Gerd Herber - * May 2018 - * *------------------------------------------------------------------------- */ static int @@ -1248,18 +1189,18 @@ H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_PACKAGE_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ - HDassert(f1->hdfs_handle != NULL); - HDassert(f2->hdfs_handle != NULL); - HDassert(f1->hdfs_handle->magic == HDFS_HDFST_MAGIC); - HDassert(f2->hdfs_handle->magic == HDFS_HDFST_MAGIC); + assert(f1->hdfs_handle != NULL); + assert(f2->hdfs_handle != NULL); + assert(f1->hdfs_handle->magic == HDFS_HDFST_MAGIC); + assert(f2->hdfs_handle->magic == HDFS_HDFST_MAGIC); finfo1 = f1->hdfs_handle->fileinfo; finfo2 = f2->hdfs_handle->fileinfo; - HDassert(finfo1 != NULL); - HDassert(finfo2 != NULL); + assert(finfo1 != NULL); + assert(finfo2 != NULL); if (finfo1->mKind != finfo2->mKind) { HGOTO_DONE(-1); @@ -1310,9 +1251,6 @@ H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * * Return: SUCCEED (Can't fail) * - * Programmer: John Mainzer - * 9/11/17 - * *------------------------------------------------------------------------- */ static herr_t @@ -1321,7 +1259,7 @@ H5FD__hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) FUNC_ENTER_PACKAGE_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif if (flags) { @@ -1346,9 +1284,6 @@ H5FD__hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) * * The end-of-address marker. * - * Programmer: Jacob Smith - * 2017-11-02 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1359,7 +1294,7 @@ H5FD__hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_PACKAGE_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif FUNC_LEAVE_NOAPI(file->eoa) @@ -1377,9 +1312,6 @@ H5FD__hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * SUCCEED (can't fail) * - * Programmer: Jacob Smith - * 2017-11-03 - * *------------------------------------------------------------------------- */ static herr_t @@ -1390,7 +1322,7 @@ H5FD__hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_ENTER_PACKAGE_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif file->eoa = addr; @@ -1411,9 +1343,6 @@ H5FD__hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) * EOF: the first address past the end of the "file", either the * filesystem file or the HDF5 file. * - * Programmer: Jacob Smith - * 2017-11-02 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1424,11 +1353,11 @@ H5FD__hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_PACKAGE_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif - HDassert(file->hdfs_handle != NULL); - HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); + assert(file->hdfs_handle != NULL); + assert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); FUNC_LEAVE_NOAPI((size_t)file->hdfs_handle->fileinfo->mSize) } /* end H5FD__hdfs_get_eof() */ @@ -1445,9 +1374,6 @@ H5FD__hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * SUCCEED/FAIL * - * Programmer: Jacob Smith - * 2017-11-02 - * *------------------------------------------------------------------------- */ static herr_t @@ -1459,11 +1385,11 @@ H5FD__hdfs_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand FUNC_ENTER_PACKAGE #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ if (!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); *file_handle = file->hdfs_handle; @@ -1488,9 +1414,6 @@ H5FD__hdfs_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand * - Unable to complete read. * - Contents of buffer `buf` are undefined. * - * Programmer: Jacob Smith - * 2017-11-?? - * *------------------------------------------------------------------------- */ static herr_t @@ -1509,22 +1432,22 @@ H5FD__hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU FUNC_ENTER_PACKAGE #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ - HDassert(file != NULL); - HDassert(file->hdfs_handle != NULL); - HDassert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); - HDassert(buf != NULL); + assert(file != NULL); + assert(file->hdfs_handle != NULL); + assert(file->hdfs_handle->magic == HDFS_HDFST_MAGIC); + assert(buf != NULL); filesize = (size_t)file->hdfs_handle->fileinfo->mSize; if ((addr > filesize) || ((addr + size) > filesize)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address"); if (FAIL == hdfsPread(file->hdfs_handle->filesystem, file->hdfs_handle->file, (tOffset)addr, buf, (tSize)size)) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read"); #if HDFS_STATS @@ -1567,9 +1490,6 @@ H5FD__hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU * * FAIL (Not possible with Read-Only S3 file.) * - * Programmer: Jacob Smith - * 2017-10-23 - * *------------------------------------------------------------------------- */ static herr_t @@ -1581,10 +1501,10 @@ H5FD__hdfs_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, h FUNC_ENTER_PACKAGE #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1605,9 +1525,6 @@ H5FD__hdfs_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, h * * FAIL (Not possible on Read-Only S3 files.) * - * Programmer: Jacob Smith - * 2017-10-23 - * *------------------------------------------------------------------------- */ static herr_t @@ -1619,10 +1536,10 @@ H5FD__hdfs_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, FUNC_ENTER_PACKAGE #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", __func__); + fprintf(stdout, "called %s.\n", __func__); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDint.c index d8c62030b5..fcc1b6c6fc 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -36,6 +35,7 @@ #include "H5FDpkg.h" /* File Drivers */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5PLprivate.h" /* Plugins */ /****************/ @@ -62,17 +62,17 @@ /************************************************************************* * - * H5FD_vsrt_tmp_t + * H5FD_srt_tmp_t * - * Structure used to store vector I/O request addresses and the associated + * Structure used to store I/O request addresses and the associated * indexes in the addrs[] array for the purpose of determine the sorted * order. * - * This is done by allocating an array of H5FD_vsrt_tmp_t of length + * This is done by allocating an array of H5FD_srt_tmp_t of length * count, loading it with the contents of the addrs[] array and the * associated indices, and then sorting it. * - * This sorted array of H5FD_vsrt_tmp_t is then used to populate sorted + * This sorted array of H5FD_srt_tmp_t is then used to populate sorted * versions of the types[], addrs[], sizes[] and bufs[] vectors. * * addr: haddr_t containing the value of addrs[i], @@ -82,10 +82,10 @@ * *************************************************************************/ -typedef struct H5FD_vsrt_tmp_t { +typedef struct H5FD_srt_tmp_t { haddr_t addr; size_t index; -} H5FD_vsrt_tmp_t; +} H5FD_srt_tmp_t; /* Information needed for iterating over the registered VFD hid_t IDs. * The name or value of the new VFD that is being registered is stored @@ -109,12 +109,14 @@ typedef struct H5FD_get_driver_ud_t { /* Local Prototypes */ /********************/ static int H5FD__get_driver_cb(void *obj, hid_t id, void *_op_data); -static herr_t H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, - H5S_t **mem_spaces, H5S_t **file_spaces, haddr_t offsets[], - size_t element_sizes[], void *bufs[] /* out */); -static herr_t H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, - H5S_t **mem_spaces, H5S_t **file_spaces, haddr_t offsets[], - size_t element_sizes[], const void *bufs[]); +static herr_t H5FD__read_selection_translate(uint32_t skip_vector_cb, H5FD_t *file, H5FD_mem_t type, + hid_t dxpl_id, uint32_t count, H5S_t **mem_spaces, + H5S_t **file_spaces, haddr_t offsets[], size_t element_sizes[], + void *bufs[] /* out */); +static herr_t H5FD__write_selection_translate(uint32_t skip_vector_cb, H5FD_t *file, H5FD_mem_t type, + hid_t dxpl_id, uint32_t count, H5S_t **mem_spaces, + H5S_t **file_spaces, haddr_t offsets[], size_t element_sizes[], + const void *bufs[]); /*********************/ /* Package Variables */ @@ -156,15 +158,15 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) FUNC_ENTER_NOAPI_NOINIT /* Sanity checks */ - HDassert(file); - HDassert(sig_addr); + assert(file); + assert(sig_addr); /* Find the least N such that 2^N is larger than the file size */ eof = H5FD_get_eof(file, H5FD_MEM_SUPER); eoa = H5FD_get_eoa(file, H5FD_MEM_SUPER); addr = MAX(eof, eoa); if (HADDR_UNDEF == addr) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to obtain EOF/EOA value") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to obtain EOF/EOA value"); for (maxpow = 0; addr; maxpow++) addr >>= 1; maxpow = MAX(maxpow, 9); @@ -175,10 +177,10 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) for (n = 8; n < maxpow; n++) { addr = (8 == n) ? 0 : (haddr_t)1 << n; if (H5FD_set_eoa(file, H5FD_MEM_SUPER, addr + H5F_SIGNATURE_LEN) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to set EOA value for file signature") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to set EOA value for file signature"); if (H5FD_read(file, H5FD_MEM_SUPER, addr, (size_t)H5F_SIGNATURE_LEN, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature") - if (!HDmemcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to read file signature"); + if (!memcmp(buf, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN)) break; } @@ -187,7 +189,7 @@ H5FD_locate_signature(H5FD_t *file, haddr_t *sig_addr) */ if (n >= maxpow) { if (H5FD_set_eoa(file, H5FD_MEM_SUPER, eoa) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value") + HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to reset EOA value"); *sig_addr = HADDR_UNDEF; } else @@ -216,9 +218,9 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf /* FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert(buf); + assert(file); + assert(file->cls); + assert(buf); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); @@ -230,7 +232,7 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf /* * collective transfer. */ if (0 == size) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); #endif /* H5_HAVE_PARALLEL */ /* If the file is open for SWMR read access, allow access to data past @@ -243,17 +245,17 @@ H5FD_read(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, void *buf /* haddr_t eoa; if (HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed"); if ((addr + file->base_addr + size) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu, eoa = %llu", (unsigned long long)(addr + file->base_addr), (unsigned long long)size, - (unsigned long long)eoa) + (unsigned long long)eoa); } /* Dispatch to driver */ if ((file->cls->read)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -278,9 +280,9 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert(buf); + assert(file); + assert(file->cls); + assert(buf); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); @@ -292,19 +294,19 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void * collective transfer. */ if (0 == size) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); #endif /* H5_HAVE_PARALLEL */ if (HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed"); if ((addr + file->base_addr + size) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size=%llu, eoa=%llu", (unsigned long long)(addr + file->base_addr), (unsigned long long)size, - (unsigned long long)eoa) + (unsigned long long)eoa); /* Dispatch to driver */ if ((file->cls->write)(file, type, dxpl_id, addr + file->base_addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -345,10 +347,6 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, haddr_t addr, size_t size, const void * Failure: FAIL * The contents of supplied buffers are undefined. * - * Programmer: JRM -- 6/10/20 - * - * Changes: None - * *------------------------------------------------------------------------- */ herr_t @@ -359,26 +357,26 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs hbool_t extend_sizes = FALSE; hbool_t extend_types = FALSE; uint32_t i; - size_t size; - H5FD_mem_t type; + size_t size = 0; + H5FD_mem_t type = H5FD_MEM_DEFAULT; hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert((types) || (count == 0)); - HDassert((addrs) || (count == 0)); - HDassert((sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(file); + assert(file->cls); + assert((types) || (count == 0)); + assert((addrs) || (count == 0)); + assert((sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* verify that the first elements of the sizes and types arrays are * valid. */ - HDassert((count == 0) || (sizes[0] != 0)); - HDassert((count == 0) || (types[0] != H5FD_MEM_NOLIST)); + assert((count == 0) || (sizes[0] != 0)); + assert((count == 0) || (types[0] != H5FD_MEM_NOLIST)); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); @@ -390,7 +388,7 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs * collective transfer. */ if (0 == count) { - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } #endif /* H5_HAVE_PARALLEL */ @@ -447,14 +445,14 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs } if (HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed"); if ((addrs[i] + size) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addrs[%d] = %llu, sizes[%d] = %llu, eoa = %llu", (int)i, (unsigned long long)(addrs[i]), (int)i, (unsigned long long)size, - (unsigned long long)eoa) + (unsigned long long)eoa); } } @@ -463,7 +461,7 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs if ((file->cls->read_vector)(file, dxpl_id, count, types, addrs, sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read vector request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read vector request failed"); } else { @@ -472,6 +470,7 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs */ extend_sizes = FALSE; extend_types = FALSE; + uint32_t no_selection_io_cause; for (i = 0; i < count; i++) { @@ -506,15 +505,20 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs } if ((file->cls->read)(file, type, dxpl_id, addrs[i], size, bufs[i]) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed"); } + + /* Add H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB to no selection I/O cause */ + H5CX_get_no_selection_io_cause(&no_selection_io_cause); + no_selection_io_cause |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB; + H5CX_set_no_selection_io_cause(no_selection_io_cause); } done: /* undo the base addr offset to the addrs array if necessary */ if (addrs_cooked) { - HDassert(file->base_addr > 0); + assert(file->base_addr > 0); for (i = 0; i < count; i++) { @@ -557,10 +561,6 @@ H5FD_read_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addrs * Failure: FAIL * One or more writes failed. * - * Programmer: JRM -- 6/10/20 - * - * Changes: None - * *------------------------------------------------------------------------- */ herr_t @@ -571,8 +571,8 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr hbool_t extend_sizes = FALSE; hbool_t extend_types = FALSE; uint32_t i; - size_t size; - H5FD_mem_t type; + size_t size = 0; + H5FD_mem_t type = H5FD_MEM_DEFAULT; hid_t dxpl_id; /* DXPL for operation */ haddr_t eoa = HADDR_UNDEF; /* EOA for file */ herr_t ret_value = SUCCEED; /* Return value */ @@ -580,18 +580,18 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert((types) || (count == 0)); - HDassert((addrs) || (count == 0)); - HDassert((sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(file); + assert(file->cls); + assert((types) || (count == 0)); + assert((addrs) || (count == 0)); + assert((sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* verify that the first elements of the sizes and types arrays are * valid. */ - HDassert((count == 0) || (sizes[0] != 0)); - HDassert((count == 0) || (types[0] != H5FD_MEM_NOLIST)); + assert((count == 0) || (sizes[0] != 0)); + assert((count == 0) || (types[0] != H5FD_MEM_NOLIST)); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); @@ -603,7 +603,7 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr * collective transfer. */ if (0 == count) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); #endif /* H5_HAVE_PARALLEL */ if (file->base_addr > 0) { @@ -651,14 +651,14 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr if (HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed"); if ((addrs[i] + size) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addrs[%d] = %llu, sizes[%d] = %llu, \ eoa = %llu", (int)i, (unsigned long long)(addrs[i]), (int)i, (unsigned long long)size, - (unsigned long long)eoa) + (unsigned long long)eoa); } /* if the underlying VFD supports vector write, make the call */ @@ -666,7 +666,7 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr if ((file->cls->write_vector)(file, dxpl_id, count, types, addrs, sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write vector request failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write vector request failed"); } else { /* otherwise, implement the vector write as a sequence of regular @@ -674,6 +674,7 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr */ extend_sizes = FALSE; extend_types = FALSE; + uint32_t no_selection_io_cause; for (i = 0; i < count; i++) { @@ -708,15 +709,20 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr } if ((file->cls->write)(file, type, dxpl_id, addrs[i], size, bufs[i]) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver write request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver write request failed"); } + + /* Add H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB to no selection I/O cause */ + H5CX_get_no_selection_io_cause(&no_selection_io_cause); + no_selection_io_cause |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB; + H5CX_set_no_selection_io_cause(no_selection_io_cause); } done: /* undo the base addr offset to the addrs array if necessary */ if (addrs_cooked) { - HDassert(file->base_addr > 0); + assert(file->base_addr > 0); for (i = 0; i < count; i++) { @@ -730,8 +736,8 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr * Function: H5FD__read_selection_translate * * Purpose: Translates a selection read call to a vector read call if - * vector reads are supported, or a series of scalar read - * calls otherwise. + * vector reads are supported and !skip_vector_cb, + * or a series of scalar read calls otherwise. * * Return: Success: SUCCEED * All reads have completed successfully, and @@ -741,23 +747,19 @@ H5FD_write_vector(H5FD_t *file, uint32_t count, H5FD_mem_t types[], haddr_t addr * Failure: FAIL * The contents of supplied buffers are undefined. * - * Programmer: NAF -- 5/13/21 - * - * Changes: None - * *------------------------------------------------------------------------- */ static herr_t -H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, - H5S_t **mem_spaces, H5S_t **file_spaces, haddr_t offsets[], +H5FD__read_selection_translate(uint32_t skip_vector_cb, H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, + uint32_t count, H5S_t **mem_spaces, H5S_t **file_spaces, haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */) { hbool_t extend_sizes = FALSE; hbool_t extend_bufs = FALSE; uint32_t i; - size_t element_size; - void *buf; - hbool_t use_vector = FALSE; + size_t element_size = 0; + void *buf = NULL; + hbool_t use_vector = FALSE; haddr_t addrs_local[H5FD_LOCAL_VECTOR_LEN]; haddr_t *addrs = addrs_local; size_t sizes_local[H5FD_LOCAL_VECTOR_LEN]; @@ -788,28 +790,28 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert((mem_spaces) || (count == 0)); - HDassert((file_spaces) || (count == 0)); - HDassert((offsets) || (count == 0)); - HDassert((element_sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(file); + assert(file->cls); + assert((mem_spaces) || (count == 0)); + assert((file_spaces) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* Check if we're using vector I/O */ - use_vector = file->cls->read_vector != NULL; + use_vector = (file->cls->read_vector != NULL) && (!skip_vector_cb); if (count > 0) { /* Verify that the first elements of the element_sizes and bufs arrays are * valid. */ - HDassert(element_sizes[0] != 0); - HDassert(bufs[0] != NULL); + assert(element_sizes[0] != 0); + assert(bufs[0] != NULL); /* Allocate sequence lists for memory and file spaces */ if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate file selection iterator") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate file selection iterator"); if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate memory selection iterator") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate memory selection iterator"); } /* Loop over dataspaces */ @@ -846,23 +848,23 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin /* Initialize sequence lists for memory and file spaces */ if (H5S_select_iter_init(file_iter, file_spaces[i], element_size, 0) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize sequence list for file space") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize sequence list for file space"); file_iter_init = TRUE; if (H5S_select_iter_init(mem_iter, mem_spaces[i], element_size, 0) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize sequence list for memory space") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize sequence list for memory space"); mem_iter_init = TRUE; /* Get the number of elements in selection */ if ((hss_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(file_spaces[i])) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCOUNT, FAIL, "can't get number of elements selected") + HGOTO_ERROR(H5E_VFL, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); H5_CHECKED_ASSIGN(nelmts, size_t, hss_nelmts, hssize_t); #ifndef NDEBUG /* Verify mem space has the same number of elements */ { if ((hss_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(mem_spaces[i])) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCOUNT, FAIL, "can't get number of elements selected") - HDassert((hssize_t)nelmts == hss_nelmts); + HGOTO_ERROR(H5E_VFL, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); + assert((hssize_t)nelmts == hss_nelmts); } #endif /* NDEBUG */ @@ -879,24 +881,24 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin if (file_seq_i == H5FD_SEQ_LIST_LEN) { if (H5S_SELECT_ITER_GET_SEQ_LIST(file_iter, H5FD_SEQ_LIST_LEN, SIZE_MAX, &file_nseq, &seq_nelem, file_off, file_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - HDassert(file_nseq > 0); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); + assert(file_nseq > 0); nelmts -= seq_nelem; file_seq_i = 0; } - HDassert(file_seq_i < file_nseq); + assert(file_seq_i < file_nseq); /* Fill/refill memory sequence list if necessary */ if (mem_seq_i == H5FD_SEQ_LIST_LEN) { if (H5S_SELECT_ITER_GET_SEQ_LIST(mem_iter, H5FD_SEQ_LIST_LEN, SIZE_MAX, &mem_nseq, &seq_nelem, mem_off, mem_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - HDassert(mem_nseq > 0); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); + assert(mem_nseq > 0); mem_seq_i = 0; } - HDassert(mem_seq_i < mem_nseq); + assert(mem_seq_i < mem_nseq); /* Calculate length of this IO */ io_len = MIN(file_len[file_seq_i], mem_len[mem_seq_i]); @@ -907,19 +909,19 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin if (vec_arr_nused == vec_arr_nalloc) { /* Check if we're using the static arrays */ if (addrs == addrs_local) { - HDassert(sizes == sizes_local); - HDassert(vec_bufs == vec_bufs_local); + assert(sizes == sizes_local); + assert(vec_bufs == vec_bufs_local); /* Allocate dynamic arrays */ if (NULL == (addrs = H5MM_malloc(sizeof(addrs_local) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for address list") + "memory allocation failed for address list"); if (NULL == (sizes = H5MM_malloc(sizeof(sizes_local) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for size list") + "memory allocation failed for size list"); if (NULL == (vec_bufs = H5MM_malloc(sizeof(vec_bufs_local) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for buffer list") + "memory allocation failed for buffer list"); /* Copy the existing data */ (void)H5MM_memcpy(addrs, addrs_local, sizeof(addrs_local)); @@ -932,16 +934,16 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin /* Reallocate arrays */ if (NULL == (tmp_ptr = H5MM_realloc(addrs, vec_arr_nalloc * sizeof(*addrs) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory reallocation failed for address list") + "memory reallocation failed for address list"); addrs = tmp_ptr; if (NULL == (tmp_ptr = H5MM_realloc(sizes, vec_arr_nalloc * sizeof(*sizes) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory reallocation failed for size list") + "memory reallocation failed for size list"); sizes = tmp_ptr; if (NULL == (tmp_ptr = H5MM_realloc(vec_bufs, vec_arr_nalloc * sizeof(*vec_bufs) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory reallocation failed for buffer list") + "memory reallocation failed for buffer list"); vec_bufs = tmp_ptr; } @@ -959,7 +961,7 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin /* Issue scalar read call */ if ((file->cls->read)(file, type, dxpl_id, offsets[i] + file_off[file_seq_i], io_len, (void *)((uint8_t *)buf + mem_off[mem_seq_i])) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read request failed"); /* Update file sequence */ if (io_len == file_len[file_seq_i]) @@ -980,35 +982,44 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin /* Make sure both memory and file sequences terminated at the same time */ if (mem_seq_i < mem_nseq) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "file selection terminated before memory selection") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, + "file selection terminated before memory selection"); /* Terminate iterators */ if (H5S_SELECT_ITER_RELEASE(file_iter) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release file selection iterator") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release file selection iterator"); file_iter_init = FALSE; if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release memory selection iterator") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release memory selection iterator"); mem_iter_init = FALSE; } /* Issue vector read call if appropriate */ if (use_vector) { - H5_CHECK_OVERFLOW(vec_arr_nused, size_t, uint32_t) + H5_CHECK_OVERFLOW(vec_arr_nused, size_t, uint32_t); if ((file->cls->read_vector)(file, dxpl_id, (uint32_t)vec_arr_nused, types, addrs, sizes, vec_bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read vector request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read vector request failed"); + } + else { + uint32_t no_selection_io_cause; + + /* Add H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB to no selection I/O cause */ + H5CX_get_no_selection_io_cause(&no_selection_io_cause); + no_selection_io_cause |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB; + H5CX_set_no_selection_io_cause(no_selection_io_cause); } done: /* Terminate and free iterators */ if (file_iter) { if (file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release file selection iterator") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release file selection iterator"); file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter); } if (mem_iter) { if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release memory selection iterator") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release memory selection iterator"); mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter); } @@ -1023,9 +1034,9 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin } /* Make sure we cleaned up */ - HDassert(!addrs || addrs == addrs_local); - HDassert(!sizes || sizes == sizes_local); - HDassert(!vec_bufs || vec_bufs == vec_bufs_local); + assert(!addrs || addrs == addrs_local); + assert(!sizes || sizes == sizes_local); + assert(!vec_bufs || vec_bufs == vec_bufs_local); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__read_selection_translate() */ @@ -1054,8 +1065,8 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin * If the underlying VFD supports selection reads, pass the * call through directly. * - * If it doesn't, convert the vector read into a sequence - * of individual reads. + * If it doesn't, convert the selection read into a sequence + * of vector or scalar reads. * * Return: Success: SUCCEED * All reads have completed successfully, and @@ -1065,10 +1076,6 @@ H5FD__read_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uin * Failure: FAIL * The contents of supplied buffers are undefined. * - * Programmer: NAF -- 3/29/21 - * - * Changes: None - * *------------------------------------------------------------------------- */ herr_t @@ -1088,18 +1095,18 @@ H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_s FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert((mem_spaces) || (count == 0)); - HDassert((file_spaces) || (count == 0)); - HDassert((offsets) || (count == 0)); - HDassert((element_sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(file); + assert(file->cls); + assert((mem_spaces) || (count == 0)); + assert((file_spaces) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* Verify that the first elements of the element_sizes and bufs arrays are * valid. */ - HDassert((count == 0) || (element_sizes[0] != 0)); - HDassert((count == 0) || (bufs[0] != NULL)); + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0] != NULL)); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); @@ -1111,7 +1118,7 @@ H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_s * collective transfer. */ if (0 == count) { - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } #endif /* H5_HAVE_PARALLEL */ @@ -1141,14 +1148,14 @@ H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_s haddr_t eoa; if (HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed"); for (i = 0; i < count; i++) { if ((offsets[i]) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, offsets[%d] = %llu, eoa = %llu", - (int)i, (unsigned long long)(offsets[i]), (unsigned long long)eoa) + (int)i, (unsigned long long)(offsets[i]), (unsigned long long)eoa); } } @@ -1158,41 +1165,41 @@ H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_s * buffers */ if (count > sizeof(mem_space_ids_local) / sizeof(mem_space_ids_local[0])) { if (NULL == (mem_space_ids = H5MM_malloc(count * sizeof(hid_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list"); if (NULL == (file_space_ids = H5MM_malloc(count * sizeof(hid_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list"); } /* Create IDs for all dataspaces */ for (; num_spaces < count; num_spaces++) { if ((mem_space_ids[num_spaces] = H5I_register(H5I_DATASPACE, mem_spaces[num_spaces], TRUE)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); if ((file_space_ids[num_spaces] = H5I_register(H5I_DATASPACE, file_spaces[num_spaces], TRUE)) < 0) { - if (H5I_dec_app_ref(mem_space_ids[num_spaces]) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "problem freeing id") - HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + if (NULL == H5I_remove(mem_space_ids[num_spaces])) + HDONE_ERROR(H5E_VFL, H5E_CANTREMOVE, FAIL, "problem removing id"); + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); } } if ((file->cls->read_selection)(file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read selection request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read selection request failed"); } else /* Otherwise, implement the selection read as a sequence of regular * or vector read calls. */ - if (H5FD__read_selection_translate(file, type, dxpl_id, count, mem_spaces, file_spaces, offsets, - element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "translation to vector or scalar read failed") + if (H5FD__read_selection_translate(SKIP_NO_CB, file, type, dxpl_id, count, mem_spaces, file_spaces, + offsets, element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "translation to vector or scalar read failed"); done: /* undo the base addr offset to the offsets array if necessary */ if (offsets_cooked) { - HDassert(file->base_addr > 0); + assert(file->base_addr > 0); for (i = 0; i < count; i++) { @@ -1200,12 +1207,14 @@ H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_s } } - /* Cleanup dataspace arrays */ + /* Cleanup dataspace arrays. Use H5I_remove() so we only close the IDs and + * not the underlying dataspaces, which were not created by this function. + */ for (i = 0; i < num_spaces; i++) { - if (H5I_dec_app_ref(mem_space_ids[i]) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "problem freeing id") - if (H5I_dec_app_ref(file_space_ids[i]) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "problem freeing id") + if (NULL == H5I_remove(mem_space_ids[i])) + HDONE_ERROR(H5E_VFL, H5E_CANTREMOVE, FAIL, "problem removing id"); + if (NULL == H5I_remove(file_space_ids[i])) + HDONE_ERROR(H5E_VFL, H5E_CANTREMOVE, FAIL, "problem removing id"); } if (mem_space_ids != mem_space_ids_local) mem_space_ids = H5MM_xfree(mem_space_ids); @@ -1221,6 +1230,15 @@ H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_s * Purpose: Like H5FD_read_selection(), but takes hid_t arrays instead * of H5S_t * arrays for the dataspaces. * + * Depending on the parameter skip_cb which is translated into + * skip_selection_cb and skip_vector_cb: + * + * --If the underlying VFD supports selection reads and !skip_selection_cb, + * pass the call through directly. + * + * --If it doesn't, convert the selection reads into a sequence of vector or + * scalar reads depending on skip_vector_cb. + * * Return: Success: SUCCEED * All reads have completed successfully, and * the results havce been into the supplied @@ -1229,14 +1247,10 @@ H5FD_read_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_s * Failure: FAIL * The contents of supplied buffers are undefined. * - * Programmer: NAF -- 5/19/21 - * - * Changes: None - * *------------------------------------------------------------------------- */ herr_t -H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], +H5FD_read_selection_id(uint32_t skip_cb, H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], void *bufs[] /* out */) { @@ -1247,23 +1261,25 @@ H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_ H5S_t **file_spaces = file_spaces_local; hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */ uint32_t i; + uint32_t skip_selection_cb; + uint32_t skip_vector_cb; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert((mem_space_ids) || (count == 0)); - HDassert((file_space_ids) || (count == 0)); - HDassert((offsets) || (count == 0)); - HDassert((element_sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(file); + assert(file->cls); + assert((mem_space_ids) || (count == 0)); + assert((file_space_ids) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* Verify that the first elements of the element_sizes and bufs arrays are * valid. */ - HDassert((count == 0) || (element_sizes[0] != 0)); - HDassert((count == 0) || (bufs[0] != NULL)); + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0] != NULL)); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); @@ -1275,10 +1291,13 @@ H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_ * collective transfer. */ if (0 == count) { - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } #endif /* H5_HAVE_PARALLEL */ + skip_selection_cb = skip_cb & SKIP_SELECTION_CB; + skip_vector_cb = skip_cb & SKIP_VECTOR_CB; + if (file->base_addr > 0) { /* apply the base_addr offset to the offsets array. Must undo before @@ -1305,22 +1324,22 @@ H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_ haddr_t eoa; if (HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed"); for (i = 0; i < count; i++) { if ((offsets[i]) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, offsets[%d] = %llu, eoa = %llu", - (int)i, (unsigned long long)(offsets[i]), (unsigned long long)eoa) + (int)i, (unsigned long long)(offsets[i]), (unsigned long long)eoa); } } /* if the underlying VFD supports selection read, make the call */ - if (file->cls->read_selection) { + if (!skip_selection_cb && file->cls->read_selection) { if ((file->cls->read_selection)(file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read selection request failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "driver read selection request failed"); } else { /* Otherwise, implement the selection read as a sequence of regular @@ -1331,30 +1350,31 @@ H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_ * buffers */ if (count > sizeof(mem_spaces_local) / sizeof(mem_spaces_local[0])) { if (NULL == (mem_spaces = H5MM_malloc(count * sizeof(H5S_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list"); if (NULL == (file_spaces = H5MM_malloc(count * sizeof(H5S_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list"); } /* Get object pointers for all dataspaces */ for (i = 0; i < count; i++) { if (NULL == (mem_spaces[i] = (H5S_t *)H5I_object_verify(mem_space_ids[i], H5I_DATASPACE))) - HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve memory dataspace from ID") + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve memory dataspace from ID"); if (NULL == (file_spaces[i] = (H5S_t *)H5I_object_verify(file_space_ids[i], H5I_DATASPACE))) - HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve file dataspace from ID") + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve file dataspace from ID"); } /* Translate to vector or scalar I/O */ - if (H5FD__read_selection_translate(file, type, dxpl_id, count, mem_spaces, file_spaces, offsets, - element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "translation to vector or scalar read failed") + + if (H5FD__read_selection_translate(skip_vector_cb, file, type, dxpl_id, count, mem_spaces, + file_spaces, offsets, element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "translation to vector or scalar read failed"); } done: /* undo the base addr offset to the offsets array if necessary */ if (offsets_cooked) { - HDassert(file->base_addr > 0); + assert(file->base_addr > 0); for (i = 0; i < count; i++) { @@ -1375,8 +1395,8 @@ H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_ * Function: H5FD__write_selection_translate * * Purpose: Translates a selection write call to a vector write call - * if vector writes are supported, or a series of scalar - * write calls otherwise. + * if vector writes are supported and !skip_vector_cb, + * or a series of scalar write calls otherwise. * * Return: Success: SUCCEED * All writes have completed successfully. @@ -1384,23 +1404,19 @@ H5FD_read_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_ * Failure: FAIL * One or more writes failed. * - * Programmer: NAF -- 5/13/21 - * - * Changes: None - * *------------------------------------------------------------------------- */ static herr_t -H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, uint32_t count, - H5S_t **mem_spaces, H5S_t **file_spaces, haddr_t offsets[], +H5FD__write_selection_translate(uint32_t skip_vector_cb, H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, + uint32_t count, H5S_t **mem_spaces, H5S_t **file_spaces, haddr_t offsets[], size_t element_sizes[], const void *bufs[]) { hbool_t extend_sizes = FALSE; hbool_t extend_bufs = FALSE; uint32_t i; - size_t element_size; - const void *buf; - hbool_t use_vector = FALSE; + size_t element_size = 0; + const void *buf = NULL; + hbool_t use_vector = FALSE; haddr_t addrs_local[H5FD_LOCAL_VECTOR_LEN]; haddr_t *addrs = addrs_local; size_t sizes_local[H5FD_LOCAL_VECTOR_LEN]; @@ -1431,28 +1447,28 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert((mem_spaces) || (count == 0)); - HDassert((file_spaces) || (count == 0)); - HDassert((offsets) || (count == 0)); - HDassert((element_sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(file); + assert(file->cls); + assert((mem_spaces) || (count == 0)); + assert((file_spaces) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* Check if we're using vector I/O */ - use_vector = file->cls->write_vector != NULL; + use_vector = (file->cls->write_vector != NULL) && (!skip_vector_cb); if (count > 0) { /* Verify that the first elements of the element_sizes and bufs arrays are * valid. */ - HDassert(element_sizes[0] != 0); - HDassert(bufs[0] != NULL); + assert(element_sizes[0] != 0); + assert(bufs[0] != NULL); /* Allocate sequence lists for memory and file spaces */ if (NULL == (file_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate file selection iterator") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate file selection iterator"); if (NULL == (mem_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate memory selection iterator") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "couldn't allocate memory selection iterator"); } /* Loop over dataspaces */ @@ -1489,23 +1505,23 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui /* Initialize sequence lists for memory and file spaces */ if (H5S_select_iter_init(file_iter, file_spaces[i], element_size, 0) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize sequence list for file space") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize sequence list for file space"); file_iter_init = TRUE; if (H5S_select_iter_init(mem_iter, mem_spaces[i], element_size, 0) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize sequence list for memory space") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize sequence list for memory space"); mem_iter_init = TRUE; /* Get the number of elements in selection */ if ((hss_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(file_spaces[i])) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCOUNT, FAIL, "can't get number of elements selected") + HGOTO_ERROR(H5E_VFL, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); H5_CHECKED_ASSIGN(nelmts, size_t, hss_nelmts, hssize_t); #ifndef NDEBUG /* Verify mem space has the same number of elements */ { if ((hss_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(mem_spaces[i])) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCOUNT, FAIL, "can't get number of elements selected") - HDassert((hssize_t)nelmts == hss_nelmts); + HGOTO_ERROR(H5E_VFL, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); + assert((hssize_t)nelmts == hss_nelmts); } #endif /* NDEBUG */ @@ -1522,24 +1538,24 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui if (file_seq_i == H5FD_SEQ_LIST_LEN) { if (H5S_SELECT_ITER_GET_SEQ_LIST(file_iter, H5FD_SEQ_LIST_LEN, SIZE_MAX, &file_nseq, &seq_nelem, file_off, file_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - HDassert(file_nseq > 0); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); + assert(file_nseq > 0); nelmts -= seq_nelem; file_seq_i = 0; } - HDassert(file_seq_i < file_nseq); + assert(file_seq_i < file_nseq); /* Fill/refill memory sequence list if necessary */ if (mem_seq_i == H5FD_SEQ_LIST_LEN) { if (H5S_SELECT_ITER_GET_SEQ_LIST(mem_iter, H5FD_SEQ_LIST_LEN, SIZE_MAX, &mem_nseq, &seq_nelem, mem_off, mem_len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") - HDassert(mem_nseq > 0); + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); + assert(mem_nseq > 0); mem_seq_i = 0; } - HDassert(mem_seq_i < mem_nseq); + assert(mem_seq_i < mem_nseq); /* Calculate length of this IO */ io_len = MIN(file_len[file_seq_i], mem_len[mem_seq_i]); @@ -1550,19 +1566,19 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui if (vec_arr_nused == vec_arr_nalloc) { /* Check if we're using the static arrays */ if (addrs == addrs_local) { - HDassert(sizes == sizes_local); - HDassert(vec_bufs == vec_bufs_local); + assert(sizes == sizes_local); + assert(vec_bufs == vec_bufs_local); /* Allocate dynamic arrays */ if (NULL == (addrs = H5MM_malloc(sizeof(addrs_local) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for address list") + "memory allocation failed for address list"); if (NULL == (sizes = H5MM_malloc(sizeof(sizes_local) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for size list") + "memory allocation failed for size list"); if (NULL == (vec_bufs = H5MM_malloc(sizeof(vec_bufs_local) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for buffer list") + "memory allocation failed for buffer list"); /* Copy the existing data */ (void)H5MM_memcpy(addrs, addrs_local, sizeof(addrs_local)); @@ -1575,16 +1591,16 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui /* Reallocate arrays */ if (NULL == (tmp_ptr = H5MM_realloc(addrs, vec_arr_nalloc * sizeof(*addrs) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory reallocation failed for address list") + "memory reallocation failed for address list"); addrs = tmp_ptr; if (NULL == (tmp_ptr = H5MM_realloc(sizes, vec_arr_nalloc * sizeof(*sizes) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory reallocation failed for size list") + "memory reallocation failed for size list"); sizes = tmp_ptr; if (NULL == (tmp_ptr = H5MM_realloc(vec_bufs, vec_arr_nalloc * sizeof(*vec_bufs) * 2))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory reallocation failed for buffer list") + "memory reallocation failed for buffer list"); vec_bufs = tmp_ptr; } @@ -1602,7 +1618,7 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui /* Issue scalar write call */ if ((file->cls->write)(file, type, dxpl_id, offsets[i] + file_off[file_seq_i], io_len, (const void *)((const uint8_t *)buf + mem_off[mem_seq_i])) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write request failed"); /* Update file sequence */ if (io_len == file_len[file_seq_i]) @@ -1623,35 +1639,44 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui /* Make sure both memory and file sequences terminated at the same time */ if (mem_seq_i < mem_nseq) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "file selection terminated before memory selection") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, + "file selection terminated before memory selection"); /* Terminate iterators */ if (H5S_SELECT_ITER_RELEASE(file_iter) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release file selection iterator") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release file selection iterator"); file_iter_init = FALSE; if (H5S_SELECT_ITER_RELEASE(mem_iter) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release memory selection iterator") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release memory selection iterator"); mem_iter_init = FALSE; } /* Issue vector write call if appropriate */ if (use_vector) { - H5_CHECK_OVERFLOW(vec_arr_nused, size_t, uint32_t) + H5_CHECK_OVERFLOW(vec_arr_nused, size_t, uint32_t); if ((file->cls->write_vector)(file, dxpl_id, (uint32_t)vec_arr_nused, types, addrs, sizes, vec_bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write vector request failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write vector request failed"); + } + else { + uint32_t no_selection_io_cause; + + /* Add H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB to no selection I/O cause */ + H5CX_get_no_selection_io_cause(&no_selection_io_cause); + no_selection_io_cause |= H5D_SEL_IO_NO_VECTOR_OR_SELECTION_IO_CB; + H5CX_set_no_selection_io_cause(no_selection_io_cause); } done: /* Terminate and free iterators */ if (file_iter) { if (file_iter_init && H5S_SELECT_ITER_RELEASE(file_iter) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release file selection iterator") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release file selection iterator"); file_iter = H5FL_FREE(H5S_sel_iter_t, file_iter); } if (mem_iter) { if (mem_iter_init && H5S_SELECT_ITER_RELEASE(mem_iter) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release memory selection iterator") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "can't release memory selection iterator"); mem_iter = H5FL_FREE(H5S_sel_iter_t, mem_iter); } @@ -1666,9 +1691,9 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui } /* Make sure we cleaned up */ - HDassert(!addrs || addrs == addrs_local); - HDassert(!sizes || sizes == sizes_local); - HDassert(!vec_bufs || vec_bufs == vec_bufs_local); + assert(!addrs || addrs == addrs_local); + assert(!sizes || sizes == sizes_local); + assert(!vec_bufs || vec_bufs == vec_bufs_local); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__write_selection_translate() */ @@ -1697,8 +1722,8 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui * If the underlying VFD supports selection writes, pass the * call through directly. * - * If it doesn't, convert the vector write into a sequence - * of individual writes. + * If it doesn't, convert the selection write into a sequence + * of vector or scalar writes. * * Return: Success: SUCCEED * All writes have completed successfully. @@ -1706,10 +1731,6 @@ H5FD__write_selection_translate(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, ui * Failure: FAIL * One or more writes failed. * - * Programmer: NAF -- 3/29/21 - * - * Changes: None - * *------------------------------------------------------------------------- */ herr_t @@ -1729,18 +1750,18 @@ H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert((mem_spaces) || (count == 0)); - HDassert((file_spaces) || (count == 0)); - HDassert((offsets) || (count == 0)); - HDassert((element_sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(file); + assert(file->cls); + assert((mem_spaces) || (count == 0)); + assert((file_spaces) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* Verify that the first elements of the element_sizes and bufs arrays are * valid. */ - HDassert((count == 0) || (element_sizes[0] != 0)); - HDassert((count == 0) || (bufs[0] != NULL)); + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0] != NULL)); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); @@ -1752,7 +1773,7 @@ H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_ * collective transfer. */ if (0 == count) { - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } #endif /* H5_HAVE_PARALLEL */ @@ -1776,14 +1797,14 @@ H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_ haddr_t eoa; if (HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed"); for (i = 0; i < count; i++) { if ((offsets[i]) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, offsets[%d] = %llu, eoa = %llu", - (int)i, (unsigned long long)(offsets[i]), (unsigned long long)eoa) + (int)i, (unsigned long long)(offsets[i]), (unsigned long long)eoa); } } @@ -1793,41 +1814,42 @@ H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_ * buffers */ if (count > sizeof(mem_space_ids_local) / sizeof(mem_space_ids_local[0])) { if (NULL == (mem_space_ids = H5MM_malloc(count * sizeof(hid_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list"); if (NULL == (file_space_ids = H5MM_malloc(count * sizeof(hid_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list"); } /* Create IDs for all dataspaces */ for (; num_spaces < count; num_spaces++) { if ((mem_space_ids[num_spaces] = H5I_register(H5I_DATASPACE, mem_spaces[num_spaces], TRUE)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); if ((file_space_ids[num_spaces] = H5I_register(H5I_DATASPACE, file_spaces[num_spaces], TRUE)) < 0) { - if (H5I_dec_app_ref(mem_space_ids[num_spaces]) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "problem freeing id") - HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + if (NULL == H5I_remove(mem_space_ids[num_spaces])) + HDONE_ERROR(H5E_VFL, H5E_CANTREMOVE, FAIL, "problem removing id"); + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); } } if ((file->cls->write_selection)(file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write selection request failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write selection request failed"); } else /* Otherwise, implement the selection write as a sequence of regular * or vector write calls. */ - if (H5FD__write_selection_translate(file, type, dxpl_id, count, mem_spaces, file_spaces, offsets, - element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "translation to vector or scalar write failed") + + if (H5FD__write_selection_translate(SKIP_NO_CB, file, type, dxpl_id, count, mem_spaces, file_spaces, + offsets, element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "translation to vector or scalar write failed"); done: /* undo the base addr offset to the offsets array if necessary */ if (offsets_cooked) { - HDassert(file->base_addr > 0); + assert(file->base_addr > 0); for (i = 0; i < count; i++) { @@ -1835,12 +1857,14 @@ H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_ } } - /* Cleanup dataspace arrays */ + /* Cleanup dataspace arrays. Use H5I_remove() so we only close the IDs and + * not the underlying dataspaces, which were not created by this function. + */ for (i = 0; i < num_spaces; i++) { - if (H5I_dec_app_ref(mem_space_ids[i]) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "problem freeing id") - if (H5I_dec_app_ref(file_space_ids[i]) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "problem freeing id") + if (NULL == H5I_remove(mem_space_ids[i])) + HDONE_ERROR(H5E_VFL, H5E_CANTREMOVE, FAIL, "problem removing id"); + if (NULL == H5I_remove(file_space_ids[i])) + HDONE_ERROR(H5E_VFL, H5E_CANTREMOVE, FAIL, "problem removing id"); } if (mem_space_ids != mem_space_ids_local) mem_space_ids = H5MM_xfree(mem_space_ids); @@ -1856,21 +1880,27 @@ H5FD_write_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, H5S_t **mem_ * Purpose: Like H5FD_write_selection(), but takes hid_t arrays * instead of H5S_t * arrays for the dataspaces. * + * Depending on the parameter skip_cb which is translated into + * skip_selection_cb and skip_vector_cb: + * + * --If the underlying VFD supports selection writes and !skip_selection_cb, + * pass the call through directly. + * + * --If it doesn't, convert the selection writes into a sequence of vector or + * scalar reads depending on skip_vector_cb. + * * Return: Success: SUCCEED * All writes have completed successfully. * * Failure: FAIL * One or more writes failed. * - * Programmer: NAF -- 5/19/21 - * - * Changes: None - * *------------------------------------------------------------------------- */ herr_t -H5FD_write_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], - hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], const void *bufs[]) +H5FD_write_selection_id(uint32_t skip_cb, H5FD_t *file, H5FD_mem_t type, uint32_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], + size_t element_sizes[], const void *bufs[]) { hbool_t offsets_cooked = FALSE; H5S_t *mem_spaces_local[H5FD_LOCAL_SEL_ARR_LEN]; @@ -1879,23 +1909,25 @@ H5FD_write_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem H5S_t **file_spaces = file_spaces_local; hid_t dxpl_id = H5I_INVALID_HID; /* DXPL for operation */ uint32_t i; + uint32_t skip_selection_cb; + uint32_t skip_vector_cb; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(file->cls); - HDassert((mem_space_ids) || (count == 0)); - HDassert((file_space_ids) || (count == 0)); - HDassert((offsets) || (count == 0)); - HDassert((element_sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(file); + assert(file->cls); + assert((mem_space_ids) || (count == 0)); + assert((file_space_ids) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* Verify that the first elements of the element_sizes and bufs arrays are * valid. */ - HDassert((count == 0) || (element_sizes[0] != 0)); - HDassert((count == 0) || (bufs[0] != NULL)); + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0] != NULL)); /* Get proper DXPL for I/O */ dxpl_id = H5CX_get_dxpl(); @@ -1907,10 +1939,13 @@ H5FD_write_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem * collective transfer. */ if (0 == count) { - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } #endif /* H5_HAVE_PARALLEL */ + skip_selection_cb = skip_cb & SKIP_SELECTION_CB; + skip_vector_cb = skip_cb & SKIP_VECTOR_CB; + if (file->base_addr > 0) { /* apply the base_addr offset to the offsets array. Must undo before @@ -1931,22 +1966,22 @@ H5FD_write_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem haddr_t eoa; if (HADDR_UNDEF == (eoa = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver get_eoa request failed"); for (i = 0; i < count; i++) { if ((offsets[i]) > eoa) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, offsets[%d] = %llu, eoa = %llu", - (int)i, (unsigned long long)(offsets[i]), (unsigned long long)eoa) + (int)i, (unsigned long long)(offsets[i]), (unsigned long long)eoa); } } /* if the underlying VFD supports selection write, make the call */ - if (file->cls->write_selection) { + if (!skip_selection_cb && file->cls->write_selection) { if ((file->cls->write_selection)(file, type, dxpl_id, count, mem_space_ids, file_space_ids, offsets, element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write selection request failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "driver write selection request failed"); } else { /* Otherwise, implement the selection write as a sequence of regular @@ -1957,30 +1992,31 @@ H5FD_write_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem * buffers */ if (count > sizeof(mem_spaces_local) / sizeof(mem_spaces_local[0])) { if (NULL == (mem_spaces = H5MM_malloc(count * sizeof(H5S_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list"); if (NULL == (file_spaces = H5MM_malloc(count * sizeof(H5S_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for dataspace list"); } /* Get object pointers for all dataspaces */ for (i = 0; i < count; i++) { if (NULL == (mem_spaces[i] = (H5S_t *)H5I_object_verify(mem_space_ids[i], H5I_DATASPACE))) - HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve memory dataspace from ID") + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve memory dataspace from ID"); if (NULL == (file_spaces[i] = (H5S_t *)H5I_object_verify(file_space_ids[i], H5I_DATASPACE))) - HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve file dataspace from ID") + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve file dataspace from ID"); } /* Translate to vector or scalar I/O */ - if (H5FD__write_selection_translate(file, type, dxpl_id, count, mem_spaces, file_spaces, offsets, - element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "translation to vector or scalar write failed") + + if (H5FD__write_selection_translate(skip_vector_cb, file, type, dxpl_id, count, mem_spaces, + file_spaces, offsets, element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "translation to vector or scalar write failed"); } done: /* undo the base addr offset to the offsets array if necessary */ if (offsets_cooked) { - HDassert(file->base_addr > 0); + assert(file->base_addr > 0); for (i = 0; i < count; i++) { @@ -1997,6 +2033,209 @@ H5FD_write_selection_id(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_write_selection_id() */ +/*------------------------------------------------------------------------- + * Function: H5FD_read_vector_from_selection + * + * Purpose: Internal routine for H5FDread_vector_from_selection() + * + * It will translate the selection read to a vector read call + * if vector reads are supported, or a series of scalar read + * calls otherwise. + * + * Return: Success: SUCCEED + * All writes have completed successfully. + * + * Failure: FAIL + * One or more writes failed. + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_read_vector_from_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], + hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], + void *bufs[]) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(file); + assert(file->cls); + assert((mem_space_ids) || (count == 0)); + assert((file_space_ids) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); + + /* Verify that the first elements of the element_sizes and bufs arrays are + * valid. */ + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0] != NULL)); + + /* Call private function */ + /* (Note compensating for base address addition in internal routine) */ + if (H5FD_read_selection_id(SKIP_SELECTION_CB, file, type, count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file selection read request failed"); + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_read_vector_from_selection() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_write_vector_from_selection + * + * Purpose: Internal routine for H5FDwrite_vector_from_selection() + * + * It will translate the selection write to a vector write call + * if vector writes are supported, or a series of scalar write + * calls otherwise. + * + * Return: Success: SUCCEED + * All writes have completed successfully. + * + * Failure: FAIL + * One or more writes failed. + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_write_vector_from_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], + hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], + const void *bufs[]) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(file); + assert(file->cls); + assert((mem_space_ids) || (count == 0)); + assert((file_space_ids) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); + + /* Verify that the first elements of the element_sizes and bufs arrays are + * valid. */ + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0] != NULL)); + + /* Call private function */ + /* (Note compensating for base address addition in internal routine) */ + if (H5FD_write_selection_id(SKIP_SELECTION_CB, file, type, count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file selection write request failed"); + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_write_vector_from_selection() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_read_from_selection + * + * Purpose: Internal routine for H5FDread_from_selection() + * + * It will translate the selection read to a series of + * scalar read calls. + * + * Return: Success: SUCCEED + * All writes have completed successfully. + * + * Failure: FAIL + * One or more writes failed. + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_read_from_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], + hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], void *bufs[]) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(file); + assert(file->cls); + assert((mem_space_ids) || (count == 0)); + assert((file_space_ids) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); + + /* Verify that the first elements of the element_sizes and bufs arrays are + * valid. */ + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0] != NULL)); + + /* Call private function */ + /* (Note compensating for base address addition in internal routine) */ + if (H5FD_read_selection_id(SKIP_SELECTION_CB | SKIP_VECTOR_CB, file, type, count, mem_space_ids, + file_space_ids, offsets, element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "file selection read request failed"); + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_read_from_selection() */ + +/*------------------------------------------------------------------------- + * Function: H5FD_write_from_selection + * + * Purpose: Internal routine for H5FDwrite_from_selection() + * + * It will translate the selection write to a series of + * scalar write calls. + * + * Return: Success: SUCCEED + * All writes have completed successfully. + * + * Failure: FAIL + * One or more writes failed. + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_write_from_selection(H5FD_t *file, H5FD_mem_t type, uint32_t count, hid_t mem_space_ids[], + hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], + const void *bufs[]) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(file); + assert(file->cls); + assert((mem_space_ids) || (count == 0)); + assert((file_space_ids) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); + + /* Verify that the first elements of the element_sizes and bufs arrays are + * valid. */ + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0] != NULL)); + + /* Call private function */ + /* (Note compensating for base address addition in internal routine) */ + if (H5FD_write_selection_id(SKIP_SELECTION_CB | SKIP_VECTOR_CB, file, type, count, mem_space_ids, + file_space_ids, offsets, element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "file selection write request failed"); + +done: + + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_write_from_selection() */ + /*------------------------------------------------------------------------- * Function: H5FD_set_eoa * @@ -2018,12 +2257,12 @@ H5FD_set_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t addr) FUNC_ENTER_NOAPI(FAIL) - HDassert(file && file->cls); - HDassert(H5F_addr_defined(addr) && addr <= file->maxaddr); + assert(file && file->cls); + assert(H5_addr_defined(addr) && addr <= file->maxaddr); /* Dispatch to driver, convert to absolute address */ if ((file->cls->set_eoa)(file, type, addr + file->base_addr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver set_eoa request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2052,11 +2291,11 @@ H5FD_get_eoa(const H5FD_t *file, H5FD_mem_t type) FUNC_ENTER_NOAPI(HADDR_UNDEF) - HDassert(file && file->cls); + assert(file && file->cls); /* Dispatch to driver */ if (HADDR_UNDEF == (ret_value = (file->cls->get_eoa)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed"); /* Adjust for base address in file (convert to relative address) */ ret_value -= file->base_addr; @@ -2088,12 +2327,12 @@ H5FD_get_eof(const H5FD_t *file, H5FD_mem_t type) FUNC_ENTER_NOAPI(HADDR_UNDEF) - HDassert(file && file->cls); + assert(file && file->cls); /* Dispatch to driver */ if (file->cls->get_eof) { if (HADDR_UNDEF == (ret_value = (file->cls->get_eof)(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "driver get_eof request failed"); } else ret_value = file->maxaddr; @@ -2124,8 +2363,8 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(driver); - HDassert(flags); + assert(driver); + assert(flags); /* Check for the driver to query and then query it */ if (driver->query) @@ -2136,6 +2375,119 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/) FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_driver_query() */ +/*------------------------------------------------------------------------ + * Function: H5FD__vstr_tmp_cmp() + * + * Purpose: This is the comparison callback function used by qsort() + * in H5FD__sort_io_req_real( ) + * + *------------------------------------------------------------------------- + */ +static int +H5FD__srt_tmp_cmp(const void *element_1, const void *element_2) +{ + haddr_t addr_1 = ((const H5FD_srt_tmp_t *)element_1)->addr; + haddr_t addr_2 = ((const H5FD_srt_tmp_t *)element_2)->addr; + int ret_value = 0; /* Return value */ + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + assert(H5_addr_defined(addr_1)); + assert(H5_addr_defined(addr_2)); + + /* Compare the addresses */ + if (H5_addr_gt(addr_1, addr_2)) + ret_value = 1; + else if (H5_addr_lt(addr_1, addr_2)) + ret_value = -1; + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__srt_tmp_cmp() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__sort_io_req_real() + * + * Purpose: Scan the addrs array to see if it is sorted. + * + * If sorted, return TRUE in *was_sorted. + * + * If not sorted, use qsort() to sort the array. + * Do this by allocating an array of struct H5FD_srt_tmp_t, + * where each instance of H5FD_srt_tmp_t has two fields, + * addr and index. Load the array with the contents of the + * addrs array and the index of the associated entry. + * Then sort the array using qsort(). + * Return *FALSE in was_sorted. + * + * This is a common routine used by: + * --H5FD_sort_vector_io_req () + * --H5FD_sort_selection_io_req() + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__sort_io_req_real(size_t count, haddr_t *addrs, hbool_t *was_sorted, struct H5FD_srt_tmp_t **srt_tmp) +{ + size_t i; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + + /* scan the offsets array to see if it is sorted */ + for (i = 1; i < count; i++) { + assert(H5_addr_defined(addrs[i - 1])); + + if (H5_addr_gt(addrs[i - 1], addrs[i])) + break; + else if (H5_addr_eq(addrs[i - 1], addrs[i])) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "duplicate addr in selections"); + } + + /* if we traversed the entire array without breaking out, then + * the array was already sorted */ + if (i >= count) + *was_sorted = TRUE; + else + *was_sorted = FALSE; + + if (!(*was_sorted)) { + size_t srt_tmp_size; + + srt_tmp_size = (count * sizeof(struct H5FD_srt_tmp_t)); + + if (NULL == (*srt_tmp = (H5FD_srt_tmp_t *)malloc(srt_tmp_size))) + + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc srt_tmp"); + + for (i = 0; i < count; i++) { + (*srt_tmp)[i].addr = addrs[i]; + (*srt_tmp)[i].index = i; + } + + /* sort the srt_tmp array */ + qsort(*srt_tmp, count, sizeof(struct H5FD_srt_tmp_t), H5FD__srt_tmp_cmp); + + /* verify no duplicate entries */ + i = 1; + + for (i = 1; i < count; i++) { + assert(H5_addr_lt((*srt_tmp)[i - 1].addr, (*srt_tmp)[i].addr)); + + if (H5_addr_eq(addrs[i - 1], addrs[i])) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "duplicate addrs in array"); + } + } + +done: + FUNC_LEAVE_NOAPI(ret_value) + +} /* H5FD__sort_io_req_real() */ + /*------------------------------------------------------------------------- * Function: H5FD_sort_vector_io_req * @@ -2167,77 +2519,44 @@ H5FD_driver_query(const H5FD_class_t *driver, unsigned long *flags /*out*/) * *------------------------------------------------------------------------- */ - -static int -H5FD__vsrt_tmp_cmp(const void *element_1, const void *element_2) -{ - haddr_t addr_1 = ((const H5FD_vsrt_tmp_t *)element_1)->addr; - haddr_t addr_2 = ((const H5FD_vsrt_tmp_t *)element_2)->addr; - int ret_value = 0; /* Return value */ - - FUNC_ENTER_PACKAGE_NOERR - - /* Sanity checks */ - HDassert(H5F_addr_defined(addr_1)); - HDassert(H5F_addr_defined(addr_2)); - - /* Compare the addresses */ - if (H5F_addr_gt(addr_1, addr_2)) - ret_value = 1; - else if (H5F_addr_lt(addr_1, addr_2)) - ret_value = -1; - - FUNC_LEAVE_NOAPI(ret_value) -} /* H5FD__vsrt_tmp_cmp() */ - herr_t H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t types[], haddr_t addrs[], size_t sizes[], H5_flexible_const_ptr_t bufs[], H5FD_mem_t **s_types_ptr, haddr_t **s_addrs_ptr, size_t **s_sizes_ptr, H5_flexible_const_ptr_t **s_bufs_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ - size_t count = (size_t)_count; - size_t i; - struct H5FD_vsrt_tmp_t *srt_tmp = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + size_t count = (size_t)_count; + size_t i; + struct H5FD_srt_tmp_t *srt_tmp = NULL; FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(vector_was_sorted); + assert(vector_was_sorted); - HDassert((types) || (count == 0)); - HDassert((addrs) || (count == 0)); - HDassert((sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert((types) || (count == 0)); + assert((addrs) || (count == 0)); + assert((sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* verify that the first elements of the sizes and types arrays are * valid. */ - HDassert((count == 0) || (sizes[0] != 0)); - HDassert((count == 0) || (types[0] != H5FD_MEM_NOLIST)); + assert((count == 0) || (sizes[0] != 0)); + assert((count == 0) || (types[0] != H5FD_MEM_NOLIST)); - HDassert((count == 0) || ((s_types_ptr) && (NULL == *s_types_ptr))); - HDassert((count == 0) || ((s_addrs_ptr) && (NULL == *s_addrs_ptr))); - HDassert((count == 0) || ((s_sizes_ptr) && (NULL == *s_sizes_ptr))); - HDassert((count == 0) || ((s_bufs_ptr) && (NULL == *s_bufs_ptr))); + assert((count == 0) || ((s_types_ptr) && (NULL == *s_types_ptr))); + assert((count == 0) || ((s_addrs_ptr) && (NULL == *s_addrs_ptr))); + assert((count == 0) || ((s_sizes_ptr) && (NULL == *s_sizes_ptr))); + assert((count == 0) || ((s_bufs_ptr) && (NULL == *s_bufs_ptr))); - /* scan the addrs array to see if it is sorted */ - for (i = 1; i < count; i++) { - HDassert(H5F_addr_defined(addrs[i - 1])); - - if (H5F_addr_gt(addrs[i - 1], addrs[i])) - break; - else if (H5F_addr_eq(addrs[i - 1], addrs[i])) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "duplicate addr in vector") - } - - /* if we traversed the entire array without breaking out, then - * the array was already sorted */ - if (i >= count) - *vector_was_sorted = TRUE; - else - *vector_was_sorted = FALSE; + /* Sort the addrs array in increasing addr order, while + * maintaining the association between each addr, and the + * sizes[], types[], and bufs[] values at the same index. + */ + if (H5FD__sort_io_req_real(count, addrs, vector_was_sorted, &srt_tmp) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sorting error in selection offsets"); if (*vector_was_sorted) { @@ -2248,58 +2567,26 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t } else { - /* must sort the addrs array in increasing addr order, while - * maintaining the association between each addr, and the - * sizes[], types[], and bufs[] values at the same index. - * - * Do this by allocating an array of struct H5FD_vsrt_tmp_t, where - * each instance of H5FD_vsrt_tmp_t has two fields, addr and index. - * Load the array with the contents of the addrs array and - * the index of the associated entry. Sort the array, allocate - * the s_types_ptr, s_addrs_ptr, s_sizes_ptr, and s_bufs_ptr + /* + * Allocate the s_types_ptr, s_addrs_ptr, s_sizes_ptr, and s_bufs_ptr * arrays and populate them using the mapping provided by - * the sorted array of H5FD_vsrt_tmp_t. + * the sorted array of H5FD_srt_tmp_t. */ size_t j; size_t fixed_size_index = count; size_t fixed_type_index = count; - size_t srt_tmp_size; - - srt_tmp_size = (count * sizeof(struct H5FD_vsrt_tmp_t)); - - if (NULL == (srt_tmp = (H5FD_vsrt_tmp_t *)HDmalloc(srt_tmp_size))) - - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc srt_tmp") - - for (i = 0; i < count; i++) { - srt_tmp[i].addr = addrs[i]; - srt_tmp[i].index = i; - } - - /* sort the srt_tmp array */ - HDqsort(srt_tmp, count, sizeof(struct H5FD_vsrt_tmp_t), H5FD__vsrt_tmp_cmp); - - /* verify no duplicate entries */ - i = 1; - - for (i = 1; i < count; i++) { - HDassert(H5F_addr_lt(srt_tmp[i - 1].addr, srt_tmp[i].addr)); - if (H5F_addr_eq(addrs[i - 1], addrs[i])) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "duplicate addr in vector") - } - - if ((NULL == (*s_types_ptr = (H5FD_mem_t *)HDmalloc(count * sizeof(H5FD_mem_t)))) || - (NULL == (*s_addrs_ptr = (haddr_t *)HDmalloc(count * sizeof(haddr_t)))) || - (NULL == (*s_sizes_ptr = (size_t *)HDmalloc(count * sizeof(size_t)))) || + if ((NULL == (*s_types_ptr = (H5FD_mem_t *)malloc(count * sizeof(H5FD_mem_t)))) || + (NULL == (*s_addrs_ptr = (haddr_t *)malloc(count * sizeof(haddr_t)))) || + (NULL == (*s_sizes_ptr = (size_t *)malloc(count * sizeof(size_t)))) || (NULL == - (*s_bufs_ptr = (H5_flexible_const_ptr_t *)HDmalloc(count * sizeof(H5_flexible_const_ptr_t))))) { + (*s_bufs_ptr = (H5_flexible_const_ptr_t *)malloc(count * sizeof(H5_flexible_const_ptr_t))))) { - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sorted vector(s)") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sorted vector(s)"); } - HDassert(sizes[0] != 0); - HDassert(types[0] != H5FD_MEM_NOLIST); + assert(sizes[0] != 0); + assert(types[0] != H5FD_MEM_NOLIST); /* Scan the sizes and types vectors to determine if the fixed size / type * optimization is in use, and if so, to determine the index of the last @@ -2314,8 +2601,8 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t fixed_type_index = i - 1; } - HDassert(fixed_size_index <= count); - HDassert(fixed_type_index <= count); + assert(fixed_size_index <= count); + assert(fixed_type_index <= count); /* Populate the sorted vectors. Note that the index stored in srt_tmp * refers to the index in the unsorted array, while the position of @@ -2334,7 +2621,7 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t done: if (srt_tmp) { - HDfree(srt_tmp); + free(srt_tmp); srt_tmp = NULL; } @@ -2349,25 +2636,25 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t /* free space allocated for sorted vectors */ if (*s_types_ptr) { - HDfree(*s_types_ptr); + free(*s_types_ptr); *s_types_ptr = NULL; } if (*s_addrs_ptr) { - HDfree(*s_addrs_ptr); + free(*s_addrs_ptr); *s_addrs_ptr = NULL; } if (*s_sizes_ptr) { - HDfree(*s_sizes_ptr); + free(*s_sizes_ptr); *s_sizes_ptr = NULL; } if (*s_bufs_ptr) { - HDfree(*s_bufs_ptr); + free(*s_bufs_ptr); *s_bufs_ptr = NULL; } } @@ -2376,6 +2663,187 @@ H5FD_sort_vector_io_req(hbool_t *vector_was_sorted, uint32_t _count, H5FD_mem_t } /* end H5FD_sort_vector_io_req() */ +/*------------------------------------------------------------------------- + * Purpose: Determine whether the supplied selection I/O request is + * sorted. + * + * if is is, set *selection_was_sorted to TRUE, set: + * + * *s_mem_space_ids_ptr = mem_space_ids; + * *s_file_space_ids_ptr = file_space_ids; + * *s_offsets_ptr = offsets; + * *s_element_sizes_ptr = element_sizes; + * *s_bufs_ptr = bufs; + * + * and return. + * + * If it is not sorted, duplicate the mem_space_ids, file_space_ids, + * offsets, element_sizes and bufs arrays, storing the base + * addresses of the new arrays in *s_mem_space_ids_ptr, + * s_file_space_ids_ptr, s_offsets_ptr, *s_element_sizes_ptr, + * and s_bufs_ptr respectively. Determine the sorted order + * of the selection I/O request, and load it into the new + * selections in sorted order. + * + * Note that in this case, it is the caller's responsibility + * to free the sorted vectors. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5FD_sort_selection_io_req(hbool_t *selection_was_sorted, size_t count, hid_t mem_space_ids[], + hid_t file_space_ids[], haddr_t offsets[], size_t element_sizes[], + H5_flexible_const_ptr_t bufs[], hid_t **s_mem_space_ids_ptr, + hid_t **s_file_space_ids_ptr, haddr_t **s_offsets_ptr, + size_t **s_element_sizes_ptr, H5_flexible_const_ptr_t **s_bufs_ptr) +{ + size_t i; + struct H5FD_srt_tmp_t *srt_tmp = NULL; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + + assert(selection_was_sorted); + + assert((mem_space_ids) || (count == 0)); + assert((file_space_ids) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); + + /* verify that the first elements of the element_sizes and bufs arrays are + * valid. + */ + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0].cvp != NULL)); + + assert((count == 0) || ((s_mem_space_ids_ptr) && (NULL == *s_mem_space_ids_ptr))); + assert((count == 0) || ((s_file_space_ids_ptr) && (NULL == *s_file_space_ids_ptr))); + assert((count == 0) || ((s_offsets_ptr) && (NULL == *s_offsets_ptr))); + assert((count == 0) || ((s_element_sizes_ptr) && (NULL == *s_element_sizes_ptr))); + assert((count == 0) || ((s_bufs_ptr) && (NULL == *s_bufs_ptr))); + + /* Sort the offsets array in increasing offset order, while + * maintaining the association between each offset, and the + * mem_space_ids[], file_space_ids[], element_sizes and bufs[] + * values at the same index. + */ + if (H5FD__sort_io_req_real(count, offsets, selection_was_sorted, &srt_tmp) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sorting error in selection offsets"); + + if (*selection_was_sorted) { + + *s_mem_space_ids_ptr = mem_space_ids; + *s_file_space_ids_ptr = file_space_ids; + *s_offsets_ptr = offsets; + *s_element_sizes_ptr = element_sizes; + *s_bufs_ptr = bufs; + } + else { + + /* + * Allocate the s_mem_space_ids_ptr, s_file_space_ids_ptr, s_offsets_ptr, + * s_element_sizes_ptr and s_bufs_ptr arrays and populate them using the + * mapping provided by the sorted array of H5FD_srt_tmp_t. + */ + size_t j; + size_t fixed_element_sizes_index = count; + size_t fixed_bufs_index = count; + + if ((NULL == (*s_mem_space_ids_ptr = (hid_t *)malloc(count * sizeof(hid_t)))) || + (NULL == (*s_file_space_ids_ptr = (hid_t *)malloc(count * sizeof(hid_t)))) || + (NULL == (*s_offsets_ptr = (haddr_t *)malloc(count * sizeof(haddr_t)))) || + (NULL == (*s_element_sizes_ptr = (size_t *)malloc(count * sizeof(size_t)))) || + (NULL == + (*s_bufs_ptr = (H5_flexible_const_ptr_t *)malloc(count * sizeof(H5_flexible_const_ptr_t))))) { + + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sorted selection(s)"); + } + + assert(element_sizes[0] != 0); + assert(bufs[0].cvp != NULL); + + /* Scan the element_sizes and bufs array to determine if the fixed + * element_sizes / bufs optimization is in use, and if so, to determine + * the index of the last valid value on each array. + * We have already verified that the first + * elements of these arrays are valid so we can start at the second + * element (if it exists). + */ + for (i = 1; i < count && ((fixed_element_sizes_index == count) || (fixed_bufs_index == count)); i++) { + if ((fixed_element_sizes_index == count) && (element_sizes[i] == 0)) + fixed_element_sizes_index = i - 1; + if ((fixed_bufs_index == count) && (bufs[i].cvp == NULL)) + fixed_bufs_index = i - 1; + } + + assert(fixed_element_sizes_index <= count); + assert(fixed_bufs_index <= count); + + /* Populate the sorted arrays. Note that the index stored in srt_tmp + * refers to the index in the unsorted array, while the position of + * srt_tmp within the sorted array is the index in the sorted arrays */ + for (i = 0; i < count; i++) { + + j = srt_tmp[i].index; + + (*s_mem_space_ids_ptr)[i] = mem_space_ids[j]; + (*s_file_space_ids_ptr)[i] = file_space_ids[j]; + (*s_offsets_ptr)[i] = offsets[j]; + (*s_element_sizes_ptr)[i] = element_sizes[MIN(j, fixed_element_sizes_index)]; + (*s_bufs_ptr)[i] = bufs[MIN(j, fixed_bufs_index)]; + } + } + +done: + if (srt_tmp) { + free(srt_tmp); + srt_tmp = NULL; + } + + /* On failure, free the sorted arrays if they were allocated. + * Note that we only allocate these arrays if the original array + * was not sorted -- thus we check both for failure, and for + * the flag indicating that the original array was not sorted + * in increasing address order. + */ + if ((ret_value != SUCCEED) && (!(*selection_was_sorted))) { + + /* free space allocated for sorted arrays */ + if (*s_mem_space_ids_ptr) { + free(*s_mem_space_ids_ptr); + *s_mem_space_ids_ptr = NULL; + } + + if (*s_file_space_ids_ptr) { + free(*s_file_space_ids_ptr); + *s_file_space_ids_ptr = NULL; + } + + if (*s_offsets_ptr) { + free(*s_offsets_ptr); + *s_offsets_ptr = NULL; + } + + if (*s_element_sizes_ptr) { + free(*s_element_sizes_ptr); + *s_element_sizes_ptr = NULL; + } + + if (*s_bufs_ptr) { + free(*s_bufs_ptr); + *s_bufs_ptr = NULL; + } + } + + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD_sort_selection_io_req() */ + /*------------------------------------------------------------------------- * Function: H5FD_delete * @@ -2397,25 +2865,25 @@ H5FD_delete(const char *filename, hid_t fapl_id) /* Sanity checks */ - HDassert(filename); + assert(filename); /* Get file access property list */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); /* Get the VFD to open the file with */ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info"); /* Get driver info */ if (NULL == (driver = (H5FD_class_t *)H5I_object(driver_prop.driver_id))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list"); if (NULL == driver->del) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no 'del' method") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "file driver has no 'del' method"); /* Dispatch to file driver */ if ((driver->del)(filename, fapl_id)) - HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "delete failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "delete failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2446,9 +2914,9 @@ H5FD_check_plugin_load(const H5FD_class_t *cls, const H5PL_key_t *key, hbool_t * FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(cls); - HDassert(key); - HDassert(success); + assert(cls); + assert(key); + assert(success); /* Which kind of key are we looking for? */ if (key->vfd.kind == H5FD_GET_DRIVER_BY_NAME) { @@ -2458,7 +2926,7 @@ H5FD_check_plugin_load(const H5FD_class_t *cls, const H5PL_key_t *key, hbool_t * } else { /* Sanity check */ - HDassert(key->vfd.kind == H5FD_GET_DRIVER_BY_VALUE); + assert(key->vfd.kind == H5FD_GET_DRIVER_BY_VALUE); /* Check if plugin value matches VFD class value */ if (cls->value == key->vfd.u.value) @@ -2495,7 +2963,7 @@ H5FD__get_driver_cb(void *obj, hid_t id, void *_op_data) } /* end if */ } /* end if */ else { - HDassert(H5FD_GET_DRIVER_BY_VALUE == op_data->key.kind); + assert(H5FD_GET_DRIVER_BY_VALUE == op_data->key.kind); if (cls->value == op_data->key.u.value) { op_data->found_id = id; ret_value = H5_ITER_STOP; @@ -2529,14 +2997,14 @@ H5FD_register_driver_by_name(const char *name, hbool_t app_ref) /* Check if driver is already registered */ if ((driver_is_registered = H5FD_is_driver_registered_by_name(name, &driver_id)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't check if driver is already registered") + HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't check if driver is already registered"); /* If driver is already registered, increment ref count on ID and return ID */ if (driver_is_registered) { - HDassert(driver_id >= 0); + assert(driver_id >= 0); if (H5I_inc_ref(driver_id, app_ref) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFD") + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFD"); } /* end if */ else { H5PL_key_t key; @@ -2546,11 +3014,11 @@ H5FD_register_driver_by_name(const char *name, hbool_t app_ref) key.vfd.kind = H5FD_GET_DRIVER_BY_NAME; key.vfd.u.name = name; if (NULL == (cls = (const H5FD_class_t *)H5PL_load(H5PL_TYPE_VFD, &key))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VFD") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VFD"); /* Register the driver we loaded */ if ((driver_id = H5FD_register(cls, sizeof(*cls), app_ref)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VFD ID") + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VFD ID"); } /* end else */ ret_value = driver_id; @@ -2583,14 +3051,14 @@ H5FD_register_driver_by_value(H5FD_class_value_t value, hbool_t app_ref) /* Check if driver is already registered */ if ((driver_is_registered = H5FD_is_driver_registered_by_value(value, &driver_id)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't check if driver is already registered") + HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't check if driver is already registered"); /* If driver is already registered, increment ref count on ID and return ID */ if (driver_is_registered) { - HDassert(driver_id >= 0); + assert(driver_id >= 0); if (H5I_inc_ref(driver_id, app_ref) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFD") + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFD"); } /* end if */ else { H5PL_key_t key; @@ -2600,11 +3068,11 @@ H5FD_register_driver_by_value(H5FD_class_value_t value, hbool_t app_ref) key.vfd.kind = H5FD_GET_DRIVER_BY_VALUE; key.vfd.u.value = value; if (NULL == (cls = (const H5FD_class_t *)H5PL_load(H5PL_TYPE_VFD, &key))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VFD") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VFD"); /* Register the driver we loaded */ if ((driver_id = H5FD_register(cls, sizeof(*cls), app_ref)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VFD ID") + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VFD ID"); } /* end else */ ret_value = driver_id; @@ -2642,7 +3110,7 @@ H5FD_is_driver_registered_by_name(const char *driver_name, hid_t *registered_id) /* Find driver with name */ if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADITER, FAIL, "can't iterate over VFDs") + HGOTO_ERROR(H5E_VFL, H5E_BADITER, FAIL, "can't iterate over VFDs"); /* Found a driver with that name */ if (op_data.found_id != H5I_INVALID_HID) { @@ -2684,7 +3152,7 @@ H5FD_is_driver_registered_by_value(H5FD_class_value_t driver_value, hid_t *regis /* Find driver with value */ if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADITER, FAIL, "can't iterate over VFDs") + HGOTO_ERROR(H5E_VFL, H5E_BADITER, FAIL, "can't iterate over VFDs"); /* Found a driver with that value */ if (op_data.found_id != H5I_INVALID_HID) { @@ -2723,13 +3191,13 @@ H5FD_get_driver_id_by_name(const char *name, hbool_t is_api) /* Find driver with specified name */ if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VFL drivers") + HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VFL drivers"); /* Found a driver with that name */ if (op_data.found_id != H5I_INVALID_HID) { ret_value = op_data.found_id; if (H5I_inc_ref(ret_value, is_api) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFL driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFL driver"); } done: @@ -2762,13 +3230,13 @@ H5FD_get_driver_id_by_value(H5FD_class_value_t value, hbool_t is_api) /* Find driver with specified value */ if (H5I_iterate(H5I_VFL, H5FD__get_driver_cb, &op_data, FALSE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VFL drivers") + HGOTO_ERROR(H5E_VFL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VFL drivers"); /* Found a driver with that value */ if (op_data.found_id != H5I_INVALID_HID) { ret_value = op_data.found_id; if (H5I_inc_ref(ret_value, is_api) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFL driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VFL driver"); } done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDlog.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDlog.c index dc9eb4d5e1..660f266d2b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDlog.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDlog.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Monday, April 17, 2000 - * * Purpose: The POSIX unbuffered file driver using only the HDF5 public * API and with a few optimizations: the lseek() call is made * only when the current file position is unknown or needs to be @@ -237,9 +233,6 @@ H5FL_DEFINE_STATIC(H5FD_log_t); * Return: Success: The driver ID for the log driver * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ hid_t @@ -275,9 +268,6 @@ H5FD_log_init(void) * * Returns: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Friday, Jan 30, 2004 - * *--------------------------------------------------------------------------- */ static herr_t @@ -299,9 +289,6 @@ H5FD__log_term(void) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, February 19, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -317,11 +304,11 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si /* Do this first, so that we don't try to free a wild pointer if * H5P_object_verify() fails. */ - HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t)); + memset(&fa, 0, sizeof(H5FD_log_fapl_t)); /* Check arguments */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); /* Duplicate the log file string * A little wasteful, since this string will just be copied later, but @@ -329,7 +316,7 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si * const cast warnings. */ if (logfile != NULL && NULL == (fa.logfile = H5MM_xstrdup(logfile))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to copy log file name") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to copy log file name"); fa.flags = flags; fa.buf_size = buf_size; @@ -353,9 +340,6 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si * members copied from the file struct. * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, April 20, 2000 - * *------------------------------------------------------------------------- */ static void * @@ -380,9 +364,6 @@ H5FD__log_fapl_get(H5FD_t *_file) * Return: Success: Ptr to a new property list * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, April 20, 2000 - * *------------------------------------------------------------------------- */ static void * @@ -394,11 +375,11 @@ H5FD__log_fapl_copy(const void *_old_fa) FUNC_ENTER_PACKAGE - HDassert(old_fa); + assert(old_fa); /* Allocate the new FAPL info */ if (NULL == (new_fa = (H5FD_log_fapl_t *)H5MM_calloc(sizeof(H5FD_log_fapl_t)))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL"); /* Copy the general information */ H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_log_fapl_t)); @@ -406,7 +387,7 @@ H5FD__log_fapl_copy(const void *_old_fa) /* Deep copy the log file name */ if (old_fa->logfile != NULL) if (NULL == (new_fa->logfile = H5MM_strdup(old_fa->logfile))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate log file name") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate log file name"); /* Set return value */ ret_value = new_fa; @@ -429,9 +410,6 @@ H5FD__log_fapl_copy(const void *_old_fa) * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Thursday, April 20, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -459,9 +437,6 @@ H5FD__log_fapl_free(void *_fa) * caller, which is always H5FD_open(). * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -488,11 +463,11 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); if (ADDR_OVERFLOW(maxaddr)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr"); /* Initialize timers */ H5_timer_init(&open_timer); @@ -509,7 +484,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get the driver specific information */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); if (NULL == (fa = (const H5FD_log_fapl_t *)H5P_peek_driver_info(plist))) { /* Use default driver configuration*/ fa = &default_fa; @@ -547,7 +522,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Create the new file struct */ if (NULL == (file = H5FL_CALLOC(H5FD_log_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct"); file->fd = fd; H5_CHECKED_ASSIGN(file->eof, haddr_t, sb.st_size, h5_stat_size_t); @@ -556,10 +531,10 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) #ifdef H5_HAVE_WIN32_API file->hFile = (HANDLE)_get_osfhandle(fd); if (INVALID_HANDLE_VALUE == file->hFile) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file handle"); if (!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo)) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file information") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file information"); file->nFileIndexHigh = fileinfo.nFileIndexHigh; file->nFileIndexLow = fileinfo.nFileIndexLow; @@ -587,20 +562,20 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) file->iosize = fa->buf_size; if (file->fa.flags & H5FD_LOG_FILE_READ) { file->nread = (unsigned char *)H5MM_calloc(file->iosize); - HDassert(file->nread); + assert(file->nread); } if (file->fa.flags & H5FD_LOG_FILE_WRITE) { file->nwrite = (unsigned char *)H5MM_calloc(file->iosize); - HDassert(file->nwrite); + assert(file->nwrite); } if (file->fa.flags & H5FD_LOG_FLAVOR) { file->flavor = (unsigned char *)H5MM_calloc(file->iosize); - HDassert(file->flavor); + assert(file->flavor); } /* Set the log file pointer */ if (fa->logfile) - file->logfp = HDfopen(fa->logfile, "w"); + file->logfp = fopen(fa->logfile, "w"); else file->logfp = stderr; @@ -609,13 +584,13 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) H5_timevals_t open_times; /* Elapsed time for open() call */ H5_timer_get_times(open_timer, &open_times); - HDfprintf(file->logfp, "Open took: (%f s)\n", open_times.elapsed); + fprintf(file->logfp, "Open took: (%f s)\n", open_times.elapsed); } if (file->fa.flags & H5FD_LOG_TIME_STAT) { H5_timevals_t stat_times; /* Elapsed time for stat() call */ H5_timer_get_times(stat_timer, &stat_times); - HDfprintf(file->logfp, "Stat took: (%f s)\n", stat_times.elapsed); + fprintf(file->logfp, "Stat took: (%f s)\n", stat_times.elapsed); } } @@ -626,7 +601,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) else { /* Use the value in the property list */ if (H5P_get(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &file->ignore_disabled_file_locks) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property"); } /* Check for non-default FAPL */ @@ -638,7 +613,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) */ if (H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0) if (H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single"); } /* Set return value */ @@ -663,9 +638,6 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) * Return: Success: SUCCEED * Failure: FAIL, file not closed. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -678,7 +650,7 @@ H5FD__log_close(H5FD_t *_file) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(file); + assert(file); /* Initialize timer */ H5_timer_init(&close_timer); @@ -705,89 +677,89 @@ H5FD__log_close(H5FD_t *_file) H5_timevals_t close_times; /* Elapsed time for close() call */ H5_timer_get_times(close_timer, &close_times); - HDfprintf(file->logfp, "Close took: (%f s)\n", close_times.elapsed); + fprintf(file->logfp, "Close took: (%f s)\n", close_times.elapsed); } /* Dump the total number of seek/read/write operations */ if (file->fa.flags & H5FD_LOG_NUM_READ) - HDfprintf(file->logfp, "Total number of read operations: %llu\n", file->total_read_ops); + fprintf(file->logfp, "Total number of read operations: %llu\n", file->total_read_ops); if (file->fa.flags & H5FD_LOG_NUM_WRITE) - HDfprintf(file->logfp, "Total number of write operations: %llu\n", file->total_write_ops); + fprintf(file->logfp, "Total number of write operations: %llu\n", file->total_write_ops); if (file->fa.flags & H5FD_LOG_NUM_SEEK) - HDfprintf(file->logfp, "Total number of seek operations: %llu\n", file->total_seek_ops); + fprintf(file->logfp, "Total number of seek operations: %llu\n", file->total_seek_ops); if (file->fa.flags & H5FD_LOG_NUM_TRUNCATE) - HDfprintf(file->logfp, "Total number of truncate operations: %llu\n", file->total_truncate_ops); + fprintf(file->logfp, "Total number of truncate operations: %llu\n", file->total_truncate_ops); /* Dump the total time in seek/read/write */ if (file->fa.flags & H5FD_LOG_TIME_READ) - HDfprintf(file->logfp, "Total time in read operations: %f s\n", file->total_read_time); + fprintf(file->logfp, "Total time in read operations: %f s\n", file->total_read_time); if (file->fa.flags & H5FD_LOG_TIME_WRITE) - HDfprintf(file->logfp, "Total time in write operations: %f s\n", file->total_write_time); + fprintf(file->logfp, "Total time in write operations: %f s\n", file->total_write_time); if (file->fa.flags & H5FD_LOG_TIME_SEEK) - HDfprintf(file->logfp, "Total time in seek operations: %f s\n", file->total_seek_time); + fprintf(file->logfp, "Total time in seek operations: %f s\n", file->total_seek_time); if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) - HDfprintf(file->logfp, "Total time in truncate operations: %f s\n", file->total_truncate_time); + fprintf(file->logfp, "Total time in truncate operations: %f s\n", file->total_truncate_time); /* Dump the write I/O information */ if (file->fa.flags & H5FD_LOG_FILE_WRITE) { - HDfprintf(file->logfp, "Dumping write I/O information:\n"); + fprintf(file->logfp, "Dumping write I/O information:\n"); last_val = file->nwrite[0]; last_addr = 0; addr = 1; while (addr < file->eoa) { if (file->nwrite[addr] != last_val) { - HDfprintf(file->logfp, - "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n", - last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + fprintf(file->logfp, + "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); last_val = file->nwrite[addr]; last_addr = addr; } addr++; } - HDfprintf(file->logfp, - "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n", - last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + fprintf(file->logfp, + "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) written to %3d times\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); } /* Dump the read I/O information */ if (file->fa.flags & H5FD_LOG_FILE_READ) { - HDfprintf(file->logfp, "Dumping read I/O information:\n"); + fprintf(file->logfp, "Dumping read I/O information:\n"); last_val = file->nread[0]; last_addr = 0; addr = 1; while (addr < file->eoa) { if (file->nread[addr] != last_val) { - HDfprintf(file->logfp, - "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n", - last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + fprintf(file->logfp, + "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); last_val = file->nread[addr]; last_addr = addr; } addr++; } - HDfprintf(file->logfp, - "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n", - last_addr, (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); + fprintf(file->logfp, + "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) read from %3d times\n", last_addr, + (addr - 1), (unsigned long)(addr - last_addr), (int)last_val); } /* Dump the I/O flavor information */ if (file->fa.flags & H5FD_LOG_FLAVOR) { - HDfprintf(file->logfp, "Dumping I/O flavor information:\n"); + fprintf(file->logfp, "Dumping I/O flavor information:\n"); last_val = file->flavor[0]; last_addr = 0; addr = 1; while (addr < file->eoa) { if (file->flavor[addr] != last_val) { - HDfprintf(file->logfp, - "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n", - last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); + fprintf(file->logfp, + "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); last_val = file->flavor[addr]; last_addr = addr; } addr++; } - HDfprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n", - last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); + fprintf(file->logfp, "\tAddr %10" PRIuHADDR "-%10" PRIuHADDR " (%10lu bytes) flavor is %s\n", + last_addr, (addr - 1), (unsigned long)(addr - last_addr), flavors[last_val]); } /* Free the logging information */ @@ -798,7 +770,7 @@ H5FD__log_close(H5FD_t *_file) if (file->fa.flags & H5FD_LOG_FLAVOR) file->flavor = (unsigned char *)H5MM_xfree(file->flavor); if (file->logfp != stderr) - HDfclose(file->logfp); + fclose(file->logfp); } /* end if */ if (file->fa.logfile) @@ -821,9 +793,6 @@ H5FD__log_close(H5FD_t *_file) * Failure: never fails (arguments were checked by the * caller). * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static int @@ -837,40 +806,40 @@ H5FD__log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) #ifdef H5_HAVE_WIN32_API if (f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->dwVolumeSerialNumber > f2->dwVolumeSerialNumber) - HGOTO_DONE(1) + HGOTO_DONE(1); if (f1->nFileIndexHigh < f2->nFileIndexHigh) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->nFileIndexHigh > f2->nFileIndexHigh) - HGOTO_DONE(1) + HGOTO_DONE(1); if (f1->nFileIndexLow < f2->nFileIndexLow) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->nFileIndexLow > f2->nFileIndexLow) - HGOTO_DONE(1) + HGOTO_DONE(1); #else #ifdef H5_DEV_T_IS_SCALAR if (f1->device < f2->device) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->device > f2->device) - HGOTO_DONE(1) + HGOTO_DONE(1); #else /* H5_DEV_T_IS_SCALAR */ /* If dev_t isn't a scalar value on this system, just use memcmp to * determine if the values are the same or not. The actual return value * shouldn't really matter... */ - if (HDmemcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0) - HGOTO_DONE(-1) - if (HDmemcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0) - HGOTO_DONE(1) + if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0) + HGOTO_DONE(-1); + if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0) + HGOTO_DONE(1); #endif /* H5_DEV_T_IS_SCALAR */ if (f1->inode < f2->inode) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->inode > f2->inode) - HGOTO_DONE(1) + HGOTO_DONE(1); #endif @@ -886,9 +855,6 @@ H5FD__log_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Friday, August 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -928,9 +894,6 @@ H5FD__log_query(const H5FD_t *_file, unsigned long *flags /* out */) * Return: Success: Address of new memory * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol - * Monday, April 17, 2000 - * *------------------------------------------------------------------------- */ static haddr_t @@ -951,15 +914,15 @@ H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hs /* Retain the (first) flavor of the information written to the file */ if (file->fa.flags != 0) { if (file->fa.flags & H5FD_LOG_FLAVOR) { - HDassert(addr < file->iosize); + assert(addr < file->iosize); H5_CHECK_OVERFLOW(size, hsize_t, size_t); - HDmemset(&file->flavor[addr], (int)type, (size_t)size); + memset(&file->flavor[addr], (int)type, (size_t)size); } if (file->fa.flags & H5FD_LOG_ALLOC) - HDfprintf(file->logfp, - "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", addr, - (haddr_t)((addr + size) - 1), size, flavors[type]); + fprintf(file->logfp, + "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", addr, + (haddr_t)((addr + size) - 1), size, flavors[type]); } /* Set return value */ @@ -975,9 +938,6 @@ H5FD__log_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hs * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, September 28, 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -990,15 +950,15 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had if (file->fa.flags != 0) { /* Reset the flavor of the information in the file */ if (file->fa.flags & H5FD_LOG_FLAVOR) { - HDassert(addr < file->iosize); + assert(addr < file->iosize); H5_CHECK_OVERFLOW(size, hsize_t, size_t); - HDmemset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size); + memset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size); } /* Log the file memory freed */ if (file->fa.flags & H5FD_LOG_FREE) - HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n", - addr, (haddr_t)((addr + size) - 1), size, flavors[type]); + fprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n", + addr, (haddr_t)((addr + size) - 1), size, flavors[type]); } FUNC_LEAVE_NOAPI(SUCCEED) @@ -1014,9 +974,6 @@ H5FD__log_free(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had * Return: Success: The end-of-address marker. * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Monday, August 2, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1038,9 +995,6 @@ H5FD__log_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Return: SUCCEED (Can't fail) * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1052,39 +1006,39 @@ H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) if (file->fa.flags != 0) { /* Check for increasing file size */ - if (H5F_addr_gt(addr, file->eoa) && H5F_addr_gt(addr, 0)) { + if (H5_addr_gt(addr, file->eoa) && H5_addr_gt(addr, 0)) { hsize_t size = addr - file->eoa; /* Retain the flavor of the space allocated by the extension */ if (file->fa.flags & H5FD_LOG_FLAVOR) { - HDassert(addr < file->iosize); + assert(addr < file->iosize); H5_CHECK_OVERFLOW(size, hsize_t, size_t); - HDmemset(&file->flavor[file->eoa], (int)type, (size_t)size); + memset(&file->flavor[file->eoa], (int)type, (size_t)size); } /* Log the extension like an allocation */ if (file->fa.flags & H5FD_LOG_ALLOC) - HDfprintf(file->logfp, - "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", - file->eoa, addr, size, flavors[type]); + fprintf(file->logfp, + "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Allocated\n", + file->eoa, addr, size, flavors[type]); } /* Check for decreasing file size */ - if (H5F_addr_lt(addr, file->eoa) && H5F_addr_gt(addr, 0)) { + if (H5_addr_lt(addr, file->eoa) && H5_addr_gt(addr, 0)) { hsize_t size = file->eoa - addr; /* Reset the flavor of the space freed by the shrink */ if (file->fa.flags & H5FD_LOG_FLAVOR) { - HDassert((addr + size) < file->iosize); + assert((addr + size) < file->iosize); H5_CHECK_OVERFLOW(size, hsize_t, size_t); - HDmemset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size); + memset(&file->flavor[addr], H5FD_MEM_DEFAULT, (size_t)size); } /* Log the shrink like a free */ if (file->fa.flags & H5FD_LOG_FREE) - HDfprintf(file->logfp, - "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n", - file->eoa, addr, size, flavors[type]); + fprintf(file->logfp, + "%10" PRIuHADDR "-%10" PRIuHADDR " (%10" PRIuHSIZE " bytes) (%s) Freed\n", file->eoa, + addr, size, flavors[type]); } } @@ -1105,9 +1059,6 @@ H5FD__log_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) * or the HDF5 file. * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1127,9 +1078,6 @@ H5FD__log_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Returns: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Sept. 16, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -1141,7 +1089,7 @@ H5FD__log_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handl FUNC_ENTER_PACKAGE if (!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); *file_handle = &(file->fd); @@ -1160,9 +1108,6 @@ H5FD__log_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_handl * buffer BUF. * Failure: FAIL, Contents of buffer BUF are undefined. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1179,17 +1124,17 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had FUNC_ENTER_PACKAGE - HDassert(file && file->pub.cls); - HDassert(buf); + assert(file && file->pub.cls); + assert(buf); /* Initialize timer */ H5_timer_init(&read_timer); /* Check for overflow conditions */ - if (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) + if (!H5_addr_defined(addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr); if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr); /* Log the I/O information about the read */ if (file->fa.flags != 0) { @@ -1198,7 +1143,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had /* Log information about the number of times these locations are read */ if (file->fa.flags & H5FD_LOG_FILE_READ) { - HDassert((addr + size) < file->iosize); + assert((addr + size) < file->iosize); while (tmp_size-- > 0) file->nread[tmp_addr++]++; } @@ -1236,16 +1181,16 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had /* Emit log string if we're tracking individual seek events. */ if (file->fa.flags & H5FD_LOG_LOC_SEEK) { - HDfprintf(file->logfp, "Seek: From %10" PRIuHADDR " To %10" PRIuHADDR, file->pos, addr); + fprintf(file->logfp, "Seek: From %10" PRIuHADDR " To %10" PRIuHADDR, file->pos, addr); /* Add the seek time, if we're tracking that. * Note that the seek time is NOT emitted for when just H5FD_LOG_TIME_SEEK * is set. */ if (file->fa.flags & H5FD_LOG_TIME_SEEK) - HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed); + fprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed); else - HDfprintf(file->logfp, "\n"); + fprintf(file->logfp, "\n"); } } #endif /* H5_HAVE_PREADWRITE */ @@ -1287,8 +1232,8 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); if (file->fa.flags & H5FD_LOG_LOC_READ) - HDfprintf(file->logfp, "Error! Reading: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n", - orig_addr, (orig_addr + orig_size) - 1, orig_size); + fprintf(file->logfp, "Error! Reading: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n", + orig_addr, (orig_addr + orig_size) - 1, orig_size); HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " @@ -1301,12 +1246,12 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had if (0 == bytes_read) { /* End of file but not end of format address space */ - HDmemset(buf, 0, size); + memset(buf, 0, size); break; } - HDassert(bytes_read >= 0); - HDassert((size_t)bytes_read <= size); + assert(bytes_read >= 0); + assert((size_t)bytes_read <= size); size -= (size_t)bytes_read; addr += (haddr_t)bytes_read; @@ -1329,16 +1274,16 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had /* Log information about the read */ if (file->fa.flags & H5FD_LOG_LOC_READ) { - HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes) (%s) Read", orig_addr, - (orig_addr + orig_size) - 1, orig_size, flavors[type]); + fprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes) (%s) Read", orig_addr, + (orig_addr + orig_size) - 1, orig_size, flavors[type]); /* Verify that we are reading in the type of data we allocated in this location */ if (file->flavor) { - HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[orig_addr] || - (H5FD_mem_t)file->flavor[orig_addr] == H5FD_MEM_DEFAULT); - HDassert(type == H5FD_MEM_DEFAULT || - type == (H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] || - (H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] == H5FD_MEM_DEFAULT); + assert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[orig_addr] || + (H5FD_mem_t)file->flavor[orig_addr] == H5FD_MEM_DEFAULT); + assert(type == H5FD_MEM_DEFAULT || + type == (H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] || + (H5FD_mem_t)file->flavor[(orig_addr + orig_size) - 1] == H5FD_MEM_DEFAULT); } /* Add the read time, if we're tracking that. @@ -1346,9 +1291,9 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had * is set. */ if (file->fa.flags & H5FD_LOG_TIME_READ) - HDfprintf(file->logfp, " (%fs @ %f)\n", read_times.elapsed, read_timer.initial.elapsed); + fprintf(file->logfp, " (%fs @ %f)\n", read_times.elapsed, read_timer.initial.elapsed); else - HDfprintf(file->logfp, "\n"); + fprintf(file->logfp, "\n"); } /* Update current position */ @@ -1374,9 +1319,6 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1393,27 +1335,27 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha FUNC_ENTER_PACKAGE - HDassert(file && file->pub.cls); - HDassert(size > 0); - HDassert(buf); + assert(file && file->pub.cls); + assert(size > 0); + assert(buf); /* Initialize timer */ H5_timer_init(&write_timer); /* Verify that we are writing out the type of data we allocated in this location */ if (file->flavor) { - HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[addr] || - (H5FD_mem_t)file->flavor[addr] == H5FD_MEM_DEFAULT); - HDassert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[(addr + size) - 1] || - (H5FD_mem_t)file->flavor[(addr + size) - 1] == H5FD_MEM_DEFAULT); + assert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[addr] || + (H5FD_mem_t)file->flavor[addr] == H5FD_MEM_DEFAULT); + assert(type == H5FD_MEM_DEFAULT || type == (H5FD_mem_t)file->flavor[(addr + size) - 1] || + (H5FD_mem_t)file->flavor[(addr + size) - 1] == H5FD_MEM_DEFAULT); } /* Check for overflow conditions */ - if (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) + if (!H5_addr_defined(addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr); if (REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu", - (unsigned long long)addr, (unsigned long long)size) + (unsigned long long)addr, (unsigned long long)size); /* Log the I/O information about the write */ if (file->fa.flags & H5FD_LOG_FILE_WRITE) { @@ -1421,7 +1363,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha haddr_t tmp_addr = addr; /* Log information about the number of times these locations are read */ - HDassert((addr + size) < file->iosize); + assert((addr + size) < file->iosize); while (tmp_size-- > 0) file->nwrite[tmp_addr++]++; } @@ -1458,16 +1400,16 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha /* Emit log string if we're tracking individual seek events. */ if (file->fa.flags & H5FD_LOG_LOC_SEEK) { - HDfprintf(file->logfp, "Seek: From %10" PRIuHADDR " To %10" PRIuHADDR, file->pos, addr); + fprintf(file->logfp, "Seek: From %10" PRIuHADDR " To %10" PRIuHADDR, file->pos, addr); /* Add the seek time, if we're tracking that. * Note that the seek time is NOT emitted for when just H5FD_LOG_TIME_SEEK * is set. */ if (file->fa.flags & H5FD_LOG_TIME_SEEK) - HDfprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed); + fprintf(file->logfp, " (%fs @ %f)\n", seek_times.elapsed, seek_timer.initial.elapsed); else - HDfprintf(file->logfp, "\n"); + fprintf(file->logfp, "\n"); } } #endif /* H5_HAVE_PREADWRITE */ @@ -1509,8 +1451,8 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR); if (file->fa.flags & H5FD_LOG_LOC_WRITE) - HDfprintf(file->logfp, "Error! Writing: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n", - orig_addr, (orig_addr + orig_size) - 1, orig_size); + fprintf(file->logfp, "Error! Writing: %10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes)\n", + orig_addr, (orig_addr + orig_size) - 1, orig_size); HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, " @@ -1521,8 +1463,8 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ - HDassert(bytes_wrote > 0); - HDassert((size_t)bytes_wrote <= size); + assert(bytes_wrote > 0); + assert((size_t)bytes_wrote <= size); size -= (size_t)bytes_wrote; addr += (haddr_t)bytes_wrote; @@ -1545,15 +1487,15 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha /* Log information about the write */ if (file->fa.flags & H5FD_LOG_LOC_WRITE) { - HDfprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes) (%s) Written", orig_addr, - (orig_addr + orig_size) - 1, orig_size, flavors[type]); + fprintf(file->logfp, "%10" PRIuHADDR "-%10" PRIuHADDR " (%10zu bytes) (%s) Written", orig_addr, + (orig_addr + orig_size) - 1, orig_size, flavors[type]); /* Check if this is the first write into a "default" section, grabbed by the metadata aggregation * algorithm */ if (file->fa.flags & H5FD_LOG_FLAVOR) { if ((H5FD_mem_t)file->flavor[orig_addr] == H5FD_MEM_DEFAULT) { - HDmemset(&file->flavor[orig_addr], (int)type, orig_size); - HDfprintf(file->logfp, " (fresh)"); + memset(&file->flavor[orig_addr], (int)type, orig_size); + fprintf(file->logfp, " (fresh)"); } } @@ -1562,9 +1504,9 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha * is set. */ if (file->fa.flags & H5FD_LOG_TIME_WRITE) - HDfprintf(file->logfp, " (%fs @ %f)\n", write_times.elapsed, write_timer.initial.elapsed); + fprintf(file->logfp, " (%fs @ %f)\n", write_times.elapsed, write_timer.initial.elapsed); else - HDfprintf(file->logfp, "\n"); + fprintf(file->logfp, "\n"); } /* Update current position and eof */ @@ -1591,9 +1533,6 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1604,10 +1543,10 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); /* Extend the file to make sure it's large enough */ - if (!H5F_addr_eq(file->eoa, file->eof)) { + if (!H5_addr_eq(file->eoa, file->eof)) { H5_timer_t trunc_timer; /* Timer for truncate operation */ H5_timevals_t trunc_times; /* Elapsed time for truncate operation */ @@ -1639,11 +1578,11 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ dwError = GetLastError(); if (dwError != NO_ERROR) - HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer") + HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer"); } if (0 == SetEndOfFile(file->hFile)) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly"); } #else /* H5_HAVE_WIN32_API */ /* Truncate/extend the file */ @@ -1667,16 +1606,16 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ /* Emit log string if we're tracking individual truncate events. */ if (file->fa.flags & H5FD_LOG_TRUNCATE) { - HDfprintf(file->logfp, "Truncate: To %10" PRIuHADDR, file->eoa); + fprintf(file->logfp, "Truncate: To %10" PRIuHADDR, file->eoa); /* Add the truncate time, if we're tracking that. * Note that the truncate time is NOT emitted for when just H5FD_LOG_TIME_TRUNCATE * is set. */ if (file->fa.flags & H5FD_LOG_TIME_TRUNCATE) - HDfprintf(file->logfp, " (%fs @ %f)\n", trunc_times.elapsed, trunc_timer.initial.elapsed); + fprintf(file->logfp, " (%fs @ %f)\n", trunc_times.elapsed, trunc_timer.initial.elapsed); else - HDfprintf(file->logfp, "\n"); + fprintf(file->logfp, "\n"); } /* Update the eof value */ @@ -1699,8 +1638,6 @@ H5FD__log_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR_ * Return: Success: SUCCEED * Failure: FAIL, file not locked. * - * Programmer: Vailin Choi; May 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1713,7 +1650,7 @@ H5FD__log_lock(H5FD_t *_file, hbool_t rw) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(file); + assert(file); /* Set exclusive or shared lock based on rw status */ lock_flags = rw ? LOCK_EX : LOCK_SH; @@ -1741,8 +1678,6 @@ H5FD__log_lock(H5FD_t *_file, hbool_t rw) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; May 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1753,7 +1688,7 @@ H5FD__log_unlock(H5FD_t *_file) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); if (HDflock(file->fd, LOCK_UN) < 0) { if (file->ignore_disabled_file_locks && ENOSYS == errno) { @@ -1786,7 +1721,7 @@ H5FD__log_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id) FUNC_ENTER_PACKAGE - HDassert(filename); + assert(filename); if (HDremove(filename) < 0) HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDmirror.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDmirror.c index 8c222d3eb0..1130fac8c2 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDmirror.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDmirror.c @@ -81,48 +81,48 @@ typedef struct H5FD_mirror_t { ssize_t bytes_written = 0; \ const unsigned char *b = NULL; \ \ - HDfprintf(stdout, "%s bytes:\n```\n", (label)); \ + fprintf(stdout, "%s bytes:\n```\n", (label)); \ \ /* print whole lines */ \ while ((len - bytes_written) >= 32) { \ b = (const unsigned char *)(buf) + bytes_written; \ - HDfprintf(stdout, \ - "%04zX %02X%02X%02X%02X %02X%02X%02X%02X" \ - " %02X%02X%02X%02X %02X%02X%02X%02X" \ - " %02X%02X%02X%02X %02X%02X%02X%02X" \ - " %02X%02X%02X%02X %02X%02X%02X%02X\n", \ - bytes_written, b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], \ - b[11], b[12], b[13], b[14], b[15], b[16], b[17], b[18], b[19], b[20], b[21], b[22], \ - b[23], b[24], b[25], b[26], b[27], b[28], b[29], b[30], b[31]); \ + fprintf(stdout, \ + "%04zX %02X%02X%02X%02X %02X%02X%02X%02X" \ + " %02X%02X%02X%02X %02X%02X%02X%02X" \ + " %02X%02X%02X%02X %02X%02X%02X%02X" \ + " %02X%02X%02X%02X %02X%02X%02X%02X\n", \ + bytes_written, b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], b[8], b[9], b[10], b[11], \ + b[12], b[13], b[14], b[15], b[16], b[17], b[18], b[19], b[20], b[21], b[22], b[23], \ + b[24], b[25], b[26], b[27], b[28], b[29], b[30], b[31]); \ bytes_written += 32; \ } \ \ /* start partial line */ \ if (len > bytes_written) { \ - HDfprintf(stdout, "%04zX ", bytes_written); \ + fprintf(stdout, "%04zX ", bytes_written); \ } \ \ /* partial line blocks */ \ while ((len - bytes_written) >= 4) { \ - HDfprintf(stdout, " %02X%02X%02X%02X", (buf)[bytes_written], (buf)[bytes_written + 1], \ - (buf)[bytes_written + 2], (buf)[bytes_written + 3]); \ + fprintf(stdout, " %02X%02X%02X%02X", (buf)[bytes_written], (buf)[bytes_written + 1], \ + (buf)[bytes_written + 2], (buf)[bytes_written + 3]); \ bytes_written += 4; \ } \ \ /* block separator before partial block */ \ if (len > bytes_written) { \ - HDfprintf(stdout, " "); \ + fprintf(stdout, " "); \ } \ \ /* partial block individual bytes */ \ while (len > bytes_written) { \ - HDfprintf(stdout, "%02X", (buf)[bytes_written++]); \ + fprintf(stdout, "%02X", (buf)[bytes_written++]); \ } \ \ /* end partial line */ \ - HDfprintf(stdout, "\n"); \ - HDfprintf(stdout, "```\n"); \ - HDfflush(stdout); \ + fprintf(stdout, "\n"); \ + fprintf(stdout, "```\n"); \ + fflush(stdout); \ } while (0) #else #define LOG_XMIT_BYTES(label, buf, len) /* no-op */ @@ -131,8 +131,8 @@ typedef struct H5FD_mirror_t { #if MIRROR_DEBUG_OP_CALLS #define LOG_OP_CALL(name) \ do { \ - HDprintf("called %s()\n", (name)); \ - HDfflush(stdout); \ + printf("called %s()\n", (name)); \ + fflush(stdout); \ } while (0) #else #define LOG_OP_CALL(name) /* no-op */ @@ -282,10 +282,10 @@ H5FD__mirror_xmit_decode_uint16(uint16_t *out, const unsigned char *_buf) LOG_OP_CALL(__func__); - HDassert(_buf && out); + assert(_buf && out); H5MM_memcpy(&n, _buf, sizeof(n)); - *out = (uint16_t)HDntohs(n); + *out = (uint16_t)ntohs(n); return 2; /* number of bytes eaten */ } /* end H5FD__mirror_xmit_decode_uint16() */ @@ -310,10 +310,10 @@ H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *_buf) LOG_OP_CALL(__func__); - HDassert(_buf && out); + assert(_buf && out); H5MM_memcpy(&n, _buf, sizeof(n)); - *out = (uint32_t)HDntohl(n); + *out = (uint32_t)ntohl(n); return 4; /* number of bytes eaten */ } /* end H5FD__mirror_xmit_decode_uint32() */ @@ -328,8 +328,6 @@ H5FD__mirror_xmit_decode_uint32(uint32_t *out, const unsigned char *_buf) * * Return: The number of bytes written to the buffer (8). * - * Programmer: Jacob Smith - * 2020-03-05 * --------------------------------------------------------------------------- */ static hbool_t @@ -369,7 +367,7 @@ H5FD__mirror_xmit_decode_uint64(uint64_t *out, const unsigned char *_buf) LOG_OP_CALL(__func__); - HDassert(_buf && out); + assert(_buf && out); H5MM_memcpy(&n, _buf, sizeof(n)); if (TRUE == is_host_little_endian()) @@ -396,7 +394,7 @@ H5FD__mirror_xmit_decode_uint8(uint8_t *out, const unsigned char *_buf) { LOG_OP_CALL(__func__); - HDassert(_buf && out); + assert(_buf && out); H5MM_memcpy(out, _buf, sizeof(uint8_t)); @@ -422,9 +420,9 @@ H5FD__mirror_xmit_encode_uint16(unsigned char *_dest, uint16_t v) LOG_OP_CALL(__func__); - HDassert(_dest); + assert(_dest); - n = (uint16_t)HDhtons(v); + n = (uint16_t)htons(v); H5MM_memcpy(_dest, &n, sizeof(n)); return 2; @@ -449,9 +447,9 @@ H5FD__mirror_xmit_encode_uint32(unsigned char *_dest, uint32_t v) LOG_OP_CALL(__func__); - HDassert(_dest); + assert(_dest); - n = (uint32_t)HDhtonl(v); + n = (uint32_t)htonl(v); H5MM_memcpy(_dest, &n, sizeof(n)); return 4; @@ -476,7 +474,7 @@ H5FD__mirror_xmit_encode_uint64(unsigned char *_dest, uint64_t v) LOG_OP_CALL(__func__); - HDassert(_dest); + assert(_dest); if (TRUE == is_host_little_endian()) n = BSWAP_64(v); @@ -503,7 +501,7 @@ H5FD__mirror_xmit_encode_uint8(unsigned char *dest, uint8_t v) { LOG_OP_CALL(__func__); - HDassert(dest); + assert(dest); H5MM_memcpy(dest, &v, sizeof(v)); @@ -536,14 +534,14 @@ H5FD_mirror_xmit_decode_header(H5FD_mirror_xmit_t *out, const unsigned char *buf LOG_OP_CALL(__func__); - HDassert(out && buf); + assert(out && buf); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->magic), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->version), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->session_token), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->xmit_count), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->op), &buf[n_eaten]); - HDassert(n_eaten == H5FD_MIRROR_XMIT_HEADER_SIZE); + assert(n_eaten == H5FD_MIRROR_XMIT_HEADER_SIZE); return n_eaten; } /* end H5FD_mirror_xmit_decode_header() */ @@ -574,11 +572,11 @@ H5FD_mirror_xmit_decode_lock(H5FD_mirror_xmit_lock_t *out, const unsigned char * LOG_OP_CALL(__func__); - HDassert(out && buf); + assert(out && buf); n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->rw), &buf[n_eaten]); - HDassert(n_eaten == H5FD_MIRROR_XMIT_LOCK_SIZE); + assert(n_eaten == H5FD_MIRROR_XMIT_LOCK_SIZE); return n_eaten; } /* end H5FD_mirror_xmit_decode_lock() */ @@ -610,13 +608,13 @@ H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char * LOG_OP_CALL(__func__); - HDassert(out && buf); + assert(out && buf); n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->flags), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->maxaddr), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->size_t_blob), &buf[n_eaten]); - HDassert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_eaten); + assert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_eaten); HDstrncpy(out->filename, (const char *)&buf[n_eaten], H5FD_MIRROR_XMIT_FILEPATH_MAX - 1); out->filename[H5FD_MIRROR_XMIT_FILEPATH_MAX - 1] = 0; /* force final NULL */ @@ -650,11 +648,11 @@ H5FD_mirror_xmit_decode_reply(H5FD_mirror_xmit_reply_t *out, const unsigned char LOG_OP_CALL(__func__); - HDassert(out && buf); + assert(out && buf); n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->status), &buf[n_eaten]); - HDassert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_eaten); + assert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_eaten); HDstrncpy(out->message, (const char *)&buf[n_eaten], H5FD_MIRROR_STATUS_MESSAGE_MAX - 1); out->message[H5FD_MIRROR_STATUS_MESSAGE_MAX - 1] = 0; /* force NULL term */ @@ -687,12 +685,12 @@ H5FD_mirror_xmit_decode_set_eoa(H5FD_mirror_xmit_eoa_t *out, const unsigned char LOG_OP_CALL(__func__); - HDassert(out && buf); + assert(out && buf); n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->type), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->eoa_addr), &buf[n_eaten]); - HDassert(n_eaten == H5FD_MIRROR_XMIT_EOA_SIZE); + assert(n_eaten == H5FD_MIRROR_XMIT_EOA_SIZE); return n_eaten; } /* end H5FD_mirror_xmit_decode_set_eoa() */ @@ -723,13 +721,13 @@ H5FD_mirror_xmit_decode_write(H5FD_mirror_xmit_write_t *out, const unsigned char LOG_OP_CALL(__func__); - HDassert(out && buf); + assert(out && buf); n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf); n_eaten += H5FD__mirror_xmit_decode_uint8(&(out->type), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->offset), &buf[n_eaten]); n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->size), &buf[n_eaten]); - HDassert(n_eaten == H5FD_MIRROR_XMIT_WRITE_SIZE); + assert(n_eaten == H5FD_MIRROR_XMIT_WRITE_SIZE); return n_eaten; } /* end H5FD_mirror_xmit_decode_write() */ @@ -755,14 +753,14 @@ H5FD_mirror_xmit_encode_header(unsigned char *dest, const H5FD_mirror_xmit_t *x) LOG_OP_CALL(__func__); - HDassert(dest && x); + assert(dest && x); n_writ += H5FD__mirror_xmit_encode_uint32((dest + n_writ), x->magic); n_writ += H5FD__mirror_xmit_encode_uint8((dest + n_writ), x->version); n_writ += H5FD__mirror_xmit_encode_uint32((dest + n_writ), x->session_token); n_writ += H5FD__mirror_xmit_encode_uint32((dest + n_writ), x->xmit_count); n_writ += H5FD__mirror_xmit_encode_uint8((dest + n_writ), x->op); - HDassert(n_writ == H5FD_MIRROR_XMIT_HEADER_SIZE); + assert(n_writ == H5FD_MIRROR_XMIT_HEADER_SIZE); return n_writ; } /* end H5FD_mirror_xmit_encode_header() */ @@ -787,11 +785,11 @@ H5FD_mirror_xmit_encode_lock(unsigned char *dest, const H5FD_mirror_xmit_lock_t LOG_OP_CALL(__func__); - HDassert(dest && x); + assert(dest && x); n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->rw); - HDassert(n_writ == H5FD_MIRROR_XMIT_LOCK_SIZE); + assert(n_writ == H5FD_MIRROR_XMIT_LOCK_SIZE); return n_writ; } /* end H5FD_mirror_xmit_encode_lock() */ @@ -817,16 +815,16 @@ H5FD_mirror_xmit_encode_open(unsigned char *dest, const H5FD_mirror_xmit_open_t LOG_OP_CALL(__func__); - HDassert(dest && x); + assert(dest && x); /* clear entire structure, but especially its filepath string area */ - HDmemset(dest, 0, H5FD_MIRROR_XMIT_OPEN_SIZE); + memset(dest, 0, H5FD_MIRROR_XMIT_OPEN_SIZE); n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->flags); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->maxaddr); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->size_t_blob); - HDassert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_writ); + assert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_writ); HDstrncpy((char *)&dest[n_writ], x->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX); return H5FD_MIRROR_XMIT_OPEN_SIZE; @@ -854,14 +852,14 @@ H5FD_mirror_xmit_encode_reply(unsigned char *dest, const H5FD_mirror_xmit_reply_ LOG_OP_CALL(__func__); - HDassert(dest && x); + assert(dest && x); /* clear entire structure, but especially its message string area */ - HDmemset(dest, 0, H5FD_MIRROR_XMIT_REPLY_SIZE); + memset(dest, 0, H5FD_MIRROR_XMIT_REPLY_SIZE); n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->status); - HDassert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_writ); + assert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_writ); HDstrncpy((char *)&dest[n_writ], x->message, H5FD_MIRROR_STATUS_MESSAGE_MAX); return H5FD_MIRROR_XMIT_REPLY_SIZE; @@ -888,12 +886,12 @@ H5FD_mirror_xmit_encode_set_eoa(unsigned char *dest, const H5FD_mirror_xmit_eoa_ LOG_OP_CALL(__func__); - HDassert(dest && x); + assert(dest && x); n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint8(&dest[n_writ], x->type); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->eoa_addr); - HDassert(n_writ == H5FD_MIRROR_XMIT_EOA_SIZE); + assert(n_writ == H5FD_MIRROR_XMIT_EOA_SIZE); return n_writ; } /* end H5FD_mirror_xmit_encode_set_eoa() */ @@ -919,13 +917,13 @@ H5FD_mirror_xmit_encode_write(unsigned char *dest, const H5FD_mirror_xmit_write_ LOG_OP_CALL(__func__); - HDassert(dest && x); + assert(dest && x); n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub)); n_writ += H5FD__mirror_xmit_encode_uint8(&dest[n_writ], x->type); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->offset); n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->size); - HDassert(n_writ == H5FD_MIRROR_XMIT_WRITE_SIZE); + assert(n_writ == H5FD_MIRROR_XMIT_WRITE_SIZE); return n_writ; } /* end H5FD_mirror_xmit_encode_write() */ @@ -945,7 +943,7 @@ H5FD_mirror_xmit_is_close(const H5FD_mirror_xmit_t *xmit) { LOG_OP_CALL(__func__); - HDassert(xmit); + assert(xmit); if ((TRUE == H5FD_mirror_xmit_is_xmit(xmit)) && (H5FD_MIRROR_OP_CLOSE == xmit->op)) return TRUE; @@ -968,7 +966,7 @@ H5FD_mirror_xmit_is_lock(const H5FD_mirror_xmit_lock_t *xmit) { LOG_OP_CALL(__func__); - HDassert(xmit); + assert(xmit); if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_LOCK == xmit->pub.op)) return TRUE; @@ -991,7 +989,7 @@ H5FD_mirror_xmit_is_open(const H5FD_mirror_xmit_open_t *xmit) { LOG_OP_CALL(__func__); - HDassert(xmit); + assert(xmit); if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_OPEN == xmit->pub.op)) @@ -1015,7 +1013,7 @@ H5FD_mirror_xmit_is_set_eoa(const H5FD_mirror_xmit_eoa_t *xmit) { LOG_OP_CALL(__func__); - HDassert(xmit); + assert(xmit); if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_SET_EOA == xmit->pub.op)) return TRUE; @@ -1038,7 +1036,7 @@ H5FD_mirror_xmit_is_reply(const H5FD_mirror_xmit_reply_t *xmit) { LOG_OP_CALL(__func__); - HDassert(xmit); + assert(xmit); if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_REPLY == xmit->pub.op)) return TRUE; @@ -1061,7 +1059,7 @@ H5FD_mirror_xmit_is_write(const H5FD_mirror_xmit_write_t *xmit) { LOG_OP_CALL(__func__); - HDassert(xmit); + assert(xmit); if ((TRUE == H5FD_mirror_xmit_is_xmit(&(xmit->pub))) && (H5FD_MIRROR_OP_WRITE == xmit->pub.op)) return TRUE; @@ -1084,7 +1082,7 @@ H5FD_mirror_xmit_is_xmit(const H5FD_mirror_xmit_t *xmit) { LOG_OP_CALL(__func__); - HDassert(xmit); + assert(xmit); if ((H5FD_MIRROR_XMIT_MAGIC != xmit->magic) || (H5FD_MIRROR_XMIT_CURR_VERSION != xmit->version)) return FALSE; @@ -1115,7 +1113,7 @@ H5FD__mirror_verify_reply(H5FD_mirror_t *file) LOG_OP_CALL(__func__); - HDassert(file && file->sock_fd); + assert(file && file->sock_fd); xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX); if (NULL == xmit_buf) @@ -1146,7 +1144,7 @@ H5FD__mirror_verify_reply(H5FD_mirror_t *file) if (xmit_buf) xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__mirror_verify_reply() */ /* ------------------------------------------------------------------------- @@ -1239,8 +1237,8 @@ H5FD__mirror_fapl_free(void *_fa) LOG_OP_CALL(__func__); /* sanity check */ - HDassert(fa != NULL); - HDassert(fa->magic == H5FD_MIRROR_FAPL_MAGIC); + assert(fa != NULL); + assert(fa->magic == H5FD_MIRROR_FAPL_MAGIC); fa->magic += 1; /* invalidate */ H5MM_xfree(fa); @@ -1282,12 +1280,12 @@ H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_dst /*out*/) if (NULL == fa_src) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); - HDassert(fa_src->magic == H5FD_MIRROR_FAPL_MAGIC); /* sanity check */ + assert(fa_src->magic == H5FD_MIRROR_FAPL_MAGIC); /* sanity check */ H5MM_memcpy(fa_dst, fa_src, sizeof(H5FD_mirror_fapl_t)); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Pget_fapl_mirror() */ /*------------------------------------------------------------------------- @@ -1380,17 +1378,17 @@ H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad /* Handshake with remote */ /* --------------------- */ - live_socket = HDsocket(AF_INET, SOCK_STREAM, 0); + live_socket = socket(AF_INET, SOCK_STREAM, 0); if (live_socket < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't create socket"); target_addr.sin_family = AF_INET; - target_addr.sin_port = HDhtons((uint16_t)fa.handshake_port); - target_addr.sin_addr.s_addr = HDinet_addr(fa.remote_ip); - HDmemset(target_addr.sin_zero, '\0', sizeof target_addr.sin_zero); + target_addr.sin_port = htons((uint16_t)fa.handshake_port); + target_addr.sin_addr.s_addr = inet_addr(fa.remote_ip); + memset(target_addr.sin_zero, '\0', sizeof target_addr.sin_zero); addr_size = sizeof(target_addr); - if (HDconnect(live_socket, (struct sockaddr *)&target_addr, addr_size) < 0) + if (connect(live_socket, (struct sockaddr *)&target_addr, addr_size) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't connect to remote server"); /* ------------- */ @@ -1482,8 +1480,8 @@ H5FD__mirror_close(H5FD_t *_file) LOG_OP_CALL(__func__); /* Sanity check */ - HDassert(file); - HDassert(file->sock_fd >= 0); + assert(file); + assert(file->sock_fd >= 0); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_CLOSE; @@ -1549,7 +1547,7 @@ H5FD__mirror_close(H5FD_t *_file) static herr_t H5FD__mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) { - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR LOG_OP_CALL(__func__); @@ -1566,7 +1564,7 @@ H5FD__mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) H5FD_FEAT_AGGREGATE_SMALLDATA | H5FD_FEAT_POSIX_COMPAT_HANDLE | H5FD_FEAT_SUPPORTS_SWMR_IO | H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__mirror_query() */ /*------------------------------------------------------------------------- @@ -1590,7 +1588,7 @@ H5FD__mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) LOG_OP_CALL(__func__); - HDassert(file); + assert(file); FUNC_LEAVE_NOAPI(file->eoa) } /* end H5FD__mirror_get_eoa() */ @@ -1617,7 +1615,7 @@ H5FD__mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) LOG_OP_CALL(__func__); - HDassert(file); + assert(file); file->eoa = addr; /* local copy */ @@ -1672,7 +1670,7 @@ H5FD__mirror_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) LOG_OP_CALL(__func__); - HDassert(file); + assert(file); FUNC_LEAVE_NOAPI(file->eof) } /* end H5FD__mirror_get_eof() */ @@ -1726,8 +1724,8 @@ H5FD__mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, LOG_OP_CALL(__func__); - HDassert(file); - HDassert(buf); + assert(file); + assert(buf); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_WRITE; @@ -1862,7 +1860,7 @@ H5FD__mirror_lock(H5FD_t *_file, hbool_t rw) if (xmit_buf) xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__mirror_lock */ /*------------------------------------------------------------------------- @@ -1906,7 +1904,7 @@ H5FD__mirror_unlock(H5FD_t *_file) if (xmit_buf) xmit_buf = H5FL_BLK_FREE(xmit, xmit_buf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__mirror_unlock */ #endif /* H5_HAVE_MIRROR_VFD */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDmpi.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDmpi.c index 74aedefde0..9b5f4e89f3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDmpi.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDmpi.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,11 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Friday, January 30, 2004 - * * Purpose: Common routines for all MPI-based VFL drivers. - * */ #include "H5private.h" /* Generic Functions */ @@ -38,19 +33,6 @@ * * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, January 30, 2004 - * - * Changes: Reworked function to use the ctl callback so we can get - * rid of H5FD_class_mpi_t. Since there are no real limits - * on what the ctl callback can do, its file parameter can't - * be constant. Thus, I had to remove the const qualifier - * on this functions file parameter as well. Note also the - * circumlocution required to use the ctl callbacks output - * parameter to pass back the rank without introducing - * compiler warnings. - * JRM -- 8/13/21 - * *------------------------------------------------------------------------- */ int @@ -64,16 +46,16 @@ H5FD_mpi_get_rank(H5FD_t *file) FUNC_ENTER_NOAPI(FAIL) - HDassert(file); + assert(file); cls = (const H5FD_class_t *)(file->cls); - HDassert(cls); - HDassert(cls->ctl); /* All MPI drivers must implement this */ + assert(cls); + assert(cls->ctl); /* All MPI drivers must implement this */ /* Dispatch to driver */ if ((cls->ctl)(file, H5FD_CTL_GET_MPI_RANK_OPCODE, flags, NULL, &rank_ptr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_rank request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_rank request failed"); - HDassert(rank >= 0); + assert(rank >= 0); ret_value = rank; @@ -90,19 +72,6 @@ H5FD_mpi_get_rank(H5FD_t *file) * * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, January 30, 2004 - * - * Changes: Reworked function to use the ctl callback so we can get - * rid of H5FD_class_mpi_t. Since there are no real limits - * on what the ctl callback can do, its file parameter can't - * be constant. Thus, I had to remove the const qualifier - * on this functions file parameter as well. Note also the - * circumlocution required to use the ctl callbacks output - * parameter to pass back the rank without introducing - * compiler warnings. - * JRM -- 8/13/21 - * *------------------------------------------------------------------------- */ int @@ -116,17 +85,17 @@ H5FD_mpi_get_size(H5FD_t *file) FUNC_ENTER_NOAPI(FAIL) - HDassert(file); + assert(file); cls = (const H5FD_class_t *)(file->cls); - HDassert(cls); - HDassert(cls->ctl); /* All MPI drivers must implement this */ + assert(cls); + assert(cls->ctl); /* All MPI drivers must implement this */ /* Dispatch to driver */ if ((cls->ctl)(file, H5FD_CTL_GET_MPI_SIZE_OPCODE, flags, NULL, &size_ptr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request failed"); if (0 >= size) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request returned bad value") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_size request returned bad value"); ret_value = size; @@ -143,19 +112,6 @@ H5FD_mpi_get_size(H5FD_t *file) * * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, January 30, 2004 - * - * Changes: Reworked function to use the ctl callback so we can get - * rid of H5FD_class_mpi_t. Since there are no real limits - * on what the ctl callback can do, its file parameter can't - * be constant. Thus, I had to remove the const qualifier - * on this functions file parameter as well. Note also the - * circumlocution required to use the ctl callbacks output - * parameter to pass back the rank without introducing - * compiler warnings. - * JRM -- 8/13/21 - * *------------------------------------------------------------------------- */ MPI_Comm @@ -169,17 +125,17 @@ H5FD_mpi_get_comm(H5FD_t *file) FUNC_ENTER_NOAPI(MPI_COMM_NULL) - HDassert(file); + assert(file); cls = (const H5FD_class_t *)(file->cls); - HDassert(cls); - HDassert(cls->ctl); /* All MPI drivers must implement this */ + assert(cls); + assert(cls->ctl); /* All MPI drivers must implement this */ /* Dispatch to driver */ if ((cls->ctl)(file, H5FD_CTL_GET_MPI_COMMUNICATOR_OPCODE, flags, NULL, &comm_ptr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed"); if (comm == MPI_COMM_NULL) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed -- bad comm") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed -- bad comm"); ret_value = comm; @@ -197,9 +153,6 @@ H5FD_mpi_get_comm(H5FD_t *file) * * Failure: HADDR_UNDEF * - * Programmer: Unknown - * January 30, 1998 - * *------------------------------------------------------------------------- */ haddr_t @@ -227,9 +180,6 @@ H5FD_mpi_MPIOff_to_haddr(MPI_Offset mpi_off) * * Failure: Negative, MPI_OFF is undefined. * - * Programmer: Unknown - * January 30, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -239,7 +189,7 @@ H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off /*out*/) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(mpi_off); + assert(mpi_off); /* Convert the HDF5 address into an MPI offset */ *mpi_off = (MPI_Offset)addr; @@ -261,9 +211,6 @@ H5FD_mpi_haddr_to_MPIOff(haddr_t addr, MPI_Offset *mpi_off /*out*/) * * Failure: Negative * - * Programmer: Houjun Tang - * May 19, 2022 - * *------------------------------------------------------------------------- */ herr_t @@ -276,14 +223,14 @@ H5FD_mpi_get_file_sync_required(H5FD_t *file, hbool_t *file_sync_required) FUNC_ENTER_NOAPI(FAIL) - HDassert(file); + assert(file); cls = (const H5FD_class_t *)(file->cls); - HDassert(cls); - HDassert(cls->ctl); /* All MPI drivers must implement this */ + assert(cls); + assert(cls->ctl); /* All MPI drivers must implement this */ /* Dispatch to driver */ if ((cls->ctl)(file, H5FD_CTL_GET_MPI_FILE_SYNC_OPCODE, flags, NULL, file_sync_required_ptr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_mpi_file_synce request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_mpi_file_synce request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -309,9 +256,6 @@ H5FD_mpi_get_file_sync_required(H5FD_t *file, hbool_t *file_sync_required) * Return: Success: 0 * Failure: -1 * - * Programmer: rky - * 19981207 - * *------------------------------------------------------------------------- */ herr_t @@ -325,11 +269,11 @@ H5FD_mpio_wait_for_left_neighbor(H5FD_t *_file) FUNC_ENTER_NOAPI(FAIL) - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); /* Portably initialize MPI status variable */ - HDmemset(&rcvstat, 0, sizeof(MPI_Status)); + memset(&rcvstat, 0, sizeof(MPI_Status)); /* p0 has no left neighbor; all other procs wait for msg */ if (file->mpi_rank != 0) { @@ -360,9 +304,6 @@ H5FD_mpio_wait_for_left_neighbor(H5FD_t *_file) * Return: Success: 0 * Failure: -1 * - * Programmer: rky - * 19981207 - * *------------------------------------------------------------------------- */ herr_t @@ -375,8 +316,8 @@ H5FD_mpio_signal_right_neighbor(H5FD_t *_file) FUNC_ENTER_NOAPI(FAIL) - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); if (file->mpi_rank != (file->mpi_size - 1)) if (MPI_SUCCESS != diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDmpio.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDmpio.c index 447e885976..aa83be4a5b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDmpio.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDmpio.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,11 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * * Purpose: This is the MPI-2 I/O driver. - * */ #include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */ @@ -93,11 +88,20 @@ static herr_t H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_i static herr_t H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t count, H5FD_mem_t types[], haddr_t addrs[], size_t sizes[], const void *bufs[]); -static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); -static herr_t H5FD__mpio_delete(const char *filename, hid_t fapl_id); -static herr_t H5FD__mpio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, - void **output); + +static herr_t H5FD__mpio_read_selection(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, + size_t count, hid_t mem_space_ids[], hid_t file_space_ids[], + haddr_t offsets[], size_t element_sizes[], void *bufs[]); + +static herr_t H5FD__mpio_write_selection(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, + size_t count, hid_t mem_space_ids[], hid_t file_space_ids[], + haddr_t offsets[], size_t element_sizes[], const void *bufs[]); + +static herr_t H5FD__mpio_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__mpio_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing); +static herr_t H5FD__mpio_delete(const char *filename, hid_t fapl_id); +static herr_t H5FD__mpio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void *input, + void **output); /* Other functions */ static herr_t H5FD__mpio_vector_build_types( @@ -106,48 +110,55 @@ static herr_t H5FD__mpio_vector_build_types( MPI_Offset *mpi_off, H5_flexible_const_ptr_t *mpi_bufs_base, int *size_i, MPI_Datatype *buf_type, hbool_t *buf_type_created, MPI_Datatype *file_type, hbool_t *file_type_created, char *unused); +static herr_t H5FD__selection_build_types(hbool_t io_op_write, size_t num_pieces, H5_flexible_const_ptr_t mbb, + H5S_t **file_spaces, H5S_t **mem_spaces, haddr_t offsets[], + H5_flexible_const_ptr_t bufs[], size_t src_element_sizes[], + size_t dst_element_sizes[], MPI_Datatype *final_ftype, + hbool_t *final_ftype_is_derived, MPI_Datatype *final_mtype, + hbool_t *final_mtype_is_derived); + /* The MPIO file driver information */ static const H5FD_class_t H5FD_mpio_g = { - H5FD_CLASS_VERSION, /* struct version */ - H5_VFD_MPIO, /* value */ - "mpio", /* name */ - HADDR_MAX, /* maxaddr */ - H5F_CLOSE_SEMI, /* fc_degree */ - H5FD__mpio_term, /* terminate */ - NULL, /* sb_size */ - NULL, /* sb_encode */ - NULL, /* sb_decode */ - 0, /* fapl_size */ - NULL, /* fapl_get */ - NULL, /* fapl_copy */ - NULL, /* fapl_free */ - 0, /* dxpl_size */ - NULL, /* dxpl_copy */ - NULL, /* dxpl_free */ - H5FD__mpio_open, /* open */ - H5FD__mpio_close, /* close */ - NULL, /* cmp */ - H5FD__mpio_query, /* query */ - NULL, /* get_type_map */ - NULL, /* alloc */ - NULL, /* free */ - H5FD__mpio_get_eoa, /* get_eoa */ - H5FD__mpio_set_eoa, /* set_eoa */ - H5FD__mpio_get_eof, /* get_eof */ - H5FD__mpio_get_handle, /* get_handle */ - H5FD__mpio_read, /* read */ - H5FD__mpio_write, /* write */ - H5FD__mpio_read_vector, /* read_vector */ - H5FD__mpio_write_vector, /* write_vector */ - NULL, /* read_selection */ - NULL, /* write_selection */ - H5FD__mpio_flush, /* flush */ - H5FD__mpio_truncate, /* truncate */ - NULL, /* lock */ - NULL, /* unlock */ - H5FD__mpio_delete, /* del */ - H5FD__mpio_ctl, /* ctl */ - H5FD_FLMAP_DICHOTOMY /* fl_map */ + H5FD_CLASS_VERSION, /* struct version */ + H5_VFD_MPIO, /* value */ + "mpio", /* name */ + HADDR_MAX, /* maxaddr */ + H5F_CLOSE_SEMI, /* fc_degree */ + H5FD__mpio_term, /* terminate */ + NULL, /* sb_size */ + NULL, /* sb_encode */ + NULL, /* sb_decode */ + 0, /* fapl_size */ + NULL, /* fapl_get */ + NULL, /* fapl_copy */ + NULL, /* fapl_free */ + 0, /* dxpl_size */ + NULL, /* dxpl_copy */ + NULL, /* dxpl_free */ + H5FD__mpio_open, /* open */ + H5FD__mpio_close, /* close */ + NULL, /* cmp */ + H5FD__mpio_query, /* query */ + NULL, /* get_type_map */ + NULL, /* alloc */ + NULL, /* free */ + H5FD__mpio_get_eoa, /* get_eoa */ + H5FD__mpio_set_eoa, /* set_eoa */ + H5FD__mpio_get_eof, /* get_eof */ + H5FD__mpio_get_handle, /* get_handle */ + H5FD__mpio_read, /* read */ + H5FD__mpio_write, /* write */ + H5FD__mpio_read_vector, /* read_vector */ + H5FD__mpio_write_vector, /* write_vector */ + H5FD__mpio_read_selection, /* read_selection */ + H5FD__mpio_write_selection, /* write_selection */ + H5FD__mpio_flush, /* flush */ + H5FD__mpio_truncate, /* truncate */ + NULL, /* lock */ + NULL, /* unlock */ + H5FD__mpio_delete, /* del */ + H5FD__mpio_ctl, /* ctl */ + H5FD_FLMAP_DICHOTOMY /* fl_map */ }; #ifdef H5FDmpio_DEBUG @@ -182,9 +193,6 @@ static int H5FD_mpio_debug_rank_s = -1; * * Returns: N/A * - * Programmer: Quincey Koziol - * Wednesday, Aug 12, 2020 - * *--------------------------------------------------------------------------- */ static void @@ -193,7 +201,7 @@ H5FD__mpio_parse_debug_str(const char *s) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(s); + assert(s); /* Set debug mask */ while (*s) { @@ -237,6 +245,8 @@ H5FD__mem_t_to_str(H5FD_mem_t mem_type) return "H5FD_MEM_LHEAP"; case H5FD_MEM_OHDR: return "H5FD_MEM_OHDR"; + case H5FD_MEM_NTYPES: + return "H5FD_MEM_NTYPES"; default: return "(Unknown)"; } @@ -252,9 +262,6 @@ H5FD__mem_t_to_str(H5FD_mem_t mem_type) * Return: Success: The driver ID for the mpio driver * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Thursday, August 5, 1999 - * *------------------------------------------------------------------------- */ hid_t @@ -277,10 +284,10 @@ H5FD_mpio_init(void) /* Initialize MPI if not already initialized */ if (MPI_SUCCESS != MPI_Initialized(&mpi_initialized)) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, H5I_INVALID_HID, "can't check if MPI is initialized") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, H5I_INVALID_HID, "can't check if MPI is initialized"); if (!mpi_initialized) { if (MPI_SUCCESS != MPI_Init(NULL, NULL)) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "can't initialize MPI") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, H5I_INVALID_HID, "can't initialize MPI"); H5FD_mpi_self_initialized = TRUE; } } @@ -291,12 +298,12 @@ H5FD_mpio_init(void) /* Allow MPI buf-and-file-type optimizations? */ s = HDgetenv("HDF5_MPI_OPT_TYPES"); - if (s && HDisdigit(*s)) - H5FD_mpi_opt_types_g = (0 == HDstrtol(s, NULL, 0)) ? FALSE : TRUE; + if (s && isdigit(*s)) + H5FD_mpi_opt_types_g = (0 == strtol(s, NULL, 0)) ? FALSE : TRUE; #ifdef H5FDmpio_DEBUG /* Clear the flag buffer */ - HDmemset(H5FD_mpio_debug_flags_s, 0, sizeof(H5FD_mpio_debug_flags_s)); + memset(H5FD_mpio_debug_flags_s, 0, sizeof(H5FD_mpio_debug_flags_s)); /* Retrieve MPI-IO debugging environment variable */ s = HDgetenv("H5FD_mpio_Debug"); @@ -321,9 +328,6 @@ H5FD_mpio_init(void) * * Returns: Non-negative on success or negative on failure * - * Programmer: Quincey Koziol - * Friday, Jan 30, 2004 - * *--------------------------------------------------------------------------- */ static herr_t @@ -374,9 +378,6 @@ H5FD__mpio_term(void) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Albert Cheng - * Feb 3, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -390,17 +391,17 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) /* Check arguments */ if (fapl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list"); if (MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "MPI_COMM_NULL is not a valid communicator") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "MPI_COMM_NULL is not a valid communicator"); /* Set the MPI communicator and info object */ if (H5P_set(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI communicator") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI communicator"); if (H5P_set(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI info object") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI info object"); /* duplication is done during driver setting. */ ret_value = H5P_set_driver(plist, H5FD_MPIO, NULL, NULL); @@ -427,9 +428,6 @@ H5Pset_fapl_mpio(hid_t fapl_id, MPI_Comm comm, MPI_Info info) * of the application to free them. * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -449,17 +447,17 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/) /* Check arguments */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list"); if (H5FD_MPIO != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "VFL driver is not MPI-I/O") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "VFL driver is not MPI-I/O"); /* Get the MPI communicator and info object */ if (comm) if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, comm) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI communicator") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI communicator"); if (info) if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI info object") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI info object"); done: /* Clean up anything duplicated on errors. The free calls will set @@ -468,10 +466,10 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/) if (ret_value != SUCCEED) { if (comm) if (H5_mpi_comm_free(comm) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI communicator") + HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI communicator"); if (info) if (H5_mpi_info_free(info) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI info object") + HDONE_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI info object"); } FUNC_LEAVE_API(ret_value) @@ -494,9 +492,6 @@ H5Pget_fapl_mpio(hid_t fapl_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Albert Cheng - * April 2, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -510,15 +505,15 @@ H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode) /* Check arguments */ if (dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); if (H5FD_MPIO_INDEPENDENT != xfer_mode && H5FD_MPIO_COLLECTIVE != xfer_mode) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incorrect xfer_mode") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incorrect xfer_mode"); /* Set the transfer mode */ if (H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -535,9 +530,6 @@ H5Pset_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode) * non-null. * Failure: Negative * - * Programmer: Albert Cheng - * April 2, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -551,12 +543,12 @@ H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode /*out*/) /* Check arguments */ if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); /* Get the transfer mode */ if (xfer_mode) if (H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, xfer_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value) @@ -576,8 +568,6 @@ H5Pget_dxpl_mpio(hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode /*out*/) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Kent Yang - * *------------------------------------------------------------------------- */ herr_t @@ -591,13 +581,13 @@ H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mo /* Check arguments */ if (dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); /* Set the transfer mode */ if (H5P_set(plist, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, &opt_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -617,8 +607,6 @@ H5Pset_dxpl_mpio_collective_opt(hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mo * Return: Success: Non-negative * Failure: Negative * - * Programmer: Kent Yang - * *------------------------------------------------------------------------- */ herr_t @@ -632,13 +620,13 @@ H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode) /* Check arguments */ if (dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); /* Set the transfer mode */ if (H5P_set(plist, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, &opt_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -656,8 +644,6 @@ H5Pset_dxpl_mpio_chunk_opt(hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Kent Yang - * *------------------------------------------------------------------------- */ herr_t @@ -671,13 +657,13 @@ H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc) /* Check arguments */ if (dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); /* Set the transfer mode */ if (H5P_set(plist, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, &num_chunk_per_proc) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -698,8 +684,6 @@ H5Pset_dxpl_mpio_chunk_opt_num(hid_t dxpl_id, unsigned num_chunk_per_proc) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Kent Yang - * *------------------------------------------------------------------------- */ herr_t @@ -713,13 +697,13 @@ H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_ch /* Check arguments */ if (dxpl_id == H5P_DEFAULT) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); /* Set the transfer mode */ if (H5P_set(plist, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, &percent_num_proc_per_chunk) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -732,9 +716,6 @@ H5Pset_dxpl_mpio_chunk_opt_ratio(hid_t dxpl_id, unsigned percent_num_proc_per_ch * * Return: SUCCEED/FAIL * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -751,7 +732,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* set atomicity value */ @@ -761,7 +742,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -774,9 +755,6 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) * * Return: SUCCEED/FAIL * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -794,7 +772,7 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Get atomicity value */ @@ -809,7 +787,7 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -828,9 +806,6 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) * Return: Success: A new file pointer * Failure: NULL * - * Programmer: Robert Kim Yates - * January 30, 1998 - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -857,7 +832,7 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR /* Get a pointer to the fapl */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); if (H5FD_mpi_self_initialized) { comm = MPI_COMM_WORLD; @@ -865,9 +840,9 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR else { /* Get the MPI communicator and info object from the property list */ if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator"); if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object"); } /* Get the MPI rank of this process and the total number of processes */ @@ -880,8 +855,8 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == mpi_rank)); if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", - __func__, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr); + fprintf(stderr, "%s: (%d) Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", + __func__, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr); #endif /* Convert HDF5 flags to MPI-IO flags */ @@ -953,12 +928,12 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR } /* Add info to the file access property list */ if (H5P_set(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't set MPI info object") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't set MPI info object"); } /* Build the return value and initialize it */ if (NULL == (file = (H5FD_mpio_t *)H5MM_calloc(sizeof(H5FD_mpio_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); file->f = fh; file->comm = comm; file->info = info; @@ -967,7 +942,7 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR /* Retrieve the flag indicating whether MPI_File_sync is needed after each write */ if (H5_mpio_get_file_sync_required(fh, &file->mpi_file_sync_required) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "unable to get mpi_file_sync_required hint") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "unable to get mpi_file_sync_required hint"); /* Only processor p0 will get the filesize and broadcast it. */ if (mpi_rank == 0) { @@ -1009,16 +984,16 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR if (file_opened) MPI_File_close(&fh); if (H5_mpi_comm_free(&comm) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTFREE, NULL, "unable to free MPI communicator") + HDONE_ERROR(H5E_VFL, H5E_CANTFREE, NULL, "unable to free MPI communicator"); if (H5_mpi_info_free(&info) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTFREE, NULL, "unable to free MPI info object") + HDONE_ERROR(H5E_VFL, H5E_CANTFREE, NULL, "unable to free MPI info object"); if (file) H5MM_xfree(file); } /* end if */ #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, mpi_rank); + fprintf(stderr, "%s: (%d) Leaving\n", __func__, mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1031,9 +1006,6 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR * * Return: SUCCEED/FAIL * - * Programmer: Unknown - * January 30, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -1051,12 +1023,12 @@ H5FD__mpio_close(H5FD_t *_file) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); /* MPI_File_close sets argument to MPI_FILE_NULL */ if (MPI_SUCCESS != (mpi_code = MPI_File_close(&(file->f)))) @@ -1070,7 +1042,7 @@ H5FD__mpio_close(H5FD_t *_file) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, mpi_rank); + fprintf(stderr, "%s: (%d) Leaving\n", __func__, mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1084,9 +1056,6 @@ H5FD__mpio_close(H5FD_t *_file) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Friday, August 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -1117,9 +1086,6 @@ H5FD__mpio_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags /* out * Return: Success: The end-of-address marker * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Friday, August 6, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1130,8 +1096,8 @@ H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); FUNC_LEAVE_NOAPI(file->eoa) } /* end H5FD__mpio_get_eoa() */ @@ -1145,9 +1111,6 @@ H5FD__mpio_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Friday, August 6, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1158,8 +1121,8 @@ H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); file->eoa = addr; @@ -1187,9 +1150,6 @@ H5FD__mpio_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) * Return: Success: The end-of-file marker * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Friday, August 6, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1200,8 +1160,8 @@ H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); FUNC_LEAVE_NOAPI(file->eof) } /* end H5FD__mpio_get_eof() */ @@ -1213,9 +1173,6 @@ H5FD__mpio_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Returns: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Sept. 16, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -1227,7 +1184,7 @@ H5FD__mpio_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand FUNC_ENTER_PACKAGE if (!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); *file_handle = &(file->f); @@ -1252,8 +1209,6 @@ H5FD__mpio_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand * * Failure: FAIL. Contents of buffer BUF are undefined. * - * Programmer: rky, 1998-01-30 - * *------------------------------------------------------------------------- */ static herr_t @@ -1290,20 +1245,20 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); - HDassert(buf); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); + assert(buf); /* Portably initialize MPI status variable */ - HDmemset(&mpi_stat, 0, sizeof(MPI_Status)); + memset(&mpi_stat, 0, sizeof(MPI_Status)); /* some numeric conversions */ if (H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off /*out*/) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off"); size_i = (int)size; /* Only look for MPI views for raw data transfers */ @@ -1312,7 +1267,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU /* Get the transfer mode from the API context */ if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); /* * Set up for a fancy xfer using complex types, or single byte block. We @@ -1328,7 +1283,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU /* Prepare for a full-blown xfer using btype, ftype, and disp */ if (H5CX_get_mpi_coll_datatypes(&buf_type, &file_type) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O datatypes") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O datatypes"); /* * Set the file view when we are using MPI derived types @@ -1350,22 +1305,22 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property"); if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank); #endif /* Check whether we should read from rank 0 and broadcast to other ranks */ if (H5CX_get_mpio_rank0_bcast()) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", __func__, file->mpi_rank); #endif /* Indicate path we've taken */ rank0_bcast = TRUE; @@ -1391,7 +1346,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU else { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent read operation */ @@ -1417,7 +1372,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU */ if (H5_mpio_create_large_type(size, 0, MPI_BYTE, &buf_type) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype"); derived_type = TRUE; size_i = 1; @@ -1425,7 +1380,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent read operation */ @@ -1481,19 +1436,19 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU /* Check for read failure */ if (bytes_read < 0 || bytes_read > io_size) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed"); #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld type = %s\n", __func__, file->mpi_rank, - (long)mpi_off, (long long)bytes_read, H5FD__mem_t_to_str(type)); + fprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld type = %s\n", __func__, file->mpi_rank, + (long)mpi_off, (long long)bytes_read, H5FD__mem_t_to_str(type)); #endif /* * This gives us zeroes beyond end of physical MPI file. */ if ((n = (io_size - bytes_read)) > 0) - HDmemset((char *)buf + bytes_read, 0, (size_t)n); + memset((char *)buf + bytes_read, 0, (size_t)n); done: if (derived_type) @@ -1501,7 +1456,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1523,9 +1478,6 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU * Failure: FAIL. USE_TYPES and OLD_USE_TYPES in the * access params may be altered. * - * Programmer: Robert Kim Yates - * January 30, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -1560,28 +1512,28 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); - HDassert(buf); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); + assert(buf); /* Verify that no data is written when between MPI_Barrier()s during file flush */ - HDassert(!H5CX_get_mpi_file_flushing()); + assert(!H5CX_get_mpi_file_flushing()); /* Portably initialize MPI status variable */ - HDmemset(&mpi_stat, 0, sizeof(MPI_Status)); + memset(&mpi_stat, 0, sizeof(MPI_Status)); /* some numeric conversions */ if (H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off"); size_i = (int)size; /* Get the transfer mode from the API context */ if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); /* * Set up for a fancy xfer using complex types, or single byte block. We @@ -1597,7 +1549,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h /* Prepare for a full-blown xfer using btype, ftype, and disp */ if (H5CX_get_mpi_coll_datatypes(&buf_type, &file_type) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O datatypes") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O datatypes"); /* * Set the file view when we are using MPI derived types @@ -1618,17 +1570,17 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property"); if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank); #endif /* Perform collective write operation */ if (MPI_SUCCESS != @@ -1644,11 +1596,11 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h else { if (type != H5FD_MEM_DRAW) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, - "Metadata Coll opt property should be collective at this point") + "Metadata Coll opt property should be collective at this point"); #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent write operation */ if (MPI_SUCCESS != @@ -1671,7 +1623,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h */ if (H5_mpio_create_large_type(size, 0, MPI_BYTE, &buf_type) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype"); derived_type = TRUE; size_i = 1; @@ -1679,7 +1631,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent write operation */ @@ -1708,12 +1660,12 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h /* Check for write failure */ if (bytes_written != io_size || bytes_written < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed"); #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld type = %s\n", __func__, - file->mpi_rank, (long)mpi_off, (long long)bytes_written, H5FD__mem_t_to_str(type)); + fprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld type = %s\n", __func__, file->mpi_rank, + (long)mpi_off, (long long)bytes_written, H5FD__mem_t_to_str(type)); #endif /* Each process will keep track of its perceived EOF value locally, and @@ -1733,7 +1685,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", __func__, file->mpi_rank, ret_value); + fprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", __func__, file->mpi_rank, ret_value); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1749,9 +1701,6 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h * Return: Success: SUCCEED. * Failure: FAIL. * - * Programmer: Neil Fortner - * March 14, 2022 - * *------------------------------------------------------------------------- */ static herr_t @@ -1780,20 +1729,20 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(s_sizes); - HDassert(s_bufs); - HDassert(vector_was_sorted); - HDassert(*vector_was_sorted); - HDassert(mpi_off); - HDassert(mpi_bufs_base); - HDassert(size_i); - HDassert(buf_type); - HDassert(buf_type_created); - HDassert(!*buf_type_created); - HDassert(file_type); - HDassert(file_type_created); - HDassert(!*file_type_created); - HDassert(unused); + assert(s_sizes); + assert(s_bufs); + assert(vector_was_sorted); + assert(*vector_was_sorted); + assert(mpi_off); + assert(mpi_bufs_base); + assert(size_i); + assert(buf_type); + assert(buf_type_created); + assert(!*buf_type_created); + assert(file_type); + assert(file_type_created); + assert(!*file_type_created); + assert(unused); /* Get bio I/O transition point (may be lower than 2G for testing) */ bigio_count = H5_mpi_get_bigio_count(); @@ -1814,7 +1763,7 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ /* some numeric conversions */ if (H5FD_mpi_haddr_to_MPIOff(addrs[0], mpi_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI offset") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI offset"); /* Check for size overflow */ if (sizes[0] > bigio_count) { @@ -1824,11 +1773,11 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ * count) to 1 when using the derived_type. */ if (H5_mpio_create_large_type(sizes[0], 0, MPI_BYTE, buf_type) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype"); *buf_type_created = TRUE; if (H5_mpio_create_large_type(sizes[0], 0, MPI_BYTE, file_type) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype"); *file_type_created = TRUE; *size_i = 1; @@ -1847,13 +1796,13 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ */ if (H5FD_sort_vector_io_req(vector_was_sorted, count, types, addrs, sizes, bufs, &s_types, s_addrs, s_sizes, s_bufs) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't sort vector I/O request") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't sort vector I/O request"); - if ((NULL == (mpi_block_lengths = (int *)HDmalloc((size_t)count * sizeof(int)))) || - (NULL == (mpi_displacements = (MPI_Aint *)HDmalloc((size_t)count * sizeof(MPI_Aint)))) || - (NULL == (mpi_bufs = (MPI_Aint *)HDmalloc((size_t)count * sizeof(MPI_Aint))))) { + if ((NULL == (mpi_block_lengths = (int *)malloc((size_t)count * sizeof(int)))) || + (NULL == (mpi_displacements = (MPI_Aint *)malloc((size_t)count * sizeof(MPI_Aint)))) || + (NULL == (mpi_bufs = (MPI_Aint *)malloc((size_t)count * sizeof(MPI_Aint))))) { - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc mpi block lengths / displacement") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc mpi block lengths / displacement"); } /* when we setup mpi_bufs[] below, all addresses are offsets from @@ -1889,7 +1838,7 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ /* Determine size of this vector element */ if (!fixed_size) { if ((*s_sizes)[i] == 0) { - HDassert(vector_was_sorted); + assert(vector_was_sorted); fixed_size = TRUE; size = sizes[i - 1]; } @@ -1923,32 +1872,32 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ /* Allocate arrays to keep track of types and whether they were created, if * necessary */ if (!sub_types) { - HDassert(!sub_types_created); + assert(!sub_types_created); - if (NULL == (sub_types = HDmalloc((size_t)count * sizeof(MPI_Datatype)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sub types array") - if (NULL == (sub_types_created = (uint8_t *)HDcalloc((size_t)count, 1))) { + if (NULL == (sub_types = malloc((size_t)count * sizeof(MPI_Datatype)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sub types array"); + if (NULL == (sub_types_created = (uint8_t *)calloc((size_t)count, 1))) { H5MM_free(sub_types); sub_types = NULL; - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sub types created array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sub types created array"); } /* Initialize sub_types to all MPI_BYTE */ for (j = 0; j < (int)count; j++) sub_types[j] = MPI_BYTE; } - HDassert(sub_types_created); + assert(sub_types_created); /* Create type for large block */ if (H5_mpio_create_large_type(size, 0, MPI_BYTE, &sub_types[i]) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype"); sub_types_created[i] = TRUE; /* Only one of these large types for this vector element */ mpi_block_lengths[i] = 1; } else - HDassert(size == (size_t)mpi_block_lengths[i]); + assert(size == (size_t)mpi_block_lengths[i]); } /* create the memory MPI derived types */ @@ -1984,34 +1933,34 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit for file_type failed", mpi_code) /* Free up memory used to build types */ - HDassert(mpi_block_lengths); - HDfree(mpi_block_lengths); + assert(mpi_block_lengths); + free(mpi_block_lengths); mpi_block_lengths = NULL; - HDassert(mpi_displacements); - HDfree(mpi_displacements); + assert(mpi_displacements); + free(mpi_displacements); mpi_displacements = NULL; - HDassert(mpi_bufs); - HDfree(mpi_bufs); + assert(mpi_bufs); + free(mpi_bufs); mpi_bufs = NULL; if (sub_types) { - HDassert(sub_types); + assert(sub_types); for (i = 0; i < (int)count; i++) if (sub_types_created[i]) MPI_Type_free(&sub_types[i]); - HDfree(sub_types); + free(sub_types); sub_types = NULL; - HDfree(sub_types_created); + free(sub_types_created); sub_types_created = NULL; } /* some numeric conversions */ if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, mpi_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0"); } else { /* setup for null participation in the collective operation. */ @@ -2026,54 +1975,54 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ /* some numeric conversions */ if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, mpi_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0"); } done: /* free sorted vectors if they exist */ if (!vector_was_sorted) if (s_types) { - HDfree(s_types); + free(s_types); s_types = NULL; } /* Clean up on error */ if (ret_value < 0) { if (mpi_block_lengths) { - HDfree(mpi_block_lengths); + free(mpi_block_lengths); mpi_block_lengths = NULL; } if (mpi_displacements) { - HDfree(mpi_displacements); + free(mpi_displacements); mpi_displacements = NULL; } if (mpi_bufs) { - HDfree(mpi_bufs); + free(mpi_bufs); mpi_bufs = NULL; } if (sub_types) { - HDassert(sub_types_created); + assert(sub_types_created); for (i = 0; i < (int)count; i++) if (sub_types_created[i]) MPI_Type_free(&sub_types[i]); - HDfree(sub_types); + free(sub_types); sub_types = NULL; - HDfree(sub_types_created); + free(sub_types_created); sub_types_created = NULL; } } /* Make sure we cleaned up */ - HDassert(!mpi_block_lengths); - HDassert(!mpi_displacements); - HDassert(!mpi_bufs); - HDassert(!sub_types); - HDassert(!sub_types_created); + assert(!mpi_block_lengths); + assert(!mpi_displacements); + assert(!mpi_bufs); + assert(!sub_types); + assert(!sub_types_created); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__mpio_vector_build_types() */ @@ -2110,9 +2059,6 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ * Return: Success: SUCCEED. * Failure: FAIL. * - * Programmer: John Mainzer - * March 15, 2021 - * *------------------------------------------------------------------------- */ static herr_t @@ -2159,22 +2105,22 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); - HDassert((types) || (count == 0)); - HDassert((addrs) || (count == 0)); - HDassert((sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); + assert((types) || (count == 0)); + assert((addrs) || (count == 0)); + assert((sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* verify that the first elements of the sizes and types arrays are * valid. */ - HDassert((count == 0) || (sizes[0] != 0)); - HDassert((count == 0) || (types[0] != H5FD_MEM_NOLIST)); + assert((count == 0) || (sizes[0] != 0)); + assert((count == 0) || (types[0] != H5FD_MEM_NOLIST)); /* Get the transfer mode from the API context * @@ -2185,7 +2131,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou * read, it does mean that all ranks are here, so we can use MPI_File_set_view(). */ if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); if (xfer_mode == H5FD_MPIO_COLLECTIVE) { /* Build MPI types, etc. */ @@ -2194,21 +2140,21 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou &vector_was_sorted, &mpi_off, (H5_flexible_const_ptr_t *)&mpi_bufs_base, &size_i, &buf_type, &buf_type_created, &file_type, &file_type_created, &unused) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't build MPI datatypes for I/O") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't build MPI datatypes for I/O"); /* free sorted addrs vector if it exists */ if (!vector_was_sorted) if (s_addrs) { - HDfree(s_addrs); + free(s_addrs); s_addrs = NULL; } /* Portably initialize MPI status variable */ - HDmemset(&mpi_stat, 0, sizeof(mpi_stat)); + memset(&mpi_stat, 0, sizeof(mpi_stat)); #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", __func__, (long)mpi_off, size_i); + fprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", __func__, (long)mpi_off, size_i); #endif /* Setup the file view. */ @@ -2218,29 +2164,29 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou /* Reset mpi_off to 0 since the view now starts at the data offset */ if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0"); /* Get the collective_opt property to check whether the application wants to do IO individually. */ if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property"); /* Read the data. */ #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stdout, "%s: using MPIO collective mode\n", __func__); + fprintf(stdout, "%s: using MPIO collective mode\n", __func__); #endif if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stdout, "%s: doing MPI collective IO\n", __func__); + fprintf(stdout, "%s: doing MPI collective IO\n", __func__); #endif /* Check whether we should read from rank 0 and broadcast to other ranks */ if (H5CX_get_mpio_rank0_bcast()) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", __func__); + fprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", __func__); #endif /* Indicate path we've taken */ rank0_bcast = TRUE; @@ -2260,7 +2206,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou else if (size_i > 0) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stdout, "%s: doing MPI independent IO\n", __func__); + fprintf(stdout, "%s: doing MPI independent IO\n", __func__); #endif if (MPI_SUCCESS != @@ -2315,7 +2261,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou /* Check for read failure */ if (bytes_read < 0 || bytes_read > io_size) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed"); /* Check for incomplete read */ n = io_size - bytes_read; @@ -2325,7 +2271,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou /* Iterate over sorted array in reverse, filling in zeroes to * sections of the buffers that were not read to */ do { - HDassert(i >= 0); + assert(i >= 0); #if MPI_VERSION >= 3 io_size = MIN(n, (MPI_Count)s_sizes[i]); @@ -2334,9 +2280,9 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou io_size = MIN(n, (int)s_sizes[i]); bytes_read = (int)s_sizes[i] - io_size; #endif - HDassert(bytes_read >= 0); + assert(bytes_read >= 0); - HDmemset((char *)s_bufs[i] + bytes_read, 0, (size_t)io_size); + memset((char *)s_bufs[i] + bytes_read, 0, (size_t)io_size); n -= io_size; i--; @@ -2364,14 +2310,14 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stdout, "%s: doing MPI independent IO\n", __func__); + fprintf(stdout, "%s: doing MPI independent IO\n", __func__); #endif /* Loop over vector elements */ for (i = 0; i < (int)count; i++) { /* Convert address to mpi offset */ if (H5FD_mpi_haddr_to_MPIOff(addrs[i], &mpi_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off"); /* Calculate I/O size */ if (!fixed_size) { @@ -2394,7 +2340,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou */ if (H5_mpio_create_large_type(size, 0, MPI_BYTE, &buf_type) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype"); buf_type_created = TRUE; size_i = 1; @@ -2403,7 +2349,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou /* Check if we actually need to do I/O */ if (addrs[i] < max_addr) { /* Portably initialize MPI status variable */ - HDmemset(&mpi_stat, 0, sizeof(mpi_stat)); + memset(&mpi_stat, 0, sizeof(mpi_stat)); /* Issue read */ if (MPI_SUCCESS != @@ -2428,7 +2374,7 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou /* Check for read failure */ if (bytes_read < 0 || bytes_read > io_size) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed"); /* * If we didn't read the entire I/O, fill in zeroes beyond end of @@ -2436,13 +2382,13 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou * addresses. */ if ((n = (io_size - bytes_read)) > 0) { - HDmemset((char *)bufs[i] + bytes_read, 0, (size_t)n); + memset((char *)bufs[i] + bytes_read, 0, (size_t)n); max_addr = addrs[i] + (haddr_t)bytes_read; } } else { /* Read is past the max address, fill in zeroes */ - HDmemset((char *)bufs[i], 0, size); + memset((char *)bufs[i], 0, size); } } } @@ -2459,22 +2405,22 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou /* free sorted vectors if they exist */ if (!vector_was_sorted) { if (s_addrs) { - HDfree(s_addrs); + free(s_addrs); s_addrs = NULL; } if (s_sizes) { - HDfree(s_sizes); + free(s_sizes); s_sizes = NULL; } if (s_bufs) { - HDfree(s_bufs); + free(s_bufs); s_bufs = NULL; } } #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", __func__, file->mpi_rank, ret_value); + fprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", __func__, file->mpi_rank, ret_value); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -2513,9 +2459,6 @@ H5FD__mpio_read_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t cou * Return: Success: SUCCEED. * Failure: FAIL. * - * Programmer: John Mainzer - * March 15, 2021 - * *------------------------------------------------------------------------- */ static herr_t @@ -2551,26 +2494,26 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); - HDassert((types) || (count == 0)); - HDassert((addrs) || (count == 0)); - HDassert((sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); + assert((types) || (count == 0)); + assert((addrs) || (count == 0)); + assert((sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* verify that the first elements of the sizes and types arrays are * valid. */ - HDassert((count == 0) || (sizes[0] != 0)); - HDassert((count == 0) || (types[0] != H5FD_MEM_NOLIST)); + assert((count == 0) || (sizes[0] != 0)); + assert((count == 0) || (types[0] != H5FD_MEM_NOLIST)); /* Verify that no data is written when between MPI_Barrier()s during file flush */ - HDassert(!H5CX_get_mpi_file_flushing()); + assert(!H5CX_get_mpi_file_flushing()); /* Get the transfer mode from the API context * @@ -2581,7 +2524,7 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co * write, it does mean that all ranks are here, so we can use MPI_File_set_view(). */ if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); if (xfer_mode == H5FD_MPIO_COLLECTIVE) { /* Build MPI types, etc. */ @@ -2590,7 +2533,7 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co &vector_was_sorted, &mpi_off, (H5_flexible_const_ptr_t *)&mpi_bufs_base, &size_i, &buf_type, &buf_type_created, &file_type, &file_type_created, &unused) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't build MPI datatypes for I/O") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't build MPI datatypes for I/O"); /* Compute max addr writted to */ if (count > 0) @@ -2599,25 +2542,25 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co /* free sorted vectors if they exist */ if (!vector_was_sorted) { if (s_addrs) { - HDfree(s_addrs); + free(s_addrs); s_addrs = NULL; } if (s_sizes) { - HDfree(s_sizes); + free(s_sizes); s_sizes = NULL; } if (s_bufs) { - HDfree(s_bufs); + free(s_bufs); s_bufs = NULL; } } /* Portably initialize MPI status variable */ - HDmemset(&mpi_stat, 0, sizeof(MPI_Status)); + memset(&mpi_stat, 0, sizeof(MPI_Status)); #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", __func__, (long)mpi_off, size_i); + fprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", __func__, (long)mpi_off, size_i); #endif /* Setup the file view. */ @@ -2627,23 +2570,23 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co /* Reset mpi_off to 0 since the view now starts at the data offset */ if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0"); /* Get the collective_opt property to check whether the application wants to do IO individually. */ if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property"); /* Write the data. */ #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stdout, "%s: using MPIO collective mode\n", __func__); + fprintf(stdout, "%s: using MPIO collective mode\n", __func__); #endif if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stdout, "%s: doing MPI collective IO\n", __func__); + fprintf(stdout, "%s: doing MPI collective IO\n", __func__); #endif if (MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(file->f, mpi_off, mpi_bufs_base, size_i, @@ -2659,7 +2602,7 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co else if (size_i > 0) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stdout, "%s: doing MPI independent IO\n", __func__); + fprintf(stdout, "%s: doing MPI independent IO\n", __func__); #endif if (MPI_SUCCESS != @@ -2692,14 +2635,14 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stdout, "%s: doing MPI independent IO\n", __func__); + fprintf(stdout, "%s: doing MPI independent IO\n", __func__); #endif /* Loop over vector elements */ for (i = 0; i < (int)count; i++) { /* Convert address to mpi offset */ if (H5FD_mpi_haddr_to_MPIOff(addrs[i], &mpi_off) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off"); /* Calculate I/O size */ if (!fixed_size) { @@ -2722,7 +2665,7 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co */ if (H5_mpio_create_large_type(size, 0, MPI_BYTE, &buf_type) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "can't create MPI-I/O datatype"); buf_type_created = TRUE; size_i = 1; @@ -2763,32 +2706,952 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co /* Cleanup on error */ if (ret_value < 0 && !vector_was_sorted) { if (s_addrs) { - HDfree(s_addrs); + free(s_addrs); s_addrs = NULL; } if (s_sizes) { - HDfree(s_sizes); + free(s_sizes); s_sizes = NULL; } if (s_bufs) { - HDfree(s_bufs); + free(s_bufs); s_bufs = NULL; } } /* Make sure we cleaned up */ - HDassert(vector_was_sorted || !s_addrs); - HDassert(vector_was_sorted || !s_sizes); - HDassert(vector_was_sorted || !s_bufs); + assert(vector_was_sorted || !s_addrs); + assert(vector_was_sorted || !s_sizes); + assert(vector_was_sorted || !s_bufs); #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", __func__, file->mpi_rank, ret_value); + fprintf(stdout, "%s: Leaving, proc %d: ret_value = %d\n", __func__, file->mpi_rank, ret_value); #endif FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__mpio_write_vector() */ +/*------------------------------------------------------------------------- + * Function: H5FD__selection_build_types + * + * Purpose: Build MPI derived datatype for each piece and then + * build MPI final derived datatype for file and memory. + * + * Note: This is derived from H5D__link_piece_collective_io() in + * src/H5Dmpio.c. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__selection_build_types(hbool_t io_op_write, size_t num_pieces, H5_flexible_const_ptr_t mbb, + H5S_t **file_spaces, H5S_t **mem_spaces, haddr_t offsets[], + H5_flexible_const_ptr_t bufs[], size_t src_element_sizes[], + size_t dst_element_sizes[], MPI_Datatype *final_ftype, + hbool_t *final_ftype_is_derived, MPI_Datatype *final_mtype, + hbool_t *final_mtype_is_derived) +{ + + MPI_Datatype *piece_mtype = NULL; + MPI_Datatype *piece_ftype = NULL; + MPI_Aint *piece_file_disp_array = NULL; + MPI_Aint *piece_mem_disp_array = NULL; + hbool_t *piece_mft_is_derived_array = + NULL; /* Flags to indicate each piece's MPI file datatype is derived */ + ; + hbool_t *piece_mmt_is_derived_array = + NULL; /* Flags to indicate each piece's MPI memory datatype is derived */ + int *piece_mpi_file_counts = NULL; /* Count of MPI file datatype for each piece */ + int *piece_mpi_mem_counts = NULL; /* Count of MPI memory datatype for each piece */ + + haddr_t base_file_addr; + size_t i; /* Local index variable */ + int mpi_code; /* MPI return code */ + + hbool_t extend_src_sizes = FALSE; + hbool_t extend_dst_sizes = FALSE; + hbool_t extend_bufs = FALSE; + H5_flexible_const_ptr_t buf; + size_t src_element_size, dst_element_size; + + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* Allocate information for num_pieces */ + if (NULL == (piece_mtype = (MPI_Datatype *)H5MM_malloc(num_pieces * sizeof(MPI_Datatype)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate piece memory datatype buffer"); + if (NULL == (piece_ftype = (MPI_Datatype *)H5MM_malloc(num_pieces * sizeof(MPI_Datatype)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate piece file datatype buffer"); + if (NULL == (piece_file_disp_array = (MPI_Aint *)H5MM_malloc(num_pieces * sizeof(MPI_Aint)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate piece file displacement buffer"); + if (NULL == (piece_mem_disp_array = (MPI_Aint *)H5MM_calloc(num_pieces * sizeof(MPI_Aint)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate piece memory displacement buffer"); + if (NULL == (piece_mpi_mem_counts = (int *)H5MM_calloc(num_pieces * sizeof(int)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate piece memory counts buffer"); + if (NULL == (piece_mpi_file_counts = (int *)H5MM_calloc(num_pieces * sizeof(int)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate piece file counts buffer"); + if (NULL == (piece_mmt_is_derived_array = (hbool_t *)H5MM_calloc(num_pieces * sizeof(hbool_t)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, + "couldn't allocate piece memory is derived datatype flags buffer"); + if (NULL == (piece_mft_is_derived_array = (hbool_t *)H5MM_calloc(num_pieces * sizeof(hbool_t)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, + "couldn't allocate piece file is derived datatype flags buffer"); + + /* save lowest file address */ + base_file_addr = offsets[0]; + + /* Obtain MPI derived datatype from all individual pieces */ + /* Iterate over selected pieces for this process */ + for (i = 0; i < num_pieces; i++) { + hsize_t *permute_map = NULL; /* array that holds the mapping from the old, + out-of-order displacements to the in-order + displacements of the MPI datatypes of the + point selection of the file space */ + hbool_t is_permuted = FALSE; + + if (!extend_src_sizes) { + if (src_element_sizes[i] == 0) { + extend_src_sizes = TRUE; + src_element_size = src_element_sizes[i - 1]; + } + else + src_element_size = src_element_sizes[i]; + } + + if (!extend_dst_sizes) { + if (dst_element_sizes[i] == 0) { + extend_dst_sizes = TRUE; + dst_element_size = dst_element_sizes[i - 1]; + } + else + dst_element_size = src_element_sizes[i]; + } + + if (!extend_bufs) { + if (bufs[i].cvp == NULL) { + extend_bufs = TRUE; + buf = bufs[i - 1]; + } + else + buf = bufs[i]; + } + + /* Obtain disk and memory MPI derived datatype */ + /* NOTE: The permute_map array can be allocated within H5S_mpio_space_type + * and will be fed into the next call to H5S_mpio_space_type + * where it will be freed. + */ + if (H5S_mpio_space_type(file_spaces[i], src_element_size, &piece_ftype[i], /* OUT: datatype created */ + &piece_mpi_file_counts[i], /* OUT */ + &(piece_mft_is_derived_array[i]), /* OUT */ + TRUE, /* this is a file space, + so permute the + datatype if the point + selections are out of + order */ + &permute_map, /* OUT: a map to indicate the + permutation of points + selected in case they + are out of order */ + &is_permuted /* OUT */) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI file type"); + + /* Sanity check */ + if (is_permuted) + assert(permute_map); + + if (H5S_mpio_space_type(mem_spaces[i], dst_element_size, &piece_mtype[i], &piece_mpi_mem_counts[i], + &(piece_mmt_is_derived_array[i]), FALSE, /* this is a memory + space, so if the file + space is not + permuted, there is no + need to permute the + datatype if the point + selections are out of + order*/ + &permute_map, /* IN: the permutation map + generated by the + file_space selection + and applied to the + memory selection */ + &is_permuted /* IN */) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create MPI buf type"); + + /* Sanity check */ + if (is_permuted) + assert(!permute_map); + + /* Piece address relative to the first piece addr + * Assign piece address to MPI displacement + * (assume MPI_Aint big enough to hold it) */ + piece_file_disp_array[i] = (MPI_Aint)offsets[i] - (MPI_Aint)base_file_addr; + + if (io_op_write) { + piece_mem_disp_array[i] = (MPI_Aint)buf.cvp - (MPI_Aint)mbb.cvp; + } + else { + piece_mem_disp_array[i] = (MPI_Aint)buf.vp - (MPI_Aint)mbb.vp; + } + } /* end for */ + + /* Create final MPI derived datatype for the file */ + if (MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)num_pieces, piece_mpi_file_counts, + piece_file_disp_array, piece_ftype, final_ftype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code); + + if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(final_ftype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code); + *final_ftype_is_derived = TRUE; + + /* Create final MPI derived datatype for memory */ + if (MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)num_pieces, piece_mpi_mem_counts, + piece_mem_disp_array, piece_mtype, final_mtype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code); + + if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(final_mtype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code); + *final_mtype_is_derived = TRUE; + + /* Free the file & memory MPI datatypes for each piece */ + for (i = 0; i < num_pieces; i++) { + if (piece_mmt_is_derived_array[i]) + if (MPI_SUCCESS != (mpi_code = MPI_Type_free(piece_mtype + i))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code); + + if (piece_mft_is_derived_array[i]) + if (MPI_SUCCESS != (mpi_code = MPI_Type_free(piece_ftype + i))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code); + } /* end for */ + +done: + + /* Release resources */ + if (piece_mtype) + H5MM_xfree(piece_mtype); + if (piece_ftype) + H5MM_xfree(piece_ftype); + if (piece_file_disp_array) + H5MM_xfree(piece_file_disp_array); + if (piece_mem_disp_array) + H5MM_xfree(piece_mem_disp_array); + if (piece_mpi_mem_counts) + H5MM_xfree(piece_mpi_mem_counts); + if (piece_mpi_file_counts) + H5MM_xfree(piece_mpi_file_counts); + if (piece_mmt_is_derived_array) + H5MM_xfree(piece_mmt_is_derived_array); + if (piece_mft_is_derived_array) + H5MM_xfree(piece_mft_is_derived_array); + + FUNC_LEAVE_NOAPI(ret_value); + +} /* H5FD__selection_build_types() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__mpio_read_selection + * + * Purpose: The behaviour of this function dependes on the value of + * the transfer mode obtained from the context. + * + * If the transfer mode is H5FD_MPIO_COLLECTIVE: + * --sort the selections + * --set mpi_bufs_base + * --build the MPI derived types + * --perform MPI_File_set_view() + * --perform MPI_File_read_at_all() or MPI_File_read_at() + * depending on whether this is a H5FD_MPIO_COLLECTIVE_IO + * + * If this is not H5FD_MPIO_COLLECTIVE: + * --undo possible base address addition in internal routines + * --call H5FD_read_vector_from_selection() to perform vector + * or scalar writes for the selections + * + * Return: Success: SUCCEED. + * Failure: FAIL. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__mpio_read_selection(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, size_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], + size_t element_sizes[], void *bufs[] /* out */) +{ + H5FD_mpio_t *file = (H5FD_mpio_t *)_file; + MPI_Offset mpi_off; + MPI_Status mpi_stat; /* Status from I/O operation */ + int size_i; /* Integer copy of 'size' to read */ + + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ + H5FD_mpio_collective_opt_t coll_opt_mode; + + MPI_Datatype final_mtype; /* Final memory MPI datatype for all pieces with selection */ + hbool_t final_mtype_is_derived = FALSE; + + MPI_Datatype final_ftype; /* Final file MPI datatype for all pieces with selection */ + hbool_t final_ftype_is_derived = FALSE; + + hid_t *s_mem_space_ids = NULL; + hid_t *s_file_space_ids = NULL; + haddr_t *s_offsets = NULL; + size_t *s_element_sizes = NULL; + H5_flexible_const_ptr_t *s_bufs = NULL; + hbool_t selection_was_sorted = TRUE; + + uint32_t i, j; + H5S_t **s_mem_spaces = NULL; + H5S_t **s_file_spaces = NULL; + haddr_t tmp_offset = 0; + void *mpi_bufs_base = NULL; + char unused = 0; /* Unused, except for non-NULL pointer value */ + +#if H5_CHECK_MPI_VERSION(3, 0) + MPI_Count bytes_read = 0; /* Number of bytes read in */ + MPI_Count type_size; /* MPI datatype used for I/O's size */ + MPI_Count io_size; /* Actual number of bytes requested */ + MPI_Count n; +#else + int bytes_read = 0; /* Number of bytes read in */ + int type_size; /* MPI datatype used for I/O's size */ + int io_size; /* Actual number of bytes requested */ + int n; +#endif + hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */ +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); + hbool_t H5FD_mpio_debug_r_flag = (H5FD_mpio_debug_flags_s[(int)'r'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* MPI return code */ + H5_flexible_const_ptr_t mbb; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_t_flag) + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); +#endif + + /* Sanity checks */ + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); + assert((count == 0) || (mem_space_ids)); + assert((count == 0) || (file_space_ids)); + assert((count == 0) || (offsets)); + assert((count == 0) || (element_sizes)); + assert((count == 0) || (bufs)); + + /* Verify that the first elements of the element_sizes and bufs arrays are + * valid. */ + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0] != NULL)); + + /* Portably initialize MPI status variable */ + memset(&mpi_stat, 0, sizeof(MPI_Status)); + + /* Get the transfer mode from the API context */ + if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); + + /* + * Set up for a fancy xfer using complex types, or single byte block. We + * wouldn't need to rely on the use_view field if MPI semantics allowed + * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which + * could mean "use MPI_BYTE" by convention). + */ + if (xfer_mode == H5FD_MPIO_COLLECTIVE) { + + if (count) { + if (H5FD_sort_selection_io_req(&selection_was_sorted, count, mem_space_ids, file_space_ids, + offsets, element_sizes, (H5_flexible_const_ptr_t *)bufs, + &s_mem_space_ids, &s_file_space_ids, &s_offsets, &s_element_sizes, + &s_bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't sort selection I/O request"); + + tmp_offset = s_offsets[0]; + + if (NULL == (s_file_spaces = H5MM_malloc(count * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for file space list"); + if (NULL == (s_mem_spaces = H5MM_malloc(count * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for memory space list"); + + for (i = 0; i < count; i++) { + if (NULL == (s_mem_spaces[i] = (H5S_t *)H5I_object_verify(s_mem_space_ids[i], H5I_DATASPACE))) + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, + "can't retrieve memory dataspace from ID"); + if (NULL == + (s_file_spaces[i] = (H5S_t *)H5I_object_verify(s_file_space_ids[i], H5I_DATASPACE))) + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, + "can't retrieve file dataspace from ID"); + } + + /* when we setup mpi_bufs[] below, all addresses are offsets from + * mpi_bufs_base. + * + * Since these offsets must all be positive, we must scan through + * s_bufs[] to find the smallest value, and choose that for + * mpi_bufs_base. + */ + j = 0; /* guess at the index of the smallest value of s_bufs[] */ + + if (s_bufs[j + 1].vp != NULL) { + for (i = 1; i < count; i++) + if (s_bufs[i].vp < s_bufs[j].vp) + j = i; + } + + mpi_bufs_base = s_bufs[j].vp; + mbb.vp = mpi_bufs_base; + + if (H5FD__selection_build_types(FALSE, count, mbb, s_file_spaces, s_mem_spaces, s_offsets, s_bufs, + s_element_sizes, s_element_sizes, &final_ftype, + &final_ftype_is_derived, &final_mtype, + &final_mtype_is_derived) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "couldn't build type for MPI-IO"); + + /* We have a single, complicated MPI datatype for both memory & file */ + size_i = 1; + } + else { + + /* No chunks selected for this process */ + size_i = 0; + + mpi_bufs_base = &unused; + + /* Set the MPI datatype */ + final_ftype = MPI_BYTE; + final_mtype = MPI_BYTE; + } + + /* some numeric conversions */ + if (H5FD_mpi_haddr_to_MPIOff(tmp_offset, &mpi_off /*out*/) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off"); + + /* + * Set the file view when we are using MPI derived types + */ + if (MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, final_ftype, + H5FD_mpi_native_g, file->info))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code); + + /* When using types, use the address as the displacement for + * MPI_File_set_view and reset the address for the read to zero + */ + /* Reset mpi_off to 0 since the view now starts at the data offset */ + if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0"); + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + fprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank); +#endif + /* Get the collective_opt property to check whether the application wants to do IO individually. */ + if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property"); + + if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + fprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank); +#endif + /* Check whether we should read from rank 0 and broadcast to other ranks */ + if (H5CX_get_mpio_rank0_bcast()) { +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + fprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", __func__, file->mpi_rank); +#endif + /* Indicate path we've taken */ + rank0_bcast = TRUE; + + /* Read on rank 0 Bcast to other ranks */ + if (file->mpi_rank == 0) { + /* If MPI_File_read_at fails, push an error, but continue + * to participate in following MPI_Bcast */ + if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, mpi_bufs_base, size_i, + final_mtype, &mpi_stat))) + HMPI_DONE_ERROR(FAIL, "MPI_File_read_at failed", mpi_code); + } + + if (MPI_SUCCESS != (mpi_code = MPI_Bcast(mpi_bufs_base, size_i, final_mtype, 0, file->comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code); + } /* end if */ + else + /* Perform collective read operation */ + if (MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, mpi_bufs_base, size_i, + final_mtype, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code); + } /* end if */ + else { +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + fprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); +#endif + + /* Perform independent read operation */ + if (MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, mpi_bufs_base, size_i, + final_mtype, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code); + } /* end else */ + + /* + * Reset the file view when we used MPI derived types + */ + if (MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, + H5FD_mpi_native_g, file->info))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code); + + /* Only retrieve bytes read if this rank _actually_ participated in I/O */ + if (!rank0_bcast || (rank0_bcast && file->mpi_rank == 0)) { + /* How many bytes were actually read? */ +#if H5_CHECK_MPI_VERSION(3, 0) + if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, final_mtype, &bytes_read))) { +#else + if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read))) { +#endif + if (rank0_bcast && file->mpi_rank == 0) { + /* If MPI_Get_elements(_x) fails for a rank 0 bcast strategy, + * push an error, but continue to participate in the following + * MPI_Bcast. + */ + bytes_read = -1; + HMPI_DONE_ERROR(FAIL, "MPI_Get_elements failed", mpi_code); + } + else + HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code); + } + } /* end if */ + + /* If the rank0-bcast feature was used, broadcast the # of bytes read to + * other ranks, which didn't perform any I/O. + */ + /* NOTE: This could be optimized further to be combined with the broadcast + * of the data. (QAK - 2019/1/2) + */ + if (rank0_bcast) +#if H5_CHECK_MPI_VERSION(3, 0) + if (MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_COUNT, 0, file->comm)) +#else + if (MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_INT, 0, file->comm)) +#endif + HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", 0); + + /* Get the type's size */ +#if H5_CHECK_MPI_VERSION(3, 0) + if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(final_mtype, &type_size))) +#else + if (MPI_SUCCESS != (mpi_code = MPI_Type_size(final_mtype, &type_size))) +#endif + HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code); + + /* Compute the actual number of bytes requested */ + io_size = type_size * size_i; + + /* Check for read failure */ + if (bytes_read < 0 || bytes_read > io_size) + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed"); + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + fprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld type = %s\n", __func__, + file->mpi_rank, (long)mpi_off, (long long)bytes_read, H5FD__mem_t_to_str(type)); +#endif + + /* + * This gives us zeroes beyond end of physical MPI file. + */ + if ((n = (io_size - bytes_read)) > 0) + memset((char *)bufs[0] + bytes_read, 0, (size_t)n); + + } /* end if */ + else { +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + fprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); +#endif + if (_file->base_addr > 0) { + /* Undo base address addition in internal routines before passing down to the mpio driver */ + for (i = 0; i < count; i++) { + assert(offsets[i] >= _file->base_addr); + offsets[i] -= _file->base_addr; + } + } + + if (H5FD_read_from_selection(_file, type, (uint32_t)count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "read vector from selection failed"); + } + +done: + /* Free the MPI buf and file types, if they were derived */ + if (final_mtype_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&final_mtype))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code); + if (final_ftype_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&final_ftype))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code); + + /* Cleanup dataspace arrays */ + if (s_mem_spaces) + s_mem_spaces = H5MM_xfree(s_mem_spaces); + if (s_file_spaces) + s_file_spaces = H5MM_xfree(s_file_spaces); + + if (!selection_was_sorted) { + free(s_mem_space_ids); + s_mem_space_ids = NULL; + free(s_file_space_ids); + s_file_space_ids = NULL; + free(s_offsets); + s_offsets = NULL; + free(s_element_sizes); + s_element_sizes = NULL; + free(s_bufs); + s_bufs = NULL; + } + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_t_flag) + fprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); +#endif + + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD__mpio_read_selection() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__mpio_write_selection + * + * Purpose: The behaviour of this function dependes on the value of + * the transfer mode obtained from the context. + * + * If the transfer mode is H5FD_MPIO_COLLECTIVE: + * --sort the selections + * --set mpi_bufs_base + * --build the MPI derived types + * --perform MPI_File_set_view() + * --perform MPI_File_write_at_all() or MPI_File_write_at() + * depending on whether this is a H5FD_MPIO_COLLECTIVE_IO + * --calculate and set the file's eof for the bytes written + * + * If this is not H5FD_MPIO_COLLECTIVE: + * --undo possible base address addition in internal routines + * --call H5FD_write_vector_from_selection() to perform vector + * or scalar writes for the selections + * + * Return: Success: SUCCEED. + * Failure: FAIL. + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__mpio_write_selection(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, size_t count, + hid_t mem_space_ids[], hid_t file_space_ids[], haddr_t offsets[], + size_t element_sizes[], const void *bufs[]) +{ + H5FD_mpio_t *file = (H5FD_mpio_t *)_file; + MPI_Offset mpi_off; + MPI_Offset save_mpi_off; /* Use at the end of the routine for setting local_eof */ + MPI_Status mpi_stat; /* Status from I/O operation */ + + int size_i; + H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */ + H5FD_mpio_collective_opt_t coll_opt_mode; + + MPI_Datatype final_mtype; /* Final memory MPI datatype for all pieces with selection */ + hbool_t final_mtype_is_derived = FALSE; + + MPI_Datatype final_ftype; /* Final file MPI datatype for all pieces with selection */ + hbool_t final_ftype_is_derived = FALSE; + + hid_t *s_mem_space_ids = NULL; + hid_t *s_file_space_ids = NULL; + haddr_t *s_offsets = NULL; + size_t *s_element_sizes = NULL; + H5_flexible_const_ptr_t *s_bufs = NULL; + hbool_t selection_was_sorted = TRUE; + const void *mpi_bufs_base = NULL; + + uint32_t i, j; + H5S_t **s_mem_spaces = NULL; + H5S_t **s_file_spaces = NULL; + haddr_t tmp_offset = 0; + char unused = 0; /* Unused, except for non-NULL pointer value */ + H5_flexible_const_ptr_t mbb; + +#if H5_CHECK_MPI_VERSION(3, 0) + MPI_Count bytes_written; + MPI_Count type_size; /* MPI datatype used for I/O's size */ + MPI_Count io_size; /* Actual number of bytes requested */ +#else + int bytes_written; + int type_size; /* MPI datatype used for I/O's size */ + int io_size; /* Actual number of bytes requested */ +#endif + +#ifdef H5FDmpio_DEBUG + hbool_t H5FD_mpio_debug_t_flag = (H5FD_mpio_debug_flags_s[(int)'t'] && H5FD_MPIO_TRACE_THIS_RANK(file)); + hbool_t H5FD_mpio_debug_w_flag = (H5FD_mpio_debug_flags_s[(int)'w'] && H5FD_MPIO_TRACE_THIS_RANK(file)); +#endif + int mpi_code; /* MPI return code */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_t_flag) + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); +#endif + + /* Sanity checks */ + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); + assert((count == 0) || (mem_space_ids)); + assert((count == 0) || (file_space_ids)); + assert((count == 0) || (offsets)); + assert((count == 0) || (element_sizes)); + assert((count == 0) || (bufs)); + + /* Verify that the first elements of the element_sizes and bufs arrays are + * valid. */ + assert((count == 0) || (element_sizes[0] != 0)); + assert((count == 0) || (bufs[0] != NULL)); + + /* Verify that no data is written when between MPI_Barrier()s during file flush */ + assert(!H5CX_get_mpi_file_flushing()); + + /* Portably initialize MPI status variable */ + memset(&mpi_stat, 0, sizeof(MPI_Status)); + + /* Get the transfer mode from the API context */ + if (H5CX_get_io_xfer_mode(&xfer_mode) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode"); + + if (xfer_mode == H5FD_MPIO_COLLECTIVE) { + + if (count) { + if (H5FD_sort_selection_io_req(&selection_was_sorted, count, mem_space_ids, file_space_ids, + offsets, element_sizes, (H5_flexible_const_ptr_t *)bufs, + &s_mem_space_ids, &s_file_space_ids, &s_offsets, &s_element_sizes, + &s_bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't sort selection I/O request"); + + tmp_offset = s_offsets[0]; + + if (NULL == (s_file_spaces = H5MM_malloc(count * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for file space list"); + if (NULL == (s_mem_spaces = H5MM_malloc(count * sizeof(H5S_t *)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "memory allocation failed for memory space list"); + + for (i = 0; i < count; i++) { + if (NULL == + (s_file_spaces[i] = (H5S_t *)H5I_object_verify(s_file_space_ids[i], H5I_DATASPACE))) + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, + "can't retrieve file dataspace from ID"); + if (NULL == (s_mem_spaces[i] = (H5S_t *)H5I_object_verify(s_mem_space_ids[i], H5I_DATASPACE))) + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, H5I_INVALID_HID, + "can't retrieve memory dataspace from ID"); + } + + /* when we setup mpi_bufs[] below, all addresses are offsets from + * mpi_bufs_base. + * + * Since these offsets must all be positive, we must scan through + * s_bufs[] to find the smallest value, and choose that for + * mpi_bufs_base. + */ + j = 0; /* guess at the index of the smallest value of s_bufs[] */ + + if (s_bufs[j + 1].cvp != NULL) { + for (i = 1; i < count; i++) + if (s_bufs[i].cvp < s_bufs[j].cvp) + j = i; + } + + mpi_bufs_base = s_bufs[j].cvp; + mbb.cvp = mpi_bufs_base; + + if (H5FD__selection_build_types(TRUE, count, mbb, s_file_spaces, s_mem_spaces, s_offsets, s_bufs, + s_element_sizes, s_element_sizes, &final_ftype, + &final_ftype_is_derived, &final_mtype, + &final_mtype_is_derived) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "couldn't build type for MPI-IO"); + + /* We have a single, complicated MPI datatype for both memory & file */ + size_i = 1; + } + else { + + /* No chunks selected for this process */ + size_i = 0; + + mpi_bufs_base = &unused; + + /* Set the MPI datatype */ + final_ftype = MPI_BYTE; + final_mtype = MPI_BYTE; + } + + /* some numeric conversions */ + if (H5FD_mpi_haddr_to_MPIOff(tmp_offset, &mpi_off /*out*/) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off"); + + /* To be used at the end of the routine for setting local_eof */ + save_mpi_off = mpi_off; + + /* + * Set the file view when we are using MPI derived types + */ + if (MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, final_ftype, + H5FD_mpi_native_g, file->info))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code); + + /* Reset mpi_off to 0 since the view now starts at the data offset */ + if (H5FD_mpi_haddr_to_MPIOff((haddr_t)0, &mpi_off) < 0) + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't set MPI off to 0"); + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_w_flag) + fprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank); +#endif + + /* Get the collective_opt property to check whether the application wants to do IO individually. */ + if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI-I/O collective_op property"); + + if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_w_flag) + fprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank); +#endif + + /* Perform collective write operation */ + if (MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(file->f, mpi_off, mpi_bufs_base, size_i, + final_mtype, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code); + + /* Do MPI_File_sync when needed by underlying ROMIO driver */ + if (file->mpi_file_sync_required) { + if (MPI_SUCCESS != (mpi_code = MPI_File_sync(file->f))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_sync failed", mpi_code); + } + } + else { + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_w_flag) + fprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); +#endif + /* Perform independent write operation */ + if (MPI_SUCCESS != (mpi_code = MPI_File_write_at(file->f, mpi_off, mpi_bufs_base, size_i, + final_mtype, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at failed", mpi_code); + } /* end else */ + + /* Reset the file view when we used MPI derived types */ + if (MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, + H5FD_mpi_native_g, file->info))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code); + + /* How many bytes were actually written */ +#if H5_CHECK_MPI_VERSION(3, 0) + if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, final_mtype, &bytes_written))) +#else + if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_written))) +#endif + HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code); + + /* Get the type's size */ +#if H5_CHECK_MPI_VERSION(3, 0) + if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(final_mtype, &type_size))) +#else + if (MPI_SUCCESS != (mpi_code = MPI_Type_size(final_mtype, &type_size))) +#endif + HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code); + + /* Compute the actual number of bytes requested */ + io_size = type_size * size_i; + + /* Check for write failure */ + if (bytes_written != io_size || bytes_written < 0) + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed"); + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_w_flag) + fprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld type = %s\n", __func__, + file->mpi_rank, (long)mpi_off, (long long)bytes_written, H5FD__mem_t_to_str(type)); +#endif + + /* Each process will keep track of its perceived EOF value locally, and + * ultimately we will reduce this value to the maximum amongst all + * processes, but until then keep the actual eof at HADDR_UNDEF just in + * case something bad happens before that point. (rather have a value + * we know is wrong sitting around rather than one that could only + * potentially be wrong.) */ + file->eof = HADDR_UNDEF; + + if (bytes_written && (((haddr_t)bytes_written + (haddr_t)save_mpi_off) > file->local_eof)) + file->local_eof = (haddr_t)save_mpi_off + (haddr_t)bytes_written; + } + else { /* Not H5FD_MPIO_COLLECTIVE */ + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_w_flag) + fprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); +#endif + if (_file->base_addr > 0) { + /* Undo base address addition in internal routines before passing down to the mpio driver */ + for (i = 0; i < count; i++) { + assert(offsets[i] >= _file->base_addr); + offsets[i] -= _file->base_addr; + } + } + + if (H5FD_write_from_selection(_file, type, (uint32_t)count, mem_space_ids, file_space_ids, offsets, + element_sizes, bufs) < 0) + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "write vector from selection failed"); + } + +done: + /* Free the MPI buf and file types, if they were derived */ + if (final_mtype_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&final_mtype))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code); + if (final_ftype_is_derived && MPI_SUCCESS != (mpi_code = MPI_Type_free(&final_ftype))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code); + + /* Cleanup dataspace arrays */ + if (s_mem_spaces) + s_mem_spaces = H5MM_xfree(s_mem_spaces); + if (s_file_spaces) + s_file_spaces = H5MM_xfree(s_file_spaces); + + if (!selection_was_sorted) { + free(s_mem_space_ids); + s_mem_space_ids = NULL; + free(s_file_space_ids); + s_file_space_ids = NULL; + free(s_offsets); + s_offsets = NULL; + free(s_element_sizes); + s_element_sizes = NULL; + free(s_bufs); + s_bufs = NULL; + } + +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_t_flag) + fprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", __func__, file->mpi_rank, ret_value); +#endif + + FUNC_LEAVE_NOAPI(ret_value) + +} /* end H5FD__mpio_write_selection() */ + /*------------------------------------------------------------------------- * Function: H5FD__mpio_flush * @@ -2796,9 +3659,6 @@ H5FD__mpio_write_vector(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, uint32_t co * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * January 30, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -2815,12 +3675,12 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); /* Only sync the file if we are not going to immediately close it */ if (!closing) @@ -2830,7 +3690,7 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -2854,9 +3714,6 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * January 31, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -2872,14 +3729,14 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); - if (!H5F_addr_eq(file->eoa, file->last_eoa)) { + if (!H5_addr_eq(file->eoa, file->last_eoa)) { int mpi_code; /* mpi return code */ MPI_Offset size; MPI_Offset needed_eof; @@ -2915,7 +3772,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR HMPI_GOTO_ERROR(FAIL, "MPI_File_get_size failed", mpi_code) if (H5FD_mpi_haddr_to_MPIOff(file->eoa, &needed_eof) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "cannot convert from haddr_t to MPI_Offset"); /* EOA != EOF. Set EOF to EOA */ if (size != needed_eof) { @@ -2943,7 +3800,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); + fprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -2970,11 +3827,11 @@ H5FD__mpio_delete(const char *filename, hid_t fapl_id) FUNC_ENTER_PACKAGE - HDassert(filename); + assert(filename); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - HDassert(H5FD_MPIO == H5P_peek_driver(plist)); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + assert(H5FD_MPIO == H5P_peek_driver(plist)); if (H5FD_mpi_self_initialized) { comm = MPI_COMM_WORLD; @@ -2982,9 +3839,9 @@ H5FD__mpio_delete(const char *filename, hid_t fapl_id) else { /* Get the MPI communicator and info from the fapl */ if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI info object") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI info object"); if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator"); } /* Get the MPI rank of this process */ @@ -3011,9 +3868,9 @@ H5FD__mpio_delete(const char *filename, hid_t fapl_id) done: /* Free duplicated MPI Communicator and Info objects */ if (H5_mpi_comm_free(&comm) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free MPI communicator") + HDONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free MPI communicator"); if (H5_mpi_info_free(&info) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free MPI info object") + HDONE_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free MPI info object"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__mpio_delete() */ @@ -3044,8 +3901,6 @@ H5FD__mpio_delete(const char *filename, hid_t fapl_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: JRM -- 8/3/21 - * *------------------------------------------------------------------------- */ static herr_t @@ -3058,39 +3913,39 @@ H5FD__mpio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_AT FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file); - HDassert(H5FD_MPIO == file->pub.driver_id); + assert(file); + assert(H5FD_MPIO == file->pub.driver_id); switch (op_code) { case H5FD_CTL_GET_MPI_COMMUNICATOR_OPCODE: - HDassert(output); - HDassert(*output); + assert(output); + assert(*output); **((MPI_Comm **)output) = file->comm; break; case H5FD_CTL_GET_MPI_RANK_OPCODE: - HDassert(output); - HDassert(*output); + assert(output); + assert(*output); **((int **)output) = file->mpi_rank; break; case H5FD_CTL_GET_MPI_SIZE_OPCODE: - HDassert(output); - HDassert(*output); + assert(output); + assert(*output); **((int **)output) = file->mpi_size; break; case H5FD_CTL_GET_MPI_FILE_SYNC_OPCODE: - HDassert(output); - HDassert(*output); + assert(output); + assert(*output); **((hbool_t **)output) = file->mpi_file_sync_required; break; default: /* unknown op code */ if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) { - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown"); } break; } diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDmulti.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDmulti.c index 7849060f84..9f8a77c940 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDmulti.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDmulti.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Monday, November 10, 1997 - * * Purpose: Implements a file driver which dispatches I/O requests to * other file drivers depending on the purpose of the address * region being accessed. For instance, all meta-data could be @@ -232,9 +228,6 @@ static const H5FD_class_t H5FD_multi_g = { * Return: Success: The driver ID for the multi driver * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ hid_t @@ -256,9 +249,6 @@ H5FD_multi_init(void) * * Returns: Non-negative on success or negative on failure * - * Programmer: Quincey Koziol - * Friday, Jan 30, 2004 - * *--------------------------------------------------------------------------- */ static herr_t @@ -281,9 +271,6 @@ H5FD_multi_term(void) * * Failure: -1 * - * Programmer: Robb Matzke - * Wednesday, August 11, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -376,9 +363,6 @@ H5Pset_fapl_split(hid_t fapl, const char *meta_ext, hid_t meta_plist_id, const c * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -413,9 +397,6 @@ H5Pset_fapl_multi(hid_t fapl_id, const H5FD_mem_t *memb_map, const hid_t *memb_f * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -440,7 +421,7 @@ H5Pget_fapl_multi(hid_t fapl_id, H5FD_mem_t *memb_map /*out*/, hid_t *memb_fapl { fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); } - H5E_END_TRY; + H5E_END_TRY if (!fa || (H5P_FILE_ACCESS_DEFAULT == fapl_id)) { if (H5FD_multi_populate_config(NULL, NULL, NULL, NULL, TRUE, &default_fa) < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTSET, "can't setup default driver configuration", @@ -510,7 +491,7 @@ H5FD_split_populate_config(const char *meta_ext, hid_t meta_plist_id, const char _memb_name[mt] = NULL; _memb_addr[mt] = HADDR_UNDEF; } - END_MEMBERS; + END_MEMBERS /* The file access properties */ _memb_fapl[H5FD_MEM_SUPER] = meta_plist_id; @@ -574,7 +555,7 @@ H5FD_split_populate_config(const char *meta_ext, hid_t meta_plist_id, const char if (!_memb_name[mmt] || !_memb_name[mmt][0]) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "file resource type not set", -1); } - END_MEMBERS; + END_MEMBERS /* * Initialize driver specific information. No need to copy it into the FA @@ -596,7 +577,7 @@ H5FD_split_populate_config(const char *meta_ext, hid_t meta_plist_id, const char "can't set sec2 driver on member FAPL", -1); } } - END_MEMBERS; + END_MEMBERS return ret_value; } @@ -709,9 +690,6 @@ H5FD_multi_populate_config(const H5FD_mem_t *memb_map, const hid_t *memb_fapl, c * * Failure: never fails * - * Programmer: Robb Matzke - * Monday, August 16, 1999 - * *------------------------------------------------------------------------- */ static hsize_t @@ -728,7 +706,7 @@ H5FD_multi_sb_size(H5FD_t *_file) UNIQUE_MEMBERS (file->fa.memb_map, mt) { nseen++; } - END_MEMBERS; + END_MEMBERS /* Addresses and EOA markers */ nbytes += nseen * 2 * 8; @@ -738,7 +716,7 @@ H5FD_multi_sb_size(H5FD_t *_file) size_t n = strlen(file->fa.memb_name[mt]) + 1; nbytes += (n + 7) & ~((size_t)0x0007); } - END_MEMBERS; + END_MEMBERS return nbytes; } @@ -761,9 +739,6 @@ H5FD_multi_sb_size(H5FD_t *_file) * * Failure: -1 * - * Programmer: Robb Matzke - * Monday, August 16, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -809,7 +784,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out p += sizeof(haddr_t); nseen++; } - END_MEMBERS; + END_MEMBERS if (H5Tconvert(H5T_NATIVE_HADDR, H5T_STD_U64LE, nseen * 2, buf + 8, NULL, H5P_DEFAULT) < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1); @@ -822,7 +797,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out for (i = n; i % 8; i++) *p++ = '\0'; } - END_MEMBERS; + END_MEMBERS return 0; } /* end H5FD_multi_sb_encode() */ @@ -842,9 +817,6 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out * * Failure: -1 * - * Programmer: Robb Matzke - * Monday, August 16, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -876,7 +848,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) memb_eoa[mt] = HADDR_UNDEF; memb_name[mt] = NULL; } - END_MEMBERS; + END_MEMBERS /* * Read the map and count the unique members. @@ -892,7 +864,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) UNIQUE_MEMBERS (map, mt) { nseen++; } - END_MEMBERS; + END_MEMBERS buf += 8; /* Decode Address and EOA values */ @@ -907,7 +879,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) memb_addr[_unmapped] = *ap++; memb_eoa[_unmapped] = *ap++; } - END_MEMBERS; + END_MEMBERS /* Decode name templates */ UNIQUE_MEMBERS (map, mt) { @@ -915,7 +887,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) memb_name[_unmapped] = (const char *)buf; buf += (n + 7) & ~((unsigned)0x0007); } - END_MEMBERS; + END_MEMBERS /* * Use the mapping saved in the superblock in preference to the one @@ -928,14 +900,14 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) ALL_MEMBERS (mt) { file->fa.memb_map[mt] = map[mt]; } - END_MEMBERS; + END_MEMBERS /* Close files which are unused now */ memset(in_use, 0, sizeof in_use); UNIQUE_MEMBERS (map, mt) { in_use[mt] = TRUE; } - END_MEMBERS; + END_MEMBERS ALL_MEMBERS (mt) { if (!in_use[mt] && file->memb[mt]) { (void)H5FDclose(file->memb[mt]); @@ -943,7 +915,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) } file->fa.memb_map[mt] = map[mt]; } - END_MEMBERS; + END_MEMBERS } /* Commit member starting addresses and name templates */ @@ -955,7 +927,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) file->fa.memb_name[mt] = my_strdup(memb_name[mt]); } } - END_MEMBERS; + END_MEMBERS if (compute_next(file) < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", -1); @@ -973,7 +945,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) */ file->memb_eoa[mt] = memb_eoa[mt]; } - END_MEMBERS; + END_MEMBERS return 0; } /* end H5FD_multi_sb_decode() */ @@ -990,9 +962,6 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) * * Failure: NULL * - * Programmer: Robb Matzke - * Friday, August 13, 1999 - * *------------------------------------------------------------------------- */ static void * @@ -1015,9 +984,6 @@ H5FD_multi_fapl_get(H5FD_t *_file) * * Failure: NULL * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static void * @@ -1050,7 +1016,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) } } } - END_MEMBERS; + END_MEMBERS if (nerrors) { ALL_MEMBERS (mt) { @@ -1059,7 +1025,7 @@ H5FD_multi_fapl_copy(const void *_old_fa) if (new_fa->memb_name[mt]) free(new_fa->memb_name[mt]); } - END_MEMBERS; + END_MEMBERS free(new_fa); H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "can't release object on error", NULL); } @@ -1075,9 +1041,6 @@ H5FD_multi_fapl_copy(const void *_old_fa) * * Failure: -1 * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1096,7 +1059,7 @@ H5FD_multi_fapl_free(void *_fa) if (fa->memb_name[mt]) free(fa->memb_name[mt]); } - END_MEMBERS; + END_MEMBERS free(fa); return 0; @@ -1113,9 +1076,6 @@ H5FD_multi_fapl_free(void *_fa) * * Failure: NULL * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -1148,18 +1108,18 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr { fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); } - H5E_END_TRY; + H5E_END_TRY if (!fa || (H5P_FILE_ACCESS_DEFAULT == fapl_id) || (H5FD_MULTI != H5Pget_driver(fapl_id))) { char *env = getenv(HDF5_DRIVER); close_fapl = fapl_id = H5Pcreate(H5P_FILE_ACCESS); if (env && !strcmp(env, "split")) { if (H5Pset_fapl_split(fapl_id, NULL, H5P_DEFAULT, NULL, H5P_DEFAULT) < 0) - H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error) + H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error); } else { if (H5Pset_fapl_multi(fapl_id, NULL, NULL, NULL, NULL, TRUE) < 0) - H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error) + H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTSET, "can't set property value", error); } fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); @@ -1176,17 +1136,17 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr else file->fa.memb_name[mt] = NULL; } - END_MEMBERS; + END_MEMBERS file->fa.relax = fa->relax; file->flags = flags; file->name = my_strdup(name); if (close_fapl >= 0) if (H5Pclose(close_fapl) < 0) - H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", error) + H5Epush_goto(func, H5E_ERR_CLS, H5E_FILE, H5E_CANTCLOSEOBJ, "can't close property list", error); - /* Compute derived properties and open member files */ - if (compute_next(file) < 0) H5Epush_goto(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, - "compute_next() failed", error); + /* Compute derived properties and open member files */ + if (compute_next(file) < 0) + H5Epush_goto(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "compute_next() failed", error); if (open_members(file) < 0) H5Epush_goto(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "open_members() failed", error); @@ -1209,7 +1169,7 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); } - END_MEMBERS; + END_MEMBERS if (file->name) free(file->name); free(file); @@ -1228,9 +1188,6 @@ H5FD_multi_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr * possible. The only subsequent operation * permitted on the file is a close operation. * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1254,7 +1211,7 @@ H5FD_multi_close(H5FD_t *_file) } } } - END_MEMBERS; + END_MEMBERS if (nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error closing member files", -1); @@ -1265,7 +1222,7 @@ H5FD_multi_close(H5FD_t *_file) if (file->fa.memb_name[mt]) free(file->fa.memb_name[mt]); } - END_MEMBERS; + END_MEMBERS free(file->name); free(file); @@ -1285,9 +1242,6 @@ H5FD_multi_close(H5FD_t *_file) * * Failure: never fails (arguments were checked by th caller). * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static int @@ -1312,7 +1266,7 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) cmp = 1; } } - END_MEMBERS; + END_MEMBERS assert(cmp || out_mt < H5FD_MEM_NTYPES); if (out_mt >= H5FD_MEM_NTYPES) return cmp; @@ -1330,9 +1284,6 @@ H5FD_multi_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, September 26, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -1361,9 +1312,6 @@ H5FD_multi_query(const H5FD_t *_f, unsigned long *flags /* out */) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, October 9, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1388,9 +1336,6 @@ H5FD_multi_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) * * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1419,7 +1364,7 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) { memb_eoa = H5FDget_eoa(file->memb[mt], mt); } - H5E_END_TRY; + H5E_END_TRY if (HADDR_UNDEF == memb_eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", @@ -1442,7 +1387,7 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) if (memb_eoa > eoa) eoa = memb_eoa; } - END_MEMBERS; + END_MEMBERS } else { H5FD_mem_t mmt = file->fa.memb_map[type]; @@ -1455,7 +1400,7 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) { eoa = H5FDget_eoa(file->memb[mmt], mmt); } - H5E_END_TRY; + H5E_END_TRY if (HADDR_UNDEF == eoa) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eoa", @@ -1491,9 +1436,6 @@ H5FD_multi_get_eoa(const H5FD_t *_file, H5FD_mem_t type) * * Failure: -1 * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1536,7 +1478,7 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) { status = H5FDset_eoa(file->memb[mmt], mmt, (eoa - file->fa.memb_addr[mmt])); } - H5E_END_TRY; + H5E_END_TRY if (status < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "member H5FDset_eoa failed", -1); @@ -1555,9 +1497,6 @@ H5FD_multi_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t eoa) * * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1580,7 +1519,7 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) { tmp_eof = H5FDget_eof(file->memb[mt], type); } - H5E_END_TRY; + H5E_END_TRY if (HADDR_UNDEF == tmp_eof) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", @@ -1602,7 +1541,7 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) if (tmp_eof > eof) eof = tmp_eof; } - END_MEMBERS; + END_MEMBERS } else { H5FD_mem_t mmt = file->fa.memb_map[type]; @@ -1616,7 +1555,7 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) { eof = H5FDget_eof(file->memb[mmt], mmt); } - H5E_END_TRY; + H5E_END_TRY if (HADDR_UNDEF == eof) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "member file has unknown eof", @@ -1646,9 +1585,6 @@ H5FD_multi_get_eof(const H5FD_t *_file, H5FD_mem_t type) * * Returns: Non-negative if succeed or negative if fails. * - * Programmer: Raymond Lu - * Sept. 16, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -1680,9 +1616,6 @@ H5FD_multi_get_handle(H5FD_t *_file, hid_t fapl, void **file_handle) * * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Thursday, August 12, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1703,7 +1636,7 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) if (file->memb[mt]) file->memb[mt]->paged_aggr = file->pub.paged_aggr; } - END_MEMBERS; + END_MEMBERS } if (HADDR_UNDEF == (addr = H5FDalloc(file->memb[mmt], mmt, dxpl_id, size))) @@ -1736,9 +1669,6 @@ H5FD_multi_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size) * * Failure: -1 * - * Programmer: Robb Matzke - * Thursday, August 12, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1771,9 +1701,6 @@ H5FD_multi_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsi * * Failure: -1, contents of buffer BUF are undefined. * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1817,9 +1744,6 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, siz * * Failure: -1 * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1861,9 +1785,6 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si * * Failure: -1, as many files flushed as possible. * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -1917,7 +1838,7 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) if (H5FDflush(file->memb[mt], dxpl_id, closing) < 0) nerrors++; } - H5E_END_TRY; + H5E_END_TRY } } if (nerrors) @@ -1934,9 +1855,6 @@ H5FD_multi_flush(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) * Return: Success: 0 * Failure: -1, as many files truncated as possible. * - * Programmer: Quincey Koziol - * Thursday, January 31, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1958,7 +1876,7 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) if (H5FDtruncate(file->memb[mt], dxpl_id, closing) < 0) nerrors++; } - H5E_END_TRY; + H5E_END_TRY } } if (nerrors) @@ -1978,8 +1896,6 @@ H5FD_multi_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) * Return: Success: 0 * Failure: -1 * - * Programmer: Vailin Choi; March 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -2004,10 +1920,10 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw) break; } /* end if */ } - H5E_END_TRY; + H5E_END_TRY } /* end if */ } - END_MEMBERS; + END_MEMBERS /* Try to unlock the member files that are locked before error is encountered */ if (nerrors) { @@ -2019,7 +1935,7 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw) if (H5FDunlock(file->memb[k]) < 0) nerrors++; } - H5E_END_TRY; + H5E_END_TRY } /* end for */ } /* end if */ @@ -2039,8 +1955,6 @@ H5FD_multi_lock(H5FD_t *_file, hbool_t rw) * Return: Success: 0 * Failure: -1 * - * Programmer: Vailin Choi; March 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -2058,7 +1972,7 @@ H5FD_multi_unlock(H5FD_t *_file) if (H5FDunlock(file->memb[mt]) < 0) nerrors++; } - END_MEMBERS; + END_MEMBERS if (nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_CANTUNLOCKFILE, "error unlocking member files", -1); @@ -2076,9 +1990,6 @@ H5FD_multi_unlock(H5FD_t *_file) * * Failure: -1 * - * Programmer: Robb Matzke - * Monday, August 23, 1999 - * *------------------------------------------------------------------------- */ static int @@ -2090,7 +2001,7 @@ compute_next(H5FD_multi_t *file) ALL_MEMBERS (mt) { file->memb_next[mt] = HADDR_UNDEF; } - END_MEMBERS; + END_MEMBERS UNIQUE_MEMBERS (file->fa.memb_map, mt1) { UNIQUE_MEMBERS2(file->fa.memb_map, mt2) @@ -2100,12 +2011,12 @@ compute_next(H5FD_multi_t *file) file->memb_next[mt1] = file->fa.memb_addr[mt2]; } } - END_MEMBERS; + END_MEMBERS if (HADDR_UNDEF == file->memb_next[mt1]) { file->memb_next[mt1] = HADDR_MAX; /*last member*/ } } - END_MEMBERS; + END_MEMBERS return 0; } @@ -2119,9 +2030,6 @@ compute_next(H5FD_multi_t *file) * * Failure: -1 * - * Programmer: Robb Matzke - * Monday, August 23, 1999 - * *------------------------------------------------------------------------- */ /* Disable warning for "format not a string literal" here @@ -2156,13 +2064,13 @@ open_members(H5FD_multi_t *file) { file->memb[mt] = H5FDopen(tmp, file->flags, file->fa.memb_fapl[mt], HADDR_UNDEF); } - H5E_END_TRY; + H5E_END_TRY if (!file->memb[mt]) { if (!file->fa.relax || (file->flags & H5F_ACC_RDWR)) nerrors++; } } - END_MEMBERS; + END_MEMBERS if (nerrors) H5Epush_ret(func, H5E_ERR_CLS, H5E_INTERNAL, H5E_BADVALUE, "error opening member files", -1); @@ -2199,7 +2107,7 @@ H5FD_multi_delete(const char *filename, hid_t fapl_id) { fa = (const H5FD_multi_fapl_t *)H5Pget_driver_info(fapl_id); } - H5E_END_TRY; + H5E_END_TRY if (!fa) { char *env = getenv(HDF5_DRIVER); @@ -2229,7 +2137,7 @@ H5FD_multi_delete(const char *filename, hid_t fapl_id) if (H5FDdelete(full_filename, fa->memb_fapl[mt]) < 0) H5Epush_ret(func, H5E_ERR_CLS, H5E_VFL, H5E_BADVALUE, "error deleting member files", -1); } - END_MEMBERS; + END_MEMBERS return 0; } /* end H5FD_multi_delete() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion.c index 7c76eedaa4..dcec22197b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion.c @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -259,7 +259,7 @@ H5FD__onion_term(void) /* Reset VFL ID */ H5FD_ONION_g = 0; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__onion_term() */ @@ -284,18 +284,18 @@ H5Pget_fapl_onion(hid_t fapl_id, H5FD_onion_fapl_info_t *fa_out) H5TRACE2("e", "i*!", fapl_id, fa_out); if (NULL == fa_out) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL info-out pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL info-out pointer"); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid FAPL ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid FAPL ID"); if (H5FD_ONION != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Incorrect VFL driver") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Incorrect VFL driver"); if (NULL == (info_ptr = (const H5FD_onion_fapl_info_t *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad VFL driver info") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad VFL driver info"); - HDmemcpy(fa_out, info_ptr, sizeof(H5FD_onion_fapl_info_t)); + memcpy(fa_out, info_ptr, sizeof(H5FD_onion_fapl_info_t)); done: FUNC_LEAVE_API(ret_value) @@ -377,8 +377,8 @@ H5FD__onion_sb_size(H5FD_t *_file) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(file); - HDassert(file->original_file); + assert(file); + assert(file->original_file); if (file->original_file) ret_value = H5FD_sb_size(file->original_file); @@ -403,11 +403,11 @@ H5FD__onion_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*ou FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(file); - HDassert(file->original_file); + assert(file); + assert(file->original_file); if (file->original_file && H5FD_sb_encode(file->original_file, name, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTENCODE, FAIL, "unable to encode the superblock in R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTENCODE, FAIL, "unable to encode the superblock in R/W file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -430,11 +430,11 @@ H5FD__onion_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(file); - HDassert(file->original_file); + assert(file); + assert(file->original_file); if (H5FD_sb_load(file->original_file, name, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode the superblock in R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode the superblock in R/W file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -470,20 +470,20 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file) if ((TRUE == file->is_open_rw) && (H5FD__onion_merge_revision_index_into_archival_index( file->rev_index, &file->curr_rev_record.archival_index) < 0)) - HGOTO_ERROR(H5E_VFL, H5E_INTERNAL, FAIL, "unable to update index to write") + HGOTO_ERROR(H5E_VFL, H5E_INTERNAL, FAIL, "unable to update index to write"); if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_REVISION_RECORD + (size_t)rec->comment_size + (H5FD_ONION_ENCODED_SIZE_INDEX_ENTRY * rec->archival_index.n_entries)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for encoded revision record") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer for encoded revision record"); if (0 == (size = H5FD__onion_revision_record_encode(rec, buf, &checksum))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding revision record") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding revision record"); phys_addr = file->onion_eof; if (H5FD_set_eoa(file->onion_file, H5FD_MEM_DRAW, phys_addr + size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't modify EOA for new revision record") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't modify EOA for new revision record"); if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, phys_addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write new revision record") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write new revision record"); file->onion_eof = phys_addr + size; if (TRUE == file->align_history_on_pages) @@ -494,10 +494,10 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file) if (history->n_revisions == 0) { unsigned char *ptr = buf; /* re-use buffer space to compute checksum */ - HDassert(history->record_locs == NULL); + assert(history->record_locs == NULL); history->n_revisions = 1; if (NULL == (history->record_locs = H5MM_calloc(sizeof(H5FD_onion_record_loc_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate temporary record pointer list") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate temporary record pointer list"); history->record_locs[0].phys_addr = phys_addr; history->record_locs[0].record_size = size; @@ -510,11 +510,11 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file) else { unsigned char *ptr = buf; /* re-use buffer space to compute checksum */ - HDassert(history->record_locs != NULL); + assert(history->record_locs != NULL); if (NULL == (new_list = H5MM_calloc((history->n_revisions + 1) * sizeof(H5FD_onion_record_loc_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to resize record pointer list") - HDmemcpy(new_list, history->record_locs, sizeof(H5FD_onion_record_loc_t) * history->n_revisions); + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to resize record pointer list"); + memcpy(new_list, history->record_locs, sizeof(H5FD_onion_record_loc_t) * history->n_revisions); H5MM_xfree(history->record_locs); history->record_locs = new_list; new_list = NULL; @@ -535,7 +535,7 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file) H5MM_xfree(buf); H5MM_xfree(new_list); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_commit_new_revision_record() */ /*----------------------------------------------------------------------------- @@ -554,46 +554,44 @@ H5FD__onion_close(H5FD_t *_file) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); if (H5FD_ONION_STORE_TARGET_ONION == file->fa.store_target) { - HDassert(file->onion_file); + assert(file->onion_file); if (file->is_open_rw) { - HDassert(file->recovery_file); + assert(file->recovery_file); if (H5FD__onion_commit_new_revision_record(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write revision record to backing store") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write revision record to backing store"); if (H5FD__onion_write_final_history(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write history to backing store") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write history to backing store"); /* Unset write-lock flag and write header */ if (file->is_open_rw) file->header.flags &= (uint32_t)~H5FD_ONION_HEADER_FLAG_WRITE_LOCK; if (H5FD__onion_write_header(&(file->header), file->onion_file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write updated header to backing store") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "Can't write updated header to backing store"); } } - else if (H5FD_ONION_STORE_TARGET_H5 == file->fa.store_target) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "hdf5 store-target not supported") else - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid history target") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid history target"); done: /* Destroy things as best we can, even if there were earlier errors */ if (file->original_file) if (H5FD_close(file->original_file) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, FAIL, "can't close backing canon file") + HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, FAIL, "can't close backing canon file"); if (file->onion_file) if (H5FD_close(file->onion_file) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, FAIL, "can't close backing onion file") + HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, FAIL, "can't close backing onion file"); if (file->recovery_file) { if (H5FD_close(file->recovery_file) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, FAIL, "can't close backing recovery file") + HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, FAIL, "can't close backing recovery file"); /* TODO: Use the VFD's del callback instead of remove (this requires * storing a copy of the fapl that was used to open it) */ @@ -601,7 +599,7 @@ H5FD__onion_close(H5FD_t *_file) } if (file->rev_index) if (H5FD__onion_revision_index_destroy(file->rev_index) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, FAIL, "can't close revision index") + HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, FAIL, "can't close revision index"); H5MM_xfree(file->recovery_file_name); H5MM_xfree(file->history.record_locs); @@ -626,7 +624,7 @@ H5FD__onion_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_onion_t *file = (const H5FD_onion_t *)_file; - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR FUNC_LEAVE_NOAPI(file->logical_eoa) } /* end H5FD__onion_get_eoa() */ @@ -644,7 +642,7 @@ H5FD__onion_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) { const H5FD_onion_t *file = (const H5FD_onion_t *)_file; - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR FUNC_LEAVE_NOAPI(file->logical_eof) } /* end H5FD__onion_get_eof() */ @@ -695,17 +693,15 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons size_t size = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE - HDassert(file != NULL); + assert(file != NULL); hdr = &file->header; history = &file->history; rec = &file->curr_rev_record; hdr->flags = H5FD_ONION_HEADER_FLAG_WRITE_LOCK; - if (H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_DIVERGENT_HISTORY & file->fa.creation_flags) - hdr->flags |= H5FD_ONION_HEADER_FLAG_DIVERGENT_HISTORY; if (H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT & file->fa.creation_flags) hdr->flags |= H5FD_ONION_HEADER_FLAG_PAGE_ALIGNMENT; @@ -713,37 +709,37 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons backing_fapl_id = H5FD__onion_get_legit_fapl_id(file->fa.backing_fapl_id); if (H5I_INVALID_HID == backing_fapl_id) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid backing FAPL ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid backing FAPL ID"); /* Create backing files for onion history */ if (NULL == (file->original_file = H5FD_open(filename, flags, backing_fapl_id, maxaddr))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "cannot open the backing file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing file"); if (NULL == (file->onion_file = H5FD_open(name_onion, flags, backing_fapl_id, maxaddr))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "cannot open the backing onion file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing onion file"); if (NULL == (file->recovery_file = H5FD_open(recovery_file_nameery, flags, backing_fapl_id, maxaddr))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "cannot open the backing file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "cannot open the backing file"); /* Write "empty" .h5 file contents (signature ONIONEOF) */ if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, 8) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA"); if (H5FD_write(file->original_file, H5FD_MEM_DRAW, 0, 8, "ONIONEOF") < 0) - HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "cannot write header to the backing h5 file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write header to the backing h5 file"); /* Write nascent history (with no revisions) to "recovery" */ if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HISTORY))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer"); size = H5FD__onion_history_encode(history, buf, &history->checksum); if (H5FD_ONION_ENCODED_SIZE_HISTORY != size) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't encode history") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't encode history"); if (H5FD_set_eoa(file->recovery_file, H5FD_MEM_DRAW, size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA"); if (H5FD_write(file->recovery_file, H5FD_MEM_DRAW, 0, size, buf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "cannot write history to the backing recovery file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write history to the backing recovery file"); hdr->history_size = size; /* record for later use */ H5MM_xfree(buf); buf = NULL; @@ -753,14 +749,14 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons */ if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer"); size = H5FD__onion_header_encode(hdr, buf, &hdr->checksum); if (H5FD_ONION_ENCODED_SIZE_HEADER != size) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't encode history header") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't encode history header"); if (H5FD_set_eoa(file->onion_file, H5FD_MEM_DRAW, size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't extend EOA"); if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, size, buf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "cannot write header to the backing onion file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "cannot write header to the backing onion file"); file->onion_eof = (haddr_t)size; if (TRUE == file->align_history_on_pages) file->onion_eof = (file->onion_eof + (hdr->page_size - 1)) & (~(hdr->page_size - 1)); @@ -768,7 +764,7 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons rec->archival_index.list = NULL; if (NULL == (file->rev_index = H5FD__onion_revision_index_init(file->fa.page_size))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize revision index") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize revision index"); done: H5MM_xfree(buf); @@ -776,7 +772,7 @@ H5FD__onion_create_truncate_onion(H5FD_onion_t *file, const char *filename, cons if (FAIL == ret_value) HDremove(recovery_file_nameery); /* destroy new temp file, if 'twas created */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_create_truncate_onion() */ static herr_t @@ -784,7 +780,7 @@ H5FD__onion_remove_unused_symbols(char *s) { char *d = s; - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR do { while (*d == '{' || *d == '}' || *d == ' ') { @@ -792,7 +788,7 @@ H5FD__onion_remove_unused_symbols(char *s) } } while ((*s++ = *d++)); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } static herr_t @@ -801,10 +797,10 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa) char *config_str_copy = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE if (!HDstrcmp(config_str, "")) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty"); /* Initialize to the default values */ fa->version = H5FD_ONION_FAPL_INFO_VERSION_CURR; @@ -821,20 +817,20 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa) * e.g. {revision_num: 2; page_size: 4;} */ if (config_str[0] != '{') - fa->revision_num = (uint64_t)HDstrtoull(config_str, NULL, 10); + fa->revision_num = (uint64_t)strtoull(config_str, NULL, 10); else { char *token1 = NULL, *token2 = NULL; /* Duplicate the configure string since strtok will mess with it */ if (NULL == (config_str_copy = H5MM_strdup(config_str))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't duplicate configure string") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't duplicate configure string"); /* Remove the curly brackets and space from the configure string */ H5FD__onion_remove_unused_symbols(config_str_copy); /* The configure string can't be empty after removing the curly brackets */ if (!HDstrcmp(config_str_copy, "")) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "configure string can't be empty") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty"); token1 = HDstrtok(config_str_copy, ":"); token2 = HDstrtok(NULL, ";"); @@ -851,29 +847,29 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa) else if (!strcmp(token2, "H5I_INVALID_HID")) fa->backing_fapl_id = H5I_INVALID_HID; else - fa->backing_fapl_id = HDstrtoll(token2, NULL, 10); + fa->backing_fapl_id = strtoll(token2, NULL, 10); } else if (!HDstrcmp(token1, "page_size")) { - fa->page_size = (uint32_t)HDstrtoul(token2, NULL, 10); + fa->page_size = (uint32_t)strtoul(token2, NULL, 10); } else if (!HDstrcmp(token1, "revision_num")) { if (!HDstrcmp(token2, "H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST")) fa->revision_num = H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST; else - fa->revision_num = (uint64_t)HDstrtoull(token2, NULL, 10); + fa->revision_num = (uint64_t)strtoull(token2, NULL, 10); } else if (!HDstrcmp(token1, "force_write_open")) { - fa->force_write_open = (uint8_t)HDstrtoul(token2, NULL, 10); + fa->force_write_open = (uint8_t)strtoul(token2, NULL, 10); } else if (!HDstrcmp(token1, "creation_flags")) { - fa->creation_flags = (uint8_t)HDstrtoul(token2, NULL, 10); + fa->creation_flags = (uint8_t)strtoul(token2, NULL, 10); } else if (!HDstrcmp(token1, "comment")) { HDstrcpy(fa->comment, token2); } else - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unknown token in the configure string: %s", - token1) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unknown token in the configure string: %s", + token1); } token1 = HDstrtok(NULL, ":"); @@ -885,17 +881,17 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa) H5P_genclass_t *pclass; /* Property list class to modify */ if (NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(H5P_FILE_ACCESS, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list class"); + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, FAIL, "not a property list class"); /* Create the new property list */ if ((fa->backing_fapl_id = H5P_create_id(pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create property list"); + HGOTO_ERROR(H5E_VFL, H5E_CANTCREATE, FAIL, "unable to create property list"); } done: H5MM_free(config_str_copy); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /*----------------------------------------------------------------------------- @@ -915,6 +911,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma const H5FD_onion_fapl_info_t *fa = NULL; H5FD_onion_fapl_info_t *new_fa = NULL; const char *config_str = NULL; + double log2_page_size = 0.0; hid_t backing_fapl_id = H5I_INVALID_HID; char *name_onion = NULL; char *recovery_file_nameery = NULL; @@ -926,12 +923,12 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Check arguments */ if (!filename || !*filename) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") - HDassert(H5P_DEFAULT != fapl_id); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); + assert(H5P_DEFAULT != fapl_id); if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); /* This VFD can be invoked by either H5Pset_fapl_onion() or * H5Pset_driver_by_name(). When invoked by the former, there will be @@ -941,41 +938,39 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma if (NULL == fa) { if (NULL == (config_str = H5P_peek_driver_config_str(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "missing VFL driver configure string") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "missing VFL driver configure string"); /* Allocate a new onion fapl info struct and fill it from the * configuration string */ if (NULL == (new_fa = H5MM_calloc(sizeof(H5FD_onion_fapl_info_t)))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate memory for onion fapl info struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate memory for onion fapl info struct"); if (H5FD__onion_parse_config_str(config_str, new_fa) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, NULL, "failed to parse configure string") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "failed to parse configure string"); fa = new_fa; } /* Check for unsupported target values */ - if (H5FD_ONION_STORE_TARGET_H5 == fa->store_target) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "same-file storage not implemented") - else if (H5FD_ONION_STORE_TARGET_ONION != fa->store_target) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid store target") + if (H5FD_ONION_STORE_TARGET_ONION != fa->store_target) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid store target"); /* Allocate space for the file struct */ if (NULL == (file = H5FL_CALLOC(H5FD_onion_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "unable to allocate file struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct"); /* Allocate space for onion VFD file names */ if (NULL == (name_onion = H5MM_malloc(sizeof(char) * (HDstrlen(filename) + 7)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "unable to allocate onion name string") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate onion name string"); HDsnprintf(name_onion, HDstrlen(filename) + 7, "%s.onion", filename); if (NULL == (recovery_file_nameery = H5MM_malloc(sizeof(char) * (HDstrlen(name_onion) + 10)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "unable to allocate recovery name string") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate recovery name string"); HDsnprintf(recovery_file_nameery, HDstrlen(name_onion) + 10, "%s.recovery", name_onion); file->recovery_file_name = recovery_file_nameery; if (NULL == (file->recovery_file_name = H5MM_malloc(sizeof(char) * (HDstrlen(name_onion) + 10)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "unable to allocate recovery name string") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate recovery name string"); HDsnprintf(file->recovery_file_name, HDstrlen(name_onion) + 10, "%s.recovery", name_onion); /* Translate H5P_DEFAULT to a real fapl ID, if necessary */ @@ -985,7 +980,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Initialize file structure fields */ - HDmemcpy(&(file->fa), fa, sizeof(H5FD_onion_fapl_info_t)); + memcpy(&(file->fa), fa, sizeof(H5FD_onion_fapl_info_t)); file->header.version = H5FD_ONION_HEADER_VERSION_CURR; file->header.page_size = file->fa.page_size; /* guarded on FAPL-set */ @@ -997,10 +992,10 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Check that the page size is a power of two */ if ((fa->page_size == 0) || ((fa->page_size & (fa->page_size - 1)) != 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "page size is not a power of two") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "page size is not a power of two"); /* Assign the page size */ - double log2_page_size = HDlog2((double)(fa->page_size)); + log2_page_size = HDlog2((double)(fa->page_size)); file->curr_rev_record.archival_index.page_size_log2 = (uint32_t)log2_page_size; /* Proceed with open. */ @@ -1018,7 +1013,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Truncate and create everything as necessary */ if (H5FD__onion_create_truncate_onion(file, filename, name_onion, file->recovery_file_name, flags, maxaddr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCREATE, NULL, "unable to create/truncate onionized files") + HGOTO_ERROR(H5E_VFL, H5E_CANTCREATE, NULL, "unable to create/truncate onionized files"); file->is_open_rw = TRUE; } else { @@ -1027,14 +1022,14 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Open the existing file using the specified fapl */ if (NULL == (file->original_file = H5FD_open(filename, flags, backing_fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open canonical file (does not exist?)") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open canonical file (does not exist?)"); /* Try to open any existing onion file */ H5E_BEGIN_TRY { file->onion_file = H5FD_open(name_onion, flags, backing_fapl_id, maxaddr); } - H5E_END_TRY; + H5E_END_TRY /* If that didn't work, create a new onion file */ /* TODO: Move to a new function */ @@ -1048,7 +1043,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma size_t size = 0; size_t saved_size = 0; - HDassert(file != NULL); + assert(file != NULL); hdr = &file->header; history = &file->history; @@ -1056,31 +1051,29 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma new_open = true; - if (H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_DIVERGENT_HISTORY & file->fa.creation_flags) - hdr->flags |= H5FD_ONION_HEADER_FLAG_DIVERGENT_HISTORY; if (H5FD_ONION_FAPL_INFO_CREATE_FLAG_ENABLE_PAGE_ALIGNMENT & file->fa.creation_flags) { hdr->flags |= H5FD_ONION_HEADER_FLAG_PAGE_ALIGNMENT; file->align_history_on_pages = TRUE; } if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT))) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file"); } if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, canon_eof) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA"); hdr->origin_eof = canon_eof; file->logical_eof = canon_eof; backing_fapl_id = H5FD__onion_get_legit_fapl_id(file->fa.backing_fapl_id); if (H5I_INVALID_HID == backing_fapl_id) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid backing FAPL ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid backing FAPL ID"); /* Create backing files for onion history */ if ((file->onion_file = H5FD_open(name_onion, (H5F_ACC_RDWR | H5F_ACC_CREAT | H5F_ACC_TRUNC), backing_fapl_id, maxaddr)) == NULL) { - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "cannot open the backing onion file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "cannot open the backing onion file"); } /* Write history header with "no" history */ @@ -1089,27 +1082,27 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma H5FD_ONION_ENCODED_SIZE_HEADER + 1; /* TODO: comment these 2 or do some other way */ head_buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER); if (NULL == head_buf) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate buffer"); size = H5FD__onion_header_encode(hdr, head_buf, &hdr->checksum); if (H5FD_ONION_ENCODED_SIZE_HEADER != size) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't encode history header") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't encode history header"); hist_buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HISTORY); if (NULL == hist_buf) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate buffer"); saved_size = size; history->n_revisions = 0; size = H5FD__onion_history_encode(history, hist_buf, &history->checksum); file->header.history_size = size; /* record for later use */ if (H5FD_ONION_ENCODED_SIZE_HISTORY != size) { - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't encode history") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "can't encode history"); } if (H5FD_set_eoa(file->onion_file, H5FD_MEM_DRAW, saved_size + size + 1) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA"); if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, saved_size, head_buf) < 0) { - HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, NULL, - "cannot write header to the backing onion file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, + "cannot write header to the backing onion file"); } file->onion_eof = (haddr_t)saved_size; @@ -1122,8 +1115,8 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma /* Write nascent history (with no revisions) to the backing onion file */ if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, saved_size + 1, size, hist_buf) < 0) { - HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, NULL, - "cannot write history to the backing onion file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, NULL, + "cannot write history to the backing onion file"); } file->header.history_size = size; /* record for later use */ @@ -1132,36 +1125,36 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma H5MM_xfree(hist_buf); } else { - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open onion file (does not exist?).") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open onion file (does not exist?)."); } } if (HADDR_UNDEF == (canon_eof = H5FD_get_eof(file->original_file, H5FD_MEM_DEFAULT))) { - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, NULL, "cannot get size of canonical file"); } if (H5FD_set_eoa(file->original_file, H5FD_MEM_DRAW, canon_eof) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't extend EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't extend EOA"); /* Get the history header from the onion file */ if (H5FD__onion_ingest_header(&file->header, file->onion_file, 0) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get history header from backing store") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get history header from backing store"); file->align_history_on_pages = (file->header.flags & H5FD_ONION_HEADER_FLAG_PAGE_ALIGNMENT) ? TRUE : FALSE; if (H5FD_ONION_HEADER_FLAG_WRITE_LOCK & file->header.flags) { /* Opening a file twice in write mode is an error */ - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "Can't open file already opened in write-mode") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, NULL, "Can't open file already opened in write-mode"); } else { /* Read in the history from the onion file */ if (H5FD__onion_ingest_history(&file->history, file->onion_file, file->header.history_addr, file->header.history_size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get history from backing store") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get history from backing store"); /* Sanity check on revision ID */ if (fa->revision_num > file->history.n_revisions && fa->revision_num != H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "target revision ID out of range") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "target revision ID out of range"); if (fa->revision_num == 0) { file->curr_rev_record.logical_eof = canon_eof; @@ -1170,12 +1163,12 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma H5FD__onion_ingest_revision_record( &file->curr_rev_record, file->onion_file, &file->history, MIN(fa->revision_num - 1, (file->history.n_revisions - 1))) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get revision record from backing store") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, NULL, "can't get revision record from backing store"); } if (H5F_ACC_RDWR & flags) if (H5FD__onion_open_rw(file, flags, maxaddr, new_open) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "can't write-open write-locked file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "can't write-open write-locked file"); } } /* End if opening existing file */ @@ -1195,7 +1188,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma */ if (NULL == (file->curr_rev_record.comment = H5MM_strndup(fa->comment, H5FD_ONION_FAPL_INFO_COMMENT_MAX_LEN))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "unable to duplicate comment string") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to duplicate comment string"); /* TODO: Lengths of strings should be size_t */ file->curr_rev_record.comment_size = (uint32_t)HDstrlen(fa->comment) + 1; @@ -1223,17 +1216,17 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma if (file->original_file) if (H5FD_close(file->original_file) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy backing canon") + HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy backing canon"); if (file->onion_file) if (H5FD_close(file->onion_file) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy backing onion") + HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy backing onion"); if (file->recovery_file) if (H5FD_close(file->recovery_file) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy backing recov") + HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy backing recov"); if (file->rev_index) if (H5FD__onion_revision_index_destroy(file->rev_index) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy revision index") + HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, NULL, "can't destroy revision index"); H5MM_xfree(file->history.record_locs); @@ -1245,7 +1238,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma H5MM_xfree(new_fa); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_open() */ /*----------------------------------------------------------------------------- @@ -1269,44 +1262,44 @@ H5FD__onion_open_rw(H5FD_onion_t *file, unsigned int flags, haddr_t maxaddr, boo uint32_t checksum = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE /* Guard against simultaneous write-open. * TODO: support recovery open with force-write-open flag in FAPL info. */ if (file->header.flags & H5FD_ONION_HEADER_FLAG_WRITE_LOCK) - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't write-open write-locked file") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "can't write-open write-locked file"); /* Copy history to recovery file */ if (NULL == (file->recovery_file = H5FD_open(file->recovery_file_name, (flags | H5F_ACC_CREAT | H5F_ACC_TRUNC), file->fa.backing_fapl_id, maxaddr))) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to create recovery file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to create recovery file"); if (0 == (size = H5FD__onion_write_history(&file->history, file->recovery_file, 0, 0))) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write history to recovery file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write history to recovery file"); if (size != file->header.history_size) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "written history differed from expected size") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "written history differed from expected size"); /* Set write-lock flag in onion header */ if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate space for encoded buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate space for encoded buffer"); file->header.flags |= H5FD_ONION_HEADER_FLAG_WRITE_LOCK; if (0 == (size = H5FD__onion_header_encode(&file->header, buf, &checksum))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding history header") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding history header"); if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, 0, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write updated history header") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write updated history header"); /* Prepare revision index and finalize write-mode open */ if (NULL == (file->rev_index = H5FD__onion_revision_index_init(file->fa.page_size))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize revision index") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "can't initialize revision index"); file->curr_rev_record.parent_revision_num = file->curr_rev_record.revision_num; if (!new_open) file->curr_rev_record.revision_num += 1; @@ -1316,20 +1309,20 @@ H5FD__onion_open_rw(H5FD_onion_t *file, unsigned int flags, haddr_t maxaddr, boo if (FAIL == ret_value) { if (file->recovery_file != NULL) { if (H5FD_close(file->recovery_file) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close recovery file") + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close recovery file"); file->recovery_file = NULL; } if (file->rev_index != NULL) { if (H5FD__onion_revision_index_destroy(file->rev_index) < 0) - HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, FAIL, "can't destroy revision index") + HDONE_ERROR(H5E_VFL, H5E_CANTRELEASE, FAIL, "can't destroy revision index"); file->rev_index = NULL; } } H5MM_xfree(buf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_open_rw() */ /*----------------------------------------------------------------------------- @@ -1355,11 +1348,11 @@ H5FD__onion_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h FUNC_ENTER_PACKAGE - HDassert(file != NULL); - HDassert(buf_out != NULL); + assert(file != NULL); + assert(buf_out != NULL); if ((uint64_t)(offset + len) > file->logical_eoa) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Read extends beyond addressed space") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Read extends beyond addressed space"); if (0 == len) goto done; @@ -1396,14 +1389,14 @@ H5FD__onion_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h /* Page exists in 'live' revision index */ if (H5FD_read(file->onion_file, H5FD_MEM_DRAW, entry_out->phys_addr + page_gap_head, page_readsize, buf_out) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get working file data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get working file data"); } else if (file->fa.revision_num != 0 && H5FD__onion_archival_index_find(&file->curr_rev_record.archival_index, page_i, &entry_out)) { /* Page exists in archival index */ if (H5FD_read(file->onion_file, H5FD_MEM_DRAW, entry_out->phys_addr + page_gap_head, page_readsize, buf_out) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get previously-amended file data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get previously-amended file data"); } else { /* Page does not exist in either index */ @@ -1415,7 +1408,7 @@ H5FD__onion_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h /* Get all original bytes in page range */ if ((read_size > 0) && H5FD_read(file->original_file, type, addr_start, read_size, buf_out) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get original file data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get original file data"); } /* Fill with 0s any gaps after end of original bytes @@ -1429,10 +1422,10 @@ H5FD__onion_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h bytes_to_read -= page_readsize; } /* end for each page in range */ - HDassert(0 == bytes_to_read); + assert(0 == bytes_to_read); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_read() */ /*----------------------------------------------------------------------------- @@ -1448,11 +1441,11 @@ H5FD__onion_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) { H5FD_onion_t *file = (H5FD_onion_t *)_file; - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR file->logical_eoa = addr; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__onion_set_eoa() */ /*----------------------------------------------------------------------------- @@ -1479,13 +1472,13 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, FUNC_ENTER_PACKAGE - HDassert(file != NULL); - HDassert(buf != NULL); - HDassert(file->rev_index != NULL); - HDassert((uint64_t)(offset + len) <= file->logical_eoa); + assert(file != NULL); + assert(buf != NULL); + assert(file->rev_index != NULL); + assert((uint64_t)(offset + len) <= file->logical_eoa); if (FALSE == file->is_open_rw) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Write not allowed if file not opened in write mode") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Write not allowed if file not opened in write mode"); if (0 == len) goto done; @@ -1496,7 +1489,7 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, n_pages = (len + page_size - 1) >> page_size_log2; if (NULL == (page_buf = H5MM_calloc(page_size * sizeof(unsigned char)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "cannot allocate temporary buffer") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "cannot allocate temporary buffer"); /* Write, page-by-page */ for (size_t i = 0; i < n_pages; i++) { @@ -1528,14 +1521,14 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, if (page_gap_head | page_gap_tail) { /* Copy existing page verbatim. */ if (H5FD_read(file->onion_file, H5FD_MEM_DRAW, entry_out->phys_addr, page_size, page_buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get working file data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get working file data"); /* Overlay delta from input buffer onto page buffer. */ - HDmemcpy(page_buf + page_gap_head, buf, page_n_used); + memcpy(page_buf + page_gap_head, buf, page_n_used); write_buf = page_buf; } /* end if partial page */ if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, entry_out->phys_addr, page_size, write_buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "write amended page data to backing file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "write amended page data to backing file"); buf += page_n_used; /* overflow never touched */ bytes_to_write -= page_n_used; @@ -1550,7 +1543,7 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, /* Copy existing page verbatim */ if (H5FD_read(file->onion_file, H5FD_MEM_DRAW, entry_out->phys_addr, page_size, page_buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get previously-amended data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get previously-amended data"); } else { haddr_t addr_start = (haddr_t)(page_i * page_size); @@ -1560,7 +1553,7 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, /* Get all original bytes in page range */ if ((read_size > 0) && H5FD_read(file->original_file, type, addr_start, read_size, page_buf) < 0) { - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get original file data") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't get original file data"); } /* Fill with 0s any gaps after end of original bytes @@ -1577,8 +1570,8 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, } /* end if page exists in neither index */ /* Copy input buffer to temporary page buffer */ - HDassert((page_size - page_gap_head) >= page_n_used); - HDmemcpy(page_buf + page_gap_head, buf, page_n_used); + assert((page_size - page_gap_head) >= page_n_used); + memcpy(page_buf + page_gap_head, buf, page_n_used); write_buf = page_buf; } /* end if data range does not span entire page */ @@ -1587,13 +1580,13 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, new_entry.phys_addr = file->onion_eof; if (H5FD_set_eoa(file->onion_file, H5FD_MEM_DRAW, file->onion_eof + page_size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't modify EOA for new page amendment") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't modify EOA for new page amendment"); if (H5FD_write(file->onion_file, H5FD_MEM_DRAW, file->onion_eof, page_size, write_buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "write amended page data to backing file") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "write amended page data to backing file"); if (H5FD__onion_revision_index_insert(file->rev_index, &new_entry) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINSERT, FAIL, "can't insert new index entry into revision index") + HGOTO_ERROR(H5E_VFL, H5E_CANTINSERT, FAIL, "can't insert new index entry into revision index"); file->onion_eof += page_size; buf += page_n_used; /* possible overflow never touched */ @@ -1601,14 +1594,14 @@ H5FD__onion_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, } /* end for each page to write */ - HDassert(0 == bytes_to_write); + assert(0 == bytes_to_write); file->logical_eof = MAX(file->logical_eof, (offset + len)); done: H5MM_xfree(page_buf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_write() */ /*------------------------------------------------------------------------- @@ -1638,19 +1631,19 @@ H5FD__onion_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_A FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(file); + assert(file); switch (op_code) { case H5FD_CTL_GET_NUM_REVISIONS: if (!output || !*output) - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "the output parameter is null") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "the output parameter is null"); **((uint64_t **)output) = file->history.n_revisions; break; /* Unknown op code */ default: if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set"); break; } @@ -1678,28 +1671,28 @@ H5FDonion_get_revision_count(const char *filename, hid_t fapl_id, uint64_t *revi /* Check args */ if (!filename || !HDstrcmp(filename, "")) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid file name"); if (!revision_count) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "revision count can't be null") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "revision count can't be null"); /* Make sure using the correct driver */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid FAPL ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid FAPL ID"); if (H5FD_ONION != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Onion VFL driver") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a Onion VFL driver"); /* Open the file with the driver */ if (NULL == (file = H5FD_open(filename, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF))) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to open file with onion driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "unable to open file with onion driver"); /* Call the private function */ if (H5FD__get_onion_revision_count(file, revision_count) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "failed to get the number of revisions") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "failed to get the number of revisions"); done: /* Close H5FD_t structure pointer */ if (file && H5FD_close(file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); FUNC_LEAVE_API(ret_value) } @@ -1721,15 +1714,15 @@ H5FD__get_onion_revision_count(H5FD_t *file, uint64_t *revision_count) FUNC_ENTER_PACKAGE - HDassert(file); - HDassert(revision_count); + assert(file); + assert(revision_count); op_code = H5FD_CTL_GET_NUM_REVISIONS; flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; /* Get the number of revisions via the ctl callback */ if (H5FD_ctl(file, op_code, flags, NULL, (void **)&revision_count) < 0) - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1749,15 +1742,15 @@ H5FD__onion_write_final_history(H5FD_onion_t *file) size_t size = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE /* TODO: history EOF may not be correct (under what circumstances?) */ if (0 == (size = H5FD__onion_write_history(&(file->history), file->onion_file, file->onion_eof, file->onion_eof))) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write final history") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write final history"); if (size != file->header.history_size) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "written history differed from expected size") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "written history differed from expected size"); /* Is last write operation to history file; no need to extend to page * boundary if set to page-align. @@ -1765,5 +1758,5 @@ H5FD__onion_write_final_history(H5FD_onion_t *file) file->onion_eof += size; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_write_final_history() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_header.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_header.c index a1d6c28f44..a346ecfa86 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_header.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_header.c @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -19,11 +19,12 @@ /* This source code file is part of the H5FD driver module */ #include "H5FDdrvr_module.h" -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDonion.h" /* Onion file driver */ -#include "H5FDonion_priv.h" /* Onion file driver internals */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDonion.h" /* Onion file driver */ +#include "H5FDonion_priv.h" /* Onion file driver internals */ +#include "H5MMprivate.h" /* Memory management */ /*----------------------------------------------------------------------------- * Function: H5FD_ingest_header @@ -43,31 +44,31 @@ H5FD__onion_ingest_header(H5FD_onion_header_t *hdr_out, H5FD_t *raw_file, haddr_ haddr_t size = (haddr_t)H5FD_ONION_ENCODED_SIZE_HEADER; uint32_t sum = 0; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE if (H5FD_get_eof(raw_file, H5FD_MEM_DRAW) < (addr + size)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "header indicates history beyond EOF") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "header indicates history beyond EOF"); if (NULL == (buf = H5MM_malloc(sizeof(char) * size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer space") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer space"); if (H5FD_set_eoa(raw_file, H5FD_MEM_DRAW, (addr + size)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't modify EOA") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't modify EOA"); if (H5FD_read(raw_file, H5FD_MEM_DRAW, addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't read history header from file") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't read history header from file"); if (H5FD__onion_header_decode(buf, hdr_out) == 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "can't decode history header") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "can't decode history header"); sum = H5_checksum_fletcher32(buf, size - 4); if (hdr_out->checksum != sum) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "checksum mismatch between buffer and stored") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "checksum mismatch between buffer and stored"); done: H5MM_xfree(buf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_ingest_header() */ /*------------------------------------------------------------------------- @@ -87,21 +88,21 @@ H5FD__onion_write_header(H5FD_onion_header_t *header, H5FD_t *file) unsigned char *buf = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HEADER))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer for updated history header") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer for updated history header"); if (0 == (size = H5FD__onion_header_encode(header, buf, &sum))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding updated history header") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "problem encoding updated history header"); if (H5FD_write(file, H5FD_MEM_DRAW, 0, (haddr_t)size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write updated history header") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "can't write updated history header"); done: H5MM_xfree(buf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_write_header()*/ /*----------------------------------------------------------------------------- @@ -127,59 +128,59 @@ H5FD__onion_header_decode(unsigned char *buf, H5FD_onion_header_t *header) unsigned char *ptr = NULL; size_t ret_value = 0; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE - HDassert(buf != NULL); - HDassert(header != NULL); - HDassert(H5FD_ONION_HEADER_VERSION_CURR == header->version); + assert(buf != NULL); + assert(header != NULL); + assert(H5FD_ONION_HEADER_VERSION_CURR == header->version); if (HDstrncmp((const char *)buf, H5FD_ONION_HEADER_SIGNATURE, 4)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid header signature") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid header signature"); if (buf[4] != H5FD_ONION_HEADER_VERSION_CURR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid header version") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid header version"); ptr = buf + 5; ui32 = 0; - HDmemcpy(&ui32, ptr, 3); + memcpy(&ui32, ptr, 3); ui8p = (uint8_t *)&ui32; UINT32DECODE(ui8p, header->flags); ptr += 3; - HDmemcpy(&ui32, ptr, 4); + memcpy(&ui32, ptr, 4); ui8p = (uint8_t *)&ui32; UINT32DECODE(ui8p, header->page_size); ptr += 4; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT32DECODE(ui8p, header->origin_eof); ptr += 8; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT32DECODE(ui8p, header->history_addr); ptr += 8; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT32DECODE(ui8p, header->history_size); ptr += 8; sum = H5_checksum_fletcher32(buf, (size_t)(ptr - buf)); - HDmemcpy(&ui32, ptr, 4); + memcpy(&ui32, ptr, 4); ui8p = (uint8_t *)&ui32; UINT32DECODE(ui8p, header->checksum); ptr += 4; if (sum != header->checksum) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "checksum mismatch") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "checksum mismatch"); ret_value = (size_t)(ptr - buf); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_header_decode() */ /*----------------------------------------------------------------------------- @@ -205,17 +206,17 @@ H5FD__onion_header_encode(H5FD_onion_header_t *header, unsigned char *buf, uint3 unsigned char *ptr = buf; size_t ret_value = 0; - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR - HDassert(buf != NULL); - HDassert(checksum != NULL); - HDassert(header != NULL); - HDassert(H5FD_ONION_HEADER_VERSION_CURR == header->version); - HDassert(0 == (header->flags & 0xFF000000)); /* max three bits long */ + assert(buf != NULL); + assert(checksum != NULL); + assert(header != NULL); + assert(H5FD_ONION_HEADER_VERSION_CURR == header->version); + assert(0 == (header->flags & 0xFF000000)); /* max three bits long */ - HDmemcpy(ptr, H5FD_ONION_HEADER_SIGNATURE, 4); + memcpy(ptr, H5FD_ONION_HEADER_SIGNATURE, 4); ptr += 4; - HDmemcpy(ptr, (unsigned char *)&header->version, 1); + memcpy(ptr, (unsigned char *)&header->version, 1); ptr += 1; UINT32ENCODE(ptr, header->flags); ptr -= 1; /* truncate to three bytes */ @@ -227,5 +228,5 @@ H5FD__onion_header_encode(H5FD_onion_header_t *header, unsigned char *buf, uint3 UINT32ENCODE(ptr, *checksum); ret_value = (size_t)(ptr - buf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_header_encode() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_history.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_history.c index ed45dddc89..e559e80e1b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_history.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_history.c @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -19,11 +19,12 @@ /* This source code file is part of the H5FD driver module */ #include "H5FDdrvr_module.h" -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDonion.h" /* Onion file driver */ -#include "H5FDonion_priv.h" /* Onion file driver internals */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDonion.h" /* Onion file driver */ +#include "H5FDonion_priv.h" /* Onion file driver internals */ +#include "H5MMprivate.h" /* Memory management */ /*----------------------------------------------------------------------------- * Function: H5FD__onion_write_history @@ -42,10 +43,10 @@ H5FD__onion_ingest_history(H5FD_onion_history_t *history_out, H5FD_t *raw_file, uint32_t sum = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE - HDassert(history_out); - HDassert(raw_file); + assert(history_out); + assert(raw_file); /* Set early so we can clean up properly on errors */ history_out->record_locs = NULL; @@ -82,7 +83,7 @@ H5FD__onion_ingest_history(H5FD_onion_history_t *history_out, H5FD_t *raw_file, if (ret_value < 0) H5MM_xfree(history_out->record_locs); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_ingest_history() */ /*----------------------------------------------------------------------------- @@ -103,27 +104,27 @@ H5FD__onion_write_history(H5FD_onion_history_t *history, H5FD_t *file, haddr_t o unsigned char *buf = NULL; uint64_t ret_value = 0; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE if (NULL == (buf = H5MM_malloc(H5FD_ONION_ENCODED_SIZE_HISTORY + (H5FD_ONION_ENCODED_SIZE_RECORD_POINTER * history->n_revisions)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate buffer for updated history") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, 0, "can't allocate buffer for updated history"); if (0 == (size = H5FD__onion_history_encode(history, buf, &_sum))) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, 0, "problem encoding updated history") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, 0, "problem encoding updated history"); if ((size + off_start > filesize_curr) && (H5FD_set_eoa(file, H5FD_MEM_DRAW, off_start + size) < 0)) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, 0, "can't modify EOA for updated history") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, 0, "can't modify EOA for updated history"); if (H5FD_write(file, H5FD_MEM_DRAW, off_start, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, 0, "can't write history as intended") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, 0, "can't write history as intended"); ret_value = size; done: H5MM_xfree(buf); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_write_history() */ /*----------------------------------------------------------------------------- @@ -165,21 +166,21 @@ H5FD__onion_history_decode(unsigned char *buf, H5FD_onion_history_t *history) unsigned char *ptr = NULL; size_t ret_value = 0; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE - HDassert(buf != NULL); - HDassert(history != NULL); - HDassert(H5FD_ONION_HISTORY_VERSION_CURR == history->version); + assert(buf != NULL); + assert(history != NULL); + assert(H5FD_ONION_HISTORY_VERSION_CURR == history->version); if (HDstrncmp((const char *)buf, H5FD_ONION_HISTORY_SIGNATURE, 4)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid signature") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid signature"); if (H5FD_ONION_HISTORY_VERSION_CURR != buf[4]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid version") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid version"); ptr = buf + 8; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT64DECODE(ui8p, n_revisions); ptr += 8; @@ -191,9 +192,9 @@ H5FD__onion_history_decode(unsigned char *buf, H5FD_onion_history_t *history) else { if (history->n_revisions != n_revisions) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, - "history argument suggests different revision count than encoded buffer") + "history argument suggests different revision count than encoded buffer"); if (NULL == history->record_locs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "list is NULL -- cannot populate") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "list is NULL -- cannot populate"); for (uint64_t i = 0; i < n_revisions; i++) { H5FD_onion_record_loc_t *rloc = &history->record_locs[i]; @@ -206,19 +207,19 @@ H5FD__onion_history_decode(unsigned char *buf, H5FD_onion_history_t *history) uint64_t record_size; uint64_t phys_addr; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT64DECODE(ui8p, phys_addr); H5_CHECKED_ASSIGN(rloc->phys_addr, haddr_t, phys_addr, uint64_t); ptr += 8; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT64DECODE(ui8p, record_size); H5_CHECKED_ASSIGN(rloc->record_size, hsize_t, record_size, uint64_t); ptr += 8; - HDmemcpy(&ui32, ptr, 4); + memcpy(&ui32, ptr, 4); ui8p = (uint8_t *)&ui32; UINT32DECODE(ui8p, rloc->checksum); ptr += 4; @@ -227,18 +228,18 @@ H5FD__onion_history_decode(unsigned char *buf, H5FD_onion_history_t *history) sum = H5_checksum_fletcher32(buf, (size_t)(ptr - buf)); - HDmemcpy(&ui32, ptr, 4); + memcpy(&ui32, ptr, 4); ui8p = (uint8_t *)&ui32; UINT32DECODE(ui8p, history->checksum); ptr += 4; if (sum != history->checksum) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "checksum mismatch") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "checksum mismatch"); ret_value = (size_t)(ptr - buf); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_history_decode() */ /*----------------------------------------------------------------------------- @@ -267,19 +268,19 @@ H5FD__onion_history_encode(H5FD_onion_history_t *history, unsigned char *buf, ui unsigned char *ptr = buf; size_t vers_u32 = (uint32_t)history->version; /* pad out unused bytes */ - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR - HDassert(history != NULL); - HDassert(H5FD_ONION_HISTORY_VERSION_CURR == history->version); - HDassert(buf != NULL); - HDassert(checksum != NULL); + assert(history != NULL); + assert(H5FD_ONION_HISTORY_VERSION_CURR == history->version); + assert(buf != NULL); + assert(checksum != NULL); - HDmemcpy(ptr, H5FD_ONION_HISTORY_SIGNATURE, 4); + memcpy(ptr, H5FD_ONION_HISTORY_SIGNATURE, 4); ptr += 4; UINT32ENCODE(ptr, vers_u32); UINT64ENCODE(ptr, history->n_revisions); if (history->n_revisions > 0) { - HDassert(history->record_locs != NULL); + assert(history->record_locs != NULL); for (uint64_t i = 0; i < history->n_revisions; i++) { H5FD_onion_record_loc_t *rloc = &history->record_locs[i]; @@ -301,5 +302,5 @@ H5FD__onion_history_encode(H5FD_onion_history_t *history, unsigned char *buf, ui *checksum = H5_checksum_fletcher32(buf, (size_t)(ptr - buf)); UINT32ENCODE(ptr, *checksum); - FUNC_LEAVE_NOAPI((size_t)(ptr - buf)); + FUNC_LEAVE_NOAPI((size_t)(ptr - buf)) } /* end H5FD__onion_history_encode() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_index.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_index.c index 9dbdde713f..a6215ab8d0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_index.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDonion_index.c @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -19,11 +19,12 @@ /* This source code file is part of the H5FD driver module */ #include "H5FDdrvr_module.h" -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5FDonion.h" /* Onion file driver */ -#include "H5FDonion_priv.h" /* Onion file driver internals */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5FDonion.h" /* Onion file driver */ +#include "H5FDonion_priv.h" /* Onion file driver internals */ +#include "H5MMprivate.h" /* Memory management */ /* 2^n for uint64_t types -- H5_EXP2 unsafe past 32 bits */ #define U64_EXP2(n) ((uint64_t)1 << (n)) @@ -51,13 +52,13 @@ H5FD__onion_ingest_revision_record(H5FD_onion_revision_record_t *r_out, H5FD_t * haddr_t addr = 0; size_t size = 0; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE - HDassert(r_out); - HDassert(raw_file); - HDassert(history); - HDassert(history->record_locs); - HDassert(history->n_revisions > 0); + assert(r_out); + assert(raw_file); + assert(history); + assert(history->record_locs); + assert(history->n_revisions > 0); high = history->n_revisions - 1; range = high; @@ -74,7 +75,7 @@ H5FD__onion_ingest_revision_record(H5FD_onion_revision_record_t *r_out, H5FD_t * r_out->archival_index.list = H5MM_xfree(r_out->archival_index.list); if (H5FD_get_eof(raw_file, H5FD_MEM_DRAW) < (addr + size)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "at least one record extends beyond EOF") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "at least one record extends beyond EOF"); /* recovery-open may have EOA below revision record */ if ((H5FD_get_eoa(raw_file, H5FD_MEM_DRAW) < (addr + size)) && @@ -91,17 +92,17 @@ H5FD__onion_ingest_revision_record(H5FD_onion_revision_record_t *r_out, H5FD_t * size = history->record_locs[n].record_size; if (NULL == (buf = H5MM_malloc(sizeof(char) * size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer space") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer space"); if (H5FD_read(raw_file, H5FD_MEM_DRAW, addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't read revision record from file") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't read revision record from file"); if (H5FD__onion_revision_record_decode(buf, r_out) != size) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "can't decode revision record (initial)") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "can't decode revision record (initial)"); sum = H5_checksum_fletcher32(buf, size - 4); if (r_out->checksum != sum) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "checksum mismatch between buffer and stored") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "checksum mismatch between buffer and stored"); if (revision_num == r_out->revision_num) break; @@ -125,34 +126,34 @@ H5FD__onion_ingest_revision_record(H5FD_onion_revision_record_t *r_out, H5FD_t * size = history->record_locs[n].record_size; if (NULL == (buf = H5MM_malloc(sizeof(char) * size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer space") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate buffer space"); if (H5FD_read(raw_file, H5FD_MEM_DRAW, addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't read revision record from file") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "can't read revision record from file"); if (H5FD__onion_revision_record_decode(buf, r_out) != size) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "can't decode revision record (initial)") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "can't decode revision record (initial)"); sum = H5_checksum_fletcher32(buf, size - 4); if (r_out->checksum != sum) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "checksum mismatch between buffer and stored") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "checksum mismatch between buffer and stored"); if (revision_num != r_out->revision_num) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, - "could not find target revision!") /* TODO: corrupted? */ - } /* end if revision ID at 'leaf' in binary search */ + "could not find target revision!"); /* TODO: corrupted? */ + } /* end if revision ID at 'leaf' in binary search */ if (r_out->comment_size > 0) if (NULL == (r_out->comment = H5MM_malloc(sizeof(char) * r_out->comment_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate comment space") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate comment space"); if (r_out->archival_index.n_entries > 0) if (NULL == (r_out->archival_index.list = H5MM_calloc(r_out->archival_index.n_entries * sizeof(H5FD_onion_index_entry_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate index entry list") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "can't allocate index entry list"); if (H5FD__onion_revision_record_decode(buf, r_out) != size) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "can't decode revision record (final)") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "can't decode revision record (final)"); done: H5MM_xfree(buf); @@ -161,7 +162,7 @@ H5FD__onion_ingest_revision_record(H5FD_onion_revision_record_t *r_out, H5FD_t * H5MM_xfree(r_out->archival_index.list); } - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_ingest_revision_record() */ /*----------------------------------------------------------------------------- @@ -183,23 +184,23 @@ H5FD__onion_archival_index_is_valid(const H5FD_onion_archival_index_t *aix) { hbool_t ret_value = TRUE; - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR - HDassert(aix); + assert(aix); if (H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR != aix->version) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); if (NULL == aix->list) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Ensure list is sorted on logical_page field */ if (aix->n_entries > 1) for (uint64_t i = 1; i < aix->n_entries - 1; i++) if (aix->list[i + 1].logical_page <= aix->list[i].logical_page) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_archival_index_is_valid() */ /*----------------------------------------------------------------------------- @@ -227,13 +228,13 @@ H5FD__onion_archival_index_find(const H5FD_onion_archival_index_t *aix, uint64_t H5FD_onion_index_entry_t *x = NULL; int ret_value = 0; - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR - HDassert(aix); - HDassert(H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR == aix->version); - HDassert(entry_out); + assert(aix); + assert(H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR == aix->version); + assert(entry_out); if (aix->n_entries != 0) - HDassert(aix->list); + assert(aix->list); high = aix->n_entries - 1; range = high; @@ -241,7 +242,7 @@ H5FD__onion_archival_index_find(const H5FD_onion_archival_index_t *aix, uint64_t /* Trivial cases */ if (aix->n_entries == 0 || logical_page > aix->list[high].logical_page || logical_page < aix->list[0].logical_page) - HGOTO_DONE(0) + HGOTO_DONE(0); /* * Binary search on sorted list @@ -249,7 +250,7 @@ H5FD__onion_archival_index_find(const H5FD_onion_archival_index_t *aix, uint64_t /* Winnow down to first of found or one element */ while (range > 0) { - HDassert(high < aix->n_entries); + assert(high < aix->n_entries); n = low + (range / 2); x = &(aix->list[n]); if (x->logical_page == logical_page) { @@ -266,7 +267,7 @@ H5FD__onion_archival_index_find(const H5FD_onion_archival_index_t *aix, uint64_t range = high - low; } - HDassert(high == low); /* one element */ + assert(high == low); /* one element */ /* n == low/high check because we may have tested it already above */ if ((n != low || n != high) && (aix->list[low].logical_page == logical_page)) { @@ -275,7 +276,7 @@ H5FD__onion_archival_index_find(const H5FD_onion_archival_index_t *aix, uint64_t } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_archival_index_find() */ /*----------------------------------------------------------------------------- @@ -291,10 +292,10 @@ H5FD__onion_revision_index_destroy(H5FD_onion_revision_index_t *rix) { herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR - HDassert(rix); - HDassert(H5FD_ONION_REVISION_INDEX_VERSION_CURR == rix->version); + assert(rix); + assert(H5FD_ONION_REVISION_INDEX_VERSION_CURR == rix->version); for (size_t i = 0; 0 < rix->_hash_table_n_keys_populated && i < rix->_hash_table_size; i++) { H5FD_onion_revision_index_hash_chain_node_t *next = NULL; @@ -304,7 +305,7 @@ H5FD__onion_revision_index_destroy(H5FD_onion_revision_index_t *rix) rix->_hash_table_n_keys_populated -= 1; while (node != NULL) { - HDassert(H5FD_ONION_REVISION_INDEX_HASH_CHAIN_NODE_VERSION_CURR == node->version); + assert(H5FD_ONION_REVISION_INDEX_HASH_CHAIN_NODE_VERSION_CURR == node->version); next = node->next; H5MM_xfree(node); @@ -314,7 +315,7 @@ H5FD__onion_revision_index_destroy(H5FD_onion_revision_index_t *rix) H5MM_xfree(rix->_hash_table); H5MM_xfree(rix); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_revision_index_destroy() */ /*----------------------------------------------------------------------------- @@ -335,17 +336,17 @@ H5FD__onion_revision_index_init(uint32_t page_size) H5FD_onion_revision_index_t *rix = NULL; H5FD_onion_revision_index_t *ret_value = NULL; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE - HDassert(0 != page_size); - HDassert(POWER_OF_TWO(page_size)); + assert(0 != page_size); + assert(POWER_OF_TWO(page_size)); if (NULL == (rix = H5MM_calloc(sizeof(H5FD_onion_revision_index_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "cannot allocate index") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "cannot allocate index"); if (NULL == (rix->_hash_table = H5MM_calloc(table_size * sizeof(H5FD_onion_revision_index_hash_chain_node_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "cannot allocate hash table") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "cannot allocate hash table"); rix->version = H5FD_ONION_REVISION_INDEX_VERSION_CURR; rix->n_entries = 0; @@ -363,7 +364,7 @@ H5FD__onion_revision_index_init(uint32_t page_size) if (NULL == ret_value) H5MM_xfree(rix); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_revision_index_init() */ /*----------------------------------------------------------------------------- @@ -389,14 +390,14 @@ H5FD__onion_revision_index_resize(H5FD_onion_revision_index_t *rix) uint64_t new_n_keys_populated = 0; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE - HDassert(rix); - HDassert(H5FD_ONION_REVISION_INDEX_VERSION_CURR == rix->version); - HDassert(rix->_hash_table); + assert(rix); + assert(H5FD_ONION_REVISION_INDEX_VERSION_CURR == rix->version); + assert(rix->_hash_table); if (NULL == (new_table = H5MM_calloc(new_size * sizeof(H5FD_onion_revision_index_hash_chain_node_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "cannot allocate new hash table") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "cannot allocate new hash table"); for (uint64_t i = 0; i < rix->_hash_table_size; i++) { while (rix->_hash_table[i] != NULL) { @@ -427,7 +428,7 @@ H5FD__onion_revision_index_resize(H5FD_onion_revision_index_t *rix) rix->_hash_table = new_table; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_revision_index_resize() */ /*----------------------------------------------------------------------------- @@ -451,21 +452,21 @@ H5FD__onion_revision_index_insert(H5FD_onion_revision_index_t *rix, const H5FD_o H5FD_onion_revision_index_hash_chain_node_t **append_dest = NULL; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE - HDassert(rix); - HDassert(H5FD_ONION_REVISION_INDEX_VERSION_CURR == rix->version); - HDassert(entry); + assert(rix); + assert(H5FD_ONION_REVISION_INDEX_VERSION_CURR == rix->version); + assert(entry); /* Resize and re-hash table if necessary */ if (rix->n_entries >= (rix->_hash_table_size * 2) || rix->_hash_table_n_keys_populated >= (rix->_hash_table_size / 2)) { if (H5FD__onion_revision_index_resize(rix) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NONE_MINOR, FAIL, "unable to resize and hash table") + HGOTO_ERROR(H5E_VFL, H5E_NONE_MINOR, FAIL, "unable to resize and hash table"); } key = entry->logical_page & (rix->_hash_table_size - 1); - HDassert(key < rix->_hash_table_size); + assert(key < rix->_hash_table_size); if (NULL == rix->_hash_table[key]) { /* Key maps to empty bucket */ @@ -482,7 +483,7 @@ H5FD__onion_revision_index_insert(H5FD_onion_revision_index_t *rix, const H5FD_o if (entry->phys_addr != node->entry_data.phys_addr) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "physical address mismatch"); } - HDmemcpy(&node->entry_data, entry, sizeof(H5FD_onion_index_entry_t)); + memcpy(&node->entry_data, entry, sizeof(H5FD_onion_index_entry_t)); append_dest = NULL; /* Node updated, do not append */ break; } @@ -492,16 +493,16 @@ H5FD__onion_revision_index_insert(H5FD_onion_revision_index_t *rix, const H5FD_o /* Add new entry to bucket chain */ if (append_dest != NULL) { if (NULL == (node = H5MM_malloc(sizeof(H5FD_onion_revision_index_hash_chain_node_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "cannot allocate new ash chain node") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "cannot allocate new ash chain node"); node->version = H5FD_ONION_REVISION_INDEX_HASH_CHAIN_NODE_VERSION_CURR; node->next = NULL; - HDmemcpy(&node->entry_data, entry, sizeof(H5FD_onion_index_entry_t)); + memcpy(&node->entry_data, entry, sizeof(H5FD_onion_index_entry_t)); *append_dest = node; rix->n_entries++; } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_revision_index_insert() */ /*----------------------------------------------------------------------------- @@ -524,15 +525,15 @@ H5FD__onion_revision_index_find(const H5FD_onion_revision_index_t *rix, uint64_t uint64_t key = 0; int ret_value = 0; - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR - HDassert(rix); - HDassert(H5FD_ONION_REVISION_INDEX_VERSION_CURR == rix->version); - HDassert(rix->_hash_table); - HDassert(entry_out); + assert(rix); + assert(H5FD_ONION_REVISION_INDEX_VERSION_CURR == rix->version); + assert(rix->_hash_table); + assert(entry_out); key = logical_page & (rix->_hash_table_size - 1); - HDassert(key < rix->_hash_table_size); + assert(key < rix->_hash_table_size); if (rix->_hash_table[key] != NULL) { H5FD_onion_revision_index_hash_chain_node_t *node = NULL; @@ -546,7 +547,7 @@ H5FD__onion_revision_index_find(const H5FD_onion_revision_index_t *rix, uint64_t } } - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_revision_index_find() */ /*----------------------------------------------------------------------------- @@ -596,60 +597,60 @@ H5FD__onion_revision_record_decode(unsigned char *buf, H5FD_onion_revision_recor unsigned char *ptr = NULL; size_t ret_value = 0; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE - HDassert(buf != NULL); - HDassert(record != NULL); - HDassert(H5FD_ONION_REVISION_RECORD_VERSION_CURR == record->version); - HDassert(H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR == record->archival_index.version); + assert(buf != NULL); + assert(record != NULL); + assert(H5FD_ONION_REVISION_RECORD_VERSION_CURR == record->version); + assert(H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR == record->archival_index.version); if (HDstrncmp((const char *)buf, H5FD_ONION_REVISION_RECORD_SIGNATURE, 4)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid signature") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid signature"); if (H5FD_ONION_REVISION_RECORD_VERSION_CURR != buf[4]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid record version") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid record version"); ptr = buf + 8; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT64DECODE(ui8p, record->revision_num); ptr += 8; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT64DECODE(ui8p, record->parent_revision_num); ptr += 8; - HDmemcpy(record->time_of_creation, ptr, 16); + memcpy(record->time_of_creation, ptr, 16); ptr += 16; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT64DECODE(ui8p, record->logical_eof); ptr += 8; - HDmemcpy(&ui32, ptr, 4); + memcpy(&ui32, ptr, 4); ui8p = (uint8_t *)&ui32; UINT32DECODE(ui8p, page_size); ptr += 4; if (page_size == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "page size is zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "page size is zero"); if (!POWER_OF_TWO(page_size)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "page size not power of two") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "page size not power of two"); for (record->archival_index.page_size_log2 = 0; (((uint32_t)1 << record->archival_index.page_size_log2) & page_size) == 0; record->archival_index.page_size_log2++) ; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT64DECODE(ui8p, n_entries); ptr += 8; - HDmemcpy(&ui32, ptr, 4); + memcpy(&ui32, ptr, 4); ui8p = (uint8_t *)&ui32; UINT32DECODE(ui8p, comment_size); ptr += 4; @@ -659,70 +660,70 @@ H5FD__onion_revision_record_decode(unsigned char *buf, H5FD_onion_revision_recor ptr += H5FD_ONION_ENCODED_SIZE_INDEX_ENTRY * n_entries; } else if (n_entries != record->archival_index.n_entries) { - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "n_entries in archival index does not match decoded") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "n_entries in archival index does not match decoded"); } else { H5FD_onion_index_entry_t *entry = NULL; if (record->archival_index.list == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "no archival index entry list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "no archival index entry list"); for (size_t i = 0; i < n_entries; i++) { entry = &record->archival_index.list[i]; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT64DECODE(ui8p, entry->logical_page); ptr += 8; /* logical_page actually encoded as address; check and convert */ if (entry->logical_page & (page_size - 1)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "logical address does not align with page size") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "logical address does not align with page size"); entry->logical_page = entry->logical_page >> record->archival_index.page_size_log2; - HDmemcpy(&ui64, ptr, 8); + memcpy(&ui64, ptr, 8); ui8p = (uint8_t *)&ui64; UINT64DECODE(ui8p, entry->phys_addr); ptr += 8; - HDmemcpy(&ui32, ptr, 4); + memcpy(&ui32, ptr, 4); ui8p = (uint8_t *)&ui32; UINT32DECODE(ui8p, sum); ptr += 4; ui32 = H5_checksum_fletcher32((ptr - 20), 16); if (ui32 != sum) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "index entry checksum mismatch") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "index entry checksum mismatch"); } } if (record->comment_size == 0) { if (record->comment != NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "comment pointer prematurely allocated") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "comment pointer prematurely allocated"); record->comment_size = comment_size; } else { if (record->comment == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "no comment pointer") - HDmemcpy(record->comment, ptr, comment_size); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "no comment pointer"); + memcpy(record->comment, ptr, comment_size); } ptr += comment_size; sum = H5_checksum_fletcher32(buf, (size_t)(ptr - buf)); - HDmemcpy(&ui32, ptr, 4); + memcpy(&ui32, ptr, 4); ui8p = (uint8_t *)&ui32; UINT32DECODE(ui8p, record->checksum); ptr += 4; if (sum != record->checksum) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "checksum mismatch") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "checksum mismatch"); ret_value = (size_t)(ptr - buf); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_revision_record_decode() */ /*----------------------------------------------------------------------------- @@ -753,23 +754,23 @@ H5FD__onion_revision_record_encode(H5FD_onion_revision_record_t *record, unsigne uint32_t vers_u32 = (uint32_t)record->version; /* pad out unused bytes */ uint32_t page_size = 0; - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR - HDassert(checksum != NULL); - HDassert(buf != NULL); - HDassert(record != NULL); - HDassert(vers_u32 < 0x100); - HDassert(H5FD_ONION_REVISION_RECORD_VERSION_CURR == record->version); - HDassert(H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR == record->archival_index.version); + assert(checksum != NULL); + assert(buf != NULL); + assert(record != NULL); + assert(vers_u32 < 0x100); + assert(H5FD_ONION_REVISION_RECORD_VERSION_CURR == record->version); + assert(H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR == record->archival_index.version); page_size = (uint32_t)(1 << record->archival_index.page_size_log2); - HDmemcpy(ptr, H5FD_ONION_REVISION_RECORD_SIGNATURE, 4); + memcpy(ptr, H5FD_ONION_REVISION_RECORD_SIGNATURE, 4); ptr += 4; UINT32ENCODE(ptr, vers_u32); UINT64ENCODE(ptr, record->revision_num); UINT64ENCODE(ptr, record->parent_revision_num); - HDmemcpy(ptr, record->time_of_creation, 16); + memcpy(ptr, record->time_of_creation, 16); ptr += 16; UINT64ENCODE(ptr, record->logical_eof); UINT32ENCODE(ptr, page_size); @@ -779,7 +780,7 @@ H5FD__onion_revision_record_encode(H5FD_onion_revision_record_t *record, unsigne if (record->archival_index.n_entries > 0) { uint64_t page_size_log2 = record->archival_index.page_size_log2; - HDassert(record->archival_index.list != NULL); + assert(record->archival_index.list != NULL); for (uint64_t i = 0; i < record->archival_index.n_entries; i++) { uint32_t sum = 0; H5FD_onion_index_entry_t *entry = NULL; @@ -796,15 +797,15 @@ H5FD__onion_revision_record_encode(H5FD_onion_revision_record_t *record, unsigne } if (record->comment_size > 0) { - HDassert(record->comment != NULL && *record->comment != '\0'); - HDmemcpy(ptr, record->comment, record->comment_size); + assert(record->comment != NULL && *record->comment != '\0'); + memcpy(ptr, record->comment, record->comment_size); ptr += record->comment_size; } *checksum = H5_checksum_fletcher32(buf, (size_t)(ptr - buf)); UINT32ENCODE(ptr, *checksum); - FUNC_LEAVE_NOAPI((size_t)(ptr - buf)); + FUNC_LEAVE_NOAPI((size_t)(ptr - buf)) } /* end H5FD__onion_revision_record_encode() */ /*----------------------------------------------------------------------------- @@ -853,13 +854,13 @@ H5FD__onion_merge_revision_index_into_archival_index(const H5FD_onion_revision_i }; herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE - HDassert(rix); - HDassert(aix); - HDassert(H5FD_ONION_REVISION_INDEX_VERSION_CURR == rix->version); - HDassert(H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR == aix->version); - HDassert(aix->page_size_log2 == rix->page_size_log2); + assert(rix); + assert(aix); + assert(H5FD_ONION_REVISION_INDEX_VERSION_CURR == rix->version); + assert(H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR == aix->version); + assert(aix->page_size_log2 == rix->page_size_log2); /* If the revision index is empty there is nothing to archive */ if (rix->n_entries == 0) @@ -869,20 +870,20 @@ H5FD__onion_merge_revision_index_into_archival_index(const H5FD_onion_revision_i new_aix.page_size_log2 = aix->page_size_log2; if (NULL == (new_aix.list = H5MM_calloc(rix->n_entries * sizeof(H5FD_onion_index_entry_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate new archival index list") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate new archival index list"); for (uint64_t i = 0; i < rix->_hash_table_size; i++) { const H5FD_onion_revision_index_hash_chain_node_t *node = NULL; for (node = rix->_hash_table[i]; node != NULL; node = node->next) { - HDmemcpy(&new_aix.list[new_aix.n_entries], &node->entry_data, sizeof(H5FD_onion_index_entry_t)); + memcpy(&new_aix.list[new_aix.n_entries], &node->entry_data, sizeof(H5FD_onion_index_entry_t)); new_aix.n_entries++; } } /* Sort the new archival list */ - HDqsort(new_aix.list, new_aix.n_entries, sizeof(H5FD_onion_index_entry_t), - H5FD__onion_archival_index_list_sort_cmp); + qsort(new_aix.list, new_aix.n_entries, sizeof(H5FD_onion_index_entry_t), + H5FD__onion_archival_index_list_sort_cmp); /* Add the old archival index entries to a 'kept' list containing the * old archival list entries that are not also included in the revision @@ -893,14 +894,14 @@ H5FD__onion_merge_revision_index_into_archival_index(const H5FD_onion_revision_i */ if (aix->n_entries > 0) if (NULL == (kept_list = H5MM_calloc(aix->n_entries * sizeof(H5FD_onion_index_entry_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate larger archival index list") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate larger archival index list"); for (uint64_t i = 0; i < aix->n_entries; i++) { const H5FD_onion_index_entry_t *entry = NULL; /* Add only if page not already added from revision index */ if (H5FD__onion_archival_index_find(&new_aix, aix->list[i].logical_page, &entry) == 0) { - HDmemcpy(&kept_list[n_kept], &aix->list[i], sizeof(H5FD_onion_index_entry_t)); + memcpy(&kept_list[n_kept], &aix->list[i], sizeof(H5FD_onion_index_entry_t)); n_kept++; } } @@ -910,26 +911,26 @@ H5FD__onion_merge_revision_index_into_archival_index(const H5FD_onion_revision_i */ H5MM_xfree(aix->list); if (NULL == (aix->list = H5MM_calloc((new_aix.n_entries + n_kept) * sizeof(H5FD_onion_index_entry_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate exact-size archival index list") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate exact-size archival index list"); /* Copy (new) revision list entries to replacement list */ - HDmemcpy(aix->list, new_aix.list, sizeof(H5FD_onion_index_entry_t) * new_aix.n_entries); + memcpy(aix->list, new_aix.list, sizeof(H5FD_onion_index_entry_t) * new_aix.n_entries); aix->n_entries = new_aix.n_entries; /* Copy (old) kept archival list entries to replacement list */ if (n_kept > 0) { - HDmemcpy(&aix->list[aix->n_entries], kept_list, sizeof(H5FD_onion_index_entry_t) * n_kept); + memcpy(&aix->list[aix->n_entries], kept_list, sizeof(H5FD_onion_index_entry_t) * n_kept); aix->n_entries += n_kept; } /* Sort this list */ - HDqsort(aix->list, aix->n_entries, sizeof(H5FD_onion_index_entry_t), - H5FD__onion_archival_index_list_sort_cmp); + qsort(aix->list, aix->n_entries, sizeof(H5FD_onion_index_entry_t), + H5FD__onion_archival_index_list_sort_cmp); done: /* Free the temporary lists */ H5MM_xfree(kept_list); H5MM_xfree(new_aix.list); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__onion_merge_revision_index_into_archival_index() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDperform.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDperform.c index 4a68c6e1e8..62097f11aa 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDperform.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDperform.c @@ -50,7 +50,7 @@ H5FDperform_init(H5FD_init_t op) * before `init` is run. */ if (H5_init_library() < 0) - HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, H5I_INVALID_HID, "library initialization failed") + HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, H5I_INVALID_HID, "library initialization failed"); ret_value = op(); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDros3.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDros3.c index 156da68050..c6414af9b4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDros3.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDros3.c @@ -13,9 +13,6 @@ /* * Read-Only S3 Virtual File Driver (VFD) * - * Programmer: Jacob Smith - * 2017-10-13 - * * Purpose: * * Provide read-only access to files hosted on Amazon's S3 service. @@ -50,6 +47,10 @@ */ static hid_t H5FD_ROS3_g = 0; +/* Session/security token property name + */ +#define ROS3_TOKEN_PROP_NAME "ros3_token_prop" + #if ROS3_STATS /* arbitrarily large value, such that any reasonable size read will be "less" @@ -117,10 +118,6 @@ static unsigned long long ros3_stats_boundaries[ROS3_STATS_BIN_COUNT]; * * Largest read size in this bin. * - * - * - * Programmer: Jacob Smith - * ***************************************************************************/ typedef struct { unsigned long long count; @@ -186,10 +183,6 @@ typedef struct { * * *** end ROS3_STATS *** * - * - * - * Programmer: Jacob Smith - * ***************************************************************************/ typedef struct H5FD_ros3_t { H5FD_t pub; @@ -236,6 +229,11 @@ static herr_t H5FD__ros3_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing static herr_t H5FD__ros3_validate_config(const H5FD_ros3_fapl_t *fa); +static herr_t H5FD__ros3_str_token_copy(const char *name, size_t size, void *_value); +static int H5FD__ros3_str_token_cmp(const void *_value1, const void *_value2, size_t size); +static herr_t H5FD__ros3_str_token_close(const char *name, size_t size, void *_value); +static herr_t H5FD__ros3_str_token_delete(hid_t prop_id, const char *name, size_t size, void *_value); + static const H5FD_class_t H5FD_ros3_g = { H5FD_CLASS_VERSION, /* struct version */ H5FD_ROS3_VALUE, /* value */ @@ -291,8 +289,6 @@ H5FL_DEFINE_STATIC(H5FD_ros3_t); * Return: Success: The driver ID for the ros3 driver. * Failure: Negative * - * Programmer: Jacob Smith 2017 - * *------------------------------------------------------------------------- */ hid_t @@ -306,7 +302,7 @@ H5FD_ros3_init(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) #if ROS3_DEBUG - HDfprintf(stdout, "H5FD_ros3_init() called.\n"); + fprintf(stdout, "H5FD_ros3_init() called.\n"); #endif if (H5I_VFL != H5I_get_type(H5FD_ROS3_g)) { @@ -340,8 +336,6 @@ H5FD_ros3_init(void) * * Returns: SUCCEED (Can't fail) * - * Programmer: Jacob Smith 2017 - * *--------------------------------------------------------------------------- */ static herr_t @@ -350,7 +344,7 @@ H5FD__ros3_term(void) FUNC_ENTER_PACKAGE_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_term() called.\n"); + fprintf(stdout, "H5FD__ros3_term() called.\n"); #endif /* Reset VFL ID */ @@ -369,9 +363,6 @@ H5FD__ros3_term(void) * * Return: SUCCEED/FAIL * - * Programmer: John Mainzer - * 9/10/17 - * *------------------------------------------------------------------------- */ herr_t @@ -383,18 +374,18 @@ H5Pset_fapl_ros3(hid_t fapl_id, const H5FD_ros3_fapl_t *fa) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*#", fapl_id, fa); - HDassert(fa != NULL); + assert(fa != NULL); #if ROS3_DEBUG - HDfprintf(stdout, "H5Pset_fapl_ros3() called.\n"); + fprintf(stdout, "H5Pset_fapl_ros3() called.\n"); #endif plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); if (plist == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (FAIL == H5FD__ros3_validate_config(fa)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid ros3 config") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid ros3 config"); ret_value = H5P_set_driver(plist, H5FD_ROS3, (const void *)fa, NULL); @@ -417,9 +408,6 @@ H5Pset_fapl_ros3(hid_t fapl_id, const H5FD_ros3_fapl_t *fa) * Return: SUCCEED if instance of H5FD_ros3_fapl_t contains internally * consistent data, FAIL otherwise. * - * Programmer: Jacob Smith - * 9/10/17 - * *------------------------------------------------------------------------- */ static herr_t @@ -429,7 +417,7 @@ H5FD__ros3_validate_config(const H5FD_ros3_fapl_t *fa) FUNC_ENTER_PACKAGE - HDassert(fa != NULL); + assert(fa != NULL); if (fa->version != H5FD_CURR_ROS3_FAPL_T_VERSION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown H5FD_ros3_fapl_t version"); @@ -453,9 +441,6 @@ H5FD__ros3_validate_config(const H5FD_ros3_fapl_t *fa) * * Failure: Negative * - * Programmer: John Mainzer - * 9/10/17 - * *------------------------------------------------------------------------- */ herr_t @@ -469,22 +454,22 @@ H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_dst /*out*/) H5TRACE2("e", "ix", fapl_id, fa_dst); #if ROS3_DEBUG - HDfprintf(stdout, "H5Pget_fapl_ros3() called.\n"); + fprintf(stdout, "H5Pget_fapl_ros3() called.\n"); #endif if (fa_dst == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst is NULL"); plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); if (plist == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); if (H5FD_ROS3 != H5P_peek_driver(plist)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); fa_src = (const H5FD_ros3_fapl_t *)H5P_peek_driver_info(plist); if (fa_src == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info"); /* Copy the ros3 fapl data out */ H5MM_memcpy(fa_dst, fa_src, sizeof(H5FD_ros3_fapl_t)); @@ -503,9 +488,6 @@ H5Pget_fapl_ros3(hid_t fapl_id, H5FD_ros3_fapl_t *fa_dst /*out*/) * * Failure: NULL * - * Programmer: John Mainzer - * 9/8/17 - * *------------------------------------------------------------------------- */ static void * @@ -519,7 +501,7 @@ H5FD__ros3_fapl_get(H5FD_t *_file) fa = (H5FD_ros3_fapl_t *)H5MM_calloc(sizeof(H5FD_ros3_fapl_t)); if (fa == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy the fields of the structure */ H5MM_memcpy(fa, &(file->fa), sizeof(H5FD_ros3_fapl_t)); @@ -544,9 +526,6 @@ H5FD__ros3_fapl_get(H5FD_t *_file) * * Failure: NULL * - * Programmer: John Mainzer - * 9/8/17 - * *------------------------------------------------------------------------- */ static void * @@ -580,9 +559,6 @@ H5FD__ros3_fapl_copy(const void *_old_fa) * * Return: SUCCEED (cannot fail) * - * Programmer: John Mainzer - * 9/8/17 - * *------------------------------------------------------------------------- */ static herr_t @@ -592,13 +568,264 @@ H5FD__ros3_fapl_free(void *_fa) FUNC_ENTER_PACKAGE_NOERR - HDassert(fa != NULL); /* sanity check */ + assert(fa != NULL); /* sanity check */ H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__ros3_fapl_free() */ +/*------------------------------------------------------------------------- + * Function: H5Pget_fapl_ros3_token + * + * Purpose: Returns session/security token of the ros3 file access + * property list though the function arguments. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Jan-Willem Blokland + * 2023-05-26 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_fapl_ros3_token(hid_t fapl_id, size_t size, char *token_dst /*out*/) +{ + H5P_genplist_t *plist = NULL; + char *token_src; + htri_t token_exists; + size_t tokenlen = 0; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "izx", fapl_id, size, token_dst); + +#if ROS3_DEBUG + fprintf(stdout, "H5Pget_fapl_ros3_token() called.\n"); +#endif + + if (size == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size cannot be zero."); + if (token_dst == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "token_dst is NULL"); + + if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5FD_ROS3 != H5P_peek_driver(plist)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); + if ((token_exists = H5P_exist_plist(plist, ROS3_TOKEN_PROP_NAME)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to check if property token exists in plist"); + if (token_exists) { + if (H5P_get(plist, ROS3_TOKEN_PROP_NAME, &token_src) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get token value"); + } + + /* Copy the token data out */ + tokenlen = HDstrlen(token_src); + if (size <= tokenlen) { + tokenlen = size - 1; + } + H5MM_memcpy(token_dst, token_src, sizeof(char) * tokenlen); + token_dst[tokenlen] = '\0'; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_fapl_ros3_token() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__ros3_str_token_copy() + * + * Purpose: Create a copy of the token string. + * + * Return: SUCCEED/FAIL + * + * Programmer: Jan-Willem Blokland + * 2023-05-26 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__ros3_str_token_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *_value) +{ + char **value = (char **)_value; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + +#if ROS3_DEBUG + fprintf(stdout, "H5FD__ros3_str_token_copy() called.\n"); +#endif + + if (*value) + if (NULL == (*value = HDstrdup(*value))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy string property token"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__ros3_str_token_copy() */ + +/*------------------------------------------------------------------------- + * Function: H5FD__ros3_str_token_cmp() + * + * Purpose: Compares two token strings with each other. + * + * Return: + * - Equivalent: 0 + * - Not Equivalent: non-zero value + * + * Programmer: Jan-Willem Blokland + * 2023-05-26 + * + *------------------------------------------------------------------------- + */ +static int +H5FD__ros3_str_token_cmp(const void *_value1, const void *_value2, size_t H5_ATTR_UNUSED size) +{ + char *const *value1 = (char *const *)_value1; + char *const *value2 = (char *const *)_value2; + int ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE_NOERR + + if (*value1) { + if (*value2) + ret_value = HDstrcmp(*value1, *value2); + else + ret_value = 1; + } + else { + if (*value2) + ret_value = -1; + else + ret_value = 0; + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__ros3_str_token_cmp */ + +/*------------------------------------------------------------------------- + * Function: H5FD__ros3_str_token_close() + * + * Purpose: Closes/frees the memory associated to the token string. + * Currently, it is an empty implementation since there no + * additional treatment needed for this property. + * + * Return: SUCCEED/FAIL + * + * Programmer: Jan-Willem Blokland + * 2023-05-26 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__ros3_str_token_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *_value) +{ + char **value = (char **)_value; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE_NOERR + + if (*value) + free(*value); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__ros3_str_token_close */ + +/*------------------------------------------------------------------------- + * Function: H5FD__ros3_str_token_delete() + * + * Purpose: Deletes the property token from the property list and frees + * the memory associated to the token string. + * Currently, it is an empty implementation since there no + * additional treatment needed for this property. + * + * Return: SUCCEED/FAIL + * + * Programmer: Jan-Willem Blokland + * 2023-05-26 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5FD__ros3_str_token_delete(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *_value) +{ + char **value = (char **)_value; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE_NOERR + + if (*value) + free(*value); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5FD__ros3_str_token_delete */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_fapl_ros3_token() + * + * Purpose: Modify the file access property list to use the H5FD_ROS3 + * driver defined in this source file by adding or + * modifying the session/security token property. + * + * Return: SUCCEED/FAIL + * + * Programmer: Jan-Willem Blokland + * 2023-05-26 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_fapl_ros3_token(hid_t fapl_id, const char *token) +{ + H5P_genplist_t *plist = NULL; + char *token_src; + htri_t token_exists; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*s", fapl_id, token); + +#if ROS3_DEBUG + fprintf(stdout, "H5Pset_fapl_ros3_token() called.\n"); +#endif + + if (fapl_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); + if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access property list"); + if (H5FD_ROS3 != H5P_peek_driver(plist)) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); + if (HDstrlen(token) > H5FD_ROS3_MAX_SECRET_TOK_LEN) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, + "specified token exceeds the internally specified maximum string length"); + + if ((token_exists = H5P_exist_plist(plist, ROS3_TOKEN_PROP_NAME)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to check if property token exists in plist"); + + if (token_exists) { + if (H5P_get(plist, ROS3_TOKEN_PROP_NAME, &token_src) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get token value"); + + memcpy(token_src, token, HDstrlen(token) + 1); + } + else { + token_src = (char *)malloc(sizeof(char) * (H5FD_ROS3_MAX_SECRET_TOK_LEN + 1)); + if (token_src == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for token_src variable."); + memcpy(token_src, token, HDstrlen(token) + 1); + if (H5P_insert(plist, ROS3_TOKEN_PROP_NAME, sizeof(char *), &token_src, NULL, NULL, NULL, NULL, + H5FD__ros3_str_token_delete, H5FD__ros3_str_token_copy, H5FD__ros3_str_token_cmp, + H5FD__ros3_str_token_close) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist"); + } + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_fapl_ros3_token() */ + #if ROS3_STATS /*---------------------------------------------------------------------------- * @@ -616,9 +843,6 @@ H5FD__ros3_fapl_free(void *_fa) * - FAILURE: `FAIL` * - Occurs if the file is invalid somehow * - * Programmer: Jacob Smith - * 2017-12-08 - * *---------------------------------------------------------------------------- */ static herr_t @@ -630,7 +854,7 @@ ros3_reset_stats(H5FD_ros3_t *file) FUNC_ENTER_PACKAGE #if ROS3_DEBUG - HDprintf("ros3_reset_stats() called\n"); + printf("ros3_reset_stats() called\n"); #endif if (file == NULL) @@ -649,7 +873,7 @@ ros3_reset_stats(H5FD_ros3_t *file) } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end ros3_reset_stats() */ #endif /* ROS3_STATS */ @@ -679,9 +903,6 @@ ros3_reset_stats(H5FD_ros3_t *file) * * Failure: NULL * - * Programmer: Jacob Smith - * 2017-11-02 - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -693,12 +914,15 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) unsigned char signing_key[SHA256_DIGEST_LENGTH]; s3r_t *handle = NULL; H5FD_ros3_fapl_t fa; + H5P_genplist_t *plist = NULL; + htri_t token_exists; + char *token; H5FD_t *ret_value = NULL; FUNC_ENTER_PACKAGE #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_open() called.\n"); + fprintf(stdout, "H5FD__ros3_open() called.\n"); #endif /* Sanity check on file offsets */ @@ -706,19 +930,29 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Check arguments */ if (!url || !*url) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); if (ADDR_OVERFLOW(maxaddr)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr"); if (flags != H5F_ACC_RDONLY) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "only Read-Only access allowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, NULL, "only Read-Only access allowed"); if (FAIL == H5Pget_fapl_ros3(fapl_id, &fa)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "can't get property list"); if (CURLE_OK != curl_global_init(CURL_GLOBAL_DEFAULT)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to initialize curl global (placeholder flags)") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to initialize curl global (placeholder flags)"); + + /* Session/security token */ + if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list"); + if ((token_exists = H5P_exist_plist(plist, ROS3_TOKEN_PROP_NAME)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "failed to check if property token exists in plist"); + if (token_exists) { + if (H5P_get(plist, ROS3_TOKEN_PROP_NAME, &token) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get token value"); + } /* open file; procedure depends on whether or not the fapl instructs to * authenticate requests or not. @@ -729,18 +963,22 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) * find way to re-use/share */ now = gmnow(); - HDassert(now != NULL); + assert(now != NULL); if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while writing iso8601 timestamp") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while writing iso8601 timestamp"); if (FAIL == H5FD_s3comms_signing_key(signing_key, (const char *)fa.secret_key, (const char *)fa.aws_region, (const char *)iso8601now)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while computing signing key") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "problem while computing signing key"); - handle = H5FD_s3comms_s3r_open(url, (const char *)fa.aws_region, (const char *)fa.secret_id, - (const unsigned char *)signing_key); + if (token_exists) + handle = H5FD_s3comms_s3r_open(url, (const char *)fa.aws_region, (const char *)fa.secret_id, + (const unsigned char *)signing_key, (const char *)token); + else + handle = H5FD_s3comms_s3r_open(url, (const char *)fa.aws_region, (const char *)fa.secret_id, + (const unsigned char *)signing_key, ""); } else - handle = H5FD_s3comms_s3r_open(url, NULL, NULL, NULL); + handle = H5FD_s3comms_s3r_open(url, NULL, NULL, NULL, NULL); if (handle == NULL) /* If we want to check CURL's say on the matter in a controlled @@ -752,14 +990,14 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* create new file struct */ file = H5FL_CALLOC(H5FD_ros3_t); if (file == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct"); file->s3r_handle = handle; H5MM_memcpy(&(file->fa), &fa, sizeof(H5FD_ros3_fapl_t)); #if ROS3_STATS if (FAIL == ros3_reset_stats(file)) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNINITIALIZED, NULL, "unable to reset file statistics"); #endif /* ROS3_STATS */ ret_value = (H5FD_t *)file; @@ -768,7 +1006,7 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) if (ret_value == NULL) { if (handle != NULL) if (FAIL == H5FD_s3comms_s3r_close(handle)) - HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close s3 file handle") + HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, NULL, "unable to close s3 file handle"); if (file != NULL) file = H5FL_FREE(H5FD_ros3_t, file); curl_global_cleanup(); /* early cleanup because open failed */ @@ -793,7 +1031,7 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) * or "meta" (any other flag) * * Prints filename and listing of total number of reads and bytes read, - * both as a grand total and separate meta- and rawdata reads. + * both as a grand total and separate meta- and raw data reads. * * If any reads were done, prints out two tables: * @@ -828,8 +1066,6 @@ H5FD__ros3_open(const char *url, unsigned flags, hid_t fapl_id, haddr_t maxaddr) * - occurs if the file passed in is invalid * - TODO: if stream is invalid? how can we check this? * - * Programmer: Jacob Smith - * *---------------------------------------------------------------------------- */ static herr_t @@ -868,20 +1104,20 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) * PRINT FILENAME * ******************/ - HDfprintf(stream, "stats for %s://%s", purl->scheme, purl->host); + fprintf(stream, "stats for %s://%s", purl->scheme, purl->host); if (purl->port != NULL && purl->port[0] != '\0') - HDfprintf(stream, ":%s", purl->port); + fprintf(stream, ":%s", purl->port); if (purl->query != NULL && purl->query[0] != '\0') { if (purl->path != NULL && purl->path[0] != '\0') - HDfprintf(stream, "/%s", purl->path); + fprintf(stream, "/%s", purl->path); else - HDfprintf(stream, "/"); - HDfprintf(stream, "?%s", purl->query); + fprintf(stream, "/"); + fprintf(stream, "?%s", purl->query); } else if (purl->path != NULL && purl->path[0] != '\0') { - HDfprintf(stream, "/%s", purl->path); + fprintf(stream, "/%s", purl->path); } - HDfprintf(stream, "\n"); + fprintf(stream, "\n"); /******************* * AGGREGATE STATS * @@ -914,10 +1150,10 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) * PRINT OVERVIEW * ******************/ - HDfprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", count_raw + count_meta, count_meta, - count_raw); - HDfprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, - bytes_raw); + fprintf(stream, "TOTAL READS: %llu (%llu meta, %llu raw)\n", count_raw + count_meta, count_meta, + count_raw); + fprintf(stream, "TOTAL BYTES: %llu (%llu meta, %llu raw)\n", bytes_raw + bytes_meta, bytes_meta, + bytes_raw); if (count_raw + count_meta == 0) goto done; @@ -926,60 +1162,60 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) * PRINT AGGREGATE STATS * *************************/ - HDfprintf(stream, "SIZES meta raw\n"); - HDfprintf(stream, " min "); + fprintf(stream, "SIZES meta raw\n"); + fprintf(stream, " min "); if (count_meta == 0) - HDfprintf(stream, " 0.000 "); + fprintf(stream, " 0.000 "); else { re_dub = (double)min_meta; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); } if (count_raw == 0) - HDfprintf(stream, " 0.000 \n"); + fprintf(stream, " 0.000 \n"); else { re_dub = (double)min_raw; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); } - HDfprintf(stream, " avg "); + fprintf(stream, " avg "); re_dub = (double)average_meta; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)average_raw; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); - HDfprintf(stream, " max "); + fprintf(stream, " max "); re_dub = (double)max_meta; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c ", re_dub, suffixes[suffix_i]); re_dub = (double)max_raw; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - HDfprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); + assert(suffix_i < sizeof(suffixes)); + fprintf(stream, "%8.3lf%c\n", re_dub, suffixes[suffix_i]); /****************************** * PRINT INDIVIDUAL BIN STATS * ******************************/ - HDfprintf(stream, "BINS # of reads total bytes average size\n"); - HDfprintf(stream, " up-to meta raw meta raw meta raw\n"); + fprintf(stream, "BINS # of reads total bytes average size\n"); + fprintf(stream, " up-to meta raw meta raw meta raw\n"); for (i = 0; i <= ROS3_STATS_BIN_COUNT; i++) { const ros3_statsbin *m; @@ -1003,56 +1239,56 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) if (i == ROS3_STATS_BIN_COUNT) { range_end = ros3_stats_boundaries[i - 1]; - HDfprintf(stream, ">"); + fprintf(stream, ">"); } else - HDfprintf(stream, " "); + fprintf(stream, " "); bm_val = (double)m->bytes; for (suffix_i = 0; bm_val >= 1024.0; suffix_i++) bm_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); + assert(suffix_i < sizeof(suffixes)); bm_suffix = suffixes[suffix_i]; br_val = (double)r->bytes; for (suffix_i = 0; br_val >= 1024.0; suffix_i++) br_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); + assert(suffix_i < sizeof(suffixes)); br_suffix = suffixes[suffix_i]; if (m->count > 0) am_val = (double)(m->bytes) / (double)(m->count); for (suffix_i = 0; am_val >= 1024.0; suffix_i++) am_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); + assert(suffix_i < sizeof(suffixes)); am_suffix = suffixes[suffix_i]; if (r->count > 0) ar_val = (double)(r->bytes) / (double)(r->count); for (suffix_i = 0; ar_val >= 1024.0; suffix_i++) ar_val /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); + assert(suffix_i < sizeof(suffixes)); ar_suffix = suffixes[suffix_i]; re_dub = (double)range_end; for (suffix_i = 0; re_dub >= 1024.0; suffix_i++) re_dub /= 1024.0; - HDassert(suffix_i < sizeof(suffixes)); - - HDfprintf(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, - suffixes[suffix_i], /* bin ceiling */ - m->count, /* metadata reads */ - r->count, /* rawdata reads */ - bm_val, bm_suffix, /* metadata bytes */ - br_val, br_suffix, /* rawdata bytes */ - am_val, am_suffix, /* metadata average */ - ar_val, ar_suffix); /* rawdata average */ - - HDfflush(stream); + assert(suffix_i < sizeof(suffixes)); + + fprintf(stream, " %8.3f%c %7d %7d %8.3f%c %8.3f%c %8.3f%c %8.3f%c\n", re_dub, + suffixes[suffix_i], /* bin ceiling */ + m->count, /* metadata reads */ + r->count, /* raw data reads */ + bm_val, bm_suffix, /* metadata bytes */ + br_val, br_suffix, /* raw data bytes */ + am_val, am_suffix, /* metadata average */ + ar_val, ar_suffix); /* raw data average */ + + fflush(stream); } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* ros3_fprint_stats */ #endif /* ROS3_STATS */ @@ -1069,9 +1305,6 @@ ros3_fprint_stats(FILE *stream, const H5FD_ros3_t *file) * * SUCCEED/FAIL * - * Programmer: Jacob Smith - * 2017-11-02 - * *------------------------------------------------------------------------- */ static herr_t @@ -1083,22 +1316,22 @@ H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file) FUNC_ENTER_PACKAGE #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_close() called.\n"); + fprintf(stdout, "H5FD__ros3_close() called.\n"); #endif /* Sanity checks */ - HDassert(file != NULL); - HDassert(file->s3r_handle != NULL); + assert(file != NULL); + assert(file->s3r_handle != NULL); /* Close the underlying request handle */ if (FAIL == H5FD_s3comms_s3r_close(file->s3r_handle)) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close S3 request handle") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close S3 request handle"); #if ROS3_STATS /* TODO: mechanism to re-target stats printout */ if (ros3_fprint_stats(stdout, file) == FAIL) - HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics") + HGOTO_ERROR(H5E_INTERNAL, H5E_ERROR, FAIL, "problem while writing file statistics"); #endif /* ROS3_STATS */ /* Release the file info */ @@ -1135,9 +1368,6 @@ H5FD__ros3_close(H5FD_t H5_ATTR_UNUSED *_file) * - Equivalent: 0 * - Not Equivalent: -1 * - * Programmer: Jacob Smith - * 2017-11-06 - * *------------------------------------------------------------------------- */ static int @@ -1152,88 +1382,88 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_PACKAGE_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_cmp() called.\n"); + fprintf(stdout, "H5FD__ros3_cmp() called.\n"); #endif - HDassert(f1->s3r_handle != NULL); - HDassert(f2->s3r_handle != NULL); + assert(f1->s3r_handle != NULL); + assert(f2->s3r_handle != NULL); purl1 = (const parsed_url_t *)f1->s3r_handle->purl; purl2 = (const parsed_url_t *)f2->s3r_handle->purl; - HDassert(purl1 != NULL); - HDassert(purl2 != NULL); - HDassert(purl1->scheme != NULL); - HDassert(purl2->scheme != NULL); - HDassert(purl1->host != NULL); - HDassert(purl2->host != NULL); + assert(purl1 != NULL); + assert(purl2 != NULL); + assert(purl1->scheme != NULL); + assert(purl2->scheme != NULL); + assert(purl1->host != NULL); + assert(purl2->host != NULL); /* URL: SCHEME */ if (HDstrcmp(purl1->scheme, purl2->scheme)) - HGOTO_DONE(-1) + HGOTO_DONE(-1); /* URL: HOST */ if (HDstrcmp(purl1->host, purl2->host)) - HGOTO_DONE(-1) + HGOTO_DONE(-1); /* URL: PORT */ if (purl1->port && purl2->port) { if (HDstrcmp(purl1->port, purl2->port)) - HGOTO_DONE(-1) + HGOTO_DONE(-1); } else if (purl1->port) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (purl2->port) - HGOTO_DONE(-1) + HGOTO_DONE(-1); /* URL: PATH */ if (purl1->path && purl2->path) { if (HDstrcmp(purl1->path, purl2->path)) - HGOTO_DONE(-1) + HGOTO_DONE(-1); } else if (purl1->path && !purl2->path) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (purl2->path && !purl1->path) - HGOTO_DONE(-1) + HGOTO_DONE(-1); /* URL: QUERY */ if (purl1->query && purl2->query) { if (HDstrcmp(purl1->query, purl2->query)) - HGOTO_DONE(-1) + HGOTO_DONE(-1); } else if (purl1->query && !purl2->query) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (purl2->query && !purl1->query) - HGOTO_DONE(-1) + HGOTO_DONE(-1); /* FAPL: AWS_REGION */ if (f1->fa.aws_region[0] != '\0' && f2->fa.aws_region[0] != '\0') { if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region)) - HGOTO_DONE(-1) + HGOTO_DONE(-1); } else if (f1->fa.aws_region[0] != '\0') - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (f2->fa.aws_region[0] != '\0') - HGOTO_DONE(-1) + HGOTO_DONE(-1); /* FAPL: SECRET_ID */ if (f1->fa.secret_id[0] != '\0' && f2->fa.secret_id[0] != '\0') { if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id)) - HGOTO_DONE(-1) + HGOTO_DONE(-1); } else if (f1->fa.secret_id[0] != '\0') - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (f2->fa.secret_id[0] != '\0') - HGOTO_DONE(-1) + HGOTO_DONE(-1); /* FAPL: SECRET_KEY */ if (f1->fa.secret_key[0] != '\0' && f2->fa.secret_key[0] != '\0') { if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key)) - HGOTO_DONE(-1) + HGOTO_DONE(-1); } else if (f1->fa.secret_key[0] != '\0') - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (f2->fa.secret_key[0] != '\0') - HGOTO_DONE(-1) + HGOTO_DONE(-1); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1253,9 +1483,6 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * * Return: SUCCEED (Can't fail) * - * Programmer: John Mainzer - * 9/11/17 - * *------------------------------------------------------------------------- */ static herr_t @@ -1264,7 +1491,7 @@ H5FD__ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) FUNC_ENTER_PACKAGE_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_query() called.\n"); + fprintf(stdout, "H5FD__ros3_query() called.\n"); #endif /* Set the VFL feature flags that this driver supports */ @@ -1291,9 +1518,6 @@ H5FD__ros3_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) * * The end-of-address marker. * - * Programmer: Jacob Smith - * 2017-11-02 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1304,7 +1528,7 @@ H5FD__ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_PACKAGE_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_get_eoa() called.\n"); + fprintf(stdout, "H5FD__ros3_get_eoa() called.\n"); #endif FUNC_LEAVE_NOAPI(file->eoa) @@ -1322,9 +1546,6 @@ H5FD__ros3_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * SUCCEED (can't fail) * - * Programmer: Jacob Smith - * 2017-11-03 - * *------------------------------------------------------------------------- */ static herr_t @@ -1335,7 +1556,7 @@ H5FD__ros3_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_ENTER_PACKAGE_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_set_eoa() called.\n"); + fprintf(stdout, "H5FD__ros3_set_eoa() called.\n"); #endif file->eoa = addr; @@ -1356,9 +1577,6 @@ H5FD__ros3_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) * EOF: the first address past the end of the "file", either the * filesystem file or the HDF5 file. * - * Programmer: Jacob Smith - * 2017-11-02 - * *------------------------------------------------------------------------- */ static haddr_t @@ -1369,7 +1587,7 @@ H5FD__ros3_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_PACKAGE_NOERR #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_get_eof() called.\n"); + fprintf(stdout, "H5FD__ros3_get_eof() called.\n"); #endif FUNC_LEAVE_NOAPI(H5FD_s3comms_s3r_get_filesize(file->s3r_handle)) @@ -1387,9 +1605,6 @@ H5FD__ros3_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * SUCCEED/FAIL * - * Programmer: Jacob Smith - * 2017-11-02 - * *------------------------------------------------------------------------- */ static herr_t @@ -1401,11 +1616,11 @@ H5FD__ros3_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand FUNC_ENTER_PACKAGE #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_get_handle() called.\n"); + fprintf(stdout, "H5FD__ros3_get_handle() called.\n"); #endif if (!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); *file_handle = file->s3r_handle; @@ -1430,9 +1645,6 @@ H5FD__ros3_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand * - Unable to complete read. * - Contents of buffer `buf` are undefined. * - * Programmer: Jacob Smith - * 2017-11-?? - * *------------------------------------------------------------------------- */ static herr_t @@ -1451,20 +1663,20 @@ H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU FUNC_ENTER_PACKAGE #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_read() called.\n"); + fprintf(stdout, "H5FD__ros3_read() called.\n"); #endif - HDassert(file != NULL); - HDassert(file->s3r_handle != NULL); - HDassert(buf != NULL); + assert(file != NULL); + assert(file->s3r_handle != NULL); + assert(buf != NULL); filesize = H5FD_s3comms_s3r_get_filesize(file->s3r_handle); if ((addr > filesize) || ((addr + size) > filesize)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "range exceeds file address"); if (H5FD_s3comms_s3r_read(file->s3r_handle, addr, size, buf) == FAIL) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "unable to execute read"); #if ROS3_STATS @@ -1507,9 +1719,6 @@ H5FD__ros3_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU * * FAIL (Not possible with Read-Only S3 file.) * - * Programmer: Jacob Smith - * 2017-10-23 - * *------------------------------------------------------------------------- */ static herr_t @@ -1521,10 +1730,10 @@ H5FD__ros3_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, h FUNC_ENTER_PACKAGE #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_write() called.\n"); + fprintf(stdout, "H5FD__ros3_write() called.\n"); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file."); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1545,9 +1754,6 @@ H5FD__ros3_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, h * * FAIL (Not possible on Read-Only S3 files.) * - * Programmer: Jacob Smith - * 2017-10-23 - * *------------------------------------------------------------------------- */ static herr_t @@ -1559,10 +1765,10 @@ H5FD__ros3_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, FUNC_ENTER_PACKAGE #if ROS3_DEBUG - HDfprintf(stdout, "H5FD__ros3_truncate() called.\n"); + fprintf(stdout, "H5FD__ros3_truncate() called.\n"); #endif - HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file.") + HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file."); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDs3comms.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDs3comms.c index 1bf0a2f3d8..8a433d50ac 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDs3comms.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDs3comms.c @@ -25,9 +25,6 @@ * Connect to remote host, send and receive HTTP requests and responses * as part of the AWS REST API, authenticating requests as appropriate. * - * Programmer: Jacob Smith - * 2017-11-30 - * *****************************************************************************/ /****************/ @@ -42,6 +39,7 @@ #include "H5Eprivate.h" /* error handling */ #include "H5MMprivate.h" /* memory management */ #include "H5FDs3comms.h" /* S3 Communications */ +#include "H5FDros3.h" /* ros3 file driver */ /****************/ /* Local Macros */ @@ -128,9 +126,6 @@ herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle); * - Should equal number of bytes passed to callback. * - Failure will result in curl error: CURLE_WRITE_ERROR. * - * Programmer: Jacob Smith - * 2017-08-17 - * *---------------------------------------------------------------------------- */ size_t @@ -200,9 +195,6 @@ curlwritecallback(char *ptr, size_t size, size_t nmemb, void *userdata) * - Forbidden (attempting to remove absent node, e.g.) * - Internal error * - * Programmer: Jacob Smith - * 2017-09-22 - * *---------------------------------------------------------------------------- */ herr_t @@ -222,14 +214,14 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_hrb_node_set."); - HDprintf("NAME: %s\n", name); - HDprintf("VALUE: %s\n", value); - HDprintf("LIST:\n->"); + fprintf(stdout, "called H5FD_s3comms_hrb_node_set."); + printf("NAME: %s\n", name); + printf("VALUE: %s\n", value); + printf("LIST:\n->"); for (node_ptr = (*L); node_ptr != NULL; node_ptr = node_ptr->next) - HDfprintf(stdout, "{%s}\n->", node_ptr->cat); - HDprintf("(null)\n"); - HDfflush(stdout); + fprintf(stdout, "{%s}\n->", node_ptr->cat); + printf("(null)\n"); + fflush(stdout); node_ptr = NULL; #endif @@ -276,7 +268,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) ret = HDsnprintf(nvcat, catwrite, "%s: %s", name, value); if (ret < 0 || (size_t)ret > catlen) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot concatenate `%s: %s", name, value); - HDassert(catlen == HDstrlen(nvcat)); + assert(catlen == HDstrlen(nvcat)); /* create new_node, should we need it */ @@ -298,11 +290,11 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) if (*L == NULL) { if (value == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove node from empty list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove node from empty list"); else { #if S3COMMS_DEBUG - HDprintf("CREATE NEW\n"); - HDfflush(stdout); + printf("CREATE NEW\n"); + fflush(stdout); #endif /******************* * CREATE NEW LIST * @@ -320,8 +312,8 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) /* sanity-check pointer passed in */ - HDassert((*L) != NULL); - HDassert((*L)->magic == S3COMMS_HRB_NODE_MAGIC); + assert((*L) != NULL); + assert((*L)->magic == S3COMMS_HRB_NODE_MAGIC); node_ptr = (*L); /* Check whether to modify/remove first node in list @@ -332,8 +324,8 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) if (value == NULL) { #if S3COMMS_DEBUG - HDprintf("REMOVE HEAD\n"); - HDfflush(stdout); + printf("REMOVE HEAD\n"); + fflush(stdout); #endif /*************** * REMOVE HEAD * @@ -342,48 +334,48 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) *L = node_ptr->next; #if S3COMMS_DEBUG - HDprintf("FREEING CAT (node)\n"); - HDfflush(stdout); + printf("FREEING CAT (node)\n"); + fflush(stdout); #endif H5MM_xfree(node_ptr->cat); #if S3COMMS_DEBUG - HDprintf("FREEING LOWERNAME (node)\n"); - HDfflush(stdout); + printf("FREEING LOWERNAME (node)\n"); + fflush(stdout); #endif H5MM_xfree(node_ptr->lowername); #if S3COMMS_DEBUG - HDprintf("FREEING NAME (node)\n"); - HDfflush(stdout); + printf("FREEING NAME (node)\n"); + fflush(stdout); #endif H5MM_xfree(node_ptr->name); #if S3COMMS_DEBUG - HDprintf("FREEING VALUE (node)\n"); - HDfflush(stdout); + printf("FREEING VALUE (node)\n"); + fflush(stdout); #endif H5MM_xfree(node_ptr->value); #if S3COMMS_DEBUG - HDprintf("MAGIC OK? %s\n", (node_ptr->magic == S3COMMS_HRB_NODE_MAGIC) ? "YES" : "NO"); - HDfflush(stdout); + printf("MAGIC OK? %s\n", (node_ptr->magic == S3COMMS_HRB_NODE_MAGIC) ? "YES" : "NO"); + fflush(stdout); #endif - HDassert(node_ptr->magic == S3COMMS_HRB_NODE_MAGIC); + assert(node_ptr->magic == S3COMMS_HRB_NODE_MAGIC); node_ptr->magic += 1ul; #if S3COMMS_DEBUG - HDprintf("FREEING POINTER\n"); - HDfflush(stdout); + printf("FREEING POINTER\n"); + fflush(stdout); #endif H5MM_xfree(node_ptr); #if S3COMMS_DEBUG - HDprintf("FREEING WORKING LOWERNAME\n"); - HDfflush(stdout); + printf("FREEING WORKING LOWERNAME\n"); + fflush(stdout); #endif H5MM_xfree(lowername); lowername = NULL; } else { #if S3COMMS_DEBUG - HDprintf("MODIFY HEAD\n"); - HDfflush(stdout); + printf("MODIFY HEAD\n"); + fflush(stdout); #endif /*************** * MODIFY HEAD * @@ -409,11 +401,11 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) is_looking = FALSE; if (value == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove a node 'before' head") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove a node 'before' head"); else { #if S3COMMS_DEBUG - HDprintf("PREPEND NEW HEAD\n"); - HDfflush(stdout); + printf("PREPEND NEW HEAD\n"); + fflush(stdout); #endif /******************* * INSERT NEW HEAD * @@ -438,17 +430,17 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) is_looking = FALSE; if (value == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node"); else { #if S3COMMS_DEBUG - HDprintf("APPEND A NODE\n"); - HDfflush(stdout); + printf("APPEND A NODE\n"); + fflush(stdout); #endif /******************* * APPEND NEW NODE * *******************/ - HDassert(HDstrcmp(lowername, node_ptr->lowername) > 0); + assert(HDstrcmp(lowername, node_ptr->lowername) > 0); new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -461,17 +453,17 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) is_looking = FALSE; if (value == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "trying to remove absent node"); else { #if S3COMMS_DEBUG - HDprintf("INSERT A NODE\n"); - HDfflush(stdout); + printf("INSERT A NODE\n"); + fflush(stdout); #endif /******************* * INSERT NEW NODE * *******************/ - HDassert(HDstrcmp(lowername, node_ptr->lowername) > 0); + assert(HDstrcmp(lowername, node_ptr->lowername) > 0); new_node->name = namecpy; new_node->value = valuecpy; new_node->lowername = lowername; @@ -493,15 +485,15 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) node_ptr->next = tmp->next; #if S3COMMS_DEBUG - HDprintf("REMOVE A NODE\n"); - HDfflush(stdout); + printf("REMOVE A NODE\n"); + fflush(stdout); #endif H5MM_xfree(tmp->cat); H5MM_xfree(tmp->lowername); H5MM_xfree(tmp->name); H5MM_xfree(tmp->value); - HDassert(tmp->magic == S3COMMS_HRB_NODE_MAGIC); + assert(tmp->magic == S3COMMS_HRB_NODE_MAGIC); tmp->magic += 1ul; H5MM_xfree(tmp); @@ -510,8 +502,8 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) } else { #if S3COMMS_DEBUG - HDprintf("MODIFY A NODE\n"); - HDfflush(stdout); + printf("MODIFY A NODE\n"); + fflush(stdout); #endif /***************** * MODIFY A NODE * @@ -522,7 +514,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) H5MM_xfree(node_ptr->value); H5MM_xfree(node_ptr->cat); - HDassert(new_node->magic == S3COMMS_HRB_NODE_MAGIC); + assert(new_node->magic == S3COMMS_HRB_NODE_MAGIC); new_node->magic += 1ul; H5MM_xfree(new_node); H5MM_xfree(lowername); @@ -555,13 +547,13 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) if (valuecpy != NULL) H5MM_xfree(valuecpy); if (new_node != NULL) { - HDassert(new_node->magic == S3COMMS_HRB_NODE_MAGIC); + assert(new_node->magic == S3COMMS_HRB_NODE_MAGIC); new_node->magic += 1ul; H5MM_xfree(new_node); } } - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_s3comms_hrb_node_set() */ /*---------------------------------------------------------------------------- @@ -595,9 +587,6 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value) * - FAILURE: `FAIL` * - `buf->magic != S3COMMS_HRB_MAGIC` * - * Programmer: Jacob Smith - * 2017-07-21 - * *---------------------------------------------------------------------------- */ herr_t @@ -609,7 +598,7 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf) FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_hrb_destroy.\n"); + fprintf(stdout, "called H5FD_s3comms_hrb_destroy.\n"); #endif if (_buf != NULL && *_buf != NULL) { @@ -653,9 +642,6 @@ H5FD_s3comms_hrb_destroy(hrb_t **_buf) * - SUCCESS: pointer to new `hrb_t` * - FAILURE: `NULL` * - * Programmer: Jacob Smith - * 2017-07-21 - * *---------------------------------------------------------------------------- */ hrb_t * @@ -673,7 +659,7 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_hrb_init_request.\n"); + fprintf(stdout, "called H5FD_s3comms_hrb_init_request.\n"); #endif if (_resource == NULL) @@ -709,7 +695,7 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string"); *res = '/'; H5MM_memcpy((&res[1]), _resource, (reslen + 1)); - HDassert((reslen + 1) == HDstrlen(res)); + assert((reslen + 1) == HDstrlen(res)); } /* end if (else resource string not starting with '/') */ verblen = HDstrlen(_verb) + 1; @@ -767,9 +753,6 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch * - fails if handle is null or has invalid magic number * * - * Programmer: Jacob Smith - * 2017-08-31 - * *---------------------------------------------------------------------------- */ herr_t @@ -780,7 +763,7 @@ H5FD_s3comms_s3r_close(s3r_t *handle) FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_s3r_close.\n"); + fprintf(stdout, "called H5FD_s3comms_s3r_close.\n"); #endif if (handle == NULL) @@ -793,12 +776,13 @@ H5FD_s3comms_s3r_close(s3r_t *handle) H5MM_xfree(handle->secret_id); H5MM_xfree(handle->region); H5MM_xfree(handle->signing_key); + H5MM_xfree(handle->token); - HDassert(handle->httpverb != NULL); + assert(handle->httpverb != NULL); H5MM_xfree(handle->httpverb); if (FAIL == H5FD_s3comms_free_purl(handle->purl)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to release parsed url structure") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to release parsed url structure"); H5MM_xfree(handle); @@ -822,8 +806,6 @@ H5FD_s3comms_s3r_close(s3r_t *handle) * - SUCCESS: size of file, in bytes, if handle is valid. * - FAILURE: 0, if handle is NULL or undefined. * - * Programmer: Jacob Smith 2017-01-14 - * *---------------------------------------------------------------------------- */ size_t @@ -866,9 +848,6 @@ H5FD_s3comms_s3r_get_filesize(s3r_t *handle) * - SUCCESS: `SUCCEED` * - FAILURE: `FAIL` * - * Programmer: Jacob Smith - * 2017-08-23 - * *---------------------------------------------------------------------------- */ herr_t @@ -885,7 +864,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_s3r_getsize.\n"); + fprintf(stdout, "called H5FD_s3comms_s3r_getsize.\n"); #endif if (handle == NULL) @@ -893,7 +872,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) if (handle->magic != S3COMMS_S3R_MAGIC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); if (handle->curlhandle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle."); /******************** * PREPARE FOR HEAD * @@ -906,7 +885,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HEADERDATA, &sds)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while setting CURL option (CURLOPT_HEADERDATA)."); - HDassert(handle->httpverb == NULL); + assert(handle->httpverb == NULL); handle->httpverb = (char *)H5MM_malloc(sizeof(char) * 16); if (handle->httpverb == NULL) HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "unable to allocate space for S3 request HTTP verb"); @@ -929,19 +908,19 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem in reading during getsize."); if (sds.size > CURL_MAX_HTTP_HEADER) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HTTP metadata buffer overrun") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HTTP metadata buffer overrun"); else if (sds.size == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "No HTTP metadata") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "No HTTP metadata"); #if S3COMMS_DEBUG else - HDfprintf(stderr, "GETSIZE: OK\n"); + fprintf(stdout, "GETSIZE: OK\n"); #endif /****************** * PARSE RESPONSE * ******************/ - start = HDstrstr(headerresponse, "\r\nContent-Length: "); + start = HDstrcasestr(headerresponse, "\r\nContent-Length: "); if (start == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find \"Content-Length\" in response."); @@ -955,17 +934,21 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) */ *end = '\0'; - content_length = HDstrtoumax((const char *)start, NULL, 0); + content_length = strtoumax((const char *)start, NULL, 0); if (UINTMAX_MAX > SIZE_MAX && content_length > SIZE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "content_length overflows size_t"); - if (content_length == 0 || errno == ERANGE) /* errno set by HDstrtoumax*/ + if (content_length == 0 || errno == ERANGE) /* errno set by strtoumax*/ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not convert found \"Content-Length\" response (\"%s\")", start); /* range is null-terminated, remember */ handle->filesize = (size_t)content_length; +#if S3COMMS_DEBUG + fprintf(stdout, "FILESIZE: %zu\n", handle->filesize); +#endif + /********************** * UNDO HEAD SETTINGS * **********************/ @@ -980,7 +963,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) H5MM_xfree(headerresponse); sds.magic += 1; /* set to bad magic */ - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_s3r_getsize */ /*---------------------------------------------------------------------------- @@ -1017,13 +1000,11 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle) * - unable to parse url (malformed?) * - error while performing `getsize()` * - * Programmer: Jacob Smith - * 2017-09-01 - * *---------------------------------------------------------------------------- */ s3r_t * -H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const unsigned char *signing_key) +H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const unsigned char *signing_key, + const char *token) { size_t tmplen = 0; CURL *curlh = NULL; @@ -1034,7 +1015,7 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_s3r_open.\n"); + fprintf(stdout, "called H5FD_s3comms_s3r_open.\n"); #endif if (url == NULL || url[0] == '\0') @@ -1044,8 +1025,8 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const /* probably a malformed url, but could be internal error */ HGOTO_ERROR(H5E_ARGS, H5E_CANTCREATE, NULL, "unable to create parsed url structure"); - HDassert(purl != NULL); /* if above passes, this must be true */ - HDassert(purl->magic == S3COMMS_PARSED_URL_MAGIC); + assert(purl != NULL); /* if above passes, this must be true */ + assert(purl->magic == S3COMMS_PARSED_URL_MAGIC); handle = (s3r_t *)H5MM_malloc(sizeof(s3r_t)); if (handle == NULL) @@ -1057,13 +1038,15 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const handle->region = NULL; handle->secret_id = NULL; handle->signing_key = NULL; + handle->token = NULL; handle->httpverb = NULL; /************************************* * RECORD AUTHENTICATION INFORMATION * *************************************/ - if ((region != NULL && *region != '\0') || (id != NULL && *id != '\0') || (signing_key != NULL)) { + if ((region != NULL && *region != '\0') || (id != NULL && *id != '\0') || (signing_key != NULL) || + (token != NULL)) { /* if one exists, all three must exist */ if (region == NULL || region[0] == '\0') @@ -1072,6 +1055,8 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "secret id cannot be null."); if (signing_key == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "signing key cannot be null."); + if (token == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "token cannot be null."); /* copy strings */ tmplen = HDstrlen(region) + 1; @@ -1091,6 +1076,12 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const if (handle->signing_key == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle key copy."); H5MM_memcpy(handle->signing_key, signing_key, tmplen); + + tmplen = HDstrlen(token) + 1; + handle->token = (char *)H5MM_malloc(sizeof(char) * tmplen); + if (handle->token == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle token copy."); + H5MM_memcpy(handle->token, token, tmplen); } /* if authentication information provided */ /************************ @@ -1137,7 +1128,7 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const * FINAL PREPARATION * *********************/ - HDassert(handle->httpverb != NULL); + assert(handle->httpverb != NULL); H5MM_memcpy(handle->httpverb, "GET", 4); ret_value = handle; @@ -1147,11 +1138,12 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const if (curlh != NULL) curl_easy_cleanup(curlh); if (FAIL == H5FD_s3comms_free_purl(purl)) - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to free parsed url structure") + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to free parsed url structure"); if (handle != NULL) { H5MM_xfree(handle->region); H5MM_xfree(handle->secret_id); H5MM_xfree(handle->signing_key); + H5MM_xfree(handle->token); if (handle->httpverb != NULL) H5MM_xfree(handle->httpverb); H5MM_xfree(handle); @@ -1197,9 +1189,6 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const * - SUCCESS: `SUCCEED` * - FAILURE: `FAIL` * - * Programmer: Jacob Smith - * 2017-08-22 - * *---------------------------------------------------------------------------- */ herr_t @@ -1215,13 +1204,16 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) hrb_t *request = NULL; int ret = 0; /* working variable to check */ /* return value of HDsnprintf */ - struct s3r_datastruct *sds = NULL; - herr_t ret_value = SUCCEED; + char *authorization = NULL; + char *buffer1 = NULL; + char *signed_headers = NULL; + struct s3r_datastruct *sds = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_s3r_read.\n"); + fprintf(stdout, "called H5FD_s3comms_s3r_read.\n"); #endif /************************************** @@ -1233,12 +1225,12 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) if (handle->magic != S3COMMS_S3R_MAGIC) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has invalid magic."); if (handle->curlhandle == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) curlhandle."); if (handle->purl == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) url.") - HDassert(handle->purl->magic == S3COMMS_PARSED_URL_MAGIC); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle has bad (null) url."); + assert(handle->purl->magic == S3COMMS_PARSED_URL_MAGIC); if (offset > handle->filesize || (len + offset) > handle->filesize) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to read past EoF") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to read past EoF"); curlh = handle->curlhandle; @@ -1281,6 +1273,11 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value"); } +#if S3COMMS_DEBUG + fprintf(stdout, "%s: Bytes %" PRIuHADDR " - %" PRIuHADDR ", Request Size: %zu\n", handle->httpverb, + offset, offset + len - 1, len); +#endif + /******************* * COMPILE REQUEST * *******************/ @@ -1292,9 +1289,9 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) char *bytesrange_ptr = NULL; /* pointer past "bytes=" portion */ bytesrange_ptr = HDstrchr(rangebytesstr, '='); - HDassert(bytesrange_ptr != NULL); + assert(bytesrange_ptr != NULL); bytesrange_ptr++; /* move to first char past '=' */ - HDassert(*bytesrange_ptr != '\0'); + assert(*bytesrange_ptr != '\0'); if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, bytesrange_ptr)) HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, @@ -1304,23 +1301,31 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) else { /* authenticate request */ - char authorization[512 + 1]; - /* 512 := approximate max length... - * 67 - * + 8 - * + 64 - * + 128 - * + 20 - * + 128 + authorization = (char *)H5MM_malloc(512 + H5FD_ROS3_MAX_SECRET_TOK_LEN + 1); + if (authorization == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for authorization variable."); + /* 2048 := approximate max length... + * 67 + * + 8 + * + 64 + * + 128 + * + 20 + * + 128 + * + 1024 */ - char buffer1[512 + 1]; /* -> Canonical Request -> Signature */ char buffer2[256 + 1]; /* -> String To Sign -> Credential */ char iso8601now[ISO8601_SIZE]; - char signed_headers[48 + 1]; + buffer1 = (char *)H5MM_malloc(512 + H5FD_ROS3_MAX_SECRET_TOK_LEN + + 1); /* -> Canonical Request -> Signature */ + if (buffer1 == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for buffer1 variable."); + signed_headers = (char *)H5MM_malloc(48 + H5FD_ROS3_MAX_SECRET_KEY_LEN + 1); + if (signed_headers == NULL) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for signed_headers variable."); /* should be large enough for nominal listing: - * "host;range;x-amz-content-sha256;x-amz-date" - * + '\0', with "range;" possibly absent + * "host;range;x-amz-content-sha256;x-amz-date;x-amz-security-token" + * + '\0', with "range;" and/or "x-amz-security-token" possibly absent */ /* zero start of strings */ @@ -1338,6 +1343,8 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null secret_id."); if (handle->signing_key == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null signing_key."); + if (handle->token == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null token."); if (handle->httpverb == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle must have non-null httpverb."); if (handle->purl->host == NULL) @@ -1351,45 +1358,57 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) (const char *)handle->purl->path, "HTTP/1.1"); if (request == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not allocate hrb_t request."); - HDassert(request->magic == S3COMMS_HRB_MAGIC); + assert(request->magic == S3COMMS_HRB_MAGIC); now = gmnow(); if (ISO8601NOW(iso8601now, now) != (ISO8601_SIZE - 1)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not format ISO8601 time."); if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "x-amz-date", (const char *)iso8601now)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-date header") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-date header"); if (headers == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); - HDassert(headers->magic == S3COMMS_HRB_NODE_MAGIC); + assert(headers->magic == S3COMMS_HRB_NODE_MAGIC); if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "x-amz-content-sha256", (const char *)EMPTY_SHA256)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-content-sha256 header") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-content-sha256 header"); if (headers == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); - HDassert(headers->magic == S3COMMS_HRB_NODE_MAGIC); + assert(headers->magic == S3COMMS_HRB_NODE_MAGIC); + + if (HDstrlen((const char *)handle->token) > 0) { + if (FAIL == + H5FD_s3comms_hrb_node_set(&headers, "x-amz-security-token", (const char *)handle->token)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-security-token header"); + if (headers == NULL) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); + assert(headers->magic == S3COMMS_HRB_NODE_MAGIC); + } if (rangebytesstr != NULL) { if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "Range", rangebytesstr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set range header") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set range header"); if (headers == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); - HDassert(headers->magic == S3COMMS_HRB_NODE_MAGIC); + assert(headers->magic == S3COMMS_HRB_NODE_MAGIC); } if (FAIL == H5FD_s3comms_hrb_node_set(&headers, "Host", handle->purl->host)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set host header") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set host header"); if (headers == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); - HDassert(headers->magic == S3COMMS_HRB_NODE_MAGIC); + assert(headers->magic == S3COMMS_HRB_NODE_MAGIC); request->first_header = headers; /**** COMPUTE AUTHORIZATION ****/ /* buffer1 -> canonical request */ - if (FAIL == H5FD_s3comms_aws_canonical_request(buffer1, 512, signed_headers, 48, request)) + if (FAIL == H5FD_s3comms_aws_canonical_request(buffer1, 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN, + signed_headers, 48 + H5FD_ROS3_MAX_SECRET_TOK_LEN, + request)) { HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad canonical request"); + } /* buffer2->string-to-sign */ if (FAIL == H5FD_s3comms_tostringtosign(buffer2, buffer1, iso8601now, handle->region)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad string-to-sign"); @@ -1403,14 +1422,15 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) if (ret == 0 || ret >= S3COMMS_MAX_CREDENTIAL_SIZE) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 credential string"); - ret = HDsnprintf(authorization, 512, "AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s", - buffer2, signed_headers, buffer1); - if (ret <= 0 || ret >= 512) + ret = HDsnprintf(authorization, 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN, + "AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s", buffer2, + signed_headers, buffer1); + if (ret <= 0 || ret >= 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 authorization string"); /* append authorization header to http request buffer */ if (H5FD_s3comms_hrb_node_set(&headers, "Authorization", (const char *)authorization) == FAIL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set Authorization header") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set Authorization header"); if (headers == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list."); @@ -1421,7 +1441,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) node = request->first_header; while (node != NULL) { - HDassert(node->magic == S3COMMS_HRB_NODE_MAGIC); + assert(node->magic == S3COMMS_HRB_NODE_MAGIC); curlheaders = curl_slist_append(curlheaders, (const char *)node->cat); if (curlheaders == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not append header to curl slist."); @@ -1453,47 +1473,60 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) curlerrbuf[0] = '\0'; if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, curlerrbuf)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem setting error buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem setting error buffer"); p_status = curl_easy_perform(curlh); if (p_status != CURLE_OK) { if (CURLE_OK != curl_easy_getinfo(curlh, CURLINFO_RESPONSE_CODE, &httpcode)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem getting response code") - HDfprintf(stderr, "CURL ERROR CODE: %d\nHTTP CODE: %d\n", p_status, httpcode); - HDfprintf(stderr, "%s\n", curl_easy_strerror(p_status)); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem getting response code"); + fprintf(stdout, "CURL ERROR CODE: %d\nHTTP CODE: %ld\n", p_status, httpcode); + fprintf(stdout, "%s\n", curl_easy_strerror(p_status)); + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "problem while performing request."); } if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_ERRORBUFFER, NULL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem unsetting error buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem unsetting error buffer"); } /* verbose error reporting */ #else p_status = curl_easy_perform(curlh); if (p_status != CURLE_OK) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "curl cannot perform request") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, FAIL, "curl cannot perform request"); #endif #if S3COMMS_DEBUG if (dest != NULL) { - HDfprintf(stderr, "len: %d\n", (int)len); - HDfprintf(stderr, "CHECKING FOR BUFFER OVERFLOW\n"); + fprintf(stdout, "len: %d\n", (int)len); + fprintf(stdout, "CHECKING FOR BUFFER OVERFLOW\n"); if (sds == NULL) - HDfprintf(stderr, "sds is NULL!\n"); + fprintf(stdout, "sds is NULL!\n"); else { - HDfprintf(stderr, "sds: 0x%lx\n", (long long)sds); - HDfprintf(stderr, "sds->size: %d\n", (int)sds->size); + fprintf(stdout, "sds: 0x%llx\n", (long long)sds); + fprintf(stdout, "sds->size: %d\n", (int)sds->size); if (len > sds->size) - HDfprintf(stderr, "buffer overwrite\n"); + fprintf(stdout, "buffer overwrite\n"); } } else - HDfprintf(stderr, "performed on entire file\n"); + fprintf(stdout, "performed on entire file\n"); #endif done: /* clean any malloc'd resources */ + if (authorization != NULL) { + H5MM_xfree(authorization); + authorization = NULL; + } + if (buffer1 != NULL) { + H5MM_xfree(buffer1); + buffer1 = NULL; + } + if (signed_headers != NULL) { + H5MM_xfree(signed_headers); + signed_headers = NULL; + } if (curlheaders != NULL) { curl_slist_free_all(curlheaders); curlheaders = NULL; @@ -1509,24 +1542,24 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) if (request != NULL) { while (headers != NULL) if (FAIL == H5FD_s3comms_hrb_node_set(&headers, headers->name, NULL)) - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot release header node") - HDassert(NULL == headers); + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot release header node"); + assert(NULL == headers); if (FAIL == H5FD_s3comms_hrb_destroy(&request)) - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot release header request structure") - HDassert(NULL == request); + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot release header request structure"); + assert(NULL == request); } if (curlh != NULL) { /* clear any Range */ if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_RANGE, NULL)) - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot unset CURLOPT_RANGE") + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot unset CURLOPT_RANGE"); /* clear headers */ if (CURLE_OK != curl_easy_setopt(curlh, CURLOPT_HTTPHEADER, NULL)) - HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot unset CURLOPT_HTTPHEADER") + HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot unset CURLOPT_HTTPHEADER"); } - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_s3r_read */ /**************************************************************************** @@ -1546,9 +1579,6 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest) * * Pointer to resulting `struct tm`,as created by gmtime(time_t * T). * - * Programmer: Jacob Smith - * 2017-07-12 - * *---------------------------------------------------------------------------- */ struct tm * @@ -1562,7 +1592,7 @@ gmnow(void) if ((time_t)(-1) != HDtime(now_ptr)) ret_value = HDgmtime(now_ptr); - HDassert(ret_value != NULL); + assert(ret_value != NULL); return ret_value; } /* end gmnow() */ @@ -1601,9 +1631,6 @@ gmnow(void) * - one or more input argument was NULL * - internal error * - * Programmer: Jacob Smith - * 2017-10-04 - * *---------------------------------------------------------------------------- */ herr_t @@ -1618,8 +1645,7 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c size_t sh_size = (size_t)_sh_size; size_t cr_len = 0; /* working length of canonical request str */ size_t sh_len = 0; /* working length of signed headers str */ - char tmpstr[256 + 1]; - tmpstr[256] = 0; /* terminating NULL */ + char tmpstr[1024]; /* "query params" refers to the optional element in the URL, e.g. * http://bucket.aws.com/myfile.txt?max-keys=2&prefix=J @@ -1634,12 +1660,12 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_aws_canonical_request.\n"); + fprintf(stdout, "called H5FD_s3comms_aws_canonical_request.\n"); #endif if (http_request == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hrb object cannot be null."); - HDassert(http_request->magic == S3COMMS_HRB_MAGIC); + assert(http_request->magic == S3COMMS_HRB_MAGIC); if (canonical_request_dest == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request destination cannot be null."); @@ -1652,6 +1678,7 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c (size_t)3); /* three newline chars */ if (cr_len >= cr_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); + /* TODO: compiler warning */ ret = HDsnprintf(canonical_request_dest, (cr_size - 1), "%s\n%s\n%s\n", http_request->verb, http_request->resource, query_params); @@ -1662,10 +1689,10 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c node = http_request->first_header; /* assumed sorted */ while (node != NULL) { - HDassert(node->magic == S3COMMS_HRB_NODE_MAGIC); + assert(node->magic == S3COMMS_HRB_NODE_MAGIC); - ret = HDsnprintf(tmpstr, 256, "%s:%s\n", node->lowername, node->value); - if (ret < 0 || ret >= 256) + ret = HDsnprintf(tmpstr, 1024, "%s:%s\n", node->lowername, node->value); + if (ret < 0 || ret >= 1024) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to concatenate HTTP header %s:%s", node->lowername, node->value); cr_len += HDstrlen(tmpstr); @@ -1673,8 +1700,8 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request"); HDstrcat(canonical_request_dest, tmpstr); - ret = HDsnprintf(tmpstr, 256, "%s;", node->lowername); - if (ret < 0 || ret >= 256) + ret = HDsnprintf(tmpstr, 1024, "%s;", node->lowername); + if (ret < 0 || ret >= 1024) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to append semicolon to lowername %s", node->lowername); sh_len += HDstrlen(tmpstr); @@ -1698,7 +1725,7 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c HDstrcat(canonical_request_dest, EMPTY_SHA256); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_s3comms_aws_canonical_request() */ /*---------------------------------------------------------------------------- @@ -1727,9 +1754,6 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c * - `dest == NULL` * - `msg == NULL` * - * Programmer: Jacob Smith - * 2017-07-12 - * *---------------------------------------------------------------------------- */ herr_t @@ -1741,13 +1765,13 @@ H5FD_s3comms_bytes_to_hex(char *dest, const unsigned char *msg, size_t msg_len, FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_bytes_to_hex.\n"); + fprintf(stdout, "called H5FD_s3comms_bytes_to_hex.\n"); #endif if (dest == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hex destination cannot be null.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hex destination cannot be null."); if (msg == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bytes sequence cannot be null.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bytes sequence cannot be null."); for (i = 0; i < msg_len; i++) { int chars_written = HDsnprintf(&(dest[i * 2]), 3, /* 'X', 'X', '\n' */ @@ -1757,7 +1781,7 @@ H5FD_s3comms_bytes_to_hex(char *dest, const unsigned char *msg, size_t msg_len, } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_s3comms_bytes_to_hex() */ /*---------------------------------------------------------------------------- @@ -1774,9 +1798,6 @@ H5FD_s3comms_bytes_to_hex(char *dest, const unsigned char *msg, size_t msg_len, * * `SUCCEED` (never fails) * - * Programmer: Jacob Smith - * 2017-11-01 - * *---------------------------------------------------------------------------- */ herr_t @@ -1785,11 +1806,11 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) FUNC_ENTER_NOAPI_NOINIT_NOERR #if S3COMMS_DEBUG - HDprintf("called H5FD_s3comms_free_purl.\n"); + printf("called H5FD_s3comms_free_purl.\n"); #endif if (purl != NULL) { - HDassert(purl->magic == S3COMMS_PARSED_URL_MAGIC); + assert(purl->magic == S3COMMS_PARSED_URL_MAGIC); if (purl->scheme != NULL) H5MM_xfree(purl->scheme); if (purl->host != NULL) @@ -1832,9 +1853,6 @@ H5FD_s3comms_free_purl(parsed_url_t *purl) * - `dest == NULL` * - error while generating hex string output * - * Programmer: Jacob Smith - * 2017-07-?? - * *---------------------------------------------------------------------------- */ herr_t @@ -1848,7 +1866,7 @@ H5FD_s3comms_HMAC_SHA256(const unsigned char *key, size_t key_len, const char *m FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_HMAC_SHA256.\n"); + fprintf(stdout, "called H5FD_s3comms_HMAC_SHA256.\n"); #endif if (dest == NULL) @@ -1860,7 +1878,7 @@ H5FD_s3comms_HMAC_SHA256(const unsigned char *key, size_t key_len, const char *m HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not convert to hex string."); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_HMAC_SHA256 */ /*----------------------------------------------------------------------------- @@ -1907,9 +1925,6 @@ H5FD_s3comms_HMAC_SHA256(const unsigned char *key, size_t key_len, const char *m * + -2 :: profile name/label not found in file * + -3 :: some other error * - * Programmer: Jacob Smith - * 2018-02-27 - * *----------------------------------------------------------------------------- */ static herr_t @@ -1938,12 +1953,12 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha FUNC_ENTER_PACKAGE #if S3COMMS_DEBUG - HDfprintf(stdout, "called load_aws_creds_from_file.\n"); + fprintf(stdout, "called load_aws_creds_from_file.\n"); #endif /* format target line for start of profile */ if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name)) - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format profile label") + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format profile label"); /* look for start of profile */ do { @@ -1976,7 +1991,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha setting_name = setting_names[setting_i]; setting_name_len = HDstrlen(setting_name); if (HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format line prefix") + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format line prefix"); /* found a matching name? */ if (!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) { @@ -1992,7 +2007,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha } while (*line_buffer != 0 && *line_buffer != '='); if (*line_buffer == 0 || *(line_buffer + 1) == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incomplete assignment in file") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "incomplete assignment in file"); line_buffer++; /* was pointing at '='; advance */ /* copy line buffer into out pointer */ @@ -2000,7 +2015,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha /* "trim" tailing whitespace by replacing with null terminator*/ buffer_i = 0; - while (!HDisspace(setting_pointers[setting_i][buffer_i])) + while (!isspace(setting_pointers[setting_i][buffer_i])) buffer_i++; setting_pointers[setting_i][buffer_i] = '\0'; @@ -2010,7 +2025,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha } while (found_setting); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__s3comms_load_aws_creds_from_file() */ /*---------------------------------------------------------------------------- @@ -2040,9 +2055,6 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha * + unable to locate profile * + region, key id, and secret key were not all found and set * - * Programmer: Jacob Smith - * 2018-02-27 - * *---------------------------------------------------------------------------- */ herr_t @@ -2058,7 +2070,7 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_load_aws_profile.\n"); + fprintf(stdout, "called H5FD_s3comms_load_aws_profile.\n"); #endif #ifdef H5_HAVE_WIN32_API @@ -2067,33 +2079,33 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("HOME")); #endif if (ret < 0 || (size_t)ret >= 117) - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path") + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path"); ret = HDsnprintf(filepath, 128, "%s%s", awspath, "credentials"); if (ret < 0 || (size_t)ret >= 128) - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path") + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path"); - credfile = HDfopen(filepath, "r"); + credfile = fopen(filepath, "r"); if (credfile != NULL) { if (H5FD__s3comms_load_aws_creds_from_file(credfile, profile_name, key_id_out, secret_access_key_out, aws_region_out) == FAIL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws credentials") - if (HDfclose(credfile) == EOF) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close credentials file") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws credentials"); + if (fclose(credfile) == EOF) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close credentials file"); credfile = NULL; } /* end if credential file opened */ ret = HDsnprintf(filepath, 128, "%s%s", awspath, "config"); if (ret < 0 || (size_t)ret >= 128) - HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path") - credfile = HDfopen(filepath, "r"); + HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path"); + credfile = fopen(filepath, "r"); if (credfile != NULL) { if (H5FD__s3comms_load_aws_creds_from_file( credfile, profile_name, (*key_id_out == 0) ? key_id_out : NULL, (*secret_access_key_out == 0) ? secret_access_key_out : NULL, (*aws_region_out == 0) ? aws_region_out : NULL) == FAIL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws config") - if (HDfclose(credfile) == EOF) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close config file") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to load from aws config"); + if (fclose(credfile) == EOF) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close config file"); credfile = NULL; } /* end if credential file opened */ @@ -2103,10 +2115,10 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * done: if (credfile != NULL) - if (HDfclose(credfile) == EOF) - HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, "problem error-closing aws configuration file") + if (fclose(credfile) == EOF) + HDONE_ERROR(H5E_ARGS, H5E_ARGS, FAIL, "problem error-closing aws configuration file"); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_s3comms_load_aws_profile() */ /*---------------------------------------------------------------------------- @@ -2130,9 +2142,6 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char * * - FAILURE: `FAIL` * - `dest == NULL` * - * Programmer: Jacob Smith - * 2017-09-18 - * *---------------------------------------------------------------------------- */ herr_t @@ -2143,7 +2152,7 @@ H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len) FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_nlowercase.\n"); + fprintf(stdout, "called H5FD_s3comms_nlowercase.\n"); #endif if (dest == NULL) @@ -2158,7 +2167,7 @@ H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len) } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_s3comms_nlowercase() */ /*---------------------------------------------------------------------------- @@ -2187,9 +2196,6 @@ H5FD_s3comms_nlowercase(char *dest, const char *s, size_t len) * - unable to parse * - `purl` is unaltered (probably NULL) * - * Programmer: Jacob Smith - * 2017-10-30 - * *---------------------------------------------------------------------------- */ herr_t @@ -2203,10 +2209,10 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) unsigned int i = 0; herr_t ret_value = FAIL; - FUNC_ENTER_NOAPI_NOINIT; + FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDprintf("called H5FD_s3comms_parse_url.\n"); + printf("called H5FD_s3comms_parse_url.\n"); #endif if (str == NULL || *str == '\0') @@ -2232,12 +2238,12 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) if (tmpstr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction: probably not URL"); len = tmpstr - curstr; - HDassert((0 <= len) && (len < urllen)); + assert((0 <= len) && (len < urllen)); /* check for restrictions */ for (i = 0; i < len; i++) { /* scheme = [a-zA-Z+-.]+ (terminated by ":") */ - if (!HDisalpha(curstr[i]) && '+' != curstr[i] && '-' != curstr[i] && '.' != curstr[i]) + if (!isalpha(curstr[i]) && '+' != curstr[i] && '-' != curstr[i] && '.' != curstr[i]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction"); } @@ -2277,7 +2283,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) } /* end else (IPv4) */ len = tmpstr - curstr; if (len == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HOST substring cannot be empty") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "HOST substring cannot be empty"); else if (len > urllen) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of HOST substring"); @@ -2299,11 +2305,11 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) tmpstr++; len = tmpstr - curstr; if (len == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT element cannot be empty") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT element cannot be empty"); else if (len > urllen) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of PORT substring"); for (i = 0; i < len; i++) - if (!HDisdigit(curstr[i])) + if (!isdigit(curstr[i])) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "PORT is not a decimal string"); /* copy port */ @@ -2349,7 +2355,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) tmpstr++; len = tmpstr - curstr; if (len == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "QUERY cannot be empty") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "QUERY cannot be empty"); else if (len > urllen) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem with length of QUERY substring"); purl->query = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1)); @@ -2366,7 +2372,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) if (ret_value == FAIL) H5FD_s3comms_free_purl(purl); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_s3comms_parse_url() */ /*---------------------------------------------------------------------------- @@ -2404,8 +2410,6 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl) * - FAILURE: `FAIL` * - `c` or `repr` was NULL * - * Programmer: Jacob Smith - * *---------------------------------------------------------------------------- */ herr_t @@ -2422,16 +2426,16 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_percent_encode_char.\n"); + fprintf(stdout, "called H5FD_s3comms_percent_encode_char.\n"); #endif if (repr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination `repr`."); #if S3COMMS_DEBUG H5FD_s3comms_bytes_to_hex((char *)hex, s, 1, FALSE); - HDfprintf(stdout, " CHAR: \'%s\'\n", s); - HDfprintf(stdout, " CHAR-HEX: \"%s\"\n", hex); + fprintf(stdout, " CHAR: \'%s\'\n", s); + fprintf(stdout, " CHAR-HEX: \"%s\"\n", hex); #endif if (c <= (unsigned char)0x7f) { @@ -2439,7 +2443,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr * and single percent-code */ #if S3COMMS_DEBUG - HDfprintf(stdout, " SINGLE-BYTE\n"); + fprintf(stdout, " SINGLE-BYTE\n"); #endif *repr_len = 3; chars_written = HDsnprintf(repr, 4, "%%%02X", c); @@ -2454,7 +2458,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr unsigned int stack_size = 0; unsigned char stack[4] = {0, 0, 0, 0}; #if S3COMMS_DEBUG - HDfprintf(stdout, " MULTI-BYTE\n"); + fprintf(stdout, " MULTI-BYTE\n"); #endif stack_size = 0; k = (unsigned int)c; @@ -2474,13 +2478,13 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr */ #if S3COMMS_DEBUG - HDfprintf(stdout, " STACK:\n {\n"); + fprintf(stdout, " STACK:\n {\n"); for (i = 0; i < stack_size; i++) { H5FD_s3comms_bytes_to_hex((char *)hex, (&stack[i]), 1, FALSE); hex[2] = 0; - HDfprintf(stdout, " %s,\n", hex); + fprintf(stdout, " %s,\n", hex); } - HDfprintf(stdout, " }\n"); + fprintf(stdout, " }\n"); #endif /**************** @@ -2515,7 +2519,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr *(repr + *repr_len) = '\0'; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5FD_s3comms_percent_encode_char */ /*---------------------------------------------------------------------------- @@ -2551,9 +2555,6 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr * - FAILURE: `FAIL` * - if any input arguments was NULL * - * Programmer: Jacob Smith - * 2017-07-13 - * *---------------------------------------------------------------------------- */ herr_t @@ -2570,22 +2571,22 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_signing_key.\n"); + fprintf(stdout, "called H5FD_s3comms_signing_key.\n"); #endif if (md == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Destination `md` cannot be NULL.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Destination `md` cannot be NULL."); if (secret == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`secret` cannot be NULL.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`secret` cannot be NULL."); if (region == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`region` cannot be NULL.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`region` cannot be NULL."); if (iso8601now == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`iso8601now` cannot be NULL.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`iso8601now` cannot be NULL."); AWS4_secret_len = 4 + HDstrlen(secret) + 1; AWS4_secret = (char *)H5MM_malloc(sizeof(char *) * AWS4_secret_len); if (AWS4_secret == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Could not allocate space.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Could not allocate space."); /* prepend "AWS4" to start of the secret key */ ret = HDsnprintf(AWS4_secret, AWS4_secret_len, "%s%s", "AWS4", secret); @@ -2608,7 +2609,7 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi done: H5MM_xfree(AWS4_secret); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD_s3comms_signing_key() */ /*---------------------------------------------------------------------------- @@ -2642,9 +2643,6 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi * - if any of the inputs are NULL * - if an error is encountered while computing checksum * - * Programmer: Jacob Smith - * 2017-07-?? - * *---------------------------------------------------------------------------- */ herr_t @@ -2662,17 +2660,17 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_tostringtosign.\n"); + fprintf(stdout, "called H5FD_s3comms_tostringtosign.\n"); #endif if (dest == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer cannot be null.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination buffer cannot be null."); if (req == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request cannot be null.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "canonical request cannot be null."); if (now == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Timestring cannot be NULL.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Timestring cannot be NULL."); if (region == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Region cannot be NULL.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Region cannot be NULL."); for (i = 0; i < 128; i++) tmp[i] = '\0'; @@ -2684,7 +2682,7 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const day[8] = '\0'; ret = HDsnprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region); if (ret <= 0 || ret >= 127) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem adding day and region to string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem adding day and region to string"); H5MM_memcpy((dest + d), "AWS4-HMAC-SHA256\n", 17); d = 17; @@ -2736,9 +2734,6 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const * - FAILURE: `FAIL` * - `dest == NULL` * - * Programmer: Jacob Smith - * 2017-09-18 - * *---------------------------------------------------------------------------- */ herr_t @@ -2749,11 +2744,11 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written) FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "called H5FD_s3comms_trim.\n"); + fprintf(stdout, "called H5FD_s3comms_trim.\n"); #endif if (dest == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "destination cannot be null."); if (s == NULL) s_len = 0; @@ -2761,7 +2756,7 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written) /* Find first non-whitespace character from start; * reduce total length per character. */ - while ((s_len > 0) && HDisspace((unsigned char)s[0]) && s_len > 0) { + while ((s_len > 0) && isspace((unsigned char)s[0]) && s_len > 0) { s++; s_len--; } @@ -2773,7 +2768,7 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written) if (s_len > 0) { do { s_len--; - } while (HDisspace((unsigned char)s[s_len])); + } while (isspace((unsigned char)s[s_len])); s_len++; /* write output into dest */ @@ -2820,9 +2815,6 @@ H5FD_s3comms_trim(char *dest, char *s, size_t s_len, size_t *n_written) * - source strings `s` or destination `dest` are NULL * - error while attempting to percent-encode a character * - * Programmer: Jacob Smith - * 2017-07-?? - * *---------------------------------------------------------------------------- */ herr_t @@ -2839,7 +2831,7 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hbool_t encode_s FUNC_ENTER_NOAPI_NOINIT #if S3COMMS_DEBUG - HDfprintf(stdout, "H5FD_s3comms_uriencode called.\n"); + fprintf(stdout, "H5FD_s3comms_uriencode called.\n"); #endif if (s == NULL) @@ -2853,8 +2845,7 @@ H5FD_s3comms_uriencode(char *dest, const char *s, size_t s_len, hbool_t encode_s */ for (s_off = 0; s_off < s_len; s_off++) { c = s[s_off]; - if (HDisalnum(c) || c == '.' || c == '-' || c == '_' || c == '~' || - (c == '/' && encode_slash == FALSE)) + if (isalnum(c) || c == '.' || c == '-' || c == '_' || c == '~' || (c == '/' && encode_slash == FALSE)) dest[dest_off++] = c; else { hex_off = 0; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDsec2.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDsec2.c index 0f5266a481..a964a6970c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDsec2.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDsec2.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * * Purpose: The POSIX unbuffered file driver using only the HDF5 public * API and with a few optimizations: the lseek() call is made * only when the current file position is unknown or needs to be @@ -197,9 +193,6 @@ H5FL_DEFINE_STATIC(H5FD_sec2_t); * Return: Success: The driver ID for the sec2 driver * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ hid_t @@ -235,9 +228,6 @@ H5FD_sec2_init(void) * * Returns: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Friday, Jan 30, 2004 - * *--------------------------------------------------------------------------- */ static herr_t @@ -260,9 +250,6 @@ H5FD__sec2_term(void) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, February 19, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -275,7 +262,7 @@ H5Pset_fapl_sec2(hid_t fapl_id) H5TRACE1("e", "i", fapl_id); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); ret_value = H5P_set_driver(plist, H5FD_SEC2, NULL, NULL); @@ -293,9 +280,6 @@ H5Pset_fapl_sec2(hid_t fapl_id) * caller, which is always H5FD_open(). * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -318,11 +302,11 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); if (ADDR_OVERFLOW(maxaddr)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr"); /* Build the open flags */ o_flags = (H5F_ACC_RDWR & flags) ? O_RDWR : O_RDONLY; @@ -347,7 +331,7 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* Create the new file struct */ if (NULL == (file = H5FL_CALLOC(H5FD_sec2_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate file struct"); file->fd = fd; H5_CHECKED_ASSIGN(file->eof, haddr_t, sb.st_size, h5_stat_size_t); @@ -356,10 +340,10 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr #ifdef H5_HAVE_WIN32_API file->hFile = (HANDLE)_get_osfhandle(fd); if (INVALID_HANDLE_VALUE == file->hFile) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file handle"); if (!GetFileInformationByHandle((HANDLE)file->hFile, &fileinfo)) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file information") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to get Windows file information"); file->nFileIndexHigh = fileinfo.nFileIndexHigh; file->nFileIndexLow = fileinfo.nFileIndexLow; @@ -371,7 +355,7 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr /* Get the FAPL */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "not a file access property list"); /* Check the file locking flags in the fapl */ if (ignore_disabled_file_locks_s != FAIL) @@ -380,7 +364,7 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr else { /* Use the value in the property list */ if (H5P_get(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &file->ignore_disabled_file_locks) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get ignore disabled file locks property"); } /* Retain a copy of the name used to open the file, for possible error reporting */ @@ -397,7 +381,7 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr */ if (H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0) if (H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single"); } /* end if */ /* Set return value */ @@ -422,9 +406,6 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr * Return: Success: SUCCEED * Failure: FAIL, file not closed. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -436,7 +417,7 @@ H5FD__sec2_close(H5FD_t *_file) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(file); + assert(file); /* Close the underlying file */ if (HDclose(file->fd) < 0) @@ -459,9 +440,6 @@ H5FD__sec2_close(H5FD_t *_file) * Failure: never fails (arguments were checked by the * caller). * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static int @@ -475,39 +453,39 @@ H5FD__sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) #ifdef H5_HAVE_WIN32_API if (f1->dwVolumeSerialNumber < f2->dwVolumeSerialNumber) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->dwVolumeSerialNumber > f2->dwVolumeSerialNumber) - HGOTO_DONE(1) + HGOTO_DONE(1); if (f1->nFileIndexHigh < f2->nFileIndexHigh) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->nFileIndexHigh > f2->nFileIndexHigh) - HGOTO_DONE(1) + HGOTO_DONE(1); if (f1->nFileIndexLow < f2->nFileIndexLow) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->nFileIndexLow > f2->nFileIndexLow) - HGOTO_DONE(1) + HGOTO_DONE(1); #else /* H5_HAVE_WIN32_API */ #ifdef H5_DEV_T_IS_SCALAR if (f1->device < f2->device) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->device > f2->device) - HGOTO_DONE(1) + HGOTO_DONE(1); #else /* H5_DEV_T_IS_SCALAR */ /* If dev_t isn't a scalar value on this system, just use memcmp to * determine if the values are the same or not. The actual return value * shouldn't really matter... */ - if (HDmemcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0) - HGOTO_DONE(-1) - if (HDmemcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0) - HGOTO_DONE(1) + if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) < 0) + HGOTO_DONE(-1); + if (memcmp(&(f1->device), &(f2->device), sizeof(dev_t)) > 0) + HGOTO_DONE(1); #endif /* H5_DEV_T_IS_SCALAR */ if (f1->inode < f2->inode) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (f1->inode > f2->inode) - HGOTO_DONE(1) + HGOTO_DONE(1); #endif /* H5_HAVE_WIN32_API */ done: @@ -522,9 +500,6 @@ H5FD__sec2_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Friday, August 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -571,9 +546,6 @@ H5FD__sec2_query(const H5FD_t *_file, unsigned long *flags /* out */) * * Return: The end-of-address marker. * - * Programmer: Robb Matzke - * Monday, August 2, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -595,9 +567,6 @@ H5FD__sec2_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Return: SUCCEED (Can't fail) * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -622,9 +591,6 @@ H5FD__sec2_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) * Return: End of file address, the first address past the end of the * "file", either the filesystem file or the HDF5 file. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -644,9 +610,6 @@ H5FD__sec2_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) * * Returns: SUCCEED/FAIL * - * Programmer: Raymond Lu - * Sept. 16, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -658,7 +621,7 @@ H5FD__sec2_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand FUNC_ENTER_PACKAGE if (!file_handle) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file handle not valid"); *file_handle = &(file->fd); @@ -677,9 +640,6 @@ H5FD__sec2_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand * buffer BUF. * Failure: FAIL, Contents of buffer BUF are undefined. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -692,14 +652,14 @@ H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU FUNC_ENTER_PACKAGE - HDassert(file && file->pub.cls); - HDassert(buf); + assert(file && file->pub.cls); + assert(buf); /* Check for overflow conditions */ - if (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) + if (!H5_addr_defined(addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr); if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr); #ifndef H5_HAVE_PREADWRITE /* Seek to the correct location (if we don't have pread) */ @@ -750,12 +710,12 @@ H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if (0 == bytes_read) { /* end of file but not end of format address space */ - HDmemset(buf, 0, size); + memset(buf, 0, size); break; } /* end if */ - HDassert(bytes_read >= 0); - HDassert((size_t)bytes_read <= size); + assert(bytes_read >= 0); + assert((size_t)bytes_read <= size); size -= (size_t)bytes_read; addr += (haddr_t)bytes_read; @@ -785,9 +745,6 @@ H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -800,15 +757,15 @@ H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN FUNC_ENTER_PACKAGE - HDassert(file && file->pub.cls); - HDassert(buf); + assert(file && file->pub.cls); + assert(buf); /* Check for overflow conditions */ - if (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) + if (!H5_addr_defined(addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr); if (REGION_OVERFLOW(addr, size)) HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu", - (unsigned long long)addr, (unsigned long long)size) + (unsigned long long)addr, (unsigned long long)size); #ifndef H5_HAVE_PREADWRITE /* Seek to the correct location (if we don't have pwrite) */ @@ -857,8 +814,8 @@ H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN (unsigned long long)bytes_wrote, (unsigned long long)offset); } /* end if */ - HDassert(bytes_wrote > 0); - HDassert((size_t)bytes_wrote <= size); + assert(bytes_wrote > 0); + assert((size_t)bytes_wrote <= size); size -= (size_t)bytes_wrote; addr += (haddr_t)bytes_wrote; @@ -889,9 +846,6 @@ H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -902,10 +856,10 @@ H5FD__sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); /* Extend the file to make sure it's large enough */ - if (!H5F_addr_eq(file->eoa, file->eof)) { + if (!H5_addr_eq(file->eoa, file->eof)) { #ifdef H5_HAVE_WIN32_API LARGE_INTEGER li; /* 64-bit (union) integer for SetFilePointer() call */ DWORD dwPtrLow; /* Low-order pointer bits from SetFilePointer() @@ -926,12 +880,12 @@ H5FD__sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR if (INVALID_SET_FILE_POINTER == dwPtrLow) { dwError = GetLastError(); if (dwError != NO_ERROR) - HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer") + HGOTO_ERROR(H5E_FILE, H5E_FILEOPEN, FAIL, "unable to set file pointer"); } bError = SetEndOfFile(file->hFile); if (0 == bError) - HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") + HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly"); #else /* H5_HAVE_WIN32_API */ if (-1 == HDftruncate(file->fd, (HDoff_t)file->eoa)) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to extend file properly") @@ -959,8 +913,6 @@ H5FD__sec2_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; May 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -972,7 +924,7 @@ H5FD__sec2_lock(H5FD_t *_file, hbool_t rw) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); /* Set exclusive or shared lock based on rw status */ lock_flags = rw ? LOCK_EX : LOCK_SH; @@ -1000,8 +952,6 @@ H5FD__sec2_lock(H5FD_t *_file, hbool_t rw) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; May 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1012,7 +962,7 @@ H5FD__sec2_unlock(H5FD_t *_file) FUNC_ENTER_PACKAGE - HDassert(file); + assert(file); if (HDflock(file->fd, LOCK_UN) < 0) { if (file->ignore_disabled_file_locks && ENOSYS == errno) { @@ -1045,7 +995,7 @@ H5FD__sec2_delete(const char *filename, hid_t H5_ATTR_UNUSED fapl_id) FUNC_ENTER_PACKAGE - HDassert(filename); + assert(filename); if (HDremove(filename) < 0) HSYS_GOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") @@ -1084,7 +1034,7 @@ H5FD__sec2_ctl(H5FD_t H5_ATTR_UNUSED *_file, uint64_t H5_ATTR_UNUSED op_code, ui /* No op codes are understood. */ if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "unknown op_code and fail if unknown flag is set"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDspace.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDspace.c index 99f4d07263..364a449c1e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDspace.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDspace.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5FDspace.c - * Jan 3 2008 - * Quincey Koziol * * Purpose: Space allocation routines for the file driver code. * @@ -83,9 +80,6 @@ H5FL_DEFINE(H5FD_free_t); * Return: Success: The address of the previous EOA. * Failure: The undefined address HADDR_UNDEF * - * Programmer: Bill Wendling - * Wednesday, 04. December, 2002 - * *------------------------------------------------------------------------- */ static haddr_t @@ -97,17 +91,17 @@ H5FD__extend(H5FD_t *file, H5FD_mem_t type, hsize_t size) FUNC_ENTER_PACKAGE /* check args */ - HDassert(file); - HDassert(file->cls); - HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); - HDassert(size > 0); + assert(file); + assert(file->cls); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); + assert(size > 0); /* Get current end-of-allocated space address */ eoa = file->cls->get_eoa(file, type); /* Check for overflow when extending */ - if (H5F_addr_overflow(eoa, size) || (eoa + size) > file->maxaddr) - HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed") + if (H5_addr_overflow(eoa, size) || (eoa + size) > file->maxaddr) + HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed"); /* Set the [NOT aligned] address to return */ ret_value = eoa; @@ -115,7 +109,7 @@ H5FD__extend(H5FD_t *file, H5FD_mem_t type, hsize_t size) /* Extend the end-of-allocated space address */ eoa += size; if (file->cls->set_eoa(file, type, eoa) < 0) - HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed") + HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "file allocation request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -131,9 +125,6 @@ H5FD__extend(H5FD_t *file, H5FD_mem_t type, hsize_t size) * Return: Success: The format address of the new file memory. * Failure: The undefined address HADDR_UNDEF * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ haddr_t @@ -148,14 +139,14 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr FUNC_ENTER_PACKAGE #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: type = %u, size = %" PRIuHSIZE "\n", __func__, (unsigned)type, size); + fprintf(stderr, "%s: type = %u, size = %" PRIuHSIZE "\n", __func__, (unsigned)type, size); #endif /* H5FD_ALLOC_DEBUG */ /* check args */ - HDassert(file); - HDassert(file->cls); - HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); - HDassert(size > 0); + assert(file); + assert(file->cls); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); + assert(size > 0); /* Check for query driver and call it */ if (file->cls->query) @@ -189,13 +180,13 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr * size */ if (file->cls->alloc) { ret_value = (file->cls->alloc)(file, type, H5CX_get_dxpl(), use_alloc_size ? size : size + extra); - if (!H5F_addr_defined(ret_value)) - HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver allocation request failed") + if (!H5_addr_defined(ret_value)) + HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver allocation request failed"); } /* end if */ else { ret_value = H5FD__extend(file, type, size + extra); - if (!H5F_addr_defined(ret_value)) - HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver eoa update request failed") + if (!H5_addr_defined(ret_value)) + HGOTO_ERROR(H5E_VFL, H5E_NOSPACE, HADDR_UNDEF, "driver eoa update request failed"); } /* end else */ /* Set the [possibly aligned] address to return */ @@ -204,14 +195,14 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr /* Post-condition sanity check */ if (!file->paged_aggr && file->alignment > 1 && orig_size >= file->threshold) - HDassert(!(ret_value % file->alignment)); + assert(!(ret_value % file->alignment)); /* Convert absolute file offset to relative address */ ret_value -= file->base_addr; done: #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: ret_value = %" PRIuHADDR "\n", __func__, ret_value); + fprintf(stderr, "%s: ret_value = %" PRIuHADDR "\n", __func__, ret_value); #endif /* H5FD_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__alloc_real() */ @@ -229,9 +220,6 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr * Return: Success: The format address of the new file memory. * Failure: The undefined address HADDR_UNDEF * - * Programmer: Quincey Koziol - * Friday, August 14, 2009 - * *------------------------------------------------------------------------- */ haddr_t @@ -242,19 +230,19 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, H5F_t *f, hsize_t size, haddr_t *frag_ FUNC_ENTER_NOAPI(HADDR_UNDEF) /* check args */ - HDassert(file); - HDassert(file->cls); - HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); - HDassert(size > 0); + assert(file); + assert(file->cls); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); + assert(size > 0); /* Call the real 'alloc' routine */ ret_value = H5FD__alloc_real(file, type, size, frag_addr, frag_size); - if (!H5F_addr_defined(ret_value)) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "real 'alloc' request failed") + if (!H5_addr_defined(ret_value)) + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, HADDR_UNDEF, "real 'alloc' request failed"); /* Mark EOA info dirty in cache, so change will get encoded */ if (H5F_eoa_dirty(f) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTMARKDIRTY, HADDR_UNDEF, "unable to mark EOA info as dirty") + HGOTO_ERROR(H5E_VFL, H5E_CANTMARKDIRTY, HADDR_UNDEF, "unable to mark EOA info as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -268,9 +256,6 @@ H5FD_alloc(H5FD_t *file, H5FD_mem_t type, H5F_t *f, hsize_t size, haddr_t *frag_ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -281,34 +266,34 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(file); - HDassert(file->cls); - HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); - HDassert(size > 0); + assert(file); + assert(file->cls); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); + assert(size > 0); #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: type = %u, addr = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", __func__, - (unsigned)type, addr, size); + fprintf(stderr, "%s: type = %u, addr = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", __func__, (unsigned)type, + addr, size); #endif /* H5FD_ALLOC_DEBUG */ /* Sanity checking */ - if (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid file offset") + if (!H5_addr_defined(addr)) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid file offset"); /* Convert address to absolute file offset */ addr += file->base_addr; /* More sanity checking */ - if (addr > file->maxaddr || H5F_addr_overflow(addr, size) || (addr + size) > file->maxaddr) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid file free space region to free") + if (addr > file->maxaddr || H5_addr_overflow(addr, size) || (addr + size) > file->maxaddr) + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid file free space region to free"); /* Check for file driver 'free' callback and call it if available */ if (file->cls->free) { #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: Letting VFD free space\n", __func__); + fprintf(stderr, "%s: Letting VFD free space\n", __func__); #endif /* H5FD_ALLOC_DEBUG */ if ((file->cls->free)(file, type, H5CX_get_dxpl(), addr, size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed"); } /* end if */ /* Check if this free block is at the end of file allocated space. * Truncate it if this is true. @@ -318,21 +303,21 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) eoa = file->cls->get_eoa(file, type); #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: eoa = %" PRIuHADDR "\n", __func__, eoa); + fprintf(stderr, "%s: eoa = %" PRIuHADDR "\n", __func__, eoa); #endif /* H5FD_ALLOC_DEBUG */ if (eoa == (addr + size)) { #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: Reducing file size to = %" PRIuHADDR "\n", __func__, addr); + fprintf(stderr, "%s: Reducing file size to = %" PRIuHADDR "\n", __func__, addr); #endif /* H5FD_ALLOC_DEBUG */ if (file->cls->set_eoa(file, type, addr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "set end of space allocation request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "set end of space allocation request failed"); } /* end if */ } /* end else-if */ else { /* leak memory */ #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", - __func__, (unsigned)type, addr, size); + fprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", + __func__, (unsigned)type, addr, size); #endif /* H5FD_ALLOC_DEBUG */ } /* end else */ @@ -353,9 +338,6 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 14, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -366,18 +348,18 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t addr, hsize_t size) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(file); - HDassert(file->cls); - HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); - HDassert(size > 0); + assert(file); + assert(file->cls); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); + assert(size > 0); /* Call the real 'free' routine */ if (H5FD__free_real(file, type, addr, size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "real 'free' request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "real 'free' request failed"); /* Mark EOA info dirty in cache, so change will get encoded */ if (H5F_eoa_dirty(f) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTMARKDIRTY, FAIL, "unable to mark EOA info as dirty") + HGOTO_ERROR(H5E_VFL, H5E_CANTMARKDIRTY, FAIL, "unable to mark EOA info as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -396,9 +378,6 @@ H5FD_free(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t addr, hsize_t size) * FALSE(0) - Block could not be extended * Failure: FAIL * - * Programmer: Quincey Koziol - * Thursday, 17. January, 2008 - * *------------------------------------------------------------------------- */ htri_t @@ -410,31 +389,31 @@ H5FD_try_extend(H5FD_t *file, H5FD_mem_t type, H5F_t *f, haddr_t blk_end, hsize_ FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(file); - HDassert(file->cls); - HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); - HDassert(extra_requested > 0); - HDassert(f); + assert(file); + assert(file->cls); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); + assert(extra_requested > 0); + assert(f); /* Retrieve the end of the address space */ if (HADDR_UNDEF == (eoa = file->cls->get_eoa(file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "driver get_eoa request failed"); /* Adjust block end by base address of the file, to create absolute address */ blk_end += file->base_addr; /* Check if the block is exactly at the end of the file */ - if (H5F_addr_eq(blk_end, eoa)) { + if (H5_addr_eq(blk_end, eoa)) { /* Extend the object by extending the underlying file */ if (HADDR_UNDEF == H5FD__extend(file, type, extra_requested)) - HGOTO_ERROR(H5E_VFL, H5E_CANTEXTEND, FAIL, "driver extend request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTEXTEND, FAIL, "driver extend request failed"); /* Mark EOA info dirty in cache, so change will get encoded */ if (H5F_eoa_dirty(f) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTMARKDIRTY, FAIL, "unable to mark EOA info as dirty") + HGOTO_ERROR(H5E_VFL, H5E_CANTMARKDIRTY, FAIL, "unable to mark EOA info as dirty"); /* Indicate success */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDsplitter.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDsplitter.c index faf5d29ac9..cf893f31e9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDsplitter.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDsplitter.c @@ -81,7 +81,7 @@ typedef struct H5FD_splitter_t { { \ H5FD__splitter_log_error((file), (funcname), (mesg)); \ if (FALSE == (file)->fa.ignore_wo_errs) \ - HGOTO_ERROR((errmajor), (errminor), (ret), (mesg)) \ + HGOTO_ERROR((errmajor), (errminor), (ret), (mesg)); \ } #define H5FD_SPLITTER_DEBUG_OP_CALLS 0 /* debugging print toggle; 0 disables */ @@ -89,8 +89,8 @@ typedef struct H5FD_splitter_t { #if H5FD_SPLITTER_DEBUG_OP_CALLS #define H5FD_SPLITTER_LOG_CALL(name) \ do { \ - HDprintf("called %s()\n", (name)); \ - HDfflush(stdout); \ + printf("called %s()\n", (name)); \ + fflush(stdout); \ } while (0) #else #define H5FD_SPLITTER_LOG_CALL(name) /* no-op */ @@ -253,7 +253,7 @@ H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr) H5FD_SPLITTER_LOG_CALL(__func__); - HDassert(id_out_ptr != NULL); + assert(id_out_ptr != NULL); if (FALSE == H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "not a file access property list"); @@ -267,7 +267,7 @@ H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr) HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, -1, "unable to copy file access property list"); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__copy_plist() */ /*------------------------------------------------------------------------- @@ -292,18 +292,18 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) H5FD_SPLITTER_LOG_CALL(__func__); if (H5FD_SPLITTER_MAGIC != vfd_config->magic) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid configuration (magic number mismatch)") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid configuration (magic number mismatch)"); if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != vfd_config->version) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid config (version number mismatch)") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid config (version number mismatch)"); if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid property list"); info = H5FL_CALLOC(H5FD_splitter_fapl_t); if (NULL == info) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct"); if (H5FD__splitter_populate_config(vfd_config, info) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't setup driver configuration") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't setup driver configuration"); ret_value = H5P_set_driver(plist_ptr, H5FD_SPLITTER, info, NULL); @@ -341,13 +341,13 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/) /* Check arguments */ if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (config == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config pointer is null") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "config pointer is null"); if (H5FD_SPLITTER_MAGIC != config->magic) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (magic number mismatch)") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (magic number mismatch)"); if (H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION != config->version) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (version unsafe)") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "info-out pointer invalid (version unsafe)"); /* Pre-set out FAPL IDs with intent to replace these values */ config->rw_fapl_id = H5I_INVALID_HID; @@ -355,15 +355,15 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/) /* Check and get the splitter fapl */ if (NULL == (plist_ptr = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5FD_SPLITTER != H5P_peek_driver(plist_ptr)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver"); fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr); if (NULL == fapl_ptr) { if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct"); if (H5FD__splitter_populate_config(NULL, default_fapl) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info"); fapl_ptr = default_fapl; } @@ -404,14 +404,14 @@ H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, H5FD_spli FUNC_ENTER_PACKAGE - HDassert(fapl_out); + assert(fapl_out); - HDmemset(fapl_out, 0, sizeof(H5FD_splitter_fapl_t)); + memset(fapl_out, 0, sizeof(H5FD_splitter_fapl_t)); if (!vfd_config) { vfd_config = H5MM_calloc(sizeof(H5FD_splitter_vfd_config_t)); if (NULL == vfd_config) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct"); vfd_config->magic = H5FD_SPLITTER_MAGIC; vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION; @@ -435,16 +435,16 @@ H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, H5FD_spli wo_plist_ptr = (H5P_genplist_t *)H5I_object(vfd_config->wo_fapl_id); if (NULL == wo_plist_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5P_peek(wo_plist_ptr, H5F_ACS_FILE_DRV_NAME, &wo_driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info"); wo_driver = (H5FD_class_t *)H5I_object(wo_driver_prop.driver_id); if (NULL == wo_driver) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver ID in file access property list"); if (H5FD_driver_query(wo_driver, &wo_driver_flags) < 0) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't query VFD flags"); if (0 == (H5FD_FEAT_DEFAULT_VFD_COMPATIBLE & wo_driver_flags)) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unsuitable W/O driver") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unsuitable W/O driver"); } /* end if W/O VFD is non-default */ fapl_out->ignore_wo_errs = vfd_config->ignore_wo_errs; @@ -456,12 +456,12 @@ H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, H5FD_spli fapl_out->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */ if (NULL == (def_plist = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); /* Set non-default channel FAPL IDs in splitter configuration info */ if (H5P_DEFAULT != vfd_config->rw_fapl_id) { if (FALSE == H5P_isa_class(vfd_config->rw_fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); fapl_out->rw_fapl_id = vfd_config->rw_fapl_id; } else { @@ -471,15 +471,15 @@ H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, H5FD_spli * would cause recursion badness. */ if ((fapl_out->rw_fapl_id = H5P_copy_plist(def_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list") + HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list"); if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_out->rw_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5P_set_driver_by_value(plist, H5_VFD_SEC2, NULL, TRUE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on R/W channel FAPL") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on R/W channel FAPL"); } if (H5P_DEFAULT != vfd_config->wo_fapl_id) { if (FALSE == H5P_isa_class(vfd_config->wo_fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access list"); fapl_out->wo_fapl_id = vfd_config->wo_fapl_id; } else { @@ -489,11 +489,11 @@ H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, H5FD_spli * would cause recursion badness. */ if ((fapl_out->wo_fapl_id = H5P_copy_plist(def_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list") + HGOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "can't copy property list"); if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_out->wo_fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5P_set_driver_by_value(plist, H5_VFD_SEC2, NULL, TRUE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on R/W channel FAPL") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default driver on R/W channel FAPL"); } done: @@ -523,13 +523,13 @@ H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len, const ch FUNC_ENTER_PACKAGE - HDassert(new_path); - HDassert(base_filename); + assert(new_path); + assert(base_filename); /* Check that output buffer can hold base filename + `_wo` suffix */ old_filename_len = HDstrlen(base_filename); if (old_filename_len > H5FD_SPLITTER_PATH_MAX - HDstrlen(suffix) - 1) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "filename exceeds max length") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "filename exceeds max length"); /* Determine if filename contains a ".h5" extension. */ if ((file_extension = HDstrstr(base_filename, ".h5"))) { @@ -579,7 +579,7 @@ H5FD__splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closin /* Public API for dxpl "context" */ if (H5FDflush(file->rw_file, dxpl_id, closing) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush R/W file"); if (H5FDflush(file->wo_file, dxpl_id, closing) < 0) H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file") @@ -612,19 +612,19 @@ H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR H5FD_SPLITTER_LOG_CALL(__func__); - HDassert(file && file->pub.cls); - HDassert(buf); + assert(file && file->pub.cls); + assert(buf); /* Check for overflow conditions */ - if (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr) + if (!H5_addr_defined(addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr undefined, addr = %llu", (unsigned long long)addr); if (REGION_OVERFLOW(addr, size)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr) + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr); /* Only read from R/W channel */ /* Public API for dxpl "context" */ if (H5FDread(file->rw_file, type, dxpl_id, addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "Reading from R/W channel failed") + HGOTO_ERROR(H5E_VFL, H5E_READERROR, FAIL, "Reading from R/W channel failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -653,12 +653,12 @@ H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr H5FD_SPLITTER_LOG_CALL(__func__); if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Write to each file */ /* Public API for dxpl "context" */ if (H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "R/W file write failed") + HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "R/W file write failed"); if (H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0) H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file") @@ -713,11 +713,11 @@ H5FD__splitter_fapl_copy(const void *_old_fa) H5FD_SPLITTER_LOG_CALL(__func__); - HDassert(old_fa_ptr); + assert(old_fa_ptr); new_fa_ptr = H5FL_CALLOC(H5FD_splitter_fapl_t); if (NULL == new_fa_ptr) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL"); H5MM_memcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t)); HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1); @@ -758,12 +758,12 @@ H5FD__splitter_fapl_free(void *_fapl) H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ - HDassert(fapl); + assert(fapl); if (H5I_dec_ref(fapl->rw_fapl_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close R/W FAPL ID") + HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close R/W FAPL ID"); if (H5I_dec_ref(fapl->wo_fapl_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close W/O FAPL ID") + HGOTO_ERROR(H5E_VFL, H5E_CANTDEC, FAIL, "can't close W/O FAPL ID"); /* Free the property list */ fapl = H5FL_FREE(H5FD_splitter_fapl_t, fapl); @@ -798,36 +798,36 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name"); if (0 == maxaddr || HADDR_UNDEF == maxaddr) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr"); if (ADDR_OVERFLOW(maxaddr)) - HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr") + HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, NULL, "bogus maxaddr"); if (H5FD_SPLITTER != H5Pget_driver(splitter_fapl_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "driver is not splitter") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "driver is not splitter"); file_ptr = (H5FD_splitter_t *)H5FL_CALLOC(H5FD_splitter_t); if (NULL == file_ptr) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct"); file_ptr->fa.rw_fapl_id = H5I_INVALID_HID; file_ptr->fa.wo_fapl_id = H5I_INVALID_HID; /* Get the driver-specific file access properties */ plist_ptr = (H5P_genplist_t *)H5I_object(splitter_fapl_id); if (NULL == plist_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr); if (NULL == fapl_ptr) { if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file access property list struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file access property list struct"); if (H5FD__splitter_populate_config(NULL, default_fapl) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't initialize driver configuration info") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't initialize driver configuration info"); /* If W/O path is not set, use base filename with '_wo' suffix */ if (*default_fapl->wo_path == '\0') if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, name) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't generate default filename for W/O channel") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, NULL, "can't generate default filename for W/O channel"); fapl_ptr = default_fapl; } @@ -849,15 +849,15 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha */ if (!file_ptr->logfp) { if (file_ptr->fa.log_file_path[0] != '\0') { - file_ptr->logfp = HDfopen(file_ptr->fa.log_file_path, "w"); + file_ptr->logfp = fopen(file_ptr->fa.log_file_path, "w"); if (file_ptr->logfp == NULL) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open log file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open log file"); } /* end if logfile path given */ } /* end if logfile pointer/handle does not exist */ file_ptr->rw_file = H5FD_open(name, flags, fapl_ptr->rw_fapl_id, HADDR_UNDEF); if (!file_ptr->rw_file) - HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open R/W file"); file_ptr->wo_file = H5FD_open(fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF); if (!file_ptr->wo_file) @@ -880,7 +880,7 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha if (file_ptr->wo_file) H5FD_close(file_ptr->wo_file); if (file_ptr->logfp) - HDfclose(file_ptr->logfp); + fclose(file_ptr->logfp); H5FL_FREE(H5FD_splitter_t, file_ptr); } } /* end if error */ @@ -908,23 +908,23 @@ H5FD__splitter_close(H5FD_t *_file) H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ - HDassert(file); + assert(file); if (H5I_dec_ref(file->fa.rw_fapl_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close R/W FAPL") + HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close R/W FAPL"); if (H5I_dec_ref(file->fa.wo_fapl_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close W/O FAPL") + HGOTO_ERROR(H5E_VFL, H5E_ARGS, FAIL, "can't close W/O FAPL"); if (file->rw_file) if (H5FD_close(file->rw_file) == FAIL) - HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close R/W file"); if (file->wo_file) if (H5FD_close(file->wo_file) == FAIL) H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close W/O file") if (file->logfp) { - HDfclose(file->logfp); + fclose(file->logfp); file->logfp = NULL; } @@ -959,11 +959,11 @@ H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); if ((ret_value = H5FD_get_eoa(file->rw_file, type)) == HADDR_UNDEF) - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, HADDR_UNDEF, "unable to get eoa") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, HADDR_UNDEF, "unable to get eoa"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -990,12 +990,12 @@ H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t ad H5FD_SPLITTER_LOG_CALL(__func__) /* Sanity check */ - HDassert(file); - HDassert(file->rw_file); - HDassert(file->wo_file); + assert(file); + assert(file->rw_file); + assert(file->wo_file); if (H5FD_set_eoa(file->rw_file, type, addr) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "H5FDset_eoa failed for R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "H5FDset_eoa failed for R/W file"); if (H5FD_set_eoa(file->wo_file, type, addr) < 0) H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file") @@ -1027,11 +1027,11 @@ H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); if (HADDR_UNDEF == (ret_value = H5FD_get_eof(file->rw_file, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "unable to get eof") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, HADDR_UNDEF, "unable to get eof"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1055,12 +1055,12 @@ H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) H5FD_SPLITTER_LOG_CALL(__func__); - HDassert(file); - HDassert(file->rw_file); - HDassert(file->wo_file); + assert(file); + assert(file->rw_file); + assert(file->wo_file); if (H5FDtruncate(file->rw_file, dxpl_id, closing) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate R/W file"); if (H5FDtruncate(file->wo_file, dxpl_id, closing) < 0) H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file") @@ -1094,8 +1094,8 @@ H5FD__splitter_sb_size(H5FD_t *_file) H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); if (file->rw_file) ret_value = H5FD_sb_size(file->rw_file); @@ -1122,11 +1122,11 @@ H5FD__splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf / H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); if (file->rw_file && H5FD_sb_encode(file->rw_file, name, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTENCODE, FAIL, "unable to encode the superblock in R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTENCODE, FAIL, "unable to encode the superblock in R/W file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1153,11 +1153,11 @@ H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *b H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); if (H5FD_sb_load(file->rw_file, name, buf) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode the superblock in R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTDECODE, FAIL, "unable to decode the superblock in R/W file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1183,8 +1183,8 @@ H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) H5FD_SPLITTER_LOG_CALL(__func__); - HDassert(f1); - HDassert(f2); + assert(f1); + assert(f2); ret_value = H5FD_cmp(f1->rw_file, f2->rw_file); @@ -1211,13 +1211,13 @@ H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_ H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ - HDassert(file); - HDassert(file->rw_file); - HDassert(file_handle); + assert(file); + assert(file->rw_file); + assert(file_handle); /* Only do for R/W channel */ if (H5FD_get_vfd_handle(file->rw_file, file->fa.rw_fapl_id, file_handle) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to get handle of R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to get handle of R/W file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1241,12 +1241,12 @@ H5FD__splitter_lock(H5FD_t *_file, hbool_t rw) H5FD_SPLITTER_LOG_CALL(__func__); - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); /* Place the lock on each file */ if (H5FD_lock(file->rw_file, rw) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock R/W file"); if (file->wo_file != NULL) if (H5FD_lock(file->wo_file, rw) < 0) @@ -1275,16 +1275,16 @@ H5FD__splitter_unlock(H5FD_t *_file) H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); /* Remove the lock on each file */ if (H5FD_unlock(file->rw_file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock R/W file"); if (file->wo_file != NULL) if (H5FD_unlock(file->wo_file) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock W/O file") + HGOTO_ERROR(H5E_VFL, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock W/O file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1320,7 +1320,7 @@ H5FD__splitter_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void * FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(file); + assert(file); switch (op_code) { /* Unknown op code */ @@ -1328,7 +1328,7 @@ H5FD__splitter_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void * if (flags & H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG) { /* Pass ctl call down to R/W channel VFD */ if (H5FDctl(file->rw_file, op_code, flags, input, output) < 0) - HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed") + HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, "VFD ctl request failed"); } else { /* If no valid VFD routing flag is specified, fail for unknown op code @@ -1336,7 +1336,7 @@ H5FD__splitter_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void * */ if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) HGOTO_ERROR(H5E_VFL, H5E_FCNTL, FAIL, - "VFD ctl request failed (unknown op code and fail if unknown flag is set)") + "VFD ctl request failed (unknown op code and fail if unknown flag is set)"); } break; @@ -1366,8 +1366,8 @@ H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */) H5FD_SPLITTER_LOG_CALL(__func__); if (file) { - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); if (H5FDquery(file->rw_file, flags) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTLOCK, FAIL, "unable to query R/W file"); @@ -1403,12 +1403,12 @@ H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); /* Allocate memory for each file, only return the return value for R/W file. */ if ((ret_value = H5FDalloc(file->rw_file, type, dxpl_id, size)) == HADDR_UNDEF) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate for R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate for R/W file"); if (H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF) H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, @@ -1437,12 +1437,12 @@ H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); /* Retrieve memory type mapping for R/W channel only */ if (H5FD_get_fs_type_map(file->rw_file, type_map) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to allocate for R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "unable to allocate for R/W file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1467,11 +1467,11 @@ H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ - HDassert(file); - HDassert(file->rw_file); + assert(file); + assert(file->rw_file); if (H5FDfree(file->rw_file, type, dxpl_id, addr, size) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free for R/W file") + HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free for R/W file"); if (H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0) H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file") @@ -1499,47 +1499,48 @@ H5FD__splitter_delete(const char *filename, hid_t fapl_id) FUNC_ENTER_PACKAGE - HDassert(filename); + assert(filename); /* Get the driver info */ if (H5P_FILE_ACCESS_DEFAULT == fapl_id) { if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t))) - HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct") + HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct"); if (H5FD__splitter_populate_config(NULL, default_fapl) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info"); /* If W/O path is not set, use base filename with '_wo' suffix */ if (*default_fapl->wo_path == '\0') if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, filename) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't generate default filename for W/O channel") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't generate default filename for W/O channel"); fapl_ptr = default_fapl; } else { if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); if (NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist))) { if (NULL == (default_fapl = H5FL_CALLOC(H5FD_splitter_fapl_t))) HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, - "unable to allocate file access property list struct") + "unable to allocate file access property list struct"); if (H5FD__splitter_populate_config(NULL, default_fapl) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't initialize driver configuration info"); /* If W/O path is not set, use base filename with '_wo' suffix */ if (*default_fapl->wo_path == '\0') if (H5FD__splitter_get_default_wo_path(default_fapl->wo_path, H5FD_SPLITTER_PATH_MAX + 1, filename) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't generate default filename for W/O channel") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, + "can't generate default filename for W/O channel"); fapl_ptr = default_fapl; } } if (H5FDdelete(filename, fapl_ptr->rw_fapl_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete file"); if (H5FDdelete(fapl_ptr->wo_path, fapl_ptr->wo_fapl_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete W/O channel file") + HGOTO_ERROR(H5E_VFL, H5E_CANTDELETEFILE, FAIL, "unable to delete W/O channel file"); done: if (default_fapl) @@ -1566,9 +1567,9 @@ H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ - HDassert(file); - HDassert(atfunc && *atfunc); - HDassert(msg && *msg); + assert(file); + assert(atfunc && *atfunc); + assert(msg && *msg); if (file->logfp != NULL) { size_t size; @@ -1580,7 +1581,7 @@ H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const ret_value = FAIL; else if (size < (size_t)HDsnprintf(s, size + 1, "%s: %s\n", atfunc, msg)) ret_value = FAIL; - else if (size != HDfwrite(s, 1, size, file->logfp)) + else if (size != fwrite(s, 1, size, file->logfp)) ret_value = FAIL; H5MM_free(s); } diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDstdio.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDstdio.c index 19f7f41f60..e58315732b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDstdio.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDstdio.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Wednesday, October 22, 1997 - * +/* * Purpose: The C STDIO virtual file driver which only uses calls from stdio.h. * This also serves as an example of coding a simple file driver, * therefore, it should not use any non-public definitions. @@ -21,6 +18,7 @@ * NOTE: This driver is not as well tested as the standard SEC2 driver * and is not intended for production use! */ + #include #include #include @@ -235,9 +233,6 @@ static const H5FD_class_t H5FD_stdio_g = { * * Failure: Negative. * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ hid_t @@ -270,9 +265,6 @@ H5FD_stdio_init(void) * * Returns: Non-negative on success or negative on failure * - * Programmer: Quincey Koziol - * Friday, Jan 30, 2004 - * *--------------------------------------------------------------------------- */ static herr_t @@ -293,9 +285,6 @@ H5FD_stdio_term(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, February 19, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -333,9 +322,6 @@ H5Pset_fapl_stdio(hid_t fapl_id) * * Failure: NULL * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 - * *------------------------------------------------------------------------- */ static H5FD_t * @@ -490,9 +476,6 @@ H5FD_stdio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -523,9 +506,6 @@ H5FD_stdio_close(H5FD_t *_file) * * Failure: never fails (arguments were checked by the caller). * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static int @@ -587,9 +567,6 @@ H5FD_stdio_cmp(const H5FD_t *_f1, const H5FD_t *_f2) * * Failure: negative * - * Programmer: Quincey Koziol - * Friday, August 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -629,9 +606,6 @@ H5FD_stdio_query(const H5FD_t *_f, unsigned long /*OUT*/ *flags) * * Failure: HADDR_UNDEF * - * Programmer: Raymond Lu - * 30 March 2007 - * *------------------------------------------------------------------------- */ static haddr_t @@ -666,9 +640,6 @@ H5FD_stdio_alloc(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp * * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Monday, August 2, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -696,9 +667,6 @@ H5FD_stdio_get_eoa(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type) * * Failure: Does not fail * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -730,9 +698,6 @@ H5FD_stdio_set_eoa(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, haddr_t addr) * * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Thursday, July 29, 1999 - * *------------------------------------------------------------------------- */ static haddr_t @@ -759,9 +724,6 @@ H5FD_stdio_get_eof(const H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type) * * Returns: Non-negative if succeed or negative if fails. * - * Programmer: Raymond Lu - * Sept. 16, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -796,9 +758,6 @@ H5FD_stdio_get_handle(H5FD_t *_file, hid_t /*UNUSED*/ fapl, void **file_handle) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -899,9 +858,6 @@ H5FD_stdio_read(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxpl * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -987,9 +943,6 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t /*UNUSED*/ type, hid_t /*UNUSED*/ dxp * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 22, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -1031,9 +984,6 @@ H5FD_stdio_flush(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t closing) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 31, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1122,8 +1072,6 @@ H5FD_stdio_truncate(H5FD_t *_file, hid_t /*UNUSED*/ dxpl_id, hbool_t /*UNUSED*/ * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; March 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1173,8 +1121,6 @@ H5FD_stdio_lock(H5FD_t *_file, hbool_t rw) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; March 2015 - * *------------------------------------------------------------------------- */ static herr_t diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDtest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDtest.c index 4a907e554f..87d24b64f7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDtest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDtest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -72,8 +71,6 @@ * VFD feature flags (which do not exist until the driver * is instantiated). * - * See test/Makefile.am for a list of the VFD strings. - * * This function is only intended for use in the test code. * * Return: TRUE (1) if the VFD supports SWMR I/O or vfd_name is @@ -83,10 +80,6 @@ * * This function cannot fail at this time so there is no * error return value. - * - * Programmer: Dana Robinson - * Fall 2014 - * *------------------------------------------------------------------------- */ hbool_t diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FDwindows.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FDwindows.c index fa3c05f2af..e38a4d31b6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FDwindows.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FDwindows.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -39,9 +38,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Dana Robinson - * October 10, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -54,7 +50,7 @@ H5Pset_fapl_windows(hid_t fapl_id) H5TRACE1("e", "i", fapl_id); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); ret_value = H5P_set_driver(plist, H5FD_WINDOWS, NULL, NULL); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FL.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FL.c index b524db3283..ec952b7ca5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FL.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FL.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Thursday, March 23, 2000 - * * Purpose: Manage priority queues of free-lists (of blocks of bytes). * These are used in various places in the library which allocate and * free differently blocks of bytes repeatedly. Usually the same size @@ -150,7 +146,7 @@ static int H5FL__fac_term_all(void); H5FL_DEFINE(H5FL_blk_node_t); /* Declare a free list to manage the H5FL_fac_gc_node_t struct */ -H5FL_DEFINE(H5FL_fac_gc_node_t); +H5FL_DEFINE_STATIC(H5FL_fac_gc_node_t); /* Declare a free list to manage the H5FL_fac_head_t struct */ H5FL_DEFINE(H5FL_fac_head_t); @@ -199,9 +195,9 @@ H5FL_term_package(void) /* Dump information about all the outstanding allocations */ while (trk != NULL) { /* Print information about the outstanding block */ - HDfprintf(stderr, "%s: Outstanding allocation:\n", __func__); - HDfprintf(stderr, "\tPtr: %p, File: %s, Function: %s, Line: %d\n", - (((unsigned char *)trk) + sizeof(H5FL_track_t)), trk->file, trk->func, trk->line); + fprintf(stderr, "%s: Outstanding allocation:\n", __func__); + fprintf(stderr, "\tPtr: %p, File: %s, Function: %s, Line: %d\n", + (((unsigned char *)trk) + sizeof(H5FL_track_t)), trk->file, trk->func, trk->line); H5CS_print_stack(trk->stack, stderr); /* Advance to next node */ @@ -222,9 +218,6 @@ H5FL_term_package(void) * Return: Success: non-NULL * Failure: NULL * - * Programmer: Quincey Koziol - * Tuesday, August 1, 2000 - * *------------------------------------------------------------------------- */ static void * @@ -238,11 +231,11 @@ H5FL__malloc(size_t mem_size) if (NULL == (ret_value = H5MM_malloc(mem_size))) { /* If we can't allocate the memory now, try garbage collecting first */ if (H5FL_garbage_coll() < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during allocation") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during allocation"); /* Now try allocating the memory again */ if (NULL == (ret_value = H5MM_malloc(mem_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk"); } /* end if */ done: @@ -258,9 +251,6 @@ H5FL__malloc(size_t mem_size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, March 24, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -273,7 +263,7 @@ H5FL__reg_init(H5FL_reg_head_t *head) /* Allocate a new garbage collection node */ if (NULL == (new_node = (H5FL_reg_gc_node_t *)H5MM_malloc(sizeof(H5FL_reg_gc_node_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize the new garbage collection node */ new_node->list = head; @@ -305,9 +295,6 @@ H5FL__reg_init(H5FL_reg_head_t *head) * * Return: Always returns NULL * - * Programmer: Quincey Koziol - * Friday, March 24, 2000 - * *------------------------------------------------------------------------- */ void * @@ -320,8 +307,8 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj) FUNC_ENTER_NOAPI_NOINIT /* Double check parameters */ - HDassert(head); - HDassert(obj); + assert(head); + assert(obj); #ifdef H5FL_TRACK { @@ -350,11 +337,11 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj) #endif /* H5FL_TRACK */ #ifdef H5FL_DEBUG - HDmemset(obj, 255, head->size); + memset(obj, 255, head->size); #endif /* H5FL_DEBUG */ /* Make certain that the free list is initialized */ - HDassert(head->init); + assert(head->init); /* Link into the free list */ ((H5FL_reg_node_t *)obj)->next = head->list; @@ -372,12 +359,12 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj) /* First check this particular list */ if (head->onlist * head->size > H5FL_reg_lst_mem_lim) if (H5FL__reg_gc_list(head) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free"); /* Then check the global amount memory on regular free lists */ if (H5FL_reg_gc_head.mem_freed > H5FL_reg_glb_mem_lim) if (H5FL__reg_gc() < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -391,9 +378,6 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj) * Return: Success: Pointer to a valid object * Failure: NULL * - * Programmer: Quincey Koziol - * Friday, March 24, 2000 - * *------------------------------------------------------------------------- */ void * @@ -404,12 +388,12 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) FUNC_ENTER_NOAPI(NULL) /* Double check parameters */ - HDassert(head); + assert(head); /* Make certain the list is initialized first */ if (!head->init) if (H5FL__reg_init(head) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks"); /* Check for nodes available on the free list first */ if (head->list != NULL) { @@ -428,7 +412,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) /* Otherwise allocate a node */ else { if (NULL == (ret_value = H5FL__malloc(head->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Increment the number of blocks allocated in list */ head->allocated++; @@ -437,7 +421,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) #ifdef H5FL_TRACK /* Copy allocation location information */ ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); - HDassert(((H5FL_track_t *)ret_value)->stack); + assert(((H5FL_track_t *)ret_value)->stack); /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) * there's no need to duplicate them. */ @@ -468,9 +452,6 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) * Return: Success: Pointer to a valid object * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, December 23, 2002 - * *------------------------------------------------------------------------- */ void * @@ -481,15 +462,15 @@ H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) FUNC_ENTER_NOAPI(NULL) /* Double check parameters */ - HDassert(head); + assert(head); /* Allocate the block */ if (NULL == (ret_value = H5FL_reg_malloc(head H5FL_TRACK_INFO_INT))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Clear to zeros */ /* (Accommodate tracking information, if present) */ - HDmemset(ret_value, 0, head->size - H5FL_TRACK_SIZE); + memset(ret_value, 0, head->size - H5FL_TRACK_SIZE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -503,9 +484,6 @@ H5FL_reg_calloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, July 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -551,9 +529,6 @@ H5FL__reg_gc_list(H5FL_reg_head_t *head) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, March 24, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -569,14 +544,14 @@ H5FL__reg_gc(void) while (gc_node != NULL) { /* Release the free nodes on the list */ if (H5FL__reg_gc_list(gc_node->list) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed"); /* Go on to the next free list to garbage collect */ gc_node = gc_node->next; } /* end while */ /* Double check that all the memory on the free lists is recycled */ - HDassert(H5FL_reg_gc_head.mem_freed == 0); + assert(H5FL_reg_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) @@ -600,7 +575,6 @@ H5FL__reg_gc(void) Can't report errors... EXAMPLES REVISION LOG - Robb Matzke, 2000-04-25 If a list cannot be freed because something is using it then return zero (failure to free a list doesn't affect any other part of the library). If some other layer frees something during its termination @@ -623,8 +597,8 @@ H5FL__reg_term(void) tmp = H5FL_reg_gc_head.first->next; #ifdef H5FL_DEBUG - HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_reg_gc_head.first->list->name, - (int)H5FL_reg_gc_head.first->list->allocated); + printf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_reg_gc_head.first->list->name, + (int)H5FL_reg_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ if (H5FL_reg_gc_head.first->list->allocated > 0) { @@ -662,9 +636,6 @@ H5FL__reg_term(void) * * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, March 23, 2000 - * *------------------------------------------------------------------------- */ static H5FL_blk_node_t * @@ -720,9 +691,6 @@ H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size) * * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, March 23, 2000 - * *------------------------------------------------------------------------- */ static H5FL_blk_node_t * @@ -734,7 +702,7 @@ H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size) /* Allocate room for the new free list node */ if (NULL == (ret_value = H5FL_CALLOC(H5FL_blk_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for chunk info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for chunk info"); /* Set the correct values for the new free list */ ret_value->size = size; @@ -761,9 +729,6 @@ H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, March 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -776,7 +741,7 @@ H5FL__blk_init(H5FL_blk_head_t *head) /* Allocate a new garbage collection node */ if (NULL == (new_node = (H5FL_blk_gc_node_t *)H5MM_malloc(sizeof(H5FL_blk_gc_node_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize the new garbage collection node */ new_node->pq = head; @@ -801,9 +766,6 @@ H5FL__blk_init(H5FL_blk_head_t *head) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, December 16, 2002 - * *------------------------------------------------------------------------- */ htri_t @@ -815,7 +777,7 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ - HDassert(head); + assert(head); /* check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ @@ -838,9 +800,6 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) * * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, March 23, 2000 - * *------------------------------------------------------------------------- */ void * @@ -853,13 +812,13 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) FUNC_ENTER_NOAPI(NULL) /* Double check parameters */ - HDassert(head); - HDassert(size); + assert(head); + assert(size); /* Make certain the list is initialized first */ if (!head->init) if (H5FL__blk_init(head) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list"); /* check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ @@ -882,12 +841,12 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) if (NULL == free_list) /* Create a new list node and insert it to the queue */ free_list = H5FL__blk_create_list(&(head->head), size); - HDassert(free_list); + assert(free_list); /* Allocate new node, with room for the page info header and the actual page data */ if (NULL == (temp = (H5FL_blk_list_t *)H5FL__malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk"); /* Increment the number of blocks of this size */ free_list->allocated++; @@ -905,7 +864,7 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) #ifdef H5FL_TRACK /* Copy allocation location information */ ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); - HDassert(((H5FL_track_t *)ret_value)->stack); + assert(((H5FL_track_t *)ret_value)->stack); /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) * there's no need to duplicate them. */ @@ -940,9 +899,6 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) * * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, December 23, 2002 - * *------------------------------------------------------------------------- */ void * @@ -953,15 +909,15 @@ H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) FUNC_ENTER_NOAPI(NULL) /* Double check parameters */ - HDassert(head); - HDassert(size); + assert(head); + assert(size); /* Allocate the block */ if (NULL == (ret_value = H5FL_blk_malloc(head, size H5FL_TRACK_INFO_INT))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Clear the block to zeros */ - HDmemset(ret_value, 0, size); + memset(ret_value, 0, size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -978,9 +934,6 @@ H5FL_blk_calloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) * * Failure: never fails * - * Programmer: Quincey Koziol - * Thursday, March 23, 2000 - * *------------------------------------------------------------------------- */ void * @@ -996,15 +949,15 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) FUNC_ENTER_NOAPI_NOINIT /* Double check parameters */ - HDassert(head); - HDassert(block); + assert(head); + assert(block); #ifdef H5FL_TRACK { unsigned char *block_ptr = ((unsigned char *)block) - sizeof(H5FL_track_t); H5FL_track_t trk; - HDmemcpy(&trk, block_ptr, sizeof(H5FL_track_t)); + memcpy(&trk, block_ptr, sizeof(H5FL_track_t)); /* Free tracking information about the allocation location */ H5CS_close_stack(trk.stack); @@ -1026,7 +979,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) trk.next->prev = trk.prev; } /* end else */ - HDmemcpy(block_ptr, &trk, sizeof(H5FL_track_t)); + memcpy(block_ptr, &trk, sizeof(H5FL_track_t)); } #endif /* H5FL_TRACK */ @@ -1040,7 +993,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) free_size = temp->size; #ifdef H5FL_DEBUG - HDmemset(temp, 255, free_size + sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE); + memset(temp, 255, free_size + sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE); #endif /* H5FL_DEBUG */ /* Check if there is a free list for native blocks of this size */ @@ -1048,7 +1001,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) /* No free list available, create a new list node and insert it to the queue */ free_list = H5FL__blk_create_list(&(head->head), free_size); if (NULL == free_list) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't create new list node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "couldn't create new list node"); /* Prepend the free'd native block to the front of the free list */ temp->next = free_list->list; /* Note: Overwrites the size field in union */ @@ -1066,12 +1019,12 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) /* First check this particular list */ if (head->list_mem > H5FL_blk_lst_mem_lim) if (H5FL__blk_gc_list(head) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free"); /* Then check the global amount memory on block free lists */ if (H5FL_blk_gc_head.mem_freed > H5FL_blk_glb_mem_lim) if (H5FL__blk_gc() < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1087,9 +1040,6 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) * * Failure: never fails * - * Programmer: Quincey Koziol - * Thursday, March 23, 2000 - * *------------------------------------------------------------------------- */ void * @@ -1100,8 +1050,8 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ FUNC_ENTER_NOAPI(NULL) /* Double check parameters */ - HDassert(head); - HDassert(new_size); + assert(head); + assert(new_size); /* Check if we are actually re-allocating a block */ if (block != NULL) { @@ -1118,7 +1068,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ size_t blk_size; /* Temporary block size */ if ((ret_value = H5FL_blk_malloc(head, new_size H5FL_TRACK_INFO_INT)) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block"); blk_size = MIN(new_size, temp->size); H5MM_memcpy(ret_value, block, blk_size); H5FL_blk_free(head, block); @@ -1129,7 +1079,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ unsigned char *block_ptr = ((unsigned char *)block) - sizeof(H5FL_track_t); H5FL_track_t trk; - HDmemcpy(&trk, block_ptr, sizeof(H5FL_track_t)); + memcpy(&trk, block_ptr, sizeof(H5FL_track_t)); /* Release previous tracking information */ H5CS_close_stack(trk.stack); @@ -1141,7 +1091,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ /* Store new tracking information */ trk.stack = H5CS_copy_stack(); - HDassert(trk.stack); + assert(trk.stack); /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) * there's no need to duplicate them. */ @@ -1149,7 +1099,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ trk.func = call_func; trk.line = call_line; - HDmemcpy(block_ptr, &trk, sizeof(H5FL_track_t)); + memcpy(block_ptr, &trk, sizeof(H5FL_track_t)); } #endif /* H5FL_TRACK */ ret_value = block; @@ -1171,9 +1121,6 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, March 23, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -1190,7 +1137,7 @@ H5FL__blk_gc_list(H5FL_blk_head_t *head) H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */ /* Sanity check */ - HDassert((blk_head->onlist && blk_head->list) || (0 == blk_head->onlist && NULL == blk_head->list)); + assert((blk_head->onlist && blk_head->list) || (0 == blk_head->onlist && NULL == blk_head->list)); /* Loop through all the blocks in the free list, freeing them */ list = blk_head->list; @@ -1246,7 +1193,7 @@ H5FL__blk_gc_list(H5FL_blk_head_t *head) head->onlist = 0; /* Double check that all the memory on this list is recycled */ - HDassert(0 == head->list_mem); + assert(0 == head->list_mem); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FL__blk_gc_list() */ @@ -1259,9 +1206,6 @@ H5FL__blk_gc_list(H5FL_blk_head_t *head) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, March 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -1277,14 +1221,14 @@ H5FL__blk_gc(void) while (gc_node != NULL) { /* For each free list being garbage collected, walk through the nodes and free them */ if (H5FL__blk_gc_list(gc_node->pq) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed"); /* Go on to the next free list to garbage collect */ gc_node = gc_node->next; } /* end while */ /* Double check that all the memory on the free lists are recycled */ - HDassert(H5FL_blk_gc_head.mem_freed == 0); + assert(H5FL_blk_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1324,8 +1268,8 @@ H5FL__blk_term(void) tmp = H5FL_blk_gc_head.first->next; #ifdef H5FL_DEBUG - HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_blk_gc_head.first->pq->name, - (int)H5FL_blk_gc_head.first->pq->allocated); + printf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_blk_gc_head.first->pq->name, + (int)H5FL_blk_gc_head.first->pq->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ @@ -1361,9 +1305,6 @@ H5FL__blk_term(void) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, March 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -1377,7 +1318,7 @@ H5FL__arr_init(H5FL_arr_head_t *head) /* Allocate a new garbage collection node */ if (NULL == (new_node = (H5FL_gc_arr_node_t *)H5MM_malloc(sizeof(H5FL_gc_arr_node_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize the new garbage collection node */ new_node->list = head; @@ -1389,7 +1330,7 @@ H5FL__arr_init(H5FL_arr_head_t *head) /* Allocate room for the free lists */ if (NULL == (head->list_arr = (H5FL_arr_node_t *)H5MM_calloc((size_t)head->maxelem * sizeof(H5FL_arr_node_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize the size of each array */ for (u = 0; u < (size_t)head->maxelem; u++) @@ -1410,9 +1351,6 @@ H5FL__arr_init(H5FL_arr_head_t *head) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, March 24, 2000 - * *------------------------------------------------------------------------- */ void * @@ -1429,20 +1367,20 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) /* The H5MM_xfree code allows obj to null */ if (!obj) - HGOTO_DONE(NULL) + HGOTO_DONE(NULL); /* Double check parameters */ - HDassert(head); + assert(head); /* Make certain that the free list is initialized */ - HDassert(head->init); + assert(head->init); #ifdef H5FL_TRACK { unsigned char *block_ptr = ((unsigned char *)obj) - sizeof(H5FL_track_t); H5FL_track_t trk; - HDmemcpy(&trk, block_ptr, sizeof(H5FL_track_t)); + memcpy(&trk, block_ptr, sizeof(H5FL_track_t)); /* Free tracking information about the allocation location */ H5CS_close_stack(trk.stack); @@ -1464,7 +1402,7 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) trk.next->prev = trk.prev; } /* end else */ - HDmemcpy(block_ptr, &trk, sizeof(H5FL_track_t)); + memcpy(block_ptr, &trk, sizeof(H5FL_track_t)); } #endif @@ -1478,7 +1416,7 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) free_nelem = temp->nelem; /* Double-check that there is enough room for arrays of this size */ - HDassert((int)free_nelem <= head->maxelem); + assert((int)free_nelem <= head->maxelem); /* Link into the free list */ temp->next = head->list_arr[free_nelem].list; @@ -1500,12 +1438,12 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) /* First check this particular list */ if (head->list_mem > H5FL_arr_lst_mem_lim) if (H5FL__arr_gc_list(head) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free"); /* Then check the global amount memory on array free lists */ if (H5FL_arr_gc_head.mem_freed > H5FL_arr_glb_mem_lim) if (H5FL__arr_gc() < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1519,9 +1457,6 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj) * Return: Success: Pointer to a valid array object * Failure: NULL * - * Programmer: Quincey Koziol - * Saturday, March 25, 2000 - * *------------------------------------------------------------------------- */ void * @@ -1534,16 +1469,16 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) FUNC_ENTER_NOAPI(NULL) /* Double check parameters */ - HDassert(head); - HDassert(elem); + assert(head); + assert(elem); /* Make certain the list is initialized first */ if (!head->init) if (H5FL__arr_init(head) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks"); /* Sanity check that the number of elements is supported */ - HDassert(elem <= (unsigned)head->maxelem); + assert(elem <= (unsigned)head->maxelem); /* Get the set of the memory block */ mem_size = head->list_arr[elem].size; @@ -1568,7 +1503,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) else { if (NULL == (new_obj = (H5FL_arr_list_t *)H5FL__malloc(sizeof(H5FL_arr_list_t) + H5FL_TRACK_SIZE + mem_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Increment the number of blocks of this size */ head->list_arr[elem].allocated++; @@ -1586,7 +1521,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) #ifdef H5FL_TRACK /* Copy allocation location information */ ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); - HDassert(((H5FL_track_t *)ret_value)->stack); + assert(((H5FL_track_t *)ret_value)->stack); /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) * there's no need to duplicate them. */ @@ -1617,9 +1552,6 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) * Return: Success: Pointer to a valid array object * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, December 23, 2002 - * *------------------------------------------------------------------------- */ void * @@ -1630,15 +1562,15 @@ H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) FUNC_ENTER_NOAPI(NULL) /* Double check parameters */ - HDassert(head); - HDassert(elem); + assert(head); + assert(elem); /* Allocate the array */ if (NULL == (ret_value = H5FL_arr_malloc(head, elem H5FL_TRACK_INFO_INT))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Clear to zeros */ - HDmemset(ret_value, 0, head->list_arr[elem].size); + memset(ret_value, 0, head->list_arr[elem].size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1652,9 +1584,6 @@ H5FL_arr_calloc(H5FL_arr_head_t *head, size_t elem H5FL_TRACK_PARAMS) * Return: Success: Pointer to a valid array object * Failure: NULL * - * Programmer: Quincey Koziol - * Saturday, March 25, 2000 - * *------------------------------------------------------------------------- */ void * @@ -1665,8 +1594,8 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ - HDassert(head); - HDassert(new_elem); + assert(head); + assert(new_elem); /* Check if we are really allocating the object */ if (obj == NULL) @@ -1675,7 +1604,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA H5FL_arr_list_t *temp; /* Temp. ptr to the new free list node allocated */ /* Sanity check that the number of elements is supported */ - HDassert((int)new_elem <= head->maxelem); + assert((int)new_elem <= head->maxelem); /* Get the pointer to the info header in front of the block to free */ temp = (H5FL_arr_list_t *)(( @@ -1702,7 +1631,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA unsigned char *block_ptr = ((unsigned char *)obj) - sizeof(H5FL_track_t); H5FL_track_t trk; - HDmemcpy(&trk, block_ptr, sizeof(H5FL_track_t)); + memcpy(&trk, block_ptr, sizeof(H5FL_track_t)); /* Release previous tracking information */ H5CS_close_stack(trk.stack); @@ -1714,7 +1643,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA /* Store new tracking information */ trk.stack = H5CS_copy_stack(); - HDassert(trk.stack); + assert(trk.stack); /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) * there's no need to duplicate them. */ @@ -1722,7 +1651,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA trk.func = call_func; trk.line = call_line; - HDmemcpy(block_ptr, &trk, sizeof(H5FL_track_t)); + memcpy(block_ptr, &trk, sizeof(H5FL_track_t)); #endif ret_value = obj; } @@ -1739,9 +1668,6 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, July 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -1788,7 +1714,7 @@ H5FL__arr_gc_list(H5FL_arr_head_t *head) } /* end for */ /* Double check that all the memory on this list is recycled */ - HDassert(head->list_mem == 0); + assert(head->list_mem == 0); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FL__arr_gc_list() */ @@ -1801,9 +1727,6 @@ H5FL__arr_gc_list(H5FL_arr_head_t *head) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, March 25, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -1819,14 +1742,14 @@ H5FL__arr_gc(void) while (gc_arr_node != NULL) { /* Release the free nodes on the list */ if (H5FL__arr_gc_list(gc_arr_node->list) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed"); /* Go on to the next free list to garbage collect */ gc_arr_node = gc_arr_node->next; } /* end while */ /* Double check that all the memory on the free lists are recycled */ - HDassert(H5FL_arr_gc_head.mem_freed == 0); + assert(H5FL_arr_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1867,8 +1790,8 @@ H5FL__arr_term(void) /* Check if the list has allocations outstanding */ #ifdef H5FL_DEBUG - HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_arr_gc_head.first->list->name, - (int)H5FL_arr_gc_head.first->list->allocated); + printf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_arr_gc_head.first->list->name, + (int)H5FL_arr_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ if (H5FL_arr_gc_head.first->list->allocated > 0) { /* Add free list to the list of nodes with allocations open still */ @@ -1904,9 +1827,6 @@ H5FL__arr_term(void) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, April 3, 2004 - * *------------------------------------------------------------------------- */ void * @@ -1917,11 +1837,11 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Double check parameters */ - HDassert(head); - HDassert(obj); + assert(head); + assert(obj); /* Make certain that the free list is initialized */ - HDassert(head->queue.init); + assert(head->queue.init); /* Use block routine */ H5FL_blk_free(&(head->queue), obj); @@ -1937,9 +1857,6 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj) * Return: Success: Pointer to a valid sequence object * Failure: NULL * - * Programmer: Quincey Koziol - * Saturday, April 3, 2004 - * *------------------------------------------------------------------------- */ void * @@ -1950,8 +1867,8 @@ H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ - HDassert(head); - HDassert(elem); + assert(head); + assert(elem); /* Use block routine */ ret_value = H5FL_blk_malloc(&(head->queue), head->size * elem H5FL_TRACK_INFO_INT); @@ -1967,9 +1884,6 @@ H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) * Return: Success: Pointer to a valid array object * Failure: NULL * - * Programmer: Quincey Koziol - * Saturday, April 3, 2004 - * *------------------------------------------------------------------------- */ void * @@ -1980,8 +1894,8 @@ H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ - HDassert(head); - HDassert(elem); + assert(head); + assert(elem); /* Use block routine */ ret_value = H5FL_blk_calloc(&(head->queue), head->size * elem H5FL_TRACK_INFO_INT); @@ -1997,9 +1911,6 @@ H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) * Return: Success: Pointer to a valid sequence object * Failure: NULL * - * Programmer: Quincey Koziol - * Saturday, April 3, 2004 - * *------------------------------------------------------------------------- */ void * @@ -2010,8 +1921,8 @@ H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA FUNC_ENTER_NOAPI_NOERR /* Double check parameters */ - HDassert(head); - HDassert(new_elem); + assert(head); + assert(new_elem); /* Use block routine */ ret_value = H5FL_blk_realloc(&(head->queue), obj, head->size * new_elem H5FL_TRACK_INFO_INT); @@ -2027,9 +1938,6 @@ H5FL_seq_realloc(H5FL_seq_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA * Return: Success: Pointer to factory object * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, February 2, 2005 - * *------------------------------------------------------------------------- */ H5FL_fac_head_t * @@ -2042,18 +1950,18 @@ H5FL_fac_init(size_t size) FUNC_ENTER_NOAPI(NULL) /* Sanity check */ - HDassert(size > 0); + assert(size > 0); /* Allocate room for the new factory */ if (NULL == (factory = (H5FL_fac_head_t *)H5FL_CALLOC(H5FL_fac_head_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for factory object") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for factory object"); /* Set size of blocks for factory */ factory->size = size; /* Allocate a new garbage collection node */ if (NULL == (new_node = (H5FL_fac_gc_node_t *)H5FL_MALLOC(H5FL_fac_gc_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Initialize the new garbage collection node */ new_node->list = factory; @@ -2098,9 +2006,6 @@ H5FL_fac_init(size_t size) * * Return: NULL * - * Programmer: Quincey Koziol - * Wednesday, February 2, 2005 - * *------------------------------------------------------------------------- */ void * @@ -2112,8 +2017,8 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj) FUNC_ENTER_NOAPI_NOINIT /* Double check parameters */ - HDassert(head); - HDassert(obj); + assert(head); + assert(obj); #ifdef H5FL_TRACK { @@ -2142,11 +2047,11 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj) #endif /* H5FL_TRACK */ #ifdef H5FL_DEBUG - HDmemset(obj, 255, head->size); + memset(obj, 255, head->size); #endif /* H5FL_DEBUG */ /* Make certain that the free list is initialized */ - HDassert(head->init); + assert(head->init); /* Link into the free list */ ((H5FL_fac_node_t *)obj)->next = head->list; @@ -2164,12 +2069,12 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj) /* First check this particular list */ if (head->onlist * head->size > H5FL_fac_lst_mem_lim) if (H5FL__fac_gc_list(head) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free"); /* Then check the global amount memory on factory free lists */ if (H5FL_fac_gc_head.mem_freed > H5FL_fac_glb_mem_lim) if (H5FL__fac_gc() < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, NULL, "garbage collection failed during free"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2183,9 +2088,6 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj) * Return: Success: Pointer to a valid sequence object * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, February 2, 2005 - * *------------------------------------------------------------------------- */ void * @@ -2197,8 +2099,8 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) FUNC_ENTER_NOAPI_NOINIT /* Double check parameters */ - HDassert(head); - HDassert(head->init); + assert(head); + assert(head->init); /* Check for nodes available on the free list first */ if (head->list != NULL) { @@ -2217,7 +2119,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) /* Otherwise allocate a node */ else { if (NULL == (ret_value = H5FL__malloc(head->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Increment the number of blocks allocated in list */ head->allocated++; @@ -2226,7 +2128,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) #ifdef H5FL_TRACK /* Copy allocation location information */ ((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack(); - HDassert(((H5FL_track_t *)ret_value)->stack); + assert(((H5FL_track_t *)ret_value)->stack); /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler) * there's no need to duplicate them. */ @@ -2257,9 +2159,6 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) * Return: Success: Pointer to a valid array object * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, February 2, 2005 - * *------------------------------------------------------------------------- */ void * @@ -2271,15 +2170,15 @@ H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) FUNC_ENTER_NOAPI_NOINIT /* Double check parameters */ - HDassert(head); + assert(head); /* Allocate the block */ if (NULL == (ret_value = H5FL_fac_malloc(head H5FL_TRACK_INFO_INT))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Clear to zeros */ /* (Accommodate tracking information, if present) */ - HDmemset(ret_value, 0, head->size - H5FL_TRACK_SIZE); + memset(ret_value, 0, head->size - H5FL_TRACK_SIZE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2293,9 +2192,6 @@ H5FL_fac_calloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Friday, December 19, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -2341,9 +2237,6 @@ H5FL__fac_gc_list(H5FL_fac_head_t *head) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Friday, December 19, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -2359,14 +2252,14 @@ H5FL__fac_gc(void) while (gc_node != NULL) { /* Release the free nodes on the list */ if (H5FL__fac_gc_list(gc_node->list) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of list failed"); /* Go on to the next free list to garbage collect */ gc_node = gc_node->next; } /* end while */ /* Double check that all the memory on the free lists is recycled */ - HDassert(H5FL_fac_gc_head.mem_freed == 0); + assert(H5FL_fac_gc_head.mem_freed == 0); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2380,9 +2273,6 @@ H5FL__fac_gc(void) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Wednesday, February 2, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -2395,22 +2285,22 @@ H5FL_fac_term(H5FL_fac_head_t *factory) FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(factory); + assert(factory); /* Garbage collect all the blocks in the factory's free list */ if (H5FL__fac_gc_list(factory) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of factory failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "garbage collection of factory failed"); /* Verify that all the blocks have been freed */ if (factory->allocated > 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "factory still has objects allocated") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "factory still has objects allocated"); /* Unlink block free list for factory from global free list */ if (factory->prev_gc) { H5FL_fac_gc_node_t *last = factory->prev_gc; /* Garbage collection node before the one being removed */ - HDassert(last->next->list == factory); + assert(last->next->list == factory); tmp = last->next->next; last->next = H5FL_FREE(H5FL_fac_gc_node_t, last->next); last->next = tmp; @@ -2418,7 +2308,7 @@ H5FL_fac_term(H5FL_fac_head_t *factory) tmp->list->prev_gc = last; } else { - HDassert(H5FL_fac_gc_head.first->list == factory); + assert(H5FL_fac_gc_head.first->list == factory); tmp = H5FL_fac_gc_head.first->next; H5FL_fac_gc_head.first = H5FL_FREE(H5FL_fac_gc_node_t, H5FL_fac_gc_head.first); H5FL_fac_gc_head.first = tmp; @@ -2441,9 +2331,6 @@ H5FL_fac_term(H5FL_fac_head_t *factory) * Return: 0. There should never be any outstanding allocations * when this is called. * - * Programmer: Neil Fortner - * Friday, December 19, 2008 - * *------------------------------------------------------------------------- */ static int @@ -2458,12 +2345,12 @@ H5FL__fac_term_all(void) tmp = H5FL_fac_gc_head.first->next; #ifdef H5FL_DEBUG - HDprintf("%s: head->size = %d, head->allocated = %d\n", __func__, - (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated); + printf("%s: head->size = %d, head->allocated = %d\n", __func__, + (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ /* The list cannot have any allocations outstanding */ - HDassert(H5FL_fac_gc_head.first->list->allocated == 0); + assert(H5FL_fac_gc_head.first->list->allocated == 0); /* Reset the "initialized" flag, in case we restart this list somehow (I don't know how..) */ H5FL_fac_gc_head.first->list->init = FALSE; @@ -2485,9 +2372,6 @@ H5FL__fac_term_all(void) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, March 24, 2000 - * *------------------------------------------------------------------------- */ herr_t @@ -2499,19 +2383,19 @@ H5FL_garbage_coll(void) /* Garbage collect the free lists for array objects */ if (H5FL__arr_gc() < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect array objects") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect array objects"); /* Garbage collect free lists for blocks */ if (H5FL__blk_gc() < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect block objects") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect block objects"); /* Garbage collect the free lists for regular objects */ if (H5FL__reg_gc() < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect regular objects") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect regular objects"); /* Garbage collect the free lists for factory objects */ if (H5FL__fac_gc() < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect factory objects") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGC, FAIL, "can't garbage collect factory objects"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2539,9 +2423,6 @@ H5FL_garbage_coll(void) * * Failure: negative * - * Programmer: Quincey Koziol - * Wednesday, August 2, 2000 - * *------------------------------------------------------------------------- */ herr_t @@ -2590,9 +2471,6 @@ H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_l * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, March 6, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -2611,7 +2489,7 @@ H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, s H5FL_reg_head_t *reg_list = gc_node->list; /* Head of list */ /* Sanity check */ - HDassert(reg_list->init); + assert(reg_list->init); /* Add the amount of memory for this list */ *reg_size += (reg_list->size * reg_list->allocated); @@ -2632,7 +2510,7 @@ H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, s H5FL_arr_head_t *head = gc_arr_node->list; /* Head of array list elements */ /* Sanity check */ - HDassert(head->init); + assert(head->init); /* Check for any allocated elements in this list */ if (head->allocated > 0) { diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FO.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FO.c index 1e775997fb..8a8f4d58e6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FO.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FO.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -74,12 +73,12 @@ H5FO_create(const H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Create container used to store open object info */ if ((f->shared->open_objs = H5SL_create(H5SL_TYPE_HADDR, NULL)) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create open object container") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create open object container"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -114,15 +113,15 @@ H5FO_opened(const H5F_t *f, haddr_t addr) FUNC_ENTER_NOAPI_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->open_objs); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->shared); + assert(f->shared->open_objs); + assert(H5_addr_defined(addr)); /* Get the object node from the container */ if (NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr))) { ret_value = open_obj->obj; - HDassert(ret_value != NULL); + assert(ret_value != NULL); } /* end if */ else ret_value = NULL; @@ -160,15 +159,15 @@ H5FO_insert(const H5F_t *f, haddr_t addr, void *obj, hbool_t delete_flag) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->open_objs); - HDassert(H5F_addr_defined(addr)); - HDassert(obj); + assert(f); + assert(f->shared); + assert(f->shared->open_objs); + assert(H5_addr_defined(addr)); + assert(obj); /* Allocate new opened object information structure */ if ((open_obj = H5FL_MALLOC(H5FO_open_obj_t)) == NULL) - HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Assign information */ open_obj->addr = addr; @@ -177,7 +176,7 @@ H5FO_insert(const H5F_t *f, haddr_t addr, void *obj, hbool_t delete_flag) /* Insert into container */ if (H5SL_insert(f->shared->open_objs, &open_obj->addr, open_obj) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert object into container") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert object into container"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -211,19 +210,19 @@ H5FO_delete(H5F_t *f, haddr_t addr) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->open_objs); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->shared); + assert(f->shared->open_objs); + assert(H5_addr_defined(addr)); /* Remove from container */ if (NULL == (open_obj = (H5FO_open_obj_t *)H5SL_remove(f->shared->open_objs, &addr))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "can't remove object from container") + HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "can't remove object from container"); /* Check if the object was deleted from the file */ if (open_obj->deleted) { if (H5O_delete(f, addr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file"); } /* end if */ /* Release the object information */ @@ -261,10 +260,10 @@ H5FO_mark(const H5F_t *f, haddr_t addr, hbool_t deleted) FUNC_ENTER_NOAPI_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->open_objs); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->shared); + assert(f->shared->open_objs); + assert(H5_addr_defined(addr)); /* Get the object node from the container */ if (NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr))) @@ -304,10 +303,10 @@ H5FO_marked(const H5F_t *f, haddr_t addr) FUNC_ENTER_NOAPI_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->open_objs); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->shared); + assert(f->shared->open_objs); + assert(H5_addr_defined(addr)); /* Get the object node from the container */ if (NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr))) @@ -342,17 +341,17 @@ H5FO_dest(const H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->open_objs); + assert(f); + assert(f->shared); + assert(f->shared->open_objs); /* Check if the object info set is empty */ if (H5SL_count(f->shared->open_objs) != 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "objects still in open object info set") + HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "objects still in open object info set"); /* Release the open object info set container */ if (H5SL_close(f->shared->open_objs) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCLOSEOBJ, FAIL, "can't close open object info set") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCLOSEOBJ, FAIL, "can't close open object info set"); f->shared->open_objs = NULL; @@ -386,11 +385,11 @@ H5FO_top_create(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); + assert(f); /* Create container used to store open object info */ if ((f->obj_count = H5SL_create(H5SL_TYPE_HADDR, NULL)) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create open object container") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create open object container"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -424,9 +423,9 @@ H5FO_top_incr(const H5F_t *f, haddr_t addr) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->obj_count); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->obj_count); + assert(H5_addr_defined(addr)); /* Get the object node from the container */ if (NULL != (obj_count = (H5FO_obj_count_t *)H5SL_search(f->obj_count, &addr))) { @@ -435,7 +434,7 @@ H5FO_top_incr(const H5F_t *f, haddr_t addr) else { /* Allocate new opened object information structure */ if (NULL == (obj_count = H5FL_MALLOC(H5FO_obj_count_t))) - HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_CACHE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Assign information */ obj_count->addr = addr; @@ -443,7 +442,7 @@ H5FO_top_incr(const H5F_t *f, haddr_t addr) /* Insert into container */ if (H5SL_insert(f->obj_count, &obj_count->addr, obj_count) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert object into container") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "can't insert object into container"); } /* end if */ done: @@ -478,9 +477,9 @@ H5FO_top_decr(const H5F_t *f, haddr_t addr) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->obj_count); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->obj_count); + assert(H5_addr_defined(addr)); /* Get the object node from the container */ if (NULL != (obj_count = (H5FO_obj_count_t *)H5SL_search(f->obj_count, &addr))) { @@ -490,14 +489,14 @@ H5FO_top_decr(const H5F_t *f, haddr_t addr) if (obj_count->count == 0) { /* Remove from container */ if (NULL == (obj_count = (H5FO_obj_count_t *)H5SL_remove(f->obj_count, &addr))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "can't remove object from container") + HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "can't remove object from container"); /* Release the object information */ obj_count = H5FL_FREE(H5FO_obj_count_t, obj_count); } /* end if */ } /* end if */ else - HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't decrement ref. count") + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't decrement ref. count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -531,9 +530,9 @@ H5FO_top_count(const H5F_t *f, haddr_t addr) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->obj_count); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->obj_count); + assert(H5_addr_defined(addr)); /* Get the object node from the container */ if (NULL != (obj_count = (H5FO_obj_count_t *)H5SL_search(f->obj_count, &addr))) @@ -570,16 +569,16 @@ H5FO_top_dest(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->obj_count); + assert(f); + assert(f->obj_count); /* Check if the object count set is empty */ if (H5SL_count(f->obj_count) != 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "objects still in open object info set") + HGOTO_ERROR(H5E_CACHE, H5E_CANTRELEASE, FAIL, "objects still in open object info set"); /* Release the open object count set container */ if (H5SL_close(f->obj_count) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCLOSEOBJ, FAIL, "can't close open object info set") + HGOTO_ERROR(H5E_CACHE, H5E_CANTCLOSEOBJ, FAIL, "can't close open object info set"); f->obj_count = NULL; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FS.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FS.c index 33f29b1f43..40bee44e94 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FS.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FS.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,13 +11,9 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, May 2, 2006 - * * Purpose: Free space tracking functions. * * Note: (Used to be in the H5HFflist.c file, prior to the date above) - * */ /****************/ @@ -83,9 +78,6 @@ H5FL_DEFINE(H5FS_t); * Return: Success: Pointer to free space structure * Failure: NULL * - * Programmer: Quincey Koziol - * Tuesday, March 7, 2006 - * *------------------------------------------------------------------------- */ H5FS_t * @@ -97,20 +89,20 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t FUNC_ENTER_NOAPI(NULL) #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", __func__, nclasses); + fprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", __func__, nclasses); #endif /* H5FS_DEBUG */ /* Check arguments. */ - HDassert(fs_create->shrink_percent); - HDassert(fs_create->shrink_percent < fs_create->expand_percent); - HDassert(fs_create->max_sect_size); - HDassert(nclasses == 0 || classes); + assert(fs_create->shrink_percent); + assert(fs_create->shrink_percent < fs_create->expand_percent); + assert(fs_create->max_sect_size); + assert(nclasses == 0 || classes); /* * Allocate free space structure */ if (NULL == (fspace = H5FS__new(f, nclasses, classes, cls_init_udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list"); /* Initialize creation information for free space manager */ fspace->client = fs_create->client; @@ -127,11 +119,11 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t if (fs_addr) { /* Allocate space for the free space header */ if (HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, (hsize_t)fspace->hdr_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for free space header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "file allocation failed for free space header"); /* Cache the new free space header (pinned) */ if (H5AC_insert_entry(f, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't add free space header to cache") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, NULL, "can't add free space header to cache"); /* Return free space header address to caller, if desired */ *fs_addr = fspace->addr; @@ -143,17 +135,17 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t /* Set the return value */ ret_value = fspace; #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: fspace = %p, fspace->addr = %" PRIuHADDR "\n", __func__, (void *)fspace, - fspace->addr); + fprintf(stderr, "%s: fspace = %p, fspace->addr = %" PRIuHADDR "\n", __func__, (void *)fspace, + fspace->addr); #endif /* H5FS_DEBUG */ done: if (!ret_value && fspace) if (H5FS__hdr_dest(fspace) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space header") + HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space header"); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %p\n", __func__, (void *)ret_value); + fprintf(stderr, "%s: Leaving, ret_value = %p\n", __func__, (void *)ret_value); #endif /* H5FS_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_create() */ @@ -166,9 +158,6 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t * Return: Success: Pointer to free space structure * Failure: NULL * - * Programmer: Quincey Koziol - * Tuesday, May 2, 2006 - * *------------------------------------------------------------------------- */ H5FS_t * @@ -181,14 +170,14 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class FUNC_ENTER_NOAPI(NULL) #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Opening free space manager, fs_addr = %" PRIuHADDR ", nclasses = %Zu\n", __func__, - fs_addr, nclasses); + fprintf(stderr, "%s: Opening free space manager, fs_addr = %" PRIuHADDR ", nclasses = %Zu\n", __func__, + fs_addr, nclasses); #endif /* H5FS_DEBUG */ /* Check arguments. */ - HDassert(H5F_addr_defined(fs_addr)); - HDassert(nclasses); - HDassert(classes); + assert(H5_addr_defined(fs_addr)); + assert(nclasses); + assert(classes); /* Initialize user data for protecting the free space manager */ cache_udata.f = f; @@ -200,26 +189,26 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class /* Protect the free space header */ if (NULL == (fspace = (H5FS_t *)H5AC_protect(f, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space header"); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: fspace->sect_addr = %" PRIuHADDR "\n", __func__, fspace->sect_addr); - HDfprintf(stderr, "%s: fspace->sect_size = %" PRIuHSIZE "\n", __func__, fspace->sect_size); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %" PRIuHSIZE "\n", __func__, fspace->alloc_sect_size); - HDfprintf(stderr, "%s: fspace->sinfo = %p\n", __func__, (void *)fspace->sinfo); - HDfprintf(stderr, "%s: fspace->rc = %u\n", __func__, fspace->rc); + fprintf(stderr, "%s: fspace->sect_addr = %" PRIuHADDR "\n", __func__, fspace->sect_addr); + fprintf(stderr, "%s: fspace->sect_size = %" PRIuHSIZE "\n", __func__, fspace->sect_size); + fprintf(stderr, "%s: fspace->alloc_sect_size = %" PRIuHSIZE "\n", __func__, fspace->alloc_sect_size); + fprintf(stderr, "%s: fspace->sinfo = %p\n", __func__, (void *)fspace->sinfo); + fprintf(stderr, "%s: fspace->rc = %u\n", __func__, fspace->rc); #endif /* H5FS_DEBUG */ /* Increment the reference count on the free space manager header */ - HDassert(fspace->rc <= 1); + assert(fspace->rc <= 1); if (H5FS__incr(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header"); fspace->alignment = alignment; fspace->align_thres = threshold; /* Unlock free space header */ if (H5AC_unprotect(f, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, NULL, "unable to release free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, NULL, "unable to release free space header"); /* Set return value */ ret_value = fspace; @@ -235,9 +224,6 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, May 30, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -249,12 +235,12 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) FUNC_ENTER_NOAPI(FAIL) #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %" PRIuHADDR "\n", __func__, fs_addr); + fprintf(stderr, "%s: Deleting free space manager, fs_addr = %" PRIuHADDR "\n", __func__, fs_addr); #endif /* H5FS_DEBUG */ /* Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(fs_addr)); + assert(f); + assert(H5_addr_defined(fs_addr)); /* Initialize user data for protecting the free space manager */ /* (no class information necessary for delete) */ @@ -269,78 +255,78 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) unsigned fspace_status = 0; /* Free space section info's status in the metadata cache */ /* Sanity check */ - HDassert(H5F_addr_defined(fs_addr)); + assert(H5_addr_defined(fs_addr)); /* Check the free space section info's status in the metadata cache */ if (H5AC_get_entry_status(f, fs_addr, &fspace_status) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "unable to check metadata cache status for free space section info") + "unable to check metadata cache status for free space section info"); - HDfprintf(stderr, "%s: fspace_status = %0x: ", __func__, fspace_status); + fprintf(stderr, "%s: fspace_status = %0x: ", __func__, fspace_status); if (fspace_status) { hbool_t printed = FALSE; if (fspace_status & H5AC_ES__IN_CACHE) { - HDfprintf(stderr, "H5AC_ES__IN_CACHE"); + fprintf(stderr, "H5AC_ES__IN_CACHE"); printed = TRUE; } /* end if */ if (fspace_status & H5AC_ES__IS_DIRTY) { - HDfprintf(stderr, "%sH5AC_ES__IS_DIRTY", (printed ? " | " : "")); + fprintf(stderr, "%sH5AC_ES__IS_DIRTY", (printed ? " | " : "")); printed = TRUE; } /* end if */ if (fspace_status & H5AC_ES__IS_PROTECTED) { - HDfprintf(stderr, "%sH5AC_ES__IS_PROTECTED", (printed ? " | " : "")); + fprintf(stderr, "%sH5AC_ES__IS_PROTECTED", (printed ? " | " : "")); printed = TRUE; } /* end if */ if (fspace_status & H5AC_ES__IS_PINNED) { - HDfprintf(stderr, "%sH5AC_ES__IS_PINNED", (printed ? " | " : "")); + fprintf(stderr, "%sH5AC_ES__IS_PINNED", (printed ? " | " : "")); printed = TRUE; } /* end if */ if (fspace_status & H5AC_ES__IS_FLUSH_DEP_PARENT) { - HDfprintf(stderr, "%sH5AC_ES__IS_FLUSH_DEP_PARENT", (printed ? " | " : "")); + fprintf(stderr, "%sH5AC_ES__IS_FLUSH_DEP_PARENT", (printed ? " | " : "")); printed = TRUE; } /* end if */ if (fspace_status & H5AC_ES__IS_FLUSH_DEP_CHILD) { - HDfprintf(stderr, "%sH5AC_ES__IS_FLUSH_DEP_CHILD", (printed ? " | " : "")); + fprintf(stderr, "%sH5AC_ES__IS_FLUSH_DEP_CHILD", (printed ? " | " : "")); printed = TRUE; } /* end if */ } /* end if */ - HDfprintf(stderr, "\n"); + fprintf(stderr, "\n"); } #endif /* H5FS_DEBUG */ /* Protect the free space header */ if (NULL == (fspace = (H5FS_t *)H5AC_protect(f, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space header"); /* Sanity check */ - HDassert(fspace->sinfo == NULL); + assert(fspace->sinfo == NULL); /* Delete serialized section storage, if there are any */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: fspace->sect_addr = %" PRIuHADDR "\n", __func__, fspace->sect_addr); + fprintf(stderr, "%s: fspace->sect_addr = %" PRIuHADDR "\n", __func__, fspace->sect_addr); #endif /* H5FS_DEBUG */ if (fspace->serial_sect_count > 0) { unsigned sinfo_status = 0; /* Free space section info's status in the metadata cache */ /* Sanity check */ - HDassert(H5F_addr_defined(fspace->sect_addr)); - HDassert(fspace->alloc_sect_size > 0); + assert(H5_addr_defined(fspace->sect_addr)); + assert(fspace->alloc_sect_size > 0); /* Check the free space section info's status in the metadata cache */ if (H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "unable to check metadata cache status for free space section info") + "unable to check metadata cache status for free space section info"); /* If the free space section info is in the cache, expunge it now */ if (sinfo_status & H5AC_ES__IN_CACHE) { /* Sanity checks on direct block */ - HDassert(!(sinfo_status & H5AC_ES__IS_PINNED)); - HDassert(!(sinfo_status & H5AC_ES__IS_PROTECTED)); + assert(!(sinfo_status & H5AC_ES__IS_PINNED)); + assert(!(sinfo_status & H5AC_ES__IS_PROTECTED)); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Expunging free space section info from cache\n", __func__); + fprintf(stderr, "%s: Expunging free space section info from cache\n", __func__); #endif /* H5FS_DEBUG */ /* Evict the free space section info from the metadata cache */ /* (Free file space) */ @@ -355,28 +341,28 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) if (H5AC_expunge_entry(f, H5AC_FSPACE_SINFO, fspace->sect_addr, cache_flags) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, - "unable to remove free space section info from cache") + "unable to remove free space section info from cache"); } /* end block */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", __func__); + fprintf(stderr, "%s: Done expunging free space section info from cache\n", __func__); #endif /* H5FS_DEBUG */ } /* end if */ else { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Deleting free space section info from file\n", __func__); + fprintf(stderr, "%s: Deleting free space section info from file\n", __func__); #endif /* H5FS_DEBUG */ /* Release the space in the file */ if (!H5F_IS_TMP_ADDR(f, fspace->sect_addr)) if (H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, fspace->sect_addr, fspace->alloc_sect_size) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections"); } /* end else */ } /* end if */ done: if (fspace && H5AC_unprotect(f, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space header") + HDONE_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space header"); FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_delete() */ @@ -389,9 +375,6 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, March 7, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -402,78 +385,77 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(f); - HDassert(fspace); + assert(f); + assert(fspace); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->addr = %" PRIuHADDR ", fspace->sinfo = %p\n", - __func__, (void *)fspace, fspace->addr, (void *)fspace->sinfo); + fprintf(stderr, "%s: Entering, fspace = %p, fspace->addr = %" PRIuHADDR ", fspace->sinfo = %p\n", + __func__, (void *)fspace, fspace->addr, (void *)fspace->sinfo); #endif /* H5FS_DEBUG */ /* Check if section info is valid */ /* (i.e. the header "owns" the section info and it's not in the cache) */ if (fspace->sinfo) { #ifdef H5FS_DEBUG - HDfprintf(stderr, - "%s: fspace->tot_sect_count = %" PRIuHSIZE ", fspace->serial_sect_count = %" PRIuHSIZE - ", fspace->sect_addr = %" PRIuHADDR ", fspace->rc = %u\n", - __func__, fspace->tot_sect_count, fspace->serial_sect_count, fspace->sect_addr, fspace->rc); - HDfprintf(stderr, - "%s: fspace->alloc_sect_size = %" PRIuHSIZE ", fspace->sect_size = %" PRIuHSIZE "\n", - __func__, fspace->alloc_sect_size, fspace->sect_size); + fprintf(stderr, + "%s: fspace->tot_sect_count = %" PRIuHSIZE ", fspace->serial_sect_count = %" PRIuHSIZE + ", fspace->sect_addr = %" PRIuHADDR ", fspace->rc = %u\n", + __func__, fspace->tot_sect_count, fspace->serial_sect_count, fspace->sect_addr, fspace->rc); + fprintf(stderr, "%s: fspace->alloc_sect_size = %" PRIuHSIZE ", fspace->sect_size = %" PRIuHSIZE "\n", + __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_DEBUG */ /* If there are sections to serialize, update them */ /* (if the free space manager is persistent) */ - if (fspace->serial_sect_count > 0 && H5F_addr_defined(fspace->addr)) { + if (fspace->serial_sect_count > 0 && H5_addr_defined(fspace->addr)) { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Real sections to store in file\n", __func__); + fprintf(stderr, "%s: Real sections to store in file\n", __func__); #endif /* H5FS_DEBUG */ if (fspace->sinfo->dirty) { /* Check if the section info is "floating" */ - if (!H5F_addr_defined(fspace->sect_addr)) { + if (!H5_addr_defined(fspace->sect_addr)) { /* Sanity check */ - HDassert(fspace->sect_size > 0); + assert(fspace->sect_size > 0); /* Allocate space for the section info in file */ if (H5F_USE_TMP_SPACE(f)) { if (HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc_tmp(f, fspace->sect_size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, - "file allocation failed for free space sections") + "file allocation failed for free space sections"); } /* end if */ else { if (HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, fspace->sect_size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, - "file allocation failed for free space sections") + "file allocation failed for free space sections"); } /* end if */ fspace->alloc_sect_size = (size_t)fspace->sect_size; /* Mark free space header as dirty */ if (H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, - "unable to mark free space header as dirty") + "unable to mark free space header as dirty"); } /* end if */ } /* end if */ else /* Sanity check that section info has address */ - HDassert(H5F_addr_defined(fspace->sect_addr)); + assert(H5_addr_defined(fspace->sect_addr)); /* Cache the free space section info */ if (H5AC_insert_entry(f, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache"); } /* end if */ else { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: NOT storing section info in file\n", __func__); + fprintf(stderr, "%s: NOT storing section info in file\n", __func__); #endif /* H5FS_DEBUG */ /* Check if space for the section info is allocated */ - if (H5F_addr_defined(fspace->sect_addr)) { + if (H5_addr_defined(fspace->sect_addr)) { /* Sanity check */ /* (section info should only be in the file if the header is */ - HDassert(H5F_addr_defined(fspace->addr)); + assert(H5_addr_defined(fspace->addr)); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info allocated though\n", __func__); + fprintf(stderr, "%s: Section info allocated though\n", __func__); #endif /* H5FS_DEBUG */ /* Check if the section info is for the free space in the file */ /* (NOTE: This is the "bootstrapping" special case for the @@ -485,13 +467,12 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) htri_t status; /* "can absorb" status for section into */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info is for file free space\n", __func__); + fprintf(stderr, "%s: Section info is for file free space\n", __func__); #endif /* H5FS_DEBUG */ /* Try to shrink the file or absorb the section info into a block aggregator */ if (H5F_IS_TMP_ADDR(f, fspace->sect_addr)) { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info in temp. address space went 'go away'\n", - __func__); + fprintf(stderr, "%s: Section info in temp. address space went 'go away'\n", __func__); #endif /* H5FS_DEBUG */ /* Reset section info in header */ fspace->sect_addr = HADDR_UNDEF; @@ -500,25 +481,25 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) /* Mark free space header as dirty */ if (H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, - "unable to mark free space header as dirty") + "unable to mark free space header as dirty"); } /* end if */ else { if ((status = H5MF_try_shrink(f, H5FD_MEM_FSPACE_SINFO, fspace->sect_addr, fspace->alloc_sect_size)) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, - "can't check for absorbing section info") + "can't check for absorbing section info"); else if (status == FALSE) { /* Section info can't "go away", but it's free. Allow * header to record it */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n", - __func__); + fprintf(stderr, "%s: Section info can't 'go away', header will own it\n", + __func__); #endif /* H5FS_DEBUG */ } /* end if */ else { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info went 'go away'\n", __func__); + fprintf(stderr, "%s: Section info went 'go away'\n", __func__); #endif /* H5FS_DEBUG */ /* Reset section info in header */ fspace->sect_addr = HADDR_UNDEF; @@ -527,7 +508,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) /* Mark free space header as dirty */ if (H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, - "unable to mark free space header as dirty") + "unable to mark free space header as dirty"); } /* end else */ } /* end else */ } /* end if */ @@ -537,7 +518,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) fspace->alloc_sect_size; /* Previous size of section info in file */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info is NOT for file free space\n", __func__); + fprintf(stderr, "%s: Section info is NOT for file free space\n", __func__); #endif /* H5FS_DEBUG */ /* Reset section info in header */ fspace->sect_addr = HADDR_UNDEF; @@ -546,19 +527,19 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) /* Mark free space header as dirty */ if (H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, - "unable to mark free space header as dirty") + "unable to mark free space header as dirty"); /* Free previous serialized sections disk space */ if (!H5F_IS_TMP_ADDR(f, old_sect_addr)) { if (H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, old_sect_addr, old_alloc_sect_size) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections"); } /* end if */ } /* end else */ } /* end if */ /* Destroy section info */ if (H5FS__sinfo_dest(fspace->sinfo) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "unable to destroy free space section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "unable to destroy free space section info"); } /* end else */ /* Reset the header's pointer to the section info */ @@ -568,16 +549,16 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) /* Just sanity checks... */ if (fspace->serial_sect_count > 0) /* Sanity check that section info has address */ - HDassert(H5F_addr_defined(fspace->sect_addr)); + assert(H5_addr_defined(fspace->sect_addr)); } /* end else */ /* Decrement the reference count on the free space manager header */ if (H5FS__decr(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header"); done: #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", __func__, ret_value, fspace->rc); + fprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", __func__, ret_value, fspace->rc); #endif /* H5FS_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_close() */ @@ -590,9 +571,6 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) * Return: Success: non-NULL, pointer to new free space manager struct * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, July 31, 2006 - * *------------------------------------------------------------------------- */ H5FS_t * @@ -605,25 +583,25 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(nclasses == 0 || (nclasses > 0 && classes)); + assert(nclasses == 0 || (nclasses > 0 && classes)); /* * Allocate free space structure */ if (NULL == (fspace = H5FL_CALLOC(H5FS_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for free space free list"); /* Set immutable free list parameters */ H5_CHECKED_ASSIGN(fspace->nclasses, uint16_t, nclasses, size_t); if (nclasses > 0) { if (NULL == (fspace->sect_cls = H5FL_SEQ_MALLOC(H5FS_section_class_t, nclasses))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for free space section class array") + "memory allocation failed for free space section class array"); /* Initialize the section classes for this free space list */ for (u = 0; u < nclasses; u++) { /* Make certain that section class type can be used as an array index into this array */ - HDassert(u == classes[u]->type); + assert(u == classes[u]->type); /* Copy the class information into the free space manager */ H5MM_memcpy(&fspace->sect_cls[u], classes[u], sizeof(H5FS_section_class_t)); @@ -631,7 +609,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes /* Call the class initialization routine, if there is one */ if (fspace->sect_cls[u].init_cls) if ((fspace->sect_cls[u].init_cls)(&fspace->sect_cls[u], cls_init_udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "unable to initialize section class") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "unable to initialize section class"); /* Determine maximum class-specific serialization size for each section */ if (fspace->sect_cls[u].serial_size > fspace->max_cls_serial_size) @@ -669,9 +647,6 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes * * Return: SUCCEED (Can't fail) * - * Programmer: Vailin Choi - * June 19, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -682,8 +657,8 @@ H5FS_size(const H5FS_t *fspace, hsize_t *meta_size) /* * Check arguments. */ - HDassert(fspace); - HDassert(meta_size); + assert(fspace); + assert(meta_size); /* Get the free space size info */ *meta_size += fspace->hdr_size + (fspace->sinfo ? fspace->sect_size : fspace->alloc_sect_size); @@ -698,9 +673,6 @@ H5FS_size(const H5FS_t *fspace, hsize_t *meta_size) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * February 7, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -710,19 +682,19 @@ H5FS__incr(H5FS_t *fspace) FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Entering, fpace->addr = %" PRIuHADDR ", fspace->rc = %u\n", __func__, fspace->addr, - fspace->rc); + fprintf(stderr, "%s: Entering, fpace->addr = %" PRIuHADDR ", fspace->rc = %u\n", __func__, fspace->addr, + fspace->rc); #endif /* H5FS_DEBUG */ /* * Check arguments. */ - HDassert(fspace); + assert(fspace); /* Check if we should pin the header in the cache */ - if (fspace->rc == 0 && H5F_addr_defined(fspace->addr)) + if (fspace->rc == 0 && H5_addr_defined(fspace->addr)) if (H5AC_pin_protected_entry(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, FAIL, "unable to pin free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTPIN, FAIL, "unable to pin free space header"); /* Increment reference count on header */ fspace->rc++; @@ -738,9 +710,6 @@ H5FS__incr(H5FS_t *fspace) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * February 7, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -750,27 +719,27 @@ H5FS__decr(H5FS_t *fspace) FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Entering, fpace->addr = %" PRIuHADDR ", fspace->rc = %u\n", __func__, fspace->addr, - fspace->rc); + fprintf(stderr, "%s: Entering, fpace->addr = %" PRIuHADDR ", fspace->rc = %u\n", __func__, fspace->addr, + fspace->rc); #endif /* H5FS_DEBUG */ /* * Check arguments. */ - HDassert(fspace); + assert(fspace); /* Decrement reference count on header */ fspace->rc--; /* Check if we should unpin the header in the cache */ if (fspace->rc == 0) { - if (H5F_addr_defined(fspace->addr)) { + if (H5_addr_defined(fspace->addr)) { if (H5AC_unpin_entry(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin free space header"); } /* end if */ else { if (H5FS__hdr_dest(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "unable to destroy free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "unable to destroy free space header"); } /* end else */ } /* end if */ @@ -785,9 +754,6 @@ H5FS__decr(H5FS_t *fspace) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Feb 14 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -798,13 +764,13 @@ H5FS__dirty(H5FS_t *fspace) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(fspace); + assert(fspace); /* Check if the free space manager is persistent */ - if (H5F_addr_defined(fspace->addr)) + if (H5_addr_defined(fspace->addr)) /* Mark header as dirty in cache */ if (H5AC_mark_entry_dirty(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -817,9 +783,6 @@ H5FS__dirty(H5FS_t *fspace) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Feb 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -830,17 +793,17 @@ H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(f); - HDassert(fspace); + assert(f); + assert(fspace); - if (!H5F_addr_defined(fspace->addr)) { + if (!H5_addr_defined(fspace->addr)) { /* Allocate space for the free space header */ if (HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, (hsize_t)H5FS_HEADER_SIZE(f)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header"); /* Cache the new free space header (pinned) */ if (H5AC_insert_entry(f, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache"); } /* end if */ if (fs_addr) @@ -857,9 +820,6 @@ H5FS_alloc_hdr(H5F_t *f, H5FS_t *fspace, haddr_t *fs_addr) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Feb 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -870,21 +830,21 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(f); - HDassert(fspace); + assert(f); + assert(fspace); - if (!H5F_addr_defined(fspace->sect_addr) && fspace->sinfo && fspace->serial_sect_count > 0) { + if (!H5_addr_defined(fspace->sect_addr) && fspace->sinfo && fspace->serial_sect_count > 0) { if (HADDR_UNDEF == (fspace->sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, fspace->sect_size))) - HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info") + HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info"); fspace->alloc_sect_size = fspace->sect_size; /* Mark free-space header as dirty */ if (H5FS__dirty(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty"); /* Cache the free-space section info */ if (H5AC_insert_entry(f, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache"); /* Since space has been allocated for the section info and the sinfo * has been inserted into the cache, relinquish ownership (i.e. float) @@ -904,9 +864,6 @@ H5FS_alloc_sect(H5F_t *f, H5FS_t *fspace) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Feb 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -919,21 +876,20 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(f); - HDassert(fspace); + assert(f); + assert(fspace); cache_flags = H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG; - ; /* Free space for section info */ - if (H5F_addr_defined(fspace->sect_addr)) { + if (H5_addr_defined(fspace->sect_addr)) { hsize_t saved_size; /* Size of previous section info */ unsigned sinfo_status = 0; /* Section info cache status */ /* Check whether free-space manager section info is in cache or not */ if (H5AC_get_entry_status(f, fspace->sect_addr, &sinfo_status) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, - "unable to check metadata cache status for free-space section info") + "unable to check metadata cache status for free-space section info"); /* Load free-space manager section info */ if (sinfo_status & H5AC_ES__IN_CACHE || !fspace->sinfo) { @@ -944,11 +900,11 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space) cache_udata.fspace = fspace; if (NULL == (fspace->sinfo = (H5FS_sinfo_t *)H5AC_protect(f, H5AC_FSPACE_SINFO, fspace->sect_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info"); /* Unload and release ownership of the free-space manager section info */ if (H5AC_unprotect(f, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info"); } /* end if */ saved_addr = fspace->sect_addr; @@ -960,22 +916,22 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space) /* Free space for the free-space manager section info */ if (!H5F_IS_TMP_ADDR(f, saved_addr)) { if (free_file_space && H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, saved_addr, saved_size) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to release free space sections"); } /* end if */ /* Mark free-space manager header as dirty */ if (H5FS__dirty(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty"); } /* end if */ /* Free space for header */ - if (H5F_addr_defined(fspace->addr)) { + if (H5_addr_defined(fspace->addr)) { unsigned hdr_status = 0; /* Header entry status */ /* Check whether free-space manager header is in cache or not */ if (H5AC_get_entry_status(f, fspace->addr, &hdr_status) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, - "unable to check metadata cache status for free-space section info") + "unable to check metadata cache status for free-space section info"); if (hdr_status & H5AC_ES__IN_CACHE) { H5FS_hdr_cache_ud_t cache_udata; /* User-data for metadata cache callback */ @@ -988,15 +944,15 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space) cache_udata.cls_init_udata = NULL; if (NULL == (fspace = (H5FS_t *)H5AC_protect(f, H5AC_FSPACE_HDR, fspace->addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to protect free space section info"); /* Unpin the free-space manager header */ if (H5AC_unpin_entry(fspace) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header"); /* Unload and release ownership of the free-space header */ if (H5AC_unprotect(f, H5AC_FSPACE_HDR, fspace->addr, fspace, cache_flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info"); } /* end if */ saved_addr = fspace->addr; @@ -1005,7 +961,7 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space) /* Free space for the free-space manager header */ if (free_file_space && H5MF_xfree(f, H5FD_MEM_FSPACE_HDR, saved_addr, (hsize_t)H5FS_HEADER_SIZE(f)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space header"); } /* end if */ done: @@ -1019,9 +975,6 @@ H5FS_free(H5F_t *f, H5FS_t *fspace, hbool_t free_file_space) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 2 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1035,14 +988,14 @@ H5FS__hdr_dest(H5FS_t *fspace) /* * Check arguments. */ - HDassert(fspace); + assert(fspace); /* Terminate the section classes for this free space list */ for (u = 0; u < fspace->nclasses; u++) { /* Call the class termination routine, if there is one */ if (fspace->sect_cls[u].term_cls) if ((fspace->sect_cls[u].term_cls)(&fspace->sect_cls[u]) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "unable to finalize section class") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "unable to finalize section class"); } /* end for */ /* Release the memory for the free space section classes */ @@ -1063,9 +1016,6 @@ H5FS__hdr_dest(H5FS_t *fspace) * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Saturday, March 11, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1076,8 +1026,8 @@ H5FS__sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) FUNC_ENTER_PACKAGE_NOERR - HDassert(sect); - HDassert(sinfo); + assert(sect); + assert(sinfo); /* Call the section's class 'free' method on the section */ (*sinfo->fspace->sect_cls[sect->type].free)(sect); @@ -1092,9 +1042,6 @@ H5FS__sinfo_free_sect_cb(void *_sect, void H5_ATTR_UNUSED *key, void *op_data) * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Saturday, March 11, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1104,8 +1051,8 @@ H5FS__sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) FUNC_ENTER_PACKAGE_NOERR - HDassert(fspace_node); - HDassert(op_data); + assert(fspace_node); + assert(op_data); /* Release the skip list for sections of this size */ H5SL_destroy(fspace_node->sect_list, H5FS__sinfo_free_sect_cb, op_data); @@ -1123,9 +1070,6 @@ H5FS__sinfo_free_node_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * July 31 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1139,9 +1083,9 @@ H5FS__sinfo_dest(H5FS_sinfo_t *sinfo) /* * Check arguments. */ - HDassert(sinfo); - HDassert(sinfo->fspace); - HDassert(sinfo->bins); + assert(sinfo); + assert(sinfo->fspace); + assert(sinfo->bins); /* Clear out lists of nodes */ for (u = 0; u < sinfo->nbins; u++) @@ -1156,7 +1100,7 @@ H5FS__sinfo_dest(H5FS_sinfo_t *sinfo) /* Release skip list for merging sections */ if (sinfo->merge_list) if (H5SL_close(sinfo->merge_list) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy section merging skip list") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy section merging skip list"); /* Decrement the reference count on free space header */ /* (make certain this is last action with section info, to allow for header @@ -1164,7 +1108,7 @@ H5FS__sinfo_dest(H5FS_sinfo_t *sinfo) */ sinfo->fspace->sinfo = NULL; if (H5FS__decr(sinfo->fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEC, FAIL, "unable to decrement ref. count on free space header"); sinfo->fspace = NULL; /* Release free space section info */ @@ -1182,8 +1126,8 @@ H5FS_get_sect_count(const H5FS_t *frsp, hsize_t *tot_sect_count) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(frsp); - HDassert(tot_sect_count); + assert(frsp); + assert(tot_sect_count); /* Report statistics for free space */ *tot_sect_count = frsp->serial_sect_count; @@ -1200,9 +1144,6 @@ H5FS_get_sect_count(const H5FS_t *frsp, hsize_t *tot_sect_count) * * Return: void * - * Programmer: Quincey Koziol - * Jul 17 2006 - * *------------------------------------------------------------------------- */ void @@ -1216,14 +1157,14 @@ H5FS__assert(const H5FS_t *fspace) H5FS__sect_assert(fspace); /* General assumptions about the section size counts */ - HDassert(fspace->sinfo->tot_size_count >= fspace->sinfo->serial_size_count); - HDassert(fspace->sinfo->tot_size_count >= fspace->sinfo->ghost_size_count); + assert(fspace->sinfo->tot_size_count >= fspace->sinfo->serial_size_count); + assert(fspace->sinfo->tot_size_count >= fspace->sinfo->ghost_size_count); } /* end if */ /* General assumptions about the section counts */ - HDassert(fspace->tot_sect_count >= fspace->serial_sect_count); - HDassert(fspace->tot_sect_count >= fspace->ghost_sect_count); - HDassert(fspace->tot_sect_count == (fspace->serial_sect_count + fspace->ghost_sect_count)); + assert(fspace->tot_sect_count >= fspace->serial_sect_count); + assert(fspace->tot_sect_count >= fspace->ghost_sect_count); + assert(fspace->tot_sect_count == (fspace->serial_sect_count + fspace->ghost_sect_count)); FUNC_LEAVE_NOAPI_VOID } /* end H5FS__assert() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FScache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FScache.c index d931c656f7..28fe2a4b45 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FScache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FScache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5FScache.c - * May 2 2006 - * Quincey Koziol * * Purpose: Implement file free space metadata cache methods. * @@ -148,9 +145,6 @@ const H5AC_class_t H5AC_FSPACE_SINFO[1] = {{ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -161,9 +155,9 @@ H5FS__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->f); - HDassert(image_len); + assert(udata); + assert(udata->f); + assert(image_len); /* Set the image length size */ *image_len = (size_t)H5FS_HEADER_SIZE(udata->f); @@ -180,8 +174,6 @@ H5FS__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ htri_t @@ -195,7 +187,7 @@ H5FS__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -217,9 +209,6 @@ H5FS__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE * Return: Success: Pointer to new object * Failure: NULL * - * Programmer: Quincey Koziol - * August 18 2013 - * *------------------------------------------------------------------------- */ static void * @@ -236,30 +225,30 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(udata); - HDassert(udata->f); + assert(image); + assert(udata); + assert(udata->f); /* Allocate a new free space manager */ if (NULL == (fspace = H5FS__new(udata->f, udata->nclasses, udata->classes, udata->cls_init_udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Set free space manager's internal information */ fspace->addr = udata->addr; /* Magic number */ - if (HDmemcmp(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature") + if (memcmp(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5FS_HDR_VERSION) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header version") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header version"); /* Client ID */ fspace->client = (H5FS_client_t)*image++; if (fspace->client >= H5FS_NUM_CLIENT_ID) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "unknown client ID in free space header"); /* Total space tracked */ H5F_DECODE_LENGTH(udata->f, image, fspace->tot_space); @@ -277,7 +266,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len /* (only check if we actually have some classes) */ UINT16DECODE(image, nclasses); if (fspace->nclasses > 0 && nclasses > fspace->nclasses) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "section class count mismatch"); /* Shrink percent */ UINT16DECODE(image, fspace->shrink_percent); @@ -308,7 +297,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) <= len); + assert((size_t)(image - (const uint8_t *)_image) <= len); /* Set return value */ ret_value = fspace; @@ -317,7 +306,7 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len /* Release resources */ if (!ret_value && fspace) if (H5FS__hdr_dest(fspace) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space header") + HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FS__cache_hdr_deserialize() */ @@ -330,9 +319,6 @@ H5FS__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -343,10 +329,9 @@ H5FS__cache_hdr_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(fspace); - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(image_len); + assert(fspace); + assert(fspace->cache_info.type == H5AC_FSPACE_HDR); + assert(image_len); /* Set the image length size */ *image_len = fspace->hdr_size; @@ -376,9 +361,6 @@ H5FS__cache_hdr_image_len(const void *_thing, size_t *image_len) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -393,14 +375,13 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(fspace); - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(H5F_addr_defined(addr)); - HDassert(new_addr); - HDassert(new_len); - HDassert(flags); + assert(f); + assert(fspace); + assert(fspace->cache_info.type == H5AC_FSPACE_HDR); + assert(H5_addr_defined(addr)); + assert(new_addr); + assert(new_len); + assert(flags); if (fspace->sinfo) { H5AC_ring_t ring; @@ -423,7 +404,7 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT * * 1) The instance of H5FS_sinfo_t is not in the metadata cache. * - * This will be TRUE iff H5F_addr_defined(fspace->sect_addr) + * This will be TRUE iff H5_addr_defined(fspace->sect_addr) * is FALSE, and fspace->sinfo is not NULL. This is sometimes * referred to as "floating" section info in the comments. * @@ -434,11 +415,11 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT * * and * - * H5F_addr_defined(fspace->addr) + * H5_addr_defined(fspace->addr) * - * will both be TRUE. If this contition does not hold, then + * will both be TRUE. If this condition does not hold, then * either the free space info is not persistent - * (!H5F_addr_defined(fspace->addr)???) or the section info + * (!H5_addr_defined(fspace->addr)???) or the section info * contains no free space data that must be written to file * ( fspace->serial_sect_count == 0 ). * @@ -458,7 +439,7 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT * cases 2) and 3), as the section info should not be stored on * disk if it doesn't exist. Similarly, since the section info * will not be stored to disk unless the header is, - * H5F_addr_defined(fspace->addr) must hold as well. + * H5_addr_defined(fspace->addr) must hold as well. * * As the objective is to touch up the free space manager header * so that it contains sensical data on the size and location of @@ -466,7 +447,7 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT * cases differently. * * Case 1) If either fspace->serial_sect_count == 0 or - * ! H5F_addr_defined(fspace->addr) do nothing as either + * ! H5_addr_defined(fspace->addr) do nothing as either * the free space manager data is not persistent, or the * section info is empty. * @@ -490,11 +471,11 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT * as dirty, as the metadata cache would not be attempting to * serialize the header if it thought it was clean. */ - if (fspace->serial_sect_count > 0 && H5F_addr_defined(fspace->addr)) { + if (fspace->serial_sect_count > 0 && H5_addr_defined(fspace->addr)) { /* Sanity check */ - HDassert(fspace->sect_size > 0); + assert(fspace->sect_size > 0); - if (!H5F_addr_defined(fspace->sect_addr)) { /* case 1 */ + if (!H5_addr_defined(fspace->sect_addr)) { /* case 1 */ haddr_t tag = HADDR_UNDEF; haddr_t sect_addr; hsize_t saved_sect_size, new_sect_size; @@ -506,7 +487,7 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT if (HADDR_UNDEF == (sect_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FSPACE_SINFO, fspace->sect_size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, - "file allocation failed for free space sections") + "file allocation failed for free space sections"); /* fspace->sect_size may change in size after H5MF_alloc(). * If increased in size, free the previous allocation and @@ -517,12 +498,12 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT new_sect_size = fspace->sect_size; if (H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, sect_addr, saved_sect_size) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections"); if (HADDR_UNDEF == (sect_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FSPACE_SINFO, new_sect_size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, - "file allocation failed for free space sections") + "file allocation failed for free space sections"); fspace->sect_size = new_sect_size; fspace->alloc_sect_size = new_sect_size; } @@ -534,14 +515,14 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT /* Get the tag for this free space manager and use it to insert the entry */ if (H5AC_get_tag((const void *)fspace, &tag) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTTAG, FAIL, "can't get tag for metadata cache object") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTTAG, FAIL, "can't get tag for metadata cache object"); H5_BEGIN_TAG(tag) if (H5AC_insert_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR_TAG(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache") + HGOTO_ERROR_TAG(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sections to cache"); H5_END_TAG - HDassert(fspace->sinfo->cache_info.size == fspace->alloc_sect_size); + assert(fspace->sinfo->cache_info.size == fspace->alloc_sect_size); /* the metadata cache is now managing the section info, * so set fspace->sinfo to NULL. @@ -559,21 +540,21 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT * be the case. If not, we will have to add code to resize * file space allocation for section info as well as moving it. */ - HDassert(fspace->sect_size > 0); - HDassert(fspace->alloc_sect_size == (size_t)fspace->sect_size); + assert(fspace->sect_size > 0); + assert(fspace->alloc_sect_size == (size_t)fspace->sect_size); /* Allocate space for the section info in file */ if (HADDR_UNDEF == (new_sect_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FSPACE_SINFO, fspace->sect_size))) HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, - "file allocation failed for free space sections") + "file allocation failed for free space sections"); fspace->alloc_sect_size = (size_t)fspace->sect_size; - HDassert(fspace->sinfo->cache_info.size == fspace->alloc_sect_size); + assert(fspace->sinfo->cache_info.size == fspace->alloc_sect_size); /* Let the metadata cache know the section info moved */ if (H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, new_sect_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move section info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move section info"); fspace->sect_addr = new_sect_addr; } /* end else-if */ @@ -582,18 +563,18 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT * be the case. If not, we will have to add code to resize * file space allocation for section info. */ - HDassert(fspace->sect_size > 0); - HDassert(fspace->alloc_sect_size == (size_t)fspace->sect_size); + assert(fspace->sect_size > 0); + assert(fspace->alloc_sect_size == (size_t)fspace->sect_size); } /* end else */ } /* end else */ else { /* for one reason or another (see comment above) there should * not be any file space allocated for the section info. */ - HDassert(!H5F_addr_defined(fspace->sect_addr)); + assert(!H5_addr_defined(fspace->sect_addr)); } /* end else */ } /* end if */ - else if (H5F_addr_defined(fspace->sect_addr)) { + else if (H5_addr_defined(fspace->sect_addr)) { /* Here the metadata cache is managing the section info. * * Do some sanity checks, and then test to see if the section @@ -602,8 +583,8 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT * a nonsense section info address. */ if (!H5F_POINT_OF_NO_RETURN(f)) { - HDassert(fspace->sect_size > 0); - HDassert(fspace->alloc_sect_size == (size_t)fspace->sect_size); + assert(fspace->sect_size > 0); + assert(fspace->alloc_sect_size == (size_t)fspace->sect_size); } /* end if */ if (H5F_IS_TMP_ADDR(f, fspace->sect_addr)) { @@ -619,25 +600,25 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT * unprotected and un-pinned. Start by verifying this. */ if (H5AC_get_entry_status(f, fspace->sect_addr, §_status) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info status") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info status"); - HDassert(sect_status & H5AC_ES__IN_CACHE); - HDassert((sect_status & H5AC_ES__IS_PROTECTED) == 0); - HDassert((sect_status & H5AC_ES__IS_PINNED) == 0); + assert(sect_status & H5AC_ES__IN_CACHE); + assert((sect_status & H5AC_ES__IS_PROTECTED) == 0); + assert((sect_status & H5AC_ES__IS_PINNED) == 0); /* Allocate space for the section info in file */ if (HADDR_UNDEF == (new_sect_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FSPACE_SINFO, fspace->sect_size))) - HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections"); fspace->alloc_sect_size = (size_t)fspace->sect_size; /* Sanity check */ - HDassert(!H5F_addr_eq(fspace->sect_addr, new_sect_addr)); + assert(!H5_addr_eq(fspace->sect_addr, new_sect_addr)); /* Let the metadata cache know the section info moved */ if (H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, new_sect_addr) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMOVE, FAIL, "unable to move section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMOVE, FAIL, "unable to move section info"); /* Update the internal address for the section info */ fspace->sect_addr = new_sect_addr; @@ -649,8 +630,8 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT } /* end else-if */ else { /* there is no section info at present */ /* do some sanity checks */ - HDassert(fspace->serial_sect_count == 0); - HDassert(fspace->tot_sect_count == fspace->ghost_sect_count); + assert(fspace->serial_sect_count == 0); + assert(fspace->tot_sect_count == fspace->ghost_sect_count); } /* end else */ /* what ever happened above, set *flags to 0 */ @@ -675,9 +656,6 @@ H5FS__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_AT * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -691,12 +669,11 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(fspace); - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(fspace->hdr_size == len); + assert(f); + assert(image); + assert(fspace); + assert(fspace->cache_info.type == H5AC_FSPACE_HDR); + assert(fspace->hdr_size == len); /* The section information does not always exits, and if it does, * it is not always in the cache. To make matters more interesting, @@ -706,11 +683,11 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN * into real file space if necessary before this function was called. * The following asserts are a cursory check on this. */ - HDassert((!H5F_addr_defined(fspace->sect_addr)) || (!H5F_IS_TMP_ADDR(f, fspace->sect_addr))); + assert((!H5_addr_defined(fspace->sect_addr)) || (!H5F_IS_TMP_ADDR(f, fspace->sect_addr))); if (!H5F_POINT_OF_NO_RETURN(f)) - HDassert((!H5F_addr_defined(fspace->sect_addr)) || - ((fspace->sect_size > 0) && (fspace->alloc_sect_size == (size_t)fspace->sect_size))); + assert((!H5_addr_defined(fspace->sect_addr)) || + ((fspace->sect_size > 0) && (fspace->alloc_sect_size == (size_t)fspace->sect_size))); /* Magic number */ H5MM_memcpy(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -767,7 +744,7 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN UINT32ENCODE(image, metadata_chksum); /* sanity checks */ - HDassert((size_t)(image - (uint8_t *)_image) == fspace->hdr_size); + assert((size_t)(image - (uint8_t *)_image) == fspace->hdr_size); FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__cache_hdr_serialize() */ @@ -779,9 +756,6 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * January 3, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -793,7 +767,7 @@ H5FS__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(fspace); + assert(fspace); /* Determine which action to take */ switch (action) { @@ -805,7 +779,7 @@ H5FS__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: if (H5AC_unsettle_entry_ring(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to mark FSM ring as unsettled") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to mark FSM ring as unsettled"); break; case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: @@ -819,9 +793,9 @@ H5FS__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) default: #ifdef NDEBUG - HGOTO_ERROR(H5E_FSPACE, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_FSPACE, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ @@ -834,16 +808,9 @@ H5FS__cache_hdr_notify(H5AC_notify_action_t action, void *_thing) * * Purpose: Destroys a free space header in memory. * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * May 2 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -855,16 +822,15 @@ H5FS__cache_hdr_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(fspace); - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); + assert(fspace); + assert(fspace->cache_info.type == H5AC_FSPACE_HDR); /* We should not still be holding on to the free space section info */ - HDassert(!fspace->sinfo); + assert(!fspace->sinfo); /* Destroy free space header */ if (H5FS__hdr_dest(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -879,9 +845,6 @@ H5FS__cache_hdr_free_icr(void *_thing) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/7/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -893,11 +856,11 @@ H5FS__cache_sinfo_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(udata); + assert(udata); fspace = udata->fspace; - HDassert(fspace); - HDassert(fspace->sect_size > 0); - HDassert(image_len); + assert(fspace); + assert(fspace->sect_size > 0); + assert(image_len); /* Set the image length size */ *image_len = (size_t)(fspace->sect_size); @@ -914,8 +877,6 @@ H5FS__cache_sinfo_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ htri_t @@ -929,7 +890,7 @@ H5FS__cache_sinfo_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -951,9 +912,6 @@ H5FS__cache_sinfo_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU * Return: Success: Pointer to in core representation * Failure: NULL * - * Programmer: John Mainzer - * 7/7/14 - * *------------------------------------------------------------------------- */ static void * @@ -973,33 +931,33 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); fspace = udata->fspace; - HDassert(fspace); - HDassert(fspace->sect_size == len); - HDassert(dirty); + assert(fspace); + assert(fspace->sect_size == len); + assert(dirty); /* Allocate a new free space section info */ if (NULL == (sinfo = H5FS__sinfo_new(udata->f, fspace))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* initialize old_sect_size */ H5_CHECKED_ASSIGN(old_sect_size, size_t, fspace->sect_size, hsize_t); /* Magic number */ - if (HDmemcmp(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections signature") + if (memcmp(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5FS_SINFO_VERSION) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections version") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections version"); /* Address of free space header for these sections */ H5F_addr_decode(udata->f, &image, &fs_addr); - if (H5F_addr_ne(fs_addr, fspace->addr)) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect header address for free space sections") + if (H5_addr_ne(fs_addr, fspace->addr)) + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect header address for free space sections"); /* Check for any serialized sections */ if (fspace->serial_sect_count > 0) { @@ -1031,11 +989,11 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l /* The number of sections of this node's size */ UINT64DECODE_VAR(image, node_count, sect_cnt_size); - HDassert(node_count); + assert(node_count); /* The size of the sections for this node */ UINT64DECODE_VAR(image, sect_size, sinfo->sect_len_size); - HDassert(sect_size); + assert(sect_size); /* Loop over nodes of this size */ for (u = 0; u < node_count; u++) { @@ -1052,10 +1010,10 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l /* Call 'deserialize' callback for this section */ des_flags = 0; - HDassert(fspace->sect_cls[sect_type].deserialize); + assert(fspace->sect_cls[sect_type].deserialize); if (NULL == (new_sect = (*fspace->sect_cls[sect_type].deserialize)( &fspace->sect_cls[sect_type], image, sect_addr, sect_size, &des_flags))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTDECODE, NULL, "can't deserialize section") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTDECODE, NULL, "can't deserialize section"); /* Update offset in serialization image */ image += fspace->sect_cls[sect_type].serial_size; @@ -1064,7 +1022,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l if (!(des_flags & H5FS_DESERIALIZE_NO_ADD)) if (H5FS_sect_add(udata->f, fspace, new_sect, H5FS_ADD_DESERIALIZING, udata) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, NULL, - "can't add section to free space manager") + "can't add section to free space manager"); } /* end for */ if (fspace->tot_sect_count == old_tot_sect_count) @@ -1073,12 +1031,12 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l } while (image < (((const uint8_t *)_image + old_sect_size) - H5FS_SIZEOF_CHKSUM)); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) <= (old_sect_size - H5FS_SIZEOF_CHKSUM)); - HDassert(old_sect_size == fspace->sect_size); - HDassert(old_tot_sect_count == fspace->tot_sect_count); - HDassert(old_serial_sect_count == fspace->serial_sect_count); - HDassert(old_ghost_sect_count == fspace->ghost_sect_count); - HDassert(old_tot_space == fspace->tot_space); + assert((size_t)(image - (const uint8_t *)_image) <= (old_sect_size - H5FS_SIZEOF_CHKSUM)); + assert(old_sect_size == fspace->sect_size); + assert(old_tot_sect_count == fspace->tot_sect_count); + assert(old_serial_sect_count == fspace->serial_sect_count); + assert(old_ghost_sect_count == fspace->ghost_sect_count); + assert(old_tot_space == fspace->tot_space); } /* end if */ /* checksum verification already done in verify_chksum cb */ @@ -1089,8 +1047,8 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l UINT32DECODE(chksum_image, stored_chksum); /* Sanity check */ - HDassert((image == chksum_image) || - ((size_t)((image - (const uint8_t *)_image) + (chksum_image - image)) == old_sect_size)); + assert((image == chksum_image) || + ((size_t)((image - (const uint8_t *)_image) + (chksum_image - image)) == old_sect_size)); /* Set return value */ ret_value = sinfo; @@ -1098,7 +1056,7 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l done: if (!ret_value && sinfo) if (H5FS__sinfo_dest(sinfo) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space info") + HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FS__cache_sinfo_deserialize() */ @@ -1111,9 +1069,6 @@ H5FS__cache_sinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 14, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1124,13 +1079,11 @@ H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(sinfo); - HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - HDassert(sinfo->fspace); - HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(image_len); + assert(sinfo); + assert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); + assert(sinfo->fspace); + assert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); + assert(image_len); /* Set the image length size */ H5_CHECKED_ASSIGN(*image_len, size_t, sinfo->fspace->alloc_sect_size, hsize_t); @@ -1149,9 +1102,6 @@ H5FS__cache_sinfo_image_len(const void *_thing, size_t *image_len) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/7/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1166,51 +1116,49 @@ H5FS__cache_sinfo_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(sinfo); - HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); + assert(f); + assert(sinfo); + assert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); fspace = sinfo->fspace; - HDassert(fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(fspace->cache_info.is_pinned); - HDassert(H5F_addr_defined(addr)); - HDassert(H5F_addr_eq(fspace->sect_addr, addr)); - HDassert(fspace->sect_size == len); - HDassert(new_addr); - HDassert(new_len); - HDassert(flags); + assert(fspace->cache_info.type == H5AC_FSPACE_HDR); + assert(fspace->cache_info.is_pinned); + assert(H5_addr_defined(addr)); + assert(H5_addr_eq(fspace->sect_addr, addr)); + assert(fspace->sect_size == len); + assert(new_addr); + assert(new_len); + assert(flags); sinfo_addr = addr; /* this will change if we relocate the section data */ /* Check for section info at temporary address */ if (H5F_IS_TMP_ADDR(f, fspace->sect_addr)) { /* Sanity check */ - HDassert(fspace->sect_size > 0); - HDassert(H5F_addr_eq(fspace->sect_addr, addr)); + assert(fspace->sect_size > 0); + assert(H5_addr_eq(fspace->sect_addr, addr)); /* Allocate space for the section info in file */ if (HADDR_UNDEF == (sinfo_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FSPACE_SINFO, fspace->sect_size))) - HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for free space sections"); fspace->alloc_sect_size = (size_t)fspace->sect_size; /* Sanity check */ - HDassert(!H5F_addr_eq(sinfo->fspace->sect_addr, sinfo_addr)); + assert(!H5_addr_eq(sinfo->fspace->sect_addr, sinfo_addr)); /* Let the metadata cache know the section info moved */ if (H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, sinfo->fspace->sect_addr, sinfo_addr) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMOVE, FAIL, "unable to move section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMOVE, FAIL, "unable to move section info"); /* Update the internal address for the section info */ sinfo->fspace->sect_addr = sinfo_addr; /* Mark free space header as dirty */ if (H5AC_mark_entry_dirty(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty"); } /* end if */ - if (!H5F_addr_eq(addr, sinfo_addr)) { + if (!H5_addr_eq(addr, sinfo_addr)) { *new_addr = sinfo_addr; *flags = H5C__SERIALIZE_MOVED_FLAG; } /* end if */ @@ -1232,9 +1180,6 @@ H5FS__cache_sinfo_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5_ * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1251,16 +1196,14 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, void *_thi FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(image); - HDassert(sinfo); - HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(sinfo->fspace->cache_info.is_pinned); - HDassert(sinfo->fspace->sect_size == len); - HDassert(sinfo->fspace->sect_cls); + assert(f); + assert(image); + assert(sinfo); + assert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); + assert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); + assert(sinfo->fspace->cache_info.is_pinned); + assert(sinfo->fspace->sect_size == len); + assert(sinfo->fspace->sect_cls); /* Magic number */ H5MM_memcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -1283,7 +1226,7 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, void *_thi if (sinfo->bins[bin].bin_list) /* Iterate over list of section size nodes for bin */ if (H5SL_iterate(sinfo->bins[bin].bin_list, H5FS__sinfo_serialize_node_cb, &udata) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section size nodes") + HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section size nodes"); /* Compute checksum */ @@ -1294,9 +1237,9 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, void *_thi UINT32ENCODE(chksum_image, metadata_chksum); /* Sanity check */ - HDassert((chksum_image == image) || - ((size_t)((image - (uint8_t *)_image) + (chksum_image - image)) == sinfo->fspace->sect_size)); - HDassert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size); + assert((chksum_image == image) || + ((size_t)((image - (uint8_t *)_image) + (chksum_image - image)) == sinfo->fspace->sect_size)); + assert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1309,9 +1252,6 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, void *_thi * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -1323,7 +1263,7 @@ H5FS__cache_sinfo_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(sinfo); + assert(sinfo); /* Check if the file was opened with SWMR-write access */ if (sinfo->fspace->swmr_write) { @@ -1336,7 +1276,7 @@ H5FS__cache_sinfo_notify(H5AC_notify_action_t action, void *_thing) HGOTO_ERROR( H5E_FSPACE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency between data block and header, address = %llu", - (unsigned long long)sinfo->fspace->sect_addr) + (unsigned long long)sinfo->fspace->sect_addr); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -1352,14 +1292,14 @@ H5FS__cache_sinfo_notify(H5AC_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Destroy flush dependency on parent */ if (H5FS__destroy_flush_depend((H5AC_info_t *)sinfo->fspace, (H5AC_info_t *)sinfo) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); break; default: #ifdef NDEBUG - HGOTO_ERROR(H5E_FSPACE, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_FSPACE, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); #else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); + assert(0 && "Unknown action?!?"); #endif /* NDEBUG */ } /* end switch */ } /* end if */ @@ -1374,16 +1314,9 @@ H5FS__cache_sinfo_notify(H5AC_notify_action_t action, void *_thing) * Purpose: Free the memory used for the in core representation of the * free space manager section info. * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1395,16 +1328,14 @@ H5FS__cache_sinfo_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(sinfo); - HDassert(sinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); - HDassert(sinfo->fspace->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); - HDassert(sinfo->fspace->cache_info.is_pinned); + assert(sinfo); + assert(sinfo->cache_info.type == H5AC_FSPACE_SINFO); + assert(sinfo->fspace->cache_info.type == H5AC_FSPACE_HDR); + assert(sinfo->fspace->cache_info.is_pinned); /* Destroy free space info */ if (H5FS__sinfo_dest(sinfo) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to destroy free space info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1418,9 +1349,6 @@ H5FS__cache_sinfo_free_icr(void *_thing) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, May 8, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1434,9 +1362,9 @@ H5FS__sinfo_serialize_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect); - HDassert(udata->sinfo); - HDassert(udata->image); + assert(sect); + assert(udata->sinfo); + assert(udata->image); /* Get section's class */ sect_cls = &udata->sinfo->fspace->sect_cls[sect->type]; @@ -1452,13 +1380,13 @@ H5FS__sinfo_serialize_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat /* Call 'serialize' callback for this section */ if (sect_cls->serialize) { if ((*sect_cls->serialize)(sect_cls, sect, *udata->image) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSERIALIZE, FAIL, "can't synchronize section") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTSERIALIZE, FAIL, "can't synchronize section"); /* Update offset in serialization buffer */ (*udata->image) += sect_cls->serial_size; } /* end if */ else - HDassert(sect_cls->serial_size == 0); + assert(sect_cls->serial_size == 0); } /* end if */ done: @@ -1473,9 +1401,6 @@ H5FS__sinfo_serialize_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, May 8, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1488,9 +1413,9 @@ H5FS__sinfo_serialize_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(fspace_node); - HDassert(udata->sinfo); - HDassert(udata->image); + assert(fspace_node); + assert(udata->sinfo); + assert(udata->image); /* Check if this node has any serializable sections */ if (fspace_node->serial_count > 0) { @@ -1501,9 +1426,9 @@ H5FS__sinfo_serialize_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udat UINT64ENCODE_VAR(*udata->image, fspace_node->sect_size, udata->sinfo->sect_len_size); /* Iterate through all the sections of this size */ - HDassert(fspace_node->sect_list); + assert(fspace_node->sect_list); if (H5SL_iterate(fspace_node->sect_list, H5FS__sinfo_serialize_sect_cb, udata) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section nodes") + HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section nodes"); } /* end if */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FSdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FSdbg.c index 16e9541250..5105032a05 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FSdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FSdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5FSdbg.c - * May 9 2006 - * Quincey Koziol * * Purpose: Dump debugging information about a free space manager * @@ -74,9 +71,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 9 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -91,11 +85,11 @@ H5FS_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Initialize user data for protecting the free space manager */ cache_udata.f = f; @@ -109,44 +103,44 @@ H5FS_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) */ if (NULL == (fspace = (H5FS_t *)H5AC_protect(f, H5AC_FSPACE_HDR, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header"); /* Print opening message */ - HDfprintf(stream, "%*sFree Space Header...\n", indent, ""); + fprintf(stream, "%*sFree Space Header...\n", indent, ""); /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Free space client:", - (fspace->client == H5FS_CLIENT_FHEAP_ID - ? "Fractal heap" - : (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Total free space tracked:", fspace->tot_space); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Total number of free space sections tracked:", fspace->tot_sect_count); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Number of serializable free space sections tracked:", fspace->serial_sect_count); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Number of ghost free space sections tracked:", fspace->ghost_sect_count); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Number of free space section classes:", (unsigned)fspace->nclasses); - HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, "Shrink percent:", fspace->shrink_percent); - HDfprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, "Expand percent:", fspace->expand_percent); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "# of bits for section address space:", fspace->max_sect_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Maximum section size:", fspace->max_sect_size); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Serialized sections address:", fspace->sect_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Serialized sections size used:", fspace->sect_size); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Serialized sections size allocated:", fspace->alloc_sect_size); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Free space client:", + (fspace->client == H5FS_CLIENT_FHEAP_ID + ? "Fractal heap" + : (fspace->client == H5FS_CLIENT_FILE_ID ? "File" : "Unknown"))); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Total free space tracked:", fspace->tot_space); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Total number of free space sections tracked:", fspace->tot_sect_count); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of serializable free space sections tracked:", fspace->serial_sect_count); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Number of ghost free space sections tracked:", fspace->ghost_sect_count); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Number of free space section classes:", (unsigned)fspace->nclasses); + fprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, "Shrink percent:", fspace->shrink_percent); + fprintf(stream, "%*s%-*s %u%%\n", indent, "", fwidth, "Expand percent:", fspace->expand_percent); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "# of bits for section address space:", fspace->max_sect_addr); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Maximum section size:", fspace->max_sect_size); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Serialized sections address:", fspace->sect_addr); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Serialized sections size used:", fspace->sect_size); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Serialized sections size allocated:", fspace->alloc_sect_size); done: if (fspace && H5AC_unprotect(f, H5AC_FSPACE_HDR, addr, fspace, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_PROTECT, FAIL, "unable to release free space header") + HDONE_ERROR(H5E_FSPACE, H5E_PROTECT, FAIL, "unable to release free space header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FS_debug() */ @@ -158,9 +152,6 @@ H5FS_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 30 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -173,16 +164,16 @@ H5FS_sect_debug(const H5FS_t *fspace, const H5FS_section_info_t *sect, FILE *str /* * Check arguments. */ - HDassert(fspace); - HDassert(sect); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(fspace); + assert(sect); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Call the section's debugging routine */ if (fspace->sect_cls[sect->type].debug) if ((fspace->sect_cls[sect->type].debug)(sect, stream, indent, fwidth) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't dump section's debugging info") + HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't dump section's debugging info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -195,9 +186,6 @@ H5FS_sect_debug(const H5FS_t *fspace, const H5FS_section_info_t *sect, FILE *str * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 9 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -214,13 +202,13 @@ H5FS_sects_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(H5F_addr_defined(fs_addr)); - HDassert(H5F_addr_defined(client_addr)); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(H5_addr_defined(fs_addr)); + assert(H5_addr_defined(client_addr)); /* Initialize user data for protecting the free space manager */ cache_udata.f = f; @@ -234,7 +222,7 @@ H5FS_sects_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent */ if (NULL == (fspace = (H5FS_t *)H5AC_protect(f, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, FAIL, "unable to load free space header"); /* Retrieve the client id */ client = fspace->client; @@ -244,11 +232,11 @@ H5FS_sects_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent * and reloaded later, with the correct client information -QAK) */ if (H5AC_unprotect(f, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__DELETED_FLAG) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_PROTECT, FAIL, "unable to release free space header") + HDONE_ERROR(H5E_FSPACE, H5E_PROTECT, FAIL, "unable to release free space header"); fspace = NULL; /* Print opening message */ - HDfprintf(stream, "%*sFree Space Sections...\n", indent, ""); + fprintf(stream, "%*sFree Space Sections...\n", indent, ""); /* * Print the values. @@ -256,23 +244,23 @@ H5FS_sects_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int indent switch (client) { case H5FS_CLIENT_FHEAP_ID: if (H5HF_sects_debug(f, client_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump fractal heap free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump fractal heap free space sections"); break; case H5FS_CLIENT_FILE_ID: if (H5MF_sects_debug(f, fs_addr, stream, indent + 3, MAX(0, fwidth - 3)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_SYSTEM, FAIL, "unable to dump file free space sections"); break; case H5FS_NUM_CLIENT_ID: default: - HDfprintf(stream, "Unknown client!\n"); + fprintf(stream, "Unknown client!\n"); break; } /* end switch */ done: if (fspace && H5AC_unprotect(f, H5AC_FSPACE_HDR, fs_addr, fspace, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_PROTECT, FAIL, "unable to release free space header") + HDONE_ERROR(H5E_FSPACE, H5E_PROTECT, FAIL, "unable to release free space header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5FS_sects_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FSint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FSint.c index d7950ab4b2..da9f9b8583 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FSint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FSint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5FSint.c - * Fall 2012 - * Dana Robinson * * Purpose: Internal routines for free space managers. * @@ -74,9 +71,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -87,12 +81,12 @@ H5FS__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(parent_entry); - HDassert(child_entry); + assert(parent_entry); + assert(child_entry); /* Create a flush dependency between parent and child entry */ if (H5AC_create_flush_dependency(parent_entry, child_entry) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -105,9 +99,6 @@ H5FS__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -118,12 +109,12 @@ H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry) FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(parent_entry); - HDassert(child_entry); + assert(parent_entry); + assert(child_entry); /* Destroy a flush dependency between parent and child entry */ if (H5AC_destroy_flush_dependency(parent_entry, child_entry) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FSsection.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FSsection.c index 96707190ce..7889f76ae1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FSsection.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FSsection.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Monday, July 31, 2006 - * * Purpose: Free space tracking functions. * */ @@ -106,9 +102,6 @@ H5FL_DEFINE(H5FS_sinfo_t); * Return: Success: non-NULL, pointer to new section info struct * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, July 31, 2006 - * *------------------------------------------------------------------------- */ H5FS_sinfo_t * @@ -120,15 +113,15 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(f); - HDassert(fspace); + assert(f); + assert(fspace); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->addr = %" PRIuHADDR "\n", __func__, fspace->addr); + fprintf(stderr, "%s: fspace->addr = %" PRIuHADDR "\n", __func__, fspace->addr); #endif /* H5FS_SINFO_DEBUG */ /* Allocate the free space header */ if (NULL == (sinfo = H5FL_CALLOC(H5FS_sinfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Set non-zero values */ sinfo->nbins = H5VM_log2_gen(fspace->max_sect_size); @@ -136,26 +129,26 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8; sinfo->sect_len_size = H5VM_limit_enc_size((uint64_t)fspace->max_sect_size); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->max_sect_size = %" PRIuHSIZE "\n", __func__, fspace->max_sect_size); - HDfprintf(stderr, "%s: fspace->max_sect_addr = %u\n", __func__, fspace->max_sect_addr); - HDfprintf(stderr, "%s: sinfo->nbins = %u\n", __func__, sinfo->nbins); - HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", __func__, - sinfo->sect_off_size, sinfo->sect_len_size); + fprintf(stderr, "%s: fspace->max_sect_size = %" PRIuHSIZE "\n", __func__, fspace->max_sect_size); + fprintf(stderr, "%s: fspace->max_sect_addr = %u\n", __func__, fspace->max_sect_addr); + fprintf(stderr, "%s: sinfo->nbins = %u\n", __func__, sinfo->nbins); + fprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", __func__, + sinfo->sect_off_size, sinfo->sect_len_size); #endif /* H5FS_SINFO_DEBUG */ /* Allocate space for the section size bins */ if (NULL == (sinfo->bins = H5FL_SEQ_CALLOC(H5FS_bin_t, (size_t)sinfo->nbins))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for free space section bin array") + "memory allocation failed for free space section bin array"); /* Increment the reference count on the free space manager header */ if (H5FS__incr(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINC, NULL, "unable to increment ref. count on free space header"); sinfo->fspace = fspace; /* Link free space manager to section info */ /* (for deserializing sections) */ - HDassert(fspace->sinfo == NULL); + assert(fspace->sinfo == NULL); fspace->sinfo = sinfo; /* Set return value */ @@ -186,9 +179,6 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Thursday, February 7, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -200,20 +190,20 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) FUNC_ENTER_PACKAGE #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, - "%s: Called, fspace->addr = %" PRIuHADDR ", fspace->sinfo = %p, fspace->sect_addr = %" PRIuHADDR - "\n", - __func__, fspace->addr, (void *)fspace->sinfo, fspace->sect_addr); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %" PRIuHSIZE ", fspace->sect_size = %" PRIuHSIZE "\n", - __func__, fspace->alloc_sect_size, fspace->sect_size); + fprintf(stderr, + "%s: Called, fspace->addr = %" PRIuHADDR ", fspace->sinfo = %p, fspace->sect_addr = %" PRIuHADDR + "\n", + __func__, fspace->addr, (void *)fspace->sinfo, fspace->sect_addr); + fprintf(stderr, "%s: fspace->alloc_sect_size = %" PRIuHSIZE ", fspace->sect_size = %" PRIuHSIZE "\n", + __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ /* Check arguments. */ - HDassert(f); - HDassert(fspace); + assert(f); + assert(fspace); /* only H5AC__READ_ONLY_FLAG may appear in accmode */ - HDassert((accmode & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((accmode & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* If the free space header doesn't already "own" the section info, load * section info or create it @@ -222,7 +212,7 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) /* Check if the section info was protected & we want a different access mode */ /* only H5AC__READ_ONLY_FLAG may appear in fspace->sinfo_accmode */ - HDassert(((fspace->sinfo_accmode) & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert(((fspace->sinfo_accmode) & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); if (fspace->sinfo_protected && accmode != fspace->sinfo_accmode) { /* Check if we need to switch from read-only access to read-write */ @@ -231,14 +221,14 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) if (H5AC_unprotect(f, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, - "unable to release free space section info") + "unable to release free space section info"); /* Re-protect the section info with read-write access */ cache_udata.f = f; cache_udata.fspace = fspace; if (NULL == (fspace->sinfo = (H5FS_sinfo_t *)H5AC_protect( f, H5AC_FSPACE_SINFO, fspace->sect_addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to load free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to load free space sections"); /* Switch the access mode we have */ fspace->sinfo_accmode = H5AC__NO_FLAGS_SET; @@ -247,21 +237,21 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) } /* end if */ else { /* If the section address is defined, load it from the file */ - if (H5F_addr_defined(fspace->sect_addr)) { + if (H5_addr_defined(fspace->sect_addr)) { /* Sanity check */ - HDassert(fspace->sinfo_protected == FALSE); - HDassert(H5F_addr_defined(fspace->addr)); + assert(fspace->sinfo_protected == FALSE); + assert(H5_addr_defined(fspace->addr)); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %" PRIuHADDR "\n", - __func__, fspace->sect_addr); + fprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %" PRIuHADDR "\n", + __func__, fspace->sect_addr); #endif /* H5FS_SINFO_DEBUG */ /* Protect the free space sections */ cache_udata.f = f; cache_udata.fspace = fspace; if (NULL == (fspace->sinfo = (H5FS_sinfo_t *)H5AC_protect(f, H5AC_FSPACE_SINFO, fspace->sect_addr, &cache_udata, accmode))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to load free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, FAIL, "unable to load free space sections"); /* Remember that we protected the section info & the access mode */ fspace->sinfo_protected = TRUE; @@ -269,34 +259,34 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) } /* end if */ else { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Creating new section info\n", __func__); + fprintf(stderr, "%s: Creating new section info\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Sanity check */ - HDassert(fspace->tot_sect_count == 0); - HDassert(fspace->serial_sect_count == 0); - HDassert(fspace->ghost_sect_count == 0); + assert(fspace->tot_sect_count == 0); + assert(fspace->serial_sect_count == 0); + assert(fspace->ghost_sect_count == 0); /* Allocate and initialize free space section info */ if (NULL == (fspace->sinfo = H5FS__sinfo_new(f, fspace))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create section info"); /* Set initial size of section info to 0 */ fspace->sect_size = fspace->alloc_sect_size = 0; } /* end if */ } /* end if */ - HDassert(fspace->rc == 2); + assert(fspace->rc == 2); /* Increment the section info lock count */ fspace->sinfo_lock_count++; done: #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, - "%s: Leaving, fspace->addr = %" PRIuHADDR - ", fspace->sinfo = %p, fspace->sect_addr = %" PRIuHADDR "\n", - __func__, fspace->addr, (void *)fspace->sinfo, fspace->sect_addr); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %" PRIuHSIZE ", fspace->sect_size = %" PRIuHSIZE "\n", - __func__, fspace->alloc_sect_size, fspace->sect_size); + fprintf(stderr, + "%s: Leaving, fspace->addr = %" PRIuHADDR ", fspace->sinfo = %p, fspace->sect_addr = %" PRIuHADDR + "\n", + __func__, fspace->addr, (void *)fspace->sinfo, fspace->sect_addr); + fprintf(stderr, "%s: fspace->alloc_sect_size = %" PRIuHSIZE ", fspace->sect_size = %" PRIuHSIZE "\n", + __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sinfo_lock() */ @@ -323,9 +313,6 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Thursday, February 7, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -335,29 +322,27 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) FUNC_ENTER_PACKAGE #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, - "%s: Called, modified = %d, fspace->addr = %" PRIuHADDR ", fspace->sect_addr = %" PRIuHADDR - "\n", - __func__, modified, fspace->addr, fspace->sect_addr); - HDfprintf( - stderr, - "%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %d, fspace->sinfo_protected = %d\n", - __func__, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %" PRIuHSIZE ", fspace->sect_size = %" PRIuHSIZE "\n", - __func__, fspace->alloc_sect_size, fspace->sect_size); + fprintf(stderr, + "%s: Called, modified = %d, fspace->addr = %" PRIuHADDR ", fspace->sect_addr = %" PRIuHADDR "\n", + __func__, modified, fspace->addr, fspace->sect_addr); + fprintf(stderr, + "%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %d, fspace->sinfo_protected = %d\n", + __func__, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected); + fprintf(stderr, "%s: fspace->alloc_sect_size = %" PRIuHSIZE ", fspace->sect_size = %" PRIuHSIZE "\n", + __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ /* Check arguments. */ - HDassert(f); - HDassert(fspace); - HDassert(fspace->rc == 2); - HDassert(fspace->sinfo); + assert(f); + assert(fspace); + assert(fspace->rc == 2); + assert(fspace->sinfo); /* Check if we modified any section */ if (modified) { /* Check if the section info was protected with a different access mode */ if (fspace->sinfo_protected && (0 != ((fspace->sinfo_accmode) & H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTDIRTY, FAIL, "attempt to modify read-only section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTDIRTY, FAIL, "attempt to modify read-only section info"); /* If we modified the section info, mark it dirty */ fspace->sinfo->dirty = TRUE; @@ -369,7 +354,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) * and mark that dirty also */ if (H5FS__dirty(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, "unable to mark free space header as dirty"); } /* end if */ /* Decrement the lock count on the section info */ @@ -384,14 +369,14 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) /* Check whether cache-flush is in progress if closing is not. */ if (!closing_or_flushing && H5AC_get_cache_flush_in_progress(f->shared->cache, &closing_or_flushing) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get flush_in_progress") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get flush_in_progress"); /* Check if we actually protected the section info */ if (fspace->sinfo_protected) { unsigned cache_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting heap */ /* Sanity check */ - HDassert(H5F_addr_defined(fspace->addr)); + assert(H5_addr_defined(fspace->addr)); /* Check if we've made new changes to the section info while locked */ if (fspace->sinfo_modified) { @@ -413,16 +398,16 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) } /* end if */ /* Sanity check */ - HDassert(H5F_addr_defined(fspace->sect_addr)); + assert(H5_addr_defined(fspace->sect_addr)); /* Unprotect section info in cache */ /* (Possibly dirty) */ /* (Possibly taking ownership from the cache) */ #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Unprotecting section info, cache_flags = %u\n", __func__, cache_flags); + fprintf(stderr, "%s: Unprotecting section info, cache_flags = %u\n", __func__, cache_flags); #endif /* H5FS_SINFO_DEBUG */ if (H5AC_unprotect(f, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info"); /* Reset the protected flag on the section info */ fspace->sinfo_protected = FALSE; @@ -430,14 +415,14 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) /* Check if header is taking ownership of section info */ if ((cache_flags & H5AC__TAKE_OWNERSHIP_FLAG)) { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Taking ownership of section info\n", __func__); + fprintf(stderr, "%s: Taking ownership of section info\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Set flag to release section info space in file */ release_sinfo_space = TRUE; } /* end if */ else { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Relinquishing section info ownership\n", __func__); + fprintf(stderr, "%s: Relinquishing section info ownership\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Free space header relinquished ownership of section info */ fspace->sinfo = NULL; @@ -447,7 +432,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) /* Check if the section info was modified */ if (fspace->sinfo_modified) { /* Check if we need to release section info in the file */ - if (H5F_addr_defined(fspace->sect_addr)) { + if (H5_addr_defined(fspace->sect_addr)) { /* Set flag to release section info space in file */ /* On file close or flushing, only need to release section info with size bigger than previous section */ @@ -461,15 +446,15 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) release_sinfo_space = TRUE; } else - HDassert(fspace->alloc_sect_size == 0); + assert(fspace->alloc_sect_size == 0); } /* end if */ else { /* Sanity checks... */ - if (H5F_addr_defined(fspace->sect_addr)) - HDassert(fspace->alloc_sect_size == fspace->sect_size); + if (H5_addr_defined(fspace->sect_addr)) + assert(fspace->alloc_sect_size == fspace->sect_size); else - HDassert(fspace->alloc_sect_size == 0); + assert(fspace->alloc_sect_size == 0); } /* end else */ } /* end else */ @@ -482,7 +467,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) hsize_t old_alloc_sect_size = fspace->alloc_sect_size; /* Previous size of section info in file */ /* Sanity check */ - HDassert(H5F_addr_defined(fspace->addr)); + assert(H5_addr_defined(fspace->addr)); /* Reset section info in header */ fspace->sect_addr = HADDR_UNDEF; @@ -492,24 +477,24 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) if (!modified) if (H5FS__dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, - "unable to mark free space header as dirty") + "unable to mark free space header as dirty"); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, - "%s: Freeing section info on disk, old_sect_addr = %" PRIuHADDR - ", old_alloc_sect_size = %" PRIuHSIZE "\n", - __func__, old_sect_addr, old_alloc_sect_size); + fprintf(stderr, + "%s: Freeing section info on disk, old_sect_addr = %" PRIuHADDR + ", old_alloc_sect_size = %" PRIuHSIZE "\n", + __func__, old_sect_addr, old_alloc_sect_size); #endif /* H5FS_SINFO_DEBUG */ /* Release space for section info in file */ if (!H5F_IS_TMP_ADDR(f, old_sect_addr)) if (H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, old_sect_addr, old_alloc_sect_size) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections"); } /* end if */ } /* end if */ done: #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); + fprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sinfo_unlock() */ @@ -521,9 +506,6 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, May 8, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -532,7 +514,7 @@ H5FS__sect_serialize_size(H5FS_t *fspace) FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(fspace); + assert(fspace); /* Compute the size of the buffer required to serialize all the sections */ if (fspace->serial_sect_count > 0) { @@ -575,9 +557,6 @@ H5FS__sect_serialize_size(H5FS_t *fspace) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, May 8, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -588,9 +567,9 @@ H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned fl FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(fspace); - HDassert(fspace->sinfo); - HDassert(cls); + assert(fspace); + assert(fspace->sinfo); + assert(cls); /* Increment total # of sections on free space list */ fspace->tot_sect_count++; @@ -598,7 +577,7 @@ H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned fl /* Check for serializable or 'ghost' section */ if (cls->flags & H5FS_CLS_GHOST_OBJ) { /* Sanity check */ - HDassert(cls->serial_size == 0); + assert(cls->serial_size == 0); /* Increment # of ghost sections */ fspace->ghost_sect_count++; @@ -614,7 +593,8 @@ H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned fl /* (if we're not deserializing the sections from disk) */ if (!(flags & H5FS_ADD_DESERIALIZING)) { if (H5FS__sect_serialize_size(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, + "can't adjust free space section size on disk"); } /* end if */ } /* end else */ @@ -630,9 +610,6 @@ H5FS__sect_increase(H5FS_t *fspace, const H5FS_section_class_t *cls, unsigned fl * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, May 8, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -643,9 +620,9 @@ H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(fspace); - HDassert(fspace->sinfo); - HDassert(cls); + assert(fspace); + assert(fspace->sinfo); + assert(cls); /* Decrement total # of sections in free space manager */ fspace->tot_sect_count--; @@ -653,7 +630,7 @@ H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) /* Check for serializable or 'ghost' section */ if (cls->flags & H5FS_CLS_GHOST_OBJ) { /* Sanity check */ - HDassert(cls->serial_size == 0); + assert(cls->serial_size == 0); /* Decrement # of ghost sections */ fspace->ghost_sect_count--; @@ -667,7 +644,7 @@ H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) /* Update the free space sections' serialized size */ if (H5FS__sect_serialize_size(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk"); } /* end else */ done: @@ -681,9 +658,6 @@ H5FS__sect_decrease(H5FS_t *fspace, const H5FS_section_class_t *cls) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -695,9 +669,9 @@ H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sinfo); - HDassert(fspace_node); - HDassert(cls); + assert(sinfo); + assert(fspace_node); + assert(cls); /* Decrement the # of sections in this bin */ /* (Different from the # of items in the bin's skiplist, since each node on @@ -735,17 +709,17 @@ H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node H5FS_node_t *tmp_fspace_node; /* Free space list size node */ /* Sanity checks */ - HDassert(fspace_node->ghost_count == 0); - HDassert(fspace_node->serial_count == 0); + assert(fspace_node->ghost_count == 0); + assert(fspace_node->serial_count == 0); /* Remove size tracking list from bin */ tmp_fspace_node = (H5FS_node_t *)H5SL_remove(sinfo->bins[bin].bin_list, &fspace_node->sect_size); if (tmp_fspace_node == NULL || tmp_fspace_node != fspace_node) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space node from skip list"); /* Destroy skip list for size tracking node */ if (H5SL_close(fspace_node->sect_list) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy size tracking node's skip list") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, "can't destroy size tracking node's skip list"); /* Release free space list node */ fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); @@ -766,9 +740,6 @@ H5FS__size_node_decr(H5FS_sinfo_t *sinfo, unsigned bin, H5FS_node_t *fspace_node * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -782,29 +753,29 @@ H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5F FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sinfo); - HDassert(sinfo->bins); - HDassert(sect); - HDassert(cls); + assert(sinfo); + assert(sinfo->bins); + assert(sect); + assert(cls); /* Determine correct bin which holds items of at least the section's size */ bin = H5VM_log2_gen(sect->size); - HDassert(bin < sinfo->nbins); + assert(bin < sinfo->nbins); if (sinfo->bins[bin].bin_list == NULL) - HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "node's bin is empty?") + HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "node's bin is empty?"); /* Find space node for section's size */ if ((fspace_node = (H5FS_node_t *)H5SL_search(sinfo->bins[bin].bin_list, §->size)) == NULL) - HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section size node") + HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section size node"); /* Remove the section's node from the list */ tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace_node->sect_list, §->addr); if (tmp_sect_node == NULL || tmp_sect_node != sect) - HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") + HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list"); /* Decrement # of sections in section size node */ if (H5FS__size_node_decr(sinfo, bin, fspace_node, cls) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove free space size node from skip list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -819,9 +790,6 @@ H5FS__sect_unlink_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5F * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -832,10 +800,10 @@ H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_sec FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(fspace); - HDassert(fspace->sinfo); - HDassert(cls); - HDassert(sect); + assert(fspace); + assert(fspace->sinfo); + assert(cls); + assert(sect); /* Remove node from merge list, if it was entered there */ if (!(cls->flags & H5FS_CLS_SEPAR_OBJ)) { @@ -843,12 +811,12 @@ H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_sec tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace->sinfo->merge_list, §->addr); if (tmp_sect_node == NULL || tmp_sect_node != sect) - HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") + HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list"); } /* end if */ /* Update section info & check if we need less room for the serialized free space sections */ if (H5FS__sect_decrease(fspace, cls) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk"); /* Decrement amount of free space managed */ fspace->tot_space -= sect->size; @@ -864,9 +832,6 @@ H5FS__sect_unlink_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_sec * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -878,21 +843,22 @@ H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(fspace); - HDassert(fspace->sinfo); - HDassert(sect); + assert(fspace); + assert(fspace->sinfo); + assert(sect); /* Get section's class */ cls = &fspace->sect_cls[sect->type]; /* Remove node from size tracked data structures */ if (H5FS__sect_unlink_size(fspace->sinfo, cls, sect) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from size tracking data structures") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, + "can't remove section from size tracking data structures"); /* Update rest of free space manager data structures for node removal */ if (H5FS__sect_unlink_rest(fspace, cls, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, - "can't remove section from non-size tracking data structures") + "can't remove section from non-size tracking data structures"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -905,9 +871,6 @@ H5FS__sect_remove_real(H5FS_t *fspace, H5FS_section_info_t *sect) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -919,23 +882,23 @@ H5FS_sect_remove(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect) FUNC_ENTER_NOAPI_NOINIT /* Check arguments. */ - HDassert(f); - HDassert(fspace); - HDassert(sect); + assert(f); + assert(fspace); + assert(sect); /* Get a pointer to the section info */ if (H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info"); sinfo_valid = TRUE; /* Perform actual section removal */ if (H5FS__sect_remove_real(fspace, sect) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove section") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, "can't remove section"); done: /* Release the section info */ if (sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") + HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info"); FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_remove() */ @@ -947,9 +910,6 @@ H5FS_sect_remove(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, March 20, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -963,17 +923,17 @@ H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_ FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sinfo); - HDassert(sect); - HDassert(H5F_addr_defined(sect->addr)); - HDassert(sect->size); + assert(sinfo); + assert(sect); + assert(H5_addr_defined(sect->addr)); + assert(sect->size); /* Determine correct bin which holds items of the section's size */ bin = H5VM_log2_gen(sect->size); - HDassert(bin < sinfo->nbins); + assert(bin < sinfo->nbins); if (sinfo->bins[bin].bin_list == NULL) { if (NULL == (sinfo->bins[bin].bin_list = H5SL_create(H5SL_TYPE_HSIZE, NULL))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for free space nodes") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for free space nodes"); } /* end if */ else /* Check for node list of the correct size already */ @@ -983,18 +943,18 @@ H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_ if (fspace_node == NULL) { /* Allocate new free list size node */ if (NULL == (fspace_node = H5FL_MALLOC(H5FS_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for free space node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for free space node"); fspace_node_alloc = TRUE; /* Initialize the free list size node */ fspace_node->sect_size = sect->size; fspace_node->serial_count = fspace_node->ghost_count = 0; if (NULL == (fspace_node->sect_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for free space nodes") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, "can't create skip list for free space nodes"); /* Insert new free space size node into bin's list */ if (H5SL_insert(sinfo->bins[bin].bin_list, fspace_node, &fspace_node->sect_size) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into skip list") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into skip list"); fspace_node_alloc = FALSE; /* (owned by the bin skip list now, don't need to free on error) */ /* Increment number of section sizes */ @@ -1025,14 +985,14 @@ H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_ /* Insert free space node into correct skip list */ if (H5SL_insert(fspace_node->sect_list, sect, §->addr) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into skip list") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space node into skip list"); done: if (ret_value < 0) if (fspace_node && fspace_node_alloc) { if (fspace_node->sect_list && H5SL_close(fspace_node->sect_list) < 0) HDONE_ERROR(H5E_FSPACE, H5E_CANTCLOSEOBJ, FAIL, - "can't destroy size free space node's skip list") + "can't destroy size free space node's skip list"); fspace_node = H5FL_FREE(H5FS_node_t, fspace_node); } /* end if */ @@ -1047,9 +1007,6 @@ H5FS__sect_link_size(H5FS_sinfo_t *sinfo, const H5FS_section_class_t *cls, H5FS_ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1061,24 +1018,24 @@ H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_secti FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(fspace); - HDassert(fspace->sinfo); - HDassert(sect); + assert(fspace); + assert(fspace->sinfo); + assert(sect); /* Add section to the address-ordered list of sections, if allowed */ if (!(cls->flags & H5FS_CLS_SEPAR_OBJ)) { if (fspace->sinfo->merge_list == NULL) if (NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, - "can't create skip list for merging free space sections") + "can't create skip list for merging free space sections"); if (H5SL_insert(fspace->sinfo->merge_list, sect, §->addr) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, - "can't insert free space node into merging skip list") + "can't insert free space node into merging skip list"); } /* end if */ /* Update section info & check if we need more room for the serialized free space sections */ if (H5FS__sect_increase(fspace, cls, flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't increase free space section size on disk"); /* Increment amount of free space managed */ fspace->tot_space += sect->size; @@ -1094,9 +1051,6 @@ H5FS__sect_link_rest(H5FS_t *fspace, const H5FS_section_class_t *cls, H5FS_secti * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1108,21 +1062,21 @@ H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(fspace); - HDassert(fspace->sinfo); - HDassert(sect); + assert(fspace); + assert(fspace->sinfo); + assert(sect); /* Get section's class */ cls = &fspace->sect_cls[sect->type]; /* Add section to size tracked data structures */ if (H5FS__sect_link_size(fspace->sinfo, cls, sect) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to size tracking data structures") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't add section to size tracking data structures"); /* Update rest of free space manager data structures for section addition */ if (H5FS__sect_link_rest(fspace, cls, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, - "can't add section to non-size tracking data structures") + "can't add section to non-size tracking data structures"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1136,9 +1090,6 @@ H5FS__sect_link(H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flags) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1153,10 +1104,10 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(fspace); - HDassert(*sect); - HDassert(H5F_addr_defined((*sect)->addr)); - HDassert((*sect)->size); + assert(fspace); + assert(*sect); + assert(H5_addr_defined((*sect)->addr)); + assert((*sect)->size); /* Loop until no more merging */ if (fspace->sinfo->merge_list) { @@ -1194,19 +1145,19 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) tmp_sect_cls->can_merge) { /* Determine if the sections can merge */ if ((status = (*tmp_sect_cls->can_merge)(tmp_sect, *sect, op_data)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't check for merging sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't check for merging sections"); if (status > 0) { /* Sanity check */ - HDassert(tmp_sect_cls->merge); + assert(tmp_sect_cls->merge); /* Remove 'less than' node from data structures */ if (H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, - "can't remove section from internal data structures") + "can't remove section from internal data structures"); /* Merge the two sections together */ if ((*tmp_sect_cls->merge)(&tmp_sect, *sect, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't merge two sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't merge two sections"); /* Retarget section pointer to 'less than' node that was merged into */ *sect = tmp_sect; @@ -1241,19 +1192,19 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) /* Determine if the sections can merge */ if ((status = (*sect_cls->can_merge)(*sect, tmp_sect, op_data)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't check for merging sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't check for merging sections"); if (status > 0) { /* Sanity check */ - HDassert(sect_cls->merge); + assert(sect_cls->merge); /* Remove 'greater than' node from data structures */ if (H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, - "can't remove section from internal data structures") + "can't remove section from internal data structures"); /* Merge the two sections together */ if ((*sect_cls->merge)(sect, tmp_sect, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't merge two sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't merge two sections"); /* It's possible that the merge caused the section to be deleted (particularly in the * paged allocation case) */ @@ -1267,7 +1218,7 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) } /* end if */ } while (modified); } /* end if */ - HDassert(*sect); + assert(*sect); /* Loop until no more shrinking */ do { @@ -1278,22 +1229,22 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) sect_cls = &fspace->sect_cls[(*sect)->type]; if (sect_cls->can_shrink) { if ((status = (*sect_cls->can_shrink)(*sect, op_data)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container"); if (status > 0) { /* Remove SECT from free-space manager */ /* (only possible to happen on second+ pass through loop) */ if (remove_sect) { if (H5FS__sect_remove_real(fspace, *sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, - "can't remove section from internal data structures") + "can't remove section from internal data structures"); remove_sect = FALSE; } /* end if */ /* Shrink the container */ /* (callback can indicate that it has discarded the section by setting *sect to NULL) */ - HDassert(sect_cls->shrink); + assert(sect_cls->shrink); if ((*sect_cls->shrink)(sect, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container"); /* If this section was shrunk away, we may need to shrink another section */ if (*sect == NULL) { @@ -1305,7 +1256,7 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) if (NULL != (last_node = H5SL_last(fspace->sinfo->merge_list))) { /* Get the pointer to the last section, from the last node */ *sect = (H5FS_section_info_t *)H5SL_item(last_node); - HDassert(*sect); + assert(*sect); /* Indicate that this section needs to be removed if it causes a shrink */ remove_sect = TRUE; @@ -1334,9 +1285,6 @@ H5FS__sect_merge(H5FS_t *fspace, H5FS_section_info_t **sect, void *op_data) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, March 7, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1350,37 +1298,37 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag FUNC_ENTER_NOAPI(FAIL) #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: *sect = {%" PRIuHADDR ", %" PRIuHSIZE ", %u, %s}\n", __func__, sect->addr, - sect->size, sect->type, - (sect->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); + fprintf(stderr, "%s: *sect = {%" PRIuHADDR ", %" PRIuHSIZE ", %u, %s}\n", __func__, sect->addr, + sect->size, sect->type, + (sect->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); #endif /* H5FS_SINFO_DEBUG */ /* Check arguments. */ - HDassert(fspace); - HDassert(sect); - HDassert(H5F_addr_defined(sect->addr)); - HDassert(sect->size); + assert(fspace); + assert(sect); + assert(H5_addr_defined(sect->addr)); + assert(sect->size); /* Get a pointer to the section info */ if (H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info"); sinfo_valid = TRUE; /* Call "add" section class callback, if there is one */ cls = &fspace->sect_cls[sect->type]; if (cls->add) if ((*cls->add)(§, &flags, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "'add' section class callback failed") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "'add' section class callback failed"); /* Check for merging returned space with existing section node */ if (flags & H5FS_ADD_RETURNED_SPACE) { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Returning space\n", __func__); + fprintf(stderr, "%s: Returning space\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Attempt to merge returned section with existing sections */ if (H5FS__sect_merge(fspace, §, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections"); } /* end if */ /* Add new (possibly merged) node to free sections data structures */ @@ -1389,10 +1337,10 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag */ if (sect) if (H5FS__sect_link(fspace, sect, flags) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list"); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->tot_space = %" PRIuHSIZE "\n", __func__, fspace->tot_space); + fprintf(stderr, "%s: fspace->tot_space = %" PRIuHSIZE "\n", __func__, fspace->tot_space); #endif /* H5FS_SINFO_DEBUG */ /* Mark free space sections as changed */ /* (if adding sections while deserializing sections, don't set the flag) */ @@ -1402,14 +1350,14 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag done: /* Release the section info */ if (sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") + HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info"); #ifdef H5FS_DEBUG_ASSERT if (!(flags & (H5FS_ADD_DESERIALIZING | H5FS_ADD_SKIP_VALID))) H5FS__assert(fspace); #endif /* H5FS_DEBUG_ASSERT */ #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); + fprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_add() */ @@ -1421,9 +1369,6 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * *------------------------------------------------------------------------- */ htri_t @@ -1437,30 +1382,29 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize FUNC_ENTER_NOAPI(FAIL) #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: addr = %" PRIuHADDR ", size = %" PRIuHSIZE ", extra_requested = %" PRIuHSIZE "\n", - __func__, addr, size, extra_requested); + fprintf(stderr, "%s: addr = %" PRIuHADDR ", size = %" PRIuHSIZE ", extra_requested = %" PRIuHSIZE "\n", + __func__, addr, size, extra_requested); #endif /* H5FS_SINFO_DEBUG */ /* Check arguments. */ - HDassert(f); - HDassert(fspace); - HDassert(H5F_addr_defined(addr)); - HDassert(size > 0); - HDassert(extra_requested > 0); + assert(f); + assert(fspace); + assert(H5_addr_defined(addr)); + assert(size > 0); + assert(extra_requested > 0); /* Check for any sections on free space list */ #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->tot_sect_count = %" PRIuHSIZE "\n", __func__, fspace->tot_sect_count); - HDfprintf(stderr, "%s: fspace->serial_sect_count = %" PRIuHSIZE "\n", __func__, - fspace->serial_sect_count); - HDfprintf(stderr, "%s: fspace->ghost_sect_count = %" PRIuHSIZE "\n", __func__, fspace->ghost_sect_count); + fprintf(stderr, "%s: fspace->tot_sect_count = %" PRIuHSIZE "\n", __func__, fspace->tot_sect_count); + fprintf(stderr, "%s: fspace->serial_sect_count = %" PRIuHSIZE "\n", __func__, fspace->serial_sect_count); + fprintf(stderr, "%s: fspace->ghost_sect_count = %" PRIuHSIZE "\n", __func__, fspace->ghost_sect_count); #endif /* H5FS_SINFO_DEBUG */ if (fspace->tot_sect_count > 0) { H5FS_section_info_t *sect; /* Temporary free space section */ /* Get a pointer to the section info */ if (H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info"); sinfo_valid = TRUE; /* @@ -1496,7 +1440,7 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize /* Remove section from data structures */ if (H5FS__sect_remove_real(fspace, sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, - "can't remove section from internal data structures") + "can't remove section from internal data structures"); /* Get class for section */ cls = &fspace->sect_cls[sect->type]; @@ -1509,7 +1453,7 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize */ if (sect->size > extra_requested) { /* Sanity check (for now) */ - HDassert(cls->flags & H5FS_CLS_ADJUST_OK); + assert(cls->flags & H5FS_CLS_ADJUST_OK); /* Adjust section by amount requested */ sect->addr += extra_requested; @@ -1517,23 +1461,23 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize if (cls->add) if ((*cls->add)(§, &flags, op_data) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, - "'add' section class callback failed") + "'add' section class callback failed"); /* Re-adding the section could cause it to disappear (particularly when paging) */ if (sect) { /* Re-add adjusted section to free sections data structures */ if (H5FS__sect_link(fspace, sect, 0) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, - "can't insert free space section into skip list") + "can't insert free space section into skip list"); } /* end if */ } /* end if */ else { /* Sanity check */ - HDassert(sect->size == extra_requested); + assert(sect->size == extra_requested); /* Exact match, so just free section */ if ((*cls->free)(sect) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't free section") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't free section"); } /* end else */ /* Note that we modified the section info */ @@ -1548,7 +1492,7 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize done: /* Release the section info */ if (sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") + HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info"); FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_try_extend() */ @@ -1562,9 +1506,6 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize * FALSE: not merged/not shrunk * Failure: negative * - * Programmer: Vailin Choi - * June 10, 2009 - * *------------------------------------------------------------------------- */ htri_t @@ -1578,42 +1519,42 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigne FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(f); - HDassert(fspace); - HDassert(sect); - HDassert(H5F_addr_defined(sect->addr)); - HDassert(sect->size); + assert(f); + assert(fspace); + assert(sect); + assert(H5_addr_defined(sect->addr)); + assert(sect->size); /* Get a pointer to the section info */ if (H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info"); sinfo_valid = TRUE; saved_fs_size = sect->size; /* Attempt to merge/shrink section with existing sections */ if (H5FS__sect_merge(fspace, §, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTMERGE, FAIL, "can't merge sections"); /* Check if section is shrunk and/or merged away completely */ if (!sect) { sinfo_modified = TRUE; - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ else { /* Check if section is merged */ if (sect->size != saved_fs_size) { if (H5FS__sect_link(fspace, sect, flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, - "can't insert free space section into skip list") + "can't insert free space section into skip list"); sinfo_modified = TRUE; - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ } /* end else */ done: /* Release the section info */ if (sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") + HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info"); FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_try_merge() */ @@ -1626,9 +1567,6 @@ H5FS_sect_try_merge(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigne * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, March 20, 2006 - * *------------------------------------------------------------------------- */ static htri_t @@ -1645,15 +1583,15 @@ H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(fspace); - HDassert(fspace->sinfo); - HDassert(fspace->sinfo->bins); - HDassert(request > 0); - HDassert(node); + assert(fspace); + assert(fspace->sinfo); + assert(fspace->sinfo->bins); + assert(request > 0); + assert(node); /* Determine correct bin which holds items of at least the section's size */ bin = H5VM_log2_gen(request); - HDassert(bin < fspace->sinfo->nbins); + assert(bin < fspace->sinfo->nbins); alignment = fspace->alignment; if (!((alignment > 1) && (request >= fspace->align_thres))) alignment = 0; /* no alignment */ @@ -1673,19 +1611,19 @@ H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node /* Take first node off of the list (ie. node w/lowest address) */ if (NULL == (*node = (H5FS_section_info_t *)H5SL_remove_first(fspace_node->sect_list))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, - "can't remove free space node from skip list") + "can't remove free space node from skip list"); /* Get section's class */ cls = &fspace->sect_cls[(*node)->type]; /* Decrement # of sections in section size node */ if (H5FS__size_node_decr(fspace->sinfo, bin, fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, - "can't remove free space size node from skip list") + "can't remove free space size node from skip list"); if (H5FS__sect_unlink_rest(fspace, cls, *node) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, - "can't remove section from non-size tracking data structures") + "can't remove section from non-size tracking data structures"); /* Indicate that we found a node for the request */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ } /* end if */ else { /* alignment is set */ @@ -1709,13 +1647,13 @@ H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node /* Get section node */ curr_sect = (H5FS_section_info_t *)H5SL_item(curr_sect_node); - HDassert(H5F_addr_defined(curr_sect->addr)); - HDassert(curr_fspace_node->sect_size == curr_sect->size); + assert(H5_addr_defined(curr_sect->addr)); + assert(curr_fspace_node->sect_size == curr_sect->size); cls = &fspace->sect_cls[curr_sect->type]; - HDassert(alignment); - HDassert(cls); + assert(alignment); + assert(cls); if ((mis_align = curr_sect->addr % alignment)) frag_size = alignment - mis_align; @@ -1725,15 +1663,15 @@ H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node if (NULL == (*node = (H5FS_section_info_t *)H5SL_remove( curr_fspace_node->sect_list, &curr_sect->addr))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, - "can't remove free space node from skip list") + "can't remove free space node from skip list"); /* Decrement # of sections in section size node */ if (H5FS__size_node_decr(fspace->sinfo, bin, curr_fspace_node, cls) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTREMOVE, FAIL, - "can't remove free space size node from skip list") + "can't remove free space size node from skip list"); if (H5FS__sect_unlink_rest(fspace, cls, *node) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, - "can't remove section from non-size tracking data structures") + "can't remove section from non-size tracking data structures"); /* * The split() callback splits NODE into 2 sections: @@ -1745,13 +1683,13 @@ H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node split_sect = cls->split(*node, frag_size); if ((H5FS__sect_link(fspace, split_sect, 0) < 0)) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, - "can't insert free space section into skip list") + "can't insert free space section into skip list"); /* sanity check */ - HDassert(split_sect->addr < (*node)->addr); - HDassert(request <= (*node)->size); + assert(split_sect->addr < (*node)->addr); + assert(request <= (*node)->size); } /* end if */ /* Indicate that we found a node for the request */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ /* Get the next section node in the list */ @@ -1779,9 +1717,6 @@ H5FS__sect_find_node(H5FS_t *fspace, hsize_t request, H5FS_section_info_t **node * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, March 7, 2006 - * *------------------------------------------------------------------------- */ htri_t @@ -1794,21 +1729,21 @@ H5FS_sect_find(H5F_t *f, H5FS_t *fspace, hsize_t request, H5FS_section_info_t ** FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(fspace); - HDassert(fspace->nclasses); - HDassert(request); - HDassert(node); + assert(fspace); + assert(fspace->nclasses); + assert(request); + assert(node); /* Check for any sections on free space list */ if (fspace->tot_sect_count > 0) { /* Get a pointer to the section info */ if (H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info"); sinfo_valid = TRUE; /* Look for node in bins */ if ((ret_value = H5FS__sect_find_node(fspace, request, node)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from bins") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "can't remove section from bins"); /* Decrement # of sections on free list, if we found an object */ if (ret_value > 0) { @@ -1820,7 +1755,7 @@ H5FS_sect_find(H5F_t *f, H5FS_t *fspace, hsize_t request, H5FS_section_info_t ** done: /* Release the section info */ if (sinfo_valid && H5FS__sinfo_unlock(f, fspace, sinfo_modified) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") + HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info"); #ifdef H5FS_DEBUG_ASSERT H5FS__assert(fspace); @@ -1836,9 +1771,6 @@ H5FS_sect_find(H5F_t *f, H5FS_t *fspace, hsize_t request, H5FS_section_info_t ** * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Saturday, May 13, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1851,13 +1783,13 @@ H5FS__iterate_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect_info); - HDassert(udata->fspace); - HDassert(udata->op); + assert(sect_info); + assert(udata->fspace); + assert(udata->op); /* Make callback for this section */ if ((*udata->op)(sect_info, udata->op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "iteration callback failed") + HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "iteration callback failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1871,9 +1803,6 @@ H5FS__iterate_sect_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Saturday, May 13, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1886,14 +1815,14 @@ H5FS__iterate_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(fspace_node); - HDassert(udata->fspace); - HDassert(udata->op); + assert(fspace_node); + assert(udata->fspace); + assert(udata->op); /* Iterate through all the sections of this size */ - HDassert(fspace_node->sect_list); + assert(fspace_node->sect_list); if (H5SL_iterate(fspace_node->sect_list, H5FS__iterate_sect_cb, udata) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section nodes") + HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section nodes"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1906,9 +1835,6 @@ H5FS__iterate_node_cb(void *_item, void H5_ATTR_UNUSED *key, void *_udata) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Saturday, May 13, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1921,8 +1847,8 @@ H5FS_sect_iterate(H5F_t *f, H5FS_t *fspace, H5FS_operator_t op, void *op_data) FUNC_ENTER_NOAPI_NOINIT /* Check arguments. */ - HDassert(fspace); - HDassert(op); + assert(fspace); + assert(op); /* Set up user data for iterator */ udata.fspace = fspace; @@ -1935,7 +1861,7 @@ H5FS_sect_iterate(H5F_t *f, H5FS_t *fspace, H5FS_operator_t op, void *op_data) /* Get a pointer to the section info */ if (H5FS__sinfo_lock(f, fspace, H5AC__READ_ONLY_FLAG) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info"); sinfo_valid = TRUE; /* Iterate over all the bins */ @@ -1944,7 +1870,7 @@ H5FS_sect_iterate(H5F_t *f, H5FS_t *fspace, H5FS_operator_t op, void *op_data) if (fspace->sinfo->bins[bin].bin_list) { /* Iterate over list of section size nodes for bin */ if (H5SL_iterate(fspace->sinfo->bins[bin].bin_list, H5FS__iterate_node_cb, &udata) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section size nodes") + HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over section size nodes"); } /* end if */ } /* end for */ } /* end if */ @@ -1952,7 +1878,7 @@ H5FS_sect_iterate(H5F_t *f, H5FS_t *fspace, H5FS_operator_t op, void *op_data) done: /* Release the section info */ if (sinfo_valid && H5FS__sinfo_unlock(f, fspace, FALSE) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") + HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info"); FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_iterate() */ @@ -1964,9 +1890,6 @@ H5FS_sect_iterate(H5F_t *f, H5FS_t *fspace, H5FS_operator_t op, void *op_data) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, May 30, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1975,7 +1898,7 @@ H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space, hsize_t *nsects) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fspace); + assert(fspace); /* Get the stats desired */ if (tot_space) @@ -1994,9 +1917,6 @@ H5FS_sect_stats(const H5FS_t *fspace, hsize_t *tot_space, hsize_t *nsects) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, July 10, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2011,14 +1931,14 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, uint FUNC_ENTER_NOAPI_NOINIT /* Check arguments. */ - HDassert(fspace); - HDassert(sect); - HDassert(sect->type < fspace->nclasses); - HDassert(new_class < fspace->nclasses); + assert(fspace); + assert(sect); + assert(sect->type < fspace->nclasses); + assert(new_class < fspace->nclasses); /* Get a pointer to the section info */ if (H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info"); sinfo_valid = TRUE; /* Get class info */ @@ -2039,16 +1959,16 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, uint to_ghost = TRUE; /* Sanity check */ - HDassert(fspace->sinfo->bins); + assert(fspace->sinfo->bins); /* Determine correct bin which holds items of at least the section's size */ bin = H5VM_log2_gen(sect->size); - HDassert(bin < fspace->sinfo->nbins); - HDassert(fspace->sinfo->bins[bin].bin_list); + assert(bin < fspace->sinfo->nbins); + assert(fspace->sinfo->bins[bin].bin_list); /* Get space node for section's size */ fspace_node = (H5FS_node_t *)H5SL_search(fspace->sinfo->bins[bin].bin_list, §->size); - HDassert(fspace_node); + assert(fspace_node); /* Adjust serializable/ghost counts */ if (to_ghost) { @@ -2106,17 +2026,17 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, uint if (fspace->sinfo->merge_list == NULL) if (NULL == (fspace->sinfo->merge_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTCREATE, FAIL, - "can't create skip list for merging free space sections") + "can't create skip list for merging free space sections"); if (H5SL_insert(fspace->sinfo->merge_list, sect, §->addr) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, - "can't insert free space node into merging skip list") + "can't insert free space node into merging skip list"); } /* end if */ else { H5FS_section_info_t *tmp_sect_node; /* Temporary section node */ tmp_sect_node = (H5FS_section_info_t *)H5SL_remove(fspace->sinfo->merge_list, §->addr); if (tmp_sect_node == NULL || tmp_sect_node != sect) - HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list") + HGOTO_ERROR(H5E_FSPACE, H5E_NOTFOUND, FAIL, "can't find section node on size list"); } /* end else */ } /* end if */ @@ -2129,12 +2049,12 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, uint /* Update current space used for free space sections */ if (H5FS__sect_serialize_size(fspace) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTCOMPUTE, FAIL, "can't adjust free space section size on disk"); done: /* Release the section info */ if (sinfo_valid && H5FS__sinfo_unlock(f, fspace, TRUE) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") + HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info"); FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_change_class() */ @@ -2148,9 +2068,6 @@ H5FS_sect_change_class(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, uint * * Return: void * - * Programmer: Quincey Koziol - * Jul 17 2006 - * *------------------------------------------------------------------------- */ void @@ -2217,8 +2134,8 @@ H5FS__sect_assert(const H5FS_t *fspace) cls = &fspace->sect_cls[sect->type]; /* Sanity check section */ - HDassert(H5F_addr_defined(sect->addr)); - HDassert(fspace_node->sect_size == sect->size); + assert(H5_addr_defined(sect->addr)); + assert(fspace_node->sect_size == sect->size); if (cls->valid) (*cls->valid)(cls, sect); @@ -2237,8 +2154,8 @@ H5FS__sect_assert(const H5FS_t *fspace) } /* end while */ /* Check the number of serializable & ghost sections of this size */ - HDassert(fspace_node->serial_count == size_serial_count); - HDassert(fspace_node->ghost_count == size_ghost_count); + assert(fspace_node->serial_count == size_serial_count); + assert(fspace_node->ghost_count == size_ghost_count); /* Add to global count of serializable & ghost section sizes */ if (fspace_node->serial_count > 0) @@ -2255,30 +2172,30 @@ H5FS__sect_assert(const H5FS_t *fspace) } /* end while */ /* Check the number of serializable & ghost sections in this bin */ - HDassert(fspace->sinfo->bins[u].tot_sect_count == (bin_serial_count + bin_ghost_count)); - HDassert(fspace->sinfo->bins[u].serial_sect_count == bin_serial_count); - HDassert(fspace->sinfo->bins[u].ghost_sect_count == bin_ghost_count); + assert(fspace->sinfo->bins[u].tot_sect_count == (bin_serial_count + bin_ghost_count)); + assert(fspace->sinfo->bins[u].serial_sect_count == bin_serial_count); + assert(fspace->sinfo->bins[u].ghost_sect_count == bin_ghost_count); } /* end if */ } /* end for */ /* Check counts from bins vs. global counts */ - HDassert(fspace->sinfo->tot_size_count == acc_tot_size_count); - HDassert(fspace->sinfo->serial_size_count == acc_serial_size_count); - HDassert(fspace->sinfo->ghost_size_count == acc_ghost_size_count); - HDassert(fspace->tot_sect_count == acc_tot_sect_count); - HDassert(fspace->serial_sect_count == acc_serial_sect_count); - HDassert(fspace->ghost_sect_count == acc_ghost_sect_count); + assert(fspace->sinfo->tot_size_count == acc_tot_size_count); + assert(fspace->sinfo->serial_size_count == acc_serial_size_count); + assert(fspace->sinfo->ghost_size_count == acc_ghost_size_count); + assert(fspace->tot_sect_count == acc_tot_sect_count); + assert(fspace->serial_sect_count == acc_serial_sect_count); + assert(fspace->ghost_sect_count == acc_ghost_sect_count); } /* end if */ else { /* Check counts are zero */ - HDassert(fspace->tot_sect_count == 0); - HDassert(fspace->serial_sect_count == 0); - HDassert(fspace->ghost_sect_count == 0); + assert(fspace->tot_sect_count == 0); + assert(fspace->serial_sect_count == 0); + assert(fspace->ghost_sect_count == 0); } /* end else */ /* Make certain that the number of sections on the address list is correct */ if (fspace->sinfo->merge_list) - HDassert(fspace->tot_sect_count == (separate_obj + H5SL_count(fspace->sinfo->merge_list))); + assert(fspace->tot_sect_count == (separate_obj + H5SL_count(fspace->sinfo->merge_list))); FUNC_LEAVE_NOAPI_VOID } /* end H5FS__sect_assert() */ @@ -2292,8 +2209,6 @@ H5FS__sect_assert(const H5FS_t *fspace) * * Return: TRUE/FALSE/FAIL * - * Programmer: Vailin Choi - * *------------------------------------------------------------------------- */ htri_t @@ -2306,10 +2221,10 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) FUNC_ENTER_NOAPI(FAIL) /* Check arguments. */ - HDassert(fspace); + assert(fspace); if (H5FS__sinfo_lock(f, fspace, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't get section info"); sinfo_valid = TRUE; if (fspace->sinfo && fspace->sinfo->merge_list) { @@ -2322,24 +2237,24 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) /* Get the pointer to the last section, from the last node */ tmp_sect = (H5FS_section_info_t *)H5SL_item(last_node); - HDassert(tmp_sect); + assert(tmp_sect); tmp_sect_cls = &fspace->sect_cls[tmp_sect->type]; if (tmp_sect_cls->can_shrink) { /* Check if the section can be shrunk away */ if ((ret_value = (*tmp_sect_cls->can_shrink)(tmp_sect, op_data)) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTSHRINK, FAIL, "can't check for shrinking container"); if (ret_value > 0) { - HDassert(tmp_sect_cls->shrink); + assert(tmp_sect_cls->shrink); /* Remove section from free space manager */ if (H5FS__sect_remove_real(fspace, tmp_sect) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, - "can't remove section from internal data structures") + "can't remove section from internal data structures"); section_removed = TRUE; /* Shrink away section */ if ((*tmp_sect_cls->shrink)(&tmp_sect, op_data) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't shrink free space container"); } /* end if */ } /* end if */ } /* end if */ @@ -2348,7 +2263,7 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) done: /* Release the section info */ if (sinfo_valid && H5FS__sinfo_unlock(f, fspace, section_removed) < 0) - HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") + HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info"); FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_try_shrink_eoa() */ @@ -2385,9 +2300,6 @@ H5FS_sect_try_shrink_eoa(H5F_t *f, H5FS_t *fspace, void *op_data) * Return: Success: non-negative * Failure: negative * - * Programmer: John Mainzer - * 6/6/16 - * *------------------------------------------------------------------------- */ herr_t @@ -2402,79 +2314,79 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, haddr_t FUNC_ENTER_NOAPI_NOINIT /* Check arguments. */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(fspace); - HDassert(fs_addr_ptr); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(fspace); + assert(fs_addr_ptr); /* the section info should be unlocked */ - HDassert(fspace->sinfo_lock_count == 0); + assert(fspace->sinfo_lock_count == 0); /* persistent free space managers must be enabled */ - HDassert(f->shared->fs_persist); + assert(f->shared->fs_persist); /* At present, all free space strategies enable the free space managers. * This will probably change -- at which point this assertion should * be revisited. */ /* Updated: Only the following two strategies enable the free-space managers */ - HDassert((f->shared->fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR) || - (f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)); + assert((f->shared->fs_strategy == H5F_FSPACE_STRATEGY_FSM_AGGR) || + (f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE)); if (fspace->serial_sect_count > 0 && fspace->sinfo) { /* the section info is floating, so space->sinfo should be defined */ - if (!H5F_addr_defined(fspace->addr)) { + if (!H5_addr_defined(fspace->addr)) { /* start by allocating file space for the header */ /* Get the EOA for the file -- need for sanity check below */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_FSPACE_HDR))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa"); /* check for overlap into temporary allocation space */ if (H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, - "hdr file space alloc will overlap into 'temporary' file space") + "hdr file space alloc will overlap into 'temporary' file space"); hdr_alloc_size = H5FS_HEADER_SIZE(f); if (H5F_PAGED_AGGR(f)) - HDassert(0 == (eoa % f->shared->fs_page_size)); + assert(0 == (eoa % f->shared->fs_page_size)); /* Allocate space for the free space header */ if (HADDR_UNDEF == (fspace->addr = H5MF_alloc(f, H5FD_MEM_FSPACE_HDR, hdr_alloc_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for free space header"); /* Cache the new free space header (pinned) */ if (H5AC_insert_entry(f, H5AC_FSPACE_HDR, fspace->addr, fspace, H5AC__PIN_ENTRY_FLAG) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space header to cache"); *fs_addr_ptr = fspace->addr; } - if (!H5F_addr_defined(fspace->sect_addr)) { + if (!H5_addr_defined(fspace->sect_addr)) { /* now allocate file space for the section info */ /* Get the EOA for the file -- need for sanity check below */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_FSPACE_SINFO))) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "Unable to get eoa") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "Unable to get eoa"); /* check for overlap into temporary allocation space */ if (H5F_IS_TMP_ADDR(f, (eoa + fspace->sect_size))) HGOTO_ERROR(H5E_FSPACE, H5E_BADRANGE, FAIL, - "sinfo file space alloc will overlap into 'temporary' file space") + "sinfo file space alloc will overlap into 'temporary' file space"); sinfo_alloc_size = fspace->sect_size; if (H5F_PAGED_AGGR(f)) - HDassert(0 == (eoa % f->shared->fs_page_size)); + assert(0 == (eoa % f->shared->fs_page_size)); /* allocate space for the section info */ if (HADDR_UNDEF == (sect_addr = H5MF_alloc(f, H5FD_MEM_FSPACE_SINFO, sinfo_alloc_size))) - HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info") + HGOTO_ERROR(H5E_FSPACE, H5E_NOSPACE, FAIL, "file allocation failed for section info"); /* update fspace->alloc_sect_size and fspace->sect_addr to reflect * the allocation @@ -2483,7 +2395,7 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, haddr_t hsize_t saved_sect_size = fspace->sect_size; if (H5MF_xfree(f, H5FD_MEM_FSPACE_SINFO, sect_addr, sinfo_alloc_size) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTFREE, FAIL, "unable to free free space sections"); fspace->sect_size = saved_sect_size; } else { @@ -2515,12 +2427,12 @@ H5FS_vfd_alloc_hdr_and_section_info_if_needed(H5F_t *f, H5FS_t *fspace, haddr_t * JRM -- 11/4/16 */ if (H5AC_insert_entry(f, H5AC_FSPACE_SINFO, sect_addr, fspace->sinfo, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sinfo to cache") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTINIT, FAIL, "can't add free space sinfo to cache"); /* We have changed the sinfo address -- Mark free space header dirty */ if (H5AC_mark_entry_dirty(fspace) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMARKDIRTY, FAIL, - "unable to mark free space header as dirty") + "unable to mark free space header as dirty"); /* since space has been allocated for the section info and the sinfo * has been inserted into the cache, relinquish ownership (i.e. float) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FSstat.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FSstat.c index 2b181679d7..3617f18ff6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FSstat.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FSstat.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -64,9 +63,6 @@ * * Return: SUCCEED (Can't fail) * - * Programmer: Vailin Choi - * August 25th, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -75,8 +71,8 @@ H5FS_stat_info(const H5F_t *f, const H5FS_t *frsp, H5FS_stat_t *stats) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(frsp); - HDassert(stats); + assert(frsp); + assert(stats); /* Report statistics for free space */ stats->tot_space = frsp->tot_space; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FStest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5FStest.c index cd452d1e1c..30f598dd28 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FStest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5FStest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -66,9 +65,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * August 25th, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -77,8 +73,8 @@ H5FS__get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(frsp); - HDassert(cparam); + assert(frsp); + assert(cparam); cparam->client = frsp->client; cparam->shrink_percent = frsp->shrink_percent; @@ -97,9 +93,6 @@ H5FS__get_cparam_test(const H5FS_t *frsp, H5FS_create_t *cparam) * * Return: A value like strcmp() * - * Programmer: Vailin Choi - * August 25th, 2008 - * *------------------------------------------------------------------------- */ int @@ -110,33 +103,33 @@ H5FS__cmp_cparam_test(const H5FS_create_t *cparam1, const H5FS_create_t *cparam2 FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(cparam1); - HDassert(cparam2); + assert(cparam1); + assert(cparam2); if (cparam1->client < cparam2->client) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->client > cparam2->client) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->shrink_percent < cparam2->shrink_percent) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->shrink_percent > cparam2->shrink_percent) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->expand_percent < cparam2->expand_percent) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->expand_percent > cparam2->expand_percent) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->max_sect_size < cparam2->max_sect_size) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->max_sect_size > cparam2->max_sect_size) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->max_sect_addr < cparam2->max_sect_addr) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->max_sect_addr > cparam2->max_sect_addr) - HGOTO_DONE(1) + HGOTO_DONE(1); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FaccProp.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5FaccProp.cpp deleted file mode 100644 index 68a130eac0..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FaccProp.cpp +++ /dev/null @@ -1,820 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include - -using std::cerr; -using std::endl; - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5FaccProp.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control -// the order of creation and deletion of the global constants. See Design Notes -// in "H5PredType.cpp" for information. - -// Initialize a pointer for the constant -FileAccPropList *FileAccPropList::DEFAULT_ = 0; - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getConstant -// Creates a FileAccPropList object representing the HDF5 constant -// H5P_FILE_ACCESS, pointed to by FileAccPropList::DEFAULT_ -// exception H5::PropListIException -// Description -// If FileAccPropList::DEFAULT_ already points to an allocated -// object, throw a PropListIException. This scenario should not -// happen. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -FileAccPropList * -FileAccPropList::getConstant() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the constant pointer is not allocated, allocate it. Otherwise, - // throw because it shouldn't be. - if (DEFAULT_ == 0) - DEFAULT_ = new FileAccPropList(H5P_FILE_ACCESS); - else - throw PropListIException("FileAccPropList::getConstant", - "FileAccPropList::getConstant is being invoked on an allocated DEFAULT_"); - return (DEFAULT_); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::deleteConstants -// Purpose Deletes the constant object that FileAccPropList::DEFAULT_ -// points to. -// exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -FileAccPropList::deleteConstants() -{ - delete DEFAULT_; -} - -//-------------------------------------------------------------------------- -// Purpose Constant for default property -//-------------------------------------------------------------------------- -const FileAccPropList &FileAccPropList::DEFAULT = *getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: Default Constructor -///\brief Creates a file access property list -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FileAccPropList::FileAccPropList() : PropList(H5P_FILE_ACCESS) -{ -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param original - IN: FileAccPropList instance to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FileAccPropList::FileAccPropList(const FileAccPropList &original) : PropList(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList overloaded constructor -///\brief Creates a file access property list using the id of an -/// existing one. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setStdio -///\brief Modifies this property list to use the \c H5FD_STDIO driver. -/// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setStdio() const -{ - herr_t ret_value = H5Pset_fapl_stdio(id); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setStdio", "H5Pset_fapl_stdio failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getDriver -///\brief Return the ID of the low-level file driver. -///\return A low-level driver ID which is the same ID used when the -/// driver was set for the property list. The driver ID is -/// only valid as long as the file driver remains registered. -/// For detail on valid driver identifiers, please refer to the -/// H5Pget_driver API in the HDF5 C Reference Manual. -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -hid_t -FileAccPropList::getDriver() const -{ - hid_t driver = H5Pget_driver(id); - if (driver < 0) { - throw PropListIException("FileAccPropList::getDriver", "H5Pget_driver failed"); - } - return (driver); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setDriver -///\brief Set file driver for this property list. -///\param new_driver_id - IN: File driver -///\param new_driver_info - IN: Struct containing the driver-specific properties -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_driver API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const -{ - herr_t ret_value = H5Pset_driver(id, new_driver_id, new_driver_info); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setDriver", "H5Pset_driver failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setFamilyOffset -///\brief Sets offset for family driver. -///\param offset - IN: offset value -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setFamilyOffset(hsize_t offset) const -{ - herr_t ret_value = H5Pset_family_offset(id, offset); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setFamilyOffset", "H5Pset_family_offset failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getFamilyOffset -///\brief Get offset for family driver. -///\return Offset for family driver -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -hsize_t -FileAccPropList::getFamilyOffset() const -{ - hsize_t offset; - herr_t ret_value = H5Pget_family_offset(id, &offset); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getFamilyOffset", "H5Pget_family_offset failed"); - } - return (offset); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setCore -///\brief Modifies this file access property list to use the \c H5FD_CORE -/// driver. -///\param increment - IN: Specifies how much memory to increase each -/// time more memory is needed, in bytes -///\param backing_store - IN: Indicating whether to write the file -/// contents to disk when the file is closed -///\exception H5::PropListIException -///\par Description -/// For more details on the use of \c H5FD_CORE driver, please -/// refer to the H5Pset_fapl_core API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setCore(size_t increment, hbool_t backing_store) const -{ - herr_t ret_value = H5Pset_fapl_core(id, increment, backing_store); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setCore", "H5Pset_fapl_core failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getCore -///\brief Queries core file driver properties. -///\param increment - OUT: Size of memory increment, in bytes -///\param backing_store - OUT: Indicating whether to write the file -/// contents to disk when the file is closed -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::getCore(size_t &increment, hbool_t &backing_store) const -{ - herr_t ret_value = H5Pget_fapl_core(id, &increment, &backing_store); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getCore", "H5Pget_fapl_core failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setFamily -///\brief Sets this file access property list to use the family driver. -///\param memb_size - IN: Size in bytes of each file member -///\param memb_plist - IN: File access property list to be used for -/// each family member -///\exception H5::PropListIException -///\par Description -/// Note that \a memb_size is used only when creating a new file. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList &memb_plist) const -{ - herr_t ret_value = H5Pset_fapl_family(id, memb_size, memb_plist.getId()); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setFamily", "H5Pset_fapl_family failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getFamily -///\brief Returns information about the family file access property -/// list. -///\param memb_size - OUT: Size in bytes of each file member -///\param memb_plist - OUT: Retrieved file access property list for each -/// file member -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::getFamily(hsize_t &memb_size, FileAccPropList &memb_plist) const -{ - hid_t memb_plist_id; - herr_t ret_value = H5Pget_fapl_family(id, &memb_size, &memb_plist_id); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed"); - } - memb_plist.p_setId(memb_plist_id); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getFamily -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts and its return value. -///\param memb_size - OUT: Size in bytes of each file member -///\return The file access property list for each file member -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -FileAccPropList -FileAccPropList::getFamily(hsize_t &memb_size) const -{ - hid_t memb_plist_id; - herr_t ret_value = H5Pget_fapl_family(id, &memb_size, &memb_plist_id); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getFamily", "H5Pget_fapl_family failed"); - } - FileAccPropList memb_plist(memb_plist_id); - return (memb_plist); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setSplit -///\brief Emulates the old split file driver, which stored meta data -/// in one file and raw data in another file. -///\param meta_plist - IN: File access plist for the metadata file -///\param raw_plist - IN: File access plist for the raw data file -///\param meta_ext - IN: Metadata filename extension as \c char* -///\param raw_ext - IN: Raw data filename extension as \c char* -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_fapl_split API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist, - const char *meta_ext, const char *raw_ext) const -{ - hid_t meta_pid = meta_plist.getId(); - hid_t raw_pid = raw_plist.getId(); - herr_t ret_value = H5Pset_fapl_split(id, meta_ext, meta_pid, raw_ext, raw_pid); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setSplit", "H5Pset_fapl_split failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setSplit -///\brief This is an overloaded member function, provided for convenience. -/// It takes character arguments as \c H5std_string. -///\param meta_plist - IN: File access plist for the metadata file -///\param raw_plist - IN: File access plist for the raw data file -///\param meta_ext - IN: Metadata filename extension as \c H5std_string -///\param raw_ext - IN: Raw data filename extension as \c H5std_string -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist, - const H5std_string &meta_ext, const H5std_string &raw_ext) const -{ - setSplit(meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str()); -} - -// Stream Virtual File Driver had been removed from the main library. -// FileAccPropList::[s,g]etStream are now removed from the C++ API. -// -BMR, March, 2012 - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getSieveBufSize -///\brief Returns the current settings for the data sieve buffer size -/// property from this property list. -///\return Data sieve buffer size, in bytes -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -size_t -FileAccPropList::getSieveBufSize() const -{ - size_t bufsize; - herr_t ret_value = H5Pget_sieve_buf_size(id, &bufsize); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed"); - } - return (bufsize); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setSieveBufSize -///\brief Sets the maximum size of the data sieve buffer. -///\param bufsize - IN: Maximum size, in bytes, of data sieve buffer -///\exception H5::PropListIException -///\par Description -/// For more detail, please refer to the H5Pset_sieve_buf_size -/// API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setSieveBufSize(size_t bufsize) const -{ - herr_t ret_value = H5Pset_sieve_buf_size(id, bufsize); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getSieveBufSize", "H5Pget_sieve_buf_size failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setMetaBlockSize -///\brief Sets the minimum size of metadata block allocations. -///\param block_size - IN: Minimum size, in bytes, of metadata -/// block allocations -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_meta_block_size -/// API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setMetaBlockSize(hsize_t &block_size) const -{ - herr_t ret_value = H5Pset_meta_block_size(id, block_size); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setMetaBlockSize", "H5Pset_meta_block_size failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getMetaBlockSize -///\brief Returns the current metadata block size setting. -///\return Metadata block size -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -hsize_t -FileAccPropList::getMetaBlockSize() const -{ - hsize_t block_size; - herr_t ret_value = H5Pget_meta_block_size(id, &block_size); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getMetaBlockSize", "H5Pget_meta_block_size failed"); - } - return (block_size); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setLog -///\brief Modifies this file access property list to use the logging -/// driver. -///\param logfile - IN: Name of the log file -///\param flags - IN: Flags specifying the types of logging activity -///\param buf_size - IN: Size of the logging buffer -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_fapl_log API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const -{ - herr_t ret_value = H5Pset_fapl_log(id, logfile, flags, buf_size); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setLog", "H5Pset_fapl_log failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setLog -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param logfile - IN: Name of the log file - string -///\param flags - IN: Flags specifying the types of logging activity -///\param buf_size - IN: Size of the logging buffer -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setLog(const H5std_string &logfile, unsigned flags, size_t buf_size) const -{ - setLog(logfile.c_str(), flags, buf_size); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setSec2 -///\brief Modifies this file access property list to use the sec2 -/// driver. -/// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setSec2() const -{ - herr_t ret_value = H5Pset_fapl_sec2(id); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setSec2", "H5Pset_fapl_sec2 failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setAlignment -///\brief Sets the alignment properties of this property list. -///\param threshold - IN: Threshold value for file object size -///\param alignment - IN: Alignment value -///\exception H5::PropListIException -///\par Description -/// The parameter \a threshold must have a non-negative value. -/// Note that setting the threshold value to 0 (zero) has the -/// effect of a special case, forcing everything to be aligned. -/// The parameter \a alignment must have a positive value. -/// -/// For more detail, please refer to the H5Pset_alignment API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const -{ - herr_t ret_value = H5Pset_alignment(id, threshold, alignment); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setAlignment", "H5Pset_alignment failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getAlignment -///\brief Returns the current settings for alignment properties from -/// this property list. -///\param threshold - OUT: Retrieved threshold value for file object size -///\param alignment - OUT: Retrieved alignment value -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const -{ - herr_t ret_value = H5Pget_alignment(id, &threshold, &alignment); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getAlignment", "H5Pget_alignment failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setMultiType -///\brief Sets data type for \c MULTI driver. -///\param dtype - IN: Type of data -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_multi_type API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setMultiType(H5FD_mem_t dtype) const -{ - herr_t ret_value = H5Pset_multi_type(id, dtype); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setMultiType", "H5Pset_multi_type failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getMultiType -///\brief Returns the data type property for \c MULTI driver. -///\return The data type property -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pget_multi_type API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -H5FD_mem_t -FileAccPropList::getMultiType() const -{ - H5FD_mem_t dtype; - herr_t ret_value = H5Pget_multi_type(id, &dtype); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getMultiType", "H5Pget_multi_type failed"); - } - return (dtype); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setCache -///\brief Sets the meta data cache and raw data chunk cache parameters. -///\param mdc_nelmts - IN: Number of elements in the meta data cache -///\param rdcc_nelmts - IN: Number of elements in the raw data chunk cache -///\param rdcc_nbytes - IN: Total size of the raw data chunk cache, in bytes -///\param rdcc_w0 - IN: Preemption policy -///\exception H5::PropListIException -///\par Description -/// The argument \a rdcc_w0 should hold a value between 0 and 1 -/// inclusive. This value indicates how much chunks that have -/// been fully read are favored for preemption. A value of zero -/// means fully read chunks are treated no differently than other -/// chunks (the preemption is strictly LRU) while a value of one -/// means fully read chunks are always preempted before other chunks. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const -{ - herr_t ret_value = H5Pset_cache(id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setCache", "H5Pset_cache failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getCache -///\brief Queries the meta data cache and raw data chunk cache parameters. -///\param mdc_nelmts - OUT: Number of elements in the meta data cache -///\param rdcc_nelmts - OUT: Number of elements in the raw data chunk cache -///\param rdcc_nbytes - OUT: Total size of the raw data chunk cache, in bytes -///\param rdcc_w0 - OUT: Preemption policy -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileAccPropList::getCache(int &mdc_nelmts, size_t &rdcc_nelmts, size_t &rdcc_nbytes, double &rdcc_w0) const -{ - herr_t ret_value = H5Pget_cache(id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getCache", "H5Pget_cache failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setFcloseDegree -///\brief Sets the degree for the file close behavior. -///\param degree - IN: -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const -{ - herr_t ret_value = H5Pset_fclose_degree(id, degree); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setFcloseDegree", "H5Pset_fclose_degree failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getFcloseDegree -///\brief Returns the degree for the file close behavior. -///\return The degree for the file close behavior -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -H5F_close_degree_t -FileAccPropList::getFcloseDegree() const -{ - H5F_close_degree_t degree; - herr_t ret_value = H5Pget_fclose_degree(id, °ree); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getFcloseDegree", "H5Pget_fclose_degree failed"); - } - return (degree); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setGcReferences -///\brief Sets garbage collecting references flag. -///\param gc_ref - IN: Flag setting reference garbage collection to -/// on (1) or off (0). -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_gc_references API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileAccPropList::setGcReferences(unsigned gc_ref) const -{ - herr_t ret_value = H5Pset_gc_references(id, gc_ref); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setGcReferences", "H5Pset_gc_references failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getGcReferences -///\brief Returns the garbage collecting references setting. -///\return Garbage collecting references setting, 0 (off) or 1 (on) -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -unsigned -FileAccPropList::getGcReferences() const -{ - unsigned gc_ref; - - // the name of this routine will be changed to H5Pget_gc_references??? - herr_t ret_value = H5Pget_gc_references(id, &gc_ref); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getGcReferences", "H5Pget_gc_references failed"); - } - return (gc_ref); -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setFileLocking -///\brief Sets file locking flags. -///\param use_file_locking - IN: Flag that determines if file locks should -// be used or not. -///\param ignore_when_disabled - IN: Flag that determines if file locks -// should be be used when disabled on the file system or not. -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_file_locking API in -/// the HDF5 C Reference Manual. -// Programmer Dana Robinson - 2020 -//-------------------------------------------------------------------------- -void -FileAccPropList::setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const -{ - herr_t ret_value = H5Pset_file_locking(id, use_file_locking, ignore_when_disabled); - - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setFileLocking", "H5Pset_file_locking failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getFileLocking -///\brief Gets file locking flags. -///\param use_file_locking - OUT: Flag that determines if file locks -// should be used or not. -///\param ignore_when_disabled - OUT: Flag that determines if file locks -// should be be used when disabled on the file system or not. -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pget_file_locking API in -/// the HDF5 C Reference Manual. -// Programmer Dana Robinson - 2020 -//-------------------------------------------------------------------------- -void -FileAccPropList::getFileLocking(hbool_t &use_file_locking, hbool_t &ignore_when_disabled) const -{ - herr_t ret_value = H5Pget_file_locking(id, &use_file_locking, &ignore_when_disabled); - - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getFileLocking", "H5Pget_file_locking failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::setLibverBounds -///\brief Sets bounds on versions of library format to be used when creating -/// or writing objects. -///\param libver_low - IN: Earliest version of the library that will be -/// used for creating or writing objects -///\param libver_high - IN: Latest version of the library that will be -///\exception H5::PropListIException -///\par Description -/// Valid values of \a libver_low are as follows: -/// \li \c H5F_LIBVER_EARLIEST (Default) -/// \li \c H5F_LIBVER_18 -/// \li \c H5F_LIBVER_110 -/// \li \c H5F_LIBVER_112 -/// \li \c H5F_LIBVER_114 -/// \li \c H5F_LIBVER_LATEST -/// -/// Valid values of \a libver_high are as follows: -/// \li \c H5F_LIBVER_18 -/// \li \c H5F_LIBVER_110 -/// \li \c H5F_LIBVER_112 -/// \li \c H5F_LIBVER_114 -/// \li \c H5F_LIBVER_LATEST (Default) -/// -/// For more detail, please refer to the H5Pset_libver_bounds API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - March, 2015 -//-------------------------------------------------------------------------- -void -FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const -{ - herr_t ret_value = H5Pset_libver_bounds(id, libver_low, libver_high); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::setLibverBounds", "H5Pset_libver_bounds failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList::getLibverBounds -///\brief Gets the current settings for the library version format bounds -/// from a file access property list. -///\param libver_low - OUT: Earliest version of the library that will be -/// used for creating or writing objects -///\param libver_high - OUT: Latest version of the library that will be -/// used for creating or writing objects -///\exception H5::PropListIException -///\par Description -/// On success, the argument \a libver_low can have the following -/// values: -/// \li \c H5F_LIBVER_EARLIEST -/// \li \c H5F_LIBVER_18 -/// \li \c H5F_LIBVER_110 -/// \li \c H5F_LIBVER_112 -/// \li \c H5F_LIBVER_114 -/// \li \c H5F_LIBVER_LATEST -/// -/// and \a libver_high: -/// \li \c H5F_LIBVER_18 -/// \li \c H5F_LIBVER_110 -/// \li \c H5F_LIBVER_112 -/// \li \c H5F_LIBVER_114 -/// \li \c H5F_LIBVER_LATEST -// Programmer Binh-Minh Ribler - March, 2015 -//-------------------------------------------------------------------------- -void -FileAccPropList::getLibverBounds(H5F_libver_t &libver_low, H5F_libver_t &libver_high) const -{ - herr_t ret_value = H5Pget_libver_bounds(id, &libver_low, &libver_high); - if (ret_value < 0) { - throw PropListIException("FileAccPropList::getLibverBounds", "H5Pget_libver_bounds failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileAccPropList destructor -///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FileAccPropList::~FileAccPropList() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Faccum.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Faccum.c index aa8969038f..e621e98283 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Faccum.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Faccum.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Faccum.c - * Jan 10 2008 - * Quincey Koziol * * Purpose: File metadata "accumulator" routines. (Used to * cache small metadata I/Os and group them into a @@ -94,9 +91,6 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 10 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -108,8 +102,8 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f_sh); - HDassert(buf); + assert(f_sh); + assert(buf); /* Translate to file driver I/O info object */ file = f_sh->lf; @@ -123,11 +117,12 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si if (size < H5F_ACCUM_MAX_SIZE) { /* Sanity check */ - HDassert(!accum->buf || (accum->alloc_size >= accum->size)); + assert(!accum->buf || (accum->alloc_size >= accum->size)); /* Current read adjoins or overlaps with metadata accumulator */ - if (H5F_addr_overlap(addr, size, accum->loc, accum->size) || ((addr + size) == accum->loc) || - (accum->loc + accum->size) == addr) { + if (H5_addr_defined(accum->loc) && + (H5_addr_overlap(addr, size, accum->loc, accum->size) || ((addr + size) == accum->loc) || + (accum->loc + accum->size) == addr)) { size_t amount_before; /* Amount to read before current accumulator */ haddr_t new_addr; /* New address of the accumulator buffer */ size_t new_size; /* New size of the accumulator buffer */ @@ -146,13 +141,13 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si /* Reallocate the metadata accumulator buffer */ if (NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_alloc_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "unable to allocate metadata accumulator buffer") + "unable to allocate metadata accumulator buffer"); /* Note the new buffer size */ accum->alloc_size = new_alloc_size; /* Clear the memory */ - HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size)); + memset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size)); } /* end if */ /* Read the part before the metadata accumulator */ @@ -161,7 +156,7 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si H5_CHECKED_ASSIGN(amount_before, size_t, (accum->loc - addr), hsize_t); /* Make room for the metadata to read in */ - HDmemmove(accum->buf + amount_before, accum->buf, accum->size); + memmove(accum->buf + amount_before, accum->buf, accum->size); /* Adjust dirty region tracking info, if present */ if (accum->dirty) @@ -169,7 +164,7 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si /* Dispatch to driver */ if (H5FD_read(file, map_type, addr, amount_before, accum->buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed"); } /* end if */ else amount_before = 0; @@ -185,7 +180,7 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si /* Dispatch to driver */ if (H5FD_read(file, map_type, (accum->loc + accum->size), amount_after, (accum->buf + accum->size + amount_before)) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed"); } /* end if */ /* Copy the data out of the buffer */ @@ -199,13 +194,13 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si else { /* Dispatch to driver */ if (H5FD_read(file, map_type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed"); } /* end else */ } /* end if */ else { /* Read the data */ if (H5FD_read(file, map_type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed"); /* Check for overlap w/dirty accumulator */ /* (Note that this could be improved by updating the non-dirty @@ -213,14 +208,14 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si * just read in. -QAK) */ if (accum->dirty && - H5F_addr_overlap(addr, size, accum->loc + accum->dirty_off, accum->dirty_len)) { + H5_addr_overlap(addr, size, accum->loc + accum->dirty_off, accum->dirty_len)) { haddr_t dirty_loc = accum->loc + accum->dirty_off; /* File offset of dirty information */ size_t buf_off; /* Offset of dirty region in buffer */ size_t dirty_off; /* Offset within dirty region */ size_t overlap_size; /* Size of overlap with dirty region */ /* Check for read starting before beginning dirty region */ - if (H5F_addr_le(addr, dirty_loc)) { + if (H5_addr_le(addr, dirty_loc)) { /* Compute offset of dirty region within buffer */ buf_off = (size_t)(dirty_loc - addr); @@ -228,7 +223,7 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si dirty_off = 0; /* Check for read ending within dirty region */ - if (H5F_addr_lt(addr + size, dirty_loc + accum->dirty_len)) + if (H5_addr_lt(addr + size, dirty_loc + accum->dirty_len)) overlap_size = (size_t)((addr + size) - buf_off); else /* Access covers whole dirty region */ overlap_size = accum->dirty_len; @@ -249,7 +244,7 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si else { /* Read the data */ if (H5FD_read(file, map_type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "driver read request failed"); } /* end else */ done: @@ -263,9 +258,6 @@ H5F__accum_read(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t si * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jun 11 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -275,11 +267,11 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, H5FD_t *file, H5F_accum_adjust_t adju FUNC_ENTER_PACKAGE - HDassert(accum); - HDassert(file); - HDassert(H5F_ACCUM_APPEND == adjust || H5F_ACCUM_PREPEND == adjust); - HDassert(size > 0); - HDassert(size <= H5F_ACCUM_MAX_SIZE); + assert(accum); + assert(file); + assert(H5F_ACCUM_APPEND == adjust || H5F_ACCUM_PREPEND == adjust); + assert(size > 0); + assert(size <= H5F_ACCUM_MAX_SIZE); /* Check if we need more buffer space */ if ((size + accum->size) > accum->alloc_size) { @@ -338,7 +330,7 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, H5FD_t *file, H5F_accum_adjust_t adju */ if (H5FD_write(file, H5FD_MEM_DEFAULT, (accum->loc + accum->dirty_off), accum->dirty_len, (accum->buf + accum->dirty_off)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "file write failed"); /* Reset accumulator dirty flag */ accum->dirty = FALSE; @@ -351,7 +343,7 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, H5FD_t *file, H5F_accum_adjust_t adju */ if (H5FD_write(file, H5FD_MEM_DEFAULT, (accum->loc + accum->dirty_off), accum->dirty_len, (accum->buf + accum->dirty_off)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "file write failed"); /* Reset accumulator dirty flag */ accum->dirty = FALSE; @@ -368,7 +360,7 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, H5FD_t *file, H5F_accum_adjust_t adju /* When appending, need to adjust location of accumulator */ if (H5F_ACCUM_APPEND == adjust) { /* Move remnant of accumulator down */ - HDmemmove(accum->buf, (accum->buf + shrink_size), remnant_size); + memmove(accum->buf, (accum->buf + shrink_size), remnant_size); /* Adjust accumulator's location */ accum->loc += shrink_size; @@ -381,14 +373,14 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, H5FD_t *file, H5F_accum_adjust_t adju /* Reallocate the metadata accumulator buffer */ if (NULL == (new_buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_size))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate metadata accumulator buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate metadata accumulator buffer"); /* Update accumulator info */ accum->buf = new_buf; accum->alloc_size = new_size; /* Clear the memory */ - HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); + memset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); } /* end if */ } /* end if */ @@ -404,9 +396,6 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, H5FD_t *file, H5F_accum_adjust_t adju * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 10 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -418,9 +407,9 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); - HDassert(H5F_SHARED_INTENT(f_sh) & H5F_ACC_RDWR); - HDassert(buf); + assert(f_sh); + assert(H5F_SHARED_INTENT(f_sh) & H5F_ACC_RDWR); + assert(buf); /* Translate to file driver pointer */ file = f_sh->lf; @@ -434,18 +423,18 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s if (size < H5F_ACCUM_MAX_SIZE) { /* Sanity check */ - HDassert(!accum->buf || (accum->alloc_size >= accum->size)); + assert(!accum->buf || (accum->alloc_size >= accum->size)); /* Check if there is already metadata in the accumulator */ if (accum->size > 0) { /* Check if the new metadata adjoins the beginning of the current accumulator */ - if ((addr + size) == accum->loc) { + if (H5_addr_defined(accum->loc) && (addr + size) == accum->loc) { /* Check if we need to adjust accumulator size */ if (H5F__accum_adjust(accum, file, H5F_ACCUM_PREPEND, size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator"); /* Move the existing metadata to the proper location */ - HDmemmove(accum->buf + size, accum->buf, accum->size); + memmove(accum->buf + size, accum->buf, accum->size); /* Copy the new metadata at the front */ H5MM_memcpy(accum->buf, buf, size); @@ -464,10 +453,10 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s accum->dirty_off = 0; } /* end if */ /* Check if the new metadata adjoins the end of the current accumulator */ - else if (addr == (accum->loc + accum->size)) { + else if (H5_addr_defined(accum->loc) && addr == (accum->loc + accum->size)) { /* Check if we need to adjust accumulator size */ if (H5F__accum_adjust(accum, file, H5F_ACCUM_APPEND, size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator"); /* Copy the new metadata to the end */ H5MM_memcpy(accum->buf + accum->size, buf, size); @@ -485,7 +474,8 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s accum->size += size; } /* end if */ /* Check if the piece of metadata being written overlaps the metadata accumulator */ - else if (H5F_addr_overlap(addr, size, accum->loc, accum->size)) { + else if (H5_addr_defined(accum->loc) && + H5_addr_overlap(addr, size, accum->loc, accum->size)) { size_t add_size; /* New size of the accumulator buffer */ /* Check if the new metadata is entirely within the current accumulator */ @@ -528,13 +518,13 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s /* Check if we need to adjust accumulator size */ if (H5F__accum_adjust(accum, file, H5F_ACCUM_PREPEND, add_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator"); /* Calculate the proper offset of the existing metadata */ H5_CHECKED_ASSIGN(old_offset, size_t, (addr + size) - accum->loc, hsize_t); /* Move the existing metadata to the proper location */ - HDmemmove(accum->buf + size, accum->buf + old_offset, (accum->size - old_offset)); + memmove(accum->buf + size, accum->buf + old_offset, (accum->size - old_offset)); /* Copy the new metadata at the front */ H5MM_memcpy(accum->buf, buf, size); @@ -570,7 +560,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s /* Check if we need to adjust accumulator size */ if (H5F__accum_adjust(accum, file, H5F_ACCUM_APPEND, add_size) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") + HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator"); /* Compute offset of dirty region (after adjusting accumulator) */ dirty_off = (size_t)(addr - accum->loc); @@ -611,13 +601,13 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s if (NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_alloc_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "unable to allocate metadata accumulator buffer") + "unable to allocate metadata accumulator buffer"); /* Note the new buffer size */ accum->alloc_size = new_alloc_size; /* Clear the memory */ - HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); + memset(accum->buf + size, 0, (accum->alloc_size - size)); } /* end if */ /* Copy the new metadata to the buffer */ @@ -639,7 +629,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s if (accum->dirty) { if (H5FD_write(file, H5FD_MEM_DEFAULT, accum->loc + accum->dirty_off, accum->dirty_len, accum->buf + accum->dirty_off) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed"); /* Reset accumulator dirty flag */ accum->dirty = FALSE; @@ -657,14 +647,14 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s /* Grow the metadata accumulator buffer */ if (NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "unable to allocate metadata accumulator buffer") + "unable to allocate metadata accumulator buffer"); /* Note the new buffer size */ accum->alloc_size = new_size; /* Clear the memory */ clear_size = MAX(accum->size, size); - HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); + memset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); } /* end if */ else { /* Check if we should shrink the accumulator buffer */ @@ -676,7 +666,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s /* Shrink the accumulator buffer */ if (NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, tmp_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "unable to allocate metadata accumulator buffer") + "unable to allocate metadata accumulator buffer"); /* Note the new buffer size */ accum->alloc_size = tmp_size; @@ -708,13 +698,13 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s /* Reallocate the metadata accumulator buffer */ if (NULL == (accum->buf = H5FL_BLK_REALLOC(meta_accum, accum->buf, new_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "unable to allocate metadata accumulator buffer") + "unable to allocate metadata accumulator buffer"); /* Note the new buffer size */ accum->alloc_size = new_size; /* Clear the memory */ - HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); + memset(accum->buf + size, 0, (accum->alloc_size - size)); } /* end if */ /* Update the metadata accumulator information */ @@ -735,21 +725,21 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s if ((H5F_SHARED_INTENT(f_sh) & H5F_ACC_SWMR_WRITE) > 0) /* Flush if dirty and reset accumulator */ if (H5F__accum_reset(f_sh, TRUE) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") + HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator"); /* Write the data */ if (H5FD_write(file, map_type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed"); /* Check for overlap w/accumulator */ /* (Note that this could be improved by updating the accumulator * with [some of] the information just read in. -QAK) */ - if (H5F_addr_overlap(addr, size, accum->loc, accum->size)) { + if (H5_addr_defined(accum->loc) && H5_addr_overlap(addr, size, accum->loc, accum->size)) { /* Check for write starting before beginning of accumulator */ - if (H5F_addr_le(addr, accum->loc)) { + if (H5_addr_le(addr, accum->loc)) { /* Check for write ending within accumulator */ - if (H5F_addr_le(addr + size, accum->loc + accum->size)) { + if (H5_addr_le(addr + size, accum->loc + accum->size)) { size_t overlap_size; /* Size of overlapping region */ /* Compute overlap size */ @@ -763,13 +753,13 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s dirty_start + accum->dirty_len; /* File address of end of dirty region */ /* Check if entire dirty region is overwritten */ - if (H5F_addr_le(dirty_end, addr + size)) { + if (H5_addr_le(dirty_end, addr + size)) { accum->dirty = FALSE; accum->dirty_len = 0; } /* end if */ else { /* Check for dirty region falling after write */ - if (H5F_addr_le(addr + size, dirty_start)) + if (H5_addr_le(addr + size, dirty_start)) accum->dirty_off = overlap_size; else { /* Dirty region overlaps w/written region */ accum->dirty_off = 0; @@ -781,19 +771,19 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s /* Trim bottom of accumulator off */ accum->loc += overlap_size; accum->size -= overlap_size; - HDmemmove(accum->buf, accum->buf + overlap_size, accum->size); + memmove(accum->buf, accum->buf + overlap_size, accum->size); } /* end if */ else { /* Access covers whole accumulator */ /* Reset accumulator, but don't flush */ if (H5F__accum_reset(f_sh, FALSE) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") + HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator"); } /* end else */ } /* end if */ else { /* Write starts after beginning of accumulator */ size_t overlap_size; /* Size of overlapping region */ /* Sanity check */ - HDassert(H5F_addr_gt(addr + size, accum->loc + accum->size)); + assert(H5_addr_gt(addr + size, accum->loc + accum->size)); /* Compute overlap size */ overlap_size = (size_t)((accum->loc + accum->size) - addr); @@ -806,13 +796,13 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s dirty_start + accum->dirty_len; /* File address of end of dirty region */ /* Check if entire dirty region is overwritten */ - if (H5F_addr_ge(dirty_start, addr)) { + if (H5_addr_ge(dirty_start, addr)) { accum->dirty = FALSE; accum->dirty_len = 0; } /* end if */ else { /* Check for dirty region falling before write */ - if (H5F_addr_le(dirty_end, addr)) + if (H5_addr_le(dirty_end, addr)) ; /* noop */ else /* Dirty region overlaps w/written region */ accum->dirty_len = (size_t)(addr - dirty_start); @@ -828,7 +818,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s else { /* Write the data */ if (H5FD_write(file, map_type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed"); } /* end else */ done: @@ -843,9 +833,6 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 10 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -858,7 +845,7 @@ H5F__accum_free(H5F_shared_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f_sh); + assert(f_sh); /* Set up alias for file's metadata accumulator info */ accum = &f_sh->accum; @@ -867,19 +854,19 @@ H5F__accum_free(H5F_shared_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr file = f_sh->lf; /* Adjust the metadata accumulator to remove the freed block, if it overlaps */ - if ((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && - H5F_addr_overlap(addr, size, accum->loc, accum->size)) { + if ((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && H5_addr_defined(accum->loc) && + H5_addr_overlap(addr, size, accum->loc, accum->size)) { size_t overlap_size; /* Size of overlap with accumulator */ /* Sanity check */ /* (The metadata accumulator should not intersect w/raw data */ - HDassert(H5FD_MEM_DRAW != type); - HDassert(H5FD_MEM_GHEAP != type); /* (global heap data is being treated as raw data currently) */ + assert(H5FD_MEM_DRAW != type); + assert(H5FD_MEM_GHEAP != type); /* (global heap data is being treated as raw data currently) */ /* Check for overlapping the beginning of the accumulator */ - if (H5F_addr_le(addr, accum->loc)) { + if (H5_addr_le(addr, accum->loc)) { /* Check for completely overlapping the accumulator */ - if (H5F_addr_ge(addr + size, accum->loc + accum->size)) { + if (H5_addr_ge(addr + size, accum->loc + accum->size)) { /* Reset the accumulator, but don't free buffer */ accum->loc = HADDR_UNDEF; accum->size = 0; @@ -894,7 +881,7 @@ H5F__accum_free(H5F_shared_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr new_accum_size = accum->size - overlap_size; /* Move the accumulator buffer information to eliminate the freed block */ - HDmemmove(accum->buf, accum->buf + overlap_size, new_accum_size); + memmove(accum->buf, accum->buf + overlap_size, new_accum_size); /* Adjust the accumulator information */ accum->loc += overlap_size; @@ -927,36 +914,36 @@ H5F__accum_free(H5F_shared_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr H5_CHECKED_ASSIGN(overlap_size, size_t, (accum->loc + accum->size) - addr, haddr_t); /* Check if block to free begins before end of dirty region */ - if (accum->dirty && H5F_addr_lt(addr, dirty_end)) { + if (accum->dirty && H5_addr_lt(addr, dirty_end)) { haddr_t tail_addr; /* Calculate the address of the tail to write */ tail_addr = addr + size; /* Check if the block to free begins before dirty region */ - if (H5F_addr_lt(addr, dirty_start)) { + if (H5_addr_lt(addr, dirty_start)) { /* Check if block to free is entirely before dirty region */ - if (H5F_addr_le(tail_addr, dirty_start)) { + if (H5_addr_le(tail_addr, dirty_start)) { /* Write out the entire dirty region of the accumulator */ if (H5FD_write(file, H5FD_MEM_DEFAULT, dirty_start, accum->dirty_len, accum->buf + accum->dirty_off) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed"); } /* end if */ /* Block to free overlaps with some/all of dirty region */ /* Check for unfreed dirty region to write */ - else if (H5F_addr_lt(tail_addr, dirty_end)) { + else if (H5_addr_lt(tail_addr, dirty_end)) { size_t write_size; size_t dirty_delta; write_size = (size_t)(dirty_end - tail_addr); dirty_delta = accum->dirty_len - write_size; - HDassert(write_size > 0); + assert(write_size > 0); /* Write out the unfreed dirty region of the accumulator */ if (H5FD_write(file, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, accum->buf + accum->dirty_off + dirty_delta) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed"); } /* end if */ /* Reset dirty flag */ @@ -965,23 +952,23 @@ H5F__accum_free(H5F_shared_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr /* Block to free begins at beginning of or in middle of dirty region */ else { /* Check if block to free ends before end of dirty region */ - if (H5F_addr_lt(tail_addr, dirty_end)) { + if (H5_addr_lt(tail_addr, dirty_end)) { size_t write_size; size_t dirty_delta; write_size = (size_t)(dirty_end - tail_addr); dirty_delta = accum->dirty_len - write_size; - HDassert(write_size > 0); + assert(write_size > 0); /* Write out the unfreed end of the dirty region of the accumulator */ if (H5FD_write(file, H5FD_MEM_DEFAULT, dirty_start + dirty_delta, write_size, accum->buf + accum->dirty_off + dirty_delta) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed"); } /* end if */ /* Check for block to free beginning at same location as dirty region */ - if (H5F_addr_eq(addr, dirty_start)) { + if (H5_addr_eq(addr, dirty_start)) { /* Reset dirty flag */ accum->dirty = FALSE; } /* end if */ @@ -1009,9 +996,6 @@ H5F__accum_free(H5F_shared_t *f_sh, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 10 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -1022,7 +1006,7 @@ H5F__accum_flush(H5F_shared_t *f_sh) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); + assert(f_sh); /* Check if we need to flush out the metadata accumulator */ if ((f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && f_sh->accum.dirty) { @@ -1034,7 +1018,7 @@ H5F__accum_flush(H5F_shared_t *f_sh) /* Flush the metadata contents */ if (H5FD_write(file, H5FD_MEM_DEFAULT, f_sh->accum.loc + f_sh->accum.dirty_off, f_sh->accum.dirty_len, f_sh->accum.buf + f_sh->accum.dirty_off) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed"); /* Reset the dirty flag */ f_sh->accum.dirty = FALSE; @@ -1051,9 +1035,6 @@ H5F__accum_flush(H5F_shared_t *f_sh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 10 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -1064,12 +1045,12 @@ H5F__accum_reset(H5F_shared_t *f_sh, hbool_t flush) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f_sh); + assert(f_sh); /* Flush any dirty data in accumulator, if requested */ if (flush) if (H5F__accum_flush(f_sh) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "can't flush metadata accumulator"); /* Check if we need to reset the metadata accumulator information */ if (f_sh->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) { diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FcreatProp.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5FcreatProp.cpp deleted file mode 100644 index b51ba10fe0..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FcreatProp.cpp +++ /dev/null @@ -1,388 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5FcreatProp.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control -// the order of creation and deletion of the global constants. See Design Notes -// in "H5PredType.cpp" for information. - -// Initialize a pointer for the constant -FileCreatPropList *FileCreatPropList::DEFAULT_ = 0; - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::getConstant -// Purpose Creates a FileCreatPropList object representing the HDF5 -// constant H5P_FILE_ACCESS, pointed to by FileCreatPropList::DEFAULT_ -// exception H5::PropListIException -// Description -// If FileCreatPropList::DEFAULT_ already points to an allocated -// object, throw a PropListIException. This scenario should not happen. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -FileCreatPropList * -FileCreatPropList::getConstant() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the constant pointer is not allocated, allocate it. Otherwise, - // throw because it shouldn't be. - if (DEFAULT_ == 0) - DEFAULT_ = new FileCreatPropList(H5P_FILE_CREATE); - else - throw PropListIException("FileCreatPropList::getConstant", - "FileCreatPropList::getConstant is being invoked on an allocated DEFAULT_"); - return (DEFAULT_); -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::deleteConstants -// Purpose Deletes the constant object that FileCreatPropList::DEFAULT_ -// points to. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -FileCreatPropList::deleteConstants() -{ - delete DEFAULT_; -} - -//-------------------------------------------------------------------------- -// Purpose Constant for default property -//-------------------------------------------------------------------------- -const FileCreatPropList &FileCreatPropList::DEFAULT = *getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList default constructor -///\brief Default constructor: Creates a file create property list -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FileCreatPropList::FileCreatPropList() : PropList(H5P_FILE_CREATE) -{ -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList copy constructor -///\brief Copy constructor: same HDF5 object as \a original -/// FileCreatPropList object. -///\param original - IN: FileCreatPropList instance to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FileCreatPropList::FileCreatPropList(const FileCreatPropList &original) : PropList(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList overloaded constructor -///\brief Creates a file creation property list using the id of an -/// existing one. -///\param plist_id - IN: FileCreatPropList id to use -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id) -{ -} - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::getVersion -///\brief Retrieves version information for various parts of a file. -///\param super - OUT: The file super block. -///\param freelist - OUT: The global free list. -///\param stab - OUT: The root symbol table entry. -///\param shhdr - OUT: Shared object headers. -///\exception H5::PropListIException -///\par Description -/// Any (or even all) of the output arguments can be null pointers. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileCreatPropList::getVersion(unsigned &super, unsigned &freelist, unsigned &stab, unsigned &shhdr) const -{ - herr_t ret_value = H5Pget_version(id, &super, &freelist, &stab, &shhdr); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::getVersion", "H5Pget_version failed"); - } -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::setUserblock -///\brief Sets the user block size field of this file creation property list. -///\param size - IN: User block size to be set, in bytes -///\exception H5::PropListIException -///\par Description -/// The default user block size is 0; it may be set to any power -/// of 2 equal to 512 or greater (512, 1024, 2048, etc.) -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileCreatPropList::setUserblock(hsize_t size) const -{ - herr_t ret_value = H5Pset_userblock(id, size); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::setUserblock", "H5Pset_userblock failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::getUserblock -///\brief Returns the user block size of this file creation property list. -///\return User block size -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -hsize_t -FileCreatPropList::getUserblock() const -{ - hsize_t userblock_size; - herr_t ret_value = H5Pget_userblock(id, &userblock_size); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::getUserblock", "H5Pget_userblock failed"); - } - return (userblock_size); -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::setSizes -///\brief Sets the byte size of the offsets and lengths used to -/// address objects in an HDF5 file. -///\param sizeof_addr - IN: Size of an object offset in bytes -///\param sizeof_size - IN: Size of an object length in bytes. -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_sizes API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const -{ - herr_t ret_value = H5Pset_sizes(id, sizeof_addr, sizeof_size); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::setSizes", "H5Pset_sizes failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::getSizes -///\brief Retrieves the size of the offsets and lengths used in an -/// HDF5 file. -/// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileCreatPropList::getSizes(size_t &sizeof_addr, size_t &sizeof_size) const -{ - herr_t ret_value = H5Pget_sizes(id, &sizeof_addr, &sizeof_size); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::getSizes", "H5Pget_sizes failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::setSymk -///\brief Sets the size of parameters used to control the symbol table -/// nodes. -///\param ik - IN: Symbol table tree rank -///\param lk - IN: Symbol table node size -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_sym_k API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileCreatPropList::setSymk(unsigned ik, unsigned lk) const -{ - herr_t ret_value = H5Pset_sym_k(id, ik, lk); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::setSymk", "H5Pset_sym_k failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::getSymk -///\brief Retrieves the size of the symbol table B-tree 1/2 rank and -/// the symbol table leaf node 1/2 size. -/// -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pget_sym_k API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileCreatPropList::getSymk(unsigned &ik, unsigned &lk) const -{ - herr_t ret_value = H5Pget_sym_k(id, &ik, &lk); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::getSymk", "H5Pget_sym_k failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::setIstorek -///\brief Sets the size of the parameter used to control the B-trees -/// for indexing chunked datasets. -///\param ik - IN: 1/2 rank of chunked storage B-tree -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pset_istore_k API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FileCreatPropList::setIstorek(unsigned ik) const -{ - herr_t ret_value = H5Pset_istore_k(id, ik); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::setIstorek", "H5Pset_istore_k failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::getIstorek -///\brief Returns the 1/2 rank of an indexed storage B-tree. -///\return 1/2 rank of chunked storage B-tree -///\exception H5::PropListIException -///\par Description -/// For information, please refer to the H5Pget_istore_k API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -unsigned -FileCreatPropList::getIstorek() const -{ - unsigned ik; - herr_t ret_value = H5Pget_istore_k(id, &ik); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::getIstorek", "H5Pget_istore_k failed"); - } - return (ik); -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::setFileSpaceStrategy -///\brief Sets the strategy and the threshold value that the library -/// will employ in managing file space. -///\param strategy - IN: Strategy for file space management -///\param persist - IN: Whether to persist free-space -///\param threshold - IN: Free-space section threshold. The library -/// default is 1, which is to track all free-space sections. -///\exception H5::PropListIException -///\par Description -/// If the given strategy is zero, the property will not be -/// changed and the existing strategy will be retained. -/// If the given threshold value is zero, the property will not be -/// changed and the existing threshold will be retained. -/// For information, please refer to the H5Pset_file_space_strategy -/// API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - Feb, 2017 -//-------------------------------------------------------------------------- -void -FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, - hsize_t threshold) const -{ - herr_t ret_value = H5Pset_file_space_strategy(id, strategy, persist, threshold); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::setFileSpaceStrategy", - "H5Pset_file_space_strategy failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::getFileSpaceStrategy -///\brief Retrieves the strategy, persist, and threshold that the library -/// uses in managing file space. -///\param strategy - OUT: Strategy for file space management -///\param persist - OUT: Whether to persist free-space -///\param threshold - OUT: Free-space section threshold -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Feb, 2017 -//-------------------------------------------------------------------------- -void -FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t &strategy, hbool_t &persist, - hsize_t &threshold) const -{ - herr_t ret_value = H5Pget_file_space_strategy(id, &strategy, &persist, &threshold); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::getFileSpaceStrategy", - "H5Pget_file_space_strategy failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::setFileSpacePagesize -///\brief Sets the file space page size for paged aggregation. -///\param fsp_psize - IN: Filespace's page size -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Feb, 2017 -//-------------------------------------------------------------------------- -void -FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const -{ - herr_t ret_value = H5Pset_file_space_page_size(id, fsp_psize); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::setFileSpacePagesize", - "H5Pset_file_space_page_size failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList::getFileSpacePagesize -///\brief Returns the file space page size for aggregating small -/// metadata or raw data. -///\return File space page size -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Feb, 2017 -//-------------------------------------------------------------------------- -hsize_t -FileCreatPropList::getFileSpacePagesize() const -{ - hsize_t fsp_psize = 0; - herr_t ret_value = H5Pget_file_space_page_size(id, &fsp_psize); - if (ret_value < 0) { - throw PropListIException("FileCreatPropList::getFileSpacePagesize", - "H5Pget_file_space_page_size failed"); - } - return (fsp_psize); -} - -//-------------------------------------------------------------------------- -// Function: FileCreatPropList destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FileCreatPropList::~FileCreatPropList() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fcwfs.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fcwfs.c index 43c8cf7eec..e05de9f539 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fcwfs.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fcwfs.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, July 19, 2011 - * * Purpose: Each file has a small cache of global heap collections called * the CWFS list and recently accessed collections with free * space appear on this list. As collections are accessed the @@ -87,9 +83,6 @@ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, July 19, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -100,9 +93,9 @@ H5F_cwfs_add(H5F_t *f, H5HG_heap_t *heap) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(f); - HDassert(f->shared); - HDassert(heap); + assert(f); + assert(f->shared); + assert(heap); /* * Add the new heap to the CWFS list, removing some other entry if @@ -111,7 +104,7 @@ H5F_cwfs_add(H5F_t *f, H5HG_heap_t *heap) */ if (NULL == f->shared->cwfs) { if (NULL == (f->shared->cwfs = (H5HG_heap_t **)H5MM_malloc(H5F_NCWFS * sizeof(H5HG_heap_t *)))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate CWFS for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate CWFS for file"); f->shared->cwfs[0] = heap; f->shared->ncwfs = 1; } @@ -120,13 +113,13 @@ H5F_cwfs_add(H5F_t *f, H5HG_heap_t *heap) for (i = H5F_NCWFS - 1; i >= 0; --i) if (H5HG_FREE_SIZE(f->shared->cwfs[i]) < H5HG_FREE_SIZE(heap)) { - HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, (size_t)i * sizeof(H5HG_heap_t *)); + memmove(f->shared->cwfs + 1, f->shared->cwfs, (size_t)i * sizeof(H5HG_heap_t *)); f->shared->cwfs[0] = heap; break; } /* end if */ } else { - HDmemmove(f->shared->cwfs + 1, f->shared->cwfs, f->shared->ncwfs * sizeof(H5HG_heap_t *)); + memmove(f->shared->cwfs + 1, f->shared->cwfs, f->shared->ncwfs * sizeof(H5HG_heap_t *)); f->shared->cwfs[0] = heap; f->shared->ncwfs += 1; } /* end else */ @@ -144,9 +137,6 @@ H5F_cwfs_add(H5F_t *f, H5HG_heap_t *heap) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, July 20, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -159,9 +149,9 @@ H5F_cwfs_find_free_heap(H5F_t *f, size_t need, haddr_t *addr) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(f); - HDassert(f->shared); - HDassert(addr); + assert(f); + assert(f->shared); + assert(addr); /* Note that we don't have metadata cache locks on the entries in * f->shared->cwfs. @@ -205,10 +195,11 @@ H5F_cwfs_find_free_heap(H5F_t *f, size_t need, haddr_t *addr) H5MF_try_extend(f, H5FD_MEM_GHEAP, H5HG_ADDR(f->shared->cwfs[cwfsno]), (hsize_t)H5HG_SIZE(f->shared->cwfs[cwfsno]), (hsize_t)new_need); if (was_extended < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "error trying to extend heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "error trying to extend heap"); else if (was_extended == TRUE) { if (H5HG_extend(f, H5HG_ADDR(f->shared->cwfs[cwfsno]), new_need) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to extend global heap collection") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, + "unable to extend global heap collection"); *addr = H5HG_ADDR(f->shared->cwfs[cwfsno]); found = TRUE; break; @@ -241,9 +232,6 @@ H5F_cwfs_find_free_heap(H5F_t *f, size_t need, haddr_t *addr) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, July 20, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -255,9 +243,9 @@ H5F_cwfs_advance_heap(H5F_t *f, H5HG_heap_t *heap, hbool_t add_heap) FUNC_ENTER_NOAPI_NOERR /* Check args */ - HDassert(f); - HDassert(f->shared); - HDassert(heap); + assert(f); + assert(f->shared); + assert(heap); for (u = 0; u < f->shared->ncwfs; u++) if (f->shared->cwfs[u] == heap) { @@ -283,9 +271,6 @@ H5F_cwfs_advance_heap(H5F_t *f, H5HG_heap_t *heap, hbool_t add_heap) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, July 20, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -297,14 +282,14 @@ H5F_cwfs_remove_heap(H5F_shared_t *shared, H5HG_heap_t *heap) FUNC_ENTER_NOAPI_NOERR /* Check args */ - HDassert(shared); - HDassert(heap); + assert(shared); + assert(heap); /* Remove the heap from the CWFS list */ for (u = 0; u < shared->ncwfs; u++) { if (shared->cwfs[u] == heap) { shared->ncwfs -= 1; - HDmemmove(shared->cwfs + u, shared->cwfs + u + 1, (shared->ncwfs - u) * sizeof(H5HG_heap_t *)); + memmove(shared->cwfs + u, shared->cwfs + u + 1, (shared->ncwfs - u) * sizeof(H5HG_heap_t *)); break; } /* end if */ } /* end for */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fdbg.c index e6c1242d09..3b1aad37db 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Wednesday, July 9, 2003 - * +/* * Purpose: File object debugging functions. */ @@ -36,9 +33,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 1 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -51,69 +45,69 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Get property list */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Retrieve file creation properties */ if (H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get userblock size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get userblock size"); /* debug */ - HDfprintf(stream, "%*sFile Super Block...\n", indent, ""); + fprintf(stream, "%*sFile Super Block...\n", indent, ""); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "File name (as opened):", H5F_OPEN_NAME(f)); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "File name (after resolving symlinks):", H5F_ACTUAL_NAME(f)); - HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "File access flags", f->shared->flags); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "File open reference count:", f->shared->nrefs); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (abs)\n", indent, "", fwidth, - "Address of super block:", f->shared->sblock->base_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " bytes\n", indent, "", fwidth, - "Size of userblock:", userblock_size); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "File name (as opened):", H5F_OPEN_NAME(f)); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "File name (after resolving symlinks):", H5F_ACTUAL_NAME(f)); + fprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "File access flags", f->shared->flags); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "File open reference count:", f->shared->nrefs); + fprintf(stream, "%*s%-*s %" PRIuHADDR " (abs)\n", indent, "", fwidth, + "Address of super block:", f->shared->sblock->base_addr); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " bytes\n", indent, "", fwidth, + "Size of userblock:", userblock_size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Superblock version number:", f->shared->sblock->super_vers); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Superblock version number:", f->shared->sblock->super_vers); /* Hard-wired versions */ - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Free list version number:", (unsigned)HDF5_FREESPACE_VERSION); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Root group symbol table entry version number:", (unsigned)HDF5_OBJECTDIR_VERSION); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Shared header version number:", (unsigned)HDF5_SHAREDHEADER_VERSION); - - HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, - "Size of file offsets (haddr_t type):", (unsigned)f->shared->sizeof_addr); - HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, - "Size of file lengths (hsize_t type):", (unsigned)f->shared->sizeof_size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Symbol table leaf node 1/2 rank:", f->shared->sblock->sym_leaf_k); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Symbol table internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_SNODE_ID]); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Indexed storage internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_CHUNK_ID]); - HDfprintf(stream, "%*s%-*s 0x%02x\n", indent, "", fwidth, - "File status flags:", (unsigned)(f->shared->sblock->status_flags)); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, - "Superblock extension address:", f->shared->sblock->ext_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, - "Shared object header message table address:", f->shared->sohm_addr); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Shared object header message version number:", (unsigned)f->shared->sohm_vers); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Number of shared object header message indexes:", (unsigned)f->shared->sohm_nindexes); - - HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, - "Address of driver information block:", f->shared->sblock->driver_addr); - - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Root group symbol table entry:", f->shared->root_grp ? "" : "(none)"); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Free list version number:", (unsigned)HDF5_FREESPACE_VERSION); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Root group symbol table entry version number:", (unsigned)HDF5_OBJECTDIR_VERSION); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Shared header version number:", (unsigned)HDF5_SHAREDHEADER_VERSION); + + fprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, + "Size of file offsets (haddr_t type):", (unsigned)f->shared->sizeof_addr); + fprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, + "Size of file lengths (hsize_t type):", (unsigned)f->shared->sizeof_size); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Symbol table leaf node 1/2 rank:", f->shared->sblock->sym_leaf_k); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Symbol table internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_SNODE_ID]); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Indexed storage internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_CHUNK_ID]); + fprintf(stream, "%*s%-*s 0x%02x\n", indent, "", fwidth, + "File status flags:", (unsigned)(f->shared->sblock->status_flags)); + fprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, + "Superblock extension address:", f->shared->sblock->ext_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, + "Shared object header message table address:", f->shared->sohm_addr); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Shared object header message version number:", (unsigned)f->shared->sohm_vers); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Number of shared object header message indexes:", (unsigned)f->shared->sohm_nindexes); + + fprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, + "Address of driver information block:", f->shared->sblock->driver_addr); + + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Root group symbol table entry:", f->shared->root_grp ? "" : "(none)"); if (f->shared->root_grp) { if (f->shared->sblock->root_ent) /* Use real root group symbol table entry */ H5G__ent_debug(f->shared->sblock->root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); @@ -126,7 +120,7 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) /* Build up a simulated root group symbol table entry */ root_oloc = H5G_oloc(f->shared->root_grp); - HDassert(root_oloc); + assert(root_oloc); root_ent.type = H5G_NOTHING_CACHED; root_ent.header = root_oloc->addr; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fdeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fdeprec.c index 94fba65ef1..257b7b21de 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fdeprec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fdeprec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Fdeprec.c - * October 1 2009 - * Quincey Koziol * * Purpose: Deprecated functions from the H5F interface. These * functions are here for compatibility purposes and may be @@ -101,17 +98,17 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo /*out*/) /* Check args */ if (!finfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct"); /* Check the type */ type = H5I_get_type(obj_id); if (H5I_FILE != type && H5I_GROUP != type && H5I_DATATYPE != type && H5I_DATASET != type && H5I_ATTR != type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Get the file object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Set up VOL callback arguments */ file_opt_args.get_info.type = type; @@ -121,7 +118,7 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo /*out*/) /* Get the file information */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info"); /* Copy the compatible fields into the older struct */ finfo->super_ext_size = finfo2.super.super_ext_size; @@ -157,7 +154,7 @@ H5Fis_hdf5(const char *name) /* Check args and all the boring stuff. */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE; @@ -167,7 +164,7 @@ H5Fis_hdf5(const char *name) /* Check if file is accessible */ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5") + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5"); /* Set return value */ ret_value = (htri_t)is_accessible; @@ -206,8 +203,6 @@ H5Fis_hdf5(const char *name) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; December 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -224,11 +219,11 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "not a file ID"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* 'low' and 'high' are both initialized to LATEST. * If latest format is not expected, set 'low' to EARLIEST @@ -244,7 +239,7 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format) /* Set the library's version bounds */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fefc.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fefc.c index 6edb7a9498..194ecbe6da 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fefc.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fefc.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Defc.c - * December 13, 2010 - * Neil Fortner * * Purpose: External file caching routines - implements a * cache of external files to minimize the number of @@ -82,9 +79,6 @@ H5FL_DEFINE_STATIC(H5F_efc_t); * Return: Pointer to new external file cache object on success * NULL on failure * - * Programmer: Neil Fortner - * Tuesday, December 14, 2010 - * *------------------------------------------------------------------------- */ H5F_efc_t * @@ -96,11 +90,11 @@ H5F__efc_create(unsigned max_nfiles) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(max_nfiles > 0); + assert(max_nfiles > 0); /* Allocate EFC struct */ if (NULL == (efc = H5FL_CALLOC(H5F_efc_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Initialize maximum number of files */ efc->max_nfiles = max_nfiles; @@ -132,15 +126,11 @@ H5F__efc_create(unsigned max_nfiles) * Return: Pointer to open file on success * NULL on failure * - * Programmer: Neil Fortner - * Tuesday, December 14, 2010 - * *------------------------------------------------------------------------- */ H5F_t * -H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) +H5F__efc_open(H5F_efc_t *efc, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5F_efc_t *efc = NULL; /* External file cache for parent file */ H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */ hbool_t open_file = FALSE; /* Whether ent->file needs to be closed in case of error */ H5P_genplist_t *plist; /* Property list pointer for FAPL */ @@ -150,35 +140,30 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(parent); - HDassert(parent->shared); - HDassert(name); + assert(name); /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "not a file access property list"); if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info"); /* Stash a copy of the "top-level" connector property, before any pass-through * connectors modify or unwrap it. */ if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set VOL connector info in API context") - - /* Get external file cache */ - efc = parent->shared->efc; + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set VOL connector info in API context"); /* Check if the EFC exists. If it does not, just call H5F_open(). We * support this so clients do not have to make 2 different calls depending * on the state of the efc. */ if (!efc) { if (NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file"); /* Make file post open call */ if (H5F__post_open(ret_value) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file"); /* Increment the number of open objects to prevent the file from being * closed out from under us - "simulate" having an open file id. Note @@ -186,7 +171,7 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi * H5F_decr_nopen_objs() in H5L_extern_traverse(). */ ret_value->nopen_objs++; - HGOTO_DONE(ret_value) + HGOTO_DONE(ret_value); } /* end if */ /* Search the skip list for name if the skip list exists, create the skip @@ -196,20 +181,20 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi ent = (H5F_efc_ent_t *)H5SL_search(efc->slist, name); } /* end if */ else { - HDassert(efc->nfiles == 0); + assert(efc->nfiles == 0); if (NULL == (efc->slist = H5SL_create(H5SL_TYPE_STR, NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, NULL, "can't create skip list") + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, NULL, "can't create skip list"); } /* end else */ /* If we found the file update the LRU list and return the cached file, * otherwise open the file and cache it */ if (ent) { - HDassert(efc->LRU_head); - HDassert(efc->LRU_tail); + assert(efc->LRU_head); + assert(efc->LRU_tail); /* Move ent to the head of the LRU list, if it is not already there */ if (ent->LRU_prev) { - HDassert(efc->LRU_head != ent); + assert(efc->LRU_head != ent); /* Remove from current position. Note that once we touch the LRU * list we cannot revert to the previous state. Make sure there can @@ -218,7 +203,7 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi if (ent->LRU_next) ent->LRU_next->LRU_prev = ent->LRU_prev; else { - HDassert(efc->LRU_tail == ent); + assert(efc->LRU_tail == ent); efc->LRU_tail = ent->LRU_prev; } /* end else */ ent->LRU_prev->LRU_next = ent->LRU_next; @@ -244,44 +229,45 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi * do not add it to cache */ if (ent) { if (H5F__efc_remove_ent(efc, ent) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, NULL, "can't remove entry from external file cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, NULL, + "can't remove entry from external file cache"); /* Do not free ent, we will recycle it below */ } /* end if */ else { /* Cannot cache file, just open file and return */ if (NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file"); /* Make file post open call */ if (H5F__post_open(ret_value) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file"); /* Increment the number of open objects to prevent the file from * being closed out from under us - "simulate" having an open * file id */ ret_value->nopen_objs++; - HGOTO_DONE(ret_value) + HGOTO_DONE(ret_value); } /* end else */ } /* end if */ else /* Allocate new entry */ if (NULL == (ent = H5FL_MALLOC(H5F_efc_ent_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Build new entry */ if (NULL == (ent->name = H5MM_strdup(name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Open the file */ if (NULL == (ent->file = H5F_open(name, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file"); open_file = TRUE; /* Make file post open call */ if (H5F__post_open(ent->file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file"); /* Increment the number of open objects to prevent the file from being * closed out from under us - "simulate" having an open file id */ @@ -290,7 +276,7 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi /* Add the file to the cache */ /* Skip list */ if (H5SL_insert(efc->slist, ent, ent->name) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, NULL, "can't insert entry into skip list") + HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, NULL, "can't insert entry into skip list"); /* Add to head of LRU list and update tail if necessary */ ent->LRU_next = efc->LRU_head; @@ -299,7 +285,7 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi ent->LRU_prev = NULL; efc->LRU_head = ent; if (!efc->LRU_tail) { - HDassert(!ent->LRU_next); + assert(!ent->LRU_next); efc->LRU_tail = ent; } /* end if */ @@ -312,10 +298,10 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi ent->file->shared->efc->nrefs++; } /* end else */ - HDassert(ent); - HDassert(ent->file); - HDassert(ent->name); - HDassert(ent->nopen); + assert(ent); + assert(ent->file); + assert(ent->name); + assert(ent->nopen); /* Set the return value */ ret_value = ent->file; @@ -326,7 +312,7 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi if (open_file) { ent->file->nopen_objs--; if (H5F_try_close(ent->file, NULL) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close external file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close external file"); } /* end if */ ent->name = (char *)H5MM_xfree(ent->name); ent = H5FL_FREE(H5F_efc_ent_t, ent); @@ -345,9 +331,6 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi * Return: Non-negative on success * Negative on failure * - * Programmer: Neil Fortner - * Wednesday, December 15, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -360,10 +343,10 @@ H5F_efc_close(H5F_t *parent, H5F_t *file) FUNC_ENTER_NOAPI_NOINIT /* Sanity checks */ - HDassert(parent); - HDassert(parent->shared); - HDassert(file); - HDassert(file->shared); + assert(parent); + assert(parent->shared); + assert(file); + assert(file->shared); /* Get external file cache */ efc = parent->shared->efc; @@ -374,9 +357,9 @@ H5F_efc_close(H5F_t *parent, H5F_t *file) if (!efc) { file->nopen_objs--; if (H5F_try_close(file, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file"); - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Scan the parent's LRU list from the head to file file. We do this @@ -389,7 +372,7 @@ H5F_efc_close(H5F_t *parent, H5F_t *file) if (!ent) { file->nopen_objs--; if (H5F_try_close(file, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file"); } /* end if */ else /* Reduce the open count on this entry */ @@ -407,9 +390,6 @@ H5F_efc_close(H5F_t *parent, H5F_t *file) * * Return: Maximum number of files (never fails) * - * Programmer: Neil Fortner - * Wednesday, December 15, 2010 - * *------------------------------------------------------------------------- */ unsigned @@ -417,8 +397,8 @@ H5F__efc_max_nfiles(H5F_efc_t *efc) { FUNC_ENTER_PACKAGE_NOERR - HDassert(efc); - HDassert(efc->max_nfiles > 0); + assert(efc); + assert(efc->max_nfiles > 0); FUNC_LEAVE_NOAPI(efc->max_nfiles) } /* end H5F__efc_max_nfiles */ @@ -433,9 +413,6 @@ H5F__efc_max_nfiles(H5F_efc_t *efc) * Return: Non-negative on success * Negative on failure * - * Programmer: Neil Fortner - * Wednesday, December 15, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -448,14 +425,14 @@ H5F__efc_release_real(H5F_efc_t *efc) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(efc); + assert(efc); /* Lock the EFC to prevent manipulation of the EFC while we are releasing it. * The EFC should never be locked when we enter this function because that * would require a cycle, a cycle would necessarily invoke * H5F__efc_try_close(), and that function checks the status of the lock * before calling this one. */ - HDassert((efc->tag == H5F_EFC_TAG_DEFAULT) || (efc->tag == H5F_EFC_TAG_CLOSE)); + assert((efc->tag == H5F_EFC_TAG_DEFAULT) || (efc->tag == H5F_EFC_TAG_CLOSE)); efc->tag = H5F_EFC_TAG_LOCK; /* Walk down the LRU list, releasing any files that are not opened by an EFC @@ -464,7 +441,7 @@ H5F__efc_release_real(H5F_efc_t *efc) while (ent) if (!ent->nopen) { if (H5F__efc_remove_ent(efc, ent) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, FAIL, "can't remove entry from external file cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, FAIL, "can't remove entry from external file cache"); /* Free the entry and move to next entry in LRU list */ prev_ent = ent; @@ -480,7 +457,7 @@ H5F__efc_release_real(H5F_efc_t *efc) efc->tag = H5F_EFC_TAG_DEFAULT; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__efc_release_real() */ /*------------------------------------------------------------------------- @@ -493,9 +470,6 @@ H5F__efc_release_real(H5F_efc_t *efc) * Return: Non-negative on success * Negative on failure * - * Programmer: Quincey Koziol - * Sunday, February 18, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -506,11 +480,11 @@ H5F__efc_release(H5F_efc_t *efc) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(efc); + assert(efc); /* Call 'real' routine */ if (H5F__efc_release_real(efc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't remove entry from external file cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't remove entry from external file cache"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -526,9 +500,6 @@ H5F__efc_release(H5F_efc_t *efc) * Return: Non-negative on success * Negative on failure * - * Programmer: Neil Fortner - * Wednesday, December 15, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -539,32 +510,32 @@ H5F__efc_destroy(H5F_efc_t *efc) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(efc); + assert(efc); if (efc->nfiles > 0) { /* Release (clear) the efc */ if (H5F__efc_release_real(efc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache"); /* If there are still cached files, return an error */ if (efc->nfiles > 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't destroy EFC after incomplete release") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't destroy EFC after incomplete release"); } /* end if */ - HDassert(efc->nfiles == 0); - HDassert(efc->LRU_head == NULL); - HDassert(efc->LRU_tail == NULL); + assert(efc->nfiles == 0); + assert(efc->LRU_head == NULL); + assert(efc->LRU_tail == NULL); /* Close skip list */ if (efc->slist) if (H5SL_close(efc->slist) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close skip list") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close skip list"); /* Free EFC object */ (void)H5FL_FREE(H5F_efc_t, efc); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__efc_destroy() */ /*------------------------------------------------------------------------- @@ -576,9 +547,6 @@ H5F__efc_destroy(H5F_efc_t *efc) * Return: Non-negative on success * Negative on failure * - * Programmer: Neil Fortner - * Wednesday, December 15, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -589,25 +557,25 @@ H5F__efc_remove_ent(H5F_efc_t *efc, H5F_efc_ent_t *ent) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(efc); - HDassert(efc->slist); - HDassert(ent); + assert(efc); + assert(efc->slist); + assert(ent); /* Remove from skip list */ if (ent != H5SL_remove(efc->slist, ent->name)) - HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "can't delete entry from skip list") + HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, "can't delete entry from skip list"); /* Remove from LRU list */ if (ent->LRU_next) ent->LRU_next->LRU_prev = ent->LRU_prev; else { - HDassert(efc->LRU_tail == ent); + assert(efc->LRU_tail == ent); efc->LRU_tail = ent->LRU_prev; } /* end else */ if (ent->LRU_prev) ent->LRU_prev->LRU_next = ent->LRU_next; else { - HDassert(efc->LRU_head == ent); + assert(efc->LRU_head == ent); efc->LRU_head = ent->LRU_next; } /* end else */ @@ -625,7 +593,7 @@ H5F__efc_remove_ent(H5F_efc_t *efc, H5F_efc_ent_t *ent) * from being closed out from under us. */ ent->file->nopen_objs--; if (H5F_try_close(ent->file, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file"); ent->file = NULL; done: @@ -641,9 +609,6 @@ H5F__efc_remove_ent(H5F_efc_t *efc, H5F_efc_ent_t *ent) * * Return: void (never fails) * - * Programmer: Neil Fortner - * Monday, January 10, 2011 - * *------------------------------------------------------------------------- */ static void @@ -655,12 +620,12 @@ H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(sf); - HDassert(sf->efc); - HDassert((sf->efc->tag > 0) || (sf->nrefs == sf->efc->nrefs)); - HDassert(sf->efc->tag != H5F_EFC_TAG_LOCK); - HDassert(tail); - HDassert(*tail); + assert(sf); + assert(sf->efc); + assert((sf->efc->tag > 0) || (sf->nrefs == sf->efc->nrefs)); + assert(sf->efc->tag != H5F_EFC_TAG_LOCK); + assert(tail); + assert(*tail); /* Recurse into this file's cached files */ for (ent = sf->efc->LRU_head; ent; ent = ent->LRU_next) { @@ -669,7 +634,7 @@ H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail) if (esf->efc) { /* If tag were 0, that would mean there are more actual references * than are counted by nrefs */ - HDassert(esf->efc->tag != 0); + assert(esf->efc->tag != 0); /* If tag has been set, we have already visited this file so just * decrement tag and continue */ @@ -685,7 +650,7 @@ H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail) !(ent->nopen)) { /* If we get here, this file's "tmp_next" pointer must be NULL */ - HDassert(esf->efc->tmp_next == NULL); + assert(esf->efc->tmp_next == NULL); /* If nrefs > 1, Add this file to the list of files with nrefs > * 1 and initialize tag to the number of references (except this @@ -714,9 +679,6 @@ H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail) * * Return: void (never fails) * - * Programmer: Neil Fortner - * Monday, January 10, 2011 - * *------------------------------------------------------------------------- */ static void @@ -728,8 +690,8 @@ H5F__efc_try_close_tag2(H5F_shared_t *sf, H5F_shared_t **tail) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(sf); - HDassert(sf->efc); + assert(sf); + assert(sf->efc); /* Recurse into this file's cached files */ for (ent = sf->efc->LRU_head; ent; ent = ent->LRU_next) { @@ -748,8 +710,8 @@ H5F__efc_try_close_tag2(H5F_shared_t *sf, H5F_shared_t **tail) ((esf->efc->tag == H5F_EFC_TAG_DEFAULT) && (esf->nrefs == esf->efc->nrefs) && !(ent->nopen)))) { /* tag should always be CLOSE is nrefs > 1 or DEFAULT if nrefs == 1 * here */ - HDassert(((esf->nrefs > 1) && ((esf->efc->tag == H5F_EFC_TAG_CLOSE))) || - ((esf->nrefs == 1) && (esf->efc->tag == H5F_EFC_TAG_DEFAULT))); + assert(((esf->nrefs > 1) && ((esf->efc->tag == H5F_EFC_TAG_CLOSE))) || + ((esf->nrefs == 1) && (esf->efc->tag == H5F_EFC_TAG_DEFAULT))); /* If tag is set to DONTCLOSE, we have already visited this file * *or* it will be the start point of another iteration so just @@ -818,9 +780,6 @@ H5F__efc_try_close_tag2(H5F_shared_t *sf, H5F_shared_t **tail) * Return: Non-negative on success * Negative on failure * - * Programmer: Neil Fortner - * Thursday, January 6, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -838,12 +797,12 @@ H5F__efc_try_close(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->efc); - HDassert(f->shared->nrefs > f->shared->efc->nrefs); - HDassert(f->shared->nrefs > 1); - HDassert(f->shared->efc->tag < 0); + assert(f); + assert(f->shared); + assert(f->shared->efc); + assert(f->shared->nrefs > f->shared->efc->nrefs); + assert(f->shared->nrefs > 1); + assert(f->shared->efc->tag < 0); if (f->shared->efc->tag == H5F_EFC_TAG_CLOSE) { /* We must have reentered this function, and we should close this file. @@ -851,7 +810,7 @@ H5F__efc_try_close(H5F_t *f) * eventually reduce this file's reference count to 1 (though possibly * not from this call to H5F__efc_release_real()). */ if (H5F__efc_release_real(f->shared->efc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache"); /* If we marked the file as closeable, there must be no open files in * its EFC. This is because, in order to close an open child file, the @@ -859,9 +818,9 @@ H5F__efc_try_close(H5F_t *f) * detect that the parent file is open (directly or through an EFC) and * refuse to close it. Verify that all files were released from this * EFC (i.e. none were open). */ - HDassert(f->shared->efc->nfiles == 0); + assert(f->shared->efc->nfiles == 0); - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Conditions where we should not do anything and just return immediately */ @@ -880,15 +839,15 @@ H5F__efc_try_close(H5F_t *f) (f->shared->efc->nfiles == 0)) /* We must have reentered this function, and we should not close this * file. Just return. */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* If the file EFC were locked, that should always mean that there exists * a reference to this file that is not in an EFC (it may have just been * removed from an EFC), and should have been caught by the above check */ /* If we get here then we must be beginning a new run. Make sure that the * temporary variables in f->shared->efc are at the default value */ - HDassert(f->shared->efc->tag == H5F_EFC_TAG_DEFAULT); - HDassert(f->shared->efc->tmp_next == NULL); + assert(f->shared->efc->tag == H5F_EFC_TAG_DEFAULT); + assert(f->shared->efc->tmp_next == NULL); /* Set up linked list for traversal into EFC tree. f->shared is guaranteed * to always be at the head. */ @@ -913,7 +872,7 @@ H5F__efc_try_close(H5F_t *f) sf->efc->tmp_next = NULL; sf = next; } /* end while */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Run through the linked list , separating into two lists, one with tag == @@ -922,11 +881,11 @@ H5F__efc_try_close(H5F_t *f) sf = f->shared; tail = NULL; while (sf) { - HDassert(sf->efc->tag >= 0); + assert(sf->efc->tag >= 0); next = sf->efc->tmp_next; if (sf->efc->tag > 0) { /* Remove from main list */ - HDassert(tail); + assert(tail); tail->efc->tmp_next = sf->efc->tmp_next; sf->efc->tmp_next = NULL; @@ -957,7 +916,7 @@ H5F__efc_try_close(H5F_t *f) sf = uncloseable_head; if (sf) { tail = uncloseable_tail; - HDassert(tail); + assert(tail); while (sf != tail->efc->tmp_next) { H5F__efc_try_close_tag2(sf, &uncloseable_tail); sf = sf->efc->tmp_next; @@ -969,11 +928,11 @@ H5F__efc_try_close(H5F_t *f) * Also, see the top of this function. */ if (f->shared->efc->tag == H5F_EFC_TAG_CLOSE) { if (H5F__efc_release_real(f->shared->efc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache"); /* Make sure the file's reference count is now 1 and will be closed by * H5F_dest(). */ - HDassert(f->shared->nrefs == 1); + assert(f->shared->nrefs == 1); } /* end if */ /* Clean up uncloseable files (reset tag and tmp_next). All closeable files @@ -982,7 +941,7 @@ H5F__efc_try_close(H5F_t *f) sf = uncloseable_head; while (sf) { next = sf->efc->tmp_next; - HDassert(sf->efc->tag == H5F_EFC_TAG_DONTCLOSE); + assert(sf->efc->tag == H5F_EFC_TAG_DONTCLOSE); sf->efc->tag = H5F_EFC_TAG_DEFAULT; sf->efc->tmp_next = NULL; sf = next; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ffake.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ffake.c index 1aae0fd08a..81aa762763 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ffake.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ffake.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -31,9 +30,6 @@ * Return: Success: Pointer to 'faked up' file structure * Failure: NULL * - * Programmer: Quincey Koziol - * Oct 2, 2006 - * *------------------------------------------------------------------------- */ H5F_t * @@ -46,9 +42,9 @@ H5F_fake_alloc(uint8_t sizeof_size) /* Allocate faked file struct */ if (NULL == (f = H5FL_CALLOC(H5F_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure"); if (NULL == (f->shared = H5FL_CALLOC(H5F_shared_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure") + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure"); /* Only set fields necessary for clients */ if (sizeof_size == 0) @@ -74,9 +70,6 @@ H5F_fake_alloc(uint8_t sizeof_size) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Oct 2, 2006 - * *------------------------------------------------------------------------- */ herr_t diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5File.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5File.cpp deleted file mode 100644 index eaa7162976..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5File.cpp +++ /dev/null @@ -1,795 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5FaccProp.h" -#include "H5FcreatProp.h" -#include "H5OcreatProp.h" -#include "H5DxferProp.h" -#include "H5DcreatProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5CommonFG.h" -#include "H5Group.h" -#include "H5AbstractDs.h" -#include "H5DataSpace.h" -#include "H5DataSet.h" -#include "H5File.h" -#include "H5Alltypes.h" - -namespace H5 { -using std::cerr; -using std::endl; - -//-------------------------------------------------------------------------- -// Function H5File default constructor -///\brief Default constructor: creates a stub H5File object. -// December 2000 -//-------------------------------------------------------------------------- -H5File::H5File() : Group(), id(H5I_INVALID_HID) -{ -} - -//-------------------------------------------------------------------------- -// Function: H5File overloaded constructor -///\brief Creates or opens an HDF5 file depending on the parameter flags. -///\param name - IN: Name of the file -///\param flags - IN: File access flags -///\param create_plist - IN: File creation property list, used when -/// modifying default file meta-data. Default to -/// FileCreatPropList::DEFAULT -///\param access_plist - IN: File access property list. Default to -/// FileAccPropList::DEFAULT -///\par Description -/// Valid values of \a flags include: -/// \li \c H5F_ACC_TRUNC - Truncate file, if it already exists, -/// erasing all data previously stored in -/// the file. -/// \li \c H5F_ACC_EXCL - Fail if file already exists. -/// \c H5F_ACC_TRUNC and \c H5F_ACC_EXCL are mutually exclusive -/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already -/// exists, and fail, otherwise -/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already -/// exists, and fail, otherwise -///\par -/// For info on file creation in the case of an already-open file, -/// please refer to the \b Special \b case section of the H5Fcreate -/// API in the C Reference Manual. -// Notes With a PGI compiler (~2012-2013,) the exception thrown by -// p_get_file could not be caught in the applications. Added try -// block here to catch then re-throw it. -BMR 2013/03/21 -// December 2000 -//-------------------------------------------------------------------------- -H5File::H5File(const char *name, unsigned int flags, const FileCreatPropList &create_plist, - const FileAccPropList &access_plist) - : Group(), id(H5I_INVALID_HID) -{ - try { - p_get_file(name, flags, create_plist, access_plist); - } - catch (FileIException &open_file) { - throw open_file; - } -} - -//-------------------------------------------------------------------------- -// Function: H5File overloaded constructor -///\brief This is another overloaded constructor. It differs from the -/// above constructor only in the type of the \a name argument. -///\param name - IN: Name of the file - \c H5std_string -///\param flags - IN: File access flags -///\param create_plist - IN: File creation property list, used when -/// modifying default file meta-data. Default to -/// FileCreatPropList::DEFAULT -///\param access_plist - IN: File access property list. Default to -/// FileAccPropList::DEFAULT -// Notes With a PGI compiler (~2012-2013,) the exception thrown by -// p_get_file could not be caught in the applications. Added try -// block here to catch then re-throw it. -BMR 2013/03/21 -// December 2000 -//-------------------------------------------------------------------------- -H5File::H5File(const H5std_string &name, unsigned int flags, const FileCreatPropList &create_plist, - const FileAccPropList &access_plist) - : Group(), id(H5I_INVALID_HID) -{ - try { - p_get_file(name.c_str(), flags, create_plist, access_plist); - } - catch (FileIException &open_file) { - throw open_file; - } -} - -//-------------------------------------------------------------------------- -// Function: H5File overloaded constructor -///\brief Opens an HDF5 file using a non-default access property list -///\param name - IN: Name of the file -///\param flags - IN: File access flags -///\param access_plist - IN: File access property list. -///\par Description -/// Valid values of \a flags include: -/// \li \c H5F_ACC_RDONLY - Open file as read-only, if it already -/// exists, and fail, otherwise -/// \li \c H5F_ACC_RDWR - Open file for read/write, if it already -/// exists, and fail, otherwise -// Notes With a PGI compiler (~2012-2013,) the exception thrown by -// p_get_file could not be caught in the applications. Added try -// block here to catch then re-throw it. -BMR 2013/03/21 -//-------------------------------------------------------------------------- -H5File::H5File(const char *name, unsigned int flags, const FileAccPropList &access_plist) - : Group(), id(H5I_INVALID_HID) -{ - try { - p_get_file(name, flags, FileCreatPropList::DEFAULT, access_plist); - } - catch (FileIException &open_file) { - throw open_file; - } -} - -//-------------------------------------------------------------------------- -// Function: H5File overloaded constructor -///\brief This is another overloaded constructor. It differs from the -/// above constructor only in the type of the \a name argument. -///\param name - IN: Name of the file - \c H5std_string -///\param flags - IN: File access flags -///\param access_plist - IN: File access property list -//-------------------------------------------------------------------------- -H5File::H5File(const H5std_string &name, unsigned int flags, const FileAccPropList &access_plist) - : Group(), id(H5I_INVALID_HID) -{ - try { - p_get_file(name.c_str(), flags, FileCreatPropList::DEFAULT, access_plist); - } - catch (FileIException &open_file) { - throw open_file; - } -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// This function is private and contains common code between the -// constructors taking a string or a char* -// Modification -// - removed H5F_ACC_CREAT because H5Fcreate will fail with -// H5F_ACC_CREAT. - BMR, Sep 17, 2014 -//-------------------------------------------------------------------------- -void -H5File::p_get_file(const char *name, unsigned int flags, const FileCreatPropList &create_plist, - const FileAccPropList &access_plist) -{ - // These bits only set for creation, so if any of them are set, - // create the file. - if (flags & (H5F_ACC_EXCL | H5F_ACC_TRUNC)) { - hid_t create_plist_id = create_plist.getId(); - hid_t access_plist_id = access_plist.getId(); - id = H5Fcreate(name, flags, create_plist_id, access_plist_id); - if (id < 0) // throw an exception when open/create fail - { - throw FileIException("H5File constructor", "H5Fcreate failed"); - } - } - // Open the file if none of the bits above are set. - else { - hid_t access_plist_id = access_plist.getId(); - id = H5Fopen(name, flags, access_plist_id); - if (id < 0) // throw an exception when open/create fail - { - throw FileIException("H5File constructor", "H5Fopen failed"); - } - } -} - -//-------------------------------------------------------------------------- -// Function: H5File overloaded constructor -///\brief Creates an H5File object using an existing file id. -///\param existing_id - IN: Id of an existing file -// Description -// Mar 29, 2015 -// Added in responding to a request from user Jason Newton. -// However, it is not recommended to use the private member "id" -// in applications. Unlike other situations, where similar -// constructor is needed by the library in order to return -// an object, H5File doesn't need it. -BMR (HDFFV-8766 partially) -//-------------------------------------------------------------------------- -H5File::H5File(hid_t existing_id) : Group(), id{existing_id} -{ - incRefCount(); // increment number of references to this id -} - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: H5File copy constructor -///\brief Copy constructor: same HDF5 object as \a original -/// H5File object. -///\param original - IN: H5File instance to copy -// December 2000 -//-------------------------------------------------------------------------- -H5File::H5File(const H5File &original) : Group(original), id{original.getId()} -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: H5File::isHdf5 (static) -///\brief Determines whether a file in HDF5 format. (Static) -///\param name - IN: Name of the file -///\return true if the file is in HDF5 format, and false, otherwise -///\exception H5::FileIException -// December 2000 -//-------------------------------------------------------------------------- -bool -H5File::isHdf5(const char *name) -{ - // Calls C routine H5Fis_accessible to determine whether the file is in - // HDF5 format. It returns positive value, 0, or negative value - htri_t ret_value = H5Fis_accessible(name, H5P_DEFAULT); - - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else // Raise exception when H5Fis_accessible returns a negative value - { - throw FileIException("H5File::isHdf5", "H5Fis_accessible returned negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::isHdf5 (static) -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c H5std_string for \a name. (Static) -///\param name - IN: Name of the file - \c H5std_string -// December 2000 -//-------------------------------------------------------------------------- -bool -H5File::isHdf5(const H5std_string &name) -{ - return (isHdf5(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: H5File::isAccessible (static) -///\brief Determines whether a file can be accessed as HDF5. (Static) -///\param name - IN: Name of the file -///\param access_plist - IN: File access property list. Default to -/// FileAccPropList::DEFAULT -///\return true if the file can be accessed as HDF5, and false, otherwise -///\exception H5::FileIException -// September 2018 -//-------------------------------------------------------------------------- -bool -H5File::isAccessible(const char *name, const FileAccPropList &access_plist) -{ - // Calls C routine H5Fis_accessible to determine whether the file is in - // HDF5 format. It returns positive value, 0, or negative value - hid_t access_plist_id = access_plist.getId(); - htri_t ret_value = H5Fis_accessible(name, access_plist_id); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else // Raise exception when H5Fis_accessible returns a negative value - { - throw FileIException("H5File::isAccessible", "H5Fis_accessible returned negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::isAccessible (static) -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c H5std_string for \a name. (Static) -///\param name - IN: Name of the file - \c H5std_string -///\param access_plist - IN: File access property list. Default to -/// FileAccPropList::DEFAULT -// September 2018 -//-------------------------------------------------------------------------- -bool -H5File::isAccessible(const H5std_string &name, const FileAccPropList &access_plist) -{ - return (isAccessible(name.c_str(), access_plist)); -} - -//-------------------------------------------------------------------------- -// Function: openFile -///\brief Opens an HDF5 file -///\param name - IN: Name of the file -///\param flags - IN: File access flags -///\param access_plist - IN: File access property list. Default to -/// FileAccPropList::DEFAULT -///\par Description -/// Valid values of \a flags include: -/// H5F_ACC_RDWR: Open with read/write access. If the file is -/// currently open for read-only access then it -/// will be reopened. Absence of this flag -/// implies read-only access. -/// -/// H5F_ACC_RDONLY: Open with read only access. - default -/// -// October 2005 -//-------------------------------------------------------------------------- -void -H5File::openFile(const char *name, unsigned int flags, const FileAccPropList &access_plist) -{ - try { - close(); - } - catch (Exception &close_error) { - throw FileIException("H5File::openFile", close_error.getDetailMsg()); - } - - hid_t access_plist_id = access_plist.getId(); - id = H5Fopen(name, flags, access_plist_id); - if (id < 0) // throw an exception when open fails - { - throw FileIException("H5File::openFile", "H5Fopen failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::openFile -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c H5std_string for \a name. -///\param name - IN: Name of the file - \c H5std_string -///\param flags - IN: File access flags -///\param access_plist - IN: File access property list. Default to -/// FileAccPropList::DEFAULT -// December 2000 -//-------------------------------------------------------------------------- -void -H5File::openFile(const H5std_string &name, unsigned int flags, const FileAccPropList &access_plist) -{ - openFile(name.c_str(), flags, access_plist); -} - -//-------------------------------------------------------------------------- -// Function: H5File::reOpen -///\brief Reopens this file. -/// -///\exception H5::FileIException -// Description -// If this object has represented another HDF5 file, the previous -// HDF5 file need to be closed first. -// Note: This wrapper doesn't seem right regarding the 'id' and should -// be investigated. BMR - 2/20/2005 -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Feb 20, 2005 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -void -H5File::reOpen() -{ - try { - close(); - } - catch (Exception &close_error) { - throw FileIException("H5File::reOpen", close_error.getDetailMsg()); - } - - // call C routine to reopen the file - Note: not sure about this, - // which id to be the parameter when closing? - id = H5Freopen(id); - if (id < 0) // Raise exception when H5Freopen returns a neg value - throw FileIException("H5File::reOpen", "H5Freopen failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5File::getCreatePlist -///\brief Returns a copy of the creation property list of this file -///\return FileCreatPropList object -///\exception H5::FileIException -// December 2000 -//-------------------------------------------------------------------------- -FileCreatPropList -H5File::getCreatePlist() const -{ - hid_t create_plist_id = H5Fget_create_plist(id); - - // if H5Fget_create_plist returns a valid id, create and return - // the FileCreatPropList object for this property list - if (create_plist_id > 0) { - FileCreatPropList create_plist(create_plist_id); - return (create_plist); - } - else { - throw FileIException("H5File::getCreatePlist", "H5Fget_create_plist failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::getAccessPlist -///\brief Returns a copy of the access property list of this file -///\return FileAccPropList object -///\exception H5::FileIException -// December 2000 -//-------------------------------------------------------------------------- -FileAccPropList -H5File::getAccessPlist() const -{ - hid_t access_plist_id = H5Fget_access_plist(id); - - // if H5Fget_access_plist returns a valid id, create and return - // the FileAccPropList object for this property list - if (access_plist_id > 0) { - FileAccPropList access_plist(access_plist_id); - return access_plist; - } - else // Raise an exception - { - throw FileIException("H5File::getAccessPlist", "H5Fget_access_plist failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::getFileInfo -///\brief Retrieves the general information of this file. -/// -///\exception H5::FileIException -///\par Description -/// The retrieved information may include information about -/// superblock extension, free space management, and shared object -// February 2017 -//-------------------------------------------------------------------------- -void -H5File::getFileInfo(H5F_info2_t &file_info) const -{ - herr_t ret_value = H5Fget_info2(id, &file_info); - if (ret_value < 0) { - throw FileIException("H5File::getFileInfo", "H5Fget_info2 failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::getFreeSpace -///\brief Returns the amount of free space in the file. -///\return Amount of free space -///\exception H5::FileIException -// May 2004 -//-------------------------------------------------------------------------- -hssize_t -H5File::getFreeSpace() const -{ - hssize_t free_space = H5Fget_freespace(id); - if (free_space < 0) { - throw FileIException("H5File::getFreeSpace", "H5Fget_freespace failed"); - } - return (free_space); -} - -//-------------------------------------------------------------------------- -// Function: H5File::getObjCount -///\brief Returns the number of opened object IDs (files, datasets, -/// groups and datatypes) in the same file. -///\param types - Type of object to retrieve the count -///\return Number of opened object IDs -///\exception H5::FileIException -///\par Description -/// The valid values for \a types include: -/// \li \c H5F_OBJ_FILE - Files only -/// \li \c H5F_OBJ_DATASET - Datasets only -/// \li \c H5F_OBJ_GROUP - Groups only -/// \li \c H5F_OBJ_DATATYPE - Named datatypes only -/// \li \c H5F_OBJ_ATTR - Attributes only -/// \li \c H5F_OBJ_ALL - All of the above, i.e., \c H5F_OBJ_FILE -/// | \c H5F_OBJ_DATASET | \c H5F_OBJ_GROUP -/// | \c H5F_OBJ_DATATYPE | \c H5F_OBJ_ATTR -///\par -/// Multiple object types can be combined with the logical OR operator (|). -// May 2004 -//-------------------------------------------------------------------------- -ssize_t -H5File::getObjCount(unsigned types) const -{ - ssize_t num_objs = H5Fget_obj_count(id, types); - if (num_objs < 0) { - throw FileIException("H5File::getObjCount", "H5Fget_obj_count failed"); - } - return (num_objs); -} - -//-------------------------------------------------------------------------- -// Function: H5File::getObjIDs -///\brief Retrieves a list of opened object IDs (files, datasets, -/// groups and datatypes) in the same file. -///\param types - Type of object to retrieve the count -///\param max_objs - Maximum number of object identifiers to place -/// into obj_id_list. -///\param oid_list - List of open object identifiers -///\exception H5::FileIException -///\par Description -/// The valid values for \a types include: -/// \li \c H5F_OBJ_FILE - Files only -/// \li \c H5F_OBJ_DATASET - Datasets only -/// \li \c H5F_OBJ_GROUP - Groups only -/// \li \c H5F_OBJ_DATATYPE - Named datatypes only -/// \li \c H5F_OBJ_ATTR - Attributes only -/// \li \c H5F_OBJ_ALL - All of the above, i.e., \c H5F_OBJ_FILE -/// | \c H5F_OBJ_DATASET | \c H5F_OBJ_GROUP -/// | \c H5F_OBJ_DATATYPE | \c H5F_OBJ_ATTR -///\par -/// Multiple object types can be combined with the logical OR operator (|). -// -// Notes: will do the overload for this one after hearing from Quincey??? -// May 2004 -//-------------------------------------------------------------------------- -void -H5File::getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const -{ - ssize_t ret_value = H5Fget_obj_ids(id, types, max_objs, oid_list); - if (ret_value < 0) { - throw FileIException("H5File::getObjIDs", "H5Fget_obj_ids failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::getVFDHandle -///\brief Returns the pointer to the file handle of the low-level file -/// driver. -///\param fapl - File access property list -///\param file_handle - Pointer to the file handle being used by -/// the low-level virtual file driver -///\exception H5::FileIException -///\par Description -/// For the \c FAMILY or \c MULTI drivers, \a fapl should be -/// defined through the property list functions: -/// \c FileAccPropList::setFamilyOffset for the \c FAMILY driver -/// and \c FileAccPropList::setMultiType for the \c MULTI driver. -/// -/// The obtained file handle is dynamic and is valid only while -/// the file remains open; it will be invalid if the file is -/// closed and reopened or opened during a subsequent session. -// May 2004 -//-------------------------------------------------------------------------- -void -H5File::getVFDHandle(const FileAccPropList &fapl, void **file_handle) const -{ - hid_t fapl_id = fapl.getId(); - herr_t ret_value = H5Fget_vfd_handle(id, fapl_id, file_handle); - if (ret_value < 0) { - throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::getVFDHandle -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Param fapl - File access property list -// Param file_handle - Pointer to the file handle being used by -// the low-level virtual file driver -// Exception H5::FileIException -// May 2004 -// Modification -// Planned for removal. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 -//-------------------------------------------------------------------------- -// void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const -//{ -// getVFDHandle((const FileAccPropList)fapl, file_handle); -//} - -//-------------------------------------------------------------------------- -// Function: H5File::getVFDHandle -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param file_handle - Pointer to the file handle being used by -/// the low-level virtual file driver -///\exception H5::FileIException -// May 2004 -//-------------------------------------------------------------------------- -void -H5File::getVFDHandle(void **file_handle) const -{ - herr_t ret_value = H5Fget_vfd_handle(id, H5P_DEFAULT, file_handle); - if (ret_value < 0) { - throw FileIException("H5File::getVFDHandle", "H5Fget_vfd_handle failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::getFileSize -///\brief Returns the file size of the HDF5 file. -///\return File size -///\exception H5::FileIException -///\par Description -/// This function is called after an existing file is opened in -/// order to learn the true size of the underlying file. -// Programmer Raymond Lu - June 24, 2004 -//-------------------------------------------------------------------------- -hsize_t -H5File::getFileSize() const -{ - hsize_t file_size; - herr_t ret_value = H5Fget_filesize(id, &file_size); - if (ret_value < 0) { - throw FileIException("H5File::getFileSize", "H5Fget_filesize failed"); - } - return (file_size); -} - -//-------------------------------------------------------------------------- -// Function: H5File::getFileNum -///\brief Returns the file number of the HDF5 file. -///\return File number -///\exception H5::FileIException -///\par Description -/// This function is called after an existing file is opened in -/// order to retrieve the unique 'file number' for the file. -// Programmer Quincey Koziol - April 13, 2019 -//-------------------------------------------------------------------------- -unsigned long -H5File::getFileNum() const -{ - unsigned long fileno = 0; - herr_t ret_value = H5Fget_fileno(id, &fileno); - if (ret_value < 0) { - throw FileIException("H5File::getFileNum", "H5Fget_fileno failed"); - } - return (fileno); -} - -//-------------------------------------------------------------------------- -// Function: H5File::getId -///\brief Get the id of this file -///\return File identifier -// Modification -// May 2008 - BMR -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. -// May, 2008 -//-------------------------------------------------------------------------- -hid_t -H5File::getId() const -{ - return (id); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: H5File::reopen -// Purpose Reopens this file. -// Exception H5::FileIException -// Description -// This function is replaced by the above function reOpen. -// December 2000 -//-------------------------------------------------------------------------- -void -H5File::reopen() -{ - H5File::reOpen(); -} - -//-------------------------------------------------------------------------- -// Function: H5File::getLocId -// Purpose Get the id of this file -// Description -// This function is a redefinition of CommonFG::getLocId. It -// is used by CommonFG member functions to get the file id. -// December 2000 -// Deprecated: -// Aug 18, 2016 -BMR -// After HDFFV-9920, the Group's methods can use getId() and -// getLocId() is kept for backward compatibility. -//-------------------------------------------------------------------------- -hid_t -H5File::getLocId() const -{ - return (getId()); -} - -//-------------------------------------------------------------------------- -// Function: H5File::p_setId (protected) -///\brief Sets the identifier of this object to a new value. -/// -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails -// Description -// The underlying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. -// December 2000 -//-------------------------------------------------------------------------- -void -H5File::p_setId(const hid_t new_id) -{ - // handling references to this old id - try { - close(); - } - catch (Exception &E) { - throw FileIException("H5File::p_setId", E.getDetailMsg()); - } - // reset object's id to the given id - id = new_id; -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: H5File::close -///\brief Closes this HDF5 file. -/// -///\exception H5::FileIException -// March 2005 -//-------------------------------------------------------------------------- -void -H5File::close() -{ - if (p_valid_id(id)) { - herr_t ret_value = H5Fclose(id); - if (ret_value < 0) { - throw FileIException("H5File::close", "H5Fclose failed"); - } - // reset the id - id = H5I_INVALID_HID; - } -} - -//-------------------------------------------------------------------------- -// Function: H5File::throwException -///\brief Throws file exception - initially implemented for CommonFG -///\param func_name - Name of the function where failure occurs -///\param msg - Message describing the failure -///\exception H5::FileIException -// Description -// This function is also used in H5Location implementation so that -// proper exception can be thrown for file or group. The -// "H5File::" will be inserted to indicate the function called is -// an implementation of H5File. -// December 2000 -//-------------------------------------------------------------------------- -void -H5File::throwException(const H5std_string &func_name, const H5std_string &msg) const -{ - H5std_string full_name = func_name; - full_name.insert(0, "H5File::"); - throw FileIException(full_name, msg); -} - -//-------------------------------------------------------------------------- -// Function: H5File destructor -///\brief Properly terminates access to this file. -// December 2000 -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Feb 20, 2005 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -H5File::~H5File() -{ - try { - close(); - } - catch (Exception &close_error) { - cerr << "H5File::~H5File - " << close_error.getDetailMsg() << endl; - } -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fint.c index 992995778c..1b5b75b760 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -138,11 +137,11 @@ H5F_init(void) /* Initialize the ID group for the file IDs */ if (H5I_register_type(H5I_FILE_CLS) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to initialize interface"); /* Check the file locking environment variable */ if (H5F__parse_file_lock_env_var(&use_locks_env_g) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -210,16 +209,16 @@ H5F__close_cb(H5VL_object_t *file_vol_obj, void **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(file_vol_obj); + assert(file_vol_obj); /* Close the file */ if (H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); /* Free the VOL object; it is unnecessary to unwrap the VOL * object before freeing it, as the object was not wrapped */ if (H5VL_free_object(file_vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -276,32 +275,32 @@ H5F__set_vol_conn(H5F_t *file) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(file); + assert(file); /* Retrieve a copy of the "top-level" connector property, before any pass-through * connectors modified or unwrapped it. */ if (H5CX_get_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info from API context") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL connector info from API context"); /* Sanity check */ - HDassert(0 != connector_prop.connector_id); + assert(0 != connector_prop.connector_id); /* Retrieve the connector for the ID */ if (NULL == (file->shared->vol_cls = (H5VL_class_t *)H5I_object(connector_prop.connector_id))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Allocate and copy connector info, if it exists */ if (connector_prop.connector_info) if (H5VL_copy_connector_info(file->shared->vol_cls, &new_connector_info, connector_prop.connector_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed"); /* Cache the connector ID & info for the container */ file->shared->vol_id = connector_prop.connector_id; file->shared->vol_info = new_connector_info; if (H5I_inc_ref(file->shared->vol_id, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, FAIL, "incrementing VOL connector ID failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -337,89 +336,91 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check args */ - HDassert(f); + assert(f); /* Make a copy of the default file access property list */ if (NULL == (old_plist = (H5P_genplist_t *)H5I_object(H5P_LST_FILE_ACCESS_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); if ((ret_value = H5P_copy_plist(old_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "can't copy file access property list"); if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(ret_value))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); /* Copy properties of the file access property list */ if (H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, + "can't set initial metadata cache resize config."); if (H5P_set(new_plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(f->shared->rdcc_nslots)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache number of slots"); if (H5P_set(new_plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set data cache byte size"); if (H5P_set(new_plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set preempt read chunks"); if (H5P_set(new_plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment threshold"); if (H5P_set(new_plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set alignment"); if (H5P_set(new_plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set garbage collect reference"); if (H5P_set(new_plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set metadata cache size"); if (H5P_set(new_plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't sieve buffer size"); if (H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'small data' cache size"); if (H5P_set(new_plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &f->shared->low_bound) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, - "can't set 'low' bound for library format versions") + "can't set 'low' bound for library format versions"); if (H5P_set(new_plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &f->shared->high_bound) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, - "can't set 'high' bound for library format versions") + "can't set 'high' bound for library format versions"); if (H5P_set(new_plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &(f->shared->read_attempts)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set 'read attempts ' flag"); if (H5P_set(new_plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set object flush callback"); if (f->shared->efc) efc_size = H5F__efc_max_nfiles(f->shared->efc); if (H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set elink file cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set elink file cache size"); if (f->shared->page_buf != NULL) { if (H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &(f->shared->page_buf->max_size)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set page buffer size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set page buffer size"); if (H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &(f->shared->page_buf->min_meta_perc)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, - "can't set minimum metadata fraction of page buffer") + "can't set minimum metadata fraction of page buffer"); if (H5P_set(new_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &(f->shared->page_buf->min_raw_perc)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, - "can't set minimum raw data fraction of page buffer") + "can't set minimum raw data fraction of page buffer"); } /* end if */ #ifdef H5_HAVE_PARALLEL if (H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->shared->coll_md_read)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read flag"); if (H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->shared->coll_md_write)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read flag"); if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { MPI_Comm mpi_comm; MPI_Info mpi_info; /* Retrieve and set MPI communicator */ if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(f))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get MPI communicator") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get MPI communicator"); if (H5P_set(new_plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &mpi_comm) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set MPI communicator") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set MPI communicator"); /* Retrieve and set MPI info object */ if (H5P_get(old_plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &mpi_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get MPI info object") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get MPI info object"); if (H5P_set(new_plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &mpi_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set MPI info object") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set MPI info object"); } #endif /* H5_HAVE_PARALLEL */ if (H5P_set(new_plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set initial metadata cache resize config.") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, + "can't set initial metadata cache resize config."); /* Prepare the driver property */ driver_prop.driver_id = f->shared->lf->driver_id; @@ -429,26 +430,26 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) /* Set the driver property */ if (H5P_set(new_plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file driver ID & info"); /* Set the VOL connector property */ connector_prop.connector_id = f->shared->vol_id; connector_prop.connector_info = f->shared->vol_info; if (H5P_set(new_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector ID & info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector ID & info"); /* Set the file close degree appropriately */ if (f->shared->fc_degree == H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->lf->cls->fc_degree)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree"); else if (f->shared->fc_degree != H5F_CLOSE_DEFAULT && H5P_set(new_plist, H5F_ACS_CLOSE_DEGREE_NAME, &(f->shared->fc_degree)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree"); done: /* Release the copy of the driver info, if it was set up */ if (driver_prop_copied && H5FD_free_driver_info(driver_prop.driver_id, driver_prop.driver_info) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close copy of driver info") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close copy of driver info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_access_plist() */ @@ -470,11 +471,11 @@ H5F_get_obj_count(const H5F_t *f, unsigned types, hbool_t app_ref, size_t *obj_i FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(obj_id_count_ptr); + assert(obj_id_count_ptr); /* Perform the query */ if ((ret_value = H5F__get_objects(f, types, 0, NULL, app_ref, obj_id_count_ptr)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -497,11 +498,11 @@ H5F_get_obj_ids(const H5F_t *f, unsigned types, size_t max_objs, hid_t *oid_list FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(obj_id_count_ptr); + assert(obj_id_count_ptr); /* Perform the query */ if ((ret_value = H5F__get_objects(f, types, max_objs, oid_list, app_ref, obj_id_count_ptr)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F__get_objects failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -528,7 +529,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(obj_id_count_ptr); + assert(obj_id_count_ptr); /* Set up search information */ olist.obj_id_list = (max_nobjs == 0 ? NULL : obj_id_list); @@ -551,7 +552,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id if (types & H5F_OBJ_FILE) { olist.obj_type = H5I_FILE; if (H5I_iterate(H5I_FILE, H5F__get_objects_cb, &olist, app_ref) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(1)"); } /* end if */ /* If the caller just wants to count the number of objects (OLIST.MAX_NOBJS is zero), @@ -562,7 +563,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id if (types & H5F_OBJ_DATASET) { olist.obj_type = H5I_DATASET; if (H5I_iterate(H5I_DATASET, H5F__get_objects_cb, &olist, app_ref) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(2)"); } /* end if */ } @@ -574,7 +575,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id if (types & H5F_OBJ_GROUP) { olist.obj_type = H5I_GROUP; if (H5I_iterate(H5I_GROUP, H5F__get_objects_cb, &olist, app_ref) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(3)"); } } @@ -586,7 +587,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id if (types & H5F_OBJ_DATATYPE) { olist.obj_type = H5I_DATATYPE; if (H5I_iterate(H5I_DATATYPE, H5F__get_objects_cb, &olist, app_ref) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(4)"); } /* end if */ } @@ -598,7 +599,7 @@ H5F__get_objects(const H5F_t *f, unsigned types, size_t max_nobjs, hid_t *obj_id if (types & H5F_OBJ_ATTR) { olist.obj_type = H5I_ATTR; if (H5I_iterate(H5I_ATTR, H5F__get_objects_cb, &olist, app_ref) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed(5)"); } /* end if */ } @@ -629,8 +630,8 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) FUNC_ENTER_PACKAGE - HDassert(obj_ptr); - HDassert(olist); + assert(obj_ptr); + assert(olist); /* Count file IDs */ if (olist->obj_type == H5I_FILE) { @@ -668,7 +669,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_MAP: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, - "maps not supported in native VOL connector") + "maps not supported in native VOL connector"); case H5I_UNINIT: case H5I_BADID: @@ -685,7 +686,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_EVENTSET: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown or invalid data object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown or invalid data object"); } /* end switch */ if ((olist->file_info.local && ((!olist->file_info.ptr.file && olist->obj_type == H5I_DATATYPE && @@ -718,8 +719,8 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) * H5_ITER_CONT to continue the iteration. */ if (olist->max_nobjs > 0 && olist->list_index >= olist->max_nobjs) - HGOTO_DONE(H5_ITER_STOP) /* Indicate that the iterator should stop */ - } /* end if */ + HGOTO_DONE(H5_ITER_STOP); /* Indicate that the iterator should stop */ + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -747,7 +748,7 @@ H5F__build_name(const char *prefix, const char *file_name, char **full_name /*ou /* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */ if (NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2 + 2))) /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate filename buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate filename buffer"); /* Compose the full file name */ HDsnprintf(*full_name, (prefix_len + fname_len + 2 + 2), "%s%s%s", @@ -807,27 +808,33 @@ H5F_t * H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const char *prop_prefix, const char *file_name, unsigned file_intent, hid_t fapl_id) { - H5F_t *src_file = NULL; /* Source file */ - char *full_name = NULL; /* File name with prefix */ - char *actual_file_name = NULL; /* File's actual name */ - char *temp_file_name = NULL; /* Temporary pointer to file name */ - size_t temp_file_name_len; /* Length of temporary file name */ - H5F_t *ret_value = NULL; /* Return value */ + H5F_t *src_file = NULL; /* Source file */ + H5F_efc_t *efc = NULL; /* External file cache */ + char *full_name = NULL; /* File name with prefix */ + char *actual_file_name = NULL; /* File's actual name */ + char *temp_file_name = NULL; /* Temporary pointer to file name */ + size_t temp_file_name_len; /* Length of temporary file name */ + H5F_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT + assert(primary_file); + assert(primary_file->shared); + + efc = primary_file->shared->efc; + /* Simplify intent flags for open calls */ file_intent &= (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ); /* Copy the file name to use */ if (NULL == (temp_file_name = H5MM_strdup(file_name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); temp_file_name_len = HDstrlen(temp_file_name); /* Target file_name is an absolute pathname: see RM for detailed description */ if (H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { /* Try opening file */ - src_file = H5F__efc_open(primary_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(efc, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); /* Adjust temporary file name if file not opened */ if (NULL == src_file) { @@ -838,7 +845,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Get last component of file_name */ H5_GET_LAST_DELIMITER(file_name, ptr) - HDassert(ptr); + assert(ptr); /* Increment past delimiter */ ptr++; @@ -850,7 +857,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c } /* end if */ else if (H5_CHECK_ABS_DRIVE(file_name)) { /* Try opening file */ - src_file = H5F__efc_open(primary_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(efc, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); /* Adjust temporary file name if file not opened */ if (NULL == src_file) { @@ -873,7 +880,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c else if (H5F_PREFIX_ELINK == prefix_type) env_prefix = HDgetenv("HDF5_EXT_PREFIX"); else - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "prefix type is not sensible") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "prefix type is not sensible"); /* If environment variable is defined, iterate through prefixes it defines */ if (NULL != env_prefix) { @@ -881,7 +888,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Make a copy of the environment variable string */ if (NULL == (saved_env = tmp_env_prefix = H5MM_strdup(env_prefix))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Loop over prefixes in environment variable */ while ((tmp_env_prefix) && (*tmp_env_prefix)) { @@ -891,12 +898,11 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c if (out_prefix_name && (*out_prefix_name)) { if (H5F__build_name(out_prefix_name, temp_file_name, &full_name /*out*/) < 0) { saved_env = (char *)H5MM_xfree(saved_env); - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename"); } /* end if */ /* Try opening file */ - src_file = - H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); /* Release copy of file name */ full_name = (char *)H5MM_xfree(full_name); @@ -920,10 +926,10 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c if (src_file == NULL && prop_prefix) { /* Construct name to open */ if (H5F__build_name(prop_prefix, temp_file_name, &full_name /*out*/) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename"); /* Try opening file */ - src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); /* Release name */ full_name = (char *)H5MM_xfree(full_name); @@ -941,10 +947,10 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c if (NULL != (dspath = H5F_EXTPATH(primary_file))) { /* Construct name to open */ if (H5F__build_name(dspath, temp_file_name, &full_name /*out*/) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename"); /* Try opening file */ - src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); /* Release name */ full_name = (char *)H5MM_xfree(full_name); @@ -959,7 +965,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Try the relative file_name stored in temp_file_name */ if (src_file == NULL) { /* Try opening file */ - src_file = H5F__efc_open(primary_file, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(efc, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); /* Check for file not opened */ if (NULL == src_file) @@ -973,7 +979,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Copy resolved file name */ if (NULL == (actual_file_name = H5MM_strdup(H5F_ACTUAL_NAME(primary_file)))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "can't duplicate resolved file name string") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "can't duplicate resolved file name string"); /* get last component of file_name */ H5_GET_LAST_DELIMITER(actual_file_name, ptr) @@ -983,11 +989,11 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Build new file name for the external file */ if (H5F__build_name((ptr ? actual_file_name : ""), temp_file_name, &full_name /*out*/) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename"); actual_file_name = (char *)H5MM_xfree(actual_file_name); /* Try opening with the resolved name */ - src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(efc, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); /* Release name */ full_name = (char *)H5MM_xfree(full_name); @@ -1004,7 +1010,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c done: if ((NULL == ret_value) && src_file) if (H5F_efc_close(primary_file, src_file) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close source file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close source file"); if (full_name) full_name = (char *)H5MM_xfree(full_name); if (temp_file_name) @@ -1038,7 +1044,7 @@ H5F__is_hdf5(const char *name, hid_t fapl_id) * should work with arbitrary VFDs, unlike H5Fis_hdf5(). */ if (NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, fapl_id, HADDR_UNDEF))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to open file"); /* If the file is already open, it's an HDF5 file * @@ -1051,7 +1057,7 @@ H5F__is_hdf5(const char *name, hid_t fapl_id) else { /* The file is an HDF5 file if the HDF5 file signature can be found */ if (H5FD_locate_signature(file, &sig_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature") + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "error while trying to locate file signature"); ret_value = (HADDR_UNDEF != sig_addr); } @@ -1059,7 +1065,7 @@ H5F__is_hdf5(const char *name, hid_t fapl_id) /* Close the file */ if (file) if (H5FD_close(file) < 0 && TRUE == ret_value) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__is_hdf5() */ @@ -1089,11 +1095,11 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F FUNC_ENTER_PACKAGE if (NULL == (f = H5FL_CALLOC(H5F_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure"); f->id_exists = FALSE; if (shared) { - HDassert(lf == NULL); + assert(lf == NULL); f->shared = shared; } else { @@ -1101,9 +1107,9 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F unsigned efc_size; /* External file cache size */ size_t u; /* Local index variable */ - HDassert(lf != NULL); + assert(lf != NULL); if (NULL == (f->shared = H5FL_CALLOC(H5F_shared_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure") + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared file structure"); f->shared->flags = flags; f->shared->sohm_addr = HADDR_UNDEF; @@ -1133,98 +1139,99 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F * to change as the file is being opened. */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not property list"); f->shared->fcpl_id = H5P_copy_plist(plist, FALSE); /* Get the FCPL values to cache */ if (H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &f->shared->sizeof_addr) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for address") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for address"); if (H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &f->shared->sizeof_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for object size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get byte number for object size"); if (H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &f->shared->sohm_nindexes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get number of SOHM indexes") - HDassert(f->shared->sohm_nindexes < 255); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get number of SOHM indexes"); + assert(f->shared->sohm_nindexes < 255); if (H5P_get(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &f->shared->fs_strategy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space strategy") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space strategy"); if (H5P_get(plist, H5F_CRT_FREE_SPACE_PERSIST_NAME, &f->shared->fs_persist) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space persisting status") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space persisting status"); if (H5P_get(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &f->shared->fs_threshold) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get free-space section threshold") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get free-space section threshold"); if (H5P_get(plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, &f->shared->fs_page_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space page size") - HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file space page size"); + assert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); /* Temporary for multi/split drivers: fail file creation * when persisting free-space or using paged aggregation strategy. */ if (H5F_HAS_FEATURE(f, H5FD_FEAT_PAGED_AGGR)) if (f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE || f->shared->fs_persist) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't open with this strategy or persistent fs") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't open with this strategy or persistent fs"); /* Get the FAPL values to cache */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list"); if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, &(f->shared->mdc_initCacheCfg)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial metadata cache resize config") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial metadata cache resize config"); if (H5P_get(plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &(f->shared->rdcc_nslots)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get data cache number of slots") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get data cache number of slots"); if (H5P_get(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &(f->shared->rdcc_nbytes)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get data cache byte size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get data cache byte size"); if (H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &(f->shared->rdcc_w0)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get preempt read chunk") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get preempt read chunk"); if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, &(f->shared->threshold)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment threshold"); if (H5P_get(plist, H5F_ACS_ALIGN_NAME, &(f->shared->alignment)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get alignment"); if (H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME, &(f->shared->gc_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get garbage collect reference") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get garbage collect reference"); if (H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size"); if (H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &(f->shared->low_bound)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'low' bound for library format versions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'low' bound for library format versions"); if (H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &(f->shared->high_bound)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'high' bound for library format versions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'high' bound for library format versions"); if (H5P_get(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &(f->shared->use_mdc_logging)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'use mdc logging' flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'use mdc logging' flag"); if (H5P_get(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &(f->shared->start_mdc_log_on_access)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'start mdc log on access' flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'start mdc log on access' flag"); if (H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get metadata cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get metadata cache size"); f->shared->meta_aggr.feature_flag = H5FD_FEAT_AGGREGATE_METADATA; if (H5P_get(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'small data' cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'small data' cache size"); f->shared->sdata_aggr.feature_flag = H5FD_FEAT_AGGREGATE_SMALLDATA; if (H5P_get(plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get elink file cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get elink file cache size"); if (efc_size > 0) if (NULL == (f->shared->efc = H5F__efc_create(efc_size))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't create external file cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't create external file cache"); #ifdef H5_HAVE_PARALLEL if (H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->shared->coll_md_read)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata read flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata read flag"); if (H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->shared->coll_md_write)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata write flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata write flag"); #endif /* H5_HAVE_PARALLEL */ if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, &(f->shared->mdc_initCacheImageCfg)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial metadata cache resize config") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get initial metadata cache resize config"); /* Get the VFD values to cache */ f->shared->maxaddr = H5FD_get_maxaddr(lf); - if (!H5F_addr_defined(f->shared->maxaddr)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad maximum address from VFD") + if (!H5_addr_defined(f->shared->maxaddr)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad maximum address from VFD"); if (H5FD_get_feature_flags(lf, &f->shared->feature_flags) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get feature flags from VFD") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get feature flags from VFD"); /* Require the SWMR feature flag if SWMR I/O is desired */ if (!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO) && (H5F_INTENT(f) & (H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ))) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "must use a SWMR-compatible VFD when SWMR is specified") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, + "must use a SWMR-compatible VFD when SWMR is specified"); if (H5FD_get_fs_type_map(lf, f->shared->fs_type_map) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get free space type mapping from VFD") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get free space type mapping from VFD"); if (H5MF_init_merge_flags(f->shared) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "problem initializing free space merge flags") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "problem initializing free space merge flags"); f->shared->tmp_addr = f->shared->maxaddr; /* Disable temp. space allocation for parallel I/O (for now) */ /* (When we've arranged to have the relocated metadata addresses (and @@ -1240,7 +1247,7 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F /* Retrieve the # of read attempts here so that sohm in superblock will get the correct # of attempts */ if (H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &f->shared->read_attempts) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get the # of read attempts") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get the # of read attempts"); /* When opening file with SWMR access, the # of read attempts is H5F_SWMR_METADATA_READ_ATTEMPTS if * not set */ @@ -1254,7 +1261,7 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F /* Turn off accumulator with SWMR */ f->shared->feature_flags &= ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA; if (H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set feature_flags in VFD"); } else { /* If no value for read attempts has been set, use the default */ @@ -1264,19 +1271,19 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F /* Determine the # of bins for metadata read retries */ if (H5F_set_retries(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't set retries and retries_nbins") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't set retries and retries_nbins"); /* Get the metadata cache log location (if we're logging) */ { char *mdc_log_location = NULL; /* location of metadata cache log location */ if (H5P_get(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &mdc_log_location) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get mdc log location") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get mdc log location"); if (mdc_log_location != NULL) { size_t len = HDstrlen(mdc_log_location); if (NULL == (f->shared->mdc_log_location = (char *)H5MM_calloc((len + 1) * sizeof(char)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, - "can't allocate memory for mdc log file name") + "can't allocate memory for mdc log file name"); HDstrncpy(f->shared->mdc_log_location, mdc_log_location, len); } else @@ -1285,49 +1292,49 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F /* Get object flush callback information */ if (H5P_get(plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &(f->shared->object_flush)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get object flush cb info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get object flush cb info"); /* Get the VOL connector info */ if (H5F__set_vol_conn(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't cache VOL connector info"); /* Create a metadata cache with the specified number of elements. * The cache might be created with a different number of elements and * the access property list should be updated to reflect that. */ if (H5AC_create(f, &(f->shared->mdc_initCacheCfg), &(f->shared->mdc_initCacheImageCfg)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create metadata cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create metadata cache"); /* Create the file's "open object" information */ if (H5FO_create(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure"); /* Add new "shared" struct to list of open files */ if (H5F__sfile_add(f->shared) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to append to list of open files") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to append to list of open files"); } /* end else */ f->shared->nrefs++; /* Create the file's "top open object" information */ if (H5FO_top_create(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create open object data structure"); /* Set return value */ ret_value = f; done: if (!ret_value && f) { - HDassert(NULL == f->vol_obj); + assert(NULL == f->vol_obj); if (!shared) { /* Attempt to clean up some of the shared file structures */ if (f->shared->efc) if (H5F__efc_destroy(f->shared->efc) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, NULL, "can't destroy external file cache") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, NULL, "can't destroy external file cache"); if (f->shared->fcpl_id > 0) if (H5I_dec_ref(f->shared->fcpl_id) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "can't close property list") + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, NULL, "can't close property list"); f->shared = H5FL_FREE(H5F_shared_t, f->shared); } @@ -1357,8 +1364,8 @@ H5F__dest(H5F_t *f, hbool_t flush) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); if (1 == f->shared->nrefs) { int actype; /* metadata cache type (enum value) */ @@ -1373,7 +1380,7 @@ H5F__dest(H5F_t *f, hbool_t flush) if ((H5F_ACC_RDWR & H5F_INTENT(f)) && flush) if (H5F__flush_phase1(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 1)") + HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 1)"); /* Notify the metadata cache that the file is about to be closed. * This allows the cache to set up for creating a metadata cache @@ -1381,7 +1388,7 @@ H5F__dest(H5F_t *f, hbool_t flush) */ if (H5AC_prep_for_file_close(f) < 0) /* Push error, but keep going */ - HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "metadata cache prep for close failed") + HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "metadata cache prep for close failed"); /* Flush at this point since the file will be closed (phase 2). * Only try to flush the file if it was opened with write access, and if @@ -1390,7 +1397,7 @@ H5F__dest(H5F_t *f, hbool_t flush) if ((H5F_ACC_RDWR & H5F_INTENT(f)) && flush) if (H5F__flush_phase2(f, TRUE) < 0) /* Push error, but keep going */ - HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 2)") + HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cached data (phase 2)"); /* With the shutdown modifications, the contents of the metadata cache * should be clean at this point, with the possible exception of the @@ -1398,13 +1405,13 @@ H5F__dest(H5F_t *f, hbool_t flush) * * Verify this. */ - HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); + assert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); /* Release the external file cache */ if (f->shared->efc) { if (H5F__efc_destroy(f->shared->efc) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't destroy external file cache") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't destroy external file cache"); f->shared->efc = NULL; } /* end if */ @@ -1414,7 +1421,7 @@ H5F__dest(H5F_t *f, hbool_t flush) * * Verify this. */ - HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); + assert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); /* Release objects that depend on the superblock being initialized */ if (f->shared->sblock) { @@ -1437,12 +1444,12 @@ H5F__dest(H5F_t *f, hbool_t flush) if (H5F_ACC_RDWR & H5F_INTENT(f)) { if (H5MF_close(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file free space info"); /* at this point, only the superblock and superblock * extension should be dirty. */ - HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); + assert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); /* Flush the file again (if requested), as shutting down the * free space manager may dirty some data structures again. @@ -1455,7 +1462,7 @@ H5F__dest(H5F_t *f, hbool_t flush) /* Mark EOA info dirty in cache, so change will get encoded */ if (H5F_eoa_dirty(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty"); /* Release any space allocated to space aggregators, * so that the eoa value corresponds to the end of the @@ -1466,17 +1473,17 @@ H5F__dest(H5F_t *f, hbool_t flush) */ if (H5MF_free_aggrs(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file space") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file space"); /* Truncate the file to the current allocated size */ if (H5FD_truncate(f->shared->lf, TRUE) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed") + HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed"); /* at this point, only the superblock and superblock * extension should be dirty. */ - HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); + assert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); } /* end if */ } /* end if */ @@ -1486,12 +1493,12 @@ H5F__dest(H5F_t *f, hbool_t flush) if (f->shared->drvinfo) if (H5AC_unpin_entry(f->shared->drvinfo) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin drvinfo") + HDONE_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin drvinfo"); /* Unpin the superblock, since we're about to destroy the cache */ if (H5AC_unpin_entry(f->shared->sblock) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock") + HDONE_ERROR(H5E_FSPACE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock"); f->shared->sblock = NULL; } /* end if */ @@ -1500,12 +1507,12 @@ H5F__dest(H5F_t *f, hbool_t flush) * * Verify this. */ - HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); + assert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); /* Remove shared file struct from list of open files */ if (H5F__sfile_remove(f->shared) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file"); /* Shutdown the metadata cache */ /* (Flushes any remaining dirty entries, which should only be the @@ -1513,12 +1520,12 @@ H5F__dest(H5F_t *f, hbool_t flush) */ if (H5AC_dest(f)) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file"); /* Shutdown the page buffer cache */ if (H5PB_dest(f->shared) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing page buffer cache") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing page buffer cache"); /* Clean up the metadata cache log location string */ if (f->shared->mdc_log_location) @@ -1532,45 +1539,45 @@ H5F__dest(H5F_t *f, hbool_t flush) /* Free the root group */ if (H5G_root_free(f->shared->root_grp) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file"); f->shared->root_grp = NULL; } /* end if */ /* Destroy other components of the file */ if (H5F__accum_reset(f->shared, TRUE) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file"); if (H5FO_dest(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file"); f->shared->cwfs = (struct H5HG_heap_t **)H5MM_xfree(f->shared->cwfs); if (H5G_node_close(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "problems closing file"); /* Destroy file creation properties */ if (H5I_GENPROP_LST != H5I_get_type(f->shared->fcpl_id)) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a property list") + HDONE_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a property list"); if (H5I_dec_ref(f->shared->fcpl_id) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close property list") + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close property list"); /* Clean up the cached VOL connector ID & info */ if (f->shared->vol_info) if (H5VL_free_connector_info(f->shared->vol_id, f->shared->vol_info) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object"); if (f->shared->vol_id > 0) if (H5I_dec_ref(f->shared->vol_id) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close VOL connector ID") + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close VOL connector ID"); f->shared->vol_cls = NULL; /* Close the file */ if (H5FD_close(f->shared->lf) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); /* Free mount table */ f->shared->mtab.child = (H5F_mount_t *)H5MM_xfree(f->shared->mtab.child); @@ -1605,18 +1612,20 @@ H5F__dest(H5F_t *f, hbool_t flush) * and unwrap file VOL object */ if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL object wrap context") + HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL object wrap context"); if (vol_wrap_ctx && (NULL == H5VL_object_unwrap(f->vol_obj))) - HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't unwrap VOL object") + HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't unwrap VOL object"); if (H5VL_free_object(f->vol_obj) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object"); f->vol_obj = NULL; } if (H5FO_top_dest(f) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "problems closing file"); f->shared = NULL; - f = H5FL_FREE(H5F_t, f); + + if (ret_value >= 0) + f = H5FL_FREE(H5F_t, f); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__dest() */ @@ -1656,7 +1665,7 @@ H5F__check_if_using_file_locks(H5P_genplist_t *fapl, hbool_t *use_file_locking) /* Check the fapl property */ if (H5P_get(fapl, H5F_ACS_USE_FILE_LOCKING_NAME, use_file_locking) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get use file locking flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get use file locking flag"); /* Check the environment variable */ if (use_locks_env_g != FAIL) @@ -1771,15 +1780,15 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * same file more than once at a time. */ if (NULL == (drvr = H5FD_get_class(fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to retrieve VFL class") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to retrieve VFL class"); /* Get the file access property list, for future queries */ if (NULL == (a_plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not file access property list"); /* Check if we are using file locking */ if (H5F__check_if_using_file_locks(a_plist, &use_file_locking) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file locking flag"); /* * Opening a file is a two step process. First we try to open the @@ -1797,22 +1806,52 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) else tent_flags = flags; - H5E_BEGIN_TRY - { - lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF); + /* + * When performing a tentative open of a file where we have stripped away + * flags such as H5F_ACC_CREAT from the specified file access flags, the + * H5E_BEGIN/END_TRY macros are used to suppress error output since there + * is an expectation that the tentative open might fail. Even though we + * explicitly clear the error stack after such a failure, the underlying + * file driver might maintain its own error stack and choose whether to + * display errors based on whether the library has disabled error reporting. + * Since we wish to suppress that error output as well for the case of + * tentative file opens, surrounding the file open call with the + * H5E_BEGIN/END_TRY macros is an explicit instruction to the file driver + * not to display errors. If the tentative file open call fails, another + * attempt at opening the file will be made without error output being + * suppressed. + * + * However, if stripping away the H5F_ACC_CREAT flag and others left us + * with the same file access flags as before, then we will skip this + * tentative file open and only make a single attempt at opening the file. + * In this case, we don't want to suppress error output since the underlying + * file driver might provide more details on why the file open failed. + */ + if (tent_flags != flags) { + /* Make tentative attempt to open file */ + H5E_BEGIN_TRY + { + lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF); + } + H5E_END_TRY } - H5E_END_TRY; - if (NULL == lf) { - if (tent_flags == flags) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", - name, tent_flags) - H5E_clear_stack(NULL); - tent_flags = flags; + /* + * If a tentative attempt to open the file wasn't necessary, attempt + * to open the file now. Otherwise, if the tentative open failed, clear + * the error stack and reset the file access flags, then make another + * attempt at opening the file. + */ + if ((tent_flags == flags) || (lf == NULL)) { + if (tent_flags != flags) { + H5E_clear_stack(NULL); + tent_flags = flags; + } + if (NULL == (lf = H5FD_open(name, tent_flags, fapl_id, HADDR_UNDEF))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file: name = '%s', tent_flags = %x", - name, tent_flags) - } /* end if */ + name, tent_flags); + } /* Is the file already open? */ if ((shared = H5F__sfile_search(lf)) != NULL) { @@ -1827,26 +1866,26 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * SWMR write/read access flags don't agree. */ if (H5FD_close(lf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info"); if (flags & H5F_ACC_TRUNC) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to truncate a file which is already open") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to truncate a file which is already open"); if (flags & H5F_ACC_EXCL) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file exists") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file exists"); if ((flags & H5F_ACC_RDWR) && 0 == (shared->flags & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for read-only") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for read-only"); if ((flags & H5F_ACC_SWMR_WRITE) && 0 == (shared->flags & H5F_ACC_SWMR_WRITE)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "SWMR write access flag not the same for file that is already open") + "SWMR write access flag not the same for file that is already open"); if ((flags & H5F_ACC_SWMR_READ) && !((shared->flags & H5F_ACC_SWMR_WRITE) || (shared->flags & H5F_ACC_SWMR_READ) || (shared->flags & H5F_ACC_RDWR))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "SWMR read access flag not the same for file that is already open") + "SWMR read access flag not the same for file that is already open"); /* Allocate new "high-level" file struct */ if ((file = H5F__new(shared, flags, fcpl_id, fapl_id, NULL)) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create new file object") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create new file object"); } /* end if */ else { /* Check if tentative open was good enough */ @@ -1857,10 +1896,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * file and open it for real. */ if (H5FD_close(lf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info"); if (NULL == (lf = H5FD_open(name, flags, fapl_id, HADDR_UNDEF))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file"); } /* end if */ /* Place an advisory lock on the file */ @@ -1868,8 +1907,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if (H5FD_lock(lf, (hbool_t)((flags & H5F_ACC_RDWR) ? TRUE : FALSE)) < 0) { /* Locking failed - Closing will remove the lock */ if (H5FD_close(lf) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "unable to close low-level file info") - HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, NULL, "unable to lock the file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "unable to close low-level file info"); + HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, NULL, "unable to lock the file"); } /* end if */ /* Create the 'top' file structure */ @@ -1879,8 +1918,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * so we have to close lf here before heading to the error handling. */ if (H5FD_close(lf) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info") - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to initialize file structure") + HDONE_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to close low-level file info"); + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to initialize file structure"); } /* end if */ /* Need to set status_flags in the superblock if the driver has a 'lock' method */ @@ -1890,9 +1929,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Check to see if both SWMR and cache image are requested. Fail if so */ if (H5C_cache_image_status(file, &ci_load, &ci_write) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get MDC cache image status") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get MDC cache image status"); if ((ci_load || ci_write) && (flags & (H5F_ACC_SWMR_READ | H5F_ACC_SWMR_WRITE))) - HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL, "can't have both SWMR and cache image") + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL, "can't have both SWMR and cache image"); /* Retain the name the file was opened with */ file->open_name = H5MM_xstrdup(name); @@ -1908,26 +1947,26 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) file->shared->use_file_locking = use_file_locking; else if (shared->nrefs > 1) if (file->shared->use_file_locking != use_file_locking) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file locking flag values don't match") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file locking flag values don't match"); /* Check if page buffering is enabled */ if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &page_buf_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get page buffer size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get page buffer size"); if (page_buf_size) { #ifdef H5_HAVE_PARALLEL /* Collective metadata writes are not supported with page buffering */ if (file->shared->coll_md_write) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "collective metadata writes are not supported with page buffering") + "collective metadata writes are not supported with page buffering"); /* Temporary: fail file create when page buffering feature is enabled for parallel */ - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "page buffering is disabled for parallel") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "page buffering is disabled for parallel"); #endif /* H5_HAVE_PARALLEL */ /* Query for other page buffer cache properties */ if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &page_buf_min_meta_perc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum metadata fraction of page buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum metadata fraction of page buffer"); if (H5P_get(a_plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &page_buf_min_raw_perc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum raw data fraction of page buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get minimum raw data fraction of page buffer"); } /* end if */ /* @@ -1944,33 +1983,33 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Create the page buffer before initializing the superblock */ if (page_buf_size) if (H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer"); /* Initialize information about the superblock and allocate space for it */ /* (Writes superblock extension messages, if there are any) */ if (H5F__super_init(file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to allocate file superblock") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to allocate file superblock"); /* Create and open the root group */ /* (This must be after the space for the superblock is allocated in * the file, since the superblock must be at offset 0) */ if (H5G_mkroot(file, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create/open root group"); } /* end if */ else if (1 == shared->nrefs) { /* Read the superblock if it hasn't been read before. */ if (H5F__super_read(file, a_plist, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock") + HGOTO_ERROR(H5E_FILE, H5E_READERROR, NULL, "unable to read superblock"); /* Create the page buffer before initializing the superblock */ if (page_buf_size) if (H5PB_create(shared, page_buf_size, page_buf_min_meta_perc, page_buf_min_raw_perc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to create page buffer"); /* Open the root group */ if (H5G_mkroot(file, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to read root group"); } /* end if */ /* @@ -1980,7 +2019,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * the degree in shared file structure. */ if (H5P_get(a_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get file close degree"); if (shared->nrefs == 1) { if (fc_degree == H5F_CLOSE_DEFAULT) shared->fc_degree = lf->cls->fc_degree; @@ -1989,16 +2028,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) } /* end if */ else if (shared->nrefs > 1) { if (fc_degree == H5F_CLOSE_DEFAULT && shared->fc_degree != lf->cls->fc_degree) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match"); if (fc_degree != H5F_CLOSE_DEFAULT && fc_degree != shared->fc_degree) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "file close degree doesn't match"); } /* end if */ /* This is a private property to clear the status_flags in the super block */ /* Use by h5clear and a routine in test/flush2.c to clear the test file's status_flags */ if (H5P_exist_plist(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME) > 0) { if (H5P_get(a_plist, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get clearance for status_flags"); else if (clear) file->shared->sblock->status_flags = 0; } /* end if */ @@ -2009,23 +2048,23 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) * in shared file structure. */ if (H5P_get(a_plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get evict on close value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get evict on close value"); if (shared->nrefs == 1) shared->evict_on_close = evict_on_close; else if (shared->nrefs > 1) { if (shared->evict_on_close != evict_on_close) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "file evict-on-close value doesn't match") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "file evict-on-close value doesn't match"); } /* end if */ /* Formulate the absolute path for later search of target file for external links */ if (shared->nrefs == 1) { if (H5_build_extpath(name, &file->shared->extpath) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build extpath"); } /* Formulate the actual file name, after following symlinks, etc. */ if (H5F__build_actual_name(file, a_plist, name, &file->actual_name) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build actual name") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to build actual name"); if (set_flag) { if (H5F_INTENT(file) & H5F_ACC_RDWR) { /* Set and check consistency of status_flags */ @@ -2036,7 +2075,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for write/SWMR write (may use to clear " - "file consistency flags)") + "file consistency flags)"); } /* version 3 superblock */ file->shared->sblock->status_flags |= H5F_SUPER_WRITE_ACCESS; @@ -2045,16 +2084,16 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* Flush the superblock & superblock extension */ if (H5F_super_dirty(file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, NULL, "unable to mark superblock as dirty") + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, NULL, "unable to mark superblock as dirty"); if (H5F_flush_tagged_metadata(file, H5AC__SUPERBLOCK_TAG) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock"); if (H5F_flush_tagged_metadata(file, file->shared->sblock->ext_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, NULL, "unable to flush superblock extension"); /* Remove the file lock for SWMR_WRITE */ if (use_file_locking && (H5F_INTENT(file) & H5F_ACC_SWMR_WRITE)) { if (H5FD_unlock(file->shared->lf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, NULL, "unable to unlock the file") + HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, NULL, "unable to unlock the file"); } /* end if */ } /* end if */ else { /* H5F_ACC_RDONLY: check consistency of status_flags */ @@ -2066,13 +2105,13 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) (!(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) && file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, - "file is not already open for SWMR writing") + "file is not already open for SWMR writing"); } /* end if */ else if ((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) || (file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for write (may use to clear file " - "consistency flags)") + "consistency flags)"); } /* version 3 superblock */ } /* end else */ } /* end if set_flag */ @@ -2083,7 +2122,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) done: if ((NULL == ret_value) && file) if (H5F__dest(file, FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_open() */ @@ -2106,11 +2145,11 @@ H5F__post_open(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity check arguments */ - HDassert(f); + assert(f); /* Store a vol object in the file struct */ if (NULL == (f->vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, f, f->shared->vol_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create VOL object") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create VOL object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2133,12 +2172,12 @@ H5F__flush_phase1(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity check arguments */ - HDassert(f); + assert(f); /* Flush any cached dataset storage raw data */ if (H5D_flush_all(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush dataset cache"); /* Release any space allocated to space aggregators, so that the eoa value * corresponds to the end of the space written to in the file. @@ -2148,7 +2187,7 @@ H5F__flush_phase1(H5F_t *f) */ if (H5MF_free_aggrs(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file space") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release file space"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__flush_phase1() */ @@ -2170,17 +2209,17 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) FUNC_ENTER_PACKAGE /* Sanity check arguments */ - HDassert(f); + assert(f); /* Inform the metadata cache that we are about to flush */ if (H5AC_prep_for_file_flush(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "prep for MDC flush failed") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "prep for MDC flush failed"); /* Flush the entire metadata cache */ if (H5AC_flush(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache"); #ifdef H5_HAVE_PARALLEL if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { @@ -2196,12 +2235,12 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) /* Truncate the file to the current allocated size */ if (H5FD_truncate(f->shared->lf, closing) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed") + HDONE_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "low level truncate failed"); /* Flush the entire metadata cache again since the EOA could have changed in the truncate call. */ if (H5AC_flush(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush metadata cache"); #ifdef H5_HAVE_PARALLEL if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) @@ -2212,22 +2251,22 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing) /* Inform the metadata cache that we are done with the flush */ if (H5AC_secure_from_file_flush(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "secure from MDC flush failed") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "secure from MDC flush failed"); /* Flush out the metadata accumulator */ if (H5F__accum_flush(f->shared) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator") + HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush metadata accumulator"); /* Flush the page buffer */ if (H5PB_flush(f->shared) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "page buffer flush failed") + HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "page buffer flush failed"); /* Flush file buffers to disk. */ if (H5FD_flush(f->shared->lf, closing) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "low level flush failed") + HDONE_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "low level flush failed"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__flush_phase2() */ @@ -2249,17 +2288,17 @@ H5F__flush(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity check arguments */ - HDassert(f); + assert(f); /* First phase of flushing data */ if (H5F__flush_phase1(f) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush file data") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush file data"); /* Second phase of flushing data */ if (H5F__flush_phase2(f, FALSE) < 0) /* Push error, but keep going*/ - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush file data") + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush file data"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__flush() */ @@ -2293,7 +2332,7 @@ H5F__close(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); + assert(f); /* Perform checks for "semi" file close degree here, since closing the * file is not allowed if there are objects still open. @@ -2304,7 +2343,7 @@ H5F__close(H5F_t *f) /* Get the number of open objects and open files on this file/mount hierarchy */ if (H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0) - HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy") + HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy"); /* If there are no other file IDs open on this file/mount hier., but * there are still open objects, issue an error and bail out now, @@ -2312,7 +2351,7 @@ H5F__close(H5F_t *f) * a "real" attempt at closing the file. */ if (nopen_files == 1 && nopen_objs > 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, there are objects still open"); } /* Reset the file ID for this file */ @@ -2320,7 +2359,7 @@ H5F__close(H5F_t *f) /* Attempt to close the file/mount hierarchy */ if (H5F_try_close(f, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2341,11 +2380,11 @@ H5F__delete(const char *filename, hid_t fapl_id) FUNC_ENTER_PACKAGE - HDassert(filename); + assert(filename); /* Delete the file */ if (H5FD_delete(filename, fapl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "unable to delete file") + HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "unable to delete file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2373,8 +2412,8 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Set the was_closed flag to the default value. * This flag lets downstream code know if the file struct is @@ -2389,12 +2428,12 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) if (f->closing) { if (was_closed) *was_closed = TRUE; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* Get the number of open objects and open files on this file/mount hierarchy */ if (H5F__mount_count_ids(f, &nopen_files, &nopen_objs) < 0) - HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy") + HGOTO_ERROR(H5E_SYM, H5E_MOUNT, FAIL, "problem checking mount hierarchy"); /* * Close file according to close degree: @@ -2415,18 +2454,18 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) * close all objects isn't a major problem. */ if ((nopen_files + nopen_objs) > 0) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); break; case H5F_CLOSE_SEMI: /* Can leave safely if file IDs are still open on this file */ if (nopen_files > 0) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Sanity check: If close degree if "semi" and we have gotten this * far and there are objects left open, bail out now. */ - HDassert(nopen_files == 0 && nopen_objs == 0); + assert(nopen_files == 0 && nopen_objs == 0); /* If we've gotten this far (ie. there are no open objects in the file), fall through to flush & * close */ @@ -2435,7 +2474,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) case H5F_CLOSE_STRONG: /* If there are other open files in the hierarchy, we can leave now */ if (nopen_files > 0) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* If we've gotten this far (ie. there are no open file IDs in the file/mount hierarchy), fall * through to flush & close */ @@ -2443,7 +2482,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) case H5F_CLOSE_DEFAULT: default: - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, unknown file close degree") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file, unknown file close degree"); } /* end switch */ /* Mark this file as closing (prevents re-entering file shutdown code below) */ @@ -2451,7 +2490,7 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) /* If the file close degree is "strong", close all the open objects in this file */ if (f->shared->fc_degree == H5F_CLOSE_STRONG) { - HDassert(nopen_files == 0); + assert(nopen_files == 0); /* Forced close of all opened objects in this file */ if (f->nopen_objs > 0) { @@ -2469,10 +2508,10 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) /* Try to close all the open objects in this file */ for (u = 0; u < obj_count; u++) if (H5I_dec_ref(objs[u]) < 0) - HGOTO_ERROR(H5E_ID, H5E_CLOSEERROR, FAIL, "can't close object") + HGOTO_ERROR(H5E_ID, H5E_CLOSEERROR, FAIL, "can't close object"); } if (result < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(1)"); /* Get the list of IDs of open named datatype objects */ /* (Do this separately from the dataset & attribute IDs, because @@ -2487,10 +2526,10 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) /* Try to close all the open objects in this file */ for (u = 0; u < obj_count; u++) if (H5I_dec_ref(objs[u]) < 0) - HGOTO_ERROR(H5E_ID, H5E_CLOSEERROR, FAIL, "can't close object") + HGOTO_ERROR(H5E_ID, H5E_CLOSEERROR, FAIL, "can't close object"); } if (result < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(2)") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADITER, FAIL, "H5F_get_obj_ids failed(2)"); } /* end if */ } /* end if */ @@ -2499,11 +2538,11 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) */ if (f->parent) if (H5F_try_close(f->parent, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close parent file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close parent file"); /* Unmount and close each child before closing the current file. */ if (H5F__close_mounts(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't unmount child files") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't unmount child files"); /* If there is more than one reference to the shared file struct and the * file has an external file cache, we should see if it can be closed. This @@ -2511,14 +2550,14 @@ H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/) */ if (f->shared->efc && (f->shared->nrefs > 1)) if (H5F__efc_try_close(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't attempt to close EFC") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't attempt to close EFC"); /* Destroy the H5F_t struct and decrement the reference count for the * shared H5F_shared_t struct. If the reference count for the H5F_shared_t * struct reaches zero then destroy it also. */ if (H5F__dest(f, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problems closing file"); /* Since we closed the file, this should be set to TRUE */ if (was_closed) @@ -2551,7 +2590,7 @@ H5F__reopen(H5F_t *f) /* Get a new "top level" file struct, sharing the same "low level" file struct */ if (NULL == (ret_value = H5F__new(f->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to reopen file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to reopen file"); /* Duplicate old file's names */ ret_value->open_name = H5MM_xstrdup(f->open_name); @@ -2580,18 +2619,18 @@ H5F_get_id(H5F_t *file) FUNC_ENTER_NOAPI_NOINIT - HDassert(file); + assert(file); if (H5I_find_id(file, H5I_FILE, &ret_value) < 0 || H5I_INVALID_HID == ret_value) { /* resurrect the ID - Register an ID with the native connector */ if ((ret_value = H5VL_wrap_register(H5I_FILE, file, FALSE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group"); file->id_exists = TRUE; } else { /* Increment reference count on existing ID */ if (H5I_inc_ref(ret_value, FALSE) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed") + HGOTO_ERROR(H5E_ID, H5E_CANTINC, H5I_INVALID_HID, "incrementing file ID failed"); } /* end else */ done: @@ -2613,7 +2652,7 @@ H5F_incr_nopen_objs(H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(++f->nopen_objs) } /* end H5F_incr_nopen_objs() */ @@ -2633,7 +2672,7 @@ H5F_decr_nopen_objs(H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(--f->nopen_objs) } /* end H5F_decr_nopen_objs() */ @@ -2662,10 +2701,10 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(fapl); - HDassert(name); - HDassert(actual_name); + assert(f); + assert(fapl); + assert(name); + assert(actual_name); /* Clear actual name pointer to begin with */ *actual_name = NULL; @@ -2680,7 +2719,7 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n /* Call lstat() on the file's name */ if (HDlstat(name, &lst) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stat info for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stat info for file"); /* Check for symbolic link */ if (S_IFLNK == (lst.st_mode & S_IFMT)) { @@ -2692,7 +2731,7 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n /* Allocate realname buffer */ if (NULL == (realname = (char *)H5MM_calloc((size_t)PATH_MAX * sizeof(char)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Perform a sanity check that the file or link wasn't switched * between when we opened it and when we called lstat(). This is @@ -2703,9 +2742,9 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n /* Copy the FAPL object to modify */ if ((new_fapl_id = H5P_copy_plist(fapl, FALSE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy file access property list"); if (NULL == (new_fapl = (H5P_genplist_t *)H5I_object(new_fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "can't get property list"); /* * Set the private property for retrieving the backing store @@ -2713,11 +2752,12 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n */ want_posix_fd = TRUE; if (H5P_set(new_fapl, H5F_ACS_WANT_POSIX_FD_NAME, &want_posix_fd) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set property for retrieving file descriptor") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, + "can't set property for retrieving file descriptor"); /* Retrieve the file handle */ if (H5F_get_vfd_handle(f, new_fapl_id, (void **)&fd) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve POSIX file descriptor") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve POSIX file descriptor"); /* Stat the filename we're resolving */ if (HDstat(name, &st) < 0) @@ -2729,15 +2769,15 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n /* Verify that the files are really the same */ if (st.st_mode != fst.st_mode || st.st_ino != fst.st_ino || st.st_dev != fst.st_dev) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "files' st_ino or st_dev fields changed!") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "files' st_ino or st_dev fields changed!"); /* Get the resolved path for the file name */ if (NULL == HDrealpath(name, realname)) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve real path for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve real path for file"); /* Duplicate the resolved path for the file name */ if (NULL == (*actual_name = (char *)H5MM_strdup(realname))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't duplicate real path") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't duplicate real path"); } /* end if */ } /* end if */ #endif /* H5_HAVE_SYMLINK */ @@ -2746,14 +2786,14 @@ H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *n if (NULL == *actual_name) { /* Just duplicate the name used to open the file */ if (NULL == (*actual_name = (char *)H5MM_strdup(name))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't duplicate open name") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't duplicate open name"); } /* end else */ done: /* Close the property list */ if (new_fapl_id > 0) if (H5I_dec_app_ref(new_fapl_id) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close duplicated FAPL") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close duplicated FAPL"); #ifdef H5_HAVE_SYMLINK if (realname) realname = (char *)H5MM_xfree(realname); @@ -2780,15 +2820,15 @@ H5F_addr_encode_len(size_t addr_len, uint8_t **pp /*in,out*/, haddr_t addr) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(addr_len); - HDassert(pp && *pp); + assert(addr_len); + assert(pp && *pp); - if (H5F_addr_defined(addr)) { + if (H5_addr_defined(addr)) { for (u = 0; u < addr_len; u++) { *(*pp)++ = (uint8_t)(addr & 0xff); addr >>= 8; } /* end for */ - HDassert("overflow" && 0 == addr); + assert("overflow" && 0 == addr); } /* end if */ else { for (u = 0; u < addr_len; u++) @@ -2814,7 +2854,7 @@ H5F_addr_encode(const H5F_t *f, uint8_t **pp /*in,out*/, haddr_t addr) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); H5F_addr_encode_len(H5F_SIZEOF_ADDR(f), pp, addr); @@ -2843,9 +2883,9 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp /*in,out*/, haddr_t *add /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(addr_len); - HDassert(pp && *pp); - HDassert(addr_p); + assert(addr_len); + assert(pp && *pp); + assert(addr_p); /* Reset value in destination */ *addr_p = 0; @@ -2871,8 +2911,8 @@ H5F_addr_decode_len(size_t addr_len, const uint8_t **pp /*in,out*/, haddr_t *add *addr_p |= tmp; } /* end if */ else if (!all_zero) - HDassert(0 == **pp); /*overflow */ - } /* end for */ + assert(0 == **pp); /*overflow */ + } /* end for */ /* If 'all_zero' is still TRUE, the address was entirely composed of '0xff' * bytes, which is the encoded form of 'HADDR_UNDEF', so set the destination @@ -2902,7 +2942,7 @@ H5F_addr_decode(const H5F_t *f, const uint8_t **pp /*in,out*/, haddr_t *addr_p / /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); H5F_addr_decode_len(H5F_SIZEOF_ADDR(f), pp, addr_p); @@ -2924,9 +2964,9 @@ H5F_set_grp_btree_shared(H5F_t *f, H5UC_t *rc) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(rc); + assert(f); + assert(f->shared); + assert(rc); f->shared->grp_btree_shared = rc; @@ -2948,8 +2988,8 @@ H5F_set_sohm_addr(H5F_t *f, haddr_t addr) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); f->shared->sohm_addr = addr; @@ -2971,8 +3011,8 @@ H5F_set_sohm_vers(H5F_t *f, unsigned vers) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); f->shared->sohm_vers = vers; @@ -2994,8 +3034,8 @@ H5F_set_sohm_nindexes(H5F_t *f, unsigned nindexes) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); f->shared->sohm_nindexes = nindexes; @@ -3017,8 +3057,8 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); f->shared->store_msg_crt_idx = flag; @@ -3035,8 +3075,6 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; December 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -3047,8 +3085,8 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Set the bounds only if the existing setting is different from the inputs */ if (f->shared->low_bound != low || f->shared->high_bound != high) { @@ -3073,7 +3111,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high) * QAK - April, 2018 */ if (H5F__flush(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information"); /* Set the new bounds */ f->shared->low_bound = low; @@ -3105,10 +3143,10 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_le /* Check args */ if (!file || !file->shared || !file->shared->lf) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file_id yields invalid file pointer") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file_id yields invalid file pointer"); fd_ptr = file->shared->lf; if (!fd_ptr->cls) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "fd_ptr yields invalid class pointer") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "fd_ptr yields invalid class pointer"); /* the address space used by the split and multi file drivers is not * a good fit for this call. Since the plan is to depreciate these @@ -3129,7 +3167,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_le * JRM -- 11/11/22 */ if (HDstrcmp(fd_ptr->cls->name, "multi") == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver."); /* While the family file driver is conceptually fully compatible * with the get file image operation, it sets a file driver message @@ -3151,11 +3189,11 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_le * JRM -- 12/21/11 */ if (HDstrcmp(fd_ptr->cls->name, "family") == 0) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver.") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver."); /* Go get the actual file size */ if (HADDR_UNDEF == (eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size"); /* Test to see if a buffer was provided */ if (buf_ptr != NULL) { @@ -3163,12 +3201,12 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_le /* Check for buffer too small */ if ((haddr_t)buf_len < eoa) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "supplied buffer too small") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "supplied buffer too small"); /* Read in the file image */ /* (Note compensation for base address addition in internal routine) */ if (H5FD_read(fd_ptr, H5FD_MEM_DEFAULT, 0, (size_t)eoa, buf_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed") + HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed"); /* Offset to "status_flags" in the superblock */ tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers); @@ -3177,7 +3215,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_le tmp_size = H5F_SUPER_STATUS_FLAGS_SIZE(file->shared->sblock->super_vers); /* Clear "status_flags" */ - HDmemset((uint8_t *)buf_ptr + tmp, 0, tmp_size); + memset((uint8_t *)buf_ptr + tmp, 0, tmp_size); } /* end if */ /* Set *image_len = to EOA */ @@ -3204,25 +3242,25 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(finfo); + assert(f); + assert(f->shared); + assert(finfo); /* Reset file info struct */ - HDmemset(finfo, 0, sizeof(*finfo)); + memset(finfo, 0, sizeof(*finfo)); /* Get the size of the superblock and any superblock extensions */ if (H5F__super_size(f, &finfo->super.super_size, &finfo->super.super_ext_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock sizes") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock sizes"); /* Get the size of any persistent free space */ if (H5MF_get_freespace(f, &finfo->free.tot_space, &finfo->free.meta_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve free space information") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve free space information"); /* Check for SOHM info */ - if (H5F_addr_defined(f->shared->sohm_addr)) + if (H5_addr_defined(f->shared->sohm_addr)) if (H5SM_ih_size(f, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve SOHM index & heap storage info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve SOHM index & heap storage info"); /* Set version # fields */ finfo->super.version = f->shared->sblock->super_vers; @@ -3255,23 +3293,23 @@ H5F_track_metadata_read_retries(H5F_t *f, unsigned actype, unsigned retries) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared->read_attempts > 1); - HDassert(f->shared->retries_nbins > 0); - HDassert(retries > 0); - HDassert(retries < f->shared->read_attempts); - HDassert(actype < H5AC_NTYPES); + assert(f); + assert(f->shared->read_attempts > 1); + assert(f->shared->retries_nbins > 0); + assert(retries > 0); + assert(retries < f->shared->read_attempts); + assert(actype < H5AC_NTYPES); /* Allocate memory for retries */ if (NULL == f->shared->retries[actype]) if (NULL == (f->shared->retries[actype] = (uint32_t *)H5MM_calloc((size_t)f->shared->retries_nbins * sizeof(uint32_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Index to retries based on log10 */ tmp = HDlog10((double)retries); log_ind = (unsigned)tmp; - HDassert(log_ind < f->shared->retries_nbins); + assert(log_ind < f->shared->retries_nbins); /* Increment the # of the "retries" */ f->shared->retries[actype][log_ind]++; @@ -3299,10 +3337,10 @@ H5F_set_retries(H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(f); + assert(f); /* Initialize the tracking for metadata read retries */ - HDmemset(f->shared->retries, 0, sizeof(f->shared->retries)); + memset(f->shared->retries, 0, sizeof(f->shared->retries)); /* Initialize the # of bins for retries */ f->shared->retries_nbins = 0; @@ -3334,13 +3372,13 @@ H5F_object_flush_cb(H5F_t *f, hid_t obj_id) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Invoke object flush callback if there is one */ if (f->shared->object_flush.func && f->shared->object_flush.func(obj_id, f->shared->object_flush.udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "object flush callback returns error") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "object flush callback returns error"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3361,12 +3399,12 @@ H5F__set_base_addr(const H5F_t *f, haddr_t addr) FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Dispatch to driver */ if (H5FD_set_base_addr(f->shared->lf, addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_base_addr request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_base_addr request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3387,13 +3425,13 @@ H5F__set_eoa(const H5F_t *f, H5F_mem_t type, haddr_t addr) FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Dispatch to driver */ /* (H5FD_set_eoa() will add base_addr to addr) */ if (H5FD_set_eoa(f->shared->lf, type, addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3415,12 +3453,12 @@ H5F__set_paged_aggr(const H5F_t *f, hbool_t paged) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Dispatch to driver */ if (H5FD_set_paged_aggr(f->shared->lf, paged) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set paged aggr mode failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set paged aggr mode failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3445,8 +3483,8 @@ H5F__get_max_eof_eoa(const H5F_t *f, haddr_t *max_eof_eoa) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Get the relative EOA and EOF */ eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT); @@ -3455,7 +3493,7 @@ H5F__get_max_eof_eoa(const H5F_t *f, haddr_t *max_eof_eoa) /* Determine the maximum */ tmp_max = MAX(eof, eoa); if (HADDR_UNDEF == tmp_max) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file get eof/eoa requests failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file get eof/eoa requests failed"); *max_eof_eoa = tmp_max; @@ -3483,14 +3521,14 @@ H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(file); - HDassert(info); + assert(file); + assert(info); /* Copy the # of bins for "retries" array */ info->nbins = file->shared->retries_nbins; /* Initialize the array of "retries" */ - HDmemset(info->retries, 0, sizeof(info->retries)); + memset(info->retries, 0, sizeof(info->retries)); /* Return if there are no bins -- no retries */ if (!info->nbins) @@ -3524,7 +3562,7 @@ H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) case H5AC_FARRAY_DBLOCK_ID: case H5AC_FARRAY_DBLK_PAGE_ID: case H5AC_SUPERBLOCK_ID: - HDassert(j < H5F_NUM_METADATA_READ_RETRY_TYPES); + assert(j < H5F_NUM_METADATA_READ_RETRY_TYPES); if (file->shared->retries[i] != NULL) { /* Allocate memory for retries[i] * @@ -3532,7 +3570,7 @@ H5F_get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) * the H5free_memory() call. */ if (NULL == (info->retries[j] = (uint32_t *)H5MM_malloc(tot_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Copy the information */ H5MM_memcpy(info->retries[j], file->shared->retries[i], tot_size); @@ -3605,72 +3643,72 @@ H5F__start_swmr_write(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Should have write permission */ if ((H5F_INTENT(f) & H5F_ACC_RDWR) == 0) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "no write intent on file"); /* Check superblock version */ if (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version - should be at least 3") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version - should be at least 3"); /* Check for correct file format version */ if ((f->shared->low_bound < H5F_LIBVER_V110) || (f->shared->high_bound < H5F_LIBVER_V110)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, - "file format version does not support SWMR - needs to be 1.10 or greater") + "file format version does not support SWMR - needs to be 1.10 or greater"); /* Should not be marked for SWMR writing mode already */ if (f->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file already in SWMR writing mode") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file already in SWMR writing mode"); /* Check to see if cache image is enabled. Fail if so */ if (H5C_cache_image_status(f, &ci_load, &ci_write) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MDC cache image status"); if (ci_load || ci_write) - HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and MDC cache image") + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, FAIL, "can't have both SWMR and MDC cache image"); /* Flush the superblock extension */ if (H5F_flush_tagged_metadata(f, f->shared->sblock->ext_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension"); /* Flush data buffers */ if (H5F__flush(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information"); /* Get the # of opened named datatypes and attributes */ if (H5F_get_obj_count(f, H5F_OBJ_DATATYPE | H5F_OBJ_ATTR, FALSE, &nt_attr_count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed"); if (nt_attr_count > 0) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "named datatypes and/or attributes opened in the file"); /* Get the # of opened datasets and groups */ if (H5F_get_obj_count(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, FALSE, &grp_dset_count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed"); if (grp_dset_count > 0) { /* Allocate space for group and object locations */ if ((obj_ids = (hid_t *)H5MM_malloc(grp_dset_count * sizeof(hid_t))) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for hid_t") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for hid_t"); if ((obj_glocs = (H5G_loc_t *)H5MM_malloc(grp_dset_count * sizeof(H5G_loc_t))) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for object group locations") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for object group locations"); if ((obj_olocs = (H5O_loc_t *)H5MM_malloc(grp_dset_count * sizeof(H5O_loc_t))) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for object locations") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for object locations"); if ((obj_paths = (H5G_name_t *)H5MM_malloc(grp_dset_count * sizeof(H5G_name_t))) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for object paths") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for object paths"); /* Taking a shortcut here to use calloc to initialize obj_apl_ids to all H5P_DEFAULT. If * this changes in the future we'll need to either initialize this array to all H5P_DEFAULT * or ensure 0 cannot be a valid value and check for 0 at cleanup. */ if ((obj_apl_ids = (hid_t *)H5MM_calloc(grp_dset_count * sizeof(hid_t))) == NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for hid_t") - HDassert(obj_apl_ids[0] == H5P_DEFAULT); + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "can't allocate buffer for hid_t"); + assert(obj_apl_ids[0] == H5P_DEFAULT); /* Get the list of opened object ids (groups & datasets) */ if (H5F_get_obj_ids(f, H5F_OBJ_GROUP | H5F_OBJ_DATASET, grp_dset_count, obj_ids, FALSE, &grp_dset_count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "H5F_get_obj_ids failed"); /* Save the VOL connector and the object wrapping context for the refresh step */ if (grp_dset_count > 0) { @@ -3678,7 +3716,7 @@ H5F__start_swmr_write(H5F_t *f) /* Get the VOL object for one of the IDs */ if (NULL == (vol_obj = H5VL_vol_object(obj_ids[0]))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Get the (top) connector for the ID */ vol_connector = vol_obj->connector; @@ -3696,7 +3734,7 @@ H5F__start_swmr_write(H5F_t *f) /* Get the object from the VOL */ if (NULL == (obj = H5VL_object(obj_ids[u]))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get the object's access property list, if it is a dataset (access * properties are not needed to reopen other object types currently) @@ -3715,11 +3753,11 @@ H5F__start_swmr_write(H5F_t *f) /* Get dataset access properties */ if ((obj_apl_ids[u] = H5D_get_access_plist(obj)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, - "unable to get dataset access property list") + "unable to get dataset access property list"); break; case H5I_MAP: - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector"); case H5I_UNINIT: case H5I_BADID: @@ -3738,7 +3776,7 @@ H5F__start_swmr_write(H5F_t *f) case H5I_NTYPES: default: HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, - "not a valid file object ID (dataset, group, or datatype)") + "not a valid file object ID (dataset, group, or datatype)"); break; } /* end switch */ @@ -3753,13 +3791,13 @@ H5F__start_swmr_write(H5F_t *f) /* Close the object */ if (H5I_dec_ref(obj_ids[u]) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTCLOSEOBJ, FAIL, "decrementing object ID failed") + HGOTO_ERROR(H5E_ID, H5E_CANTCLOSEOBJ, FAIL, "decrementing object ID failed"); } /* end for */ } /* end if */ /* Flush and reset the accumulator */ if (H5F__accum_reset(f->shared, TRUE) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") + HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator"); /* Turn on SWMR write in shared file open flags */ f->shared->flags |= H5F_ACC_SWMR_WRITE; @@ -3772,12 +3810,12 @@ H5F__start_swmr_write(H5F_t *f) /* Initialize "retries" and "retries_nbins" */ if (H5F_set_retries(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't set retries and retries_nbins") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't set retries and retries_nbins"); /* Turn off usage of accumulator */ f->shared->feature_flags &= ~(unsigned)H5FD_FEAT_ACCUMULATE_METADATA; if (H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set feature_flags in VFD") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set feature_flags in VFD"); setup = TRUE; @@ -3787,41 +3825,41 @@ H5F__start_swmr_write(H5F_t *f) * type (exclusive vs shared) with a second call. */ if (H5FD_unlock(f->shared->lf) < 0) { - HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file") + HGOTO_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file"); } if (H5FD_lock(f->shared->lf, TRUE) < 0) { - HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, FAIL, "unable to lock the file") + HGOTO_ERROR(H5E_FILE, H5E_CANTLOCKFILE, FAIL, "unable to lock the file"); } } /* Mark superblock as dirty */ if (H5F_super_dirty(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty"); /* Flush the superblock */ if (H5F_flush_tagged_metadata(f, H5AC__SUPERBLOCK_TAG) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock"); /* Evict all flushed entries in the cache except the pinned superblock */ if (H5F__evict_cache_entries(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict file's cached information") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to evict file's cached information"); /* Refresh (reopen) the objects (groups & datasets) in the file */ for (u = 0; u < grp_dset_count; u++) if (H5O_refresh_metadata_reopen(obj_ids[u], obj_apl_ids[u], &obj_glocs[u], vol_connector, TRUE) < 0) - HGOTO_ERROR(H5E_ID, H5E_CLOSEERROR, FAIL, "can't refresh-close object") + HGOTO_ERROR(H5E_ID, H5E_CLOSEERROR, FAIL, "can't refresh-close object"); done: if (ret_value < 0 && setup) { /* Re-enable accumulator */ f->shared->feature_flags |= (unsigned)H5FD_FEAT_ACCUMULATE_METADATA; if (H5FD_set_feature_flags(f->shared->lf, f->shared->feature_flags) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set feature_flags in VFD") + HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set feature_flags in VFD"); /* Reset the # of read attempts */ f->shared->read_attempts = H5F_METADATA_READ_ATTEMPTS; if (H5F_set_retries(f) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't set retries and retries_nbins") + HDONE_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't set retries and retries_nbins"); /* Un-set H5F_ACC_SWMR_WRITE in shared open flags */ f->shared->flags &= ~H5F_ACC_SWMR_WRITE; @@ -3831,17 +3869,17 @@ H5F__start_swmr_write(H5F_t *f) /* Mark superblock as dirty */ if (H5F_super_dirty(f) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty"); /* Flush the superblock */ if (H5F_flush_tagged_metadata(f, H5AC__SUPERBLOCK_TAG) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock") + HDONE_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock"); } /* end if */ /* Unlock the file */ if (H5F_USE_FILE_LOCKING(f)) if (H5FD_unlock(f->shared->lf) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file") + HDONE_ERROR(H5E_FILE, H5E_CANTUNLOCKFILE, FAIL, "unable to unlock the file"); /* Free memory */ if (obj_ids) @@ -3857,7 +3895,7 @@ H5F__start_swmr_write(H5F_t *f) if (obj_apl_ids) { for (u = 0; u < grp_dset_count; u++) if (obj_apl_ids[u] != H5P_DEFAULT && obj_apl_ids[u] >= 0 && H5I_dec_ref(obj_apl_ids[u]) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTDEC, FAIL, "decrementing property list ID failed") + HDONE_ERROR(H5E_ID, H5E_CANTDEC, FAIL, "decrementing property list ID failed"); H5MM_xfree(obj_apl_ids); } @@ -3882,8 +3920,8 @@ H5F__format_convert(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Check if the superblock should be downgraded */ if (f->shared->sblock->super_vers > HDF5_SUPERBLOCK_VERSION_V18_LATEST) { @@ -3898,14 +3936,14 @@ H5F__format_convert(H5F_t *f) f->shared->fs_page_size == H5F_FILE_SPACE_PAGE_SIZE_DEF)) { /* Check to remove free-space manager info message from superblock extension */ - if (H5F_addr_defined(f->shared->sblock->ext_addr)) + if (H5_addr_defined(f->shared->sblock->ext_addr)) if (H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, - "error in removing message from superblock extension") + "error in removing message from superblock extension"); /* Close freespace manager */ if (H5MF_try_close(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to free free-space address"); /* Set non-persistent freespace manager */ f->shared->fs_strategy = H5F_FILE_SPACE_STRATEGY_DEF; @@ -3921,7 +3959,7 @@ H5F__format_convert(H5F_t *f) if (mark_dirty) /* Mark superblock as dirty */ if (H5F_super_dirty(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3960,26 +3998,26 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) /* Retrieve VOL file from object */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object"); /* Check if the file's ID already exists */ if (H5I_find_id(vol_obj_file, H5I_FILE, &file_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "getting file ID failed"); /* If the ID does not exist, register it with the VOL connector */ if (H5I_INVALID_HID == file_id) { /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; if ((file_id = H5VL_wrap_register(H5I_FILE, vol_obj_file, app_ref)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle"); } /* end if */ else { /* Increment ref count on existing ID */ if (H5I_inc_ref(file_id, app_ref) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "incrementing file ID failed"); } /* end else */ /* Set return value */ @@ -3988,7 +4026,7 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref) done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_FILE, H5E_CANTRESET, H5I_INVALID_HID, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_get_file_id() */ @@ -4008,8 +4046,8 @@ H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); f->shared->crt_dset_min_ohdr_flag = minimize; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fio.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fio.c index 287dd61241..1b329b647e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fio.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fio.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Fio.c - * Jan 10 2008 - * Quincey Koziol * * Purpose: File I/O routines. * @@ -75,9 +72,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 10 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -89,20 +83,20 @@ H5F_shared_block_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); - HDassert(buf); - HDassert(H5F_addr_defined(addr)); + assert(f_sh); + assert(buf); + assert(H5_addr_defined(addr)); /* Check for attempting I/O on 'temporary' file address */ - if (H5F_addr_le(f_sh->tmp_addr, (addr + size))) - HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + if (H5_addr_le(f_sh->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space"); /* Treat global heap as raw data */ map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; /* Pass through page buffer layer */ if (H5PB_read(f_sh, map_type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -117,9 +111,6 @@ H5F_shared_block_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 10 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -131,21 +122,21 @@ H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf / FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(buf); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->shared); + assert(buf); + assert(H5_addr_defined(addr)); /* Check for attempting I/O on 'temporary' file address */ - if (H5F_addr_le(f->shared->tmp_addr, (addr + size))) - HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + if (H5_addr_le(f->shared->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space"); /* Treat global heap as raw data */ map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; /* Pass through page buffer layer */ if (H5PB_read(f->shared, map_type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through page buffer failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -160,9 +151,6 @@ H5F_block_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf / * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 10 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -174,21 +162,21 @@ H5F_shared_block_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); - HDassert(H5F_SHARED_INTENT(f_sh) & H5F_ACC_RDWR); - HDassert(buf); - HDassert(H5F_addr_defined(addr)); + assert(f_sh); + assert(H5F_SHARED_INTENT(f_sh) & H5F_ACC_RDWR); + assert(buf); + assert(H5_addr_defined(addr)); /* Check for attempting I/O on 'temporary' file address */ - if (H5F_addr_le(f_sh->tmp_addr, (addr + size))) - HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + if (H5_addr_le(f_sh->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space"); /* Treat global heap as raw data */ map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; /* Pass through page buffer layer */ if (H5PB_write(f_sh, map_type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -203,9 +191,6 @@ H5F_shared_block_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 10 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -217,22 +202,22 @@ H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); - HDassert(buf); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(f->shared); + assert(H5F_INTENT(f) & H5F_ACC_RDWR); + assert(buf); + assert(H5_addr_defined(addr)); /* Check for attempting I/O on 'temporary' file address */ - if (H5F_addr_le(f->shared->tmp_addr, (addr + size))) - HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + if (H5_addr_le(f->shared->tmp_addr, (addr + size))) + HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space"); /* Treat global heap as raw data */ map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; /* Pass through page buffer layer */ if (H5PB_write(f->shared, map_type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through page buffer failed"); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_block_write() */ @@ -248,9 +233,6 @@ H5F_block_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, const void * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * May 3 2021 - * *------------------------------------------------------------------------- */ herr_t @@ -263,12 +245,12 @@ H5F_shared_select_read(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, H5S_ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); - HDassert((mem_spaces) || (count == 0)); - HDassert((file_spaces) || (count == 0)); - HDassert((offsets) || (count == 0)); - HDassert((element_sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(f_sh); + assert((mem_spaces) || (count == 0)); + assert((file_spaces) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* Treat global heap as raw data */ map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; @@ -276,7 +258,7 @@ H5F_shared_select_read(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, H5S_ /* Pass down to file driver layer (bypass page buffer for now) */ if (H5FD_read_selection(f_sh->lf, map_type, count, mem_spaces, file_spaces, offsets, element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "selection read through file driver failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "selection read through file driver failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -293,9 +275,6 @@ H5F_shared_select_read(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, H5S_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * May 4 2021 - * *------------------------------------------------------------------------- */ herr_t @@ -308,12 +287,12 @@ H5F_shared_select_write(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, H5S FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); - HDassert((mem_spaces) || (count == 0)); - HDassert((file_spaces) || (count == 0)); - HDassert((offsets) || (count == 0)); - HDassert((element_sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(f_sh); + assert((mem_spaces) || (count == 0)); + assert((file_spaces) || (count == 0)); + assert((offsets) || (count == 0)); + assert((element_sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* Treat global heap as raw data */ map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; @@ -321,7 +300,7 @@ H5F_shared_select_write(H5F_shared_t *f_sh, H5FD_mem_t type, uint32_t count, H5S /* Pass down to file driver layer (bypass page buffer for now) */ if (H5FD_write_selection(f_sh->lf, map_type, count, mem_spaces, file_spaces, offsets, element_sizes, bufs) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "selection write through file driver failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "selection write through file driver failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -336,11 +315,11 @@ H5F_shared_vector_read(H5F_shared_t *f_sh, uint32_t count, H5FD_mem_t types[], h FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); - HDassert((types) || (count == 0)); - HDassert((addrs) || (count == 0)); - HDassert((sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(f_sh); + assert((types) || (count == 0)); + assert((addrs) || (count == 0)); + assert((sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* * Note that we don't try to map global heap data to raw @@ -349,13 +328,21 @@ H5F_shared_vector_read(H5F_shared_t *f_sh, uint32_t count, H5FD_mem_t types[], h * for now, assume the caller has done this already. */ #ifndef NDEBUG - for (uint32_t i = 0; i < count; i++) - HDassert(types[i] != H5FD_MEM_GHEAP); + for (uint32_t i = 0; i < count; i++) { + /* Break early if H5FD_MEM_NOLIST was specified + * since a full 'count'-sized array may not + * have been passed for 'types' + */ + if (i > 0 && types[i] == H5FD_MEM_NOLIST) + break; + + assert(types[i] != H5FD_MEM_GHEAP); + } #endif /* Pass down to file driver layer (bypass page buffer for now) */ if (H5FD_read_vector(f_sh->lf, count, types, addrs, sizes, bufs) < 0) - HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vector read through file driver failed") + HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "vector read through file driver failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -381,11 +368,11 @@ H5F_shared_vector_write(H5F_shared_t *f_sh, uint32_t count, H5FD_mem_t types[], FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); - HDassert((types) || (count == 0)); - HDassert((addrs) || (count == 0)); - HDassert((sizes) || (count == 0)); - HDassert((bufs) || (count == 0)); + assert(f_sh); + assert((types) || (count == 0)); + assert((addrs) || (count == 0)); + assert((sizes) || (count == 0)); + assert((bufs) || (count == 0)); /* * Note that we don't try to map global heap data to raw @@ -394,13 +381,21 @@ H5F_shared_vector_write(H5F_shared_t *f_sh, uint32_t count, H5FD_mem_t types[], * for now, assume the caller has done this already. */ #ifndef NDEBUG - for (uint32_t i = 0; i < count; i++) - HDassert(types[i] != H5FD_MEM_GHEAP); + for (uint32_t i = 0; i < count; i++) { + /* Break early if H5FD_MEM_NOLIST was specified + * since a full 'count'-sized array may not + * have been passed for 'types' + */ + if (i > 0 && types[i] == H5FD_MEM_NOLIST) + break; + + assert(types[i] != H5FD_MEM_GHEAP); + } #endif /* Pass down to file driver layer (bypass page buffer for now) */ if (H5FD_write_vector(f_sh->lf, count, types, addrs, sizes, bufs) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write through file driver failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "vector write through file driver failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -414,9 +409,6 @@ H5F_shared_vector_write(H5F_shared_t *f_sh, uint32_t count, H5FD_mem_t types[], * * Return: Non-negative on success/Negative on failure * - * Programmer: Mike McGreevy - * September 9, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -428,47 +420,20 @@ H5F_flush_tagged_metadata(H5F_t *f, haddr_t tag) /* Use tag to search for and flush associated metadata */ if (H5AC_flush_tagged_metadata(f, tag) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata"); /* Flush and reset the accumulator */ if (H5F__accum_reset(f->shared, TRUE) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator") + HGOTO_ERROR(H5E_IO, H5E_CANTRESET, FAIL, "can't reset accumulator"); /* Flush file buffers to disk. */ if (H5FD_flush(f->shared->lf, FALSE) < 0) - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed") + HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed"); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_flush_tagged_metadata */ -/*------------------------------------------------------------------------- - * Function: H5F_evict_tagged_metadata - * - * Purpose: Evicts metadata from the cache with specified tag. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Mike McGreevy - * September 9, 2010 - * - *------------------------------------------------------------------------- - */ -herr_t -H5F_evict_tagged_metadata(H5F_t *f, haddr_t tag) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI(FAIL) - - /* Evict the object's metadata */ - if (H5AC_evict_tagged_metadata(f, tag, TRUE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "unable to evict tagged metadata") - -done: - FUNC_LEAVE_NOAPI(ret_value); -} /* end H5F_evict_tagged_metadata */ - /*------------------------------------------------------------------------- * Function: H5F__evict_cache_entries * @@ -476,9 +441,6 @@ H5F_evict_tagged_metadata(H5F_t *f, haddr_t tag) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Dec 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -488,12 +450,12 @@ H5F__evict_cache_entries(H5F_t *f) FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Evict all except pinned entries in the cache */ if (H5AC_evict(f) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "unable to evict all except pinned entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "unable to evict all except pinned entries"); #ifndef NDEBUG { @@ -502,24 +464,24 @@ H5F__evict_cache_entries(H5F_t *f) /* Retrieve status of the superblock */ if (H5AC_get_entry_status(f, (haddr_t)0, &status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to get entry status") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to get entry status"); /* Verify status of the superblock entry in the cache */ if (!(status & H5AC_ES__IN_CACHE) || !(status & H5AC_ES__IS_PINNED)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to get entry status") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to get entry status"); /* Get the number of cache entries */ if (H5AC_get_cache_size(f->shared->cache, NULL, NULL, NULL, &cur_num_entries) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed."); /* Should be the only one left in the cache (the superblock) */ if (cur_num_entries != 1) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "number of cache entries is not correct") + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "number of cache entries is not correct"); } #endif /* NDEBUG */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__evict_cache_entries() */ /*------------------------------------------------------------------------- @@ -532,9 +494,6 @@ H5F__evict_cache_entries(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Sept 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -543,8 +502,8 @@ H5F_get_checksums(const uint8_t *buf, size_t buf_size, uint32_t *s_chksum /*out* FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments */ - HDassert(buf); - HDassert(buf_size); + assert(buf); + assert(buf_size); /* Return the stored checksum */ if (s_chksum) { diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5FloatType.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5FloatType.cpp deleted file mode 100644 index 33f8377084..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5FloatType.cpp +++ /dev/null @@ -1,355 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5DxferProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5AbstractDs.h" -#include "H5DataSpace.h" -#include "H5AtomType.h" -#include "H5FloatType.h" -#include "H5DataSet.h" -#include "H5PredType.h" - -namespace H5 { - -//-------------------------------------------------------------------------- -// Function: FloatType default constructor -///\brief Default constructor: Creates a stub floating-point datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FloatType::FloatType() -{ -} - -//-------------------------------------------------------------------------- -// Function: FloatType overloaded constructor -///\brief Creates a floating-point datatype using a predefined type. -///\param pred_type - IN: Predefined datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FloatType::FloatType(const PredType &pred_type) : AtomType() -{ - // use DataType::copy to make a copy of this predefined type - copy(pred_type); -} - -//-------------------------------------------------------------------------- -// Function: FloatType overloaded constructor -///\brief Creates an FloatType object using the id of an existing -/// datatype. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FloatType::FloatType(const hid_t existing_id) : AtomType(existing_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: FloatType copy constructor -///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FloatType::FloatType(const FloatType &original) : AtomType(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: FloatType overloaded constructor -///\brief Gets the floating-point datatype of the specified dataset -///\param dataset - IN: Dataset that this floating-point datatype -/// associates with -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FloatType::FloatType(const DataSet &dataset) : AtomType() -{ - // Calls C function H5Dget_type to get the id of the datatype - id = H5Dget_type(dataset.getId()); - - if (id < 0) { - throw DataSetIException("FloatType constructor", "H5Dget_type failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FloatType overloaded constructor -///\brief Creates an FloatType instance by opening an HDF5 float datatype -/// given its name, provided as a C character string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Float type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openFloatType(const char*) -// to improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -FloatType::FloatType(const H5Location &loc, const char *dtype_name) : AtomType() -{ - id = p_opentype(loc, dtype_name); -} - -//-------------------------------------------------------------------------- -// Function: FloatType overloaded constructor -///\brief Creates an FloatType instance by opening an HDF5 float datatype -/// given its name, provided as an \c H5std_string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Float type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openFloatType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -FloatType::FloatType(const H5Location &loc, const H5std_string &dtype_name) : AtomType() -{ - id = p_opentype(loc, dtype_name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: FloatType::decode -///\brief Returns an FloatType object via DataType* by decoding the -/// binary object description of this type. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -DataType * -FloatType::decode() const -{ - hid_t encoded_flttype_id = H5I_INVALID_HID; - try { - encoded_flttype_id = p_decode(); - } - catch (DataTypeIException &err) { - throw; - } - FloatType *encoded_flttype = new FloatType; - encoded_flttype->p_setId(encoded_flttype_id); - return (encoded_flttype); -} - -//-------------------------------------------------------------------------- -// Function: FloatType::getFields -///\brief Retrieves floating point datatype bit field information. -///\param spos - OUT: Retrieved floating-point sign bit -///\param epos - OUT: Retrieved exponent bit-position -///\param esize - OUT: Retrieved size of exponent, in bits -///\param mpos - OUT: Retrieved mantissa bit-position -///\param msize - OUT: Retrieved size of mantissa, in bits -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FloatType::getFields(size_t &spos, size_t &epos, size_t &esize, size_t &mpos, size_t &msize) const -{ - herr_t ret_value = H5Tget_fields(id, &spos, &epos, &esize, &mpos, &msize); - if (ret_value < 0) { - throw DataTypeIException("FloatType::getFields", "H5Tget_fields failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FloatType::setFields -///\brief Sets locations and sizes of floating point bit fields. -///\param spos - OUT: Sign position, i.e., the bit offset of the -/// floating-point sign bit. -///\param epos - OUT: Exponent bit position -///\param esize - OUT: Size of exponent, in bits -///\param mpos - OUT: Mantissa bit-position -///\param msize - OUT: Size of mantissa, in bits -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const -{ - herr_t ret_value = H5Tset_fields(id, spos, epos, esize, mpos, msize); - if (ret_value < 0) { - throw DataTypeIException("FloatType::setFields", "H5Tset_fields failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FloatType::getEbias -///\brief Retrieves the exponent bias of a floating-point type. -///\return Exponent bias -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -size_t -FloatType::getEbias() const -{ - size_t ebias = H5Tget_ebias(id); - // Returns the bias if successful - if (ebias == 0) { - throw DataTypeIException("FloatType::getEbias", "H5Tget_ebias failed - returned exponent bias as 0"); - } - return (ebias); -} - -//-------------------------------------------------------------------------- -// Function: FloatType::setEbias -///\brief Sets the exponent bias of a floating-point type. -///\param ebias - Exponent bias value -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FloatType::setEbias(size_t ebias) const -{ - herr_t ret_value = H5Tset_ebias(id, ebias); - if (ret_value < 0) { - throw DataTypeIException("FloatType::setEbias", "H5Tset_ebias failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FloatType::getNorm -///\brief Retrieves mantissa normalization of a floating-point datatype. -///\param norm_string - OUT: Text string of the normalization type -///\return Valid normalization type, which can be: -/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored -/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1 -/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized -///\exception H5::DataTypeIException -///\par Description -/// For your convenience, this function also provides the text -/// string of the returned normalization type, via parameter -/// \a norm_string. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5T_norm_t -FloatType::getNorm(H5std_string &norm_string) const -{ - H5T_norm_t norm = H5Tget_norm(id); // C routine - // Returns a valid normalization type if successful - if (norm == H5T_NORM_ERROR) { - throw DataTypeIException("FloatType::getNorm", "H5Tget_norm failed - returned H5T_NORM_ERROR"); - } - if (norm == H5T_NORM_IMPLIED) - norm_string = "H5T_NORM_IMPLIED (0)"; - else if (norm == H5T_NORM_MSBSET) - norm_string = "H5T_NORM_MSBSET (1)"; - else if (norm == H5T_NORM_NONE) - norm_string = "H5T_NORM_NONE (2)"; - return (norm); -} - -//-------------------------------------------------------------------------- -// Function: FloatType::setNorm -///\brief Sets the mantissa normalization of a floating-point datatype. -///\param norm - IN: Mantissa normalization type -///\exception H5::DataTypeIException -///\par Description -/// Valid values for normalization type include: -/// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored -/// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1 -/// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FloatType::setNorm(H5T_norm_t norm) const -{ - herr_t ret_value = H5Tset_norm(id, norm); - if (ret_value < 0) { - throw DataTypeIException("FloatType::setNorm", "H5Tset_norm failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FloatType::getInpad -///\brief Retrieves the internal padding type for unused bits in -/// this floating-point datatypes. -///\return Internal padding type, which can be: -/// \li \c H5T_PAD_ZERO (0) - Set background to zeros -/// \li \c H5T_PAD_ONE (1) - Set background to ones -/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone -///\exception H5::DataTypeIException -///\par Description -/// For your convenience, this function also provides the text -/// string of the returned internal padding type, via parameter -/// \a pad_string. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5T_pad_t -FloatType::getInpad(H5std_string &pad_string) const -{ - H5T_pad_t pad_type = H5Tget_inpad(id); - // Returns a valid padding type if successful - if (pad_type == H5T_PAD_ERROR) { - throw DataTypeIException("FloatType::getInpad", "H5Tget_inpad failed - returned H5T_PAD_ERROR"); - } - if (pad_type == H5T_PAD_ZERO) - pad_string = "H5T_PAD_ZERO (0)"; - else if (pad_type == H5T_PAD_ONE) - pad_string = "H5T_PAD_ONE (1)"; - else if (pad_type == H5T_PAD_BACKGROUND) - pad_string = "H5T_PAD_BACKGROUD (2)"; - return (pad_type); -} - -//-------------------------------------------------------------------------- -// Function: FloatType::setInpad -///\brief Fills unused internal floating point bits. -///\param inpad - IN: Internal padding type -///\exception H5::DataTypeIException -///\par Description -/// If any internal bits of a floating point type are unused -/// (that is, those significant bits which are not part of the -/// sign, exponent, or mantissa), then they will be filled -/// according to the padding value provided by \a inpad. -///\par -/// Valid values for normalization type include: -/// \li \c H5T_PAD_ZERO (0) - Set background to zeros -/// \li \c H5T_PAD_ONE (1) - Set background to ones -/// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -FloatType::setInpad(H5T_pad_t inpad) const -{ - herr_t ret_value = H5Tset_inpad(id, inpad); - if (ret_value < 0) { - throw DataTypeIException("FloatType::setInpad", "H5Tset_inpad failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: FloatType destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -FloatType::~FloatType() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fmount.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fmount.c index 7992f7be16..ef0aa7b1a4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fmount.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fmount.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -35,9 +34,6 @@ static void H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsign * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, July 2, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -48,7 +44,7 @@ H5F__close_mounts(H5F_t *f) FUNC_ENTER_PACKAGE - HDassert(f); + assert(f); /* Unmount all child files. Loop backwards to avoid having to adjust u when * a file is unmounted. Note that we rely on unsigned u "wrapping around" @@ -62,21 +58,21 @@ H5F__close_mounts(H5F_t *f) /* Close the internal group maintaining the mount point */ if (H5G_close(f->shared->mtab.child[u].group) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close child group") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "can't close child group"); /* Close the child file */ if (H5F_try_close(f->shared->mtab.child[u].file, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close child file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close child file"); /* Eliminate the mount point from the table */ - HDmemmove(f->shared->mtab.child + u, f->shared->mtab.child + u + 1, - (f->shared->mtab.nmounts - u - 1) * sizeof(f->shared->mtab.child[0])); + memmove(f->shared->mtab.child + u, f->shared->mtab.child + u + 1, + (f->shared->mtab.nmounts - u - 1) * sizeof(f->shared->mtab.child[0])); f->shared->mtab.nmounts--; f->nmounts--; } } - HDassert(f->nmounts == 0); + assert(f->nmounts == 0); done: FUNC_LEAVE_NOAPI(ret_value) @@ -91,9 +87,6 @@ H5F__close_mounts(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, October 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -112,10 +105,10 @@ H5F_mount(const H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UN FUNC_ENTER_NOAPI(FAIL) - HDassert(loc); - HDassert(name && *name); - HDassert(child); - HDassert(TRUE == H5P_isa_class(plist_id, H5P_FILE_MOUNT)); + assert(loc); + assert(name && *name); + assert(child); + assert(TRUE == H5P_isa_class(plist_id, H5P_FILE_MOUNT)); /* Set up group location to fill in */ mp_loc.oloc = &mp_oloc; @@ -129,41 +122,41 @@ H5F_mount(const H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UN * that the mount wouldn't introduce a cycle in the mount tree. */ if (child->parent) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "file is already mounted"); if (H5G_loc_find(loc, name, &mp_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found"); /* If the mount location is holding its file open, that file will close * and remove the mount as soon as we exit this function. Prevent the * user from doing this. */ if (mp_loc.oloc->holding_file != FALSE) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount path cannot contain links to external files") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount path cannot contain links to external files"); /* Open the mount point group */ if (NULL == (mount_point = H5G_open(&mp_loc))) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found"); /* Check if the proposed mount point group is already a mount point */ if (H5G_MOUNTED(mount_point)) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point is already in use") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point is already in use"); /* Retrieve information from the mount point group */ /* (Some of which we had before but was reset in mp_loc when the group * "took over" the group location - QAK) */ parent = H5G_fileof(mount_point); - HDassert(parent); + assert(parent); mp_loc.oloc = H5G_oloc(mount_point); - HDassert(mp_loc.oloc); + assert(mp_loc.oloc); mp_loc.path = H5G_nameof(mount_point); - HDassert(mp_loc.path); + assert(mp_loc.path); for (ancestor = parent; ancestor; ancestor = ancestor->parent) if (ancestor->shared == child->shared) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount would introduce a cycle") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount would introduce a cycle"); /* Make certain that the parent & child files have the same "file close degree" */ if (parent->shared->fc_degree != child->shared->fc_degree) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mounted file has different file close degree than parent") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mounted file has different file close degree than parent"); /* * Use a binary search to locate the position that the child should be @@ -178,7 +171,7 @@ H5F_mount(const H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UN md = (lt + rt) / 2; oloc = H5G_oloc(parent->shared->mtab.child[md].group); - cmp = H5F_addr_cmp(mp_loc.oloc->addr, oloc->addr); + cmp = H5_addr_cmp(mp_loc.oloc->addr, oloc->addr); if (cmp < 0) rt = md; else if (cmp > 0) @@ -187,7 +180,7 @@ H5F_mount(const H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UN if (cmp > 0) md++; if (!cmp) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point is already in use") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point is already in use"); /* Make room in the table */ if (parent->shared->mtab.nmounts >= parent->shared->mtab.nalloc) { @@ -196,14 +189,14 @@ H5F_mount(const H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UN n * sizeof(parent->shared->mtab.child[0])); if (!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for mount table") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for mount table"); parent->shared->mtab.child = x; parent->shared->mtab.nalloc = n; } /* Insert into table */ - HDmemmove(parent->shared->mtab.child + md + 1, parent->shared->mtab.child + md, - (parent->shared->mtab.nmounts - md) * sizeof(parent->shared->mtab.child[0])); + memmove(parent->shared->mtab.child + md + 1, parent->shared->mtab.child + md, + (parent->shared->mtab.nmounts - md) * sizeof(parent->shared->mtab.child[0])); parent->shared->mtab.nmounts++; parent->nmounts++; parent->shared->mtab.child[md].group = mount_point; @@ -212,29 +205,29 @@ H5F_mount(const H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UN /* Set the group's mountpoint flag */ if (H5G_mount(parent->shared->mtab.child[md].group) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to set group mounted flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to set group mounted flag"); /* Get the group location for the root group in the file to unmount */ if (NULL == (root_loc.oloc = H5G_oloc(child->shared->root_grp))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group"); if (NULL == (root_loc.path = H5G_nameof(child->shared->root_grp))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group"); /* Search the open IDs and replace names for mount operation */ /* We pass H5G_UNKNOWN as object type; search all IDs */ if (H5G_name_replace(NULL, H5G_NAME_MOUNT, mp_loc.oloc->file, mp_loc.path->full_path_r, root_loc.oloc->file, root_loc.path->full_path_r) < 0) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to replace name") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to replace name"); done: if (ret_value < 0) { if (mount_point) { if (H5G_close(mount_point) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close mounted group") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close mounted group"); } else { if (H5G_loc_free(&mp_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free mount location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free mount location"); } } @@ -254,9 +247,6 @@ H5F_mount(const H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UN * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, October 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -276,8 +266,8 @@ H5F_unmount(const H5G_loc_t *loc, const char *name) FUNC_ENTER_NOAPI(FAIL) - HDassert(loc); - HDassert(name && *name); + assert(loc); + assert(name && *name); /* Set up mount point location to fill in */ mp_loc.oloc = &mp_oloc; @@ -290,13 +280,13 @@ H5F_unmount(const H5G_loc_t *loc, const char *name) * then we must have found the mount point. */ if (H5G_loc_find(loc, name, &mp_loc /*out*/) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "group not found") + HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "group not found"); mp_loc_setup = TRUE; child = mp_loc.oloc->file; mnt_oloc = H5G_oloc(child->shared->root_grp); child_idx = -1; - if (child->parent && H5F_addr_eq(mp_oloc.addr, mnt_oloc->addr)) { + if (child->parent && H5_addr_eq(mp_oloc.addr, mnt_oloc->addr)) { unsigned u; /*counters */ /* @@ -327,7 +317,7 @@ H5F_unmount(const H5G_loc_t *loc, const char *name) while (lt < rt && cmp) { md = (lt + rt) / 2; mnt_oloc = H5G_oloc(parent->shared->mtab.child[md].group); - cmp = H5F_addr_cmp(mp_oloc.addr, mnt_oloc->addr); + cmp = H5_addr_cmp(mp_oloc.addr, mnt_oloc->addr); if (cmp < 0) rt = md; else @@ -335,7 +325,7 @@ H5F_unmount(const H5G_loc_t *loc, const char *name) } if (cmp) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "not a mount point") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "not a mount point"); /* Found the correct index, set the info about the child */ child_idx = (int)md; @@ -349,40 +339,40 @@ H5F_unmount(const H5G_loc_t *loc, const char *name) * Could be different due to the shared mount table. */ parent = child->parent; } /* end else */ - HDassert(child_idx >= 0); + assert(child_idx >= 0); /* Save the information about the child from the mount table */ child_group = parent->shared->mtab.child[child_idx].group; /* Get the group location for the root group in the file to unmount */ if (NULL == (root_loc.oloc = H5G_oloc(child->shared->root_grp))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group"); if (NULL == (root_loc.path = H5G_nameof(child->shared->root_grp))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group"); /* Search the open IDs replace names to reflect unmount operation */ if (H5G_name_replace(NULL, H5G_NAME_UNMOUNT, mp_loc.oloc->file, mp_loc.path->full_path_r, root_loc.oloc->file, root_loc.path->full_path_r) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to replace name") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to replace name"); /* Eliminate the mount point from the table */ - HDmemmove(parent->shared->mtab.child + (unsigned)child_idx, - (parent->shared->mtab.child + (unsigned)child_idx) + 1, - ((parent->shared->mtab.nmounts - (unsigned)child_idx) - 1) * - sizeof(parent->shared->mtab.child[0])); + memmove(parent->shared->mtab.child + (unsigned)child_idx, + (parent->shared->mtab.child + (unsigned)child_idx) + 1, + ((parent->shared->mtab.nmounts - (unsigned)child_idx) - 1) * + sizeof(parent->shared->mtab.child[0])); parent->shared->mtab.nmounts -= 1; parent->nmounts -= 1; /* Unmount the child file from the parent file */ if (H5G_unmount(child_group) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to reset group mounted flag") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to reset group mounted flag"); if (H5G_close(child_group) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close unmounted group") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close unmounted group"); /* Detach child file from parent & see if it should close */ child->parent = NULL; if (H5F_try_close(child, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close unmounted file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close unmounted file"); done: /* Free the mount point location's information, if it's been set up */ @@ -400,9 +390,6 @@ H5F_unmount(const H5G_loc_t *loc, const char *name) * Return: Success: TRUE/FALSE * Failure: (can't happen) * - * Programmer: Quincey Koziol - * Thursday, January 2, 2002 - * *------------------------------------------------------------------------- */ hbool_t @@ -412,7 +399,7 @@ H5F_is_mount(const H5F_t *file) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(file); + assert(file); if (file->parent != NULL) ret_value = TRUE; @@ -430,9 +417,6 @@ H5F_is_mount(const H5F_t *file) * * Return: void * - * Programmer: Quincey Koziol - * Tuesday, July 19, 2005 - * *------------------------------------------------------------------------- */ static void @@ -443,9 +427,9 @@ H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_ob FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); - HDassert(nopen_files); - HDassert(nopen_objs); + assert(f); + assert(nopen_files); + assert(nopen_objs); /* If this file is still open, increment number of file IDs open */ if (H5F_ID_EXISTS(f)) @@ -479,9 +463,6 @@ H5F__mount_count_ids_recurse(H5F_t *f, unsigned *nopen_files, unsigned *nopen_ob * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tues, July 19, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -490,9 +471,9 @@ H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); - HDassert(nopen_files); - HDassert(nopen_objs); + assert(f); + assert(nopen_files); + assert(nopen_objs); /* Find the top file in the mounting hierarchy */ while (f->parent) @@ -511,9 +492,6 @@ H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Fri, August 21, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -526,7 +504,7 @@ H5F__flush_mounts_recurse(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); + assert(f); /* Flush all child files, not stopping for errors */ for (u = 0; u < f->shared->mtab.nmounts; u++) @@ -535,11 +513,11 @@ H5F__flush_mounts_recurse(H5F_t *f) /* Call the "real" flush routine, for this file */ if (H5F__flush(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information"); /* Check flush errors for children - errors are already on the stack */ if (nerrors) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's child mounts") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's child mounts"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -552,9 +530,6 @@ H5F__flush_mounts_recurse(H5F_t *f) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Fri, August 21, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -565,7 +540,7 @@ H5F_flush_mounts(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); + assert(f); /* Find the top file in the mount hierarchy */ while (f->parent) @@ -573,7 +548,7 @@ H5F_flush_mounts(H5F_t *f) /* Flush the mounted file hierarchy */ if (H5F__flush_mounts_recurse(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -587,9 +562,6 @@ H5F_flush_mounts(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, October 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -605,7 +577,7 @@ H5F_traverse_mount(H5O_loc_t *oloc /*in,out*/) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(oloc); + assert(oloc); /* * The loop is necessary because we might have file1 mounted at the root @@ -622,7 +594,7 @@ H5F_traverse_mount(H5O_loc_t *oloc /*in,out*/) while (lt < rt && cmp) { md = (lt + rt) / 2; mnt_oloc = H5G_oloc(parent->shared->mtab.child[md].group); - cmp = H5F_addr_cmp(oloc->addr, mnt_oloc->addr); + cmp = H5_addr_cmp(oloc->addr, mnt_oloc->addr); if (cmp < 0) rt = md; else @@ -639,11 +611,11 @@ H5F_traverse_mount(H5O_loc_t *oloc /*in,out*/) /* Release the mount point */ if (H5O_loc_free(oloc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to free object location") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to free object location"); /* Copy the entry for the root group */ if (H5O_loc_copy_deep(oloc, mnt_oloc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location"); /* In case the shared root group info points to a different file handle * than the child, modify oloc */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fmpi.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fmpi.c index d4baf1fb0b..6786e07c06 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fmpi.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fmpi.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Fmpi.c - * Jan 10 2008 - * Quincey Koziol * * Purpose: MPI-related routines. * @@ -78,9 +75,6 @@ * * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, January 30, 2004 - * *------------------------------------------------------------------------- */ int @@ -90,11 +84,11 @@ H5F_mpi_get_rank(const H5F_t *f) FUNC_ENTER_NOAPI((-1)) - HDassert(f && f->shared); + assert(f && f->shared); /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_rank(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_rank request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_rank request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -109,9 +103,6 @@ H5F_mpi_get_rank(const H5F_t *f) * * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, January 30, 2004 - * *------------------------------------------------------------------------- */ MPI_Comm @@ -121,11 +112,11 @@ H5F_mpi_get_comm(const H5F_t *f) FUNC_ENTER_NOAPI(MPI_COMM_NULL) - HDassert(f && f->shared); + assert(f && f->shared); /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_comm(f->shared->lf)) == MPI_COMM_NULL) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, MPI_COMM_NULL, "driver get_comm request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -140,9 +131,6 @@ H5F_mpi_get_comm(const H5F_t *f) * * Failure: Negative * - * Programmer: John Mainzer - * Friday, May 6, 2005 - * *------------------------------------------------------------------------- */ int @@ -152,11 +140,11 @@ H5F_shared_mpi_get_size(const H5F_shared_t *f_sh) FUNC_ENTER_NOAPI((-1)) - HDassert(f_sh); + assert(f_sh); /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_size(f_sh->lf)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_size request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_size request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -171,9 +159,6 @@ H5F_shared_mpi_get_size(const H5F_shared_t *f_sh) * * Failure: Negative * - * Programmer: John Mainzer - * Friday, May 6, 2005 - * *------------------------------------------------------------------------- */ int @@ -183,11 +168,11 @@ H5F_mpi_get_size(const H5F_t *f) FUNC_ENTER_NOAPI((-1)) - HDassert(f && f->shared); + assert(f && f->shared); /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_size(f->shared->lf)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_size request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "driver get_size request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -210,7 +195,7 @@ H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(file); + assert(file); /* Check VFD */ if (!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) @@ -222,7 +207,7 @@ H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set atomicity flag"); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__set_mpi_atomicity() */ /*------------------------------------------------------------------------- @@ -233,9 +218,6 @@ H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -246,7 +228,7 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag) H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL); + FUNC_ENTER_API(FAIL) H5TRACE2("e", "ib", file_id, flag); /* Get the file object */ @@ -263,7 +245,7 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set MPI atomicity"); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Fset_mpi_atomicity() */ /*------------------------------------------------------------------------- @@ -283,8 +265,8 @@ H5F__get_mpi_atomicity(const H5F_t *file, hbool_t *flag) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(file); - HDassert(flag); + assert(file); + assert(flag); /* Check VFD */ if (!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) @@ -296,7 +278,7 @@ H5F__get_mpi_atomicity(const H5F_t *file, hbool_t *flag) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get atomicity flag"); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__get_mpi_atomicity() */ /*------------------------------------------------------------------------- @@ -307,9 +289,6 @@ H5F__get_mpi_atomicity(const H5F_t *file, hbool_t *flag) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -320,7 +299,7 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag /*out*/) H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL); + FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", file_id, flag); /* Get the file object */ @@ -337,7 +316,7 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag /*out*/) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MPI atomicity"); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Fget_mpi_atomicity() */ /*------------------------------------------------------------------------- @@ -351,9 +330,6 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag /*out*/) * * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Feb 14, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -364,7 +340,7 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(mpi_comm); + assert(mpi_comm); /* Set value to return to invalid MPI comm */ *mpi_comm = MPI_COMM_NULL; @@ -377,15 +353,15 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) /* Retrieve the file structure */ if (H5G_loc(loc_id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); f = loc.oloc->file; - HDassert(f); + assert(f); /* Check if MPIO driver is used */ if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { /* retrieve the file communicator */ if (MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator"); } } /* otherwise, this is from H5Fopen or H5Fcreate and has to be collective */ @@ -396,20 +372,20 @@ H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) H5FD_class_t *driver_class = NULL; if (NULL == (plist = H5P_object_verify(acspl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file access list") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a file access list"); if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID & info"); if (NULL == (driver_class = H5FD_get_class(driver_prop.driver_id))) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get driver class structure") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get driver class structure"); if (H5FD_driver_query(driver_class, &driver_feat_flags) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get driver feature flags") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get driver feature flags"); if (driver_feat_flags & H5FD_FEAT_HAS_MPI) if (H5P_peek(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, mpi_comm) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator"); } done: @@ -437,7 +413,7 @@ H5F_get_coll_metadata_reads(const H5F_t *file) FUNC_ENTER_NOAPI_NOERR - HDassert(file && file->shared); + assert(file && file->shared); /* Retrieve the file-global flag */ file_flag = H5F_COLL_MD_READ(file); @@ -515,9 +491,9 @@ H5F_set_coll_metadata_reads(H5F_t *file, H5P_coll_md_read_flag_t *file_flag, hbo FUNC_ENTER_NOAPI_NOERR - HDassert(file && file->shared); - HDassert(file_flag); - HDassert(context_flag); + assert(file && file->shared); + assert(file_flag); + assert(context_flag); /* Save old state */ prev_file_flag = H5F_COLL_MD_READ(file); @@ -566,13 +542,13 @@ H5F_mpi_get_file_block_type(hbool_t commit, MPI_Datatype *new_type, hbool_t *new FUNC_ENTER_NOAPI(FAIL) - HDassert(new_type); - HDassert(new_type_derived); + assert(new_type); + assert(new_type_derived); *new_type_derived = FALSE; field_count = 2; - HDassert(field_count == sizeof(types) / sizeof(MPI_Datatype)); + assert(field_count == sizeof(types) / sizeof(MPI_Datatype)); block_lengths[0] = 1; block_lengths[1] = 1; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fquery.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fquery.c index b2b0972247..b74884ea89 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fquery.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fquery.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Fquery.c - * Jan 10 2008 - * Quincey Koziol * * Purpose: File structure query routines. * @@ -80,7 +77,7 @@ H5F_shared_get_intent(const H5F_shared_t *f_sh) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f_sh); + assert(f_sh); FUNC_LEAVE_NOAPI(f_sh->flags) } /* end H5F_shared_get_intent() */ @@ -101,7 +98,7 @@ H5F_get_intent(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->shared->flags) } /* end H5F_get_intent() */ @@ -115,8 +112,6 @@ H5F_get_intent(const H5F_t *f) * * Return: low_bound on success/abort on failure (shouldn't fail) * - * Programmer: Vailin Choi; June 2016 - * *------------------------------------------------------------------------- */ H5F_libver_t @@ -125,7 +120,7 @@ H5F_get_low_bound(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->shared->low_bound) } /* end H5F_get_low_bound() */ @@ -139,8 +134,6 @@ H5F_get_low_bound(const H5F_t *f) * * Return: high_bound on success/abort on failure (shouldn't fail) * - * Programmer: Vailin Choi; June 2016 - * *------------------------------------------------------------------------- */ H5F_libver_t @@ -149,7 +142,7 @@ H5F_get_high_bound(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->shared->high_bound) } /* end H5F_get_high_bound() */ @@ -169,8 +162,8 @@ H5F_get_open_name(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->open_name); + assert(f); + assert(f->open_name); FUNC_LEAVE_NOAPI(f->open_name) } /* end H5F_get_open_name() */ @@ -190,8 +183,8 @@ H5F_get_actual_name(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->actual_name); + assert(f); + assert(f->actual_name); FUNC_LEAVE_NOAPI(f->actual_name) } /* end H5F_get_actual_name() */ @@ -212,9 +205,9 @@ H5F_get_extpath(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->extpath); + assert(f); + assert(f->shared); + assert(f->shared->extpath); FUNC_LEAVE_NOAPI(f->shared->extpath) } /* end H5F_get_extpath() */ @@ -233,7 +226,7 @@ H5F_get_shared(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->shared) } /* end H5F_get_shared() */ @@ -252,10 +245,10 @@ H5F_same_shared(const H5F_t *f1, const H5F_t *f2) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f1); - HDassert(f1->shared); - HDassert(f2); - HDassert(f2->shared); + assert(f1); + assert(f1->shared); + assert(f2); + assert(f2->shared); FUNC_LEAVE_NOAPI(f1->shared == f2->shared) } /* end H5F_same_shared() */ @@ -274,7 +267,7 @@ H5F_get_nopen_objs(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->nopen_objs) } /* end H5F_get_nopen_objs() */ @@ -293,7 +286,7 @@ H5F_file_id_exists(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->id_exists) } /* end H5F_file_id_exists() */ @@ -312,7 +305,7 @@ H5F_get_parent(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->parent) } /* end H5F_get_parent() */ @@ -331,7 +324,7 @@ H5F_get_nmounts(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->nmounts) } /* end H5F_get_nmounts() */ @@ -350,7 +343,7 @@ H5F_get_read_attempts(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->shared->read_attempts) } /* end H5F_get_read_attempts() */ @@ -370,8 +363,8 @@ H5F_get_fcpl(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->fcpl_id) } /* end H5F_get_fcpl() */ @@ -392,8 +385,8 @@ H5F_sizeof_addr(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->sizeof_addr) } /* end H5F_sizeof_addr() */ @@ -414,8 +407,8 @@ H5F_sizeof_size(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->sizeof_size) } /* H5F_sizeof_size() */ @@ -434,8 +427,8 @@ H5F_get_sohm_addr(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->sohm_addr) } /* end H5F_get_sohm_addr() */ @@ -454,8 +447,8 @@ H5F_get_sohm_vers(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->sohm_vers) } /* end H5F_get_sohm_vers() */ @@ -474,8 +467,8 @@ H5F_get_sohm_nindexes(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->sohm_nindexes) } /* end H5F_get_sohm_nindexes() */ @@ -498,9 +491,9 @@ H5F_sym_leaf_k(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->sblock); + assert(f); + assert(f->shared); + assert(f->shared->sblock); FUNC_LEAVE_NOAPI(f->shared->sblock->sym_leaf_k) } /* end H5F_sym_leaf_k() */ @@ -518,7 +511,7 @@ H5F_get_min_dset_ohdr(const H5F_t *f) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->shared->crt_dset_min_ohdr_flag) } /* end H5F_get_min_dset_ohdr */ @@ -541,10 +534,10 @@ H5F_Kvalue(const H5F_t *f, const H5B_class_t *type) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->sblock); - HDassert(type); + assert(f); + assert(f->shared); + assert(f->shared->sblock); + assert(type); FUNC_LEAVE_NOAPI(f->shared->sblock->btree_k[type->id]) } /* end H5F_Kvalue() */ @@ -563,8 +556,8 @@ H5F_get_nrefs(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->nrefs) } /* end H5F_get_nrefs() */ @@ -587,8 +580,8 @@ H5F_rdcc_nslots(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->rdcc_nslots) } /* end H5F_rdcc_nelmts() */ @@ -611,8 +604,8 @@ H5F_rdcc_nbytes(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->rdcc_nbytes) } /* end H5F_rdcc_nbytes() */ @@ -635,8 +628,8 @@ H5F_rdcc_w0(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->rdcc_w0) } /* end H5F_rdcc_w0() */ @@ -657,9 +650,9 @@ H5F_get_base_addr(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->sblock); + assert(f); + assert(f->shared); + assert(f->shared->sblock); FUNC_LEAVE_NOAPI(f->shared->sblock->base_addr) } /* end H5F_get_base_addr() */ @@ -682,8 +675,8 @@ H5F_grp_btree_shared(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->grp_btree_shared) } /* end H5F_grp_btree_shared() */ @@ -706,8 +699,8 @@ H5F_sieve_buf_size(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->sieve_buf_size) } /* end H5F_sieve_buf_size() */ @@ -722,9 +715,6 @@ H5F_sieve_buf_size(const H5F_t *f) * Return: Success: The "garbage collect references flag" is returned. * Failure: (should not happen) * - * Programmer: Quincey Koziol - * Jul 8 2005 - * *------------------------------------------------------------------------- */ unsigned @@ -733,8 +723,8 @@ H5F_gc_ref(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->gc_ref) } /* end H5F_gc_ref() */ @@ -754,8 +744,8 @@ H5F_get_fc_degree(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->fc_degree) } /* end H5F_get_fc_degree() */ @@ -777,8 +767,8 @@ H5F_get_evict_on_close(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->evict_on_close) } /* end H5F_get_evict_on_close() */ @@ -798,8 +788,8 @@ H5F_store_msg_crt_idx(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->store_msg_crt_idx) } /* end H5F_store_msg_crt_idx() */ @@ -819,7 +809,7 @@ H5F_shared_has_feature(const H5F_shared_t *f_sh, unsigned feature) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f_sh); + assert(f_sh); FUNC_LEAVE_NOAPI((hbool_t)(f_sh->lf->feature_flags & feature)) } /* end H5F_shared_has_feature() */ @@ -839,8 +829,8 @@ H5F_has_feature(const H5F_t *f, unsigned feature) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI((hbool_t)(f->shared->lf->feature_flags & feature)) } /* end H5F_has_feature() */ @@ -861,9 +851,9 @@ H5F_get_driver_id(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); + assert(f); + assert(f->shared); + assert(f->shared->lf); FUNC_LEAVE_NOAPI(f->shared->lf->driver_id) } /* end H5F_get_driver_id() */ @@ -885,14 +875,14 @@ H5F_get_fileno(const H5F_t *f, unsigned long *filenum) FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(filenum); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(filenum); /* Retrieve the file's serial number */ if (H5FD_get_fileno(f->shared->lf, filenum) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno") + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "can't retrieve fileno"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -913,11 +903,11 @@ H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type) FUNC_ENTER_NOAPI(HADDR_UNDEF) - HDassert(f_sh); + assert(f_sh); /* Dispatch to driver */ if (HADDR_UNDEF == (ret_value = H5FD_get_eoa(f_sh->lf, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -938,12 +928,12 @@ H5F_get_eoa(const H5F_t *f, H5FD_mem_t type) FUNC_ENTER_NOAPI(HADDR_UNDEF) - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Dispatch to driver */ if (HADDR_UNDEF == (ret_value = H5FD_get_eoa(f->shared->lf, type))) - HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "driver get_eoa request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -964,8 +954,8 @@ H5F_shared_get_file_driver(const H5F_shared_t *f_sh, H5FD_t **file_handle) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f_sh); - HDassert(file_handle); + assert(f_sh); + assert(file_handle); *file_handle = f_sh->lf; @@ -990,12 +980,12 @@ H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(file); - HDassert(file_handle); + assert(file); + assert(file_handle); /* Get the VFD handle */ if (H5FD_get_vfd_handle(file->shared->lf, fapl, file_handle) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file handle for file driver"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1018,10 +1008,10 @@ H5F_is_tmp_addr(const H5F_t *f, haddr_t addr) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); - FUNC_LEAVE_NOAPI(H5F_addr_le(f->shared->tmp_addr, addr)) + FUNC_LEAVE_NOAPI(H5_addr_le(f->shared->tmp_addr, addr)) } /* end H5F_is_tmp_addr() */ /*------------------------------------------------------------------------- @@ -1041,8 +1031,8 @@ H5F_use_tmp_space(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->use_tmp_space) } /* end H5F_use_tmp_space() */ @@ -1064,7 +1054,7 @@ H5F_coll_md_read(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->shared->coll_md_read) } /* end H5F_coll_md_read() */ @@ -1077,9 +1067,6 @@ H5F_coll_md_read(const H5F_t *f) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Houjun Tang - * May 19, 2022 - * *------------------------------------------------------------------------- */ herr_t @@ -1089,12 +1076,12 @@ H5F_shared_get_mpi_file_sync_required(const H5F_shared_t *f_sh, hbool_t *flag /* FUNC_ENTER_NOAPI(FAIL) - HDassert(f_sh); - HDassert(flag); + assert(f_sh); + assert(flag); /* Dispatch to driver */ if ((ret_value = H5FD_mpi_get_file_sync_required(f_sh->lf, flag)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver get_file_sync_required request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver get_file_sync_required request failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1118,8 +1105,8 @@ H5F_use_mdc_logging(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->use_mdc_logging) } /* end H5F_use_mdc_logging() */ @@ -1141,8 +1128,8 @@ H5F_start_mdc_log_on_access(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->start_mdc_log_on_access) } /* end H5F_start_mdc_log_on_access() */ @@ -1164,8 +1151,8 @@ H5F_mdc_log_location(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->mdc_log_location) } /* end H5F_mdc_log_location() */ @@ -1185,8 +1172,8 @@ H5F_get_alignment(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->alignment) } /* end H5F_get_alignment() */ @@ -1206,8 +1193,8 @@ H5F_get_threshold(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->threshold) } /* end H5F_get_threshold() */ @@ -1227,8 +1214,8 @@ H5F_get_pgend_meta_thres(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->pgend_meta_thres) } /* end H5F_get_pgend_meta_thres() */ @@ -1248,8 +1235,8 @@ H5F_get_point_of_no_return(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->point_of_no_return) } /* end H5F_get_point_of_no_return() */ @@ -1269,8 +1256,8 @@ H5F_get_null_fsm_addr(const H5F_t *f) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->null_fsm_addr) } /* end H5F_get_null_fsm_addr() */ @@ -1282,9 +1269,6 @@ H5F_get_null_fsm_addr(const H5F_t *f) * * Return: VOL class pointer for file, can't fail * - * Programmer: Quincey Koziol - * Saturday, August 17, 2019 - * *------------------------------------------------------------------------- */ const H5VL_class_t * @@ -1292,8 +1276,8 @@ H5F_get_vol_cls(const H5F_t *f) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->vol_cls) } /* end H5F_get_vol_cls */ @@ -1312,7 +1296,7 @@ H5F_get_vol_obj(const H5F_t *f) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); + assert(f); FUNC_LEAVE_NOAPI(f->vol_obj) } /* end H5F_get_vol_obj */ @@ -1325,9 +1309,6 @@ H5F_get_vol_obj(const H5F_t *f) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, August 17, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1338,12 +1319,12 @@ H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Verify structure version */ if (info->version != H5VL_CONTAINER_INFO_VERSION) - HGOTO_ERROR(H5E_FILE, H5E_VERSION, FAIL, "wrong container info version #") + HGOTO_ERROR(H5E_FILE, H5E_VERSION, FAIL, "wrong container info version #"); /* Set the container info fields */ info->feature_flags = 0; /* None currently defined */ @@ -1368,8 +1349,35 @@ H5F_get_file_locking(const H5F_t *f) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); FUNC_LEAVE_NOAPI(f->shared->use_file_locking) } /* end H5F_get_file_locking */ + +/*------------------------------------------------------------------------- + * Function: H5F_has_vector_select_io + * + * Purpose: Determine if vector or selection I/O is supported by this file + * + * Return: TRUE/FALSE + * + *------------------------------------------------------------------------- + */ +hbool_t +H5F_has_vector_select_io(const H5F_t *f, hbool_t is_write) +{ + hbool_t ret_value; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + assert(f); + assert(f->shared); + + if (is_write) + ret_value = (f->shared->lf->cls->write_vector != NULL || f->shared->lf->cls->write_selection != NULL); + else + ret_value = (f->shared->lf->cls->read_vector != NULL || f->shared->lf->cls->read_selection != NULL); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_has_vector_select_io */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fsfile.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fsfile.c index 6a565ca00c..ef80a799ca 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fsfile.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fsfile.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -36,7 +35,7 @@ typedef struct H5F_sfile_node_t { H5FL_DEFINE_STATIC(H5F_sfile_node_t); /* Declare a local variable to track the shared file information */ -H5F_sfile_node_t *H5F_sfile_head_g = NULL; +static H5F_sfile_node_t *H5F_sfile_head_s = NULL; /*------------------------------------------------------------------------- * Function: H5F_sfile_assert_num @@ -45,9 +44,6 @@ H5F_sfile_node_t *H5F_sfile_head_g = NULL; * * Return: void * - * Programmer: Quincey Koziol - * Monday, July 25, 2005 - * *------------------------------------------------------------------------- */ void @@ -57,14 +53,14 @@ H5F_sfile_assert_num(unsigned n) if (n == 0) { /* Sanity checking */ - HDassert(H5F_sfile_head_g == NULL); + assert(H5F_sfile_head_s == NULL); } /* end if */ else { unsigned count; /* Number of open shared files */ H5F_sfile_node_t *curr; /* Current shared file node */ /* Iterate through low-level files for matching low-level file info */ - curr = H5F_sfile_head_g; + curr = H5F_sfile_head_s; count = 0; while (curr) { /* Increment # of open shared file structs */ @@ -75,7 +71,7 @@ H5F_sfile_assert_num(unsigned n) } /* end while */ /* Sanity checking */ - HDassert(count == n); + assert(count == n); } /* end else */ FUNC_LEAVE_NOAPI_VOID @@ -88,9 +84,6 @@ H5F_sfile_assert_num(unsigned n) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, July 18, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -102,18 +95,18 @@ H5F__sfile_add(H5F_shared_t *shared) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(shared); + assert(shared); /* Allocate new shared file node */ if (NULL == (new_shared = H5FL_CALLOC(H5F_sfile_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Set shared file value */ new_shared->shared = shared; /* Prepend to list of shared files open */ - new_shared->next = H5F_sfile_head_g; - H5F_sfile_head_g = new_shared; + new_shared->next = H5F_sfile_head_s; + H5F_sfile_head_s = new_shared; done: FUNC_LEAVE_NOAPI(ret_value) @@ -127,9 +120,6 @@ H5F__sfile_add(H5F_shared_t *shared) * * Return: Non-NULL on success / NULL on failure * - * Programmer: Quincey Koziol - * Monday, July 18, 2005 - * *------------------------------------------------------------------------- */ H5F_shared_t * @@ -141,14 +131,14 @@ H5F__sfile_search(H5FD_t *lf) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(lf); + assert(lf); /* Iterate through low-level files for matching low-level file info */ - curr = H5F_sfile_head_g; + curr = H5F_sfile_head_s; while (curr) { /* Check for match */ if (0 == H5FD_cmp(curr->shared->lf, lf)) - HGOTO_DONE(curr->shared) + HGOTO_DONE(curr->shared); /* Advance to next shared file node */ curr = curr->next; @@ -165,9 +155,6 @@ H5F__sfile_search(H5FD_t *lf) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, July 18, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -180,11 +167,11 @@ H5F__sfile_remove(H5F_shared_t *shared) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(shared); + assert(shared); /* Locate shared file node with correct shared file */ last = NULL; - curr = H5F_sfile_head_g; + curr = H5F_sfile_head_s; while (curr && curr->shared != shared) { /* Advance to next node */ last = curr; @@ -193,7 +180,7 @@ H5F__sfile_remove(H5F_shared_t *shared) /* Indicate error if the node wasn't found */ if (curr == NULL) - HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info") + HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "can't find shared file info"); /* Remove node found from list */ if (last != NULL) @@ -201,7 +188,7 @@ H5F__sfile_remove(H5F_shared_t *shared) last->next = curr->next; else /* Removing head node in list */ - H5F_sfile_head_g = curr->next; + H5F_sfile_head_s = curr->next; /* Release the shared file node struct */ /* (the shared file info itself is freed elsewhere) */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fspace.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fspace.c index 29495f181c..163d8d8c48 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fspace.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fspace.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Fspace.c - * Dec 30 2013 - * Quincey Koziol * * Purpose: Space allocation routines for the file. * @@ -77,9 +74,6 @@ * Return: Success: The format address of the new file memory. * Failure: The undefined address HADDR_UNDEF * - * Programmer: Quincey Koziol - * Monday, December 30, 2013 - * *------------------------------------------------------------------------- */ haddr_t @@ -90,11 +84,11 @@ H5F__alloc(H5F_t *f, H5F_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t * FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); - HDassert(size > 0); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); + assert(size > 0); /* Check whether the file can use temporary addresses */ if (f->shared->use_tmp_space) { @@ -102,22 +96,22 @@ H5F__alloc(H5F_t *f, H5F_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t * /* Get the EOA for the file */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa"); /* Check for overlapping into file's temporary allocation space */ - if (H5F_addr_gt((eoa + size), f->shared->tmp_addr)) + if (H5_addr_gt((eoa + size), f->shared->tmp_addr)) HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, HADDR_UNDEF, - "'normal' file space allocation request will overlap into 'temporary' file space") + "'normal' file space allocation request will overlap into 'temporary' file space"); } /* end if */ /* Call the file driver 'alloc' routine */ ret_value = H5FD_alloc(f->shared->lf, type, f, size, frag_addr, frag_size); - if (!H5F_addr_defined(ret_value)) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, HADDR_UNDEF, "file driver 'alloc' request failed") + if (!H5_addr_defined(ret_value)) + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, HADDR_UNDEF, "file driver 'alloc' request failed"); /* Mark EOA dirty */ if (H5F_eoa_dirty(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, HADDR_UNDEF, "unable to mark EOA as dirty") + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, HADDR_UNDEF, "unable to mark EOA as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -136,9 +130,6 @@ H5F__alloc(H5F_t *f, H5F_mem_t type, hsize_t size, haddr_t *frag_addr, hsize_t * * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, December 30, 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -149,19 +140,19 @@ H5F__free(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); - HDassert(size > 0); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); + assert(size > 0); /* Call the file driver 'free' routine */ if (H5FD_free(f->shared->lf, type, f, addr, size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "file driver 'free' request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "file driver 'free' request failed"); /* Mark EOA dirty */ if (H5F_eoa_dirty(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark EOA as dirty") + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark EOA as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -180,9 +171,6 @@ H5F__free(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size) * FALSE(0) - Block could not be extended * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, 30 December, 2013 - * *------------------------------------------------------------------------- */ htri_t @@ -193,15 +181,15 @@ H5F__try_extend(H5F_t *f, H5FD_mem_t type, haddr_t blk_end, hsize_t extra_reques FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); - HDassert(extra_requested > 0); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); + assert(extra_requested > 0); /* Extend the object by extending the underlying file */ if ((ret_value = H5FD_try_extend(f->shared->lf, type, f, blk_end, extra_requested)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTEXTEND, FAIL, "driver try extend request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTEXTEND, FAIL, "driver try extend request failed"); /* H5FD_try_extend() updates driver message and marks the superblock * dirty, so no need to do it again here. diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fsuper.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fsuper.c index 824c7703ad..b381369ac0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fsuper.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fsuper.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -82,8 +81,6 @@ static const unsigned HDF5_superblock_ver_bounds[] = { * Return: Success: non-negative on success * Failure: Negative * - * Programmer: Vailin Choi; Feb 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -94,19 +91,19 @@ H5F__super_ext_create(H5F_t *f, H5O_loc_t *ext_ptr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->sblock); - HDassert(!H5F_addr_defined(f->shared->sblock->ext_addr)); - HDassert(ext_ptr); + assert(f); + assert(f->shared); + assert(f->shared->sblock); + assert(!H5_addr_defined(f->shared->sblock->ext_addr)); + assert(ext_ptr); /* Check for older version of superblock format that can't support superblock extensions */ if (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "superblock extension not permitted with version %u of superblock", - f->shared->sblock->super_vers) - else if (H5F_addr_defined(f->shared->sblock->ext_addr)) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "superblock extension already exists?!?!") + f->shared->sblock->super_vers); + else if (H5_addr_defined(f->shared->sblock->ext_addr)) + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "superblock extension already exists?!?!"); else { /* The superblock extension isn't actually a group, but the * default group creation list should work fine. @@ -118,7 +115,7 @@ H5F__super_ext_create(H5F_t *f, H5O_loc_t *ext_ptr) */ H5O_loc_reset(ext_ptr); if (H5O_create(f, (size_t)0, (size_t)1, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension"); /* Record the address of the superblock extension */ f->shared->sblock->ext_addr = ext_ptr->addr; @@ -136,8 +133,6 @@ H5F__super_ext_create(H5F_t *f, H5O_loc_t *ext_ptr) * Return: Success: non-negative on success * Failure: Negative * - * Programmer: Vailin Choi; Feb 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -148,9 +143,9 @@ H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(H5F_addr_defined(ext_addr)); - HDassert(ext_ptr); + assert(f); + assert(H5_addr_defined(ext_addr)); + assert(ext_ptr); /* Set up "fake" object location for superblock extension */ H5O_loc_reset(ext_ptr); @@ -159,7 +154,7 @@ H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) /* Open the superblock extension object header */ if (H5O_open(ext_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open superblock extension") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open superblock extension"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -173,8 +168,6 @@ H5F__super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr) * Return: Success: non-negative on success * Failure: Negative * - * Programmer: Vailin Choi; Feb 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -186,8 +179,8 @@ H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(ext_ptr); + assert(f); + assert(ext_ptr); /* Check if extension was created */ if (was_created) { @@ -196,7 +189,7 @@ H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created) /* Increment link count on superblock extension's object header */ if (H5O_link(ext_ptr, 1) < 0) - HGOTO_ERROR(H5E_FILE, H5E_LINKCOUNT, FAIL, "unable to increment hard link count") + HGOTO_ERROR(H5E_FILE, H5E_LINKCOUNT, FAIL, "unable to increment hard link count"); /* Decrement refcount on superblock extension's object header in memory */ if (H5O_dec_rc_by_loc(ext_ptr) < 0) @@ -206,7 +199,7 @@ H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created) /* Twiddle the number of open objects to avoid closing the file. */ f->nopen_objs++; if (H5O_close(ext_ptr, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close superblock extension"); f->nopen_objs--; done: @@ -230,9 +223,6 @@ H5F__super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hbool_t was_created) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 11/10/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -244,18 +234,17 @@ H5F__update_super_ext_driver_msg(H5F_t *f) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); sblock = f->shared->sblock; - HDassert(sblock); - HDassert(sblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(sblock->cache_info.type == H5AC_SUPERBLOCK); + assert(sblock); + assert(sblock->cache_info.type == H5AC_SUPERBLOCK); /* Update the driver information message in the superblock extension * if appropriate. */ if (sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2) { - if (H5F_addr_defined(sblock->ext_addr)) { + if (H5_addr_defined(sblock->ext_addr)) { /* Check for ignoring the driver info for this file */ if (!H5F_HAS_FEATURE(f, H5FD_FEAT_IGNORE_DRVRINFO)) { size_t driver_size; /* Size of driver info block (bytes)*/ @@ -272,11 +261,11 @@ H5F__update_super_ext_driver_msg(H5F_t *f) uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */ /* Sanity check */ - HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); + assert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); /* Encode driver-specific data */ if (H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information"); /* Write the message to the superblock extension. * @@ -288,7 +277,7 @@ H5F__update_super_ext_driver_msg(H5F_t *f) if (H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, - "unable to update driver info header message") + "unable to update driver info header message"); } /* end if driver_size > 0 */ } /* end if !H5F_HAS_FEATURE(f, H5FD_FEAT_IGNORE_DRVRINFO) */ } /* end if superblock extension exists */ @@ -309,9 +298,6 @@ H5F__update_super_ext_driver_msg(H5F_t *f) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Bill Wendling - * Sept 12, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -346,7 +332,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) #ifdef H5_HAVE_PARALLEL if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) if ((mpi_size = H5F_mpi_get_size(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size"); /* If we are an MPI application with at least two processes, the * following superblock signature location optimization is applicable. @@ -363,13 +349,13 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) int mpi_result; /* Sanity check */ - HDassert(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)); + assert(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)); /* Set up MPI info */ if ((mpi_rank = H5F_mpi_get_rank(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Can't get MPI rank") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Can't get MPI rank"); if (MPI_COMM_NULL == (this_comm = H5F_mpi_get_comm(f))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator"); /* Search for the file's signature only with rank 0 process */ if (0 == mpi_rank) { @@ -381,7 +367,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) { status = H5FD_locate_signature(file, &super_addr); } - H5E_END_TRY; + H5E_END_TRY /* Set superblock address to undefined on error */ if (status < 0) @@ -397,19 +383,19 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) #endif /* H5_HAVE_PARALLEL */ if (H5FD_locate_signature(file, &super_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature") + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature"); #ifdef H5_HAVE_PARALLEL } /* end else */ #endif /* H5_HAVE_PARALLEL */ - if (!H5F_addr_defined(super_addr)) - HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "file signature not found") + if (!H5_addr_defined(super_addr)) + HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "file signature not found"); /* Check for userblock present */ - if (H5F_addr_gt(super_addr, 0)) { + if (H5_addr_gt(super_addr, 0)) { /* Set the base address for the file in the VFD now */ if (H5F__set_base_addr(f, super_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "failed to set base address for file driver") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "failed to set base address for file driver"); } /* end if */ /* Determine file intent for superblock protect */ @@ -426,19 +412,19 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Get the shared file creation property list */ if (NULL == (c_plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "can't get property list"); /* Make certain we can read the fixed-size portion of the superblock */ if (H5F__set_eoa(f, H5FD_MEM_SUPER, (haddr_t)(H5F_SUPERBLOCK_FIXED_SIZE + H5F_SUPERBLOCK_MINIMAL_VARLEN_SIZE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "set end of space allocation request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "set end of space allocation request failed"); /* Set up the user data for cache callbacks */ udata.f = f; udata.ignore_drvrinfo = H5F_HAS_FEATURE(f, H5FD_FEAT_IGNORE_DRVRINFO); udata.sym_leaf_k = 0; if (H5P_get(c_plist, H5F_CRT_BTREE_RANK_NAME, udata.btree_k) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes"); udata.stored_eof = HADDR_UNDEF; udata.drvrinfo_removed = FALSE; @@ -447,7 +433,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Look up the superblock */ if (NULL == (sblock = (H5F_super_t *)H5AC_protect(f, H5AC_SUPERBLOCK, (haddr_t)0, &udata, rw_flags))) - HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock") + HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock"); /* * When opening a file with SWMR-write access, the library will first @@ -475,7 +461,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Check to ensure that superblock version 3 is used for SWMR-write access */ if (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) { if (sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version for SWMR is less than 3") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version for SWMR is less than 3"); } /* Upgrade low_bound to at least V18 when encountering version 2 superblock */ @@ -488,15 +474,15 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Version bounds check */ if (sblock->super_vers > HDF5_superblock_ver_bounds[f->shared->high_bound]) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version exceeds high bound") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version exceeds high bound"); /* Pin the superblock in the cache */ if (H5AC_pin_protected_entry(sblock) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTPIN, FAIL, "unable to pin superblock") + HGOTO_ERROR(H5E_FILE, H5E_CANTPIN, FAIL, "unable to pin superblock"); /* Mark the superblock dirty if it was modified during loading */ if (((rw_flags & H5AC__READ_ONLY_FLAG) == 0) && udata.ignore_drvrinfo && udata.drvrinfo_removed) { - HDassert(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2); + assert(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2); sblock_flags |= H5AC__DIRTIED_FLAG; } /* end if */ @@ -509,7 +495,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Check if superblock address is different from base address and adjust * base address and "end of file" address if so. */ - if (!H5F_addr_eq(super_addr, sblock->base_addr)) { + if (!H5_addr_eq(super_addr, sblock->base_addr)) { /* If the superblock moved in the file, adjust the EOF */ /* (Handles moving earlier & later) */ udata.stored_eof -= (sblock->base_addr - super_addr); @@ -519,7 +505,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Set the base address for the file in the VFD now */ if (H5F__set_base_addr(f, sblock->base_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "failed to set base address for file driver") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "failed to set base address for file driver"); /* Indicate that the superblock should be marked dirty */ if ((rw_flags & H5AC__READ_ONLY_FLAG) == 0) @@ -528,34 +514,34 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Set information in the file's creation property list */ if (H5P_set(c_plist, H5F_CRT_SUPER_VERS_NAME, &sblock->super_vers) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set superblock version") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set superblock version"); if (H5P_set(c_plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &sblock->sizeof_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set byte number in an address") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set byte number in an address"); if (H5P_set(c_plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &sblock->sizeof_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set byte number for object size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set byte number for object size"); /* Handle the B-tree 'K' values */ if (sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) { /* Sanity check */ - HDassert(udata.sym_leaf_k != 0); + assert(udata.sym_leaf_k != 0); /* Set the symbol table internal node 'K' value */ if (H5P_set(c_plist, H5F_CRT_SYM_LEAF_NAME, &udata.sym_leaf_k) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for symbol table leaf nodes") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for symbol table leaf nodes"); sblock->sym_leaf_k = udata.sym_leaf_k; /* Set the B-tree internal node values, etc */ if (H5P_set(c_plist, H5F_CRT_BTREE_RANK_NAME, udata.btree_k) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes"); H5MM_memcpy(sblock->btree_k, udata.btree_k, sizeof(unsigned) * (size_t)H5B_NUM_BTREE_ID); } /* end if */ else { /* Get the (default) B-tree internal node values, etc */ /* (Note: these may be reset in a superblock extension) */ if (H5P_get(c_plist, H5F_CRT_BTREE_RANK_NAME, sblock->btree_k) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes"); if (H5P_get(c_plist, H5F_CRT_SYM_LEAF_NAME, &sblock->sym_leaf_k) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes"); } /* end else */ /* @@ -563,28 +549,27 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * address. */ if (H5P_set(c_plist, H5F_CRT_USER_BLOCK_NAME, &sblock->base_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set userblock size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set userblock size"); /* * Make sure that the data is not truncated. One case where this is * possible is if the first file of a family of files was opened * individually. - */ - /* Can skip this test when it is not the initial file open-- - * H5F__super_read() call from H5F_evict_tagged_metadata() for - * refreshing object. + * + * Can skip this test when it is not the initial file open. + * * When flushing file buffers and fractal heap is involved, * the library will allocate actual space for tmp addresses * via the file layer. The aggregator allocates a block, * thus the eoa might be greater than eof. * Note: the aggregator is changed again after being reset * earlier before H5AC_flush due to allocation of tmp addresses. - */ - /* The EOF check must be skipped when the file is opened for SWMR read, + * + * The EOF check must be skipped when the file is opened for SWMR read, * as the file can appear truncated if only part of it has been * been flushed to disk by the SWMR writer process. - */ - /* The EOF check is also skipped when the private property + * + * The EOF check is also skipped when the private property * H5F_ACS_SKIP_EOF_CHECK_NAME exists in the fapl. * This property is enabled by the tool h5clear with these * two options: (1) --filesize (2) --increment @@ -593,7 +578,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Check if this private property exists in fapl */ if (H5P_exist_plist(fa_plist, H5F_ACS_SKIP_EOF_CHECK_NAME) > 0) if (H5P_get(fa_plist, H5F_ACS_SKIP_EOF_CHECK_NAME, &skip_eof_check) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get skip EOF check value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get skip EOF check value"); if (H5F_INTENT(f) & H5F_ACC_SWMR_READ) { /* @@ -605,18 +590,18 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) (sblock->status_flags & H5F_SUPER_WRITE_ACCESS) && sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3) skip_eof_check = TRUE; - } /* end if */ + } if (!skip_eof_check && initial_read) { if (HADDR_UNDEF == (eof = H5FD_get_eof(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to determine file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to determine file size"); /* (Account for the stored EOA being absolute offset -QAK) */ if ((eof + sblock->base_addr) < udata.stored_eof) HGOTO_ERROR(H5E_FILE, H5E_TRUNCATED, FAIL, "truncated file: eof = %llu, sblock->base_addr = %llu, stored_eof = %llu", (unsigned long long)eof, (unsigned long long)sblock->base_addr, - (unsigned long long)udata.stored_eof) - } /* end if */ + (unsigned long long)udata.stored_eof); + } /* * Tell the file driver how much address space has already been @@ -627,7 +612,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) H5AC_set_ring(H5AC_RING_SBE, NULL); /* Decode the optional driver information block */ - if (H5F_addr_defined(sblock->driver_addr)) { + if (H5_addr_defined(sblock->driver_addr)) { H5O_drvinfo_t *drvinfo; /* Driver info */ H5F_drvrinfo_cache_ud_t drvrinfo_udata; /* User data for metadata callbacks */ unsigned drvinfo_flags = H5AC__NO_FLAGS_SET; /* Flags used in driver info block unprotect call */ @@ -635,7 +620,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Sanity check - driver info block should only be defined for * superblock version < 2. */ - HDassert(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2); + assert(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2); /* Set up user data */ drvrinfo_udata.f = f; @@ -646,12 +631,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) */ if (H5FD_set_eoa(f->shared->lf, H5FD_MEM_SUPER, sblock->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE) < 0) /* will extend eoa later if required */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "set end of space allocation request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "set end of space allocation request failed"); /* Look up the driver info block */ if (NULL == (drvinfo = (H5O_drvinfo_t *)H5AC_protect(f, H5AC_DRVRINFO, sblock->driver_addr, &drvrinfo_udata, rw_flags))) - HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load driver info block") + HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load driver info block"); /* Loading the driver info block is enough to set up the right info */ @@ -666,7 +651,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Release the driver info block */ if (H5AC_unprotect(f, H5AC_DRVRINFO, sblock->driver_addr, drvinfo, drvinfo_flags) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to release driver info block") + HGOTO_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to release driver info block"); /* save a pointer to the driver information cache entry */ f->shared->drvinfo = drvinfo; @@ -674,10 +659,10 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* (Account for the stored EOA being absolute offset -NAF) */ if (H5F__set_eoa(f, H5FD_MEM_DEFAULT, udata.stored_eof - sblock->base_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set end-of-address marker for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set end-of-address marker for file"); /* Decode the optional superblock extension info */ - if (H5F_addr_defined(sblock->ext_addr)) { + if (H5_addr_defined(sblock->ext_addr)) { H5O_loc_t ext_loc; /* "Object location" for superblock extension */ H5O_btreek_t btreek; /* v1 B-tree 'K' value message from superblock extension */ H5O_drvinfo_t drvinfo; /* Driver info message from superblock extension */ @@ -689,60 +674,60 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) */ if (sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, - "invalid superblock - extension message should not be defined for version < 2") + "invalid superblock - extension message should not be defined for version < 2"); /* Check for superblock extension being located "outside" the stored * 'eoa' value, which can occur with the split/multi VFD. */ - if (H5F_addr_gt(sblock->ext_addr, udata.stored_eof)) { + if (H5_addr_gt(sblock->ext_addr, udata.stored_eof)) { /* Set the 'eoa' for the object header memory type large enough * to give some room for a reasonably sized superblock extension. * (This is _rather_ a kludge -QAK) */ if (H5F__set_eoa(f, H5FD_MEM_OHDR, (haddr_t)(sblock->ext_addr + 1024)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set end-of-address marker for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set end-of-address marker for file"); } /* end if */ /* Open the superblock extension */ if (H5F__super_ext_open(f, sblock->ext_addr, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension"); /* Check for the extension having a 'driver info' message */ if ((status = H5O_msg_exists(&ext_loc, H5O_DRVINFO_ID)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header"); if (status) { /* Check for ignoring the driver info for this file */ if (!udata.ignore_drvrinfo) { /* Retrieve the 'driver info' structure */ if (NULL == H5O_msg_read(&ext_loc, H5O_DRVINFO_ID, &drvinfo)) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver info message not present") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver info message not present"); /* Validate and decode driver information */ if (H5FD_sb_load(f->shared->lf, drvinfo.name, drvinfo.buf) < 0) { H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo); - HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "unable to decode driver information") + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "unable to decode driver information"); } /* end if */ /* Reset driver info message */ H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo); - HDassert(FALSE == f->shared->drvinfo_sb_msg_exists); + assert(FALSE == f->shared->drvinfo_sb_msg_exists); f->shared->drvinfo_sb_msg_exists = TRUE; } /* end else */ } /* end if */ /* Read in the shared OH message information if there is any */ if (H5SM_get_info(&ext_loc, c_plist) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to read SOHM table information") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to read SOHM table information"); /* Check for the extension having a 'v1 B-tree "K"' message */ if ((status = H5O_msg_exists(&ext_loc, H5O_BTREEK_ID)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header"); if (status) { /* Retrieve the 'v1 B-tree "K"' structure */ if (NULL == H5O_msg_read(&ext_loc, H5O_BTREEK_ID, &btreek)) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "v1 B-tree 'K' info message not present") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "v1 B-tree 'K' info message not present"); /* Set non-default v1 B-tree 'K' value info from file */ sblock->btree_k[H5B_CHUNK_ID] = btreek.btree_k[H5B_CHUNK_ID]; @@ -751,21 +736,21 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Set non-default v1 B-tree 'K' values in the property list */ if (H5P_set(c_plist, H5F_CRT_BTREE_RANK_NAME, btreek.btree_k) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes"); if (H5P_set(c_plist, H5F_CRT_SYM_LEAF_NAME, &btreek.sym_leaf_k) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for symbol table leaf nodes") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for symbol table leaf nodes"); } /* end if */ /* Check for the extension having a 'free-space manager info' message */ if ((status = H5O_msg_exists(&ext_loc, H5O_FSINFO_ID)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header"); if (status) { uint8_t flags; /* Message flags */ /* Get message flags */ if (H5O_msg_get_flags(&ext_loc, H5O_FSINFO_ID, &flags) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, - "unable to message flags for free-space manager info message") + "unable to message flags for free-space manager info message"); /* If message is NOT marked "unknown"--set up file space info */ if (!(flags & H5O_MSG_FLAG_WAS_UNKNOWN)) { @@ -778,16 +763,16 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if (H5P_exist_plist(fa_plist, H5F_ACS_NULL_FSM_ADDR_NAME) > 0) if (H5P_get(fa_plist, H5F_ACS_NULL_FSM_ADDR_NAME, &f->shared->null_fsm_addr) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, - "can't get clearance for persisting fsm addr") + "can't get clearance for persisting fsm addr"); /* Retrieve the 'file space info' structure */ if (NULL == H5O_msg_read(&ext_loc, H5O_FSINFO_ID, &fsinfo)) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free-space manager info message") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free-space manager info message"); /* Version bounds check */ if (H5O_fsinfo_check_version(H5F_HIGH_BOUND(f), &fsinfo) < 0) HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, - "File space info message's version out of bounds") + "File space info message's version out of bounds"); /* Update changed values */ if (f->shared->fs_version != fsinfo.version) @@ -797,31 +782,31 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Set non-default strategy in the property list */ if (H5P_set(c_plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &fsinfo.strategy) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy"); } /* end if */ if (f->shared->fs_persist != fsinfo.persist) { f->shared->fs_persist = fsinfo.persist; /* Set non-default strategy in the property list */ if (H5P_set(c_plist, H5F_CRT_FREE_SPACE_PERSIST_NAME, &fsinfo.persist) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy"); } /* end if */ if (f->shared->fs_threshold != fsinfo.threshold) { f->shared->fs_threshold = fsinfo.threshold; /* Set non-default threshold in the property list */ if (H5P_set(c_plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &fsinfo.threshold) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space strategy"); } /* end if */ - HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); - HDassert(fsinfo.page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); + assert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); + assert(fsinfo.page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); if (f->shared->fs_page_size != fsinfo.page_size) { f->shared->fs_page_size = fsinfo.page_size; /* Set file space page size in the property list */ if (H5P_set(c_plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, &fsinfo.page_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space page size") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file space page size"); } /* end if */ if (f->shared->pgend_meta_thres != fsinfo.pgend_meta_thres) /* Initialize page end meta threshold */ @@ -840,7 +825,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * option is used. */ if (!skip_eof_check && !f->shared->null_fsm_addr) - HDassert((!f->shared->fs_persist) || (f->shared->eoa_fsm_fsalloc != HADDR_UNDEF)); + assert((!f->shared->fs_persist) || (f->shared->eoa_fsm_fsalloc != HADDR_UNDEF)); /* * A crashed file with persistent free-space managers may have @@ -890,7 +875,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * be set -- verify that it is NULL, and then set it. * Set it back to NULL when we are done. */ - HDassert(f->shared->sblock == NULL); + assert(f->shared->sblock == NULL); f->shared->sblock = sblock; #endif /* JRM */ @@ -898,7 +883,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) if (H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, - "error in writing fsinfo message to superblock extension") + "error in writing fsinfo message to superblock extension"); } else { if (H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) { @@ -907,13 +892,13 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) #endif /* JRM */ HGOTO_ERROR(H5E_FILE, H5E_CANTDELETE, FAIL, - "error in removing message from superblock extension") + "error in removing message from superblock extension"); } if (H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, - "error in writing fsinfo message to superblock extension") + "error in writing fsinfo message to superblock extension"); } #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ f->shared->sblock = NULL; @@ -925,7 +910,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Check for the extension having a 'metadata cache image' message */ if ((status = H5O_msg_exists(&ext_loc, H5O_MDCI_MSG_ID)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_FILE, H5E_EXISTS, FAIL, "unable to read object header"); if (status) { hbool_t rw = ((rw_flags & H5AC__READ_ONLY_FLAG) == 0); H5O_mdci_t mdci_msg; @@ -944,7 +929,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Retrieve the 'metadata cache image message' structure */ if (NULL == H5O_msg_read(&ext_loc, H5O_MDCI_MSG_ID, &mdci_msg)) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache image message") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache image message"); /* Indicate to the cache that there's an image to load on first protect call */ if (H5AC_load_cache_image_on_next_protect(f, mdci_msg.addr, mdci_msg.size, rw) < 0) @@ -954,7 +939,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Close superblock extension */ if (H5F__super_ext_close(f, &ext_loc, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close file's superblock extension"); } /* end if */ /* Update the driver info if VFD indicated to do so */ @@ -962,7 +947,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * earlier in this routine. */ if (((rw_flags & H5AC__READ_ONLY_FLAG) == 0) && sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2 && - H5F_addr_defined(sblock->ext_addr)) { + H5_addr_defined(sblock->ext_addr)) { /* Check for modifying the driver info when opening the file */ if (H5F_HAS_FEATURE(f, H5FD_FEAT_DIRTY_DRVRINFO_LOAD)) { size_t driver_size; /* Size of driver info block (bytes) */ @@ -974,11 +959,11 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */ /* Sanity check */ - HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); + assert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); /* Encode driver-specific data */ if (H5FD_sb_encode(f->shared->lf, drvinfo.name, dbuf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information"); /* Set the driver info information for the superblock extension */ drvinfo.len = driver_size; @@ -993,12 +978,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * be set -- verify that it is NULL, and then set it. * Set it back to NULL when we are done. */ - HDassert(f->shared->sblock == NULL); + assert(f->shared->sblock == NULL); f->shared->sblock = sblock; #endif /* JRM */ if (H5F__super_ext_write_msg(f, H5O_DRVINFO_ID, &drvinfo, FALSE, H5O_MSG_NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, - "error in writing message to superblock extension") + "error in writing message to superblock extension"); #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ f->shared->sblock = NULL; @@ -1011,10 +996,10 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Remove the driver info message from the superblock extension */ if (H5F__super_ext_remove_msg(f, H5O_DRVINFO_ID) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, - "error in removing message from superblock extension") + "error in removing message from superblock extension"); /* Check if the superblock extension was removed */ - if (!H5F_addr_defined(sblock->ext_addr)) + if (!H5_addr_defined(sblock->ext_addr)) sblock_flags |= H5AC__DIRTIED_FLAG; } /* end if */ } /* end if */ @@ -1024,7 +1009,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Set the page aggregation mode */ if (H5F__set_paged_aggr(f, (hbool_t)H5F_PAGED_AGGR(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "failed to set paged_aggr status for file driver") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "failed to set paged_aggr status for file driver"); done: /* Reset the ring in the API context */ @@ -1033,7 +1018,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Release the superblock */ if (sblock && H5AC_unprotect(f, H5AC_SUPERBLOCK, (haddr_t)0, sblock, sblock_flags) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock") + HDONE_ERROR(H5E_FILE, H5E_CANTUNPROTECT, FAIL, "unable to close superblock"); /* If we have failed, make sure no entries are left in the * metadata cache, so that it can be shut down and discarded. @@ -1042,22 +1027,26 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Unpin and discard drvinfo cache entry */ if (f->shared->drvinfo) { if (H5AC_unpin_entry(f->shared->drvinfo) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin driver info") + HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin driver info"); /* Evict the driver info block from the cache */ - if (sblock && H5AC_expunge_entry(f, H5AC_DRVRINFO, sblock->driver_addr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge driver info block") + if (sblock) { + if (H5AC_expunge_entry(f, H5AC_DRVRINFO, sblock->driver_addr, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge driver info block"); + f->shared->drvinfo = NULL; + } } /* end if */ /* Unpin & discard superblock */ if (sblock) { /* Unpin superblock in cache */ if (H5AC_unpin_entry(sblock) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock") + HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock"); /* Evict the superblock from the cache */ if (H5AC_expunge_entry(f, H5AC_SUPERBLOCK, (haddr_t)0, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge superblock") + HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge superblock"); + f->shared->sblock = NULL; } /* end if */ } /* end if */ @@ -1074,9 +1063,6 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * Sept 15, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1103,7 +1089,7 @@ H5F__super_init(H5F_t *f) /* Allocate space for the superblock */ if (NULL == (sblock = H5FL_CALLOC(H5F_super_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize various address information */ sblock->base_addr = HADDR_UNDEF; @@ -1113,15 +1099,15 @@ H5F__super_init(H5F_t *f) /* Get the shared file creation property list */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Initialize sym_leaf_k */ if (H5P_get(plist, H5F_CRT_SYM_LEAF_NAME, &sblock->sym_leaf_k) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for object size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for object size"); /* Initialize btree_k */ if (H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &sblock->btree_k[0]) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes"); /* Check for non-default free-space settings */ if (!(f->shared->fs_strategy == H5F_FILE_SPACE_STRATEGY_DEF && @@ -1189,20 +1175,20 @@ H5F__super_init(H5F_t *f) /* Version bounds check */ if (super_vers > HDF5_superblock_ver_bounds[f->shared->high_bound]) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version out of bounds") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "superblock version out of bounds"); /* If a newer superblock version is required, set it here */ if (super_vers != HDF5_SUPERBLOCK_VERSION_DEF) { H5P_genplist_t *c_plist; /* Property list */ if (NULL == (c_plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property list"); if (H5P_set(c_plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set superblock version") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set superblock version"); } /* end if */ if (H5FD_set_paged_aggr(f->shared->lf, (hbool_t)H5F_PAGED_AGGR(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to set paged_aggr status for file driver") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to set paged_aggr status for file driver"); /* * The superblock starts immediately after the user-defined @@ -1211,7 +1197,7 @@ H5F__super_init(H5F_t *f) * now. */ if (H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get userblock size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get userblock size"); /* Sanity check the userblock size vs. the file's allocation alignment */ if (userblock_size > 0) { @@ -1219,10 +1205,10 @@ H5F__super_init(H5F_t *f) hsize_t alignment = H5F_PAGED_AGGR(f) ? f->shared->fs_page_size : f->shared->alignment; if (userblock_size < alignment) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be > file object alignment") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "userblock size must be > file object alignment"); if (0 != (userblock_size % alignment)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, - "userblock size must be an integral multiple of file object alignment") + "userblock size must be an integral multiple of file object alignment"); } /* end if */ sblock->base_addr = userblock_size; @@ -1230,13 +1216,13 @@ H5F__super_init(H5F_t *f) /* Reserve space for the userblock */ if (H5F__set_eoa(f, H5FD_MEM_SUPER, userblock_size) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for userblock") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to set EOA value for userblock"); /* Set the base address for the file in the VFD now, after allocating * space for userblock. */ if (H5F__set_base_addr(f, sblock->base_addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to set base address for file driver") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "failed to set base address for file driver"); /* Save a local copy of the superblock version number, size of addresses & offsets */ sblock->super_vers = super_vers; @@ -1283,7 +1269,7 @@ H5F__super_init(H5F_t *f) /* Insert superblock into cache, pinned */ if (H5AC_insert_entry(f, H5AC_SUPERBLOCK, (haddr_t)0, sblock, H5AC__PIN_ENTRY_FLAG | H5AC__FLUSH_LAST_FLAG | H5AC__FLUSH_COLLECTIVELY_FLAG) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add superblock to cache") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "can't add superblock to cache"); sblock_in_cache = TRUE; /* Keep a copy of the superblock info */ @@ -1291,7 +1277,7 @@ H5F__super_init(H5F_t *f) /* Allocate space for the superblock */ if (HADDR_UNDEF == H5MF_alloc(f, H5FD_MEM_SUPER, superblock_size)) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for superblock") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for superblock"); /* set the drvinfo filed to NULL -- will overwrite this later if needed */ f->shared->drvinfo = NULL; @@ -1302,12 +1288,12 @@ H5F__super_init(H5F_t *f) /* Files with SOHM indices always need the superblock extension */ if (f->shared->sohm_nindexes > 0) { - HDassert(super_vers >= HDF5_SUPERBLOCK_VERSION_2); + assert(super_vers >= HDF5_SUPERBLOCK_VERSION_2); need_ext = TRUE; } /* end if */ /* Files with non-default free space settings always need the superblock extension */ else if (non_default_fs_settings) { - HDassert(super_vers >= HDF5_SUPERBLOCK_VERSION_2); + assert(super_vers >= HDF5_SUPERBLOCK_VERSION_2); need_ext = TRUE; } /* end if */ /* If we're going to use a version of the superblock format which allows @@ -1343,7 +1329,7 @@ H5F__super_init(H5F_t *f) * extension. */ if (H5F__super_ext_create(f, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create superblock extension"); ext_created = TRUE; /* Create the Shared Object Header Message table and register it with @@ -1352,7 +1338,7 @@ H5F__super_init(H5F_t *f) if (f->shared->sohm_nindexes > 0) { /* Initialize the shared message code & write the SOHM message to the extension */ if (H5SM_init(f, plist, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create SOHM table") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to create SOHM table"); } /* Check for non-default v1 B-tree 'K' values to store */ @@ -1368,7 +1354,7 @@ H5F__super_init(H5F_t *f) if (H5O_msg_create(&ext_loc, H5O_BTREEK_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &btreek) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, - "unable to update v1 B-tree 'K' value header message") + "unable to update v1 B-tree 'K' value header message"); } /* end if */ /* Check for driver info to store */ @@ -1377,20 +1363,20 @@ H5F__super_init(H5F_t *f) uint8_t dbuf[H5F_MAX_DRVINFOBLOCK_SIZE]; /* Driver info block encoding buffer */ /* Sanity check */ - HDassert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); + assert(driver_size <= H5F_MAX_DRVINFOBLOCK_SIZE); /* Encode driver-specific data */ - HDmemset(dbuf, 0, sizeof(dbuf)); + memset(dbuf, 0, sizeof(dbuf)); if (H5FD_sb_encode(f->shared->lf, info.name, dbuf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information"); /* Write driver info information to the superblock extension */ info.len = driver_size; info.buf = dbuf; if (H5O_msg_create(&ext_loc, H5O_DRVINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update driver info header message"); - HDassert(FALSE == f->shared->drvinfo_sb_msg_exists); + assert(FALSE == f->shared->drvinfo_sb_msg_exists); f->shared->drvinfo_sb_msg_exists = TRUE; } /* end if */ @@ -1410,7 +1396,7 @@ H5F__super_init(H5F_t *f) /* Set the version for the fsinfo message */ if (H5O_fsinfo_set_version(H5F_LOW_BOUND(f), H5F_HIGH_BOUND(f), &fsinfo) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo"); f->shared->fs_version = fsinfo.version; for (ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) @@ -1418,18 +1404,19 @@ H5F__super_init(H5F_t *f) if (H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE | H5O_MSG_FLAG_MARK_IF_UNKNOWN, H5O_UPDATE_TIME, &fsinfo) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update free-space info header message") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update free-space info header message"); } /* end if */ } /* end if */ else { /* Check for creating an "old-style" driver info block */ if (driver_size > 0) { /* Sanity check */ - HDassert(H5F_addr_defined(sblock->driver_addr)); + assert(H5_addr_defined(sblock->driver_addr)); /* Allocate space for the driver info */ if (NULL == (drvinfo = (H5O_drvinfo_t *)H5MM_calloc(sizeof(H5O_drvinfo_t)))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "memory allocation failed for driver info message") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, + "memory allocation failed for driver info message"); /* Set up driver info message */ /* (NOTE: All the actual information (name & driver information) is @@ -1443,12 +1430,12 @@ H5F__super_init(H5F_t *f) if (H5AC_insert_entry(f, H5AC_DRVRINFO, sblock->driver_addr, drvinfo, H5AC__PIN_ENTRY_FLAG | H5AC__FLUSH_LAST_FLAG | H5AC__FLUSH_COLLECTIVELY_FLAG) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINS, FAIL, "can't add driver info block to cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTINS, FAIL, "can't add driver info block to cache"); drvinfo_in_cache = TRUE; f->shared->drvinfo = drvinfo; } /* end if */ else - HDassert(!H5F_addr_defined(sblock->driver_addr)); + assert(!H5_addr_defined(sblock->driver_addr)); } /* end if */ done: @@ -1458,7 +1445,7 @@ H5F__super_init(H5F_t *f) /* Close superblock extension, if it was created */ if (ext_created && H5F__super_ext_close(f, &ext_loc, ext_created) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension"); /* Cleanup on failure */ if (ret_value < 0) { @@ -1468,11 +1455,11 @@ H5F__super_init(H5F_t *f) if (drvinfo_in_cache) { /* Unpin drvinfo in cache */ if (H5AC_unpin_entry(drvinfo) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin driver info") + HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin driver info"); /* Evict the driver info block from the cache */ if (H5AC_expunge_entry(f, H5AC_DRVRINFO, sblock->driver_addr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge driver info block") + HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge driver info block"); } /* end if */ else /* Free driver info block */ @@ -1485,16 +1472,16 @@ H5F__super_init(H5F_t *f) if (sblock_in_cache) { /* Unpin superblock in cache */ if (H5AC_unpin_entry(sblock) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock") + HDONE_ERROR(H5E_FILE, H5E_CANTUNPIN, FAIL, "unable to unpin superblock"); /* Evict the superblock from the cache */ if (H5AC_expunge_entry(f, H5AC_SUPERBLOCK, (haddr_t)0, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge superblock") + HDONE_ERROR(H5E_FILE, H5E_CANTEXPUNGE, FAIL, "unable to expunge superblock"); } /* end if */ else /* Free superblock */ if (H5F__super_free(sblock) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to destroy superblock") + HDONE_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to destroy superblock"); /* Reset variables in file structure */ f->shared->sblock = NULL; @@ -1512,9 +1499,6 @@ H5F__super_init(H5F_t *f) * Return: Success: non-negative on success * Failure: Negative * - * Programmer: Quincey Koziol - * January 4, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -1525,13 +1509,13 @@ H5F_eoa_dirty(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->sblock); + assert(f); + assert(f->shared); + assert(f->shared->sblock); /* Mark superblock dirty in cache, so change to EOA will get encoded */ if (H5F_super_dirty(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty"); /* If the driver information block exists, mark it dirty as well * so that the change in eoa will be reflected there as well if @@ -1539,12 +1523,12 @@ H5F_eoa_dirty(H5F_t *f) */ if (f->shared->drvinfo) { if (H5AC_mark_entry_dirty(f->shared->drvinfo) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo as dirty") + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo as dirty"); } /* end if */ /* If the driver info is stored as a message, update that instead */ else if (f->shared->drvinfo_sb_msg_exists) { if (H5F__update_super_ext_driver_msg(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo message as dirty") + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark drvinfo message as dirty"); } done: @@ -1559,9 +1543,6 @@ H5F_eoa_dirty(H5F_t *f) * Return: Success: non-negative on success * Failure: Negative * - * Programmer: Quincey Koziol - * August 14, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -1572,13 +1553,13 @@ H5F_super_dirty(H5F_t *f) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->sblock); + assert(f); + assert(f->shared); + assert(f->shared->sblock); /* Mark superblock dirty in cache, so change to EOA will get encoded */ if (H5AC_mark_entry_dirty(f->shared->sblock) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1592,9 +1573,6 @@ H5F_super_dirty(H5F_t *f) * Return: Success: non-negative on success * Failure: Negative * - * Programmer: Quincey Koziol - * April 1, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -1603,7 +1581,7 @@ H5F__super_free(H5F_super_t *sblock) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(sblock); + assert(sblock); /* Free root group symbol table entry, if any */ sblock->root_ent = (H5G_entry_t *)H5MM_xfree(sblock->root_ent); @@ -1622,9 +1600,6 @@ H5F__super_free(H5F_super_t *sblock) * Return: Success: non-negative on success * Failure: Negative * - * Programmer: Vailin Choi - * July 11, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1636,9 +1611,9 @@ H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_size) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->sblock); + assert(f); + assert(f->shared); + assert(f->shared->sblock); /* Set the superblock size */ if (super_size) @@ -1646,7 +1621,7 @@ H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_size) /* Set the superblock extension size */ if (super_ext_size) { - if (H5F_addr_defined(f->shared->sblock->ext_addr)) { + if (H5_addr_defined(f->shared->sblock->ext_addr)) { H5O_loc_t ext_loc; /* "Object location" for superblock extension */ H5O_hdr_info_t hdr_info; /* Object info for superblock extension */ @@ -1660,7 +1635,7 @@ H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_size) /* Get object header info for superblock extension */ if (H5O_get_hdr_info(&ext_loc, &hdr_info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info"); /* Set the superblock extension size */ *super_ext_size = hdr_info.space.total; @@ -1685,8 +1660,6 @@ H5F__super_size(H5F_t *f, hsize_t *super_size, hsize_t *super_ext_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Feb 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -1702,48 +1675,48 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->sblock); + assert(f); + assert(f->shared); + assert(f->shared->sblock); /* Set the ring type in the API context */ H5AC_set_ring(H5AC_RING_SBE, &orig_ring); /* Open/create the superblock extension object header */ - if (H5F_addr_defined(f->shared->sblock->ext_addr)) { + if (H5_addr_defined(f->shared->sblock->ext_addr)) { if (H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open file's superblock extension"); } /* end if */ else { - HDassert(may_create); + assert(may_create); if (H5F__super_ext_create(f, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, FAIL, "unable to create file's superblock extension"); ext_created = TRUE; } /* end else */ - HDassert(H5F_addr_defined(ext_loc.addr)); + assert(H5_addr_defined(ext_loc.addr)); ext_opened = TRUE; /* Check if message with ID does not exist in the object header */ if ((status = H5O_msg_exists(&ext_loc, id)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, - "unable to check object header for message or message exists") + "unable to check object header for message or message exists"); /* Check for creating vs. writing */ if (may_create) { if (status) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should not exist"); /* Create the message with ID in the superblock extension */ if (H5O_msg_create(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to create the message in object header"); } /* end if */ else { if (!status) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "Message should exist"); /* Update the message with ID in the superblock extension */ if (H5O_msg_write(&ext_loc, id, (mesg_flags | H5O_MSG_FLAG_DONTSHARE), H5O_UPDATE_TIME, mesg) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to write the message in object header"); } /* end else */ done: @@ -1753,11 +1726,11 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, /* Close the superblock extension, if it was opened */ if (ext_opened && H5F__super_ext_close(f, &ext_loc, ext_created) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension"); /* Mark superblock dirty in cache, if superblock extension was created */ if (ext_created && H5AC_mark_entry_dirty(f->shared->sblock) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty"); FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_write_msg() */ @@ -1769,8 +1742,6 @@ H5F__super_ext_write_msg(H5F_t *f, unsigned id, void *mesg, hbool_t may_create, * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Feb 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -1786,39 +1757,39 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id) FUNC_ENTER_PACKAGE /* Make sure that the superblock extension object header exists */ - HDassert(H5F_addr_defined(f->shared->sblock->ext_addr)); + assert(H5_addr_defined(f->shared->sblock->ext_addr)); /* Set the ring type in the API context */ H5AC_set_ring(H5AC_RING_SBE, &orig_ring); /* Open superblock extension object header */ if (H5F__super_ext_open(f, f->shared->sblock->ext_addr, &ext_loc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "error in starting file's superblock extension"); ext_opened = TRUE; /* Check if message with ID exists in the object header */ if ((status = H5O_msg_exists(&ext_loc, id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check object header for message"); else if (status) { /* message exists */ H5O_hdr_info_t hdr_info; /* Object header info for superblock extension */ /* Remove the message */ if (H5O_msg_remove(&ext_loc, id, H5O_ALL, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete free-space manager info message"); /* Get info for the superblock extension's object header */ if (H5O_get_hdr_info(&ext_loc, &hdr_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info"); /* If the object header is an empty base chunk, remove superblock extension */ if (hdr_info.nchunks == 1) { if ((null_count = H5O_msg_count(&ext_loc, H5O_NULL_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages"); else if ((unsigned)null_count == hdr_info.nmesgs) { - HDassert(H5F_addr_defined(ext_loc.addr)); + assert(H5_addr_defined(ext_loc.addr)); if (H5O_delete(f, ext_loc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count messages"); f->shared->sblock->ext_addr = HADDR_UNDEF; } /* end else-if */ } /* end if */ @@ -1831,7 +1802,7 @@ H5F__super_ext_remove_msg(H5F_t *f, unsigned id) /* Close superblock extension object header, if opened */ if (ext_opened && H5F__super_ext_close(f, &ext_loc, FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension") + HDONE_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to close file's superblock extension"); FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_remove_msg() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Fsuper_cache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Fsuper_cache.c index ce39f197d5..0e4b02ad41 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Fsuper_cache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Fsuper_cache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5Fsuper_cache.c - * Aug 15 2009 - * Quincey Koziol * - * Purpose: Implement file superblock & driver info metadata cache methods. + * Purpose: Implement file superblock & driver info metadata cache methods * *------------------------------------------------------------------------- */ @@ -77,10 +74,10 @@ static herr_t H5F__cache_drvrinfo_serialize(const H5F_t *f, void *image, size_t static herr_t H5F__cache_drvrinfo_free_icr(void *thing); /* Local encode/decode routines */ -static herr_t H5F__superblock_prefix_decode(H5F_super_t *sblock, const uint8_t **image_ref, +static herr_t H5F__superblock_prefix_decode(H5F_super_t *sblock, const uint8_t **image_ref, size_t len, const H5F_superblock_cache_ud_t *udata, hbool_t extend_eoa); static herr_t H5F__drvrinfo_prefix_decode(H5O_drvinfo_t *drvinfo, char *drv_name, const uint8_t **image_ref, - H5F_drvrinfo_cache_ud_t *udata, hbool_t extend_eoa); + size_t len, H5F_drvrinfo_cache_ud_t *udata, hbool_t extend_eoa); /*********************/ /* Package Variables */ @@ -136,59 +133,65 @@ H5FL_EXTERN(H5F_super_t); /*------------------------------------------------------------------------- * Function: H5F__superblock_prefix_decode * - * Purpose: Decode a superblock prefix - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * December 15, 2016 + * Purpose: Decode a superblock prefix * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5F__superblock_prefix_decode(H5F_super_t *sblock, const uint8_t **image_ref, +H5F__superblock_prefix_decode(H5F_super_t *sblock, const uint8_t **image_ref, size_t len, const H5F_superblock_cache_ud_t *udata, hbool_t extend_eoa) { const uint8_t *image = (const uint8_t *)*image_ref; /* Pointer into raw data buffer */ - htri_t ret_value = SUCCEED; /* Return value */ + const uint8_t *end = image + len - 1; /* Pointer to end of buffer */ + htri_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(sblock); - HDassert(image_ref); - HDassert(image); - HDassert(udata); - HDassert(udata->f); + assert(sblock); + assert(image_ref); + assert(image); + assert(udata); + assert(udata->f); /* Skip over signature (already checked when locating the superblock) */ + if (H5_IS_BUFFER_OVERFLOW(image, H5F_SIGNATURE_LEN, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); image += H5F_SIGNATURE_LEN; /* Superblock version */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); sblock->super_vers = *image++; if (sblock->super_vers > HDF5_SUPERBLOCK_VERSION_LATEST) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad superblock version number") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad superblock version number"); - /* Sanity check */ - HDassert(((size_t)(image - (const uint8_t *)*image_ref)) == H5F_SUPERBLOCK_FIXED_SIZE); + /* Size check */ + if (((size_t)(image - (const uint8_t *)*image_ref)) != H5F_SUPERBLOCK_FIXED_SIZE) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad superblock (fixed) size"); /* Determine the size of addresses & size of offsets, for computing the * variable-sized portion of the superblock. */ if (sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) { + if (H5_IS_BUFFER_OVERFLOW(image, 6, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); sblock->sizeof_addr = image[4]; sblock->sizeof_size = image[5]; - } /* end if */ + } else { + if (H5_IS_BUFFER_OVERFLOW(image, 2, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); sblock->sizeof_addr = image[0]; sblock->sizeof_size = image[1]; - } /* end else */ + } + if (sblock->sizeof_addr != 2 && sblock->sizeof_addr != 4 && sblock->sizeof_addr != 8 && sblock->sizeof_addr != 16 && sblock->sizeof_addr != 32) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad byte number in an address") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad byte number in an address"); if (sblock->sizeof_size != 2 && sblock->sizeof_size != 4 && sblock->sizeof_size != 8 && sblock->sizeof_size != 16 && sblock->sizeof_size != 32) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad byte number for object size") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad byte number for object size"); /* Check for extending the EOA for the file */ if (extend_eoa) { @@ -197,12 +200,13 @@ H5F__superblock_prefix_decode(H5F_super_t *sblock, const uint8_t **image_ref, /* Determine the size of the variable-length part of the superblock */ variable_size = (size_t)H5F_SUPERBLOCK_VARLEN_SIZE(sblock->super_vers, sblock->sizeof_addr, sblock->sizeof_size); - HDassert(variable_size > 0); + if (variable_size == 0) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "variable size can't be zero"); /* Make certain we can read the variable-sized portion of the superblock */ if (H5F__set_eoa(udata->f, H5FD_MEM_SUPER, (haddr_t)(H5F_SUPERBLOCK_FIXED_SIZE + variable_size)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "set end of space allocation request failed") - } /* end if */ + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "set end of space allocation request failed"); + } /* Update the image buffer pointer */ *image_ref = image; @@ -212,50 +216,55 @@ H5F__superblock_prefix_decode(H5F_super_t *sblock, const uint8_t **image_ref, } /* end H5F__superblock_prefix_decode() */ /*------------------------------------------------------------------------- - * Function: H5F__drvrinfo_prefix_decode - * - * Purpose: Decode a driver info prefix - * - * Return: Non-negative on success/Negative on failure + * Function: H5F__drvrinfo_prefix_decode * - * Programmer: Quincey Koziol - * December 15, 2016 + * Purpose: Decode a driver info prefix * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5F__drvrinfo_prefix_decode(H5O_drvinfo_t *drvrinfo, char *drv_name, const uint8_t **image_ref, +H5F__drvrinfo_prefix_decode(H5O_drvinfo_t *drvrinfo, char *drv_name, const uint8_t **image_ref, size_t len, H5F_drvrinfo_cache_ud_t *udata, hbool_t extend_eoa) { const uint8_t *image = (const uint8_t *)*image_ref; /* Pointer into raw data buffer */ + const uint8_t *end = image + len - 1; /* Pointer to end of buffer */ unsigned drv_vers; /* Version of driver info block */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(drvrinfo); - HDassert(image_ref); - HDassert(image); - HDassert(udata); - HDassert(udata->f); + assert(drvrinfo); + assert(image_ref); + assert(image); + assert(udata); + assert(udata->f); /* Version number */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); drv_vers = *image++; if (drv_vers != HDF5_DRIVERINFO_VERSION_0) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad driver information block version number") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "bad driver information block version number"); - image += 3; /* reserved bytes */ + /* Reserved bytes */ + if (H5_IS_BUFFER_OVERFLOW(image, 3, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + image += 3; /* Driver info size */ + if (H5_IS_BUFFER_OVERFLOW(image, 4, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT32DECODE(image, drvrinfo->len); /* Driver name and/or version */ if (drv_name) { + if (H5_IS_BUFFER_OVERFLOW(image, 8, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); H5MM_memcpy(drv_name, (const char *)image, (size_t)8); drv_name[8] = '\0'; image += 8; /* advance past name/version */ - } /* end if */ + } /* Extend the EOA if required so that we can read the complete driver info block */ if (extend_eoa) { @@ -264,17 +273,17 @@ H5F__drvrinfo_prefix_decode(H5O_drvinfo_t *drvrinfo, char *drv_name, const uint8 /* Get current EOA... */ eoa = H5FD_get_eoa(udata->f->shared->lf, H5FD_MEM_SUPER); - if (!H5F_addr_defined(eoa)) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + if (!H5_addr_defined(eoa)) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver get_eoa request failed"); /* ... if it is too small, extend it. */ min_eoa = udata->driver_addr + H5F_DRVINFOBLOCK_HDR_SIZE + drvrinfo->len; /* If it grew, set it */ - if (H5F_addr_gt(min_eoa, eoa)) + if (H5_addr_gt(min_eoa, eoa)) if (H5FD_set_eoa(udata->f->shared->lf, H5FD_MEM_SUPER, min_eoa) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "set end of space allocation request failed") - } /* end if */ + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "set end of space allocation request failed"); + } /* Update the image buffer pointer */ *image_ref = image; @@ -286,13 +295,9 @@ H5F__drvrinfo_prefix_decode(H5O_drvinfo_t *drvrinfo, char *drv_name, const uint8 /*------------------------------------------------------------------------- * Function: H5F__cache_superblock_get_initial_load_size * - * Purpose: Compute the size of the data structure on disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * July 17, 2013 + * Purpose: Compute the size of the data structure on disk * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -300,8 +305,7 @@ H5F__cache_superblock_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t { FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(image_len); + assert(image_len); /* Set the initial image length size */ *image_len = H5F_SUPERBLOCK_FIXED_SIZE + /* Fixed size of superblock */ @@ -313,36 +317,31 @@ H5F__cache_superblock_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t /*------------------------------------------------------------------------- * Function: H5F__cache_superblock_get_final_load_size * - * Purpose: Compute the final size of the data structure on disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * November 17, 2016 + * Purpose: Compute the final size of the data structure on disk * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5F__cache_superblock_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, - void *_udata, size_t *actual_len) +H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len, void *_udata, + size_t *actual_len) { const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ H5F_super_t sblock; /* Temporary file superblock */ - htri_t ret_value = SUCCEED; /* Return value */ + htri_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(image); - HDassert(udata); - HDassert(actual_len); - HDassert(*actual_len == image_len); - HDassert(image_len >= H5F_SUPERBLOCK_FIXED_SIZE + 6); + assert(image); + assert(udata); + assert(actual_len); + assert(*actual_len == image_len); + assert(image_len >= H5F_SUPERBLOCK_FIXED_SIZE + 6); /* Deserialize the file superblock's prefix */ - if (H5F__superblock_prefix_decode(&sblock, &image, udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't decode file superblock prefix") + if (H5F__superblock_prefix_decode(&sblock, &image, image_len, udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't decode file superblock prefix"); /* Save the version to be used in verify_chksum callback */ udata->super_vers = sblock.super_vers; @@ -358,14 +357,11 @@ H5F__cache_superblock_get_final_load_size(const void *_image, size_t H5_ATTR_NDE /*------------------------------------------------------------------------- * Function: H5F__cache_superblock_verify_chksum * - * Purpose: Verify the computed checksum of the data structure is the - * same as the stored chksum. - * - * Return: Success: TRUE/FALSE - * Failure: Negative - * - * Programmer: Vailin Choi; Aug 2015 + * Purpose: Verify the computed checksum of the data structure is the + * same as the stored chksum. * + * Return: Success: TRUE/FALSE + * Failure: Negative *------------------------------------------------------------------------- */ static htri_t @@ -373,15 +369,14 @@ H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata { const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ - uint32_t stored_chksum; /* Stored metadata checksum value */ - uint32_t computed_chksum; /* Computed metadata checksum value */ - htri_t ret_value = TRUE; /* Return value */ + uint32_t stored_chksum; /* Stored metadata checksum value */ + uint32_t computed_chksum; /* Computed metadata checksum value */ + htri_t ret_value = TRUE; FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); /* No checksum for version 0 & 1 */ if (udata->super_vers >= HDF5_SUPERBLOCK_VERSION_2) { @@ -391,48 +386,43 @@ H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata if (stored_chksum != computed_chksum) ret_value = FALSE; - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__cache_superblock_verify_chksum() */ /*------------------------------------------------------------------------- - * Function: H5F__cache_superblock_deserialize - * - * Purpose: Loads an object from the disk. + * Function: H5F__cache_superblock_deserialize * - * Return: Success: Pointer to new object - * Failure: NULL - * - * Programmer: Quincey Koziol - * July 18 2013 + * Purpose: Load an object from the disk * + * Return: Success: Pointer to new object + * Failure: NULL *------------------------------------------------------------------------- */ static void * -H5F__cache_superblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5F_super_t *sblock = NULL; /* File's superblock */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ - const uint8_t *image = _image; /* Pointer into raw data buffer */ - H5F_super_t *ret_value = NULL; /* Return value */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ + const uint8_t *end = image + len - 1; /* Pointer to end of buffer */ + H5F_super_t *ret_value = NULL; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(image); - HDassert(udata); - HDassert(udata->f); - HDassert(len >= H5F_SUPERBLOCK_FIXED_SIZE + 6); + assert(image); + assert(udata); + assert(udata->f); + assert(len >= H5F_SUPERBLOCK_FIXED_SIZE + 6); /* Allocate space for the superblock */ if (NULL == (sblock = H5FL_CALLOC(H5F_super_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Deserialize the file superblock's prefix */ - if (H5F__superblock_prefix_decode(sblock, &image, udata, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL, "can't decode file superblock prefix") + if (H5F__superblock_prefix_decode(sblock, &image, len, udata, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL, "can't decode file superblock prefix"); /* Check for older version of superblock format */ if (sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) { @@ -442,85 +432,113 @@ H5F__cache_superblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUS unsigned chunk_btree_k; /* B-tree chunk internal node 'K' value */ /* Freespace version (hard-wired) */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); if (HDF5_FREESPACE_VERSION != *image++) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad free space version number") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad free space version number"); /* Root group version number (hard-wired) */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); if (HDF5_OBJECTDIR_VERSION != *image++) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad object directory version number") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad object directory version number"); /* Skip over reserved byte */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); image++; /* Shared header version number (hard-wired) */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); if (HDF5_SHAREDHEADER_VERSION != *image++) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad shared-header format version number") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad shared-header format version number"); /* Skip over size of file addresses (already decoded) */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); image++; udata->f->shared->sizeof_addr = sblock->sizeof_addr; /* Keep a local copy also */ /* Skip over size of file sizes (already decoded) */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); image++; udata->f->shared->sizeof_size = sblock->sizeof_size; /* Keep a local copy also */ /* Skip over reserved byte */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); image++; /* Various B-tree sizes */ + if (H5_IS_BUFFER_OVERFLOW(image, 2, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); UINT16DECODE(image, sym_leaf_k); if (sym_leaf_k == 0) - HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, NULL, "bad symbol table leaf node 1/2 rank") + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, NULL, "bad symbol table leaf node 1/2 rank"); udata->sym_leaf_k = sym_leaf_k; /* Keep a local copy also */ /* Need 'get' call to set other array values */ + if (H5_IS_BUFFER_OVERFLOW(image, 2, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); UINT16DECODE(image, snode_btree_k); if (snode_btree_k == 0) - HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, NULL, "bad 1/2 rank for btree internal nodes") + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, NULL, "bad 1/2 rank for btree internal nodes"); udata->btree_k[H5B_SNODE_ID] = snode_btree_k; - /* - * Delay setting the value in the property list until we've checked + /* Delay setting the value in the property list until we've checked * for the indexed storage B-tree internal 'K' value later. */ /* File status flags (not really used yet) */ + if (H5_IS_BUFFER_OVERFLOW(image, 4, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); UINT32DECODE(image, status_flags); - HDassert(status_flags <= 255); + if (status_flags > 255) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad superblock status flags"); sblock->status_flags = (uint8_t)status_flags; if (sblock->status_flags & ~H5F_SUPER_ALL_FLAGS) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad flag value for superblock") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad flag value for superblock"); - /* - * If the superblock version # is greater than 0, read in the indexed + /* If the superblock version # is greater than 0, read in the indexed * storage B-tree internal 'K' value */ if (sblock->super_vers > HDF5_SUPERBLOCK_VERSION_DEF) { + if (H5_IS_BUFFER_OVERFLOW(image, 2, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); UINT16DECODE(image, chunk_btree_k); /* Reserved bytes are present only in version 1 */ - if (sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1) - image += 2; /* reserved */ - } /* end if */ + if (sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1) { + /* Reserved */ + if (H5_IS_BUFFER_OVERFLOW(image, 2, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); + image += 2; + } + } else chunk_btree_k = HDF5_BTREE_CHUNK_IK_DEF; udata->btree_k[H5B_CHUNK_ID] = chunk_btree_k; /* Remainder of "variable-sized" portion of superblock */ + if (H5_IS_BUFFER_OVERFLOW(image, H5F_sizeof_addr(udata->f) * 4, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); H5F_addr_decode(udata->f, (const uint8_t **)&image, &sblock->base_addr /*out*/); H5F_addr_decode(udata->f, (const uint8_t **)&image, &sblock->ext_addr /*out*/); H5F_addr_decode(udata->f, (const uint8_t **)&image, &udata->stored_eof /*out*/); H5F_addr_decode(udata->f, (const uint8_t **)&image, &sblock->driver_addr /*out*/); /* Allocate space for the root group symbol table entry */ - HDassert(!sblock->root_ent); + if (sblock->root_ent) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "root entry should not exist yet"); if (NULL == (sblock->root_ent = (H5G_entry_t *)H5MM_calloc(sizeof(H5G_entry_t)))) HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, - "can't allocate space for root group symbol table entry") + "can't allocate space for root group symbol table entry"); - /* decode the root group symbol table entry */ - if (H5G_ent_decode(udata->f, (const uint8_t **)&image, sblock->root_ent) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL, "can't decode root group symbol table entry") + /* Decode the root group symbol table entry */ + if (H5G_ent_decode(udata->f, (const uint8_t **)&image, sblock->root_ent, end) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL, "can't decode root group symbol table entry"); /* Set the root group address to the correct value */ sblock->root_addr = sblock->root_ent->header; @@ -530,30 +548,36 @@ H5F__cache_superblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUS * undefined to let the library ignore the family driver information saved * in the superblock. */ - if (udata->ignore_drvrinfo && H5F_addr_defined(sblock->driver_addr)) { + if (udata->ignore_drvrinfo && H5_addr_defined(sblock->driver_addr)) { /* Eliminate the driver info */ sblock->driver_addr = HADDR_UNDEF; udata->drvrinfo_removed = TRUE; - } /* end if */ + } /* NOTE: Driver info block is decoded separately, later */ - - } /* end if */ + } else { uint32_t read_chksum; /* Checksum read from file */ /* Skip over size of file addresses (already decoded) */ image++; udata->f->shared->sizeof_addr = sblock->sizeof_addr; /* Keep a local copy also */ - /* Skip over size of file sizes (already decoded) */ image++; udata->f->shared->sizeof_size = sblock->sizeof_size; /* Keep a local copy also */ + /* Check whether the image pointer is out of bounds */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); + /* File status flags (not really used yet) */ sblock->status_flags = *image++; if (sblock->status_flags & ~H5F_SUPER_ALL_FLAGS) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad flag value for superblock") + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad flag value for superblock"); + + /* Check whether the image pointer will be out of bounds */ + if (H5_IS_BUFFER_OVERFLOW(image, H5F_SIZEOF_ADDR(udata->f) * 4, end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); /* Base, superblock extension, end of file & root group object header addresses */ H5F_addr_decode(udata->f, (const uint8_t **)&image, &sblock->base_addr /*out*/); @@ -563,6 +587,10 @@ H5F__cache_superblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUS /* checksum verification already done in verify_chksum cb */ + /* Check whether the image pointer will be out of bounds */ + if (H5_IS_BUFFER_OVERFLOW(image, sizeof(uint32_t), end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, NULL, "image pointer is out of bounds"); + /* Decode checksum */ UINT32DECODE(image, read_chksum); @@ -572,19 +600,19 @@ H5F__cache_superblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUS * any attempt to load the Driver Information Block. */ sblock->driver_addr = HADDR_UNDEF; - } /* end else */ + } - /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) <= len); + /* Size check */ + if ((size_t)(image - (const uint8_t *)_image) > len) + HDONE_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "bad decoded superblock size"); - /* Set return value */ ret_value = sblock; done: /* Release the [possibly partially initialized] superblock on error */ if (!ret_value && sblock) if (H5F__super_free(sblock) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTFREE, NULL, "unable to destroy superblock data") + HDONE_ERROR(H5E_FILE, H5E_CANTFREE, NULL, "unable to destroy superblock data"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__cache_superblock_deserialize() */ @@ -592,13 +620,9 @@ H5F__cache_superblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUS /*------------------------------------------------------------------------- * Function: H5F__cache_superblock_image_len * - * Purpose: Compute the size of the data structure on disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * July 19, 2013 + * Purpose: Compute the size of the data structure on disk * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -608,11 +632,9 @@ H5F__cache_superblock_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(sblock); - HDassert(sblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(sblock->cache_info.type == H5AC_SUPERBLOCK); - HDassert(image_len); + assert(sblock); + assert(sblock->cache_info.type == H5AC_SUPERBLOCK); + assert(image_len); /* Set the image length size */ *image_len = (size_t)H5F_SUPERBLOCK_SIZE(sblock); @@ -623,13 +645,9 @@ H5F__cache_superblock_image_len(const void *_thing, size_t *image_len) /*------------------------------------------------------------------------- * Function: H5F__cache_superblock_serialize * - * Purpose: Flushes a dirty object to disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * July 19 2013 + * Purpose: Flush a dirty object to disk * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -638,20 +656,19 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the object */ uint8_t *image = _image; /* Pointer into raw data buffer */ haddr_t rel_eof; /* Relative EOF for file */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(f); - HDassert(image); - HDassert(sblock); + assert(f); + assert(image); + assert(sblock); /* Assert that the superblock is marked as being flushed last (and collectively in parallel) */ /* (We'll rely on the cache to make sure it actually *is* flushed last (and collectively in parallel), but this check doesn't hurt) */ - HDassert(sblock->cache_info.flush_me_last); + assert(sblock->cache_info.flush_me_last); /* Encode the common portion of the file superblock for all versions */ H5MM_memcpy(image, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN); @@ -695,7 +712,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU * such, use the EOA value in its place, knowing that the current EOF * value will ultimately match it. */ if ((rel_eof = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER)) == HADDR_UNDEF) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed"); H5F_addr_encode(f, &image, (rel_eof + sblock->base_addr)); /* Encode the driver information block address */ @@ -703,7 +720,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU /* Encode the root group object entry, including the cached stab info */ if (H5G_ent_encode(f, &image, sblock->root_ent) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTENCODE, FAIL, "can't encode root group symbol table entry") + HGOTO_ERROR(H5E_FILE, H5E_CANTENCODE, FAIL, "can't encode root group symbol table entry"); /* NOTE: Driver info block is handled separately */ @@ -729,12 +746,12 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU * in its place, knowing that the current EOF value will * ultimately match it. */ if ((rel_eof = H5FD_get_eoa(f->shared->lf, H5FD_MEM_SUPER)) == HADDR_UNDEF) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed"); H5F_addr_encode(f, &image, (rel_eof + sblock->base_addr)); /* Retrieve information for root group */ if (NULL == (root_oloc = H5G_oloc(f->shared->root_grp))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to retrieve root group information") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to retrieve root group information"); /* Encode address of root group's object header */ H5F_addr_encode(f, &image, root_oloc->addr); @@ -746,11 +763,11 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU UINT32ENCODE(image, chksum); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == (size_t)H5F_SUPERBLOCK_SIZE(sblock)); - } /* end else */ + assert((size_t)(image - (uint8_t *)_image) == (size_t)H5F_SUPERBLOCK_SIZE(sblock)); + } /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -759,36 +776,26 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU /*------------------------------------------------------------------------- * Function: H5F__cache_superblock_free_icr * - * Purpose: Destroy/release an "in core representation" of a data + * Purpose: Destroy/release an "in core representation" of a data * structure * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * July 20, 2013 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5F__cache_superblock_free_icr(void *_thing) { H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the object */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(sblock); - HDassert(sblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(sblock->cache_info.type == H5AC_SUPERBLOCK); + assert(sblock); + assert(sblock->cache_info.type == H5AC_SUPERBLOCK); /* Destroy superblock */ if (H5F__super_free(sblock) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free superblock") + HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free superblock"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -799,11 +806,7 @@ H5F__cache_superblock_free_icr(void *_thing) * * Purpose: Compute the initial size of the data structure on disk. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * July 20, 2013 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -811,8 +814,7 @@ H5F__cache_drvrinfo_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *i { FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(image_len); + assert(image_len); /* Set the initial image length size */ *image_len = H5F_DRVINFOBLOCK_HDR_SIZE; /* Fixed size portion of driver info block */ @@ -825,34 +827,29 @@ H5F__cache_drvrinfo_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *i * * Purpose: Compute the final size of the data structure on disk. * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * November 17, 2016 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, - void *_udata, size_t *actual_len) +H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len, void *_udata, + size_t *actual_len) { const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */ H5O_drvinfo_t drvrinfo; /* Driver info */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(image); - HDassert(udata); - HDassert(actual_len); - HDassert(*actual_len == image_len); - HDassert(image_len == H5F_DRVINFOBLOCK_HDR_SIZE); + assert(image); + assert(udata); + assert(actual_len); + assert(*actual_len == image_len); + assert(image_len == H5F_DRVINFOBLOCK_HDR_SIZE); /* Deserialize the file driver info's prefix */ - if (H5F__drvrinfo_prefix_decode(&drvrinfo, NULL, &image, udata, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't decode file driver info prefix") + if (H5F__drvrinfo_prefix_decode(&drvrinfo, NULL, &image, image_len, udata, TRUE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't decode file driver info prefix"); /* Set the final size for the cache image */ *actual_len = H5F_DRVINFOBLOCK_HDR_SIZE + drvrinfo.len; @@ -864,53 +861,46 @@ H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBU /*------------------------------------------------------------------------- * Function: H5F__cache_drvrinfo_deserialize * - * Purpose: Loads an object from the disk. - * - * Return: Success: Pointer to a new driver info struct - * Failure: NULL - * - * Programmer: Quincey Koziol - * July 20 2013 + * Purpose: Loads an object from the disk * + * Return: Success: Pointer to a new driver info struct + * Failure: NULL *------------------------------------------------------------------------- */ static void * -H5F__cache_drvrinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5O_drvinfo_t *drvinfo = NULL; /* Driver info */ H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */ const uint8_t *image = _image; /* Pointer into raw data buffer */ char drv_name[9]; /* Name of driver */ - H5O_drvinfo_t *ret_value = NULL; /* Return value */ + H5O_drvinfo_t *ret_value = NULL; FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(image); - HDassert(len >= H5F_DRVINFOBLOCK_HDR_SIZE); - HDassert(udata); - HDassert(udata->f); + assert(image); + assert(len >= H5F_DRVINFOBLOCK_HDR_SIZE); + assert(udata); + assert(udata->f); /* Allocate space for the driver info */ if (NULL == (drvinfo = (H5O_drvinfo_t *)H5MM_calloc(sizeof(H5O_drvinfo_t)))) - HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "memory allocation failed for driver info message") + HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "memory allocation failed for driver info message"); /* Deserialize the file driver info's prefix */ - if (H5F__drvrinfo_prefix_decode(drvinfo, drv_name, &image, udata, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL, "can't decode file driver info prefix") + if (H5F__drvrinfo_prefix_decode(drvinfo, drv_name, &image, len, udata, FALSE) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL, "can't decode file driver info prefix"); /* Sanity check */ - HDassert(len == (H5F_DRVINFOBLOCK_HDR_SIZE + drvinfo->len)); + assert(len == (H5F_DRVINFOBLOCK_HDR_SIZE + drvinfo->len)); /* Validate and decode driver information */ if (H5FD_sb_load(udata->f->shared->lf, drv_name, image) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL, "unable to decode driver information") + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL, "unable to decode driver information"); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) <= len); + assert((size_t)(image - (const uint8_t *)_image) <= len); - /* Set return value */ ret_value = drvinfo; done: @@ -924,13 +914,9 @@ H5F__cache_drvrinfo_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /*------------------------------------------------------------------------- * Function: H5F__cache_drvrinfo_image_len * - * Purpose: Compute the size of the data structure on disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * July 20, 2013 + * Purpose: Compute the size of the data structure on disk * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -940,11 +926,9 @@ H5F__cache_drvrinfo_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(drvinfo); - HDassert(drvinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(drvinfo->cache_info.type == H5AC_DRVRINFO); - HDassert(image_len); + assert(drvinfo); + assert(drvinfo->cache_info.type == H5AC_DRVRINFO); + assert(image_len); /* Set the image length size */ *image_len = (size_t)(H5F_DRVINFOBLOCK_HDR_SIZE + /* Fixed-size portion of driver info block */ @@ -956,13 +940,9 @@ H5F__cache_drvrinfo_image_len(const void *_thing, size_t *image_len) /*------------------------------------------------------------------------- * Function: H5F__cache_drvrinfo_serialize * - * Purpose: Flushes a dirty object to disk. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * July 20 2013 + * Purpose: Flush a dirty object to disk * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -971,17 +951,15 @@ H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBU H5O_drvinfo_t *drvinfo = (H5O_drvinfo_t *)_thing; /* Pointer to the object */ uint8_t *image = _image; /* Pointer into raw data buffer */ uint8_t *dbuf; /* Pointer to beginning of driver info */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* check arguments */ - HDassert(f); - HDassert(image); - HDassert(drvinfo); - HDassert(drvinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(drvinfo->cache_info.type == H5AC_DRVRINFO); - HDassert(len == (size_t)(H5F_DRVINFOBLOCK_HDR_SIZE + drvinfo->len)); + assert(f); + assert(image); + assert(drvinfo); + assert(drvinfo->cache_info.type == H5AC_DRVRINFO); + assert(len == (size_t)(H5F_DRVINFOBLOCK_HDR_SIZE + drvinfo->len)); /* Save pointer to beginning of driver info */ dbuf = image; @@ -997,13 +975,13 @@ H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBU /* Encode driver-specific data */ if (H5FD_sb_encode(f->shared->lf, (char *)image, dbuf + H5F_DRVINFOBLOCK_HDR_SIZE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to encode driver information"); /* Advance buffer pointer past name & variable-sized portion of driver info */ image += 8 + drvinfo->len; /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1012,18 +990,10 @@ H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBU /*------------------------------------------------------------------------- * Function: H5F__cache_drvrinfo_free_icr * - * Purpose: Destroy/release an "in core representation" of a data + * Purpose: Destroy/release an "in core representation" of a data * structure * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * July 20, 2013 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -1033,10 +1003,8 @@ H5F__cache_drvrinfo_free_icr(void *_thing) FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(drvinfo); - HDassert(drvinfo->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(drvinfo->cache_info.type == H5AC_DRVRINFO); + assert(drvinfo); + assert(drvinfo->cache_info.type == H5AC_DRVRINFO); /* Destroy driver info message */ H5MM_xfree(drvinfo); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ftest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ftest.c index 3628879733..593c525527 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ftest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ftest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Ftest.c - * Jan 3 2007 - * Quincey Koziol * * Purpose: File testing routines. * @@ -80,9 +77,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jan 3, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -96,20 +90,20 @@ H5F__get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_coun /* Check arguments */ if (NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); /* Push API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Retrieve count for message type */ if (H5SM__get_mesg_count_test(file, type_id, mesg_count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve shared message count") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve shared message count"); done: if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__get_sohm_mesg_count_test() */ @@ -124,9 +118,6 @@ H5F__get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, size_t *mesg_coun * * Return: SUCCEED/FAIL * - * Programmer: Neil Fortner - * Mar 31, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -140,20 +131,20 @@ H5F__check_cached_stab_test(hid_t file_id) /* Check arguments */ if (NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); /* Push API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Verify the cached stab info */ if (H5G__verify_cached_stab_test(H5G_oloc(file->shared->root_grp), file->shared->sblock->root_ent) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to verify cached symbol table info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to verify cached symbol table info"); done: if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_FILE, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__check_cached_stab_test() */ @@ -165,9 +156,6 @@ H5F__check_cached_stab_test(hid_t file_id) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jun 10, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -180,7 +168,7 @@ H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr) /* Check arguments */ if (NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); /* Retrieve maxaddr for file */ *maxaddr = file->shared->maxaddr; @@ -197,9 +185,6 @@ H5F__get_maxaddr_test(hid_t file_id, haddr_t *maxaddr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jul 10, 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -212,7 +197,7 @@ H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr) /* Check arguments */ if (NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); /* Retrieve maxaddr for file */ *sbe_addr = file->shared->sblock->ext_addr; @@ -228,9 +213,6 @@ H5F__get_sbe_addr_test(hid_t file_id, haddr_t *sbe_addr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Oct 13, 2018 - * *------------------------------------------------------------------------- */ htri_t @@ -243,9 +225,9 @@ H5F__same_file_test(hid_t file_id1, hid_t file_id2) /* Check arguments */ if (NULL == (file1 = (H5F_t *)H5VL_object_verify(file_id1, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); if (NULL == (file2 = (H5F_t *)H5VL_object_verify(file_id2, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file"); /* If they are using the same underlying "shared" file struct, they are the same file */ ret_value = (file1->shared == file2->shared); @@ -266,9 +248,6 @@ H5F__same_file_test(hid_t file_id1, hid_t file_id2) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Summer 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -280,7 +259,7 @@ H5F__reparse_file_lock_variable_test(void) /* Check the file locking environment variable */ if (H5F__parse_file_lock_env_var(&use_locks_env_g) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to parse file locking environment variable"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5G.c b/externals/coda-oss/modules/drivers/hdf5/source/H5G.c index b570979301..95fc4bff5b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5G.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5G.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -156,25 +155,25 @@ H5G__create_api_common(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl /* Check arguments */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string"); /* Set up object access arguments */ if (H5VL_setup_acc_args(loc_id, H5P_CLS_GACC, TRUE, &gapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Check link creation property list */ if (H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a link creation property list"); /* Check group creation property list */ if (H5P_DEFAULT == gcpl_id) gcpl_id = H5P_GROUP_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group creation property list"); /* Set the LCPL for the API context */ H5CX_set_lcpl(lcpl_id); @@ -182,16 +181,16 @@ H5G__create_api_common(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl /* Create the group */ if (NULL == (grp = H5VL_group_create(*vol_obj_ptr, &loc_params, name, lcpl_id, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group"); /* Get an ID for the group */ if ((ret_value = H5VL_register(H5I_GROUP, grp, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get ID for group handle") + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get ID for group handle"); done: if (H5I_INVALID_HID == ret_value) if (grp && H5VL_group_close(*vol_obj_ptr, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__create_api_common() */ @@ -229,7 +228,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t g /* Create the group synchronously */ if ((ret_value = H5G__create_api_common(loc_id, name, lcpl_id, gcpl_id, gapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create group"); done: FUNC_LEAVE_API(ret_value) @@ -265,7 +264,7 @@ H5Gcreate_async(const char *app_file, const char *app_func, unsigned app_line, h /* Create the group asynchronously */ if ((ret_value = H5G__create_api_common(loc_id, name, lcpl_id, gcpl_id, gapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create group"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -274,8 +273,8 @@ H5Gcreate_async(const char *app_file, const char *app_func, unsigned app_line, h H5ARG_TRACE9(__func__, "*s*sIui*siiii", app_file, app_func, app_line, loc_id, name, lcpl_id, gcpl_id, gapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on group ID") - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on group ID"); + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -329,16 +328,16 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) if (H5P_DEFAULT == gcpl_id) gcpl_id = H5P_GROUP_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group create property list"); if (H5P_DEFAULT == gapl_id) gapl_id = H5P_GROUP_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not group access property list"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&gapl_id, H5P_CLS_GACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -346,22 +345,22 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Create the group */ if (NULL == (grp = H5VL_group_create(vol_obj, &loc_params, NULL, H5P_LINK_CREATE_DEFAULT, gcpl_id, gapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group"); /* Get an ID for the group */ if ((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get ID for group handle") + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get ID for group handle"); done: /* Cleanup on failure */ if (H5I_INVALID_HID == ret_value) if (grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group"); FUNC_LEAVE_API(ret_value) } /* end H5Gcreate_anon() */ @@ -391,26 +390,26 @@ H5G__open_api_common(hid_t loc_id, const char *name, hid_t gapl_id, void **token /* Check args */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string"); /* Set up object access arguments */ if (H5VL_setup_acc_args(loc_id, H5P_CLS_GACC, FALSE, &gapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); if (NULL == (grp = H5VL_group_open(*vol_obj_ptr, &loc_params, name, gapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group"); /* Register an ID for the group */ if ((ret_value = H5VL_register(H5I_GROUP, grp, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group"); done: if (H5I_INVALID_HID == ret_value) if (grp && H5VL_group_close(*vol_obj_ptr, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group"); FUNC_LEAVE_NOAPI(ret_value) } /* H5G__open_api_common() */ @@ -440,7 +439,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) /* Open the group synchronously */ if ((ret_value = H5G__open_api_common(loc_id, name, gapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously open group"); done: FUNC_LEAVE_API(ret_value) @@ -474,7 +473,7 @@ H5Gopen_async(const char *app_file, const char *app_func, unsigned app_line, hid /* Open the group asynchronously */ if ((ret_value = H5G__open_api_common(loc_id, name, gapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously open group"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -483,8 +482,8 @@ H5Gopen_async(const char *app_file, const char *app_func, unsigned app_line, hid H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, gapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on group ID") - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on group ID"); + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -516,7 +515,7 @@ H5Gget_create_plist(hid_t group_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_GROUP_GET_GCPL; @@ -524,7 +523,7 @@ H5Gget_create_plist(hid_t group_id) /* Get the group creation property list for the group */ if (H5VL_group_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list"); /* Set the return value */ ret_value = vol_cb_args.args.get_gcpl.gcpl_id; @@ -559,19 +558,19 @@ H5G__get_info_api_common(hid_t loc_id, H5G_info_t *group_info /*out*/, void **to /* Check args */ id_type = H5I_get_type(loc_id); if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID"); if (!group_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL"); /* Set up VOL callback & object access arguments */ vol_cb_args.op_type = H5VL_GROUP_GET_INFO; if (H5VL_setup_self_args(loc_id, vol_obj_ptr, &vol_cb_args.args.get_info.loc_params) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments"); vol_cb_args.args.get_info.ginfo = group_info; /* Retrieve group information */ if (H5VL_group_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -596,7 +595,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info /*out*/) /* Retrieve group information synchronously */ if (H5G__get_info_api_common(loc_id, group_info, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to synchronously get group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to synchronously get group info"); done: FUNC_LEAVE_API(ret_value) @@ -629,7 +628,7 @@ H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, /* Retrieve group information asynchronously */ if (H5G__get_info_api_common(loc_id, group_info, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to asynchronously get group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to asynchronously get group info"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -637,7 +636,7 @@ H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE6(__func__, "*s*sIuixi", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -667,18 +666,18 @@ H5G__get_info_by_name_api_common(hid_t loc_id, const char *name, H5G_info_t *gro /* Check args */ if (!group_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL"); /* Set up VOL callback & object access arguments */ vol_cb_args.op_type = H5VL_GROUP_GET_INFO; if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr, &vol_cb_args.args.get_info.loc_params) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments"); vol_cb_args.args.get_info.ginfo = group_info; /* Retrieve group information */ if (H5VL_group_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -704,7 +703,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info /*out /* Retrieve group information synchronously */ if (H5G__get_info_by_name_api_common(loc_id, name, group_info, lapl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't synchronously retrieve group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't synchronously retrieve group info"); done: FUNC_LEAVE_API(ret_value) @@ -737,7 +736,7 @@ H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned a /* Retrieve group information asynchronously */ if (H5G__get_info_by_name_api_common(loc_id, name, group_info, lapl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't asynchronously retrieve group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't asynchronously retrieve group info"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -745,7 +744,7 @@ H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned a if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE8(__func__, "*s*sIui*sxii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -776,18 +775,18 @@ H5G__get_info_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t /* Check args */ if (!group_info) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL"); /* Set up VOL callback & object access arguments */ vol_cb_args.op_type = H5VL_GROUP_GET_INFO; if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, FALSE, lapl_id, vol_obj_ptr, &vol_cb_args.args.get_info.loc_params) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments"); vol_cb_args.args.get_info.ginfo = group_info; /* Retrieve group information */ if (H5VL_group_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -815,7 +814,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5 /* Retrieve group information synchronously */ if (H5G__get_info_by_idx_api_common(loc_id, group_name, idx_type, order, n, group_info, lapl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't synchronously retrieve group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't synchronously retrieve group info"); done: FUNC_LEAVE_API(ret_value) @@ -851,7 +850,7 @@ H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned ap /* Retrieve group information asynchronously */ if (H5G__get_info_by_idx_api_common(loc_id, group_name, idx_type, order, n, group_info, lapl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't asynchronously retrieve group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't asynchronously retrieve group info"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -859,7 +858,7 @@ H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned ap if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE11(__func__, "*s*sIui*sIiIohxii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -885,13 +884,13 @@ H5Gclose(hid_t group_id) /* Check arguments */ if (H5I_GROUP != H5I_get_type(group_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID"); /* Decrement the counter on the group ID. It will be freed if the count * reaches zero. */ if (H5I_dec_app_ref(group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "decrementing group ID failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "decrementing group ID failed"); done: FUNC_LEAVE_API(ret_value) @@ -920,13 +919,13 @@ H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hi /* Check arguments */ if (H5I_GROUP != H5I_get_type(group_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID"); /* Prepare for possible asynchronous operation */ if (H5ES_NONE != es_id) { /* Get group object's connector */ if (NULL == (vol_obj = H5VL_vol_object(group_id))) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get VOL object for group") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get VOL object for group"); /* Increase connector's refcount, so it doesn't get closed if closing * the group closes the file */ @@ -941,7 +940,7 @@ H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hi * reaches zero. */ if (H5I_dec_app_ref_async(group_id, token_ptr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "decrementing group ID failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "decrementing group ID failed"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -949,11 +948,11 @@ H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, group_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: if (connector && H5VL_conn_dec_rc(connector) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't decrement ref count on connector") + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't decrement ref count on connector"); FUNC_LEAVE_API(ret_value) } /* end H5Gclose_async() */ @@ -965,9 +964,6 @@ H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hi * * Return: Non-negative on success, negative on failure * - * Programmer: Mike McGreevy - * May 19, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -982,11 +978,11 @@ H5Gflush(hid_t group_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_GROUP_FLUSH; @@ -994,7 +990,7 @@ H5Gflush(hid_t group_id) /* Flush group's metadata to file */ if (H5VL_group_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group"); done: FUNC_LEAVE_API(ret_value) @@ -1007,9 +1003,6 @@ H5Gflush(hid_t group_id) * * Return: Non-negative on success, negative on failure * - * Programmer: Mike McGreevy - * July 21, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -1024,11 +1017,11 @@ H5Grefresh(hid_t group_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group ID"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(group_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_GROUP_REFRESH; @@ -1036,7 +1029,7 @@ H5Grefresh(hid_t group_id) /* Refresh group's metadata */ if (H5VL_group_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gbtree2.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gbtree2.c index 7dc268a7b6..d44f6745c5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gbtree2.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gbtree2.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gbtree2.c - * Sep 9 2006 - * Quincey Koziol * * Purpose: v2 B-tree callbacks for indexing fields on links * @@ -137,9 +134,6 @@ const H5B2_class_t H5G_BT2_CORDER[1] = {{ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -154,7 +148,7 @@ H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) /* Decode link information */ if (NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) - HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") + HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link"); /* Compare the string values */ udata->cmp = HDstrcmp(udata->name, lnk->name); @@ -162,7 +156,7 @@ H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) /* Check for correct link & callback to make */ if (udata->cmp == 0 && udata->found_op) { if ((udata->found_op)(lnk, udata->found_op_data) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed"); } /* end if */ /* Release the space allocated for the link */ @@ -180,9 +174,6 @@ H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, September 9, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -209,9 +200,6 @@ H5G__dense_btree2_name_store(void *_nrecord, const void *_udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Quincey Koziol - * Monday, September 11, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -224,8 +212,8 @@ H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(bt2_udata); - HDassert(bt2_rec); + assert(bt2_udata); + assert(bt2_rec); /* Check hash value */ if (bt2_udata->name_hash < bt2_rec->hash) @@ -236,7 +224,7 @@ H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int H5G_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */ /* Sanity check */ - HDassert(bt2_udata->name_hash == bt2_rec->hash); + assert(bt2_udata->name_hash == bt2_rec->hash); /* Prepare user data for callback */ /* down */ @@ -250,7 +238,7 @@ H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int /* Check if the user's link and the B-tree's link have the same name */ if (H5HF_op(bt2_udata->fheap, bt2_rec->id, H5G__dense_fh_name_cmp, &fh_udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); /* Callback will set comparison value */ *result = fh_udata.cmp; @@ -268,9 +256,6 @@ H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, September 11, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -281,7 +266,7 @@ H5G__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_U FUNC_ENTER_PACKAGE_NOERR /* Encode the record's fields */ - UINT32ENCODE(raw, nrecord->hash) + UINT32ENCODE(raw, nrecord->hash); H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) @@ -295,9 +280,6 @@ H5G__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_U * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, September 11, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -308,7 +290,7 @@ H5G__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U FUNC_ENTER_PACKAGE_NOERR /* Decode the record's fields */ - UINT32DECODE(raw, nrecord->hash) + UINT32DECODE(raw, nrecord->hash); H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) @@ -322,9 +304,6 @@ H5G__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, September 11, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -336,9 +315,9 @@ H5G__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_ FUNC_ENTER_PACKAGE_NOERR - HDfprintf(stream, "%*s%-*s {%x, ", indent, "", fwidth, "Record:", (unsigned)nrecord->hash); + fprintf(stream, "%*s%-*s {%x, ", indent, "", fwidth, "Record:", (unsigned)nrecord->hash); for (u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) - HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); + fprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G__dense_btree2_name_debug() */ @@ -351,9 +330,6 @@ H5G__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_ * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -380,9 +356,6 @@ H5G__dense_btree2_corder_store(void *_nrecord, const void *_udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -394,8 +367,8 @@ H5G__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, i FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(bt2_udata); - HDassert(bt2_rec); + assert(bt2_udata); + assert(bt2_rec); /* Check creation order value */ if (bt2_udata->corder < bt2_rec->corder) @@ -416,9 +389,6 @@ H5G__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, i * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -429,7 +399,7 @@ H5G__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR FUNC_ENTER_PACKAGE_NOERR /* Encode the record's fields */ - INT64ENCODE(raw, nrecord->corder) + INT64ENCODE(raw, nrecord->corder); H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) @@ -443,9 +413,6 @@ H5G__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -456,7 +423,7 @@ H5G__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR FUNC_ENTER_PACKAGE_NOERR /* Decode the record's fields */ - INT64DECODE(raw, nrecord->corder) + INT64DECODE(raw, nrecord->corder); H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) @@ -470,9 +437,6 @@ H5G__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, October 30, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -484,9 +448,9 @@ H5G__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void FUNC_ENTER_PACKAGE_NOERR - HDfprintf(stream, "%*s%-*s {%llu, ", indent, "", fwidth, "Record:", (unsigned long long)nrecord->corder); + fprintf(stream, "%*s%-*s {%llu, ", indent, "", fwidth, "Record:", (unsigned long long)nrecord->corder); for (u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) - HDfprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); + fprintf(stderr, "%02x%s", nrecord->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G__dense_btree2_corder_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gcache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gcache.c index 2c64078412..febd37a776 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gcache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gcache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5Gcache.c - * Feb 5 2008 - * Quincey Koziol * - * Purpose: Implement group metadata cache methods. + * Purpose: Implement group metadata cache methods * *------------------------------------------------------------------------- */ @@ -102,15 +99,10 @@ H5FL_SEQ_EXTERN(H5G_entry_t); /*------------------------------------------------------------------------- * Function: H5G__cache_node_get_initial_load_size() * - * Purpose: Determine the size of the on-disk image of the node, and - * return this value in *image_len. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/21/14 + * Purpose: Determine the size of the on-disk image of the node, and + * return this value in *image_len. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -120,9 +112,8 @@ H5G__cache_node_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR - /* Sanity checks */ - HDassert(f); - HDassert(image_len); + assert(f); + assert(image_len); /* Set the image length size */ *image_len = (size_t)(H5G_NODE_SIZE(f)); @@ -133,22 +124,18 @@ H5G__cache_node_get_initial_load_size(void *_udata, size_t *image_len) /*------------------------------------------------------------------------- * Function: H5G__cache_node_deserialize * - * Purpose: Given a buffer containing the on disk image of a symbol table - * node, allocate an instance of H5G_node_t, load the contents of the - * image into it, and return a pointer to the instance. + * Purpose: Given a buffer containing the on disk image of a symbol table + * node, allocate an instance of H5G_node_t, load the contents of the + * image into it, and return a pointer to the instance. * - * Note that deserializing the image requires access to the file - * pointer, which is not included in the parameter list for this - * callback. Finesse this issue by passing in the file pointer - * twice to the H5AC_protect() call -- once as the file pointer - * proper, and again as the user data + * Note that deserializing the image requires access to the file + * pointer, which is not included in the parameter list for this + * callback. Finesse this issue by passing in the file pointer + * twice to the H5AC_protect() call -- once as the file pointer + * proper, and again as the user data * * Return: Success: Pointer to in core representation * Failure: NULL - * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static void * @@ -158,41 +145,48 @@ H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, hbool_ H5G_node_t *sym = NULL; /* Symbol table node created */ const uint8_t *image = (const uint8_t *)_image; /* Pointer to image to deserialize */ const uint8_t *image_end = image + len - 1; /* Pointer to end of image buffer */ - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* Sanity checks */ - HDassert(image); - HDassert(len > 0); - HDassert(f); - HDassert(dirty); + assert(image); + assert(len > 0); + assert(f); + assert(dirty); /* Allocate symbol table data structures */ if (NULL == (sym = H5FL_CALLOC(H5G_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); sym->node_size = (size_t)(H5G_NODE_SIZE(f)); if (NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - /* magic */ - if (HDmemcmp(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "bad symbol table node signature") + /* Magic */ + if (H5_IS_BUFFER_OVERFLOW(image, H5_SIZEOF_MAGIC, image_end)) + HGOTO_ERROR(H5E_SYM, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + if (memcmp(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "bad symbol table node signature"); image += H5_SIZEOF_MAGIC; - /* version */ + /* Version */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, image_end)) + HGOTO_ERROR(H5E_SYM, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (H5G_NODE_VERS != *image++) - HGOTO_ERROR(H5E_SYM, H5E_VERSION, NULL, "bad symbol table node version") + HGOTO_ERROR(H5E_SYM, H5E_VERSION, NULL, "bad symbol table node version"); - /* reserved */ + /* Reserved */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, image_end)) + HGOTO_ERROR(H5E_SYM, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); image++; - /* number of symbols */ + /* Number of symbols */ + if (H5_IS_BUFFER_OVERFLOW(image, 2, image_end)) + HGOTO_ERROR(H5E_SYM, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(image, sym->nsyms); - /* entries */ + /* Entries */ if (H5G__ent_decode_vec(f, &image, image_end, sym->entry, sym->nsyms) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "unable to decode symbol table entries"); /* Set return value */ ret_value = sym; @@ -200,7 +194,7 @@ H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, hbool_ done: if (!ret_value) if (sym && H5G__node_free(sym) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, NULL, "unable to destroy symbol table node") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, NULL, "unable to destroy symbol table node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__cache_node_deserialize() */ @@ -209,14 +203,9 @@ H5G__cache_node_deserialize(const void *_image, size_t len, void *_udata, hbool_ * Function: H5G__cache_node_image_len * * Purpose: Compute the size of the data structure on disk and return - * it in *image_len. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 6/21/14 + * it in *image_len * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -226,11 +215,9 @@ H5G__cache_node_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR - /* Sanity checks */ - HDassert(sym); - HDassert(sym->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(sym->cache_info.type == H5AC_SNODE); - HDassert(image_len); + assert(sym); + assert(sym->cache_info.type == H5AC_SNODE); + assert(image_len); *image_len = sym->node_size; @@ -240,17 +227,12 @@ H5G__cache_node_image_len(const void *_thing, size_t *image_len) /*------------------------------------------------------------------------- * Function: H5G__cache_node_serialize * - * Purpose: Given a correctly sized buffer and an instance of H5G_node_t, - * serialize the contents of the instance of H5G_node_t, and write - * this data into the supplied buffer. This buffer will be written - * to disk. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/21/14 + * Purpose: Given a correctly sized buffer and an instance of H5G_node_t, + * serialize the contents of the instance of H5G_node_t, and write + * this data into the supplied buffer. This buffer will be written + * to disk. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -258,37 +240,35 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len, void *_thing { H5G_node_t *sym = (H5G_node_t *)_thing; /* Pointer to object */ uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity checks */ - HDassert(f); - HDassert(image); - HDassert(sym); - HDassert(sym->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(sym->cache_info.type == H5AC_SNODE); - HDassert(len == sym->node_size); + assert(f); + assert(image); + assert(sym); + assert(sym->cache_info.type == H5AC_SNODE); + assert(len == sym->node_size); - /* magic number */ + /* Magic number */ H5MM_memcpy(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; - /* version number */ + /* Version number */ *image++ = H5G_NODE_VERS; - /* reserved */ + /* Reserved */ *image++ = 0; - /* number of symbols */ + /* Number of symbols */ UINT16ENCODE(image, sym->nsyms); - /* entries */ + /* Entries */ if (H5G__ent_encode_vec(f, &image, sym->entry, sym->nsyms) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") + HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize"); /* Clear rest of symbol table node */ - HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); + memset(image, 0, len - (size_t)(image - (uint8_t *)_image)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -297,36 +277,25 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len, void *_thing /*------------------------------------------------------------------------- * Function: H5G__cache_node_free_icr * - * Purpose: Destroys a symbol table node in memory. - * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 6/21/14 + * Purpose: Destroy a symbol table node in memory * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5G__cache_node_free_icr(void *_thing) { H5G_node_t *sym = (H5G_node_t *)_thing; /* Pointer to the object */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity checks */ - HDassert(sym); - HDassert(sym->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(sym->cache_info.type == H5AC_SNODE); + assert(sym); + assert(sym->cache_info.type == H5AC_SNODE); /* Destroy symbol table node */ if (H5G__node_free(sym) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gcompact.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gcompact.c index 5346c01162..08a8fa2b92 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gcompact.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gcompact.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gcompact.c - * Sep 5 2005 - * Quincey Koziol * * Purpose: Functions for handling compact storage. * @@ -71,9 +68,6 @@ static herr_t H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 5 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -86,13 +80,13 @@ H5G__compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(lnk); - HDassert(udata); - HDassert(udata->curr_lnk < udata->ltable->nlinks); + assert(lnk); + assert(udata); + assert(udata->curr_lnk < udata->ltable->nlinks); /* Copy link message into table */ if (NULL == H5O_msg_copy(H5O_LINK_ID, lnk, &(udata->ltable->lnks[udata->curr_lnk]))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message"); /* Increment current link entry to operate on */ udata->curr_lnk++; @@ -110,9 +104,6 @@ H5G__compact_build_table_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Sep 6, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -124,9 +115,9 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_ind FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(oloc); - HDassert(linfo); - HDassert(ltable); + assert(oloc); + assert(linfo); + assert(ltable); /* Set size of table */ H5_CHECK_OVERFLOW(linfo->nlinks, hsize_t, size_t); @@ -139,7 +130,7 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_ind /* Allocate the link table */ if ((ltable->lnks = (H5O_link_t *)H5MM_calloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Set up user data for iteration */ udata.ltable = ltable; @@ -149,11 +140,11 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_ind op.op_type = H5O_MESG_OP_APP; op.u.app_op = H5G__compact_build_table_cb; if (H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages"); /* Sort link table in correct iteration order */ if (H5G__link_sort_table(ltable, idx_type, order) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages") + HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages"); } /* end if */ else ltable->lnks = NULL; @@ -171,9 +162,6 @@ H5G__compact_build_table(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_ind * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 6 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -184,12 +172,12 @@ H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(grp_oloc && grp_oloc->file); - HDassert(obj_lnk); + assert(grp_oloc && grp_oloc->file); + assert(obj_lnk); /* Insert link message into group */ if (H5O_msg_create(grp_oloc, H5O_LINK_ID, 0, H5O_UPDATE_TIME, obj_lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -202,9 +190,6 @@ H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 6, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -218,15 +203,15 @@ H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5 FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(oloc); + assert(oloc); /* Build table of all link messages */ if (H5G__compact_build_table(oloc, linfo, idx_type, order, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table"); /* Check for going out of bounds */ if (idx >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound"); /* Get the length of the name */ *name_len = HDstrlen(ltable.lnks[idx].name); @@ -241,7 +226,7 @@ H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5 done: /* Release link table */ if (ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__compact_get_name_by_idx() */ @@ -254,9 +239,6 @@ H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5 * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 5 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -269,17 +251,17 @@ H5G__compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, vo FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(lnk); - HDassert(udata); + assert(lnk); + assert(udata); /* If we've found the right link, get the object type */ if (HDstrcmp(lnk->name, udata->name) == 0) { /* Replace path names for link being removed */ if (H5G__link_name_replace(udata->file, udata->grp_full_path_r, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get object type") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get object type"); /* Stop the iteration, we found the correct link */ - HGOTO_DONE(H5_ITER_STOP) + HGOTO_DONE(H5_ITER_STOP); } /* end if */ done: @@ -293,9 +275,6 @@ H5G__compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, vo * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, September 19, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -306,8 +285,8 @@ H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const ch FUNC_ENTER_PACKAGE - HDassert(oloc && oloc->file); - HDassert(name && *name); + assert(oloc && oloc->file); + assert(name && *name); /* Initialize data to pass through object header iteration */ udata.file = oloc->file; @@ -316,7 +295,7 @@ H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const ch /* Iterate over the link messages to delete the right one */ if (H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G__compact_remove_common_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -329,9 +308,6 @@ H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const ch * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 14, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -344,16 +320,16 @@ H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5RS FUNC_ENTER_PACKAGE - HDassert(oloc && oloc->file); - HDassert(linfo); + assert(oloc && oloc->file); + assert(linfo); /* Build table of all link messages, sorted according to desired order */ if (H5G__compact_build_table(oloc, linfo, idx_type, order, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table"); /* Check for going out of bounds */ if (n >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index out of bound"); /* Initialize data to pass through object header iteration */ udata.file = oloc->file; @@ -362,12 +338,12 @@ H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5RS /* Iterate over the link messages to delete the right one */ if (H5O_msg_remove_op(oloc, H5O_LINK_ID, H5O_FIRST, H5G__compact_remove_common_cb, &udata, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link message"); done: /* Release link table */ if (ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__compact_remove_by_idx() */ @@ -379,9 +355,6 @@ H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5RS * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, October 3, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -395,13 +368,13 @@ H5G__compact_iterate(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(oloc); - HDassert(linfo); - HDassert(op); + assert(oloc); + assert(linfo); + assert(op); /* Build table of all link messages */ if (H5G__compact_build_table(oloc, linfo, idx_type, order, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table"); /* Iterate over links in table */ if ((ret_value = H5G__link_iterate_table(<able, skip, last_lnk, op, op_data)) < 0) @@ -410,7 +383,7 @@ H5G__compact_iterate(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t done: /* Release link table */ if (ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__compact_iterate() */ @@ -423,9 +396,6 @@ H5G__compact_iterate(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 20 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -438,22 +408,22 @@ H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_ud FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(lnk); - HDassert(udata); + assert(lnk); + assert(udata); /* Check for name to get information */ if (HDstrcmp(lnk->name, udata->name) == 0) { if (udata->lnk) { /* Copy link information */ if (NULL == H5O_msg_copy(H5O_LINK_ID, lnk, udata->lnk)) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message"); } /* end if */ /* Indicate that the correct link was found */ *udata->found = TRUE; /* Stop iteration now */ - HGOTO_DONE(H5_ITER_STOP) + HGOTO_DONE(H5_ITER_STOP); } /* end if */ done: @@ -467,9 +437,6 @@ H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_ud * * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 20 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -482,9 +449,9 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, hbool_t *found, H5O FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(name && *name); - HDassert(found); - HDassert(lnk && oloc->file); + assert(name && *name); + assert(found); + assert(lnk && oloc->file); /* Set up user data for iteration */ udata.name = name; @@ -495,7 +462,7 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, hbool_t *found, H5O op.op_type = H5O_MESG_OP_APP; op.u.app_op = H5G__compact_lookup_cb; if (H5O_msg_iterate(oloc, H5O_LINK_ID, &op, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over link messages"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -509,9 +476,6 @@ H5G__compact_lookup(const H5O_loc_t *oloc, const char *name, hbool_t *found, H5O * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 6 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -524,26 +488,26 @@ H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_i FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(oloc && oloc->file); - HDassert(linfo); - HDassert(lnk); + assert(oloc && oloc->file); + assert(linfo); + assert(lnk); /* Build table of all link messages, sorted according to desired order */ if (H5G__compact_build_table(oloc, linfo, idx_type, order, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create link message table"); /* Check for going out of bounds */ if (n >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "index out of bound"); /* Copy link information */ if (NULL == H5O_msg_copy(H5O_LINK_ID, <able.lnks[n], lnk)) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message"); done: /* Release link table */ if (ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__compact_lookup_by_idx() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gdense.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gdense.c index 0df6ffa8d5..961560ad4a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gdense.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gdense.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gdense.c - * Sep 9 2006 - * Quincey Koziol * * Purpose: Routines for operating on "dense" link storage for a * group in a file. @@ -240,9 +237,6 @@ typedef struct { * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 9 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -261,12 +255,12 @@ H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline) /* * Check arguments. */ - HDassert(f); - HDassert(linfo); + assert(f); + assert(linfo); /* Set fractal heap creation parameters */ /* XXX: Give some control of these to applications? */ - HDmemset(&fheap_cparam, 0, sizeof(fheap_cparam)); + memset(&fheap_cparam, 0, sizeof(fheap_cparam)); fheap_cparam.managed.width = H5G_FHEAP_MAN_WIDTH; fheap_cparam.managed.start_block_size = H5G_FHEAP_MAN_START_BLOCK_SIZE; fheap_cparam.managed.max_direct_size = H5G_FHEAP_MAN_MAX_DIRECT_SIZE; @@ -279,19 +273,19 @@ H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline) /* Create fractal heap for storing links */ if (NULL == (fheap = H5HF_create(f, &fheap_cparam))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create fractal heap"); /* Retrieve the heap's address in the file */ if (H5HF_get_heap_addr(fheap, &(linfo->fheap_addr)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get fractal heap address") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get fractal heap address"); /* Retrieve the heap's ID length in the file */ if (H5HF_get_id_len(fheap, &fheap_id_len) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length") - HDassert(fheap_id_len == H5G_DENSE_FHEAP_ID_LEN); + HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length"); + assert(fheap_id_len == H5G_DENSE_FHEAP_ID_LEN); /* Create the name index v2 B-tree */ - HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); + memset(&bt2_cparam, 0, sizeof(bt2_cparam)); bt2_cparam.cls = H5G_BT2_NAME; bt2_cparam.node_size = (size_t)H5G_NAME_BT2_NODE_SIZE; H5_CHECK_OVERFLOW(fheap_id_len, /* From: */ hsize_t, /* To: */ uint32_t); @@ -300,16 +294,16 @@ H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline) bt2_cparam.split_percent = H5G_NAME_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5G_NAME_BT2_MERGE_PERC; if (NULL == (bt2_name = H5B2_create(f, &bt2_cparam, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index"); /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(bt2_name, &(linfo->name_bt2_addr)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for name index"); /* Check if we should create a creation order index v2 B-tree */ if (linfo->index_corder) { /* Create the creation order index v2 B-tree */ - HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam)); + memset(&bt2_cparam, 0, sizeof(bt2_cparam)); bt2_cparam.cls = H5G_BT2_CORDER; bt2_cparam.node_size = (size_t)H5G_CORDER_BT2_NODE_SIZE; H5_CHECK_OVERFLOW(fheap_id_len, /* From: */ hsize_t, /* To: */ uint32_t); @@ -318,21 +312,21 @@ H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline) bt2_cparam.split_percent = H5G_CORDER_BT2_SPLIT_PERC; bt2_cparam.merge_percent = H5G_CORDER_BT2_MERGE_PERC; if (NULL == (bt2_corder = H5B2_create(f, &bt2_cparam, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index"); /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(bt2_corder, &(linfo->corder_bt2_addr)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for creation order index") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for creation order index"); } /* end if */ done: /* Close the open objects */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_create() */ @@ -344,9 +338,6 @@ H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -367,37 +358,37 @@ H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk) /* * Check arguments. */ - HDassert(f); - HDassert(linfo); - HDassert(lnk); + assert(f); + assert(linfo); + assert(lnk); /* Find out the size of buffer needed for serialized link */ if ((link_size = H5O_msg_raw_size(f, H5O_LINK_ID, FALSE, lnk)) == 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size") + HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size"); /* Wrap the local buffer for serialized link */ if (NULL == (wb = H5WB_wrap(link_buf, sizeof(link_buf)))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer"); /* Get a pointer to a buffer that's large enough for link */ if (NULL == (link_ptr = H5WB_actual(wb, link_size))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer") + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer"); /* Create serialized form of link */ if (H5O_msg_encode(f, H5O_LINK_ID, FALSE, (unsigned char *)link_ptr, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link") + HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode link"); /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, linfo->fheap_addr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Insert the serialized link into the fractal heap */ if (H5HF_insert(fheap, link_size, link_ptr, udata.id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into fractal heap"); /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, linfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Create the callback information for v2 B-tree record insertion */ udata.common.f = f; @@ -411,30 +402,30 @@ H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk) /* Insert link into 'name' tracking v2 B-tree */ if (H5B2_insert(bt2_name, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree"); /* Check if we should create a creation order index v2 B-tree record */ if (linfo->index_corder) { /* Open the creation order index v2 B-tree */ - HDassert(H5F_addr_defined(linfo->corder_bt2_addr)); + assert(H5_addr_defined(linfo->corder_bt2_addr)); if (NULL == (bt2_corder = H5B2_open(f, linfo->corder_bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index"); /* Insert the record into the creation order index v2 B-tree */ if (H5B2_insert(bt2_corder, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree"); } /* end if */ done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index"); if (wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_insert() */ @@ -446,9 +437,6 @@ H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -463,12 +451,12 @@ H5G__dense_lookup_cb(const void *_lnk, void *_user_lnk) /* * Check arguments. */ - HDassert(lnk); - HDassert(user_lnk); + assert(lnk); + assert(user_lnk); /* Copy link information */ if (H5O_msg_copy(H5O_LINK_ID, lnk, user_lnk) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -481,9 +469,6 @@ H5G__dense_lookup_cb(const void *_lnk, void *_user_lnk) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -499,19 +484,19 @@ H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, hbool_t /* * Check arguments. */ - HDassert(f); - HDassert(linfo); - HDassert(name && *name); - HDassert(found); - HDassert(lnk); + assert(f); + assert(linfo); + assert(name && *name); + assert(found); + assert(lnk); /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, linfo->fheap_addr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, linfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Construct the user data for v2 B-tree callback */ udata.f = f; @@ -523,14 +508,14 @@ H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, hbool_t /* Find & copy the named link in the 'name' index */ if (H5B2_find(bt2_name, &udata, found, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in name index"); done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_lookup() */ @@ -543,9 +528,6 @@ H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, hbool_t * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Nov 7 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -560,11 +542,11 @@ H5G__dense_lookup_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) /* Decode link information & keep a copy */ if (NULL == (tmp_lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) - HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") + HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link"); /* Copy link information */ if (NULL == H5O_msg_copy(H5O_LINK_ID, tmp_lnk, udata->lnk)) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message"); done: /* Release the space allocated for the link */ @@ -581,9 +563,6 @@ H5G__dense_lookup_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) * * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * - * Programmer: Quincey Koziol - * Nov 7 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -603,7 +582,7 @@ H5G__dense_lookup_by_idx_bt2_cb(const void *_record, void *_bt2_udata) /* Call fractal heap 'op' routine, to copy the link information */ if (H5HF_op(bt2_udata->fheap, record->id, H5G__dense_lookup_by_idx_fh_cb, &fh_udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, H5_ITER_ERROR, "link found callback failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, H5_ITER_ERROR, "link found callback failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -617,9 +596,6 @@ H5G__dense_lookup_by_idx_bt2_cb(const void *_record, void *_bt2_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 7 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -637,9 +613,9 @@ H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type /* * Check arguments. */ - HDassert(f); - HDassert(linfo); - HDassert(lnk); + assert(f); + assert(linfo); + assert(lnk); /* Determine the address of the index to use */ if (idx_type == H5_INDEX_NAME) { @@ -650,7 +626,7 @@ H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type bt2_addr = HADDR_UNDEF; } /* end if */ else { - HDassert(idx_type == H5_INDEX_CRT_ORDER); + assert(idx_type == H5_INDEX_CRT_ORDER); /* This address may not be defined if creation order is tracked, but * there's no index on it. If there's no v2 B-tree that indexes @@ -664,22 +640,22 @@ H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type * use the B-tree for names instead of building a table to speed up the * process. */ - if (order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) { + if (order == H5_ITER_NATIVE && !H5_addr_defined(bt2_addr)) { bt2_addr = linfo->name_bt2_addr; - HDassert(H5F_addr_defined(bt2_addr)); + assert(H5_addr_defined(bt2_addr)); } /* end if */ /* If there is an index defined for the field, use it */ - if (H5F_addr_defined(bt2_addr)) { + if (H5_addr_defined(bt2_addr)) { H5G_bt2_ud_lbi_t udata; /* User data for v2 B-tree link lookup */ /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, linfo->fheap_addr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index"); /* Construct the user data for v2 B-tree callback */ udata.f = f; @@ -688,30 +664,30 @@ H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type /* Find & copy the link in the appropriate index */ if (H5B2_index(bt2, order, n, H5G__dense_lookup_by_idx_bt2_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in index") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in index"); } /* end if */ else { /* Otherwise, we need to build a table of the links and sort it */ /* Build the table of links for this group */ if (H5G__dense_build_table(f, linfo, idx_type, order, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links"); /* Check for going out of bounds */ if (n >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound"); /* Copy link information */ if (NULL == H5O_msg_copy(H5O_LINK_ID, <able.lnks[n], lnk)) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message"); } /* end else */ done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index"); if (ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_lookup_by_idx() */ @@ -725,9 +701,6 @@ H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Sept 25 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -739,13 +712,13 @@ H5G__dense_build_table_cb(const H5O_link_t *lnk, void *_udata) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(lnk); - HDassert(udata); - HDassert(udata->curr_lnk < udata->ltable->nlinks); + assert(lnk); + assert(udata); + assert(udata->curr_lnk < udata->ltable->nlinks); /* Copy link information */ if (H5O_msg_copy(H5O_LINK_ID, lnk, &(udata->ltable->lnks[udata->curr_lnk])) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy link message"); /* Increment number of links stored */ udata->curr_lnk++; @@ -765,9 +738,6 @@ H5G__dense_build_table_cb(const H5O_link_t *lnk, void *_udata) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Sep 25, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -779,9 +749,9 @@ H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(linfo); - HDassert(ltable); + assert(f); + assert(linfo); + assert(ltable); /* Set size of table */ H5_CHECK_OVERFLOW(linfo->nlinks, /* From: */ hsize_t, /* To: */ size_t); @@ -793,7 +763,7 @@ H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, /* Allocate the table to store the links */ if ((ltable->lnks = (H5O_link_t *)H5MM_malloc(sizeof(H5O_link_t) * ltable->nlinks)) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Set up user data for iteration */ udata.ltable = ltable; @@ -802,11 +772,11 @@ H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, /* Iterate over the links in the group, building a table of the link messages */ if (H5G__dense_iterate(f, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G__dense_build_table_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links") + HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links"); /* Sort link table in correct iteration order */ if (H5G__link_sort_table(ltable, idx_type, order) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages") + HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages"); } /* end if */ else ltable->lnks = NULL; @@ -823,9 +793,6 @@ H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -845,7 +812,7 @@ H5G__dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata) */ if (NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) - HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") + HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -858,9 +825,6 @@ H5G__dense_iterate_fh_cb(const void *obj, size_t obj_len, void *_udata) * * Return: H5_ITER_ERROR/H5_ITER_CONT/H5_ITER_STOP * - * Programmer: Quincey Koziol - * Sep 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -884,7 +848,7 @@ H5G__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) /* Call fractal heap 'op' routine, to copy the link information */ if (H5HF_op(bt2_udata->fheap, record->id, H5G__dense_iterate_fh_cb, &fh_udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, H5_ITER_ERROR, "heap op callback failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, H5_ITER_ERROR, "heap op callback failed"); /* Make the callback */ ret_value = (bt2_udata->op)(fh_udata.lnk, bt2_udata->op_data); @@ -912,9 +876,6 @@ H5G__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -932,9 +893,9 @@ H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_i /* * Check arguments. */ - HDassert(f); - HDassert(linfo); - HDassert(op); + assert(f); + assert(linfo); + assert(op); /* Determine the address of the index to use */ if (idx_type == H5_INDEX_NAME) { @@ -945,7 +906,7 @@ H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_i bt2_addr = HADDR_UNDEF; } /* end if */ else { - HDassert(idx_type == H5_INDEX_CRT_ORDER); + assert(idx_type == H5_INDEX_CRT_ORDER); /* This address may not be defined if creation order is tracked, but * there's no index on it. If there's no v2 B-tree that indexes @@ -959,8 +920,8 @@ H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_i * use the B-tree for names instead of building a table to speed up the * process. */ - if (order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) { - HDassert(H5F_addr_defined(linfo->name_bt2_addr)); + if (order == H5_ITER_NATIVE && !H5_addr_defined(bt2_addr)) { + assert(H5_addr_defined(linfo->name_bt2_addr)); bt2_addr = linfo->name_bt2_addr; } /* end if */ @@ -969,15 +930,15 @@ H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_i H5G_bt2_ud_it_t udata; /* User data for iterator callback */ /* Sanity check */ - HDassert(H5F_addr_defined(bt2_addr)); + assert(H5_addr_defined(bt2_addr)); /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, linfo->fheap_addr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index"); /* Construct the user data for v2 B-tree iterator callback */ udata.f = f; @@ -999,7 +960,7 @@ H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_i else { /* Build the table of links for this group */ if (H5G__dense_build_table(f, linfo, idx_type, order, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links"); /* Iterate over links in table */ if ((ret_value = H5G__link_iterate_table(<able, skip, last_lnk, op, op_data)) < 0) @@ -1009,11 +970,11 @@ H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_i done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index"); if (ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_iterate() */ @@ -1026,9 +987,6 @@ H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type, H5_i * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 19 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1043,7 +1001,7 @@ H5G__dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) /* Decode link information */ if (NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) - HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") + HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link"); /* Get the length of the name */ udata->name_len = HDstrlen(lnk->name); @@ -1069,9 +1027,6 @@ H5G__dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 19 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1092,7 +1047,7 @@ H5G__dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata) /* Call fractal heap 'op' routine, to perform user callback */ if (H5HF_op(bt2_udata->fheap, record->id, H5G__dense_get_name_by_idx_fh_cb, &fh_udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link found callback failed"); /* Set the name's full length to return */ bt2_udata->name_len = fh_udata.name_len; @@ -1108,9 +1063,6 @@ H5G__dense_get_name_by_idx_bt2_cb(const void *_record, void *_bt2_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 19 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1128,8 +1080,8 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5 /* * Check arguments. */ - HDassert(f); - HDassert(linfo); + assert(f); + assert(linfo); /* Determine the address of the index to use */ if (idx_type == H5_INDEX_NAME) { @@ -1140,7 +1092,7 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5 bt2_addr = HADDR_UNDEF; } /* end if */ else { - HDassert(idx_type == H5_INDEX_CRT_ORDER); + assert(idx_type == H5_INDEX_CRT_ORDER); /* This address may not be defined if creation order is tracked, but * there's no index on it. If there's no v2 B-tree that indexes @@ -1154,22 +1106,22 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5 * use the B-tree for names instead of building a table to speed up the * process. */ - if (order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) { + if (order == H5_ITER_NATIVE && !H5_addr_defined(bt2_addr)) { bt2_addr = linfo->name_bt2_addr; - HDassert(H5F_addr_defined(bt2_addr)); + assert(H5_addr_defined(bt2_addr)); } /* end if */ /* If there is an index defined for the field, use it */ - if (H5F_addr_defined(bt2_addr)) { + if (H5_addr_defined(bt2_addr)) { H5G_bt2_ud_gnbi_t udata; /* User data for v2 B-tree callback */ /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, linfo->fheap_addr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index"); /* Set up the user data for the v2 B-tree 'record remove' callback */ udata.f = f; @@ -1179,7 +1131,7 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5 /* Retrieve the name according to the v2 B-tree's index order */ if (H5B2_index(bt2, order, n, H5G__dense_get_name_by_idx_bt2_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree") + HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree"); /* Set return value */ *name_len = udata.name_len; @@ -1187,11 +1139,11 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5 else { /* Otherwise, we need to build a table of the links and sort it */ /* Build the table of links for this group */ if (H5G__dense_build_table(f, linfo, idx_type, order, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links"); /* Check for going out of bounds */ if (n >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound"); /* Get the length of the name */ *name_len = HDstrlen(ltable.lnks[n].name); @@ -1207,11 +1159,11 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5 done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index"); if (ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_get_name_by_idx() */ @@ -1223,9 +1175,6 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5 * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 12 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1241,40 +1190,40 @@ H5G__dense_remove_fh_cb(const void *obj, size_t obj_len, void *_udata) /* Decode link information */ if (NULL == (lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) - HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link") + HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link"); /* Check for removing the link from the creation order index */ - if (H5F_addr_defined(udata->corder_bt2_addr)) { + if (H5_addr_defined(udata->corder_bt2_addr)) { H5G_bt2_ud_common_t bt2_udata; /* Info for B-tree callbacks */ /* Open the creation order index v2 B-tree */ if (NULL == (bt2 = H5B2_open(udata->f, udata->corder_bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index"); /* Set up the user data for the v2 B-tree 'record remove' callback */ - HDassert(lnk->corder_valid); + assert(lnk->corder_valid); bt2_udata.corder = lnk->corder; /* Remove the record from the name index v2 B-tree */ if (H5B2_remove(bt2, &bt2_udata, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, - "unable to remove link from creation order index v2 B-tree") + "unable to remove link from creation order index v2 B-tree"); } /* end if */ /* Replace open objects' names, if requested */ if (udata->replace_names) if (H5G__link_name_replace(udata->f, udata->grp_full_path_r, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRENAME, FAIL, "unable to rename open objects") + HGOTO_ERROR(H5E_SYM, H5E_CANTRENAME, FAIL, "unable to rename open objects"); /* Perform the deletion action on the link, if requested */ /* (call message "delete" callback directly: *ick* - QAK) */ if (H5O_link_delete(udata->f, NULL, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link"); done: /* Release resources */ if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for creation order index"); if (lnk) H5O_msg_free(H5O_LINK_ID, lnk); @@ -1288,9 +1237,6 @@ H5G__dense_remove_fh_cb(const void *obj, size_t obj_len, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 12 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1311,12 +1257,12 @@ H5G__dense_remove_bt2_cb(const void *_record, void *_bt2_udata) /* Call fractal heap 'op' routine, to perform user callback */ if (H5HF_op(bt2_udata->common.fheap, record->id, H5G__dense_remove_fh_cb, &fh_udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link removal callback failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link removal callback failed"); /* Remove record from fractal heap, if requested */ if (bt2_udata->rem_from_fheap) if (H5HF_remove(bt2_udata->common.fheap, record->id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from fractal heap"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1329,9 +1275,6 @@ H5G__dense_remove_bt2_cb(const void *_record, void *_bt2_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 12 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1347,17 +1290,17 @@ H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_ /* * Check arguments. */ - HDassert(f); - HDassert(linfo); - HDassert(name && *name); + assert(f); + assert(linfo); + assert(name && *name); /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, linfo->fheap_addr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Open the name index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, linfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Set up the user data for the v2 B-tree 'record remove' callback */ udata.common.f = f; @@ -1373,14 +1316,14 @@ H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_ /* Remove the record from the name index v2 B-tree */ if (H5B2_remove(bt2, &udata, H5G__dense_remove_bt2_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from name index v2 B-tree") + HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from name index v2 B-tree"); done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_remove() */ @@ -1392,9 +1335,6 @@ H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Nov 15 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1408,7 +1348,7 @@ H5G__dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) /* Decode link information */ if (NULL == (udata->lnk = (H5O_link_t *)H5O_msg_decode(udata->f, NULL, H5O_LINK_ID, obj_len, (const unsigned char *)obj))) - HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, H5_ITER_ERROR, "can't decode link") + HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, H5_ITER_ERROR, "can't decode link"); /* Can't operate on link here because the fractal heap block is locked */ @@ -1423,9 +1363,6 @@ H5G__dense_remove_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 15 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1449,7 +1386,7 @@ H5G__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) else { const H5G_dense_bt2_corder_rec_t *record = (const H5G_dense_bt2_corder_rec_t *)_record; - HDassert(bt2_udata->idx_type == H5_INDEX_CRT_ORDER); + assert(bt2_udata->idx_type == H5_INDEX_CRT_ORDER); /* Set the heap ID to operate on */ heap_id = record->id; @@ -1461,11 +1398,11 @@ H5G__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) /* Call fractal heap 'op' routine, to perform user callback */ if (H5HF_op(bt2_udata->fheap, heap_id, H5G__dense_remove_by_idx_fh_cb, &fh_udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link removal callback failed") - HDassert(fh_udata.lnk); + HGOTO_ERROR(H5E_SYM, H5E_CANTOPERATE, FAIL, "link removal callback failed"); + assert(fh_udata.lnk); /* Check for removing the link from the "other" index (creation order, when name used and vice versa) */ - if (H5F_addr_defined(bt2_udata->other_bt2_addr)) { + if (H5_addr_defined(bt2_udata->other_bt2_addr)) { H5G_bt2_ud_common_t other_bt2_udata; /* Info for B-tree callbacks */ /* Determine the index being used */ @@ -1474,7 +1411,7 @@ H5G__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) other_bt2_udata.corder = fh_udata.lnk->corder; } /* end if */ else { - HDassert(bt2_udata->idx_type == H5_INDEX_CRT_ORDER); + assert(bt2_udata->idx_type == H5_INDEX_CRT_ORDER); /* Set up the user data for the v2 B-tree 'record remove' callback */ other_bt2_udata.f = bt2_udata->f; @@ -1488,36 +1425,36 @@ H5G__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(bt2_udata->f, bt2_udata->other_bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for 'other' index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for 'other' index"); /* Set the common information for the v2 B-tree remove operation */ /* Remove the record from the name index v2 B-tree */ if (H5B2_remove(bt2, &other_bt2_udata, NULL, NULL) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, H5_ITER_ERROR, - "unable to remove link from 'other' index v2 B-tree") + "unable to remove link from 'other' index v2 B-tree"); } /* end if */ /* Replace open objects' names */ if (H5G__link_name_replace(bt2_udata->f, bt2_udata->grp_full_path_r, fh_udata.lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRENAME, FAIL, "unable to rename open objects") + HGOTO_ERROR(H5E_SYM, H5E_CANTRENAME, FAIL, "unable to rename open objects"); /* Perform the deletion action on the link */ /* (call link message "delete" callback directly: *ick* - QAK) */ if (H5O_link_delete(bt2_udata->f, NULL, fh_udata.lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link"); /* Release the space allocated for the link */ H5O_msg_free(H5O_LINK_ID, fh_udata.lnk); /* Remove record from fractal heap */ if (H5HF_remove(bt2_udata->fheap, heap_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from fractal heap"); done: /* Release resources */ if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for 'other' index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for 'other' index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_remove_by_idx_bt2_cb() */ @@ -1530,9 +1467,6 @@ H5G__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1550,8 +1484,8 @@ H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_ful /* * Check arguments. */ - HDassert(f); - HDassert(linfo); + assert(f); + assert(linfo); /* Determine the address of the index to use */ if (idx_type == H5_INDEX_NAME) { @@ -1562,7 +1496,7 @@ H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_ful bt2_addr = HADDR_UNDEF; } /* end if */ else { - HDassert(idx_type == H5_INDEX_CRT_ORDER); + assert(idx_type == H5_INDEX_CRT_ORDER); /* This address may not be defined if creation order is tracked, but * there's no index on it. If there's no v2 B-tree that indexes @@ -1576,22 +1510,22 @@ H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_ful * use the B-tree for names instead of building a table to speed up the * process. */ - if (order == H5_ITER_NATIVE && !H5F_addr_defined(bt2_addr)) { + if (order == H5_ITER_NATIVE && !H5_addr_defined(bt2_addr)) { bt2_addr = linfo->name_bt2_addr; - HDassert(H5F_addr_defined(bt2_addr)); + assert(H5_addr_defined(bt2_addr)); } /* end if */ /* If there is an index defined for the field, use it */ - if (H5F_addr_defined(bt2_addr)) { + if (H5_addr_defined(bt2_addr)) { H5G_bt2_ud_rmbi_t udata; /* User data for v2 B-tree record removal */ /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, linfo->fheap_addr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for index"); /* Set up the user data for the v2 B-tree 'remove by index' callback */ udata.f = f; @@ -1602,30 +1536,30 @@ H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_ful /* Remove the record from the name index v2 B-tree */ if (H5B2_remove_by_idx(bt2, order, n, H5G__dense_remove_by_idx_bt2_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from indexed v2 B-tree") + HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from indexed v2 B-tree"); } /* end if */ else { /* Otherwise, we need to build a table of the links and sort it */ /* Build the table of links for this group */ if (H5G__dense_build_table(f, linfo, idx_type, order, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "error building table of links"); /* Check for going out of bounds */ if (n >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound"); /* Remove the appropriate link from the dense storage */ if (H5G__dense_remove(f, linfo, grp_full_path_r, ltable.lnks[n].name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from dense storage") + HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from dense storage"); } /* end else */ done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for index"); if (ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__dense_remove_by_idx() */ @@ -1637,9 +1571,6 @@ H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_ful * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 12 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1652,8 +1583,8 @@ H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link) /* * Check arguments. */ - HDassert(f); - HDassert(linfo); + assert(f); + assert(linfo); /* Check if we are to adjust the ref. count for all the links */ /* (we adjust the ref. count when deleting a group and we _don't_ adjust @@ -1665,7 +1596,7 @@ H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link) /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, linfo->fheap_addr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Set up the user data for the v2 B-tree 'record remove' callback */ udata.common.f = f; @@ -1681,33 +1612,33 @@ H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link) /* Delete the name index, adjusting the ref. count on links removed */ if (H5B2_delete(f, linfo->name_bt2_addr, NULL, H5G__dense_remove_bt2_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index"); /* Close the fractal heap */ if (H5HF_close(fheap) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close fractal heap"); } /* end if */ else { /* Delete the name index, without adjusting the ref. count on the links */ if (H5B2_delete(f, linfo->name_bt2_addr, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for name index"); } /* end else */ linfo->name_bt2_addr = HADDR_UNDEF; /* Check if we should delete the creation order index v2 B-tree */ if (linfo->index_corder) { /* Delete the creation order index, without adjusting the ref. count on the links */ - HDassert(H5F_addr_defined(linfo->corder_bt2_addr)); + assert(H5_addr_defined(linfo->corder_bt2_addr)); if (H5B2_delete(f, linfo->corder_bt2_addr, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete v2 B-tree for creation order index"); linfo->corder_bt2_addr = HADDR_UNDEF; } /* end if */ else - HDassert(!H5F_addr_defined(linfo->corder_bt2_addr)); + assert(!H5_addr_defined(linfo->corder_bt2_addr)); /* Delete the fractal heap */ if (H5HF_delete(f, linfo->fheap_addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete fractal heap"); linfo->fheap_addr = HADDR_UNDEF; done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gdeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gdeprec.c index 43b6cafff4..79a5fce8a9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gdeprec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gdeprec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gdeprec.c - * June 21 2006 - * James Laird * * Purpose: Deprecated functions from the H5G interface. These * functions are here for compatibility purposes and may be @@ -95,9 +92,6 @@ static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc /*in*/, const char *name, c * * Return: Object type (can't fail) * - * Programmer: Quincey Koziol - * Tuesday, November 21, 2006 - * *------------------------------------------------------------------------- */ H5G_obj_t @@ -154,9 +148,6 @@ H5G_map_obj_type(H5O_type_t obj_type) * * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Wednesday, September 24, 1997 - * *------------------------------------------------------------------------- */ hid_t @@ -173,9 +164,9 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name given"); if (size_hint > UINT32_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "size_hint cannot be larger than UINT32_MAX") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "size_hint cannot be larger than UINT32_MAX"); /* Check if we need to create a non-standard GCPL */ if (size_hint > 0) { @@ -184,31 +175,31 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) /* Get the default property list */ if (NULL == (gc_plist = (H5P_genplist_t *)H5I_object(H5P_GROUP_CREATE_DEFAULT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); /* Make a copy of the default property list */ if ((tmp_gcpl = H5P_copy_plist(gc_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list"); /* Get pointer to the copied property list */ if (NULL == (gc_plist = (H5P_genplist_t *)H5I_object(tmp_gcpl))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); /* Get the group info property */ if (H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get group info"); /* Set the non-default local heap size hint */ H5_CHECKED_ASSIGN(ginfo.lheap_size_hint, uint32_t, size_hint, size_t); if (H5P_set(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info"); } else tmp_gcpl = H5P_GROUP_CREATE_DEFAULT; /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, H5I_INVALID_HID, "can't set collective metadata read info"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -216,26 +207,26 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Create the group */ if (NULL == (grp = H5VL_group_create(vol_obj, &loc_params, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group"); /* Get an ID for the group */ if ((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group"); done: if (H5I_INVALID_HID != tmp_gcpl && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT) if (H5I_dec_ref(tmp_gcpl) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release property list"); if (H5I_INVALID_HID == ret_value) if (grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group"); FUNC_LEAVE_API(ret_value) } /* end H5Gcreate1() */ @@ -252,9 +243,6 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) * * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Wednesday, December 31, 1997 - * *------------------------------------------------------------------------- */ hid_t @@ -270,7 +258,7 @@ H5Gopen1(hid_t loc_id, const char *name) /* Check args */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -278,21 +266,21 @@ H5Gopen1(hid_t loc_id, const char *name) /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Open the group */ if (NULL == (grp = H5VL_group_open(vol_obj, &loc_params, name, H5P_GROUP_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open group"); /* Get an ID for the group */ if ((ret_value = H5VL_register(H5I_GROUP, grp, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group") + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group"); done: if (H5I_INVALID_HID == ret_value) if (grp && H5VL_group_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release group"); FUNC_LEAVE_API(ret_value) } /* end H5Gopen1() */ @@ -316,13 +304,13 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Check arguments */ if (!cur_name || !*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified"); if (!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(cur_loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Create link */ if (type == H5L_TYPE_HARD) { @@ -337,7 +325,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Construct a temporary VOL object */ tmp_vol_obj.data = NULL; @@ -354,7 +342,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Create the link through the VOL */ if (H5VL_link_create(&vol_cb_args, &tmp_vol_obj, &new_loc_params, H5P_LINK_CREATE_DEFAULT, H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link"); } /* end if */ else if (type == H5L_TYPE_SOFT) { H5VL_object_t *vol_obj; /* Object of loc_id */ @@ -368,7 +356,7 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_CREATE_SOFT; @@ -377,10 +365,10 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new /* Create the link through the VOL */ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT, H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link"); } /* end else-if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not a valid link type"); done: FUNC_LEAVE_API(ret_value) @@ -405,13 +393,13 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_ /* Check arguments */ if (!cur_name || !*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified"); if (!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(cur_loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Create the appropriate kind of link */ if (type == H5L_TYPE_HARD) { @@ -427,9 +415,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_ /* Get the location objects */ if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(new_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_CREATE_HARD; @@ -442,7 +430,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_ /* Create the link through the VOL */ if (H5VL_link_create(&vol_cb_args, vol_obj2, &new_loc_params, H5P_LINK_CREATE_DEFAULT, H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link"); } /* end if */ else if (type == H5L_TYPE_SOFT) { H5VL_object_t *vol_obj; /* Object of loc_id */ @@ -461,7 +449,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_ /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_CREATE_SOFT; @@ -470,10 +458,10 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_ /* Create the link through the VOL */ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT, H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link"); } /* end else-if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid link type"); done: FUNC_LEAVE_API(ret_value) @@ -499,7 +487,7 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) /* Set up collective metadata if appropriate */ if (H5CX_set_loc(src_loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); loc_params1.type = H5VL_OBJECT_BY_NAME; loc_params1.obj_type = H5I_get_type(src_loc_id); @@ -512,12 +500,12 @@ H5Gmove(hid_t src_loc_id, const char *src_name, const char *dst_name) /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(src_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Move the link */ if (H5VL_link_move(vol_obj, &loc_params1, NULL, &loc_params2, H5P_LINK_CREATE_DEFAULT, H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link") + HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "couldn't move link"); done: FUNC_LEAVE_API(ret_value) @@ -544,7 +532,7 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *d /* Set up collective metadata if appropriate */ if (H5CX_set_loc(dst_loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set location parameter for source object */ loc_params1.type = H5VL_OBJECT_BY_NAME; @@ -561,16 +549,16 @@ H5Gmove2(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *d if (H5L_SAME_LOC != src_loc_id) /* get the location object */ if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (H5L_SAME_LOC != dst_loc_id) /* get the location object */ if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Move the link */ if (H5VL_link_move(vol_obj1, &loc_params1, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT, H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link") + HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link"); done: FUNC_LEAVE_API(ret_value) @@ -596,11 +584,11 @@ H5Gunlink(hid_t loc_id, const char *name) /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.obj_type = H5I_get_type(loc_id); @@ -609,14 +597,14 @@ H5Gunlink(hid_t loc_id, const char *name) /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_DELETE; /* Delete the link */ if (H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link"); done: FUNC_LEAVE_API(ret_value) @@ -643,11 +631,11 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/) /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -657,7 +645,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/) /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_GET_VAL; @@ -666,7 +654,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/) /* Get the link value */ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value"); done: FUNC_LEAVE_API(ret_value) @@ -684,9 +672,6 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, July 20, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -702,11 +687,11 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) H5TRACE3("e", "i*s*s", loc_id, name, comment); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Fill in location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -716,7 +701,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ obj_opt_args.set_comment.comment = comment; @@ -726,7 +711,7 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) /* Set the comment */ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value"); done: FUNC_LEAVE_API(ret_value) @@ -750,9 +735,6 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment) * * Failure: Negative * - * Programmer: Robb Matzke - * Monday, July 20, 1998 - * *------------------------------------------------------------------------- */ int @@ -769,13 +751,13 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf /*out*/ H5TRACE4("Is", "i*szx", loc_id, name, bufsize, buf); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no name specified"); if (bufsize > 0 && !buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no buffer specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, -1, "no buffer specified"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, -1, "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, -1, "can't set collective metadata read info"); /* Fill in location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -785,7 +767,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf /*out*/ /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier"); /* Set up VOL callback arguments */ obj_opt_args.get_comment.buf = buf; @@ -797,7 +779,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf /*out*/ /* Get the comment */ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, -1, "unable to get comment value") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, -1, "unable to get comment value"); /* Set return value */ ret_value = (int)comment_len; @@ -844,15 +826,15 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *o /* Check args */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); if (idx_p && *idx_p < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified"); /* Get the object pointer */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier") + HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier"); /* Set up VOL callback arguments */ grp_opt_args.iterate_old.loc_params.type = H5VL_OBJECT_BY_NAME; @@ -890,9 +872,6 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *o * Return: Success: Non-negative * Failure: Negative * - * Programmer: Raymond Lu - * Nov 20, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -910,19 +889,19 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs /*out*/) /* Check args */ id_type = H5I_get_type(loc_id); if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid group (or file) ID"); if (!num_objs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects"); /* Set up VOL callback & object access arguments */ vol_cb_args.op_type = H5VL_GROUP_GET_INFO; if (H5VL_setup_self_args(loc_id, &vol_obj, &vol_cb_args.args.get_info.loc_params) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments"); vol_cb_args.args.get_info.ginfo = &grp_info; /* Retrieve the group's information */ if (H5VL_group_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info"); /* Set the number of objects [i.e. links] in the group */ *num_objs = grp_info.nlinks; @@ -943,9 +922,6 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs /*out*/) * Return: Non-negative on success, with the fields of STATBUF (if * non-null) initialized. Negative on failure. * - * Programmer: Robb Matzke - * Monday, April 13, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -956,12 +932,12 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t * H5VL_native_group_optional_args_t grp_opt_args; /* Arguments for optional operation */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL); + FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf); /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) @@ -986,7 +962,7 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t * HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Gget_objinfo() */ /*------------------------------------------------------------------------- @@ -997,9 +973,6 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 20, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -1033,11 +1006,11 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, /* Go retrieve the data model & native object information */ /* (don't need index & heap info) */ - HDassert(obj_loc); + assert(obj_loc); if (H5O_get_info(obj_loc->oloc, &dm_info, H5O_INFO_BASIC | H5O_INFO_TIME) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get data model object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get data model object info"); if (H5O_get_native_info(obj_loc->oloc, &nat_info, H5O_INFO_HDR) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get native object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get native object info"); /* Get mapped object type */ statbuf->type = H5G_map_obj_type(dm_info.type); @@ -1045,7 +1018,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, /* Get object number (i.e. address) for object */ if (H5VL_native_token_to_addr(obj_loc->oloc->file, H5I_FILE, dm_info.token, &obj_addr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); statbuf->objno[0] = (unsigned long)(obj_addr); #if H5_SIZEOF_UINT64_T > H5_SIZEOF_LONG @@ -1072,7 +1045,7 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, * location for the object */ *own_loc = H5G_OWN_NONE; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_objinfo_cb() */ /*------------------------------------------------------------------------- @@ -1086,9 +1059,6 @@ H5G__get_objinfo_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, * * Failure: Negative * - * Programmer: Robb Matzke - * Monday, April 13, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1097,15 +1067,15 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5 H5G_trav_goi_t udata; /* User data for callback */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE; + FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(loc); - HDassert(name && *name); + assert(loc); + assert(name && *name); /* Reset stat buffer */ if (statbuf) - HDmemset(statbuf, 0, sizeof(H5G_stat_t)); + memset(statbuf, 0, sizeof(H5G_stat_t)); /* Set up user data for retrieving information */ udata.statbuf = statbuf; @@ -1129,7 +1099,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5 { ret = H5L_get_info(loc, name, &linfo); } - H5E_END_TRY; + H5E_END_TRY if (ret >= 0 && linfo.type != H5L_TYPE_HARD) { statbuf->linklen = linfo.u.val_size; @@ -1138,14 +1108,14 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5 } else { /* UD link. H5L_get_info checked for invalid link classes */ - HDassert(linfo.type >= H5L_TYPE_UD_MIN && linfo.type <= H5L_TYPE_MAX); + assert(linfo.type >= H5L_TYPE_UD_MIN && linfo.type <= H5L_TYPE_MAX); statbuf->type = H5G_UDLINK; } } } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_objinfo() */ /*------------------------------------------------------------------------- @@ -1166,9 +1136,6 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link, H5 * Return: Success: Non-negative * Failure: Negative * - * Programmer: Raymond Lu - * Nov 20, 2002 - * *------------------------------------------------------------------------- */ ssize_t @@ -1185,7 +1152,7 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set collective metadata read info") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set collective metadata read info"); /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_IDX; @@ -1198,7 +1165,7 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_GET_NAME; @@ -1208,7 +1175,7 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size /* Call internal function */ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name"); /* Set the return value */ ret_value = (ssize_t)name_len; @@ -1227,9 +1194,6 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size * Return: Success: H5G_GROUP(1), H5G_DATASET(2), H5G_TYPE(3) * Failure: H5G_UNKNOWN * - * Programmer: Raymond Lu - * Nov 20, 2002 - * *------------------------------------------------------------------------- */ H5G_obj_t @@ -1255,7 +1219,7 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO; @@ -1264,11 +1228,11 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) /* Retrieve the object's basic information (which includes its type) */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info"); /* Map to group object type */ if (H5G_UNKNOWN == (ret_value = H5G_map_obj_type(oinfo.type))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't determine object type"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gent.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gent.c index 811e010ff9..02b4c8a380 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gent.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gent.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,11 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Robb Matzke - * Friday, September 19, 1997 - */ - /****************/ /* Module Setup */ /****************/ @@ -72,9 +66,6 @@ * * Failure: Negative * - * Programmer: Robb Matzke - * Jul 18 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -86,16 +77,16 @@ H5G__ent_decode_vec(const H5F_t *f, const uint8_t **pp, const uint8_t *p_end, H5 FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); - HDassert(pp); - HDassert(ent); + assert(f); + assert(pp); + assert(ent); /* decode entries */ for (u = 0; u < n; u++) { if (*pp > p_end) - HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "ran off the end of the image buffer") - if (H5G_ent_decode(f, pp, ent + u) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode") + HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "ran off the end of the image buffer"); + if (H5G_ent_decode(f, pp, ent + u, p_end) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode"); } done: @@ -112,13 +103,10 @@ H5G__ent_decode_vec(const H5F_t *f, const uint8_t **pp, const uint8_t *p_end, H5 * * Failure: Negative * - * Programmer: Robb Matzke - * Jul 18 1997 - * *------------------------------------------------------------------------- */ herr_t -H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) +H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, const uint8_t *p_end) { const uint8_t *p_ret = *pp; uint32_t tmp; @@ -127,15 +115,26 @@ H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) FUNC_ENTER_NOAPI(FAIL) /* check arguments */ - HDassert(f); - HDassert(pp); - HDassert(ent); + assert(f); + assert(pp); + assert(ent); + + if (H5_IS_BUFFER_OVERFLOW(*pp, ent->name_off, p_end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "image pointer is out of bounds"); /* decode header */ H5F_DECODE_LENGTH(f, *pp, ent->name_off); + + if (H5_IS_BUFFER_OVERFLOW(*pp, H5F_SIZEOF_ADDR(f) + sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "image pointer is out of bounds"); + H5F_addr_decode(f, pp, &(ent->header)); UINT32DECODE(*pp, tmp); *pp += 4; /*reserved*/ + + if (H5_IS_BUFFER_OVERFLOW(*pp, 1, p_end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "image pointer is out of bounds"); + ent->type = (H5G_cache_type_t)tmp; /* decode scratch-pad */ @@ -144,19 +143,23 @@ H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) break; case H5G_CACHED_STAB: - HDassert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH); + assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH); + if (H5_IS_BUFFER_OVERFLOW(*pp, H5F_SIZEOF_ADDR(f) * 2, p_end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "image pointer is out of bounds"); H5F_addr_decode(f, pp, &(ent->cache.stab.btree_addr)); H5F_addr_decode(f, pp, &(ent->cache.stab.heap_addr)); break; case H5G_CACHED_SLINK: + if (H5_IS_BUFFER_OVERFLOW(*pp, sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_FILE, H5E_OVERFLOW, FAIL, "image pointer is out of bounds"); UINT32DECODE(*pp, ent->cache.slink.lval_offset); break; case H5G_CACHED_ERROR: case H5G_NCACHED: default: - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown symbol table entry cache type") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown symbol table entry cache type"); } /* end switch */ *pp = p_ret + H5G_SIZEOF_ENTRY_FILE(f); @@ -176,9 +179,6 @@ H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) * * Failure: Negative * - * Programmer: Robb Matzke - * Jul 18 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -190,14 +190,14 @@ H5G__ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsign FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); - HDassert(pp); - HDassert(ent); + assert(f); + assert(pp); + assert(ent); /* encode entries */ for (u = 0; u < n; u++) if (H5G_ent_encode(f, pp, ent + u) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode") + HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -214,9 +214,6 @@ H5G__ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsign * * Failure: Negative * - * Programmer: Robb Matzke - * Jul 18 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -228,8 +225,8 @@ H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) FUNC_ENTER_NOAPI(FAIL) /* check arguments */ - HDassert(f); - HDassert(pp); + assert(f); + assert(pp); /* Check for actual entry to encode */ if (ent) { @@ -245,7 +242,7 @@ H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) break; case H5G_CACHED_STAB: - HDassert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH); + assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH); H5F_addr_encode(f, pp, ent->cache.stab.btree_addr); H5F_addr_encode(f, pp, ent->cache.stab.heap_addr); break; @@ -257,7 +254,7 @@ H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) case H5G_CACHED_ERROR: case H5G_NCACHED: default: - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown symbol table entry cache type") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown symbol table entry cache type"); } /* end switch */ } /* end if */ else { @@ -269,7 +266,7 @@ H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) /* fill with zero */ if (*pp < p_ret) - HDmemset(*pp, 0, (size_t)(p_ret - *pp)); + memset(*pp, 0, (size_t)(p_ret - *pp)); *pp = p_ret; done: @@ -284,9 +281,6 @@ H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Pedro Vicente - * ???day, August ??, 2002 - * * Notes: 'depth' parameter determines how much of the group entry * structure we want to copy. The values are: * H5_COPY_SHALLOW - Copy all the fields from the source @@ -305,9 +299,9 @@ H5G__ent_copy(H5G_entry_t *dst, H5G_entry_t *src, H5_copy_depth_t depth) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(src); - HDassert(dst); - HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP); + assert(src); + assert(dst); + assert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP); /* Copy the top level information */ H5MM_memcpy(dst, src, sizeof(H5G_entry_t)); @@ -315,7 +309,6 @@ H5G__ent_copy(H5G_entry_t *dst, H5G_entry_t *src, H5_copy_depth_t depth) /* Deep copy the names */ if (depth == H5_COPY_DEEP) { /* Nothing currently */ - ; } else if (depth == H5_COPY_SHALLOW) { H5G__ent_reset(src); @@ -332,9 +325,6 @@ H5G__ent_copy(H5G_entry_t *dst, H5G_entry_t *src, H5_copy_depth_t depth) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * ?day, August ??, 2005 - * *------------------------------------------------------------------------- */ void @@ -343,10 +333,10 @@ H5G__ent_reset(H5G_entry_t *ent) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(ent); + assert(ent); /* Clear the symbol table entry to an empty state */ - HDmemset(ent, 0, sizeof(H5G_entry_t)); + memset(ent, 0, sizeof(H5G_entry_t)); ent->header = HADDR_UNDEF; FUNC_LEAVE_NOAPI_VOID @@ -360,9 +350,6 @@ H5G__ent_reset(H5G_entry_t *ent) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Sep 20 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -375,17 +362,17 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); - HDassert(heap); - HDassert(name); - HDassert(lnk); + assert(f); + assert(heap); + assert(name); + assert(lnk); /* Reset the new entry */ H5G__ent_reset(ent); /* Add the new name to the heap */ if (H5HL_insert(f, heap, HDstrlen(name) + 1, name, &name_offset) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap"); ent->name_off = name_offset; /* Build correct information for symbol table entry based on link type */ @@ -406,15 +393,15 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk /* Build target object location */ if (H5O_loc_reset(&targ_oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location") + HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location"); targ_oloc.file = f; targ_oloc.addr = lnk->u.hard.addr; /* Check if a symbol table message exists */ if ((stab_exists = H5O_msg_exists(&targ_oloc, H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for STAB message") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for STAB message"); - HDassert(!stab_exists); + assert(!stab_exists); } /* end else */ #endif /* NDEBUG */ } /* end if */ @@ -427,19 +414,19 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk /* Build target object location */ if (H5O_loc_reset(&targ_oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location") + HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location"); targ_oloc.file = f; targ_oloc.addr = lnk->u.hard.addr; /* Get the object header */ if (NULL == (oh = H5O_protect(&targ_oloc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_SYM, H5E_CANTPROTECT, FAIL, "unable to protect target object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTPROTECT, FAIL, "unable to protect target object header"); /* Check if a symbol table message exists */ if ((stab_exists = H5O_msg_exists_oh(oh, H5O_STAB_ID)) < 0) { if (H5O_unprotect(&targ_oloc, oh, H5AC__NO_FLAGS_SET) < 0) HERROR(H5E_SYM, H5E_CANTUNPROTECT, "unable to release object header"); - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for STAB message") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to check for STAB message"); } /* end if */ if (stab_exists) { @@ -447,7 +434,7 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk if (NULL == H5O_msg_read_oh(f, oh, H5O_STAB_ID, &stab)) { if (H5O_unprotect(&targ_oloc, oh, H5AC__NO_FLAGS_SET) < 0) HERROR(H5E_SYM, H5E_CANTUNPROTECT, "unable to release object header"); - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read STAB message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read STAB message"); } /* end if */ /* Cache symbol table message */ @@ -460,7 +447,7 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk ent->type = H5G_NOTHING_CACHED; if (H5O_unprotect(&targ_oloc, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); } /* end else */ else ent->type = H5G_NOTHING_CACHED; @@ -473,7 +460,7 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk /* Insert link value into local heap */ if (H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap"); ent->type = H5G_CACHED_SLINK; ent->cache.slink.lval_offset = lnk_offset; @@ -483,7 +470,7 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk case H5L_TYPE_EXTERNAL: case H5L_TYPE_MAX: default: - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type"); } /* end switch */ done: @@ -497,9 +484,6 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 29 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -514,47 +498,47 @@ H5G__ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, con nested_indent = indent + 3; nested_fwidth = MAX(0, fwidth - 3); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Name offset into private heap:", (unsigned long)(ent->name_off)); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Name offset into private heap:", (unsigned long)(ent->name_off)); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object header address:", ent->header); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object header address:", ent->header); - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Cache info type:"); + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Cache info type:"); switch (ent->type) { case H5G_NOTHING_CACHED: - HDfprintf(stream, "Nothing Cached\n"); + fprintf(stream, "Nothing Cached\n"); break; case H5G_CACHED_STAB: - HDfprintf(stream, "Symbol Table\n"); + fprintf(stream, "Symbol Table\n"); - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Cached entry information:"); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", nested_indent, "", nested_fwidth, - "B-tree address:", ent->cache.stab.btree_addr); + fprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Cached entry information:"); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", nested_indent, "", nested_fwidth, + "B-tree address:", ent->cache.stab.btree_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", nested_indent, "", nested_fwidth, - "Heap address:", ent->cache.stab.heap_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", nested_indent, "", nested_fwidth, + "Heap address:", ent->cache.stab.heap_addr); break; case H5G_CACHED_SLINK: - HDfprintf(stream, "Symbolic Link\n"); - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Cached information:"); - HDfprintf(stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth, - "Link value offset:", (unsigned long)(ent->cache.slink.lval_offset)); + fprintf(stream, "Symbolic Link\n"); + fprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Cached information:"); + fprintf(stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth, + "Link value offset:", (unsigned long)(ent->cache.slink.lval_offset)); if (heap) { lval = (const char *)H5HL_offset_into(heap, ent->cache.slink.lval_offset); - HDfprintf(stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth, - "Link value:", (lval == NULL) ? "" : lval); + fprintf(stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth, + "Link value:", (lval == NULL) ? "" : lval); } /* end if */ else - HDfprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, - "Warning: Invalid heap address given, name not displayed!"); + fprintf(stream, "%*s%-*s\n", nested_indent, "", nested_fwidth, + "Warning: Invalid heap address given, name not displayed!"); break; case H5G_CACHED_ERROR: case H5G_NCACHED: default: - HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type); + fprintf(stream, "*** Unknown symbol type %d\n", ent->type); break; } /* end switch */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gint.c index d3b6ccf030..1a9b335143 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gint.c - * April 5 2007 - * Quincey Koziol * * Purpose: General use, "internal" routines for groups. * @@ -132,7 +129,7 @@ H5G_init(void) FUNC_ENTER_NOAPI(FAIL) /* Initialize the ID group for the group IDs */ if (H5I_register_type(H5I_GROUP_CLS) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to initialize interface"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -147,9 +144,6 @@ H5G_init(void) * affect other interfaces; zero otherwise. * Failure: Negative. * - * Programmer: Quincey Koziol - * Sunday, September 13, 2015 - * *------------------------------------------------------------------------- */ int @@ -179,9 +173,6 @@ H5G_top_term_package(void) * affect other interfaces; zero otherwise. * Failure: Negative. * - * Programmer: Robb Matzke - * Monday, January 5, 1998 - * *------------------------------------------------------------------------- */ int @@ -192,7 +183,7 @@ H5G_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(0 == H5I_nmembers(H5I_GROUP)); + assert(0 == H5I_nmembers(H5I_GROUP)); /* Destroy the group object id group */ n += (H5I_dec_type_ref(H5I_GROUP) > 0); @@ -217,15 +208,15 @@ H5G__close_cb(H5VL_object_t *grp_vol_obj, void **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(grp_vol_obj); + assert(grp_vol_obj); /* Close the group */ if (H5VL_group_close(grp_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group") + HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to close group"); /* Free the VOL object */ if (H5VL_free_object(grp_vol_obj) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to free VOL object") + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to free VOL object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -240,9 +231,6 @@ H5G__close_cb(H5VL_object_t *grp_vol_obj, void **request) * * Failure: NULL * - * Programmer: Quincey Koziol - * April 5, 2007 - * *------------------------------------------------------------------------- */ H5G_t * @@ -255,15 +243,15 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t g FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - HDassert(lcpl_id != H5P_DEFAULT); - HDassert(gcpl_id != H5P_DEFAULT); + assert(loc); + assert(name && *name); + assert(lcpl_id != H5P_DEFAULT); + assert(gcpl_id != H5P_DEFAULT); /* Set up group creation info */ gcrt_info.gcpl_id = gcpl_id; gcrt_info.cache_type = H5G_NOTHING_CACHED; - HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); + memset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Set up object creation information */ ocrt_info.obj_type = H5O_TYPE_GROUP; @@ -272,8 +260,8 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t g /* Create the new group and link it to its parent group */ if (H5L_link_object(loc, name, &ocrt_info, lcpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create and link to group") - HDassert(ocrt_info.new_obj); + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create and link to group"); + assert(ocrt_info.new_obj); /* Set the return value */ ret_value = (H5G_t *)ocrt_info.new_obj; @@ -294,9 +282,6 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id, hid_t g * * Failure: NULL * - * Programmer: Robb Matzke - * Aug 11 1997 - * *------------------------------------------------------------------------- */ H5G_t * @@ -309,25 +294,25 @@ H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info) FUNC_ENTER_PACKAGE /* check args */ - HDassert(file); - HDassert(gcrt_info->gcpl_id != H5P_DEFAULT); + assert(file); + assert(gcrt_info->gcpl_id != H5P_DEFAULT); /* create an open group */ if (NULL == (grp = H5FL_CALLOC(H5G_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); if (NULL == (grp->shared = H5FL_CALLOC(H5G_shared_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Create the group object header */ if (H5G__obj_create(file, gcrt_info, &(grp->oloc) /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group object header"); oloc_init = 1; /* Indicate that the object location information is valid */ /* Add group to list of open objects in file */ if (H5FO_top_incr(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't incr object ref. count") + HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't incr object ref. count"); if (H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, TRUE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects"); /* Set the count of times the object is opened */ grp->shared->fo_count = 1; @@ -341,11 +326,11 @@ H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info) if (oloc_init) { if (H5O_dec_rc_by_loc(&(grp->oloc)) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, - "unable to decrement refcount on newly created object") + "unable to decrement refcount on newly created object"); if (H5O_close(&(grp->oloc), NULL) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release object header") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release object header"); if (H5O_delete(file, grp->oloc.addr) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, NULL, "unable to delete object header") + HDONE_ERROR(H5E_SYM, H5E_CANTDELETE, NULL, "unable to delete object header"); } /* end if */ if (grp != NULL) { if (grp->shared != NULL) @@ -365,9 +350,6 @@ H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info) * Return: Success: Ptr to a new group. * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, August 27, 2007 - * *------------------------------------------------------------------------- */ H5G_t * @@ -384,8 +366,8 @@ H5G__open_name(const H5G_loc_t *loc, const char *name) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(loc); - HDassert(name); + assert(loc); + assert(name); /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -394,18 +376,18 @@ H5G__open_name(const H5G_loc_t *loc, const char *name) /* Find the group object */ if (H5G_loc_find(loc, name, &grp_loc /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "group not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "group not found"); loc_found = TRUE; /* Check that the object found is the correct type */ if (H5O_obj_type(&grp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't get object type") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't get object type"); if (obj_type != H5O_TYPE_GROUP) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, NULL, "not a group") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, NULL, "not a group"); /* Open the group */ if (NULL == (grp = H5G_open(&grp_loc))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group"); /* Set return value */ ret_value = grp; @@ -413,7 +395,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name) done: if (!ret_value) if (loc_found && H5G_loc_free(&grp_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__open_name() */ @@ -428,9 +410,6 @@ H5G__open_name(const H5G_loc_t *loc, const char *name) * * Failure: NULL * - * Programmer: Robb Matzke - * Monday, January 5, 1998 - * *------------------------------------------------------------------------- */ H5G_t * @@ -443,17 +422,17 @@ H5G_open(const H5G_loc_t *loc) FUNC_ENTER_NOAPI(NULL) /* Check args */ - HDassert(loc); + assert(loc); /* Allocate the group structure */ if (NULL == (grp = H5FL_CALLOC(H5G_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for group") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for group"); /* Shallow copy (take ownership) of the group location object */ if (H5O_loc_copy_shallow(&(grp->oloc), loc->oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy object location") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy object location"); if (H5G_name_copy(&(grp->path), loc->path, H5_COPY_SHALLOW) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy path") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, NULL, "can't copy path"); /* Check if group was already open */ if ((shared_fo = (H5G_shared_t *)H5FO_opened(grp->oloc.file, grp->oloc.addr)) == NULL) { @@ -463,17 +442,17 @@ H5G_open(const H5G_loc_t *loc) /* Open the group object */ if (H5G__open_oid(grp) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "not found"); /* Add group to list of open objects in file */ if (H5FO_insert(grp->oloc.file, grp->oloc.addr, grp->shared, FALSE) < 0) { grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, NULL, "can't insert group into list of open objects"); } /* end if */ /* Increment object count for the object in the top file */ if (H5FO_top_incr(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't increment object count") + HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't increment object count"); /* Set open object count */ grp->shared->fo_count = 1; @@ -489,12 +468,12 @@ H5G_open(const H5G_loc_t *loc) if (H5FO_top_count(grp->oloc.file, grp->oloc.addr) == 0) { /* Open the object through this top file */ if (H5O_open(&(grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open object header"); } /* end if */ /* Increment object count for the object in the top file */ if (H5FO_top_incr(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't increment object count") + HGOTO_ERROR(H5E_SYM, H5E_CANTINC, NULL, "can't increment object count"); } /* end else */ /* Set return value */ @@ -520,9 +499,6 @@ H5G_open(const H5G_loc_t *loc) * * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, March 17, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -534,20 +510,20 @@ H5G__open_oid(H5G_t *grp) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(grp); + assert(grp); /* Allocate the shared information for the group */ if (NULL == (grp->shared = H5FL_CALLOC(H5G_shared_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Grab the object header */ if (H5O_open(&(grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group"); obj_opened = TRUE; /* Check if this object has the right message(s) to be treated as a group */ if ((H5O_msg_exists(&(grp->oloc), H5O_STAB_ID) <= 0) && (H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID) <= 0)) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "not a group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "not a group"); done: if (ret_value < 0) { @@ -567,9 +543,6 @@ H5G__open_oid(H5G_t *grp) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, January 5, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -582,35 +555,35 @@ H5G_close(H5G_t *grp) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(grp && grp->shared); - HDassert(grp->shared->fo_count > 0); + assert(grp && grp->shared); + assert(grp->shared->fo_count > 0); --grp->shared->fo_count; if (0 == grp->shared->fo_count) { - HDassert(grp != H5G_rootof(H5G_fileof(grp))); + assert(grp != H5G_rootof(H5G_fileof(grp))); /* Uncork cache entries with object address tag */ if (H5AC_cork(grp->oloc.file, grp->oloc.addr, H5AC__GET_CORKED, &corked) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status"); if (corked) if (H5AC_cork(grp->oloc.file, grp->oloc.addr, H5AC__UNCORK, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTUNCORK, FAIL, "unable to uncork an object") + HGOTO_ERROR(H5E_SYM, H5E_CANTUNCORK, FAIL, "unable to uncork an object"); /* Remove the group from the list of opened objects in the file */ if (H5FO_top_decr(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't decrement count for object") + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't decrement count for object"); if (H5FO_delete(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't remove group from list of open objects") + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't remove group from list of open objects"); if (H5O_close(&(grp->oloc), &file_closed) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close"); /* Evict group metadata if evicting on close */ if (!file_closed && H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) { if (H5AC_flush_tagged_metadata(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata"); if (H5AC_evict_tagged_metadata(grp->oloc.file, grp->oloc.addr, FALSE) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata"); } /* end if */ /* Free memory */ @@ -619,17 +592,17 @@ H5G_close(H5G_t *grp) else { /* Decrement the ref. count for this object in the top file */ if (H5FO_top_decr(grp->oloc.file, grp->oloc.addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't decrement count for object") + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't decrement count for object"); /* Check reference count for this object in the top file */ if (H5FO_top_count(grp->oloc.file, grp->oloc.addr) == 0) { if (H5O_close(&(grp->oloc), NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close"); } /* end if */ else /* Free object location (i.e. "unhold" the file if appropriate) */ if (H5O_loc_free(&(grp->oloc)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "problem attempting to free location") + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "problem attempting to free location"); /* If this group is a mount point and the mount point is the last open * reference to the group (i.e. fo_count == 1 now), then attempt to @@ -638,13 +611,13 @@ H5G_close(H5G_t *grp) if (grp->shared->mounted && grp->shared->fo_count == 1) { /* Attempt to close down the file hierarchy */ if (H5F_try_close(grp->oloc.file, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close"); } /* end if */ } /* end else */ if (H5G_name_free(&(grp->path)) < 0) { grp = H5FL_FREE(H5G_t, grp); - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't free group entry name") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't free group entry name"); } /* end if */ grp = H5FL_FREE(H5G_t, grp); @@ -661,9 +634,6 @@ H5G_close(H5G_t *grp) * Return: Success: Ptr to group entry * Failure: NULL * - * Programmer: Robb Matzke - * Tuesday, March 24, 1998 - * *------------------------------------------------------------------------- */ H5O_loc_t * @@ -683,9 +653,6 @@ H5G_oloc(H5G_t *grp) * Return: Success: Ptr to hier. name * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, September 12, 2005 - * *------------------------------------------------------------------------- */ H5G_name_t * @@ -706,9 +673,6 @@ H5G_nameof(H5G_t *grp) * * Failure: NULL * - * Programmer: Robb Matzke - * Tuesday, March 24, 1998 - * *------------------------------------------------------------------------- */ H5F_t * @@ -717,7 +681,7 @@ H5G_fileof(H5G_t *grp) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(grp); + assert(grp); FUNC_LEAVE_NOAPI(grp->oloc.file) } /* end H5G_fileof() */ @@ -729,9 +693,6 @@ H5G_fileof(H5G_t *grp) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, July 5, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -740,7 +701,7 @@ H5G_get_shared_count(H5G_t *grp) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(grp && grp->shared); + assert(grp && grp->shared); FUNC_LEAVE_NOAPI(grp->shared->fo_count) } /* end H5G_get_shared_count() */ @@ -752,9 +713,6 @@ H5G_get_shared_count(H5G_t *grp) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, July 19, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -763,8 +721,8 @@ H5G_mount(H5G_t *grp) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(grp && grp->shared); - HDassert(grp->shared->mounted == FALSE); + assert(grp && grp->shared); + assert(grp->shared->mounted == FALSE); /* Set the 'mounted' flag */ grp->shared->mounted = TRUE; @@ -779,9 +737,6 @@ H5G_mount(H5G_t *grp) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, July 15, 2008 - * *------------------------------------------------------------------------- */ hbool_t @@ -790,7 +745,7 @@ H5G_mounted(H5G_t *grp) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(grp && grp->shared); + assert(grp && grp->shared); FUNC_LEAVE_NOAPI(grp->shared->mounted) } /* end H5G_mounted() */ @@ -802,9 +757,6 @@ H5G_mounted(H5G_t *grp) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, July 19, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -813,8 +765,8 @@ H5G_unmount(H5G_t *grp) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(grp && grp->shared); - HDassert(grp->shared->mounted == TRUE); + assert(grp && grp->shared); + assert(grp->shared->mounted == TRUE); /* Reset the 'mounted' flag */ grp->shared->mounted = FALSE; @@ -830,9 +782,6 @@ H5G_unmount(H5G_t *grp) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Oct 3, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -844,8 +793,8 @@ H5G__iterate_cb(const H5O_link_t *lnk, void *_udata) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(lnk); - HDassert(udata); + assert(lnk); + assert(udata); switch (udata->lnk_op.op_type) { #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -860,14 +809,14 @@ H5G__iterate_cb(const H5O_link_t *lnk, void *_udata) /* Retrieve the info for the link */ if (H5G_link_to_info(udata->link_loc, lnk, &info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link"); /* Make the application callback */ ret_value = (udata->lnk_op.op_func.op_new)(udata->gid, lnk->name, &info, udata->op_data); } break; default: - HDassert(0 && "Unknown link op type?!?"); + assert(0 && "Unknown link op type?!?"); } /* end switch */ done: @@ -881,9 +830,6 @@ H5G__iterate_cb(const H5O_link_t *lnk, void *_udata) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Oct 3, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -898,18 +844,18 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(loc); - HDassert(group_name); - HDassert(last_lnk); - HDassert(lnk_op && lnk_op->op_func.op_new); + assert(loc); + assert(group_name); + assert(last_lnk); + assert(lnk_op && lnk_op->op_func.op_new); /* Open the group on which to operate. We also create a group ID which * we can pass to the application-defined operator. */ if (NULL == (grp = H5G__open_name(loc, group_name))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group"); if ((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register group"); /* Set up user data for callback */ udata.gid = gid; @@ -920,16 +866,16 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter /* Call the real group iteration routine */ if ((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, skip, last_lnk, H5G__iterate_cb, &udata)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "error iterating over links") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "error iterating over links"); done: /* Release the group opened */ if (gid != H5I_INVALID_HID) { if (H5I_dec_app_ref(gid) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group"); } else if (grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_iterate() */ @@ -941,9 +887,6 @@ H5G_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Nov 4, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -964,9 +907,6 @@ H5G__free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSE * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Nov 4, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -986,8 +926,8 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(lnk); - HDassert(udata); + assert(lnk); + assert(udata); /* Check if we will need more space to store this link's relative path */ /* ("+2" is for string terminator and possible '/' for group separator later) */ @@ -998,19 +938,19 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) /* Attempt to allocate larger buffer for path */ if (NULL == (new_path = H5MM_realloc(udata->path, len_needed))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate path string") + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate path string"); udata->path = (char *)new_path; udata->path_buf_size = len_needed; } /* end if */ /* Build the link's relative path name */ - HDassert(udata->path[old_path_len] == '\0'); + assert(udata->path[old_path_len] == '\0'); HDstrncpy(&(udata->path[old_path_len]), lnk->name, link_name_len + 1); udata->curr_path_len += link_name_len; /* Construct the link info from the link message */ if (H5G_link_to_info(udata->curr_loc->oloc, lnk, &info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get info for link"); /* Make the application callback */ ret_value = (udata->op)(udata->gid, udata->path, &info, udata->op_data); @@ -1027,7 +967,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) /* Find the object using the LAPL passed in */ /* (Correctly handles mounted files) */ if (H5G_loc_find(udata->curr_loc, lnk->name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found"); obj_found = TRUE; /* Construct unique "position" for this object */ @@ -1041,7 +981,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) /* Get the object's reference count and type */ if (H5O_get_rc_and_type(&obj_oloc, &rc, &otype) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info"); /* If its ref count is > 1, we add it to the list of visited objects */ /* (because it could come up again during traversal) */ @@ -1050,7 +990,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) /* Allocate new object "position" node */ if ((new_node = H5FL_MALLOC(H5_obj_t)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate object node") + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate object node"); /* Set node information */ *new_node = obj_pos; @@ -1058,7 +998,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) /* Add to list of visited objects */ if (H5SL_insert(udata->visited, new_node, new_node) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5_ITER_ERROR, - "can't insert object node into visited list") + "can't insert object node into visited list"); } /* end if */ /* If it's a group, we recurse into it */ @@ -1069,13 +1009,13 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) htri_t linfo_exists; /* Whether the link info message exists */ /* Add the path separator to the current path */ - HDassert(udata->path[udata->curr_path_len] == '\0'); + assert(udata->path[udata->curr_path_len] == '\0'); HDstrncpy(&(udata->path[udata->curr_path_len]), "/", (size_t)2); udata->curr_path_len++; /* Attempt to get the link info for this group */ if ((linfo_exists = H5G__obj_get_linfo(&obj_oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "can't check for link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "can't check for link info message"); if (linfo_exists) { /* Check for creation order tracking, if creation order index lookup requested */ if (idx_type == H5_INDEX_CRT_ORDER) { @@ -1085,7 +1025,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) idx_type = H5_INDEX_NAME; } /* end if */ else - HDassert(idx_type == H5_INDEX_NAME); + assert(idx_type == H5_INDEX_NAME); } /* end if */ else { /* Can only perform name lookups on groups with symbol tables */ @@ -1114,7 +1054,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata) /* Release resources */ if (obj_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__visit_cb() */ @@ -1158,25 +1098,25 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o herr_t ret_value = FAIL; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ - HDmemset(&udata, 0, sizeof(udata)); + memset(&udata, 0, sizeof(udata)); FUNC_ENTER_NOAPI(FAIL) /* Check args */ if (!loc) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "loc parameter cannot be NULL"); /* Open the group to begin visiting within */ if (NULL == (grp = H5G__open_name(loc, group_name))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group"); /* Register an ID for the starting group */ if ((gid = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register group"); /* Get the location of the starting group */ if (H5G_loc(gid, &start_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); /* Set up user data */ udata.gid = gid; @@ -1188,17 +1128,17 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o /* Allocate space for the path name */ if (NULL == (udata.path = H5MM_strdup(""))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate path name buffer") + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate path name buffer"); udata.path_buf_size = 1; udata.curr_path_len = 0; /* Create skip list to store visited object information */ if ((udata.visited = H5SL_create(H5SL_TYPE_OBJ, NULL)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects"); /* Get the group's reference count */ if (H5O_get_rc_and_type(&grp->oloc, &rc, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object info"); /* If its ref count is > 1, we add it to the list of visited objects */ /* (because it could come up again during traversal) */ @@ -1207,7 +1147,7 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o /* Allocate new object "position" node */ if ((obj_pos = H5FL_MALLOC(H5_obj_t)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate object node") + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't allocate object node"); /* Construct unique "position" for this object */ H5F_GET_FILENO(grp->oloc.file, obj_pos->fileno); @@ -1215,12 +1155,12 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o /* Add to list of visited objects */ if (H5SL_insert(udata.visited, obj_pos, obj_pos) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert object node into visited list") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert object node into visited list"); } /* end if */ /* Attempt to get the link info for this group */ if ((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message"); if (linfo_exists) { /* Check for creation order tracking, if creation order index lookup requested */ if (idx_type == H5_INDEX_CRT_ORDER) { @@ -1230,7 +1170,7 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o idx_type = H5_INDEX_NAME; } /* end if */ else - HDassert(idx_type == H5_INDEX_NAME); + assert(idx_type == H5_INDEX_NAME); } /* end if */ else { /* Can only perform name lookups on groups with symbol tables */ @@ -1242,7 +1182,7 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o /* Call the link iteration routine */ if ((ret_value = H5G__obj_iterate(&(grp->oloc), idx_type, order, (hsize_t)0, NULL, H5G__visit_cb, &udata)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't visit links") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't visit links"); done: /* Release user data resources */ @@ -1253,10 +1193,10 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o /* Release the group opened */ if (gid != H5I_INVALID_HID) { if (H5I_dec_app_ref(gid) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close group"); } else if (grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "unable to release group"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_visit() */ @@ -1272,9 +1212,6 @@ H5G_visit(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_o * * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol - * Tuesday, October 25, 2005 - * *------------------------------------------------------------------------- */ hid_t @@ -1293,53 +1230,53 @@ H5G_get_create_plist(const H5G_t *grp) /* Copy the default group creation property list */ if (NULL == (gcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_GROUP_CREATE_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default group creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default group creation property list"); if ((new_gcpl_id = H5P_copy_plist(gcpl_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list"); if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_gcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get property list"); /* Retrieve any object creation properties */ if (H5O_get_create_plist(&grp->oloc, new_plist) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info"); /* Check for the group having a group info message */ if ((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header"); if (ginfo_exists) { H5O_ginfo_t ginfo; /* Group info message */ /* Read the group info */ if (NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, H5I_INVALID_HID, "can't get group info") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, H5I_INVALID_HID, "can't get group info"); /* Set the group info for the property list */ if (H5P_set(new_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set group info"); } /* end if */ /* Check for the group having a link info message */ if ((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to read object header"); if (linfo_exists) { /* Set the link info for the property list */ if (H5P_set(new_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set link info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set link info"); } /* end if */ /* Check for the group having a pipeline message */ if ((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "unable to read object header"); if (pline_exists) { H5O_pline_t pline; /* Pipeline message */ /* Read the pipeline */ if (NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, H5I_INVALID_HID, "can't get link pipeline") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, H5I_INVALID_HID, "can't get link pipeline"); /* Set the pipeline for the property list */ if (H5P_poke(new_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set link pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set link pipeline"); } /* end if */ /* Set the return value */ @@ -1349,7 +1286,7 @@ H5G_get_create_plist(const H5G_t *grp) if (ret_value < 0) { if (new_gcpl_id > 0) if (H5I_dec_app_ref(new_gcpl_id) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't free") + HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't free"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1362,9 +1299,6 @@ H5G_get_create_plist(const H5G_t *grp) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 18, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -1379,8 +1313,8 @@ H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_in FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); - HDassert(grp_info); + assert(loc); + assert(grp_info); /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -1389,17 +1323,17 @@ H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_in /* Find the group object */ if (H5G_loc_find(loc, name, &grp_loc /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found"); loc_found = TRUE; /* Retrieve the group's information */ if (H5G__obj_info(grp_loc.oloc, grp_info /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info"); done: /* Clean up */ if (loc_found && H5G_loc_free(&grp_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_name() */ @@ -1411,9 +1345,6 @@ H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_in * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 18, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -1429,8 +1360,8 @@ H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); - HDassert(grp_info); + assert(loc); + assert(grp_info); /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -1439,17 +1370,17 @@ H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id /* Find the object's location, according to the order in the index */ if (H5G_loc_find_by_idx(loc, group_name, idx_type, order, n, &grp_loc /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found"); loc_found = TRUE; /* Retrieve the group's information */ if (H5G__obj_info(grp_loc.oloc, grp_info /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info"); done: /* Clean up */ if (loc_found && H5G_loc_free(&grp_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_info_by_idx() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Glink.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Glink.c index a02935fd3e..be34877f70 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Glink.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Glink.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Glink.c - * Nov 13 2006 - * Quincey Koziol * * Purpose: Functions for handling links in groups. * @@ -87,9 +84,6 @@ static int H5G__link_cmp_corder_dec(const void *lnk1, const void *lnk2); * as equal, their order in the sorted array is undefined. * (i.e. same as strcmp()) * - * Programmer: Quincey Koziol - * Sep 5 2005 - * *------------------------------------------------------------------------- */ static int @@ -112,9 +106,6 @@ H5G__link_cmp_name_inc(const void *lnk1, const void *lnk2) * as equal, their order in the sorted array is undefined. * (i.e. opposite strcmp()) * - * Programmer: Quincey Koziol - * Sep 25 2006 - * *------------------------------------------------------------------------- */ static int @@ -136,9 +127,6 @@ H5G__link_cmp_name_dec(const void *lnk1, const void *lnk2) * equal to, or greater than the second. If two members compare * as equal, their order in the sorted array is undefined. * - * Programmer: Quincey Koziol - * Nov 6 2006 - * *------------------------------------------------------------------------- */ static int @@ -169,9 +157,6 @@ H5G__link_cmp_corder_inc(const void *lnk1, const void *lnk2) * equal to, or greater than the first. If two members compare * as equal, their order in the sorted array is undefined. * - * Programmer: Quincey Koziol - * Nov 6 2006 - * *------------------------------------------------------------------------- */ static int @@ -198,9 +183,6 @@ H5G__link_cmp_corder_dec(const void *lnk1, const void *lnk2) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 16 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -212,28 +194,28 @@ H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, const H5G_entry_t *ent, co FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(lnk); - HDassert(heap); - HDassert(ent); - HDassert(name); + assert(lnk); + assert(heap); + assert(ent); + assert(name); /* Set (default) common info for link */ lnk->cset = H5F_DEFAULT_CSET; lnk->corder = 0; lnk->corder_valid = FALSE; /* Creation order not valid for this link */ if ((lnk->name = H5MM_xstrdup(name)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to duplicate link name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to duplicate link name"); /* Object is a symbolic or hard link */ if (ent->type == H5G_CACHED_SLINK) { const char *s; /* Pointer to link value */ if ((s = (const char *)H5HL_offset_into(heap, ent->cache.slink.lval_offset)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get symbolic link name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get symbolic link name"); /* Copy the link value */ if ((lnk->u.soft.name = H5MM_xstrdup(s)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to duplicate symbolic link name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to duplicate symbolic link name"); dup_soft = TRUE; @@ -265,9 +247,6 @@ H5G__ent_to_link(H5O_link_t *lnk, const H5HL_t *heap, const H5G_entry_t *ent, co * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 7 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -278,8 +257,8 @@ H5G_link_to_info(const H5O_loc_t *link_loc, const H5O_link_t *lnk, H5L_info2_t * FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(link_loc); - HDassert(lnk); + assert(link_loc); + assert(lnk); /* Get information from the link */ if (info) { @@ -293,7 +272,7 @@ H5G_link_to_info(const H5O_loc_t *link_loc, const H5O_link_t *lnk, H5L_info2_t * /* Serialize the address into a VOL token */ if (H5VL_native_addr_to_token(link_loc->file, H5I_FILE, lnk->u.hard.addr, &info->u.token) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSERIALIZE, FAIL, - "can't serialize address into object token") + "can't serialize address into object token"); break; case H5L_TYPE_SOFT: @@ -307,7 +286,7 @@ H5G_link_to_info(const H5O_loc_t *link_loc, const H5O_link_t *lnk, H5L_info2_t * const H5L_class_t *link_class; /* User-defined link class */ if (lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX) - HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "unknown link class") + HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "unknown link class"); /* User-defined link; call its query function to get the link udata size. */ /* Get the link class for this type of link. It's okay if the class @@ -325,7 +304,7 @@ H5G_link_to_info(const H5O_loc_t *link_loc, const H5O_link_t *lnk, H5L_info2_t * if ((cb_ret = (link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, NULL, (size_t)0)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, - "query buffer size callback returned failure") + "query buffer size callback returned failure"); info->u.val_size = (size_t)cb_ret; } /* end if */ @@ -346,9 +325,6 @@ H5G_link_to_info(const H5O_loc_t *link_loc, const H5O_link_t *lnk, H5L_info2_t * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, November 20 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -359,9 +335,9 @@ H5G__link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t *obj FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(grp_loc); - HDassert(lnk); - HDassert(obj_loc); + assert(grp_loc); + assert(lnk); + assert(obj_loc); /* * Build location from the link @@ -369,11 +345,11 @@ H5G__link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t *obj /* Check for unknown library-internal link */ if (lnk->type > H5L_TYPE_BUILTIN_MAX && lnk->type < H5L_TYPE_UD_MIN) - HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "unknown link type") + HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "unknown link type"); /* Build object's group hier. location */ if (H5G_name_set(grp_loc->path, obj_loc->path, lnk->name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name"); /* Set the object location, if it's a hard link set the address also */ obj_loc->oloc->file = grp_loc->oloc->file; @@ -392,9 +368,6 @@ H5G__link_to_loc(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t *obj * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Nov 20, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -405,32 +378,32 @@ H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, H5_iter_orde FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ltable); + assert(ltable); /* Can't sort when empty since the links table will be NULL */ if (0 == ltable->nlinks) HGOTO_DONE(ret_value); /* This should never be NULL if the number of links is non-zero */ - HDassert(ltable->lnks); + assert(ltable->lnks); /* Pick appropriate sorting routine */ if (idx_type == H5_INDEX_NAME) { if (order == H5_ITER_INC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_inc); + qsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_inc); else if (order == H5_ITER_DEC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_dec); + qsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_name_dec); else - HDassert(order == H5_ITER_NATIVE); + assert(order == H5_ITER_NATIVE); } /* end if */ else { - HDassert(idx_type == H5_INDEX_CRT_ORDER); + assert(idx_type == H5_INDEX_CRT_ORDER); if (order == H5_ITER_INC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_inc); + qsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_inc); else if (order == H5_ITER_DEC) - HDqsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_dec); + qsort(ltable->lnks, ltable->nlinks, sizeof(H5O_link_t), H5G__link_cmp_corder_dec); else - HDassert(order == H5_ITER_NATIVE); + assert(order == H5_ITER_NATIVE); } /* end else */ done: @@ -446,9 +419,6 @@ H5G__link_sort_table(H5G_link_table_t *ltable, H5_index_t idx_type, H5_iter_orde * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Nov 20, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -461,15 +431,15 @@ H5G__link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, hsize_t *l FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ltable); - HDassert(op); + assert(ltable); + assert(op); /* Skip over links, if requested */ if (last_lnk) *last_lnk += skip; /* Iterate over link messages */ - H5_CHECKED_ASSIGN(u, size_t, skip, hsize_t) + H5_CHECKED_ASSIGN(u, size_t, skip, hsize_t); for (; u < ltable->nlinks && !ret_value; u++) { /* Make the callback */ ret_value = (op)(&(ltable->lnks[u]), op_data); @@ -494,9 +464,6 @@ H5G__link_iterate_table(const H5G_link_table_t *ltable, hsize_t skip, hsize_t *l * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Sep 6, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -508,20 +475,20 @@ H5G__link_release_table(H5G_link_table_t *ltable) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(ltable); + assert(ltable); /* Release link info, if any */ if (ltable->nlinks > 0) { /* Free link message information */ for (u = 0; u < ltable->nlinks; u++) if (H5O_msg_reset(H5O_LINK_ID, &(ltable->lnks[u])) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link message"); /* Free table of links */ H5MM_xfree(ltable->lnks); } /* end if */ else - HDassert(ltable->lnks == NULL); + assert(ltable->lnks == NULL); done: FUNC_LEAVE_NOAPI(ret_value) @@ -535,9 +502,6 @@ H5G__link_release_table(H5G_link_table_t *ltable) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 13 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -549,13 +513,13 @@ H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, const H5O_link_ FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(file); + assert(file); /* Search the open IDs and replace names for unlinked object */ if (grp_full_path_r) { obj_path_r = H5G_build_fullpath_refstr_str(grp_full_path_r, lnk->name); if (H5G_name_replace(lnk, H5G_NAME_DELETE, file, obj_path_r, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to replace name") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to replace name"); } done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gloc.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gloc.c index 0d85bc1bb9..24590d00d9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gloc.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gloc.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gloc.c - * Sep 13 2005 - * Quincey Koziol * * Purpose: Functions for working with group "locations" * @@ -154,7 +151,7 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) /* Construct a group location for root group of the file */ if (H5G_root_loc(f, loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file"); break; } @@ -162,9 +159,9 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) H5G_t *group = (H5G_t *)obj; if (NULL == (loc->oloc = H5G_oloc(group))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of group"); if (NULL == (loc->path = H5G_nameof(group))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of group"); break; } @@ -175,9 +172,9 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) dt = H5T_get_actual_type((H5T_t *)obj); if (NULL == (loc->oloc = H5T_oloc(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of datatype"); if (NULL == (loc->path = H5T_nameof(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of datatype"); break; } @@ -185,9 +182,9 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) H5D_t *dset = (H5D_t *)obj; if (NULL == (loc->oloc = H5D_oloc(dset))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of dataset"); if (NULL == (loc->path = H5D_nameof(dset))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of dataset"); break; } @@ -195,48 +192,48 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) H5A_t *attr = (H5A_t *)obj; if (NULL == (loc->oloc = H5A_oloc(attr))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location of attribute"); if (NULL == (loc->path = H5A_nameof(attr))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of attribute") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path of attribute"); break; } case H5I_DATASPACE: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of dataspace"); case H5I_MAP: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maps not supported in native VOL connector") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "maps not supported in native VOL connector"); case H5I_GENPROP_CLS: case H5I_GENPROP_LST: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of property list"); case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to get group location of error class, message or stack") + "unable to get group location of error class, message or stack"); case H5I_VFL: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to get group location of a virtual file driver (VFD)") + "unable to get group location of a virtual file driver (VFD)"); case H5I_VOL: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to get group location of a virtual object layer (VOL) connector") + "unable to get group location of a virtual object layer (VOL) connector"); case H5I_SPACE_SEL_ITER: HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to get group location of a dataspace selection iterator") + "unable to get group location of a dataspace selection iterator"); case H5I_EVENTSET: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a event set") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a event set"); case H5I_UNINIT: case H5I_BADID: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid location ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid location ID"); } /* end switch */ done: @@ -262,11 +259,11 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) /* Get the object from the VOL */ if (NULL == (obj = H5VL_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Fill in the struct */ if (H5G_loc_real(obj, H5I_get_type(loc_id), loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to fill in location struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to fill in location struct"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -279,9 +276,6 @@ H5G_loc(hid_t loc_id, H5G_loc_t *loc) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 13, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -292,14 +286,14 @@ H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) FUNC_ENTER_NOAPI(FAIL) /* Check args. */ - HDassert(dst); - HDassert(src); + assert(dst); + assert(src); /* Copy components of the location */ if (H5O_loc_copy(dst->oloc, src->oloc, depth) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to copy entry") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to copy entry"); if (H5G_name_copy(dst->path, src->path, depth) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to copy path") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to copy path"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -312,9 +306,6 @@ H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 13, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -325,13 +316,13 @@ H5G_loc_reset(H5G_loc_t *loc) FUNC_ENTER_NOAPI(FAIL) /* Check args. */ - HDassert(loc); + assert(loc); /* Reset components of the location */ if (H5O_loc_reset(loc->oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to reset entry") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to reset entry"); if (H5G_name_reset(loc->path) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to reset path") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to reset path"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -344,9 +335,6 @@ H5G_loc_reset(H5G_loc_t *loc) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 13, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -357,13 +345,13 @@ H5G_loc_free(H5G_loc_t *loc) FUNC_ENTER_NOAPI(FAIL) /* Check args. */ - HDassert(loc); + assert(loc); /* Reset components of the location */ if (H5G_name_free(loc->path) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free path") + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to free path"); if (H5O_loc_free(loc->oloc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to free object header location") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to free object header location"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -376,9 +364,6 @@ H5G_loc_free(H5G_loc_t *loc) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, October 17, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -393,7 +378,7 @@ H5G__loc_find_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, /* Check if the name in this group resolved to a valid object */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object '%s' doesn't exist", name) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object '%s' doesn't exist", name); /* Take ownership of the object's group location */ /* (Group traversal callbacks are responsible for either taking ownership @@ -413,9 +398,6 @@ H5G__loc_find_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 13, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -427,16 +409,16 @@ H5G_loc_find(const H5G_loc_t *loc, const char *name, H5G_loc_t *obj_loc /*out*/) FUNC_ENTER_NOAPI(FAIL) /* Check args. */ - HDassert(loc); - HDassert(name && *name); - HDassert(obj_loc); + assert(loc); + assert(name && *name); + assert(obj_loc); /* Set up user data for locating object */ udata.loc = obj_loc; /* Traverse group hierarchy to locate object */ if (H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_find_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -450,9 +432,6 @@ H5G_loc_find(const H5G_loc_t *loc, const char *name, H5G_loc_t *obj_loc /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -471,23 +450,23 @@ H5G__loc_find_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ /* Check if the name in this group resolved to a valid link */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group doesn't exist") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group doesn't exist"); /* Query link */ if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "link not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "link not found"); lnk_copied = TRUE; /* Build the initial object location for the link */ if (H5G__link_to_loc(obj_loc, &fnd_lnk, udata->loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot initialize object location") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot initialize object location"); obj_loc_valid = TRUE; /* Perform any special traversals that the link needs */ /* (soft links, user-defined links, file mounting, etc.) */ /* (may modify the object location) */ if (H5G__traverse_special(obj_loc, &fnd_lnk, H5G_TARGET_NORMAL, TRUE, udata->loc, &obj_exists) < 0) - HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "special link traversal failed") + HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "special link traversal failed"); done: /* Reset the link information, if we have a copy */ @@ -497,7 +476,7 @@ H5G__loc_find_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ /* Release the object location if we failed after copying it */ if (ret_value < 0 && obj_loc_valid) if (H5G_loc_free(udata->loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location"); /* Indicate that this callback didn't take ownership of the group * * location for the object */ @@ -513,9 +492,6 @@ H5G__loc_find_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, November 20, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -528,9 +504,9 @@ H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx FUNC_ENTER_NOAPI(FAIL) /* Check args. */ - HDassert(loc); - HDassert(group_name && *group_name); - HDassert(obj_loc); + assert(loc); + assert(group_name && *group_name); + assert(obj_loc); /* Set up user data for locating object */ udata.idx_type = idx_type; @@ -540,7 +516,7 @@ H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx /* Traverse group hierarchy to locate object */ if (H5G_traverse(loc, group_name, H5G_TARGET_NORMAL, H5G__loc_find_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -553,9 +529,6 @@ H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 13, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -567,9 +540,9 @@ H5G__loc_insert(H5G_loc_t *grp_loc, char *name, H5G_loc_t *obj_loc, H5O_type_t o FUNC_ENTER_PACKAGE /* Check args. */ - HDassert(grp_loc); - HDassert(name && *name); - HDassert(obj_loc); + assert(grp_loc); + assert(name && *name); + assert(obj_loc); /* Create link object for the object location */ lnk.type = H5L_TYPE_HARD; @@ -581,11 +554,11 @@ H5G__loc_insert(H5G_loc_t *grp_loc, char *name, H5G_loc_t *obj_loc, H5O_type_t o /* Insert new group into current group's symbol table */ if (H5G_obj_insert(grp_loc->oloc, name, &lnk, TRUE, obj_type, crt_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert object") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert object"); /* Set the name of the object location */ if (H5G_name_set(grp_loc->path, obj_loc->path, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot set name"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -598,9 +571,6 @@ H5G__loc_insert(H5G_loc_t *grp_loc, char *name, H5G_loc_t *obj_loc, H5O_type_t o * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, February 2, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -618,7 +588,7 @@ H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_ if (lnk) *exists = FALSE; else - HGOTO_ERROR(H5E_SYM, H5E_INTERNAL, FAIL, "no object or link info?") + HGOTO_ERROR(H5E_SYM, H5E_INTERNAL, FAIL, "no object or link info?"); else *exists = TRUE; @@ -638,9 +608,6 @@ H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_ * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, February 2, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -651,13 +618,13 @@ H5G_loc_exists(const H5G_loc_t *loc, const char *name, hbool_t *exists) FUNC_ENTER_NOAPI(FAIL) /* Check args. */ - HDassert(loc); - HDassert(name && *name); - HDassert(exists); + assert(loc); + assert(name && *name); + assert(exists); /* Traverse group hierarchy to locate object */ if (H5G_traverse(loc, name, H5G_TARGET_EXISTS, H5G__loc_exists_cb, exists) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't check if object exists") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't check if object exists"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -670,9 +637,6 @@ H5G_loc_exists(const H5G_loc_t *loc, const char *name, hbool_t *exists) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, December 21, 2019 - * *------------------------------------------------------------------------- */ static herr_t @@ -687,7 +651,7 @@ H5G__loc_addr_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UN /* Check if the name in this group resolved to a valid link */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist"); /* Set address of object */ *udata = obj_loc->oloc->addr; @@ -708,9 +672,6 @@ H5G__loc_addr_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UN * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, November 23, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -721,13 +682,13 @@ H5G__loc_addr(const H5G_loc_t *loc, const char *name, haddr_t *addr /*out*/) FUNC_ENTER_PACKAGE /* Check args. */ - HDassert(loc); - HDassert(name && *name); - HDassert(addr); + assert(loc); + assert(name && *name); + assert(addr); /* Traverse group hierarchy to locate object */ if (H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_addr_cb, addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -740,9 +701,6 @@ H5G__loc_addr(const H5G_loc_t *loc, const char *name, haddr_t *addr /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, November 23, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -757,11 +715,11 @@ H5G__loc_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UN /* Check if the name in this group resolved to a valid link */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist"); /* Query object information */ if (H5O_get_info(obj_loc->oloc, udata->oinfo, udata->fields) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object info"); done: /* Indicate that this callback didn't take ownership of the group * @@ -779,9 +737,6 @@ H5G__loc_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_UN * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, November 23, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -793,9 +748,9 @@ H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info2_t *oinfo /*out*/, FUNC_ENTER_NOAPI(FAIL) /* Check args. */ - HDassert(loc); - HDassert(name && *name); - HDassert(oinfo); + assert(loc); + assert(name && *name); + assert(oinfo); /* Set up user data for locating object */ udata.fields = fields; @@ -803,7 +758,7 @@ H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info2_t *oinfo /*out*/, /* Traverse group hierarchy to locate object */ if (H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_info_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -816,9 +771,6 @@ H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info2_t *oinfo /*out*/, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, November 23, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -833,11 +785,11 @@ H5G__loc_native_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ /* Check if the name in this group resolved to a valid link */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist"); /* Query object information */ if (H5O_get_native_info(obj_loc->oloc, udata->oinfo, udata->fields) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object info"); done: /* Indicate that this callback didn't take ownership of the group * @@ -855,9 +807,6 @@ H5G__loc_native_info_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, November 23, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -869,9 +818,9 @@ H5G_loc_native_info(const H5G_loc_t *loc, const char *name, H5O_native_info_t *o FUNC_ENTER_NOAPI(FAIL) /* Check args. */ - HDassert(loc); - HDassert(name && *name); - HDassert(oinfo); + assert(loc); + assert(name && *name); + assert(oinfo); /* Set up user data for locating object */ udata.fields = fields; @@ -879,7 +828,7 @@ H5G_loc_native_info(const H5G_loc_t *loc, const char *name, H5O_native_info_t *o /* Traverse group hierarchy to locate object */ if (H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_native_info_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -892,9 +841,6 @@ H5G_loc_native_info(const H5G_loc_t *loc, const char *name, H5O_native_info_t *o * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, August 30, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -911,28 +857,28 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ /* Check if the name in this group resolved to a valid link */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist"); /* Check for existing comment message */ if ((exists = H5O_msg_exists(obj_loc->oloc, H5O_NAME_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header"); /* Remove the previous comment message if any */ if (exists) if (H5O_msg_remove(obj_loc->oloc, H5O_NAME_ID, 0, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, - "unable to delete existing comment object header message") + "unable to delete existing comment object header message"); /* Add the new message */ if (udata->comment && *udata->comment) { if (NULL == (comment.s = HDstrdup(udata->comment))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy group comment") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy group comment"); if (H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message"); } /* end if */ done: - HDfree(comment.s); + free(comment.s); /* Indicate that this callback didn't take ownership of the group * * location for the object */ @@ -949,9 +895,6 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, August 30, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -963,15 +906,15 @@ H5G_loc_set_comment(const H5G_loc_t *loc, const char *name, const char *comment) FUNC_ENTER_NOAPI(FAIL) /* Check args. */ - HDassert(loc); - HDassert(name && *name); + assert(loc); + assert(name && *name); /* Set up user data for locating object */ udata.comment = comment; /* Traverse group hierarchy to locate object */ if (H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_set_comment_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -984,9 +927,6 @@ H5G_loc_set_comment(const H5G_loc_t *loc, const char *name, const char *comment) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, August 30, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -1002,7 +942,7 @@ H5G__loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ /* Check if the name in this group resolved to a valid link */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist"); /* Query object comment */ comment.s = NULL; @@ -1035,9 +975,6 @@ H5G__loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, August 30, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1050,8 +987,8 @@ H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out* FUNC_ENTER_NOAPI(FAIL) /* Check args. */ - HDassert(loc); - HDassert(name && *name); + assert(loc); + assert(name && *name); /* Set up user data for locating object */ udata.comment = comment; @@ -1060,7 +997,7 @@ H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out* /* Traverse group hierarchy to locate object */ if (H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_get_comment_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object"); /* Set value to return */ if (comment_len) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gname.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gname.c index 7f1d6c0eb8..2d7d855136 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gname.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gname.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gname.c - * Sep 12 2005 - * Quincey Koziol * * Purpose: Functions for handling group hierarchy paths. * @@ -107,9 +104,6 @@ static int H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key); * * Failure: Ptr to the null terminator of NAME. * - * Programmer: Robb Matzke - * Aug 11 1997 - * *------------------------------------------------------------------------- */ const char * @@ -117,7 +111,7 @@ H5G__component(const char *name, size_t *size_p) { FUNC_ENTER_PACKAGE_NOERR - HDassert(name); + assert(name); while ('/' == *name) name++; @@ -136,9 +130,6 @@ H5G__component(const char *name, size_t *size_p) * Return: Success: Ptr to normalized name. * Failure: NULL * - * Programmer: Quincey Koziol - * Saturday, August 16, 2003 - * *------------------------------------------------------------------------- */ char * @@ -152,11 +143,11 @@ H5G_normalize(const char *name) FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(name); + assert(name); /* Duplicate the name, to return */ if (NULL == (norm = H5MM_strdup(name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for normalized string") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for normalized string"); /* Walk through the characters, omitting duplicated '/'s */ s = d = 0; @@ -198,9 +189,6 @@ H5G_normalize(const char *name) * Return: TRUE for valid prefix, FALSE for not a valid prefix, FAIL * on error * - * Programmer: Quincey Koziol - * - * Date: September 24, 2002 * *------------------------------------------------------------------------- */ @@ -216,13 +204,13 @@ H5G__common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) /* Get component of each name */ fullpath = H5RS_get_str(fullpath_r); - HDassert(fullpath); + assert(fullpath); fullpath = H5G__component(fullpath, &nchars1); - HDassert(fullpath); + assert(fullpath); prefix = H5RS_get_str(prefix_r); - HDassert(prefix); + assert(prefix); prefix = H5G__component(prefix, &nchars2); - HDassert(prefix); + assert(prefix); /* Check if we have a real string for each component */ while (*fullpath && *prefix) { @@ -236,15 +224,15 @@ H5G__common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) /* Get next component of each name */ fullpath = H5G__component(fullpath, &nchars1); - HDassert(fullpath); + assert(fullpath); prefix = H5G__component(prefix, &nchars2); - HDassert(prefix); + assert(prefix); } /* end if */ else - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ else - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end while */ /* If we reached the end of the prefix path to check, it must be a valid prefix */ @@ -262,10 +250,6 @@ H5G__common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r) * * Return: Pointer to reference counted string on success, NULL on error * - * Programmer: Quincey Koziol - * - * Date: August 19, 2005 - * *------------------------------------------------------------------------- */ static H5RS_str_t * @@ -276,12 +260,12 @@ H5G__build_fullpath(const char *prefix, const char *name) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(prefix); - HDassert(name); + assert(prefix); + assert(name); /* Create full path */ if (NULL == (ret_value = H5RS_create(prefix))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, NULL, "can't create ref-counted string") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, NULL, "can't create ref-counted string"); if (prefix[HDstrlen(prefix) - 1] != '/') H5RS_aputc(ret_value, '/'); /* Add separator, if the prefix doesn't end in one */ H5RS_acat(ret_value, name); @@ -298,9 +282,6 @@ H5G__build_fullpath(const char *prefix, const char *name) * Return: Success: Non-NULL, combined path * Failure: NULL * - * Programmer: Quincey Koziol - * Tuesday, October 11, 2005 - * *------------------------------------------------------------------------- */ H5RS_str_t * @@ -311,12 +292,12 @@ H5G_build_fullpath_refstr_str(H5RS_str_t *prefix_r, const char *name) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(prefix_r); - HDassert(name); + assert(prefix_r); + assert(name); /* Get the raw string for the user path */ prefix = H5RS_get_str(prefix_r); - HDassert(prefix); + assert(prefix); /* Create reference counted string for path */ ret_value = H5G__build_fullpath(prefix, name); @@ -332,9 +313,6 @@ H5G_build_fullpath_refstr_str(H5RS_str_t *prefix_r, const char *name) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, September 12, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -343,13 +321,13 @@ H5G__name_init(H5G_name_t *name, const char *path) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(name); + assert(name); /* Set the initial paths for a name object */ name->full_path_r = H5RS_create(path); - HDassert(name->full_path_r); + assert(name->full_path_r); name->user_path_r = H5RS_create(path); - HDassert(name->user_path_r); + assert(name->user_path_r); name->obj_hidden = 0; FUNC_LEAVE_NOAPI(SUCCEED) @@ -363,9 +341,6 @@ H5G__name_init(H5G_name_t *name, const char *path) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Pedro Vicente - * Thursday, August 22, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -375,9 +350,9 @@ H5G_name_set(const H5G_name_t *loc, H5G_name_t *obj, const char *name) FUNC_ENTER_NOAPI(FAIL) - HDassert(loc); - HDassert(obj); - HDassert(name); + assert(loc); + assert(obj); + assert(name); /* Free & reset the object's previous paths info (if they exist) */ H5G_name_free(obj); @@ -386,14 +361,14 @@ H5G_name_set(const H5G_name_t *loc, H5G_name_t *obj, const char *name) if (loc->full_path_r) { /* Go build the new full path */ if ((obj->full_path_r = H5G_build_fullpath_refstr_str(loc->full_path_r, name)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_PATH, FAIL, "can't build user path name") + HGOTO_ERROR(H5E_SYM, H5E_PATH, FAIL, "can't build user path name"); } /* end if */ /* Create the object's user path, if a user path exists in the location */ if (loc->user_path_r) { /* Go build the new user path */ if ((obj->user_path_r = H5G_build_fullpath_refstr_str(loc->user_path_r, name)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_PATH, FAIL, "can't build user path name") + HGOTO_ERROR(H5E_SYM, H5E_PATH, FAIL, "can't build user path name"); } /* end if */ done: @@ -408,9 +383,6 @@ H5G_name_set(const H5G_name_t *loc, H5G_name_t *obj, const char *name) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, September 12, 2005 - * * Notes: 'depth' parameter determines how much of the group entry * structure we want to copy. The depths are: * H5_COPY_SHALLOW - Copy all the fields from the source @@ -429,13 +401,13 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments */ - HDassert(src); - HDassert(dst); + assert(src); + assert(dst); #if defined(H5_USING_MEMCHECKER) || !defined(NDEBUG) - HDassert(dst->full_path_r == NULL); - HDassert(dst->user_path_r == NULL); + assert(dst->full_path_r == NULL); + assert(dst->user_path_r == NULL); #endif /* H5_USING_MEMCHECKER */ - HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP); + assert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP); /* Copy the top level information */ H5MM_memcpy(dst, src, sizeof(H5G_name_t)); @@ -464,9 +436,6 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth) * Return: Success: Non-negative, length of name * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, December 13, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -477,7 +446,7 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, size_t *name FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(loc); + assert(loc); /* If the user path is available and it's not "hidden", use it */ if (loc->path->user_path_r != NULL && loc->path->obj_hidden == 0) { @@ -503,7 +472,7 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, size_t *name else if (!loc->path->obj_hidden) { /* Search for name of object */ if (H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size, name_len) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name"); /* Indicate that the name is _not_ cached, if requested */ /* (Currently only used for testing - QAK, 2010/07/26) */ @@ -523,9 +492,6 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, size_t *name * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, September 12, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -534,10 +500,10 @@ H5G_name_reset(H5G_name_t *name) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments */ - HDassert(name); + assert(name); /* Clear the group hier. name to an empty state */ - HDmemset(name, 0, sizeof(H5G_name_t)); + memset(name, 0, sizeof(H5G_name_t)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G_name_reset() */ @@ -549,10 +515,6 @@ H5G_name_reset(H5G_name_t *name) * * Return: Success * - * Programmer: Pedro Vicente - * - * Date: August 22, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -561,7 +523,7 @@ H5G_name_free(H5G_name_t *name) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(name); + assert(name); if (name->full_path_r) { H5RS_decr(name->full_path_r); @@ -584,9 +546,6 @@ H5G_name_free(H5G_name_t *name) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, December 13, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -601,14 +560,14 @@ H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(path_r_ptr && *path_r_ptr); - HDassert(full_suffix); - HDassert(src_path); - HDassert(dst_path); + assert(path_r_ptr && *path_r_ptr); + assert(full_suffix); + assert(src_path); + assert(dst_path); /* Get pointer to path to update */ path = H5RS_get_str(*path_r_ptr); - HDassert(path); + assert(path); /* Check if path needs to be updated */ full_suffix_len = HDstrlen(full_suffix); @@ -648,7 +607,7 @@ H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char /* Allocate new ref-counted string */ if (NULL == (rs = H5RS_create(NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create ref-counted string") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create ref-counted string"); /* Create the new path */ if (path_prefix2_len > 0) @@ -675,10 +634,6 @@ H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente - * - * Date: June 5, 2002 - * *------------------------------------------------------------------------- */ static int @@ -693,7 +648,7 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) FUNC_ENTER_PACKAGE - HDassert(obj_ptr); + assert(obj_ptr); /* Get the symbol table entry */ switch (H5I_get_type(obj_id)) { @@ -710,14 +665,14 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_DATATYPE: /* Avoid non-named datatypes */ if (!H5T_is_named((H5T_t *)obj_ptr)) - HGOTO_DONE(SUCCEED) /* Do not exit search over IDs */ + HGOTO_DONE(SUCCEED); /* Do not exit search over IDs */ oloc = H5T_oloc((H5T_t *)obj_ptr); obj_path = H5T_nameof((H5T_t *)obj_ptr); break; case H5I_MAP: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector"); case H5I_UNINIT: case H5I_BADID: @@ -735,14 +690,14 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_EVENTSET: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object"); } /* end switch */ - HDassert(oloc); - HDassert(obj_path); + assert(oloc); + assert(obj_path); /* Check if the object has a full path still */ if (!obj_path->full_path_r) - HGOTO_DONE(SUCCEED) /* No need to look at object, it's path is already invalid */ + HGOTO_DONE(SUCCEED); /* No need to look at object, it's path is already invalid */ /* Find the top file in object's mount hier. */ if (H5F_PARENT(oloc->file)) { @@ -769,7 +724,7 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) /* Check if the object is in same file mount hier. */ if (!H5F_SAME_SHARED(top_obj_file, names->src_file)) - HGOTO_DONE(SUCCEED) /* No need to look at object, it's path is already invalid */ + HGOTO_DONE(SUCCEED); /* No need to look at object, it's path is already invalid */ switch (names->op) { /*------------------------------------------------------------------------- @@ -789,7 +744,7 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) /* Create new full path */ if (NULL == (rs = H5RS_create(src_path))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create ref-counted string") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create ref-counted string"); H5RS_acat(rs, full_path); /* Release previous full path */ @@ -830,7 +785,7 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) /* Create new full path suffix */ if (NULL == (rs = H5RS_create(full_suffix))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create ref-counted string") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create ref-counted string"); /* Release previous full path */ H5RS_decr(obj_path->full_path_r); @@ -881,7 +836,7 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) H5RS_str_t *rs; /* Ref-counted string for new path */ /* Sanity check */ - HDassert(names->dst_full_path_r); + assert(names->dst_full_path_r); /* Get pointers to paths of interest */ full_path = H5RS_get_str(obj_path->full_path_r); @@ -889,8 +844,8 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) dst_path = H5RS_get_str(names->dst_full_path_r); /* Make certain that the source and destination names are full (not relative) paths */ - HDassert(*src_path == '/'); - HDassert(*dst_path == '/'); + assert(*src_path == '/'); + assert(*dst_path == '/'); /* Get pointer to "full suffix" */ full_suffix = full_path + HDstrlen(src_path); @@ -898,11 +853,11 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) /* Update the user path, if one exists */ if (obj_path->user_path_r) if (H5G__name_move_path(&(obj_path->user_path_r), full_suffix, src_path, dst_path) < 0) - HGOTO_ERROR(H5E_SYM, H5E_PATH, FAIL, "can't build user path name") + HGOTO_ERROR(H5E_SYM, H5E_PATH, FAIL, "can't build user path name"); /* Create new full path */ if (NULL == (rs = H5RS_create(dst_path))) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create ref-counted string") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "can't create ref-counted string"); H5RS_acat(rs, full_suffix); /* Release previous full path */ @@ -914,11 +869,11 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid operation"); } /* end switch */ done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__name_replace_cb() */ /*------------------------------------------------------------------------- @@ -933,10 +888,6 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) * * Return: Success: 0, Failure: -1 * - * Programmer: Pedro Vicente - * - * Date: June 11, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -948,7 +899,7 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, H5RS FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(src_file); + assert(src_file); /* Check if the object we are manipulating has a path */ if (src_full_path_r) { @@ -970,7 +921,7 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, H5RS /* Get the type of the object */ if (H5O_obj_type(&tmp_oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type"); /* Determine which type of objects to operate on */ switch (obj_type) { @@ -991,13 +942,13 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, H5RS case H5O_TYPE_MAP: HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, - "maps not supported in native VOL connector") + "maps not supported in native VOL connector"); case H5O_TYPE_UNKNOWN: case H5O_TYPE_NTYPES: /* Search and replace names through datatype IDs */ default: - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not valid object type") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not valid object type"); } /* end switch */ } /* end case */ break; @@ -1013,7 +964,7 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, H5RS default: /* User-defined link */ /* Check for unknown library-defined link type */ if (lnk->type < H5L_TYPE_UD_MIN) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown link type"); /* User-defined & external links automatically wipe out * names (because it would be too much work to track them), @@ -1045,17 +996,17 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, H5RS /* Search through group IDs */ if (search_group) if (H5I_iterate(H5I_GROUP, H5G__name_replace_cb, &names, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over groups"); /* Search through dataset IDs */ if (search_dataset) if (H5I_iterate(H5I_DATASET, H5G__name_replace_cb, &names, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datasets"); /* Search through datatype IDs */ if (search_datatype) if (H5I_iterate(H5I_DATATYPE, H5G__name_replace_cb, &names, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over datatypes"); } /* end if */ } /* end if */ @@ -1072,9 +1023,6 @@ H5G_name_replace(const H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file, H5RS * 0 if not correct object * negative on failure. * - * Programmer: Quincey Koziol - * November 4 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -1090,10 +1038,10 @@ H5G__get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(path); - HDassert(linfo); - HDassert(udata->loc); - HDassert(udata->path == NULL); + assert(path); + assert(linfo); + assert(udata->loc); + assert(udata->path == NULL); /* Check for hard link with correct address */ if (linfo->type == H5L_TYPE_HARD) { @@ -1101,14 +1049,14 @@ H5G__get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, /* Retrieve hard link address from VOL token */ if (H5VL_native_token_to_addr(udata->loc->file, H5I_FILE, linfo->u.token, &link_addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address") + HGOTO_ERROR(H5E_SYM, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token into address"); if (udata->loc->addr == link_addr) { H5G_loc_t grp_loc; /* Location of group */ /* Get group's location */ if (H5G_loc(gid, &grp_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "bad group location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "bad group location"); /* Set up opened object location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1117,24 +1065,24 @@ H5G__get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, /* Find the object */ if (H5G_loc_find(&grp_loc, path, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "object not found"); obj_found = TRUE; /* Check for object in same file (handles mounted files) */ /* (re-verify address, in case we traversed a file mount) */ if (udata->loc->addr == obj_loc.oloc->addr && udata->loc->file == obj_loc.oloc->file) { if (NULL == (udata->path = H5MM_strdup(path))) - HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, H5_ITER_ERROR, "can't duplicate path string") + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, H5_ITER_ERROR, "can't duplicate path string"); /* We found a match so we return immediately */ - HGOTO_DONE(H5_ITER_STOP) + HGOTO_DONE(H5_ITER_STOP); } /* end if */ } /* end if */ } /* end if */ done: if (obj_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__get_name_by_addr_cb() */ @@ -1150,9 +1098,6 @@ H5G__get_name_by_addr_cb(hid_t gid, const char *path, const H5L_info2_t *linfo, * * Failure: -1 * - * Programmer: Quincey Koziol - * November 4 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1166,18 +1111,18 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size, si herr_t ret_value = SUCCEED; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ - HDmemset(&udata, 0, sizeof(udata)); + memset(&udata, 0, sizeof(udata)); FUNC_ENTER_NOAPI(FAIL) /* Construct a group location for root group of the file */ if (H5G_root_loc(f, &root_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get root group's location") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get root group's location"); /* Check for root group being the object looked for */ if (root_loc.oloc->addr == loc->addr && root_loc.oloc->file == loc->file) { if (NULL == (udata.path = H5MM_strdup(""))) - HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "can't duplicate path string") + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "can't duplicate path string"); found_obj = TRUE; } /* end if */ else { @@ -1188,7 +1133,7 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size, si /* Visit all the links in the file */ if ((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G__get_name_by_addr_cb, &udata)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group traversal failed while looking for object name") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group traversal failed while looking for object name"); else if (status > 0) found_obj = TRUE; } /* end else */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gnode.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gnode.c index 0e66107fc8..bff0ae6dfb 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gnode.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gnode.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gnode.c - * Jun 26 1997 - * Robb Matzke * * Purpose: Functions for handling symbol table nodes. A * symbol table node is a small collection of symbol @@ -131,9 +128,6 @@ H5FL_SEQ_DEFINE(H5G_entry_t); * * Failure: Can't fail * - * Programmer: Robb Matzke - * Wednesday, October 8, 1997 - * *------------------------------------------------------------------------- */ static H5UC_t * @@ -141,7 +135,7 @@ H5G__node_get_shared(const H5F_t *f, const void H5_ATTR_UNUSED *_udata) { FUNC_ENTER_PACKAGE_NOERR - HDassert(f); + assert(f); /* Return the pointer to the ref-count object */ FUNC_LEAVE_NOAPI(H5F_GRP_BTREE_SHARED(f)) @@ -154,9 +148,6 @@ H5G__node_get_shared(const H5F_t *f, const void H5_ATTR_UNUSED *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 8 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -166,11 +157,11 @@ H5G__node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) FUNC_ENTER_PACKAGE_NOERR - HDassert(shared); - HDassert(raw); - HDassert(key); + assert(shared); + assert(raw); + assert(key); - H5F_DECODE_LENGTH_LEN(raw, key->offset, shared->sizeof_len); + H5_DECODE_LENGTH_LEN(raw, key->offset, shared->sizeof_len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G__node_decode_key() */ @@ -182,9 +173,6 @@ H5G__node_decode_key(const H5B_shared_t *shared, const uint8_t *raw, void *_key) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 8 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -194,11 +182,11 @@ H5G__node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) FUNC_ENTER_PACKAGE_NOERR - HDassert(shared); - HDassert(raw); - HDassert(key); + assert(shared); + assert(raw); + assert(key); - H5F_ENCODE_LENGTH_LEN(raw, key->offset, shared->sizeof_len); + H5_ENCODE_LENGTH_LEN(raw, key->offset, shared->sizeof_len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G__node_encode_key() */ @@ -210,9 +198,6 @@ H5G__node_encode_key(const H5B_shared_t *shared, uint8_t *raw, const void *_key) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, February 28, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -223,20 +208,20 @@ H5G__node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, cons FUNC_ENTER_PACKAGE_NOERR - HDassert(key); + assert(key); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Heap offset:", (unsigned)key->offset); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Heap offset:", (unsigned)key->offset); if (udata->heap) { const char *s; - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Name:"); + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Name:"); if ((s = (const char *)H5HL_offset_into(udata->heap, key->offset)) != NULL) - HDfprintf(stream, "%s\n", s); + fprintf(stream, "%s\n", s); } /* end if */ else - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Cannot get name; heap address not specified\n"); + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Cannot get name; heap address not specified\n"); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G__node_debug_key() */ @@ -248,9 +233,6 @@ H5G__node_debug_key(FILE *stream, int indent, int fwidth, const void *_key, cons * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 15 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -261,10 +243,10 @@ H5G__node_free(H5G_node_t *sym) /* * Check arguments. */ - HDassert(sym); + assert(sym); /* Verify that node is clean */ - HDassert(sym->cache_info.is_dirty == FALSE); + assert(sym->cache_info.is_dirty == FALSE); if (sym->entry) sym->entry = H5FL_SEQ_FREE(H5G_entry_t, sym->entry); @@ -286,9 +268,6 @@ H5G__node_free(H5G_node_t *sym) * * Failure: Negative * - * Programmer: Robb Matzke - * Jun 23 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -305,19 +284,19 @@ H5G__node_create(H5F_t *f, H5B_ins_t H5_ATTR_UNUSED op, void *_lt_key, void H5_A /* * Check arguments. */ - HDassert(f); - HDassert(H5B_INS_FIRST == op); + assert(f); + assert(H5B_INS_FIRST == op); if (NULL == (sym = H5FL_CALLOC(H5G_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); sym->node_size = H5G_NODE_SIZE(f); if (HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)sym->node_size))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space"); if (NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))))) - HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "memory allocation failed"); if (H5AC_insert_entry(f, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node"); /* * The left and right symbols in an empty tree are both the * empty string stored at offset zero by the H5G functions. This @@ -356,9 +335,6 @@ H5G__node_create(H5F_t *f, H5B_ins_t H5_ATTR_UNUSED op, void *_lt_key, void H5_A * * Failure: FAIL (same as LT_KEYheap); - HDassert(lt_key); - HDassert(rt_key); + assert(udata && udata->heap); + assert(lt_key); + assert(rt_key); /* Get pointers to string names */ if ((s1 = (const char *)H5HL_offset_into(udata->heap, lt_key->offset)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name"); if ((s2 = (const char *)H5HL_offset_into(udata->heap, rt_key->offset)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name"); /* Set return value */ ret_value = HDstrcmp(s1, s2); @@ -409,9 +385,6 @@ H5G__node_cmp2(void *_lt_key, void *_udata, void *_rt_key) * * Failure: FAIL (same as UDATA < LT_KEY) * - * Programmer: Robb Matzke - * Jun 23 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -426,19 +399,19 @@ H5G__node_cmp3(void *_lt_key, void *_udata, void *_rt_key) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(udata && udata->heap); - HDassert(lt_key); - HDassert(rt_key); + assert(udata && udata->heap); + assert(lt_key); + assert(rt_key); /* left side */ if ((s = (const char *)H5HL_offset_into(udata->heap, lt_key->offset)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name"); if (HDstrcmp(udata->name, s) <= 0) ret_value = (-1); else { /* right side */ if ((s = (const char *)H5HL_offset_into(udata->heap, rt_key->offset)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name"); if (HDstrcmp(udata->name, s) > 0) ret_value = 1; } /* end else */ @@ -466,9 +439,6 @@ H5G__node_cmp3(void *_lt_key, void *_udata, void *_rt_key) * returned through the UDATA pointer, if *FOUND is true. * Failure: Negative if not found. * - * Programmer: Robb Matzke - * Jun 23 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -486,16 +456,16 @@ H5G__node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, hboo /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(found); - HDassert(udata && udata->common.heap); + assert(f); + assert(H5_addr_defined(addr)); + assert(found); + assert(udata && udata->common.heap); /* * Load the symbol table node for exclusive access. */ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table node"); /* * Binary search. @@ -505,7 +475,7 @@ H5G__node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, hboo idx = (lt + rt) / 2; if ((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table name"); cmp = HDstrcmp(udata->common.name, s); if (cmp < 0) @@ -522,12 +492,12 @@ H5G__node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, hboo /* Call user's callback operator */ if ((udata->op)(&sn->entry[idx], udata->op_data) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "iterator callback failed") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "iterator callback failed"); } /* end else */ done: if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__node_found() */ @@ -558,9 +528,6 @@ H5G__node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, hboo * * Failure: H5B_INS_ERROR, NEW_NODE_P might not be initialized. * - * Programmer: Robb Matzke - * Jun 24 1997 - * *------------------------------------------------------------------------- */ static H5B_ins_t @@ -584,18 +551,18 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, hbool_t H /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(md_key); - HDassert(rt_key); - HDassert(udata && udata->common.heap); - HDassert(new_node_p); + assert(f); + assert(H5_addr_defined(addr)); + assert(md_key); + assert(rt_key); + assert(udata && udata->common.heap); + assert(new_node_p); /* * Load the symbol node. */ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node"); /* * Where does the new symbol get inserted? We use a binary search. @@ -604,11 +571,11 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, hbool_t H while (lt < rt) { idx = (int)((lt + rt) / 2); if ((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name"); /* Check if symbol is already present */ if (0 == (cmp = HDstrcmp(udata->common.name, s))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "symbol is already present in symbol table") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "symbol is already present in symbol table"); if (cmp < 0) rt = (unsigned)idx; @@ -620,7 +587,7 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, hbool_t H /* Convert link information & name to symbol table entry */ if (H5G__ent_convert(f, udata->common.heap, udata->common.name, udata->lnk, udata->obj_type, udata->crt_info, &ent) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5B_INS_ERROR, "unable to convert link") + HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5B_INS_ERROR, "unable to convert link"); /* Determine where to place entry in node */ if (sn->nsyms >= 2 * H5F_SYM_LEAF_K(f)) { @@ -633,17 +600,17 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, hbool_t H /* The right node */ if (H5G__node_create(f, H5B_INS_FIRST, NULL, NULL, NULL, new_node_p /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to split symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to split symbol table node"); if (NULL == (snrt = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, *new_node_p, f, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node"); H5MM_memcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f), H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); snrt->nsyms = H5F_SYM_LEAF_K(f); snrt_flags |= H5AC__DIRTIED_FLAG; /* The left node */ - HDmemset(sn->entry + H5F_SYM_LEAF_K(f), 0, H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); + memset(sn->entry + H5F_SYM_LEAF_K(f), 0, H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); sn->nsyms = H5F_SYM_LEAF_K(f); sn_flags |= H5AC__DIRTIED_FLAG; @@ -677,9 +644,9 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, hbool_t H } /* end else */ /* Move entries down to make room for new entry */ - HDassert(idx >= 0); - HDmemmove(insert_into->entry + idx + 1, insert_into->entry + idx, - (insert_into->nsyms - (unsigned)idx) * sizeof(H5G_entry_t)); + assert(idx >= 0); + memmove(insert_into->entry + idx + 1, insert_into->entry + idx, + (insert_into->nsyms - (unsigned)idx) * sizeof(H5G_entry_t)); /* Copy new entry into table */ H5G__ent_copy(&(insert_into->entry[idx]), &ent, H5_COPY_SHALLOW); @@ -689,9 +656,9 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, hbool_t H done: if (snrt && H5AC_unprotect(f, H5AC_SNODE, *new_node_p, snrt, snrt_flags) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node"); if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, sn_flags) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5B_INS_ERROR, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__node_insert() */ @@ -719,9 +686,6 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, hbool_t H * * Failure: H5B_INS_ERROR * - * Programmer: Robb Matzke - * Thursday, September 24, 1998 - * *------------------------------------------------------------------------- */ static H5B_ins_t @@ -740,15 +704,15 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert((H5G_node_key_t *)_lt_key); - HDassert(rt_key); - HDassert(udata && udata->common.heap); + assert(f); + assert(H5_addr_defined(addr)); + assert((H5G_node_key_t *)_lt_key); + assert(rt_key); + assert(udata && udata->common.heap); /* Load the symbol table */ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to protect symbol table node"); /* "Normal" removal of a single entry from the symbol table node */ if (udata->common.name != NULL) { @@ -762,7 +726,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i idx = (lt + rt) / 2; if ((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name"); cmp = HDstrcmp(udata->common.name, s); if (cmp < 0) rt = idx; @@ -771,11 +735,11 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i } /* end while */ if (cmp) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "name not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5B_INS_ERROR, "name not found"); /* Get a pointer to the name of the link */ if (NULL == (lnk.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off))) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name"); link_name_len = HDstrlen(lnk.name) + 1; /* Set up rest of link structure */ @@ -786,17 +750,17 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i lnk.type = H5L_TYPE_SOFT; if (NULL == (lnk.u.soft.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].cache.slink.lval_offset))) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name"); } /* end if */ else { lnk.type = H5L_TYPE_HARD; - HDassert(H5F_addr_defined(sn->entry[idx].header)); + assert(H5_addr_defined(sn->entry[idx].header)); lnk.u.hard.addr = sn->entry[idx].header; } /* end else */ /* Replace any object names */ if (H5G__link_name_replace(f, udata->grp_full_path_r, &lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get object type") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get object type"); /* Decrement the ref. count for hard links */ if (lnk.type == H5L_TYPE_HARD) { @@ -807,7 +771,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i tmp_oloc.addr = lnk.u.hard.addr; if (H5O_link(&tmp_oloc, -1) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5B_INS_ERROR, "unable to decrement object link count"); } /* end if */ else { /* Remove the soft link's value from the local heap */ @@ -818,13 +782,13 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i if (H5HL_remove(f, udata->common.heap, sn->entry[idx].cache.slink.lval_offset, soft_link_len) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, - "unable to remove soft link from local heap") + "unable to remove soft link from local heap"); } /* end if */ } /* end else */ /* Remove the link's name from the local heap */ if (H5HL_remove(f, udata->common.heap, sn->entry[idx].name_off, link_name_len) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove link name from local heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, "unable to remove link name from local heap"); /* Remove the entry from the symbol table node */ if (1 == sn->nsyms) { @@ -833,7 +797,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i * node and indicate that the pointer to this node in the B-tree * should be removed also. */ - HDassert(0 == idx); + assert(0 == idx); sn->nsyms = 0; sn_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; ret_value = H5B_INS_REMOVE; @@ -846,7 +810,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i */ sn->nsyms -= 1; sn_flags |= H5AC__DIRTIED_FLAG; - HDmemmove(sn->entry + idx, sn->entry + idx + 1, (sn->nsyms - idx) * sizeof(H5G_entry_t)); + memmove(sn->entry + idx, sn->entry + idx + 1, (sn->nsyms - idx) * sizeof(H5G_entry_t)); ret_value = H5B_INS_NOOP; } else if (idx + 1 == sn->nsyms) { @@ -868,7 +832,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i */ sn->nsyms -= 1; sn_flags |= H5AC__DIRTIED_FLAG; - HDmemmove(sn->entry + idx, sn->entry + idx + 1, (sn->nsyms - idx) * sizeof(H5G_entry_t)); + memmove(sn->entry + idx, sn->entry + idx + 1, (sn->nsyms - idx) * sizeof(H5G_entry_t)); ret_value = H5B_INS_NOOP; } /* end else */ } /* end if */ @@ -883,12 +847,12 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i for (idx = 0; idx < sn->nsyms; idx++) { if (!(H5G_CACHED_SLINK == sn->entry[idx].type)) { /* Decrement the reference count */ - HDassert(H5F_addr_defined(sn->entry[idx].header)); + assert(H5_addr_defined(sn->entry[idx].header)); tmp_oloc.addr = sn->entry[idx].header; if (H5O_link(&tmp_oloc, -1) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR, - "unable to decrement object link count") + "unable to decrement object link count"); } /* end if */ } /* end for */ @@ -904,7 +868,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i done: if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, sn_flags) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release symbol table node") + HDONE_ERROR(H5E_SYM, H5E_CANTUNPROTECT, H5B_INS_ERROR, "unable to release symbol table node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__node_remove() */ @@ -916,9 +880,6 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jun 24 1997 - * *------------------------------------------------------------------------- */ int @@ -936,13 +897,13 @@ H5G__node_iterate(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(udata && udata->heap); + assert(f); + assert(H5_addr_defined(addr)); + assert(udata && udata->heap); /* Protect the symbol table node & local heap while we iterate over entries */ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node"); /* * Iterate over the symbol table node entries. @@ -956,19 +917,19 @@ H5G__node_iterate(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, /* Get the pointer to the name of the link in the heap */ if ((name = (const char *)H5HL_offset_into(udata->heap, ents[u].name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get symbol table node name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get symbol table node name"); /* Convert the entry to a link */ if (H5G__ent_to_link(&lnk, udata->heap, &ents[u], name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5_ITER_ERROR, - "unable to convert symbol table entry to link") + "unable to convert symbol table entry to link"); /* Make the callback */ ret_value = (udata->op)(&lnk, udata->op_data); /* Release memory for link object */ if (H5O_msg_reset(H5O_LINK_ID, &lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, H5_ITER_ERROR, "unable to release link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, H5_ITER_ERROR, "unable to release link message"); } /* end else */ /* Increment the number of entries passed through */ @@ -982,7 +943,7 @@ H5G__node_iterate(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, done: /* Release resources */ if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__node_iterate() */ @@ -995,9 +956,6 @@ H5G__node_iterate(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Nov 20, 2002 - * *------------------------------------------------------------------------- */ int @@ -1013,19 +971,19 @@ H5G__node_sumup(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(num_objs); + assert(f); + assert(H5_addr_defined(addr)); + assert(num_objs); /* Find the object node and add the number of symbol entries. */ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node"); *num_objs += sn->nsyms; done: if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__node_sumup() */ @@ -1039,9 +997,6 @@ H5G__node_sumup(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, * Return: 0 if object isn't found in this node; 1 if object is found; * Negative on failure * - * Programmer: Raymond Lu - * Nov 20, 2002 - * *------------------------------------------------------------------------- */ int @@ -1057,9 +1012,9 @@ H5G__node_by_idx(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(udata); + assert(f); + assert(H5_addr_defined(addr)); + assert(udata); /* Get a pointer to the symbol table node */ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__READ_ONLY_FLAG))) @@ -1073,9 +1028,9 @@ H5G__node_by_idx(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, ent_idx = udata->idx - udata->num_objs; /* Call 'by index' callback */ - HDassert(udata->op); + assert(udata->op); if ((udata->op)(&sn->entry[ent_idx], udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "'by index' callback failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "'by index' callback failed"); /* Indicate that we found the entry we are interested in */ ret_value = H5_ITER_STOP; @@ -1085,7 +1040,7 @@ H5G__node_by_idx(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, done: if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__node_by_idx() */ @@ -1099,9 +1054,6 @@ H5G__node_by_idx(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, * Return: Non-negative on success * Negative on failure * - * Programmer: Quincey Koziol - * Jul 5, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -1114,21 +1066,21 @@ H5G__node_init(H5F_t *f) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(f); + assert(f); /* Set the raw key size */ sizeof_rkey = H5F_SIZEOF_SIZE(f); /*name offset */ /* Allocate & initialize global info for the shared structure */ if (NULL == (shared = H5B_shared_new(f, H5B_SNODE, sizeof_rkey))) - HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info") + HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed for shared B-tree info"); /* Set up the "local" information for this file's groups */ /* */ /* Make shared B-tree info reference counted */ if (H5F_SET_GRP_BTREE_SHARED(f, H5UC_create(shared, H5B_shared_free)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1143,9 +1095,6 @@ H5G__node_init(H5F_t *f) * Return: Non-negative on success * Negative on failure * - * Programmer: Quincey Koziol - * Jul 5, 2004 - * * *------------------------------------------------------------------------- */ @@ -1155,7 +1104,7 @@ H5G_node_close(const H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(f); + assert(f); /* Free the raw B-tree node buffer */ if (H5F_GRP_BTREE_SHARED(f)) @@ -1172,9 +1121,6 @@ H5G_node_close(const H5F_t *f) * * Return: 0(zero) on success/Negative on failure * - * Programmer: Peter Cao - * Sept 10, 2005 - * *------------------------------------------------------------------------- */ int @@ -1192,17 +1138,17 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(udata); + assert(f); + assert(H5_addr_defined(addr)); + assert(udata); /* load the symbol table into memory from the source file */ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node"); /* get the base address of the heap */ if (NULL == (heap = H5HL_protect(f, udata->src_heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "unable to protect symbol name") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "unable to protect symbol name"); /* copy object in this node one by one */ for (i = 0; i < sn->nsyms; i++) { @@ -1234,7 +1180,7 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const /* Get pointer to link value in local heap */ if ((link_name = (char *)H5HL_offset_into(heap, tmp_src_ent.cache.slink.lval_offset)) == NULL) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name"); /* Check if the object pointed by the soft link exists in the source file */ if (H5G__loc_addr(&grp_loc, link_name, &obj_addr) >= 0) { @@ -1246,7 +1192,7 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const } /* if ((H5G_CACHED_SLINK == src_ent->type)... */ /* Check if object in source group is a hard link */ - if (H5F_addr_defined(src_ent->header)) { + if (H5_addr_defined(src_ent->header)) { H5O_loc_t new_dst_oloc; /* Copied object location in destination */ H5O_loc_t tmp_src_oloc; /* Temporary object location for source object */ @@ -1262,7 +1208,7 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const /* Copy the shared object from source to destination */ if (H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, cpy_info, TRUE, &obj_type, (void **)&cpy_udata) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy object"); /* Set up object creation info for symbol table insertion. Only * case so far is for inserting old-style groups (for caching stab @@ -1276,7 +1222,7 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const /* Construct link information for eventual insertion */ lnk.type = H5L_TYPE_HARD; lnk.u.hard.addr = new_dst_oloc.addr; - } /* ( H5F_addr_defined(src_ent->header)) */ + } /* ( H5_addr_defined(src_ent->header)) */ else if (H5G_CACHED_SLINK == src_ent->type) { /* it is a soft link */ /* Set object type to unknown */ @@ -1285,10 +1231,10 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const /* Construct link information for eventual insertion */ lnk.type = H5L_TYPE_SOFT; if ((lnk.u.soft.name = (char *)H5HL_offset_into(heap, src_ent->cache.slink.lval_offset)) == NULL) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get link name"); } /* else if */ else - HDassert(0 && "Unknown entry type"); + assert(0 && "Unknown entry type"); /* Set up common link data */ lnk.cset = H5F_DEFAULT_CSET; /* XXX: Allow user to set this */ @@ -1298,16 +1244,16 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const /* Determine name of source object */ if ((name = (const char *)H5HL_offset_into(heap, src_ent->name_off)) == NULL) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get source object name") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get source object name"); /* Set copied metadata tag */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) /* Insert the new object in the destination file's group */ /* (Don't increment the link count - that's already done above for hard links) */ if (H5G__stab_insert_real(udata->dst_file, udata->dst_stab, name, &lnk, obj_type, (obj_type == H5O_TYPE_GROUP ? &gcrt_info : NULL)) < 0) - HGOTO_ERROR_TAG(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") + HGOTO_ERROR_TAG(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name"); /* Reset metadata tag */ H5_END_TAG @@ -1316,10 +1262,10 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const done: if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to unprotect symbol name") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to unprotect symbol name"); if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__node_copy() */ @@ -1331,9 +1277,6 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, const * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 19 2006 - * *------------------------------------------------------------------------- */ int @@ -1350,16 +1293,16 @@ H5G__node_build_table(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(udata && udata->heap); + assert(f); + assert(H5_addr_defined(addr)); + assert(udata && udata->heap); /* * Save information about the symbol table node since we can't lock it * because we're about to call an application function. */ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node"); /* Check if the link table needs to be extended */ if ((udata->ltable->nlinks + sn->nsyms) >= udata->alloc_nlinks) { @@ -1369,7 +1312,7 @@ H5G__node_build_table(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr /* Re-allocate the link table */ if (NULL == (x = (H5O_link_t *)H5MM_realloc(udata->ltable->lnks, sizeof(H5O_link_t) * na))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed"); udata->ltable->lnks = x; } /* end if */ @@ -1380,7 +1323,7 @@ H5G__node_build_table(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr /* Get pointer to link's name in the heap */ if ((name = (const char *)H5HL_offset_into(udata->heap, sn->entry[u].name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get symbol table link name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get symbol table link name"); /* Determine the link to operate on in the table */ linkno = udata->ltable->nlinks++; @@ -1388,13 +1331,13 @@ H5G__node_build_table(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr /* Convert the entry to a link */ if (H5G__ent_to_link(&udata->ltable->lnks[linkno], udata->heap, &sn->entry[u], name) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, H5_ITER_ERROR, - "unable to convert symbol table entry to link") + "unable to convert symbol table entry to link"); } /* end for */ done: /* Release the locked items */ if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__node_build_table() */ @@ -1407,9 +1350,6 @@ H5G__node_build_table(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * Jun 19 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1421,8 +1361,8 @@ H5G__node_iterate_size(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t H5_ FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(stab_size); + assert(f); + assert(stab_size); *stab_size += H5G_NODE_SIZE(f); @@ -1437,9 +1377,6 @@ H5G__node_iterate_size(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t H5_ * * Return: 0(zero) on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 4 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1455,16 +1392,16 @@ H5G_node_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, had /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Pin the heap down in memory */ - if (heap_addr > 0 && H5F_addr_defined(heap_addr)) + if (heap_addr > 0 && H5_addr_defined(heap_addr)) if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to protect symbol table heap"); /* * If we couldn't load the symbol table node, then try loading the @@ -1479,28 +1416,27 @@ H5G_node_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, had HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to debug B-tree node"); } /* end if */ else { - HDfprintf(stream, "%*sSymbol Table Node...\n", indent, ""); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Dirty:", sn->cache_info.is_dirty ? "Yes" : "No"); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Size of Node (in bytes):", (unsigned)sn->node_size); - HDfprintf(stream, "%*s%-*s %u of %u\n", indent, "", fwidth, "Number of Symbols:", sn->nsyms, - (unsigned)(2 * H5F_SYM_LEAF_K(f))); + fprintf(stream, "%*sSymbol Table Node...\n", indent, ""); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty:", sn->cache_info.is_dirty ? "Yes" : "No"); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Size of Node (in bytes):", (unsigned)sn->node_size); + fprintf(stream, "%*s%-*s %u of %u\n", indent, "", fwidth, "Number of Symbols:", sn->nsyms, + (unsigned)(2 * H5F_SYM_LEAF_K(f))); indent += 3; fwidth = MAX(0, fwidth - 3); for (u = 0; u < sn->nsyms; u++) { - HDfprintf(stream, "%*sSymbol %u:\n", indent - 3, "", u); + fprintf(stream, "%*sSymbol %u:\n", indent - 3, "", u); if (heap) { const char *s = (const char *)H5HL_offset_into(heap, sn->entry[u].name_off); if (s) - HDfprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", s); + fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", s); } /* end if */ else - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, - "Warning: Invalid heap address given, name not displayed!"); + fprintf(stream, "%*s%-*s\n", indent, "", fwidth, + "Warning: Invalid heap address given, name not displayed!"); H5G__ent_debug(sn->entry + u, stream, indent, fwidth, heap); } /* end for */ @@ -1508,9 +1444,9 @@ H5G_node_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, had done: if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to release symbol table node"); if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_node_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gobj.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gobj.c index a6b68081ac..6878e51d47 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gobj.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gobj.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gobj.c - * Sep 5 2005 - * Quincey Koziol * * Purpose: Functions for abstract handling of objects in groups. * @@ -102,9 +99,6 @@ static herr_t H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *l * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 29 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -121,28 +115,28 @@ H5G__obj_create(H5F_t *f, H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc /*out*/) /* * Check arguments. */ - HDassert(f); - HDassert(oloc); + assert(f); + assert(oloc); /* Get the property list */ if (NULL == (gc_plist = (H5P_genplist_t *)H5I_object(gcrt_info->gcpl_id))) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a property list"); /* Get the group info property */ if (H5P_get(gc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info"); /* Get the link info property */ if (H5P_get(gc_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info"); /* Get the pipeline property */ if (H5P_peek(gc_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get group info"); /* Call the "real" group creation routine now */ if (H5G__obj_create_real(f, &ginfo, &linfo, &pline, gcrt_info, oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, FAIL, "unable to create group"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -155,9 +149,6 @@ H5G__obj_create(H5F_t *f, H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 29 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -174,15 +165,15 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf /* * Check arguments. */ - HDassert(f); - HDassert(ginfo); - HDassert(linfo); - HDassert(pline); - HDassert(oloc); + assert(f); + assert(ginfo); + assert(linfo); + assert(pline); + assert(oloc); /* Check for invalid access request */ if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file"); /* Check for using the latest version of the group format which is introduced in v18 */ /* (add more checks for creating "new format" groups when needed) */ @@ -195,7 +186,7 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf * going to be built on it. */ if (linfo->index_corder && !linfo->track_corder) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "must track creation order to create index for it") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "must track creation order to create index for it"); /* Check if we should be using the latest version of the group format */ if (use_at_least_v18) { @@ -208,14 +199,14 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf /* Calculate message size information, for creating group's object header */ linfo_size = H5O_msg_size_f(f, gcpl_id, H5O_LINFO_ID, linfo, (size_t)0); - HDassert(linfo_size); + assert(linfo_size); ginfo_size = H5O_msg_size_f(f, gcpl_id, H5O_GINFO_ID, ginfo, (size_t)0); - HDassert(ginfo_size); + assert(ginfo_size); if (pline && pline->nused) { pline_size = H5O_msg_size_f(f, gcpl_id, H5O_PLINE_ID, pline, (size_t)0); - HDassert(pline_size); + assert(pline_size); } /* end if */ lnk.type = H5L_TYPE_HARD; @@ -224,7 +215,7 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf lnk.cset = H5T_CSET_ASCII; lnk.name = &null_char; link_size = H5O_msg_size_f(f, gcpl_id, H5O_LINK_ID, &lnk, (size_t)ginfo->est_name_len); - HDassert(link_size); + assert(link_size); /* Compute size of header to use for creation */ hdr_size = linfo_size + ginfo_size + pline_size + (ginfo->est_num_entries * link_size); @@ -238,23 +229,23 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf * incremented if the object is added to the group directed graph. */ if (H5O_create(f, hdr_size, (size_t)1, gcpl_id, oloc /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create header"); /* Check for format of group to create */ if (use_at_least_v18) { H5_GCC_CLANG_DIAG_OFF("cast-qual") /* Insert link info message */ if (H5O_msg_create(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, (void *)linfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); /* Insert group info message */ if (H5O_msg_create(oloc, H5O_GINFO_ID, H5O_MSG_FLAG_CONSTANT, 0, (void *)ginfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); /* Insert pipeline message */ if (pline && pline->nused) if (H5O_msg_create(oloc, H5O_PLINE_ID, H5O_MSG_FLAG_CONSTANT, 0, (void *)pline) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); H5_GCC_CLANG_DIAG_ON("cast-qual") } /* end if */ else { @@ -262,7 +253,7 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf /* The group doesn't currently have a 'stab' message, go create one */ if (H5G__stab_create(oloc, ginfo, &stab) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create symbol table") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create symbol table"); /* Cache the symbol table information */ gcrt_info->cache_type = H5G_CACHED_STAB; @@ -283,9 +274,6 @@ H5G__obj_create_real(H5F_t *f, const H5O_ginfo_t *ginfo, const H5O_linfo_t *linf * Return: Success: TRUE/FALSE whether message was found & retrieved * Failure: FAIL if error occurred * - * Programmer: Quincey Koziol - * Mar 11 2007 - * *------------------------------------------------------------------------- */ htri_t @@ -297,34 +285,34 @@ H5G__obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo) FUNC_ENTER_PACKAGE_TAG(grp_oloc->addr) /* check arguments */ - HDassert(grp_oloc); - HDassert(linfo); + assert(grp_oloc); + assert(linfo); /* Check for the group having a link info message */ if ((ret_value = H5O_msg_exists(grp_oloc, H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header"); if (ret_value) { /* Retrieve the "link info" structure */ if (NULL == H5O_msg_read(grp_oloc, H5O_LINFO_ID, linfo)) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "link info message not present") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "link info message not present"); /* Check if we don't know how many links there are */ if (linfo->nlinks == HSIZET_MAX) { /* Check if we are using "dense" link storage */ - if (H5F_addr_defined(linfo->fheap_addr)) { + if (H5_addr_defined(linfo->fheap_addr)) { /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(grp_oloc->file, linfo->name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Retrieve # of records in "name" B-tree */ /* (should be same # of records in all indices) */ if (H5B2_get_nrec(bt2_name, &linfo->nlinks) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve # of records in index") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve # of records in index"); } /* end if */ else { /* Retrieve # of links from object header */ if (H5O_get_nlinks(grp_oloc, &linfo->nlinks) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve # of links for object") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve # of links for object"); } /* end if */ } /* end if */ } /* end if */ @@ -332,7 +320,7 @@ H5G__obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo) done: /* Release resources */ if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for name index"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5G__obj_get_linfo() */ @@ -345,9 +333,6 @@ H5G__obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 30 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -360,12 +345,12 @@ H5G__obj_compact_to_dense_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, voi FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(lnk); - HDassert(udata); + assert(lnk); + assert(udata); /* Insert link into dense link storage */ if (H5G__dense_insert(udata->f, udata->linfo, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -379,9 +364,6 @@ H5G__obj_compact_to_dense_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, voi * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sept 16 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -393,13 +375,13 @@ H5G__obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(lnk); - HDassert(udata); + assert(lnk); + assert(udata); /* Insert link into group */ H5_GCC_CLANG_DIAG_OFF("cast-qual") if (H5G_obj_insert(udata->grp_oloc, lnk->name, (H5O_link_t *)lnk, FALSE, H5O_TYPE_UNKNOWN, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert link into group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert link into group"); H5_GCC_CLANG_DIAG_ON("cast-qual") done: @@ -417,9 +399,6 @@ H5G__obj_stab_to_new_cb(const H5O_link_t *lnk, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 6 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -437,14 +416,14 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, FUNC_ENTER_NOAPI_TAG(grp_oloc->addr, FAIL) /* check arguments */ - HDassert(grp_oloc && grp_oloc->file); - HDassert(name && *name); - HDassert(obj_lnk); + assert(grp_oloc && grp_oloc->file); + assert(name && *name); + assert(obj_lnk); /* Check if we have information about the number of objects in this group */ /* (by attempting to get the link info message for this group) */ if ((linfo_exists = H5G__obj_get_linfo(grp_oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message"); if (linfo_exists) { H5O_ginfo_t ginfo; /* Group info message */ size_t link_msg_size; /* Size of new link message in the file */ @@ -464,17 +443,17 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Get the link's message size */ if ((link_msg_size = H5O_msg_raw_size(grp_oloc->file, H5O_LINK_ID, FALSE, obj_lnk)) == 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size") + HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't get link size"); /* Get the group info */ if (NULL == H5O_msg_read(grp_oloc, H5O_GINFO_ID, &ginfo)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info"); /* If there's still a small enough number of links, use the 'link' message */ /* (If the encoded form of the link is too large to fit into an object * header message, convert to using dense link storage instead of link messages) */ - if (H5F_addr_defined(linfo.fheap_addr)) + if (H5_addr_defined(linfo.fheap_addr)) use_new_dense = TRUE; else if (linfo.nlinks < ginfo.max_compact && link_msg_size < H5O_MESG_MAX_SIZE) use_new_dense = FALSE; @@ -485,16 +464,16 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Get the pipeline message, if it exists */ if ((pline_exists = H5O_msg_exists(grp_oloc, H5O_PLINE_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header"); if (pline_exists) { if (NULL == H5O_msg_read(grp_oloc, H5O_PLINE_ID, &tmp_pline)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline"); pline = &tmp_pline; } /* end if */ /* The group doesn't currently have "dense" storage for links */ if (H5G__dense_create(grp_oloc->file, &linfo, pline) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create 'dense' form of new format group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create 'dense' form of new format group"); /* Set up user data for object header message iteration */ udata.f = grp_oloc->file; @@ -505,11 +484,11 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, op.op_type = H5O_MESG_OP_APP; op.u.app_op = H5G__obj_compact_to_dense_cb; if (H5O_msg_iterate(grp_oloc, H5O_LINK_ID, &op, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links"); /* Remove all the 'link' messages */ if (H5O_msg_remove(grp_oloc, H5O_LINK_ID, H5O_ALL, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link messages") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete link messages"); use_new_dense = TRUE; } /* end else */ @@ -525,12 +504,12 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Insert link info message */ if (H5O_msg_create(grp_oloc, H5O_LINFO_ID, 0, 0, &new_linfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); /* Insert group info message */ if (H5O_msg_create(grp_oloc, H5O_GINFO_ID, H5O_MSG_FLAG_CONSTANT, H5O_UPDATE_TIME, &new_ginfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); /* Set up user data for iteration */ udata.grp_oloc = grp_oloc; @@ -538,21 +517,21 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Iterate through all links in "old format" group and insert them into new format */ if (H5G__stab_iterate(grp_oloc, H5_ITER_NATIVE, (hsize_t)0, NULL, H5G__obj_stab_to_new_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over old format links") + HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over old format links"); /* Remove the symbol table message from the group */ if (H5O_msg_remove(grp_oloc, H5O_STAB_ID, 0, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete old format link storage") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete old format link storage"); /* Recursively call this routine to insert the new link, since the * group is in the "new format" now and the link info should be * set up, etc. */ if (H5G_obj_insert(grp_oloc, name, obj_lnk, adj_link, obj_type, crt_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into group"); /* Done with insertion now */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ else use_old_format = TRUE; @@ -562,18 +541,18 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, if (use_old_format) { /* Insert into symbol table */ if (H5G__stab_insert(grp_oloc, name, obj_lnk, obj_type, crt_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry into symbol table") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry into symbol table"); } /* end if */ else { if (use_new_dense) { /* Insert into dense link storage */ if (H5G__dense_insert(grp_oloc->file, &linfo, obj_lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link into dense storage"); } /* end if */ else { /* Insert with link message */ if (H5G__compact_insert(grp_oloc, obj_lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link as link message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert link as link message"); } /* end else */ } /* end else */ @@ -581,7 +560,7 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, if (!use_old_format) { linfo.nlinks++; if (H5O_msg_write(grp_oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, &linfo) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message"); } /* end if */ /* Increment link count on object, if requested and it's a hard link */ @@ -595,13 +574,13 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, /* Increment reference count for object */ if (H5O_link(&obj_oloc, 1) < 0) - HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "unable to increment hard link count") + HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "unable to increment hard link count"); } /* end if */ done: /* Free any space used by the pipeline message */ if (pline && H5O_msg_reset(H5O_PLINE_ID, pline) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "can't release pipeline") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "can't release pipeline"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5G_obj_insert() */ @@ -616,9 +595,6 @@ H5G_obj_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_lnk, * * Failure: Negative * - * Programmer: Quincey Koziol - * Oct 3, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -632,45 +608,45 @@ H5G__obj_iterate(const H5O_loc_t *grp_oloc, H5_index_t idx_type, H5_iter_order_t FUNC_ENTER_PACKAGE_TAG(grp_oloc->addr) /* Sanity check */ - HDassert(grp_oloc); - HDassert(op); + assert(grp_oloc); + assert(op); /* Attempt to get the link info for this group */ if ((linfo_exists = H5G__obj_get_linfo(grp_oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message"); if (linfo_exists) { /* Check for going out of bounds */ if (skip > 0 && (size_t)skip >= linfo.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound"); /* Check for creation order tracking, if creation order index lookup requested */ if (idx_type == H5_INDEX_CRT_ORDER) { /* Check if creation order is tracked */ if (!linfo.track_corder) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group"); } /* end if */ - if (H5F_addr_defined(linfo.fheap_addr)) { + if (H5_addr_defined(linfo.fheap_addr)) { /* Iterate over the links in the group, building a table of the link messages */ if ((ret_value = H5G__dense_iterate(grp_oloc->file, &linfo, idx_type, order, skip, last_lnk, op, op_data)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over dense links") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over dense links"); } /* end if */ else { /* Get the object's name from the link messages */ if ((ret_value = H5G__compact_iterate(grp_oloc, &linfo, idx_type, order, skip, last_lnk, op, op_data)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over compact links") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over compact links"); } /* end else */ } /* end if */ else { /* Can only perform name lookups on groups with symbol tables */ if (idx_type != H5_INDEX_NAME) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query"); /* Iterate over symbol table */ if ((ret_value = H5G__stab_iterate(grp_oloc, order, skip, last_lnk, op, op_data)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over symbol table") + HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "can't iterate over symbol table"); } /* end else */ done: @@ -684,9 +660,6 @@ H5G__obj_iterate(const H5O_loc_t *grp_oloc, H5_index_t idx_type, H5_iter_order_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 27 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -703,8 +676,8 @@ H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(oloc); - HDassert(grp_info); + assert(oloc); + assert(grp_info); /* Set up group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -713,25 +686,25 @@ H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info) /* Deep copy (duplicate) of the group location object */ if (H5O_loc_copy_deep(&grp_oloc, oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "can't copy object location") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "can't copy object location"); /* Open the group */ if (NULL == (grp = H5G_open(&grp_loc))) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount point not found"); /* Get information from the group */ grp_info->mounted = H5G_MOUNTED(grp); /* Attempt to get the link info for this group */ if ((linfo_exists = H5G__obj_get_linfo(oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message"); if (linfo_exists) { /* Retrieve the information about the links */ grp_info->nlinks = linfo.nlinks; grp_info->max_corder = linfo.max_corder; /* Check if the group is using compact or dense storage for its links */ - if (H5F_addr_defined(linfo.fheap_addr)) + if (H5_addr_defined(linfo.fheap_addr)) grp_info->storage_type = H5G_STORAGE_TYPE_DENSE; else grp_info->storage_type = H5G_STORAGE_TYPE_COMPACT; @@ -739,7 +712,7 @@ H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info) else { /* Get the number of objects in this group by iterating over symbol table */ if (H5G__stab_count(oloc, &grp_info->nlinks) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't count objects") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't count objects"); /* Set the other information about the group */ grp_info->storage_type = H5G_STORAGE_TYPE_SYMBOL_TABLE; @@ -749,7 +722,7 @@ H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info) done: /* Clean up resources */ if (grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "unable to close queried group") + HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "unable to close queried group"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__obj_info() */ @@ -762,9 +735,6 @@ H5G__obj_info(const H5O_loc_t *oloc, H5G_info_t *grp_info) * Return: Success: Non-negative, length of name * Failure: Negative * - * Programmer: Raymond Lu - * Nov 20, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -778,39 +748,39 @@ H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_orde FUNC_ENTER_NOAPI_TAG(oloc->addr, FAIL) /* Sanity check */ - HDassert(oloc && oloc->file); + assert(oloc && oloc->file); /* Attempt to get the link info for this group */ if ((linfo_exists = H5G__obj_get_linfo(oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message"); if (linfo_exists) { /* Check for creation order tracking, if creation order index lookup requested */ if (idx_type == H5_INDEX_CRT_ORDER) /* Check if creation order is tracked */ if (!linfo.track_corder) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group"); /* Check for dense link storage */ - if (H5F_addr_defined(linfo.fheap_addr)) { + if (H5_addr_defined(linfo.fheap_addr)) { /* Get the object's name from the dense link storage */ if (H5G__dense_get_name_by_idx(oloc->file, &linfo, idx_type, order, n, name, name_size, name_len) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name"); } /* end if */ else { /* Get the object's name from the link messages */ if (H5G__compact_get_name_by_idx(oloc, &linfo, idx_type, order, n, name, name_size, name_len) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name"); } /* end else */ } /* end if */ else { /* Can only perform name lookups on groups with symbol tables */ if (idx_type != H5_INDEX_NAME) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query"); /* Get the object's name from the symbol table */ if (H5G__stab_get_name_by_idx(oloc, order, n, name, name_size, name_len) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name"); } /* end else */ done: @@ -825,9 +795,6 @@ H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_orde * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Nov 14, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -838,8 +805,8 @@ H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *linfo) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(oloc); - HDassert(linfo); + assert(oloc); + assert(linfo); /* Decrement # of links in group */ linfo->nlinks--; @@ -849,12 +816,12 @@ H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *linfo) linfo->max_corder = 0; /* Check for transitioning out of dense storage, if we are using it */ - if (H5F_addr_defined(linfo->fheap_addr)) { + if (H5_addr_defined(linfo->fheap_addr)) { /* Check if there's no more links */ if (linfo->nlinks == 0) { /* Delete the dense storage */ if (H5G__dense_delete(oloc->file, linfo, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage"); } /* end if */ /* Check for switching back to compact storage */ else { @@ -862,7 +829,7 @@ H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *linfo) /* Get the group info */ if (NULL == H5O_msg_read(oloc, H5O_GINFO_ID, &ginfo)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info"); /* Check if we should switch from dense storage back to link messages */ if (linfo->nlinks < ginfo.min_dense) { @@ -873,11 +840,11 @@ H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *linfo) /* Build the table of links for this group */ if (H5G__dense_build_table(oloc->file, linfo, H5_INDEX_NAME, H5_ITER_NATIVE, <able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links") + HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links"); /* Pin the object header */ if (NULL == (oh = H5O_pin(oloc))) - HGOTO_ERROR(H5E_SYM, H5E_CANTPIN, FAIL, "unable to pin group object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTPIN, FAIL, "unable to pin group object header"); /* Inspect links in table for ones that can't be converted back * into link message form (currently only links which can't fit @@ -899,30 +866,30 @@ H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *linfo) /* Release object header */ if (H5O_unpin(oh) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTUNPIN, FAIL, - "unable to unpin group object header") + "unable to unpin group object header"); - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); } /* end if */ /* Remove the dense storage */ if (H5G__dense_delete(oloc->file, linfo, FALSE) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete dense link storage"); } /* end if */ /* Release object header */ if (H5O_unpin(oh) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTUNPIN, FAIL, "unable to unpin group object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTUNPIN, FAIL, "unable to unpin group object header"); /* Free link table information */ if (H5G__link_release_table(<able) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") + HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table"); } /* end if */ } /* end else */ } /* end if */ /* Update link info in the object header */ if (H5O_msg_write(oloc, H5O_LINFO_ID, 0, H5O_UPDATE_TIME, linfo) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update link info message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -936,9 +903,6 @@ H5G__obj_remove_update_linfo(const H5O_loc_t *oloc, H5O_linfo_t *linfo) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Sep 19, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -952,26 +916,26 @@ H5G_obj_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *n FUNC_ENTER_NOAPI_TAG(oloc->addr, FAIL) /* Sanity check */ - HDassert(oloc); - HDassert(name && *name); + assert(oloc); + assert(name && *name); /* Attempt to get the link info for this group */ if ((linfo_exists = H5G__obj_get_linfo(oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message"); if (linfo_exists) { /* Using the new format for groups */ use_old_format = FALSE; /* Check for dense or compact storage */ - if (H5F_addr_defined(linfo.fheap_addr)) { + if (H5_addr_defined(linfo.fheap_addr)) { /* Remove object from the dense link storage */ if (H5G__dense_remove(oloc->file, &linfo, grp_full_path_r, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object"); } /* end if */ else /* Remove object from the link messages */ if (H5G__compact_remove(oloc, grp_full_path_r, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object"); } /* end if */ else { /* Using the old format for groups */ @@ -979,13 +943,13 @@ H5G_obj_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *n /* Remove object from the symbol table */ if (H5G__stab_remove(oloc, grp_full_path_r, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object"); } /* end else */ /* Update link info for a new-style group */ if (!use_old_format) if (H5G__obj_remove_update_linfo(oloc, &linfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTUPDATE, FAIL, "unable to update link info") + HGOTO_ERROR(H5E_SYM, H5E_CANTUPDATE, FAIL, "unable to update link info"); done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -999,9 +963,6 @@ H5G_obj_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *n * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Nov 14, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1016,51 +977,51 @@ H5G_obj_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, H5 FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(grp_oloc && grp_oloc->file); + assert(grp_oloc && grp_oloc->file); /* Attempt to get the link info for this group */ if ((linfo_exists = H5G__obj_get_linfo(grp_oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message"); if (linfo_exists) { /* Check for creation order tracking, if creation order index lookup requested */ if (idx_type == H5_INDEX_CRT_ORDER) { /* Check if creation order is tracked */ if (!linfo.track_corder) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group"); } /* end if */ /* Using the new format for groups */ use_old_format = FALSE; /* Check for dense or compact storage */ - if (H5F_addr_defined(linfo.fheap_addr)) { + if (H5_addr_defined(linfo.fheap_addr)) { /* Remove object from the dense link storage */ if (H5G__dense_remove_by_idx(grp_oloc->file, &linfo, grp_full_path_r, idx_type, order, n) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object"); } /* end if */ else { /* Remove object from compact link storage */ if (H5G__compact_remove_by_idx(grp_oloc, &linfo, grp_full_path_r, idx_type, order, n) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object"); } /* end else */ } /* end if */ else { /* Can only perform name lookups on groups with symbol tables */ if (idx_type != H5_INDEX_NAME) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query"); /* Using the old format for groups */ use_old_format = TRUE; /* Remove object from the symbol table */ if (H5G__stab_remove_by_idx(grp_oloc, grp_full_path_r, order, n) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't remove object"); } /* end else */ /* Update link info for a new-style group */ if (!use_old_format) if (H5G__obj_remove_update_linfo(grp_oloc, &linfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTUPDATE, FAIL, "unable to update link info") + HGOTO_ERROR(H5E_SYM, H5E_CANTUPDATE, FAIL, "unable to update link info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1073,9 +1034,6 @@ H5G_obj_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, H5 * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 26 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1088,29 +1046,29 @@ H5G__obj_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found, H5O FUNC_ENTER_PACKAGE_TAG(grp_oloc->addr) /* check arguments */ - HDassert(grp_oloc && grp_oloc->file); - HDassert(name && *name); + assert(grp_oloc && grp_oloc->file); + assert(name && *name); /* Attempt to get the link info message for this group */ if ((linfo_exists = H5G__obj_get_linfo(grp_oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message"); if (linfo_exists) { /* Check for dense link storage */ - if (H5F_addr_defined(linfo.fheap_addr)) { + if (H5_addr_defined(linfo.fheap_addr)) { /* Get the object's info from the dense link storage */ if (H5G__dense_lookup(grp_oloc->file, &linfo, name, found, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object"); } /* end if */ else { /* Get the object's info from the link messages */ if (H5G__compact_lookup(grp_oloc, name, found, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object"); } /* end else */ } /* end if */ else /* Get the object's info from the symbol table */ if (H5G__stab_lookup(grp_oloc, name, found, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object"); done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -1124,9 +1082,6 @@ H5G__obj_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found, H5O * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 6 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1140,39 +1095,39 @@ H5G_obj_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_index_t idx_type, H5_iter_or FUNC_ENTER_NOAPI_TAG(grp_oloc->addr, FAIL) /* check arguments */ - HDassert(grp_oloc && grp_oloc->file); + assert(grp_oloc && grp_oloc->file); /* Attempt to get the link info message for this group */ if ((linfo_exists = H5G__obj_get_linfo(grp_oloc, &linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message"); if (linfo_exists) { /* Check for creation order tracking, if creation order index lookup requested */ if (idx_type == H5_INDEX_CRT_ORDER) { /* Check if creation order is tracked */ if (!linfo.track_corder) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group"); } /* end if */ /* Check for dense link storage */ - if (H5F_addr_defined(linfo.fheap_addr)) { + if (H5_addr_defined(linfo.fheap_addr)) { /* Get the link from the dense storage */ if (H5G__dense_lookup_by_idx(grp_oloc->file, &linfo, idx_type, order, n, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object"); } /* end if */ else { /* Get the link from the link messages */ if (H5G__compact_lookup_by_idx(grp_oloc, &linfo, idx_type, order, n, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object"); } /* end else */ } /* end if */ else { /* Can only perform name lookups on groups with symbol tables */ if (idx_type != H5_INDEX_NAME) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query"); /* Get the object's info from the symbol table */ if (H5G__stab_lookup_by_idx(grp_oloc, order, n, lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate object"); } /* end else */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Goh.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Goh.c index 1a2504a1d7..60836175e3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Goh.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Goh.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -87,9 +86,6 @@ H5FL_DEFINE(H5G_copy_file_ud_t); * * Failure: NULL * - * Programmer: Neil Fortner - * Thursday, July 30, 2009 - * *------------------------------------------------------------------------- */ static void * @@ -103,7 +99,7 @@ H5O__group_get_copy_file_udata(void) * Currently this is only a ginfo, so there is no specific struct type for * this operation. */ if (NULL == (ret_value = H5FL_CALLOC(H5G_copy_file_ud_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -117,9 +113,6 @@ H5O__group_get_copy_file_udata(void) * * Return: * - * Programmer: Neil Fortner - * Thursday, July 30, 2009 - * *------------------------------------------------------------------------- */ static void @@ -130,7 +123,7 @@ H5O__group_free_copy_file_udata(void *_udata) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(udata); + assert(udata); /* Free the ginfo struct (including nested data structs) */ H5O_msg_free(H5O_PLINE_ID, udata->common.src_pline); @@ -153,9 +146,6 @@ H5O__group_free_copy_file_udata(void *_udata) * Failure: FAIL if the existence of certain messages * cannot be determined. * - * Programmer: Robb Matzke - * Monday, November 2, 1998 - * *------------------------------------------------------------------------- */ static htri_t @@ -167,13 +157,13 @@ H5O__group_isa(const H5O_t *oh) FUNC_ENTER_PACKAGE - HDassert(oh); + assert(oh); /* Check for any of the messages that indicate a group */ if ((stab_exists = H5O_msg_exists_oh(oh, H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header"); if ((linfo_exists = H5O_msg_exists_oh(oh, H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header"); ret_value = (stab_exists > 0 || linfo_exists > 0); @@ -189,9 +179,6 @@ H5O__group_isa(const H5O_t *oh) * Return: Success: Pointer to group data * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static void * @@ -202,20 +189,20 @@ H5O__group_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) FUNC_ENTER_PACKAGE - HDassert(obj_loc); + assert(obj_loc); *opened_type = H5I_GROUP; /* Open the group */ if (NULL == (grp = H5G_open(obj_loc))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group"); ret_value = (void *)grp; done: if (NULL == ret_value) if (grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release group"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__group_open() */ @@ -228,9 +215,6 @@ H5O__group_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) * Return: Success: Pointer to the group data structure * Failure: NULL * - * Programmer: Quincey Koziol - * Tuesday, April 10, 2007 - * *------------------------------------------------------------------------- */ static void * @@ -243,19 +227,19 @@ H5O__group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(crt_info); - HDassert(obj_loc); + assert(f); + assert(crt_info); + assert(obj_loc); - /* Create the the group */ + /* Create the group */ if (NULL == (grp = H5G__create(f, crt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group"); /* Set up the new group's location */ if (NULL == (obj_loc->oloc = H5G_oloc(grp))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get object location of group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get object location of group"); if (NULL == (obj_loc->path = H5G_nameof(grp))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get path of group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get path of group"); /* Set the return value */ ret_value = grp; @@ -263,7 +247,7 @@ H5O__group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) done: if (ret_value == NULL) if (grp && H5G_close(grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release group") + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, NULL, "unable to release group"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__group_create() */ @@ -276,9 +260,6 @@ H5O__group_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) * Return: Success: Pointer to object header location * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static H5O_loc_t * @@ -291,11 +272,11 @@ H5O__group_get_oloc(hid_t obj_id) /* Get the group */ if (NULL == (grp = (H5G_t *)H5VL_object(obj_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID") + HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID"); /* Get the group's object header location */ if (NULL == (ret_value = H5G_oloc(grp))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -309,9 +290,6 @@ H5O__group_get_oloc(hid_t obj_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * July 12 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -326,55 +304,55 @@ H5O__group_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(oh); - HDassert(bh_info); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(oh); + assert(bh_info); /* Check for "new style" group info */ if ((exists = H5O_msg_exists_oh(oh, H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read object header"); if (exists > 0) { H5O_linfo_t linfo; /* Link info message */ /* Get "new style" group info */ if (NULL == H5O_msg_read_oh(loc->file, oh, H5O_LINFO_ID, &linfo)) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't read LINFO message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't read LINFO message"); /* Check if name index available */ - if (H5F_addr_defined(linfo.name_bt2_addr)) { + if (H5_addr_defined(linfo.name_bt2_addr)) { /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(loc->file, linfo.name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Get name index B-tree size */ if (H5B2_size(bt2_name, &bh_info->index_size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info for name index") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info for name index"); } /* end if */ /* Check if creation order index available */ - if (H5F_addr_defined(linfo.corder_bt2_addr)) { + if (H5_addr_defined(linfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ if (NULL == (bt2_corder = H5B2_open(loc->file, linfo.corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for creation order index") + "unable to open v2 B-tree for creation order index"); /* Get creation order index B-tree size */ if (H5B2_size(bt2_corder, &bh_info->index_size) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, - "can't retrieve B-tree storage info for creation order index") + "can't retrieve B-tree storage info for creation order index"); } /* end if */ /* Get fractal heap size, if available */ - if (H5F_addr_defined(linfo.fheap_addr)) { + if (H5_addr_defined(linfo.fheap_addr)) { /* Open the fractal heap for links */ if (NULL == (fheap = H5HF_open(loc->file, linfo.fheap_addr))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Get heap storage size */ if (H5HF_size(fheap, &bh_info->heap_size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info"); } /* end if */ } /* end if */ else { @@ -382,21 +360,21 @@ H5O__group_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5_ih_info_t *bh_info) /* Must be "old style" group, get symbol table message */ if (NULL == H5O_msg_read_oh(loc->file, oh, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't find LINFO nor STAB messages") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't find LINFO nor STAB messages"); /* Get symbol table size info */ if (H5G__stab_bh_size(loc->file, &stab, bh_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve symbol table size info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve symbol table size info"); } /* end else */ done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index"); if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__group_bh_info() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Groot.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Groot.c index 997d187cc8..7f5b9564a2 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Groot.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Groot.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Groot.c - * Apr 8 2009 - * Neil Fortner * * Purpose: Functions for operating on the root group. * @@ -81,9 +78,6 @@ * * Failure: NULL * - * Programmer: Robb Matzke - * Tuesday, October 13, 1998 - * *------------------------------------------------------------------------- */ H5G_t * @@ -92,17 +86,17 @@ H5G_rootof(H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Walk to top of mounted files */ while (f->parent) f = f->parent; /* Sanity check */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->root_grp); + assert(f); + assert(f->shared); + assert(f->shared->root_grp); /* Check to see if the root group was opened through a different * "top" file, and switch it to point at the current "top" file. @@ -125,9 +119,6 @@ H5G_rootof(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 11 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -143,26 +134,26 @@ H5G_mkroot(H5F_t *f, hbool_t create_root) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->sblock); + assert(f); + assert(f->shared); + assert(f->shared->sblock); /* Check if the root group is already initialized */ if (f->shared->root_grp) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Create information needed for group nodes */ if (H5G__node_init(f) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group node info") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group node info"); /* * Create the group pointer */ if (NULL == (f->shared->root_grp = H5FL_CALLOC(H5G_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); if (NULL == (f->shared->root_grp->shared = H5FL_CALLOC(H5G_shared_t))) { f->shared->root_grp = H5FL_FREE(H5G_t, f->shared->root_grp); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } /* end if */ /* Initialize the root_loc structure to point to fields in the newly created @@ -181,24 +172,24 @@ H5G_mkroot(H5F_t *f, hbool_t create_root) gcrt_info.gcpl_id = f->shared->fcpl_id; gcrt_info.cache_type = H5G_NOTHING_CACHED; if (H5G__obj_create(f, &gcrt_info, root_loc.oloc /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry"); if (1 != H5O_link(root_loc.oloc, 1)) - HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)") + HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)"); /* Decrement refcount on root group's object header in memory */ if (H5O_dec_rc_by_loc(root_loc.oloc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, - "unable to decrement refcount on root group's object header") + "unable to decrement refcount on root group's object header"); /* Mark superblock dirty, so root group info is flushed */ sblock_dirty = TRUE; /* Create the root group symbol table entry */ - HDassert(!f->shared->sblock->root_ent); + assert(!f->shared->sblock->root_ent); if (f->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_2) { /* Allocate space for the root group symbol table entry */ if (NULL == (f->shared->sblock->root_ent = (H5G_entry_t *)H5MM_calloc(sizeof(H5G_entry_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate space for symbol table entry") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate space for symbol table entry"); /* Initialize the root group symbol table entry */ f->shared->sblock->root_ent->type = gcrt_info.cache_type; @@ -217,7 +208,7 @@ H5G_mkroot(H5F_t *f, hbool_t create_root) * Open the root object as a group. */ if (H5O_open(root_loc.oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open root group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open root group"); /* Actions to take if the symbol table information is cached */ if (f->shared->sblock->root_ent && f->shared->sblock->root_ent->type == H5G_CACHED_STAB) { @@ -225,7 +216,7 @@ H5G_mkroot(H5F_t *f, hbool_t create_root) * not exist. This can happen if, for example, an external link is * added to the root group. */ if ((stab_exists = H5O_msg_exists(root_loc.oloc, H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check if symbol table message exists") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check if symbol table message exists"); /* Remove the cache if the stab does not exist */ if (!stab_exists) @@ -243,7 +234,7 @@ H5G_mkroot(H5F_t *f, hbool_t create_root) /* Check if the symbol table message is valid, and replace with the * cached symbol table if necessary */ if (H5G__stab_valid(root_loc.oloc, &cached_stab) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to verify symbol table") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to verify symbol table"); } /* end if */ #endif /* H5_STRICT_FORMAT_CHECKS */ } /* end if */ @@ -262,12 +253,12 @@ H5G_mkroot(H5F_t *f, hbool_t create_root) * to use the latest version while the superblock is an old version. * If stab_exists is not -1 then we have already checked. */ if (stab_exists == -1 && (stab_exists = H5O_msg_exists(root_loc.oloc, H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check if symbol table message exists") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check if symbol table message exists"); if (stab_exists) { /* Read the root group's symbol table message */ if (NULL == H5O_msg_read(root_loc.oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message"); /* Update the root group symbol table entry */ f->shared->sblock->root_ent->type = H5G_CACHED_STAB; @@ -288,7 +279,7 @@ H5G_mkroot(H5F_t *f, hbool_t create_root) * exists. Don't count either the superblock extension or the root group * in the number of open objects in the file. */ - HDassert((1 == f->nopen_objs) || (2 == f->nopen_objs && HADDR_UNDEF != f->shared->sblock->ext_addr)); + assert((1 == f->nopen_objs) || (2 == f->nopen_objs && HADDR_UNDEF != f->shared->sblock->ext_addr)); f->nopen_objs--; done: @@ -309,7 +300,7 @@ H5G_mkroot(H5F_t *f, hbool_t create_root) /* Mark superblock dirty in cache, if necessary */ if (sblock_dirty) if (H5AC_mark_entry_dirty(f->shared->sblock) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty") + HDONE_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_mkroot() */ @@ -324,9 +315,6 @@ H5G_mkroot(H5F_t *f, hbool_t create_root) * Return: Success: Non-negative * Failure: Negative * - * Programmer: James Laird - * Tuesday, September 7, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -335,8 +323,8 @@ H5G_root_free(H5G_t *grp) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(grp && grp->shared); - HDassert(grp->shared->fo_count > 0); + assert(grp && grp->shared); + assert(grp->shared->fo_count > 0); /* Free the path */ H5G_name_free(&(grp->path)); @@ -355,9 +343,6 @@ H5G_root_free(H5G_t *grp) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Mar 5 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -368,18 +353,18 @@ H5G_root_loc(H5F_t *f, H5G_loc_t *loc) FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(loc); + assert(f); + assert(loc); /* Retrieve the root group for the file */ root_grp = H5G_rootof(f); - HDassert(root_grp); + assert(root_grp); /* Build the group location for the root group */ if (NULL == (loc->oloc = H5G_oloc(root_grp))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group"); if (NULL == (loc->path = H5G_nameof(root_grp))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group"); /* Patch up root group's object location to reflect this file */ /* (Since the root group info is only stored once for files which diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Group.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5Group.cpp deleted file mode 100644 index b017f4f6ee..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Group.cpp +++ /dev/null @@ -1,292 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5FaccProp.h" -#include "H5FcreatProp.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5DxferProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5AbstractDs.h" -#include "H5DataSpace.h" -#include "H5DataSet.h" -#include "H5CommonFG.h" -#include "H5Attribute.h" -#include "H5Group.h" -#include "H5File.h" -#include "H5Alltypes.h" - -namespace H5 { -using std::cerr; -using std::endl; - -//-------------------------------------------------------------------------- -// Function: Group default constructor -///\brief Default constructor: creates a stub Group. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) -{ -} - -//-------------------------------------------------------------------------- -// Function: Group copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param original - IN: Original group to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Group::Group(const Group &original) : H5Object(), CommonFG(), id(original.id) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: Group::closeObjId -///\brief Closes an object, which was opened with Group::getObjId -/// -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - March, 2017 -//-------------------------------------------------------------------------- -void -Group::closeObjId(hid_t obj_id) const -{ - herr_t ret_value = H5Oclose(obj_id); - if (ret_value < 0) { - throwException("Group::closeObjId", "H5Oclose failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: Group::getLocId -// Purpose: Get the id of this group -// Programmer Binh-Minh Ribler - 2000 -// Description -// This function is a redefinition of CommonFG::getLocId. It -// is used by CommonFG member functions to get the file id. -// Deprecated: -// Aug 18, 2016 -BMR -// After HDFFV-9920, the Group's methods can use getId() and -// getLocId() is kept for backward compatibility. -//-------------------------------------------------------------------------- -hid_t -Group::getLocId() const -{ - return (getId()); -} - -//-------------------------------------------------------------------------- -// Function: Group overloaded constructor -///\brief Creates a Group object using the id of an existing group. -///\param existing_id - IN: Id of an existing group -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: Group overload constructor - dereference -///\brief Given a reference, ref, to an hdf5 group, creates a Group object -///\param loc - IN: Specifying location referenced object is in -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type - default to H5R_OBJECT -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException -///\par Description -/// \c obj can be DataSet, Group, or named DataType, that -/// is a datatype that has been named by DataType::commit. -// Programmer Binh-Minh Ribler - Oct, 2006 -//-------------------------------------------------------------------------- -Group::Group(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist) - : H5Object(), CommonFG(), id(H5I_INVALID_HID) -{ - id = H5Location::p_dereference(loc.getId(), ref, ref_type, plist, "constructor - by dereference"); -} - -//-------------------------------------------------------------------------- -// Function: Group::getNumObjs -///\brief Returns the number of objects in this group. -///\return Number of objects -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - January, 2003 -//-------------------------------------------------------------------------- -hsize_t -Group::getNumObjs() const -{ - H5G_info_t ginfo; // Group information - - herr_t ret_value = H5Gget_info(getId(), &ginfo); - if (ret_value < 0) - throwException("getNumObjs", "H5Gget_info failed"); - return (ginfo.nlinks); -} - -//-------------------------------------------------------------------------- -// Function: Group::getObjId -///\brief Opens an object via object header. -///\param obj_name - IN: Path to the object -///\param plist - IN: Access property list for the link pointing to -/// the object -///\exception H5::FileIException or H5::GroupIException -///\par Description -/// This function opens an object in a group or file, using -/// H5Oopen. Thus, an object can be opened without knowing -/// the object's type. -// Programmer Binh-Minh Ribler - March, 2017 -//-------------------------------------------------------------------------- -hid_t -Group::getObjId(const char *obj_name, const PropList &plist) const -{ - hid_t ret_value = H5Oopen(getId(), obj_name, plist.getId()); - if (ret_value < 0) { - throwException("Group::getObjId", "H5Oopen failed"); - } - return (ret_value); -} - -//-------------------------------------------------------------------------- -// Function: Group::getObjId -///\brief This is an overloaded member function, provided for convenience. -/// It takes a reference to a \c H5std_string for the object's name. -///\param obj_name - IN: Path to the object -///\param plist - IN: Access property list for the link pointing to -/// the object -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - March, 2017 -//-------------------------------------------------------------------------- -hid_t -Group::getObjId(const H5std_string &obj_name, const PropList &plist) const -{ - return (getObjId(obj_name.c_str(), plist)); -} - -//-------------------------------------------------------------------------- -// Function: Group::getId -///\brief Get the id of this group -///\return Group identifier -// Modification: -// May 2008 - BMR -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 -//-------------------------------------------------------------------------- -hid_t -Group::getId() const -{ - return (id); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: Group::p_setId -///\brief Sets the identifier of this object to a new value. -/// -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails -// Description: -// The underlying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Group::p_setId(const hid_t new_id) -{ - // handling references to this old id - try { - close(); - } - catch (Exception &close_error) { - throwException("Group::p_setId", close_error.getDetailMsg()); - } - // reset object's id to the given id - id = new_id; -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: Group::close -///\brief Closes this group. -/// -///\exception H5::GroupIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 -//-------------------------------------------------------------------------- -void -Group::close() -{ - if (p_valid_id(id)) { - herr_t ret_value = H5Gclose(id); - if (ret_value < 0) { - throwException("Group::close", "H5Gclose failed"); - } - // reset the id - id = H5I_INVALID_HID; - } -} - -//-------------------------------------------------------------------------- -// Function: Group::throwException -///\brief Throws H5::GroupIException. -///\param func_name - Name of the function where failure occurs -///\param msg - Message describing the failure -///\exception H5::GroupIException -// Description -// This function is also used in H5Location's methods so that -// proper exception can be thrown for file or group. The -// "Group::" will be inserted to indicate the function called is -// an implementation of Group. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -Group::throwException(const H5std_string &func_name, const H5std_string &msg) const -{ - H5std_string full_name = func_name; - full_name.insert(0, "Group::"); - throw GroupIException(full_name, msg); -} - -//-------------------------------------------------------------------------- -// Function: Group destructor -///\brief Properly terminates access to this group. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Feb 20, 2005 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -Group::~Group() -{ - try { - close(); - } - catch (Exception &close_error) { - cerr << "Group::~Group - " << close_error.getDetailMsg() << endl; - } -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gstab.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gstab.c index a91b670438..e7f6c02ba7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gstab.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gstab.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,11 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Friday, September 19, 1997 - * - */ - /****************/ /* Module Setup */ /****************/ @@ -116,9 +110,6 @@ typedef struct H5G_bt_it_lbi_t { * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 7 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -133,35 +124,35 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint) /* * Check arguments. */ - HDassert(f); - HDassert(stab); - HDassert(size_hint > 0); + assert(f); + assert(stab); + assert(size_hint > 0); /* Create the B-tree */ if (H5B_create(f, H5B_SNODE, NULL, &(stab->btree_addr) /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree"); /* Create symbol table private heap */ if (H5HL_create(f, size_hint, &(stab->heap_addr) /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap"); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(f, stab->heap_addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap"); /* Insert name into the heap */ if (H5HL_insert(f, heap, (size_t)1, "", &name_offset) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert name into heap"); /* B-trees won't work if the first name isn't at the beginning * of the heap. */ - HDassert(0 == name_offset); + assert(0 == name_offset); done: /* Release resources */ if (heap && FAIL == H5HL_unprotect(heap)) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__stab_create_components() */ @@ -180,9 +171,6 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 1 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -197,8 +185,8 @@ H5G__stab_create(H5O_loc_t *grp_oloc, const H5O_ginfo_t *ginfo, H5O_stab_t *stab /* * Check arguments. */ - HDassert(grp_oloc); - HDassert(stab); + assert(grp_oloc); + assert(stab); /* Adjust the size hint, if necessary */ if (ginfo->lheap_size_hint == 0) @@ -214,14 +202,14 @@ H5G__stab_create(H5O_loc_t *grp_oloc, const H5O_ginfo_t *ginfo, H5O_stab_t *stab /* Go create the B-tree & local heap */ if (H5G__stab_create_components(grp_oloc->file, stab, size_hint) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create symbol table components"); /* * Insert the symbol table message into the object header and the symbol * table entry. */ if (H5O_msg_create(grp_oloc, H5O_STAB_ID, 0, H5O_UPDATE_TIME, stab) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create message"); done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -236,9 +224,6 @@ H5G__stab_create(H5O_loc_t *grp_oloc, const H5O_ginfo_t *ginfo, H5O_stab_t *stab * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 7 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -252,14 +237,14 @@ H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, H5O_li FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); - HDassert(stab); - HDassert(name && *name); - HDassert(obj_lnk); + assert(f); + assert(stab); + assert(name && *name); + assert(obj_lnk); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(f, stab->heap_addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap"); /* Initialize data to pass through B-tree */ udata.common.name = name; @@ -270,12 +255,12 @@ H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, H5O_li /* Insert into symbol table */ if (H5B_insert(f, H5B_SNODE, stab->btree_addr, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert entry"); done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__stab_insert_real() */ @@ -289,9 +274,6 @@ H5G__stab_insert_real(H5F_t *f, const H5O_stab_t *stab, const char *name, H5O_li * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 1 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -304,16 +286,16 @@ H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_ln FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(grp_oloc && grp_oloc->file); - HDassert(name && *name); - HDassert(obj_lnk); + assert(grp_oloc && grp_oloc->file); + assert(name && *name); + assert(obj_lnk); /* Retrieve symbol table message */ if (NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); if (H5G__stab_insert_real(grp_oloc->file, &stab, name, obj_lnk, obj_type, crt_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "unable to insert the name"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -326,9 +308,6 @@ H5G__stab_insert(const H5O_loc_t *grp_oloc, const char *name, H5O_link_t *obj_ln * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, September 17, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -341,16 +320,16 @@ H5G__stab_remove(const H5O_loc_t *loc, H5RS_str_t *grp_full_path_r, const char * FUNC_ENTER_PACKAGE - HDassert(loc && loc->file); - HDassert(name && *name); + assert(loc && loc->file); + assert(name && *name); /* Read in symbol table message */ if (NULL == H5O_msg_read(loc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(loc->file, stab.heap_addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap"); /* Initialize data to pass through B-tree */ udata.common.name = name; @@ -359,12 +338,12 @@ H5G__stab_remove(const H5O_loc_t *loc, H5RS_str_t *grp_full_path_r, const char * /* Remove from symbol table */ if (H5B_remove(loc->file, H5B_SNODE, stab.btree_addr, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry"); done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__stab_remove() */ @@ -376,9 +355,6 @@ H5G__stab_remove(const H5O_loc_t *loc, H5RS_str_t *grp_full_path_r, const char * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, November 15, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -394,20 +370,20 @@ H5G__stab_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, FUNC_ENTER_PACKAGE - HDassert(grp_oloc && grp_oloc->file); + assert(grp_oloc && grp_oloc->file); /* Look up name of link to remove, by index */ if (H5G__stab_lookup_by_idx(grp_oloc, order, n, &obj_lnk) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get link information") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get link information"); lnk_copied = TRUE; /* Read in symbol table message */ if (NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "not a symbol table"); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(grp_oloc->file, stab.heap_addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap"); /* Initialize data to pass through B-tree */ udata.common.name = obj_lnk.name; @@ -416,12 +392,12 @@ H5G__stab_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, /* Remove link from symbol table */ if (H5B_remove(grp_oloc->file, H5B_SNODE, stab.btree_addr, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to remove entry"); done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); /* Reset the link information, if we have a copy */ if (lnk_copied) @@ -437,9 +413,6 @@ H5G__stab_remove_by_idx(const H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -451,14 +424,14 @@ H5G__stab_delete(H5F_t *f, const H5O_stab_t *stab) FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(stab); - HDassert(H5F_addr_defined(stab->btree_addr)); - HDassert(H5F_addr_defined(stab->heap_addr)); + assert(f); + assert(stab); + assert(H5_addr_defined(stab->btree_addr)); + assert(H5_addr_defined(stab->heap_addr)); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(f, stab->heap_addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap"); /* Set up user data for B-tree deletion */ udata.common.name = NULL; @@ -466,21 +439,21 @@ H5G__stab_delete(H5F_t *f, const H5O_stab_t *stab) /* Delete entire B-tree */ if (H5B_delete(f, H5B_SNODE, stab->btree_addr, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table B-tree"); /* Release resources */ if (H5HL_unprotect(heap) < 0) - HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); heap = NULL; /* Delete local heap for names */ if (H5HL_delete(f, stab->heap_addr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "unable to delete symbol table heap"); done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__stab_delete() */ @@ -492,9 +465,6 @@ H5G__stab_delete(H5F_t *f, const H5O_stab_t *stab) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, October 3, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -509,16 +479,16 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t skip, hs FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(oloc); - HDassert(op); + assert(oloc); + assert(op); /* Get the B-tree info */ if (NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address"); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap"); /* Check on iteration order */ /* ("native" iteration order is increasing for this link storage mechanism) */ @@ -539,7 +509,7 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t skip, hs /* Check for too high of a starting index (ex post facto :-) */ /* (Skipping exactly as many entries as are in the group is currently an error) */ if (skip > 0 && skip >= *last_lnk) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified"); } /* end if */ else { H5G_bt_it_bt_t udata; /* User data to pass to B-tree callback */ @@ -551,15 +521,15 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t skip, hs /* Iterate over the group members */ if (H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_build_table, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to build link table") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to build link table"); /* Check for skipping out of bounds */ if (skip > 0 && (size_t)skip >= ltable.nlinks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound"); /* Sort link table in correct iteration order */ if (H5G__link_sort_table(<able, H5_INDEX_NAME, order) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages") + HGOTO_ERROR(H5E_SYM, H5E_CANTSORT, FAIL, "error sorting link messages"); /* Iterate over links in table */ if ((ret_value = H5G__link_iterate_table(<able, skip, last_lnk, op, op_data)) < 0) @@ -569,9 +539,9 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t skip, hs done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); if (ltable.lnks && H5G__link_release_table(<able) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table") + HDONE_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to release link table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__stab_iterate() */ @@ -583,9 +553,6 @@ H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t skip, hs * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 6, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -597,19 +564,19 @@ H5G__stab_count(const H5O_loc_t *oloc, hsize_t *num_objs) FUNC_ENTER_PACKAGE_TAG(oloc->addr) /* Sanity check */ - HDassert(oloc); - HDassert(num_objs); + assert(oloc); + assert(num_objs); /* Reset the number of objects in the group */ *num_objs = 0; /* Get the B-tree info */ if (NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address"); /* Iterate over the group members */ if (H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_sumup, num_objs) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed"); done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -622,9 +589,6 @@ H5G__stab_count(const H5O_loc_t *oloc, hsize_t *num_objs) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * June 25 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -637,23 +601,23 @@ H5G__stab_bh_size(H5F_t *f, const H5O_stab_t *stab, H5_ih_info_t *bh_info) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(stab); - HDassert(bh_info); + assert(f); + assert(stab); + assert(bh_info); /* Set up user data for B-tree iteration */ snode_size = 0; /* Get the B-tree & symbol table node size info */ if (H5B_get_info(f, H5B_SNODE, stab->btree_addr, &bt_info, H5G__node_iterate_size, &snode_size) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "iteration operator failed"); /* Add symbol table & B-tree node sizes to index info */ bh_info->index_size += snode_size + bt_info.size; /* Get the size of the local heap for the group */ if (H5HL_heapsize(f, stab->heap_addr, &(bh_info->heap_size)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "iteration operator failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -668,9 +632,6 @@ H5G__stab_bh_size(H5F_t *f, const H5O_stab_t *stab, H5_ih_info_t *bh_info) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Nov 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -684,17 +645,17 @@ H5G__stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(ent); - HDassert(udata && udata->heap); + assert(ent); + assert(udata && udata->heap); /* Get name offset in heap */ name_off = ent->name_off; if ((name = (const char *)H5HL_offset_into(udata->heap, name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table link name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table link name"); if ((udata->name = H5MM_strdup(name)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to duplicate symbol table link name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to duplicate symbol table link name"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -707,9 +668,6 @@ H5G__stab_get_name_by_idx_cb(const H5G_entry_t *ent, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Nov 20, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -723,20 +681,20 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t herr_t ret_value = SUCCEED; /* Return value */ /* Portably clear udata struct (before FUNC_ENTER) */ - HDmemset(&udata, 0, sizeof(udata)); + memset(&udata, 0, sizeof(udata)); FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(oloc); + assert(oloc); /* Get the B-tree & local heap info */ if (NULL == H5O_msg_read(oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address"); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap"); /* Remap index for decreasing iteration order */ if (order == H5_ITER_DEC) { @@ -744,7 +702,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t /* Iterate over the symbol table nodes, to count the links */ if (H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_sumup, &nlinks) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed"); /* Map decreasing iteration order index to increasing iteration order index */ n = nlinks - (n + 1); @@ -760,11 +718,11 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t /* Iterate over the group members */ if (H5B_iterate(oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed"); /* If we don't know the name now, we almost certainly went out of bounds */ if (udata.name == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound"); /* Get the length of the name */ *name_len = HDstrlen(udata.name); @@ -779,7 +737,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); /* Free the duplicated name */ if (udata_valid && udata.name != NULL) @@ -797,9 +755,6 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t * * Failure: Negative * - * Programmer: Quincey Koziol - * Sep 20, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -814,7 +769,7 @@ H5G__stab_lookup_cb(const H5G_entry_t *ent, void *_udata) if (udata->lnk) /* Convert the entry to a link */ if (H5G__ent_to_link(udata->lnk, udata->heap, ent, udata->name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link") + HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -827,9 +782,6 @@ H5G__stab_lookup_cb(const H5G_entry_t *ent, void *_udata) * * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 20 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -844,18 +796,18 @@ H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found, H5 FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(grp_oloc && grp_oloc->file); - HDassert(name && *name); - HDassert(found); - HDassert(lnk); + assert(grp_oloc && grp_oloc->file); + assert(name && *name); + assert(found); + assert(lnk); /* Retrieve the symbol table message for the group */ if (NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't read message") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't read message"); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(grp_oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap"); /* Set up user data to pass to 'find' operation callback */ udata.name = name; @@ -870,12 +822,12 @@ H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found, H5 /* Search the B-tree */ if (H5B_find(grp_oloc->file, H5B_SNODE, stab.btree_addr, found, &bt_udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "not found"); done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__stab_lookup() */ @@ -889,9 +841,6 @@ H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found, H5 * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Nov 9, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -904,16 +853,16 @@ H5G__stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(ent); - HDassert(udata && udata->heap); + assert(ent); + assert(udata && udata->heap); /* Get a pointer to the link name */ if ((name = (const char *)H5HL_offset_into(udata->heap, ent->name_off)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table link name") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table link name"); /* Convert the entry to a link */ if (H5G__ent_to_link(udata->lnk, udata->heap, ent, name) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link") + HGOTO_ERROR(H5E_SYM, H5E_CANTCONVERT, FAIL, "unable to convert symbol table entry to link"); udata->found = TRUE; done: @@ -927,9 +876,6 @@ H5G__stab_lookup_by_idx_cb(const H5G_entry_t *ent, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 7 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -943,16 +889,16 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(grp_oloc && grp_oloc->file); - HDassert(lnk); + assert(grp_oloc && grp_oloc->file); + assert(lnk); /* Get the B-tree & local heap info */ if (NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address"); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(grp_oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap") + HGOTO_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to protect symbol table heap"); /* Remap index for decreasing iteration order */ if (order == H5_ITER_DEC) { @@ -960,7 +906,7 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ /* Iterate over the symbol table nodes, to count the links */ if (H5B_iterate(grp_oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_sumup, &nlinks) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed"); /* Map decreasing iteration order index to increasing iteration order index */ n = nlinks - (n + 1); @@ -976,16 +922,16 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ /* Iterate over the group members */ if (H5B_iterate(grp_oloc->file, H5B_SNODE, stab.btree_addr, H5G__node_by_idx, &udata) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "iteration operator failed"); /* If we didn't find the link, we almost certainly went out of bounds */ if (!udata.found) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound"); done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__stab_lookup_by_idx() */ @@ -1008,9 +954,6 @@ H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Mar 17, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -1032,7 +975,7 @@ H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab) /* Address is invalid, try the b-tree address in the alternate symbol * table message */ if (!alt_stab || H5B_valid(grp_oloc->file, H5B_SNODE, alt_stab->btree_addr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to locate b-tree") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to locate b-tree"); else { /* The alternate symbol table's b-tree address is valid. Adjust the * symbol table message in the group. */ @@ -1047,7 +990,7 @@ H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab) * table message */ if (!alt_stab || NULL == (heap = H5HL_protect(grp_oloc->file, alt_stab->heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "unable to locate heap") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "unable to locate heap"); else { /* The alternate symbol table's heap address is valid. Adjust the * symbol table message in the group. */ @@ -1060,13 +1003,13 @@ H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab) if (changed) { H5E_clear_stack(NULL); if (H5O_msg_write(grp_oloc, H5O_STAB_ID, 0, H5O_UPDATE_TIME | H5O_UPDATE_FORCE, &stab) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to correct symbol table message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to correct symbol table message"); } /* end if */ done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5G__stab_valid */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gtest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gtest.c index bc1f78465a..a68ffaee9f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gtest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gtest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Monday, October 17, 2005 - * +/* * Purpose: Group testing functions. */ @@ -96,90 +93,90 @@ H5G__is_empty_test(hid_t gid) /* Get group structure */ if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* "New format" checks */ /* Check if the group has any link messages */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists > 0) { /* Sanity check that new group format shouldn't have old messages */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found"); - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ /* Check for a link info message */ if ((linfo_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (linfo_exists > 0) { H5O_linfo_t linfo; /* Link info message */ /* Sanity check that new group format shouldn't have old messages */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found"); /* Get the link info */ if (H5G__obj_get_linfo(&(grp->oloc), &linfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info"); /* Check for 'dense' link storage file addresses being defined */ - if (H5F_addr_defined(linfo.fheap_addr)) - HGOTO_DONE(FALSE) - if (H5F_addr_defined(linfo.name_bt2_addr)) - HGOTO_DONE(FALSE) - if (H5F_addr_defined(linfo.corder_bt2_addr)) - HGOTO_DONE(FALSE) + if (H5_addr_defined(linfo.fheap_addr)) + HGOTO_DONE(FALSE); + if (H5_addr_defined(linfo.name_bt2_addr)) + HGOTO_DONE(FALSE); + if (H5_addr_defined(linfo.corder_bt2_addr)) + HGOTO_DONE(FALSE); /* Check for link count */ if (linfo.nlinks > 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ /* "Old format" checks */ /* Check if the group has a symbol table message */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists > 0) { H5O_stab_t stab; /* Info about local heap & B-tree */ hsize_t nlinks; /* Number of links in the group */ /* Sanity check that old group format shouldn't have new messages */ if (linfo_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link info messages found"); if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and group info messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and group info messages found"); /* Get the B-tree & local heap info */ if (NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol table message") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol table message"); /* Get the count of links in the group */ if (H5G__stab_count(&(grp->oloc), &nlinks) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to count links") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to count links"); /* Check for link count */ if (nlinks > 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ done: if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5G__is_empty_test() */ @@ -215,24 +212,24 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) /* Get group structure */ if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Check if the group has any link messages */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists == 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Check if the group has a symbol table message */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found"); /* Check if we should retrieve the number of link messages */ if (nmsgs) { @@ -240,13 +237,13 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) /* Check how many link messages there are */ if ((msg_count = H5O_msg_count(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count link messages") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to count link messages"); *nmsgs = (unsigned)msg_count; } /* end if */ done: if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5G__has_links_test() */ @@ -281,28 +278,28 @@ H5G__has_stab_test(hid_t gid) /* Get group structure */ if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Check if the group has a symbol table message */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists == 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Check if the group has any link messages */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists > 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "both symbol table and link messages found"); done: if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5G__has_stab_test() */ @@ -339,45 +336,45 @@ H5G__is_new_dense_test(hid_t gid) /* Get group structure */ if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Check if the group has a symbol table message */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists > 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Check if the group has any link messages */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINK_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists > 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Check if the group has link info message */ if ((msg_exists = H5O_msg_exists(&(grp->oloc), H5O_LINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); if (msg_exists > 0) { H5O_linfo_t linfo; /* Link info message */ /* Get the link info */ if (H5G__obj_get_linfo(&(grp->oloc), &linfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info"); /* Check for 'dense' link storage file addresses being defined */ - if (!H5F_addr_defined(linfo.fheap_addr)) - HGOTO_DONE(FALSE) - if (!H5F_addr_defined(linfo.name_bt2_addr)) - HGOTO_DONE(FALSE) + if (!H5_addr_defined(linfo.fheap_addr)) + HGOTO_DONE(FALSE); + if (!H5_addr_defined(linfo.name_bt2_addr)) + HGOTO_DONE(FALSE); } /* end if */ done: if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5G__is_new_dense_test() */ @@ -417,45 +414,45 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) /* Get group structure */ if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Set metadata tag in API context */ - H5_BEGIN_TAG(grp->oloc.addr); + H5_BEGIN_TAG(grp->oloc.addr) /* Get the link info */ if (H5G__obj_get_linfo(&(grp->oloc), &linfo) < 0) - HGOTO_ERROR_TAG(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info") + HGOTO_ERROR_TAG(H5E_SYM, H5E_BADMESG, FAIL, "can't get link info"); /* Check for 'dense' link storage file addresses being defined */ - if (!H5F_addr_defined(linfo.fheap_addr)) - HGOTO_DONE_TAG(FAIL) - if (!H5F_addr_defined(linfo.name_bt2_addr)) - HGOTO_DONE_TAG(FAIL) + if (!H5_addr_defined(linfo.fheap_addr)) + HGOTO_DONE_TAG(FAIL); + if (!H5_addr_defined(linfo.name_bt2_addr)) + HGOTO_DONE_TAG(FAIL); /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(grp->oloc.file, linfo.name_bt2_addr, NULL))) - HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Retrieve # of records in name index */ if (H5B2_get_nrec(bt2_name, name_count) < 0) - HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index") + HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index"); /* Check if there is a creation order index */ - if (H5F_addr_defined(linfo.corder_bt2_addr)) { + if (H5_addr_defined(linfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ if (NULL == (bt2_corder = H5B2_open(grp->oloc.file, linfo.corder_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for creation order index") + "unable to open v2 B-tree for creation order index"); /* Retrieve # of records in creation order index */ if (H5B2_get_nrec(bt2_corder, corder_count) < 0) HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTCOUNT, FAIL, - "unable to retrieve # of records from creation order index") + "unable to retrieve # of records from creation order index"); } /* end if */ else *corder_count = 0; @@ -466,11 +463,11 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) done: /* Release resources */ if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index"); if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_SYM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index"); if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5G__new_dense_info_test() */ @@ -506,24 +503,24 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) /* Get group structure */ if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Make certain the group has a symbol table message */ if (NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbol table message"); /* Check the size of the local heap for the group */ if (H5HL_get_size(grp->oloc.file, stab.heap_addr, lheap_size) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size") + HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, FAIL, "can't query local heap size"); done: if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5G__lheap_size_test() */ @@ -561,16 +558,16 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(user_path_len); - HDassert(obj_hidden); + assert(user_path_len); + assert(obj_hidden); /* Get pointer to object for ID */ if (NULL == (obj_ptr = H5VL_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get object for ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get object for ID"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Get the symbol table entry */ @@ -586,13 +583,13 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign case H5I_DATATYPE: /* Avoid non-named datatypes */ if (!H5T_is_named((H5T_t *)obj_ptr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a named datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a named datatype"); obj_path = H5T_nameof((H5T_t *)obj_ptr); break; case H5I_MAP: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector"); case H5I_UNINIT: case H5I_BADID: @@ -610,9 +607,9 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign case H5I_EVENTSET: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object type"); } /* end switch */ - HDassert(obj_path); + assert(obj_path); /* Retrieve a copy of the user path and put it into the buffer */ if (obj_path->user_path_r) { @@ -635,7 +632,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign done: if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5G__user_path_test() */ @@ -650,9 +647,6 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign * * Return: SUCCEED/FAIL * - * Programmer: Neil Fortner - * Mar 31, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -666,30 +660,30 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) /* Verify that stab info is cached in ent */ if (ent->type != H5G_CACHED_STAB) - HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "symbol table information is not cached") + HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "symbol table information is not cached"); /* Read the symbol table message from the group */ if (NULL == H5O_msg_read(grp_oloc, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "unable to read symbol table message"); /* Verify that the cached symbol table info matches the symbol table message * in the object header. */ if ((ent->cache.stab.btree_addr != stab.btree_addr) || (ent->cache.stab.heap_addr != stab.heap_addr)) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "cached stab info does not match object header"); /* Verify that the btree address is valid */ if (H5B_valid(grp_oloc->file, H5B_SNODE, stab.btree_addr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "b-tree address is invalid") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "b-tree address is invalid"); /* Verify that the heap address is valid */ if (NULL == (heap = H5HL_protect(grp_oloc->file, stab.heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "heap address is invalid") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "heap address is invalid"); done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, FAIL, "unable to unprotect symbol table heap"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5G__verify_cached_stab_test() */ @@ -704,9 +698,6 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) * * Return: H5_ITER_STOP/H5_ITER_CONT/H5_ITER_ERROR * - * Programmer: Neil Fortner - * Apr 8, 2011 - * *------------------------------------------------------------------------- */ static int @@ -724,12 +715,12 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, h FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(H5_addr_defined(addr)); /* Load the node */ if (NULL == (sn = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5_ITER_ERROR, "unable to load symbol table node"); /* Check each target object to see if its stab message (if present) matches * the cached stab (if present). If one exists, both must exist. */ @@ -744,28 +735,28 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, h /* Load target object header */ if (NULL == (targ_oh = H5O_protect(&targ_oloc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_SYM, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to protect target object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to protect target object header"); /* Check if a symbol table message exists */ if ((stab_exists = H5O_msg_exists_oh(targ_oh, H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "unable to check for STAB message") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, H5_ITER_ERROR, "unable to check for STAB message"); if (stab_exists) { /* Read symbol table message */ if (NULL == H5O_msg_read_oh(f, targ_oh, H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to read STAB message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to read STAB message"); /* Check if the stab matches the cached stab info */ if (sn->entry[i].type != H5G_CACHED_STAB) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "STAB message is not cached in group node") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "STAB message is not cached in group node"); if ((sn->entry[i].cache.stab.btree_addr != stab.btree_addr) || (sn->entry[i].cache.stab.heap_addr != stab.heap_addr)) HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, - "cached symbol table information is incorrect") + "cached symbol table information is incorrect"); } else if (sn->entry[i].type == H5G_CACHED_STAB) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "nonexistent STAB message is cached") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, H5_ITER_ERROR, "nonexistent STAB message is cached"); /* Unprotect target object */ if (H5O_unprotect(&targ_oloc, targ_oh, H5AC__NO_FLAGS_SET) < 0) @@ -775,10 +766,10 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, h done: if (sn && H5AC_unprotect(f, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") + HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header"); if (targ_oh) { - HDassert(ret_value == H5_ITER_ERROR); + assert(ret_value == H5_ITER_ERROR); if (H5O_unprotect(&targ_oloc, targ_oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to release object header"); } /* end if */ @@ -798,9 +789,6 @@ H5G__verify_cached_stabs_test_cb(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, h * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * April 6 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -816,11 +804,11 @@ H5G__verify_cached_stabs_test(hid_t gid) FUNC_ENTER_PACKAGE /* check args */ - HDassert(gid >= 0); + assert(gid >= 0); /* Check args */ if (NULL == (grp = (H5G_t *)H5VL_object_verify(gid, H5I_GROUP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group"); /* Set up metadata tagging */ H5AC_tag(grp->oloc.addr, &prev_tag); @@ -828,7 +816,7 @@ H5G__verify_cached_stabs_test(hid_t gid) /* Check for group having a symbol table message */ /* Check for the group having a group info message */ if ((stab_exists = H5O_msg_exists(&(grp->oloc), H5O_STAB_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header"); /* No need to check anything if the symbol table doesn't exist */ if (!stab_exists) @@ -836,7 +824,7 @@ H5G__verify_cached_stabs_test(hid_t gid) /* Read the stab */ if (NULL == H5O_msg_read(&(grp->oloc), H5O_STAB_ID, &stab)) - HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get symbol table info") + HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get symbol table info"); /* Iterate over the b-tree, checking validity of cached information */ if ((ret_value = H5B_iterate(grp->oloc.file, H5B_SNODE, stab.btree_addr, H5G__verify_cached_stabs_test_cb, diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Gtraverse.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Gtraverse.c index 168c61ac34..41e990c1e5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Gtraverse.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Gtraverse.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Gtraverse.c - * Sep 13 2005 - * Quincey Koziol * * Purpose: Functions for traversing group hierarchy * @@ -98,9 +95,6 @@ static herr_t H5G__traverse_real(const H5G_loc_t *loc, const char *name, unsigne * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 13, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -118,7 +112,7 @@ H5G__traverse_slink_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc, const char H5_ATTR_UNU if (udata->chk_exists) udata->exists = FALSE; else - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found"); } /* end if */ else { /* Copy new location information for resolved object */ @@ -144,9 +138,6 @@ H5G__traverse_slink_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc, const char H5_ATTR_UNU * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 13, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -166,14 +157,14 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(grp_loc); - HDassert(lnk); - HDassert(lnk->type >= H5L_TYPE_UD_MIN); - HDassert(obj_loc); + assert(grp_loc); + assert(lnk); + assert(lnk->type >= H5L_TYPE_UD_MIN); + assert(obj_loc); /* Get the link class for this type of link. */ if (NULL == (link_class = H5L_find_class(lnk->type))) - HGOTO_ERROR(H5E_SYM, H5E_NOTREGISTERED, FAIL, "unable to get UD link class") + HGOTO_ERROR(H5E_SYM, H5E_NOTREGISTERED, FAIL, "unable to get UD link class"); /* Set up location for user-defined callback. Use a copy of our current * grp_loc. */ @@ -181,13 +172,13 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G grp_loc_copy.oloc = &grp_oloc_copy; H5G_loc_reset(&grp_loc_copy); if (H5G_loc_copy(&grp_loc_copy, grp_loc, H5_COPY_DEEP) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object location") + HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "unable to copy object location"); /* Create a group ID to pass to the user-defined callback */ if (NULL == (grp = H5G_open(&grp_loc_copy))) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group"); if ((cur_grp = H5VL_wrap_register(H5I_GROUP, grp, FALSE)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group") + HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group"); /* User-defined callback function */ #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -218,12 +209,12 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G } /* end if */ /* else, we really needed to open the object */ else - HGOTO_ERROR(H5E_SYM, H5E_BADID, FAIL, "traversal callback returned invalid ID") + HGOTO_ERROR(H5E_SYM, H5E_BADID, FAIL, "traversal callback returned invalid ID"); } /* end if */ /* Get the object location information from the ID the user callback returned */ if (H5G_loc(cb_return, &new_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to get object location from ID") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to get object location from ID"); /* Release any previous location information for the object */ H5G_loc_free(obj_loc); @@ -235,22 +226,22 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G * object location will be invalidated when the file closes). */ if (H5O_loc_hold_file(obj_loc->oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open"); /* We have a copy of the location and we're holding the file open. * Close the open ID the user passed back. */ if (H5I_dec_ref(cb_return) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback") + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback"); cb_return = (hid_t)(-1); done: /* Close location given to callback. */ if (cur_grp > 0 && H5I_dec_ref(cur_grp) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID for current location") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID for current location"); if (ret_value < 0 && cb_return > 0 && H5I_dec_ref(cb_return) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__traverse_ud() */ @@ -266,9 +257,6 @@ H5G__traverse_ud(const H5G_loc_t *grp_loc /*in,out*/, const H5O_link_t *lnk, H5G * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, April 10, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -287,9 +275,9 @@ H5G__traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t * FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(grp_loc); - HDassert(lnk); - HDassert(lnk->type == H5L_TYPE_SOFT); + assert(grp_loc); + assert(lnk); + assert(lnk->type == H5L_TYPE_SOFT); /* Set up temporary location */ tmp_grp_loc.oloc = &tmp_grp_oloc; @@ -318,7 +306,7 @@ H5G__traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t * /* Traverse the link */ if (H5G__traverse_real(&tmp_grp_loc, lnk->u.soft.name, target, H5G__traverse_slink_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to follow symbolic link"); /* Pass back information about whether the object exists */ *obj_exists = udata.exists; @@ -344,9 +332,6 @@ H5G__traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 20 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -359,9 +344,9 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(grp_loc); - HDassert(lnk); - HDassert(obj_loc); + assert(grp_loc); + assert(lnk); + assert(obj_loc); /* If we found a symbolic link then we should follow it. But if this * is the last component of the name and the H5G_TARGET_SLINK bit of @@ -371,19 +356,19 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned /* Get the # of soft / UD links left to traverse */ if (H5CX_get_nlinks(&nlinks) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse"); /* Decrement # of links and range check */ if ((nlinks)-- <= 0) - HGOTO_ERROR(H5E_LINK, H5E_NLINKS, FAIL, "too many links") + HGOTO_ERROR(H5E_LINK, H5E_NLINKS, FAIL, "too many links"); /* Update the # of links in the API context */ if (H5CX_set_nlinks(nlinks) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't update # of soft / UD links to traverse") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't update # of soft / UD links to traverse"); /* Traverse soft link */ if (H5G__traverse_slink(grp_loc, lnk, obj_loc, (target & H5G_TARGET_EXISTS), obj_exists) < 0) - HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "symbolic link traversal failed") + HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "symbolic link traversal failed"); } /* end if */ /* @@ -395,19 +380,19 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned /* Get the # of soft / UD links left to traverse */ if (H5CX_get_nlinks(&nlinks) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse"); /* Decrement # of links and range check */ if ((nlinks)-- <= 0) - HGOTO_ERROR(H5E_LINK, H5E_NLINKS, FAIL, "too many links") + HGOTO_ERROR(H5E_LINK, H5E_NLINKS, FAIL, "too many links"); /* Update the # of links in the API context */ if (H5CX_set_nlinks(nlinks) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't update # of soft / UD links to traverse") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't update # of soft / UD links to traverse"); /* Traverse user-defined link */ if (H5G__traverse_ud(grp_loc, lnk, obj_loc, (target & H5G_TARGET_EXISTS), obj_exists) < 0) - HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "user-defined link traversal failed") + HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "user-defined link traversal failed"); } /* end if */ /* @@ -421,9 +406,9 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned * the status of the object (into a hard link), so don't use an 'else' * statement here. -QAK) */ - if (H5F_addr_defined(obj_loc->oloc->addr) && (0 == (target & H5G_TARGET_MOUNT) || !last_comp)) { + if (H5_addr_defined(obj_loc->oloc->addr) && (0 == (target & H5G_TARGET_MOUNT) || !last_comp)) { if (H5F_traverse_mount(obj_loc->oloc /*in,out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "mount point traversal failed") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "mount point traversal failed"); } /* end if */ /* If the grp_loc is the only thing holding an external file open @@ -432,7 +417,7 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned */ if (grp_loc->oloc->holding_file && grp_loc->oloc->file == obj_loc->oloc->file) if (H5O_loc_hold_file(obj_loc->oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -448,9 +433,6 @@ H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned * Failure: Negative if the name could not be fully * resolved. * - * Programmer: Robb Matzke - * Aug 11 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -478,9 +460,9 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G FUNC_ENTER_PACKAGE /* Check parameters */ - HDassert(_loc); - HDassert(name); - HDassert(op); + assert(_loc); + assert(name); + assert(op); /* * Where does the searching start? For absolute names it starts at the @@ -492,7 +474,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G /* Look up root group for starting location */ root_grp = H5G_rootof(_loc->oloc->file); - HDassert(root_grp); + assert(root_grp); /* Set the location entry to the root group's info */ loc.oloc = &(root_grp->oloc); @@ -512,25 +494,25 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G #if defined(H5_USING_MEMCHECKER) || !defined(NDEBUG) /* Clear group location */ if (H5G_loc_reset(&grp_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to reset location") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to reset location"); #endif /* H5_USING_MEMCHECKER */ /* Deep copy of the starting location to group location */ if (H5G_loc_copy(&grp_loc, &loc, H5_COPY_DEEP) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to copy location") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to copy location"); group_copy = TRUE; /* Clear object location */ if (H5G_loc_reset(&obj_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to reset location") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to reset location"); /* Wrap the local buffer for serialized header info */ if (NULL == (wb = H5WB_wrap(comp_buf, sizeof(comp_buf)))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer"); /* Get a pointer to a buffer that's large enough */ if (NULL == (comp = (char *)H5WB_actual(wb, (HDstrlen(name) + 1)))) - HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer") + HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer"); /* Traverse the path */ while ((name = H5G__component(name, &nchars)) && *name) { @@ -566,19 +548,19 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G /* Get information for object in current group */ lookup_status = FALSE; if (H5G__obj_lookup(grp_loc.oloc, comp, &lookup_status, &lnk /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't look up component") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't look up component"); obj_exists = FALSE; /* If the lookup was OK, build object location and traverse special links, etc. */ if (lookup_status) { /* Sanity check link and indicate it's valid */ - HDassert(lnk.type >= H5L_TYPE_HARD); - HDassert(!HDstrcmp(comp, lnk.name)); + assert(lnk.type >= H5L_TYPE_HARD); + assert(!HDstrcmp(comp, lnk.name)); link_valid = TRUE; /* Build object location from the link */ if (H5G__link_to_loc(&grp_loc, &lnk, &obj_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot initialize object location") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot initialize object location"); obj_loc_valid = TRUE; /* Assume object exists */ @@ -587,7 +569,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G /* Perform any special traversals that the link needs */ /* (soft links, user-defined links, file mounting, etc.) */ if (H5G__traverse_special(&grp_loc, &lnk, target, last_comp, &obj_loc, &obj_exists) < 0) - HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "special link traversal failed") + HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "special link traversal failed"); } /* end if */ /* Check for last component in name provided */ @@ -604,16 +586,16 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G cb_loc = NULL; } /* end if */ else { - HDassert(!obj_loc_valid); + assert(!obj_loc_valid); cb_lnk = NULL; cb_loc = NULL; } /* end else */ /* Call 'operator' routine */ if ((op)(&grp_loc, comp, cb_lnk, cb_loc, op_data, &own_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CALLBACK, FAIL, "traversal operator failed") + HGOTO_ERROR(H5E_SYM, H5E_CALLBACK, FAIL, "traversal operator failed"); - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Handle lookup failures now */ @@ -636,11 +618,11 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G /* Check for the parent group having a group info message */ /* (OK if not found) */ if ((exists = H5O_msg_exists(grp_loc.oloc, H5O_GINFO_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header"); if (exists) { /* Get the group info for parent group */ if (NULL == H5O_msg_read(grp_loc.oloc, H5O_GINFO_ID, &par_ginfo)) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "group info message not present") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "group info message not present"); /* Use parent group info settings */ ginfo = &par_ginfo; @@ -653,7 +635,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G /* (OK if not found) */ /* Get the link info for parent group */ if ((exists = H5G__obj_get_linfo(grp_loc.oloc, &par_linfo)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header"); if (exists) { /* Only keep the creation order information from the parent * group's link info @@ -670,11 +652,11 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G /* Check for the parent group having a filter pipeline message */ /* (OK if not found) */ if ((exists = H5O_msg_exists(grp_loc.oloc, H5O_PLINE_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header"); if (exists) { /* Get the filter pipeline for parent group */ if (NULL == H5O_msg_read(grp_loc.oloc, H5O_PLINE_ID, &par_pline)) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "filter pipeline message not present") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "filter pipeline message not present"); /* Use parent filter pipeline settings */ pline = &par_pline; @@ -687,46 +669,46 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G /* XXX: Should we allow user to control the group creation params here? -QAK */ gcrt_info.gcpl_id = H5P_GROUP_CREATE_DEFAULT; gcrt_info.cache_type = H5G_NOTHING_CACHED; - HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); + memset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); if (H5G__obj_create_real(grp_oloc.file, ginfo, linfo, pline, &gcrt_info, obj_loc.oloc /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry"); /* Insert new group into current group's symbol table */ if (H5G__loc_insert(&grp_loc, comp, &obj_loc, H5O_TYPE_GROUP, &gcrt_info) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group"); /* Decrement refcount on intermediate group's object header in memory */ if (H5O_dec_rc_by_loc(obj_loc.oloc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, - "unable to decrement refcount on newly created object") + "unable to decrement refcount on newly created object"); /* Close new group */ if (H5O_close(obj_loc.oloc, NULL) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close"); /* If the parent group was holding the file open, the * newly-created group should, as well. */ if (grp_loc.oloc->holding_file) if (H5O_loc_hold_file(obj_loc.oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to hold file open"); /* Reset any non-default object header messages */ H5_GCC_CLANG_DIAG_OFF("cast-qual") if (ginfo != &def_ginfo) if (H5O_msg_reset(H5O_GINFO_ID, (void *)ginfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset group info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset group info message"); if (linfo != &def_linfo) if (H5O_msg_reset(H5O_LINFO_ID, (void *)linfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link info message") + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link info message"); if (pline != &def_pline) if (H5O_msg_reset(H5O_PLINE_ID, (void *)pline) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset I/O pipeline message") + HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset I/O pipeline message"); H5_GCC_CLANG_DIAG_ON("cast-qual") } /* end if */ else - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "component not found"); } /* end if */ /* @@ -749,14 +731,14 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G * Since we don't have a group location or a link to the object we pass in * NULL. */ - HDassert(group_copy); + assert(group_copy); if ((op)(NULL, ".", NULL, &grp_loc, op_data, &own_loc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "traversal operator failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "traversal operator failed"); /* If the callback took ownership of the object location, it actually has * ownership of grp_loc. It shouldn't have tried to take ownership of * the "group location", which was NULL. */ - HDassert(!(own_loc & H5G_OWN_GRP_LOC)); + assert(!(own_loc & H5G_OWN_GRP_LOC)); if (own_loc & H5G_OWN_OBJ_LOC) own_loc |= H5G_OWN_GRP_LOC; @@ -775,11 +757,11 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G /* If there's valid information in the link, reset it */ if (link_valid) if (H5O_msg_reset(H5O_LINK_ID, &lnk) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link message") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link message"); /* Release temporary component buffer */ if (wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't release wrapped buffer") + HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't release wrapped buffer"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5G__traverse_real() */ @@ -794,9 +776,6 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G * Failure: Negative if the path could not be fully * traversed. * - * Programmer: Quincey Koziol - * Sep 13 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -809,11 +788,11 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver /* Check args */ if (!name || !*name) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no name given") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no name given"); if (!loc) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no starting location") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no starting location"); if (!op) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no operation provided") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "no operation provided"); /* Retrieve the original # of soft / UD links that are able to be traversed * (So that multiple calls to H5G_traverse don't incorrectly look @@ -821,7 +800,7 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver * may need their own mechanism to set & reset the # of links to traverse) */ if (H5CX_get_nlinks(&orig_nlinks) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse"); /* Set up invalid tag. This is a precautionary step only. Setting an invalid * tag here will ensure that no metadata accessed while doing the traversal @@ -830,18 +809,18 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver * shouldn't be during the traversal. Note that for best tagging assertion * coverage, setting H5C_DO_TAGGING_SANITY_CHECKS is advised. */ - H5_BEGIN_TAG(H5AC__INVALID_TAG); + H5_BEGIN_TAG(H5AC__INVALID_TAG) /* Go perform "real" traversal */ if (H5G__traverse_real(loc, name, target, op, op_data) < 0) - HGOTO_ERROR_TAG(H5E_SYM, H5E_NOTFOUND, FAIL, "internal path traversal failed") + HGOTO_ERROR_TAG(H5E_SYM, H5E_NOTFOUND, FAIL, "internal path traversal failed"); /* Reset tag after traversal */ H5_END_TAG /* Reset the # of soft / UD links that can be traversed */ if (H5CX_set_nlinks(orig_nlinks) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't reset # of soft / UD links to traverse") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't reset # of soft / UD links to traverse"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HF.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HF.c index 96478bf093..9faa6ad9e5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HF.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HF.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HF.c - * Feb 24 2006 - * Quincey Koziol * * Purpose: Implements a "fractal heap" for storing variable- * length objects in a file. @@ -81,9 +78,6 @@ H5FL_DEFINE_STATIC(H5HF_t); * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -104,9 +98,6 @@ H5HF__op_read(const void *obj, size_t obj_len, void *op_data) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -134,9 +125,6 @@ H5HF__op_write(const void *obj, size_t obj_len, void *op_data) * Return: Pointer to heap wrapper on success * NULL on failure * - * Programmer: Quincey Koziol - * Feb 24 2006 - * *------------------------------------------------------------------------- */ H5HF_t * @@ -152,29 +140,30 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam) /* * Check arguments. */ - HDassert(f); - HDassert(cparam); + assert(f); + assert(cparam); /* Create shared fractal heap header */ if (HADDR_UNDEF == (fh_addr = H5HF__hdr_create(f, cparam))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create fractal heap header"); /* Allocate fractal heap wrapper */ if (NULL == (fh = H5FL_MALLOC(H5HF_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for fractal heap info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for fractal heap info"); /* Lock the heap header into memory */ if (NULL == (hdr = H5HF__hdr_protect(f, fh_addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap header"); /* Point fractal heap wrapper at header and bump it's ref count */ fh->hdr = hdr; if (H5HF__hdr_incr(fh->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header"); /* Increment # of files using this heap header */ if (H5HF__hdr_fuse_incr(fh->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment file reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, + "can't increment file reference count on shared heap header"); /* Set file pointer for this heap open context */ fh->f = f; @@ -184,10 +173,10 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam) done: if (hdr && H5AC_unprotect(f, H5AC_FHEAP_HDR, fh_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release fractal heap header") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release fractal heap header"); if (!ret_value && fh) if (H5HF_close(fh) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, NULL, "unable to close fractal heap") + HDONE_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, NULL, "unable to close fractal heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_create() */ @@ -200,9 +189,6 @@ H5HF_create(H5F_t *f, const H5HF_create_t *cparam) * Return: Pointer to heap wrapper on success * NULL on failure * - * Programmer: Quincey Koziol - * Apr 18 2006 - * *------------------------------------------------------------------------- */ H5HF_t * @@ -217,29 +203,30 @@ H5HF_open(H5F_t *f, haddr_t fh_addr) /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(fh_addr)); + assert(f); + assert(H5_addr_defined(fh_addr)); /* Load the heap header into memory */ if (NULL == (hdr = H5HF__hdr_protect(f, fh_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap header"); /* Check for pending heap deletion */ if (hdr->pending_delete) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, NULL, "can't open fractal heap pending deletion") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, NULL, "can't open fractal heap pending deletion"); /* Create fractal heap info */ if (NULL == (fh = H5FL_MALLOC(H5HF_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for fractal heap info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for fractal heap info"); /* Point fractal heap wrapper at header */ fh->hdr = hdr; if (H5HF__hdr_incr(fh->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header"); /* Increment # of files using this heap header */ if (H5HF__hdr_fuse_incr(fh->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment file reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, + "can't increment file reference count on shared heap header"); /* Set file pointer for this heap open context */ fh->f = f; @@ -249,10 +236,10 @@ H5HF_open(H5F_t *f, haddr_t fh_addr) done: if (hdr && H5AC_unprotect(f, H5AC_FHEAP_HDR, fh_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release fractal heap header") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release fractal heap header"); if (!ret_value && fh) if (H5HF_close(fh) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, NULL, "unable to close fractal heap") + HDONE_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, NULL, "unable to close fractal heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_open() */ @@ -264,9 +251,6 @@ H5HF_open(H5F_t *f, haddr_t fh_addr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 17 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -277,8 +261,8 @@ H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p) /* * Check arguments. */ - HDassert(fh); - HDassert(id_len_p); + assert(fh); + assert(id_len_p); /* Retrieve the ID length for entries in this heap */ *id_len_p = fh->hdr->id_len; @@ -293,9 +277,6 @@ H5HF_get_id_len(H5HF_t *fh, size_t *id_len_p) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 18 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -306,8 +287,8 @@ H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr_p) /* * Check arguments. */ - HDassert(fh); - HDassert(heap_addr_p); + assert(fh); + assert(heap_addr_p); /* Retrieve the heap header address for this heap */ *heap_addr_p = fh->hdr->heap_addr; @@ -323,9 +304,6 @@ H5HF_get_heap_addr(const H5HF_t *fh, haddr_t *heap_addr_p) * Return: Non-negative on success (with heap ID of new object * filled in), negative on failure * - * Programmer: Quincey Koziol - * Feb 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -337,13 +315,13 @@ H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id /*out*/) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(fh); - HDassert(obj); - HDassert(id); + assert(fh); + assert(obj); + assert(id); /* Check arguments */ if (size == 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "can't insert 0-sized objects") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "can't insert 0-sized objects"); /* Set the shared heap header's file context for this operation */ fh->hdr->f = fh->f; @@ -360,24 +338,24 @@ H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id /*out*/) */ H5_GCC_CLANG_DIAG_OFF("cast-qual") if (H5HF__huge_insert(hdr, size, (void *)obj, id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'huge' object in fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'huge' object in fractal heap"); H5_GCC_CLANG_DIAG_ON("cast-qual") } /* end if */ /* Check for 'tiny' object */ else if (size <= hdr->tiny_max_len) { /* Store 'tiny' object in heap */ if (H5HF__tiny_insert(hdr, size, obj, id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'tiny' object in fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'tiny' object in fractal heap"); } /* end if */ else { /* Check if we are in "append only" mode, or if there's enough room for the object */ if (hdr->write_once) { - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'write once' managed blocks not supported yet") + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "'write once' managed blocks not supported yet"); } /* end if */ else { /* Allocate space for object in 'managed' heap */ if (H5HF__man_insert(hdr, size, obj, id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'managed' object in fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'managed' object in fractal heap"); } /* end else */ } /* end else */ @@ -392,9 +370,6 @@ H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id /*out*/) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 9 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -409,16 +384,16 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) /* * Check arguments. */ - HDassert(fh); - HDassert(id); - HDassert(obj_len_p); + assert(fh); + assert(id); + assert(obj_len_p); /* Get the ID flags */ id_flags = *id; /* Check for correct heap ID version */ if ((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version"); /* Set the shared heap header's file context for this operation */ fh->hdr->f = fh->f; @@ -426,19 +401,19 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) /* Check type of object in heap */ if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) { if (H5HF__man_get_obj_len(fh->hdr, id, obj_len_p) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'managed' object's length") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'managed' object's length"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { if (H5HF__huge_get_obj_len(fh->hdr, id, obj_len_p) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'huge' object's length") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'huge' object's length"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { if (H5HF__tiny_get_obj_len(fh->hdr, id, obj_len_p) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length"); } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") + fprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet"); } /* end else */ done: @@ -452,9 +427,6 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 20 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -469,16 +441,16 @@ H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p) /* * Check arguments. */ - HDassert(fh); - HDassert(id); - HDassert(obj_off_p); + assert(fh); + assert(id); + assert(obj_off_p); /* Get the ID flags */ id_flags = *id; /* Check for correct heap ID version */ if ((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version"); /* Set the shared heap header's file context for this operation */ fh->hdr->f = fh->f; @@ -490,15 +462,15 @@ H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p) else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { /* Huge objects are located directly in the file */ if (H5HF__huge_get_obj_off(fh->hdr, id, obj_off_p) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'huge' object's offset") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'huge' object's offset"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Tiny objects are not stored in the heap */ *obj_off_p = (hsize_t)0; } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") + fprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet"); } /* end else */ done: @@ -512,9 +484,6 @@ H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Mar 18 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -529,16 +498,16 @@ H5HF_read(H5HF_t *fh, const void *_id, void *obj /*out*/) /* * Check arguments. */ - HDassert(fh); - HDassert(id); - HDassert(obj); + assert(fh); + assert(id); + assert(obj); /* Get the ID flags */ id_flags = *id; /* Check for correct heap ID version */ if ((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version"); /* Set the shared heap header's file context for this operation */ fh->hdr->f = fh->f; @@ -547,21 +516,21 @@ H5HF_read(H5HF_t *fh, const void *_id, void *obj /*out*/) if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) { /* Read object from managed heap blocks */ if (H5HF__man_read(fh->hdr, id, obj) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read object from fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read object from fractal heap"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { /* Read 'huge' object from file */ if (H5HF__huge_read(fh->hdr, id, obj) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read 'huge' object from fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read 'huge' object from fractal heap"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Read 'tiny' object from file */ if (H5HF__tiny_read(fh->hdr, id, obj) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read 'tiny' object from fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read 'tiny' object from fractal heap"); } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") + fprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet"); } /* end else */ done: @@ -587,9 +556,6 @@ H5HF_read(H5HF_t *fh, const void *_id, void *obj /*out*/) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -604,16 +570,16 @@ H5HF_write(H5HF_t *fh, void *_id, hbool_t H5_ATTR_UNUSED *id_changed, const void /* * Check arguments. */ - HDassert(fh); - HDassert(id); - HDassert(obj); + assert(fh); + assert(id); + assert(obj); /* Get the ID flags */ id_flags = *id; /* Check for correct heap ID version */ if ((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version"); /* Set the shared heap header's file context for this operation */ fh->hdr->f = fh->f; @@ -623,21 +589,21 @@ H5HF_write(H5HF_t *fh, void *_id, hbool_t H5_ATTR_UNUSED *id_changed, const void /* Operate on object from managed heap blocks */ /* (ID can't change and modifying object is "easy" to manage) */ if (H5HF__man_write(fh->hdr, id, obj) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "can't write to 'managed' heap object") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "can't write to 'managed' heap object"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { /* Operate on "huge" object */ if (H5HF__huge_write(fh->hdr, id, obj) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "can't write to 'huge' heap object") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "can't write to 'huge' heap object"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Check for writing a 'tiny' object */ /* (which isn't supported yet - ID will change) */ - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "modifying 'tiny' object not supported yet") + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "modifying 'tiny' object not supported yet"); } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") + fprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet"); } /* end else */ done: @@ -656,9 +622,6 @@ H5HF_write(H5HF_t *fh, void *_id, hbool_t H5_ATTR_UNUSED *id_changed, const void * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sept 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -673,16 +636,16 @@ H5HF_op(H5HF_t *fh, const void *_id, H5HF_operator_t op, void *op_data) /* * Check arguments. */ - HDassert(fh); - HDassert(id); - HDassert(op); + assert(fh); + assert(id); + assert(op); /* Get the ID flags */ id_flags = *id; /* Check for correct heap ID version */ if ((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version"); /* Set the shared heap header's file context for this operation */ fh->hdr->f = fh->f; @@ -691,21 +654,21 @@ H5HF_op(H5HF_t *fh, const void *_id, H5HF_operator_t op, void *op_data) if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) { /* Operate on object from managed heap blocks */ if (H5HF__man_op(fh->hdr, id, op, op_data) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on object from fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on object from fractal heap"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { /* Operate on 'huge' object from file */ if (H5HF__huge_op(fh->hdr, id, op, op_data) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on 'huge' object from fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on 'huge' object from fractal heap"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Operate on 'tiny' object from file */ if (H5HF__tiny_op(fh->hdr, id, op, op_data) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on 'tiny' object from fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on 'tiny' object from fractal heap"); } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") + fprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet"); } /* end else */ done: @@ -719,9 +682,6 @@ H5HF_op(H5HF_t *fh, const void *_id, H5HF_operator_t op, void *op_data) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 15 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -736,16 +696,16 @@ H5HF_remove(H5HF_t *fh, const void *_id) /* * Check arguments. */ - HDassert(fh); - HDassert(fh->hdr); - HDassert(id); + assert(fh); + assert(fh->hdr); + assert(id); /* Get the ID flags */ id_flags = *id; /* Check for correct heap ID version */ if ((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version"); /* Set the shared heap header's file context for this operation */ fh->hdr->f = fh->f; @@ -754,21 +714,21 @@ H5HF_remove(H5HF_t *fh, const void *_id) if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) { /* Remove object from managed heap blocks */ if (H5HF__man_remove(fh->hdr, id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from fractal heap"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) { /* Remove 'huge' object from file & v2 B-tree tracker */ if (H5HF__huge_remove(fh->hdr, id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove 'huge' object from fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove 'huge' object from fractal heap"); } /* end if */ else if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) { /* Remove 'tiny' object from heap statistics */ if (H5HF__tiny_remove(fh->hdr, id) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove 'tiny' object from fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove 'tiny' object from fractal heap"); } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") + fprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet"); } /* end else */ done: @@ -782,9 +742,6 @@ H5HF_remove(H5HF_t *fh, const void *_id) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 17 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -799,7 +756,7 @@ H5HF_close(H5HF_t *fh) /* * Check arguments. */ - HDassert(fh); + assert(fh); /* Decrement file reference & check if this is the last open fractal heap using the shared heap header */ if (0 == H5HF__hdr_fuse_decr(fh->hdr)) { @@ -813,7 +770,7 @@ H5HF_close(H5HF_t *fh) * the metadata cache - QAK) */ if (H5HF__space_close(fh->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info"); /* Reset the block iterator, if necessary */ /* (Can't put this in header "destroy" routine, because it has @@ -823,7 +780,7 @@ H5HF_close(H5HF_t *fh) */ if (H5HF__man_iter_ready(&fh->hdr->next_block)) if (H5HF__man_iter_reset(&fh->hdr->next_block) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator"); /* Shut down the huge object information */ /* (Can't put this in header "destroy" routine, because it has @@ -831,7 +788,7 @@ H5HF_close(H5HF_t *fh) * modified by the shutdown routine - QAK) */ if (H5HF__huge_term(fh->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release 'huge' object info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release 'huge' object info"); /* Check for pending heap deletion */ if (fh->hdr->pending_delete) { @@ -848,7 +805,7 @@ H5HF_close(H5HF_t *fh) * immediately -QAK) */ if (H5HF__hdr_decr(fh->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header"); /* Check for pending heap deletion */ if (pending_delete) { @@ -856,11 +813,11 @@ H5HF_close(H5HF_t *fh) /* Lock the heap header into memory */ if (NULL == (hdr = H5HF__hdr_protect(fh->f, heap_addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header"); /* Delete heap, starting with header (unprotects header) */ if (H5HF__hdr_delete(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to delete fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to delete fractal heap"); } /* end if */ done: @@ -877,9 +834,6 @@ H5HF_close(H5HF_t *fh) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 4 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -893,12 +847,12 @@ H5HF_delete(H5F_t *f, haddr_t fh_addr) /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(fh_addr)); + assert(f); + assert(H5_addr_defined(fh_addr)); /* Lock the heap header into memory */ if (NULL == (hdr = H5HF__hdr_protect(f, fh_addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header"); /* Check for files using shared heap header */ if (hdr->file_rc) @@ -906,14 +860,14 @@ H5HF_delete(H5F_t *f, haddr_t fh_addr) else { /* Delete heap now, starting with header (unprotects header) */ if (H5HF__hdr_delete(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to delete fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "unable to delete fractal heap"); hdr = NULL; } /* end if */ done: /* Unprotect the header, if an error occurred */ if (hdr && H5AC_unprotect(f, H5AC_FHEAP_HDR, fh_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap header") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_delete() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFbtree2.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFbtree2.c index 9f546817e5..56e5270e08 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFbtree2.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFbtree2.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFbtree2.c - * Aug 7 2006 - * Quincey Koziol * * Purpose: v2 B-tree callbacks for "huge" object tracker * @@ -31,10 +28,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HFpkg.h" /* Fractal heaps */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5B2private.h" /* B-Trees (Version 2) */ +#include "H5Eprivate.h" /* Error Handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5HFpkg.h" /* Fractal Heaps */ +#include "H5MFprivate.h" /* File Memory Management */ /****************/ /* Local Macros */ @@ -180,9 +180,6 @@ H5FL_DEFINE_STATIC(H5HF_huge_bt2_ctx_t); * Return: Success: non-NULL * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, November 26, 2009 - * *------------------------------------------------------------------------- */ static void * @@ -195,11 +192,11 @@ H5HF__huge_bt2_crt_context(void *_f) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); + assert(f); /* Allocate callback context */ if (NULL == (ctx = H5FL_MALLOC(H5HF_huge_bt2_ctx_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context"); /* Determine the size of addresses & lengths in the file */ ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); @@ -222,9 +219,6 @@ H5HF__huge_bt2_crt_context(void *_f) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, November 26, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -235,7 +229,7 @@ H5HF__huge_bt2_dst_context(void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Release callback context */ ctx = H5FL_FREE(H5HF_huge_bt2_ctx_t, ctx); @@ -252,9 +246,6 @@ H5HF__huge_bt2_dst_context(void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 8, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -276,9 +267,6 @@ H5HF__huge_bt2_indir_found(const void *nrecord, void *op_data) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 8, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -292,7 +280,7 @@ H5HF__huge_bt2_indir_remove(const void *nrecord, void *_udata) /* Free the space in the file for the object being removed */ if (H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free space for huge object on disk") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free space for huge object on disk"); /* Set the length of the object removed */ udata->obj_len = ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len; @@ -309,9 +297,6 @@ H5HF__huge_bt2_indir_remove(const void *nrecord, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -333,9 +318,6 @@ H5HF__huge_bt2_indir_store(void *nrecord, const void *udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -357,9 +339,6 @@ H5HF__huge_bt2_indir_compare(const void *_rec1, const void *_rec2, int *result) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -371,12 +350,12 @@ H5HF__huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Encode the record's fields */ H5F_addr_encode_len(ctx->sizeof_addr, &raw, nrecord->addr); - H5F_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); - H5F_ENCODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_indir_encode() */ @@ -389,9 +368,6 @@ H5HF__huge_bt2_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -403,12 +379,12 @@ H5HF__huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Decode the record's fields */ H5F_addr_decode_len(ctx->sizeof_addr, &raw, &nrecord->addr); - H5F_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); - H5F_DECODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_indir_decode() */ @@ -421,9 +397,6 @@ H5HF__huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -434,8 +407,8 @@ H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *_nr FUNC_ENTER_PACKAGE_NOERR - HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %" PRIuHSIZE "}\n", indent, "", fwidth, - "Record:", nrecord->addr, nrecord->len, nrecord->id); + fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %" PRIuHSIZE "}\n", indent, "", fwidth, + "Record:", nrecord->addr, nrecord->len, nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_indir_debug() */ @@ -449,9 +422,6 @@ H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *_nr * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 8, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -473,9 +443,6 @@ H5HF__huge_bt2_filt_indir_found(const void *nrecord, void *op_data) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 8, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -490,7 +457,7 @@ H5HF__huge_bt2_filt_indir_remove(const void *nrecord, void *_udata) if (H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->len) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free space for huge object on disk") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free space for huge object on disk"); /* Set the length of the object removed */ udata->obj_len = ((const H5HF_huge_bt2_filt_indir_rec_t *)nrecord)->obj_size; @@ -507,9 +474,6 @@ H5HF__huge_bt2_filt_indir_remove(const void *nrecord, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -531,9 +495,6 @@ H5HF__huge_bt2_filt_indir_store(void *nrecord, const void *udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -555,9 +516,6 @@ H5HF__huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2, int *res * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -569,14 +527,14 @@ H5HF__huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Encode the record's fields */ H5F_addr_encode_len(ctx->sizeof_addr, &raw, nrecord->addr); - H5F_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); UINT32ENCODE(raw, nrecord->filter_mask); - H5F_ENCODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); - H5F_ENCODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_filt_indir_encode() */ @@ -589,9 +547,6 @@ H5HF__huge_bt2_filt_indir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -603,14 +558,14 @@ H5HF__huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Decode the record's fields */ H5F_addr_decode_len(ctx->sizeof_addr, &raw, &nrecord->addr); - H5F_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); UINT32DECODE(raw, nrecord->filter_mask); - H5F_DECODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); - H5F_DECODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, nrecord->id, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_filt_indir_decode() */ @@ -623,9 +578,6 @@ H5HF__huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -636,9 +588,9 @@ H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void FUNC_ENTER_PACKAGE_NOERR - HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %x, %" PRIuHSIZE ", %" PRIuHSIZE "}\n", - indent, "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, - nrecord->obj_size, nrecord->id); + fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %x, %" PRIuHSIZE ", %" PRIuHSIZE "}\n", indent, + "", fwidth, "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size, + nrecord->id); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_filt_indir_debug() */ @@ -652,9 +604,6 @@ H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 8, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -668,7 +617,7 @@ H5HF__huge_bt2_dir_remove(const void *nrecord, void *_udata) /* Free the space in the file for the object being removed */ if (H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free space for huge object on disk") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free space for huge object on disk"); /* Set the length of the object removed */ udata->obj_len = ((const H5HF_huge_bt2_indir_rec_t *)nrecord)->len; @@ -685,9 +634,6 @@ H5HF__huge_bt2_dir_remove(const void *nrecord, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -709,9 +655,6 @@ H5HF__huge_bt2_dir_store(void *nrecord, const void *udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -744,9 +687,6 @@ H5HF__huge_bt2_dir_compare(const void *_rec1, const void *_rec2, int *result) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -758,11 +698,11 @@ H5HF__huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Encode the record's fields */ H5F_addr_encode_len(ctx->sizeof_addr, &raw, nrecord->addr); - H5F_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_dir_encode() */ @@ -775,9 +715,6 @@ H5HF__huge_bt2_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -789,11 +726,11 @@ H5HF__huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Decode the record's fields */ H5F_addr_decode_len(ctx->sizeof_addr, &raw, &nrecord->addr); - H5F_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_dir_decode() */ @@ -806,9 +743,6 @@ H5HF__huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 7, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -819,8 +753,8 @@ H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrec FUNC_ENTER_PACKAGE_NOERR - HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE "}\n", indent, "", fwidth, - "Record:", nrecord->addr, nrecord->len); + fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE "}\n", indent, "", fwidth, + "Record:", nrecord->addr, nrecord->len); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_dir_debug() */ @@ -834,9 +768,6 @@ H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrec * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 15, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -858,9 +789,6 @@ H5HF__huge_bt2_filt_dir_found(const void *nrecord, void *op_data) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 15, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -875,7 +803,7 @@ H5HF__huge_bt2_filt_dir_remove(const void *nrecord, void *_udata) if (H5MF_xfree(udata->hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->addr, ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->len) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free space for huge object on disk") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free space for huge object on disk"); /* Set the length of the object removed */ udata->obj_len = ((const H5HF_huge_bt2_filt_dir_rec_t *)nrecord)->obj_size; @@ -892,9 +820,6 @@ H5HF__huge_bt2_filt_dir_remove(const void *nrecord, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 15, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -916,9 +841,6 @@ H5HF__huge_bt2_filt_dir_store(void *nrecord, const void *udata) * =0 if rec1 == rec2 * >0 if rec1 > rec2 * - * Programmer: Quincey Koziol - * Tuesday, August 15, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -951,9 +873,6 @@ H5HF__huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2, int *resul * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 15, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -965,13 +884,13 @@ H5HF__huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Encode the record's fields */ H5F_addr_encode_len(ctx->sizeof_addr, &raw, nrecord->addr); - H5F_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); UINT32ENCODE(raw, nrecord->filter_mask); - H5F_ENCODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); + H5_ENCODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_filt_dir_encode() */ @@ -984,9 +903,6 @@ H5HF__huge_bt2_filt_dir_encode(uint8_t *raw, const void *_nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 15, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -998,13 +914,13 @@ H5HF__huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Decode the record's fields */ H5F_addr_decode_len(ctx->sizeof_addr, &raw, &nrecord->addr); - H5F_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, nrecord->len, ctx->sizeof_size); UINT32DECODE(raw, nrecord->filter_mask); - H5F_DECODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); + H5_DECODE_LENGTH_LEN(raw, nrecord->obj_size, ctx->sizeof_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_filt_dir_decode() */ @@ -1017,9 +933,6 @@ H5HF__huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, August 15, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1030,8 +943,8 @@ H5HF__huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void * FUNC_ENTER_PACKAGE_NOERR - HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %x, %" PRIuHSIZE "}\n", indent, "", fwidth, - "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size); + fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIuHSIZE ", %x, %" PRIuHSIZE "}\n", indent, "", fwidth, + "Record:", nrecord->addr, nrecord->len, nrecord->filter_mask, nrecord->obj_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_filt_dir_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFcache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFcache.c index e86d647211..c34a37412a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFcache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFcache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5HFcache.c - * Feb 24 2006 - * Quincey Koziol * - * Purpose: Implement fractal heap metadata cache methods. + * Purpose: Implement fractal heap metadata cache methods * *------------------------------------------------------------------------- */ @@ -191,9 +188,6 @@ H5FL_BLK_DEFINE(direct_block); * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * December 15, 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -205,17 +199,17 @@ H5HF__hdr_prefix_decode(H5HF_hdr_t *hdr, const uint8_t **image_ref) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(hdr); - HDassert(image); + assert(hdr); + assert(image); /* Magic number */ - if (HDmemcmp(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "wrong fractal heap header signature") + if (memcmp(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "wrong fractal heap header signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5HF_HDR_VERSION) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "wrong fractal heap header version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "wrong fractal heap header version"); /* General heap information */ UINT16DECODE(image, hdr->id_len); /* Heap ID length */ @@ -237,9 +231,6 @@ H5HF__hdr_prefix_decode(H5HF_hdr_t *hdr, const uint8_t **image_ref) * * Failure: NULL * - * Programmer: Quincey Koziol - * Feb 27 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -248,9 +239,9 @@ H5HF__dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(pp && *pp); - HDassert(dtable); + assert(f); + assert(pp && *pp); + assert(dtable); /* Table width */ UINT16DECODE(*pp, dtable->cparam.width); @@ -285,9 +276,6 @@ H5HF__dtable_decode(H5F_t *f, const uint8_t **pp, H5HF_dtable_t *dtable) * * Failure: NULL * - * Programmer: Quincey Koziol - * Feb 27 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -296,9 +284,9 @@ H5HF__dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(pp && *pp); - HDassert(dtable); + assert(f); + assert(pp && *pp); + assert(dtable); /* Table width */ UINT16ENCODE(*pp, dtable->cparam.width); @@ -338,9 +326,6 @@ H5HF__dtable_encode(H5F_t *f, uint8_t **pp, const H5HF_dtable_t *dtable) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -352,8 +337,8 @@ H5HF__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(udata); - HDassert(image_len); + assert(udata); + assert(image_len); /* Set the internal parameters for the heap */ dummy_hdr.f = udata->f; @@ -375,9 +360,6 @@ H5HF__cache_hdr_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * November 18, 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -392,14 +374,14 @@ H5HF__cache_hdr_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UN FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(image); - HDassert(udata); - HDassert(actual_len); - HDassert(*actual_len == image_len); + assert(image); + assert(udata); + assert(actual_len); + assert(*actual_len == image_len); /* Deserialize the fractal heap header's prefix */ if (H5HF__hdr_prefix_decode(&hdr, &image) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode fractal heap header prefix") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode fractal heap header prefix"); /* Check for I/O filter info on this heap */ if (hdr.filter_len > 0) @@ -421,8 +403,6 @@ H5HF__cache_hdr_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UN * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -436,7 +416,7 @@ H5HF__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -458,9 +438,6 @@ H5HF__cache_hdr_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNUSE * Return: Success: Pointer to in core representation * Failure: NULL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static void * @@ -476,18 +453,18 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(image); - HDassert(len > 0); - HDassert(udata); - HDassert(dirty); + assert(image); + assert(len > 0); + assert(udata); + assert(dirty); /* Allocate space for the fractal heap data structure */ if (NULL == (hdr = H5HF__hdr_alloc(udata->f))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Deserialize the fractal heap header's prefix */ if (H5HF__hdr_prefix_decode(hdr, &image) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode fractal heap header prefix") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode fractal heap header prefix"); /* Heap status flags */ /* (bit 0: "huge" object IDs have wrapped) */ @@ -518,21 +495,21 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ /* Managed objects' doubling-table info */ if (H5HF__dtable_decode(hdr->f, &image, &(hdr->man_dtable)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, NULL, "unable to encode managed obj. doubling table info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, NULL, "unable to encode managed obj. doubling table info"); /* Set the fractal heap header's 'base' size */ hdr->heap_size = (size_t)H5HF_HEADER_SIZE(hdr); /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(image - (const uint8_t *)_image) == (hdr->heap_size - H5HF_SIZEOF_CHKSUM)); + assert((size_t)(image - (const uint8_t *)_image) == (hdr->heap_size - H5HF_SIZEOF_CHKSUM)); /* Check for I/O filter information to decode */ if (hdr->filter_len > 0) { H5O_pline_t *pline; /* Pipeline information from the header on disk */ /* Sanity check */ - HDassert(len > hdr->heap_size); /* A header with filter info is > than a standard header */ + assert(len > hdr->heap_size); /* A header with filter info is > than a standard header */ /* Compute the heap header's size */ hdr->heap_size += (size_t)(hdr->sizeof_size /* Size of size for filtered root direct block */ @@ -547,14 +524,14 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ /* Decode I/O filter information */ if (NULL == (pline = (H5O_pline_t *)H5O_msg_decode(hdr->f, NULL, H5O_PLINE_ID, len, image))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode I/O pipeline filters"); /* Advance past filter info to checksum */ image += hdr->filter_len; /* Copy the information into the header's I/O pipeline structure */ if (NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &(hdr->pline))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, NULL, "can't copy I/O filter pipeline") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, NULL, "can't copy I/O filter pipeline"); /* Release the space allocated for the I/O pipeline filters */ H5O_msg_free(H5O_PLINE_ID, pline); @@ -564,11 +541,11 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == hdr->heap_size); + assert((size_t)(image - (const uint8_t *)_image) == hdr->heap_size); /* Finish initialization of heap header */ if (H5HF__hdr_finish_init(hdr) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header"); /* Set return value */ ret_value = (void *)hdr; @@ -576,7 +553,7 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ done: if (!ret_value && hdr) if (H5HF__hdr_free(hdr) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to release fractal heap header") + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "unable to release fractal heap header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__cache_hdr_deserialize() */ @@ -593,9 +570,6 @@ H5HF__cache_hdr_deserialize(const void *_image, size_t len, void *_udata, hbool_ * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -606,10 +580,9 @@ H5HF__cache_hdr_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(hdr); - HDassert(hdr->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); - HDassert(image_len); + assert(hdr); + assert(hdr->cache_info.type == H5AC_FHEAP_HDR); + assert(image_len); *image_len = hdr->heap_size; @@ -631,9 +604,6 @@ H5HF__cache_hdr_image_len(const void *_thing, size_t *image_len) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -647,15 +617,14 @@ H5HF__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t len, FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(hdr); - HDassert(hdr->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); - HDassert(H5F_addr_defined(addr)); - HDassert(addr == hdr->heap_addr); - HDassert(new_addr); - HDassert(new_len); - HDassert(flags); + assert(f); + assert(hdr); + assert(hdr->cache_info.type == H5AC_FHEAP_HDR); + assert(H5_addr_defined(addr)); + assert(addr == hdr->heap_addr); + assert(new_addr); + assert(new_len); + assert(flags); #ifndef NDEBUG { @@ -690,8 +659,8 @@ H5HF__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t len, */ if (H5HF__cache_verify_hdr_descendants_clean((H5F_t *)f, hdr, &fd_children_clean, &descendants_clean) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify hdr descendants clean.") - HDassert(fd_children_clean); + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify hdr descendants clean."); + assert(fd_children_clean); } #endif /* NDEBUG */ @@ -717,9 +686,6 @@ H5HF__cache_hdr_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t len, * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -734,12 +700,11 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(image); - HDassert(hdr); - HDassert(hdr->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); - HDassert(len == hdr->heap_size); + assert(f); + assert(image); + assert(hdr); + assert(hdr->cache_info.type == H5AC_FHEAP_HDR); + assert(len == hdr->heap_size); /* Set the shared heap header's file context for this operation */ H5_GCC_DIAG_OFF("discarded-qualifiers") @@ -788,7 +753,7 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN /* Managed objects' doubling-table info */ if (H5HF__dtable_encode(hdr->f, &image, &(hdr->man_dtable)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, FAIL, "unable to encode managed obj. doubling table info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, FAIL, "unable to encode managed obj. doubling table info"); /* Check for I/O filter information to encode */ if (hdr->filter_len > 0) { @@ -800,7 +765,7 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN /* Encode I/O filter information */ if (H5O_msg_encode(hdr->f, H5O_PLINE_ID, FALSE, image, &(hdr->pline)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, FAIL, "can't encode I/O pipeline filters") + HGOTO_ERROR(H5E_HEAP, H5E_CANTENCODE, FAIL, "can't encode I/O pipeline filters"); image += hdr->filter_len; } /* end if */ @@ -811,7 +776,7 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN UINT32ENCODE(image, metadata_chksum); /* sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) == len); + assert((size_t)(image - (uint8_t *)_image) == len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -829,16 +794,9 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN * This routine also does not free the file space that may * be allocated to the header. * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -850,13 +808,12 @@ H5HF__cache_hdr_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(hdr); - HDassert(hdr->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); - HDassert(hdr->rc == 0); + assert(hdr); + assert(hdr->cache_info.type == H5AC_FHEAP_HDR); + assert(hdr->rc == 0); if (H5HF__hdr_free(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "unable to release fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "unable to release fractal heap header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -871,9 +828,6 @@ H5HF__cache_hdr_free_icr(void *_thing) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -884,10 +838,10 @@ H5HF__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(udata); - HDassert(udata->par_info); - HDassert(udata->par_info->hdr); - HDassert(image_len); + assert(udata); + assert(udata->par_info); + assert(udata->par_info->hdr); + assert(image_len); /* Set the image length size */ *image_len = (size_t)H5HF_MAN_INDIRECT_SIZE(udata->par_info->hdr, *udata->nrows); @@ -904,8 +858,6 @@ H5HF__cache_iblock_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -919,7 +871,7 @@ H5HF__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -945,9 +897,6 @@ H5HF__cache_iblock_verify_chksum(const void *_image, size_t len, void H5_ATTR_UN * Return: Success: Pointer to in core representation * Failure: NULL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static void * @@ -966,23 +915,23 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(image); - HDassert(udata); - HDassert(dirty); + assert(image); + assert(udata); + assert(dirty); hdr = udata->par_info->hdr; - HDassert(hdr->f); + assert(hdr->f); /* Set the shared heap header's file context for this operation */ hdr->f = udata->f; /* Allocate space for the fractal heap indirect block */ if (NULL == (iblock = H5FL_CALLOC(H5HF_indirect_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Share common heap information */ iblock->hdr = hdr; if (H5HF__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header"); /* Set block's internal information */ iblock->rc = 0; @@ -993,21 +942,21 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED iblock->size = H5HF_MAN_INDIRECT_SIZE(hdr, iblock->nrows); /* sanity check */ - HDassert(iblock->size == len); + assert(iblock->size == len); /* Magic number */ - if (HDmemcmp(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong fractal heap indirect block signature") + if (memcmp(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong fractal heap indirect block signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5HF_IBLOCK_VERSION) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version"); /* Address of heap that owns this block */ H5F_addr_decode(udata->f, &image, &heap_addr); - if (H5F_addr_ne(heap_addr, hdr->heap_addr)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block") + if (H5_addr_ne(heap_addr, hdr->heap_addr)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block"); /* Address of parent block */ iblock->parent = udata->par_info->iblock; @@ -1023,7 +972,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Share parent block */ if (H5HF__iblock_incr(iblock->parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, - "can't increment reference count on shared indirect block") + "can't increment reference count on shared indirect block"); /* Set max. # of rows in this block */ iblock->max_rows = iblock->nrows; @@ -1037,10 +986,10 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED UINT64DECODE_VAR(image, iblock->block_off, hdr->heap_off_size); /* Allocate & decode child block entry tables */ - HDassert(iblock->nrows > 0); + assert(iblock->nrows > 0); if (NULL == (iblock->ents = H5FL_SEQ_MALLOC(H5HF_indirect_ent_t, (size_t)(iblock->nrows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for direct entries") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for direct entries"); if (hdr->filter_len > 0) { unsigned dir_rows; /* Number of direct rows in this indirect block */ @@ -1051,7 +1000,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Allocate indirect block filtered entry array */ if (NULL == (iblock->filt_ents = H5FL_SEQ_MALLOC(H5HF_indirect_filt_ent_t, (size_t)(dir_rows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block entries") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block entries"); } /* end if */ else iblock->filt_ents = NULL; @@ -1063,7 +1012,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Check for heap with I/O filters */ if (hdr->filter_len > 0) { /* Sanity check */ - HDassert(iblock->filt_ents); + assert(iblock->filt_ents); /* Decode extra information for direct blocks */ if (u < (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width)) { @@ -1074,8 +1023,8 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* (either both the address & size are defined or both are * not defined) */ - HDassert((H5F_addr_defined(iblock->ents[u].addr) && iblock->filt_ents[u].size) || - (!H5F_addr_defined(iblock->ents[u].addr) && iblock->filt_ents[u].size == 0)); + assert((H5_addr_defined(iblock->ents[u].addr) && iblock->filt_ents[u].size) || + (!H5_addr_defined(iblock->ents[u].addr) && iblock->filt_ents[u].size == 0)); /* I/O filter mask for filtered direct block */ UINT32DECODE(image, iblock->filt_ents[u].filter_mask); @@ -1083,14 +1032,14 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED } /* end if */ /* Count child blocks */ - if (H5F_addr_defined(iblock->ents[u].addr)) { + if (H5_addr_defined(iblock->ents[u].addr)) { iblock->nchildren++; iblock->max_child = u; } /* end if */ } /* end for */ /* Sanity check */ - HDassert(iblock->nchildren); /* indirect blocks w/no children should have been deleted */ + assert(iblock->nchildren); /* indirect blocks w/no children should have been deleted */ /* checksum verification already done by verify_chksum cb */ @@ -1098,7 +1047,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == iblock->size); + assert((size_t)(image - (const uint8_t *)_image) == iblock->size); /* Check if we have any indirect block children */ if (iblock->nrows > hdr->man_dtable.max_direct_rows) { @@ -1110,7 +1059,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Allocate & initialize child indirect block pointer array */ if (NULL == (iblock->child_iblocks = H5FL_SEQ_CALLOC( H5HF_indirect_ptr_t, (size_t)(indir_rows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for block entries") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for block entries"); } /* end if */ else iblock->child_iblocks = NULL; @@ -1121,7 +1070,7 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED done: if (!ret_value && iblock) if (H5HF__man_iblock_dest(iblock) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap indirect block") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap indirect block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__cache_iblock_deserialize() */ @@ -1134,9 +1083,6 @@ H5HF__cache_iblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1147,10 +1093,9 @@ H5HF__cache_iblock_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(iblock); - HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(image_len); + assert(iblock); + assert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(image_len); *image_len = iblock->size; @@ -1172,9 +1117,6 @@ H5HF__cache_iblock_image_len(const void *_thing, size_t *image_len) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1188,20 +1130,18 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5 FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(iblock); - HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(iblock->cache_info.size == iblock->size); - HDassert(H5F_addr_defined(addr)); - HDassert(H5F_addr_eq(iblock->addr, addr)); - HDassert(new_addr); - HDassert(new_len); - HDassert(flags); + assert(f); + assert(iblock); + assert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(iblock->cache_info.size == iblock->size); + assert(H5_addr_defined(addr)); + assert(H5_addr_eq(iblock->addr, addr)); + assert(new_addr); + assert(new_len); + assert(flags); hdr = iblock->hdr; - HDassert(hdr); - HDassert(hdr->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); + assert(hdr); + assert(hdr->cache_info.type == H5AC_FHEAP_HDR); #ifndef NDEBUG { @@ -1214,7 +1154,7 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5 * iblock are clean. */ if (H5AC_get_entry_status(f, iblock->addr, &iblock_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get iblock status") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get iblock status"); /* since the current iblock is the guest of honor in a flush, we know * that it is locked into the cache for the duration of the call. Hence @@ -1223,8 +1163,8 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5 */ if (H5HF__cache_verify_iblock_descendants_clean((H5F_t *)f, iblock->addr, iblock, &iblock_status, &fd_children_clean, &descendants_clean) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify descendants clean.") - HDassert(fd_children_clean); + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify descendants clean."); + assert(fd_children_clean); } #endif /* NDEBUG */ @@ -1237,14 +1177,15 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5 /* Allocate 'normal' space for the new indirect block on disk */ if (HADDR_UNDEF == (iblock_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FHEAP_IBLOCK, (hsize_t)iblock->size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, + "file allocation failed for fractal heap indirect block"); /* Sanity check */ - HDassert(!H5F_addr_eq(iblock->addr, iblock_addr)); + assert(!H5_addr_eq(iblock->addr, iblock_addr)); /* Let the metadata cache know the block moved */ if (H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_IBLOCK, iblock->addr, iblock_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move indirect block"); /* Update the internal address for the block */ iblock->addr = iblock_addr; @@ -1256,7 +1197,7 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5 /* Mark that heap header was modified */ if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); } /* end if */ else { H5HF_indirect_t *par_iblock; /* Parent indirect block */ @@ -1271,7 +1212,7 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5 /* Mark that parent was modified */ if (H5HF__iblock_dirty(par_iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); } /* end if */ *new_addr = iblock_addr; @@ -1294,9 +1235,6 @@ H5HF__cache_iblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t H5 * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1316,17 +1254,16 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(f); - HDassert(image); - HDassert(iblock); - HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(iblock->cache_info.size == iblock->size); - HDassert(len == iblock->size); + assert(f); + assert(image); + assert(iblock); + assert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(iblock->cache_info.size == iblock->size); + assert(len == iblock->size); /* Indirect block must be in 'normal' file space */ - HDassert(!H5F_IS_TMP_ADDR(f, iblock->addr)); - HDassert(H5F_addr_eq(iblock->addr, iblock->cache_info.addr)); + assert(!H5F_IS_TMP_ADDR(f, iblock->addr)); + assert(H5_addr_eq(iblock->addr, iblock->cache_info.addr)); /* Get the pointer to the shared heap header */ hdr = iblock->hdr; @@ -1359,7 +1296,7 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG /* Check for heap with I/O filters */ if (hdr->filter_len > 0) { /* Sanity check */ - HDassert(iblock->filt_ents); + assert(iblock->filt_ents); /* Encode extra information for direct blocks */ if (u < (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width)) { @@ -1367,8 +1304,8 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG /* (either both the address & size are defined or both are * not defined) */ - HDassert((H5F_addr_defined(iblock->ents[u].addr) && iblock->filt_ents[u].size) || - (!H5F_addr_defined(iblock->ents[u].addr) && iblock->filt_ents[u].size == 0)); + assert((H5_addr_defined(iblock->ents[u].addr) && iblock->filt_ents[u].size) || + (!H5_addr_defined(iblock->ents[u].addr) && iblock->filt_ents[u].size == 0)); /* Size of filtered direct block */ H5F_ENCODE_LENGTH(f, image, iblock->filt_ents[u].size); @@ -1380,7 +1317,7 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG #ifndef NDEBUG /* Count child blocks */ - if (H5F_addr_defined(iblock->ents[u].addr)) { + if (H5_addr_defined(iblock->ents[u].addr)) { nchildren++; if (u > max_child) max_child = u; @@ -1395,10 +1332,10 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG UINT32ENCODE(image, metadata_chksum); /* Sanity checks */ - HDassert((size_t)(image - (uint8_t *)_image) == iblock->size); + assert((size_t)(image - (uint8_t *)_image) == iblock->size); #ifndef NDEBUG - HDassert(nchildren == iblock->nchildren); - HDassert(max_child == iblock->max_child); + assert(nchildren == iblock->nchildren); + assert(max_child == iblock->max_child); #endif /* NDEBUG */ FUNC_LEAVE_NOAPI(ret_value) @@ -1417,9 +1354,6 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1431,10 +1365,9 @@ H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(iblock); - HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(iblock->hdr); + assert(iblock); + assert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(iblock->hdr); /* further sanity checks */ if (iblock->parent == NULL) { @@ -1442,7 +1375,7 @@ H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) /* the fractal heap has already pinned the hdr. Do what */ /* sanity checking we can. */ if ((iblock->block_off == 0) && (iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED)) - HDassert(iblock->hdr->root_iblock == iblock); + assert(iblock->hdr->root_iblock == iblock); } /* end if */ else { /* if this is a child iblock, verify that the pointers are */ @@ -1451,9 +1384,9 @@ H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) unsigned H5_ATTR_NDEBUG_UNUSED indir_idx; /* Index in parent's child iblock pointer array */ /* Sanity check */ - HDassert(par_iblock->child_iblocks); - HDassert(iblock->par_entry >= - (iblock->hdr->man_dtable.max_direct_rows * iblock->hdr->man_dtable.cparam.width)); + assert(par_iblock->child_iblocks); + assert(iblock->par_entry >= + (iblock->hdr->man_dtable.max_direct_rows * iblock->hdr->man_dtable.cparam.width)); /* Compute index in parent's child iblock pointer array */ indir_idx = iblock->par_entry - @@ -1462,8 +1395,8 @@ H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) /* The pointer to iblock in the parent may not be set yet -- */ /* verify that it is either NULL, or that it has been set to */ /* iblock. */ - HDassert((NULL == par_iblock->child_iblocks[indir_idx]) || - (par_iblock->child_iblocks[indir_idx] == iblock)); + assert((NULL == par_iblock->child_iblocks[indir_idx]) || + (par_iblock->child_iblocks[indir_idx] == iblock)); } /* end else */ switch (action) { @@ -1472,7 +1405,7 @@ H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) /* Create flush dependency with parent, if there is one */ if (iblock->fd_parent) if (H5AC_create_flush_dependency(iblock->fd_parent, iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -1489,13 +1422,13 @@ H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) if (iblock->fd_parent) { /* Destroy flush dependency with parent */ if (H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); iblock->fd_parent = NULL; } /* end if */ break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); break; } /* end switch */ @@ -1509,16 +1442,9 @@ H5HF__cache_iblock_notify(H5AC_notify_action_t action, void *_thing) * Purpose: Unlink the supplied instance of H5HF_indirect_t from the * fractal heap and free its memory. * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1530,15 +1456,14 @@ H5HF__cache_iblock_free_icr(void *thing) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(iblock); - HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(iblock->rc == 0); - HDassert(iblock->hdr); + assert(iblock); + assert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(iblock->rc == 0); + assert(iblock->hdr); /* Destroy fractal heap indirect block */ if (H5HF__man_iblock_dest(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1553,9 +1478,6 @@ H5HF__cache_iblock_free_icr(void *thing) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1568,14 +1490,14 @@ H5HF__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(udata); - HDassert(image_len); + assert(udata); + assert(image_len); /* Convenience variables */ par_info = (const H5HF_parent_t *)(&(udata->par_info)); - HDassert(par_info); + assert(par_info); hdr = par_info->hdr; - HDassert(hdr); + assert(hdr); /* Check for I/O filters on this heap */ if (hdr->filter_len > 0) { @@ -1602,8 +1524,6 @@ H5HF__cache_dblock_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -1623,12 +1543,12 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); par_info = (H5HF_parent_t *)(&(udata->par_info)); - HDassert(par_info); + assert(par_info); hdr = par_info->hdr; - HDassert(hdr); + assert(hdr); /* Get out if data block is not checksummed */ if (!(hdr->checksum_dblocks)) @@ -1648,7 +1568,7 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata) * provided to it. */ if (NULL == (read_buf = H5MM_malloc(len))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer"); /* Set up parameters for filter pipeline */ nbytes = len; @@ -1658,7 +1578,7 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata) /* Push direct block data through I/O filter pipeline */ if (H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &len, &read_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, FAIL, "output pipeline failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, FAIL, "output pipeline failed"); /* Update info about direct block */ udata->decompressed = TRUE; @@ -1683,13 +1603,13 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata) chk_p -= H5HF_SIZEOF_CHKSUM; /* Reset checksum field, for computing the checksum */ - HDmemset(chk_p, 0, (size_t)H5HF_SIZEOF_CHKSUM); + memset(chk_p, 0, (size_t)H5HF_SIZEOF_CHKSUM); /* Compute checksum on entire direct block */ computed_chksum = H5_checksum_metadata(read_buf, len, 0); /* Restore the checksum */ - UINT32ENCODE(chk_p, stored_chksum) + UINT32ENCODE(chk_p, stored_chksum); /* Verify checksum */ if (stored_chksum != computed_chksum) @@ -1698,12 +1618,12 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata) /* Save the decompressed data to be used later in deserialize callback */ if (hdr->filter_len > 0) { /* Sanity check */ - HDassert(udata->decompressed); - HDassert(len == udata->dblock_size); + assert(udata->decompressed); + assert(len == udata->dblock_size); /* Allocate block buffer */ if (NULL == (udata->dblk = H5FL_BLK_MALLOC(direct_block, (size_t)len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Copy un-filtered data into block's buffer */ H5MM_memcpy(udata->dblk, read_buf, len); @@ -1732,9 +1652,6 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata) * Return: Success: Pointer to in core representation * Failure: NULL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static void * @@ -1752,20 +1669,19 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); par_info = (H5HF_parent_t *)(&(udata->par_info)); - HDassert(par_info); + assert(par_info); hdr = par_info->hdr; - HDassert(hdr); - HDassert(hdr->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); - HDassert(dirty); + assert(hdr); + assert(hdr->cache_info.type == H5AC_FHEAP_HDR); + assert(dirty); /* Allocate space for the fractal heap direct block */ if (NULL == (dblock = H5FL_CALLOC(H5HF_direct_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemset(&dblock->cache_info, 0, sizeof(H5AC_info_t)); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + memset(&dblock->cache_info, 0, sizeof(H5AC_info_t)); /* Set the shared heap header's file context for this operation */ hdr->f = udata->f; @@ -1773,7 +1689,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo /* Share common heap information */ dblock->hdr = hdr; if (H5HF__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment reference count on shared heap header"); /* Set block's internal information */ dblock->size = udata->dblock_size; @@ -1783,7 +1699,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo /* Direct block is already decompressed in verify_chksum callback */ if (udata->decompressed) { /* Sanity check */ - HDassert(udata->dblk); + assert(udata->dblk); /* Take ownership of the decompressed direct block */ dblock->blk = udata->dblk; @@ -1795,7 +1711,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo unsigned filter_mask; /* Excluded filters for direct block */ /* Sanity check */ - HDassert(udata->dblk == NULL); + assert(udata->dblk == NULL); /* Initialize the filter callback struct */ filter_cb.op_data = NULL; @@ -1806,7 +1722,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo * provided to it. */ if (NULL == (read_buf = H5MM_malloc(len))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer"); /* Copy compressed image into buffer */ H5MM_memcpy(read_buf, image, len); @@ -1816,10 +1732,10 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo filter_mask = udata->filter_mask; if (H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &len, &read_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed"); /* Sanity check */ - HDassert(nbytes == dblock->size); + assert(nbytes == dblock->size); /* Copy un-filtered data into block's buffer */ H5MM_memcpy(dblock->blk, read_buf, dblock->size); @@ -1827,16 +1743,16 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo } /* end if */ else { /* Sanity checks */ - HDassert(udata->dblk == NULL); - HDassert(!udata->decompressed); + assert(udata->dblk == NULL); + assert(!udata->decompressed); /* Allocate block buffer */ /* XXX: Change to using free-list factories */ if (NULL == (dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy image to dblock->blk */ - HDassert(dblock->size == len); + assert(dblock->size == len); H5MM_memcpy(dblock->blk, image, dblock->size); } /* end else */ @@ -1844,18 +1760,18 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo image = dblock->blk; /* Magic number */ - if (HDmemcmp(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong fractal heap direct block signature") + if (memcmp(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "wrong fractal heap direct block signature"); image += H5_SIZEOF_MAGIC; /* Version */ if (*image++ != H5HF_DBLOCK_VERSION) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, NULL, "wrong fractal heap direct block version"); /* Address of heap that owns this block (just for file integrity checks) */ H5F_addr_decode(udata->f, &image, &heap_addr); - if (H5F_addr_ne(heap_addr, hdr->heap_addr)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block") + if (H5_addr_ne(heap_addr, hdr->heap_addr)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "incorrect heap header address for direct block"); /* Address of parent block */ dblock->parent = par_info->iblock; @@ -1868,7 +1784,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo /* Share parent block */ if (H5HF__iblock_incr(dblock->parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, - "can't increment reference count on shared indirect block") + "can't increment reference count on shared indirect block"); } /* end if */ /* Offset of heap within the heap's address space */ @@ -1885,7 +1801,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo } /* end if */ /* Sanity check */ - HDassert((size_t)(image - dblock->blk) == (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); + assert((size_t)(image - dblock->blk) == (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); /* Set return value */ ret_value = (void *)dblock; @@ -1898,7 +1814,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo /* Cleanup on error */ if (!ret_value && dblock) if (H5HF__man_dblock_dest(dblock) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap direct block") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy fractal heap direct block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__cache_dblock_deserialize() */ @@ -1913,9 +1829,6 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, hbo * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -1928,14 +1841,13 @@ H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(dblock); - HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); - HDassert(image_len); + assert(dblock); + assert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); + assert(image_len); /* Set up convenience variables */ hdr = dblock->hdr; - HDassert(hdr); + assert(hdr); /* Check for I/O filters on this heap */ if (hdr->filter_len > 0) { @@ -1982,7 +1894,7 @@ H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len) size = dblock->size; /* Set the image size */ - HDassert(size > 0); + assert(size > 0); *image_len = size; FUNC_LEAVE_NOAPI(SUCCEED) @@ -2045,9 +1957,6 @@ H5HF__cache_dblock_image_len(const void *_thing, size_t *image_len) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -2070,17 +1979,16 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(dblock); - HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); - HDassert(dblock->write_buf == NULL); - HDassert(dblock->write_size == 0); - HDassert(dblock->cache_info.size == len); - HDassert(H5F_addr_defined(addr)); - HDassert(new_addr); - HDassert(new_len); - HDassert(flags); + assert(f); + assert(dblock); + assert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); + assert(dblock->write_buf == NULL); + assert(dblock->write_size == 0); + assert(dblock->cache_info.size == len); + assert(H5_addr_defined(addr)); + assert(new_addr); + assert(new_len); + assert(flags); /* Set up local variables */ hdr = dblock->hdr; @@ -2089,9 +1997,8 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le /* Set the shared heap header's file context for this operation */ hdr->f = (H5F_t *)f; - HDassert(hdr); - HDassert(hdr->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); + assert(hdr); + assert(hdr->cache_info.type == H5AC_FHEAP_HDR); if (dblock->parent) { /* this is the common case, in which the direct block is the child @@ -2103,9 +2010,8 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le par_iblock = dblock->parent; par_entry = dblock->par_entry; - HDassert(par_iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(par_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); + assert(par_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(H5_addr_eq(par_iblock->ents[par_entry].addr, addr)); } /* end if */ else { /* the direct block is a root direct block -- just set par_iblock @@ -2122,7 +2028,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le * and the checksum at the beginning of the block. */ - HDassert(dblock->blk); + assert(dblock->blk); image = dblock->blk; /* Magic number */ @@ -2143,7 +2049,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le uint32_t metadata_chksum; /* Computed metadata checksum value */ /* Clear the checksum field, to compute the checksum */ - HDmemset(image, 0, (size_t)H5HF_SIZEOF_CHKSUM); + memset(image, 0, (size_t)H5HF_SIZEOF_CHKSUM); /* Compute checksum on entire direct block */ metadata_chksum = H5_checksum_metadata(dblock->blk, dblock->size, 0); @@ -2158,7 +2064,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le */ /* Sanity check */ - HDassert((size_t)(image - dblock->blk) == (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); + assert((size_t)(image - dblock->blk) == (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); /* If I/O filters are enabled on this heap, we must run the direct block * image through the filters to obtain the image that we will hand off @@ -2178,7 +2084,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le /* Allocate buffer to perform I/O filtering on */ write_size = dblock->size; if (NULL == (write_buf = H5MM_malloc(write_size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer"); /* Copy the direct block's image into the buffer to compress */ H5MM_memcpy(write_buf, dblock->blk, write_size); @@ -2187,7 +2093,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le nbytes = write_size; if (H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &write_size, &write_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "output pipeline failed") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "output pipeline failed"); /* Use the compressed number of bytes as the size to write */ write_size = nbytes; @@ -2205,8 +2111,8 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le hbool_t hdr_changed = FALSE; /* Whether the header info changed */ /* Sanity check */ - HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); - HDassert(hdr->pline_root_direct_size > 0); + assert(H5_addr_eq(hdr->man_dtable.table_addr, addr)); + assert(hdr->pline_root_direct_size > 0); /* Check if the filter mask changed */ if (hdr->pline_root_direct_filter_mask != filter_mask) { @@ -2218,7 +2124,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le * size matches the heap's last record. This value will * likely change shortly. */ - HDassert(len == hdr->pline_root_direct_size); + assert(len == hdr->pline_root_direct_size); /* Check if we need to re-size the block on disk */ if (hdr->pline_root_direct_size != write_size || at_tmp_addr) { @@ -2230,19 +2136,19 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le if (!at_tmp_addr) /* Release direct block's current disk space */ if (H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, addr, (hsize_t)hdr->pline_root_direct_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block"); /* Allocate space for the compressed direct block */ if (HADDR_UNDEF == (dblock_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FHEAP_DBLOCK, (hsize_t)write_size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, - "file allocation failed for fractal heap direct block") + "file allocation failed for fractal heap direct block"); /* Update information about compressed direct block's * location & size */ - HDassert(hdr->man_dtable.table_addr == addr); - HDassert(hdr->pline_root_direct_size == len); + assert(hdr->man_dtable.table_addr == addr); + assert(hdr->pline_root_direct_size == len); hdr->man_dtable.table_addr = dblock_addr; hdr->pline_root_direct_size = write_size; @@ -2253,14 +2159,14 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le /* Check if heap header was modified */ if (hdr_changed) if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); } /* end if */ else { /* the direct block's parent is an indirect block */ hbool_t par_changed = FALSE; /* Whether the parent's infochanged */ /* Sanity check */ - HDassert(par_iblock); - HDassert(par_iblock->filt_ents[par_entry].size > 0); + assert(par_iblock); + assert(par_iblock->filt_ents[par_entry].size > 0); /* Check if the filter mask changed */ if (par_iblock->filt_ents[par_entry].filter_mask != filter_mask) { @@ -2272,7 +2178,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le * size matches the heap's last record. This value will * likely change shortly. */ - HDassert(len == par_iblock->filt_ents[par_entry].size); + assert(len == par_iblock->filt_ents[par_entry].size); /* Check if we need to re-size the block on disk */ if (par_iblock->filt_ents[par_entry].size != write_size || at_tmp_addr) { @@ -2285,19 +2191,19 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le /* Release direct block's current disk space */ if (H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, addr, (hsize_t)par_iblock->filt_ents[par_entry].size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block"); /* Allocate space for the compressed direct block */ if (HADDR_UNDEF == (dblock_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FHEAP_DBLOCK, (hsize_t)write_size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, - "file allocation failed for fractal heap direct block") + "file allocation failed for fractal heap direct block"); /* Update information about compressed direct block's * location & size */ - HDassert(par_iblock->ents[par_entry].addr == addr); - HDassert(par_iblock->filt_ents[par_entry].size == len); + assert(par_iblock->ents[par_entry].addr == addr); + assert(par_iblock->filt_ents[par_entry].size == len); par_iblock->ents[par_entry].addr = dblock_addr; par_iblock->filt_ents[par_entry].size = write_size; @@ -2308,7 +2214,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le /* Check if parent was modified */ if (par_changed) if (H5HF__iblock_dirty(par_iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); } /* end else */ } /* end if */ else { @@ -2333,34 +2239,34 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le if (HADDR_UNDEF == (dblock_addr = H5MF_alloc((H5F_t *)f, H5FD_MEM_FHEAP_DBLOCK, (hsize_t)write_size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, - "file allocation failed for fractal heap direct block") + "file allocation failed for fractal heap direct block"); /* Check for root direct block */ if (NULL == dblock->parent) { /* Sanity checks */ - HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); - HDassert(!H5F_addr_eq(hdr->man_dtable.table_addr, dblock_addr)); + assert(H5_addr_eq(hdr->man_dtable.table_addr, addr)); + assert(!H5_addr_eq(hdr->man_dtable.table_addr, dblock_addr)); /* Update information about direct block's location */ hdr->man_dtable.table_addr = dblock_addr; /* Mark that heap header was modified */ if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); } /* end if */ else { /* the direct block's parent is an indirect block */ /* Sanity checks */ - HDassert(par_iblock); - HDassert(par_iblock->ents); - HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); - HDassert(!H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr)); + assert(par_iblock); + assert(par_iblock->ents); + assert(H5_addr_eq(par_iblock->ents[par_entry].addr, addr)); + assert(!H5_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr)); /* Update information about direct block's location */ par_iblock->ents[par_entry].addr = dblock_addr; /* Mark that parent was modified */ if (H5HF__iblock_dirty(par_iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); } /* end else */ } /* end if */ } /* end else */ @@ -2379,7 +2285,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le dblock->write_size = write_size; /* finally, pass data back to the metadata cache as appropriate */ - if (!H5F_addr_eq(addr, dblock_addr)) { + if (!H5_addr_eq(addr, dblock_addr)) { dblock_flags |= H5AC__SERIALIZE_MOVED_FLAG; *new_addr = dblock_addr; } /* end if */ @@ -2392,8 +2298,8 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le *flags = dblock_flags; /* final sanity check */ - HDassert(dblock->write_buf); - HDassert(dblock->write_size > 0); + assert(dblock->write_buf); + assert(dblock->write_size > 0); done: /* discard the write buf if we have an error */ @@ -2419,9 +2325,6 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, haddr_t addr, size_t le * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -2434,17 +2337,16 @@ H5HF__cache_dblock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(f); - HDassert(image); - HDassert(len > 0); - HDassert(dblock); - HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); - HDassert((dblock->blk != dblock->write_buf) || (dblock->cache_info.size == dblock->size)); - HDassert(dblock->write_buf); - HDassert(dblock->write_size > 0); - HDassert((dblock->blk != dblock->write_buf) || (dblock->write_size == dblock->size)); - HDassert(dblock->write_size == len); + assert(f); + assert(image); + assert(len > 0); + assert(dblock); + assert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); + assert((dblock->blk != dblock->write_buf) || (dblock->cache_info.size == dblock->size)); + assert(dblock->write_buf); + assert(dblock->write_size > 0); + assert((dblock->blk != dblock->write_buf) || (dblock->write_size == dblock->size)); + assert(dblock->write_size == len); /* Copy the image from *(dblock->write_buf) to *image */ H5MM_memcpy(image, dblock->write_buf, dblock->write_size); @@ -2471,9 +2373,6 @@ H5HF__cache_dblock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -2485,10 +2384,9 @@ H5HF__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(dblock); - HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); - HDassert(dblock->hdr); + assert(dblock); + assert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); + assert(dblock->hdr); switch (action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: @@ -2496,7 +2394,7 @@ H5HF__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) /* Create flush dependency with parent, if there is one */ if (dblock->fd_parent) if (H5AC_create_flush_dependency(dblock->fd_parent, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -2513,13 +2411,13 @@ H5HF__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) if (dblock->fd_parent) { /* Destroy flush dependency with parent */ if (H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); dblock->fd_parent = NULL; } /* end if */ break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); break; } /* end switch */ @@ -2533,16 +2431,9 @@ H5HF__cache_dblock_notify(H5AC_notify_action_t action, void *_thing) * Purpose: Free the in core memory allocated to the supplied direct * block. * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -2554,13 +2445,12 @@ H5HF__cache_dblock_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(dblock); - HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); + assert(dblock); + assert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); /* Destroy fractal heap direct block */ if (H5HF__man_dblock_dest(dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2576,9 +2466,6 @@ H5HF__cache_dblock_free_icr(void *_thing) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * 1/5/18 - * *------------------------------------------------------------------------- */ static herr_t @@ -2589,11 +2476,10 @@ H5HF__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(dblock); - HDassert(dblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); - HDassert(dblock->file_size > 0); - HDassert(fsf_size); + assert(dblock); + assert(dblock->cache_info.type == H5AC_FHEAP_DBLOCK); + assert(dblock->file_size > 0); + assert(fsf_size); /* Set free space in file size */ *fsf_size = dblock->file_size; @@ -2659,9 +2545,6 @@ H5HF__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 5/25/14 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -2676,18 +2559,17 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, hbool_t *fd_ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(hdr); - HDassert(hdr->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(hdr->cache_info.type == H5AC_FHEAP_HDR); - HDassert(fd_clean); - HDassert(clean); + assert(f); + assert(hdr); + assert(hdr->cache_info.type == H5AC_FHEAP_HDR); + assert(fd_clean); + assert(clean); hdr_addr = hdr->cache_info.addr; - HDassert(hdr_addr == hdr->heap_addr); + assert(hdr_addr == hdr->heap_addr); if (H5AC_get_entry_status(f, hdr_addr, &hdr_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get hdr status") - HDassert(hdr_status & H5AC_ES__IN_CACHE); + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get hdr status"); + assert(hdr_status & H5AC_ES__IN_CACHE); /* We have three basic scenarios we have to deal with: * @@ -2737,12 +2619,12 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, hbool_t *fd_ root_iblock_addr = root_iblock->addr; /* get the status of the root iblock */ - HDassert(root_iblock_addr != HADDR_UNDEF); + assert(root_iblock_addr != HADDR_UNDEF); if (H5AC_get_entry_status(f, root_iblock_addr, &root_iblock_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get root iblock status") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get root iblock status"); root_iblock_in_cache = ((root_iblock_status & H5AC_ES__IN_CACHE) != 0); - HDassert(root_iblock_in_cache || (root_iblock == NULL)); + assert(root_iblock_in_cache || (root_iblock == NULL)); if (!root_iblock_in_cache) { /* we are done */ *clean = TRUE; @@ -2757,8 +2639,8 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, hbool_t *fd_ * the root inode. */ if (H5AC_flush_dependency_exists(f, hdr->heap_addr, root_iblock_addr, &fd_exists) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") - HDassert(fd_exists); + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency"); + assert(fd_exists); *fd_clean = FALSE; } /* end else-if */ @@ -2797,7 +2679,7 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, hbool_t *fd_ if (NULL == (root_iblock = (H5HF_indirect_t *)H5AC_protect( f, H5AC_FHEAP_IBLOCK, root_iblock_addr, NULL, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() failed.") + HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() failed."); H5_END_TAG @@ -2840,8 +2722,8 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, hbool_t *fd_ * or we think of a better way. */ if (H5AC_get_entry_ptr_from_addr(f, root_iblock_addr, (void **)(&root_iblock)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "H5AC_get_entry_ptr_from_addr() failed.") - HDassert(root_iblock); + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "H5AC_get_entry_ptr_from_addr() failed."); + assert(root_iblock); } /* end else */ } /* end if */ else { /* root_iblock != NULL */ @@ -2872,12 +2754,12 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, hbool_t *fd_ if (NULL == (iblock = (H5HF_indirect_t *)H5AC_protect( f, H5AC_FHEAP_IBLOCK, root_iblock_addr, NULL, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() failed.") + HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() failed."); H5_END_TAG unprotect_root_iblock = TRUE; - HDassert(iblock == root_iblock); + assert(iblock == root_iblock); } /* end if */ } /* end else */ @@ -2885,19 +2767,18 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, hbool_t *fd_ * in memory for the duration of the call. Do some sanity checks, * and then call H5HF__cache_verify_iblock_descendants_clean(). */ - HDassert(root_iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(root_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(root_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); if (H5HF__cache_verify_iblock_descendants_clean(f, hdr->heap_addr, root_iblock, &root_iblock_status, fd_clean, clean) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify root iblock & descendants clean.") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify root iblock & descendants clean."); /* Unprotect the root indirect block if required */ if (unprotect_root_iblock) { - HDassert(root_iblock); + assert(root_iblock); if (H5AC_unprotect(f, H5AC_FHEAP_IBLOCK, root_iblock_addr, root_iblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() failed.") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() failed."); } /* end if */ } /* end else */ } /* end if */ @@ -2910,14 +2791,14 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, hbool_t *fd_ /* this is scenario 2 -- we have a root dblock */ root_dblock_addr = hdr->man_dtable.table_addr; if (H5AC_get_entry_status(f, root_dblock_addr, &root_dblock_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get root dblock status") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get root dblock status"); if (root_dblock_status & H5AC_ES__IN_CACHE) { if (H5AC_verify_entry_type(f, root_dblock_addr, &H5AC_FHEAP_DBLOCK[0], &in_cache, &type_ok) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check dblock type") - HDassert(in_cache); + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check dblock type"); + assert(in_cache); if (!type_ok) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock addr doesn't refer to a dblock?!?") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock addr doesn't refer to a dblock?!?"); /* If a root dblock is in cache, it must have a flush * dependency relationship with the header, and it @@ -2929,12 +2810,12 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, hbool_t *fd_ * relationship with the header. */ if (H5AC_flush_dependency_exists(f, hdr->heap_addr, root_dblock_addr, &fd_exists) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency"); if (!fd_exists) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock is not a flush dep parent of header.") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock is not a flush dep parent of header."); if (0 != (root_dblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT)) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock in cache and is a flush dep parent.") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "root dblock in cache and is a flush dep parent."); *clean = !((root_dblock_status & H5AC_ES__IS_DIRTY) && (((root_dblock_status & H5AC_ES__IMAGE_IS_UP_TO_DATE) == 0) || @@ -3023,9 +2904,6 @@ H5HF__cache_verify_hdr_descendants_clean(H5F_t *f, H5HF_hdr_t *hdr, hbool_t *fd_ * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 5/25/14 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -3040,31 +2918,30 @@ H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, haddr_t fd_parent_addr, H5 FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(H5F_addr_defined(fd_parent_addr)); - HDassert(iblock); - HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(iblock_status); - HDassert(fd_clean); - HDassert(*fd_clean); - HDassert(clean); /* note that *clean need not be TRUE */ + assert(f); + assert(H5_addr_defined(fd_parent_addr)); + assert(iblock); + assert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(iblock_status); + assert(fd_clean); + assert(*fd_clean); + assert(clean); /* note that *clean need not be TRUE */ if ((*fd_clean) && H5HF__cache_verify_iblocks_dblocks_clean(f, fd_parent_addr, iblock, fd_clean, clean, &has_dblocks) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify dblocks clean.") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify dblocks clean."); if ((*fd_clean) && H5HF__cache_verify_descendant_iblocks_clean(f, fd_parent_addr, iblock, fd_clean, clean, &has_iblocks) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify iblocks clean.") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify iblocks clean."); /* verify that flush dependency setup is plausible */ if (0 == (*iblock_status & H5AC_ES__IS_FLUSH_DEP_CHILD)) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock is not a flush dep child.") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock is not a flush dep child."); if (((has_dblocks || has_iblocks)) && (0 == (*iblock_status & H5AC_ES__IS_FLUSH_DEP_PARENT))) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock has children and is not a flush dep parent.") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock has children and is not a flush dep parent."); if (((has_dblocks || has_iblocks)) && (0 == (*iblock_status & H5AC_ES__IS_PINNED))) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock has children and is not pinned.") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "iblock has children and is not pinned."); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3140,9 +3017,6 @@ H5HF__cache_verify_iblock_descendants_clean(H5F_t *f, haddr_t fd_parent_addr, H5 * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 5/25/14 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -3159,45 +3033,44 @@ H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5HF_ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(H5F_addr_defined(fd_parent_addr)); - HDassert(iblock); - HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(fd_clean); - HDassert(*fd_clean); - HDassert(clean); /* note that *clean need not be true */ - HDassert(has_dblocks); + assert(f); + assert(H5_addr_defined(fd_parent_addr)); + assert(iblock); + assert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(fd_clean); + assert(*fd_clean); + assert(clean); /* note that *clean need not be true */ + assert(has_dblocks); i = 0; num_direct_rows = MIN(iblock->nrows, iblock->hdr->man_dtable.max_direct_rows); - HDassert(num_direct_rows <= iblock->nrows); + assert(num_direct_rows <= iblock->nrows); max_dblock_index = (num_direct_rows * iblock->hdr->man_dtable.cparam.width) - 1; iblock_addr = iblock->addr; - HDassert(H5F_addr_defined(iblock_addr)); + assert(H5_addr_defined(iblock_addr)); while ((*fd_clean) && (i <= max_dblock_index)) { haddr_t dblock_addr; dblock_addr = iblock->ents[i].addr; - if (H5F_addr_defined(dblock_addr)) { + if (H5_addr_defined(dblock_addr)) { hbool_t in_cache; hbool_t type_ok; if (H5AC_verify_entry_type(f, dblock_addr, &H5AC_FHEAP_DBLOCK[0], &in_cache, &type_ok) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check dblock type") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check dblock type"); if (in_cache) { /* dblock is in cache */ hbool_t fd_exists; unsigned dblock_status = 0; if (!type_ok) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock addr doesn't refer to a dblock?!?") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "dblock addr doesn't refer to a dblock?!?"); if (H5AC_get_entry_status(f, dblock_addr, &dblock_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get dblock status") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get dblock status"); - HDassert(dblock_status & H5AC_ES__IN_CACHE); + assert(dblock_status & H5AC_ES__IN_CACHE); *has_dblocks = TRUE; @@ -3207,7 +3080,7 @@ H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5HF_ *clean = FALSE; if (H5AC_flush_dependency_exists(f, fd_parent_addr, dblock_addr, &fd_exists) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency"); if (fd_exists) *fd_clean = FALSE; @@ -3218,11 +3091,11 @@ H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5HF_ * here. */ if (H5AC_flush_dependency_exists(f, iblock_addr, dblock_addr, &fd_exists) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency"); if (!fd_exists) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, - "dblock in cache and not a flush dep child of iblock.") + "dblock in cache and not a flush dep child of iblock."); } /* end if */ } /* end if */ @@ -3304,9 +3177,6 @@ H5HF__cache_verify_iblocks_dblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5HF_ * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 5/25/14 - * *------------------------------------------------------------------------- */ #ifndef NDEBUG @@ -3324,17 +3194,16 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5 FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(H5F_addr_defined(fd_parent_addr)); - HDassert(iblock); - HDassert(iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(fd_clean); - HDassert(*fd_clean); - HDassert(clean); /* note that *clean need not be true */ - HDassert(has_iblocks); + assert(f); + assert(H5_addr_defined(fd_parent_addr)); + assert(iblock); + assert(iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(fd_clean); + assert(*fd_clean); + assert(clean); /* note that *clean need not be true */ + assert(has_iblocks); num_direct_rows = MIN(iblock->nrows, iblock->hdr->man_dtable.max_direct_rows); - HDassert(num_direct_rows <= iblock->nrows); + assert(num_direct_rows <= iblock->nrows); iblock_addr = iblock->addr; first_iblock_index = num_direct_rows * iblock->hdr->man_dtable.cparam.width; @@ -3344,11 +3213,11 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5 while ((*fd_clean) && (i <= last_iblock_index)) { haddr_t child_iblock_addr = iblock->ents[i].addr; - if (H5F_addr_defined(child_iblock_addr)) { + if (H5_addr_defined(child_iblock_addr)) { unsigned child_iblock_status = 0; if (H5AC_get_entry_status(f, child_iblock_addr, &child_iblock_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get iblock status") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get iblock status"); if (child_iblock_status & H5AC_ES__IN_CACHE) { hbool_t fd_exists; @@ -3362,7 +3231,7 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5 *clean = FALSE; if (H5AC_flush_dependency_exists(f, fd_parent_addr, child_iblock_addr, &fd_exists) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency"); if (fd_exists) *fd_clean = FALSE; @@ -3386,7 +3255,7 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5 * If the entry is unprotected and unpinned, we simply * protect it. * - * If, however, the the child iblock is already protected, + * If, however, the child iblock is already protected, * but not pinned, we have a bit of a problem, as we have * no legitimate way of looking up its pointer in memory. * @@ -3450,7 +3319,7 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5 if (NULL == (child_iblock = (H5HF_indirect_t *)H5AC_protect( f, H5AC_FHEAP_IBLOCK, child_iblock_addr, NULL, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() failed.") + HGOTO_ERROR_TAG(H5E_HEAP, H5E_CANTPROTECT, FAIL, "H5AC_protect() failed."); H5_END_TAG @@ -3464,14 +3333,14 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5 if (H5AC_get_entry_ptr_from_addr(f, child_iblock_addr, (void **)(&child_iblock)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "H5AC_get_entry_ptr_from_addr() failed.") - HDassert(child_iblock); + "H5AC_get_entry_ptr_from_addr() failed."); + assert(child_iblock); } /* end else */ } /* end if */ else { /* child iblock is pinned -- look it up in the */ /* parent iblocks child_iblocks array. */ - HDassert(iblock->child_iblocks); + assert(iblock->child_iblocks); child_iblock = iblock->child_iblocks[i - first_iblock_index]; } /* end else */ @@ -3479,15 +3348,14 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5 * a pointer to the child iblock. Verify that we * that we have the correct one. */ - HDassert(child_iblock); - HDassert(child_iblock->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(child_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); - HDassert(child_iblock->addr == child_iblock_addr); + assert(child_iblock); + assert(child_iblock->cache_info.type == H5AC_FHEAP_IBLOCK); + assert(child_iblock->addr == child_iblock_addr); /* now make the recursive call */ if (H5HF__cache_verify_iblock_descendants_clean( f, fd_parent_addr, child_iblock, &child_iblock_status, fd_clean, clean) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify child iblock clean.") + HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, "can't verify child iblock clean."); /* if iblock_addr != fd_parent_addr, verify that a flush * dependency relationship exists between iblock and @@ -3495,18 +3363,18 @@ H5HF__cache_verify_descendant_iblocks_clean(H5F_t *f, haddr_t fd_parent_addr, H5 */ if (fd_parent_addr != iblock_addr) { if (H5AC_flush_dependency_exists(f, iblock_addr, child_iblock_addr, &fd_exists) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't check flush dependency"); if (!fd_exists) HGOTO_ERROR(H5E_HEAP, H5E_SYSTEM, FAIL, - "iblock is not a flush dep parent of child_iblock.") + "iblock is not a flush dep parent of child_iblock."); } /* end if */ /* if we protected the child iblock, unprotect it now */ if (unprotect_child_iblock) { if (H5AC_unprotect(f, H5AC_FHEAP_IBLOCK, child_iblock_addr, child_iblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() failed.") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "H5AC_unprotect() failed."); } /* end if */ } /* end if */ } /* end if */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFdbg.c index af8c264971..0a86fc009e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFdbg.c - * Feb 24 2006 - * Quincey Koziol * * Purpose: Dump debugging information about a fractal heap * @@ -96,9 +93,6 @@ static herr_t H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 20 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -116,18 +110,18 @@ H5HF_id_print(H5HF_t *fh, const void *_id, FILE *stream, int indent, int fwidth) /* * Check arguments. */ - HDassert(fh); - HDassert(id); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(fh); + assert(id); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Get the ID flags */ id_flags = *id; /* Check for correct heap ID version */ if ((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version"); /* Check type of object in heap */ if ((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) { @@ -140,21 +134,21 @@ H5HF_id_print(H5HF_t *fh, const void *_id, FILE *stream, int indent, int fwidth) id_type = 'T'; } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") + fprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet"); } /* end else */ /* Get the length of the heap object */ if (H5HF_get_obj_len(fh, id, &obj_len) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve heap ID length") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve heap ID length"); /* Get the offset of the heap object */ if (H5HF_get_obj_off(fh, id, &obj_off) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve heap ID length") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve heap ID length"); /* Display the heap ID */ - HDfprintf(stream, "%*s%-*s (%c, %" PRIuHSIZE " , %zu)\n", indent, "", fwidth, - "Heap ID info: (type, offset, length)", id_type, obj_off, obj_len); + fprintf(stream, "%*s%-*s (%c, %" PRIuHSIZE " , %zu)\n", indent, "", fwidth, + "Heap ID info: (type, offset, length)", id_type, obj_off, obj_len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -167,9 +161,6 @@ H5HF_id_print(H5HF_t *fh, const void *_id, FILE *stream, int indent, int fwidth) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 28 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -180,40 +171,39 @@ H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fw /* * Check arguments. */ - HDassert(dtable); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(dtable); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* * Print the values. */ /* Creation parameter values */ - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Doubling table width:", dtable->cparam.width); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "Starting block size:", dtable->cparam.start_block_size); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "Max. direct block size:", dtable->cparam.max_direct_size); - HDfprintf(stream, "%*s%-*s %u (bits)\n", indent, "", fwidth, - "Max. index size:", dtable->cparam.max_index); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Starting # of rows in root indirect block:", dtable->cparam.start_root_rows); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Doubling table width:", dtable->cparam.width); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "Starting block size:", dtable->cparam.start_block_size); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "Max. direct block size:", dtable->cparam.max_direct_size); + fprintf(stream, "%*s%-*s %u (bits)\n", indent, "", fwidth, "Max. index size:", dtable->cparam.max_index); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Starting # of rows in root indirect block:", dtable->cparam.start_root_rows); /* Run-time varying parameter values */ - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Table's root address:", dtable->table_addr); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Current # of rows in root indirect block:", dtable->curr_root_rows); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Table's root address:", dtable->table_addr); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Current # of rows in root indirect block:", dtable->curr_root_rows); /* Computed values */ - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Max. # of rows in root indirect block:", dtable->max_root_rows); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Max. # of direct rows in any indirect block:", dtable->max_direct_rows); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "# of bits for IDs in first row:", dtable->first_row_bits); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "# of IDs in first row:", dtable->num_id_first_row); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Max. # of rows in root indirect block:", dtable->max_root_rows); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Max. # of direct rows in any indirect block:", dtable->max_direct_rows); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "# of bits for IDs in first row:", dtable->first_row_bits); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "# of IDs in first row:", dtable->num_id_first_row); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF__dtable_debug() */ @@ -225,9 +215,6 @@ H5HF__dtable_debug(const H5HF_dtable_t *dtable, FILE *stream, int indent, int fw * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 23 2012 - * *------------------------------------------------------------------------- */ void @@ -238,76 +225,76 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i /* * Check arguments. */ - HDassert(hdr); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(hdr); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Print opening message */ - HDfprintf(stream, "%*sFractal Heap Header...\n", indent, ""); + fprintf(stream, "%*sFractal Heap Header...\n", indent, ""); /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Heap is:", hdr->man_dtable.curr_root_rows > 0 ? "Indirect" : "Direct"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Objects stored in 'debugging' format:", hdr->debug_objs ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "'Write once' flag:", hdr->write_once ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "'Huge' object IDs have wrapped:", hdr->huge_ids_wrapped ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "Free space in managed blocks:", hdr->total_man_free); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "Managed space data block size:", hdr->man_size); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "Total managed space allocated:", hdr->man_alloc_size); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "Offset of managed space iterator:", hdr->man_iter_off); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "Number of managed objects in heap:", hdr->man_nobjs); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Address of free space manager for managed blocks:", hdr->fs_addr); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Max. size of managed object:", (unsigned long)hdr->max_man_size); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "'Huge' object space used:", hdr->huge_size); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "Number of 'huge' objects in heap:", hdr->huge_nobjs); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "ID of next 'huge' object:", hdr->huge_next_id); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Address of v2 B-tree for 'huge' objects:", hdr->huge_bt2_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "'Tiny' object space used:", hdr->tiny_size); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "Number of 'tiny' objects in heap:", hdr->tiny_nobjs); - - HDfprintf(stream, "%*sManaged Objects Doubling-Table Info...\n", indent, ""); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Heap is:", hdr->man_dtable.curr_root_rows > 0 ? "Indirect" : "Direct"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Objects stored in 'debugging' format:", hdr->debug_objs ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "'Write once' flag:", hdr->write_once ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "'Huge' object IDs have wrapped:", hdr->huge_ids_wrapped ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "Free space in managed blocks:", hdr->total_man_free); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "Managed space data block size:", hdr->man_size); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "Total managed space allocated:", hdr->man_alloc_size); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "Offset of managed space iterator:", hdr->man_iter_off); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "Number of managed objects in heap:", hdr->man_nobjs); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Address of free space manager for managed blocks:", hdr->fs_addr); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Max. size of managed object:", (unsigned long)hdr->max_man_size); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "'Huge' object space used:", hdr->huge_size); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "Number of 'huge' objects in heap:", hdr->huge_nobjs); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "ID of next 'huge' object:", hdr->huge_next_id); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Address of v2 B-tree for 'huge' objects:", hdr->huge_bt2_addr); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "'Tiny' object space used:", hdr->tiny_size); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "Number of 'tiny' objects in heap:", hdr->tiny_nobjs); + + fprintf(stream, "%*sManaged Objects Doubling-Table Info...\n", indent, ""); H5HF__dtable_debug(&hdr->man_dtable, stream, indent + 3, MAX(0, fwidth - 3)); /* Print information about I/O filters */ if (hdr->filter_len > 0) { - HDfprintf(stream, "%*sI/O filter Info...\n", indent, ""); + fprintf(stream, "%*sI/O filter Info...\n", indent, ""); if (hdr->man_dtable.curr_root_rows == 0) { - HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), - "Compressed size of root direct block:", hdr->pline_root_direct_size); - HDfprintf(stream, "%*s%-*s %x\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter mask for root direct block:", hdr->pline_root_direct_filter_mask); + fprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), + "Compressed size of root direct block:", hdr->pline_root_direct_size); + fprintf(stream, "%*s%-*s %x\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter mask for root direct block:", hdr->pline_root_direct_filter_mask); } /* end if */ H5O_debug_id(H5O_PLINE_ID, hdr->f, &(hdr->pline), stream, indent + 3, MAX(0, fwidth - 3)); } /* end if */ /* Print internal (runtime) information, if requested */ if (dump_internal) { - HDfprintf(stream, "%*sFractal Heap Header Internal Information:\n", indent, ""); + fprintf(stream, "%*sFractal Heap Header Internal Information:\n", indent, ""); /* Dump root iblock, if there is one */ - HDfprintf(stream, "%*s%-*s %x\n", indent + 3, "", MAX(0, fwidth - 3), - "Root indirect block flags:", hdr->root_iblock_flags); - HDfprintf(stream, "%*s%-*s %p\n", indent + 3, "", MAX(0, fwidth - 3), - "Root indirect block pointer:", (void *)hdr->root_iblock); + fprintf(stream, "%*s%-*s %x\n", indent + 3, "", MAX(0, fwidth - 3), + "Root indirect block flags:", hdr->root_iblock_flags); + fprintf(stream, "%*s%-*s %p\n", indent + 3, "", MAX(0, fwidth - 3), + "Root indirect block pointer:", (void *)hdr->root_iblock); if (hdr->root_iblock) H5HF_iblock_print(hdr->root_iblock, dump_internal, stream, indent + 3, fwidth); } /* end if */ @@ -322,9 +309,6 @@ H5HF_hdr_print(const H5HF_hdr_t *hdr, hbool_t dump_internal, FILE *stream, int i * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -338,22 +322,22 @@ H5HF_hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Load the fractal heap header */ if (NULL == (hdr = H5HF__hdr_protect(f, addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header"); /* Print the information about the heap's header */ H5HF_hdr_print(hdr, FALSE, stream, indent, fwidth); done: if (hdr && H5AC_unprotect(f, H5AC_FHEAP_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header") + HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_hdr_debug() */ @@ -365,9 +349,6 @@ H5HF_hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 13 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -383,16 +364,16 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) /* * Check arguments. */ - HDassert(sect); - HDassert(udata); + assert(sect); + assert(udata); /* Set up some local variables, for convenience */ sect_start = sect->sect_info.addr; sect_end = (sect->sect_info.addr + sect->sect_info.size) - 1; - HDassert(sect_end >= sect_start); + assert(sect_end >= sect_start); dblock_start = udata->dblock_addr; dblock_end = (udata->dblock_addr + udata->dblock_size) - 1; - HDassert(dblock_end >= dblock_start); + assert(dblock_end >= dblock_start); /* Check for overlap between free space section & direct block */ if ((sect_start <= dblock_end && @@ -408,18 +389,18 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) if (sect_start < dblock_start) start = 0; else - H5_CHECKED_ASSIGN(start, size_t, (sect_start - dblock_start), hsize_t) + H5_CHECKED_ASSIGN(start, size_t, (sect_start - dblock_start), hsize_t); if (sect_end > dblock_end) - H5_CHECKED_ASSIGN(end, size_t, udata->dblock_size, hsize_t) + H5_CHECKED_ASSIGN(end, size_t, udata->dblock_size, hsize_t); else - H5_CHECKED_ASSIGN(end, size_t, ((sect_end - dblock_start) + 1), hsize_t) + H5_CHECKED_ASSIGN(end, size_t, ((sect_end - dblock_start) + 1), hsize_t); /* Calculate the length */ len = end - start; HDsnprintf(temp_str, sizeof(temp_str), "Section #%u:", (unsigned)udata->sect_count); - HDfprintf(udata->stream, "%*s%-*s %8zu, %8zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9), - temp_str, start, len); + fprintf(udata->stream, "%*s%-*s %8zu, %8zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9), + temp_str, start, len); udata->sect_count++; /* Mark this node's free space & check for overlaps w/other sections */ @@ -432,7 +413,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) /* Flag overlaps */ if (overlap) - HDfprintf(udata->stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); + fprintf(udata->stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); else udata->amount_free += len; } /* end if */ @@ -447,9 +428,6 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 28 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -468,44 +446,44 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(H5F_addr_defined(hdr_addr)); - HDassert(block_size > 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(H5_addr_defined(hdr_addr)); + assert(block_size > 0); /* Load the fractal heap header */ if (NULL == (hdr = H5HF__hdr_protect(f, hdr_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header"); /* * Load the heap direct block */ if (NULL == (dblock = H5HF__man_dblock_protect(hdr, addr, block_size, NULL, 0, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap direct block"); /* Print opening message */ - HDfprintf(stream, "%*sFractal Heap Direct Block...\n", indent, ""); + fprintf(stream, "%*sFractal Heap Direct Block...\n", indent, ""); /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Address of fractal heap that owns this block:", hdr->heap_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "Offset of direct block in heap:", dblock->block_off); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Address of fractal heap that owns this block:", hdr->heap_addr); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "Offset of direct block in heap:", dblock->block_off); blk_prefix_size = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of block header:", blk_prefix_size); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of block header:", blk_prefix_size); /* Allocate space for the free space markers */ if (NULL == (marker = (uint8_t *)H5MM_calloc(dblock->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize the free space information for the heap */ if (H5HF__space_start(hdr, FALSE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space"); /* If there is a free space manager for the heap, check for sections that overlap this block */ if (hdr->fspace) { @@ -522,29 +500,29 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, udata.amount_free = 0; /* Print header */ - HDfprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); + fprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); /* Iterate over the free space sections, to detect overlaps with this block */ if (H5FS_sect_iterate(f, hdr->fspace, H5HF_dblock_debug_cb, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space"); /* Close the free space information */ if (H5HF__space_close(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info"); /* Keep the amount of space free */ amount_free = udata.amount_free; /* Check for no free space */ if (amount_free == 0) - HDfprintf(stream, "%*s\n", indent + 3, ""); + fprintf(stream, "%*s\n", indent + 3, ""); } /* end if */ else amount_free = 0; - HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of available space for data used:", - (100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) / - (double)(dblock->size - blk_prefix_size))); + fprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of available space for data used:", + (100.0 * (double)((dblock->size - blk_prefix_size) - amount_free) / + (double)(dblock->size - blk_prefix_size))); /* * Print the data in a VMS-style octal dump. @@ -553,9 +531,9 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, done: if (dblock && H5AC_unprotect(f, H5AC_FHEAP_DBLOCK, addr, dblock, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap direct block") + HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap direct block"); if (hdr && H5AC_unprotect(f, H5AC_FHEAP_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header") + HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header"); H5MM_xfree(marker); FUNC_LEAVE_NOAPI(ret_value) @@ -568,9 +546,6 @@ H5HF_dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 23 2012 - * *------------------------------------------------------------------------- */ void @@ -585,54 +560,54 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st /* * Check arguments. */ - HDassert(iblock); - HDassert(iblock->hdr); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(iblock); + assert(iblock->hdr); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Set up convenience variables */ hdr = iblock->hdr; /* Print opening message */ - HDfprintf(stream, "%*sFractal Heap Indirect Block...\n", indent, ""); + fprintf(stream, "%*sFractal Heap Indirect Block...\n", indent, ""); /* * Print the values. */ - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Address of fractal heap that owns this block:", hdr->heap_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, - "Offset of indirect block in heap:", iblock->block_off); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of indirect block:", iblock->size); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Current # of rows:", iblock->nrows); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. # of rows:", iblock->max_rows); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Max direct block rows:", hdr->man_dtable.max_direct_rows); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Address of fractal heap that owns this block:", hdr->heap_addr); + fprintf(stream, "%*s%-*s %" PRIuHSIZE " \n", indent, "", fwidth, + "Offset of indirect block in heap:", iblock->block_off); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Size of indirect block:", iblock->size); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Current # of rows:", iblock->nrows); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. # of rows:", iblock->max_rows); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Max direct block rows:", hdr->man_dtable.max_direct_rows); /* Print the entry tables */ if (hdr->filter_len > 0) - HDfprintf(stream, "%*sDirect Block Entries: (address/compressed size/filter mask)\n", indent, ""); + fprintf(stream, "%*sDirect Block Entries: (address/compressed size/filter mask)\n", indent, ""); else - HDfprintf(stream, "%*sDirect Block Entries: (address)\n", indent, ""); + fprintf(stream, "%*sDirect Block Entries: (address)\n", indent, ""); for (u = 0; u < hdr->man_dtable.max_direct_rows && u < iblock->nrows; u++) { HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (block size: %lu)", (unsigned)u, (unsigned long)hdr->man_dtable.row_block_size[u]); - HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); + fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); for (v = 0; v < hdr->man_dtable.cparam.width; v++) { size_t off = (u * hdr->man_dtable.cparam.width) + v; HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); if (hdr->filter_len > 0) - HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "/%6zu/%x\n", indent + 6, "", MAX(0, fwidth - 6), - temp_str, iblock->ents[off].addr, iblock->filt_ents[off].size, - iblock->filt_ents[off].filter_mask); + fprintf(stream, "%*s%-*s %9" PRIuHADDR "/%6zu/%x\n", indent + 6, "", MAX(0, fwidth - 6), + temp_str, iblock->ents[off].addr, iblock->filt_ents[off].size, + iblock->filt_ents[off].filter_mask); else - HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, - iblock->ents[off].addr); + fprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, + iblock->ents[off].addr); } /* end for */ } /* end for */ - HDfprintf(stream, "%*sIndirect Block Entries:\n", indent, ""); + fprintf(stream, "%*sIndirect Block Entries:\n", indent, ""); if (iblock->nrows > hdr->man_dtable.max_direct_rows) { unsigned first_row_bits; /* Number of bits used bit addresses in first row */ unsigned num_indirect_rows; /* Number of rows of blocks in each indirect block */ @@ -643,30 +618,29 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st num_indirect_rows = (H5VM_log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1; HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (# of rows: %u)", (unsigned)u, num_indirect_rows); - HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); + fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); for (v = 0; v < hdr->man_dtable.cparam.width; v++) { size_t off = (u * hdr->man_dtable.cparam.width) + v; HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v); - HDfprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, - iblock->ents[off].addr); + fprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str, + iblock->ents[off].addr); } /* end for */ } /* end for */ } /* end if */ else - HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), ""); + fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), ""); /* Print internal (runtime) information, if requested */ if (dump_internal) { - HDfprintf(stream, "%*sFractal Indirect Block Internal Information:\n", indent, ""); + fprintf(stream, "%*sFractal Indirect Block Internal Information:\n", indent, ""); /* Print general information */ - HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), - "Reference count:", iblock->rc); + fprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Reference count:", iblock->rc); /* Print parent's information */ - HDfprintf(stream, "%*s%-*s %p\n", indent + 3, "", MAX(0, fwidth - 3), - "Parent indirect block address:", (void *)iblock->parent); + fprintf(stream, "%*s%-*s %p\n", indent + 3, "", MAX(0, fwidth - 3), + "Parent indirect block address:", (void *)iblock->parent); if (iblock->parent) H5HF_iblock_print(iblock->parent, TRUE, stream, indent + 6, fwidth); } /* end if */ @@ -681,9 +655,6 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, hbool_t dump_internal, FILE *st * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 7 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -700,33 +671,33 @@ H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - HDassert(H5F_addr_defined(hdr_addr)); - HDassert(nrows > 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + assert(H5_addr_defined(hdr_addr)); + assert(nrows > 0); /* Load the fractal heap header */ if (NULL == (hdr = H5HF__hdr_protect(f, hdr_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header"); /* * Load the heap indirect block */ if (NULL == (iblock = H5HF__man_iblock_protect(hdr, addr, nrows, NULL, 0, FALSE, H5AC__READ_ONLY_FLAG, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block"); /* Print the information about the heap's indirect block */ H5HF_iblock_print(iblock, FALSE, stream, indent, fwidth); done: if (iblock && H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap direct block") + HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap direct block"); if (hdr && H5AC_unprotect(f, H5AC_FHEAP_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header") + HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_iblock_debug() */ @@ -738,9 +709,6 @@ H5HF_iblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 13 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -755,26 +723,25 @@ H5HF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) /* * Check arguments. */ - HDassert(sect); - HDassert(udata); + assert(sect); + assert(udata); /* Print generic section information */ - HDfprintf( - udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, "Section type:", - (sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE - ? "single" - : (sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW - ? "first row" - : (sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW ? "normal row" : "unknown")))); - HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, - "Section address:", sect->sect_info.addr); - HDfprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\n", udata->indent, "", udata->fwidth, - "Section size:", sect->sect_info.size); + fprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, "Section type:", + (sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE + ? "single" + : (sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW + ? "first row" + : (sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW ? "normal row" : "unknown")))); + fprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, + "Section address:", sect->sect_info.addr); + fprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\n", udata->indent, "", udata->fwidth, + "Section size:", sect->sect_info.size); /* Dump section-specific debugging information */ if (H5FS_sect_debug(udata->fspace, _sect, udata->stream, udata->indent + 3, MAX(0, udata->fwidth - 3)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't dump section's debugging info") + HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't dump section's debugging info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -787,9 +754,6 @@ H5HF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 9 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -803,19 +767,19 @@ H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, int fwidth /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(fh_addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(H5_addr_defined(fh_addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Load the fractal heap header */ if (NULL == (hdr = H5HF__hdr_protect(f, fh_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap header"); /* Initialize the free space information for the heap */ if (H5HF__space_start(hdr, FALSE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space"); /* If there is a free space manager for the heap, iterate over them */ if (hdr->fspace) { @@ -829,16 +793,16 @@ H5HF_sects_debug(H5F_t *f, haddr_t fh_addr, FILE *stream, int indent, int fwidth /* Iterate over all the free space sections */ if (H5FS_sect_iterate(f, hdr->fspace, H5HF_sects_debug_cb, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space"); /* Close the free space information */ if (H5HF__space_close(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info"); } /* end if */ done: if (hdr && H5AC_unprotect(f, H5AC_FHEAP_HDR, fh_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header") + HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release fractal heap header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_sects_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFdblock.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFdblock.c index 69e745ae91..6b37f9868a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFdblock.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFdblock.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFdblock.c - * Apr 10 2006 - * Quincey Koziol * * Purpose: Direct block routines for fractal heaps. * @@ -76,9 +73,6 @@ H5FL_DEFINE(H5HF_direct_t); * * Return: Pointer to new direct block on success, NULL on failure * - * Programmer: Quincey Koziol - * Feb 27 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -96,21 +90,22 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* * Allocate file and memory data structures. */ if (NULL == (dblock = H5FL_MALLOC(H5HF_direct_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for fractal heap direct block") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for fractal heap direct block"); /* Reset the metadata cache info for the heap header */ - HDmemset(&dblock->cache_info, 0, sizeof(H5AC_info_t)); + memset(&dblock->cache_info, 0, sizeof(H5AC_info_t)); /* Share common heap information */ dblock->hdr = hdr; if (H5HF__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header"); /* Set info for direct block */ if (par_iblock) { @@ -134,8 +129,8 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p /* Allocate buffer for block */ /* XXX: Change to using free-list factories */ if ((dblock->blk = H5FL_BLK_MALLOC(direct_block, dblock->size)) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - HDmemset(dblock->blk, 0, dblock->size); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + memset(dblock->blk, 0, dblock->size); dblock->write_buf = NULL; dblock->write_size = 0; @@ -144,19 +139,19 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p if (H5F_USE_TMP_SPACE(hdr->f)) { if (HADDR_UNDEF == (dblock_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)dblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "file allocation failed for fractal heap direct block") + "file allocation failed for fractal heap direct block"); } /* end if */ else { if (HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_DBLOCK, (hsize_t)dblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "file allocation failed for fractal heap direct block") + "file allocation failed for fractal heap direct block"); } /* end else */ /* Attach to parent indirect block, if there is one */ dblock->parent = par_iblock; if (dblock->parent) { if (H5HF__man_iblock_attach(dblock->parent, par_entry, dblock_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't attach direct block to parent indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't attach direct block to parent indirect block"); dblock->fd_parent = par_iblock; } /* end if */ else @@ -166,7 +161,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p /* Create a new 'single' section for the free space in the block */ if (NULL == (sec_node = H5HF__sect_single_new((dblock->block_off + H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)), free_space, dblock->parent, dblock->par_entry))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for new direct block's free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for new direct block's free space"); /* Check what to do with section node */ if (ret_sec_node) @@ -175,16 +170,16 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p else { /* Add new free space to the heap's list of space */ if (H5HF__space_add(hdr, sec_node, 0) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list"); } /* end else */ /* Cache the new fractal heap direct block */ if (H5AC_insert_entry(hdr->f, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap direct block to cache") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap direct block to cache"); /* Increase the allocated heap size */ if (H5HF__hdr_inc_alloc(hdr, dblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size"); /* Set the address of of direct block, if requested */ if (addr_p) @@ -194,7 +189,7 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p if (ret_value < 0) if (dblock) if (H5HF__man_dblock_dest(dblock) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap direct block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__man_dblock_create() */ @@ -210,9 +205,6 @@ H5HF__man_dblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 17 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -227,8 +219,8 @@ H5HF__man_dblock_destroy(H5HF_hdr_t *hdr, H5HF_direct_t *dblock, haddr_t dblock_ /* * Check arguments. */ - HDassert(hdr); - HDassert(dblock); + assert(hdr); + assert(dblock); /* Check for I/O filters on this heap */ if (hdr->filter_len > 0) { @@ -258,15 +250,15 @@ H5HF__man_dblock_destroy(H5HF_hdr_t *hdr, H5HF_direct_t *dblock, haddr_t dblock_ /* Check for root direct block */ if (hdr->man_dtable.curr_root_rows == 0) { /* Sanity check */ - HDassert(hdr->man_dtable.table_addr == dblock_addr); - HDassert(hdr->man_dtable.cparam.start_block_size == dblock->size); + assert(hdr->man_dtable.table_addr == dblock_addr); + assert(hdr->man_dtable.cparam.start_block_size == dblock->size); /* Sanity check block iterator */ - HDassert(!H5HF__man_iter_ready(&hdr->next_block)); + assert(!H5HF__man_iter_ready(&hdr->next_block)); /* Reset header information back to "empty heap" state */ if (H5HF__hdr_empty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty"); } /* end if */ else { /* Adjust heap statistics */ @@ -276,13 +268,13 @@ H5HF__man_dblock_destroy(H5HF_hdr_t *hdr, H5HF_direct_t *dblock, haddr_t dblock_ if ((dblock->block_off + dblock->size) == hdr->man_iter_off) /* Move 'next block' iterator backwards (may shrink heap) */ if (H5HF__hdr_reverse_iter(hdr, dblock_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reverse 'next block' iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reverse 'next block' iterator"); /* Detach from parent indirect block */ if (dblock->parent) { /* Destroy flush dependency between direct block and parent */ if (H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); dblock->fd_parent = NULL; /* If this is the last direct block for the indirect block, the @@ -309,7 +301,7 @@ H5HF__man_dblock_destroy(H5HF_hdr_t *hdr, H5HF_direct_t *dblock, haddr_t dblock_ done: /* Unprotect the indirect block, with appropriate flags */ if (H5AC_unprotect(hdr->f, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, cache_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__man_dblock_destroy() */ @@ -322,9 +314,6 @@ H5HF__man_dblock_destroy(H5HF_hdr_t *hdr, H5HF_direct_t *dblock, haddr_t dblock_ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Mar 13 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -339,15 +328,15 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_ /* * Check arguments. */ - HDassert(hdr); - HDassert(request > 0); + assert(hdr); + assert(request > 0); /* Compute the min. size of the direct block needed to fulfill the request */ if (request < hdr->man_dtable.cparam.start_block_size) min_dblock_size = hdr->man_dtable.cparam.start_block_size; else { min_dblock_size = ((size_t)1) << (1 + H5VM_log2_gen((uint64_t)request)); - HDassert(min_dblock_size <= hdr->man_dtable.cparam.max_direct_size); + assert(min_dblock_size <= hdr->man_dtable.cparam.max_direct_size); } /* end else */ /* Adjust the size of block needed to fulfill request, with overhead */ @@ -355,11 +344,11 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_ min_dblock_size *= 2; /* Check if this is the first block in the heap */ - if (!H5F_addr_defined(hdr->man_dtable.table_addr) && + if (!H5_addr_defined(hdr->man_dtable.table_addr) && min_dblock_size == hdr->man_dtable.cparam.start_block_size) { /* Create new direct block at starting offset */ if (H5HF__man_dblock_create(hdr, NULL, 0, &dblock_addr, ret_sec_node) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block"); /* Point root at new direct block */ hdr->man_dtable.curr_root_rows = 0; @@ -372,7 +361,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_ /* Extend heap to cover new direct block */ if (H5HF__hdr_adjust_heap(hdr, (hsize_t)hdr->man_dtable.cparam.start_block_size, (hssize_t)hdr->man_dtable.row_tot_dblock_free[0]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block"); } /* end if */ /* Root entry already exists, allocate direct block from root indirect block */ else { @@ -384,30 +373,29 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_ /* Update iterator to reflect any previous increments as well as allow for requested direct block size */ if (H5HF__hdr_update_iter(hdr, min_dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "unable to update block iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "unable to update block iterator"); /* Retrieve information about current iterator position */ if (H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") - HDassert(next_row < iblock->nrows); + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location"); + assert(next_row < iblock->nrows); H5_CHECKED_ASSIGN(next_size, size_t, hdr->man_dtable.row_block_size[next_row], hsize_t); /* Check for skipping over blocks */ if (min_dblock_size > next_size) { - HDfprintf( - stderr, - "%s: Skipping direct block sizes not supported, min_dblock_size = %zu, next_size = %zu\n", - __func__, min_dblock_size, next_size); - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not supported yet") + fprintf(stderr, + "%s: Skipping direct block sizes not supported, min_dblock_size = %zu, next_size = %zu\n", + __func__, min_dblock_size, next_size); + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not supported yet"); } /* end if */ /* Advance "next block" iterator to next direct block entry */ if (H5HF__hdr_inc_iter(hdr, (hsize_t)next_size, 1) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment 'next block' iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment 'next block' iterator"); /* Create new direct block at current location*/ if (H5HF__man_dblock_create(hdr, iblock, next_entry, &dblock_addr, ret_sec_node) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block"); } /* end else */ done: @@ -422,9 +410,6 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_ * * Return: Pointer to direct block on success, NULL on failure * - * Programmer: Quincey Koziol - * Apr 17 2006 - * *------------------------------------------------------------------------- */ H5HF_direct_t * @@ -440,12 +425,12 @@ H5HF__man_dblock_protect(H5HF_hdr_t *hdr, haddr_t dblock_addr, size_t dblock_siz /* * Check arguments. */ - HDassert(hdr); - HDassert(H5F_addr_defined(dblock_addr)); - HDassert(dblock_size > 0); + assert(hdr); + assert(H5_addr_defined(dblock_addr)); + assert(dblock_size > 0); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up parent info */ udata.par_info.hdr = hdr; @@ -468,7 +453,7 @@ H5HF__man_dblock_protect(H5HF_hdr_t *hdr, haddr_t dblock_addr, size_t dblock_siz } /* end if */ else { /* Sanity check */ - HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr)); + assert(H5_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr)); /* Set up parameters to read filtered direct block */ udata.odi_size = par_iblock->filt_ents[par_entry].size; @@ -487,7 +472,7 @@ H5HF__man_dblock_protect(H5HF_hdr_t *hdr, haddr_t dblock_addr, size_t dblock_siz /* Protect the direct block */ if (NULL == (dblock = (H5HF_direct_t *)H5AC_protect(hdr->f, H5AC_FHEAP_DBLOCK, dblock_addr, &udata, flags))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap direct block"); /* Set the return value */ ret_value = dblock; @@ -503,9 +488,6 @@ H5HF__man_dblock_protect(H5HF_hdr_t *hdr, haddr_t dblock_addr, size_t dblock_siz * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 8 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -524,17 +506,17 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, H5HF_indirect_t **ret_ /* * Check arguments. */ - HDassert(hdr); - HDassert(hdr->man_dtable.curr_root_rows); /* Only works for heaps with indirect root block */ - HDassert(ret_iblock); - HDassert(ret_did_protect); + assert(hdr); + assert(hdr->man_dtable.curr_root_rows); /* Only works for heaps with indirect root block */ + assert(ret_iblock); + assert(ret_did_protect); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Look up row & column for object */ if (H5HF__dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object"); /* Set initial indirect block info */ iblock_addr = hdr->man_dtable.table_addr; @@ -542,7 +524,7 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, H5HF_indirect_t **ret_ /* Lock root indirect block */ if (NULL == (iblock = H5HF__man_iblock_protect(hdr, iblock_addr, hdr->man_dtable.curr_root_rows, NULL, 0, FALSE, flags, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block"); /* Check for indirect block row */ while (row >= hdr->man_dtable.max_direct_rows) { @@ -553,7 +535,7 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, H5HF_indirect_t **ret_ /* Compute # of rows in child indirect block */ nrows = (H5VM_log2_gen(hdr->man_dtable.row_block_size[row]) - hdr->man_dtable.first_row_bits) + 1; - HDassert(nrows < iblock->nrows); /* child must be smaller than parent */ + assert(nrows < iblock->nrows); /* child must be smaller than parent */ /* Compute indirect block's entry */ entry = (row * hdr->man_dtable.cparam.width) + col; @@ -562,9 +544,9 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, H5HF_indirect_t **ret_ iblock_addr = iblock->ents[entry].addr; /* Check if we need to (re-)create the child indirect block */ - if (!H5F_addr_defined(iblock_addr)) { + if (!H5_addr_defined(iblock_addr)) { if (H5HF__man_iblock_create(hdr, iblock, entry, nrows, nrows, &iblock_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block"); /* Indicate that the parent indirect block was modified */ cache_flags |= H5AC__DIRTIED_FLAG; @@ -573,11 +555,11 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, H5HF_indirect_t **ret_ /* Lock child indirect block */ if (NULL == (new_iblock = H5HF__man_iblock_protect(hdr, iblock_addr, nrows, iblock, entry, FALSE, flags, &new_did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block"); /* Release the current indirect block */ if (H5HF__man_iblock_unprotect(iblock, cache_flags, did_protect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); /* Switch variables to use new indirect block */ iblock = new_iblock; @@ -585,9 +567,9 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, H5HF_indirect_t **ret_ /* Look up row & column in new indirect block for object */ if (H5HF__dtable_lookup(&hdr->man_dtable, (obj_off - iblock->block_off), &row, &col) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") - HDassert(row < iblock->nrows); /* child must be smaller than parent */ - } /* end while */ + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object"); + assert(row < iblock->nrows); /* child must be smaller than parent */ + } /* end while */ /* Set return parameters */ if (ret_entry) @@ -611,9 +593,6 @@ H5HF__man_dblock_locate(H5HF_hdr_t *hdr, hsize_t obj_off, H5HF_indirect_t **ret_ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 7 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -627,23 +606,23 @@ H5HF__man_dblock_delete(H5F_t *f, haddr_t dblock_addr, hsize_t dblock_size) /* * Check arguments. */ - HDassert(f); - HDassert(H5F_addr_defined(dblock_addr)); - HDassert(dblock_size > 0); + assert(f); + assert(H5_addr_defined(dblock_addr)); + assert(dblock_size > 0); /* Check the direct block's status in the metadata cache */ if (H5AC_get_entry_status(f, dblock_addr, &dblock_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for direct block"); /* If the direct block is in the cache, expunge it now */ if (dblock_status & H5AC_ES__IN_CACHE) { /* Sanity checks on direct block */ - HDassert(!(dblock_status & H5AC_ES__IS_PINNED)); - HDassert(!(dblock_status & H5AC_ES__IS_PROTECTED)); + assert(!(dblock_status & H5AC_ES__IS_PINNED)); + assert(!(dblock_status & H5AC_ES__IS_PROTECTED)); /* Evict the direct block from the metadata cache */ if (H5AC_expunge_entry(f, H5AC_FHEAP_DBLOCK, dblock_addr, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove direct block from cache") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove direct block from cache"); } /* end if */ /* Check if the direct block is NOT currently allocated in temp. file space */ @@ -661,7 +640,7 @@ H5HF__man_dblock_delete(H5F_t *f, haddr_t dblock_addr, hsize_t dblock_size) * so we just release the file space here, directly. -QAK) */ if (H5MF_xfree(f, H5FD_MEM_FHEAP_DBLOCK, dblock_addr, dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block file space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap direct block file space"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -674,9 +653,6 @@ H5HF__man_dblock_delete(H5F_t *f, haddr_t dblock_addr, hsize_t dblock_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 27 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -689,16 +665,16 @@ H5HF__man_dblock_dest(H5HF_direct_t *dblock) /* * Check arguments. */ - HDassert(dblock); + assert(dblock); /* Decrement reference count on shared fractal heap info */ - HDassert(dblock->hdr != NULL); + assert(dblock->hdr != NULL); if (H5HF__hdr_decr(dblock->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header"); if (dblock->parent) if (H5HF__iblock_decr(dblock->parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared indirect block") + "can't decrement reference count on shared indirect block"); /* Free block's buffer */ dblock->blk = H5FL_BLK_FREE(direct_block, dblock->blk); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFdtable.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFdtable.c index 5a1f9503a5..f03060d879 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFdtable.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFdtable.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFdtable.c - * Apr 10 2006 - * Quincey Koziol * * Purpose: "Doubling table" routines for fractal heaps. * @@ -72,9 +69,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 6 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -90,7 +84,7 @@ H5HF__dtable_init(H5HF_dtable_t *dtable) /* * Check arguments. */ - HDassert(dtable); + assert(dtable); /* Compute/cache some values */ dtable->start_bits = H5VM_log2_of2((uint32_t)dtable->cparam.start_block_size); @@ -103,16 +97,16 @@ H5HF__dtable_init(H5HF_dtable_t *dtable) /* Build table of block sizes for each row */ if (NULL == (dtable->row_block_size = (hsize_t *)H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table block size table") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table block size table"); if (NULL == (dtable->row_block_off = (hsize_t *)H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table block offset table") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create doubling table block offset table"); if (NULL == (dtable->row_tot_dblock_free = (hsize_t *)H5MM_malloc(dtable->max_root_rows * sizeof(hsize_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "can't create doubling table total direct block free space table") + "can't create doubling table total direct block free space table"); if (NULL == (dtable->row_max_dblock_free = (size_t *)H5MM_malloc(dtable->max_root_rows * sizeof(size_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "can't create doubling table max. direct block free space table") + "can't create doubling table max. direct block free space table"); tmp_block_size = dtable->cparam.start_block_size; acc_block_off = dtable->cparam.start_block_size * dtable->cparam.width; dtable->row_block_size[0] = dtable->cparam.start_block_size; @@ -135,9 +129,6 @@ H5HF__dtable_init(H5HF_dtable_t *dtable) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 6 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -148,9 +139,9 @@ H5HF__dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, uns /* * Check arguments. */ - HDassert(dtable); - HDassert(row); - HDassert(col); + assert(dtable); + assert(row); + assert(col); /* Check for offset in first row */ if (off < dtable->num_id_first_row) { @@ -175,9 +166,6 @@ H5HF__dtable_lookup(const H5HF_dtable_t *dtable, hsize_t off, unsigned *row, uns * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 27 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -188,7 +176,7 @@ H5HF__dtable_dest(H5HF_dtable_t *dtable) /* * Check arguments. */ - HDassert(dtable); + assert(dtable); /* Free the block size lookup table for the doubling table */ H5MM_xfree(dtable->row_block_size); @@ -212,9 +200,6 @@ H5HF__dtable_dest(H5HF_dtable_t *dtable) * * Return: Non-negative on success (can't fail) * - * Programmer: Quincey Koziol - * Apr 25 2006 - * *------------------------------------------------------------------------- */ unsigned @@ -227,7 +212,7 @@ H5HF__dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) /* * Check arguments. */ - HDassert(dtable); + assert(dtable); if (block_size == dtable->cparam.start_block_size) row = 0; @@ -246,9 +231,6 @@ H5HF__dtable_size_to_row(const H5HF_dtable_t *dtable, size_t block_size) * * Return: Non-negative on success (can't fail) * - * Programmer: Quincey Koziol - * May 31 2006 - * *------------------------------------------------------------------------- */ unsigned @@ -261,7 +243,7 @@ H5HF__dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) /* * Check arguments. */ - HDassert(dtable); + assert(dtable); rows = (H5VM_log2_gen(size) - dtable->first_row_bits) + 1; @@ -275,9 +257,6 @@ H5HF__dtable_size_to_rows(const H5HF_dtable_t *dtable, hsize_t size) * * Return: Non-zero span size on success/zero on failure * - * Programmer: Quincey Koziol - * July 25 2006 - * *------------------------------------------------------------------------- */ hsize_t @@ -295,8 +274,8 @@ H5HF__dtable_span_size(const H5HF_dtable_t *dtable, unsigned start_row, unsigned /* * Check arguments. */ - HDassert(dtable); - HDassert(num_entries > 0); + assert(dtable); + assert(num_entries > 0); /* Compute starting entry */ start_entry = (start_row * dtable->cparam.width) + start_col; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFhdr.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFhdr.c index fa03c32399..d74d3a3a16 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFhdr.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFhdr.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFhdr.c - * Apr 10 2006 - * Quincey Koziol * * Purpose: Heap header routines for fractal heaps. * @@ -91,9 +88,6 @@ H5FL_DEFINE_STATIC(H5HF_hdr_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 21 2006 - * *------------------------------------------------------------------------- */ H5HF_hdr_t * @@ -107,11 +101,11 @@ H5HF__hdr_alloc(H5F_t *f) /* * Check arguments. */ - HDassert(f); + assert(f); /* Allocate space for the shared information */ if (NULL == (hdr = H5FL_CALLOC(H5HF_hdr_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "allocation failed for fractal heap shared header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "allocation failed for fractal heap shared header"); /* Set the internal parameters for the heap */ hdr->f = f; @@ -133,9 +127,6 @@ H5HF__hdr_alloc(H5F_t *f) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 21 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -153,8 +144,8 @@ H5HF__hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) /* * Check arguments. */ - HDassert(hdr); - HDassert(iblock_row >= hdr->man_dtable.max_direct_rows); + assert(hdr); + assert(iblock_row >= hdr->man_dtable.max_direct_rows); /* Set the free space in direct blocks */ acc_heap_size = 0; @@ -184,9 +175,6 @@ H5HF__hdr_compute_free_space(H5HF_hdr_t *hdr, unsigned iblock_row) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 12 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -199,12 +187,12 @@ H5HF__hdr_finish_init_phase1(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Compute/cache some values */ hdr->heap_off_size = (uint8_t)H5HF_SIZEOF_OFFSET_BITS(hdr->man_dtable.cparam.max_index); if (H5HF__dtable_init(&hdr->man_dtable) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize doubling table info"); /* Set the size of heap IDs */ hdr->heap_len_size = @@ -221,9 +209,6 @@ H5HF__hdr_finish_init_phase1(H5HF_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 12 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -237,7 +222,7 @@ H5HF__hdr_finish_init_phase2(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Set the free space in direct blocks */ for (u = 0; u < hdr->man_dtable.max_root_rows; u++) { @@ -249,20 +234,20 @@ H5HF__hdr_finish_init_phase2(H5HF_hdr_t *hdr) } /* end if */ else if (H5HF__hdr_compute_free_space(hdr, u) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, - "can't initialize direct block free space for indirect block") + "can't initialize direct block free space for indirect block"); } /* end for */ /* Initialize the block iterator for searching for free space */ if (H5HF__man_iter_init(&hdr->next_block) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize space search block iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize space search block iterator"); /* Initialize the information for tracking 'huge' objects */ if (H5HF__huge_init(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize info for tracking huge objects") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize info for tracking huge objects"); /* Initialize the information for tracking 'tiny' objects */ if (H5HF__tiny_init(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize info for tracking tiny objects") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize info for tracking tiny objects"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -275,9 +260,6 @@ H5HF__hdr_finish_init_phase2(H5HF_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 21 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -290,15 +272,15 @@ H5HF__hdr_finish_init(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* First phase of header final initialization */ if (H5HF__hdr_finish_init_phase1(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't finish phase #1 of header final initialization") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't finish phase #1 of header final initialization"); /* Second phase of header final initialization */ if (H5HF__hdr_finish_init_phase2(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't finish phase #2 of header final initialization") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't finish phase #2 of header final initialization"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -311,9 +293,6 @@ H5HF__hdr_finish_init(H5HF_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 21 2006 - * *------------------------------------------------------------------------- */ haddr_t @@ -328,41 +307,41 @@ H5HF__hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* * Check arguments. */ - HDassert(f); - HDassert(cparam); + assert(f); + assert(cparam); #ifndef NDEBUG /* Check for valid parameters */ if (cparam->managed.width == 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "width must be greater than zero") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "width must be greater than zero"); if (cparam->managed.width > H5HF_WIDTH_LIMIT) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "width too large") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "width too large"); if (!POWER_OF_TWO(cparam->managed.width)) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "width not power of two") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "width not power of two"); if (cparam->managed.start_block_size == 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "starting block size must be greater than zero") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "starting block size must be greater than zero"); if (!POWER_OF_TWO(cparam->managed.start_block_size)) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "starting block size not power of two") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "starting block size not power of two"); if (cparam->managed.max_direct_size == 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. direct block size must be greater than zero") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. direct block size must be greater than zero"); if (cparam->managed.max_direct_size > H5HF_MAX_DIRECT_SIZE_LIMIT) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. direct block size too large") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. direct block size too large"); if (!POWER_OF_TWO(cparam->managed.max_direct_size)) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. direct block size not power of two") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. direct block size not power of two"); if (cparam->managed.max_direct_size < cparam->max_man_size) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, - "max. direct block size not large enough to hold all managed blocks") + "max. direct block size not large enough to hold all managed blocks"); if (cparam->managed.max_index == 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. heap size must be greater than zero") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. heap size must be greater than zero"); #endif /* NDEBUG */ /* Allocate & basic initialization for the shared header */ if (NULL == (hdr = H5HF__hdr_alloc(f))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "can't allocate space for shared heap info") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "can't allocate space for shared heap info"); #ifndef NDEBUG if (cparam->managed.max_index > (unsigned)(8 * hdr->sizeof_size)) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. heap size too large for file") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, "max. heap size too large for file"); #endif /* NDEBUG */ /* Set the creation parameters for the heap */ @@ -383,7 +362,7 @@ H5HF__hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* (doesn't need ID length set up) */ if (H5HF__hdr_finish_init_phase1(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, - "can't finish phase #1 of header final initialization") + "can't finish phase #1 of header final initialization"); /* Copy any I/O filter pipeline */ /* (This code is not in the "finish init phase" routines because those @@ -393,26 +372,26 @@ H5HF__hdr_create(H5F_t *f, const H5HF_create_t *cparam) if (cparam->pline.nused > 0) { /* Check if the filters in the DCPL can be applied to this dataset */ if (H5Z_can_apply_direct(&(cparam->pline)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "I/O filters can't operate on this heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "I/O filters can't operate on this heap"); /* Mark the filters as checked */ hdr->checked_filters = TRUE; /* Make the "set local" filter callbacks for this dataset */ if (H5Z_set_local_direct(&(cparam->pline)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to set local filter parameters") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to set local filter parameters"); /* Copy the I/O filter pipeline from the creation parameters to the header */ if (NULL == H5O_msg_copy(H5O_PLINE_ID, &(cparam->pline), &(hdr->pline))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline"); /* Set the version for the I/O pipeline message */ if (H5O_pline_set_version(hdr->f, &(hdr->pline)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set version of I/O filter pipeline") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set version of I/O filter pipeline"); /* Compute the I/O filters' encoded size */ if (0 == (hdr->filter_len = (unsigned)H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline)))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, HADDR_UNDEF, "can't get I/O filter pipeline size") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, HADDR_UNDEF, "can't get I/O filter pipeline size"); /* Compute size of header on disk */ hdr->heap_size = H5HF_HEADER_SIZE(hdr) /* Base header size */ @@ -457,10 +436,10 @@ H5HF__hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Check boundaries */ if (cparam->id_len < (1 + hdr->heap_off_size + hdr->heap_len_size)) HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, HADDR_UNDEF, - "ID length not large enough to hold object IDs") + "ID length not large enough to hold object IDs"); else if (cparam->id_len > H5HF_MAX_ID_LEN) HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, HADDR_UNDEF, - "ID length too large to store tiny object lengths") + "ID length too large to store tiny object lengths"); /* Use the requested size for the heap ID */ hdr->id_len = cparam->id_len; @@ -471,30 +450,30 @@ H5HF__hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* (needs ID and filter lengths set up) */ if (H5HF__hdr_finish_init_phase2(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, - "can't finish phase #2 of header final initialization") + "can't finish phase #2 of header final initialization"); /* Extra checking for possible gap between max. direct block size minus * overhead and "huge" object size */ dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); if ((cparam->managed.max_direct_size - dblock_overhead) < cparam->max_man_size) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, HADDR_UNDEF, - "max. direct block size not large enough to hold all managed blocks") + "max. direct block size not large enough to hold all managed blocks"); /* Allocate space for the header on disk */ if (HADDR_UNDEF == (hdr->heap_addr = H5MF_alloc(f, H5FD_MEM_FHEAP_HDR, (hsize_t)hdr->heap_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for fractal heap header"); /* Cache the new fractal heap header */ if (H5AC_insert_entry(f, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, HADDR_UNDEF, "can't add fractal heap header to cache"); /* Set address of heap header to return */ ret_value = hdr->heap_addr; done: - if (!H5F_addr_defined(ret_value) && hdr) + if (!H5_addr_defined(ret_value) && hdr) if (H5HF__hdr_free(hdr) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, HADDR_UNDEF, "unable to release fractal heap header") + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, HADDR_UNDEF, "unable to release fractal heap header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__hdr_create() */ @@ -506,9 +485,6 @@ H5HF__hdr_create(H5F_t *f, const H5HF_create_t *cparam) * * Return: Pointer to indirect block on success, NULL on failure * - * Programmer: Quincey Koziol - * May 5 2010 - * *------------------------------------------------------------------------- */ H5HF_hdr_t * @@ -521,18 +497,18 @@ H5HF__hdr_protect(H5F_t *f, haddr_t addr, unsigned flags) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(H5_addr_defined(addr)); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Set up userdata for protect call */ cache_udata.f = f; /* Lock the heap header into memory */ if (NULL == (hdr = (H5HF_hdr_t *)H5AC_protect(f, H5AC_FHEAP_HDR, addr, &cache_udata, flags))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap header"); /* Set the header's address */ hdr->heap_addr = addr; @@ -554,9 +530,6 @@ H5HF__hdr_protect(H5F_t *f, haddr_t addr, unsigned flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 27 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -567,12 +540,12 @@ H5HF__hdr_incr(H5HF_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Mark header as un-evictable when a block is depending on it */ if (hdr->rc == 0) if (H5AC_pin_protected_entry(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap header"); /* Increment reference count on shared header */ hdr->rc++; @@ -588,9 +561,6 @@ H5HF__hdr_incr(H5HF_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 27 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -601,17 +571,17 @@ H5HF__hdr_decr(H5HF_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(hdr->rc); + assert(hdr); + assert(hdr->rc); /* Decrement reference count on shared header */ hdr->rc--; /* Mark header as evictable again when no child blocks depend on it */ if (hdr->rc == 0) { - HDassert(hdr->file_rc == 0); + assert(hdr->file_rc == 0); if (H5AC_unpin_entry(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap header"); } /* end if */ done: @@ -625,9 +595,6 @@ H5HF__hdr_decr(H5HF_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 1 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -636,7 +603,7 @@ H5HF__hdr_fuse_incr(H5HF_hdr_t *hdr) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Increment file reference count on shared header */ hdr->file_rc++; @@ -651,9 +618,6 @@ H5HF__hdr_fuse_incr(H5HF_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 1 2006 - * *------------------------------------------------------------------------- */ size_t @@ -662,8 +626,8 @@ H5HF__hdr_fuse_decr(H5HF_hdr_t *hdr) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(hdr); - HDassert(hdr->file_rc); + assert(hdr); + assert(hdr->file_rc); /* Decrement file reference count on shared header */ hdr->file_rc--; @@ -678,9 +642,6 @@ H5HF__hdr_fuse_decr(H5HF_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 27 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -691,16 +652,16 @@ H5HF__hdr_dirty(H5HF_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Resize pinned header in cache if I/O filter is present. */ if (hdr->filter_len > 0) if (H5AC_resize_entry(hdr, (size_t)hdr->heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap header"); /* Mark header as dirty in cache */ if (H5AC_mark_entry_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -713,9 +674,6 @@ H5HF__hdr_dirty(H5HF_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 9 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -728,15 +686,15 @@ H5HF__hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Update heap header */ - HDassert(amt > 0 || hdr->total_man_free >= (hsize_t)-amt); + assert(amt > 0 || hdr->total_man_free >= (hsize_t)-amt); hdr->total_man_free = (hsize_t)((hssize_t)hdr->total_man_free + amt); /* Mark heap header as modified */ if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -749,9 +707,6 @@ H5HF__hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Apr 10 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -764,18 +719,18 @@ H5HF__hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Set the total managed space in heap */ hdr->man_size = new_size; /* Adjust the free space in direct blocks */ - HDassert(extra_free > 0 || hdr->total_man_free >= (hsize_t)-extra_free); + assert(extra_free > 0 || hdr->total_man_free >= (hsize_t)-extra_free); hdr->total_man_free = (hsize_t)((hssize_t)hdr->total_man_free + extra_free); /* Mark heap header as modified */ if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -788,9 +743,6 @@ H5HF__hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 23 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -801,8 +753,8 @@ H5HF__hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) /* * Check arguments. */ - HDassert(hdr); - HDassert(alloc_size); + assert(hdr); + assert(alloc_size); /* Update the "allocated" size within the heap */ hdr->man_alloc_size += alloc_size; @@ -817,9 +769,6 @@ H5HF__hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 30 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -832,12 +781,12 @@ H5HF__hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, /* * Check arguments. */ - HDassert(hdr); - HDassert(iblock); + assert(hdr); + assert(iblock); /* Set up "next block" iterator at correct location */ if (H5HF__man_iter_start_entry(hdr, &hdr->next_block, iblock, curr_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize block iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize block iterator"); /* Set the offset of the iterator in the heap */ hdr->man_iter_off = curr_off; @@ -853,9 +802,6 @@ H5HF__hdr_start_iter(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, hsize_t curr_off, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 31 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -868,11 +814,11 @@ H5HF__hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Reset "next block" iterator */ if (H5HF__man_iter_reset(&hdr->next_block) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator"); /* Set the offset of the iterator in the heap */ hdr->man_iter_off = curr_off; @@ -888,9 +834,6 @@ H5HF__hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 3 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -905,24 +848,24 @@ H5HF__hdr_skip_blocks(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_e /* * Check arguments. */ - HDassert(hdr); - HDassert(iblock); - HDassert(nentries); + assert(hdr); + assert(iblock); + assert(nentries); /* Compute the span within the heap to skip */ row = start_entry / hdr->man_dtable.cparam.width; col = start_entry % hdr->man_dtable.cparam.width; sect_size = H5HF__dtable_span_size(&hdr->man_dtable, row, col, nentries); - HDassert(sect_size > 0); + assert(sect_size > 0); /* Advance the new block iterator */ if (H5HF__hdr_inc_iter(hdr, sect_size, nentries) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size"); /* Add 'indirect' section for blocks skipped in this row */ if (H5HF__sect_indirect_add(hdr, iblock, start_entry, nentries) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, - "can't create indirect section for indirect block's free space") + "can't create indirect section for indirect block's free space"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -938,9 +881,6 @@ H5HF__hdr_skip_blocks(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start_e * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -953,13 +893,13 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) /* * Check arguments. */ - HDassert(hdr); - HDassert(min_dblock_size > 0); + assert(hdr); + assert(min_dblock_size > 0); /* Check for creating first indirect block */ if (hdr->man_dtable.curr_root_rows == 0) { if (H5HF__man_iblock_root_create(hdr, min_dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to create root indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to create root indirect block"); } /* end if */ else { H5HF_indirect_t *iblock; /* Pointer to indirect block */ @@ -975,12 +915,12 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) if (!H5HF__man_iter_ready(&hdr->next_block)) { /* Start iterator with previous offset of iterator */ if (H5HF__man_iter_start_offset(hdr, &hdr->next_block, hdr->man_iter_off) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location"); } /* end if */ /* Get information about current iterator location */ if (H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location"); /* Check for skipping over blocks in the current block */ if (min_dblock_row > next_row && next_row < iblock->nrows) { @@ -996,11 +936,12 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Add skipped direct blocks to heap's free space */ if (H5HF__hdr_skip_blocks(hdr, iblock, next_entry, skip_entries) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space"); /* Get information about new iterator location */ if (H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, + "unable to retrieve current block iterator location"); } /* end if */ do { @@ -1013,23 +954,23 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Check for needing to expand root indirect block */ if (iblock->parent == NULL) { if (H5HF__man_iblock_root_double(hdr, min_dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to double root indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to double root indirect block"); } /* end if */ else { /* Move iterator up one level */ if (H5HF__man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, - "unable to advance current block iterator location") + "unable to advance current block iterator location"); /* Increment location of next block at this level */ if (H5HF__man_iter_next(hdr, &hdr->next_block, 1) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't advance fractal heap block location") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't advance fractal heap block location"); } /* end else */ /* Get information about new iterator location */ if (H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "unable to retrieve current block iterator location") + "unable to retrieve current block iterator location"); /* Indicate that we walked up */ walked_up = TRUE; @@ -1040,7 +981,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) if (next_row >= hdr->man_dtable.max_direct_rows) { unsigned child_nrows; /* Number of rows in new indirect block */ - HDassert(!H5F_addr_defined(iblock->ents[next_entry].addr)); + assert(!H5_addr_defined(iblock->ents[next_entry].addr)); /* Compute # of rows in next child indirect block to use */ child_nrows = @@ -1056,7 +997,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) child_rows_needed = (H5VM_log2_of2((uint32_t)min_dblock_size) - H5VM_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size)) + 2; - HDassert(child_rows_needed > child_nrows); + assert(child_rows_needed > child_nrows); child_entry = (next_row + (child_rows_needed - child_nrows)) * hdr->man_dtable.cparam.width; if (child_entry > (iblock->nrows * hdr->man_dtable.cparam.width)) @@ -1065,7 +1006,7 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Add skipped indirect blocks to heap's free space */ if (H5HF__hdr_skip_blocks(hdr, iblock, next_entry, (child_entry - next_entry)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, - "can't add skipped blocks to heap's free space") + "can't add skipped blocks to heap's free space"); } /* end if */ else { H5HF_indirect_t *new_iblock; /* Pointer to new indirect block */ @@ -1076,19 +1017,19 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) if (H5HF__man_iblock_create(hdr, iblock, next_entry, child_nrows, child_nrows, &new_iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, - "can't allocate fractal heap indirect block") + "can't allocate fractal heap indirect block"); /* Lock new indirect block */ if (NULL == (new_iblock = H5HF__man_iblock_protect(hdr, new_iblock_addr, child_nrows, iblock, next_entry, FALSE, H5AC__NO_FLAGS_SET, &did_protect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, - "unable to protect fractal heap indirect block") + "unable to protect fractal heap indirect block"); /* Move iterator down one level (pins indirect block) */ if (H5HF__man_iter_down(&hdr->next_block, new_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, - "unable to advance current block iterator location") + "unable to advance current block iterator location"); /* Check for skipping over rows and add free section for skipped rows */ if (min_dblock_size > hdr->man_dtable.cparam.start_block_size) { @@ -1100,19 +1041,19 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Add skipped blocks to heap's free space */ if (H5HF__hdr_skip_blocks(hdr, new_iblock, 0, new_entry) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, - "can't add skipped blocks to heap's free space") + "can't add skipped blocks to heap's free space"); } /* end if */ /* Unprotect child indirect block */ if (H5HF__man_iblock_unprotect(new_iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, - "unable to release fractal heap indirect block") + "unable to release fractal heap indirect block"); } /* end else */ /* Get information about new iterator location */ if (H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "unable to retrieve current block iterator location") + "unable to retrieve current block iterator location"); /* Indicate that we walked down */ walked_down = TRUE; @@ -1131,9 +1072,6 @@ H5HF__hdr_update_iter(H5HF_hdr_t *hdr, size_t min_dblock_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 23 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1146,13 +1084,13 @@ H5HF__hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) /* * Check arguments. */ - HDassert(hdr); - HDassert(nentries); + assert(hdr); + assert(nentries); /* Advance the iterator for the current location within the indirect block */ if (hdr->next_block.curr) if (H5HF__man_iter_next(hdr, &hdr->next_block, nentries) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") + HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location"); /* Increment the offset of the iterator in the heap */ hdr->man_iter_off += adv_size; @@ -1169,9 +1107,6 @@ H5HF__hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 31 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1188,19 +1123,19 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Initialize block iterator, if necessary */ if (!H5HF__man_iter_ready(&hdr->next_block)) /* Start iterator with previous offset of iterator */ if (H5HF__man_iter_start_offset(hdr, &hdr->next_block, hdr->man_iter_off) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location"); /* Walk backwards through heap, looking for direct block to place iterator after */ /* Get information about current iterator location */ if (H5HF__man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information"); /* Move current iterator position backwards once */ curr_entry--; @@ -1216,8 +1151,8 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) /* Walk backwards through entries, until we find one that has a child */ /* (Skip direct block that will be deleted, if we find it) */ tmp_entry = (int)curr_entry; - while (tmp_entry >= 0 && (H5F_addr_eq(iblock->ents[tmp_entry].addr, dblock_addr) || - !H5F_addr_defined(iblock->ents[tmp_entry].addr))) + while (tmp_entry >= 0 && (H5_addr_eq(iblock->ents[tmp_entry].addr, dblock_addr) || + !H5_addr_defined(iblock->ents[tmp_entry].addr))) tmp_entry--; /* Check for no earlier blocks in this indirect block */ if (tmp_entry < 0) { @@ -1226,12 +1161,12 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) /* Move iterator to parent of current block */ if (H5HF__man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, - "unable to move current block iterator location up") + "unable to move current block iterator location up"); /* Get information about current iterator location */ if (H5HF__man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "unable to retrieve current block iterator information") + "unable to retrieve current block iterator information"); /* Move current iterator position backwards once */ curr_entry--; @@ -1245,7 +1180,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) /* Reset 'next block' iterator */ if (H5HF__man_iter_reset(&hdr->next_block) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator"); } /* end else */ } /* end if */ else { @@ -1261,7 +1196,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) /* Set the current location of the iterator to next entry after the existing direct block */ if (H5HF__man_iter_set_entry(hdr, &hdr->next_block, curr_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "unable to set current block iterator location") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "unable to set current block iterator location"); /* Update iterator offset */ hdr->man_iter_off = iblock->block_off; @@ -1284,16 +1219,16 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) child_nrows, iblock, curr_entry, FALSE, H5AC__NO_FLAGS_SET, &did_protect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, - "unable to protect fractal heap indirect block") + "unable to protect fractal heap indirect block"); /* Set the current location of the iterator */ if (H5HF__man_iter_set_entry(hdr, &hdr->next_block, curr_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "unable to set current block iterator location") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "unable to set current block iterator location"); /* Walk down into child indirect block (pins child block) */ if (H5HF__man_iter_down(&hdr->next_block, child_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, - "unable to advance current block iterator location") + "unable to advance current block iterator location"); /* Update iterator location */ iblock = child_iblock; @@ -1302,7 +1237,7 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) /* Unprotect child indirect block */ if (H5HF__man_iblock_unprotect(child_iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, - "unable to release fractal heap indirect block") + "unable to release fractal heap indirect block"); /* Note that we walked down */ walked_down = TRUE; @@ -1321,9 +1256,6 @@ H5HF__hdr_reverse_iter(H5HF_hdr_t *hdr, haddr_t dblock_addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 17 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1334,12 +1266,12 @@ H5HF__hdr_empty(H5HF_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); + assert(hdr); /* Reset block iterator, if necessary */ if (H5HF__man_iter_ready(&hdr->next_block)) if (H5HF__man_iter_reset(&hdr->next_block) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator"); /* Shrink managed heap size */ hdr->man_size = 0; @@ -1357,7 +1289,7 @@ H5HF__hdr_empty(H5HF_hdr_t *hdr) /* Mark heap header as modified */ if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1370,9 +1302,6 @@ H5HF__hdr_empty(H5HF_hdr_t *hdr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 27 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -1385,16 +1314,16 @@ H5HF__hdr_free(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Free the block size lookup table for the doubling table */ if (H5HF__dtable_dest(&hdr->man_dtable) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap doubling table") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap doubling table"); /* Release any I/O pipeline filter information */ if (hdr->pline.nused) if (H5O_msg_reset(H5O_PLINE_ID, &(hdr->pline)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to reset I/O pipeline message") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to reset I/O pipeline message"); /* Free the shared info itself */ hdr = H5FL_FREE(H5HF_hdr_t, hdr); @@ -1410,9 +1339,6 @@ H5HF__hdr_free(H5HF_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jan 5 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1426,8 +1352,8 @@ H5HF__hdr_delete(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); - HDassert(!hdr->file_rc); + assert(hdr); + assert(!hdr->file_rc); #ifndef NDEBUG { @@ -1435,11 +1361,11 @@ H5HF__hdr_delete(H5HF_hdr_t *hdr) /* Check the heap header's status in the metadata cache */ if (H5AC_get_entry_status(hdr->f, hdr->heap_addr, &hdr_status) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for heap header"); /* Sanity checks on heap header */ - HDassert(hdr_status & H5AC_ES__IN_CACHE); - HDassert(hdr_status & H5AC_ES__IS_PROTECTED); + assert(hdr_status & H5AC_ES__IN_CACHE); + assert(hdr_status & H5AC_ES__IS_PROTECTED); } /* end block */ #endif /* NDEBUG */ @@ -1447,13 +1373,13 @@ H5HF__hdr_delete(H5HF_hdr_t *hdr) /* (must occur before attempting to delete the heap, so indirect blocks * will get unpinned) */ - if (H5F_addr_defined(hdr->fs_addr)) + if (H5_addr_defined(hdr->fs_addr)) /* Delete free space manager for heap */ if (H5HF__space_delete(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap free space manager") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap free space manager"); /* Check for root direct/indirect block */ - if (H5F_addr_defined(hdr->man_dtable.table_addr)) { + if (H5_addr_defined(hdr->man_dtable.table_addr)) { if (hdr->man_dtable.curr_root_rows == 0) { hsize_t dblock_size; /* Size of direct block on disk */ @@ -1471,23 +1397,23 @@ H5HF__hdr_delete(H5HF_hdr_t *hdr) /* Delete root direct block */ if (H5HF__man_dblock_delete(hdr->f, hdr->man_dtable.table_addr, dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap root direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap root direct block"); } /* end if */ else { /* Delete root indirect block */ if (H5HF__man_iblock_delete(hdr, hdr->man_dtable.table_addr, hdr->man_dtable.curr_root_rows, NULL, 0) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, - "unable to release fractal heap root indirect block") + "unable to release fractal heap root indirect block"); } /* end else */ } /* end if */ /* Check for 'huge' objects in heap */ - if (H5F_addr_defined(hdr->huge_bt2_addr)) { + if (H5_addr_defined(hdr->huge_bt2_addr)) { /* Delete huge objects in heap and their tracker */ if (H5HF__huge_delete(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, - "unable to release fractal heap 'huge' objects and tracker") + "unable to release fractal heap 'huge' objects and tracker"); } /* end if */ /* Indicate that the heap header should be deleted & file space freed */ @@ -1496,7 +1422,7 @@ H5HF__hdr_delete(H5HF_hdr_t *hdr) done: /* Unprotect the header with appropriate flags */ if (H5AC_unprotect(hdr->f, H5AC_FHEAP_HDR, hdr->heap_addr, hdr, cache_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap header") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__hdr_delete() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFhuge.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFhuge.c index cfa7330134..ddf56840b6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFhuge.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFhuge.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFhuge.c - * Aug 7 2006 - * Quincey Koziol * * Purpose: Routines for "huge" objects in fractal heap * @@ -85,9 +82,6 @@ static herr_t H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 7 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -101,7 +95,7 @@ H5HF__huge_bt2_create(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Compute the size of 'raw' records on disk */ /* (Note: the size for huge IDs could be set to 'huge_id_size', instead @@ -148,12 +142,13 @@ H5HF__huge_bt2_create(H5HF_hdr_t *hdr) /* Create v2 B-tree for tracking 'huge' objects */ if (NULL == (hdr->huge_bt2 = H5B2_create(hdr->f, &bt2_cparam, hdr->f))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking 'huge' heap objects") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, + "can't create v2 B-tree for tracking 'huge' heap objects"); /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(hdr->huge_bt2, &hdr->huge_bt2_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "can't get v2 B-tree address for tracking 'huge' heap objects") + "can't get v2 B-tree address for tracking 'huge' heap objects"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -166,9 +161,6 @@ H5HF__huge_bt2_create(H5HF_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 7 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -179,7 +171,7 @@ H5HF__huge_init(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Compute information about 'huge' objects for the heap */ @@ -235,9 +227,6 @@ H5HF__huge_init(H5HF_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 15 2006 - * *------------------------------------------------------------------------- */ static hsize_t @@ -251,12 +240,12 @@ H5HF__huge_new_id(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Check for wrapping around 'huge' object ID space */ if (hdr->huge_ids_wrapped) /* Fail for now - eventually should iterate through v2 B-tree, looking for available ID */ - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, 0, "wrapping 'huge' object IDs not supported yet") + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, 0, "wrapping 'huge' object IDs not supported yet"); else { /* Get new 'huge' object ID to use for object */ /* (avoids using ID 0) */ @@ -281,9 +270,6 @@ H5HF__huge_new_id(H5HF_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 7 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -301,17 +287,17 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) /* * Check arguments. */ - HDassert(hdr); - HDassert(obj_size > hdr->max_man_size); - HDassert(obj); - HDassert(id); + assert(hdr); + assert(obj_size > hdr->max_man_size); + assert(obj); + assert(id); /* Check if the v2 B-tree for tracking 'huge' heap objects has been created yet */ - if (!H5F_addr_defined(hdr->huge_bt2_addr)) { + if (!H5_addr_defined(hdr->huge_bt2_addr)) { /* Go create (& open) v2 B-tree */ if (H5HF__huge_bt2_create(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, - "can't create v2 B-tree for tracking 'huge' heap objects") + "can't create v2 B-tree for tracking 'huge' heap objects"); } /* end if */ else { /* Check if v2 B-tree is open yet */ @@ -319,10 +305,10 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) /* Open existing v2 B-tree */ if (NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for tracking 'huge' heap objects") + "unable to open v2 B-tree for tracking 'huge' heap objects"); } /* end if */ } /* end else */ - HDassert(hdr->huge_bt2); + assert(hdr->huge_bt2); /* Check for I/O pipeline filter on heap */ if (hdr->filter_len > 0) { @@ -336,14 +322,14 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) /* Allocate buffer to perform I/O filtering on */ write_size = obj_size; if (NULL == (write_buf = H5MM_malloc(write_size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer"); H5MM_memcpy(write_buf, obj, write_size); /* Push direct block data through I/O filter pipeline */ nbytes = write_size; if (H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &write_size, &write_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, FAIL, "output pipeline failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, FAIL, "output pipeline failed"); /* Update size of object on disk */ write_size = nbytes; @@ -355,15 +341,15 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) /* Allocate space in the file for storing the 'huge' object */ if (HADDR_UNDEF == (obj_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, (hsize_t)write_size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap huge object") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap huge object"); /* Write the object's data to disk */ if (H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, write_size, write_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "writing 'huge' object to file failed") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "writing 'huge' object to file failed"); /* Release buffer for writing, if we had one */ if (write_buf != obj) { - HDassert(hdr->filter_len > 0); + assert(hdr->filter_len > 0); H5MM_xfree(write_buf); } /* end if */ @@ -381,7 +367,7 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) /* Insert record for object in v2 B-tree */ if (H5B2_insert(hdr->huge_bt2, &obj_rec) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, - "couldn't insert object tracking record in v2 B-tree") + "couldn't insert object tracking record in v2 B-tree"); /* Encode ID for user */ *id++ = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_HUGE; @@ -400,7 +386,7 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) /* Insert record for object in v2 B-tree */ if (H5B2_insert(hdr->huge_bt2, &obj_rec) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, - "couldn't insert object tracking record in v2 B-tree") + "couldn't insert object tracking record in v2 B-tree"); /* Encode ID for user */ *id++ = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_HUGE; @@ -416,7 +402,7 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) /* Get new ID for object */ if (0 == (new_id = H5HF__huge_new_id(hdr))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't generate new ID for object") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't generate new ID for object"); if (hdr->filter_len > 0) { /* Initialize record for object in v2 B-tree */ @@ -441,11 +427,12 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) /* Insert record for tracking object in v2 B-tree */ if (H5B2_insert(hdr->huge_bt2, ins_rec) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, + "couldn't insert object tracking record in v2 B-tree"); /* Encode ID for user */ *id++ = H5HF_ID_VERS_CURR | H5HF_ID_TYPE_HUGE; - UINT64ENCODE_VAR(id, new_id, hdr->huge_id_size) + UINT64ENCODE_VAR(id, new_id, hdr->huge_id_size); } /* end else */ /* Update statistics about heap */ @@ -454,7 +441,7 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) /* Mark heap header as modified */ if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -467,9 +454,6 @@ H5HF__huge_insert(H5HF_hdr_t *hdr, size_t obj_size, void *obj, void *_id) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 8 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -482,10 +466,10 @@ H5HF__huge_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) /* * Check arguments. */ - HDassert(hdr); - HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); - HDassert(id); - HDassert(obj_len_p); + assert(hdr); + assert(H5_addr_defined(hdr->huge_bt2_addr)); + assert(id); + assert(obj_len_p); /* Skip over the flag byte */ id++; @@ -515,7 +499,7 @@ H5HF__huge_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) /* Open existing v2 B-tree */ if (NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for tracking 'huge' heap objects") + "unable to open v2 B-tree for tracking 'huge' heap objects"); } /* end if */ if (hdr->filter_len > 0) { @@ -523,14 +507,14 @@ H5HF__huge_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) H5HF_huge_bt2_filt_indir_rec_t search_rec; /* Record for searching for object */ /* Get ID for looking up 'huge' object in v2 B-tree */ - UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size); /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, &found, H5HF__huge_bt2_filt_indir_found, &found_rec) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree"); if (!found) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree"); /* Retrieve the object's length */ *obj_len_p = (size_t)found_rec.obj_size; @@ -540,13 +524,13 @@ H5HF__huge_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) H5HF_huge_bt2_indir_rec_t search_rec; /* Record for searching for object */ /* Get ID for looking up 'huge' object in v2 B-tree */ - UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size); /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, &found, H5HF__huge_bt2_indir_found, &found_rec) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree"); if (!found) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree"); /* Retrieve the object's length */ *obj_len_p = (size_t)found_rec.len; @@ -564,9 +548,6 @@ H5HF__huge_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 8 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -580,10 +561,10 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p) /* * Check arguments. */ - HDassert(hdr); - HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); - HDassert(id); - HDassert(obj_off_p); + assert(hdr); + assert(H5_addr_defined(hdr->huge_bt2_addr)); + assert(id); + assert(obj_off_p); /* Skip over the flag byte */ id++; @@ -597,14 +578,14 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p) hbool_t found = FALSE; /* Whether entry was found */ /* Sanity check */ - HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); + assert(H5_addr_defined(hdr->huge_bt2_addr)); /* Check if v2 B-tree is open yet */ if (NULL == hdr->huge_bt2) { /* Open existing v2 B-tree */ if (NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for tracking 'huge' heap objects") + "unable to open v2 B-tree for tracking 'huge' heap objects"); } /* end if */ if (hdr->filter_len > 0) { @@ -612,14 +593,14 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p) H5HF_huge_bt2_filt_indir_rec_t search_rec; /* Record for searching for object */ /* Get ID for looking up 'huge' object in v2 B-tree */ - UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size); /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, &found, H5HF__huge_bt2_filt_indir_found, &found_rec) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree"); if (!found) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree"); /* Retrieve the object's address & length */ obj_addr = found_rec.addr; @@ -629,13 +610,13 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p) H5HF_huge_bt2_indir_rec_t search_rec; /* Record for searching for object */ /* Get ID for looking up 'huge' object in v2 B-tree */ - UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size); /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, &found, H5HF__huge_bt2_indir_found, &found_rec) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree"); if (!found) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree"); /* Retrieve the object's address & length */ obj_addr = found_rec.addr; @@ -656,9 +637,6 @@ H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 8 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -675,9 +653,9 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(is_read || op); + assert(hdr); + assert(id); + assert(is_read || op); /* Skip over the flag byte */ id++; @@ -696,14 +674,14 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope hbool_t found = FALSE; /* Whether entry was found */ /* Sanity check */ - HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); + assert(H5_addr_defined(hdr->huge_bt2_addr)); /* Check if v2 B-tree is open yet */ if (NULL == hdr->huge_bt2) { /* Open existing v2 B-tree */ if (NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for tracking 'huge' heap objects") + "unable to open v2 B-tree for tracking 'huge' heap objects"); } /* end if */ if (hdr->filter_len > 0) { @@ -711,14 +689,14 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope H5HF_huge_bt2_filt_indir_rec_t search_rec; /* Record for searching for object */ /* Get ID for looking up 'huge' object in v2 B-tree */ - UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size); /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, &found, H5HF__huge_bt2_filt_indir_found, &found_rec) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree"); if (!found) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree"); /* Retrieve the object's address & length */ obj_addr = found_rec.addr; @@ -730,13 +708,13 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope H5HF_huge_bt2_indir_rec_t search_rec; /* Record for searching for object */ /* Get ID for looking up 'huge' object in v2 B-tree */ - UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size); /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, &found, H5HF__huge_bt2_indir_found, &found_rec) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree"); if (!found) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree"); /* Retrieve the object's address & length */ obj_addr = found_rec.addr; @@ -747,7 +725,7 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope /* Set up buffer for reading */ if (hdr->filter_len > 0 || !is_read) { if (NULL == (read_buf = H5MM_malloc((size_t)obj_size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer"); } /* end if */ else read_buf = op_data; @@ -755,7 +733,7 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope /* Read the object's (possibly filtered) data from the file */ /* (reads directly into application's buffer if no filters are present) */ if (H5F_block_read(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, (size_t)obj_size, read_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_READERROR, FAIL, "can't read 'huge' object's data from the file") + HGOTO_ERROR(H5E_HEAP, H5E_READERROR, FAIL, "can't read 'huge' object's data from the file"); /* Check for I/O pipeline filter on heap */ if (hdr->filter_len > 0) { @@ -771,7 +749,7 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope read_size = nbytes = obj_size; if (H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_NO_EDC, filter_cb, &nbytes, &read_size, &read_buf) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, FAIL, "input filter failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, FAIL, "input filter failed"); obj_size = nbytes; } /* end if */ @@ -789,7 +767,7 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope read_buf = H5MM_xfree(read_buf); /* Indicate error */ - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "application's callback failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "application's callback failed"); } /* end if */ } /* end if */ @@ -802,41 +780,36 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, H5HF_ope } /* end H5HF__huge_op_real() */ /*------------------------------------------------------------------------- - * Function: H5HF__huge_write - * - * Purpose: Write a 'huge' object to the heap + * Function: H5HF__huge_write * - * Note: This implementation somewhat limited: it doesn't handle - * heaps with filters, which would require re-compressing the - * huge object and probably changing the address of the object - * on disk (and possibly the heap ID for "direct" huge IDs). + * Purpose: Write a 'huge' object to the heap * - * Return: SUCCEED/FAIL + * Note: This implementation somewhat limited: it doesn't handle + * heaps with filters, which would require re-compressing the + * huge object and probably changing the address of the object + * on disk (and possibly the heap ID for "direct" huge IDs). * - * Programmer: Quincey Koziol - * Feb 21 2007 + * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ herr_t H5HF__huge_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj) { - haddr_t obj_addr; /* Object's address in the file */ - size_t obj_size; /* Object's size in the file */ - herr_t ret_value = SUCCEED; /* Return value */ + haddr_t obj_addr = HADDR_UNDEF; /* Object's address in the file */ + size_t obj_size = 0; /* Object's size in the file */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ - HDassert(hdr); - HDassert(id); - HDassert(obj); + assert(hdr); + assert(id); + assert(obj); /* Check for filters on the heap */ if (hdr->filter_len > 0) - HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "modifying 'huge' object with filters not supported yet") + HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, + "modifying 'huge' object with filters not supported yet"); /* Skip over the flag byte */ id++; @@ -846,41 +819,41 @@ H5HF__huge_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj) /* Retrieve the object's address and length (common) */ H5F_addr_decode(hdr->f, &id, &obj_addr); H5F_DECODE_LENGTH(hdr->f, id, obj_size); - } /* end if */ + } else { H5HF_huge_bt2_indir_rec_t found_rec; /* Record found from tracking object */ H5HF_huge_bt2_indir_rec_t search_rec; /* Record for searching for object */ hbool_t found = FALSE; /* Whether entry was found */ /* Sanity check */ - HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); + assert(H5_addr_defined(hdr->huge_bt2_addr)); /* Check if v2 B-tree is open yet */ if (NULL == hdr->huge_bt2) { /* Open existing v2 B-tree */ if (NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for tracking 'huge' heap objects") - } /* end if */ + "unable to open v2 B-tree for tracking 'huge' heap objects"); + } /* Get ID for looking up 'huge' object in v2 B-tree */ - UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size); /* Look up object in v2 B-tree */ if (H5B2_find(hdr->huge_bt2, &search_rec, &found, H5HF__huge_bt2_indir_found, &found_rec) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFIND, FAIL, "can't check for object in v2 B-tree"); if (!found) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree"); /* Retrieve the object's address & length */ obj_addr = found_rec.addr; H5_CHECKED_ASSIGN(obj_size, size_t, found_rec.len, hsize_t); - } /* end else */ + } /* Write the object's data to the file */ /* (writes directly from application's buffer) */ if (H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, obj_size, obj) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "writing 'huge' object to file failed") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "writing 'huge' object to file failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -893,9 +866,6 @@ H5HF__huge_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sept 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -908,13 +878,13 @@ H5HF__huge_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(obj); + assert(hdr); + assert(id); + assert(obj); /* Call the internal 'op' routine */ if (H5HF__huge_op_real(hdr, id, TRUE, NULL, obj) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -927,9 +897,6 @@ H5HF__huge_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sept 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -942,13 +909,13 @@ H5HF__huge_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_d /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(op); + assert(hdr); + assert(id); + assert(op); /* Call the internal 'op' routine routine */ if (H5HF__huge_op_real(hdr, id, FALSE, op, op_data) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -961,9 +928,6 @@ H5HF__huge_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_d * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 8 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -977,16 +941,16 @@ H5HF__huge_remove(H5HF_hdr_t *hdr, const uint8_t *id) /* * Check arguments. */ - HDassert(hdr); - HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); - HDassert(id); + assert(hdr); + assert(H5_addr_defined(hdr->huge_bt2_addr)); + assert(id); /* Check if v2 B-tree is open yet */ if (NULL == hdr->huge_bt2) { /* Open existing v2 B-tree */ if (NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for tracking 'huge' heap objects") + "unable to open v2 B-tree for tracking 'huge' heap objects"); } /* end if */ /* Skip over the flag byte */ @@ -1008,7 +972,7 @@ H5HF__huge_remove(H5HF_hdr_t *hdr, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ if (H5B2_remove(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_filt_dir_remove, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree"); } /* end if */ else { H5HF_huge_bt2_dir_rec_t search_rec; /* Record for searching for object */ @@ -1021,7 +985,7 @@ H5HF__huge_remove(H5HF_hdr_t *hdr, const uint8_t *id) /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ if (H5B2_remove(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_dir_remove, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree"); } /* end else */ } /* end if */ else { @@ -1029,23 +993,23 @@ H5HF__huge_remove(H5HF_hdr_t *hdr, const uint8_t *id) H5HF_huge_bt2_filt_indir_rec_t search_rec; /* Record for searching for object */ /* Get ID for looking up 'huge' object in v2 B-tree */ - UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size); /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ if (H5B2_remove(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_filt_indir_remove, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree"); } /* end if */ else { H5HF_huge_bt2_indir_rec_t search_rec; /* Record for searching for object */ /* Get ID for looking up 'huge' object in v2 B-tree */ - UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size) + UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size); /* Remove the record for tracking the 'huge' object from the v2 B-tree */ /* (space in the file for the object is freed in the 'remove' callback) */ if (H5B2_remove(hdr->huge_bt2, &search_rec, H5HF__huge_bt2_indir_remove, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree"); } /* end else */ } /* end else */ @@ -1055,7 +1019,7 @@ H5HF__huge_remove(H5HF_hdr_t *hdr, const uint8_t *id) /* Mark heap header as modified */ if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1068,9 +1032,6 @@ H5HF__huge_remove(H5HF_hdr_t *hdr, const uint8_t *id) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 8 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1083,30 +1044,30 @@ H5HF__huge_term(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Check if v2 B-tree index is open */ if (hdr->huge_bt2) { /* Sanity check */ - HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); + assert(H5_addr_defined(hdr->huge_bt2_addr)); /* Close v2 B-tree index */ if (H5B2_close(hdr->huge_bt2) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree"); hdr->huge_bt2 = NULL; } /* end if */ /* Check if there are no more 'huge' objects in the heap and delete the * v2 B-tree that tracks them, if so */ - if (H5F_addr_defined(hdr->huge_bt2_addr) && hdr->huge_nobjs == 0) { + if (H5_addr_defined(hdr->huge_bt2_addr) && hdr->huge_nobjs == 0) { /* Sanity check */ - HDassert(hdr->huge_size == 0); + assert(hdr->huge_size == 0); /* Delete the v2 B-tree */ /* (any v2 B-tree class will work here) */ if (H5B2_delete(hdr->f, hdr->huge_bt2_addr, hdr->f, NULL, NULL) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree"); /* Reset the information about 'huge' objects in the file */ hdr->huge_bt2_addr = HADDR_UNDEF; @@ -1115,7 +1076,7 @@ H5HF__huge_term(H5HF_hdr_t *hdr) /* Mark heap header as modified */ if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); } /* end if */ done: @@ -1130,9 +1091,6 @@ H5HF__huge_term(H5HF_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 8 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1147,10 +1105,10 @@ H5HF__huge_delete(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); - HDassert(H5F_addr_defined(hdr->huge_bt2_addr)); - HDassert(hdr->huge_nobjs); - HDassert(hdr->huge_size); + assert(hdr); + assert(H5_addr_defined(hdr->huge_bt2_addr)); + assert(hdr->huge_nobjs); + assert(hdr->huge_size); /* Set up the callback info */ udata.hdr = hdr; @@ -1171,7 +1129,7 @@ H5HF__huge_delete(H5HF_hdr_t *hdr) /* Delete the v2 B-tree */ if (H5B2_delete(hdr->f, hdr->huge_bt2_addr, hdr->f, op, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFiblock.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFiblock.c index afbfb14b24..db9901f6db 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFiblock.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFiblock.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFiblock.c - * Apr 10 2006 - * Quincey Koziol * * Purpose: Indirect block routines for fractal heaps. * @@ -89,9 +86,6 @@ H5FL_SEQ_DEFINE(H5HF_indirect_ptr_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 17 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -102,11 +96,11 @@ H5HF__iblock_pin(H5HF_indirect_t *iblock) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(iblock); + assert(iblock); /* Mark block as un-evictable */ if (H5AC_pin_protected_entry(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap indirect block"); /* If this indirect block has a parent, update it's child iblock pointer */ if (iblock->parent) { @@ -114,27 +108,27 @@ H5HF__iblock_pin(H5HF_indirect_t *iblock) unsigned indir_idx; /* Index in parent's child iblock pointer array */ /* Sanity check */ - HDassert(par_iblock->child_iblocks); - HDassert(iblock->par_entry >= - (iblock->hdr->man_dtable.max_direct_rows * iblock->hdr->man_dtable.cparam.width)); + assert(par_iblock->child_iblocks); + assert(iblock->par_entry >= + (iblock->hdr->man_dtable.max_direct_rows * iblock->hdr->man_dtable.cparam.width)); /* Compute index in parent's child iblock pointer array */ indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows * iblock->hdr->man_dtable.cparam.width); /* Set pointer to pinned indirect block in parent */ - HDassert(par_iblock->child_iblocks[indir_idx] == NULL); + assert(par_iblock->child_iblocks[indir_idx] == NULL); par_iblock->child_iblocks[indir_idx] = iblock; } /* end if */ else { /* Check for pinning the root indirect block */ if (iblock->block_off == 0) { /* Sanity check - shouldn't be recursively pinning root indirect block */ - HDassert(0 == (iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED)); + assert(0 == (iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED)); /* Check if we should set the root iblock pointer */ if (0 == iblock->hdr->root_iblock_flags) { - HDassert(NULL == iblock->hdr->root_iblock); + assert(NULL == iblock->hdr->root_iblock); iblock->hdr->root_iblock = iblock; } /* end if */ @@ -154,9 +148,6 @@ H5HF__iblock_pin(H5HF_indirect_t *iblock) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 17 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -167,11 +158,11 @@ H5HF__iblock_unpin(H5HF_indirect_t *iblock) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(iblock); + assert(iblock); /* Mark block as evictable again */ if (H5AC_unpin_entry(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -184,9 +175,6 @@ H5HF__iblock_unpin(H5HF_indirect_t *iblock) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 27 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -197,13 +185,13 @@ H5HF__iblock_incr(H5HF_indirect_t *iblock) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(iblock); - HDassert(iblock->block_off == 0 || iblock->parent); + assert(iblock); + assert(iblock->block_off == 0 || iblock->parent); /* Mark block as un-evictable when a child block is depending on it */ if (iblock->rc == 0) if (H5HF__iblock_pin(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin fractal heap indirect block"); /* Increment reference count on shared indirect block */ iblock->rc++; @@ -219,9 +207,6 @@ H5HF__iblock_incr(H5HF_indirect_t *iblock) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 27 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -232,7 +217,7 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(iblock); + assert(iblock); /* Decrement reference count on shared indirect block */ iblock->rc--; @@ -246,27 +231,27 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock) unsigned indir_idx; /* Index in parent's child iblock pointer array */ /* Sanity check */ - HDassert(par_iblock->child_iblocks); - HDassert(iblock->par_entry >= - (iblock->hdr->man_dtable.max_direct_rows * iblock->hdr->man_dtable.cparam.width)); + assert(par_iblock->child_iblocks); + assert(iblock->par_entry >= + (iblock->hdr->man_dtable.max_direct_rows * iblock->hdr->man_dtable.cparam.width)); /* Compute index in parent's child iblock pointer array */ indir_idx = iblock->par_entry - (iblock->hdr->man_dtable.max_direct_rows * iblock->hdr->man_dtable.cparam.width); /* Reset pointer to pinned child indirect block in parent */ - HDassert(par_iblock->child_iblocks[indir_idx]); + assert(par_iblock->child_iblocks[indir_idx]); par_iblock->child_iblocks[indir_idx] = NULL; } /* end if */ else { /* Check for root indirect block */ if (iblock->block_off == 0) { /* Sanity check - shouldn't be recursively unpinning root indirect block */ - HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED); + assert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PINNED); /* Check if we should reset the root iblock pointer */ if (H5HF_ROOT_IBLOCK_PINNED == iblock->hdr->root_iblock_flags) { - HDassert(NULL != iblock->hdr->root_iblock); + assert(NULL != iblock->hdr->root_iblock); iblock->hdr->root_iblock = NULL; } /* end if */ @@ -279,12 +264,12 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock) if (!iblock->removed_from_cache) { /* Unpin the indirect block, making it evictable again */ if (H5HF__iblock_unpin(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block"); } /* end if */ else { /* Destroy the indirect block */ if (H5HF__man_iblock_dest(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block"); } /* end else */ } /* end if */ @@ -299,9 +284,6 @@ H5HF__iblock_decr(H5HF_indirect_t *iblock) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 21 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -312,11 +294,11 @@ H5HF__iblock_dirty(H5HF_indirect_t *iblock) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(iblock); + assert(iblock); /* Mark indirect block as dirty in cache */ if (H5AC_mark_entry_dirty(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap indirect block as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark fractal heap indirect block as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -329,9 +311,6 @@ H5HF__iblock_dirty(H5HF_indirect_t *iblock) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 2 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -368,17 +347,17 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Allocate root indirect block */ if (H5HF__man_iblock_create(hdr, NULL, 0, nrows, hdr->man_dtable.max_root_rows, &iblock_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block"); /* Move current direct block (used as root) into new indirect block */ /* Lock new indirect block */ if (NULL == (iblock = H5HF__man_iblock_protect(hdr, iblock_addr, nrows, NULL, 0, FALSE, H5AC__NO_FLAGS_SET, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block"); /* Check if there's already a direct block as root) */ - have_direct_block = H5F_addr_defined(hdr->man_dtable.table_addr); + have_direct_block = H5_addr_defined(hdr->man_dtable.table_addr); if (have_direct_block) { H5HF_direct_t *dblock; /* Pointer to direct block to query */ @@ -386,7 +365,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) if (NULL == (dblock = H5HF__man_dblock_protect(hdr, hdr->man_dtable.table_addr, hdr->man_dtable.cparam.start_block_size, NULL, 0, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block"); /* Attach direct block to new root indirect block */ dblock->parent = iblock; @@ -394,17 +373,17 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Destroy flush dependency between direct block and header */ if (H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); dblock->fd_parent = NULL; /* Create flush dependency between direct block and new root indirect block */ if (H5AC_create_flush_dependency(iblock, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); dblock->fd_parent = iblock; if (H5HF__man_iblock_attach(iblock, 0, hdr->man_dtable.table_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, - "can't attach root direct block to parent indirect block") + "can't attach root direct block to parent indirect block"); /* Check for I/O filters on this heap */ if (hdr->filter_len > 0) { @@ -420,12 +399,12 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Scan free space sections to set any 'parent' pointers to new indirect block */ if (H5HF__space_create_root(hdr, iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, - "can't set free space section info to new root indirect block") + "can't set free space section info to new root indirect block"); /* Unlock first (previously the root) direct block */ if (H5AC_unprotect(hdr->f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block"); dblock = NULL; } /* end if */ @@ -433,22 +412,22 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) if (H5HF__hdr_start_iter(hdr, iblock, (hsize_t)(have_direct_block ? hdr->man_dtable.cparam.start_block_size : 0), have_direct_block) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize block iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize block iterator"); /* Check for skipping over direct blocks, in order to get to large enough block */ if (min_dblock_size > hdr->man_dtable.cparam.start_block_size) /* Add skipped blocks to heap's free space */ if (H5HF__hdr_skip_blocks(hdr, iblock, have_direct_block, ((nrows - 1) * hdr->man_dtable.cparam.width) - have_direct_block) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space"); /* Mark indirect block as modified */ if (H5HF__iblock_dirty(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty"); /* Unprotect root indirect block (it's pinned by the iterator though) */ if (H5HF__man_iblock_unprotect(iblock, H5AC__DIRTIED_FLAG, did_protect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); iblock = NULL; /* Point heap header at new indirect block */ @@ -466,7 +445,7 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Extend heap to cover new root indirect block */ if (H5HF__hdr_adjust_heap(hdr, hdr->man_dtable.row_block_off[nrows], (hssize_t)acc_dblock_free) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -479,9 +458,6 @@ H5HF__man_iblock_root_create(H5HF_hdr_t *hdr, size_t min_dblock_size) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 17 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -506,12 +482,12 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Get "new block" iterator information */ if (H5HF__man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location"); next_size = hdr->man_dtable.row_block_size[next_row]; /* Make certain the iterator is at the root indirect block */ - HDassert(iblock->parent == NULL); - HDassert(iblock->block_off == 0); + assert(iblock->parent == NULL); + assert(iblock->block_off == 0); /* Keep this for later */ old_nrows = iblock->nrows; @@ -519,7 +495,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Check for skipping over direct block rows */ if (iblock->nrows < hdr->man_dtable.max_direct_rows && min_dblock_size > next_size) { /* Sanity check */ - HDassert(min_dblock_size > hdr->man_dtable.cparam.start_block_size); + assert(min_dblock_size > hdr->man_dtable.cparam.start_block_size); /* Set flag */ skip_direct_rows = TRUE; @@ -539,7 +515,8 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) if (!H5F_IS_TMP_ADDR(hdr->f, iblock->addr)) /* Free previous indirect block disk space */ if (H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, iblock->addr, (hsize_t)iblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, + "unable to free fractal heap indirect block file space"); /* Compute size of buffer needed for new indirect block */ iblock->nrows = new_nrows; @@ -549,36 +526,38 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Allocate [temporary] space for the new indirect block on disk */ if (H5F_USE_TMP_SPACE(hdr->f)) { if (HADDR_UNDEF == (new_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, + "file allocation failed for fractal heap indirect block"); } /* end if */ else { if (HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, (hsize_t)iblock->size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, + "file allocation failed for fractal heap indirect block"); } /* end else */ /* Resize pinned indirect block in the cache, if its changed size */ if (old_iblock_size != iblock->size) { if (H5AC_resize_entry(iblock, (size_t)iblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap indirect block"); } /* end if */ /* Move object in cache, if it actually was relocated */ - if (H5F_addr_ne(iblock->addr, new_addr)) { + if (H5_addr_ne(iblock->addr, new_addr)) { if (H5AC_move_entry(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move fractal heap root indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move fractal heap root indirect block"); iblock->addr = new_addr; } /* end if */ /* Re-allocate child block entry array */ if (NULL == (iblock->ents = H5FL_SEQ_REALLOC(H5HF_indirect_ent_t, iblock->ents, (size_t)(iblock->nrows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for direct entries") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for direct entries"); /* Check for skipping over rows and add free section for skipped rows */ if (skip_direct_rows) /* Add skipped blocks to heap's free space */ if (H5HF__hdr_skip_blocks(hdr, iblock, next_entry, (new_next_entry - next_entry)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't add skipped blocks to heap's free space"); /* Initialize new direct block entries in rows added */ acc_dblock_free = 0; @@ -596,12 +575,12 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Compute the number of direct rows for this indirect block */ dir_rows = MIN(iblock->nrows, hdr->man_dtable.max_direct_rows); - HDassert(dir_rows > old_nrows); + assert(dir_rows > old_nrows); /* Re-allocate filtered direct block entry array */ if (NULL == (iblock->filt_ents = H5FL_SEQ_REALLOC(H5HF_indirect_filt_ent_t, iblock->filt_ents, (size_t)(dir_rows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for filtered direct entries") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for filtered direct entries"); /* Initialize new entries allocated */ for (u = (old_nrows * hdr->man_dtable.cparam.width); u < (dir_rows * hdr->man_dtable.cparam.width); @@ -623,7 +602,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) if (NULL == (iblock->child_iblocks = H5FL_SEQ_REALLOC(H5HF_indirect_ptr_t, iblock->child_iblocks, (size_t)(indir_rows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for filtered direct entries") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for filtered direct entries"); /* Compute the previous # of indirect rows in this block */ if (old_nrows < hdr->man_dtable.max_direct_rows) @@ -639,7 +618,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Mark indirect block as dirty */ if (H5HF__iblock_dirty(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty"); /* Update other shared header info */ hdr->man_dtable.curr_root_rows = new_nrows; @@ -648,7 +627,7 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) /* Extend heap to cover new root indirect block */ if (H5HF__hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], (hssize_t)acc_dblock_free) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -661,9 +640,6 @@ H5HF__man_iblock_root_double(H5HF_hdr_t *hdr, size_t min_dblock_size) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jun 12 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -682,9 +658,9 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(iblock); - HDassert(iblock->parent == NULL); - HDassert(hdr); + assert(iblock); + assert(iblock->parent == NULL); + assert(hdr); /* Compute maximum row used by child of indirect block */ max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; @@ -697,7 +673,8 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) if (!H5F_IS_TMP_ADDR(hdr->f, iblock->addr)) /* Free previous indirect block disk space */ if (H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, iblock->addr, (hsize_t)iblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to free fractal heap indirect block file space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, + "unable to free fractal heap indirect block file space"); /* Compute free space in rows to delete */ acc_dblock_free = 0; @@ -713,30 +690,32 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) /* Allocate [temporary] space for the new indirect block on disk */ if (H5F_USE_TMP_SPACE(hdr->f)) { if (HADDR_UNDEF == (new_addr = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, + "file allocation failed for fractal heap indirect block"); } /* end if */ else { if (HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, (hsize_t)iblock->size))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, + "file allocation failed for fractal heap indirect block"); } /* end else */ /* Resize pinned indirect block in the cache, if it has changed size */ if (old_size != iblock->size) { if (H5AC_resize_entry(iblock, (size_t)iblock->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize fractal heap indirect block"); } /* end if */ /* Move object in cache, if it actually was relocated */ - if (H5F_addr_ne(iblock->addr, new_addr)) { + if (H5_addr_ne(iblock->addr, new_addr)) { if (H5AC_move_entry(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSPLIT, FAIL, "unable to move fractal heap root indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSPLIT, FAIL, "unable to move fractal heap root indirect block"); iblock->addr = new_addr; } /* end if */ /* Re-allocate child block entry array */ if (NULL == (iblock->ents = H5FL_SEQ_REALLOC(H5HF_indirect_ent_t, iblock->ents, (size_t)(iblock->nrows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct entries") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for direct entries"); /* Check for needing to re-allocate filtered entry array */ if (hdr->filter_len > 0 && new_nrows < hdr->man_dtable.max_direct_rows) { @@ -744,7 +723,7 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) if (NULL == (iblock->filt_ents = H5FL_SEQ_REALLOC(H5HF_indirect_filt_ent_t, iblock->filt_ents, (size_t)(iblock->nrows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for filtered direct entries") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for filtered direct entries"); } /* end if */ /* Check for needing to re-allocate child iblock pointer array */ @@ -761,7 +740,7 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) H5FL_SEQ_REALLOC(H5HF_indirect_ptr_t, iblock->child_iblocks, (size_t)(indir_rows * hdr->man_dtable.cparam.width)))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, - "memory allocation failed for filtered direct entries") + "memory allocation failed for filtered direct entries"); } /* end if */ else iblock->child_iblocks = @@ -770,7 +749,7 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) /* Mark indirect block as dirty */ if (H5HF__iblock_dirty(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty"); /* Update other shared header info */ hdr->man_dtable.curr_root_rows = new_nrows; @@ -779,7 +758,7 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) /* Shrink heap to only cover new root indirect block */ if (H5HF__hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], -(hssize_t)acc_dblock_free) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce space to cover root direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce space to cover root direct block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -795,9 +774,6 @@ H5HF__man_iblock_root_halve(H5HF_indirect_t *iblock) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 31 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -814,7 +790,7 @@ H5HF__man_iblock_root_revert(H5HF_indirect_t *root_iblock) /* * Check arguments. */ - HDassert(root_iblock); + assert(root_iblock); /* Set up local convenience variables */ hdr = root_iblock->hdr; @@ -824,9 +800,9 @@ H5HF__man_iblock_root_revert(H5HF_indirect_t *root_iblock) /* Get pointer to last direct block */ if (NULL == (dblock = H5HF__man_dblock_protect(hdr, dblock_addr, dblock_size, root_iblock, 0, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block") - HDassert(dblock->parent == root_iblock); - HDassert(dblock->par_entry == 0); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block"); + assert(dblock->parent == root_iblock); + assert(dblock->par_entry == 0); /* Check for I/O filters on this heap */ if (hdr->filter_len > 0) { @@ -837,18 +813,18 @@ H5HF__man_iblock_root_revert(H5HF_indirect_t *root_iblock) /* Destroy flush dependency between old root iblock and new root direct block */ if (H5AC_destroy_flush_dependency(dblock->fd_parent, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); dblock->fd_parent = NULL; /* Detach direct block from parent */ if (H5HF__man_iblock_detach(dblock->parent, 0) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach direct block from parent indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach direct block from parent indirect block"); dblock->parent = NULL; dblock->par_entry = 0; /* Create flush dependency between header and new root direct block */ if (H5AC_create_flush_dependency(hdr, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); dblock->fd_parent = hdr; /* Point root at direct block */ @@ -857,20 +833,20 @@ H5HF__man_iblock_root_revert(H5HF_indirect_t *root_iblock) /* Reset 'next block' iterator */ if (H5HF__hdr_reset_iter(hdr, (hsize_t)dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator"); /* Extend heap to just cover first direct block */ if (H5HF__hdr_adjust_heap(hdr, (hsize_t)hdr->man_dtable.cparam.start_block_size, (hssize_t)hdr->man_dtable.row_tot_dblock_free[0]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block"); /* Scan free space sections to reset any 'parent' pointers */ if (H5HF__space_revert_root(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESET, FAIL, "can't reset free space section info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESET, FAIL, "can't reset free space section info"); done: if (dblock && H5AC_unprotect(hdr->f, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__man_iblock_root_revert() */ @@ -885,9 +861,6 @@ H5HF__man_iblock_root_revert(H5HF_indirect_t *root_iblock) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 6 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -904,9 +877,9 @@ H5HF__man_iblock_alloc_row(H5HF_hdr_t *hdr, H5HF_free_section_t **sec_node) /* * Check arguments. */ - HDassert(hdr); - HDassert(sec_node && old_sec_node); - HDassert(old_sec_node->u.row.row < hdr->man_dtable.max_direct_rows); + assert(hdr); + assert(sec_node && old_sec_node); + assert(old_sec_node->u.row.row < hdr->man_dtable.max_direct_rows); /* Check for serialized row section, or serialized / deleted indirect * section under it. */ @@ -915,24 +888,24 @@ H5HF__man_iblock_alloc_row(H5HF_hdr_t *hdr, H5HF_free_section_t **sec_node) (TRUE == old_sec_node->u.row.under->u.indirect.u.iblock->removed_from_cache)) /* Revive row and / or indirect section */ if (H5HF__sect_row_revive(hdr, old_sec_node) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section"); /* Get a pointer to the indirect block covering the section */ if (NULL == (iblock = H5HF__sect_row_get_iblock(old_sec_node))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve indirect block for row section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve indirect block for row section"); /* Hold indirect block in memory, until direct block can point to it */ if (H5HF__iblock_incr(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block"); iblock_held = TRUE; /* Reduce (& possibly re-add) 'row' section */ if (H5HF__sect_row_reduce(hdr, old_sec_node, &dblock_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce row section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce row section node"); /* Create direct block & single section */ if (H5HF__man_dblock_create(hdr, iblock, dblock_entry, NULL, sec_node) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block"); done: /* Release hold on indirect block */ @@ -951,9 +924,6 @@ H5HF__man_iblock_alloc_row(H5HF_hdr_t *hdr, H5HF_free_section_t **sec_node) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Mar 6 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -969,24 +939,24 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p /* * Check arguments. */ - HDassert(hdr); - HDassert(nrows > 0); - HDassert(addr_p); + assert(hdr); + assert(nrows > 0); + assert(addr_p); /* * Allocate file and memory data structures. */ if (NULL == (iblock = H5FL_MALLOC(H5HF_indirect_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for fractal heap indirect block") + "memory allocation failed for fractal heap indirect block"); /* Reset the metadata cache info for the heap header */ - HDmemset(&iblock->cache_info, 0, sizeof(H5AC_info_t)); + memset(&iblock->cache_info, 0, sizeof(H5AC_info_t)); /* Share common heap information */ iblock->hdr = hdr; if (H5HF__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header"); /* Set info for indirect block */ iblock->rc = 0; @@ -1000,7 +970,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p /* Allocate child block entry array */ if (NULL == (iblock->ents = H5FL_SEQ_MALLOC(H5HF_indirect_ent_t, (size_t)(iblock->nrows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for block entries") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for block entries"); /* Initialize indirect block entry tables */ for (u = 0; u < (iblock->nrows * hdr->man_dtable.cparam.width); u++) @@ -1016,7 +986,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p /* Allocate & initialize indirect block filtered entry array */ if (NULL == (iblock->filt_ents = H5FL_SEQ_CALLOC(H5HF_indirect_filt_ent_t, (size_t)(dir_rows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for block entries") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for block entries"); } /* end if */ else iblock->filt_ents = NULL; @@ -1031,7 +1001,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p /* Allocate & initialize child indirect block pointer array */ if (NULL == (iblock->child_iblocks = H5FL_SEQ_CALLOC( H5HF_indirect_ptr_t, (size_t)(indir_rows * hdr->man_dtable.cparam.width)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for block entries") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for block entries"); } /* end if */ else iblock->child_iblocks = NULL; @@ -1040,12 +1010,12 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p if (H5F_USE_TMP_SPACE(hdr->f)) { if (HADDR_UNDEF == (*addr_p = H5MF_alloc_tmp(hdr->f, (hsize_t)iblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "file allocation failed for fractal heap indirect block") + "file allocation failed for fractal heap indirect block"); } /* end if */ else { if (HADDR_UNDEF == (*addr_p = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, (hsize_t)iblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "file allocation failed for fractal heap indirect block") + "file allocation failed for fractal heap indirect block"); } /* end else */ iblock->addr = *addr_p; @@ -1056,7 +1026,7 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p /* Attach new block to parent */ if (H5HF__man_iblock_attach(iblock->parent, par_entry, *addr_p) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, - "can't attach indirect block to parent indirect block") + "can't attach indirect block to parent indirect block"); /* Compute the indirect block's offset in the heap's address space */ /* (based on parent's block offset) */ @@ -1081,13 +1051,13 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p /* Cache the new indirect block */ if (H5AC_insert_entry(hdr->f, H5AC_FHEAP_IBLOCK, *addr_p, iblock, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap indirect block to cache") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add fractal heap indirect block to cache"); done: if (ret_value < 0) if (iblock) if (H5HF__man_iblock_dest(iblock) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy fractal heap indirect block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__man_iblock_create() */ @@ -1099,9 +1069,6 @@ H5HF__man_iblock_create(H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblock, unsigned p * * Return: Pointer to indirect block on success, NULL on failure * - * Programmer: Quincey Koziol - * Apr 17 2006 - * *------------------------------------------------------------------------- */ H5HF_indirect_t * @@ -1119,13 +1086,13 @@ H5HF__man_iblock_protect(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_n /* * Check arguments. */ - HDassert(hdr); - HDassert(H5F_addr_defined(iblock_addr)); - HDassert(iblock_nrows > 0); - HDassert(did_protect); + assert(hdr); + assert(H5_addr_defined(iblock_addr)); + assert(iblock_nrows > 0); + assert(did_protect); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Check if we are allowed to use existing pinned iblock pointer */ if (!must_protect) { @@ -1134,8 +1101,8 @@ H5HF__man_iblock_protect(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_n unsigned indir_idx; /* Index in parent's child iblock pointer array */ /* Sanity check */ - HDassert(par_iblock->child_iblocks); - HDassert(par_entry >= (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width)); + assert(par_iblock->child_iblocks); + assert(par_entry >= (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width)); /* Compute index in parent's child iblock pointer array */ indir_idx = par_entry - (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width); @@ -1148,18 +1115,18 @@ H5HF__man_iblock_protect(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_n } /* end if */ else { /* Check for root indirect block */ - if (H5F_addr_eq(iblock_addr, hdr->man_dtable.table_addr)) { + if (H5_addr_eq(iblock_addr, hdr->man_dtable.table_addr)) { /* Check for valid pointer to pinned indirect block in root */ if (H5HF_ROOT_IBLOCK_PINNED == hdr->root_iblock_flags) { /* Sanity check */ - HDassert(NULL != hdr->root_iblock); + assert(NULL != hdr->root_iblock); /* Return the pointer to the pinned root indirect block */ iblock = hdr->root_iblock; } /* end if */ else { /* Sanity check */ - HDassert(NULL == hdr->root_iblock); + assert(NULL == hdr->root_iblock); should_protect = TRUE; } /* end else */ @@ -1186,7 +1153,7 @@ H5HF__man_iblock_protect(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_n /* Protect the indirect block */ if (NULL == (iblock = (H5HF_indirect_t *)H5AC_protect(hdr->f, H5AC_FHEAP_IBLOCK, iblock_addr, &cache_udata, flags))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect fractal heap indirect block"); /* Set the indirect block's address */ iblock->addr = iblock_addr; @@ -1194,11 +1161,11 @@ H5HF__man_iblock_protect(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_n /* Check for root indirect block */ if (iblock->block_off == 0) { /* Sanity check - shouldn't be recursively protecting root indirect block */ - HDassert(0 == (hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PROTECTED)); + assert(0 == (hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PROTECTED)); /* Check if we should set the root iblock pointer */ if (0 == hdr->root_iblock_flags) { - HDassert(NULL == hdr->root_iblock); + assert(NULL == hdr->root_iblock); hdr->root_iblock = iblock; } /* end if */ @@ -1227,9 +1194,6 @@ H5HF__man_iblock_protect(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_n * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 17 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1242,7 +1206,7 @@ H5HF__man_iblock_unprotect(H5HF_indirect_t *iblock, unsigned cache_flags, hbool_ /* * Check arguments. */ - HDassert(iblock); + assert(iblock); /* Check if we previously protected this indirect block */ /* (as opposed to using an existing pointer to a pinned child indirect block) */ @@ -1250,11 +1214,11 @@ H5HF__man_iblock_unprotect(H5HF_indirect_t *iblock, unsigned cache_flags, hbool_ /* Check for root indirect block */ if (iblock->block_off == 0) { /* Sanity check - shouldn't be recursively unprotecting root indirect block */ - HDassert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PROTECTED); + assert(iblock->hdr->root_iblock_flags & H5HF_ROOT_IBLOCK_PROTECTED); /* Check if we should reset the root iblock pointer */ if (H5HF_ROOT_IBLOCK_PROTECTED == iblock->hdr->root_iblock_flags) { - HDassert(NULL != iblock->hdr->root_iblock); + assert(NULL != iblock->hdr->root_iblock); iblock->hdr->root_iblock = NULL; } /* end if */ @@ -1264,7 +1228,7 @@ H5HF__man_iblock_unprotect(H5HF_indirect_t *iblock, unsigned cache_flags, hbool_ /* Unprotect the indirect block */ if (H5AC_unprotect(iblock->hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, iblock, cache_flags) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); } /* end if */ done: @@ -1278,9 +1242,6 @@ H5HF__man_iblock_unprotect(H5HF_indirect_t *iblock, unsigned cache_flags, hbool_ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 30 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1293,13 +1254,13 @@ H5HF__man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_a /* * Check arguments. */ - HDassert(iblock); - HDassert(H5F_addr_defined(child_addr)); - HDassert(!H5F_addr_defined(iblock->ents[entry].addr)); + assert(iblock); + assert(H5_addr_defined(child_addr)); + assert(!H5_addr_defined(iblock->ents[entry].addr)); /* Increment the reference count on this indirect block */ if (H5HF__iblock_incr(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block"); /* Point at the child block */ iblock->ents[entry].addr = child_addr; @@ -1309,7 +1270,7 @@ H5HF__man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_a unsigned row; /* Row for entry */ /* Sanity check */ - HDassert(iblock->filt_ents); + assert(iblock->filt_ents); /* Compute row for entry */ row = entry / iblock->hdr->man_dtable.cparam.width; @@ -1328,7 +1289,7 @@ H5HF__man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_a /* Mark indirect block as modified */ if (H5HF__iblock_dirty(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1341,9 +1302,6 @@ H5HF__man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_a * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 31 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1359,8 +1317,8 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) /* * Check arguments. */ - HDassert(iblock); - HDassert(iblock->nchildren); + assert(iblock); + assert(iblock->nchildren); /* Set up convenience variables */ hdr = iblock->hdr; @@ -1374,7 +1332,7 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) /* Check for I/O filters on this heap */ if (hdr->filter_len > 0) { /* Sanity check */ - HDassert(iblock->filt_ents); + assert(iblock->filt_ents); /* If this is a direct block, reset its initial size */ if (row < hdr->man_dtable.max_direct_rows) { @@ -1388,13 +1346,13 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) unsigned indir_idx; /* Index in parent's child iblock pointer array */ /* Sanity check */ - HDassert(iblock->child_iblocks); + assert(iblock->child_iblocks); /* Compute index in child iblock pointer array */ indir_idx = entry - (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width); /* Sanity check */ - HDassert(iblock->child_iblocks[indir_idx]); + assert(iblock->child_iblocks[indir_idx]); /* Reset pointer to child indirect block in parent */ iblock->child_iblocks[indir_idx] = NULL; @@ -1410,7 +1368,7 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) /* Reduce the max. entry used, if necessary */ if (entry == iblock->max_child) { if (iblock->nchildren > 0) - while (!H5F_addr_defined(iblock->ents[iblock->max_child].addr)) + while (!H5_addr_defined(iblock->ents[iblock->max_child].addr)) iblock->max_child--; else iblock->max_child = 0; @@ -1422,10 +1380,10 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) * direct block in the heap, convert the heap back to using a root * direct block */ - if (iblock->nchildren == 1 && H5F_addr_defined(iblock->ents[0].addr)) + if (iblock->nchildren == 1 && H5_addr_defined(iblock->ents[0].addr)) if (H5HF__man_iblock_root_revert(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, - "can't convert root indirect block back to root direct block") + "can't convert root indirect block back to root direct block"); /* If the indirect block wasn't removed already (by reverting it) */ if (!iblock->removed_from_cache) { @@ -1441,7 +1399,7 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) if (iblock->nrows > 1 && max_child_row <= (iblock->nrows / 2)) if (H5HF__man_iblock_root_halve(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, - "can't reduce size of root indirect block") + "can't reduce size of root indirect block"); } /* end if */ } /* end if */ } /* end if */ @@ -1450,7 +1408,7 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) if (!iblock->removed_from_cache) { /* Mark indirect block as modified */ if (H5HF__iblock_dirty(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark indirect block as dirty"); /* Check for last child being removed from indirect block */ if (iblock->nchildren == 0) { @@ -1470,25 +1428,25 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) if (NULL == (del_iblock = H5HF__man_iblock_protect(hdr, iblock->addr, iblock->nrows, iblock->parent, iblock->par_entry, TRUE, H5AC__NO_FLAGS_SET, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") - HDassert(did_protect == TRUE); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block"); + assert(did_protect == TRUE); /* Check for deleting root indirect block (and no root direct block) */ if (iblock->block_off == 0 && hdr->man_dtable.curr_root_rows > 0) /* Reset header information back to "empty heap" state */ if (H5HF__hdr_empty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty"); /* Detach from parent indirect block */ if (iblock->parent) { /* Destroy flush dependency between indirect block and parent */ if (H5AC_destroy_flush_dependency(iblock->fd_parent, iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); iblock->fd_parent = NULL; /* Detach from parent indirect block */ if (H5HF__man_iblock_detach(iblock->parent, iblock->par_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTATTACH, FAIL, "can't detach from parent indirect block"); iblock->parent = NULL; iblock->par_entry = 0; } /* end if */ @@ -1501,7 +1459,7 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) * not being deleted) */ if (H5HF__iblock_decr(iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block"); iblock = NULL; /* Delete indirect block from cache, if appropriate */ @@ -1530,7 +1488,7 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) /* Unprotect the indirect block, with appropriate flags */ if (H5HF__man_iblock_unprotect(del_iblock, cache_flags, TRUE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); /* if took ownership, free file space & mark block as removed from cache */ if (took_ownership) { @@ -1539,7 +1497,7 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) if (H5MF_xfree(hdr->f, H5FD_MEM_FHEAP_IBLOCK, del_iblock->addr, (hsize_t)del_iblock->size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, - "unable to free fractal heap indirect block file space") + "unable to free fractal heap indirect block file space"); del_iblock->addr = HADDR_UNDEF; /* Mark block as removed from the cache */ @@ -1558,9 +1516,6 @@ H5HF__man_iblock_detach(H5HF_indirect_t *iblock, unsigned entry) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * July 10 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1571,8 +1526,8 @@ H5HF__man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *ch /* * Check arguments. */ - HDassert(iblock); - HDassert(child_addr); + assert(iblock); + assert(child_addr); /* Retrieve address of entry */ *child_addr = iblock->ents[entry].addr; @@ -1591,9 +1546,6 @@ H5HF__man_iblock_entry_addr(H5HF_indirect_t *iblock, unsigned entry, haddr_t *ch * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 7 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1612,16 +1564,16 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_nr /* * Check arguments. */ - HDassert(hdr); - HDassert(H5F_addr_defined(iblock_addr)); - HDassert(iblock_nrows > 0); + assert(hdr); + assert(H5_addr_defined(iblock_addr)); + assert(iblock_nrows > 0); /* Lock indirect block */ if (NULL == (iblock = H5HF__man_iblock_protect(hdr, iblock_addr, iblock_nrows, par_iblock, par_entry, TRUE, H5AC__NO_FLAGS_SET, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") - HDassert(iblock->nchildren > 0); - HDassert(did_protect == TRUE); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block"); + assert(iblock->nchildren > 0); + assert(did_protect == TRUE); /* Iterate over rows in this indirect block */ entry = 0; @@ -1629,7 +1581,7 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_nr /* Iterate over entries in this row */ for (col = 0; col < hdr->man_dtable.cparam.width; col++, entry++) { /* Check for child entry at this position */ - if (H5F_addr_defined(iblock->ents[entry].addr)) { + if (H5_addr_defined(iblock->ents[entry].addr)) { /* Are we in a direct or indirect block row */ if (row < hdr->man_dtable.max_direct_rows) { hsize_t dblock_size; /* Size of direct block on disk */ @@ -1643,7 +1595,7 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_nr /* Delete child direct block */ if (H5HF__man_dblock_delete(hdr->f, iblock->ents[entry].addr, dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, - "unable to release fractal heap child direct block") + "unable to release fractal heap child direct block"); } /* end if */ else { hsize_t row_block_size; /* The size of blocks in this row */ @@ -1659,7 +1611,7 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_nr if (H5HF__man_iblock_delete(hdr, iblock->ents[entry].addr, child_nrows, iblock, entry) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, - "unable to release fractal heap child indirect block") + "unable to release fractal heap child indirect block"); } /* end else */ } /* end if */ } /* end for */ @@ -1672,10 +1624,10 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_nr /* Check the indirect block's status in the metadata cache */ if (H5AC_get_entry_status(hdr->f, iblock_addr, &iblock_status) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "unable to check metadata cache status for indirect block") + "unable to check metadata cache status for indirect block"); /* Check if indirect block is pinned */ - HDassert(!(iblock_status & H5AC_ES__IS_PINNED)); + assert(!(iblock_status & H5AC_ES__IS_PINNED)); } #endif /* NDEBUG */ @@ -1691,7 +1643,7 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_nr done: /* Unprotect the indirect block, with appropriate flags */ if (iblock && H5HF__man_iblock_unprotect(iblock, cache_flags, did_protect) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__man_iblock_delete() */ @@ -1704,8 +1656,6 @@ H5HF__man_iblock_delete(H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned iblock_nr * * Return: non-negative on success, negative on error * - * Programmer: Vailin Choi - * July 12 2007 *------------------------------------------------------------------------- */ herr_t @@ -1721,15 +1671,15 @@ H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned n /* * Check arguments. */ - HDassert(f); - HDassert(hdr); - HDassert(H5F_addr_defined(iblock_addr)); - HDassert(heap_size); + assert(f); + assert(hdr); + assert(H5_addr_defined(iblock_addr)); + assert(heap_size); /* Protect the indirect block */ if (NULL == (iblock = H5HF__man_iblock_protect(hdr, iblock_addr, nrows, par_iblock, par_entry, FALSE, H5AC__READ_ONLY_FLAG, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load fractal heap indirect block"); /* Accumulate size of this indirect block */ *heap_size += iblock->size; @@ -1751,18 +1701,18 @@ H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned n size_t v; /* Local index variable */ for (v = 0; v < hdr->man_dtable.cparam.width; v++, entry++) - if (H5F_addr_defined(iblock->ents[entry].addr)) + if (H5_addr_defined(iblock->ents[entry].addr)) if (H5HF__man_iblock_size(f, hdr, iblock->ents[entry].addr, num_indirect_rows, iblock, entry, heap_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, - "unable to get fractal heap storage info for indirect block") + "unable to get fractal heap storage info for indirect block"); } /* end for */ } /* end if */ done: /* Release the indirect block */ if (iblock && H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); iblock = NULL; FUNC_LEAVE_NOAPI(ret_value) @@ -1778,9 +1728,6 @@ H5HF__man_iblock_size(H5F_t *f, H5HF_hdr_t *hdr, haddr_t iblock_addr, unsigned n * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Jan 14 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -1798,16 +1745,16 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, hsize_t * /* * Check arguments. */ - HDassert(hdr); - HDassert(block_off > 0); - HDassert(ret_entry); + assert(hdr); + assert(block_off > 0); + assert(ret_entry); /* Look up row & column for object */ if (H5HF__dtable_lookup(&hdr->man_dtable, block_off, &row, &col) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of block"); /* Sanity check - first lookup must be an indirect block */ - HDassert(row >= hdr->man_dtable.max_direct_rows); + assert(row >= hdr->man_dtable.max_direct_rows); /* Traverse down, until a direct block at the offset is found, then * use previous (i.e. parent's) offset, row, and column. @@ -1828,12 +1775,12 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, hsize_t * /* Look up row & column in new indirect block for object */ if (H5HF__dtable_lookup(&hdr->man_dtable, (block_off - par_block_off), &row, &col) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of block"); } /* end while */ /* Sanity check */ - HDassert(row == 0); - HDassert(col == 0); + assert(row == 0); + assert(col == 0); /* Set return parameters */ *ret_par_block_off = prev_par_block_off; @@ -1850,9 +1797,6 @@ H5HF__man_iblock_parent_info(const H5HF_hdr_t *hdr, hsize_t block_off, hsize_t * * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 6 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1865,17 +1809,17 @@ H5HF__man_iblock_dest(H5HF_indirect_t *iblock) /* * Check arguments. */ - HDassert(iblock); - HDassert(iblock->rc == 0); + assert(iblock); + assert(iblock->rc == 0); /* Decrement reference count on shared info */ - HDassert(iblock->hdr); + assert(iblock->hdr); if (H5HF__hdr_decr(iblock->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header"); if (iblock->parent) if (H5HF__iblock_decr(iblock->parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared indirect block") + "can't decrement reference count on shared indirect block"); /* Release entry tables */ if (iblock->ents) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFiter.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFiter.c index 673c54398c..9d87cc6f18 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFiter.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFiter.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFiter.c - * Apr 24 2006 - * Quincey Koziol * * Purpose: Block iteration routines for fractal heaps. * @@ -65,7 +62,7 @@ /*******************/ /* Declare a free list to manage the H5HF_block_loc_t struct */ -H5FL_DEFINE(H5HF_block_loc_t); +H5FL_DEFINE_STATIC(H5HF_block_loc_t); /*------------------------------------------------------------------------- * Function: H5HF__man_iter_init @@ -76,9 +73,6 @@ H5FL_DEFINE(H5HF_block_loc_t); * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -89,10 +83,10 @@ H5HF__man_iter_init(H5HF_block_iter_t *biter) /* * Check arguments. */ - HDassert(biter); + assert(biter); /* Reset block iterator information */ - HDmemset(biter, 0, sizeof(H5HF_block_iter_t)); + memset(biter, 0, sizeof(H5HF_block_iter_t)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF__man_iter_init() */ @@ -105,9 +99,6 @@ H5HF__man_iter_init(H5HF_block_iter_t *biter) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -129,16 +120,16 @@ H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t o /* * Check arguments. */ - HDassert(biter); - HDassert(!biter->ready); + assert(biter); + assert(!biter->ready); /* Check for empty heap */ - HDassert(offset >= hdr->man_dtable.cparam.start_block_size); + assert(offset >= hdr->man_dtable.cparam.start_block_size); /* Allocate level structure */ if (NULL == (biter->curr = H5FL_MALLOC(H5HF_block_loc_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for direct block free list section") + "memory allocation failed for direct block free list section"); /* 1: = offset> @@ -207,7 +198,7 @@ H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t o if (NULL == (iblock = H5HF__man_iblock_protect(hdr, iblock_addr, iblock_nrows, iblock_parent, iblock_par_entry, FALSE, H5AC__NO_FLAGS_SET, &did_protect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap indirect block"); /* Make indirect block the context for the current location */ biter->curr->context = iblock; @@ -215,18 +206,18 @@ H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t o /* Hold the indirect block with the location */ if (H5HF__iblock_incr(biter->curr->context) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, - "can't increment reference count on shared indirect block") + "can't increment reference count on shared indirect block"); /* Release the current indirect block */ if (H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); iblock = NULL; /* See if the location falls in a direct block row */ /* Or, if the offset has just filled up a direct or indirect block */ if (curr_offset == (col * hdr->man_dtable.row_block_size[row]) || row < hdr->man_dtable.max_direct_rows) { - HDassert(curr_offset - (col * hdr->man_dtable.row_block_size[row]) == 0); + assert(curr_offset - (col * hdr->man_dtable.row_block_size[row]) == 0); break; /* Done now */ } /* end if */ /* Indirect block row */ @@ -236,7 +227,7 @@ H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t o /* Allocate level structure */ if (NULL == (new_loc = H5FL_MALLOC(H5HF_block_loc_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for direct block free list section") + "memory allocation failed for direct block free list section"); /* Link new level into iterator */ new_loc->up = biter->curr; @@ -263,9 +254,6 @@ H5HF__man_iter_start_offset(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, hsize_t o * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 31 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -276,7 +264,7 @@ H5HF__man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsign /* * Check arguments. */ - HDassert(biter); + assert(biter); /* Set location context */ biter->curr->entry = entry; @@ -294,9 +282,6 @@ H5HF__man_iter_set_entry(const H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsign * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -311,15 +296,15 @@ H5HF__man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, H5HF_indir /* * Check arguments. */ - HDassert(hdr); - HDassert(biter); - HDassert(!biter->ready); - HDassert(iblock); + assert(hdr); + assert(biter); + assert(!biter->ready); + assert(iblock); /* Create new location for iterator */ if (NULL == (new_loc = H5FL_MALLOC(H5HF_block_loc_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for direct block free list section") + "memory allocation failed for direct block free list section"); /* Set up location context */ new_loc->entry = start_entry; @@ -330,7 +315,7 @@ H5HF__man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, H5HF_indir /* Increment reference count on indirect block */ if (H5HF__iblock_incr(new_loc->context) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block"); /* Make new location the current location */ biter->curr = new_loc; @@ -353,9 +338,6 @@ H5HF__man_iter_start_entry(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, H5HF_indir * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -368,7 +350,7 @@ H5HF__man_iter_reset(H5HF_block_iter_t *biter) /* * Check arguments. */ - HDassert(biter); + assert(biter); /* Free any location contexts that exist */ if (biter->curr) { @@ -385,7 +367,7 @@ H5HF__man_iter_reset(H5HF_block_iter_t *biter) if (curr_loc->context) if (H5HF__iblock_decr(curr_loc->context) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, - "can't decrement reference count on shared indirect block") + "can't decrement reference count on shared indirect block"); /* Free the current location context */ curr_loc = H5FL_FREE(H5HF_block_loc_t, curr_loc); @@ -412,9 +394,6 @@ H5HF__man_iter_reset(H5HF_block_iter_t *biter) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -425,16 +404,16 @@ H5HF__man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries /* * Check arguments. */ - HDassert(biter); - HDassert(biter->curr); - HDassert(biter->curr->context); - HDassert(biter->curr->row < biter->curr->context->nrows); + assert(biter); + assert(biter->curr); + assert(biter->curr->context); + assert(biter->curr->row < biter->curr->context->nrows); /* Advance entry in current block */ biter->curr->entry += nentries; biter->curr->row = biter->curr->entry / hdr->man_dtable.cparam.width; biter->curr->col = biter->curr->entry % hdr->man_dtable.cparam.width; - /* HDassert(biter->curr->row <= biter->curr->context->nrows); */ + /* assert(biter->curr->row <= biter->curr->context->nrows); */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF__man_iter_next() */ @@ -446,9 +425,6 @@ H5HF__man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -462,15 +438,15 @@ H5HF__man_iter_up(H5HF_block_iter_t *biter) /* * Check arguments. */ - HDassert(biter); - HDassert(biter->ready); - HDassert(biter->curr); - HDassert(biter->curr->up); - HDassert(biter->curr->context); + assert(biter); + assert(biter->ready); + assert(biter->curr); + assert(biter->curr->up); + assert(biter->curr->context); /* Release hold on current location's indirect block */ if (H5HF__iblock_decr(biter->curr->context) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block"); /* Get pointer to location context above this one */ up_loc = biter->curr->up; @@ -492,9 +468,6 @@ H5HF__man_iter_up(H5HF_block_iter_t *biter) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -508,15 +481,15 @@ H5HF__man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock) /* * Check arguments. */ - HDassert(biter); - HDassert(biter->ready); - HDassert(biter->curr); - HDassert(biter->curr->context); + assert(biter); + assert(biter->ready); + assert(biter->curr); + assert(biter->curr->context); /* Create new location to move down to */ if (NULL == (down_loc = H5FL_MALLOC(H5HF_block_loc_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for direct block free list section") + "memory allocation failed for direct block free list section"); /* Initialize down location */ down_loc->row = 0; @@ -527,7 +500,7 @@ H5HF__man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock) /* Increment reference count on indirect block */ if (H5HF__iblock_incr(down_loc->context) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block"); /* Make down location the current location */ biter->curr = down_loc; @@ -546,9 +519,6 @@ H5HF__man_iter_down(H5HF_block_iter_t *biter, H5HF_indirect_t *iblock) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -560,8 +530,8 @@ H5HF__man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, unsi /* * Check arguments. */ - HDassert(biter); - HDassert(biter->ready); + assert(biter); + assert(biter->ready); /* Retrieve the information asked for */ if (row) @@ -583,9 +553,6 @@ H5HF__man_iter_curr(H5HF_block_iter_t *biter, unsigned *row, unsigned *col, unsi * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Apr 25 2006 - * *------------------------------------------------------------------------- */ hbool_t @@ -596,7 +563,7 @@ H5HF__man_iter_ready(H5HF_block_iter_t *biter) /* * Check arguments. */ - HDassert(biter); + assert(biter); FUNC_LEAVE_NOAPI(biter->ready) } /* end H5HF__man_iter_ready() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFman.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFman.c index b1b4f6013f..d5075c0317 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFman.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFman.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFman.c - * Feb 24 2006 - * Quincey Koziol * * Purpose: "Managed" object routines for fractal heaps. * @@ -49,7 +46,7 @@ if (!((HDR)->checked_filters)) { \ if ((HDR)->pline.nused) \ if (H5Z_can_apply_direct(&((HDR)->pline)) < 0) \ - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "I/O filters can't operate on this heap") \ + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "I/O filters can't operate on this heap"); \ \ (HDR)->checked_filters = TRUE; \ } /* end if */ \ @@ -88,9 +85,6 @@ static herr_t H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operato * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Mar 13 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -110,23 +104,23 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) /* * Check arguments. */ - HDassert(hdr); - HDassert(obj_size > 0); - HDassert(obj); - HDassert(id); + assert(hdr); + assert(obj_size > 0); + assert(obj); + assert(id); /* Check pipeline */ H5HF_MAN_WRITE_CHECK_PLINE(hdr) /* Look for free space */ if ((node_found = H5HF__space_find(hdr, (hsize_t)obj_size, &sec_node)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap"); /* If we didn't find a node, go create a direct block big enough to hold the requested block */ if (!node_found) /* Allocate direct block big enough to hold requested size */ if (H5HF__man_dblock_new(hdr, obj_size, &sec_node) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create fractal heap direct block"); /* Check for row section */ if (sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || @@ -134,24 +128,24 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) /* Allocate 'single' selection out of 'row' selection */ if (H5HF__man_iblock_alloc_row(hdr, &sec_node) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't break up row section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't break up row section"); } /* end if */ - HDassert(sec_node->sect_info.type == H5HF_FSPACE_SECT_SINGLE); + assert(sec_node->sect_info.type == H5HF_FSPACE_SECT_SINGLE); /* Check for 'single' section being serialized */ if (sec_node->sect_info.state == H5FS_SECT_SERIALIZED) if (H5HF__sect_single_revive(hdr, sec_node) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section") - HDassert(sec_node->sect_info.state == H5FS_SECT_LIVE); + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section"); + assert(sec_node->sect_info.state == H5FS_SECT_LIVE); /* Retrieve direct block address from section */ if (H5HF__sect_single_dblock_info(hdr, sec_node, &dblock_addr, &dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information"); /* Lock direct block */ if (NULL == (dblock = H5HF__man_dblock_protect(hdr, dblock_addr, dblock_size, sec_node->u.single.parent, sec_node->u.single.par_entry, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block"); /* Insert object into block */ @@ -160,11 +154,11 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) blk_off = (size_t)(sec_node->sect_info.addr - dblock->block_off); /* Sanity checks */ - HDassert(sec_node->sect_info.size >= obj_size); + assert(sec_node->sect_info.size >= obj_size); /* Reduce (& possibly re-add) single section */ if (H5HF__sect_single_reduce(hdr, sec_node, obj_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce single section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce single section node"); sec_node = NULL; /* Encode the object in the block */ @@ -179,7 +173,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) p += obj_size; /* Sanity check */ - HDassert((size_t)(p - (dblock->blk + blk_off)) == obj_size); + assert((size_t)(p - (dblock->blk + blk_off)) == obj_size); } /* end block */ /* Set the heap ID for the new object (heap offset & obj length) */ @@ -190,17 +184,17 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) /* Reduce space available in heap (marks header dirty) */ if (H5HF__hdr_adj_free(hdr, -(ssize_t)obj_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap"); done: /* Release section node on error */ if (ret_value < 0) if (sec_node && H5HF__sect_single_free((H5FS_section_info_t *)sec_node) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release section node") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release section node"); /* Release the direct block (marked as dirty) */ if (dblock && H5AC_unprotect(hdr->f, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__man_insert() */ @@ -212,9 +206,6 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) * * Return: SUCCEED (Can't fail) * - * Programmer: Dana Robinson - * August 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -226,9 +217,9 @@ H5HF__man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(obj_len_p); + assert(hdr); + assert(id); + assert(obj_len_p); /* Skip over the flag byte */ id++; @@ -249,9 +240,6 @@ H5HF__man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Aug 20 2015 - * *------------------------------------------------------------------------- */ void @@ -262,9 +250,9 @@ H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(obj_off_p); + assert(hdr); + assert(id); + assert(obj_off_p); /* Skip over the flag byte */ id++; @@ -283,9 +271,6 @@ H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Mar 17 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -311,9 +296,9 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(op); + assert(hdr); + assert(id); + assert(op); /* Set the access mode for the direct block */ if (op_flags & H5HF_OP_MODIFY) { @@ -337,15 +322,15 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * /* Check for bad offset or length */ if (obj_off == 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap offset") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap offset"); if (obj_off > hdr->man_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object offset too large") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object offset too large"); if (obj_len == 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap object size") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap object size"); if (obj_len > hdr->man_dtable.cparam.max_direct_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object size too large for direct block") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object size too large for direct block"); if (obj_len > hdr->max_man_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object should be standalone") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object should be standalone"); /* Check for root direct block */ if (hdr->man_dtable.curr_root_rows == 0) { @@ -356,7 +341,7 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * /* Lock direct block */ if (NULL == (dblock = H5HF__man_dblock_protect(hdr, dblock_addr, dblock_size, NULL, 0, dblock_access_flags))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block"); } /* end if */ else { H5HF_indirect_t *iblock; /* Pointer to indirect block */ @@ -365,7 +350,7 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * /* Look up indirect block containing direct block */ if (H5HF__man_dblock_locate(hdr, obj_off, &iblock, &entry, &did_protect, H5AC__READ_ONLY_FLAG) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section"); /* Set direct block info */ dblock_addr = iblock->ents[entry].addr; @@ -374,13 +359,13 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * dblock_size = (size_t)hdr->man_dtable.row_block_size[entry / hdr->man_dtable.cparam.width]; /* Check for offset of invalid direct block */ - if (!H5F_addr_defined(dblock_addr)) { + if (!H5_addr_defined(dblock_addr)) { /* Unlock indirect block */ if (H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, - "unable to release fractal heap indirect block") + "unable to release fractal heap indirect block"); - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap ID not in allocated direct block") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap ID not in allocated direct block"); } /* end if */ /* Lock direct block */ @@ -389,40 +374,40 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * /* Unlock indirect block */ if (H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, - "unable to release fractal heap indirect block") + "unable to release fractal heap indirect block"); - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect fractal heap direct block"); } /* end if */ /* Unlock indirect block */ if (H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); iblock = NULL; } /* end else */ /* Compute offset of object within block */ - HDassert((obj_off - dblock->block_off) < (hsize_t)dblock_size); + assert((obj_off - dblock->block_off) < (hsize_t)dblock_size); blk_off = (size_t)(obj_off - dblock->block_off); /* Check for object's offset in the direct block prefix information */ if (blk_off < (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block"); /* Check for object's length overrunning the end of the direct block */ if ((blk_off + obj_len) > dblock_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object overruns end of direct block") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object overruns end of direct block"); /* Point to location for object */ p = dblock->blk + blk_off; /* Call the user's 'op' callback */ if (op(p, obj_len, op_data) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "application's callback failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "application's callback failed"); done: /* Unlock direct block */ if (dblock && H5AC_unprotect(hdr->f, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, dblock_cache_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap direct block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__man_op_real() */ @@ -434,9 +419,6 @@ H5HF__man_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Mar 17 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -449,13 +431,13 @@ H5HF__man_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(obj); + assert(hdr); + assert(id); + assert(obj); /* Call the internal 'op' routine routine */ if (H5HF__man_op_real(hdr, id, H5HF__op_read, obj, 0) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -468,9 +450,6 @@ H5HF__man_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -483,9 +462,9 @@ H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj) /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(obj); + assert(hdr); + assert(id); + assert(obj); /* Call the internal 'op' routine routine * @@ -495,7 +474,7 @@ H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj) */ H5_GCC_CLANG_DIAG_OFF("cast-qual") if (H5HF__man_op_real(hdr, id, H5HF__op_write, (void *)obj, H5HF_OP_MODIFY) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object"); H5_GCC_CLANG_DIAG_ON("cast-qual") done: @@ -509,9 +488,6 @@ H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sept 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -524,13 +500,13 @@ H5HF__man_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_da /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(op); + assert(hdr); + assert(id); + assert(op); /* Call the internal 'op' routine routine */ if (H5HF__man_op_real(hdr, id, op, op_data, 0) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -543,9 +519,6 @@ H5HF__man_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_da * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 15 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -567,8 +540,8 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id) /* * Check arguments. */ - HDassert(hdr); - HDassert(id); + assert(hdr); + assert(id); /* Check pipeline */ H5HF_MAN_WRITE_CHECK_PLINE(hdr) @@ -582,15 +555,15 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id) /* Check for bad offset or length */ if (obj_off == 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap offset") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap offset"); if (obj_off > hdr->man_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object offset too large") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object offset too large"); if (obj_len == 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap object size") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "invalid fractal heap object size"); if (obj_len > hdr->man_dtable.cparam.max_direct_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object size too large for direct block") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object size too large for direct block"); if (obj_len > hdr->max_man_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object should be standalone") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap object should be standalone"); /* Check for root direct block */ if (hdr->man_dtable.curr_root_rows == 0) { @@ -603,11 +576,11 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id) /* Look up indirect block containing direct block */ if (H5HF__man_dblock_locate(hdr, obj_off, &iblock, &dblock_entry, &did_protect, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section"); /* Check for offset of invalid direct block */ - if (!H5F_addr_defined(iblock->ents[dblock_entry].addr)) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap ID not in allocated direct block") + if (!H5_addr_defined(iblock->ents[dblock_entry].addr)) + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "fractal heap ID not in allocated direct block"); /* Set direct block info */ H5_CHECK_OVERFLOW((hdr->man_dtable.row_block_size[dblock_entry / hdr->man_dtable.cparam.width]), @@ -623,50 +596,50 @@ H5HF__man_remove(H5HF_hdr_t *hdr, const uint8_t *id) } /* end else */ /* Compute offset of object within block */ - HDassert((obj_off - dblock_block_off) < (hsize_t)dblock_size); + assert((obj_off - dblock_block_off) < (hsize_t)dblock_size); blk_off = (size_t)(obj_off - dblock_block_off); /* Check for object's offset in the direct block prefix information */ if (blk_off < (size_t)H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object located in prefix of direct block"); /* Check for object's length overrunning the end of the direct block */ if ((blk_off + obj_len) > dblock_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object overruns end of direct block") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "object overruns end of direct block"); /* Create free space section node */ if (NULL == (sec_node = H5HF__sect_single_new(obj_off, obj_len, iblock, dblock_entry))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for direct block's free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for direct block's free space"); /* Unlock indirect block */ if (iblock) { if (H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); iblock = NULL; } /* end if */ /* Increase space available in heap (marks header dirty) */ if (H5HF__hdr_adj_free(hdr, (ssize_t)obj_len) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't adjust free space for heap"); /* Update statistics about heap */ hdr->man_nobjs--; /* Return free space to the heap's list of space */ if (H5HF__space_add(hdr, sec_node, H5FS_ADD_RETURNED_SPACE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add direct block free space to global list"); sec_node = NULL; done: if (ret_value < 0) { /* Release section node */ if (sec_node && H5HF__sect_single_free((H5FS_section_info_t *)sec_node) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release section node") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release section node"); } /* end if */ /* Unlock indirect block */ if (iblock && H5HF__man_iblock_unprotect(iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__man_remove() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFsection.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFsection.c index de68e3d27c..0dd9f3faf4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFsection.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFsection.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,11 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Monday, May 1, 2006 - * * Purpose: Free space section routines for fractal heaps - * */ /****************/ @@ -266,7 +261,7 @@ H5FS_section_class_t H5HF_FSPACE_SECT_CLS_INDIRECT[1] = {{ }}; /* Declare a free list to manage the H5HF_free_section_t struct */ -H5FL_DEFINE(H5HF_free_section_t); +H5FL_DEFINE_STATIC(H5HF_free_section_t); /*****************************/ /* Library Private Variables */ @@ -284,9 +279,6 @@ H5FL_DEFINE(H5HF_free_section_t); * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, July 25, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -298,20 +290,20 @@ H5FS__sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(cls); - HDassert(!cls->cls_private); + assert(cls); + assert(!cls->cls_private); /* Allocate & initialize the class-private (i.e. private shared) information * for this type of section */ if (NULL == (cls_prvt = (H5HF_sect_private_t *)H5MM_malloc(sizeof(H5HF_sect_private_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); cls_prvt->hdr = hdr; cls->cls_private = cls_prvt; /* Increment reference count on heap header */ if (H5HF__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -325,9 +317,6 @@ H5FS__sect_init_cls(H5FS_section_class_t *cls, H5HF_hdr_t *hdr) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, July 25, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -339,14 +328,14 @@ H5FS__sect_term_cls(H5FS_section_class_t *cls) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(cls); + assert(cls); /* Get pointer to class private info */ cls_prvt = (H5HF_sect_private_t *)cls->cls_private; /* Decrement reference count on heap header */ if (H5HF__hdr_decr(cls_prvt->hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared heap header"); /* Free the class private information */ cls->cls_private = H5MM_xfree(cls_prvt); @@ -364,9 +353,6 @@ H5FS__sect_term_cls(H5FS_section_class_t *cls) * * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, May 13, 2006 - * *------------------------------------------------------------------------- */ static H5HF_free_section_t * @@ -378,12 +364,12 @@ H5FS__sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, H5 FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(H5F_addr_defined(sect_addr)); + assert(H5_addr_defined(sect_addr)); /* Create free list section node */ if (NULL == (new_sect = H5FL_MALLOC(H5HF_free_section_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for direct block free list section") + "memory allocation failed for direct block free list section"); /* Set the information passed in */ new_sect->sect_info.addr = sect_addr; @@ -409,9 +395,6 @@ H5FS__sect_node_new(unsigned sect_type, haddr_t sect_addr, hsize_t sect_size, H5 * * Failure: negative * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -421,13 +404,13 @@ H5HF__sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *iblock) FUNC_ENTER_PACKAGE - HDassert(sect); + assert(sect); /* Release indirect block, if there was one */ if (iblock) if (H5HF__iblock_decr(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, - "can't decrement reference count on section's indirect block") + "can't decrement reference count on section's indirect block"); /* Release the section */ sect = H5FL_FREE(H5HF_free_section_t, sect); @@ -443,9 +426,6 @@ H5HF__sect_node_free(H5HF_free_section_t *sect, H5HF_indirect_t *iblock) * * Return: Pointer to new section on success/NULL on failure * - * Programmer: Quincey Koziol - * May 30 2006 - * *------------------------------------------------------------------------- */ H5HF_free_section_t * @@ -459,19 +439,19 @@ H5HF__sect_single_new(hsize_t sect_off, size_t sect_size, H5HF_indirect_t *paren /* * Check arguments. */ - HDassert(sect_size); + assert(sect_size); /* Create free space section node */ if (NULL == (sect = H5FS__sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_off, (hsize_t)sect_size, H5FS_SECT_LIVE))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for single section") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for single section"); /* Set the 'single' specific fields */ sect->u.single.parent = parent; if (sect->u.single.parent) { if (H5HF__iblock_incr(sect->u.single.parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, - "can't increment reference count on shared indirect block") + "can't increment reference count on shared indirect block"); } /* end if */ sect->u.single.par_entry = par_entry; @@ -494,9 +474,6 @@ H5HF__sect_single_new(hsize_t sect_off, size_t sect_size, H5HF_indirect_t *paren * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 24 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -512,18 +489,18 @@ H5HF__sect_single_locate_parent(H5HF_hdr_t *hdr, hbool_t refresh, H5HF_free_sect /* * Check arguments. */ - HDassert(hdr); - HDassert(hdr->man_dtable.curr_root_rows > 0); - HDassert(sect); + assert(hdr); + assert(hdr->man_dtable.curr_root_rows > 0); + assert(sect); /* Look up indirect block containing direct blocks for range */ if (H5HF__man_dblock_locate(hdr, sect->sect_info.addr, &sec_iblock, &sec_entry, &did_protect, H5AC__READ_ONLY_FLAG) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section"); /* Increment reference count on indirect block that free section is in */ if (H5HF__iblock_incr(sec_iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block"); /* Check for refreshing existing parent information */ if (refresh) { @@ -531,7 +508,7 @@ H5HF__sect_single_locate_parent(H5HF_hdr_t *hdr, hbool_t refresh, H5HF_free_sect /* Release hold on previous parent indirect block */ if (H5HF__iblock_decr(sect->u.single.parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, - "can't decrement reference count on section's indirect block") + "can't decrement reference count on section's indirect block"); } /* end if */ } /* end if */ @@ -541,7 +518,7 @@ H5HF__sect_single_locate_parent(H5HF_hdr_t *hdr, hbool_t refresh, H5HF_free_sect /* Unlock indirect block */ if (H5HF__man_iblock_unprotect(sec_iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); sec_iblock = NULL; done: @@ -555,9 +532,6 @@ H5HF__sect_single_locate_parent(H5HF_hdr_t *hdr, hbool_t refresh, H5HF_free_sect * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 8 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -570,21 +544,21 @@ H5HF__sect_single_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) /* * Check arguments. */ - HDassert(hdr); - HDassert(sect); - HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED); + assert(hdr); + assert(sect); + assert(sect->sect_info.state == H5FS_SECT_SERIALIZED); /* Check for root direct block */ if (hdr->man_dtable.curr_root_rows == 0) { /* Set the information for the section */ - HDassert(H5F_addr_defined(hdr->man_dtable.table_addr)); + assert(H5_addr_defined(hdr->man_dtable.table_addr)); sect->u.single.parent = NULL; sect->u.single.par_entry = 0; } /* end if */ else { /* Look up indirect block information for section */ if (H5HF__sect_single_locate_parent(hdr, FALSE, sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get section's parent info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get section's parent info"); } /* end else */ /* Section is "live" now */ @@ -601,9 +575,6 @@ H5HF__sect_single_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * October 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -615,17 +586,17 @@ H5HF__sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, /* * Check arguments. */ - HDassert(hdr); - HDassert(sect); - HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE); - HDassert(sect->sect_info.state == H5FS_SECT_LIVE); - HDassert(dblock_addr); - HDassert(dblock_size); + assert(hdr); + assert(sect); + assert(sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE); + assert(sect->sect_info.state == H5FS_SECT_LIVE); + assert(dblock_addr); + assert(dblock_size); /* Check for root direct block */ if (hdr->man_dtable.curr_root_rows == 0) { /* Retrieve direct block info from heap header */ - HDassert(H5F_addr_defined(hdr->man_dtable.table_addr)); + assert(H5_addr_defined(hdr->man_dtable.table_addr)); *dblock_addr = hdr->man_dtable.table_addr; *dblock_size = hdr->man_dtable.cparam.start_block_size; } /* end if */ @@ -648,9 +619,6 @@ H5HF__sect_single_dblock_info(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 31 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -663,16 +631,16 @@ H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, size_t amt) /* * Check arguments. */ - HDassert(hdr); - HDassert(sect); - HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE); - HDassert(sect->sect_info.state == H5FS_SECT_LIVE); + assert(hdr); + assert(sect); + assert(sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE); + assert(sect->sect_info.state == H5FS_SECT_LIVE); /* Check for eliminating the section */ if (sect->sect_info.size == amt) { /* Free single section */ if (H5HF__sect_single_free((H5FS_section_info_t *)sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free single section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free single section node"); } /* end if */ else { /* Adjust information for section */ @@ -681,7 +649,7 @@ H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, size_t amt) /* Re-insert section node into heap's free space */ if (H5HF__space_add(hdr, sect, 0) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't re-add single section to free space manager") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't re-add single section to free space manager"); } /* end else */ done: @@ -700,9 +668,6 @@ H5HF__sect_single_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, size_t amt) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, July 27, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -716,13 +681,13 @@ H5HF__sect_single_full_dblock(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect); - HDassert(sect->sect_info.state == H5FS_SECT_LIVE); - HDassert(hdr); + assert(sect); + assert(sect->sect_info.state == H5FS_SECT_LIVE); + assert(hdr); /* Retrieve direct block address from section */ if (H5HF__sect_single_dblock_info(hdr, sect, &dblock_addr, &dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information"); /* Check for section occupying entire direct block */ /* (and not the root direct block) */ @@ -733,16 +698,16 @@ H5HF__sect_single_full_dblock(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) if (NULL == (dblock = H5HF__man_dblock_protect(hdr, dblock_addr, dblock_size, sect->u.single.parent, sect->u.single.par_entry, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") - HDassert(H5F_addr_eq(dblock->block_off + dblock_overhead, sect->sect_info.addr)); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block"); + assert(H5_addr_eq(dblock->block_off + dblock_overhead, sect->sect_info.addr)); /* Convert 'single' section into 'row' section */ if (H5HF__sect_row_from_single(hdr, sect, dblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't convert single section into row section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't convert single section into row section"); /* Destroy direct block */ if (H5HF__man_dblock_destroy(hdr, dblock, dblock_addr, &parent_removed) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release direct block"); dblock = NULL; /* If the parent for this direct block was removed and the indirect @@ -750,7 +715,7 @@ H5HF__sect_single_full_dblock(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) */ if (parent_removed && H5FS_SECT_LIVE == sect->u.row.under->sect_info.state) if (H5HF__sect_row_parent_removed(sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "can't update section info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "can't update section info"); } /* end if */ done: @@ -766,9 +731,6 @@ H5HF__sect_single_full_dblock(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, July 27, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -787,13 +749,13 @@ H5HF__sect_single_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata H5HF_hdr_t *hdr = udata->hdr; /* Fractal heap header */ /* Sanity check */ - HDassert(sect); - HDassert(hdr); + assert(sect); + assert(hdr); /* Check if single section covers entire direct block it's in */ /* (converts to row section possibly) */ if (H5HF__sect_single_full_dblock(hdr, (*sect)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't check/convert single section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't check/convert single section"); /* Set the "returned space" flag if the single section was changed * into a row section, so the "merging & shrinking" algorithm @@ -815,9 +777,6 @@ H5HF__sect_single_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, May 1, 2006 - * *------------------------------------------------------------------------- */ static H5FS_section_info_t * @@ -831,13 +790,13 @@ H5HF__sect_single_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(H5F_addr_defined(sect_addr)); - HDassert(sect_size); + assert(H5_addr_defined(sect_addr)); + assert(sect_size); /* Create free list section node */ if (NULL == (new_sect = H5FS__sect_node_new(H5HF_FSPACE_SECT_SINGLE, sect_addr, sect_size, H5FS_SECT_SERIALIZED))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "allocation failed for direct block free list section") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "allocation failed for direct block free list section"); /* Set return value */ ret_value = (H5FS_section_info_t *)new_sect; @@ -857,9 +816,6 @@ H5HF__sect_single_deserialize(const H5FS_section_class_t H5_ATTR_UNUSED *cls, * * Failure: negative * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ static htri_t @@ -873,18 +829,18 @@ H5HF__sect_single_can_merge(const H5FS_section_info_t *_sect1, const H5FS_sectio FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect1); - HDassert(sect2); - HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ - HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); + assert(sect1); + assert(sect2); + assert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ + assert(H5_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); /* Check if second section adjoins first section */ /* (This can only occur within a direct block, due to the direct block * overhead at the beginning of a block, so no need to check if sections * are actually within the same direct block) */ - if (H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr)) - HGOTO_DONE(TRUE) + if (H5_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr)) + HGOTO_DONE(TRUE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -901,9 +857,6 @@ H5HF__sect_single_can_merge(const H5FS_section_info_t *_sect1, const H5FS_sectio * * Failure: negative * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -918,28 +871,28 @@ H5HF__sect_single_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect1); - HDassert((*sect1)->sect_info.type == H5HF_FSPACE_SECT_SINGLE); - HDassert(sect2); - HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_SINGLE); - HDassert(H5F_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr)); + assert(sect1); + assert((*sect1)->sect_info.type == H5HF_FSPACE_SECT_SINGLE); + assert(sect2); + assert(sect2->sect_info.type == H5HF_FSPACE_SECT_SINGLE); + assert(H5_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr)); /* Add second section's size to first section */ (*sect1)->sect_info.size += sect2->sect_info.size; /* Get rid of second section */ if (H5HF__sect_single_free((H5FS_section_info_t *)sect2) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node"); /* Check to see if we should revive first section */ if ((*sect1)->sect_info.state != H5FS_SECT_LIVE) if (H5HF__sect_single_revive(hdr, (*sect1)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section"); /* Check if single section covers entire direct block it's in */ /* (converts to row section possibly) */ if (H5HF__sect_single_full_dblock(hdr, (*sect1)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't check/convert single section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't check/convert single section"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -958,9 +911,6 @@ H5HF__sect_single_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, June 5, 2006 - * *------------------------------------------------------------------------- */ static htri_t @@ -974,7 +924,7 @@ H5HF__sect_single_can_shrink(const H5FS_section_info_t *_sect, void *_udata) FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect); + assert(sect); /* Check for section occupying entire root direct block */ /* (We shouldn't ever have a single section that occupies an entire @@ -989,14 +939,14 @@ H5HF__sect_single_can_shrink(const H5FS_section_info_t *_sect, void *_udata) dblock_size = hdr->man_dtable.cparam.start_block_size; dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); if ((dblock_size - dblock_overhead) == sect->sect_info.size) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ else { /* We shouldn't have a situation where the 'next block' iterator * is moved before a direct block that still has objects within it. */ - HDassert(hdr->man_iter_off > sect->sect_info.addr); - HGOTO_DONE(FALSE) + assert(hdr->man_iter_off > sect->sect_info.addr); + HGOTO_DONE(FALSE); } /* end else */ done: @@ -1012,9 +962,6 @@ H5HF__sect_single_can_shrink(const H5FS_section_info_t *_sect, void *_udata) * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, July 17, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1031,34 +978,34 @@ H5HF__sect_single_shrink(H5FS_section_info_t **_sect, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect); - HDassert(*sect); - HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_SINGLE); + assert(sect); + assert(*sect); + assert((*sect)->sect_info.type == H5HF_FSPACE_SECT_SINGLE); /* Check to see if we should revive section */ if ((*sect)->sect_info.state != H5FS_SECT_LIVE) if (H5HF__sect_single_revive(hdr, (*sect)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section"); /* Retrieve direct block address from section */ if (H5HF__sect_single_dblock_info(hdr, (*sect), &dblock_addr, &dblock_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information"); /* Protect the direct block for the section */ /* (should be a root direct block) */ - HDassert(dblock_addr == hdr->man_dtable.table_addr); + assert(dblock_addr == hdr->man_dtable.table_addr); if (NULL == (dblock = H5HF__man_dblock_protect(hdr, dblock_addr, dblock_size, (*sect)->u.single.parent, (*sect)->u.single.par_entry, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") - HDassert(H5F_addr_eq(dblock->block_off + dblock_size, (*sect)->sect_info.addr + (*sect)->sect_info.size)); + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block"); + assert(H5_addr_eq(dblock->block_off + dblock_size, (*sect)->sect_info.addr + (*sect)->sect_info.size)); /* Get rid of section */ if (H5HF__sect_single_free((H5FS_section_info_t *)*sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node"); /* Destroy direct block */ if (H5HF__man_dblock_destroy(hdr, dblock, dblock_addr, NULL) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release direct block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release direct block"); dblock = NULL; /* Indicate that the section has been released */ @@ -1077,9 +1024,6 @@ H5HF__sect_single_shrink(H5FS_section_info_t **_sect, void *_udata) * * Failure: negative * - * Programmer: Quincey Koziol - * Wednesday, May 17, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1092,7 +1036,7 @@ H5HF__sect_single_free(H5FS_section_info_t *_sect) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect); + assert(sect); /* Check for live reference to an indirect block */ if (sect->sect_info.state == H5FS_SECT_LIVE) @@ -1102,7 +1046,7 @@ H5HF__sect_single_free(H5FS_section_info_t *_sect) /* Release the section */ if (H5HF__sect_node_free(sect, parent) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1116,9 +1060,6 @@ H5HF__sect_single_free(H5FS_section_info_t *_sect) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, July 21, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1129,7 +1070,7 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect); + assert(sect); if (sect->sect_info.state == H5FS_SECT_LIVE) { /* Check if this section is not in a direct block that is the root direct block */ @@ -1144,25 +1085,25 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 /* Sanity check settings for section's direct block's parent */ iblock = sect->u.single.parent; - HDassert(H5F_addr_defined(iblock->ents[sect->u.single.par_entry].addr)); + assert(H5_addr_defined(iblock->ents[sect->u.single.par_entry].addr)); /* Retrieve direct block address from section */ status = H5HF__sect_single_dblock_info(iblock->hdr, (const H5HF_free_section_t *)sect, &dblock_addr, &dblock_size); - HDassert(status >= 0); - HDassert(H5F_addr_eq(iblock->ents[sect->u.single.par_entry].addr, dblock_addr)); - HDassert(dblock_size > 0); + assert(status >= 0); + assert(H5_addr_eq(iblock->ents[sect->u.single.par_entry].addr, dblock_addr)); + assert(dblock_size > 0); /* Check if the section is actually within the heap */ - HDassert(sect->sect_info.addr < iblock->hdr->man_iter_off); + assert(sect->sect_info.addr < iblock->hdr->man_iter_off); /* Check that the direct block has been merged correctly */ dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(iblock->hdr); - HDassert((sect->sect_info.size + dblock_overhead) < dblock_size); + assert((sect->sect_info.size + dblock_overhead) < dblock_size); /* Check the direct block's status in the metadata cache */ status = H5AC_get_entry_status(iblock->hdr->f, dblock_addr, &dblock_status); - HDassert(status >= 0); + assert(status >= 0); /* If the direct block for the section isn't already protected, * protect it here in order to check single section's sanity @@ -1174,19 +1115,19 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 /* Protect the direct block for the section */ dblock = H5HF__man_dblock_protect(iblock->hdr, dblock_addr, dblock_size, iblock, sect->u.single.par_entry, H5AC__READ_ONLY_FLAG); - HDassert(dblock); + assert(dblock); /* Sanity check settings for section */ - HDassert(dblock_size == dblock->size); - HDassert(dblock->size > sect->sect_info.size); - HDassert(H5F_addr_lt(dblock->block_off, sect->sect_info.addr)); - HDassert(H5F_addr_ge((dblock->block_off + dblock->size), - (sect->sect_info.addr + sect->sect_info.size))); + assert(dblock_size == dblock->size); + assert(dblock->size > sect->sect_info.size); + assert(H5_addr_lt(dblock->block_off, sect->sect_info.addr)); + assert(H5_addr_ge((dblock->block_off + dblock->size), + (sect->sect_info.addr + sect->sect_info.size))); /* Release direct block */ status = H5AC_unprotect(iblock->hdr->f, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET); - HDassert(status >= 0); + assert(status >= 0); } /* end if */ } /* end if */ } /* end if */ @@ -1203,9 +1144,6 @@ H5HF__sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5 * * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, July 6, 2006 - * *------------------------------------------------------------------------- */ static H5HF_free_section_t * @@ -1218,16 +1156,16 @@ H5HF__sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, uns FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect_size); - HDassert(nentries); - HDassert(under_sect); + assert(sect_size); + assert(nentries); + assert(under_sect); /* Create 'row' free space section node */ /* ("inherits" underlying indirect section's state) */ if (NULL == (sect = H5FS__sect_node_new( (unsigned)(is_first ? H5HF_FSPACE_SECT_FIRST_ROW : H5HF_FSPACE_SECT_NORMAL_ROW), sect_off, sect_size, under_sect->sect_info.state))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for row section") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for row section"); /* Set the 'row' specific fields */ sect->u.row.under = under_sect; @@ -1250,9 +1188,6 @@ H5HF__sect_row_create(haddr_t sect_off, hsize_t sect_size, hbool_t is_first, uns * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 6 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1265,9 +1200,9 @@ H5HF__sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_dire /* * Check arguments. */ - HDassert(hdr); - HDassert(sect); - HDassert(dblock); + assert(hdr); + assert(sect); + assert(dblock); /* Convert 'single' section information to 'row' section info */ sect->sect_info.addr = dblock->block_off; @@ -1279,11 +1214,11 @@ H5HF__sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_dire /* Create indirect section that underlies the row section */ if (NULL == (sect->u.row.under = H5HF__sect_indirect_for_row(hdr, dblock->parent, sect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "serializing row section not supported yet") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "serializing row section not supported yet"); /* Release single section's hold on underlying indirect block */ if (H5HF__iblock_decr(dblock->parent) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1296,9 +1231,6 @@ H5HF__sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_dire * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 6 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1311,9 +1243,9 @@ H5HF__sect_row_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) /* * Check arguments. */ - HDassert(hdr); - HDassert(sect); - HDassert(sect->u.row.under); + assert(hdr); + assert(sect); + assert(sect->u.row.under); /* If the indirect section's iblock has been removed from the cache, but the * section is still marked as "live", switch it to the "serialized" state. @@ -1321,13 +1253,13 @@ H5HF__sect_row_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) if ((H5FS_SECT_LIVE == sect->u.row.under->sect_info.state) && (TRUE == sect->u.row.under->u.indirect.u.iblock->removed_from_cache)) if (H5HF__sect_row_parent_removed(sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "can't update section info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "can't update section info"); /* Pass along "revive" request to underlying indirect section */ /* (which will mark this section as "live") */ if (H5HF__sect_indirect_revive_row(hdr, sect->u.row.under) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section") - HDassert(sect->sect_info.state == H5FS_SECT_LIVE); + HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section"); + assert(sect->sect_info.state == H5FS_SECT_LIVE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1342,9 +1274,6 @@ H5HF__sect_row_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 6 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1358,21 +1287,21 @@ H5HF__sect_row_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned *entr /* * Check arguments. */ - HDassert(hdr); - HDassert(sect); - HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || - sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); - HDassert(sect->sect_info.state == H5FS_SECT_LIVE); - HDassert(entry_p); + assert(hdr); + assert(sect); + assert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || + sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); + assert(sect->sect_info.state == H5FS_SECT_LIVE); + assert(entry_p); /* Mark the row as checked out from the free space manager */ - HDassert(sect->u.row.checked_out == FALSE); + assert(sect->u.row.checked_out == FALSE); sect->u.row.checked_out = TRUE; /* Forward row section to indirect routines, to handle reducing underlying indirect section */ alloc_from_start = FALSE; if (H5HF__sect_indirect_reduce_row(hdr, sect, &alloc_from_start) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce underlying section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce underlying section"); /* Determine entry allocated */ *entry_p = (sect->u.row.row * hdr->man_dtable.cparam.width) + sect->u.row.col; @@ -1383,7 +1312,7 @@ H5HF__sect_row_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned *entr if (sect->u.row.num_entries == 1) { /* Free row section */ if (H5HF__sect_row_free((H5FS_section_info_t *)sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section node"); } /* end if */ else { /* Check whether to allocate from the beginning or end of the row */ @@ -1401,7 +1330,7 @@ H5HF__sect_row_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned *entr /* Add 'row' section back to free space list */ if (H5HF__space_add(hdr, sect, 0) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't re-add indirect section to free space manager") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't re-add indirect section to free space manager"); } /* end else */ done: @@ -1415,9 +1344,6 @@ H5HF__sect_row_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned *entr * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 10 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1428,9 +1354,9 @@ H5HF__sect_row_first(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(sect); - HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); + assert(hdr); + assert(sect); + assert(sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); /* If the row is already checked out from the free space manager, just * change it's class directly and the free space manager will adjust when @@ -1441,7 +1367,7 @@ H5HF__sect_row_first(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) else /* Change row section to be the "first row" */ if (H5HF__space_sect_change_class(hdr, sect, H5HF_FSPACE_SECT_FIRST_ROW) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "can't set row section to be first row") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "can't set row section to be first row"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1454,9 +1380,6 @@ H5HF__sect_row_first(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) * * Return: Pointer to indirect block on success/NULL on failure * - * Programmer: Quincey Koziol - * July 9 2006 - * *------------------------------------------------------------------------- */ H5HF_indirect_t * @@ -1469,10 +1392,10 @@ H5HF__sect_row_get_iblock(H5HF_free_section_t *sect) /* * Check arguments. */ - HDassert(sect); - HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || - sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); - HDassert(sect->sect_info.state == H5FS_SECT_LIVE); + assert(sect); + assert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || + sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); + assert(sect->sect_info.state == H5FS_SECT_LIVE); ret_value = H5HF__sect_indirect_get_iblock(sect->u.row.under); @@ -1487,9 +1410,6 @@ H5HF__sect_row_get_iblock(H5HF_free_section_t *sect) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * February 4 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -1502,14 +1422,14 @@ H5HF__sect_row_parent_removed(H5HF_free_section_t *sect) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(sect); + assert(sect); /* Get a copy of the indirect block's offset before decrementing refcount on it */ tmp_iblock_off = sect->u.row.under->u.indirect.u.iblock->block_off; /* Decrement the refcount on the indirect block, since serialized sections don't hold a reference */ if (H5HF__iblock_decr(sect->u.row.under->u.indirect.u.iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block"); /* Switch indirect block info to serialized form */ /* (Overwrites iblock pointer in the indirect section) */ @@ -1542,9 +1462,6 @@ H5HF__sect_row_parent_removed(H5HF_free_section_t *sect) * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, July 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1556,12 +1473,12 @@ H5HF__sect_row_init_cls(H5FS_section_class_t *cls, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(cls); - HDassert(hdr); + assert(cls); + assert(hdr); /* Call common class initialization */ if (H5FS__sect_init_cls(cls, hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize common section class") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize common section class"); /* First row sections actually are proxies for indirection sections on disk */ if (cls->type == H5HF_FSPACE_SECT_FIRST_ROW) @@ -1585,9 +1502,6 @@ H5HF__sect_row_init_cls(H5FS_section_class_t *cls, void *_udata) * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, July 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1598,11 +1512,11 @@ H5HF__sect_row_term_cls(H5FS_section_class_t *cls) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(cls); + assert(cls); /* Call common class termination */ if (H5FS__sect_term_cls(cls) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't terminate common section class") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't terminate common section class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1617,9 +1531,6 @@ H5HF__sect_row_term_cls(H5FS_section_class_t *cls) * * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, July 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1632,17 +1543,17 @@ H5HF__sect_row_serialize(const H5FS_section_class_t *cls, const H5FS_section_inf FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(cls); - HDassert(buf); - HDassert(sect); - HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); - HDassert(sect->sect_info.addr == sect->u.row.under->sect_info.addr); + assert(cls); + assert(buf); + assert(sect); + assert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); + assert(sect->sect_info.addr == sect->u.row.under->sect_info.addr); /* Forward to indirect routine to serialize underlying section */ hdr = ((H5HF_sect_private_t *)(cls->cls_private))->hdr; if (H5HF__sect_indirect_serialize(hdr, sect->u.row.under, buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSERIALIZE, FAIL, - "can't serialize row section's underlying indirect section") + "can't serialize row section's underlying indirect section"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1660,9 +1571,6 @@ H5HF__sect_row_serialize(const H5FS_section_class_t *cls, const H5FS_section_inf * * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, July 15, 2006 - * *------------------------------------------------------------------------- */ static H5FS_section_info_t * @@ -1675,16 +1583,16 @@ H5HF__sect_row_deserialize(const H5FS_section_class_t *cls, const uint8_t *buf, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(cls); - HDassert(buf); - HDassert(H5F_addr_defined(sect_addr)); - HDassert(sect_size); + assert(cls); + assert(buf); + assert(H5_addr_defined(sect_addr)); + assert(sect_size); /* Forward to indirect routine to deserialize underlying section */ hdr = ((H5HF_sect_private_t *)(cls->cls_private))->hdr; if (NULL == (ret_value = H5HF__sect_indirect_deserialize(hdr, buf, sect_addr, sect_size, des_flags))) HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, - "can't deserialize row section's underlying indirect section") + "can't deserialize row section's underlying indirect section"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1701,9 +1609,6 @@ H5HF__sect_row_deserialize(const H5FS_section_class_t *cls, const uint8_t *buf, * * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, July 6, 2006 - * *------------------------------------------------------------------------- */ static htri_t @@ -1718,17 +1623,17 @@ H5HF__sect_row_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_i FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect1); - HDassert(sect1->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); - HDassert(sect2); - HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ - HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); + assert(sect1); + assert(sect1->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); + assert(sect2); + assert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ + assert(H5_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); /* Get the top indirect section underlying each row */ top_indir_sect1 = H5HF__sect_indirect_top(sect1->u.row.under); - HDassert(top_indir_sect1); + assert(top_indir_sect1); top_indir_sect2 = H5HF__sect_indirect_top(sect2->u.row.under); - HDassert(top_indir_sect2); + assert(top_indir_sect2); /* Check if second section shares the same underlying indirect block as * the first section, but doesn't already have same underlying indirect @@ -1738,9 +1643,9 @@ H5HF__sect_row_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_i if (H5HF__sect_indirect_iblock_off(sect1->u.row.under) == H5HF__sect_indirect_iblock_off(sect2->u.row.under)) /* Check if second section adjoins first section */ - if (H5F_addr_eq((top_indir_sect1->sect_info.addr + top_indir_sect1->u.indirect.span_size), - top_indir_sect2->sect_info.addr)) - HGOTO_DONE(TRUE) + if (H5_addr_eq((top_indir_sect1->sect_info.addr + top_indir_sect1->u.indirect.span_size), + top_indir_sect2->sect_info.addr)) + HGOTO_DONE(TRUE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1757,9 +1662,6 @@ H5HF__sect_row_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section_i * * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, July 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1774,10 +1676,10 @@ H5HF__sect_row_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect1); - HDassert((*sect1)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); - HDassert(sect2); - HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); + assert(sect1); + assert((*sect1)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); + assert(sect2); + assert(sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); /* Check if second section is past end of "next block" iterator */ if (sect2->sect_info.addr >= hdr->man_iter_off) { @@ -1788,12 +1690,12 @@ H5HF__sect_row_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, /* Shrink away underlying indirect section */ if (H5HF__sect_indirect_shrink(hdr, top_indir_sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't shrink underlying indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't shrink underlying indirect section"); } /* end if */ else /* Merge rows' underlying indirect sections together */ if (H5HF__sect_indirect_merge_row(hdr, (*sect1), sect2) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMERGE, FAIL, "can't merge underlying indirect sections") + HGOTO_ERROR(H5E_HEAP, H5E_CANTMERGE, FAIL, "can't merge underlying indirect sections"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1812,9 +1714,6 @@ H5HF__sect_row_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2, * * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, July 6, 2006 - * *------------------------------------------------------------------------- */ static htri_t @@ -1828,12 +1727,12 @@ H5HF__sect_row_can_shrink(const H5FS_section_info_t *_sect, void H5_ATTR_UNUSED FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect); - HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); + assert(sect); + assert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); /* Check if section is past end of "next block" iterator */ if (sect->sect_info.addr >= hdr->man_iter_off) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1848,9 +1747,6 @@ H5HF__sect_row_can_shrink(const H5FS_section_info_t *_sect, void H5_ATTR_UNUSED * * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, July 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1865,16 +1761,16 @@ H5HF__sect_row_shrink(H5FS_section_info_t **_sect, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect); - HDassert(*sect); - HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); + assert(sect); + assert(*sect); + assert((*sect)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); /* Get the top indirect section underlying each row */ top_indir_sect = H5HF__sect_indirect_top((*sect)->u.row.under); /* Shrink away underlying indirect section */ if (H5HF__sect_indirect_shrink(hdr, top_indir_sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't shrink underlying indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't shrink underlying indirect section"); /* Indicate that the section has been released */ *sect = NULL; @@ -1892,9 +1788,6 @@ H5HF__sect_row_shrink(H5FS_section_info_t **_sect, void *_udata) * * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, July 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1904,11 +1797,11 @@ H5HF__sect_row_free_real(H5HF_free_section_t *sect) FUNC_ENTER_PACKAGE - HDassert(sect); + assert(sect); /* Release the section */ if (H5HF__sect_node_free(sect, NULL) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1923,9 +1816,6 @@ H5HF__sect_row_free_real(H5HF_free_section_t *sect) * * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, July 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1936,16 +1826,16 @@ H5HF__sect_row_free(H5FS_section_info_t *_sect) FUNC_ENTER_PACKAGE - HDassert(sect); - HDassert(sect->u.row.under); + assert(sect); + assert(sect->u.row.under); /* Decrement the ref. count on the row section's underlying indirect section */ if (H5HF__sect_indirect_decr(sect->u.row.under) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't detach section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't detach section node"); /* Release the section */ if (H5HF__sect_row_free_real(sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1959,9 +1849,6 @@ H5HF__sect_row_free(H5FS_section_info_t *_sect) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, July 21, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1976,30 +1863,30 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t FUNC_ENTER_PACKAGE_NOERR /* Basic sanity check */ - HDassert(cls); - HDassert(sect); + assert(cls); + assert(sect); /* Retrieve class private information */ cls_prvt = (H5HF_sect_private_t *)cls->cls_private; hdr = cls_prvt->hdr; /* Sanity checking on the row */ - HDassert(sect->u.row.under); - HDassert(sect->u.row.num_entries); - HDassert(sect->u.row.checked_out == FALSE); + assert(sect->u.row.under); + assert(sect->u.row.num_entries); + assert(sect->u.row.checked_out == FALSE); indir_sect = sect->u.row.under; indir_idx = sect->u.row.row - indir_sect->u.indirect.row; - HDassert(indir_sect->u.indirect.dir_rows[indir_idx] == sect); + assert(indir_sect->u.indirect.dir_rows[indir_idx] == sect); /* Check if the section is actually within the heap */ - HDassert(sect->sect_info.addr < hdr->man_iter_off); + assert(sect->sect_info.addr < hdr->man_iter_off); /* Different checking for different kinds of rows */ if (sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW) { H5HF_free_section_t *top_indir_sect; /* Top indirect section for row */ /* Some extra sanity checks on the row */ - HDassert(sect->u.row.row == indir_sect->u.indirect.row); + assert(sect->u.row.row == indir_sect->u.indirect.row); /* Get the top indirect section underlying row */ top_indir_sect = H5HF__sect_indirect_top(sect->u.row.under); @@ -2019,9 +1906,6 @@ H5HF__sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, July 25, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2032,17 +1916,17 @@ H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect); + assert(sect); /* Print indirect section information */ - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Row:", sect->u.row.row); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Column:", sect->u.row.col); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of entries:", sect->u.row.num_entries); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Row:", sect->u.row.row); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Column:", sect->u.row.col); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of entries:", sect->u.row.num_entries); /* If this is a first row section display information about underlying indirect section */ if (sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW) { /* Print indirect section header */ - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Underlying indirect section:"); + fprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Underlying indirect section:"); H5HF__sect_indirect_debug(sect->u.row.under, stream, indent + 3, MAX(0, fwidth - 3)); } /* end if */ @@ -2057,9 +1941,6 @@ H5HF__sect_row_debug(const H5FS_section_info_t *_sect, FILE *stream, int indent, * * Return: Offset of indirect block in "heap space" (can't fail) * - * Programmer: Quincey Koziol - * July 6 2006 - * *------------------------------------------------------------------------- */ static hsize_t @@ -2072,7 +1953,7 @@ H5HF__sect_indirect_iblock_off(const H5HF_free_section_t *sect) /* * Check arguments. */ - HDassert(sect); + assert(sect); ret_value = sect->sect_info.state == H5FS_SECT_LIVE ? sect->u.indirect.u.iblock->block_off : sect->u.indirect.u.iblock_off; @@ -2087,9 +1968,6 @@ H5HF__sect_indirect_iblock_off(const H5HF_free_section_t *sect) * * Return: Pointer to the top indirect section (can't fail) * - * Programmer: Quincey Koziol - * July 6 2006 - * *------------------------------------------------------------------------- */ static H5HF_free_section_t * @@ -2102,7 +1980,7 @@ H5HF__sect_indirect_top(H5HF_free_section_t *sect) /* * Check arguments. */ - HDassert(sect); + assert(sect); if (sect->u.indirect.parent) ret_value = H5HF__sect_indirect_top(sect->u.indirect.parent); @@ -2121,9 +1999,6 @@ H5HF__sect_indirect_top(H5HF_free_section_t *sect) * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, July 3, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2135,12 +2010,12 @@ H5HF__sect_indirect_init_cls(H5FS_section_class_t *cls, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(cls); - HDassert(hdr); + assert(cls); + assert(hdr); /* Call to common class initialization */ if (H5FS__sect_init_cls(cls, hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize common section class") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize common section class"); /* Set the size of all serialized objects of this class of sections */ cls->serial_size = H5HF_SECT_INDIRECT_SERIAL_SIZE(hdr); @@ -2158,9 +2033,6 @@ H5HF__sect_indirect_init_cls(H5FS_section_class_t *cls, void *_udata) * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, July 3, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2171,11 +2043,11 @@ H5HF__sect_indirect_term_cls(H5FS_section_class_t *cls) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(cls); + assert(cls); /* Call common class termination */ if (H5FS__sect_term_cls(cls) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't terminate common section class") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't terminate common section class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2189,9 +2061,6 @@ H5HF__sect_indirect_term_cls(H5FS_section_class_t *cls) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 6 2006 - * *------------------------------------------------------------------------- */ static H5HF_free_section_t * @@ -2206,13 +2075,13 @@ H5HF__sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, H5 /* * Check arguments. */ - HDassert(hdr); - HDassert(nentries); + assert(hdr); + assert(nentries); /* Create free space section node */ if (NULL == (sect = H5FS__sect_node_new(H5HF_FSPACE_SECT_INDIRECT, sect_off, sect_size, (iblock ? H5FS_SECT_LIVE : H5FS_SECT_SERIALIZED)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for indirect section") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for indirect section"); /* Set the 'indirect' specific fields */ if (iblock) { @@ -2220,7 +2089,7 @@ H5HF__sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, H5 sect->u.indirect.iblock_entries = hdr->man_dtable.cparam.width * sect->u.indirect.u.iblock->max_rows; if (H5HF__iblock_incr(sect->u.indirect.u.iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, - "can't increment reference count on shared indirect block") + "can't increment reference count on shared indirect block"); } /* end if */ else { sect->u.indirect.u.iblock_off = iblock_off; @@ -2232,7 +2101,7 @@ H5HF__sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, H5 /* Compute span size of indirect section */ sect->u.indirect.span_size = H5HF__dtable_span_size(&hdr->man_dtable, row, col, nentries); - HDassert(sect->u.indirect.span_size > 0); + assert(sect->u.indirect.span_size > 0); /* This indirect section doesn't (currently) have a parent */ sect->u.indirect.parent = NULL; @@ -2257,9 +2126,6 @@ H5HF__sect_indirect_new(H5HF_hdr_t *hdr, haddr_t sect_off, hsize_t sect_size, H5 * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 6 2006 - * *------------------------------------------------------------------------- */ static H5HF_free_section_t * @@ -2273,16 +2139,16 @@ H5HF__sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_ /* * Check arguments. */ - HDassert(hdr); - HDassert(iblock); - HDassert(row_sect); - HDassert(row_sect->u.row.row < hdr->man_dtable.max_direct_rows); + assert(hdr); + assert(iblock); + assert(row_sect); + assert(row_sect->u.row.row < hdr->man_dtable.max_direct_rows); /* Create free space section node */ if (NULL == (sect = H5HF__sect_indirect_new(hdr, row_sect->sect_info.addr, row_sect->sect_info.size, iblock, iblock->block_off, row_sect->u.row.row, row_sect->u.row.col, row_sect->u.row.num_entries))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create indirect section"); /* Set # of direct rows covered */ sect->u.indirect.dir_nrows = 1; @@ -2290,9 +2156,9 @@ H5HF__sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_ /* Allocate space for the derived row sections */ if (NULL == (sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *)))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "allocation failed for row section pointer array") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "allocation failed for row section pointer array"); - /* Atatch the new row section to indirect section */ + /* Attach the new row section to indirect section */ sect->u.indirect.dir_rows[0] = row_sect; sect->u.indirect.rc = 1; @@ -2306,7 +2172,7 @@ H5HF__sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_ done: if (!ret_value && sect) if (H5HF__sect_indirect_free(sect) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "can't free indirect section node") + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "can't free indirect section node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__sect_indirect_for_row() */ @@ -2319,9 +2185,6 @@ H5HF__sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, H5HF_free_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 6 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2345,8 +2208,8 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ /* * Check arguments. */ - HDassert(sect); - HDassert(sect->u.indirect.span_size > 0); + assert(sect); + assert(sect->u.indirect.span_size > 0); /* Reset reference count for indirect section */ /* (Also reset the direct & indirect row pointers */ @@ -2373,7 +2236,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ /* Allocate space for the derived row sections */ if (NULL == (sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *) * dir_nrows))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array"); } /* end if */ else { /* No rows of direct blocks covered, reset direct row information */ @@ -2408,7 +2271,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ /* Allocate space for the child indirect sections */ if (NULL == (sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_malloc( sizeof(H5HF_free_section_t *) * sect->u.indirect.indir_nents))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for indirect section pointer array") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for indirect section pointer array"); } /* end if */ else { /* No indirect block entries covered, reset indirect row information */ @@ -2436,7 +2299,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ if (NULL == (row_sect = H5HF__sect_row_create( curr_off, (hdr->man_dtable.row_block_size[u] - dblock_overhead), first_child, u, row_col, row_entries, sect))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "creation failed for child row section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "creation failed for child row section"); /* Add new row section to array for indirect section */ sect->u.indirect.dir_rows[curr_row] = row_sect; @@ -2447,7 +2310,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ else /* Add new row section to free space manager for the heap */ if (H5HF__space_add(hdr, row_sect, space_flags) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add row section to free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add row section to free space"); /* Increment reference count for underlying indirect section */ sect->u.indirect.rc++; @@ -2485,15 +2348,15 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ if (H5HF__man_iblock_entry_addr(sect->u.indirect.u.iblock, curr_entry, &child_iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "unable to retrieve child indirect block's address") + "unable to retrieve child indirect block's address"); /* If the child indirect block's address is defined, protect it */ - if (H5F_addr_defined(child_iblock_addr)) { + if (H5_addr_defined(child_iblock_addr)) { if (NULL == (child_iblock = H5HF__man_iblock_protect( hdr, child_iblock_addr, child_nrows, sect->u.indirect.u.iblock, curr_entry, FALSE, H5AC__NO_FLAGS_SET, &did_protect))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, - "unable to protect fractal heap indirect block") + "unable to protect fractal heap indirect block"); } /* end if */ else child_iblock = NULL; @@ -2504,20 +2367,20 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ /* Create free space section node */ if (NULL == (child_sect = H5HF__sect_indirect_new(hdr, curr_off, (hsize_t)0, child_iblock, curr_off, 0, 0, child_nentries))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section"); /* Initialize rows for new indirect section */ if (H5HF__sect_indirect_init_rows(hdr, child_sect, first_child, first_row_sect, space_flags, 0, 0, (child_nrows - 1), (hdr->man_dtable.cparam.width - 1)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize indirect section"); /* If we have a valid child indirect block, release it now */ /* (will be pinned, if rows reference it) */ if (child_iblock) if (H5HF__man_iblock_unprotect(child_iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, - "unable to release fractal heap indirect block") + "unable to release fractal heap indirect block"); /* Attach child section to this section */ child_sect->u.indirect.parent = sect; @@ -2552,7 +2415,7 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ sect->u.indirect.dir_nrows = dir_nrows; /* Make certain we've tracked the section's dependents correctly */ - HDassert(sect->u.indirect.rc == (sect->u.indirect.indir_nents + sect->u.indirect.dir_nrows)); + assert(sect->u.indirect.rc == (sect->u.indirect.indir_nents + sect->u.indirect.dir_nrows)); done: if (ret_value < 0) { @@ -2573,9 +2436,6 @@ H5HF__sect_indirect_init_rows(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, hbool_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 3 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2597,9 +2457,9 @@ H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start /* * Check arguments. */ - HDassert(hdr); - HDassert(iblock); - HDassert(nentries); + assert(hdr); + assert(iblock); + assert(nentries); /* Compute starting column & row */ start_row = start_entry / hdr->man_dtable.cparam.width; @@ -2619,24 +2479,24 @@ H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start /* Create free space section node */ if (NULL == (sect = H5HF__sect_indirect_new(hdr, sect_off, (hsize_t)0, iblock, iblock->block_off, start_row, start_col, nentries))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section"); /* Initialize rows for new indirect section */ if (H5HF__sect_indirect_init_rows(hdr, sect, TRUE, &first_row_sect, H5FS_ADD_SKIP_VALID, start_row, start_col, end_row, end_col) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize indirect section") - HDassert(first_row_sect); + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize indirect section"); + assert(first_row_sect); /* Now that underlying indirect section is consistent, add first row * section to free space manager for the heap */ if (H5HF__space_add(hdr, first_row_sect, H5FS_ADD_RETURNED_SPACE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add row section to free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't add row section to free space"); done: if (ret_value < 0 && sect) if (H5HF__sect_indirect_free(sect) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__sect_indirect_add() */ @@ -2648,9 +2508,6 @@ H5HF__sect_indirect_add(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, unsigned start * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 6 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2663,8 +2520,8 @@ H5HF__sect_indirect_decr(H5HF_free_section_t *sect) /* * Check arguments. */ - HDassert(sect); - HDassert(sect->u.indirect.rc); + assert(sect); + assert(sect->u.indirect.rc); /* Decrement ref. count for indirect section */ sect->u.indirect.rc--; @@ -2678,13 +2535,13 @@ H5HF__sect_indirect_decr(H5HF_free_section_t *sect) /* Free indirect section */ if (H5HF__sect_indirect_free(sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node"); /* Decrement ref. count on indirect section's parent */ if (par_sect) if (H5HF__sect_indirect_decr(par_sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, - "can't decrement ref. count on parent indirect section") + "can't decrement ref. count on parent indirect section"); } /* end if */ done: @@ -2698,9 +2555,6 @@ H5HF__sect_indirect_decr(H5HF_free_section_t *sect) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 3 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2715,23 +2569,23 @@ H5HF__sect_indirect_revive_row(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) /* * Check arguments. */ - HDassert(hdr); - HDassert(sect); - HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED); + assert(hdr); + assert(sect); + assert(sect->sect_info.state == H5FS_SECT_SERIALIZED); /* Look up indirect block containing indirect blocks for section */ if (H5HF__man_dblock_locate(hdr, sect->sect_info.addr, &sec_iblock, NULL, &did_protect, H5AC__READ_ONLY_FLAG) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section"); /* Review the section */ if (H5HF__sect_indirect_revive(hdr, sect, sec_iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section"); done: /* Unlock indirect block */ if (sec_iblock && H5HF__man_iblock_unprotect(sec_iblock, H5AC__NO_FLAGS_SET, did_protect) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__sect_indirect_revive_row() */ @@ -2743,9 +2597,6 @@ H5HF__sect_indirect_revive_row(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 10 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2759,14 +2610,14 @@ H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_indi /* * Check arguments. */ - HDassert(hdr); - HDassert(sect); - HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED); - HDassert(sect_iblock); + assert(hdr); + assert(sect); + assert(sect->sect_info.state == H5FS_SECT_SERIALIZED); + assert(sect_iblock); /* Increment reference count on indirect block that free section is in */ if (H5HF__iblock_incr(sect_iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block"); /* Set the pointer to the section's indirect block */ sect->u.indirect.u.iblock = sect_iblock; @@ -2784,7 +2635,7 @@ H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_indi /* Revive parent indirect section, if there is one */ if (sect->u.indirect.parent && sect->u.indirect.parent->sect_info.state == H5FS_SECT_SERIALIZED) if (H5HF__sect_indirect_revive(hdr, sect->u.indirect.parent, sect->u.indirect.u.iblock->parent) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREVIVE, FAIL, "can't revive indirect section"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2799,9 +2650,6 @@ H5HF__sect_indirect_revive(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, H5HF_indi * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 10 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2824,8 +2672,8 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h /* * Check arguments. */ - HDassert(hdr); - HDassert(row_sect); + assert(hdr); + assert(row_sect); /* Compute starting & ending information for row section */ row_start_entry = (row_sect->u.row.row * hdr->man_dtable.cparam.width) + row_sect->u.row.col; @@ -2840,11 +2688,11 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h end_row = end_entry / hdr->man_dtable.cparam.width; /* Additional sanity check */ - HDassert(sect->u.indirect.span_size > 0); - HDassert(sect->u.indirect.iblock_entries > 0); - HDassert(sect->u.indirect.dir_nrows > 0); - HDassert(sect->u.indirect.dir_rows); - HDassert(sect->u.indirect.dir_rows[(row_sect->u.row.row - start_row)] == row_sect); + assert(sect->u.indirect.span_size > 0); + assert(sect->u.indirect.iblock_entries > 0); + assert(sect->u.indirect.dir_nrows > 0); + assert(sect->u.indirect.dir_rows); + assert(sect->u.indirect.dir_rows[(row_sect->u.row.row - start_row)] == row_sect); /* Check if we should allocate from end of indirect section */ if (row_end_entry == end_entry && start_row != end_row) { @@ -2865,14 +2713,14 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h /* Remove this indirect section from parent indirect section */ if (H5HF__sect_indirect_reduce(hdr, sect->u.indirect.parent, sect->u.indirect.par_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce parent indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce parent indirect section"); sect->u.indirect.parent = NULL; sect->u.indirect.par_entry = 0; /* If we weren't the first section, set "first row" for this indirect section */ if (!is_first) if (H5HF__sect_indirect_first(hdr, sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't make new 'first row' for indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't make new 'first row' for indirect section"); } /* end if */ /* Adjust indirect section's span size */ @@ -2887,7 +2735,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h /* Adjust block coordinates of span */ sect->u.indirect.col++; if (sect->u.indirect.col == hdr->man_dtable.cparam.width) { - HDassert(row_sect->u.row.num_entries == 1); + assert(row_sect->u.row.num_entries == 1); /* Adjust section's span information */ sect->u.indirect.row++; @@ -2898,21 +2746,21 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h /* Adjust direct row sections for indirect section */ if (sect->u.indirect.dir_nrows > 0) { - HDassert(sect->u.indirect.dir_rows); - HDmemmove(§->u.indirect.dir_rows[0], §->u.indirect.dir_rows[1], - sect->u.indirect.dir_nrows * sizeof(H5HF_free_section_t *)); - HDassert(sect->u.indirect.dir_rows[0]); + assert(sect->u.indirect.dir_rows); + memmove(§->u.indirect.dir_rows[0], §->u.indirect.dir_rows[1], + sect->u.indirect.dir_nrows * sizeof(H5HF_free_section_t *)); + assert(sect->u.indirect.dir_rows[0]); /* Make new "first row" in indirect section */ if (row_sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW) if (H5HF__sect_row_first(hdr, sect->u.indirect.dir_rows[0]) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, - "can't make new 'first row' for indirect section") + "can't make new 'first row' for indirect section"); } /* end if */ else { /* Sanity check */ - HDassert(sect->u.indirect.indir_nents > 0); - HDassert(sect->u.indirect.indir_ents); + assert(sect->u.indirect.indir_nents > 0); + assert(sect->u.indirect.indir_ents); /* Eliminate direct rows for this section */ sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.dir_rows); @@ -2921,7 +2769,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h if (row_sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW) if (H5HF__sect_indirect_first(hdr, sect->u.indirect.indir_ents[0]) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, - "can't make new 'first row' for child indirect section") + "can't make new 'first row' for child indirect section"); } /* end else */ } /* end if */ @@ -2932,17 +2780,17 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h unsigned new_end_row; /* New end row for entries */ /* Sanity check */ - HDassert(sect->u.indirect.indir_nents == 0); - HDassert(sect->u.indirect.indir_ents == NULL); + assert(sect->u.indirect.indir_nents == 0); + assert(sect->u.indirect.indir_ents == NULL); /* Adjust number of entries covered */ sect->u.indirect.num_entries--; /* Check for eliminating a direct row */ new_end_row = ((start_entry + sect->u.indirect.num_entries) - 1) / hdr->man_dtable.cparam.width; - HDassert(new_end_row <= end_row); + assert(new_end_row <= end_row); if (new_end_row < end_row) { - HDassert(new_end_row == (end_row - 1)); + assert(new_end_row == (end_row - 1)); sect->u.indirect.dir_nrows--; } /* end if */ } /* end if */ @@ -2955,11 +2803,11 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h unsigned u; /* Local index variable */ /* Sanity checks */ - HDassert(row_sect->u.row.col == 0); - HDassert(row_sect->u.row.row > 0); - HDassert(row_sect->u.row.row < hdr->man_dtable.max_direct_rows); - HDassert(row_sect->u.row.num_entries == hdr->man_dtable.cparam.width); - HDassert(row_sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); + assert(row_sect->u.row.col == 0); + assert(row_sect->u.row.row > 0); + assert(row_sect->u.row.row < hdr->man_dtable.max_direct_rows); + assert(row_sect->u.row.num_entries == hdr->man_dtable.cparam.width); + assert(row_sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); /* Compute basic information about peer & current indirect sections */ new_start_row = row_sect->u.row.row; @@ -2980,7 +2828,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h if (NULL == (peer_sect = H5HF__sect_indirect_new(hdr, sect->sect_info.addr, sect->sect_info.size, iblock, iblock_off, start_row, start_col, peer_nentries))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section"); /* Set up direct row & indirect entry information for peer section */ peer_sect->u.indirect.indir_nents = 0; @@ -2988,15 +2836,15 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h peer_sect->u.indirect.dir_nrows = peer_dir_nrows; if (NULL == (peer_sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_malloc( sizeof(H5HF_free_section_t *) * peer_dir_nrows))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "allocation failed for row section pointer array") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "allocation failed for row section pointer array"); /* Transfer row sections between current & peer sections */ H5MM_memcpy(&peer_sect->u.indirect.dir_rows[0], §->u.indirect.dir_rows[0], (sizeof(H5HF_free_section_t *) * peer_dir_nrows)); - HDmemmove(§->u.indirect.dir_rows[0], §->u.indirect.dir_rows[peer_dir_nrows], - (sizeof(H5HF_free_section_t *) * (sect->u.indirect.dir_nrows - peer_dir_nrows))); + memmove(§->u.indirect.dir_rows[0], §->u.indirect.dir_rows[peer_dir_nrows], + (sizeof(H5HF_free_section_t *) * (sect->u.indirect.dir_nrows - peer_dir_nrows))); sect->u.indirect.dir_nrows -= peer_dir_nrows; - HDassert(row_sect == sect->u.indirect.dir_rows[0]); + assert(row_sect == sect->u.indirect.dir_rows[0]); /* Re-target transferred row sections to point to new underlying indirect section */ for (u = 0; u < peer_dir_nrows; u++) @@ -3027,9 +2875,9 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h (peer_nentries + 1); /* Transferred entries, plus the entry allocated out of the row */ /* Make certain we've tracked the sections' dependents correctly */ - HDassert(sect->u.indirect.rc == (sect->u.indirect.indir_nents + sect->u.indirect.dir_nrows)); - HDassert(peer_sect->u.indirect.rc == - (peer_sect->u.indirect.indir_nents + peer_sect->u.indirect.dir_nrows)); + assert(sect->u.indirect.rc == (sect->u.indirect.indir_nents + sect->u.indirect.dir_nrows)); + assert(peer_sect->u.indirect.rc == + (peer_sect->u.indirect.indir_nents + peer_sect->u.indirect.dir_nrows)); /* Reset the peer_sect variable, to indicate that it has been hooked into the data structures * correctly and shouldn't be freed */ @@ -3040,7 +2888,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h /* Decrement count of entries & rows */ sect->u.indirect.num_entries--; sect->u.indirect.dir_nrows--; - HDassert(sect->u.indirect.dir_nrows == 0); + assert(sect->u.indirect.dir_nrows == 0); /* Eliminate direct rows for this section */ sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.dir_rows); @@ -3051,10 +2899,10 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h * into the main free space structures (via the direct blocks), and the reference count is updated. */ if (peer_sect) { /* Sanity check - we should only be here if an error occurred */ - HDassert(ret_value < 0); + assert(ret_value < 0); if (H5HF__sect_indirect_free(peer_sect) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -3069,9 +2917,6 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, h * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 10 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -3090,10 +2935,10 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned /* * Check arguments. */ - HDassert(hdr); - HDassert(sect); - HDassert(sect->u.indirect.span_size > 0); - HDassert(sect->u.indirect.iblock_entries > 0); + assert(hdr); + assert(sect); + assert(sect->u.indirect.span_size > 0); + assert(sect->u.indirect.iblock_entries > 0); /* Compute starting & ending information for indirect section */ start_row = sect->u.indirect.row; @@ -3113,7 +2958,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned /* Reduce parent indirect section */ if (H5HF__sect_indirect_reduce(hdr, sect->u.indirect.parent, sect->u.indirect.par_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce parent indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce parent indirect section"); sect->u.indirect.parent = NULL; sect->u.indirect.par_entry = 0; @@ -3121,16 +2966,16 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned if (!is_first) if (H5HF__sect_indirect_first(hdr, sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, - "can't make new 'first row' for indirect section") + "can't make new 'first row' for indirect section"); } /* end if */ /* Check if we can allocate from start of indirect section */ if (child_entry == start_entry) { /* Sanity check */ - HDassert(sect->u.indirect.dir_nrows == 0); - HDassert(sect->u.indirect.dir_rows == NULL); - HDassert(sect->u.indirect.indir_nents > 0); - HDassert(sect->u.indirect.indir_ents); + assert(sect->u.indirect.dir_nrows == 0); + assert(sect->u.indirect.dir_rows == NULL); + assert(sect->u.indirect.indir_nents > 0); + assert(sect->u.indirect.indir_ents); /* Adjust section start */ sect->sect_info.addr += hdr->man_dtable.row_block_size[start_row]; @@ -3146,19 +2991,19 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned /* Adjust indirect entry information */ sect->u.indirect.indir_nents--; - HDmemmove(§->u.indirect.indir_ents[0], §->u.indirect.indir_ents[1], - sect->u.indirect.indir_nents * sizeof(H5HF_free_section_t *)); - HDassert(sect->u.indirect.indir_ents[0]); + memmove(§->u.indirect.indir_ents[0], §->u.indirect.indir_ents[1], + sect->u.indirect.indir_nents * sizeof(H5HF_free_section_t *)); + assert(sect->u.indirect.indir_ents[0]); /* Make new "first row" in new first indirect child section */ if (H5HF__sect_indirect_first(hdr, sect->u.indirect.indir_ents[0]) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, - "can't make new 'first row' for child indirect section") + "can't make new 'first row' for child indirect section"); } /* end if */ else if (child_entry == end_entry) { /* Sanity check */ - HDassert(sect->u.indirect.indir_nents > 0); - HDassert(sect->u.indirect.indir_ents); + assert(sect->u.indirect.indir_nents > 0); + assert(sect->u.indirect.indir_ents); /* Adjust span of blocks covered */ sect->u.indirect.num_entries--; @@ -3181,8 +3026,8 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned unsigned u; /* Local index variable */ /* Sanity check */ - HDassert(sect->u.indirect.indir_nents > 0); - HDassert(sect->u.indirect.indir_ents); + assert(sect->u.indirect.indir_nents > 0); + assert(sect->u.indirect.indir_ents); /* Compute basic information about peer & current indirect sections */ peer_nentries = end_entry - child_entry; @@ -3190,7 +3035,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned peer_start_col = (child_entry + 1) % hdr->man_dtable.cparam.width; child_row = child_entry / hdr->man_dtable.cparam.width; new_nentries = sect->u.indirect.num_entries - (peer_nentries + 1); - HDassert(child_row >= hdr->man_dtable.max_direct_rows); + assert(child_row >= hdr->man_dtable.max_direct_rows); /* Get indirect block information for peer */ if (sect->sect_info.state == H5FS_SECT_LIVE) { @@ -3207,7 +3052,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned sect->u.indirect.num_entries = new_nentries; sect->u.indirect.span_size = H5HF__dtable_span_size(&hdr->man_dtable, sect->u.indirect.row, sect->u.indirect.col, new_nentries); - HDassert(sect->u.indirect.span_size > 0); + assert(sect->u.indirect.span_size > 0); /* Compute address of peer indirect section */ peer_sect_addr = sect->sect_info.addr; @@ -3218,7 +3063,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned if (NULL == (peer_sect = H5HF__sect_indirect_new(hdr, peer_sect_addr, sect->sect_info.size, iblock, iblock_off, peer_start_row, peer_start_col, peer_nentries))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section"); /* Set up direct row & indirect entry information for peer section */ peer_sect->u.indirect.dir_nrows = 0; @@ -3227,7 +3072,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned if (NULL == (peer_sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_malloc( sizeof(H5HF_free_section_t *) * peer_nentries))) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, - "allocation failed for indirect section pointer array") + "allocation failed for indirect section pointer array"); /* Transfer child indirect sections between current & peer sections */ H5MM_memcpy(&peer_sect->u.indirect.indir_ents[0], @@ -3254,15 +3099,14 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned /* (Note modified on current section's ref. count, since we haven't * detached the child section yet) */ - HDassert((sect->u.indirect.rc - 1) == - (sect->u.indirect.indir_nents + sect->u.indirect.dir_nrows)); - HDassert(peer_sect->u.indirect.rc == - (peer_sect->u.indirect.indir_nents + peer_sect->u.indirect.dir_nrows)); + assert((sect->u.indirect.rc - 1) == (sect->u.indirect.indir_nents + sect->u.indirect.dir_nrows)); + assert(peer_sect->u.indirect.rc == + (peer_sect->u.indirect.indir_nents + peer_sect->u.indirect.dir_nrows)); /* Make new "first row" in peer section */ if (H5HF__sect_indirect_first(hdr, peer_sect->u.indirect.indir_ents[0]) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, - "can't make new 'first row' for peer indirect section") + "can't make new 'first row' for peer indirect section"); /* Reset the peer_sect variable, to indicate that it has been hooked into the data structures * correctly and shouldn't be freed */ @@ -3273,7 +3117,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned /* Decrement count of entries & indirect entries */ sect->u.indirect.num_entries--; sect->u.indirect.indir_nents--; - HDassert(sect->u.indirect.indir_nents == 0); + assert(sect->u.indirect.indir_nents == 0); /* Eliminate indirect entries for this section */ sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents); @@ -3282,17 +3126,17 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned /* Decrement # of sections which depend on this row */ /* (Must be last as section can be freed) */ if (H5HF__sect_indirect_decr(sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't decrement section's ref. count ") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't decrement section's ref. count "); done: /* Free allocated peer_sect. Note that this is necessary for all failures until peer_sect is linked * into the main free space structures (via the direct blocks), and the reference count is updated. */ if (peer_sect) { /* Sanity check - we should only be here if an error occurred */ - HDassert(ret_value < 0); + assert(ret_value < 0); if (H5HF__sect_indirect_free(peer_sect) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -3305,9 +3149,6 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, unsigned * * Return: Non-negative (TRUE/FALSE) on success/ * - * Programmer: Quincey Koziol - * July 17 2006 - * *------------------------------------------------------------------------- */ static hbool_t @@ -3318,7 +3159,7 @@ H5HF__sect_indirect_is_first(H5HF_free_section_t *sect) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(sect); + assert(sect); /* Recurse to parent */ if (sect->u.indirect.parent) { @@ -3338,9 +3179,6 @@ H5HF__sect_indirect_is_first(H5HF_free_section_t *sect) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 10 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -3351,30 +3189,30 @@ H5HF__sect_indirect_first(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(hdr); - HDassert(sect); + assert(hdr); + assert(sect); /* Check if this indirect section has direct block rows */ if (sect->u.indirect.dir_nrows > 0) { /* Sanity checks */ - HDassert(sect->u.indirect.row == 0); - HDassert(sect->u.indirect.col == 0); - HDassert(sect->u.indirect.dir_rows); - HDassert(sect->u.indirect.dir_rows[0]); + assert(sect->u.indirect.row == 0); + assert(sect->u.indirect.col == 0); + assert(sect->u.indirect.dir_rows); + assert(sect->u.indirect.dir_rows[0]); /* Change first row section in indirect section to be the "first row" */ if (H5HF__sect_row_first(hdr, sect->u.indirect.dir_rows[0]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "can't set row section to be first row") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "can't set row section to be first row"); } /* end if */ else { /* Sanity checks */ - HDassert(sect->u.indirect.indir_nents > 0); - HDassert(sect->u.indirect.indir_ents); - HDassert(sect->u.indirect.indir_ents[0]); + assert(sect->u.indirect.indir_nents > 0); + assert(sect->u.indirect.indir_ents); + assert(sect->u.indirect.indir_ents[0]); /* Forward to first child indirect section */ if (H5HF__sect_indirect_first(hdr, sect->u.indirect.indir_ents[0]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "can't set child indirect section to be first row") + HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, FAIL, "can't set child indirect section to be first row"); } /* end else */ done: @@ -3388,9 +3226,6 @@ H5HF__sect_indirect_first(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) * * Return: Pointer to indirect block on success/NULL on failure * - * Programmer: Quincey Koziol - * July 9 2006 - * *------------------------------------------------------------------------- */ static H5HF_indirect_t * @@ -3401,9 +3236,9 @@ H5HF__sect_indirect_get_iblock(H5HF_free_section_t *sect) /* * Check arguments. */ - HDassert(sect); - HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_INDIRECT); - HDassert(sect->sect_info.state == H5FS_SECT_LIVE); + assert(sect); + assert(sect->sect_info.type == H5HF_FSPACE_SECT_INDIRECT); + assert(sect->sect_info.state == H5FS_SECT_LIVE); FUNC_LEAVE_NOAPI(sect->u.indirect.u.iblock) } /* end H5HF__sect_indirect_get_iblock() */ @@ -3419,9 +3254,6 @@ H5HF__sect_indirect_get_iblock(H5HF_free_section_t *sect) * * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, July 18, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -3440,22 +3272,22 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H FUNC_ENTER_PACKAGE /* Sanity check parameters */ - HDassert(hdr); - HDassert(row_sect1); - HDassert(row_sect1->u.row.under); - HDassert(row_sect2); - HDassert(row_sect2->u.row.under); - HDassert(row_sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); + assert(hdr); + assert(row_sect1); + assert(row_sect1->u.row.under); + assert(row_sect2); + assert(row_sect2->u.row.under); + assert(row_sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); /* Set up indirect section information */ sect1 = H5HF__sect_indirect_top(row_sect1->u.row.under); - HDassert(sect1); + assert(sect1); sect2 = H5HF__sect_indirect_top(row_sect2->u.row.under); - HDassert(sect2); + assert(sect2); /* Sanity check some assumptions about the indirect sections */ - HDassert(sect1->u.indirect.span_size > 0); - HDassert(sect2->u.indirect.span_size > 0); + assert(sect1->u.indirect.span_size > 0); + assert(sect2->u.indirect.span_size > 0); /* Set up span information */ start_row1 = sect1->u.indirect.row; @@ -3481,8 +3313,8 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H * has child row sections, first indirect section _must_ have * them also) */ - HDassert(sect1->u.indirect.dir_nrows > 0); - HDassert(sect1->u.indirect.dir_rows); + assert(sect1->u.indirect.dir_nrows > 0); + assert(sect1->u.indirect.dir_rows); /* Get the offsets for the indirect blocks under the rows */ if (H5FS_SECT_LIVE == row_sect1->u.row.under->sect_info.state) @@ -3503,11 +3335,11 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H last_row_sect1 = sect1->u.indirect.dir_rows[sect1->u.indirect.dir_nrows - 1]; else last_row_sect1 = row_sect1; - HDassert(last_row_sect1); - HDassert(last_row_sect1->u.row.row == end_row1); + assert(last_row_sect1); + assert(last_row_sect1->u.row.row == end_row1); /* Adjust info for first row section, to absorb second row section */ - HDassert((last_row_sect1->u.row.col + last_row_sect1->u.row.num_entries) == row_sect2->u.row.col); + assert((last_row_sect1->u.row.col + last_row_sect1->u.row.num_entries) == row_sect2->u.row.col); last_row_sect1->u.row.num_entries += row_sect2->u.row.num_entries; /* Set up parameters for transfer of rows */ @@ -3536,7 +3368,7 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H /* Extend the first section's row array */ if (NULL == (new_dir_rows = (H5HF_free_section_t **)H5MM_realloc( sect1->u.indirect.dir_rows, sizeof(H5HF_free_section_t *) * new_dir_nrows1))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array"); sect1->u.indirect.dir_rows = new_dir_rows; /* Transfer the second section's rows to first section */ @@ -3565,9 +3397,9 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H unsigned new_indir_nents1; /* New value for number of indirect entries in first section */ /* Some sanity checks on second indirect section */ - HDassert(sect2->u.indirect.rc > 0); - HDassert(sect2->u.indirect.indir_nents > 0); - HDassert(sect2->u.indirect.indir_ents); + assert(sect2->u.indirect.rc > 0); + assert(sect2->u.indirect.indir_nents > 0); + assert(sect2->u.indirect.indir_ents); /* Set up parameters for transfer of entries */ new_indir_nents1 = sect1->u.indirect.indir_nents + sect2->u.indirect.indir_nents; @@ -3583,7 +3415,7 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H /* Extend the first section's entry array */ if (NULL == (new_indir_ents = (H5HF_free_section_t **)H5MM_realloc( sect1->u.indirect.indir_ents, sizeof(H5HF_free_section_t *) * new_indir_nents1))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for row section pointer array"); sect1->u.indirect.indir_ents = new_indir_ents; /* Transfer the second section's entries to first section */ @@ -3609,7 +3441,7 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H sect1->u.indirect.span_size += sect2->u.indirect.span_size; /* Make certain we've tracked the first section's dependents correctly */ - HDassert(sect1->u.indirect.rc == (sect1->u.indirect.indir_nents + sect1->u.indirect.dir_nrows)); + assert(sect1->u.indirect.rc == (sect1->u.indirect.indir_nents + sect1->u.indirect.dir_nrows)); /* Wrap up, freeing or re-inserting second row section */ /* (want this to be after the first indirect section is consistent again) */ @@ -3618,21 +3450,21 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H /* (indirectly releases second indirect section, since all of it's * other dependents are gone) */ - HDassert(sect2->u.indirect.rc == 1); + assert(sect2->u.indirect.rc == 1); if (H5HF__sect_row_free((H5FS_section_info_t *)row_sect2) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section"); } /* end if */ else { /* Decrement ref. count on second indirect section's parent */ - HDassert(sect2->u.indirect.rc == 0); + assert(sect2->u.indirect.rc == 0); if (sect2->u.indirect.parent) if (H5HF__sect_indirect_decr(sect2->u.indirect.parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, - "can't decrement ref. count on parent indirect section") + "can't decrement ref. count on parent indirect section"); /* Free second indirect section */ if (H5HF__sect_indirect_free(sect2) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node"); /* Re-add the second section's first row */ /* (it's already been added to first indirect section, but it's been removed @@ -3640,16 +3472,16 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H */ row_sect2->sect_info.type = H5HF_FSPACE_SECT_NORMAL_ROW; if (H5HF__space_add(hdr, row_sect2, H5FS_ADD_SKIP_VALID) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't re-add second row section to free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't re-add second row section to free space"); } /* end else */ /* Check if we can create parent indirect section for first section */ /* (i.e. merged indirect sections cover an entire indirect block) */ if (sect1->u.indirect.iblock_entries == sect1->u.indirect.num_entries) { /* Build parent section for fully populated indirect section */ - HDassert(sect1->u.indirect.parent == NULL); + assert(sect1->u.indirect.parent == NULL); if (H5HF__sect_indirect_build_parent(hdr, sect1) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create parent for full indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create parent for full indirect section"); } /* end if */ done: @@ -3664,9 +3496,6 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, H * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, July 21, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -3682,14 +3511,14 @@ H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) FUNC_ENTER_PACKAGE /* Sanity check parameters */ - HDassert(hdr); - HDassert(sect); - HDassert(H5FS_SECT_LIVE == sect->sect_info.state); - HDassert(sect->u.indirect.span_size > 0); - HDassert(sect->u.indirect.iblock_entries > 0); - HDassert(sect->u.indirect.iblock_entries == sect->u.indirect.num_entries); - HDassert(sect->u.indirect.u.iblock); - HDassert(sect->u.indirect.parent == NULL); + assert(hdr); + assert(sect); + assert(H5FS_SECT_LIVE == sect->sect_info.state); + assert(sect->u.indirect.span_size > 0); + assert(sect->u.indirect.iblock_entries > 0); + assert(sect->u.indirect.iblock_entries == sect->u.indirect.num_entries); + assert(sect->u.indirect.u.iblock); + assert(sect->u.indirect.parent == NULL); /* Get information for creating parent indirect section */ if (sect->u.indirect.u.iblock->parent) { @@ -3700,19 +3529,19 @@ H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) else { /* Retrieve the information for the parent block */ if (H5HF__man_iblock_parent_info(hdr, sect->sect_info.addr, &par_block_off, &par_entry) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get block entry") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get block entry"); par_iblock = NULL; } /* end else */ /* Compute row & column for block in parent */ par_row = par_entry / hdr->man_dtable.cparam.width; par_col = par_entry % hdr->man_dtable.cparam.width; - HDassert(par_row >= hdr->man_dtable.max_direct_rows); + assert(par_row >= hdr->man_dtable.max_direct_rows); /* Create parent indirect section */ if (NULL == (par_sect = H5HF__sect_indirect_new(hdr, sect->sect_info.addr, sect->sect_info.size, par_iblock, par_block_off, par_row, par_col, 1))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create indirect section"); /* No rows of direct blocks covered in parent, reset direct row information */ par_sect->u.indirect.dir_nrows = 0; @@ -3722,7 +3551,7 @@ H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) par_sect->u.indirect.indir_nents = 1; if (NULL == (par_sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_malloc(sizeof(H5HF_free_section_t *)))) - HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for indirect section pointer array") + HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "allocation failed for indirect section pointer array"); /* Attach sections together */ sect->u.indirect.parent = par_sect; @@ -3733,7 +3562,7 @@ H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) done: if (ret_value < 0) if (par_sect && H5HF__sect_indirect_free(par_sect) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") + HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF__sect_indirect_build_parent() */ @@ -3746,9 +3575,6 @@ H5HF__sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, July 24, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -3760,34 +3586,34 @@ H5HF__sect_indirect_shrink(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) FUNC_ENTER_PACKAGE /* Sanity check parameters */ - HDassert(hdr); - HDassert(sect); + assert(hdr); + assert(sect); /* Sanity check some assumptions about the indirect section */ - HDassert(sect->u.indirect.dir_nrows > 0 || sect->u.indirect.indir_nents > 0); + assert(sect->u.indirect.dir_nrows > 0 || sect->u.indirect.indir_nents > 0); /* Walk through direct rows, freeing them */ for (u = 0; u < sect->u.indirect.dir_nrows; u++) { /* Remove the normal rows from free space manager */ if (sect->u.indirect.dir_rows[u]->sect_info.type != H5HF_FSPACE_SECT_FIRST_ROW) { - HDassert(sect->u.indirect.dir_rows[u]->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); + assert(sect->u.indirect.dir_rows[u]->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); if (H5HF__space_remove(hdr, sect->u.indirect.dir_rows[u]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove section from heap free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove section from heap free space"); } /* end if */ /* Release the row section */ if (H5HF__sect_row_free_real(sect->u.indirect.dir_rows[u]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free child section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free child section node"); } /* end for */ /* Walk through indirect entries, freeing them (recursively) */ for (u = 0; u < sect->u.indirect.indir_nents; u++) if (H5HF__sect_indirect_shrink(hdr, sect->u.indirect.indir_ents[u]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free child section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free child section node"); /* Free the indirect section itself */ if (H5HF__sect_indirect_free(sect) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free indirect section node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3802,9 +3628,6 @@ H5HF__sect_indirect_shrink(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, July 3, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -3815,21 +3638,21 @@ H5HF__sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(sect); - HDassert(buf); + assert(hdr); + assert(sect); + assert(buf); /* Check if this indirect section has a parent & forward if this section is first */ if (sect->u.indirect.parent) { if (sect->sect_info.addr == sect->u.indirect.parent->sect_info.addr) if (H5HF__sect_indirect_serialize(hdr, sect->u.indirect.parent, buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSERIALIZE, FAIL, - "can't serialize indirect section's parent indirect section") + "can't serialize indirect section's parent indirect section"); } /* end if */ else { /* Indirect range's indirect block's block offset */ if (sect->sect_info.state == H5FS_SECT_LIVE) { - HDassert(sect->u.indirect.u.iblock); + assert(sect->u.indirect.u.iblock); UINT64ENCODE_VAR(buf, sect->u.indirect.u.iblock->block_off, hdr->heap_off_size); } /* end if */ else @@ -3857,9 +3680,6 @@ H5HF__sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, July 3, 2006 - * *------------------------------------------------------------------------- */ static H5FS_section_info_t * @@ -3880,10 +3700,10 @@ H5HF__sect_indirect_deserialize(H5HF_hdr_t *hdr, const uint8_t *buf, haddr_t sec FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(hdr); - HDassert(buf); - HDassert(H5F_addr_defined(sect_addr)); - HDassert(sect_size); + assert(hdr); + assert(buf); + assert(H5_addr_defined(sect_addr)); + assert(sect_size); /* Indirect range's indirect block's block offset */ UINT64DECODE_VAR(buf, iblock_off, hdr->heap_off_size); @@ -3900,7 +3720,7 @@ H5HF__sect_indirect_deserialize(H5HF_hdr_t *hdr, const uint8_t *buf, haddr_t sec /* Create free space section node */ if (NULL == (new_sect = H5HF__sect_indirect_new(hdr, sect_addr, sect_size, NULL, iblock_off, start_row, start_col, nentries))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't create indirect section"); /* Compute start entry */ start_entry = (start_row * hdr->man_dtable.cparam.width) + start_col; @@ -3914,7 +3734,7 @@ H5HF__sect_indirect_deserialize(H5HF_hdr_t *hdr, const uint8_t *buf, haddr_t sec if (H5HF__sect_indirect_init_rows(hdr, new_sect, TRUE, NULL, H5FS_ADD_DESERIALIZING, new_sect->u.indirect.row, new_sect->u.indirect.col, end_row, end_col) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize indirect section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize indirect section"); /* Indicate that this section shouldn't be added to free space manager's list */ *des_flags |= H5FS_DESERIALIZE_NO_ADD; @@ -3935,9 +3755,6 @@ H5HF__sect_indirect_deserialize(H5HF_hdr_t *hdr, const uint8_t *buf, haddr_t sec * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, July 3, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -3948,7 +3765,7 @@ H5HF__sect_indirect_free(H5HF_free_section_t *sect) FUNC_ENTER_PACKAGE - HDassert(sect); + assert(sect); /* Release the memory for tracking direct rows */ sect->u.indirect.dir_rows = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.dir_rows); @@ -3964,7 +3781,7 @@ H5HF__sect_indirect_free(H5HF_free_section_t *sect) /* Release the sections */ if (H5HF__sect_node_free(sect, iblock) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free section node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3978,9 +3795,6 @@ H5HF__sect_indirect_free(H5HF_free_section_t *sect) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, July 21, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -3996,8 +3810,8 @@ H5HF__sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect FUNC_ENTER_PACKAGE_NOERR /* Sanity check arguments */ - HDassert(hdr); - HDassert(sect); + assert(hdr); + assert(sect); /* Compute starting entry, column & row */ start_row = sect->u.indirect.row; @@ -4021,22 +3835,22 @@ H5HF__sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect /* Iterate over direct rows, checking pointer references */ dir_nrows = (max_dir_row - start_row) + 1; - HDassert(dir_nrows == sect->u.indirect.dir_nrows); + assert(dir_nrows == sect->u.indirect.dir_nrows); for (u = 0; u < dir_nrows; u++) { const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_row_sect; /* Pointer to row section */ tmp_row_sect = sect->u.indirect.dir_rows[u]; - HDassert(tmp_row_sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || - tmp_row_sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); - HDassert(tmp_row_sect->u.row.under == sect); - HDassert(tmp_row_sect->u.row.row == (start_row + u)); + assert(tmp_row_sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || + tmp_row_sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); + assert(tmp_row_sect->u.row.under == sect); + assert(tmp_row_sect->u.row.row == (start_row + u)); if (u > 0) { const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_row_sect2; /* Pointer to row section */ tmp_row_sect2 = sect->u.indirect.dir_rows[u - 1]; - HDassert(tmp_row_sect2->u.row.row < tmp_row_sect->u.row.row); - HDassert(H5F_addr_lt(tmp_row_sect2->sect_info.addr, tmp_row_sect->sect_info.addr)); - HDassert(tmp_row_sect2->sect_info.size <= tmp_row_sect->sect_info.size); + assert(tmp_row_sect2->u.row.row < tmp_row_sect->u.row.row); + assert(H5_addr_lt(tmp_row_sect2->sect_info.addr, tmp_row_sect->sect_info.addr)); + assert(tmp_row_sect2->sect_info.size <= tmp_row_sect->sect_info.size); } /* end if */ } /* end for */ } /* end if */ @@ -4045,24 +3859,24 @@ H5HF__sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect if (sect->u.indirect.indir_nents > 0) { /* Basic sanity checks */ if (sect->sect_info.state == H5FS_SECT_LIVE) { - HDassert(sect->u.indirect.iblock_entries); - HDassert(sect->u.indirect.indir_nents <= sect->u.indirect.iblock_entries); + assert(sect->u.indirect.iblock_entries); + assert(sect->u.indirect.indir_nents <= sect->u.indirect.iblock_entries); } /* end if */ - HDassert(sect->u.indirect.indir_ents); + assert(sect->u.indirect.indir_ents); /* Sanity check each child indirect section */ for (u = 0; u < sect->u.indirect.indir_nents; u++) { const H5HF_free_section_t *tmp_child_sect; /* Pointer to child indirect section */ tmp_child_sect = sect->u.indirect.indir_ents[u]; - HDassert(tmp_child_sect->sect_info.type == H5HF_FSPACE_SECT_INDIRECT); - HDassert(tmp_child_sect->u.indirect.parent == sect); + assert(tmp_child_sect->sect_info.type == H5HF_FSPACE_SECT_INDIRECT); + assert(tmp_child_sect->u.indirect.parent == sect); if (u > 0) { const H5HF_free_section_t H5_ATTR_NDEBUG_UNUSED *tmp_child_sect2; /* Pointer to child indirect section */ tmp_child_sect2 = sect->u.indirect.indir_ents[u - 1]; - HDassert(H5F_addr_lt(tmp_child_sect2->sect_info.addr, tmp_child_sect->sect_info.addr)); + assert(H5_addr_lt(tmp_child_sect2->sect_info.addr, tmp_child_sect->sect_info.addr)); } /* end if */ /* Recursively check child indirect section */ @@ -4082,9 +3896,6 @@ H5HF__sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, July 3, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -4093,12 +3904,12 @@ H5HF__sect_indirect_debug(const H5HF_free_section_t *sect, FILE *stream, int ind FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect); + assert(sect); /* Print indirect section information */ - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Row:", sect->u.indirect.row); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Column:", sect->u.indirect.col); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of entries:", sect->u.indirect.num_entries); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Row:", sect->u.indirect.row); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Column:", sect->u.indirect.col); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of entries:", sect->u.indirect.num_entries); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__sect_indirect_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFspace.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFspace.c index c007e1ed0a..2913062fe5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFspace.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFspace.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFspace.c - * May 2 2006 - * Quincey Koziol * * Purpose: Space allocation routines for fractal heaps. * @@ -79,9 +76,6 @@ * * Failure: negative * - * Programmer: Quincey Koziol - * May 2 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -97,14 +91,14 @@ H5HF__space_start(H5HF_hdr_t *hdr, hbool_t may_create) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Check for creating free space info for the heap */ - if (H5F_addr_defined(hdr->fs_addr)) { + if (H5_addr_defined(hdr->fs_addr)) { /* Open an existing free space structure for the heap */ if (NULL == (hdr->fspace = H5FS_open(hdr->f, hdr->fs_addr, NELMTS(classes), classes, hdr, (hsize_t)H5HF_FSPACE_THRHD_DEF, (hsize_t)H5HF_FSPACE_ALIGN_DEF))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info"); } /* end if */ else { /* Check if we are allowed to create the free space manager */ @@ -122,8 +116,8 @@ H5HF__space_start(H5HF_hdr_t *hdr, hbool_t may_create) if (NULL == (hdr->fspace = H5FS_create(hdr->f, &hdr->fs_addr, &fs_create, NELMTS(classes), classes, hdr, (hsize_t)H5HF_FSPACE_THRHD_DEF, (hsize_t)H5HF_FSPACE_ALIGN_DEF))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info") - HDassert(H5F_addr_defined(hdr->fs_addr)); + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize free space info"); + assert(H5_addr_defined(hdr->fs_addr)); } /* end if */ } /* end else */ @@ -140,9 +134,6 @@ H5HF__space_start(H5HF_hdr_t *hdr, hbool_t may_create) * * Failure: negative * - * Programmer: Quincey Koziol - * May 15 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -156,20 +147,20 @@ H5HF__space_add(H5HF_hdr_t *hdr, H5HF_free_section_t *node, unsigned flags) /* * Check arguments. */ - HDassert(hdr); - HDassert(node); + assert(hdr); + assert(node); /* Check if the free space for the heap has been initialized */ if (!hdr->fspace) if (H5HF__space_start(hdr, TRUE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space"); /* Construct user data */ udata.hdr = hdr; /* Add to the free space for the heap */ if (H5FS_sect_add(hdr->f, hdr->fspace, (H5FS_section_info_t *)node, flags, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't add section to heap free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't add section to heap free space"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -183,9 +174,6 @@ H5HF__space_add(H5HF_hdr_t *hdr, H5HF_free_section_t *node, unsigned flags) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * May 2 2006 - * *------------------------------------------------------------------------- */ htri_t @@ -199,19 +187,19 @@ H5HF__space_find(H5HF_hdr_t *hdr, hsize_t request, H5HF_free_section_t **node) /* * Check arguments. */ - HDassert(hdr); - HDassert(request); - HDassert(node); + assert(hdr); + assert(request); + assert(node); /* Check if the free space for the heap has been initialized */ if (!hdr->fspace) if (H5HF__space_start(hdr, FALSE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space"); /* Search for free space in the heap */ if (hdr->fspace) if ((node_found = H5FS_sect_find(hdr->f, hdr->fspace, request, (H5FS_section_info_t **)node)) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap"); /* Set return value */ ret_value = node_found; @@ -230,9 +218,6 @@ H5HF__space_find(H5HF_hdr_t *hdr, hsize_t request, H5HF_free_section_t **node) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Feb 24 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -246,15 +231,15 @@ H5HF__space_revert_root_cb(H5FS_section_info_t *_sect, void H5_ATTR_UNUSED *_uda /* * Check arguments. */ - HDassert(sect); + assert(sect); /* Only modify "live" single blocks... */ if (sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE && sect->sect_info.state == H5FS_SECT_LIVE) { /* Release hold on previous indirect block (we must have one) */ - HDassert(sect->u.single.parent); + assert(sect->u.single.parent); if (H5HF__iblock_decr(sect->u.single.parent) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, - "can't decrement reference count on section's indirect block") + "can't decrement reference count on section's indirect block"); /* Reset parent information */ sect->u.single.parent = NULL; @@ -274,9 +259,6 @@ H5HF__space_revert_root_cb(H5FS_section_info_t *_sect, void H5_ATTR_UNUSED *_uda * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Feb 23 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -289,13 +271,14 @@ H5HF__space_revert_root(const H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Only need to scan the sections if the free space has been initialized */ if (hdr->fspace) /* Iterate over all sections, resetting the parent pointers in 'single' sections */ if (H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF__space_revert_root_cb, NULL) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to reset parent pointers") + HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, + "can't iterate over sections to reset parent pointers"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -311,9 +294,6 @@ H5HF__space_revert_root(const H5HF_hdr_t *hdr) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Feb 24 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -328,24 +308,24 @@ H5HF__space_create_root_cb(H5FS_section_info_t *_sect, void *_udata) /* * Check arguments. */ - HDassert(sect); - HDassert(root_iblock); + assert(sect); + assert(root_iblock); /* Sanity check sections */ /* (If we are switching from a direct block for the root block of the heap, */ /* there should only be 'single' type sections. -QAK) */ - HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE); + assert(sect->sect_info.type == H5HF_FSPACE_SECT_SINGLE); /* Increment ref. count on new root indirect block */ if (H5HF__iblock_incr(root_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, - "can't increment reference count on section's indirect block") + "can't increment reference count on section's indirect block"); /* Set parent info ("live" section must _NOT_ have a parent right now) */ if (sect->sect_info.state == H5FS_SECT_SERIALIZED) sect->sect_info.state = H5FS_SECT_LIVE; /* Mark "live" now */ else - HDassert(!sect->u.single.parent); + assert(!sect->u.single.parent); sect->u.single.parent = root_iblock; sect->u.single.par_entry = 0; @@ -363,9 +343,6 @@ H5HF__space_create_root_cb(H5FS_section_info_t *_sect, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Feb 24 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -378,15 +355,15 @@ H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock) /* * Check arguments. */ - HDassert(hdr); - HDassert(root_iblock); + assert(hdr); + assert(root_iblock); /* Only need to scan the sections if the free space has been initialized */ if (hdr->fspace) /* Iterate over all sections, setting the parent pointers in 'single' sections to the new indirect * block */ if (H5FS_sect_iterate(hdr->f, hdr->fspace, H5HF__space_create_root_cb, root_iblock) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to set parent pointers") + HGOTO_ERROR(H5E_FSPACE, H5E_BADITER, FAIL, "can't iterate over sections to set parent pointers"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -400,9 +377,6 @@ H5HF__space_create_root(const H5HF_hdr_t *hdr, H5HF_indirect_t *root_iblock) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * August 14 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -415,18 +389,18 @@ H5HF__space_size(H5HF_hdr_t *hdr, hsize_t *fs_size) /* * Check arguments. */ - HDassert(hdr); - HDassert(fs_size); + assert(hdr); + assert(fs_size); /* Check if the free space for the heap has been initialized */ if (!hdr->fspace) if (H5HF__space_start(hdr, FALSE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize heap free space"); /* Get free space metadata size */ if (hdr->fspace) { if (H5FS_size(hdr->fspace, fs_size) < 0) - HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info") + HGOTO_ERROR(H5E_FSPACE, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info"); } /* end if */ else *fs_size = 0; @@ -443,9 +417,6 @@ H5HF__space_size(H5HF_hdr_t *hdr, hsize_t *fs_size) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * July 24 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -458,13 +429,13 @@ H5HF__space_remove(H5HF_hdr_t *hdr, H5HF_free_section_t *node) /* * Check arguments. */ - HDassert(hdr); - HDassert(hdr->fspace); - HDassert(node); + assert(hdr); + assert(hdr->fspace); + assert(node); /* Remove from the free space for the heap */ if (H5FS_sect_remove(hdr->f, hdr->fspace, (H5FS_section_info_t *)node) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove section from heap free space") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove section from heap free space"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -479,9 +450,6 @@ H5HF__space_remove(H5HF_hdr_t *hdr, H5HF_free_section_t *node) * * Failure: negative * - * Programmer: Quincey Koziol - * May 2 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -494,7 +462,7 @@ H5HF__space_close(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Check if the free space was ever opened */ if (hdr->fspace) { @@ -502,17 +470,17 @@ H5HF__space_close(H5HF_hdr_t *hdr) /* Retrieve the number of sections for this heap */ if (H5FS_sect_stats(hdr->fspace, NULL, &nsects) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOUNT, FAIL, "can't query free space section count") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOUNT, FAIL, "can't query free space section count"); /* Close the free space for the heap */ if (H5FS_close(hdr->f, hdr->fspace) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info"); hdr->fspace = NULL; /* Check if we can delete the free space manager for this heap */ if (!nsects) { if (H5FS_delete(hdr->f, hdr->fs_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete free space info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDELETE, FAIL, "can't delete free space info"); hdr->fs_addr = HADDR_UNDEF; } /* end if */ } /* end if */ @@ -529,9 +497,6 @@ H5HF__space_close(H5HF_hdr_t *hdr) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Aug 7 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -544,11 +509,11 @@ H5HF__space_delete(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Delete the free space manager */ if (H5FS_delete(hdr->f, hdr->fs_addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't delete to free space manager") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't delete to free space manager"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -563,9 +528,6 @@ H5HF__space_delete(H5HF_hdr_t *hdr) * * Failure: negative * - * Programmer: Quincey Koziol - * July 10 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -578,13 +540,13 @@ H5HF__space_sect_change_class(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, uint16 /* * Check arguments. */ - HDassert(hdr); - HDassert(hdr->fspace); - HDassert(sect); + assert(hdr); + assert(hdr->fspace); + assert(sect); /* Notify the free space manager that a section has changed class */ if (H5FS_sect_change_class(hdr->f, hdr->fspace, (H5FS_section_info_t *)sect, new_class) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMODIFY, FAIL, "can't modify class of free space section") + HGOTO_ERROR(H5E_HEAP, H5E_CANTMODIFY, FAIL, "can't modify class of free space section"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFstat.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFstat.c index 542d12b8e4..411ad7ab79 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFstat.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFstat.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Monday, March 6, 2006 - * +/* * Purpose: Fractal heap metadata statistics functions. * */ @@ -68,9 +65,6 @@ * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, March 6, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -79,8 +73,8 @@ H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); - HDassert(stats); + assert(fh); + assert(stats); /* Report statistics for fractal heap */ stats->man_size = fh->hdr->man_size; @@ -107,9 +101,6 @@ H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats) * * Return: non-negative on success, negative on error * - * Programmer: Vailin Choi - * July 12 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -125,8 +116,8 @@ H5HF_size(const H5HF_t *fh, hsize_t *heap_size) /* * Check arguments. */ - HDassert(fh); - HDassert(heap_size); + assert(fh); + assert(heap_size); /* Get "convenience" pointer to fractal heap header */ hdr = fh->hdr; @@ -137,35 +128,35 @@ H5HF_size(const H5HF_t *fh, hsize_t *heap_size) *heap_size += hdr->huge_size; /* "huge" object storage */ /* Check for indirect blocks for managed objects */ - if (H5F_addr_defined(hdr->man_dtable.table_addr) && hdr->man_dtable.curr_root_rows != 0) + if (H5_addr_defined(hdr->man_dtable.table_addr) && hdr->man_dtable.curr_root_rows != 0) if (H5HF__man_iblock_size(hdr->f, hdr, hdr->man_dtable.table_addr, hdr->man_dtable.curr_root_rows, NULL, 0, heap_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, - "unable to get fractal heap storage info for indirect block") + "unable to get fractal heap storage info for indirect block"); /* Check for B-tree storage of huge objects in fractal heap */ - if (H5F_addr_defined(hdr->huge_bt2_addr)) { + if (H5_addr_defined(hdr->huge_bt2_addr)) { /* Open the huge object index v2 B-tree */ if (NULL == (bt2 = H5B2_open(hdr->f, hdr->huge_bt2_addr, hdr->f))) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for tracking 'huge' objects") + "unable to open v2 B-tree for tracking 'huge' objects"); /* Get the B-tree storage */ if (H5B2_size(bt2, heap_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info"); } /* end if */ /* Get storage for free-space tracking info */ - if (H5F_addr_defined(hdr->fs_addr)) { + if (H5_addr_defined(hdr->fs_addr)) { if (H5HF__space_size(hdr, &meta_size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve FS meta storage info"); *heap_size += meta_size; } /* end if */ done: /* Release resources */ if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for tracking 'huge' objects") + HDONE_ERROR(H5E_HEAP, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for tracking 'huge' objects"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_size() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFtest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFtest.c index 84734d2a43..8605163f1e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFtest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFtest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Thursday, February 3, 2006 - * +/* * Purpose: Fractal heap testing functions. * */ @@ -70,9 +67,6 @@ * * Failure: negative * - * Programmer: Quincey Koziol - * Friday, February 24, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -81,8 +75,8 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); - HDassert(cparam); + assert(fh); + assert(cparam); /* Get fractal heap creation parameters */ if (fh->hdr->id_len == (unsigned)(1 + fh->hdr->heap_off_size + fh->hdr->heap_len_size)) @@ -106,9 +100,6 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 14, 2006 - * *------------------------------------------------------------------------- */ int @@ -119,46 +110,46 @@ H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(cparam1); - HDassert(cparam2); + assert(cparam1); + assert(cparam2); /* Compare doubling table parameters */ if (cparam1->managed.width < cparam2->managed.width) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->managed.width > cparam2->managed.width) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->managed.start_block_size < cparam2->managed.start_block_size) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->managed.start_block_size > cparam2->managed.start_block_size) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->managed.max_direct_size < cparam2->managed.max_direct_size) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->managed.max_direct_size > cparam2->managed.max_direct_size) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->managed.max_index < cparam2->managed.max_index) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->managed.max_index > cparam2->managed.max_index) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->managed.start_root_rows < cparam2->managed.start_root_rows) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->managed.start_root_rows > cparam2->managed.start_root_rows) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Compare other general parameters for heap */ if (cparam1->max_man_size < cparam2->max_man_size) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->max_man_size > cparam2->max_man_size) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cparam1->id_len < cparam2->id_len) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->id_len > cparam2->id_len) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Compare "important" parameters for any I/O pipeline filters */ if (cparam1->pline.nused < cparam2->pline.nused) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->pline.nused > cparam2->pline.nused) - HGOTO_DONE(1) + HGOTO_DONE(1); else { size_t u, v; /* Local index variables */ @@ -166,15 +157,15 @@ H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2) for (u = 0; u < cparam1->pline.nused; u++) { /* Check filter ID */ if (cparam1->pline.filter[u].id < cparam2->pline.filter[u].id) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->pline.filter[u].id > cparam2->pline.filter[u].id) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Check filter flags */ if (cparam1->pline.filter[u].flags < cparam2->pline.filter[u].flags) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->pline.filter[u].flags > cparam2->pline.filter[u].flags) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Don't worry about comparing the filter names right now... */ /* (they are expanded during the encode/decode process, but aren't copied @@ -183,27 +174,27 @@ H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2) #if 0 /* Check filter name */ if(!cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if(cparam1->pline.filter[u].name && !cparam2->pline.filter[u].name) - HGOTO_DONE(1) + HGOTO_DONE(1); else if(cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) { if((ret_value = HDstrcmp(cparam1->pline.filter[u].name, cparam2->pline.filter[u].name))) - HGOTO_DONE(ret_value) + HGOTO_DONE(ret_value); } /* end if */ #endif /* Check # of filter parameters */ if (cparam1->pline.filter[u].cd_nelmts < cparam2->pline.filter[u].cd_nelmts) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->pline.filter[u].cd_nelmts > cparam2->pline.filter[u].cd_nelmts) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Check filter parameters */ for (v = 0; v < cparam1->pline.filter[u].cd_nelmts; v++) { if (cparam1->pline.filter[u].cd_values[v] < cparam2->pline.filter[u].cd_values[v]) - HGOTO_DONE(-1) + HGOTO_DONE(-1); else if (cparam1->pline.filter[u].cd_values[v] > cparam2->pline.filter[u].cd_values[v]) - HGOTO_DONE(1) + HGOTO_DONE(1); } /* end for */ } /* end for */ @@ -222,9 +213,6 @@ H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2) * * Failure: 0 * - * Programmer: Quincey Koziol - * Monday, May 22, 2006 - * *------------------------------------------------------------------------- */ unsigned @@ -235,7 +223,7 @@ H5HF_get_max_root_rows(const H5HF_t *fh) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); + assert(fh); /* Return max. # of rows in root indirect block */ ret_value = fh->hdr->man_dtable.max_root_rows; @@ -252,9 +240,6 @@ H5HF_get_max_root_rows(const H5HF_t *fh) * * Failure: 0 * - * Programmer: Quincey Koziol - * Monday, May 22, 2006 - * *------------------------------------------------------------------------- */ unsigned @@ -265,7 +250,7 @@ H5HF_get_dtable_width_test(const H5HF_t *fh) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); + assert(fh); /* Return width of doubling table */ ret_value = fh->hdr->man_dtable.cparam.width; @@ -282,9 +267,6 @@ H5HF_get_dtable_width_test(const H5HF_t *fh) * * Failure: 0 * - * Programmer: Quincey Koziol - * Monday, May 22, 2006 - * *------------------------------------------------------------------------- */ unsigned @@ -295,7 +277,7 @@ H5HF_get_dtable_max_drows_test(const H5HF_t *fh) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); + assert(fh); /* Return max. # of direct blocks in any indirect block */ ret_value = fh->hdr->man_dtable.max_direct_rows; @@ -316,9 +298,6 @@ H5HF_get_dtable_max_drows_test(const H5HF_t *fh) * * Failure: 0 * - * Programmer: Quincey Koziol - * Monday, May 22, 2006 - * *------------------------------------------------------------------------- */ unsigned @@ -329,8 +308,8 @@ H5HF_get_iblock_max_drows_test(const H5HF_t *fh, unsigned pos) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); - HDassert(pos); + assert(fh); + assert(pos); /* Return max. # of direct blocks in this indirect block row */ ret_value = pos + (fh->hdr->man_dtable.max_direct_bits - fh->hdr->man_dtable.first_row_bits) + 1; @@ -347,9 +326,6 @@ H5HF_get_iblock_max_drows_test(const H5HF_t *fh, unsigned pos) * * Failure: 0 * - * Programmer: Quincey Koziol - * Monday, May 15, 2006 - * *------------------------------------------------------------------------- */ hsize_t @@ -360,7 +336,7 @@ H5HF_get_dblock_size_test(const H5HF_t *fh, unsigned row) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); + assert(fh); /* Return direct block free space */ ret_value = fh->hdr->man_dtable.row_block_size[row]; @@ -378,9 +354,6 @@ H5HF_get_dblock_size_test(const H5HF_t *fh, unsigned row) * * Failure: 0 * - * Programmer: Quincey Koziol - * Monday, April 10, 2006 - * *------------------------------------------------------------------------- */ hsize_t @@ -391,7 +364,7 @@ H5HF_get_dblock_free_test(const H5HF_t *fh, unsigned row) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); + assert(fh); /* Return direct block free space */ ret_value = fh->hdr->man_dtable.row_tot_dblock_free[row]; @@ -408,9 +381,6 @@ H5HF_get_dblock_free_test(const H5HF_t *fh, unsigned row) * * Failure: negative * - * Programmer: Quincey Koziol - * Monday, May 15, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -421,10 +391,10 @@ H5HF_get_id_off_test(const H5HF_t *fh, const void *_id, hsize_t *obj_off) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); - HDassert(fh->hdr); - HDassert(id); - HDassert(obj_off); + assert(fh); + assert(fh->hdr); + assert(id); + assert(obj_off); /* Get the offset for a 'normal' heap ID */ id++; @@ -441,9 +411,6 @@ H5HF_get_id_off_test(const H5HF_t *fh, const void *_id, hsize_t *obj_off) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 14, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -454,8 +421,8 @@ H5HF_get_id_type_test(const void *_id, unsigned char *obj_type) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(id); - HDassert(obj_type); + assert(id); + assert(obj_type); /* Get the type for a heap ID */ *obj_type = (uint8_t)(*id & H5HF_ID_TYPE_MASK); @@ -471,9 +438,6 @@ H5HF_get_id_type_test(const void *_id, unsigned char *obj_type) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 14, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -482,10 +446,10 @@ H5HF_get_tiny_info_test(const H5HF_t *fh, size_t *max_len, hbool_t *len_extended FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); - HDassert(fh->hdr); - HDassert(max_len); - HDassert(len_extended); + assert(fh); + assert(fh->hdr); + assert(max_len); + assert(len_extended); /* Retrieve information about tiny object's ID encoding in a heap */ *max_len = fh->hdr->tiny_max_len; @@ -502,9 +466,6 @@ H5HF_get_tiny_info_test(const H5HF_t *fh, size_t *max_len, hbool_t *len_extended * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Monday, August 14, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -513,9 +474,9 @@ H5HF_get_huge_info_test(const H5HF_t *fh, hsize_t *next_id, hbool_t *ids_direct) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments. */ - HDassert(fh); - HDassert(fh->hdr); - HDassert(ids_direct); + assert(fh); + assert(fh->hdr); + assert(ids_direct); /* Retrieve information about tiny object's ID encoding in a heap */ if (next_id) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HFtiny.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HFtiny.c index f1fcf90318..e303b33278 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HFtiny.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HFtiny.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HFtiny.c - * Aug 14 2006 - * Quincey Koziol * * Purpose: Routines for "tiny" objects in fractal heap * @@ -79,9 +76,6 @@ static herr_t H5HF__tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operat * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -92,7 +86,7 @@ H5HF__tiny_init(H5HF_hdr_t *hdr) /* * Check arguments. */ - HDassert(hdr); + assert(hdr); /* Compute information about 'tiny' objects for the heap */ @@ -124,9 +118,6 @@ H5HF__tiny_init(H5HF_hdr_t *hdr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -141,11 +132,11 @@ H5HF__tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) /* * Check arguments. */ - HDassert(hdr); - HDassert(obj_size <= hdr->tiny_max_len); - HDassert(obj_size <= (H5HF_TINY_MASK_EXT + 1)); - HDassert(obj); - HDassert(id); + assert(hdr); + assert(obj_size <= hdr->tiny_max_len); + assert(obj_size <= (H5HF_TINY_MASK_EXT + 1)); + assert(obj); + assert(id); /* Adjust object's size for encoding it */ enc_obj_size = obj_size - 1; @@ -161,7 +152,7 @@ H5HF__tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) } /* end else */ H5MM_memcpy(id, obj, obj_size); - HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); + memset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); /* Update statistics about heap */ hdr->tiny_size += obj_size; @@ -169,7 +160,7 @@ H5HF__tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) /* Mark heap header as modified */ if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -182,9 +173,6 @@ H5HF__tiny_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Aug 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -197,9 +185,9 @@ H5HF__tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(obj_len_p); + assert(hdr); + assert(id); + assert(obj_len_p); /* Check if 'tiny' object ID is in extended form, and retrieve encoded size */ if (!hdr->tiny_len_extended) @@ -223,9 +211,6 @@ H5HF__tiny_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -239,9 +224,9 @@ H5HF__tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(op); + assert(hdr); + assert(id); + assert(op); /* Get the object's encoded length */ /* H5HF__tiny_obj_len can't fail */ @@ -260,7 +245,7 @@ H5HF__tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void /* Call the user's 'op' callback */ if (op(id, enc_obj_size, op_data) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "application's callback failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "application's callback failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -273,9 +258,6 @@ H5HF__tiny_op_real(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 8 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -288,13 +270,13 @@ H5HF__tiny_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(obj); + assert(hdr); + assert(id); + assert(obj); /* Call the internal 'op' routine */ if (H5HF__tiny_op_real(hdr, id, H5HF__op_read, obj) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -307,9 +289,6 @@ H5HF__tiny_read(H5HF_hdr_t *hdr, const uint8_t *id, void *obj) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sept 11 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -322,13 +301,13 @@ H5HF__tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_d /* * Check arguments. */ - HDassert(hdr); - HDassert(id); - HDassert(op); + assert(hdr); + assert(id); + assert(op); /* Call the internal 'op' routine routine */ if (H5HF__tiny_op_real(hdr, id, op, op_data) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object") + HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -341,9 +320,6 @@ H5HF__tiny_op(H5HF_hdr_t *hdr, const uint8_t *id, H5HF_operator_t op, void *op_d * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Aug 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -357,8 +333,8 @@ H5HF__tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id) /* * Check arguments. */ - HDassert(hdr); - HDassert(id); + assert(hdr); + assert(id); /* Get the object's encoded length */ /* H5HF__tiny_obj_len can't fail */ @@ -370,7 +346,7 @@ H5HF__tiny_remove(H5HF_hdr_t *hdr, const uint8_t *id) /* Mark heap header as modified */ if (H5HF__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDIRTY, FAIL, "can't mark heap header as dirty"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HG.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HG.c index 6362ea2e26..5e573fa750 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HG.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HG.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Friday, March 27, 1998 - * * Purpose: Operations on the global heap. The global heap is the set of * all collections and each collection contains one or more * global heap objects. An object belongs to exactly one @@ -115,9 +111,6 @@ H5FL_BLK_DEFINE(gheap_chunk); * * Failure: NULL * - * Programmer: Robb Matzke - * Friday, March 27, 1998 - * *------------------------------------------------------------------------- */ static haddr_t @@ -132,7 +125,7 @@ H5HG__create(H5F_t *f, size_t size) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); + assert(f); if (size < H5HG_MINSIZE) size = H5HG_MINSIZE; size = H5HG_ALIGN(size); @@ -140,20 +133,20 @@ H5HG__create(H5F_t *f, size_t size) /* Create it */ H5_CHECK_OVERFLOW(size, size_t, hsize_t); if (HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_GHEAP, (hsize_t)size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap"); if (NULL == (heap = H5FL_CALLOC(H5HG_heap_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed"); heap->addr = addr; heap->size = size; heap->shared = H5F_SHARED(f); if (NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") - HDmemset(heap->chunk, 0, size); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed"); + memset(heap->chunk, 0, size); heap->nalloc = H5HG_NOBJS(f, size); heap->nused = 1; /* account for index 0, which is used for the free object */ if (NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, heap->nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed"); /* Initialize the header */ H5MM_memcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -170,51 +163,43 @@ H5HG__create(H5F_t *f, size_t size) * align the pointer, but this might not be the case. */ n = (size_t)H5HG_ALIGN(p - heap->chunk) - (size_t)(p - heap->chunk); -#ifdef OLD_WAY - /* Don't bother zeroing out the rest of the info in the heap -QAK */ - HDmemset(p, 0, n); -#endif /* OLD_WAY */ p += n; /* The freespace object */ heap->obj[0].size = size - H5HG_SIZEOF_HDR(f); - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + assert(H5HG_ISALIGNED(heap->obj[0].size)); heap->obj[0].nrefs = 0; heap->obj[0].begin = p; UINT16ENCODE(p, 0); /*object ID*/ UINT16ENCODE(p, 0); /*reference count*/ UINT32ENCODE(p, 0); /*reserved*/ H5F_ENCODE_LENGTH(f, p, heap->obj[0].size); -#ifdef OLD_WAY - /* Don't bother zeroing out the rest of the info in the heap -QAK */ - HDmemset(p, 0, (size_t)((heap->chunk + heap->size) - p)); -#endif /* OLD_WAY */ /* Add this heap to the beginning of the CWFS list */ if (H5F_cwfs_add(f, heap) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, - "unable to add global heap collection to file's CWFS") + "unable to add global heap collection to file's CWFS"); /* Add the heap to the cache */ if (H5AC_insert_entry(f, H5AC_GHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to cache global heap collection"); ret_value = addr; done: /* Cleanup on error */ - if (!H5F_addr_defined(ret_value)) { - if (H5F_addr_defined(addr)) { + if (!H5_addr_defined(ret_value)) { + if (H5_addr_defined(addr)) { /* Release the space on disk */ if (H5MF_xfree(f, H5FD_MEM_GHEAP, addr, (hsize_t)size) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, HADDR_UNDEF, "unable to free global heap") + HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, HADDR_UNDEF, "unable to free global heap"); /* Check if the heap object was allocated */ if (heap) /* Destroy the heap object */ if (H5HG__free(heap) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, - "unable to destroy global heap collection") + "unable to destroy global heap collection"); } /* end if */ } /* end if */ @@ -228,9 +213,6 @@ H5HG__create(H5F_t *f, size_t size) * * Return: Pointer to indirect block on success, NULL on failure * - * Programmer: Quincey Koziol - * Wednesday, May 5, 2010 - * *------------------------------------------------------------------------- */ H5HG_heap_t * @@ -242,15 +224,15 @@ H5HG__protect(H5F_t *f, haddr_t addr, unsigned flags) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(H5_addr_defined(addr)); /* only H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Lock the heap into memory */ if (NULL == (heap = (H5HG_heap_t *)H5AC_protect(f, H5AC_GHEAP, addr, f, flags))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap"); /* Set the heap's address */ heap->addr = addr; @@ -275,9 +257,6 @@ H5HG__protect(H5F_t *f, haddr_t addr, unsigned flags) * * Failure: 0 * - * Programmer: Robb Matzke - * Friday, March 27, 1998 - * *------------------------------------------------------------------------- */ static size_t @@ -291,9 +270,9 @@ H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(heap); - HDassert(heap->obj[0].size >= need); - HDassert(heap_flags_ptr); + assert(heap); + assert(heap->obj[0].size >= need); + assert(heap_flags_ptr); /* * Find an ID for the new object. ID zero is reserved for the free space @@ -307,7 +286,7 @@ H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) break; } /* end else */ - HDassert(idx < heap->nused); + assert(idx < heap->nused); /* Check if we need more room to store heap objects */ if (idx >= heap->nalloc) { @@ -317,19 +296,19 @@ H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) /* Determine the new number of objects to index */ /* nalloc is *not* guaranteed to be a power of 2! - NAF 10/26/09 */ new_alloc = MIN(MAX(heap->nalloc * 2, (idx + 1)), (H5HG_MAXIDX + 1)); - HDassert(idx < new_alloc); + assert(idx < new_alloc); /* Reallocate array of objects */ if (NULL == (new_obj = H5FL_SEQ_REALLOC(H5HG_obj_t, heap->obj, new_alloc))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, 0, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, 0, "memory allocation failed"); /* Clear newly allocated space */ - HDmemset(&new_obj[heap->nalloc], 0, (new_alloc - heap->nalloc) * sizeof(heap->obj[0])); + memset(&new_obj[heap->nalloc], 0, (new_alloc - heap->nalloc) * sizeof(heap->obj[0])); /* Update heap information */ heap->nalloc = new_alloc; heap->obj = new_obj; - HDassert(heap->nalloc > heap->nused); + assert(heap->nalloc > heap->nused); } /* end if */ /* Initialize the new object */ @@ -362,7 +341,7 @@ H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) UINT16ENCODE(p, 0); /*nrefs*/ UINT32ENCODE(p, 0); /*reserved*/ H5F_ENCODE_LENGTH(f, p, heap->obj[0].size); - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + assert(H5HG_ISALIGNED(heap->obj[0].size)); } /* end else-if */ else { /* @@ -371,7 +350,7 @@ H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) */ heap->obj[0].size -= need; heap->obj[0].begin += need; - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + assert(H5HG_ISALIGNED(heap->obj[0].size)); } /* Mark the heap as dirty */ @@ -381,7 +360,7 @@ H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) ret_value = idx; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5HG__alloc() */ /*------------------------------------------------------------------------- @@ -396,9 +375,6 @@ H5HG__alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) * * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, June 12, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -415,17 +391,17 @@ H5HG_extend(H5F_t *f, haddr_t addr, size_t need) FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(H5_addr_defined(addr)); /* Protect the heap */ if (NULL == (heap = H5HG__protect(f, addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap"); /* Re-allocate the heap information in memory */ if (NULL == (new_chunk = H5FL_BLK_REALLOC(gheap_chunk, heap->chunk, (heap->size + need)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "new heap allocation failed") - HDmemset(new_chunk + heap->size, 0, need); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "new heap allocation failed"); + memset(new_chunk + heap->size, 0, need); /* Adjust the size of the heap */ old_size = heap->size; @@ -452,18 +428,18 @@ H5HG_extend(H5F_t *f, haddr_t addr, size_t need) UINT16ENCODE(p, 0); /*nrefs*/ UINT32ENCODE(p, 0); /*reserved*/ H5F_ENCODE_LENGTH(f, p, heap->obj[0].size); - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); + assert(H5HG_ISALIGNED(heap->obj[0].size)); /* Resize the heap in the cache */ if (H5AC_resize_entry(heap, heap->size) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize global heap in cache") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "unable to resize global heap in cache"); /* Mark the heap as dirty */ heap_flags |= H5AC__DIRTIED_FLAG; done: if (heap && H5AC_unprotect(f, H5AC_GHEAP, heap->addr, heap, heap_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to unprotect heap") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to unprotect heap"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HG_extend() */ @@ -485,9 +461,6 @@ H5HG_extend(H5F_t *f, haddr_t addr, size_t need) * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, March 27, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -503,12 +476,12 @@ H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj /*out*/) FUNC_ENTER_NOAPI_TAG(H5AC__GLOBALHEAP_TAG, FAIL) /* Check args */ - HDassert(f); - HDassert(0 == size || obj); - HDassert(hobj); + assert(f); + assert(0 == size || obj); + assert(hobj); if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file"); /* Find a large enough collection on the CWFS list */ need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); @@ -516,36 +489,30 @@ H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj /*out*/) /* Look for a heap in the file's CWFS that has enough space for the object */ addr = HADDR_UNDEF; if (H5F_cwfs_find_free_heap(f, need, &addr) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "error trying to locate heap") + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "error trying to locate heap"); /* * If we didn't find any collection with enough free space then allocate a * new collection large enough for the message plus the collection header. */ - if (!H5F_addr_defined(addr)) { + if (!H5_addr_defined(addr)) { addr = H5HG__create(f, need + H5HG_SIZEOF_HDR(f)); - if (!H5F_addr_defined(addr)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to allocate a global heap collection") + if (!H5_addr_defined(addr)) + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to allocate a global heap collection"); } /* end if */ - HDassert(H5F_addr_defined(addr)); + assert(H5_addr_defined(addr)); if (NULL == (heap = H5HG__protect(f, addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap"); /* Split the free space to make room for the new object */ if (0 == (idx = H5HG__alloc(f, heap, size, &heap_flags))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate global heap object") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate global heap object"); /* Copy data into the heap */ - if (size > 0) { + if (size > 0) H5MM_memcpy(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f), obj, size); -#ifdef OLD_WAY - /* Don't bother zeroing out the rest of the info in the heap -QAK */ - HDmemset(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f) + size, 0, - need - (H5HG_SIZEOF_OBJHDR(f) + size)); -#endif /* OLD_WAY */ - } /* end if */ heap_flags |= H5AC__DIRTIED_FLAG; /* Return value */ @@ -554,7 +521,7 @@ H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj /*out*/) done: if (heap && H5AC_unprotect(f, H5AC_GHEAP, heap->addr, heap, heap_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to unprotect heap.") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to unprotect heap."); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5HG_insert() */ @@ -571,9 +538,6 @@ H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj /*out*/) * * Failure: NULL * - * Programmer: Robb Matzke - * Monday, March 30, 1998 - * *------------------------------------------------------------------------- */ void * @@ -588,21 +552,21 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object /*out*/, size_t *buf_size) FUNC_ENTER_NOAPI_TAG(H5AC__GLOBALHEAP_TAG, NULL) /* Check args */ - HDassert(f); - HDassert(hobj); + assert(f); + assert(hobj); /* Load the heap */ if (NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, NULL, "unable to protect global heap"); - HDassert(hobj->idx < heap->nused); - HDassert(heap->obj[hobj->idx].begin); + assert(hobj->idx < heap->nused); + assert(heap->obj[hobj->idx].begin); size = heap->obj[hobj->idx].size; p = heap->obj[hobj->idx].begin + H5HG_SIZEOF_OBJHDR(f); /* Allocate a buffer for the object read in, if the user didn't give one */ if (!object && NULL == (object = H5MM_malloc(size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5MM_memcpy(object, p, size); /* @@ -611,7 +575,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object /*out*/, size_t *buf_size) */ if (heap->obj[0].begin) { if (H5F_cwfs_advance_heap(f, heap, FALSE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMODIFY, NULL, "can't adjust file's CWFS") + HGOTO_ERROR(H5E_HEAP, H5E_CANTMODIFY, NULL, "can't adjust file's CWFS"); } /* end if */ /* If the caller would like to know the heap object's size, set that */ @@ -623,7 +587,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object /*out*/, size_t *buf_size) done: if (heap && H5AC_unprotect(f, H5AC_GHEAP, hobj->addr, heap, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, NULL, "unable to release object header"); if (NULL == ret_value && NULL == orig_object && object) H5MM_free(object); @@ -644,9 +608,6 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object /*out*/, size_t *buf_size) * * Failure: Negative * - * Programmer: Robb Matzke - * Monday, March 30, 1998 - * *------------------------------------------------------------------------- */ int @@ -659,22 +620,22 @@ H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust) FUNC_ENTER_NOAPI_TAG(H5AC__GLOBALHEAP_TAG, FAIL) /* Check args */ - HDassert(f); - HDassert(hobj); + assert(f); + assert(hobj); if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file"); /* Load the heap */ if (NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap"); if (adjust != 0) { - HDassert(hobj->idx < heap->nused); - HDassert(heap->obj[hobj->idx].begin); + assert(hobj->idx < heap->nused); + assert(heap->obj[hobj->idx].begin); if ((heap->obj[hobj->idx].nrefs + adjust) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "new link count would be out of range") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "new link count would be out of range"); if ((heap->obj[hobj->idx].nrefs + adjust) > H5HG_MAXLINK) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "new link count would be out of range") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "new link count would be out of range"); heap->obj[hobj->idx].nrefs += adjust; heap_flags |= H5AC__DIRTIED_FLAG; } /* end if */ @@ -684,7 +645,7 @@ H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust) done: if (heap && H5AC_unprotect(f, H5AC_GHEAP, hobj->addr, heap, heap_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5HG_link() */ @@ -697,9 +658,6 @@ H5HG_link(H5F_t *f, const H5HG_t *hobj, int adjust) * * Failure: Negative * - * Programmer: Neil Fortner - * Thursday, February 12, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -711,23 +669,23 @@ H5HG_get_obj_size(H5F_t *f, H5HG_t *hobj, size_t *obj_size) FUNC_ENTER_NOAPI_TAG(H5AC__GLOBALHEAP_TAG, FAIL) /* Check args */ - HDassert(f); - HDassert(hobj); - HDassert(obj_size); + assert(f); + assert(hobj); + assert(obj_size); /* Load the heap */ if (NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap"); - HDassert(hobj->idx < heap->nused); - HDassert(heap->obj[hobj->idx].begin); + assert(hobj->idx < heap->nused); + assert(heap->obj[hobj->idx].begin); /* Set object size */ *obj_size = heap->obj[hobj->idx].size; done: if (heap && H5AC_unprotect(f, H5AC_GHEAP, hobj->addr, heap, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5HG_get_obj_size() */ @@ -739,9 +697,6 @@ H5HG_get_obj_size(H5F_t *f, H5HG_t *hobj, size_t *obj_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, March 30, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -757,23 +712,23 @@ H5HG_remove(H5F_t *f, H5HG_t *hobj) FUNC_ENTER_NOAPI_TAG(H5AC__GLOBALHEAP_TAG, FAIL) /* Check args */ - HDassert(f); - HDassert(hobj); + assert(f); + assert(hobj); if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "no write intent on file"); /* Load the heap */ if (NULL == (heap = H5HG__protect(f, hobj->addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap"); - HDassert(hobj->idx < heap->nused); + assert(hobj->idx < heap->nused); /* When the application selects the same location to rewrite the VL element by using H5Sselect_elements, * it can happen that the entry has been removed by first rewrite. Here we simply skip the removal of * the entry and let the second rewrite happen (see HDFFV-10635). In the future, it'd be nice to handle * this situation in H5T_conv_vlen in H5Tconv.c instead of this level (HDFFV-10648). */ if (heap->obj[hobj->idx].nrefs == 0 && heap->obj[hobj->idx].size == 0 && !heap->obj[hobj->idx].begin) - HGOTO_DONE(ret_value) + HGOTO_DONE(ret_value); obj_start = heap->obj[hobj->idx].begin; /* Include object header size */ @@ -790,7 +745,7 @@ H5HG_remove(H5F_t *f, H5HG_t *hobj) } /* end if */ else heap->obj[0].size += need; - HDmemmove(obj_start, obj_start + need, heap->size - (size_t)((obj_start + need) - heap->chunk)); + memmove(obj_start, obj_start + need, heap->size - (size_t)((obj_start + need) - heap->chunk)); if (heap->obj[0].size >= H5HG_SIZEOF_OBJHDR(f)) { p = heap->obj[0].begin; UINT16ENCODE(p, 0); /*id*/ @@ -798,7 +753,7 @@ H5HG_remove(H5F_t *f, H5HG_t *hobj) UINT32ENCODE(p, 0); /*reserved*/ H5F_ENCODE_LENGTH(f, p, heap->obj[0].size); } /* end if */ - HDmemset(heap->obj + hobj->idx, 0, sizeof(H5HG_obj_t)); + memset(heap->obj + hobj->idx, 0, sizeof(H5HG_obj_t)); flags |= H5AC__DIRTIED_FLAG; if ((heap->obj[0].size + H5HG_SIZEOF_HDR(f)) == heap->size) { @@ -817,14 +772,14 @@ H5HG_remove(H5F_t *f, H5HG_t *hobj) * heap isn't on the CWFS list then add it to the end. */ if (H5F_cwfs_advance_heap(f, heap, TRUE) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMODIFY, FAIL, "can't adjust file's CWFS") + HGOTO_ERROR(H5E_HEAP, H5E_CANTMODIFY, FAIL, "can't adjust file's CWFS"); } /* end else */ done: if (heap && H5AC_unprotect(f, H5AC_GHEAP, hobj->addr, heap, flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); - FUNC_LEAVE_NOAPI_TAG(ret_value); + FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5HG_remove() */ /*------------------------------------------------------------------------- @@ -834,9 +789,6 @@ H5HG_remove(H5F_t *f, H5HG_t *hobj) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, January 15, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -847,11 +799,11 @@ H5HG__free(H5HG_heap_t *heap) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(heap); + assert(heap); /* Remove the heap from the CWFS list */ if (H5F_cwfs_remove_heap(heap->shared, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove heap from file's CWFS") + HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove heap from file's CWFS"); if (heap->chunk) heap->chunk = H5FL_BLK_FREE(gheap_chunk, heap->chunk); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HGcache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HGcache.c index ddcf8a1773..ecce815f87 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HGcache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HGcache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5HGcache.c - * Feb 5 2008 - * Quincey Koziol * - * Purpose: Implement global heap metadata cache methods. + * Purpose: Implement global heap metadata cache methods * *------------------------------------------------------------------------- */ @@ -31,12 +28,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5HGpkg.h" /* Global heaps */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ +#include "H5HGpkg.h" /* Global heaps */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ /****************/ /* Local Macros */ @@ -64,7 +61,7 @@ static herr_t H5HG__cache_heap_serialize(const H5F_t *f, void *image, size_t len static herr_t H5HG__cache_heap_free_icr(void *thing); /* Prefix deserialization */ -static herr_t H5HG__hdr_deserialize(H5HG_heap_t *heap, const uint8_t *image, const H5F_t *f); +static herr_t H5HG__hdr_deserialize(H5HG_heap_t *heap, const uint8_t *image, size_t len, const H5F_t *f); /*********************/ /* Package Variables */ @@ -97,65 +94,64 @@ const H5AC_class_t H5AC_GHEAP[1] = {{ /*******************/ /*------------------------------------------------------------------------- - * Function: H5HG__hdr_deserialize() + * Function: H5HG__hdr_deserialize * - * Purpose: Decode a global heap's header - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * December 15, 2016 + * Purpose: Decode a global heap's header * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5HG__hdr_deserialize(H5HG_heap_t *heap, const uint8_t *image, const H5F_t *f) +H5HG__hdr_deserialize(H5HG_heap_t *heap, const uint8_t *image, size_t len, const H5F_t *f) { - herr_t ret_value = SUCCEED; /* Return value */ + const uint8_t *p_end = image + len - 1; /* End of image buffer */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(heap); - HDassert(image); - HDassert(f); + assert(heap); + assert(image); + assert(f); /* Magic number */ - if (HDmemcmp(image, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad global heap collection signature") + if (H5_IS_BUFFER_OVERFLOW(image, H5_SIZEOF_MAGIC, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + if (memcmp(image, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad global heap collection signature"); image += H5_SIZEOF_MAGIC; /* Version */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); if (H5HG_VERSION != *image++) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "wrong version number in global heap") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "wrong version number in global heap"); /* Reserved */ + if (H5_IS_BUFFER_OVERFLOW(image, 3, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); image += 3; /* Size */ + if (H5_IS_BUFFER_OVERFLOW(image, H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); H5F_DECODE_LENGTH(f, image, heap->size); - HDassert(heap->size >= H5HG_MINSIZE); + if (heap->size < H5HG_MINSIZE) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "global heap size is too small"); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HG__hdr_deserialize() */ /*------------------------------------------------------------------------- - * Function: H5HG__cache_heap_get_initial_load_size() - * - * Purpose: Return the initial speculative read size to the metadata - * cache. This size will be used in the initial attempt to read - * the global heap. If this read is too small, the cache will - * try again with the correct value obtained from - * H5HG__cache_get_final_load_size(). - * - * Return: Success: SUCCEED - * Failure: FAIL + * Function: H5HG__cache_heap_get_initial_load_size * - * Programmer: John Mainzer - * 7/27/14 + * Purpose: Return the initial speculative read size to the metadata + * cache. This size will be used in the initial attempt to read + * the global heap. If this read is too small, the cache will + * try again with the correct value obtained from + * H5HG__cache_get_final_load_size(). * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -163,50 +159,42 @@ H5HG__cache_heap_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *imag { FUNC_ENTER_PACKAGE_NOERR - /* Sanity check */ - HDassert(image_len); + assert(image_len); - /* Set the image length size */ - *image_len = (size_t)H5HG_MINSIZE; + *image_len = H5HG_MINSIZE; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HG__cache_heap_get_initial_load_size() */ /*------------------------------------------------------------------------- - * Function: H5HG__cache_heap_get_initial_load_size() + * Function: H5HG__cache_heap_get_final_load_size * - * Purpose: Return the final read size for a speculatively ready heap to - * the metadata cache. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * November 18, 2016 + * Purpose: Return the final read size for a speculatively ready heap to + * the metadata cache. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5HG__cache_heap_get_final_load_size(const void *image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *udata, - size_t *actual_len) +H5HG__cache_heap_get_final_load_size(const void *image, size_t image_len, void *udata, size_t *actual_len) { - H5HG_heap_t heap; /* Global heap */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HG_heap_t heap; + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(image); - HDassert(udata); - HDassert(actual_len); - HDassert(*actual_len == image_len); - HDassert(image_len == H5HG_MINSIZE); + assert(image); + assert(udata); + assert(actual_len); + assert(*actual_len == image_len); + assert(image_len == H5HG_MINSIZE); /* Deserialize the heap's header */ - if (H5HG__hdr_deserialize(&heap, (const uint8_t *)image, (const H5F_t *)udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode global heap prefix") + heap.size = 0; + if (H5HG__hdr_deserialize(&heap, (const uint8_t *)image, image_len, (const H5F_t *)udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode global heap prefix"); - /* Set the final size for the cache image */ + /* Set the actual global heap size */ *actual_len = heap.size; done: @@ -216,108 +204,145 @@ H5HG__cache_heap_get_final_load_size(const void *image, size_t H5_ATTR_NDEBUG_UN /*------------------------------------------------------------------------- * Function: H5HG__cache_heap_deserialize * - * Purpose: Given a buffer containing the on disk image of the global - * heap, deserialize it, load its contents into a newly allocated - * instance of H5HG_heap_t, and return a pointer to the new instance. - * - * Return: Success: Pointer to in core representation - * Failure: NULL - * - * Programmer: John Mainzer - * 7/27/14 + * Purpose: Given a buffer containing the on disk image of the global + * heap, deserialize it, load its contents into a newly allocated + * instance of H5HG_heap_t, and return a pointer to the new + * instance. * + * Return: Success: Pointer to a new global heap + * Failure: NULL *------------------------------------------------------------------------- */ static void * H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { - H5F_t *f = (H5F_t *)_udata; /* File pointer -- obtained from user data */ - H5HG_heap_t *heap = NULL; /* New global heap */ - uint8_t *image; /* Pointer to image to decode */ - size_t max_idx = 0; /* Maximum heap object index seen */ - size_t nalloc; /* Number of objects allocated */ - void *ret_value = NULL; /* Return value */ + H5F_t *f = (H5F_t *)_udata; /* File pointer */ + H5HG_heap_t *heap = NULL; /* New global heap */ + uint8_t *p = NULL; /* Pointer to objects in (copied) image buffer */ + const uint8_t *p_end = NULL; /* End of (copied) image buffer */ + size_t max_idx = 0; /* Maximum heap object index seen */ + size_t nalloc = 0; /* Number of objects allocated */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* Sanity checks */ - HDassert(_image); - HDassert(len >= (size_t)H5HG_MINSIZE); - HDassert(f); - HDassert(dirty); + assert(_image); + assert(len >= (size_t)H5HG_MINSIZE); + assert(f); + assert(dirty); /* Allocate a new global heap */ if (NULL == (heap = H5FL_CALLOC(H5HG_heap_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); heap->shared = H5F_SHARED(f); if (NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - /* Copy the image buffer into the newly allocate chunk */ + /* Copy the image buffer into the newly allocated chunk */ H5MM_memcpy(heap->chunk, _image, len); + /* Set p_end + * + * Note that parsing moves along p / heap->chunk, so p_end + * has to refer to the end of that buffer and NOT _image + */ + p_end = heap->chunk + len - 1; + /* Deserialize the heap's header */ - if (H5HG__hdr_deserialize(heap, (const uint8_t *)heap->chunk, f) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode global heap header") + if (H5_IS_BUFFER_OVERFLOW(heap->chunk, H5HG_SIZEOF_HDR(f), p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + if (H5HG__hdr_deserialize(heap, (const uint8_t *)heap->chunk, len, f) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode global heap header"); /* Decode each object */ - image = heap->chunk + H5HG_SIZEOF_HDR(f); + + /* Set the p pointer to the objects in heap->chunk */ + p = heap->chunk + H5HG_SIZEOF_HDR(f); + + /* Set the number of allocated objects */ nalloc = H5HG_NOBJS(f, heap->size); /* Calloc the obj array because the file format spec makes no guarantee * about the order of the objects, and unused slots must be set to zero. */ if (NULL == (heap->obj = H5FL_SEQ_CALLOC(H5HG_obj_t, nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); heap->nalloc = nalloc; - while (image < (heap->chunk + heap->size)) { - if ((image + H5HG_SIZEOF_OBJHDR(f)) > (heap->chunk + heap->size)) { - /* - * The last bit of space is too tiny for an object header, so + while (p < (heap->chunk + heap->size)) { + + if ((p + H5HG_SIZEOF_OBJHDR(f)) > (heap->chunk + heap->size)) { + + /* The last bit of space is too tiny for an object header, so * we assume that it's free space. */ - HDassert(NULL == heap->obj[0].begin); - heap->obj[0].size = (size_t)(((const uint8_t *)heap->chunk + heap->size) - image); - heap->obj[0].begin = image; - image += heap->obj[0].size; - } /* end if */ + if (NULL != heap->obj[0].begin) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "object 0 should not be set"); + heap->obj[0].size = (size_t)(((const uint8_t *)heap->chunk + heap->size) - p); + heap->obj[0].begin = p; + + /* No buffer overflow check here since this just moves the pointer + * to the end of the buffer, which was calculated above + */ + p += heap->obj[0].size; + } else { - size_t need = 0; - unsigned idx; - uint8_t *begin = image; + size_t need = 0; /* # bytes needed to store the object */ + unsigned idx; /* Heap object index */ + uint8_t *begin = p; /* Pointer to start of object */ + + /* Parse a normal heap entry */ - UINT16DECODE(image, idx); + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT16DECODE(p, idx); /* Check if we need more room to store heap objects */ if (idx >= heap->nalloc) { size_t new_alloc; /* New allocation number */ - H5HG_obj_t *new_obj; /* New array of object descriptions */ + H5HG_obj_t *new_obj; /* New array of object descriptions */ /* Determine the new number of objects to index */ new_alloc = MAX(heap->nalloc * 2, (idx + 1)); - HDassert(idx < new_alloc); + if (idx >= new_alloc) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "inappropriate heap index"); /* Reallocate array of objects */ if (NULL == (new_obj = H5FL_SEQ_REALLOC(H5HG_obj_t, heap->obj, new_alloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Clear newly allocated space */ - HDmemset(&new_obj[heap->nalloc], 0, (new_alloc - heap->nalloc) * sizeof(heap->obj[0])); + memset(&new_obj[heap->nalloc], 0, (new_alloc - heap->nalloc) * sizeof(heap->obj[0])); /* Update heap information */ heap->nalloc = new_alloc; heap->obj = new_obj; - HDassert(heap->nalloc > heap->nused); - } /* end if */ - - UINT16DECODE(image, heap->obj[idx].nrefs); - image += 4; /*reserved*/ - H5F_DECODE_LENGTH(f, image, heap->obj[idx].size); + if (heap->nalloc <= heap->nused) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "inappropriate # allocated slots"); + } + + /* Number of references */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT16DECODE(p, heap->obj[idx].nrefs); + + /* Reserved bytes */ + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + p += 4; + + /* Object length */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + H5F_DECODE_LENGTH(f, p, heap->obj[idx].size); + + /* Object + * + * Points to beginning of object, INCLUDING the header. + */ heap->obj[idx].begin = begin; - /* - * The total storage size includes the size of the object + /* The total storage size includes the size of the object * header and is zero padded so the next object header is * properly aligned. The entire obj array was calloc'ed, * so no need to zero the space here. The last bit of space @@ -328,37 +353,44 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, hbool need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(heap->obj[idx].size); if (idx > max_idx) max_idx = idx; - } /* end if */ + } else need = heap->obj[idx].size; - image = begin + need; - } /* end else */ - } /* end while */ - - /* Sanity checks */ - HDassert(image == heap->chunk + heap->size); - HDassert(H5HG_ISALIGNED(heap->obj[0].size)); - - /* Set the next index value to use */ + /* Make sure the extra padding doesn't cause us to overrun + * the buffer + */ + if (H5_IS_BUFFER_OVERFLOW(begin, need, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + p = begin + need; + } + } + + /* Post-parse checks */ + if (p != heap->chunk + heap->size) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "partially decoded global heap"); + if (FALSE == H5HG_ISALIGNED(heap->obj[0].size)) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "decoded global heap is not aligned"); + + /* Set the next index value to use when creating a new object */ if (max_idx > 0) heap->nused = max_idx + 1; else heap->nused = 1; - /* Sanity check */ - HDassert(max_idx < heap->nused); + if (max_idx >= heap->nused) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "bad `next unused` heap index value"); /* Add the new heap to the CWFS list for the file */ if (H5F_cwfs_add(f, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "unable to add global heap collection to file's CWFS") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "unable to add global heap collection to file's CWFS"); ret_value = heap; done: if (!ret_value && heap) if (H5HG__free(heap) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "unable to destroy global heap collection"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HG__cache_heap_deserialize() */ @@ -366,15 +398,10 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, hbool /*------------------------------------------------------------------------- * Function: H5HG__cache_heap_image_len * - * Purpose: Return the on disk image size of the global heap to the - * metadata cache via the image_len. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/27/14 + * Purpose: Return the on disk image size of the global heap to the + * metadata cache via the image_len. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -384,12 +411,10 @@ H5HG__cache_heap_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR - /* Sanity checks */ - HDassert(heap); - HDassert(heap->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(heap->cache_info.type == H5AC_GHEAP); - HDassert(heap->size >= H5HG_MINSIZE); - HDassert(image_len); + assert(heap); + assert(heap->cache_info.type == H5AC_GHEAP); + assert(heap->size >= H5HG_MINSIZE); + assert(image_len); *image_len = heap->size; @@ -399,17 +424,12 @@ H5HG__cache_heap_image_len(const void *_thing, size_t *image_len) /*------------------------------------------------------------------------- * Function: H5HG__cache_heap_serialize * - * Purpose: Given an appropriately sized buffer and an instance of - * H5HG_heap_t, serialize the global heap for writing to file, - * and copy the serialized version into the buffer. - * - * - * Return: Success: SUCCEED - * Failure: FAIL + * Purpose: Given an appropriately sized buffer and an instance of + * H5HG_heap_t, serialize the global heap for writing to file, + * and copy the serialized version into the buffer. * - * Programmer: John Mainzer - * 7/27/14 * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -419,15 +439,14 @@ H5HG__cache_heap_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, si FUNC_ENTER_PACKAGE_NOERR - HDassert(f); - HDassert(image); - HDassert(heap); - HDassert(heap->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(heap->cache_info.type == H5AC_GHEAP); - HDassert(heap->size == len); - HDassert(heap->chunk); + assert(f); + assert(image); + assert(heap); + assert(heap->cache_info.type == H5AC_GHEAP); + assert(heap->size == len); + assert(heap->chunk); - /* copy the image into the buffer */ + /* Copy the image into the buffer */ H5MM_memcpy(image, heap->chunk, len); FUNC_LEAVE_NOAPI(SUCCEED) @@ -436,36 +455,25 @@ H5HG__cache_heap_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *image, si /*------------------------------------------------------------------------- * Function: H5HG__cache_heap_free_icr * - * Purpose: Free the in memory representation of the supplied global heap. - * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/27/14 + * Purpose: Free the in memory representation of the supplied global heap. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5HG__cache_heap_free_icr(void *_thing) { H5HG_heap_t *heap = (H5HG_heap_t *)_thing; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity checks */ - HDassert(heap); - HDassert(heap->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(heap->cache_info.type == H5AC_GHEAP); + assert(heap); + assert(heap->cache_info.type == H5AC_GHEAP); /* Destroy global heap collection */ if (H5HG__free(heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap collection") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy global heap collection"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HGdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HGdbg.c index 4ae9025aba..60cf3f785e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HGdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HGdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Wednesday, July 9, 2003 - * +/* * Purpose: Global Heap object debugging functions. */ @@ -67,9 +64,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Mar 27, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -84,19 +78,19 @@ H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) FUNC_ENTER_NOAPI(FAIL) /* check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); if (NULL == (h = H5HG__protect(f, addr, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap collection"); - HDfprintf(stream, "%*sGlobal Heap Collection...\n", indent, ""); - HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Dirty:", (int)(h->cache_info.is_dirty)); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Total collection size in file:", (unsigned long)(h->size)); + fprintf(stream, "%*sGlobal Heap Collection...\n", indent, ""); + fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Dirty:", (int)(h->cache_info.is_dirty)); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Total collection size in file:", (unsigned long)(h->size)); for (u = 1, nused = 0, maxobj = 0; u < h->nused; u++) if (h->obj[u].begin) { @@ -104,45 +98,45 @@ H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) if (u > maxobj) maxobj = u; } - HDfprintf(stream, "%*s%-*s %u/%lu/", indent, "", fwidth, "Objects defined/allocated/max:", nused, - (unsigned long)h->nalloc); + fprintf(stream, "%*s%-*s %u/%lu/", indent, "", fwidth, "Objects defined/allocated/max:", nused, + (unsigned long)h->nalloc); if (nused) - HDfprintf(stream, "%u\n", maxobj); + fprintf(stream, "%u\n", maxobj); else - HDfprintf(stream, "NA\n"); + fprintf(stream, "NA\n"); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Free space:", (unsigned long)(h->obj[0].size)); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Free space:", (unsigned long)(h->obj[0].size)); for (u = 1; u < h->nused; u++) if (h->obj[u].begin) { char buf[64]; HDsnprintf(buf, sizeof(buf), "Object %u", u); - HDfprintf(stream, "%*s%s\n", indent, "", buf); - HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MIN(fwidth - 3, 0), - "Obffset in block:", (unsigned long)(h->obj[u].begin - h->chunk)); - HDfprintf(stream, "%*s%-*s %d\n", indent + 3, "", MIN(fwidth - 3, 0), - "Reference count:", h->obj[u].nrefs); - HDfprintf(stream, "%*s%-*s %lu/%lu\n", indent + 3, "", MIN(fwidth - 3, 0), - "Size of object body:", (unsigned long)(h->obj[u].size), - (unsigned long)H5HG_ALIGN(h->obj[u].size)); + fprintf(stream, "%*s%s\n", indent, "", buf); + fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MIN(fwidth - 3, 0), + "Obffset in block:", (unsigned long)(h->obj[u].begin - h->chunk)); + fprintf(stream, "%*s%-*s %d\n", indent + 3, "", MIN(fwidth - 3, 0), + "Reference count:", h->obj[u].nrefs); + fprintf(stream, "%*s%-*s %lu/%lu\n", indent + 3, "", MIN(fwidth - 3, 0), + "Size of object body:", (unsigned long)(h->obj[u].size), + (unsigned long)H5HG_ALIGN(h->obj[u].size)); p = h->obj[u].begin + H5HG_SIZEOF_OBJHDR(f); for (j = 0; j < h->obj[u].size; j += 16) { - HDfprintf(stream, "%*s%04u: ", indent + 6, "", j); + fprintf(stream, "%*s%04u: ", indent + 6, "", j); for (k = 0; k < 16; k++) { if (8 == k) - HDfprintf(stream, " "); + fprintf(stream, " "); if (j + k < h->obj[u].size) - HDfprintf(stream, "%02x ", p[j + k]); + fprintf(stream, "%02x ", p[j + k]); else HDfputs(" ", stream); } for (k = 0; k < 16 && j + k < h->obj[u].size; k++) { if (8 == k) - HDfprintf(stream, " "); + fprintf(stream, " "); HDfputc(p[j + k] > ' ' && p[j + k] <= '~' ? p[j + k] : '.', stream); } - HDfprintf(stream, "\n"); + fprintf(stream, "\n"); } } @@ -150,5 +144,5 @@ H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) if (h && H5AC_unprotect(f, H5AC_GHEAP, addr, h, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header"); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5HG_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HGquery.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HGquery.c index c24a414c43..3d329b60a8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HGquery.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HGquery.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Wednesday, July 20, 2011 - * * Purpose: Query routines for global heaps. * */ @@ -67,9 +63,6 @@ * * Return: Address of heap on success/abort on failure (shouldn't fail) * - * Programmer: Quincey Koziol - * Wednesday, July 20, 2011 - * *------------------------------------------------------------------------- */ haddr_t @@ -78,7 +71,7 @@ H5HG_get_addr(const H5HG_heap_t *heap) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(heap); + assert(heap); FUNC_LEAVE_NOAPI(heap->addr) } /* H5HG_get_addr() */ @@ -90,9 +83,6 @@ H5HG_get_addr(const H5HG_heap_t *heap) * * Return: Size of heap on success/abort on failure (shouldn't fail) * - * Programmer: Quincey Koziol - * Wednesday, July 20, 2011 - * *------------------------------------------------------------------------- */ size_t @@ -101,7 +91,7 @@ H5HG_get_size(const H5HG_heap_t *heap) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(heap); + assert(heap); FUNC_LEAVE_NOAPI(heap->size) } /* H5HG_get_size() */ @@ -113,9 +103,6 @@ H5HG_get_size(const H5HG_heap_t *heap) * * Return: Free size of heap on success/abort on failure (shouldn't fail) * - * Programmer: Quincey Koziol - * Wednesday, July 20, 2011 - * *------------------------------------------------------------------------- */ size_t @@ -124,7 +111,7 @@ H5HG_get_free_size(const H5HG_heap_t *heap) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(heap); + assert(heap); FUNC_LEAVE_NOAPI(heap->obj[0].size) } /* H5HG_get_free_size() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HL.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HL.c index aa9eb3c2c5..ffec3ad3ff 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HL.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HL.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HL.c - * Jul 16 1997 - * Robb Matzke * * Purpose: Heap functions for the local heaps used by symbol * tables to store names (among other things). @@ -32,11 +29,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ -#include "H5HLpkg.h" /* Local Heaps */ -#include "H5MFprivate.h" /* File memory management */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata Cache */ +#include "H5Eprivate.h" /* Error Handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5HLpkg.h" /* Local Heaps */ +#include "H5MFprivate.h" /* File Memory Management */ +#include "H5MMprivate.h" /* Memory Management */ /****************/ /* Local Macros */ @@ -90,9 +90,6 @@ H5FL_BLK_DEFINE(lheap_chunk); * returned through the ADDR argument. * Failure: FAIL. addr_p will be HADDR_UNDEF. * - * Programmer: Robb Matzke - * Jul 16 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -106,8 +103,8 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p /*out*/) FUNC_ENTER_NOAPI(FAIL) /* check arguments */ - HDassert(f); - HDassert(addr_p); + assert(f); + assert(addr_p); /* Adjust size hint as necessary */ if (size_hint && size_hint < H5HL_SIZEOF_FREE(f)) @@ -165,7 +162,7 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p /*out*/) } else { if (heap) { - if (H5F_addr_defined(heap->prfx_addr)) + if (H5_addr_defined(heap->prfx_addr)) if (FAIL == H5MF_xfree(f, H5FD_MEM_LHEAP, heap->prfx_addr, total_size)) HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't release heap data?"); if (FAIL == H5HL__dest(heap)) @@ -184,9 +181,6 @@ H5HL_create(H5F_t *f, size_t size_hint, haddr_t *addr_p /*out*/) * * Return: SUCCEED/FAIL * - * Programmer: Bill Wendling - * Sept. 16, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -198,8 +192,8 @@ H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(heap); + assert(f); + assert(heap); /* Check to see if we can reduce the size of the heap in memory by * eliminating free blocks at the tail of the buffer before flushing the @@ -245,7 +239,7 @@ H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap) /* Truncate the free block */ last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); new_heap_size = last_fl->offset + last_fl->size; - HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); + assert(last_fl->size >= H5HL_SIZEOF_FREE(f)); } else { /* Set the size of the memory buffer to the start @@ -261,8 +255,8 @@ H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap) /* Truncate the free block */ last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); new_heap_size = last_fl->offset + last_fl->size; - HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); - HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); + assert(last_fl->size >= H5HL_SIZEOF_FREE(f)); + assert(last_fl->size == H5HL_ALIGN(last_fl->size)); } } } @@ -273,7 +267,7 @@ H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap) * storage. */ if (new_heap_size != heap->dblk_size) { - HDassert(new_heap_size < heap->dblk_size); + assert(new_heap_size < heap->dblk_size); /* Resize the memory buffer */ if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, new_heap_size))) @@ -296,9 +290,6 @@ H5HL__minimize_heap_space(H5F_t *f, H5HL_t *heap) * Return: Success: Non-NULL pointer to the local heap prefix. * Failure: NULL * - * Programmer: Bill Wendling - * Sept. 17, 2003 - * *------------------------------------------------------------------------- */ H5HL_t * @@ -315,11 +306,11 @@ H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags) FUNC_ENTER_NOAPI(NULL) /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(H5_addr_defined(addr)); /* Only the H5AC__READ_ONLY_FLAG may appear in flags */ - HDassert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Construct the user data for protect callback */ prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); @@ -379,9 +370,6 @@ H5HL_protect(H5F_t *f, haddr_t addr, unsigned flags) * Return: Success: Valid pointer * Failure: NULL * - * Programmer: Bill Wendling - * Sept. 17, 2003 - * *------------------------------------------------------------------------- */ void * @@ -392,7 +380,7 @@ H5HL_offset_into(const H5HL_t *heap, size_t offset) FUNC_ENTER_NOAPI(NULL) /* Sanity check */ - HDassert(heap); + assert(heap); if (offset >= heap->dblk_size) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, NULL, "unable to offset into local heap data block"); @@ -409,9 +397,6 @@ H5HL_offset_into(const H5HL_t *heap, size_t offset) * * Return: SUCCEED/FAIL * - * Programmer: Bill Wendling - * Sept. 17, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -422,7 +407,7 @@ H5HL_unprotect(H5HL_t *heap) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(heap); + assert(heap); /* Decrement # of times heap is protected */ heap->prots--; @@ -437,7 +422,7 @@ H5HL_unprotect(H5HL_t *heap) } else { /* Sanity check */ - HDassert(heap->dblk); + assert(heap->dblk); /* Mark local heap data block as evictable again */ /* (data block still pins prefix) */ @@ -458,9 +443,6 @@ H5HL_unprotect(H5HL_t *heap) * * Return: NULL * - * Programmer: Robb Matzke - * Jul 17 1997 - * *------------------------------------------------------------------------- */ static H5HL_free_t * @@ -491,9 +473,6 @@ H5HL__remove_free(H5HL_t *heap, H5HL_free_t *fl) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Oct 12 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -504,13 +483,13 @@ H5HL__dirty(H5HL_t *heap) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(heap); - HDassert(heap->prfx); + assert(heap); + assert(heap->prfx); /* Mark heap data block as dirty, if there is one */ if (!heap->single_cache_obj) { /* Sanity check */ - HDassert(heap->dblk); + assert(heap->dblk); if (FAIL == H5AC_mark_entry_dirty(heap->dblk)) HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, FAIL, "unable to mark heap data block as dirty"); @@ -535,9 +514,6 @@ H5HL__dirty(H5HL_t *heap) * Failure: FAIL * Offset set to SIZE_MAX * - * Programmer: Robb Matzke - * Jul 17 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -552,11 +528,11 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(f); - HDassert(heap); - HDassert(buf_size > 0); - HDassert(buf); - HDassert(offset_out); + assert(f); + assert(heap); + assert(buf_size > 0); + assert(buf); + assert(offset_out); /* Mark heap as dirty in cache */ /* (A bit early in the process, but it's difficult to determine in the @@ -582,8 +558,8 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of offset = fl->offset; fl->offset += need_size; fl->size -= need_size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); + assert(fl->offset == H5HL_ALIGN(fl->offset)); + assert(fl->size == H5HL_ALIGN(fl->size)); found = TRUE; break; } @@ -627,7 +603,7 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of need_more = need_size; new_dblk_size = heap->dblk_size + need_more; - HDassert(heap->dblk_size < new_dblk_size); + assert(heap->dblk_size < new_dblk_size); old_dblk_size = heap->dblk_size; H5_CHECK_OVERFLOW(heap->dblk_size, size_t, hsize_t); H5_CHECK_OVERFLOW(new_dblk_size, size_t, hsize_t); @@ -669,14 +645,14 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of offset = last_fl->offset; last_fl->offset += need_size; last_fl->size += need_more - need_size; - HDassert(last_fl->offset == H5HL_ALIGN(last_fl->offset)); - HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); + assert(last_fl->offset == H5HL_ALIGN(last_fl->offset)); + assert(last_fl->size == H5HL_ALIGN(last_fl->size)); if (last_fl->size < H5HL_SIZEOF_FREE(f)) { #ifdef H5HL_DEBUG if (H5DEBUG(HL) && last_fl->size) { - HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes at line %d\n", - (unsigned long)(last_fl->size), __LINE__); + fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes at line %d\n", (unsigned long)(last_fl->size), + __LINE__); } #endif last_fl = H5HL__remove_free(heap, last_fl); @@ -692,8 +668,8 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); fl->offset = old_dblk_size + need_size; fl->size = need_more - need_size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); + assert(fl->offset == H5HL_ALIGN(fl->offset)); + assert(fl->size == H5HL_ALIGN(fl->size)); fl->prev = NULL; fl->next = heap->freelist; if (heap->freelist) @@ -702,16 +678,16 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of #ifdef H5HL_DEBUG } else if (H5DEBUG(HL) && need_more > need_size) { - HDfprintf(H5DEBUG(HL), "H5HL_insert: lost %lu bytes at line %d\n", - (unsigned long)(need_more - need_size), __LINE__); + fprintf(H5DEBUG(HL), "H5HL_insert: lost %lu bytes at line %d\n", + (unsigned long)(need_more - need_size), __LINE__); #endif } } #ifdef H5HL_DEBUG if (H5DEBUG(HL)) { - HDfprintf(H5DEBUG(HL), "H5HL: resize mem buf from %lu to %lu bytes\n", - (unsigned long)(old_dblk_size), (unsigned long)(old_dblk_size + need_more)); + fprintf(H5DEBUG(HL), "H5HL: resize mem buf from %lu to %lu bytes\n", + (unsigned long)(old_dblk_size), (unsigned long)(old_dblk_size + need_more)); } #endif if (NULL == (heap->dblk_image = H5FL_BLK_REALLOC(lheap_chunk, heap->dblk_image, heap->dblk_size))) @@ -719,7 +695,7 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of /* Clear new section so junk doesn't appear in the file */ /* (Avoid clearing section which will be overwritten with newly inserted data) */ - HDmemset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size))); + memset(heap->dblk_image + offset + buf_size, 0, (new_dblk_size - (offset + buf_size))); } /* Copy the data into the heap */ @@ -749,9 +725,6 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf, size_t *of * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Jul 16 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -763,15 +736,15 @@ H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(f); - HDassert(heap); - HDassert(size > 0); - HDassert(offset == H5HL_ALIGN(offset)); + assert(f); + assert(heap); + assert(size > 0); + assert(offset == H5HL_ALIGN(offset)); size = H5HL_ALIGN(size); - HDassert(offset < heap->dblk_size); - HDassert(offset + size <= heap->dblk_size); + assert(offset < heap->dblk_size); + assert(offset + size <= heap->dblk_size); /* Mark heap as dirty in cache * @@ -794,21 +767,21 @@ H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size) if ((offset + size) == fl->offset) { fl->offset = offset; fl->size += size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); + assert(fl->offset == H5HL_ALIGN(fl->offset)); + assert(fl->size == H5HL_ALIGN(fl->size)); fl2 = fl->next; while (fl2) { if ((fl2->offset + fl2->size) == fl->offset) { fl->offset = fl2->offset; fl->size += fl2->size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); + assert(fl->offset == H5HL_ALIGN(fl->offset)); + assert(fl->size == H5HL_ALIGN(fl->size)); fl2 = H5HL__remove_free(heap, fl2); if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { if (FAIL == H5HL__minimize_heap_space(f, heap)) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed"); } - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } fl2 = fl2->next; } @@ -816,22 +789,22 @@ H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size) if (FAIL == H5HL__minimize_heap_space(f, heap)) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed"); } - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } else if (fl->offset + fl->size == offset) { fl->size += size; fl2 = fl->next; - HDassert(fl->size == H5HL_ALIGN(fl->size)); + assert(fl->size == H5HL_ALIGN(fl->size)); while (fl2) { if (fl->offset + fl->size == fl2->offset) { fl->size += fl2->size; - HDassert(fl->size == H5HL_ALIGN(fl->size)); + assert(fl->size == H5HL_ALIGN(fl->size)); fl2 = H5HL__remove_free(heap, fl2); if (((fl->offset + fl->size) == heap->dblk_size) && ((2 * fl->size) > heap->dblk_size)) { if (FAIL == H5HL__minimize_heap_space(f, heap)) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed"); } - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } fl2 = fl2->next; } @@ -839,7 +812,7 @@ H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size) if (FAIL == H5HL__minimize_heap_space(f, heap)) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "heap size minimization failed"); } - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } fl = fl->next; } @@ -852,10 +825,10 @@ H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size) if (size < H5HL_SIZEOF_FREE(f)) { #ifdef H5HL_DEBUG if (H5DEBUG(HL)) { - HDfprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", (unsigned long)size); + fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n", (unsigned long)size); } #endif - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* Add an entry to the free list */ @@ -863,8 +836,8 @@ H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); fl->offset = offset; fl->size = size; - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); - HDassert(fl->size == H5HL_ALIGN(fl->size)); + assert(fl->offset == H5HL_ALIGN(fl->offset)); + assert(fl->size == H5HL_ALIGN(fl->size)); fl->prev = NULL; fl->next = heap->freelist; if (heap->freelist) @@ -886,9 +859,6 @@ H5HL_remove(H5F_t *f, H5HL_t *heap, size_t offset, size_t size) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Mar 22 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -904,8 +874,8 @@ H5HL_delete(H5F_t *f, haddr_t addr) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(H5_addr_defined(addr)); /* Construct the user data for protect callback */ prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); @@ -950,9 +920,6 @@ H5HL_delete(H5F_t *f, haddr_t addr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Nov 7 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -966,9 +933,9 @@ H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(size); + assert(f); + assert(H5_addr_defined(addr)); + assert(size); /* Construct the user data for protect callback */ prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); @@ -1002,9 +969,6 @@ H5HL_get_size(H5F_t *f, haddr_t addr, size_t *size) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * June 19 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1018,9 +982,9 @@ H5HL_heapsize(H5F_t *f, haddr_t addr, hsize_t *heap_size) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(heap_size); + assert(f); + assert(H5_addr_defined(addr)); + assert(heap_size); /* Construct the user data for protect callback */ prfx_udata.sizeof_size = H5F_SIZEOF_SIZE(f); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HLcache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HLcache.c index 620704aaa7..377bc0fa3d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HLcache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HLcache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5HLcache.c - * Feb 5 2008 - * Quincey Koziol * - * Purpose: Implement local heap metadata cache methods. + * Purpose: Implement local heap metadata cache methods * *------------------------------------------------------------------------- */ @@ -31,12 +28,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HLpkg.h" /* Local Heaps */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata Cache */ +#include "H5Cprivate.h" /* Cache */ +#include "H5Eprivate.h" /* Error Handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5HLpkg.h" /* Local Heaps */ +#include "H5MMprivate.h" /* Memory Management */ /****************/ /* Local Macros */ @@ -82,7 +81,8 @@ static herr_t H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_th static herr_t H5HL__cache_datablock_free_icr(void *thing); /* Header deserialization */ -static herr_t H5HL__hdr_deserialize(H5HL_t *heap, const uint8_t *image, H5HL_cache_prfx_ud_t *udata); +static herr_t H5HL__hdr_deserialize(H5HL_t *heap, const uint8_t *image, size_t len, + H5HL_cache_prfx_ud_t *udata); /* Free list de/serialization */ static herr_t H5HL__fl_deserialize(H5HL_t *heap); @@ -138,38 +138,39 @@ const H5AC_class_t H5AC_LHEAP_DBLK[1] = {{ /*------------------------------------------------------------------------- * Function: H5HL__hdr_deserialize() * - * Purpose: Decode a local heap's header - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * December 15, 2016 + * Purpose: Decode a local heap's header * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5HL__hdr_deserialize(H5HL_t *heap, const uint8_t *image, H5HL_cache_prfx_ud_t *udata) +H5HL__hdr_deserialize(H5HL_t *heap, const uint8_t *image, size_t len, H5HL_cache_prfx_ud_t *udata) { - herr_t ret_value = SUCCEED; /* Return value */ + const uint8_t *p_end = image + len - 1; /* End of image buffer */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Sanity checks */ - HDassert(heap); - HDassert(image); - HDassert(udata); + assert(heap); + assert(image); + assert(udata); - /* Check magic number */ - if (HDmemcmp(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad local heap signature") + /* Magic number */ + if (H5_IS_BUFFER_OVERFLOW(image, H5_SIZEOF_MAGIC, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + if (memcmp(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad local heap signature"); image += H5_SIZEOF_MAGIC; /* Version */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); if (H5HL_VERSION != *image++) - HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "wrong version number in local heap") + HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "wrong version number in local heap"); /* Reserved */ + if (H5_IS_BUFFER_OVERFLOW(image, 3, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); image += 3; /* Store the prefix's address & length */ @@ -177,16 +178,28 @@ H5HL__hdr_deserialize(H5HL_t *heap, const uint8_t *image, H5HL_cache_prfx_ud_t * heap->prfx_size = udata->sizeof_prfx; /* Heap data size */ - H5F_DECODE_LENGTH_LEN(image, heap->dblk_size, udata->sizeof_size); + if (H5_IS_BUFFER_OVERFLOW(image, udata->sizeof_size, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + H5_DECODE_LENGTH_LEN(image, heap->dblk_size, udata->sizeof_size); /* Free list head */ - H5F_DECODE_LENGTH_LEN(image, heap->free_block, udata->sizeof_size); + if (H5_IS_BUFFER_OVERFLOW(image, udata->sizeof_size, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + H5_DECODE_LENGTH_LEN(image, heap->free_block, udata->sizeof_size); if (heap->free_block != H5HL_FREE_NULL && heap->free_block >= heap->dblk_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad heap free list") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad heap free list"); /* Heap data address */ + if (H5_IS_BUFFER_OVERFLOW(image, udata->sizeof_addr, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); H5F_addr_decode_len(udata->sizeof_addr, &image, &(heap->dblk_addr)); + /* Check that the datablock address is valid (might not be true + * in a corrupt file) + */ + if (!H5_addr_defined(heap->dblk_addr)) + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "bad datablock address"); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL__hdr_deserialize() */ @@ -198,9 +211,6 @@ H5HL__hdr_deserialize(H5HL_t *heap, const uint8_t *image, H5HL_cache_prfx_ud_t * * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Oct 12 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -213,8 +223,8 @@ H5HL__fl_deserialize(H5HL_t *heap) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(heap); - HDassert(!heap->freelist); + assert(heap); + assert(!heap->freelist); /* Build free list */ free_block = heap->free_block; @@ -223,25 +233,25 @@ H5HL__fl_deserialize(H5HL_t *heap) /* Sanity check */ if (free_block >= heap->dblk_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list"); /* Allocate & initialize free list node */ if (NULL == (fl = H5FL_MALLOC(H5HL_free_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); fl->offset = (size_t)free_block; fl->prev = tail; fl->next = NULL; /* Decode offset of next free block */ image = heap->dblk_image + free_block; - H5F_DECODE_LENGTH_LEN(image, free_block, heap->sizeof_size); + H5_DECODE_LENGTH_LEN(image, free_block, heap->sizeof_size); if (0 == free_block) - HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "free block size is zero?") + HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, FAIL, "free block size is zero?"); /* Decode length of this free block */ - H5F_DECODE_LENGTH_LEN(image, fl->size, heap->sizeof_size); + H5_DECODE_LENGTH_LEN(image, fl->size, heap->sizeof_size); if ((fl->offset + fl->size) > heap->dblk_size) - HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list") + HGOTO_ERROR(H5E_HEAP, H5E_BADRANGE, FAIL, "bad heap free list"); /* Append node onto list */ if (tail) @@ -268,9 +278,6 @@ H5HL__fl_deserialize(H5HL_t *heap) * * Return: Nothing (void) * - * Programmer: Quincey Koziol - * Oct 12 2008 - * *------------------------------------------------------------------------- */ static void @@ -281,21 +288,21 @@ H5HL__fl_serialize(const H5HL_t *heap) FUNC_ENTER_PACKAGE_NOERR /* check arguments */ - HDassert(heap); + assert(heap); /* Serialize the free list into the heap data's image */ for (fl = heap->freelist; fl; fl = fl->next) { uint8_t *image; /* Pointer into raw data buffer */ - HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + assert(fl->offset == H5HL_ALIGN(fl->offset)); image = heap->dblk_image + fl->offset; if (fl->next) - H5F_ENCODE_LENGTH_LEN(image, fl->next->offset, heap->sizeof_size) + H5_ENCODE_LENGTH_LEN(image, fl->next->offset, heap->sizeof_size); else - H5F_ENCODE_LENGTH_LEN(image, H5HL_FREE_NULL, heap->sizeof_size) + H5_ENCODE_LENGTH_LEN(image, H5HL_FREE_NULL, heap->sizeof_size); - H5F_ENCODE_LENGTH_LEN(image, fl->size, heap->sizeof_size) + H5_ENCODE_LENGTH_LEN(image, fl->size, heap->sizeof_size); } FUNC_LEAVE_NOAPI_VOID @@ -311,9 +318,6 @@ H5HL__fl_serialize(const H5HL_t *heap) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -322,7 +326,7 @@ H5HL__cache_prefix_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *im FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(image_len); + assert(image_len); /* Set the image length size */ *image_len = H5HL_SPEC_READ_SIZE; @@ -339,14 +343,10 @@ H5HL__cache_prefix_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *im * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * November 18, 2016 - * *------------------------------------------------------------------------- */ static herr_t -H5HL__cache_prefix_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image_len, - void *_udata, size_t *actual_len) +H5HL__cache_prefix_get_final_load_size(const void *_image, size_t image_len, void *_udata, size_t *actual_len) { const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ H5HL_cache_prfx_ud_t *udata = (H5HL_cache_prfx_ud_t *)_udata; /* User data for callback */ @@ -356,16 +356,16 @@ H5HL__cache_prefix_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(image); - HDassert(udata); - HDassert(actual_len); - HDassert(*actual_len == image_len); + assert(image); + assert(udata); + assert(actual_len); + assert(*actual_len == image_len); - HDmemset(&heap, 0, sizeof(H5HL_t)); + memset(&heap, 0, sizeof(H5HL_t)); /* Deserialize the heap's header */ - if (H5HL__hdr_deserialize(&heap, (const uint8_t *)image, udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode local heap header") + if (H5HL__hdr_deserialize(&heap, (const uint8_t *)image, image_len, udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, FAIL, "can't decode local heap header"); /* Set the final size for the cache image */ *actual_len = heap.prfx_size; @@ -373,7 +373,7 @@ H5HL__cache_prefix_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG /* Check if heap block exists */ if (heap.dblk_size) /* Check if heap data block is contiguous with header */ - if (H5F_addr_eq((heap.prfx_addr + heap.prfx_size), heap.dblk_addr)) + if (H5_addr_eq((heap.prfx_addr + heap.prfx_size), heap.dblk_addr)) /* Note that the heap should be a single object in the cache */ *actual_len += heap.dblk_size; @@ -384,47 +384,44 @@ H5HL__cache_prefix_get_final_load_size(const void *_image, size_t H5_ATTR_NDEBUG /*------------------------------------------------------------------------- * Function: H5HL__cache_prefix_deserialize * - * Purpose: Given a buffer containing the on disk image of the local - * heap prefix, deserialize it, load its contents into a newly allocated - * instance of H5HL_prfx_t, and return a pointer to the new instance. - * - * Return: Success: Pointer to in core representation - * Failure: NULL - * - * Programmer: John Mainzer - * 6/21/14 + * Purpose: Given a buffer containing the on disk image of the local + * heap prefix, deserialize it, load its contents into a newly + * allocated instance of H5HL_prfx_t, and return a pointer to + * the new instance. * + * Return: Success: Pointer to in core representation + * Failure: NULL *------------------------------------------------------------------------- */ static void * -H5HL__cache_prefix_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, - hbool_t H5_ATTR_UNUSED *dirty) +H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata, hbool_t H5_ATTR_UNUSED *dirty) { H5HL_t *heap = NULL; /* Local heap */ H5HL_prfx_t *prfx = NULL; /* Heap prefix deserialized */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into decoding buffer */ + const uint8_t *p_end = image + len - 1; /* End of image buffer */ H5HL_cache_prfx_ud_t *udata = (H5HL_cache_prfx_ud_t *)_udata; /* User data for callback */ void *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(len > 0); - HDassert(udata); - HDassert(udata->sizeof_size > 0); - HDassert(udata->sizeof_addr > 0); - HDassert(udata->sizeof_prfx > 0); - HDassert(H5F_addr_defined(udata->prfx_addr)); - HDassert(dirty); + assert(image); + assert(len > 0); + assert(udata); + assert(udata->sizeof_size > 0); + assert(udata->sizeof_addr > 0); + assert(udata->sizeof_prfx > 0); + assert(H5_addr_defined(udata->prfx_addr)); + assert(dirty); /* Allocate space in memory for the heap */ if (NULL == (heap = H5HL__new(udata->sizeof_size, udata->sizeof_addr, udata->sizeof_prfx))) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate local heap structure"); /* Deserialize the heap's header */ - if (H5HL__hdr_deserialize(heap, (const uint8_t *)image, udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode local heap header") + if (H5HL__hdr_deserialize(heap, (const uint8_t *)image, len, udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTDECODE, NULL, "can't decode local heap header"); /* Allocate the heap prefix */ if (NULL == (prfx = H5HL__prfx_new(heap))) @@ -433,13 +430,13 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED /* Check if heap block exists */ if (heap->dblk_size) { /* Check if heap data block is contiguous with header */ - if (H5F_addr_eq((heap->prfx_addr + heap->prfx_size), heap->dblk_addr)) { + if (H5_addr_eq((heap->prfx_addr + heap->prfx_size), heap->dblk_addr)) { /* Note that the heap should be a single object in the cache */ heap->single_cache_obj = TRUE; /* Allocate space for the heap data image */ if (NULL == (heap->dblk_image = H5FL_BLK_MALLOC(lheap_chunk, heap->dblk_size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Set image to the start of the data block. This is necessary * because there may be a gap between the used portion of the @@ -447,11 +444,13 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED image = ((const uint8_t *)_image) + heap->prfx_size; /* Copy the heap data from the speculative read buffer */ + if (H5_IS_BUFFER_OVERFLOW(image, heap->dblk_size, p_end)) + HGOTO_ERROR(H5E_HEAP, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5MM_memcpy(heap->dblk_image, image, heap->dblk_size); /* Build free list */ if (H5HL__fl_deserialize(heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, NULL, "can't initialize free list"); } else /* Note that the heap should _NOT_ be a single @@ -488,9 +487,6 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -501,10 +497,9 @@ H5HL__cache_prefix_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(prfx); - HDassert(prfx->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(prfx->cache_info.type == H5AC_LHEAP_PRFX); - HDassert(image_len); + assert(prfx); + assert(prfx->cache_info.type == H5AC_LHEAP_PRFX); + assert(image_len); /* Set the prefix's size */ *image_len = prfx->heap->prfx_size; @@ -529,9 +524,6 @@ H5HL__cache_prefix_image_len(const void *_thing, size_t *image_len) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -545,24 +537,23 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(prfx); - HDassert(prfx->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(prfx->cache_info.type == H5AC_LHEAP_PRFX); - HDassert(H5F_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr)); - HDassert(prfx->heap); + assert(f); + assert(image); + assert(prfx); + assert(prfx->cache_info.type == H5AC_LHEAP_PRFX); + assert(H5_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr)); + assert(prfx->heap); /* Get the pointer to the heap */ heap = prfx->heap; - HDassert(heap); + assert(heap); #ifndef NDEBUG /* Compute the buffer size */ size_t buf_size = heap->prfx_size; /* expected size of the image buffer */ if (heap->single_cache_obj) buf_size += heap->dblk_size; - HDassert(len == buf_size); + assert(len == buf_size); #endif /* Update the free block value from the free list */ @@ -575,8 +566,8 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, *image++ = 0; /*reserved*/ *image++ = 0; /*reserved*/ *image++ = 0; /*reserved*/ - H5F_ENCODE_LENGTH_LEN(image, heap->dblk_size, heap->sizeof_size); - H5F_ENCODE_LENGTH_LEN(image, heap->free_block, heap->sizeof_size); + H5_ENCODE_LENGTH_LEN(image, heap->dblk_size, heap->sizeof_size); + H5_ENCODE_LENGTH_LEN(image, heap->free_block, heap->sizeof_size); H5F_addr_encode_len(heap->sizeof_addr, &image, heap->dblk_addr); /* Check if the local heap is a single object in cache */ @@ -589,7 +580,7 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, * the prefix and the data block due to alignment constraints. */ gap = heap->prfx_size - (size_t)(image - (uint8_t *)_image); - HDmemset(image, 0, gap); + memset(image, 0, gap); image += gap; } @@ -600,14 +591,14 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, H5MM_memcpy(image, heap->dblk_image, heap->dblk_size); /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len); + assert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len); } else { /* Sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) <= len); + assert((size_t)(image - (uint8_t *)_image) <= len); /* Clear rest of local heap */ - HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); + memset(image, 0, len - (size_t)(image - (uint8_t *)_image)); } FUNC_LEAVE_NOAPI(SUCCEED) @@ -623,16 +614,9 @@ H5HL__cache_prefix_serialize(const H5_ATTR_NDEBUG_UNUSED H5F_t *f, void *_image, * from a failed speculative load attempt. See comments below for * details. * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -644,14 +628,13 @@ H5HL__cache_prefix_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(prfx); - HDassert(prfx->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(prfx->cache_info.type == H5AC_LHEAP_PRFX); - HDassert(H5F_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr)); + assert(prfx); + assert(prfx->cache_info.type == H5AC_LHEAP_PRFX); + assert(H5_addr_eq(prfx->cache_info.addr, prfx->heap->prfx_addr)); /* Destroy local heap prefix */ if (H5HL__prfx_dest(prfx) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't destroy local heap prefix") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't destroy local heap prefix"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -667,9 +650,6 @@ H5HL__cache_prefix_free_icr(void *_thing) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -680,9 +660,9 @@ H5HL__cache_datablock_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(heap); - HDassert(heap->dblk_size > 0); - HDassert(image_len); + assert(heap); + assert(heap->dblk_size > 0); + assert(image_len); /* Set the image length size */ *image_len = heap->dblk_size; @@ -700,9 +680,6 @@ H5HL__cache_datablock_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: Pointer to in core representation * Failure: NULL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static void * @@ -715,13 +692,13 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, h FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(len > 0); - HDassert(heap); - HDassert(heap->dblk_size == len); - HDassert(!heap->single_cache_obj); - HDassert(NULL == heap->dblk); - HDassert(dirty); + assert(image); + assert(len > 0); + assert(heap); + assert(heap->dblk_size == len); + assert(!heap->single_cache_obj); + assert(NULL == heap->dblk); + assert(dirty); /* Allocate space in memory for the heap data block */ if (NULL == (dblk = H5HL__dblk_new(heap))) @@ -761,9 +738,6 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, h * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -774,12 +748,11 @@ H5HL__cache_datablock_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(dblk); - HDassert(dblk->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblk->cache_info.type == H5AC_LHEAP_DBLK); - HDassert(dblk->heap); - HDassert(dblk->heap->dblk_size > 0); - HDassert(image_len); + assert(dblk); + assert(dblk->cache_info.type == H5AC_LHEAP_DBLK); + assert(dblk->heap); + assert(dblk->heap->dblk_size > 0); + assert(image_len); *image_len = dblk->heap->dblk_size; @@ -795,9 +768,6 @@ H5HL__cache_datablock_image_len(const void *_thing, size_t *image_len) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -810,15 +780,14 @@ H5HL__cache_datablock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *imag FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(dblk); - HDassert(dblk->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(dblk->cache_info.type == H5AC_LHEAP_DBLK); - HDassert(dblk->heap); + assert(f); + assert(image); + assert(dblk); + assert(dblk->cache_info.type == H5AC_LHEAP_DBLK); + assert(dblk->heap); heap = dblk->heap; - HDassert(heap->dblk_size == len); - HDassert(!heap->single_cache_obj); + assert(heap->dblk_size == len); + assert(!heap->single_cache_obj); /* Update the free block value from the free list */ heap->free_block = heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL; @@ -841,9 +810,6 @@ H5HL__cache_datablock_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *imag * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * November 19, 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -855,7 +821,7 @@ H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_thing) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dblk); + assert(dblk); switch (action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: @@ -864,12 +830,12 @@ H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_AFTER_LOAD: /* Sanity checks */ - HDassert(dblk->heap); - HDassert(dblk->heap->prfx); + assert(dblk->heap); + assert(dblk->heap->prfx); /* Pin the heap's prefix */ if (FAIL == H5AC_pin_protected_entry(dblk->heap->prfx)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin local heap prefix") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPIN, FAIL, "unable to pin local heap prefix"); break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: @@ -884,16 +850,16 @@ H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_BEFORE_EVICT: /* Sanity checks */ - HDassert(dblk->heap); - HDassert(dblk->heap->prfx); + assert(dblk->heap); + assert(dblk->heap->prfx); /* Unpin the local heap prefix */ if (FAIL == H5AC_unpin_entry(dblk->heap->prfx)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap prefix") + HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin local heap prefix"); break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); break; } @@ -906,16 +872,9 @@ H5HL__cache_datablock_notify(H5C_notify_action_t action, void *_thing) * * Purpose: Free the in memory representation of the supplied local heap data block. * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 6/21/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -927,13 +886,12 @@ H5HL__cache_datablock_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(dblk); - HDassert(dblk->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(dblk->cache_info.type == H5AC_LHEAP_DBLK); + assert(dblk); + assert(dblk->cache_info.type == H5AC_LHEAP_DBLK); /* Destroy the data block */ if (H5HL__dblk_dest(dblk) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap data block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap data block"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HLdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HLdbg.c index e75f361850..852884a42e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HLdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HLdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Wednesday, July 9, 2003 - * +/* * Purpose: Local Heap object debugging functions. */ @@ -39,9 +36,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Aug 1 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -57,36 +51,36 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) FUNC_ENTER_NOAPI(FAIL) /* check arguments */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); if (NULL == (h = (H5HL_t *)H5HL_protect(f, addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load/protect local heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load/protect local heap"); - HDfprintf(stream, "%*sLocal Heap...\n", indent, ""); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size (in bytes):", h->prfx_size); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of heap data:", h->dblk_addr); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data bytes allocated for heap:", h->dblk_size); + fprintf(stream, "%*sLocal Heap...\n", indent, ""); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size (in bytes):", h->prfx_size); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of heap data:", h->dblk_addr); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data bytes allocated for heap:", h->dblk_size); /* Traverse the free list and check that all free blocks fall within * the heap and that no two free blocks point to the same region of * the heap. */ if (NULL == (marker = (uint8_t *)H5MM_calloc(h->dblk_size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed"); - HDfprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); + fprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); for (free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { char temp_str[32]; HDsnprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block); - HDfprintf(stream, "%*s%-*s %8zu, %8zu\n", indent + 3, "", MAX(0, fwidth - 9), temp_str, - freelist->offset, freelist->size); + fprintf(stream, "%*s%-*s %8zu, %8zu\n", indent + 3, "", MAX(0, fwidth - 9), temp_str, + freelist->offset, freelist->size); if ((freelist->offset + freelist->size) > h->dblk_size) - HDfprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); + fprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); else { int overlap = 0; size_t i; @@ -97,25 +91,25 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) marker[freelist->offset + i] = 1; } if (overlap) - HDfprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); + fprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS ONE!\n"); else amount_free += freelist->size; } } if (h->dblk_size) - HDfprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", - (100.0 * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); + fprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", + (100.0 * (double)(h->dblk_size - amount_free) / (double)h->dblk_size)); /* Print the data in a VMS-style octal dump */ H5_buffer_dump(stream, indent, h->dblk_image, marker, (size_t)0, h->dblk_size); done: if (h && FAIL == H5HL_unprotect(h)) - HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release/unprotect local heap") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release/unprotect local heap"); if (marker && NULL != (marker = (uint8_t *)H5MM_xfree(marker))) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't free marker buffer") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "can't free marker buffer"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HLdblk.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HLdblk.c index 9e6fc4ad3e..570136584d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HLdblk.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HLdblk.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HLdblk.c - * Summer 2012 - * Dana Robinson * * Purpose: Data block routines for local heaps. * @@ -76,9 +73,6 @@ H5FL_DEFINE_STATIC(H5HL_dblk_t); * Return: Success: non-NULL pointer to new local heap data block * Failure: NULL * - * Programmer: Quincey Koziol - * Oct 12 2008 - * *------------------------------------------------------------------------- */ H5HL_dblk_t * @@ -90,15 +84,15 @@ H5HL__dblk_new(H5HL_t *heap) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(heap); + assert(heap); /* Allocate new local heap data block */ if (NULL == (dblk = H5FL_CALLOC(H5HL_dblk_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for local heap data block") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for local heap data block"); /* Increment ref. count on heap data structure */ if (FAIL == H5HL__inc_rc(heap)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count"); /* Link the heap & the data block */ dblk->heap = heap; @@ -113,7 +107,7 @@ H5HL__dblk_new(H5HL_t *heap) /* H5FL_FREE always returns NULL so we can't check for errors */ dblk = H5FL_FREE(H5HL_dblk_t, dblk); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL__dblk_new() */ /*------------------------------------------------------------------------- @@ -123,9 +117,6 @@ H5HL__dblk_new(H5HL_t *heap) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Oct 12 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -136,7 +127,7 @@ H5HL__dblk_dest(H5HL_dblk_t *dblk) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(dblk); + assert(dblk); /* Check if data block was initialized */ if (dblk->heap) { @@ -145,7 +136,7 @@ H5HL__dblk_dest(H5HL_dblk_t *dblk) /* Decrement ref. count on heap data structure */ if (FAIL == H5HL__dec_rc(dblk->heap)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count"); /* Unlink heap from data block */ dblk->heap = NULL; @@ -166,9 +157,6 @@ H5HL__dblk_dest(H5HL_dblk_t *dblk) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Oct 12 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -183,8 +171,8 @@ H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(heap); - HDassert(new_heap_size > 0); + assert(heap); + assert(new_heap_size > 0); /* Release old space on disk */ old_addr = heap->dblk_addr; @@ -203,12 +191,12 @@ H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size) heap->dblk_size = new_heap_size; /* Check if heap data block actually moved in the file */ - if (H5F_addr_eq(old_addr, new_addr)) { + if (H5_addr_eq(old_addr, new_addr)) { /* Check if heap data block is contiguous w/prefix */ if (heap->single_cache_obj) { /* Sanity check */ - HDassert(H5F_addr_eq(heap->prfx_addr + heap->prfx_size, old_addr)); - HDassert(heap->prfx); + assert(H5_addr_eq(heap->prfx_addr + heap->prfx_size, old_addr)); + assert(heap->prfx); /* Resize the heap prefix in the cache */ if (FAIL == H5AC_resize_entry(heap->prfx, (size_t)(heap->prfx_size + new_heap_size))) @@ -216,8 +204,8 @@ H5HL__dblk_realloc(H5F_t *f, H5HL_t *heap, size_t new_heap_size) } else { /* Sanity check */ - HDassert(H5F_addr_ne(heap->prfx_addr + heap->prfx_size, old_addr)); - HDassert(heap->dblk); + assert(H5_addr_ne(heap->prfx_addr + heap->prfx_size, old_addr)); + assert(heap->dblk); /* Resize the heap data block in the cache */ if (H5AC_resize_entry(heap->dblk, (size_t)new_heap_size) < 0) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HLint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HLint.c index 42d67448a9..9369875afa 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HLint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HLint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HLint.c - * Oct 12 2008 - * Quincey Koziol * * Purpose: Local heap internal routines. * @@ -75,9 +72,6 @@ H5FL_DEFINE_STATIC(H5HL_t); * Return: Success: non-NULL pointer to new local heap * Failure: NULL * - * Programmer: Quincey Koziol - * Jan 5 2010 - * *------------------------------------------------------------------------- */ H5HL_t * @@ -89,13 +83,13 @@ H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(sizeof_size > 0); - HDassert(sizeof_addr > 0); - HDassert(prfx_size > 0); + assert(sizeof_size > 0); + assert(sizeof_addr > 0); + assert(prfx_size > 0); /* Allocate new local heap structure */ if (NULL == (heap = H5FL_CALLOC(H5HL_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Initialize non-zero fields */ heap->sizeof_size = sizeof_size; @@ -108,7 +102,7 @@ H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size) done: if (!ret_value && heap != NULL) if (NULL == (heap = H5FL_FREE(H5HL_t, heap))) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "can't free heap memory") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "can't free heap memory"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL__new() */ @@ -120,9 +114,6 @@ H5HL__new(size_t sizeof_size, size_t sizeof_addr, size_t prfx_size) * * Return: SUCCEED (Can't fail) * - * Programmer: Quincey Koziol - * Oct 12 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -131,7 +122,7 @@ H5HL__inc_rc(H5HL_t *heap) FUNC_ENTER_PACKAGE_NOERR /* check arguments */ - HDassert(heap); + assert(heap); /* Increment heap's ref. count */ heap->rc++; @@ -146,9 +137,6 @@ H5HL__inc_rc(H5HL_t *heap) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Oct 12 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -159,7 +147,7 @@ H5HL__dec_rc(H5HL_t *heap) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(heap); + assert(heap); /* Decrement heap's ref. count */ heap->rc--; @@ -179,9 +167,6 @@ H5HL__dec_rc(H5HL_t *heap) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jan 15 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -192,13 +177,13 @@ H5HL__dest(H5HL_t *heap) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(heap); + assert(heap); /* Verify that node is unused */ - HDassert(heap->prots == 0); - HDassert(heap->rc == 0); - HDassert(heap->prfx == NULL); - HDassert(heap->dblk == NULL); + assert(heap->prots == 0); + assert(heap->rc == 0); + assert(heap->prfx == NULL); + assert(heap->dblk == NULL); /* Use DONE errors here to try to free as much as possible */ if (heap->dblk_image) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5HLprfx.c b/externals/coda-oss/modules/drivers/hdf5/source/H5HLprfx.c index 03e399911c..6011e8ec2a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5HLprfx.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5HLprfx.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5HLprfx.c - * Summer 2012 - * Dana Robinson * * Purpose: Prefix routines for local heaps. * @@ -75,9 +72,6 @@ H5FL_DEFINE_STATIC(H5HL_prfx_t); * Return: Success: non-NULL pointer to new local heap prefix * Failure: NULL * - * Programmer: Quincey Koziol - * Oct 12 2008 - * *------------------------------------------------------------------------- */ H5HL_prfx_t * @@ -89,15 +83,15 @@ H5HL__prfx_new(H5HL_t *heap) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(heap); + assert(heap); /* Allocate new local heap prefix */ if (NULL == (prfx = H5FL_CALLOC(H5HL_prfx_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for local heap prefix") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "memory allocation failed for local heap prefix"); /* Increment ref. count on heap data structure */ if (FAIL == H5HL__inc_rc(heap)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, NULL, "can't increment heap ref. count"); /* Link the heap & the prefix */ prfx->heap = heap; @@ -122,9 +116,6 @@ H5HL__prfx_new(H5HL_t *heap) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Oct 12 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -135,7 +126,7 @@ H5HL__prfx_dest(H5HL_prfx_t *prfx) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(prfx); + assert(prfx); /* Check if prefix was initialized */ if (prfx->heap) { @@ -144,7 +135,7 @@ H5HL__prfx_dest(H5HL_prfx_t *prfx) /* Decrement ref. count on heap data structure */ if (FAIL == H5HL__dec_rc(prfx->heap)) - HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count") + HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement heap ref. count"); /* Unlink heap from prefix */ prfx->heap = NULL; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5I.c b/externals/coda-oss/modules/drivers/hdf5/source/H5I.c index 0de8e8cd0c..f0d1be6471 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5I.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5I.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -123,12 +122,12 @@ H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, H5I /* Verify that we found a type to give out */ if (done == FALSE) - HGOTO_ERROR(H5E_ID, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded") + HGOTO_ERROR(H5E_ID, H5E_NOSPACE, H5I_BADID, "Maximum number of ID types exceeded"); } /* Allocate new ID class */ if (NULL == (cls = H5MM_calloc(sizeof(H5I_class_t)))) - HGOTO_ERROR(H5E_ID, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed") + HGOTO_ERROR(H5E_ID, H5E_CANTALLOC, H5I_BADID, "ID class allocation failed"); /* Initialize class fields */ cls->type = new_type; @@ -138,7 +137,7 @@ H5Iregister_type(size_t H5_ATTR_DEBUG_API_USED hash_size, unsigned reserved, H5I /* Register the new ID class */ if (H5I_register_type(cls) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINIT, H5I_BADID, "can't initialize ID class") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, H5I_BADID, "can't initialize ID class"); /* Set return value */ ret_value = new_type; @@ -172,9 +171,9 @@ H5Itype_exists(H5I_type_t type) /* Validate parameter */ if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type"); if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); if (NULL == H5I_type_info_array_g[type]) ret_value = FALSE; @@ -193,10 +192,6 @@ H5Itype_exists(H5I_type_t type) * * Return: SUCCEED/FAIL * - * Programmer: James Laird - * Nathaniel Furrer - * Friday, April 23, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -208,22 +203,22 @@ H5Inmembers(H5I_type_t type, hsize_t *num_members) H5TRACE2("e", "It*h", type, num_members); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type"); /* Validate parameters. This needs to be done here, instead of letting * the private interface handle it, because the public interface throws * an error when the supplied type does not exist. */ if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); if (NULL == H5I_type_info_array_g[type]) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "supplied type does not exist"); if (num_members) { int64_t members; if ((members = H5I_nmembers(type)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTCOUNT, FAIL, "can't compute number of members") + HGOTO_ERROR(H5E_ID, H5E_CANTCOUNT, FAIL, "can't compute number of members"); H5_CHECKED_ASSIGN(*num_members, hsize_t, members, int64_t); } @@ -241,10 +236,6 @@ H5Inmembers(H5I_type_t type, hsize_t *num_members) * * Return: SUCCEED/FAIL * - * Programmer: James Laird - * Nathaniel Furrer - * Friday, April 23, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -256,7 +247,7 @@ H5Iclear_type(H5I_type_t type, hbool_t force) H5TRACE2("e", "Itb", type, force); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type"); ret_value = H5I_clear_type(type, force, TRUE); @@ -275,9 +266,6 @@ H5Iclear_type(H5I_type_t type, hbool_t force) * * Return: SUCCEED/FAIL * - * Programmer: Nathaniel Furrer - * James Laird - * *------------------------------------------------------------------------- */ herr_t @@ -289,7 +277,7 @@ H5Idestroy_type(H5I_type_t type) H5TRACE1("e", "It", type); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "cannot call public function on library type"); ret_value = H5I__destroy_type(type); @@ -316,11 +304,11 @@ H5Iregister(H5I_type_t type, const void *object) H5TRACE2("i", "It*x", type, object); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, H5I_INVALID_HID, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, H5I_INVALID_HID, "cannot call public function on library type"); /* Register the object */ if ((ret_value = H5I__register(type, object, TRUE, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object"); done: FUNC_LEAVE_API(ret_value) @@ -347,13 +335,13 @@ H5Iregister_future(H5I_type_t type, const void *object, H5I_future_realize_func_ /* Check arguments */ if (NULL == realize_cb) - HGOTO_ERROR(H5E_ID, H5E_BADVALUE, H5I_INVALID_HID, "NULL pointer for realize_cb not allowed") + HGOTO_ERROR(H5E_ID, H5E_BADVALUE, H5I_INVALID_HID, "NULL pointer for realize_cb not allowed"); if (NULL == discard_cb) - HGOTO_ERROR(H5E_ID, H5E_BADVALUE, H5I_INVALID_HID, "NULL pointer for realize_cb not allowed") + HGOTO_ERROR(H5E_ID, H5E_BADVALUE, H5I_INVALID_HID, "NULL pointer for realize_cb not allowed"); /* Register the future object */ if ((ret_value = H5I__register(type, object, TRUE, realize_cb, discard_cb)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object"); done: FUNC_LEAVE_API(ret_value) @@ -382,9 +370,9 @@ H5Iobject_verify(hid_t id, H5I_type_t type) /* Validate parameters */ if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type"); if (type < 1 || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "identifier has invalid type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "identifier has invalid type"); ret_value = H5I_object_verify(id, type); @@ -436,9 +424,6 @@ H5Iget_type(hid_t id) * calling H5I_object(). * Failure: NULL * - * Programmer: James Laird - * Nathaniel Furrer - * *------------------------------------------------------------------------- */ void * @@ -450,7 +435,7 @@ H5Iremove_verify(hid_t id, H5I_type_t type) H5TRACE2("*x", "iIt", id, type); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type"); /* Remove the id */ ret_value = H5I__remove_verify(id, type); @@ -469,9 +454,6 @@ H5Iremove_verify(hid_t id, H5I_type_t type) * Return: Success: New reference count * Failure: -1 * - * Programmer: Quincey Koziol - * Dec 7, 2003 - * *------------------------------------------------------------------------- */ int @@ -484,11 +466,11 @@ H5Idec_ref(hid_t id) /* Check arguments */ if (id < 0) - HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID"); /* Do actual decrement operation */ if ((ret_value = H5I_dec_app_ref(id)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count"); done: FUNC_LEAVE_API(ret_value) @@ -514,11 +496,11 @@ H5Iinc_ref(hid_t id) /* Check arguments */ if (id < 0) - HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID"); /* Do actual increment operation */ if ((ret_value = H5I_inc_ref(id, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINC, (-1), "can't increment ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTINC, (-1), "can't increment ID ref count"); done: FUNC_LEAVE_API(ret_value) @@ -544,11 +526,11 @@ H5Iget_ref(hid_t id) /* Check arguments */ if (id < 0) - HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID"); /* Do actual retrieve operation */ if ((ret_value = H5I_get_ref(id, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't get ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't get ID ref count"); done: FUNC_LEAVE_API(ret_value) @@ -574,13 +556,13 @@ H5Iinc_type_ref(H5I_type_t type) /* Check arguments */ if (type <= 0 || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID type") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID type"); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type"); /* Do actual increment operation */ if ((ret_value = H5I__inc_type_ref(type)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINC, (-1), "can't increment ID type ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTINC, (-1), "can't increment ID type ref count"); done: FUNC_LEAVE_API(ret_value) @@ -619,7 +601,7 @@ H5Idec_type_ref(H5I_type_t type) H5TRACE1("e", "It", type); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type"); ret_value = H5I_dec_type_ref(type); @@ -647,13 +629,13 @@ H5Iget_type_ref(H5I_type_t type) /* Check arguments */ if (type <= 0 || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID type") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "invalid ID type"); if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "cannot call public function on library type"); /* Do actual retrieve operation */ if ((ret_value = H5I__get_type_ref(type)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't get ID type ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't get ID type ref count"); done: FUNC_LEAVE_API(ret_value) @@ -753,7 +735,7 @@ H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) /* Check arguments */ if (H5I_IS_LIB_TYPE(type)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "cannot call public function on library type"); /* Set up udata struct */ udata.app_cb = func; @@ -783,9 +765,6 @@ H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key) * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) * Failure: H5_ITER_ERROR (-1) * - * Programmer: Neil Fortner - * Friday, October 11, 2013 - * *------------------------------------------------------------------------- */ static int @@ -829,9 +808,6 @@ H5I__iterate_pub_cb(void H5_ATTR_UNUSED *obj, hid_t id, void *_udata) * * Return: The last value returned by op * - * Programmer: Neil Fortner - * Friday, October 11, 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -851,7 +827,7 @@ H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data) * here, as we can't do anything with it without revising the API. */ if ((ret_value = H5I_iterate(type, H5I__iterate_pub_cb, &int_udata, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "can't iterate over ids") + HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "can't iterate over ids"); done: FUNC_LEAVE_API(ret_value) @@ -888,14 +864,14 @@ H5Iget_file_id(hid_t obj_id) /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ID, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ID, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Get the file ID */ if ((ret_value = H5F_get_file_id(vol_obj, type, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file ID"); } else - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "not an ID of a file object"); done: FUNC_LEAVE_API(ret_value) @@ -936,7 +912,7 @@ H5Iget_name(hid_t id, char *name /*out*/, size_t size) /* Get the object pointer */ if (NULL == (vol_obj = H5VL_vol_object(id))) - HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier") + HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -950,7 +926,7 @@ H5Iget_name(hid_t id, char *name /*out*/, size_t size) /* Retrieve object's name */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name"); /* Set return value */ ret_value = (ssize_t)obj_name_len; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5IdComponent.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5IdComponent.cpp deleted file mode 100644 index ce52fb0d60..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5IdComponent.cpp +++ /dev/null @@ -1,453 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5Library.h" -#include "H5IdComponent.h" -#include "H5DataSpace.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This flag indicates whether H5Library::initH5cpp has been called to register -// the terminating functions with atexit() -bool IdComponent::H5cppinit = false; - -// This flag is used to decide whether H5dont_atexit should be called. -// Subclasses that have global constants use it. This is a temporary -// work-around in 1.8.16. It will be removed after HDFFV-9540 is fixed. -bool IdComponent::H5dontAtexit_called = false; -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: IdComponent::incRefCount -///\brief Increment reference counter for a given id. -// Programmer Binh-Minh Ribler - May 2005 -//-------------------------------------------------------------------------- -void -IdComponent::incRefCount(const hid_t obj_id) const -{ - if (p_valid_id(obj_id)) - if (H5Iinc_ref(obj_id) < 0) - throw IdComponentException(inMemFunc("incRefCount"), "incrementing object ref count failed"); -} - -//-------------------------------------------------------------------------- -// Function: IdComponent::incRefCount -///\brief Increment reference counter for the id of this object. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -IdComponent::incRefCount() const -{ - incRefCount(getId()); -} - -//-------------------------------------------------------------------------- -// Function: IdComponent::decRefCount -///\brief Decrement reference counter for a given id. -// Programmer Binh-Minh Ribler - May 2005 -// Modification: -// Added the check for ref counter to give a little more info -// on why H5Idec_ref fails in some cases - BMR 5/19/2005 -//-------------------------------------------------------------------------- -void -IdComponent::decRefCount(const hid_t obj_id) const -{ - if (p_valid_id(obj_id)) - if (H5Idec_ref(obj_id) < 0) { - if (H5Iget_ref(obj_id) <= 0) - throw IdComponentException(inMemFunc("decRefCount"), "object ref count is 0 or negative"); - else - throw IdComponentException(inMemFunc("decRefCount"), "decrementing object ref count failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: IdComponent::decRefCount -///\brief Decrement reference counter for the id of this object. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -IdComponent::decRefCount() const -{ - decRefCount(getId()); -} - -//-------------------------------------------------------------------------- -// Function: IdComponent::getCounter -///\brief Returns the reference counter for a given id. -///\return Reference count -// Programmer Binh-Minh Ribler - May 2005 -//-------------------------------------------------------------------------- -int -IdComponent::getCounter(const hid_t obj_id) const -{ - int counter = 0; - if (p_valid_id(obj_id)) { - counter = H5Iget_ref(obj_id); - if (counter < 0) - throw IdComponentException(inMemFunc("incRefCount"), - "getting object ref count failed - negative"); - } - return (counter); -} - -//-------------------------------------------------------------------------- -// Function: IdComponent::getCounter -///\brief Returns the reference counter for the id of this object. -///\return Reference count -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -IdComponent::getCounter() const -{ - return (getCounter(getId())); -} - -//-------------------------------------------------------------------------- -// Function: getHDFObjType (static) -///\brief Given an id, returns the type of the object. -///\return a valid HDF object type, which may be one of the following: -/// \li \c H5I_FILE -/// \li \c H5I_GROUP -/// \li \c H5I_DATATYPE -/// \li \c H5I_DATASPACE -/// \li \c H5I_DATASET -/// \li \c H5I_ATTR -/// \li or \c H5I_BADID, if no valid type can be determined or the -/// input object id is invalid. -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -H5I_type_t -IdComponent::getHDFObjType(const hid_t obj_id) -{ - if (obj_id <= 0) - return H5I_BADID; // invalid - H5I_type_t id_type = H5Iget_type(obj_id); - if (id_type <= H5I_BADID || id_type >= H5I_NTYPES) - return H5I_BADID; // invalid - else - return id_type; // valid type -} - -//-------------------------------------------------------------------------- -// Function: getHDFObjType -///\brief Returns the type of the object. It is an overloaded function -/// of the above function. -///\return a valid HDF object type, which may be one of the following: -/// \li \c H5I_FILE -/// \li \c H5I_GROUP -/// \li \c H5I_DATATYPE -/// \li \c H5I_DATASPACE -/// \li \c H5I_DATASET -/// \li \c H5I_ATTR -/// \li or \c H5I_BADID, if no valid type can be determined or the -/// input object id is invalid. -// Programmer Binh-Minh Ribler - Mar, 2014 -//-------------------------------------------------------------------------- -H5I_type_t -IdComponent::getHDFObjType() const -{ - return (getHDFObjType(getId())); -} - -//-------------------------------------------------------------------------- -// Function: getNumMembers (static) -///\brief Returns the number of members of the given type. -///\return Number of members -///\par Description -/// If there is no member of the given type, getNumMembers will -/// return 0. Valid types are: -/// \li \c H5I_FILE (= 1) -/// \li \c H5I_GROUP -/// \li \c H5I_DATATYPE -/// \li \c H5I_DATASPACE -/// \li \c H5I_DATASET -/// \li \c H5I_ATTR -/// \li \c H5I_VFL -/// \li \c H5I_VOL -/// \li \c H5I_GENPROP_CLS -/// \li \c H5I_GENPROP_LST -/// \li \c H5I_ERROR_CLASS -/// \li \c H5I_ERROR_MSG -/// \li \c H5I_ERROR_STACK -// Programmer Binh-Minh Ribler - Feb, 2017 -//-------------------------------------------------------------------------- -hsize_t -IdComponent::getNumMembers(H5I_type_t type) -{ - hsize_t nmembers = 0; - herr_t ret_value = H5Inmembers(type, &nmembers); - if (ret_value < 0) - throw IdComponentException("getNumMembers", "H5Inmembers failed"); - else - return (nmembers); -} - -//-------------------------------------------------------------------------- -// Function: isValid (static) -///\brief Checks if the given ID is valid. -///\return true if the given identifier is valid, and false, otherwise. -///\par Description -/// A valid ID is one that is in use and has an application -/// reference count of at least 1. -// Programmer Binh-Minh Ribler - Mar 1, 2017 -//-------------------------------------------------------------------------- -bool -IdComponent::isValid(hid_t an_id) -{ - // Call C function - htri_t ret_value = H5Iis_valid(an_id); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else // Raise exception when H5Iis_valid returns a negative value - throw IdComponentException("isValid", "H5Iis_valid failed"); -} - -//-------------------------------------------------------------------------- -// Function: typeExists (static) -///\brief Queries if a given type is currently registered with the -/// library. -///\return true if the given type exists, and false, otherwise. -///\par Description -/// Valid types are: -/// \li \c H5I_FILE (= 1) -/// \li \c H5I_GROUP -/// \li \c H5I_DATATYPE -/// \li \c H5I_DATASPACE -/// \li \c H5I_DATASET -/// \li \c H5I_ATTR -/// \li \c H5I_VFL -/// \li \c H5I_VOL -/// \li \c H5I_GENPROP_CLS -/// \li \c H5I_GENPROP_LST -/// \li \c H5I_ERROR_CLASS -/// \li \c H5I_ERROR_MSG -/// \li \c H5I_ERROR_STACK -// Programmer Binh-Minh Ribler - Feb, 2017 -//-------------------------------------------------------------------------- -bool -IdComponent::typeExists(H5I_type_t type) -{ - // Call C function - htri_t ret_value = H5Itype_exists(type); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else // Raise exception when H5Itype_exists returns a negative value - throw IdComponentException("typeExists", "H5Itype_exists failed"); -} - -//-------------------------------------------------------------------------- -// Function: IdComponent::operator= -///\brief Assignment operator. -///\param rhs - IN: Reference to the existing object -///\return Reference to IdComponent instance -///\exception H5::IdComponentException when attempt to close the HDF5 -/// object fails -// Description -// First, close the current valid id of this object. Then -// copy the id from rhs to this object, and increment the -// reference counter of the id to indicate that another object -// is referencing that id. -// Modification -// 2010/5/9 - BMR -// Removed close() and incRefCount() because setId/p_setId takes -// care of close() and setId takes care incRefCount(). -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IdComponent & -IdComponent::operator=(const IdComponent &rhs) -{ - if (this != &rhs) { - // handling references to this id - try { - setId(rhs.getId()); - // Note: a = b, so there are two objects with the same hdf5 id - // that's why incRefCount is needed, and it is called by setId - } - catch (Exception &close_error) { - throw FileIException(inMemFunc("operator="), close_error.getDetailMsg()); - } - } - return *this; -} - -//-------------------------------------------------------------------------- -// Function: IdComponent::setId -///\brief Sets the identifier of this object to a new value. -///\param new_id - IN: New identifier to be set to -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails -// Description: -// p_setId ensures that the current valid id of this object is -// properly closed before resetting the object's id to the new id. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// 2008/7/23 - BMR -// Changed all subclasses' setId to p_setId and put back setId -// here. p_setId is used in the library where the id provided -// by a C API passed on to user's application in the form of a -// C++ API object, which will be destroyed properly, and so -// p_setId does not call incRefCount. On the other hand, the -// public version setId is used by other applications, in which -// the id passed to setId is that of another C++ API object, so -// setId must call incRefCount. -//-------------------------------------------------------------------------- -void -IdComponent::setId(const hid_t new_id) -{ - // set to new_id - p_setId(new_id); - - // increment the reference counter of the new id - incRefCount(); -} - -//-------------------------------------------------------------------------- -// Function: IdComponent destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IdComponent::~IdComponent() -{ -} - -// -// Implementation of protected functions for HDF5 Reference Interface -// and miscellaneous helpers. -// - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: IdComponent::inMemFunc -///\brief Makes and returns string "::" -///\param func_name - Name of the function where failure occurs -// Description -/// Concatenates the class name of this object with the -/// passed-in function name to create a string that indicates -/// where the failure occurs. The class-name is provided by -/// fromClass(). This string will be used by a base class when -/// an exception is thrown. -// Programmer Binh-Minh Ribler - Aug 6, 2005 -//-------------------------------------------------------------------------- -H5std_string -IdComponent::inMemFunc(const char *func_name) const -{ - H5std_string full_name = func_name; - full_name.insert(0, "::"); - full_name.insert(0, fromClass()); - return (full_name); -} - -//-------------------------------------------------------------------------- -// Function: IdComponent default constructor - private -///\brief Default constructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IdComponent::IdComponent() -{ - // initH5cpp will register the terminating functions with atexit(). - // This should only be done once. - if (!H5cppinit) { - H5Library::initH5cpp(); - H5cppinit = true; - } -} - -//-------------------------------------------------------------------------- -// Function: IdComponent::p_get_file_name (protected) -// Purpose Gets the name of the file, in which this object belongs. -// Exception: H5::IdComponentException -// Description: -// This function is protected so that the user applications can -// only have access to its code via H5Location subclasses. -// September 2017 -// This function should be moved to H5Location now that Attribute -// inherits from H5Location. -// Programmer Binh-Minh Ribler - Jul, 2004 -//-------------------------------------------------------------------------- -H5std_string -IdComponent::p_get_file_name() const -{ - hid_t temp_id = getId(); - - // Preliminary call to H5Fget_name to get the length of the file name - ssize_t name_size = H5Fget_name(temp_id, NULL, 0); - - // If H5Aget_name returns a negative value, raise an exception, - if (name_size < 0) { - throw IdComponentException("", "H5Fget_name failed"); - } - - // The actual message size is the cast value + 1 for the terminal ASCII NUL - // (unfortunate in/out type sign mismatch) - size_t actual_name_size = static_cast(name_size) + 1; - - // Call H5Fget_name again to get the actual file name - char *name_C = new char[actual_name_size](); - - name_size = H5Fget_name(temp_id, name_C, actual_name_size); - - // Check for failure again - if (name_size < 0) { - delete[] name_C; - throw IdComponentException("", "H5Fget_name failed"); - } - - // Convert the C file name and return - H5std_string file_name(name_C); - delete[] name_C; - - return file_name; -} - -// -// Local functions used in this class -// - -//-------------------------------------------------------------------------- -// Function: p_valid_id -// Purpose Verifies that the given id is a valid id so it can be passed -// into an H5I C function. -// Return true if id is valid, false, otherwise -// Programmer Binh-Minh Ribler - May, 2005 -//-------------------------------------------------------------------------- -bool -IdComponent::p_valid_id(const hid_t obj_id) -{ - if (obj_id <= 0) - return false; - - H5I_type_t id_type = H5Iget_type(obj_id); - return (id_type > H5I_BADID && id_type < H5I_NTYPES); -} - -// Notes about IdComponent::id -// May 2008 - BMR -// Class hierarchy is revised to address bugzilla 1068... -// ...member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. -// (reasons: 1. encountered problems when adding H5Location; -// 2. Scott Meyers, item 33) - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Idbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Idbg.c index aa244a7f61..4c7d1ec17c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Idbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Idbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -82,10 +81,10 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) FUNC_ENTER_PACKAGE_NOERR - HDfprintf(stderr, " id = %" PRIdHID "\n", info->id); - HDfprintf(stderr, " count = %u\n", info->count); - HDfprintf(stderr, " obj = 0x%8p\n", info->object); - HDfprintf(stderr, " marked = %d\n", info->marked); + fprintf(stderr, " id = %" PRIdHID "\n", info->id); + fprintf(stderr, " count = %u\n", info->count); + fprintf(stderr, " obj = 0x%8p\n", info->object); + fprintf(stderr, " marked = %d\n", info->marked); /* Get the group location, so we get get the name */ switch (type) { @@ -144,9 +143,9 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) if (path) { if (path->user_path_r) - HDfprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); + fprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r)); if (path->full_path_r) - HDfprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r)); + fprintf(stderr, " full_path = %s\n", H5RS_get_str(path->full_path_r)); } FUNC_LEAVE_NOAPI(H5_ITER_CONT) @@ -168,7 +167,7 @@ H5I_dump_ids_for_type(H5I_type_t type) FUNC_ENTER_NOAPI_NOERR - HDfprintf(stderr, "Dumping ID type %d\n", (int)type); + fprintf(stderr, "Dumping ID type %d\n", (int)type); type_info = H5I_type_info_array_g[type]; if (type_info) { @@ -177,21 +176,21 @@ H5I_dump_ids_for_type(H5I_type_t type) H5I_id_info_t *tmp = NULL; /* Header */ - HDfprintf(stderr, " init_count = %u\n", type_info->init_count); - HDfprintf(stderr, " reserved = %u\n", type_info->cls->reserved); - HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_info->id_count); - HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_info->nextid); + fprintf(stderr, " init_count = %u\n", type_info->init_count); + fprintf(stderr, " reserved = %u\n", type_info->cls->reserved); + fprintf(stderr, " id_count = %llu\n", (unsigned long long)type_info->id_count); + fprintf(stderr, " nextid = %llu\n", (unsigned long long)type_info->nextid); /* List */ if (type_info->id_count > 0) { - HDfprintf(stderr, " List:\n"); + fprintf(stderr, " List:\n"); /* Normally we care about the callback's return value * (H5I_ITER_CONT, etc.), but this is an iteration over all * the IDs so we don't care. * * XXX: Update this to emit an error message on errors? */ - HDfprintf(stderr, " (HASH TABLE)\n"); + fprintf(stderr, " (HASH TABLE)\n"); HASH_ITER(hh, type_info->hash_table, item, tmp) { H5I__id_dump_cb((void *)item, NULL, (void *)&type); @@ -199,7 +198,7 @@ H5I_dump_ids_for_type(H5I_type_t type) } } else - HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n"); + fprintf(stderr, "Global type info/tracking pointer for that type is NULL\n"); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5I_dump_ids_for_type() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Iint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Iint.c index 5675374956..462dc71d7e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Iint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Iint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -93,7 +92,7 @@ int H5I_next_type_g = (int)H5I_NTYPES; H5FL_DEFINE_STATIC(H5I_id_info_t); /* Whether deletes are actually marks (for mark-and-sweep) */ -hbool_t H5I_marking_g = FALSE; +static hbool_t H5I_marking_s = FALSE; /*****************************/ /* Library Private Variables */ @@ -137,7 +136,7 @@ H5I_term_package(void) for (i = 0; i < H5I_next_type_g; i++) { type_info = H5I_type_info_array_g[i]; if (type_info) { - HDassert(NULL == type_info->hash_table); + assert(NULL == type_info->hash_table); type_info = H5MM_xfree(type_info); H5I_type_info_array_g[i] = NULL; in_use++; @@ -168,14 +167,14 @@ H5I_register_type(const H5I_class_t *cls) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(cls); - HDassert(cls->type > 0 && (int)cls->type < H5I_MAX_NUM_TYPES); + assert(cls); + assert(cls->type > 0 && (int)cls->type < H5I_MAX_NUM_TYPES); /* Initialize the type */ if (NULL == H5I_type_info_array_g[cls->type]) { /* Allocate the type information for new type */ if (NULL == (type_info = (H5I_type_info_t *)H5MM_calloc(sizeof(H5I_type_info_t)))) - HGOTO_ERROR(H5E_ID, H5E_CANTALLOC, FAIL, "ID type allocation failed") + HGOTO_ERROR(H5E_ID, H5E_CANTALLOC, FAIL, "ID type allocation failed"); H5I_type_info_array_g[cls->type] = type_info; } else { @@ -214,9 +213,6 @@ H5I_register_type(const H5I_class_t *cls) * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, March 24, 1999 - * *------------------------------------------------------------------------- */ int64_t @@ -229,7 +225,7 @@ H5I_nmembers(H5I_type_t type) /* Validate parameter */ if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); if (NULL == (type_info = H5I_type_info_array_g[type]) || type_info->init_count <= 0) HGOTO_DONE(0); @@ -248,9 +244,6 @@ H5I_nmembers(H5I_type_t type) * * Return: Pointer to the unwrapped pointer (can't fail) * - * Programmer: Quincey Koziol - * Friday, October 19, 2018 - * *------------------------------------------------------------------------- */ static void * @@ -261,7 +254,7 @@ H5I__unwrap(void *object, H5I_type_t type) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(object); + assert(object); /* The stored object pointer might be an H5VL_object_t, in which * case we'll need to get the wrapped object struct (H5F_t *, etc.). @@ -291,9 +284,6 @@ H5I__unwrap(void *object, H5I_type_t type) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Wednesday, March 24, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -308,11 +298,11 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) /* Validate parameters */ if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); udata.type_info = H5I_type_info_array_g[type]; if (udata.type_info == NULL || udata.type_info->init_count <= 0) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type"); /* Finish constructing udata */ udata.force = force; @@ -324,18 +314,18 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) */ /* Set marking flag */ - H5I_marking_g = TRUE; + H5I_marking_s = TRUE; /* Mark nodes for deletion */ HASH_ITER(hh, udata.type_info->hash_table, item, tmp) { if (!item->marked) if (H5I__mark_node((void *)item, NULL, (void *)&udata) < 0) - HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed while clearing the ID type") + HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed while clearing the ID type"); } /* Unset marking flag */ - H5I_marking_g = FALSE; + H5I_marking_s = FALSE; /* Perform sweep */ HASH_ITER(hh, udata.type_info->hash_table, item, tmp) @@ -358,9 +348,6 @@ H5I_clear_type(H5I_type_t type, hbool_t force, hbool_t app_ref) * * Return: SUCCEED/FAIL * - * Programmer: Neil Fortner - * Friday, July 10, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -373,9 +360,9 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(info); - HDassert(udata); - HDassert(udata->type_info); + assert(info); + assert(udata); + assert(udata->type_info); /* Do nothing to the object if the reference count is larger than * one and forcing is off. @@ -389,10 +376,10 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata) if (udata->force) { #ifdef H5I_DEBUG if (H5DEBUG(I)) { - HDfprintf(H5DEBUG(I), - "H5I: discard type=%d obj=0x%08lx " - "failure ignored\n", - (int)udata->type_info->cls->type, (unsigned long)(info->object)); + fprintf(H5DEBUG(I), + "H5I: discard type=%d obj=%p " + "failure ignored\n", + (int)udata->type_info->cls->type, info->object); } #endif /* H5I_DEBUG */ @@ -412,10 +399,10 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata) if (udata->force) { #ifdef H5I_DEBUG if (H5DEBUG(I)) { - HDfprintf(H5DEBUG(I), - "H5I: free type=%d obj=0x%08lx " - "failure ignored\n", - (int)udata->type_info->cls->type, (unsigned long)(info->object)); + fprintf(H5DEBUG(I), + "H5I: free type=%d obj=%p " + "failure ignored\n", + (int)udata->type_info->cls->type, info->object); } #endif /* H5I_DEBUG */ @@ -453,9 +440,6 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata) * * Return: SUCCEED/FAIL * - * Programmer: Nathaniel Furrer - * James Laird - * *------------------------------------------------------------------------- */ herr_t @@ -468,11 +452,11 @@ H5I__destroy_type(H5I_type_t type) /* Validate parameter */ if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); type_info = H5I_type_info_array_g[type]; if (type_info == NULL || type_info->init_count <= 0) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type"); /* Close/clear/destroy all IDs for this type */ H5E_BEGIN_TRY @@ -481,9 +465,9 @@ H5I__destroy_type(H5I_type_t type) } H5E_END_TRY /* don't care about errors */ - /* Check if we should release the ID class */ - if (type_info->cls->flags & H5I_CLASS_IS_APPLICATION) - type_info->cls = H5MM_xfree_const(type_info->cls); + /* Check if we should release the ID class */ + if (type_info->cls->flags & H5I_CLASS_IS_APPLICATION) + type_info->cls = H5MM_xfree_const(type_info->cls); HASH_CLEAR(hh, type_info->hash_table); type_info->hash_table = NULL; @@ -528,12 +512,12 @@ H5I__register(H5I_type_t type, const void *object, hbool_t app_ref, H5I_future_r /* Check arguments */ if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number"); type_info = H5I_type_info_array_g[type]; if ((NULL == type_info) || (type_info->init_count <= 0)) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, H5I_INVALID_HID, "invalid type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, H5I_INVALID_HID, "invalid type"); if (NULL == (info = H5FL_CALLOC(H5I_id_info_t))) - HGOTO_ERROR(H5E_ID, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") + HGOTO_ERROR(H5E_ID, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed"); /* Create the struct & its ID */ new_id = H5I_MAKE(type, type_info->nextid); @@ -552,7 +536,7 @@ H5I__register(H5I_type_t type, const void *object, hbool_t app_ref, H5I_future_r type_info->nextid++; /* Sanity check for the 'nextid' getting too large and wrapping around */ - HDassert(type_info->nextid <= ID_MASK); + assert(type_info->nextid <= ID_MASK); /* Set the most recent ID to this object */ type_info->last_id_info = info; @@ -582,12 +566,12 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Sanity checks */ - HDassert(type >= H5I_FILE && type < H5I_NTYPES); - HDassert(object); + assert(type >= H5I_FILE && type < H5I_NTYPES); + assert(object); /* Retrieve ID for object */ if (H5I_INVALID_HID == (ret_value = H5I__register(type, object, app_ref, NULL, NULL))) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -621,29 +605,29 @@ H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, h FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(object); + assert(object); /* Make sure ID is not already in use */ if (NULL != (info = H5I__find_id(existing_id))) - HGOTO_ERROR(H5E_ID, H5E_BADRANGE, FAIL, "ID already in use") + HGOTO_ERROR(H5E_ID, H5E_BADRANGE, FAIL, "ID already in use"); /* Make sure type number is valid */ if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); /* Get type pointer from list of types */ type_info = H5I_type_info_array_g[type]; if (NULL == type_info || type_info->init_count <= 0) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type"); /* Make sure requested ID belongs to object's type */ if (H5I_TYPE(existing_id) != type) - HGOTO_ERROR(H5E_ID, H5E_BADRANGE, FAIL, "invalid type for provided ID") + HGOTO_ERROR(H5E_ID, H5E_BADRANGE, FAIL, "invalid type for provided ID"); /* Allocate new structure to house this ID */ if (NULL == (info = H5FL_CALLOC(H5I_id_info_t))) - HGOTO_ERROR(H5E_ID, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_ID, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Create the struct & insert requested ID */ info->id = existing_id; @@ -678,9 +662,6 @@ H5I_register_using_existing_id(H5I_type_t type, void *object, hbool_t app_ref, h * with the specified ID. * Failure: NULL * - * Programmer: Quincey Koziol - * Saturday, February 27, 2010 - * *------------------------------------------------------------------------- */ void * @@ -693,7 +674,7 @@ H5I_subst(hid_t id, const void *new_object) /* General lookup of the ID */ if (NULL == (info = H5I__find_id(id))) - HGOTO_ERROR(H5E_ID, H5E_NOTFOUND, NULL, "can't get ID ref count") + HGOTO_ERROR(H5E_ID, H5E_NOTFOUND, NULL, "can't get ID ref count"); /* Get the old object pointer to return */ H5_GCC_CLANG_DIAG_OFF("cast-qual") @@ -748,9 +729,6 @@ H5I_object(hid_t id) * specified ID. * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, July 31, 2002 - * *------------------------------------------------------------------------- */ void * @@ -761,7 +739,7 @@ H5I_object_verify(hid_t id, H5I_type_t type) FUNC_ENTER_NOAPI_NOERR - HDassert(type >= 1 && (int)type < H5I_next_type_g); + assert(type >= 1 && (int)type < H5I_next_type_g); /* Verify that the type of the ID is correct & lookup the ID */ if (type == H5I_TYPE(id) && NULL != (info = H5I__find_id(id))) { @@ -787,9 +765,6 @@ H5I_object_verify(hid_t id, H5I_type_t type) * ID types). * Failure: H5I_BADID * - * Programmer: Robb Matzke - * Friday, February 19, 1999 - * *------------------------------------------------------------------------- */ H5I_type_t @@ -802,7 +777,7 @@ H5I_get_type(hid_t id) if (id > 0) ret_value = H5I_TYPE(id); - HDassert(ret_value >= H5I_BADID && (int)ret_value < H5I_next_type_g); + assert(ret_value >= H5I_BADID && (int)ret_value < H5I_next_type_g); FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_get_type() */ @@ -828,7 +803,7 @@ H5I_is_file_object(hid_t id) H5I_type_t type = H5I_get_type(id); htri_t ret_value = FAIL; - FUNC_ENTER_NOAPI(FAIL); + FUNC_ENTER_NOAPI(FAIL) /* Fail if the ID type is out of range */ if (type < 1 || type >= H5I_NTYPES) @@ -852,7 +827,7 @@ H5I_is_file_object(hid_t id) ret_value = FALSE; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5I_is_file_object() */ /*------------------------------------------------------------------------- @@ -866,9 +841,6 @@ H5I_is_file_object(hid_t id) * calling H5I_object(). * Failure: NULL * - * Programmer: James Laird - * Nat Furrer - * *------------------------------------------------------------------------- */ void * @@ -897,9 +869,6 @@ H5I__remove_verify(hid_t id, H5I_type_t type) * calling H5I_object(). * Failure: NULL * - * Programmer: Quincey Koziol - * October 3, 2013 - * *------------------------------------------------------------------------- */ static void * @@ -911,19 +880,19 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(type_info); + assert(type_info); /* Delete or mark the node */ HASH_FIND(hh, type_info->hash_table, &id, sizeof(hid_t), info); if (info) { - HDassert(!info->marked); - if (!H5I_marking_g) + assert(!info->marked); + if (!H5I_marking_s) HASH_DELETE(hh, type_info->hash_table, info); else info->marked = TRUE; } else - HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, NULL, "can't remove ID node from hash table") + HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, NULL, "can't remove ID node from hash table"); /* Check if this ID was the last one accessed */ if (type_info->last_id_info == info) @@ -933,7 +902,7 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id) ret_value = (void *)info->object; H5_GCC_CLANG_DIAG_ON("cast-qual") - if (!H5I_marking_g) + if (!H5I_marking_s) info = H5FL_FREE(H5I_id_info_t, info); /* Decrement the number of IDs in the type */ @@ -967,14 +936,14 @@ H5I_remove(hid_t id) /* Check arguments */ type = H5I_TYPE(id); if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "invalid type number"); type_info = H5I_type_info_array_g[type]; if (type_info == NULL || type_info->init_count <= 0) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "invalid type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, NULL, "invalid type"); /* Remove the node from the type */ if (NULL == (ret_value = H5I__remove_common(type_info, id))) - HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, NULL, "can't remove ID node") + HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, NULL, "can't remove ID node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1005,11 +974,11 @@ H5I__dec_ref(hid_t id, void **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(id >= 0); + assert(id >= 0); /* General lookup of the ID */ if (NULL == (info = H5I__find_id(id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID"); /* If this is the last reference to the object then invoke the type's * free method on the object. If the free method is undefined or @@ -1035,7 +1004,7 @@ H5I__dec_ref(hid_t id, void **request) if (!type_info->cls->free_func || (type_info->cls->free_func)((void *)info->object, request) >= 0) { /* Remove the node from the type */ if (NULL == H5I__remove_common(type_info, id)) - HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, (-1), "can't remove ID node") + HGOTO_ERROR(H5E_ID, H5E_CANTDELETE, (-1), "can't remove ID node"); ret_value = 0; } /* end if */ else @@ -1069,11 +1038,11 @@ H5I_dec_ref(hid_t id) FUNC_ENTER_NOAPI((-1)) /* Sanity check */ - HDassert(id >= 0); + assert(id >= 0); /* Synchronously decrement refcount on ID */ if ((ret_value = H5I__dec_ref(id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1101,11 +1070,11 @@ H5I__dec_app_ref(hid_t id, void **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(id >= 0); + assert(id >= 0); /* Call regular decrement reference count routine */ if ((ret_value = H5I__dec_ref(id, request)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count"); /* Check if the ID still exists */ if (ret_value > 0) { @@ -1113,11 +1082,11 @@ H5I__dec_app_ref(hid_t id, void **request) /* General lookup of the ID */ if (NULL == (info = H5I__find_id(id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID"); /* Adjust app_ref */ --(info->app_count); - HDassert(info->count >= info->app_count); + assert(info->count >= info->app_count); /* Set return value */ ret_value = (int)info->app_count; @@ -1136,9 +1105,6 @@ H5I__dec_app_ref(hid_t id, void **request) * Return: Success: New app. reference count * Failure: -1 * - * Programmer: Quincey Koziol - * Sept 16, 2010 - * *------------------------------------------------------------------------- */ int @@ -1149,11 +1115,11 @@ H5I_dec_app_ref(hid_t id) FUNC_ENTER_NOAPI((-1)) /* Sanity check */ - HDassert(id >= 0); + assert(id >= 0); /* Synchronously decrement refcount on ID */ if ((ret_value = H5I__dec_app_ref(id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1171,9 +1137,6 @@ H5I_dec_app_ref(hid_t id) * Return: Success: New app. reference count * Failure: -1 * - * Programmer: Houjun Tang - * Oct 21, 2019 - * *------------------------------------------------------------------------- */ int @@ -1184,11 +1147,11 @@ H5I_dec_app_ref_async(hid_t id, void **token) FUNC_ENTER_NOAPI((-1)) /* Sanity check */ - HDassert(id >= 0); + assert(id >= 0); /* [Possibly] aynchronously decrement refcount on ID */ if ((ret_value = H5I__dec_app_ref(id, token)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't asynchronously decrement ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't asynchronously decrement ID ref count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1216,7 +1179,7 @@ H5I__dec_app_ref_always_close(hid_t id, void **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(id >= 0); + assert(id >= 0); /* Call application decrement reference count routine */ ret_value = H5I__dec_app_ref(id, request); @@ -1231,7 +1194,7 @@ H5I__dec_app_ref_always_close(hid_t id, void **request) */ H5I_remove(id); - HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count"); } /* end if */ done: @@ -1257,11 +1220,11 @@ H5I_dec_app_ref_always_close(hid_t id) FUNC_ENTER_NOAPI((-1)) /* Sanity check */ - HDassert(id >= 0); + assert(id >= 0); /* Synchronously decrement refcount on ID */ if ((ret_value = H5I__dec_app_ref_always_close(id, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't decrement ID ref count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1289,11 +1252,11 @@ H5I_dec_app_ref_always_close_async(hid_t id, void **token) FUNC_ENTER_NOAPI((-1)) /* Sanity check */ - HDassert(id >= 0); + assert(id >= 0); /* [Possibly] aynchronously decrement refcount on ID */ if ((ret_value = H5I__dec_app_ref_always_close(id, token)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't asynchronously decrement ID ref count") + HGOTO_ERROR(H5E_ID, H5E_CANTDEC, (-1), "can't asynchronously decrement ID ref count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1318,11 +1281,11 @@ H5I_inc_ref(hid_t id, hbool_t app_ref) FUNC_ENTER_NOAPI((-1)) /* Sanity check */ - HDassert(id >= 0); + assert(id >= 0); /* General lookup of the ID */ if (NULL == (info = H5I__find_id(id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID"); /* Adjust reference counts */ ++(info->count); @@ -1355,11 +1318,11 @@ H5I_get_ref(hid_t id, hbool_t app_ref) FUNC_ENTER_NOAPI((-1)) /* Sanity check */ - HDassert(id >= 0); + assert(id >= 0); /* General lookup of the ID */ if (NULL == (info = H5I__find_id(id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't locate ID"); /* Set return value */ ret_value = (int)(app_ref ? info->app_count : info->count); @@ -1387,12 +1350,12 @@ H5I__inc_type_ref(H5I_type_t type) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(type > 0 && (int)type < H5I_next_type_g); + assert(type > 0 && (int)type < H5I_next_type_g); /* Check arguments */ type_info = H5I_type_info_array_g[type]; if (NULL == type_info) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "invalid type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "invalid type"); /* Set return value */ ret_value = (int)(++(type_info->init_count)); @@ -1429,11 +1392,11 @@ H5I_dec_type_ref(H5I_type_t type) FUNC_ENTER_NOAPI((-1)) if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "invalid type number"); type_info = H5I_type_info_array_g[type]; if (type_info == NULL || type_info->init_count <= 0) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "invalid type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "invalid type"); /* Decrement the number of users of the ID type. If this is the * last user of the type then release all IDs from the type and @@ -1473,12 +1436,12 @@ H5I__get_type_ref(H5I_type_t type) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(type >= 0); + assert(type >= 0); /* Check arguments */ type_info = H5I_type_info_array_g[type]; if (!type_info) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "invalid type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, (-1), "invalid type"); /* Set return value */ ret_value = (int)type_info->init_count; @@ -1571,7 +1534,7 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re /* Check arguments */ if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid type number"); type_info = H5I_type_info_array_g[type]; /* Only iterate through ID list if it is initialized and there are IDs in type */ @@ -1592,7 +1555,7 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re if (!item->marked) { int ret = H5I__iterate_cb((void *)item, NULL, (void *)&iter_udata); if (H5_ITER_ERROR == ret) - HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed") + HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed"); if (H5_ITER_STOP == ret) break; } @@ -1628,10 +1591,10 @@ H5I__find_id(hid_t id) /* Check arguments */ type = H5I_TYPE(id); if (type <= H5I_BADID || (int)type >= H5I_next_type_g) - HGOTO_DONE(NULL) + HGOTO_DONE(NULL); type_info = H5I_type_info_array_g[type]; if (!type_info || type_info->init_count <= 0) - HGOTO_DONE(NULL) + HGOTO_DONE(NULL); /* Check for same ID as we have looked up last time */ if (type_info->last_id_info && type_info->last_id_info->id == id) @@ -1652,23 +1615,23 @@ H5I__find_id(hid_t id) /* Invoke the realize callback, to get the actual object */ if ((id_info->realize_cb)((void *)id_info->object, &actual_id) < 0) - HGOTO_DONE(NULL) + HGOTO_DONE(NULL); /* Verify that we received a valid ID, of the same type */ if (H5I_INVALID_HID == actual_id) - HGOTO_DONE(NULL) + HGOTO_DONE(NULL); if (H5I_TYPE(id) != H5I_TYPE(actual_id)) - HGOTO_DONE(NULL) + HGOTO_DONE(NULL); /* Swap the actual object in for the future object */ future_object = (void *)id_info->object; actual_object = H5I__remove_common(type_info, actual_id); - HDassert(actual_object); + assert(actual_object); id_info->object = actual_object; /* Discard the future object */ if ((id_info->discard_cb)(future_object) < 0) - HGOTO_DONE(NULL) + HGOTO_DONE(NULL); future_object = NULL; /* Change the ID from 'future' to 'actual' */ @@ -1707,8 +1670,8 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(info); - HDassert(udata); + assert(info); + assert(udata); /* Get a pointer to the VOL connector's data */ H5_GCC_CLANG_DIAG_OFF("cast-qual") @@ -1743,13 +1706,13 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id) FUNC_ENTER_NOAPI(FAIL) - HDassert(id); + assert(id); *id = H5I_INVALID_HID; type_info = H5I_type_info_array_g[type]; if (!type_info || type_info->init_count <= 0) - HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type") + HGOTO_ERROR(H5E_ID, H5E_BADGROUP, FAIL, "invalid type"); /* Only iterate through ID list if it is initialized and there are IDs in type */ if (type_info->init_count > 0 && type_info->id_count > 0) { @@ -1767,7 +1730,7 @@ H5I_find_id(const void *object, H5I_type_t type, hid_t *id) { int ret = H5I__find_id_cb((void *)item, NULL, (void *)&udata); if (H5_ITER_ERROR == ret) - HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed") + HGOTO_ERROR(H5E_ID, H5E_BADITER, FAIL, "iteration failed"); if (H5_ITER_STOP == ret) break; } diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5IntType.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5IntType.cpp deleted file mode 100644 index 27c449165b..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5IntType.cpp +++ /dev/null @@ -1,205 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5DxferProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5AbstractDs.h" -#include "H5DataSpace.h" -#include "H5AtomType.h" -#include "H5IntType.h" -#include "H5DataSet.h" -#include "H5PredType.h" - -namespace H5 { - -//-------------------------------------------------------------------------- -// Function: IntType default constructor -///\brief Default constructor: Creates a stub integer datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IntType::IntType() -{ -} - -//-------------------------------------------------------------------------- -// Function: IntType copy constructor -///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IntType::IntType(const IntType &original) : AtomType(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: IntType overloaded constructor -///\brief Creates a integer type using a predefined type -///\param pred_type - IN: Predefined datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IntType::IntType(const PredType &pred_type) : AtomType() -{ - // use DataType::copy to make a copy of this predefined type - copy(pred_type); -} - -//-------------------------------------------------------------------------- -// Function: IntType overloaded constructor -///\brief Creates an integer datatype using the id of an existing -/// datatype. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IntType::IntType(const hid_t existing_id) : AtomType(existing_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: IntType overloaded constructor -///\brief Gets the integer datatype of the specified dataset. -///\param dataset - IN: Dataset that this integer datatype associates with -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IntType::IntType(const DataSet &dataset) : AtomType() -{ - // Calls C function H5Dget_type to get the id of the datatype - id = H5Dget_type(dataset.getId()); - - if (id < 0) { - throw DataSetIException("IntType constructor", "H5Dget_type failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: IntType overloaded constructor -///\brief Creates a IntType instance by opening an HDF5 integer datatype -/// given its name as a char*. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Integer type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openIntType(const char*) to -// improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -IntType::IntType(const H5Location &loc, const char *dtype_name) : AtomType() -{ - id = p_opentype(loc, dtype_name); -} - -//-------------------------------------------------------------------------- -// Function: IntType overloaded constructor -///\brief Creates a IntType instance by opening an HDF5 integer datatype -/// given its name, provided as an \c H5std_string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Integer type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openIntType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -IntType::IntType(const H5Location &loc, const H5std_string &dtype_name) : AtomType() -{ - id = p_opentype(loc, dtype_name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: IntType::decode -///\brief Returns an IntType object via DataType* by decoding the -/// binary object description of this type. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -DataType * -IntType::decode() const -{ - hid_t encoded_inttype_id = H5I_INVALID_HID; - try { - encoded_inttype_id = p_decode(); - } - catch (DataTypeIException &err) { - throw; - } - IntType *encoded_inttype = new IntType; - encoded_inttype->p_setId(encoded_inttype_id); - return (encoded_inttype); -} - -//-------------------------------------------------------------------------- -// Function: IntType::getSign -///\brief Retrieves the sign type for an integer type. -///\return Valid sign type -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5T_sign_t -IntType::getSign() const -{ - H5T_sign_t type_sign = H5Tget_sign(id); // C routine - - // Returns a valid sign type if no errors - if (type_sign == H5T_SGN_ERROR) { - throw DataTypeIException("IntType::getSign", - "H5Tget_sign failed - returned H5T_SGN_ERROR for the sign type"); - } - return (type_sign); -} - -//-------------------------------------------------------------------------- -// Function: IntType::getSign -///\brief Sets the sign property for an integer type. -///\param sign - IN: Sign type -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -IntType::setSign(H5T_sign_t sign) const -{ - // Call C routine to set the sign property - herr_t ret_value = H5Tset_sign(id, sign); - if (ret_value < 0) { - throw DataTypeIException("IntType::setSign", "H5Tset_sign failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: IntType destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -IntType::~IntType() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Itest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Itest.c index 80738a9c3c..68204a86d9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Itest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Itest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -59,9 +58,6 @@ * Return: Success: The length of name. * Failure: -1 * - * Programmer: Quincey Koziol - * Tuesday, July 27, 2010 - * *------------------------------------------------------------------------- */ ssize_t @@ -78,25 +74,25 @@ H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached) /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context"); api_ctx_pushed = TRUE; /* Get the object pointer */ if (NULL == (vol_obj = H5VL_vol_object(id))) - HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier") + HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier"); /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTSET, (-1), "can't set VOL wrapper info") + HGOTO_ERROR(H5E_ID, H5E_CANTSET, (-1), "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Get object location */ if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object location") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object location"); /* Call internal group routine to retrieve object's name */ if (H5G_get_name(&loc, name, size, &name_len, cached) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name") + HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name"); /* Set return value */ ret_value = (ssize_t)name_len; @@ -104,10 +100,10 @@ H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached) done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_ID, H5E_CANTRESET, (-1), "can't reset VOL wrapper info") + HDONE_ERROR(H5E_ID, H5E_CANTRESET, (-1), "can't reset VOL wrapper info"); if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context") + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5I__get_name_test() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5L.c b/externals/coda-oss/modules/drivers/hdf5/source/H5L.c index ba8da1f29a..c746ec6b60 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5L.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5L.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -85,9 +84,6 @@ static herr_t H5L__iterate_api_common(hid_t group_id, H5_index_t idx_type, H5_it * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Wednesday, March 29, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -106,13 +102,13 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds /* Check arguments */ if (src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC"); if (!src_name || !*src_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified"); if (!dst_name || !*dst_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified"); if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list"); /* Check the link create property list */ if (H5P_DEFAULT == lcpl_id) @@ -124,7 +120,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set location parameter for source object */ loc_params1.type = H5VL_OBJECT_BY_NAME; @@ -141,11 +137,11 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds if (H5L_SAME_LOC != src_loc_id) /* Get the location object */ if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (H5L_SAME_LOC != dst_loc_id) /* Get the location object */ if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Make sure that the VOL connectors are the same */ if (vol_obj1 && vol_obj2) { @@ -153,10 +149,10 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds /* Check if both objects are associated with the same VOL connector */ if (H5VL_cmp_connector_cls(&same_connector, vol_obj1->connector->cls, vol_obj2->connector->cls) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes"); if (same_connector) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "Objects are accessed through different VOL connectors and can't be linked") + "Objects are accessed through different VOL connectors and can't be linked"); } /* Construct a temporary source VOL object */ @@ -166,7 +162,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds } else { if (NULL == vol_obj2) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "NULL VOL object") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "NULL VOL object"); tmp_vol_obj.connector = vol_obj2->connector; tmp_vol_obj.data = NULL; @@ -175,7 +171,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds /* Move the link */ if (H5VL_link_move(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link"); done: FUNC_LEAVE_API(ret_value) @@ -190,9 +186,6 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Wednesday, March 29, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -211,13 +204,13 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds /* Check arguments */ if (src_loc_id == H5L_SAME_LOC && dst_loc_id == H5L_SAME_LOC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not both be H5L_SAME_LOC"); if (!src_name || !*src_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified"); if (!dst_name || !*dst_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified"); if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list"); /* Check the link create property list */ if (H5P_DEFAULT == lcpl_id) @@ -229,7 +222,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set location parameter for source object */ loc_params1.type = H5VL_OBJECT_BY_NAME; @@ -246,11 +239,11 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds if (H5L_SAME_LOC != src_loc_id) /* Get the location object */ if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(src_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (H5L_SAME_LOC != dst_loc_id) /* Get the location object */ if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(dst_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Make sure that the VOL connectors are the same */ if (vol_obj1 && vol_obj2) { @@ -258,10 +251,10 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds /* Check if both objects are associated with the same VOL connector */ if (H5VL_cmp_connector_cls(&same_connector, vol_obj1->connector->cls, vol_obj2->connector->cls) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes"); if (same_connector) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "Objects are accessed through different VOL connectors and can't be linked") + "Objects are accessed through different VOL connectors and can't be linked"); } /* end if */ /* Construct a temporary source VOL object */ @@ -271,7 +264,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds } /* end if */ else { if (NULL == vol_obj2) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "NULL VOL object pointer") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "NULL VOL object pointer"); tmp_vol_obj.connector = vol_obj2->connector; tmp_vol_obj.data = NULL; @@ -280,7 +273,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds /* Copy the link */ if (H5VL_link_copy(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link") + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to copy link"); done: FUNC_LEAVE_API(ret_value) @@ -310,13 +303,13 @@ H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const ch /* Check arguments */ if (link_loc_id == H5L_SAME_LOC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link location id should not be H5L_SAME_LOC") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link location id should not be H5L_SAME_LOC"); if (!link_target) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be NULL"); if (!*link_target) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be an empty string"); if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list"); /* link_name is verified in H5VL_setup_name_args() */ /* Get the link creation property list */ @@ -328,11 +321,11 @@ H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const ch /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up object access arguments */ if (H5VL_setup_name_args(link_loc_id, link_name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_CREATE_SOFT; @@ -341,7 +334,7 @@ H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const ch /* Create the link */ if (H5VL_link_create(&vol_cb_args, *vol_obj_ptr, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link") + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -360,9 +353,6 @@ H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const ch * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, April 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -376,7 +366,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name /* Creates a soft link synchronously */ if (H5L__create_soft_api_common(link_target, link_loc_id, link_name, lcpl_id, lapl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to synchronously create soft link") + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to synchronously create soft link"); done: FUNC_LEAVE_API(ret_value) @@ -411,7 +401,7 @@ H5Lcreate_soft_async(const char *app_file, const char *app_func, unsigned app_li /* Creates a soft link asynchronously */ if (H5L__create_soft_api_common(link_target, link_loc_id, link_name, lcpl_id, lapl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to asynchronously create soft link") + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to asynchronously create soft link"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -419,7 +409,7 @@ H5Lcreate_soft_async(const char *app_file, const char *app_func, unsigned app_li if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(__func__, "*s*sIu*si*siii", app_file, app_func, app_line, link_target, link_loc_id, link_name, lcpl_id, lapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -452,17 +442,17 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_l /* Check arguments */ if (cur_loc_id == H5L_SAME_LOC && link_loc_id == H5L_SAME_LOC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC"); if (!cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be NULL"); if (!*cur_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be an empty string"); if (!link_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be NULL"); if (!*link_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be an empty string"); if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list"); /* Check the link create property list */ if (H5P_DEFAULT == lcpl_id) @@ -473,7 +463,7 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_l /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, cur_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up new location struct */ link_loc_params.type = H5VL_OBJECT_BY_NAME; @@ -484,11 +474,11 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_l if (H5L_SAME_LOC != cur_loc_id) /* Get the current location object */ if (NULL == (curr_vol_obj = (H5VL_object_t *)H5VL_vol_object(cur_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (H5L_SAME_LOC != link_loc_id) /* Get the new location object */ if (NULL == (link_vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Make sure that the VOL connectors are the same */ if (curr_vol_obj && link_vol_obj) { @@ -497,10 +487,10 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_l /* Check if both objects are associated with the same VOL connector */ if (H5VL_cmp_connector_cls(&same_connector, curr_vol_obj->connector->cls, link_vol_obj->connector->cls) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes"); if (same_connector) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "Objects are accessed through different VOL connectors and can't be linked") + "Objects are accessed through different VOL connectors and can't be linked"); } /* end if */ /* Construct a temporary VOL object */ @@ -508,7 +498,7 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_l (*tmp_vol_obj_ptr_ptr)->connector = curr_vol_obj->connector; else { if (NULL == link_vol_obj) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "NULL VOL object pointer") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "NULL VOL object pointer"); (*tmp_vol_obj_ptr_ptr)->connector = link_vol_obj->connector; } /* end else */ @@ -529,7 +519,7 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_l /* Create the link */ if (H5VL_link_create(&vol_cb_args, *tmp_vol_obj_ptr_ptr, &link_loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link") + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -546,9 +536,6 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_l * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, April 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -563,7 +550,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const c /* Creates a hard link synchronously */ if (H5L__create_hard_api_common(cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to synchronously create hard link") + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to synchronously create hard link"); done: FUNC_LEAVE_API(ret_value) @@ -605,7 +592,7 @@ H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_li /* Creates a hard link asynchronously */ if (H5L__create_hard_api_common(cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, token_ptr, &vol_obj_ptr) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to asynchronously create hard link") + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to asynchronously create hard link"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -613,7 +600,7 @@ H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_li if (H5ES_insert(es_id, vol_obj_ptr->connector, token, H5ARG_TRACE10(__func__, "*s*sIui*si*siii", app_file, app_func, app_line, cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -634,9 +621,6 @@ H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_li * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, May 18, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -659,11 +643,11 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i /* Check arguments */ if (!file_name || !*file_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no file name specified"); if (!obj_name || !*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name specified"); if (!link_name || !*link_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified"); /* Get the link creation property list */ if (H5P_DEFAULT == lcpl_id) @@ -674,18 +658,18 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get normalized copy of the link target */ if (NULL == (norm_obj_name = H5G_normalize(obj_name))) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize object name") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize object name"); /* Combine the filename and link name into a single buffer to give to the UD link */ file_name_len = HDstrlen(file_name) + 1; norm_obj_name_len = HDstrlen(norm_obj_name) + 1; buf_size = 1 + file_name_len + norm_obj_name_len; if (NULL == (ext_link_buf = H5MM_malloc(buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate udata buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate udata buffer"); /* Encode the external link information */ p = (uint8_t *)ext_link_buf; @@ -701,7 +685,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_CREATE_UD; @@ -712,7 +696,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i /* Create an external link */ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link"); done: H5MM_xfree(ext_link_buf); @@ -740,9 +724,6 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Tuesday, December 13, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -759,11 +740,11 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, con /* Check arguments */ if (!link_name || !*link_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no link name specified"); if (link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class"); if (!udata && udata_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata cannot be NULL if udata_size is non-zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "udata cannot be NULL if udata_size is non-zero"); /* Get the link creation property list */ if (H5P_DEFAULT == lcpl_id) @@ -774,7 +755,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, con /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); loc_params.type = H5VL_OBJECT_BY_NAME; loc_params.loc_data.loc_by_name.name = link_name; @@ -783,7 +764,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, con /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_CREATE_UD; @@ -794,7 +775,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, con /* Create user-defined link */ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link"); done: FUNC_LEAVE_API(ret_value) @@ -827,14 +808,14 @@ H5L__delete_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **tok /* Set up object access arguments */ if (H5VL_setup_name_args(loc_id, name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_DELETE; /* Delete link */ if (H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -852,9 +833,6 @@ H5L__delete_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **tok * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, April 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -867,7 +845,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) /* Delete a link synchronously */ if (H5L__delete_api_common(loc_id, name, lapl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to synchronously delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to synchronously delete link"); done: FUNC_LEAVE_API(ret_value) @@ -900,7 +878,7 @@ H5Ldelete_async(const char *app_file, const char *app_func, unsigned app_line, h /* Delete a link asynchronously */ if (H5L__delete_api_common(loc_id, name, lapl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to asynchronously delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to asynchronously delete link"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -908,7 +886,7 @@ H5Ldelete_async(const char *app_file, const char *app_func, unsigned app_line, h if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -940,23 +918,23 @@ H5L__delete_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t i /* Check arguments */ if (!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); /* Set up object access arguments */ if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_DELETE; /* Delete the link */ if (H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -976,9 +954,6 @@ H5L__delete_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t i * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, November 13, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -992,7 +967,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_i /* Delete a link synchronously */ if (H5L__delete_by_idx_api_common(loc_id, group_name, idx_type, order, n, lapl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to synchronously delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to synchronously delete link"); done: FUNC_LEAVE_API(ret_value) @@ -1028,7 +1003,7 @@ H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_ /* Delete a link asynchronously */ if (H5L__delete_by_idx_api_common(loc_id, group_name, idx_type, order, n, lapl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to asynchronously delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to asynchronously delete link"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1036,7 +1011,7 @@ H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE10(__func__, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1056,9 +1031,6 @@ H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_ * * Failure: Negative * - * Programmer: Robb Matzke - * Monday, April 13, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1074,11 +1046,11 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -1088,7 +1060,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t /* Get the VOL object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_GET_VAL; @@ -1097,7 +1069,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t /* Get the link value */ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name); done: FUNC_LEAVE_API(ret_value) @@ -1116,9 +1088,6 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t * Return: Success: Non-negative with the link value in BUF. * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, November 13, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1135,15 +1104,15 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ /* Check arguments */ if (!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_IDX; @@ -1156,7 +1125,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ /* Get the VOL object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_GET_VAL; @@ -1165,7 +1134,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ /* Get the link value */ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value"); done: FUNC_LEAVE_API(ret_value) @@ -1196,11 +1165,11 @@ H5L__exists_api_common(hid_t loc_id, const char *name, hbool_t *exists, hid_t la /* Check arguments */ /* name is verified in H5VL_setup_name_args() */ if (NULL == exists) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer for link existence") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer for link existence"); /* Set up object access arguments */ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_EXISTS; @@ -1208,7 +1177,7 @@ H5L__exists_api_common(hid_t loc_id, const char *name, hbool_t *exists, hid_t la /* Check for the existence of the link */ if (H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1221,9 +1190,6 @@ H5L__exists_api_common(hid_t loc_id, const char *name, hbool_t *exists, hid_t la * * Return: Success: TRUE/FALSE/FAIL * - * Programmer: Quincey Koziol - * Friday, March 16, 2007 - * *------------------------------------------------------------------------- */ htri_t @@ -1238,7 +1204,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) /* Synchronously check if a link exists */ exists = FALSE; if (H5L__exists_api_common(loc_id, name, &exists, lapl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to synchronously check link existence") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to synchronously check link existence"); /* Set return value */ ret_value = (htri_t)exists; @@ -1273,7 +1239,7 @@ H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, h /* Asynchronously check if a link exists */ if (H5L__exists_api_common(loc_id, name, exists, lapl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to asynchronously check link existence") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to asynchronously check link existence"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1281,7 +1247,7 @@ H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, h /* clang-format off */ H5ARG_TRACE8(__func__, "*s*sIui*s*bii", app_file, app_func, app_line, loc_id, name, exists, lapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1295,9 +1261,6 @@ H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, h * Return: Success: Non-negative with information in LINFO * Failure: Negative * - * Programmer: James Laird - * Wednesday, June 21, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1313,11 +1276,11 @@ H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t l /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -1327,7 +1290,7 @@ H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t l /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_GET_INFO; @@ -1335,7 +1298,7 @@ H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t l /* Get the link information */ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info"); done: FUNC_LEAVE_API(ret_value) @@ -1350,9 +1313,6 @@ H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t l * Return: Success: Non-negative with information in LINFO * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1369,15 +1329,15 @@ H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Check arguments */ if (!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_IDX; @@ -1390,7 +1350,7 @@ H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_GET_INFO; @@ -1398,7 +1358,7 @@ H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Get the link information */ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info"); done: FUNC_LEAVE_API(ret_value) @@ -1418,9 +1378,6 @@ H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Monday, July 10, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1433,7 +1390,7 @@ H5Lregister(const H5L_class_t *cls) /* Check args */ if (cls == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class"); /* Check H5L_class_t version number; this is where a function to convert * from an outdated version should be called. @@ -1443,23 +1400,23 @@ H5Lregister(const H5L_class_t *cls) * (in src/H5Gtraverse.c), so it's allowed to to pass through here. - QAK, 2018/02/06 */ if (cls->version > H5L_LINK_CLASS_T_VERS) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid H5L_class_t version number"); #ifdef H5_NO_DEPRECATED_SYMBOLS if (cls->version < H5L_LINK_CLASS_T_VERS) HGOTO_ERROR( H5E_ARGS, H5E_BADVALUE, FAIL, "deprecated H5L_class_t version number (%d) and library built without deprecated symbol support", - cls->version) + cls->version); #endif /* H5_NO_DEPRECATED_SYMBOLS */ if (cls->id < H5L_TYPE_UD_MIN || cls->id > H5L_TYPE_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link identification number"); if (cls->trav_func == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no traversal function specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no traversal function specified"); /* Do it */ if (H5L_register(cls) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register link type") + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register link type"); done: FUNC_LEAVE_API(ret_value) @@ -1475,9 +1432,6 @@ H5Lregister(const H5L_class_t *cls) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Monday, July 10, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1490,11 +1444,11 @@ H5Lunregister(H5L_type_t id) /* Check args */ if (id < 0 || id > H5L_TYPE_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type"); /* Do it */ if (H5L_unregister(id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type") + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to unregister link type"); done: FUNC_LEAVE_API(ret_value) @@ -1510,9 +1464,6 @@ H5Lunregister(H5L_type_t id) * FALSE if it is unregistered * FAIL on error (if the class is not a valid UD class ID) * - * Programmer: James Laird - * Monday, July 10, 2006 - * *------------------------------------------------------------------------- */ htri_t @@ -1526,11 +1477,11 @@ H5Lis_registered(H5L_type_t id) /* Check args */ if (id < 0 || id > H5L_TYPE_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type id number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link type id number"); /* Is the link class already registered? */ if (H5L_is_registered(id, &is_registered) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "could not determine registration status of UD link type") + HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "could not determine registration status of UD link type"); ret_value = is_registered ? TRUE : FALSE; @@ -1551,9 +1502,6 @@ H5Lis_registered(H5L_type_t id) * * Failure: -1 * - * Programmer: Quincey Koziol - * Saturday, November 11, 2006 - * *------------------------------------------------------------------------- */ ssize_t @@ -1571,15 +1519,15 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5 /* Check arguments */ if (!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name specified"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid iteration order specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list info"); /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_IDX; @@ -1592,7 +1540,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5 /* Get the VOL object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_GET_NAME; @@ -1602,7 +1550,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5 /* Get the link information */ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, (-1), "unable to get link name"); /* Set the return value */ ret_value = (ssize_t)link_name_len; @@ -1637,17 +1585,17 @@ H5L__iterate_api_common(hid_t group_id, H5_index_t idx_type, H5_iter_order_t ord /* Check arguments */ id_type = H5I_get_type(group_id); if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified"); /* Set up object access arguments */ if (H5VL_setup_self_args(group_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_ITER; @@ -1661,7 +1609,7 @@ H5L__iterate_api_common(hid_t group_id, H5_index_t idx_type, H5_iter_order_t ord /* Iterate over the links */ if ((ret_value = H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1696,7 +1644,7 @@ H5Literate2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t /* Iterate over links synchronously */ if ((ret_value = H5L__iterate_api_common(group_id, idx_type, order, idx_p, op, op_data, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "synchronous link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "synchronous link iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -1739,7 +1687,7 @@ H5Literate_async(const char *app_file, const char *app_func, unsigned app_line, /* Iterate over links asynchronously */ if ((ret_value = H5L__iterate_api_common(group_id, idx_type, order, idx_p, op, op_data, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "asynchronous link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "asynchronous link iteration failed"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1747,7 +1695,7 @@ H5Literate_async(const char *app_file, const char *app_func, unsigned app_line, if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE10(__func__, "*s*sIuiIiIo*hLI*xi", app_file, app_func, app_line, group_id, idx_type, order, idx_p, op, op_data, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1770,9 +1718,6 @@ H5Literate_async(const char *app_file, const char *app_func, unsigned app_line, * of the operators. * * - * Programmer: Quincey Koziol - * Thursday, November 16, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1789,23 +1734,23 @@ H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Check arguments */ if (!group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL"); if (!*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -1825,7 +1770,7 @@ H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Iterate over the links */ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -1854,9 +1799,6 @@ H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 24 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1874,13 +1816,13 @@ H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat /* Check args */ id_type = H5I_get_type(group_id); if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1888,7 +1830,7 @@ H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_ITER; @@ -1902,7 +1844,7 @@ H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat /* Iterate over the links */ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed"); done: FUNC_LEAVE_API(ret_value) @@ -1931,9 +1873,6 @@ H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 3 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1950,23 +1889,23 @@ H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ /* Check args */ if (!group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL"); if (!*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -1986,7 +1925,7 @@ H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ /* Visit the links */ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed"); done: FUNC_LEAVE_API(ret_value) @@ -2010,9 +1949,6 @@ H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ * * Return: Non-negative on success/ Negative on failure * - * Programmer: James Laird - * Monday, July 17, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2030,21 +1966,21 @@ H5Lunpack_elink_val(const void *_ext_linkval, size_t link_size, unsigned *flags, /* Sanity check external link buffer */ if (ext_linkval == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an external link linkval buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not an external link linkval buffer"); lnk_version = (*ext_linkval >> 4) & 0x0F; lnk_flags = *ext_linkval & 0x0F; if (lnk_version > H5L_EXT_VERSION) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad version number for external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad version number for external link"); if (lnk_flags & (unsigned)~H5L_EXT_FLAGS_ALL) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad flags for external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad flags for external link"); if (link_size <= 2) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid external link buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid external link buffer"); /* Try to do some error checking. If the last character in the linkval * (the last character of obj_path) isn't NULL, then something's wrong. */ if (ext_linkval[link_size - 1] != '\0') - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "linkval buffer is not NULL-terminated") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "linkval buffer is not NULL-terminated"); /* We're now guaranteed that HDstrlen won't segfault, since the buffer has * at least one NULL in it. @@ -2055,7 +1991,7 @@ H5Lunpack_elink_val(const void *_ext_linkval, size_t link_size, unsigned *flags, * this external link value has no object name and is invalid. */ if ((len + 1) >= (link_size - 1)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "linkval buffer doesn't contain an object path") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "linkval buffer doesn't contain an object path"); /* If we got here then the buffer contains (at least) two strings packed * in the correct way. Assume it's correct and return pointers to the diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5LT.c b/externals/coda-oss/modules/drivers/hdf5/source/H5LT.c new file mode 100644 index 0000000000..d48f240081 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5LT.c @@ -0,0 +1,3343 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "H5LTprivate.h" + +/* For Lex and Yacc */ +#define COL 3 +#define LIMIT 512 +#define INCREMENT 1024 +#define TMP_LEN 256 +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) +size_t input_len; +char *myinput; +size_t indent = 0; + +/* File Image operations + + A file image is a representation of an HDF5 file in a memory + buffer. In order to perform operations on an image in a similar way + to a file, the application buffer is copied to a FAPL buffer, which + in turn is copied to a VFD buffer. Buffer copying can decrease + performance, especially when using large file images. A solution to + this issue is to simulate the copying of the application buffer, + when actually the same buffer is used for the FAPL and the VFD. + This is implemented by using callbacks that simulate the standard + functions for memory management (additional callbacks are used for + the management of associated data structures). From the application + standpoint, a file handle can be obtained from a file image by using + the API routine H5LTopen_file_image(). This function takes a flag + argument that indicates the HDF5 library how to handle the given image; + several flag values can be combined by using the bitwise OR operator. + Valid flag values include: + + H5LT_FILE_IMAGE_OPEN_RW indicates the HDF5 library to open the file + image in read/write mode. Default is read-only mode. + + H5LT_FILE_IMAGE_DONT_COPY indicates the HDF5 library to not copy the + supplied user buffer; the same buffer will be handled by the FAPL and + the VFD driver. Default operation copies the user buffer to the FAPL and + VFD driver. + + H5LT_FILE_IMAGE_DONT_RELEASE indicates the HDF5 library to not release + the buffer handled by the FAPL and the VFD upon closing. This flag value + is only applicable when the flag value H5LT_FILE_IMAGE_DONT_COPY is set as + well. The application is responsible to release the image buffer. +*/ + +/* Data structure to pass application data to callbacks. */ +typedef struct { + void *app_image_ptr; /* Pointer to application buffer */ + size_t app_image_size; /* Size of application buffer */ + void *fapl_image_ptr; /* Pointer to FAPL buffer */ + size_t fapl_image_size; /* Size of FAPL buffer */ + int fapl_ref_count; /* Reference counter for FAPL buffer */ + void *vfd_image_ptr; /* Pointer to VFD buffer */ + size_t vfd_image_size; /* Size of VFD buffer */ + int vfd_ref_count; /* Reference counter for VFD buffer */ + unsigned flags; /* Flags indicate how the file image will */ + /* be open */ + int ref_count; /* Reference counter on udata struct */ +} H5LT_file_image_ud_t; + +/* callbacks prototypes for file image ops */ +static void *image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *udata); +static void *image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file_image_op, + void *udata); +static void *image_realloc(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *udata); +static herr_t image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *udata); +static void *udata_copy(void *udata); +static herr_t udata_free(void *udata); + +/* Definition of callbacks for file image operations. */ + +/*------------------------------------------------------------------------- + * Function: image_malloc + * + * Purpose: Simulates malloc() function to avoid copying file images. + * The application buffer is set to the buffer on only one FAPL. + * Then the FAPL buffer can be copied to other FAPL buffers or + * to only one VFD buffer. + * + * Return: Address of "allocated" buffer, if successful. Otherwise, it returns + * NULL. + * + *------------------------------------------------------------------------- + */ +static void * +image_malloc(size_t size, H5FD_file_image_op_t file_image_op, void *_udata) +{ + H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata; + void *return_value = NULL; + + /* callback is only used if the application buffer is not actually copied */ + if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY)) + goto out; + + switch (file_image_op) { + /* the app buffer is "copied" to only one FAPL. Afterwards, FAPLs can be "copied" */ + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET: + if (udata->app_image_ptr == NULL) + goto out; + if (udata->app_image_size != size) + goto out; + if (udata->fapl_image_ptr != NULL) + goto out; + if (udata->fapl_image_size != 0) + goto out; + if (udata->fapl_ref_count != 0) + goto out; + + udata->fapl_image_ptr = udata->app_image_ptr; + udata->fapl_image_size = udata->app_image_size; + return_value = udata->fapl_image_ptr; + udata->fapl_ref_count++; + break; + + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY: + if (udata->fapl_image_ptr == NULL) + goto out; + if (udata->fapl_image_size != size) + goto out; + if (udata->fapl_ref_count == 0) + goto out; + + return_value = udata->fapl_image_ptr; + udata->fapl_ref_count++; + break; + + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET: + goto out; + + case H5FD_FILE_IMAGE_OP_FILE_OPEN: + /* FAPL buffer is "copied" to only one VFD buffer */ + if (udata->vfd_image_ptr != NULL) + goto out; + if (udata->vfd_image_size != 0) + goto out; + if (udata->vfd_ref_count != 0) + goto out; + if (udata->fapl_image_ptr == NULL) + goto out; + if (udata->fapl_image_size != size) + goto out; + if (udata->fapl_ref_count == 0) + goto out; + + udata->vfd_image_ptr = udata->fapl_image_ptr; + udata->vfd_image_size = size; + udata->vfd_ref_count++; + return_value = udata->vfd_image_ptr; + break; + + /* added unused labels to shut the compiler up */ + case H5FD_FILE_IMAGE_OP_NO_OP: + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE: + case H5FD_FILE_IMAGE_OP_FILE_RESIZE: + case H5FD_FILE_IMAGE_OP_FILE_CLOSE: + default: + goto out; + } /* end switch */ + + return (return_value); + +out: + return NULL; +} /* end image_malloc() */ + +/*------------------------------------------------------------------------- + * Function: image_memcpy + * + * Purpose: Simulates memcpy() function to avoid copying file images. + * The image buffer can be set to only one FAPL buffer, and + * "copied" to only one VFD buffer. The FAPL buffer can be + * "copied" to other FAPLs buffers. + * + * Return: The address of the destination buffer, if successful. Otherwise, it + * returns NULL. + * + *------------------------------------------------------------------------- + */ +static void * +image_memcpy(void *dest, const void *src, size_t size, H5FD_file_image_op_t file_image_op, void *_udata) +{ + H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata; + + /* callback is only used if the application buffer is not actually copied */ + if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY)) + goto out; + + switch (file_image_op) { + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET: + if (dest != udata->fapl_image_ptr) + goto out; + if (src != udata->app_image_ptr) + goto out; + if (size != udata->fapl_image_size) + goto out; + if (size != udata->app_image_size) + goto out; + if (udata->fapl_ref_count == 0) + goto out; + break; + + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY: + if (dest != udata->fapl_image_ptr) + goto out; + if (src != udata->fapl_image_ptr) + goto out; + if (size != udata->fapl_image_size) + goto out; + if (udata->fapl_ref_count < 2) + goto out; + break; + + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET: + goto out; + + case H5FD_FILE_IMAGE_OP_FILE_OPEN: + if (dest != udata->vfd_image_ptr) + goto out; + if (src != udata->fapl_image_ptr) + goto out; + if (size != udata->vfd_image_size) + goto out; + if (size != udata->fapl_image_size) + goto out; + if (udata->fapl_ref_count == 0) + goto out; + if (udata->vfd_ref_count != 1) + goto out; + break; + + /* added unused labels to shut the compiler up */ + case H5FD_FILE_IMAGE_OP_NO_OP: + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE: + case H5FD_FILE_IMAGE_OP_FILE_RESIZE: + case H5FD_FILE_IMAGE_OP_FILE_CLOSE: + default: + goto out; + } /* end switch */ + + return (dest); + +out: + return NULL; +} /* end image_memcpy() */ + +/*------------------------------------------------------------------------- + * Function: image_realloc + * + * Purpose: Reallocates the shared application image buffer and updates data + * structures that manage buffer "copying". + * + * Return: Address of reallocated buffer, if successful. Otherwise, it returns + * NULL. + * + *------------------------------------------------------------------------- + */ +static void * +image_realloc(void *ptr, size_t size, H5FD_file_image_op_t file_image_op, void *_udata) +{ + H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata; + void *return_value = NULL; + + /* callback is only used if the application buffer is not actually copied */ + if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY)) + goto out; + + /* realloc() is not allowed when the HDF5 library won't release the image + buffer because reallocation may change the address of the buffer. The + new address cannot be communicated to the application to release it. */ + if (udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE) + goto out; + + /* realloc() is not allowed if the image is open in read-only mode */ + if (!(udata->flags & H5LT_FILE_IMAGE_OPEN_RW)) + goto out; + + if (file_image_op == H5FD_FILE_IMAGE_OP_FILE_RESIZE) { + if (udata->vfd_image_ptr != ptr) + goto out; + + if (udata->vfd_ref_count != 1) + goto out; + + if (NULL == (udata->vfd_image_ptr = realloc(ptr, size))) + goto out; + + udata->vfd_image_size = size; + return_value = udata->vfd_image_ptr; + } /* end if */ + else + goto out; + + return (return_value); + +out: + return NULL; +} /* end image_realloc() */ + +/*------------------------------------------------------------------------- + * Function: image_free + * + * Purpose: Simulates deallocation of FAPL and VFD buffers by decreasing + * reference counters. Shared application buffer is actually + * deallocated if there are no outstanding references. + * + * Return: SUCCEED or FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +image_free(void *ptr, H5FD_file_image_op_t file_image_op, void *_udata) +{ + H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata; + + /* callback is only used if the application buffer is not actually copied */ + if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY)) + goto out; + + switch (file_image_op) { + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE: + if (udata->fapl_image_ptr != ptr) + goto out; + if (udata->fapl_ref_count == 0) + goto out; + + udata->fapl_ref_count--; + + /* release the shared buffer only if indicated by the respective flag and there are no outstanding + * references */ + if (udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0 && + !(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) { + free(udata->fapl_image_ptr); + udata->app_image_ptr = NULL; + udata->fapl_image_ptr = NULL; + udata->vfd_image_ptr = NULL; + } /* end if */ + break; + + case H5FD_FILE_IMAGE_OP_FILE_CLOSE: + if (udata->vfd_image_ptr != ptr) + goto out; + if (udata->vfd_ref_count != 1) + goto out; + + udata->vfd_ref_count--; + + /* release the shared buffer only if indicated by the respective flag and there are no outstanding + * references */ + if (udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0 && + !(udata->flags & H5LT_FILE_IMAGE_DONT_RELEASE)) { + free(udata->vfd_image_ptr); + udata->app_image_ptr = NULL; + udata->fapl_image_ptr = NULL; + udata->vfd_image_ptr = NULL; + } /* end if */ + break; + + /* added unused labels to keep the compiler quite */ + case H5FD_FILE_IMAGE_OP_NO_OP: + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET: + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY: + case H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET: + case H5FD_FILE_IMAGE_OP_FILE_OPEN: + case H5FD_FILE_IMAGE_OP_FILE_RESIZE: + default: + goto out; + } /* end switch */ + + return (SUCCEED); + +out: + return (FAIL); +} /* end image_free() */ + +/*------------------------------------------------------------------------- + * Function: udata_copy + * + * Purpose: Simulates the copying of the user data structure utilized in the + * management of the "copying" of file images. + * + * Return: Address of "newly allocated" structure, if successful. Otherwise, it + * returns NULL. + * + *------------------------------------------------------------------------- + */ +static void * +udata_copy(void *_udata) +{ + H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata; + + /* callback is only used if the application buffer is not actually copied */ + if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY)) + goto out; + if (udata->ref_count == 0) + goto out; + + udata->ref_count++; + + return (udata); + +out: + return NULL; +} /* end udata_copy */ + +/*------------------------------------------------------------------------- + * Function: udata_free + * + * Purpose: Simulates deallocation of the user data structure utilized in the + * management of the "copying" of file images. The data structure is + * actually deallocated when there are no outstanding references. + * + * Return: SUCCEED or FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +udata_free(void *_udata) +{ + H5LT_file_image_ud_t *udata = (H5LT_file_image_ud_t *)_udata; + + /* callback is only used if the application buffer is not actually copied */ + if (!(udata->flags & H5LT_FILE_IMAGE_DONT_COPY)) + goto out; + if (udata->ref_count == 0) + goto out; + + udata->ref_count--; + + /* checks that there are no references outstanding before deallocating udata */ + if (udata->ref_count == 0 && udata->fapl_ref_count == 0 && udata->vfd_ref_count == 0) + free(udata); + + return (SUCCEED); + +out: + return (FAIL); +} /* end udata_free */ + +/* End of callbacks definitions for file image operations */ + +/*------------------------------------------------------------------------- + * + * internal functions + * + *------------------------------------------------------------------------- + */ +static herr_t H5LT_get_attribute_mem(hid_t loc_id, const char *obj_name, const char *attr_name, + hid_t mem_type_id, void *data); + +/*------------------------------------------------------------------------- + * Function: H5LT_make_dataset + * + * Purpose: Creates and writes a dataset of a type tid + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +static herr_t +H5LT_make_dataset_numerical(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, hid_t tid, + const void *data) +{ + hid_t did = -1, sid = -1; + + /* check the arguments */ + if (dset_name == NULL) + return -1; + + /* Create the data space for the dataset. */ + if ((sid = H5Screate_simple(rank, dims, NULL)) < 0) + return -1; + + /* Create the dataset. */ + if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + + /* Write the dataset only if there is data to write */ + if (data) + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + goto out; + + /* End access to the dataset and release resources used by it. */ + if (H5Dclose(did) < 0) + return -1; + + /* Terminate access to the data space. */ + if (H5Sclose(sid) < 0) + return -1; + + return 0; + +out: + H5E_BEGIN_TRY + { + H5Dclose(did); + H5Sclose(sid); + } + H5E_END_TRY + return -1; +} + +/*------------------------------------------------------------------------- + * + * Public functions + * + *------------------------------------------------------------------------- + */ + +/*------------------------------------------------------------------------- + * Function: H5LTmake_dataset + * + * Purpose: Creates and writes a dataset of a type tid + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTmake_dataset(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, hid_t tid, + const void *data) +{ + return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, tid, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTmake_dataset_char + * + * Purpose: Creates and writes a dataset of H5T_NATIVE_CHAR type + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTmake_dataset_char(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const char *data) +{ + return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_CHAR, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTmake_dataset_short + * + * Purpose: Creates and writes a dataset of H5T_NATIVE_SHORT type + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTmake_dataset_short(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const short *data) +{ + return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_SHORT, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTmake_dataset_int + * + * Purpose: Creates and writes a dataset of H5T_NATIVE_INT type + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTmake_dataset_int(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const int *data) +{ + return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_INT, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTmake_dataset_long + * + * Purpose: Creates and writes a dataset of H5T_NATIVE_LONG type + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTmake_dataset_long(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const long *data) +{ + return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_LONG, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTmake_dataset_float + * + * Purpose: Creates and writes a dataset of H5T_NATIVE_FLOAT type + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTmake_dataset_float(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, const float *data) +{ + return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_FLOAT, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTmake_dataset_double + * + * Purpose: Creates and writes a dataset of H5T_NATIVE_DOUBLE type + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTmake_dataset_double(hid_t loc_id, const char *dset_name, int rank, const hsize_t *dims, + const double *data) +{ + return (H5LT_make_dataset_numerical(loc_id, dset_name, rank, dims, H5T_NATIVE_DOUBLE, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTmake_dataset_string + * + * Purpose: Creates and writes a dataset of H5T_C_S1 type + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTmake_dataset_string(hid_t loc_id, const char *dset_name, const char *buf) +{ + hid_t did = -1; + hid_t sid = -1; + hid_t tid = -1; + size_t size; + + /* check the arguments */ + if (dset_name == NULL) + return -1; + + /* create a string data type */ + if ((tid = H5Tcopy(H5T_C_S1)) < 0) + goto out; + + size = strlen(buf) + 1; /* extra null term */ + + if (H5Tset_size(tid, size) < 0) + goto out; + + if (H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0) + goto out; + + /* Create the data space for the dataset. */ + if ((sid = H5Screate(H5S_SCALAR)) < 0) + goto out; + + /* Create the dataset. */ + if ((did = H5Dcreate2(loc_id, dset_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + + /* Write the dataset only if there is data to write */ + if (buf) + if (H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto out; + + /* close*/ + if (H5Dclose(did) < 0) + return -1; + if (H5Sclose(sid) < 0) + return -1; + if (H5Tclose(tid) < 0) + goto out; + + return 0; + +out: + H5E_BEGIN_TRY + { + H5Dclose(did); + H5Tclose(tid); + H5Sclose(sid); + } + H5E_END_TRY + return -1; +} + +/*------------------------------------------------------------------------- + * Function: H5LTopen_file_image + * + * Purpose: Open a user supplied file image using the core file driver. + * + * Return: File identifier, Failure: -1 + * + *------------------------------------------------------------------------- + */ +hid_t +H5LTopen_file_image(void *buf_ptr, size_t buf_size, unsigned flags) +{ + hid_t fapl = -1, file_id = -1; /* HDF5 identifiers */ + unsigned file_open_flags; /* Flags for image open */ + char file_name[64]; /* Filename buffer */ + size_t alloc_incr; /* Buffer allocation increment */ + size_t min_incr = 65536; /* Minimum buffer increment */ + double buf_prcnt = 0.1; /* Percentage of buffer size to set + as increment */ + static long file_name_counter; + H5FD_file_image_callbacks_t callbacks = {&image_malloc, &image_memcpy, &image_realloc, &image_free, + &udata_copy, &udata_free, (void *)NULL}; + + /* check arguments */ + if (buf_ptr == NULL) + goto out; + if (buf_size == 0) + goto out; + if (flags & (unsigned)~(H5LT_FILE_IMAGE_ALL)) + goto out; + + /* Create FAPL to transmit file image */ + if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + goto out; + + /* set allocation increment to a percentage of the supplied buffer size, or + * a pre-defined minimum increment value, whichever is larger + */ + if ((size_t)(buf_prcnt * (double)buf_size) > min_incr) + alloc_incr = (size_t)(buf_prcnt * (double)buf_size); + else + alloc_incr = min_incr; + + /* Configure FAPL to use the core file driver */ + if (H5Pset_fapl_core(fapl, alloc_incr, false) < 0) + goto out; + + /* Set callbacks for file image ops ONLY if the file image is NOT copied */ + if (flags & H5LT_FILE_IMAGE_DONT_COPY) { + H5LT_file_image_ud_t *udata; /* Pointer to udata structure */ + + /* Allocate buffer to communicate user data to callbacks */ + if (NULL == (udata = (H5LT_file_image_ud_t *)malloc(sizeof(H5LT_file_image_ud_t)))) + goto out; + + /* Initialize udata with info about app buffer containing file image and flags */ + udata->app_image_ptr = buf_ptr; + udata->app_image_size = buf_size; + udata->fapl_image_ptr = NULL; + udata->fapl_image_size = 0; + udata->fapl_ref_count = 0; + udata->vfd_image_ptr = NULL; + udata->vfd_image_size = 0; + udata->vfd_ref_count = 0; + udata->flags = flags; + udata->ref_count = 1; /* corresponding to the first FAPL */ + + /* copy address of udata into callbacks */ + callbacks.udata = (void *)udata; + + /* Set file image callbacks */ + if (H5Pset_file_image_callbacks(fapl, &callbacks) < 0) { + free(udata); + goto out; + } /* end if */ + } /* end if */ + + /* Assign file image in user buffer to FAPL */ + if (H5Pset_file_image(fapl, buf_ptr, buf_size) < 0) + goto out; + + /* set file open flags */ + if (flags & H5LT_FILE_IMAGE_OPEN_RW) + file_open_flags = H5F_ACC_RDWR; + else + file_open_flags = H5F_ACC_RDONLY; + + /* define a unique file name */ + snprintf(file_name, (sizeof(file_name) - 1), "file_image_%ld", file_name_counter++); + + /* Assign file image in FAPL to the core file driver */ + if ((file_id = H5Fopen(file_name, file_open_flags, fapl)) < 0) + goto out; + + /* Close FAPL */ + if (H5Pclose(fapl) < 0) + goto out; + + /* Return file identifier */ + return file_id; + +out: + H5E_BEGIN_TRY + { + H5Pclose(fapl); + } + H5E_END_TRY + return -1; +} /* end H5LTopen_file_image() */ + +/*------------------------------------------------------------------------- + * Function: H5LT_read_dataset + * + * Purpose: Reads a dataset from disk. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +static herr_t +H5LT_read_dataset_numerical(hid_t loc_id, const char *dset_name, hid_t tid, void *data) +{ + hid_t did; + + /* check the arguments */ + if (dset_name == NULL) + return -1; + + /* Open the dataset. */ + if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + return -1; + + /* Read */ + if (H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) + goto out; + + /* End access to the dataset and release resources used by it. */ + if (H5Dclose(did)) + return -1; + + return 0; + +out: + H5Dclose(did); + return -1; +} + +/*------------------------------------------------------------------------- + * Function: H5LTread_dataset + * + * Purpose: Reads a dataset from disk. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTread_dataset(hid_t loc_id, const char *dset_name, hid_t tid, void *data) +{ + return (H5LT_read_dataset_numerical(loc_id, dset_name, tid, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTread_dataset_char + * + * Purpose: Reads a dataset from disk. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTread_dataset_char(hid_t loc_id, const char *dset_name, char *data) +{ + return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_CHAR, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTread_dataset_short + * + * Purpose: Reads a dataset from disk. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTread_dataset_short(hid_t loc_id, const char *dset_name, short *data) +{ + return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_SHORT, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTread_dataset_int + * + * Purpose: Reads a dataset from disk. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTread_dataset_int(hid_t loc_id, const char *dset_name, int *data) +{ + return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_INT, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTread_dataset_long + * + * Purpose: Reads a dataset from disk. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTread_dataset_long(hid_t loc_id, const char *dset_name, long *data) +{ + return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_LONG, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTread_dataset_float + * + * Purpose: Reads a dataset from disk. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTread_dataset_float(hid_t loc_id, const char *dset_name, float *data) +{ + return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_FLOAT, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTread_dataset_double + * + * Purpose: Reads a dataset from disk. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTread_dataset_double(hid_t loc_id, const char *dset_name, double *data) +{ + return (H5LT_read_dataset_numerical(loc_id, dset_name, H5T_NATIVE_DOUBLE, data)); +} + +/*------------------------------------------------------------------------- + * Function: H5LTread_dataset_string + * + * Purpose: Reads a dataset + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTread_dataset_string(hid_t loc_id, const char *dset_name, char *buf) +{ + hid_t did = -1; + hid_t tid = -1; + + /* check the arguments */ + if (dset_name == NULL) + return -1; + + /* Open the dataset. */ + if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + return -1; + + if ((tid = H5Dget_type(did)) < 0) + goto out; + + /* Read */ + if (H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + goto out; + + /* close */ + if (H5Dclose(did)) + goto out; + if (H5Tclose(tid)) + return -1; + + return 0; + +out: + H5E_BEGIN_TRY + { + H5Dclose(did); + H5Tclose(tid); + } + H5E_END_TRY + return -1; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_dataset_ndims + * + * Purpose: Gets the dimensionality of a dataset. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTget_dataset_ndims(hid_t loc_id, const char *dset_name, int *rank) +{ + hid_t did = -1; + hid_t sid = -1; + + /* check the arguments */ + if (dset_name == NULL) + return -1; + + /* Open the dataset. */ + if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + return -1; + + /* Get the dataspace handle */ + if ((sid = H5Dget_space(did)) < 0) + goto out; + + /* Get rank */ + if ((*rank = H5Sget_simple_extent_ndims(sid)) < 0) + goto out; + + /* Terminate access to the dataspace */ + if (H5Sclose(sid) < 0) + goto out; + + /* End access to the dataset */ + if (H5Dclose(did)) + return -1; + + return 0; + +out: + H5E_BEGIN_TRY + { + H5Dclose(did); + H5Sclose(sid); + } + H5E_END_TRY + return -1; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_dataset_info + * + * Purpose: Gets information about a dataset. + * + * Return: Success: 0, Failure: -1 + *------------------------------------------------------------------------- + */ + +herr_t +H5LTget_dataset_info(hid_t loc_id, const char *dset_name, hsize_t *dims, H5T_class_t *type_class, + size_t *type_size) +{ + hid_t did = -1; + hid_t tid = -1; + hid_t sid = -1; + + /* check the arguments */ + if (dset_name == NULL) + return -1; + + /* open the dataset. */ + if ((did = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) + return -1; + + /* get an identifier for the datatype. */ + tid = H5Dget_type(did); + + /* get the class. */ + if (type_class != NULL) + *type_class = H5Tget_class(tid); + + /* get the size. */ + if (type_size != NULL) + *type_size = H5Tget_size(tid); + + if (dims != NULL) { + /* get the dataspace handle */ + if ((sid = H5Dget_space(did)) < 0) + goto out; + + /* get dimensions */ + if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) + goto out; + + /* terminate access to the dataspace */ + if (H5Sclose(sid) < 0) + goto out; + } /* end if */ + + /* release the datatype. */ + if (H5Tclose(tid)) + return -1; + + /* end access to the dataset */ + if (H5Dclose(did)) + return -1; + + return 0; + +out: + H5E_BEGIN_TRY + { + H5Tclose(tid); + H5Sclose(sid); + H5Dclose(did); + } + H5E_END_TRY + return -1; +} + +/*------------------------------------------------------------------------- + * Function: find_dataset + * + * Purpose: operator function used by H5LTfind_dataset + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +static herr_t +find_dataset(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const H5L_info2_t *linfo, + void *op_data) +{ + /* Define a default zero value for return. This will cause the iterator to continue if + * the dataset is not found yet. + */ + int ret = 0; + + /* check the arguments */ + if (name == NULL) + return ret; + + /* Shut the compiler up */ + (void)loc_id; + (void)linfo; + + /* Define a positive value for return value if the dataset was found. This will + * cause the iterator to immediately return that positive value, + * indicating short-circuit success + */ + if (strncmp(name, (char *)op_data, strlen((char *)op_data)) == 0) + ret = 1; + + return ret; +} + +/*------------------------------------------------------------------------- + * Function: H5LTfind_dataset + * + * Purpose: Inquires if a dataset named dset_name exists attached + * to the object loc_id. + * + * Return: + * Success: The return value of the first operator that + * returns non-zero, or zero if all members were + * processed with no operator returning non-zero. + * + * Failure: Negative if something goes wrong within the + * library, or the negative value returned by one + * of the operators. + * + *------------------------------------------------------------------------- + */ +/* H5Literate wants a non-const pointer but we have a const pointer in the API + * call. It's safe to ignore this because we control the callback, don't + * modify the op_data buffer (i.e.: dset_name) during the traversal, and the + * library never modifies that buffer. + */ +H5_GCC_CLANG_DIAG_OFF("cast-qual") +herr_t +H5LTfind_dataset(hid_t loc_id, const char *dset_name) +{ + return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, 0, find_dataset, (void *)dset_name); +} +H5_GCC_CLANG_DIAG_ON("cast-qual") + +/*------------------------------------------------------------------------- + * + * Set attribute functions + * + *------------------------------------------------------------------------- + */ + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_string + * + * Purpose: Creates and writes a string attribute named attr_name and attaches + * it to the object specified by the name obj_name. + * + * Return: Success: 0, Failure: -1 + * + * Comments: If the attribute already exists, it is overwritten + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTset_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name, const char *attr_data) +{ + hid_t attr_type; + hid_t attr_space_id; + hid_t attr_id; + hid_t obj_id; + htri_t has_attr; + size_t attr_size; + + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + if (attr_data == NULL) + return -1; + + /* Open the object */ + if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) + return -1; + + /* Create the attribute */ + if ((attr_type = H5Tcopy(H5T_C_S1)) < 0) + goto out; + + attr_size = strlen(attr_data) + 1; /* extra null term */ + + if (H5Tset_size(attr_type, (size_t)attr_size) < 0) + goto out; + + if (H5Tset_strpad(attr_type, H5T_STR_NULLTERM) < 0) + goto out; + + if ((attr_space_id = H5Screate(H5S_SCALAR)) < 0) + goto out; + + /* Delete the attribute if it already exists */ + if ((has_attr = H5Aexists(obj_id, attr_name)) < 0) + goto out; + if (has_attr > 0) + if (H5Adelete(obj_id, attr_name) < 0) + goto out; + + /* Create and write the attribute */ + + if ((attr_id = H5Acreate2(obj_id, attr_name, attr_type, attr_space_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + + if (H5Awrite(attr_id, attr_type, attr_data) < 0) + goto out; + + if (H5Aclose(attr_id) < 0) + goto out; + + if (H5Sclose(attr_space_id) < 0) + goto out; + + if (H5Tclose(attr_type) < 0) + goto out; + + /* Close the object */ + if (H5Oclose(obj_id) < 0) + return -1; + + return 0; + +out: + + H5Oclose(obj_id); + return -1; +} + +/*------------------------------------------------------------------------- + * Function: H5LT_set_attribute_numerical + * + * Purpose: Private function used by H5LTset_attribute_int and H5LTset_attribute_float + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LT_set_attribute_numerical(hid_t loc_id, const char *obj_name, const char *attr_name, size_t size, + hid_t tid, const void *data) +{ + + hid_t obj_id, sid, attr_id; + hsize_t dim_size = size; + htri_t has_attr; + + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + + /* Open the object */ + if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) + return -1; + + /* Create the data space for the attribute. */ + if ((sid = H5Screate_simple(1, &dim_size, NULL)) < 0) + goto out; + + /* Delete the attribute if it already exists */ + if ((has_attr = H5Aexists(obj_id, attr_name)) < 0) + goto out; + if (has_attr > 0) + if (H5Adelete(obj_id, attr_name) < 0) + goto out; + + /* Create the attribute. */ + if ((attr_id = H5Acreate2(obj_id, attr_name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + + /* Write the attribute data. */ + if (H5Awrite(attr_id, tid, data) < 0) + goto out; + + /* Close the attribute. */ + if (H5Aclose(attr_id) < 0) + goto out; + + /* Close the dataspace. */ + if (H5Sclose(sid) < 0) + goto out; + + /* Close the object */ + if (H5Oclose(obj_id) < 0) + return -1; + + return 0; + +out: + H5Oclose(obj_id); + return -1; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_char + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name, const char *data, + size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_CHAR, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_uchar + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned char *data, + size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_UCHAR, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_short + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name, const short *data, + size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_SHORT, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_ushort + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name, + const unsigned short *data, size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_USHORT, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_int + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name, const int *data, size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_INT, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_uint + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned int *data, + size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_UINT, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_long + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name, const long *data, + size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_LONG, data) < 0) + return -1; + + return 0; +} +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_long_long + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: This function was added to support attributes of type long long + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name, const long long *data, + size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_LLONG, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_ulong + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name, const unsigned long *data, + size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_ULONG, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_ullong + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTset_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, + const unsigned long long *data, size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_ULLONG, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_float + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name, const float *data, + size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_FLOAT, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTset_attribute_double + * + * Purpose: Create and write an attribute. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTset_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name, const double *data, + size_t size) +{ + + if (H5LT_set_attribute_numerical(loc_id, obj_name, attr_name, size, H5T_NATIVE_DOUBLE, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTfind_attribute + * + * Purpose: Checks if an attribute named attr_name exists attached to + * the object loc_id + * + * TODO: Overloading herr_t is not a great idea. This function either + * needs to be rewritten to take a Boolean out parameter in + * HDF5 2.0 or possibly even eliminated entirely as it simply + * wraps H5Aexists. + * + * Return: An htri_t value cast to herr_t + * Exists: Positive + * Does not exist: 0 + * Error: Negative + *------------------------------------------------------------------------- + */ +herr_t +H5LTfind_attribute(hid_t loc_id, const char *attr_name) +{ + return (herr_t)H5Aexists(loc_id, attr_name); +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_ndims + * + * Purpose: Gets the dimensionality of an attribute. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTget_attribute_ndims(hid_t loc_id, const char *obj_name, const char *attr_name, int *rank) +{ + hid_t attr_id; + hid_t sid; + hid_t obj_id; + + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + + /* Open the object */ + if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) + return -1; + + /* Open the attribute. */ + if ((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0) { + H5Oclose(obj_id); + return -1; + } + + /* Get the dataspace handle */ + if ((sid = H5Aget_space(attr_id)) < 0) + goto out; + + /* Get rank */ + if ((*rank = H5Sget_simple_extent_ndims(sid)) < 0) + goto out; + + /* Terminate access to the attribute */ + if (H5Sclose(sid) < 0) + goto out; + + /* End access to the attribute */ + if (H5Aclose(attr_id)) + goto out; + + /* Close the object */ + if (H5Oclose(obj_id) < 0) + return -1; + + return 0; + +out: + H5Aclose(attr_id); + H5Oclose(obj_id); + return -1; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_info + * + * Purpose: Gets information about an attribute. + * + * Return: Success: 0, Failure: -1 + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTget_attribute_info(hid_t loc_id, const char *obj_name, const char *attr_name, hsize_t *dims, + H5T_class_t *type_class, size_t *type_size) +{ + hid_t attr_id; + hid_t tid; + hid_t sid; + hid_t obj_id; + + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + + /* Open the object */ + if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) + return -1; + + /* Open the attribute. */ + if ((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0) { + H5Oclose(obj_id); + return -1; + } + + /* Get an identifier for the datatype. */ + tid = H5Aget_type(attr_id); + + /* Get the class. */ + *type_class = H5Tget_class(tid); + + /* Get the size. */ + *type_size = H5Tget_size(tid); + + /* Get the dataspace handle */ + if ((sid = H5Aget_space(attr_id)) < 0) + goto out; + + /* Get dimensions */ + if (H5Sget_simple_extent_dims(sid, dims, NULL) < 0) + goto out; + + /* Terminate access to the dataspace */ + if (H5Sclose(sid) < 0) + goto out; + + /* Release the datatype. */ + if (H5Tclose(tid)) + goto out; + + /* End access to the attribute */ + if (H5Aclose(attr_id)) + goto out; + + /* Close the object */ + if (H5Oclose(obj_id) < 0) + return -1; + + return 0; + +out: + H5Tclose(tid); + H5Aclose(attr_id); + H5Oclose(obj_id); + return -1; +} + +/*------------------------------------------------------------------------- + * Function: H5LTtext_to_dtype + * + * Purpose: Convert DDL description to HDF5 data type. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +hid_t +H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type) +{ + hid_t type_id; + + /* check the arguments */ + if (text == NULL) + return -1; + + if (lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG) + goto out; + + if (lang_type != H5LT_DDL) { + fprintf(stderr, "only DDL is supported for now.\n"); + goto out; + } + + input_len = strlen(text); + myinput = HDstrdup(text); + + if ((type_id = H5LTyyparse()) < 0) { + free(myinput); + goto out; + } + + free(myinput); + input_len = 0; + + return type_id; + +out: + return -1; +} + +/*------------------------------------------------------------------------- + * Function: realloc_and_append + * + * Purpose: Expand the buffer and append a string to it. + * + * Return: void + * + *------------------------------------------------------------------------- + */ +static char * +realloc_and_append(bool _no_user_buf, size_t *len, char *buf, const char *str_to_add) +{ + size_t size_str_to_add, size_str; + + if (_no_user_buf) { + char *tmp_realloc; + + if (!buf) + goto out; + + /* If the buffer isn't big enough, reallocate it. Otherwise, go to do strcat. */ + if (str_to_add && ((ssize_t)(*len - (strlen(buf) + strlen(str_to_add) + 1)) < LIMIT)) { + *len += ((strlen(buf) + strlen(str_to_add) + 1) / INCREMENT + 1) * INCREMENT; + } + else if (!str_to_add && ((ssize_t)(*len - strlen(buf) - 1) < LIMIT)) { + *len += INCREMENT; + } + + tmp_realloc = (char *)realloc(buf, *len); + if (tmp_realloc == NULL) { + free(buf); + buf = NULL; + goto out; + } + else + buf = tmp_realloc; + } + + if (str_to_add) { + /* find the size of the buffer to add */ + size_str_to_add = strlen(str_to_add); + /* find the size of the current buffer */ + size_str = strlen(buf); + + /* Check to make sure the appended string does not + * extend past the allocated buffer; if it does then truncate the string + */ + if (size_str < *len - 1) { + if (size_str + size_str_to_add < *len - 1) { + strcat(buf, str_to_add); + } + else { + strncat(buf, str_to_add, (*len - 1) - size_str); + } + } + else { + buf[*len - 1] = '\0'; /* buffer is full, null terminate */ + } + } + + return buf; + +out: + return NULL; +} + +/*------------------------------------------------------------------------- + * Function: indentation + * + * Purpose: Print spaces for indentation + * + * Return: void + * + *------------------------------------------------------------------------- + */ +static char * +indentation(size_t x, char *str, bool no_u_buf, size_t *s_len) +{ + char tmp_str[TMP_LEN]; + + if (x < 80) { + memset(tmp_str, ' ', x); + tmp_str[x] = '\0'; + } + else + snprintf(tmp_str, TMP_LEN, "error: the indentation exceeds the number of cols."); + + if (!(str = realloc_and_append(no_u_buf, s_len, str, tmp_str))) + goto out; + + return str; + +out: + return NULL; +} + +/*------------------------------------------------------------------------- + * Function: print_enum + * + * Purpose: prints the enum data + * + * Return: Success: 0, Failure: -1 + * + *-----------------------------------------------------------------------*/ +static char * +print_enum(hid_t type, char *str, size_t *str_len, bool no_ubuf, size_t indt) +{ + char **name = NULL; /*member names */ + unsigned char *value = NULL; /*value array */ + int nmembs; /*number of members */ + char tmp_str[TMP_LEN]; + int nchars; /*number of output characters */ + hid_t super = -1; /*enum base integer type */ + hid_t native = -1; /*native integer data type */ + size_t super_size; /*enum base type size */ + size_t dst_size; /*destination value type size */ + int i; + + if ((nmembs = H5Tget_nmembers(type)) <= 0) + goto out; + + if ((super = H5Tget_super(type)) < 0) + goto out; + + /* Use buffer of INT or UNSIGNED INT to print enum values because + * we don't expect these values to be so big that INT or UNSIGNED + * INT can't hold. + */ + if (H5T_SGN_NONE == H5Tget_sign(super)) { + native = H5T_NATIVE_UINT; + } + else { + native = H5T_NATIVE_INT; + } + + super_size = H5Tget_size(super); + dst_size = H5Tget_size(native); + + /* Get the names and raw values of all members */ + name = (char **)calloc((size_t)nmembs, sizeof(char *)); + value = (unsigned char *)calloc((size_t)nmembs, MAX(dst_size, super_size)); + + for (i = 0; i < nmembs; i++) { + if ((name[i] = H5Tget_member_name(type, (unsigned)i)) == NULL) + goto out; + if (H5Tget_member_value(type, (unsigned)i, value + (size_t)i * super_size) < 0) + goto out; + } + + /* Convert values to native data type */ + if (native > 0) { + if (H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0) + goto out; + } + + /* + * Sort members by increasing value + * ***not implemented yet*** + */ + + /* Print members */ + for (i = 0; i < nmembs; i++) { + if (!(str = indentation(indt + COL, str, no_ubuf, str_len))) + goto out; + nchars = snprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]); + if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) + goto out; + memset(tmp_str, ' ', (size_t)MAX(3, 19 - nchars) + 1); + tmp_str[MAX(3, 19 - nchars)] = '\0'; + if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) + goto out; + + if (H5T_SGN_NONE == H5Tget_sign(native)) + snprintf(tmp_str, TMP_LEN, "%u", *((unsigned int *)((void *)(value + (size_t)i * dst_size)))); + else + snprintf(tmp_str, TMP_LEN, "%d", *((int *)((void *)(value + (size_t)i * dst_size)))); + if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) + goto out; + + snprintf(tmp_str, TMP_LEN, ";\n"); + if (!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) + goto out; + } + + /* Release resources */ + for (i = 0; i < nmembs; i++) + H5free_memory(name[i]); + + free(name); + free(value); + H5Tclose(super); + + return str; + +out: + + if (0 == nmembs) { + str = realloc_and_append(no_ubuf, str_len, str, "\n"); + assert((indt + 4) < TMP_LEN); + memset(tmp_str, ' ', (indt + 4) + 1); + tmp_str[(indt + 4)] = '\0'; + str = realloc_and_append(no_ubuf, str_len, str, tmp_str); + str = realloc_and_append(no_ubuf, str_len, str, " "); + } /* end if */ + + /* Release resources */ + if (name) { + for (i = 0; i < nmembs; i++) + if (name[i]) + free(name[i]); + free(name); + } /* end if */ + + if (value) + free(value); + + if (super >= 0) + H5Tclose(super); + + return NULL; +} + +/*------------------------------------------------------------------------- + * Function: H5LTdtype_to_text + * + * Purpose: Convert HDF5 data type to DDL description. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len) +{ + size_t str_len = INCREMENT; + char *text_str = NULL; + herr_t ret = SUCCEED; + + if (lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG) + goto out; + + if (len && !str) { + text_str = (char *)calloc(str_len, sizeof(char)); + text_str[0] = '\0'; + if (!(text_str = H5LT_dtype_to_text(dtype, text_str, lang_type, &str_len, 1))) + goto out; + *len = strlen(text_str) + 1; + if (text_str) + free(text_str); + text_str = NULL; + } + else if (len && str) { + if (!(H5LT_dtype_to_text(dtype, str, lang_type, len, 0))) + goto out; + str[*len - 1] = '\0'; + } + + return ret; + +out: + free(text_str); + + return FAIL; +} + +/*------------------------------------------------------------------------- + * Function: H5LT_dtype_to_text + * + * Purpose: Private function to convert HDF5 data type to DDL description. + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +char * +H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, bool no_user_buf) +{ + H5T_class_t tcls; + char tmp_str[TMP_LEN]; + int i; + + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, NULL))) + goto out; + + if (lang != H5LT_DDL) { + snprintf(dt_str, *slen, "only DDL is supported for now"); + goto out; + } + + if ((tcls = H5Tget_class(dtype)) < 0) + goto out; + + switch (tcls) { + case H5T_INTEGER: + case H5T_BITFIELD: + if (H5Tequal(dtype, H5T_STD_I8BE)) { + snprintf(dt_str, *slen, "H5T_STD_I8BE"); + } + else if (H5Tequal(dtype, H5T_STD_I8LE)) { + snprintf(dt_str, *slen, "H5T_STD_I8LE"); + } + else if (H5Tequal(dtype, H5T_STD_I16BE)) { + snprintf(dt_str, *slen, "H5T_STD_I16BE"); + } + else if (H5Tequal(dtype, H5T_STD_I16LE)) { + snprintf(dt_str, *slen, "H5T_STD_I16LE"); + } + else if (H5Tequal(dtype, H5T_STD_I32BE)) { + snprintf(dt_str, *slen, "H5T_STD_I32BE"); + } + else if (H5Tequal(dtype, H5T_STD_I32LE)) { + snprintf(dt_str, *slen, "H5T_STD_I32LE"); + } + else if (H5Tequal(dtype, H5T_STD_I64BE)) { + snprintf(dt_str, *slen, "H5T_STD_I64BE"); + } + else if (H5Tequal(dtype, H5T_STD_I64LE)) { + snprintf(dt_str, *slen, "H5T_STD_I64LE"); + } + else if (H5Tequal(dtype, H5T_STD_U8BE)) { + snprintf(dt_str, *slen, "H5T_STD_U8BE"); + } + else if (H5Tequal(dtype, H5T_STD_U8LE)) { + snprintf(dt_str, *slen, "H5T_STD_U8LE"); + } + else if (H5Tequal(dtype, H5T_STD_U16BE)) { + snprintf(dt_str, *slen, "H5T_STD_U16BE"); + } + else if (H5Tequal(dtype, H5T_STD_U16LE)) { + snprintf(dt_str, *slen, "H5T_STD_U16LE"); + } + else if (H5Tequal(dtype, H5T_STD_U32BE)) { + snprintf(dt_str, *slen, "H5T_STD_U32BE"); + } + else if (H5Tequal(dtype, H5T_STD_U32LE)) { + snprintf(dt_str, *slen, "H5T_STD_U32LE"); + } + else if (H5Tequal(dtype, H5T_STD_U64BE)) { + snprintf(dt_str, *slen, "H5T_STD_U64BE"); + } + else if (H5Tequal(dtype, H5T_STD_U64LE)) { + snprintf(dt_str, *slen, "H5T_STD_U64LE"); + } + else if (H5Tequal(dtype, H5T_NATIVE_SCHAR)) { + snprintf(dt_str, *slen, "H5T_NATIVE_SCHAR"); + } + else if (H5Tequal(dtype, H5T_NATIVE_UCHAR)) { + snprintf(dt_str, *slen, "H5T_NATIVE_UCHAR"); + } + else if (H5Tequal(dtype, H5T_NATIVE_SHORT)) { + snprintf(dt_str, *slen, "H5T_NATIVE_SHORT"); + } + else if (H5Tequal(dtype, H5T_NATIVE_USHORT)) { + snprintf(dt_str, *slen, "H5T_NATIVE_USHORT"); + } + else if (H5Tequal(dtype, H5T_NATIVE_INT)) { + snprintf(dt_str, *slen, "H5T_NATIVE_INT"); + } + else if (H5Tequal(dtype, H5T_NATIVE_UINT)) { + snprintf(dt_str, *slen, "H5T_NATIVE_UINT"); + } + else if (H5Tequal(dtype, H5T_NATIVE_LONG)) { + snprintf(dt_str, *slen, "H5T_NATIVE_LONG"); + } + else if (H5Tequal(dtype, H5T_NATIVE_ULONG)) { + snprintf(dt_str, *slen, "H5T_NATIVE_ULONG"); + } + else if (H5Tequal(dtype, H5T_NATIVE_LLONG)) { + snprintf(dt_str, *slen, "H5T_NATIVE_LLONG"); + } + else if (H5Tequal(dtype, H5T_NATIVE_ULLONG)) { + snprintf(dt_str, *slen, "H5T_NATIVE_ULLONG"); + } + else { + snprintf(dt_str, *slen, "undefined integer"); + } + + break; + case H5T_FLOAT: + if (H5Tequal(dtype, H5T_IEEE_F32BE)) { + snprintf(dt_str, *slen, "H5T_IEEE_F32BE"); + } + else if (H5Tequal(dtype, H5T_IEEE_F32LE)) { + snprintf(dt_str, *slen, "H5T_IEEE_F32LE"); + } + else if (H5Tequal(dtype, H5T_IEEE_F64BE)) { + snprintf(dt_str, *slen, "H5T_IEEE_F64BE"); + } + else if (H5Tequal(dtype, H5T_IEEE_F64LE)) { + snprintf(dt_str, *slen, "H5T_IEEE_F64LE"); + } + else if (H5Tequal(dtype, H5T_NATIVE_FLOAT)) { + snprintf(dt_str, *slen, "H5T_NATIVE_FLOAT"); + } + else if (H5Tequal(dtype, H5T_NATIVE_DOUBLE)) { + snprintf(dt_str, *slen, "H5T_NATIVE_DOUBLE"); + } + else if (H5Tequal(dtype, H5T_NATIVE_LDOUBLE)) { + snprintf(dt_str, *slen, "H5T_NATIVE_LDOUBLE"); + } + else { + snprintf(dt_str, *slen, "undefined float"); + } + + break; + case H5T_STRING: { + /* Make a copy of type in memory in case when DTYPE is on disk, the size + * will be bigger than in memory. This makes it easier to compare + * types in memory. */ + hid_t str_type; + H5T_order_t order; + hid_t tmp_type; + size_t size; + H5T_str_t str_pad; + H5T_cset_t cset; + htri_t is_vlstr; + + if ((tmp_type = H5Tcopy(dtype)) < 0) + goto out; + if ((size = H5Tget_size(tmp_type)) == 0) + goto out; + if ((str_pad = H5Tget_strpad(tmp_type)) < 0) + goto out; + if ((cset = H5Tget_cset(tmp_type)) < 0) + goto out; + if ((is_vlstr = H5Tis_variable_str(tmp_type)) < 0) + goto out; + + /* Print lead-in */ + snprintf(dt_str, *slen, "H5T_STRING {\n"); + indent += COL; + + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + + if (is_vlstr) + snprintf(tmp_str, TMP_LEN, "STRSIZE H5T_VARIABLE;\n"); + else + snprintf(tmp_str, TMP_LEN, "STRSIZE %d;\n", (int)size); + + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + + if (str_pad == H5T_STR_NULLTERM) + snprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLTERM;\n"); + else if (str_pad == H5T_STR_NULLPAD) + snprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_NULLPAD;\n"); + else if (str_pad == H5T_STR_SPACEPAD) + snprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_SPACEPAD;\n"); + else + snprintf(tmp_str, TMP_LEN, "STRPAD H5T_STR_ERROR;\n"); + + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + + if (cset == H5T_CSET_ASCII) + snprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_ASCII;\n"); + else if (cset == H5T_CSET_UTF8) + snprintf(tmp_str, TMP_LEN, "CSET H5T_CSET_UTF8;\n"); + else + snprintf(tmp_str, TMP_LEN, "CSET unknown;\n"); + + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + /* Reproduce a C type string */ + if ((str_type = H5Tcopy(H5T_C_S1)) < 0) + goto out; + if (is_vlstr) { + if (H5Tset_size(str_type, H5T_VARIABLE) < 0) + goto out; + } + else { + if (H5Tset_size(str_type, size) < 0) + goto out; + } + if (H5Tset_cset(str_type, cset) < 0) + goto out; + if (H5Tset_strpad(str_type, str_pad) < 0) + goto out; + + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + + /* Check C variable-length string first. Are the two types equal? */ + if (H5Tequal(tmp_type, str_type)) { + snprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + goto next; + } + + /* Change the endianness and see if they're equal. */ + if ((order = H5Tget_order(tmp_type)) < 0) + goto out; + if (order == H5T_ORDER_LE) { + if (H5Tset_order(str_type, H5T_ORDER_LE) < 0) + goto out; + } + else if (order == H5T_ORDER_BE) { + if (H5Tset_order(str_type, H5T_ORDER_BE) < 0) + goto out; + } + + if (H5Tequal(tmp_type, str_type)) { + snprintf(tmp_str, TMP_LEN, "CTYPE H5T_C_S1;\n"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + goto next; + } + + /* If not equal to C variable-length string, check Fortran type. + * Actually H5Tequal can't tell difference between H5T_C_S1 and + * H5T_FORTRAN_S1!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ + if (H5Tclose(str_type) < 0) + goto out; + if ((str_type = H5Tcopy(H5T_FORTRAN_S1)) < 0) + goto out; + if (H5Tset_cset(str_type, cset) < 0) + goto out; + if (H5Tset_size(str_type, size) < 0) + goto out; + if (H5Tset_strpad(str_type, str_pad) < 0) + goto out; + + /* Are the two types equal? */ + if (H5Tequal(tmp_type, str_type)) { + snprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + goto next; + } + + /* Change the endianness and see if they're equal. */ + if ((order = H5Tget_order(tmp_type)) < 0) + goto out; + if (order == H5T_ORDER_LE) { + if (H5Tset_order(str_type, H5T_ORDER_LE) < 0) + goto out; + } + else if (order == H5T_ORDER_BE) { + if (H5Tset_order(str_type, H5T_ORDER_BE) < 0) + goto out; + } + + /* Are the two types equal? */ + if (H5Tequal(tmp_type, str_type)) { + snprintf(tmp_str, TMP_LEN, "CTYPE H5T_FORTRAN_S1;\n"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + goto next; + } + + /* Type doesn't match any of above. */ + snprintf(tmp_str, TMP_LEN, "CTYPE unknown_one_character_type;\n"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + +next: + H5Tclose(str_type); + H5Tclose(tmp_type); + + /* Print closing */ + indent -= COL; + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + snprintf(tmp_str, TMP_LEN, "}"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + break; + } + case H5T_OPAQUE: { + char *tag = NULL; + + /* Print lead-in */ + snprintf(dt_str, *slen, "H5T_OPAQUE {\n"); + indent += COL; + + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + snprintf(tmp_str, TMP_LEN, "OPQ_SIZE %lu;\n", (unsigned long)H5Tget_size(dtype)); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + tag = H5Tget_tag(dtype); + if (tag) { + snprintf(tmp_str, TMP_LEN, "OPQ_TAG \"%s\";\n", tag); + if (tag) + H5free_memory(tag); + tag = NULL; + } + else + snprintf(tmp_str, TMP_LEN, "OPQ_TAG \"\";\n"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + /* Print closing */ + indent -= COL; + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + snprintf(tmp_str, TMP_LEN, "}"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + break; + } + case H5T_ENUM: { + hid_t super; + size_t super_len; + char *stmp = NULL; + + /* Print lead-in */ + snprintf(dt_str, *slen, "H5T_ENUM {\n"); + indent += COL; + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + + if ((super = H5Tget_super(dtype)) < 0) + goto out; + if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0) + goto out; + stmp = (char *)calloc(super_len, sizeof(char)); + if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) { + free(stmp); + goto out; + } + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) { + free(stmp); + goto out; + } + + if (stmp) + free(stmp); + stmp = NULL; + + snprintf(tmp_str, TMP_LEN, ";\n"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + H5Tclose(super); + + if (!(dt_str = print_enum(dtype, dt_str, slen, no_user_buf, indent))) + goto out; + + /* Print closing */ + indent -= COL; + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + snprintf(tmp_str, TMP_LEN, "}"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + break; + } + case H5T_VLEN: { + hid_t super; + size_t super_len; + char *stmp = NULL; + + /* Print lead-in */ + snprintf(dt_str, *slen, "H5T_VLEN {\n"); + indent += COL; + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + + if ((super = H5Tget_super(dtype)) < 0) + goto out; + if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0) + goto out; + stmp = (char *)calloc(super_len, sizeof(char)); + if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) { + free(stmp); + goto out; + } + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) { + free(stmp); + goto out; + } + + if (stmp) + free(stmp); + stmp = NULL; + snprintf(tmp_str, TMP_LEN, "\n"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + H5Tclose(super); + + /* Print closing */ + indent -= COL; + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + snprintf(tmp_str, TMP_LEN, "}"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + break; + } + case H5T_ARRAY: { + hid_t super; + size_t super_len; + char *stmp = NULL; + hsize_t dims[H5S_MAX_RANK]; + int ndims; + + /* Print lead-in */ + snprintf(dt_str, *slen, "H5T_ARRAY {\n"); + indent += COL; + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + + /* Get array information */ + if ((ndims = H5Tget_array_ndims(dtype)) < 0) + goto out; + if (H5Tget_array_dims2(dtype, dims) < 0) + goto out; + + /* Print array dimensions */ + for (i = 0; i < ndims; i++) { + snprintf(tmp_str, TMP_LEN, "[%d]", (int)dims[i]); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + } + snprintf(tmp_str, TMP_LEN, " "); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + if ((super = H5Tget_super(dtype)) < 0) + goto out; + if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0) + goto out; + stmp = (char *)calloc(super_len, sizeof(char)); + if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) { + free(stmp); + goto out; + } + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) { + free(stmp); + goto out; + } + if (stmp) + free(stmp); + stmp = NULL; + snprintf(tmp_str, TMP_LEN, "\n"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + H5Tclose(super); + + /* Print closing */ + indent -= COL; + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + snprintf(tmp_str, TMP_LEN, "}"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + break; + } + case H5T_COMPOUND: { + char *mname = NULL; + hid_t mtype; + size_t moffset; + H5T_class_t mclass; + size_t mlen; + char *mtmp = NULL; + int nmembs; + + if ((nmembs = H5Tget_nmembers(dtype)) < 0) + goto out; + + snprintf(dt_str, *slen, "H5T_COMPOUND {\n"); + indent += COL; + + for (i = 0; i < nmembs; i++) { + if ((mname = H5Tget_member_name(dtype, (unsigned)i)) == NULL) + goto out; + if ((mtype = H5Tget_member_type(dtype, (unsigned)i)) < 0) + goto out; + moffset = H5Tget_member_offset(dtype, (unsigned)i); + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + + if ((mclass = H5Tget_class(mtype)) < 0) + goto out; + if (H5T_COMPOUND == mclass) + indent += COL; + + if (H5LTdtype_to_text(mtype, NULL, lang, &mlen) < 0) + goto out; + mtmp = (char *)calloc(mlen, sizeof(char)); + if (H5LTdtype_to_text(mtype, mtmp, lang, &mlen) < 0) { + free(mtmp); + goto out; + } + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, mtmp))) { + free(mtmp); + goto out; + } + if (mtmp) + free(mtmp); + mtmp = NULL; + + if (H5T_COMPOUND == mclass) + indent -= COL; + + snprintf(tmp_str, TMP_LEN, " \"%s\"", mname); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + if (mname) + H5free_memory(mname); + mname = NULL; + + snprintf(tmp_str, TMP_LEN, " : %lu;\n", (unsigned long)moffset); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + } + + /* Print closing */ + indent -= COL; + if (!(dt_str = indentation(indent + COL, dt_str, no_user_buf, slen))) + goto out; + snprintf(tmp_str, TMP_LEN, "}"); + if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, tmp_str))) + goto out; + + break; + } + case H5T_TIME: + snprintf(dt_str, *slen, "H5T_TIME: not yet implemented"); + break; + case H5T_NO_CLASS: + snprintf(dt_str, *slen, "H5T_NO_CLASS"); + break; + case H5T_REFERENCE: + if (H5Tequal(dtype, H5T_STD_REF_DSETREG) == true) { + snprintf(dt_str, *slen, " H5T_REFERENCE { H5T_STD_REF_DSETREG }"); + } + else { + snprintf(dt_str, *slen, " H5T_REFERENCE { H5T_STD_REF_OBJECT }"); + } + break; + case H5T_NCLASSES: + break; + default: + snprintf(dt_str, *slen, "unknown data type"); + } + + return dt_str; + +out: + return NULL; +} + +/*------------------------------------------------------------------------- + * + * Get attribute functions + * + *------------------------------------------------------------------------- + */ + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_string + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTget_attribute_string(hid_t loc_id, const char *obj_name, const char *attr_name, char *data) +{ + /* identifiers */ + hid_t obj_id; + + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + + /* Open the object */ + if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) + return -1; + + /* Get the attribute */ + if (H5LT_get_attribute_disk(obj_id, attr_name, data) < 0) { + H5Oclose(obj_id); + return -1; + } + + /* Close the object */ + if (H5Oclose(obj_id) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_char + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_char(hid_t loc_id, const char *obj_name, const char *attr_name, char *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_CHAR, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_uchar + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_uchar(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned char *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_UCHAR, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_short + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_short(hid_t loc_id, const char *obj_name, const char *attr_name, short *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_SHORT, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_ushort + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_ushort(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned short *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_USHORT, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_int + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_int(hid_t loc_id, const char *obj_name, const char *attr_name, int *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_INT, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_uint + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_uint(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned int *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_UINT, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_long + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_long(hid_t loc_id, const char *obj_name, const char *attr_name, long *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_LONG, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_long_long + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: This function was added to support INTEGER*8 Fortran types + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_long_long(hid_t loc_id, const char *obj_name, const char *attr_name, long long *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_LLONG, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_ulong + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_ulong(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned long *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_ULONG, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_ullong + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LTget_attribute_ullong(hid_t loc_id, const char *obj_name, const char *attr_name, unsigned long long *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_ULLONG, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_float + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTget_attribute_float(hid_t loc_id, const char *obj_name, const char *attr_name, float *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_FLOAT, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute_double + * + * Purpose: Reads an attribute named attr_name + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTget_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_name, double *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, H5T_NATIVE_DOUBLE, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * Function: H5LTget_attribute + * + * Purpose: Reads an attribute named attr_name with the memory type mem_type_id + * + * Return: Success: 0, Failure: -1 + * + * Comments: Private function + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LTget_attribute(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t mem_type_id, void *data) +{ + /* Get the attribute */ + if (H5LT_get_attribute_mem(loc_id, obj_name, attr_name, mem_type_id, data) < 0) + return -1; + + return 0; +} + +/*------------------------------------------------------------------------- + * private functions + *------------------------------------------------------------------------- + */ + +/*------------------------------------------------------------------------- + * Function: H5LT_get_attribute_mem + * + * Purpose: Reads an attribute named attr_name with the memory type mem_type_id + * + * Return: Success: 0, Failure: -1 + * + * Comments: Private function + * + *------------------------------------------------------------------------- + */ + +static herr_t +H5LT_get_attribute_mem(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t mem_type_id, + void *data) +{ + /* identifiers */ + hid_t obj_id = -1; + hid_t attr_id = -1; + + /* check the arguments */ + if (obj_name == NULL) + return -1; + if (attr_name == NULL) + return -1; + + /* Open the object */ + if ((obj_id = H5Oopen(loc_id, obj_name, H5P_DEFAULT)) < 0) + goto out; + + if ((attr_id = H5Aopen(obj_id, attr_name, H5P_DEFAULT)) < 0) + goto out; + + if (H5Aread(attr_id, mem_type_id, data) < 0) + goto out; + + if (H5Aclose(attr_id) < 0) + goto out; + attr_id = -1; + + /* Close the object */ + if (H5Oclose(obj_id) < 0) + goto out; + obj_id = -1; + + return 0; + +out: + if (obj_id > 0) + H5Oclose(obj_id); + if (attr_id > 0) + H5Aclose(attr_id); + return -1; +} + +/*------------------------------------------------------------------------- + * Function: H5LT_get_attribute_disk + * + * Purpose: Reads an attribute named attr_name with the datatype stored on disk + * + * Return: Success: 0, Failure: -1 + * + * Comments: + * + *------------------------------------------------------------------------- + */ + +herr_t +H5LT_get_attribute_disk(hid_t loc_id, const char *attr_name, void *attr_out) +{ + /* identifiers */ + hid_t attr_id; + hid_t attr_type; + + if ((attr_id = H5Aopen(loc_id, attr_name, H5P_DEFAULT)) < 0) + return -1; + + if ((attr_type = H5Aget_type(attr_id)) < 0) + goto out; + + if (H5Aread(attr_id, attr_type, attr_out) < 0) + goto out; + + if (H5Tclose(attr_type) < 0) + goto out; + + if (H5Aclose(attr_id) < 0) + return -1; + + return 0; + +out: + H5Tclose(attr_type); + H5Aclose(attr_id); + return -1; +} + +/*------------------------------------------------------------------------- + * Function: H5LT_set_attribute_string + * + * Purpose: creates and writes an attribute named NAME to the dataset DSET_ID + * + * Return: FAIL on error, SUCCESS on success + * + * Comments: + * + *------------------------------------------------------------------------- + */ +herr_t +H5LT_set_attribute_string(hid_t dset_id, const char *name, const char *buf) +{ + hid_t tid; + hid_t sid = -1; + hid_t aid = -1; + htri_t has_attr; + size_t size; + + /* Delete the attribute if it already exists */ + if ((has_attr = H5Aexists(dset_id, name)) < 0) + return FAIL; + if (has_attr > 0) + if (H5Adelete(dset_id, name) < 0) + return FAIL; + + /*------------------------------------------------------------------------- + * create the attribute type + *------------------------------------------------------------------------- + */ + if ((tid = H5Tcopy(H5T_C_S1)) < 0) + return FAIL; + + size = strlen(buf) + 1; /* extra null term */ + + if (H5Tset_size(tid, (size_t)size) < 0) + goto out; + + if (H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0) + goto out; + + if ((sid = H5Screate(H5S_SCALAR)) < 0) + goto out; + + /*------------------------------------------------------------------------- + * create and write the attribute + *------------------------------------------------------------------------- + */ + if ((aid = H5Acreate2(dset_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto out; + + if (H5Awrite(aid, tid, buf) < 0) + goto out; + + if (H5Aclose(aid) < 0) + goto out; + + if (H5Sclose(sid) < 0) + goto out; + + if (H5Tclose(tid) < 0) + goto out; + + return SUCCEED; + + /* error zone */ +out: + H5E_BEGIN_TRY + { + H5Aclose(aid); + H5Tclose(tid); + H5Sclose(sid); + } + H5E_END_TRY + return FAIL; +} + +htri_t +H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid) +{ + char *tmp_path = NULL; /* Temporary copy of the path */ + char *curr_name; /* Pointer to current component of path name */ + char *delimit; /* Pointer to path delimiter during traversal */ + H5I_type_t obj_type; + htri_t link_exists, obj_exists; + size_t path_length; + htri_t ret_value; + + /* Initialize */ + ret_value = false; + + /* check the arguments */ + if (path == NULL) { + ret_value = FAIL; + goto done; + } + + /* Find the type of loc_id */ + if ((obj_type = H5Iget_type(loc_id)) == H5I_BADID) { + ret_value = FAIL; + goto done; + } + + /* Find the length of the path */ + path_length = strlen(path); + + /* Check if the identifier is the object itself, i.e. path is '.' */ + if (strncmp(path, ".", path_length) == 0) { + if (check_object_valid) { + obj_exists = H5Oexists_by_name(loc_id, path, H5P_DEFAULT); + ret_value = obj_exists; + goto done; + } + else { + ret_value = true; /* Since the object is the identifier itself, + * we can only check if loc_id is a valid type */ + goto done; + } + } + + /* Duplicate the path to use */ + if (NULL == (tmp_path = HDstrdup(path))) { + ret_value = FAIL; + goto done; + } + + curr_name = tmp_path; + + /* check if absolute pathname */ + if (strncmp(path, "/", 1) == 0) + curr_name++; + + /* check if relative path name starts with "./" */ + if (strncmp(path, "./", 2) == 0) + curr_name += 2; + + while ((delimit = strchr(curr_name, '/')) != NULL) { + /* Change the delimiter to terminate the string */ + *delimit = '\0'; + + obj_exists = false; + if ((link_exists = H5Lexists(loc_id, tmp_path, H5P_DEFAULT)) < 0) { + ret_value = FAIL; + goto done; + } + + /* If target link does not exist then no reason to + * continue checking the path */ + if (link_exists != true) { + ret_value = false; + goto done; + } + + /* Determine if link resolves to an actual object */ + if ((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) { + ret_value = FAIL; + goto done; + } + + if (obj_exists != true) + break; + + /* Change the delimiter back to '/' */ + *delimit = '/'; + + /* Advance the pointer in the path to the start of the next component */ + curr_name = delimit + 1; + + } /* end while */ + + /* Should be pointing to the last component in the path name now... */ + + /* Check if link does not exist */ + if ((link_exists = H5Lexists(loc_id, tmp_path, H5P_DEFAULT)) < 0) { + ret_value = FAIL; + } + else { + ret_value = link_exists; + /* Determine if link resolves to an actual object for check_object_valid true */ + if (check_object_valid == true && link_exists == true) { + if ((obj_exists = H5Oexists_by_name(loc_id, tmp_path, H5P_DEFAULT)) < 0) { + ret_value = FAIL; + } + else { + ret_value = obj_exists; + } + } + } + +done: + if (tmp_path != NULL) + free(tmp_path); + + return ret_value; +} diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5LTanalyze.c b/externals/coda-oss/modules/drivers/hdf5/source/H5LTanalyze.c new file mode 100644 index 0000000000..8890b8e48c --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5LTanalyze.c @@ -0,0 +1,2582 @@ +#if defined (__GNUC__) +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wnested-externs" +#pragma GCC diagnostic ignored "-Wold-style-definition" +#pragma GCC diagnostic ignored "-Wredundant-decls" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wstrict-overflow" +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#if !defined (__clang__) +#pragma GCC diagnostic ignored "-Wlarger-than=" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +#endif +#pragma GCC diagnostic ignored "-Wswitch-default" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 600 +#pragma GCC diagnostic ignored "-Wnull-dereference" +#endif +#elif defined __SUNPRO_CC +#pragma disable_warn +#elif defined _MSC_VER +#pragma warning(push, 1) +#endif +#line 2 "hl/src//H5LTanalyze.c" +/* Quiet warnings about integer type macro redefinitions on Visual Studio + * (MSVC doesn't define STDC_VERSION, but has inttypes.h). This is an + * issue that is apparently fixed in flex 2.6.5. + */ +#include + +#line 9 "hl/src//H5LTanalyze.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define yy_create_buffer H5LTyy_create_buffer +#define yy_delete_buffer H5LTyy_delete_buffer +#define yy_scan_buffer H5LTyy_scan_buffer +#define yy_scan_string H5LTyy_scan_string +#define yy_scan_bytes H5LTyy_scan_bytes +#define yy_init_buffer H5LTyy_init_buffer +#define yy_flush_buffer H5LTyy_flush_buffer +#define yy_load_buffer_state H5LTyy_load_buffer_state +#define yy_switch_to_buffer H5LTyy_switch_to_buffer +#define yypush_buffer_state H5LTyypush_buffer_state +#define yypop_buffer_state H5LTyypop_buffer_state +#define yyensure_buffer_stack H5LTyyensure_buffer_stack +#define yy_flex_debug H5LTyy_flex_debug +#define yyin H5LTyyin +#define yyleng H5LTyyleng +#define yylex H5LTyylex +#define yylineno H5LTyylineno +#define yyout H5LTyyout +#define yyrestart H5LTyyrestart +#define yytext H5LTyytext +#define yywrap H5LTyywrap +#define yyalloc H5LTyyalloc +#define yyrealloc H5LTyyrealloc +#define yyfree H5LTyyfree + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +#ifdef yy_create_buffer +#define H5LTyy_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer H5LTyy_create_buffer +#endif + +#ifdef yy_delete_buffer +#define H5LTyy_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer H5LTyy_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define H5LTyy_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer H5LTyy_scan_buffer +#endif + +#ifdef yy_scan_string +#define H5LTyy_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string H5LTyy_scan_string +#endif + +#ifdef yy_scan_bytes +#define H5LTyy_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes H5LTyy_scan_bytes +#endif + +#ifdef yy_init_buffer +#define H5LTyy_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer H5LTyy_init_buffer +#endif + +#ifdef yy_flush_buffer +#define H5LTyy_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer H5LTyy_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define H5LTyy_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state H5LTyy_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define H5LTyy_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer H5LTyy_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define H5LTyypush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state H5LTyypush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define H5LTyypop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state H5LTyypop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define H5LTyyensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack H5LTyyensure_buffer_stack +#endif + +#ifdef yylex +#define H5LTyylex_ALREADY_DEFINED +#else +#define yylex H5LTyylex +#endif + +#ifdef yyrestart +#define H5LTyyrestart_ALREADY_DEFINED +#else +#define yyrestart H5LTyyrestart +#endif + +#ifdef yylex_init +#define H5LTyylex_init_ALREADY_DEFINED +#else +#define yylex_init H5LTyylex_init +#endif + +#ifdef yylex_init_extra +#define H5LTyylex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra H5LTyylex_init_extra +#endif + +#ifdef yylex_destroy +#define H5LTyylex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy H5LTyylex_destroy +#endif + +#ifdef yyget_debug +#define H5LTyyget_debug_ALREADY_DEFINED +#else +#define yyget_debug H5LTyyget_debug +#endif + +#ifdef yyset_debug +#define H5LTyyset_debug_ALREADY_DEFINED +#else +#define yyset_debug H5LTyyset_debug +#endif + +#ifdef yyget_extra +#define H5LTyyget_extra_ALREADY_DEFINED +#else +#define yyget_extra H5LTyyget_extra +#endif + +#ifdef yyset_extra +#define H5LTyyset_extra_ALREADY_DEFINED +#else +#define yyset_extra H5LTyyset_extra +#endif + +#ifdef yyget_in +#define H5LTyyget_in_ALREADY_DEFINED +#else +#define yyget_in H5LTyyget_in +#endif + +#ifdef yyset_in +#define H5LTyyset_in_ALREADY_DEFINED +#else +#define yyset_in H5LTyyset_in +#endif + +#ifdef yyget_out +#define H5LTyyget_out_ALREADY_DEFINED +#else +#define yyget_out H5LTyyget_out +#endif + +#ifdef yyset_out +#define H5LTyyset_out_ALREADY_DEFINED +#else +#define yyset_out H5LTyyset_out +#endif + +#ifdef yyget_leng +#define H5LTyyget_leng_ALREADY_DEFINED +#else +#define yyget_leng H5LTyyget_leng +#endif + +#ifdef yyget_text +#define H5LTyyget_text_ALREADY_DEFINED +#else +#define yyget_text H5LTyyget_text +#endif + +#ifdef yyget_lineno +#define H5LTyyget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno H5LTyyget_lineno +#endif + +#ifdef yyset_lineno +#define H5LTyyset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno H5LTyyset_lineno +#endif + +#ifdef yywrap +#define H5LTyywrap_ALREADY_DEFINED +#else +#define yywrap H5LTyywrap +#endif + +#ifdef yyalloc +#define H5LTyyalloc_ALREADY_DEFINED +#else +#define yyalloc H5LTyyalloc +#endif + +#ifdef yyrealloc +#define H5LTyyrealloc_ALREADY_DEFINED +#else +#define yyrealloc H5LTyyrealloc +#endif + +#ifdef yyfree +#define H5LTyyfree_ALREADY_DEFINED +#else +#define yyfree H5LTyyfree +#endif + +#ifdef yytext +#define H5LTyytext_ALREADY_DEFINED +#else +#define yytext H5LTyytext +#endif + +#ifdef yyleng +#define H5LTyyleng_ALREADY_DEFINED +#else +#define yyleng H5LTyyleng +#endif + +#ifdef yyin +#define H5LTyyin_ALREADY_DEFINED +#else +#define yyin H5LTyyin +#endif + +#ifdef yyout +#define H5LTyyout_ALREADY_DEFINED +#else +#define yyout H5LTyyout +#endif + +#ifdef yy_flex_debug +#define H5LTyy_flex_debug_ALREADY_DEFINED +#else +#define yy_flex_debug H5LTyy_flex_debug +#endif + +#ifdef yylineno +#define H5LTyylineno_ALREADY_DEFINED +#else +#define yylineno H5LTyylineno +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = NULL; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); + +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); + +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ +typedef flex_uint8_t YY_CHAR; + +FILE *yyin = NULL, *yyout = NULL; + +typedef int yy_state_type; + +extern int yylineno; +int yylineno = 1; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; +#define YY_NUM_RULES 64 +#define YY_END_OF_BUFFER 65 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[275] = + { 0, + 63, 63, 65, 64, 63, 64, 55, 61, 62, 64, + 64, 64, 64, 59, 60, 57, 58, 63, 0, 55, + 0, 0, 0, 0, 0, 56, 0, 0, 0, 0, + 0, 38, 0, 0, 0, 0, 0, 39, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 37, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 54, 36, 0, 0, 0, 45, 49, 0, 0, + 0, 0, 0, 0, 0, 0, 51, 53, 50, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, + 0, 0, 0, 0, 0, 0, 35, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, + 2, 0, 0, 0, 0, 0, 0, 9, 10, 0, + 0, 47, 0, 44, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 3, 4, 5, 6, 7, 8, 11, 12, + 13, 14, 15, 16, 0, 0, 0, 43, 46, 28, + 29, 30, 31, 0, 0, 0, 22, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 0, 24, 0, 0, 0, 23, + 0, 0, 0, 41, 0, 0, 0, 32, 0, 26, + 18, 20, 19, 0, 25, 0, 40, 42, 33, 0, + 27, 21, 34, 0 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 4, 5, 6, + 7, 8, 9, 10, 4, 11, 4, 12, 13, 1, + 1, 1, 1, 1, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 1, 1, 23, 24, 25, 26, 27, + 28, 29, 30, 31, 32, 33, 1, 1, 34, 35, + 36, 1, 37, 1, 38, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 39, 1, 40, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +static const YY_CHAR yy_meta[41] = + { 0, + 1, 1, 2, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 + } ; + +static const flex_int16_t yy_base[277] = + { 0, + 0, 0, 299, 300, 296, 0, 0, 300, 300, 11, + 288, 269, 264, 300, 300, 300, 300, 292, 290, 0, + 274, 257, 259, 261, 259, 300, 256, 259, 247, 246, + 16, 300, 265, 33, 14, 268, 259, 300, 251, 24, + 254, 252, 259, 262, 248, 243, 34, 251, 258, 254, + 235, 240, 244, 249, 236, 233, 235, 245, 231, 247, + 36, 231, 241, 223, 237, 300, 238, 241, 227, 222, + 247, 227, 219, 231, 226, 219, 208, 34, 223, 219, + 225, 300, 300, 208, 215, 202, 300, 300, 210, 200, + 204, 204, 38, 210, 39, 220, 300, 300, 300, 201, + + 47, 218, 212, 212, 211, 66, 73, 208, 195, 199, + 210, 199, 193, 191, 196, 75, 182, 300, 209, 212, + 209, 52, 206, 209, 206, 66, 300, 190, 198, 188, + 193, 193, 189, 169, 200, 197, 74, 71, 72, 77, + 186, 185, 84, 86, 87, 184, 183, 177, 183, 180, + 300, 175, 185, 165, 88, 90, 173, 167, 169, 166, + 91, 99, 96, 172, 171, 170, 169, 168, 167, 300, + 300, 166, 165, 164, 163, 162, 161, 300, 300, 94, + 160, 300, 155, 300, 171, 157, 156, 155, 154, 157, + 138, 143, 137, 141, 140, 140, 143, 137, 141, 136, + + 101, 139, 300, 300, 300, 300, 300, 300, 300, 300, + 300, 300, 300, 300, 145, 140, 130, 300, 300, 300, + 300, 300, 300, 127, 140, 140, 300, 121, 127, 131, + 136, 120, 134, 116, 120, 120, 118, 126, 113, 127, + 300, 117, 108, 123, 117, 300, 107, 104, 105, 300, + 108, 112, 102, 300, 105, 106, 104, 300, 93, 300, + 300, 300, 300, 78, 300, 57, 300, 300, 300, 56, + 300, 300, 300, 300, 127, 65 + } ; + +static const flex_int16_t yy_def[277] = + { 0, + 274, 1, 274, 274, 274, 275, 276, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 275, 276, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 0, 274, 274 + } ; + +static const flex_int16_t yy_nxt[341] = + { 0, + 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, + 7, 8, 9, 4, 4, 10, 4, 4, 4, 4, + 11, 4, 4, 4, 4, 12, 4, 4, 4, 13, + 4, 4, 4, 4, 4, 14, 15, 4, 16, 17, + 21, 22, 36, 48, 49, 37, 39, 62, 40, 53, + 41, 42, 77, 54, 43, 94, 63, 44, 45, 106, + 113, 55, 46, 109, 78, 47, 141, 20, 110, 107, + 119, 95, 120, 273, 142, 121, 122, 123, 114, 124, + 146, 135, 125, 126, 136, 164, 166, 272, 147, 157, + 158, 168, 159, 165, 167, 160, 161, 271, 172, 169, + + 174, 176, 186, 162, 188, 163, 173, 194, 175, 177, + 187, 199, 189, 195, 197, 270, 196, 200, 201, 198, + 215, 269, 268, 235, 216, 202, 236, 19, 267, 19, + 266, 265, 264, 263, 262, 261, 260, 259, 258, 257, + 256, 255, 254, 253, 252, 251, 250, 249, 248, 247, + 246, 245, 244, 243, 242, 241, 240, 239, 238, 237, + 234, 233, 232, 231, 230, 229, 228, 227, 226, 225, + 224, 223, 222, 221, 220, 219, 218, 217, 214, 213, + 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, + 193, 192, 191, 190, 185, 184, 183, 182, 181, 180, + + 179, 178, 171, 170, 156, 155, 154, 153, 152, 151, + 150, 149, 148, 145, 144, 143, 140, 139, 138, 137, + 134, 133, 132, 131, 130, 129, 128, 127, 118, 117, + 116, 115, 112, 111, 108, 105, 104, 103, 102, 101, + 100, 99, 98, 97, 96, 93, 92, 91, 90, 89, + 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, + 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, + 66, 65, 64, 61, 60, 59, 58, 57, 56, 52, + 51, 50, 38, 35, 34, 33, 32, 31, 30, 29, + 28, 27, 26, 18, 25, 24, 23, 18, 274, 3, + + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274 + } ; + +static const flex_int16_t yy_chk[341] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 10, 10, 31, 35, 35, 31, 34, 47, 34, 40, + 34, 34, 61, 40, 34, 78, 47, 34, 34, 93, + 101, 40, 34, 95, 61, 34, 122, 276, 95, 93, + 106, 78, 106, 270, 122, 106, 106, 107, 101, 107, + 126, 116, 107, 107, 116, 138, 139, 266, 126, 137, + 137, 140, 137, 138, 139, 137, 137, 264, 143, 140, + + 144, 145, 155, 137, 156, 137, 143, 161, 144, 145, + 155, 163, 156, 161, 162, 259, 161, 163, 163, 162, + 180, 257, 256, 201, 180, 163, 201, 275, 255, 275, + 253, 252, 251, 249, 248, 247, 245, 244, 243, 242, + 240, 239, 238, 237, 236, 235, 234, 233, 232, 231, + 230, 229, 228, 226, 225, 224, 217, 216, 215, 202, + 200, 199, 198, 197, 196, 195, 194, 193, 192, 191, + 190, 189, 188, 187, 186, 185, 183, 181, 177, 176, + 175, 174, 173, 172, 169, 168, 167, 166, 165, 164, + 160, 159, 158, 157, 154, 153, 152, 150, 149, 148, + + 147, 146, 142, 141, 136, 135, 134, 133, 132, 131, + 130, 129, 128, 125, 124, 123, 121, 120, 119, 117, + 115, 114, 113, 112, 111, 110, 109, 108, 105, 104, + 103, 102, 100, 96, 94, 92, 91, 90, 89, 86, + 85, 84, 81, 80, 79, 77, 76, 75, 74, 73, + 72, 71, 70, 69, 68, 67, 65, 64, 63, 62, + 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, + 50, 49, 48, 46, 45, 44, 43, 42, 41, 39, + 37, 36, 33, 30, 29, 28, 27, 25, 24, 23, + 22, 21, 19, 18, 13, 12, 11, 5, 3, 274, + + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, + 274, 274, 274, 274, 274, 274, 274, 274, 274, 274 + } ; + +static yy_state_type yy_last_accepting_state; +static char *yy_last_accepting_cpos; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +#line 1 "hl/src//H5LTanalyze.l" +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* NOTE! + * + * If you make any changes to H5LTanalyze.l, please run bin/genparser to + * recreate the output files. + */ + +#line 28 "hl/src//H5LTanalyze.l" +#include +#include +#include +#include + +#include "H5private.h" +#include "H5LTparse.h" + +static char *trim_quotes(const char *); +static int my_yyinput(char *, int); +#undef YY_INPUT +#define YY_INPUT(b, r, ms) (r=my_yyinput(b, ms)) +#define token(x) (int)x +#define hid(x) (hid_t)x + +#ifdef YY_BUF_SIZE +#undef YY_BUF_SIZE +#endif +#define YY_BUF_SIZE 262144 /*Define read buffer to be 256K*/ + +extern char *myinput; +extern size_t input_len; + +#line 909 "hl/src//H5LTanalyze.c" +#line 910 "hl/src//H5LTanalyze.c" + +#define INITIAL 0 + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals ( void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( void ); + +int yyget_debug ( void ); + +void yyset_debug ( int debug_flag ); + +YY_EXTRA_TYPE yyget_extra ( void ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in ( void ); + +void yyset_in ( FILE * _in_str ); + +FILE *yyget_out ( void ); + +void yyset_out ( FILE * _out_str ); + + int yyget_leng ( void ); + +char *yyget_text ( void ); + +int yyget_lineno ( void ); + +void yyset_lineno ( int _line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( void ); +#else +extern int yywrap ( void ); +#endif +#endif + +#ifndef YY_NO_UNPUT + + static void yyunput ( int c, char *buf_ptr ); + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput ( void ); +#else +static int input ( void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + int n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + { +#line 53 "hl/src//H5LTanalyze.l" + + +#line 1122 "hl/src//H5LTanalyze.c" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 275 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 300 ); + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; + +case 1: +YY_RULE_SETUP +#line 55 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_I8BE_TOKEN);} + YY_BREAK +case 2: +YY_RULE_SETUP +#line 56 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_I8LE_TOKEN);} + YY_BREAK +case 3: +YY_RULE_SETUP +#line 57 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_I16BE_TOKEN);} + YY_BREAK +case 4: +YY_RULE_SETUP +#line 58 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_I16LE_TOKEN);} + YY_BREAK +case 5: +YY_RULE_SETUP +#line 59 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_I32BE_TOKEN);} + YY_BREAK +case 6: +YY_RULE_SETUP +#line 60 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_I32LE_TOKEN);} + YY_BREAK +case 7: +YY_RULE_SETUP +#line 61 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_I64BE_TOKEN);} + YY_BREAK +case 8: +YY_RULE_SETUP +#line 62 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_I64LE_TOKEN);} + YY_BREAK +case 9: +YY_RULE_SETUP +#line 64 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_U8BE_TOKEN);} + YY_BREAK +case 10: +YY_RULE_SETUP +#line 65 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_U8LE_TOKEN);} + YY_BREAK +case 11: +YY_RULE_SETUP +#line 66 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_U16BE_TOKEN);} + YY_BREAK +case 12: +YY_RULE_SETUP +#line 67 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_U16LE_TOKEN);} + YY_BREAK +case 13: +YY_RULE_SETUP +#line 68 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_U32BE_TOKEN);} + YY_BREAK +case 14: +YY_RULE_SETUP +#line 69 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_U32LE_TOKEN);} + YY_BREAK +case 15: +YY_RULE_SETUP +#line 70 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_U64BE_TOKEN);} + YY_BREAK +case 16: +YY_RULE_SETUP +#line 71 "hl/src//H5LTanalyze.l" +{return hid(H5T_STD_U64LE_TOKEN);} + YY_BREAK +case 17: +YY_RULE_SETUP +#line 73 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_CHAR_TOKEN);} + YY_BREAK +case 18: +YY_RULE_SETUP +#line 74 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_SCHAR_TOKEN);} + YY_BREAK +case 19: +YY_RULE_SETUP +#line 75 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_UCHAR_TOKEN);} + YY_BREAK +case 20: +YY_RULE_SETUP +#line 76 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_SHORT_TOKEN);} + YY_BREAK +case 21: +YY_RULE_SETUP +#line 77 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_USHORT_TOKEN);} + YY_BREAK +case 22: +YY_RULE_SETUP +#line 78 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_INT_TOKEN);} + YY_BREAK +case 23: +YY_RULE_SETUP +#line 79 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_UINT_TOKEN);} + YY_BREAK +case 24: +YY_RULE_SETUP +#line 80 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_LONG_TOKEN);} + YY_BREAK +case 25: +YY_RULE_SETUP +#line 81 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_ULONG_TOKEN);} + YY_BREAK +case 26: +YY_RULE_SETUP +#line 82 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_LLONG_TOKEN);} + YY_BREAK +case 27: +YY_RULE_SETUP +#line 83 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_ULLONG_TOKEN);} + YY_BREAK +case 28: +YY_RULE_SETUP +#line 85 "hl/src//H5LTanalyze.l" +{return hid(H5T_IEEE_F32BE_TOKEN);} + YY_BREAK +case 29: +YY_RULE_SETUP +#line 86 "hl/src//H5LTanalyze.l" +{return hid(H5T_IEEE_F32LE_TOKEN);} + YY_BREAK +case 30: +YY_RULE_SETUP +#line 87 "hl/src//H5LTanalyze.l" +{return hid(H5T_IEEE_F64BE_TOKEN);} + YY_BREAK +case 31: +YY_RULE_SETUP +#line 88 "hl/src//H5LTanalyze.l" +{return hid(H5T_IEEE_F64LE_TOKEN);} + YY_BREAK +case 32: +YY_RULE_SETUP +#line 89 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_FLOAT_TOKEN);} + YY_BREAK +case 33: +YY_RULE_SETUP +#line 90 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_DOUBLE_TOKEN);} + YY_BREAK +case 34: +YY_RULE_SETUP +#line 91 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_LDOUBLE_TOKEN);} + YY_BREAK +case 35: +YY_RULE_SETUP +#line 93 "hl/src//H5LTanalyze.l" +{return token(H5T_STRING_TOKEN);} + YY_BREAK +case 36: +YY_RULE_SETUP +#line 94 "hl/src//H5LTanalyze.l" +{return token(STRSIZE_TOKEN);} + YY_BREAK +case 37: +YY_RULE_SETUP +#line 95 "hl/src//H5LTanalyze.l" +{return token(STRPAD_TOKEN);} + YY_BREAK +case 38: +YY_RULE_SETUP +#line 96 "hl/src//H5LTanalyze.l" +{return token(CSET_TOKEN);} + YY_BREAK +case 39: +YY_RULE_SETUP +#line 97 "hl/src//H5LTanalyze.l" +{return token(CTYPE_TOKEN);} + YY_BREAK +case 40: +YY_RULE_SETUP +#line 98 "hl/src//H5LTanalyze.l" +{return token(H5T_STR_NULLTERM_TOKEN);} + YY_BREAK +case 41: +YY_RULE_SETUP +#line 99 "hl/src//H5LTanalyze.l" +{return token(H5T_STR_NULLPAD_TOKEN);} + YY_BREAK +case 42: +YY_RULE_SETUP +#line 100 "hl/src//H5LTanalyze.l" +{return token(H5T_STR_SPACEPAD_TOKEN);} + YY_BREAK +case 43: +YY_RULE_SETUP +#line 101 "hl/src//H5LTanalyze.l" +{return token(H5T_CSET_ASCII_TOKEN);} + YY_BREAK +case 44: +YY_RULE_SETUP +#line 102 "hl/src//H5LTanalyze.l" +{return token(H5T_CSET_UTF8_TOKEN);} + YY_BREAK +case 45: +YY_RULE_SETUP +#line 103 "hl/src//H5LTanalyze.l" +{return token(H5T_C_S1_TOKEN);} + YY_BREAK +case 46: +YY_RULE_SETUP +#line 104 "hl/src//H5LTanalyze.l" +{return token(H5T_FORTRAN_S1_TOKEN);} + YY_BREAK +case 47: +YY_RULE_SETUP +#line 105 "hl/src//H5LTanalyze.l" +{return token(H5T_VARIABLE_TOKEN);} + YY_BREAK +case 48: +YY_RULE_SETUP +#line 107 "hl/src//H5LTanalyze.l" +{return token(H5T_COMPOUND_TOKEN);} + YY_BREAK +case 49: +YY_RULE_SETUP +#line 108 "hl/src//H5LTanalyze.l" +{return token(H5T_ENUM_TOKEN);} + YY_BREAK +case 50: +YY_RULE_SETUP +#line 109 "hl/src//H5LTanalyze.l" +{return token(H5T_ARRAY_TOKEN);} + YY_BREAK +case 51: +YY_RULE_SETUP +#line 110 "hl/src//H5LTanalyze.l" +{return token(H5T_VLEN_TOKEN);} + YY_BREAK +case 52: +YY_RULE_SETUP +#line 112 "hl/src//H5LTanalyze.l" +{return token(H5T_OPAQUE_TOKEN);} + YY_BREAK +case 53: +YY_RULE_SETUP +#line 113 "hl/src//H5LTanalyze.l" +{return token(OPQ_SIZE_TOKEN);} + YY_BREAK +case 54: +YY_RULE_SETUP +#line 114 "hl/src//H5LTanalyze.l" +{return token(OPQ_TAG_TOKEN);} + YY_BREAK +case 55: +YY_RULE_SETUP +#line 116 "hl/src//H5LTanalyze.l" +{ + H5LTyylval.ival = atoi(yytext); + return NUMBER; + } + YY_BREAK +case 56: +/* rule 56 can match eol */ +YY_RULE_SETUP +#line 121 "hl/src//H5LTanalyze.l" +{ + H5LTyylval.sval = trim_quotes(yytext); + return STRING; + } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 126 "hl/src//H5LTanalyze.l" +{return token('{');} + YY_BREAK +case 58: +YY_RULE_SETUP +#line 127 "hl/src//H5LTanalyze.l" +{return token('}');} + YY_BREAK +case 59: +YY_RULE_SETUP +#line 128 "hl/src//H5LTanalyze.l" +{return token('[');} + YY_BREAK +case 60: +YY_RULE_SETUP +#line 129 "hl/src//H5LTanalyze.l" +{return token(']');} + YY_BREAK +case 61: +YY_RULE_SETUP +#line 130 "hl/src//H5LTanalyze.l" +{return token(':');} + YY_BREAK +case 62: +YY_RULE_SETUP +#line 131 "hl/src//H5LTanalyze.l" +{return token(';');} + YY_BREAK +case 63: +/* rule 63 can match eol */ +YY_RULE_SETUP +#line 132 "hl/src//H5LTanalyze.l" +; + YY_BREAK +case 64: +YY_RULE_SETUP +#line 134 "hl/src//H5LTanalyze.l" +ECHO; + YY_BREAK +#line 1507 "hl/src//H5LTanalyze.c" +case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + yy_state_type yy_current_state; + char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 275 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + int yy_is_jam; + char *yy_cp = (yy_c_buf_p); + + YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 275 ) + yy_c = yy_meta[yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_is_jam = (yy_current_state == 274); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf ); + + yyfree( (void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (const char * yystr ) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (const char* msg ) +{ + fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param _line_number line number + * + */ +void yyset_lineno (int _line_number ) +{ + + yylineno = _line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str ) +{ + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str ) +{ + yyout = _out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int _bdebug ) +{ + yy_flex_debug = _bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = NULL; + yyout = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n ) +{ + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s ) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return malloc(size); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 134 "hl/src//H5LTanalyze.l" + + +/* Allocate a copy of `quoted` with the double quote character at + * the beginning and the one at the end both removed. The caller is + * responsible for free()ing the copy. + */ +static char * +trim_quotes(const char *quoted) +{ + size_t len = strlen(quoted); + char *trimmed; + + assert(quoted[0] == '"' && quoted[len - 1] == '"'); + + trimmed = strdup(quoted + 1); + trimmed[len - 2] = '\0'; + + return trimmed; +} + +static int my_yyinput(char *buf, int max_size) +{ + int ret; + + memcpy(buf, myinput, input_len); + ret = (int)input_len; + return ret; +} + +int H5LTyyerror(const char *msg) +{ + printf("ERROR: %s before \"%s\".\n", msg, yytext); + return 0; +} + +int yywrap() +{ + return 1; +} + diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5LTparse.c b/externals/coda-oss/modules/drivers/hdf5/source/H5LTparse.c new file mode 100644 index 0000000000..592b863207 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5LTparse.c @@ -0,0 +1,2121 @@ +#if defined (__GNUC__) +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 402 +#pragma GCC diagnostic ignored "-Wconversion" +#pragma GCC diagnostic ignored "-Wimplicit-function-declaration" +#pragma GCC diagnostic ignored "-Wmissing-prototypes" +#pragma GCC diagnostic ignored "-Wnested-externs" +#pragma GCC diagnostic ignored "-Wold-style-definition" +#pragma GCC diagnostic ignored "-Wredundant-decls" +#pragma GCC diagnostic ignored "-Wsign-compare" +#pragma GCC diagnostic ignored "-Wsign-conversion" +#pragma GCC diagnostic ignored "-Wstrict-overflow" +#pragma GCC diagnostic ignored "-Wstrict-prototypes" +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#if !defined (__clang__) +#pragma GCC diagnostic ignored "-Wlarger-than=" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=const" +#pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" +#endif +#pragma GCC diagnostic ignored "-Wswitch-default" +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-macros" +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif +#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 600 +#pragma GCC diagnostic ignored "-Wnull-dereference" +#endif +#elif defined __SUNPRO_CC +#pragma disable_warn +#elif defined _MSC_VER +#pragma warning(push, 1) +#endif +/* A Bison parser, made by GNU Bison 3.8.2. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output, and Bison version. */ +#define YYBISON 30802 + +/* Bison version string. */ +#define YYBISON_VERSION "3.8.2" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + +/* Substitute the variable and function names. */ +#define yyparse H5LTyyparse +#define yylex H5LTyylex +#define yyerror H5LTyyerror +#define yydebug H5LTyydebug +#define yynerrs H5LTyynerrs +#define yylval H5LTyylval +#define yychar H5LTyychar + +/* First part of user prologue. */ +#line 19 "hl/src//H5LTparse.y" + +#include +#include +#include + +#include "H5private.h" + +extern int yylex(void); +extern int yyerror(const char *); + +#define STACK_SIZE 16 + +/*structure for compound type information*/ +struct cmpd_info { + hid_t id; /*type ID*/ + bool is_field; /*flag to lexer for compound member*/ + bool first_memb; /*flag for first compound member*/ +}; + +/*stack for nested compound type*/ +static struct cmpd_info cmpd_stack[STACK_SIZE] = { + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, + {0, 0, 1}, {0, 0, 1}, {0, 0, 1}, {0, 0, 1} }; + +static int csindex = -1; /*pointer to the top of compound stack*/ + +/*structure for array type information*/ +struct arr_info { + hsize_t dims[H5S_MAX_RANK]; /*size of each dimension, limited to 32 dimensions*/ + unsigned ndims; /*number of dimensions*/ + bool is_dim; /*flag to lexer for dimension*/ +}; +/*stack for nested array type*/ +static struct arr_info arr_stack[STACK_SIZE]; +static int asindex = -1; /*pointer to the top of array stack*/ + +static H5T_str_t str_pad; /*variable for string padding*/ +static H5T_cset_t str_cset; /*variable for string character set*/ +static bool is_variable = 0; /*variable for variable-length string*/ +static size_t str_size; /*variable for string size*/ + +static hid_t enum_id; /*type ID*/ +static bool is_enum = 0; /*flag to lexer for enum type*/ +static bool is_enum_memb = 0; /*flag to lexer for enum member*/ +static char* enum_memb_symbol; /*enum member symbol string*/ + + +#line 128 "hl/src//H5LTparse.c" + +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +#include "H5LTparse.h" +/* Symbol kind. */ +enum yysymbol_kind_t +{ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_H5T_STD_I8BE_TOKEN = 3, /* H5T_STD_I8BE_TOKEN */ + YYSYMBOL_H5T_STD_I8LE_TOKEN = 4, /* H5T_STD_I8LE_TOKEN */ + YYSYMBOL_H5T_STD_I16BE_TOKEN = 5, /* H5T_STD_I16BE_TOKEN */ + YYSYMBOL_H5T_STD_I16LE_TOKEN = 6, /* H5T_STD_I16LE_TOKEN */ + YYSYMBOL_H5T_STD_I32BE_TOKEN = 7, /* H5T_STD_I32BE_TOKEN */ + YYSYMBOL_H5T_STD_I32LE_TOKEN = 8, /* H5T_STD_I32LE_TOKEN */ + YYSYMBOL_H5T_STD_I64BE_TOKEN = 9, /* H5T_STD_I64BE_TOKEN */ + YYSYMBOL_H5T_STD_I64LE_TOKEN = 10, /* H5T_STD_I64LE_TOKEN */ + YYSYMBOL_H5T_STD_U8BE_TOKEN = 11, /* H5T_STD_U8BE_TOKEN */ + YYSYMBOL_H5T_STD_U8LE_TOKEN = 12, /* H5T_STD_U8LE_TOKEN */ + YYSYMBOL_H5T_STD_U16BE_TOKEN = 13, /* H5T_STD_U16BE_TOKEN */ + YYSYMBOL_H5T_STD_U16LE_TOKEN = 14, /* H5T_STD_U16LE_TOKEN */ + YYSYMBOL_H5T_STD_U32BE_TOKEN = 15, /* H5T_STD_U32BE_TOKEN */ + YYSYMBOL_H5T_STD_U32LE_TOKEN = 16, /* H5T_STD_U32LE_TOKEN */ + YYSYMBOL_H5T_STD_U64BE_TOKEN = 17, /* H5T_STD_U64BE_TOKEN */ + YYSYMBOL_H5T_STD_U64LE_TOKEN = 18, /* H5T_STD_U64LE_TOKEN */ + YYSYMBOL_H5T_NATIVE_CHAR_TOKEN = 19, /* H5T_NATIVE_CHAR_TOKEN */ + YYSYMBOL_H5T_NATIVE_SCHAR_TOKEN = 20, /* H5T_NATIVE_SCHAR_TOKEN */ + YYSYMBOL_H5T_NATIVE_UCHAR_TOKEN = 21, /* H5T_NATIVE_UCHAR_TOKEN */ + YYSYMBOL_H5T_NATIVE_SHORT_TOKEN = 22, /* H5T_NATIVE_SHORT_TOKEN */ + YYSYMBOL_H5T_NATIVE_USHORT_TOKEN = 23, /* H5T_NATIVE_USHORT_TOKEN */ + YYSYMBOL_H5T_NATIVE_INT_TOKEN = 24, /* H5T_NATIVE_INT_TOKEN */ + YYSYMBOL_H5T_NATIVE_UINT_TOKEN = 25, /* H5T_NATIVE_UINT_TOKEN */ + YYSYMBOL_H5T_NATIVE_LONG_TOKEN = 26, /* H5T_NATIVE_LONG_TOKEN */ + YYSYMBOL_H5T_NATIVE_ULONG_TOKEN = 27, /* H5T_NATIVE_ULONG_TOKEN */ + YYSYMBOL_H5T_NATIVE_LLONG_TOKEN = 28, /* H5T_NATIVE_LLONG_TOKEN */ + YYSYMBOL_H5T_NATIVE_ULLONG_TOKEN = 29, /* H5T_NATIVE_ULLONG_TOKEN */ + YYSYMBOL_H5T_IEEE_F32BE_TOKEN = 30, /* H5T_IEEE_F32BE_TOKEN */ + YYSYMBOL_H5T_IEEE_F32LE_TOKEN = 31, /* H5T_IEEE_F32LE_TOKEN */ + YYSYMBOL_H5T_IEEE_F64BE_TOKEN = 32, /* H5T_IEEE_F64BE_TOKEN */ + YYSYMBOL_H5T_IEEE_F64LE_TOKEN = 33, /* H5T_IEEE_F64LE_TOKEN */ + YYSYMBOL_H5T_NATIVE_FLOAT_TOKEN = 34, /* H5T_NATIVE_FLOAT_TOKEN */ + YYSYMBOL_H5T_NATIVE_DOUBLE_TOKEN = 35, /* H5T_NATIVE_DOUBLE_TOKEN */ + YYSYMBOL_H5T_NATIVE_LDOUBLE_TOKEN = 36, /* H5T_NATIVE_LDOUBLE_TOKEN */ + YYSYMBOL_H5T_STRING_TOKEN = 37, /* H5T_STRING_TOKEN */ + YYSYMBOL_STRSIZE_TOKEN = 38, /* STRSIZE_TOKEN */ + YYSYMBOL_STRPAD_TOKEN = 39, /* STRPAD_TOKEN */ + YYSYMBOL_CSET_TOKEN = 40, /* CSET_TOKEN */ + YYSYMBOL_CTYPE_TOKEN = 41, /* CTYPE_TOKEN */ + YYSYMBOL_H5T_VARIABLE_TOKEN = 42, /* H5T_VARIABLE_TOKEN */ + YYSYMBOL_H5T_STR_NULLTERM_TOKEN = 43, /* H5T_STR_NULLTERM_TOKEN */ + YYSYMBOL_H5T_STR_NULLPAD_TOKEN = 44, /* H5T_STR_NULLPAD_TOKEN */ + YYSYMBOL_H5T_STR_SPACEPAD_TOKEN = 45, /* H5T_STR_SPACEPAD_TOKEN */ + YYSYMBOL_H5T_CSET_ASCII_TOKEN = 46, /* H5T_CSET_ASCII_TOKEN */ + YYSYMBOL_H5T_CSET_UTF8_TOKEN = 47, /* H5T_CSET_UTF8_TOKEN */ + YYSYMBOL_H5T_C_S1_TOKEN = 48, /* H5T_C_S1_TOKEN */ + YYSYMBOL_H5T_FORTRAN_S1_TOKEN = 49, /* H5T_FORTRAN_S1_TOKEN */ + YYSYMBOL_H5T_OPAQUE_TOKEN = 50, /* H5T_OPAQUE_TOKEN */ + YYSYMBOL_OPQ_SIZE_TOKEN = 51, /* OPQ_SIZE_TOKEN */ + YYSYMBOL_OPQ_TAG_TOKEN = 52, /* OPQ_TAG_TOKEN */ + YYSYMBOL_H5T_COMPOUND_TOKEN = 53, /* H5T_COMPOUND_TOKEN */ + YYSYMBOL_H5T_ENUM_TOKEN = 54, /* H5T_ENUM_TOKEN */ + YYSYMBOL_H5T_ARRAY_TOKEN = 55, /* H5T_ARRAY_TOKEN */ + YYSYMBOL_H5T_VLEN_TOKEN = 56, /* H5T_VLEN_TOKEN */ + YYSYMBOL_STRING = 57, /* STRING */ + YYSYMBOL_NUMBER = 58, /* NUMBER */ + YYSYMBOL_59_ = 59, /* '{' */ + YYSYMBOL_60_ = 60, /* '}' */ + YYSYMBOL_61_ = 61, /* '[' */ + YYSYMBOL_62_ = 62, /* ']' */ + YYSYMBOL_63_ = 63, /* ':' */ + YYSYMBOL_64_ = 64, /* ';' */ + YYSYMBOL_YYACCEPT = 65, /* $accept */ + YYSYMBOL_start = 66, /* start */ + YYSYMBOL_ddl_type = 67, /* ddl_type */ + YYSYMBOL_atomic_type = 68, /* atomic_type */ + YYSYMBOL_integer_type = 69, /* integer_type */ + YYSYMBOL_fp_type = 70, /* fp_type */ + YYSYMBOL_compound_type = 71, /* compound_type */ + YYSYMBOL_72_1 = 72, /* $@1 */ + YYSYMBOL_memb_list = 73, /* memb_list */ + YYSYMBOL_memb_def = 74, /* memb_def */ + YYSYMBOL_75_2 = 75, /* $@2 */ + YYSYMBOL_field_name = 76, /* field_name */ + YYSYMBOL_field_offset = 77, /* field_offset */ + YYSYMBOL_offset = 78, /* offset */ + YYSYMBOL_array_type = 79, /* array_type */ + YYSYMBOL_80_3 = 80, /* $@3 */ + YYSYMBOL_dim_list = 81, /* dim_list */ + YYSYMBOL_dim = 82, /* dim */ + YYSYMBOL_83_4 = 83, /* $@4 */ + YYSYMBOL_84_5 = 84, /* $@5 */ + YYSYMBOL_dimsize = 85, /* dimsize */ + YYSYMBOL_vlen_type = 86, /* vlen_type */ + YYSYMBOL_opaque_type = 87, /* opaque_type */ + YYSYMBOL_88_6 = 88, /* @6 */ + YYSYMBOL_89_7 = 89, /* $@7 */ + YYSYMBOL_opaque_size = 90, /* opaque_size */ + YYSYMBOL_opaque_tag = 91, /* opaque_tag */ + YYSYMBOL_string_type = 92, /* string_type */ + YYSYMBOL_93_8 = 93, /* $@8 */ + YYSYMBOL_94_9 = 94, /* $@9 */ + YYSYMBOL_95_10 = 95, /* $@10 */ + YYSYMBOL_96_11 = 96, /* @11 */ + YYSYMBOL_strsize = 97, /* strsize */ + YYSYMBOL_strpad = 98, /* strpad */ + YYSYMBOL_cset = 99, /* cset */ + YYSYMBOL_ctype = 100, /* ctype */ + YYSYMBOL_enum_type = 101, /* enum_type */ + YYSYMBOL_102_12 = 102, /* $@12 */ + YYSYMBOL_enum_list = 103, /* enum_list */ + YYSYMBOL_enum_def = 104, /* enum_def */ + YYSYMBOL_105_13 = 105, /* $@13 */ + YYSYMBOL_enum_symbol = 106, /* enum_symbol */ + YYSYMBOL_enum_val = 107 /* enum_val */ +}; +typedef enum yysymbol_kind_t yysymbol_kind_t; + + + + +#ifdef short +# undef short +#endif + +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif +#endif + +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; +#else +typedef short yytype_int16; +#endif + +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 +#endif + +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; +#else +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned +# endif +#endif + +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + + +/* Stored state numbers (used for stacks). */ +typedef yytype_uint8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + + +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YY_USE(E) ((void) (E)) +#else +# define YY_USE(E) /* empty */ +#endif + +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# endif +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) + +#if !defined yyoverflow + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* !defined yyoverflow */ + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yy_state_t yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYPTRDIFF_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYPTRDIFF_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 58 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 197 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 65 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 43 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 92 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 134 + +/* YYMAXUTOK -- Last valid token kind. */ +#define YYMAXUTOK 313 + + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex. */ +static const yytype_int8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 63, 64, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 61, 2, 62, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 59, 2, 60, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58 +}; + +#if YYDEBUG +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_int16 yyrline[] = +{ + 0, 101, 101, 102, 104, 105, 106, 107, 109, 110, + 111, 112, 113, 116, 117, 118, 119, 120, 121, 122, + 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, + 145, 146, 147, 148, 149, 150, 151, 155, 154, 163, + 164, 166, 166, 203, 211, 212, 215, 217, 217, 226, + 227, 229, 230, 229, 237, 240, 247, 252, 244, 259, + 261, 266, 273, 282, 289, 263, 313, 314, 316, 317, + 318, 320, 321, 323, 324, 328, 327, 332, 333, 335, + 335, 385, 387 +}; +#endif + +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if YYDEBUG || 0 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "\"end of file\"", "error", "\"invalid token\"", "H5T_STD_I8BE_TOKEN", + "H5T_STD_I8LE_TOKEN", "H5T_STD_I16BE_TOKEN", "H5T_STD_I16LE_TOKEN", + "H5T_STD_I32BE_TOKEN", "H5T_STD_I32LE_TOKEN", "H5T_STD_I64BE_TOKEN", + "H5T_STD_I64LE_TOKEN", "H5T_STD_U8BE_TOKEN", "H5T_STD_U8LE_TOKEN", + "H5T_STD_U16BE_TOKEN", "H5T_STD_U16LE_TOKEN", "H5T_STD_U32BE_TOKEN", + "H5T_STD_U32LE_TOKEN", "H5T_STD_U64BE_TOKEN", "H5T_STD_U64LE_TOKEN", + "H5T_NATIVE_CHAR_TOKEN", "H5T_NATIVE_SCHAR_TOKEN", + "H5T_NATIVE_UCHAR_TOKEN", "H5T_NATIVE_SHORT_TOKEN", + "H5T_NATIVE_USHORT_TOKEN", "H5T_NATIVE_INT_TOKEN", + "H5T_NATIVE_UINT_TOKEN", "H5T_NATIVE_LONG_TOKEN", + "H5T_NATIVE_ULONG_TOKEN", "H5T_NATIVE_LLONG_TOKEN", + "H5T_NATIVE_ULLONG_TOKEN", "H5T_IEEE_F32BE_TOKEN", + "H5T_IEEE_F32LE_TOKEN", "H5T_IEEE_F64BE_TOKEN", "H5T_IEEE_F64LE_TOKEN", + "H5T_NATIVE_FLOAT_TOKEN", "H5T_NATIVE_DOUBLE_TOKEN", + "H5T_NATIVE_LDOUBLE_TOKEN", "H5T_STRING_TOKEN", "STRSIZE_TOKEN", + "STRPAD_TOKEN", "CSET_TOKEN", "CTYPE_TOKEN", "H5T_VARIABLE_TOKEN", + "H5T_STR_NULLTERM_TOKEN", "H5T_STR_NULLPAD_TOKEN", + "H5T_STR_SPACEPAD_TOKEN", "H5T_CSET_ASCII_TOKEN", "H5T_CSET_UTF8_TOKEN", + "H5T_C_S1_TOKEN", "H5T_FORTRAN_S1_TOKEN", "H5T_OPAQUE_TOKEN", + "OPQ_SIZE_TOKEN", "OPQ_TAG_TOKEN", "H5T_COMPOUND_TOKEN", + "H5T_ENUM_TOKEN", "H5T_ARRAY_TOKEN", "H5T_VLEN_TOKEN", "STRING", + "NUMBER", "'{'", "'}'", "'['", "']'", "':'", "';'", "$accept", "start", + "ddl_type", "atomic_type", "integer_type", "fp_type", "compound_type", + "$@1", "memb_list", "memb_def", "$@2", "field_name", "field_offset", + "offset", "array_type", "$@3", "dim_list", "dim", "$@4", "$@5", + "dimsize", "vlen_type", "opaque_type", "@6", "$@7", "opaque_size", + "opaque_tag", "string_type", "$@8", "$@9", "$@10", "@11", "strsize", + "strpad", "cset", "ctype", "enum_type", "$@12", "enum_list", "enum_def", + "$@13", "enum_symbol", "enum_val", YY_NULLPTR +}; + +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + return yytname[yysymbol]; +} +#endif + +#define YYPACT_NINF (-25) + +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) + +#define YYTABLE_NINF (-1) + +#define yytable_value_is_error(Yyn) \ + 0 + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 114, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -24, -22, -25, -13, -25, + -11, 49, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, 18, 45, 38, 168, 39, 114, -25, -4, + 41, -25, 36, -25, 42, -25, -25, 37, -25, 40, + 56, -25, -3, -25, -25, -25, -25, -25, -25, -25, + -25, 43, -25, 66, 55, 51, -21, 57, -25, 0, + 95, -25, 50, -25, -25, -25, -25, -25, -25, -25, + -25, -25, 89, -25, 90, 97, 92, 99, 52, -25, + -25, -25, -25, -25, -25, 94, -25, 119, 100, -25, + -6, -25, -25, -25, 98, -25, 120, 46, -25, -25, + 101, -25, 103, -25 +}; + +/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_int8 yydefact[] = +{ + 2, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 0, 0, 47, 0, 57, + 0, 0, 3, 4, 8, 9, 5, 6, 7, 12, + 10, 11, 0, 0, 0, 0, 0, 0, 1, 0, + 0, 49, 0, 59, 0, 76, 77, 0, 69, 0, + 0, 85, 0, 65, 71, 66, 48, 51, 50, 87, + 61, 0, 60, 0, 0, 0, 0, 0, 58, 0, + 0, 53, 54, 91, 86, 88, 89, 64, 62, 78, + 79, 80, 0, 70, 0, 0, 0, 0, 0, 72, + 67, 56, 55, 52, 92, 0, 63, 0, 0, 90, + 0, 68, 81, 82, 0, 73, 0, 0, 83, 84, + 0, 74, 0, 75 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int8 yypgoto[] = +{ + -25, -25, -15, -25, 111, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_uint8 yydefgoto[] = +{ + 0, 41, 42, 43, 44, 45, 46, 54, 70, 78, + 85, 92, 106, 112, 47, 56, 72, 82, 87, 108, + 98, 48, 49, 84, 118, 69, 104, 50, 83, 117, + 126, 132, 67, 102, 124, 130, 51, 79, 86, 95, + 107, 96, 115 +}; + +/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint8 yytable[] = +{ + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 52, 93, 53, 65, 94, + 122, 123, 64, 99, 100, 101, 55, 36, 57, 58, + 37, 38, 39, 40, 66, 77, 59, 81, 80, 1, + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 128, 129, 60, 61, 63, 68, + 71, 74, 73, 88, 75, 89, 36, 90, 91, 37, + 38, 39, 40, 105, 116, 97, 76, 1, 2, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 103, 109, 110, 111, 113, 114, 119, 120, + 121, 127, 125, 133, 36, 131, 62, 37, 38, 39, + 40, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27 +}; + +static const yytype_int8 yycheck[] = +{ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 59, 57, 59, 42, 60, + 46, 47, 57, 43, 44, 45, 59, 50, 59, 0, + 53, 54, 55, 56, 58, 70, 38, 72, 61, 3, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 48, 49, 51, 59, 59, 58, + 64, 64, 60, 60, 64, 39, 50, 52, 57, 53, + 54, 55, 56, 63, 62, 58, 60, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 57, 64, 64, 58, 64, 58, 64, 40, + 60, 41, 64, 60, 50, 64, 55, 53, 54, 55, + 56, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29 +}; + +/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + state STATE-NUM. */ +static const yytype_int8 yystos[] = +{ + 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 50, 53, 54, 55, + 56, 66, 67, 68, 69, 70, 71, 79, 86, 87, + 92, 101, 59, 59, 72, 59, 80, 59, 0, 38, + 51, 59, 69, 59, 67, 42, 58, 97, 58, 90, + 73, 64, 81, 60, 64, 64, 60, 67, 74, 102, + 61, 67, 82, 93, 88, 75, 103, 83, 60, 39, + 52, 57, 76, 57, 60, 104, 106, 58, 85, 43, + 44, 45, 98, 57, 91, 63, 77, 105, 84, 64, + 64, 58, 78, 64, 58, 107, 62, 94, 89, 64, + 40, 60, 46, 47, 99, 64, 95, 41, 48, 49, + 100, 64, 96, 60 +}; + +/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr1[] = +{ + 0, 65, 66, 66, 67, 67, 67, 67, 68, 68, + 68, 68, 68, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, + 70, 70, 70, 70, 70, 70, 70, 72, 71, 73, + 73, 75, 74, 76, 77, 77, 78, 80, 79, 81, + 81, 83, 84, 82, 85, 86, 88, 89, 87, 90, + 91, 93, 94, 95, 96, 92, 97, 97, 98, 98, + 98, 99, 99, 100, 100, 102, 101, 103, 103, 105, + 104, 106, 107 +}; + +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr2[] = +{ + 0, 2, 0, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 0, 5, 0, + 2, 0, 5, 1, 0, 2, 1, 0, 6, 0, + 2, 0, 0, 5, 1, 4, 0, 0, 11, 1, + 1, 0, 0, 0, 0, 19, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 0, 7, 0, 2, 0, + 4, 1, 1 +}; + + +enum { YYENOMEM = -2 }; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) + +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + + + + +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Kind, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) +{ + FILE *yyoutput = yyo; + YY_USE (yyoutput); + if (!yyvaluep) + return; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YY_USE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ + +static void +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); + + yy_symbol_value_print (yyo, yykind, yyvaluep); + YYFPRINTF (yyo, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, + int yyrule) +{ + int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)]); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + + + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep) +{ + YY_USE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YY_USE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + +/* Lookahead token kind. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + + + +/*----------. +| yyparse. | +`----------*/ + +hid_t +yyparse (void) +{ + yy_state_fast_t yystate = 0; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus = 0; + + /* Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; + + /* The state stack: array, bottom, top. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; + + /* The semantic value stack: array, bottom, top. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; + + int yyn; + /* The return value of yyparse. */ + int yyresult; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yychar = YYEMPTY; /* Cause a token to be read. */ + + goto yysetstate; + + +/*------------------------------------------------------------. +| yynewstate -- push a new state, which is found in yystate. | +`------------------------------------------------------------*/ +yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); + + if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + YYNOMEM; +#else + { + /* Get the current used size of the three stacks, in elements. */ + YYPTRDIFF_T yysize = yyssp - yyss + 1; + +# if defined yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + yy_state_t *yyss1 = yyss; + YYSTYPE *yyvs1 = yyvs; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yystacksize); + yyss = yyss1; + yyvs = yyvs1; + } +# else /* defined YYSTACK_RELOCATE */ + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + YYNOMEM; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yy_state_t *yyss1 = yyss; + union yyalloc *yyptr = + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); + if (! yyptr) + YYNOMEM; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token\n")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else if (yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + goto yyerrlab1; + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + /* Discard the shifted token. */ + yychar = YYEMPTY; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: /* start: %empty */ +#line 101 "hl/src//H5LTparse.y" + { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } +#line 1353 "hl/src//H5LTparse.c" + break; + + case 3: /* start: ddl_type */ +#line 102 "hl/src//H5LTparse.y" + { return (yyval.hid);} +#line 1359 "hl/src//H5LTparse.c" + break; + + case 13: /* integer_type: H5T_STD_I8BE_TOKEN */ +#line 116 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } +#line 1365 "hl/src//H5LTparse.c" + break; + + case 14: /* integer_type: H5T_STD_I8LE_TOKEN */ +#line 117 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } +#line 1371 "hl/src//H5LTparse.c" + break; + + case 15: /* integer_type: H5T_STD_I16BE_TOKEN */ +#line 118 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } +#line 1377 "hl/src//H5LTparse.c" + break; + + case 16: /* integer_type: H5T_STD_I16LE_TOKEN */ +#line 119 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } +#line 1383 "hl/src//H5LTparse.c" + break; + + case 17: /* integer_type: H5T_STD_I32BE_TOKEN */ +#line 120 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } +#line 1389 "hl/src//H5LTparse.c" + break; + + case 18: /* integer_type: H5T_STD_I32LE_TOKEN */ +#line 121 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } +#line 1395 "hl/src//H5LTparse.c" + break; + + case 19: /* integer_type: H5T_STD_I64BE_TOKEN */ +#line 122 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } +#line 1401 "hl/src//H5LTparse.c" + break; + + case 20: /* integer_type: H5T_STD_I64LE_TOKEN */ +#line 123 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } +#line 1407 "hl/src//H5LTparse.c" + break; + + case 21: /* integer_type: H5T_STD_U8BE_TOKEN */ +#line 124 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } +#line 1413 "hl/src//H5LTparse.c" + break; + + case 22: /* integer_type: H5T_STD_U8LE_TOKEN */ +#line 125 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } +#line 1419 "hl/src//H5LTparse.c" + break; + + case 23: /* integer_type: H5T_STD_U16BE_TOKEN */ +#line 126 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } +#line 1425 "hl/src//H5LTparse.c" + break; + + case 24: /* integer_type: H5T_STD_U16LE_TOKEN */ +#line 127 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } +#line 1431 "hl/src//H5LTparse.c" + break; + + case 25: /* integer_type: H5T_STD_U32BE_TOKEN */ +#line 128 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } +#line 1437 "hl/src//H5LTparse.c" + break; + + case 26: /* integer_type: H5T_STD_U32LE_TOKEN */ +#line 129 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } +#line 1443 "hl/src//H5LTparse.c" + break; + + case 27: /* integer_type: H5T_STD_U64BE_TOKEN */ +#line 130 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } +#line 1449 "hl/src//H5LTparse.c" + break; + + case 28: /* integer_type: H5T_STD_U64LE_TOKEN */ +#line 131 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } +#line 1455 "hl/src//H5LTparse.c" + break; + + case 29: /* integer_type: H5T_NATIVE_CHAR_TOKEN */ +#line 132 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } +#line 1461 "hl/src//H5LTparse.c" + break; + + case 30: /* integer_type: H5T_NATIVE_SCHAR_TOKEN */ +#line 133 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } +#line 1467 "hl/src//H5LTparse.c" + break; + + case 31: /* integer_type: H5T_NATIVE_UCHAR_TOKEN */ +#line 134 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } +#line 1473 "hl/src//H5LTparse.c" + break; + + case 32: /* integer_type: H5T_NATIVE_SHORT_TOKEN */ +#line 135 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } +#line 1479 "hl/src//H5LTparse.c" + break; + + case 33: /* integer_type: H5T_NATIVE_USHORT_TOKEN */ +#line 136 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } +#line 1485 "hl/src//H5LTparse.c" + break; + + case 34: /* integer_type: H5T_NATIVE_INT_TOKEN */ +#line 137 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } +#line 1491 "hl/src//H5LTparse.c" + break; + + case 35: /* integer_type: H5T_NATIVE_UINT_TOKEN */ +#line 138 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } +#line 1497 "hl/src//H5LTparse.c" + break; + + case 36: /* integer_type: H5T_NATIVE_LONG_TOKEN */ +#line 139 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } +#line 1503 "hl/src//H5LTparse.c" + break; + + case 37: /* integer_type: H5T_NATIVE_ULONG_TOKEN */ +#line 140 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } +#line 1509 "hl/src//H5LTparse.c" + break; + + case 38: /* integer_type: H5T_NATIVE_LLONG_TOKEN */ +#line 141 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } +#line 1515 "hl/src//H5LTparse.c" + break; + + case 39: /* integer_type: H5T_NATIVE_ULLONG_TOKEN */ +#line 142 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } +#line 1521 "hl/src//H5LTparse.c" + break; + + case 40: /* fp_type: H5T_IEEE_F32BE_TOKEN */ +#line 145 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } +#line 1527 "hl/src//H5LTparse.c" + break; + + case 41: /* fp_type: H5T_IEEE_F32LE_TOKEN */ +#line 146 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } +#line 1533 "hl/src//H5LTparse.c" + break; + + case 42: /* fp_type: H5T_IEEE_F64BE_TOKEN */ +#line 147 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } +#line 1539 "hl/src//H5LTparse.c" + break; + + case 43: /* fp_type: H5T_IEEE_F64LE_TOKEN */ +#line 148 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } +#line 1545 "hl/src//H5LTparse.c" + break; + + case 44: /* fp_type: H5T_NATIVE_FLOAT_TOKEN */ +#line 149 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } +#line 1551 "hl/src//H5LTparse.c" + break; + + case 45: /* fp_type: H5T_NATIVE_DOUBLE_TOKEN */ +#line 150 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } +#line 1557 "hl/src//H5LTparse.c" + break; + + case 46: /* fp_type: H5T_NATIVE_LDOUBLE_TOKEN */ +#line 151 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } +#line 1563 "hl/src//H5LTparse.c" + break; + + case 47: /* $@1: %empty */ +#line 155 "hl/src//H5LTparse.y" + { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } +#line 1569 "hl/src//H5LTparse.c" + break; + + case 48: /* compound_type: H5T_COMPOUND_TOKEN $@1 '{' memb_list '}' */ +#line 157 "hl/src//H5LTparse.y" + { (yyval.hid) = cmpd_stack[csindex].id; + cmpd_stack[csindex].id = 0; + cmpd_stack[csindex].first_memb = 1; + csindex--; + } +#line 1579 "hl/src//H5LTparse.c" + break; + + case 51: /* $@2: %empty */ +#line 166 "hl/src//H5LTparse.y" + { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } +#line 1585 "hl/src//H5LTparse.c" + break; + + case 52: /* memb_def: ddl_type $@2 field_name field_offset ';' */ +#line 168 "hl/src//H5LTparse.y" + { + size_t origin_size, new_size; + hid_t dtype_id = cmpd_stack[csindex].id; + + /*Adjust size and insert member, consider both member size and offset.*/ + if(cmpd_stack[csindex].first_memb) { /*reclaim the size 1 temporarily set*/ + new_size = H5Tget_size((yyvsp[-4].hid)) + (yyvsp[-1].ival); + H5Tset_size(dtype_id, new_size); + /*member name is saved in yylval.sval by lexer*/ + H5Tinsert(dtype_id, (yyvsp[-2].sval), (yyvsp[-1].ival), (yyvsp[-4].hid)); + + cmpd_stack[csindex].first_memb = 0; + } else { + origin_size = H5Tget_size(dtype_id); + + if((yyvsp[-1].ival) == 0) { + new_size = origin_size + H5Tget_size((yyvsp[-4].hid)); + H5Tset_size(dtype_id, new_size); + H5Tinsert(dtype_id, (yyvsp[-2].sval), origin_size, (yyvsp[-4].hid)); + } else { + new_size = (yyvsp[-1].ival) + H5Tget_size((yyvsp[-4].hid)); + H5Tset_size(dtype_id, new_size); + H5Tinsert(dtype_id, (yyvsp[-2].sval), (yyvsp[-1].ival), (yyvsp[-4].hid)); + } + } + if((yyvsp[-2].sval)) { + free((yyvsp[-2].sval)); + (yyvsp[-2].sval) = NULL; + } + cmpd_stack[csindex].is_field = 0; + H5Tclose((yyvsp[-4].hid)); + + new_size = H5Tget_size(dtype_id); + } +#line 1624 "hl/src//H5LTparse.c" + break; + + case 53: /* field_name: STRING */ +#line 204 "hl/src//H5LTparse.y" + { + (yyval.sval) = strdup(yylval.sval); + free(yylval.sval); + yylval.sval = NULL; + } +#line 1634 "hl/src//H5LTparse.c" + break; + + case 54: /* field_offset: %empty */ +#line 211 "hl/src//H5LTparse.y" + { (yyval.ival) = 0; } +#line 1640 "hl/src//H5LTparse.c" + break; + + case 55: /* field_offset: ':' offset */ +#line 213 "hl/src//H5LTparse.y" + { (yyval.ival) = yylval.ival; } +#line 1646 "hl/src//H5LTparse.c" + break; + + case 57: /* $@3: %empty */ +#line 217 "hl/src//H5LTparse.y" + { asindex++; /*pushd onto the stack*/ } +#line 1652 "hl/src//H5LTparse.c" + break; + + case 58: /* array_type: H5T_ARRAY_TOKEN $@3 '{' dim_list ddl_type '}' */ +#line 219 "hl/src//H5LTparse.y" + { + (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); + arr_stack[asindex].ndims = 0; + asindex--; + H5Tclose((yyvsp[-1].hid)); + } +#line 1663 "hl/src//H5LTparse.c" + break; + + case 61: /* $@4: %empty */ +#line 229 "hl/src//H5LTparse.y" + { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } +#line 1669 "hl/src//H5LTparse.c" + break; + + case 62: /* $@5: %empty */ +#line 230 "hl/src//H5LTparse.y" + { unsigned ndims = arr_stack[asindex].ndims; + arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; + arr_stack[asindex].ndims++; + arr_stack[asindex].is_dim = 0; + } +#line 1679 "hl/src//H5LTparse.c" + break; + + case 65: /* vlen_type: H5T_VLEN_TOKEN '{' ddl_type '}' */ +#line 241 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } +#line 1685 "hl/src//H5LTparse.c" + break; + + case 66: /* @6: %empty */ +#line 247 "hl/src//H5LTparse.y" + { + size_t size = (size_t)yylval.ival; + (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); + } +#line 1694 "hl/src//H5LTparse.c" + break; + + case 67: /* $@7: %empty */ +#line 252 "hl/src//H5LTparse.y" + { + H5Tset_tag((yyvsp[-3].hid), yylval.sval); + free(yylval.sval); + yylval.sval = NULL; + } +#line 1704 "hl/src//H5LTparse.c" + break; + + case 68: /* opaque_type: H5T_OPAQUE_TOKEN '{' OPQ_SIZE_TOKEN opaque_size ';' @6 OPQ_TAG_TOKEN opaque_tag ';' $@7 '}' */ +#line 257 "hl/src//H5LTparse.y" + { (yyval.hid) = (yyvsp[-5].hid); } +#line 1710 "hl/src//H5LTparse.c" + break; + + case 71: /* $@8: %empty */ +#line 266 "hl/src//H5LTparse.y" + { + if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN) + is_variable = 1; + else + str_size = yylval.ival; + } +#line 1721 "hl/src//H5LTparse.c" + break; + + case 72: /* $@9: %empty */ +#line 273 "hl/src//H5LTparse.y" + { + if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN) + str_pad = H5T_STR_NULLTERM; + else if((yyvsp[-1].ival) == H5T_STR_NULLPAD_TOKEN) + str_pad = H5T_STR_NULLPAD; + else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN) + str_pad = H5T_STR_SPACEPAD; + } +#line 1734 "hl/src//H5LTparse.c" + break; + + case 73: /* $@10: %empty */ +#line 282 "hl/src//H5LTparse.y" + { + if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN) + str_cset = H5T_CSET_ASCII; + else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN) + str_cset = H5T_CSET_UTF8; + } +#line 1745 "hl/src//H5LTparse.c" + break; + + case 74: /* @11: %empty */ +#line 289 "hl/src//H5LTparse.y" + { + if((yyvsp[-1].hid) == H5T_C_S1_TOKEN) + (yyval.hid) = H5Tcopy(H5T_C_S1); + else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN) + (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); + } +#line 1756 "hl/src//H5LTparse.c" + break; + + case 75: /* string_type: H5T_STRING_TOKEN '{' STRSIZE_TOKEN strsize ';' $@8 STRPAD_TOKEN strpad ';' $@9 CSET_TOKEN cset ';' $@10 CTYPE_TOKEN ctype ';' @11 '}' */ +#line 296 "hl/src//H5LTparse.y" + { + hid_t str_id = (yyvsp[-1].hid); + + /*set string size*/ + if(is_variable) { + H5Tset_size(str_id, H5T_VARIABLE); + is_variable = 0; + } else + H5Tset_size(str_id, str_size); + + /*set string padding and character set*/ + H5Tset_strpad(str_id, str_pad); + H5Tset_cset(str_id, str_cset); + + (yyval.hid) = str_id; + } +#line 1777 "hl/src//H5LTparse.c" + break; + + case 76: /* strsize: H5T_VARIABLE_TOKEN */ +#line 313 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_VARIABLE_TOKEN;} +#line 1783 "hl/src//H5LTparse.c" + break; + + case 78: /* strpad: H5T_STR_NULLTERM_TOKEN */ +#line 316 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} +#line 1789 "hl/src//H5LTparse.c" + break; + + case 79: /* strpad: H5T_STR_NULLPAD_TOKEN */ +#line 317 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} +#line 1795 "hl/src//H5LTparse.c" + break; + + case 80: /* strpad: H5T_STR_SPACEPAD_TOKEN */ +#line 318 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} +#line 1801 "hl/src//H5LTparse.c" + break; + + case 81: /* cset: H5T_CSET_ASCII_TOKEN */ +#line 320 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} +#line 1807 "hl/src//H5LTparse.c" + break; + + case 82: /* cset: H5T_CSET_UTF8_TOKEN */ +#line 321 "hl/src//H5LTparse.y" + {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} +#line 1813 "hl/src//H5LTparse.c" + break; + + case 83: /* ctype: H5T_C_S1_TOKEN */ +#line 323 "hl/src//H5LTparse.y" + {(yyval.hid) = H5T_C_S1_TOKEN;} +#line 1819 "hl/src//H5LTparse.c" + break; + + case 84: /* ctype: H5T_FORTRAN_S1_TOKEN */ +#line 324 "hl/src//H5LTparse.y" + {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} +#line 1825 "hl/src//H5LTparse.c" + break; + + case 85: /* $@12: %empty */ +#line 328 "hl/src//H5LTparse.y" + { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } +#line 1831 "hl/src//H5LTparse.c" + break; + + case 86: /* enum_type: H5T_ENUM_TOKEN '{' integer_type ';' $@12 enum_list '}' */ +#line 330 "hl/src//H5LTparse.y" + { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } +#line 1837 "hl/src//H5LTparse.c" + break; + + case 89: /* $@13: %empty */ +#line 335 "hl/src//H5LTparse.y" + { + is_enum_memb = 1; /*indicate member of enum*/ + enum_memb_symbol = strdup(yylval.sval); + free(yylval.sval); + yylval.sval = NULL; + } +#line 1848 "hl/src//H5LTparse.c" + break; + + case 90: /* enum_def: enum_symbol $@13 enum_val ';' */ +#line 342 "hl/src//H5LTparse.y" + { + char char_val=(char)yylval.ival; + short short_val=(short)yylval.ival; + int int_val=(int)yylval.ival; + long long_val=(long)yylval.ival; + long long llong_val=(long long)yylval.ival; + hid_t super = H5Tget_super(enum_id); + hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND); + H5T_order_t super_order = H5Tget_order(super); + H5T_order_t native_order = H5Tget_order(native); + + if(is_enum && is_enum_memb) { /*if it's an enum member*/ + /*To handle machines of different endianness*/ + if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &char_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &char_val); + } else if(H5Tequal(native, H5T_NATIVE_SHORT) || H5Tequal(native, H5T_NATIVE_USHORT)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &short_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &short_val); + } else if(H5Tequal(native, H5T_NATIVE_INT) || H5Tequal(native, H5T_NATIVE_UINT)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &int_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &int_val); + } else if(H5Tequal(native, H5T_NATIVE_LONG) || H5Tequal(native, H5T_NATIVE_ULONG)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &long_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &long_val); + } else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) { + if(super_order != native_order) + H5Tconvert(native, super, 1, &llong_val, NULL, H5P_DEFAULT); + H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val); + } + + is_enum_memb = 0; + if(enum_memb_symbol) free(enum_memb_symbol); + } + + H5Tclose(super); + H5Tclose(native); + } +#line 1895 "hl/src//H5LTparse.c" + break; + + +#line 1899 "hl/src//H5LTparse.c" + + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; + yyerror (YY_("syntax error")); + } + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; + ++yynerrs; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + /* Pop stack until we find a state that shifts the error token. */ + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + YY_ACCESSING_SYMBOL (yystate), yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturnlab; + + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturnlab; + + +/*-----------------------------------------------------------. +| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + goto yyreturnlab; + + +/*----------------------------------------------------------. +| yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +yyreturnlab: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + + return yyresult; +} + diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5LaccProp.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5LaccProp.cpp deleted file mode 100644 index acdaa13d57..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5LaccProp.cpp +++ /dev/null @@ -1,160 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5LaccProp.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control -// the order of creation and deletion of the global constants. See Design Notes -// in "H5PredType.cpp" for information. - -// Initialize a pointer for the constant -LinkAccPropList *LinkAccPropList::DEFAULT_ = 0; - -//-------------------------------------------------------------------------- -// Function: LinkAccPropList::getConstant -// Creates a LinkAccPropList object representing the HDF5 constant -// H5P_LINK_ACCESS, pointed to by LinkAccPropList::DEFAULT_ -// exception H5::PropListIException -// Description -// If LinkAccPropList::DEFAULT_ already points to an allocated -// object, throw a PropListIException. This scenario should not -// happen. -// Programmer Binh-Minh Ribler - December, 2016 -//-------------------------------------------------------------------------- -LinkAccPropList * -LinkAccPropList::getConstant() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the constant pointer is not allocated, allocate it. Otherwise, - // throw because it shouldn't be. - if (DEFAULT_ == 0) - DEFAULT_ = new LinkAccPropList(H5P_LINK_ACCESS); - else - throw PropListIException("LinkAccPropList::getConstant", - "LinkAccPropList::getConstant is being invoked on an allocated DEFAULT_"); - return (DEFAULT_); -} - -//-------------------------------------------------------------------------- -// Function: LinkAccPropList::deleteConstants -// Purpose: Deletes the constant object that LinkAccPropList::DEFAULT_ -// points to. -// exception H5::PropListIException -// Programmer Binh-Minh Ribler - December, 2016 -//-------------------------------------------------------------------------- -void -LinkAccPropList::deleteConstants() -{ - delete DEFAULT_; -} - -//-------------------------------------------------------------------------- -// Purpose: Constant for default property -//-------------------------------------------------------------------------- -const LinkAccPropList &LinkAccPropList::DEFAULT = *getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: Default Constructor -///\brief Creates a file access property list -// Programmer Binh-Minh Ribler - December, 2016 -//-------------------------------------------------------------------------- -LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) -{ -} - -//-------------------------------------------------------------------------- -// Function: LinkAccPropList copy constructor -///\brief Copy Constructor: same HDF5 object as \a original -///\param original - IN: LinkAccPropList instance to copy -// Programmer Binh-Minh Ribler - December, 2016 -//-------------------------------------------------------------------------- -LinkAccPropList::LinkAccPropList(const LinkAccPropList &original) : PropList(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: LinkAccPropList overloaded constructor -///\brief Creates a file access property list using the id of an -/// existing one. -// Programmer Binh-Minh Ribler - December, 2016 -//-------------------------------------------------------------------------- -LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: LinkAccPropList::setNumLinks -///\brief Set the number of soft or user-defined link traversals allowed -/// before the library assumes it has found a cycle and aborts the -/// traversal. -/// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - March 1, 2017 -//-------------------------------------------------------------------------- -void -LinkAccPropList::setNumLinks(size_t nlinks) const -{ - herr_t ret_value = H5Pset_nlinks(id, nlinks); - // Throw exception if H5Pset_nlinks returns failure - if (ret_value < 0) { - throw PropListIException("setNumLinks", "H5Pset_nlinks failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: LinkAccPropList::getNumLinks -///\brief Gets the number of soft or user-defined links that can be -/// traversed before a failure occurs. -/// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - March 1, 2017 -//-------------------------------------------------------------------------- -size_t -LinkAccPropList::getNumLinks() const -{ - size_t nlinks = 0; - herr_t ret_value = H5Pget_nlinks(id, &nlinks); - // Throw exception if H5Pget_nlinks returns failure - if (ret_value < 0) { - throw PropListIException("getNumLinks", "H5Pget_nlinks failed"); - } - return (nlinks); -} - -//-------------------------------------------------------------------------- -// Function: LinkAccPropList destructor -///\brief Noop destructor -// Programmer Binh-Minh Ribler - December, 2016 -//-------------------------------------------------------------------------- -LinkAccPropList::~LinkAccPropList() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5LcreatProp.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5LcreatProp.cpp deleted file mode 100644 index 3851d56dc1..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5LcreatProp.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5LcreatProp.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control -// the order of creation and deletion of the global constants. See Design Notes -// in "H5PredType.cpp" for information. - -// Initialize a pointer for the constant -LinkCreatPropList *LinkCreatPropList::DEFAULT_ = 0; - -//-------------------------------------------------------------------------- -// Function: LinkCreatPropList::getConstant -// Creates a LinkCreatPropList object representing the HDF5 constant -// H5P_LINK_CREATE, pointed to by LinkCreatPropList::DEFAULT_ -// exception H5::PropListIException -// Description -// If LinkCreatPropList::DEFAULT_ already points to an allocated -// object, throw a PropListIException. This scenario should not -// happen. -// December, 2016 -//-------------------------------------------------------------------------- -LinkCreatPropList * -LinkCreatPropList::getConstant() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the constant pointer is not allocated, allocate it. Otherwise, - // throw because it shouldn't be. - if (DEFAULT_ == 0) - DEFAULT_ = new LinkCreatPropList(H5P_LINK_CREATE); - else - throw PropListIException("LinkCreatPropList::getConstant", - "LinkCreatPropList::getConstant is being invoked on an allocated DEFAULT_"); - return (DEFAULT_); -} - -//-------------------------------------------------------------------------- -// Function: LinkCreatPropList::deleteConstants -// Purpose: Deletes the constant object that LinkCreatPropList::DEFAULT_ -// points to. -// exception H5::PropListIException -// December, 2016 -//-------------------------------------------------------------------------- -void -LinkCreatPropList::deleteConstants() -{ - delete DEFAULT_; -} - -//-------------------------------------------------------------------------- -// Purpose: Constant for default property -//-------------------------------------------------------------------------- -const LinkCreatPropList &LinkCreatPropList::DEFAULT = *getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: Default Constructor -///\brief Creates a file access property list -// December, 2016 -//-------------------------------------------------------------------------- -LinkCreatPropList::LinkCreatPropList() : PropList(H5P_LINK_CREATE) -{ -} - -//-------------------------------------------------------------------------- -// Function: LinkCreatPropList copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param original - IN: LinkCreatPropList instance to copy -// December, 2016 -//-------------------------------------------------------------------------- -LinkCreatPropList::LinkCreatPropList(const LinkCreatPropList &original) : PropList(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: LinkCreatPropList overloaded constructor -///\brief Creates a file access property list using the id of an -/// existing one. -// December, 2016 -//-------------------------------------------------------------------------- -LinkCreatPropList::LinkCreatPropList(const hid_t plist_id) : PropList(plist_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: LinkCreatPropList::setCreateIntermediateGroup -///\brief Specifies in property list whether to create missing -/// intermediate groups. -///\param crt_intmd_group - IN: Flag specifying whether to create -/// intermediate groups upon the creation of an object -///\exception H5::PropListIException -// April, 2019 -//-------------------------------------------------------------------------- -void -LinkCreatPropList::setCreateIntermediateGroup(bool crt_intmd_group) const -{ - herr_t ret_value = H5Pset_create_intermediate_group(id, static_cast(crt_intmd_group)); - // Throw exception if H5Pset_create_intermediate_group returns failure - if (ret_value < 0) { - throw PropListIException("setCreateIntermediateGroup", "H5Pset_create_intermediate_group failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: LinkCreatPropList::getCreateIntermediateGroup -///\brief Determines whether property is set to enable creating missing -/// intermediate groups. -///\return true if creating intermediate groups is enabled, and false, otherwise -///\exception H5::PropListIException -// April, 2019 -//-------------------------------------------------------------------------- -bool -LinkCreatPropList::getCreateIntermediateGroup() const -{ - unsigned crt_intmd_group; - herr_t ret_value = H5Pget_create_intermediate_group(id, &crt_intmd_group); - // Throw exception if H5Pget_create_intermediate_group returns failure - if (ret_value < 0) { - throw PropListIException("getCreateIntermediateGroup", "H5Pget_create_intermediate_group failed"); - } - - return static_cast(crt_intmd_group); -} - -//-------------------------------------------------------------------------- -// Function: LinkCreatPropList::setCharEncoding -///\brief Sets the character encoding of the string. -/// -///\exception H5::PropListIException -// March, 2018 -//-------------------------------------------------------------------------- -void -LinkCreatPropList::setCharEncoding(H5T_cset_t encoding) const -{ - herr_t ret_value = H5Pset_char_encoding(id, encoding); - // Throw exception if H5Pset_char_encoding returns failure - if (ret_value < 0) { - throw PropListIException("setCharEncoding", "H5Pset_char_encoding failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: LinkCreatPropList::getCharEncoding -///\brief Gets the character encoding of the string. -///\return The character encoding -///\exception H5::PropListIException -// March, 2018 -//-------------------------------------------------------------------------- -H5T_cset_t -LinkCreatPropList::getCharEncoding() const -{ - H5T_cset_t encoding; - herr_t ret_value = H5Pget_char_encoding(id, &encoding); - // Throw exception if H5Pget_char_encoding returns failure - if (ret_value < 0) { - throw PropListIException("getCharEncoding", "H5Pget_char_encoding failed"); - } - return (encoding); -} - -//-------------------------------------------------------------------------- -// Function: LinkCreatPropList destructor -///\brief Noop destructor -// December, 2016 -//-------------------------------------------------------------------------- -LinkCreatPropList::~LinkCreatPropList() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ldeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ldeprec.c index 4c107b1da8..1399eecff9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ldeprec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ldeprec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -104,7 +103,7 @@ H5L__iterate2_shim(hid_t group_id, const char *name, const H5L_info2_t *linfo2, if (H5L_TYPE_HARD == linfo2->type) { if (H5VLnative_token_to_addr(group_id, linfo2->u.token, &linfo.u.address) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, H5_ITER_ERROR, - "can't deserialize object token into address") + "can't deserialize object token into address"); } else linfo.u.val_size = linfo2->u.val_size; @@ -155,24 +154,24 @@ H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t /* Check arguments */ id_type = H5I_get_type(group_id); if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified"); /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, - "H5Literate1 is only meant to be used with the native VOL connector") + "H5Literate1 is only meant to be used with the native VOL connector"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -194,7 +193,7 @@ H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t /* Iterate over the links */ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -218,10 +217,6 @@ H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t * library, or the negative value returned by one * of the operators. * - * - * Programmer: Quincey Koziol - * Thursday, November 16, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -240,30 +235,30 @@ H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Check arguments */ if (!group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL"); if (!*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, - "H5Literate_by_name1 is only meant to be used with the native VOL connector") + "H5Literate_by_name1 is only meant to be used with the native VOL connector"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -287,7 +282,7 @@ H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Iterate over the links */ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -303,9 +298,6 @@ H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H * Return: Success: Non-negative with information in LINFO * Failure: Negative * - * Programmer: James Laird - * Wednesday, June 21, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -323,11 +315,11 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -337,14 +329,14 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, - "H5Lget_info1 is only meant to be used with the native VOL connector") + "H5Lget_info1 is only meant to be used with the native VOL connector"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_GET_INFO; @@ -352,7 +344,7 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l /* Get the link information */ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info"); /* Copy the new-style members into the old-style struct */ if (linfo) { @@ -364,12 +356,12 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l void *vol_obj_data; if (NULL == (vol_obj_data = H5VL_object_data(vol_obj))) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get underlying VOL object") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get underlying VOL object"); if (H5VL_native_token_to_addr(vol_obj_data, loc_params.obj_type, linfo2.u.token, &linfo->u.address) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); } /* end if */ else linfo->u.val_size = linfo2.u.val_size; @@ -390,9 +382,6 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l * Return: Success: Non-negative with information in LINFO * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -411,15 +400,15 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Check arguments */ if (!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up location struct */ loc_params.type = H5VL_OBJECT_BY_IDX; @@ -432,14 +421,14 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, - "H5Lget_info_by_idx1 is only meant to be used with the native VOL connector") + "H5Lget_info_by_idx1 is only meant to be used with the native VOL connector"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_LINK_GET_INFO; @@ -447,7 +436,7 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Get the link information */ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info"); /* Copy the new-style members into the old-style struct */ if (linfo) { @@ -459,12 +448,12 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H void *vol_obj_data; if (NULL == (vol_obj_data = H5VL_object_data(vol_obj))) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get underlying VOL object") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get underlying VOL object"); if (H5VL_native_token_to_addr(vol_obj_data, loc_params.obj_type, linfo2.u.token, &linfo->u.address) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); } /* end if */ else linfo->u.val_size = linfo2.u.val_size; @@ -499,9 +488,6 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 24 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -521,13 +507,13 @@ H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat /* Check args */ id_type = H5I_get_type(group_id); if (!(H5I_GROUP == id_type || H5I_FILE == id_type)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -535,14 +521,14 @@ H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, - "H5Lvisit1 is only meant to be used with the native VOL connector") + "H5Lvisit1 is only meant to be used with the native VOL connector"); /* Set up shim */ shim_data.real_op = op; @@ -560,7 +546,7 @@ H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat /* Iterate over the links */ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed"); done: FUNC_LEAVE_API(ret_value) @@ -591,9 +577,6 @@ H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 3 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -612,30 +595,30 @@ H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ /* Check args */ if (!group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be NULL"); if (!*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_name parameter cannot be an empty string"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info"); /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, - "H5Lvisit_by_name1 is only meant to be used with the native VOL connector") + "H5Lvisit_by_name1 is only meant to be used with the native VOL connector"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -659,7 +642,7 @@ H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ /* Visit the links */ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Lexternal.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Lexternal.c index 82c45129f6..d7edbad0e1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Lexternal.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Lexternal.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -92,9 +91,6 @@ static const H5L_class_t H5L_EXTERN_LINK_CLASS[1] = {{ * * Return: ID of the opened object on success/H5I_INVALID_HID on failure * - * Programmer: James Laird - * Monday, July 10, 2006 - * *------------------------------------------------------------------------- */ static hid_t @@ -125,13 +121,13 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(p); + assert(p); /* Check external link version & flags */ if (((*p >> 4) & 0x0F) > H5L_EXT_VERSION) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad version number for external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad version number for external link"); if ((*p & 0x0F) & ~H5L_EXT_FLAGS_ALL) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad flags for external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, H5I_INVALID_HID, "bad flags for external link"); p++; /* Gather some information from the external link's user data */ @@ -141,19 +137,19 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, H5I_INVALID_HID, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5I_INVALID_HID, "can't find object for ID"); /* Get the fapl_id set for lapl_id if any */ if (H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get fapl for links") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get fapl for links"); /* Get the location for the group holding the external link */ if (H5G_loc(cur_group, &loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get object location") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get object location"); /* get the access flags set for lapl_id if any */ if (H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, &intent) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink file access flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink file access flags"); /* get the file access mode flags for the parent file, if they were not set * on lapl_id */ @@ -161,15 +157,15 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons intent = H5F_INTENT(loc.oloc->file); if ((fapl_id == H5P_DEFAULT) && ((fapl_id = H5F_get_access_plist(loc.oloc->file, FALSE)) < 0)) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get parent's file access property list") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "can't get parent's file access property list"); /* Get callback_info */ if (H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink callback info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get elink callback info"); /* Get file access property list */ if (NULL == (fa_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, H5I_INVALID_HID, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5I_INVALID_HID, "can't find object for ID"); /* Make callback if it exists */ if (cb_info.func) { @@ -181,7 +177,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons /* Query length of parent group name */ if (H5G_get_name(&loc, NULL, (size_t)0, &group_name_len, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve length of group name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve length of group name"); /* Account for null terminator */ group_name_len++; @@ -190,50 +186,50 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons if (group_name_len > sizeof(local_group_name)) { if (NULL == (parent_group_name = (char *)H5MM_malloc(group_name_len))) HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, H5I_INVALID_HID, - "can't allocate buffer to hold group name, group_name_len = %zu", group_name_len) + "can't allocate buffer to hold group name, group_name_len = %zu", group_name_len); } /* end if */ else parent_group_name = local_group_name; /* Get parent group name */ if (H5G_get_name(&loc, parent_group_name, group_name_len, NULL, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve group name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve group name"); /* Make callback */ if ((cb_info.func)(parent_file_name, parent_group_name, file_name, obj_name, &intent, fapl_id, cb_info.user_data) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, H5I_INVALID_HID, "traversal operator failed") + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, H5I_INVALID_HID, "traversal operator failed"); /* Check access flags */ if ((intent & H5F_ACC_TRUNC) || (intent & H5F_ACC_EXCL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid file open flags"); } /* end if */ /* Set file close degree for new file to "weak" */ if (H5P_set(fa_plist, H5F_ACS_CLOSE_DEGREE_NAME, &fc_degree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5I_INVALID_HID, "can't set file close degree"); /* Get the current elink prefix */ if (H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &elink_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get external link prefix") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5I_INVALID_HID, "can't get external link prefix"); /* Search for the target file */ if (NULL == (ext_file = H5F_prefix_open_file(loc.oloc->file, H5F_PREFIX_ELINK, elink_prefix, file_name, intent, fapl_id))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, H5I_INVALID_HID, - "unable to open external file, external link file name = '%s'", file_name) + "unable to open external file, external link file name = '%s'", file_name); /* Retrieve the "group location" for the file's root group */ if (H5G_root_loc(ext_file, &root_loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, H5I_INVALID_HID, "unable to create location for file") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, H5I_INVALID_HID, "unable to create location for file"); /* Open the object referenced in the external file */ if (NULL == (ext_obj = H5O_open_name(&root_loc, obj_name, &opened_type))) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object"); /* Get an ID for the external link's object */ if ((ext_obj_id = H5VL_wrap_register(opened_type, ext_obj, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register external link object"); /* Set return value */ ret_value = ext_obj_id; @@ -243,15 +239,15 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons /* Release resources */ if (fapl_id > 0 && H5I_dec_ref(fapl_id) < 0) HDONE_ERROR(H5E_ID, H5E_CANTRELEASE, H5I_INVALID_HID, - "unable to close ID for file access property list") + "unable to close ID for file access property list"); if (ext_file && H5F_efc_close(loc.oloc->file, ext_file) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problem closing external file") + HDONE_ERROR(H5E_LINK, H5E_CANTCLOSEFILE, H5I_INVALID_HID, "problem closing external file"); if (parent_group_name && parent_group_name != local_group_name) parent_group_name = (char *)H5MM_xfree(parent_group_name); if (ret_value < 0) { /* Close object if it's open and something failed */ if (ext_obj_id >= 0 && H5I_dec_ref(ext_obj_id) < 0) - HDONE_ERROR(H5E_ID, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close ID for external object") + HDONE_ERROR(H5E_ID, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to close ID for external object"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -269,9 +265,6 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons * * Return: Size of buffer on success/Negative on failure * - * Programmer: James Laird - * Monday, July 10, 2006 - * *------------------------------------------------------------------------- */ static ssize_t @@ -285,9 +278,9 @@ H5L__extern_query(const char H5_ATTR_UNUSED *link_name, const void *_udata, size /* Check external link version & flags */ if (((*udata >> 4) & 0x0F) != H5L_EXT_VERSION) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad version number for external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad version number for external link"); if ((*udata & 0x0F) & ~H5L_EXT_FLAGS_ALL) - HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad flags for external link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDECODE, FAIL, "bad flags for external link"); /* If the buffer is NULL, skip writing anything in it and just return * the size needed */ @@ -315,9 +308,6 @@ H5L__extern_query(const char H5_ATTR_UNUSED *link_name, const void *_udata, size * * Return: Non-negative on success/ negative on failure * - * Programmer: James Laird - * Monday, July 17, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -328,7 +318,7 @@ H5L_register_external(void) FUNC_ENTER_NOAPI(FAIL) if (H5L_register(H5L_EXTERN_LINK_CLASS) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class") + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Library.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5Library.cpp deleted file mode 100644 index 19c7ee78a7..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Library.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include - -#include "H5CppDoc.h" // included only for Doxygen to generate part of RM -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5FaccProp.h" -#include "H5FcreatProp.h" -#include "H5OcreatProp.h" -#include "H5DxferProp.h" -#include "H5DcreatProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5AtomType.h" -#include "H5PredType.h" -#include "H5DataSpace.h" -#include "H5Library.h" - -namespace H5 { - -//-------------------------------------------------------------------------- -// Function: H5Library::open (static) -///\brief Initializes the HDF5 library. -/// -///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Library::open() -{ - herr_t ret_value = H5open(); - if (ret_value < 0) { - throw LibraryIException("H5Library::open", "H5open failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Library::close (static) -///\brief Flushes all data to disk, closes files, and cleans up memory. -/// -///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Library::close() -{ - herr_t ret_value = H5close(); - if (ret_value < 0) { - throw LibraryIException("H5Library::close", "H5close failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Library::dontAtExit (static) -///\brief Instructs library not to install the C \c atexit cleanup routine -/// -///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 -// Modification -// Removed the check for failure returned from H5dont_atexit. -// will be fixed to not fail (HDFFV-9540) -//-------------------------------------------------------------------------- -void -H5Library::dontAtExit() -{ - (void)H5dont_atexit(); -} - -//-------------------------------------------------------------------------- -// Function: H5Library::getLibVersion (static) -///\brief Returns the HDF library release number. -///\param majnum - OUT: Major version of the library -///\param minnum - OUT: Minor version of the library -///\param relnum - OUT: Release number of the library -///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Library::getLibVersion(unsigned &majnum, unsigned &minnum, unsigned &relnum) -{ - herr_t ret_value = H5get_libversion(&majnum, &minnum, &relnum); - if (ret_value < 0) { - throw LibraryIException("H5Library::getLibVersion", "H5get_libversion failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Library::checkVersion (static) -///\brief Verifies that the arguments match the version numbers -/// compiled into the library -///\param majnum - IN: Major version of the library -///\param minnum - IN: Minor version of the library -///\param relnum - IN: Release number of the library -///\exception H5::LibraryIException -///\par Description -/// For information about library version, please refer to -/// the H5check_version API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum) -{ - herr_t ret_value = H5check_version(majnum, minnum, relnum); - if (ret_value < 0) { - throw LibraryIException("H5Library::checkVersion", "H5check_version failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Library::garbageCollect (static) -///\brief Walks through all the garbage collection routines for the -/// library, which are supposed to free any unused memory they -/// have allocated. -/// -///\exception H5::LibraryIException -///\par Description -/// It is not required that H5Library::garbageCollect be called -/// at any particular time; it is only necessary in certain -/// situations, such as when the application has performed actions -/// that cause the library to allocate many objects. The -/// application should call H5Library::garbageCollect if it -/// eventually releases those objects and wants to reduce the -/// memory used by the library from the peak usage required. -///\par -/// The library automatically garbage collects all the free -/// lists when the application ends. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void -H5Library::garbageCollect() -{ - herr_t ret_value = H5garbage_collect(); - if (ret_value < 0) { - throw LibraryIException("H5Library::garbageCollect", "H5garbage_collect failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Library::initH5cpp (static) -///\brief Initializes C++ library and registers terminating functions at -/// exit. Only for the library functions, not for user-defined -/// functions. -// Description -// initH5cpp registers the following functions with std::atexit(): -// termH5cpp() - calls H5close() after all cleanup in -// the C++ library is done -// ::deleteConstants - deletes all references -// for global constants -///\exception H5::LibraryIException -// -// Programmer Binh-Minh Ribler - September, 2015 -//-------------------------------------------------------------------------- -void -H5Library::initH5cpp() -{ - // Register terminating functions with atexit(); they will be invoked in - // the reversed order - int ret_value = 0; - ret_value = std::atexit(termH5cpp); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registering termH5cpp failed"); - - ret_value = std::atexit(PredType::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registering PredType::deleteConstants failed"); - - ret_value = std::atexit(PropList::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registering PropList::deleteConstants failed"); - - ret_value = std::atexit(DSetAccPropList::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", - "Registering DSetAccPropList::deleteConstants failed"); - - ret_value = std::atexit(LinkAccPropList::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", - "Registering LinkAccPropList::deleteConstants failed"); - - ret_value = std::atexit(LinkCreatPropList::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", - "Registering LinkCreatPropList::deleteConstants failed"); - - ret_value = std::atexit(FileAccPropList::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", - "Registering FileAccPropList::deleteConstants failed"); - - ret_value = std::atexit(FileCreatPropList::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", - "Registering FileCreatPropList::deleteConstants failed"); - - ret_value = std::atexit(DSetMemXferPropList::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", - "Registering DSetMemXferPropList::deleteConstants failed"); - - ret_value = std::atexit(DSetCreatPropList::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", - "Registering DSetCreatPropList::deleteConstants failed"); - - ret_value = std::atexit(ObjCreatPropList::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", - "Registering ObjCreatPropList::deleteConstants failed"); - - ret_value = std::atexit(DataSpace::deleteConstants); - if (ret_value != 0) - throw LibraryIException("H5Library::initH5cpp", "Registering DataSpace::deleteConstants failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Library::termH5cpp (static) -///\brief Sends request for the C layer to terminate. -///\par Description -/// If the C library fails to terminate, exit with a failure. -// Programmer Binh-Minh Ribler - September, 2015 -//-------------------------------------------------------------------------- -void -H5Library::termH5cpp() -{ - // Close the C library - herr_t ret_value = H5close(); - if (ret_value == -1) - exit(-1); -} - -//-------------------------------------------------------------------------- -// Function: H5Library::setFreeListLimits (static) -///\brief Sets limits on the different kinds of free lists. -///\param reg_global_lim - IN: Limit on all "regular" free list memory used -///\param reg_list_lim - IN: Limit on memory used in each "regular" free list -///\param arr_global_lim - IN: Limit on all "array" free list memory used -///\param arr_list_lim - IN: Limit on memory used in each "array" free list -///\param blk_global_lim - IN: Limit on all "block" free list memory used -///\param blk_list_lim - IN: Limit on memory used in each "block" free list -///\exception H5::LibraryIException -///\par Description -/// Setting a value of -1 for a limit means no limit of that type. -/// For more information on free list limits, please refer to -/// the H5set_free_list_limits API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void -H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim, - int blk_global_lim, int blk_list_lim) -{ - herr_t ret_value = H5set_free_list_limits(reg_global_lim, reg_list_lim, arr_global_lim, arr_list_lim, - blk_global_lim, blk_list_lim); - if (ret_value < 0) { - throw LibraryIException("H5Library::setFreeListLimits", "H5set_free_list_limits failed"); - } -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: H5Library default constructor - private -///\brief Default constructor: Creates a stub H5Library object -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5Library::H5Library() -{ -} - -//-------------------------------------------------------------------------- -// Function: H5Library destructor -///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5Library::~H5Library() -{ -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Lint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Lint.c index 33098770ef..554dd14844 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Lint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Lint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -197,9 +196,6 @@ static H5L_class_t *H5L_table_g = NULL; * * Failure: negative * - * Programmer: James Laird - * Thursday, July 13, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -211,7 +207,7 @@ H5L_init(void) /* Initialize user-defined link classes */ if (H5L_register_external() < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class") + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to register external link class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -224,9 +220,6 @@ H5L_init(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Tuesday, January 24, 2006 - * *------------------------------------------------------------------------- */ int @@ -256,9 +249,6 @@ H5L_term_package(void) * link class table. * Failure: Negative * - * Programmer: James Laird - * Monday, July 10, 2006 - * *------------------------------------------------------------------------- */ static int @@ -271,7 +261,7 @@ H5L__find_class_idx(H5L_type_t id) for (i = 0; i < H5L_table_used_g; i++) if (H5L_table_g[i].id == id) - HGOTO_DONE((int)i) + HGOTO_DONE((int)i); done: FUNC_LEAVE_NOAPI(ret_value) @@ -286,9 +276,6 @@ H5L__find_class_idx(H5L_type_t id) * Return: Success: Ptr to entry in global link class table. * Failure: NULL * - * Programmer: James Laird - * Monday, July 10, 2006 - * *------------------------------------------------------------------------- */ const H5L_class_t * @@ -301,7 +288,7 @@ H5L_find_class(H5L_type_t id) /* Get the index in the global table */ if ((idx = H5L__find_class_idx(id)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class") + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, NULL, "unable to find link class"); /* Set return value */ ret_value = H5L_table_g + idx; @@ -320,9 +307,6 @@ H5L_find_class(H5L_type_t id) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Monday, July 10, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -333,8 +317,8 @@ H5L_register(const H5L_class_t *cls) FUNC_ENTER_NOAPI(FAIL) - HDassert(cls); - HDassert(cls->id >= 0 && cls->id <= H5L_TYPE_MAX); + assert(cls); + assert(cls->id >= 0 && cls->id <= H5L_TYPE_MAX); /* Is the link type already registered? */ for (i = 0; i < H5L_table_used_g; i++) @@ -347,7 +331,7 @@ H5L_register(const H5L_class_t *cls) size_t n = MAX(H5L_MIN_TABLE_SIZE, (2 * H5L_table_alloc_g)); H5L_class_t *table = (H5L_class_t *)H5MM_realloc(H5L_table_g, (n * sizeof(H5L_class_t))); if (!table) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend link type table"); H5L_table_g = table; H5L_table_alloc_g = n; } /* end if */ @@ -372,9 +356,6 @@ H5L_register(const H5L_class_t *cls) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Monday, July 10, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -385,7 +366,7 @@ H5L_unregister(H5L_type_t id) FUNC_ENTER_NOAPI(FAIL) - HDassert(id >= 0 && id <= H5L_TYPE_MAX); + assert(id >= 0 && id <= H5L_TYPE_MAX); /* Is the filter already registered? */ for (i = 0; i < H5L_table_used_g; i++) @@ -394,11 +375,11 @@ H5L_unregister(H5L_type_t id) /* Fail if filter not found */ if (i >= H5L_table_used_g) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered") + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered"); /* Remove filter from table */ /* Don't worry about shrinking table size (for now) */ - HDmemmove(&H5L_table_g[i], &H5L_table_g[i + 1], sizeof(H5L_class_t) * ((H5L_table_used_g - 1) - i)); + memmove(&H5L_table_g[i], &H5L_table_g[i + 1], sizeof(H5L_class_t) * ((H5L_table_used_g - 1) - i)); H5L_table_used_g--; done: @@ -423,7 +404,7 @@ H5L_is_registered(H5L_type_t id, hbool_t *is_registered) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(is_registered); + assert(is_registered); /* Is the link class already registered? */ *is_registered = FALSE; @@ -444,9 +425,6 @@ H5L_is_registered(H5L_type_t id, hbool_t *is_registered) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Tuesday, December 13, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -458,9 +436,9 @@ H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(new_loc); - HDassert(obj_loc); - HDassert(new_name && *new_name); + assert(new_loc); + assert(obj_loc); + assert(new_name && *new_name); /* The link callback will check that the object isn't being hard linked * into a different file, so we don't need to do it here (there could be @@ -473,7 +451,7 @@ H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid /* Create the link */ if (H5L__create_real(new_loc, new_name, obj_loc->path, obj_loc->oloc->file, &lnk, NULL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -486,9 +464,6 @@ H5L_link(const H5G_loc_t *new_loc, const char *new_name, H5G_loc_t *obj_loc, hid * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, April 9, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -500,9 +475,9 @@ H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, H5O_obj_create_t FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(new_loc); - HDassert(new_name && *new_name); - HDassert(ocrt_info); + assert(new_loc); + assert(new_name && *new_name); + assert(ocrt_info); /* The link callback will check that the object isn't being hard linked * into a different file, so we don't need to do it here (there could be @@ -514,7 +489,7 @@ H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, H5O_obj_create_t /* Create the link */ if (H5L__create_real(new_loc, new_name, NULL, NULL, &lnk, ocrt_info, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -527,9 +502,6 @@ H5L_link_object(const H5G_loc_t *new_loc, const char *new_name, H5O_obj_create_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, September 19, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -549,7 +521,7 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT /* Check if the name in this group resolved to a valid location */ /* (which is not what we want) */ if (obj_loc != NULL) - HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name already exists") + HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name already exists"); /* Check for crossing file boundaries with a new hard link */ if (udata->lnk->type == H5L_TYPE_HARD) { @@ -562,7 +534,7 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT if (NULL == (udata->ocrt_info->new_obj = H5O_obj_create(grp_loc->oloc->file, udata->ocrt_info->obj_type, udata->ocrt_info->crt_info, &new_loc))) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create object") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create object"); /* Set address for hard link */ udata->lnk->u.hard.addr = new_loc.oloc->addr; @@ -576,7 +548,7 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT else { /* Check that both objects are in same file */ if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "interfile hard links are not allowed") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "interfile hard links are not allowed"); } /* end else */ } /* end if */ @@ -589,7 +561,7 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT if (udata->lc_plist) { /* Get character encoding property */ if (H5CX_get_encoding(&udata->lnk->cset) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'character set' property") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'character set' property"); } /* end if */ else udata->lnk->cset = H5F_DEFAULT_CSET; /* Default character encoding for link */ @@ -603,12 +575,12 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, udata->ocrt_info ? udata->ocrt_info->obj_type : H5O_TYPE_UNKNOWN, udata->ocrt_info ? udata->ocrt_info->crt_info : NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link for object"); /* Set object's path if it has been passed in and is not set */ if (udata->path != NULL && udata->path->user_path_r == NULL) if (H5G_name_set(grp_loc->path, udata->path, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "cannot set name") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "cannot set name"); /* If link is a user-defined link, trigger its creation callback if it has one */ if (udata->lnk->type >= H5L_TYPE_UD_MIN) { @@ -616,7 +588,7 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT /* Get the link class for this type of link. */ if (NULL == (link_class = H5L_find_class(udata->lnk->type))) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to get class of UD link") + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "unable to get class of UD link"); if (link_class->create_func != NULL) { H5O_loc_t temp_oloc; @@ -627,7 +599,7 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT */ H5G_name_reset(&temp_path); if (H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location") + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location"); temp_loc.oloc = &temp_oloc; temp_loc.path = &temp_path; @@ -635,14 +607,14 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT /* Set up location for user-defined callback */ if (NULL == (grp = H5G_open(&temp_loc))) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group"); if ((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group") + HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register ID for group"); /* Make callback */ if ((link_class->create_func)(name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size, H5P_DEFAULT) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "link creation callback failed") + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "link creation callback failed"); } /* end if */ } /* end if */ @@ -652,23 +624,23 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT H5O_loc_t oloc; /* Object location for created object */ /* Set up object location */ - HDmemset(&oloc, 0, sizeof(oloc)); + memset(&oloc, 0, sizeof(oloc)); oloc.file = grp_loc->oloc->file; oloc.addr = udata->lnk->u.hard.addr; /* Decrement refcount on new object's object header in memory */ if (H5O_dec_rc_by_loc(&oloc) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + HDONE_ERROR(H5E_LINK, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object"); } /* end if */ /* Close the location given to the user callback if it was created */ if (grp_id >= 0) { if (H5I_dec_app_ref(grp_id) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback") + HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback"); } /* end if */ else if (grp != NULL) { if (H5G_close(grp) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback") + HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback"); } /* end if */ else if (temp_loc_init) H5G_loc_free(&temp_loc); @@ -694,9 +666,6 @@ H5L__link_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t H5_AT * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, December 5, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -712,14 +681,14 @@ H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *o FUNC_ENTER_PACKAGE /* Check args */ - HDassert(link_loc); - HDassert(link_name && *link_name); - HDassert(lnk); - HDassert(lnk->type >= H5L_TYPE_HARD && lnk->type <= H5L_TYPE_MAX); + assert(link_loc); + assert(link_name && *link_name); + assert(lnk); + assert(lnk->type >= H5L_TYPE_HARD && lnk->type <= H5L_TYPE_MAX); /* Get normalized link name */ if ((norm_link_name = H5G_normalize(link_name)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name"); /* Check for flags present in creation property list */ if (lcpl_id != H5P_DEFAULT) { @@ -727,11 +696,11 @@ H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *o /* Get link creation property list */ if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get intermediate group creation property */ if (H5CX_get_intermediate_group(&crt_intmd_group) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'create intermediate group' property") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get 'create intermediate group' property"); if (crt_intmd_group > 0) target_flags |= H5G_CRT_INTMD_GROUP; @@ -757,7 +726,7 @@ H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *o /* Traverse the destination path & create new link */ if (H5G_traverse(link_loc, link_name, target_flags, H5L__link_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert link") + HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert link"); done: /* Free the normalized path name */ @@ -774,9 +743,6 @@ H5L__create_real(const H5G_loc_t *link_loc, const char *link_name, H5G_name_t *o * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, April 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -795,14 +761,14 @@ H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link FUNC_ENTER_PACKAGE /* Check args */ - HDassert(cur_loc); - HDassert(cur_name && *cur_name); - HDassert(link_loc); - HDassert(link_name && *link_name); + assert(cur_loc); + assert(cur_name && *cur_name); + assert(link_loc); + assert(link_name && *link_name); /* Get normalized copy of the current name */ if ((norm_cur_name = H5G_normalize(cur_name)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name"); /* Set up link data specific to hard links */ lnk.type = H5L_TYPE_HARD; @@ -812,7 +778,7 @@ H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link obj_loc.oloc = &oloc; H5G_loc_reset(&obj_loc); if (H5G_loc_find(cur_loc, norm_cur_name, &obj_loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "source object not found") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "source object not found"); loc_valid = TRUE; /* Construct link information for eventual insertion */ @@ -824,13 +790,13 @@ H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link /* Create actual link to the object. Pass in NULL for the path, since this * function shouldn't change an object's user path. */ if (H5L__create_real(link_loc, link_name, NULL, link_file, &lnk, NULL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object"); done: /* Free the object header location */ if (loc_valid) if (H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to free location") + HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to free location"); /* Free the normalized path name */ if (norm_cur_name) @@ -846,9 +812,6 @@ H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Monday, April 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -861,13 +824,13 @@ H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, const char FUNC_ENTER_PACKAGE /* Check args */ - HDassert(link_loc); - HDassert(target_path && *target_path); - HDassert(link_name && *link_name); + assert(link_loc); + assert(target_path && *target_path); + assert(link_name && *link_name); /* Get normalized copy of the link target */ if ((norm_target = H5G_normalize(target_path)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name"); /* Set up link data specific to soft links */ lnk.type = H5L_TYPE_SOFT; @@ -875,7 +838,7 @@ H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, const char /* Create actual link to the object */ if (H5L__create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object"); done: /* Free the normalized target name */ @@ -893,9 +856,6 @@ H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc, const char * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Friday, May 19, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -908,17 +868,17 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX); - HDassert(link_loc); - HDassert(link_name && *link_name); - HDassert(ud_data_size == 0 || ud_data); + assert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX); + assert(link_loc); + assert(link_name && *link_name); + assert(ud_data_size == 0 || ud_data); /* Initialize the link struct's pointer to its udata buffer */ lnk.u.ud.udata = NULL; /* Make sure that this link class is registered */ if (H5L__find_class_idx(type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "link class has not been registered with library") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "link class has not been registered with library"); /* Fill in UD link-specific information in the link struct*/ if (ud_data_size > 0) { @@ -933,7 +893,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_ /* Create actual link to the object */ if (H5L__create_real(link_loc, link_name, NULL, NULL, &lnk, NULL, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to register new name for object") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to register new name for object"); done: /* Free the link's udata buffer if it's been allocated */ @@ -949,9 +909,6 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, November 13 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -962,7 +919,7 @@ H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(lnk); + assert(lnk); /* Check for soft link */ if (H5L_TYPE_SOFT == lnk->type) { @@ -985,13 +942,13 @@ H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size) if (link_class != NULL && link_class->query_func != NULL) { if ((link_class->query_func)(lnk->name, lnk->u.ud.udata, lnk->u.ud.size, buf, size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query callback returned failure") + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "query callback returned failure"); } /* end if */ else if (buf && size > 0) ((char *)buf)[0] = '\0'; } /* end if */ else - HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "object is not a symbolic or user-defined link") + HGOTO_ERROR(H5E_LINK, H5E_BADTYPE, FAIL, "object is not a symbolic or user-defined link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1004,9 +961,6 @@ H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 20, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -1020,11 +974,11 @@ H5L__get_val_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, cons /* Check if the name in this group resolved to a valid link */ if (lnk == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name) + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "'%s' doesn't exist", name); /* Retrieve the value for the link */ if (H5L__get_val_real(lnk, udata->buf, udata->size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value"); done: /* Indicate that this callback didn't take ownership of the group * @@ -1048,9 +1002,6 @@ H5L__get_val_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char *name, cons * * Failure: Negative * - * Programmer: Robb Matzke - * Monday, April 13, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1062,8 +1013,8 @@ H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t s FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(loc); - HDassert(name && *name); + assert(loc); + assert(name && *name); /* Set up user data for retrieving information */ udata.size = size; @@ -1071,7 +1022,7 @@ H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t s /* Traverse the group hierarchy to locate the object to get info about */ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_val_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1085,9 +1036,6 @@ H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t s * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, November 13 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1104,16 +1052,16 @@ H5L__get_val_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_A /* Check if the name of the group resolved to a valid object */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist"); /* Query link */ if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found"); lnk_copied = TRUE; /* Retrieve the value for the link */ if (H5L__get_val_real(&fnd_lnk, udata->buf, udata->size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't retrieve link value"); done: /* Reset the link information, if we have a copy */ @@ -1135,9 +1083,6 @@ H5L__get_val_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_A * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 27, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -1150,8 +1095,8 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); - HDassert(name && *name); + assert(loc); + assert(name && *name); /* Set up user data for retrieving information */ udata.idx_type = idx_type; @@ -1162,7 +1107,8 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, /* Traverse the group hierarchy to locate the object to get info about */ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_val_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n) + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", + (unsigned long long)n); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1176,9 +1122,6 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, September 19, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -1192,22 +1135,22 @@ H5L__delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *ln /* Check if the group resolved to a valid link */ if (grp_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist"); /* Check if the name in this group resolved to a valid link */ if (name == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist"); /* Check for non-existent (NULL) link. * Note that this can also occur when attempting to remove '.' */ if (lnk == NULL) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, - "callback link pointer is NULL (specified link may be '.' or not exist)") + "callback link pointer is NULL (specified link may be '.' or not exist)"); /* Remove the link from the group */ if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to remove link from group"); done: /* Indicate that this callback didn't take ownership of the group * @@ -1224,9 +1167,6 @@ H5L__delete_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *ln * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, September 17, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1238,17 +1178,17 @@ H5L__delete(const H5G_loc_t *loc, const char *name) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(loc); - HDassert(name && *name); + assert(loc); + assert(name && *name); /* Get normalized copy of the name */ if ((norm_name = H5G_normalize(name)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name") + HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize name"); /* Set up user data for unlink operation */ if (H5G_traverse(loc, norm_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT, H5L__delete_cb, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTREMOVE, FAIL, "can't unlink object") + HGOTO_ERROR(H5E_LINK, H5E_CANTREMOVE, FAIL, "can't unlink object"); done: /* Free the normalized path name */ @@ -1265,9 +1205,6 @@ H5L__delete(const H5G_loc_t *loc, const char *name) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, November 13 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1282,12 +1219,12 @@ H5L__delete_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_AT /* Check if the name of the group resolved to a valid object */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist"); /* Delete link */ if (H5G_obj_remove_by_idx(obj_loc->oloc, obj_loc->path->full_path_r, udata->idx_type, udata->order, udata->n) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found"); done: /* Indicate that this callback didn't take ownership of the group * @@ -1305,9 +1242,6 @@ H5L__delete_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_AT * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 27, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -1320,8 +1254,8 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(loc); - HDassert(name && *name); + assert(loc); + assert(name && *name); /* Set up user data for unlink operation */ udata.idx_type = idx_type; @@ -1331,7 +1265,7 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, /* Traverse the group hierarchy to remove the link */ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK | H5G_TARGET_MOUNT, H5L__delete_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1346,9 +1280,6 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Monday, April 3, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1366,23 +1297,23 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t /* Make sure an object with this name doesn't already exist */ if (obj_loc != NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "an object with that name already exists") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "an object with that name already exists"); /* Check for crossing file boundaries with a new hard link */ if (udata->lnk->type == H5L_TYPE_HARD) /* Check that both objects are in same file */ if (!H5F_SAME_SHARED(grp_loc->oloc->file, udata->file)) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "moving a link across files is not allowed") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "moving a link across files is not allowed"); /* Give the object its new name */ - HDassert(udata->lnk->name == NULL); + assert(udata->lnk->name == NULL); H5_GCC_CLANG_DIAG_OFF("cast-qual") udata->lnk->name = (char *)name; H5_GCC_CLANG_DIAG_ON("cast-qual") /* Insert the link into the group */ if (H5G_obj_insert(grp_loc->oloc, name, udata->lnk, TRUE, H5O_TYPE_UNKNOWN, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create new link to object"); /* If the link was a user-defined link, call its move callback if it has one */ if (udata->lnk->type >= H5L_TYPE_UD_MIN) { @@ -1390,7 +1321,7 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t /* Get the link class for this type of link. */ if (NULL == (link_class = H5L_find_class(udata->lnk->type))) - HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered") + HGOTO_ERROR(H5E_LINK, H5E_NOTREGISTERED, FAIL, "link class is not registered"); if ((!udata->copy && link_class->move_func) || (udata->copy && link_class->copy_func)) { H5O_loc_t temp_oloc; @@ -1401,7 +1332,7 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t */ H5G_name_reset(&temp_path); if (H5O_loc_copy_deep(&temp_oloc, grp_loc->oloc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location") + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object location"); temp_loc.oloc = &temp_oloc; temp_loc.path = &temp_path; @@ -1409,19 +1340,19 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t /* Set up location for user-defined callback */ if (NULL == (grp = H5G_open(&temp_loc))) - HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_LINK, H5E_CANTOPENOBJ, FAIL, "unable to open group"); if ((grp_id = H5VL_wrap_register(H5I_GROUP, grp, TRUE)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID") + HGOTO_ERROR(H5E_LINK, H5E_CANTREGISTER, FAIL, "unable to register group ID"); if (udata->copy) { if ((link_class->copy_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD copy callback returned error") + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD copy callback returned error"); } /* end if */ else { if ((link_class->move_func)(udata->lnk->name, grp_id, udata->lnk->u.ud.udata, udata->lnk->u.ud.size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD move callback returned error") + HGOTO_ERROR(H5E_LINK, H5E_CALLBACK, FAIL, "UD move callback returned error"); } /* end else */ } /* end if */ } /* end if */ @@ -1430,11 +1361,11 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t /* Close the location given to the user callback if it was created */ if (grp_id >= 0) { if (H5I_dec_app_ref(grp_id) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback") + HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close ID from UD callback"); } /* end if */ else if (grp != NULL) { if (H5G_close(grp) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback") + HDONE_ERROR(H5E_LINK, H5E_CANTRELEASE, FAIL, "unable to close group given to UD callback"); } /* end if */ else if (temp_loc_init) H5G_loc_free(&temp_loc); @@ -1459,9 +1390,6 @@ H5L__move_dest_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Friday, April 3, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1478,15 +1406,15 @@ H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, /* Check if the name in this group resolved to a valid link */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist"); /* Check for operations on '.' */ if (lnk == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "the name of a link must be supplied to move or copy") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "the name of a link must be supplied to move or copy"); /* Set up user data for move_dest_cb */ if (NULL == (udata_out.lnk = (H5O_link_t *)H5O_msg_copy(H5O_LINK_ID, lnk, NULL))) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved") + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link to be moved"); /* In this special case, the link's name is going to be replaced at its * destination, so we should free it here. @@ -1505,12 +1433,12 @@ H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, * (destination) traversal has the correct value */ if (H5CX_set_nlinks(udata->orig_nlinks) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't reset # of soft / UD links to traverse") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't reset # of soft / UD links to traverse"); /* Insert the link into its new location */ if (H5G_traverse(udata->dst_loc, udata->dst_name, udata->dst_target_flags, H5L__move_dest_cb, &udata_out) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to follow symbolic link"); /* If this is a move and not a copy operation, change the object's name and remove the old link */ if (!udata->copy) { @@ -1518,28 +1446,28 @@ H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, /* Make certain that the destination name is a full (not relative) path */ if (*(udata->dst_name) != '/') { - HDassert(udata->dst_loc->path->full_path_r); + assert(udata->dst_loc->path->full_path_r); /* Create reference counted string for full dst path */ if ((dst_name_r = H5G_build_fullpath_refstr_str(udata->dst_loc->path->full_path_r, udata->dst_name)) == NULL) - HGOTO_ERROR(H5E_LINK, H5E_PATH, FAIL, "can't build destination path name") + HGOTO_ERROR(H5E_LINK, H5E_PATH, FAIL, "can't build destination path name"); } /* end if */ else dst_name_r = H5RS_wrap(udata->dst_name); - HDassert(dst_name_r); + assert(dst_name_r); /* Fix names up */ if (H5G_name_replace(lnk, H5G_NAME_MOVE, obj_loc->oloc->file, obj_loc->path->full_path_r, udata->dst_loc->oloc->file, dst_name_r) < 0) { H5RS_decr(dst_name_r); - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to replace name") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to replace name"); } /* end if */ /* Remove the old link */ if (H5G_obj_remove(grp_loc->oloc, grp_loc->path->full_path_r, orig_name) < 0) { H5RS_decr(dst_name_r); - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to remove old name") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to remove old name"); } /* end if */ H5RS_decr(dst_name_r); @@ -1579,9 +1507,6 @@ H5L__move_cb(H5G_loc_t *grp_loc /*in*/, const char *name, const H5O_link_t *lnk, * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Monday, May 1, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1597,21 +1522,21 @@ H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_l FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(src_loc); - HDassert(dst_loc); - HDassert(src_name && *src_name); - HDassert(dst_name && *dst_name); + assert(src_loc); + assert(dst_loc); + assert(src_name && *src_name); + assert(dst_name && *dst_name); /* Check for flags present in creation property list */ if (lcpl_id != H5P_DEFAULT) { unsigned crt_intmd_group; if (NULL == (lc_plist = (H5P_genplist_t *)H5I_object(lcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get intermediate group creation property */ if (H5CX_get_intermediate_group(&crt_intmd_group) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for creating missing groups"); /* Set target flags for source and destination */ if (crt_intmd_group > 0) @@ -1619,7 +1544,7 @@ H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_l /* Get character encoding property */ if (H5CX_get_encoding(&char_encoding) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property value for character encoding"); } /* end if */ /* Set up user data */ @@ -1633,12 +1558,12 @@ H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_l * that the countdown can be reset after the first path is traversed. */ if (H5CX_get_nlinks(&udata.orig_nlinks) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve # of soft / UD links to traverse"); /* Do the move */ if (H5G_traverse(src_loc, src_name, H5G_TARGET_MOUNT | H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__move_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to find link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1652,9 +1577,6 @@ H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_l * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, March 16 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -1684,9 +1606,6 @@ H5L__exists_final_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATT * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, December 31 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1719,7 +1638,7 @@ H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATT cb_func = H5L__exists_inter_cb; } /* end else */ if (H5G_traverse(obj_loc, next, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists"); } /* end if */ else *udata->exists = TRUE; @@ -1745,9 +1664,6 @@ H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATT * * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, December 31 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -1762,9 +1678,9 @@ H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hbool_t *exists) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(loc); - HDassert(name); - HDassert(exists); + assert(loc); + assert(name); + assert(exists); /* Copy the name and skip leading '/'s */ name_trav = name_copy = H5MM_strdup(name); @@ -1790,7 +1706,7 @@ H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hbool_t *exists) /* Traverse the group hierarchy to locate the link to check */ if (H5G_traverse(loc, name_trav, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if link exists"); } done: @@ -1810,9 +1726,6 @@ H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hbool_t *exists) * * Return: Non-negative on success, with *exists set/Negative on failure * - * Programmer: Quincey Koziol - * Friday, March 16 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1824,9 +1737,9 @@ H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(loc); - HDassert(name); - HDassert(exists); + assert(loc); + assert(name); + assert(exists); /* A path of "/" will always exist in a file */ if (0 == HDstrcmp(name, "/")) @@ -1835,7 +1748,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists) /* Traverse the group hierarchy to locate the object to get info about */ udata.exists = exists; if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__exists_final_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "link doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "link doesn't exist"); } done: @@ -1849,9 +1762,6 @@ H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Monday, April 17 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1865,11 +1775,11 @@ H5L__get_info_cb(H5G_loc_t *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, con /* Check if the name in this group resolved to a valid link */ if (lnk == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "name doesn't exist"); /* Get information from the link */ if (H5G_link_to_info(grp_loc->oloc, lnk, udata->linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info"); done: /* Indicate that this callback didn't take ownership of the group * @@ -1886,9 +1796,6 @@ H5L__get_info_cb(H5G_loc_t *grp_loc /*in*/, const char H5_ATTR_UNUSED *name, con * * Return: SUCCEED/FAIL * - * Programmer: James Laird - * Monday, April 17 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1903,7 +1810,7 @@ H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linfo /*out*/) /* Traverse the group hierarchy to locate the object to get info about */ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name doesn't exist"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1917,9 +1824,6 @@ H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info2_t *linfo /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, November 6 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1936,16 +1840,16 @@ H5L__get_info_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ /* Check if the name of the group resolved to a valid object */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist"); /* Query link */ if (H5G_obj_lookup_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, &fnd_lnk) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found"); lnk_copied = TRUE; /* Get information from the link */ if (H5G_link_to_info(obj_loc->oloc, &fnd_lnk, udata->linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info"); done: /* Reset the link information, if we have a copy */ @@ -1979,9 +1883,9 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); - HDassert(name && *name); - HDassert(linfo); + assert(loc); + assert(name && *name); + assert(linfo); /* Set up user data for callback */ udata.idx_type = idx_type; @@ -1991,7 +1895,7 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type /* Traverse the group hierarchy to locate the object to get info about */ if (H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2005,9 +1909,6 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, November 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2022,12 +1923,12 @@ H5L__get_name_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ /* Check if the name of the group resolved to a valid object */ if (obj_loc == NULL) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist"); /* Query link */ if (H5G_obj_get_name_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, udata->name, udata->size, &udata->name_len) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found"); done: /* Indicate that this callback didn't take ownership of the group * @@ -2057,9 +1958,9 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); - HDassert(group_name && *group_name); - HDassert(link_name_len); + assert(loc); + assert(group_name && *group_name); + assert(link_name_len); /* Set up user data for callback */ udata.idx_type = idx_type; @@ -2072,7 +1973,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id /* Traverse the group hierarchy to locate the link to get name of */ if (H5G_traverse(loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_name_by_idx_cb, &udata) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get name") + HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get name"); /* Set the return value */ *link_name_len = udata.name_len; @@ -2089,9 +1990,6 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 29 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2110,10 +2008,10 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(dst_file); - HDassert(src_lnk); - HDassert(dst_lnk); - HDassert(cpy_info); + assert(dst_file); + assert(src_lnk); + assert(dst_lnk); + assert(cpy_info); /* Expand soft or external link, if requested */ if ((H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) || @@ -2131,24 +2029,24 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t /* Check if the target object exists */ if (H5G_loc_exists(&lnk_grp_loc, src_lnk->name, &tar_exists) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to check if target object exists") + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to check if target object exists"); if (tar_exists) { /* Make a temporary copy of the link, so that it will not change the * info in the cache when we change it to a hard link */ if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, &tmp_src_lnk)) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message") + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message"); /* Set up group location for target object. Let H5G_traverse expand * the link. */ tmp_src_loc.path = &tmp_src_path; tmp_src_loc.oloc = &tmp_src_oloc; if (H5G_loc_reset(&tmp_src_loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to reset location") + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to reset location"); /* Find the target object */ if (H5G_loc_find(&lnk_grp_loc, src_lnk->name, &tmp_src_loc) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to find target object") + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to find target object"); expanded_link_open = TRUE; /* Convert symbolic link to hard link */ @@ -2164,7 +2062,7 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t /* Copy src link information to dst link information */ if (NULL == H5O_msg_copy(H5O_LINK_ID, src_lnk, dst_lnk)) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message") + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy message"); dst_lnk_init = TRUE; /* Check if object in source group is a hard link & copy it */ @@ -2181,13 +2079,13 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t tmp_src_oloc.file = src_oloc->file; tmp_src_oloc.addr = src_lnk->u.hard.addr; } /* end if */ - HDassert(H5F_addr_defined(tmp_src_oloc.addr)); + assert(H5_addr_defined(tmp_src_oloc.addr)); /* Copy the shared object from source to destination */ /* Don't care about obj_type or udata because those are only important * for old style groups */ if (H5O_copy_header_map(&tmp_src_oloc, &new_dst_oloc, cpy_info, TRUE, NULL, NULL) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy object"); /* Copy new destination object's information for eventual insertion */ dst_lnk->u.hard.addr = new_dst_oloc.addr; @@ -2196,7 +2094,7 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t done: /* Check if we used a temporary src link */ if (src_lnk != _src_lnk) { - HDassert(src_lnk == &tmp_src_lnk); + assert(src_lnk == &tmp_src_lnk); H5O_msg_reset(H5O_LINK_ID, &tmp_src_lnk); } /* end if */ if (ret_value < 0) @@ -2205,7 +2103,7 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t /* Check if we need to free the temp source oloc */ if (expanded_link_open) if (H5G_loc_free(&tmp_src_loc) < 0) - HDONE_ERROR(H5E_LINK, H5E_CANTFREE, FAIL, "unable to free object") + HDONE_ERROR(H5E_LINK, H5E_CANTFREE, FAIL, "unable to free object"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5L__link_copy_file() */ @@ -2231,9 +2129,9 @@ H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter FUNC_ENTER_NOAPI_NOINIT /* Sanity checks */ - HDassert(loc); - HDassert(group_name); - HDassert(op); + assert(loc); + assert(group_name); + assert(op); /* Set up iteration beginning/end info */ idx = (idx_p == NULL ? 0 : *idx_p); @@ -2245,7 +2143,7 @@ H5L_iterate(H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter /* Iterate over the links */ if ((ret_value = H5G_iterate(loc, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed"); /* Set the index we stopped at */ if (idx_p) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Location.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5Location.cpp deleted file mode 100644 index a20386392b..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Location.cpp +++ /dev/null @@ -1,2442 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include -using namespace std; - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5DataSpace.h" -#include "H5PropList.h" -#include "H5FaccProp.h" -#include "H5FcreatProp.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5DxferProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5AbstractDs.h" -#include "H5DataSet.h" -#include "H5CommonFG.h" -#include "H5Group.h" -#include "H5File.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: H5Location default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5Location::H5Location() : IdComponent() -{ -} - -//-------------------------------------------------------------------------- -// Function: H5Location overloaded constructor (protected) -// Purpose Creates an H5Location object using the id of an existing HDF5 -// object. -// Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 - -// *** Deprecation warning *** -// This constructor is no longer appropriate because the data member "id" had -// been moved to the sub-classes. It will be removed in 1.10 release. If its -// removal does not raise any problems in 1.10, it will be removed from 1.8 in -// subsequent releases. -// Removed in 1.10.1 - Aug 2016 -//-------------------------------------------------------------------------- -// H5Location::H5Location(const hid_t object_id) : IdComponent() {} - -//-------------------------------------------------------------------------- -// Function: H5Location copy constructor -// Purpose This noop copy constructor is removed as a result of the data -// member "id" being moved down to sub-classes. (Mar 2015) -///\param original - IN: H5Location instance to copy -// Programmer Binh-Minh Ribler - 2000 -// -// *** Deprecation warning *** -// This constructor is no longer appropriate because the data member "id" had -// been moved to the sub-classes. It is removed from 1.8.15 because it is -// a noop and it can be generated by the compiler if needed. -//-------------------------------------------------------------------------- -// H5Location::H5Location(const H5Location& original) : IdComponent() {} - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: H5Location::nameExists -///\brief Checks if a link of a given name exists in a location -///\param name - IN: Searched name -///\param lapl - IN: Link access property list -///\exception H5::LocationException -// Modification -// Renamed from exists() in 1.10.2 -BMR -//-------------------------------------------------------------------------- -bool -H5Location::nameExists(const char *name, const LinkAccPropList &lapl) const -{ - htri_t ret_value = H5Lexists(getId(), name, lapl.getId()); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else // Raise exception when H5Lexists returns a negative value - { - throw LocationException(inMemFunc("nameExists"), "H5Lexists failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Location::nameExists -///\brief Checks if a link of a given name exists in a location -///\param name - IN: Searched name -///\param lapl - IN: Link access property list -///\exception H5::LocationException -// Modification -// Renamed from exists() in 1.10.2 -BMR -//-------------------------------------------------------------------------- -bool -H5Location::nameExists(const H5std_string &name, const LinkAccPropList &lapl) const -{ - return (nameExists(name.c_str(), lapl)); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::exists - Deprecated -// Purpose Checks if a link of a given name exists in a location -///\brief Deprecated in favor of nameExists -///\param name - IN: Searched name -///\param lapl - IN: Link access property list -///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Nov, 2016 -// Modification -// Renamed to nameExists() in 1.10.2 -BMR -//-------------------------------------------------------------------------- -bool -H5Location::exists(const char *name, const LinkAccPropList &lapl) const -{ - return (nameExists(name, lapl)); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::exists - Deprecated -// Purpose Checks if a link of a given name exists in a location -///\brief Deprecated in favor of nameExists -///\param name - IN: Searched name -///\param lapl - IN: Link access property list -///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Dec, 2016 -// Modification -// Renamed to nameExists() in 1.10.2 -BMR -//-------------------------------------------------------------------------- -bool -H5Location::exists(const H5std_string &name, const LinkAccPropList &lapl) const -{ - return (nameExists(name.c_str(), lapl)); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::flush -///\brief Flushes all buffers associated with a location to disk. -///\param scope - IN: Specifies the scope of the flushing action, -/// which can be either of these values: -/// \li \c H5F_SCOPE_GLOBAL - Flushes the entire virtual file -/// \li \c H5F_SCOPE_LOCAL - Flushes only the specified file -///\exception H5::LocationException -///\par Description -/// This location is used to identify the file to be flushed. -// Programmer Binh-Minh Ribler - 2012 -// Modification -// Sep 2012 - BMR -// Moved from H5File/H5Object -//-------------------------------------------------------------------------- -void -H5Location::flush(H5F_scope_t scope) const -{ - herr_t ret_value = H5Fflush(getId(), scope); - if (ret_value < 0) { - throw LocationException(inMemFunc("flush"), "H5Fflush failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getFileName -///\brief Gets the name of the file, in which an HDF5 object at this -/// location belongs. -///\return File name -///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Jul, 2004 -//-------------------------------------------------------------------------- -H5std_string -H5Location::getFileName() const -{ - try { - return (p_get_file_name()); - } - catch (IdComponentException &E) { - throw LocationException(inMemFunc("getFileName"), E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief Sets or resets the comment for an object specified by its name. -///\param name - IN: Name of the object -///\param comment - IN: New comment -///\exception H5::LocationException -///\par Description -/// If \a comment is an empty string or a null pointer, the comment -/// message is removed from the object. -/// Comments should be relatively short, null-terminated, ASCII -/// strings. They can be attached to any object that has an -/// object header, e.g., data sets, groups, named data types, -/// and data spaces, but not symbolic links. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -// Modification -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void -H5Location::setComment(const char *name, const char *comment) const -{ - herr_t ret_value = H5Oset_comment_by_name(getId(), name, comment, H5P_DEFAULT); - if (ret_value < 0) - throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name and \a comment. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -//-------------------------------------------------------------------------- -void -H5Location::setComment(const H5std_string &name, const H5std_string &comment) const -{ - setComment(name.c_str(), comment.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it doesn't take -/// an object name. -// Programmer Binh-Minh Ribler - Sep 2013 -//-------------------------------------------------------------------------- -void -H5Location::setComment(const char *comment) const -{ - herr_t ret_value = H5Oset_comment_by_name(getId(), ".", comment, H5P_DEFAULT); - if (ret_value < 0) - throw LocationException(inMemFunc("setComment"), "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::setComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a comment. -// Programmer Binh-Minh Ribler - Sep 2013 -//-------------------------------------------------------------------------- -void -H5Location::setComment(const H5std_string &comment) const -{ - setComment(comment.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::removeComment -///\brief Removes the comment from an object specified by its name. -///\param name - IN: Name of the object -///\exception H5::LocationException -// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) -// 2007: QAK modified to use H5O APIs; however the first parameter is -// no longer just file or group, this function should be moved -// to another class to accommodate attribute, dataset, and named -// datatype. - BMR -//-------------------------------------------------------------------------- -void -H5Location::removeComment(const char *name) const -{ - herr_t ret_value = H5Oset_comment_by_name(getId(), name, NULL, H5P_DEFAULT); - if (ret_value < 0) - throw LocationException(inMemFunc("removeComment"), "H5Oset_comment_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::removeComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) -//-------------------------------------------------------------------------- -void -H5Location::removeComment(const H5std_string &name) const -{ - removeComment(name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getComment -///\brief Retrieves the comment for this location, returning its length. -///\param name - IN: Name of the object -///\param buf_size - IN: Length of the comment to retrieve -///\param comment - OUT: Retrieved comment -///\return Actual length of the comment -///\exception H5::LocationException -///\par Description -/// This function retrieves \a buf_size characters of the comment -/// including the null terminator. Thus, if the actual length -/// of the comment is more than buf_size-1, the retrieved comment -/// will be truncated to accommodate the null terminator. -// Programmer Binh-Minh Ribler - Mar 2014 -//-------------------------------------------------------------------------- -ssize_t -H5Location::getComment(const char *name, size_t buf_size, char *comment) const -{ - // H5Oget_comment_by_name will get buf_size chars of the comment including - // the null terminator - ssize_t comment_len; - comment_len = H5Oget_comment_by_name(getId(), name, comment, buf_size, H5P_DEFAULT); - - // If H5Oget_comment_by_name returns a negative value, raise an exception - if (comment_len < 0) { - throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed"); - } - // If the comment is longer than the provided buffer size, the C library - // will not null terminate it - if (static_cast(comment_len) >= buf_size) - comment[buf_size - 1] = '\0'; - - // Return the actual comment length, which might be different from buf_size - return (comment_len); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getComment -///\brief Returns the comment as \a string for this location, -/// returning its length. -///\param name - IN: Name of the object -///\param buf_size - IN: Length of the comment to retrieve, default to 0 -///\return Comment string -///\exception H5::LocationException -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -//-------------------------------------------------------------------------- -H5std_string -H5Location::getComment(const char *name, size_t buf_size) const -{ - // Initialize string to "", so that if there is no comment, the returned - // string will be empty - H5std_string comment; - - // Preliminary call to get the comment's length - ssize_t comment_len = H5Oget_comment_by_name(getId(), name, NULL, 0, H5P_DEFAULT); - - // If H5Oget_comment_by_name returns a negative value, raise an exception - if (comment_len < 0) { - throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed"); - } - - // If comment exists, calls C routine again to get it - else if (comment_len > 0) { - size_t tmp_len = buf_size; - - // If buffer size is not provided, use comment length - if (tmp_len == 0) - tmp_len = static_cast(comment_len); - - // Temporary buffer for char* comment - char *comment_C = new char[tmp_len + 1](); - - // Used overloaded function - ssize_t temp_len = getComment(name, tmp_len + 1, comment_C); - if (temp_len < 0) { - delete[] comment_C; - throw LocationException("H5Location::getComment", "H5Oget_comment_by_name failed"); - } - - // Convert the C comment to return - comment = comment_C; - - // Clean up resource - delete[] comment_C; - } - - // Return the string comment - return (comment); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getComment -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) -//-------------------------------------------------------------------------- -H5std_string -H5Location::getComment(const H5std_string &name, size_t buf_size) const -{ - return (getComment(name.c_str(), buf_size)); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: H5Location::p_reference (protected) -// Purpose Creates a reference to an HDF5 object or a dataset region. -// Parameters -// name - IN: Name of the object to be referenced -// dataspace - IN: Dataspace with selection -// ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void -H5Location::p_reference(void *ref, const char *name, hid_t space_id, H5R_type_t ref_type) const -{ - herr_t ret_value = H5Rcreate(ref, getId(), name, ref_type, space_id); - if (ret_value < 0) { - throw ReferenceException(inMemFunc("reference"), "H5Rcreate failed"); - } -} - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief Creates a reference to an HDF5 object or a dataset region. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference. (default) -///\exception H5::ReferenceException -///\note This method is more suitable for a dataset region reference. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void -H5Location::reference(void *ref, const char *name, const DataSpace &dataspace, H5R_type_t ref_type) const -{ - try { - p_reference(ref, name, dataspace.getId(), ref_type); - } - catch (ReferenceException &E) { - throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param dataspace - IN: Dataspace with selection -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -/// reference. (default) -///\exception H5::ReferenceException -///\note This method is more suitable for a dataset region reference. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void -H5Location::reference(void *ref, const H5std_string &name, const DataSpace &dataspace, - H5R_type_t ref_type) const -{ - try { - p_reference(ref, name.c_str(), dataspace.getId(), ref_type); - } - catch (ReferenceException &E) { - throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it does not take -/// a DataSpace object and the reference type must be specified. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference (default) -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -///\exception H5::ReferenceException -///\note This method is more suitable for an object reference. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void -H5Location::reference(void *ref, const char *name, H5R_type_t ref_type) const -{ - try { - p_reference(ref, name, -1, ref_type); - } - catch (ReferenceException &E) { - throw ReferenceException(inMemFunc("reference"), E.getDetailMsg()); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Location::reference -///\brief This is an overloaded function, provided for your convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for the object's name. -///\param ref - IN: Reference pointer -///\param name - IN: Name of the object to be referenced - \c H5std_string -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference (default) -/// \li \c H5R_DATASET_REGION - Reference is a dataset region -///\note This method is more suitable for an object reference. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -void -H5Location::reference(void *ref, const H5std_string &name, H5R_type_t ref_type) const -{ - reference(ref, name.c_str(), ref_type); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: H5Location::p_dereference (protected) -// Purpose Dereference a ref into an hdf5 object. -// Parameters -// loc_id - IN: An hdf5 identifier specifying the location of the -// referenced object -// ref - IN: Reference pointer -// ref_type - IN: Reference type -// plist - IN: Property list - default to PropList::DEFAULT -// from_func - IN: Name of the calling function -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -//-------------------------------------------------------------------------- -hid_t -H5Location::p_dereference(hid_t loc_id, const void *ref, H5R_type_t ref_type, const PropList &plist, - const char *from_func) -{ - hid_t plist_id; - if (p_valid_id(plist.getId())) - plist_id = plist.getId(); - else - plist_id = H5P_DEFAULT; - - hid_t temp_id = H5Rdereference2(loc_id, plist_id, ref_type, ref); - if (temp_id < 0) { - throw ReferenceException(inMemFunc(from_func), "H5Rdereference2 failed"); - } - - return (temp_id); -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: H5Location::dereference -///\brief Dereferences a reference into an HDF5 object, given an HDF5 object. -///\param loc - IN: Location of the referenced object -///\param ref - IN: Reference pointer -///\param ref_type - IN: Reference type -///\param plist - IN: Property list - default to PropList::DEFAULT -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -//-------------------------------------------------------------------------- -void -H5Location::dereference(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist) -{ - p_setId(p_dereference(loc.getId(), ref, ref_type, plist, "dereference")); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::dereference -// brief Dereferences a reference into an HDF5 object, given an attribute. -// param attr - IN: Attribute specifying the location of the referenced object -// param ref - IN: Reference pointer -// param ref_type - IN: Reference type -// param plist - IN: Property list - default to PropList::DEFAULT -// exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 -// Modification -// Mar, 2017 -// Removed in 1.10.1 because H5Location is Attribute's baseclass -// now. -BMR -//-------------------------------------------------------------------------- -/* void H5Location::dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type, const PropList& -plist) -{ - p_setId(p_dereference(attr.getId(), ref, ref_type, plist, "dereference")); -} -*/ - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: H5Location::getObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\param ref - IN: Reference to query -///\return An object type, which can be one of the following: -/// \li \c H5G_UNKNOWN - A failure occurs. (-1) -/// \li \c H5G_GROUP - Object is a group. -/// \li \c H5G_DATASET - Object is a dataset. -/// \li \c H5G_TYPE Object - is a named datatype -/// \li \c H5G_LINK - Object is a symbolic link. -/// \li \c H5G_UDLINK - Object is a user-defined link. -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 -// Modification -// Sep 2012: Moved up from H5File, Group, DataSet, and DataType -//-------------------------------------------------------------------------- -H5G_obj_t -H5Location::getObjType(void *ref, H5R_type_t ref_type) const -{ - try { - return (p_get_obj_type(ref, ref_type)); - } - catch (ReferenceException &E) { - throw ReferenceException(inMemFunc("getObjType"), E.getDetailMsg()); - } -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: H5Location::p_get_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. -// Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5G_UNKNOWN \tFailure occurs (-1) -// H5G_GROUP \tObject is a group. -// H5G_DATASET \tObject is a dataset. -// H5G_TYPE Object \tis a named datatype. -// H5G_LINK \tObject is a symbolic link. -// H5G_UDLINK \tObject is a user-defined link. -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5G_obj_t -H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const -{ - H5G_obj_t obj_type = H5Rget_obj_type1(getId(), ref_type, ref); - if (obj_type == H5G_UNKNOWN) { - throw ReferenceException(inMemFunc("getObjType"), "H5Rget_obj_type1 failed"); - } - return (obj_type); -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: H5Location::getRefObjType -///\brief Retrieves the type of object that an object reference points to. -///\param ref - IN: Reference to query -///\param ref_type - IN: Type of reference to query, valid values are: -/// \li \c H5R_OBJECT - Reference is an object reference. -/// \li \c H5R_DATASET_REGION - Reference is a dataset region reference. -///\return An object type, which can be one of the following: -/// \li \c H5O_TYPE_UNKNOWN - Unknown object type (-1) -/// \li \c H5O_TYPE_GROUP - Object is a group -/// \li \c H5O_TYPE_DATASET - Object is a dataset -/// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype -/// \li \c H5O_TYPE_NTYPES - Number of different object types -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5O_type_t -H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const -{ - try { - return (p_get_ref_obj_type(ref, ref_type)); - } - catch (ReferenceException &E) { - throw ReferenceException(inMemFunc("getRefObjType"), E.getDetailMsg()); - } -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: H5Location::p_get_ref_obj_type (protected) -// Purpose Retrieves the type of object that an object reference points to. -// Parameters -// ref - IN: Reference to query -// ref_type - IN: Type of reference to query -// Return An object type, which can be one of the following: -// H5O_TYPE_UNKNOWN - Unknown object type (-1) -// H5O_TYPE_GROUP - Object is a group -// H5O_TYPE_DATASET - Object is a dataset -// H5O_TYPE_NAMED_DATATYPE - Object is a named datatype -// H5O_TYPE_NTYPES - Number of object types -// Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -H5O_type_t -H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const -{ - H5O_type_t obj_type = H5O_TYPE_UNKNOWN; - herr_t ret_value = H5Rget_obj_type2(getId(), ref_type, ref, &obj_type); - if (ret_value < 0) { - throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 failed"); - } - if (obj_type == H5O_TYPE_UNKNOWN || obj_type >= H5O_TYPE_NTYPES) { - throw ReferenceException(inMemFunc("getRefObjType"), "H5Rget_obj_type2 returned invalid type"); - } - return (obj_type); -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: H5Location::getRegion -///\brief Retrieves a dataspace with the region pointed to selected. -///\param ref - IN: Reference to get region of -///\param ref_type - IN: Type of reference to get region of - default -// to H5R_DATASET_REGION -///\return DataSpace object -///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 -// Modification -// Mar 29, 2015 -// Used friend function to set id for DataSpace instead of the -// existing id constructor or the setId method to avoid incrementing -// ref count, as a work-around for a problem described in the JIRA -// issue HDFFV-7947. -BMR -//-------------------------------------------------------------------------- -DataSpace -H5Location::getRegion(void *ref, H5R_type_t ref_type) const -{ - hid_t space_id = H5Rget_region(getId(), ref_type, ref); - if (space_id < 0) { - throw ReferenceException(inMemFunc("getRegion"), "H5Rget_region failed"); - } - try { - DataSpace dataspace; - f_DataSpace_setId(&dataspace, space_id); - return (dataspace); - } - catch (DataSpaceIException &E) { - throw ReferenceException(inMemFunc("getRegion"), E.getDetailMsg()); - } -} - -// From H5CommonFG.cpp -// Notes with "***Updated" are new and for Group.cpp -// Original notes are from December 2000 -// -// There are a few comments that are common to most of the functions -// defined in this file so they are listed here. -// - getLocId is called by all functions, that call a C API, to get -// the location id, which can be either a file id or a group id. -// This function is pure virtual and it's up to H5File and Group -// to call the right getId() - although, as the structure of the -// library at this time, getId() is basically the IdComponent::getId() -// ***Updated: after the classes are rearranged (HDFFV-9920), functions -// in CommonFG are moved to Group, and they can call getId() -// instead of getLocId(). getLocId() is kept for backward -// compatibility on user applications. Aug 18, 2016 -BMR -// ***Updated: Moving to Group was a mistake, now to H5Location -// Aug 24, 2016 -BMR -// - when a failure returned by the C API, the functions will call -// throwException, which is a pure virtual function and is implemented -// by H5File to throw a FileIException and by Group to throw a -// GroupIException. -// ***Updated: after HDFFV-9920, methods in classes H5Location and Group -// use throwException to distinguish the FileIException and GroupIException. -// CommonFG is no longer used in the library. Aug 18, 2016 -BMR -// H5Location::throwException is changed to throw LocationException for any -// subclass that is not H5File or Group. Aug 14, 2017 -BMR -// ***Note: following the changes in HDFFV-9920, some of the methods could -// throw different exceptions, but for backward-compatibility, throwException -// is kept in those methods as well. Sep 17, 2016 -BMR -// - -//-------------------------------------------------------------------------- -// Function: H5Location::createGroup -///\brief Creates a new group at this location, which can be a file, -/// group, dataset, attribute, or named datatype. -///\param name - IN: Name of the group to create -///\param size_hint - IN: Indicates the number of bytes to reserve for -/// the names that will appear in the group -///\return Group instance -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -///\par Description -/// The optional \a size_hint specifies how much file space to -/// reserve for storing the names that will appear in this new -/// group. If a non-positive value is provided for the \a size_hint -/// then a default size is chosen. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Group -H5Location::createGroup(const char *name, const LinkCreatPropList &lcpl) const -{ - // Call C routine H5Gcreate2 to create the named group, giving the - // location id which can be a file id or a group id - hid_t group_id = H5Gcreate2(getId(), name, lcpl.getId(), H5P_DEFAULT, H5P_DEFAULT); - - // If the creation of the group failed, throw an exception - if (group_id < 0) - throwException("createGroup", "H5Gcreate2 failed"); - - // No failure, create and return the Group object - Group group; - H5Location *ptr = &group; - ptr->p_setId(group_id); - return (group); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::createGroup -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Group -H5Location::createGroup(const H5std_string &name, const LinkCreatPropList &lcpl) const -{ - return (createGroup(name.c_str(), lcpl)); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::createGroup -///\brief Creates a new group at this location, which can be a file, -/// group, dataset, attribute, or named datatype. -///\param name - IN: Name of the group to create -///\param size_hint - IN: Indicates the number of bytes to reserve for -/// the names that will appear in the group -///\return Group instance -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -///\par Description -/// The optional \a size_hint specifies how much file space to -/// reserve for storing the names that will appear in this new -/// group. If a non-positive value is provided for the \a size_hint -/// then a default size is chosen. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Group -H5Location::createGroup(const char *name, size_t size_hint) const -{ - // Group creation property list for size hint - hid_t gcpl_id = 0; - - // Set the local heap size hint - if (size_hint > 0) { - // If the creation of the property list failed, throw an exception - if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) - throwException("createGroup", "H5Pcreate failed"); - - if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) { - H5Pclose(gcpl_id); - throwException("createGroup", "H5Pset_local_heap_size_hint failed"); - } - } - - // Call C routine H5Gcreate2 to create the named group, giving the - // location id which can be a file id or a group id - hid_t group_id = H5Gcreate2(getId(), name, H5P_DEFAULT, gcpl_id, H5P_DEFAULT); - - // Close the group creation property list, if necessary - if (gcpl_id > 0) - H5Pclose(gcpl_id); - - // If the creation of the group failed, throw an exception - if (group_id < 0) - throwException("createGroup", "H5Gcreate2 failed"); - - // No failure, create and return the Group object - Group group; - H5Location *ptr = &group; - ptr->p_setId(group_id); - return (group); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::createGroup -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Group -H5Location::createGroup(const H5std_string &name, size_t size_hint) const -{ - return (createGroup(name.c_str(), size_hint)); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::openGroup -///\brief Opens an existing group in a location which can be a file -/// or another group. -///\param name - IN: Name of the group to open -///\return Group instance -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Group -H5Location::openGroup(const char *name) const -{ - // Call C routine H5Gopen2 to open the named group, giving the - // location id which can be a file id or a group id - hid_t group_id = H5Gopen2(getId(), name, H5P_DEFAULT); - - // If the opening of the group failed, throw an exception - if (group_id < 0) - throwException("openGroup", "H5Gopen2 failed"); - - // No failure, create and return the Group object - Group group; - // group.p_setId(group_id); - H5Location *ptr = &group; - ptr->p_setId(group_id); - return (group); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::openGroup -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Group -H5Location::openGroup(const H5std_string &name) const -{ - return (openGroup(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::createDataSet -///\brief Creates a new dataset at this location. -///\param name - IN: Name of the dataset to create -///\param data_type - IN: Datatype of the dataset -///\param data_space - IN: Dataspace for the dataset -///\param dcpl - IN: Dataset creation properly list -///\param lcpl - IN: Link creation properly list -///\param dapl - IN: Dataset access properly list -///\return DataSet instance -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// 2000 -// Modification: -// Jul 2018 -// Added LinkCreatPropList and DSetAccPropList but did not -// follow the order in the C function: lcpl, dcpl, dapl, to -// accommodate the existing createDataSet calls. -//-------------------------------------------------------------------------- -DataSet -H5Location::createDataSet(const char *name, const DataType &data_type, const DataSpace &data_space, - const DSetCreatPropList &dcpl, const DSetAccPropList &dapl, - const LinkCreatPropList &lcpl) const -{ - // Obtain identifiers for C API - hid_t type_id = data_type.getId(); - hid_t space_id = data_space.getId(); - hid_t dcpl_id = dcpl.getId(); - hid_t lcpl_id = lcpl.getId(); - hid_t dapl_id = dapl.getId(); - - // Call C routine H5Dcreate2 to create the named dataset - hid_t dataset_id = H5Dcreate2(getId(), name, type_id, space_id, lcpl_id, dcpl_id, dapl_id); - - // If the creation of the dataset failed, throw an exception - if (dataset_id < 0) - throwException("createDataSet", "H5Dcreate2 failed"); - - // No failure, create and return the DataSet object - DataSet dataset; - f_DataSet_setId(&dataset, dataset_id); - return (dataset); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::createDataSet -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// 2000 -// Modification: -// Jul 2018 -// Added LinkCreatPropList and DSetAccPropList but did not -// follow the order in the C function: lcpl, dcpl, dapl, to -// accommodate the existing createDataSet calls. -//-------------------------------------------------------------------------- -DataSet -H5Location::createDataSet(const H5std_string &name, const DataType &data_type, const DataSpace &data_space, - const DSetCreatPropList &dcpl, const DSetAccPropList &dapl, - const LinkCreatPropList &lcpl) const -{ - return (createDataSet(name.c_str(), data_type, data_space, dcpl, dapl, lcpl)); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::openDataSet -///\brief Opens an existing dataset at this location. -///\param name - IN: Name of the dataset to open -///\return DataSet instance -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// 2000 -// Modification: -// Jul 2018 -// Added DSetAccPropList argument -//-------------------------------------------------------------------------- -DataSet -H5Location::openDataSet(const char *name, const DSetAccPropList &dapl) const -{ - // Call C function H5Dopen2 to open the specified dataset, giving - // the location id and the dataset's name - hid_t dapl_id = dapl.getId(); - hid_t dataset_id = H5Dopen2(getId(), name, dapl_id); - - // If the dataset's opening failed, throw an exception - if (dataset_id < 0) - throwException("openDataSet", "H5Dopen2 failed"); - - // No failure, create and return the DataSet object - DataSet dataset; - f_DataSet_setId(&dataset, dataset_id); - return (dataset); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::openDataSet -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// 2000 -// Modification: -// Jul 2018 -// Added DSetAccPropList argument -//-------------------------------------------------------------------------- -DataSet -H5Location::openDataSet(const H5std_string &name, const DSetAccPropList &dapl) const -{ - return (openDataSet(name.c_str(), dapl)); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::link -///\brief Creates a soft link from \a link_name to \a target_name. -///\param target_name - IN: Name of object, can be a non-existing object -///\param link_name - IN: Link name for the target name -///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT -///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT -///\exception H5::FileIException or H5::GroupIException -///\par Description -/// Note that both names are interpreted relative to the current -/// location. -/// For information on creating a soft link, please refer to the -/// H5Lcreate_soft APIs in the HDF5 C Reference Manual. -// March 2018 -//-------------------------------------------------------------------------- -void -H5Location::link(const char *target_name, const char *link_name, const LinkCreatPropList &lcpl, - const LinkAccPropList &lapl) const -{ - herr_t ret_value = -1; - hid_t lcpl_id = lcpl.getId(); - hid_t lapl_id = lapl.getId(); - - ret_value = H5Lcreate_soft(target_name, getId(), link_name, lcpl_id, lapl_id); - if (ret_value < 0) - throwException("link", "creating soft link failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::link -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a target_name and \a link_name. -///\exception H5::FileIException or H5::GroupIException -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::link(const H5std_string &target_name, const H5std_string &link_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - link(target_name.c_str(), link_name.c_str(), lcpl, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::link -///\brief Creates a hard link from \a new_name to \a curr_name. -///\param curr_name - IN: Name of the existing object -///\param new_loc - IN: New group or root group -///\param new_name - IN: New name for the object -///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT -///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT -///\exception H5::FileIException or H5::GroupIException -///\par Description -/// Note that both names are interpreted relative to the -/// specified location. -/// For information on creating a hard link, please refer to the -/// H5Lcreate_hard APIs in the HDF5 C Reference Manual. -// March 2018 -//-------------------------------------------------------------------------- -void -H5Location::link(const char *curr_name, const Group &new_loc, const char *new_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - herr_t ret_value = -1; - hid_t new_loc_id = new_loc.getId(); - hid_t lcpl_id = lcpl.getId(); - hid_t lapl_id = lapl.getId(); - - ret_value = H5Lcreate_hard(getId(), curr_name, new_loc_id, new_name, lcpl_id, lapl_id); - if (ret_value < 0) - throwException("link", "creating link failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::link -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a curr_name and \a new_name. -///\exception H5::FileIException or H5::GroupIException -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::link(const H5std_string &curr_name, const Group &new_loc, const H5std_string &new_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - link(curr_name.c_str(), new_loc, new_name.c_str(), lcpl, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::link -///\brief Creates a hard link from \a new_name to \a curr_name - can be -/// used to pass in H5L_SAME_LOC. -///\param curr_name - IN: Name of the existing object -///\param loc_id - IN: Group or root group ID, or H5L_SAME_LOC -///\param new_name - IN: New name for the link -///\param lcpl - IN: Link creation plist - default to LinkCreatPropList::DEFAULT -///\param lapl - IN: Link access plist - default to LinkAccPropList::DEFAULT -///\exception H5::FileIException or H5::GroupIException -///\par Description -/// Note that both names are interpreted relative to the -/// specified location. -/// For information on creating a hard link, please refer to the -/// H5Lcreate_hard APIs in the HDF5 C Reference Manual. -// March 2018 -//-------------------------------------------------------------------------- -void -H5Location::link(const char *curr_name, const hid_t same_loc, const char *new_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - herr_t ret_value = -1; - hid_t lcpl_id = lcpl.getId(); - hid_t lapl_id = lapl.getId(); - - ret_value = H5Lcreate_hard(getId(), curr_name, same_loc, new_name, lcpl_id, lapl_id); - - if (ret_value < 0) - throwException("link", "creating link failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::link -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a curr_name and \a new_name. -///\exception H5::FileIException or H5::GroupIException -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::link(const H5std_string &curr_name, const hid_t same_loc, const H5std_string &new_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - link(curr_name.c_str(), same_loc, new_name.c_str(), lcpl, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::link -///\brief Creates a link of the specified type from \a new_name to -/// \a curr_name. -///\param link_type - IN: Link type; possible values are -/// \li \c H5G_LINK_HARD -/// \li \c H5G_LINK_SOFT -///\param curr_name - IN: Name of the existing object if link is a hard -/// link; can be anything for the soft link -///\param new_name - IN: New name for the object -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -///\par Description -/// Note that both names are interpreted relative to the -/// specified location. -/// For information on creating hard link and soft link, please -/// refer to the H5Lcreate_hard and H5Lcreate_soft APIs in the -/// HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// 2007: QAK modified to use H5L APIs - BMR -// Mar 2018: Inadequate functionality, new hard link is only in -// H5L_SAME_LOC. This function will be retired in favor of -// its replacement. - BMR -//-------------------------------------------------------------------------- -void -H5Location::link(H5L_type_t link_type, const char *curr_name, const char *new_name) const -{ - herr_t ret_value = -1; - - switch (link_type) { - case H5L_TYPE_HARD: - ret_value = H5Lcreate_hard(getId(), curr_name, H5L_SAME_LOC, new_name, H5P_DEFAULT, H5P_DEFAULT); - break; - - case H5L_TYPE_SOFT: - ret_value = H5Lcreate_soft(curr_name, getId(), new_name, H5P_DEFAULT, H5P_DEFAULT); - break; - - case H5L_TYPE_ERROR: - case H5L_TYPE_EXTERNAL: - case H5L_TYPE_MAX: - default: - throwException("link", "unknown link type"); - break; - } /* end switch */ - - if (ret_value < 0) - throwException("link", "creating link failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::link -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a curr_name and \a new_name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Location::link(H5L_type_t link_type, const H5std_string &curr_name, const H5std_string &new_name) const -{ - link(link_type, curr_name.c_str(), new_name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::copyLink -///\brief Copies a link from one group to another. -///\param src_name - IN: Original name -///\param dst - IN: Destination location -///\param dst_name - IN: New name -///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT -///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT -///\exception H5::FileIException or H5::GroupIException -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::copyLink(const char *src_name, const Group &dst, const char *dst_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - herr_t ret_value; - hid_t dst_id = dst.getId(); - hid_t lcpl_id = lcpl.getId(); - hid_t lapl_id = lapl.getId(); - - ret_value = H5Lcopy(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id); - if (ret_value < 0) - throwException("copyLink", "H5Lcopy failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::copyLink -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a src_name and \a dst_name. -///\exception H5::FileIException or H5::GroupIException -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::copyLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - copyLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::copyLink -///\brief Copies a link from a group in the same location. -///\param src_name - IN: Original name -///\param dst_name - IN: New name -///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT -///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT -///\exception H5::FileIException or H5::GroupIException -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::copyLink(const char *src_name, const char *dst_name, const LinkCreatPropList &lcpl, - const LinkAccPropList &lapl) const -{ - herr_t ret_value; - hid_t lcpl_id = lcpl.getId(); - hid_t lapl_id = lapl.getId(); - - ret_value = H5Lcopy(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id); - if (ret_value < 0) - throwException("copyLink", "H5Lcopy H5L_SAME_LOC failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::copyLink -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a src_name and \a dst_name. -///\exception H5::FileIException or H5::GroupIException -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::copyLink(const H5std_string &src_name, const H5std_string &dst_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - copyLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::moveLink -///\brief Renames a link in this group and moves it to a new location. -///\param src_name - IN: Original name -///\param dst - IN: Destination location -///\param dst_name - IN: New name -///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT -///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT -///\exception H5::FileIException or H5::GroupIException -///\note -/// Exercise care in moving groups as it is possible to render -/// data in a file inaccessible with H5Location::moveLink. Please refer -/// to the Group Interface in the HDF5 User's Guide for details. -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::moveLink(const char *src_name, const Group &dst, const char *dst_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - herr_t ret_value; - hid_t dst_id = dst.getId(); - hid_t lcpl_id = lcpl.getId(); - hid_t lapl_id = lapl.getId(); - - ret_value = H5Lmove(getId(), src_name, dst_id, dst_name, lcpl_id, lapl_id); - if (ret_value < 0) - throwException("moveLink", "H5Lmove failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::moveLink -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a src_name and \a dst_name. -///\exception H5::FileIException or H5::GroupIException -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::moveLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - moveLink(src_name.c_str(), dst, dst_name.c_str(), lcpl, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::moveLink -///\brief Renames a link in this group. -///\param src_name - IN: Original name -///\param dst_name - IN: New name -///\param lcpl - IN: Link creation plist - default LinkCreatPropList::DEFAULT -///\param lapl - IN: Link access plist - default LinkAccPropList::DEFAULT -///\exception H5::FileIException or H5::GroupIException -///\note -/// Exercise care in moving groups as it is possible to render -/// data in a file inaccessible with H5Location::moveLink. Please refer -/// to the Group Interface in the HDF5 User's Guide for details. -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::moveLink(const char *src_name, const char *dst_name, const LinkCreatPropList &lcpl, - const LinkAccPropList &lapl) const -{ - herr_t ret_value; - hid_t lcpl_id = lcpl.getId(); - hid_t lapl_id = lapl.getId(); - - ret_value = H5Lmove(getId(), src_name, H5L_SAME_LOC, dst_name, lcpl_id, lapl_id); - if (ret_value < 0) - throwException("moveLink", "H5Lmove H5L_SAME_LOC failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::moveLink -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a src_name and \a dst_name. -///\exception H5::FileIException or H5::GroupIException -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::moveLink(const H5std_string &src_name, const H5std_string &dst_name, - const LinkCreatPropList &lcpl, const LinkAccPropList &lapl) const -{ - moveLink(src_name.c_str(), dst_name.c_str(), lcpl, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::move -///\brief Renames an object at this location. - Deprecated due to inadequate functionality -///\param src - IN: Object's original name -///\param dst - IN: Object's new name -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -///\note -/// Exercise care in moving groups as it is possible to render -/// data in a file inaccessible with H5Location::move. Please refer -/// to the Group Interface in the HDF5 User's Guide for details. -// Modification -// 2007: QAK modified to use H5L APIs - BMR -// 2018: Will be replaced by H5Location::moveLink() -BMR -//-------------------------------------------------------------------------- -void -H5Location::move(const char *src, const char *dst) const -{ - moveLink(src, dst, LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::move -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a src and \a dst. - Deprecated due to inadequate functionality -// Modification -// 2018: Will be replaced by H5Location::moveLink() -BMR -//-------------------------------------------------------------------------- -void -H5Location::move(const H5std_string &src, const H5std_string &dst) const -{ - moveLink(src.c_str(), dst.c_str(), LinkCreatPropList::DEFAULT, LinkAccPropList::DEFAULT); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::unlink -///\brief Removes the specified link from this group. -///\param name - IN: Name of the object to be removed -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::unlink(const char *name, const LinkAccPropList &lapl) const -{ - herr_t ret_value = H5Ldelete(getId(), name, lapl.getId()); - if (ret_value < 0) - throwException("unlink", "H5Ldelete failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::unlink -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// March, 2018 -//-------------------------------------------------------------------------- -void -H5Location::unlink(const H5std_string &name, const LinkAccPropList &lapl) const -{ - unlink(name.c_str(), lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getNativeObjinfo -///\brief Retrieves native information about an HDF5 object. -///\param objinfo - OUT: Struct containing the native object info -///\param fields - IN: Indicates the group of information to be retrieved -///\par Description -/// Valid values of \a fields are as follows: -/// \li \c H5O_INFO_HDR (default) -/// \li \c H5O_INFO_META_SIZE -/// \li \c H5O_INFO_ALL -// July, 2018 -//-------------------------------------------------------------------------- -void -H5Location::getNativeObjinfo(H5O_native_info_t &objinfo, unsigned fields) const -{ - - // Use C API to get information of the object - herr_t ret_value = H5Oget_native_info(getId(), &objinfo, fields); - - // Throw exception if C API returns failure - if (ret_value < 0) - throwException(inMemFunc("getNativeObjinfo"), "H5Oget_native_info failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getNativeObjinfo -///\brief Retrieves native information about an HDF5 object given its name. -///\param name - IN: Name of the object to be queried - \c char * -///\param objinfo - OUT: Struct containing the native object info -///\param fields - IN: Indicates the group of information to be retrieved -/// - default to H5O_INFO_HDR -///\param lapl - IN: Link access property list -///\par Description -/// Valid values of \a fields are as follows: -/// \li \c H5O_INFO_HDR (default) -/// \li \c H5O_INFO_META_SIZE -/// \li \c H5O_INFO_ALL -// July, 2018 -//-------------------------------------------------------------------------- -void -H5Location::getNativeObjinfo(const char *name, H5O_native_info_t &objinfo, unsigned fields, - const LinkAccPropList &lapl) const -{ - // Use C API to get information of the object - herr_t ret_value = H5Oget_native_info_by_name(getId(), name, &objinfo, fields, lapl.getId()); - - // Throw exception if C API returns failure - if (ret_value < 0) - throwException(inMemFunc("getNativeObjinfo"), "H5Oget_native_info_by_name failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getNativeObjinfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -///\param name - IN: Name of the object to be queried - \c H5std_string -///\param objinfo - OUT: Struct containing the native object info -///\param fields - IN: Indicates the group of information to be retrieved -/// - default to H5O_INFO_HDR -///\param lapl - IN: Link access property list -// July, 2018 -//-------------------------------------------------------------------------- -void -H5Location::getNativeObjinfo(const H5std_string &name, H5O_native_info_t &objinfo, unsigned fields, - const LinkAccPropList &lapl) const -{ - getNativeObjinfo(name.c_str(), objinfo, fields, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getNativeObjinfo -///\brief Retrieves native information about an HDF5 object given its index. -///\param grp_name - IN: Group name where the object belongs - \c char * -///\param idx_type - IN: Type of index -///\param order - IN: Order to traverse -///\param idx - IN: Object position -///\param objinfo - OUT: Struct containing the native object info -///\param fields - IN: Indicates the group of information to be retrieved -/// - default to H5O_INFO_HDR -///\param lapl - IN: Link access property list -///\par Description -/// Valid values of \a fields are as follows: -/// \li \c H5O_INFO_HDR (default) -/// \li \c H5O_INFO_META_SIZE -/// \li \c H5O_INFO_ALL -// July, 2018 -//-------------------------------------------------------------------------- -void -H5Location::getNativeObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, - H5O_native_info_t &objinfo, unsigned fields, const LinkAccPropList &lapl) const -{ - // Use C API to get information of the object - herr_t ret_value = - H5Oget_native_info_by_idx(getId(), grp_name, idx_type, order, idx, &objinfo, fields, lapl.getId()); - - // Throw exception if C API returns failure - if (ret_value < 0) - throwException(inMemFunc("getNativeObjinfo"), "H5Oget_native_info_by_idx failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -///\param name - IN: Name of the object to be queried - \c H5std_string -///\param objinfo - OUT: Struct containing the native object info -///\param fields - IN: Indicates a group of information to be retrieved -/// - default to H5O_INFO_HDR -///\param lapl - IN: Link access property list -// July, 2018 -//-------------------------------------------------------------------------- -void -H5Location::getNativeObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, - hsize_t idx, H5O_native_info_t &objinfo, unsigned fields, - const LinkAccPropList &lapl) const -{ - getNativeObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief Retrieves information about an HDF5 object. -///\param objinfo - OUT: Struct containing the object info -///\param fields - IN: Indicates the group of information to be retrieved -///\par Description -/// Valid values of \a fields are as follows: -/// \li \c H5O_INFO_BASIC (default) -/// \li \c H5O_INFO_TIME -/// \li \c H5O_INFO_NUM_ATTRS -/// \li \c H5O_INFO_HDR -/// \li \c H5O_INFO_META_SIZE -/// \li \c H5O_INFO_ALL -// July, 2018 -//-------------------------------------------------------------------------- -void -H5Location::getObjinfo(H5O_info2_t &objinfo, unsigned fields) const -{ - - // Use C API to get information of the object - herr_t ret_value = H5Oget_info3(getId(), &objinfo, fields); - - // Throw exception if C API returns failure - if (ret_value < 0) - throwException(inMemFunc("getObjinfo"), "H5Oget_info3 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief Retrieves information about an HDF5 object given its name. -///\param name - IN: Name of the object to be queried - \c char * -///\param objinfo - OUT: Struct containing the object info -///\param fields - IN: Indicates the group of information to be retrieved -/// - default to H5O_INFO_BASIC -///\param lapl - IN: Link access property list -///\par Description -/// Valid values of \a fields are as follows: -/// \li \c H5O_INFO_BASIC (default) -/// \li \c H5O_INFO_TIME -/// \li \c H5O_INFO_NUM_ATTRS -/// \li \c H5O_INFO_HDR -/// \li \c H5O_INFO_META_SIZE -/// \li \c H5O_INFO_ALL -// July, 2018 -//-------------------------------------------------------------------------- -void -H5Location::getObjinfo(const char *name, H5O_info2_t &objinfo, unsigned fields, - const LinkAccPropList &lapl) const -{ - // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_name3(getId(), name, &objinfo, fields, lapl.getId()); - - // Throw exception if C API returns failure - if (ret_value < 0) - throwException(inMemFunc("getObjinfo"), "H5Oget_info_by_name2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -///\param name - IN: Name of the object to be queried - \c H5std_string -///\param objinfo - OUT: Struct containing the object info -///\param fields - IN: Indicates the group of information to be retrieved -/// - default to H5O_INFO_BASIC -///\param lapl - IN: Link access property list -// July, 2018 -//-------------------------------------------------------------------------- -void -H5Location::getObjinfo(const H5std_string &name, H5O_info2_t &objinfo, unsigned fields, - const LinkAccPropList &lapl) const -{ - getObjinfo(name.c_str(), objinfo, fields, lapl); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief Retrieves information about an HDF5 object given its index. -///\param grp_name - IN: Group name where the object belongs - \c char * -///\param idx_type - IN: Type of index -///\param order - IN: Order to traverse -///\param idx - IN: Object position -///\param objinfo - OUT: Struct containing the object info -///\param fields - IN: Indicates the group of information to be retrieved -/// - default to H5O_INFO_BASIC -///\param lapl - IN: Link access property list -///\par Description -/// Valid values of \a fields are as follows: -/// \li \c H5O_INFO_BASIC (default) -/// \li \c H5O_INFO_TIME -/// \li \c H5O_INFO_NUM_ATTRS -/// \li \c H5O_INFO_HDR -/// \li \c H5O_INFO_META_SIZE -/// \li \c H5O_INFO_ALL -// July, 2018 -//-------------------------------------------------------------------------- -void -H5Location::getObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, - H5O_info2_t &objinfo, unsigned fields, const LinkAccPropList &lapl) const -{ - // Use C API to get information of the object - herr_t ret_value = - H5Oget_info_by_idx3(getId(), grp_name, idx_type, order, idx, &objinfo, fields, lapl.getId()); - - // Throw exception if C API returns failure - if (ret_value < 0) - throwException(inMemFunc("getObjinfo"), "H5Oget_info_by_idx2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -///\param name - IN: Name of the object to be queried - \c H5std_string -///\param objinfo - OUT: Struct containing the object info -///\param fields - IN: Indicates a group of information to be retrieved -/// - default to H5O_INFO_BASIC -///\param lapl - IN: Link access property list -// July, 2018 -//-------------------------------------------------------------------------- -void -H5Location::getObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, - H5O_info2_t &objinfo, unsigned fields, const LinkAccPropList &lapl) const -{ - getObjinfo(grp_name.c_str(), idx_type, order, idx, objinfo, fields, lapl); -} - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief Returns information about an object. -///\param name - IN: Name of the object -///\param follow_link - IN: Link flag -///\param statbuf - OUT: Buffer to return information about the object -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -///\par Description -/// For information, please refer to the H5Gget_objinfo API in -/// the HDF5 C Reference Manual. -// 2000 -//-------------------------------------------------------------------------- -void -H5Location::getObjinfo(const char *name, hbool_t follow_link, H5G_stat_t &statbuf) const -{ - herr_t ret_value = H5Gget_objinfo(getId(), name, follow_link, &statbuf); - if (ret_value < 0) - throwException("getObjinfo", "H5Gget_objinfo failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Location::getObjinfo(const H5std_string &name, hbool_t follow_link, H5G_stat_t &statbuf) const -{ - getObjinfo(name.c_str(), follow_link, statbuf); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above functions in that it doesn't have -/// the parameter \a follow_link. -// Nov, 2005 -//-------------------------------------------------------------------------- -void -H5Location::getObjinfo(const char *name, H5G_stat_t &statbuf) const -{ - herr_t ret_value = H5Gget_objinfo(getId(), name, 0, &statbuf); - if (ret_value < 0) - throwException("getObjinfo", "H5Gget_objinfo failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjinfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - Nov, 2005 -//-------------------------------------------------------------------------- -void -H5Location::getObjinfo(const H5std_string &name, H5G_stat_t &statbuf) const -{ - getObjinfo(name.c_str(), statbuf); -} - -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: H5Location::getLinkInfo -///\brief Returns the information of the named link. -///\param link_name - IN: Symbolic link to the object -///\param size - IN: Maximum number of characters of value to be returned -///\return Name of the object -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// 2000 -//-------------------------------------------------------------------------- -H5L_info2_t -H5Location::getLinkInfo(const char *link_name, const LinkAccPropList &lapl) const -{ - H5L_info2_t linkinfo; // link info structure - - herr_t ret_value = H5Lget_info2(getId(), link_name, &linkinfo, lapl.getId()); - if (ret_value < 0) - throwException("getLinkInfo", "H5Lget_info to find buffer size failed"); - - return (linkinfo); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getLinkInfo -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a link_name. -//-------------------------------------------------------------------------- -H5L_info2_t -H5Location::getLinkInfo(const H5std_string &link_name, const LinkAccPropList &lapl) const -{ - return (getLinkInfo(link_name.c_str(), lapl)); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getLinkval -///\brief Returns the name of the object that the symbolic link points to. -///\param name - IN: Symbolic link to the object -///\param size - IN: Maximum number of characters of value to be returned -///\return Name of the object -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// 2000 -//-------------------------------------------------------------------------- -H5std_string -H5Location::getLinkval(const char *name, size_t size) const -{ - H5L_info2_t linkinfo; - char *value_C; // value in C string - size_t val_size = size; - H5std_string value; - herr_t ret_value; - - // if user doesn't provide buffer size, determine it - if (size == 0) { - ret_value = H5Lget_info2(getId(), name, &linkinfo, H5P_DEFAULT); - if (ret_value < 0) - throwException("getLinkval", "H5Lget_info to find buffer size failed"); - - val_size = linkinfo.u.val_size; - } - - // if link has value, retrieve the value, otherwise, return null string - if (val_size > 0) { - // Create buffer for C string - value_C = new char[val_size + 1](); - - ret_value = H5Lget_val(getId(), name, value_C, val_size, H5P_DEFAULT); - if (ret_value < 0) { - delete[] value_C; - throwException("getLinkval", "H5Lget_val failed"); - } - - value = H5std_string(value_C); - delete[] value_C; - } - return (value); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getLinkval -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5std_string -H5Location::getLinkval(const H5std_string &name, size_t size) const -{ - return (getLinkval(name.c_str(), size)); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::mount -///\brief Mounts the file \a child onto this group. -///\param name - IN: Name of the group -///\param child - IN: File to mount -///\param plist - IN: Property list to use -///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2014 (original 2000) -//-------------------------------------------------------------------------- -void -H5Location::mount(const char *name, const H5File &child, const PropList &plist) const -{ - // Obtain identifiers for C API - hid_t plist_id = plist.getId(); - hid_t child_id = child.getId(); - - // Call C routine H5Fmount to do the mouting - herr_t ret_value = H5Fmount(getId(), name, child_id, plist_id); - - // Raise exception if H5Fmount returns negative value - if (ret_value < 0) - throwException("mount", "H5Fmount failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::mount -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Param name - IN: Name of the group -// Param child - IN: File to mount -// Param plist - IN: Property list to use -// Exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -// Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 -//-------------------------------------------------------------------------- -// void H5Location::mount(const char* name, H5File& child, PropList& plist) const -//{ -// mount(name, child, plist); -//} - -//-------------------------------------------------------------------------- -// Function: H5Location::mount -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Location::mount(const H5std_string &name, const H5File &child, const PropList &plist) const -{ - mount(name.c_str(), child, plist); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::mount -// Purpose This is an overloaded member function, kept for backward -// compatibility. It differs from the above function in that it -// misses const's. This wrapper will be removed in future release. -// Programmer Binh-Minh Ribler - 2014 -// Modification -// Modified to call its replacement. -BMR, 2014/04/16 -// Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 -// Removed from code. -BMR, 2016/08/11 1.8.18 and 1.10.1 -//-------------------------------------------------------------------------- -// void H5Location::mount(const H5std_string& name, H5File& child, PropList& plist) const -//{ -// mount(name.c_str(), child, plist); -//} - -//-------------------------------------------------------------------------- -// Function: H5Location::unmount -///\brief Unmounts the specified file. -///\param name - IN: Name of the file to unmount -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Location::unmount(const char *name) const -{ - // Call C routine H5Fmount to do the mouting - herr_t ret_value = H5Funmount(getId(), name); - - // Raise exception if H5Funmount returns negative value - if (ret_value < 0) - throwException("unmount", "H5Funmount failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::unmount -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Location::unmount(const H5std_string &name) const -{ - unmount(name.c_str()); -} - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: H5Location::iterateElems -///\brief Iterates a user's function over the entries of a group. -///\param name - IN : Name of group to iterate over -///\param idx - IN/OUT: Starting (IN) and ending (OUT) entry indices -///\param op - IN : User's function to operate on each entry -///\param op_data - IN/OUT: Data associated with the operation -///\return The return value of the first operator that returns non-zero, -/// or zero if all members were processed with no operator -/// returning non-zero. -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -H5Location::iterateElems(const char *name, int *idx, H5G_iterate_t op, void *op_data) -{ - int ret_value = H5Giterate(getId(), name, idx, op, op_data); - if (ret_value < 0) { - throwException("iterateElems", "H5Giterate failed"); - } - return (ret_value); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::iterateElems -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -H5Location::iterateElems(const H5std_string &name, int *idx, H5G_iterate_t op, void *op_data) -{ - return (iterateElems(name.c_str(), idx, op, op_data)); -} -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: H5Location::getNumObjs -///\brief Deprecated - moved to H5::Group in 1.10.2. -///\return Deprecated -///\exception Deprecated -// Programmer Binh-Minh Ribler - January, 2003 -//-------------------------------------------------------------------------- -hsize_t -H5Location::getNumObjs() const -{ - H5G_info_t ginfo; // Group information - - herr_t ret_value = H5Gget_info(getId(), &ginfo); - if (ret_value < 0) - throwException("getNumObjs", "H5Gget_info failed"); - return (ginfo.nlinks); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjnameByIdx -///\brief Returns the name of an object in this group, given the -/// object's index. -///\param idx - IN: Transient index of the object -///\return Object name -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -///\par Description -/// The value of idx can be any nonnegative number less than the -/// total number of objects in the group, which is returned by -/// the function \c H5Location::getNumObjs. Note that this is a -/// transient index; thus, an object may have a different index -/// each time the group is opened. -// Programmer Binh-Minh Ribler - Mar, 2005 -//-------------------------------------------------------------------------- -H5std_string -H5Location::getObjnameByIdx(hsize_t idx) const -{ - // call H5Lget_name_by_idx with name as NULL to get its length - ssize_t name_len = - H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, NULL, 0, H5P_DEFAULT); - if (name_len < 0) - throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - - // The actual size is the cast value + 1 for the terminal ASCII NUL - // (unfortunate in/out type sign mismatch) - size_t actual_name_len = static_cast(name_len) + 1; - - // Create buffer for C string - char *name_C = new char[actual_name_len](); - - name_len = H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name_C, actual_name_len, - H5P_DEFAULT); - - if (name_len < 0) { - delete[] name_C; - throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - } - - // clean up and return the string - H5std_string name = H5std_string(name_C); - delete[] name_C; - return (name); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjnameByIdx -///\brief Retrieves the name of an object in this group, given the -/// object's index. -///\param idx - IN: Transient index of the object -///\param name - IN/OUT: Retrieved name of the object -///\param size - IN: Length to retrieve -///\return Actual size of the object name or 0, if object has no name -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -///\par Description -/// The value of idx can be any nonnegative number less than the -/// total number of objects in the group, which is returned by -/// the function \c H5Location::getNumObjs. Note that this is a -/// transient index; thus, an object may have a different index -/// each time the group is opened. -// Programmer Binh-Minh Ribler - January, 2003 -//-------------------------------------------------------------------------- -ssize_t -H5Location::getObjnameByIdx(hsize_t idx, char *name, size_t size) const -{ - ssize_t name_len = - H5Lget_name_by_idx(getId(), ".", H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5P_DEFAULT); - if (name_len < 0) - throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - - return (name_len); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjnameByIdx -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes an -/// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - January, 2003 -//-------------------------------------------------------------------------- -ssize_t -H5Location::getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const -{ - // Create buffer for C string - char *name_C = new char[size + 1](); - - // call overloaded function to get the name - ssize_t name_len = getObjnameByIdx(idx, name_C, size + 1); - if (name_len < 0) { - delete[] name_C; - throwException("getObjnameByIdx", "H5Lget_name_by_idx failed"); - } - - // clean up and return the string - name = H5std_string(name_C); - delete[] name_C; - return (name_len); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::childObjType -///\brief Returns the type of an object in this file/group, given the -/// object's name. -///\param objname - IN: Name of the object -///\return Object type, which can have the following values for group, -/// dataset, and named datatype -/// \li \c H5O_TYPE_GROUP -/// \li \c H5O_TYPE_DATASET -/// \li \c H5O_TYPE_NAMED_DATATYPE -/// For information, please refer to the H5Oget_info_by_name API in -/// the HDF5 C Reference Manual. -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -/// Exception will be thrown when: -/// - an error returned by the C API -/// - object type is not one of the valid values above -// Programmer Binh-Minh Ribler - April, 2014 -//-------------------------------------------------------------------------- -H5O_type_t -H5Location::childObjType(const char *objname) const -{ - H5O_info2_t objinfo; - H5O_type_t objtype = H5O_TYPE_UNKNOWN; - - // Use C API to get information of the object - herr_t ret_value = H5Oget_info_by_name3(getId(), objname, &objinfo, H5O_INFO_BASIC, H5P_DEFAULT); - - // Throw exception if C API returns failure - if (ret_value < 0) - throwException("childObjType", "H5Oget_info_by_name failed"); - // Return a valid type or throw an exception for unknown type - else - switch (objinfo.type) { - case H5O_TYPE_GROUP: - case H5O_TYPE_DATASET: - case H5O_TYPE_NAMED_DATATYPE: - objtype = objinfo.type; - break; - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - case H5O_TYPE_MAP: - default: - throwException("childObjType", "Unknown type of object"); - } - return (objtype); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::childObjType -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \a H5std_string for the object's name. -///\brief Returns the type of an object in this group, given the -/// object's name. -///\param objname - IN: Name of the object (H5std_string&) -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - April, 2014 -//-------------------------------------------------------------------------- -H5O_type_t -H5Location::childObjType(const H5std_string &objname) const -{ - // Use overloaded function - H5O_type_t objtype = childObjType(objname.c_str()); - return (objtype); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::childObjType -///\brief Returns the type of an object in this file/group, given the -/// object's index and its type and order. -///\param index - IN: Position of the object -///\param index_type - IN: Type of the index, default to H5_INDEX_NAME -///\param order - IN: Traversing order, default to H5_ITER_INC -///\param objname - IN: Name of the object, default to "." -///\return Object type, which can have the following values for group, -/// dataset, and named datatype -/// \li \c H5O_TYPE_GROUP -/// \li \c H5O_TYPE_DATASET -/// \li \c H5O_TYPE_NAMED_DATATYPE -/// For information, please refer to the H5Oget_info_by_idx API in -/// the HDF5 C Reference Manual. -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -/// Exception will be thrown when: -/// - an error returned by the C API -/// - object type is not one of the valid values above -// Developer's Notes: -// - this overload uses H5Oget_info_by_idx instead of H5Oget_info_by_name -// like the previous childObjType() -// - index is the required argument so, first -// - objname is last because it's more likely the location is already -// fully specified -// - Leave property list out for now because C API is not using it, it -// can be added later when needed. -// Programmer Binh-Minh Ribler - April, 2014 -//-------------------------------------------------------------------------- -H5O_type_t -H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, - const char *objname) const -{ - herr_t ret_value; - H5O_info2_t objinfo; - H5O_type_t objtype = H5O_TYPE_UNKNOWN; - - // Use C API to get information of the object - ret_value = H5Oget_info_by_idx3(getId(), objname, index_type, order, index, &objinfo, H5O_INFO_BASIC, - H5P_DEFAULT); - - // Throw exception if C API returns failure - if (ret_value < 0) - throwException("childObjType", "H5Oget_info_by_idx failed"); - // Return a valid type or throw an exception for unknown type - else - switch (objinfo.type) { - case H5O_TYPE_GROUP: - case H5O_TYPE_DATASET: - case H5O_TYPE_NAMED_DATATYPE: - objtype = objinfo.type; - break; - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - case H5O_TYPE_MAP: - default: - throwException("childObjType", "Unknown type of object"); - } - return (objtype); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::childObjVersion -///\brief Returns the object header version of an object in this file/group, -/// given the object's name. -///\param objname - IN: Name of the object -///\return Object version, which can have the following values: -/// \li \c H5O_VERSION_1 -/// \li \c H5O_VERSION_2 -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -/// Exception will be thrown when: -/// - an error returned by the C API -/// - version number is not one of the valid values above -// Programmer Binh-Minh Ribler - April, 2014 -//-------------------------------------------------------------------------- -unsigned -H5Location::childObjVersion(const char *objname) const -{ - H5O_native_info_t objinfo; - unsigned version = 0; - - // Use C API to get information of the object - herr_t ret_value = - H5Oget_native_info_by_name(getId(), objname, &objinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT); - - // Throw exception if C API returns failure - if (ret_value < 0) - throwException("childObjVersion", "H5Oget_info_by_name failed"); - // Return a valid version or throw an exception for invalid value - else { - version = objinfo.hdr.version; - if (version != H5O_VERSION_1 && version != H5O_VERSION_2) - throwException("childObjVersion", "Invalid version for object"); - } - return (version); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::childObjVersion -///\brief This is an overloaded member function, provided for convenience. -/// It takes an \a H5std_string for the object's name. -///\brief Returns the type of an object in this group, given the -/// object's name. -///\param objname - IN: Name of the object (H5std_string&) -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - April, 2014 -//-------------------------------------------------------------------------- -unsigned -H5Location::childObjVersion(const H5std_string &objname) const -{ - // Use overloaded function - unsigned version = childObjVersion(objname.c_str()); - return (version); -} - -#ifndef H5_NO_DEPRECATED_SYMBOLS -//-------------------------------------------------------------------------- -// Function: H5Location::getObjTypeByIdx -///\brief Returns the type of an object in this group, given the -/// object's index. -///\param idx - IN: Transient index of the object -///\return Object type -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - January, 2003 -//-------------------------------------------------------------------------- -H5G_obj_t -H5Location::getObjTypeByIdx(hsize_t idx) const -{ - H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx); - if (obj_type == H5G_UNKNOWN) - throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - - return (obj_type); -} - -//-------------------------------------------------------------------------- -// Function: H5Location::getObjTypeByIdx -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function because it also provides -/// the returned object type in text (char*) -///\param idx - IN: Transient index of the object -///\param type_name - OUT: Object type in text -///\return Object type -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - May, 2010 -// Modification -// Modified to use the other function. -BMR, 2016/03/07 -//-------------------------------------------------------------------------- -H5G_obj_t -H5Location::getObjTypeByIdx(hsize_t idx, char *type_name) const -{ - H5std_string stype_name(type_name); - return (getObjTypeByIdx(idx, stype_name)); -} -//-------------------------------------------------------------------------- -// Function: H5Location::getObjTypeByIdx -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function because it also provides -/// the returned object type in text (H5std_string&) -///\param idx - IN: Transient index of the object -///\param type_name - OUT: Object type in text -///\return Object type -///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - January, 2003 -//-------------------------------------------------------------------------- -H5G_obj_t -H5Location::getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const -{ - H5G_obj_t obj_type = H5Gget_objtype_by_idx(getId(), idx); - switch (obj_type) { - case H5G_LINK: - type_name = H5std_string("symbolic link"); - break; - case H5G_GROUP: - type_name = H5std_string("group"); - break; - case H5G_DATASET: - type_name = H5std_string("dataset"); - break; - case H5G_TYPE: - type_name = H5std_string("datatype"); - break; - case H5G_UNKNOWN: - case H5G_UDLINK: - case H5G_RESERVED_5: - case H5G_RESERVED_6: - case H5G_RESERVED_7: - default: - throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } - return (obj_type); -} - -#endif /* H5_NO_DEPRECATED_SYMBOLS */ - -//-------------------------------------------------------------------------- -// Function: H5Location::throwException -///\brief Invokes subclass' throwException -///\param func_name - Name of the function where failure occurs -///\param msg - Message describing the failure -///\exception H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 -// Modification -// August 2017 - BMR -// Keep H5Location::throwException and H5File::throwException to -// maintain backward compatibility. For other subclasses, throw -// LocationException. -//-------------------------------------------------------------------------- -void -H5Location::throwException(const H5std_string &func_name, const H5std_string &msg) const -{ - throw LocationException(inMemFunc(func_name.c_str()), msg); -} - -//-------------------------------------------------------------------------- -// Function: f_DataSet_setId - friend -// Modification: -// Moved to H5CommonFG.cpp after the rearrangement of classes -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- - -// end of From H5CommonFG.cpp - -//-------------------------------------------------------------------------- -// Function: f_Attribute_setId - friend -// Modification: -// Moved to H5Object.cpp after the rearrangement of classes -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- - -//-------------------------------------------------------------------------- -// Function: f_DataSpace_setId - friend -// Purpose This function is friend to class H5::DataSpace so that it can -// can set DataSpace::id in order to work around a problem -// described in the JIRA issue HDFFV-7947. -// Applications shouldn't need to use it. -// param dspace - IN/OUT: DataSpace object to be changed -// param new_id - IN: New id to set -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -f_DataSpace_setId(DataSpace *dspace, hid_t new_id) -{ - dspace->p_setId(new_id); -} - -//-------------------------------------------------------------------------- -// Function: H5Location destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5Location::~H5Location() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5M.c b/externals/coda-oss/modules/drivers/hdf5/source/H5M.c index 624a81d960..cb8f7717f4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5M.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5M.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -93,7 +92,7 @@ H5M_init(void) /* Initialize the ID group for the map IDs */ if (H5I_register_type(H5I_MAP_CLS) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, FAIL, "unable to initialize interface"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -145,7 +144,7 @@ H5M_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(0 == H5I_nmembers(H5I_MAP)); + assert(0 == H5I_nmembers(H5I_MAP)); /* Destroy the dataset object id group */ n += (H5I_dec_type_ref(H5I_MAP) > 0); @@ -171,7 +170,7 @@ H5M__close_cb(H5VL_object_t *map_vol_obj, void **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(map_vol_obj); + assert(map_vol_obj); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_MAP_CLOSE; @@ -218,26 +217,26 @@ H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t /* Check arguments */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string"); /* Get link creation property list */ if (H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "lcpl_id is not a link creation property list"); /* Get map creation property list */ if (H5P_DEFAULT == mcpl_id) mcpl_id = H5P_MAP_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(mcpl_id, H5P_MAP_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "mcpl_id is not a map create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "mcpl_id is not a map create property list ID"); /* Set up VOL callback arguments */ if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, TRUE, &mapl_id, vol_obj_ptr, &map_args.create.loc_params) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); map_args.create.name = name; map_args.create.lcpl_id = lcpl_id; map_args.create.key_type_id = key_type_id; @@ -250,12 +249,12 @@ H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t /* Create the map */ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map") + HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map"); map = map_args.create.map; /* Get an ID for the map */ if ((ret_value = H5VL_register(H5I_MAP, map, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register map handle") + HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register map handle"); done: /* Cleanup on failure */ @@ -265,7 +264,7 @@ H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t vol_cb_args.args = NULL; if (map && H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -300,7 +299,7 @@ H5Mcreate(hid_t loc_id, const char *name, hid_t key_type_id, hid_t val_type_id, /* Create the map synchronously */ if ((ret_value = H5M__create_api_common(loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create map synchronously") + HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create map synchronously"); done: FUNC_LEAVE_API(ret_value) @@ -338,7 +337,7 @@ H5Mcreate_async(const char *app_file, const char *app_func, unsigned app_line, h /* Create the map asynchronously */ if ((ret_value = H5M__create_api_common(loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create map asynchronously") + HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create map asynchronously"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -347,8 +346,8 @@ H5Mcreate_async(const char *app_file, const char *app_func, unsigned app_line, h H5ARG_TRACE11(__func__, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) - HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID") - HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID"); + HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -395,15 +394,15 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id if (H5P_DEFAULT == mcpl_id) mcpl_id = H5P_MAP_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(mcpl_id, H5P_MAP_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not map create property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not map create property list ID"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&mapl_id, H5P_CLS_MACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Set location parameters */ @@ -422,12 +421,12 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id /* Create the map */ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map") + HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map"); map = map_args.create.map; /* Get an ID for the map */ if ((ret_value = H5VL_register(H5I_MAP, map, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register map") + HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register map"); done: /* Cleanup on failure */ @@ -437,7 +436,7 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id vol_cb_args.args = NULL; if (map && H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map"); } /* end if */ FUNC_LEAVE_API(ret_value) @@ -470,14 +469,14 @@ H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token /* Check args */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string"); /* Set up VOL callback arguments */ if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, FALSE, &mapl_id, vol_obj_ptr, &map_args.open.loc_params) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); map_args.open.name = name; map_args.open.mapl_id = mapl_id; map_args.open.map = NULL; @@ -486,12 +485,12 @@ H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token /* Open the map */ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map") + HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map"); map = map_args.open.map; /* Register an ID for the map */ if ((ret_value = H5VL_register(H5I_MAP, map, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register map ID") + HGOTO_ERROR(H5E_MAP, H5E_CANTREGISTER, H5I_INVALID_HID, "can't register map ID"); done: /* Cleanup on failure */ @@ -501,7 +500,7 @@ H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token vol_cb_args.args = NULL; if (map && H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -532,7 +531,7 @@ H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id) /* Open the map synchronously */ if ((ret_value = H5M__open_api_common(loc_id, name, mapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to open map synchronously") + HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to open map synchronously"); done: FUNC_LEAVE_API(ret_value) @@ -567,7 +566,7 @@ H5Mopen_async(const char *app_file, const char *app_func, unsigned app_line, hid /* Open the map asynchronously */ if ((ret_value = H5M__open_api_common(loc_id, name, mapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to open map asynchronously") + HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to open map asynchronously"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -576,8 +575,8 @@ H5Mopen_async(const char *app_file, const char *app_func, unsigned app_line, hid H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, mapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) - HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID") - HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID"); + HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -605,13 +604,13 @@ H5Mclose(hid_t map_id) /* Check args */ if (H5I_MAP != H5I_get_type(map_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a map ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a map ID"); /* Decrement the counter on the map. It will be freed if the count * reaches zero. */ if (H5I_dec_app_ref_always_close(map_id) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement count on map ID") + HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement count on map ID"); done: FUNC_LEAVE_API(ret_value) @@ -640,11 +639,11 @@ H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hi /* Check args */ if (H5I_MAP != H5I_get_type(map_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a map ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a map ID"); /* Get map object's connector */ if (NULL == (vol_obj = H5VL_vol_object(map_id))) - HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "can't get VOL object for map") + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "can't get VOL object for map"); /* Prepare for possible asynchronous operation */ if (H5ES_NONE != es_id) { @@ -661,7 +660,7 @@ H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hi * reaches zero. */ if (H5I_dec_app_ref_always_close_async(map_id, token_ptr) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") + HGOTO_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -669,11 +668,11 @@ H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, map_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: if (connector && H5VL_conn_dec_rc(connector) < 0) - HDONE_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement ref count on connector") + HDONE_ERROR(H5E_MAP, H5E_CANTDEC, FAIL, "can't decrement ref count on connector"); FUNC_LEAVE_API(ret_value) } /* end H5Mclose_async() */ @@ -704,7 +703,7 @@ H5Mget_key_type(hid_t map_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier"); /* Set up VOL callback arguments */ map_args.get.get_type = H5VL_MAP_GET_KEY_TYPE; @@ -714,7 +713,7 @@ H5Mget_key_type(hid_t map_id) /* Get the key datatype */ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get key datatype") + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get key datatype"); /* Set return value */ ret_value = map_args.get.args.get_key_type.type_id; @@ -749,7 +748,7 @@ H5Mget_val_type(hid_t map_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier"); /* Set up VOL callback arguments */ map_args.get.get_type = H5VL_MAP_GET_VAL_TYPE; @@ -759,7 +758,7 @@ H5Mget_val_type(hid_t map_id) /* Get the value datatype */ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get value datatype") + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get value datatype"); /* Set return value */ ret_value = map_args.get.args.get_val_type.type_id; @@ -794,7 +793,7 @@ H5Mget_create_plist(hid_t map_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier"); /* Set up VOL callback arguments */ map_args.get.get_type = H5VL_MAP_GET_MCPL; @@ -804,7 +803,7 @@ H5Mget_create_plist(hid_t map_id) /* Get the map creation property list */ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map creation properties") + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map creation properties"); /* Set return value */ ret_value = map_args.get.args.get_mcpl.mcpl_id; @@ -842,7 +841,7 @@ H5Mget_access_plist(hid_t map_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier"); /* Set up VOL callback arguments */ map_args.get.get_type = H5VL_MAP_GET_MAPL; @@ -852,7 +851,7 @@ H5Mget_access_plist(hid_t map_id) /* Get the map access property list */ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties") + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties"); /* Set return value */ ret_value = map_args.get.args.get_mapl.mapl_id; @@ -886,13 +885,13 @@ H5Mget_count(hid_t map_id, hsize_t *count /*out*/, hid_t dxpl_id) /* Check args */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -905,7 +904,7 @@ H5Mget_count(hid_t map_id, hsize_t *count /*out*/, hid_t dxpl_id) /* Get the number of key-value pairs stored in the map */ if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get KV pair count for map") + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get KV pair count for map"); /* Set value to return */ if (count) @@ -939,19 +938,19 @@ H5M__put_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t /* Check arguments */ if (key_mem_type_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID"); if (val_mem_type_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value memory datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value memory datatype ID"); /* Get map pointer */ if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -966,7 +965,7 @@ H5M__put_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t /* Set the key/value pair */ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, dxpl_id, token_ptr) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to put key/value pair") + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to put key/value pair"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1000,7 +999,7 @@ H5Mput(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_ /* Add key-value pair to the map synchronously */ if ((ret_value = H5M__put_api_common(map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTPUT, FAIL, "unable to put value to map synchronously") + HGOTO_ERROR(H5E_MAP, H5E_CANTPUT, FAIL, "unable to put value to map synchronously"); done: FUNC_LEAVE_API(ret_value) @@ -1036,7 +1035,7 @@ H5Mput_async(const char *app_file, const char *app_func, unsigned app_line, hid_ /* Add key-value pair to the map asynchronously */ if ((ret_value = H5M__put_api_common(map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTPUT, FAIL, "unable to put value to map asynchronously") + HGOTO_ERROR(H5E_MAP, H5E_CANTPUT, FAIL, "unable to put value to map asynchronously"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1044,7 +1043,7 @@ H5Mput_async(const char *app_file, const char *app_func, unsigned app_line, hid_ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE10(__func__, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1074,19 +1073,19 @@ H5M__get_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t /* Check arguments */ if (key_mem_type_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID"); if (val_mem_type_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value memory datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value memory datatype ID"); /* Get map pointer */ if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -1101,7 +1100,7 @@ H5M__get_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t /* Get the value for the key */ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, dxpl_id, token_ptr) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map") + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1138,7 +1137,7 @@ H5Mget(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t val_mem_type_ /* Get key-value pair from the map synchronously */ if ((ret_value = H5M__get_api_common(map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map synchronously") + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map synchronously"); done: FUNC_LEAVE_API(ret_value) @@ -1174,7 +1173,7 @@ H5Mget_async(const char *app_file, const char *app_func, unsigned app_line, hid_ /* Get key-value pair from the map asynchronously */ if ((ret_value = H5M__get_api_common(map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map asynchronously") + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map asynchronously"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1182,7 +1181,7 @@ H5Mget_async(const char *app_file, const char *app_func, unsigned app_line, hid_ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE10(__func__, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1214,17 +1213,17 @@ H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, /* Check arguments */ if (key_mem_type_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID"); /* Get map pointer */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -1238,7 +1237,7 @@ H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, /* Check if key exists */ if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTGET, ret_value, "unable to check if key exists") + HGOTO_ERROR(H5E_MAP, H5E_CANTGET, ret_value, "unable to check if key exists"); /* Set value to return */ if (exists) @@ -1292,19 +1291,19 @@ H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, /* Check arguments */ if (key_mem_type_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified"); /* Get map pointer */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -1377,23 +1376,23 @@ H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_m /* Check arguments */ if (!map_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "map_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "map_name parameter cannot be NULL"); if (!*map_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "map_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "map_name parameter cannot be an empty string"); if (key_mem_type_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified"); /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -1451,17 +1450,17 @@ H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id) /* Check arguments */ if (key_mem_type_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid key memory datatype ID"); /* Get map pointer */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "map_id is not a map ID"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -1477,7 +1476,7 @@ H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id) /* Delete the key/value pair */ if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to delete key/value pair") + HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to delete key/value pair"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5MF.c b/externals/coda-oss/modules/drivers/hdf5/source/H5MF.c index 7755c8d171..2c9fb6dcc1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5MF.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5MF.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5MF.c - * Jul 11 1997 - * Robb Matzke * * Purpose: File memory management functions. * @@ -50,8 +47,8 @@ #define H5MF_CHECK_FSM(FSM, CF) \ do { \ - HDassert(*CF == FALSE); \ - if (!H5F_addr_defined(FSM->addr) || !H5F_addr_defined(FSM->sect_addr)) \ + assert(*CF == FALSE); \ + if (!H5_addr_defined(FSM->addr) || !H5_addr_defined(FSM->sect_addr)) \ *CF = TRUE; \ } while (0) @@ -131,9 +128,6 @@ static herr_t H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata); * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Friday, February 1, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -147,8 +141,8 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f_sh); - HDassert(f_sh->lf); + assert(f_sh); + assert(f_sh->lf); /* Iterate over all the free space types to determine if sections of that type * can merge with the metadata or small 'raw' data aggregator @@ -201,7 +195,7 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh) switch (mapping_type) { case H5MF_AGGR_MERGE_SEPARATE: /* Don't merge any metadata together */ - HDmemset(f_sh->fs_aggr_merge, 0, sizeof(f_sh->fs_aggr_merge)); + memset(f_sh->fs_aggr_merge, 0, sizeof(f_sh->fs_aggr_merge)); /* Check if merging raw data should be allowed */ /* (treat global heaps as raw data) */ @@ -214,7 +208,7 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh) case H5MF_AGGR_MERGE_DICHOTOMY: /* Merge all metadata together (but not raw data) */ - HDmemset(f_sh->fs_aggr_merge, H5F_FS_MERGE_METADATA, sizeof(f_sh->fs_aggr_merge)); + memset(f_sh->fs_aggr_merge, H5F_FS_MERGE_METADATA, sizeof(f_sh->fs_aggr_merge)); /* Allow merging raw data allocations together */ /* (treat global heaps as raw data) */ @@ -224,12 +218,12 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh) case H5MF_AGGR_MERGE_TOGETHER: /* Merge all allocation types together */ - HDmemset(f_sh->fs_aggr_merge, (H5F_FS_MERGE_METADATA | H5F_FS_MERGE_RAWDATA), - sizeof(f_sh->fs_aggr_merge)); + memset(f_sh->fs_aggr_merge, (H5F_FS_MERGE_METADATA | H5F_FS_MERGE_RAWDATA), + sizeof(f_sh->fs_aggr_merge)); break; default: - HGOTO_ERROR(H5E_RESOURCE, H5E_BADVALUE, FAIL, "invalid mapping type") + HGOTO_ERROR(H5E_RESOURCE, H5E_BADVALUE, FAIL, "invalid mapping type"); } /* end switch */ done: @@ -244,8 +238,6 @@ H5MF_init_merge_flags(H5F_shared_t *f_sh) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; Nov 2016 - * *------------------------------------------------------------------------- */ void @@ -254,8 +246,8 @@ H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f_sh); - HDassert(fs_type); + assert(f_sh); + assert(fs_type); if (H5F_SHARED_PAGED_AGGR(f_sh)) { /* paged aggregation */ if (size >= f_sh->fs_page_size) { @@ -290,9 +282,6 @@ H5MF__alloc_to_fs_type(H5F_shared_t *f_sh, H5FD_mem_t alloc_type, hsize_t size, * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Jan 8 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -312,16 +301,16 @@ H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type) /* * Check arguments. */ - HDassert(f); + assert(f); if (H5F_PAGED_AGGR(f)) - HDassert(type < H5F_MEM_PAGE_NTYPES); + assert(type < H5F_MEM_PAGE_NTYPES); else { - HDassert((H5FD_mem_t)type < H5FD_MEM_NTYPES); - HDassert((H5FD_mem_t)type != H5FD_MEM_NOLIST); + assert((H5FD_mem_t)type < H5FD_MEM_NTYPES); + assert((H5FD_mem_t)type != H5FD_MEM_NOLIST); } /* end else */ - HDassert(f->shared); - HDassert(H5F_addr_defined(f->shared->fs_addr[type])); - HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); + assert(f->shared); + assert(H5_addr_defined(f->shared->fs_addr[type])); + assert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); /* Set up the alignment and threshold to use depending on the manager type */ if (H5F_PAGED_AGGR(f)) { @@ -343,7 +332,7 @@ H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type) /* Open an existing free space structure for the file */ if (NULL == (f->shared->fs_man[type] = H5FS_open(f, f->shared->fs_addr[type], NELMTS(classes), classes, f, alignment, threshold))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info"); /* Set the state for the free space manager to "open", if it is now */ if (f->shared->fs_man[type]) @@ -367,9 +356,6 @@ H5MF__open_fstype(H5F_t *f, H5F_mem_page_t type) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Jan 8 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -390,16 +376,16 @@ H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type) /* * Check arguments. */ - HDassert(f); + assert(f); if (H5F_PAGED_AGGR(f)) - HDassert(type < H5F_MEM_PAGE_NTYPES); + assert(type < H5F_MEM_PAGE_NTYPES); else { - HDassert((H5FD_mem_t)type < H5FD_MEM_NTYPES); - HDassert((H5FD_mem_t)type != H5FD_MEM_NOLIST); + assert((H5FD_mem_t)type < H5FD_MEM_NTYPES); + assert((H5FD_mem_t)type != H5FD_MEM_NOLIST); } /* end else */ - HDassert(f->shared); - HDassert(!H5F_addr_defined(f->shared->fs_addr[type])); - HDassert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); + assert(f->shared); + assert(!H5_addr_defined(f->shared->fs_addr[type])); + assert(f->shared->fs_state[type] == H5F_FS_STATE_CLOSED); /* Set the free space creation parameters */ fs_create.client = H5FS_CLIENT_FILE_ID; @@ -427,7 +413,7 @@ H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type) if (NULL == (f->shared->fs_man[type] = H5FS_create(f, NULL, &fs_create, NELMTS(classes), classes, f, alignment, threshold))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space info"); /* Set the state for the free space manager to "open", if it is now */ if (f->shared->fs_man[type]) @@ -450,9 +436,6 @@ H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Jan 8 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -465,25 +448,25 @@ H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type) /* * Check arguments. */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); if (H5F_PAGED_AGGR(f)) - HDassert(type < H5F_MEM_PAGE_NTYPES); + assert(type < H5F_MEM_PAGE_NTYPES); else { - HDassert((H5FD_mem_t)type < H5FD_MEM_NTYPES); - HDassert((H5FD_mem_t)type != H5FD_MEM_NOLIST); + assert((H5FD_mem_t)type < H5FD_MEM_NTYPES); + assert((H5FD_mem_t)type != H5FD_MEM_NOLIST); } /* end else */ /* Check if the free space manager exists already */ - if (H5F_addr_defined(f->shared->fs_addr[type])) { + if (H5_addr_defined(f->shared->fs_addr[type])) { /* Open existing free space manager */ if (H5MF__open_fstype(f, type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, FAIL, "can't initialize file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, FAIL, "can't initialize file free space"); } /* end if */ else { /* Create new free space manager */ if (H5MF__create_fstype(f, type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCREATE, FAIL, "can't initialize file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCREATE, FAIL, "can't initialize file free space"); } /* end else */ done: @@ -499,8 +482,6 @@ H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; April 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -514,12 +495,12 @@ H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); + assert(f); if (H5F_PAGED_AGGR(f)) - HDassert(type < H5F_MEM_PAGE_NTYPES); + assert(type < H5F_MEM_PAGE_NTYPES); else - HDassert((H5FD_mem_t)type < H5FD_MEM_NTYPES); - HDassert(H5F_addr_defined(f->shared->fs_addr[type])); + assert((H5FD_mem_t)type < H5FD_MEM_NTYPES); + assert(H5_addr_defined(f->shared->fs_addr[type])); /* Put address into temporary variable and reset it */ /* (Avoids loopback in file space freeing routine) */ @@ -539,19 +520,19 @@ H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type) H5AC_set_ring(fsm_ring, &orig_ring); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Before deleting free space manager\n", __func__); + fprintf(stderr, "%s: Before deleting free space manager\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Delete free space manager for this type */ if (H5FS_delete(f, tmp_fs_addr) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't delete free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't delete free space manager"); /* Shift [back] to closed state */ - HDassert(f->shared->fs_state[type] == H5F_FS_STATE_DELETING); + assert(f->shared->fs_state[type] == H5F_FS_STATE_DELETING); f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; /* Sanity check that the free space manager for this type wasn't started up again */ - HDassert(!H5F_addr_defined(f->shared->fs_addr[type])); + assert(!H5_addr_defined(f->shared->fs_addr[type])); done: /* Reset the ring in the API context */ @@ -570,8 +551,6 @@ H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; July 1st, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -584,22 +563,22 @@ H5MF__close_fstype(H5F_t *f, H5F_mem_page_t type) /* * Check arguments. */ - HDassert(f); + assert(f); if (H5F_PAGED_AGGR(f)) - HDassert(type < H5F_MEM_PAGE_NTYPES); + assert(type < H5F_MEM_PAGE_NTYPES); else - HDassert((H5FD_mem_t)type < H5FD_MEM_NTYPES); - HDassert(f->shared); - HDassert(f->shared->fs_man[type]); - HDassert(f->shared->fs_state[type] != H5F_FS_STATE_CLOSED); + assert((H5FD_mem_t)type < H5FD_MEM_NTYPES); + assert(f->shared); + assert(f->shared->fs_man[type]); + assert(f->shared->fs_state[type] != H5F_FS_STATE_CLOSED); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Before closing free space manager\n", __func__); + fprintf(stderr, "%s: Before closing free space manager\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Close an existing free space structure for the file */ if (H5FS_close(f, f->shared->fs_man[type]) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't release free space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't release free space info"); f->shared->fs_man[type] = NULL; f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; @@ -615,8 +594,6 @@ H5MF__close_fstype(H5F_t *f, H5F_mem_page_t type) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; April 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -630,9 +607,9 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(fspace); - HDassert(node); + assert(f); + assert(fspace); + assert(node); H5MF__alloc_to_fs_type(f->shared, alloc_type, node->sect_info.size, &fs_type); @@ -650,14 +627,13 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio H5AC_set_ring(fsm_ring, &orig_ring); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, - "%s: adding node, node->sect_info.addr = %" PRIuHADDR ", node->sect_info.size = %" PRIuHSIZE - "\n", - __func__, node->sect_info.addr, node->sect_info.size); + fprintf(stderr, + "%s: adding node, node->sect_info.addr = %" PRIuHADDR ", node->sect_info.size = %" PRIuHSIZE "\n", + __func__, node->sect_info.addr, node->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Add the section */ if (H5FS_sect_add(f, fspace, (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't re-add section to file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't re-add section to file free space"); done: /* Reset the ring in the API context */ @@ -676,8 +652,6 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio * Return: TRUE if a section is found to fulfill the request * FALSE if not * - * Programmer: Vailin Choi; April 2013 - * *------------------------------------------------------------------------- */ htri_t @@ -690,8 +664,8 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(fspace); + assert(f); + assert(fspace); /* Set the ring type in the API context */ if (H5MF__fsm_is_self_referential(f->shared, fspace)) @@ -702,16 +676,16 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h /* Try to get a section from the free space manager */ if ((ret_value = H5FS_sect_find(f, fspace, size, (H5FS_section_info_t **)&node)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "error locating free space in file") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "error locating free space in file"); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section found = %d\n", __func__, ret_value); + fprintf(stderr, "%s: section found = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Check for actually finding section */ if (ret_value) { /* Sanity check */ - HDassert(node); + assert(node); /* Retrieve return value */ if (addr) @@ -720,12 +694,12 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h /* Check for eliminating the section */ if (node->sect_info.size == size) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: freeing node\n", __func__); + fprintf(stderr, "%s: freeing node\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Free section node */ if (H5MF__sect_free((H5FS_section_info_t *)node) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node"); } /* end if */ else { /* Adjust information for section */ @@ -733,13 +707,13 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h node->sect_info.size -= size; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: re-adding node, node->sect_info.size = %" PRIuHSIZE "\n", __func__, - node->sect_info.size); + fprintf(stderr, "%s: re-adding node, node->sect_info.size = %" PRIuHSIZE "\n", __func__, + node->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Re-add the section to the free-space manager */ if (H5MF__add_sect(f, alloc_type, fspace, node) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't re-add section to file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't re-add section to file free space"); } /* end else */ } /* end if */ @@ -762,9 +736,6 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h * Return: Success: The file address of new chunk. * Failure: HADDR_UNDEF * - * Programmer: Robb Matzke - * Jul 11 1997 - * *------------------------------------------------------------------------- */ haddr_t @@ -777,19 +748,19 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: alloc_type = %u, size = %" PRIuHSIZE "\n", __func__, (unsigned)alloc_type, size); + fprintf(stderr, "%s: alloc_type = %u, size = %" PRIuHSIZE "\n", __func__, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ /* check arguments */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(size > 0); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(size > 0); H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 1.0\n", __func__); + fprintf(stderr, "%s: Check 1.0\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Set the ring type in the API context */ @@ -807,41 +778,41 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) */ if (H5AC_unsettle_ring(f, fsm_ring) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_SYSTEM, HADDR_UNDEF, - "attempt to notify cache that ring is unsettled failed") + "attempt to notify cache that ring is unsettled failed"); /* Check if the free space manager for the file has been initialized */ - if (!f->shared->fs_man[fs_type] && H5F_addr_defined(f->shared->fs_addr[fs_type])) { + if (!f->shared->fs_man[fs_type] && H5_addr_defined(f->shared->fs_addr[fs_type])) { /* Open the free-space manager */ if (H5MF__open_fstype(f, fs_type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, HADDR_UNDEF, "can't initialize file free space") - HDassert(f->shared->fs_man[fs_type]); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTOPENOBJ, HADDR_UNDEF, "can't initialize file free space"); + assert(f->shared->fs_man[fs_type]); } /* end if */ /* Search for large enough space in the free space manager */ if (f->shared->fs_man[fs_type]) if (H5MF__find_sect(f, alloc_type, size, f->shared->fs_man[fs_type], &ret_value) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "error locating a node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "error locating a node"); } /* end if */ /* If no space is found from the free-space manager, continue further action */ - if (!H5F_addr_defined(ret_value)) { + if (!H5_addr_defined(ret_value)) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 2.0\n", __func__); + fprintf(stderr, "%s: Check 2.0\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ if (f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE) { - HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); + assert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); if (HADDR_UNDEF == (ret_value = H5MF__alloc_pagefs(f, alloc_type, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, - "allocation failed from paged aggregation") + "allocation failed from paged aggregation"); } /* end if */ else { /* For non-paged aggregation, continue further action */ if (HADDR_UNDEF == (ret_value = H5MF_aggr_vfd_alloc(f, alloc_type, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed from aggr/vfd") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed from aggr/vfd"); } /* end else */ } /* end if */ - HDassert(H5F_addr_defined(ret_value)); + assert(H5_addr_defined(ret_value)); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 3.0\n", __func__); + fprintf(stderr, "%s: Check 3.0\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ done: @@ -850,8 +821,8 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", __func__, ret_value, - size); + fprintf(stderr, "%s: Leaving: ret_value = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", __func__, ret_value, + size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -877,8 +848,6 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) * Return: Success: The file address of new chunk. * Failure: HADDR_UNDEF * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ static haddr_t @@ -891,7 +860,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) FUNC_ENTER_PACKAGE #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: alloc_type = %u, size = %" PRIuHSIZE "\n", __func__, (unsigned)alloc_type, size); + fprintf(stderr, "%s: alloc_type = %u, size = %" PRIuHSIZE "\n", __func__, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &ptype); @@ -908,14 +877,14 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) /* Get the EOA for the file */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, alloc_type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa") - HDassert(!(eoa % f->shared->fs_page_size)); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa"); + assert(!(eoa % f->shared->fs_page_size)); H5MF_EOA_MISALIGN(f, (eoa + size), f->shared->fs_page_size, frag_size); /* Allocate from VFD */ if (HADDR_UNDEF == (ret_value = H5F__alloc(f, alloc_type, size + frag_size, NULL, NULL))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space"); /* If there is a mis-aligned fragment at EOA */ if (frag_size) { @@ -924,17 +893,17 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) if (!(f->shared->fs_man[ptype])) if (H5MF__start_fstype(f, ptype) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, - "can't initialize file free space") + "can't initialize file free space"); /* Create free space section for the fragment */ if (NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_LARGE, ret_value + size, frag_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, - "can't initialize free space section") + "can't initialize free space section"); /* Add the fragment to the large free-space manager */ if (H5MF__add_sect(f, alloc_type, f->shared->fs_man[ptype], node) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, - "can't re-add section to file free space") + "can't re-add section to file free space"); node = NULL; } /* end if */ @@ -950,22 +919,22 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) /* Allocate one file space page */ if (HADDR_UNDEF == (new_page = H5MF_alloc(f, alloc_type, f->shared->fs_page_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space"); /* Start up the free-space manager */ if (!(f->shared->fs_man[ptype])) if (H5MF__start_fstype(f, ptype) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize file free space") - HDassert(f->shared->fs_man[ptype]); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize file free space"); + assert(f->shared->fs_man[ptype]); if (NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_SMALL, (new_page + size), (f->shared->fs_page_size - size)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize free space section") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize free space section"); /* Add the remaining space in the page to the manager */ if (H5MF__add_sect(f, alloc_type, f->shared->fs_man[ptype], node) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, - "can't re-add section to file free space") + "can't re-add section to file free space"); node = NULL; @@ -973,7 +942,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) we don't read an empty page from disk */ if (f->shared->page_buf != NULL && H5PB_add_new_page(f->shared, alloc_type, new_page) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, HADDR_UNDEF, - "can't add new page to Page Buffer new page list") + "can't add new page to Page Buffer new page list"); ret_value = new_page; } break; @@ -982,14 +951,14 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) case H5F_MEM_PAGE_DEFAULT: default: HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, - "can't allocate file space: unrecognized type") + "can't allocate file space: unrecognized type"); break; } /* end switch */ done: #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", __func__, ret_value, - size); + fprintf(stderr, "%s: Leaving: ret_value = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", __func__, ret_value, + size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -998,7 +967,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) /* Release section node, if allocated and not added to section list or merged */ if (node) if (H5MF__sect_free((H5FS_section_info_t *)node) < 0) - HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free section node") + HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free section node"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__alloc_pagefs() */ @@ -1022,9 +991,6 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) * Return: Success: Temporary file address * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol - * Thursday, June 4, 2009 - * *------------------------------------------------------------------------- */ haddr_t @@ -1035,25 +1001,25 @@ H5MF_alloc_tmp(H5F_t *f, hsize_t size) FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: size = %" PRIuHSIZE "\n", __func__, size); + fprintf(stderr, "%s: size = %" PRIuHSIZE "\n", __func__, size); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(size > 0); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(size > 0); /* Retrieve the 'eoa' for the file */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "driver get_eoa request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "driver get_eoa request failed"); /* Compute value to return */ ret_value = f->shared->tmp_addr - size; /* Check for overlap into the actual allocated space in the file */ - if (H5F_addr_le(ret_value, eoa)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "driver get_eoa request failed") + if (H5_addr_le(ret_value, eoa)) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "driver get_eoa request failed"); /* Adjust temporary address allocator in the file */ f->shared->tmp_addr = ret_value; @@ -1070,9 +1036,6 @@ H5MF_alloc_tmp(H5F_t *f, hsize_t size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 17 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1087,15 +1050,15 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", - __func__, (unsigned)alloc_type, addr, size); + fprintf(stderr, "%s: Entering - alloc_type = %u, addr = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", + __func__, (unsigned)alloc_type, addr, size); #endif /* H5MF_ALLOC_DEBUG */ /* check arguments */ - HDassert(f); - if (!H5F_addr_defined(addr) || 0 == size) - HGOTO_DONE(SUCCEED) - HDassert(addr != 0); /* Can't deallocate the superblock :-) */ + assert(f); + if (!H5_addr_defined(addr) || 0 == size) + HGOTO_DONE(SUCCEED); + assert(addr != 0); /* Can't deallocate the superblock :-) */ H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); @@ -1114,11 +1077,11 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) if (H5F_HAVE_FREE_SPACE_MANAGER(f)) if (H5AC_unsettle_ring(f, fsm_ring) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_SYSTEM, FAIL, - "attempt to notify cache that ring is unsettled failed") + "attempt to notify cache that ring is unsettled failed"); /* Check for attempting to free space that's a 'temporary' file address */ - if (H5F_addr_le(f->shared->tmp_addr, addr)) - HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "attempting to free temporary file space") + if (H5_addr_le(f->shared->tmp_addr, addr)) + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, FAIL, "attempting to free temporary file space"); /* If it's metadata, check if the space to free intersects with the file's * metadata accumulator @@ -1127,7 +1090,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) /* Check if the space to free intersects with the file's metadata accumulator */ if (H5F__accum_free(f->shared, alloc_type, addr, size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, - "can't check free space intersection w/metadata accumulator") + "can't check free space intersection w/metadata accumulator"); } /* end if */ /* Check if the free space manager for the file has been initialized */ @@ -1137,27 +1100,26 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) * space is at the end of the file */ #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: fs_addr = %" PRIuHADDR "\n", __func__, f->shared->fs_addr[fs_type]); + fprintf(stderr, "%s: fs_addr = %" PRIuHADDR "\n", __func__, f->shared->fs_addr[fs_type]); #endif /* H5MF_ALLOC_DEBUG_MORE */ - if (!H5F_addr_defined(f->shared->fs_addr[fs_type])) { + if (!H5_addr_defined(f->shared->fs_addr[fs_type])) { htri_t status; /* "can absorb" status for section into */ #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", __func__); + fprintf(stderr, "%s: Trying to avoid starting up free space manager\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Try to shrink the file or absorb the block into a block aggregator */ if ((status = H5MF_try_shrink(f, alloc_type, addr, size)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't check for absorbing block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't check for absorbing block"); else if (status > 0) /* Indicate success */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); else if (size < f->shared->fs_threshold) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, - "%s: dropping addr = %" PRIuHADDR ", size = %" PRIuHSIZE ", on the floor!\n", - __func__, addr, size); + fprintf(stderr, "%s: dropping addr = %" PRIuHADDR ", size = %" PRIuHSIZE ", on the floor!\n", + __func__, addr, size); #endif /* H5MF_ALLOC_DEBUG_MORE */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end else-if */ } /* end if */ @@ -1172,10 +1134,10 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) */ if (f->shared->fs_state[fs_type] == H5F_FS_STATE_DELETING || !H5F_HAVE_FREE_SPACE_MANAGER(f)) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: dropping addr = %" PRIuHADDR ", size = %" PRIuHSIZE ", on the floor!\n", - __func__, addr, size); + fprintf(stderr, "%s: dropping addr = %" PRIuHADDR ", size = %" PRIuHSIZE ", on the floor!\n", + __func__, addr, size); #endif /* H5MF_ALLOC_DEBUG_MORE */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* There's either already a free space manager, or the freed @@ -1183,29 +1145,29 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) * the file space manager */ if (H5MF__start_fstype(f, fs_type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space"); } /* end if */ /* Create the free-space section for the freed section */ ctype = H5MF_SECT_CLASS_TYPE(f, size); if (NULL == (node = H5MF__sect_new(ctype, addr, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section"); /* If size of the freed section is larger than threshold, add it to the free space manager */ if (size >= f->shared->fs_threshold) { - HDassert(f->shared->fs_man[fs_type]); + assert(f->shared->fs_man[fs_type]); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Before H5FS_sect_add()\n", __func__); + fprintf(stderr, "%s: Before H5FS_sect_add()\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Add to the free space for the file */ if (H5MF__add_sect(f, alloc_type, f->shared->fs_man[fs_type], node) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't add section to file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't add section to file free space"); node = NULL; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: After H5FS_sect_add()\n", __func__); + fprintf(stderr, "%s: After H5FS_sect_add()\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ else { @@ -1221,7 +1183,7 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) /* Try to merge the section that is smaller than threshold */ if ((merged = H5FS_sect_try_merge(f, f->shared->fs_man[fs_type], (H5FS_section_info_t *)node, H5FS_ADD_RETURNED_SPACE, &udata)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't merge section to file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't merge section to file free space"); else if (merged == TRUE) /* successfully merged */ /* Indicate that the node was used */ node = NULL; @@ -1235,10 +1197,10 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) /* Release section node, if allocated and not added to section list or merged */ if (node) if (H5MF__sect_free((H5FS_section_info_t *)node) < 0) - HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") + HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node"); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); + fprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -1263,9 +1225,6 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) * FALSE(0) - Block could not be extended * Failure: FAIL * - * Programmer: Quincey Koziol - * Friday, June 11, 2004 - * *------------------------------------------------------------------------- */ htri_t @@ -1282,15 +1241,15 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, - "%s: Entering: alloc_type = %u, addr = %" PRIuHADDR ", size = %" PRIuHSIZE - ", extra_requested = %" PRIuHSIZE "\n", - __func__, (unsigned)alloc_type, addr, size, extra_requested); + fprintf(stderr, + "%s: Entering: alloc_type = %u, addr = %" PRIuHADDR ", size = %" PRIuHSIZE + ", extra_requested = %" PRIuHSIZE "\n", + __func__, (unsigned)alloc_type, addr, size, extra_requested); #endif /* H5MF_ALLOC_DEBUG */ /* Sanity check */ - HDassert(f); - HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); + assert(f); + assert(H5F_INTENT(f) & H5F_ACC_RDWR); /* Set mapped type, treating global heap as raw data */ map_type = (alloc_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : alloc_type; @@ -1315,8 +1274,8 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi /* To extend a large block: calculate in advance the mis-aligned fragment so EOA will end at * page boundary if extended */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, alloc_type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") - HDassert(!(eoa % f->shared->fs_page_size)); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa"); + assert(!(eoa % f->shared->fs_page_size)); H5MF_EOA_MISALIGN(f, (eoa + extra_requested), f->shared->fs_page_size, frag_size); } /* end else */ @@ -1335,9 +1294,9 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi if (allow_extend) { /* Try extending the block at EOA */ if ((ret_value = H5F__try_extend(f, map_type, end, extra_requested + frag_size)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file"); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: extended = %d\n", __func__, ret_value); + fprintf(stderr, "%s: extended = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* If extending at EOA succeeds: */ @@ -1346,20 +1305,20 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi H5MF_free_section_t *node = NULL; /* Free space section pointer */ /* Should be large-sized block */ - HDassert(size >= f->shared->fs_page_size); + assert(size >= f->shared->fs_page_size); /* Start up the free-space manager */ if (!(f->shared->fs_man[fs_type])) if (H5MF__start_fstype(f, fs_type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space"); /* Create free space section for the fragment */ if (NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_LARGE, end + extra_requested, frag_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section"); /* Add the fragment to the large-sized free-space manager */ if (H5MF__add_sect(f, alloc_type, f->shared->fs_man[fs_type], node) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't re-add section to file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINSERT, FAIL, "can't re-add section to file free space"); node = NULL; } /* end if */ @@ -1372,10 +1331,10 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi /* Check if the block is able to extend into aggregation block */ aggr = (map_type == H5FD_MEM_DRAW) ? &(f->shared->sdata_aggr) : &(f->shared->meta_aggr); if ((ret_value = H5MF__aggr_try_extend(f, aggr, map_type, end, extra_requested)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending aggregation block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending aggregation block"); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: H5MF__aggr_try_extend = %d\n", __func__, ret_value); + fprintf(stderr, "%s: H5MF__aggr_try_extend = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ @@ -1389,19 +1348,19 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi udata.alloc_type = alloc_type; /* Check if the free space for the file has been initialized */ - if (!f->shared->fs_man[fs_type] && H5F_addr_defined(f->shared->fs_addr[fs_type])) + if (!f->shared->fs_man[fs_type] && H5_addr_defined(f->shared->fs_addr[fs_type])) /* Open the free-space manager */ if (H5MF__open_fstype(f, fs_type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space"); /* Try to extend the block into a free-space section */ if (f->shared->fs_man[fs_type]) { if ((ret_value = H5FS_sect_try_extend(f, f->shared->fs_man[fs_type], addr, size, extra_requested, H5FS_ADD_RETURNED_SPACE, &udata)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, - "error extending block in free space manager") + "error extending block in free space manager"); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Try to H5FS_sect_try_extend = %d\n", __func__, ret_value); + fprintf(stderr, "%s: Try to H5FS_sect_try_extend = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ @@ -1412,8 +1371,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi if (frag_size <= H5F_PGEND_META_THRES(f) && extra_requested <= frag_size) ret_value = TRUE; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Try to extend into the page end threshold = %d\n", __func__, - ret_value); + fprintf(stderr, "%s: Try to extend into the page end threshold = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ } /* end if */ @@ -1425,7 +1383,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %d\n", __func__, ret_value); + fprintf(stderr, "%s: Leaving: ret_value = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -1442,9 +1400,6 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 14 2008 - * *------------------------------------------------------------------------- */ htri_t @@ -1460,20 +1415,20 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", - __func__, (unsigned)alloc_type, addr, size); + fprintf(stderr, "%s: Entering - alloc_type = %u, addr = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", + __func__, (unsigned)alloc_type, addr, size); #endif /* H5MF_ALLOC_DEBUG */ /* check arguments */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(H5F_addr_defined(addr)); - HDassert(size > 0); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(H5_addr_defined(addr)); + assert(size > 0); /* Set up free-space section class information */ sect_cls = H5MF_SECT_CLS_TYPE(f, size); - HDassert(sect_cls); + assert(sect_cls); /* Get free space type from allocation type */ H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); @@ -1487,7 +1442,7 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) /* Create free-space section for block */ if (NULL == (node = H5MF__sect_new(sect_cls->type, addr, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section"); /* Construct user data for callbacks */ udata.f = f; @@ -1498,12 +1453,12 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) /* Check if the block can shrink the container */ if (sect_cls->can_shrink) { if ((ret_value = (*sect_cls->can_shrink)((const H5FS_section_info_t *)node, &udata)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't check if section can shrink container") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't check if section can shrink container"); if (ret_value > 0) { - HDassert(sect_cls->shrink); + assert(sect_cls->shrink); if ((*sect_cls->shrink)((H5FS_section_info_t **)&node, &udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink container") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink container"); } /* end if */ } /* end if */ @@ -1514,10 +1469,10 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) /* Free section node allocated */ if (node && H5MF__sect_free((H5FS_section_info_t *)node) < 0) - HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") + HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node"); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); + fprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF_try_shrink() */ @@ -1530,8 +1485,6 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -1541,25 +1494,27 @@ H5MF_close(H5F_t *f) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", __func__); + fprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); if (H5F_PAGED_AGGR(f)) { if ((ret_value = H5MF__close_pagefs(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'page' file space") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, + "can't close free-space managers for 'page' file space"); } else { if ((ret_value = H5MF__close_aggrfs(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'aggr' file space") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, + "can't close free-space managers for 'aggr' file space"); } done: #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", __func__); + fprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF_close() */ @@ -1573,9 +1528,6 @@ H5MF_close(H5F_t *f) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Jan 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -1585,42 +1537,42 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) FUNC_ENTER_PACKAGE #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", __func__); + fprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); if (H5F_PAGED_AGGR(f)) - HDassert(type < H5F_MEM_PAGE_NTYPES); + assert(type < H5F_MEM_PAGE_NTYPES); else - HDassert((H5FD_mem_t)type < H5FD_MEM_NTYPES); + assert((H5FD_mem_t)type < H5FD_MEM_NTYPES); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %" PRIuHADDR "\n", - __func__, (unsigned)type, (void *)f->shared->fs_man[type], (unsigned)type, - f->shared->fs_addr[type]); + fprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %" PRIuHADDR "\n", + __func__, (unsigned)type, (void *)f->shared->fs_man[type], (unsigned)type, + f->shared->fs_addr[type]); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* If the free space manager for this type is open, close it */ if (f->shared->fs_man[type]) if (H5MF__close_fstype(f, type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager"); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %" PRIuHADDR "\n", - __func__, (unsigned)type, (void *)f->shared->fs_man[type], (unsigned)type, - f->shared->fs_addr[type]); + fprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %" PRIuHADDR "\n", + __func__, (unsigned)type, (void *)f->shared->fs_man[type], (unsigned)type, + f->shared->fs_addr[type]); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* If there is free space manager info for this type, delete it */ - if (H5F_addr_defined(f->shared->fs_addr[type])) + if (H5_addr_defined(f->shared->fs_addr[type])) if (H5MF__delete_fstype(f, type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't delete the free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't delete the free space manager"); done: #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", __func__); + fprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5MF__close_delete() */ @@ -1634,9 +1586,6 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * Jan 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -1649,11 +1598,11 @@ H5MF_try_close(H5F_t *f) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", __func__); + fprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ - HDassert(f); + assert(f); /* If there have been no file space allocations / deallocation so * far, must call H5MF_tidy_self_referential_fsm_hack() to float @@ -1696,7 +1645,7 @@ H5MF_try_close(H5F_t *f) } /* end if */ if (H5MF__close_delete_fstype(f, ptype) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager"); } /* end for */ } /* end if */ else { @@ -1718,7 +1667,7 @@ H5MF_try_close(H5F_t *f) } /* end if */ if (H5MF__close_delete_fstype(f, (H5F_mem_page_t)type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager"); } /* end for */ } /* end else */ @@ -1728,7 +1677,7 @@ H5MF_try_close(H5F_t *f) H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", __func__); + fprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5MF_try_close() */ @@ -1740,9 +1689,6 @@ H5MF_try_close(H5F_t *f) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, January 22, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -1756,14 +1702,14 @@ H5MF__close_aggrfs(H5F_t *f) FUNC_ENTER_PACKAGE #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", __func__); + fprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(f->shared->sblock); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(f->shared->sblock); /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initially set the ring in @@ -1775,11 +1721,11 @@ H5MF__close_aggrfs(H5F_t *f) /* Free the space in aggregators */ /* (for space not at EOA, it may be put into free space managers) */ if (H5MF_free_aggrs(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators"); /* Trying shrinking the EOA for the file */ if (H5MF__close_shrink_eoa(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa"); /* Making free-space managers persistent for superblock version >= 2 */ if (f->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2 && f->shared->fs_persist) { @@ -1790,7 +1736,7 @@ H5MF__close_aggrfs(H5F_t *f) /* superblock extension and free space manager message should * exist at this point -- verify at least the former. */ - HDassert(H5F_addr_defined(f->shared->sblock->ext_addr)); + assert(H5_addr_defined(f->shared->sblock->ext_addr)); /* file space for all non-empty free space managers should be * allocated at this point, and these free space managers should @@ -1817,7 +1763,7 @@ H5MF__close_aggrfs(H5F_t *f) /* Write the free space manager message -- message must already exist */ if (H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, - "error in writing message to superblock extension") + "error in writing message to superblock extension"); /* Close the free space managers */ for (type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) { @@ -1833,10 +1779,10 @@ H5MF__close_aggrfs(H5F_t *f) curr_ring = needed_ring; } /* end if */ - HDassert(f->shared->fs_state[type] == H5F_FS_STATE_OPEN); + assert(f->shared->fs_state[type] == H5F_FS_STATE_OPEN); if (H5FS_close(f, f->shared->fs_man[type]) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close free space manager"); f->shared->fs_man[type] = NULL; f->shared->fs_state[type] = H5F_FS_STATE_CLOSED; } /* end if */ @@ -1846,47 +1792,47 @@ H5MF__close_aggrfs(H5F_t *f) /* verify that we haven't dirtied any metadata cache entries * from the metadata free space manager ring out. */ - HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); + assert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); /* verify that the aggregators are still shutdown. */ - HDassert(f->shared->sdata_aggr.tot_size == 0); - HDassert(f->shared->sdata_aggr.addr == 0); - HDassert(f->shared->sdata_aggr.size == 0); + assert(f->shared->sdata_aggr.tot_size == 0); + assert(f->shared->sdata_aggr.addr == 0); + assert(f->shared->sdata_aggr.size == 0); - HDassert(f->shared->meta_aggr.tot_size == 0); - HDassert(f->shared->meta_aggr.addr == 0); - HDassert(f->shared->meta_aggr.size == 0); + assert(f->shared->meta_aggr.tot_size == 0); + assert(f->shared->meta_aggr.addr == 0); + assert(f->shared->meta_aggr.size == 0); /* Trying shrinking the EOA for the file */ /* (in case any free space is now at the EOA) */ if (H5MF__close_shrink_eoa(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa"); /* get the eoa, and verify that it has the expected value */ if (HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size"); /* f->shared->eoa_post_fsm_fsalloc is undefined if there has * been no file space allocation or deallocation since file * open. */ - HDassert(H5F_NULL_FSM_ADDR(f) || final_eoa == f->shared->eoa_fsm_fsalloc); + assert(H5F_NULL_FSM_ADDR(f) || final_eoa == f->shared->eoa_fsm_fsalloc); } /* end if */ else { /* super_vers can be 0, 1, 2 */ for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) if (H5MF__close_delete_fstype(f, (H5F_mem_page_t)type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space"); } /* end else */ /* Free the space in aggregators (again) */ /* (in case any free space information re-started them) */ if (H5MF_free_aggrs(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't free aggregators"); /* Trying shrinking the EOA for the file */ /* (in case any free space is now at the EOA) */ if (H5MF__close_shrink_eoa(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa"); done: /* Reset the ring in the API context */ @@ -1894,7 +1840,7 @@ H5MF__close_aggrfs(H5F_t *f) H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", __func__); + fprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__close_aggrfs() */ @@ -1906,8 +1852,6 @@ H5MF__close_aggrfs(H5F_t *f) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1922,16 +1866,16 @@ H5MF__close_pagefs(H5F_t *f) FUNC_ENTER_PACKAGE #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", __func__); + fprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(f->shared->sblock); - HDassert(f->shared->fs_page_size); - HDassert(f->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(f->shared->sblock); + assert(f->shared->fs_page_size); + assert(f->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2); /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initially set the ring in @@ -1942,7 +1886,7 @@ H5MF__close_pagefs(H5F_t *f) /* Trying shrinking the EOA for the file */ if (H5MF__close_shrink_eoa(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa"); /* Set up file space info message */ fsinfo.strategy = f->shared->fs_strategy; @@ -1962,7 +1906,7 @@ H5MF__close_pagefs(H5F_t *f) /* superblock extension and free space manager message should * exist at this point -- verify at least the former. */ - HDassert(H5F_addr_defined(f->shared->sblock->ext_addr)); + assert(H5_addr_defined(f->shared->sblock->ext_addr)); /* file space for all non-empty free space managers should be * allocated at this point, and these free space managers should @@ -1982,7 +1926,7 @@ H5MF__close_pagefs(H5F_t *f) /* Write the free space manager message -- message must already exist */ if (H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, - "error in writing message to superblock extension") + "error in writing message to superblock extension"); /* Close the free space managers */ /* use H5MF__close_fstype() for this? */ @@ -1999,10 +1943,10 @@ H5MF__close_pagefs(H5F_t *f) curr_ring = needed_ring; } /* end if */ - HDassert(f->shared->fs_state[ptype] == H5F_FS_STATE_OPEN); + assert(f->shared->fs_state[ptype] == H5F_FS_STATE_OPEN); if (H5FS_close(f, f->shared->fs_man[ptype]) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close free space manager"); f->shared->fs_man[ptype] = NULL; f->shared->fs_state[ptype] = H5F_FS_STATE_CLOSED; } /* end if */ @@ -2012,16 +1956,16 @@ H5MF__close_pagefs(H5F_t *f) /* verify that we haven't dirtied any metadata cache entries * from the metadata free space manager ring out. */ - HDassert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); + assert(H5AC_cache_is_clean(f, H5AC_RING_MDFSM)); /* Trying shrinking the EOA for the file */ /* (in case any free space is now at the EOA) */ if (H5MF__close_shrink_eoa(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa"); /* get the eoa, and verify that it has the expected value */ if (HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size"); /* f->shared->eoa_post_fsm_fsalloc is undefined if there has * been no file space allocation or deallocation since file @@ -2039,9 +1983,9 @@ H5MF__close_pagefs(H5F_t *f) * the file driver layer. However, as this possibility seems remote, * it is ignored in the following assert. */ - HDassert((H5F_NULL_FSM_ADDR(f)) || (final_eoa == f->shared->eoa_fsm_fsalloc) || - ((H5F_addr_defined(f->shared->eoa_post_mdci_fsalloc)) && - (final_eoa == f->shared->eoa_post_mdci_fsalloc))); + assert((H5F_NULL_FSM_ADDR(f)) || (final_eoa == f->shared->eoa_fsm_fsalloc) || + ((H5_addr_defined(f->shared->eoa_post_mdci_fsalloc)) && + (final_eoa == f->shared->eoa_post_mdci_fsalloc))); } /* end if */ else { /* Iterate over all the free space types that have managers @@ -2049,19 +1993,19 @@ H5MF__close_pagefs(H5F_t *f) */ for (ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) if (H5MF__close_delete_fstype(f, ptype) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager"); /* Write file space info message to superblock extension object header */ /* Create the superblock extension object header in advance if needed */ if (H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, - "error in writing message to superblock extension") + "error in writing message to superblock extension"); } /* end else */ /* Trying shrinking the EOA for the file */ /* (in case any free space is now at the EOA) */ if (H5MF__close_shrink_eoa(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa"); done: /* Reset the ring in the API context */ @@ -2069,7 +2013,7 @@ H5MF__close_pagefs(H5F_t *f) H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", __func__); + fprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__close_pagefs() */ @@ -2081,9 +2025,6 @@ H5MF__close_pagefs(H5F_t *f) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Saturday, July 7, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -2102,8 +2043,8 @@ H5MF__close_shrink_eoa(H5F_t *f) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); /* Construct user data for callbacks */ udata.f = f; @@ -2138,7 +2079,7 @@ H5MF__close_shrink_eoa(H5F_t *f) : ((ptype % H5FD_MEM_NTYPES) + 1)); if ((status = H5FS_sect_try_shrink_eoa(f, f->shared->fs_man[ptype], &udata)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa"); else if (status > 0) eoa_shrank = TRUE; } /* end if */ @@ -2162,7 +2103,7 @@ H5MF__close_shrink_eoa(H5F_t *f) udata.alloc_type = type; if ((status = H5FS_sect_try_shrink_eoa(f, f->shared->fs_man[type], &udata)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa"); else if (status > 0) eoa_shrank = TRUE; } /* end if */ @@ -2170,7 +2111,7 @@ H5MF__close_shrink_eoa(H5F_t *f) /* check the two aggregators */ if ((status = H5MF__aggrs_try_shrink_eoa(f)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa"); else if (status > 0) eoa_shrank = TRUE; } /* end else */ @@ -2192,9 +2133,6 @@ H5MF__close_shrink_eoa(H5F_t *f) * Return: Success: Amount of free space in file * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, October 6, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -2220,9 +2158,9 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); + assert(f); + assert(f->shared); + assert(f->shared->lf); /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initially set the ring in @@ -2243,16 +2181,16 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) for (tt = H5FD_MEM_SUPER; tt < H5FD_MEM_NTYPES; tt++) if (HADDR_UNDEF == (fs_eoa[tt] = H5F_get_eoa(f, tt))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed"); if (!H5F_PAGED_AGGR(f)) { /* Retrieve metadata aggregator info, if available */ if (H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats"); /* Retrieve 'small data' aggregator info, if available */ if (H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats"); } /* end if */ /* Iterate over all the free space types that have managers and get each free list's space */ @@ -2260,10 +2198,10 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) fs_started[type] = FALSE; /* Check if the free space for the file has been initialized */ - if (!f->shared->fs_man[type] && H5F_addr_defined(f->shared->fs_addr[type])) { + if (!f->shared->fs_man[type] && H5_addr_defined(f->shared->fs_addr[type])) { if (H5MF__open_fstype(f, type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") - HDassert(f->shared->fs_man[type]); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space"); + assert(f->shared->fs_man[type]); fs_started[type] = TRUE; } /* end if */ @@ -2285,9 +2223,9 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) /* Retrieve free space size from free space manager */ if (H5FS_sect_stats(f->shared->fs_man[type], &type_fs_size, NULL) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats"); if (H5FS_size(f->shared->fs_man[type], &type_meta_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space metadata stats") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space metadata stats"); /* Increment total free space for types */ tot_fs_size += type_fs_size; @@ -2310,7 +2248,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) if (fs_started[type]) if (H5MF__close_fstype(f, type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't close file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't close file free space"); } /* end for */ /* Set the value(s) to return */ @@ -2336,8 +2274,6 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -2356,9 +2292,9 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) /* check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); + assert(f); + assert(f->shared); + assert(f->shared->lf); /* H5MF_tidy_self_referential_fsm_hack() will fail if any self * referential FSM is opened prior to the call to it. Thus call @@ -2413,10 +2349,10 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t curr_ring = needed_ring; } /* end if */ - if (!f->shared->fs_man[ty] && H5F_addr_defined(f->shared->fs_addr[ty])) { + if (!f->shared->fs_man[ty] && H5_addr_defined(f->shared->fs_addr[ty])) { if (H5MF__open_fstype(f, ty) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't open the free space manager") - HDassert(f->shared->fs_man[ty]); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't open the free space manager"); + assert(f->shared->fs_man[ty]); fs_started = TRUE; } /* end if */ @@ -2424,7 +2360,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t if (f->shared->fs_man[ty]) if (H5MF__get_free_sects(f, f->shared->fs_man[ty], §_udata, &nums) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, - "can't get section info for the free space manager") + "can't get section info for the free space manager"); /* Increment total # of sections */ total_sects += nums; @@ -2432,7 +2368,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t /* Close the free space manager of this type, if we started it here */ if (fs_started) if (H5MF__close_fstype(f, ty) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, FAIL, "can't close file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, FAIL, "can't close file free space"); if ((H5F_PAGED_AGGR(f)) && (type != H5FD_MEM_DEFAULT)) ty = (H5F_mem_page_t)(ty + H5FD_MEM_NTYPES - 2); } /* end for */ @@ -2456,9 +2392,6 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t * * Return: Always succeed * - * Programmer: Vailin Choi - * July 1st, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -2486,8 +2419,6 @@ H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -2499,21 +2430,21 @@ H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(sect_udata); - HDassert(nums); - HDassert(fspace); + assert(f); + assert(sect_udata); + assert(nums); + assert(fspace); /* Query how many sections of this type */ if (H5FS_sect_stats(fspace, NULL, &hnums) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query free space stats"); H5_CHECKED_ASSIGN(*nums, size_t, hnums, hsize_t); /* Check if we should retrieve the section info */ if (sect_udata->sects && *nums > 0) /* Iterate over all the free space sections of this type, adding them to the user's section info */ if (H5FS_sect_iterate(f, fspace, H5MF__sects_cb, sect_udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_BADITER, FAIL, "can't iterate over sections") + HGOTO_ERROR(H5E_RESOURCE, H5E_BADITER, FAIL, "can't iterate over sections"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2615,9 +2546,6 @@ H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, * * Return: SUCCEED/FAIL * - * Programmer: John Mainzer - * 5/25/16 - * *------------------------------------------------------------------------- */ herr_t @@ -2637,13 +2565,13 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) /* Check args */ - HDassert(f); - HDassert(f->shared); - HDassert(fsm_settled); + assert(f); + assert(f->shared); + assert(fsm_settled); /* Initialize structs */ - HDmemset(&fsinfo, 0, sizeof(fsinfo)); - HDmemset(&fs_stat, 0, sizeof(fs_stat)); + memset(&fsinfo, 0, sizeof(fsinfo)); + memset(&fs_stat, 0, sizeof(fs_stat)); /* * Only need to settle things if we are persisting free space and @@ -2654,19 +2582,19 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) hbool_t fsm_visited[H5F_MEM_PAGE_NTYPES]; /* State of FSM */ /* Sanity check */ - HDassert(f->shared->sblock); + assert(f->shared->sblock); /* should only be called if file is opened R/W */ - HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); + assert(H5F_INTENT(f) & H5F_ACC_RDWR); /* shouldn't be called unless we have a superblock supporting the * superblock extension. */ - HDassert(f->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2); + assert(f->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_2); /* Initialize fsm_opened and fsm_visited */ - HDmemset(fsm_opened, 0, sizeof(fsm_opened)); - HDmemset(fsm_visited, 0, sizeof(fsm_visited)); + memset(fsm_opened, 0, sizeof(fsm_opened)); + memset(fsm_visited, 0, sizeof(fsm_visited)); /* 1) Reduce the EOA to the extent possible. */ @@ -2685,7 +2613,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) */ /* Vailin -- is this correct? */ if (!H5F_PAGED_AGGR(f) && (H5MF_free_aggrs(f) < 0)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregators") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregators"); /* Set the ring type in the DXPL. In most cases, we will * need H5AC_RING_MDFSM first, so initially set the ring in @@ -2734,15 +2662,15 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if (pass_count == 0) { /* this is the first pass */ - HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); - HDassert(fsm_type < H5F_MEM_PAGE_LARGE_SUPER); + assert(fsm_type > H5F_MEM_PAGE_DEFAULT); + assert(fsm_type < H5F_MEM_PAGE_LARGE_SUPER); } /* end if */ else if (H5F_PAGED_AGGR(f)) { /* page alloc active */ - HDassert(fsm_type >= H5F_MEM_PAGE_LARGE_SUPER); - HDassert(fsm_type < H5F_MEM_PAGE_NTYPES); + assert(fsm_type >= H5F_MEM_PAGE_LARGE_SUPER); + assert(fsm_type < H5F_MEM_PAGE_NTYPES); } /* end else-if */ else /* paged allocation disabled -- should be unreachable */ - HDassert(FALSE); + assert(FALSE); if (!fsm_visited[fsm_type]) { fsm_visited[fsm_type] = TRUE; @@ -2752,13 +2680,13 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) * space. */ if (NULL == f->shared->fs_man[fsm_type]) { - if (H5F_addr_defined(f->shared->fs_addr[fsm_type])) { + if (H5_addr_defined(f->shared->fs_addr[fsm_type])) { /* Sanity check */ - HDassert(fsm_opened[fsm_type] == FALSE); + assert(fsm_opened[fsm_type] == FALSE); if (H5MF__open_fstype(f, fsm_type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, - "can't initialize file free space manager") + "can't initialize file free space manager"); fsm_opened[fsm_type] = TRUE; } /* end if */ } /* end if */ @@ -2777,17 +2705,17 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* Query free space manager info for this type */ if (H5FS_stat_info(f, f->shared->fs_man[fsm_type], &fs_stat) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't get free-space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't get free-space info"); /* Check if the free space manager has space in the file */ - if (H5F_addr_defined(fs_stat.addr) || H5F_addr_defined(fs_stat.sect_addr)) { + if (H5_addr_defined(fs_stat.addr) || H5_addr_defined(fs_stat.sect_addr)) { /* Delete the free space manager in the file. Will * reallocate later if the free space manager contains * any free space. */ if (H5FS_free(f, f->shared->fs_man[fsm_type], TRUE) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, - "can't release free-space headers") + "can't release free-space headers"); f->shared->fs_addr[fsm_type] = HADDR_UNDEF; } /* end if */ } /* end if */ @@ -2810,14 +2738,14 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) * file space manager info message is guaranteed to exist. * Leave it in for now, but consider removing it. */ - if (H5F_addr_defined(f->shared->sblock->ext_addr)) + if (H5_addr_defined(f->shared->sblock->ext_addr)) if (H5F__super_ext_remove_msg(f, H5O_FSINFO_ID) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, - "error in removing message from superblock extension") + "error in removing message from superblock extension"); /* As the final element in 1), shrink the EOA for the file */ if (H5MF__close_shrink_eoa(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa"); /* 2) Ensure that space is allocated for the free space manager superblock * extension message. Must do this now, before reallocating file space @@ -2843,7 +2771,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) if (H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, TRUE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, - "error in writing fsinfo message to superblock extension") + "error in writing fsinfo message to superblock extension"); /* 3) Scan all free space managers not involved in allocating * space for free space managers. For each such free space @@ -2880,15 +2808,15 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) H5MF__alloc_to_fs_type(f->shared, mem_type, alloc_size, &fsm_type); if (pass_count == 0) { /* this is the first pass */ - HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); - HDassert(fsm_type < H5F_MEM_PAGE_LARGE_SUPER); + assert(fsm_type > H5F_MEM_PAGE_DEFAULT); + assert(fsm_type < H5F_MEM_PAGE_LARGE_SUPER); } /* end if */ else if (H5F_PAGED_AGGR(f)) { /* page alloc active */ - HDassert(fsm_type >= H5F_MEM_PAGE_LARGE_SUPER); - HDassert(fsm_type < H5F_MEM_PAGE_NTYPES); + assert(fsm_type >= H5F_MEM_PAGE_LARGE_SUPER); + assert(fsm_type < H5F_MEM_PAGE_NTYPES); } /* end else-if */ else /* paged allocation disabled -- should be unreachable */ - HDassert(FALSE); + assert(FALSE); /* Test to see if we need to switch rings -- do so if required */ if (H5MF__fsm_type_is_self_referential(f->shared, fsm_type)) @@ -2916,11 +2844,11 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) */ if (!H5MF__fsm_type_is_self_referential(f->shared, fsm_type)) { /* The current ring should be H5AC_RING_RDFSM */ - HDassert(curr_ring == H5AC_RING_RDFSM); + assert(curr_ring == H5AC_RING_RDFSM); /* Query free space manager info for this type */ if (H5FS_stat_info(f, f->shared->fs_man[fsm_type], &fs_stat) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info"); /* If the free space manager contains section info, * allocate space for the header and sinfo (note that @@ -2929,39 +2857,39 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) */ if (fs_stat.serial_sect_count > 0) { /* Sanity check */ - HDassert(!H5F_addr_defined(fs_stat.addr)); + assert(!H5_addr_defined(fs_stat.addr)); /* Allocate FSM header */ if (H5FS_alloc_hdr(f, f->shared->fs_man[fsm_type], &f->shared->fs_addr[fsm_type]) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "can't allocated free-space header") + "can't allocated free-space header"); /* Allocate FSM section info */ - HDassert(!H5F_addr_defined(fs_stat.sect_addr)); - HDassert(fs_stat.alloc_sect_size == 0); + assert(!H5_addr_defined(fs_stat.sect_addr)); + assert(fs_stat.alloc_sect_size == 0); if (H5FS_alloc_sect(f, f->shared->fs_man[fsm_type]) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "can't allocate free-space section info") + "can't allocate free-space section info"); #ifndef NDEBUG /* Re-Query free space manager info for this type */ if (H5FS_stat_info(f, f->shared->fs_man[fsm_type], &fs_stat) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, - "can't get free-space info") + "can't get free-space info"); - HDassert(H5F_addr_defined(fs_stat.addr)); - HDassert(H5F_addr_defined(fs_stat.sect_addr)); - HDassert(fs_stat.serial_sect_count > 0); - HDassert(fs_stat.alloc_sect_size > 0); - HDassert(fs_stat.alloc_sect_size == fs_stat.sect_size); + assert(H5_addr_defined(fs_stat.addr)); + assert(H5_addr_defined(fs_stat.sect_addr)); + assert(fs_stat.serial_sect_count > 0); + assert(fs_stat.alloc_sect_size > 0); + assert(fs_stat.alloc_sect_size == fs_stat.sect_size); #endif /* NDEBUG */ } /* end if */ else { - HDassert(!H5F_addr_defined(fs_stat.addr)); - HDassert(!H5F_addr_defined(fs_stat.sect_addr)); - HDassert(fs_stat.serial_sect_count == 0); - HDassert(fs_stat.alloc_sect_size == 0); + assert(!H5_addr_defined(fs_stat.addr)); + assert(!H5_addr_defined(fs_stat.sect_addr)); + assert(fs_stat.serial_sect_count == 0); + assert(fs_stat.alloc_sect_size == 0); } /* end else */ } /* end if */ } /* end if */ @@ -2970,7 +2898,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) if (fsm_opened[fsm_type]) { if (H5MF__close_fstype(f, fsm_type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, - "can't close file free space manager") + "can't close file free space manager"); fsm_opened[fsm_type] = FALSE; } /* end if */ } /* end if */ @@ -2979,7 +2907,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* verify that all opened FSMs were closed */ for (fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++) - HDassert(!fsm_opened[fsm_type]); + assert(!fsm_opened[fsm_type]); /* Indicate that the FSM was settled successfully */ *fsm_settled = TRUE; @@ -3084,9 +3012,6 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) * * Return: SUCCEED/FAIL * - * Programmer: John Mainzer - * 5/25/16 - * *------------------------------------------------------------------------- */ herr_t @@ -3109,9 +3034,9 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) /* Check args */ - HDassert(f); - HDassert(f->shared); - HDassert(fsm_settled); + assert(f); + assert(f->shared); + assert(fsm_settled); /* * Only need to settle things if we are persisting free space and @@ -3119,22 +3044,22 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) */ if (f->shared->fs_persist && !H5F_NULL_FSM_ADDR(f)) { /* Sanity check */ - HDassert(f->shared->lf); + assert(f->shared->lf); /* should only be called if file is opened R/W */ - HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); + assert(H5F_INTENT(f) & H5F_ACC_RDWR); H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); - HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT); - HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER); + assert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT); + assert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER); - HDassert(sm_fssinfo_fs_type > H5F_MEM_PAGE_DEFAULT); - HDassert(sm_fssinfo_fs_type < H5F_MEM_PAGE_LARGE_SUPER); + assert(sm_fssinfo_fs_type > H5F_MEM_PAGE_DEFAULT); + assert(sm_fssinfo_fs_type < H5F_MEM_PAGE_LARGE_SUPER); - HDassert(!H5F_addr_defined(f->shared->fs_addr[sm_fshdr_fs_type])); - HDassert(!H5F_addr_defined(f->shared->fs_addr[sm_fssinfo_fs_type])); + assert(!H5_addr_defined(f->shared->fs_addr[sm_fshdr_fs_type])); + assert(!H5_addr_defined(f->shared->fs_addr[sm_fssinfo_fs_type])); /* Note that in most cases, sm_hdr_fspace will equal sm_sinfo_fspace. */ sm_hdr_fspace = f->shared->fs_man[sm_fshdr_fs_type]; @@ -3146,14 +3071,14 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); - HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); - HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES); + assert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); + assert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES); - HDassert(lg_fssinfo_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); - HDassert(lg_fssinfo_fs_type < H5F_MEM_PAGE_NTYPES); + assert(lg_fssinfo_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); + assert(lg_fssinfo_fs_type < H5F_MEM_PAGE_NTYPES); - HDassert(!H5F_addr_defined(f->shared->fs_addr[lg_fshdr_fs_type])); - HDassert(!H5F_addr_defined(f->shared->fs_addr[lg_fssinfo_fs_type])); + assert(!H5_addr_defined(f->shared->fs_addr[lg_fshdr_fs_type])); + assert(!H5_addr_defined(f->shared->fs_addr[lg_fssinfo_fs_type])); /* Note that in most cases, lg_hdr_fspace will equal lg_sinfo_fspace. */ lg_hdr_fspace = f->shared->fs_man[lg_fshdr_fs_type]; @@ -3170,22 +3095,22 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) if (sm_hdr_fspace) { /* Query free space manager info for this type */ if (H5FS_stat_info(f, sm_hdr_fspace, &fs_stat) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info"); - HDassert(!H5F_addr_defined(fs_stat.addr)); - HDassert(!H5F_addr_defined(fs_stat.sect_addr)); - HDassert(fs_stat.alloc_sect_size == 0); + assert(!H5_addr_defined(fs_stat.addr)); + assert(!H5_addr_defined(fs_stat.sect_addr)); + assert(fs_stat.alloc_sect_size == 0); } /* end if */ /* Verify that sm_sinfo_fspace is floating if it exists and is distinct */ if ((sm_sinfo_fspace) && (sm_hdr_fspace != sm_sinfo_fspace)) { /* Query free space manager info for this type */ if (H5FS_stat_info(f, sm_sinfo_fspace, &fs_stat) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info"); - HDassert(!H5F_addr_defined(fs_stat.addr)); - HDassert(!H5F_addr_defined(fs_stat.sect_addr)); - HDassert(fs_stat.alloc_sect_size == 0); + assert(!H5_addr_defined(fs_stat.addr)); + assert(!H5_addr_defined(fs_stat.sect_addr)); + assert(fs_stat.alloc_sect_size == 0); } /* end if */ if (H5F_PAGED_AGGR(f)) { @@ -3193,11 +3118,11 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) if (lg_hdr_fspace) { /* Query free space manager info for this type */ if (H5FS_stat_info(f, lg_hdr_fspace, &fs_stat) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info (3)") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info (3)"); - HDassert(!H5F_addr_defined(fs_stat.addr)); - HDassert(!H5F_addr_defined(fs_stat.sect_addr)); - HDassert(fs_stat.alloc_sect_size == 0); + assert(!H5_addr_defined(fs_stat.addr)); + assert(!H5_addr_defined(fs_stat.sect_addr)); + assert(fs_stat.alloc_sect_size == 0); } /* end if */ /* Verify that lg_sinfo_fspace is floating if it @@ -3206,11 +3131,11 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) if ((lg_sinfo_fspace) && (lg_hdr_fspace != lg_sinfo_fspace)) { /* Query free space manager info for this type */ if (H5FS_stat_info(f, lg_sinfo_fspace, &fs_stat) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info (4)") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get free-space info (4)"); - HDassert(!H5F_addr_defined(fs_stat.addr)); - HDassert(!H5F_addr_defined(fs_stat.sect_addr)); - HDassert(fs_stat.alloc_sect_size == 0); + assert(!H5_addr_defined(fs_stat.addr)); + assert(!H5_addr_defined(fs_stat.sect_addr)); + assert(fs_stat.alloc_sect_size == 0); } /* end if */ } /* end if */ } @@ -3225,11 +3150,11 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) */ /* (for space not at EOF, it may be put into free space managers) */ if ((!H5F_PAGED_AGGR(f)) && (H5MF_free_aggrs(f) < 0)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregators") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregators"); /* Trying shrinking the EOA for the file */ if (H5MF__close_shrink_eoa(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't shrink eoa"); /* WARNING: This approach settling the self referential free space * managers and allocating space for them in the file will @@ -3237,7 +3162,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * multi file drivers, as the self referential free space * manager header and section info can be stored in up to * two different files -- requiring that up to two EOA's - * be stored in the the free space managers super block + * be stored in the free space manager's superblock * extension message. * * As of this writing, we are solving this problem by @@ -3262,26 +3187,27 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) if (sm_hdr_fspace) if (H5FS_vfd_alloc_hdr_and_section_info_if_needed( f, sm_hdr_fspace, &(f->shared->fs_addr[sm_fshdr_fs_type])) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate sm hdr FSM file space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, + "can't vfd allocate sm hdr FSM file space"); if (sm_sinfo_fspace && (sm_sinfo_fspace != sm_hdr_fspace)) if (H5FS_vfd_alloc_hdr_and_section_info_if_needed( f, sm_sinfo_fspace, &(f->shared->fs_addr[sm_fssinfo_fs_type])) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "can't vfd allocate sm sinfo FSM file space") + "can't vfd allocate sm sinfo FSM file space"); if (H5F_PAGED_AGGR(f)) { if (lg_hdr_fspace) if (H5FS_vfd_alloc_hdr_and_section_info_if_needed( f, lg_hdr_fspace, &(f->shared->fs_addr[lg_fshdr_fs_type])) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "can't vfd allocate lg hdr FSM file space") + "can't vfd allocate lg hdr FSM file space"); if (lg_sinfo_fspace && (lg_sinfo_fspace != lg_hdr_fspace)) if (H5FS_vfd_alloc_hdr_and_section_info_if_needed( f, lg_sinfo_fspace, &(f->shared->fs_addr[lg_fssinfo_fs_type])) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "can't vfd allocate lg sinfo FSM file space") + "can't vfd allocate lg sinfo FSM file space"); } /* end if */ sm_hdr_fspace = f->shared->fs_man[sm_fshdr_fs_type]; @@ -3293,7 +3219,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) if (H5MF__continue_alloc_fsm(f->shared, sm_hdr_fspace, sm_sinfo_fspace, lg_hdr_fspace, lg_sinfo_fspace, &continue_alloc_fsm) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate lg sinfo FSM file space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't vfd allocate lg sinfo FSM file space"); } while (continue_alloc_fsm); /* All free space managers should have file space allocated for them @@ -3309,7 +3235,7 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * final EOA of the file. */ if (HADDR_UNDEF == (eoa_fsm_fsalloc = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size"); f->shared->eoa_fsm_fsalloc = eoa_fsm_fsalloc; /* Indicate that the FSM was settled successfully */ @@ -3333,8 +3259,6 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * 6/24/2019 *------------------------------------------------------------------------- */ static herr_t @@ -3344,8 +3268,8 @@ H5MF__continue_alloc_fsm(H5F_shared_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_s FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(f_sh); - HDassert(continue_alloc_fsm); + assert(f_sh); + assert(continue_alloc_fsm); /* Check sm_hdr_fspace */ if (sm_hdr_fspace && sm_hdr_fspace->serial_sect_count > 0 && sm_hdr_fspace->sinfo) @@ -3379,9 +3303,6 @@ H5MF__continue_alloc_fsm(H5F_shared_t *f_sh, H5FS_t *sm_hdr_fspace, H5FS_t *sm_s * * Return: TRUE/FALSE * - * Programmer: John Mainzer - * 12/6/16 - * *------------------------------------------------------------------------- */ static hbool_t @@ -3396,9 +3317,9 @@ H5MF__fsm_type_is_self_referential(H5F_shared_t *f_sh, H5F_mem_page_t fsm_type) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f_sh); - HDassert(fsm_type >= H5F_MEM_PAGE_DEFAULT); - HDassert(fsm_type < H5F_MEM_PAGE_NTYPES); + assert(f_sh); + assert(fsm_type >= H5F_MEM_PAGE_DEFAULT); + assert(fsm_type < H5F_MEM_PAGE_NTYPES); H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); @@ -3434,9 +3355,6 @@ H5MF__fsm_type_is_self_referential(H5F_shared_t *f_sh, H5F_mem_page_t fsm_type) * * Return: TRUE/FALSE * - * Programmer: John Mainzer - * 12/6/16 - * *------------------------------------------------------------------------- */ static hbool_t @@ -3449,8 +3367,8 @@ H5MF__fsm_is_self_referential(H5F_shared_t *f_sh, H5FS_t *fspace) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f_sh); - HDassert(fspace); + assert(f_sh); + assert(fspace); H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); H5MF__alloc_to_fs_type(f_sh, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5MFaggr.c b/externals/coda-oss/modules/drivers/hdf5/source/H5MFaggr.c index 6519127f7d..5464b8aa6f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5MFaggr.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5MFaggr.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,11 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * * Purpose: Routines for aggregating free space allocations - * */ /****************/ @@ -80,9 +75,6 @@ static htri_t H5MF__aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr * Return: Success: The file address of new chunk. * Failure: HADDR_UNDEF * - * Programmer: Vailin Choi; July 1st, 2009 - * (The coding is from H5MF_alloc().) - * *------------------------------------------------------------------------- */ haddr_t @@ -92,36 +84,36 @@ H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: alloc_type = %u, size = %" PRIuHSIZE "\n", __func__, (unsigned)alloc_type, size); + fprintf(stderr, "%s: alloc_type = %u, size = %" PRIuHSIZE "\n", __func__, (unsigned)alloc_type, size); #endif /* H5MF_AGGR_DEBUG */ /* check arguments */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); - HDassert(size > 0); + assert(f); + assert(f->shared); + assert(f->shared->lf); + assert(size > 0); /* Couldn't find anything from the free space manager, go allocate some */ if (alloc_type != H5FD_MEM_DRAW && alloc_type != H5FD_MEM_GHEAP) { /* Handle metadata differently from "raw" data */ if (HADDR_UNDEF == (ret_value = H5MF__aggr_alloc(f, &(f->shared->meta_aggr), &(f->shared->sdata_aggr), alloc_type, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate metadata"); } /* end if */ else { /* Allocate "raw" data: H5FD_MEM_DRAW and H5FD_MEM_GHEAP */ if (HADDR_UNDEF == (ret_value = H5MF__aggr_alloc(f, &(f->shared->sdata_aggr), &(f->shared->meta_aggr), H5FD_MEM_DRAW, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate raw data") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate raw data"); } /* end else */ /* Sanity check for overlapping into file's temporary allocation space */ - HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr)); + assert(H5_addr_le((ret_value + size), f->shared->tmp_addr)); done: #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", __func__, ret_value, - size); + fprintf(stderr, "%s: Leaving: ret_value = %" PRIuHADDR ", size = %" PRIuHSIZE "\n", __func__, ret_value, + size); #endif /* H5MF_AGGR_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) @@ -136,9 +128,6 @@ H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) * Return: Success: The format address of the new file memory. * Failure: The undefined address HADDR_UNDEF * - * Programmer: Quincey Koziol - * Thursday, December 13, 2007 - * *------------------------------------------------------------------------- */ static haddr_t @@ -151,24 +140,24 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_PACKAGE #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: type = %u, size = %" PRIuHSIZE "\n", __func__, (unsigned)type, size); + fprintf(stderr, "%s: type = %u, size = %" PRIuHSIZE "\n", __func__, (unsigned)type, size); #endif /* H5MF_AGGR_DEBUG */ /* check args */ - HDassert(f); - HDassert(aggr); - HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || - aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); - HDassert(other_aggr); - HDassert(other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || - other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); - HDassert(other_aggr->feature_flag != aggr->feature_flag); - HDassert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); - HDassert(size > 0); + assert(f); + assert(aggr); + assert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || + aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); + assert(other_aggr); + assert(other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || + other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); + assert(other_aggr->feature_flag != aggr->feature_flag); + assert(type >= H5FD_MEM_DEFAULT && type < H5FD_MEM_NTYPES); + assert(size > 0); /* Get the EOA for the file */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, HADDR_UNDEF, "Unable to get eoa"); /* * If the aggregation feature is enabled for this file and strategy is not H5F_FILE_SPACE_NONE, @@ -200,8 +189,8 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F H5FD_mem_t alloc_type, other_alloc_type; /* Current aggregator & 'other' aggregator types */ #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: aggr = {%" PRIuHADDR ", %" PRIuHSIZE ", %" PRIuHSIZE "}\n", __func__, - aggr->addr, aggr->tot_size, aggr->size); + fprintf(stderr, "%s: aggr = {%" PRIuHADDR ", %" PRIuHSIZE ", %" PRIuHSIZE "}\n", __func__, + aggr->addr, aggr->tot_size, aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Turn off alignment if allocation < threshold */ @@ -210,7 +199,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F alignment = 0; /* no alignment */ /* Generate fragment if aggregator is mis-aligned */ - if (alignment && H5F_addr_gt(aggr->addr, 0) && + if (alignment && H5_addr_gt(aggr->addr, 0) && (aggr_mis_align = (aggr->addr + H5F_BASE_ADDR(f)) % alignment)) { aggr_frag_addr = aggr->addr; aggr_frag_size = alignment - aggr_mis_align; @@ -230,14 +219,14 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F hsize_t ext_size = size + aggr_frag_size; /* Check for overlapping into file's temporary allocation space */ - if (H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) - HGOTO_ERROR( - H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, - "'normal' file space allocation request will overlap into 'temporary' file space") + if (H5_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, + "'normal' file space allocation request will overlap into 'temporary' " + "file space"); if ((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space"); else if (extended) { /* aggr->size is unchanged */ ret_value = aggr->addr + aggr_frag_size; @@ -250,18 +239,19 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * allocation block size. */ if ((other_aggr->size > 0) && - (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && + (H5_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { if (H5MF__aggr_free(f, other_alloc_type, other_aggr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, - "can't free aggregation block") + "can't free aggregation block"); } /* end if */ /* Allocate space from the VFD (i.e. at the end of the file) */ if (HADDR_UNDEF == (ret_value = H5F__alloc(f, alloc_type, size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, + "can't allocate file space"); } /* end else */ } /* end if */ else { @@ -269,21 +259,21 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F /* Allocate another block */ #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: Allocating block\n", __func__); + fprintf(stderr, "%s: Allocating block\n", __func__); #endif /* H5MF_AGGR_DEBUG */ if (aggr_frag_size > (ext_size - size)) ext_size += (aggr_frag_size - (ext_size - size)); /* Check for overlapping into file's temporary allocation space */ - if (H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) - HGOTO_ERROR( - H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, - "'normal' file space allocation request will overlap into 'temporary' file space") + if (H5_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) + HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, + "'normal' file space allocation request will overlap into 'temporary' " + "file space"); if ((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space"); else if (extended) { aggr->addr += aggr_frag_size; aggr->size += (ext_size - aggr_frag_size); @@ -297,31 +287,32 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * allocation block size. */ if ((other_aggr->size > 0) && - (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && + (H5_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { if (H5MF__aggr_free(f, other_alloc_type, other_aggr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, - "can't free aggregation block") + "can't free aggregation block"); } /* end if */ /* Allocate space from the VFD (i.e. at the end of the file) */ if (HADDR_UNDEF == (new_space = H5F__alloc(f, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, + "can't allocate file space"); /* Return the unused portion of the block to a free list */ if (aggr->size > 0) if (H5MF_xfree(f, alloc_type, aggr->addr, aggr->size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, - "can't free aggregation block") + "can't free aggregation block"); /* If the block is not to be aligned, fold the eoa fragment * into the newly allocated aggregator, as it could have * been allocated in an aligned manner if the aggregator * block is larger than the threshold */ if (eoa_frag_size && !alignment) { - HDassert(eoa_frag_addr + eoa_frag_size == new_space); + assert(eoa_frag_addr + eoa_frag_size == new_space); aggr->addr = eoa_frag_addr; aggr->size = aggr->alloc_size + eoa_frag_size; aggr->tot_size = aggr->size; @@ -347,13 +338,13 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F /* Freeing any possible fragment due to file allocation */ if (eoa_frag_size) if (H5MF_xfree(f, alloc_type, eoa_frag_addr, eoa_frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment"); /* Freeing any possible fragment due to alignment in the block after extension */ if (extended && aggr_frag_size) if (H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, - "can't free aggregation fragment") + "can't free aggregation fragment"); } /* end if */ else { /* Allocate space out of the block */ @@ -365,31 +356,31 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F if (aggr_frag_size) if (H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, - "can't free aggregation fragment") + "can't free aggregation fragment"); } /* end else */ } /* end if */ else { /* Allocate data from the file */ if (HADDR_UNDEF == (ret_value = H5F__alloc(f, type, size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space"); /* Check if fragment was generated */ if (eoa_frag_size) /* Put fragment on the free list */ if (H5MF_xfree(f, type, eoa_frag_addr, eoa_frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment"); } /* end else */ /* Sanity check for overlapping into file's temporary allocation space */ - HDassert(H5F_addr_le((ret_value + size), f->shared->tmp_addr)); + assert(H5_addr_le((ret_value + size), f->shared->tmp_addr)); /* Post-condition sanity check */ if (H5F_ALIGNMENT(f) && size >= H5F_THRESHOLD(f)) - HDassert(!((ret_value + H5FD_get_base_addr(f->shared->lf)) % H5F_ALIGNMENT(f))); + assert(!((ret_value + H5FD_get_base_addr(f->shared->lf)) % H5F_ALIGNMENT(f))); done: #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: ret_value = %" PRIuHADDR "\n", __func__, ret_value); + fprintf(stderr, "%s: ret_value = %" PRIuHADDR "\n", __func__, ret_value); #endif /* H5MF_AGGR_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__aggr_alloc() */ @@ -414,9 +405,6 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * FALSE(0) - Block could not be extended * Failure: FAIL * - * Programmer: Quincey Koziol - * Thursday, December 13, 2007 - * *------------------------------------------------------------------------- */ htri_t H5MF__aggr_try_extend(H5F_t * f, H5F_blk_aggr_t * aggr, H5FD_mem_t type, haddr_t blk_end, @@ -427,10 +415,10 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(aggr); - HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || - aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); + assert(f); + assert(aggr); + assert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || + aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); /* Check if this aggregator is active */ if (f->shared->feature_flags & aggr->feature_flag) { @@ -438,15 +426,15 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * If the block being tested adjoins the beginning of the aggregator * block, check if the aggregator can accommodate the extension. */ - if (H5F_addr_eq(blk_end, aggr->addr)) { + if (H5_addr_eq(blk_end, aggr->addr)) { haddr_t eoa; /* EOA for the file */ /* Get the EOA for the file */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa"); /* If the aggregator is at the end of file: */ - if (H5F_addr_eq(eoa, aggr->addr + aggr->size)) { + if (H5_addr_eq(eoa, aggr->addr + aggr->size)) { /* If extra_requested is below percentage threshold, extend block into the aggregator. */ if (extra_requested <= (hsize_t)(EXTEND_THRESHOLD * (float)aggr->size)) { aggr->size -= extra_requested; @@ -465,7 +453,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F (extra_requested < aggr->alloc_size) ? aggr->alloc_size : extra_requested; if ((ret_value = H5F__try_extend(f, type, (aggr->addr + aggr->size), extra)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file"); else if (ret_value == TRUE) { /* Shift the aggregator block by the extra requested */ /* (allocates the space for the extra_requested) */ @@ -512,9 +500,6 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * FALSE(0) - Section and aggregator can not be absorbed * Failure: FAIL * - * Programmer: Quincey Koziol - * Friday, February 1, 2008 - * *------------------------------------------------------------------------- */ htri_t H5MF__aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, const H5MF_free_section_t *sect, @@ -525,24 +510,24 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(f); - HDassert(aggr); - HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || - aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); - HDassert(sect); - HDassert(shrink); + assert(f); + assert(aggr); + assert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || + aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); + assert(sect); + assert(shrink); /* Check if this aggregator is active */ if (f->shared->feature_flags & aggr->feature_flag) { /* Check if the block adjoins the beginning or end of the aggregator */ - if (H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr) || - H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)) { + if (H5_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr) || + H5_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)) { #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, - "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "} adjoins aggr = {%" PRIuHADDR - ", %" PRIuHSIZE "}\n", - "H5MF__aggr_can_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, - aggr->size); + fprintf(stderr, + "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "} adjoins aggr = {%" PRIuHADDR + ", %" PRIuHSIZE "}\n", + "H5MF__aggr_can_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, + aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Check if aggregator would get too large and should be absorbed into section */ if ((aggr->size + sect->sect_info.size) >= aggr->alloc_size) @@ -551,7 +536,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F *shrink = H5MF_SHRINK_AGGR_ABSORB_SECT; /* Indicate success */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ } /* end if */ @@ -568,9 +553,6 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, February 1, 2008 - * *------------------------------------------------------------------------- */ herr_t H5MF__aggr_absorb(const H5F_t H5_ATTR_UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect, @@ -579,37 +561,37 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(f); - HDassert(aggr); - HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || - aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); - HDassert(f->shared->feature_flags & aggr->feature_flag); - HDassert(sect); + assert(f); + assert(aggr); + assert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || + aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); + assert(f->shared->feature_flags & aggr->feature_flag); + assert(sect); /* Check if aggregator would get too large and should be absorbed into section */ if ((aggr->size + sect->sect_info.size) >= aggr->alloc_size && allow_sect_absorb) { /* Check if the section adjoins the beginning or end of the aggregator */ - if (H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) { + if (H5_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) { #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, - "%s: aggr {%" PRIuHADDR ", %" PRIuHSIZE "} adjoins front of section = {%" PRIuHADDR - ", %" PRIuHSIZE "}\n", - "H5MF__aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, - sect->sect_info.size); + fprintf(stderr, + "%s: aggr {%" PRIuHADDR ", %" PRIuHSIZE "} adjoins front of section = {%" PRIuHADDR + ", %" PRIuHSIZE "}\n", + "H5MF__aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, + sect->sect_info.size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb aggregator onto end of section */ sect->sect_info.size += aggr->size; } /* end if */ else { /* Sanity check */ - HDassert(H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)); + assert(H5_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)); #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, - "%s: aggr {%" PRIuHADDR ", %" PRIuHSIZE "} adjoins end of section = {%" PRIuHADDR - ", %" PRIuHSIZE "}\n", - "H5MF__aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, - sect->sect_info.size); + fprintf(stderr, + "%s: aggr {%" PRIuHADDR ", %" PRIuHSIZE "} adjoins end of section = {%" PRIuHADDR + ", %" PRIuHSIZE "}\n", + "H5MF__aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, + sect->sect_info.size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb aggregator onto beginning of section */ sect->sect_info.addr -= aggr->size; @@ -623,13 +605,13 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F } /* end if */ else { /* Check if the section adjoins the beginning or end of the aggregator */ - if (H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) { + if (H5_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) { #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, - "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "} adjoins front of aggr = {%" PRIuHADDR - ", %" PRIuHSIZE "}\n", - "H5MF__aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, - aggr->size); + fprintf(stderr, + "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "} adjoins front of aggr = {%" PRIuHADDR + ", %" PRIuHSIZE "}\n", + "H5MF__aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, + aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb section onto front of aggregator */ aggr->addr -= sect->sect_info.size; @@ -642,20 +624,20 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F } /* end if */ else { /* Sanity check */ - HDassert(H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)); + assert(H5_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)); #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, - "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "} adjoins end of aggr = {%" PRIuHADDR - ", %" PRIuHSIZE "}\n", - "H5MF__aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, - aggr->size); + fprintf(stderr, + "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "} adjoins end of aggr = {%" PRIuHADDR + ", %" PRIuHSIZE "}\n", + "H5MF__aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, + aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb section onto end of aggregator */ aggr->size += sect->sect_info.size; } /* end if */ /* Sanity check */ - HDassert(!allow_sect_absorb || (aggr->size < aggr->alloc_size)); + assert(!allow_sect_absorb || (aggr->size < aggr->alloc_size)); } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -669,9 +651,6 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, December 13, 2007 - * *------------------------------------------------------------------------- */ herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, hsize_t *size) @@ -679,10 +658,10 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(f); - HDassert(aggr); - HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || - aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); + assert(f); + assert(aggr); + assert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || + aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); /* Check if this aggregator is active */ if (f->shared->feature_flags & aggr->feature_flag) { @@ -703,9 +682,6 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, December 13, 2007 - * *------------------------------------------------------------------------- */ static herr_t H5MF__aggr_reset(H5F_t * f, H5F_blk_aggr_t * aggr) @@ -716,10 +692,10 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(aggr); - HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || - aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); + assert(f); + assert(aggr); + assert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || + aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); /* Set the type of memory in the file */ alloc_type = (aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA @@ -735,8 +711,8 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F tmp_addr = aggr->addr; tmp_size = aggr->size; #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: tmp_addr = %" PRIuHADDR ", tmp_size = %" PRIuHSIZE "\n", __func__, - tmp_addr, tmp_size); + fprintf(stderr, "%s: tmp_addr = %" PRIuHADDR ", tmp_size = %" PRIuHSIZE "\n", __func__, tmp_addr, + tmp_size); #endif /* H5MF_AGGR_DEBUG */ /* Reset aggregator block information */ @@ -747,7 +723,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F /* Return the unused portion of the metadata block to the file */ if (tmp_size > 0 && (H5F_INTENT(f) & H5F_ACC_RDWR)) if (H5MF_xfree(f, alloc_type, tmp_addr, tmp_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't release aggregator's free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't release aggregator's free space"); } /* end if */ done: @@ -763,9 +739,6 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi - * July 1st, 2009 - * *------------------------------------------------------------------------- */ herr_t H5MF_free_aggrs(H5F_t * f) @@ -781,22 +754,22 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(f); - HDassert(f->shared); - HDassert(f->shared->lf); + assert(f); + assert(f->shared); + assert(f->shared->lf); /* Retrieve metadata aggregator info, if available */ if (H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats"); /* Retrieve 'small data' aggregator info, if available */ if (H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats"); /* Make certain we release the aggregator that's later in the file first */ /* (so the file shrinks properly) */ - if (H5F_addr_defined(ma_addr) && H5F_addr_defined(sda_addr)) { - if (H5F_addr_lt(ma_addr, sda_addr)) { + if (H5_addr_defined(ma_addr) && H5_addr_defined(sda_addr)) { + if (H5_addr_lt(ma_addr, sda_addr)) { first_aggr = &(f->shared->sdata_aggr); second_aggr = &(f->shared->meta_aggr); } /* end if */ @@ -814,9 +787,9 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * to the free lists in the file. */ if (H5MF__aggr_reset(f, first_aggr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset metadata block") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset metadata block"); if (H5MF__aggr_reset(f, second_aggr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset 'small data' block") + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't reset 'small data' block"); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF_free_aggrs() */ @@ -829,8 +802,6 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * Return: Success: non-negative (TRUE/FALSE) * Failure: negative * - * Programmer: Vailin Choi - * *------------------------------------------------------------------------- */ static htri_t H5MF__aggr_can_shrink_eoa(H5F_t * f, H5FD_mem_t type, H5F_blk_aggr_t * aggr) @@ -841,18 +812,18 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(aggr); - HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || - aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); + assert(f); + assert(aggr); + assert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || + aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); /* Get the EOA for the file */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa"); /* Check if the aggregator is at EOA */ - if (aggr->size > 0 && H5F_addr_defined(aggr->addr)) - ret_value = H5F_addr_eq(eoa, aggr->addr + aggr->size); + if (aggr->size > 0 && H5_addr_defined(aggr->addr)) + ret_value = H5_addr_eq(eoa, aggr->addr + aggr->size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -868,8 +839,6 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi - * *------------------------------------------------------------------------- */ static herr_t H5MF__aggr_free(H5F_t * f, H5FD_mem_t type, H5F_blk_aggr_t * aggr) @@ -879,19 +848,19 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(f->shared->lf); - HDassert(aggr); - HDassert(H5F_addr_defined(aggr->addr)); - HDassert(aggr->size > 0); - HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); - HDassert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || - aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); - HDassert(f->shared->feature_flags & aggr->feature_flag); + assert(f); + assert(f->shared->lf); + assert(aggr); + assert(H5_addr_defined(aggr->addr)); + assert(aggr->size > 0); + assert(H5F_INTENT(f) & H5F_ACC_RDWR); + assert(aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA || + aggr->feature_flag == H5FD_FEAT_AGGREGATE_SMALLDATA); + assert(f->shared->feature_flags & aggr->feature_flag); /* Free the remaining space at EOA in the aggregator */ if (H5F__free(f, type, aggr->addr, aggr->size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregation block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free aggregation block"); /* Reset the aggregator */ aggr->tot_size = 0; @@ -911,8 +880,6 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi - * *------------------------------------------------------------------------- */ htri_t H5MF__aggrs_try_shrink_eoa(H5F_t * f) @@ -924,20 +891,20 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(f->shared); + assert(f); + assert(f->shared); if ((ma_status = H5MF__aggr_can_shrink_eoa(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr))) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats"); if (ma_status > 0) if (H5MF__aggr_free(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa"); if ((sda_status = H5MF__aggr_can_shrink_eoa(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr))) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats"); if (sda_status > 0) if (H5MF__aggr_free(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa"); ret_value = (ma_status || sda_status); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5MFdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5MFdbg.c index 2184302578..3c5060f84e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5MFdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5MFdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5MFdbg.c - * Jan 31 2008 - * Quincey Koziol * * Purpose: File memory management debugging functions. * @@ -83,9 +80,6 @@ static herr_t H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * January 31 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -100,29 +94,29 @@ H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) /* * Check arguments. */ - HDassert(sect); - HDassert(udata); + assert(sect); + assert(udata); /* Print generic section information */ - HDfprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, "Section type:", - (sect->sect_info.type == H5MF_FSPACE_SECT_SIMPLE - ? "simple" - : (sect->sect_info.type == H5MF_FSPACE_SECT_SMALL - ? "small" - : (sect->sect_info.type == H5MF_FSPACE_SECT_LARGE ? "large" : "unknown")))); - HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, - "Section address:", sect->sect_info.addr); - HDfprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\n", udata->indent, "", udata->fwidth, - "Section size:", sect->sect_info.size); - HDfprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, - "End of section:", (haddr_t)((sect->sect_info.addr + sect->sect_info.size) - 1)); - HDfprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, - "Section state:", (sect->sect_info.state == H5FS_SECT_LIVE ? "live" : "serialized")); + fprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, "Section type:", + (sect->sect_info.type == H5MF_FSPACE_SECT_SIMPLE + ? "simple" + : (sect->sect_info.type == H5MF_FSPACE_SECT_SMALL + ? "small" + : (sect->sect_info.type == H5MF_FSPACE_SECT_LARGE ? "large" : "unknown")))); + fprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, + "Section address:", sect->sect_info.addr); + fprintf(udata->stream, "%*s%-*s %" PRIuHSIZE "\n", udata->indent, "", udata->fwidth, + "Section size:", sect->sect_info.size); + fprintf(udata->stream, "%*s%-*s %" PRIuHADDR "\n", udata->indent, "", udata->fwidth, + "End of section:", (haddr_t)((sect->sect_info.addr + sect->sect_info.size) - 1)); + fprintf(udata->stream, "%*s%-*s %s\n", udata->indent, "", udata->fwidth, + "Section state:", (sect->sect_info.state == H5FS_SECT_LIVE ? "live" : "serialized")); /* Dump section-specific debugging information */ if (H5FS_sect_debug(udata->fspace, _sect, udata->stream, udata->indent + 3, MAX(0, udata->fwidth - 3)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_BADITER, FAIL, "can't dump section's debugging info") + HGOTO_ERROR(H5E_RESOURCE, H5E_BADITER, FAIL, "can't dump section's debugging info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -135,9 +129,6 @@ H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * January 31 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -151,16 +142,16 @@ H5MF_sects_debug(H5F_t *f, haddr_t fs_addr, FILE *stream, int indent, int fwidth /* * Check arguments. */ - HDassert(f); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); for (type = H5F_MEM_PAGE_DEFAULT; type < H5F_MEM_PAGE_NTYPES; type++) - if (H5F_addr_eq(f->shared->fs_addr[type], fs_addr)) { + if (H5_addr_eq(f->shared->fs_addr[type], fs_addr)) { if (!f->shared->fs_man[type]) if (H5MF__open_fstype(f, type) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space"); if (f->shared->fs_man[type]) { H5MF_debug_iter_ud_t udata; /* User data for callbacks */ @@ -173,11 +164,11 @@ H5MF_sects_debug(H5F_t *f, haddr_t fs_addr, FILE *stream, int indent, int fwidth /* Iterate over all the free space sections */ if (H5FS_sect_iterate(f, f->shared->fs_man[type], H5MF__sects_debug_cb, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space"); /* Close the free space information */ if (H5FS_close(f, f->shared->fs_man[type]) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release free space info"); } /* end if */ break; } /* end if */ @@ -195,9 +186,6 @@ H5MF_sects_debug(H5F_t *f, haddr_t fs_addr, FILE *stream, int indent, int fwidth * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 31 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -210,20 +198,20 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Dumping file free space sections\n", __func__); + fprintf(stderr, "%s: Dumping file free space sections\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* * Check arguments. */ - HDassert(f); - HDassert(stream); + assert(f); + assert(stream); /* Retrieve the 'eoa' for the file */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed"); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %" PRIuHADDR "\n", __func__, eoa); + fprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %" PRIuHADDR "\n", __func__, eoa); #endif /* H5MF_ALLOC_DEBUG */ if (H5F_PAGED_AGGR(f)) { /* File space paging */ @@ -231,10 +219,10 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) for (ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { /* Print header for type */ - HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)ptype); + fprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)ptype); /* Print header for sections */ - HDfprintf(stream, "%*sSections:\n", indent + 3, ""); + fprintf(stream, "%*sSections:\n", indent + 3, ""); /* If there is a free space manager for this type, iterate over them */ if (f->shared->fs_man[ptype]) { @@ -248,11 +236,11 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) /* Iterate over all the free space sections */ if (H5FS_sect_iterate(f, f->shared->fs_man[ptype], H5MF__sects_debug_cb, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space"); } /* end if */ else /* No sections of this type */ - HDfprintf(stream, "%*s\n", indent + 6, ""); + fprintf(stream, "%*s\n", indent + 6, ""); } /* end for */ } /* end if */ else { /* not file space paging */ @@ -265,34 +253,33 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) /* Retrieve metadata aggregator info, if available */ H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, - "%s: ma_addr = %" PRIuHADDR ", ma_size = %" PRIuHSIZE ", end of ma = %" PRIuHADDR "\n", - __func__, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); + fprintf(stderr, + "%s: ma_addr = %" PRIuHADDR ", ma_size = %" PRIuHSIZE ", end of ma = %" PRIuHADDR "\n", + __func__, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Retrieve 'small data' aggregator info, if available */ H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, - "%s: sda_addr = %" PRIuHADDR ", sda_size = %" PRIuHSIZE ", end of sda = %" PRIuHADDR "\n", - __func__, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); + fprintf(stderr, + "%s: sda_addr = %" PRIuHADDR ", sda_size = %" PRIuHSIZE ", end of sda = %" PRIuHADDR "\n", + __func__, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Iterate over all the free space types that have managers and dump each free list's space */ for (atype = H5FD_MEM_DEFAULT; atype < H5FD_MEM_NTYPES; atype++) { /* Print header for type */ - HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)atype); + fprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)atype); /* Check for this type being mapped to another type */ if (H5FD_MEM_DEFAULT == f->shared->fs_type_map[atype] || atype == f->shared->fs_type_map[atype]) { /* Retrieve the 'eoa' for this file memory type */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, atype))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3), - "eoa:", eoa); + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed"); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3), "eoa:", eoa); /* Print header for sections */ - HDfprintf(stream, "%*sSections:\n", indent + 3, ""); + fprintf(stream, "%*sSections:\n", indent + 3, ""); /* If there is a free space manager for this type, iterate over them */ if (f->shared->fs_man[atype]) { @@ -306,19 +293,19 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) /* Iterate over all the free space sections */ if (H5FS_sect_iterate(f, f->shared->fs_man[atype], H5MF__sects_debug_cb, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") + HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space"); } /* end if */ else /* No sections of this type */ - HDfprintf(stream, "%*s\n", indent + 6, ""); + fprintf(stream, "%*s\n", indent + 6, ""); } /* end if */ else - HDfprintf(stream, "%*sMapped to type = %u\n", indent, "", - (unsigned)f->shared->fs_type_map[atype]); + fprintf(stream, "%*sMapped to type = %u\n", indent, "", + (unsigned)f->shared->fs_type_map[atype]); } /* end for */ } /* end else */ done: - HDfprintf(stderr, "%s: Done dumping file free space sections\n", __func__); + fprintf(stderr, "%s: Done dumping file free space sections\n", __func__); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF__sects_dump() */ #endif /* H5MF_ALLOC_DEBUG_DUMP */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5MFsection.c b/externals/coda-oss/modules/drivers/hdf5/source/H5MFsection.c index d9fc355cd4..ede7912860 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5MFsection.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5MFsection.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * * Purpose: Free space section callbacks for file. * */ @@ -167,7 +163,7 @@ const H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{ /*******************/ /* Declare a free list to manage the H5MF_free_section_t struct */ -H5FL_DEFINE(H5MF_free_section_t); +H5FL_DEFINE_STATIC(H5MF_free_section_t); /* * "simple/small/large" section callbacks @@ -180,9 +176,6 @@ H5FL_DEFINE(H5MF_free_section_t); * * Return: Pointer to new section on success/NULL on failure * - * Programmer: Quincey Koziol - * January 8 2008 - * *------------------------------------------------------------------------- */ H5MF_free_section_t * @@ -194,12 +187,12 @@ H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect_size); + assert(sect_size); /* Create free space section node */ if (NULL == (sect = H5FL_MALLOC(H5MF_free_section_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for direct block free list section") + "memory allocation failed for direct block free list section"); /* Set the information passed in */ sect->sect_info.addr = sect_off; @@ -224,9 +217,6 @@ H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -237,7 +227,7 @@ H5MF__sect_free(H5FS_section_info_t *_sect) FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect); + assert(sect); /* Release the section */ sect = H5FL_FREE(H5MF_free_section_t, sect); @@ -253,9 +243,6 @@ H5MF__sect_free(H5FS_section_info_t *_sect) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * *------------------------------------------------------------------------- */ static H5FS_section_info_t * @@ -268,13 +255,13 @@ H5MF__sect_deserialize(const H5FS_section_class_t *cls, const uint8_t H5_ATTR_UN FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(cls); - HDassert(H5F_addr_defined(sect_addr)); - HDassert(sect_size); + assert(cls); + assert(H5_addr_defined(sect_addr)); + assert(sect_size); /* Create free space section for block */ if (NULL == (sect = H5MF__sect_new(cls->type, sect_addr, sect_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section"); /* Set return value */ ret_value = (H5FS_section_info_t *)sect; @@ -291,9 +278,6 @@ H5MF__sect_deserialize(const H5FS_section_class_t *cls, const uint8_t H5_ATTR_UN * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -310,7 +294,7 @@ H5MF__sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5FS_sect FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect); + assert(sect); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5MF__sect_valid() */ @@ -324,8 +308,6 @@ H5MF__sect_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5FS_sect * Return: Success: the fragment for aligning sect * Failure: null * - * Programmer: Vailin Choi, July 29, 2008 - * *------------------------------------------------------------------------- */ static H5FS_section_info_t * @@ -337,7 +319,7 @@ H5MF__sect_split(H5FS_section_info_t *sect, hsize_t frag_size) /* Allocate space for new section */ if (NULL == (ret_value = H5MF__sect_new(sect->type, sect->addr, frag_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section"); /* Set new section's info */ sect->addr += frag_size; @@ -361,9 +343,6 @@ H5MF__sect_split(H5FS_section_info_t *sect, hsize_t frag_size) * Return: Success: non-negative (TRUE/FALSE) * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * *------------------------------------------------------------------------- */ static htri_t @@ -377,13 +356,13 @@ H5MF__sect_simple_can_merge(const H5FS_section_info_t *_sect1, const H5FS_sectio FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect1); - HDassert(sect2); - HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ - HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); + assert(sect1); + assert(sect2); + assert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ + assert(H5_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); /* Check if second section adjoins first section */ - ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr); + ret_value = H5_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr); FUNC_LEAVE_NOAPI(ret_value) } /* H5MF__sect_simple_can_merge() */ @@ -398,9 +377,6 @@ H5MF__sect_simple_can_merge(const H5FS_section_info_t *_sect1, const H5FS_sectio * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -414,18 +390,18 @@ H5MF__sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect1); - HDassert((*sect1)->sect_info.type == H5MF_FSPACE_SECT_SIMPLE); - HDassert(sect2); - HDassert(sect2->sect_info.type == H5MF_FSPACE_SECT_SIMPLE); - HDassert(H5F_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr)); + assert(sect1); + assert((*sect1)->sect_info.type == H5MF_FSPACE_SECT_SIMPLE); + assert(sect2); + assert(sect2->sect_info.type == H5MF_FSPACE_SECT_SIMPLE); + assert(H5_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr)); /* Add second section's size to first section */ (*sect1)->sect_info.size += sect2->sect_info.size; /* Get rid of second section */ if (H5MF__sect_free((H5FS_section_info_t *)sect2) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -439,9 +415,6 @@ H5MF__sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect * Return: Success: non-negative (TRUE/FALSE) * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * *------------------------------------------------------------------------- */ static htri_t @@ -456,34 +429,33 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect); - HDassert(udata); - HDassert(udata->f); + assert(sect); + assert(udata); + assert(udata->f); /* Retrieve the end of the file's address space */ if (HADDR_UNDEF == (eoa = H5F_get_eoa(udata->f, udata->alloc_type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed"); /* Compute address of end of section to check */ end = sect->sect_info.addr + sect->sect_info.size; /* Check if the section is exactly at the end of the allocated space in the file */ - if (H5F_addr_eq(end, eoa)) { + if (H5_addr_eq(end, eoa)) { /* Set the shrinking type */ udata->shrink = H5MF_SHRINK_EOA; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, - "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, shrinks file, eoa = %" PRIuHADDR "\n", - __func__, sect->sect_info.addr, sect->sect_info.size, eoa); + fprintf(stderr, "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, shrinks file, eoa = %" PRIuHADDR "\n", + __func__, sect->sect_info.addr, sect->sect_info.size, eoa); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Indicate shrinking can occur */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ else { /* Shrinking can't occur if the 'eoa_shrink_only' flag is set and we're not shrinking the EOA */ if (udata->allow_eoa_shrink_only) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Check if this section is allowed to merge with metadata aggregation block */ if (udata->f->shared->fs_aggr_merge[udata->alloc_type] & H5F_FS_MERGE_METADATA) { @@ -492,18 +464,18 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* See if section can absorb the aggregator & vice versa */ if ((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect, &(udata->shrink))) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, + "error merging section with aggregation block"); else if (status > 0) { /* Set the aggregator to operate on */ udata->aggr = &(udata->f->shared->meta_aggr); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, - "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, adjoins metadata aggregator\n", - __func__, sect->sect_info.addr, sect->sect_info.size); + fprintf(stderr, "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, adjoins metadata aggregator\n", + __func__, sect->sect_info.addr, sect->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Indicate shrinking can occur */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ } /* end if */ @@ -514,18 +486,19 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* See if section can absorb the aggregator & vice versa */ if ((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect, &(udata->shrink))) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, + "error merging section with aggregation block"); else if (status > 0) { /* Set the aggregator to operate on */ udata->aggr = &(udata->f->shared->sdata_aggr); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, - "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, adjoins small data aggregator\n", - __func__, sect->sect_info.addr, sect->sect_info.size); + fprintf(stderr, + "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, adjoins small data aggregator\n", + __func__, sect->sect_info.addr, sect->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Indicate shrinking can occur */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ } /* end if */ } /* end else */ @@ -545,9 +518,6 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, January 8, 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -560,34 +530,34 @@ H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect); - HDassert(udata); - HDassert(udata->f); + assert(sect); + assert(udata); + assert(udata->f); /* Check for shrinking file */ if (H5MF_SHRINK_EOA == udata->shrink) { /* Sanity check */ - HDassert(H5F_INTENT(udata->f) & H5F_ACC_RDWR); + assert(H5F_INTENT(udata->f) & H5F_ACC_RDWR); /* Release section's space at EOA */ if (H5F__free(udata->f, udata->alloc_type, (*sect)->sect_info.addr, (*sect)->sect_info.size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed"); } /* end if */ else { /* Sanity check */ - HDassert(udata->aggr); + assert(udata->aggr); /* Absorb the section into the aggregator or vice versa */ if (H5MF__aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, - "can't absorb section into aggregator or vice versa") + "can't absorb section into aggregator or vice versa"); } /* end else */ /* Check for freeing section */ if (udata->shrink != H5MF_SHRINK_SECT_ABSORB_AGGR) { /* Free section */ if (H5MF__sect_free((H5FS_section_info_t *)*sect) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node"); /* Mark section as freed, for free space manager */ *sect = NULL; @@ -612,8 +582,6 @@ H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -628,8 +596,8 @@ H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata) FUNC_ENTER_PACKAGE #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Entering, section {%" PRIuHADDR ", %" PRIuHSIZE "}\n", __func__, - (*sect)->sect_info.addr, (*sect)->sect_info.size); + fprintf(stderr, "%s: Entering, section {%" PRIuHADDR ", %" PRIuHSIZE "}\n", __func__, + (*sect)->sect_info.addr, (*sect)->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Do not adjust the section raw data or global heap data */ @@ -644,20 +612,20 @@ H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata) if (!rem && (*sect)->sect_info.size <= H5F_PGEND_META_THRES(udata->f) && (*flags & H5FS_ADD_RETURNED_SPACE)) { if (H5MF__sect_free((H5FS_section_info_t *)(*sect)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node"); *sect = NULL; *flags &= (unsigned)~H5FS_ADD_RETURNED_SPACE; *flags |= H5FS_PAGE_END_NO_ADD; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section is dropped\n", __func__); + fprintf(stderr, "%s: section is dropped\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ /* Adjust the section if it is not at page end but its size + prem is at page end */ else if (prem <= H5F_PGEND_META_THRES(udata->f)) { (*sect)->sect_info.size += prem; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section is adjusted {%" PRIuHADDR ", %" PRIuHSIZE "}\n", __func__, - (*sect)->sect_info.addr, (*sect)->sect_info.size); + fprintf(stderr, "%s: section is adjusted {%" PRIuHADDR ", %" PRIuHSIZE "}\n", __func__, + (*sect)->sect_info.addr, (*sect)->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ @@ -676,8 +644,6 @@ H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata) * Return: Success: non-negative (TRUE/FALSE) * Failure: negative * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ static htri_t @@ -691,13 +657,13 @@ H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect1); - HDassert(sect2); - HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ - HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); + assert(sect1); + assert(sect2); + assert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ + assert(H5_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); /* Check if second section adjoins first section */ - ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr); + ret_value = H5_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr); if (ret_value > 0) /* If they are on different pages, couldn't merge */ if ((sect1->sect_info.addr / udata->f->shared->fs_page_size) != @@ -705,7 +671,7 @@ H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section ret_value = FALSE; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Leaving: ret_value = %d\n", __func__, ret_value); + fprintf(stderr, "%s: Leaving: ret_value = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ FUNC_LEAVE_NOAPI(ret_value) @@ -723,8 +689,6 @@ H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -738,18 +702,18 @@ H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect1); - HDassert((*sect1)->sect_info.type == H5MF_FSPACE_SECT_SMALL); - HDassert(sect2); - HDassert(sect2->sect_info.type == H5MF_FSPACE_SECT_SMALL); - HDassert(H5F_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr)); + assert(sect1); + assert((*sect1)->sect_info.type == H5MF_FSPACE_SECT_SMALL); + assert(sect2); + assert(sect2->sect_info.type == H5MF_FSPACE_SECT_SMALL); + assert(H5_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr)); /* Add second section's size to first section */ (*sect1)->sect_info.size += sect2->sect_info.size; if ((*sect1)->sect_info.size == udata->f->shared->fs_page_size) { if (H5MF_xfree(udata->f, udata->alloc_type, (*sect1)->sect_info.addr, (*sect1)->sect_info.size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section"); /* Need to free possible metadata page in the PB cache */ /* This is in response to the data corruption bug from fheap.c with page buffering + page strategy */ @@ -757,16 +721,16 @@ H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 /* Note: Update of raw data page (large or small sized) is handled by the PB cache */ if (udata->f->shared->page_buf != NULL && udata->alloc_type != H5FD_MEM_DRAW) if (H5PB_remove_entry(udata->f->shared, (*sect1)->sect_info.addr) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section"); if (H5MF__sect_free((H5FS_section_info_t *)(*sect1)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node"); *sect1 = NULL; } /* end if */ /* Get rid of second section */ if (H5MF__sect_free((H5FS_section_info_t *)sect2) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -786,8 +750,6 @@ H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 * Return: Success: non-negative (TRUE/FALSE) * Failure: negative * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ static htri_t @@ -801,15 +763,15 @@ H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ - HDassert(sect1); - HDassert(sect2); - HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ - HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); + assert(sect1); + assert(sect2); + assert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ + assert(H5_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); - ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr); + ret_value = H5_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Leaving: ret_value = %d\n", __func__, ret_value); + fprintf(stderr, "%s: Leaving: ret_value = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ FUNC_LEAVE_NOAPI(ret_value) @@ -825,8 +787,6 @@ H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -839,18 +799,18 @@ H5MF__sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect1); - HDassert((*sect1)->sect_info.type == H5MF_FSPACE_SECT_LARGE); - HDassert(sect2); - HDassert(sect2->sect_info.type == H5MF_FSPACE_SECT_LARGE); - HDassert(H5F_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr)); + assert(sect1); + assert((*sect1)->sect_info.type == H5MF_FSPACE_SECT_LARGE); + assert(sect2); + assert(sect2->sect_info.type == H5MF_FSPACE_SECT_LARGE); + assert(H5_addr_eq((*sect1)->sect_info.addr + (*sect1)->sect_info.size, sect2->sect_info.addr)); /* Add second section's size to first section */ (*sect1)->sect_info.size += sect2->sect_info.size; /* Get rid of second section */ if (H5MF__sect_free((H5FS_section_info_t *)sect2) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -864,8 +824,6 @@ H5MF__sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 * Return: Success: non-negative (TRUE/FALSE) * Failure: negative * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ static htri_t @@ -880,30 +838,29 @@ H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect); - HDassert(sect->sect_info.type == H5MF_FSPACE_SECT_LARGE); - HDassert(udata); - HDassert(udata->f); + assert(sect); + assert(sect->sect_info.type == H5MF_FSPACE_SECT_LARGE); + assert(udata); + assert(udata->f); /* Retrieve the end of the file's address space */ if (HADDR_UNDEF == (eoa = H5FD_get_eoa(udata->f->shared->lf, udata->alloc_type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed"); /* Compute address of end of section to check */ end = sect->sect_info.addr + sect->sect_info.size; /* Check if the section is exactly at the end of the allocated space in the file */ - if (H5F_addr_eq(end, eoa) && sect->sect_info.size >= udata->f->shared->fs_page_size) { + if (H5_addr_eq(end, eoa) && sect->sect_info.size >= udata->f->shared->fs_page_size) { /* Set the shrinking type */ udata->shrink = H5MF_SHRINK_EOA; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, - "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, shrinks file, eoa = %" PRIuHADDR "\n", - __func__, sect->sect_info.addr, sect->sect_info.size, eoa); + fprintf(stderr, "%s: section {%" PRIuHADDR ", %" PRIuHSIZE "}, shrinks file, eoa = %" PRIuHADDR "\n", + __func__, sect->sect_info.addr, sect->sect_info.size, eoa); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Indicate shrinking can occur */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ done: @@ -918,8 +875,6 @@ H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; Dec 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -933,13 +888,13 @@ H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(sect); - HDassert((*sect)->sect_info.type == H5MF_FSPACE_SECT_LARGE); - HDassert(udata); - HDassert(udata->f); - HDassert(udata->shrink == H5MF_SHRINK_EOA); - HDassert(H5F_INTENT(udata->f) & H5F_ACC_RDWR); - HDassert(H5F_PAGED_AGGR(udata->f)); + assert(sect); + assert((*sect)->sect_info.type == H5MF_FSPACE_SECT_LARGE); + assert(udata); + assert(udata->f); + assert(udata->shrink == H5MF_SHRINK_EOA); + assert(H5F_INTENT(udata->f) & H5F_ACC_RDWR); + assert(H5F_PAGED_AGGR(udata->f)); /* Calculate possible mis-aligned fragment */ H5MF_EOA_MISALIGN(udata->f, (*sect)->sect_info.addr, udata->f->shared->fs_page_size, frag_size); @@ -948,14 +903,14 @@ H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *_udata) /* Retain partial page in the free-space manager so as to keep EOA at page boundary */ if (H5F__free(udata->f, udata->alloc_type, (*sect)->sect_info.addr + frag_size, (*sect)->sect_info.size - frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "driver free request failed"); if (frag_size) /* Adjust section size for the partial page */ (*sect)->sect_info.size = frag_size; else { /* Free section */ if (H5MF__sect_free((H5FS_section_info_t *)*sect) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node"); /* Mark section as freed, for free space manager */ *sect = NULL; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5MM.c b/externals/coda-oss/modules/drivers/hdf5/source/H5MM.c index 68c8633015..609f94610a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5MM.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5MM.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5MM.c - * Jul 10 1997 - * Robb Matzke * * Purpose: Memory management functions * @@ -36,45 +33,14 @@ /****************/ /* Local Macros */ /****************/ -#if defined H5_MEMORY_ALLOC_SANITY_CHECK -#define H5MM_SIG_SIZE 4 -#define H5MM_HEAD_GUARD_SIZE 8 -#define H5MM_TAIL_GUARD_SIZE 8 -#define H5MM_BLOCK_FROM_BUF(mem) \ - ((H5MM_block_t *)((void *)((unsigned char *)mem - (offsetof(H5MM_block_t, b) + H5MM_HEAD_GUARD_SIZE)))) -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ /******************/ /* Local Typedefs */ /******************/ -#if defined H5_MEMORY_ALLOC_SANITY_CHECK -/* Memory allocation "block", wrapped around each allocation */ -struct H5MM_block_t; /* Forward declaration for typedef */ -typedef struct H5MM_block_t { - unsigned char - sig[H5MM_SIG_SIZE]; /* Signature for the block, to indicate it was allocated with H5MM* interface */ - struct H5MM_block_t *next; /* Pointer to next block in the list of allocated blocks */ - struct H5MM_block_t *prev; /* Pointer to previous block in the list of allocated blocks */ - union { - struct { - size_t size; /* Size of allocated block */ - hbool_t in_use; /* Whether the block is in use or is free */ - } info; - double _align; /* Align following buffer (b) to double boundary (unused) */ - } u; - unsigned char b[]; /* Buffer for caller (includes header and footer) */ -} H5MM_block_t; -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ - /********************/ /* Local Prototypes */ /********************/ -#if defined H5_MEMORY_ALLOC_SANITY_CHECK -static hbool_t H5MM__is_our_block(void *mem); -static void H5MM__sanity_check_block(const H5MM_block_t *block); -static void H5MM__sanity_check(void *mem); -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ /*********************/ /* Package Variables */ @@ -88,152 +54,6 @@ static void H5MM__sanity_check(void *mem); /* Local Variables */ /*******************/ -#if defined H5_MEMORY_ALLOC_SANITY_CHECK -/* Constant strings for block signature, head & tail guards */ -static const char H5MM_block_signature_s[H5MM_SIG_SIZE] = {'H', '5', 'M', 'M'}; -static const char H5MM_block_head_guard_s[H5MM_HEAD_GUARD_SIZE] = {'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F'}; -static const char H5MM_block_tail_guard_s[H5MM_TAIL_GUARD_SIZE] = {'B', 'E', 'E', 'F', 'D', 'E', 'A', 'D'}; - -/* Flag to indicate the the interface has been initialized */ -static hbool_t H5MM_init_s = FALSE; - -/* Head of the list of allocated blocks */ -static H5MM_block_t H5MM_block_head_s; - -/* Statistics about block allocations */ -static unsigned long long H5MM_total_alloc_bytes_s = 0; -static size_t H5MM_curr_alloc_bytes_s = 0; -static size_t H5MM_peak_alloc_bytes_s = 0; -static size_t H5MM_max_block_size_s = 0; -static size_t H5MM_total_alloc_blocks_count_s = 0; -static size_t H5MM_curr_alloc_blocks_count_s = 0; -static size_t H5MM_peak_alloc_blocks_count_s = 0; -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ - -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - -/*------------------------------------------------------------------------- - * Function: H5MM__is_our_block - * - * Purpose: Try to determine if a memory buffer has been allocated through - * the H5MM* interface, instead of the system's malloc() routines. - * - * Return: Success: TRUE/FALSE - * Failure: (Can't fail) - * - * Programmer: Quincey Koziol - * Dec 30 2015 - * - *------------------------------------------------------------------------- - */ -static hbool_t -H5MM__is_our_block(void *mem) -{ - H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); - - return (0 == HDmemcmp(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE)); -} - -/*------------------------------------------------------------------------- - * Function: H5MM__sanity_check_block - * - * Purpose: Check a block wrapper around a buffer to validate it. - * - * Return: N/A (void) - * - * Programmer: Quincey Koziol - * Dec 30 2015 - * - *------------------------------------------------------------------------- - */ -static void -H5MM__sanity_check_block(const H5MM_block_t *block) -{ - HDassert(block->u.info.size > 0); - HDassert(block->u.info.in_use); - /* Check for head & tail guards, if not head of linked list */ - if (block->u.info.size != SIZE_MAX) { - HDassert(0 == HDmemcmp(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE)); - HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->u.info.size, H5MM_block_tail_guard_s, - H5MM_TAIL_GUARD_SIZE)); - } -} - -/*------------------------------------------------------------------------- - * Function: H5MM__sanity_check - * - * Purpose: Check a buffer to validate it (just calls - * H5MM__sanity_check_block after finding block for buffer) - * - * Return: N/A (void) - * - * Programmer: Quincey Koziol - * Dec 30 2015 - * - *------------------------------------------------------------------------- - */ -static void -H5MM__sanity_check(void *mem) -{ - H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); - - H5MM__sanity_check_block(block); -} - -/*------------------------------------------------------------------------- - * Function: H5MM_sanity_check_all - * - * Purpose: Sanity check all current memory allocations. - * - * Return: N/A (void) - * - * Programmer: Quincey Koziol - * Jan 5 2016 - * - *------------------------------------------------------------------------- - */ -void -H5MM_sanity_check_all(void) -{ - H5MM_block_t *curr = NULL; - - curr = H5MM_block_head_s.next; - while (curr != &H5MM_block_head_s) { - H5MM__sanity_check_block(curr); - curr = curr->next; - } /* end while */ -} /* end H5MM_sanity_check_all() */ - -/*------------------------------------------------------------------------- - * Function: H5MM_final_sanity_check - * - * Purpose: Final sanity checks on memory allocation. - * - * Return: N/A (void) - * - * Programmer: Quincey Koziol - * Jan 1 2016 - * - *------------------------------------------------------------------------- - */ -void -H5MM_final_sanity_check(void) -{ - HDassert(0 == H5MM_curr_alloc_bytes_s); - HDassert(0 == H5MM_curr_alloc_blocks_count_s); - HDassert(H5MM_block_head_s.next == &H5MM_block_head_s); - HDassert(H5MM_block_head_s.prev == &H5MM_block_head_s); -#ifdef H5MM_PRINT_MEMORY_STATS - HDfprintf(stderr, "%s: H5MM_total_alloc_bytes_s = %llu\n", __func__, H5MM_total_alloc_bytes_s); - HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %zu\n", __func__, H5MM_peak_alloc_bytes_s); - HDfprintf(stderr, "%s: H5MM_max_block_size_s = %zu\n", __func__, H5MM_max_block_size_s); - HDfprintf(stderr, "%s: H5MM_total_alloc_blocks_count_s = %zu\n", __func__, - H5MM_total_alloc_blocks_count_s); - HDfprintf(stderr, "%s: H5MM_peak_alloc_blocks_count_s = %zu\n", __func__, H5MM_peak_alloc_blocks_count_s); -#endif /* H5MM_PRINT_MEMORY_STATS */ -} -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ - /*------------------------------------------------------------------------- * Function: H5MM_malloc * @@ -247,10 +67,6 @@ H5MM_final_sanity_check(void) * * Return: Success: Pointer to new memory * Failure: NULL - * - * Programmer: Quincey Koziol - * Nov 8 2003 - * *------------------------------------------------------------------------- */ void * @@ -261,60 +77,7 @@ H5MM_malloc(size_t size) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - /* Initialize block list head singleton */ - if (!H5MM_init_s) { - H5MM_memcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); - H5MM_block_head_s.next = &H5MM_block_head_s; - H5MM_block_head_s.prev = &H5MM_block_head_s; - H5MM_block_head_s.u.info.size = SIZE_MAX; - H5MM_block_head_s.u.info.in_use = TRUE; - - H5MM_init_s = TRUE; - } /* end if */ -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ - - if (size) { -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - H5MM_block_t *block; - size_t alloc_size = sizeof(H5MM_block_t) + size + H5MM_HEAD_GUARD_SIZE + H5MM_TAIL_GUARD_SIZE; - - if (NULL != (block = (H5MM_block_t *)HDmalloc(alloc_size))) { - /* Set up block */ - H5MM_memcpy(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE); - block->next = H5MM_block_head_s.next; - H5MM_block_head_s.next = block; - block->next->prev = block; - block->prev = &H5MM_block_head_s; - block->u.info.size = size; - block->u.info.in_use = TRUE; - H5MM_memcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE); - H5MM_memcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, - H5MM_TAIL_GUARD_SIZE); - - /* Update statistics */ - H5MM_total_alloc_bytes_s += size; - H5MM_curr_alloc_bytes_s += size; - if (H5MM_curr_alloc_bytes_s > H5MM_peak_alloc_bytes_s) - H5MM_peak_alloc_bytes_s = H5MM_curr_alloc_bytes_s; - if (size > H5MM_max_block_size_s) - H5MM_max_block_size_s = size; - H5MM_total_alloc_blocks_count_s++; - H5MM_curr_alloc_blocks_count_s++; - if (H5MM_curr_alloc_blocks_count_s > H5MM_peak_alloc_blocks_count_s) - H5MM_peak_alloc_blocks_count_s = H5MM_curr_alloc_blocks_count_s; - - /* Set buffer to return */ - ret_value = block->b + H5MM_HEAD_GUARD_SIZE; - } /* end if */ - else - ret_value = NULL; -#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ - ret_value = HDmalloc(size); -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ - } /* end if */ - else - ret_value = NULL; + ret_value = malloc(size); FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_malloc() */ @@ -331,13 +94,8 @@ H5MM_malloc(size_t size) * considered an error condition since allocations of zero * bytes usually indicate problems. * - * * Return: Success: Pointer to new memory * Failure: NULL - * - * Programmer: Quincey Koziol - * Nov 8 2003 - * *------------------------------------------------------------------------- */ void * @@ -348,16 +106,7 @@ H5MM_calloc(size_t size) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - if (size) { -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - if (NULL != (ret_value = H5MM_malloc(size))) - HDmemset(ret_value, 0, size); -#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ - ret_value = HDcalloc((size_t)1, size); -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ - } /* end if */ - else - ret_value = NULL; + ret_value = calloc(1, size); FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_calloc() */ @@ -378,10 +127,6 @@ H5MM_calloc(size_t size) * Return: Success: Ptr to new memory if size > 0 * NULL if size is zero * Failure: NULL (input buffer is unchanged on failure) - * - * Programmer: Robb Matzke - * Jul 10 1997 - * *------------------------------------------------------------------------- */ void * @@ -396,35 +141,12 @@ H5MM_realloc(void *mem, size_t size) /* Not defined in the standard, return NULL */ ret_value = NULL; else { -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - if (size > 0) { - if (mem) { - if (H5MM__is_our_block(mem)) { - H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); - size_t old_size = block->u.info.size; - - H5MM__sanity_check(mem); - - ret_value = H5MM_malloc(size); - H5MM_memcpy(ret_value, mem, MIN(size, old_size)); - H5MM_xfree(mem); - } /* end if */ - else - ret_value = HDrealloc(mem, size); - } - else - ret_value = H5MM_malloc(size); - } - else - ret_value = H5MM_xfree(mem); -#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ - ret_value = HDrealloc(mem, size); + ret_value = realloc(mem, size); /* Some platforms do not return NULL if size is zero. */ if (0 == size) ret_value = NULL; -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ - } /* end else */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_realloc() */ @@ -437,9 +159,6 @@ H5MM_realloc(void *mem, size_t size) * * Return: Success: Pointer to a new string (NULL if s is NULL). * Failure: NULL - * - * Programmer: Robb Matzke - * Jul 10 1997 *------------------------------------------------------------------------- */ char * @@ -449,18 +168,9 @@ H5MM_xstrdup(const char *s) FUNC_ENTER_NOAPI(NULL) -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - if (s) { - if (NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDstrcpy(ret_value, s); - } -#else if (s) if (NULL == (ret_value = HDstrdup(s))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed") -#endif - + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed"); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_xstrdup() */ @@ -476,9 +186,6 @@ H5MM_xstrdup(const char *s) * * Return: Success: Pointer to a new string * Failure: NULL - * - * Programmer: Robb Matzke - * Jul 10 1997 *------------------------------------------------------------------------- */ char * @@ -489,15 +196,9 @@ H5MM_strdup(const char *s) FUNC_ENTER_NOAPI(NULL) if (!s) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "NULL string not allowed") -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - if (NULL == (ret_value = (char *)H5MM_malloc(HDstrlen(s) + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDstrcpy(ret_value, s); -#else + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "NULL string not allowed"); if (NULL == (ret_value = HDstrdup(s))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed") -#endif + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -522,29 +223,15 @@ H5MM_strdup(const char *s) char * H5MM_strndup(const char *s, size_t n) { -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - size_t len; -#endif char *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) if (!s) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "NULL string not allowed") - -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - for (len = 0; len < n && s[len] != '\0'; len++) - ; - - if (NULL == (ret_value = H5MM_malloc(len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "NULL string not allowed"); - H5MM_memcpy(ret_value, s, len); - ret_value[len] = '\0'; -#else if (NULL == (ret_value = HDstrndup(s, n))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed") -#endif + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -553,18 +240,13 @@ H5MM_strndup(const char *s, size_t n) /*------------------------------------------------------------------------- * Function: H5MM_xfree * - * Purpose: Just like free(3) except null pointers are allowed as - * arguments, and the return value (always NULL) can be - * assigned to the pointer whose memory was just freed: + * Purpose: Just like free(3) except the return value (always NULL) can + * be assigned to the pointer whose memory was just freed: * - * thing = H5MM_xfree (thing); + * thing = H5MM_xfree(thing); * * Return: Success: NULL * Failure: never fails - * - * Programmer: Robb Matzke - * Jul 10 1997 - * *------------------------------------------------------------------------- */ void * @@ -573,37 +255,7 @@ H5MM_xfree(void *mem) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - if (mem) { -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - if (H5MM__is_our_block(mem)) { - H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); - - /* Run sanity checks on this block and its neighbors */ - H5MM__sanity_check(mem); - H5MM__sanity_check_block(block->next); - H5MM__sanity_check_block(block->prev); - - /* Update statistics */ - H5MM_curr_alloc_bytes_s -= block->u.info.size; - H5MM_curr_alloc_blocks_count_s--; - - /* Reset block info */ - HDmemset(block->sig, 0, H5MM_SIG_SIZE); - block->next->prev = block->prev; - block->prev->next = block->next; - block->next = NULL; - block->prev = NULL; - block->u.info.in_use = FALSE; - - /* Free the block (finally!) */ - HDfree(block); - } - else - HDfree(mem); -#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ - HDfree(mem); -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ - } /* end if */ + free(mem); FUNC_LEAVE_NOAPI(NULL) } /* end H5MM_xfree() */ @@ -617,7 +269,6 @@ H5MM_xfree(void *mem) * * Return: Success: NULL * Failure: never fails - * *------------------------------------------------------------------------- */ void * @@ -640,10 +291,6 @@ H5MM_xfree_const(const void *mem) * * Return: Success: pointer to dest * Failure: NULL - * - * Programmer: Dana Robinson - * Spring 2019 - * *------------------------------------------------------------------------- */ void * @@ -654,59 +301,15 @@ H5MM_memcpy(void *dest, const void *src, size_t n) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(dest); - HDassert(src); + assert(dest); + assert(src); /* Check for buffer overlap */ - const char* src_n = (const char*)src + n; - const char* dest_n = (const char*)dest + n; - HDassert((const char *)dest >= src_n || (const char *)src >= dest_n); + assert((char *)dest >= (const char *)src + n || (const char *)src >= (char *)dest + n); /* Copy */ - ret = HDmemcpy(dest, src, n); + ret = memcpy(dest, src, n); FUNC_LEAVE_NOAPI(ret) } /* end H5MM_memcpy() */ - -/*------------------------------------------------------------------------- - * Function: H5MM_get_alloc_stats - * - * Purpose: Gets the memory allocation statistics for the library, if the - * H5_MEMORY_ALLOC_SANITY_CHECK macro is defined. If the macro is not - * defined, zeros are returned. These statistics are global for the - * entire library. - * - * Parameters: - * H5_alloc_stats_t *stats; OUT: Memory allocation statistics - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Quincey Koziol - * Saturday, March 7, 2020 - * - *------------------------------------------------------------------------- - */ -herr_t -H5MM_get_alloc_stats(H5_alloc_stats_t *stats) -{ - FUNC_ENTER_NOAPI_NOERR - -#if defined H5_MEMORY_ALLOC_SANITY_CHECK - if (stats) { - stats->total_alloc_bytes = H5MM_total_alloc_bytes_s; - stats->curr_alloc_bytes = H5MM_curr_alloc_bytes_s; - stats->peak_alloc_bytes = H5MM_peak_alloc_bytes_s; - stats->max_block_size = H5MM_max_block_size_s; - stats->total_alloc_blocks_count = H5MM_total_alloc_blocks_count_s; - stats->curr_alloc_blocks_count = H5MM_curr_alloc_blocks_count_s; - stats->peak_alloc_blocks_count = H5MM_peak_alloc_blocks_count_s; - } /* end if */ -#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ - if (stats) - HDmemset(stats, 0, sizeof(H5_alloc_stats_t)); -#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5MM_get_alloc_stats() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5O.c b/externals/coda-oss/modules/drivers/hdf5/source/H5O.c index fa241c2583..fc92a6107d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5O.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5O.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -113,16 +112,16 @@ H5O__open_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **token /* name is checked in this H5VL_setup_name_args() */ /* Set up object access arguments */ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Open the object */ if (NULL == (opened_obj = H5VL_object_open(*vol_obj_ptr, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object"); /* Get an atom for the object */ if ((ret_value = H5VL_register(opened_type, opened_obj, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -146,9 +145,6 @@ H5O__open_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **token * * Failure: H5I_INVALID_HID * - * Programmer: James Laird - * July 14 2006 - * *------------------------------------------------------------------------- */ hid_t @@ -161,7 +157,7 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) /* Open the object synchronously */ if ((ret_value = H5O__open_api_common(loc_id, name, lapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to synchronously open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to synchronously open object"); done: FUNC_LEAVE_API(ret_value) @@ -195,7 +191,7 @@ H5Oopen_async(const char *app_file, const char *app_func, unsigned app_line, hid /* Open the object asynchronously */ if ((ret_value = H5O__open_api_common(loc_id, name, lapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to asynchronously open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to asynchronously open object"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -204,8 +200,8 @@ H5Oopen_async(const char *app_file, const char *app_func, unsigned app_line, hid H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID") - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID"); + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } done: @@ -241,16 +237,16 @@ H5O__open_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t idx /* Set up object access arguments */ if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Open the object */ if (NULL == (opened_obj = H5VL_object_open(*vol_obj_ptr, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object"); /* Get an ID for the object */ if ((ret_value = H5VL_register(opened_type, opened_obj, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -274,9 +270,6 @@ H5O__open_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t idx * Return: Success: An open object identifier * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol - * November 20 2006 - * *------------------------------------------------------------------------- */ hid_t @@ -291,7 +284,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ite /* Open the object synchronously */ if ((ret_value = H5O__open_by_idx_api_common(loc_id, group_name, idx_type, order, n, lapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to synchronously open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to synchronously open object"); done: FUNC_LEAVE_API(ret_value) @@ -328,7 +321,7 @@ H5Oopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li /* Open the object asynchronously */ if ((ret_value = H5O__open_by_idx_api_common(loc_id, group_name, idx_type, order, n, lapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to asynchronously open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to asynchronously open object"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -337,8 +330,8 @@ H5Oopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li H5ARG_TRACE10(__func__, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID") - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID"); + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } done: @@ -353,9 +346,6 @@ H5Oopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li * Return: Success: An open object identifier * Failure: H5I_INVALID_HID * - * Programmer: Dana Robinson - * Winter 2019 - * *------------------------------------------------------------------------- */ hid_t @@ -373,15 +363,15 @@ H5Oopen_by_token(hid_t loc_id, H5O_token_t token) /* Check args */ if (H5O_IS_TOKEN_UNDEF(token)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "can't open H5O_TOKEN_UNDEF") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "can't open H5O_TOKEN_UNDEF"); /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Get object type */ if ((vol_obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); loc_params.type = H5VL_OBJECT_BY_TOKEN; loc_params.loc_data.loc_by_token.token = &token; @@ -390,11 +380,11 @@ H5Oopen_by_token(hid_t loc_id, H5O_token_t token) /* Open the object */ if (NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object"); /* Register the object's ID */ if ((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); done: FUNC_LEAVE_API(ret_value) @@ -429,39 +419,39 @@ H5O__copy_api_common(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, c /* Check arguments */ if (!src_name || !*src_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no source name specified"); if (!dst_name || !*dst_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified"); /* Get correct property lists */ if (H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list"); /* Get object copy property list */ if (H5P_DEFAULT == ocpypl_id) ocpypl_id = H5P_OBJECT_COPY_DEFAULT; else if (TRUE != H5P_isa_class(ocpypl_id, H5P_OBJECT_COPY)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list"); /* Set the LCPL for the API context */ H5CX_set_lcpl(lcpl_id); /* Setup and check args */ if (H5VL_setup_loc_args(src_loc_id, &vol_obj1, &loc_params1) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments"); /* get the object */ if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object(dst_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); loc_params2.type = H5VL_OBJECT_BY_SELF; loc_params2.obj_type = H5I_get_type(dst_loc_id); /* Copy the object */ if (H5VL_object_copy(vol_obj1, &loc_params1, src_name, *vol_obj_ptr, &loc_params2, dst_name, ocpypl_id, lcpl_id, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -552,7 +542,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds /* To copy an object synchronously */ if (H5O__copy_api_common(src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to synchronously copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to synchronously copy object"); done: FUNC_LEAVE_API(ret_value) @@ -588,7 +578,7 @@ H5Ocopy_async(const char *app_file, const char *app_func, unsigned app_line, hid /* To copy an object asynchronously */ if (H5O__copy_api_common(src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to asynchronously copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to asynchronously copy object"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -596,7 +586,7 @@ H5Ocopy_async(const char *app_file, const char *app_func, unsigned app_line, hid if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE10(__func__, "*s*sIui*si*siii", app_file, app_func, app_line, src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -625,7 +615,7 @@ H5O__flush_api_common(hid_t obj_id, void **token_ptr, H5VL_object_t **_vol_obj_p /* Setup and check args */ if (H5VL_setup_loc_args(obj_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_OBJECT_FLUSH; @@ -634,7 +624,7 @@ H5O__flush_api_common(hid_t obj_id, void **token_ptr, H5VL_object_t **_vol_obj_p /* Flush the object */ if (H5VL_object_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -647,9 +637,6 @@ H5O__flush_api_common(hid_t obj_id, void **token_ptr, H5VL_object_t **_vol_obj_p * * Return: Non-negative on success, negative on failure * - * Programmer: Mike McGreevy - * May 19, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -662,7 +649,7 @@ H5Oflush(hid_t obj_id) /* To flush an object synchronously */ if (H5O__flush_api_common(obj_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to synchronously flush object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to synchronously flush object"); done: FUNC_LEAVE_API(ret_value) @@ -694,7 +681,7 @@ H5Oflush_async(const char *app_file, const char *app_func, unsigned app_line, hi /* Flush an object asynchronously */ if (H5O__flush_api_common(obj_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to asynchronously flush object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to asynchronously flush object"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -702,7 +689,7 @@ H5Oflush_async(const char *app_file, const char *app_func, unsigned app_line, hi if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, obj_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -731,7 +718,7 @@ H5O__refresh_api_common(hid_t oid, void **token_ptr, H5VL_object_t **_vol_obj_pt /* Setup and check args */ if (H5VL_setup_loc_args(oid, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_OBJECT_REFRESH; @@ -740,7 +727,7 @@ H5O__refresh_api_common(hid_t oid, void **token_ptr, H5VL_object_t **_vol_obj_pt /* Refresh the object */ if (H5VL_object_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -753,9 +740,6 @@ H5O__refresh_api_common(hid_t oid, void **token_ptr, H5VL_object_t **_vol_obj_pt * * Return: Non-negative on success, negative on failure * - * Programmer: Mike McGreevy - * July 28, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -768,7 +752,7 @@ H5Orefresh(hid_t oid) /* To refresh an object synchronously */ if (H5O__refresh_api_common(oid, NULL, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to synchronously refresh object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to synchronously refresh object"); done: FUNC_LEAVE_API(ret_value) @@ -800,7 +784,7 @@ H5Orefresh_async(const char *app_file, const char *app_func, unsigned app_line, /* Refresh an object asynchronously */ if (H5O__refresh_api_common(oid, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to asynchronously refresh object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to asynchronously refresh object"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -808,7 +792,7 @@ H5Orefresh_async(const char *app_file, const char *app_func, unsigned app_line, if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, oid, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -830,9 +814,6 @@ H5Orefresh_async(const char *app_file, const char *app_func, unsigned app_line, * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Tuesday, December 13, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -851,16 +832,16 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid /* Check arguments */ if (new_loc_id == H5L_SAME_LOC) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "cannot use H5L_SAME_LOC when only one location is specified") + "cannot use H5L_SAME_LOC when only one location is specified"); if (!new_name || !*new_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); /* Avoid compiler warning on 32-bit machines */ #if H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T if (HDstrlen(new_name) > H5L_MAX_LINK_NAME_LEN) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "name too long") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "name too long"); #endif /* H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T */ if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list"); /* Get the link creation property list */ if (H5P_DEFAULT == lcpl_id) @@ -871,7 +852,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up new location struct */ new_loc_params.type = H5VL_OBJECT_BY_NAME; @@ -881,11 +862,11 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid /* Get the first location object */ if (NULL == (vol_obj1 = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (H5L_SAME_LOC != new_loc_id) /* get the location object */ if (NULL == (vol_obj2 = H5VL_vol_object(new_loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Make sure that the VOL connectors are the same */ if (vol_obj1 && vol_obj2) { @@ -893,10 +874,10 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid /* Check if both objects are associated with the same VOL connector */ if (H5VL_cmp_connector_cls(&same_connector, vol_obj1->connector->cls, vol_obj2->connector->cls) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes"); if (same_connector) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "Objects are accessed through different VOL connectors and can't be linked") + "Objects are accessed through different VOL connectors and can't be linked"); } /* end if */ /* Construct a temporary VOL object */ @@ -912,7 +893,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid /* Create a link to the object */ if (H5VL_link_create(&vol_cb_args, &tmp_vol_obj, &new_loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link"); done: FUNC_LEAVE_API(ret_value) @@ -933,9 +914,6 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid * Return: Success: Non-negative * Failure: Negative * - * Programmer: James Laird - * July 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -954,11 +932,11 @@ H5Oincr_refcount(hid_t object_id) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(object_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_OBJECT_CHANGE_REF_COUNT; @@ -967,7 +945,7 @@ H5Oincr_refcount(hid_t object_id) /* Change the object's reference count */ if (H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed"); done: FUNC_LEAVE_API(ret_value) @@ -988,9 +966,6 @@ H5Oincr_refcount(hid_t object_id) * Return: Success: Non-negative * Failure: Negative * - * Programmer: James Laird - * July 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1009,11 +984,11 @@ H5Odecr_refcount(hid_t object_id) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(object_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(object_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_OBJECT_CHANGE_REF_COUNT; @@ -1022,7 +997,7 @@ H5Odecr_refcount(hid_t object_id) /* Change the object's reference count */ if (H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed"); done: FUNC_LEAVE_API(ret_value) @@ -1036,9 +1011,6 @@ H5Odecr_refcount(hid_t object_id) * Return: Success: TRUE/FALSE * Failure: FAIL * - * Programmer: Quincey Koziol - * February 2 2010 - * *------------------------------------------------------------------------- */ htri_t @@ -1055,17 +1027,17 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) /* Check args */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set the location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -1080,7 +1052,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) /* Check if the object exists */ if (H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name); /* Set return value */ ret_value = (htri_t)obj_exists; @@ -1096,9 +1068,6 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1114,9 +1083,9 @@ H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo /*out*/, unsigned fields) /* Check args */ if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL"); if (fields & ~H5O_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1124,7 +1093,7 @@ H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo /*out*/, unsigned fields) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO; @@ -1133,7 +1102,7 @@ H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo /*out*/, unsigned fields) /* Retrieve the object's information */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object"); done: FUNC_LEAVE_API(ret_value) @@ -1164,14 +1133,14 @@ H5O__get_info_by_name_api_common(hid_t loc_id, const char *name, H5O_info2_t *oi /* Check args */ if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL"); if (fields & ~H5O_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* "name" is checked in H5VL_setup_name_args() */ /* Set up object access arguments */ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO; @@ -1180,7 +1149,7 @@ H5O__get_info_by_name_api_common(hid_t loc_id, const char *name, H5O_info2_t *oi /* Retrieve the object's information */ if (H5VL_object_get(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1193,9 +1162,6 @@ H5O__get_info_by_name_api_common(hid_t loc_id, const char *name, H5O_info2_t *oi * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1209,7 +1175,7 @@ H5Oget_info_by_name3(hid_t loc_id, const char *name, H5O_info2_t *oinfo /*out*/, /* Retrieve object information synchronously */ if (H5O__get_info_by_name_api_common(loc_id, name, oinfo, fields, lapl_id, NULL, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't synchronously retrieve object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't synchronously retrieve object info"); done: FUNC_LEAVE_API(ret_value) @@ -1244,7 +1210,7 @@ H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned a /* Retrieve group information asynchronously */ if (H5O__get_info_by_name_api_common(loc_id, name, oinfo, fields, lapl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't asynchronously retrieve object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't asynchronously retrieve object info"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1252,7 +1218,7 @@ H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned a if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(__func__, "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1267,9 +1233,6 @@ H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned a * Return: Success: Non-negative * Failure: Negative * - * Programmer: Dana Robinson - * Fall 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1286,19 +1249,19 @@ H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Check args */ if (!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct"); if (fields & ~H5O_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_IDX; @@ -1311,7 +1274,7 @@ H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO; @@ -1320,7 +1283,7 @@ H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Retrieve the object's information */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object"); done: FUNC_LEAVE_API(ret_value) @@ -1333,9 +1296,6 @@ H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1352,9 +1312,9 @@ H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo /*out*/, unsigned fiel /* Check args */ if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL"); if (fields & ~H5O_NATIVE_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1362,7 +1322,7 @@ H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo /*out*/, unsigned fiel /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ obj_opt_args.get_native_info.fields = fields; @@ -1373,7 +1333,7 @@ H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo /*out*/, unsigned fiel /* Retrieve the object's information */ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object"); done: FUNC_LEAVE_API(ret_value) @@ -1386,9 +1346,6 @@ H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo /*out*/, unsigned fiel * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Fall 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1406,17 +1363,17 @@ H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oi /* Check args */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string"); if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL"); if (fields & ~H5O_NATIVE_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Fill out location struct */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -1426,7 +1383,7 @@ H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oi /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ obj_opt_args.get_native_info.fields = fields; @@ -1437,7 +1394,7 @@ H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oi /* Retrieve the object's information */ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object: '%s'", name) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object: '%s'", name); done: FUNC_LEAVE_API(ret_value) @@ -1452,9 +1409,6 @@ H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oi * Return: Success: Non-negative * Failure: Negative * - * Programmer: Dana Robinson - * Fall 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1472,19 +1426,19 @@ H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_t /* Check args */ if (!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct"); if (fields & ~H5O_NATIVE_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_IDX; @@ -1497,7 +1451,7 @@ H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_t /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ obj_opt_args.get_native_info.fields = fields; @@ -1508,7 +1462,7 @@ H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_t /* Retrieve the object's information */ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object"); done: FUNC_LEAVE_API(ret_value) @@ -1526,9 +1480,6 @@ H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_t * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * August 30 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1545,11 +1496,11 @@ H5Oset_comment(hid_t obj_id, const char *comment) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(obj_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info"); /* Fill in location struct fields */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1563,7 +1514,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) /* (Re)set the object's comment */ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object"); done: FUNC_LEAVE_API(ret_value) @@ -1581,9 +1532,6 @@ H5Oset_comment(hid_t obj_id, const char *comment) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * August 30 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1600,11 +1548,11 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_ /* Check args */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Fill in location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -1614,7 +1562,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_ /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ obj_opt_args.set_comment.comment = comment; @@ -1624,7 +1572,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_ /* (Re)set the object's comment */ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name); done: FUNC_LEAVE_API(ret_value) @@ -1641,9 +1589,6 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_ * * Failure: -1 * - * Programmer: Quincey Koziol - * August 30 2007 - * *------------------------------------------------------------------------- */ ssize_t @@ -1661,7 +1606,7 @@ H5Oget_comment(hid_t obj_id, char *comment /*out*/, size_t bufsize) /* Get the object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier"); /* Set fields in the location struct */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1677,7 +1622,7 @@ H5Oget_comment(hid_t obj_id, char *comment /*out*/, size_t bufsize) /* Retrieve the object's comment */ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object"); /* Set return value */ ret_value = (ssize_t)comment_len; @@ -1697,9 +1642,6 @@ H5Oget_comment(hid_t obj_id, char *comment /*out*/, size_t bufsize) * * Failure: -1 * - * Programmer: Quincey Koziol - * August 30 2007 - * *------------------------------------------------------------------------- */ ssize_t @@ -1717,11 +1659,11 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment /*out*/, si /* Check args */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "no name"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, (-1), "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, (-1), "can't set access property list info"); /* Fill in location struct fields */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -1731,7 +1673,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment /*out*/, si /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier"); /* Set up VOL callback arguments */ obj_opt_args.get_comment.buf = comment; @@ -1743,7 +1685,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment /*out*/, si /* Retrieve the object's comment */ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name); /* Set return value */ ret_value = (ssize_t)comment_len; @@ -1782,9 +1724,6 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment /*out*/, si * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 25 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1801,17 +1740,17 @@ H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2 /* Check args */ if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified"); if (fields & ~H5O_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1828,7 +1767,7 @@ H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2 /* Visit the objects */ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -1864,9 +1803,6 @@ H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2 * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 24 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1883,25 +1819,25 @@ H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it /* Check args */ if (!obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL"); if (!*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified"); if (fields & ~H5O_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -1920,7 +1856,7 @@ H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it /* Visit the objects */ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -1950,7 +1886,7 @@ H5O__close_check_type(hid_t object_id) case H5I_DATASET: case H5I_MAP: if (H5I_object(object_id) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid object"); break; case H5I_UNINIT: @@ -1989,9 +1925,6 @@ H5O__close_check_type(hid_t object_id) * * Return: SUCCEED/FAIL * - * Programmer: James Laird - * July 14 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2004,10 +1937,10 @@ H5Oclose(hid_t object_id) /* Validate the object type before closing */ if (H5O__close_check_type(object_id) <= 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "not a valid object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "not a valid object"); if (H5I_dec_app_ref(object_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object"); done: FUNC_LEAVE_API(ret_value) @@ -2036,13 +1969,13 @@ H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hi /* Validate the object type before closing */ if (H5O__close_check_type(object_id) <= 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "not a valid object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "not a valid object"); /* Prepare for possible asynchronous operation */ if (H5ES_NONE != es_id) { /* Get file object's connector */ if (NULL == (vol_obj = H5VL_vol_object(object_id))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get VOL object for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get VOL object for object"); /* Increase connector's refcount, so it doesn't get closed if closing * this object ID closes the file */ @@ -2057,7 +1990,7 @@ H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hi * When it reaches zero the object will be closed. */ if (H5I_dec_app_ref_async(object_id, token_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "decrementing object ID failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "decrementing object ID failed"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -2065,11 +1998,11 @@ H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, object_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: if (connector && H5VL_conn_dec_rc(connector) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "can't decrement ref count on connector") + HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "can't decrement ref count on connector"); FUNC_LEAVE_API(ret_value) } /* end H5Oclose_async() */ @@ -2094,7 +2027,7 @@ H5O__disable_mdc_flushes(H5O_loc_t *oloc) HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object"); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5O__disable_mdc_flushes() */ /*------------------------------------------------------------------------- @@ -2106,9 +2039,6 @@ H5O__disable_mdc_flushes(H5O_loc_t *oloc) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi - * January 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -2119,7 +2049,7 @@ H5Odisable_mdc_flushes(hid_t object_id) H5VL_loc_params_t loc_params; /* Location parameters */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL); + FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", object_id); /* Make sure the ID is a file object */ @@ -2144,7 +2074,7 @@ H5Odisable_mdc_flushes(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object"); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Odisable_mdc_flushes() */ /*------------------------------------------------------------------------- @@ -2167,7 +2097,7 @@ H5O__enable_mdc_flushes(H5O_loc_t *oloc) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object"); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5O__enable_mdc_flushes() */ /*------------------------------------------------------------------------- @@ -2179,9 +2109,6 @@ H5O__enable_mdc_flushes(H5O_loc_t *oloc) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi - * January 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -2192,7 +2119,7 @@ H5Oenable_mdc_flushes(hid_t object_id) H5VL_loc_params_t loc_params; /* Location parameters */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL); + FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", object_id); /* Make sure the ID is a file object */ @@ -2217,7 +2144,7 @@ H5Oenable_mdc_flushes(hid_t object_id) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object"); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* H5Oenable_mdc_flushes() */ /*------------------------------------------------------------------------- @@ -2236,7 +2163,7 @@ H5O__are_mdc_flushes_disabled(const H5O_loc_t *oloc, hbool_t *are_disabled) FUNC_ENTER_PACKAGE - HDassert(are_disabled); + assert(are_disabled); if (H5AC_cork(oloc->file, oloc->addr, H5AC__GET_CORKED, are_disabled) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve object's cork status"); @@ -2257,9 +2184,6 @@ H5O__are_mdc_flushes_disabled(const H5O_loc_t *oloc, hbool_t *are_disabled) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi - * January 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -2271,7 +2195,7 @@ H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled) H5VL_loc_params_t loc_params; /* Location parameters */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL); + FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*b", object_id, are_disabled); /* Sanity check */ @@ -2330,13 +2254,13 @@ H5Otoken_cmp(hid_t loc_id, const H5O_token_t *token1, const H5O_token_t *token2, /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (NULL == cmp_value) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid cmp_value pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid cmp_value pointer"); /* Compare the two tokens */ if (H5VL_token_cmp(vol_obj, token1, token2, cmp_value) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOMPARE, FAIL, "object token comparison failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOMPARE, FAIL, "object token comparison failed"); done: FUNC_LEAVE_API(ret_value) @@ -2364,19 +2288,19 @@ H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **token_str) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (NULL == token) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer"); if (NULL == token_str) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token string pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token string pointer"); /* Get object type */ if ((vol_obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get underlying VOL object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get underlying VOL object type"); /* Serialize the token */ if (H5VL_token_to_str(vol_obj, vol_obj_type, token, token_str) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "object token serialization failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "object token serialization failed"); done: FUNC_LEAVE_API(ret_value) @@ -2404,19 +2328,19 @@ H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (NULL == token) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer"); if (NULL == token_str) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token string pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token string pointer"); /* Get object type */ if ((vol_obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get underlying VOL object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get underlying VOL object type"); /* Deserialize the token */ if (H5VL_token_from_str(vol_obj, vol_obj_type, token_str, token) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "object token deserialization failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, "object token deserialization failed"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oainfo.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oainfo.c index 7b1598c75c..23841a6ff9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oainfo.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oainfo.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Oainfo.c - * Mar 6 2007 - * Quincey Koziol * * Purpose: Attribute Information messages. * @@ -89,38 +86,41 @@ H5FL_DEFINE_STATIC(H5O_ainfo_t); * * Return: Success: Ptr to new message in native form. * Failure: NULL - * - * Programmer: Quincey Koziol - * Mar 6 2007 - * *------------------------------------------------------------------------- */ static void * H5O__ainfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_ainfo_t *ainfo = NULL; /* Attribute info */ - unsigned char flags; /* Flags for encoding attribute info */ - void *ret_value = NULL; /* Return value */ + const uint8_t *p_end = p + p_size - 1; /* End of input buffer */ + H5O_ainfo_t *ainfo = NULL; /* Attribute info */ + unsigned char flags; /* Flags for encoding attribute info */ + uint8_t sizeof_addr; /* Size of addresses in this file */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); + + sizeof_addr = H5F_sizeof_addr(f); /* Version of message */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (*p++ != H5O_AINFO_VERSION) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message"); /* Allocate space for message */ if (NULL == (ainfo = H5FL_MALLOC(H5O_ainfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Get the flags for the message */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); flags = *p++; if (flags & ~H5O_AINFO_ALL_FLAGS) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message"); ainfo->track_corder = (flags & H5O_AINFO_TRACK_CORDER) ? TRUE : FALSE; ainfo->index_corder = (flags & H5O_AINFO_INDEX_CORDER) ? TRUE : FALSE; @@ -128,20 +128,30 @@ H5O__ainfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS ainfo->nattrs = HSIZET_MAX; /* Max. creation order value for the object */ - if (ainfo->track_corder) - UINT16DECODE(p, ainfo->max_crt_idx) + if (ainfo->track_corder) { + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT16DECODE(p, ainfo->max_crt_idx); + } else ainfo->max_crt_idx = H5O_MAX_CRT_ORDER_IDX; /* Address of fractal heap to store "dense" attributes */ + if (H5_IS_BUFFER_OVERFLOW(p, sizeof_addr, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(ainfo->fheap_addr)); /* Address of v2 B-tree to index names of attributes (names are always indexed) */ + if (H5_IS_BUFFER_OVERFLOW(p, sizeof_addr, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(ainfo->name_bt2_addr)); /* Address of v2 B-tree to index creation order of links, if there is one */ - if (ainfo->index_corder) + if (ainfo->index_corder) { + if (H5_IS_BUFFER_OVERFLOW(p, sizeof_addr, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(ainfo->corder_bt2_addr)); + } else ainfo->corder_bt2_addr = HADDR_UNDEF; @@ -162,9 +172,6 @@ H5O__ainfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 6 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -176,9 +183,9 @@ H5O__ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(ainfo); + assert(f); + assert(p); + assert(ainfo); /* Message version */ *p++ = H5O_AINFO_VERSION; @@ -202,7 +209,7 @@ H5O__ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c if (ainfo->index_corder) H5F_addr_encode(f, &p, ainfo->corder_bt2_addr); else - HDassert(!H5F_addr_defined(ainfo->corder_bt2_addr)); + assert(!H5_addr_defined(ainfo->corder_bt2_addr)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__ainfo_encode() */ @@ -216,9 +223,6 @@ H5O__ainfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: Quincey Koziol - * Mar 6 2007 - * *------------------------------------------------------------------------- */ static void * @@ -231,9 +235,9 @@ H5O__ainfo_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(ainfo); + assert(ainfo); if (!dest && NULL == (dest = H5FL_MALLOC(H5O_ainfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ *dest = *ainfo; @@ -255,9 +259,6 @@ H5O__ainfo_copy(const void *_mesg, void *_dest) * Return: Success: Message data size in bytes without alignment. * Failure: zero * - * Programmer: Quincey Koziol - * Mar 6 2007 - * *------------------------------------------------------------------------- */ static size_t @@ -289,9 +290,6 @@ H5O__ainfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, March 6, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -299,7 +297,7 @@ H5O__ainfo_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5O_ainfo_t, mesg); @@ -315,9 +313,6 @@ H5O__ainfo_free(void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, March 6, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -329,15 +324,15 @@ H5O__ainfo_delete(H5F_t *f, H5O_t H5_ATTR_NDEBUG_UNUSED *open_oh, void *_mesg) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(ainfo); - HDassert(open_oh); + assert(f); + assert(ainfo); + assert(open_oh); /* If the object is using "dense" attribute storage, delete it */ - if (H5F_addr_defined(ainfo->fheap_addr)) + if (H5_addr_defined(ainfo->fheap_addr)) /* Delete the attribute */ if (H5A__dense_delete(f, ainfo) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense attribute storage") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense attribute storage"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -352,9 +347,6 @@ H5O__ainfo_delete(H5F_t *f, H5O_t H5_ATTR_NDEBUG_UNUSED *open_oh, void *_mesg) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, March 9, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -364,8 +356,8 @@ H5O__ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUS FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(deleted); - HDassert(cpy_info); + assert(deleted); + assert(cpy_info); /* If we are not copying attributes into the destination file, indicate * that this message should be deleted. @@ -384,9 +376,6 @@ H5O__ainfo_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUS * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: Peter Cao - * July 18, 2007 - * *------------------------------------------------------------------------- */ static void * @@ -401,27 +390,27 @@ H5O__ainfo_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, void *mesg_src, H5F_ FUNC_ENTER_PACKAGE /* check args */ - HDassert(file_src); - HDassert(ainfo_src); - HDassert(file_dst); - HDassert(cpy_info); - HDassert(!cpy_info->copy_without_attr); + assert(file_src); + assert(ainfo_src); + assert(file_dst); + assert(cpy_info); + assert(!cpy_info->copy_without_attr); /* Allocate space for the destination message */ if (NULL == (ainfo_dst = H5FL_MALLOC(H5O_ainfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy the top level of the information */ *ainfo_dst = *ainfo_src; - if (H5F_addr_defined(ainfo_src->fheap_addr)) { + if (H5_addr_defined(ainfo_src->fheap_addr)) { /* Prepare to copy dense attributes - actual copy in post_copy */ /* Set copied metadata tag */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) if (H5A__dense_create(file_dst, ainfo_dst) < 0) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINIT, NULL, "unable to create dense storage for attributes"); /* Reset metadata tag */ H5_END_TAG @@ -449,9 +438,6 @@ H5O__ainfo_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, void *mesg_src, H5F_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * July 25, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -463,12 +449,12 @@ H5O__ainfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_l FUNC_ENTER_PACKAGE - HDassert(ainfo_src); + assert(ainfo_src); - if (H5F_addr_defined(ainfo_src->fheap_addr)) + if (H5_addr_defined(ainfo_src->fheap_addr)) if (H5A__dense_post_copy_file_all(src_oloc, ainfo_src, dst_oloc, (H5O_ainfo_t *)mesg_dst, cpy_info) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't copy attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't copy attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -481,9 +467,6 @@ H5O__ainfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_l * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 6 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -494,25 +477,25 @@ H5O__ainfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(ainfo); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of attributes:", ainfo->nattrs); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Track creation order of attributes:", ainfo->track_corder ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Index creation order of attributes:", ainfo->index_corder ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Max. creation index value:", (unsigned)ainfo->max_crt_idx); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "'Dense' attribute storage fractal heap address:", ainfo->fheap_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "'Dense' attribute storage name index v2 B-tree address:", ainfo->name_bt2_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "'Dense' attribute storage creation order index v2 B-tree address:", ainfo->corder_bt2_addr); + assert(f); + assert(ainfo); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of attributes:", ainfo->nattrs); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Track creation order of attributes:", ainfo->track_corder ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Index creation order of attributes:", ainfo->index_corder ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Max. creation index value:", (unsigned)ainfo->max_crt_idx); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "'Dense' attribute storage fractal heap address:", ainfo->fheap_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "'Dense' attribute storage name index v2 B-tree address:", ainfo->name_bt2_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "'Dense' attribute storage creation order index v2 B-tree address:", ainfo->corder_bt2_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__ainfo_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oalloc.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oalloc.c index 1fbcbebcf0..16bbab839f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oalloc.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oalloc.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Oalloc.c - * Nov 17 2006 - * Quincey Koziol * * Purpose: Object header allocation routines. * @@ -93,9 +90,6 @@ H5FL_EXTERN(H5O_cont_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 17 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -109,11 +103,11 @@ H5O__add_gap(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t *oh, unsigned chunkno, hbool_ FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(oh->version > H5O_VERSION_1); - HDassert(chk_dirtied); - HDassert(new_gap_loc); - HDassert(new_gap_size); + assert(oh); + assert(oh->version > H5O_VERSION_1); + assert(chk_dirtied); + assert(new_gap_loc); + assert(new_gap_size); #ifndef NDEBUG if (chunkno > 0) { @@ -122,10 +116,10 @@ H5O__add_gap(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t *oh, unsigned chunkno, hbool_ /* Check the object header chunk proxy's status in the metadata cache */ if (H5AC_get_entry_status(f, oh->chunk[chunkno].addr, &chk_proxy_status) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, - "unable to check metadata cache status for object header chunk proxy") + "unable to check metadata cache status for object header chunk proxy"); /* Make certain that object header is protected */ - HDassert(chk_proxy_status & H5AC_ES__IS_PROTECTED); + assert(chk_proxy_status & H5AC_ES__IS_PROTECTED); } /* end if */ #endif /* NDEBUG */ @@ -136,11 +130,11 @@ H5O__add_gap(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t *oh, unsigned chunkno, hbool_ /* (a null message that's not the one we are eliminating) */ if (H5O_NULL_ID == oh->mesg[u].type->id && oh->mesg[u].chunkno == chunkno && u != idx) { /* Sanity check - chunks with null messages shouldn't have a gap */ - HDassert(oh->chunk[chunkno].gap == 0); + assert(oh->chunk[chunkno].gap == 0); /* Eliminate the gap in the chunk */ if (H5O__eliminate_gap(oh, chk_dirtied, &oh->mesg[u], new_gap_loc, new_gap_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't eliminate gap in chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't eliminate gap in chunk"); /* Set flag to indicate that the gap was handled */ merged_with_null = TRUE; @@ -155,9 +149,9 @@ H5O__add_gap(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t *oh, unsigned chunkno, hbool_ oh->mesg[u].raw -= new_gap_size; /* Slide raw message info forward in chunk image */ - HDmemmove(new_gap_loc, new_gap_loc + new_gap_size, - (size_t)((oh->chunk[chunkno].image + (oh->chunk[chunkno].size - H5O_SIZEOF_CHKSUM_OH(oh))) - - (new_gap_loc + new_gap_size))); + memmove(new_gap_loc, new_gap_loc + new_gap_size, + (size_t)((oh->chunk[chunkno].image + (oh->chunk[chunkno].size - H5O_SIZEOF_CHKSUM_OH(oh))) - + (new_gap_loc + new_gap_size))); /* Add existing gap size to new gap size */ new_gap_size += oh->chunk[chunkno].gap; @@ -169,7 +163,7 @@ H5O__add_gap(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t *oh, unsigned chunkno, hbool_ /* Check if we need to extend message table to hold the new null message */ if (oh->nmesgs >= oh->alloc_nmesgs) if (H5O__alloc_msgs(oh, (size_t)1) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages"); /* Increment new gap size */ oh->chunk[chunkno].gap += new_gap_size; @@ -185,7 +179,7 @@ H5O__add_gap(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t *oh, unsigned chunkno, hbool_ /* Zero out new null message's raw data */ if (null_msg->raw_size) - HDmemset(null_msg->raw, 0, null_msg->raw_size); + memset(null_msg->raw, 0, null_msg->raw_size); /* Mark message as dirty */ null_msg->dirty = TRUE; @@ -218,9 +212,6 @@ H5O__add_gap(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t *oh, unsigned chunkno, hbool_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 17 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -232,12 +223,12 @@ H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *g FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(oh); - HDassert(oh->version > H5O_VERSION_1); - HDassert(chk_dirtied); - HDassert(mesg); - HDassert(gap_loc); - HDassert(gap_size); + assert(oh); + assert(oh->version > H5O_VERSION_1); + assert(chk_dirtied); + assert(mesg); + assert(gap_loc); + assert(gap_size); /* Check if the null message is before or after the gap produced */ null_before_gap = (hbool_t)(mesg->raw < gap_loc); @@ -274,10 +265,10 @@ H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *g /* Slide raw message info in chunk image */ if (null_before_gap) /* Slide messages down */ - HDmemmove(move_start + gap_size, move_start, (size_t)(move_end - move_start)); + memmove(move_start + gap_size, move_start, (size_t)(move_end - move_start)); else { /* Slide messages up */ - HDmemmove(move_start - gap_size, move_start, (size_t)(move_end - move_start)); + memmove(move_start - gap_size, move_start, (size_t)(move_end - move_start)); /* Adjust start of null message */ mesg->raw -= gap_size; @@ -285,14 +276,14 @@ H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *g } else if (move_end == move_start && !null_before_gap) { /* Slide null message up */ - HDmemmove(move_start - gap_size, move_start, mesg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); + memmove(move_start - gap_size, move_start, mesg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); /* Adjust start of null message */ mesg->raw -= gap_size; } /* end if */ /* Zero out addition to null message */ - HDmemset(mesg->raw + mesg->raw_size, 0, gap_size); + memset(mesg->raw + mesg->raw_size, 0, gap_size); /* Adjust size of null message */ mesg->raw_size += gap_size; @@ -315,9 +306,6 @@ H5O__eliminate_gap(H5O_t *oh, hbool_t *chk_dirtied, H5O_mesg_t *mesg, uint8_t *g * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 22 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -332,16 +320,16 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(new_type); - HDassert(new_size); + assert(oh); + assert(new_type); + assert(new_size); /* Point to null message to allocate out of */ alloc_msg = &oh->mesg[null_idx]; /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(f, oh, alloc_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk"); /* Check if there's a need to split the null message */ if (alloc_msg->raw_size > new_size) { @@ -355,7 +343,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new /* Add the gap to the chunk */ if (H5O__add_gap(f, oh, alloc_msg->chunkno, &chk_dirtied, null_idx, alloc_msg->raw + alloc_msg->raw_size, gap_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk"); } /* end if */ else { size_t new_mesg_size = @@ -365,7 +353,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new /* Check if we need to extend message table to hold the new null message */ if (oh->nmesgs >= oh->alloc_nmesgs) { if (H5O__alloc_msgs(oh, (size_t)1) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages"); /* "Retarget" 'alloc_msg' pointer into newly re-allocated array of messages */ alloc_msg = &oh->mesg[null_idx]; @@ -392,7 +380,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new ((oh->chunk[null_chunkno].image + oh->chunk[null_chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[null_chunkno].gap)), oh->chunk[null_chunkno].gap) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk"); } /* end if */ /* Set the size of the new "real" message */ @@ -411,7 +399,7 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new done: /* Release chunk */ if (chk_proxy && H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__alloc_null() */ @@ -424,9 +412,6 @@ H5O__alloc_null(H5F_t *f, H5O_t *oh, size_t null_idx, const H5O_msg_class_t *new * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 21 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -440,7 +425,7 @@ H5O__alloc_msgs(H5O_t *oh, size_t min_alloc) FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); + assert(oh); /* Initialize number of messages information */ old_alloc = oh->alloc_nmesgs; @@ -448,14 +433,14 @@ H5O__alloc_msgs(H5O_t *oh, size_t min_alloc) /* Attempt to allocate more memory */ if (NULL == (new_mesg = H5FL_SEQ_REALLOC(H5O_mesg_t, oh->mesg, na))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Update ohdr information */ oh->alloc_nmesgs = na; oh->mesg = new_mesg; /* Set new object header info to zeros */ - HDmemset(&oh->mesg[old_alloc], 0, (oh->alloc_nmesgs - old_alloc) * sizeof(H5O_mesg_t)); + memset(&oh->mesg[old_alloc], 0, (oh->alloc_nmesgs - old_alloc) * sizeof(H5O_mesg_t)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -485,8 +470,6 @@ H5O__alloc_msgs(H5O_t *oh, size_t min_alloc) * * FAIL: Some internal error has been detected. * - * Programmer: John Mainzer -- 8/16/05 - * *------------------------------------------------------------------------- */ static htri_t @@ -510,15 +493,15 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size FUNC_ENTER_PACKAGE /* check args */ - HDassert(f != NULL); - HDassert(oh != NULL); - HDassert(chunkno < oh->nchunks); - HDassert(size > 0); - HDassert(msg_idx != NULL); - HDassert(H5F_addr_defined(oh->chunk[chunkno].addr)); + assert(f != NULL); + assert(oh != NULL); + assert(chunkno < oh->nchunks); + assert(size > 0); + assert(msg_idx != NULL); + assert(H5_addr_defined(oh->chunk[chunkno].addr)); /* Test to see if the specified chunk ends with a null messages. - * If successful, set the index of the the null message in extend_msg. + * If successful, set the index of the null message in extend_msg. */ for (u = 0; u < oh->nmesgs; u++) { /* Check for null message at end of proper chunk */ @@ -536,7 +519,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size /* If we can extend an existing null message, adjust the delta appropriately */ if (extended_msg) { - HDassert(oh->chunk[chunkno].gap == 0); + assert(oh->chunk[chunkno].gap == 0); delta = aligned_size - oh->mesg[extend_msg].raw_size; } /* end if */ else @@ -548,7 +531,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size uint64_t chunk0_size; /* Size of chunk 0's data */ size_t orig_prfx_size = (size_t)1 << (oh->flags & H5O_HDR_CHUNK0_SIZE); /* Original prefix size */ - HDassert(oh->chunk[0].size >= (size_t)H5O_SIZEOF_HDR(oh)); + assert(oh->chunk[0].size >= (size_t)H5O_SIZEOF_HDR(oh)); chunk0_size = oh->chunk[0].size - (size_t)H5O_SIZEOF_HDR(oh); /* Check for moving to a 8-byte size encoding */ @@ -573,15 +556,15 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(f, oh, chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk"); /* Determine whether the chunk can be extended */ was_extended = H5MF_try_extend(f, H5FD_MEM_OHDR, oh->chunk[chunkno].addr, (hsize_t)(oh->chunk[chunkno].size), (hsize_t)(delta + extra_prfx_size)); if (was_extended < 0) /* error */ - HGOTO_ERROR(H5E_OHDR, H5E_CANTEXTEND, FAIL, "can't tell if we can extend chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTEXTEND, FAIL, "can't tell if we can extend chunk"); else if (was_extended == FALSE) /* can't extend -- we are done */ - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Adjust object header prefix flags */ if (adjust_size_flags) { @@ -590,7 +573,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size /* Mark object header as dirty in cache */ if (H5AC_mark_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty"); } /* end if */ /* If we can extend an existing null message, take care of that */ @@ -603,7 +586,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size /* Create a new null message */ if (oh->nmesgs >= oh->alloc_nmesgs) if (H5O__alloc_msgs(oh, (size_t)1) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages"); /* Set extension message */ extend_msg = oh->nmesgs++; @@ -628,17 +611,17 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size oh->chunk[chunkno].size += delta + extra_prfx_size; oh->chunk[chunkno].image = H5FL_BLK_REALLOC(chunk_image, old_image, oh->chunk[chunkno].size); if (NULL == oh->chunk[chunkno].image) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't reallocate extended object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't reallocate extended object header chunk"); oh->chunk[chunkno].gap = 0; /* Wipe new space for chunk */ - HDmemset(oh->chunk[chunkno].image + old_size, 0, oh->chunk[chunkno].size - old_size); + memset(oh->chunk[chunkno].image + old_size, 0, oh->chunk[chunkno].size - old_size); /* Move chunk 0 data up if the size flags changed */ if (adjust_size_flags) - HDmemmove(oh->chunk[0].image + H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh), - oh->chunk[0].image + H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh) - extra_prfx_size, - old_size - (size_t)H5O_SIZEOF_HDR(oh) + extra_prfx_size); + memmove(oh->chunk[0].image + H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh), + oh->chunk[0].image + H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh) - extra_prfx_size, + old_size - (size_t)H5O_SIZEOF_HDR(oh) + extra_prfx_size); /* Spin through existing messages, adjusting them */ for (u = 0; u < oh->nmesgs; u++) { @@ -657,10 +640,10 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size /* Protect chunk containing continuation message */ if (NULL == (chk_proxy2 = H5O__chunk_protect(f, oh, cont_chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk"); /* Adjust size in continuation message */ - HDassert(((H5O_cont_t *)(oh->mesg[u].native))->size == old_size); + assert(((H5O_cont_t *)(oh->mesg[u].native))->size == old_size); ((H5O_cont_t *)(oh->mesg[u].native))->size = oh->chunk[chunkno].size; /* Flag continuation message as dirty */ @@ -669,13 +652,13 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size /* Release chunk containing continuation message */ if (H5O__chunk_unprotect(f, chk_proxy2, chk_dirtied2) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); } /* end if */ } /* end for */ /* Resize the chunk in the cache */ if (H5O__chunk_resize(oh, chk_proxy) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk"); /* Set new message index */ *msg_idx = extend_msg; @@ -683,7 +666,7 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size done: /* Release chunk */ if (chk_proxy && H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__alloc_extend_chunk() */ @@ -710,9 +693,6 @@ H5O__alloc_extend_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno, size_t size, size * * Failure: Negative * - * Programmer: Quincey Koziol - * Oct 21 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -726,11 +706,11 @@ H5O__alloc_find_best_nonnull(const H5F_t *f, const H5O_t *oh, size_t *size, H5O_ FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(f); - HDassert(oh); - HDassert(size); - HDassert(*size > 0); - HDassert(found_msg); + assert(f); + assert(oh); + assert(size); + assert(*size > 0); + assert(found_msg); /* * Find the smallest message that could be moved to make room for the @@ -859,9 +839,6 @@ H5O__alloc_find_best_nonnull(const H5F_t *f, const H5O_t *oh, size_t *size, H5O_ * * Failure: Negative * - * Programmer: Quincey Koziol - * Oct 21 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -882,10 +859,10 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); - HDassert(found_msg); - HDassert(new_idx); + assert(f); + assert(oh); + assert(found_msg); + assert(new_idx); /* * The total chunk size must include the requested space plus enough @@ -893,7 +870,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ * aligned properly. */ size = MAX(H5O_MIN_SIZE, size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); - HDassert(size == H5O_ALIGN_OH(oh, size)); + assert(size == H5O_ALIGN_OH(oh, size)); /* * The total chunk size must include enough space for the checksum @@ -904,8 +881,8 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ /* Allocate space in file to hold the new chunk */ new_chunk_addr = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)size); - if (!H5F_addr_defined(new_chunk_addr)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "unable to allocate space for new chunk") + if (!H5_addr_defined(new_chunk_addr)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "unable to allocate space for new chunk"); /* Create the new chunk giving it a file address. */ if (oh->nchunks >= oh->alloc_nchunks) { @@ -913,7 +890,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ H5O_chunk_t *x; if (NULL == (x = H5FL_SEQ_REALLOC(H5O_chunk_t, oh->chunk, na))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate larger chunk array, na = %zu", na) + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate larger chunk array, na = %zu", na); oh->alloc_nchunks = na; oh->chunk = x; } /* end if */ @@ -924,7 +901,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ oh->chunk[chunkno].size = size; oh->chunk[chunkno].gap = 0; if (NULL == (oh->chunk[chunkno].image = p = H5FL_BLK_CALLOC(chunk_image, size))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate image for chunk, size = %zu", size) + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate image for chunk, size = %zu", size); oh->chunk[chunkno].chunk_proxy = NULL; /* If this is a later version of the object header format, put the magic @@ -941,7 +918,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ */ if (oh->nmesgs + 3 > oh->alloc_nmesgs) if (H5O__alloc_msgs(oh, (size_t)3) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages"); /* Check if we need to move multiple messages, in order to make room for the new message */ cont_size = H5O_ALIGN_OH(oh, (size_t)(H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f))); @@ -955,7 +932,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ /* Protect last chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(f, oh, chunkno - 1))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk"); /* Copy each message to the new location */ for (u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) @@ -963,11 +940,11 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ if (curr_msg->type->id == H5O_NULL_ID) { /* Delete the null message */ if (u < oh->nmesgs - 1) - HDmemmove(curr_msg, curr_msg + 1, ((oh->nmesgs - 1) - u) * sizeof(H5O_mesg_t)); + memmove(curr_msg, curr_msg + 1, ((oh->nmesgs - 1) - u) * sizeof(H5O_mesg_t)); oh->nmesgs--; } /* end if */ else { - HDassert(curr_msg->type->id != H5O_CONT_ID); + assert(curr_msg->type->id != H5O_CONT_ID); /* Copy the raw data */ H5MM_memcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh), @@ -998,14 +975,14 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ (size_t)H5O_SIZEOF_MSGHDR_OH(oh); null_msg->chunkno = chunkno - 1; - HDassert(null_msg->raw_size >= cont_size); + assert(null_msg->raw_size >= cont_size); /* Remove any gap in the chunk */ oh->chunk[chunkno - 1].gap = 0; /* Release chunk, marking it dirty */ if (H5O__chunk_unprotect(f, chk_proxy, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); } /* end if */ else { /* Move message (that will be replaced with continuation message) @@ -1015,7 +992,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(f, oh, oh->mesg[found_msg->msgno].chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk"); /* Create null message for space that message to copy currently occupies */ found_null = oh->nmesgs++; @@ -1041,7 +1018,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ /* Add any available space after the message to move to the new null message */ if (found_msg->gap_size > 0) { /* Absorb a gap after the moved message */ - HDassert(oh->chunk[null_msg->chunkno].gap == found_msg->gap_size); + assert(oh->chunk[null_msg->chunkno].gap == found_msg->gap_size); null_msg->raw_size += found_msg->gap_size; oh->chunk[null_msg->chunkno].gap = 0; } /* end if */ @@ -1050,8 +1027,8 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ &oh->mesg[found_msg->null_msgno]; /* Pointer to NULL message to eliminate */ /* Absorb a null message after the moved message */ - HDassert((null_msg->raw + null_msg->raw_size) == - (old_null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh))); + assert((null_msg->raw + null_msg->raw_size) == + (old_null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh))); null_msg->raw_size += found_msg->null_size; /* Release any information/memory for message */ @@ -1059,8 +1036,8 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ /* Remove null message from list of messages */ if (found_msg->null_msgno < (oh->nmesgs - 1)) - HDmemmove(old_null_msg, old_null_msg + 1, - ((oh->nmesgs - 1) - found_msg->null_msgno) * sizeof(H5O_mesg_t)); + memmove(old_null_msg, old_null_msg + 1, + ((oh->nmesgs - 1) - found_msg->null_msgno) * sizeof(H5O_mesg_t)); /* Decrement # of messages */ /* (Don't bother reducing size of message array for now -QAK) */ @@ -1075,7 +1052,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ /* Release chunk, marking it dirty */ if (H5O__chunk_unprotect(f, chk_proxy, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); } /* end if */ } /* end if */ @@ -1091,18 +1068,18 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ /* Insert the new chunk into the cache */ if (H5O__chunk_add(f, oh, chunkno, oh->mesg[found_null].chunkno) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't add new chunk to cache") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't add new chunk to cache"); /* Initialize the continuation information */ if (NULL == (cont = H5FL_MALLOC(H5O_cont_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); cont->addr = oh->chunk[chunkno].addr; cont->size = oh->chunk[chunkno].size; cont->chunkno = chunkno; /* Split the null message and point at continuation message */ if (H5O__alloc_null(f, oh, found_null, H5O_MSG_CONT, cont, cont_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't split null message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't split null message"); /* Set new message index value */ *new_idx = idx; @@ -1140,9 +1117,6 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, const H5O_ * * Failure: Negative * - * Programmer: Robb Matzke - * Aug 7 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -1156,26 +1130,26 @@ H5O__alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t *new_idx) FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(size > 0); + assert(oh); + assert(size > 0); size = H5O_ALIGN_OH(oh, size); /* Find the smallest null message that could hold a continuation message */ idx = oh->nmesgs; cont_size = H5O_ALIGN_OH(oh, (size_t)(H5F_SIZEOF_ADDR(f) + H5F_SIZEOF_SIZE(f))); if (H5O__alloc_find_best_null(oh, cont_size, &idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error while locating best null header message") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error while locating best null header message"); /* If we couldn't find a null message, locate the best message to move to new chunk */ if (idx >= oh->nmesgs) { found_msg.msgno = -1; if (H5O__alloc_find_best_nonnull(f, oh, &size, &found_msg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error while locating best non-null header message") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error while locating best non-null header message"); } /* end if */ /* Allocate and initialize new chunk in the file */ if (H5O__alloc_chunk(f, oh, size, idx, &found_msg, new_idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate new object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate new object header chunk"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1189,9 +1163,6 @@ H5O__alloc_new_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t *new_idx) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 21 2016 - * *------------------------------------------------------------------------- */ static herr_t @@ -1203,9 +1174,9 @@ H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx) FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(oh); - HDassert(size > 0); - HDassert(mesg_idx); + assert(oh); + assert(size > 0); + assert(mesg_idx); /* Find the smallest null message that could hold the new object header message */ found_null = -1; @@ -1262,9 +1233,6 @@ H5O__alloc_find_best_null(const H5O_t *oh, size_t size, size_t *mesg_idx) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1278,23 +1246,23 @@ H5O__alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const void *mesg, s FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(type); - HDassert(mesg); - HDassert(mesg_idx); + assert(oh); + assert(type); + assert(mesg); + assert(mesg_idx); /* Compute the size needed to store the message in the object header */ raw_size = (type->raw_size)(f, FALSE, mesg); if (0 == raw_size) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "can't compute object header message size") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "can't compute object header message size"); if (raw_size >= H5O_MESG_MAX_SIZE) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "object header message is too large") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "object header message is too large"); aligned_size = H5O_ALIGN_OH(oh, raw_size); /* Find the smallest null message that could hold the new object header message */ idx = oh->nmesgs; if (H5O__alloc_find_best_null(oh, aligned_size, &idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error while locating best null header message") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error while locating best null header message"); /* if we didn't find one, then allocate more header space */ if (idx >= oh->nmesgs) { @@ -1310,7 +1278,7 @@ H5O__alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const void *mesg, s htri_t tri_result; /* Status from attempting to extend chunk */ if ((tri_result = H5O__alloc_extend_chunk(f, oh, chunkno, raw_size, &idx)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTEXTEND, FAIL, "can't extend existing chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTEXTEND, FAIL, "can't extend existing chunk"); if (tri_result == TRUE) break; } /* end for */ @@ -1318,17 +1286,17 @@ H5O__alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const void *mesg, s /* If we were not able to extend a chunk, create a new one */ if (idx >= oh->nmesgs) if (H5O__alloc_new_chunk(f, oh, raw_size, &idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create a new object header data chunk") + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create a new object header data chunk"); } /* end if */ - HDassert(idx < oh->nmesgs); + assert(idx < oh->nmesgs); /* Split the null message and point at continuation message */ if (H5O__alloc_null(f, oh, idx, type, NULL, aligned_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't split null message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't split null message"); /* Mark object header as dirty in cache */ if (H5AC_mark_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty"); /* Set message index value */ *mesg_idx = idx; @@ -1345,9 +1313,6 @@ H5O__alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const void *mesg, s * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 22 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1360,29 +1325,29 @@ H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); - HDassert(mesg); + assert(f); + assert(oh); + assert(mesg); /* Check if we should operate on the message */ if (adj_link) /* Free any space referred to in the file from this message */ if (H5O__delete_mesg(f, oh, mesg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, - "unable to delete file space for object header message") + "unable to delete file space for object header message"); /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(f, oh, mesg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk"); /* Free any native information */ H5O__msg_free_mesg(mesg); /* Change message type to nil and zero it */ mesg->type = H5O_MSG_NULL; - HDassert(mesg->raw + mesg->raw_size <= (oh->chunk[mesg->chunkno].image + oh->chunk[mesg->chunkno].size) - - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[mesg->chunkno].gap)); - HDmemset(mesg->raw, 0, mesg->raw_size); + assert(mesg->raw + mesg->raw_size <= (oh->chunk[mesg->chunkno].image + oh->chunk[mesg->chunkno].size) - + (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[mesg->chunkno].gap)); + memset(mesg->raw, 0, mesg->raw_size); /* Clear message flags */ mesg->flags = 0; @@ -1398,13 +1363,13 @@ H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) ((oh->chunk[mesg->chunkno].image + oh->chunk[mesg->chunkno].size) - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[mesg->chunkno].gap)), oh->chunk[mesg->chunkno].gap) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, "can't eliminate gap in chunk"); } /* end if */ done: /* Release chunk, if not already done */ if (chk_proxy && H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__release_mesg() */ @@ -1417,9 +1382,6 @@ H5O__release_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg, hbool_t adj_link) * Return: Success: non-negative (TRUE/FALSE) * Failure: negative * - * Programmer: Vailin Choi - * Feb. 2009 - * *------------------------------------------------------------------------- */ static htri_t @@ -1434,8 +1396,8 @@ H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) FUNC_ENTER_PACKAGE /* Check arguments. */ - HDassert(f); - HDassert(oh); + assert(f); + assert(oh); /* Get initial information */ cont_msg = &oh->mesg[cont_u]; @@ -1455,7 +1417,7 @@ H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) if (curr_msg->chunkno == deleted_chunkno) { /* Find size of all non-null messages in the chunk pointed to by the continuation message */ if (curr_msg->type->id != H5O_NULL_ID) { - HDassert(curr_msg->type->id != H5O_CONT_ID); + assert(curr_msg->type->id != H5O_CONT_ID); nonnull_size += curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh); } /* end if */ } /* end if */ @@ -1481,11 +1443,11 @@ H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) /* Convert continuation message into a null message. Do not delete * the target chunk yet, so we can still copy messages from it. */ if (H5O__release_mesg(f, oh, cont_msg, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message"); /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(f, oh, cont_chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk"); /* Move message(s) forward into continuation message */ for (v = 0, curr_msg = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg++) @@ -1511,9 +1473,9 @@ H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) /* Delete the target chunk */ if (H5O__chunk_delete(f, oh, deleted_chunkno) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove chunk from cache") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove chunk from cache"); - HDassert(move_start <= (move_end + gap_size)); + assert(move_start <= (move_end + gap_size)); /* Check if there is space remaining in the continuation message */ /* (The remaining space can be gap or a null message) */ @@ -1530,14 +1492,14 @@ H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) if (gap_size > 0) { /* Convert remnant into gap in chunk */ if (H5O__add_gap(f, oh, cont_chunkno, &chk_dirtied, cont_u, move_start, gap_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk"); } /* end if */ /* Release any information/memory for continuation message */ H5O__msg_free_mesg(cont_msg); if (cont_u < (oh->nmesgs - 1)) - HDmemmove(&oh->mesg[cont_u], &oh->mesg[cont_u + 1], - ((oh->nmesgs - 1) - cont_u) * sizeof(H5O_mesg_t)); + memmove(&oh->mesg[cont_u], &oh->mesg[cont_u + 1], + ((oh->nmesgs - 1) - cont_u) * sizeof(H5O_mesg_t)); oh->nmesgs--; } /* end else */ @@ -1554,8 +1516,8 @@ H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) /* Remove from message list */ if (v < (oh->nmesgs - 1)) - HDmemmove(&oh->mesg[v], &oh->mesg[v + 1], - ((oh->nmesgs - 1) - v) * sizeof(H5O_mesg_t)); + memmove(&oh->mesg[v], &oh->mesg[v + 1], + ((oh->nmesgs - 1) - v) * sizeof(H5O_mesg_t)); oh->nmesgs--; } /* end if */ } /* end if */ @@ -1573,7 +1535,7 @@ H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) done: /* Release chunk, if not already done */ if (chk_proxy && H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__move_cont() */ @@ -1586,9 +1548,6 @@ H5O__move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 17 2005 - * *------------------------------------------------------------------------- */ static htri_t @@ -1606,7 +1565,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); + assert(oh); /* Loop until no messages packed */ /* (Double loop is not very efficient, but it would be some extra work to @@ -1644,12 +1603,12 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) /* Protect chunk */ if (NULL == (null_chk_proxy = H5O__chunk_protect(f, oh, curr_msg->chunkno))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, - "unable to load object header chunk") + "unable to load object header chunk"); /* Copy raw data for non-null message to new location */ - HDmemmove(curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), - nonnull_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), - nonnull_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); + memmove(curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), + nonnull_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), + nonnull_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); /* Adjust non-null message's offset in chunk */ nonnull_msg->raw = curr_msg->raw; @@ -1665,7 +1624,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) /* Release chunk, marking it dirty */ if (H5O__chunk_unprotect(f, null_chk_proxy, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect object header chunk") + "unable to unprotect object header chunk"); null_chk_proxy = NULL; /* Set the flag to indicate that the null message @@ -1680,7 +1639,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) } /* end if */ } /* end for */ /* Should have been message after null message */ - HDassert(v < oh->nmesgs); + assert(v < oh->nmesgs); } /* end if */ } /* end if */ else { @@ -1693,7 +1652,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) if ((status = H5O__move_cont(f, oh, u)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, - "Error in moving messages into cont message") + "Error in moving messages into cont message"); else if (status > 0) { /* Message(s) got moved into "continuation" message */ packed_msg = TRUE; break; @@ -1713,9 +1672,11 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) /* Protect chunks */ if (NULL == (null_chk_proxy = H5O__chunk_protect(f, oh, null_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, + "unable to load object header chunk"); if (NULL == (curr_chk_proxy = H5O__chunk_protect(f, oh, curr_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, + "unable to load object header chunk"); /* If the message being moved is a continuation * message and we are doing SWMR writes, we must @@ -1730,27 +1691,27 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) /* The other chunks involved should never be * chunk 0 */ - HDassert(curr_msg->chunkno > 0); - HDassert(((H5O_cont_t *)(curr_msg->native))->chunkno > 0); + assert(curr_msg->chunkno > 0); + assert(((H5O_cont_t *)(curr_msg->native))->chunkno > 0); /* Protect continuation message target chunk */ if (NULL == (cont_targ_chk_proxy = H5O__chunk_protect( f, oh, ((H5O_cont_t *)(curr_msg->native))->chunkno))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, - "unable to load object header chunk") + "unable to load object header chunk"); /* Check for flush dependency on previous continuation chunk */ /* (As opposed to chunk 0) */ if (cont_targ_chk_proxy->fd_parent) { /* Remove flush dependency on old continuation * message chunk */ - HDassert(cont_targ_chk_proxy); - HDassert(curr_chk_proxy); - HDassert((void *)curr_chk_proxy == cont_targ_chk_proxy->fd_parent); + assert(cont_targ_chk_proxy); + assert(curr_chk_proxy); + assert((void *)curr_chk_proxy == cont_targ_chk_proxy->fd_parent); if (H5AC_destroy_flush_dependency(curr_chk_proxy, cont_targ_chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, - "unable to destroy flush dependency") + "unable to destroy flush dependency"); cont_targ_chk_proxy->fd_parent = NULL; } /* end if */ @@ -1758,18 +1719,15 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) /* Avoid (another) flush dependency on chunk 0 */ if (0 != null_msg->chunkno) { /* Sanity checks */ - HDassert(null_chk_mdc_obj); - HDassert(((H5C_cache_entry_t *)null_chk_mdc_obj)->magic == - H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(((H5C_cache_entry_t *)null_chk_mdc_obj)->type); - HDassert(((H5C_cache_entry_t *)null_chk_mdc_obj)->type->id == - H5AC_OHDR_CHK_ID); + assert(null_chk_mdc_obj); + assert(((H5C_cache_entry_t *)null_chk_mdc_obj)->type); + assert(((H5C_cache_entry_t *)null_chk_mdc_obj)->type->id == H5AC_OHDR_CHK_ID); /* Create flush dependency on new continuation * message chunk */ if (H5AC_create_flush_dependency(null_chk_mdc_obj, cont_targ_chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, - "unable to create flush dependency") + "unable to create flush dependency"); cont_targ_chk_proxy->fd_parent = null_chk_mdc_obj; } /* end if */ @@ -1777,7 +1735,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) /* Unprotect continuation message target chunk */ if (H5O__chunk_unprotect(f, cont_targ_chk_proxy, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect object header chunk") + "unable to unprotect object header chunk"); cont_targ_chk_proxy = NULL; } /* end if */ @@ -1805,7 +1763,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) /* Release current chunk, marking it dirty */ if (H5O__chunk_unprotect(f, curr_chk_proxy, curr_chk_dirtied) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect object header chunk") + "unable to unprotect object header chunk"); curr_chk_proxy = NULL; curr_chk_dirtied = FALSE; @@ -1818,13 +1776,13 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)), oh->chunk[old_chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, - "can't eliminate gap in chunk") + "can't eliminate gap in chunk"); } /* end if */ /* Release null chunk, marking it dirty */ if (H5O__chunk_unprotect(f, null_chk_proxy, null_chk_dirtied) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect object header chunk") + "unable to unprotect object header chunk"); null_chk_proxy = NULL; null_chk_dirtied = FALSE; } /* end if */ @@ -1847,7 +1805,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) /* Add the gap to the chunk */ if (H5O__add_gap(f, oh, null_msg->chunkno, &null_chk_dirtied, v, null_msg->raw + null_msg->raw_size, gap_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert gap in chunk"); /* Re-use message # for new null message taking place of non-null message */ new_null_msg = v; @@ -1865,7 +1823,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) if (oh->nmesgs >= oh->alloc_nmesgs) { if (H5O__alloc_msgs(oh, (size_t)1) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "can't allocate more space for messages") + "can't allocate more space for messages"); /* "Retarget" 'curr_msg' pointer into newly re-allocated array of messages */ @@ -1879,7 +1837,7 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) /* Release null message's chunk, marking it dirty */ if (H5O__chunk_unprotect(f, null_chk_proxy, null_chk_dirtied) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect object header chunk") + "unable to unprotect object header chunk"); null_chk_proxy = NULL; null_chk_dirtied = FALSE; @@ -1903,13 +1861,13 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[old_chunkno].gap)), oh->chunk[old_chunkno].gap) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTREMOVE, FAIL, - "can't eliminate gap in chunk") + "can't eliminate gap in chunk"); } /* end if */ /* Release new null message's chunk, marking it dirty */ if (H5O__chunk_unprotect(f, curr_chk_proxy, curr_chk_dirtied) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect object header chunk") + "unable to unprotect object header chunk"); curr_chk_proxy = NULL; curr_chk_dirtied = FALSE; } /* end else */ @@ -1943,15 +1901,15 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) done: if (ret_value < 0) { if (null_chk_proxy && H5O__chunk_unprotect(f, null_chk_proxy, null_chk_dirtied) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect null object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect null object header chunk"); if (curr_chk_proxy && H5O__chunk_unprotect(f, curr_chk_proxy, curr_chk_dirtied) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect current object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect current object header chunk"); if (cont_targ_chk_proxy && H5O__chunk_unprotect(f, cont_targ_chk_proxy, FALSE) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect continuation message target object header chunk") + "unable to unprotect continuation message target object header chunk"); } /* end if */ else - HDassert(!null_chk_proxy && !curr_chk_proxy && !cont_targ_chk_proxy); + assert(!null_chk_proxy && !curr_chk_proxy && !cont_targ_chk_proxy); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__move_msgs_forward() */ @@ -1964,9 +1922,6 @@ H5O__move_msgs_forward(H5F_t *f, H5O_t *oh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 10 2005 - * *------------------------------------------------------------------------- */ static htri_t @@ -1979,7 +1934,7 @@ H5O__merge_null(H5F_t *f, H5O_t *oh) FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh != NULL); + assert(oh != NULL); /* Loop until no messages merged */ /* (Double loop is not very efficient, but it would be some extra work to add @@ -1999,7 +1954,7 @@ H5O__merge_null(H5F_t *f, H5O_t *oh) unsigned v; /* Local index variable */ /* Should be no gaps in chunk with null message */ - HDassert(oh->chunk[curr_msg->chunkno].gap == 0); + assert(oh->chunk[curr_msg->chunkno].gap == 0); /* Loop over messages again, looking for null message in same chunk */ for (v = 0, curr_msg2 = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg2++) { @@ -2040,7 +1995,7 @@ H5O__merge_null(H5F_t *f, H5O_t *oh) /* Protect chunk */ if (NULL == (curr_chk_proxy = H5O__chunk_protect(f, oh, curr_msg->chunkno))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, - "unable to load object header chunk") + "unable to load object header chunk"); /* Adjust first message address and extend length to cover second message */ curr_msg->raw += adj_raw; @@ -2052,12 +2007,12 @@ H5O__merge_null(H5F_t *f, H5O_t *oh) /* Release new null message's chunk, marking it dirty */ if (H5O__chunk_unprotect(f, curr_chk_proxy, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, - "unable to unprotect object header chunk") + "unable to unprotect object header chunk"); /* Remove second message from list of messages */ if (v < (oh->nmesgs - 1)) - HDmemmove(&oh->mesg[v], &oh->mesg[v + 1], - ((oh->nmesgs - 1) - v) * sizeof(H5O_mesg_t)); + memmove(&oh->mesg[v], &oh->mesg[v + 1], + ((oh->nmesgs - 1) - v) * sizeof(H5O_mesg_t)); /* Decrement # of messages */ /* (Don't bother reducing size of message array for now -QAK) */ @@ -2066,7 +2021,7 @@ H5O__merge_null(H5F_t *f, H5O_t *oh) /* The merge null message might span the entire chunk: scan for empty chunk to * remove */ if ((result = H5O__remove_empty_chunks(f, oh)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk"); else if (result > 0) /* Get out of loop */ break; @@ -2074,7 +2029,7 @@ H5O__merge_null(H5F_t *f, H5O_t *oh) /* If the merged message is too large, shrink the chunk */ if (curr_msg->raw_size >= H5O_MESG_MAX_SIZE) if (H5O__alloc_shrink_chunk(f, oh, curr_msg->chunkno) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "unable to shrink chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "unable to shrink chunk"); /* Get out of loop */ break; @@ -2112,9 +2067,6 @@ H5O__merge_null(H5F_t *f, H5O_t *oh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 17 2005 - * *------------------------------------------------------------------------- */ static htri_t @@ -2127,7 +2079,7 @@ H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh != NULL); + assert(oh != NULL); /* Loop until no chunks are freed */ do { @@ -2167,7 +2119,7 @@ H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) ((H5O_cont_t *)(cont_msg->native))->chunkno = w; break; } /* end if */ - HDassert(((H5O_cont_t *)(cont_msg->native))->chunkno > 0); + assert(((H5O_cont_t *)(cont_msg->native))->chunkno > 0); } /* end if */ /* Check for correct chunk to delete */ @@ -2176,9 +2128,9 @@ H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) } /* end if */ } /* end for */ /* Must be a continuation message that points to chunk containing null message */ - HDassert(v < oh->nmesgs); - HDassert(cont_msg); - HDassert(((H5O_cont_t *)(cont_msg->native))->chunkno == null_msg->chunkno); + assert(v < oh->nmesgs); + assert(cont_msg); + assert(((H5O_cont_t *)(cont_msg->native))->chunkno == null_msg->chunkno); /* Initialize information about null message */ null_msg_no = u; @@ -2186,7 +2138,7 @@ H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) /* Convert continuation message into a null message */ if (H5O__release_mesg(f, oh, cont_msg, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to convert into null message"); /* * Remove chunk from object header's data structure @@ -2198,8 +2150,8 @@ H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) /* Remove chunk from list of chunks */ if (null_msg->chunkno < (oh->nchunks - 1)) { - HDmemmove(&oh->chunk[null_msg->chunkno], &oh->chunk[null_msg->chunkno + 1], - ((oh->nchunks - 1) - null_msg->chunkno) * sizeof(H5O_chunk_t)); + memmove(&oh->chunk[null_msg->chunkno], &oh->chunk[null_msg->chunkno + 1], + ((oh->nchunks - 1) - null_msg->chunkno) * sizeof(H5O_chunk_t)); /* Adjust chunk number for any chunk proxies that are in the cache */ for (u = null_msg->chunkno; u < (oh->nchunks - 1); u++) { @@ -2208,13 +2160,13 @@ H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) /* Check the chunk proxy's status in the metadata cache */ if (H5AC_get_entry_status(f, oh->chunk[u].addr, &chk_proxy_status) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, - "unable to check metadata cache status for chunk proxy") + "unable to check metadata cache status for chunk proxy"); /* If the entry is in the cache, update its chunk index */ if (chk_proxy_status & H5AC_ES__IN_CACHE) { if (H5O__chunk_update_idx(f, oh, u) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, - "unable to update index for chunk proxy") + "unable to update index for chunk proxy"); } /* end if */ } /* end for */ } /* end if */ @@ -2232,8 +2184,8 @@ H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) /* Remove null message from list of messages */ if (null_msg_no < (oh->nmesgs - 1)) - HDmemmove(&oh->mesg[null_msg_no], &oh->mesg[null_msg_no + 1], - ((oh->nmesgs - 1) - null_msg_no) * sizeof(H5O_mesg_t)); + memmove(&oh->mesg[null_msg_no], &oh->mesg[null_msg_no + 1], + ((oh->nmesgs - 1) - null_msg_no) * sizeof(H5O_mesg_t)); /* Decrement # of messages */ /* (Don't bother reducing size of message array for now -QAK) */ @@ -2242,7 +2194,7 @@ H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) /* Adjust chunk # for messages in chunks after deleted chunk */ for (u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) { /* Sanity check - there should be no messages in deleted chunk */ - HDassert(curr_msg->chunkno != deleted_chunkno); + assert(curr_msg->chunkno != deleted_chunkno); /* Adjust chunk index for messages in later chunks */ if (curr_msg->chunkno > deleted_chunkno) @@ -2264,7 +2216,7 @@ H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) ((H5O_cont_t *)(curr_msg->native))->chunkno = w; break; } /* end if */ - HDassert(((H5O_cont_t *)(curr_msg->native))->chunkno > 0); + assert(((H5O_cont_t *)(curr_msg->native))->chunkno > 0); } /* end if */ else { /* Check for pointer to chunk after deleted chunk */ @@ -2300,9 +2252,6 @@ H5O__remove_empty_chunks(H5F_t *f, H5O_t *oh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 4 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -2315,7 +2264,7 @@ H5O__condense_header(H5F_t *f, H5O_t *oh) FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh != NULL); + assert(oh != NULL); /* Loop until no changed to the object header messages & chunks */ do { @@ -2325,21 +2274,21 @@ H5O__condense_header(H5F_t *f, H5O_t *oh) /* Scan for messages that can be moved earlier in chunks */ result = H5O__move_msgs_forward(f, oh); if (result < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't move header messages forward") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't move header messages forward"); if (result > 0) rescan_header = TRUE; /* Scan for adjacent null messages & merge them */ result = H5O__merge_null(f, oh); if (result < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack null header messages") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack null header messages"); if (result > 0) rescan_header = TRUE; /* Scan for empty chunks to remove */ result = H5O__remove_empty_chunks(f, oh); if (result < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't remove empty chunk"); if (result > 0) rescan_header = TRUE; } while (rescan_header); @@ -2359,9 +2308,6 @@ H5O__condense_header(H5F_t *f, H5O_t *oh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Oct 20 2008 - * *------------------------------------------------------------------------- */ static herr_t @@ -2386,12 +2332,12 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); + assert(f); + assert(oh); /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(f, oh, chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk"); /* Loop backwards to increase the chance of seeing more null messages at the * end of the chunk. Note that we rely on unsigned u wrapping around at the @@ -2410,8 +2356,8 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) uint8_t *src = curr_msg->raw + curr_msg->raw_size; /* Source location */ /* Slide down the raw data */ - HDmemmove(curr_msg->raw - sizeof_msghdr, src, - (size_t)(old_image + new_size - sizeof_chksum - src)); + memmove(curr_msg->raw - sizeof_msghdr, src, + (size_t)(old_image + new_size - sizeof_chksum - src)); /* Update the raw data pointers for messages after this one */ for (v = 0, curr_msg2 = &oh->mesg[0]; v < oh->nmesgs; v++, curr_msg2++) @@ -2427,7 +2373,7 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) /* Remove the deleted null message from list of messages */ if (u < (oh->nmesgs - 1)) - HDmemmove(&oh->mesg[u], &oh->mesg[u + 1], ((oh->nmesgs - 1) - u) * sizeof(H5O_mesg_t)); + memmove(&oh->mesg[u], &oh->mesg[u + 1], ((oh->nmesgs - 1) - u) * sizeof(H5O_mesg_t)); /* Decrement # of messages */ /* (Don't bother reducing size of message array for now) */ @@ -2438,7 +2384,7 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) /* Check if the chunk is too small, extend if necessary */ total_msg_size = new_size - (size_t)(chunkno == 0 ? H5O_SIZEOF_HDR(oh) : H5O_SIZEOF_CHKHDR_OH(oh)); if (total_msg_size < min_chunk_size) { - HDassert(oh->alloc_nmesgs > oh->nmesgs); + assert(oh->alloc_nmesgs > oh->nmesgs); oh->nmesgs++; /* Initialize new null message to make the chunk large enough */ @@ -2486,9 +2432,9 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) oh->flags |= new_size_flags; /* Slide chunk 0 data down */ - HDmemmove(chunk->image + H5O_SIZEOF_HDR(oh) - sizeof_chksum, - chunk->image + H5O_SIZEOF_HDR(oh) - sizeof_chksum + less_prfx_size, - new_size - (size_t)H5O_SIZEOF_HDR(oh)); + memmove(chunk->image + H5O_SIZEOF_HDR(oh) - sizeof_chksum, + chunk->image + H5O_SIZEOF_HDR(oh) - sizeof_chksum + less_prfx_size, + new_size - (size_t)H5O_SIZEOF_HDR(oh)); /* Adjust chunk size */ new_size -= less_prfx_size; @@ -2499,7 +2445,7 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) chunk->image = H5FL_BLK_REALLOC(chunk_image, old_image, chunk->size); chunk->gap = 0; if (NULL == oh->chunk[chunkno].image) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Spin through existing messages, adjusting them */ for (u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) { @@ -2517,10 +2463,10 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) /* Protect chunk */ if (NULL == (cont_chk_proxy = H5O__chunk_protect(f, oh, curr_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk"); /* Adjust size of continuation message */ - HDassert(((H5O_cont_t *)(curr_msg->native))->size == old_size); + assert(((H5O_cont_t *)(curr_msg->native))->size == old_size); ((H5O_cont_t *)(curr_msg->native))->size = chunk->size; /* Flag continuation message as dirty */ @@ -2528,24 +2474,24 @@ H5O__alloc_shrink_chunk(H5F_t *f, H5O_t *oh, unsigned chunkno) /* Release chunk, marking it dirty */ if (H5O__chunk_unprotect(f, cont_chk_proxy, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); } /* end if */ } /* end for */ - HDassert(new_size <= old_size); + assert(new_size <= old_size); /* Resize the chunk in the cache */ if (H5O__chunk_resize(oh, chk_proxy) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize object header chunk"); /* Free the unused space in the file */ if (H5MF_xfree(f, H5FD_MEM_OHDR, chunk->addr + new_size, (hsize_t)(old_size - new_size)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to shrink object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to shrink object header chunk"); done: /* Release chunk, marking it dirty */ if (chk_proxy && H5O__chunk_unprotect(f, chk_proxy, TRUE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__alloc_shrink_chunk() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oattr.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oattr.c index 9e6f7e7476..901227ee26 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oattr.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oattr.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -113,99 +112,129 @@ H5FL_EXTERN(H5S_extent_t); Pointer to the new message in native order on success, NULL on failure DESCRIPTION This function decodes the "raw" disk form of a attribute message - into a struct in memory native format. The struct is allocated within this - function using malloc() and is returned to the caller. + into a struct in memory native format. The struct is allocated within this + function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned *ioflags, size_t p_size, const uint8_t *p) { - H5A_t *attr = NULL; - H5S_extent_t *extent; /*extent dimensionality information */ - size_t name_len; /*attribute name length */ - size_t dt_size; /* Datatype size */ - hssize_t sds_size; /* Signed Dataspace size */ - hsize_t ds_size; /* Dataspace size */ - unsigned flags = 0; /* Attribute flags */ - H5A_t *ret_value = NULL; /* Return value */ + H5A_t *attr = NULL; + const uint8_t *p_end = p + p_size - 1; /* End of input buffer */ + size_t delta = 0; /* Amount to move p in next field */ + H5S_extent_t *extent = NULL; /* Extent dimensionality information */ + size_t name_len; /* Attribute name length */ + size_t dt_size; /* Datatype size */ + hssize_t sds_size; /* Signed Dataspace size */ + hsize_t ds_size; /* Dataspace size */ + unsigned flags = 0; /* Attribute flags */ + H5A_t *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); if (NULL == (attr = H5FL_CALLOC(H5A_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); if (NULL == (attr->shared = H5FL_CALLOC(H5A_shared_t))) - HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared attr structure") + HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate shared attr structure"); /* Version number */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); attr->shared->version = *p++; if (attr->shared->version < H5O_ATTR_VERSION_1 || attr->shared->version > H5O_ATTR_VERSION_LATEST) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "bad version number for attribute message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "bad version number for attribute message"); /* Get the flags byte if we have a later version of the attribute */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (attr->shared->version >= H5O_ATTR_VERSION_2) { flags = *p++; /* Check for unknown flag */ if (flags & (unsigned)~H5O_ATTR_FLAG_ALL) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "unknown flag for attribute message") - } /* end if */ + HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "unknown flag for attribute message"); + } else - p++; /* Byte is unused when version<2 */ + p++; /* Byte is unused when version < 2 */ - /* - * Decode the sizes of the parts of the attribute. The sizes stored in + /* Decode the sizes of the parts of the attribute. The sizes stored in * the file are exact but the parts are aligned on 8-byte boundaries. */ - UINT16DECODE(p, name_len); /*including null*/ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT16DECODE(p, name_len); /* Including null */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, attr->shared->dt_size); + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, attr->shared->ds_size); - /* - * Decode the character encoding for the name for versions 3 or later, + /* Decode the character encoding for the name for versions 3 or later, * as well as some reserved bytes. */ - if (attr->shared->version >= H5O_ATTR_VERSION_3) + if (attr->shared->version >= H5O_ATTR_VERSION_3) { + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); attr->shared->encoding = (H5T_cset_t)*p++; + } - /* Decode and store the name */ - if (NULL == (attr->shared->name = H5MM_strdup((const char *)p))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + /* Decode and store the name + * + * NOTE: If the buffer overflow error message changes, test_corrupted_attnamelen() + * in titerate.c will fail since it looks for it explicitly. + */ + if (H5_IS_BUFFER_OVERFLOW(p, name_len, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + if (NULL == (attr->shared->name = H5MM_strndup((const char *)p, name_len - 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Make an attempt to detect corrupted name or name length - HDFFV-10588 */ - if (name_len != (HDstrlen(attr->shared->name) + 1)) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "attribute name has different length than stored length") + if (name_len != (HDstrnlen(attr->shared->name, name_len) + 1)) + HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "attribute name has different length than stored length"); + /* Determine pointer movement and check if it's valid */ if (attr->shared->version < H5O_ATTR_VERSION_2) - p += H5O_ALIGN_OLD(name_len); /* advance the memory pointer */ + delta = H5O_ALIGN_OLD(name_len); else - p += name_len; /* advance the memory pointer */ + delta = name_len; + if (H5_IS_BUFFER_OVERFLOW(p, delta, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + p += delta; /* Decode the attribute's datatype */ + if (H5_IS_BUFFER_OVERFLOW(p, attr->shared->dt_size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (NULL == (attr->shared->dt = (H5T_t *)(H5O_MSG_DTYPE->decode)( f, open_oh, ((flags & H5O_ATTR_FLAG_TYPE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, attr->shared->dt_size, p))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute datatype"); + + /* Determine pointer movement and check if it's valid */ if (attr->shared->version < H5O_ATTR_VERSION_2) - p += H5O_ALIGN_OLD(attr->shared->dt_size); + delta = H5O_ALIGN_OLD(attr->shared->dt_size); else - p += attr->shared->dt_size; + delta = attr->shared->dt_size; + if (H5_IS_BUFFER_OVERFLOW(p, delta, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + p += delta; - /* decode the attribute dataspace. It can be shared in versions >= 3 + /* Decode the attribute dataspace. It can be shared in versions >= 3 * What's actually shared, though, is only the extent. */ if (NULL == (attr->shared->ds = H5FL_CALLOC(H5S_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Decode attribute's dataspace extent */ + if (H5_IS_BUFFER_OVERFLOW(p, attr->shared->ds_size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if ((extent = (H5S_extent_t *)(H5O_MSG_SDSPACE->decode)( f, open_oh, ((flags & H5O_ATTR_FLAG_SPACE_SHARED) ? H5O_MSG_FLAG_SHARED : 0), ioflags, attr->shared->ds_size, p)) == NULL) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace"); /* Copy the extent information to the dataspace */ H5MM_memcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t)); @@ -215,38 +244,42 @@ H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, u /* Default to entire dataspace being selected */ if (H5S_select_all(attr->shared->ds, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); + /* Determine pointer movement and check if it's valid */ if (attr->shared->version < H5O_ATTR_VERSION_2) - p += H5O_ALIGN_OLD(attr->shared->ds_size); + delta = H5O_ALIGN_OLD(attr->shared->ds_size); else - p += attr->shared->ds_size; - - /* Get the datatype's size */ - if (0 == (dt_size = H5T_get_size(attr->shared->dt))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get datatype size") + delta = attr->shared->ds_size; + if (H5_IS_BUFFER_OVERFLOW(p, delta, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + p += delta; /* Get the datatype & dataspace sizes */ if (0 == (dt_size = H5T_get_size(attr->shared->dt))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get datatype size") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get datatype size"); if ((sds_size = H5S_GET_EXTENT_NPOINTS(attr->shared->ds)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get dataspace size") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "unable to get dataspace size"); ds_size = (hsize_t)sds_size; /* Compute the size of the data */ H5_CHECKED_ASSIGN(attr->shared->data_size, size_t, ds_size * (hsize_t)dt_size, hsize_t); + /* Check if multiplication has overflown */ + if ((attr->shared->data_size / dt_size) != ds_size) + HGOTO_ERROR(H5E_RESOURCE, H5E_OVERFLOW, NULL, "data size exceeds addressable range"); - /* Go get the data */ + /* Get the data */ if (attr->shared->data_size) { /* Ensure that data size doesn't exceed buffer size, in case of - it's being corrupted in the file */ - if (attr->shared->data_size > p_size) - HGOTO_ERROR(H5E_RESOURCE, H5E_OVERFLOW, NULL, "data size exceeds buffer size") + * it's being corrupted in the file + */ + if (H5_IS_BUFFER_OVERFLOW(p, attr->shared->data_size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, attr->shared->data_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5MM_memcpy(attr->shared->data, p, attr->shared->data_size); - } /* end if */ + } /* Increment the reference count for this object header message in cache(compact storage) or for the object from dense storage. */ @@ -256,15 +289,16 @@ H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, u ret_value = attr; done: - if (NULL == ret_value) + if (NULL == ret_value) { if (attr) { - /* Free any dynamically allocated items */ if (attr->shared) if (H5A__shared_free(attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info") - + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't release attribute info"); attr = H5FL_FREE(H5A_t, attr); - } /* end if */ + } + if (extent) + extent = H5FL_FREE(H5S_extent_t, extent); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__attr_decode() */ @@ -298,16 +332,16 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(p); - HDassert(attr); + assert(f); + assert(p); + assert(attr); /* Check whether datatype and dataspace are shared */ if ((is_type_shared = H5O_msg_is_shared(H5O_DTYPE_ID, attr->shared->dt)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't determine if datatype is shared") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't determine if datatype is shared"); if ((is_space_shared = H5O_msg_is_shared(H5O_SDSPACE_ID, attr->shared->ds)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't determine if dataspace is shared") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't determine if dataspace is shared"); /* Encode Version */ *p++ = attr->shared->version; @@ -339,7 +373,7 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg) H5MM_memcpy(p, attr->shared->name, name_len); if (attr->shared->version < H5O_ATTR_VERSION_2) { /* Pad to the correct number of bytes */ - HDmemset(p + name_len, 0, H5O_ALIGN_OLD(name_len) - name_len); + memset(p + name_len, 0, H5O_ALIGN_OLD(name_len) - name_len); p += H5O_ALIGN_OLD(name_len); } /* end if */ else @@ -347,10 +381,10 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg) /* encode the attribute datatype */ if ((H5O_MSG_DTYPE->encode)(f, FALSE, p, attr->shared->dt) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute datatype") + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute datatype"); if (attr->shared->version < H5O_ATTR_VERSION_2) { - HDmemset(p + attr->shared->dt_size, 0, H5O_ALIGN_OLD(attr->shared->dt_size) - attr->shared->dt_size); + memset(p + attr->shared->dt_size, 0, H5O_ALIGN_OLD(attr->shared->dt_size) - attr->shared->dt_size); p += H5O_ALIGN_OLD(attr->shared->dt_size); } /* end if */ else @@ -358,10 +392,10 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg) /* encode the attribute dataspace */ if ((H5O_MSG_SDSPACE->encode)(f, FALSE, p, &(attr->shared->ds->extent)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute dataspace") + HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't encode attribute dataspace"); if (attr->shared->version < H5O_ATTR_VERSION_2) { - HDmemset(p + attr->shared->ds_size, 0, H5O_ALIGN_OLD(attr->shared->ds_size) - attr->shared->ds_size); + memset(p + attr->shared->ds_size, 0, H5O_ALIGN_OLD(attr->shared->ds_size) - attr->shared->ds_size); p += H5O_ALIGN_OLD(attr->shared->ds_size); } /* end if */ else @@ -371,10 +405,10 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg) if (attr->shared->data) H5MM_memcpy(p, attr->shared->data, attr->shared->data_size); else - HDmemset(p, 0, attr->shared->data_size); + memset(p, 0, attr->shared->data_size); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__attr_encode() */ /*-------------------------------------------------------------------------- @@ -400,11 +434,11 @@ H5O__attr_copy(const void *_src, void *_dst) FUNC_ENTER_PACKAGE /* check args */ - HDassert(_src); + assert(_src); /* copy */ if (NULL == (ret_value = (H5A_t *)H5A__copy((H5A_t *)_dst, (const H5A_t *)_src))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "can't copy attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "can't copy attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -435,7 +469,7 @@ H5O__attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) FUNC_ENTER_PACKAGE_NOERR - HDassert(attr); + assert(attr); /* Common size information */ ret_value = 1 + /*version */ @@ -465,7 +499,7 @@ H5O__attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) attr->shared->ds_size + /*dataspace */ attr->shared->data_size; /*the data itself */ else - HDassert(0 && "Bad attribute version"); + assert(0 && "Bad attribute version"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__attr_size() */ @@ -478,9 +512,6 @@ H5O__attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg) * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -498,9 +529,6 @@ H5O__attr_reset(void H5_ATTR_UNUSED *_mesg) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Thursday, November 18, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -511,10 +539,10 @@ H5O__attr_free(void *mesg) FUNC_ENTER_PACKAGE - HDassert(mesg); + assert(mesg); if (H5A__close(attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -527,9 +555,6 @@ H5O__attr_free(void *mesg) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Friday, September 26, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -541,16 +566,16 @@ H5O__attr_delete(H5F_t *f, H5O_t *oh, void *_mesg) FUNC_ENTER_NOAPI_NOINIT /* check args */ - HDassert(f); - HDassert(attr); + assert(f); + assert(attr); /* Decrement reference count on datatype in file */ if ((H5O_MSG_DTYPE->del)(f, oh, attr->shared->dt) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust datatype link count") + HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust datatype link count"); /* Decrement reference count on dataspace in file */ if ((H5O_MSG_SDSPACE->del)(f, oh, attr->shared->ds) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust dataspace link count") + HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust dataspace link count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -564,9 +589,6 @@ H5O__attr_delete(H5F_t *f, H5O_t *oh, void *_mesg) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Friday, September 26, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -578,8 +600,8 @@ H5O__attr_link(H5F_t *f, H5O_t *oh, void *_mesg) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(attr); + assert(f); + assert(attr); /* Re-share attribute's datatype and dataspace to increment their * reference count if they're shared. @@ -588,9 +610,9 @@ H5O__attr_link(H5F_t *f, H5O_t *oh, void *_mesg) */ /* Increment reference count on datatype & dataspace in file */ if ((H5O_MSG_DTYPE->link)(f, oh, attr->shared->dt) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust datatype link count") + HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust datatype link count"); if ((H5O_MSG_SDSPACE->link)(f, oh, attr->shared->ds) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust dataspace link count") + HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust dataspace link count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -604,9 +626,6 @@ H5O__attr_link(H5F_t *f, H5O_t *oh, void *_mesg) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, June 26, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -619,15 +638,15 @@ H5O__attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, FUNC_ENTER_PACKAGE /* check args */ - HDassert(deleted); - HDassert(cpy_info); - HDassert(cpy_info->file_dst); + assert(deleted); + assert(cpy_info); + assert(cpy_info->file_dst); /* Check to ensure that the version of the message to be copied does not exceed * the message version allowed by the destination file's high bound. */ if (attr_src->shared->version > H5O_attr_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "attribute message version out of bounds"); /* If we are not copying attributes into the destination file, indicate * that this message should be deleted. @@ -647,9 +666,6 @@ H5O__attr_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *native_src, * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: Quincey Koziol - * November 1, 2005 - * *------------------------------------------------------------------------- */ static void * @@ -662,19 +678,19 @@ H5O__attr_copy_file(H5F_t *file_src, const H5O_msg_class_t H5_ATTR_UNUSED *mesg_ FUNC_ENTER_PACKAGE /* check args */ - HDassert(native_src); - HDassert(file_dst); - HDassert(cpy_info); - HDassert(!cpy_info->copy_without_attr); + assert(native_src); + assert(file_dst); + assert(cpy_info); + assert(!cpy_info->copy_without_attr); /* Mark datatype as being on disk now. This step used to be done in a lower level * by H5O_dtype_decode. But it has been moved up. Not an ideal place, but no better * place than here. */ if (H5T_set_loc(((H5A_t *)native_src)->shared->dt, H5F_VOL_OBJ(file_src), H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location"); if (NULL == (ret_value = H5A__attr_copy_file((H5A_t *)native_src, file_dst, recompute_size, cpy_info))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -691,9 +707,6 @@ H5O__attr_copy_file(H5F_t *file_src, const H5O_msg_class_t H5_ATTR_UNUSED *mesg_ * * Return: SUCCEED/FAIL * - * Programmer: Peter Cao - * March 6, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -706,7 +719,7 @@ H5O__attr_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_lo if (H5A__attr_post_copy_file(src_oloc, (const H5A_t *)mesg_src, dst_oloc, (H5A_t *)mesg_dst, cpy_info) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't copy attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't copy attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -719,9 +732,6 @@ H5O__attr_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_lo * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Thursday, January 18, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -731,8 +741,8 @@ H5O__attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) FUNC_ENTER_PACKAGE_NOERR - HDassert(attr); - HDassert(crt_idx); + assert(attr); + assert(crt_idx); /* Get the attribute's creation index */ *crt_idx = attr->shared->crt_idx; @@ -747,9 +757,6 @@ H5O__attr_get_crt_index(const void *_mesg, H5O_msg_crt_idx_t *crt_idx /*out*/) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Thursday, January 18, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -759,7 +766,7 @@ H5O__attr_set_crt_index(void *_mesg, H5O_msg_crt_idx_t crt_idx) FUNC_ENTER_PACKAGE_NOERR - HDassert(attr); + assert(attr); /* Set the creation index */ attr->shared->crt_idx = crt_idx; @@ -796,12 +803,12 @@ H5O__attr_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidt FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s \"%s\"\n", indent, "", fwidth, "Name:", mesg->shared->name); + fprintf(stream, "%*s%-*s \"%s\"\n", indent, "", fwidth, "Name:", mesg->shared->name); switch (mesg->shared->encoding) { case H5T_CSET_ASCII: s = "ASCII"; @@ -835,27 +842,27 @@ H5O__attr_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set of Name:", s); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Object opened:", mesg->obj_opened ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object:", mesg->oloc.addr); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set of Name:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Object opened:", mesg->obj_opened ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Object:", mesg->oloc.addr); /* Check for attribute creation order index on the attribute */ if (mesg->shared->crt_idx != H5O_MAX_CRT_ORDER_IDX) - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Creation Index:", (unsigned)mesg->shared->crt_idx); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Creation Index:", (unsigned)mesg->shared->crt_idx); - HDfprintf(stream, "%*sDatatype...\n", indent, ""); - HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3), - "Encoded Size:", (unsigned long)(mesg->shared->dt_size)); + fprintf(stream, "%*sDatatype...\n", indent, ""); + fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3), + "Encoded Size:", (unsigned long)(mesg->shared->dt_size)); if ((H5O_MSG_DTYPE->debug)(f, mesg->shared->dt, stream, indent + 3, MAX(0, fwidth - 3)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display datatype message info") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display datatype message info"); - HDfprintf(stream, "%*sDataspace...\n", indent, ""); - HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3), - "Encoded Size:", (unsigned long)(mesg->shared->ds_size)); + fprintf(stream, "%*sDataspace...\n", indent, ""); + fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3), + "Encoded Size:", (unsigned long)(mesg->shared->ds_size)); if (H5S_debug(f, mesg->shared->ds, stream, indent + 3, MAX(0, fwidth - 3)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display dataspace message info") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to display dataspace message info"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oattribute.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oattribute.c index 175c86026a..9e38488502 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oattribute.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oattribute.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -149,9 +148,6 @@ static herr_t H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg, * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 4 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -165,21 +161,21 @@ H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_U FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(mesg); - HDassert(udata); - HDassert(udata->f); - HDassert(udata->ainfo); - HDassert(attr); + assert(oh); + assert(mesg); + assert(udata); + assert(udata->f); + assert(udata->ainfo); + assert(attr); /* Insert attribute into dense storage */ if (H5A__dense_insert(udata->f, udata->ainfo, attr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to add to dense storage") + 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, oh, mesg, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message"); /* Indicate that the object header was modified */ *oh_modified = H5O_MODIFY_CONDENSE; @@ -195,9 +191,6 @@ H5O__attr_to_dense_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_U * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Friday, December 8, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -211,12 +204,12 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) FUNC_ENTER_NOAPI_NOINIT /* Check arguments */ - HDassert(loc); - HDassert(attr); + assert(loc); + assert(attr); /* Pin the object header */ if (NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + 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) { @@ -225,7 +218,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) /* Check for (& retrieve if available) attribute info */ if ((ainfo_exists = H5A__get_ainfo(loc->file, oh, &ainfo)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message"); if (!ainfo_exists) { /* Initialize attribute information */ ainfo.track_corder = (hbool_t)((oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? TRUE : FALSE); @@ -241,19 +234,19 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) } /* end if */ else { /* Sanity check attribute info read in */ - HDassert(ainfo.nattrs > 0); - HDassert(ainfo.track_corder == ((oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) > 0)); - HDassert(ainfo.index_corder == ((oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) > 0)); + assert(ainfo.nattrs > 0); + assert(ainfo.track_corder == ((oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) > 0)); + assert(ainfo.index_corder == ((oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) > 0)); } /* end else */ /* Check if switching to "dense" attribute storage is possible */ - if (!H5F_addr_defined(ainfo.fheap_addr)) { + if (!H5_addr_defined(ainfo.fheap_addr)) { htri_t shareable; /* Whether the attribute will be shared */ size_t raw_size = 0; /* Raw size of message */ /* Check for attribute being shareable */ if ((shareable = H5SM_can_share(loc->file, NULL, NULL, H5O_ATTR_ID, attr)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't determine attribute sharing status") + HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't determine attribute sharing status"); else if (shareable == FALSE) { /* Compute the size needed to encode the attribute */ raw_size = (H5O_MSG_ATTR->raw_size)(loc->file, FALSE, attr); @@ -266,7 +259,8 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) /* Create dense storage for attributes */ if (H5A__dense_create(loc->file, &ainfo) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create dense storage for attributes") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, + "unable to create dense storage for attributes"); /* Set up user data for callback */ udata.f = loc->file; @@ -277,7 +271,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) op.u.lib_op = H5O__attr_to_dense_cb; if (H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCONVERT, FAIL, - "error converting attributes to dense storage") + "error converting attributes to dense storage"); } /* end if */ } /* end if */ @@ -288,7 +282,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) 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) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINC, FAIL, "attribute creation index can't be incremented") + 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 */ attr->shared->crt_idx = ainfo.max_crt_idx++; @@ -300,11 +294,11 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) /* Add the attribute information message, if one is needed */ if (new_ainfo) { if (H5O__msg_append_real(loc->file, 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") + 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, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message"); } /* end if */ else { /* Set "bogus" creation index for attribute */ @@ -315,15 +309,15 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) } /* end else */ /* Check for storing attribute with dense storage */ - if (H5F_addr_defined(ainfo.fheap_addr)) { + if (H5_addr_defined(ainfo.fheap_addr)) { /* Insert attribute into dense storage */ if (H5A__dense_insert(loc->file, &ainfo, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to add to dense storage") + 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, oh, H5O_MSG_ATTR, 0, 0, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new attribute in header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new attribute in header"); /* Increment reference count for shared attribute object for the * object handle created by the caller function H5A__create. The count @@ -338,7 +332,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) /* Retrieve ref count for shared attribute */ if (H5SM_get_refcount(loc->file, H5O_ATTR_ID, &attr->sh_loc, &attr_rc) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") + 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 * storage, decrement the reference count on any shared components @@ -365,19 +359,19 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) */ if (attr_rc > 1) { if (H5O__attr_delete(loc->file, oh, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + 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") + 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, oh, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object"); done: if (oh && H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__attr_create() */ @@ -390,9 +384,6 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -405,15 +396,15 @@ H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(mesg); - HDassert(!udata->attr); + assert(oh); + assert(mesg); + assert(!udata->attr); /* Check for correct attribute message to modify */ 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))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy attribute") + 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 */ @@ -435,9 +426,6 @@ H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, December 11, 2006 - * *------------------------------------------------------------------------- */ H5A_t * @@ -453,36 +441,36 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) FUNC_ENTER_PACKAGE_TAG(loc->addr) /* Check arguments */ - HDassert(loc); - HDassert(name); + assert(loc); + assert(name); /* Protect the object header to iterate over */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") + 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) { /* Check for (& retrieve if available) attribute info */ if (H5A__get_ainfo(loc->file, oh, &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "can't check for attribute info message") + 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) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") + 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))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute") + 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 (H5_addr_defined(ainfo.fheap_addr)) { /* Open attribute with dense storage */ if (NULL == (opened_attr = H5A__dense_open(loc->file, &ainfo, name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute"); } /* end if */ else { H5O_iter_opn_t udata; /* User data for callback */ @@ -496,20 +484,20 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) 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) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "error updating attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "error updating attribute"); /* Check that we found the attribute */ if (!udata.attr) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't locate attribute: '%s'", name) + HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't locate attribute: '%s'", name); /* Get attribute opened from object header */ - HDassert(udata.attr); + assert(udata.attr); opened_attr = udata.attr; } /* end else */ /* Mark datatype as being on disk now */ if (H5T_set_loc(opened_attr->shared->dt, H5F_VOL_OBJ(loc->file), H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location"); } /* end else */ /* Set return value */ @@ -517,12 +505,12 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + 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) - HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__attr_open_by_name() */ @@ -534,9 +522,6 @@ H5O__attr_open_by_name(const H5O_loc_t *loc, const char *name) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 18 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -548,12 +533,12 @@ H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(attr); - HDassert(ret_attr); + assert(attr); + assert(ret_attr); /* Copy attribute information. Shared some attribute information. */ if (NULL == (*ret_attr = H5A__copy(NULL, attr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -567,9 +552,6 @@ H5O__attr_open_by_idx_cb(const H5A_t *attr, void *_ret_attr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, December 18, 2006 - * *------------------------------------------------------------------------- */ H5A_t * @@ -584,7 +566,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); + assert(loc); /* Build attribute operator info */ attr_op.op_type = H5A_ATTR_OP_LIB; @@ -592,28 +574,28 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t /* Iterate over attributes to locate correct one */ if (H5O_attr_iterate_real((hid_t)-1, loc, idx_type, order, n, NULL, &attr_op, &opened_attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, NULL, "can't locate attribute") + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, NULL, "can't locate attribute"); /* 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) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, NULL, "failed in finding opened attribute") + 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) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute"); if (NULL == (opened_attr = H5A__copy(NULL, exist_attr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, NULL, "can't copy existing attribute"); } else { /* Mark datatype as being on disk now */ if (H5T_set_loc(opened_attr->shared->dt, H5F_VOL_OBJ(loc->file), H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "invalid datatype location"); } /* end if */ } /* end if */ @@ -624,7 +606,7 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t /* Release any resources, on error */ if (NULL == ret_value && opened_attr) if (H5A__close(opened_attr) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute") + HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, NULL, "can't close attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__attr_open_by_idx() */ @@ -639,9 +621,6 @@ H5O__attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order_t * FALSE: didn't find the opened object * FAIL: function failed. * - * Programmer: Raymond Lu - * 23 June 2008 - * *------------------------------------------------------------------------- */ static htri_t @@ -656,11 +635,11 @@ H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char *name_ /* Get file serial number for the location of attribute */ if (H5F_get_fileno(loc->file, &loc_fnum) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "can't get file serial number") + 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) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't count opened attributes") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't count opened attributes"); /* Find out whether the attribute has been opened */ if (num_open_attr) { @@ -669,14 +648,14 @@ H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char *name_ /* Allocate space for the attribute ID list */ 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") + 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) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get IDs of opened attributes") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get IDs of opened attributes"); if (check_num_attr != num_open_attr) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "open attribute count mismatch") + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "open attribute count mismatch"); /* Iterate over the attributes */ for (u = 0; u < num_open_attr; u++) { @@ -684,11 +663,11 @@ H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char *name_ /* Get pointer to attribute */ if (NULL == (*attr = (H5A_t *)H5VL_object_verify(attr_id_list[u], H5I_ATTR))) - HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, FAIL, "not an attribute") + 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) - HGOTO_ERROR(H5E_ATTR, H5E_BADVALUE, FAIL, "can't get file serial number") + 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 @@ -716,9 +695,6 @@ H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char *name_ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jan 2 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -732,27 +708,27 @@ H5O__attr_update_shared(H5F_t *f, H5O_t *oh, H5A_t *attr, H5O_shared_t *update_s FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(attr); + assert(f); + assert(attr); /* Extract shared message info from current attribute (for later use) */ if (H5O_set_shared(&sh_mesg, &(attr->sh_loc)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't get shared message") + 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) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to reset attribute sharing") + 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, oh, 0, H5O_ATTR_ID, attr, NULL)) == 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "attribute changed sharing status") + HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "attribute changed sharing status"); else if (shared_mesg < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADMESG, FAIL, "can't share attribute") + 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, H5O_ATTR_ID, &attr->sh_loc, &attr_rc) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") + 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 * components (ie. its reference count is 1), increment the reference @@ -766,16 +742,16 @@ H5O__attr_update_shared(H5F_t *f, H5O_t *oh, H5A_t *attr, H5O_shared_t *update_s if (attr_rc == 1) /* Increment reference count on attribute components */ if (H5O__attr_link(f, oh, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count") + HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count"); /* Remove the old attribute from the SOHM storage */ if (H5SM_delete(f, oh, &sh_mesg) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to delete shared attribute in shared storage") + 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) - HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't get shared message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, FAIL, "can't get shared message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -789,9 +765,6 @@ H5O__attr_update_shared(H5F_t *f, H5O_t *oh, H5A_t *attr, H5O_shared_t *update_s * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 4 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -806,24 +779,24 @@ H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUS FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(mesg); - HDassert(!udata->found); + assert(oh); + assert(mesg); + assert(!udata->found); /* Check for correct attribute message to modify */ if (0 == HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) { /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(udata->f, oh, mesg->chunkno))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk") + 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. * The shared attribute structure will be different in that situation. SLU-2010/7/29 */ if (((H5A_t *)mesg->native)->shared != udata->attr->shared) { /* Sanity check */ - HDassert(((H5A_t *)mesg->native)->shared->data); - HDassert(udata->attr->shared->data); - HDassert(((H5A_t *)mesg->native)->shared->data != udata->attr->shared->data); + assert(((H5A_t *)mesg->native)->shared->data); + assert(udata->attr->shared->data); + assert(((H5A_t *)mesg->native)->shared->data != udata->attr->shared->data); /* (Needs to occur before updating the shared message, or the hash * value on the old & new messages will be the same) */ @@ -837,14 +810,15 @@ H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUS /* Release chunk */ if (H5O__chunk_unprotect(udata->f, chk_proxy, chk_dirtied) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") + 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, 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") + "unable to update attribute in shared storage"); /* Indicate that the object header was modified */ *oh_modified = H5O_MODIFY; @@ -859,7 +833,7 @@ H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUS done: /* Release chunk, if not already done */ if (chk_proxy && H5O__chunk_unprotect(udata->f, chk_proxy, chk_dirtied) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") + 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() */ @@ -871,9 +845,6 @@ H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUS * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, December 4, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -886,26 +857,26 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); - HDassert(attr); + assert(loc); + assert(attr); /* Pin the object header */ if (NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + 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) { /* Check for (& retrieve if available) attribute info */ if (H5A__get_ainfo(loc->file, oh, &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + 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 (H5_addr_defined(ainfo.fheap_addr)) { /* Modify the attribute data in dense storage */ if (H5A__dense_write(loc->file, &ainfo, attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute"); } /* end if */ else { H5O_iter_wrt_t udata; /* User data for callback */ @@ -920,20 +891,20 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr) 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) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute"); /* Check that we found the attribute */ if (!udata.found) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate open attribute?") + 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, oh, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object"); done: if (oh && H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__attr_write */ @@ -946,9 +917,6 @@ H5O__attr_write(const H5O_loc_t *loc, H5A_t *attr) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 5 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -962,9 +930,9 @@ H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(oh); - HDassert(mesg); - HDassert(!udata->found); + assert(oh); + assert(mesg); + assert(!udata->found); /* Check for existing attribute with new name */ if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->new_name) == 0) { @@ -991,9 +959,6 @@ H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 5 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1008,9 +973,9 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(mesg); - HDassert(!udata->found); + assert(oh); + assert(mesg); + assert(!udata->found); /* Find correct attribute message to rename */ if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->old_name) == 0) { @@ -1018,7 +983,7 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(udata->f, oh, mesg->chunkno))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk"); /* Change the name for the attribute */ H5MM_xfree(((H5A_t *)mesg->native)->shared->name); @@ -1026,7 +991,7 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR /* Recompute the version to encode the attribute with */ 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") + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5_ITER_ERROR, "unable to update attribute version"); /* Mark the message as modified */ mesg->dirty = TRUE; @@ -1034,7 +999,8 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR /* Release chunk */ if (H5O__chunk_unprotect(udata->f, chk_proxy, chk_dirtied) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, + "unable to unprotect object header chunk"); chk_proxy = NULL; /* Check for shared message */ @@ -1042,11 +1008,11 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR /* Update the shared attribute in the SOHM storage */ if (H5O__attr_update_shared(udata->f, oh, (H5A_t *)mesg->native, NULL) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, H5_ITER_ERROR, - "unable to update attribute in shared storage") + "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); + assert(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) || @@ -1072,7 +1038,7 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR */ if (H5O__release_mesg(udata->f, oh, mesg, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, H5_ITER_ERROR, - "unable to release previous attribute") + "unable to release previous attribute"); *oh_modified = H5O_MODIFY_CONDENSE; @@ -1081,10 +1047,10 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR if (H5O__msg_append_real(udata->f, 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") + "unable to relocate renamed attribute in header"); /* Sanity check */ - HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr) == FALSE); + assert(H5O_msg_is_shared(H5O_ATTR_ID, attr) == FALSE); /* Close the local copy of the attribute */ H5A__close(attr); @@ -1104,7 +1070,7 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR done: /* Release chunk, if not already done */ if (chk_proxy && H5O__chunk_unprotect(udata->f, chk_proxy, chk_dirtied) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, H5_ITER_ERROR, "unable to unprotect object header chunk") + 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() */ @@ -1116,9 +1082,6 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, December 5, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1131,27 +1094,27 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, const char *new_nam FUNC_ENTER_PACKAGE_TAG(loc->addr) /* Check arguments */ - HDassert(loc); - HDassert(old_name); - HDassert(new_name); + assert(loc); + assert(old_name); + assert(new_name); /* Pin the object header */ if (NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + 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) { /* Check for (& retrieve if available) attribute info */ if (H5A__get_ainfo(loc->file, oh, &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + 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 (H5_addr_defined(ainfo.fheap_addr)) { /* Rename the attribute data in dense storage */ if (H5A__dense_rename(loc->file, &ainfo, old_name, new_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute"); } /* end if */ else { H5O_iter_ren_t udata; /* User data for callback */ @@ -1167,30 +1130,30 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, const char *new_nam 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) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute"); /* If the new name was found, indicate an error */ if (udata.found) - HGOTO_ERROR(H5E_ATTR, H5E_EXISTS, FAIL, "attribute with new name already exists") + 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.u.lib_op = H5O__attr_rename_mod_cb; if (H5O__msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, &op, &udata) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "error updating attribute"); /* Check that we found the attribute to rename */ if (!udata.found) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute with old name") + 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, oh, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object"); done: if (oh && H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__attr_rename() */ @@ -1202,9 +1165,6 @@ H5O__attr_rename(const H5O_loc_t *loc, const char *old_name, const char *new_nam * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, December 5, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1219,32 +1179,32 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index_t idx_type, H FUNC_ENTER_NOAPI_NOINIT_TAG(loc->addr) /* Check arguments */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(attr_op); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(attr_op); /* Protect the object header to iterate over */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") + 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) { /* Check for (& retrieve if available) attribute info */ if (H5A__get_ainfo(loc->file, oh, &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + 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 (H5_addr_defined(ainfo.fheap_addr)) { /* Check for skipping too many attributes */ if (skip > 0 && skip >= ainfo.nattrs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified"); /* Release the object header */ if (H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); oh = NULL; /* Iterate over attributes in dense storage */ @@ -1255,16 +1215,16 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index_t idx_type, H else { /* Build table of attributes for compact storage */ if (H5A__compact_build_table(loc->file, oh, idx_type, order, &atable) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table"); /* Release the object header */ if (H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + 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) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") + 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) @@ -1274,9 +1234,9 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index_t idx_type, H done: /* Release resources */ if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); if (atable.attrs && H5A__attr_release_table(&atable) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_attr_iterate_real() */ @@ -1288,9 +1248,6 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, H5_index_t idx_type, H * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, December 5, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1303,11 +1260,11 @@ H5O__attr_iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsiz FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(attr_op); + assert(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") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); /* Iterate over attributes to locate correct one */ if ((ret_value = @@ -1323,19 +1280,14 @@ H5O__attr_iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsiz * * Purpose: Check for reverting from dense to compact attribute storage * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * Wednesday, February 14, 2007 - * - * Modification:Raymond Lu - * 24 June 2008 * When converting storage from dense to compact, if found * the attribute is already opened, use the opened message * to insert. If not, still use the message in the attribute * table. This will guarantee that the attribute message is * shared between the object in metadata cache and the opened * object. + * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -1347,21 +1299,21 @@ H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); - HDassert(oh); - HDassert(ainfo); + assert(loc); + assert(oh); + assert(ainfo); /* Decrement the number of attributes on the object */ ainfo->nattrs--; /* Check for shifting from dense storage back to compact storage */ - if (H5F_addr_defined(ainfo->fheap_addr) && ainfo->nattrs < oh->min_dense) { + if (H5_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, ainfo, H5_INDEX_NAME, H5_ITER_NATIVE, &atable) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") + 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 @@ -1385,12 +1337,12 @@ H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) /* Check if attribute is shared */ 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") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "error determining if message is shared"); 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, oh, (atable.attrs[u])) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count") + HGOTO_ERROR(H5E_ATTR, H5E_LINKCOUNT, FAIL, "unable to adjust attribute link count"); } /* end if */ else { /* Reset 'shared' status, so attribute will be shared again */ @@ -1402,22 +1354,22 @@ H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) /* 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) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute") + 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, oh, H5O_MSG_ATTR, 0, 0, exist_attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't create message"); } /* end if */ else if (H5O__msg_append_real(loc->file, oh, H5O_MSG_ATTR, 0, 0, (atable.attrs[u])) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't create message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "can't create message"); } /* end for */ /* Remove the dense storage */ if (H5A__dense_delete(loc->file, ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete dense attribute storage") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete dense attribute storage"); } /* end if */ } /* end if */ @@ -1426,20 +1378,20 @@ H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) * accessed via fractal heap/v2 B-tree (HDFFV-9277) */ if (H5O__msg_write_real(loc->file, oh, H5O_MSG_AINFO, H5O_MSG_FLAG_DONTSHARE, 0, ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info message"); /* 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) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute info"); } /* end if */ done: /* Release resources */ if (atable.attrs && H5A__attr_release_table(&atable) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__attr_remove_update() */ @@ -1452,9 +1404,6 @@ H5O__attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1467,15 +1416,15 @@ H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNU FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(mesg); - HDassert(!udata->found); + assert(oh); + assert(mesg); + assert(!udata->found); /* Check for correct attribute message to modify */ 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, oh, mesg, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message"); /* Indicate that the object header was modified */ *oh_modified = H5O_MODIFY_CONDENSE; @@ -1498,9 +1447,6 @@ H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNU * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, December 11, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1514,26 +1460,26 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) FUNC_ENTER_PACKAGE_TAG(loc->addr) /* Check arguments */ - HDassert(loc); - HDassert(name); + assert(loc); + assert(name); /* Pin the object header */ if (NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + 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) { /* Check for (& retrieve if available) attribute info */ if ((ainfo_exists = H5A__get_ainfo(loc->file, oh, &ainfo)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + 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 (H5_addr_defined(ainfo.fheap_addr)) { /* Delete attribute from dense storage */ if (H5A__dense_remove(loc->file, &ainfo, name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage") + 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 */ @@ -1548,25 +1494,25 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) 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) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute"); /* Check that we found the attribute */ if (!udata.found) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute") + 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) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info"); /* Update the modification time, if any */ if (H5O_touch_oh(loc->file, oh, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object"); done: if (oh && H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__attr_remove() */ @@ -1579,9 +1525,6 @@ H5O__attr_remove(const H5O_loc_t *loc, const char *name) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Wednesday, February 14, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1596,25 +1539,25 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order FUNC_ENTER_PACKAGE_TAG(loc->addr) /* Check arguments */ - HDassert(loc); + assert(loc); /* Pin the object header */ if (NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPIN, FAIL, "unable to pin object header") + 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) { /* Check for (& retrieve if available) attribute info */ if ((ainfo_exists = H5A__get_ainfo(loc->file, oh, &ainfo)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + 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 (H5_addr_defined(ainfo.fheap_addr)) { /* Delete attribute from dense storage */ if (H5A__dense_remove_by_idx(loc->file, &ainfo, idx_type, order, n) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute in dense storage") + 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 */ @@ -1622,11 +1565,11 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order /* Build table of attributes for compact storage */ if (H5A__compact_build_table(loc->file, oh, idx_type, order, &atable) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table"); /* Check for skipping too many attributes */ if (n >= atable.nattrs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index specified") + 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; @@ -1637,27 +1580,27 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order 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) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "error deleting attribute"); /* Check that we found the attribute */ if (!udata.found) - HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute") + 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) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update attribute info"); /* Update the modification time, if any */ if (H5O_touch_oh(loc->file, oh, FALSE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUPDATE, FAIL, "unable to update time on object"); done: if (oh && H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); if (atable.attrs && H5A__attr_release_table(&atable) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") + HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__attr_remove_by_idx() */ @@ -1669,9 +1612,6 @@ H5O__attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, H5_iter_order * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Thursday, March 9, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1682,9 +1622,9 @@ H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(oh); - HDassert(nattrs); + assert(f); + assert(oh); + assert(nattrs); /* Check for attributes stored densely */ if (oh->version > H5O_VERSION_1) { @@ -1693,7 +1633,7 @@ H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) /* Attempt to get the attribute information from the object header */ if ((ainfo_exists = H5A__get_ainfo(f, oh, &ainfo)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message"); else if (ainfo_exists > 0) *nattrs = ainfo.nattrs; else @@ -1723,9 +1663,6 @@ H5O__attr_count_real(H5F_t *f, H5O_t *oh, hsize_t *nattrs) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Dec 11 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1738,8 +1675,8 @@ H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, unsig FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(mesg); - HDassert(udata->exists && !*udata->exists); + assert(mesg); + assert(udata->exists && !*udata->exists); /* Check for correct attribute message */ if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) { @@ -1760,9 +1697,6 @@ H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, unsig * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Monday, December 11, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1775,27 +1709,27 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name, hbool_t *attr_exists) FUNC_ENTER_PACKAGE_TAG(loc->addr) /* Check arguments */ - HDassert(loc); - HDassert(name); - HDassert(attr_exists); + assert(loc); + assert(name); + assert(attr_exists); /* Protect the object header to iterate over */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") + 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) { /* Check for (& retrieve if available) attribute info */ if (H5A__get_ainfo(loc->file, oh, &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + 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 (H5_addr_defined(ainfo.fheap_addr)) { /* Check if attribute exists in dense storage */ if (H5A__dense_exists(loc->file, &ainfo, name, attr_exists) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute") + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute"); } /* end if */ else { H5O_iter_xst_t udata; /* User data for callback */ @@ -1809,12 +1743,12 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name, hbool_t *attr_exists) 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) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute") + HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error checking for existence of attribute"); } /* end else */ done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__attr_exists() */ @@ -1826,9 +1760,6 @@ H5O__attr_exists(const H5O_loc_t *loc, const char *name, hbool_t *attr_exists) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * June 19, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1841,9 +1772,9 @@ H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info) FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(oh); - HDassert(bh_info); + assert(f); + assert(oh); + assert(bh_info); /* Attributes are only stored in fractal heap & indexed w/v2 B-tree in later versions */ if (oh->version > H5O_VERSION_1) { @@ -1852,40 +1783,40 @@ H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info) /* Check for (& retrieve if available) attribute info */ if ((ainfo_exists = H5A__get_ainfo(f, oh, &ainfo)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message"); else if (ainfo_exists > 0) { /* Check if name index available */ - if (H5F_addr_defined(ainfo.name_bt2_addr)) { + if (H5_addr_defined(ainfo.name_bt2_addr)) { /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(f, ainfo.name_bt2_addr, NULL))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + 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, &(bh_info->index_size)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") + 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 (H5_addr_defined(ainfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ if (NULL == (bt2_corder = H5B2_open(f, ainfo.corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for creation order index") + "unable to open v2 B-tree for creation order index"); /* Get creation order index B-tree size */ if (H5B2_size(bt2_corder, &(bh_info->index_size)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") + 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 (H5_addr_defined(ainfo.fheap_addr)) { /* Open the fractal heap for attributes */ if (NULL == (fheap = H5HF_open(f, ainfo.fheap_addr))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Get heap storage size */ if (H5HF_size(fheap, &(bh_info->heap_size)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info"); } /* end if */ } /* end else */ } /* end if */ @@ -1893,11 +1824,11 @@ H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info) done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap"); if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index"); if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") + 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() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Object.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5Object.cpp deleted file mode 100644 index d092ef0d6b..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Object.cpp +++ /dev/null @@ -1,576 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5FaccProp.h" -#include "H5FcreatProp.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5DxferProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5DataSpace.h" -#include "H5AbstractDs.h" -#include "H5CommonFG.h" -#include "H5Group.h" -#include "H5File.h" -#include "H5DataSet.h" -#include "H5Attribute.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// userAttrOpWrpr interfaces between the user's function and the -// C library function H5Aiterate2 -extern "C" { - -static herr_t -userAttrOpWrpr(hid_t loc_id, const char *attr_name, const H5A_info_t *ainfo, void *op_data) -{ - // Unused - (void)loc_id; - (void)ainfo; - - H5std_string s_attr_name = H5std_string(attr_name); - UserData4Aiterate *myData = reinterpret_cast(op_data); - myData->op(*myData->location, s_attr_name, myData->opData); - return 0; -} - -// userVisitOpWrpr interfaces between the user's function and the -// C library function H5Ovisit3 -static herr_t -userVisitOpWrpr(hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info, void *op_data) -{ - // Unused - (void)obj_id; - - H5std_string s_attr_name = H5std_string(attr_name); - UserData4Visit *myData = reinterpret_cast(op_data); - int status = myData->op(*myData->obj, s_attr_name, obj_info, myData->opData); - return status; -} - -} // extern "C" - -//-------------------------------------------------------------------------- -// Function: H5Object default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5Object::H5Object() : H5Location() -{ -} - -//-------------------------------------------------------------------------- -// Function: f_Attribute_setId - friend -// Purpose: This function is friend to class H5::Attribute so that it -// can set Attribute::id in order to work around a problem -// described in the JIRA issue HDFFV-7947. -// Applications shouldn't need to use it. -// param attr - IN/OUT: Attribute object to be changed -// param new_id - IN: New id to set -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -f_Attribute_setId(Attribute *attr, hid_t new_id) -{ - attr->p_setId(new_id); -} -#endif - -//-------------------------------------------------------------------------- -// Function: H5Object::createAttribute -///\brief Creates an attribute for a group, dataset, or named datatype. -///\param name - IN: Name of the attribute -///\param data_type - IN: Datatype for the attribute -///\param data_space - IN: Dataspace for the attribute - only simple -/// dataspaces are allowed at this time -///\param create_plist - IN: Creation property list - default to -/// PropList::DEFAULT -///\return Attribute instance -///\exception H5::AttributeIException -///\par Description -/// The attribute name specified in \a name must be unique. -/// Attempting to create an attribute with the same name as an -/// existing attribute will raise an exception, leaving the -/// pre-existing attribute intact. To overwrite an existing -/// attribute with a new attribute of the same name, first -/// delete the existing one with \c H5Object::removeAttr, then -/// recreate it with this function. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute -H5Object::createAttribute(const char *name, const DataType &data_type, const DataSpace &data_space, - const PropList &create_plist) const -{ - hid_t type_id = data_type.getId(); - hid_t space_id = data_space.getId(); - hid_t plist_id = create_plist.getId(); - hid_t attr_id = H5Acreate2(getId(), name, type_id, space_id, plist_id, H5P_DEFAULT); - - // If the attribute id is valid, create and return the Attribute object - if (attr_id > 0) { - Attribute attr; - f_Attribute_setId(&attr, attr_id); - return (attr); - } - else - throw AttributeIException(inMemFunc("createAttribute"), "H5Acreate2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::createAttribute -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute -H5Object::createAttribute(const H5std_string &name, const DataType &data_type, const DataSpace &data_space, - const PropList &create_plist) const -{ - return (createAttribute(name.c_str(), data_type, data_space, create_plist)); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief Opens an attribute given its name. -///\param name - IN: Name of the attribute -///\return Attribute instance -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute -H5Object::openAttribute(const char *name) const -{ - hid_t attr_id = H5Aopen(getId(), name, H5P_DEFAULT); - if (attr_id > 0) { - Attribute attr; - f_Attribute_setId(&attr, attr_id); - return (attr); - } - else { - throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute -H5Object::openAttribute(const H5std_string &name) const -{ - return (openAttribute(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::openAttribute -///\brief Opens an attribute given its index. -///\param idx - IN: Index of the attribute, a 0-based, non-negative integer -///\return Attribute instance -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -Attribute -H5Object::openAttribute(const unsigned int idx) const -{ - hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, static_cast(idx), - H5P_DEFAULT, H5P_DEFAULT); - if (attr_id > 0) { - Attribute attr; - f_Attribute_setId(&attr, attr_id); - return (attr); - } - else { - throw AttributeIException(inMemFunc("openAttribute"), "H5Aopen_by_idx failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: H5Object::iterateAttrs -///\brief Iterates a user's function over all the attributes of an H5 -/// object, which may be a group, dataset or named datatype. -///\param user_op - IN: User's function to operate on each attribute -///\param _idx - IN/OUT: Starting (IN) and ending (OUT) attribute indices -///\param op_data - IN: User's data to pass to user's operator function -///\return Returned value of the last operator if it was non-zero, or -/// zero if all attributes were processed -///\exception H5::AttributeIException -///\par Description -/// The signature of user_op is -/// void (*)(H5::H5Location&, H5std_string, void*). -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data) -{ - // store the user's function and data - UserData4Aiterate *userData = new UserData4Aiterate; - userData->opData = op_data; - userData->op = user_op; - userData->location = this; - - // call the C library routine H5Aiterate2 to iterate the attributes - hsize_t idx = _idx ? static_cast(*_idx) : 0; - int ret_value = - H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, userAttrOpWrpr, static_cast(userData)); - - // release memory - delete userData; - - if (ret_value >= 0) { - /* Pass back update index value to calling code */ - if (_idx) - *_idx = static_cast(idx); - return (ret_value); - } - else // raise exception when H5Aiterate returns a negative value - throw AttributeIException(inMemFunc("iterateAttrs"), "H5Aiterate2 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::visit -///\brief Recursively visits all HDF5 objects accessible from this object. -///\param idx_type - IN: Type of index; valid values include: -/// \li \c H5_INDEX_NAME -/// \li \c H5_INDEX_CRT_ORDER -///\param order - IN: Order in which index is traversed; valid values include: -/// \li \c H5_ITER_DEC -/// \li \c H5_ITER_INC -/// \li \c H5_ITER_NATIVE -///\param user_op - IN: Callback function passing data regarding the -/// object to the calling application -///\param *op_data - IN: User-defined pointer to data required by the -/// application for its processing of the object -///\param fields - IN: Flags specifying the fields to be retrieved -/// to the callback op via the H5O_info2_t argument. -/// \li \c H5O_INFO_BASIC fileno, addr, type, and rc fields -/// \li \c H5O_INFO_TIME atime, mtime, ctime, and btime fields -/// \li \c H5O_INFO_NUM_ATTRS num_attrs field -/// \li \c H5O_INFO_ALL H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS -///\return -/// \li On success: -/// \li the return value of the first operator that returns a positive value -/// \li zero if all members were processed with no operator returning non-zero -/// \li On failure: -/// \li an exception Exception will be thrown if something went -/// wrong within the library or the operator failed -///\exception H5::Exception -///\par Description -/// For information, please refer to the H5Ovisit3 API in the HDF5 -/// C Reference Manual. -// Programmer Binh-Minh Ribler - Feb, 2019 -//-------------------------------------------------------------------------- -void -H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, - unsigned int fields) -{ - // Store the user's function and data - UserData4Visit *userData = new UserData4Visit; - userData->opData = op_data; - userData->op = user_op; - userData->obj = this; - - // Call the C API passing in op wrapper and info - herr_t ret_value = - H5Ovisit3(getId(), idx_type, order, userVisitOpWrpr, static_cast(userData), fields); - - // Release memory - delete userData; - - // Throw exception if H5Ovisit3 failed, which could be a failure in - // the library or in the call back operator - if (ret_value < 0) - throw Exception(inMemFunc("visit"), "H5Ovisit3 failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::objVersion -///\brief Returns the header version of this HDF5 object. -///\return Object version, which can have the following values: -/// \li \c H5O_VERSION_1 -/// \li \c H5O_VERSION_2 -///\exception H5::ObjHeaderIException -/// Exception will be thrown when: -/// - an error returned by the C API -/// - version number is not one of the valid values above -// Programmer Binh-Minh Ribler - December, 2016 -//-------------------------------------------------------------------------- -unsigned -H5Object::objVersion() const -{ - H5O_native_info_t objinfo; - unsigned version = 0; - - // Use C API to get information of the object - herr_t ret_value = H5Oget_native_info(getId(), &objinfo, H5O_NATIVE_INFO_HDR); - - // Throw exception if C API returns failure - if (ret_value < 0) - throw Exception(inMemFunc("objVersion"), "H5Oget_native_info failed"); - // Return a valid version or throw an exception for invalid value - else { - version = objinfo.hdr.version; - if (version != H5O_VERSION_1 && version != H5O_VERSION_2) - throw ObjHeaderIException("objVersion", "Invalid version for object"); - } - return (version); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::getNumAttrs -///\brief Returns the number of attributes attached to this HDF5 object. -///\return Number of attributes -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -int -H5Object::getNumAttrs() const -{ - H5O_info2_t oinfo; /* Object info */ - - if (H5Oget_info3(getId(), &oinfo, H5O_INFO_NUM_ATTRS) < 0) - throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); - else - return (static_cast(oinfo.num_attrs)); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::attrExists -///\brief Checks whether the named attribute exists at this location. -///\param name - IN: Name of the attribute to be queried -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2013 -//-------------------------------------------------------------------------- -bool -H5Object::attrExists(const char *name) const -{ - // Call C routine H5Aexists to determine whether an attribute exists - // at this location, which could be specified by a file, group, dataset, - // or named datatype. - herr_t ret_value = H5Aexists(getId(), name); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else // Raise exception when H5Aexists returns a negative value - throw AttributeIException(inMemFunc("attrExists"), "H5Aexists failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::attrExists -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -bool -H5Object::attrExists(const H5std_string &name) const -{ - return (attrExists(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::removeAttr -///\brief Removes the named attribute from this object. -///\param name - IN: Name of the attribute to be removed -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Object::removeAttr(const char *name) const -{ - herr_t ret_value = H5Adelete(getId(), name); - if (ret_value < 0) - throw AttributeIException(inMemFunc("removeAttr"), "H5Adelete failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::removeAttr -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -H5Object::removeAttr(const H5std_string &name) const -{ - removeAttr(name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::renameAttr -///\brief Renames the named attribute from this object. -///\param oldname - IN: Name of the attribute to be renamed -///\param newname - IN: New name ame of the attribute -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Mar, 2005 -//-------------------------------------------------------------------------- -void -H5Object::renameAttr(const char *oldname, const char *newname) const -{ - herr_t ret_value = H5Arename(getId(), oldname, newname); - if (ret_value < 0) - throw AttributeIException(inMemFunc("renameAttr"), "H5Arename failed"); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::renameAttr -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function in that it takes -/// a reference to an \c H5std_string for the names. -// Programmer Binh-Minh Ribler - Mar, 2005 -//-------------------------------------------------------------------------- -void -H5Object::renameAttr(const H5std_string &oldname, const H5std_string &newname) const -{ - renameAttr(oldname.c_str(), newname.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: getObjName -///\brief Given an id, returns the type of the object. -///\return The name of the object -// Programmer Binh-Minh Ribler - Mar, 2014 -//-------------------------------------------------------------------------- -ssize_t -H5Object::getObjName(char *obj_name, size_t buf_size) const -{ - // H5Iget_name will get buf_size-1 chars of the name to null terminate it - ssize_t name_size = H5Iget_name(getId(), obj_name, buf_size); - - // If H5Iget_name returns a negative value, raise an exception - if (name_size < 0) { - throw Exception(inMemFunc("getObjName"), "H5Iget_name failed"); - } - else if (name_size == 0) { - throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0"); - } - // Return length of the name - return (name_size); -} - -//-------------------------------------------------------------------------- -// Function: H5Object::getObjName -///\brief Returns the name of this object as an \a H5std_string. -///\return Name of the object -///\exception H5::Exception -// Programmer Binh-Minh Ribler - Mar, 2014 -//-------------------------------------------------------------------------- -H5std_string -H5Object::getObjName() const -{ - H5std_string obj_name; // object name to return - - // Preliminary call to get the size of the object name - ssize_t name_size = H5Iget_name(getId(), NULL, 0); - - // If H5Iget_name failed, throw exception - if (name_size < 0) { - throw Exception(inMemFunc("getObjName"), "H5Iget_name failed"); - } - else if (name_size == 0) { - throw Exception(inMemFunc("getObjName"), "Object must have a name, but name length is 0"); - } - // Object's name exists, retrieve it - else if (name_size > 0) { - - // The actual size is the cast value + 1 for the terminal ASCII NUL - // (unfortunate in/out type sign mismatch) - size_t actual_name_size = static_cast(name_size) + 1; - - // Create buffer for C string - char *name_C = new char[actual_name_size](); - - // Use overloaded function - name_size = getObjName(name_C, actual_name_size); - - // Convert the C object name to return - obj_name = name_C; - - // Clean up resource - delete[] name_C; - } - - // Return object's name - return obj_name; -} - -//-------------------------------------------------------------------------- -// Function: H5Object::getObjName -///\brief Gets the name of this object, returning its length. -///\param obj_name - OUT: Buffer for the name string as \a H5std_string -///\param len - IN: Desired length of the name, default to 0 -///\return Actual length of the object name -///\exception H5::Exception -///\par Description -/// This function retrieves the object's name as an std string. -/// buf_size can specify a specific length or default to 0, in -/// which case the entire name will be retrieved. -// Programmer Binh-Minh Ribler - Mar, 2014 -//-------------------------------------------------------------------------- -ssize_t -H5Object::getObjName(H5std_string &obj_name, size_t len) const -{ - ssize_t name_size = 0; - - // If no length is provided, get the entire object name - if (len == 0) { - obj_name = getObjName(); - name_size = static_cast(obj_name.length()); - } - // If length is provided, get that number of characters in name - else { - // Create buffer for C string - char *name_C = new char[len + 1](); - - // Use overloaded function - name_size = getObjName(name_C, len + 1); - - // Convert the C object name to return - obj_name = name_C; - - // Clean up resource - delete[] name_C; - } - // Otherwise, keep obj_name intact - - // Return name size - return name_size; -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: H5Object destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5Object::~H5Object() -{ -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Obogus.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Obogus.c index 8ef1abc0f1..364629b43c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Obogus.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Obogus.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Obogus.c - * Jan 21 2003 - * Quincey Koziol * * Purpose: "bogus" message. This message is guaranteed to never * be found in a valid HDF5 file and is only used to @@ -96,38 +93,34 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{ * Purpose: Decode a "bogus" message and return a pointer to a new * native message struct. * - * Return: Success: Ptr to new message in native struct. - * + * Return: Success: Pointer to new message in native struct * Failure: NULL - * - * Programmer: Quincey Koziol - * Jan 21 2003 - * *------------------------------------------------------------------------- */ static void * -H5O__bogus_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__bogus_decode(H5F_t *f, H5O_t H5_ATTR_NDEBUG_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_bogus_t *mesg = NULL; - void *ret_value; /* Return value */ + const uint8_t *p_end = p + p_size - 1; + H5O_bogus_t *mesg = NULL; + void *ret_value; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); /* Allocate the bogus message */ if (NULL == (mesg = (H5O_bogus_t *)H5MM_calloc(sizeof(H5O_bogus_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - /* decode */ + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT32DECODE(p, mesg->u); /* Validate the bogus info */ if (mesg->u != H5O_BOGUS_VALUE) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid bogus value :-)") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid bogus value :-)"); /* Set return value */ ret_value = mesg; @@ -146,9 +139,6 @@ H5O__bogus_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 21 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -158,9 +148,9 @@ H5O__bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(mesg); + assert(f); + assert(p); + assert(mesg); /* encode */ UINT32ENCODE(p, H5O_BOGUS_VALUE); @@ -180,9 +170,6 @@ H5O__bogus_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared * * Failure: Negative * - * Programmer: Quincey Koziol - * Jan 21 2003 - * *------------------------------------------------------------------------- */ static size_t @@ -201,9 +188,6 @@ H5O__bogus_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sh * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 21 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -214,13 +198,13 @@ H5O__bogus_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s `%u'\n", indent, "", fwidth, "Bogus Value:", mesg->u); + fprintf(stream, "%*s%-*s `%u'\n", indent, "", fwidth, "Bogus Value:", mesg->u); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__bogus_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Obtreek.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Obtreek.c index d219e782cf..0bac54e508 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Obtreek.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Obtreek.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Thursday, March 1, 2007 - * +/* * Purpose: A message holding non-default v1 B-tree 'K' value * information in the superblock extension. */ @@ -60,49 +57,56 @@ const H5O_msg_class_t H5O_MSG_BTREEK[1] = {{ #define H5O_BTREEK_VERSION 0 /*------------------------------------------------------------------------- - * Function: H5O__btreek_decode + * Function: H5O__btreek_decode * - * Purpose: Decode a shared message table message and return a pointer + * Purpose: Decode a shared message table message and return a pointer * to a newly allocated H5O_btreek_t struct. * - * Return: Success: Ptr to new message in native struct. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Mar 1, 2007 - * + * Return: Success: Pointer to new message in native struct + * Failure: NULL *------------------------------------------------------------------------- */ static void * -H5O__btreek_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__btreek_decode(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, + unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, + const uint8_t *p) { - H5O_btreek_t *mesg; /* Native message */ - void *ret_value = NULL; /* Return value */ + const uint8_t *p_end = p + p_size - 1; /* End of input buffer */ + H5O_btreek_t *mesg = NULL; /* Native message */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); /* Version of message */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (*p++ != H5O_BTREEK_VERSION) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message"); /* Allocate space for message */ if (NULL == (mesg = (H5O_btreek_t *)H5MM_calloc(sizeof(H5O_btreek_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for v1 B-tree 'K' message") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for v1 B-tree 'K' message"); /* Retrieve non-default B-tree 'K' values */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, mesg->btree_k[H5B_CHUNK_ID]); + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, mesg->btree_k[H5B_SNODE_ID]); + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, mesg->sym_leaf_k); /* Set return value */ ret_value = (void *)mesg; done: + if (NULL == ret_value) + H5MM_free(mesg); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__btreek_decode() */ @@ -113,9 +117,6 @@ H5O__btreek_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsig * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 1, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -127,9 +128,9 @@ H5O__btreek_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_share FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); - HDassert(p); - HDassert(mesg); + assert(f); + assert(p); + assert(mesg); /* Store version and non-default v1 B-tree 'K' values */ *p++ = H5O_BTREEK_VERSION; @@ -149,9 +150,6 @@ H5O__btreek_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_share * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: Quincey Koziol - * Mar 1, 2007 - * *------------------------------------------------------------------------- */ static void * @@ -164,11 +162,11 @@ H5O__btreek_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(mesg); + assert(mesg); if (!dest && NULL == (dest = (H5O_btreek_t *)H5MM_malloc(sizeof(H5O_btreek_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for shared message table message") + "memory allocation failed for shared message table message"); /* All this message requires is a shallow copy */ *dest = *mesg; @@ -189,9 +187,6 @@ H5O__btreek_copy(const void *_mesg, void *_dest) * Return: Success: Message data size in bytes w/o alignment. * Failure: 0 * - * Programmer: Quincey Koziol - * Mar 1, 2007 - * *------------------------------------------------------------------------- */ static size_t @@ -203,7 +198,7 @@ H5O__btreek_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_s FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); + assert(f); ret_value = 1 + /* Version number */ 2 + /* Chunked storage internal B-tree 'K' value */ @@ -220,9 +215,6 @@ H5O__btreek_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_s * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 1, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -233,18 +225,18 @@ H5O__btreek_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); - HDassert(mesg); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Chunked storage internal B-tree 'K' value:", mesg->btree_k[H5B_CHUNK_ID]); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Symbol table node internal B-tree 'K' value:", mesg->btree_k[H5B_SNODE_ID]); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Symbol table node leaf 'K' value:", mesg->sym_leaf_k); + assert(f); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Chunked storage internal B-tree 'K' value:", mesg->btree_k[H5B_CHUNK_ID]); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Symbol table node internal B-tree 'K' value:", mesg->btree_k[H5B_SNODE_ID]); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Symbol table node leaf 'K' value:", mesg->sym_leaf_k); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__btreek_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ocache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ocache.c index 5088a4661e..4a56cb2216 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ocache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ocache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5Ocache.c - * Sep 28 2005 - * Quincey Koziol * - * Purpose: Object header metadata cache virtual functions. + * Purpose: Object header metadata cache virtual functions * *------------------------------------------------------------------------- */ @@ -31,13 +28,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free lists */ -#include "H5MFprivate.h" /* File memory management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5WBprivate.h" /* Wrapped Buffers */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free lists */ +#include "H5MFprivate.h" /* File memory management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5WBprivate.h" /* Wrapped Buffers */ /****************/ /* Local Macros */ @@ -75,7 +72,7 @@ static herr_t H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing); static herr_t H5O__cache_chk_free_icr(void *thing); /* Prefix routines */ -static herr_t H5O__prefix_deserialize(const uint8_t *image, H5O_cache_ud_t *udata); +static herr_t H5O__prefix_deserialize(const uint8_t *image, size_t len, H5O_cache_ud_t *udata); /* Chunk routines */ static herr_t H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t *image, @@ -145,15 +142,10 @@ H5FL_SEQ_DEFINE(H5O_cont_t); /*------------------------------------------------------------------------- * Function: H5O__cache_get_initial_load_size() * - * Purpose: Tell the metadata cache how much data to read from file in - * the first speculative read for the object header. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/28/14 + * Purpose: Tell the metadata cache how much data to read from file in + * the first speculative read for the object header. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -161,8 +153,7 @@ H5O__cache_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *image_len) { FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(image_len); + assert(image_len); /* Set the image length size */ *image_len = H5O_SPEC_READ_SIZE; @@ -173,37 +164,30 @@ H5O__cache_get_initial_load_size(void H5_ATTR_UNUSED *_udata, size_t *image_len) /*------------------------------------------------------------------------- * Function: H5O__cache_get_final_load_size() * - * Purpose: Tell the metadata cache the final size of an object header. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * November 18, 2016 + * Purpose: Tell the metadata cache the final size of an object header. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5O__cache_get_final_load_size(const void *image, size_t H5_ATTR_NDEBUG_UNUSED image_len, void *_udata, - size_t *actual_len) +H5O__cache_get_final_load_size(const void *image, size_t image_len, void *_udata, size_t *actual_len) { H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(image); - HDassert(udata); - HDassert(actual_len); - HDassert(*actual_len == image_len); + assert(image); + assert(udata); + assert(actual_len); + assert(*actual_len == image_len); /* Deserialize the object header prefix */ - if (H5O__prefix_deserialize((const uint8_t *)image, udata) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't deserialize object header prefix") + if (H5O__prefix_deserialize((const uint8_t *)image, image_len, udata) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't deserialize object header prefix"); /* Sanity check */ - HDassert(udata->oh); + assert(udata->oh); /* Set the final size for the cache image */ *actual_len = udata->chunk0_size + (size_t)H5O_SIZEOF_HDR(udata->oh); @@ -220,10 +204,6 @@ H5O__cache_get_final_load_size(const void *image, size_t H5_ATTR_NDEBUG_UNUSED i * * Return: Success: TRUE/FALSE * Failure: Negative - * - * Programmer: Vailin Choi - * Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -231,14 +211,13 @@ H5O__cache_verify_chksum(const void *_image, size_t len, void *_udata) { const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */ - htri_t ret_value = TRUE; /* Return value */ + htri_t ret_value = TRUE; FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(image); - HDassert(udata); - HDassert(udata->oh); + assert(image); + assert(udata); + assert(udata->oh); /* There is no checksum for version 1 */ if (udata->oh->version != H5O_VERSION_1) { @@ -250,18 +229,18 @@ H5O__cache_verify_chksum(const void *_image, size_t len, void *_udata) if (stored_chksum != computed_chksum) { /* These fields are not deserialized yet in H5O__prefix_deserialize() */ - HDassert(udata->oh->chunk == NULL); - HDassert(udata->oh->mesg == NULL); - HDassert(udata->oh->proxy == NULL); + assert(udata->oh->chunk == NULL); + assert(udata->oh->mesg == NULL); + assert(udata->oh->proxy == NULL); /* Indicate that udata->oh is to be freed later in H5O__prefix_deserialize() */ udata->free_oh = TRUE; ret_value = FALSE; - } /* end if */ - } /* end if */ + } + } else - HDassert(!(udata->common.file_intent & H5F_ACC_SWMR_WRITE)); + assert(!(udata->common.file_intent & H5F_ACC_SWMR_WRITE)); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__cache_verify_chksum() */ @@ -269,21 +248,18 @@ H5O__cache_verify_chksum(const void *_image, size_t len, void *_udata) /*------------------------------------------------------------------------- * Function: H5O__cache_deserialize * - * Purpose: Attempt to deserialize the object header contained in the - * supplied buffer, load the data into an instance of H5O_t, and - * return a pointer to the new instance. + * Purpose: Attempt to deserialize the object header contained in the + * supplied buffer, load the data into an instance of H5O_t, and + * return a pointer to the new instance. * - * Note that the object header is read with with a speculative read. - * If the initial read is too small, make note of this fact and return - * without error. H5C__load_entry() will note the size discrepancy - * and retry the deserialize operation with the correct size read. + * Note that the object header is read with with a speculative + * read. If the initial read is too small, make note of this fact + * and return without error. H5C__load_entry() will note the + * size discrepancy and retry the deserialize operation with + * the correct size read. * * Return: Success: Pointer to in core representation * Failure: NULL - * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static void * @@ -291,31 +267,29 @@ H5O__cache_deserialize(const void *image, size_t len, void *_udata, hbool_t *dir { H5O_t *oh = NULL; /* Object header read in */ H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */ - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(image); - HDassert(len > 0); - HDassert(udata); - HDassert(udata->common.f); - HDassert(udata->common.cont_msg_info); - HDassert(dirty); - - /* Check for partially deserialized object header */ - /* (Object header prefix will be deserialized if the object header came - * through the 'get_final_load_size' callback and not deserialized if - * the object header is coming from a cache image - QAK, 2016/12/14) + assert(image); + assert(len > 0); + assert(udata); + assert(udata->common.f); + assert(udata->common.cont_msg_info); + assert(dirty); + + /* Check for partially deserialized object header + * + * The Object header prefix will be deserialized if the object header came + * through the 'get_final_load_size' callback and not deserialized if + * the object header is coming from a cache image. */ if (NULL == udata->oh) { /* Deserialize the object header prefix */ - if (H5O__prefix_deserialize((const uint8_t *)image, udata) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't deserialize object header prefix") - - /* Sanity check */ - HDassert(udata->oh); - } /* end if */ + if (H5O__prefix_deserialize((const uint8_t *)image, len, udata) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't deserialize object header prefix"); + assert(udata->oh); + } /* Retrieve partially deserialized object header from user data */ oh = udata->oh; @@ -327,15 +301,15 @@ H5O__cache_deserialize(const void *image, size_t len, void *_udata, hbool_t *dir if (oh->swmr_write) { /* Create virtual entry, for use as proxy */ if (NULL == (oh->proxy = H5AC_proxy_entry_create())) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, NULL, "can't create object header proxy") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, NULL, "can't create object header proxy"); + } else oh->proxy = NULL; /* Parse the first chunk */ if (H5O__chunk_deserialize(oh, udata->common.addr, udata->chunk0_size, (const uint8_t *)image, len, &(udata->common), dirty) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize first object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize first object header chunk"); /* Note that we've loaded the object header from the file */ udata->made_attempt = TRUE; @@ -347,7 +321,7 @@ H5O__cache_deserialize(const void *image, size_t len, void *_udata, hbool_t *dir /* Release the [possibly partially initialized] object header on errors */ if (!ret_value && oh) if (H5O__free(oh, FALSE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header data") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header data"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__cache_deserialize() */ @@ -355,16 +329,11 @@ H5O__cache_deserialize(const void *image, size_t len, void *_udata, hbool_t *dir /*------------------------------------------------------------------------- * Function: H5O__cache_image_len * - * Purpose: Compute the size in bytes of the specified instance of - * H5O_t on disk, and return it in *image_len. On failure, - * the value of *image_len is undefined. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/28/14 + * Purpose: Compute the size in bytes of the specified instance of + * H5O_t on disk, and return it in *image_len. On failure, + * the value of *image_len is undefined. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -374,11 +343,9 @@ H5O__cache_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(oh); - HDassert(oh->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(oh->cache_info.type == H5AC_OHDR); - HDassert(image_len); + assert(oh); + assert(oh->cache_info.type == H5AC_OHDR); + assert(image_len); /* Report the object header's prefix+first chunk length */ *image_len = oh->chunk[0].size; @@ -389,15 +356,10 @@ H5O__cache_image_len(const void *_thing, size_t *image_len) /*------------------------------------------------------------------------- * Function: H5O__cache_serialize * - * Purpose: Serialize the contents of the supplied object header, and - * load this data into the supplied buffer. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/28/14 + * Purpose: Serialize the contents of the supplied object header, and + * load this data into the supplied buffer. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -405,17 +367,15 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) { H5O_t *oh = (H5O_t *)_thing; /* Object header to encode */ uint8_t *chunk_image; /* Pointer to object header prefix buffer */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(oh); - HDassert(oh->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(oh->cache_info.type == H5AC_OHDR); - HDassert(oh->chunk[0].size == len); + assert(f); + assert(image); + assert(oh); + assert(oh->cache_info.type == H5AC_OHDR); + assert(oh->chunk[0].size == len); #ifdef H5O_DEBUG H5O__assert(oh); #endif /* H5O_DEBUG */ @@ -433,11 +393,11 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) if (oh->version > H5O_VERSION_1) { uint64_t chunk0_size; /* Size of chunk 0's data */ - HDassert(oh->chunk[0].size >= (size_t)H5O_SIZEOF_HDR(oh)); + assert(oh->chunk[0].size >= (size_t)H5O_SIZEOF_HDR(oh)); chunk0_size = oh->chunk[0].size - (size_t)H5O_SIZEOF_HDR(oh); /* Verify magic number */ - HDassert(!HDmemcmp(chunk_image, H5O_HDR_MAGIC, H5_SIZEOF_MAGIC)); + assert(!memcmp(chunk_image, H5O_HDR_MAGIC, H5_SIZEOF_MAGIC)); chunk_image += H5_SIZEOF_MAGIC; /* Version */ @@ -452,29 +412,29 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) UINT32ENCODE(chunk_image, oh->mtime); UINT32ENCODE(chunk_image, oh->ctime); UINT32ENCODE(chunk_image, oh->btime); - } /* end if */ + } /* Attribute fields */ if (oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) { UINT16ENCODE(chunk_image, oh->max_compact); UINT16ENCODE(chunk_image, oh->min_dense); - } /* end if */ + } /* First chunk size */ switch (oh->flags & H5O_HDR_CHUNK0_SIZE) { case 0: /* 1 byte size */ - HDassert(chunk0_size < 256); + assert(chunk0_size < 256); *chunk_image++ = (uint8_t)chunk0_size; break; case 1: /* 2 byte size */ - HDassert(chunk0_size < 65536); + assert(chunk0_size < 65536); UINT16ENCODE(chunk_image, chunk0_size); break; case 2: /* 4 byte size */ /* use <= 2**32 -1 to stay within 4 bytes integer range */ - HDassert(chunk0_size <= 4294967295UL); + assert(chunk0_size <= 4294967295UL); UINT32ENCODE(chunk_image, chunk0_size); break; @@ -483,9 +443,9 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) break; default: - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad size for chunk 0") - } /* end switch */ - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad size for chunk 0"); + } + } else { /* Version */ *chunk_image++ = oh->version; @@ -496,7 +456,7 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) /* Number of messages */ #ifdef H5O_ENABLE_BAD_MESG_COUNT if (oh->store_bad_mesg_count) - UINT16ENCODE(chunk_image, (oh->nmesgs - 1)) + UINT16ENCODE(chunk_image, (oh->nmesgs - 1)); else #endif /* H5O_ENABLE_BAD_MESG_COUNT */ UINT16ENCODE(chunk_image, oh->nmesgs); @@ -508,16 +468,16 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) UINT32ENCODE(chunk_image, (oh->chunk[0].size - (size_t)H5O_SIZEOF_HDR(oh))); /* Zero to alignment */ - HDmemset(chunk_image, 0, (size_t)(H5O_SIZEOF_HDR(oh) - 12)); + memset(chunk_image, 0, (size_t)(H5O_SIZEOF_HDR(oh) - 12)); chunk_image += (size_t)(H5O_SIZEOF_HDR(oh) - 12); - } /* end else */ + } - HDassert((size_t)(chunk_image - oh->chunk[0].image) == - (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); + assert((size_t)(chunk_image - oh->chunk[0].image) == + (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); /* Serialize messages for this chunk */ if (H5O__chunk_serialize(f, oh, (unsigned)0) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize first object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize first object header chunk"); /* copy the chunk into the image -- this is potentially expensive. * Can we rework things so that the object header and the cache @@ -534,42 +494,35 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) * * Purpose: Handle cache action notifications * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Quincey Koziol - * Jul 23 2016 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5O__cache_notify(H5AC_notify_action_t action, void *_thing) { H5O_t *oh = (H5O_t *)_thing; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ - HDassert(oh); + assert(oh); switch (action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: case H5AC_NOTIFY_ACTION_AFTER_LOAD: if (oh->swmr_write) { /* Sanity check */ - HDassert(oh->proxy); + assert(oh->proxy); /* Register the object header as a parent of the virtual entry */ if (H5AC_proxy_entry_add_parent(oh->proxy, oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't add object header as parent of proxy") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't add object header as parent of proxy"); + } break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: - /* do nothing */ + /* Do nothing */ break; case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: { @@ -582,27 +535,27 @@ H5O__cache_notify(H5AC_notify_action_t action, void *_thing) #ifndef NDEBUG /* Reset the number of messages dirtied by decoding */ oh->ndecode_dirtied = 0; -#endif /* NDEBUG */ +#endif } break; case H5AC_NOTIFY_ACTION_CHILD_DIRTIED: case H5AC_NOTIFY_ACTION_CHILD_CLEANED: case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ + /* Do nothing */ break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: if (oh->swmr_write) { /* Unregister the object header as a parent of the virtual entry */ if (H5AC_proxy_entry_remove_parent(oh->proxy, oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't remove object header as parent of proxy") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't remove object header as parent of proxy"); + } break; default: - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unknown action from metadata cache") - } /* end switch */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -611,36 +564,25 @@ H5O__cache_notify(H5AC_notify_action_t action, void *_thing) /*------------------------------------------------------------------------- * Function: H5O__cache_free_icr * - * Purpose: Free the in core representation of the supplied object header. - * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/28/14 + * Purpose: Free the in core representation of the supplied object header. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5O__cache_free_icr(void *_thing) { H5O_t *oh = (H5O_t *)_thing; /* Object header to destroy */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(oh); - HDassert(oh->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(oh->cache_info.type == H5AC_OHDR); + assert(oh); + assert(oh->cache_info.type == H5AC_OHDR); /* Destroy object header */ if (H5O__free(oh, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't destroy object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't destroy object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -649,16 +591,11 @@ H5O__cache_free_icr(void *_thing) /*------------------------------------------------------------------------- * Function: H5O__cache_chk_get_initial_load_size() * - * Purpose: Tell the metadata cache how large the on disk image of the - * chunk proxy is, so it can load the image into a buffer for the - * deserialize call. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/28/14 + * Purpose: Tell the metadata cache how large the on disk image of the + * chunk proxy is, so it can load the image into a buffer for the + * deserialize call. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -668,10 +605,9 @@ H5O__cache_chk_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(udata); - HDassert(udata->oh); - HDassert(image_len); + assert(udata); + assert(udata->oh); + assert(image_len); /* Set the image length size */ *image_len = udata->size; @@ -687,10 +623,6 @@ H5O__cache_chk_get_initial_load_size(void *_udata, size_t *image_len) * * Return: Success: TRUE/FALSE * Failure: Negative - * - * Programmer: Vailin Choi - * Aug 2015 - * *------------------------------------------------------------------------- */ static htri_t @@ -698,12 +630,11 @@ H5O__cache_chk_verify_chksum(const void *_image, size_t len, void *_udata) { const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ H5O_chk_cache_ud_t *udata = (H5O_chk_cache_ud_t *)_udata; /* User data for callback */ - htri_t ret_value = TRUE; /* Return value */ + htri_t ret_value = TRUE; FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(image); + assert(image); /* There is no checksum for version 1 */ if (udata->oh->version != H5O_VERSION_1) { @@ -715,7 +646,7 @@ H5O__cache_chk_verify_chksum(const void *_image, size_t len, void *_udata) if (stored_chksum != computed_chksum) ret_value = FALSE; - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__cache_chk_verify_chksum() */ @@ -723,16 +654,12 @@ H5O__cache_chk_verify_chksum(const void *_image, size_t len, void *_udata) /*------------------------------------------------------------------------- * Function: H5O__cache_chk_deserialize * - * Purpose: Attempt to deserialize the object header continuation chunk - * contained in the supplied buffer, load the data into an instance - * of H5O_chunk_proxy_t, and return a pointer to the new instance. + * Purpose: Attempt to deserialize the object header continuation chunk + * contained in the supplied buffer, load the data into an instance + * of H5O_chunk_proxy_t, and return a pointer to the new instance. * * Return: Success: Pointer to in core representation * Failure: NULL - * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static void * @@ -740,39 +667,37 @@ H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata, hbool_t { H5O_chunk_proxy_t *chk_proxy = NULL; /* Chunk proxy object */ H5O_chk_cache_ud_t *udata = (H5O_chk_cache_ud_t *)_udata; /* User data for callback */ - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(image); - HDassert(len > 0); - HDassert(udata); - HDassert(udata->oh); - HDassert(dirty); + assert(image); + assert(len > 0); + assert(udata); + assert(udata->oh); + assert(dirty); /* Allocate space for the object header data structure */ if (NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Check if we are still decoding the object header */ /* (as opposed to bringing a piece of it back from the file) */ if (udata->decoding) { - /* Sanity check */ - HDassert(udata->common.f); - HDassert(udata->common.cont_msg_info); + assert(udata->common.f); + assert(udata->common.cont_msg_info); /* Parse the chunk */ if (H5O__chunk_deserialize(udata->oh, udata->common.addr, udata->size, (const uint8_t *)image, len, &(udata->common), dirty) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize object header chunk"); /* Set the chunk number for the chunk proxy */ H5_CHECKED_ASSIGN(chk_proxy->chunkno, unsigned, udata->oh->nchunks - 1, size_t); - } /* end if */ + } else { /* Sanity check */ - HDassert(udata->chunkno < udata->oh->nchunks); + assert(udata->chunkno < udata->oh->nchunks); /* Set the chunk number for the chunk proxy */ chk_proxy->chunkno = udata->chunkno; @@ -780,13 +705,13 @@ H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata, hbool_t /* Sanity check that the chunk representation we have in memory is * the same as the one being brought in from disk. */ - HDassert(0 == HDmemcmp(image, udata->oh->chunk[chk_proxy->chunkno].image, - udata->oh->chunk[chk_proxy->chunkno].size)); - } /* end else */ + assert(0 == memcmp(image, udata->oh->chunk[chk_proxy->chunkno].image, + udata->oh->chunk[chk_proxy->chunkno].size)); + } /* Increment reference count of object header */ if (H5O__inc_rc(udata->oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, NULL, "can't increment reference count on object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, NULL, "can't increment reference count on object header"); chk_proxy->oh = udata->oh; /* Set return value */ @@ -795,7 +720,7 @@ H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata, hbool_t done: if (NULL == ret_value) if (chk_proxy && H5O__chunk_dest(chk_proxy) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header chunk"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__cache_chk_deserialize() */ @@ -803,15 +728,10 @@ H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata, hbool_t /*------------------------------------------------------------------------- * Function: H5O__cache_chk_image_len * - * Purpose: Return the on disk image size of a object header chunk to the - * metadata cache via the image_len. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/28/14 + * Purpose: Return the on disk image size of a object header chunk to the + * metadata cache via the image_len. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t @@ -821,12 +741,10 @@ H5O__cache_chk_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR - /* Check arguments */ - HDassert(chk_proxy); - HDassert(chk_proxy->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(chk_proxy->cache_info.type == H5AC_OHDR_CHK); - HDassert(chk_proxy->oh); - HDassert(image_len); + assert(chk_proxy); + assert(chk_proxy->cache_info.type == H5AC_OHDR_CHK); + assert(chk_proxy->oh); + assert(image_len); *image_len = chk_proxy->oh->chunk[chk_proxy->chunkno].size; @@ -836,39 +754,33 @@ H5O__cache_chk_image_len(const void *_thing, size_t *image_len) /*------------------------------------------------------------------------- * Function: H5O__cache_chk_serialize * - * Purpose: Given a pointer to an instance of an object header chunk and an - * appropriately sized buffer, serialize the contents of the - * instance for writing to disk, and copy the serialized data - * into the buffer. - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/28/14 + * Purpose: Given a pointer to an instance of an object header chunk and an + * appropriately sized buffer, serialize the contents of the + * instance for writing to disk, and copy the serialized data + * into the buffer. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5O__cache_chk_serialize(const H5F_t *f, void *image, size_t len, void *_thing) { H5O_chunk_proxy_t *chk_proxy = (H5O_chunk_proxy_t *)_thing; /* Object header chunk to serialize */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(chk_proxy); - HDassert(chk_proxy->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(chk_proxy->cache_info.type == H5AC_OHDR_CHK); - HDassert(chk_proxy->oh); - HDassert(chk_proxy->oh->chunk[chk_proxy->chunkno].size == len); + assert(f); + assert(image); + assert(chk_proxy); + assert(chk_proxy->cache_info.type == H5AC_OHDR_CHK); + assert(chk_proxy->oh); + assert(chk_proxy->oh->chunk[chk_proxy->chunkno].size == len); /* Serialize messages for this chunk */ if (H5O__chunk_serialize(f, chk_proxy->oh, chk_proxy->chunkno) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "unable to serialize object header continuation chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, + "unable to serialize object header continuation chunk"); /* copy the chunk into the image -- this is potentially expensive. * Can we rework things so that the chunk and the cache share a buffer? @@ -884,26 +796,19 @@ H5O__cache_chk_serialize(const H5F_t *f, void *image, size_t len, void *_thing) * * Purpose: Handle cache action notifications * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Neil Fortner - * Mar 20 2012 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing) { H5O_chunk_proxy_t *chk_proxy = (H5O_chunk_proxy_t *)_thing; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* - * Check arguments. - */ - HDassert(chk_proxy); - HDassert(chk_proxy->oh); + assert(chk_proxy); + assert(chk_proxy->oh); switch (action) { case H5AC_NOTIFY_ACTION_AFTER_INSERT: @@ -912,41 +817,39 @@ H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing) /* Add flush dependency on chunk with continuation, if one exists */ if (chk_proxy->fd_parent) { /* Sanity checks */ - HDassert(((H5C_cache_entry_t *)(chk_proxy->fd_parent))->magic == - H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type); - HDassert((((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type->id == H5AC_OHDR_ID) || - (((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type->id == H5AC_OHDR_CHK_ID)); + assert(((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type); + assert((((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type->id == H5AC_OHDR_ID) || + (((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type->id == H5AC_OHDR_CHK_ID)); /* Add flush dependency from chunk containing the continuation message * that points to this chunk (either oh or another chunk proxy object) */ if (H5AC_create_flush_dependency(chk_proxy->fd_parent, chk_proxy) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); + } /* Add flush dependency on object header */ { if (H5AC_create_flush_dependency(chk_proxy->oh, chk_proxy) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, "unable to create flush dependency") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEPEND, FAIL, "unable to create flush dependency"); + } /* Add flush dependency on object header proxy, if proxy exists */ { /* Sanity check */ - HDassert(chk_proxy->oh->proxy); + assert(chk_proxy->oh->proxy); /* Register the object header chunk as a parent of the virtual entry */ if (H5AC_proxy_entry_add_parent(chk_proxy->oh->proxy, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, - "can't add object header chunk as parent of proxy") + "can't add object header chunk as parent of proxy"); } - } /* end if */ + } break; case H5AC_NOTIFY_ACTION_AFTER_FLUSH: case H5AC_NOTIFY_ACTION_ENTRY_DIRTIED: - /* do nothing */ + /* Do nothing */ break; case H5AC_NOTIFY_ACTION_ENTRY_CLEANED: { @@ -962,7 +865,7 @@ H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing) case H5AC_NOTIFY_ACTION_CHILD_CLEANED: case H5AC_NOTIFY_ACTION_CHILD_UNSERIALIZED: case H5AC_NOTIFY_ACTION_CHILD_SERIALIZED: - /* do nothing */ + /* Do nothing */ break; case H5AC_NOTIFY_ACTION_BEFORE_EVICT: @@ -970,35 +873,29 @@ H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing) /* Remove flush dependency on parent object header chunk, if one is set */ if (chk_proxy->fd_parent) { /* Sanity checks */ - HDassert(((H5C_cache_entry_t *)(chk_proxy->fd_parent))->magic == - H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type); - HDassert((((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type->id == H5AC_OHDR_ID) || - (((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type->id == H5AC_OHDR_CHK_ID)); + assert(((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type); + assert((((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type->id == H5AC_OHDR_ID) || + (((H5C_cache_entry_t *)(chk_proxy->fd_parent))->type->id == H5AC_OHDR_CHK_ID)); if (H5AC_destroy_flush_dependency(chk_proxy->fd_parent, chk_proxy) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); chk_proxy->fd_parent = NULL; - } /* end if */ + } /* Unregister the object header as a parent of the virtual entry */ if (H5AC_destroy_flush_dependency(chk_proxy->oh, chk_proxy) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNDEPEND, FAIL, "unable to destroy flush dependency"); /* Unregister the object header chunk as a parent of the virtual entry */ if (H5AC_proxy_entry_remove_parent(chk_proxy->oh->proxy, chk_proxy) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, - "can't remove object header chunk as parent of proxy") - } /* end if */ + "can't remove object header chunk as parent of proxy"); + } break; default: -#ifdef NDEBUG - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unknown action from metadata cache") -#else /* NDEBUG */ - HDassert(0 && "Unknown action?!?"); -#endif /* NDEBUG */ - } /* end switch */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unknown action from metadata cache"); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1007,37 +904,26 @@ H5O__cache_chk_notify(H5AC_notify_action_t action, void *_thing) /*------------------------------------------------------------------------- * Function: H5O__cache_chk_free_icr * - * Purpose: Free the in core memory associated with the supplied object - * header continuation chunk. - * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: John Mainzer - * 7/28/14 + * Purpose: Free the in core memory associated with the supplied object + * header continuation chunk. * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5O__cache_chk_free_icr(void *_thing) { H5O_chunk_proxy_t *chk_proxy = (H5O_chunk_proxy_t *)_thing; /* Object header chunk proxy to release */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(chk_proxy); - HDassert(chk_proxy->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(chk_proxy->cache_info.type == H5AC_OHDR_CHK); + assert(chk_proxy); + assert(chk_proxy->cache_info.type == H5AC_OHDR_CHK); /* Destroy object header chunk proxy */ if (H5O__chunk_dest(chk_proxy) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to destroy object header chunk proxy") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to destroy object header chunk proxy"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1046,28 +932,22 @@ H5O__cache_chk_free_icr(void *_thing) /*------------------------------------------------------------------------- * Function: H5O__add_cont_msg * - * Purpose: Add information from a continuation message to the list of + * Purpose: Add information from a continuation message to the list of * continuation messages in the object header * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * July 12, 2008 - * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5O__add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) { - size_t contno; /* Continuation message index */ - herr_t ret_value = SUCCEED; /* Return value */ + size_t contno; /* Continuation message index */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(cont_msg_info); - HDassert(cont); + assert(cont_msg_info); + assert(cont); /* Increase chunk array size, if necessary */ if (cont_msg_info->nmsgs >= cont_msg_info->alloc_nmsgs) { @@ -1075,10 +955,10 @@ H5O__add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) H5O_cont_t *x; if (NULL == (x = H5FL_SEQ_REALLOC(H5O_cont_t, cont_msg_info->msgs, na))) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "memory allocation failed"); cont_msg_info->alloc_nmsgs = na; cont_msg_info->msgs = x; - } /* end if */ + } /* Init the continuation message info */ contno = cont_msg_info->nmsgs++; @@ -1093,32 +973,27 @@ H5O__add_cont_msg(H5O_cont_msgs_t *cont_msg_info, const H5O_cont_t *cont) /*------------------------------------------------------------------------- * Function: H5O__prefix_deserialize() * - * Purpose: Deserialize an object header prefix - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * December 14, 2016 + * Purpose: Deserialize an object header prefix * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t -H5O__prefix_deserialize(const uint8_t *_image, H5O_cache_ud_t *udata) +H5O__prefix_deserialize(const uint8_t *_image, size_t len, H5O_cache_ud_t *udata) { const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *p_end = image + len - 1; /* End of image buffer */ H5O_t *oh = NULL; /* Object header read in */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); /* Allocate space for the new object header data structure */ if (NULL == (oh = H5FL_CALLOC(H5O_t))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* File-specific, non-stored information */ oh->sizeof_size = H5F_SIZEOF_SIZE(udata->common.f); @@ -1126,26 +1001,36 @@ H5O__prefix_deserialize(const uint8_t *_image, H5O_cache_ud_t *udata) /* Check for presence of magic number */ /* (indicates version 2 or later) */ - if (!HDmemcmp(image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { - /* Magic number */ + if (H5_IS_BUFFER_OVERFLOW(image, H5_SIZEOF_MAGIC, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + if (!memcmp(image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { + + /* Magic number (bounds checked above) */ image += H5_SIZEOF_MAGIC; /* Version */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); oh->version = *image++; if (H5O_VERSION_2 != oh->version) - HGOTO_ERROR(H5E_OHDR, H5E_VERSION, FAIL, "bad object header version number") + HGOTO_ERROR(H5E_OHDR, H5E_VERSION, FAIL, "bad object header version number"); /* Flags */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); oh->flags = *image++; if (oh->flags & ~H5O_HDR_ALL_FLAGS) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unknown object header status flag(s)") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unknown object header status flag(s)"); /* Number of links to object (unless overridden by refcount message) */ oh->nlink = 1; /* Time fields */ if (oh->flags & H5O_HDR_STORE_TIMES) { - uint32_t tmp; /* Temporary value */ + uint32_t tmp; + + if (H5_IS_BUFFER_OVERFLOW(image, 4 + 4 + 4 + 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT32DECODE(image, tmp); oh->atime = (time_t)tmp; @@ -1155,62 +1040,81 @@ H5O__prefix_deserialize(const uint8_t *_image, H5O_cache_ud_t *udata) oh->ctime = (time_t)tmp; UINT32DECODE(image, tmp); oh->btime = (time_t)tmp; - } /* end if */ + } else oh->atime = oh->mtime = oh->ctime = oh->btime = 0; /* Attribute fields */ if (oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) { + if (H5_IS_BUFFER_OVERFLOW(image, 2 + 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + UINT16DECODE(image, oh->max_compact); UINT16DECODE(image, oh->min_dense); if (oh->max_compact < oh->min_dense) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad object header attribute phase change values") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad object header attribute phase change values"); + } else { oh->max_compact = H5O_CRT_ATTR_MAX_COMPACT_DEF; oh->min_dense = H5O_CRT_ATTR_MIN_DENSE_DEF; - } /* end else */ + } /* First chunk size */ switch (oh->flags & H5O_HDR_CHUNK0_SIZE) { case 0: /* 1 byte size */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); udata->chunk0_size = *image++; break; case 1: /* 2 byte size */ + if (H5_IS_BUFFER_OVERFLOW(image, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT16DECODE(image, udata->chunk0_size); break; case 2: /* 4 byte size */ + if (H5_IS_BUFFER_OVERFLOW(image, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT32DECODE(image, udata->chunk0_size); break; case 3: /* 8 byte size */ + if (H5_IS_BUFFER_OVERFLOW(image, 8, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT64DECODE(image, udata->chunk0_size); break; default: - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad size for chunk 0") - } /* end switch */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad size for chunk 0"); + } if (udata->chunk0_size > 0 && udata->chunk0_size < H5O_SIZEOF_MSGHDR_OH(oh)) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad object header chunk size") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad object header chunk size"); + } else { /* Version */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); oh->version = *image++; if (H5O_VERSION_1 != oh->version) - HGOTO_ERROR(H5E_OHDR, H5E_VERSION, FAIL, "bad object header version number") + HGOTO_ERROR(H5E_OHDR, H5E_VERSION, FAIL, "bad object header version number"); /* Flags */ oh->flags = H5O_CRT_OHDR_FLAGS_DEF; /* Reserved */ + if (H5_IS_BUFFER_OVERFLOW(image, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); image++; /* Number of messages */ + if (H5_IS_BUFFER_OVERFLOW(image, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT16DECODE(image, udata->v1_pfx_nmesgs); /* Link count */ + if (H5_IS_BUFFER_OVERFLOW(image, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT32DECODE(image, oh->nlink); /* Reset unused time fields */ @@ -1221,29 +1125,35 @@ H5O__prefix_deserialize(const uint8_t *_image, H5O_cache_ud_t *udata) oh->min_dense = 0; /* First chunk size */ + if (H5_IS_BUFFER_OVERFLOW(image, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT32DECODE(image, udata->chunk0_size); if ((udata->v1_pfx_nmesgs > 0 && udata->chunk0_size < H5O_SIZEOF_MSGHDR_OH(oh)) || (udata->v1_pfx_nmesgs == 0 && udata->chunk0_size > 0)) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad object header chunk size") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad object header chunk size"); /* Reserved, in version 1 (for 8-byte alignment padding) */ + if (H5_IS_BUFFER_OVERFLOW(image, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); image += 4; - } /* end else */ + } /* Verify object header prefix length */ - HDassert((size_t)(image - _image) == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); + if ((size_t)(image - _image) != (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "bad object header prefix length"); /* If udata->oh is to be freed (see H5O__cache_verify_chksum), - save the pointer to udata->oh and free it later after setting - udata->oh with the new object header */ + * save the pointer to udata->oh and free it later after setting + * udata->oh with the new object header + */ if (udata->free_oh) { H5O_t *saved_oh = udata->oh; - HDassert(udata->oh); + assert(udata->oh); /* Save the object header for later use in 'deserialize' callback */ udata->oh = oh; if (H5O__free(saved_oh, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't destroy object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't destroy object header"); udata->free_oh = FALSE; } else @@ -1256,7 +1166,7 @@ H5O__prefix_deserialize(const uint8_t *_image, H5O_cache_ud_t *udata) /* Release the [possibly partially initialized] object header on errors */ if (ret_value < 0 && oh) if (H5O__free(oh, FALSE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to destroy object header data") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to destroy object header data"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__prefix_deserialize() */ @@ -1264,40 +1174,33 @@ H5O__prefix_deserialize(const uint8_t *_image, H5O_cache_ud_t *udata) /*------------------------------------------------------------------------- * Function: H5O__chunk_deserialize * - * Purpose: Deserialize a chunk for an object header - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * July 12, 2008 + * Purpose: Deserialize a chunk for an object header * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t *image, size_t len, H5O_common_cache_ud_t *udata, hbool_t *dirty) { - const uint8_t *chunk_image; /* Pointer into buffer to decode */ + const uint8_t *chunk_image = NULL; /* Pointer into buffer to decode */ + const uint8_t *p_end = NULL; /* End of image buffer */ uint8_t *eom_ptr; /* Pointer to end of messages for a chunk */ unsigned merged_null_msgs = 0; /* Number of null messages merged together */ unsigned chunkno; /* Current chunk's index */ -#ifndef NDEBUG - unsigned nullcnt; /* Count of null messages (for sanity checking gaps in chunks) */ -#endif /* NDEBUG */ - hbool_t mesgs_modified = + unsigned nullcnt; /* Count of null messages (for sanity checking gaps in chunks) */ + hbool_t mesgs_modified = FALSE; /* Whether any messages were modified when the object header was deserialized */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(oh); - HDassert(H5F_addr_defined(addr)); - HDassert(image); - HDassert(len); - HDassert(udata->f); - HDassert(udata->cont_msg_info); + assert(oh); + assert(H5_addr_defined(addr)); + assert(image); + assert(len); + assert(udata->f); + assert(udata->cont_msg_info); /* Increase chunk array size, if necessary */ if (oh->nchunks >= oh->alloc_nchunks) { @@ -1305,10 +1208,10 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t H5O_chunk_t *x; if (NULL == (x = H5FL_SEQ_REALLOC(H5O_chunk_t, oh->chunk, na))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed"); oh->alloc_nchunks = na; oh->chunk = x; - } /* end if */ + } /* Init the chunk data info */ chunkno = (unsigned)oh->nchunks++; @@ -1320,34 +1223,41 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t else oh->chunk[chunkno].size = chunk_size; if (NULL == (oh->chunk[chunkno].image = H5FL_BLK_MALLOC(chunk_image, oh->chunk[chunkno].size))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed"); oh->chunk[chunkno].chunk_proxy = NULL; /* Copy disk image into chunk's image */ if (len < oh->chunk[chunkno].size) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "attempted to copy too many disk image bytes into buffer") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "attempted to copy too many disk image bytes into buffer"); H5MM_memcpy(oh->chunk[chunkno].image, image, oh->chunk[chunkno].size); /* Point into chunk image to decode */ chunk_image = oh->chunk[chunkno].image; + p_end = chunk_image + oh->chunk[chunkno].size - 1; + + /* Skip over [already decoded] prefix in special case of chunk 0 */ + if (chunkno == 0) { + size_t skip = (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)); + + if (H5_IS_BUFFER_OVERFLOW(chunk_image, skip, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + chunk_image += skip; + } - /* Handle chunk 0 as special case */ - if (chunkno == 0) - /* Skip over [already decoded] prefix */ - chunk_image += (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh)); /* Check for magic # on chunks > 0 in later versions of the format */ else if (chunkno > 0 && oh->version > H5O_VERSION_1) { /* Magic number */ - if (HDmemcmp(chunk_image, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "wrong object header chunk signature") + if (H5_IS_BUFFER_OVERFLOW(chunk_image, H5_SIZEOF_MAGIC, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + if (memcmp(chunk_image, H5O_CHK_MAGIC, H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "wrong object header chunk signature"); chunk_image += H5_SIZEOF_MAGIC; - } /* end if */ + } /* Decode messages from this chunk */ eom_ptr = oh->chunk[chunkno].image + (oh->chunk[chunkno].size - H5O_SIZEOF_CHKSUM_OH(oh)); -#ifndef NDEBUG nullcnt = 0; -#endif /* NDEBUG */ + while (chunk_image < eom_ptr) { size_t mesg_size; /* Size of message read in */ unsigned id; /* ID (type) of current message */ @@ -1357,50 +1267,65 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t /* Decode message prefix info */ /* Version # */ - if (oh->version == H5O_VERSION_1) - UINT16DECODE(chunk_image, id) - else + if (oh->version == H5O_VERSION_1) { + if (H5_IS_BUFFER_OVERFLOW(chunk_image, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + UINT16DECODE(chunk_image, id); + } + else { + if (H5_IS_BUFFER_OVERFLOW(chunk_image, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); id = *chunk_image++; + } /* Message size */ + if (H5_IS_BUFFER_OVERFLOW(chunk_image, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT16DECODE(chunk_image, mesg_size); if (mesg_size != H5O_ALIGN_OH(oh, mesg_size)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message not aligned") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message not aligned"); /* Message flags */ + if (H5_IS_BUFFER_OVERFLOW(chunk_image, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); flags = *chunk_image++; if (flags & ~H5O_MSG_FLAG_BITS) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unknown flag for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unknown flag for message"); if ((flags & H5O_MSG_FLAG_SHARED) && (flags & H5O_MSG_FLAG_DONTSHARE)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message"); if ((flags & H5O_MSG_FLAG_WAS_UNKNOWN) && (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message"); if ((flags & H5O_MSG_FLAG_WAS_UNKNOWN) && !(flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message"); /* Delay checking the "shareable" flag until we've made sure id * references a valid message class that this version of the library * knows about */ /* Reserved bytes/creation index */ - if (oh->version == H5O_VERSION_1) - chunk_image += 3; /*reserved*/ + if (oh->version == H5O_VERSION_1) { + /* Reserved bytes */ + if (H5_IS_BUFFER_OVERFLOW(chunk_image, 3, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + chunk_image += 3; + } else { /* Only decode creation index if they are being tracked */ - if (oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) + if (oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) { + if (H5_IS_BUFFER_OVERFLOW(chunk_image, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT16DECODE(chunk_image, crt_idx); - } /* end else */ + } + } /* Try to detect invalidly formatted object header message that * extends past end of chunk. */ if (chunk_image + mesg_size > eom_ptr) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "corrupt object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "corrupt object header"); -#ifndef NDEBUG /* Increment count of null messages */ if (H5O_NULL_ID == id) nullcnt++; -#endif /* NDEBUG */ /* Check for combining two adjacent 'null' messages */ if ((udata->file_intent & H5F_ACC_RDWR) && H5O_NULL_ID == id && oh->nmesgs > 0 && @@ -1413,7 +1338,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t oh->mesg[mesgno].raw_size += (size_t)H5O_SIZEOF_MSGHDR_OH(oh) + mesg_size; oh->mesg[mesgno].dirty = TRUE; merged_null_msgs++; - } /* end if */ + } else { H5O_mesg_t *mesg; /* Pointer to new message */ unsigned ioflags = 0; /* Flags for decode routine */ @@ -1421,7 +1346,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t /* Check if we need to extend message table to hold the new message */ if (oh->nmesgs >= oh->alloc_nmesgs) if (H5O__alloc_msgs(oh, (size_t)1) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate more space for messages"); /* Get pointer to message to set up */ mesg = &oh->mesg[oh->nmesgs]; @@ -1452,7 +1377,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t /* Allocate "unknown" message info */ if (NULL == (unknown = H5FL_MALLOC(H5O_unknown_t))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Save the original message type ID */ *unknown = id; @@ -1468,7 +1393,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE)) || (flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS)) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, - "unknown message with 'fail if unknown' flag found") + "unknown message with 'fail if unknown' flag found"); /* Check for "mark if unknown" message flag, etc. */ else if ((flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) && !(flags & H5O_MSG_FLAG_WAS_UNKNOWN) && (udata->file_intent & H5F_ACC_RDWR)) { @@ -1477,31 +1402,31 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t /* This is a bit aggressive, since the application may * never change anything about the object (metadata or * raw data), but we can sort out the finer details - * when/if we start using the flag - QAK + * when/if we start using the flag. */ /* Also, it's possible that this functionality may not * get invoked if the object header is brought into * the metadata cache in some other "weird" way, like - * using H5Ocopy() - QAK + * using H5Ocopy(). */ mesg->flags |= H5O_MSG_FLAG_WAS_UNKNOWN; /* Mark the message and chunk as dirty */ mesg->dirty = TRUE; mesgs_modified = TRUE; - } /* end if */ - } /* end if */ + } + } else { /* Check for message of unshareable class marked as "shareable" */ if ((flags & H5O_MSG_FLAG_SHAREABLE) && H5O_msg_class_g[id] && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE)) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, - "message of unshareable class flagged as shareable") + "message of unshareable class flagged as shareable"); /* Set message class for "known" messages */ mesg->type = H5O_msg_class_g[id]; - } /* end else */ + } /* Do some inspection/interpretation of new messages from this chunk */ /* (detect continuation messages, ref. count messages, etc.) */ @@ -1511,8 +1436,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t H5O_cont_t *cont; /* Decode continuation message */ - cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(udata->f, NULL, 0, &ioflags, mesg->raw_size, - mesg->raw); + if (NULL == (cont = (H5O_cont_t *)(H5O_MSG_CONT->decode)(udata->f, NULL, 0, &ioflags, + mesg->raw_size, mesg->raw))) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "bad continuation message found"); H5_CHECKED_ASSIGN(cont->chunkno, unsigned, udata->cont_msg_info->nmsgs + 1, size_t); /* the next continuation message/chunk */ @@ -1521,8 +1447,8 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t /* Add to continuation messages left to interpret */ if (H5O__add_cont_msg(udata->cont_msg_info, cont) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't add continuation message") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't add continuation message"); + } /* Check if message is a ref. count message */ else if (H5O_REFCOUNT_ID == id) { H5O_refcount_t *refcount; @@ -1530,7 +1456,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t /* Decode ref. count message */ if (oh->version <= H5O_VERSION_1) HGOTO_ERROR(H5E_OHDR, H5E_VERSION, FAIL, - "object header version does not support reference count message") + "object header version does not support reference count message"); refcount = (H5O_refcount_t *)(H5O_MSG_REFCOUNT->decode)(udata->f, NULL, 0, &ioflags, mesg->raw_size, mesg->raw); @@ -1540,26 +1466,26 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t /* Set object header values */ oh->has_refcount_msg = TRUE; if (!refcount) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't decode refcount") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't decode refcount"); oh->nlink = *refcount; - } /* end if */ + } /* Check if message is a link message */ else if (H5O_LINK_ID == id) { /* Increment the count of link messages */ oh->link_msgs_seen++; - } /* end if */ + } /* Check if message is an attribute message */ else if (H5O_ATTR_ID == id) { /* Increment the count of attribute messages */ oh->attr_msgs_seen++; - } /* end if */ + } /* Mark the message & chunk as dirty if the message was changed by decoding */ if ((ioflags & H5O_DECODEIO_DIRTY) && (udata->file_intent & H5F_ACC_RDWR)) { mesg->dirty = TRUE; mesgs_modified = TRUE; - } /* end if */ - } /* end else */ + } + } /* Advance decode pointer past message */ chunk_image += mesg_size; @@ -1567,18 +1493,20 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t /* Check for 'gap' at end of chunk */ if ((eom_ptr - chunk_image) > 0 && (eom_ptr - chunk_image) < H5O_SIZEOF_MSGHDR_OH(oh)) { /* Gaps can only occur in later versions of the format */ - HDassert(oh->version > H5O_VERSION_1); + if (oh->version == H5O_VERSION_1) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "gap found in early version of file format"); /* Gaps should only occur in chunks with no null messages */ - HDassert(nullcnt == 0); + if (nullcnt != 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "gap in chunk with no null messages"); /* Set gap information for chunk */ oh->chunk[chunkno].gap = (size_t)(eom_ptr - chunk_image); /* Increment location in chunk */ chunk_image += oh->chunk[chunkno].gap; - } /* end if */ - } /* end while */ + } + } /* Check for correct checksum on chunks, in later versions of the format */ if (oh->version > H5O_VERSION_1) { @@ -1587,11 +1515,14 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t /* checksum verification already done in verify_chksum cb */ /* Metadata checksum */ + if (H5_IS_BUFFER_OVERFLOW(chunk_image, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT32DECODE(chunk_image, stored_chksum); - } /* end if */ + } - /* Sanity check */ - HDassert(chunk_image == oh->chunk[chunkno].image + oh->chunk[chunkno].size); + /* Size check */ + if (chunk_image != oh->chunk[chunkno].image + oh->chunk[chunkno].size) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "object header image size mismatch"); /* Mark the chunk dirty if we've modified messages */ if (mesgs_modified) @@ -1601,7 +1532,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t if (merged_null_msgs > 0) { udata->merged_null_msgs += merged_null_msgs; *dirty = TRUE; - } /* end if */ + } done: if (ret_value < 0 && udata->cont_msg_info->msgs) { @@ -1612,48 +1543,42 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t } /* H5O__chunk_deserialize() */ /*------------------------------------------------------------------------- - * Function: H5O__chunk_serialize + * Function: H5O__chunk_serialize * - * Purpose: Serialize a chunk for an object header - * - * Return: Success: SUCCEED - * Failure: FAIL - * - * Programmer: Quincey Koziol - * July 12, 2008 + * Purpose: Serialize a chunk for an object header * + * Return: SUCCEED/FAIL *------------------------------------------------------------------------- */ static herr_t H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno) { - H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ - unsigned u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_mesg_t *curr_msg; /* Pointer to current message being operated on */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - /* Check arguments */ - HDassert(f); - HDassert(oh); + assert(f); + assert(oh); /* Encode any dirty messages in this chunk */ for (u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) if (curr_msg->dirty && curr_msg->chunkno == chunkno) { H5_GCC_CLANG_DIAG_OFF("cast-qual") if (H5O_msg_flush((H5F_t *)f, oh, curr_msg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message"); H5_GCC_CLANG_DIAG_ON("cast-qual") } /* Sanity checks */ if (oh->version > H5O_VERSION_1) /* Make certain the magic # is present */ - HDassert(!HDmemcmp(oh->chunk[chunkno].image, (chunkno == 0 ? H5O_HDR_MAGIC : H5O_CHK_MAGIC), - H5_SIZEOF_MAGIC)); + assert(!memcmp(oh->chunk[chunkno].image, (chunkno == 0 ? H5O_HDR_MAGIC : H5O_CHK_MAGIC), + H5_SIZEOF_MAGIC)); else /* Gaps should never occur in version 1 of the format */ - HDassert(oh->chunk[chunkno].gap == 0); + assert(oh->chunk[chunkno].gap == 0); /* Extra work, for later versions of the format */ if (oh->version > H5O_VERSION_1) { @@ -1662,9 +1587,9 @@ H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno) /* Check for gap in chunk & zero it out */ if (oh->chunk[chunkno].gap) - HDmemset((oh->chunk[chunkno].image + oh->chunk[chunkno].size) - - (H5O_SIZEOF_CHKSUM + oh->chunk[chunkno].gap), - 0, oh->chunk[chunkno].gap); + memset((oh->chunk[chunkno].image + oh->chunk[chunkno].size) - + (H5O_SIZEOF_CHKSUM + oh->chunk[chunkno].gap), + 0, oh->chunk[chunkno].gap); /* Compute metadata checksum */ metadata_chksum = @@ -1673,7 +1598,7 @@ H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno) /* Metadata checksum */ chunk_image = oh->chunk[chunkno].image + (oh->chunk[chunkno].size - H5O_SIZEOF_CHKSUM); UINT32ENCODE(chunk_image, metadata_chksum); - } /* end if */ + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ocache_image.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ocache_image.c index 84ee3c3222..c3793844ed 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ocache_image.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ocache_image.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,14 +13,12 @@ /*------------------------------------------------------------------------- * * Created: H5Ocache_image.c - * June 21, 2015 - * John Mainzer * * Purpose: A message indicating that a metadata cache image block - * of the indicated length exists at the specified offset - * in the HDF5 file. + * of the indicated length exists at the specified offset + * in the HDF5 file. * - * The mdci_msg only appears in the superblock extension. + * The mdci_msg only appears in the superblock extension * *------------------------------------------------------------------------- */ @@ -74,52 +71,57 @@ const H5O_msg_class_t H5O_MSG_MDCI[1] = {{ #define H5O_MDCI_VERSION_0 0 /* Declare the free list for H5O_mdci_t's */ -H5FL_DEFINE(H5O_mdci_t); +H5FL_DEFINE_STATIC(H5O_mdci_t); /*------------------------------------------------------------------------- * Function: H5O__mdci_decode * * Purpose: Decode a metadata cache image message and return a - * pointer to a newly allocated H5O_mdci_t struct. - * - * Return: Success: Ptr to new message in native struct. - * Failure: NULL - * - * Programmer: John Mainzer - * 6/22/15 + * pointer to a newly allocated H5O_mdci_t struct. * + * Return: Success: Pointer to new message in native struct + * Failure: NULL *------------------------------------------------------------------------- */ static void * H5O__mdci_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_mdci_t *mesg; /* Native message */ - void *ret_value = NULL; /* Return value */ + H5O_mdci_t *mesg = NULL; /* New cache image message */ + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); /* Version of message */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (*p++ != H5O_MDCI_VERSION_0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message"); /* Allocate space for message */ if (NULL == (mesg = (H5O_mdci_t *)H5FL_MALLOC(H5O_mdci_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for metadata cache image message") + "memory allocation failed for metadata cache image message"); - /* Decode */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(mesg->addr)); + + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_DECODE_LENGTH(f, p, mesg->size); /* Set return value */ ret_value = (void *)mesg; done: + if (!ret_value && mesg) + H5FL_FREE(H5O_mdci_t, mesg); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__mdci_decode() */ @@ -130,9 +132,6 @@ H5O__mdci_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 6/22/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -143,9 +142,9 @@ H5O__mdci_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); - HDassert(p); - HDassert(mesg); + assert(f); + assert(p); + assert(mesg); /* encode */ *p++ = H5O_MDCI_VERSION_0; @@ -164,9 +163,6 @@ H5O__mdci_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: John Mainzer - * 6/22/15 - * *------------------------------------------------------------------------- */ static void * @@ -179,9 +175,9 @@ H5O__mdci_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(mesg); + assert(mesg); if (!dest && NULL == (dest = H5FL_MALLOC(H5O_mdci_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ *dest = *mesg; @@ -204,9 +200,6 @@ H5O__mdci_copy(const void *_mesg, void *_dest) * * Failure: zero * - * Programmer: John Mainzer - * 6/22/15 - * *------------------------------------------------------------------------- */ static size_t @@ -233,9 +226,6 @@ H5O__mdci_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 6/22/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -243,7 +233,7 @@ H5O__mdci_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5O_mdci_t, mesg); @@ -257,9 +247,6 @@ H5O__mdci_free(void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, March 19, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -272,11 +259,11 @@ H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(mesg); + assert(f); + assert(mesg); /* Free file space for cache image */ - if (H5F_addr_defined(mesg->addr)) { + if (H5_addr_defined(mesg->addr)) { /* The space for the cache image block was allocated directly * from the VFD layer at the end of file. As this was the * last file space allocation before shutdown, the cache image @@ -285,15 +272,15 @@ H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) if (f->shared->closing) { /* Get the eoa, and verify that it has the expected value */ if (HADDR_UNDEF == (final_eoa = H5FD_get_eoa(f->shared->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get file size") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get file size"); - HDassert(H5F_addr_eq(final_eoa, mesg->addr + mesg->size)); + assert(H5_addr_eq(final_eoa, mesg->addr + mesg->size)); if (H5FD_free(f->shared->lf, H5FD_MEM_SUPER, f, mesg->addr, mesg->size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't free MDC image") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't free MDC image"); } else if (H5MF_xfree(f, H5FD_MEM_SUPER, mesg->addr, mesg->size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free file space for cache image block"); } /* end if */ done: @@ -307,9 +294,6 @@ H5O__mdci_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: John Mainzer - * 6/22/15 - * *------------------------------------------------------------------------- */ static herr_t @@ -320,17 +304,17 @@ H5O__mdci_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mdci); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(mdci); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Metadata Cache Image Block address:", mdci->addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Metadata Cache Image Block address:", mdci->addr); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Metadata Cache Image Block size in bytes:", mdci->size); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Metadata Cache Image Block size in bytes:", mdci->size); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__mdci_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ochunk.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ochunk.c index eadbb19caa..f09e6eb0e6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ochunk.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ochunk.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Ochunk.c - * Jul 13 2008 - * Quincey Koziol * * Purpose: Object header chunk routines. * @@ -73,9 +70,6 @@ H5FL_DEFINE(H5O_chunk_proxy_t); * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jul 13 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -89,18 +83,18 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno) FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) /* check args */ - HDassert(f); - HDassert(oh); - HDassert(idx < oh->nchunks); - HDassert(idx > 0); + assert(f); + assert(oh); + assert(idx < oh->nchunks); + assert(idx > 0); /* Allocate space for the object header data structure */ if (NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Increment reference count on object header */ if (H5O__inc_rc(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "can't increment reference count on object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "can't increment reference count on object header"); /* Set the values in the chunk proxy */ chk_proxy->f = f; @@ -110,13 +104,13 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno) /* Determine the parent of the chunk */ if (cont_chunkno != 0) { if (NULL == (cont_chk_proxy = H5O__chunk_protect(f, oh, cont_chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk"); chk_proxy->fd_parent = cont_chk_proxy; } /* end else */ /* Insert the chunk proxy into the cache */ if (H5AC_insert_entry(f, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk"); chk_proxy = NULL; @@ -124,12 +118,12 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno) /* Cleanup on failure */ if (ret_value < 0) if (chk_proxy && H5O__chunk_dest(chk_proxy) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to destroy object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to destroy object header chunk"); /* Release resources */ if (cont_chk_proxy) if (H5O__chunk_unprotect(f, cont_chk_proxy, FALSE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__chunk_add() */ @@ -141,9 +135,6 @@ H5O__chunk_add(H5F_t *f, H5O_t *oh, unsigned idx, unsigned cont_chunkno) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jul 17 2008 - * *------------------------------------------------------------------------- */ H5O_chunk_proxy_t * @@ -155,20 +146,20 @@ H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx) FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) /* check args */ - HDassert(f); - HDassert(oh); - HDassert(idx < oh->nchunks); + assert(f); + assert(oh); + assert(idx < oh->nchunks); /* Check for protecting first chunk */ if (0 == idx) { /* Create new "fake" chunk proxy for first chunk */ /* (since the first chunk is already handled by the H5O_t object) */ if (NULL == (chk_proxy = H5FL_CALLOC(H5O_chunk_proxy_t))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Increment reference count on object header */ if (H5O__inc_rc(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, NULL, "can't increment reference count on object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, NULL, "can't increment reference count on object header"); /* Set chunk proxy fields */ chk_proxy->f = f; @@ -180,7 +171,7 @@ H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx) /* Construct the user data for protecting chunk proxy */ /* (and _not_ decoding it) */ - HDmemset(&chk_udata, 0, sizeof(chk_udata)); + memset(&chk_udata, 0, sizeof(chk_udata)); chk_udata.oh = oh; chk_udata.chunkno = idx; chk_udata.size = oh->chunk[idx].size; @@ -188,11 +179,11 @@ H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx) /* Get the chunk proxy */ if (NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, H5AC_OHDR_CHK, oh->chunk[idx].addr, &chk_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk"); /* Sanity check */ - HDassert(chk_proxy->oh == oh); - HDassert(chk_proxy->chunkno == idx); + assert(chk_proxy->oh == oh); + assert(chk_proxy->chunkno == idx); } /* end else */ /* Set return value */ @@ -202,7 +193,7 @@ H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx) /* Cleanup on error */ if (!ret_value) if (0 == idx && chk_proxy && H5O__chunk_dest(chk_proxy) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "unable to destroy object header chunk"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__chunk_protect() */ @@ -214,9 +205,6 @@ H5O__chunk_protect(H5F_t *f, H5O_t *oh, unsigned idx) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jul 17 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -227,8 +215,8 @@ H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t dirtied) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(chk_proxy); + assert(f); + assert(chk_proxy); /* Check for releasing first chunk */ if (0 == chk_proxy->chunkno) { @@ -236,12 +224,12 @@ H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t dirtied) if (dirtied) { /* Mark object header as dirty in cache */ if (H5AC_mark_entry_dirty(chk_proxy->oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty"); } /* end else/if */ /* Decrement reference count of object header */ if (H5O__dec_rc(chk_proxy->oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "can't decrement reference count on object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "can't decrement reference count on object header"); /* Free fake chunk proxy */ chk_proxy = H5FL_FREE(H5O_chunk_proxy_t, chk_proxy); @@ -250,7 +238,7 @@ H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t dirtied) /* Release the chunk proxy from the cache, possibly marking it dirty */ if (H5AC_unprotect(f, H5AC_OHDR_CHK, chk_proxy->oh->chunk[chk_proxy->chunkno].addr, chk_proxy, (dirtied ? H5AC__DIRTIED_FLAG : H5AC__NO_FLAGS_SET)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk"); } /* end else */ done: @@ -264,9 +252,6 @@ H5O__chunk_unprotect(H5F_t *f, H5O_chunk_proxy_t *chk_proxy, hbool_t dirtied) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * May 6 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -277,19 +262,19 @@ H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(chk_proxy); + assert(oh); + assert(chk_proxy); /* Check for resizing first chunk */ if (0 == chk_proxy->chunkno) { /* Resize object header in cache */ if (H5AC_resize_entry(oh, oh->chunk[0].size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize chunk in cache") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize chunk in cache"); } /* end if */ else { /* Resize chunk in cache */ if (H5AC_resize_entry(chk_proxy, oh->chunk[chk_proxy->chunkno].size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize chunk in cache") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRESIZE, FAIL, "unable to resize chunk in cache"); } /* end else */ done: @@ -303,9 +288,6 @@ H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_proxy) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jul 13 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -318,14 +300,14 @@ H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx) FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) /* check args */ - HDassert(f); - HDassert(oh); - HDassert(idx < oh->nchunks); - HDassert(idx > 0); + assert(f); + assert(oh); + assert(idx < oh->nchunks); + assert(idx > 0); /* Construct the user data for protecting chunk proxy */ /* (and _not_ decoding it) */ - HDmemset(&chk_udata, 0, sizeof(chk_udata)); + memset(&chk_udata, 0, sizeof(chk_udata)); chk_udata.oh = oh; chk_udata.chunkno = idx; chk_udata.size = oh->chunk[idx].size; @@ -333,14 +315,14 @@ H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx) /* Get the chunk proxy */ if (NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(f, H5AC_OHDR_CHK, oh->chunk[idx].addr, &chk_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk"); /* Update index for chunk proxy in cache */ chk_proxy->chunkno = idx; /* Release the chunk proxy from the cache, marking it deleted */ if (H5AC_unprotect(f, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__DIRTIED_FLAG) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk"); done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -353,9 +335,6 @@ H5O__chunk_update_idx(H5F_t *f, H5O_t *oh, unsigned idx) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jul 13 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -368,14 +347,14 @@ H5O__chunk_delete(H5F_t *f, H5O_t *oh, unsigned idx) FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr) /* check args */ - HDassert(f); - HDassert(oh); - HDassert(idx < oh->nchunks); - HDassert(idx > 0); + assert(f); + assert(oh); + assert(idx < oh->nchunks); + assert(idx > 0); /* Get the chunk proxy */ if (NULL == (chk_proxy = H5O__chunk_protect(f, oh, idx))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk"); /* Only free file space if not doing SWMR writes */ if (!oh->swmr_write) @@ -384,7 +363,7 @@ H5O__chunk_delete(H5F_t *f, H5O_t *oh, unsigned idx) done: /* Release the chunk proxy from the cache, marking it deleted */ if (chk_proxy && H5AC_unprotect(f, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, cache_flags) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__chunk_delete() */ @@ -396,9 +375,6 @@ H5O__chunk_delete(H5F_t *f, H5O_t *oh, unsigned idx) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * July 13, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -409,11 +385,11 @@ H5O__chunk_dest(H5O_chunk_proxy_t *chk_proxy) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(chk_proxy); + assert(chk_proxy); /* Decrement reference count of object header */ if (H5O__dec_rc(chk_proxy->oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "can't decrement reference count on object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "can't decrement reference count on object header"); done: /* Release the chunk proxy object */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ocont.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ocont.c index 16797c2a5c..3af61a28c4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ocont.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ocont.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Ocont.c - * Aug 6 1997 - * Robb Matzke * * Purpose: The object header continuation message. This * message is only generated and read from within @@ -75,40 +72,43 @@ H5FL_DEFINE(H5O_cont_t); * Purpose: Decode the raw header continuation message. * * Return: Success: Ptr to the new native message - * * Failure: NULL - * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ static void * H5O__cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_cont_t *cont = NULL; - void *ret_value = NULL; /* Return value */ + H5O_cont_t *cont = NULL; + const uint8_t *p_end = p + p_size - 1; + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); /* Allocate space for the message */ if (NULL == (cont = H5FL_MALLOC(H5O_cont_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed"); /* Decode */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(cont->addr)); + + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_DECODE_LENGTH(f, p, cont->size); + cont->chunkno = 0; /* Set return value */ ret_value = cont; done: + if (NULL == ret_value && NULL != cont) + H5FL_FREE(H5O_cont_t, cont); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__cont_decode() */ @@ -119,9 +119,6 @@ H5O__cont_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 7 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -132,11 +129,11 @@ H5O__cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(cont); - HDassert(H5F_addr_defined(cont->addr)); - HDassert(cont->size > 0); + assert(f); + assert(p); + assert(cont); + assert(H5_addr_defined(cont->addr)); + assert(cont->size > 0); /* encode */ H5F_addr_encode(f, &p, cont->addr); @@ -156,9 +153,6 @@ H5O__cont_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * * Failure: zero * - * Programmer: Quincey Koziol - * Sep 6 2005 - * *------------------------------------------------------------------------- */ static size_t @@ -182,9 +176,6 @@ H5O__cont_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, November 15, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -192,7 +183,7 @@ H5O__cont_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5O_cont_t, mesg); @@ -206,9 +197,6 @@ H5O__cont_free(void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, October 10, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -220,13 +208,13 @@ H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(mesg); + assert(f); + assert(mesg); /* Notify the cache that the chunk has been deleted */ /* (releases the space for the chunk) */ if (H5O__chunk_delete(f, open_oh, mesg->chunkno) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove chunk from cache") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove chunk from cache"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -239,9 +227,6 @@ H5O__cont_delete(H5F_t *f, H5O_t *open_oh, void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -252,17 +237,17 @@ H5O__cont_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(cont); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(cont); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Continuation address:", cont->addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Continuation address:", cont->addr); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Continuation size in bytes:", (unsigned long)(cont->size)); - HDfprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Points to chunk number:", (int)(cont->chunkno)); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Continuation size in bytes:", (unsigned long)(cont->size)); + fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, "Points to chunk number:", (int)(cont->chunkno)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__cont_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ocopy.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ocopy.c index 8b05d4a6af..ae60afb6c2 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ocopy.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ocopy.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -117,9 +116,6 @@ H5FL_DEFINE(haddr_t); * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 29, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -137,17 +133,17 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); - HDassert(src_name && *src_name); - HDassert(dst_loc); - HDassert(dst_name && *dst_name); + assert(loc); + assert(src_name && *src_name); + assert(dst_loc); + assert(dst_name && *dst_name); /* Check if destination name already exists */ dst_exists = FALSE; if (H5L_exists_tolerant(dst_loc, dst_name, &dst_exists) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists"); if (dst_exists) - HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists") + HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists"); /* Set up opened group location to fill in */ src_loc.oloc = &src_oloc; @@ -156,23 +152,23 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const /* Find the source object to copy */ if (H5G_loc_find(loc, src_name, &src_loc /*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found"); loc_found = TRUE; /* Open source object's object header */ if (H5O_open(&src_oloc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object"); obj_open = TRUE; /* Do the actual copying of the object */ if (H5O__copy_obj(&src_loc, dst_loc, dst_name, ocpypl_id, lcpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); done: if (loc_found && H5G_loc_free(&src_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location"); if (obj_open && H5O_close(&src_oloc, NULL) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__copy() */ @@ -192,9 +188,6 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc, const * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * May 30, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -224,26 +217,26 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 FUNC_ENTER_PACKAGE_TAG(oloc_src->addr) - HDassert(oloc_src); - HDassert(oloc_src->file); - HDassert(H5F_addr_defined(oloc_src->addr)); - HDassert(oloc_dst->file); - HDassert(cpy_info); + assert(oloc_src); + assert(oloc_src->file); + assert(H5_addr_defined(oloc_src->addr)); + assert(oloc_dst->file); + assert(cpy_info); /* Get pointer to object class for this object */ if (NULL == (obj_class = H5O__obj_class(oloc_src))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type"); /* Set the pointer to the shared struct for the object if opened in the file */ cpy_info->shared_fo = H5FO_opened(oloc_src->file, oloc_src->addr); /* Get source object header */ if (NULL == (oh_src = H5O_protect(oloc_src, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Retrieve user data for particular type of object to copy */ if (obj_class->get_copy_file_udata && (NULL == (cpy_udata = (obj_class->get_copy_file_udata)()))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to retrieve copy user data") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to retrieve copy user data"); /* If we are merging committed datatypes, check for a match in the destination * file now */ @@ -264,13 +257,13 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Search for a matching committed datatype, building the list if * necessary */ if ((merge = H5O__copy_search_comm_dt(oloc_src->file, oh_src, oloc_dst, cpy_info)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't search for matching committed datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't search for matching committed datatype"); if (merge) { /* Found a match, add to skip list and exit */ /* Allocate space for the address mapping of the object copied */ if (NULL == (addr_map = H5FL_MALLOC(H5O_addr_map_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Insert the address mapping for the found object into the copied * list */ @@ -285,27 +278,27 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Insert into skip list */ if (H5SL_insert(cpy_info->map_list, addr_map, &(addr_map->src_obj_pos)) < 0) { addr_map = H5FL_FREE(H5O_addr_map_t, addr_map); - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list"); } /* end if */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ } /* end if */ /* Flush any dirty messages in source object header to update the header chunks */ if (H5O__flush_msgs(oloc_src->file, oh_src) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object header messages") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object header messages"); /* Allocate the destination object header and fill in header fields */ if (NULL == (oh_dst = H5FL_CALLOC(H5O_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize header information */ oh_dst->version = oh_src->version; /* Version bounds check for destination object header */ if (oh_dst->version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(oloc_dst->file)]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "destination object header version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "destination object header version out of bounds"); oh_dst->flags = oh_src->flags; oh_dst->link_msgs_seen = oh_src->link_msgs_seen; @@ -328,7 +321,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 if (oh_dst->swmr_write) { /* Create virtual entry, for use as proxy */ if (NULL == (oh_dst->proxy = H5AC_proxy_entry_create())) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy"); } /* end if */ else oh_dst->proxy = NULL; @@ -341,7 +334,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Allocate memory for the chunk array - always start with 1 chunk */ if (NULL == (oh_dst->chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, (size_t)1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Update number of allocated chunks. There are still no chunks used. */ oh_dst->alloc_nchunks = 1; @@ -350,8 +343,8 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 * the source that shouldn't be copied to the destination. */ if (NULL == (deleted = (hbool_t *)H5MM_malloc(sizeof(hbool_t) * oh_src->nmesgs))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - HDmemset(deleted, FALSE, sizeof(hbool_t) * oh_src->nmesgs); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + memset(deleted, FALSE, sizeof(hbool_t) * oh_src->nmesgs); /* "pre copy" pass over messages, to gather information for actual message copy operation * (for messages which depend on information from other messages) @@ -363,7 +356,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 mesg_src = &(oh_src->mesg[mesgno]); /* Sanity check */ - HDassert(!mesg_src->dirty); /* Should be cleared by earlier call to flush messages */ + assert(!mesg_src->dirty); /* Should be cleared by earlier call to flush messages */ /* Get message class to operate on */ copy_type = mesg_src->type; @@ -376,7 +369,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 ++null_msgs; copy_type = H5O_MSG_NULL; } /* end if */ - HDassert(copy_type); + assert(copy_type); if (copy_type->pre_copy_file) { /* Decode the message if necessary. */ @@ -391,7 +384,8 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Perform "pre copy" operation on message */ if ((copy_type->pre_copy_file)(oloc_src->file, mesg_src->native, &(deleted[mesgno]), cpy_info, cpy_udata) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to perform 'pre copy' operation on message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, + "unable to perform 'pre copy' operation on message"); /* Check if the message should be deleted in the destination */ if (deleted[mesgno]) @@ -411,7 +405,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Allocate memory for destination message array */ if (oh_dst->alloc_nmesgs > 0) if (NULL == (oh_dst->mesg = H5FL_SEQ_CALLOC(H5O_mesg_t, oh_dst->alloc_nmesgs))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* "copy" pass over messages, to perform main message copying */ null_msgs = 0; @@ -422,7 +416,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 if (FALSE == cpy_info->preserve_null) { while (deleted[mesgno + null_msgs]) { ++null_msgs; - HDassert(mesgno + null_msgs < oh_src->nmesgs); + assert(mesgno + null_msgs < oh_src->nmesgs); } /* end while */ } /* end if */ @@ -450,7 +444,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 * converted to a nil message) in the destination -QAK) */ copy_type = mesg_dst->type; - HDassert(copy_type); + assert(copy_type); /* copy this message into destination file */ if (copy_type->copy_file) { @@ -470,7 +464,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 if (NULL == (mesg_dst->native = H5O__msg_copy_file(copy_type, oloc_src->file, mesg_src->native, oloc_dst->file, &recompute_size, &mesg_flags, cpy_info, cpy_udata))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object header message"); /* Check if the sharing state changed, and recompute the size if so */ @@ -530,19 +524,24 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 size_t delta = (size_t)(H5O_MIN_SIZE - dst_oh_size); /* Delta in chunk size needed */ /* Sanity check */ - HDassert((oh_dst->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_1); + assert((oh_dst->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_1); /* Determine whether to create gap or NULL message */ - if (delta < H5O_SIZEOF_MSGHDR_OH(oh_dst)) + if ((oh_dst->version > H5O_VERSION_1) && (delta < H5O_SIZEOF_MSGHDR_OH(oh_dst))) dst_oh_gap = delta; - else + else { + /* NULL message must be at least size of message header */ + if (delta < H5O_SIZEOF_MSGHDR_OH(oh_dst)) + delta = H5O_SIZEOF_MSGHDR_OH(oh_dst); + dst_oh_null = delta; + } /* Increase destination object header size */ dst_oh_size += delta; /* Sanity check */ - HDassert(dst_oh_size <= 255); + assert(dst_oh_size <= 255); } /* end if */ /* Add in destination's object header size now */ @@ -551,7 +550,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Allocate space for chunk in destination file */ if (HADDR_UNDEF == (oh_dst->chunk[0].addr = H5MF_alloc(oloc_dst->file, H5FD_MEM_OHDR, (hsize_t)dst_oh_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header"); addr_new = oh_dst->chunk[0].addr; /* Create memory image for the new chunk */ @@ -564,7 +563,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 * (QAK - 2010/08/17) */ if (NULL == (oh_dst->chunk[0].image = H5FL_BLK_CALLOC(chunk_image, (size_t)dst_oh_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Set dest. chunk information */ oh_dst->chunk[0].size = (size_t)dst_oh_size; @@ -577,7 +576,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 * treatment. This has to happen after the destination header has been * allocated. */ - HDassert(H5O_SIZEOF_MSGHDR_OH(oh_src) == H5O_SIZEOF_MSGHDR_OH(oh_dst)); + assert(H5O_SIZEOF_MSGHDR_OH(oh_src) == H5O_SIZEOF_MSGHDR_OH(oh_dst)); msghdr_size = H5O_SIZEOF_MSGHDR_OH(oh_dst); current_pos = oh_dst->chunk[0].image; @@ -598,7 +597,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 if (FALSE == cpy_info->preserve_null) { while (deleted[mesgno + null_msgs]) { ++null_msgs; - HDassert(mesgno + null_msgs < oh_src->nmesgs); + assert(mesgno + null_msgs < oh_src->nmesgs); } /* end while */ } /* end if */ @@ -628,7 +627,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Make sure we have enough space for new NULL message */ if (oh_dst->nmesgs + 1 > oh_dst->alloc_nmesgs) if (H5O__alloc_msgs(oh_dst, (size_t)1) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate more space for messages"); /* Create null message for [rest of] space in new chunk */ /* (account for chunk's magic # & checksum) */ @@ -642,11 +641,11 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 } /* end if */ /* Make sure we filled the chunk, except for room at the end for a checksum */ - HDassert(current_pos + dst_oh_gap + dst_oh_null + H5O_SIZEOF_CHKSUM_OH(oh_dst) == - (size_t)dst_oh_size + oh_dst->chunk[0].image); + assert(current_pos + dst_oh_gap + dst_oh_null + H5O_SIZEOF_CHKSUM_OH(oh_dst) == + (size_t)dst_oh_size + oh_dst->chunk[0].image); /* Set the dest. object location to the first chunk address */ - HDassert(H5F_addr_defined(addr_new)); + assert(H5_addr_defined(addr_new)); oloc_dst->addr = addr_new; /* If we are merging committed datatypes and this is a committed datatype, insert @@ -654,11 +653,11 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 */ if (cpy_info->merge_comm_dt && obj_class->type == H5O_TYPE_NAMED_DATATYPE) if (H5O__copy_insert_comm_dt(oloc_src->file, oh_src, oloc_dst, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't insert committed datatype into destination list") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't insert committed datatype into destination list"); /* Allocate space for the address mapping of the object copied */ if (NULL == (addr_map = H5FL_MALLOC(H5O_addr_map_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Insert the address mapping for the new object into the copied list */ /* (Do this here, because "post copy" possibly checks it) */ @@ -673,7 +672,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Insert into skip list */ if (H5SL_insert(cpy_info->map_list, addr_map, &(addr_map->src_obj_pos)) < 0) { addr_map = H5FL_FREE(H5O_addr_map_t, addr_map); - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list"); } /* end if */ /* "post copy" loop over messages, to fix up any messages which require a complete @@ -687,7 +686,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 if (FALSE == cpy_info->preserve_null) { while (deleted[mesgno + null_msgs]) { ++null_msgs; - HDassert(mesgno + null_msgs < oh_src->nmesgs); + assert(mesgno + null_msgs < oh_src->nmesgs); } /* end while */ } /* end if */ @@ -700,14 +699,14 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 * converted to a nil message) in the destination -QAK) */ copy_type = mesg_dst->type; - HDassert(copy_type); + assert(copy_type); if (copy_type->post_copy_file && mesg_src->native) { unsigned mesg_flags; /* Message flags */ /* Sanity check destination message */ - HDassert(mesg_dst->type == mesg_src->type); - HDassert(mesg_dst->native); + assert(mesg_dst->type == mesg_src->type); + assert(mesg_dst->native); /* Get destination message flags. mesg_dst->flags will contain the * original flags for now. */ @@ -720,10 +719,10 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 if ((copy_type->post_copy_file)(oloc_src, mesg_src->native, oloc_dst, mesg_dst->native, &mesg_flags, cpy_info) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, - "unable to perform 'post copy' operation on message") + "unable to perform 'post copy' operation on message"); /* Verify that the flags did not change */ - HDassert(mesg_flags == (unsigned)mesg_dst->flags); + assert(mesg_flags == (unsigned)mesg_dst->flags); } /* end if */ } /* end for */ @@ -738,14 +737,14 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Retag all copied metadata to apply the destination object's tag */ if (H5AC_retag_copied_metadata(oloc_dst->file, oloc_dst->addr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to re-tag metadata entries") + HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, FAIL, "unable to re-tag metadata entries"); /* Set metadata tag for destination object's object header */ - H5_BEGIN_TAG(oloc_dst->addr); + H5_BEGIN_TAG(oloc_dst->addr) /* Insert destination object header in cache */ if (H5AC_insert_entry(oloc_dst->file, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header"); oh_dst = NULL; inserted = TRUE; @@ -754,7 +753,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Set obj_type and udata, if requested */ if (obj_type) { - HDassert(udata); + assert(udata); *obj_type = obj_class->type; *udata = cpy_udata; } /* end if */ @@ -766,15 +765,15 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 /* Release pointer to source object header and its derived objects */ if (oh_src && H5O_unprotect(oloc_src, oh_src, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); /* Free destination object header on failure */ if (ret_value < 0) { if (oh_dst && !inserted) { if (H5O__free(oh_dst, TRUE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data") + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data"); if (H5O_loc_reset(oloc_dst) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data") + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data"); } /* end if */ if (addr_map == NULL && cpy_udata) { @@ -794,9 +793,6 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5 * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 1, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -811,11 +807,11 @@ H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5O_ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(oloc_src); - HDassert(oloc_src->file); - HDassert(oloc_dst); - HDassert(oloc_dst->file); - HDassert(cpy_info); + assert(oloc_src); + assert(oloc_src->file); + assert(oloc_dst); + assert(oloc_dst->file); + assert(cpy_info); /* Create object "position" struct */ H5F_GET_FILENO(oloc_src->file, src_obj_pos.fileno); @@ -835,7 +831,7 @@ H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5O_ /* Copy object referred to */ if (H5O__copy_header_real(oloc_src, oloc_dst, cpy_info, obj_type, udata) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); /* Check for incrementing the depth of copy */ if (inc_depth) @@ -853,7 +849,7 @@ H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5O_ /* Return saved obj_type and udata, if requested */ if (obj_type) { - HDassert(udata); + assert(udata); *obj_type = addr_map->obj_class->type; *udata = addr_map->udata; } /* end if */ @@ -874,7 +870,7 @@ H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5O_ /* Increment destination object's link count, if allowed */ if (inc_link) if (H5O_link(oloc_dst, 1) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to increment object link count") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to increment object link count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -906,12 +902,12 @@ H5O__copy_free_addrmap_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UN FUNC_ENTER_PACKAGE_NOERR - HDassert(item); + assert(item); /* Release user data for particular type of object */ if (item->udata) { - HDassert(item->obj_class); - HDassert(item->obj_class->free_copy_file_udata); + assert(item->obj_class); + assert(item->obj_class->free_copy_file_udata); (item->obj_class->free_copy_file_udata)(item->udata); } /* end if */ @@ -928,9 +924,6 @@ H5O__copy_free_addrmap_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UN * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * May 30, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -946,29 +939,29 @@ H5O__copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, hid_t FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(oloc_src); - HDassert(oloc_src->file); - HDassert(H5F_addr_defined(oloc_src->addr)); - HDassert(oloc_dst->file); + assert(oloc_src); + assert(oloc_src->file); + assert(H5_addr_defined(oloc_src->addr)); + assert(oloc_dst->file); /* Initialize copy info before errors can be thrown */ - HDmemset(&cpy_info, 0, sizeof(H5O_copy_t)); + memset(&cpy_info, 0, sizeof(H5O_copy_t)); /* Get the copy property list */ if (NULL == (ocpy_plist = (H5P_genplist_t *)H5I_object(ocpypl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Retrieve the copy parameters */ if (H5P_get(ocpy_plist, H5O_CPY_OPTION_NAME, &cpy_option) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object copy flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object copy flag"); /* Retrieve the merge committed datatype list */ if (H5P_peek(ocpy_plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed datatype list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed datatype list"); /* Get callback info */ if (H5P_get(ocpy_plist, H5O_CPY_MCDT_SEARCH_CB_NAME, &cb_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info"); /* Convert copy flags into copy struct */ if ((cpy_option & H5O_COPY_SHALLOW_HIERARCHY_FLAG) > 0) { @@ -1003,11 +996,11 @@ H5O__copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, hid_t /* Create a skip list to keep track of which objects are copied */ if (NULL == (cpy_info.map_list = H5SL_create(H5SL_TYPE_OBJ, NULL))) - HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, FAIL, "cannot make skip list") + HGOTO_ERROR(H5E_SLIST, H5E_CANTCREATE, FAIL, "cannot make skip list"); /* copy the object from the source file to the destination file */ if (H5O__copy_header_real(oloc_src, oloc_dst, &cpy_info, NULL, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); done: if (cpy_info.map_list) @@ -1025,9 +1018,6 @@ H5O__copy_header(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, hid_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * June 4, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -1042,11 +1032,11 @@ H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name, hid_ FUNC_ENTER_PACKAGE - HDassert(src_loc); - HDassert(src_loc->oloc->file); - HDassert(dst_loc); - HDassert(dst_loc->oloc->file); - HDassert(dst_name); + assert(src_loc); + assert(src_loc->oloc->file); + assert(dst_loc); + assert(dst_loc->oloc->file); + assert(dst_name); /* Set up copied object location to fill in */ new_loc.oloc = &new_oloc; @@ -1061,7 +1051,7 @@ H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name, hid_ /* Copy the object from the source file to the destination file */ if (H5O__copy_header(src_loc->oloc, &new_oloc, ocpypl_id, lcpl_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); /* Patch dst_loc. Again, this can be removed once oloc's point to shared * file structs. */ @@ -1069,7 +1059,7 @@ H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name, hid_ /* Insert the new object in the destination file's group */ if (H5L_link(dst_loc, dst_name, &new_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link"); entry_inserted = TRUE; done: @@ -1087,9 +1077,6 @@ H5O__copy_obj(H5G_loc_t *src_loc, H5G_loc_t *dst_loc, const char *dst_name, hid_ * * Return: SUCCEED (never fails) * - * Programmer: Neil Fortner - * Oct 6 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1100,9 +1087,9 @@ H5O__copy_free_comm_dt_cb(void *item, void *_key, void H5_ATTR_UNUSED *_op_data) FUNC_ENTER_PACKAGE_NOERR - HDassert(addr); - HDassert(key); - HDassert(key->dt); + assert(addr); + assert(key); + assert(key->dt); key->dt = (H5T_t *)H5O_msg_free(H5O_DTYPE_ID, key->dt); key = H5FL_FREE(H5O_copy_search_comm_dt_key_t, key); @@ -1121,9 +1108,6 @@ H5O__copy_free_comm_dt_cb(void *item, void *_key, void H5_ATTR_UNUSED *_op_data) * <0 if key1 is less than key2. * >0 if key1 is greater than key2. * - * Programmer: Neil Fortner - * Oct 6 2011 - * *------------------------------------------------------------------------- */ static int @@ -1139,9 +1123,9 @@ H5O__copy_comm_dt_cmp(const void *_key1, const void *_key2) * first so only one comparison needs to be made. */ if (key1->fileno != key2->fileno) { if (key1->fileno < key2->fileno) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (key1->fileno > key2->fileno) - HGOTO_DONE(1) + HGOTO_DONE(1); } /* end if */ ret_value = H5T_cmp(key1->dt, key2->dt, FALSE); @@ -1161,9 +1145,6 @@ H5O__copy_comm_dt_cmp(const void *_key1, const void *_key2) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Nov 3 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1179,24 +1160,24 @@ H5O__copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(attr); - HDassert(udata); - HDassert(udata->dst_dt_list); - HDassert(H5F_addr_defined(udata->obj_oloc.addr)); + assert(attr); + assert(udata); + assert(udata->dst_dt_list); + assert(H5_addr_defined(udata->obj_oloc.addr)); /* Get attribute datatype */ if (NULL == (dt = H5A_type(attr))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get attribute datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get attribute datatype"); /* Check if the datatype is committed and search the skip list if so */ if (H5T_is_named(dt)) { /* Allocate key */ if (NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Copy datatype into key */ if (NULL == (key->dt = (H5T_t *)H5O_msg_copy(H5O_DTYPE_ID, dt, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy datatype message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy datatype message"); /* Get datatype object fileno */ H5F_GET_FILENO(udata->obj_oloc.file, key->fileno); @@ -1204,12 +1185,12 @@ H5O__copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) if (!H5SL_search(udata->dst_dt_list, key)) { /* Allocate destination address */ if (NULL == (addr = H5FL_MALLOC(haddr_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Add the destination datatype to the skip list */ *addr = ((H5O_shared_t *)(key->dt))->u.loc.oh_addr; if (H5SL_insert(udata->dst_dt_list, addr, key) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list"); obj_inserted = TRUE; } /* end if */ } /* end if */ @@ -1223,7 +1204,7 @@ H5O__copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) key = H5FL_FREE(H5O_copy_search_comm_dt_key_t, key); } /* end if */ if (addr) { - HDassert(ret_value < 0); + assert(ret_value < 0); addr = H5FL_FREE(haddr_t, addr); } /* end if */ } /* end if */ @@ -1241,9 +1222,6 @@ H5O__copy_search_comm_dt_attr_cb(const H5A_t *attr, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Nov 3 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1259,25 +1237,25 @@ H5O__copy_search_comm_dt_check(H5O_loc_t *obj_oloc, H5O_copy_search_comm_dt_ud_t FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(obj_oloc); - HDassert(udata); - HDassert(udata->dst_dt_list); - HDassert(udata->dst_root_loc); + assert(obj_oloc); + assert(udata); + assert(udata->dst_dt_list); + assert(udata->dst_root_loc); /* Get pointer to object class for this object */ if ((obj_class = H5O__obj_class(obj_oloc)) == NULL) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type"); /* Check if the object is a datatype, a dataset using a committed * datatype, or contains an attribute using a committed datatype */ if (obj_class->type == H5O_TYPE_NAMED_DATATYPE) { /* Allocate key */ if (NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Read the destination datatype */ if (NULL == (key->dt = (H5T_t *)H5O_msg_read(obj_oloc, H5O_DTYPE_ID, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message"); /* Get destination object fileno */ H5F_GET_FILENO(obj_oloc->file, key->fileno); @@ -1286,23 +1264,23 @@ H5O__copy_search_comm_dt_check(H5O_loc_t *obj_oloc, H5O_copy_search_comm_dt_ud_t if (!H5SL_search(udata->dst_dt_list, key)) { /* Allocate destination address */ if (NULL == (addr = H5FL_MALLOC(haddr_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Add the destination datatype to the skip list */ *addr = obj_oloc->addr; if (H5SL_insert(udata->dst_dt_list, addr, key) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list"); obj_inserted = TRUE; } /* end if */ } /* end if */ else if (obj_class->type == H5O_TYPE_DATASET) { /* Allocate key */ if (NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Read the destination datatype */ if (NULL == (key->dt = (H5T_t *)H5O_msg_read(obj_oloc, H5O_DTYPE_ID, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message"); /* Check if the datatype is committed and search the skip list if so */ if (H5T_is_named(key->dt)) { @@ -1312,12 +1290,12 @@ H5O__copy_search_comm_dt_check(H5O_loc_t *obj_oloc, H5O_copy_search_comm_dt_ud_t if (!H5SL_search(udata->dst_dt_list, key)) { /* Allocate destination address */ if (NULL == (addr = H5FL_MALLOC(haddr_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Add the destination datatype to the skip list */ *addr = ((H5O_shared_t *)(key->dt))->u.loc.oh_addr; if (H5SL_insert(udata->dst_dt_list, addr, key) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list"); obj_inserted = TRUE; } /* end if */ } /* end if */ @@ -1341,7 +1319,7 @@ H5O__copy_search_comm_dt_check(H5O_loc_t *obj_oloc, H5O_copy_search_comm_dt_ud_t key = H5FL_FREE(H5O_copy_search_comm_dt_key_t, key); } /* end if */ if (addr) { - HDassert(ret_value < 0); + assert(ret_value < 0); addr = H5FL_FREE(haddr_t, addr); } /* end if */ } /* end if */ @@ -1358,9 +1336,6 @@ H5O__copy_search_comm_dt_check(H5O_loc_t *obj_oloc, H5O_copy_search_comm_dt_ud_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Oct 6 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1378,11 +1353,11 @@ H5O__copy_search_comm_dt_cb(hid_t H5_ATTR_UNUSED group, const char *name, const FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(name); - HDassert(linfo); - HDassert(udata); - HDassert(udata->dst_dt_list); - HDassert(udata->dst_root_loc); + assert(name); + assert(linfo); + assert(udata); + assert(udata->dst_dt_list); + assert(udata->dst_root_loc); /* Check if this is a hard link */ if (linfo->type == H5L_TYPE_HARD) { @@ -1393,18 +1368,18 @@ H5O__copy_search_comm_dt_cb(hid_t H5_ATTR_UNUSED group, const char *name, const /* Find the object */ if (H5G_loc_find(udata->dst_root_loc, name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5_ITER_ERROR, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5_ITER_ERROR, "object not found"); obj_found = TRUE; /* Check object and add to skip list if appropriate */ if (H5O__copy_search_comm_dt_check(&obj_oloc, udata) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "can't check object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "can't check object"); } /* end if */ done: /* Release resources */ if (obj_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__copy_search_comm_dt_cb */ @@ -1421,9 +1396,6 @@ H5O__copy_search_comm_dt_cb(hid_t H5_ATTR_UNUSED group, const char *name, const * FALSE if a match is not found * Negative on failure * - * Programmer: Neil Fortner - * Sep 27 2011 - * *------------------------------------------------------------------------- */ static htri_t @@ -1439,19 +1411,19 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst /*i FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(oh_src); - HDassert(oloc_dst); - HDassert(oloc_dst->file); - HDassert(H5F_ID_EXISTS(oloc_dst->file)); - HDassert(cpy_info); + assert(oh_src); + assert(oloc_dst); + assert(oloc_dst->file); + assert(H5F_ID_EXISTS(oloc_dst->file)); + assert(cpy_info); /* Allocate key */ if (NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Read the source datatype */ if (NULL == (key->dt = (H5T_t *)H5O_msg_read_oh(file_src, oh_src, H5O_DTYPE_ID, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message"); /* Get destination object fileno */ H5F_GET_FILENO(oloc_dst->file, key->fileno); @@ -1460,7 +1432,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst /*i if (!cpy_info->dst_dt_list) { /* Create the skip list */ if (NULL == (cpy_info->dst_dt_list = H5SL_create(H5SL_TYPE_GENERIC, H5O__copy_comm_dt_cmp))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create skip list for committed datatypes") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create skip list for committed datatypes"); /* Add suggested types to list, if they are present */ if (cpy_info->dst_dt_suggestion_list) { @@ -1471,9 +1443,9 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst /*i /* Set up the root group in the destination file */ if (NULL == (dst_root_loc.oloc = H5G_oloc(H5G_rootof(oloc_dst->file)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group"); if (NULL == (dst_root_loc.path = H5G_nameof(H5G_rootof(oloc_dst->file)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group"); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1498,7 +1470,7 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst /*i if (H5O__copy_search_comm_dt_check(&obj_oloc, &udata) < 0) { if (H5G_loc_free(&obj_loc) < 0) HERROR(H5E_OHDR, H5E_CANTRELEASE, "can't free location"); - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't check object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't check object"); } /* end if */ /* Free location */ @@ -1526,21 +1498,21 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst /*i /* Make callback to see if we should search destination file */ if (cpy_info->mcdt_cb) if ((search_cb_ret = cpy_info->mcdt_cb(cpy_info->mcdt_ud)) == H5O_MCDT_SEARCH_ERROR) - HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "callback returned error") + HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "callback returned error"); if (search_cb_ret == H5O_MCDT_SEARCH_CONT) { /* Build the complete dst dt list */ /* Set up the root group in the destination file, if necessary */ if (!dst_root_loc.oloc) { - HDassert(!dst_root_loc.path); + assert(!dst_root_loc.path); if (NULL == (dst_root_loc.oloc = H5G_oloc(H5G_rootof(oloc_dst->file)))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "unable to get object location for root group") + "unable to get object location for root group"); if (NULL == (dst_root_loc.path = H5G_nameof(H5G_rootof(oloc_dst->file)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group"); } /* end if */ else - HDassert(dst_root_loc.path); + assert(dst_root_loc.path); /* Build udata. Note that this may be done twice in some cases, but * it should be rare and should be cheaper on average than trying to @@ -1554,11 +1526,11 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst /*i * list */ if (H5G_visit(&dst_root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5O__copy_search_comm_dt_cb, &udata) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed"); cpy_info->dst_dt_list_complete = TRUE; } /* end if */ else if (search_cb_ret != H5O_MCDT_SEARCH_STOP) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown return value for callback") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown return value for callback"); } /* end if */ } /* end if */ @@ -1589,9 +1561,6 @@ H5O__copy_search_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst /*i * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Oct 6 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1604,33 +1573,33 @@ H5O__copy_insert_comm_dt(H5F_t *file_src, H5O_t *oh_src, H5O_loc_t *oloc_dst, H5 FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(oh_src); - HDassert(oloc_dst); - HDassert(oloc_dst->file); - HDassert(oloc_dst->addr != HADDR_UNDEF); - HDassert(cpy_info); - HDassert(cpy_info->dst_dt_list); + assert(oh_src); + assert(oloc_dst); + assert(oloc_dst->file); + assert(oloc_dst->addr != HADDR_UNDEF); + assert(cpy_info); + assert(cpy_info->dst_dt_list); /* Allocate key */ if (NULL == (key = H5FL_MALLOC(H5O_copy_search_comm_dt_key_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Read the datatype. Read from the source file because the destination * object could be changed in the post-copy. */ if (NULL == (key->dt = (H5T_t *)H5O_msg_read_oh(file_src, oh_src, H5O_DTYPE_ID, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read DTYPE message"); /* Get destination object fileno */ H5F_GET_FILENO(oloc_dst->file, key->fileno); /* Allocate destination address */ if (NULL == (addr = H5FL_MALLOC(haddr_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Add the destination datatype to the skip list */ *addr = oloc_dst->addr; if (H5SL_insert(cpy_info->dst_dt_list, addr, key) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object into skip list"); done: if (ret_value < 0) { diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ocopy_ref.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ocopy_ref.c index 7ba2dc558e..2479d71162 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ocopy_ref.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ocopy_ref.c @@ -14,7 +14,7 @@ * * Created: H5Ocopy_ref.c * - * Purpose: Object with references copying routines. + * Purpose: Object with references copying routines * *------------------------------------------------------------------------- */ @@ -30,6 +30,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File */ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ @@ -99,15 +100,15 @@ H5O__copy_obj_by_ref(H5O_loc_t *src_oloc, H5O_loc_t *dst_oloc, H5G_loc_t *dst_ro FUNC_ENTER_PACKAGE - HDassert(src_oloc); - HDassert(dst_oloc); + assert(src_oloc); + assert(dst_oloc); /* Perform the copy, or look up existing copy */ if ((ret_value = H5O_copy_header_map(src_oloc, dst_oloc, cpy_info, FALSE, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); /* Check if a new valid object is copied to the destination */ - if (H5F_addr_defined(dst_oloc->addr) && (ret_value > SUCCEED)) { + if (H5_addr_defined(dst_oloc->addr) && (ret_value > SUCCEED)) { char tmp_obj_name[80]; H5G_name_t new_path; H5O_loc_t new_oloc; @@ -131,10 +132,10 @@ H5O__copy_obj_by_ref(H5O_loc_t *src_oloc, H5O_loc_t *dst_oloc, H5G_loc_t *dst_ro * This could be changed in the future to slightly improve performance * --NAF */ if (H5L_link(dst_root_loc, tmp_obj_name, &new_loc, cpy_info->lcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert link"); H5G_loc_free(&new_loc); - } /* if (H5F_addr_defined(dst_oloc.addr)) */ + } /* if (H5_addr_defined(dst_oloc.addr)) */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -170,30 +171,30 @@ H5O__copy_expand_ref_object1(H5O_loc_t *src_oloc, const void *buf_src, H5O_loc_t H5O_token_t tmp_token = {0}; /* If data is not initialized, copy zeros and skip */ - if (0 == HDmemcmp(src_buf, zeros, buf_size)) - HDmemset(dst_buf, 0, buf_size); + if (0 == memcmp(src_buf, zeros, buf_size)) + memset(dst_buf, 0, buf_size); else { /* Set up for the object copy for the reference */ if (H5R__decode_token_obj_compat(src_buf, &buf_size, &tmp_token, token_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode src object address") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode src object address"); if (H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); - if (!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer") + if (!H5_addr_defined(src_oloc->addr) || src_oloc->addr == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer"); dst_oloc->addr = HADDR_UNDEF; /* Attempt to copy object from source to destination file */ if (H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); /* Set the object reference info for the destination file */ if (H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token"); if (H5R__encode_token_obj_compat((const H5O_token_t *)&tmp_token, token_size, dst_buf, &buf_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to encode dst object address") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to encode dst object address"); } /* end else */ } /* end for */ @@ -233,26 +234,26 @@ H5O__copy_expand_ref_region1(H5O_loc_t *src_oloc, const void *buf_src, H5O_loc_t uint8_t *q; /* If data is not initialized, copy zeros and skip */ - if (0 == HDmemcmp(src_buf, zeros, buf_size)) - HDmemset(dst_buf, 0, buf_size); + if (0 == memcmp(src_buf, zeros, buf_size)) + memset(dst_buf, 0, buf_size); else { /* Read from heap */ if (H5R__decode_heap(src_oloc->file, src_buf, &buf_size, &data, &data_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode dataset region information") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "unable to decode dataset region information"); /* Get object address */ p = (const uint8_t *)data; H5F_addr_decode(src_oloc->file, &p, &src_oloc->addr); - if (!H5F_addr_defined(src_oloc->addr) || src_oloc->addr == 0) { + if (!H5_addr_defined(src_oloc->addr) || src_oloc->addr == 0) { H5MM_free(data); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "undefined reference pointer"); } dst_oloc->addr = HADDR_UNDEF; /* Attempt to copy object from source to destination file */ if (H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0) { H5MM_free(data); - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); } /* end if */ /* Serialize object addr */ @@ -262,7 +263,7 @@ H5O__copy_expand_ref_region1(H5O_loc_t *src_oloc, const void *buf_src, H5O_loc_t /* Write to heap */ if (H5R__encode_heap(dst_oloc->file, dst_buf, &buf_size, data, (size_t)data_size) < 0) { H5MM_free(data); - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode dataset region information") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode dataset region information"); } /* Free the buffer allocated in H5R__decode_heap() */ @@ -309,48 +310,48 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, const H5T_t *dt /* Create datatype ID for src datatype. */ if ((tid_src == H5I_INVALID_HID) && (tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register source file datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register source file datatype"); /* create a memory copy of the reference datatype */ if (NULL == (dt_mem = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy"); if ((tid_mem = H5I_register(H5I_DATATYPE, dt_mem, FALSE)) < 0) { (void)H5T_close_real(dt_mem); - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register memory datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register memory datatype"); } /* end if */ /* create reference datatype at the destination file */ if (NULL == (dt_dst = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy"); if (H5T_set_loc(dt_dst, H5F_VOL_OBJ(dst_oloc->file), H5T_LOC_DISK) < 0) { (void)H5T_close_real(dt_dst); - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "cannot mark datatype on disk"); } /* end if */ if ((tid_dst = H5I_register(H5I_DATATYPE, dt_dst, FALSE)) < 0) { (void)H5T_close_real(dt_dst); - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register destination file datatype"); } /* end if */ /* Set up the conversion functions */ if (NULL == (tpath_src_mem = H5T_path_find(dt_src, dt_mem))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and mem datatypes"); if (NULL == (tpath_mem_dst = H5T_path_find(dt_mem, dt_dst))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between mem and dst datatypes"); /* Use extra conversion buffer (TODO we should avoid using an extra buffer once the H5Ocopy code has been * reworked) */ conv_buf_size = MAX(H5T_get_size(dt_src), H5T_get_size(dt_mem)) * ref_count; if (NULL == (conv_buf = H5FL_BLK_MALLOC(type_conv, conv_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer"); H5MM_memcpy(conv_buf, buf_src, nbytes_src); /* Convert from source file to memory */ if (H5T_convert(tpath_src_mem, tid_src, tid_mem, ref_count, (size_t)0, (size_t)0, conv_buf, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); /* Retrieve loc ID */ if ((dst_loc_id = H5F_get_id(dst_oloc->file)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Making equivalent references in the destination file */ for (i = 0; i < ref_count; i++) { @@ -358,63 +359,63 @@ H5O__copy_expand_ref_object2(H5O_loc_t *src_oloc, hid_t tid_src, const H5T_t *dt H5R_ref_priv_t *ref = (H5R_ref_priv_t *)&ref_ptr[i]; /* Check for null reference - only expand reference if it is not null */ - if (HDmemcmp(ref, zeros, H5R_REF_BUF_SIZE)) { + if (memcmp(ref, zeros, H5R_REF_BUF_SIZE)) { H5O_token_t tmp_token = {0}; /* Get src object address */ if (H5R__get_obj_token(ref, &tmp_token, &token_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object token") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object token"); if (H5VL_native_token_to_addr(src_oloc->file, H5I_FILE, tmp_token, &src_oloc->addr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); /* Attempt to copy object from source to destination file */ if (H5O__copy_obj_by_ref(src_oloc, dst_oloc, dst_root_loc, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); /* Set dst object address */ if (H5VL_native_addr_to_token(dst_oloc->file, H5I_FILE, dst_oloc->addr, &tmp_token) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token"); if (H5R__set_obj_token(ref, (const H5O_token_t *)&tmp_token, token_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set object token") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set object token"); /* Do not set app_ref since references are released once the copy is done */ if (H5R__set_loc_id(ref, dst_loc_id, TRUE, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set destination loc id") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set destination loc id"); } /* end if */ } /* end for */ /* Copy into another buffer, to reclaim memory later */ if (NULL == (reclaim_buf = H5FL_BLK_MALLOC(type_conv, conv_buf_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for copy buffer"); H5MM_memcpy(reclaim_buf, conv_buf, conv_buf_size); if (NULL == (buf_space = H5S_create_simple((unsigned)1, buf_dim, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); /* Convert from memory to destination file */ if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, ref_count, (size_t)0, (size_t)0, conv_buf, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); H5MM_memcpy(buf_dst, conv_buf, nbytes_src); /* Reclaim space from reference data */ if (H5T_reclaim(tid_mem, buf_space, reclaim_buf) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "unable to reclaim reference data") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "unable to reclaim reference data"); done: if (buf_space && (H5S_close(buf_space) < 0)) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't close dataspace") + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't close dataspace"); /* Don't decrement ID, we want to keep underlying datatype */ if (reg_tid_src && (tid_src > 0) && (NULL == H5I_remove(tid_src))) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if ((tid_mem > 0) && H5I_dec_ref(tid_mem) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if ((tid_dst > 0) && H5I_dec_ref(tid_dst) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID") + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "Can't decrement temporary datatype ID"); if (reclaim_buf) reclaim_buf = H5FL_BLK_FREE(type_conv, reclaim_buf); if (conv_buf) conv_buf = H5FL_BLK_FREE(type_conv, conv_buf); if ((dst_loc_id != H5I_INVALID_HID) && (H5I_dec_ref(dst_loc_id) < 0)) - HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement refcount on location id") + HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement refcount on location id"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__copy_expand_ref_object2() */ @@ -441,12 +442,12 @@ H5O_copy_expand_ref(H5F_t *file_src, hid_t tid_src, const H5T_t *dt_src, void *b FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(file_src); - HDassert(buf_src); - HDassert(file_dst); - HDassert(buf_dst); - HDassert(nbytes_src); - HDassert(cpy_info); + assert(file_src); + assert(buf_src); + assert(file_dst); + assert(buf_dst); + assert(nbytes_src); + assert(cpy_info); /* Initialize object locations */ H5O_loc_reset(&src_oloc); @@ -456,9 +457,9 @@ H5O_copy_expand_ref(H5F_t *file_src, hid_t tid_src, const H5T_t *dt_src, void *b /* Set up the root group in the destination file */ if (NULL == (dst_root_loc.oloc = H5G_oloc(H5G_rootof(file_dst)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location for root group"); if (NULL == (dst_root_loc.path = H5G_nameof(H5G_rootof(file_dst)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get path for root group"); /* Determine # of reference elements to copy */ ref_count = nbytes_src / H5T_get_size(dt_src); @@ -468,24 +469,24 @@ H5O_copy_expand_ref(H5F_t *file_src, hid_t tid_src, const H5T_t *dt_src, void *b case H5R_OBJECT1: if (H5O__copy_expand_ref_object1(&src_oloc, buf_src, &dst_oloc, &dst_root_loc, buf_dst, ref_count, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to expand H5R_OBJECT1 reference") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to expand H5R_OBJECT1 reference"); break; case H5R_DATASET_REGION1: if (H5O__copy_expand_ref_region1(&src_oloc, buf_src, &dst_oloc, &dst_root_loc, buf_dst, ref_count, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to expand H5R_DATASET_REGION1 reference") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to expand H5R_DATASET_REGION1 reference"); break; case H5R_DATASET_REGION2: case H5R_ATTR: case H5R_OBJECT2: if (H5O__copy_expand_ref_object2(&src_oloc, tid_src, dt_src, buf_src, nbytes_src, &dst_oloc, &dst_root_loc, buf_dst, ref_count, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to expand reference") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to expand reference"); break; case H5R_BADTYPE: case H5R_MAXTYPE: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type"); break; } /* end switch */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5OcreatProp.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5OcreatProp.cpp deleted file mode 100644 index dffdeb1022..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5OcreatProp.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control -// the order of creation and deletion of the global constants. See Design Notes -// in "H5PredType.cpp" for information. - -// Initialize a pointer for the constant -ObjCreatPropList *ObjCreatPropList::DEFAULT_ = 0; - -//-------------------------------------------------------------------------- -// Function: ObjCreatPropList::getConstant -// Creates a ObjCreatPropList object representing the HDF5 constant -// H5P_FILE_ACCESS, pointed to by ObjCreatPropList::DEFAULT_ -// exception H5::PropListIException -// Description -// If ObjCreatPropList::DEFAULT_ already points to an allocated -// object, throw a PropListIException. This scenario should not -// happen. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -ObjCreatPropList * -ObjCreatPropList::getConstant() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the constant pointer is not allocated, allocate it. Otherwise, - // throw because it shouldn't be. - if (DEFAULT_ == 0) - DEFAULT_ = new ObjCreatPropList(H5P_OBJECT_CREATE); - else - throw PropListIException("ObjCreatPropList::getConstant", - "ObjCreatPropList::getConstant is being invoked on an allocated DEFAULT_"); - return (DEFAULT_); -} - -//-------------------------------------------------------------------------- -// Function: ObjCreatPropList::deleteConstants -// Purpose: Deletes the constant object that ObjCreatPropList::DEFAULT_ -// points to. -// exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -ObjCreatPropList::deleteConstants() -{ - delete DEFAULT_; -} - -//-------------------------------------------------------------------------- -// Purpose: Constant for default property -//-------------------------------------------------------------------------- -const ObjCreatPropList &ObjCreatPropList::DEFAULT = *getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: Default Constructor -///\brief Creates a file access property list -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) -{ -} - -//-------------------------------------------------------------------------- -// Function: ObjCreatPropList copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param original - IN: ObjCreatPropList instance to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList &original) : PropList(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: ObjCreatPropList overloaded constructor -///\brief Creates a file access property list using the id of an -/// existing one. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: ObjCreatPropList::setAttrPhaseChange -///\brief Sets attribute storage phase change thresholds. -///\param max_compact - IN: Maximum number of attributes to be stored in -/// compact storage. Default to 8 -///\param min_dense - IN: Minimum number of attributes to be stored in -/// dense storage. Default to 6 -///\exception H5::PropListIException -///\par Description -/// If \c max_compact is set to 0, dense storage will be used. -/// For more detail about on attribute storage, please refer to the -/// H5Pset_attr_phase_change API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - September 2015 -//-------------------------------------------------------------------------- -void -ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) const -{ - herr_t ret_value = H5Pset_attr_phase_change(id, max_compact, min_dense); - if (ret_value < 0) { - throw PropListIException("ObjCreatPropList::setAttrPhaseChange", "H5Pset_attr_phase_change failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: ObjCreatPropList::getAttrPhaseChange -///\brief Gets attribute storage phase change thresholds. -///\param max_compact - OUT: Maximum number of attributes to be stored in -/// compact storage. -///\param min_dense - OUT: Minimum number of attributes to be stored in -/// dense storage. -///\exception H5::PropListIException -///\par Description -/// If \c max_compact is set to 0, dense storage will be used. -/// For more detail about on attribute storage, please refer to the -/// H5Pget_attr_phase_change API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - September 2015 -//-------------------------------------------------------------------------- -void -ObjCreatPropList::getAttrPhaseChange(unsigned &max_compact, unsigned &min_dense) const -{ - herr_t ret_value; - ret_value = H5Pget_attr_phase_change(id, &max_compact, &min_dense); - if (ret_value < 0) { - throw PropListIException("ObjCreatPropList::getAttrPhaseChange", "H5Pget_attr_phase_change failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: ObjCreatPropList::setAttrCrtOrder -///\brief Set the flags for creation order of attributes on an object -///\param crt_order_flags - IN: Flags specifying whether to track and -/// index attribute creation order. Default: No flag set -///\exception H5::PropListIException -///\par Description -/// Valid flags are: -/// \li \c H5P_CRT_ORDER_TRACKED - Attribute creation order is tracked -/// \li \c H5P_CRT_ORDER_INDEXED - Attribute creation order is -/// indexed (requires H5P_CRT_ORDER_TRACKED). -/// When no flag is set, attribute creation order is neither -/// tracked not indexed. Note that HDF5 currently provides no -/// mechanism to turn on attribute creation order tracking at object -/// creation time and to build the index later. -/// For detail, please refer to the H5Pset_attr_creation_order API -/// in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - September 2015 -//-------------------------------------------------------------------------- -void -ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const -{ - herr_t ret_value = H5Pset_attr_creation_order(id, crt_order_flags); - if (ret_value < 0) { - throw PropListIException("ObjCreatPropList::setAttrCrtOrder", "H5Pset_attr_creation_order failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: ObjCreatPropList::getAttrCrtOrder -///\brief Returns the flags indicating creation order is tracked/indexed -/// for attributes on an object. -///\return The flags -///\exception H5::PropListIException -///\par Description -/// When no flag is set, i.e. crt_order_flags = 0, attribute -/// creation order is neither tracked not indexed. -/// For detail, please refer to the H5Pget_attr_creation_order API -/// in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - September 2015 -//-------------------------------------------------------------------------- -unsigned -ObjCreatPropList::getAttrCrtOrder() const -{ - herr_t ret_value; - unsigned crt_order_flags = 0; - ret_value = H5Pget_attr_creation_order(id, &crt_order_flags); - if (ret_value < 0) { - throw PropListIException("ObjCreatPropList::getAttrCrtOrder", "H5Pget_attr_creation_order failed"); - } - return (crt_order_flags); -} - -//-------------------------------------------------------------------------- -// Function: ObjCreatPropList destructor -///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -ObjCreatPropList::~ObjCreatPropList() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Odbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Odbg.c index 2435463f73..d6c7097a4c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Odbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Odbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Odbg.c - * Nov 17 2006 - * Quincey Koziol * * Purpose: Object header debugging routines. * @@ -75,9 +72,6 @@ * * Return: SUCCEED (Doesn't fail, just crashes) * - * Programmer: Quincey Koziol - * Oct 17 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -109,24 +103,23 @@ H5O__assert(const H5O_t *oh) free_space += oh->chunk[u].gap; /* Check for valid raw data image */ - HDassert(oh->chunk[u].image); - HDassert(oh->chunk[u].size > (size_t)H5O_SIZEOF_CHKHDR_OH(oh)); + assert(oh->chunk[u].image); + assert(oh->chunk[u].size > (size_t)H5O_SIZEOF_CHKHDR_OH(oh)); /* All chunks must be allocated on disk */ - HDassert(H5F_addr_defined(oh->chunk[u].addr)); + assert(H5_addr_defined(oh->chunk[u].addr)); /* Version specific checks */ if (oh->version > H5O_VERSION_1) { /* Make certain that the magic number is correct for each chunk */ - HDassert( - !HDmemcmp(oh->chunk[u].image, (u == 0 ? H5O_HDR_MAGIC : H5O_CHK_MAGIC), H5_SIZEOF_MAGIC)); + assert(!memcmp(oh->chunk[u].image, (u == 0 ? H5O_HDR_MAGIC : H5O_CHK_MAGIC), H5_SIZEOF_MAGIC)); /* Check for valid gap size */ - HDassert(oh->chunk[u].gap < (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); + assert(oh->chunk[u].gap < (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); } /* end if */ else /* Gaps should never occur in version 1 of the format */ - HDassert(oh->chunk[u].gap == 0); + assert(oh->chunk[u].gap == 0); } /* end for */ /* Check for correct chunk #0 size flags */ @@ -134,13 +127,13 @@ H5O__assert(const H5O_t *oh) uint64_t chunk0_size = oh->chunk[0].size - (size_t)H5O_SIZEOF_HDR(oh); if (chunk0_size <= 255) - HDassert((oh->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_1); + assert((oh->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_1); else if (chunk0_size <= 65535) - HDassert((oh->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_2); + assert((oh->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_2); else if (chunk0_size <= 4294967295) - HDassert((oh->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_4); + assert((oh->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_4); else - HDassert((oh->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_8); + assert((oh->flags & H5O_HDR_CHUNK0_SIZE) == H5O_HDR_CHUNK0_8); } /* end if */ /* Loop over all messages in object header */ @@ -158,7 +151,7 @@ H5O__assert(const H5O_t *oh) H5O_cont_t *cont = (H5O_cont_t *)curr_msg->native; hbool_t H5_ATTR_NDEBUG_UNUSED found_chunk = FALSE; /* Found a chunk that matches */ - HDassert(cont); + assert(cont); /* Increment # of continuation messages found */ cont_msgs_found++; @@ -166,13 +159,13 @@ H5O__assert(const H5O_t *oh) /* Sanity check that every continuation message has a matching chunk */ /* (and only one) */ for (v = 0; v < oh->nchunks; v++) { - if (H5F_addr_eq(cont->addr, oh->chunk[v].addr) && cont->size == oh->chunk[v].size) { - HDassert(cont->chunkno == v); - HDassert(!found_chunk); + if (H5_addr_eq(cont->addr, oh->chunk[v].addr) && cont->size == oh->chunk[v].size) { + assert(cont->chunkno == v); + assert(!found_chunk); found_chunk = TRUE; } /* end if */ } /* end for */ - HDassert(found_chunk); + assert(found_chunk); meta_space += curr_tot_size; } /* end if */ @@ -181,42 +174,42 @@ H5O__assert(const H5O_t *oh) mesg_space += curr_msg->raw_size; /* Make sure the message has a native form if it is marked dirty */ - HDassert(curr_msg->native || !curr_msg->dirty); + assert(curr_msg->native || !curr_msg->dirty); } /* end else */ /* Make certain that the message is in a valid chunk */ - HDassert(curr_msg->chunkno < oh->nchunks); + assert(curr_msg->chunkno < oh->nchunks); /* Make certain null messages aren't in chunks with gaps */ if (H5O_NULL_ID == curr_msg->type->id) - HDassert(oh->chunk[curr_msg->chunkno].gap == 0); + assert(oh->chunk[curr_msg->chunkno].gap == 0); /* Make certain that the message is completely in a chunk message area */ - HDassert(curr_tot_size <= (oh->chunk[curr_msg->chunkno].size) - - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[curr_msg->chunkno].gap)); + assert(curr_tot_size <= (oh->chunk[curr_msg->chunkno].size) - + (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[curr_msg->chunkno].gap)); if (curr_msg->chunkno == 0) - HDassert(curr_hdr >= - oh->chunk[curr_msg->chunkno].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); + assert(curr_hdr >= + oh->chunk[curr_msg->chunkno].image + (H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); else - HDassert(curr_hdr >= oh->chunk[curr_msg->chunkno].image + - (H5O_SIZEOF_CHKHDR_OH(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); - HDassert(curr_msg->raw + curr_msg->raw_size <= - (oh->chunk[curr_msg->chunkno].image + oh->chunk[curr_msg->chunkno].size) - - (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[curr_msg->chunkno].gap)); + assert(curr_hdr >= oh->chunk[curr_msg->chunkno].image + + (H5O_SIZEOF_CHKHDR_OH(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); + assert(curr_msg->raw + curr_msg->raw_size <= + (oh->chunk[curr_msg->chunkno].image + oh->chunk[curr_msg->chunkno].size) - + (H5O_SIZEOF_CHKSUM_OH(oh) + oh->chunk[curr_msg->chunkno].gap)); /* Make certain that no other messages overlap this message */ for (v = 0, tmp_msg = &oh->mesg[0]; v < oh->nmesgs; v++, tmp_msg++) { if (u != v) - HDassert(!((tmp_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh)) >= curr_hdr && - (tmp_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh)) < (curr_hdr + curr_tot_size))); + assert(!((tmp_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh)) >= curr_hdr && + (tmp_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh)) < (curr_hdr + curr_tot_size))); } /* end for */ } /* end for */ /* Sanity check that the # of cont. messages is correct for the # of chunks */ - HDassert(oh->nchunks == (cont_msgs_found + 1)); + assert(oh->nchunks == (cont_msgs_found + 1)); /* Sanity check that all the bytes are accounted for */ - HDassert(hdr_size == (free_space + meta_space + mesg_space)); + assert(hdr_size == (free_space + meta_space + mesg_space)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__assert() */ @@ -230,9 +223,6 @@ H5O__assert(const H5O_t *oh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Feb 13 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -244,19 +234,19 @@ H5O_debug_id(unsigned type_id, H5F_t *f, const void *mesg, FILE *stream, int ind FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(type->debug); - HDassert(f); - HDassert(mesg); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(type); + assert(type->debug); + assert(f); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Call the debug method in the class */ if ((ret_value = (type->debug)(f, mesg, stream, indent, fwidth)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "unable to debug message") + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "unable to debug message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -269,9 +259,6 @@ H5O_debug_id(unsigned type_id, H5F_t *f, const void *mesg, FILE *stream, int ind * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -285,36 +272,35 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(oh); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* debug */ - HDfprintf(stream, "%*sObject Header...\n", indent, ""); + fprintf(stream, "%*sObject Header...\n", indent, ""); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Dirty:", oh->cache_info.is_dirty ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", oh->version); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Header size (in bytes):", (unsigned)H5O_SIZEOF_HDR(oh)); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of links:", oh->nlink); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Dirty:", oh->cache_info.is_dirty ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", oh->version); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Header size (in bytes):", (unsigned)H5O_SIZEOF_HDR(oh)); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of links:", oh->nlink); /* Extra information for later versions */ if (oh->version > H5O_VERSION_1) { /* Display object's status flags */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute creation order tracked:", - (oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? "Yes" : "No"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute creation order indexed:", - (oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? "Yes" : "No"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute storage phase change values:", - (oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) ? "Non-default" : "Default"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Timestamps:", (oh->flags & H5O_HDR_STORE_TIMES) ? "Enabled" : "Disabled"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute creation order tracked:", + (oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? "Yes" : "No"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute creation order indexed:", + (oh->flags & H5O_HDR_ATTR_CRT_ORDER_INDEXED) ? "Yes" : "No"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Attribute storage phase change values:", + (oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) ? "Non-default" : "Default"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Timestamps:", (oh->flags & H5O_HDR_STORE_TIMES) ? "Enabled" : "Disabled"); if (oh->flags & ~H5O_HDR_ALL_FLAGS) - HDfprintf(stream, "*** UNKNOWN OBJECT HEADER STATUS FLAG: %02x!\n", (unsigned)oh->flags); + fprintf(stream, "*** UNKNOWN OBJECT HEADER STATUS FLAG: %02x!\n", (unsigned)oh->flags); /* Only dump times, if they are tracked */ if (oh->flags & H5O_HDR_STORE_TIMES) { @@ -324,45 +310,45 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int /* Time fields */ tm = HDlocaltime(&oh->atime); HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Access Time:", buf); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Access Time:", buf); tm = HDlocaltime(&oh->mtime); HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Modification Time:", buf); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Modification Time:", buf); tm = HDlocaltime(&oh->ctime); HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Change Time:", buf); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Change Time:", buf); tm = HDlocaltime(&oh->btime); HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Birth Time:", buf); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Birth Time:", buf); } /* end if */ /* Attribute tracking fields */ if (oh->flags & H5O_HDR_ATTR_STORE_PHASE_CHANGE) { - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Max. compact attributes:", (unsigned)oh->max_compact); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Min. dense attributes:", (unsigned)oh->min_dense); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Max. compact attributes:", (unsigned)oh->max_compact); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Min. dense attributes:", (unsigned)oh->min_dense); } /* end if */ } /* end if */ - HDfprintf(stream, "%*s%-*s %zu (%zu)\n", indent, "", fwidth, - "Number of messages (allocated):", oh->nmesgs, oh->alloc_nmesgs); - HDfprintf(stream, "%*s%-*s %zu (%zu)\n", indent, "", fwidth, "Number of chunks (allocated):", oh->nchunks, - oh->alloc_nchunks); + fprintf(stream, "%*s%-*s %zu (%zu)\n", indent, "", fwidth, "Number of messages (allocated):", oh->nmesgs, + oh->alloc_nmesgs); + fprintf(stream, "%*s%-*s %zu (%zu)\n", indent, "", fwidth, "Number of chunks (allocated):", oh->nchunks, + oh->alloc_nchunks); /* debug each chunk */ for (i = 0, chunk_total = 0; i < oh->nchunks; i++) { size_t chunk_size; - HDfprintf(stream, "%*sChunk %d...\n", indent, "", i); + fprintf(stream, "%*sChunk %d...\n", indent, "", i); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3), - "Address:", oh->chunk[i].addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", MAX(0, fwidth - 3), + "Address:", oh->chunk[i].addr); /* Decrement chunk 0's size by the object header prefix size */ if (0 == i) { - if (H5F_addr_ne(oh->chunk[i].addr, addr)) - HDfprintf(stream, "*** WRONG ADDRESS FOR CHUNK #0!\n"); + if (H5_addr_ne(oh->chunk[i].addr, addr)) + fprintf(stream, "*** WRONG ADDRESS FOR CHUNK #0!\n"); chunk_size = oh->chunk[i].size - (size_t)H5O_SIZEOF_HDR(oh); } /* end if */ else @@ -372,14 +358,14 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int chunk_total += chunk_size; gap_total += oh->chunk[i].gap; - HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Size in bytes:", chunk_size); + fprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Size in bytes:", chunk_size); - HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Gap:", oh->chunk[i].gap); + fprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), "Gap:", oh->chunk[i].gap); } /* end for */ /* debug each message */ if (NULL == (sequence = (unsigned *)H5MM_calloc(NELMTS(H5O_msg_class_g) * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); for (i = 0, mesg_total = 0; i < oh->nmesgs; i++) { const H5O_msg_class_t *debug_type; /* Type of message to use for callbacks */ unsigned chunkno; /* Chunk for message */ @@ -391,21 +377,21 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int if (oh->mesg[i].type->id == H5O_CONT_ID) mesg_total += H5O_SIZEOF_CHKHDR_OH(oh); - HDfprintf(stream, "%*sMessage %d...\n", indent, "", i); + fprintf(stream, "%*sMessage %d...\n", indent, "", i); /* check for bad message id */ if (oh->mesg[i].type->id >= (int)NELMTS(H5O_msg_class_g)) { - HDfprintf(stream, "*** BAD MESSAGE ID 0x%04x\n", oh->mesg[i].type->id); + fprintf(stream, "*** BAD MESSAGE ID 0x%04x\n", oh->mesg[i].type->id); continue; } /* end if */ /* message name and size */ - HDfprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n", indent + 3, "", MAX(0, fwidth - 3), - "Message ID (sequence number):", (unsigned)(oh->mesg[i].type->id), oh->mesg[i].type->name, - sequence[oh->mesg[i].type->id]++); - HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", MAX(0, fwidth - 3), - "Dirty:", oh->mesg[i].dirty ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s ", indent + 3, "", MAX(0, fwidth - 3), "Message flags:"); + fprintf(stream, "%*s%-*s 0x%04x `%s' (%d)\n", indent + 3, "", MAX(0, fwidth - 3), + "Message ID (sequence number):", (unsigned)(oh->mesg[i].type->id), oh->mesg[i].type->name, + sequence[oh->mesg[i].type->id]++); + fprintf(stream, "%*s%-*s %s\n", indent + 3, "", MAX(0, fwidth - 3), + "Dirty:", oh->mesg[i].dirty ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s ", indent + 3, "", MAX(0, fwidth - 3), "Message flags:"); if (oh->mesg[i].flags) { hbool_t flag_printed = FALSE; @@ -417,61 +403,61 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS)); if (oh->mesg[i].flags & H5O_MSG_FLAG_CONSTANT) { - HDfprintf(stream, "%sC", (flag_printed ? ", " : "<")); + fprintf(stream, "%sC", (flag_printed ? ", " : "<")); flag_printed = TRUE; } /* end if */ if (oh->mesg[i].flags & H5O_MSG_FLAG_SHARED) { - HDfprintf(stream, "%sS", (flag_printed ? ", " : "<")); + fprintf(stream, "%sS", (flag_printed ? ", " : "<")); flag_printed = TRUE; } /* end if */ if (oh->mesg[i].flags & H5O_MSG_FLAG_DONTSHARE) { - HDfprintf(stream, "%sDS", (flag_printed ? ", " : "<")); + fprintf(stream, "%sDS", (flag_printed ? ", " : "<")); flag_printed = TRUE; } /* end if */ if (oh->mesg[i].flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE) { - HDfprintf(stream, "%sFIUW", (flag_printed ? ", " : "<")); + fprintf(stream, "%sFIUW", (flag_printed ? ", " : "<")); flag_printed = TRUE; } /* end if */ if (oh->mesg[i].flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) { - HDfprintf(stream, "%sMIU", (flag_printed ? ", " : "<")); + fprintf(stream, "%sMIU", (flag_printed ? ", " : "<")); flag_printed = TRUE; } /* end if */ if (oh->mesg[i].flags & H5O_MSG_FLAG_WAS_UNKNOWN) { - HDassert(oh->mesg[i].flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN); - HDfprintf(stream, "%sWU", (flag_printed ? ", " : "<")); + assert(oh->mesg[i].flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN); + fprintf(stream, "%sWU", (flag_printed ? ", " : "<")); flag_printed = TRUE; } /* end if */ if (oh->mesg[i].flags & H5O_MSG_FLAG_SHAREABLE) { - HDfprintf(stream, "%sSA", (flag_printed ? ", " : "<")); + fprintf(stream, "%sSA", (flag_printed ? ", " : "<")); flag_printed = TRUE; } /* end if */ if (oh->mesg[i].flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS) { - HDfprintf(stream, "%sFIUA", (flag_printed ? ", " : "<")); + fprintf(stream, "%sFIUA", (flag_printed ? ", " : "<")); flag_printed = TRUE; } /* end if */ if (!flag_printed) - HDfprintf(stream, "-"); - HDfprintf(stream, ">\n"); + fprintf(stream, "-"); + fprintf(stream, ">\n"); if (oh->mesg[i].flags & ~H5O_MSG_FLAG_BITS) - HDfprintf(stream, "%*s%-*s 0x%02x\n", indent + 3, "", MAX(0, fwidth - 3), - "*** ADDITIONAL UNKNOWN FLAGS --->", oh->mesg[i].flags & ~H5O_MSG_FLAG_BITS); + fprintf(stream, "%*s%-*s 0x%02x\n", indent + 3, "", MAX(0, fwidth - 3), + "*** ADDITIONAL UNKNOWN FLAGS --->", oh->mesg[i].flags & ~H5O_MSG_FLAG_BITS); } /* end if */ else - HDfprintf(stream, "\n"); + fprintf(stream, "\n"); - HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3), - "Chunk number:", oh->mesg[i].chunkno); + fprintf(stream, "%*s%-*s %u\n", indent + 3, "", MAX(0, fwidth - 3), + "Chunk number:", oh->mesg[i].chunkno); chunkno = oh->mesg[i].chunkno; if (chunkno >= oh->nchunks) - HDfprintf(stream, "*** BAD CHUNK NUMBER\n"); - HDfprintf(stream, "%*s%-*s (%zu, %zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3), - "Raw message data (offset, size) in chunk:", - (size_t)(oh->mesg[i].raw - oh->chunk[chunkno].image), oh->mesg[i].raw_size); + fprintf(stream, "*** BAD CHUNK NUMBER\n"); + fprintf(stream, "%*s%-*s (%zu, %zu) bytes\n", indent + 3, "", MAX(0, fwidth - 3), + "Raw message data (offset, size) in chunk:", + (size_t)(oh->mesg[i].raw - oh->chunk[chunkno].image), oh->mesg[i].raw_size); /* check the size */ if ((oh->mesg[i].raw + oh->mesg[i].raw_size > oh->chunk[chunkno].image + oh->chunk[chunkno].size) || (oh->mesg[i].raw < oh->chunk[chunkno].image)) - HDfprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n"); + fprintf(stream, "*** BAD MESSAGE RAW ADDRESS\n"); /* decode the message */ debug_type = oh->mesg[i].type; @@ -479,15 +465,15 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int H5O_LOAD_NATIVE(f, H5O_DECODEIO_NOCHANGE, oh, &oh->mesg[i], FAIL) /* print the message */ - HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Message Information:"); + fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), "Message Information:"); if (debug_type->debug && oh->mesg[i].native != NULL) (debug_type->debug)(f, oh->mesg[i].native, stream, indent + 6, MAX(0, fwidth - 6)); else - HDfprintf(stream, "%*s\n", indent + 6, ""); + fprintf(stream, "%*s\n", indent + 6, ""); } /* end for */ if ((mesg_total + gap_total) != chunk_total) - HDfprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); + fprintf(stream, "*** TOTAL SIZE DOES NOT MATCH ALLOCATED SIZE!\n"); done: /* Release resources */ @@ -504,9 +490,6 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -519,11 +502,11 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(H5_addr_defined(addr)); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Set up the object location */ loc.file = f; @@ -531,15 +514,15 @@ H5O_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth) loc.holding_file = FALSE; if (NULL == (oh = H5O_protect(&loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* debug */ if (H5O__debug_real(f, oh, addr, stream, indent, fwidth) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "debug dump call failed") + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "debug dump call failed"); done: if (oh && H5O_unprotect(&loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Odeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Odeprec.c index af88e97ab1..71edd82b02 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Odeprec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Odeprec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -34,6 +33,7 @@ #include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Opkg.h" /* Object headers */ #include "H5VLnative_private.h" /* Native VOL connector */ @@ -91,14 +91,14 @@ static herr_t H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_p static herr_t H5O__reset_info1(H5O_info1_t *oinfo) { - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR /* Reset the passed-in info struct */ - HDmemset(oinfo, 0, sizeof(H5O_info1_t)); + memset(oinfo, 0, sizeof(H5O_info1_t)); oinfo->type = H5O_TYPE_UNKNOWN; oinfo->addr = HADDR_UNDEF; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__reset_info1() */ /*------------------------------------------------------------------------- @@ -110,9 +110,6 @@ H5O__reset_info1(H5O_info1_t *oinfo) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * November 26 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -127,12 +124,12 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(oinfo2); - HDassert(op_data); + assert(oinfo2); + assert(op_data); /* Reset the legacy info struct */ if (H5O__reset_info1(&oinfo) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct"); /* Check for retrieving data model information */ dm_fields = shim_data->fields & (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS); @@ -146,7 +143,7 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, /* Deserialize VOL object token into object address */ if (H5VLnative_token_to_addr(obj_id, oinfo2->token, &oinfo.addr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); } if (shim_data->fields & H5O_INFO_TIME) { oinfo.atime = oinfo2->atime; @@ -175,7 +172,7 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier") + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier"); /* Set up VOL callback arguments */ obj_opt_args.get_native_info.fields = nat_fields; @@ -186,7 +183,7 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, /* Retrieve the object's native information */ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object"); /* Set the native fields */ if (shim_data->fields & H5O_INFO_HDR) @@ -201,7 +198,7 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, ret_value = (shim_data->real_op)(obj_id, name, &oinfo, shim_data->real_op_data); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__iterate1_adapter() */ /*------------------------------------------------------------------------- @@ -211,9 +208,6 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2, * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 21 2019 - * *------------------------------------------------------------------------- */ static herr_t @@ -226,12 +220,12 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(vol_obj); - HDassert(loc_params); + assert(vol_obj); + assert(loc_params); /* Reset the passed-in info struct */ if (H5O__reset_info1(oinfo) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct"); /* Check for retrieving data model information */ dm_fields = fields & (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS); @@ -246,14 +240,14 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf /* Retrieve the object's data model information */ if (H5VL_object_get(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object"); /* Set the data model fields */ if (fields & H5O_INFO_BASIC) { void *vol_obj_data; if (NULL == (vol_obj_data = H5VL_object_data(vol_obj))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get underlying VOL object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get underlying VOL object"); oinfo->fileno = dm_info.fileno; oinfo->type = dm_info.type; @@ -263,7 +257,7 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf if (H5VL_native_token_to_addr(vol_obj_data, loc_params->obj_type, dm_info.token, &oinfo->addr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); } /* end if */ if (fields & H5O_INFO_TIME) { oinfo->atime = dm_info.atime; @@ -291,7 +285,7 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf /* Retrieve the object's native information */ if (H5VL_object_optional(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object"); /* Set the native fields */ if (fields & H5O_INFO_HDR) @@ -336,9 +330,6 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf * Return: Success: An open object identifier * Failure: H5I_INVALID_HID * - * Programmer: James Laird - * July 14 2006 - * *------------------------------------------------------------------------- */ hid_t @@ -358,25 +349,25 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Get object type */ if ((vol_obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, - "can't determine if VOL object is native connector object") + "can't determine if VOL object is native connector object"); if (is_native_vol_obj) { /* This is a native-specific routine that requires serialization of the token */ if (H5VLnative_addr_to_token(loc_id, addr, &obj_token) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, H5I_INVALID_HID, - "can't serialize address into object token") + "can't serialize address into object token"); } /* end if */ else HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, - "H5Oopen_by_addr is only meant to be used with the native VOL connector") + "H5Oopen_by_addr is only meant to be used with the native VOL connector"); loc_params.type = H5VL_OBJECT_BY_TOKEN; loc_params.loc_data.loc_by_token.token = &obj_token; @@ -385,11 +376,11 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) /* Open the object */ if (NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object"); /* Register the object's ID */ if ((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); done: FUNC_LEAVE_API(ret_value) @@ -417,7 +408,7 @@ H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo /*out*/) /* Check args */ if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -425,11 +416,11 @@ H5Oget_info1(hid_t loc_id, H5O_info1_t *oinfo /*out*/) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Retrieve the object's information */ if (H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object"); done: FUNC_LEAVE_API(ret_value) @@ -457,15 +448,15 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, /* Check args */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string"); if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Fill out location struct */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -475,11 +466,11 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Retrieve the object's information */ if (H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object"); done: FUNC_LEAVE_API(ret_value) @@ -494,9 +485,6 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * November 26 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -512,17 +500,17 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Check args */ if (!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); loc_params.type = H5VL_OBJECT_BY_IDX; loc_params.loc_data.loc_by_idx.name = group_name; @@ -534,11 +522,11 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Retrieve the object's information */ if (H5O__get_info_old(vol_obj, &loc_params, oinfo, H5O_INFO_ALL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object"); done: FUNC_LEAVE_API(ret_value) @@ -553,9 +541,6 @@ H5Oget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H * * Return: SUCCEED/FAIL * - * Programmer: Neil Fortner - * July 7 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -571,9 +556,9 @@ H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo /*out*/, unsigned fields) /* Check args */ if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL"); if (fields & ~H5O_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Set location struct fields */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -581,19 +566,19 @@ H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo /*out*/, unsigned fields) /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, - "can't determine if VOL object is native connector object") + "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, - "H5Oget_info2 is only meant to be used with the native VOL connector") + "H5Oget_info2 is only meant to be used with the native VOL connector"); /* Retrieve deprecated info struct */ if (H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object"); done: FUNC_LEAVE_API(ret_value) @@ -608,9 +593,6 @@ H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo /*out*/, unsigned fields) * * Return: SUCCEED/FAIL * - * Programmer: Neil Fortner - * July 7 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -627,17 +609,17 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, /* Check args */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string"); if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "oinfo parameter cannot be NULL"); if (fields & ~H5O_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Fill out location struct */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -647,19 +629,19 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, - "can't determine if VOL object is native connector object") + "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, - "H5Oget_info_by_name2 is only meant to be used with the native VOL connector") + "H5Oget_info_by_name2 is only meant to be used with the native VOL connector"); /* Retrieve deprecated info struct */ if (H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object"); done: FUNC_LEAVE_API(ret_value) @@ -676,9 +658,6 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * November 26 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -695,19 +674,19 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Check args */ if (!group_name || !*group_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!oinfo) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct"); if (fields & ~H5O_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); loc_params.type = H5VL_OBJECT_BY_IDX; loc_params.loc_data.loc_by_idx.name = group_name; @@ -719,19 +698,19 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, - "can't determine if VOL object is native connector object") + "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, - "H5Oget_info_by_idx2 is only meant to be used with the native VOL connector") + "H5Oget_info_by_idx2 is only meant to be used with the native VOL connector"); /* Retrieve deprecated info struct */ if (H5O__get_info_old(vol_obj, &loc_params, oinfo, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get deprecated info for object"); done: FUNC_LEAVE_API(ret_value) @@ -764,9 +743,6 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 25 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -783,15 +759,15 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1 /* Check args */ if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified"); /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -813,7 +789,7 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1 /* Visit the objects */ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed"); done: FUNC_LEAVE_API(ret_value) @@ -846,9 +822,6 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1 * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 24 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -866,23 +839,23 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it /* Check args */ if (!obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL"); if (!*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -906,7 +879,7 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it /* Visit the objects */ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed"); done: FUNC_LEAVE_API(ret_value) @@ -942,9 +915,6 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 25 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -963,25 +933,25 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1 /* Check args */ if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified"); if (fields & ~H5O_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, - "can't determine if VOL object is native connector object") + "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, - "H5Ovisit2 is only meant to be used with the native VOL connector") + "H5Ovisit2 is only meant to be used with the native VOL connector"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -1003,7 +973,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1 /* Visit the objects */ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed"); done: FUNC_LEAVE_API(ret_value) @@ -1039,9 +1009,6 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1 * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 24 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1060,33 +1027,33 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it /* Check args */ if (!obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be NULL"); if (!*obj_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj_name parameter cannot be an empty string"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); if (!op) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified"); if (fields & ~H5O_INFO_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the location object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Check if the VOL object is a native VOL connector object */ if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, - "can't determine if VOL object is native connector object") + "can't determine if VOL object is native connector object"); if (!is_native_vol_obj) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, H5I_INVALID_HID, - "H5Ovisit_by_name2 is only meant to be used with the native VOL connector") + "H5Ovisit_by_name2 is only meant to be used with the native VOL connector"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -1110,7 +1077,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it /* Visit the objects */ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Odrvinfo.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Odrvinfo.c index ffa1cee1fb..36a1ba5093 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Odrvinfo.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Odrvinfo.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,11 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Thursday, March 1, 2007 - * - * Purpose: A message holding driver info settings - * in the superblock extension. +/* + * Purpose: A message holding driver info settings in the superblock extension */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ @@ -61,63 +57,71 @@ const H5O_msg_class_t H5O_MSG_DRVINFO[1] = {{ #define H5O_DRVINFO_VERSION 0 /*------------------------------------------------------------------------- - * Function: H5O__drvinfo_decode + * Function: H5O__drvinfo_decode * - * Purpose: Decode a shared message table message and return a pointer + * Purpose: Decode a shared message table message and return a pointer * to a newly allocated H5O_drvinfo_t struct. * - * Return: Success: Ptr to new message in native struct. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Mar 1, 2007 - * + * Return: Success: Pointer to new message in native struct + * Failure: NULL *------------------------------------------------------------------------- */ static void * H5O__drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, - unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, - size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, + const uint8_t *p) { - H5O_drvinfo_t *mesg; /* Native message */ - void *ret_value = NULL; /* Return value */ + H5O_drvinfo_t *mesg = NULL; /* Native message */ + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); /* Version of message */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (*p++ != H5O_DRVINFO_VERSION) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message"); /* Allocate space for message */ if (NULL == (mesg = (H5O_drvinfo_t *)H5MM_calloc(sizeof(H5O_drvinfo_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info message") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info message"); /* Retrieve driver name */ + if (H5_IS_BUFFER_OVERFLOW(p, 8, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5MM_memcpy(mesg->name, p, 8); mesg->name[8] = '\0'; p += 8; /* Decode buffer size */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, mesg->len); - HDassert(mesg->len); + if (0 == mesg->len) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "message length can't be zero"); /* Allocate space for buffer */ - if (NULL == (mesg->buf = (uint8_t *)H5MM_malloc(mesg->len))) { - mesg = (H5O_drvinfo_t *)H5MM_xfree(mesg); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info buffer") - } /* end if */ + if (NULL == (mesg->buf = (uint8_t *)H5MM_malloc(mesg->len))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info buffer"); /* Copy encoded driver info into buffer */ + if (H5_IS_BUFFER_OVERFLOW(p, mesg->len, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5MM_memcpy(mesg->buf, p, mesg->len); /* Set return value */ ret_value = (void *)mesg; done: + if (!ret_value && mesg) { + H5MM_xfree(mesg->buf); + H5MM_xfree(mesg); + } + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__drvinfo_decode() */ @@ -128,9 +132,6 @@ H5O__drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 1, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -142,15 +143,15 @@ H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); - HDassert(p); - HDassert(mesg); + assert(f); + assert(p); + assert(mesg); /* Store version, driver name, buffer length, & encoded buffer */ *p++ = H5O_DRVINFO_VERSION; H5MM_memcpy(p, mesg->name, 8); p += 8; - HDassert(mesg->len <= 65535); + assert(mesg->len <= 65535); UINT16ENCODE(p, mesg->len); H5MM_memcpy(p, mesg->buf, mesg->len); @@ -166,9 +167,6 @@ H5O__drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shar * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: Quincey Koziol - * Mar 1, 2007 - * *------------------------------------------------------------------------- */ static void * @@ -181,11 +179,11 @@ H5O__drvinfo_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(mesg); + assert(mesg); if (!dest && NULL == (dest = (H5O_drvinfo_t *)H5MM_malloc(sizeof(H5O_drvinfo_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for shared message table message") + "memory allocation failed for shared message table message"); /* Shallow copy the fields */ *dest = *mesg; @@ -194,7 +192,7 @@ H5O__drvinfo_copy(const void *_mesg, void *_dest) if (NULL == (dest->buf = (uint8_t *)H5MM_malloc(mesg->len))) { if (dest != _dest) dest = (H5O_drvinfo_t *)H5MM_xfree(dest); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } /* end if */ H5MM_memcpy(dest->buf, mesg->buf, mesg->len); @@ -214,9 +212,6 @@ H5O__drvinfo_copy(const void *_mesg, void *_dest) * Return: Success: Message data size in bytes w/o alignment. * Failure: 0 * - * Programmer: Quincey Koziol - * Mar 1, 2007 - * *------------------------------------------------------------------------- */ static size_t @@ -228,8 +223,8 @@ H5O__drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_ FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); - HDassert(mesg); + assert(f); + assert(mesg); ret_value = 1 + /* Version number */ 8 + /* Driver name */ @@ -247,9 +242,6 @@ H5O__drvinfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 1 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -260,7 +252,7 @@ H5O__drvinfo_reset(void *_mesg) FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(mesg); + assert(mesg); /* reset */ mesg->buf = (uint8_t *)H5MM_xfree(mesg->buf); @@ -275,9 +267,6 @@ H5O__drvinfo_reset(void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 1, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -288,14 +277,14 @@ H5O__drvinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); - HDassert(mesg); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Driver name:", mesg->name); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Buffer size:", mesg->len); + assert(f); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Driver name:", mesg->name); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Buffer size:", mesg->len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__drvinfo_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Odtype.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Odtype.c index 6a13f5208b..48622e2802 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Odtype.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Odtype.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -71,7 +70,7 @@ static herr_t H5O__dtype_debug(H5F_t *f, const void *_mesg, FILE *stream, int in * because in that case we are either debugging or deleting the object header */ #define H5O_DTYPE_CHECK_VERSION(DT, VERS, MIN_VERS, IOF, CLASS, ERR) \ if (((VERS) < (MIN_VERS)) && !(*(IOF)&H5O_DECODEIO_NOCHANGE)) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, ERR, "incorrect " CLASS " datatype version") + HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, ERR, "incorrect " CLASS " datatype version"); #else /* H5_STRICT_FORMAT_CHECKS */ /* If the version is too low and we are allowed to change the message, upgrade * it and mark the object header as dirty */ @@ -79,7 +78,7 @@ static herr_t H5O__dtype_debug(H5F_t *f, const void *_mesg, FILE *stream, int in if (((VERS) < (MIN_VERS)) && !(*(IOF)&H5O_DECODEIO_NOCHANGE)) { \ (VERS) = (MIN_VERS); \ if (H5T__upgrade_version((DT), (VERS)) < 0) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade " CLASS " encoding version") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade " CLASS " encoding version"); \ *(IOF) |= H5O_DECODEIO_DIRTY; \ } /* end if */ #endif /* H5_STRICT_FORMAT_CHECKS */ @@ -109,46 +108,63 @@ const H5O_msg_class_t H5O_MSG_DTYPE[1] = {{ }}; /*------------------------------------------------------------------------- - * Function: H5O__dtype_decode_helper + * Function: H5O__dtype_decode_helper * - * Purpose: Decodes a datatype + * Purpose: Decodes a datatype * - * Return: TRUE if we can upgrade the parent type's version even + * Return: TRUE if we can upgrade the parent type's version even * with strict format checks * FALSE if we cannot - * Negative on failure - * - * Programmer: Robb Matzke - * Monday, December 8, 1997 - * + * NEGATIVE on failure *------------------------------------------------------------------------- */ static htri_t -H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t *dt) +H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t *dt, hbool_t skip, + const uint8_t *p_end) { - unsigned flags, version; - unsigned i; - size_t z; - htri_t ret_value = FALSE; /* Return value */ + unsigned flags; + unsigned version; + htri_t ret_value = FALSE; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(pp && *pp); - HDassert(dt && dt->shared); + assert(pp && *pp); + assert(dt && dt->shared); + + /* XXX NOTE! + * + * H5Tencode() does not take a buffer size, so normal bounds checking in + * that case is impossible. + * + * Instead of using our normal H5_IS_BUFFER_OVERFLOW macro, use + * H5_IS_KNOWN_BUFFER_OVERFLOW, which will skip the check when the + * we're decoding a buffer from H5Tconvert(). + * + * Even if this is fixed at some point in the future, as long as we + * support the old, size-less API call, we will need to use the modified + * macros. + */ /* Version, class & flags */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT32DECODE(*pp, flags); version = (flags >> 4) & 0x0f; if (version < H5O_DTYPE_VERSION_1 || version > H5O_DTYPE_VERSION_LATEST) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "bad version number for datatype message") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "bad version number for datatype message"); dt->shared->version = version; dt->shared->type = (H5T_class_t)(flags & 0x0f); flags >>= 8; /* Size */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT32DECODE(*pp, dt->shared->size); + /* Check for invalid datatype size */ + if (dt->shared->size == 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "invalid datatype size"); + switch (dt->shared->type) { case H5T_INTEGER: /* @@ -158,6 +174,8 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t dt->shared->u.atomic.lsb_pad = (flags & 0x2) ? H5T_PAD_ONE : H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = (flags & 0x4) ? H5T_PAD_ONE : H5T_PAD_ZERO; dt->shared->u.atomic.u.i.sign = (flags & 0x8) ? H5T_SGN_2 : H5T_SGN_NONE; + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 2 + 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT16DECODE(*pp, dt->shared->u.atomic.offset); UINT16DECODE(*pp, dt->shared->u.atomic.prec); break; @@ -170,12 +188,12 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t if (version >= H5O_DTYPE_VERSION_3) { /* Unsupported byte order*/ if ((flags & 0x40) && !(flags & 0x1)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "bad byte order for datatype message") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "bad byte order for datatype message"); /* VAX order if both 1st and 6th bits are turned on*/ if (flags & 0x40) dt->shared->u.atomic.order = H5T_ORDER_VAX; - } /* end if */ + } dt->shared->u.atomic.lsb_pad = (flags & 0x2) ? H5T_PAD_ONE : H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = (flags & 0x4) ? H5T_PAD_ONE : H5T_PAD_ZERO; dt->shared->u.atomic.u.f.pad = (flags & 0x8) ? H5T_PAD_ONE : H5T_PAD_ZERO; @@ -193,22 +211,41 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown floating-point normalization") - } /* end switch */ + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown floating-point normalization"); + } dt->shared->u.atomic.u.f.sign = (flags >> 8) & 0xff; + + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 2 + 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT16DECODE(*pp, dt->shared->u.atomic.offset); UINT16DECODE(*pp, dt->shared->u.atomic.prec); + + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 1 + 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); dt->shared->u.atomic.u.f.epos = *(*pp)++; dt->shared->u.atomic.u.f.esize = *(*pp)++; - HDassert(dt->shared->u.atomic.u.f.esize > 0); + if (dt->shared->u.atomic.u.f.esize == 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "exponent size can't be zero"); + + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 1 + 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); dt->shared->u.atomic.u.f.mpos = *(*pp)++; dt->shared->u.atomic.u.f.msize = *(*pp)++; - HDassert(dt->shared->u.atomic.u.f.msize > 0); + if (dt->shared->u.atomic.u.f.msize == 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "mantissa size can't be zero"); + + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT32DECODE(*pp, dt->shared->u.atomic.u.f.ebias); break; - case H5T_TIME: /* Time datatypes */ + case H5T_TIME: + /* + * Time datatypes... + */ dt->shared->u.atomic.order = (flags & 0x1) ? H5T_ORDER_BE : H5T_ORDER_LE; + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT16DECODE(*pp, dt->shared->u.atomic.prec); break; @@ -233,29 +270,42 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t dt->shared->u.atomic.order = (flags & 0x1) ? H5T_ORDER_BE : H5T_ORDER_LE; dt->shared->u.atomic.lsb_pad = (flags & 0x2) ? H5T_PAD_ONE : H5T_PAD_ZERO; dt->shared->u.atomic.msb_pad = (flags & 0x4) ? H5T_PAD_ONE : H5T_PAD_ZERO; + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 2 + 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); UINT16DECODE(*pp, dt->shared->u.atomic.offset); UINT16DECODE(*pp, dt->shared->u.atomic.prec); break; - case H5T_OPAQUE: + case H5T_OPAQUE: { + size_t z; + /* * Opaque types... */ + + /* The opaque tag flag field must be aligned */ z = flags & (H5T_OPAQUE_TAG_MAX - 1); - HDassert(0 == (z & 0x7)); /*must be aligned*/ + if (0 != (z & 0x7)) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "opaque flag field must be aligned"); + if (NULL == (dt->shared->u.opaque.tag = (char *)H5MM_malloc(z + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, z, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); H5MM_memcpy(dt->shared->u.opaque.tag, *pp, z); dt->shared->u.opaque.tag[z] = '\0'; + *pp += z; break; + } case H5T_COMPOUND: { + unsigned nmembs; /* Number of compound members */ unsigned offset_nbytes; /* Size needed to encode member offsets */ size_t max_memb_pos = 0; /* Maximum member covered, so far */ unsigned max_version = 0; /* Maximum member version */ unsigned upgrade_to = 0; /* Version number we can "soft" upgrade to */ - unsigned j; /* Compute the # of bytes required to store a member offset */ offset_nbytes = H5VM_limit_enc_size((uint64_t)dt->shared->size); @@ -263,76 +313,147 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t /* * Compound datatypes... */ - dt->shared->u.compnd.nmembs = flags & 0xffff; - if (dt->shared->u.compnd.nmembs == 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid number of members: %u", - dt->shared->u.compnd.nmembs) - dt->shared->u.compnd.nalloc = dt->shared->u.compnd.nmembs; - dt->shared->u.compnd.memb = - (H5T_cmemb_t *)H5MM_calloc(dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t)); - dt->shared->u.compnd.memb_size = 0; - if (NULL == dt->shared->u.compnd.memb) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed") - for (i = 0; i < dt->shared->u.compnd.nmembs; i++) { - unsigned ndims = 0; /* Number of dimensions of the array field */ - htri_t can_upgrade; /* Whether we can upgrade this type's version */ - hsize_t dim[H5O_LAYOUT_NDIMS]; /* Dimensions of the array */ - H5T_t *array_dt; /* Temporary pointer to the array datatype */ - H5T_t *temp_type; /* Temporary pointer to the field's datatype */ + nmembs = flags & 0xffff; + if (nmembs == 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid number of members: %u", nmembs); + if (NULL == + (dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_calloc(nmembs * sizeof(H5T_cmemb_t)))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed"); + dt->shared->u.compnd.nalloc = nmembs; + + if (dt->shared->u.compnd.memb_size != 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "member size not initialized to zero"); + + for (dt->shared->u.compnd.nmembs = 0; dt->shared->u.compnd.nmembs < nmembs; + dt->shared->u.compnd.nmembs++) { + + size_t actual_name_length = 0; /* Actual length of name */ + unsigned ndims = 0; /* Number of dimensions of the array field */ + htri_t can_upgrade; /* Whether we can upgrade this type's version */ + hsize_t dim[H5O_LAYOUT_NDIMS]; /* Dimensions of the array */ + H5T_t *array_dt; /* Temporary pointer to the array datatype */ + H5T_t *temp_type; /* Temporary pointer to the field's datatype */ + + /* Get the length of the field name */ + if (!skip) { + /* There is a realistic buffer end, so check bounds */ + + size_t max = (size_t)(p_end - *pp + 1); /* Max possible name length */ + + actual_name_length = HDstrnlen((const char *)*pp, max); + if (actual_name_length == max) + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "field name not null terminated"); + } + else { + /* The buffer end can't be determined when it's an unbounded buffer + * passed via H5Tdecode(), so don't bounds check and hope for + * the best. + */ + actual_name_length = HDstrlen((const char *)*pp); + } + + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, actual_name_length, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); /* Decode the field name */ - dt->shared->u.compnd.memb[i].name = H5MM_xstrdup((const char *)*pp); + if (NULL == (dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name = + H5MM_xstrdup((const char *)*pp))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, + "can't duplicate compound member name string"); /* Version 3 of the datatype message eliminated the padding to multiple of 8 bytes */ - if (version >= H5O_DTYPE_VERSION_3) + if (version >= H5O_DTYPE_VERSION_3) { /* Advance past name, including null terminator */ - *pp += HDstrlen((const char *)*pp) + 1; - else + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, actual_name_length + 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); + *pp += actual_name_length + 1; + } + else { /* Advance multiple of 8 w/ null terminator */ - *pp += ((HDstrlen((const char *)*pp) + 8) / 8) * 8; + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, ((actual_name_length + 8) / 8) * 8, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); + *pp += ((actual_name_length + 8) / 8) * 8; + } /* Decode the field offset */ /* (starting with version 3 of the datatype message, use the minimum # of bytes required) */ - if (version >= H5O_DTYPE_VERSION_3) - UINT32DECODE_VAR(*pp, dt->shared->u.compnd.memb[i].offset, offset_nbytes) - else - UINT32DECODE(*pp, dt->shared->u.compnd.memb[i].offset) + if (version >= H5O_DTYPE_VERSION_3) { + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, offset_nbytes, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); + UINT32DECODE_VAR(*pp, dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].offset, + offset_nbytes); + } + else { + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); + UINT32DECODE(*pp, dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].offset); + } /* Older versions of the library allowed a field to have * intrinsic 'arrayness'. Newer versions of the library * use the separate array datatypes. */ if (version == H5O_DTYPE_VERSION_1) { /* Decode the number of dimensions */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); ndims = *(*pp)++; /* Check that ndims is valid */ - if (ndims > 4) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid number of dimensions for array") + if (ndims > 4) { + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name = + H5MM_xfree(dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, + "invalid number of dimensions for array"); + } - *pp += 3; /*reserved bytes */ + /* Skip reserved bytes */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 3, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); + *pp += 3; /* Skip dimension permutation */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); *pp += 4; /* Skip reserved bytes */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); *pp += 4; /* Decode array dimension sizes */ - for (j = 0; j < 4; j++) - UINT32DECODE(*pp, dim[j]); - } /* end if */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, (4 * 4), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); + for (int i = 0; i < 4; i++) + UINT32DECODE(*pp, dim[i]); + } /* Allocate space for the field's datatype */ - if (NULL == (temp_type = H5T__alloc())) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + if (NULL == (temp_type = H5T__alloc())) { + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name = + H5MM_xfree(dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + } /* Decode the field's datatype information */ - if ((can_upgrade = H5O__dtype_decode_helper(ioflags, pp, temp_type)) < 0) { - for (j = 0; j <= i; j++) - H5MM_xfree(dt->shared->u.compnd.memb[j].name); - H5MM_xfree(dt->shared->u.compnd.memb); - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode member type") - } /* end if */ + if ((can_upgrade = H5O__dtype_decode_helper(ioflags, pp, temp_type, skip, p_end)) < 0) { + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name = + H5MM_xfree(dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name); + if (H5T_close_real(temp_type) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't release datatype info"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode member type"); + } + if (temp_type->shared->size == 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "type size can't be zero"); /* Upgrade the version if we can and it is necessary */ if (can_upgrade && temp_type->shared->version > version) { @@ -340,7 +461,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t /* Pass "can_upgrade" flag down to parent type */ ret_value = TRUE; - } /* end if */ + } /* Go create the array datatype now, for older versions of the datatype message */ if (version == H5O_DTYPE_VERSION_1) { @@ -348,15 +469,21 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t if (ndims > 0) { /* Create the array datatype for the field */ if ((array_dt = H5T__array_create(temp_type, ndims, dim)) == NULL) { - for (j = 0; j <= i; j++) - H5MM_xfree(dt->shared->u.compnd.memb[j].name); - H5MM_xfree(dt->shared->u.compnd.memb); + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name = + H5MM_xfree(dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name); + if (H5T_close_real(temp_type) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, + "can't release datatype info"); HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, - "unable to create array datatype") - } /* end if */ + "unable to create array datatype"); + } /* Close the base type for the array */ - (void)H5T_close_real(temp_type); + if (H5T_close_real(temp_type) < 0) { + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name = + H5MM_xfree(dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].name); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't release datatype info"); + } /* Make the array type the type that is set for the field */ temp_type = array_dt; @@ -372,43 +499,51 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t /* Set the return value to indicate that we should freely * upgrade parent types */ ret_value = TRUE; - } /* end else */ - } /* end if */ - } /* end if */ + } + } + } /* Keep track of the maximum member version found */ if (temp_type->shared->version > max_version) max_version = temp_type->shared->version; - /* - * Set the "force conversion" flag if VL datatype fields exist in this + /* Set the "force conversion" flag if VL datatype fields exist in this * type or any component types */ if (temp_type->shared->force_conv == TRUE) dt->shared->force_conv = TRUE; /* Member size */ - dt->shared->u.compnd.memb[i].size = temp_type->shared->size; + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].size = temp_type->shared->size; dt->shared->u.compnd.memb_size += temp_type->shared->size; /* Set the field datatype (finally :-) */ - dt->shared->u.compnd.memb[i].type = temp_type; - - /* Check if this field overlaps with a prior field */ - /* (probably indicates that the file is corrupt) */ - if (i > 0 && dt->shared->u.compnd.memb[i].offset < max_memb_pos) { - for (j = 0; j < i; j++) - if (dt->shared->u.compnd.memb[i].offset >= dt->shared->u.compnd.memb[j].offset && - dt->shared->u.compnd.memb[i].offset < - (dt->shared->u.compnd.memb[j].offset + dt->shared->u.compnd.memb[j].size)) + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].type = temp_type; + + /* Check if this field overlaps with a prior field + * (probably indicates that the file is corrupt) + */ + if (dt->shared->u.compnd.nmembs > 0 && + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].offset < max_memb_pos) { + for (unsigned u = 0; u < dt->shared->u.compnd.nmembs; u++) + if ((dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].offset >= + dt->shared->u.compnd.memb[u].offset && + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].offset < + (dt->shared->u.compnd.memb[u].offset + dt->shared->u.compnd.memb[u].size)) || + (dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].offset < + dt->shared->u.compnd.memb[u].offset && + (dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].offset + + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].size) > + dt->shared->u.compnd.memb[u].offset)) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, - "member overlaps with previous member") - } /* end if */ + "member overlaps with previous member"); + } /* Update the maximum member position covered */ - max_memb_pos = MAX(max_memb_pos, - (dt->shared->u.compnd.memb[i].offset + dt->shared->u.compnd.memb[i].size)); - } /* end for */ + max_memb_pos = + MAX(max_memb_pos, (dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].offset + + dt->shared->u.compnd.memb[dt->shared->u.compnd.nmembs].size)); + } /* Check if the compound type is packed */ H5T__update_packed(dt); @@ -417,18 +552,21 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t if (version < upgrade_to) { version = upgrade_to; if (H5T__upgrade_version(dt, upgrade_to) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade compound encoding version") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade compound encoding version"); /* We won't mark the message dirty since there were no * errors in the file, simply type versions that we will no * longer encode. */ - } /* end if */ + } /* Check that no member of this compound has a version greater * than the compound itself. */ H5O_DTYPE_CHECK_VERSION(dt, version, max_version, ioflags, "compound", FAIL) } break; - case H5T_REFERENCE: /* Reference datatypes... */ + case H5T_REFERENCE: + /* + * Reference datatypes... + */ dt->shared->u.atomic.order = H5T_ORDER_NONE; dt->shared->u.atomic.prec = 8 * dt->shared->size; dt->shared->u.atomic.offset = 0; @@ -459,61 +597,106 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t /* Mark location of this type as undefined for now. The caller * function should decide the location. */ if (H5T_set_loc(dt, NULL, H5T_LOC_BADLOC) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); break; - case H5T_ENUM: + case H5T_ENUM: { + unsigned nmembs; + /* * Enumeration datatypes... */ - dt->shared->u.enumer.nmembs = dt->shared->u.enumer.nalloc = flags & 0xffff; + nmembs = flags & 0xffff; if (NULL == (dt->shared->parent = H5T__alloc())) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode parent datatype") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate parent datatype"); + if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent, skip, p_end) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode parent datatype"); + if (dt->shared->parent->shared->size != dt->shared->size) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "ENUM datatype size does not match parent"); /* Check if the parent of this enum has a version greater than the * enum itself. */ H5O_DTYPE_CHECK_VERSION(dt, version, dt->shared->parent->shared->version, ioflags, "enum", FAIL) - if (NULL == (dt->shared->u.enumer.name = - (char **)H5MM_calloc(dt->shared->u.enumer.nalloc * sizeof(char *))) || - NULL == (dt->shared->u.enumer.value = (uint8_t *)H5MM_calloc( - dt->shared->u.enumer.nalloc * dt->shared->parent->shared->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + /* Allocate name and value arrays */ + if (NULL == (dt->shared->u.enumer.name = (char **)H5MM_calloc(nmembs * sizeof(char *))) || + NULL == (dt->shared->u.enumer.value = + (uint8_t *)H5MM_calloc(nmembs * dt->shared->parent->shared->size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed"); + dt->shared->u.enumer.nalloc = nmembs; /* Names */ - for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { - dt->shared->u.enumer.name[i] = H5MM_xstrdup((const char *)*pp); + for (dt->shared->u.enumer.nmembs = 0; dt->shared->u.enumer.nmembs < nmembs; + dt->shared->u.enumer.nmembs++) { + + size_t actual_name_length = 0; /* Actual length of name */ + + /* Get the length of the enum name */ + if (!skip) { + /* There is a realistic buffer end, so check bounds */ + + size_t max = (size_t)(p_end - *pp + 1); /* Max possible name length */ + + actual_name_length = HDstrnlen((const char *)*pp, max); + if (actual_name_length == max) + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "enum name not null terminated"); + } + else { + /* The buffer end can't be determined when it's an unbounded buffer + * passed via H5Tdecode(), so don't bounds check and hope for + * the best. + */ + actual_name_length = HDstrlen((const char *)*pp); + } + + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, actual_name_length, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + if (NULL == (dt->shared->u.enumer.name[dt->shared->u.enumer.nmembs] = + H5MM_xstrdup((const char *)*pp))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "can't duplicate enum name string"); /* Version 3 of the datatype message eliminated the padding to multiple of 8 bytes */ - if (version >= H5O_DTYPE_VERSION_3) + if (version >= H5O_DTYPE_VERSION_3) { /* Advance past name, including null terminator */ - *pp += HDstrlen((const char *)*pp) + 1; - else + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, actual_name_length + 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); + *pp += actual_name_length + 1; + } + else { /* Advance multiple of 8 w/ null terminator */ - *pp += ((HDstrlen((const char *)*pp) + 8) / 8) * 8; - } /* end for */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, ((actual_name_length + 8) / 8) * 8, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, + "ran off end of input buffer while decoding"); + *pp += ((actual_name_length + 8) / 8) * 8; + } + } + if (dt->shared->u.enumer.nmembs != nmembs) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "incorrect number of enum members decoded"); /* Values */ - H5MM_memcpy(dt->shared->u.enumer.value, *pp, - dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size); - *pp += dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size; - break; + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, nmembs * dt->shared->parent->shared->size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + H5MM_memcpy(dt->shared->u.enumer.value, *pp, nmembs * dt->shared->parent->shared->size); + *pp += nmembs * dt->shared->parent->shared->size; + } break; - case H5T_VLEN: /* Variable length datatypes... */ + case H5T_VLEN: + /* + * Variable length datatypes... + */ /* Set the type of VL information, either sequence or string */ dt->shared->u.vlen.type = (H5T_vlen_type_t)(flags & 0x0f); if (dt->shared->u.vlen.type == H5T_VLEN_STRING) { dt->shared->u.vlen.pad = (H5T_str_t)((flags >> 4) & 0x0f); dt->shared->u.vlen.cset = (H5T_cset_t)((flags >> 8) & 0x0f); - } /* end if */ + } /* Decode base type of VL information */ if (NULL == (dt->shared->parent = H5T__alloc())) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed") - if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode VL parent type") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed"); + if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent, skip, p_end) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode VL parent type"); /* Check if the parent of this vlen has a version greater than the * vlen itself. */ @@ -524,36 +707,50 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t /* Mark location this type as undefined for now. The caller function should * decide the location. */ if (H5T_set_loc(dt, NULL, H5T_LOC_BADLOC) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); break; - case H5T_ARRAY: /* Array datatypes */ + case H5T_ARRAY: + /* + * Array datatypes... + */ /* Decode the number of dimensions */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); dt->shared->u.array.ndims = *(*pp)++; /* Double-check the number of dimensions */ if (dt->shared->u.array.ndims > H5S_MAX_RANK) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "too many dimensions for array datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "too many dimensions for array datatype"); /* Skip reserved bytes, if version has them */ - if (version < H5O_DTYPE_VERSION_3) + if (version < H5O_DTYPE_VERSION_3) { + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, 3, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); *pp += 3; + } /* Decode array dimension sizes & compute number of elements */ - for (i = 0, dt->shared->u.array.nelem = 1; i < (unsigned)dt->shared->u.array.ndims; i++) { - UINT32DECODE(*pp, dt->shared->u.array.dim[i]); - dt->shared->u.array.nelem *= dt->shared->u.array.dim[i]; - } /* end for */ + dt->shared->u.array.nelem = 1; + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, (dt->shared->u.array.ndims * 4), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); + for (unsigned u = 0; u < dt->shared->u.array.ndims; u++) { + UINT32DECODE(*pp, dt->shared->u.array.dim[u]); + dt->shared->u.array.nelem *= dt->shared->u.array.dim[u]; + } /* Skip array dimension permutations, if version has them */ - if (version < H5O_DTYPE_VERSION_3) + if (version < H5O_DTYPE_VERSION_3) { + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, (dt->shared->u.array.ndims * 4), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, FAIL, "ran off end of input buffer while decoding"); *pp += dt->shared->u.array.ndims * 4; + } /* Decode base type of array */ if (NULL == (dt->shared->parent = H5T__alloc())) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed") - if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode array parent type") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "memory allocation failed"); + if (H5O__dtype_decode_helper(ioflags, pp, dt->shared->parent, skip, p_end) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "unable to decode array parent type"); /* Check if the parent of this array has a version greater than the * array itself. */ @@ -562,8 +759,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t /* There should be no array datatypes with version < 2. */ H5O_DTYPE_CHECK_VERSION(dt, version, H5O_DTYPE_VERSION_2, ioflags, "array", FAIL) - /* - * Set the "force conversion" flag if a VL base datatype is used or + /* Set the "force conversion" flag if a VL base datatype is used or * or if any components of the base datatype are VL types. */ if (dt->shared->parent->shared->force_conv == TRUE) @@ -573,18 +769,16 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t case H5T_NO_CLASS: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown datatype class found") - } /* end switch */ + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown datatype class found"); + } done: + /* Cleanup on error */ if (ret_value < 0) - if (dt != NULL) { - if (dt->shared != NULL) { - HDassert(!dt->shared->owned_vol_obj); - dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); - } /* end if */ - dt = H5FL_FREE(H5T_t, dt); - } /* end if */ + /* Release (reset) dt but do not free it - leave it as an empty datatype as was the case on + * function entry */ + if (H5T__free(dt) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't release datatype info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dtype_decode_helper() */ @@ -600,9 +794,6 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, December 8, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -617,8 +808,8 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) FUNC_ENTER_PACKAGE /* check args */ - HDassert(pp && *pp); - HDassert(dt); + assert(pp && *pp); + assert(dt); /* skip the type and class bit-field for now */ *pp += 4; @@ -643,7 +834,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "byte order is not supported in file format yet") + "byte order is not supported in file format yet"); } /* end switch */ switch (dt->shared->u.atomic.lsb_pad) { @@ -659,7 +850,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "bit padding is not supported in file format yet") + "bit padding is not supported in file format yet"); } /* end switch */ switch (dt->shared->u.atomic.msb_pad) { @@ -675,7 +866,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "bit padding is not supported in file format yet") + "bit padding is not supported in file format yet"); } /* end switch */ switch (dt->shared->u.atomic.u.i.sign) { @@ -690,7 +881,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_NSGN: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "sign scheme is not supported in file format yet") + "sign scheme is not supported in file format yet"); } /* end switch */ UINT16ENCODE(*pp, dt->shared->u.atomic.offset); @@ -711,7 +902,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_ORDER_VAX: /*turn on 1st and 6th (reserved before adding VAX) bits*/ flags |= 0x41; - HDassert(dt->shared->version >= H5O_DTYPE_VERSION_3); + assert(dt->shared->version >= H5O_DTYPE_VERSION_3); break; case H5T_ORDER_MIXED: @@ -719,7 +910,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "byte order is not supported in file format yet") + "byte order is not supported in file format yet"); } /* end switch */ switch (dt->shared->u.atomic.lsb_pad) { @@ -735,7 +926,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "bit padding is not supported in file format yet") + "bit padding is not supported in file format yet"); } /* end switch */ switch (dt->shared->u.atomic.msb_pad) { @@ -751,7 +942,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "bit padding is not supported in file format yet") + "bit padding is not supported in file format yet"); } /* end switch */ switch (dt->shared->u.atomic.u.f.pad) { @@ -767,7 +958,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "bit padding is not supported in file format yet") + "bit padding is not supported in file format yet"); } /* end switch */ switch (dt->shared->u.atomic.u.f.norm) { @@ -785,19 +976,19 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_NORM_ERROR: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "normalization scheme is not supported in file format yet") + "normalization scheme is not supported in file format yet"); } /* end switch */ flags = (unsigned)(flags | ((dt->shared->u.atomic.u.f.sign << 8) & 0xff00)); UINT16ENCODE(*pp, dt->shared->u.atomic.offset); UINT16ENCODE(*pp, dt->shared->u.atomic.prec); - HDassert(dt->shared->u.atomic.u.f.epos <= 255); + assert(dt->shared->u.atomic.u.f.epos <= 255); *(*pp)++ = (uint8_t)(dt->shared->u.atomic.u.f.epos); - HDassert(dt->shared->u.atomic.u.f.esize <= 255); + assert(dt->shared->u.atomic.u.f.esize <= 255); *(*pp)++ = (uint8_t)(dt->shared->u.atomic.u.f.esize); - HDassert(dt->shared->u.atomic.u.f.mpos <= 255); + assert(dt->shared->u.atomic.u.f.mpos <= 255); *(*pp)++ = (uint8_t)(dt->shared->u.atomic.u.f.mpos); - HDassert(dt->shared->u.atomic.u.f.msize <= 255); + assert(dt->shared->u.atomic.u.f.msize <= 255); *(*pp)++ = (uint8_t)(dt->shared->u.atomic.u.f.msize); UINT32ENCODE(*pp, dt->shared->u.atomic.u.f.ebias); break; @@ -817,7 +1008,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "byte order is not supported in file format yet") + "byte order is not supported in file format yet"); } /* end switch */ UINT16ENCODE(*pp, dt->shared->u.atomic.prec); break; @@ -826,11 +1017,11 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) /* * Character string types... (not fully implemented) */ - HDassert(dt->shared->u.atomic.order == H5T_ORDER_NONE); - HDassert(dt->shared->u.atomic.prec == 8 * dt->shared->size); - HDassert(dt->shared->u.atomic.offset == 0); - HDassert(dt->shared->u.atomic.lsb_pad == H5T_PAD_ZERO); - HDassert(dt->shared->u.atomic.msb_pad == H5T_PAD_ZERO); + assert(dt->shared->u.atomic.order == H5T_ORDER_NONE); + assert(dt->shared->u.atomic.prec == 8 * dt->shared->size); + assert(dt->shared->u.atomic.offset == 0); + assert(dt->shared->u.atomic.lsb_pad == H5T_PAD_ZERO); + assert(dt->shared->u.atomic.msb_pad == H5T_PAD_ZERO); flags = (unsigned)(flags | (dt->shared->u.atomic.u.s.pad & 0x0f)); flags = (unsigned)(flags | ((((unsigned)dt->shared->u.atomic.u.s.cset) & 0x0f) << 4)); @@ -854,7 +1045,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_ORDER_NONE: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "byte order is not supported in file format yet") + "byte order is not supported in file format yet"); } /* end switch */ switch (dt->shared->u.atomic.lsb_pad) { @@ -870,7 +1061,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "bit padding is not supported in file format yet") + "bit padding is not supported in file format yet"); } /* end switch */ switch (dt->shared->u.atomic.msb_pad) { @@ -886,7 +1077,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_NPAD: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "bit padding is not supported in file format yet") + "bit padding is not supported in file format yet"); } /* end switch */ UINT16ENCODE(*pp, dt->shared->u.atomic.offset); @@ -925,11 +1116,11 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) for (i = 0; i < dt->shared->u.compnd.nmembs; i++) { /* Sanity check */ /* (compound datatypes w/array members must be encoded w/version >= 2) */ - HDassert(dt->shared->u.compnd.memb[i].type->shared->type != H5T_ARRAY || - dt->shared->version >= H5O_DTYPE_VERSION_2); + assert(dt->shared->u.compnd.memb[i].type->shared->type != H5T_ARRAY || + dt->shared->version >= H5O_DTYPE_VERSION_2); /* Check that the version is at least as great as the member */ - HDassert(dt->shared->version >= dt->shared->u.compnd.memb[i].type->shared->version); + assert(dt->shared->version >= dt->shared->u.compnd.memb[i].type->shared->version); /* Name */ HDstrcpy((char *)(*pp), dt->shared->u.compnd.memb[i].name); @@ -948,9 +1139,9 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) /* Member offset */ /* (starting with version 3 of the datatype message, use the minimum # of bytes required) */ if (dt->shared->version >= H5O_DTYPE_VERSION_3) - UINT32ENCODE_VAR(*pp, (uint32_t)dt->shared->u.compnd.memb[i].offset, offset_nbytes) + UINT32ENCODE_VAR(*pp, (uint32_t)dt->shared->u.compnd.memb[i].offset, offset_nbytes); else - UINT32ENCODE(*pp, dt->shared->u.compnd.memb[i].offset) + UINT32ENCODE(*pp, dt->shared->u.compnd.memb[i].offset); /* If we don't have any array fields, write out the old style * member information, for better backward compatibility @@ -980,7 +1171,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) /* Subtype */ if (H5O__dtype_encode_helper(pp, dt->shared->u.compnd.memb[i].type) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode member type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode member type"); } /* end for */ } break; @@ -992,7 +1183,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_ENUM: /* Check that the version is at least as great as the parent */ - HDassert(dt->shared->version >= dt->shared->parent->shared->version); + assert(dt->shared->version >= dt->shared->parent->shared->version); /* * Enumeration datatypes... @@ -1001,7 +1192,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) /* Parent type */ if (H5O__dtype_encode_helper(pp, dt->shared->parent) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode parent datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode parent datatype"); /* Names, each a multiple of eight bytes */ for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { @@ -1028,7 +1219,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) case H5T_VLEN: /* Variable length datatypes... */ /* Check that the version is at least as great as the parent */ - HDassert(dt->shared->version >= dt->shared->parent->shared->version); + assert(dt->shared->version >= dt->shared->parent->shared->version); flags |= (dt->shared->u.vlen.type & 0x0f); if (dt->shared->u.vlen.type == H5T_VLEN_STRING) { @@ -1038,21 +1229,21 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) /* Encode base type of VL information */ if (H5O__dtype_encode_helper(pp, dt->shared->parent) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type"); break; case H5T_ARRAY: /* Array datatypes */ /* Double-check the number of dimensions */ - HDassert(dt->shared->u.array.ndims <= H5S_MAX_RANK); + assert(dt->shared->u.array.ndims <= H5S_MAX_RANK); /* Check that the version is valid */ - HDassert(dt->shared->version >= H5O_DTYPE_VERSION_2); + assert(dt->shared->version >= H5O_DTYPE_VERSION_2); /* Check that the version is at least as great as the parent */ - HDassert(dt->shared->version >= dt->shared->parent->shared->version); + assert(dt->shared->version >= dt->shared->parent->shared->version); /* Encode the number of dimensions */ - HDassert(dt->shared->u.array.ndims <= UCHAR_MAX); + assert(dt->shared->u.array.ndims <= UCHAR_MAX); *(*pp)++ = (uint8_t)dt->shared->u.array.ndims; /* Drop this information for Version 3 of the format */ @@ -1076,7 +1267,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) /* Encode base type of array's information */ if (H5O__dtype_encode_helper(pp, dt->shared->parent) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "unable to encode VL parent type"); break; case H5T_NO_CLASS: @@ -1114,33 +1305,48 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt) Pointer to the new message in native order on success, NULL on failure DESCRIPTION This function decodes the "raw" disk form of a simple datatype message - into a struct in memory native format. The struct is allocated within this - function using malloc() and is returned to the caller. + into a struct in memory native format. The struct is allocated within this + function using malloc() and is returned to the caller. --------------------------------------------------------------------------*/ static void * H5O__dtype_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned *ioflags /*in,out*/, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned *ioflags /*in,out*/, size_t p_size, const uint8_t *p) { - H5T_t *dt = NULL; - void *ret_value = NULL; /* Return value */ + hbool_t skip; + H5T_t *dt = NULL; + const uint8_t *p_end = p + p_size - 1; + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(p); + assert(f); + assert(p); /* Allocate datatype message */ if (NULL == (dt = H5T__alloc())) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + + /* If we are decoding a buffer from H5Tdecode(), we won't have the size + * of the buffer and bounds checking will be impossible. In this case, + * the library will have set p_size to SIZE_MAX and we can use that + * as a signal to skip bounds checking. + */ + skip = (p_size == SIZE_MAX ? TRUE : FALSE); /* Perform actual decode of message */ - if (H5O__dtype_decode_helper(ioflags, &p, dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode type") + if (H5O__dtype_decode_helper(ioflags, &p, dt, skip, p_end) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode type"); /* Set return value */ ret_value = dt; done: + /* Cleanup on error */ + if (!ret_value) + /* Free dt */ + if (H5T_close_real(dt) < 0) + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "can't release datatype info"); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dtype_decode() */ @@ -1170,13 +1376,13 @@ H5O__dtype_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *mesg) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(p); - HDassert(dt); + assert(f); + assert(p); + assert(dt); /* encode */ if (H5O__dtype_encode_helper(&p, dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode type"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1209,11 +1415,11 @@ H5O__dtype_copy(const void *_src, void *_dst) FUNC_ENTER_PACKAGE /* check args */ - HDassert(src); + assert(src); /* Copy */ if (NULL == (dst = H5T_copy(src, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't copy type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't copy type"); /* Was result already allocated? */ if (_dst) { @@ -1254,8 +1460,8 @@ H5O__dtype_size(const H5F_t *f, const void *_mesg) FUNC_ENTER_PACKAGE_NOERR - HDassert(f); - HDassert(dt); + assert(f); + assert(dt); /* Set the common size information */ ret_value = 4 + /* Type, class & flags */ @@ -1370,9 +1576,6 @@ H5O__dtype_size(const H5F_t *f, const void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -1395,9 +1598,6 @@ H5O__dtype_reset(void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 30, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -1408,11 +1608,11 @@ H5O__dtype_free(void *mesg) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(mesg); + assert(mesg); /* Release the datatype */ if (H5T_close_real((H5T_t *)mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free datatype"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1425,9 +1625,6 @@ H5O__dtype_free(void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -1438,21 +1635,21 @@ H5O__dtype_set_share(void *_mesg /*in,out*/, const H5O_shared_t *sh) FUNC_ENTER_PACKAGE - HDassert(dt); - HDassert(sh); + assert(dt); + assert(sh); /* Make sure the shared message location is initialized, so that it * either has valid sharing information or is set to 0. */ - HDassert(sh->type <= H5O_SHARE_TYPE_HERE); + assert(sh->type <= H5O_SHARE_TYPE_HERE); /* Make sure we're not sharing a committed type in the heap */ - HDassert(sh->type == H5O_SHARE_TYPE_COMMITTED || - (dt->shared->state != H5T_STATE_OPEN && dt->shared->state != H5T_STATE_NAMED)); + assert(sh->type == H5O_SHARE_TYPE_COMMITTED || + (dt->shared->state != H5T_STATE_OPEN && dt->shared->state != H5T_STATE_NAMED)); /* Copy the shared information */ if (H5O_set_shared(&(dt->sh_loc), sh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy shared message info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy shared message info"); /* If this is now a committed datatype, set its state properly. */ if (sh->type == H5O_SHARE_TYPE_COMMITTED) { @@ -1460,7 +1657,7 @@ H5O__dtype_set_share(void *_mesg /*in,out*/, const H5O_shared_t *sh) /* Set up the object location for the datatype also */ if (H5O_loc_reset(&(dt->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to reset location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to reset location"); dt->oloc.file = sh->file; dt->oloc.addr = sh->u.loc.oh_addr; } /* end if */ @@ -1480,9 +1677,6 @@ H5O__dtype_set_share(void *_mesg /*in,out*/, const H5O_shared_t *sh) * FALSE if datatype may not shared * Negative on failure * - * Programmer: James Laird - * Monday, October 16, 2006 - * *------------------------------------------------------------------------- */ static htri_t @@ -1494,19 +1688,19 @@ H5O__dtype_can_share(const void *_mesg) FUNC_ENTER_PACKAGE - HDassert(mesg); + assert(mesg); /* Don't share immutable datatypes */ if ((tri_ret = H5T_is_immutable(mesg)) > 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else if (tri_ret < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is immutable") + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is immutable"); /* Don't share committed datatypes */ if ((tri_ret = H5T_is_named(mesg)) > 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else if (tri_ret < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is shared") + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "can't tell if datatype is shared"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1522,9 +1716,6 @@ H5O__dtype_can_share(const void *_mesg) * * Failure: Negative * - * Programmer: Quincey Koziol - * November 21, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -1538,15 +1729,15 @@ H5O__dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t H5_ATTR_ FUNC_ENTER_PACKAGE /* check args */ - HDassert(file_src); - HDassert(dt_src); - HDassert(cpy_info); - HDassert(cpy_info->file_dst); + assert(file_src); + assert(dt_src); + assert(cpy_info); + assert(cpy_info->file_dst); /* Check to ensure that the version of the message to be copied does not exceed the message version as indicated by the destination file's high bound */ if (dt_src->shared->version > H5O_dtype_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "datatype message version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "datatype message version out of bounds"); /* If the user data is non-NULL, assume we are copying a dataset * and check if we need to make a copy of the datatype for later in @@ -1558,11 +1749,11 @@ H5O__dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t H5_ATTR_ if (udata) { /* Create a memory copy of the variable-length datatype */ if (NULL == (udata->src_dtype = H5T_copy(dt_src, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy"); /* Set the location of the source datatype to describe the disk form of the data */ if (H5T_set_loc(udata->src_dtype, H5F_VOL_OBJ(file_src), H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk"); } /* end if */ done: @@ -1577,9 +1768,6 @@ H5O__dtype_pre_copy_file(H5F_t *file_src, const void *mesg_src, hbool_t H5_ATTR_ * Return: Success: Native copy of message * Failure: NULL * - * Programmer: James Laird - * December 12, 2006 - * *------------------------------------------------------------------------- */ static void * @@ -1594,11 +1782,11 @@ H5O__dtype_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const H5O_msg_class_t *mesg /* Perform a normal copy of the object header message */ if (NULL == (dst_mesg = (H5T_t *)H5O__dtype_copy(native_src, NULL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy"); /* The datatype will be in the new file; set its location. */ if (H5T_set_loc(dst_mesg, H5F_VOL_OBJ(file_dst), H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to set location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to set location"); ret_value = dst_mesg; @@ -1617,9 +1805,6 @@ H5O__dtype_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const H5O_msg_class_t *mesg * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * November 8, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1633,14 +1818,14 @@ H5O__dtype_shared_post_copy_upd(const H5O_loc_t H5_ATTR_UNUSED *src_oloc, const FUNC_ENTER_PACKAGE if (dt_dst->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { - HDassert(H5T_is_named(dt_dst)); + assert(H5T_is_named(dt_dst)); if (H5O_loc_reset(&(dt_dst->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to reset location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to reset location"); dt_dst->oloc.file = dt_dst->sh_loc.file; dt_dst->oloc.addr = dt_dst->sh_loc.u.loc.oh_addr; } /* end if */ else - HDassert(!H5T_is_named(dt_dst)); + assert(!H5T_is_named(dt_dst)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1677,11 +1862,11 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(dt); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(dt); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); switch (dt->shared->type) { case H5T_INTEGER: @@ -1735,45 +1920,45 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type class:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type class:", s); - HDfprintf(stream, "%*s%-*s %lu byte%s\n", indent, "", fwidth, "Size:", (unsigned long)(dt->shared->size), - 1 == dt->shared->size ? "" : "s"); + fprintf(stream, "%*s%-*s %lu byte%s\n", indent, "", fwidth, "Size:", (unsigned long)(dt->shared->size), + 1 == dt->shared->size ? "" : "s"); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", dt->shared->version); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", dt->shared->version); if (H5T_COMPOUND == dt->shared->type) { - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Number of members:", dt->shared->u.compnd.nmembs); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Number of members:", dt->shared->u.compnd.nmembs); for (i = 0; i < dt->shared->u.compnd.nmembs; i++) { HDsnprintf(buf, sizeof(buf), "Member %u:", i); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, buf, dt->shared->u.compnd.memb[i].name); - HDfprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3), - "Byte offset:", (unsigned long)(dt->shared->u.compnd.memb[i].offset)); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, buf, dt->shared->u.compnd.memb[i].name); + fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3), + "Byte offset:", (unsigned long)(dt->shared->u.compnd.memb[i].offset)); H5O__dtype_debug(f, dt->shared->u.compnd.memb[i].type, stream, indent + 3, MAX(0, fwidth - 3)); } /* end for */ } /* end if */ else if (H5T_ENUM == dt->shared->type) { - HDfprintf(stream, "%*s%s\n", indent, "", "Base type:"); + fprintf(stream, "%*s%s\n", indent, "", "Base type:"); H5O__dtype_debug(f, dt->shared->parent, stream, indent + 3, MAX(0, fwidth - 3)); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Number of members:", dt->shared->u.enumer.nmembs); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Number of members:", dt->shared->u.enumer.nmembs); for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { HDsnprintf(buf, sizeof(buf), "Member %u:", i); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, buf, dt->shared->u.enumer.name[i]); - HDfprintf(stream, "%*s%-*s 0x", indent, "", fwidth, "Raw bytes of value:"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, buf, dt->shared->u.enumer.name[i]); + fprintf(stream, "%*s%-*s 0x", indent, "", fwidth, "Raw bytes of value:"); for (k = 0; k < dt->shared->parent->shared->size; k++) - HDfprintf(stream, "%02x", - (unsigned)*((uint8_t *)dt->shared->u.enumer.value + - (i * dt->shared->parent->shared->size) + k)); - HDfprintf(stream, "\n"); + fprintf(stream, "%02x", + (unsigned)*((uint8_t *)dt->shared->u.enumer.value + + (i * dt->shared->parent->shared->size) + k)); + fprintf(stream, "\n"); } /* end for */ } /* end else if */ else if (H5T_OPAQUE == dt->shared->type) { - HDfprintf(stream, "%*s%-*s \"%s\"\n", indent, "", fwidth, "Tag:", dt->shared->u.opaque.tag); + fprintf(stream, "%*s%-*s \"%s\"\n", indent, "", fwidth, "Tag:", dt->shared->u.opaque.tag); } /* end else if */ else if (H5T_REFERENCE == dt->shared->type) { - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Fix dumping reference types!"); + fprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Fix dumping reference types!"); } /* end else if */ else if (H5T_STRING == dt->shared->type) { switch (dt->shared->u.atomic.u.s.cset) { @@ -1810,7 +1995,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set:", s); switch (dt->shared->u.atomic.u.s.pad) { case H5T_STR_NULLTERM: @@ -1849,7 +2034,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "String Padding:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "String Padding:", s); } /* end else if */ else if (H5T_VLEN == dt->shared->type) { switch (dt->shared->u.vlen.type) { @@ -1868,7 +2053,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Vlen type:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Vlen type:", s); switch (dt->shared->u.vlen.loc) { case H5T_LOC_MEMORY: @@ -1886,7 +2071,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Location:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Location:", s); /* Extra information for VL-strings */ if (dt->shared->u.vlen.type == H5T_VLEN_STRING) { @@ -1923,7 +2108,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Character Set:", s); switch (dt->shared->u.vlen.pad) { case H5T_STR_NULLTERM: @@ -1961,16 +2146,16 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "String Padding:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "String Padding:", s); } /* end if */ } /* end else if */ else if (H5T_ARRAY == dt->shared->type) { - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Rank:", dt->shared->u.array.ndims); - HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:"); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Rank:", dt->shared->u.array.ndims); + fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:"); for (i = 0; i < dt->shared->u.array.ndims; i++) - HDfprintf(stream, "%s%u", (i ? ", " : ""), (unsigned)dt->shared->u.array.dim[i]); - HDfprintf(stream, "}\n"); - HDfprintf(stream, "%*s%s\n", indent, "", "Base type:"); + fprintf(stream, "%s%u", (i ? ", " : ""), (unsigned)dt->shared->u.array.dim[i]); + fprintf(stream, "}\n"); + fprintf(stream, "%*s%s\n", indent, "", "Base type:"); H5O__dtype_debug(f, dt->shared->parent, stream, indent + 3, MAX(0, fwidth - 3)); } /* end else if */ else { @@ -2001,15 +2186,15 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Byte order:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Byte order:", s); - HDfprintf(stream, "%*s%-*s %lu bit%s\n", indent, "", fwidth, - "Precision:", (unsigned long)(dt->shared->u.atomic.prec), - 1 == dt->shared->u.atomic.prec ? "" : "s"); + fprintf(stream, "%*s%-*s %lu bit%s\n", indent, "", fwidth, + "Precision:", (unsigned long)(dt->shared->u.atomic.prec), + 1 == dt->shared->u.atomic.prec ? "" : "s"); - HDfprintf(stream, "%*s%-*s %lu bit%s\n", indent, "", fwidth, - "Offset:", (unsigned long)(dt->shared->u.atomic.offset), - 1 == dt->shared->u.atomic.offset ? "" : "s"); + fprintf(stream, "%*s%-*s %lu bit%s\n", indent, "", fwidth, + "Offset:", (unsigned long)(dt->shared->u.atomic.offset), + 1 == dt->shared->u.atomic.offset ? "" : "s"); switch (dt->shared->u.atomic.lsb_pad) { case H5T_PAD_ZERO: @@ -2030,7 +2215,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = "pad?"; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Low pad type:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Low pad type:", s); switch (dt->shared->u.atomic.msb_pad) { case H5T_PAD_ZERO: @@ -2051,7 +2236,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = "pad?"; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "High pad type:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "High pad type:", s); if (H5T_FLOAT == dt->shared->type) { switch (dt->shared->u.atomic.u.f.pad) { @@ -2077,7 +2262,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Internal pad type:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Internal pad type:", s); switch (dt->shared->u.atomic.u.f.norm) { case H5T_NORM_IMPLIED: @@ -2097,25 +2282,25 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt HDsnprintf(buf, sizeof(buf), "H5T_NORM_%d", (int)(dt->shared->u.atomic.u.f.norm)); s = buf; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Normalization:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Normalization:", s); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Sign bit location:", (unsigned long)(dt->shared->u.atomic.u.f.sign)); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Sign bit location:", (unsigned long)(dt->shared->u.atomic.u.f.sign)); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Exponent location:", (unsigned long)(dt->shared->u.atomic.u.f.epos)); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Exponent location:", (unsigned long)(dt->shared->u.atomic.u.f.epos)); - HDfprintf(stream, "%*s%-*s 0x%08lx\n", indent, "", fwidth, - "Exponent bias:", (unsigned long)(dt->shared->u.atomic.u.f.ebias)); + fprintf(stream, "%*s%-*s 0x%08lx\n", indent, "", fwidth, + "Exponent bias:", (unsigned long)(dt->shared->u.atomic.u.f.ebias)); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Exponent size:", (unsigned long)(dt->shared->u.atomic.u.f.esize)); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Exponent size:", (unsigned long)(dt->shared->u.atomic.u.f.esize)); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Mantissa location:", (unsigned long)(dt->shared->u.atomic.u.f.mpos)); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Mantissa location:", (unsigned long)(dt->shared->u.atomic.u.f.mpos)); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Mantissa size:", (unsigned long)(dt->shared->u.atomic.u.f.msize)); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Mantissa size:", (unsigned long)(dt->shared->u.atomic.u.f.msize)); } /* end if */ else if (H5T_INTEGER == dt->shared->type) { @@ -2135,7 +2320,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt s = buf; break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Sign scheme:", s); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Sign scheme:", s); } /* end else if */ } /* end else */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oefl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oefl.c index 15c0bf2ede..5e8c4df902 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oefl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oefl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,11 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Robb Matzke - * Tuesday, November 25, 1997 - */ - #include "H5Omodule.h" /* This source code file is part of the H5O module */ #include "H5private.h" /* Generic Functions */ @@ -65,111 +59,130 @@ const H5O_msg_class_t H5O_MSG_EFL[1] = {{ /*------------------------------------------------------------------------- * Function: H5O__efl_decode * - * Purpose: Decode an external file list message and return a pointer to - * the message (and some other data). - * - * Return: Success: Ptr to a new message struct. - * - * Failure: NULL + * Purpose: Decode an external file list message and return a pointer to + * the message (and some other data). * - * Programmer: Robb Matzke - * Tuesday, November 25, 1997 - * - * Modification: - * Raymond Lu - * 11 April 2011 * We allow zero dimension size starting from the 1.8.7 release. * The dataset size of external storage can be zero. + * + * Return: Success: Pointer to a new message struct + * Failure: NULL *------------------------------------------------------------------------- */ static void * H5O__efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_efl_t *mesg = NULL; - int version; - const char *s = NULL; - H5HL_t *heap; - size_t u; /* Local index variable */ - void *ret_value = NULL; /* Return value */ + H5O_efl_t *mesg = NULL; + int version; + const uint8_t *p_end = p + p_size - 1; /* pointer to last byte in p */ + const char *s = NULL; + H5HL_t *heap = NULL; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); if (NULL == (mesg = (H5O_efl_t *)H5MM_calloc(sizeof(H5O_efl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed"); - /* Version */ + /* Version (1 byte) */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); version = *p++; if (version != H5O_EFL_VERSION) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for external file list message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for external file list message"); - /* Reserved */ + /* Reserved (3 bytes) */ + if (H5_IS_BUFFER_OVERFLOW(p, 3, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); p += 3; - /* Number of slots */ + /* Number of slots (2x 2 bytes) */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, mesg->nalloc); - HDassert(mesg->nalloc > 0); + if (mesg->nalloc <= 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad number of allocated slots when parsing efl msg"); + + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, mesg->nused); - HDassert(mesg->nused <= mesg->nalloc); + if (mesg->nused > mesg->nalloc) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad number of in-use slots when parsing efl msg"); /* Heap address */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(mesg->heap_addr)); + if (H5_addr_defined(mesg->heap_addr) == FALSE) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad local heap address when parsing efl msg"); -#ifndef NDEBUG - HDassert(H5F_addr_defined(mesg->heap_addr)); + /* Decode the file list */ + mesg->slot = (H5O_efl_entry_t *)H5MM_calloc(mesg->nalloc * sizeof(H5O_efl_entry_t)); + if (NULL == mesg->slot) + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "memory allocation failed"); if (NULL == (heap = H5HL_protect(f, mesg->heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read protect link value") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect local heap"); +#ifdef H5O_DEBUG + /* Verify that the name at offset 0 in the local heap is the empty string */ s = (const char *)H5HL_offset_into(heap, 0); - - HDassert(s && !*s); - - if (H5HL_unprotect(heap) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") - heap = NULL; + if (s == NULL) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "could not obtain pointer into local heap"); + if (*s != '\0') + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "entry at offset 0 in local heap not an empty string"); #endif - /* Decode the file list */ - mesg->slot = (H5O_efl_entry_t *)H5MM_calloc(mesg->nalloc * sizeof(H5O_efl_entry_t)); - if (NULL == mesg->slot) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - if (NULL == (heap = H5HL_protect(f, mesg->heap_addr, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read protect link value") - for (u = 0; u < mesg->nused; u++) { + for (size_t u = 0; u < mesg->nused; u++) { /* Name */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_DECODE_LENGTH(f, p, mesg->slot[u].name_offset); if ((s = (const char *)H5HL_offset_into(heap, mesg->slot[u].name_offset)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "unable to get external file name") - if (*s == (char)'\0') - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "invalid external file name") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get external file name"); + if (*s == '\0') + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "invalid external file name"); mesg->slot[u].name = H5MM_xstrdup(s); - HDassert(mesg->slot[u].name); + if (mesg->slot[u].name == NULL) + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "string duplication failed"); /* File offset */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_DECODE_LENGTH(f, p, mesg->slot[u].offset); /* Size */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_DECODE_LENGTH(f, p, mesg->slot[u].size); - } /* end for */ + } if (H5HL_unprotect(heap) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read unprotect link value") - heap = NULL; + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to unprotect local heap"); /* Set return value */ ret_value = mesg; done: - if (ret_value == NULL) - if (mesg != NULL) + if (ret_value == NULL) { + if (mesg != NULL) { + if (mesg->slot != NULL) { + for (size_t u = 0; u < mesg->nused; u++) + H5MM_xfree(mesg->slot[u].name); + H5MM_xfree(mesg->slot); + } H5MM_xfree(mesg); + } + if (heap != NULL) + if (H5HL_unprotect(heap) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to unprotect local heap"); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__efl_decode() */ @@ -181,9 +194,6 @@ H5O__efl_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, November 25, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -195,9 +205,9 @@ H5O__efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); - HDassert(p); + assert(f); + assert(mesg); + assert(p); /* Version */ *p++ = H5O_EFL_VERSION; @@ -208,13 +218,13 @@ H5O__efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con *p++ = 0; /* Number of slots */ - HDassert(mesg->nalloc > 0); + assert(mesg->nalloc > 0); UINT16ENCODE(p, mesg->nused); /*yes, twice*/ - HDassert(mesg->nused > 0 && mesg->nused <= mesg->nalloc); + assert(mesg->nused > 0 && mesg->nused <= mesg->nalloc); UINT16ENCODE(p, mesg->nused); /* Heap address */ - HDassert(H5F_addr_defined(mesg->heap_addr)); + assert(H5_addr_defined(mesg->heap_addr)); H5F_addr_encode(f, &p, mesg->heap_addr); /* Encode file list */ @@ -223,7 +233,7 @@ H5O__efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con * The name should have been added to the heap when the dataset was * created. */ - HDassert(mesg->slot[u].name_offset); + assert(mesg->slot[u].name_offset); H5F_ENCODE_LENGTH(f, p, mesg->slot[u].name_offset); H5F_ENCODE_LENGTH(f, p, (hsize_t)mesg->slot[u].offset); H5F_ENCODE_LENGTH(f, p, mesg->slot[u].size); @@ -242,9 +252,6 @@ H5O__efl_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con * * Failure: NULL * - * Programmer: Robb Matzke - * Tuesday, November 25, 1997 - * *------------------------------------------------------------------------- */ static void * @@ -259,11 +266,11 @@ H5O__efl_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(mesg); + assert(mesg); /* Allocate destination message, if necessary */ if (!dest && NULL == (dest = (H5O_efl_t *)H5MM_calloc(sizeof(H5O_efl_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message"); /* copy */ *dest = *mesg; @@ -271,12 +278,12 @@ H5O__efl_copy(const void *_mesg, void *_dest) /* Deep copy allocated information */ if (dest->nalloc > 0) { if (NULL == (dest->slot = (H5O_efl_entry_t *)H5MM_calloc(dest->nalloc * sizeof(H5O_efl_entry_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slots") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slots"); slot_allocated = TRUE; for (u = 0; u < mesg->nused; u++) { dest->slot[u] = mesg->slot[u]; if (NULL == (dest->slot[u].name = H5MM_xstrdup(mesg->slot[u].name))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slot name") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate efl message slot name"); } /* end for */ } /* end if */ @@ -310,9 +317,6 @@ H5O__efl_copy(const void *_mesg, void *_dest) * * Failure: 0 * - * Programmer: Robb Matzke - * Tuesday, November 25, 1997 - * *------------------------------------------------------------------------- */ static size_t @@ -324,8 +328,8 @@ H5O__efl_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); + assert(f); + assert(mesg); ret_value = (size_t)H5F_SIZEOF_ADDR(f) + /*heap address */ 2 + /*slots allocated*/ @@ -346,9 +350,6 @@ H5O__efl_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, November 25, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -360,7 +361,7 @@ H5O__efl_reset(void *_mesg) FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(mesg); + assert(mesg); /* reset */ if (mesg->slot) { @@ -386,9 +387,6 @@ H5O__efl_reset(void *_mesg) * * Failure: 0 * - * Programmer: Robb Matzke - * Tuesday, March 3, 1998 - * *------------------------------------------------------------------------- */ hsize_t @@ -423,9 +421,6 @@ H5O_efl_total_size(H5O_efl_t *efl) * * Failure: NULL * - * Programmer: Peter Cao - * September 29, 2005 - * *------------------------------------------------------------------------- */ static void * @@ -442,12 +437,12 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d FUNC_ENTER_PACKAGE_TAG(H5AC__COPIED_TAG) /* check args */ - HDassert(efl_src); - HDassert(file_dst); + assert(efl_src); + assert(file_dst); /* Allocate space for the destination efl */ if (NULL == (efl_dst = (H5O_efl_t *)H5MM_calloc(sizeof(H5O_efl_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy the "top level" information */ H5MM_memcpy(efl_dst, efl_src, sizeof(H5O_efl_t)); @@ -459,22 +454,22 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d /* Create name heap */ if (H5HL_create(file_dst, heap_size, &efl_dst->heap_addr /*out*/) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, NULL, "can't create heap") + HGOTO_ERROR(H5E_EFL, H5E_CANTINIT, NULL, "can't create heap"); /* Pin the heap down in memory */ if (NULL == (heap = H5HL_protect(file_dst, efl_dst->heap_addr, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to protect EFL file name heap") + HGOTO_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to protect EFL file name heap"); /* Insert "empty" name first */ if (H5HL_insert(file_dst, heap, (size_t)1, "", &name_offset) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap") - HDassert(0 == name_offset); + HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap"); + assert(0 == name_offset); /* allocate array of external file entries */ if (efl_src->nalloc > 0) { size = efl_src->nalloc * sizeof(H5O_efl_entry_t); if ((efl_dst->slot = (H5O_efl_entry_t *)H5MM_calloc(size)) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy content from the source. Need to update later */ H5MM_memcpy(efl_dst->slot, efl_src->slot, size); @@ -485,7 +480,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d efl_dst->slot[idx].name = H5MM_xstrdup(efl_src->slot[idx].name); if (H5HL_insert(file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name, &(efl_dst->slot[idx].name_offset)) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap") + HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap"); } /* Set return value */ @@ -494,7 +489,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d done: /* Release resources */ if (heap && H5HL_unprotect(heap) < 0) - HDONE_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to unprotect EFL file name heap") + HDONE_ERROR(H5E_EFL, H5E_PROTECT, NULL, "unable to unprotect EFL file name heap"); if (!ret_value) if (efl_dst) H5MM_xfree(efl_dst); @@ -509,9 +504,6 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, November 25, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -523,34 +515,33 @@ H5O__efl_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int ind FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Heap address:", mesg->heap_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Heap address:", mesg->heap_addr); - HDfprintf(stream, "%*s%-*s %zu/%zu\n", indent, "", fwidth, "Slots used/allocated:", mesg->nused, - mesg->nalloc); + fprintf(stream, "%*s%-*s %zu/%zu\n", indent, "", fwidth, "Slots used/allocated:", mesg->nused, + mesg->nalloc); for (u = 0; u < mesg->nused; u++) { char buf[64]; HDsnprintf(buf, sizeof(buf), "File %zu", u); - HDfprintf(stream, "%*s%s:\n", indent, "", buf); + fprintf(stream, "%*s%s:\n", indent, "", buf); - HDfprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(fwidth - 3, 0), - "Name:", mesg->slot[u].name); + fprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(fwidth - 3, 0), "Name:", mesg->slot[u].name); - HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(fwidth - 3, 0), - "Name offset:", mesg->slot[u].name_offset); + fprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(fwidth - 3, 0), + "Name offset:", mesg->slot[u].name_offset); - HDfprintf(stream, "%*s%-*s %" PRIdMAX "\n", indent + 3, "", MAX(fwidth - 3, 0), - "Offset of data in file:", (intmax_t)(mesg->slot[u].offset)); + fprintf(stream, "%*s%-*s %" PRIdMAX "\n", indent + 3, "", MAX(fwidth - 3, 0), + "Offset of data in file:", (intmax_t)(mesg->slot[u].offset)); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent + 3, "", MAX(fwidth - 3, 0), - "Bytes reserved for data:", (mesg->slot[u].size)); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent + 3, "", MAX(fwidth - 3, 0), + "Bytes reserved for data:", (mesg->slot[u].size)); } /* end for */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ofill.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ofill.c index b62281e32a..d43136424c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ofill.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ofill.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,11 +10,9 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Wednesday, September 30, 1998 - * +/* * Purpose: The fill message indicates a bit pattern to use for - * uninitialized data points of a dataset. + * uninitialized data points of a dataset. */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ @@ -179,16 +176,12 @@ H5FL_BLK_EXTERN(type_conv); /*------------------------------------------------------------------------- * Function: H5O__fill_new_decode * - * Purpose: Decode a new fill value message. The new fill value - * message is fill value plus space allocation time and - * fill value writing time and whether fill value is defined. - * - * Return: Success: Ptr to new message in native struct. - * Failure: NULL - * - * Programmer: Raymond Lu - * Feb 26, 2002 + * Purpose: Decode a new fill value message. The new fill value + * message is fill value plus space allocation time and + * fill value writing time and whether fill value is defined. * + * Return: Success: Pointer to new message in native struct + * Failure: NULL *------------------------------------------------------------------------- */ static void * @@ -202,19 +195,28 @@ H5O__fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(p); + assert(f); + assert(p); if (NULL == (fill = H5FL_CALLOC(H5O_fill_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message"); /* Version */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); fill->version = *p++; if (fill->version < H5O_FILL_VERSION_1 || fill->version > H5O_FILL_VERSION_LATEST) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for fill value message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for fill value message"); /* Decode each version */ if (fill->version < H5O_FILL_VERSION_3) { + + /* Versions 1 & 2 */ + + /* Buffer size check for the next three bytes */ + if (H5_IS_BUFFER_OVERFLOW(p, 3, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + /* Space allocation time */ fill->alloc_time = (H5D_alloc_time_t)*p++; @@ -226,31 +228,39 @@ H5O__fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Only decode fill value information if one is defined */ if (fill->fill_defined) { + + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); INT32DECODE(p, fill->size); + if (fill->size > 0) { H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); - /* Ensure that fill size doesn't exceed buffer size, due to possible data corruption */ - if (p + fill->size - 1 > p_end) - HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "fill size exceeds buffer size") + if (H5_IS_BUFFER_OVERFLOW(p, fill->size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value"); H5MM_memcpy(fill->buf, p, (size_t)fill->size); - } /* end if */ - } /* end if */ + } + } else - fill->size = (-1); - } /* end if */ + fill->size = -1; + } else { + + /* Version 3 */ + unsigned flags; /* Status flags */ /* Flags */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); flags = *p++; /* Check for unknown flags */ if (flags & (unsigned)~H5O_FILL_FLAGS_ALL) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown flag for fill value message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown flag for fill value message"); /* Space allocation time */ fill->alloc_time = @@ -261,39 +271,45 @@ H5O__fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Check for undefined fill value */ if (flags & H5O_FILL_FLAG_UNDEFINED_VALUE) { - /* Sanity check */ - HDassert(!(flags & H5O_FILL_FLAG_HAVE_VALUE)); + + if (flags & H5O_FILL_FLAG_HAVE_VALUE) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "have value and undefined value flags both set"); /* Set value for "undefined" fill value */ - fill->size = (-1); - } /* end if */ + fill->size = -1; + } else if (flags & H5O_FILL_FLAG_HAVE_VALUE) { /* Fill value size */ + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT32DECODE(p, fill->size); /* Fill value */ H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); + + if (H5_IS_BUFFER_OVERFLOW(p, fill->size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + if (NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value"); H5MM_memcpy(fill->buf, p, (size_t)fill->size); /* Set the "defined" flag */ fill->fill_defined = TRUE; - } /* end else */ + } else /* Set the "defined" flag */ fill->fill_defined = TRUE; - } /* end else */ + } /* Set return value */ ret_value = (void *)fill; done: if (!ret_value && fill) { - if (fill->buf) - H5MM_xfree(fill->buf); + H5MM_xfree(fill->buf); fill = H5FL_FREE(H5O_fill_t, fill); - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__fill_new_decode() */ @@ -301,14 +317,10 @@ H5O__fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, /*------------------------------------------------------------------------- * Function: H5O__fill_old_decode * - * Purpose: Decode an old fill value message. - * - * Return: Success: Ptr to new message in native struct. - * Failure: NULL - * - * Programmer: Robb Matzke - * Wednesday, September 30, 1998 + * Purpose: Decode an old fill value message * + * Return: Success: Pointer to new message in native struct + * Failure: NULL *------------------------------------------------------------------------- */ static void * @@ -323,11 +335,11 @@ H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flag FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(p); + assert(f); + assert(p); if (NULL == (fill = H5FL_CALLOC(H5O_fill_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value message"); /* Set non-zero default fields */ fill->version = H5O_FILL_VERSION_2; @@ -335,6 +347,8 @@ H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flag fill->fill_time = H5D_FILL_TIME_IFSET; /* Fill value size */ + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT32DECODE(p, fill->size); /* Only decode the fill value itself if there is one */ @@ -342,27 +356,27 @@ H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flag H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); /* Ensure that fill size doesn't exceed buffer size, due to possible data corruption */ - if (p + fill->size - 1 > p_end) - HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "fill size exceeds buffer size") + if (H5_IS_BUFFER_OVERFLOW(p, fill->size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); /* Get the datatype message */ if ((exists = H5O_msg_exists_oh(open_oh, H5O_DTYPE_ID)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read object header") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, NULL, "unable to read object header"); if (exists) { if (NULL == (dt = (H5T_t *)H5O_msg_read_oh(f, open_oh, H5O_DTYPE_ID, NULL))) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't read DTYPE message") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "can't read DTYPE message"); /* Verify size */ if (fill->size != (ssize_t)H5T_GET_SIZE(dt)) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "inconsistent fill value size") - } /* end if */ + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, NULL, "inconsistent fill value size"); + } if (NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value"); H5MM_memcpy(fill->buf, p, (size_t)fill->size); fill->fill_defined = TRUE; - } /* end if */ + } else - fill->size = (-1); + fill->size = -1; /* Set return value */ ret_value = (void *)fill; @@ -372,10 +386,9 @@ H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flag H5O_msg_free(H5O_DTYPE_ID, dt); if (!ret_value && fill) { - if (fill->buf) - H5MM_xfree(fill->buf); - fill = H5FL_FREE(H5O_fill_t, fill); - } /* end if */ + H5MM_xfree(fill->buf); + H5FL_FREE(H5O_fill_t, fill); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__fill_old_decode() */ @@ -389,9 +402,6 @@ H5O__fill_old_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flag * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Feb 26, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -401,9 +411,9 @@ H5O__fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) FUNC_ENTER_PACKAGE_NOERR - HDassert(f); - HDassert(p); - HDassert(fill && NULL == fill->type); + assert(f); + assert(p); + assert(fill && NULL == fill->type); /* Version */ *p++ = (uint8_t)fill->version; @@ -432,12 +442,12 @@ H5O__fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) uint8_t flags = 0; /* Fill value setting flags */ /* Encode space allocation time */ - HDassert(fill->alloc_time == (H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time)); + assert(fill->alloc_time == (H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time)); flags = (uint8_t)(flags | ((H5O_FILL_MASK_ALLOC_TIME & fill->alloc_time) << H5O_FILL_SHIFT_ALLOC_TIME)); /* Encode fill value writing time */ - HDassert(fill->fill_time == (H5O_FILL_MASK_FILL_TIME & fill->fill_time)); + assert(fill->fill_time == (H5O_FILL_MASK_FILL_TIME & fill->fill_time)); flags = (uint8_t)(flags | ((H5O_FILL_MASK_FILL_TIME & fill->fill_time) << H5O_FILL_SHIFT_FILL_TIME)); /* Check if we need to encode a fill value size */ @@ -449,7 +459,7 @@ H5O__fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) *p++ = (uint8_t)flags; /* Sanity check */ - HDassert(!fill->buf); + assert(!fill->buf); } /* end if */ else if (fill->size > 0) { /* Indicate that a fill value size is present */ @@ -462,7 +472,7 @@ H5O__fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) INT32ENCODE(p, fill->size); /* Encode the fill value */ - HDassert(fill->buf); + assert(fill->buf); H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); H5MM_memcpy(p, fill->buf, (size_t)fill->size); } /* end if */ @@ -471,7 +481,7 @@ H5O__fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) *p++ = (uint8_t)flags; /* Sanity check */ - HDassert(!fill->buf); + assert(!fill->buf); } /* end else */ } /* end else */ @@ -485,9 +495,6 @@ H5O__fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, October 1, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -497,9 +504,9 @@ H5O__fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) FUNC_ENTER_PACKAGE_NOERR - HDassert(f); - HDassert(p); - HDassert(fill && NULL == fill->type); + assert(f); + assert(p); + assert(fill && NULL == fill->type); UINT32ENCODE(p, fill->size); if (fill->buf) @@ -519,9 +526,6 @@ H5O__fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: Raymond Lu - * Feb 26, 2002 - * *------------------------------------------------------------------------- */ static void * @@ -533,10 +537,10 @@ H5O__fill_copy(const void *_src, void *_dst) FUNC_ENTER_PACKAGE - HDassert(src); + assert(src); if (!dst && NULL == (dst = H5FL_MALLOC(H5O_fill_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill message"); /* Shallow copy basic fields */ *dst = *src; @@ -544,7 +548,7 @@ H5O__fill_copy(const void *_src, void *_dst) /* Copy data type of fill value */ if (src->type) { if (NULL == (dst->type = H5T_copy(src->type, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "can't copy datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "can't copy datatype"); } /* end if */ else dst->type = NULL; @@ -553,7 +557,7 @@ H5O__fill_copy(const void *_src, void *_dst) if (src->buf) { H5_CHECK_OVERFLOW(src->size, ssize_t, size_t); if (NULL == (dst->buf = H5MM_malloc((size_t)src->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value"); H5MM_memcpy(dst->buf, src->buf, (size_t)src->size); /* Check for needing to convert/copy fill value */ @@ -563,7 +567,7 @@ H5O__fill_copy(const void *_src, void *_dst) /* Set up type conversion function */ if (NULL == (tpath = H5T_path_find(src->type, dst->type))) HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, - "unable to convert between src and dst data types") + "unable to convert between src and dst data types"); /* If necessary, convert fill value datatypes (which copies VL components, etc.) */ if (!H5T_path_noop(tpath)) { @@ -574,11 +578,11 @@ H5O__fill_copy(const void *_src, void *_dst) /* Wrap copies of types to convert */ dst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->type, H5T_COPY_TRANSIENT), FALSE); if (dst_id < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy/register datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy/register datatype"); src_id = H5I_register(H5I_DATATYPE, H5T_copy(src->type, H5T_COPY_ALL), FALSE); if (src_id < 0) { H5I_dec_ref(dst_id); - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy/register datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy/register datatype"); } /* end if */ /* Allocate a background buffer */ @@ -586,7 +590,7 @@ H5O__fill_copy(const void *_src, void *_dst) if (H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, bkg_size))) { H5I_dec_ref(src_id); H5I_dec_ref(dst_id); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } /* end if */ /* Convert fill value */ @@ -596,7 +600,7 @@ H5O__fill_copy(const void *_src, void *_dst) H5I_dec_ref(dst_id); if (bkg_buf) bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); - HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, NULL, "datatype conversion failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCONVERT, NULL, "datatype conversion failed"); } /* end if */ /* Release the background buffer */ @@ -638,9 +642,6 @@ H5O__fill_copy(const void *_src, void *_dst) * Return: Success: Message data size in bytes w/o alignment. * Failure: 0 * - * Programmer: Raymond Lu - * Feb 26, 2002 - * *------------------------------------------------------------------------- */ static size_t @@ -651,8 +652,8 @@ H5O__fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) FUNC_ENTER_PACKAGE_NOERR - HDassert(f); - HDassert(fill); + assert(f); + assert(fill); /* Determine size for different versions */ if (fill->version < H5O_FILL_VERSION_3) { @@ -685,9 +686,6 @@ H5O__fill_new_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) * Return: Success: Message data size in bytes w/o alignment. * Failure: 0 * - * Programmer: Robb Matzke - * Thursday, October 1, 1998 - * *------------------------------------------------------------------------- */ static size_t @@ -697,7 +695,7 @@ H5O__fill_old_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) FUNC_ENTER_PACKAGE_NOERR - HDassert(fill); + assert(fill); FUNC_LEAVE_NOAPI(4 + (size_t)fill->size) } /* end H5O__fill_old_size() */ @@ -709,9 +707,6 @@ H5O__fill_old_size(const H5F_t H5_ATTR_UNUSED *f, const void *_fill) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, January 22, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -722,7 +717,7 @@ H5O_fill_reset_dyn(H5O_fill_t *fill) FUNC_ENTER_NOAPI(FAIL) - HDassert(fill); + assert(fill); if (fill->buf) { if (fill->type && H5T_detect_class(fill->type, H5T_VLEN, FALSE) > 0) { @@ -731,20 +726,20 @@ H5O_fill_reset_dyn(H5O_fill_t *fill) /* Copy the fill value datatype and get an ID for it */ if (NULL == (fill_type = H5T_copy(fill->type, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy fill value datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy fill value datatype"); if ((fill_type_id = H5I_register(H5I_DATATYPE, fill_type, FALSE)) < 0) { (void)H5T_close_real(fill_type); - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register fill value datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to register fill value datatype"); } /* end if */ /* Create a scalar dataspace for the fill value element */ if (NULL == (fill_space = H5S_create(H5S_SCALAR))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create scalar dataspace") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create scalar dataspace"); /* Reclaim any variable length components of the fill value */ if (H5T_reclaim(fill_type_id, fill_space, fill->buf) < 0) { H5S_close(fill_space); - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "unable to reclaim variable-length fill value data") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "unable to reclaim variable-length fill value data"); } /* end if */ /* Release the scalar fill value dataspace */ @@ -762,7 +757,7 @@ H5O_fill_reset_dyn(H5O_fill_t *fill) done: if (fill_type_id > 0 && H5I_dec_ref(fill_type_id) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for temp ID") + HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for temp ID"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_fill_reset_dyn() */ @@ -774,9 +769,6 @@ H5O_fill_reset_dyn(H5O_fill_t *fill) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, October 1, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -786,7 +778,7 @@ H5O__fill_reset(void *_fill) FUNC_ENTER_PACKAGE_NOERR - HDassert(fill); + assert(fill); /* Reset dynamic fields */ H5O_fill_reset_dyn(fill); @@ -806,9 +798,6 @@ H5O__fill_reset(void *_fill) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, December 5, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -816,7 +805,7 @@ H5O__fill_free(void *fill) { FUNC_ENTER_PACKAGE_NOERR - HDassert(fill); + assert(fill); fill = H5FL_FREE(H5O_fill_t, fill); @@ -832,8 +821,6 @@ H5O__fill_free(void *fill) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi; Dec 2017 - * *------------------------------------------------------------------------- */ static herr_t @@ -846,13 +833,13 @@ H5O__fill_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, hb FUNC_ENTER_PACKAGE /* check args */ - HDassert(cpy_info); - HDassert(cpy_info->file_dst); + assert(cpy_info); + assert(cpy_info->file_dst); /* Check to ensure that the version of the message to be copied does not exceed the message version allowed by the destination file's high bound */ if (fill_src->version > H5O_fill_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "fill value message version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "fill value message version out of bounds"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -865,9 +852,6 @@ H5O__fill_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, hb * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, October 1, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -878,81 +862,81 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream, int in FUNC_ENTER_PACKAGE_NOERR - HDassert(f); - HDassert(fill); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(fill); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Space Allocation Time:"); + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Space Allocation Time:"); switch (fill->alloc_time) { case H5D_ALLOC_TIME_EARLY: - HDfprintf(stream, "Early\n"); + fprintf(stream, "Early\n"); break; case H5D_ALLOC_TIME_LATE: - HDfprintf(stream, "Late\n"); + fprintf(stream, "Late\n"); break; case H5D_ALLOC_TIME_INCR: - HDfprintf(stream, "Incremental\n"); + fprintf(stream, "Incremental\n"); break; case H5D_ALLOC_TIME_DEFAULT: case H5D_ALLOC_TIME_ERROR: default: - HDfprintf(stream, "Unknown!\n"); + fprintf(stream, "Unknown!\n"); break; } /* end switch */ - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Time:"); + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Time:"); switch (fill->fill_time) { case H5D_FILL_TIME_ALLOC: - HDfprintf(stream, "On Allocation\n"); + fprintf(stream, "On Allocation\n"); break; case H5D_FILL_TIME_NEVER: - HDfprintf(stream, "Never\n"); + fprintf(stream, "Never\n"); break; case H5D_FILL_TIME_IFSET: - HDfprintf(stream, "If Set\n"); + fprintf(stream, "If Set\n"); break; case H5D_FILL_TIME_ERROR: default: - HDfprintf(stream, "Unknown!\n"); + fprintf(stream, "Unknown!\n"); break; } /* end switch */ - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Value Defined:"); + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Fill Value Defined:"); H5P_is_fill_value_defined((const H5O_fill_t *)fill, &fill_status); switch (fill_status) { case H5D_FILL_VALUE_UNDEFINED: - HDfprintf(stream, "Undefined\n"); + fprintf(stream, "Undefined\n"); break; case H5D_FILL_VALUE_DEFAULT: - HDfprintf(stream, "Default\n"); + fprintf(stream, "Default\n"); break; case H5D_FILL_VALUE_USER_DEFINED: - HDfprintf(stream, "User Defined\n"); + fprintf(stream, "User Defined\n"); break; case H5D_FILL_VALUE_ERROR: default: - HDfprintf(stream, "Unknown!\n"); + fprintf(stream, "Unknown!\n"); break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %zd\n", indent, "", fwidth, "Size:", fill->size); - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:"); + fprintf(stream, "%*s%-*s %zd\n", indent, "", fwidth, "Size:", fill->size); + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Data type:"); if (fill->type) { H5T_debug(fill->type, stream); - HDfprintf(stream, "\n"); + fprintf(stream, "\n"); } /* end if */ else - HDfprintf(stream, "\n"); + fprintf(stream, "\n"); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__fill_debug() */ @@ -967,9 +951,6 @@ H5O__fill_debug(H5F_t H5_ATTR_UNUSED *f, const void *_fill, FILE *stream, int in * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, October 1, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -982,9 +963,9 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed) FUNC_ENTER_NOAPI(FAIL) - HDassert(fill); - HDassert(dset_type); - HDassert(fill_changed); + assert(fill); + assert(dset_type); + assert(fill_changed); /* No-op cases */ if (!fill->buf || !fill->type || 0 == H5T_cmp(fill->type, dset_type, FALSE)) { @@ -1003,41 +984,40 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed) * Can we convert between source and destination data types? */ if (NULL == (tpath = H5T_path_find(fill->type, dset_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes"); /* Don't bother doing anything if there will be no actual conversion */ if (!H5T_path_noop(tpath)) { + size_t fill_type_size; + if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill->type, H5T_COPY_ALL), FALSE)) < 0 || (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(dset_type, H5T_COPY_ALL), FALSE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy/register data type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy/register data type"); /* * Datatype conversions are always done in place, so we need a buffer * that is large enough for both source and destination. */ - if (H5T_get_size(fill->type) >= H5T_get_size(dset_type)) - buf = fill->buf; - else { - if (NULL == (buf = H5MM_malloc(H5T_get_size(dset_type)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") - H5MM_memcpy(buf, fill->buf, H5T_get_size(fill->type)); - } /* end else */ + fill_type_size = H5T_get_size(fill->type); + + if (NULL == (buf = H5MM_malloc(MAX(fill_type_size, H5T_get_size(dset_type))))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion"); + H5MM_memcpy(buf, fill->buf, fill_type_size); /* Use CALLOC here to clear the buffer in case later the library thinks there's * data in the background. */ if (H5T_path_bkg(tpath) && NULL == (bkg = H5MM_calloc(H5T_get_size(dset_type)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion"); /* Do the conversion */ if (H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "datatype conversion failed"); /* Update the fill message */ - if (buf != fill->buf) { - H5T_vlen_reclaim_elmt(fill->buf, fill->type); - H5MM_xfree(fill->buf); - fill->buf = buf; - } /* end if */ + H5T_vlen_reclaim_elmt(fill->buf, fill->type); + H5MM_xfree(fill->buf); + fill->buf = buf; + (void)H5T_close_real(fill->type); fill->type = NULL; H5_CHECKED_ASSIGN(fill->size, ssize_t, H5T_get_size(dset_type), size_t); @@ -1048,11 +1028,9 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed) done: if (src_id >= 0 && H5I_dec_ref(src_id) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for temp ID") + HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for temp ID"); if (dst_id >= 0 && H5I_dec_ref(dst_id) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for temp ID") - if (buf != fill->buf) - H5MM_xfree(buf); + HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement ref count for temp ID"); if (bkg) H5MM_xfree(bkg); @@ -1066,8 +1044,6 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; December 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -1079,15 +1055,15 @@ H5O_fill_set_version(H5F_t *f, H5O_fill_t *fill) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(fill); + assert(f); + assert(fill); /* Upgrade to the version indicated by the file's low bound if higher */ version = MAX(fill->version, H5O_fill_ver_bounds[H5F_LOW_BOUND(f)]); /* Version bounds check */ if (version > H5O_fill_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds"); /* Set the message version */ fill->version = version; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oflush.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oflush.c index 0ea9c40d39..6ff751f1cf 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oflush.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oflush.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Oflush.c - * Aug 19, 2010 - * Mike McGreevy * * Purpose: Object flush/refresh routines. * @@ -61,9 +58,6 @@ static herr_t H5O__refresh_metadata_close(H5O_loc_t *oloc, H5G_loc_t *obj_loc, h * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * December 29, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -78,23 +72,23 @@ H5O_flush(H5O_loc_t *oloc, hid_t obj_id) /* Currently, H5Oflush causes H5Fclose to trigger an assertion failure in metadata cache. * Leave this situation for the future solution */ if (H5F_HAS_FEATURE(oloc->file, H5FD_FEAT_HAS_MPI)) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "H5Oflush isn't supported for parallel") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "H5Oflush isn't supported for parallel"); /* Get the object pointer */ if (NULL == (obj_ptr = H5VL_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Get the object class */ if (NULL == (obj_class = H5O__obj_class(oloc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object class"); /* Flush the object of this class */ if (obj_class->flush && obj_class->flush(obj_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object"); /* Flush the object metadata and invoke flush callback */ if (H5O_flush_common(oloc, obj_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -108,8 +102,6 @@ H5O_flush(H5O_loc_t *oloc, hid_t obj_id) * * Return: Non-negative on success, negative on failure * - * Programmer: Vailin Choi; Dec 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -122,15 +114,15 @@ H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id) /* Retrieve tag for object */ if (H5O__oh_tag(oloc, &tag) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object metadata"); /* Flush metadata based on tag value of the object */ if (H5F_flush_tagged_metadata(oloc->file, tag) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata"); /* Check to invoke callback */ if (H5F_object_flush_cb(oloc->file, obj_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to do object flush callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -144,9 +136,6 @@ H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mike McGreevy - * May 19, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -158,20 +147,20 @@ H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(oloc); + assert(oloc); /* Get object header for object */ if (NULL == (oh = H5O_protect(oloc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object's object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object's object header"); /* Get object header's address (i.e. the tag value for this object) */ if (HADDR_UNDEF == (*tag = H5O_OH_GET_ADDR(oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get address of object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get address of object header"); done: /* Unprotect object header on failure */ if (oh && H5O_unprotect(oloc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__oh_tag() */ @@ -191,9 +180,6 @@ H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag) * * Return: Non-negative on success, negative on failure * - * Programmer: Mike McGreevy/Vailin Choi - * July 28, 2010/Feb 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -233,14 +219,14 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid) /* Save important datatype state */ if (H5I_get_type(oid) == H5I_DATATYPE) if (H5T_save_refresh_state(oid, &cached_H5O_shared) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to save datatype state"); /* Get the VOL object from the ID and cache a pointer to the connector. * The vol_obj will disappear when the underlying object is closed, so * we can't use that directly. */ if (NULL == (vol_obj = H5VL_vol_object(oid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); connector = vol_obj->connector; /* Bump the number of references on the VOL connector. @@ -250,11 +236,11 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid) /* Close object & evict its metadata */ if (H5O__refresh_metadata_close(oloc, &obj_loc, oid) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object"); /* Re-open the object, re-fetching its metadata */ if (H5O_refresh_metadata_reopen(oid, H5P_DEFAULT, &obj_loc, connector, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object"); /* Restore the number of references on the VOL connector */ connector->nrefs--; @@ -262,7 +248,7 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid) /* Restore important datatype state */ if (H5I_get_type(oid) == H5I_DATATYPE) if (H5T_restore_refresh_state(oid, &cached_H5O_shared) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to restore datatype state") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to restore datatype state"); } /* end if */ @@ -270,7 +256,7 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid) if (objs_incr && file) H5F_decr_nopen_objs(file); - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_refresh_metadata() */ /*------------------------------------------------------------------------- @@ -287,9 +273,6 @@ H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mike McGreevy/Vailin Choi - * July 28, 2010/Feb 2014 - * *------------------------------------------------------------------------- */ static herr_t @@ -313,15 +296,15 @@ H5O__refresh_metadata_close(H5O_loc_t *oloc, H5G_loc_t *obj_loc, hid_t oid) /* Handle close for multiple dataset opens */ if (H5I_get_type(oid) == H5I_DATASET) if (H5D_mult_refresh_close(oid) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset"); /* Retrieve tag for object */ if (H5O__oh_tag(oloc, &tag) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to get object header address") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to get object header address"); /* Get cork status of the object with tag */ if (H5AC_cork(oloc->file, tag, H5AC__GET_CORKED, &corked) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status") + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status"); /* Hold a copy of the object's file pointer, since closing the object will * invalidate the file pointer in the oloc. @@ -329,23 +312,23 @@ H5O__refresh_metadata_close(H5O_loc_t *oloc, H5G_loc_t *obj_loc, hid_t oid) file = oloc->file; /* Close the object */ if (H5I_dec_ref(oid) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to close object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to close object"); /* Flush metadata based on tag value of the object */ if (H5F_flush_tagged_metadata(file, tag) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata"); /* Evict the object's tagged metadata */ - if (H5F_evict_tagged_metadata(file, tag) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to evict metadata") + if (H5AC_evict_tagged_metadata(file, tag, TRUE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to evict metadata"); /* Re-cork object with tag */ if (corked) if (H5AC_cork(file, tag, H5AC__SET_CORK, &corked) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to cork the object") + HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to cork the object"); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__refresh_metadata_close() */ /*------------------------------------------------------------------------- @@ -357,9 +340,6 @@ H5O__refresh_metadata_close(H5O_loc_t *oloc, H5G_loc_t *obj_loc, hid_t oid) * * Return: SUCCEED/FAIL * - * Programmer: Mike McGreevy/Vailin Choi - * July 28, 2010/Feb 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -373,8 +353,8 @@ H5O_refresh_metadata_reopen(hid_t oid, hid_t apl_id, H5G_loc_t *obj_loc, H5VL_t FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(obj_loc); - HDassert(vol_connector); + assert(obj_loc); + assert(vol_connector); /* Get object's type */ type = H5I_get_type(oid); @@ -383,31 +363,31 @@ H5O_refresh_metadata_reopen(hid_t oid, hid_t apl_id, H5G_loc_t *obj_loc, H5VL_t case H5I_GROUP: /* Re-open the group */ if (NULL == (object = H5G_open(obj_loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open group") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open group"); break; case H5I_DATATYPE: /* Re-open the named datatype */ if (NULL == (object = H5T_open(obj_loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open named datatype"); break; case H5I_DATASET: /* Set dataset access property list in API context if appropriate */ if (H5CX_set_apl(&apl_id, H5P_CLS_DACC, oid, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info"); /* Re-open the dataset */ if (NULL == (object = H5D_open(obj_loc, apl_id == H5P_DEFAULT ? H5P_DATASET_ACCESS_DEFAULT : apl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset"); if (!start_swmr) /* No need to handle multiple opens when H5Fstart_swmr_write() */ if (H5D_mult_refresh_reopen((H5D_t *)object) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to finish refresh for dataset"); break; case H5I_MAP: - HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector"); case H5I_UNINIT: case H5I_BADID: @@ -426,14 +406,14 @@ H5O_refresh_metadata_reopen(hid_t oid, hid_t apl_id, H5G_loc_t *obj_loc, H5VL_t case H5I_NTYPES: default: HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, - "not a valid file object ID (dataset, group, or datatype)") + "not a valid file object ID (dataset, group, or datatype)"); break; } /* end switch */ /* Re-register ID for the object */ if ((H5VL_register_using_existing_id(type, object, vol_connector, TRUE, oid)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, FAIL, "unable to re-register object ID after refresh"); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_refresh_metadata_reopen() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ofsinfo.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ofsinfo.c index a60222c057..6829eb8634 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ofsinfo.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ofsinfo.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5Ofsinfo.c - * Feb 2009 - * Vailin Choi * - * Purpose: File space info message. + * Purpose: File space info message * *------------------------------------------------------------------------- */ @@ -82,43 +79,41 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t); * * Purpose: Decode a message and return a pointer to a newly allocated one. * - * Return: Success: Ptr to new message in native form. - * Failure: NULL - * - * Programmer: Vailin Choi; Feb 2009 - * + * Return: Success: Pointer to new message in native form + * Failure: NULL *------------------------------------------------------------------------- */ static void * H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_fsinfo_t *fsinfo = NULL; /* File space info message */ - H5F_mem_page_t ptype; /* Memory type for iteration */ - unsigned vers; /* message version */ - const uint8_t *p_end = p + p_size; - void *ret_value = NULL; /* Return value */ + H5O_fsinfo_t *fsinfo = NULL; /* File space info message */ + H5F_mem_page_t ptype; /* Memory type for iteration */ + unsigned vers; /* Message version */ + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); /* Allocate space for message */ if (NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); for (ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo->fs_addr[ptype - 1] = HADDR_UNDEF; /* Version of message */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); vers = *p++; if (vers == H5O_FSINFO_VERSION_0) { - H5F_file_space_type_t strategy; /* Strategy */ - hsize_t threshold; /* Threshold */ - H5FD_mem_t type; /* Memory type for iteration */ + H5F_file_space_type_t strategy; /* Strategy */ + hsize_t threshold = 0; /* Threshold */ + H5FD_mem_t type; /* Memory type for iteration */ fsinfo->persist = H5F_FREE_SPACE_PERSIST_DEF; fsinfo->threshold = H5F_FREE_SPACE_THRESHOLD_DEF; @@ -126,6 +121,8 @@ H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU fsinfo->pgend_meta_thres = H5F_FILE_SPACE_PGEND_META_THRES; fsinfo->eoa_pre_fsm_fsalloc = HADDR_UNDEF; + if (H5_IS_BUFFER_OVERFLOW(p, 1 + H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); strategy = (H5F_file_space_type_t)*p++; /* File space strategy */ H5F_DECODE_LENGTH(f, p, threshold); /* Free-space section threshold */ @@ -136,11 +133,11 @@ H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU fsinfo->persist = TRUE; fsinfo->threshold = threshold; if (HADDR_UNDEF == (fsinfo->eoa_pre_fsm_fsalloc = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file size"); for (type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) { - if (p + H5_SIZEOF_HADDR_T > p_end) - HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL, - "ran off end of input buffer while decoding") + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type - 1])); } break; @@ -161,30 +158,46 @@ H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU case H5F_FILE_SPACE_NTYPES: case H5F_FILE_SPACE_DEFAULT: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file space strategy") - } /* end switch */ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file space strategy"); + } fsinfo->version = H5O_FSINFO_VERSION_1; fsinfo->mapped = TRUE; } else { - HDassert(vers >= H5O_FSINFO_VERSION_1); + if (vers < H5O_FSINFO_VERSION_1) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "bad version number"); - fsinfo->version = vers; + fsinfo->version = vers; + if (H5_IS_BUFFER_OVERFLOW(p, 1 + 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); fsinfo->strategy = (H5F_fspace_strategy_t)*p++; /* File space strategy */ fsinfo->persist = *p++; /* Free-space persist or not */ - H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section threshold */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section threshold */ + + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_DECODE_LENGTH(f, p, fsinfo->page_size); /* File space page size */ - UINT16DECODE(p, fsinfo->pgend_meta_thres); /* Page end metadata threshold */ + + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT16DECODE(p, fsinfo->pgend_meta_thres); /* Page end metadata threshold */ + + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(fsinfo->eoa_pre_fsm_fsalloc)); /* EOA before free-space header and section info */ /* Decode addresses of free space managers, if persisting */ if (fsinfo->persist) - for (ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) + for (ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(fsinfo->fs_addr[ptype - 1])); - + } fsinfo->mapped = FALSE; } @@ -192,8 +205,8 @@ H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU ret_value = fsinfo; done: - if (ret_value == NULL && fsinfo != NULL) - fsinfo = H5FL_FREE(H5O_fsinfo_t, fsinfo); + if (!ret_value && fsinfo) + H5FL_FREE(H5O_fsinfo_t, fsinfo); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__fsinfo_decode() */ @@ -205,8 +218,6 @@ H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Feb 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -218,9 +229,9 @@ H5O__fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(fsinfo); + assert(f); + assert(p); + assert(fsinfo); *p++ = (uint8_t)fsinfo->version; /* message version */ *p++ = (uint8_t)fsinfo->strategy; /* File space strategy */ @@ -249,8 +260,6 @@ H5O__fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: Vailin Choi; Feb 2009 - * *------------------------------------------------------------------------- */ static void * @@ -263,9 +272,9 @@ H5O__fsinfo_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(fsinfo); + assert(fsinfo); if (!dest && NULL == (dest = H5FL_CALLOC(H5O_fsinfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ *dest = *fsinfo; @@ -287,8 +296,6 @@ H5O__fsinfo_copy(const void *_mesg, void *_dest) * Return: Success: Message data size in bytes without alignment. * Failure: zero * - * Programmer: Vailin Choi; Feb 2009 - * *------------------------------------------------------------------------- */ static size_t @@ -319,8 +326,6 @@ H5O__fsinfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const vo * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Feb 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -328,7 +333,7 @@ H5O__fsinfo_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5O_fsinfo_t, mesg); @@ -342,8 +347,6 @@ H5O__fsinfo_free(void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Feb 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -355,54 +358,54 @@ H5O__fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(fsinfo); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(fsinfo); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "File space strategy:"); + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "File space strategy:"); switch (fsinfo->strategy) { case H5F_FSPACE_STRATEGY_FSM_AGGR: - HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_FSM_AGGR"); + fprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_FSM_AGGR"); break; case H5F_FSPACE_STRATEGY_PAGE: - HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_PAGE"); + fprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_PAGE"); break; case H5F_FSPACE_STRATEGY_AGGR: - HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_AGGR"); + fprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_AGGR"); break; case H5F_FSPACE_STRATEGY_NONE: - HDfprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_NONE"); + fprintf(stream, "%s\n", "H5F_FSPACE_STRATEGY_NONE"); break; case H5F_FSPACE_STRATEGY_NTYPES: default: - HDfprintf(stream, "%s\n", "unknown"); + fprintf(stream, "%s\n", "unknown"); } /* end switch */ - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Free-space persist:", fsinfo->persist ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Free-space persist:", fsinfo->persist ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Free-space section threshold:", fsinfo->threshold); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Free-space section threshold:", fsinfo->threshold); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "File space page size:", fsinfo->page_size); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "File space page size:", fsinfo->page_size); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "Page end metadata threshold:", fsinfo->pgend_meta_thres); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "Page end metadata threshold:", fsinfo->pgend_meta_thres); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc); if (fsinfo->persist) { for (ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Free space manager address:", fsinfo->fs_addr[ptype - 1]); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Free space manager address:", fsinfo->fs_addr[ptype - 1]); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -415,8 +418,6 @@ H5O__fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi; June 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -429,7 +430,7 @@ H5O_fsinfo_set_version(H5F_libver_t low, H5F_libver_t high, H5O_fsinfo_t *fsinfo /* Sanity check */ HDcompile_assert(N_FSINFO_VERSION_BOUNDS == H5F_LIBVER_NBOUNDS); - HDassert(fsinfo); + assert(fsinfo); version = H5O_FSINFO_VERSION_1; @@ -439,7 +440,7 @@ H5O_fsinfo_set_version(H5F_libver_t low, H5F_libver_t high, H5O_fsinfo_t *fsinfo /* Version bounds check */ if (H5O_fsinfo_ver_bounds[high] == H5O_INVALID_VERSION || version > H5O_fsinfo_ver_bounds[high]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "File space info message's version out of bounds"); /* Set the message version */ fsinfo->version = version; @@ -455,9 +456,6 @@ H5O_fsinfo_set_version(H5F_libver_t low, H5F_libver_t high, H5O_fsinfo_t *fsinfo * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Summer 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -469,11 +467,11 @@ H5O_fsinfo_check_version(H5F_libver_t high, H5O_fsinfo_t *fsinfo) /* Sanity check */ HDcompile_assert(N_FSINFO_VERSION_BOUNDS == H5F_LIBVER_NBOUNDS); - HDassert(fsinfo); + assert(fsinfo); /* Check the version */ if (H5O_fsinfo_ver_bounds[high] == H5O_INVALID_VERSION || fsinfo->version > H5O_fsinfo_ver_bounds[high]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "File space info message's version out of bounds"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oginfo.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oginfo.c index ef0c434cfa..f8b12632ef 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oginfo.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oginfo.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5Oginfo.c - * Aug 23 2005 - * Quincey Koziol * - * Purpose: Group Information messages. + * Purpose: Group Information messages * *------------------------------------------------------------------------- */ @@ -79,70 +76,74 @@ H5FL_DEFINE_STATIC(H5O_ginfo_t); * Purpose: Decode a message and return a pointer to * a newly allocated one. * - * Return: Success: Ptr to new message in native order. - * - * Failure: NULL - * - * Programmer: Quincey Koziol - * Aug 30 2005 - * + * Return: Success: Pointer to new message in native order + * Failure: NULL *------------------------------------------------------------------------- */ static void * H5O__ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */ - unsigned char flags; /* Flags for encoding group info */ - void *ret_value = NULL; /* Return value */ + H5O_ginfo_t *ginfo = NULL; /* Pointer to group information message */ + unsigned char flags; /* Flags for encoding group info */ + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(p); + assert(f); + assert(p); /* Version of message */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (*p++ != H5O_GINFO_VERSION) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message"); /* Allocate space for message */ if (NULL == (ginfo = H5FL_CALLOC(H5O_ginfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Get the flags for the group */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + flags = *p++; if (flags & ~H5O_GINFO_ALL_FLAGS) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message"); ginfo->store_link_phase_change = (flags & H5O_GINFO_STORE_PHASE_CHANGE) ? TRUE : FALSE; ginfo->store_est_entry_info = (flags & H5O_GINFO_STORE_EST_ENTRY_INFO) ? TRUE : FALSE; /* Get the max. # of links to store compactly & the min. # of links to store densely */ if (ginfo->store_link_phase_change) { - UINT16DECODE(p, ginfo->max_compact) - UINT16DECODE(p, ginfo->min_dense) - } /* end if */ + if (H5_IS_BUFFER_OVERFLOW(p, 2 * 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT16DECODE(p, ginfo->max_compact); + UINT16DECODE(p, ginfo->min_dense); + } else { ginfo->max_compact = H5G_CRT_GINFO_MAX_COMPACT; ginfo->min_dense = H5G_CRT_GINFO_MIN_DENSE; - } /* end else */ + } /* Get the estimated # of entries & name lengths */ if (ginfo->store_est_entry_info) { - UINT16DECODE(p, ginfo->est_num_entries) - UINT16DECODE(p, ginfo->est_name_len) - } /* end if */ + if (H5_IS_BUFFER_OVERFLOW(p, 2 * 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT16DECODE(p, ginfo->est_num_entries); + UINT16DECODE(p, ginfo->est_name_len); + } else { ginfo->est_num_entries = H5G_CRT_GINFO_EST_NUM_ENTRIES; ginfo->est_name_len = H5G_CRT_GINFO_EST_NAME_LEN; - } /* end if */ + } /* Set return value */ ret_value = ginfo; done: - if (ret_value == NULL) - if (ginfo != NULL) - ginfo = H5FL_FREE(H5O_ginfo_t, ginfo); + if (!ret_value && ginfo) + H5FL_FREE(H5O_ginfo_t, ginfo); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__ginfo_decode() */ @@ -154,9 +155,6 @@ H5O__ginfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 30 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -169,8 +167,8 @@ H5O__ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(p); - HDassert(ginfo); + assert(p); + assert(ginfo); /* Message version */ *p++ = H5O_GINFO_VERSION; @@ -182,14 +180,14 @@ H5O__ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared /* Store the max. # of links to store compactly & the min. # of links to store densely */ if (ginfo->store_link_phase_change) { - UINT16ENCODE(p, ginfo->max_compact) - UINT16ENCODE(p, ginfo->min_dense) + UINT16ENCODE(p, ginfo->max_compact); + UINT16ENCODE(p, ginfo->min_dense); } /* end if */ /* Estimated # of entries & name lengths */ if (ginfo->store_est_entry_info) { - UINT16ENCODE(p, ginfo->est_num_entries) - UINT16ENCODE(p, ginfo->est_name_len) + UINT16ENCODE(p, ginfo->est_num_entries); + UINT16ENCODE(p, ginfo->est_name_len); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -205,9 +203,6 @@ H5O__ginfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared * * Failure: NULL * - * Programmer: Quincey Koziol - * Aug 30 2005 - * *------------------------------------------------------------------------- */ static void * @@ -220,9 +215,9 @@ H5O__ginfo_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(ginfo); + assert(ginfo); if (!dest && NULL == (dest = H5FL_MALLOC(H5O_ginfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ *dest = *ginfo; @@ -245,9 +240,6 @@ H5O__ginfo_copy(const void *_mesg, void *_dest) * * Failure: zero * - * Programmer: Quincey Koziol - * Aug 30 2005 - * *------------------------------------------------------------------------- */ static size_t @@ -280,9 +272,6 @@ H5O__ginfo_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sh * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, August 30, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -290,7 +279,7 @@ H5O__ginfo_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5O_ginfo_t, mesg); @@ -304,9 +293,6 @@ H5O__ginfo_free(void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 30 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -317,18 +303,18 @@ H5O__ginfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(ginfo); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. compact links:", ginfo->max_compact); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Min. dense links:", ginfo->min_dense); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Estimated # of objects in group:", ginfo->est_num_entries); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Estimated length of object in group's name:", ginfo->est_name_len); + assert(f); + assert(ginfo); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Max. compact links:", ginfo->max_compact); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Min. dense links:", ginfo->min_dense); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Estimated # of objects in group:", ginfo->est_num_entries); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Estimated length of object in group's name:", ginfo->est_name_len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__ginfo_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oint.c index 5c782a1e1a..a367ffc4b6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -209,8 +208,6 @@ H5O_init(void) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi; December 2017 - * *------------------------------------------------------------------------- */ static herr_t @@ -222,8 +219,8 @@ H5O__set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_id FUNC_ENTER_PACKAGE /* check arguments */ - HDassert(f); - HDassert(oh); + assert(f); + assert(oh); /* Set the correct version to encode object header with */ if (store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) @@ -236,7 +233,7 @@ H5O__set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_id /* Version bounds check */ if (version > H5O_obj_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "object header version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "object header version out of bounds"); /* Set the message version */ oh->version = version; @@ -259,9 +256,6 @@ H5O__set_version(H5F_t *f, H5O_t *oh, uint8_t oh_flags, hbool_t store_msg_crt_id * * Failure: Negative * - * Programmer: Robb Matzke - * Aug 5 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -272,25 +266,25 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id, H5O_loc FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(loc); - HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE)); + assert(f); + assert(loc); + assert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE)); /* create object header in freelist * header version is set internally */ oh = H5O_create_ohdr(f, ocpl_id); if (NULL == oh) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't instantiate object header") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't instantiate object header"); /* apply object header information to file */ if (H5O_apply_ohdr(f, oh, ocpl_id, size_hint, initial_rc, loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't apply object header to file") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't apply object header to file"); done: if ((FAIL == ret_value) && (NULL != oh) && (H5O__free(oh, TRUE) < 0)) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "can't delete object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "can't delete object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_create() */ @@ -303,9 +297,6 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id, H5O_loc * Return: Success: Pointer to the newly-crated header object. * Failure: NULL * - * Programmer: Jacob Smith - * 2018 August 17 - * *----------------------------------------------------------------------------- */ H5O_t * @@ -318,35 +309,35 @@ H5O_create_ohdr(H5F_t *f, hid_t ocpl_id) FUNC_ENTER_NOAPI(NULL) - HDassert(f); - HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE)); + assert(f); + assert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE)); /* Check for invalid access request */ if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file"); oh = H5FL_CALLOC(H5O_t); if (NULL == oh) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id); if (NULL == oc_plist) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a property list"); /* Get any object header status flags set by properties */ if (H5P_DATASET_CREATE_DEFAULT == ocpl_id) { /* If the OCPL is the default DCPL, we can get the header flags from the * API context. Otherwise we have to call H5P_get */ if (H5CX_get_ohdr_flags(&oh_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags"); } else { if (H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags"); } if (H5O__set_version(f, oh, oh_flags, H5F_STORE_MSG_CRT_IDX(f)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set version of object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set version of object header"); oh->flags = oh_flags; @@ -354,7 +345,7 @@ H5O_create_ohdr(H5F_t *f, hid_t ocpl_id) done: if ((NULL == ret_value) && (NULL != oh) && (H5O__free(oh, TRUE) < 0)) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "can't delete object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "can't delete object header"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O_create_ohdr() */ @@ -368,9 +359,6 @@ H5O_create_ohdr(H5F_t *f, hid_t ocpl_id) * Return: Success: SUCCEED (0) (non-negative value) * Failure: FAIL (-1) (negative value) * - * Programmer: Jacob Smith - * 2018 August 17 - * *----------------------------------------------------------------------------- */ herr_t @@ -384,10 +372,10 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(loc_out); - HDassert(oh); - HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE)); + assert(f); + assert(loc_out); + assert(oh); + assert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE)); /* Allocate at least a reasonable size for the object header */ size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint)); @@ -401,14 +389,14 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init if (0 < H5P_exist_plist(oc_plist, H5O_BAD_MESG_COUNT_NAME)) /* Get bad message count flag -- from property list */ if (H5P_get(oc_plist, H5O_BAD_MESG_COUNT_NAME, &oh->store_bad_mesg_count) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get bad message count flag") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get bad message count flag"); #endif /* H5O_ENABLE_BAD_MESG_COUNT */ /* Create object header proxy if doing SWMR writes */ if (oh->swmr_write) { oh->proxy = H5AC_proxy_entry_create(); if (NULL == oh->proxy) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy"); } else { oh->proxy = NULL; @@ -416,7 +404,7 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id); if (NULL == oc_plist) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list"); /* Initialize version-specific fields */ if (oh->version > H5O_VERSION_1) { @@ -432,9 +420,9 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init /* Get attribute storage phase change values -- from property list */ if (H5P_get(oc_plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &oh->max_compact) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get max. # of compact attributes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get max. # of compact attributes"); if (H5P_get(oc_plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &oh->min_dense) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get min. # of dense attributes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get min. # of dense attributes"); /* Check for non-default attribute storage phase change values */ if (H5O_CRT_ATTR_MAX_COMPACT_DEF != oh->max_compact || H5O_CRT_ATTR_MIN_DENSE_DEF != oh->min_dense) @@ -468,14 +456,14 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init /* Allocate disk space for header and first chunk */ oh_addr = H5MF_alloc(f, H5FD_MEM_OHDR, (hsize_t)oh_size); if (HADDR_UNDEF == oh_addr) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for object header"); /* Create the chunk list */ oh->nchunks = 1; oh->alloc_nchunks = 1; oh->chunk = H5FL_SEQ_MALLOC(H5O_chunk_t, (size_t)oh->alloc_nchunks); if (NULL == oh->chunk) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize the first chunk */ oh->chunk[0].addr = oh_addr; @@ -486,7 +474,7 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init /* (including space for serializing the object header prefix */ oh->chunk[0].image = H5FL_BLK_CALLOC(chunk_image, oh_size); if (NULL == oh->chunk[0].image) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); oh->chunk[0].chunk_proxy = NULL; /* Put magic # for object header in first chunk */ @@ -498,7 +486,7 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init oh->alloc_nmesgs = H5O_NMESGS; oh->mesg = H5FL_SEQ_CALLOC(H5O_mesg_t, oh->alloc_nmesgs); if (NULL == oh->mesg) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize the initial "null" message; covers the entire first chunk */ oh->mesg[0].type = H5O_MSG_NULL; @@ -517,11 +505,11 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init } /* Set metadata tag in API context */ - H5_BEGIN_TAG(oh_addr); + H5_BEGIN_TAG(oh_addr) /* Cache object header */ if (H5AC_insert_entry(f, H5AC_OHDR, oh_addr, oh, insert_flags) < 0) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header"); /* Reset object header pointer, now that it's been inserted into the cache */ oh = NULL; @@ -534,10 +522,10 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init loc_out->addr = oh_addr; if (H5O_open(loc_out) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object header"); done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* H5O_apply_ohdr() */ /*------------------------------------------------------------------------- @@ -547,15 +535,6 @@ H5O_apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t init * entry OBJ_ENT. * * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Monday, January 5, 1998 - * - * Modification: - * Raymond Lu - * 5 November 2007 - * Turn off the holding file variable if it's on. When it's - * needed, the caller will turn it on again. *------------------------------------------------------------------------- */ herr_t @@ -566,12 +545,12 @@ H5O_open(H5O_loc_t *loc) FUNC_ENTER_NOAPI_NOERR /* Check args */ - HDassert(loc); - HDassert(loc->file); + assert(loc); + assert(loc->file); #ifdef H5O_DEBUG if (H5DEBUG(O)) - HDfprintf(H5DEBUG(O), "> %" PRIuHADDR "\n", loc->addr); + fprintf(H5DEBUG(O), "> %" PRIuHADDR "\n", loc->addr); #endif /* Turn off the variable for holding file or increment open-lock counters */ @@ -591,9 +570,6 @@ H5O_open(H5O_loc_t *loc) * Return: Success: Pointer to object data * Failure: NULL * - * Programmer: Quincey Koziol - * March 5 2007 - * *------------------------------------------------------------------------- */ void * @@ -608,8 +584,8 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type) FUNC_ENTER_NOAPI(NULL) /* Check args */ - HDassert(loc); - HDassert(name && *name); + assert(loc); + assert(name && *name); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -618,17 +594,17 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type) /* Find the object's location */ if (H5G_loc_find(loc, name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "object not found"); loc_found = TRUE; /* Open the object */ if (NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object"); done: if (NULL == ret_value) if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_open_name() */ @@ -641,9 +617,6 @@ H5O_open_name(const H5G_loc_t *loc, const char *name, H5I_type_t *opened_type) * Return: Success: Pointer to object data * Failure: NULL * - * Programmer: Quincey Koziol - * December 28, 2017 - * *------------------------------------------------------------------------- */ void * @@ -659,7 +632,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5 FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); + assert(loc); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -668,18 +641,18 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5 /* Find the object's location, according to the order in the index */ if (H5G_loc_find_by_idx(loc, name, idx_type, order, n, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "group not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "group not found"); loc_found = TRUE; /* Open the object */ if (NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object"); done: /* Release the object location if we failed after copying it */ if (NULL == ret_value) if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, NULL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__open_by_idx() */ @@ -692,9 +665,6 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type, H5 * Return: Success: Pointer to object data * Failure: NULL * - * Programmer: Quincey Koziol - * December 28, 2017 - * *------------------------------------------------------------------------- */ void * @@ -708,7 +678,7 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(loc); + assert(loc); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -720,7 +690,7 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type) /* Open the object */ if (NULL == (ret_value = H5O_open_by_loc(&obj_loc, opened_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -734,9 +704,6 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr, H5I_type_t *opened_type) * Return: Success: Pointer to object data * Failure: NULL * - * Programmer: James Laird - * July 25 2006 - * *------------------------------------------------------------------------- */ void * @@ -747,16 +714,16 @@ H5O_open_by_loc(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) FUNC_ENTER_NOAPI(NULL) - HDassert(obj_loc); + assert(obj_loc); /* Get the object class for this location */ if (NULL == (obj_class = H5O__obj_class(obj_loc->oloc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object class") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object class"); /* Call the object class's 'open' routine */ - HDassert(obj_class->open); + assert(obj_class->open); if (NULL == (ret_value = obj_class->open(obj_loc, opened_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -769,9 +736,6 @@ H5O_open_by_loc(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, January 5, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -782,9 +746,9 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_NOPEN_OBJS(loc->file) > 0); + assert(loc); + assert(loc->file); + assert(H5F_NOPEN_OBJS(loc->file) > 0); /* Set the file_closed flag to the default value. * This flag lets downstream code know if the file struct is @@ -801,10 +765,10 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) #ifdef H5O_DEBUG if (H5DEBUG(O)) { if (FALSE == H5F_ID_EXISTS(loc->file) && 1 == H5F_NREFS(loc->file)) - HDfprintf(H5DEBUG(O), "< %" PRIuHADDR " auto %lu remaining\n", loc->addr, - (unsigned long)H5F_NOPEN_OBJS(loc->file)); + fprintf(H5DEBUG(O), "< %" PRIuHADDR " auto %lu remaining\n", loc->addr, + (unsigned long)H5F_NOPEN_OBJS(loc->file)); else - HDfprintf(H5DEBUG(O), "< %" PRIuHADDR "\n", loc->addr); + fprintf(H5DEBUG(O), "< %" PRIuHADDR "\n", loc->addr); } #endif @@ -815,11 +779,11 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) if (H5F_NOPEN_OBJS(loc->file) == H5F_NMOUNTS(loc->file)) /* Attempt to close down the file hierarchy */ if (H5F_try_close(loc->file, file_closed) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "problem attempting file close"); /* Release location information */ if (H5O_loc_free(loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "problem attempting to free location") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "problem attempting to free location"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -835,9 +799,6 @@ H5O_close(H5O_loc_t *loc, hbool_t *file_closed /*out*/) * * Failure: -1 * - * Programmer: Robb Matzke - * Aug 5 1997 - * *------------------------------------------------------------------------- */ int @@ -849,23 +810,23 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); - HDassert(deleted); + assert(f); + assert(oh); + assert(deleted); /* Check for adjusting link count */ if (adjust) { if (adjust < 0) { /* Check for too large of an adjustment */ if ((unsigned)(-adjust) > oh->nlink) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, (-1), "link count would be negative") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, (-1), "link count would be negative"); /* Adjust the link count for the object header */ oh->nlink = (unsigned)((int)oh->nlink + adjust); /* Mark object header as dirty in cache */ if (H5AC_mark_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty"); /* Check if the object should be deleted */ if (oh->nlink == 0) { @@ -873,7 +834,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if (H5FO_opened(f, addr) != NULL) { /* Flag the object to be deleted when it's closed */ if (H5FO_mark(f, addr, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion"); } /* end if */ else { /* Mark the object header for deletion */ @@ -888,7 +849,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if (H5FO_marked(f, addr)) { /* Remove "delete me" flag on the object */ if (H5FO_mark(f, addr, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "can't mark object for deletion"); } /* end if */ } /* end if */ @@ -897,7 +858,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) /* Mark object header as dirty in cache */ if (H5AC_mark_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, (-1), "unable to mark object header as dirty"); } /* end if */ /* Check for operations on refcount message */ @@ -907,7 +868,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) /* Check for removing refcount message */ if (oh->nlink <= 1) { if (H5O__msg_remove_real(f, oh, H5O_MSG_REFCOUNT, H5O_ALL, NULL, NULL, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "unable to delete refcount message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, (-1), "unable to delete refcount message"); oh->has_refcount_msg = FALSE; } /* end if */ /* Update refcount message with new link count */ @@ -916,7 +877,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if (H5O__msg_write_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, (-1), "unable to update refcount message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, (-1), "unable to update refcount message"); } /* end else */ } /* end if */ else { @@ -926,7 +887,7 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) if (H5O__msg_append_real(f, oh, H5O_MSG_REFCOUNT, H5O_MSG_FLAG_DONTSHARE, 0, &refcount) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, (-1), "unable to create new refcount message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, (-1), "unable to create new refcount message"); oh->has_refcount_msg = TRUE; } /* end if */ } /* end else */ @@ -950,9 +911,6 @@ H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted) * * Failure: Negative * - * Programmer: Robb Matzke - * Aug 5 1997 - * *------------------------------------------------------------------------- */ int @@ -965,23 +923,23 @@ H5O_link(const H5O_loc_t *loc, int adjust) FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL) /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); /* Pin the object header */ if (NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header"); /* Call the "real" link routine */ if ((ret_value = H5O__link_oh(loc->file, adjust, oh, &deleted)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust object link count") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust object link count"); done: if (oh && H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); if (ret_value >= 0 && deleted && H5O_delete(loc->file, loc->addr) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file") + HDONE_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_link() */ @@ -997,9 +955,6 @@ H5O_link(const H5O_loc_t *loc, int adjust) * object. * Failure: NULL * - * Programmer: Quincey Koziol - * Dec 31 2002 - * *------------------------------------------------------------------------- */ H5O_t * @@ -1014,20 +969,20 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) FUNC_ENTER_NOAPI_TAG(loc->addr, NULL) /* check args */ - HDassert(loc); - HDassert(loc->file); + assert(loc); + assert(loc->file); /* prot_flags may only contain the H5AC__READ_ONLY_FLAG */ - HDassert((prot_flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); + assert((prot_flags & (unsigned)(~H5AC__READ_ONLY_FLAG)) == 0); /* Check for valid address */ - if (!H5F_addr_defined(loc->addr)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "address undefined") + if (!H5_addr_defined(loc->addr)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "address undefined"); /* Check for write access on the file */ file_intent = H5F_INTENT(loc->file); if ((0 == (prot_flags & H5AC__READ_ONLY_FLAG)) && (0 == (file_intent & H5F_ACC_RDWR))) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file"); /* Construct the user data for protect callback */ udata.made_attempt = FALSE; @@ -1038,13 +993,13 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) udata.common.f = loc->file; udata.common.file_intent = file_intent; udata.common.merged_null_msgs = 0; - HDmemset(&cont_msg_info, 0, sizeof(cont_msg_info)); + memset(&cont_msg_info, 0, sizeof(cont_msg_info)); udata.common.cont_msg_info = &cont_msg_info; udata.common.addr = loc->addr; /* Lock the object header into the cache */ if (NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_OHDR, loc->addr, &udata, prot_flags))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header"); /* Check if there are any continuation messages to process */ if (cont_msg_info.nmsgs > 0) { @@ -1054,8 +1009,8 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) /* Sanity check - we should only have continuation messages to process * when the object header is actually loaded from the file. */ - HDassert(udata.made_attempt == TRUE); - HDassert(cont_msg_info.msgs); + assert(udata.made_attempt == TRUE); + assert(cont_msg_info.msgs); /* Construct the user data for protecting chunks */ chk_udata.decoding = TRUE; @@ -1084,17 +1039,17 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) if (NULL == (chk_proxy = (H5O_chunk_proxy_t *)H5AC_protect(loc->file, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, &chk_udata, prot_flags))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header chunk"); /* Sanity check */ - HDassert(chk_proxy->oh == oh); - HDassert(chk_proxy->chunkno == chkcnt); - HDassert(oh->nchunks == (chkcnt + 1)); + assert(chk_proxy->oh == oh); + assert(chk_proxy->chunkno == chkcnt); + assert(oh->nchunks == (chkcnt + 1)); /* Release the chunk from the cache */ if (H5AC_unprotect(loc->file, H5AC_OHDR_CHK, cont_msg_info.msgs[curr_msg].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header chunk"); /* Advance to next continuation message */ curr_msg++; @@ -1121,7 +1076,7 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) /* Check for incorrect # of messages in v1 object header */ if (oh->version == H5O_VERSION_1 && (oh->nmesgs + udata.common.merged_null_msgs) != udata.v1_pfx_nmesgs) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "corrupt object header - incorrect # of messages") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "corrupt object header - incorrect # of messages"); #endif /* H5_STRICT_FORMAT_CHECKS */ } /* end if */ @@ -1136,7 +1091,7 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) unsigned u; /* Local index variable */ /* Sanity check */ - HDassert(oh->swmr_write); + assert(oh->swmr_write); /* Iterate over chunks > 0 */ for (u = 1; u < oh->nchunks; u++) { @@ -1144,15 +1099,15 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(loc->file, oh, u))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header chunk"); /* Pin chunk proxy*/ if (H5AC_pin_protected_entry(chk_proxy) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, NULL, "unable to pin object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, NULL, "unable to pin object header chunk"); /* Unprotect chunk */ if (H5O__chunk_unprotect(loc->file, chk_proxy, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to unprotect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to unprotect object header chunk"); /* Preserve chunk proxy pointer for later */ oh->chunk[u].chunk_proxy = chk_proxy; @@ -1166,9 +1121,14 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) ret_value = oh; done: - if (ret_value == NULL && oh) + if (ret_value == NULL && oh) { + /* Release any continuation messages built up */ + if (cont_msg_info.msgs) + cont_msg_info.msgs = (H5O_cont_t *)H5FL_SEQ_FREE(H5O_cont_t, cont_msg_info.msgs); + if (H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header"); + } FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_protect() */ @@ -1184,9 +1144,6 @@ H5O_protect(const H5O_loc_t *loc, unsigned prot_flags, hbool_t pin_all_chunks) * object. * Failure: NULL * - * Programmer: Quincey Koziol - * Jul 13 2008 - * *------------------------------------------------------------------------- */ H5O_t * @@ -1198,16 +1155,16 @@ H5O_pin(const H5O_loc_t *loc) FUNC_ENTER_NOAPI(NULL) /* check args */ - HDassert(loc); + assert(loc); /* Get header */ if (NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header"); /* Increment the reference count on the object header */ /* (which will pin it, if appropriate) */ if (H5O__inc_rc(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, NULL, "unable to increment reference count on object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, NULL, "unable to increment reference count on object header"); /* Set the return value */ ret_value = oh; @@ -1215,7 +1172,7 @@ H5O_pin(const H5O_loc_t *loc) done: /* Release the object header from the cache */ if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_pin() */ @@ -1229,9 +1186,6 @@ H5O_pin(const H5O_loc_t *loc) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Jul 13 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -1242,12 +1196,12 @@ H5O_unpin(H5O_t *oh) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(oh); + assert(oh); /* Decrement the reference count on the object header */ /* (which will unpin it, if appropriate) */ if (H5O__dec_rc(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1263,9 +1217,6 @@ H5O_unpin(H5O_t *oh) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Dec 31 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -1276,22 +1227,22 @@ H5O_unprotect(const H5O_loc_t *loc, H5O_t *oh, unsigned oh_flags) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(loc); - HDassert(oh); + assert(loc); + assert(oh); /* Unpin the other chunks */ if (oh->chunks_pinned && oh->nchunks > 1) { unsigned u; /* Local index variable */ /* Sanity check */ - HDassert(oh->swmr_write); + assert(oh->swmr_write); /* Iterate over chunks > 0 */ for (u = 1; u < oh->nchunks; u++) { if (NULL != oh->chunk[u].chunk_proxy) { /* Release chunk proxy */ if (H5AC_unpin_entry(oh->chunk[u].chunk_proxy) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header chunk"); oh->chunk[u].chunk_proxy = NULL; } /* end if */ } /* end for */ @@ -1302,7 +1253,7 @@ H5O_unprotect(const H5O_loc_t *loc, H5O_t *oh, unsigned oh_flags) /* Unprotect the object header */ if (H5AC_unprotect(loc->file, H5AC_OHDR, oh->chunk[0].addr, oh, oh_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1317,9 +1268,6 @@ H5O_unprotect(const H5O_loc_t *loc, H5O_t *oh, unsigned oh_flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, July 27, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1332,8 +1280,8 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) FUNC_ENTER_NOAPI_NOINIT - HDassert(f); - HDassert(oh); + assert(f); + assert(oh); /* Check if this object header is tracking times */ if (oh->flags & H5O_HDR_STORE_TIMES) { @@ -1360,7 +1308,7 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) /* Allocate space for the modification time message */ if (H5O__msg_alloc(f, oh, H5O_MSG_MTIME_NEW, &mesg_flags, &now, &idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, - "unable to allocate space for modification time message") + "unable to allocate space for modification time message"); /* Set the message's flags if appropriate */ oh->mesg[idx].flags = (uint8_t)mesg_flags; @@ -1368,13 +1316,13 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(f, oh, oh->mesg[idx].chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header chunk"); /* Allocate 'native' space, if necessary */ if (NULL == oh->mesg[idx].native) { if (NULL == (oh->mesg[idx].native = H5FL_MALLOC(time_t))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, - "memory allocation failed for modification time message") + "memory allocation failed for modification time message"); } /* end if */ /* Update the message */ @@ -1392,14 +1340,14 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) /* Mark object header as dirty in cache */ if (H5AC_mark_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty"); } /* end else */ } /* end if */ done: /* Release chunk */ if (chk_proxy && H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header chunk"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_touch_oh() */ @@ -1414,9 +1362,6 @@ H5O_touch_oh(H5F_t *f, H5O_t *oh, hbool_t force) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, July 27, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1429,22 +1374,22 @@ H5O_touch(const H5O_loc_t *loc, hbool_t force) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(loc); + assert(loc); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Create/Update the modification time message */ if (H5O_touch_oh(loc->file, oh, force) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to update object modification time") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to update object modification time"); /* Mark object header as changed */ oh_flags |= H5AC__DIRTIED_FLAG; done: if (oh && H5O_unprotect(loc, oh, oh_flags) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_touch() */ @@ -1458,9 +1403,6 @@ H5O_touch(const H5O_loc_t *loc, hbool_t force) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, January 21, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1472,8 +1414,8 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(oh); + assert(f); + assert(oh); /* Look for existing message */ for (idx = 0; idx < oh->nmesgs; idx++) @@ -1486,7 +1428,7 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) /* Allocate the native message in memory */ if (NULL == (bogus = H5MM_malloc(sizeof(H5O_bogus_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "memory allocation failed for 'bogus' message"); /* Update the native value */ bogus->u = H5O_BOGUS_VALUE; @@ -1496,11 +1438,11 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) else if (bogus_id == H5O_BOGUS_INVALID_ID) type = H5O_MSG_BOGUS_INVALID; else - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "invalid ID for 'bogus' message") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "invalid ID for 'bogus' message"); /* Allocate space in the object header for bogus message */ if (H5O__msg_alloc(f, oh, type, &mesg_flags, bogus, &idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message"); /* Point to "bogus" information (take it over) */ oh->mesg[idx].native = bogus; @@ -1528,9 +1470,6 @@ H5O_bogus_oh(H5F_t *f, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 19 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1545,8 +1484,8 @@ H5O_delete(H5F_t *f, haddr_t addr) FUNC_ENTER_NOAPI_TAG(addr, FAIL) /* Check args */ - HDassert(f); - HDassert(H5F_addr_defined(addr)); + assert(f); + assert(H5_addr_defined(addr)); /* Set up the object location */ loc.file = f; @@ -1555,25 +1494,25 @@ H5O_delete(H5F_t *f, haddr_t addr) /* Get the object header information */ if (NULL == (oh = H5O_protect(&loc, H5AC__NO_FLAGS_SET, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Delete object */ if (H5O__delete_oh(f, oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file"); /* Uncork cache entries with tag: addr */ if (H5AC_cork(f, addr, H5AC__GET_CORKED, &corked) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status"); if (corked) if (H5AC_cork(f, addr, H5AC__UNCORK, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork an object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork an object"); /* Mark object header as deleted */ oh_flags = H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; done: if (oh && H5O_unprotect(&loc, oh, oh_flags) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_delete() */ @@ -1589,9 +1528,6 @@ H5O_delete(H5F_t *f, haddr_t addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 19 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -1604,8 +1540,8 @@ H5O__delete_oh(H5F_t *f, H5O_t *oh) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(oh); + assert(f); + assert(oh); /* Walk through the list of object header messages, asking each one to * delete any file space used @@ -1614,7 +1550,7 @@ H5O__delete_oh(H5F_t *f, H5O_t *oh) /* Free any space referred to in the file from this message */ if (H5O__delete_mesg(f, oh, curr_msg) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, - "unable to delete file space for object header message") + "unable to delete file space for object header message"); } /* end for */ done: @@ -1629,9 +1565,6 @@ H5O__delete_oh(H5F_t *f, H5O_t *oh) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, November 4, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1644,15 +1577,15 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type) /* Load the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Retrieve the type of the object */ if (H5O__obj_type_real(oh, obj_type) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type"); done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_obj_type() */ @@ -1665,9 +1598,6 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, November 21, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -1678,8 +1608,8 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(oh); - HDassert(obj_type); + assert(oh); + assert(obj_type); /* Look up class for object header */ if (NULL == (obj_class = H5O__obj_class_real(oh))) { @@ -1704,9 +1634,6 @@ H5O__obj_type_real(const H5O_t *oh, H5O_type_t *obj_type) * Return: Success: An object class * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ const H5O_obj_class_t * @@ -1719,15 +1646,15 @@ H5O__obj_class(const H5O_loc_t *loc) /* Load the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header"); /* Test whether entry qualifies as a particular type of object */ if (NULL == (ret_value = H5O__obj_class_real(oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object type"); done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O__obj_class() */ @@ -1740,9 +1667,6 @@ H5O__obj_class(const H5O_loc_t *loc) * Return: Success: An object class * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, November 21, 2005 - * *------------------------------------------------------------------------- */ static const H5O_obj_class_t * @@ -1754,7 +1678,7 @@ H5O__obj_class_real(const H5O_t *oh) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(oh); + assert(oh); /* Test whether entry qualifies as a particular type of object */ /* (Note: loop is in reverse order, to test specific objects first) */ @@ -1762,13 +1686,13 @@ H5O__obj_class_real(const H5O_t *oh) htri_t isa; /* Is entry a particular type? */ if ((isa = (H5O_obj_class_g[i - 1]->isa)(oh)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type"); else if (isa) - HGOTO_DONE(H5O_obj_class_g[i - 1]) + HGOTO_DONE(H5O_obj_class_g[i - 1]); } if (0 == i) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1782,9 +1706,6 @@ H5O__obj_class_real(const H5O_t *oh) * Return: Success: Pointer to H5O_loc_t * Failure: NULL * - * Programmer: James Laird - * July 25 2006 - * *------------------------------------------------------------------------- */ H5O_loc_t * @@ -1797,21 +1718,21 @@ H5O_get_loc(hid_t object_id) switch (H5I_get_type(object_id)) { case H5I_GROUP: if (NULL == (ret_value = H5O_OBJ_GROUP->get_oloc(object_id))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from group ID") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from group ID"); break; case H5I_DATASET: if (NULL == (ret_value = H5O_OBJ_DATASET->get_oloc(object_id))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from dataset ID") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from dataset ID"); break; case H5I_DATATYPE: if (NULL == (ret_value = H5O_OBJ_DATATYPE->get_oloc(object_id))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from datatype ID") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from datatype ID"); break; case H5I_MAP: - HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "maps not supported in native VOL connector") + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "maps not supported in native VOL connector"); case H5I_UNINIT: case H5I_BADID: @@ -1829,7 +1750,7 @@ H5O_get_loc(hid_t object_id) case H5I_EVENTSET: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type") + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type"); } /* end switch */ done: @@ -1844,9 +1765,6 @@ H5O_get_loc(hid_t object_id) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, September 19, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1855,10 +1773,10 @@ H5O_loc_reset(H5O_loc_t *loc) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments */ - HDassert(loc); + assert(loc); /* Clear the object location to an empty state */ - HDmemset(loc, 0, sizeof(H5O_loc_t)); + memset(loc, 0, sizeof(H5O_loc_t)); loc->addr = HADDR_UNDEF; FUNC_LEAVE_NOAPI(SUCCEED) @@ -1872,9 +1790,6 @@ H5O_loc_reset(H5O_loc_t *loc) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, September 19, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -1883,9 +1798,9 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments */ - HDassert(src); - HDassert(dst); - HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP); + assert(src); + assert(dst); + assert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP); /* Invoke correct routine */ if (depth == H5_COPY_SHALLOW) @@ -1907,9 +1822,6 @@ H5O_loc_copy(H5O_loc_t *dst, H5O_loc_t *src, H5_copy_depth_t depth) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * January 18, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -1918,8 +1830,8 @@ H5O_loc_copy_shallow(H5O_loc_t *dst, H5O_loc_t *src) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments */ - HDassert(src); - HDassert(dst); + assert(src); + assert(dst); /* Copy the top level information */ H5MM_memcpy(dst, src, sizeof(H5O_loc_t)); @@ -1940,9 +1852,6 @@ H5O_loc_copy_shallow(H5O_loc_t *dst, H5O_loc_t *src) * Return: Success: Non-negative * Failure: Negative * - * Programmer: David Young - * January 18, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -1951,8 +1860,8 @@ H5O_loc_copy_deep(H5O_loc_t *dst, const H5O_loc_t *src) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments */ - HDassert(src); - HDassert(dst); + assert(src); + assert(dst); /* Copy the top level information */ H5MM_memcpy(dst, src, sizeof(H5O_loc_t)); @@ -1975,9 +1884,6 @@ H5O_loc_copy_deep(H5O_loc_t *dst, const H5O_loc_t *src) * Return: Success: Non-negative * Failure: Negative * - * Programmer: James Laird - * Wednesday, August 16, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1986,8 +1892,8 @@ H5O_loc_hold_file(H5O_loc_t *loc) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check arguments */ - HDassert(loc); - HDassert(loc->file); + assert(loc); + assert(loc->file); /* If this location is not already holding its file open, do so. */ if (!loc->holding_file) { @@ -2008,9 +1914,6 @@ H5O_loc_hold_file(H5O_loc_t *loc) * Return: Success: Non-negative * Failure: Negative * - * Programmer: James Laird - * Wednesday, August 16, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2021,7 +1924,7 @@ H5O_loc_free(H5O_loc_t *loc) FUNC_ENTER_NOAPI_NOINIT /* Check arguments */ - HDassert(loc); + assert(loc); /* If this location is holding its file open try to close the file. */ if (loc->holding_file) { @@ -2029,7 +1932,7 @@ H5O_loc_free(H5O_loc_t *loc) loc->holding_file = FALSE; if (H5F_NOPEN_OBJS(loc->file) <= 0) { if (H5F_try_close(loc->file, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file"); } } @@ -2045,9 +1948,6 @@ H5O_loc_free(H5O_loc_t *loc) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * September 22 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -2059,23 +1959,23 @@ H5O_get_hdr_info(const H5O_loc_t *loc, H5O_hdr_info_t *hdr) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(loc); - HDassert(hdr); + assert(loc); + assert(hdr); /* Reset the object header info structure */ - HDmemset(hdr, 0, sizeof(*hdr)); + memset(hdr, 0, sizeof(*hdr)); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header"); /* Get the information for the object header */ if (H5O__get_hdr_info_real(oh, hdr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info"); done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_hdr_info() */ @@ -2088,9 +1988,6 @@ H5O_get_hdr_info(const H5O_loc_t *loc, H5O_hdr_info_t *hdr) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * September 22 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -2103,8 +2000,8 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(oh); - HDassert(hdr); + assert(oh); + assert(hdr); /* Set the version for the object header */ hdr->version = oh->version; @@ -2155,7 +2052,7 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) } /* end for */ /* Sanity check that all the bytes are accounted for */ - HDassert(hdr->space.total == (hdr->space.free + hdr->space.meta + hdr->space.mesg)); + assert(hdr->space.total == (hdr->space.free + hdr->space.meta + hdr->space.mesg)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__get_hdr_info_real() */ @@ -2168,9 +2065,6 @@ H5O__get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * November 21 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2183,20 +2077,20 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields) FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL) /* Check args */ - HDassert(loc); - HDassert(oinfo); + assert(loc); + assert(oinfo); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Get class for object */ if (NULL == (obj_class = H5O__obj_class_real(oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class"); /* Reset the object info structure */ if (H5O__reset_info2(oinfo) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't reset object data struct"); /* Get basic information, if requested */ if (fields & H5O_INFO_BASIC) { @@ -2205,7 +2099,7 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields) /* Set the object's address into the token */ if (H5VL_native_addr_to_token(loc->file, H5I_FILE, loc->addr, &oinfo->token) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, "can't serialize address into object token"); /* Retrieve the type of the object */ oinfo->type = obj_class->type; @@ -2236,20 +2130,20 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields) /* Might be information for modification time */ if ((exists = H5O_msg_exists_oh(oh, H5O_MTIME_ID)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message"); if (exists > 0) { /* Get "old style" modification time info */ if (NULL == H5O_msg_read_oh(loc->file, oh, H5O_MTIME_ID, &oinfo->ctime)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message"); } /* end if */ else { /* Check for "new style" modification time info */ if ((exists = H5O_msg_exists_oh(oh, H5O_MTIME_NEW_ID)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message"); if (exists > 0) { /* Get "new style" modification time info */ if (NULL == H5O_msg_read_oh(loc->file, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message"); } /* end if */ else oinfo->ctime = 0; @@ -2260,11 +2154,11 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields) /* Retrieve # of attributes */ if (fields & H5O_INFO_NUM_ATTRS) if (H5O__attr_count_real(loc->file, oh, &oinfo->num_attrs) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count"); done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_get_info() */ @@ -2277,9 +2171,6 @@ H5O_get_info(const H5O_loc_t *loc, H5O_info2_t *oinfo, unsigned fields) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * November 21 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2292,24 +2183,24 @@ H5O_get_native_info(const H5O_loc_t *loc, H5O_native_info_t *oinfo, unsigned fie FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL) /* Check args */ - HDassert(loc); - HDassert(oinfo); + assert(loc); + assert(oinfo); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Get class for object */ if (NULL == (obj_class = H5O__obj_class_real(oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine object class"); /* Reset the object info structure */ - HDmemset(oinfo, 0, sizeof(*oinfo)); + memset(oinfo, 0, sizeof(*oinfo)); /* Get the information for the object header, if requested */ if (fields & H5O_NATIVE_INFO_HDR) if (H5O__get_hdr_info_real(oh, &oinfo->hdr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info"); /* Get B-tree & heap metadata storage size, if requested */ if (fields & H5O_NATIVE_INFO_META_SIZE) { @@ -2317,16 +2208,16 @@ H5O_get_native_info(const H5O_loc_t *loc, H5O_native_info_t *oinfo, unsigned fie if (obj_class->bh_info) /* Call the object's class 'bh_info' routine */ if ((obj_class->bh_info)(loc, oh, &oinfo->meta_size.obj) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info"); /* Get B-tree & heap info for any attributes */ if (H5O__attr_bh_info(loc->file, oh, &oinfo->meta_size.attr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info"); } /* end if */ done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_get_native_info() */ @@ -2339,9 +2230,6 @@ H5O_get_native_info(const H5O_loc_t *loc, H5O_native_info_t *oinfo, unsigned fie * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * November 28 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2353,12 +2241,12 @@ H5O_get_create_plist(const H5O_loc_t *loc, H5P_genplist_t *oc_plist) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(loc); - HDassert(oc_plist); + assert(loc); + assert(oc_plist); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Set property values, if they were used for the object */ if (oh->version > H5O_VERSION_1) { @@ -2367,9 +2255,9 @@ H5O_get_create_plist(const H5O_loc_t *loc, H5P_genplist_t *oc_plist) /* Set attribute storage values */ if (H5P_set(oc_plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &oh->max_compact) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, - "can't set max. # of compact attributes in property list") + "can't set max. # of compact attributes in property list"); if (H5P_set(oc_plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &oh->min_dense) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list"); /* Mask off non-"user visible" flags */ H5_CHECKED_ASSIGN(ohdr_flags, uint8_t, @@ -2379,12 +2267,12 @@ H5O_get_create_plist(const H5O_loc_t *loc, H5P_genplist_t *oc_plist) /* Set object header flags */ if (H5P_set(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object header flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object header flags"); } /* end if */ done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_create_plist() */ @@ -2397,9 +2285,6 @@ H5O_get_create_plist(const H5O_loc_t *loc, H5P_genplist_t *oc_plist) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * March 11 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2411,19 +2296,19 @@ H5O_get_nlinks(const H5O_loc_t *loc, hsize_t *nlinks) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(loc); - HDassert(nlinks); + assert(loc); + assert(nlinks); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Retrieve the # of link messages seen when the object header was loaded */ *nlinks = oh->link_msgs_seen; done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_nlinks() */ @@ -2436,9 +2321,6 @@ H5O_get_nlinks(const H5O_loc_t *loc, hsize_t *nlinks) * Return: Success: Pointer to object opened * Failure: NULL * - * Programmer: Quincey Koziol - * April 9 2007 - * *------------------------------------------------------------------------- */ void * @@ -2450,25 +2332,25 @@ H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc FUNC_ENTER_NOAPI(NULL) /* Sanity checks */ - HDassert(f); - HDassert(obj_type >= H5O_TYPE_GROUP && obj_type <= H5O_TYPE_NAMED_DATATYPE); - HDassert(crt_info); - HDassert(obj_loc); + assert(f); + assert(obj_type >= H5O_TYPE_GROUP && obj_type <= H5O_TYPE_NAMED_DATATYPE); + assert(crt_info); + assert(obj_loc); /* Iterate through the object classes */ for (u = 0; u < NELMTS(H5O_obj_class_g); u++) { /* Check for correct type of object to create */ if (H5O_obj_class_g[u]->type == obj_type) { /* Call the object class's 'create' routine */ - HDassert(H5O_obj_class_g[u]->create); + assert(H5O_obj_class_g[u]->create); if (NULL == (ret_value = H5O_obj_class_g[u]->create(f, crt_info, obj_loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object"); /* Break out of loop */ break; } /* end if */ } /* end for */ - HDassert(ret_value); + assert(ret_value); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2486,9 +2368,6 @@ H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc * Return: Success: Valid haddr_t * Failure: HADDR_UNDEF * - * Programmer: Quincey Koziol - * March 15 2007 - * *------------------------------------------------------------------------- */ haddr_t @@ -2497,8 +2376,8 @@ H5O_get_oh_addr(const H5O_t *oh) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(oh); - HDassert(oh->chunk); + assert(oh); + assert(oh->chunk); FUNC_LEAVE_NOAPI(oh->chunk[0].addr) } /* end H5O_get_oh_addr() */ @@ -2506,17 +2385,14 @@ H5O_get_oh_addr(const H5O_t *oh) /*------------------------------------------------------------------------- * Function: H5O_get_oh_flags * - * Programmer: Jacob Smith - * 2018 August 17 - * *------------------------------------------------------------------------- */ uint8_t H5O_get_oh_flags(const H5O_t *oh) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(oh); - FUNC_LEAVE_NOAPI(oh->flags); /* flags can be 0 */ + assert(oh); + FUNC_LEAVE_NOAPI(oh->flags) /* flags can be 0 */ } /* H5O_get_oh_flags() */ /*------------------------------------------------------------------------- @@ -2526,35 +2402,29 @@ H5O_get_oh_flags(const H5O_t *oh) * caller has verified that accessing this variable is appropriate * to the header in question. * - * Programmer: Jacob Smith - * 2018 August 17 - * *------------------------------------------------------------------------- */ time_t H5O_get_oh_mtime(const H5O_t *oh) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(oh); - HDassert(oh->mtime); - FUNC_LEAVE_NOAPI(oh->mtime); + assert(oh); + assert(oh->mtime); + FUNC_LEAVE_NOAPI(oh->mtime) } /* H5O_get_oh_mtime() */ /*------------------------------------------------------------------------- * Function: H5O_get_oh_version * - * Programmer: Jacob Smith - * 2018 August 17 - * *------------------------------------------------------------------------- */ uint8_t H5O_get_oh_version(const H5O_t *oh) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(oh); - HDassert(oh->version); - FUNC_LEAVE_NOAPI(oh->version); + assert(oh); + assert(oh->version); + FUNC_LEAVE_NOAPI(oh->version) } /* H5O_get_oh_version() */ /*------------------------------------------------------------------------- @@ -2565,9 +2435,6 @@ H5O_get_oh_version(const H5O_t *oh) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * November 4 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2579,11 +2446,11 @@ H5O_get_rc_and_type(const H5O_loc_t *loc, unsigned *rc, H5O_type_t *otype) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(loc); + assert(loc); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Set the object's reference count */ if (rc) @@ -2592,11 +2459,11 @@ H5O_get_rc_and_type(const H5O_loc_t *loc, unsigned *rc, H5O_type_t *otype) /* Retrieve the type of the object */ if (otype) if (H5O__obj_type_real(oh, otype) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type"); done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_rc_and_type() */ @@ -2608,9 +2475,6 @@ H5O_get_rc_and_type(const H5O_loc_t *loc, unsigned *rc, H5O_type_t *otype) * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Nov 25, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -2631,9 +2495,6 @@ H5O__free_visit_visited(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSE * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Nov 25, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -2649,9 +2510,9 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t *l FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(name); - HDassert(linfo); - HDassert(udata); + assert(name); + assert(linfo); + assert(udata); /* Check if this is a hard link */ if (linfo->type == H5L_TYPE_HARD) { @@ -2665,7 +2526,7 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t *l /* Find the object using the LAPL passed in */ /* (Correctly handles mounted files) */ if (H5G_loc_find(udata->start_loc, name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5_ITER_ERROR, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, H5_ITER_ERROR, "object not found"); obj_found = TRUE; /* Construct unique "position" for this object */ @@ -2678,7 +2539,7 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t *l /* Get the object's info */ if (H5O_get_info(&obj_oloc, &oinfo, udata->fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5_ITER_ERROR, "unable to get object info"); /* Make the application callback */ ret_value = (udata->op)(udata->obj_id, name, &oinfo, udata->op_data); @@ -2692,7 +2553,7 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t *l /* Allocate new object "position" node */ if ((new_node = H5FL_MALLOC(H5_obj_t)) == NULL) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate object node") + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, H5_ITER_ERROR, "can't allocate object node"); /* Set node information */ *new_node = obj_pos; @@ -2700,7 +2561,7 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t *l /* Add to list of visited objects */ if (H5SL_insert(udata->visited, new_node, new_node) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, - "can't insert object node into visited list") + "can't insert object node into visited list"); } /* end if */ } /* end if */ } /* end if */ @@ -2709,7 +2570,7 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t *l done: /* Release resources */ if (obj_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__visit_cb() */ @@ -2743,9 +2604,6 @@ H5O__visit_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t *l * library, or the negative value returned by one * of the operators. * - * Programmer: Quincey Koziol - * November 24 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2766,10 +2624,10 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or FUNC_ENTER_PACKAGE /* Portably initialize user data struct to zeros */ - HDmemset(&udata, 0, sizeof(udata)); + memset(&udata, 0, sizeof(udata)); /* Check args */ - HDassert(loc); + assert(loc); /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -2778,25 +2636,25 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or /* Find the object's location */ if (H5G_loc_find(loc, obj_name, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found"); loc_found = TRUE; /* Get the object's info */ if (H5O_get_info(&obj_oloc, &oinfo, fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get object info"); /* Open the object */ /* (Takes ownership of the obj_loc information) */ if (NULL == (obj = H5O_open_by_loc(&obj_loc, &opened_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object"); /* Get an ID for the visited object */ if ((obj_id = H5VL_wrap_register(opened_type, obj, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register visited object") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register visited object"); /* Make callback for starting object */ if ((ret_value = op(obj_id, ".", &oinfo, op_data)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "can't visit objects") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "can't visit objects"); /* Check return value of first callback */ if (ret_value != H5_ITER_CONT) @@ -2809,7 +2667,7 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or /* Get the location of the starting group */ if (H5G_loc(obj_id, &start_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); /* Set up user data for visiting links */ udata.obj_id = obj_id; @@ -2820,7 +2678,7 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or /* Create skip list to store visited object information */ if ((udata.visited = H5SL_create(H5SL_TYPE_OBJ, NULL)) == NULL) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create skip list for visited objects"); /* If its ref count is > 1, we add it to the list of visited objects */ /* (because it could come up again during traversal) */ @@ -2829,7 +2687,7 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or /* Allocate new object "position" node */ if ((obj_pos = H5FL_MALLOC(H5_obj_t)) == NULL) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "can't allocate object node") + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "can't allocate object node"); /* Construct unique "position" for this object */ obj_pos->fileno = oinfo.fileno; @@ -2837,30 +2695,30 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or /* De-serialize object token into an object address */ if (H5VL_native_token_to_addr(loc->oloc->file, H5I_FILE, oinfo.token, &(obj_pos->addr)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); /* Add to list of visited objects */ if (H5SL_insert(udata.visited, obj_pos, obj_pos) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert object node into visited list"); } /* Get the location of the visited group */ if (H5G_loc(obj_id, &vis_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); /* Call internal group visitation routine */ if ((ret_value = H5G_visit(&vis_loc, ".", idx_type, order, H5O__visit_cb, &udata)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed"); } /* end if */ done: /* XXX (VOL MERGE): Probably also want to consider closing obj here on failures */ if (obj_id != H5I_INVALID_HID) { if (H5I_dec_app_ref(obj_id) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close object"); } else if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location"); if (udata.visited) H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL); @@ -2875,9 +2733,6 @@ H5O__visit(H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5_iter_or * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jul 13 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -2888,12 +2743,12 @@ H5O__inc_rc(H5O_t *oh) FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); + assert(oh); /* Pin the object header when the reference count goes above 0 */ if (oh->rc == 0) if (H5AC_pin_protected_entry(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header"); /* Increment reference count */ oh->rc++; @@ -2909,9 +2764,6 @@ H5O__inc_rc(H5O_t *oh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jul 13 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -2923,7 +2775,7 @@ H5O__dec_rc(H5O_t *oh) /* check args */ if (!oh) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object header") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object header"); /* Decrement reference count */ oh->rc--; @@ -2931,7 +2783,7 @@ H5O__dec_rc(H5O_t *oh) /* Unpin the object header when the reference count goes back to 0 */ if (oh->rc == 0) if (H5AC_unpin_entry(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2945,9 +2797,6 @@ H5O__dec_rc(H5O_t *oh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Oct 08 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -2959,21 +2808,21 @@ H5O_dec_rc_by_loc(const H5O_loc_t *loc) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(loc); + assert(loc); /* Get header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header"); /* Decrement the reference count on the object header */ /* (which will unpin it, if appropriate) */ if (H5O__dec_rc(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to decrement reference count on object header"); done: /* Release the object header from the cache */ if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_dec_rc_by_loc() */ @@ -2985,9 +2834,6 @@ H5O_dec_rc_by_loc(const H5O_loc_t *loc) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * July 24 2016 - * *------------------------------------------------------------------------- */ H5AC_proxy_entry_t * @@ -2996,7 +2842,7 @@ H5O_get_proxy(const H5O_t *oh) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(oh); + assert(oh); FUNC_LEAVE_NOAPI(oh->proxy) } /* end H5O_get_proxy() */ @@ -3008,9 +2854,6 @@ H5O_get_proxy(const H5O_t *oh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 15 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -3022,8 +2865,8 @@ H5O__free(H5O_t *oh, hbool_t H5_ATTR_NDEBUG_UNUSED force) FUNC_ENTER_PACKAGE /* check args */ - HDassert(oh); - HDassert(0 == oh->rc); + assert(oh); + assert(0 == oh->rc); /* Destroy chunks */ if (oh->chunk) { @@ -3044,14 +2887,14 @@ H5O__free(H5O_t *oh, hbool_t H5_ATTR_NDEBUG_UNUSED force) if (oh->ndecode_dirtied && oh->mesg[u].dirty) oh->ndecode_dirtied--; else if (!force) - HDassert(oh->mesg[u].dirty == 0); + assert(oh->mesg[u].dirty == 0); #endif /* NDEBUG */ H5O__msg_free_mesg(&oh->mesg[u]); } /* end for */ /* Make sure we accounted for all the messages dirtied by decoding */ - HDassert(!oh->ndecode_dirtied); + assert(!oh->ndecode_dirtied); oh->mesg = (H5O_mesg_t *)H5FL_SEQ_FREE(H5O_mesg_t, oh->mesg); } /* end if */ @@ -3059,7 +2902,7 @@ H5O__free(H5O_t *oh, hbool_t H5_ATTR_NDEBUG_UNUSED force) /* Destroy the proxy */ if (oh->proxy) if (H5AC_proxy_entry_dest(oh->proxy) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy virtual entry used for proxy") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy virtual entry used for proxy"); /* destroy object header */ oh = H5FL_FREE(H5O_t, oh); @@ -3080,12 +2923,12 @@ H5O__free(H5O_t *oh, hbool_t H5_ATTR_NDEBUG_UNUSED force) static herr_t H5O__reset_info2(H5O_info2_t *oinfo) { - FUNC_ENTER_PACKAGE_NOERR; + FUNC_ENTER_PACKAGE_NOERR /* Reset the passed-in info struct */ - HDmemset(oinfo, 0, sizeof(H5O_info2_t)); + memset(oinfo, 0, sizeof(H5O_info2_t)); oinfo->type = H5O_TYPE_UNKNOWN; oinfo->token = H5O_TOKEN_UNDEF; - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__reset_info2() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Olayout.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Olayout.c index 206b2b854b..4ee2f82290 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Olayout.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Olayout.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,10 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Wednesday, October 8, 1997 - * - * Purpose: Messages related to data layout. +/* + * Purpose: Messages related to data layout */ #define H5D_FRIEND /*suppress error about including H5Dpkg */ @@ -79,83 +76,91 @@ H5FL_DEFINE(H5O_layout_t); * Purpose: Decode an data layout message and return a pointer to a * new one created with malloc(). * - * Return: Success: Ptr to new message in native order. - * + * Return: Success: Pointer to new message in native order * Failure: NULL - * - * Programmer: Robb Matzke - * Wednesday, October 8, 1997 - * *------------------------------------------------------------------------- */ static void * H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ H5O_layout_t *mesg = NULL; uint8_t *heap_block = NULL; - unsigned u; - const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); - /* decode */ if (NULL == (mesg = H5FL_CALLOC(H5O_layout_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); mesg->storage.type = H5D_LAYOUT_ERROR; + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); mesg->version = *p++; + if (mesg->version < H5O_LAYOUT_VERSION_1 || mesg->version > H5O_LAYOUT_VERSION_4) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for layout message") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "bad version number for layout message"); if (mesg->version < H5O_LAYOUT_VERSION_3) { unsigned ndims; /* Num dimensions in chunk */ /* Dimensionality */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); ndims = *p++; + if (!ndims || ndims > H5O_LAYOUT_NDIMS) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is out of range") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "dimensionality is out of range"); /* Layout class */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); mesg->type = (H5D_layout_t)*p++; - HDassert(H5D_CONTIGUOUS == mesg->type || H5D_CHUNKED == mesg->type || H5D_COMPACT == mesg->type); + + if (H5D_CONTIGUOUS != mesg->type && H5D_CHUNKED != mesg->type && H5D_COMPACT != mesg->type) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "bad layout type for layout message"); /* Set the storage type */ mesg->storage.type = mesg->type; /* Reserved bytes */ + if (H5_IS_BUFFER_OVERFLOW(p, 5, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); p += 5; /* Address */ if (mesg->type == H5D_CONTIGUOUS) { + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(mesg->storage.u.contig.addr)); /* Set the layout operations */ mesg->ops = H5D_LOPS_CONTIG; - } /* end if */ + } else if (mesg->type == H5D_CHUNKED) { + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); /* Set the layout operations */ mesg->ops = H5D_LOPS_CHUNK; - /* Set the chunk operations */ - /* (Only "btree" indexing type currently supported in this version) */ + /* Set the chunk operations + * (Only "btree" indexing type currently supported in this version) + */ mesg->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; mesg->storage.u.chunk.ops = H5D_COPS_BTREE; - } /* end if */ - else { - /* Sanity check */ - HDassert(mesg->type == H5D_COMPACT); - + } + else if (mesg->type == H5D_COMPACT) { /* Set the layout operations */ mesg->ops = H5D_LOPS_COMPACT; - } /* end else */ + } + else + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid layout type"); /* Read the size */ if (mesg->type != H5D_CHUNKED) { @@ -163,59 +168,84 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU * truncation of the dimension sizes when they were stored in this * version of the layout message. Compute the contiguous storage * size in the dataset code, where we've got the dataspace - * information available also. - QAK 5/26/04 + * information available also. */ - p += ndims * 4; /* Skip over dimension sizes (32-bit quantities) */ - } /* end if */ + if (H5_IS_BUFFER_OVERFLOW(p, (ndims * 4), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + p += ndims * sizeof(uint32_t); /* Skip over dimension sizes */ + } else { + if (ndims < 2) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "bad dimensions for chunked storage"); mesg->u.chunk.ndims = ndims; - for (u = 0; u < ndims; u++) + + if (H5_IS_BUFFER_OVERFLOW(p, (ndims * 4), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + for (unsigned u = 0; u < ndims; u++) { + UINT32DECODE(p, mesg->u.chunk.dim[u]); + /* Just in case that something goes very wrong, such as file corruption */ + if (mesg->u.chunk.dim[u] == 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "bad chunk dimension value when parsing layout message - chunk dimension " + "must be positive: mesg->u.chunk.dim[%u] = %u", + u, mesg->u.chunk.dim[u]); + } + /* Compute chunk size */ - for (u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < ndims; u++) + mesg->u.chunk.size = mesg->u.chunk.dim[0]; + for (unsigned u = 1; u < ndims; u++) mesg->u.chunk.size *= mesg->u.chunk.dim[u]; - } /* end if */ + } if (mesg->type == H5D_COMPACT) { + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT32DECODE(p, mesg->storage.u.compact.size); + if (mesg->storage.u.compact.size > 0) { /* Ensure that size doesn't exceed buffer size, due to possible data corruption */ - if (p + mesg->storage.u.compact.size - 1 > p_end) - HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "storage size exceeds buffer size") + if (H5_IS_BUFFER_OVERFLOW(p, mesg->storage.u.compact.size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for compact data buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, + "memory allocation failed for compact data buffer"); H5MM_memcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size); p += mesg->storage.u.compact.size; - } /* end if */ - } /* end if */ - } /* end if */ + } + } + } else { /* Layout & storage class */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); mesg->type = mesg->storage.type = (H5D_layout_t)*p++; /* Interpret the rest of the message according to the layout class */ switch (mesg->type) { case H5D_COMPACT: /* Compact data size */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, mesg->storage.u.compact.size); if (mesg->storage.u.compact.size > 0) { /* Ensure that size doesn't exceed buffer size, due to possible data corruption */ - if (p + mesg->storage.u.compact.size - 1 > p_end) - HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "storage size exceeds buffer size") + if (H5_IS_BUFFER_OVERFLOW(p, mesg->storage.u.compact.size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); /* Allocate space for compact data */ if (NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size))) HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, - "memory allocation failed for compact data buffer") + "memory allocation failed for compact data buffer"); /* Compact data */ H5MM_memcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size); p += mesg->storage.u.compact.size; - } /* end if */ + } /* Set the layout operations */ mesg->ops = H5D_LOPS_COMPACT; @@ -223,9 +253,13 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU case H5D_CONTIGUOUS: /* Contiguous storage address */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(mesg->storage.u.contig.addr)); /* Contiguous storage size */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_DECODE_LENGTH(f, p, mesg->storage.u.contig.size); /* Set the layout operations */ @@ -238,35 +272,55 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU mesg->u.chunk.flags = (uint8_t)0; /* Dimensionality */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.ndims = *p++; + if (mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "dimensionality is too large"); + if (mesg->u.chunk.ndims < 2) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "bad dimensions for chunked storage"); /* B-tree address */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); + if (H5_IS_BUFFER_OVERFLOW(p, (mesg->u.chunk.ndims * 4), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); + /* Chunk dimensions */ - for (u = 0; u < mesg->u.chunk.ndims; u++) { + for (unsigned u = 0; u < mesg->u.chunk.ndims; u++) { + UINT32DECODE(p, mesg->u.chunk.dim[u]); /* Just in case that something goes very wrong, such as file corruption. */ if (mesg->u.chunk.dim[u] == 0) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, - "chunk dimension must be positive: mesg->u.chunk.dim[%u] = %u", u, - mesg->u.chunk.dim[u]) - } /* end for */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "bad chunk dimension value when parsing layout message - chunk " + "dimension must be positive: mesg->u.chunk.dim[%u] = %u", + u, mesg->u.chunk.dim[u]); + } /* Compute chunk size */ - for (u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++) + mesg->u.chunk.size = mesg->u.chunk.dim[0]; + for (unsigned u = 1; u < mesg->u.chunk.ndims; u++) mesg->u.chunk.size *= mesg->u.chunk.dim[u]; - /* Set the chunk operations */ - /* (Only "btree" indexing type supported with v3 of message format) */ + /* Set the chunk operations + * (Only "btree" indexing type supported with v3 of message format) + */ mesg->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; mesg->storage.u.chunk.ops = H5D_COPS_BTREE; - } /* end if */ + } else { /* Get the chunked layout flags */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.flags = *p++; /* Check for valid flags */ @@ -274,36 +328,63 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU * until features are added for the flags) */ if (mesg->u.chunk.flags & ~H5O_LAYOUT_ALL_CHUNK_FLAGS) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "bad flag value for message") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "bad flag value for message"); /* Dimensionality */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.ndims = *p++; + if (mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "dimensionality is too large") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "dimensionality is too large"); /* Encoded # of bytes for each chunk dimension */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.enc_bytes_per_dim = *p++; + if (mesg->u.chunk.enc_bytes_per_dim == 0 || mesg->u.chunk.enc_bytes_per_dim > 8) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "encoded chunk dimension size is too large") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "encoded chunk dimension size is too large"); + + if (H5_IS_BUFFER_OVERFLOW(p, (mesg->u.chunk.ndims * mesg->u.chunk.enc_bytes_per_dim), + p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); /* Chunk dimensions */ - for (u = 0; u < mesg->u.chunk.ndims; u++) + for (unsigned u = 0; u < mesg->u.chunk.ndims; u++) { UINT64DECODE_VAR(p, mesg->u.chunk.dim[u], mesg->u.chunk.enc_bytes_per_dim); + /* Just in case that something goes very wrong, such as file corruption. */ + if (mesg->u.chunk.dim[u] == 0) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "bad chunk dimension value when parsing layout message - chunk " + "dimension must be positive: mesg->u.chunk.dim[%u] = %u", + u, mesg->u.chunk.dim[u]); + } + /* Compute chunk size */ - for (u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++) + mesg->u.chunk.size = mesg->u.chunk.dim[0]; + for (unsigned u = 1; u < mesg->u.chunk.ndims; u++) mesg->u.chunk.size *= mesg->u.chunk.dim[u]; /* Chunk index type */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.idx_type = (H5D_chunk_index_t)*p++; + if (mesg->u.chunk.idx_type >= H5D_CHUNK_IDX_NTYPES) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "unknown chunk index type") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "unknown chunk index type"); mesg->storage.u.chunk.idx_type = mesg->u.chunk.idx_type; switch (mesg->u.chunk.idx_type) { case H5D_CHUNK_IDX_BTREE: HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, - "v1 B-tree index type should never be in a v4 layout message") + "v1 B-tree index type should never be in a v4 layout message"); break; case H5D_CHUNK_IDX_NONE: /* Implicit Index */ @@ -312,9 +393,12 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU case H5D_CHUNK_IDX_SINGLE: /* Single Chunk Index */ if (mesg->u.chunk.flags & H5O_LAYOUT_CHUNK_SINGLE_INDEX_WITH_FILTER) { + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_size(f) + 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); H5F_DECODE_LENGTH(f, p, mesg->storage.u.chunk.u.single.nbytes); UINT32DECODE(p, mesg->storage.u.chunk.u.single.filter_mask); - } /* end if */ + } /* Set the chunk operations */ mesg->storage.u.chunk.ops = H5D_COPS_SINGLE; @@ -322,10 +406,14 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU case H5D_CHUNK_IDX_FARRAY: /* Fixed array creation parameters */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = *p++; + if (0 == mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, - "invalid fixed array creation parameter") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "invalid fixed array creation parameter"); /* Set the chunk operations */ mesg->storage.u.chunk.ops = H5D_COPS_FARRAY; @@ -333,48 +421,100 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU case H5D_CHUNK_IDX_EARRAY: /* Extensible array creation parameters */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.u.earray.cparam.max_nelmts_bits = *p++; + if (0 == mesg->u.chunk.u.earray.cparam.max_nelmts_bits) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, - "invalid extensible array creation parameter") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "invalid extensible array creation parameter"); + + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.u.earray.cparam.idx_blk_elmts = *p++; + if (0 == mesg->u.chunk.u.earray.cparam.idx_blk_elmts) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, - "invalid extensible array creation parameter") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "invalid extensible array creation parameter"); + + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs = *p++; + if (0 == mesg->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, - "invalid extensible array creation parameter") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "invalid extensible array creation parameter"); + + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.u.earray.cparam.data_blk_min_elmts = *p++; + if (0 == mesg->u.chunk.u.earray.cparam.data_blk_min_elmts) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, - "invalid extensible array creation parameter") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "invalid extensible array creation parameter"); + + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits = *p++; + if (0 == mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, - "invalid extensible array creation parameter") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "invalid extensible array creation parameter"); /* Set the chunk operations */ mesg->storage.u.chunk.ops = H5D_COPS_EARRAY; break; case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */ + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); UINT32DECODE(p, mesg->u.chunk.u.btree2.cparam.node_size); + + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.u.btree2.cparam.split_percent = *p++; + + if (mesg->u.chunk.u.btree2.cparam.split_percent == 0 || + mesg->u.chunk.u.btree2.cparam.split_percent > 100) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "bad value for v2 B-tree split percent value - must be > 0 and " + "<= 100: split percent = %" PRIu8, + mesg->u.chunk.u.btree2.cparam.split_percent); + + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); mesg->u.chunk.u.btree2.cparam.merge_percent = *p++; + if (mesg->u.chunk.u.btree2.cparam.merge_percent == 0 || + mesg->u.chunk.u.btree2.cparam.merge_percent > 100) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, + "bad value for v2 B-tree merge percent value - must be > 0 and " + "<= 100: merge percent = %" PRIu8, + mesg->u.chunk.u.btree2.cparam.merge_percent); + /* Set the chunk operations */ mesg->storage.u.chunk.ops = H5D_COPS_BT2; break; case H5D_CHUNK_IDX_NTYPES: default: - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "Invalid chunk index type") - } /* end switch */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "Invalid chunk index type"); + } /* Chunk index address */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); - } /* end else */ + } /* Set the layout operations */ mesg->ops = H5D_LOPS_CHUNK; @@ -383,10 +523,16 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU case H5D_VIRTUAL: /* Check version */ if (mesg->version < H5O_LAYOUT_VERSION_4) - HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "invalid layout version with virtual layout") + HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "invalid layout version with virtual layout"); /* Heap information */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(mesg->storage.u.virt.serial_list_hobjid.addr)); + /* NOTE: virtual mapping global heap entry address could be undefined */ + + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT32DECODE(p, mesg->storage.u.virt.serial_list_hobjid.idx); /* Initialize other fields */ @@ -402,68 +548,117 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU /* Decode heap block if it exists */ if (mesg->storage.u.virt.serial_list_hobjid.addr != HADDR_UNDEF) { const uint8_t *heap_block_p; + const uint8_t *heap_block_p_end; uint8_t heap_vers; size_t block_size = 0; size_t tmp_size; - hsize_t tmp_hsize; + hsize_t tmp_hsize = 0; uint32_t stored_chksum; uint32_t computed_chksum; - size_t i; /* Read heap */ if (NULL == (heap_block = (uint8_t *)H5HG_read( f, &(mesg->storage.u.virt.serial_list_hobjid), NULL, &block_size))) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "Unable to read global heap block") + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "Unable to read global heap block"); - heap_block_p = (const uint8_t *)heap_block; + heap_block_p = (const uint8_t *)heap_block; + heap_block_p_end = heap_block_p + block_size - 1; /* Decode the version number of the heap block encoding */ + if (H5_IS_BUFFER_OVERFLOW(heap_block_p, 1, heap_block_p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); heap_vers = (uint8_t)*heap_block_p++; + if ((uint8_t)H5O_LAYOUT_VDS_GH_ENC_VERS != heap_vers) HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "bad version # of encoded VDS heap information, expected %u, got %u", - (unsigned)H5O_LAYOUT_VDS_GH_ENC_VERS, (unsigned)heap_vers) + (unsigned)H5O_LAYOUT_VDS_GH_ENC_VERS, (unsigned)heap_vers); /* Number of entries */ - H5F_DECODE_LENGTH(f, heap_block_p, tmp_hsize) + if (H5_IS_BUFFER_OVERFLOW(heap_block_p, H5F_sizeof_size(f), heap_block_p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); + H5F_DECODE_LENGTH(f, heap_block_p, tmp_hsize); /* Allocate entry list */ if (NULL == (mesg->storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_calloc( (size_t)tmp_hsize * sizeof(H5O_storage_virtual_ent_t)))) - HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate heap block") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "unable to allocate heap block"); mesg->storage.u.virt.list_nalloc = (size_t)tmp_hsize; mesg->storage.u.virt.list_nused = (size_t)tmp_hsize; /* Decode each entry */ - for (i = 0; i < mesg->storage.u.virt.list_nused; i++) { + for (size_t i = 0; i < mesg->storage.u.virt.list_nused; i++) { + ptrdiff_t avail_buffer_space; + + avail_buffer_space = heap_block_p_end - heap_block_p + 1; + if (avail_buffer_space <= 0) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); + /* Source file name */ - tmp_size = HDstrlen((const char *)heap_block_p) + 1; + tmp_size = HDstrnlen((const char *)heap_block_p, (size_t)avail_buffer_space); + if (tmp_size == (size_t)avail_buffer_space) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding - unterminated source " + "file name string"); + else + tmp_size += 1; /* Add space for NUL terminator */ + if (NULL == (mesg->storage.u.virt.list[i].source_file_name = (char *)H5MM_malloc(tmp_size))) - HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, - "unable to allocate memory for source file name") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, + "unable to allocate memory for source file name"); H5MM_memcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, tmp_size); heap_block_p += tmp_size; + avail_buffer_space = heap_block_p_end - heap_block_p + 1; + if (avail_buffer_space <= 0) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); + /* Source dataset name */ - tmp_size = HDstrlen((const char *)heap_block_p) + 1; + tmp_size = HDstrnlen((const char *)heap_block_p, (size_t)avail_buffer_space); + if (tmp_size == (size_t)avail_buffer_space) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding - unterminated source " + "dataset name string"); + else + tmp_size += 1; /* Add space for NUL terminator */ + if (NULL == (mesg->storage.u.virt.list[i].source_dset_name = (char *)H5MM_malloc(tmp_size))) - HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, - "unable to allocate memory for source dataset name") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, + "unable to allocate memory for source dataset name"); H5MM_memcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, tmp_size); heap_block_p += tmp_size; /* Source selection */ - if (H5S_SELECT_DESERIALIZE(&mesg->storage.u.virt.list[i].source_select, - &heap_block_p) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode source space selection") + avail_buffer_space = heap_block_p_end - heap_block_p + 1; + + if (avail_buffer_space <= 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, NULL, + "buffer overflow while decoding layout"); + + if (H5S_SELECT_DESERIALIZE(&mesg->storage.u.virt.list[i].source_select, &heap_block_p, + (size_t)(avail_buffer_space)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, + "can't decode source space selection"); /* Virtual selection */ + + /* Buffer space must be updated after previous deserialization */ + avail_buffer_space = heap_block_p_end - heap_block_p + 1; + + if (avail_buffer_space <= 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, NULL, + "buffer overflow while decoding layout"); + if (H5S_SELECT_DESERIALIZE(&mesg->storage.u.virt.list[i].source_dset.virtual_select, - &heap_block_p) < 0) + &heap_block_p, (size_t)(avail_buffer_space)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, - "can't decode virtual space selection") + "can't decode virtual space selection"); /* Parse source file and dataset names for "printf" * style format specifiers */ @@ -472,13 +667,13 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU &mesg->storage.u.virt.list[i].parsed_source_file_name, &mesg->storage.u.virt.list[i].psfn_static_strlen, &mesg->storage.u.virt.list[i].psfn_nsubs) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't parse source file name") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't parse source file name"); if (H5D_virtual_parse_source_name( mesg->storage.u.virt.list[i].source_dset_name, &mesg->storage.u.virt.list[i].parsed_source_dset_name, &mesg->storage.u.virt.list[i].psdn_static_strlen, &mesg->storage.u.virt.list[i].psdn_nsubs) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't parse source dataset name") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't parse source dataset name"); /* Set source names in source_dset struct */ if ((mesg->storage.u.virt.list[i].psfn_nsubs == 0) && @@ -495,9 +690,9 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU else mesg->storage.u.virt.list[i].source_dset.dset_name = mesg->storage.u.virt.list[i].source_dset_name; - } /* end if */ + } - /* unlim_dim fields */ + /* Unlim_dim fields */ mesg->storage.u.virt.list[i].unlim_dim_source = H5S_get_select_unlim_dim(mesg->storage.u.virt.list[i].source_select); mesg->storage.u.virt.list[i].unlim_dim_virtual = @@ -513,7 +708,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU mesg->storage.u.virt.list[i].source_select; mesg->storage.u.virt.list[i].source_dset.clipped_virtual_select = mesg->storage.u.virt.list[i].source_dset.virtual_select; - } /* end if */ + } /* Check mapping for validity (do both pre and post * checks here, since we had to allocate the entry list @@ -521,18 +716,21 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU if (H5D_virtual_check_mapping_pre( mesg->storage.u.virt.list[i].source_dset.virtual_select, mesg->storage.u.virt.list[i].source_select, H5O_VIRTUAL_STATUS_INVALID) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid mapping selections") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid mapping selections"); if (H5D_virtual_check_mapping_post(&mesg->storage.u.virt.list[i]) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid mapping entry") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid mapping entry"); /* Update min_dims */ if (H5D_virtual_update_min_dims(mesg, i) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, - "unable to update virtual dataset minimum dimensions") - } /* end for */ + "unable to update virtual dataset minimum dimensions"); + } /* Read stored checksum */ - UINT32DECODE(heap_block_p, stored_chksum) + if (H5_IS_BUFFER_OVERFLOW(heap_block_p, 4, heap_block_p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); + UINT32DECODE(heap_block_p, stored_chksum); /* Compute checksum */ computed_chksum = H5_checksum_metadata(heap_block, block_size - (size_t)4, 0); @@ -540,11 +738,11 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU /* Verify checksum */ if (stored_chksum != computed_chksum) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, - "incorrect metadata checksum for global heap block") + "incorrect metadata checksum for global heap block"); /* Verify that the heap block size is correct */ if ((size_t)(heap_block_p - heap_block) != block_size) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "incorrect heap block size") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "incorrect heap block size"); } /* end if */ /* Set the layout operations */ @@ -555,9 +753,9 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class") - } /* end switch */ - } /* end else */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "Invalid layout class"); + } + } /* Set return value */ ret_value = mesg; @@ -567,9 +765,9 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU if (mesg) { if (mesg->type == H5D_VIRTUAL) if (H5D__virtual_reset_layout(mesg) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to reset virtual layout") - mesg = H5FL_FREE(H5O_layout_t, mesg); - } /* end if */ + HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to reset virtual layout"); + H5FL_FREE(H5O_layout_t, mesg); + } heap_block = (uint8_t *)H5MM_xfree(heap_block); @@ -583,11 +781,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 8, 1997 - * * Note: - * Quincey Koziol, 2004-5-21 * We write out version 3 messages by default now. * *------------------------------------------------------------------------- @@ -602,9 +796,9 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(mesg); - HDassert(p); + assert(f); + assert(mesg); + assert(p); /* Message version */ *p++ = (uint8_t)((mesg->version < H5O_LAYOUT_VERSION_3) ? H5O_LAYOUT_VERSION_3 : mesg->version); @@ -623,7 +817,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, if (mesg->storage.u.compact.buf) H5MM_memcpy(p, mesg->storage.u.compact.buf, mesg->storage.u.compact.size); else - HDmemset(p, 0, mesg->storage.u.compact.size); + memset(p, 0, mesg->storage.u.compact.size); p += mesg->storage.u.compact.size; } /* end if */ break; @@ -639,7 +833,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, case H5D_CHUNKED: if (mesg->version < H5O_LAYOUT_VERSION_4) { /* Number of dimensions */ - HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + assert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); *p++ = (uint8_t)mesg->u.chunk.ndims; /* B-tree address */ @@ -654,11 +848,11 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, *p++ = mesg->u.chunk.flags; /* Number of dimensions */ - HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + assert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); *p++ = (uint8_t)mesg->u.chunk.ndims; /* Encoded # of bytes for each chunk dimension */ - HDassert(mesg->u.chunk.enc_bytes_per_dim > 0 && mesg->u.chunk.enc_bytes_per_dim <= 8); + assert(mesg->u.chunk.enc_bytes_per_dim > 0 && mesg->u.chunk.enc_bytes_per_dim <= 8); *p++ = (uint8_t)mesg->u.chunk.enc_bytes_per_dim; /* Dimension sizes */ @@ -671,7 +865,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, switch (mesg->u.chunk.idx_type) { case H5D_CHUNK_IDX_BTREE: HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, - "v1 B-tree index type should never be in a v4 layout message") + "v1 B-tree index type should never be in a v4 layout message"); break; case H5D_CHUNK_IDX_NONE: /* Implicit */ @@ -707,7 +901,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, case H5D_CHUNK_IDX_NTYPES: default: - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid chunk index type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid chunk index type"); } /* end switch */ /* @@ -728,7 +922,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid layout class") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid layout class"); } /* end switch */ done: @@ -745,9 +939,6 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, * * Failure: NULL * - * Programmer: Robb Matzke - * Wednesday, October 8, 1997 - * *------------------------------------------------------------------------- */ static void * @@ -760,11 +951,11 @@ H5O__layout_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(mesg); + assert(mesg); /* Allocate destination message, if necessary */ if (!dest && NULL == (dest = H5FL_MALLOC(H5O_layout_t))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "layout message allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "layout message allocation failed"); /* copy */ *dest = *mesg; @@ -775,18 +966,18 @@ H5O__layout_copy(const void *_mesg, void *_dest) /* Deep copy the buffer for compact datasets also */ if (mesg->storage.u.compact.size > 0) { /* Sanity check */ - HDassert(mesg->storage.u.compact.buf); + assert(mesg->storage.u.compact.buf); /* Allocate memory for the raw data */ if (NULL == (dest->storage.u.compact.buf = H5MM_malloc(dest->storage.u.compact.size))) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset"); /* Copy over the raw data */ H5MM_memcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size); } /* end if */ else - HDassert(dest->storage.u.compact.buf == NULL); + assert(dest->storage.u.compact.buf == NULL); break; case H5D_CONTIGUOUS: @@ -801,13 +992,13 @@ H5O__layout_copy(const void *_mesg, void *_dest) case H5D_VIRTUAL: if (H5D__virtual_copy_layout(dest) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy virtual layout") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy virtual layout"); break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, NULL, "Invalid layout class") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, NULL, "Invalid layout class"); } /* end switch */ /* Set return value */ @@ -832,9 +1023,6 @@ H5O__layout_copy(const void *_mesg, void *_dest) * * Failure: 0 * - * Programmer: Robb Matzke - * Wednesday, October 8, 1997 - * *------------------------------------------------------------------------- */ static size_t @@ -846,8 +1034,8 @@ H5O__layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const vo FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); + assert(f); + assert(mesg); /* Compute serialized size */ /* (including possibly compact data) */ @@ -864,9 +1052,6 @@ H5O__layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const vo * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, September 13, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -884,7 +1069,7 @@ H5O__layout_reset(void *_mesg) else if (H5D_VIRTUAL == mesg->type) /* Free the virtual entry list */ if (H5D__virtual_reset_layout(mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to reset virtual layout") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to reset virtual layout"); /* Reset the message */ mesg->type = H5D_CONTIGUOUS; @@ -902,9 +1087,6 @@ H5O__layout_reset(void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, March 11, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -914,7 +1096,7 @@ H5O__layout_free(void *_mesg) FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); /* Free resources within the message */ H5O__layout_reset(mesg); @@ -931,9 +1113,6 @@ H5O__layout_free(void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, March 19, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -945,9 +1124,9 @@ H5O__layout_delete(H5F_t *f, H5O_t *open_oh, void *_mesg) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(open_oh); - HDassert(mesg); + assert(f); + assert(open_oh); + assert(mesg); /* Perform different actions, depending on the type of storage */ switch (mesg->type) { @@ -958,25 +1137,25 @@ H5O__layout_delete(H5F_t *f, H5O_t *open_oh, void *_mesg) case H5D_CONTIGUOUS: /* Contiguous block on disk */ /* Free the file space for the raw data */ if (H5D__contig_delete(f, &mesg->storage) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data"); break; case H5D_CHUNKED: /* Chunked blocks on disk */ /* Free the file space for the index & chunk raw data */ if (H5D__chunk_delete(f, open_oh, &mesg->storage) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data"); break; case H5D_VIRTUAL: /* Virtual dataset */ /* Free the file space virtual dataset */ if (H5D__virtual_delete(f, &mesg->storage) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data"); break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not valid storage type") + HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not valid storage type"); } /* end switch */ done: @@ -992,8 +1171,6 @@ H5O__layout_delete(H5F_t *f, H5O_t *open_oh, void *_mesg) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi; Dec 2017 - * *------------------------------------------------------------------------- */ static herr_t @@ -1007,13 +1184,13 @@ H5O__layout_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, FUNC_ENTER_PACKAGE /* check args */ - HDassert(cpy_info); - HDassert(cpy_info->file_dst); + assert(cpy_info); + assert(cpy_info->file_dst); /* Check to ensure that the version of the message to be copied does not exceed the message version allowed by the destination file's high bound */ if (layout_src->version > H5O_layout_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "layout message version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "layout message version out of bounds"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1028,9 +1205,6 @@ H5O__layout_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, * * Failure: NULL * - * Programmer: Peter Cao - * July 23, 2005 - * *------------------------------------------------------------------------- */ static void * @@ -1047,13 +1221,13 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, FUNC_ENTER_PACKAGE /* check args */ - HDassert(file_src); - HDassert(layout_src); - HDassert(file_dst); + assert(file_src); + assert(layout_src); + assert(file_dst); /* Copy the layout information */ if (NULL == (layout_dst = (H5O_layout_t *)H5O__layout_copy(layout_src, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy layout") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy layout"); /* Copy the layout type specific information */ switch (layout_src->type) { @@ -1062,7 +1236,7 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, /* copy compact raw data */ if (H5D__compact_copy(file_src, &layout_src->storage.u.compact, file_dst, &layout_dst->storage.u.compact, udata->src_dtype, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage"); copied = TRUE; } /* end if */ break; @@ -1082,7 +1256,7 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, /* copy contiguous raw data */ if (H5D__contig_copy(file_src, &layout_src->storage.u.contig, file_dst, &layout_dst->storage.u.contig, udata->src_dtype, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy contiguous storage") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy contiguous storage"); copied = TRUE; } /* end if */ break; @@ -1095,7 +1269,7 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, if (H5D__chunk_copy(file_src, &layout_src->storage.u.chunk, &layout_src->u.chunk, file_dst, &layout_dst->storage.u.chunk, udata->src_space_extent, udata->src_dtype, udata->common.src_pline, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy chunked storage"); copied = TRUE; } /* end if */ break; @@ -1104,13 +1278,13 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, /* Copy virtual layout. Always copy so the memory fields get copied * properly. */ if (H5D__virtual_copy(file_dst, layout_dst) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy virtual storage") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy virtual storage"); break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "Invalid layout class"); } /* end switch */ /* Check if copy routine was invoked (which frees the source datatype) */ @@ -1135,9 +1309,6 @@ H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, October 8, 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -1149,102 +1320,101 @@ H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", mesg->version); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", mesg->version); switch (mesg->type) { case H5D_CHUNKED: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Chunked"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Chunked"); /* Chunk # of dims & size */ - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Number of dimensions:", (unsigned long)(mesg->u.chunk.ndims)); - HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Size:"); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, + "Number of dimensions:", (unsigned long)(mesg->u.chunk.ndims)); + fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Size:"); for (u = 0; u < (size_t)mesg->u.chunk.ndims; u++) - HDfprintf(stream, "%s%lu", u ? ", " : "", (unsigned long)(mesg->u.chunk.dim[u])); - HDfprintf(stream, "}\n"); + fprintf(stream, "%s%lu", u ? ", " : "", (unsigned long)(mesg->u.chunk.dim[u])); + fprintf(stream, "}\n"); /* Index information */ switch (mesg->u.chunk.idx_type) { case H5D_CHUNK_IDX_BTREE: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "v1 B-tree"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "v1 B-tree"); break; case H5D_CHUNK_IDX_NONE: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "Implicit"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "Implicit"); break; case H5D_CHUNK_IDX_SINGLE: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "Single Chunk"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "Single Chunk"); break; case H5D_CHUNK_IDX_FARRAY: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "Fixed Array"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "Fixed Array"); /* (Should print the fixed array creation parameters) */ break; case H5D_CHUNK_IDX_EARRAY: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "Extensible Array"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "Extensible Array"); /* (Should print the extensible array creation parameters) */ break; case H5D_CHUNK_IDX_BT2: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "v2 B-tree"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "v2 B-tree"); /* (Should print the v2-Btree creation parameters) */ break; case H5D_CHUNK_IDX_NTYPES: default: - HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Index Type:", "Unknown", - (unsigned)mesg->u.chunk.idx_type); + fprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Index Type:", "Unknown", + (unsigned)mesg->u.chunk.idx_type); break; } /* end switch */ - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Index address:", mesg->storage.u.chunk.idx_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Index address:", mesg->storage.u.chunk.idx_addr); break; case H5D_CONTIGUOUS: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Contiguous"); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Data address:", mesg->storage.u.contig.addr); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, - "Data Size:", mesg->storage.u.contig.size); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Contiguous"); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Data address:", mesg->storage.u.contig.addr); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, + "Data Size:", mesg->storage.u.contig.size); break; case H5D_COMPACT: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Compact"); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "Data Size:", mesg->storage.u.compact.size); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Compact"); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Data Size:", mesg->storage.u.compact.size); break; case H5D_VIRTUAL: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Virtual"); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Global heap address:", mesg->storage.u.virt.serial_list_hobjid.addr); - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "Global heap index:", mesg->storage.u.virt.serial_list_hobjid.idx); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Type:", "Virtual"); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Global heap address:", mesg->storage.u.virt.serial_list_hobjid.addr); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "Global heap index:", mesg->storage.u.virt.serial_list_hobjid.idx); for (u = 0; u < mesg->storage.u.virt.list_nused; u++) { - HDfprintf(stream, "%*sMapping %zu:\n", indent, "", u); - HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, - "Virtual selection:", ""); - HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, - "Source file name:", mesg->storage.u.virt.list[u].source_file_name); - HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, - "Source dataset name:", mesg->storage.u.virt.list[u].source_dset_name); - HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, - "Source selection:", ""); + fprintf(stream, "%*sMapping %zu:\n", indent, "", u); + fprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, + "Virtual selection:", ""); + fprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, + "Source file name:", mesg->storage.u.virt.list[u].source_file_name); + fprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, + "Source dataset name:", mesg->storage.u.virt.list[u].source_dset_name); + fprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth - 3, + "Source selection:", ""); } /* end for */ break; case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Type:", "Unknown", - (unsigned)mesg->type); + fprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Type:", "Unknown", + (unsigned)mesg->type); break; } /* end switch */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Olinfo.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Olinfo.c index 56245177c2..507f39c79f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Olinfo.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Olinfo.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,16 +13,14 @@ /*------------------------------------------------------------------------- * * Created: H5Olinfo.c - * Aug 23 2005 - * Quincey Koziol * - * Purpose: Link Information messages. + * Purpose: Link information messages * *------------------------------------------------------------------------- */ -#define H5G_FRIEND /*suppress error about including H5Gpkg */ -#define H5L_FRIEND /*suppress error about including H5Lpkg */ +#define H5G_FRIEND /* Suppress error about including H5Gpkg */ +#define H5L_FRIEND /* Suppress error about including H5Lpkg */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ #include "H5private.h" /* Generic Functions */ @@ -96,40 +93,41 @@ H5FL_DEFINE_STATIC(H5O_linfo_t); * * Purpose: Decode a message and return a pointer to a newly allocated one. * - * Return: Success: Ptr to new message in native form. + * Return: Success: Pointer to new message in native form * Failure: NULL - * - * Programmer: Quincey Koziol - * Aug 23 2005 - * *------------------------------------------------------------------------- */ static void * H5O__linfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_linfo_t *linfo = NULL; /* Link info */ - unsigned char index_flags; /* Flags for encoding link index info */ - void *ret_value = NULL; /* Return value */ + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + H5O_linfo_t *linfo = NULL; /* Link info */ + unsigned char index_flags; /* Flags for encoding link index info */ + uint8_t addr_size = H5F_SIZEOF_ADDR(f); /* Temp var */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); + + /* Check input buffer before decoding version and index flags */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); /* Version of message */ if (*p++ != H5O_LINFO_VERSION) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message"); /* Allocate space for message */ if (NULL == (linfo = H5FL_MALLOC(H5O_linfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Get the index flags for the group */ index_flags = *p++; if (index_flags & ~H5O_LINFO_ALL_FLAGS) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message"); linfo->track_corder = (index_flags & H5O_LINFO_TRACK_CORDER) ? TRUE : FALSE; linfo->index_corder = (index_flags & H5O_LINFO_INDEX_CORDER) ? TRUE : FALSE; @@ -137,11 +135,18 @@ H5O__linfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS linfo->nlinks = HSIZET_MAX; /* Max. link creation order value for the group, if tracked */ - if (linfo->track_corder) - INT64DECODE(p, linfo->max_corder) + if (linfo->track_corder) { + if (H5_IS_BUFFER_OVERFLOW(p, 8, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + INT64DECODE(p, linfo->max_corder); + } else linfo->max_corder = 0; + /* Check input buffer before decoding the next two addresses */ + if (H5_IS_BUFFER_OVERFLOW(p, addr_size + addr_size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + /* Address of fractal heap to store "dense" links */ H5F_addr_decode(f, &p, &(linfo->fheap_addr)); @@ -149,8 +154,11 @@ H5O__linfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS H5F_addr_decode(f, &p, &(linfo->name_bt2_addr)); /* Address of v2 B-tree to index creation order of links, if there is one */ - if (linfo->index_corder) + if (linfo->index_corder) { + if (H5_IS_BUFFER_OVERFLOW(p, addr_size, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(linfo->corder_bt2_addr)); + } else linfo->corder_bt2_addr = HADDR_UNDEF; @@ -172,9 +180,6 @@ H5O__linfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUS * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 23 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -186,9 +191,9 @@ H5O__linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(linfo); + assert(f); + assert(p); + assert(linfo); /* Message version */ *p++ = H5O_LINFO_VERSION; @@ -200,7 +205,7 @@ H5O__linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c /* Max. link creation order value for the group, if tracked */ if (linfo->track_corder) - INT64ENCODE(p, linfo->max_corder) + INT64ENCODE(p, linfo->max_corder); /* Address of fractal heap to store "dense" links */ H5F_addr_encode(f, &p, linfo->fheap_addr); @@ -212,7 +217,7 @@ H5O__linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c if (linfo->index_corder) H5F_addr_encode(f, &p, linfo->corder_bt2_addr); else - HDassert(!H5F_addr_defined(linfo->corder_bt2_addr)); + assert(!H5_addr_defined(linfo->corder_bt2_addr)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__linfo_encode() */ @@ -226,9 +231,6 @@ H5O__linfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: Quincey Koziol - * Aug 23 2005 - * *------------------------------------------------------------------------- */ static void * @@ -241,9 +243,9 @@ H5O__linfo_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(linfo); + assert(linfo); if (!dest && NULL == (dest = H5FL_MALLOC(H5O_linfo_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ *dest = *linfo; @@ -265,9 +267,6 @@ H5O__linfo_copy(const void *_mesg, void *_dest) * Return: Success: Message data size in bytes without alignment. * Failure: zero * - * Programmer: Quincey Koziol - * Aug 23 2005 - * *------------------------------------------------------------------------- */ static size_t @@ -298,9 +297,6 @@ H5O__linfo_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const voi * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, August 23, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -308,7 +304,7 @@ H5O__linfo_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5O_linfo_t, mesg); @@ -322,9 +318,6 @@ H5O__linfo_free(void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, September 16, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -336,13 +329,13 @@ H5O__linfo_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(linfo); + assert(f); + assert(linfo); /* If the group is using "dense" link storage, delete it */ - if (H5F_addr_defined(linfo->fheap_addr)) + if (H5_addr_defined(linfo->fheap_addr)) if (H5G__dense_delete(f, linfo, TRUE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense link storage") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense link storage"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -357,9 +350,6 @@ H5O__linfo_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) * * Failure: NULL * - * Programmer: Quincey Koziol - * June 26, 2006 - * *------------------------------------------------------------------------- */ static void * @@ -375,12 +365,12 @@ H5O__linfo_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t *fi FUNC_ENTER_PACKAGE_TAG(H5AC__COPIED_TAG) /* check args */ - HDassert(linfo_src); - HDassert(cpy_info); + assert(linfo_src); + assert(cpy_info); /* Copy the source message */ if (NULL == (linfo_dst = (H5O_linfo_t *)H5O__linfo_copy(linfo_src, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "memory allocation failed"); /* If we are performing a 'shallow hierarchy' copy, and the links in this * group won't be included in the destination, reset the link info for @@ -398,10 +388,10 @@ H5O__linfo_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t *fi /* (XXX: should probably get the "creation" parameters for the source group's * dense link storage components and use those - QAK) */ - if (H5F_addr_defined(linfo_src->fheap_addr)) { + if (H5_addr_defined(linfo_src->fheap_addr)) { /* Create the dense link storage */ if (H5G__dense_create(file_dst, linfo_dst, udata->common.src_pline) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create 'dense' form of new format group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create 'dense' form of new format group"); } /* end if */ } /* end else */ @@ -425,9 +415,6 @@ H5O__linfo_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t *fi * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Sept 26 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -441,21 +428,21 @@ H5O__linfo_post_copy_file_cb(const H5O_link_t *src_lnk, void *_udata) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(src_lnk); - HDassert(udata); + assert(src_lnk); + assert(udata); /* Copy the link (and the object it points to) */ if (H5L__link_copy_file(udata->dst_oloc->file, src_lnk, udata->src_oloc, &dst_lnk, udata->cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy link") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy link"); dst_lnk_init = TRUE; /* Set metadata tag in API context */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) /* Insert the new object in the destination file's group */ /* (Doesn't increment the link count - that's already been taken care of for hard links) */ if (H5G__dense_insert(udata->dst_oloc->file, udata->dst_linfo, &dst_lnk) < 0) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert destination link") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTINSERT, H5_ITER_ERROR, "unable to insert destination link"); /* Reset metadata tag in API context */ H5_END_TAG @@ -475,9 +462,6 @@ H5O__linfo_post_copy_file_cb(const H5O_link_t *src_lnk, void *_udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 26, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -491,19 +475,19 @@ H5O__linfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_l FUNC_ENTER_PACKAGE /* check args */ - HDassert(src_oloc && src_oloc->file); - HDassert(linfo_src); - HDassert(dst_oloc && dst_oloc->file); - HDassert(H5F_addr_defined(dst_oloc->addr)); - HDassert(linfo_dst); - HDassert(cpy_info); + assert(src_oloc && src_oloc->file); + assert(linfo_src); + assert(dst_oloc && dst_oloc->file); + assert(H5_addr_defined(dst_oloc->addr)); + assert(linfo_dst); + assert(cpy_info); /* If we are performing a 'shallow hierarchy' copy, get out now */ if (cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Check for copying dense link storage */ - if (H5F_addr_defined(linfo_src->fheap_addr)) { + if (H5_addr_defined(linfo_src->fheap_addr)) { H5O_linfo_postcopy_ud_t udata; /* User data for iteration callback */ /* Set up dense link iteration user data */ @@ -515,7 +499,7 @@ H5O__linfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_l /* Iterate over the links in the group, building a table of the link messages */ if (H5G__dense_iterate(src_oloc->file, linfo_src, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, H5O__linfo_post_copy_file_cb, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links") + HGOTO_ERROR(H5E_SYM, H5E_CANTNEXT, FAIL, "error iterating over links"); } /* end if */ done: @@ -529,9 +513,6 @@ H5O__linfo_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_l * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 23 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -542,25 +523,25 @@ H5O__linfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(linfo); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Track creation order of links:", linfo->track_corder ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "Index creation order of links:", linfo->index_corder ? "TRUE" : "FALSE"); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of links:", linfo->nlinks); - HDfprintf(stream, "%*s%-*s %" PRId64 "\n", indent, "", fwidth, - "Max. creation order value:", linfo->max_corder); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "'Dense' link storage fractal heap address:", linfo->fheap_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "'Dense' link storage name index v2 B-tree address:", linfo->name_bt2_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "'Dense' link storage creation order index v2 B-tree address:", linfo->corder_bt2_addr); + assert(f); + assert(linfo); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Track creation order of links:", linfo->track_corder ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Index creation order of links:", linfo->index_corder ? "TRUE" : "FALSE"); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of links:", linfo->nlinks); + fprintf(stream, "%*s%-*s %" PRId64 "\n", indent, "", fwidth, + "Max. creation order value:", linfo->max_corder); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "'Dense' link storage fractal heap address:", linfo->fheap_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "'Dense' link storage name index v2 B-tree address:", linfo->name_bt2_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "'Dense' link storage creation order index v2 B-tree address:", linfo->corder_bt2_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__linfo_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Olink.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Olink.c index ea1a1c07e8..88611ec08f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Olink.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Olink.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5Olink.c - * Aug 29 2005 - * Quincey Koziol * - * Purpose: Link messages. + * Purpose: Link messages * *------------------------------------------------------------------------- */ @@ -101,106 +98,114 @@ H5FL_DEFINE_STATIC(H5O_link_t); * Purpose: Decode a message and return a pointer to * a newly allocated one. * - * Return: Success: Ptr to new message in native order. - * - * Failure: NULL - * - * Programmer: Quincey Koziol - * Aug 29 2005 - * + * Return: Success: Pointer to new message in native order + * Failure: NULL *------------------------------------------------------------------------- */ static void * H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_link_t *lnk = NULL; /* Pointer to link message */ - size_t len = 0; /* Length of a string in the message */ - unsigned char link_flags; /* Flags for encoding link info */ - const uint8_t *p_end = p + p_size; /* End of the p buffer */ - void *ret_value = NULL; /* Return value */ + H5O_link_t *lnk = NULL; /* Pointer to link message */ + size_t len = 0; /* Length of a string in the message */ + unsigned char link_flags; /* Flags for encoding link info */ + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); - /* decode */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (*p++ != H5O_LINK_VERSION) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message"); /* Allocate space for message */ if (NULL == (lnk = H5FL_CALLOC(H5O_link_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Get the encoding flags for the link */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); link_flags = *p++; if (link_flags & ~H5O_LINK_ALL_FLAGS) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad flag value for message"); /* Check for non-default link type */ if (link_flags & H5O_LINK_STORE_LINK_TYPE) { /* Get the type of the link */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); lnk->type = (H5L_type_t)*p++; if (lnk->type < H5L_TYPE_HARD || lnk->type > H5L_TYPE_MAX) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad link type") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad link type"); + } else lnk->type = H5L_TYPE_HARD; /* Get the link creation time from the file */ if (link_flags & H5O_LINK_STORE_CORDER) { - INT64DECODE(p, lnk->corder) + if (H5_IS_BUFFER_OVERFLOW(p, 8, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + INT64DECODE(p, lnk->corder); lnk->corder_valid = TRUE; - } /* end if */ + } else { lnk->corder = 0; lnk->corder_valid = FALSE; - } /* end else */ + } /* Check for non-default name character set */ if (link_flags & H5O_LINK_STORE_NAME_CSET) { /* Get the link name's character set */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); lnk->cset = (H5T_cset_t)*p++; if (lnk->cset < H5T_CSET_ASCII || lnk->cset > H5T_CSET_UTF8) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad cset type") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad cset type"); + } else lnk->cset = H5T_CSET_ASCII; /* Get the length of the link's name */ switch (link_flags & H5O_LINK_NAME_SIZE) { case 0: /* 1 byte size */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); len = *p++; break; case 1: /* 2 byte size */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, len); break; case 2: /* 4 byte size */ + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT32DECODE(p, len); break; case 3: /* 8 byte size */ + if (H5_IS_BUFFER_OVERFLOW(p, 8, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT64DECODE(p, len); break; default: - HDassert(0 && "bad size for name"); - } /* end switch */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no appropriate size for name length"); + } if (len == 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid name length") - - /* Make sure that length doesn't exceed buffer size, which could occur - when the file is corrupted */ - if (p + len > p_end) - HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "name length causes read past end of buffer") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid name length"); /* Get the link's name */ + if (H5_IS_BUFFER_OVERFLOW(p, len, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (NULL == (lnk->name = (char *)H5MM_malloc(len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5MM_memcpy(lnk->name, p, len); lnk->name[len] = '\0'; p += len; @@ -209,22 +214,23 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE switch (lnk->type) { case H5L_TYPE_HARD: /* Get the address of the object the link points to */ + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(lnk->u.hard.addr)); break; case H5L_TYPE_SOFT: /* Get the link value */ - UINT16DECODE(p, len) + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT16DECODE(p, len); if (len == 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid link length") - - /* Make sure that length doesn't exceed buffer size, which could occur - when the file is corrupted */ - if (p + len > p_end) - HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "name length causes read past end of buffer") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid link length"); + if (H5_IS_BUFFER_OVERFLOW(p, len, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (NULL == (lnk->u.soft.name = (char *)H5MM_malloc((size_t)len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5MM_memcpy(lnk->u.soft.name, p, len); lnk->u.soft.name[len] = '\0'; p += len; @@ -236,40 +242,39 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE case H5L_TYPE_MAX: default: if (lnk->type < H5L_TYPE_UD_MIN || lnk->type > H5L_TYPE_MAX) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown link type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unknown link type"); /* A UD link. Get the user-supplied data */ - UINT16DECODE(p, len) + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT16DECODE(p, len); + if (lnk->type == H5L_TYPE_EXTERNAL && len < 3) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "external link information length < 3"); lnk->u.ud.size = len; if (len > 0) { - /* Make sure that length doesn't exceed buffer size, which could - occur when the file is corrupted */ - if (p + len > p_end) - HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "name length causes read past end of buffer") - + if (H5_IS_BUFFER_OVERFLOW(p, len, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (NULL == (lnk->u.ud.udata = H5MM_malloc((size_t)len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5MM_memcpy(lnk->u.ud.udata, p, len); p += len; } else lnk->u.ud.udata = NULL; - } /* end switch */ + } /* Set return value */ ret_value = lnk; done: - if (ret_value == NULL) - if (lnk != NULL) { - if (lnk->name != NULL) - H5MM_xfree(lnk->name); - if (lnk->type == H5L_TYPE_SOFT && lnk->u.soft.name != NULL) - H5MM_xfree(lnk->u.soft.name); - if (lnk->type >= H5L_TYPE_UD_MIN && lnk->u.ud.size > 0 && lnk->u.ud.udata != NULL) - H5MM_xfree(lnk->u.ud.udata); - lnk = H5FL_FREE(H5O_link_t, lnk); - } /* end if */ + if (!ret_value && lnk) { + H5MM_xfree(lnk->name); + if (lnk->type == H5L_TYPE_SOFT && lnk->u.soft.name != NULL) + H5MM_xfree(lnk->u.soft.name); + if (lnk->type >= H5L_TYPE_UD_MIN && lnk->u.ud.size > 0 && lnk->u.ud.udata != NULL) + H5MM_xfree(lnk->u.ud.udata); + H5FL_FREE(H5O_link_t, lnk); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__link_decode() */ @@ -281,9 +286,6 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 29 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -296,13 +298,13 @@ H5O__link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(lnk); + assert(f); + assert(p); + assert(lnk); /* Get length of link's name */ len = (uint64_t)HDstrlen(lnk->name); - HDassert(len > 0); + assert(len > 0); /* encode */ *p++ = H5O_LINK_VERSION; @@ -327,7 +329,7 @@ H5O__link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co /* Store the link creation order in the file, if its valid */ if (lnk->corder_valid) - INT64ENCODE(p, lnk->corder) + INT64ENCODE(p, lnk->corder); /* Store a non-default link name character set */ if (link_flags & H5O_LINK_STORE_NAME_CSET) @@ -352,7 +354,7 @@ H5O__link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co break; default: - HDassert(0 && "bad size for name"); + assert(0 && "bad size for name"); } /* end switch */ /* Store the link's name */ @@ -369,8 +371,8 @@ H5O__link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co case H5L_TYPE_SOFT: /* Store the link value */ len = (uint16_t)HDstrlen(lnk->u.soft.name); - HDassert(len > 0); - UINT16ENCODE(p, len) + assert(len > 0); + UINT16ENCODE(p, len); H5MM_memcpy(p, lnk->u.soft.name, (size_t)len); p += len; break; @@ -380,11 +382,11 @@ H5O__link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co case H5L_TYPE_ERROR: case H5L_TYPE_MAX: default: - HDassert(lnk->type >= H5L_TYPE_UD_MIN && lnk->type <= H5L_TYPE_MAX); + assert(lnk->type >= H5L_TYPE_UD_MIN && lnk->type <= H5L_TYPE_MAX); /* Store the user-supplied data, however long it is */ len = (uint16_t)lnk->u.ud.size; - UINT16ENCODE(p, len) + UINT16ENCODE(p, len); if (len > 0) { H5MM_memcpy(p, lnk->u.ud.udata, (size_t)len); p += len; @@ -405,9 +407,6 @@ H5O__link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * * Failure: NULL * - * Programmer: Quincey Koziol - * Aug 29 2005 - * *------------------------------------------------------------------------- */ static void * @@ -420,27 +419,27 @@ H5O__link_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(lnk); + assert(lnk); if (!dest && NULL == (dest = H5FL_MALLOC(H5O_link_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy static information */ *dest = *lnk; /* Duplicate the link's name */ - HDassert(lnk->name); + assert(lnk->name); if (NULL == (dest->name = H5MM_xstrdup(lnk->name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate link name") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate link name"); /* Copy other information needed for different link types */ if (lnk->type == H5L_TYPE_SOFT) { if (NULL == (dest->u.soft.name = H5MM_xstrdup(lnk->u.soft.name))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate soft link value") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't duplicate soft link value"); } /* end if */ else if (lnk->type >= H5L_TYPE_UD_MIN) { if (lnk->u.ud.size > 0) { if (NULL == (dest->u.ud.udata = H5MM_malloc(lnk->u.ud.size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5MM_memcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size); } /* end if */ } /* end if */ @@ -471,9 +470,6 @@ H5O__link_copy(const void *_mesg, void *_dest) * * Failure: zero * - * Programmer: Quincey Koziol - * Aug 29 2005 - * *------------------------------------------------------------------------- */ static size_t @@ -526,7 +522,7 @@ H5O__link_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void case H5L_TYPE_EXTERNAL: case H5L_TYPE_MAX: default: /* Default is user-defined link type */ - HDassert(lnk->type >= H5L_TYPE_UD_MIN); + assert(lnk->type >= H5L_TYPE_UD_MIN); ret_value += 2 + /* User-defined data size */ lnk->u.ud.size; /* User-defined data */ break; @@ -543,9 +539,6 @@ H5O__link_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, August 29, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -576,9 +569,6 @@ H5O__link_reset(void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, August 29, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -588,7 +578,7 @@ H5O__link_free(void *_mesg) FUNC_ENTER_PACKAGE_NOERR - HDassert(lnk); + assert(lnk); lnk = H5FL_FREE(H5O_link_t, lnk); @@ -602,9 +592,6 @@ H5O__link_free(void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, August 29, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -617,8 +604,8 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(lnk); + assert(f); + assert(lnk); /* Check for adjusting the link count when the link is removed */ /* Adjust the reference count of the object when a hard link is removed */ @@ -628,12 +615,12 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) /* Construct object location for object, in order to decrement it's ref count */ H5O_loc_reset(&oloc); oloc.file = f; - HDassert(H5F_addr_defined(lnk->u.hard.addr)); + assert(H5_addr_defined(lnk->u.hard.addr)); oloc.addr = lnk->u.hard.addr; /* Decrement the ref count for the object */ if (H5O_link(&oloc, -1) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to decrement object link count"); } /* end if */ /* Perform the "delete" callback when a user-defined link is removed */ else if (lnk->type >= H5L_TYPE_UD_MIN) { @@ -641,24 +628,24 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) /* Get the link class for this type of link. */ if (NULL == (link_class = H5L_find_class(lnk->type))) - HGOTO_ERROR(H5E_OHDR, H5E_NOTREGISTERED, FAIL, "link class not registered") + HGOTO_ERROR(H5E_OHDR, H5E_NOTREGISTERED, FAIL, "link class not registered"); /* Check for delete callback */ if (link_class->del_func) { /* Get a file ID for the file the link is in */ if ((file_id = H5F_get_id(f)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to get file ID"); /* Call user-defined link's 'delete' callback */ if ((link_class->del_func)(lnk->name, file_id, lnk->u.ud.udata, lnk->u.ud.size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure") + HGOTO_ERROR(H5E_OHDR, H5E_CALLBACK, FAIL, "link deletion callback returned failure"); } /* end if */ } /* end if */ done: /* Release the file ID */ if (file_id > 0 && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file") + HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEFILE, FAIL, "can't close file"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_link_delete() */ @@ -673,9 +660,6 @@ H5O_link_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) * * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, June 26, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -685,8 +669,8 @@ H5O__link_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSE FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(deleted); - HDassert(cpy_info); + assert(deleted); + assert(cpy_info); /* If we are performing a 'shallow hierarchy' copy, and this link won't * be included in the final group, indicate that it should be deleted @@ -708,9 +692,6 @@ H5O__link_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_UNUSE * * Failure: NULL * - * Programmer: Quincey Koziol - * November 7, 2005 - * *------------------------------------------------------------------------- */ static void * @@ -724,18 +705,18 @@ H5O__link_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t H5_A FUNC_ENTER_PACKAGE /* check args */ - HDassert(link_src); - HDassert(cpy_info); - HDassert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth); + assert(link_src); + assert(cpy_info); + assert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth); /* Sanity check source link type */ if (link_src->type > H5L_TYPE_SOFT && link_src->type < H5L_TYPE_UD_MIN) - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "unrecognized built-in link type") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, NULL, "unrecognized built-in link type"); /* Allocate "blank" link for destination */ /* (values will be filled in during 'post copy' operation) */ if (NULL == (ret_value = H5FL_CALLOC(H5O_link_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -748,9 +729,6 @@ H5O__link_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *native_src, H5F_t H5_A * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 7, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -764,17 +742,17 @@ H5O__link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_lo FUNC_ENTER_PACKAGE /* check args */ - HDassert(link_src); - HDassert(dst_oloc); - HDassert(H5F_addr_defined(dst_oloc->addr)); - HDassert(dst_oloc->file); - HDassert(link_dst); - HDassert(cpy_info); - HDassert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth); + assert(link_src); + assert(dst_oloc); + assert(H5_addr_defined(dst_oloc->addr)); + assert(dst_oloc->file); + assert(link_dst); + assert(cpy_info); + assert(cpy_info->max_depth < 0 || cpy_info->curr_depth < cpy_info->max_depth); /* Copy the link (and the object it points to) */ if (H5L__link_copy_file(dst_oloc->file, link_src, src_oloc, link_dst, cpy_info) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy link") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -787,9 +765,6 @@ H5O__link_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_lo * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Aug 29 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -801,37 +776,37 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(lnk); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Link Type:", - (lnk->type == H5L_TYPE_HARD - ? "Hard" - : (lnk->type == H5L_TYPE_SOFT - ? "Soft" - : (lnk->type == H5L_TYPE_EXTERNAL - ? "External" - : (lnk->type >= H5L_TYPE_UD_MIN ? "User-defined" : "Unknown"))))); + assert(f); + assert(lnk); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Link Type:", + (lnk->type == H5L_TYPE_HARD + ? "Hard" + : (lnk->type == H5L_TYPE_SOFT + ? "Soft" + : (lnk->type == H5L_TYPE_EXTERNAL + ? "External" + : (lnk->type >= H5L_TYPE_UD_MIN ? "User-defined" : "Unknown"))))); if (lnk->corder_valid) - HDfprintf(stream, "%*s%-*s %" PRId64 "\n", indent, "", fwidth, "Creation Order:", lnk->corder); + fprintf(stream, "%*s%-*s %" PRId64 "\n", indent, "", fwidth, "Creation Order:", lnk->corder); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Link Name Character Set:", - (lnk->cset == H5T_CSET_ASCII ? "ASCII" : (lnk->cset == H5T_CSET_UTF8 ? "UTF-8" : "Unknown"))); - HDfprintf(stream, "%*s%-*s '%s'\n", indent, "", fwidth, "Link Name:", lnk->name); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Link Name Character Set:", + (lnk->cset == H5T_CSET_ASCII ? "ASCII" : (lnk->cset == H5T_CSET_UTF8 ? "UTF-8" : "Unknown"))); + fprintf(stream, "%*s%-*s '%s'\n", indent, "", fwidth, "Link Name:", lnk->name); /* Display link-specific information */ switch (lnk->type) { case H5L_TYPE_HARD: - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Object address:", lnk->u.hard.addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Object address:", lnk->u.hard.addr); break; case H5L_TYPE_SOFT: - HDfprintf(stream, "%*s%-*s '%s'\n", indent, "", fwidth, "Link Value:", lnk->u.soft.name); + fprintf(stream, "%*s%-*s '%s'\n", indent, "", fwidth, "Link Value:", lnk->u.soft.name); break; case H5L_TYPE_ERROR: @@ -843,17 +818,17 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in const char *objname = (const char *)lnk->u.ud.udata + (HDstrlen((const char *)lnk->u.ud.udata) + 1); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, - "External File Name:", (const char *)lnk->u.ud.udata); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "External Object Name:", objname); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "External File Name:", (const char *)lnk->u.ud.udata); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "External Object Name:", objname); } /* end if */ else { - HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, - "User-Defined Link Size:", lnk->u.ud.size); + fprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, + "User-Defined Link Size:", lnk->u.ud.size); } /* end else */ } /* end if */ else - HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type") + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unrecognized link type"); break; } /* end switch */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Omessage.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Omessage.c index 29220e038a..d76409d55a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Omessage.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Omessage.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Omessage.c - * Dec 3 2006 - * Quincey Koziol * * Purpose: Object header message routines. * @@ -93,9 +90,6 @@ static herr_t H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_clas * * Failure: Negative * - * Programmer: Quincey Koziol - * Dec 1 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -107,22 +101,22 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, unsi FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(loc); - HDassert(type_id < NELMTS(H5O_msg_class_g)); - HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); - HDassert(mesg); + assert(loc); + assert(type_id < NELMTS(H5O_msg_class_g)); + assert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); + assert(mesg); /* Pin the object header */ if (NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header"); /* Go append message to object header */ if (H5O_msg_append_oh(loc->file, oh, type_id, mesg_flags, update_flags, mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to append to object header"); done: if (oh && H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_create() */ @@ -138,9 +132,6 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, unsi * * Failure: Negative * - * Programmer: Quincey Koziol - * Dec 31 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -153,18 +144,18 @@ H5O_msg_append_oh(H5F_t *f, H5O_t *oh, unsigned type_id, unsigned mesg_flags, un FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(oh); - HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(f); + assert(oh); + assert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); - HDassert(mesg); + assert(type); + assert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); + assert(mesg); /* Append new message to object header */ if (H5O__msg_append_real(f, oh, type, mesg_flags, update_flags, mesg) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new message in header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to create new message in header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -179,9 +170,6 @@ H5O_msg_append_oh(H5F_t *f, H5O_t *oh, unsigned type_id, unsigned mesg_flags, un * * Failure: Negative * - * Programmer: Quincey Koziol - * Dec 8 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -194,19 +182,19 @@ H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); - HDassert(type); - HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); - HDassert(mesg); + assert(f); + assert(oh); + assert(type); + assert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); + assert(mesg); /* Allocate space for a new message */ if (H5O__msg_alloc(f, oh, type, &mesg_flags, mesg, &idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create new message") + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "unable to create new message"); /* Copy the information for the message */ if (H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to write message"); #ifdef H5O_DEBUG H5O__assert(oh); #endif /* H5O_DEBUG */ @@ -229,9 +217,6 @@ H5O__msg_append_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned * * Failure: Negative * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -244,27 +229,27 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, unsig FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(mesg); - HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); + assert(type); + assert(mesg); + assert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); /* Pin the object header */ if (NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header"); /* Call the "real" modify routine */ if (H5O__msg_write_real(loc->file, oh, type, mesg_flags, update_flags, mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message"); done: if (oh && H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_write() */ @@ -282,9 +267,6 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, unsig * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Dec 6 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -297,18 +279,18 @@ H5O_msg_write_oh(H5F_t *f, H5O_t *oh, unsigned type_id, unsigned mesg_flags, uns FUNC_ENTER_NOAPI_TAG(oh->cache_info.addr, FAIL) /* check args */ - HDassert(f); - HDassert(oh); - HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(f); + assert(oh); + assert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(mesg); - HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); + assert(type); + assert(mesg); + assert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); /* Call the "real" modify routine */ if (H5O__msg_write_real(f, oh, type, mesg_flags, update_flags, mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to write object header message"); done: FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -328,9 +310,6 @@ H5O_msg_write_oh(H5F_t *f, H5O_t *oh, unsigned type_id, unsigned mesg_flags, uns * * Failure: Negative * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -344,23 +323,23 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned m FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); - HDassert(type); - HDassert(type != H5O_MSG_ATTR); - HDassert(mesg); - HDassert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); + assert(f); + assert(oh); + assert(type); + assert(type != H5O_MSG_ATTR); + assert(mesg); + assert(0 == (mesg_flags & ~H5O_MSG_FLAG_BITS)); /* Locate message of correct type */ for (idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) if (type == idx_msg->type) break; if (idx == oh->nmesgs) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found"); /* Check for modifying a constant message */ if (!(update_flags & H5O_UPDATE_FORCE) && (idx_msg->flags & H5O_MSG_FLAG_CONSTANT)) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to modify constant message"); /* This message is shared, but it's being modified. */ else if ((idx_msg->flags & H5O_MSG_FLAG_SHARED) || (idx_msg->flags & H5O_MSG_FLAG_SHAREABLE)) { htri_t status; /* Status of "try share" call */ @@ -368,13 +347,13 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned m /* First, sanity check to make sure it's not a committed message; * these can't ever be modified. */ - HDassert(((H5O_shared_t *)idx_msg->native)->type != H5O_SHARE_TYPE_COMMITTED); + assert(((H5O_shared_t *)idx_msg->native)->type != H5O_SHARE_TYPE_COMMITTED); /* Also, sanity check that a message doesn't switch status from being * shared (or shareable) to being unshareable. (Which could cause * a message to increase in size in the object header) */ - HDassert(!(mesg_flags & H5O_MSG_FLAG_DONTSHARE)); + assert(!(mesg_flags & H5O_MSG_FLAG_DONTSHARE)); /* Remove the old message from the SOHM index */ /* (It would be more efficient to try to share the message first, then @@ -384,7 +363,7 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned m * header to the SOHM heap), so just delete it first -QAK) */ if (H5SM_delete(f, oh, (H5O_shared_t *)idx_msg->native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete message from SOHM index") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete message from SOHM index"); /* If we're replacing a shared message, the new message must be shared * (or else it may increase in size!), so pass in NULL for the OH @@ -395,14 +374,14 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned m */ if ((status = H5SM_try_share(f, ((mesg_flags & H5O_MSG_FLAG_SHARED) ? NULL : oh), 0, idx_msg->type->id, mesg, &mesg_flags)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "error while trying to share message") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "error while trying to share message"); if (status == FALSE && (mesg_flags & H5O_MSG_FLAG_SHARED)) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "message changed sharing status") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "message changed sharing status"); } /* end if */ /* Copy the information for the message */ if (H5O__copy_mesg(f, oh, idx, type, mesg, mesg_flags, update_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to write message"); #ifdef H5O_DEBUG H5O__assert(oh); #endif /* H5O_DEBUG */ @@ -428,9 +407,6 @@ H5O__msg_write_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned m * * Failure: NULL * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ void * @@ -442,22 +418,22 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg) FUNC_ENTER_NOAPI_TAG(loc->addr, NULL) /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(type_id < NELMTS(H5O_msg_class_g)); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to protect object header"); /* Call the "real" read routine */ if (NULL == (ret_value = H5O_msg_read_oh(loc->file, oh, type_id, mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message") + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header message"); done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_msg_read() */ @@ -479,9 +455,6 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg) * * Failure: NULL * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ void * @@ -494,18 +467,18 @@ H5O_msg_read_oh(H5F_t *f, H5O_t *oh, unsigned type_id, void *mesg) FUNC_ENTER_NOAPI_NOINIT /* check args */ - HDassert(f); - HDassert(oh); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(f); + assert(oh); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Scan through the messages looking for the right one */ for (idx = 0; idx < oh->nmesgs; idx++) if (type == oh->mesg[idx].type) break; if (idx == oh->nmesgs) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "message type not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, NULL, "message type not found"); /* * Decode the message if necessary. If the message is shared then retrieve @@ -519,7 +492,7 @@ H5O_msg_read_oh(H5F_t *f, H5O_t *oh, unsigned type_id, void *mesg) * returning. */ if (NULL == (ret_value = (type->copy)(oh->mesg[idx].native, mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy message to user space"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -534,9 +507,6 @@ H5O_msg_read_oh(H5F_t *f, H5O_t *oh, unsigned type_id, void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 12 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -548,13 +518,13 @@ H5O_msg_reset(unsigned type_id, void *native) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Call the "real" reset routine */ if (H5O__msg_reset_real(type, native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "unable to reset object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -569,9 +539,6 @@ H5O_msg_reset(unsigned type_id, void *native) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 12 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -582,15 +549,15 @@ H5O__msg_reset_real(const H5O_msg_class_t *type, void *native) FUNC_ENTER_PACKAGE /* check args */ - HDassert(type); + assert(type); if (native) { if (type->reset) { if ((type->reset)(native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "reset method failed"); } /* end if */ else - HDmemset(native, 0, type->native_size); + memset(native, 0, type->native_size); } /* end if */ done: @@ -607,9 +574,6 @@ H5O__msg_reset_real(const H5O_msg_class_t *type, void *native) * * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ void * @@ -621,9 +585,9 @@ H5O_msg_free(unsigned type_id, void *mesg) FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Call the "real" free routine */ ret_value = H5O_msg_free_real(type, mesg); @@ -638,9 +602,6 @@ H5O_msg_free(unsigned type_id, void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, Sep 6, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -649,7 +610,7 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg) FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(mesg); + assert(mesg); /* Free any native information */ mesg->native = H5O_msg_free_real(mesg->type, mesg->native); @@ -666,9 +627,6 @@ H5O__msg_free_mesg(H5O_mesg_t *mesg) * Return: Success: NULL * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ void * @@ -677,7 +635,7 @@ H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ - HDassert(type); + assert(type); if (msg_native) { H5O__msg_reset_real(type, msg_native); @@ -700,9 +658,6 @@ H5O_msg_free_real(const H5O_msg_class_t *type, void *msg_native) * * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, May 21, 1998 - * *------------------------------------------------------------------------- */ void * @@ -714,14 +669,14 @@ H5O_msg_copy(unsigned type_id, const void *mesg, void *dst) FUNC_ENTER_NOAPI(NULL) /* check args */ - HDassert(mesg); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(mesg); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Call the message class's copy routine */ if (NULL == (ret_value = (type->copy)(mesg, dst))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to copy object header message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -737,9 +692,6 @@ H5O_msg_copy(unsigned type_id, const void *mesg, void *dst) * * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, April 21, 1998 - * *------------------------------------------------------------------------- */ int @@ -753,16 +705,16 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Load the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header"); /* Count the messages of the correct type */ msg_count = H5O__msg_count_real(oh, type); @@ -770,7 +722,7 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id) done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_count() */ @@ -785,9 +737,6 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id) * * Failure: (can't fail) * - * Programmer: Quincey Koziol - * Tuesday, February 6, 2007 - * *------------------------------------------------------------------------- */ unsigned @@ -799,8 +748,8 @@ H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(oh); - HDassert(type); + assert(oh); + assert(type); /* Loop over all messages, counting the ones of the type looked for */ for (u = ret_value = 0; u < oh->nmesgs; u++) @@ -823,9 +772,6 @@ H5O__msg_count_real(const H5O_t *oh, const H5O_msg_class_t *type) * not be determined due to some error such as * not being able to read the object header. * - * Programmer: Robb Matzke - * Monday, November 2, 1998 - * *------------------------------------------------------------------------- */ htri_t @@ -836,21 +782,21 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id) FUNC_ENTER_NOAPI_TAG(loc->addr, FAIL) - HDassert(loc); - HDassert(loc->file); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(loc); + assert(loc->file); + assert(type_id < NELMTS(H5O_msg_class_g)); /* Load the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header"); /* Call the "real" exists routine */ if ((ret_value = H5O_msg_exists_oh(oh, type_id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to verify object header message") + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, FAIL, "unable to verify object header message"); done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5O_msg_exists() */ @@ -868,9 +814,6 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id) * not be determined due to some error such as * not being able to read the object header. * - * Programmer: Robb Matzke - * Monday, November 2, 1998 - * *------------------------------------------------------------------------- */ htri_t @@ -882,15 +825,15 @@ H5O_msg_exists_oh(const H5O_t *oh, unsigned type_id) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(oh); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(oh); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Scan through the messages looking for the right one */ for (u = 0; u < oh->nmesgs; u++) if (type == oh->mesg[u].type) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); done: FUNC_LEAVE_NOAPI(ret_value) @@ -910,9 +853,6 @@ H5O_msg_exists_oh(const H5O_t *oh, unsigned type_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 28 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -925,25 +865,25 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Pin the object header */ if (NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header"); /* Call the "real" remove routine */ if ((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message"); done: if (oh && H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_remove() */ @@ -959,9 +899,6 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 6 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -975,25 +912,25 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, H5O_oper FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(H5O_ATTR_ID != type_id); /* Attributes are modified in another routine */ + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Pin the object header */ if (NULL == (oh = H5O_pin(loc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPIN, FAIL, "unable to pin object header"); /* Call the "real" remove routine */ if ((ret_value = H5O__msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to remove object header message"); done: if (oh && H5O_unpin(oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPIN, FAIL, "unable to unpin object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_remove_op() */ @@ -1007,9 +944,6 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, H5O_oper * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sep 6 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -1023,14 +957,14 @@ H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, un FUNC_ENTER_PACKAGE /* check args */ - HDassert(mesg); + assert(mesg); /* Check for callback routine */ if (udata->op) { /* Call the iterator callback */ if ((try_remove = (udata->op)(mesg->native, sequence, udata->op_data)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, - "object header message deletion callback failed") + "object header message deletion callback failed"); } /* end if */ else { /* If there's no callback routine, does the sequence # match? */ @@ -1047,14 +981,14 @@ H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, un */ /* Convert message into a null message */ if (H5O__release_mesg(udata->f, oh, mesg, udata->adj_link) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to release message"); /* Indicate that the object header was modified */ *oh_modified = H5O_MODIFY_CONDENSE; /* Break out now, if we've found the correct message */ if (udata->sequence == H5O_FIRST || udata->sequence != H5O_ALL) - HGOTO_DONE(H5_ITER_STOP) + HGOTO_DONE(H5_ITER_STOP); } /* end if */ done: @@ -1072,9 +1006,6 @@ H5O__msg_remove_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, un * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 28 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1088,13 +1019,13 @@ H5O__msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, int seque FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); - HDassert(type); + assert(f); + assert(oh); + assert(type); /* Make certain we are allowed to modify the file */ if (0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "no write intent on file"); /* Set up iterator operator data */ udata.f = f; @@ -1108,11 +1039,11 @@ H5O__msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, int seque op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5O__msg_remove_cb; if (H5O__msg_iterate_real(f, oh, type, &op, &udata) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error iterating over messages") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "error iterating over messages"); /* Fail if we tried to remove any constant messages */ if (udata.nfailed) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to remove constant message(s)") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to remove constant message(s)"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1127,9 +1058,6 @@ H5O__msg_remove_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, int seque * value of the last operator if it was non-zero, or zero if all * object headers were processed. * - * Programmer: Quincey Koziol - * Nov 19 2004 - * * Description: * This function iterates over the object headers of an object * specified with 'loc' of type 'type_id'. For each object header of the @@ -1158,17 +1086,17 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, const H5O_mesg_operator_ FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(op); + assert(type); + assert(op); /* Protect the object header to iterate over */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header"); /* Call the "real" iterate routine */ if ((ret_value = H5O__msg_iterate_real(loc->file, oh, type, op, op_data)) < 0) @@ -1176,7 +1104,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, const H5O_mesg_operator_ done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_iterate() */ @@ -1190,9 +1118,6 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, const H5O_mesg_operator_ * value of the last operator if it was non-zero, or zero if all * object headers were processed. * - * Programmer: Quincey Koziol - * Sep 6 2005 - * * Description: * This function iterates over the object headers of an object * specified with 'ent' of type 'type_id'. For each object header of the @@ -1224,11 +1149,11 @@ H5O__msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const H5 FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); - HDassert(type); - HDassert(op); - HDassert(op->u.app_op); + assert(f); + assert(oh); + assert(type); + assert(op); + assert(op->u.app_op); /* Iterate over messages */ for (sequence = 0, idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs && !ret_value; idx++, idx_msg++) { @@ -1265,15 +1190,15 @@ H5O__msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const H5 */ if (oh_modified & H5O_MODIFY_CONDENSE) if (H5O__condense_header(f, oh) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTPACK, FAIL, "can't pack object header"); /* Mark object header as changed */ if (H5O_touch_oh(f, oh, FALSE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object") + HDONE_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object"); /* Mark object header as dirty in cache */ if (H5AC_mark_entry_dirty(oh) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty") + HGOTO_ERROR(H5E_OHDR, H5E_CANTMARKDIRTY, FAIL, "unable to mark object header as dirty"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -1287,9 +1212,6 @@ H5O__msg_iterate_real(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, const H5 * * Return: Size of message on success, 0 on failure * - * Programmer: Quincey Koziol - * Feb 13 2003 - * *------------------------------------------------------------------------- */ size_t @@ -1301,16 +1223,16 @@ H5O_msg_raw_size(const H5F_t *f, unsigned type_id, hbool_t disable_shared, const FUNC_ENTER_NOAPI(0) /* Check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(type->raw_size); - HDassert(f); - HDassert(mesg); + assert(type); + assert(type->raw_size); + assert(f); + assert(mesg); /* Compute the raw data size for the mesg */ if (0 == (ret_value = (type->raw_size)(f, disable_shared, mesg))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1327,9 +1249,6 @@ H5O_msg_raw_size(const H5F_t *f, unsigned type_id, hbool_t disable_shared, const * * Return: Size of message on success, 0 on failure * - * Programmer: Quincey Koziol - * Sep 6 2005 - * *------------------------------------------------------------------------- */ size_t @@ -1343,24 +1262,24 @@ H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, const void *mesg FUNC_ENTER_NOAPI(0) /* Check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(type->raw_size); - HDassert(f); - HDassert(mesg); + assert(type); + assert(type->raw_size); + assert(f); + assert(mesg); /* Get the property list */ if (NULL == (ocpl = (H5P_genplist_t *)H5I_object(ocpl_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, 0, "not a property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, 0, "not a property list"); /* Get any object header status flags set by properties */ if (H5P_get(ocpl, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "can't get object header flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "can't get object header flags"); /* Compute the raw data size for the mesg */ if ((ret_value = (type->raw_size)(f, FALSE, mesg)) == 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message"); /* Add in "extra" raw space */ ret_value += extra_raw; @@ -1387,9 +1306,6 @@ H5O_msg_size_f(const H5F_t *f, hid_t ocpl_id, unsigned type_id, const void *mesg * * Return: Size of message on success, 0 on failure * - * Programmer: Quincey Koziol - * Mar 7 2007 - * *------------------------------------------------------------------------- */ size_t @@ -1401,16 +1317,16 @@ H5O_msg_size_oh(const H5F_t *f, const H5O_t *oh, unsigned type_id, const void *m FUNC_ENTER_NOAPI(0) /* Check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(type->raw_size); - HDassert(f); - HDassert(mesg); + assert(type); + assert(type->raw_size); + assert(f); + assert(mesg); /* Compute the raw data size for the mesg */ if ((ret_value = (type->raw_size)(f, FALSE, mesg)) == 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, 0, "unable to determine size of message"); /* Add in "extra" raw space */ ret_value += extra_raw; @@ -1437,9 +1353,6 @@ H5O_msg_size_oh(const H5F_t *f, const H5O_t *oh, unsigned type_id, const void *m * Return: Object can be shared: TRUE * Object cannot be shared: FALSE * - * Programmer: James Laird - * January 12 2007 - * *------------------------------------------------------------------------- */ htri_t @@ -1451,10 +1364,10 @@ H5O_msg_can_share(unsigned type_id, const void *mesg) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(mesg); + assert(type); + assert(mesg); /* If there is a can_share callback, use it */ if (type->can_share) @@ -1469,7 +1382,7 @@ H5O_msg_can_share(unsigned type_id, const void *mesg) /* If the message is shareable, both copy_file and post_copy_file must be * defined */ - HDassert((type->post_copy_file && type->copy_file) || ret_value == FALSE); + assert((type->post_copy_file && type->copy_file) || ret_value == FALSE); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_can_share() */ @@ -1483,9 +1396,6 @@ H5O_msg_can_share(unsigned type_id, const void *mesg) * Return: Object can be shared: TRUE * Object cannot be shared: FALSE * - * Programmer: Quincey Koziol - * March 15 2007 - * *------------------------------------------------------------------------- */ htri_t @@ -1497,9 +1407,9 @@ H5O_msg_can_share_in_ohdr(unsigned type_id) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Otherwise, the message can be shared if messages of this type are * shareable in general; i.e., if they have the "is_sharable" flag @@ -1519,9 +1429,6 @@ H5O_msg_can_share_in_ohdr(unsigned type_id) * Return: Object is shared: TRUE * Object is not shared: FALSE * - * Programmer: James Laird - * April 5 2006 - * *------------------------------------------------------------------------- */ htri_t @@ -1539,10 +1446,10 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg) else #endif /* H5O_ENABLE_BOGUS */ { - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(mesg); + assert(type); + assert(mesg); /* If messages in a class aren't shareable, then obviously this message isn't shared! :-) */ if (type->share_flags & H5O_SHARE_IS_SHARABLE) @@ -1562,9 +1469,6 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg) * Return: Success: Non-negative * Failure: Negative * - * Programmer: James Laird - * November 1 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1576,27 +1480,27 @@ H5O_msg_set_share(unsigned type_id, const H5O_shared_t *share, void *mesg) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(type->share_flags & H5O_SHARE_IS_SHARABLE); - HDassert(mesg); - HDassert(share); - HDassert(share->type != H5O_SHARE_TYPE_UNSHARED); + assert(type); + assert(type->share_flags & H5O_SHARE_IS_SHARABLE); + assert(mesg); + assert(share); + assert(share->type != H5O_SHARE_TYPE_UNSHARED); /* If there's a special action for this class that needs to be performed * when setting the shared component, do that */ if (type->set_share) { if ((type->set_share)(mesg, share) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set shared message information") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set shared message information"); } /* end if */ else { /* Set this message as the shared component for the message, wiping out * any information that was there before */ if (H5O_set_shared((H5O_shared_t *)mesg, share) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set shared message information") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to set shared message information"); } /* end else */ done: @@ -1611,9 +1515,6 @@ H5O_msg_set_share(unsigned type_id, const H5O_shared_t *share, void *mesg) * Return: Success: Non-negative * Failure: Negative * - * Programmer: James Laird - * Oct 17 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1622,13 +1523,13 @@ H5O_msg_reset_share(unsigned H5_ATTR_NDEBUG_UNUSED type_id, void *mesg) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); - HDassert(H5O_msg_class_g[type_id]); /* map the type ID to the actual type object */ - HDassert(H5O_msg_class_g[type_id]->share_flags & H5O_SHARE_IS_SHARABLE); - HDassert(mesg); + assert(type_id < NELMTS(H5O_msg_class_g)); + assert(H5O_msg_class_g[type_id]); /* map the type ID to the actual type object */ + assert(H5O_msg_class_g[type_id]->share_flags & H5O_SHARE_IS_SHARABLE); + assert(mesg); /* Reset the shared component in the message to zero. */ - HDmemset((H5O_shared_t *)mesg, 0, sizeof(H5O_shared_t)); + memset((H5O_shared_t *)mesg, 0, sizeof(H5O_shared_t)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_msg_reset_share() */ @@ -1641,9 +1542,6 @@ H5O_msg_reset_share(unsigned H5_ATTR_NDEBUG_UNUSED type_id, void *mesg) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * March 15 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1655,17 +1553,17 @@ H5O_msg_get_crt_index(unsigned type_id, const void *mesg, H5O_msg_crt_idx_t *crt FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); - HDassert(mesg); - HDassert(crt_idx); + assert(type); + assert(mesg); + assert(crt_idx); /* If there is a "get_crt_index callback, use it */ if (type->get_crt_index) { /* Retrieve the creation index from the native message */ if ((type->get_crt_index)(mesg, crt_idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve creation index") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve creation index"); } /* end if */ else *crt_idx = 0; @@ -1684,9 +1582,6 @@ H5O_msg_get_crt_index(unsigned type_id, const void *mesg, H5O_msg_crt_idx_t *crt * * Failure: Negative * - * Programmer: Raymond Lu - * July 13, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -1698,14 +1593,14 @@ H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared, unsigned char FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(f); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Encode */ if ((type->encode)(f, disable_shared, buf, mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1721,9 +1616,6 @@ H5O_msg_encode(H5F_t *f, unsigned type_id, hbool_t disable_shared, unsigned char * * Failure: NULL * - * Programmer: Raymond Lu - * July 14, 2004 - * *------------------------------------------------------------------------- */ void * @@ -1736,14 +1628,14 @@ H5O_msg_decode(H5F_t *f, H5O_t *open_oh, unsigned type_id, size_t buf_size, cons FUNC_ENTER_NOAPI(NULL) /* check args */ - HDassert(f); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(f); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* decode */ if (NULL == (ret_value = (type->decode)(f, open_oh, 0, &ioflags, buf_size, buf))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "unable to decode message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1762,9 +1654,6 @@ H5O_msg_decode(H5F_t *f, H5O_t *open_oh, unsigned type_id, size_t buf_size, cons * * Failure: NULL * - * Programmer: Peter Cao - * June 4, 2005 - * *------------------------------------------------------------------------- */ void * @@ -1776,20 +1665,20 @@ H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, void *native_sr FUNC_ENTER_PACKAGE /* check args */ - HDassert(type); - HDassert(type->copy_file); - HDassert(file_src); - HDassert(native_src); - HDassert(file_dst); - HDassert(recompute_size); - HDassert(cpy_info); + assert(type); + assert(type->copy_file); + assert(file_src); + assert(native_src); + assert(file_dst); + assert(recompute_size); + assert(cpy_info); /* The copy_file callback will return an H5O_shared_t only if the message * to be copied is a committed datatype. */ if (NULL == (ret_value = (type->copy_file)(file_src, native_src, file_dst, recompute_size, mesg_flags, cpy_info, udata))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object header message to file") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy object header message to file"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1803,9 +1692,6 @@ H5O__msg_copy_file(const H5O_msg_class_t *type, H5F_t *file_src, void *native_sr * Return: Success: Index of message * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, September 3, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1819,38 +1705,38 @@ H5O__msg_alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned *mesg_ FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); - HDassert(mesg_flags); - HDassert(!(*mesg_flags & H5O_MSG_FLAG_SHARED)); - HDassert(type); - HDassert(native); - HDassert(mesg_idx); + assert(f); + assert(oh); + assert(mesg_flags); + assert(!(*mesg_flags & H5O_MSG_FLAG_SHARED)); + assert(type); + assert(native); + assert(mesg_idx); /* Check if message is already shared */ if ((shared_mesg = H5O_msg_is_shared(type->id, native)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "error determining if message is shared") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "error determining if message is shared"); else if (shared_mesg > 0) { /* Increment message's reference count */ if (type->link && (type->link)(f, oh, native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared message ref count") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared message ref count"); *mesg_flags |= H5O_MSG_FLAG_SHARED; } /* end if */ else { /* Attempt to share message */ if (H5SM_try_share(f, oh, 0, type->id, native, mesg_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "error determining if message should be shared") + HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, FAIL, "error determining if message should be shared"); } /* end else */ /* Allocate space in the object header for the message */ if (H5O__alloc(f, oh, type, native, &new_idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for message"); /* Get the message's "creation index", if it has one */ if (type->get_crt_index) { /* Retrieve the creation index from the native message */ if ((type->get_crt_index)(native, &oh->mesg[new_idx].crt_idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve creation index") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve creation index"); } /* end if */ /* Set new message index */ @@ -1868,9 +1754,6 @@ H5O__msg_alloc(H5F_t *f, H5O_t *oh, const H5O_msg_class_t *type, unsigned *mesg_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, September 3, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -1885,22 +1768,22 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, con FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); - HDassert(type); - HDassert(type->copy); - HDassert(mesg); + assert(f); + assert(oh); + assert(type); + assert(type->copy); + assert(mesg); /* Protect chunk */ if (NULL == (chk_proxy = H5O__chunk_protect(f, oh, idx_msg->chunkno))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header chunk"); /* Reset existing native information for the header's message */ H5O__msg_reset_real(type, idx_msg->native); /* Copy the native object for the message */ if (NULL == (idx_msg->native = (type->copy)(mesg, idx_msg->native))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header"); /* Update the message flags */ idx_msg->flags = (uint8_t)mesg_flags; @@ -1911,18 +1794,18 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, con /* Release chunk */ if (H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk"); chk_proxy = NULL; /* Update the modification time, if requested */ if (update_flags & H5O_UPDATE_TIME) if (H5O_touch_oh(f, oh, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUPDATE, FAIL, "unable to update time on object"); done: /* Release chunk, if not already released */ if (chk_proxy && H5O__chunk_unprotect(f, chk_proxy, chk_dirtied) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__copy_mesg() */ @@ -1944,9 +1827,6 @@ H5O__copy_mesg(H5F_t *f, H5O_t *oh, size_t idx, const H5O_msg_class_t *type, con * Return: Success: Non-negative * Failure: Negative * - * Programmer: James Laird - * December 21, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1958,14 +1838,14 @@ H5O_msg_delete(H5F_t *f, H5O_t *open_oh, unsigned type_id, void *mesg) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(f); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* delete */ if ((type->del) && (type->del)(f, open_oh, mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete file space for object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "unable to delete file space for object header message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1980,9 +1860,6 @@ H5O_msg_delete(H5F_t *f, H5O_t *open_oh, unsigned type_id, void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 26 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1994,9 +1871,9 @@ H5O__delete_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(mesg); - HDassert(oh); + assert(f); + assert(mesg); + assert(oh); /* Check if there is a file space deletion callback for this type of message */ if (type->del) { @@ -2005,7 +1882,7 @@ H5O__delete_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) if ((type->del)(f, oh, mesg->native) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, - "unable to delete file space for object header message") + "unable to delete file space for object header message"); } /* end if */ done: @@ -2019,9 +1896,6 @@ H5O__delete_mesg(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * May 14 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2034,8 +1908,8 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(f); - HDassert(oh); + assert(f); + assert(oh); /* Point into message's chunk's image */ p = mesg->raw - H5O_SIZEOF_MSGHDR_OH(oh); @@ -2048,10 +1922,10 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) /* Encode the message prefix */ if (oh->version == H5O_VERSION_1) - UINT16ENCODE(p, msg_id) + UINT16ENCODE(p, msg_id); else *p++ = (uint8_t)msg_id; - HDassert(mesg->raw_size < H5O_MESG_MAX_SIZE); + assert(mesg->raw_size < H5O_MESG_MAX_SIZE); UINT16ENCODE(p, mesg->raw_size); *p++ = mesg->flags; @@ -2067,15 +1941,15 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) if (oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) UINT16ENCODE(p, mesg->crt_idx); } /* end else */ - HDassert(p == mesg->raw); + assert(p == mesg->raw); #ifndef NDEBUG /* Make certain that null messages aren't in chunks w/gaps */ if (H5O_NULL_ID == msg_id) - HDassert(oh->chunk[mesg->chunkno].gap == 0); + assert(oh->chunk[mesg->chunkno].gap == 0); else /* Non-null messages should always have a native pointer */ - HDassert(mesg->native); + assert(mesg->native); #endif /* NDEBUG */ /* Encode the message itself, if it's not an "unknown" message */ @@ -2085,10 +1959,10 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) * encode a Shared Object message instead of the object * which is being shared. */ - HDassert(mesg->raw >= oh->chunk[mesg->chunkno].image); - HDassert(mesg->raw_size == H5O_ALIGN_OH(oh, mesg->raw_size)); - HDassert(mesg->raw + mesg->raw_size <= - oh->chunk[mesg->chunkno].image + (oh->chunk[mesg->chunkno].size - H5O_SIZEOF_CHKSUM_OH(oh))); + assert(mesg->raw >= oh->chunk[mesg->chunkno].image); + assert(mesg->raw_size == H5O_ALIGN_OH(oh, mesg->raw_size)); + assert(mesg->raw + mesg->raw_size <= + oh->chunk[mesg->chunkno].image + (oh->chunk[mesg->chunkno].size - H5O_SIZEOF_CHKSUM_OH(oh))); #ifndef NDEBUG /* Sanity check that the message won't overwrite past it's allocated space */ { @@ -2096,12 +1970,12 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) msg_size = mesg->type->raw_size(f, FALSE, mesg->native); msg_size = H5O_ALIGN_OH(oh, msg_size); - HDassert(msg_size <= mesg->raw_size); + assert(msg_size <= mesg->raw_size); } #endif /* NDEBUG */ - HDassert(mesg->type->encode); + assert(mesg->type->encode); if ((mesg->type->encode)(f, FALSE, mesg->raw, mesg->native) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message"); } /* end if */ /* Mark the message as clean now */ @@ -2118,9 +1992,6 @@ H5O_msg_flush(H5F_t *f, H5O_t *oh, H5O_mesg_t *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Nov 21 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -2133,18 +2004,18 @@ H5O__flush_msgs(H5F_t *f, H5O_t *oh) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(oh); + assert(f); + assert(oh); /* Encode any dirty messages */ for (u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) if (curr_msg->dirty) if (H5O_msg_flush(f, oh, curr_msg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "unable to encode object header message"); /* Sanity check for the correct # of messages in object header */ if (oh->nmesgs != u) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "corrupt object header - too few messages") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "corrupt object header - too few messages"); #ifndef NDEBUG /* Reset the number of messages dirtied by decoding, as they have all @@ -2163,8 +2034,6 @@ H5O__flush_msgs(H5F_t *f, H5O_t *oh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin; Jan 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -2179,16 +2048,16 @@ H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t *flags) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(loc); - HDassert(loc->file); - HDassert(H5F_addr_defined(loc->addr)); - HDassert(type_id < NELMTS(H5O_msg_class_g)); + assert(loc); + assert(loc->file); + assert(H5_addr_defined(loc->addr)); + assert(type_id < NELMTS(H5O_msg_class_g)); type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header"); /* Locate message of correct type */ for (idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) @@ -2196,14 +2065,14 @@ H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t *flags) break; if (idx == oh->nmesgs) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message type not found"); /* Set return value */ *flags = idx_msg->flags; done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_get_flags() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Omtime.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Omtime.c index 8b82f6102f..1474c66968 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Omtime.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Omtime.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,10 +10,8 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Robb Matzke - * Friday, July 24, 1998 - * - * Purpose: The object modification time message. +/* + * Purpose: The object modification time message */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ @@ -94,46 +91,49 @@ const H5O_msg_class_t H5O_MSG_MTIME_NEW[1] = {{ H5FL_DEFINE(time_t); /*------------------------------------------------------------------------- - * Function: H5O__mtime_new_decode + * Function: H5O__mtime_new_decode * * Purpose: Decode a new modification time message and return a pointer to * a new time_t value. * + * This version of the modification time was used in HDF5 + * 1.6.1 and later. + * * The new modification time message format was added due to the * performance overhead of the old format. * - * Return: Success: Ptr to new message in native struct. - * - * Failure: NULL - * - * Programmer: Quincey Koziol - * Jan 3 2002 - * + * Return: Success: Pointer to new message in native struct + * Failure: NULL *------------------------------------------------------------------------- */ static void * -H5O__mtime_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, - unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, - size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__mtime_new_decode(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, + unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, + const uint8_t *p) { - time_t *mesg; - uint32_t tmp_time; /* Temporary copy of the time */ - void *ret_value = NULL; /* Return value */ + const uint8_t *p_end = p + p_size - 1; /* End of input buffer */ + time_t *mesg = NULL; + uint32_t tmp_time; /* Temporary copy of the time */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); - /* decode */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (*p++ != H5O_MTIME_VERSION) HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for mtime message"); /* Skip reserved bytes */ + if (H5_IS_BUFFER_OVERFLOW(p, 3, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); p += 3; /* Get the time_t from the file */ + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT32DECODE(p, tmp_time); /* The return value */ @@ -154,40 +154,41 @@ H5O__mtime_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, * Purpose: Decode a modification time message and return a pointer to a * new time_t value. * + * This version of the modification time was used in HDF5 + * 1.6.0 and earlier. + * * The new modification time message format was added due to the * performance overhead of the old format. * - * Return: Success: Ptr to new message in native struct. - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Jul 24 1998 - * + * Return: Success: Pointer to new message in native struct + * Failure: NULL *------------------------------------------------------------------------- */ static void * -H5O__mtime_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__mtime_decode(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, + unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, + const uint8_t *p) { - time_t *mesg, the_time; - struct tm tm; - int i; /* Local index variable */ - void *ret_value = NULL; /* Return value */ + const uint8_t *p_end = p + p_size - 1; /* End of input buffer */ + time_t *mesg = NULL; + time_t the_time; + struct tm tm; + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); - /* decode */ - for (i = 0; i < 14; i++) - if (!HDisdigit(p[i])) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message") + /* Buffer should have 14 message bytes and 2 reserved bytes */ + if (H5_IS_BUFFER_OVERFLOW(p, 16, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + for (int i = 0; i < 14; i++) + if (!isdigit(p[i])) + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "badly formatted modification time message"); /* Convert YYYYMMDDhhmmss UTC to a time_t. */ - HDmemset(&tm, 0, sizeof tm); + memset(&tm, 0, sizeof tm); tm.tm_year = (p[0] - '0') * 1000 + (p[1] - '0') * 100 + (p[2] - '0') * 10 + (p[3] - '0') - 1900; tm.tm_mon = (p[4] - '0') * 10 + (p[5] - '0') - 1; tm.tm_mday = (p[6] - '0') * 10 + (p[7] - '0'); @@ -196,11 +197,11 @@ H5O__mtime_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign tm.tm_sec = (p[12] - '0') * 10 + (p[13] - '0'); tm.tm_isdst = -1; /* (figure it out) */ if ((time_t)-1 == (the_time = H5_make_time(&tm))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't construct time info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't construct time info"); /* The return value */ if (NULL == (mesg = H5FL_MALLOC(time_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); *mesg = the_time; /* Set return value */ @@ -217,9 +218,6 @@ H5O__mtime_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Jan 3 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -231,9 +229,9 @@ H5O__mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sh FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(mesg); + assert(f); + assert(p); + assert(mesg); /* Version */ *p++ = H5O_MTIME_VERSION; @@ -256,9 +254,6 @@ H5O__mtime_new_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sh * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 24 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -271,9 +266,9 @@ H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(mesg); + assert(f); + assert(p); + assert(mesg); /* encode */ tm = HDgmtime(mesg); @@ -293,9 +288,6 @@ H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared * * Failure: NULL * - * Programmer: Robb Matzke - * Jul 24 1998 - * *------------------------------------------------------------------------- */ static void * @@ -308,7 +300,7 @@ H5O__mtime_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(mesg); + assert(mesg); if (!dest && NULL == (dest = H5FL_MALLOC(time_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); @@ -334,9 +326,6 @@ H5O__mtime_copy(const void *_mesg, void *_dest) * * Failure: 0 * - * Programmer: Quincey Koziol - * Jan 3 2002 - * *------------------------------------------------------------------------- */ static size_t @@ -346,8 +335,8 @@ H5O__mtime_new_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disabl FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); + assert(f); + assert(mesg); FUNC_LEAVE_NOAPI(8) } /* end H5O__mtime_new_size() */ @@ -364,9 +353,6 @@ H5O__mtime_new_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disabl * * Failure: 0 * - * Programmer: Robb Matzke - * Jul 14 1998 - * *------------------------------------------------------------------------- */ static size_t @@ -376,8 +362,8 @@ H5O__mtime_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sh FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); + assert(f); + assert(mesg); FUNC_LEAVE_NOAPI(16) } /* end H5O__mtime_size() */ @@ -389,9 +375,6 @@ H5O__mtime_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sh * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 30, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -399,7 +382,7 @@ H5O__mtime_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(time_t, mesg); @@ -413,9 +396,6 @@ H5O__mtime_free(void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Jul 24 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -428,17 +408,17 @@ H5O__mtime_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* debug */ tm = HDlocaltime(mesg); HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm); - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Time:", buf); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Time:", buf); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__mtime_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oname.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oname.c index b12634edb5..727b603fc7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oname.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oname.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5Oname.c - * Aug 12 1997 - * Robb Matzke * - * Purpose: Object name message. + * Purpose: Object name (comment) message * *------------------------------------------------------------------------- */ @@ -68,41 +65,37 @@ const H5O_msg_class_t H5O_MSG_NAME[1] = {{ * Purpose: Decode a name message and return a pointer to a new * native message struct. * - * Return: Success: Ptr to new message in native struct. - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Aug 12 1997 - * + * Return: Success: Ptr to new message in native struct. + * Failure: NULL *------------------------------------------------------------------------- */ static void * -H5O__name_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) +H5O__name_decode(H5F_t H5_ATTR_NDEBUG_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, + unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, + const uint8_t *p) { - H5O_name_t *mesg; - void *ret_value = NULL; /* Return value */ + H5O_name_t *mesg = NULL; + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); - /* decode */ if (NULL == (mesg = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - if (NULL == (mesg->s = (char *)H5MM_strdup((const char *)p))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + + if (NULL == (mesg->s = (char *)H5MM_strndup((const char *)p, p_size - 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - /* Set return value */ ret_value = mesg; done: if (NULL == ret_value) - if (mesg) - mesg = (H5O_name_t *)H5MM_xfree(mesg); + if (mesg) { + H5MM_xfree(mesg->s); + H5MM_xfree(mesg); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__name_decode() */ @@ -114,9 +107,6 @@ H5O__name_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigne * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 12 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -128,9 +118,9 @@ H5O__name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(mesg && mesg->s); + assert(f); + assert(p); + assert(mesg && mesg->s); /* encode */ HDstrcpy((char *)p, mesg->s); @@ -148,9 +138,6 @@ H5O__name_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_shared, * * Failure: NULL * - * Programmer: Robb Matzke - * Aug 12 1997 - * *------------------------------------------------------------------------- */ static void * @@ -163,15 +150,15 @@ H5O__name_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(mesg); + assert(mesg); if (!dest && NULL == (dest = (H5O_name_t *)H5MM_calloc(sizeof(H5O_name_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ *dest = *mesg; if (NULL == (dest->s = H5MM_xstrdup(mesg->s))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Set return value */ ret_value = dest; @@ -196,9 +183,6 @@ H5O__name_copy(const void *_mesg, void *_dest) * * Failure: Negative * - * Programmer: Robb Matzke - * Aug 12 1997 - * *------------------------------------------------------------------------- */ static size_t @@ -210,8 +194,8 @@ H5O__name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); + assert(f); + assert(mesg); ret_value = mesg->s ? HDstrlen(mesg->s) + 1 : 0; @@ -226,9 +210,6 @@ H5O__name_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 12 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -239,7 +220,7 @@ H5O__name_reset(void *_mesg) FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(mesg); + assert(mesg); /* reset */ mesg->s = (char *)H5MM_xfree(mesg->s); @@ -254,9 +235,6 @@ H5O__name_reset(void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 12 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -267,13 +245,13 @@ H5O__name_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(mesg); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", mesg->s); + fprintf(stream, "%*s%-*s `%s'\n", indent, "", fwidth, "Name:", mesg->s); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__name_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Onull.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Onull.c index 0f3143cc57..d6ec380cbb 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Onull.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Onull.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,7 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Onull.c - * Aug 6 1997 * * Purpose: The null message. * diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Opline.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Opline.c index 0f14891c7a..01c271ffb9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Opline.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Opline.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,10 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * - * Purpose: Data filter pipeline message. + * Purpose: Data filter pipeline message */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ @@ -103,14 +99,11 @@ H5FL_DEFINE(H5O_pline_t); * * Purpose: Decodes a filter pipeline message. * - * Return: Success: Ptr to the native message. + * Return: Success: Pointer to a new pipeline message * Failure: NULL - * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ + static void * H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) @@ -120,23 +113,27 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign size_t name_length; /* Length of filter name */ size_t i; /* Local index variable */ const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ - void *ret_value = NULL; /* Return value */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(p); + assert(f); + assert(p); /* Allocate space for I/O pipeline message */ if (NULL == (pline = H5FL_CALLOC(H5O_pline_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Version */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); pline->version = *p++; if (pline->version < H5O_PLINE_VERSION_1 || pline->version > H5O_PLINE_VERSION_LATEST) - HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "bad version number for filter pipeline message") + HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "bad version number for filter pipeline message"); /* Number of filters */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); pline->nused = *p++; if (pline->nused > H5Z_MAX_NFILTERS) { @@ -145,98 +142,113 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign */ pline->nused = 0; - HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter pipeline message has too many filters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter pipeline message has too many filters"); } /* Reserved */ - if (pline->version == H5O_PLINE_VERSION_1) + if (pline->version == H5O_PLINE_VERSION_1) { + if (H5_IS_BUFFER_OVERFLOW(p, 6, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); p += 6; + } /* Allocate array for filters */ pline->nalloc = pline->nused; if (NULL == (pline->filter = (H5Z_filter_info_t *)H5MM_calloc(pline->nalloc * sizeof(pline->filter[0])))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Decode filters */ for (i = 0, filter = &pline->filter[0]; i < pline->nused; i++, filter++) { /* Filter ID */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, filter->id); /* Length of filter name */ if (pline->version > H5O_PLINE_VERSION_1 && filter->id < H5Z_FILTER_RESERVED) name_length = 0; else { + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, name_length); if (pline->version == H5O_PLINE_VERSION_1 && name_length % 8) - HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter name length is not a multiple of eight") - } /* end if */ + HGOTO_ERROR(H5E_PLINE, H5E_CANTLOAD, NULL, "filter name length is not a multiple of eight"); + } /* Filter flags */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, filter->flags); /* Number of filter parameters ("client data elements") */ + if (H5_IS_BUFFER_OVERFLOW(p, 2, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); UINT16DECODE(p, filter->cd_nelmts); /* Filter name, if there is one */ if (name_length) { - size_t actual_name_length; /* Actual length of name */ + size_t actual_name_length; /* Actual length of name */ + size_t max = (size_t)(p_end - p + 1); /* Max possible name length */ /* Determine actual name length (without padding, but with null terminator) */ - actual_name_length = HDstrlen((const char *)p) + 1; - HDassert(actual_name_length <= name_length); + actual_name_length = HDstrnlen((const char *)p, max); + if (actual_name_length == max) + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "filter name not null terminated"); + actual_name_length += 1; /* include \0 byte */ /* Allocate space for the filter name, or use the internal buffer */ if (actual_name_length > H5Z_COMMON_NAME_LEN) { filter->name = (char *)H5MM_malloc(actual_name_length); if (NULL == filter->name) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for filter name") - } /* end if */ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for filter name"); + } else filter->name = filter->_name; HDstrncpy(filter->name, (const char *)p, actual_name_length); + + if (H5_IS_BUFFER_OVERFLOW(p, name_length, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); p += name_length; - } /* end if */ + } /* Filter parameters */ if (filter->cd_nelmts) { - size_t j; /* Local index variable */ /* Allocate space for the client data elements, or use the internal buffer */ if (filter->cd_nelmts > H5Z_COMMON_CD_VALUES) { filter->cd_values = (unsigned *)H5MM_malloc(filter->cd_nelmts * sizeof(unsigned)); if (NULL == filter->cd_values) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for client data") - } /* end if */ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for client data"); + } else filter->cd_values = filter->_cd_values; - /* - * Read the client data values and the padding - */ - for (j = 0; j < filter->cd_nelmts; j++) { - if (p + 4 - 1 <= p_end) - UINT32DECODE(p, filter->cd_values[j]) - else - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "ran off the end of the buffer: current p = %p, p_size = %zu, p_end = %p", - (const void *)p, p_size, (const void *)p_end) + /* Read the client data values and the padding */ + for (size_t j = 0; j < filter->cd_nelmts; j++) { + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT32DECODE(p, filter->cd_values[j]); } if (pline->version == H5O_PLINE_VERSION_1) - if (filter->cd_nelmts % 2) - p += 4; /*padding*/ - } /* end if */ - } /* end for */ + if (filter->cd_nelmts % 2) { + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, + "ran off end of input buffer while decoding"); + p += 4; /* padding */ + } + } + } /* Set return value */ ret_value = pline; done: - if (NULL == ret_value && pline) { + if (!ret_value && pline) { H5O__pline_reset(pline); H5O__pline_free(pline); - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__pline_decode() */ @@ -248,9 +260,6 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -263,8 +272,8 @@ H5O__pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p /*out*/, const void *mesg) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(p); - HDassert(mesg); + assert(p); + assert(mesg); /* Message header */ *p++ = (uint8_t)pline->version; @@ -349,9 +358,6 @@ H5O__pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p /*out*/, const void *mesg) * * Failure: NULL * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ static void * @@ -366,7 +372,7 @@ H5O__pline_copy(const void *_src, void *_dst /*out*/) /* Allocate pipeline message, if not provided */ if (!dst && NULL == (dst = H5FL_MALLOC(H5O_pline_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Shallow copy basic fields */ *dst = *src; @@ -376,7 +382,7 @@ H5O__pline_copy(const void *_src, void *_dst /*out*/) if (dst->nalloc) { /* Allocate array to hold filters */ if (NULL == (dst->filter = (H5Z_filter_info_t *)H5MM_calloc(dst->nalloc * sizeof(dst->filter[0])))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Deep-copy filters */ for (i = 0; i < src->nused; i++) { @@ -394,7 +400,7 @@ H5O__pline_copy(const void *_src, void *_dst /*out*/) dst->filter[i].name = (char *)H5MM_strdup(src->filter[i].name); if (NULL == dst->filter[i].name) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for filter name") + "memory allocation failed for filter name"); } /* end if */ else dst->filter[i].name = dst->filter[i]._name; @@ -406,7 +412,7 @@ H5O__pline_copy(const void *_src, void *_dst /*out*/) if (src->filter[i].cd_nelmts > H5Z_COMMON_CD_VALUES) { if (NULL == (dst->filter[i].cd_values = (unsigned *)H5MM_malloc(src->filter[i].cd_nelmts * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5MM_memcpy(dst->filter[i].cd_values, src->filter[i].cd_values, src->filter[i].cd_nelmts * sizeof(unsigned)); @@ -441,9 +447,6 @@ H5O__pline_copy(const void *_src, void *_dst /*out*/) * * Failure: zero * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ static size_t @@ -504,9 +507,6 @@ H5O__pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -521,18 +521,18 @@ H5O__pline_reset(void *mesg) * other API calls so DO NOT ASSUME THAT ANY VALUES ARE SANE. */ - HDassert(pline); + assert(pline); /* Free the filter information and array */ if (pline->filter) { /* Free information for each filter */ for (i = 0; i < pline->nused; i++) { if (pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name) - HDassert((HDstrlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN); + assert((HDstrlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN); if (pline->filter[i].name != pline->filter[i]._name) pline->filter[i].name = (char *)H5MM_xfree(pline->filter[i].name); if (pline->filter[i].cd_values && pline->filter[i].cd_values != pline->filter[i]._cd_values) - HDassert(pline->filter[i].cd_nelmts > H5Z_COMMON_CD_VALUES); + assert(pline->filter[i].cd_nelmts > H5Z_COMMON_CD_VALUES); if (pline->filter[i].cd_values != pline->filter[i]._cd_values) pline->filter[i].cd_values = (unsigned *)H5MM_xfree(pline->filter[i].cd_values); } /* end for */ @@ -557,9 +557,6 @@ H5O__pline_reset(void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, March 11, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -567,7 +564,7 @@ H5O__pline_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5O_pline_t, mesg); @@ -584,9 +581,6 @@ H5O__pline_free(void *mesg) * * Failure: Negative * - * Programmer: Peter Cao - * December 27, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -600,14 +594,14 @@ H5O__pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, FUNC_ENTER_PACKAGE /* check args */ - HDassert(pline_src); - HDassert(cpy_info); - HDassert(cpy_info->file_dst); + assert(pline_src); + assert(cpy_info); + assert(cpy_info->file_dst); /* Check to ensure that the version of the message to be copied does not exceed the message version allowed by the destination file's high bound */ if (pline_src->version > H5O_pline_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "pline message version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "pline message version out of bounds"); /* If the user data is non-NULL, assume we are copying a dataset or group * and make a copy of the filter pipeline for later in @@ -615,7 +609,7 @@ H5O__pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, */ if (udata) if (NULL == (udata->src_pline = (H5O_pline_t *)H5O__pline_copy(pline_src, NULL))) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to copy") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to copy"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -630,9 +624,6 @@ H5O__pline_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -643,14 +634,14 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(pline); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(pline); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %zu/%zu\n", indent, "", fwidth, "Number of filters:", pline->nused, - pline->nalloc); + fprintf(stream, "%*s%-*s %zu/%zu\n", indent, "", fwidth, "Number of filters:", pline->nused, + pline->nalloc); /* Loop over all the filters */ for (size_t i = 0; i < pline->nused; i++) { @@ -659,29 +650,29 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in */ char name[64]; - HDmemset(name, 0, 64); + memset(name, 0, 64); HDsnprintf(name, sizeof(name), "Filter at position %zu", i); - HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); - HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter identification:", (unsigned)(pline->filter[i].id)); + fprintf(stream, "%*s%-*s\n", indent, "", fwidth, name); + fprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter identification:", (unsigned)(pline->filter[i].id)); if (pline->filter[i].name) - HDfprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(0, fwidth - 3), - "Filter name:", pline->filter[i].name); + fprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(0, fwidth - 3), + "Filter name:", pline->filter[i].name); else - HDfprintf(stream, "%*s%-*s NONE\n", indent + 3, "", MAX(0, fwidth - 3), "Filter name:"); - HDfprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), - "Flags:", pline->filter[i].flags); - HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), - "Num CD values:", pline->filter[i].cd_nelmts); + fprintf(stream, "%*s%-*s NONE\n", indent + 3, "", MAX(0, fwidth - 3), "Filter name:"); + fprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3), + "Flags:", pline->filter[i].flags); + fprintf(stream, "%*s%-*s %zu\n", indent + 3, "", MAX(0, fwidth - 3), + "Num CD values:", pline->filter[i].cd_nelmts); /* Filter parameters */ for (size_t j = 0; j < pline->filter[i].cd_nelmts; j++) { char field_name[32]; HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j); - HDfprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), field_name, - pline->filter[i].cd_values[j]); + fprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), field_name, + pline->filter[i].cd_values[j]); } } @@ -695,8 +686,6 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; December 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -708,15 +697,15 @@ H5O_pline_set_version(H5F_t *f, H5O_pline_t *pline) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(pline); + assert(f); + assert(pline); /* Upgrade to the version indicated by the file's low bound if higher */ version = MAX(pline->version, H5O_pline_ver_bounds[H5F_LOW_BOUND(f)]); /* Version bounds check */ if (version > H5O_pline_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_PLINE, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds") + HGOTO_ERROR(H5E_PLINE, H5E_BADRANGE, FAIL, "Filter pipeline version out of bounds"); /* Set the message version */ pline->version = version; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Orefcount.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Orefcount.c index 277c0f53e5..7c0c71f476 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Orefcount.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Orefcount.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5Orefcount.c - * Mar 10 2007 - * Quincey Koziol * - * Purpose: Object ref. count messages. + * Purpose: Object reference count messages * *------------------------------------------------------------------------- */ @@ -73,47 +70,48 @@ H5FL_DEFINE_STATIC(H5O_refcount_t); /*------------------------------------------------------------------------- * Function: H5O__refcount_decode * - * Purpose: Decode a message and return a pointer to a newly allocated one. - * - * Return: Success: Ptr to new message in native form. - * Failure: NULL - * - * Programmer: Quincey Koziol - * Mar 10 2007 + * Purpose: Decode a message and return a pointer to a newly allocated + * one. * + * Return: Success: Pointer to new message in native form + * Failure: NULL *------------------------------------------------------------------------- */ static void * H5O__refcount_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, - unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, - size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, + const uint8_t *p) { - H5O_refcount_t *refcount = NULL; /* Reference count */ - void *ret_value = NULL; /* Return value */ + H5O_refcount_t *refcount = NULL; /* Reference count */ + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); /* Version of message */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); if (*p++ != H5O_REFCOUNT_VERSION) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for message"); /* Allocate space for message */ if (NULL == (refcount = H5FL_MALLOC(H5O_refcount_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - /* Get ref. count for object */ - UINT32DECODE(p, *refcount) + /* Get reference count for object */ + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + UINT32DECODE(p, *refcount); /* Set return value */ ret_value = refcount; done: - if (ret_value == NULL && refcount != NULL) - refcount = H5FL_FREE(H5O_refcount_t, refcount); + if (!ret_value && refcount) + H5FL_FREE(H5O_refcount_t, refcount); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__refcount_decode() */ @@ -125,9 +123,6 @@ H5O__refcount_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 10 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -139,9 +134,9 @@ H5O__refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(refcount); + assert(f); + assert(p); + assert(refcount); /* Message version */ *p++ = H5O_REFCOUNT_VERSION; @@ -161,9 +156,6 @@ H5O__refcount_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_sha * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: Quincey Koziol - * Mar 10 2007 - * *------------------------------------------------------------------------- */ static void * @@ -176,9 +168,9 @@ H5O__refcount_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(refcount); + assert(refcount); if (!dest && NULL == (dest = H5FL_MALLOC(H5O_refcount_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* copy */ *dest = *refcount; @@ -200,9 +192,6 @@ H5O__refcount_copy(const void *_mesg, void *_dest) * Return: Success: Message data size in bytes without alignment. * Failure: zero * - * Programmer: Quincey Koziol - * Mar 10 2007 - * *------------------------------------------------------------------------- */ static size_t @@ -227,9 +216,6 @@ H5O__refcount_size(const H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, March 10, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -237,7 +223,7 @@ H5O__refcount_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5O_refcount_t, mesg); @@ -253,9 +239,6 @@ H5O__refcount_free(void *mesg) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, March 10, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -266,8 +249,8 @@ H5O__refcount_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_U FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(deleted); - HDassert(cpy_info); + assert(deleted); + assert(cpy_info); /* Always delete this message when copying objects between files. Let * the copy routine set the correct ref. count. @@ -284,9 +267,6 @@ H5O__refcount_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void H5_ATTR_U * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 6 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -297,13 +277,13 @@ H5O__refcount_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, in FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(refcount); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(refcount); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of links:", (unsigned)*refcount); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of links:", (unsigned)*refcount); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__refcount_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Osdspace.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Osdspace.c index cacceb55fb..cd0d3eda66 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Osdspace.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Osdspace.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -108,85 +107,105 @@ static void * H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5S_extent_t *sdim = NULL; /* New extent dimensionality structure */ + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + H5S_extent_t *sdim = NULL; /* New extent dimensionality structure */ unsigned flags, version; - unsigned i; /* Local counting variable */ - const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ - void *ret_value = NULL; /* Return value */ + unsigned i; + void *ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); - /* decode */ if (NULL == (sdim = H5FL_CALLOC(H5S_extent_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, NULL, "dataspace structure allocation failed") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "dataspace structure allocation failed"); + sdim->type = H5S_NO_CLASS; /* Check version */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); version = *p++; + if (version < H5O_SDSPACE_VERSION_1 || version > H5O_SDSPACE_VERSION_2) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "wrong version number in dataspace message") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "wrong version number in dataspace message"); sdim->version = version; /* Get rank */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); sdim->rank = *p++; + if (sdim->rank > H5S_MAX_RANK) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "simple dataspace dimensionality is too large") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "simple dataspace dimensionality is too large"); /* Get dataspace flags for later */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); flags = *p++; /* Get or determine the type of the extent */ if (version >= H5O_SDSPACE_VERSION_2) { + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); sdim->type = (H5S_class_t)*p++; + if (sdim->type != H5S_SIMPLE && sdim->rank > 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid rank for scalar or NULL dataspace") - } /* end if */ + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "invalid rank for scalar or NULL dataspace"); + } else { - /* Set the dataspace type to be simple or scalar as appropriate */ + /* Set the dataspace type to be simple or scalar as appropriate + * (version 1 does not allow H5S_NULL) + */ if (sdim->rank > 0) sdim->type = H5S_SIMPLE; else sdim->type = H5S_SCALAR; /* Increment past reserved byte */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); p++; - } /* end else */ - HDassert(sdim->type != H5S_NULL || sdim->version >= H5O_SDSPACE_VERSION_2); + } - /* Only Version 1 has these reserved bytes */ - if (version == H5O_SDSPACE_VERSION_1) - p += 4; /*reserved*/ + /* Version 1 has 4 reserved bytes */ + if (version == H5O_SDSPACE_VERSION_1) { + if (H5_IS_BUFFER_OVERFLOW(p, 4, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + p += 4; + } /* Decode dimension sizes */ if (sdim->rank > 0) { - /* Ensure that rank doesn't cause reading passed buffer's end, - due to possible data corruption */ - uint8_t sizeof_size = H5F_SIZEOF_SIZE(f); - if (p + (sizeof_size * sdim->rank - 1) > p_end) { - HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "rank might cause reading passed buffer's end") - } - if (NULL == (sdim->size = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + /* Sizes */ + + /* Check that we have space to decode sdim->rank values */ + if (H5_IS_BUFFER_OVERFLOW(p, (H5F_sizeof_size(f) * sdim->rank), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); + if (NULL == (sdim->size = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); for (i = 0; i < sdim->rank; i++) H5F_DECODE_LENGTH(f, p, sdim->size[i]); + /* Max sizes */ + if (flags & H5S_VALID_MAX) { if (NULL == (sdim->max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - - /* Ensure that rank doesn't cause reading passed buffer's end */ - if (p + (sizeof_size * sdim->rank - 1) > p_end) - HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "rank might cause reading passed buffer's end") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed"); + /* Check that we have space to decode sdim->rank values */ + if (H5_IS_BUFFER_OVERFLOW(p, (H5F_sizeof_size(f) * sdim->rank), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); for (i = 0; i < sdim->rank; i++) H5F_DECODE_LENGTH(f, p, sdim->max[i]); - } /* end if */ - } /* end if */ + } + + /* NOTE: The version 1 permutation indexes were never implemented so + * there is nothing to decode. + */ + } /* Compute the number of elements in the extent */ if (sdim->type == H5S_NULL) @@ -194,16 +213,16 @@ H5O__sdspace_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UN else { for (i = 0, sdim->nelem = 1; i < sdim->rank; i++) sdim->nelem *= sdim->size[i]; - } /* end else */ + } /* Set return value */ - ret_value = (void *)sdim; /*success*/ + ret_value = (void *)sdim; done: if (!ret_value && sdim) { H5S__extent_release(sdim); - sdim = H5FL_FREE(H5S_extent_t, sdim); - } /* end if */ + H5FL_FREE(H5S_extent_t, sdim); + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__sdspace_decode() */ @@ -236,13 +255,13 @@ H5O__sdspace_encode(H5F_t *f, uint8_t *p, const void *_mesg) FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(sdim); + assert(f); + assert(p); + assert(sdim); /* Version */ - HDassert(sdim->version > 0); - HDassert(sdim->type != H5S_NULL || sdim->version >= H5O_SDSPACE_VERSION_2); + assert(sdim->version > 0); + assert(sdim->type != H5S_NULL || sdim->version >= H5O_SDSPACE_VERSION_2); *p++ = (uint8_t)sdim->version; /* Rank */ @@ -304,13 +323,13 @@ H5O__sdspace_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(mesg); + assert(mesg); if (!dest && NULL == (dest = H5FL_CALLOC(H5S_extent_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy extent information */ if (H5S__extent_copy_real(dest, mesg, TRUE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent"); /* Set return value */ ret_value = dest; @@ -372,9 +391,6 @@ H5O__sdspace_size(const H5F_t *f, const void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, April 30, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -396,9 +412,6 @@ H5O__sdspace_reset(void *_mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 30, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -406,7 +419,7 @@ H5O__sdspace_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5S_extent_t, mesg); @@ -423,9 +436,6 @@ H5O__sdspace_free(void *mesg) * * Failure: Negative * - * Programmer: Quincey Koziol - * November 30, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -439,15 +449,15 @@ H5O__sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, FUNC_ENTER_PACKAGE /* check args */ - HDassert(file_src); - HDassert(src_space_extent); - HDassert(cpy_info); - HDassert(cpy_info->file_dst); + assert(file_src); + assert(src_space_extent); + assert(cpy_info); + assert(cpy_info->file_dst); /* Check to ensure that the version of the message to be copied does not exceed the message version allowed by the destination file's high bound */ if (src_space_extent->version > H5O_sdspace_ver_bounds[H5F_HIGH_BOUND(cpy_info->file_dst)]) - HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "dataspace message version out of bounds") + HGOTO_ERROR(H5E_OHDR, H5E_BADRANGE, FAIL, "dataspace message version out of bounds"); /* If the user data is non-NULL, assume we are copying a dataset * and make a copy of the dataspace extent for later in the object copying @@ -458,11 +468,11 @@ H5O__sdspace_pre_copy_file(H5F_t H5_ATTR_UNUSED *file_src, const void *mesg_src, if (udata) { /* Allocate copy of dataspace extent */ if (NULL == (udata->src_space_extent = H5FL_CALLOC(H5S_extent_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed") + HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "dataspace extent allocation failed"); /* Create a copy of the dataspace extent */ if (H5S__extent_copy_real(udata->src_space_extent, src_space_extent, TRUE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent"); } /* end if */ done: @@ -495,35 +505,35 @@ H5O__sdspace_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(sdim); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(sdim); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Rank:", (unsigned long)(sdim->rank)); + fprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Rank:", (unsigned long)(sdim->rank)); if (sdim->rank > 0) { unsigned u; /* local counting variable */ - HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:"); + fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Dim Size:"); for (u = 0; u < sdim->rank; u++) - HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", sdim->size[u]); - HDfprintf(stream, "}\n"); + fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", sdim->size[u]); + fprintf(stream, "}\n"); - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:"); + fprintf(stream, "%*s%-*s ", indent, "", fwidth, "Dim Max:"); if (sdim->max) { - HDfprintf(stream, "{"); + fprintf(stream, "{"); for (u = 0; u < sdim->rank; u++) { if (H5S_UNLIMITED == sdim->max[u]) - HDfprintf(stream, "%sUNLIM", u ? ", " : ""); + fprintf(stream, "%sUNLIM", u ? ", " : ""); else - HDfprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", sdim->max[u]); + fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", sdim->max[u]); } /* end for */ - HDfprintf(stream, "}\n"); + fprintf(stream, "}\n"); } /* end if */ else - HDfprintf(stream, "CONSTANT\n"); + fprintf(stream, "CONSTANT\n"); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oshared.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oshared.c index d27e719ab1..eb4eb26ca3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oshared.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oshared.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Robb Matzke - * Wednesday, April 1, 1998 - * * Purpose: Functions that operate on a shared message. The shared * message doesn't ever actually appear in the object header as * a normal message. Instead, if a message is shared, the @@ -94,9 +90,6 @@ static herr_t H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class * * Failure: NULL * - * Programmer: Quincey Koziol - * Sep 24 2003 - * *------------------------------------------------------------------------- */ static void * @@ -111,15 +104,15 @@ H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(shared); - HDassert(type); - HDassert(type->share_flags & H5O_SHARE_IS_SHARABLE); + assert(f); + assert(shared); + assert(type); + assert(type->share_flags & H5O_SHARE_IS_SHARABLE); /* This message could have a heap ID (SOHM) or the address of an object * header on disk (named datatype) */ - HDassert(H5O_IS_STORED_SHARED(shared->type)); + assert(H5O_IS_STORED_SHARED(shared->type)); /* Check for implicit shared object header message */ if (shared->type == H5O_SHARE_TYPE_SOHM) { @@ -129,36 +122,36 @@ H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t /* Retrieve the fractal heap address for shared messages */ if (H5SM_get_fheap_addr(f, type->id, &fheap_addr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't get fheap address for shared messages") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't get fheap address for shared messages"); /* Open the fractal heap */ if (NULL == (fheap = H5HF_open(f, fheap_addr))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open fractal heap") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open fractal heap"); /* Get the size of the message in the heap */ if (H5HF_get_obj_len(fheap, &(shared->u.heap_id), &mesg_size) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't get message size from fractal heap.") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "can't get message size from fractal heap."); /* Wrap the local buffer for serialized message */ if (NULL == (wb = H5WB_wrap(mesg_buf, sizeof(mesg_buf)))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't wrap buffer") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't wrap buffer"); /* Get a pointer to a buffer that's large enough for message */ if (NULL == (mesg_ptr = (uint8_t *)H5WB_actual(wb, mesg_size))) - HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "can't get actual buffer") + HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "can't get actual buffer"); /* Retrieve the message from the heap */ if (H5HF_read(fheap, &(shared->u.heap_id), mesg_ptr) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "can't read message from fractal heap.") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "can't read message from fractal heap."); /* Decode the message */ if (NULL == (ret_value = (type->decode)(f, open_oh, 0, ioflags, mesg_size, mesg_ptr))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode shared message.") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, NULL, "can't decode shared message."); } /* end if */ else { H5O_loc_t oloc; /* Location for object header where message is stored */ - HDassert(shared->type == H5O_SHARE_TYPE_COMMITTED); + assert(shared->type == H5O_SHARE_TYPE_COMMITTED); /* Build the object location for the shared message's object header */ oloc.file = f; @@ -171,24 +164,24 @@ H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t * the same object header the attribute is in. Read the message * directly. */ if (NULL == (ret_value = H5O_msg_read_oh(f, open_oh, type->id, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message") + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message"); } else /* The shared message is in another object header */ if (NULL == (ret_value = H5O_msg_read(&oloc, type->id, NULL))) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message") + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read message"); } /* end else */ /* Mark the message as shared */ if (H5O_msg_set_share(type->id, shared, ret_value) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to set sharing information") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to set sharing information"); done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "can't close fractal heap") + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, NULL, "can't close fractal heap"); if (wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, NULL, "can't close wrapped buffer") + HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, NULL, "can't close wrapped buffer"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__shared_read() */ @@ -207,9 +200,6 @@ H5O__shared_read(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const H5O_shared_t * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 26 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -220,8 +210,8 @@ H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_ FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(shared); + assert(f); + assert(shared); /* Check for type of shared message */ if (shared->type == H5O_SHARE_TYPE_COMMITTED) { @@ -258,27 +248,27 @@ H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_ hbool_t deleted = FALSE; /* This is used only to satisfy H5O__link_oh */ if (H5O__link_oh(f, adjust, open_oh, &deleted) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count"); - HDassert(!deleted); + assert(!deleted); } else /* The shared message is in another object header */ if (H5O_link(&oloc, adjust) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count"); } /* end if */ else { - HDassert(shared->type == H5O_SHARE_TYPE_SOHM || shared->type == H5O_SHARE_TYPE_HERE); + assert(shared->type == H5O_SHARE_TYPE_SOHM || shared->type == H5O_SHARE_TYPE_HERE); /* Check for decrementing reference count on shared message */ if (adjust < 0) { if (H5SM_delete(f, open_oh, shared) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to delete message from SOHM table") + HGOTO_ERROR(H5E_OHDR, H5E_CANTDEC, FAIL, "unable to delete message from SOHM table"); } /* end if */ /* Check for incrementing reference count on message */ else if (adjust > 0) { if (H5SM_try_share(f, open_oh, 0, type->id, shared, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "error trying to share message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINC, FAIL, "error trying to share message"); } /* end if */ } /* end else */ @@ -294,9 +284,6 @@ H5O__shared_link_adj(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_ * Return: Success: A buffer containing the decoded shared object * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, January 22, 2007 - * *------------------------------------------------------------------------- */ void * @@ -310,14 +297,14 @@ H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *b FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(buf); - HDassert(type); + assert(f); + assert(buf); + assert(type); /* Version */ version = *buf++; if (version < H5O_SHARED_VERSION_1 || version > H5O_SHARED_VERSION_LATEST) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for shared object message") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for shared object message"); /* Get the shared information type * Flags are unused before version 3. @@ -347,7 +334,7 @@ H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *b * Otherwise, it is a named datatype, so copy an H5O_loc_t. */ if (sh_mesg.type == H5O_SHARE_TYPE_SOHM) { - HDassert(version >= H5O_SHARED_VERSION_3); + assert(version >= H5O_SHARED_VERSION_3); H5MM_memcpy(&sh_mesg.u.heap_id, buf, sizeof(sh_mesg.u.heap_id)); } /* end if */ else { @@ -368,7 +355,7 @@ H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *b /* Retrieve actual message, through decoded shared message info */ if (NULL == (ret_value = H5O__shared_read(f, open_oh, ioflags, &sh_mesg, type))) - HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message") + HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to retrieve native message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -381,9 +368,6 @@ H5O__shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *b * * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke - * Thursday, April 2, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -394,9 +378,9 @@ H5O__shared_encode(const H5F_t *f, uint8_t *buf /*out*/, const H5O_shared_t *sh_ FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(f); - HDassert(buf); - HDassert(sh_mesg); + assert(f); + assert(buf); + assert(sh_mesg); /* If this message is shared in the heap, we need to use version 3 of the * encoding and encode the SHARED_IN_HEAP flag. @@ -404,7 +388,7 @@ H5O__shared_encode(const H5F_t *f, uint8_t *buf /*out*/, const H5O_shared_t *sh_ if (sh_mesg->type == H5O_SHARE_TYPE_SOHM) version = H5O_SHARED_VERSION_LATEST; else { - HDassert(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED); + assert(sh_mesg->type == H5O_SHARE_TYPE_COMMITTED); version = H5O_SHARED_VERSION_2; /* version 1 is no longer used */ } /* end else */ @@ -429,9 +413,6 @@ H5O__shared_encode(const H5F_t *f, uint8_t *buf /*out*/, const H5O_shared_t *sh_ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Sep 26 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -440,8 +421,8 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src) FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ - HDassert(dst); - HDassert(src); + assert(dst); + assert(src); /* copy */ *dst = *src; @@ -457,9 +438,6 @@ H5O_set_shared(H5O_shared_t *dst, const H5O_shared_t *src) * Return: Success: Length * Failure: 0 * - * Programmer: Robb Matzke - * Thursday, April 2, 1998 - * *------------------------------------------------------------------------- */ size_t @@ -475,7 +453,7 @@ H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) (size_t)H5F_SIZEOF_ADDR(f); /* Sharing by another obj hdr */ } /* end if */ else { - HDassert(sh_mesg->type == H5O_SHARE_TYPE_SOHM); + assert(sh_mesg->type == H5O_SHARE_TYPE_SOHM); ret_value = 1 + /* Version */ 1 + /* Type field */ H5O_FHEAP_ID_LEN; /* Shared in the heap */ @@ -491,9 +469,6 @@ H5O__shared_size(const H5F_t *f, const H5O_shared_t *sh_mesg) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Friday, September 26, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -504,8 +479,8 @@ H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_sh FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(sh_mesg); + assert(f); + assert(sh_mesg); /* * Committed datatypes increment the OH of the original message when they @@ -518,7 +493,7 @@ H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_sh /* Decrement the reference count on the shared object */ if (H5O__shared_link_adj(f, open_oh, type, sh_mesg, -1) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -532,9 +507,6 @@ H5O__shared_delete(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_sh * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Friday, September 26, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -545,12 +517,12 @@ H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_shar FUNC_ENTER_PACKAGE /* Check args */ - HDassert(f); - HDassert(sh_mesg); + assert(f); + assert(sh_mesg); /* Increment the reference count on the shared object */ if (H5O__shared_link_adj(f, open_oh, type, sh_mesg, 1) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "unable to adjust shared object link count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -563,9 +535,6 @@ H5O__shared_link(H5F_t *f, H5O_t *open_oh, const H5O_msg_class_t *type, H5O_shar * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * January 22, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -583,13 +552,13 @@ H5O__shared_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, H5F_t *file_dst, FUNC_ENTER_PACKAGE /* check args */ - HDassert(file_src); - HDassert(file_dst); - HDassert(mesg_type); - HDassert(shared_src); - HDassert(shared_dst); - HDassert(recompute_size); - HDassert(cpy_info); + assert(file_src); + assert(file_dst); + assert(mesg_type); + assert(shared_src); + assert(shared_dst); + assert(recompute_size); + assert(cpy_info); /* Committed shared messages create a shared message at the destination * and also copy the committed object that they point to. @@ -603,10 +572,11 @@ H5O__shared_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, H5F_t *file_dst, if (shared_src->type != H5O_SHARE_TYPE_COMMITTED) { /* Simulate trying to share new message in the destination file. */ /* Set copied metadata tag */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) if (H5SM_try_share(file_dst, NULL, H5SM_DEFER, mesg_type->id, _native_dst, mesg_flags) < 0) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_WRITEERROR, FAIL, "unable to determine if message should be shared") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_WRITEERROR, FAIL, + "unable to determine if message should be shared"); /* Reset metadata tag */ H5_END_TAG @@ -634,9 +604,6 @@ H5O__shared_copy_file(H5F_t H5_ATTR_NDEBUG_UNUSED *file_src, H5F_t *file_dst, * * Return: SUCCEED/FAIL * - * Programmer: Peter Cao - * May 24 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -648,9 +615,9 @@ H5O__shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type, const H5O FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(shared_src); - HDassert(shared_dst); + assert(f); + assert(shared_src); + assert(shared_dst); /* Copy the target of committed messages, try to share others */ if (shared_src->type == H5O_SHARE_TYPE_COMMITTED) { @@ -663,7 +630,7 @@ H5O__shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type, const H5O src_oloc.file = shared_src->file; src_oloc.addr = shared_src->u.loc.oh_addr; if (H5O_copy_header_map(&src_oloc, &dst_oloc, cpy_info, FALSE, NULL, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); /* Set up destination message's shared info */ H5O_UPDATE_SHARED(shared_dst, H5O_SHARE_TYPE_COMMITTED, f, mesg_type->id, 0, dst_oloc.addr) @@ -671,7 +638,7 @@ H5O__shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type, const H5O else /* Share the message */ if (H5SM_try_share(f, NULL, H5SM_WAS_DEFERRED, mesg_type->id, shared_dst, mesg_flags) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't share message") + HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "can't share message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -684,9 +651,6 @@ H5O__shared_post_copy_file(H5F_t *f, const H5O_msg_class_t *mesg_type, const H5O * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, April 2, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -695,35 +659,35 @@ H5O__shared_debug(const H5O_shared_t *mesg, FILE *stream, int indent, int fwidth FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(mesg); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); switch (mesg->type) { case H5O_SHARE_TYPE_UNSHARED: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Unshared"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Unshared"); break; case H5O_SHARE_TYPE_COMMITTED: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Obj Hdr"); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, - "Object address:", mesg->u.loc.oh_addr); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Obj Hdr"); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, + "Object address:", mesg->u.loc.oh_addr); break; case H5O_SHARE_TYPE_SOHM: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "SOHM"); - HDfprintf(stream, "%*s%-*s %016llx\n", indent, "", fwidth, - "Heap ID:", (unsigned long long)mesg->u.heap_id.val); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "SOHM"); + fprintf(stream, "%*s%-*s %016llx\n", indent, "", fwidth, + "Heap ID:", (unsigned long long)mesg->u.heap_id.val); break; case H5O_SHARE_TYPE_HERE: - HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Here"); + fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Shared Message type:", "Here"); break; default: - HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Shared Message type:", "Unknown", - (unsigned)mesg->type); + fprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, "Shared Message type:", "Unknown", + (unsigned)mesg->type); } /* end switch */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Oshmesg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Oshmesg.c index 4b4dfab23f..6588097d34 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Oshmesg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Oshmesg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: James Laird - * Monday, January 29, 2007 - * +/* * Purpose: A message holding "implicitly shared object header message" * information in the superblock extension. */ @@ -57,45 +54,52 @@ const H5O_msg_class_t H5O_MSG_SHMESG[1] = {{ }}; /*------------------------------------------------------------------------- - * Function: H5O__shmesg_decode + * Function: H5O__shmesg_decode * - * Purpose: Decode a shared message table message and return a pointer + * Purpose: Decode a shared message table message and return a pointer * to a newly allocated H5O_shmesg_table_t struct. * - * Return: Success: Ptr to new message in native struct. - * Failure: NULL - * - * Programmer: James Laird - * Jan 29, 2007 - * + * Return: Success: Ptr to new message in native struct. + * Failure: NULL *------------------------------------------------------------------------- */ static void * H5O__shmesg_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_shmesg_table_t *mesg; /* Native message */ - void *ret_value = NULL; /* Return value */ + H5O_shmesg_table_t *mesg; /* New shared message table */ + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* Sanity check */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); if (NULL == (mesg = (H5O_shmesg_table_t *)H5MM_calloc(sizeof(H5O_shmesg_table_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for shared message table message") + "memory allocation failed for shared message table message"); /* Retrieve version, table address, and number of indexes */ + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); mesg->version = *p++; + + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(mesg->addr)); + + if (H5_IS_BUFFER_OVERFLOW(p, 1, p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); mesg->nindexes = *p++; /* Set return value */ ret_value = (void *)mesg; done: + if (!ret_value && mesg) + H5MM_xfree(mesg); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__shmesg_decode() */ @@ -106,9 +110,6 @@ H5O__shmesg_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Jan 29, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -119,9 +120,9 @@ H5O__shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); - HDassert(p); - HDassert(mesg); + assert(f); + assert(p); + assert(mesg); /* Store version, table address, and number of indexes */ *p++ = (uint8_t)mesg->version; @@ -140,9 +141,6 @@ H5O__shmesg_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, * Return: Success: Ptr to _DEST * Failure: NULL * - * Programmer: James Laird - * Jan 29, 2007 - * *------------------------------------------------------------------------- */ static void * @@ -155,11 +153,11 @@ H5O__shmesg_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(mesg); + assert(mesg); if (!dest && NULL == (dest = (H5O_shmesg_table_t *)H5MM_malloc(sizeof(H5O_shmesg_table_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for shared message table message") + "memory allocation failed for shared message table message"); /* All this message requires is a shallow copy */ *dest = *mesg; @@ -180,9 +178,6 @@ H5O__shmesg_copy(const void *_mesg, void *_dest) * Return: Success: Message data size in bytes w/o alignment. * Failure: 0 * - * Programmer: James Laird - * Jan 29, 2007 - * *------------------------------------------------------------------------- */ static size_t @@ -193,7 +188,7 @@ H5O__shmesg_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const vo FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); + assert(f); ret_value = (size_t)(1 + /* Version number */ H5F_SIZEOF_ADDR(f) + /* Table address */ @@ -209,9 +204,6 @@ H5O__shmesg_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const vo * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Jan 29, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -222,16 +214,16 @@ H5O__shmesg_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(f); - HDassert(mesg); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); - - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", mesg->version); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, - "Shared message table address:", mesg->addr); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of indexes:", mesg->nindexes); + assert(f); + assert(mesg); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); + + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Version:", mesg->version); + fprintf(stream, "%*s%-*s %" PRIuHADDR " (rel)\n", indent, "", fwidth, + "Shared message table address:", mesg->addr); + fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Number of indexes:", mesg->nindexes); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__shmesg_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ostab.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ostab.c index 30d7bd413d..24504f969e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ostab.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ostab.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,10 +13,8 @@ /*------------------------------------------------------------------------- * * Created: H5Ostab.c - * Aug 6 1997 - * Robb Matzke * - * Purpose: Symbol table messages. + * Purpose: Symbol table messages * *------------------------------------------------------------------------- */ @@ -79,41 +76,39 @@ H5FL_DEFINE_STATIC(H5O_stab_t); * Purpose: Decode a symbol table message and return a pointer to * a newly allocated one. * - * Return: Success: Ptr to new message in native order. - * - * Failure: NULL - * - * Programmer: Robb Matzke - * Aug 6 1997 - * + * Return: Success: Pointer to new message in native order + * Failure: NULL *------------------------------------------------------------------------- */ static void * H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, - unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p) + unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p) { - H5O_stab_t *stab = NULL; - void *ret_value = NULL; /* Return value */ + H5O_stab_t *stab = NULL; + const uint8_t *p_end = p + p_size - 1; /* End of the p buffer */ + void *ret_value = NULL; FUNC_ENTER_PACKAGE - /* check args */ - HDassert(f); - HDassert(p); + assert(f); + assert(p); - /* decode */ if (NULL == (stab = H5FL_CALLOC(H5O_stab_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); + + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(stab->btree_addr)); + + if (H5_IS_BUFFER_OVERFLOW(p, H5F_sizeof_addr(f), p_end)) + HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding"); H5F_addr_decode(f, &p, &(stab->heap_addr)); - /* Set return value */ ret_value = stab; done: - if (ret_value == NULL) - if (stab != NULL) - stab = H5FL_FREE(H5O_stab_t, stab); + if (!ret_value && stab) + H5FL_FREE(H5O_stab_t, stab); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__stab_decode() */ @@ -125,9 +120,6 @@ H5O__stab_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSE * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -138,9 +130,9 @@ H5O__stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(p); - HDassert(stab); + assert(f); + assert(p); + assert(stab); /* encode */ H5F_addr_encode(f, &p, stab->btree_addr); @@ -159,9 +151,6 @@ H5O__stab_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, co * * Failure: NULL * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ static void * @@ -174,7 +163,7 @@ H5O__stab_copy(const void *_mesg, void *_dest) FUNC_ENTER_PACKAGE /* check args */ - HDassert(stab); + assert(stab); if (!dest && NULL == (dest = H5FL_MALLOC(H5O_stab_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); @@ -199,9 +188,6 @@ H5O__stab_copy(const void *_mesg, void *_dest) * * Failure: zero * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ static size_t @@ -224,9 +210,6 @@ H5O__stab_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const void * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 30, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -234,7 +217,7 @@ H5O__stab_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5O_stab_t, mesg); @@ -248,9 +231,6 @@ H5O__stab_free(void *mesg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -261,12 +241,12 @@ H5O__stab_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *mesg) FUNC_ENTER_PACKAGE /* check args */ - HDassert(f); - HDassert(mesg); + assert(f); + assert(mesg); /* Free the file space for the symbol table */ if (H5G__stab_delete(f, (const H5O_stab_t *)mesg) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free symbol table"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -281,9 +261,6 @@ H5O__stab_delete(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, void *mesg) * * Failure: NULL * - * Programmer: Peter Cao - * September 10, 2005 - * *------------------------------------------------------------------------- */ static void * @@ -300,23 +277,23 @@ H5O__stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, FUNC_ENTER_PACKAGE /* check args */ - HDassert(stab_src); - HDassert(file_dst); + assert(stab_src); + assert(file_dst); /* Allocate space for the destination stab */ if (NULL == (stab_dst = H5FL_MALLOC(H5O_stab_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Get the old local heap's size and use that as the hint for the new heap */ if (H5HL_get_size(file_src, stab_src->heap_addr, &size_hint) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size") + HGOTO_ERROR(H5E_SYM, H5E_CANTGETSIZE, NULL, "can't query local heap size"); /* Set copy metadata tag */ - H5_BEGIN_TAG(H5AC__COPIED_TAG); + H5_BEGIN_TAG(H5AC__COPIED_TAG) /* Create components of symbol table message */ if (H5G__stab_create_components(file_dst, stab_dst, size_hint) < 0) - HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components") + HGOTO_ERROR_TAG(H5E_SYM, H5E_CANTINIT, NULL, "can't create symbol table components"); /* Reset metadata tag */ H5_END_TAG @@ -344,9 +321,6 @@ H5O__stab_copy_file(H5F_t *file_src, void *native_src, H5F_t *file_dst, * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * September 28, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -361,15 +335,15 @@ H5O__stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_lo FUNC_ENTER_PACKAGE /* check args */ - HDassert(stab_src); - HDassert(H5F_addr_defined(dst_oloc->addr)); - HDassert(dst_oloc->file); - HDassert(stab_dst); - HDassert(cpy_info); + assert(stab_src); + assert(H5_addr_defined(dst_oloc->addr)); + assert(dst_oloc->file); + assert(stab_dst); + assert(cpy_info); /* If we are performing a 'shallow hierarchy' copy, get out now */ if (cpy_info->max_depth >= 0 && cpy_info->curr_depth >= cpy_info->max_depth) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Set up B-tree iteration user data */ udata.src_oloc = src_oloc; @@ -380,7 +354,7 @@ H5O__stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_lo /* Iterate over objects in group, copying them */ if ((H5B_iterate(src_oloc->file, H5B_SNODE, stab_src->btree_addr, H5G__node_copy, &udata)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "iteration operator failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -393,9 +367,6 @@ H5O__stab_post_copy_file(const H5O_loc_t *src_oloc, const void *mesg_src, H5O_lo * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Aug 6 1997 - * *------------------------------------------------------------------------- */ static herr_t @@ -406,15 +377,15 @@ H5O__stab_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(f); - HDassert(stab); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(stab); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "B-tree address:", stab->btree_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "B-tree address:", stab->btree_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Name heap address:", stab->heap_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Name heap address:", stab->heap_addr); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O__stab_debug() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Otest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Otest.c index 61d513e960..c646f424b2 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Otest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Otest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Monday, December 4, 2006 - * +/* * Purpose: Object header testing functions. */ @@ -96,29 +93,29 @@ H5O__is_attr_dense_test(hid_t oid) /* Get object location for object */ if (NULL == (loc = H5O_get_loc(oid))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ if (H5A__get_ainfo(loc->file, oh, &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message"); } /* end if */ /* Check if dense storage is being used */ - if (H5F_addr_defined(ainfo.fheap_addr)) { + if (H5_addr_defined(ainfo.fheap_addr)) { /* Check for any messages in object header */ - HDassert(H5O__msg_count_real(oh, H5O_MSG_ATTR) == 0); + assert(H5O__msg_count_real(oh, H5O_MSG_ATTR) == 0); ret_value = TRUE; } /* end if */ @@ -127,9 +124,9 @@ H5O__is_attr_dense_test(hid_t oid) done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__is_attr_dense_test() */ @@ -168,22 +165,22 @@ H5O__is_attr_empty_test(hid_t oid) /* Get object location for object */ if (NULL == (loc = H5O_get_loc(oid))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Check for attribute info stored */ if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ if ((ainfo_exists = H5A__get_ainfo(loc->file, oh, &ainfo)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message"); } /* end if */ /* Retrieve the number of attribute messages in header */ @@ -193,17 +190,17 @@ H5O__is_attr_empty_test(hid_t oid) if (oh->version > H5O_VERSION_1) { if (ainfo_exists) { /* Check for using dense storage */ - if (H5F_addr_defined(ainfo.fheap_addr)) { + if (H5_addr_defined(ainfo.fheap_addr)) { /* Check for any messages in object header */ - HDassert(nattrs == 0); + assert(nattrs == 0); /* Set metadata tag in API context */ - H5_BEGIN_TAG(loc->addr); + H5_BEGIN_TAG(loc->addr) /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(loc->file, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for name index") + "unable to open v2 B-tree for name index"); /* Reset metadata tag in API context */ H5_END_TAG @@ -211,14 +208,14 @@ H5O__is_attr_empty_test(hid_t oid) /* Retrieve # of records in name index */ if (H5B2_get_nrec(bt2_name, &nattrs) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, - "unable to retrieve # of records from name index") + "unable to retrieve # of records from name index"); } /* end if */ /* Verify that attribute count in object header is correct */ - HDassert(nattrs == ainfo.nattrs); + assert(nattrs == ainfo.nattrs); } /* end if */ else - HDassert(nattrs == 0); + assert(nattrs == 0); } /* end if */ /* Set the return value */ @@ -227,11 +224,11 @@ H5O__is_attr_empty_test(hid_t oid) done: /* Release resources */ if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index"); if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__is_attr_empty_test() */ @@ -270,23 +267,23 @@ H5O__num_attrs_test(hid_t oid, hsize_t *nattrs) /* Get object location for object */ if (NULL == (loc = H5O_get_loc(oid))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ if (H5A__get_ainfo(loc->file, oh, &ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message"); } /* end if */ /* Retrieve the number of attribute messages in header */ @@ -295,27 +292,27 @@ H5O__num_attrs_test(hid_t oid, hsize_t *nattrs) /* Check for later version of object header format */ if (oh->version > H5O_VERSION_1) { /* Check for using dense storage */ - if (H5F_addr_defined(ainfo.fheap_addr)) { + if (H5_addr_defined(ainfo.fheap_addr)) { /* Check for any messages in object header */ - HDassert(obj_nattrs == 0); + assert(obj_nattrs == 0); /* Set metadata tag in API context */ - H5_BEGIN_TAG(loc->addr); + H5_BEGIN_TAG(loc->addr) /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(loc->file, ainfo.name_bt2_addr, NULL))) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Reset metadata tag in API context */ H5_END_TAG /* Retrieve # of records in name index */ if (H5B2_get_nrec(bt2_name, &obj_nattrs) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index"); } /* end if */ /* Verify that attribute count in object header is correct */ - HDassert(obj_nattrs == ainfo.nattrs); + assert(obj_nattrs == ainfo.nattrs); } /* end if */ /* Set the number of attributes */ @@ -324,11 +321,11 @@ H5O__num_attrs_test(hid_t oid, hsize_t *nattrs) done: /* Release resources */ if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index"); if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__num_attrs_test() */ @@ -369,53 +366,53 @@ H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* Get object location for object */ if (NULL == (loc = H5O_get_loc(oid))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Set metadata tag in API context */ - H5_BEGIN_TAG(loc->addr); + H5_BEGIN_TAG(loc->addr) /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if (oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ if (H5A__get_ainfo(loc->file, oh, &ainfo) < 0) - HGOTO_ERROR_TAG(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") + HGOTO_ERROR_TAG(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message"); } /* end if */ /* Check for 'dense' attribute storage file addresses being defined */ - if (!H5F_addr_defined(ainfo.fheap_addr)) - HGOTO_DONE_TAG(FAIL) - if (!H5F_addr_defined(ainfo.name_bt2_addr)) - HGOTO_DONE_TAG(FAIL) + if (!H5_addr_defined(ainfo.fheap_addr)) + HGOTO_DONE_TAG(FAIL); + if (!H5_addr_defined(ainfo.name_bt2_addr)) + HGOTO_DONE_TAG(FAIL); /* Open the name index v2 B-tree */ if (NULL == (bt2_name = H5B2_open(loc->file, ainfo.name_bt2_addr, NULL))) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index"); /* Retrieve # of records in name index */ if (H5B2_get_nrec(bt2_name, name_count) < 0) - HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index") + HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index"); /* Check if there is a creation order index */ - if (H5F_addr_defined(ainfo.corder_bt2_addr)) { + if (H5_addr_defined(ainfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ if (NULL == (bt2_corder = H5B2_open(loc->file, ainfo.corder_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for creation order index") + "unable to open v2 B-tree for creation order index"); /* Retrieve # of records in creation order index */ if (H5B2_get_nrec(bt2_corder, corder_count) < 0) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTCOUNT, FAIL, - "unable to retrieve # of records from creation order index") + "unable to retrieve # of records from creation order index"); } /* end if */ else *corder_count = 0; @@ -426,13 +423,13 @@ H5O__attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) done: /* Release resources */ if (bt2_name && H5B2_close(bt2_name) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") + HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index"); if (bt2_corder && H5B2_close(bt2_corder) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") + HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index"); if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__attr_dense_info_test() */ @@ -471,11 +468,11 @@ H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val) /* Get object location for object */ if (NULL == (loc = H5O_get_loc(oid))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Locate "unknown" message */ for (idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) @@ -483,7 +480,7 @@ H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val) /* Check for "unknown" message having the correct flags */ if (((idx_msg->flags & H5O_MSG_FLAG_WAS_UNKNOWN) > 0) != flag_val) HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, - "'unknown' message has incorrect 'was unknown' flag value") + "'unknown' message has incorrect 'was unknown' flag value"); /* Break out of loop, to indicate that the "unknown" message was found */ break; @@ -491,11 +488,11 @@ H5O__check_msg_marked_test(hid_t oid, hbool_t flag_val) /* Check for not finding an "unknown" message */ if (idx == oh->nmesgs) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "'unknown' message type not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "'unknown' message type not found"); done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__check_msg_marked_test() */ @@ -532,11 +529,11 @@ H5O__expunge_chunks_test(const H5O_loc_t *loc) /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header"); /* Safety check */ nchunks = oh->nchunks; - HDassert(0 < nchunks && nchunks < NELMTS(chk_addr)); + assert(0 < nchunks && nchunks < NELMTS(chk_addr)); /* Iterate over all the chunks, saving the chunk addresses */ for (u = 0; u < oh->nchunks; u++) @@ -544,14 +541,14 @@ H5O__expunge_chunks_test(const H5O_loc_t *loc) /* Release the object header */ if (H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header"); /* Iterate over all the saved chunk addresses, evicting them from the cache */ /* (in reverse order, so that chunk #0 is unpinned) */ for (u = nchunks - 1; u < nchunks; u--) if (H5AC_expunge_entry(loc->file, (u == 0 ? H5AC_OHDR : H5AC_OHDR_CHK), chk_addr[u], H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTEXPUNGE, FAIL, "unable to expunge object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTEXPUNGE, FAIL, "unable to expunge object header chunk"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -586,12 +583,12 @@ H5O__get_rc_test(const H5O_loc_t *loc, unsigned *rc) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(loc); - HDassert(rc); + assert(loc); + assert(rc); /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to protect object header"); /* Save the refcount for the object header */ *rc = oh->nlink; @@ -599,7 +596,7 @@ H5O__get_rc_test(const H5O_loc_t *loc, unsigned *rc) done: /* Release the object header */ if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to unprotect object header"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__get_rc_test() */ @@ -639,16 +636,16 @@ H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) /* Get object location for object */ if (NULL == (loc = H5O_get_loc(oid))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Locate first message of given type */ for (idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) @@ -662,13 +659,13 @@ H5O__msg_get_chunkno_test(hid_t oid, unsigned msg_type, unsigned *chunk_num) /* Check for not finding a message of the given type*/ if (idx == oh->nmesgs) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message of type not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "message of type not found"); done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__msg_get_chunkno_test() */ @@ -706,16 +703,16 @@ H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) /* Get object location for object */ if (NULL == (loc = H5O_get_loc(oid))) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found"); /* Set API context */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set API context"); api_ctx_pushed = TRUE; /* Get the object header */ if (NULL == (oh = H5O_protect(loc, H5AC__NO_FLAGS_SET, FALSE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header"); /* Locate first message of given type */ for (idx = 0, curr_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, curr_msg++) @@ -769,7 +766,7 @@ H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) /* (*new_idx returned from this routine is unused here) */ if (H5O__alloc_chunk(loc->file, oh, (curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)), oh->nmesgs, &found_msg, &new_idx) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate new object header chunk") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "can't allocate new object header chunk"); /* Break out of loop, the message was found */ break; @@ -777,9 +774,9 @@ H5O__msg_move_to_new_chunk_test(hid_t oid, unsigned msg_type) done: if (oh && H5O_unprotect(loc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); if (api_ctx_pushed && H5CX_pop(FALSE) < 0) - HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_OHDR, H5E_CANTRESET, FAIL, "can't reset API context"); FUNC_LEAVE_NOAPI(ret_value) } /* H5O__msg_move_to_new_chunk_test() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ounknown.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ounknown.c index 99a3a72177..08841021de 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ounknown.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ounknown.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Ounknown.c - * Apr 19 2007 - * Quincey Koziol * * Purpose: Handle unknown message classes in a minimal way. * @@ -66,9 +63,6 @@ H5FL_DEFINE(H5O_unknown_t); * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, May 1, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -76,7 +70,7 @@ H5O__unknown_free(void *mesg) { FUNC_ENTER_PACKAGE_NOERR - HDassert(mesg); + assert(mesg); mesg = H5FL_FREE(H5O_unknown_t, mesg); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5P.c b/externals/coda-oss/modules/drivers/hdf5/source/H5P.c index 3ce5bd559d..8d64bfd85b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5P.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5P.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,8 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * +/* * Purpose: Generic Property Functions */ @@ -175,27 +173,27 @@ H5Pcreate_class(hid_t parent, const char *name, H5P_cls_create_func_t cls_create /* Check arguments. */ if (H5P_DEFAULT != parent && (H5I_GENPROP_CLS != H5I_get_type(parent))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list class"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid class name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid class name"); if ((create_data != NULL && cls_create == NULL) || (copy_data != NULL && cls_copy == NULL) || (close_data != NULL && cls_close == NULL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "data specified, but no callback provided") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "data specified, but no callback provided"); /* Get the pointer to the parent class */ if (parent == H5P_DEFAULT) par_class = NULL; else if (NULL == (par_class = (H5P_genclass_t *)H5I_object(parent))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve parent class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't retrieve parent class"); /* Create the new property list class */ if (NULL == (pclass = H5P__create_class(par_class, name, H5P_TYPE_USER, cls_create, create_data, cls_copy, copy_data, cls_close, close_data))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list class"); /* Get an ID for the class */ if ((ret_value = H5I_register(H5I_GENPROP_CLS, pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class"); done: if (H5I_INVALID_HID == ret_value && pclass) @@ -416,17 +414,17 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, H5P_p /* Check arguments. */ if (NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(cls_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid class name"); if (size > 0 && def_value == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default"); /* Create the new property list class */ orig_pclass = pclass; if ((ret_value = H5P__register(&pclass, name, size, def_value, prp_create, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in class"); /* Check if the property class changed and needs to be substituted in the ID */ if (pclass != orig_pclass) { @@ -434,13 +432,13 @@ H5Pregister2(hid_t cls_id, const char *name, size_t size, void *def_value, H5P_p /* Substitute the new property class in the ID */ if (NULL == (old_pclass = (H5P_genclass_t *)H5I_subst(cls_id, pclass))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to substitute property class in ID") - HDassert(old_pclass == orig_pclass); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to substitute property class in ID"); + assert(old_pclass == orig_pclass); /* Close the previous class */ if (H5P__close_class(old_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, - "unable to close original property class after substitution") + "unable to close original property class after substitution"); } /* end if */ done: @@ -600,16 +598,16 @@ H5Pinsert2(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_s /* Check arguments. */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); if (size > 0 && value == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default"); /* Create the new property list class */ if ((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, prp_cmp, prp_close)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist"); done: FUNC_LEAVE_API(ret_value) @@ -832,7 +830,7 @@ H5Pencode2(hid_t plist_id, void *buf, size_t *nalloc, hid_t fapl_id) /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* Call the internal encode routine */ if ((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0) @@ -1024,18 +1022,18 @@ H5Pequal(hid_t id1, hid_t id2) /* Check arguments. */ if ((H5I_GENPROP_LST != H5I_get_type(id1) && H5I_GENPROP_CLS != H5I_get_type(id1)) || (H5I_GENPROP_LST != H5I_get_type(id2) && H5I_GENPROP_CLS != H5I_get_type(id2))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property objects") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property objects"); if (H5I_get_type(id1) != H5I_get_type(id2)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not the same kind of property objects") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not the same kind of property objects"); if (NULL == (obj1 = H5I_object(id1)) || NULL == (obj2 = H5I_object(id2))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); /* Compare property lists */ if (H5I_GENPROP_LST == H5I_get_type(id1)) { int cmp_ret = 0; if (H5P__cmp_plist((const H5P_genplist_t *)obj1, (const H5P_genplist_t *)obj2, &cmp_ret) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOMPARE, FAIL, "can't compare property lists") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOMPARE, FAIL, "can't compare property lists"); /* Set return value */ ret_value = cmp_ret == 0 ? TRUE : FALSE; @@ -1125,8 +1123,8 @@ H5P__iterate_cb(H5P_genprop_t *prop, void *_udata) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(prop); - HDassert(udata); + assert(prop); + assert(udata); /* Call the user's callback routine */ ret_value = (*udata->iter_func)(udata->id, prop->name, udata->iter_data); @@ -1381,26 +1379,26 @@ H5Pcopy_prop(hid_t dst_id, hid_t src_id, const char *name) /* Check arguments. */ if ((src_id_type = H5I_get_type(src_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid source ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid source ID"); if ((dst_id_type = H5I_get_type(dst_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid destination ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid destination ID"); if ((H5I_GENPROP_LST != src_id_type && H5I_GENPROP_CLS != src_id_type) || (H5I_GENPROP_LST != dst_id_type && H5I_GENPROP_CLS != dst_id_type)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property objects") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not property objects"); if (src_id_type != dst_id_type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not the same kind of property objects") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not the same kind of property objects"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); /* Compare property lists */ if (H5I_GENPROP_LST == src_id_type) { if (H5P__copy_prop_plist(dst_id, src_id, name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between lists") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between lists"); } /* end if */ /* Must be property classes */ else { if (H5P__copy_prop_pclass(dst_id, src_id, name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between classes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy property between classes"); } /* end else */ done: @@ -1484,11 +1482,11 @@ H5Pclose(hid_t plist_id) if (H5P_DEFAULT != plist_id) { /* Check arguments. */ if (H5I_GENPROP_LST != H5I_get_type(plist_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Close the property list */ if (H5I_dec_app_ref(plist_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close"); } /* end if */ done: @@ -1567,19 +1565,19 @@ H5Pget_class_parent(hid_t pclass_id) /* Check arguments. */ if (NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property class"); /* Retrieve the property class's parent */ if (NULL == (parent = H5P__get_class_parent(pclass))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to query class of property list") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5I_INVALID_HID, "unable to query class of property list"); /* Increment the outstanding references to the class object */ if (H5P__access_class(parent, H5P_MOD_INC_REF) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ID ref count") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ID ref count"); /* Get an ID for the class */ if ((ret_value = H5I_register(H5I_GENPROP_CLS, parent, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list class"); done: if (H5I_INVALID_HID == ret_value && parent) @@ -1616,11 +1614,11 @@ H5Pclose_class(hid_t cls_id) /* Check arguments */ if (H5I_GENPROP_CLS != H5I_get_type(cls_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list class"); /* Close the property list class */ if (H5I_dec_app_ref(cls_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't close"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5PB.c b/externals/coda-oss/modules/drivers/hdf5/source/H5PB.c index 7504aba9da..6f9f7323e1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5PB.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5PB.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -79,8 +78,8 @@ #define H5PB__INSERT_LRU(page_buf, page_ptr) \ { \ - HDassert(page_buf); \ - HDassert(page_ptr); \ + assert(page_buf); \ + assert(page_ptr); \ /* insert the entry at the head of the list. */ \ H5PB__PREPEND((page_ptr), (page_buf)->LRU_head_ptr, (page_buf)->LRU_tail_ptr, \ (page_buf)->LRU_list_len) \ @@ -88,8 +87,8 @@ #define H5PB__REMOVE_LRU(page_buf, page_ptr) \ { \ - HDassert(page_buf); \ - HDassert(page_ptr); \ + assert(page_buf); \ + assert(page_ptr); \ /* remove the entry from the list. */ \ H5PB__REMOVE((page_ptr), (page_buf)->LRU_head_ptr, (page_buf)->LRU_tail_ptr, \ (page_buf)->LRU_list_len) \ @@ -97,8 +96,8 @@ #define H5PB__MOVE_TO_TOP_LRU(page_buf, page_ptr) \ { \ - HDassert(page_buf); \ - HDassert(page_ptr); \ + assert(page_buf); \ + assert(page_ptr); \ /* Remove entry and insert at the head of the list. */ \ H5PB__REMOVE((page_ptr), (page_buf)->LRU_head_ptr, (page_buf)->LRU_tail_ptr, \ (page_buf)->LRU_list_len) \ @@ -154,8 +153,6 @@ H5FL_DEFINE_STATIC(H5PB_entry_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -164,7 +161,7 @@ H5PB_reset_stats(H5PB_t *page_buf) FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(page_buf); + assert(page_buf); page_buf->accesses[0] = 0; page_buf->accesses[1] = 0; @@ -195,8 +192,6 @@ H5PB_reset_stats(H5PB_t *page_buf) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -206,7 +201,7 @@ H5PB_get_stats(const H5PB_t *page_buf, unsigned accesses[2], unsigned hits[2], u FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(page_buf); + assert(page_buf); accesses[0] = page_buf->accesses[0]; accesses[1] = page_buf->accesses[1]; @@ -232,8 +227,6 @@ H5PB_get_stats(const H5PB_t *page_buf, unsigned accesses[2], unsigned hits[2], u * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -241,29 +234,29 @@ H5PB_print_stats(const H5PB_t *page_buf) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(page_buf); - - HDprintf("PAGE BUFFER STATISTICS:\n"); - - HDprintf("******* METADATA\n"); - HDprintf("\t Total Accesses: %u\n", page_buf->accesses[0]); - HDprintf("\t Hits: %u\n", page_buf->hits[0]); - HDprintf("\t Misses: %u\n", page_buf->misses[0]); - HDprintf("\t Evictions: %u\n", page_buf->evictions[0]); - HDprintf("\t Bypasses: %u\n", page_buf->bypasses[0]); - HDprintf("\t Hit Rate = %f%%\n", - ((double)page_buf->hits[0] / (page_buf->accesses[0] - page_buf->bypasses[0])) * 100); - HDprintf("*****************\n\n"); - - HDprintf("******* RAWDATA\n"); - HDprintf("\t Total Accesses: %u\n", page_buf->accesses[1]); - HDprintf("\t Hits: %u\n", page_buf->hits[1]); - HDprintf("\t Misses: %u\n", page_buf->misses[1]); - HDprintf("\t Evictions: %u\n", page_buf->evictions[1]); - HDprintf("\t Bypasses: %u\n", page_buf->bypasses[1]); - HDprintf("\t Hit Rate = %f%%\n", - ((double)page_buf->hits[1] / (page_buf->accesses[1] - page_buf->bypasses[0])) * 100); - HDprintf("*****************\n\n"); + assert(page_buf); + + printf("PAGE BUFFER STATISTICS:\n"); + + printf("******* METADATA\n"); + printf("\t Total Accesses: %u\n", page_buf->accesses[0]); + printf("\t Hits: %u\n", page_buf->hits[0]); + printf("\t Misses: %u\n", page_buf->misses[0]); + printf("\t Evictions: %u\n", page_buf->evictions[0]); + printf("\t Bypasses: %u\n", page_buf->bypasses[0]); + printf("\t Hit Rate = %f%%\n", + ((double)page_buf->hits[0] / (page_buf->accesses[0] - page_buf->bypasses[0])) * 100); + printf("*****************\n\n"); + + printf("******* RAWDATA\n"); + printf("\t Total Accesses: %u\n", page_buf->accesses[1]); + printf("\t Hits: %u\n", page_buf->hits[1]); + printf("\t Misses: %u\n", page_buf->misses[1]); + printf("\t Evictions: %u\n", page_buf->evictions[1]); + printf("\t Bypasses: %u\n", page_buf->bypasses[1]); + printf("\t Hit Rate = %f%%\n", + ((double)page_buf->hits[1] / (page_buf->accesses[1] - page_buf->bypasses[0])) * 100); + printf("*****************\n\n"); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5PB_print_stats */ @@ -275,8 +268,6 @@ H5PB_print_stats(const H5PB_t *page_buf) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -288,11 +279,12 @@ H5PB_create(H5F_shared_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, un FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); + assert(f_sh); /* Check args */ if (f_sh->fs_strategy != H5F_FSPACE_STRATEGY_PAGE) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "Enabling Page Buffering requires PAGE file space strategy") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, + "Enabling Page Buffering requires PAGE file space strategy"); /* round down the size if it is larger than the page size */ else if (size > f_sh->fs_page_size) { hsize_t temp_size; @@ -301,11 +293,11 @@ H5PB_create(H5F_shared_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, un H5_CHECKED_ASSIGN(size, size_t, temp_size, hsize_t); } /* end if */ else if (0 != size % f_sh->fs_page_size) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINIT, FAIL, "Page Buffer size must be >= to the page size") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINIT, FAIL, "Page Buffer size must be >= to the page size"); /* Allocate the new page buffering structure */ if (NULL == (page_buf = H5FL_CALLOC(H5PB_t))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "memory allocation failed"); page_buf->max_size = size; H5_CHECKED_ASSIGN(page_buf->page_size, size_t, f_sh->fs_page_size, hsize_t); @@ -319,12 +311,12 @@ H5PB_create(H5F_shared_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, un page_buf->min_raw_count = (unsigned)((size * page_buf_min_raw_perc) / (f_sh->fs_page_size * 100)); if (NULL == (page_buf->slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCREATE, FAIL, "can't create skip list") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCREATE, FAIL, "can't create skip list"); if (NULL == (page_buf->mf_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCREATE, FAIL, "can't create skip list") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCREATE, FAIL, "can't create skip list"); if (NULL == (page_buf->page_fac = H5FL_fac_init(page_buf->page_size))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINIT, FAIL, "can't create page factory") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINIT, FAIL, "can't create page factory"); f_sh->page_buf = page_buf; @@ -351,8 +343,6 @@ H5PB_create(H5F_shared_t *f_sh, size_t size, unsigned page_buf_min_meta_perc, un * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ static herr_t @@ -365,13 +355,13 @@ H5PB__flush_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(page_entry); - HDassert(f_sh); + assert(page_entry); + assert(f_sh); /* Flush the page if it's dirty */ if (page_entry->is_dirty) if (H5PB__write_entry(f_sh, page_entry) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -384,8 +374,6 @@ H5PB__flush_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -396,7 +384,7 @@ H5PB_flush(H5F_shared_t *f_sh) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f_sh); + assert(f_sh); /* Flush all the entries in the PB skiplist, if we have write access on the file */ if (f_sh->page_buf && (H5F_ACC_RDWR & H5F_SHARED_INTENT(f_sh))) { @@ -404,7 +392,7 @@ H5PB_flush(H5F_shared_t *f_sh) /* Iterate over all entries in page buffer skip list */ if (H5SL_iterate(page_buf->slist_ptr, H5PB__flush_cb, f_sh)) - HGOTO_ERROR(H5E_PAGEBUF, H5E_BADITER, FAIL, "can't flush page buffer skip list") + HGOTO_ERROR(H5E_PAGEBUF, H5E_BADITER, FAIL, "can't flush page buffer skip list"); } /* end if */ done: @@ -418,8 +406,6 @@ H5PB_flush(H5F_shared_t *f_sh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ static herr_t @@ -431,9 +417,9 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) FUNC_ENTER_PACKAGE_NOERR /* Sanity checking */ - HDassert(page_entry); - HDassert(op_data); - HDassert(op_data->page_buf); + assert(page_entry); + assert(op_data); + assert(op_data->page_buf); /* Remove entry from LRU list */ if (op_data->actual_slist) { @@ -454,8 +440,6 @@ H5PB__dest_cb(void *item, void H5_ATTR_UNUSED *key, void *_op_data) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -466,7 +450,7 @@ H5PB_dest(H5F_shared_t *f_sh) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); + assert(f_sh); /* flush and destroy the page buffer, if it exists */ if (f_sh->page_buf) { @@ -474,7 +458,7 @@ H5PB_dest(H5F_shared_t *f_sh) H5PB_ud1_t op_data; /* Iteration context */ if (H5PB_flush(f_sh) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTFLUSH, FAIL, "can't flush page buffer") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTFLUSH, FAIL, "can't flush page buffer"); /* Set up context info */ op_data.page_buf = page_buf; @@ -482,16 +466,16 @@ H5PB_dest(H5F_shared_t *f_sh) /* Destroy the skip list containing all the entries in the PB */ op_data.actual_slist = TRUE; if (H5SL_destroy(page_buf->slist_ptr, H5PB__dest_cb, &op_data)) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCLOSEOBJ, FAIL, "can't destroy page buffer skip list") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCLOSEOBJ, FAIL, "can't destroy page buffer skip list"); /* Destroy the skip list containing the new entries */ op_data.actual_slist = FALSE; if (H5SL_destroy(page_buf->mf_slist_ptr, H5PB__dest_cb, &op_data)) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCLOSEOBJ, FAIL, "can't destroy page buffer skip list") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTCLOSEOBJ, FAIL, "can't destroy page buffer skip list"); /* Destroy the page factory */ if (H5FL_fac_term(page_buf->page_fac) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTRELEASE, FAIL, "can't destroy page buffer page factory") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTRELEASE, FAIL, "can't destroy page buffer page factory"); f_sh->page_buf = H5FL_FREE(H5PB_t, page_buf); } /* end if */ @@ -510,8 +494,6 @@ H5PB_dest(H5F_shared_t *f_sh) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -524,9 +506,9 @@ H5PB_add_new_page(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t page_addr) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); + assert(f_sh); page_buf = f_sh->page_buf; - HDassert(page_buf); + assert(page_buf); /* If there is an existing page, this means that at some point the * file free space manager freed and re-allocated a page at the same @@ -539,7 +521,7 @@ H5PB_add_new_page(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t page_addr) if (NULL == H5SL_search(page_buf->mf_slist_ptr, &(page_addr))) { /* Create the new PB entry */ if (NULL == (page_entry = H5FL_CALLOC(H5PB_entry_t))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Initialize page fields */ page_entry->addr = page_addr; @@ -548,7 +530,7 @@ H5PB_add_new_page(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t page_addr) /* Insert entry in skip list */ if (H5SL_insert(page_buf->mf_slist_ptr, page_entry, &(page_entry->addr)) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_BADVALUE, FAIL, "Can't insert entry in skip list") + HGOTO_ERROR(H5E_PAGEBUF, H5E_BADVALUE, FAIL, "Can't insert entry in skip list"); } /* end if */ done: @@ -569,8 +551,6 @@ H5PB_add_new_page(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t page_addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -582,9 +562,9 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf) FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(page_buf); - HDassert(size <= page_buf->page_size); - HDassert(buf); + assert(page_buf); + assert(size <= page_buf->page_size); + assert(buf); /* calculate the aligned address of the first page */ page_addr = (addr / page_buf->page_size) * page_buf->page_size; @@ -594,7 +574,7 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf) if (page_entry) { haddr_t offset; - HDassert(addr + size <= page_addr + page_buf->page_size); + assert(addr + size <= page_addr + page_buf->page_size); offset = addr - page_addr; H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, size); @@ -616,8 +596,6 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Feb 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -630,22 +608,22 @@ H5PB_remove_entry(const H5F_shared_t *f_sh, haddr_t addr) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); + assert(f_sh); page_buf = f_sh->page_buf; - HDassert(page_buf); + assert(page_buf); /* Search for address in the skip list */ page_entry = (H5PB_entry_t *)H5SL_search(page_buf->slist_ptr, (void *)(&addr)); /* If found, remove the entry from the PB cache */ if (page_entry) { - HDassert(page_entry->type != H5F_MEM_PAGE_DRAW); + assert(page_entry->type != H5F_MEM_PAGE_DRAW); if (NULL == H5SL_remove(page_buf->slist_ptr, &(page_entry->addr))) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Page Entry is not in skip list") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Page Entry is not in skip list"); /* Remove from LRU list */ H5PB__REMOVE_LRU(page_buf, page_entry) - HDassert(H5SL_count(page_buf->slist_ptr) == page_buf->LRU_list_len); + assert(H5SL_count(page_buf->slist_ptr) == page_buf->LRU_list_len); page_buf->meta_count--; @@ -665,8 +643,6 @@ H5PB_remove_entry(const H5F_shared_t *f_sh, haddr_t addr) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -687,8 +663,8 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); - HDassert(type != H5FD_MEM_GHEAP); + assert(f_sh); + assert(type != H5FD_MEM_GHEAP); /* Get pointer to page buffer info for this file */ page_buf = f_sh->page_buf; @@ -702,7 +678,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * int mpi_size; if ((mpi_size = H5F_shared_mpi_get_size(f_sh)) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size"); if (1 != mpi_size) bypass_pb = TRUE; #endif @@ -715,7 +691,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * */ if (NULL == page_buf || size >= page_buf->page_size || (bypass_pb && H5FD_MEM_DRAW == type)) { if (H5F__accum_read(f_sh, type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "read through metadata accumulator failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "read through metadata accumulator failed"); /* Update statistics */ if (page_buf) { @@ -730,7 +706,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * */ if (NULL == page_buf || (size >= page_buf->page_size && H5FD_MEM_DRAW != type) || (bypass_pb && H5FD_MEM_DRAW == type)) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ /* Update statistics */ @@ -754,7 +730,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * num_touched_pages = (last_page_addr / page_buf->page_size + 1) - (first_page_addr / page_buf->page_size); if (first_page_addr == last_page_addr) { - HDassert(1 == num_touched_pages); + assert(1 == num_touched_pages); last_page_addr = HADDR_UNDEF; } /* end if */ } /* end if */ @@ -789,20 +765,20 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * if (node) { page_entry = (H5PB_entry_t *)H5SL_item(node); - HDassert(page_entry); + assert(page_entry); /* If the current page address falls out of the access block, then there are no more pages to go over */ if (page_entry->addr >= addr + size) break; - HDassert(page_entry->addr == search_addr); + assert(page_entry->addr == search_addr); if (page_entry->is_dirty) { /* special handling for the first page if it is not a full page access */ if (i == 0 && first_page_addr != addr) { offset = addr - first_page_addr; - HDassert(page_buf->page_size > offset); + assert(page_buf->page_size > offset); H5MM_memcpy(buf, (uint8_t *)page_entry->page_buf_ptr + offset, page_buf->page_size - (size_t)offset); @@ -837,7 +813,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * else { /* A raw data access could span 1 or 2 PB entries at this point so we need to handle that */ - HDassert(1 == num_touched_pages || 2 == num_touched_pages); + assert(1 == num_touched_pages || 2 == num_touched_pages); for (i = 0; i < num_touched_pages; i++) { haddr_t buf_offset; @@ -884,18 +860,18 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * /* check if we can make space in page buffer */ if ((can_make_space = H5PB__make_space(f_sh, page_buf, type)) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "make space in Page buffer Failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "make space in Page buffer Failed"); /* if make_space returns 0, then we can't use the page buffer for this I/O and we need to bypass */ if (0 == can_make_space) { /* make space can't return FALSE on second touched page since the first is of the same * type */ - HDassert(0 == i); + assert(0 == i); /* read entire block from VFD and return */ if (H5FD_read(file, type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "driver read request failed"); /* Break out of loop */ break; @@ -905,18 +881,18 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * /* Read page from VFD */ if (NULL == (new_page_buf = H5FL_FAC_MALLOC(page_buf->page_fac))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTALLOC, FAIL, - "memory allocation failed for page buffer entry") + "memory allocation failed for page buffer entry"); /* Read page through the VFD layer, but make sure we don't read past the EOA. */ /* Retrieve the 'eoa' for the file */ if (HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, type))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed"); /* If the entire page falls outside the EOA, then fail */ if (search_addr > eoa) HGOTO_ERROR(H5E_PAGEBUF, H5E_BADVALUE, FAIL, - "reading an entire page that is outside the file EOA") + "reading an entire page that is outside the file EOA"); /* Adjust the read size to not go beyond the EOA */ if (search_addr + page_size > eoa) @@ -924,7 +900,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * /* Read page from VFD */ if (H5FD_read(file, type, search_addr, page_size, new_page_buf) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "driver read request failed"); /* Copy the requested data from the page into the input buffer */ offset = (0 == i ? addr - search_addr : 0); @@ -933,7 +909,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * /* Create the new PB entry */ if (NULL == (page_entry = H5FL_CALLOC(H5PB_entry_t))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "memory allocation failed"); page_entry->page_buf_ptr = new_page_buf; page_entry->addr = search_addr; @@ -942,7 +918,7 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * /* Insert page into PB */ if (H5PB__insert_entry(page_buf, page_entry) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTSET, FAIL, "error inserting new page in page buffer") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTSET, FAIL, "error inserting new page in page buffer"); /* Update statistics */ if (type == H5FD_MEM_DRAW) @@ -966,8 +942,6 @@ H5PB_read(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, void * * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -988,7 +962,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(f_sh); + assert(f_sh); /* Get pointer to page buffer info for this file */ page_buf = f_sh->page_buf; @@ -1002,7 +976,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const int mpi_size; if ((mpi_size = H5F_shared_mpi_get_size(f_sh)) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size"); if (1 != mpi_size) bypass_pb = TRUE; #endif @@ -1015,7 +989,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const */ if (NULL == page_buf || size >= page_buf->page_size || bypass_pb) { if (H5F__accum_write(f_sh, type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed"); /* Update statistics */ if (page_buf) { @@ -1030,13 +1004,13 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const */ if (NULL == page_buf || (size >= page_buf->page_size && H5FD_MEM_DRAW != type) || (bypass_pb && H5FD_MEM_DRAW == type)) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); #ifdef H5_HAVE_PARALLEL if (bypass_pb) { if (H5PB_update_entry(page_buf, addr, size, buf) > 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTUPDATE, FAIL, "failed to update PB with metadata cache") - HGOTO_DONE(SUCCEED) + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTUPDATE, FAIL, "failed to update PB with metadata cache"); + HGOTO_DONE(SUCCEED); } /* end if */ #endif } /* end if */ @@ -1062,7 +1036,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const num_touched_pages = (last_page_addr / page_buf->page_size + 1) - (first_page_addr / page_buf->page_size); if (first_page_addr == last_page_addr) { - HDassert(1 == num_touched_pages); + assert(1 == num_touched_pages); last_page_addr = HADDR_UNDEF; } /* end if */ } /* end if */ @@ -1089,7 +1063,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const page_entry = (H5PB_entry_t *)H5SL_search(page_buf->slist_ptr, (void *)(&search_addr)); if (page_entry) { offset = addr - first_page_addr; - HDassert(page_buf->page_size > offset); + assert(page_buf->page_size > offset); /* Update page's data */ H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, @@ -1103,7 +1077,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const /* Special handling for the last page if it is not a full page update */ else if (num_touched_pages > 1 && i == (num_touched_pages - 1) && (search_addr + page_buf->page_size) != (addr + size)) { - HDassert(search_addr + page_buf->page_size > addr + size); + assert(search_addr + page_buf->page_size > addr + size); /* Lookup the page in the skip list */ page_entry = (H5PB_entry_t *)H5SL_search(page_buf->slist_ptr, (void *)(&search_addr)); @@ -1142,7 +1116,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const } /* end if */ else { /* An access could span 1 or 2 PBs at this point so we need to handle that */ - HDassert(1 == num_touched_pages || 2 == num_touched_pages); + assert(1 == num_touched_pages || 2 == num_touched_pages); for (i = 0; i < num_touched_pages; i++) { haddr_t buf_offset; @@ -1189,17 +1163,17 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const /* Check if we can make space in page buffer */ if ((can_make_space = H5PB__make_space(f_sh, page_buf, type)) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "make space in Page buffer Failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_NOSPACE, FAIL, "make space in Page buffer Failed"); /* If make_space returns 0, then we can't use the page * buffer for this I/O and we need to bypass */ if (0 == can_make_space) { - HDassert(0 == i); + assert(0 == i); /* Write to VFD and return */ if (H5FD_write(file, type, addr, size, buf) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "driver write request failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "driver write request failed"); /* Break out of loop */ break; @@ -1222,10 +1196,10 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const /* Allocate space for the page buffer */ if (NULL == (new_page_buf = H5FL_FAC_MALLOC(page_buf->page_fac))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTALLOC, FAIL, - "memory allocation failed for page buffer entry") - HDmemset(new_page_buf, 0, (size_t)offset); - HDmemset((uint8_t *)new_page_buf + offset + access_size, 0, - page_size - ((size_t)offset + access_size)); + "memory allocation failed for page buffer entry"); + memset(new_page_buf, 0, (size_t)offset); + memset((uint8_t *)new_page_buf + offset + access_size, 0, + page_size - ((size_t)offset + access_size)); page_entry->page_buf_ptr = new_page_buf; @@ -1242,11 +1216,11 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const /* Allocate space for the page buffer */ if (NULL == (new_page_buf = H5FL_FAC_CALLOC(page_buf->page_fac))) HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTALLOC, FAIL, - "memory allocation failed for page buffer entry") + "memory allocation failed for page buffer entry"); /* Create the new loaded PB entry */ if (NULL == (page_entry = H5FL_CALLOC(H5PB_entry_t))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTALLOC, FAIL, "memory allocation failed"); page_entry->page_buf_ptr = new_page_buf; page_entry->addr = search_addr; @@ -1254,12 +1228,12 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const /* Retrieve the 'eoa' for the file */ if (HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, type))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed"); /* If the entire page falls outside the EOA, then fail */ if (search_addr > eoa) HGOTO_ERROR(H5E_PAGEBUF, H5E_BADVALUE, FAIL, - "writing to a page that is outside the file EOA") + "writing to a page that is outside the file EOA"); /* Retrieve the 'eof' for the file - The MPI-VFD EOF * returned will most likely be HADDR_UNDEF, so skip @@ -1267,7 +1241,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const */ if (!H5F_SHARED_HAS_FEATURE(f_sh, H5FD_FEAT_HAS_MPI)) if (HADDR_UNDEF == (eof = H5FD_get_eof(f_sh->lf, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eof request failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eof request failed"); /* Adjust the read size to not go beyond the EOA */ if (search_addr + page_size > eoa) @@ -1275,7 +1249,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const if (search_addr < eof) { if (H5FD_read(file, type, search_addr, page_size, new_page_buf) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "driver read request failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_READERROR, FAIL, "driver read request failed"); /* Update statistics */ if (type == H5FD_MEM_DRAW || type == H5FD_MEM_GHEAP) @@ -1293,7 +1267,7 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const /* Insert page into PB, evicting other pages as necessary */ if (H5PB__insert_entry(page_buf, page_entry) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTSET, FAIL, "error inserting new page in page buffer") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTSET, FAIL, "error inserting new page in page buffer"); } /* end else */ } /* end for */ } /* end else */ @@ -1310,8 +1284,6 @@ H5PB_write(H5F_shared_t *f_sh, H5FD_mem_t type, haddr_t addr, size_t size, const * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * *------------------------------------------------------------------------- */ herr_t @@ -1324,7 +1296,7 @@ H5PB_enabled(H5F_shared_t *f_sh, H5FD_mem_t type, hbool_t *enabled) FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(f_sh); + assert(f_sh); /* Get pointer to page buffer info for this file */ page_buf = f_sh->page_buf; @@ -1338,7 +1310,7 @@ H5PB_enabled(H5F_shared_t *f_sh, H5FD_mem_t type, hbool_t *enabled) int mpi_size; if ((mpi_size = H5F_shared_mpi_get_size(f_sh)) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "can't retrieve MPI communicator size"); if (1 != mpi_size) bypass_pb = TRUE; #endif @@ -1357,7 +1329,7 @@ H5PB_enabled(H5F_shared_t *f_sh, H5FD_mem_t type, hbool_t *enabled) * returns FALSE, the calling function performs I/O avoiding the page * buffer layer */ if (page_buf) { - HDassert(type == H5FD_MEM_DRAW); + assert(type == H5FD_MEM_DRAW); page_buf->bypasses[1]++; } /* end if */ @@ -1389,8 +1361,6 @@ H5PB_enabled(H5F_shared_t *f_sh, H5FD_mem_t type, hbool_t *enabled) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ static herr_t @@ -1402,8 +1372,8 @@ H5PB__insert_entry(H5PB_t *page_buf, H5PB_entry_t *page_entry) /* Insert entry in skip list */ if (H5SL_insert(page_buf->slist_ptr, page_entry, &(page_entry->addr)) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINSERT, FAIL, "can't insert entry in skip list") - HDassert(H5SL_count(page_buf->slist_ptr) * page_buf->page_size <= page_buf->max_size); + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTINSERT, FAIL, "can't insert entry in skip list"); + assert(H5SL_count(page_buf->slist_ptr) * page_buf->page_size <= page_buf->max_size); /* Increment appropriate page count */ if (H5F_MEM_PAGE_DRAW == page_entry->type || H5F_MEM_PAGE_GHEAP == page_entry->type) @@ -1433,8 +1403,6 @@ H5PB__insert_entry(H5PB_t *page_buf, H5PB_entry_t *page_entry) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ static htri_t @@ -1446,8 +1414,8 @@ H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f_sh); - HDassert(page_buf); + assert(f_sh); + assert(page_buf); /* Get oldest entry */ page_entry = page_buf->LRU_tail_ptr; @@ -1456,8 +1424,8 @@ H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) /* If threshould is 100% metadata and page buffer is full of metadata, then we can't make space for raw data */ if (0 == page_buf->raw_count && page_buf->min_meta_count == page_buf->meta_count) { - HDassert(page_buf->meta_count * page_buf->page_size == page_buf->max_size); - HGOTO_DONE(FALSE) + assert(page_buf->meta_count * page_buf->page_size == page_buf->max_size); + HGOTO_DONE(FALSE); } /* end if */ /* check the metadata threshold before evicting metadata items */ @@ -1473,8 +1441,8 @@ H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) /* If threshould is 100% raw data and page buffer is full of raw data, then we can't make space for meta data */ if (0 == page_buf->meta_count && page_buf->min_raw_count == page_buf->raw_count) { - HDassert(page_buf->raw_count * page_buf->page_size == page_buf->max_size); - HGOTO_DONE(FALSE) + assert(page_buf->raw_count * page_buf->page_size == page_buf->max_size); + HGOTO_DONE(FALSE); } /* end if */ /* check the raw data threshold before evicting raw data items */ @@ -1490,11 +1458,11 @@ H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) /* Remove from page index */ if (NULL == H5SL_remove(page_buf->slist_ptr, &(page_entry->addr))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_BADVALUE, FAIL, "Tail Page Entry is not in skip list") + HGOTO_ERROR(H5E_PAGEBUF, H5E_BADVALUE, FAIL, "Tail Page Entry is not in skip list"); /* Remove entry from LRU list */ H5PB__REMOVE_LRU(page_buf, page_entry) - HDassert(H5SL_count(page_buf->slist_ptr) == page_buf->LRU_list_len); + assert(H5SL_count(page_buf->slist_ptr) == page_buf->LRU_list_len); /* Decrement appropriate page type counter */ if (H5F_MEM_PAGE_DRAW == page_entry->type || H5F_MEM_PAGE_GHEAP == page_entry->type) @@ -1505,7 +1473,7 @@ H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) /* Flush page if dirty */ if (page_entry->is_dirty) if (H5PB__write_entry(f_sh, page_entry) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed"); /* Update statistics */ if (page_entry->type == H5F_MEM_PAGE_DRAW || H5F_MEM_PAGE_GHEAP == page_entry->type) @@ -1531,8 +1499,6 @@ H5PB__make_space(H5F_shared_t *f_sh, H5PB_t *page_buf, H5FD_mem_t inserted_type) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ static herr_t @@ -1544,12 +1510,12 @@ H5PB__write_entry(H5F_shared_t *f_sh, H5PB_entry_t *page_entry) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f_sh); - HDassert(page_entry); + assert(f_sh); + assert(page_entry); /* Retrieve the 'eoa' for the file */ if (HADDR_UNDEF == (eoa = H5F_shared_get_eoa(f_sh, (H5FD_mem_t)page_entry->type))) - HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_CANTGET, FAIL, "driver get_eoa request failed"); /* If the starting address of the page is larger than * the EOA, then the entire page is discarded without writing. @@ -1567,7 +1533,7 @@ H5PB__write_entry(H5F_shared_t *f_sh, H5PB_entry_t *page_entry) if (H5FD_write(file, (H5FD_mem_t)page_entry->type, page_entry->addr, page_size, page_entry->page_buf_ptr) < 0) - HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed") + HGOTO_ERROR(H5E_PAGEBUF, H5E_WRITEERROR, FAIL, "file write failed"); } /* end if */ page_entry->is_dirty = FALSE; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5PL.c b/externals/coda-oss/modules/drivers/hdf5/source/H5PL.c index b052078216..c7c3df31b0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5PL.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5PL.c @@ -2,7 +2,7 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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://www.hdfgroup.org/licenses. * @@ -81,7 +81,7 @@ H5PLset_loading_state(unsigned int plugin_control_mask) /* Set the plugin control mask */ if (H5PL__set_plugin_control_mask(plugin_control_mask) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "error setting plugin control mask") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "error setting plugin control mask"); done: FUNC_LEAVE_API(ret_value) @@ -112,11 +112,11 @@ H5PLget_loading_state(unsigned *plugin_control_mask /*out*/) H5TRACE1("e", "x", plugin_control_mask); if (NULL == plugin_control_mask) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_control_mask parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_control_mask parameter cannot be NULL"); /* Set the plugin control mask */ if (H5PL__get_plugin_control_mask(plugin_control_mask) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "error getting plugin control mask") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "error getting plugin control mask"); done: FUNC_LEAVE_API(ret_value) @@ -142,13 +142,13 @@ H5PLappend(const char *search_path) /* Check args */ if (NULL == search_path) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL"); if (0 == HDstrlen(search_path)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero"); /* Append the search path to the path table */ if (H5PL__append_path(search_path) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTAPPEND, FAIL, "unable to append search path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTAPPEND, FAIL, "unable to append search path"); done: FUNC_LEAVE_API(ret_value) @@ -174,13 +174,13 @@ H5PLprepend(const char *search_path) /* Check args */ if (NULL == search_path) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL"); if (0 == HDstrlen(search_path)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero"); /* Prepend the search path to the path table */ if (H5PL__prepend_path(search_path) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to prepend search path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to prepend search path"); done: FUNC_LEAVE_API(ret_value) @@ -207,21 +207,21 @@ H5PLreplace(const char *search_path, unsigned int idx) /* Check args */ if (NULL == search_path) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL"); if (0 == HDstrlen(search_path)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero"); /* Check index */ num_paths = H5PL__get_num_paths(); if (0 == num_paths) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "path table is empty") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "path table is empty"); else if (idx >= num_paths) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, - "index path out of bounds for table - can't be more than %u", (num_paths - 1)) + "index path out of bounds for table - can't be more than %u", (num_paths - 1)); /* Insert the search path into the path table */ if (H5PL__replace_path(search_path, idx) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to replace search path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to replace search path"); done: FUNC_LEAVE_API(ret_value) @@ -249,19 +249,19 @@ H5PLinsert(const char *search_path, unsigned int idx) /* Check args */ if (NULL == search_path) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL"); if (0 == HDstrlen(search_path)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero"); /* Check index */ num_paths = H5PL__get_num_paths(); if ((0 != num_paths) && (idx >= num_paths)) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, - "index path out of bounds for table - can't be more than %u", (num_paths - 1)) + "index path out of bounds for table - can't be more than %u", (num_paths - 1)); /* Insert the search path into the path table */ if (H5PL__insert_path(search_path, idx) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to insert search path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to insert search path"); done: FUNC_LEAVE_API(ret_value) @@ -292,14 +292,14 @@ H5PLremove(unsigned int idx) /* Check index */ num_paths = H5PL__get_num_paths(); if (0 == num_paths) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "path table is empty") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "path table is empty"); else if (idx >= num_paths) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, - "index path out of bounds for table - can't be more than %u", (num_paths - 1)) + "index path out of bounds for table - can't be more than %u", (num_paths - 1)); /* Delete the search path from the path table */ if (H5PL__remove_path(idx) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTDELETE, FAIL, "unable to remove search path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTDELETE, FAIL, "unable to remove search path"); done: FUNC_LEAVE_API(ret_value) @@ -343,18 +343,18 @@ H5PLget(unsigned int idx, char *path_buf, size_t buf_size) /* Check index */ num_paths = H5PL__get_num_paths(); if (0 == num_paths) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "path table is empty") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "path table is empty"); else if (idx >= num_paths) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, - "index path out of bounds for table - can't be more than %u", (num_paths - 1)) + "index path out of bounds for table - can't be more than %u", (num_paths - 1)); /* Check if the search table is empty */ if (H5PL__get_num_paths() == 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, (-1), "plugin search path table is empty") + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, (-1), "plugin search path table is empty"); /* Get the path at the specified index and its length */ if (NULL == (path = H5PL__get_path(idx))) - HGOTO_ERROR(H5E_PLUGIN, H5E_BADVALUE, (-1), "no path stored at that index") + HGOTO_ERROR(H5E_PLUGIN, H5E_BADVALUE, (-1), "no path stored at that index"); path_len = HDstrlen(path); /* If the path buffer is not NULL, copy the path to the buffer */ @@ -391,7 +391,7 @@ H5PLsize(unsigned int *num_paths) /* Check arguments */ if (!num_paths) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "num_paths parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "num_paths parameter cannot be NULL"); /* Get the number of stored plugin paths */ *num_paths = H5PL__get_num_paths(); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5PLint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5PLint.c index 9256e85718..73be42af93 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5PLint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5PLint.c @@ -2,7 +2,7 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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://www.hdfgroup.org/licenses. * @@ -82,7 +82,7 @@ H5PL__get_plugin_control_mask(unsigned int *mask /*out*/) FUNC_ENTER_PACKAGE_NOERR /* Check args - Just assert on package functions */ - HDassert(mask); + assert(mask); /* Return the mask */ *mask = H5PL_plugin_control_mask_g; @@ -148,11 +148,11 @@ H5PL_init(void) /* Create the table of previously-loaded plugins */ if (H5PL__create_plugin_cache() < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINIT, FAIL, "can't create plugin cache") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINIT, FAIL, "can't create plugin cache"); /* Create the table of search paths for dynamic libraries */ if (H5PL__create_path_table() < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINIT, FAIL, "can't create plugin search path table") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINIT, FAIL, "can't create plugin search path table"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -183,13 +183,13 @@ H5PL_term_package(void) * We need to bump the return value if we did any real work here. */ if (H5PL__close_plugin_cache(&already_closed) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTFREE, (-1), "problem closing plugin cache") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTFREE, (-1), "problem closing plugin cache"); if (!already_closed) ret_value++; /* Close the search path table and free the paths */ if (H5PL__close_path_table() < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTFREE, (-1), "problem closing search path table") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTFREE, (-1), "problem closing search path table"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -223,24 +223,24 @@ H5PL_load(H5PL_type_t type, const H5PL_key_t *key) switch (type) { case H5PL_TYPE_FILTER: if ((H5PL_plugin_control_mask_g & H5PL_FILTER_PLUGIN) == 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "filter plugins disabled") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "filter plugins disabled"); break; case H5PL_TYPE_VOL: if ((H5PL_plugin_control_mask_g & H5PL_VOL_PLUGIN) == 0) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, - "Virtual Object Layer (VOL) driver plugins disabled") + "Virtual Object Layer (VOL) driver plugins disabled"); break; case H5PL_TYPE_VFD: if ((H5PL_plugin_control_mask_g & H5PL_VFD_PLUGIN) == 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Virtual File Driver (VFD) plugins disabled") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Virtual File Driver (VFD) plugins disabled"); break; case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Invalid plugin type specified") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "Invalid plugin type specified"); } /* Set up the search parameters */ @@ -249,16 +249,22 @@ H5PL_load(H5PL_type_t type, const H5PL_key_t *key) /* Search in the table of already loaded plugin libraries */ if (H5PL__find_plugin_in_cache(&search_params, &found, &plugin_info) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in plugin cache failed") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in plugin cache failed"); /* If not found, try iterating through the path table to find an appropriate plugin */ if (!found) if (H5PL__find_plugin_in_path_table(&search_params, &found, &plugin_info) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, "search in path table failed") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, NULL, + "can't find plugin in the paths either set by HDF5_PLUGIN_PATH, or default location, " + "or set by H5PLxxx functions"); /* Set the return value we found the plugin */ if (found) ret_value = plugin_info; + else + HGOTO_ERROR(H5E_PLUGIN, H5E_NOTFOUND, NULL, + "can't find plugin. Check either HDF5_VOL_CONNECTOR, HDF5_PLUGIN_PATH, default location, " + "or path set by H5PLxxx functions"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -323,11 +329,11 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(path); + assert(path); if (type == H5PL_TYPE_NONE) - HDassert(!key); - HDassert(success); - HDassert(plugin_info); + assert(!key); + assert(success); + assert(plugin_info); /* Initialize out parameters */ *success = FALSE; @@ -340,25 +346,25 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s */ if (NULL == (handle = H5PL_OPEN_DLIB(path))) { H5PL_CLR_ERROR; /* clear error */ - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* Return a handle for the function H5PLget_plugin_type in the dynamic library. * The plugin library is supposed to define this function. */ if (NULL == (get_plugin_type = (H5PL_get_plugin_type_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_type"))) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Return a handle for the function H5PLget_plugin_info in the dynamic library. * The plugin library is supposed to define this function. */ if (NULL == (get_plugin_info = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(handle, "H5PLget_plugin_info"))) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Check the plugin type and return if it doesn't match the one passed in */ loaded_plugin_type = (H5PL_type_t)(*get_plugin_type)(); if ((type != H5PL_TYPE_NONE) && (type != loaded_plugin_type)) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Get the plugin information */ switch (loaded_plugin_type) { @@ -367,7 +373,7 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s /* Get the plugin info */ if (NULL == (filter_info = (const H5Z_class2_t *)(*get_plugin_info)())) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get filter info from plugin"); /* Setup temporary plugin key if one wasn't supplied */ if (!key) { @@ -391,7 +397,7 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s /* Get the plugin info */ if (NULL == (cls = (const void *)(*get_plugin_info)())) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VOL connector info from plugin") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VOL connector info from plugin"); /* Setup temporary plugin key if one wasn't supplied */ if (!key) { @@ -402,7 +408,7 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s /* Ask VOL interface if this class is the one we are looking for and is compatible, etc */ if (H5VL_check_plugin_load(cls, key, success) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, FAIL, "VOL connector compatibility check failed") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, FAIL, "VOL connector compatibility check failed"); /* Check for finding the correct plugin */ if (*success) { @@ -419,7 +425,7 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s /* Get the plugin info */ if (NULL == (cls = (const void *)(*get_plugin_info)())) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VFD info from plugin") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get VFD info from plugin"); /* Setup temporary plugin key if one wasn't supplied */ if (!key) { @@ -430,7 +436,7 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s /* Ask VFD interface if this class is the one we are looking for and is compatible, etc */ if (H5FD_check_plugin_load(cls, key, success) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, FAIL, "VFD compatibility check failed") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, FAIL, "VFD compatibility check failed"); /* Check for finding the correct plugin */ if (*success) { @@ -445,18 +451,18 @@ H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *s case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "Invalid plugin type specified") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "Invalid plugin type specified"); } /* end switch */ /* If we found the correct plugin, store it in the cache */ if (*success) if (H5PL__add_plugin(loaded_plugin_type, key, handle)) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to add new plugin to plugin cache"); done: if (!(*success) && handle) if (H5PL__close(handle) < 0) - HDONE_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library") + HDONE_ERROR(H5E_PLUGIN, H5E_CLOSEERROR, FAIL, "can't close dynamic library"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5PL__open() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5PLpath.c b/externals/coda-oss/modules/drivers/hdf5/source/H5PLpath.c index 31960c7ce4..82d54228b5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5PLpath.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5PLpath.c @@ -2,7 +2,7 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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://www.hdfgroup.org/licenses. * @@ -108,28 +108,28 @@ H5PL__insert_at(const char *path, unsigned int idx) FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(path); - HDassert(HDstrlen(path)); + assert(path); + assert(HDstrlen(path)); /* Expand the table if it is full */ if (H5PL_num_paths_g == H5PL_path_capacity_g) if (H5PL__expand_path_table() < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't expand path table") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't expand path table"); /* Copy the path for storage so the caller can dispose of theirs */ if (NULL == (path_copy = H5MM_strdup(path))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't make internal copy of path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't make internal copy of path"); #ifdef H5_HAVE_WIN32_API /* Clean up Microsoft Windows environment variables in the path string */ if (H5_expand_windows_env_vars(&path_copy)) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTCONVERT, FAIL, "can't expand environment variable string") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTCONVERT, FAIL, "can't expand environment variable string"); #endif /* H5_HAVE_WIN32_API */ /* If the table entry is in use, make some space */ if (H5PL_paths_g[idx]) if (H5PL__make_space_at(idx) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "unable to make space in the table for the new entry") + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "unable to make space in the table for the new entry"); /* Insert the copy of the search path into the table at the specified index */ H5PL_paths_g[idx] = path_copy; @@ -158,7 +158,7 @@ H5PL__make_space_at(unsigned int idx) FUNC_ENTER_PACKAGE_NOERR /* Check args - Just assert on package functions */ - HDassert(idx < H5PL_path_capacity_g); + assert(idx < H5PL_path_capacity_g); /* Copy the paths back to make a space */ for (u = H5PL_num_paths_g; u > idx; u--) @@ -189,21 +189,21 @@ H5PL__replace_at(const char *path, unsigned int idx) FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(path); - HDassert(HDstrlen(path)); + assert(path); + assert(HDstrlen(path)); /* Check that the table entry is in use */ if (!H5PL_paths_g[idx]) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTFREE, FAIL, "path entry at index %u in the table is NULL", idx) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTFREE, FAIL, "path entry at index %u in the table is NULL", idx); /* Copy the path for storage so the caller can dispose of theirs */ if (NULL == (path_copy = H5MM_strdup(path))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't make internal copy of path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't make internal copy of path"); #ifdef H5_HAVE_WIN32_API /* Clean up Microsoft Windows environment variables in the path string */ if (H5_expand_windows_env_vars(&path_copy)) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTCONVERT, FAIL, "can't expand environment variable string") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTCONVERT, FAIL, "can't expand environment variable string"); #endif /* H5_HAVE_WIN32_API */ /* Free the existing path entry */ @@ -243,7 +243,7 @@ H5PL__create_path_table(void) H5PL_num_paths_g = 0; H5PL_path_capacity_g = H5PL_INITIAL_PATH_CAPACITY; if (NULL == (H5PL_paths_g = (char **)H5MM_calloc((size_t)H5PL_path_capacity_g * sizeof(char *)))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path table") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path table"); /* Retrieve paths from HDF5_PLUGIN_PATH if the user sets it * or from the default paths if it isn't set. @@ -255,7 +255,7 @@ H5PL__create_path_table(void) paths = H5MM_strdup(env_var); if (NULL == paths) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path copy") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path copy"); /* Separate the paths and store them */ next_path = HDstrtok_r(paths, H5PL_PATH_SEPARATOR, &lasts); @@ -263,7 +263,7 @@ H5PL__create_path_table(void) /* Insert the path into the table */ if (H5PL__append_path(next_path) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't insert path: %s", next_path) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't insert path: %s", next_path); /* Get the next path from the environment string */ next_path = HDstrtok_r(NULL, H5PL_PATH_SEPARATOR, &lasts); @@ -356,10 +356,10 @@ H5PL__expand_path_table(void) /* Resize the array */ if (NULL == (H5PL_paths_g = (char **)H5MM_realloc(H5PL_paths_g, (size_t)H5PL_path_capacity_g * sizeof(char *)))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "allocating additional memory for path table failed") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "allocating additional memory for path table failed"); /* Initialize the new memory */ - HDmemset(H5PL_paths_g + H5PL_num_paths_g, 0, (size_t)H5PL_PATH_CAPACITY_ADD * sizeof(char *)); + memset(H5PL_paths_g + H5PL_num_paths_g, 0, (size_t)H5PL_PATH_CAPACITY_ADD * sizeof(char *)); done: /* Set the path capacity back if there were problems */ @@ -386,12 +386,12 @@ H5PL__append_path(const char *path) FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(path); - HDassert(HDstrlen(path)); + assert(path); + assert(HDstrlen(path)); /* Insert the path at the end of the table */ if (H5PL__insert_at(path, H5PL_num_paths_g) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to append search path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to append search path"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -414,12 +414,12 @@ H5PL__prepend_path(const char *path) FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(path); - HDassert(HDstrlen(path)); + assert(path); + assert(HDstrlen(path)); /* Insert the path at the beginning of the table */ if (H5PL__insert_at(path, 0) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to prepend search path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to prepend search path"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -442,13 +442,13 @@ H5PL__replace_path(const char *path, unsigned int idx) FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(path); - HDassert(HDstrlen(path)); - HDassert(idx < H5PL_path_capacity_g); + assert(path); + assert(HDstrlen(path)); + assert(idx < H5PL_path_capacity_g); /* Insert the path at the requested index */ if (H5PL__replace_at(path, idx) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to replace search path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to replace search path"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -472,13 +472,13 @@ H5PL__insert_path(const char *path, unsigned int idx) FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(path); - HDassert(HDstrlen(path)); - HDassert(idx < H5PL_path_capacity_g); + assert(path); + assert(HDstrlen(path)); + assert(idx < H5PL_path_capacity_g); /* Insert the path at the requested index */ if (H5PL__insert_at(path, idx) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to insert search path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTINSERT, FAIL, "unable to insert search path"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -503,11 +503,11 @@ H5PL__remove_path(unsigned int idx) FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(idx < H5PL_path_capacity_g); + assert(idx < H5PL_path_capacity_g); /* Check if the path at that index is set */ if (!H5PL_paths_g[idx]) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTDELETE, FAIL, "search path at index %u is NULL", idx) + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTDELETE, FAIL, "search path at index %u is NULL", idx); /* Delete the path */ H5PL_num_paths_g--; @@ -543,7 +543,7 @@ H5PL__get_path(unsigned int idx) /* Get the path at the requested index */ if (idx >= H5PL_num_paths_g) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "path index %u is out of range in table", idx) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "path index %u is out of range in table", idx); return H5PL_paths_g[idx]; done: @@ -579,7 +579,7 @@ H5PL__path_table_iterate(H5PL_iterate_type_t iter_type, H5PL_iterate_t iter_op, } done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5PL__path_table_iterate() */ /*------------------------------------------------------------------------- @@ -612,12 +612,12 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type FUNC_ENTER_PACKAGE - HDassert(plugin_path); - HDassert(iter_op); + assert(plugin_path); + assert(iter_op); /* Open the directory - skip the path if the directory can't be opened */ if (!(dirp = HDopendir(plugin_path))) - HGOTO_DONE(H5_ITER_CONT) + HGOTO_DONE(H5_ITER_CONT); /* Iterate through all entries in the directory */ while (NULL != (dp = HDreaddir(dirp))) { @@ -640,14 +640,14 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type 4; /* Extra "+4" to quiet GCC warning - 2019/07/05, QAK */ if (NULL == (path = (char *)H5MM_calloc(len))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate memory for path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate memory for path"); HDsnprintf(path, len, "%s/%s", plugin_path, dp->d_name); /* Get info for directory entry */ if (HDstat(path, &my_stat) == -1) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5_ITER_ERROR, "can't stat file %s -- error was: %s", path, - HDstrerror(errno)) + HDstrerror(errno)); /* If it is a directory, skip it */ if (S_ISDIR(my_stat.st_mode)) @@ -681,7 +681,7 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type if (dirp) if (HDclosedir(dirp) < 0) HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, H5_ITER_ERROR, "can't close directory: %s", - HDstrerror(errno)) + HDstrerror(errno)); path = (char *)H5MM_xfree(path); @@ -704,14 +704,14 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(plugin_path); - HDassert(iter_op); + assert(plugin_path); + assert(iter_op); /* Specify a file mask. *.* = We want everything! - * skip the path if the directory can't be opened */ HDsnprintf(service, sizeof(service), "%s\\*.dll", plugin_path); if ((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE) - HGOTO_DONE(H5_ITER_CONT) + HGOTO_DONE(H5_ITER_CONT); /* Loop over all the files */ do { @@ -724,7 +724,7 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type len = HDstrlen(plugin_path) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(fdFile.cFileName) + 1; if (NULL == (path = (char *)H5MM_calloc(len))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate memory for path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate memory for path"); HDsnprintf(path, len, "%s\\%s", plugin_path, fdFile.cFileName); @@ -788,9 +788,9 @@ H5PL__find_plugin_in_path_table(const H5PL_search_params_t *search_params, hbool FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(search_params); - HDassert(found); - HDassert(plugin_info); + assert(search_params); + assert(found); + assert(plugin_info); /* Initialize output parameters */ *found = FALSE; @@ -801,13 +801,12 @@ H5PL__find_plugin_in_path_table(const H5PL_search_params_t *search_params, hbool /* Search for the plugin in this path */ if (H5PL__find_plugin_in_path(search_params, found, H5PL_paths_g[u], plugin_info) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in path %s encountered an error", - H5PL_paths_g[u]) + HERROR(H5E_PLUGIN, H5E_CANTGET, "search in path %s encountered an error", H5PL_paths_g[u]); /* Break out if found */ if (*found) { if (!plugin_info) - HGOTO_ERROR(H5E_PLUGIN, H5E_BADVALUE, FAIL, "plugin info should not be NULL") + HGOTO_ERROR(H5E_PLUGIN, H5E_BADVALUE, FAIL, "plugin info should not be NULL"); break; } } @@ -819,7 +818,7 @@ H5PL__find_plugin_in_path_table(const H5PL_search_params_t *search_params, hbool /*------------------------------------------------------------------------- * Function: H5PL__find_plugin_in_path * - * Purpose: Given a path, this function opens the directory and envokes + * Purpose: Given a path, this function opens the directory and invokes * another function to go through all files to find the right * plugin library. Two function definitions are for Unix and * Windows. @@ -844,17 +843,18 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(search_params); - HDassert(found); - HDassert(dir); - HDassert(plugin_info); + assert(search_params); + assert(found); + assert(dir); + assert(plugin_info); /* Initialize the found parameter */ *found = FALSE; /* Open the directory */ if (!(dirp = HDopendir(dir))) - HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory: %s", dir) + HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory (%s). Please verify its existence", + dir); /* Iterate through all entries in the directory */ while (NULL != (dp = HDreaddir(dirp))) { @@ -877,14 +877,14 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo 4; /* Extra "+4" to quiet GCC warning - 2019/07/05, QAK */ if (NULL == (path = (char *)H5MM_calloc(len))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path"); HDsnprintf(path, len, "%s/%s", dir, dp->d_name); /* Get info for directory entry */ if (HDstat(path, &my_stat) == -1) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't stat file %s -- error was: %s", path, - HDstrerror(errno)) + HDstrerror(errno)); /* If it is a directory, skip it */ if (S_ISDIR(my_stat.st_mode)) { @@ -894,9 +894,9 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo /* attempt to open the dynamic library */ if (H5PL__open(path, search_params->type, search_params->key, found, NULL, plugin_info) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed"); if (*found) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); path = (char *)H5MM_xfree(path); } /* end if */ @@ -905,7 +905,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo done: if (dirp) if (HDclosedir(dirp) < 0) - HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "can't close directory: %s", HDstrerror(errno)) + HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "can't close directory: %s", HDstrerror(errno)); path = (char *)H5MM_xfree(path); @@ -925,10 +925,10 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(search_params); - HDassert(found); - HDassert(dir); - HDassert(plugin_info); + assert(search_params); + assert(found); + assert(dir); + assert(plugin_info); /* Initialize the found parameter */ *found = FALSE; @@ -936,7 +936,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo /* Specify a file mask. *.* = We want everything! */ HDsnprintf(service, sizeof(service), "%s\\*.dll", dir); if ((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE) - HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory") + HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory"); /* Loop over all the files */ do { @@ -951,7 +951,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(fdFile.cFileName) + 1; if (NULL == (path = (char *)H5MM_calloc(len))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path"); HDsnprintf(path, len, "%s\\%s", dir, fdFile.cFileName); @@ -961,9 +961,9 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo /* attempt to open the dynamic library */ if (H5PL__open(path, search_params->type, search_params->key, found, NULL, plugin_info) < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "search in directory failed"); if (*found) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); path = (char *)H5MM_xfree(path); } diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5PLplugin_cache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5PLplugin_cache.c index 2f77e58e74..e294dc7d2a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5PLplugin_cache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5PLplugin_cache.c @@ -2,7 +2,7 @@ * Copyright by The HDF Group. * * All rights reserved. * * * - * This file is part of HDF5. The full HDF5 copyright notice, including * + * 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://www.hdfgroup.org/licenses. * @@ -109,7 +109,7 @@ H5PL__create_plugin_cache(void) if (NULL == (H5PL_cache_g = (H5PL_plugin_t *)H5MM_calloc((size_t)H5PL_cache_capacity_g * sizeof(H5PL_plugin_t)))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for plugin cache") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for plugin cache"); done: /* Try to clean up on errors */ @@ -183,10 +183,10 @@ H5PL__expand_cache(void) /* Resize the array */ if (NULL == (H5PL_cache_g = (H5PL_plugin_t *)H5MM_realloc(H5PL_cache_g, (size_t)H5PL_cache_capacity_g * sizeof(H5PL_plugin_t)))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "allocating additional memory for plugin cache failed") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "allocating additional memory for plugin cache failed"); /* Initialize the new memory */ - HDmemset(H5PL_cache_g + H5PL_num_plugins_g, 0, (size_t)H5PL_CACHE_CAPACITY_ADD * sizeof(H5PL_plugin_t)); + memset(H5PL_cache_g + H5PL_num_plugins_g, 0, (size_t)H5PL_CACHE_CAPACITY_ADD * sizeof(H5PL_plugin_t)); done: /* Set the cache capacity back if there were problems */ @@ -215,7 +215,7 @@ H5PL__add_plugin(H5PL_type_t type, const H5PL_key_t *key, H5PL_HANDLE handle) /* Expand the cache if it is too small */ if (H5PL_num_plugins_g >= H5PL_cache_capacity_g) if (H5PL__expand_cache() < 0) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't expand plugin cache") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't expand plugin cache"); /* Store the plugin info and bump the # of plugins */ H5PL_cache_g[H5PL_num_plugins_g].type = type; @@ -253,9 +253,9 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f FUNC_ENTER_PACKAGE /* Check args - Just assert on package functions */ - HDassert(search_params); - HDassert(found); - HDassert(plugin_info); + assert(search_params); + assert(found); + assert(plugin_info); /* Initialize output parameters */ *found = FALSE; @@ -289,7 +289,7 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f matched = TRUE; } else { - HDassert(search_params->key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE); + assert(search_params->key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE); /* Make sure the plugin cache entry key type matches our search key type */ if (H5PL_cache_g[u].key.vol.kind != H5VL_GET_CONNECTOR_BY_VALUE) @@ -313,7 +313,7 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f matched = TRUE; } else { - HDassert(search_params->key->vfd.kind == H5FD_GET_DRIVER_BY_VALUE); + assert(search_params->key->vfd.kind == H5FD_GET_DRIVER_BY_VALUE); /* Make sure the plugin cache entry key type matches our search key type */ if (H5PL_cache_g[u].key.vfd.kind != H5FD_GET_DRIVER_BY_VALUE) @@ -329,7 +329,7 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f case H5PL_TYPE_ERROR: case H5PL_TYPE_NONE: default: - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "Invalid plugin type specified") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "Invalid plugin type specified"); } /* If the plugin type (filter, VOL connector, VFD plugin, etc.) and key match, @@ -342,11 +342,11 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f /* Get the "get plugin info" function from the plugin. */ if (NULL == (get_plugin_info_function = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC( H5PL_cache_g[u].handle, "H5PLget_plugin_info"))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info"); /* Call the "get plugin info" function */ if (NULL == (info = (*get_plugin_info_function)())) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info"); /* Set output parameters */ *found = TRUE; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pacpl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pacpl.c index 65fd54ace7..b4dd90b8df 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pacpl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pacpl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pdapl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pdapl.c index a8d8717c38..1167fabddf 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pdapl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pdapl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pdapl.c - * October 27, 2008 - * Neil Fortner * * Purpose: Dataset access property list class routines * @@ -31,13 +28,14 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5VMprivate.h" /* Vector Functions */ /****************/ /* Local Macros */ @@ -203,43 +201,43 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) if (H5P__register_real(pclass, H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5D_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &rdcc_nslots, NULL, NULL, NULL, H5D_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5D_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the size of raw data chunk cache(bytes) */ if (H5P__register_real(pclass, H5D_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5D_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &rdcc_nbytes, NULL, NULL, NULL, H5D_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5D_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the preemption for reading chunks */ if (H5P__register_real(pclass, H5D_ACS_PREEMPT_READ_CHUNKS_NAME, H5D_ACS_PREEMPT_READ_CHUNKS_SIZE, &rdcc_w0, NULL, NULL, NULL, H5D_ACS_PREEMPT_READ_CHUNKS_ENC, H5D_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the VDS view option */ if (H5P__register_real(pclass, H5D_ACS_VDS_VIEW_NAME, H5D_ACS_VDS_VIEW_SIZE, &virtual_view, NULL, NULL, NULL, H5D_ACS_VDS_VIEW_ENC, H5D_ACS_VDS_VIEW_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the VDS printf gap */ if (H5P__register_real(pclass, H5D_ACS_VDS_PRINTF_GAP_NAME, H5D_ACS_VDS_PRINTF_GAP_SIZE, &printf_gap, NULL, NULL, NULL, H5D_ACS_VDS_PRINTF_GAP_ENC, H5D_ACS_VDS_PRINTF_GAP_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register property for vds prefix */ if (H5P__register_real(pclass, H5D_ACS_VDS_PREFIX_NAME, H5D_ACS_VDS_PREFIX_SIZE, &H5D_def_vds_prefix_g, NULL, H5D_ACS_VDS_PREFIX_SET, H5D_ACS_VDS_PREFIX_GET, H5D_ACS_VDS_PREFIX_ENC, H5D_ACS_VDS_PREFIX_DEC, H5D_ACS_VDS_PREFIX_DEL, H5D_ACS_VDS_PREFIX_COPY, H5D_ACS_VDS_PREFIX_CMP, H5D_ACS_VDS_PREFIX_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register info for append flush */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_ACS_APPEND_FLUSH_NAME, H5D_ACS_APPEND_FLUSH_SIZE, &H5D_def_append_flush_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register property for external file prefix */ if (H5P__register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, @@ -247,7 +245,7 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) H5D_ACS_EFILE_PREFIX_ENC, H5D_ACS_EFILE_PREFIX_DEC, H5D_ACS_EFILE_PREFIX_DEL, H5D_ACS_EFILE_PREFIX_COPY, H5D_ACS_EFILE_PREFIX_CMP, H5D_ACS_EFILE_PREFIX_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -269,7 +267,7 @@ H5P__dapl_vds_file_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(value); + assert(value); /* Copy the prefix */ *(char **)value = H5MM_xstrdup(*(const char **)value); @@ -293,7 +291,7 @@ H5P__dapl_vds_file_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(value); + assert(value); /* Copy the prefix */ *(char **)value = H5MM_xstrdup(*(const char **)value); @@ -330,7 +328,7 @@ H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size) enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); if (NULL != *pp) { /* encode the length of the prefix */ @@ -373,14 +371,14 @@ H5P__dapl_vds_file_pref_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE - HDassert(pp); - HDassert(*pp); - HDassert(vds_file_pref); + assert(pp); + assert(*pp); + assert(vds_file_pref); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); /* Decode the size */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); /* Decode the value */ UINT64DECODE_VAR(*pp, enc_value, enc_size); @@ -389,7 +387,7 @@ H5P__dapl_vds_file_pref_dec(const void **_pp, void *_value) if (0 != len) { /* Make a copy of the user's prefix string */ if (NULL == (*vds_file_pref = (char *)H5MM_malloc(len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix"); HDstrncpy(*vds_file_pref, *(const char **)pp, len); (*vds_file_pref)[len] = '\0'; @@ -416,7 +414,7 @@ H5P__dapl_vds_file_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); H5MM_xfree(*(void **)value); @@ -436,7 +434,7 @@ H5P__dapl_vds_file_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNU { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); *(char **)value = H5MM_xstrdup(*(const char **)value); @@ -486,7 +484,7 @@ H5P__dapl_vds_file_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UN { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); H5MM_xfree(*(void **)value); @@ -509,7 +507,7 @@ H5P__dapl_efile_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(value); + assert(value); /* Copy the prefix */ *(char **)value = H5MM_xstrdup(*(const char **)value); @@ -533,7 +531,7 @@ H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(value); + assert(value); /* Copy the prefix */ *(char **)value = H5MM_xstrdup(*(const char **)value); @@ -570,7 +568,7 @@ H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); if (NULL != *pp) { /* encode the length of the prefix */ @@ -613,14 +611,14 @@ H5P__dapl_efile_pref_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE - HDassert(pp); - HDassert(*pp); - HDassert(efile_pref); + assert(pp); + assert(*pp); + assert(efile_pref); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); /* Decode the size */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); /* Decode the value */ UINT64DECODE_VAR(*pp, enc_value, enc_size); @@ -629,7 +627,7 @@ H5P__dapl_efile_pref_dec(const void **_pp, void *_value) if (0 != len) { /* Make a copy of the user's prefix string */ if (NULL == (*efile_pref = (char *)H5MM_malloc(len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix"); HDstrncpy(*efile_pref, *(const char **)pp, len); (*efile_pref)[len] = '\0'; @@ -656,7 +654,7 @@ H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); H5MM_xfree(*(void **)value); @@ -676,7 +674,7 @@ H5P__dapl_efile_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); *(char **)value = H5MM_xstrdup(*(const char **)value); @@ -726,7 +724,7 @@ H5P__dapl_efile_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); H5MM_xfree(*(void **)value); @@ -874,7 +872,7 @@ H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size) /* Sanity checks */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - HDassert(size); + assert(size); /* Determine if this is the default value, in which case only encode * enc_size (as 255). Also set size needed for encoding. */ @@ -885,11 +883,11 @@ H5P__encode_chunk_cache_nslots(const void *value, void **_pp, size_t *size) else { enc_value = (uint64_t) * (const size_t *)value; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size > 0); + assert(enc_size > 0); *size += (1 + enc_size); } /* end else */ - HDassert(enc_size < 256); + assert(enc_size < 256); if (NULL != *pp) { /* Encode the size */ @@ -929,13 +927,13 @@ H5P__decode_chunk_cache_nslots(const void **_pp, void *_value) /* Sanity check */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - HDassert(pp); - HDassert(*pp); - HDassert(value); + assert(pp); + assert(*pp); + assert(value); /* Decode the size */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); /* Determine if enc_size indicates that this is the default value, in which * case set value to H5D_ACS_DATA_CACHE_NUM_SLOTS_DEF and return */ @@ -974,7 +972,7 @@ H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size) /* Sanity checks */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - HDassert(size); + assert(size); /* Determine if this is the default value, in which case only encode * enc_size (as 255). Also set size needed for encoding. */ @@ -985,11 +983,11 @@ H5P__encode_chunk_cache_nbytes(const void *value, void **_pp, size_t *size) else { enc_value = (uint64_t) * (const size_t *)value; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size > 0); + assert(enc_size > 0); *size += (1 + enc_size); } /* end else */ - HDassert(enc_size < 256); + assert(enc_size < 256); if (NULL != *pp) { /* Encode the size */ @@ -1029,13 +1027,13 @@ H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value) /* Sanity check */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - HDassert(pp); - HDassert(*pp); - HDassert(value); + assert(pp); + assert(*pp); + assert(value); /* Decode the size */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); /* Determine if enc_size indicates that this is the default value, in which * case set value to H5D_ACS_DATA_CACHE_BYTE_SIZE_DEF and return */ @@ -1078,15 +1076,15 @@ H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view) /* Check argument */ if ((view != H5D_VDS_FIRST_MISSING) && (view != H5D_VDS_LAST_AVAILABLE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid bounds option") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid bounds option"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Update property list */ if (H5P_set(plist, H5D_ACS_VDS_VIEW_NAME, &view) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -1114,12 +1112,12 @@ H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value from property list */ if (view) if (H5P_get(plist, H5D_ACS_VDS_VIEW_NAME, view) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value) @@ -1144,8 +1142,8 @@ H5P__dacc_vds_view_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(view); - HDassert(size); + assert(view); + assert(size); if (NULL != *pp) /* Encode EDC property */ @@ -1176,9 +1174,9 @@ H5P__dacc_vds_view_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(view); + assert(pp); + assert(*pp); + assert(view); /* Decode EDC property */ *view = (H5D_vds_view_t) * (*pp)++; @@ -1220,15 +1218,15 @@ H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size) /* Check argument */ if (gap_size == HSIZE_UNDEF) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid printf gap size") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid printf gap size"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Update property list */ if (H5P_set(plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &gap_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -1257,12 +1255,12 @@ H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value from property list */ if (gap_size) if (H5P_get(plist, H5D_ACS_VDS_PRINTF_GAP_NAME, gap_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value) @@ -1297,37 +1295,37 @@ H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t *boundary, H5D /* Check arguments */ if (0 == ndims) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality cannot be zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality cannot be zero"); if (ndims > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality is too large") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality is too large"); if (!boundary) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no boundary dimensions specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no boundary dimensions specified"); /* Check if the callback function is NULL and the user data is non-NULL. * This is almost certainly an error as the user data will not be used. */ if (!func && udata) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set up values */ info.ndims = ndims; info.func = func; info.udata = udata; - HDmemset(info.boundary, 0, sizeof(info.boundary)); + memset(info.boundary, 0, sizeof(info.boundary)); /* boundary can be 0 to indicate no boundary is set */ for (u = 0; u < ndims; u++) { if (boundary[u] != (boundary[u] & 0xffffffff)) /* negative value (including H5S_UNLIMITED) */ - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all boundary dimensions must be less than 2^32") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all boundary dimensions must be less than 2^32"); info.boundary[u] = boundary[u]; /* Store user's boundary dimensions */ } /* end for */ /* Set values */ if (H5P_set(plist, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set append flush") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set append flush"); done: FUNC_LEAVE_API(ret_value) @@ -1359,15 +1357,15 @@ H5Pget_append_flush(hid_t plist_id, unsigned ndims, hsize_t boundary[], H5D_appe /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve info for append flush */ if (H5P_get(plist, H5D_ACS_APPEND_FLUSH_NAME, &info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object flush callback") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object flush callback"); /* Assign return values */ if (boundary) { - HDmemset(boundary, 0, ndims * sizeof(hsize_t)); + memset(boundary, 0, ndims * sizeof(hsize_t)); if (info.ndims > 0) for (u = 0; u < info.ndims && u < ndims; u++) boundary[u] = info.boundary[u]; @@ -1409,11 +1407,11 @@ H5Pset_efile_prefix(hid_t plist_id, const char *prefix) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set prefix */ if (H5P_set(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info"); done: FUNC_LEAVE_API(ret_value) @@ -1442,11 +1440,11 @@ H5Pget_efile_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the current prefix */ if (H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &my_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix"); /* Check for prefix being set */ if (my_prefix) { @@ -1497,11 +1495,11 @@ H5Pset_virtual_prefix(hid_t plist_id, const char *prefix) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set prefix */ if (H5P_set(plist, H5D_ACS_VDS_PREFIX_NAME, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info"); done: FUNC_LEAVE_API(ret_value) @@ -1532,11 +1530,11 @@ H5Pget_virtual_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the current prefix */ if (H5P_peek(plist, H5D_ACS_VDS_PREFIX_NAME, &my_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vds file prefix") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vds file prefix"); /* Check for prefix being set */ if (my_prefix) { diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pdcpl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pdcpl.c index fc9dd47c0e..5254f6db0d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pdcpl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pdcpl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -293,8 +292,6 @@ static const H5O_layout_t H5D_def_layout_virtual_g = H5D_DEF_LAYOUT_VIRTUAL; * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 31, 2006 *------------------------------------------------------------------------- */ static herr_t @@ -309,20 +306,20 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass) H5D_CRT_LAYOUT_SET, H5D_CRT_LAYOUT_GET, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC, H5D_CRT_LAYOUT_DEL, H5D_CRT_LAYOUT_COPY, H5D_CRT_LAYOUT_CMP, H5D_CRT_LAYOUT_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the fill value property */ if (H5P__register_real(pclass, H5D_CRT_FILL_VALUE_NAME, H5D_CRT_FILL_VALUE_SIZE, &H5D_def_fill_g, NULL, H5D_CRT_FILL_VALUE_SET, H5D_CRT_FILL_VALUE_GET, H5D_CRT_FILL_VALUE_ENC, H5D_CRT_FILL_VALUE_DEC, H5D_CRT_FILL_VALUE_DEL, H5D_CRT_FILL_VALUE_COPY, H5D_CRT_FILL_VALUE_CMP, H5D_CRT_FILL_VALUE_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the space allocation time state property */ if (H5P__register_real(pclass, H5D_CRT_ALLOC_TIME_STATE_NAME, H5D_CRT_ALLOC_TIME_STATE_SIZE, &H5D_def_alloc_time_state_g, NULL, NULL, NULL, H5D_CRT_ALLOC_TIME_STATE_ENC, H5D_CRT_ALLOC_TIME_STATE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the external file list property */ if (H5P__register_real(pclass, H5D_CRT_EXT_FILE_LIST_NAME, H5D_CRT_EXT_FILE_LIST_SIZE, &H5D_def_efl_g, @@ -330,13 +327,13 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass) H5D_CRT_EXT_FILE_LIST_ENC, H5D_CRT_EXT_FILE_LIST_DEC, H5D_CRT_EXT_FILE_LIST_DEL, H5D_CRT_EXT_FILE_LIST_COPY, H5D_CRT_EXT_FILE_LIST_CMP, H5D_CRT_EXT_FILE_LIST_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the object header minimization property */ if (H5P__register_real(pclass, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, H5D_CRT_MIN_DSET_HDR_SIZE_SIZE, &H5O_ohdr_min_g, NULL, NULL, NULL, H5D_CRT_MIN_DSET_HDR_SIZE_ENC, H5D_CRT_MIN_DSET_HDR_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -350,9 +347,6 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -366,11 +360,11 @@ H5P__dcrt_layout_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *na FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of layout */ if (NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout"); /* Copy new layout message over old one */ *layout = new_layout; @@ -387,9 +381,6 @@ H5P__dcrt_layout_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *na * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -403,11 +394,11 @@ H5P__dcrt_layout_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *na FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of layout */ if (NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout"); /* Copy new layout message over old one */ *layout = new_layout; @@ -426,9 +417,6 @@ H5P__dcrt_layout_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *na * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -444,8 +432,8 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(layout); - HDassert(size); + assert(layout); + assert(size); if (NULL != *pp) { /* Encode layout type */ @@ -461,7 +449,7 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) /* Encode chunk dims */ HDcompile_assert(sizeof(uint32_t) == sizeof(layout->u.chunk.dim[0])); for (u = 0; u < (size_t)layout->u.chunk.ndims; u++) { - UINT32ENCODE(*pp, layout->u.chunk.dim[u]) + UINT32ENCODE(*pp, layout->u.chunk.dim[u]); *size += sizeof(uint32_t); } /* end for */ } /* end if */ @@ -469,7 +457,7 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) uint64_t nentries = (uint64_t)layout->storage.u.virt.list_nused; /* Encode number of entries */ - UINT64ENCODE(*pp, nentries) + UINT64ENCODE(*pp, nentries); *size += (size_t)8; /* Iterate over entries */ @@ -493,14 +481,14 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) tmp_size = (size_t)-1; tmp_p = *pp; if (H5S_encode(layout->storage.u.virt.list[u].source_select, pp, &tmp_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection"); *size += (size_t)(*pp - tmp_p); /* Virtual dataset selection. Same notes as above apply. */ tmp_size = (size_t)-1; tmp_p = *pp; if (H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, pp, &tmp_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection"); *size += (size_t)(*pp - tmp_p); } /* end for */ } /* end if */ @@ -533,7 +521,7 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) tmp_size = (size_t)0; tmp_p = NULL; if (H5S_encode(layout->storage.u.virt.list[u].source_select, &tmp_p, &tmp_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize source selection"); *size += tmp_size; /* Virtual dataset selection */ @@ -541,7 +529,7 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) tmp_p = NULL; if (H5S_encode(layout->storage.u.virt.list[u].source_dset.virtual_select, &tmp_p, &tmp_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "unable to serialize virtual selection"); *size += tmp_size; } /* end for */ } /* end if */ @@ -561,9 +549,6 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -578,9 +563,9 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(value); + assert(pp); + assert(*pp); + assert(value); /* Decode layout type */ type = (H5D_layout_t) * (*pp)++; @@ -614,7 +599,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) /* Set rank & dimensions */ tmp_layout.u.chunk.ndims = (unsigned)ndims; for (u = 0; u < ndims; u++) - UINT32DECODE(*pp, tmp_layout.u.chunk.dim[u]) + UINT32DECODE(*pp, tmp_layout.u.chunk.dim[u]); /* Point at the newly set up struct */ layout = &tmp_layout; @@ -625,7 +610,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) uint64_t nentries; /* Number of VDS mappings */ /* Decode number of entries */ - UINT64DECODE(*pp, nentries) + UINT64DECODE(*pp, nentries); if (nentries == (uint64_t)0) /* Just use the default struct */ @@ -640,7 +625,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) /* Allocate entry list */ if (NULL == (tmp_layout.storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_calloc( (size_t)nentries * sizeof(H5O_storage_virtual_ent_t)))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate heap block") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate heap block"); tmp_layout.storage.u.virt.list_nalloc = (size_t)nentries; tmp_layout.storage.u.virt.list_nused = (size_t)nentries; @@ -651,7 +636,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) if (NULL == (tmp_layout.storage.u.virt.list[u].source_file_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, - "unable to allocate memory for source file name") + "unable to allocate memory for source file name"); H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_file_name, *pp, tmp_size); *pp += tmp_size; @@ -660,19 +645,19 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) if (NULL == (tmp_layout.storage.u.virt.list[u].source_dset_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, - "unable to allocate memory for source dataset name") + "unable to allocate memory for source dataset name"); H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_dset_name, *pp, tmp_size); *pp += tmp_size; /* Source selection */ if (NULL == (tmp_layout.storage.u.virt.list[u].source_select = H5S_decode(pp))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode source space selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode source space selection"); tmp_layout.storage.u.virt.list[u].source_space_status = H5O_VIRTUAL_STATUS_USER; /* Virtual selection */ if (NULL == (tmp_layout.storage.u.virt.list[u].source_dset.virtual_select = H5S_decode(pp))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode virtual space selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode virtual space selection"); tmp_layout.storage.u.virt.list[u].virtual_space_status = H5O_VIRTUAL_STATUS_USER; /* Parse source file and dataset names for "printf" @@ -682,13 +667,13 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) &tmp_layout.storage.u.virt.list[u].parsed_source_file_name, &tmp_layout.storage.u.virt.list[u].psfn_static_strlen, &tmp_layout.storage.u.virt.list[u].psfn_nsubs) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't parse source file name") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't parse source file name"); if (H5D_virtual_parse_source_name( tmp_layout.storage.u.virt.list[u].source_dset_name, &tmp_layout.storage.u.virt.list[u].parsed_source_dset_name, &tmp_layout.storage.u.virt.list[u].psdn_static_strlen, &tmp_layout.storage.u.virt.list[u].psdn_nsubs) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't parse source dataset name") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't parse source dataset name"); /* Set source names in source_dset struct */ if ((tmp_layout.storage.u.virt.list[u].psfn_nsubs == 0) && @@ -728,7 +713,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) /* Update min_dims */ if (H5D_virtual_update_min_dims(&tmp_layout, u) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, - "unable to update virtual dataset minimum dimensions") + "unable to update virtual dataset minimum dimensions"); } /* end for */ /* Point at the newly set up struct */ @@ -740,7 +725,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad layout type") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad layout type"); } /* end switch */ /* Set the value */ @@ -758,9 +743,6 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Tuesday, Feb 10, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -772,11 +754,11 @@ H5P__dcrt_layout_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *na FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Reset the old layout */ if (H5O_msg_reset(H5O_LAYOUT_ID, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -790,9 +772,6 @@ H5P__dcrt_layout_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *na * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Monday, Feb 9, 2015 - * *-------------------------------------------------------------------------- */ static herr_t @@ -804,11 +783,11 @@ H5P__dcrt_layout_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED siz FUNC_ENTER_PACKAGE - HDassert(layout); + assert(layout); /* Make copy of layout */ if (NULL == H5O_msg_copy(H5O_LAYOUT_ID, layout, &new_layout)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy layout"); /* Set new layout message directly into property list */ *layout = new_layout; @@ -828,9 +807,6 @@ H5P__dcrt_layout_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED siz * VALUE2 is greater than VALUE1 and zero if VALUE1 and * VALUE2 are equal. * - * Programmer: Quincey Koziol - * Tuesday, December 23, 2008 - * *------------------------------------------------------------------------- */ static int @@ -843,15 +819,15 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t H5_ATTR_ FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(layout1); - HDassert(layout2); - HDassert(size == sizeof(H5O_layout_t)); + assert(layout1); + assert(layout2); + assert(size == sizeof(H5O_layout_t)); /* Check for different layout type */ if (layout1->type < layout2->type) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (layout1->type > layout2->type) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Compare non-dataset-specific fields in layout info */ switch (layout1->type) { @@ -864,16 +840,16 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t H5_ATTR_ /* Check the number of dimensions */ if (layout1->u.chunk.ndims < layout2->u.chunk.ndims) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (layout1->u.chunk.ndims > layout2->u.chunk.ndims) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Compare the chunk dims */ for (u = 0; u < layout1->u.chunk.ndims - 1; u++) { if (layout1->u.chunk.dim[u] < layout2->u.chunk.dim[u]) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (layout1->u.chunk.dim[u] > layout2->u.chunk.dim[u]) - HGOTO_DONE(1) + HGOTO_DONE(1); } /* end for */ } /* end case */ break; @@ -885,9 +861,9 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t H5_ATTR_ /* Compare number of mappings */ if (layout1->storage.u.virt.list_nused < layout2->storage.u.virt.list_nused) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (layout1->storage.u.virt.list_nused > layout2->storage.u.virt.list_nused) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Iterate over mappings */ for (u = 0; u < layout1->storage.u.virt.list_nused; u++) { @@ -897,45 +873,45 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t H5_ATTR_ if ((equal = H5S_extent_equal(layout1->storage.u.virt.list[u].source_dset.virtual_select, layout2->storage.u.virt.list[u].source_dset.virtual_select)) < 0) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (!equal) - HGOTO_DONE(1) + HGOTO_DONE(1); if ((equal = H5S_SELECT_SHAPE_SAME( layout1->storage.u.virt.list[u].source_dset.virtual_select, layout2->storage.u.virt.list[u].source_dset.virtual_select)) < 0) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (!equal) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Compare source file names */ strcmp_ret = HDstrcmp(layout1->storage.u.virt.list[u].source_file_name, layout2->storage.u.virt.list[u].source_file_name); if (strcmp_ret < 0) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (strcmp_ret > 0) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Compare source dataset names */ strcmp_ret = HDstrcmp(layout1->storage.u.virt.list[u].source_dset_name, layout2->storage.u.virt.list[u].source_dset_name); if (strcmp_ret < 0) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (strcmp_ret > 0) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Compare source spaces. Note we cannot tell which is * "greater", so just return 1 if different, -1 on failure. */ if ((equal = H5S_extent_equal(layout1->storage.u.virt.list[u].source_select, layout2->storage.u.virt.list[u].source_select)) < 0) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (!equal) - HGOTO_DONE(1) + HGOTO_DONE(1); if ((equal = H5S_SELECT_SHAPE_SAME(layout1->storage.u.virt.list[u].source_select, layout2->storage.u.virt.list[u].source_select)) < 0) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (!equal) - HGOTO_DONE(1) + HGOTO_DONE(1); } /* end for */ } /* end block */ break; @@ -943,7 +919,7 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t H5_ATTR_ case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HDassert(0 && "Unknown layout type!"); + assert(0 && "Unknown layout type!"); } /* end switch */ done: @@ -958,9 +934,6 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, size_t H5_ATTR_ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Tuesday, Feb 10, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -971,11 +944,11 @@ H5P__dcrt_layout_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED si FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Reset the old layout */ if (H5O_msg_reset(H5O_LAYOUT_ID, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -989,9 +962,6 @@ H5P__dcrt_layout_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED si * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1005,11 +975,11 @@ H5P__dcrt_fill_value_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of fill value */ if (NULL == H5O_msg_copy(H5O_FILL_ID, fill, &new_fill)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value"); /* Copy new fill value message over old one */ *fill = new_fill; @@ -1026,9 +996,6 @@ H5P__dcrt_fill_value_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1042,11 +1009,11 @@ H5P__dcrt_fill_value_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of fill value */ if (NULL == H5O_msg_copy(H5O_FILL_ID, fill, &new_fill)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value"); /* Copy new fill value message over old one */ *fill = new_fill; @@ -1065,9 +1032,6 @@ H5P__dcrt_fill_value_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1085,8 +1049,8 @@ H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) /* Sanity check */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); HDcompile_assert(sizeof(ssize_t) <= sizeof(int64_t)); - HDassert(fill); - HDassert(size); + assert(fill); + assert(size); if (NULL != *pp) { /* Encode alloc and fill time */ @@ -1094,7 +1058,7 @@ H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) *(*pp)++ = (uint8_t)fill->fill_time; /* Encode size of fill value */ - INT64ENCODE(*pp, fill->size) + INT64ENCODE(*pp, fill->size); /* Encode the fill value & datatype */ if (fill->size > 0) { @@ -1103,15 +1067,15 @@ H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) *pp += fill->size; /* Encode fill value datatype */ - HDassert(fill->type); + assert(fill->type); if (H5T_encode(fill->type, NULL, &dt_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); /* Encode the size of a size_t */ enc_value = (uint64_t)dt_size; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); /* Encode the size */ *(*pp)++ = (uint8_t)enc_size; @@ -1120,7 +1084,7 @@ H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) UINT64ENCODE_VAR(*pp, enc_value, enc_size); if (H5T_encode(fill->type, *pp, &dt_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); *pp += dt_size; } /* end if */ } /* end if */ @@ -1135,9 +1099,9 @@ H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) /* calculate those if they were not calculated earlier */ if (NULL == *pp) { /* Get the size of the encoded datatype */ - HDassert(fill->type); + assert(fill->type); if (H5T_encode(fill->type, NULL, &dt_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); enc_value = (uint64_t)dt_size; enc_size = H5VM_limit_enc_size(enc_value); } @@ -1159,9 +1123,6 @@ H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1184,7 +1145,7 @@ H5P__dcrt_fill_value_dec(const void **_pp, void *_value) fill->fill_time = (H5D_fill_time_t) * (*pp)++; /* Decode fill size */ - INT64DECODE(*pp, fill->size) + INT64DECODE(*pp, fill->size); /* Check if there's a fill value */ if (fill->size > 0) { @@ -1194,12 +1155,12 @@ H5P__dcrt_fill_value_dec(const void **_pp, void *_value) /* Allocate fill buffer and copy the contents in it */ if (NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for fill value buffer") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for fill value buffer"); H5MM_memcpy((uint8_t *)fill->buf, *pp, (size_t)fill->size); *pp += fill->size; enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); /* Decode the size of encoded datatype */ UINT64DECODE_VAR(*pp, enc_value, enc_size); @@ -1207,7 +1168,7 @@ H5P__dcrt_fill_value_dec(const void **_pp, void *_value) /* Decode type */ if (NULL == (fill->type = H5T_decode(dt_size, *pp))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode fill value datatype") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode fill value datatype"); *pp += dt_size; } /* end if */ @@ -1223,9 +1184,6 @@ H5P__dcrt_fill_value_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Thursday, Feb 26, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1237,11 +1195,11 @@ H5P__dcrt_fill_value_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Reset the old fill value message */ if (H5O_msg_reset(H5O_FILL_ID, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release fill value message") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release fill value message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1255,9 +1213,6 @@ H5P__dcrt_fill_value_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Thursday, Feb 26, 2015 - * *-------------------------------------------------------------------------- */ static herr_t @@ -1269,11 +1224,11 @@ H5P__dcrt_fill_value_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED FUNC_ENTER_PACKAGE - HDassert(fill); + assert(fill); /* Make copy of fill value message */ if (NULL == H5O_msg_copy(H5O_FILL_ID, fill, &new_fill)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy fill value"); /* Set new fill value message directly into property list */ *fill = new_fill; @@ -1292,9 +1247,6 @@ H5P__dcrt_fill_value_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED * VALUE2 is greater than VALUE1 and zero if VALUE1 and * VALUE2 are equal. * - * Programmer: Quincey Koziol - * Wednesday, January 7, 2004 - * *------------------------------------------------------------------------- */ int @@ -1308,9 +1260,9 @@ H5P_fill_value_cmp(const void *_fill1, const void *_fill2, size_t H5_ATTR_UNUSED FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(fill1); - HDassert(fill2); - HDassert(size == sizeof(H5O_fill_t)); + assert(fill1); + assert(fill2); + assert(size == sizeof(H5O_fill_t)); /* Check the size of fill values */ if (fill1->size < fill2->size) @@ -1333,7 +1285,7 @@ H5P_fill_value_cmp(const void *_fill1, const void *_fill2, size_t H5_ATTR_UNUSED if (fill1->buf != NULL && fill2->buf == NULL) HGOTO_DONE(1); if (fill1->buf != NULL) - if ((cmp_value = HDmemcmp(fill1->buf, fill2->buf, (size_t)fill1->size)) != 0) + if ((cmp_value = memcmp(fill1->buf, fill2->buf, (size_t)fill1->size)) != 0) HGOTO_DONE(cmp_value); /* Check the allocation time for the fill values */ @@ -1360,9 +1312,6 @@ H5P_fill_value_cmp(const void *_fill1, const void *_fill2, size_t H5_ATTR_UNUSED * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Thursday, Feb 26, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1373,11 +1322,11 @@ H5P__dcrt_fill_value_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Reset the old fill value message */ if (H5O_msg_reset(H5O_FILL_ID, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release fill value message") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release fill value message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1391,9 +1340,6 @@ H5P__dcrt_fill_value_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1407,11 +1353,11 @@ H5P__dcrt_ext_file_list_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of external file list */ if (NULL == H5O_msg_copy(H5O_EFL_ID, efl, &new_efl)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list"); /* Copy new external file list message over old one */ *efl = new_efl; @@ -1428,9 +1374,6 @@ H5P__dcrt_ext_file_list_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1444,11 +1387,11 @@ H5P__dcrt_ext_file_list_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of external file list */ if (NULL == H5O_msg_copy(H5O_EFL_ID, efl, &new_efl)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list"); /* Copy new external file list message over old one */ *efl = new_efl; @@ -1467,9 +1410,6 @@ H5P__dcrt_ext_file_list_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1485,17 +1425,17 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(efl); + assert(efl); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); HDcompile_assert(sizeof(off_t) <= sizeof(uint64_t)); HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t)); - HDassert(size); + assert(size); if (NULL != *pp) { /* Encode number of slots used */ enc_value = (uint64_t)efl->nused; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -1505,7 +1445,7 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) len = HDstrlen(efl->slot[u].name) + 1; enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -1516,14 +1456,14 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) /* Encode offset */ enc_value = (uint64_t)efl->slot[u].offset; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); /* encode size */ enc_value = (uint64_t)efl->slot[u].size; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); } /* end for */ @@ -1552,9 +1492,6 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1570,9 +1507,9 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(pp); - HDassert(*pp); - HDassert(efl); + assert(pp); + assert(*pp); + assert(efl); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); HDcompile_assert(sizeof(off_t) <= sizeof(uint64_t)); HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t)); @@ -1582,7 +1519,7 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value) /* Decode number of slots used */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); nused = (size_t)enc_value; @@ -1593,7 +1530,7 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value) size_t na = efl->nalloc + H5O_EFL_ALLOC; H5O_efl_entry_t *x = (H5O_efl_entry_t *)H5MM_realloc(efl->slot, na * sizeof(H5O_efl_entry_t)); if (!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed"); efl->nalloc = na; efl->slot = x; @@ -1601,7 +1538,7 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value) /* Decode length of slot name */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); len = (size_t)enc_value; @@ -1611,13 +1548,13 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value) /* decode offset */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); efl->slot[u].offset = (off_t)enc_value; /* decode size */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); efl->slot[u].size = (hsize_t)enc_value; @@ -1637,9 +1574,6 @@ H5P__dcrt_ext_file_list_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Thursday, Feb 26, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1651,11 +1585,11 @@ H5P__dcrt_ext_file_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Reset the old efl message */ if (H5O_msg_reset(H5O_EFL_ID, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release external file list message") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release external file list message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1669,9 +1603,6 @@ H5P__dcrt_ext_file_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNU * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Thurday, Feb 26, 2015 - * *-------------------------------------------------------------------------- */ static herr_t @@ -1683,11 +1614,11 @@ H5P__dcrt_ext_file_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNU FUNC_ENTER_PACKAGE - HDassert(efl); + assert(efl); /* Make copy of efl message */ if (NULL == H5O_msg_copy(H5O_EFL_ID, efl, &new_efl)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy external file list"); /* Set new efl message directly into property list */ *efl = new_efl; @@ -1707,9 +1638,6 @@ H5P__dcrt_ext_file_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNU * VALUE2 is greater than VALUE1 and zero if VALUE1 and * VALUE2 are equal. * - * Programmer: Quincey Koziol - * Wednesday, January 7, 2004 - * *------------------------------------------------------------------------- */ static int @@ -1723,9 +1651,9 @@ H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t H5_ATTR FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(efl1); - HDassert(efl2); - HDassert(size == sizeof(H5O_efl_t)); + assert(efl1); + assert(efl2); + assert(size == sizeof(H5O_efl_t)); /* Check the number of allocated efl entries */ if (efl1->nalloc < efl2->nalloc) @@ -1790,9 +1718,6 @@ H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, size_t H5_ATTR * Return: Success: Non-negative * Failure: Negative * - * Programmer: Neil Fortner - * Thursday, Feb 26, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1803,11 +1728,11 @@ H5P__dcrt_ext_file_list_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UN FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Reset the old efl message */ if (H5O_msg_reset(H5O_EFL_ID, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release external file list message") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release external file list message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1820,9 +1745,6 @@ H5P__dcrt_ext_file_list_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UN * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 23, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -1835,7 +1757,7 @@ H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) /* Get the allocation time state */ if (H5P_get(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get space allocation time state") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get space allocation time state"); /* If we still have the "default" allocation time, change it according to the new layout */ if (alloc_time_state) { @@ -1843,7 +1765,7 @@ H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) /* Get current fill value info */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); /* Set the default based on layout */ switch (layout->type) { @@ -1863,17 +1785,17 @@ H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type"); } /* end switch */ /* Set updated fill value info */ if (H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time"); } /* end if */ /* Set layout value */ if (H5P_set(plist, H5D_CRT_LAYOUT_NAME, layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1886,9 +1808,6 @@ H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, January 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1903,11 +1822,11 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type) /* Check arguments */ if (layout_type < 0 || layout_type >= H5D_NLAYOUTS) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "raw data layout method is not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "raw data layout method is not valid"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get pointer to correct default layout */ switch (layout_type) { @@ -1930,12 +1849,12 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type"); } /* end switch */ /* Set value */ if (H5P__set_layout(plist, layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout"); done: FUNC_LEAVE_API(ret_value) @@ -1950,9 +1869,6 @@ H5Pset_layout(hid_t plist_id, H5D_layout_t layout_type) * * Failure: H5D_LAYOUT_ERROR (negative) * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ H5D_layout_t @@ -1967,11 +1883,11 @@ H5Pget_layout(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, H5D_LAYOUT_ERROR, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5D_LAYOUT_ERROR, "can't find object for ID"); /* Peek at layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_LAYOUT_ERROR, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5D_LAYOUT_ERROR, "can't get layout"); /* Set return value */ ret_value = layout.type; @@ -1992,9 +1908,6 @@ H5Pget_layout(hid_t plist_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, January 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2011,35 +1924,35 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) /* Check arguments */ if (ndims <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality must be positive"); if (ndims > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality is too large") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk dimensionality is too large"); if (!dim) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no chunk dimensions specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no chunk dimensions specified"); /* Verify & initialize property's chunk dims */ H5MM_memcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g)); - HDmemset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim)); + memset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim)); chunk_nelmts = 1; for (u = 0; u < (unsigned)ndims; u++) { if (dim[u] == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive"); if (dim[u] != (dim[u] & 0xffffffff)) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be less than 2^32") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be less than 2^32"); chunk_nelmts *= dim[u]; if (chunk_nelmts > (uint64_t)0xffffffff) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "number of elements in chunk must be < 4GB") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "number of elements in chunk must be < 4GB"); chunk_layout.u.chunk.dim[u] = (uint32_t)dim[u]; /* Store user's chunk dimensions */ } /* end for */ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set chunk information in property list */ chunk_layout.u.chunk.ndims = (unsigned)ndims; if (H5P__set_layout(plist, &chunk_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout"); done: FUNC_LEAVE_API(ret_value) @@ -2057,9 +1970,6 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ int @@ -2074,13 +1984,13 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[] /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Peek at the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout"); if (H5D_CHUNKED != layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout"); if (dim) { unsigned u; /* Local index variable */ @@ -2112,9 +2022,6 @@ H5Pget_chunk(hid_t plist_id, int max_ndims, hsize_t dim[] /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Friday, February 13, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -2136,25 +2043,25 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const /* Check arguments */ if (!src_file_name) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "source file name not provided") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "source file name not provided"); if (!src_dset_name) - HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "source dataset name not provided") + HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "source dataset name not provided"); if (NULL == (vspace = (H5S_t *)H5I_object_verify(vspace_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataspace"); if (NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dataspace"); /* Check selections for validity */ if (H5D_virtual_check_mapping_pre(vspace, src_space, H5O_VIRTUAL_STATUS_USER) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "invalid mapping selections") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "invalid mapping selections"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the current layout */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &virtual_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout"); retrieved_layout = TRUE; /* If the layout was not already virtual, Start with default virtual layout. @@ -2165,13 +2072,13 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const else { /* Reset the old layout */ if (H5O_msg_reset(H5O_LAYOUT_ID, &virtual_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message"); /* Copy the default virtual layout */ H5MM_memcpy(&virtual_layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g)); /* Sanity check */ - HDassert(virtual_layout.storage.u.virt.list_nalloc == 0); + assert(virtual_layout.storage.u.virt.list_nalloc == 0); } /* end else */ /* Expand list if necessary */ @@ -2182,28 +2089,28 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const /* Expand size of entry list */ if (NULL == (x = (H5O_storage_virtual_ent_t *)H5MM_realloc( virtual_layout.storage.u.virt.list, new_alloc * sizeof(H5O_storage_virtual_ent_t)))) - HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't reallocate virtual dataset mapping list") + HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't reallocate virtual dataset mapping list"); virtual_layout.storage.u.virt.list = x; virtual_layout.storage.u.virt.list_nalloc = new_alloc; } /* end if */ /* Add virtual dataset mapping entry */ ent = &virtual_layout.storage.u.virt.list[virtual_layout.storage.u.virt.list_nused]; - HDmemset(ent, 0, sizeof(H5O_storage_virtual_ent_t)); /* Clear before starting to set up */ + memset(ent, 0, sizeof(H5O_storage_virtual_ent_t)); /* Clear before starting to set up */ if (NULL == (ent->source_dset.virtual_select = H5S_copy(vspace, FALSE, TRUE))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection"); if (NULL == (ent->source_file_name = H5MM_xstrdup(src_file_name))) - HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name") + HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name"); if (NULL == (ent->source_dset_name = H5MM_xstrdup(src_dset_name))) - HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name") + HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name"); if (NULL == (ent->source_select = H5S_copy(src_space, FALSE, TRUE))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy source selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy source selection"); if (H5D_virtual_parse_source_name(ent->source_file_name, &ent->parsed_source_file_name, &ent->psfn_static_strlen, &ent->psfn_nsubs) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't parse source file name") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't parse source file name"); if (H5D_virtual_parse_source_name(ent->source_dset_name, &ent->parsed_source_dset_name, &ent->psdn_static_strlen, &ent->psdn_nsubs) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't parse source dataset name") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't parse source dataset name"); if ((ent->psfn_nsubs == 0) && (ent->psdn_nsubs == 0)) { if (ent->parsed_source_file_name) ent->source_dset.file_name = ent->parsed_source_file_name->name_segment; @@ -2229,11 +2136,11 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const /* Check entry for validity */ if (H5D_virtual_check_mapping_post(ent) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid mapping entry") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid mapping entry"); /* Update min_dims */ if (H5D_virtual_update_min_dims(&virtual_layout, virtual_layout.storage.u.virt.list_nused) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to update virtual dataset minimum dimensions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to update virtual dataset minimum dimensions"); /* Finish adding entry */ virtual_layout.storage.u.virt.list_nused++; @@ -2243,7 +2150,7 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const /* (Even on failure, so there's not a mangled layout struct in the list) */ if (retrieved_layout) { if (H5P_poke(plist, H5D_CRT_LAYOUT_NAME, &virtual_layout) < 0) { - HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout") + HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout"); if (old_list != virtual_layout.storage.u.virt.list) free_list = TRUE; } /* end if */ @@ -2257,10 +2164,10 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const ent->source_file_name = (char *)H5MM_xfree(ent->source_file_name); ent->source_dset_name = (char *)H5MM_xfree(ent->source_dset_name); if (ent->source_dset.virtual_select && H5S_close(ent->source_dset.virtual_select) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release virtual selection") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release virtual selection"); ent->source_dset.virtual_select = NULL; if (ent->source_select && H5S_close(ent->source_select) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection"); ent->source_select = NULL; H5D_virtual_free_parsed_name(ent->parsed_source_file_name); ent->parsed_source_file_name = NULL; @@ -2286,9 +2193,6 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, const * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Friday, February 13, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -2304,13 +2208,13 @@ H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/) if (count) { /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout"); if (H5D_VIRTUAL != layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout"); /* Return the number of mappings */ *count = layout.storage.u.virt.list_nused; @@ -2331,9 +2235,6 @@ H5Pget_virtual_count(hid_t dcpl_id, size_t *count /*out*/) * Return: Returns a dataspace identifier if successful; otherwise * returns a negative value. * - * Programmer: Neil Fortner - * Friday, February 13, 2015 - * *------------------------------------------------------------------------- */ hid_t @@ -2349,30 +2250,30 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t idx) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout"); if (H5D_VIRTUAL != layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout"); /* Get the virtual space */ if (idx >= layout.storage.u.virt.list_nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)") - HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)"); + assert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); if (NULL == (space = H5S_copy(layout.storage.u.virt.list[idx].source_dset.virtual_select, FALSE, TRUE))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection"); /* Register ID */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace"); done: /* Free space on failure */ if ((ret_value < 0) && space) if (H5S_close(space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection"); FUNC_LEAVE_API(ret_value) } /* end H5Pget_virtual_vspace() */ @@ -2388,9 +2289,6 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t idx) * Return: Returns a dataspace identifier if successful; otherwise * returns a negative value. * - * Programmer: Neil Fortner - * Saturday, February 14, 2015 - * *------------------------------------------------------------------------- */ hid_t @@ -2406,18 +2304,18 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout"); if (H5D_VIRTUAL != layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout"); /* Check index */ if (idx >= layout.storage.u.virt.list_nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)") - HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)"); + assert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); /* Attempt to open source dataset and patch extent if extent status is not * H5O_VIRTUAL_STATUS_CORRECT? -NAF */ @@ -2432,11 +2330,11 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx) /* Get rank of source space */ if ((rank = H5S_GET_EXTENT_NDIMS(layout.storage.u.virt.list[idx].source_select)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get source space rank") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get source space rank"); /* Get bounds of selection */ if (H5S_SELECT_BOUNDS(layout.storage.u.virt.list[idx].source_select, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get selection bounds") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get selection bounds"); /* Adjust bounds to extent */ for (i = 0; i < rank; i++) @@ -2445,7 +2343,7 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx) /* Set extent */ if (H5S_set_extent_simple(layout.storage.u.virt.list[idx].source_select, (unsigned)rank, bounds_end, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set source space extent") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set source space extent"); /* Update source space status */ layout.storage.u.virt.list[idx].source_space_status = H5O_VIRTUAL_STATUS_SEL_BOUNDS; @@ -2453,17 +2351,17 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx) /* Get the source space */ if (NULL == (space = H5S_copy(layout.storage.u.virt.list[idx].source_select, FALSE, TRUE))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy source selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy source selection"); /* Register ID */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace"); done: /* Free space on failure */ if ((ret_value < 0) && space) if (H5S_close(space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection"); FUNC_LEAVE_API(ret_value) } /* end H5Pget_virtual_srcspace() */ @@ -2492,9 +2390,6 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t idx) * Return: Returns the length of the name if successful, otherwise * returns a negative value. * - * Programmer: Neil Fortner - * Saturday, February 14, 2015 - * *------------------------------------------------------------------------- */ ssize_t @@ -2509,19 +2404,19 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout"); if (H5D_VIRTUAL != layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout"); /* Get the virtual filename */ if (idx >= layout.storage.u.virt.list_nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)") - HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); - HDassert(layout.storage.u.virt.list[idx].source_file_name); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)"); + assert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); + assert(layout.storage.u.virt.list[idx].source_file_name); if (name && (size > 0)) (void)HDstrncpy(name, layout.storage.u.virt.list[idx].source_file_name, size); ret_value = (ssize_t)HDstrlen(layout.storage.u.virt.list[idx].source_file_name); @@ -2553,9 +2448,6 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si * Return: Returns the length of the name if successful, otherwise * returns a negative value. * - * Programmer: Neil Fortner - * Saturday, February 14, 2015 - * *------------------------------------------------------------------------- */ ssize_t @@ -2570,19 +2462,19 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout"); if (H5D_VIRTUAL != layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout"); /* Get the virtual filename */ if (idx >= layout.storage.u.virt.list_nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)") - HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); - HDassert(layout.storage.u.virt.list[idx].source_dset_name); + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)"); + assert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc); + assert(layout.storage.u.virt.list[idx].source_dset_name); if (name && (size > 0)) (void)HDstrncpy(name, layout.storage.u.virt.list[idx].source_dset_name, size); ret_value = (ssize_t)HDstrlen(layout.storage.u.virt.list[idx].source_dset_name); @@ -2599,9 +2491,6 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t idx, char *name /*out*/, size_t si * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Thursday, January 21, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -2617,17 +2506,17 @@ H5Pset_chunk_opts(hid_t plist_id, unsigned options) /* Check arguments */ if (options & ~(H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unknown chunk options") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unknown chunk options"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout"); if (H5D_CHUNKED != layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout"); /* Translate options into flags that can be used with the layout message */ if (options & H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) @@ -2642,7 +2531,7 @@ H5Pset_chunk_opts(hid_t plist_id, unsigned options) /* Set layout value */ if (H5P_poke(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout"); done: FUNC_LEAVE_API(ret_value) @@ -2655,9 +2544,6 @@ H5Pset_chunk_opts(hid_t plist_id, unsigned options) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Friday, January 22, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -2672,13 +2558,13 @@ H5Pget_chunk_opts(hid_t plist_id, unsigned *options /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve the layout property */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout"); if (H5D_CHUNKED != layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout"); if (options) { /* Translate options from flags that can be used with the layout message @@ -2710,9 +2596,6 @@ H5Pget_chunk_opts(hid_t plist_id, unsigned *options /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, March 3, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2729,24 +2612,24 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); if (offset < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "negative external file offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "negative external file offset"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list"); if (efl.nused > 0 && H5O_EFL_UNLIMITED == efl.slot[efl.nused - 1].size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "previous file size is unlimited") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "previous file size is unlimited"); if (H5O_EFL_UNLIMITED != size) { for (idx = 0, total = size; idx < efl.nused; idx++, total = tmp) { tmp = total + efl.slot[idx].size; if (tmp <= total) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "total external data size overflowed") + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "total external data size overflowed"); } /* end for */ } /* end if */ @@ -2756,7 +2639,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) H5O_efl_entry_t *x = (H5O_efl_entry_t *)H5MM_realloc(efl.slot, na * sizeof(H5O_efl_entry_t)); if (!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed"); efl.nalloc = na; efl.slot = x; } /* end if */ @@ -2768,7 +2651,7 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) efl.nused++; if (H5P_poke(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list"); done: FUNC_LEAVE_API(ret_value) @@ -2783,9 +2666,6 @@ H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size) * * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, March 3, 1998 - * *------------------------------------------------------------------------- */ int @@ -2800,11 +2680,11 @@ H5Pget_external_count(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list"); /* Set return value */ ret_value = (int)efl.nused; @@ -2832,9 +2712,6 @@ H5Pget_external_count(hid_t plist_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, March 3, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2850,14 +2727,14 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list"); if (idx >= efl.nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "external file index is out of range"); /* Return values */ if (name_size > 0 && name) @@ -2891,9 +2768,6 @@ H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name /*out * * Return: Non-negative on success/Negative on failure * - * Programmer: Kent Yang - * Tuesday, April 1, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -2909,20 +2783,20 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block) H5TRACE3("e", "iIuIu", plist_id, options_mask, pixels_per_block); if (H5Z_get_filter_info(H5Z_FILTER_SZIP, &config_flags) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't get filter info") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't get filter info"); if (!(config_flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED)) - HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled.") + HGOTO_ERROR(H5E_PLINE, H5E_NOENCODER, FAIL, "Filter present but encoding is disabled."); /* Check arguments */ if ((pixels_per_block % 2) == 1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is not even") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is not even"); if (pixels_per_block > H5_SZIP_MAX_PIXELS_PER_BLOCK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is too large") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "pixels_per_block is too large"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Always set K13 compression (and un-set CHIP compression) */ options_mask &= (unsigned)(~H5_SZIP_CHIP_OPTION_MASK); @@ -2941,11 +2815,11 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block) /* Add the filter */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); if (H5Z_append(&pline, H5Z_FILTER_SZIP, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add szip filter to pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add szip filter to pipeline"); if (H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline"); done: FUNC_LEAVE_API(ret_value) @@ -2960,9 +2834,6 @@ H5Pset_szip(hid_t plist_id, unsigned options_mask, unsigned pixels_per_block) * * Return: Non-negative on success/Negative on failure * - * Programmer: Kent Yang - * Wednesday, November 13, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -2977,19 +2848,19 @@ H5Pset_shuffle(hid_t plist_id) /* Check arguments */ if (TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Add the filter */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); if (H5Z_append(&pline, H5Z_FILTER_SHUFFLE, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to shuffle the data") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to shuffle the data"); if (H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline"); done: FUNC_LEAVE_API(ret_value) @@ -3002,9 +2873,6 @@ H5Pset_shuffle(hid_t plist_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Xiaowen Wu - * Wednesday, December 22, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -3019,19 +2887,19 @@ H5Pset_nbit(hid_t plist_id) /* Check arguments */ if (TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Add the nbit filter */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); if (H5Z_append(&pline, H5Z_FILTER_NBIT, H5Z_FLAG_OPTIONAL, (size_t)0, NULL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add nbit filter to pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add nbit filter to pipeline"); if (H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline"); done: FUNC_LEAVE_API(ret_value) @@ -3060,9 +2928,6 @@ H5Pset_nbit(hid_t plist_id) * Return: Non-negative on success/Negative on failure * - * Programmer: Xiaowen Wu - * Thursday, April 14, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -3078,16 +2943,16 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac /* Check arguments */ if (TRUE != H5P_isa_class(plist_id, H5P_DATASET_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list"); if (scale_factor < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "scale factor must be >= 0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "scale factor must be >= 0"); if (scale_type != H5Z_SO_FLOAT_DSCALE && scale_type != H5Z_SO_FLOAT_ESCALE && scale_type != H5Z_SO_INT) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid scale type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid scale type"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set parameters for the filter * scale_type = 0: floating-point type, filter uses variable-minimum-bits method, @@ -3102,11 +2967,11 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac /* Add the scaleoffset filter */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); if (H5Z_append(&pline, H5Z_FILTER_SCALEOFFSET, H5Z_FLAG_OPTIONAL, (size_t)2, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add scaleoffset filter to pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add scaleoffset filter to pipeline"); if (H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to set pipeline"); done: FUNC_LEAVE_API(ret_value) @@ -3124,9 +2989,6 @@ H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type, int scale_fac * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, October 1, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -3141,11 +3003,11 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the current fill value */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); /* Release the dynamic fill value components */ H5O_fill_reset_dyn(&fill); @@ -3156,20 +3018,20 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) /* Retrieve pointer to datatype */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Set the fill value */ if (NULL == (fill.type = H5T_copy(type, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy datatype") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy datatype"); fill.size = (ssize_t)H5T_get_size(type); if (NULL == (fill.buf = H5MM_malloc((size_t)fill.size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value"); H5MM_memcpy(fill.buf, value, (size_t)fill.size); /* Set up type conversion function */ if (NULL == (tpath = H5T_path_find(type, type))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, - "unable to convert between src and dest data types") + "unable to convert between src and dest data types"); /* If necessary, convert fill value datatypes (which copies VL components, etc.) */ if (!H5T_path_noop(tpath)) { @@ -3177,14 +3039,14 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) /* Allocate a background buffer */ if (H5T_path_bkg(tpath) && NULL == (bkg_buf = H5FL_BLK_CALLOC(type_conv, (size_t)fill.size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Convert the fill value */ if (H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf) < 0) { if (bkg_buf) bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); - HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); } /* end if */ /* Release the background buffer */ @@ -3197,7 +3059,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) /* Update fill value in property list */ if (H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set fill value"); done: FUNC_LEAVE_API(ret_value) @@ -3214,9 +3076,6 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, October 17, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -3239,13 +3098,13 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value /*out*/ * is undefined, also return error. */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); if (fill.size == -1) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "fill value is undefined") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "fill value is undefined"); /* Check for "default" fill value */ if (fill.size == 0) { - HDmemset(value, 0, H5T_get_size(type)); + memset(value, 0, H5T_get_size(type)); HGOTO_DONE(SUCCEED); } /* end if */ @@ -3253,9 +3112,9 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value /*out*/ * Can we convert between the source and destination datatypes? */ if (NULL == (tpath = H5T_path_find(fill.type, type))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to convert between src and dst datatypes"); if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(fill.type, H5T_COPY_TRANSIENT), FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy/register datatype") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy/register datatype"); /* * Data type conversions are always done in place, so we need a buffer @@ -3265,21 +3124,21 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value /*out*/ if (H5T_get_size(type) >= H5T_get_size(fill.type)) { buf = value; if (H5T_path_bkg(tpath) && NULL == (bkg = H5MM_calloc(H5T_get_size(type)))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion"); } /* end if */ else { if (NULL == (buf = H5MM_calloc(H5T_get_size(fill.type)))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion"); if (H5T_path_bkg(tpath) && NULL == (bkg = H5MM_calloc(H5T_get_size(fill.type)))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion"); } /* end else */ H5MM_memcpy(buf, fill.buf, H5T_get_size(fill.type)); /* Do the conversion */ if ((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_ALL), FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy/register datatype") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy/register datatype"); if (H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "datatype conversion failed"); if (buf != value) H5MM_memcpy(value, buf, H5T_get_size(type)); @@ -3289,9 +3148,9 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value /*out*/ if (bkg != value) H5MM_xfree(bkg); if (src_id >= 0 && H5I_dec_ref(src_id) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID") + HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID"); if (dst_id >= 0 && H5I_dec_ref(dst_id) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID") + HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_get_fill_value() */ @@ -3307,9 +3166,6 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value /*out*/ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, October 1, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -3324,17 +3180,17 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value /*out*/) /* Check arguments */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (!value) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no fill value output buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no fill value output buffer"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the fill value */ if (H5P_get_fill_value(plist, type, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); done: FUNC_LEAVE_API(ret_value) @@ -3347,9 +3203,6 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, January 16, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -3359,8 +3212,8 @@ H5P_is_fill_value_defined(const H5O_fill_t *fill, H5D_fill_value_t *status) FUNC_ENTER_NOAPI(FAIL) - HDassert(fill); - HDassert(status); + assert(fill); + assert(status); /* Check if the fill value was "unset" */ if (fill->size == -1 && !fill->buf) @@ -3373,7 +3226,7 @@ H5P_is_fill_value_defined(const H5O_fill_t *fill, H5D_fill_value_t *status) *status = H5D_FILL_VALUE_USER_DEFINED; else { *status = H5D_FILL_VALUE_ERROR; - HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "invalid combination of fill-value info") + HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "invalid combination of fill-value info"); } /* end else */ done: @@ -3387,9 +3240,6 @@ H5P_is_fill_value_defined(const H5O_fill_t *fill, H5D_fill_value_t *status) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, October 17, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -3400,15 +3250,15 @@ H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status) FUNC_ENTER_NOAPI(FAIL) - HDassert(status); + assert(status); /* Get the fill value struct */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); /* Get the fill-value status */ if (H5P_is_fill_value_defined(&fill, status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3421,9 +3271,6 @@ H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, January 16, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -3435,15 +3282,15 @@ H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*DF", plist_id, status); - HDassert(status); + assert(status); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the fill-value status */ if (H5P_fill_value_defined(plist, status) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't check fill value status"); done: FUNC_LEAVE_API(ret_value) @@ -3458,9 +3305,6 @@ H5Pfill_value_defined(hid_t plist_id, H5D_fill_value_t *status) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, January 16, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -3476,11 +3320,11 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time) /* Check arguments */ if (alloc_time < H5D_ALLOC_TIME_DEFAULT || alloc_time > H5D_ALLOC_TIME_INCR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid allocation time setting") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid allocation time setting"); /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Check for resetting to default for layout type */ if (alloc_time == H5D_ALLOC_TIME_DEFAULT) { @@ -3488,7 +3332,7 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time) /* Peek at the storage layout */ if (H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout"); /* Set the default based on layout */ switch (layout.type) { @@ -3511,7 +3355,7 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time) case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: default: - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown layout type"); } /* end switch */ /* Reset the "state" of the allocation time property back to the "default" */ @@ -3523,16 +3367,16 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time) /* Retrieve previous fill value settings */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); /* Update property value */ fill.alloc_time = alloc_time; /* Set values */ if (H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value"); if (H5P_set(plist, H5D_CRT_ALLOC_TIME_STATE_NAME, &alloc_time_state) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set space allocation time"); done: FUNC_LEAVE_API(ret_value) @@ -3547,9 +3391,6 @@ H5Pset_alloc_time(hid_t plist_id, H5D_alloc_time_t alloc_time) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, January 16, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -3567,11 +3408,11 @@ H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time /*out*/) /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve fill value settings */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); /* Set user's value */ *alloc_time = fill.alloc_time; @@ -3589,9 +3430,6 @@ H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t *alloc_time /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, January 16, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -3606,22 +3444,22 @@ H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time) /* Check arguments */ if (fill_time < H5D_FILL_TIME_ALLOC || fill_time > H5D_FILL_TIME_IFSET) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fill time setting") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fill time setting"); /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve previous fill value settings */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); /* Update property value */ fill.fill_time = fill_time; /* Set values */ if (H5P_poke(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value"); done: FUNC_LEAVE_API(ret_value) @@ -3635,9 +3473,6 @@ H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, January 16, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -3655,11 +3490,11 @@ H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time /*out*/) /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve fill value settings */ if (H5P_peek(plist, H5D_CRT_FILL_VALUE_NAME, &fill) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value"); /* Set user's value */ *fill_time = fill.fill_time; @@ -3682,9 +3517,6 @@ H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t *fill_time /*out*/) * Failure: Negative value (FAIL) * Success: Non-negative value (SUCCEED) * - * Programmer: Jacob Smith - * 2018 August 14 - * *----------------------------------------------------------------------------- */ herr_t @@ -3698,14 +3530,14 @@ H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize /*out*/) H5TRACE2("e", "ix", dcpl_id, minimize); if (NULL == minimize) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "receiving pointer cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "receiving pointer cannot be NULL"); plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE); if (NULL == plist) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &setting) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dset oh minimize flag value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dset oh minimize flag value"); *minimize = setting; @@ -3726,9 +3558,6 @@ H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize /*out*/) * Failure: Negative value (FAIL) * Success: Non-negative value (SUCCEED) * - * Programmer: Jacob Smith - * 2018 August 14 - * *----------------------------------------------------------------------------- */ herr_t @@ -3743,13 +3572,13 @@ H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize) plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE); if (NULL == plist) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &prev_set) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get extant dset oh minimize flag value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get extant dset oh minimize flag value"); if (H5P_poke(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &minimize) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get dset oh minimize flag value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get dset oh minimize flag value"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pdeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pdeprec.c index 90c6c5d2f1..5c4e9629b5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pdeprec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pdeprec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pdeprec.c - * October 11 2007 - * Quincey Koziol * * Purpose: Deprecated functions from the H5P interface. These * functions are here for compatibility purposes and may be @@ -243,13 +240,13 @@ H5Pregister1(hid_t cls_id, const char *name, size_t size, void *def_value, H5P_p /* Substitute the new property class in the ID */ if (NULL == (old_pclass = (H5P_genclass_t *)H5I_subst(cls_id, pclass))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to substitute property class in ID") - HDassert(old_pclass == orig_pclass); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to substitute property class in ID"); + assert(old_pclass == orig_pclass); /* Close the previous class */ if (H5P__close_class(orig_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, - "unable to close original property class after substitution") + "unable to close original property class after substitution"); } /* end if */ done: @@ -409,16 +406,16 @@ H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_s /* Check arguments. */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid property name"); if (size > 0 && value == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "properties >0 size must have default"); /* Create the new property list class */ if ((ret_value = H5P_insert(plist, name, size, value, prp_set, prp_get, NULL, NULL, prp_delete, prp_copy, NULL, prp_close)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to register property in plist"); done: FUNC_LEAVE_API(ret_value) @@ -442,9 +439,6 @@ H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value, H5P_prp_s * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -459,12 +453,12 @@ H5Pget_version(hid_t plist_id, unsigned *super /*out*/, unsigned *freelist /*out /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (super) if (H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, super) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get superblock version") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get superblock version"); if (freelist) *freelist = HDF5_FREESPACE_VERSION; /* (hard-wired) */ if (stab) @@ -513,7 +507,7 @@ H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc) /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&temp_fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* Call the internal encode routine */ if ((ret_value = H5P__encode(plist, TRUE, buf, nalloc)) < 0) @@ -530,7 +524,6 @@ H5Pencode1(hid_t plist_id, void *buf, size_t *nalloc) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Jan 2017 *------------------------------------------------------------------------- */ herr_t @@ -548,7 +541,7 @@ H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t thresh H5TRACE3("e", "iFth", plist_id, strategy, threshold); if ((unsigned)in_strategy >= H5F_FILE_SPACE_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid strategy") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid strategy"); /* * For 1.10.0 H5Pset_file_space: * If strategy is zero, the property is not changed; @@ -584,11 +577,11 @@ H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t thresh case H5F_FILE_SPACE_NTYPES: case H5F_FILE_SPACE_DEFAULT: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file space strategy") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file space strategy"); } if (H5Pset_file_space_strategy(plist_id, new_strategy, new_persist, new_threshold) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file space strategy") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file space strategy"); done: FUNC_LEAVE_API(ret_value) @@ -601,8 +594,6 @@ H5Pset_file_space(hid_t plist_id, H5F_file_space_type_t strategy, hsize_t thresh * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Jan 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -618,7 +609,7 @@ H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy /*out*/, hsize /* Get current file space info */ if (H5Pget_file_space_strategy(plist_id, &new_strategy, &new_persist, &new_threshold) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space strategy") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space strategy"); /* Get value(s) */ if (strategy) { @@ -642,7 +633,7 @@ H5Pget_file_space(hid_t plist_id, H5F_file_space_type_t *strategy /*out*/, hsize case H5F_FSPACE_STRATEGY_PAGE: case H5F_FSPACE_STRATEGY_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file space strategy") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file space strategy"); } } diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pdxpl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pdxpl.c index dd1f632399..6babaf92da 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pdxpl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pdxpl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pdxpl.c - * March 16 1998 - * Robb Matzke * * Purpose: Data transfer property list class routines * @@ -31,14 +28,15 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Cache */ -#include "H5Dprivate.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FDprivate.h" /* File drivers */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Cache */ +#include "H5Dprivate.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* File drivers */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5VMprivate.h" /* Vector Functions */ /****************/ /* Local Macros */ @@ -169,6 +167,19 @@ #define H5D_XFER_DSET_IO_SEL_ENC H5P__dxfr_edc_enc #define H5D_XFER_DSET_IO_SEL_DEC H5P__dxfr_edc_dec #endif /* QAK */ +/* Definition for selection I/O mode property */ +#define H5D_XFER_SELECTION_IO_MODE_SIZE sizeof(H5D_selection_io_mode_t) +#define H5D_XFER_SELECTION_IO_MODE_DEF H5D_SELECTION_IO_MODE_DEFAULT +#define H5D_XFER_SELECTION_IO_MODE_ENC H5P__dxfr_selection_io_mode_enc +#define H5D_XFER_SELECTION_IO_MODE_DEC H5P__dxfr_selection_io_mode_dec +/* Definitions for cause of no selection I/O property */ +#define H5D_XFER_NO_SELECTION_IO_CAUSE_SIZE sizeof(uint32_t) +#define H5D_XFER_NO_SELECTION_IO_CAUSE_DEF 0 +/* Definitions for modify write buffer property */ +#define H5D_XFER_MODIFY_WRITE_BUF_SIZE sizeof(hbool_t) +#define H5D_XFER_MODIFY_WRITE_BUF_DEF FALSE +#define H5D_XFER_MODIFY_WRITE_BUF_ENC H5P__dxfr_modify_write_buf_enc +#define H5D_XFER_MODIFY_WRITE_BUF_DEC H5P__dxfr_modify_write_buf_dec /******************/ /* Local Typedefs */ @@ -209,6 +220,10 @@ static herr_t H5P__dxfr_xform_close(const char *name, size_t size, void *value); static herr_t H5P__dxfr_dset_io_hyp_sel_copy(const char *name, size_t size, void *value); static int H5P__dxfr_dset_io_hyp_sel_cmp(const void *value1, const void *value2, size_t size); static herr_t H5P__dxfr_dset_io_hyp_sel_close(const char *name, size_t size, void *value); +static herr_t H5P__dxfr_selection_io_mode_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_selection_io_mode_dec(const void **pp, void *value); +static herr_t H5P__dxfr_modify_write_buf_enc(const void *value, void **pp, size_t *size); +static herr_t H5P__dxfr_modify_write_buf_dec(const void **pp, void *value); /*********************/ /* Package Variables */ @@ -278,6 +293,9 @@ static const H5T_conv_cb_t H5D_def_conv_cb_g = static const void *H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */ static const H5S_t *H5D_def_dset_io_sel_g = H5D_XFER_DSET_IO_SEL_DEF; /* Default value for dataset I/O selection */ +static const H5D_selection_io_mode_t H5D_def_selection_io_mode_g = H5D_XFER_SELECTION_IO_MODE_DEF; +static const uint32_t H5D_def_no_selection_io_cause_g = H5D_XFER_NO_SELECTION_IO_CAUSE_DEF; +static const hbool_t H5D_def_modify_write_buf_g = H5D_XFER_MODIFY_WRITE_BUF_DEF; /*------------------------------------------------------------------------- * Function: H5P__dxfr_reg_prop @@ -286,8 +304,6 @@ static const H5S_t *H5D_def_dset_io_sel_g = * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 31, 2006 *------------------------------------------------------------------------- */ static herr_t @@ -301,146 +317,164 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) if (H5P__register_real(pclass, H5D_XFER_MAX_TEMP_BUF_NAME, H5D_XFER_MAX_TEMP_BUF_SIZE, &H5D_def_max_temp_buf_g, NULL, NULL, NULL, H5D_XFER_MAX_TEMP_BUF_ENC, H5D_XFER_MAX_TEMP_BUF_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the type conversion buffer property */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_XFER_TCONV_BUF_NAME, H5D_XFER_TCONV_BUF_SIZE, &H5D_def_tconv_buf_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the background buffer property */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_XFER_BKGR_BUF_NAME, H5D_XFER_BKGR_BUF_SIZE, &H5D_def_bkgr_buf_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the background buffer type property */ if (H5P__register_real(pclass, H5D_XFER_BKGR_BUF_TYPE_NAME, H5D_XFER_BKGR_BUF_TYPE_SIZE, &H5D_def_bkgr_buf_type_g, NULL, NULL, NULL, H5D_XFER_BKGR_BUF_TYPE_ENC, H5D_XFER_BKGR_BUF_TYPE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the B-Tree node splitting ratios property */ if (H5P__register_real(pclass, H5D_XFER_BTREE_SPLIT_RATIO_NAME, H5D_XFER_BTREE_SPLIT_RATIO_SIZE, H5D_def_btree_split_ratio_g, NULL, NULL, NULL, H5D_XFER_BTREE_SPLIT_RATIO_ENC, H5D_XFER_BTREE_SPLIT_RATIO_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the vlen allocation function property */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_XFER_VLEN_ALLOC_NAME, H5D_XFER_VLEN_ALLOC_SIZE, &H5D_def_vlen_alloc_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the vlen allocation information property */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_XFER_VLEN_ALLOC_INFO_NAME, H5D_XFER_VLEN_ALLOC_INFO_SIZE, &H5D_def_vlen_alloc_info_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the vlen free function property */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_XFER_VLEN_FREE_NAME, H5D_XFER_VLEN_FREE_SIZE, &H5D_def_vlen_free_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the vlen free information property */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_XFER_VLEN_FREE_INFO_NAME, H5D_XFER_VLEN_FREE_INFO_SIZE, &H5D_def_vlen_free_info_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the vector size property */ if (H5P__register_real(pclass, H5D_XFER_HYPER_VECTOR_SIZE_NAME, H5D_XFER_HYPER_VECTOR_SIZE_SIZE, &H5D_def_hyp_vec_size_g, NULL, NULL, NULL, H5D_XFER_HYPER_VECTOR_SIZE_ENC, H5D_XFER_HYPER_VECTOR_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the I/O transfer mode properties */ if (H5P__register_real(pclass, H5D_XFER_IO_XFER_MODE_NAME, H5D_XFER_IO_XFER_MODE_SIZE, &H5D_def_io_xfer_mode_g, NULL, NULL, NULL, H5D_XFER_IO_XFER_MODE_ENC, H5D_XFER_IO_XFER_MODE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); if (H5P__register_real(pclass, H5D_XFER_MPIO_COLLECTIVE_OPT_NAME, H5D_XFER_MPIO_COLLECTIVE_OPT_SIZE, &H5D_def_mpio_collective_opt_mode_g, NULL, NULL, NULL, H5D_XFER_MPIO_COLLECTIVE_OPT_ENC, H5D_XFER_MPIO_COLLECTIVE_OPT_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); if (H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_HARD_NAME, H5D_XFER_MPIO_CHUNK_OPT_HARD_SIZE, &H5D_def_mpio_chunk_opt_mode_g, NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_HARD_ENC, H5D_XFER_MPIO_CHUNK_OPT_HARD_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); if (H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_NUM_NAME, H5D_XFER_MPIO_CHUNK_OPT_NUM_SIZE, &H5D_def_mpio_chunk_opt_num_g, NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_NUM_ENC, H5D_XFER_MPIO_CHUNK_OPT_NUM_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); if (H5P__register_real(pclass, H5D_XFER_MPIO_CHUNK_OPT_RATIO_NAME, H5D_XFER_MPIO_CHUNK_OPT_RATIO_SIZE, &H5D_def_mpio_chunk_opt_ratio_g, NULL, NULL, NULL, H5D_XFER_MPIO_CHUNK_OPT_RATIO_ENC, H5D_XFER_MPIO_CHUNK_OPT_RATIO_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the chunk optimization mode property. */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_SIZE, &H5D_def_mpio_actual_chunk_opt_mode_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the actual I/O mode property. */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_MPIO_ACTUAL_IO_MODE_NAME, H5D_MPIO_ACTUAL_IO_MODE_SIZE, &H5D_def_mpio_actual_io_mode_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the local cause of broken collective I/O */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the global cause of broken collective I/O */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, H5D_MPIO_NO_COLLECTIVE_CAUSE_SIZE, &H5D_def_mpio_no_collective_cause_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the EDC property */ if (H5P__register_real(pclass, H5D_XFER_EDC_NAME, H5D_XFER_EDC_SIZE, &H5D_def_enable_edc_g, NULL, NULL, NULL, H5D_XFER_EDC_ENC, H5D_XFER_EDC_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the filter callback property */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_XFER_FILTER_CB_NAME, H5D_XFER_FILTER_CB_SIZE, &H5D_def_filter_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the type conversion callback property */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5D_XFER_CONV_CB_NAME, H5D_XFER_CONV_CB_SIZE, &H5D_def_conv_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the data transform property */ if (H5P__register_real(pclass, H5D_XFER_XFORM_NAME, H5D_XFER_XFORM_SIZE, &H5D_def_xfer_xform_g, NULL, H5D_XFER_XFORM_SET, H5D_XFER_XFORM_GET, H5D_XFER_XFORM_ENC, H5D_XFER_XFORM_DEC, H5D_XFER_XFORM_DEL, H5D_XFER_XFORM_COPY, H5D_XFER_XFORM_CMP, H5D_XFER_XFORM_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the dataset I/O selection property */ if (H5P__register_real(pclass, H5D_XFER_DSET_IO_SEL_NAME, H5D_XFER_DSET_IO_SEL_SIZE, &H5D_def_dset_io_sel_g, NULL, NULL, NULL, NULL, NULL, NULL, H5D_XFER_DSET_IO_SEL_COPY, H5D_XFER_DSET_IO_SEL_CMP, H5D_XFER_DSET_IO_SEL_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + if (H5P__register_real(pclass, H5D_XFER_SELECTION_IO_MODE_NAME, H5D_XFER_SELECTION_IO_MODE_SIZE, + &H5D_def_selection_io_mode_g, NULL, NULL, NULL, H5D_XFER_SELECTION_IO_MODE_ENC, + H5D_XFER_SELECTION_IO_MODE_DEC, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the cause of no selection I/O property */ + /* (Note: this property should not have an encode/decode callback) */ + if (H5P__register_real(pclass, H5D_XFER_NO_SELECTION_IO_CAUSE_NAME, H5D_XFER_NO_SELECTION_IO_CAUSE_SIZE, + &H5D_def_no_selection_io_cause_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); + + /* Register the modify write buffer property */ + if (H5P__register_real(pclass, H5D_XFER_MODIFY_WRITE_BUF_NAME, H5D_XFER_MODIFY_WRITE_BUF_SIZE, + &H5D_def_modify_write_buf_g, NULL, NULL, NULL, H5D_XFER_MODIFY_WRITE_BUF_ENC, + H5D_XFER_MODIFY_WRITE_BUF_DEC, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -456,9 +490,6 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -470,8 +501,8 @@ H5P__dxfr_bkgr_buf_type_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(bkgr_buf_type); - HDassert(size); + assert(bkgr_buf_type); + assert(size); if (NULL != *pp) /* Encode background buffer type */ @@ -493,9 +524,6 @@ H5P__dxfr_bkgr_buf_type_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -507,9 +535,9 @@ H5P__dxfr_bkgr_buf_type_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(bkgr_buf_type); + assert(pp); + assert(*pp); + assert(bkgr_buf_type); /* Decode background buffer type */ *bkgr_buf_type = (H5T_bkg_t) * (*pp)++; @@ -527,9 +555,6 @@ H5P__dxfr_bkgr_buf_type_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -541,23 +566,23 @@ H5P__dxfr_btree_split_ratio_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(btree_split_ratio); - HDassert(size); + assert(btree_split_ratio); + assert(size); if (NULL != *pp) { /* Encode the size of a double*/ *(*pp)++ = (uint8_t)sizeof(double); /* Encode the left split value */ - H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio) + H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio); btree_split_ratio++; /* Encode the middle split value */ - H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio) + H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio); btree_split_ratio++; /* Encode the right split value */ - H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio) + H5_ENCODE_DOUBLE(*pp, *(const double *)btree_split_ratio); } /* end if */ /* Size of B-tree split ratio values */ @@ -576,9 +601,6 @@ H5P__dxfr_btree_split_ratio_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -592,19 +614,19 @@ H5P__dxfr_btree_split_ratio_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(btree_split_ratio); + assert(pp); + assert(*pp); + assert(btree_split_ratio); /* Decode the size */ enc_size = *(*pp)++; if (enc_size != sizeof(double)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded"); /* Decode the left, middle & left B-tree split ratios */ - H5_DECODE_DOUBLE(*pp, btree_split_ratio[0]) - H5_DECODE_DOUBLE(*pp, btree_split_ratio[1]) - H5_DECODE_DOUBLE(*pp, btree_split_ratio[2]) + H5_DECODE_DOUBLE(*pp, btree_split_ratio[0]); + H5_DECODE_DOUBLE(*pp, btree_split_ratio[1]); + H5_DECODE_DOUBLE(*pp, btree_split_ratio[2]); done: FUNC_LEAVE_NOAPI(ret_value) @@ -618,9 +640,6 @@ H5P__dxfr_btree_split_ratio_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -632,11 +651,11 @@ H5P__dxfr_xform_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *nam FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of data transform */ if (H5Z_xform_copy((H5Z_data_xform_t **)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the data transform info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the data transform info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -650,9 +669,6 @@ H5P__dxfr_xform_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *nam * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -664,11 +680,11 @@ H5P__dxfr_xform_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *nam FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of data transform */ if (H5Z_xform_copy((H5Z_data_xform_t **)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the data transform info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the data transform info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -684,9 +700,6 @@ H5P__dxfr_xform_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *nam * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, August 6, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -703,13 +716,13 @@ H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) /* Sanity check */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - HDassert(size); + assert(size); /* Check for data transform set */ if (NULL != data_xform_prop) { /* Get the transform expression */ if (NULL == (pexp = H5Z_xform_extract_xform_str(data_xform_prop))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression"); /* Get the transform string expression size */ len = HDstrlen(pexp) + 1; @@ -722,13 +735,13 @@ H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) /* encode the length of the prefix */ enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); if (NULL != data_xform_prop) { /* Sanity check */ - HDassert(pexp); + assert(pexp); /* Copy the expression into the buffer */ H5MM_memcpy(*pp, (const uint8_t *)pexp, len); @@ -756,9 +769,6 @@ H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, August 6, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -774,20 +784,20 @@ H5P__dxfr_xform_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(data_xform_prop); + assert(pp); + assert(*pp); + assert(data_xform_prop); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); /* Decode the length of xform expression */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); len = (size_t)enc_value; if (0 != len) { if (NULL == (*data_xform_prop = H5Z_xform_create((const char *)*pp))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create data transform info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create data transform info"); *pp += len; } /* end if */ else @@ -804,10 +814,6 @@ H5P__dxfr_xform_dec(const void **_pp, void *_value) * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber - * - * Date: April 9, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -818,10 +824,10 @@ H5P__dxfr_xform_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *nam FUNC_ENTER_PACKAGE - HDassert(value); + assert(value); if (H5Z_xform_destroy(*(H5Z_data_xform_t **)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -835,10 +841,6 @@ H5P__dxfr_xform_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *nam * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber - * - * Date: April 9, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -849,11 +851,11 @@ H5P__dxfr_xform_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of data transform */ if (H5Z_xform_copy((H5Z_data_xform_t **)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the data transform info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the data transform info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -867,9 +869,6 @@ H5P__dxfr_xform_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. * - * Programmer: Quincey Koziol - * Wednesday, August 15, 2012 - * *------------------------------------------------------------------------- */ static int @@ -885,9 +884,9 @@ H5P__dxfr_xform_cmp(const void *_xform1, const void *_xform2, size_t H5_ATTR_UNU FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(xform1); - HDassert(xform2); - HDassert(size == sizeof(H5Z_data_xform_t *)); + assert(xform1); + assert(xform2); + assert(size == sizeof(H5Z_data_xform_t *)); /* Check for a property being set */ if (*xform1 == NULL && *xform2 != NULL) @@ -896,7 +895,7 @@ H5P__dxfr_xform_cmp(const void *_xform1, const void *_xform2, size_t H5_ATTR_UNU HGOTO_DONE(1); if (*xform1) { - HDassert(*xform2); + assert(*xform2); /* Get the transform expressions */ pexp1 = H5Z_xform_extract_xform_str(*xform1); @@ -909,7 +908,7 @@ H5P__dxfr_xform_cmp(const void *_xform1, const void *_xform2, size_t H5_ATTR_UNU HGOTO_DONE(1); if (pexp1) { - HDassert(pexp2); + assert(pexp2); ret_value = HDstrcmp(pexp1, pexp2); } /* end if */ } /* end if */ @@ -925,10 +924,6 @@ H5P__dxfr_xform_cmp(const void *_xform1, const void *_xform2, size_t H5_ATTR_UNU * * Return: Success: SUCCEED, Failure: FAIL * - * Programmer: Leon Arber - * - * Date: April 9, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -938,10 +933,10 @@ H5P__dxfr_xform_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED siz FUNC_ENTER_PACKAGE - HDassert(value); + assert(value); if (H5Z_xform_destroy(*(H5Z_data_xform_t **)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing the parse tree"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -954,9 +949,6 @@ H5P__dxfr_xform_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED siz * * Return: Non-negative on success/Negative on failure * - * Programmer: Leon Arber - * Monday, March 07, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -971,32 +963,32 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) /* Check arguments */ if (expression == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "expression cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "expression cannot be NULL"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* See if a data transform is already set, and free it if it is */ if (H5P_peek(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression"); /* Destroy previous data transform property */ if (H5Z_xform_destroy(data_xform_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release data transform expression") + HGOTO_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release data transform expression"); /* Create data transform info from expression */ if (NULL == (data_xform_prop = H5Z_xform_create(expression))) - HGOTO_ERROR(H5E_PLIST, H5E_NOSPACE, FAIL, "unable to create data transform info") + HGOTO_ERROR(H5E_PLIST, H5E_NOSPACE, FAIL, "unable to create data transform info"); /* Update property list (takes ownership of transform) */ if (H5P_poke(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Error setting data transform expression") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Error setting data transform expression"); done: if (ret_value < 0) if (data_xform_prop && H5Z_xform_destroy(data_xform_prop) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release data transform expression") + HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release data transform expression"); FUNC_LEAVE_API(ret_value) } /* end H5Pset_data_transform() */ @@ -1018,9 +1010,6 @@ H5Pset_data_transform(hid_t plist_id, const char *expression) * If a zero is returned for the name's length, then there is no name * associated with the ID. * - * Programmer: Leon Arber - * August 27, 2004 - * *------------------------------------------------------------------------- */ ssize_t @@ -1037,17 +1026,17 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_peek(plist, H5D_XFER_XFORM_NAME, &data_xform_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting data transform expression"); if (NULL == data_xform_prop) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "data transform has not been set") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "data transform has not been set"); /* Get the data transform string */ if (NULL == (pexp = H5Z_xform_extract_xform_str(data_xform_prop))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "failed to retrieve transform expression"); /* Copy into application buffer */ len = HDstrlen(pexp); @@ -1079,9 +1068,6 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, March 16, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1095,19 +1081,19 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg) /* Check arguments */ if (size == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buffer size must not be zero"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Update property list */ if (H5P_set(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer buffer size"); if (H5P_set(plist, H5D_XFER_TCONV_BUF_NAME, &tconv) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set transfer type conversion buffer"); if (H5P_set(plist, H5D_XFER_BKGR_BUF_NAME, &bkg) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "Can't set background type conversion buffer"); done: FUNC_LEAVE_API(ret_value) @@ -1122,9 +1108,6 @@ H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg) * * Failure: 0 * - * Programmer: Robb Matzke - * Monday, March 16, 1998 - * *------------------------------------------------------------------------- */ size_t @@ -1139,19 +1122,19 @@ H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, 0, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, 0, "can't find object for ID"); /* Return values */ if (tconv) if (H5P_get(plist, H5D_XFER_TCONV_BUF_NAME, tconv) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get transfer type conversion buffer"); if (bkg) if (H5P_get(plist, H5D_XFER_BKGR_BUF_NAME, bkg) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "Can't get background type conversion buffer"); /* Get the size */ if (H5P_get(plist, H5D_XFER_MAX_TEMP_BUF_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, 0, "Can't set transfer buffer size"); /* Set the return value */ ret_value = size; @@ -1171,9 +1154,6 @@ H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, March 17, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1188,12 +1168,12 @@ H5Pset_preserve(hid_t plist_id, hbool_t status) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Update property list */ need_bkg = status ? H5T_BKG_YES : H5T_BKG_NO; if (H5P_set(plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -1208,9 +1188,6 @@ H5Pset_preserve(hid_t plist_id, hbool_t status) * * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, March 17, 1998 - * *------------------------------------------------------------------------- */ int @@ -1225,11 +1202,11 @@ H5Pget_preserve(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (H5P_get(plist, H5D_XFER_BKGR_BUF_TYPE_NAME, &need_bkg) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); /* Set return value */ ret_value = need_bkg ? TRUE : FALSE; @@ -1248,9 +1225,6 @@ H5Pget_preserve(hid_t plist_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Jan 3, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1264,15 +1238,15 @@ H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check) /* Check argument */ if (check != H5Z_ENABLE_EDC && check != H5Z_DISABLE_EDC) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid value") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid value"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Update property list */ if (H5P_set(plist, H5D_XFER_EDC_NAME, &check) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -1288,9 +1262,6 @@ H5Pset_edc_check(hid_t plist_id, H5Z_EDC_t check) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Jan 3, 2003 - * *------------------------------------------------------------------------- */ H5Z_EDC_t @@ -1304,11 +1275,11 @@ H5Pget_edc_check(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_ERROR_EDC, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_ERROR_EDC, "can't find object for ID"); /* Update property list */ if (H5P_get(plist, H5D_XFER_EDC_NAME, &ret_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5Z_ERROR_EDC, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5Z_ERROR_EDC, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -1323,9 +1294,6 @@ H5Pget_edc_check(hid_t plist_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Jan 14, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1340,14 +1308,14 @@ H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Update property list */ cb_struct.func = func; cb_struct.op_data = op_data; if (H5P_set(plist, H5D_XFER_FILTER_CB_NAME, &cb_struct) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -1362,9 +1330,6 @@ H5Pset_filter_callback(hid_t plist_id, H5Z_filter_func_t func, void *op_data) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * April 15, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -1379,14 +1344,14 @@ H5Pset_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t op, void *operate_dat /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Update property list */ cb_struct.func = op; cb_struct.user_data = operate_data; if (H5P_set(plist, H5D_XFER_CONV_CB_NAME, &cb_struct) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -1401,9 +1366,6 @@ H5Pset_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t op, void *operate_dat * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * April 15, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -1418,11 +1380,11 @@ H5Pget_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t *op /*out*/, void **o /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get property */ if (H5P_get(plist, H5D_XFER_CONV_CB_NAME, &cb_struct) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); /* Assign return value */ *op = cb_struct.func; @@ -1442,9 +1404,6 @@ H5Pget_type_conv_cb(hid_t plist_id, H5T_conv_except_func_t *op /*out*/, void **o * * Failure: Negative * - * Programmer: Robb Matzke - * Monday, September 28, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1459,11 +1418,11 @@ H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the split ratios */ if (H5P_get(plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &btree_split_ratio) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); /* Get values */ if (left) @@ -1492,9 +1451,6 @@ H5Pget_btree_ratios(hid_t plist_id, double *left /*out*/, double *middle /*out*/ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, September 28, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1509,11 +1465,11 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right) /* Check arguments */ if (left < 0.0 || left > 1.0 || middle < 0.0 || middle > 1.0 || right < 0.0 || right > 1.0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0 <= X <= 1.0") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "split ratio must satisfy 0.0 <= X <= 1.0"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ split_ratio[0] = left; @@ -1522,7 +1478,7 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right) /* Set the split ratios */ if (H5P_set(plist, H5D_XFER_BTREE_SPLIT_RATIO_NAME, &split_ratio) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -1542,9 +1498,6 @@ H5Pset_btree_ratios(hid_t plist_id, double left, double middle, double right) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 1, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -1555,17 +1508,17 @@ H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, void FUNC_ENTER_NOAPI(FAIL) - HDassert(plist); + assert(plist); /* Update property list */ if (H5P_set(plist, H5D_XFER_VLEN_ALLOC_NAME, &alloc_func) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); if (H5P_set(plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, &alloc_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); if (H5P_set(plist, H5D_XFER_VLEN_FREE_NAME, &free_func) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); if (H5P_set(plist, H5D_XFER_VLEN_FREE_INFO_NAME, &free_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1585,9 +1538,6 @@ H5P_set_vlen_mem_manager(H5P_genplist_t *plist, H5MM_allocate_t alloc_func, void * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 1, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -1602,11 +1552,11 @@ H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_ /* Check arguments */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list"); /* Update property list */ if (H5P_set_vlen_mem_manager(plist, alloc_func, alloc_info, free_func, free_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set values") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set values"); done: FUNC_LEAVE_API(ret_value) @@ -1619,9 +1569,6 @@ H5Pset_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t alloc_func, void *alloc_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 1, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -1636,20 +1583,20 @@ H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func /*out*/, voi /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (alloc_func) if (H5P_get(plist, H5D_XFER_VLEN_ALLOC_NAME, alloc_func) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); if (alloc_info) if (H5P_get(plist, H5D_XFER_VLEN_ALLOC_INFO_NAME, alloc_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); if (free_func) if (H5P_get(plist, H5D_XFER_VLEN_FREE_NAME, free_func) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); if (free_info) if (H5P_get(plist, H5D_XFER_VLEN_FREE_INFO_NAME, free_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value) @@ -1671,9 +1618,6 @@ H5Pget_vlen_mem_manager(hid_t plist_id, H5MM_allocate_t *alloc_func /*out*/, voi * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, July 9, 2001 - * *------------------------------------------------------------------------- */ herr_t @@ -1687,15 +1631,15 @@ H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size) /* Check arguments */ if (vector_size < 1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "vector size too small"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Update property list */ if (H5P_set(plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, &vector_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); done: FUNC_LEAVE_API(ret_value) @@ -1708,9 +1652,6 @@ H5Pset_hyper_vector_size(hid_t plist_id, size_t vector_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, July 9, 2001 - * *------------------------------------------------------------------------- */ herr_t @@ -1724,12 +1665,12 @@ H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Return values */ if (vector_size) if (H5P_get(plist, H5D_XFER_HYPER_VECTOR_SIZE_NAME, vector_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value) @@ -1745,9 +1686,6 @@ H5Pget_hyper_vector_size(hid_t plist_id, size_t *vector_size /*out*/) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1759,8 +1697,8 @@ H5P__dxfr_io_xfer_mode_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(xfer_mode); - HDassert(size); + assert(xfer_mode); + assert(size); if (NULL != *pp) /* Encode I/O transfer mode */ @@ -1782,9 +1720,6 @@ H5P__dxfr_io_xfer_mode_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1796,9 +1731,9 @@ H5P__dxfr_io_xfer_mode_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(xfer_mode); + assert(pp); + assert(*pp); + assert(xfer_mode); /* Decode I/O transfer mode */ *xfer_mode = (H5FD_mpio_xfer_t) * (*pp)++; @@ -1816,9 +1751,6 @@ H5P__dxfr_io_xfer_mode_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1831,8 +1763,8 @@ H5P__dxfr_mpio_collective_opt_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(coll_opt); - HDassert(size); + assert(coll_opt); + assert(size); if (NULL != *pp) /* Encode MPI-I/O collective optimization property */ @@ -1854,9 +1786,6 @@ H5P__dxfr_mpio_collective_opt_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1869,9 +1798,9 @@ H5P__dxfr_mpio_collective_opt_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(coll_opt); + assert(pp); + assert(*pp); + assert(coll_opt); /* Decode MPI-I/O collective optimization mode */ *coll_opt = (H5FD_mpio_collective_opt_t) * (*pp)++; @@ -1889,9 +1818,6 @@ H5P__dxfr_mpio_collective_opt_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1904,8 +1830,8 @@ H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(chunk_opt); - HDassert(size); + assert(chunk_opt); + assert(size); if (NULL != *pp) /* Encode MPI-I/O chunk optimization property */ @@ -1927,9 +1853,6 @@ H5P__dxfr_mpio_chunk_opt_hard_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1941,9 +1864,9 @@ H5P__dxfr_mpio_chunk_opt_hard_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(chunk_opt); + assert(pp); + assert(*pp); + assert(chunk_opt); /* Decode MPI-I/O chunk optimization mode */ *chunk_opt = (H5FD_mpio_chunk_opt_t) * (*pp)++; @@ -1960,9 +1883,6 @@ H5P__dxfr_mpio_chunk_opt_hard_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * - * Programmer: Jacob Gruber - * Wednesday, May 4, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -1977,12 +1897,12 @@ H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Return values */ if (actual_chunk_opt_mode) if (H5P_get(plist, H5D_MPIO_ACTUAL_CHUNK_OPT_MODE_NAME, actual_chunk_opt_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value) @@ -1996,9 +1916,6 @@ H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, * * Return: Non-negative on success/Negative on failure * - * Programmer: Jacob Gruber - * Wednesday, May 4, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -2012,12 +1929,12 @@ H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Return values */ if (actual_io_mode) if (H5P_get(plist, H5D_MPIO_ACTUAL_IO_MODE_NAME, actual_io_mode) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); done: FUNC_LEAVE_API(ret_value) @@ -2030,8 +1947,6 @@ H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Jonathan Kim - * Aug 3, 2012 *------------------------------------------------------------------------- */ herr_t @@ -2046,15 +1961,15 @@ H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_ca /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Return values */ if (local_no_collective_cause) if (H5P_get(plist, H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME, local_no_collective_cause) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get local value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get local value"); if (global_no_collective_cause) if (H5P_get(plist, H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME, global_no_collective_cause) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get global value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get global value"); done: FUNC_LEAVE_API(ret_value) @@ -2071,9 +1986,6 @@ H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_ca * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -2085,8 +1997,8 @@ H5P__dxfr_edc_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(check); - HDassert(size); + assert(check); + assert(size); if (NULL != *pp) /* Encode EDC property */ @@ -2108,9 +2020,6 @@ H5P__dxfr_edc_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 3, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -2122,9 +2031,9 @@ H5P__dxfr_edc_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(check); + assert(pp); + assert(*pp); + assert(check); /* Decode EDC property */ *check = (H5Z_EDC_t) * (*pp)++; @@ -2139,9 +2048,6 @@ H5P__dxfr_edc_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sunday, January 31, 2021 - * *------------------------------------------------------------------------- */ static herr_t @@ -2157,7 +2063,7 @@ H5P__dxfr_dset_io_hyp_sel_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U if (orig_space) { /* Make copy of dataspace */ if (NULL == (new_space = H5S_copy(orig_space, FALSE, TRUE))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the dataset I/O selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "error copying the dataset I/O selection"); /* Set new value for property */ *(void **)value = new_space; @@ -2167,7 +2073,7 @@ H5P__dxfr_dset_io_hyp_sel_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U /* Cleanup on error */ if (ret_value < 0) if (new_space && H5S_close(new_space) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing dataset I/O selection dataspace") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing dataset I/O selection dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_dset_io_hyp_sel_copy() */ @@ -2180,9 +2086,6 @@ H5P__dxfr_dset_io_hyp_sel_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. * - * Programmer: Quincey Koziol - * Sunday, January 31, 2021 - * *------------------------------------------------------------------------- */ static int @@ -2195,9 +2098,9 @@ H5P__dxfr_dset_io_hyp_sel_cmp(const void *_space1, const void *_space2, size_t H FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(space1); - HDassert(space1); - HDassert(size == sizeof(H5S_t *)); + assert(space1); + assert(space1); + assert(size == sizeof(H5S_t *)); /* Check for a property being set */ if (*space1 == NULL && *space2 != NULL) @@ -2206,7 +2109,7 @@ H5P__dxfr_dset_io_hyp_sel_cmp(const void *_space1, const void *_space2, size_t H HGOTO_DONE(1); if (*space1) { - HDassert(*space2); + assert(*space2); /* Compare the extents of the dataspaces */ /* (Error & not-equal count the same) */ @@ -2238,9 +2141,6 @@ H5P__dxfr_dset_io_hyp_sel_cmp(const void *_space1, const void *_space2, size_t H * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sunday, January 31, 2021 - * *------------------------------------------------------------------------- */ static herr_t @@ -2253,12 +2153,78 @@ H5P__dxfr_dset_io_hyp_sel_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_ /* Release any dataspace */ if (space && H5S_close(space) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing dataset I/O selection dataspace") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, "error closing dataset I/O selection dataspace"); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_dset_io_hyp_sel_close() */ +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_selection_io_mode_enc + * + * Purpose: Callback routine which is called whenever the selection + * I/O mode property in the dataset transfer property list + * is encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_selection_io_mode_enc(const void *value, void **_pp, size_t *size) +{ + const H5D_selection_io_mode_t *select_io_mode = + (const H5D_selection_io_mode_t *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + assert(select_io_mode); + assert(size); + + if (NULL != *pp) + /* Encode selection I/O mode property */ + *(*pp)++ = (uint8_t)*select_io_mode; + + /* Size of selection I/O mode property */ + (*size)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_selection_io_mode_enc() */ + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_selection_io_mode_dec + * + * Purpose: Callback routine which is called whenever the selection + * I/O mode property in the dataset transfer property list + * is decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_selection_io_mode_dec(const void **_pp, void *_value) +{ + H5D_selection_io_mode_t *select_io_mode = (H5D_selection_io_mode_t *)_value; /* Selection I/O mode */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + assert(pp); + assert(*pp); + assert(select_io_mode); + + /* Decode selection I/O mode property */ + *select_io_mode = (H5D_selection_io_mode_t) * (*pp)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_selection_io_dec() */ + /*------------------------------------------------------------------------- * Function: H5Pset_dataset_io_hyperslab_selection * @@ -2280,17 +2246,14 @@ H5P__dxfr_dset_io_hyp_sel_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, January 30, 2021 - * *------------------------------------------------------------------------- */ herr_t H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { - H5P_genplist_t *plist = NULL; /* Property list pointer */ - H5S_t *space; /* Dataspace to hold selection */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + H5S_t *space = NULL; /* Dataspace to hold selection */ hbool_t space_created = FALSE; /* Whether a new dataspace has been created */ hbool_t reset_prop_on_error = FALSE; /* Whether to reset the property on failure */ herr_t ret_value = SUCCEED; /* return value */ @@ -2300,30 +2263,30 @@ H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper /* Check arguments */ if (rank < 1 || rank > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank value: %u", rank) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank value: %u", rank); if (!(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID)) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); if (start == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "'count' pointer is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "'count' pointer is NULL"); if (stride != NULL) { unsigned u; /* Local index variable */ /* Check for 0-sized strides */ for (u = 0; u < rank; u++) if (stride[u] == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value - stride[%u]==0", u) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid value - stride[%u]==0", u); } /* end if */ if (count == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "'start' pointer is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "'start' pointer is NULL"); /* block is allowed to be NULL, and will be assumed to be all '1's when NULL */ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* See if a dataset I/O selection is already set, and free it if it is */ if (H5P_peek(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting dataset I/O selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "error getting dataset I/O selection"); /* Check for operation on existing dataspace selection */ if (NULL != space) { @@ -2331,7 +2294,7 @@ H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper /* Get dimensions from current dataspace for selection */ if ((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get selection's dataspace rank") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get selection's dataspace rank"); /* Check for different # of dimensions */ if ((unsigned)sndims != rank) { @@ -2339,7 +2302,7 @@ H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper if (op == H5S_SELECT_SET) { /* Close previous dataspace */ if (H5S_close(space) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + HGOTO_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release dataspace"); /* Reset 'space' pointer, so it's re-created */ space = NULL; @@ -2348,7 +2311,7 @@ H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper reset_prop_on_error = TRUE; } /* end if */ else - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "different rank for previous and new selections") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "different rank for previous and new selections"); } /* end if */ } /* end if */ @@ -2363,27 +2326,264 @@ H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper /* Create dataspace of the correct dimensionality, with maximum dimensions */ if (NULL == (space = H5S_create_simple(rank, dims, NULL))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create dataspace for selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "unable to create dataspace for selection"); space_created = TRUE; } /* end if */ /* Set selection for dataspace */ if (H5S_select_hyperslab(space, op, start, stride, count, block) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSELECT, FAIL, "can't create selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSELECT, FAIL, "can't create selection"); /* Update property list (takes ownership of dataspace, if new) */ if (H5P_poke(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "error setting dataset I/O selection") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "error setting dataset I/O selection"); space_created = FALSE; /* Reset now that property owns the dataspace */ done: /* Cleanup on failure */ if (ret_value < 0) { if (reset_prop_on_error && plist && H5P_poke(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "error setting dataset I/O selection") + HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "error setting dataset I/O selection"); if (space_created && H5S_close(space) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release dataspace"); } /* end if */ FUNC_LEAVE_API(ret_value) } /* end H5Pset_dataset_io_hyperslab_selection() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_selection_io + * + * Purpose: To set the selection I/O mode in the dataset + * transfer property list. + * + * Note: The library may not perform selection I/O as it asks for if + * the layout callback determines that it is not feasible to do so. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_selection_io(hid_t plist_id, H5D_selection_io_mode_t selection_io_mode) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "iDC", plist_id, selection_io_mode); + + /* Check arguments */ + if (plist_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); + + if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); + + /* Set the selection I/O mode */ + if (H5P_set(plist, H5D_XFER_SELECTION_IO_MODE_NAME, &selection_io_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_selection_io() */ + +/*------------------------------------------------------------------------- + * Function: H5Pget_selection_io + * + * Purpose: To retrieve the selection I/O mode that is set in + * the dataset transfer property list. + * + * Note: The library may not perform selection I/O as it asks for if + * the layout callback determines that it is not feasible to do so. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_selection_io(hid_t plist_id, H5D_selection_io_mode_t *selection_io_mode /*out*/) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", plist_id, selection_io_mode); + + /* Check arguments */ + if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); + + /* Get the selection I/O mode */ + if (selection_io_mode) + if (H5P_get(plist, H5D_XFER_SELECTION_IO_MODE_NAME, selection_io_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_selection_io() */ + +/*------------------------------------------------------------------------- + * Function: H5Pget_no_selection_io_cause + * + * Purpose: Retrieves causes for not performing selection I/O + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_no_selection_io_cause(hid_t plist_id, uint32_t *no_selection_io_cause /*out*/) +{ + H5P_genplist_t *plist; + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", plist_id, no_selection_io_cause); + + /* Get the plist structure */ + if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); + + /* Return values */ + if (no_selection_io_cause) + if (H5P_get(plist, H5D_XFER_NO_SELECTION_IO_CAUSE_NAME, no_selection_io_cause) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get no_selection_io_cause value"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_no_selection_io_cause() */ + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_modify_write_buf_enc + * + * Purpose: Callback routine which is called whenever the modify write + * buffer property in the dataset transfer property list is + * encoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_modify_write_buf_enc(const void *value, void **_pp /*out*/, size_t *size /*out*/) +{ + const hbool_t *modify_write_buf = (const hbool_t *)value; /* Create local alias for values */ + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity check */ + assert(modify_write_buf); + assert(size); + + if (NULL != *pp) + /* Encode modify write buf property. Use "!!" so we always get 0 or 1 */ + *(*pp)++ = (uint8_t)(!!(*modify_write_buf)); + + /* Size of modify write buf property */ + (*size)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_modify_write_buf_enc() */ + +/*------------------------------------------------------------------------- + * Function: H5P__dxfr_modify_write_buf_dec + * + * Purpose: Callback routine which is called whenever the modify write + * buffer property in the dataset transfer property list is + * decoded. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dxfr_modify_write_buf_dec(const void **_pp, void *_value /*out*/) +{ + hbool_t *modify_write_buf = (hbool_t *)_value; /* Modify write buffer */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + assert(pp); + assert(*pp); + assert(modify_write_buf); + + /* Decode selection I/O mode property */ + *modify_write_buf = (hbool_t) * (*pp)++; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dxfr_modify_write_buf_dec() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_modify_write_buf + * + * Purpose: Allows the library to modify the contents of the write + * buffer + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_modify_write_buf(hid_t plist_id, hbool_t modify_write_buf) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", plist_id, modify_write_buf); + + /* Check arguments */ + if (plist_id == H5P_DEFAULT) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't set values in default property list"); + + if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); + + /* Set the selection I/O mode */ + if (H5P_set(plist, H5D_XFER_MODIFY_WRITE_BUF_NAME, &modify_write_buf) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_modify_write_buf() */ + +/*------------------------------------------------------------------------- + * Function: H5Pget_modify_write_buf + * + * Purpose: Retrieves the "modify write buffer" property + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_modify_write_buf(hid_t plist_id, hbool_t *modify_write_buf /*out*/) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", plist_id, modify_write_buf); + + /* Check arguments */ + if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a dxpl"); + + /* Get the selection I/O mode */ + if (modify_write_buf) + if (H5P_get(plist, H5D_XFER_MODIFY_WRITE_BUF_NAME, modify_write_buf) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value"); + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_modify_write_buf() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pencdec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pencdec.c index d7ebac6a96..69396f489b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pencdec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pencdec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,8 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * +/* * Purpose: Generic Property Functions */ @@ -75,9 +73,6 @@ typedef struct { * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Sunday, July 29, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -91,8 +86,8 @@ H5P__encode_size_t(const void *value, void **_pp, size_t *size) /* Sanity checks */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - HDassert(enc_size < 256); - HDassert(size); + assert(enc_size < 256); + assert(size); if (NULL != *pp) { /* Encode the size */ @@ -116,9 +111,6 @@ H5P__encode_size_t(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 07, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -132,8 +124,8 @@ H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) /* Sanity checks */ HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t)); - HDassert(enc_size < 256); - HDassert(size); + assert(enc_size < 256); + assert(size); if (NULL != *pp) { *(*pp)++ = (uint8_t)enc_size; @@ -156,9 +148,6 @@ H5P__encode_hsize_t(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Sunday, July 29, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -169,15 +158,15 @@ H5P__encode_unsigned(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(value); - HDassert(size); + assert(value); + assert(size); if (NULL != *pp) { /* Encode the size */ *(*pp)++ = (uint8_t)sizeof(unsigned); /* Encode the value */ - H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)value) + H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)value); } /* end if */ /* Set size needed for encoding */ @@ -194,9 +183,6 @@ H5P__encode_unsigned(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 07, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -207,8 +193,8 @@ H5P__encode_uint8_t(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(value); - HDassert(size); + assert(value); + assert(size); if (NULL != *pp) { /* Encode the value */ @@ -229,9 +215,6 @@ H5P__encode_uint8_t(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * August 15, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -242,8 +225,8 @@ H5P__encode_hbool_t(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(value); - HDassert(size); + assert(value); + assert(size); if (NULL != *pp) /* Encode the value */ @@ -263,9 +246,6 @@ H5P__encode_hbool_t(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Sunday, July 29, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -276,15 +256,15 @@ H5P__encode_double(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(value); - HDassert(size); + assert(value); + assert(size); if (NULL != *pp) { /* Encode the size */ *(*pp)++ = (uint8_t)sizeof(double); /* Encode the value */ - H5_ENCODE_DOUBLE(*pp, *(const double *)value) + H5_ENCODE_DOUBLE(*pp, *(const double *)value); } /* end if */ /* Set size needed for encoding */ @@ -322,8 +302,8 @@ H5P__encode_cb(H5P_genprop_t *prop, void *_udata) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(prop); - HDassert(udata); + assert(prop); + assert(udata); /* Check if this property can be encoded */ if (prop->encode) { @@ -341,7 +321,7 @@ H5P__encode_cb(H5P_genprop_t *prop, void *_udata) /* Encode (or not, if *(udata->pp) is NULL) the property value */ prop_value_len = 0; if ((prop->encode)(prop->value, udata->pp, &prop_value_len) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, H5_ITER_ERROR, "property encoding routine failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, H5_ITER_ERROR, "property encoding routine failed"); *(udata->enc_size_ptr) += prop_value_len; } /* end if */ @@ -386,7 +366,7 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, size_t /* Sanity check */ if (NULL == nalloc) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad allocation size pointer") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad allocation size pointer"); /* If the buffer is NULL, then this call to H5P__encode will return how much * space is needed to encode a property. @@ -412,7 +392,7 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, size_t /* Iterate over all properties in property list, encoding them */ idx = 0; if (H5P__iterate_plist(plist, enc_all_prop, &idx, H5P__encode_cb, &udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADITER, FAIL, "can't iterate over properties") + HGOTO_ERROR(H5E_PLIST, H5E_BADITER, FAIL, "can't iterate over properties"); /* Encode a terminator for list of properties */ if (encode) @@ -434,9 +414,6 @@ H5P__encode(const H5P_genplist_t *plist, hbool_t enc_all_prop, void *buf, size_t * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, August 2, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -451,13 +428,13 @@ H5P__decode_size_t(const void **_pp, void *_value) /* Sanity check */ HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - HDassert(pp); - HDassert(*pp); - HDassert(value); + assert(pp); + assert(*pp); + assert(value); /* Decode the size */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); /* Decode the value */ UINT64DECODE_VAR(*pp, enc_value, enc_size); @@ -474,9 +451,6 @@ H5P__decode_size_t(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 07, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -491,13 +465,13 @@ H5P__decode_hsize_t(const void **_pp, void *_value) /* Sanity check */ HDcompile_assert(sizeof(hsize_t) <= sizeof(uint64_t)); - HDassert(pp); - HDassert(*pp); - HDassert(value); + assert(pp); + assert(*pp); + assert(value); /* Decode the size */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); /* Decode the value */ UINT64DECODE_VAR(*pp, enc_value, enc_size); @@ -514,9 +488,6 @@ H5P__decode_hsize_t(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, August 2, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -530,16 +501,16 @@ H5P__decode_unsigned(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(value); + assert(pp); + assert(*pp); + assert(value); /* Decode the size */ enc_size = *(*pp)++; if (enc_size != sizeof(unsigned)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded"); - H5_DECODE_UNSIGNED(*pp, *value) + H5_DECODE_UNSIGNED(*pp, *value); done: FUNC_LEAVE_NOAPI(ret_value) @@ -553,9 +524,6 @@ H5P__decode_unsigned(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, August 2, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -568,9 +536,9 @@ H5P__decode_uint8_t(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(value); + assert(pp); + assert(*pp); + assert(value); /* Decode the value */ *value = *(*pp)++; @@ -586,9 +554,6 @@ H5P__decode_uint8_t(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, August 15, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -601,9 +566,9 @@ H5P__decode_hbool_t(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(value); + assert(pp); + assert(*pp); + assert(value); /* Decode the value */ *value = (hbool_t) * (*pp)++; @@ -619,9 +584,6 @@ H5P__decode_hbool_t(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, August 2, 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -635,16 +597,16 @@ H5P__decode_double(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(value); + assert(pp); + assert(*pp); + assert(value); /* Decode the size */ enc_size = *(*pp)++; if (enc_size != sizeof(double)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded"); - H5_DECODE_DOUBLE(*pp, *value) + H5_DECODE_DOUBLE(*pp, *value); done: FUNC_LEAVE_NOAPI(ret_value) @@ -689,18 +651,18 @@ H5P__decode(const void *buf) /* Sanity check */ if (NULL == p) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "decode buffer is NULL") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "decode buffer is NULL"); /* Get the version number of the encoded property list */ vers = (uint8_t)*p++; if ((uint8_t)H5P_ENCODE_VERS != vers) HGOTO_ERROR(H5E_PLIST, H5E_VERSION, FAIL, "bad version # of encoded information, expected %u, got %u", - (unsigned)H5P_ENCODE_VERS, (unsigned)vers) + (unsigned)H5P_ENCODE_VERS, (unsigned)vers); /* Get the type of the property list */ type = (H5P_plist_type_t)*p++; if (type <= H5P_TYPE_USER || type >= H5P_TYPE_MAX_TYPE) - HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "bad type of encoded information: %u", (unsigned)type) + HGOTO_ERROR(H5E_PLIST, H5E_BADRANGE, FAIL, "bad type of encoded information: %u", (unsigned)type); /* Create new property list of the specified type */ if ((plist_id = H5P__new_plist_of_type(type)) < 0) @@ -708,7 +670,7 @@ H5P__decode(const void *buf) /* Get the property list object */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property class") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property class"); /* Loop over encoded properties, deserializing their values */ while (p) { @@ -725,12 +687,12 @@ H5P__decode(const void *buf) /* Find property with name */ if (NULL == (prop = H5P__find_prop_plist(plist, name))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist: '%s'", name) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist: '%s'", name); /* Check if we should increase the size of the value buffer */ if (prop->size > value_buf_size) { if (NULL == (value_buf = H5MM_realloc(value_buf, prop->size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "decoding buffer allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "decoding buffer allocation failed"); value_buf_size = prop->size; } /* end if */ @@ -738,14 +700,14 @@ H5P__decode(const void *buf) if (prop->decode) { if ((prop->decode)((const void **)&p, value_buf) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, - "property decoding routine failed, property: '%s'", name) + "property decoding routine failed, property: '%s'", name); } /* end if */ else - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s'", name) + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s'", name); /* Set the value for the property */ if (H5P_poke(plist, name, value_buf) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value for property: '%s'", name) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value for property: '%s'", name); } /* end while */ /* Set return value */ @@ -760,7 +722,7 @@ H5P__decode(const void *buf) if (ret_value < 0) { if (plist_id > 0 && H5I_dec_ref(plist_id) < 0) HDONE_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, - "unable to close partially initialized property list") + "unable to close partially initialized property list"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pfapl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pfapl.c index c8c07368f6..0aca611772 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pfapl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pfapl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -539,8 +538,6 @@ static const hbool_t H5F_def_ignore_disabled_file_locks_g = * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 31, 2006 *------------------------------------------------------------------------- */ static herr_t @@ -559,60 +556,60 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) &H5F_def_mdc_initCacheCfg_g, NULL, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_CONFIG_CMP, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the size of raw data chunk cache (elements) */ if (H5P__register_real(pclass, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, H5F_ACS_DATA_CACHE_NUM_SLOTS_SIZE, &H5F_def_rdcc_nslots_g, NULL, NULL, NULL, H5F_ACS_DATA_CACHE_NUM_SLOTS_ENC, H5F_ACS_DATA_CACHE_NUM_SLOTS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the size of raw data chunk cache(bytes) */ if (H5P__register_real(pclass, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, H5F_ACS_DATA_CACHE_BYTE_SIZE_SIZE, &H5F_def_rdcc_nbytes_g, NULL, NULL, NULL, H5F_ACS_DATA_CACHE_BYTE_SIZE_ENC, H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the preemption for reading chunks */ if (H5P__register_real(pclass, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, H5F_ACS_PREEMPT_READ_CHUNKS_SIZE, &H5F_def_rdcc_w0_g, NULL, NULL, NULL, H5F_ACS_PREEMPT_READ_CHUNKS_ENC, H5F_ACS_PREEMPT_READ_CHUNKS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the threshold for alignment */ if (H5P__register_real(pclass, H5F_ACS_ALIGN_THRHD_NAME, H5F_ACS_ALIGN_THRHD_SIZE, &H5F_def_threshold_g, NULL, NULL, NULL, H5F_ACS_ALIGN_THRHD_ENC, H5F_ACS_ALIGN_THRHD_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the alignment */ if (H5P__register_real(pclass, H5F_ACS_ALIGN_NAME, H5F_ACS_ALIGN_SIZE, &H5F_def_alignment_g, NULL, NULL, NULL, H5F_ACS_ALIGN_ENC, H5F_ACS_ALIGN_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the minimum metadata allocation block size */ if (H5P__register_real(pclass, H5F_ACS_META_BLOCK_SIZE_NAME, H5F_ACS_META_BLOCK_SIZE_SIZE, &H5F_def_meta_block_size_g, NULL, NULL, NULL, H5F_ACS_META_BLOCK_SIZE_ENC, H5F_ACS_META_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the maximum sieve buffer size */ if (H5P__register_real(pclass, H5F_ACS_SIEVE_BUF_SIZE_NAME, H5F_ACS_SIEVE_BUF_SIZE_SIZE, &H5F_def_sieve_buf_size_g, NULL, NULL, NULL, H5F_ACS_SIEVE_BUF_SIZE_ENC, H5F_ACS_SIEVE_BUF_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the minimum "small data" allocation block size */ if (H5P__register_real(pclass, H5F_ACS_SDATA_BLOCK_SIZE_NAME, H5F_ACS_SDATA_BLOCK_SIZE_SIZE, &H5F_def_sdata_block_size_g, NULL, NULL, NULL, H5F_ACS_SDATA_BLOCK_SIZE_ENC, H5F_ACS_SDATA_BLOCK_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the garbage collection reference */ if (H5P__register_real(pclass, H5F_ACS_GARBG_COLCT_REF_NAME, H5F_ACS_GARBG_COLCT_REF_SIZE, &H5F_def_gc_ref_g, NULL, NULL, NULL, H5F_ACS_GARBG_COLCT_REF_ENC, H5F_ACS_GARBG_COLCT_REF_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the file driver ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ @@ -620,26 +617,26 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) H5F_ACS_FILE_DRV_CRT, H5F_ACS_FILE_DRV_SET, H5F_ACS_FILE_DRV_GET, NULL, NULL, H5F_ACS_FILE_DRV_DEL, H5F_ACS_FILE_DRV_COPY, H5F_ACS_FILE_DRV_CMP, H5F_ACS_FILE_DRV_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the file close degree */ if (H5P__register_real(pclass, H5F_ACS_CLOSE_DEGREE_NAME, H5F_CLOSE_DEGREE_SIZE, &H5F_def_close_degree_g, NULL, NULL, NULL, H5F_CLOSE_DEGREE_ENC, H5F_CLOSE_DEGREE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the offset of family driver info */ if (H5P__register_real(pclass, H5F_ACS_FAMILY_OFFSET_NAME, H5F_ACS_FAMILY_OFFSET_SIZE, &H5F_def_family_offset_g, NULL, NULL, NULL, H5F_ACS_FAMILY_OFFSET_ENC, H5F_ACS_FAMILY_OFFSET_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the private property of new family file size. It's used by h5repart only. */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5F_ACS_FAMILY_NEWSIZE_NAME, H5F_ACS_FAMILY_NEWSIZE_SIZE, &H5F_def_family_newsize_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the private property of whether convert family to a single-file driver. It's used by h5repart * only. */ @@ -647,25 +644,25 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) if (H5P__register_real(pclass, H5F_ACS_FAMILY_TO_SINGLE_NAME, H5F_ACS_FAMILY_TO_SINGLE_SIZE, &H5F_def_family_to_single_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the data type of multi driver info */ if (H5P__register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g, NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the 'low' bound of library format versions */ if (H5P__register_real(pclass, H5F_ACS_LIBVER_LOW_BOUND_NAME, H5F_ACS_LIBVER_LOW_BOUND_SIZE, &H5F_def_libver_low_bound_g, NULL, NULL, NULL, H5F_ACS_LIBVER_LOW_BOUND_ENC, H5F_ACS_LIBVER_LOW_BOUND_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the 'high' bound of library format versions */ if (H5P__register_real(pclass, H5F_ACS_LIBVER_HIGH_BOUND_NAME, H5F_ACS_LIBVER_HIGH_BOUND_SIZE, &H5F_def_libver_high_bound_g, NULL, NULL, NULL, H5F_ACS_LIBVER_HIGH_BOUND_ENC, H5F_ACS_LIBVER_HIGH_BOUND_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the private property of whether to retrieve the file descriptor from the core VFD */ /* (used internally to the library only) */ @@ -673,13 +670,13 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) if (H5P__register_real(pclass, H5F_ACS_WANT_POSIX_FD_NAME, H5F_ACS_WANT_POSIX_FD_SIZE, &H5F_def_want_posix_fd_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the external file cache size */ if (H5P__register_real(pclass, H5F_ACS_EFC_SIZE_NAME, H5F_ACS_EFC_SIZE_SIZE, &H5F_def_efc_size_g, NULL, NULL, NULL, H5F_ACS_EFC_SIZE_ENC, H5F_ACS_EFC_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the initial file image info */ /* (Note: this property should not have an encode/decode callback -QAK) */ @@ -688,46 +685,46 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) H5F_ACS_FILE_IMAGE_INFO_GET, NULL, NULL, H5F_ACS_FILE_IMAGE_INFO_DEL, H5F_ACS_FILE_IMAGE_INFO_COPY, H5F_ACS_FILE_IMAGE_INFO_CMP, H5F_ACS_FILE_IMAGE_INFO_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the # of read attempts */ if (H5P__register_real(pclass, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, H5F_ACS_METADATA_READ_ATTEMPTS_SIZE, &H5F_def_metadata_read_attempts_g, NULL, NULL, NULL, H5F_ACS_METADATA_READ_ATTEMPTS_ENC, H5F_ACS_METADATA_READ_ATTEMPTS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register object flush callback */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5F_ACS_OBJECT_FLUSH_CB_NAME, H5F_ACS_OBJECT_FLUSH_CB_SIZE, &H5F_def_object_flush_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the private property of whether to clear the superblock status_flags. It's used by h5clear * only. */ if (H5P__register_real(pclass, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, H5F_ACS_CLEAR_STATUS_FLAGS_SIZE, &H5F_def_clear_status_flags_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the private property of whether to skip EOF check. It's used by h5clear only. */ if (H5P__register_real(pclass, H5F_ACS_SKIP_EOF_CHECK_NAME, H5F_ACS_SKIP_EOF_CHECK_SIZE, &H5F_def_skip_eof_check_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the private property of whether to drop free-space to the floor. It's used by h5clear only. */ if (H5P__register_real(pclass, H5F_ACS_NULL_FSM_ADDR_NAME, H5F_ACS_NULL_FSM_ADDR_SIZE, &H5F_def_null_fsm_addr_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the metadata cache logging flag. */ if (H5P__register_real(pclass, H5F_ACS_USE_MDC_LOGGING_NAME, H5F_ACS_USE_MDC_LOGGING_SIZE, &H5F_def_use_mdc_logging_g, NULL, NULL, NULL, H5F_ACS_USE_MDC_LOGGING_ENC, H5F_ACS_USE_MDC_LOGGING_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the metadata cache log location. */ if (H5P__register_real(pclass, H5F_ACS_MDC_LOG_LOCATION_NAME, H5F_ACS_MDC_LOG_LOCATION_SIZE, @@ -735,33 +732,33 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) H5F_ACS_MDC_LOG_LOCATION_DEC, H5F_ACS_MDC_LOG_LOCATION_DEL, H5F_ACS_MDC_LOG_LOCATION_COPY, H5F_ACS_MDC_LOG_LOCATION_CMP, H5F_ACS_MDC_LOG_LOCATION_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the flag that indicates whether mdc logging starts on file access. */ if (H5P__register_real(pclass, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, H5F_ACS_START_MDC_LOG_ON_ACCESS_SIZE, &H5F_def_start_mdc_log_on_access_g, NULL, NULL, NULL, H5F_ACS_START_MDC_LOG_ON_ACCESS_ENC, H5F_ACS_START_MDC_LOG_ON_ACCESS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the evict on close flag */ if (H5P__register_real(pclass, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, H5F_ACS_EVICT_ON_CLOSE_FLAG_SIZE, &H5F_def_evict_on_close_flag_g, NULL, NULL, NULL, H5F_ACS_EVICT_ON_CLOSE_FLAG_ENC, H5F_ACS_EVICT_ON_CLOSE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ if (H5P__register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the metadata collective write flag */ if (H5P__register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the MPI communicator */ if (H5P__register_real(pclass, H5F_ACS_MPI_PARAMS_COMM_NAME, H5F_ACS_MPI_PARAMS_COMM_SIZE, @@ -769,7 +766,7 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) H5F_ACS_MPI_PARAMS_COMM_GET, NULL, NULL, H5F_ACS_MPI_PARAMS_COMM_DEL, H5F_ACS_MPI_PARAMS_COMM_COPY, H5F_ACS_MPI_PARAMS_COMM_CMP, H5F_ACS_MPI_PARAMS_COMM_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the MPI info struct */ if (H5P__register_real(pclass, H5F_ACS_MPI_PARAMS_INFO_NAME, H5F_ACS_MPI_PARAMS_INFO_SIZE, @@ -777,7 +774,7 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) H5F_ACS_MPI_PARAMS_INFO_GET, NULL, NULL, H5F_ACS_MPI_PARAMS_INFO_DEL, H5F_ACS_MPI_PARAMS_INFO_COPY, H5F_ACS_MPI_PARAMS_INFO_CMP, H5F_ACS_MPI_PARAMS_INFO_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); #endif /* H5_HAVE_PARALLEL */ @@ -787,27 +784,27 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_ENC, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_DEC, NULL, NULL, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_CMP, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the size of the page buffer size */ if (H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_SIZE_NAME, H5F_ACS_PAGE_BUFFER_SIZE_SIZE, &H5F_def_page_buf_size_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_SIZE_ENC, H5F_ACS_PAGE_BUFFER_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the size of the page buffer minimum metadata size */ if (H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_SIZE, &H5F_def_page_buf_min_meta_perc_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the size of the page buffer minimum raw data size */ if (H5P__register_real(pclass, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_SIZE, &H5F_def_page_buf_min_raw_perc_g, NULL, NULL, NULL, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_ENC, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the file VOL connector ID & info */ /* (Note: this property should not have an encode/decode callback -QAK) */ @@ -815,20 +812,20 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) H5F_ACS_VOL_CONN_CRT, H5F_ACS_VOL_CONN_SET, H5F_ACS_VOL_CONN_GET, NULL, NULL, H5F_ACS_VOL_CONN_DEL, H5F_ACS_VOL_CONN_COPY, H5F_ACS_VOL_CONN_CMP, H5F_ACS_VOL_CONN_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the use file locking flag */ if (H5P__register_real(pclass, H5F_ACS_USE_FILE_LOCKING_NAME, H5F_ACS_USE_FILE_LOCKING_SIZE, &H5F_def_use_file_locking_g, NULL, NULL, NULL, H5F_ACS_USE_FILE_LOCKING_ENC, H5F_ACS_USE_FILE_LOCKING_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the ignore disabled file locks flag */ if (H5P__register_real(pclass, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_SIZE, &H5F_def_ignore_disabled_file_locks_g, NULL, NULL, NULL, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_ENC, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -867,27 +864,27 @@ H5P__facc_set_def_driver(void) /* Check to see if the driver is already registered */ if ((driver_is_registered = H5FD_is_driver_registered_by_name(driver_env_var, &driver_id)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFL driver is already registered") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check if VFL driver is already registered"); if (driver_is_registered) { - HDassert(driver_id >= 0); + assert(driver_id >= 0); if (H5I_inc_ref(driver_id, TRUE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "unable to increment ref count on VFD") + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "unable to increment ref count on VFD"); driver_ref_inc = TRUE; } /* end else-if */ else { /* Check for VFL drivers that ship with the library */ if (H5P__facc_set_def_driver_check_predefined(driver_env_var, &driver_id) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check for predefined VFL driver name") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't check for predefined VFL driver name"); else if (driver_id > 0) { if (H5I_inc_ref(driver_id, TRUE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "can't increment VFL driver refcount") + HGOTO_ERROR(H5E_VFL, H5E_CANTINC, FAIL, "can't increment VFL driver refcount"); driver_ref_inc = TRUE; } else { /* Register the VFL driver */ if ((driver_id = H5FD_register_driver_by_name(driver_env_var, TRUE)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "can't register VFL driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "can't register VFL driver"); driver_ref_inc = TRUE; } /* end else */ } /* end else */ @@ -902,28 +899,28 @@ H5P__facc_set_def_driver(void) /* Get default file access pclass */ if (NULL == (def_fapclass = (H5P_genclass_t *)H5I_object(H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_VFL, H5E_BADID, FAIL, - "can't find object for default file access property class ID") + "can't find object for default file access property class ID"); /* Set new default VFL driver for default file access pclass */ if (H5P__class_set(def_fapclass, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, - "can't set default VFL driver for default file access property list class") + "can't set default VFL driver for default file access property list class"); /* Get default file access plist */ if (NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_VFL, H5E_BADID, FAIL, "can't find object for default fapl ID") + HGOTO_ERROR(H5E_VFL, H5E_BADID, FAIL, "can't find object for default fapl ID"); /* Set new default VFL driver for default FAPL */ if (H5P_set_driver(def_fapl, driver_prop.driver_id, driver_prop.driver_info, driver_prop.driver_config_str) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default VFL driver for default FAPL") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "can't set default VFL driver for default FAPL"); } done: /* Clean up on error */ if (ret_value < 0) { if (driver_id >= 0 && driver_ref_inc && H5I_dec_app_ref(driver_id) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "unable to unregister VFL driver") + HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "unable to unregister VFL driver"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -949,91 +946,91 @@ H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver FUNC_ENTER_PACKAGE - HDassert(driver_name); - HDassert(driver_id); + assert(driver_name); + assert(driver_id); if (!HDstrcmp(driver_name, "sec2")) { if ((*driver_id = H5FD_SEC2) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize sec2 VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize sec2 VFD"); } else if (!HDstrcmp(driver_name, "core") || !HDstrcmp(driver_name, "core_paged")) { if ((*driver_id = H5FD_CORE) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize core VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize core VFD"); } else if (!HDstrcmp(driver_name, "log")) { if ((*driver_id = H5FD_LOG) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize log VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize log VFD"); } else if (!HDstrcmp(driver_name, "family")) { if ((*driver_id = H5FD_FAMILY) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize family VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize family VFD"); } else if (!HDstrcmp(driver_name, "multi") || !HDstrcmp(driver_name, "split")) { if ((*driver_id = H5FD_MULTI) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize multi VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize multi VFD"); } else if (!HDstrcmp(driver_name, "stdio")) { if ((*driver_id = H5FD_STDIO) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize stdio VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize stdio VFD"); } else if (!HDstrcmp(driver_name, "splitter")) { if ((*driver_id = H5FD_SPLITTER) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize splitter VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize splitter VFD"); } else if (!HDstrcmp(driver_name, "mpio")) { #ifdef H5_HAVE_PARALLEL if ((*driver_id = H5FD_MPIO) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize MPI I/O VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize MPI I/O VFD"); #else - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "MPI-I/O VFD is not enabled") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "MPI-I/O VFD is not enabled"); #endif } else if (!HDstrcmp(driver_name, "direct")) { #ifdef H5_HAVE_DIRECT if ((*driver_id = H5FD_DIRECT) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Direct I/O VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Direct I/O VFD"); #else - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Direct I/O VFD is not enabled") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Direct I/O VFD is not enabled"); #endif } else if (!HDstrcmp(driver_name, "mirror")) { #ifdef H5_HAVE_MIRROR_VFD if ((*driver_id = H5FD_MIRROR) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize mirror VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize mirror VFD"); #else - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Mirror VFD is not enabled") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Mirror VFD is not enabled"); #endif } else if (!HDstrcmp(driver_name, "hdfs")) { #ifdef H5_HAVE_LIBHDFS if ((*driver_id = H5FD_HDFS) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize HDFS VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize HDFS VFD"); #else - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "HDFS VFD is not enabled") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "HDFS VFD is not enabled"); #endif } else if (!HDstrcmp(driver_name, "ros3")) { #ifdef H5_HAVE_ROS3_VFD if ((*driver_id = H5FD_ROS3) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize ROS3 VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize ROS3 VFD"); #else - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "ROS3 VFD is not enabled") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "ROS3 VFD is not enabled"); #endif } else if (!HDstrcmp(driver_name, "subfiling")) { #ifdef H5_HAVE_SUBFILING_VFD if ((*driver_id = H5FD_SUBFILING) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Subfiling VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Subfiling VFD"); #else - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Subfiling VFD is not enabled") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Subfiling VFD is not enabled"); #endif } else if (!HDstrcmp(driver_name, "windows")) { #ifdef H5_HAVE_WINDOWS if ((*driver_id = H5FD_WINDOWS) < 0) - HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Windows VFD") + HGOTO_ERROR(H5E_VFL, H5E_UNINITIALIZED, FAIL, "couldn't initialize Windows VFD"); #else - HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Windows VFD is not enabled") + HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "Windows VFD is not enabled"); #endif } else { @@ -1063,9 +1060,6 @@ H5P__facc_set_def_driver_check_predefined(const char *driver_name, hid_t *driver * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, June 9, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1079,17 +1073,17 @@ H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment) /* Check args */ if (alignment < 1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "alignment must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "alignment must be positive"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_ALIGN_THRHD_NAME, &threshold) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set threshold") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set threshold"); if (H5P_set(plist, H5F_ACS_ALIGN_NAME, &alignment) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set alignment"); done: FUNC_LEAVE_API(ret_value) @@ -1104,9 +1098,6 @@ H5Pset_alignment(hid_t fapl_id, hsize_t threshold, hsize_t alignment) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, June 9, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1120,15 +1111,15 @@ H5Pget_alignment(hid_t fapl_id, hsize_t *threshold /*out*/, hsize_t *alignment / /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (threshold) if (H5P_get(plist, H5F_ACS_ALIGN_THRHD_NAME, threshold) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get threshold") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get threshold"); if (alignment) if (H5P_get(plist, H5F_ACS_ALIGN_NAME, alignment) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get alignment"); done: FUNC_LEAVE_API(ret_value) @@ -1151,9 +1142,6 @@ H5Pget_alignment(hid_t fapl_id, hsize_t *threshold /*out*/, hsize_t *alignment / * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, August 3, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -1167,10 +1155,10 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive /* If VFD configuration information is supplied, ensure that either binary * configuration data or a configuration string is supplied, but not both. */ - HDassert(!new_driver_info || !new_driver_config_str); + assert(!new_driver_info || !new_driver_config_str); if (NULL == H5I_object_verify(new_driver_id, H5I_VFL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID"); if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & config. string */ @@ -1182,10 +1170,10 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive /* Set the driver ID, info & config. string property */ if (H5P_set(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver ID & info"); } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1205,9 +1193,6 @@ H5P_set_driver(H5P_genplist_t *plist, hid_t new_driver_id, const void *new_drive * Return: Success: Non-negative * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, August 3, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -1221,13 +1206,13 @@ H5Pset_driver(hid_t plist_id, hid_t new_driver_id, const void *new_driver_info) /* Check arguments */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if (NULL == H5I_object_verify(new_driver_id, H5I_VFL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file driver ID"); /* Set the driver */ if (H5P_set_driver(plist, new_driver_id, new_driver_info, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info"); done: FUNC_LEAVE_API(ret_value) @@ -1259,21 +1244,21 @@ H5P_set_driver_by_name(H5P_genplist_t *plist, const char *driver_name, const cha FUNC_ENTER_NOAPI(FAIL) - HDassert(plist); - HDassert(driver_name); + assert(plist); + assert(driver_name); /* Register the driver */ if ((new_driver_id = H5FD_register_driver_by_name(driver_name, app_ref)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register VFD") + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register VFD"); /* Set the driver */ if (H5P_set_driver(plist, new_driver_id, NULL, driver_config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info"); done: if (ret_value < 0) { if (new_driver_id >= 0 && H5I_dec_app_ref(new_driver_id) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement count on VFD ID") + HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement count on VFD ID"); } FUNC_LEAVE_NOAPI(ret_value) @@ -1307,15 +1292,15 @@ H5Pset_driver_by_name(hid_t plist_id, const char *driver_name, const char *drive /* Check arguments */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if (!driver_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "driver_name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "driver_name parameter cannot be NULL"); if (!*driver_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "driver_name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "driver_name parameter cannot be an empty string"); /* Set the driver */ if (H5P_set_driver_by_name(plist, driver_name, driver_config, TRUE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info"); done: FUNC_LEAVE_API(ret_value) @@ -1347,21 +1332,21 @@ H5P_set_driver_by_value(H5P_genplist_t *plist, H5FD_class_value_t driver_value, FUNC_ENTER_NOAPI(FAIL) - HDassert(plist); - HDassert(driver_value >= 0); + assert(plist); + assert(driver_value >= 0); /* Register the driver */ if ((new_driver_id = H5FD_register_driver_by_value(driver_value, app_ref)) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register VFD") + HGOTO_ERROR(H5E_VFL, H5E_CANTREGISTER, FAIL, "unable to register VFD"); /* Set the driver */ if (H5P_set_driver(plist, new_driver_id, NULL, driver_config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info"); done: if (ret_value < 0) { if (new_driver_id >= 0 && H5I_dec_app_ref(new_driver_id) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement count on VFD ID") + HDONE_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement count on VFD ID"); } FUNC_LEAVE_NOAPI(ret_value) @@ -1395,13 +1380,13 @@ H5Pset_driver_by_value(hid_t plist_id, H5FD_class_value_t driver_value, const ch /* Check arguments */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if (driver_value < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "negative VFD value is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "negative VFD value is disallowed"); /* Set the driver */ if (H5P_set_driver_by_value(plist, driver_value, driver_config, TRUE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set driver info"); done: FUNC_LEAVE_API(ret_value) @@ -1420,9 +1405,6 @@ H5Pset_driver_by_value(hid_t plist_id, H5FD_class_value_t driver_value, const ch * * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 - * *------------------------------------------------------------------------- */ hid_t @@ -1437,11 +1419,11 @@ H5P_peek_driver(H5P_genplist_t *plist) H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & configuration string */ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver ID"); ret_value = driver_prop.driver_id; } /* end if */ else - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5FD_VFD_DEFAULT == ret_value) ret_value = H5_DEFAULT_VFD; @@ -1465,9 +1447,6 @@ H5P_peek_driver(H5P_genplist_t *plist) * * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, February 26, 1998 - * *------------------------------------------------------------------------- */ hid_t @@ -1480,11 +1459,11 @@ H5Pget_driver(hid_t plist_id) H5TRACE1("i", "i", plist_id); if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get the driver */ if ((ret_value = H5P_peek_driver(plist)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get driver"); done: FUNC_LEAVE_API(ret_value) @@ -1504,9 +1483,6 @@ H5Pget_driver(hid_t plist_id) * although no error is pushed on the stack in * this case. * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ const void * @@ -1521,11 +1497,11 @@ H5P_peek_driver_info(H5P_genplist_t *plist) H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & configuration string */ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info"); ret_value = driver_prop.driver_info; } /* end if */ else - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1545,9 +1521,6 @@ H5P_peek_driver_info(H5P_genplist_t *plist) * although no error is pushed on the stack in * this case. * - * Programmer: Robb Matzke - * Wednesday, August 4, 1999 - * *------------------------------------------------------------------------- */ const void * @@ -1560,11 +1533,11 @@ H5Pget_driver_info(hid_t plist_id) H5TRACE1("*x", "i", plist_id); if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); /* Get the driver info */ if (NULL == (ret_value = (const void *)H5P_peek_driver_info(plist))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver info"); done: FUNC_LEAVE_API(ret_value) @@ -1596,11 +1569,11 @@ H5P_peek_driver_config_str(H5P_genplist_t *plist) H5FD_driver_prop_t driver_prop; /* Property for driver ID, info & configuration string */ if (H5P_peek(plist, H5F_ACS_FILE_DRV_NAME, &driver_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver configuration string") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get driver configuration string"); ret_value = driver_prop.driver_config_str; } /* end if */ else - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a file access property list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1636,11 +1609,11 @@ H5Pget_driver_config_str(hid_t fapl_id, char *config_buf, size_t buf_size) /* Check arguments */ if (!config_buf && buf_size) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "config_buf cannot be NULL if buf_size is non-zero") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "config_buf cannot be NULL if buf_size is non-zero"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, (-1), "can't find object for ID"); /* Retrieve configuration string property */ if ((config_str = H5P_peek_driver_config_str(plist))) { @@ -1673,9 +1646,6 @@ H5Pget_driver_config_str(hid_t fapl_id, char *config_buf, size_t buf_size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, Sept 8, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1692,7 +1662,7 @@ H5P__file_driver_copy(void *value) if (info->driver_id > 0) { /* Increment the reference count on driver and copy driver info */ if (H5I_inc_ref(info->driver_id, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VFL driver"); /* Copy driver info, if it exists */ if (info->driver_info) { @@ -1701,20 +1671,20 @@ H5P__file_driver_copy(void *value) /* Retrieve the driver for the ID */ if (NULL == (driver = (H5FD_class_t *)H5I_object(info->driver_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a driver ID") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a driver ID"); /* Allow the driver to copy or do it ourselves */ if (driver->fapl_copy) { if (NULL == (new_pl = (driver->fapl_copy)(info->driver_info))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver info copy failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver info copy failed"); } /* end if */ else if (driver->fapl_size > 0) { if (NULL == (new_pl = H5MM_malloc(driver->fapl_size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed"); H5MM_memcpy(new_pl, info->driver_info, driver->fapl_size); } /* end else-if */ else - HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info") + HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info"); /* Set the driver info for the copy */ info->driver_info = new_pl; @@ -1725,7 +1695,7 @@ H5P__file_driver_copy(void *value) char *new_config_str = NULL; if (NULL == (new_config_str = H5MM_strdup(info->driver_config_str))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver configuration string copy failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "driver configuration string copy failed"); info->driver_config_str = new_config_str; } /* end if */ } /* end if */ @@ -1743,9 +1713,6 @@ H5P__file_driver_copy(void *value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, Sept 8, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1763,14 +1730,14 @@ H5P__file_driver_free(void *value) /* Free the driver info, if it exists */ if (info->driver_info) if (H5FD_free_driver_info(info->driver_id, info->driver_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "driver info free request failed"); /* Free the driver configuration string, if it exists */ H5MM_xfree_const(info->driver_config_str); /* Decrement reference count for driver */ if (H5I_dec_ref(info->driver_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDEC, FAIL, "can't decrement reference count for driver ID"); } } @@ -1786,9 +1753,6 @@ H5P__file_driver_free(void *value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, September 8, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1800,7 +1764,7 @@ H5P__facc_file_driver_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNU /* Make copy of file driver */ if (H5P__file_driver_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1814,9 +1778,6 @@ H5P__facc_file_driver_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNU * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, Sept 7, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1828,11 +1789,11 @@ H5P__facc_file_driver_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSE FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of file driver ID & info */ if (H5P__file_driver_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1846,9 +1807,6 @@ H5P__facc_file_driver_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSE * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, Sept 7, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1860,11 +1818,11 @@ H5P__facc_file_driver_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSE FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of file driver */ if (H5P__file_driver_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1878,9 +1836,6 @@ H5P__facc_file_driver_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSE * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, September 8, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1893,7 +1848,7 @@ H5P__facc_file_driver_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSE /* Free the file driver ID & info */ if (H5P__file_driver_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file driver"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1907,9 +1862,6 @@ H5P__facc_file_driver_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSE * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, September 8, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1921,7 +1873,7 @@ H5P__facc_file_driver_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE /* Make copy of file driver */ if (H5P__file_driver_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file driver"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1937,9 +1889,6 @@ H5P__facc_file_driver_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE * VALUE2 is greater than VALUE1 and zero if VALUE1 and * VALUE2 are equal. * - * Programmer: Quincey Koziol - * Monday, September 8, 2015 - * *------------------------------------------------------------------------- */ static int @@ -1955,15 +1904,15 @@ H5P__facc_file_driver_cmp(const void *_info1, const void *_info2, size_t H5_ATTR FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(info1); - HDassert(info2); - HDassert(size == sizeof(H5FD_driver_prop_t)); + assert(info1); + assert(info2); + assert(size == sizeof(H5FD_driver_prop_t)); /* Compare drivers */ if (NULL == (cls1 = H5FD_get_class(info1->driver_id))) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (NULL == (cls2 = H5FD_get_class(info2->driver_id))) - HGOTO_DONE(1) + HGOTO_DONE(1); if (cls1->name == NULL && cls2->name != NULL) HGOTO_DONE(-1); if (cls1->name != NULL && cls2->name == NULL) @@ -1973,17 +1922,17 @@ H5P__facc_file_driver_cmp(const void *_info1, const void *_info2, size_t H5_ATTR /* Compare driver infos */ if (cls1->fapl_size < cls2->fapl_size) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (cls1->fapl_size > cls2->fapl_size) - HGOTO_DONE(1) - HDassert(cls1->fapl_size == cls2->fapl_size); + HGOTO_DONE(1); + assert(cls1->fapl_size == cls2->fapl_size); if (info1->driver_info == NULL && info2->driver_info != NULL) HGOTO_DONE(-1); if (info1->driver_info != NULL && info2->driver_info == NULL) HGOTO_DONE(1); if (info1->driver_info) { - HDassert(cls1->fapl_size > 0); - if (0 != (cmp_value = HDmemcmp(info1->driver_info, info2->driver_info, cls1->fapl_size))) + assert(cls1->fapl_size > 0); + if (0 != (cmp_value = memcmp(info1->driver_info, info2->driver_info, cls1->fapl_size))) HGOTO_DONE(cmp_value); } /* end if */ @@ -2009,9 +1958,6 @@ H5P__facc_file_driver_cmp(const void *_info1, const void *_info2, size_t H5_ATTR * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, September 8, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -2023,7 +1969,7 @@ H5P__facc_file_driver_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUS /* Free the file driver */ if (H5P__file_driver_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file driver"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2039,9 +1985,6 @@ H5P__facc_file_driver_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUS * Return: Success: Non-negative value. * Failure: Negative value. * - * Programmer: Raymond Lu - * Sep 17, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -2055,13 +1998,13 @@ H5Pset_family_offset(hid_t fapl_id, hsize_t offset) /* Get the plist structure */ if (H5P_DEFAULT == fapl_id) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list"); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set value */ if (H5P_set(plist, H5F_ACS_FAMILY_OFFSET_NAME, &offset) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set offset for family file") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set offset for family file"); done: FUNC_LEAVE_API(ret_value) @@ -2077,9 +2020,6 @@ H5Pset_family_offset(hid_t fapl_id, hsize_t offset) * Return: Success: Non-negative value. * Failure: Negative value. * - * Programmer: Raymond Lu - * Sep 17, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -2093,14 +2033,14 @@ H5Pget_family_offset(hid_t fapl_id, hsize_t *offset /*out*/) /* Get the plist structure */ if (H5P_DEFAULT == fapl_id) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list"); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (offset) { if (H5P_get(plist, H5F_ACS_FAMILY_OFFSET_NAME, offset) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set offset for family file") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set offset for family file"); } /* end if */ done: @@ -2117,9 +2057,6 @@ H5Pget_family_offset(hid_t fapl_id, hsize_t *offset /*out*/) * Return: Success: Non-negative value. * Failure: Negative value. * - * Programmer: Raymond Lu - * Sep 17, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -2133,13 +2070,13 @@ H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type) /* Get the plist structure */ if (H5P_DEFAULT == fapl_id) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list"); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set value */ if (H5P_set(plist, H5F_ACS_MULTI_TYPE_NAME, &type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set type for multi driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set type for multi driver"); done: FUNC_LEAVE_API(ret_value) @@ -2155,9 +2092,6 @@ H5Pset_multi_type(hid_t fapl_id, H5FD_mem_t type) * Return: Success: Non-negative value. * Failure: Negative value. * - * Programmer: Raymond Lu - * Sep 17, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -2171,14 +2105,14 @@ H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type /*out*/) /* Get the plist structure */ if (H5P_DEFAULT == fapl_id) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list"); if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (type) { if (H5P_get(plist, H5F_ACS_MULTI_TYPE_NAME, type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get type for multi driver") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get type for multi driver"); } /* end if */ done: @@ -2202,9 +2136,6 @@ H5Pget_multi_type(hid_t fapl_id, H5FD_mem_t *type /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, May 19, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2220,19 +2151,19 @@ H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, size_t rdcc_nslots, /* Check arguments */ if (rdcc_w0 < 0.0 || rdcc_w0 > 1.0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "raw data cache w0 value must be between 0.0 and 1.0 inclusive") + "raw data cache w0 value must be between 0.0 and 1.0 inclusive"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set sizes */ if (H5P_set(plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, &rdcc_nslots) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache number of slots"); if (H5P_set(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, &rdcc_nbytes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set data cache byte size"); if (H5P_set(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, &rdcc_w0) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks"); done: FUNC_LEAVE_API(ret_value) @@ -2249,9 +2180,6 @@ H5Pset_cache(hid_t plist_id, int H5_ATTR_UNUSED mdc_nelmts, size_t rdcc_nslots, * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, May 19, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2266,7 +2194,7 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts, size_t *rdcc_nslots /*out*/, size_ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get sizes */ @@ -2276,13 +2204,13 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts, size_t *rdcc_nslots /*out*/, size_ if (rdcc_nslots) if (H5P_get(plist, H5F_ACS_DATA_CACHE_NUM_SLOTS_NAME, rdcc_nslots) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get data cache number of slots") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get data cache number of slots"); if (rdcc_nbytes) if (H5P_get(plist, H5F_ACS_DATA_CACHE_BYTE_SIZE_NAME, rdcc_nbytes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get data cache byte size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get data cache byte size"); if (rdcc_w0) if (H5P_get(plist, H5F_ACS_PREEMPT_READ_CHUNKS_NAME, rdcc_w0) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get preempt read chunks") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get preempt read chunks"); done: FUNC_LEAVE_API(ret_value) @@ -2296,9 +2224,6 @@ H5Pget_cache(hid_t plist_id, int *mdc_nelmts, size_t *rdcc_nslots /*out*/, size_ * * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer - * Thursday, June 25, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -2312,11 +2237,11 @@ H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* validate the new configuration */ if (H5AC_validate_cache_image_config(config_ptr) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid metadata cache image configuration") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid metadata cache image configuration"); /* set the modified metadata cache image config */ @@ -2325,7 +2250,7 @@ H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr) */ if (H5P_set(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, config_ptr) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache image initial config") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache image initial config"); done: FUNC_LEAVE_API(ret_value) @@ -2343,9 +2268,6 @@ H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer - * Friday, June 26, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -2359,13 +2281,13 @@ H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config /*out* /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* validate the config ptr */ if (config == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config ptr on entry.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config ptr on entry."); if (config->version != H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown image config version.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown image config version."); /* If we ever support multiple versions of H5AC_cache_config_t, we * will have to get the canonical version here, and then translate @@ -2374,7 +2296,7 @@ H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config /*out* /* Get the current initial metadata cache resize configuration */ if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_IMAGE_CONFIG_NAME, config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get metadata cache initial image config") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get metadata cache initial image config"); done: FUNC_LEAVE_API(ret_value) @@ -2388,9 +2310,6 @@ H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config /*out* * * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer - * Thursday, April 7, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -2404,11 +2323,11 @@ H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* validate the new configuration */ if (H5AC_validate_config(config_ptr) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid metadata cache configuration") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid metadata cache configuration"); /* set the modified config */ @@ -2417,7 +2336,7 @@ H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) */ if (H5P_set(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache initial config") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache initial config"); done: FUNC_LEAVE_API(ret_value) @@ -2435,9 +2354,6 @@ H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) * * Return: Non-negative on success/Negative on failure * - * Programmer: J. Mainzer - * Thursday, April 7, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -2451,13 +2367,13 @@ H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* validate the config ptr */ if (config == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config ptr on entry.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config ptr on entry."); if (config->version != H5AC__CURR_CACHE_CONFIG_VERSION) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version."); /* If we ever support multiple versions of H5AC_cache_config_t, we * will have to get the canonical version here, and then translate @@ -2466,7 +2382,7 @@ H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config /*out*/) /* Get the current initial metadata cache resize configuration */ if (H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get metadata cache initial resize config") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get metadata cache initial resize config"); done: FUNC_LEAVE_API(ret_value) @@ -2491,9 +2407,6 @@ H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * June, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -2507,11 +2420,11 @@ H5Pset_gc_references(hid_t plist_id, unsigned gc_ref) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_GARBG_COLCT_REF_NAME, &gc_ref) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set garbage collect reference"); done: FUNC_LEAVE_API(ret_value) @@ -2525,9 +2438,6 @@ H5Pset_gc_references(hid_t plist_id, unsigned gc_ref) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * June, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -2541,12 +2451,12 @@ H5Pget_gc_references(hid_t plist_id, unsigned *gc_ref /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (gc_ref) if (H5P_get(plist, H5F_ACS_GARBG_COLCT_REF_NAME, gc_ref) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get garbage collect reference") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get garbage collect reference"); done: FUNC_LEAVE_API(ret_value) @@ -2559,9 +2469,6 @@ H5Pget_gc_references(hid_t plist_id, unsigned *gc_ref /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * November, 2001 - * *------------------------------------------------------------------------- */ herr_t @@ -2575,11 +2482,11 @@ H5Pset_fclose_degree(hid_t plist_id, H5F_close_degree_t degree) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_CLOSE_DEGREE_NAME, °ree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file close degree"); done: FUNC_LEAVE_API(ret_value) @@ -2592,9 +2499,6 @@ H5Pset_fclose_degree(hid_t plist_id, H5F_close_degree_t degree) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * November, 2001 - * *------------------------------------------------------------------------- */ herr_t @@ -2608,10 +2512,10 @@ H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (degree && H5P_get(plist, H5F_ACS_CLOSE_DEGREE_NAME, degree) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file close degree"); done: FUNC_LEAVE_API(ret_value) @@ -2634,9 +2538,6 @@ H5Pget_fclose_degree(hid_t plist_id, H5F_close_degree_t *degree /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, August 25, 2000 - * *------------------------------------------------------------------------- */ herr_t @@ -2650,11 +2551,11 @@ H5Pset_meta_block_size(hid_t plist_id, hsize_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set meta data block size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set meta data block size"); done: FUNC_LEAVE_API(ret_value) @@ -2668,9 +2569,6 @@ H5Pset_meta_block_size(hid_t plist_id, hsize_t size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, August 29, 2000 - * *------------------------------------------------------------------------- */ herr_t @@ -2684,12 +2582,12 @@ H5Pget_meta_block_size(hid_t plist_id, hsize_t *size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (size) { if (H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get meta data block size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get meta data block size"); } /* end if */ done: @@ -2713,9 +2611,6 @@ H5Pget_meta_block_size(hid_t plist_id, hsize_t *size /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, September 21, 2000 - * *------------------------------------------------------------------------- */ herr_t @@ -2729,11 +2624,11 @@ H5Pset_sieve_buf_size(hid_t plist_id, size_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set sieve buffer size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set sieve buffer size"); done: FUNC_LEAVE_API(ret_value) @@ -2747,9 +2642,6 @@ H5Pset_sieve_buf_size(hid_t plist_id, size_t size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, September 21, 2000 - * *------------------------------------------------------------------------- */ herr_t @@ -2763,12 +2655,12 @@ H5Pget_sieve_buf_size(hid_t plist_id, size_t *size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (size) if (H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get sieve buffer size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get sieve buffer size"); done: FUNC_LEAVE_API(ret_value) @@ -2791,9 +2683,6 @@ H5Pget_sieve_buf_size(hid_t plist_id, size_t *size /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 5, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -2807,11 +2696,11 @@ H5Pset_small_data_block_size(hid_t plist_id, hsize_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' block size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' block size"); done: FUNC_LEAVE_API(ret_value) @@ -2825,9 +2714,6 @@ H5Pset_small_data_block_size(hid_t plist_id, hsize_t size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 5, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -2841,12 +2727,12 @@ H5Pget_small_data_block_size(hid_t plist_id, hsize_t *size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (size) { if (H5P_get(plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get 'small data' block size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get 'small data' block size"); } /* end if */ done: @@ -2952,9 +2838,6 @@ H5Pget_small_data_block_size(hid_t plist_id, hsize_t *size /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Sunday, December 30, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2968,27 +2851,27 @@ H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high) /* Check args */ if (low < 0 || low > H5F_LIBVER_LATEST) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "low bound is not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "low bound is not valid"); if (high < 0 || high > H5F_LIBVER_LATEST) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "high bound is not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "high bound is not valid"); /* (earliest, earliest), (latest, earliest), (v18, earliest) are not valid combinations */ if (high == H5F_LIBVER_EARLIEST) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid (low,high) combination of library version bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid (low,high) combination of library version bound"); /* (latest, v18) is not valid combination */ if (high < low) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid (low,high) combination of library version bound") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid (low,high) combination of library version bound"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, &low) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set low bound for library format versions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set low bound for library format versions"); if (H5P_set(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, &high) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set high bound for library format versions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set high bound for library format versions"); done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_libver_bounds() */ @@ -3001,9 +2884,6 @@ H5Pset_libver_bounds(hid_t plist_id, H5F_libver_t low, H5F_libver_t high) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, January 3, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -3017,16 +2897,16 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low /*out*/, H5F_libver_t *hi /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (low) if (H5P_get(plist, H5F_ACS_LIBVER_LOW_BOUND_NAME, low) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get low bound for library format versions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get low bound for library format versions"); if (high) if (H5P_get(plist, H5F_ACS_LIBVER_HIGH_BOUND_NAME, high) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get high bound for library format versions") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get high bound for library format versions"); done: FUNC_LEAVE_API(ret_value) @@ -3043,9 +2923,6 @@ H5Pget_libver_bounds(hid_t plist_id, H5F_libver_t *low /*out*/, H5F_libver_t *hi * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Friday, December 17, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -3059,11 +2936,11 @@ H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set value */ if (H5P_set(plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set elink file cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set elink file cache size"); done: FUNC_LEAVE_API(ret_value) @@ -3080,9 +2957,6 @@ H5Pset_elink_file_cache_size(hid_t plist_id, unsigned efc_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Friday, December 17, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -3096,12 +2970,12 @@ H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (efc_size) if (H5P_get(plist, H5F_ACS_EFC_SIZE_NAME, efc_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink file cache size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get elink file cache size"); done: FUNC_LEAVE_API(ret_value) @@ -3115,9 +2989,6 @@ H5Pget_elink_file_cache_size(hid_t plist_id, unsigned *efc_size /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -3132,15 +3003,15 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) /* validate parameters */ if (!(((buf_ptr == NULL) && (buf_len == 0)) || ((buf_ptr != NULL) && (buf_len > 0)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistent buf_ptr and buf_len") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "inconsistent buf_ptr and buf_len"); /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get old image info */ if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image pointer") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image pointer"); /* Release previous buffer, if it exists */ if (image_info.buffer != NULL) { @@ -3148,7 +3019,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) if (SUCCEED != image_info.callbacks.image_free(image_info.buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, image_info.callbacks.udata)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "image_free callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "image_free callback failed"); } /* end if */ else H5MM_xfree(image_info.buffer); @@ -3160,17 +3031,17 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) if (image_info.callbacks.image_malloc) { if (NULL == (image_info.buffer = image_info.callbacks.image_malloc( buf_len, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, image_info.callbacks.udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "image malloc callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "image malloc callback failed"); } /* end if */ else if (NULL == (image_info.buffer = H5MM_malloc(buf_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory block"); /* Copy data */ if (image_info.callbacks.image_memcpy) { if (image_info.buffer != image_info.callbacks.image_memcpy(image_info.buffer, buf_ptr, buf_len, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_SET, image_info.callbacks.udata)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed"); } /* end if */ else H5MM_memcpy(image_info.buffer, buf_ptr, buf_len); @@ -3182,7 +3053,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) /* Set values */ if (H5P_poke(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file image info"); done: FUNC_LEAVE_API(ret_value) @@ -3212,9 +3083,6 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -3229,15 +3097,15 @@ H5Pget_file_image(hid_t fapl_id, void **buf /*out*/, size_t *buf_len /*out*/) /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &image_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info"); /* verify file image field consistency */ - HDassert(((image_info.buffer != NULL) && (image_info.size > 0)) || - ((image_info.buffer == NULL) && (image_info.size == 0))); + assert(((image_info.buffer != NULL) && (image_info.size > 0)) || + ((image_info.buffer == NULL) && (image_info.size == 0))); /* Set output size */ if (buf_len != NULL) @@ -3253,17 +3121,17 @@ H5Pget_file_image(hid_t fapl_id, void **buf /*out*/, size_t *buf_len /*out*/) if (NULL == (copy_ptr = image_info.callbacks.image_malloc( image_info.size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, image_info.callbacks.udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "image malloc callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "image malloc callback failed"); } /* end if */ else if (NULL == (copy_ptr = H5MM_malloc(image_info.size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate copy") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate copy"); /* Copy data */ if (image_info.callbacks.image_memcpy) { if (copy_ptr != image_info.callbacks.image_memcpy( copy_ptr, image_info.buffer, image_info.size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_GET, image_info.callbacks.udata)) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed"); } /* end if */ else H5MM_memcpy(copy_ptr, image_info.buffer, image_info.size); @@ -3287,9 +3155,6 @@ H5Pget_file_image(hid_t fapl_id, void **buf /*out*/, size_t *buf_len /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -3304,50 +3169,50 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get old info */ if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get old file image info"); /* verify file image field consistency */ - HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); + assert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); /* Make sure a file image hasn't already been set */ if (info.buffer != NULL || info.size > 0) HGOTO_ERROR( H5E_PLIST, H5E_SETDISALLOWED, FAIL, - "setting callbacks when an image is already set is forbidden. It could cause memory leaks.") + "setting callbacks when an image is already set is forbidden. It could cause memory leaks."); /* verify that callbacks_ptr is not NULL */ if (NULL == callbacks_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks_ptr"); /* Make sure udata callbacks are going to be set if udata is going to be set */ if (callbacks_ptr->udata) if (callbacks_ptr->udata_copy == NULL || callbacks_ptr->udata_free == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_SETDISALLOWED, FAIL, "udata callbacks must be set if udata is set") + HGOTO_ERROR(H5E_PLIST, H5E_SETDISALLOWED, FAIL, "udata callbacks must be set if udata is set"); /* Release old udata if it exists */ if (info.callbacks.udata != NULL) { - HDassert(info.callbacks.udata_free); + assert(info.callbacks.udata_free); if (info.callbacks.udata_free(info.callbacks.udata) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "udata_free callback failed"); } /* end if */ /* Update struct */ info.callbacks = *callbacks_ptr; if (callbacks_ptr->udata) { - HDassert(callbacks_ptr->udata_copy); - HDassert(callbacks_ptr->udata_free); + assert(callbacks_ptr->udata_copy); + assert(callbacks_ptr->udata_free); if ((info.callbacks.udata = callbacks_ptr->udata_copy(callbacks_ptr->udata)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't copy the supplied udata") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't copy the supplied udata"); } /* end if */ /* Set values */ if (H5P_poke(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file image info"); done: FUNC_LEAVE_API(ret_value) @@ -3363,9 +3228,6 @@ H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback * * Return: Non-negative on success/Negative on failure * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -3380,27 +3242,27 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback /* Get the plist structure */ if (NULL == (fapl = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get old info */ if (H5P_peek(fapl, H5F_ACS_FILE_IMAGE_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file image info"); /* verify file image field consistency */ - HDassert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); + assert(((info.buffer != NULL) && (info.size > 0)) || ((info.buffer == NULL) && (info.size == 0))); /* verify that callbacks is not NULL */ if (NULL == callbacks) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks ptr") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL callbacks ptr"); /* Transfer values to parameters */ *callbacks = info.callbacks; /* Copy udata if it exists */ if (info.callbacks.udata != NULL) { - HDassert(info.callbacks.udata_copy); + assert(info.callbacks.udata_copy); if ((callbacks->udata = info.callbacks.udata_copy(info.callbacks.udata)) == 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't copy udata") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't copy udata"); } /* end if */ done: @@ -3421,9 +3283,6 @@ H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callback * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -3439,8 +3298,7 @@ H5P__file_image_info_copy(void *value) info = (H5FD_file_image_info_t *)value; /* verify file image field consistency */ - HDassert(((info->buffer != NULL) && (info->size > 0)) || - ((info->buffer == NULL) && (info->size == 0))); + assert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); if (info->buffer && info->size > 0) { void *old_buffer; /* Pointer to old image buffer */ @@ -3452,11 +3310,11 @@ H5P__file_image_info_copy(void *value) if (info->callbacks.image_malloc) { if (NULL == (info->buffer = info->callbacks.image_malloc( info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "image malloc callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "image malloc callback failed"); } /* end if */ else { if (NULL == (info->buffer = H5MM_malloc(info->size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory block") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory block"); } /* end else */ /* Copy data to new buffer */ @@ -3464,7 +3322,7 @@ H5P__file_image_info_copy(void *value) if (info->buffer != info->callbacks.image_memcpy(info->buffer, old_buffer, info->size, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_COPY, info->callbacks.udata)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed"); } /* end if */ else H5MM_memcpy(info->buffer, old_buffer, info->size); @@ -3475,7 +3333,7 @@ H5P__file_image_info_copy(void *value) void *old_udata = info->callbacks.udata; if (NULL == info->callbacks.udata_copy) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "udata_copy not defined") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "udata_copy not defined"); info->callbacks.udata = info->callbacks.udata_copy(old_udata); } /* end if */ @@ -3495,9 +3353,6 @@ H5P__file_image_info_copy(void *value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, Sept 2, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -3513,15 +3368,14 @@ H5P__file_image_info_free(void *value) info = (H5FD_file_image_info_t *)value; /* Verify file image field consistency */ - HDassert(((info->buffer != NULL) && (info->size > 0)) || - ((info->buffer == NULL) && (info->size == 0))); + assert(((info->buffer != NULL) && (info->size > 0)) || ((info->buffer == NULL) && (info->size == 0))); /* Free buffer */ if (info->buffer != NULL && info->size > 0) { if (info->callbacks.image_free) { if ((*info->callbacks.image_free)(info->buffer, H5FD_FILE_IMAGE_OP_PROPERTY_LIST_CLOSE, info->callbacks.udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "image_free callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "image_free callback failed"); } /* end if */ else H5MM_xfree(info->buffer); @@ -3530,9 +3384,9 @@ H5P__file_image_info_free(void *value) /* Free udata if it exists */ if (info->callbacks.udata) { if (NULL == info->callbacks.udata_free) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "udata_free not defined") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "udata_free not defined"); if ((*info->callbacks.udata_free)(info->callbacks.udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "udata_free callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "udata_free callback failed"); } /* end if */ } /* end if */ @@ -3548,9 +3402,6 @@ H5P__file_image_info_free(void *value) * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. * - * Programmer: John Mainzer - * June 26, 2015 - * *------------------------------------------------------------------------- */ static int @@ -3604,9 +3455,6 @@ H5P__facc_cache_image_config_cmp(const void *_config1, const void *_config2, siz * Return: Success: Non-negative * Failure: Negative * - * Programmer: John Mainzer - * June 26, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -3619,7 +3467,7 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(value); + assert(value); if (NULL != *pp) { /* Encode type sizes (as a safety check) */ @@ -3650,9 +3498,6 @@ H5P__facc_cache_image_config_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: John Mainzer - * June 26, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -3666,9 +3511,9 @@ H5P__facc_cache_image_config_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(config); + assert(pp); + assert(*pp); + assert(config); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); /* Set property to default value */ @@ -3677,7 +3522,7 @@ H5P__facc_cache_image_config_dec(const void **_pp, void *_value) /* Decode type sizes */ enc_size = *(*pp)++; if (enc_size != sizeof(unsigned)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded"); INT32DECODE(*pp, config->version); @@ -3699,9 +3544,6 @@ H5P__facc_cache_image_config_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -3713,11 +3555,11 @@ H5P__facc_file_image_info_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of file image info */ if (H5P__file_image_info_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3731,9 +3573,6 @@ H5P__facc_file_image_info_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -3745,11 +3584,11 @@ H5P__facc_file_image_info_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of file image info */ if (H5P__file_image_info_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3765,9 +3604,6 @@ H5P__facc_file_image_info_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U * * Return: Non-negative on success/Negative on failure * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -3780,7 +3616,7 @@ H5P__facc_file_image_info_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U /* Free the file image info */ if (H5P__file_image_info_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file image info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3795,9 +3631,6 @@ H5P__facc_file_image_info_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_U * * Return: Non-negative on success/Negative on failure * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -3809,7 +3642,7 @@ H5P__facc_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U /* Make copy of file image info */ if (H5P__file_image_info_copy(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy file image info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3825,9 +3658,6 @@ H5P__facc_file_image_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_U * VALUE2 is greater than VALUE1 and zero if VALUE1 and * VALUE2 are equal. * - * Programmer: Quincey Koziol - * Thursday, September 3, 2015 - * *------------------------------------------------------------------------- */ static int @@ -3841,45 +3671,45 @@ H5P__facc_file_image_info_cmp(const void *_info1, const void *_info2, size_t H5_ FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(info1); - HDassert(info2); - HDassert(size == sizeof(H5FD_file_image_info_t)); + assert(info1); + assert(info2); + assert(size == sizeof(H5FD_file_image_info_t)); /* Check for different buffer sizes */ if (info1->size < info2->size) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (info1->size > info2->size) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Check for different callbacks */ /* (Order in memory is fairly meaningless, so just check for equality) */ if (info1->callbacks.image_malloc != info2->callbacks.image_malloc) - HGOTO_DONE(1) + HGOTO_DONE(1); if (info1->callbacks.image_memcpy != info2->callbacks.image_memcpy) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (info1->callbacks.image_realloc != info2->callbacks.image_realloc) - HGOTO_DONE(1) + HGOTO_DONE(1); if (info1->callbacks.image_free != info2->callbacks.image_free) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (info1->callbacks.udata_copy != info2->callbacks.udata_copy) - HGOTO_DONE(1) + HGOTO_DONE(1); if (info1->callbacks.udata_free != info2->callbacks.udata_free) - HGOTO_DONE(-1) + HGOTO_DONE(-1); /* Check for different udata */ /* (Don't know how big it is, so can't check contents) */ if (info1->callbacks.udata < info2->callbacks.udata) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (info1->callbacks.udata > info2->callbacks.udata) - HGOTO_DONE(1) + HGOTO_DONE(1); /* Check buffer contents (instead of buffer pointers) */ if (info1->buffer != NULL && info2->buffer == NULL) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (info1->buffer == NULL && info2->buffer != NULL) - HGOTO_DONE(1) + HGOTO_DONE(1); if (info1->buffer != NULL && info2->buffer != NULL) - ret_value = HDmemcmp(info1->buffer, info2->buffer, size); + ret_value = memcmp(info1->buffer, info2->buffer, size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3894,9 +3724,6 @@ H5P__facc_file_image_info_cmp(const void *_info1, const void *_info2, size_t H5_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Jacob Gruber - * Thurday, August 11, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -3908,7 +3735,7 @@ H5P__facc_file_image_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_ /* Free the file image info */ if (H5P__file_image_info_free(value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file image info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release file image info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3922,9 +3749,6 @@ H5P__facc_file_image_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_ * Return: positive if VALUE1 is greater than VALUE2, negative if VALUE2 is * greater than VALUE1 and zero if VALUE1 and VALUE2 are equal. * - * Programmer: Mohamad Chaarawi - * September 24, 2012 - * *------------------------------------------------------------------------- */ static int @@ -4093,9 +3917,6 @@ H5P__facc_cache_config_cmp(const void *_config1, const void *_config2, size_t H5 * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 09, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -4110,7 +3931,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(value); + assert(value); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); if (NULL != *pp) { @@ -4137,7 +3958,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) enc_value = (uint64_t)config->initial_size; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -4145,13 +3966,13 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) enc_value = (uint64_t)config->max_size; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); enc_value = (uint64_t)config->min_size; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -4169,7 +3990,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) enc_value = (uint64_t)config->max_increment; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -4191,7 +4012,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) enc_value = (uint64_t)config->max_decrement; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -4238,9 +4059,6 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 09, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -4255,9 +4073,9 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(config); + assert(pp); + assert(*pp); + assert(config); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); /* Set property to default value */ @@ -4266,10 +4084,10 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value) /* Decode type sizes */ enc_size = *(*pp)++; if (enc_size != sizeof(unsigned)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded"); enc_size = *(*pp)++; if (enc_size != sizeof(double)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "double value can't be decoded"); /* int */ INT32DECODE(*pp, config->version); @@ -4288,19 +4106,19 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value) H5_DECODE_UNSIGNED(*pp, config->set_initial_size); enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); config->initial_size = (size_t)enc_value; H5_DECODE_DOUBLE(*pp, config->min_clean_fraction); enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); config->max_size = (size_t)enc_value; enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); config->min_size = (size_t)enc_value; @@ -4320,7 +4138,7 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value) H5_DECODE_UNSIGNED(*pp, config->apply_max_increment); enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); config->max_increment = (size_t)enc_value; @@ -4341,7 +4159,7 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value) H5_DECODE_UNSIGNED(*pp, config->apply_max_decrement); enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); config->max_decrement = (size_t)enc_value; @@ -4372,9 +4190,6 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, August 15, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -4387,8 +4202,8 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(fclose_degree); - HDassert(size); + assert(fclose_degree); + assert(size); if (NULL != *pp) /* Encode file close degree */ @@ -4410,9 +4225,6 @@ H5P__facc_fclose_degree_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, August 15, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -4424,9 +4236,9 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(fclose_degree); + assert(pp); + assert(*pp); + assert(fclose_degree); /* Decode file close degree */ *fclose_degree = (H5F_close_degree_t) * (*pp)++; @@ -4444,9 +4256,6 @@ H5P__facc_fclose_degree_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, August 15, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -4458,8 +4267,8 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(type); - HDassert(size); + assert(type); + assert(size); if (NULL != *pp) /* Encode file close degree */ @@ -4481,9 +4290,6 @@ H5P__facc_multi_type_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, August 15, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -4495,9 +4301,9 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(type); + assert(pp); + assert(*pp); + assert(type); /* Decode multi VFD memory type */ *type = (H5FD_mem_t) * (*pp)++; @@ -4515,8 +4321,6 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer - * *------------------------------------------------------------------------- */ static herr_t @@ -4528,8 +4332,8 @@ H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(type); - HDassert(size); + assert(type); + assert(size); /* Encode */ if (NULL != *pp) @@ -4551,8 +4355,6 @@ H5P__facc_libver_type_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: - * *------------------------------------------------------------------------- */ static herr_t @@ -4564,9 +4366,9 @@ H5P__facc_libver_type_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(type); + assert(pp); + assert(*pp); + assert(type); /* Decode */ *type = (H5F_libver_t) * (*pp)++; @@ -4587,8 +4389,6 @@ H5P__facc_libver_type_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -4607,11 +4407,11 @@ H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, &attempts) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set # of metadata read attempts") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set # of metadata read attempts"); done: FUNC_LEAVE_API(ret_value) @@ -4624,8 +4424,6 @@ H5Pset_metadata_read_attempts(hid_t plist_id, unsigned attempts) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Sept 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -4642,11 +4440,11 @@ H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the # of read attempts set */ if (H5P_get(plist, H5F_ACS_METADATA_READ_ATTEMPTS_NAME, attempts) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get the number of metadata read attempts") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get the number of metadata read attempts"); /* If not set, return the default value */ if (*attempts == H5F_ACS_METADATA_READ_ATTEMPTS_DEF) /* 0 */ @@ -4665,8 +4463,6 @@ H5Pget_metadata_read_attempts(hid_t plist_id, unsigned *attempts /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Dec 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -4682,11 +4478,11 @@ H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata) /* Check if the callback function is NULL and the user data is non-NULL. * This is almost certainly an error as the user data will not be used. */ if (!func && udata) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Update property list */ flush_info.func = func; @@ -4694,7 +4490,7 @@ H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata) /* Set values */ if (H5P_set(plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &flush_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object flush callback") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object flush callback"); done: FUNC_LEAVE_API(ret_value) @@ -4708,8 +4504,6 @@ H5Pset_object_flush_cb(hid_t plist_id, H5F_flush_cb_t func, void *udata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; Dec 2013 - * *------------------------------------------------------------------------- */ herr_t @@ -4724,11 +4518,11 @@ H5Pget_object_flush_cb(hid_t plist_id, H5F_flush_cb_t *func /*out*/, void **udat /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Retrieve the callback function and user data */ if (H5P_get(plist, H5F_ACS_OBJECT_FLUSH_CB_NAME, &flush_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object flush callback") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object flush callback"); /* Assign return value */ if (func) @@ -4761,25 +4555,25 @@ H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, /* Check arguments */ if (H5P_DEFAULT == plist_id) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't modify default property list"); if (!location) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "location cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "location cannot be NULL"); /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plist_id is not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plist_id is not a file access property list"); /* Make a copy of the passed-in location */ if (NULL == (new_location = H5MM_xstrdup(location))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy passed-in log location") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy passed-in log location"); /* Set values */ if (H5P_set(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &is_enabled) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set is_enabled flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set is_enabled flag"); if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &new_location) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set log location") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set log location"); if (H5P_set(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &start_on_access) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set start_on_access flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set start_on_access flag"); done: FUNC_LEAVE_API(ret_value) @@ -4807,20 +4601,20 @@ H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled /*out*/, char *locati /* Get the property list structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plist_id is not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plist_id is not a file access property list"); /* Get simple values */ if (is_enabled) if (H5P_get(plist, H5F_ACS_USE_MDC_LOGGING_NAME, is_enabled) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get log location") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get log location"); if (start_on_access) if (H5P_get(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, start_on_access) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get start_on_access flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get start_on_access flag"); /* Get the location */ if (location || location_size) if (H5P_get(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &location_ptr) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get log location") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get log location"); /* Copy log location to output buffer */ if (location_ptr && location) @@ -4869,7 +4663,7 @@ H5P__facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); if (NULL != *pp) { /* encode the length of the prefix */ @@ -4914,14 +4708,14 @@ H5P__facc_mdc_log_location_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE - HDassert(pp); - HDassert(*pp); - HDassert(log_location); + assert(pp); + assert(*pp); + assert(log_location); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); /* Decode the size */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); /* Decode the value */ UINT64DECODE_VAR(*pp, enc_value, enc_size); @@ -4930,7 +4724,7 @@ H5P__facc_mdc_log_location_dec(const void **_pp, void *_value) if (0 != len) { /* Make a copy of the user's prefix string */ if (NULL == (*log_location = (char *)H5MM_malloc(len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix"); HDstrncpy(*log_location, *(const char **)pp, len); (*log_location)[len] = '\0'; @@ -4958,7 +4752,7 @@ H5P__facc_mdc_log_location_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_ { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); H5MM_xfree(*(void **)value); @@ -4979,7 +4773,7 @@ H5P__facc_mdc_log_location_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_ { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); *(char **)value = H5MM_xstrdup(*(const char **)value); @@ -5032,7 +4826,7 @@ H5P__facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); H5MM_xfree(*(void **)value); @@ -5052,9 +4846,6 @@ H5P__facc_mdc_log_location_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -5068,19 +4859,19 @@ H5Pset_evict_on_close(hid_t fapl_id, hbool_t H5_ATTR_PARALLEL_UNUSED evict_on_cl /* Compare the property list's class against the other class */ if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); #ifndef H5_HAVE_PARALLEL /* Set value */ if (H5P_set(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, &evict_on_close) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set evict on close property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set evict on close property"); #else HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, - "evict on close is currently not supported in parallel HDF5") + "evict on close is currently not supported in parallel HDF5"); #endif /* H5_HAVE_PARALLEL */ done: @@ -5100,9 +4891,6 @@ H5Pset_evict_on_close(hid_t fapl_id, hbool_t H5_ATTR_PARALLEL_UNUSED evict_on_cl * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -5116,14 +4904,14 @@ H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close /*out*/) /* Compare the property list's class against the other class */ if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_get(plist, H5F_ACS_EVICT_ON_CLOSE_FLAG_NAME, evict_on_close) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get evict on close property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get evict on close property"); done: FUNC_LEAVE_API(ret_value) @@ -5145,9 +4933,6 @@ H5Pget_evict_on_close(hid_t fapl_id, hbool_t *evict_on_close /*out*/) * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -5161,17 +4946,17 @@ H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when /* Make sure this is a fapl */ if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_USE_FILE_LOCKING_NAME, &use_file_locking) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set use file locking property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set use file locking property"); if (H5P_set(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, &ignore_when_disabled) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set ignore disabled file locks property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set ignore disabled file locks property"); done: FUNC_LEAVE_API(ret_value) @@ -5187,9 +4972,6 @@ H5Pset_file_locking(hid_t fapl_id, hbool_t use_file_locking, hbool_t ignore_when * * Return: SUCCEED/FAIL * - * Programmer: Dana Robinson - * Spring 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -5203,17 +4985,17 @@ H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking /*out*/, hbool_t *i /* Make sure this is a fapl */ if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (H5P_get(plist, H5F_ACS_USE_FILE_LOCKING_NAME, use_file_locking) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get use file locking property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get use file locking property"); if (H5P_get(plist, H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_NAME, ignore_when_disabled) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get ignore disabled file locks property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get ignore disabled file locks property"); done: FUNC_LEAVE_API(ret_value) @@ -5229,9 +5011,6 @@ H5Pget_file_locking(hid_t fapl_id, hbool_t *use_file_locking /*out*/, hbool_t *i * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Sunday, June 21, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -5243,8 +5022,8 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(coll_md_read_flag); - HDassert(size); + assert(coll_md_read_flag); + assert(size); if (NULL != *pp) { /* Encode the value */ @@ -5266,9 +5045,6 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Sunday, June 21, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -5280,9 +5056,9 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(coll_md_read_flag); + assert(pp); + assert(*pp); + assert(coll_md_read_flag); /* Decode file close degree */ *coll_md_read_flag = (H5P_coll_md_read_flag_t) * (*pp); @@ -5306,9 +5082,6 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * Sunday, June 21, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -5326,7 +5099,7 @@ H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective) * are sub-classes of link access property lists -QAK) */ if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist"); /* set property to either TRUE if > 0, or FALSE otherwise */ if (is_collective) @@ -5336,11 +5109,11 @@ H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag"); done: FUNC_LEAVE_API(ret_value) @@ -5358,9 +5131,6 @@ H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * Sunday, June 21, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -5376,7 +5146,7 @@ H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective /*out*/) * are sub-classes of link access property lists -QAK) */ if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist"); /* Get value */ if (is_collective) { @@ -5386,10 +5156,10 @@ H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective /*out*/) /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &internal_flag) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag"); if (internal_flag < 0) *is_collective = FALSE; @@ -5409,9 +5179,6 @@ H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * Sunday, June 21, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -5425,15 +5192,15 @@ H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective) /* Compare the property list's class against the other class */ if (TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &is_collective) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata write flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata write flag"); done: FUNC_LEAVE_API(ret_value) @@ -5446,9 +5213,6 @@ H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective) * * Return: Non-negative on success/Negative on failure * - * Programmer: Dana Robinson - * August 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -5462,17 +5226,17 @@ H5Pget_mpi_params(hid_t plist_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/ /* Make sure that the property list is a fapl */ if (TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the properties */ if (H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, comm) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI communicator from plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI communicator from plist"); if (H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI info from plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI info from plist"); done: FUNC_LEAVE_API(ret_value) @@ -5485,9 +5249,6 @@ H5Pget_mpi_params(hid_t plist_id, MPI_Comm *comm /*out*/, MPI_Info *info /*out*/ * * Return: Non-negative on success/Negative on failure * - * Programmer: Dana Robinson - * August 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -5501,21 +5262,21 @@ H5Pset_mpi_params(hid_t plist_id, MPI_Comm comm, MPI_Info info) /* Make sure the MPI communicator is valid */ if (MPI_COMM_NULL == comm) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "not a valid argument") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "not a valid argument"); /* Make sure that the property list is a fapl */ if (TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set values */ if (H5P_set(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI communicator") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI communicator"); if (H5P_set(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI info object") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI info object"); done: FUNC_LEAVE_API(ret_value) @@ -5543,7 +5304,7 @@ H5P__facc_mpi_comm_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * /* Make a copy of the MPI communicator */ if (H5_mpi_comm_dup(*comm, &comm_tmp) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI communicator") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI communicator"); done: /* Copy the communicator to the in/out parameter */ @@ -5577,7 +5338,7 @@ H5P__facc_mpi_comm_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * /* Make a copy of the MPI communicator */ if (H5_mpi_comm_dup(*comm, &comm_tmp) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI communicator") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI communicator"); done: /* Copy the communicator to the out parameter */ @@ -5610,7 +5371,7 @@ H5P__facc_mpi_comm_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * /* Free the MPI communicator */ if (H5_mpi_comm_free(comm) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI communicator") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI communicator"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5637,7 +5398,7 @@ H5P__facc_mpi_comm_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED s /* Make a copy of the MPI communicator */ if (H5_mpi_comm_dup(*comm, &comm_tmp) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI communicator") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI communicator"); done: /* Copy the communicator to the in/out parameter */ @@ -5673,7 +5434,7 @@ H5P__facc_mpi_comm_cmp(const void *_comm1, const void *_comm2, size_t H5_ATTR_UN /* Compare the MPI communicators */ if (H5_mpi_comm_cmp(*comm1, *comm2, &ret_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, 0, "unable to compare MPI communicator") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, 0, "unable to compare MPI communicator"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5699,7 +5460,7 @@ H5P__facc_mpi_comm_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED /* Free the MPI communicator */ if (H5_mpi_comm_free(comm) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI communicator") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI communicator"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5727,7 +5488,7 @@ H5P__facc_mpi_info_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * /* Make a copy of the MPI info object */ if (H5_mpi_info_dup(*info, &info_tmp) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI info object") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI info object"); done: /* Copy the info object to the in/out parameter */ @@ -5761,7 +5522,7 @@ H5P__facc_mpi_info_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * /* Make a copy of the MPI communicator */ if (H5_mpi_info_dup(*info, &info_tmp) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI info object") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI info object"); done: /* Copy the info object to the out parameter */ @@ -5794,7 +5555,7 @@ H5P__facc_mpi_info_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * /* Free the MPI info object */ if (H5_mpi_info_free(info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI info object") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI info object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5821,7 +5582,7 @@ H5P__facc_mpi_info_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED s /* Make a copy of the MPI info object */ if (H5_mpi_info_dup(*info, &info_tmp) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI info object") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to duplicate MPI info object"); done: /* Copy the info object to the in/out parameter */ @@ -5857,7 +5618,7 @@ H5P__facc_mpi_info_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UN /* Compare the MPI info objects */ if (H5_mpi_info_cmp(*info1, *info2, &ret_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, 0, "unable to compare MPI info objects") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, 0, "unable to compare MPI info objects"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5883,7 +5644,7 @@ H5P__facc_mpi_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED /* Free the MPI info object */ if (H5_mpi_info_free(info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI info object") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to free MPI info object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5896,9 +5657,6 @@ H5P__facc_mpi_info_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * Sunday, June 21, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -5912,14 +5670,14 @@ H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective /*out*/) /* Compare the property list's class against the other class */ if (TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist"); /* Get the plist structure */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, is_collective) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get collective metadata write flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get collective metadata write flag"); done: FUNC_LEAVE_API(ret_value) @@ -5935,9 +5693,6 @@ H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * June 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -5951,14 +5706,14 @@ H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_perc, /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (min_meta_perc > 100) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Minimum metadata fractions must be between 0 and 100 inclusive") + "Minimum metadata fractions must be between 0 and 100 inclusive"); if (min_raw_perc > 100) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "Minimum rawdata fractions must be between 0 and 100 inclusive") + "Minimum raw data fractions must be between 0 and 100 inclusive"); if (min_meta_perc + min_raw_perc > 100) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, @@ -5966,11 +5721,11 @@ H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_perc, /* Set size */ if (H5P_set(plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, &buf_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set page buffer size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set page buffer size"); if (H5P_set(plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, &min_meta_perc) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set percentage of min metadata entries") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set percentage of min metadata entries"); if (H5P_set(plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, &min_raw_perc) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set percentage of min rawdata entries") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set percentage of min raw data entries"); done: FUNC_LEAVE_API(ret_value) @@ -5983,9 +5738,6 @@ H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_perc, * * Return: Non-negative on success/Negative on failure * - * Programmer: Mohamad Chaarawi - * June 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -6000,19 +5752,19 @@ H5Pget_page_buffer_size(hid_t plist_id, size_t *buf_size /*out*/, unsigned *min_ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get size */ if (buf_size) if (H5P_get(plist, H5F_ACS_PAGE_BUFFER_SIZE_NAME, buf_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get page buffer size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get page buffer size"); if (min_meta_perc) if (H5P_get(plist, H5F_ACS_PAGE_BUFFER_MIN_META_PERC_NAME, min_meta_perc) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get page buffer minimum metadata percent") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get page buffer minimum metadata percent"); if (min_raw_perc) if (H5P_get(plist, H5F_ACS_PAGE_BUFFER_MIN_RAW_PERC_NAME, min_raw_perc) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get page buffer minimum raw data percent") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get page buffer minimum raw data percent"); done: FUNC_LEAVE_API(ret_value) @@ -6038,7 +5790,7 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) FUNC_ENTER_NOAPI(FAIL) if (NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { H5VL_connector_prop_t vol_prop; /* Property for VOL ID & info */ @@ -6049,7 +5801,7 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) /* Set the connector ID & info property */ if (H5P_set(plist, H5F_ACS_VOL_CONN_NAME, &vol_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info"); } /* end if */ else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); @@ -6069,9 +5821,6 @@ H5P_set_vol(H5P_genplist_t *plist, hid_t vol_id, const void *vol_info) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * March 8, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -6084,11 +5833,11 @@ H5P_reset_vol_class(const H5P_genclass_t *pclass, const H5VL_connector_prop_t *v /* Get the connector ID & info property */ if (H5P__class_get(pclass, H5F_ACS_VOL_CONN_NAME, &old_vol_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector ID & info"); /* Set the new connector ID & info property */ if (H5P__class_set(pclass, H5F_ACS_VOL_CONN_NAME, vol_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL connector ID & info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6116,13 +5865,13 @@ H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info) /* Check arguments */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if (NULL == H5I_object_verify(new_vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file VOL ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file VOL ID"); /* Set the VOL */ if (H5P_set_vol(plist, new_vol_id, new_vol_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VOL"); done: FUNC_LEAVE_API(ret_value) @@ -6148,9 +5897,12 @@ H5Pget_vol_id(hid_t plist_id, hid_t *vol_id /*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", plist_id, vol_id); + if (H5P_DEFAULT == plist_id) + plist_id = H5P_FILE_ACCESS_DEFAULT; + /* Get property list for ID */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get the current VOL ID */ if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { @@ -6158,17 +5910,17 @@ H5Pget_vol_id(hid_t plist_id, hid_t *vol_id /*out*/) /* Get the connector property */ if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector info"); /* Increment the VOL ID's ref count */ if (H5I_inc_ref(connector_prop.connector_id, TRUE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID"); /* Set the connector ID to return */ *vol_id = connector_prop.connector_id; } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); done: FUNC_LEAVE_API(ret_value) @@ -6196,7 +5948,7 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info /*out*/) /* Get property list for ID */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get the current VOL info */ if (TRUE == H5P_isa_class(plist->plist_id, H5P_FILE_ACCESS)) { @@ -6205,7 +5957,7 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info /*out*/) /* Get the connector property */ if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property"); /* Copy connector info, if it exists */ if (connector_prop.connector_info) { @@ -6213,18 +5965,18 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info /*out*/) /* Retrieve the connector for the ID */ if (NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop.connector_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Allocate and copy connector info */ if (H5VL_copy_connector_info(connector, &new_connector_info, connector_prop.connector_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed"); } /* end if */ /* Set the connector info */ *vol_info = new_connector_info; } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); done: FUNC_LEAVE_API(ret_value) @@ -6255,34 +6007,37 @@ H5Pget_vol_info(hid_t plist_id, void **vol_info /*out*/) *------------------------------------------------------------------------- */ herr_t -H5Pget_vol_cap_flags(hid_t plist_id, unsigned *cap_flags) +H5Pget_vol_cap_flags(hid_t plist_id, uint64_t *cap_flags) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*Iu", plist_id, cap_flags); + H5TRACE2("e", "i*UL", plist_id, cap_flags); /* Get the 'cap_flags' from the connector */ if (cap_flags) { + if (H5P_DEFAULT == plist_id) + plist_id = H5P_FILE_ACCESS_DEFAULT; + if (TRUE == H5P_isa_class(plist_id, H5P_FILE_ACCESS)) { H5P_genplist_t *plist; /* Property list pointer */ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ /* Get property list for ID */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get the connector property */ if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property"); /* Query the capability flags */ if (H5VL_get_cap_flags(&connector_prop, cap_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector capability flags") - } /* end if */ + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector capability flags"); + } else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - } /* end if */ + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list"); + } done: FUNC_LEAVE_API(ret_value) @@ -6307,7 +6062,7 @@ H5P__facc_vol_create(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size /* Make copy of the VOL connector */ if (H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6332,11 +6087,11 @@ H5P__facc_vol_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of VOL connector ID & info */ if (H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6361,11 +6116,11 @@ H5P__facc_vol_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of VOL connector */ if (H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6391,7 +6146,7 @@ H5P__facc_vol_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, /* Free the VOL connector ID & info */ if (H5VL_conn_free((H5VL_connector_prop_t *)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6416,7 +6171,7 @@ H5P__facc_vol_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, /* Make copy of VOL connector */ if (H5VL_conn_copy((H5VL_connector_prop_t *)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6449,17 +6204,17 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(info1); - HDassert(info2); - HDassert(size == sizeof(H5VL_connector_prop_t)); + assert(info1); + assert(info2); + assert(size == sizeof(H5VL_connector_prop_t)); /* Compare connectors */ if (NULL == (cls1 = (H5VL_class_t *)H5I_object(info1->connector_id))) - HGOTO_DONE(-1) + HGOTO_DONE(-1); if (NULL == (cls2 = (H5VL_class_t *)H5I_object(info2->connector_id))) - HGOTO_DONE(1) + HGOTO_DONE(1); status = H5VL_cmp_connector_cls(&cmp_value, cls1, cls2); - HDassert(status >= 0); + assert(status >= 0); if (cmp_value != 0) HGOTO_DONE(cmp_value); @@ -6470,9 +6225,9 @@ H5P__facc_vol_cmp(const void *_info1, const void *_info2, size_t H5_ATTR_UNUSED /* Use one of the classes (cls1) info comparison routines to compare the * info objects */ - HDassert(cls1->info_cls.cmp == cls2->info_cls.cmp); + assert(cls1->info_cls.cmp == cls2->info_cls.cmp); status = H5VL_cmp_connector_info(cls1, &cmp_value, info1->connector_info, info2->connector_info); - HDassert(status >= 0); + assert(status >= 0); /* Set return value */ ret_value = cmp_value; @@ -6500,7 +6255,7 @@ H5P__facc_vol_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, /* Free the VOL connector */ if (H5VL_conn_free((H5VL_connector_prop_t *)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "can't release VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pfcpl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pfcpl.c index 195fadabad..9c14add1b9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pfcpl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pfcpl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pfcpl.c - * January 6 1998 - * Robb Matzke * * Purpose: File creation property list class routines * @@ -203,8 +200,6 @@ static const hsize_t H5F_def_file_space_page_size_g = H5F_CRT_FILE * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 31, 2006 *------------------------------------------------------------------------- */ static herr_t @@ -218,88 +213,88 @@ H5P__fcrt_reg_prop(H5P_genclass_t *pclass) if (H5P__register_real(pclass, H5F_CRT_USER_BLOCK_NAME, H5F_CRT_USER_BLOCK_SIZE, &H5F_def_userblock_size_g, NULL, NULL, NULL, H5F_CRT_USER_BLOCK_ENC, H5F_CRT_USER_BLOCK_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the 1/2 rank for symbol table leaf nodes */ if (H5P__register_real(pclass, H5F_CRT_SYM_LEAF_NAME, H5F_CRT_SYM_LEAF_SIZE, &H5F_def_sym_leaf_k_g, NULL, NULL, NULL, H5F_CRT_SYM_LEAF_ENC, H5F_CRT_SYM_LEAF_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the 1/2 rank for btree internal nodes */ if (H5P__register_real(pclass, H5F_CRT_BTREE_RANK_NAME, H5F_CRT_BTREE_RANK_SIZE, H5F_def_btree_k_g, NULL, NULL, NULL, H5F_CRT_BTREE_RANK_ENC, H5F_CRT_BTREE_RANK_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the byte number for an address */ if (H5P__register_real(pclass, H5F_CRT_ADDR_BYTE_NUM_NAME, H5F_CRT_ADDR_BYTE_NUM_SIZE, &H5F_def_sizeof_addr_g, NULL, NULL, NULL, H5F_CRT_ADDR_BYTE_NUM_ENC, H5F_CRT_ADDR_BYTE_NUM_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the byte number for object size */ if (H5P__register_real(pclass, H5F_CRT_OBJ_BYTE_NUM_NAME, H5F_CRT_OBJ_BYTE_NUM_SIZE, &H5F_def_sizeof_size_g, NULL, NULL, NULL, H5F_CRT_OBJ_BYTE_NUM_ENC, H5F_CRT_OBJ_BYTE_NUM_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the superblock version number */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5F_CRT_SUPER_VERS_NAME, H5F_CRT_SUPER_VERS_SIZE, &H5F_def_superblock_ver_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the shared OH message information */ if (H5P__register_real(pclass, H5F_CRT_SHMSG_NINDEXES_NAME, H5F_CRT_SHMSG_NINDEXES_SIZE, &H5F_def_num_sohm_indexes_g, NULL, NULL, NULL, H5F_CRT_SHMSG_NINDEXES_ENC, H5F_CRT_SHMSG_NINDEXES_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); if (H5P__register_real(pclass, H5F_CRT_SHMSG_INDEX_TYPES_NAME, H5F_CRT_SHMSG_INDEX_TYPES_SIZE, &H5F_def_sohm_index_flags_g, NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_TYPES_ENC, H5F_CRT_SHMSG_INDEX_TYPES_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); if (H5P__register_real(pclass, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, H5F_CRT_SHMSG_INDEX_MINSIZE_SIZE, &H5F_def_sohm_index_minsizes_g, NULL, NULL, NULL, H5F_CRT_SHMSG_INDEX_MINSIZE_ENC, H5F_CRT_SHMSG_INDEX_MINSIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the shared OH cutoff size information */ if (H5P__register_real(pclass, H5F_CRT_SHMSG_LIST_MAX_NAME, H5F_CRT_SHMSG_LIST_MAX_SIZE, &H5F_def_sohm_list_max_g, NULL, NULL, NULL, H5F_CRT_SHMSG_LIST_MAX_ENC, H5F_CRT_SHMSG_LIST_MAX_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); if (H5P__register_real(pclass, H5F_CRT_SHMSG_BTREE_MIN_NAME, H5F_CRT_SHMSG_BTREE_MIN_SIZE, &H5F_def_sohm_btree_min_g, NULL, NULL, NULL, H5F_CRT_SHMSG_BTREE_MIN_ENC, H5F_CRT_SHMSG_BTREE_MIN_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the file space handling strategy */ if (H5P__register_real(pclass, H5F_CRT_FILE_SPACE_STRATEGY_NAME, H5F_CRT_FILE_SPACE_STRATEGY_SIZE, &H5F_def_file_space_strategy_g, NULL, NULL, NULL, H5F_CRT_FILE_SPACE_STRATEGY_ENC, H5F_CRT_FILE_SPACE_STRATEGY_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the free-space persist flag */ if (H5P__register_real(pclass, H5F_CRT_FREE_SPACE_PERSIST_NAME, H5F_CRT_FREE_SPACE_PERSIST_SIZE, &H5F_def_free_space_persist_g, NULL, NULL, NULL, H5F_CRT_FREE_SPACE_PERSIST_ENC, H5F_CRT_FREE_SPACE_PERSIST_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the free space section threshold */ if (H5P__register_real(pclass, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, H5F_CRT_FREE_SPACE_THRESHOLD_SIZE, &H5F_def_free_space_threshold_g, NULL, NULL, NULL, H5F_CRT_FREE_SPACE_THRESHOLD_ENC, H5F_CRT_FREE_SPACE_THRESHOLD_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the file space page size */ if (H5P__register_real(pclass, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, H5F_CRT_FILE_SPACE_PAGE_SIZE_SIZE, &H5F_def_file_space_page_size_g, NULL, NULL, NULL, H5F_CRT_FILE_SPACE_PAGE_SIZE_ENC, H5F_CRT_FILE_SPACE_PAGE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -313,9 +308,6 @@ H5P__fcrt_reg_prop(H5P_genclass_t *pclass) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, January 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -331,20 +323,20 @@ H5Pset_userblock(hid_t plist_id, hsize_t size) if (size > 0) { /* Check that the userblock size is >=512 */ if (size < 512) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is non-zero and less than 512") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is non-zero and less than 512"); /* Check that the userblock size is a power of two */ if (!POWER_OF_TWO(size)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is non-zero and not a power of two") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "userblock size is non-zero and not a power of two"); } /* end if */ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set value */ if (H5P_set(plist, H5F_CRT_USER_BLOCK_NAME, &size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set user block") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set user block"); done: FUNC_LEAVE_API(ret_value) @@ -360,9 +352,6 @@ H5Pset_userblock(hid_t plist_id, hsize_t size) * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -396,9 +385,6 @@ H5Pget_userblock(hid_t plist_id, hsize_t *size /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, January 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -413,29 +399,29 @@ H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size) /* Check arguments */ if (sizeof_addr) { if (sizeof_addr != 2 && sizeof_addr != 4 && sizeof_addr != 8 && sizeof_addr != 16) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file haddr_t size is not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file haddr_t size is not valid"); } /* end if */ if (sizeof_size) { if (sizeof_size != 2 && sizeof_size != 4 && sizeof_size != 8 && sizeof_size != 16) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file size_t size is not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file size_t size is not valid"); } /* end if */ /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set value */ if (sizeof_addr) { uint8_t tmp_sizeof_addr = (uint8_t)sizeof_addr; if (H5P_set(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &tmp_sizeof_addr) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for an address") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for an address"); } /* end if */ if (sizeof_size) { uint8_t tmp_sizeof_size = (uint8_t)sizeof_size; if (H5P_set(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &tmp_sizeof_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for object ") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set byte number for object "); } /* end if */ done: @@ -452,9 +438,6 @@ H5Pset_sizes(hid_t plist_id, size_t sizeof_addr, size_t sizeof_size) * Return: Success: Non-negative, sizes returned through arguments. * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -468,21 +451,21 @@ H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out*/, size_t *sizeof_size /* /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (sizeof_addr) { uint8_t tmp_sizeof_addr; if (H5P_get(plist, H5F_CRT_ADDR_BYTE_NUM_NAME, &tmp_sizeof_addr) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for an address") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for an address"); *sizeof_addr = tmp_sizeof_addr; } /* end if */ if (sizeof_size) { uint8_t tmp_sizeof_size; if (H5P_get(plist, H5F_CRT_OBJ_BYTE_NUM_NAME, &tmp_sizeof_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for object ") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get byte number for object "); *sizeof_size = tmp_sizeof_size; } /* end if */ @@ -510,9 +493,6 @@ H5Pget_sizes(hid_t plist_id, size_t *sizeof_addr /*out*/, size_t *sizeof_size /* * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, January 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -558,9 +538,6 @@ H5Pset_sym_k(hid_t plist_id, unsigned ik, unsigned lk) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -600,9 +577,6 @@ H5Pget_sym_k(hid_t plist_id, unsigned *ik /*out*/, unsigned *lk /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, January 6, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -648,9 +622,6 @@ H5Pset_istore_k(hid_t plist_id, unsigned ik) * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -687,9 +658,6 @@ H5Pget_istore_k(hid_t plist_id, unsigned *ik /*out*/) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 7, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -701,8 +669,8 @@ H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(btree_k); - HDassert(size); + assert(btree_k); + assert(size); if (NULL != *pp) { unsigned u; /* Local index variable */ @@ -713,7 +681,7 @@ H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size) /* Encode all the btree */ for (u = 0; u < H5B_NUM_BTREE_ID; u++) { /* Encode the left split value */ - H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)btree_k) + H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)btree_k); btree_k++; } /* end for */ } /* end if */ @@ -733,9 +701,6 @@ H5P__fcrt_btree_rank_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 7, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -750,18 +715,18 @@ H5P__fcrt_btree_rank_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(btree_k); + assert(pp); + assert(*pp); + assert(btree_k); /* Decode the size */ enc_size = *(*pp)++; if (enc_size != sizeof(unsigned)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded"); /* Decode all the type flags */ for (u = 0; u < H5B_NUM_BTREE_ID; u++) - H5_DECODE_UNSIGNED(*pp, btree_k[u]) + H5_DECODE_UNSIGNED(*pp, btree_k[u]); done: FUNC_LEAVE_NOAPI(ret_value) @@ -781,9 +746,6 @@ H5P__fcrt_btree_rank_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Monday, October 9, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -819,9 +781,6 @@ H5Pset_shared_mesg_nindexes(hid_t plist_id, unsigned nindexes) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Monday, October 9, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -856,9 +815,6 @@ H5Pget_shared_mesg_nindexes(hid_t plist_id, unsigned *nindexes /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Wednesday, April 5, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -875,15 +831,15 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_ /* Check arguments */ if (mesg_type_flags > H5O_SHMESG_ALL_FLAG) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unrecognized flags in mesg_type_flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unrecognized flags in mesg_type_flags"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Read the current number of indexes */ if (H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes"); /* Range check */ if (index_num >= nindexes) @@ -891,9 +847,9 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_ /* Get arrays of type flags and message sizes */ if (H5P_get(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current index type flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current index type flags"); if (H5P_get(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current min sizes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current min sizes"); /* Set values in arrays */ type_flags[index_num] = mesg_type_flags; @@ -901,9 +857,9 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_ /* Write arrays back to plist */ if (H5P_set(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set index type flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set index type flags"); if (H5P_set(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set min mesg sizes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set min mesg sizes"); done: FUNC_LEAVE_API(ret_value) @@ -918,9 +874,6 @@ H5Pset_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned mesg_type_ * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Wednesday, April 5, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -938,21 +891,21 @@ H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Read the current number of indexes */ if (H5P_get(plist, H5F_CRT_SHMSG_NINDEXES_NAME, &nindexes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of indexes"); if (index_num >= nindexes) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, - "index_num is greater than number of indexes in property list") + "index_num is greater than number of indexes in property list"); /* Get arrays of type flags and message sizes */ if (H5P_get(plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, type_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current index type flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current index type flags"); if (H5P_get(plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current min sizes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current min sizes"); /* Get values from arrays */ if (mesg_type_flags) @@ -974,9 +927,6 @@ H5Pget_shared_mesg_index(hid_t plist_id, unsigned index_num, unsigned *mesg_type * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 7, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -988,8 +938,8 @@ H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(type_flags); - HDassert(size); + assert(type_flags); + assert(size); if (NULL != *pp) { unsigned u; /* Local index variable */ @@ -1000,7 +950,7 @@ H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size) /* Encode all the type flags */ for (u = 0; u < H5O_SHMESG_MAX_NINDEXES; u++) { /* Encode the left split value */ - H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)type_flags) + H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)type_flags); type_flags++; } /* end for */ } /* end if */ @@ -1021,9 +971,6 @@ H5P__fcrt_shmsg_index_types_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 7, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1038,18 +985,18 @@ H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(type_flags); + assert(pp); + assert(*pp); + assert(type_flags); /* Decode the size */ enc_size = *(*pp)++; if (enc_size != sizeof(unsigned)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded"); /* Decode all the type flags */ for (u = 0; u < H5O_SHMESG_MAX_NINDEXES; u++) - H5_DECODE_UNSIGNED(*pp, type_flags[u]) + H5_DECODE_UNSIGNED(*pp, type_flags[u]); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1065,9 +1012,6 @@ H5P__fcrt_shmsg_index_types_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 7, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1079,8 +1023,8 @@ H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(minsizes); - HDassert(size); + assert(minsizes); + assert(size); if (NULL != *pp) { unsigned u; /* Local index variable */ @@ -1091,7 +1035,7 @@ H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size) /* Encode all the minsize values */ for (u = 0; u < H5O_SHMESG_MAX_NINDEXES; u++) { /* Encode the left split value */ - H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)minsizes) + H5_ENCODE_UNSIGNED(*pp, *(const unsigned *)minsizes); minsizes++; } /* end for */ } /* end if */ @@ -1112,9 +1056,6 @@ H5P__fcrt_shmsg_index_minsize_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * August 7, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -1129,18 +1070,18 @@ H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(minsizes); + assert(pp); + assert(*pp); + assert(minsizes); /* Decode the size */ enc_size = *(*pp)++; if (enc_size != sizeof(unsigned)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded"); /* Decode all the minsize values */ for (u = 0; u < H5O_SHMESG_MAX_NINDEXES; u++) - H5_DECODE_UNSIGNED(*pp, minsizes[u]) + H5_DECODE_UNSIGNED(*pp, minsizes[u]); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1160,9 +1101,6 @@ H5P__fcrt_shmsg_index_minsize_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Wednesday, April 5, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1180,11 +1118,11 @@ H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_ * Range check to make certain they will fit into encoded form. */ if (max_list + 1 < min_btree) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "minimum B-tree value is greater than maximum list value") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "minimum B-tree value is greater than maximum list value"); if (max_list > H5O_SHMESG_MAX_LIST_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max list value is larger than H5O_SHMESG_MAX_LIST_SIZE") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max list value is larger than H5O_SHMESG_MAX_LIST_SIZE"); if (min_btree > H5O_SHMESG_MAX_LIST_SIZE) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE"); /* Avoid the strange case where max_list == 0 and min_btree == 1, so deleting the * last message in a B-tree makes it become an empty list. @@ -1213,9 +1151,6 @@ H5Pset_shared_mesg_phase_change(hid_t plist_id, unsigned max_list, unsigned min_ * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Wednesday, April 5, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1253,8 +1188,6 @@ H5Pget_shared_mesg_phase_change(hid_t plist_id, unsigned *max_list /*out*/, unsi * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 10, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -1268,23 +1201,23 @@ H5Pset_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t strategy, hbool /* Check arguments */ if (strategy >= H5F_FSPACE_STRATEGY_NTYPES) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid strategy") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid strategy"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set value(s), if non-zero */ if (H5P_set(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, &strategy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file space strategy") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set file space strategy"); /* Ignore persist and threshold settings for strategies that do not use FSM */ if (strategy == H5F_FSPACE_STRATEGY_FSM_AGGR || strategy == H5F_FSPACE_STRATEGY_PAGE) { if (H5P_set(plist, H5F_CRT_FREE_SPACE_PERSIST_NAME, &persist) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set free-space persisting status") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set free-space persisting status"); if (H5P_set(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, &threshold) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set free-space threshold") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set free-space threshold"); } /* end if */ done: @@ -1299,8 +1232,6 @@ H5Pset_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t strategy, hbool * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; June 10, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -1315,18 +1246,18 @@ H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy /*out /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value(s) */ if (strategy) if (H5P_get(plist, H5F_CRT_FILE_SPACE_STRATEGY_NAME, strategy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space strategy") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space strategy"); if (persist) if (H5P_get(plist, H5F_CRT_FREE_SPACE_PERSIST_NAME, persist) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space persisting status") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space persisting status"); if (threshold) if (H5P_get(plist, H5F_CRT_FREE_SPACE_THRESHOLD_NAME, threshold) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space threshold") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get free-space threshold"); done: FUNC_LEAVE_API(ret_value) @@ -1342,9 +1273,6 @@ H5Pget_file_space_strategy(hid_t plist_id, H5F_fspace_strategy_t *strategy /*out * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, December 27, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1357,8 +1285,8 @@ H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(strategy); - HDassert(size); + assert(strategy); + assert(size); if (NULL != *pp) /* Encode free-space strategy */ @@ -1380,9 +1308,6 @@ H5P__fcrt_fspace_strategy_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, December 27, 2013 - * *------------------------------------------------------------------------- */ static herr_t @@ -1394,9 +1319,9 @@ H5P__fcrt_fspace_strategy_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(strategy); + assert(pp); + assert(*pp); + assert(strategy); /* Decode free-space strategy */ *strategy = (H5F_fspace_strategy_t) * (*pp)++; @@ -1411,8 +1336,6 @@ H5P__fcrt_fspace_strategy_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; August 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -1426,17 +1349,17 @@ H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (fsp_size < H5F_FILE_SPACE_PAGE_SIZE_MIN) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "cannot set file space page size to less than 512") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "cannot set file space page size to less than 512"); if (fsp_size > H5F_FILE_SPACE_PAGE_SIZE_MAX) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "cannot set file space page size to more than 1GB") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "cannot set file space page size to more than 1GB"); /* Set the value*/ if (H5P_set(plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, &fsp_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set file space page size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set file space page size"); done: FUNC_LEAVE_API(ret_value) @@ -1450,8 +1373,6 @@ H5Pset_file_space_page_size(hid_t plist_id, hsize_t fsp_size) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; August 2012 - * *------------------------------------------------------------------------- */ herr_t @@ -1465,12 +1386,12 @@ H5Pget_file_space_page_size(hid_t plist_id, hsize_t *fsp_size /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (fsp_size) if (H5P_get(plist, H5F_CRT_FILE_SPACE_PAGE_SIZE_NAME, fsp_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space page size") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get file space page size"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pfmpl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pfmpl.c index b39639dd10..9dac659558 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pfmpl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pfmpl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pmtpl.c - * November 1 2006 - * Quincey Koziol * * Purpose: File mount property list class routines * @@ -102,8 +99,6 @@ static const hbool_t H5F_def_local_g = H5F_MNT_SYM_LOCAL_DEF; /* Whether symlink * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 31, 2006 *------------------------------------------------------------------------- */ static herr_t @@ -116,7 +111,7 @@ H5P__fmnt_reg_prop(H5P_genclass_t *pclass) /* Register property of whether symlinks is local to file */ if (H5P__register_real(pclass, H5F_MNT_SYM_LOCAL_NAME, H5F_MNT_SYM_LOCAL_SIZE, &H5F_def_local_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pgcpl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pgcpl.c index c4ecf202a8..cf60f43db6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pgcpl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pgcpl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pgcpl.c - * August 29 2006 - * Quincey Koziol * * Purpose: Group creation property list class routines * @@ -111,8 +108,6 @@ static const H5O_linfo_t H5G_def_linfo_g = H5G_CRT_LINK_INFO_DEF; /* Default li * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 31, 2006 *------------------------------------------------------------------------- */ static herr_t @@ -126,13 +121,13 @@ H5P__gcrt_reg_prop(H5P_genclass_t *pclass) if (H5P__register_real(pclass, H5G_CRT_GROUP_INFO_NAME, H5G_CRT_GROUP_INFO_SIZE, &H5G_def_ginfo_g, NULL, NULL, NULL, H5G_CRT_GROUP_INFO_ENC, H5G_CRT_GROUP_INFO_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register link info property */ if (H5P__register_real(pclass, H5G_CRT_LINK_INFO_NAME, H5G_CRT_LINK_INFO_SIZE, &H5G_def_linfo_g, NULL, NULL, NULL, H5G_CRT_LINK_INFO_ENC, H5G_CRT_LINK_INFO_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -145,8 +140,6 @@ H5P__gcrt_reg_prop(H5P_genclass_t *pclass) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 29, 2005 *------------------------------------------------------------------------- */ herr_t @@ -161,18 +154,18 @@ H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info"); /* Update field */ H5_CHECKED_ASSIGN(ginfo.lheap_size_hint, uint32_t, size_hint, size_t); /* Set value */ if (H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info"); done: FUNC_LEAVE_API(ret_value) @@ -186,8 +179,6 @@ H5Pset_local_heap_size_hint(hid_t plist_id, size_t size_hint) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 29, 2005 *------------------------------------------------------------------------- */ herr_t @@ -204,11 +195,11 @@ H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info"); /* Update field */ *size_hint = ginfo.lheap_size_hint; @@ -231,8 +222,6 @@ H5Pget_local_heap_size_hint(hid_t plist_id, size_t *size_hint /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 29, 2005 *------------------------------------------------------------------------- */ herr_t @@ -247,19 +236,19 @@ H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens /* Range check values */ if (max_compact < min_dense) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be >= min dense value") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be >= min dense value"); if (max_compact > 65535) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be < 65536") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be < 65536"); if (min_dense > 65535) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min dense value must be < 65536") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min dense value must be < 65536"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get group info */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info"); /* Update fields */ if (max_compact != H5G_CRT_GINFO_MAX_COMPACT || min_dense != H5G_CRT_GINFO_MIN_DENSE) @@ -271,7 +260,7 @@ H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens /* Set group info */ if (H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info"); done: FUNC_LEAVE_API(ret_value) @@ -285,8 +274,6 @@ H5Pset_link_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * August 29, 2005 *------------------------------------------------------------------------- */ herr_t @@ -304,11 +291,11 @@ H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get group info */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info"); if (max_compact) *max_compact = ginfo.max_compact; @@ -335,8 +322,6 @@ H5Pget_link_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 6, 2005 *------------------------------------------------------------------------- */ herr_t @@ -351,17 +336,17 @@ H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name /* Range check values */ if (est_num_entries > 65535) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "est. number of entries must be < 65536") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "est. number of entries must be < 65536"); if (est_name_len > 65535) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "est. name length must be < 65536") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "est. name length must be < 65536"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get group info */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info"); /* Update fields */ if (est_num_entries != H5G_CRT_GINFO_EST_NUM_ENTRIES || est_name_len != H5G_CRT_GINFO_EST_NAME_LEN) @@ -373,7 +358,7 @@ H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name /* Set group info */ if (H5P_set(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set group info"); done: FUNC_LEAVE_API(ret_value) @@ -387,8 +372,6 @@ H5Pset_est_link_info(hid_t plist_id, unsigned est_num_entries, unsigned est_name * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 6, 2005 *------------------------------------------------------------------------- */ herr_t @@ -406,11 +389,11 @@ H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*out*/, unsigned /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get group info */ if (H5P_get(plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info"); if (est_num_entries) *est_num_entries = ginfo.est_num_entries; @@ -429,8 +412,6 @@ H5Pget_est_link_info(hid_t plist_id, unsigned *est_num_entries /*out*/, unsigned * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 12, 2006 *------------------------------------------------------------------------- */ herr_t @@ -445,15 +426,15 @@ H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags) /* Check for bad combination of flags */ if (!(crt_order_flags & H5P_CRT_ORDER_TRACKED) && (crt_order_flags & H5P_CRT_ORDER_INDEXED)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tracking creation order is required for index") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tracking creation order is required for index"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get link info */ if (H5P_get(plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info"); /* Update fields */ linfo.track_corder = (hbool_t)((crt_order_flags & H5P_CRT_ORDER_TRACKED) ? TRUE : FALSE); @@ -461,7 +442,7 @@ H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags) /* Set link info */ if (H5P_set(plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set link info"); done: FUNC_LEAVE_API(ret_value) @@ -475,8 +456,6 @@ H5Pset_link_creation_order(hid_t plist_id, unsigned crt_order_flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * September 12, 2006 *------------------------------------------------------------------------- */ herr_t @@ -497,11 +476,11 @@ H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_GROUP_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get link info */ if (H5P_get(plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info"); *crt_order_flags |= linfo.track_corder ? H5P_CRT_ORDER_TRACKED : 0; *crt_order_flags |= linfo.index_corder ? H5P_CRT_ORDER_INDEXED : 0; @@ -521,9 +500,6 @@ H5Pget_link_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -535,11 +511,11 @@ H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR if (NULL != *pp) { - UINT32ENCODE(*pp, ginfo->lheap_size_hint) - UINT16ENCODE(*pp, ginfo->max_compact) - UINT16ENCODE(*pp, ginfo->min_dense) - UINT16ENCODE(*pp, ginfo->est_num_entries) - UINT16ENCODE(*pp, ginfo->est_name_len) + UINT32ENCODE(*pp, ginfo->lheap_size_hint); + UINT16ENCODE(*pp, ginfo->max_compact); + UINT16ENCODE(*pp, ginfo->min_dense); + UINT16ENCODE(*pp, ginfo->est_num_entries); + UINT16ENCODE(*pp, ginfo->est_name_len); } /* end if */ *size += sizeof(uint16_t) * 4 + sizeof(uint32_t); @@ -557,9 +533,6 @@ H5P__gcrt_group_info_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -572,14 +545,14 @@ H5P__gcrt_group_info_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Set property to default value */ - HDmemset(ginfo, 0, sizeof(H5O_ginfo_t)); + memset(ginfo, 0, sizeof(H5O_ginfo_t)); *ginfo = H5G_def_ginfo_g; - UINT32DECODE(*pp, ginfo->lheap_size_hint) - UINT16DECODE(*pp, ginfo->max_compact) - UINT16DECODE(*pp, ginfo->min_dense) - UINT16DECODE(*pp, ginfo->est_num_entries) - UINT16DECODE(*pp, ginfo->est_name_len) + UINT32DECODE(*pp, ginfo->lheap_size_hint); + UINT16DECODE(*pp, ginfo->max_compact); + UINT16DECODE(*pp, ginfo->min_dense); + UINT16DECODE(*pp, ginfo->est_num_entries); + UINT16DECODE(*pp, ginfo->est_name_len); /* Update fields */ if (ginfo->max_compact != H5G_CRT_GINFO_MAX_COMPACT || ginfo->min_dense != H5G_CRT_GINFO_MIN_DENSE) @@ -606,9 +579,6 @@ H5P__gcrt_group_info_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -629,7 +599,7 @@ H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size) *(*pp)++ = (uint8_t)sizeof(unsigned); /* Encode the value */ - H5_ENCODE_UNSIGNED(*pp, crt_order_flags) + H5_ENCODE_UNSIGNED(*pp, crt_order_flags); } /* end if */ *size += (1 + sizeof(unsigned)); @@ -647,9 +617,6 @@ H5P__gcrt_link_info_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -665,13 +632,13 @@ H5P__gcrt_link_info_dec(const void **_pp, void *_value) enc_size = *(*pp)++; if (enc_size != sizeof(unsigned)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded"); /* Set property to default value */ - HDmemset(linfo, 0, sizeof(H5O_linfo_t)); + memset(linfo, 0, sizeof(H5O_linfo_t)); *linfo = H5G_def_linfo_g; - H5_DECODE_UNSIGNED(*pp, crt_order_flags) + H5_DECODE_UNSIGNED(*pp, crt_order_flags); /* Update fields */ linfo->track_corder = (hbool_t)((crt_order_flags & H5P_CRT_ORDER_TRACKED) ? TRUE : FALSE); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pint.c index 6a8d2e065e..b9db915074 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,8 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * +/* * Purpose: Generic Property Functions */ @@ -422,9 +420,6 @@ static const H5I_class_t H5I_GENPROPLST_CLS[1] = {{ * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, March 4, 2000 - * *------------------------------------------------------------------------- */ herr_t @@ -444,9 +439,9 @@ H5P_init_phase1(void) * Initialize the Generic Property class & object groups. */ if (H5I_register_type(H5I_GENPROPCLS_CLS) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); if (H5I_register_type(H5I_GENPROPLST_CLS) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group") + HGOTO_ERROR(H5E_ID, H5E_CANTINIT, FAIL, "unable to initialize ID group"); /* Repeatedly pass over the list of property list classes for the library, * initializing each class if its parent class is initialized, until no @@ -462,11 +457,11 @@ H5P_init_phase1(void) H5P_libclass_t const *lib_class = init_class[u]; /* Current class to operate on */ /* Check if the current class hasn't been initialized and can be now */ - HDassert(lib_class->class_id); + assert(lib_class->class_id); if (*lib_class->class_id == (-1) && (lib_class->par_pclass == NULL || *lib_class->par_pclass != NULL)) { /* Sanity check - only the root class is not allowed to have a parent class */ - HDassert(lib_class->par_pclass || lib_class == H5P_CLS_ROOT); + assert(lib_class->par_pclass || lib_class == H5P_CLS_ROOT); /* Allocate the new class */ if (NULL == (*lib_class->pclass = H5P__create_class( @@ -474,22 +469,22 @@ H5P_init_phase1(void) lib_class->type, lib_class->create_func, lib_class->create_data, lib_class->copy_func, lib_class->copy_data, lib_class->close_func, lib_class->close_data))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "class initialization failed"); /* Call routine to register properties for class */ if (lib_class->reg_prop_func && (*lib_class->reg_prop_func)(*lib_class->pclass) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register properties"); /* Register the new class */ if ((*lib_class->class_id = H5I_register(H5I_GENPROP_CLS, *lib_class->pclass, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't register property list class"); /* Only register the default property list if it hasn't been created yet */ if (lib_class->def_plist_id && *lib_class->def_plist_id == (-1)) { /* Register the default property list for the new class*/ if ((*lib_class->def_plist_id = H5P_create_id(*lib_class->pclass, FALSE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, - "can't register default property list for class") + "can't register default property list for class"); } /* end if */ /* Increment class initialization counters */ @@ -500,7 +495,7 @@ H5P_init_phase1(void) } while (pass_init > 0); /* Verify that all classes were initialized */ - HDassert(tot_init == NELMTS(init_class)); + assert(tot_init == NELMTS(init_class)); done: if (ret_value < 0 && tot_init > 0) { @@ -511,16 +506,16 @@ H5P_init_phase1(void) for (u = 0; u < NELMTS(init_class); u++) { H5P_libclass_t const *lib_class = init_class[u]; /* Current class to operate on */ - HDassert(lib_class->class_id); + assert(lib_class->class_id); if (*lib_class->class_id >= 0) { /* Close the class ID */ if (H5I_dec_ref(*lib_class->class_id) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to close property list class ID") + HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to close property list class ID"); } else if (lib_class->pclass && *lib_class->pclass) { /* Close a half-initialized pclass */ if (H5P__close_class(*lib_class->pclass) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to close property list class") + HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to close property list class"); } } } @@ -551,7 +546,7 @@ H5P_init_phase2(void) /* Set up the default VFL driver */ if (H5P__facc_set_def_driver() < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "unable to set default VFL driver") + HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "unable to set default VFL driver"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -693,9 +688,6 @@ H5P_term_package(void) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Wednesday, April 8, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -707,7 +699,7 @@ H5P__close_class_cb(void *_pclass, void H5_ATTR_UNUSED **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(pclass); + assert(pclass); /* Close the property list class object */ if (H5P__close_class(pclass) < 0) @@ -724,9 +716,6 @@ H5P__close_class_cb(void *_pclass, void H5_ATTR_UNUSED **request) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Wednesday, April 8, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -738,7 +727,7 @@ H5P__close_list_cb(void *_plist, void H5_ATTR_UNUSED **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); + assert(plist); /* Close the property list object */ if (H5P_close(plist) < 0) @@ -780,30 +769,30 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(slist); - HDassert(prop); - HDassert(prop->cmp); - HDassert(cb); + assert(slist); + assert(prop); + assert(prop->cmp); + assert(cb); /* Allocate space for a temporary copy of the property value */ if (NULL == (tmp_value = H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value"); H5MM_memcpy(tmp_value, prop->value, prop->size); /* Call "type 1" callback ('create', 'copy' or 'close') */ if (cb(prop->name, prop->size, tmp_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Property callback failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Property callback failed"); /* Make a copy of the class's property */ if (NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property"); /* Copy the changed value into the new property */ H5MM_memcpy(pcopy->value, tmp_value, prop->size); /* Insert the changed property into the property list */ if (H5P__add_prop(slist, pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into skip list"); done: /* Release the temporary value buffer */ @@ -847,7 +836,7 @@ H5P__copy_pclass(H5P_genclass_t *pclass) FUNC_ENTER_PACKAGE - HDassert(pclass); + assert(pclass); /* * Create new property class object @@ -857,7 +846,7 @@ H5P__copy_pclass(H5P_genclass_t *pclass) if (NULL == (new_pclass = H5P__create_class(pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "unable to create property list class"); /* Copy the properties registered for this class */ if (pclass->nprops > 0) { @@ -868,11 +857,11 @@ H5P__copy_pclass(H5P_genclass_t *pclass) while (curr_node != NULL) { /* Make a copy of the class's property */ if (NULL == (pcopy = H5P__dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "Can't copy property"); /* Insert the initialized property into the property list */ if (H5P__add_prop(new_pclass->props, pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, NULL, "Can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, NULL, "Can't insert property into class"); /* Increment property count for class */ new_pclass->nprops++; @@ -929,7 +918,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) FUNC_ENTER_NOAPI(H5I_INVALID_HID) - HDassert(old_plist); + assert(old_plist); /* * Create new property list object @@ -937,7 +926,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Allocate room for the property list */ if (NULL == (new_plist = H5FL_CALLOC(H5P_genplist_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed"); /* Set class state */ new_plist->pclass = old_plist->pclass; @@ -947,12 +936,12 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Initialize the skip list to hold the changed properties */ if ((new_plist->props = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, - "can't create skip list for changed properties") + "can't create skip list for changed properties"); /* Create the skip list for deleted properties */ if ((new_plist->del = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, - "can't create skip list for deleted properties") + "can't create skip list for deleted properties"); /* Create the skip list to hold names of properties already seen * (This prevents a property in the class hierarchy from having it's @@ -960,7 +949,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) * already been seen) */ if ((seen = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for seen properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "can't create skip list for seen properties"); nseen = 0; /* Cycle through the deleted properties & copy them into the new list's deleted section */ @@ -971,17 +960,17 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Duplicate string for insertion into new deleted property skip list */ if ((new_name = H5MM_xstrdup((char *)H5SL_item(curr_node))) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "memory allocation failed"); /* Insert property name into deleted list */ if (H5SL_insert(new_plist->del, new_name, new_name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, - "can't insert property into deleted skip list") + "can't insert property into deleted skip list"); /* Add property name to "seen" list */ if (H5SL_insert(seen, new_name, new_name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, - "can't insert property into seen skip list") + "can't insert property into seen skip list"); nseen++; /* Get the next property node in the skip list */ @@ -998,26 +987,26 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Make a copy of the list's property */ if (NULL == (new_prop = H5P__dup_prop(tmp, H5P_PROP_WITHIN_LIST))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property"); /* Call property copy callback, if it exists */ if (new_prop->copy) { if ((new_prop->copy)(new_prop->name, new_prop->size, new_prop->value) < 0) { H5P__free_prop(new_prop); - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't copy property"); } /* end if */ } /* end if */ /* Insert the initialized property into the property list */ if (H5P__add_prop(new_plist->props, new_prop) < 0) { H5P__free_prop(new_prop); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "Can't insert property into list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, "Can't insert property into list"); } /* end if */ /* Add property name to "seen" list */ if (H5SL_insert(seen, new_prop->name, new_prop->name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, - "can't insert property into seen skip list") + "can't insert property into seen skip list"); nseen++; /* Increment the number of properties in list */ @@ -1048,14 +1037,14 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) if (tmp->copy) { /* Call the callback & insert changed value into skip list (if necessary) */ if (H5P__do_prop_cb1(new_plist->props, tmp, tmp->copy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't create property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5I_INVALID_HID, "Can't create property"); } /* end if */ /* Add property name to "seen" list, if we have other classes to work on */ if (has_parent_class) { if (H5SL_insert(seen, tmp->name, tmp->name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5I_INVALID_HID, - "can't insert property into seen skip list") + "can't insert property into seen skip list"); nseen++; } /* end if */ @@ -1074,11 +1063,11 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) /* Increment the number of property lists derived from class */ if (H5P__access_class(new_plist->pclass, H5P_MOD_INC_LST) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ref count") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't increment class ref count"); /* Get an ID for the property list */ if ((new_plist_id = H5I_register(H5I_GENPROP_LST, new_plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list"); /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ @@ -1093,7 +1082,7 @@ H5P_copy_plist(const H5P_genplist_t *old_plist, hbool_t app_ref) if ((tclass->copy_func)(new_plist_id, old_plist->plist_id, old_plist->pclass->copy_data) < 0) { /* Delete ID, ignore return value */ H5I_remove(new_plist_id); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property"); } /* end if */ } /* end if */ @@ -1145,12 +1134,12 @@ H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) FUNC_ENTER_PACKAGE - HDassert(oprop); - HDassert(type != H5P_PROP_WITHIN_UNKNOWN); + assert(oprop); + assert(type != H5P_PROP_WITHIN_UNKNOWN); /* Allocate the new property */ if (NULL == (prop = H5FL_MALLOC(H5P_genprop_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy basic property information */ H5MM_memcpy(prop, oprop, sizeof(H5P_genprop_t)); @@ -1159,8 +1148,8 @@ H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) /* Duplicating property for a class */ if (type == H5P_PROP_WITHIN_CLASS) { - HDassert(oprop->type == H5P_PROP_WITHIN_CLASS); - HDassert(oprop->shared_name == FALSE); + assert(oprop->type == H5P_PROP_WITHIN_CLASS); + assert(oprop->shared_name == FALSE); /* Duplicate name */ prop->name = H5MM_xstrdup(oprop->name); @@ -1177,8 +1166,8 @@ H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) } /* end if */ /* Duplicating a property from a class */ else { - HDassert(oprop->type == H5P_PROP_WITHIN_CLASS); - HDassert(oprop->shared_name == FALSE); + assert(oprop->type == H5P_PROP_WITHIN_CLASS); + assert(oprop->shared_name == FALSE); /* Share the name */ prop->shared_name = TRUE; @@ -1190,9 +1179,9 @@ H5P__dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) /* Duplicate current value, if it exists */ if (oprop->value != NULL) { - HDassert(prop->size > 0); + assert(prop->size > 0); if (NULL == (prop->value = H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5MM_memcpy(prop->value, oprop->value, prop->size); } /* end if */ @@ -1259,13 +1248,13 @@ H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type, const vo FUNC_ENTER_PACKAGE - HDassert(name); - HDassert((size > 0 && value != NULL) || (size == 0)); - HDassert(type != H5P_PROP_WITHIN_UNKNOWN); + assert(name); + assert((size > 0 && value != NULL) || (size == 0)); + assert(type != H5P_PROP_WITHIN_UNKNOWN); /* Allocate the new property */ if (NULL == (prop = H5FL_MALLOC(H5P_genprop_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Set the property initial values */ prop->name = H5MM_xstrdup(name); /* Duplicate name */ @@ -1276,7 +1265,7 @@ H5P__create_prop(const char *name, size_t size, H5P_prop_within_t type, const vo /* Duplicate value, if it exists */ if (value != NULL) { if (NULL == (prop->value = H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5MM_memcpy(prop->value, value, prop->size); } /* end if */ else @@ -1340,13 +1329,13 @@ H5P__add_prop(H5SL_t *slist, H5P_genprop_t *prop) FUNC_ENTER_PACKAGE - HDassert(slist); - HDassert(prop); - HDassert(prop->type != H5P_PROP_WITHIN_UNKNOWN); + assert(slist); + assert(prop); + assert(prop->type != H5P_PROP_WITHIN_UNKNOWN); /* Insert property into skip list */ if (H5SL_insert(slist, prop, prop->name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into skip list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1377,12 +1366,12 @@ H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name) FUNC_ENTER_PACKAGE - HDassert(plist); - HDassert(name); + assert(plist); + assert(name); /* Check if the property has been deleted from list */ if (H5SL_search(plist->del, name) != NULL) { - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "property deleted from skip list") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "property deleted from skip list"); } /* end if */ else { /* Get the property data from the skip list */ @@ -1403,7 +1392,7 @@ H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name) /* Check if we haven't found the property */ if (ret_value == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't find property in skip list") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't find property in skip list"); } /* end else */ } /* end else */ @@ -1436,12 +1425,12 @@ H5P__find_prop_pclass(H5P_genclass_t *pclass, const char *name) FUNC_ENTER_PACKAGE - HDassert(pclass); - HDassert(name); + assert(pclass); + assert(name); /* Get the property from the skip list */ if (NULL == (ret_value = (H5P_genprop_t *)H5SL_search(pclass->props, name))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't find property in skip list") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't find property in skip list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1470,7 +1459,7 @@ H5P__free_prop(H5P_genprop_t *prop) { FUNC_ENTER_PACKAGE_NOERR - HDassert(prop); + assert(prop); /* Release the property value if it exists */ if (prop->value) @@ -1513,7 +1502,7 @@ H5P__free_prop_cb(void *item, void H5_ATTR_UNUSED *key, void *op_data) FUNC_ENTER_PACKAGE_NOERR - HDassert(tprop); + assert(tprop); /* Call the close callback and ignore the return value, there's nothing we can do about it */ if (make_cb && tprop->close != NULL) @@ -1551,7 +1540,7 @@ H5P__free_del_name_cb(void *item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED FUNC_ENTER_PACKAGE_NOERR - HDassert(del_name); + assert(del_name); /* Free the name */ H5MM_xfree(del_name); @@ -1586,8 +1575,8 @@ H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) { FUNC_ENTER_PACKAGE_NOERR - HDassert(pclass); - HDassert(mod > H5P_MOD_ERR && mod < H5P_MOD_MAX); + assert(pclass); + assert(mod > H5P_MOD_ERR && mod < H5P_MOD_MAX); switch (mod) { case H5P_MOD_INC_CLS: /* Increment the dependent class count*/ @@ -1624,14 +1613,14 @@ H5P__access_class(H5P_genclass_t *pclass, H5P_class_mod_t mod) case H5P_MOD_ERR: case H5P_MOD_MAX: default: - HDassert(0 && "Invalid H5P class modification"); + assert(0 && "Invalid H5P class modification"); } /* end switch */ /* Check if we can release the class information now */ if (pclass->deleted && pclass->plists == 0 && pclass->classes == 0) { H5P_genclass_t *par_class = pclass->parent; /* Pointer to class's parent */ - HDassert(pclass->name); + assert(pclass->name); H5MM_xfree(pclass->name); /* Free the class properties without making callbacks */ @@ -1681,9 +1670,9 @@ H5P__open_class_path_cb(void *_obj, hid_t H5_ATTR_UNUSED id, void *_key) FUNC_ENTER_PACKAGE_NOERR - HDassert(obj); - HDassert(H5I_GENPROP_CLS == H5I_get_type(id)); - HDassert(key); + assert(obj); + assert(H5I_GENPROP_CLS == H5I_get_type(id)); + assert(key); /* Check if the class object has the same parent as the new class */ if (obj->parent == key->parent) { @@ -1740,20 +1729,20 @@ H5P__create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t FUNC_ENTER_PACKAGE - HDassert(name); + assert(name); /* Allow internal classes to break some rules */ /* (This allows the root of the tree to be created with this routine -QAK) */ if (type == H5P_TYPE_USER) - HDassert(par_class); + assert(par_class); /* Allocate room for the class */ if (NULL == (pclass = H5FL_CALLOC(H5P_genclass_t))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "property list class allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "property list class allocation failed"); /* Set class state */ pclass->parent = par_class; if (NULL == (pclass->name = H5MM_xstrdup(name))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "property list class name allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, NULL, "property list class name allocation failed"); pclass->type = type; pclass->nprops = 0; /* Classes are created without properties initially */ pclass->plists = 0; /* No properties lists of this class yet */ @@ -1764,7 +1753,7 @@ H5P__create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t /* Create the skip list for properties */ if (NULL == (pclass->props = H5SL_create(H5SL_TYPE_STR, NULL))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "can't create skip list for properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "can't create skip list for properties"); /* Set callback functions and pass-along data */ pclass->create_func = cls_create; @@ -1777,7 +1766,7 @@ H5P__create_class(H5P_genclass_t *par_class, const char *name, H5P_plist_type_t /* Increment parent class's derived class value */ if (par_class != NULL) { if (H5P__access_class(par_class, H5P_MOD_INC_CLS) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL, "Can't increment parent class ref count") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL, "Can't increment parent class ref count"); } /* end if */ /* Set return value */ @@ -1836,7 +1825,7 @@ H5P__create(H5P_genclass_t *pclass) FUNC_ENTER_PACKAGE - HDassert(pclass); + assert(pclass); /* * Create new property list object @@ -1844,7 +1833,7 @@ H5P__create(H5P_genclass_t *pclass) /* Allocate room for the property list */ if (NULL == (plist = H5FL_CALLOC(H5P_genplist_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Set class state */ plist->pclass = pclass; @@ -1853,11 +1842,11 @@ H5P__create(H5P_genclass_t *pclass) /* Create the skip list for changed properties */ if ((plist->props = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "can't create skip list for changed properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "can't create skip list for changed properties"); /* Create the skip list for deleted properties */ if ((plist->del = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "can't create skip list for deleted properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "can't create skip list for deleted properties"); /* Create the skip list to hold names of properties already seen * (This prevents a property in the class hierarchy from having it's @@ -1865,7 +1854,7 @@ H5P__create(H5P_genclass_t *pclass) * already been seen) */ if ((seen = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "can't create skip list for seen properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, NULL, "can't create skip list for seen properties"); /* * Check if we should copy class properties (up through list of parent classes also), @@ -1888,13 +1877,13 @@ H5P__create(H5P_genclass_t *pclass) if (tmp->create) { /* Call the callback & insert changed value into skip list (if necessary) */ if (H5P__do_prop_cb1(plist->props, tmp, tmp->create) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "Can't create property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "Can't create property"); } /* end if */ /* Add property name to "seen" list */ if (H5SL_insert(seen, tmp->name, tmp->name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, NULL, - "can't insert property into seen skip list") + "can't insert property into seen skip list"); /* Increment the number of properties in list */ plist->nprops++; @@ -1911,7 +1900,7 @@ H5P__create(H5P_genclass_t *pclass) /* Increment the number of property lists derived from class */ if (H5P__access_class(plist->pclass, H5P_MOD_INC_LST) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL, "Can't increment class ref count") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, NULL, "Can't increment class ref count"); /* Set return value */ ret_value = plist; @@ -1975,15 +1964,15 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) FUNC_ENTER_NOAPI(H5I_INVALID_HID) - HDassert(pclass); + assert(pclass); /* Create the new property list */ if ((plist = H5P__create(pclass)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list"); /* Get an ID for the property list */ if ((plist_id = H5I_register(H5I_GENPROP_LST, plist, app_ref)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register property list"); /* Save the property list ID in the property list struct, for use in the property class's 'close' callback */ @@ -1998,7 +1987,7 @@ H5P_create_id(H5P_genclass_t *pclass, hbool_t app_ref) if ((tclass->create_func)(plist_id, tclass->create_data) < 0) { /* Delete ID, ignore return value */ H5I_remove(plist_id); - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, H5I_INVALID_HID, "Can't initialize property"); } /* end if */ } /* end if */ @@ -2215,25 +2204,25 @@ H5P__register_real(H5P_genclass_t *pclass, const char *name, size_t size, const FUNC_ENTER_PACKAGE - HDassert(pclass); - HDassert(0 == pclass->plists); - HDassert(0 == pclass->classes); - HDassert(name); - HDassert((size > 0 && def_value != NULL) || (size == 0)); + assert(pclass); + assert(0 == pclass->plists); + assert(0 == pclass->classes); + assert(name); + assert((size > 0 && def_value != NULL) || (size == 0)); /* Check for duplicate named properties */ if (NULL != H5SL_search(pclass->props, name)) - HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists") + HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists"); /* Create property object from parameters */ if (NULL == (new_prop = H5P__create_prop(name, size, H5P_PROP_WITHIN_CLASS, def_value, prp_create, prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property"); /* Insert property into property list class */ if (H5P__add_prop(pclass->props, new_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class"); /* Increment property count for class */ pclass->nprops++; @@ -2244,7 +2233,7 @@ H5P__register_real(H5P_genclass_t *pclass, const char *name, size_t size, const done: if (ret_value < 0) if (new_prop && H5P__free_prop(new_prop) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property") + HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property"); FUNC_LEAVE_NOAPI(ret_value) } /* H5P__register_real() */ @@ -2446,8 +2435,8 @@ H5P__register(H5P_genclass_t **ppclass, const char *name, size_t size, const voi FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(ppclass); - HDassert(pclass); + assert(ppclass); + assert(pclass); /* Check if class needs to be split because property lists or classes have * been created since the last modification was made to the class. @@ -2456,7 +2445,7 @@ H5P__register(H5P_genclass_t **ppclass, const char *name, size_t size, const voi if (NULL == (new_class = H5P__create_class( pclass->parent, pclass->name, pclass->type, pclass->create_func, pclass->create_data, pclass->copy_func, pclass->copy_data, pclass->close_func, pclass->close_data))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy class"); /* Walk through the skip list of the old class and copy properties */ if (pclass->nprops > 0) { @@ -2470,11 +2459,11 @@ H5P__register(H5P_genclass_t **ppclass, const char *name, size_t size, const voi /* Make a copy of the class's property */ if (NULL == (pcopy = H5P__dup_prop((H5P_genprop_t *)H5SL_item(curr_node), H5P_PROP_WITHIN_CLASS))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property"); /* Insert the initialized property into the property class */ if (H5P__add_prop(new_class->props, pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class"); /* Increment property count for class */ new_class->nprops++; @@ -2491,7 +2480,7 @@ H5P__register(H5P_genclass_t **ppclass, const char *name, size_t size, const voi /* Really register the property in the class */ if (H5P__register_real(pclass, name, size, def_value, prp_create, prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't register property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't register property"); /* Update pointer to pointer to class, if a new one was generated */ if (new_class) @@ -2500,7 +2489,7 @@ H5P__register(H5P_genclass_t **ppclass, const char *name, size_t size, const voi done: if (ret_value < 0) if (new_class && H5P__close_class(new_class) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close new property class") + HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close new property class"); FUNC_LEAVE_NOAPI(ret_value) } /* H5P__register() */ @@ -2685,13 +2674,13 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5 FUNC_ENTER_NOAPI_NOINIT - HDassert(plist); - HDassert(name); - HDassert((size > 0 && value != NULL) || (size == 0)); + assert(plist); + assert(name); + assert((size > 0 && value != NULL) || (size == 0)); /* Check for duplicate named properties */ if (NULL != H5SL_search(plist->props, name)) - HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists") + HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists"); /* Check if the property has been deleted */ if (NULL != H5SL_search(plist->del, name)) { @@ -2699,7 +2688,7 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5 /* Remove the property name from the deleted property skip list */ if (NULL == (temp_name = (char *)H5SL_remove(plist->del, name))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from deleted skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from deleted skip list"); /* free the name of the removed property */ H5MM_xfree(temp_name); @@ -2713,7 +2702,7 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5 if (tclass->nprops > 0) { /* Find the property in the class */ if (NULL != H5SL_search(tclass->props, name)) - HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists") + HGOTO_ERROR(H5E_PLIST, H5E_EXISTS, FAIL, "property already exists"); } /* end if */ /* Go up to parent class */ @@ -2727,11 +2716,11 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5 if (NULL == (new_prop = H5P__create_prop(name, size, H5P_PROP_WITHIN_LIST, value, NULL, prp_set, prp_get, prp_encode, prp_decode, prp_delete, prp_copy, prp_cmp, prp_close))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property"); /* Insert property into property list class */ if (H5P__add_prop(plist->props, new_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class"); /* Increment property count for class */ plist->nprops++; @@ -2739,7 +2728,7 @@ H5P_insert(H5P_genplist_t *plist, const char *name, size_t size, void *value, H5 done: if (ret_value < 0) if (new_prop && H5P__free_prop(new_prop) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property") + HDONE_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close property"); FUNC_LEAVE_NOAPI(ret_value) } /* H5P_insert() */ @@ -2778,20 +2767,20 @@ H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(plist_op); - HDassert(pclass_op); + assert(plist); + assert(name); + assert(plist_op); + assert(pclass_op); /* Check if the property has been deleted */ if (NULL != H5SL_search(plist->del, name)) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); /* Find property in changed list */ if (NULL != (prop = (H5P_genprop_t *)H5SL_search(plist->props, name))) { /* Call the 'found in property list' callback */ if ((*plist_op)(plist, name, prop, udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on property"); } /* end if */ else { /* @@ -2805,7 +2794,7 @@ H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op if (NULL != (prop = (H5P_genprop_t *)H5SL_search(tclass->props, name))) { /* Call the 'found in class' callback */ if ((*pclass_op)(plist, name, prop, udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on property"); /* Leave */ break; @@ -2820,7 +2809,7 @@ H5P__do_prop(H5P_genplist_t *plist, const char *name, H5P_do_plist_op_t plist_op * nor in the properties in the class hierarchy, indicate an error */ if (NULL == tclass) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't find property in skip list") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't find property in skip list"); } /* end else */ done: @@ -2858,13 +2847,13 @@ H5P__poke_plist_cb(H5P_genplist_t H5_ATTR_NDEBUG_UNUSED *plist, const char H5_AT FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(prop); + assert(plist); + assert(name); + assert(prop); /* Check for property size >0 */ if (0 == prop->size) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); /* Overwrite value in property */ H5MM_memcpy(prop->value, udata->value, prop->size); @@ -2905,24 +2894,24 @@ H5P__poke_pclass_cb(H5P_genplist_t *plist, const char H5_ATTR_NDEBUG_UNUSED *nam FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(prop); - HDassert(prop->cmp); + assert(plist); + assert(name); + assert(prop); + assert(prop->cmp); /* Check for property size >0 */ if (0 == prop->size) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); /* Make a copy of the class's property */ if (NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property"); H5MM_memcpy(pcopy->value, udata->value, pcopy->size); /* Insert the changed property into the property list */ if (H5P__add_prop(plist->props, pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert changed property into skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert changed property into skip list"); done: /* Cleanup on failure */ @@ -2966,14 +2955,14 @@ H5P_poke(H5P_genplist_t *plist, const char *name, const void *value) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(value); + assert(plist); + assert(name); + assert(value); /* Find the property and set the value */ udata.value = value; if (H5P__do_prop(plist, name, H5P__poke_plist_cb, H5P__poke_pclass_cb, &udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to overwrite value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to overwrite value"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3011,24 +3000,24 @@ H5P__set_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(prop); + assert(plist); + assert(name); + assert(prop); /* Check for property size >0 */ if (0 == prop->size) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); /* Make a copy of the value and pass to 'set' callback */ if (NULL != prop->set) { /* Make a copy of the current value, in case the callback fails */ if (NULL == (tmp_value = H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value"); H5MM_memcpy(tmp_value, udata->value, prop->size); /* Call user's callback */ if ((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value"); /* Set the pointer for copying */ prp_value = tmp_value; @@ -3041,7 +3030,7 @@ H5P__set_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, if (NULL != prop->del) { /* Call user's 'delete' callback */ if ((*(prop->del))(plist->plist_id, name, prop->size, prop->value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release property value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release property value"); } /* end if */ /* Copy new [possibly unchanged] value into property value */ @@ -3088,25 +3077,25 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(prop); - HDassert(prop->cmp); + assert(plist); + assert(name); + assert(prop); + assert(prop->cmp); /* Check for property size >0 */ if (0 == prop->size) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); /* Make a copy of the value and pass to 'set' callback */ if (NULL != prop->set) { /* Make a copy of the current value, in case the callback fails */ if (NULL == (tmp_value = H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value"); H5MM_memcpy(tmp_value, udata->value, prop->size); /* Call user's callback */ if ((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value"); /* Set the pointer for copying */ prp_value = tmp_value; @@ -3117,13 +3106,13 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, /* Make a copy of the class's property */ if (NULL == (pcopy = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property"); H5MM_memcpy(pcopy->value, prp_value, pcopy->size); /* Insert the changed property into the property list */ if (H5P__add_prop(plist->props, pcopy) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert changed property into skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert changed property into skip list"); done: /* Free the temporary value buffer */ @@ -3178,14 +3167,14 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(value); + assert(plist); + assert(name); + assert(value); /* Find the property and set the value */ udata.value = value; if (H5P__do_prop(plist, name, H5P__set_plist_cb, H5P__set_pclass_cb, &udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to set value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to set value"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3225,17 +3214,17 @@ H5P__class_get(const H5P_genclass_t *pclass, const char *name, void *value) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(pclass); - HDassert(name); - HDassert(value); + assert(pclass); + assert(name); + assert(value); /* Find property in list */ if (NULL == (prop = (H5P_genprop_t *)H5SL_search(pclass->props, name))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); /* Check for property size >0 */ if (0 == prop->size) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); /* Copy the property value */ H5MM_memcpy(value, prop->value, prop->size); @@ -3280,17 +3269,17 @@ H5P__class_set(const H5P_genclass_t *pclass, const char *name, const void *value FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(pclass); - HDassert(name); - HDassert(value); + assert(pclass); + assert(name); + assert(value); /* Find property in list */ if (NULL == (prop = (H5P_genprop_t *)H5SL_search(pclass->props, name))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); /* Check for property size >0 */ if (0 == prop->size) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); /* Copy the property value */ H5MM_memcpy(prop->value, value, prop->size); @@ -3327,8 +3316,8 @@ H5P_exist_plist(const H5P_genplist_t *plist, const char *name) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(plist); - HDassert(name); + assert(plist); + assert(name); /* Check for property in deleted property list */ if (H5SL_search(plist->del, name) != NULL) @@ -3343,7 +3332,7 @@ H5P_exist_plist(const H5P_genplist_t *plist, const char *name) tclass = plist->pclass; while (tclass != NULL) { if (H5SL_search(tclass->props, name) != NULL) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); /* Go up to parent class */ tclass = tclass->parent; @@ -3386,8 +3375,8 @@ H5P__exist_pclass(H5P_genclass_t *pclass, const char *name) FUNC_ENTER_PACKAGE_NOERR - HDassert(pclass); - HDassert(name); + assert(pclass); + assert(name); /* Check for property in property list */ if (H5SL_search(pclass->props, name) != NULL) @@ -3398,7 +3387,7 @@ H5P__exist_pclass(H5P_genclass_t *pclass, const char *name) tclass = pclass->parent; while (tclass != NULL) { if (H5SL_search(tclass->props, name) != NULL) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); /* Go up to parent class */ tclass = tclass->parent; @@ -3442,13 +3431,13 @@ H5P__get_size_plist(const H5P_genplist_t *plist, const char *name, size_t *size) FUNC_ENTER_PACKAGE - HDassert(plist); - HDassert(name); - HDassert(size); + assert(plist); + assert(name); + assert(size); /* Find property */ if (NULL == (prop = H5P__find_prop_plist(plist, name))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); /* Get property size */ *size = prop->size; @@ -3487,13 +3476,13 @@ H5P__get_size_pclass(H5P_genclass_t *pclass, const char *name, size_t *size) FUNC_ENTER_PACKAGE - HDassert(pclass); - HDassert(name); - HDassert(size); + assert(pclass); + assert(name); + assert(size); /* Find property */ if ((prop = H5P__find_prop_pclass(pclass, name)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); /* Get property size */ *size = prop->size; @@ -3527,8 +3516,8 @@ H5P__get_nprops_plist(const H5P_genplist_t *plist, size_t *nprops) { FUNC_ENTER_PACKAGE_NOERR - HDassert(plist); - HDassert(nprops); + assert(plist); + assert(nprops); /* Get property size */ *nprops = plist->nprops; @@ -3564,8 +3553,8 @@ H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recu FUNC_ENTER_NOAPI_NOERR - HDassert(pclass); - HDassert(nprops); + assert(pclass); + assert(nprops); /* Get number of properties */ *nprops = pclass->nprops; @@ -3610,8 +3599,8 @@ H5P__cmp_prop(const H5P_genprop_t *prop1, const H5P_genprop_t *prop2) FUNC_ENTER_PACKAGE_NOERR - HDassert(prop1); - HDassert(prop2); + assert(prop1); + assert(prop2); /* Check the name */ if ((cmp_value = HDstrcmp(prop1->name, prop2->name)) != 0) @@ -3741,8 +3730,8 @@ H5P__cmp_class(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) FUNC_ENTER_PACKAGE_NOERR - HDassert(pclass1); - HDassert(pclass2); + assert(pclass1); + assert(pclass2); /* Use the revision number to quickly check for identical classes */ if (pclass1->revision == pclass2->revision) @@ -3872,18 +3861,18 @@ H5P__cmp_plist_cb(H5P_genprop_t *prop, void *_udata) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(prop); - HDassert(udata); + assert(prop); + assert(udata); /* Check if the property exists in the second property list */ if ((prop2_exist = H5P_exist_plist(udata->plist2, prop->name)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5_ITER_ERROR, "can't lookup existence of property?") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5_ITER_ERROR, "can't lookup existence of property?"); if (prop2_exist) { const H5P_genprop_t *prop2; /* Pointer to property in second plist */ /* Look up same property in second property list */ if (NULL == (prop2 = H5P__find_prop_plist(udata->plist2, prop->name))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5_ITER_ERROR, "property doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, H5_ITER_ERROR, "property doesn't exist"); /* Compare the two properties */ if ((udata->cmp_value = H5P__cmp_prop(prop, prop2)) != 0) @@ -3932,9 +3921,9 @@ H5P__cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, int * FUNC_ENTER_PACKAGE - HDassert(plist1); - HDassert(plist2); - HDassert(cmp_ret); + assert(plist1); + assert(plist2); + assert(cmp_ret); /* Check the number of properties */ if (plist1->nprops < plist2->nprops) { @@ -3962,7 +3951,7 @@ H5P__cmp_plist(const H5P_genplist_t *plist1, const H5P_genplist_t *plist2, int * /* Iterate over properties in first property list */ if ((ret_value = H5P__iterate_plist(plist1, TRUE, &idx, H5P__cmp_plist_cb, &udata)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to iterate over list"); if (ret_value != 0) { *cmp_ret = udata.cmp_value; HGOTO_DONE(SUCCEED); @@ -4009,8 +3998,8 @@ H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2) FUNC_ENTER_NOAPI_NOERR - HDassert(pclass1); - HDassert(pclass2); + assert(pclass1); + assert(pclass2); /* Compare property classes */ if (H5P__cmp_class(pclass1, pclass2) == 0) { @@ -4064,13 +4053,13 @@ H5P_isa_class(hid_t plist_id, hid_t pclass_id) /* Check arguments. */ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); if (NULL == (pclass = (H5P_genclass_t *)H5I_object_verify(pclass_id, H5I_GENPROP_CLS))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property class"); /* Compare the property list's class against the other class */ if ((ret_value = H5P_class_isa(plist->pclass, pclass)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to compare property list classes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "unable to compare property list classes"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4113,11 +4102,11 @@ H5P_object_verify(hid_t plist_id, hid_t pclass_id) /* Compare the property list's class against the other class */ if (H5P_isa_class(plist_id, pclass_id) != TRUE) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, NULL, "property list is not a member of the class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, NULL, "property list is not a member of the class"); /* Get the plist structure */ if (NULL == (ret_value = (H5P_genplist_t *)H5I_object(plist_id))) - HGOTO_ERROR(H5E_ID, H5E_BADID, NULL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, NULL, "can't find object for ID"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4154,8 +4143,8 @@ H5P__iterate_plist_cb(void *_item, void *_key, void *_udata) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(item); - HDassert(key); + assert(item); + assert(key); /* Check if we've found the correctly indexed property */ if (*udata->curr_idx_ptr >= udata->prev_idx) { @@ -4170,7 +4159,7 @@ H5P__iterate_plist_cb(void *_item, void *_key, void *_udata) /* Add property name to 'seen' list */ if (H5SL_insert(udata->seen, key, key) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert property into 'seen' skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, H5_ITER_ERROR, "can't insert property into 'seen' skip list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4207,8 +4196,8 @@ H5P__iterate_plist_pclass_cb(void *_item, void *_key, void *_udata) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(item); - HDassert(key); + assert(item); + assert(key); /* Only call iterator callback for properties we haven't seen * before and that haven't been deleted. @@ -4286,13 +4275,13 @@ H5P__iterate_plist(const H5P_genplist_t *plist, hbool_t iter_all_prop, int *idx, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); - HDassert(idx); - HDassert(cb_func); + assert(plist); + assert(idx); + assert(cb_func); /* Create the skip list to hold names of properties already seen */ if (NULL == (seen = H5SL_create(H5SL_TYPE_STR, NULL))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't create skip list for seen properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't create skip list for seen properties"); /* Set up iterator callback info */ udata_int.plist = plist; @@ -4365,8 +4354,8 @@ H5P__iterate_pclass_cb(void *_item, void H5_ATTR_NDEBUG_UNUSED *_key, void *_uda FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(item); - HDassert((char *)_key); + assert(item); + assert((char *)_key); /* Check if we've found the correctly indexed property */ if (*udata->curr_idx_ptr >= udata->prev_idx) { @@ -4444,9 +4433,9 @@ H5P__iterate_pclass(const H5P_genclass_t *pclass, int *idx, H5P_iterate_int_t cb FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(pclass); - HDassert(idx); - HDassert(cb_func); + assert(pclass); + assert(idx); + assert(cb_func); /* Set up iterator callback info */ udata_int.cb_func = cb_func; @@ -4498,13 +4487,13 @@ H5P__peek_cb(H5P_genplist_t H5_ATTR_NDEBUG_UNUSED *plist, const char H5_ATTR_NDE FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(prop); + assert(plist); + assert(name); + assert(prop); /* Check for property size >0 */ if (0 == prop->size) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); /* Make a (shallow) copy of the value */ H5MM_memcpy(udata->value, prop->value, prop->size); @@ -4546,14 +4535,14 @@ H5P_peek(H5P_genplist_t *plist, const char *name, void *value) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(value); + assert(plist); + assert(name); + assert(value); /* Find the property and peek at the value */ udata.value = value; if (H5P__do_prop(plist, name, H5P__peek_cb, H5P__peek_cb, &udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to peek at value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to peek at value"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4591,24 +4580,24 @@ H5P__get_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, void * FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(prop); + assert(plist); + assert(name); + assert(prop); /* Check for property size >0 */ if (0 == prop->size) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size"); /* Call the 'get' callback, if there is one */ if (NULL != prop->get) { /* Make a copy of the current value, in case the callback fails */ if (NULL == (tmp_value = H5MM_malloc(prop->size))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value"); H5MM_memcpy(tmp_value, prop->value, prop->size); /* Call user's callback */ if ((*(prop->get))(plist->plist_id, name, prop->size, tmp_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value"); /* Copy new [possibly unchanged] value into return value */ H5MM_memcpy(udata->value, tmp_value, prop->size); @@ -4662,14 +4651,14 @@ H5P_get(H5P_genplist_t *plist, const char *name, void *value) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(value); + assert(plist); + assert(name); + assert(value); /* Find the property and get the value */ udata.value = value; if (H5P__do_prop(plist, name, H5P__get_cb, H5P__get_cb, &udata) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to get value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to get value"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4705,28 +4694,28 @@ H5P__del_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(prop); + assert(plist); + assert(name); + assert(prop); /* Pass value to 'close' callback, if it exists */ if (NULL != prop->del) { /* Call user's callback */ if ((*(prop->del))(plist->plist_id, name, prop->size, prop->value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release property value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release property value"); } /* end if */ /* Duplicate string for insertion into new deleted property skip list */ if (NULL == (del_name = H5MM_xstrdup(name))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Insert property name into deleted list */ if (H5SL_insert(plist->del, del_name, del_name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into deleted skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into deleted skip list"); /* Remove the property from the skip list */ if (NULL == H5SL_remove(plist->props, prop->name)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from skip list"); /* Free the property, ignoring return value, nothing we can do */ H5P__free_prop(prop); @@ -4774,30 +4763,30 @@ H5P__del_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(plist); - HDassert(name); - HDassert(prop); + assert(plist); + assert(name); + assert(prop); /* Pass value to 'del' callback, if it exists */ if (NULL != prop->del) { /* Allocate space for a temporary copy of the property value */ if (NULL == (tmp_value = H5MM_malloc(prop->size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, - "memory allocation failed for temporary property value") + "memory allocation failed for temporary property value"); H5MM_memcpy(tmp_value, prop->value, prop->size); /* Call user's callback */ if ((*(prop->del))(plist->plist_id, name, prop->size, tmp_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't close property value"); } /* end if */ /* Duplicate string for insertion into new deleted property skip list */ if (NULL == (del_name = H5MM_xstrdup(name))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Insert property name into deleted list */ if (H5SL_insert(plist->del, del_name, del_name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into deleted skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into deleted skip list"); /* Decrement the number of properties in list */ plist->nprops--; @@ -4849,12 +4838,12 @@ H5P_remove(H5P_genplist_t *plist, const char *name) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(plist); - HDassert(name); + assert(plist); + assert(name); /* Find the property and get the value */ if (H5P__do_prop(plist, name, H5P__del_plist_cb, H5P__del_pclass_cb, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to remove value") + HGOTO_ERROR(H5E_PLIST, H5E_CANTOPERATE, FAIL, "can't operate on plist to remove value"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4902,35 +4891,35 @@ H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) FUNC_ENTER_PACKAGE - HDassert(name); + assert(name); /* Get the objects to operate on */ if (NULL == (src_plist = (H5P_genplist_t *)H5I_object(src_id)) || NULL == (dst_plist = (H5P_genplist_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property object doesn't exist"); /* If the property exists in the destination already */ if (NULL != H5P__find_prop_plist(dst_plist, name)) { /* Delete the property from the destination list, calling the 'close' callback if necessary */ if (H5P_remove(dst_plist, name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property"); /* Get the pointer to the source property */ prop = H5P__find_prop_plist(src_plist, name); /* Make a copy of the source property */ if ((new_prop = H5P__dup_prop(prop, H5P_PROP_WITHIN_LIST)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property"); /* Call property copy callback, if it exists */ if (new_prop->copy) { if ((new_prop->copy)(new_prop->name, new_prop->size, new_prop->value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property"); } /* end if */ /* Insert the initialized property into the property list */ if (H5P__add_prop(dst_plist->props, new_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into list"); /* Increment the number of properties in list */ dst_plist->nprops++; @@ -4939,24 +4928,24 @@ H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name) else { /* Get the pointer to the source property */ if (NULL == (prop = H5P__find_prop_plist(src_plist, name))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist"); /* Create property object from parameters */ if (NULL == (new_prop = H5P__create_prop(prop->name, prop->size, H5P_PROP_WITHIN_LIST, prop->value, prop->create, prop->set, prop->get, prop->encode, prop->decode, prop->del, prop->copy, prop->cmp, prop->close))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "Can't create property"); /* Call property creation callback, if it exists */ if (new_prop->create) { if ((new_prop->create)(new_prop->name, new_prop->size, new_prop->value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't initialize property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't initialize property"); } /* end if */ /* Insert property into property list class */ if (H5P__add_prop(dst_plist->props, new_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "Can't insert property into class"); /* Increment property count for class */ dst_plist->nprops++; @@ -5013,30 +5002,30 @@ H5P__copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(name); + assert(name); /* Get property list classes */ if (NULL == (src_pclass = (H5P_genclass_t *)H5I_object(src_id))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "source property class object doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "source property class object doesn't exist"); if (NULL == (dst_pclass = (H5P_genclass_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "destination property class object doesn't exist") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "destination property class object doesn't exist"); /* Get the property from the source */ if (NULL == (prop = H5P__find_prop_pclass(src_pclass, name))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to locate property") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "unable to locate property"); /* If the property exists in the destination already */ if (H5P__exist_pclass(dst_pclass, name)) { /* Delete the old property from the destination class */ if (H5P__unregister(dst_pclass, name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property"); } /* end if */ /* Register the property into the destination */ orig_dst_pclass = dst_pclass; if (H5P__register(&dst_pclass, name, prop->size, prop->value, prop->create, prop->set, prop->get, prop->encode, prop->decode, prop->del, prop->copy, prop->cmp, prop->close) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "unable to remove property"); /* Check if the property class changed and needs to be substituted in the ID */ if (dst_pclass != orig_dst_pclass) { @@ -5044,13 +5033,13 @@ H5P__copy_prop_pclass(hid_t dst_id, hid_t src_id, const char *name) /* Substitute the new destination property class in the ID */ if (NULL == (old_dst_pclass = (H5P_genclass_t *)H5I_subst(dst_id, dst_pclass))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to substitute property class in ID") - HDassert(old_dst_pclass == orig_dst_pclass); + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to substitute property class in ID"); + assert(old_dst_pclass == orig_dst_pclass); /* Close the previous class */ if (H5P__close_class(old_dst_pclass) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, FAIL, - "unable to close original property class after substitution") + "unable to close original property class after substitution"); } /* end if */ done: @@ -5088,16 +5077,16 @@ H5P__unregister(H5P_genclass_t *pclass, const char *name) FUNC_ENTER_PACKAGE - HDassert(pclass); - HDassert(name); + assert(pclass); + assert(name); /* Get the property node from the skip list */ if ((prop = (H5P_genprop_t *)H5SL_search(pclass->props, name)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't find property in skip list") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't find property in skip list"); /* Remove the property from the skip list */ if (H5SL_remove(pclass->props, prop->name) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDELETE, FAIL, "can't remove property from skip list"); /* Free the property, ignoring return value, nothing we can do */ H5P__free_prop(prop); @@ -5151,7 +5140,7 @@ H5P_close(H5P_genplist_t *plist) FUNC_ENTER_NOAPI_NOINIT - HDassert(plist); + assert(plist); /* Make call to property list class close callback, if needed * (up through chain of parent classes also) @@ -5175,7 +5164,7 @@ H5P_close(H5P_genplist_t *plist) * already been seen) */ if ((seen = H5SL_create(H5SL_TYPE_STR, NULL)) == NULL) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't create skip list for seen properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, FAIL, "can't create skip list for seen properties"); nseen = 0; /* Walk through the changed properties in the list */ @@ -5193,7 +5182,7 @@ H5P_close(H5P_genplist_t *plist) /* Add property name to "seen" list */ if (H5SL_insert(seen, tmp->name, tmp->name) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into seen skip list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into seen skip list"); nseen++; /* Get the next property node in the skip list */ @@ -5231,7 +5220,7 @@ H5P_close(H5P_genplist_t *plist) /* Allocate space for a temporary copy of the property value */ if (NULL == (tmp_value = H5MM_malloc(tmp->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for temporary property value") + "memory allocation failed for temporary property value"); H5MM_memcpy(tmp_value, tmp->value, tmp->size); /* Call the 'close' callback */ @@ -5245,7 +5234,7 @@ H5P_close(H5P_genplist_t *plist) if (has_parent_class) { if (H5SL_insert(seen, tmp->name, tmp->name) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, - "can't insert property into seen skip list") + "can't insert property into seen skip list"); nseen++; } /* end if */ } /* end if */ @@ -5261,7 +5250,7 @@ H5P_close(H5P_genplist_t *plist) /* Decrement class's dependent property list value! */ if (H5P__access_class(plist->pclass, H5P_MOD_DEC_LST) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't decrement class ref count") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "Can't decrement class ref count"); /* Free the list of 'seen' properties */ H5SL_close(seen); @@ -5311,7 +5300,7 @@ H5P_get_class_name(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOERR - HDassert(pclass); + assert(pclass); /* Get class name */ ret_value = H5MM_xstrdup(pclass->name); @@ -5347,7 +5336,7 @@ H5P__get_class_path(H5P_genclass_t *pclass) FUNC_ENTER_PACKAGE - HDassert(pclass); + assert(pclass); /* Recursively build the full path */ if (pclass->parent != NULL) { @@ -5364,7 +5353,7 @@ H5P__get_class_path(H5P_genclass_t *pclass) ret_str_len = HDstrlen(par_path) + HDstrlen(pclass->name) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */ if (NULL == (ret_value = (char *)H5MM_malloc(ret_str_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name"); /* Build the full path for this class */ HDsnprintf(ret_value, ret_str_len, "%s/%s", par_path, pclass->name); @@ -5413,11 +5402,11 @@ H5P__open_class_path(const char *path) FUNC_ENTER_PACKAGE - HDassert(path); + assert(path); /* Duplicate the path to use */ tmp_path = H5MM_xstrdup(path); - HDassert(tmp_path); + assert(tmp_path); /* Find the generic property class with this full path */ curr_name = tmp_path; @@ -5433,9 +5422,9 @@ H5P__open_class_path(const char *path) /* Find the class with this name & parent by iterating over the open classes */ if (H5I_iterate(H5I_GENPROP_CLS, H5P__open_class_path_cb, &check_info, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes") + HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes"); else if (NULL == check_info.new_class) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class"); /* Advance the pointer in the path to the start of the next component */ curr_class = check_info.new_class; @@ -5451,13 +5440,13 @@ H5P__open_class_path(const char *path) /* Find the class with this name & parent by iterating over the open classes */ if (H5I_iterate(H5I_GENPROP_CLS, H5P__open_class_path_cb, &check_info, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes") + HGOTO_ERROR(H5E_PLIST, H5E_BADITER, NULL, "can't iterate over classes"); else if (NULL == check_info.new_class) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't locate class"); /* Copy it */ if (NULL == (ret_value = H5P__copy_pclass(check_info.new_class))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "can't copy property class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, NULL, "can't copy property class"); done: /* Free the duplicated path */ @@ -5492,7 +5481,7 @@ H5P__get_class_parent(const H5P_genclass_t *pclass) FUNC_ENTER_PACKAGE_NOERR - HDassert(pclass); + assert(pclass); /* Get property size */ ret_value = pclass->parent; @@ -5524,11 +5513,11 @@ H5P__close_class(H5P_genclass_t *pclass) FUNC_ENTER_NOAPI_NOINIT - HDassert(pclass); + assert(pclass); /* Decrement the reference count & check if the object should go away */ if (H5P__access_class(pclass, H5P_MOD_DEC_REF) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't decrement ID ref count") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't decrement ID ref count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5542,9 +5531,6 @@ H5P__close_class(H5P_genclass_t *pclass) * Return: Success: ID of new property list * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol - * Thursday, August 2, 2012 - * *------------------------------------------------------------------------- */ hid_t @@ -5558,7 +5544,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type) /* Sanity checks */ HDcompile_assert(H5P_TYPE_REFERENCE_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); - HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_REFERENCE_ACCESS); + assert(type >= H5P_TYPE_USER && type <= H5P_TYPE_REFERENCE_ACCESS); /* Check arguments */ if (type == H5P_TYPE_USER) @@ -5662,11 +5648,11 @@ H5P__new_plist_of_type(H5P_plist_type_t type) /* Get the class object */ if (NULL == (pclass = (H5P_genclass_t *)H5I_object(class_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property class") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, H5I_INVALID_HID, "not a property class"); /* Create the new property list */ if ((ret_value = H5P_create_id(pclass, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create property list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5683,9 +5669,6 @@ H5P__new_plist_of_type(H5P_plist_type_t type) * Return: Success: Non-negative ID of property list. * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol - * April 22, 2014 - * *------------------------------------------------------------------------- */ hid_t @@ -5694,7 +5677,7 @@ H5P_get_plist_id(const H5P_genplist_t *plist) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(plist); + assert(plist); FUNC_LEAVE_NOAPI(plist->plist_id) } /* end H5P_get_plist_id() */ @@ -5710,9 +5693,6 @@ H5P_get_plist_id(const H5P_genplist_t *plist) * Return: Success: Non-NULL class of property list. * Failure: NULL * - * Programmer: Quincey Koziol - * April 22, 2014 - * *------------------------------------------------------------------------- */ H5P_genclass_t * @@ -5721,7 +5701,7 @@ H5P_get_class(const H5P_genplist_t *plist) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(plist); + assert(plist); FUNC_LEAVE_NOAPI(plist->pclass) } /* end H5P_get_class() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Plapl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Plapl.c index 451d0d9019..19a63bc8c9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Plapl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Plapl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Plapl.c - * July 14 2006 - * James Laird * * Purpose: Link access property list class routines * @@ -31,12 +28,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Lprivate.h" /* Links */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Lprivate.h" /* Links */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5VMprivate.h" /* Vector Functions */ /****************/ /* Local Macros */ @@ -179,9 +177,6 @@ static const H5P_coll_md_read_flag_t H5L_def_coll_md_read_g = * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 31, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -194,7 +189,7 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) /* Register property for number of links traversed */ if (H5P__register_real(pclass, H5L_ACS_NLINKS_NAME, H5L_ACS_NLINKS_SIZE, &H5L_def_nlinks_g, NULL, NULL, NULL, H5L_ACS_NLINKS_ENC, H5L_ACS_NLINKS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register property for external link prefix */ if (H5P__register_real(pclass, H5L_ACS_ELINK_PREFIX_NAME, H5L_ACS_ELINK_PREFIX_SIZE, @@ -202,33 +197,33 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) H5L_ACS_ELINK_PREFIX_ENC, H5L_ACS_ELINK_PREFIX_DEC, H5L_ACS_ELINK_PREFIX_DEL, H5L_ACS_ELINK_PREFIX_COPY, H5L_ACS_ELINK_PREFIX_CMP, H5L_ACS_ELINK_PREFIX_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register fapl for link access */ if (H5P__register_real(pclass, H5L_ACS_ELINK_FAPL_NAME, H5L_ACS_ELINK_FAPL_SIZE, &H5L_def_fapl_id_g, NULL, H5L_ACS_ELINK_FAPL_SET, H5L_ACS_ELINK_FAPL_GET, H5L_ACS_ELINK_FAPL_ENC, H5L_ACS_ELINK_FAPL_DEC, H5L_ACS_ELINK_FAPL_DEL, H5L_ACS_ELINK_FAPL_COPY, H5L_ACS_ELINK_FAPL_CMP, H5L_ACS_ELINK_FAPL_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register property for external link file access flags */ if (H5P__register_real(pclass, H5L_ACS_ELINK_FLAGS_NAME, H5L_ACS_ELINK_FLAGS_SIZE, &H5L_def_elink_flags_g, NULL, NULL, NULL, H5L_ACS_ELINK_FLAGS_ENC, H5L_ACS_ELINK_FLAGS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register property for external link file traversal callback */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5L_ACS_ELINK_CB_NAME, H5L_ACS_ELINK_CB_SIZE, &H5L_def_elink_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); #ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ if (H5P__register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g, NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); #endif /* H5_HAVE_PARALLEL */ done: @@ -243,9 +238,6 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, Sept 2, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -258,7 +250,7 @@ H5P__lacc_elink_fapl_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Get the FAPL ID */ l_fapl_id = *(const hid_t *)value; @@ -268,9 +260,9 @@ H5P__lacc_elink_fapl_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED H5P_genplist_t *l_fapl_plist; if (NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list"); if (((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list"); } /* end if */ done: @@ -285,9 +277,6 @@ H5P__lacc_elink_fapl_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, Sept 2, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -300,7 +289,7 @@ H5P__lacc_elink_fapl_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Get the FAPL ID */ l_fapl_id = *(const hid_t *)value; @@ -310,9 +299,9 @@ H5P__lacc_elink_fapl_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED H5P_genplist_t *l_fapl_plist; if (NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list"); if (((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list"); } /* end if */ done: @@ -329,9 +318,6 @@ H5P__lacc_elink_fapl_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, August 15, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -349,7 +335,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) /* Check for non-default FAPL */ if (*elink_fapl != H5P_DEFAULT) { if (NULL == (fapl_plist = (H5P_genplist_t *)H5P_object_verify(*elink_fapl, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property list"); non_default_fapl = TRUE; } /* end if */ @@ -362,7 +348,7 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) /* (if *pp == NULL, will only compute the size) */ if (non_default_fapl) { if (H5P__encode(fapl_plist, TRUE, NULL, &fapl_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list"); if (*pp) { uint64_t enc_value; @@ -371,13 +357,13 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) /* encode the length of the plist */ enc_value = (uint64_t)fapl_size; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); /* encode the plist */ if (H5P__encode(fapl_plist, TRUE, *pp, &fapl_size) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list"); *pp += fapl_size; } @@ -400,9 +386,6 @@ H5P__lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, August 15, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -416,9 +399,9 @@ H5P__lacc_elink_fapl_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(pp); - HDassert(*pp); - HDassert(elink_fapl); + assert(pp); + assert(*pp); + assert(elink_fapl); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); /* Determine if the FAPL is non-default */ @@ -431,13 +414,13 @@ H5P__lacc_elink_fapl_dec(const void **_pp, void *_value) /* Decode the plist length */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); fapl_size = (size_t)enc_value; /* Decode the property list */ if ((*elink_fapl = H5P__decode(*pp)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode property") + HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode property"); *pp += fapl_size; } /* end if */ @@ -456,9 +439,6 @@ H5P__lacc_elink_fapl_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 - * *-------------------------------------------------------------------------- */ static herr_t @@ -471,14 +451,14 @@ H5P__lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Get the FAPL ID */ l_fapl_id = (*(const hid_t *)value); /* Close the FAPL */ if (l_fapl_id != H5P_DEFAULT && H5I_dec_ref(l_fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -492,9 +472,6 @@ H5P__lacc_elink_fapl_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 - * *-------------------------------------------------------------------------- */ static herr_t @@ -506,7 +483,7 @@ H5P__lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Get the FAPL ID */ l_fapl_id = (*(const hid_t *)value); @@ -516,9 +493,9 @@ H5P__lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED H5P_genplist_t *l_fapl_plist; if (NULL == (l_fapl_plist = (H5P_genplist_t *)H5P_object_verify(l_fapl_id, H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "can't get property list"); if (((*(hid_t *)value) = H5P_copy_plist(l_fapl_plist, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy file access property list"); } /* end if */ done: @@ -534,9 +511,6 @@ H5P__lacc_elink_fapl_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED * * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. * - * Programmer: Quincey Koziol - * Wednesday, August 15, 2012 - * *------------------------------------------------------------------------- */ static int @@ -568,7 +542,7 @@ H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_ herr_t H5_ATTR_NDEBUG_UNUSED status; status = H5P__cmp_plist(obj1, obj2, &ret_value); - HDassert(status >= 0); + assert(status >= 0); } /* end if */ done: @@ -583,9 +557,6 @@ H5P__lacc_elink_fapl_cmp(const void *value1, const void *value2, size_t H5_ATTR_ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Vailin Choi - * Tuesday, Sept 23, 2008 - * *--------------------------------------------------------------------------- */ static herr_t @@ -597,14 +568,14 @@ H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Get the FAPL ID */ l_fapl_id = (*(const hid_t *)value); /* Close the FAPL */ if ((l_fapl_id > H5P_DEFAULT) && (H5I_dec_ref(l_fapl_id) < 0)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRELEASE, FAIL, "unable to close ID for file access property list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -618,9 +589,6 @@ H5P__lacc_elink_fapl_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, Sept 2, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -630,7 +598,7 @@ H5P__lacc_elink_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(value); + assert(value); /* Copy the prefix */ *(char **)value = H5MM_xstrdup(*(const char **)value); @@ -646,9 +614,6 @@ H5P__lacc_elink_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, Sept 2, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -658,7 +623,7 @@ H5P__lacc_elink_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(value); + assert(value); /* Copy the prefix */ *(char **)value = H5MM_xstrdup(*(const char **)value); @@ -676,9 +641,6 @@ H5P__lacc_elink_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -700,7 +662,7 @@ H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) enc_value = (uint64_t)len; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); if (NULL != *pp) { /* encode the length of the prefix */ @@ -731,9 +693,6 @@ H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -748,14 +707,14 @@ H5P__lacc_elink_pref_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE - HDassert(pp); - HDassert(*pp); - HDassert(elink_pref); + assert(pp); + assert(*pp); + assert(elink_pref); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); /* Decode the size */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); /* Decode the value */ UINT64DECODE_VAR(*pp, enc_value, enc_size); @@ -764,7 +723,7 @@ H5P__lacc_elink_pref_dec(const void **_pp, void *_value) if (0 != len) { /* Make a copy of the user's prefix string */ if (NULL == (*elink_pref = (char *)H5MM_malloc(len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix"); HDstrncpy(*elink_pref, *(const char **)pp, len); (*elink_pref)[len] = '\0'; @@ -784,9 +743,6 @@ H5P__lacc_elink_pref_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 2, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -795,7 +751,7 @@ H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); H5MM_xfree(*(void **)value); @@ -809,9 +765,6 @@ H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 2, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -819,7 +772,7 @@ H5P__lacc_elink_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); *(char **)value = H5MM_xstrdup(*(const char **)value); @@ -835,9 +788,6 @@ H5P__lacc_elink_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED * * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. * - * Programmer: Mohamad Chaarawi - * Thursday, November 3, 2011 - * *------------------------------------------------------------------------- */ static int @@ -867,9 +817,6 @@ H5P__lacc_elink_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 2, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -877,7 +824,7 @@ H5P__lacc_elink_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); H5MM_xfree(*(void **)value); @@ -900,9 +847,6 @@ H5P__lacc_elink_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSE * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Friday, July 14, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -919,11 +863,11 @@ H5Pset_nlinks(hid_t plist_id, size_t nlinks) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set number of links */ if (H5P_set(plist, H5L_ACS_NLINKS_NAME, &nlinks) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set nlink info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set nlink info"); done: FUNC_LEAVE_API(ret_value) @@ -940,9 +884,6 @@ H5Pset_nlinks(hid_t plist_id, size_t nlinks) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Friday, July 14, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -959,11 +900,11 @@ H5Pget_nlinks(hid_t plist_id, size_t *nlinks /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the current number of links */ if (H5P_get(plist, H5L_ACS_NLINKS_NAME, nlinks) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get number of links"); done: FUNC_LEAVE_API(ret_value) @@ -978,9 +919,6 @@ H5Pget_nlinks(hid_t plist_id, size_t *nlinks /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Thursday, August 3, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -994,11 +932,11 @@ H5Pset_elink_prefix(hid_t plist_id, const char *prefix) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set prefix */ if (H5P_set(plist, H5L_ACS_ELINK_PREFIX_NAME, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info"); done: FUNC_LEAVE_API(ret_value) @@ -1015,9 +953,6 @@ H5Pset_elink_prefix(hid_t plist_id, const char *prefix) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Thursday, August 3, 2006 - * *------------------------------------------------------------------------- */ ssize_t @@ -1033,11 +968,11 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the current prefix */ if (H5P_peek(plist, H5L_ACS_ELINK_PREFIX_NAME, &my_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external link prefix"); /* Check for prefix being set */ if (my_prefix) { @@ -1066,9 +1001,6 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix /*out*/, size_t size) * * Return: Non-negative on success/Negative on failure * - * Programmer: - * Vailin Choi; Tuesday, September 12th, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -1086,7 +1018,7 @@ H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id) /* Set the file access property list for the link access */ if (H5P_set(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fapl for link") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fapl for link"); done: FUNC_LEAVE_API(ret_value) @@ -1100,9 +1032,6 @@ H5Pset_elink_fapl(hid_t lapl_id, hid_t fapl_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: - * Vailin Choi; Tuesday, September 12th, 2008 - * *------------------------------------------------------------------------- */ hid_t @@ -1116,13 +1045,13 @@ H5Pget_elink_fapl(hid_t lapl_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); if (H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &ret_value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links"); done: - FUNC_LEAVE_API(ret_value); + FUNC_LEAVE_API(ret_value) } /* end H5Pget_elink_fapl() */ /*------------------------------------------------------------------------- @@ -1134,9 +1063,6 @@ H5Pget_elink_fapl(hid_t lapl_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Tuesday, December 9, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -1152,15 +1078,15 @@ H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags) if ((flags != H5F_ACC_RDWR) && (flags != (H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE)) && (flags != H5F_ACC_RDONLY) && (flags != (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ)) && (flags != H5F_ACC_DEFAULT)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set flags */ if (H5P_set(plist, H5L_ACS_ELINK_FLAGS_NAME, &flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access flags"); done: FUNC_LEAVE_API(ret_value) @@ -1174,9 +1100,6 @@ H5Pset_elink_acc_flags(hid_t lapl_id, unsigned flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Tuesday, December 9, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -1190,12 +1113,12 @@ H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get flags */ if (flags) if (H5P_get(plist, H5L_ACS_ELINK_FLAGS_NAME, flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "can't get access flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, 0, "can't get access flags"); done: FUNC_LEAVE_API(ret_value) @@ -1210,9 +1133,6 @@ H5Pget_elink_acc_flags(hid_t lapl_id, unsigned *flags /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Tuesday, December 15, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -1228,11 +1148,11 @@ H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data) /* Check if the callback function is NULL and the user data is non-NULL. * This is almost certainly an error as the user data will not be used. */ if (!func && op_data) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Populate the callback info struct */ cb_info.func = func; @@ -1240,7 +1160,7 @@ H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data) /* Set callback info */ if (H5P_set(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set callback info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set callback info"); done: FUNC_LEAVE_API(ret_value) @@ -1254,9 +1174,6 @@ H5Pset_elink_cb(hid_t lapl_id, H5L_elink_traverse_t func, void *op_data) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Tuesday, December 15, 2008 - * *------------------------------------------------------------------------- */ herr_t @@ -1271,11 +1188,11 @@ H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func /*out*/, void **op_dat /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get callback_info */ if (H5P_get(plist, H5L_ACS_ELINK_CB_NAME, &cb_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info"); if (func) *func = cb_info.func; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Plcpl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Plcpl.c index 431b7af17d..536172e161 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Plcpl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Plcpl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -103,8 +102,6 @@ static const unsigned H5L_def_intmd_group_g = * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 31, 2006 *------------------------------------------------------------------------- */ static herr_t @@ -118,7 +115,7 @@ H5P__lcrt_reg_prop(H5P_genclass_t *pclass) if (H5P__register_real(pclass, H5L_CRT_INTERMEDIATE_GROUP_NAME, H5L_CRT_INTERMEDIATE_GROUP_SIZE, &H5L_def_intmd_group_g, NULL, NULL, NULL, H5L_CRT_INTERMEDIATE_GROUP_ENC, H5L_CRT_INTERMEDIATE_GROUP_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -134,8 +131,6 @@ H5P__lcrt_reg_prop(H5P_genclass_t *pclass) * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * May 08, 2005 *------------------------------------------------------------------------- */ herr_t @@ -149,12 +144,12 @@ H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd_group) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set value */ crt_intmd_group = (unsigned)(crt_intmd_group > 0 ? 1 : 0); if (H5P_set(plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, &crt_intmd_group) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set intermediate group creation flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set intermediate group creation flag"); done: FUNC_LEAVE_API(ret_value) @@ -168,8 +163,6 @@ H5Pset_create_intermediate_group(hid_t plist_id, unsigned crt_intmd_group) * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * May 08, 2005 *------------------------------------------------------------------------- */ herr_t @@ -183,12 +176,12 @@ H5Pget_create_intermediate_group(hid_t plist_id, unsigned *crt_intmd_group /*out /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_LINK_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (crt_intmd_group) if (H5P_get(plist, H5L_CRT_INTERMEDIATE_GROUP_NAME, crt_intmd_group) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get intermediate group creation flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get intermediate group creation flag"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pmapl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pmapl.c index 9d3469599c..351bc73ec0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pmapl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pmapl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -118,13 +117,13 @@ H5P__macc_reg_prop(H5P_genclass_t *pclass) if (H5P__register_real(pclass, H5M_ACS_KEY_PREFETCH_SIZE_NAME, H5M_ACS_KEY_PREFETCH_SIZE_SIZE, &key_prefetch_size, NULL, NULL, NULL, H5M_ACS_KEY_PREFETCH_SIZE_ENC, H5M_ACS_KEY_PREFETCH_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the key prefetch allocation size for iteration */ if (H5P__register_real(pclass, H5M_ACS_KEY_ALLOC_SIZE_NAME, H5M_ACS_KEY_ALLOC_SIZE_SIZE, &key_alloc_size, NULL, NULL, NULL, H5M_ACS_KEY_ALLOC_SIZE_ENC, H5M_ACS_KEY_ALLOC_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pmcpl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pmcpl.c index 5ad564a81b..f2cc29a8bb 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pmcpl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pmcpl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pocpl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pocpl.c index 40475d005b..b1647116b9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pocpl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pocpl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pocpl.c - * Nov 28 2006 - * Quincey Koziol * * Purpose: Object creation property list class routines * @@ -32,14 +29,15 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Ppkg.h" /* Property lists */ -#include "H5PLprivate.h" /* Dynamic plugin */ -#include "H5Zprivate.h" /* Filter pipeline */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5PLprivate.h" /* Dynamic plugin */ +#include "H5VMprivate.h" /* Vector Functions */ +#include "H5Zprivate.h" /* Filter pipeline */ /****************/ /* Local Macros */ @@ -144,9 +142,6 @@ static const H5O_pline_t H5O_def_pline_g = H5O_CRT_PIPELINE_DEF; /* Default I * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * November 28, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -160,26 +155,26 @@ H5P__ocrt_reg_prop(H5P_genclass_t *pclass) if (H5P__register_real(pclass, H5O_CRT_ATTR_MAX_COMPACT_NAME, H5O_CRT_ATTR_MAX_COMPACT_SIZE, &H5O_def_attr_max_compact_g, NULL, NULL, NULL, H5O_CRT_ATTR_MAX_COMPACT_ENC, H5O_CRT_ATTR_MAX_COMPACT_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register min. dense attribute storage property */ if (H5P__register_real(pclass, H5O_CRT_ATTR_MIN_DENSE_NAME, H5O_CRT_ATTR_MIN_DENSE_SIZE, &H5O_def_attr_min_dense_g, NULL, NULL, NULL, H5O_CRT_ATTR_MIN_DENSE_ENC, H5O_CRT_ATTR_MIN_DENSE_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register object header flags property */ if (H5P__register_real(pclass, H5O_CRT_OHDR_FLAGS_NAME, H5O_CRT_OHDR_FLAGS_SIZE, &H5O_def_ohdr_flags_g, NULL, NULL, NULL, H5O_CRT_OHDR_FLAGS_ENC, H5O_CRT_OHDR_FLAGS_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register the pipeline property */ if (H5P__register_real(pclass, H5O_CRT_PIPELINE_NAME, H5O_CRT_PIPELINE_SIZE, &H5O_def_pline_g, NULL, H5O_CRT_PIPELINE_SET, H5O_CRT_PIPELINE_GET, H5O_CRT_PIPELINE_ENC, H5O_CRT_PIPELINE_DEC, H5O_CRT_PIPELINE_DEL, H5O_CRT_PIPELINE_COPY, H5O_CRT_PIPELINE_CMP, H5O_CRT_PIPELINE_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -202,9 +197,6 @@ H5P__ocrt_reg_prop(H5P_genclass_t *pclass) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -218,21 +210,21 @@ H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens /* Range check values */ if (max_compact < min_dense) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be >= min dense value") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be >= min dense value"); if (max_compact > 65535) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be < 65536") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "max compact value must be < 65536"); if (min_dense > 65535) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min dense value must be < 65536") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "min dense value must be < 65536"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set property values */ if (H5P_set(plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &max_compact) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set max. # of compact attributes in property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set max. # of compact attributes in property list"); if (H5P_set(plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &min_dense) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list"); done: FUNC_LEAVE_API(ret_value) @@ -245,9 +237,6 @@ H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dens * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -261,16 +250,16 @@ H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (max_compact) { if (H5P_get(plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, max_compact) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get max. # of compact attributes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get max. # of compact attributes"); } /* end if */ if (min_dense) { if (H5P_get(plist, H5O_CRT_ATTR_MIN_DENSE_NAME, min_dense) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get min. # of dense attributes") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get min. # of dense attributes"); } /* end if */ done: @@ -284,9 +273,6 @@ H5Pget_attr_phase_change(hid_t plist_id, unsigned *max_compact /*out*/, unsigned * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * February 6, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -301,15 +287,15 @@ H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags) /* Check for bad combination of flags */ if (!(crt_order_flags & H5P_CRT_ORDER_TRACKED) && (crt_order_flags & H5P_CRT_ORDER_INDEXED)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tracking creation order is required for index") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tracking creation order is required for index"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get object header flags */ if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags"); /* Mask off previous attribute creation order flag settings */ ohdr_flags &= (uint8_t) ~(H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED); @@ -322,7 +308,7 @@ H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags) /* Set object header flags */ if (H5P_set(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object header flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object header flags"); done: FUNC_LEAVE_API(ret_value) @@ -336,9 +322,6 @@ H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flags) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * February 6, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -359,11 +342,11 @@ H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get object header flags */ if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags"); /* Set creation order flags to return */ *crt_order_flags |= (ohdr_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) ? H5P_CRT_ORDER_TRACKED : 0; @@ -395,9 +378,6 @@ H5Pget_attr_creation_order(hid_t plist_id, unsigned *crt_order_flags /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * March 1, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -412,11 +392,11 @@ H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get object header flags */ if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags"); /* Mask off previous time tracking flag settings */ ohdr_flags &= (uint8_t)~H5O_HDR_STORE_TIMES; @@ -426,7 +406,7 @@ H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times) /* Set object header flags */ if (H5P_set(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object header flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set object header flags"); done: FUNC_LEAVE_API(ret_value) @@ -439,9 +419,6 @@ H5Pset_obj_track_times(hid_t plist_id, hbool_t track_times) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * March 1, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -459,11 +436,11 @@ H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get object header flags */ if (H5P_get(plist, H5O_CRT_OHDR_FLAGS_NAME, &ohdr_flags) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags"); /* Set track times flag to return */ *track_times = (hbool_t)((ohdr_flags & H5O_HDR_STORE_TIMES) ? TRUE : FALSE); @@ -504,9 +481,6 @@ H5Pget_obj_track_times(hid_t plist_id, hbool_t *track_times /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, October 17, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -520,15 +494,15 @@ H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags, si /* Get the pipeline property to modify */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Modify the filter parameters of the I/O pipeline */ if (H5Z_modify(&pline, filter, flags, cd_nelmts, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline"); /* Put the I/O pipeline information back into the property list */ if (H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -565,9 +539,6 @@ H5P_modify_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned flags, si * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -582,19 +553,19 @@ H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t /* Check args */ if (filter < 0 || filter > H5Z_FILTER_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier"); if (flags & ~((unsigned)H5Z_FLAG_DEFMASK)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags"); if (cd_nelmts > 0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Modify the filter parameters of the I/O pipeline */ if (H5P_modify_filter(plist, filter, flags, cd_nelmts, cd_values) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't modify filter") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't modify filter"); done: FUNC_LEAVE_API(ret_value) @@ -627,9 +598,6 @@ H5Pmodify_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -644,19 +612,19 @@ H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd /* Check args */ if (filter < 0 || filter > H5Z_FILTER_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identifier"); if (flags & ~((unsigned)H5Z_FLAG_DEFMASK)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid flags"); if (cd_nelmts > 0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no client data values supplied"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Call the private function */ if (H5P__set_filter(plist, filter, flags, cd_nelmts, cd_values) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "failed to call private function") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "failed to call private function"); done: FUNC_LEAVE_API(ret_value) @@ -692,9 +660,6 @@ H5Pset_filter(hid_t plist_id, H5Z_filter_t filter, unsigned int flags, size_t cd * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -709,19 +674,19 @@ H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, /* Check if filter is already available */ if ((filter_avail = H5Z_filter_avail(filter)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't check filter availability") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't check filter availability"); /* Get the pipeline property to append to */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Add the filter to the I/O pipeline */ if (H5Z_append(&pline, filter, flags, cd_nelmts, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline"); /* Put the I/O pipeline information back into the property list */ if (H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -742,9 +707,6 @@ H5P__set_filter(H5P_genplist_t *plist, H5Z_filter_t filter, unsigned int flags, * * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, August 4, 1998 - * *------------------------------------------------------------------------- */ int @@ -759,11 +721,11 @@ H5Pget_nfilters(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the pipeline property to query */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Set return value */ ret_value = (int)(pline.nused); @@ -791,9 +753,6 @@ H5Pget_nfilters(hid_t plist_id) * * Failure: H5Z_FILTER_ERROR (Negative) * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ H5Z_filter_t @@ -819,9 +778,9 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t */ if (cd_nelmts && *cd_nelmts > 256) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, - "probable uninitialized *cd_nelmts argument") + "probable uninitialized *cd_nelmts argument"); if (cd_nelmts && *cd_nelmts > 0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied"); /* * If cd_nelmts is null but cd_values is non-null then just ignore @@ -833,22 +792,22 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_FILTER_ERROR, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_FILTER_ERROR, "can't find object for ID"); /* Get the pipeline property to query */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline"); /* Check index */ if (idx >= pline.nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid"); /* Set pointer to particular filter to query */ filter = &pline.filter[idx]; /* Get filter information */ if (H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info"); /* Set return value */ ret_value = filter->id; @@ -874,9 +833,6 @@ H5Pget_filter2(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, October 17, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -892,15 +848,15 @@ H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags /* Get pipeline info */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Get pointer to filter in pipeline */ if (NULL == (filter = H5Z_filter_info(&pline, id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID is invalid"); /* Get filter information */ if (H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -923,9 +879,6 @@ H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -941,7 +894,7 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out* /* Check args */ if (id < 0 || id > H5Z_FILTER_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID value out of range") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID value out of range"); if (cd_nelmts || cd_values) { /* * It's likely that users forget to initialize this on input, so @@ -950,9 +903,9 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out* * is too large. */ if (cd_nelmts && *cd_nelmts > 256) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument"); if (cd_nelmts && *cd_nelmts > 0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied"); /* * If cd_nelmts is null but cd_values is non-null then just ignore @@ -964,11 +917,11 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out* /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get filter information */ if (H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, filter_config) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info"); done: FUNC_LEAVE_API(ret_value) @@ -984,9 +937,6 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out* * more filters not currently available. * Failure: FAIL on error * - * Programmer: Quincey Koziol - * Tuesday, April 8, 2003 - * *------------------------------------------------------------------------- */ htri_t @@ -1001,15 +951,15 @@ H5Pall_filters_avail(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the pipeline property to query */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Check if all filters are available */ if ((ret_value = H5Z_all_filters_avail(&pline)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't check pipeline information") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "can't check pipeline information"); done: FUNC_LEAVE_API(ret_value) @@ -1025,9 +975,6 @@ H5Pall_filters_avail(hid_t plist_id) * FALSE: not found * FAIL: error * - * Programmer: Raymond Lu - * 26 April 2013 - * *------------------------------------------------------------------------- */ htri_t @@ -1040,11 +987,11 @@ H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id) /* Get pipeline info */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Check if the file is in the pipeline */ if ((ret_value = H5Z_filter_in_pline(&pline, id)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTCOMPARE, FAIL, "can't find filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTCOMPARE, FAIL, "can't find filter"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1058,9 +1005,6 @@ H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Pedro Vicente - * January 26, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -1075,21 +1019,21 @@ H5Premove_filter(hid_t plist_id, H5Z_filter_t filter) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the pipeline property to modify */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Check if there are any filters */ if (pline.filter) { /* Delete filter */ if (H5Z_delete(&pline, filter) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't delete filter") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't delete filter"); /* Put the I/O pipeline information back into the property list */ if (H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline"); } /* end if */ done: @@ -1109,9 +1053,6 @@ H5Premove_filter(hid_t plist_id, H5Z_filter_t filter) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1126,23 +1067,23 @@ H5Pset_deflate(hid_t plist_id, unsigned level) /* Check arguments */ if (level > 9) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid deflate level") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid deflate level"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the pipeline property to append to */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Add the filter */ if (H5Z_append(&pline, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, (size_t)1, &level) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add deflate filter to pipeline"); /* Put the I/O pipeline information back into the property list */ if (H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline"); done: FUNC_LEAVE_API(ret_value) @@ -1156,9 +1097,6 @@ H5Pset_deflate(hid_t plist_id, unsigned level) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Dec 19, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -1173,19 +1111,19 @@ H5Pset_fletcher32(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the pipeline property to append to */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get pipeline"); /* Add the Fletcher32 checksum as a filter */ if (H5Z_append(&pline, H5Z_FILTER_FLETCHER32, H5Z_FLAG_MANDATORY, (size_t)0, NULL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add fletcher32 filter to pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add fletcher32 filter to pipeline"); /* Put the I/O pipeline information back into the property list */ if (H5P_poke(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set pipeline"); done: FUNC_LEAVE_API(ret_value) @@ -1198,9 +1136,6 @@ H5Pset_fletcher32(hid_t plist_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, October 23, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1211,7 +1146,7 @@ H5P__get_filter(const H5Z_filter_info_t *filter, unsigned int *flags /*out*/, si FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(filter); + assert(filter); /* Filter flags */ if (flags) @@ -1273,9 +1208,6 @@ H5P__get_filter(const H5Z_filter_info_t *filter, unsigned int *flags /*out*/, si * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, Sept 3, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1289,11 +1221,11 @@ H5P__ocrt_pipeline_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of I/O pipeline */ if (NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &new_pline)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline"); /* Copy new I/O pipeline message over old one */ *pline = new_pline; @@ -1310,9 +1242,6 @@ H5P__ocrt_pipeline_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, Sept 1, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1326,11 +1255,11 @@ H5P__ocrt_pipeline_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of I/O pipeline */ if (NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &new_pline)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline"); /* Copy new I/O pipeline message over old one */ *pline = new_pline; @@ -1349,9 +1278,6 @@ H5P__ocrt_pipeline_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1363,8 +1289,8 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR - HDassert(pline); - HDassert(size); + assert(pline); + assert(size); HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); if (NULL != *pp) { @@ -1377,7 +1303,7 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) /* encode nused value */ enc_value = (uint64_t)pline->nused; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); @@ -1386,10 +1312,10 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) unsigned v; /* Local index variable */ /* encode filter ID */ - INT32ENCODE(*pp, pline->filter[u].id) + INT32ENCODE(*pp, pline->filter[u].id); /* encode filter flags */ - H5_ENCODE_UNSIGNED(*pp, pline->filter[u].flags) + H5_ENCODE_UNSIGNED(*pp, pline->filter[u].flags); /* encode filter name if it exists */ if (NULL != pline->filter[u].name) { @@ -1407,13 +1333,13 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) /* encode cd_nelmts */ enc_value = (uint64_t)pline->filter[u].cd_nelmts; enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); + assert(enc_size < 256); *(*pp)++ = (uint8_t)enc_size; UINT64ENCODE_VAR(*pp, enc_value, enc_size); /* encode all values */ for (v = 0; v < pline->filter[u].cd_nelmts; v++) - H5_ENCODE_UNSIGNED(*pp, pline->filter[u].cd_values[v]) + H5_ENCODE_UNSIGNED(*pp, pline->filter[u].cd_values[v]); } /* end for */ } /* end if */ @@ -1441,9 +1367,6 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Mohamad Chaarawi - * Monday, October 10, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -1464,16 +1387,16 @@ H5P__ocrt_pipeline_dec(const void **_pp, void *_value) /* Decode the size of size_t */ enc_size = *(*pp)++; if (enc_size != sizeof(unsigned)) - HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded") + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unsigned value can't be decoded"); /* decode nused */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); nused = (size_t)enc_value; /* Set property default value */ - HDmemset(pline, 0, sizeof(H5O_pline_t)); + memset(pline, 0, sizeof(H5O_pline_t)); *pline = H5O_def_pline_g; for (u = 0; u < nused; u++) { @@ -1482,10 +1405,10 @@ H5P__ocrt_pipeline_dec(const void **_pp, void *_value) unsigned v; /* Local index variable */ /* decode filter id */ - INT32DECODE(*pp, filter.id) + INT32DECODE(*pp, filter.id); /* decode filter flags */ - H5_DECODE_UNSIGNED(*pp, filter.flags) + H5_DECODE_UNSIGNED(*pp, filter.flags); /* decode value indicating if the name is encoded */ has_name = *(*pp)++; @@ -1499,24 +1422,24 @@ H5P__ocrt_pipeline_dec(const void **_pp, void *_value) /* decode num elements */ enc_size = *(*pp)++; - HDassert(enc_size < 256); + assert(enc_size < 256); UINT64DECODE_VAR(*pp, enc_value, enc_size); filter.cd_nelmts = (size_t)enc_value; if (filter.cd_nelmts) { if (NULL == (filter.cd_values = (unsigned *)H5MM_malloc(sizeof(unsigned) * filter.cd_nelmts))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for cd_values") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for cd_values"); } /* end if */ else filter.cd_values = NULL; /* decode values */ for (v = 0; v < filter.cd_nelmts; v++) - H5_DECODE_UNSIGNED(*pp, filter.cd_values[v]) + H5_DECODE_UNSIGNED(*pp, filter.cd_values[v]); /* Add the filter to the I/O pipeline */ if (H5Z_append(pline, filter.id, filter.flags, filter.cd_nelmts, filter.cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to add filter to pipeline"); /* Free cd_values, if it was allocated */ filter.cd_values = (unsigned *)H5MM_xfree(filter.cd_values); @@ -1534,9 +1457,6 @@ H5P__ocrt_pipeline_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, Sept 3, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1548,11 +1468,11 @@ H5P__ocrt_pipeline_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Reset the old I/O pipeline */ if (H5O_msg_reset(H5O_PLINE_ID, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release I/O pipeline message") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release I/O pipeline message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1566,9 +1486,6 @@ H5P__ocrt_pipeline_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED * * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, Sept 3, 2015 - * *-------------------------------------------------------------------------- */ static herr_t @@ -1581,11 +1498,11 @@ H5P__ocrt_pipeline_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED s FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(pline); + assert(pline); /* Make copy of I/O pipeline */ if (NULL == H5O_msg_copy(H5O_PLINE_ID, pline, &new_pline)) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy I/O pipeline"); /* Copy new I/O pipeline message over old one */ *pline = new_pline; @@ -1604,9 +1521,6 @@ H5P__ocrt_pipeline_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED s * VALUE2 is greater than VALUE1 and zero if VALUE1 and * VALUE2 are equal. * - * Programmer: Quincey Koziol - * Wednesday, January 7, 2004 - * *------------------------------------------------------------------------- */ static int @@ -1620,9 +1534,9 @@ H5P__ocrt_pipeline_cmp(const void *_pline1, const void *_pline2, size_t H5_ATTR_ FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(pline1); - HDassert(pline2); - HDassert(size == sizeof(H5O_pline_t)); + assert(pline1); + assert(pline2); + assert(size == sizeof(H5O_pline_t)); /* Check the number of used pipeline entries */ if (pline1->nused < pline2->nused) @@ -1699,9 +1613,6 @@ H5P__ocrt_pipeline_cmp(const void *_pline1, const void *_pline2, size_t H5_ATTR_ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, Sept 3, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -1712,11 +1623,11 @@ H5P__ocrt_pipeline_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Reset the old I/O pipeline */ if (H5O_msg_reset(H5O_PLINE_ID, value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release I/O pipeline message") + HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release I/O pipeline message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1742,9 +1653,6 @@ H5P__ocrt_pipeline_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED * * Failure: H5Z_FILTER_ERROR (Negative) * - * Programmer: Robb Matzke - * Wednesday, April 15, 1998 - * *------------------------------------------------------------------------- */ H5Z_filter_t @@ -1769,9 +1677,9 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t */ if (cd_nelmts && *cd_nelmts > 256) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, - "probable uninitialized *cd_nelmts argument") + "probable uninitialized *cd_nelmts argument"); if (cd_nelmts && *cd_nelmts > 0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "client data values not supplied"); /* * If cd_nelmts is null but cd_values is non-null then just ignore @@ -1783,22 +1691,22 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_FILTER_ERROR, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5Z_FILTER_ERROR, "can't find object for ID"); /* Get pipeline info */ if (H5P_peek(plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get pipeline"); /* Check more args */ if (idx >= pline.nused) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5Z_FILTER_ERROR, "filter number is invalid"); /* Set pointer to particular filter to query */ filter = &pline.filter[idx]; /* Get filter information */ if (H5P__get_filter(filter, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, H5Z_FILTER_ERROR, "can't get filter info"); /* Set return value */ ret_value = filter->id; @@ -1823,9 +1731,6 @@ H5Pget_filter1(hid_t plist_id, unsigned idx, unsigned int *flags /*out*/, size_t * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, April 5, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1841,7 +1746,7 @@ H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out* /* Check args */ if (id < 0 || id > H5Z_FILTER_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID value out of range") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID value out of range"); if (cd_nelmts || cd_values) { /* * It's likely that users forget to initialize this on input, so @@ -1850,9 +1755,9 @@ H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out* * is too large. */ if (cd_nelmts && *cd_nelmts > 256) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "probable uninitialized *cd_nelmts argument"); if (cd_nelmts && *cd_nelmts > 0 && !cd_values) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "client data values not supplied"); /* * If cd_nelmts is null but cd_values is non-null then just ignore @@ -1864,11 +1769,11 @@ H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out* /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get filter info */ if (H5P_get_filter_by_id(plist, id, flags, cd_nelmts, cd_values, namelen, name, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get filter info"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pocpypl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pocpypl.c index f029e20d54..67337d5aff 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pocpypl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pocpypl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pocpypl.c - * Mar 13 2006 - * Peter Cao * * Purpose: Object copying property list class routines * @@ -146,8 +143,6 @@ H5FL_DEFINE(H5O_copy_dtype_merge_list_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 31, 2006 *------------------------------------------------------------------------- */ static herr_t @@ -160,7 +155,7 @@ H5P__ocpy_reg_prop(H5P_genclass_t *pclass) /* Register copy options property */ if (H5P__register_real(pclass, H5O_CPY_OPTION_NAME, H5O_CPY_OPTION_SIZE, &H5O_def_ocpy_option_g, NULL, NULL, NULL, H5O_CPY_OPTION_ENC, H5O_CPY_OPTION_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register merge named dtype list property */ if (H5P__register_real(pclass, H5O_CPY_MERGE_COMM_DT_LIST_NAME, H5O_CPY_MERGE_COMM_DT_LIST_SIZE, @@ -169,14 +164,14 @@ H5P__ocpy_reg_prop(H5P_genclass_t *pclass) H5O_CPY_MERGE_COMM_DT_LIST_DEC, H5O_CPY_MERGE_COMM_DT_LIST_DEL, H5O_CPY_MERGE_COMM_DT_LIST_COPY, H5O_CPY_MERGE_COMM_DT_LIST_CMP, H5O_CPY_MERGE_COMM_DT_LIST_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); /* Register property for callback when completing the search for a matching named datatype from the named * dtype list */ /* (Note: this property should not have an encode/decode callback -QAK) */ if (H5P__register_real(pclass, H5O_CPY_MCDT_SEARCH_CB_NAME, H5O_CPY_MCDT_SEARCH_CB_SIZE, &H5O_def_mcdt_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -189,9 +184,6 @@ H5P__ocpy_reg_prop(H5P_genclass_t *pclass) * * Return: NULL * - * Programmer: Neil Fortner - * October 27, 2011 - * *------------------------------------------------------------------------- */ static H5O_copy_dtype_merge_list_t * @@ -211,7 +203,7 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) dt_list = tmp_node; } /* end while */ - FUNC_LEAVE_NOAPI(NULL); + FUNC_LEAVE_NOAPI(NULL) } /* H5P__free_merge_comm_dtype_list */ /*-------------------------------------------------------------------------- @@ -222,9 +214,6 @@ H5P__free_merge_comm_dtype_list(H5O_copy_dtype_merge_list_t *dt_list) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, September 2, 2015 - * *-------------------------------------------------------------------------- */ static herr_t @@ -239,16 +228,16 @@ H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of merge committed dtype list */ src_dt_list = *value; while (src_dt_list) { /* Copy src_dt_list */ if (NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed"); if (NULL == (tmp_dt_list->path = H5MM_strdup(src_dt_list->path))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed"); /* Add copied node to dest dtype list */ if (dst_dt_list_tail) { @@ -288,9 +277,6 @@ H5P__copy_merge_comm_dt_list(H5O_copy_dtype_merge_list_t **value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, Sept 2, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -302,11 +288,11 @@ H5P__ocpy_merge_comm_dt_list_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATT FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of merge committed dtype list */ if (H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -320,9 +306,6 @@ H5P__ocpy_merge_comm_dt_list_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATT * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, Sept 2, 2015 - * *------------------------------------------------------------------------- */ static herr_t @@ -334,11 +317,11 @@ H5P__ocpy_merge_comm_dt_list_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATT FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of merge committed dtype list */ if (H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -354,9 +337,6 @@ H5P__ocpy_merge_comm_dt_list_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATT * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 31, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -369,8 +349,8 @@ H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR - HDassert(dt_list_ptr); - HDassert(size); + assert(dt_list_ptr); + assert(size); /* Iterate over merge committed dtype list */ dt_list = *dt_list_ptr; @@ -411,9 +391,6 @@ H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 31, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -430,9 +407,9 @@ H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(pp); - HDassert(*pp); - HDassert(dt_list); + assert(pp); + assert(*pp); + assert(dt_list); /* Start off with NULL (default value) */ *dt_list = NULL; @@ -442,11 +419,11 @@ H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value) while (len > 0) { /* Create new node & duplicate string */ if (NULL == (tmp_dt_list = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed"); if (NULL == (tmp_dt_list->path = H5MM_strdup(*(const char **)pp))) - HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed"); *pp += len + 1; - HDassert(len == HDstrlen(tmp_dt_list->path)); + assert(len == HDstrlen(tmp_dt_list->path)); /* Add copied node to dtype list */ if (dt_list_tail) { @@ -486,9 +463,6 @@ H5P__ocpy_merge_comm_dt_list_dec(const void **_pp, void *_value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, September 2, 2015 - * *-------------------------------------------------------------------------- */ static herr_t @@ -498,7 +472,7 @@ H5P__ocpy_merge_comm_dt_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATT FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(value); + assert(value); /* Free the merge named dtype list */ H5P__free_merge_comm_dtype_list(*(H5O_copy_dtype_merge_list_t **)value); @@ -514,9 +488,6 @@ H5P__ocpy_merge_comm_dt_list_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATT * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 31, 2012 - * *-------------------------------------------------------------------------- */ static herr_t @@ -527,11 +498,11 @@ H5P__ocpy_merge_comm_dt_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATT FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(value); + assert(value); /* Make copy of merge committed dtype list */ if (H5P__copy_merge_comm_dt_list((H5O_copy_dtype_merge_list_t **)value) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy merge committed dtype list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -548,9 +519,6 @@ H5P__ocpy_merge_comm_dt_list_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATT * VALUE2 is greater than VALUE1 and zero if VALUE1 and * VALUE2 are equal. * - * Programmer: Neil Fortner - * Friday, October 28, 2011 - * *------------------------------------------------------------------------- */ static int @@ -564,20 +532,20 @@ H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, s FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(_dt_list1); - HDassert(_dt_list2); - HDassert(size == sizeof(H5O_copy_dtype_merge_list_t *)); + assert(_dt_list1); + assert(_dt_list2); + assert(size == sizeof(H5O_copy_dtype_merge_list_t *)); /* Walk through the lists, comparing each path. For the lists to be the * same, the paths must be in the same order. */ while (dt_list1 && dt_list2) { - HDassert(dt_list1->path); - HDassert(dt_list2->path); + assert(dt_list1->path); + assert(dt_list2->path); /* Compare paths */ ret_value = HDstrcmp(dt_list1->path, dt_list2->path); if (ret_value != 0) - HGOTO_DONE(ret_value) + HGOTO_DONE(ret_value); /* Advance to next node */ dt_list1 = dt_list1->next; @@ -586,9 +554,9 @@ H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, s /* Check if one list is longer than the other */ if (dt_list1) - HGOTO_DONE(1) + HGOTO_DONE(1); if (dt_list2) - HGOTO_DONE(-1) + HGOTO_DONE(-1); done: FUNC_LEAVE_NOAPI(ret_value) @@ -602,9 +570,6 @@ H5P__ocpy_merge_comm_dt_list_cmp(const void *_dt_list1, const void *_dt_list2, s * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 31, 2012 - * *--------------------------------------------------------------------------- */ static herr_t @@ -612,7 +577,7 @@ H5P__ocpy_merge_comm_dt_list_close(const char H5_ATTR_UNUSED *name, size_t H5_AT { FUNC_ENTER_PACKAGE_NOERR - HDassert(value); + assert(value); /* Free the merge named dtype list */ H5P__free_merge_comm_dtype_list(*(H5O_copy_dtype_merge_list_t **)value); @@ -637,8 +602,6 @@ H5P__ocpy_merge_comm_dt_list_close(const char H5_ATTR_UNUSED *name, size_t H5_AT * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * March 13, 2006 *------------------------------------------------------------------------- */ herr_t @@ -652,15 +615,15 @@ H5Pset_copy_object(hid_t plist_id, unsigned cpy_option) /* Check parameters */ if (cpy_option & ~H5O_COPY_ALL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown option specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown option specified"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set value */ if (H5P_set(plist, H5O_CPY_OPTION_NAME, &cpy_option) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set copy object flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set copy object flag"); done: FUNC_LEAVE_API(ret_value) @@ -674,8 +637,6 @@ H5Pset_copy_object(hid_t plist_id, unsigned cpy_option) * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * March 13, 2006 *------------------------------------------------------------------------- */ herr_t @@ -689,12 +650,12 @@ H5Pget_copy_object(hid_t plist_id, unsigned *cpy_option /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get values */ if (cpy_option) if (H5P_get(plist, H5O_CPY_OPTION_NAME, cpy_option) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object copy flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object copy flag"); done: FUNC_LEAVE_API(ret_value) @@ -707,7 +668,7 @@ H5Pget_copy_object(hid_t plist_id, unsigned *cpy_option /*out*/) * target file when merging committed datatypes during H5Ocopy * (i.e. when using the H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG flag * as set by H5Pset_copy_object). If the source named - * dataype is not found in the list of paths created by this + * datatype is not found in the list of paths created by this * function, the entire file will be searched. * * Usage: H5Padd_merge_committed_dtype_path(plist_id, path) @@ -716,8 +677,6 @@ H5Pget_copy_object(hid_t plist_id, unsigned *cpy_option /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * October 27, 2011 *------------------------------------------------------------------------- */ herr_t @@ -733,28 +692,28 @@ H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path) /* Check parameters */ if (!path) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no path specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no path specified"); if (path[0] == '\0') - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "path is empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "path is empty string"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get dtype list */ if (H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &old_list) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge named dtype list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge named dtype list"); /* Add the new path to the list */ if (NULL == (new_obj = H5FL_CALLOC(H5O_copy_dtype_merge_list_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); if (NULL == (new_obj->path = H5MM_strdup(path))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); new_obj->next = old_list; /* Update the list stored in the property list */ if (H5P_poke(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &new_obj) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge named dtype list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge named dtype list"); done: if (ret_value < 0) @@ -778,8 +737,6 @@ H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * October 27, 2011 *------------------------------------------------------------------------- */ herr_t @@ -794,18 +751,18 @@ H5Pfree_merge_committed_dtype_paths(hid_t plist_id) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get dtype list */ if (H5P_peek(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed dtype list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get merge committed dtype list"); /* Free dtype list */ dt_list = H5P__free_merge_comm_dtype_list(dt_list); /* Update the list stored in the property list (to NULL) */ if (H5P_poke(plist, H5O_CPY_MERGE_COMM_DT_LIST_NAME, &dt_list) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge committed dtype list") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set merge committed dtype list"); done: FUNC_LEAVE_API(ret_value) @@ -826,7 +783,6 @@ H5Pfree_merge_committed_dtype_paths(hid_t plist_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; November 28, 2011 *------------------------------------------------------------------------- */ herr_t @@ -842,11 +798,11 @@ H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data) /* Check if the callback function is NULL and the user data is non-NULL. * This is almost certainly an error as the user data will not be used. */ if (!func && op_data) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "callback is NULL while user data is not"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Populate the callback info struct */ cb_info.func = func; @@ -854,7 +810,7 @@ H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data) /* Set callback info */ if (H5P_set(plist, H5O_CPY_MCDT_SEARCH_CB_NAME, &cb_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set callback info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set callback info"); done: FUNC_LEAVE_API(ret_value) @@ -873,8 +829,6 @@ H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; November 29, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -889,11 +843,11 @@ H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func /*out*/, void * /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_OBJECT_COPY))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get callback info */ if (H5P_get(plist, H5O_CPY_MCDT_SEARCH_CB_NAME, &cb_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get callback info"); if (func) *func = cb_info.func; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5PredType.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5PredType.cpp deleted file mode 100644 index 9458fb7117..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5PredType.cpp +++ /dev/null @@ -1,994 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5AtomType.h" -#include "H5PredType.h" - -namespace H5 { - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: PredType overloaded constructor -///\brief Creates a PredType object using the id of an existing -/// predefined datatype. -///\param predtype_id - IN: Id of a predefined datatype -// Description -// This constructor creates a PredType object by copying -// the provided HDF5 predefined datatype. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id) -{ - id = H5Tcopy(predtype_id); -} - -//-------------------------------------------------------------------------- -// Function: PredType default constructor -///\brief Default constructor: Creates a stub predefined datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -PredType::PredType() : AtomType() -{ -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: PredType copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param original - IN: PredType instance to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -PredType::PredType(const PredType &original) : AtomType(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: PredType::operator= -///\brief Assignment operator. -///\param rhs - IN: Reference to the predefined datatype -///\return Reference to PredType instance -///\exception H5::DataTypeIException -// Description -// Makes a copy of the type on the right hand side and stores -// the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -PredType & -PredType::operator=(const PredType &rhs) -{ - if (this != &rhs) - copy(rhs); - return (*this); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// These dummy functions do not inherit from DataType - they'll -// throw an DataTypeIException if invoked. -void -PredType::commit(H5Location &loc, const char *name) -{ - // Unused - (void)loc; - (void)name; - - throw DataTypeIException("PredType::commit", - "Error: Attempted to commit a predefined datatype. Invalid operation!"); -} - -void -PredType::commit(H5Location &loc, const H5std_string &name) -{ - commit(loc, name.c_str()); -} - -bool -PredType::committed() -{ - throw DataTypeIException("PredType::committed", - "Error: Attempting to check for commit status on a predefined datatype."); -} -#endif // DOXYGEN_SHOULD_SKIP_THIS - -// Default destructor -//-------------------------------------------------------------------------- -// Function: PredType destructor -///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -PredType::~PredType() -{ -} - -/***************************************************************************** - The following section is regarding the global constants PredType, - DataSpace, and PropList. - - *****************************************************************************/ - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// Definition pointers for the constants -PredType *PredType::PREDTYPE_CONST_ = 0; // dummy -PredType *PredType::STD_I8BE_; -PredType *PredType::STD_I8LE_; -PredType *PredType::STD_I16BE_; -PredType *PredType::STD_I16LE_; -PredType *PredType::STD_I32BE_; -PredType *PredType::STD_I32LE_; -PredType *PredType::STD_I64BE_; -PredType *PredType::STD_I64LE_; -PredType *PredType::STD_U8BE_; -PredType *PredType::STD_U8LE_; -PredType *PredType::STD_U16BE_; -PredType *PredType::STD_U16LE_; -PredType *PredType::STD_U32BE_; -PredType *PredType::STD_U32LE_; -PredType *PredType::STD_U64BE_; -PredType *PredType::STD_U64LE_; -PredType *PredType::STD_B8BE_; -PredType *PredType::STD_B8LE_; -PredType *PredType::STD_B16BE_; -PredType *PredType::STD_B16LE_; -PredType *PredType::STD_B32BE_; -PredType *PredType::STD_B32LE_; -PredType *PredType::STD_B64BE_; -PredType *PredType::STD_B64LE_; -PredType *PredType::STD_REF_OBJ_; -PredType *PredType::STD_REF_DSETREG_; - -PredType *PredType::C_S1_; -PredType *PredType::FORTRAN_S1_; - -PredType *PredType::IEEE_F32BE_; -PredType *PredType::IEEE_F32LE_; -PredType *PredType::IEEE_F64BE_; -PredType *PredType::IEEE_F64LE_; - -PredType *PredType::UNIX_D32BE_; -PredType *PredType::UNIX_D32LE_; -PredType *PredType::UNIX_D64BE_; -PredType *PredType::UNIX_D64LE_; - -PredType *PredType::INTEL_I8_; -PredType *PredType::INTEL_I16_; -PredType *PredType::INTEL_I32_; -PredType *PredType::INTEL_I64_; -PredType *PredType::INTEL_U8_; -PredType *PredType::INTEL_U16_; -PredType *PredType::INTEL_U32_; -PredType *PredType::INTEL_U64_; -PredType *PredType::INTEL_B8_; -PredType *PredType::INTEL_B16_; -PredType *PredType::INTEL_B32_; -PredType *PredType::INTEL_B64_; -PredType *PredType::INTEL_F32_; -PredType *PredType::INTEL_F64_; - -PredType *PredType::ALPHA_I8_; -PredType *PredType::ALPHA_I16_; -PredType *PredType::ALPHA_I32_; -PredType *PredType::ALPHA_I64_; -PredType *PredType::ALPHA_U8_; -PredType *PredType::ALPHA_U16_; -PredType *PredType::ALPHA_U32_; -PredType *PredType::ALPHA_U64_; -PredType *PredType::ALPHA_B8_; -PredType *PredType::ALPHA_B16_; -PredType *PredType::ALPHA_B32_; -PredType *PredType::ALPHA_B64_; -PredType *PredType::ALPHA_F32_; -PredType *PredType::ALPHA_F64_; - -PredType *PredType::MIPS_I8_; -PredType *PredType::MIPS_I16_; -PredType *PredType::MIPS_I32_; -PredType *PredType::MIPS_I64_; -PredType *PredType::MIPS_U8_; -PredType *PredType::MIPS_U16_; -PredType *PredType::MIPS_U32_; -PredType *PredType::MIPS_U64_; -PredType *PredType::MIPS_B8_; -PredType *PredType::MIPS_B16_; -PredType *PredType::MIPS_B32_; -PredType *PredType::MIPS_B64_; -PredType *PredType::MIPS_F32_; -PredType *PredType::MIPS_F64_; - -PredType *PredType::NATIVE_CHAR_; -PredType *PredType::NATIVE_SCHAR_; -PredType *PredType::NATIVE_UCHAR_; -PredType *PredType::NATIVE_SHORT_; -PredType *PredType::NATIVE_USHORT_; -PredType *PredType::NATIVE_INT_; -PredType *PredType::NATIVE_UINT_; -PredType *PredType::NATIVE_LONG_; -PredType *PredType::NATIVE_ULONG_; -PredType *PredType::NATIVE_LLONG_; -PredType *PredType::NATIVE_ULLONG_; -PredType *PredType::NATIVE_FLOAT_; -PredType *PredType::NATIVE_DOUBLE_; -PredType *PredType::NATIVE_LDOUBLE_; -PredType *PredType::NATIVE_B8_; -PredType *PredType::NATIVE_B16_; -PredType *PredType::NATIVE_B32_; -PredType *PredType::NATIVE_B64_; -PredType *PredType::NATIVE_OPAQUE_; -PredType *PredType::NATIVE_HSIZE_; -PredType *PredType::NATIVE_HSSIZE_; -PredType *PredType::NATIVE_HERR_; -PredType *PredType::NATIVE_HBOOL_; - -PredType *PredType::NATIVE_INT8_; -PredType *PredType::NATIVE_UINT8_; -PredType *PredType::NATIVE_INT16_; -PredType *PredType::NATIVE_UINT16_; -PredType *PredType::NATIVE_INT32_; -PredType *PredType::NATIVE_UINT32_; -PredType *PredType::NATIVE_INT64_; -PredType *PredType::NATIVE_UINT64_; - -// LEAST types -PredType *PredType::NATIVE_INT_LEAST8_; -PredType *PredType::NATIVE_UINT_LEAST8_; - -PredType *PredType::NATIVE_INT_LEAST16_; -PredType *PredType::NATIVE_UINT_LEAST16_; - -PredType *PredType::NATIVE_INT_LEAST32_; -PredType *PredType::NATIVE_UINT_LEAST32_; - -PredType *PredType::NATIVE_INT_LEAST64_; -PredType *PredType::NATIVE_UINT_LEAST64_; - -// FAST types -PredType *PredType::NATIVE_INT_FAST8_; -PredType *PredType::NATIVE_UINT_FAST8_; - -PredType *PredType::NATIVE_INT_FAST16_; -PredType *PredType::NATIVE_UINT_FAST16_; - -PredType *PredType::NATIVE_INT_FAST32_; -PredType *PredType::NATIVE_UINT_FAST32_; - -PredType *PredType::NATIVE_INT_FAST64_; -PredType *PredType::NATIVE_UINT_FAST64_; - -//-------------------------------------------------------------------------- -// Function: PredType::getPredTypes -// Purpose Returns the dummy PredType constant object pointer -// Return: PredType object pointer -// Description -// If the dummy constant PREDTYPE_CONST_ is not allocated yet, -// call makePredTypes() to allocate all of the PredType constants. -// Otherwise, just simply return the object pointer PREDTYPE_CONST_. -// -// Note that, there is a similar function to getPredTypes() in -// other classes, that have global constants, is called getConstant(). -// -// Programmer Binh-Minh Ribler - September 2015 -//-------------------------------------------------------------------------- -PredType * -PredType::getPredTypes() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the dummy constant pointer is not allocated, allocate all PredType - // constant pointers. Otherwise, throw because it shouldn't be. - if (PREDTYPE_CONST_ == 0) - makePredTypes(); - else - throw H5::DataTypeIException( - "PredType::getPredTypes", - "PredType::getPredTypes is being invoked on an allocated PREDTYPE_CONST_"); - return PREDTYPE_CONST_; -} - -//-------------------------------------------------------------------------- -// Function: PredType::makePredTypes -// Purpose Allocate all PredType constants. -// Programmer Binh-Minh Ribler - September 2015 -//-------------------------------------------------------------------------- -void -PredType::makePredTypes() -{ - PREDTYPE_CONST_ = new PredType; - C_S1_ = new PredType(H5T_C_S1); - FORTRAN_S1_ = new PredType(H5T_FORTRAN_S1); - - STD_I8BE_ = new PredType(H5T_STD_I8BE); - STD_I8LE_ = new PredType(H5T_STD_I8LE); - STD_I16BE_ = new PredType(H5T_STD_I16BE); - STD_I16LE_ = new PredType(H5T_STD_I16LE); - STD_I32BE_ = new PredType(H5T_STD_I32BE); - STD_I32LE_ = new PredType(H5T_STD_I32LE); - STD_I64BE_ = new PredType(H5T_STD_I64BE); - STD_I64LE_ = new PredType(H5T_STD_I64LE); - STD_U8BE_ = new PredType(H5T_STD_U8BE); - STD_U8LE_ = new PredType(H5T_STD_U8LE); - STD_U16BE_ = new PredType(H5T_STD_U16BE); - STD_U16LE_ = new PredType(H5T_STD_U16LE); - STD_U32BE_ = new PredType(H5T_STD_U32BE); - STD_U32LE_ = new PredType(H5T_STD_U32LE); - STD_U64BE_ = new PredType(H5T_STD_U64BE); - STD_U64LE_ = new PredType(H5T_STD_U64LE); - STD_B8BE_ = new PredType(H5T_STD_B8BE); - STD_B8LE_ = new PredType(H5T_STD_B8LE); - - STD_B16BE_ = new PredType(H5T_STD_B16BE); - STD_B16LE_ = new PredType(H5T_STD_B16LE); - STD_B32BE_ = new PredType(H5T_STD_B32BE); - STD_B32LE_ = new PredType(H5T_STD_B32LE); - STD_B64BE_ = new PredType(H5T_STD_B64BE); - STD_B64LE_ = new PredType(H5T_STD_B64LE); - STD_REF_OBJ_ = new PredType(H5T_STD_REF_OBJ); - STD_REF_DSETREG_ = new PredType(H5T_STD_REF_DSETREG); - - IEEE_F32BE_ = new PredType(H5T_IEEE_F32BE); - IEEE_F32LE_ = new PredType(H5T_IEEE_F32LE); - IEEE_F64BE_ = new PredType(H5T_IEEE_F64BE); - IEEE_F64LE_ = new PredType(H5T_IEEE_F64LE); - - UNIX_D32BE_ = new PredType(H5T_UNIX_D32BE); - UNIX_D32LE_ = new PredType(H5T_UNIX_D32LE); - UNIX_D64BE_ = new PredType(H5T_UNIX_D64BE); - UNIX_D64LE_ = new PredType(H5T_UNIX_D64LE); - - INTEL_I8_ = new PredType(H5T_INTEL_I8); - INTEL_I16_ = new PredType(H5T_INTEL_I16); - INTEL_I32_ = new PredType(H5T_INTEL_I32); - INTEL_I64_ = new PredType(H5T_INTEL_I64); - INTEL_U8_ = new PredType(H5T_INTEL_U8); - INTEL_U16_ = new PredType(H5T_INTEL_U16); - INTEL_U32_ = new PredType(H5T_INTEL_U32); - INTEL_U64_ = new PredType(H5T_INTEL_U64); - INTEL_B8_ = new PredType(H5T_INTEL_B8); - INTEL_B16_ = new PredType(H5T_INTEL_B16); - INTEL_B32_ = new PredType(H5T_INTEL_B32); - INTEL_B64_ = new PredType(H5T_INTEL_B64); - INTEL_F32_ = new PredType(H5T_INTEL_F32); - INTEL_F64_ = new PredType(H5T_INTEL_F64); - - ALPHA_I8_ = new PredType(H5T_ALPHA_I8); - ALPHA_I16_ = new PredType(H5T_ALPHA_I16); - ALPHA_I32_ = new PredType(H5T_ALPHA_I32); - ALPHA_I64_ = new PredType(H5T_ALPHA_I64); - ALPHA_U8_ = new PredType(H5T_ALPHA_U8); - ALPHA_U16_ = new PredType(H5T_ALPHA_U16); - ALPHA_U32_ = new PredType(H5T_ALPHA_U32); - ALPHA_U64_ = new PredType(H5T_ALPHA_U64); - ALPHA_B8_ = new PredType(H5T_ALPHA_B8); - ALPHA_B16_ = new PredType(H5T_ALPHA_B16); - ALPHA_B32_ = new PredType(H5T_ALPHA_B32); - ALPHA_B64_ = new PredType(H5T_ALPHA_B64); - ALPHA_F32_ = new PredType(H5T_ALPHA_F32); - ALPHA_F64_ = new PredType(H5T_ALPHA_F64); - - MIPS_I8_ = new PredType(H5T_MIPS_I8); - MIPS_I16_ = new PredType(H5T_MIPS_I16); - MIPS_I32_ = new PredType(H5T_MIPS_I32); - MIPS_I64_ = new PredType(H5T_MIPS_I64); - MIPS_U8_ = new PredType(H5T_MIPS_U8); - MIPS_U16_ = new PredType(H5T_MIPS_U16); - MIPS_U32_ = new PredType(H5T_MIPS_U32); - MIPS_U64_ = new PredType(H5T_MIPS_U64); - MIPS_B8_ = new PredType(H5T_MIPS_B8); - MIPS_B16_ = new PredType(H5T_MIPS_B16); - MIPS_B32_ = new PredType(H5T_MIPS_B32); - MIPS_B64_ = new PredType(H5T_MIPS_B64); - MIPS_F32_ = new PredType(H5T_MIPS_F32); - MIPS_F64_ = new PredType(H5T_MIPS_F64); - - NATIVE_CHAR_ = new PredType(H5T_NATIVE_CHAR); - NATIVE_INT_ = new PredType(H5T_NATIVE_INT); - NATIVE_FLOAT_ = new PredType(H5T_NATIVE_FLOAT); - NATIVE_SCHAR_ = new PredType(H5T_NATIVE_SCHAR); - NATIVE_UCHAR_ = new PredType(H5T_NATIVE_UCHAR); - NATIVE_SHORT_ = new PredType(H5T_NATIVE_SHORT); - NATIVE_USHORT_ = new PredType(H5T_NATIVE_USHORT); - NATIVE_UINT_ = new PredType(H5T_NATIVE_UINT); - NATIVE_LONG_ = new PredType(H5T_NATIVE_LONG); - NATIVE_ULONG_ = new PredType(H5T_NATIVE_ULONG); - NATIVE_LLONG_ = new PredType(H5T_NATIVE_LLONG); - NATIVE_ULLONG_ = new PredType(H5T_NATIVE_ULLONG); - NATIVE_DOUBLE_ = new PredType(H5T_NATIVE_DOUBLE); - NATIVE_LDOUBLE_ = new PredType(H5T_NATIVE_LDOUBLE); - NATIVE_B8_ = new PredType(H5T_NATIVE_B8); - NATIVE_B16_ = new PredType(H5T_NATIVE_B16); - NATIVE_B32_ = new PredType(H5T_NATIVE_B32); - NATIVE_B64_ = new PredType(H5T_NATIVE_B64); - NATIVE_OPAQUE_ = new PredType(H5T_NATIVE_OPAQUE); - NATIVE_HSIZE_ = new PredType(H5T_NATIVE_HSIZE); - NATIVE_HSSIZE_ = new PredType(H5T_NATIVE_HSSIZE); - NATIVE_HERR_ = new PredType(H5T_NATIVE_HERR); - NATIVE_HBOOL_ = new PredType(H5T_NATIVE_HBOOL); - - NATIVE_INT8_ = new PredType(H5T_NATIVE_INT8); - NATIVE_UINT8_ = new PredType(H5T_NATIVE_UINT8); - NATIVE_INT16_ = new PredType(H5T_NATIVE_INT16); - NATIVE_UINT16_ = new PredType(H5T_NATIVE_UINT16); - NATIVE_INT32_ = new PredType(H5T_NATIVE_INT32); - NATIVE_UINT32_ = new PredType(H5T_NATIVE_UINT32); - NATIVE_INT64_ = new PredType(H5T_NATIVE_INT64); - NATIVE_UINT64_ = new PredType(H5T_NATIVE_UINT64); - - // LEAST types - NATIVE_INT_LEAST8_ = new PredType(H5T_NATIVE_INT_LEAST8); - NATIVE_UINT_LEAST8_ = new PredType(H5T_NATIVE_UINT_LEAST8); - - NATIVE_INT_LEAST16_ = new PredType(H5T_NATIVE_INT_LEAST16); - NATIVE_UINT_LEAST16_ = new PredType(H5T_NATIVE_UINT_LEAST16); - - NATIVE_INT_LEAST32_ = new PredType(H5T_NATIVE_INT_LEAST32); - NATIVE_UINT_LEAST32_ = new PredType(H5T_NATIVE_UINT_LEAST32); - - NATIVE_INT_LEAST64_ = new PredType(H5T_NATIVE_INT_LEAST64); - NATIVE_UINT_LEAST64_ = new PredType(H5T_NATIVE_UINT_LEAST64); - - // FAST types - NATIVE_INT_FAST8_ = new PredType(H5T_NATIVE_INT_FAST8); - NATIVE_UINT_FAST8_ = new PredType(H5T_NATIVE_UINT_FAST8); - - NATIVE_INT_FAST16_ = new PredType(H5T_NATIVE_INT_FAST16); - NATIVE_UINT_FAST16_ = new PredType(H5T_NATIVE_UINT_FAST16); - - NATIVE_INT_FAST32_ = new PredType(H5T_NATIVE_INT_FAST32); - NATIVE_UINT_FAST32_ = new PredType(H5T_NATIVE_UINT_FAST32); - - NATIVE_INT_FAST64_ = new PredType(H5T_NATIVE_INT_FAST64); - NATIVE_UINT_FAST64_ = new PredType(H5T_NATIVE_UINT_FAST64); - -} // makePredTypes - -//-------------------------------------------------------------------------- -// Function: PredType::deleteConstants -// Purpose Deletes all PredType constant pointers. -// Programmer Binh-Minh Ribler - September 2015 -//-------------------------------------------------------------------------- -void -PredType::deleteConstants() -{ - delete STD_I8BE_; - delete STD_I8LE_; - delete STD_I16BE_; - delete STD_I16LE_; - delete STD_I32BE_; - delete STD_I32LE_; - delete STD_I64BE_; - delete STD_I64LE_; - delete STD_U8BE_; - delete STD_U8LE_; - delete STD_U16BE_; - delete STD_U16LE_; - delete STD_U32BE_; - delete STD_U32LE_; - delete STD_U64BE_; - delete STD_U64LE_; - delete STD_B8BE_; - delete STD_B8LE_; - delete STD_B16BE_; - delete STD_B16LE_; - delete STD_B32BE_; - delete STD_B32LE_; - delete STD_B64BE_; - delete STD_B64LE_; - delete STD_REF_OBJ_; - delete STD_REF_DSETREG_; - - delete C_S1_; - delete FORTRAN_S1_; - - delete IEEE_F32BE_; - delete IEEE_F32LE_; - delete IEEE_F64BE_; - delete IEEE_F64LE_; - - delete UNIX_D32BE_; - delete UNIX_D32LE_; - delete UNIX_D64BE_; - delete UNIX_D64LE_; - - delete INTEL_I8_; - delete INTEL_I16_; - delete INTEL_I32_; - delete INTEL_I64_; - delete INTEL_U8_; - delete INTEL_U16_; - delete INTEL_U32_; - delete INTEL_U64_; - delete INTEL_B8_; - delete INTEL_B16_; - delete INTEL_B32_; - delete INTEL_B64_; - delete INTEL_F32_; - delete INTEL_F64_; - - delete ALPHA_I8_; - delete ALPHA_I16_; - delete ALPHA_I32_; - delete ALPHA_I64_; - delete ALPHA_U8_; - delete ALPHA_U16_; - delete ALPHA_U32_; - delete ALPHA_U64_; - delete ALPHA_B8_; - delete ALPHA_B16_; - delete ALPHA_B32_; - delete ALPHA_B64_; - delete ALPHA_F32_; - delete ALPHA_F64_; - - delete MIPS_I8_; - delete MIPS_I16_; - delete MIPS_I32_; - delete MIPS_I64_; - delete MIPS_U8_; - delete MIPS_U16_; - delete MIPS_U32_; - delete MIPS_U64_; - delete MIPS_B8_; - delete MIPS_B16_; - delete MIPS_B32_; - delete MIPS_B64_; - delete MIPS_F32_; - delete MIPS_F64_; - - delete NATIVE_CHAR_; - delete NATIVE_SCHAR_; - delete NATIVE_UCHAR_; - delete NATIVE_SHORT_; - delete NATIVE_USHORT_; - delete NATIVE_INT_; - delete NATIVE_UINT_; - delete NATIVE_LONG_; - delete NATIVE_ULONG_; - delete NATIVE_LLONG_; - delete NATIVE_ULLONG_; - delete NATIVE_FLOAT_; - delete NATIVE_DOUBLE_; - delete NATIVE_LDOUBLE_; - delete NATIVE_B8_; - delete NATIVE_B16_; - delete NATIVE_B32_; - delete NATIVE_B64_; - delete NATIVE_OPAQUE_; - delete NATIVE_HSIZE_; - delete NATIVE_HSSIZE_; - delete NATIVE_HERR_; - delete NATIVE_HBOOL_; - - delete NATIVE_INT8_; - delete NATIVE_UINT8_; - delete NATIVE_INT16_; - delete NATIVE_UINT16_; - delete NATIVE_INT32_; - delete NATIVE_UINT32_; - delete NATIVE_INT64_; - delete NATIVE_UINT64_; - - // LEAST types - delete NATIVE_INT_LEAST8_; - delete NATIVE_UINT_LEAST8_; - - delete NATIVE_INT_LEAST16_; - delete NATIVE_UINT_LEAST16_; - - delete NATIVE_INT_LEAST32_; - delete NATIVE_UINT_LEAST32_; - - delete NATIVE_INT_LEAST64_; - delete NATIVE_UINT_LEAST64_; - - // FAST types - delete NATIVE_INT_FAST8_; - delete NATIVE_UINT_FAST8_; - - delete NATIVE_INT_FAST16_; - delete NATIVE_UINT_FAST16_; - - delete NATIVE_INT_FAST32_; - delete NATIVE_UINT_FAST32_; - - delete NATIVE_INT_FAST64_; - delete NATIVE_UINT_FAST64_; - - delete PREDTYPE_CONST_; - PREDTYPE_CONST_ = 0; -} // deleteConstants - -// Assigning the constant references to the dynamically allocated constants -// after using PREDTYPE_CONST to activate the creation of those constants. - -// PREDTYPE_CONST will be the first static constant declared in the file. -// getPredTypes() will call makePredTypes() to allocate memory for all the -// PredType constants. Note that, there is a similar function to getPredTypes() -// in other classes, that have global constants, is called getConstant(). - -const PredType &PredType::PREDTYPE_CONST = *PredType::getPredTypes(); -const PredType &PredType::STD_I8BE = *STD_I8BE_; -const PredType &PredType::STD_I8LE = *STD_I8LE_; -const PredType &PredType::STD_I16BE = *STD_I16BE_; -const PredType &PredType::STD_I16LE = *STD_I16LE_; -const PredType &PredType::STD_I32BE = *STD_I32BE_; -const PredType &PredType::STD_I32LE = *STD_I32LE_; -const PredType &PredType::STD_I64BE = *STD_I64BE_; -const PredType &PredType::STD_I64LE = *STD_I64LE_; -const PredType &PredType::STD_U8BE = *STD_U8BE_; -const PredType &PredType::STD_U8LE = *STD_U8LE_; -const PredType &PredType::STD_U16BE = *STD_U16BE_; -const PredType &PredType::STD_U16LE = *STD_U16LE_; -const PredType &PredType::STD_U32BE = *STD_U32BE_; -const PredType &PredType::STD_U32LE = *STD_U32LE_; -const PredType &PredType::STD_U64BE = *STD_U64BE_; -const PredType &PredType::STD_U64LE = *STD_U64LE_; -const PredType &PredType::STD_B8BE = *STD_B8BE_; -const PredType &PredType::STD_B8LE = *STD_B8LE_; -const PredType &PredType::STD_B16BE = *STD_B16BE_; -const PredType &PredType::STD_B16LE = *STD_B16LE_; -const PredType &PredType::STD_B32BE = *STD_B32BE_; -const PredType &PredType::STD_B32LE = *STD_B32LE_; -const PredType &PredType::STD_B64BE = *STD_B64BE_; -const PredType &PredType::STD_B64LE = *STD_B64LE_; -const PredType &PredType::STD_REF_OBJ = *STD_REF_OBJ_; -const PredType &PredType::STD_REF_DSETREG = *STD_REF_DSETREG_; - -const PredType &PredType::C_S1 = *C_S1_; -const PredType &PredType::FORTRAN_S1 = *FORTRAN_S1_; - -const PredType &PredType::IEEE_F32BE = *IEEE_F32BE_; -const PredType &PredType::IEEE_F32LE = *IEEE_F32LE_; -const PredType &PredType::IEEE_F64BE = *IEEE_F64BE_; -const PredType &PredType::IEEE_F64LE = *IEEE_F64LE_; - -const PredType &PredType::UNIX_D32BE = *UNIX_D32BE_; -const PredType &PredType::UNIX_D32LE = *UNIX_D32LE_; -const PredType &PredType::UNIX_D64BE = *UNIX_D64BE_; -const PredType &PredType::UNIX_D64LE = *UNIX_D64LE_; - -const PredType &PredType::INTEL_I8 = *INTEL_I8_; -const PredType &PredType::INTEL_I16 = *INTEL_I16_; -const PredType &PredType::INTEL_I32 = *INTEL_I32_; -const PredType &PredType::INTEL_I64 = *INTEL_I64_; -const PredType &PredType::INTEL_U8 = *INTEL_U8_; -const PredType &PredType::INTEL_U16 = *INTEL_U16_; -const PredType &PredType::INTEL_U32 = *INTEL_U32_; -const PredType &PredType::INTEL_U64 = *INTEL_U64_; -const PredType &PredType::INTEL_B8 = *INTEL_B8_; -const PredType &PredType::INTEL_B16 = *INTEL_B16_; -const PredType &PredType::INTEL_B32 = *INTEL_B32_; -const PredType &PredType::INTEL_B64 = *INTEL_B64_; -const PredType &PredType::INTEL_F32 = *INTEL_F32_; -const PredType &PredType::INTEL_F64 = *INTEL_F64_; - -const PredType &PredType::ALPHA_I8 = *ALPHA_I8_; -const PredType &PredType::ALPHA_I16 = *ALPHA_I16_; -const PredType &PredType::ALPHA_I32 = *ALPHA_I32_; -const PredType &PredType::ALPHA_I64 = *ALPHA_I64_; -const PredType &PredType::ALPHA_U8 = *ALPHA_U8_; -const PredType &PredType::ALPHA_U16 = *ALPHA_U16_; -const PredType &PredType::ALPHA_U32 = *ALPHA_U32_; -const PredType &PredType::ALPHA_U64 = *ALPHA_U64_; -const PredType &PredType::ALPHA_B8 = *ALPHA_B8_; -const PredType &PredType::ALPHA_B16 = *ALPHA_B16_; -const PredType &PredType::ALPHA_B32 = *ALPHA_B32_; -const PredType &PredType::ALPHA_B64 = *ALPHA_B64_; -const PredType &PredType::ALPHA_F32 = *ALPHA_F32_; -const PredType &PredType::ALPHA_F64 = *ALPHA_F64_; - -const PredType &PredType::MIPS_I8 = *MIPS_I8_; -const PredType &PredType::MIPS_I16 = *MIPS_I16_; -const PredType &PredType::MIPS_I32 = *MIPS_I32_; -const PredType &PredType::MIPS_I64 = *MIPS_I64_; -const PredType &PredType::MIPS_U8 = *MIPS_U8_; -const PredType &PredType::MIPS_U16 = *MIPS_U16_; -const PredType &PredType::MIPS_U32 = *MIPS_U32_; -const PredType &PredType::MIPS_U64 = *MIPS_U64_; -const PredType &PredType::MIPS_B8 = *MIPS_B8_; -const PredType &PredType::MIPS_B16 = *MIPS_B16_; -const PredType &PredType::MIPS_B32 = *MIPS_B32_; -const PredType &PredType::MIPS_B64 = *MIPS_B64_; -const PredType &PredType::MIPS_F32 = *MIPS_F32_; -const PredType &PredType::MIPS_F64 = *MIPS_F64_; - -const PredType &PredType::NATIVE_CHAR = *NATIVE_CHAR_; -const PredType &PredType::NATIVE_SCHAR = *NATIVE_SCHAR_; -const PredType &PredType::NATIVE_UCHAR = *NATIVE_UCHAR_; -const PredType &PredType::NATIVE_SHORT = *NATIVE_SHORT_; -const PredType &PredType::NATIVE_USHORT = *NATIVE_USHORT_; -const PredType &PredType::NATIVE_INT = *NATIVE_INT_; -const PredType &PredType::NATIVE_UINT = *NATIVE_UINT_; -const PredType &PredType::NATIVE_LONG = *NATIVE_LONG_; -const PredType &PredType::NATIVE_ULONG = *NATIVE_ULONG_; -const PredType &PredType::NATIVE_LLONG = *NATIVE_LLONG_; -const PredType &PredType::NATIVE_ULLONG = *NATIVE_ULLONG_; -const PredType &PredType::NATIVE_FLOAT = *NATIVE_FLOAT_; -const PredType &PredType::NATIVE_DOUBLE = *NATIVE_DOUBLE_; -const PredType &PredType::NATIVE_LDOUBLE = *NATIVE_LDOUBLE_; -const PredType &PredType::NATIVE_B8 = *NATIVE_B8_; -const PredType &PredType::NATIVE_B16 = *NATIVE_B16_; -const PredType &PredType::NATIVE_B32 = *NATIVE_B32_; -const PredType &PredType::NATIVE_B64 = *NATIVE_B64_; -const PredType &PredType::NATIVE_OPAQUE = *NATIVE_OPAQUE_; -const PredType &PredType::NATIVE_HSIZE = *NATIVE_HSIZE_; -const PredType &PredType::NATIVE_HSSIZE = *NATIVE_HSSIZE_; -const PredType &PredType::NATIVE_HERR = *NATIVE_HERR_; -const PredType &PredType::NATIVE_HBOOL = *NATIVE_HBOOL_; - -const PredType &PredType::NATIVE_INT8 = *NATIVE_INT8_; -const PredType &PredType::NATIVE_UINT8 = *NATIVE_UINT8_; -const PredType &PredType::NATIVE_INT16 = *NATIVE_INT16_; -const PredType &PredType::NATIVE_UINT16 = *NATIVE_UINT16_; -const PredType &PredType::NATIVE_INT32 = *NATIVE_INT32_; -const PredType &PredType::NATIVE_UINT32 = *NATIVE_UINT32_; -const PredType &PredType::NATIVE_INT64 = *NATIVE_INT64_; -const PredType &PredType::NATIVE_UINT64 = *NATIVE_UINT64_; - -// LEAST types -const PredType &PredType::NATIVE_INT_LEAST8 = *NATIVE_INT_LEAST8_; -const PredType &PredType::NATIVE_UINT_LEAST8 = *NATIVE_UINT_LEAST8_; - -const PredType &PredType::NATIVE_INT_LEAST16 = *NATIVE_INT_LEAST16_; -const PredType &PredType::NATIVE_UINT_LEAST16 = *NATIVE_UINT_LEAST16_; - -const PredType &PredType::NATIVE_INT_LEAST32 = *NATIVE_INT_LEAST32_; -const PredType &PredType::NATIVE_UINT_LEAST32 = *NATIVE_UINT_LEAST32_; - -const PredType &PredType::NATIVE_INT_LEAST64 = *NATIVE_INT_LEAST64_; -const PredType &PredType::NATIVE_UINT_LEAST64 = *NATIVE_UINT_LEAST64_; - -// FAST types -const PredType &PredType::NATIVE_INT_FAST8 = *NATIVE_INT_FAST8_; -const PredType &PredType::NATIVE_UINT_FAST8 = *NATIVE_UINT_FAST8_; - -const PredType &PredType::NATIVE_INT_FAST16 = *NATIVE_INT_FAST16_; -const PredType &PredType::NATIVE_UINT_FAST16 = *NATIVE_UINT_FAST16_; - -const PredType &PredType::NATIVE_INT_FAST32 = *NATIVE_INT_FAST32_; -const PredType &PredType::NATIVE_UINT_FAST32 = *NATIVE_UINT_FAST32_; - -const PredType &PredType::NATIVE_INT_FAST64 = *NATIVE_INT_FAST64_; -const PredType &PredType::NATIVE_UINT_FAST64 = *NATIVE_UINT_FAST64_; - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -} // namespace H5 - -/*************************************************************************** - Design Note - =========== - -September 2015: - - The C++ library has several types of global constants from different - classes, such as PropList, PredType, DataSpace, etc... Previously, - these global constants were declared statically and the C++ library used - a constant, called PredType::AtExit, to detect when all the global - constants are destroyed then close the C library (H5close). This method - relied on the order of the constants being created and destroyed and - that PredType constants be the last to be destroyed. In September - 2015, it was recognized that the order in which the global constants were - created and destroyed was actually undefined, thus can be different - between different compilers. This resulted in failure when compilers - destroy PredType constants before others because when PredType::AtExit - was destroyed, the C library was closed, so when the constants of other - classes such as PropList or DataSpace were being deleted, the C library - would not be available. - - These are the classes that have global constants: - + PredType - + DataSpace - + PropList (and its subclasses below) - + DSetMemXferPropList - + DSetCreatPropList - + DSetAccPropList - + FileAccPropList - + FileCreatPropList - + LinkAccPropList - + LinkCreatPropList - + ObjCreatPropList - - The new method includes these main points: - - - The C++ library uses dynamically allocated constants to have the - control in which order the global constants are created/destroyed. - - - The previous static constants are changed to be the references to - the dynamically allocated constants to avoid impact on applications. - - - The first time an IdComponent default constructor is invoked, it - will call the function H5Library::initH5cpp which registers the - terminating functions from each class that has the global constants - so that these functions can destroy those constants at the exit of the - application. IdComponent is a baseclass of any object class that has - an identifier, such as Group, DataSet, DataType,... The classes which - have the global constants are all derived from IdComponent. - - - At the normal termination of the application, each registered function - for each constant type will delete all the allocated constants in - that type class, then a different terminating function, which was also - registered with atexit() by initH5cpp, will call H5close to close the - C library. - - The following list presents the differences between the old and new - methods and the changes implemented for the new method. - - 1. The following items are added to class H5Library: - // Private instance to be created by H5Library only - static H5Library* instance; - - // Returns a singleton H5Library to initialize the global - // constants, invoked in IdComponent default constructor - static H5Library* getInstance(); // public - - // Registers cleanup and terminating functions with atexit(), - // called in IdComponent default constructor - static void initH5cpp(void); // public - - // Calls H5close to terminate the library, registered with - // atexit(), as the last thing to be done. - static void termH5cpp(void); // public - - 2. The following shows the differences between the old and new methods - for allocating the PredType constants. There are more than 100 - constants, but only one is shown here for examples. - - Old Method: - ---------- - // Declaration of the constant - in "H5PredType.h" - static const PredType NATIVE_INT; - - // Definition of the constant - in "H5PredType.cpp" - const PredType PredType::NATIVE_INT(H5T_NATIVE_INT); - - New Method: - ---------- - // Declare pointer for a constant - in "H5PredType.h" - static PredType* NATIVE_INT_; // "H5PredType.h" - - // Change previous constant to reference - in "H5PredType.h" - static const PredType& NATIVE_INT; - - // The assignment of the first static constant, named - // PREDTYPE_CONST, calls makePredTypes() which allocates the - // dynamic memory for every PredType constant. - - // Creates a dynamic PredType object representing a C constant - // - in makePredTypes() - NATIVE_INT_ = new PredType(H5T_NATIVE_INT); - - // Assign the constant reference to the dynamic object - // - in "H5PredType.cpp" - const PredType& PredType::NATIVE_INT = *NATIVE_INT_; - - Functions added to class PredType: - - // Creates the constants - static void makePredTypes(); // private - - // Calls makePredTypes to create the constants and returns - // the dummy constant PREDTYPE_CONST; - static PredType* getPredTypes(); // private - - // Deletes the constants - static void deleteConstants(); // public - - 3. This section shows the differences between the old and new methods - for allocating the DataSpace constant, DataSpace::ALL. - - Old Method: - ---------- - // Declaration of the constant - in "H5DataSpace.h" - static const DataSpace ALL; - - // Definition of the constant - in "H5DataSpace.cpp" - const DataSpace DataSpace::ALL(H5S_ALL); - - New Method: - ---------- - // Declare pointer for a constant - in "H5DataSpace.h" - static DataSpace* ALL_; // "H5DataSpace.h" - - // Change previous constant to reference - in "H5DataSpace.h" - static const DataSpace& ALL; - - // Creates a dynamic DataSpace object representing the C constant - // - in "H5DataSpace.cpp" - ALL_ = new DataSpace(H5S_ALL); - - // Assign the constant reference to the dynamic object - // - in "H5DataSpace.cpp" - const DataSpace& DataSpace::ALL = *ALL_; - - Functions added to class DataSpace: - - // Creates the constant - static DataSpace* getConstant(); // private - - // Deletes the constant - static void deleteConstants(); // public - - 4. This section shows the differences between the old and new methods - for allocating the following constants - - PropList constant, PropList::DEFAULT. - - DSetAccPropList constant, DSetAccPropList::DEFAULT. - - DSetCreatPropList constant, DSetCreatPropList::DEFAULT. - - DSetMemXferPropList constant, DSetMemXferPropList::DEFAULT. - - FileCreatPropList constant, FileCreatPropList::DEFAULT. - - FileAccPropList constant, FileAccPropList::DEFAULT. - - LinkAccPropList constant, LinkAccPropList::DEFAULT. - - LinkCreatPropList constant, LinkCreatPropList::DEFAULT. - - ObjCreatPropList constant, ObjCreatPropList::DEFAULT. - - For these constants, the library has the same changes, except the - class names and the HDF5 corresponding constants. Only the items - of PropList are listed, and "PropList" can be replaced by any of - DSetAccPropList, DSetCreatPropList, DSetMemXferPropList, - FileCreatPropList, FileAccPropList, LinkAccPropList, LinkCreatPropList, - ObjCreatPropList for those classes. The HDF5 C constant "H5P_DEFAULT" - can be replaced by any of these respectively: H5P_DATASET_ACCESS, - H5P_DATASET_CREATE, H5P_DATASET_XFER, H5P_FILE_CREATE, H5P_FILE_ACCESS, - H5P_LINK_ACCESS, H5P_LINK_CREATE, and H5P_OBJECT_CREATE. - - Old Method: - ---------- - // Declaration of the constant - in "H5PropList.h" - static const PropList DEFAULT; - - // Definition of the constant - in "H5PropList.cpp" - const PropList PropList::DEFAULT(H5P_DEFAULT); - - New Method: - ---------- - // Declare pointer for a constant - in "H5PropList.h" - static PropList* DEFAULT_; // "H5PropList.h" - - // Change previous constant to reference - in "H5PropList.h" - static const PropList& DEFAULT; - - // Creates a dynamic PropList object representing the C constant - // - in "H5PropList.cpp" - DEFAULT_ = new PropList(H5P_DEFAULT); - - // Assign the constant reference to the dynamic object - // - in "H5PropList.cpp" - const PropList& PropList::DEFAULT = *DEFAULT_; - - Functions added to class PropList: - - // Creates the constant - static PropList* getConstant(); // private - - // Deletes the constants - static void deleteConstants(); // public - - The same functions are added to the subclasses of PropList instead of - using PropList's because of the class types and in favor of clarity. - -****************************************************************************/ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5PropList.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5PropList.cpp deleted file mode 100644 index d4e7b397d4..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5PropList.cpp +++ /dev/null @@ -1,835 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" - -namespace H5 { -using std::cerr; -using std::endl; - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -// This DOXYGEN_SHOULD_SKIP_THIS block is a work-around approach to control -// the order of creation and deletion of the global constants. See Design Notes -// in "H5PredType.cpp" for information. - -// Initialize a pointer for the constant -PropList *PropList::DEFAULT_ = 0; - -//-------------------------------------------------------------------------- -// Function: PropList::getConstant -// Purpose Creates a PropList object representing the HDF5 constant -// H5P_DEFAULT, pointed to by PropList::DEFAULT_. -// Exception H5::PropListIException -// Description -// If PropList::DEFAULT_ already points to an allocated object, -// throw a PropListIException. This scenario should not happen. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -PropList * -PropList::getConstant() -{ - // Tell the C library not to clean up, H5Library::termH5cpp will call - // H5close - more dependency if use H5Library::dontAtExit() - if (!IdComponent::H5dontAtexit_called) { - (void)H5dont_atexit(); - IdComponent::H5dontAtexit_called = true; - } - - // If the constant pointer is not allocated, allocate it. Otherwise, - // throw because it shouldn't be. - if (DEFAULT_ == 0) - DEFAULT_ = new PropList(H5P_DEFAULT); - else - throw PropListIException("PropList::getConstant", - "PropList::getConstant is being invoked on an allocated DEFAULT_"); - return (DEFAULT_); -} - -//-------------------------------------------------------------------------- -// Function: PropList::deleteConstants -// Purpose Deletes the constant object that PropList::DEFAULT_ points to. -// Programmer Binh-Minh Ribler - 2015 -//-------------------------------------------------------------------------- -void -PropList::deleteConstants() -{ - delete DEFAULT_; -} - -//-------------------------------------------------------------------------- -// Purpose Constant for default property. -//-------------------------------------------------------------------------- -const PropList &PropList::DEFAULT = *getConstant(); - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: Default constructor -///\brief Default constructor: creates a stub property list object. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -PropList::PropList() : IdComponent(), id(H5P_DEFAULT) -{ -} - -//-------------------------------------------------------------------------- -// Function: PropList copy constructor -///\brief Copy constructor: same HDF5 object as \a original -///\param original - IN: The original property list to copy -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -PropList::PropList(const PropList &original) : IdComponent(), id(original.id) -{ - incRefCount(); // increment number of references to this id -} - -//-------------------------------------------------------------------------- -// Function: PropList overloaded constructor -///\brief Creates a property list using the id of an existing property. -///\param plist_id - IN: Id of the existing property list -///\exception H5::PropListIException -// Description -// This function creates a new property list if a property -// class is provided or makes a copy of a property list if one -// is given. If the given id is anything else, then set this -// property's id to H5P_DEFAULT. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -PropList::PropList(const hid_t plist_id) : IdComponent(), id{H5P_DEFAULT} -{ - H5I_type_t id_type = H5Iget_type(plist_id); - switch (id_type) { - case H5I_GENPROP_CLS: - // call C routine to create a new property from the given prop class - id = H5Pcreate(plist_id); - if (id < 0) { - throw PropListIException("PropList constructor", "H5Pcreate failed"); - } - break; - case H5I_GENPROP_LST: - // call C routine to make a copy of the given property list - id = H5Pcopy(plist_id); - if (id < 0) { - throw PropListIException("PropList constructor", "H5Pcopy failed"); - } - break; - /* These should really be error cases, but changing that breaks - * the stated behavior and causes test failures. - * (DER, July 2017) - */ - case H5I_BADID: - case H5I_FILE: - case H5I_GROUP: - case H5I_DATATYPE: - case H5I_DATASPACE: - case H5I_DATASET: - case H5I_ATTR: - case H5I_VFL: - case H5I_VOL: - case H5I_ERROR_CLASS: - case H5I_ERROR_MSG: - case H5I_ERROR_STACK: - case H5I_NTYPES: - case H5I_UNINIT: - case H5I_MAP: - case H5I_SPACE_SEL_ITER: - case H5I_EVENTSET: - default: - id = H5P_DEFAULT; - break; - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::copy -///\brief Makes a copy of an existing property list. -///\param like_plist - IN: Reference to the existing property list -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -void -PropList::copy(const PropList &like_plist) -{ - // If this object is representing an hdf5 object, close it before - // copying like_plist to it - try { - close(); - } - catch (Exception &close_error) { - throw PropListIException(inMemFunc("copy"), close_error.getDetailMsg()); - } - - // call C routine to copy the property list - id = H5Pcopy(like_plist.getId()); - if (id < 0) - throw PropListIException(inMemFunc("copy"), "H5Pcopy failed"); -} - -//-------------------------------------------------------------------------- -// Function: PropList::operator= -///\brief Assignment operator. -///\param rhs - IN: Reference to the existing property list -///\return Reference to PropList instance -///\exception H5::PropListIException -// Description -// Makes a copy of the property list on the right hand side -// and stores the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -PropList & -PropList::operator=(const PropList &rhs) -{ - if (this != &rhs) - copy(rhs); - return (*this); -} - -//-------------------------------------------------------------------------- -// Function: PropList::copyProp -///\brief Copies a property from this property list or class to another -///\param dest - IN: Destination property list or class -///\param name - IN: Name of the property to copy - \c char pointer -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -void -PropList::copyProp(PropList &dest, const char *name) const -{ - hid_t dst_id = dest.getId(); - herr_t ret_value = H5Pcopy_prop(dst_id, id, name); - if (ret_value < 0) { - throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::copyProp -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param dest - IN: Destination property list or class -///\param name - IN: Name of the property to copy - \c H5std_string -// Programmer Binh-Minh Ribler - Jul, 2005 -//-------------------------------------------------------------------------- -void -PropList::copyProp(PropList &dest, const H5std_string &name) const -{ - copyProp(dest, name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: PropList::copyProp -///\brief Copies a property from one list or class to another - Obsolete -///\param dest - IN: Destination property list or class -///\param src - IN: Source property list or class -///\param name - IN: Name of the property to copy - \c char pointer -///\note This member function will be removed in the next release -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -PropList::copyProp(PropList &dest, PropList &src, const char *name) const -{ - hid_t dst_id = dest.getId(); - hid_t src_id = src.getId(); - herr_t ret_value = H5Pcopy_prop(dst_id, src_id, name); - if (ret_value < 0) { - throw PropListIException(inMemFunc("copyProp"), "H5Pcopy_prop failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::copyProp -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. - Obsolete -///\param dest - IN: Destination property list or class -///\param src - IN: Source property list or class -///\param name - IN: Name of the property to copy - \c H5std_string -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -PropList::copyProp(PropList &dest, PropList &src, const H5std_string &name) const -{ - copyProp(dest, src, name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: PropList::getId -///\brief Get the id of this property list -///\return Property list identifier -// Description: -// Class hierarchy is revised to address bugzilla 1068. Class -// AbstractDS and Attribute are moved out of H5Object. In -// addition, member IdComponent::id is moved into subclasses, and -// IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 -//-------------------------------------------------------------------------- -hid_t -PropList::getId() const -{ - return (id); -} - -#ifndef DOXYGEN_SHOULD_SKIP_THIS -//-------------------------------------------------------------------------- -// Function: PropList::p_setId -///\brief Sets the identifier of this object to a new value. -/// -///\exception H5::IdComponentException when the attempt to close the HDF5 -/// object fails -// Description: -// The underlying reference counting in the C library ensures -// that the current valid id of this object is properly closed. -// Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -PropList::p_setId(const hid_t new_id) -{ - // handling references to this old id - try { - close(); - } - catch (Exception &close_error) { - throw PropListIException(inMemFunc("p_setId"), close_error.getDetailMsg()); - } - // reset object's id to the given id - id = new_id; -} - -#endif // DOXYGEN_SHOULD_SKIP_THIS - -//-------------------------------------------------------------------------- -// Function: PropList::close -///\brief Closes the property list if it is not a default one. -/// -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 -//-------------------------------------------------------------------------- -void -PropList::close() -{ - if (p_valid_id(id)) { - herr_t ret_value = H5Pclose(id); - if (ret_value < 0) { - throw PropListIException(inMemFunc("close"), "H5Pclose failed"); - } - // reset the id - id = H5I_INVALID_HID; - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::getClass -///\brief Returns the class of this property list, i.e. \c H5P_FILE_CREATE... -///\return The property list class if it is not equal to \c H5P_ROOT -///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -hid_t -PropList::getClass() const -{ - hid_t plist_class = H5Pget_class(id); - if (plist_class == H5P_ROOT) { - throw PropListIException(inMemFunc("getClass"), "H5Pget_class failed - returned H5P_ROOT"); - } - return (plist_class); -} - -//-------------------------------------------------------------------------- -// Function: PropList::propExist -///\brief Queries the existence of a property in a property object. -///\param name - IN: Name of property to check for - \c char pointer -///\return true if the property exists in the property object, and -/// false, otherwise. -///\exception H5::PropListIException -///\par Description -/// This routine checks if a property exists within a property -/// list or class. -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -bool -PropList::propExist(const char *name) const -{ - // Calls C routine H5Pexist to determine whether a property exists - // within a property list or class. It returns a positive value, 0, - // or a negative value - htri_t ret_value = H5Pexist(id, name); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else // Raise exception when H5Pexist returns a negative value - { - throw PropListIException(inMemFunc("propExist"), "H5Pexist failed"); - } -} -//-------------------------------------------------------------------------- -// Function: PropList::propExist -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to check for - \c H5std_string -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -bool -PropList::propExist(const H5std_string &name) const -{ - return (propExist(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: PropList::closeClass -///\brief Close a property list class. -/// -///\exception H5::PropListIException -///\par Description -/// Releases memory and detaches a class from the property -/// list class hierarchy. -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -PropList::closeClass() const -{ - herr_t ret_value = H5Pclose_class(id); - if (ret_value < 0) { - throw PropListIException(inMemFunc("closeClass"), "H5Pclose_class failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::getProperty -///\brief Query the value of a property in a property list. -///\param name - IN: Name of property to query - \c char pointer -///\param value - OUT: Pointer to the buffer for the property value -///\exception H5::PropListIException -///\par Description -/// Retrieves a copy of the value for a property in a property -/// list. The property name must exist or this routine will -/// throw an exception. -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -PropList::getProperty(const char *name, void *value) const -{ - herr_t ret_value = H5Pget(id, name, value); - if (ret_value < 0) { - throw PropListIException(inMemFunc("getProperty"), "H5Pget failed"); - } -} -//-------------------------------------------------------------------------- -// Function: PropList::getProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to query - \c char pointer -///\return The property that is a \c H5std_string. -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -H5std_string -PropList::getProperty(const char *name) const -{ - // Get property size first - size_t size = getPropSize(name); - - // Allocate buffer then get the property - char *prop_strg_C = new char[size + 1](); - - herr_t ret_value = H5Pget(id, name, prop_strg_C); // call C API - - // Throw exception if H5Pget returns failure - if (ret_value < 0) { - delete[] prop_strg_C; - throw PropListIException(inMemFunc("getProperty"), "H5Pget failed"); - } - - // Return property value as a string after deleting temp C-string - H5std_string prop_strg(prop_strg_C); - delete[] prop_strg_C; - return (prop_strg); -} -//-------------------------------------------------------------------------- -// Function: PropList::getProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to query - \c H5std_string -///\param value - OUT: Pointer to the buffer for the property value -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -PropList::getProperty(const H5std_string &name, void *value) const -{ - getProperty(name.c_str(), value); -} -//-------------------------------------------------------------------------- -// Function: PropList::getProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to query - \c H5std_string -///\return The property that is a \c H5std_string. -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -H5std_string -PropList::getProperty(const H5std_string &name) const -{ - return (getProperty(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: PropList::getPropSize -///\brief Query the size of a property in a property list or class. -///\param name - IN: Name of property to query -///\return Size of the property -///\exception H5::PropListIException -///\par Description -/// This routine retrieves the size of a property's value -/// in bytes. Zero-sized properties are allowed and the return -/// value will be of 0. This function works for both property -/// lists and classes. -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -size_t -PropList::getPropSize(const char *name) const -{ - size_t prop_size; - herr_t ret_value = H5Pget_size(id, name, &prop_size); - if (ret_value < 0) { - throw PropListIException(inMemFunc("getPropSize"), "H5Pget_size failed"); - } - return (prop_size); -} -//-------------------------------------------------------------------------- -// Function: PropList::getPropSize -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to query - \c H5std_string -/// -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -size_t -PropList::getPropSize(const H5std_string &name) const -{ - return (getPropSize(name.c_str())); -} - -//-------------------------------------------------------------------------- -// Function: PropList::getClassName -///\brief Return the name of a generic property list class. -///\return A string containing the class name, if success, otherwise, -/// an empty string. -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -H5std_string -PropList::getClassName() const -{ - char *temp_str; - temp_str = H5Pget_class_name(id); - if (temp_str != NULL) { - H5std_string class_name(temp_str); - H5free_memory(temp_str); - return (class_name); - } - else - return ""; -} - -//-------------------------------------------------------------------------- -// Function: PropList::getNumProps -///\brief Returns the number of properties in this property list or class. -///\return Size of the property. -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -size_t -PropList::getNumProps() const -{ - size_t nprops; - herr_t ret_value = H5Pget_nprops(id, &nprops); - if (ret_value < 0) { - throw PropListIException(inMemFunc("getNumProps"), "H5Pget_nprops failed"); - } - return (nprops); -} - -//-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief Set a property's value in a property list. -///\param name - IN: Name of property to set - \c char pointer -///\param value - IN: Void pointer to the value for the property -///\exception H5::PropListIException -// Description -// Revision svn r29815 changed 'value' to const, hence, deprecated -// the non-const setProperty. -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -PropList::setProperty(const char *name, const void *value) const -{ - herr_t ret_value = H5Pset(id, name, value); - if (ret_value < 0) { - throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief Deprecated due to missing const in prototype. (1.10.1) -// Programmer: Binh-Minh Ribler - March, 2017 -// Modification -// Planned for removal. -BMR, 2017/03/17 1.10.1 -//-------------------------------------------------------------------------- -void -PropList::setProperty(const char *name, void *value) const -{ - herr_t ret_value = H5Pset(id, name, value); - if (ret_value < 0) { - throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to set - \c char pointer -///\param charptr - IN: Char pointer to the value for the property -// Description -// Revision svn r29815 changed 'value' to const, hence, deprecated -// the non-const setProperty. -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -PropList::setProperty(const char *name, const char *charptr) const -{ - herr_t ret_value = H5Pset(id, name, static_cast(charptr)); - if (ret_value < 0) { - throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to set - \c char pointer -///\param strg - IN: Value for the property is a \c H5std_string -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -PropList::setProperty(const char *name, const H5std_string &strg) const -{ - setProperty(name, strg.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief Deprecated due to missing const in prototype. (1.10.1) -// Programmer: Binh-Minh Ribler - March, 2017 -// Modification -// Planned for removal. -BMR, 2017/03/17 1.10.1 -//-------------------------------------------------------------------------- -void -PropList::setProperty(const char *name, H5std_string &strg) const -{ - setProperty(name, strg.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to set - \c H5std_string -///\param value - IN: Void pointer to the value for the property -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -PropList::setProperty(const H5std_string &name, const void *value) const -{ - setProperty(name.c_str(), value); -} - -//-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief Deprecated due to missing const in prototype. (1.10.1) -// Programmer: Binh-Minh Ribler - March, 2017 -// Modification -// Planned for removal. -BMR, 2017/03/17 1.10.1 -//-------------------------------------------------------------------------- -void -PropList::setProperty(const H5std_string &name, void *value) const -{ - setProperty(name.c_str(), value); -} - -//-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to set - \c H5std_string -///\param strg - IN: Value for the property is a \c H5std_string -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -PropList::setProperty(const H5std_string &name, const H5std_string &strg) const -{ - setProperty(name.c_str(), strg.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: PropList::setProperty -///\brief Deprecated due to missing const in prototype. (1.10.1) -// Programmer: Binh-Minh Ribler - March, 2017 -// Modification -// Planned for removal. -BMR, 2017/03/17 1.10.1 -//-------------------------------------------------------------------------- -void -PropList::setProperty(const H5std_string &name, H5std_string &strg) const -{ - setProperty(name.c_str(), strg.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: PropList::isAClass -///\brief Determines whether a property list is a certain class. -///\param prop_class - IN: Property class to query -///\return true if the property list is a member of the property list -/// class, and false, otherwise. -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -bool -PropList::isAClass(const PropList &prop_class) const -{ - htri_t ret_value = H5Pisa_class(id, prop_class.getId()); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else // Raise exception when H5Pisa_class returns a negative value - { - throw PropListIException(inMemFunc("isAClass"), "H5Pisa_class failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::removeProp -///\brief Removes a property from a property list. -///\param name - IN: Name of property to remove - \c char pointer -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -PropList::removeProp(const char *name) const -{ - herr_t ret_value = H5Premove(id, name); - if (ret_value < 0) { - throw PropListIException(inMemFunc("removeProp"), "H5Premove failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::removeProp -///\brief This is an overloaded member function, provided for convenience. -/// It differs from the above function only in what arguments it -/// accepts. -///\param name - IN: Name of property to remove - \c H5std_string -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -void -PropList::removeProp(const H5std_string &name) const -{ - removeProp(name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: PropList::operator== -///\brief Compares this property list or class against the given list or class. -///\param rhs - IN: Reference to the property list to compare -///\return true if the property lists or classes are equal, and -/// false, otherwise. -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -bool -PropList::operator==(const PropList &rhs) const -{ - htri_t ret_value = H5Pequal(id, rhs.getId()); - if (ret_value > 0) - return true; - else if (ret_value == 0) - return false; - else // Raise exception when H5Pequal returns a negative value - { - throw PropListIException(inMemFunc("operator=="), "H5Pequal failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: PropList::getClassParent -///\brief Returns the parent class of a generic property class -///\return The parent class of a property class -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 -//-------------------------------------------------------------------------- -PropList -PropList::getClassParent() const -{ - hid_t class_id = H5Pget_class_parent(id); - if (class_id < 0) { - throw PropListIException(inMemFunc("getClassParent"), "H5Pget_class_parent failed"); - } - PropList pclass(class_id); - return (pclass); -} - -//-------------------------------------------------------------------------- -// Function: PropList destructor -///\brief Properly terminates access to this property list. -// Programmer Binh-Minh Ribler - 2000 -// Modification -// - Replaced resetIdComponent() with decRefCount() to use C -// library ID reference counting mechanism - BMR, Jun 1, 2004 -// - Replaced decRefCount with close() to let the C library -// handle the reference counting - BMR, Jun 1, 2006 -//-------------------------------------------------------------------------- -PropList::~PropList() -{ - try { - close(); - } - catch (Exception &close_error) { - cerr << "PropList::~PropList - " << close_error.getDetailMsg() << endl; - } -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Pstrcpl.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Pstrcpl.c index 89fc9672ee..86c3754844 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Pstrcpl.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Pstrcpl.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Pstrcpl.c - * October 26 2005 - * James Laird * * Purpose: String creation property list class routines * @@ -109,8 +106,6 @@ static const H5T_cset_t H5P_def_char_encoding_g = * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * October 31, 2006 *------------------------------------------------------------------------- */ static herr_t @@ -124,7 +119,7 @@ H5P__strcrt_reg_prop(H5P_genclass_t *pclass) if (H5P__register_real(pclass, H5P_STRCRT_CHAR_ENCODING_NAME, H5P_STRCRT_CHAR_ENCODING_SIZE, &H5P_def_char_encoding_g, NULL, NULL, NULL, H5P_STRCRT_CHAR_ENCODING_ENC, H5P_STRCRT_CHAR_ENCODING_DEC, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -137,8 +132,6 @@ H5P__strcrt_reg_prop(H5P_genclass_t *pclass) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Wednesday, October 26, 2005 *------------------------------------------------------------------------- */ herr_t @@ -152,15 +145,15 @@ H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding) /* Check arguments */ if (encoding <= H5T_CSET_ERROR || encoding >= H5T_NCSET) - HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "character encoding is not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "character encoding is not valid"); /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_STRING_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Set the character encoding */ if (H5P_set(plist, H5P_STRCRT_CHAR_ENCODING_NAME, &encoding) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set character encoding") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set character encoding"); done: FUNC_LEAVE_API(ret_value) @@ -173,8 +166,6 @@ H5Pset_char_encoding(hid_t plist_id, H5T_cset_t encoding) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * November 1, 2005 *------------------------------------------------------------------------- */ herr_t @@ -188,12 +179,12 @@ H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/) /* Get the plist structure */ if (NULL == (plist = H5P_object_verify(plist_id, H5P_STRING_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get value */ if (encoding) if (H5P_get(plist, H5P_STRCRT_CHAR_ENCODING_NAME, encoding) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get character encoding flag") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get character encoding flag"); done: FUNC_LEAVE_API(ret_value) @@ -209,9 +200,6 @@ H5Pget_char_encoding(hid_t plist_id, H5T_cset_t *encoding /*out*/) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 31, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -223,8 +211,8 @@ H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(encoding); - HDassert(size); + assert(encoding); + assert(size); if (NULL != *pp) /* Encode character set encoding */ @@ -246,9 +234,6 @@ H5P__strcrt_char_encoding_enc(const void *value, void **_pp, size_t *size) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, August 31, 2012 - * *------------------------------------------------------------------------- */ static herr_t @@ -260,9 +245,9 @@ H5P__strcrt_char_encoding_dec(const void **_pp, void *_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pp); - HDassert(*pp); - HDassert(encoding); + assert(pp); + assert(*pp); + assert(encoding); /* Decode character set encoding */ *encoding = (H5T_cset_t) * (*pp)++; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ptest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ptest.c index 7c1571c684..0bb1c31e61 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ptest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ptest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Saturday May 31, 2003 - * +/* * Purpose: Generic Property Testing Functions */ @@ -67,7 +64,7 @@ H5P__get_class_path_test(hid_t pclass_id) /* Get the property list class path */ if (NULL == (ret_value = H5P__get_class_path(pclass))) - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "unable to query full path of class") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "unable to query full path of class"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5R.c b/externals/coda-oss/modules/drivers/hdf5/source/H5R.c index 09b20797f5..a43b638cc0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5R.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5R.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -95,33 +94,33 @@ H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_p /* Check args */ if (ref_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); if (oapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get object access property list */ if (H5P_DEFAULT == oapl_id) oapl_id = H5P_LINK_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get object type */ if ((obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get the file for the object */ if ((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Retrieve VOL file object */ if (NULL == (vol_obj_file = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO; @@ -129,7 +128,7 @@ H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_p /* Get container info */ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -144,20 +143,20 @@ H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_p /* Get the object token */ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token"); /* Create the reference (do not pass filename, since file_id is attached) */ - HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE); + memset(ref_ptr, 0, H5R_REF_BUF_SIZE); if (H5R__create_object(&obj_token, cont_info.token_size, (H5R_ref_priv_t *)ref_ptr) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference"); /* Attach loc_id to reference and hold reference to it */ if (H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference"); done: if (file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file"); FUNC_LEAVE_API(ret_value) } /* end H5Rcreate_object() */ @@ -192,37 +191,37 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, /* Check args */ if (ref_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); if ((space_id == H5I_INVALID_HID) || (space_id == H5S_ALL) || (space_id == H5S_BLOCK)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid"); if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (oapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get object access property list */ if (H5P_DEFAULT == oapl_id) oapl_id = H5P_LINK_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get object type */ if ((obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get the file for the object */ if ((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Retrieve VOL file object */ if (NULL == (vol_obj_file = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO; @@ -230,7 +229,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, /* Get container info */ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -245,21 +244,21 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, /* Get the object token */ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token"); /* Create the reference (do not pass filename, since file_id is attached) */ - HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE); + memset(ref_ptr, 0, H5R_REF_BUF_SIZE); if (H5R__create_region((const H5O_token_t *)&obj_token, cont_info.token_size, space, (H5R_ref_priv_t *)ref_ptr) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference"); /* Attach loc_id to reference and hold reference to it */ if (H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference"); done: if (file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file"); FUNC_LEAVE_API(ret_value) } /* end H5Rcreate_region() */ @@ -292,35 +291,35 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl /* Check args */ if (ref_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); if (!attr_name || !*attr_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name given"); if (oapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Get object access property list */ if (H5P_DEFAULT == oapl_id) oapl_id = H5P_LINK_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(oapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "oapl_id is not a link access property list ID"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get object type */ if ((obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get the file for the object */ if ((file_id = H5F_get_file_id(vol_obj, obj_type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Retrieve VOL file object */ if (NULL == (vol_obj_file = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO; @@ -328,7 +327,7 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl /* Get container info */ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -343,21 +342,21 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl /* Get the object token */ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token"); /* Create the reference (do not pass filename, since file_id is attached) */ - HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE); + memset(ref_ptr, 0, H5R_REF_BUF_SIZE); if (H5R__create_attr((const H5O_token_t *)&obj_token, cont_info.token_size, attr_name, (H5R_ref_priv_t *)ref_ptr) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create attribute reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create attribute reference"); /* Attach loc_id to reference and hold reference to it */ if (H5R__set_loc_id((H5R_ref_priv_t *)ref_ptr, file_id, TRUE, TRUE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference"); done: if (file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file"); FUNC_LEAVE_API(ret_value) } /* end H5Rcreate_attr() */ @@ -381,14 +380,14 @@ H5Rdestroy(H5R_ref_t *ref_ptr) /* Check args */ if (NULL == ref_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid reference pointer"); /* Destroy reference */ if (H5R__destroy((H5R_ref_priv_t *)ref_ptr) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "unable to destroy reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "unable to destroy reference"); /* Memset back to 0 for safety */ - HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE); + memset(ref_ptr, 0, H5R_REF_BUF_SIZE); done: FUNC_LEAVE_API(ret_value) @@ -414,12 +413,12 @@ H5Rget_type(const H5R_ref_t *ref_ptr) /* Check args */ if (NULL == ref_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5R_BADTYPE, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5R_BADTYPE, "invalid reference pointer"); /* Get reference type */ ret_value = H5R__get_type((const H5R_ref_priv_t *)ref_ptr); if ((ret_value <= H5R_BADTYPE) || (ret_value >= H5R_MAXTYPE)) - HGOTO_ERROR(H5E_REFERENCE, H5E_BADVALUE, H5R_BADTYPE, "invalid reference type") + HGOTO_ERROR(H5E_REFERENCE, H5E_BADVALUE, H5R_BADTYPE, "invalid reference type"); done: FUNC_LEAVE_API(ret_value) @@ -444,11 +443,11 @@ H5Requal(const H5R_ref_t *ref1_ptr, const H5R_ref_t *ref2_ptr) /* Check args */ if (!ref1_ptr || !ref2_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer"); /* Compare references */ if ((ret_value = H5R__equal((const H5R_ref_priv_t *)ref2_ptr, (const H5R_ref_priv_t *)ref2_ptr)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "cannot compare references") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "cannot compare references"); done: FUNC_LEAVE_API(ret_value) @@ -473,11 +472,11 @@ H5Rcopy(const H5R_ref_t *src_ref_ptr, H5R_ref_t *dst_ref_ptr) /* Check args */ if (NULL == src_ref_ptr || NULL == dst_ref_ptr) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid reference pointer"); /* Copy reference */ if (H5R__copy((const H5R_ref_priv_t *)src_ref_ptr, (H5R_ref_priv_t *)dst_ref_ptr) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "cannot copy reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "cannot copy reference"); done: FUNC_LEAVE_API(ret_value) @@ -510,42 +509,42 @@ H5R__open_object_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, vo /* Check args */ if (ref_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer"); if (H5R__get_type((const H5R_ref_priv_t *)ref_ptr) <= H5R_BADTYPE || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type"); if (rapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); if (oapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); /* Retrieve loc_id from reference */ if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) { /* Attempt to re-open file and pass rapl_id as a fapl_id */ if ((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "cannot re-open referenced file") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "cannot re-open referenced file"); } /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&oapl_id, H5P_CLS_DACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* Get object token */ if (H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get object token"); /* Set up arguments for object access by token */ if (H5VL_setup_token_args(loc_id, &obj_token, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Open object by token */ if (NULL == (opened_obj = H5VL_object_open(*vol_obj_ptr, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token"); /* Register object */ if ((ret_value = H5VL_register(opened_type, opened_obj, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -571,7 +570,7 @@ H5Ropen_object(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) /* Open the dataset synchronously */ if ((ret_value = H5R__open_object_api_common(ref_ptr, rapl_id, oapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object synchronously") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object synchronously"); done: FUNC_LEAVE_API(ret_value) @@ -604,7 +603,7 @@ H5Ropen_object_async(const char *app_file, const char *app_func, unsigned app_li /* Open the object asynchronously */ if ((ret_value = H5R__open_object_api_common(ref_ptr, rapl_id, oapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object asynchronously") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object asynchronously"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -613,8 +612,9 @@ H5Ropen_object_async(const char *app_file, const char *app_func, unsigned app_li H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID") - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, + "can't decrement count on object ID"); + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -652,42 +652,42 @@ H5R__open_region_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, vo /* Check args */ if (ref_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer"); if ((H5R__get_type((const H5R_ref_priv_t *)ref_ptr) != H5R_DATASET_REGION1) && (H5R__get_type((const H5R_ref_priv_t *)ref_ptr) != H5R_DATASET_REGION2)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type"); if (rapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); if (oapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); /* Retrieve loc_id from reference */ if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) { /* Attempt to re-open file and pass rapl_id as a fapl_id */ if ((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "cannot re-open referenced file") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "cannot re-open referenced file"); } /* Get object token */ if (H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get object token"); /* Set up arguments for object access by token */ if (H5VL_setup_token_args(loc_id, &obj_token, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Open object by token */ if (NULL == (opened_obj = H5VL_object_open(*vol_obj_ptr, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token"); /* Register object */ if ((opened_obj_id = H5VL_register(opened_type, opened_obj, (*vol_obj_ptr)->connector, FALSE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); /* Get VOL object object */ if (NULL == (opened_obj = H5VL_vol_object(opened_obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_GET_SPACE; @@ -695,24 +695,24 @@ H5R__open_region_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, vo /* Get dataspace from object */ if (H5VL_dataset_get(opened_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace from dataset") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace from dataset"); space_id = vol_cb_args.args.get_space.space_id; if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace"); /* Get the dataspace with the correct region selected */ if (H5R__get_region((const H5R_ref_priv_t *)ref_ptr, space) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get selection on dataspace") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get selection on dataspace"); /* Simply return space_id */ ret_value = space_id; done: if ((opened_obj_id != H5I_INVALID_HID) && (H5I_dec_ref(opened_obj_id) < 0)) - HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close object") + HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close object"); if (H5I_INVALID_HID == ret_value) /* Cleanup on failure */ if ((space_id != H5I_INVALID_HID) && (H5I_dec_ref(space_id) < 0)) - HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close dataspace") + HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__open_region_api_common() */ @@ -738,7 +738,7 @@ H5Ropen_region(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id) /* Open the region synchronously */ if ((ret_value = H5R__open_region_api_common(ref_ptr, rapl_id, oapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open region synchronously") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open region synchronously"); done: FUNC_LEAVE_API(ret_value) @@ -771,7 +771,7 @@ H5Ropen_region_async(const char *app_file, const char *app_func, unsigned app_li /* Open the region asynchronously */ if ((ret_value = H5R__open_region_api_common(ref_ptr, rapl_id, oapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open region asynchronously") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open region asynchronously"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -780,8 +780,9 @@ H5Ropen_region_async(const char *app_file, const char *app_func, unsigned app_li H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on region ID") - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, + "can't decrement count on region ID"); + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -817,28 +818,28 @@ H5R__open_attr_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id, void /* Check args */ if (ref_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer"); if (H5R__get_type((const H5R_ref_priv_t *)ref_ptr) != H5R_ATTR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type"); if (rapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); if (aapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); /* Retrieve loc_id from reference */ if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) { /* Attempt to re-open file and pass rapl_id as a fapl_id */ if ((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "cannot re-open referenced file") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "cannot re-open referenced file"); } /* Get object token */ if (H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get object token"); /* Get the VOL object */ if (NULL == (*vol_obj_ptr = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; @@ -848,15 +849,15 @@ H5R__open_attr_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id, void /* Open object by token */ if (NULL == (opened_obj = H5VL_object_open(*vol_obj_ptr, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token"); /* Register object */ if ((opened_obj_id = H5VL_register(opened_type, opened_obj, (*vol_obj_ptr)->connector, FALSE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&aapl_id, H5P_CLS_AACC, loc_id, FALSE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -864,25 +865,25 @@ H5R__open_attr_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id, void /* Get VOL object object */ if (NULL == (opened_obj = H5VL_vol_object(opened_obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Open the attribute */ if (NULL == (opened_attr = H5VL_attr_open(opened_obj, &loc_params, H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr), aapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open attribute: '%s'", - H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr)) + H5R_REF_ATTRNAME((const H5R_ref_priv_t *)ref_ptr)); /* Register the attribute and get an ID for it */ if ((ret_value = H5VL_register(H5I_ATTR, opened_attr, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register attribute handle"); done: if ((opened_obj_id != H5I_INVALID_HID) && (H5I_dec_ref(opened_obj_id) < 0)) - HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close object") + HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close object"); if (H5I_INVALID_HID == ret_value) /* Cleanup on failure */ if (opened_attr && H5VL_attr_close(*vol_obj_ptr, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute") + HDONE_ERROR(H5E_REFERENCE, H5E_CLOSEERROR, H5I_INVALID_HID, "can't close attribute"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__open_attr_api_common() */ @@ -907,7 +908,7 @@ H5Ropen_attr(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t aapl_id) /* Open the attribute synchronously */ if ((ret_value = H5R__open_attr_api_common(ref_ptr, rapl_id, aapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_OPENERROR, H5I_INVALID_HID, "unable to open attribute synchronously") + HGOTO_ERROR(H5E_REFERENCE, H5E_OPENERROR, H5I_INVALID_HID, "unable to open attribute synchronously"); done: FUNC_LEAVE_API(ret_value) @@ -940,7 +941,7 @@ H5Ropen_attr_async(const char *app_file, const char *app_func, unsigned app_line /* Open the attribute asynchronously */ if ((ret_value = H5R__open_attr_api_common(ref_ptr, rapl_id, aapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_OPENERROR, H5I_INVALID_HID, "unable to open attribute asynchronously") + HGOTO_ERROR(H5E_REFERENCE, H5E_OPENERROR, H5I_INVALID_HID, "unable to open attribute asynchronously"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -950,8 +951,8 @@ H5Ropen_attr_async(const char *app_file, const char *app_func, unsigned app_line /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, - "can't decrement count on attribute ID") - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + "can't decrement count on attribute ID"); + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -983,26 +984,26 @@ H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type /*out*/ /* Check args */ if (ref_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer"); if (H5R__get_type((const H5R_ref_priv_t *)ref_ptr) <= H5R_BADTYPE || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type"); if (rapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Retrieve loc_id from reference */ if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) /* Attempt to re-open file and pass rapl_id as a fapl_id */ if ((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, FAIL, "cannot re-open referenced file") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, FAIL, "cannot re-open referenced file"); /* Get object token */ if (H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get object token"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; @@ -1015,7 +1016,7 @@ H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type /*out*/ /* Retrieve object's type */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type"); done: FUNC_LEAVE_API(ret_value) @@ -1042,17 +1043,17 @@ H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf /*out*/, size_t size) /* Check args */ if (ref_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer"); if (H5R__get_type((const H5R_ref_priv_t *)ref_ptr) <= H5R_BADTYPE || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type"); /* Get name */ if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) { /* Un-opened external references do not have loc_id set but hold a * copy of the filename */ if ((ret_value = H5R__get_file_name((const H5R_ref_priv_t *)ref_ptr, buf, size)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to retrieve file name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to retrieve file name"); } else { H5VL_object_t *vol_obj; /* Object of loc_id */ @@ -1061,7 +1062,7 @@ H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf /*out*/, size_t size) /* Retrieve VOL file object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_GET_NAME; @@ -1072,7 +1073,7 @@ H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf /*out*/, size_t size) /* Get file name */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to get file name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to get file name"); /* Set return value */ ret_value = (ssize_t)file_name_len; @@ -1108,26 +1109,26 @@ H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf /*out*/, size_t siz /* Check args */ if (ref_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer"); if (H5R__get_type((const H5R_ref_priv_t *)ref_ptr) <= H5R_BADTYPE || H5R__get_type((const H5R_ref_priv_t *)ref_ptr) >= H5R_MAXTYPE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type"); if (rapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a property list"); /* Retrieve loc_id from reference */ if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) /* Attempt to re-open file and pass rapl_id as a fapl_id */ if ((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, (-1), "cannot re-open referenced file") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, (-1), "cannot re-open referenced file"); /* Get object token */ if (H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to get object token"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; @@ -1142,7 +1143,7 @@ H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf /*out*/, size_t siz /* Retrieve object's name */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name"); /* Set return value */ ret_value = (ssize_t)obj_name_len; @@ -1170,13 +1171,13 @@ H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *buf /*out*/, size_t size) /* Check args */ if (ref_ptr == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer"); if (H5R__get_type((const H5R_ref_priv_t *)ref_ptr) != H5R_ATTR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type"); /* Get attribute name */ if ((ret_value = H5R__get_attr_name((const H5R_ref_priv_t *)ref_ptr, buf, size)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine attribute name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine attribute name"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5RS.c b/externals/coda-oss/modules/drivers/hdf5/source/H5RS.c index 7f1bbd6e1e..0bf40b1d94 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5RS.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5RS.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -111,7 +110,7 @@ H5RS__xstrdup(H5RS_str_t *rs, const char *s) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(rs); + assert(rs); if (s) { size_t len = HDstrlen(s); @@ -123,9 +122,9 @@ H5RS__xstrdup(H5RS_str_t *rs, const char *s) /* Allocate the underlying string */ if (NULL == (rs->s = (char *)H5FL_BLK_MALLOC(str_buf, rs->max))) - HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, FAIL, "memory allocation failed"); if (len) - HDmemcpy(rs->s, s, len); + memcpy(rs->s, s, len); rs->end = rs->s + len; *rs->end = '\0'; rs->len = len; @@ -139,9 +138,9 @@ H5RS__xstrdup(H5RS_str_t *rs, const char *s) } /* end if */ else { /* Sanity checks */ - HDassert(NULL == rs->end); - HDassert(0 == rs->max); - HDassert(0 == rs->len); + assert(NULL == rs->end); + assert(0 == rs->max); + assert(0 == rs->len); } /* end else */ } /* end else */ @@ -175,12 +174,12 @@ H5RS__prepare_for_append(H5RS_str_t *rs) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(rs); + assert(rs); if (NULL == rs->s) { rs->max = H5RS_ALLOC_SIZE; if (NULL == (rs->s = (char *)H5FL_BLK_MALLOC(str_buf, rs->max))) - HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, FAIL, "memory allocation failed"); rs->end = rs->s; *rs->s = '\0'; rs->len = 0; @@ -191,7 +190,7 @@ H5RS__prepare_for_append(H5RS_str_t *rs) */ if (rs->wrapped) { if (H5RS__xstrdup(rs, rs->s) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTCOPY, FAIL, "can't copy string") + HGOTO_ERROR(H5E_RS, H5E_CANTCOPY, FAIL, "can't copy string"); rs->wrapped = FALSE; } /* end if */ } /* end else */ @@ -227,7 +226,7 @@ H5RS__resize_for_append(H5RS_str_t *rs, size_t len) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(rs); + assert(rs); /* Check if buffer should be re-allocated */ if (len >= (rs->max - rs->len)) { @@ -235,7 +234,7 @@ H5RS__resize_for_append(H5RS_str_t *rs, size_t len) while (len >= (rs->max - rs->len)) rs->max *= 2; if (NULL == (rs->s = (char *)H5FL_BLK_REALLOC(str_buf, rs->s, rs->max))) - HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, FAIL, "memory allocation failed"); rs->end = rs->s + rs->len; } /* end if */ @@ -271,12 +270,12 @@ H5RS_create(const char *s) /* Allocate ref-counted string structure */ if (NULL == (ret_value = H5FL_CALLOC(H5RS_str_t))) - HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Set the internal fields */ if (s) if (H5RS__xstrdup(ret_value, s) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTCOPY, NULL, "can't copy string") + HGOTO_ERROR(H5E_RS, H5E_CANTCOPY, NULL, "can't copy string"); ret_value->n = 1; done: @@ -311,7 +310,7 @@ H5RS_wrap(const char *s) /* Allocate ref-counted string structure */ if (NULL == (ret_value = H5FL_MALLOC(H5RS_str_t))) - HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, NULL, "memory allocation failed"); /* Set the internal fields * @@ -343,9 +342,6 @@ H5RS_wrap(const char *s) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, September 18, 2020 - * *------------------------------------------------------------------------- */ /* Disable warning for "format not a string literal" here -QAK */ @@ -366,24 +362,24 @@ H5RS_asprintf_cat(H5RS_str_t *rs, const char *fmt, ...) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(rs); - HDassert(fmt); + assert(rs); + assert(fmt); /* Prepare the [possibly wrapped or empty] ref-counted string for an append */ if (H5RS__prepare_for_append(rs) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTINIT, FAIL, "can't initialize ref-counted string") + HGOTO_ERROR(H5E_RS, H5E_CANTINIT, FAIL, "can't initialize ref-counted string"); /* Attempt to write formatted output into the managed string */ - HDva_start(args1, fmt); - HDva_copy(args2, args1); + va_start(args1, fmt); + va_copy(args2, args1); while ((out_len = (size_t)HDvsnprintf(rs->end, (rs->max - rs->len), fmt, args1)) >= (rs->max - rs->len)) { /* Allocate a large enough buffer */ if (H5RS__resize_for_append(rs, out_len) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTRESIZE, FAIL, "can't resize ref-counted string buffer") + HGOTO_ERROR(H5E_RS, H5E_CANTRESIZE, FAIL, "can't resize ref-counted string buffer"); /* Restart the va_list */ - HDva_end(args1); - HDva_copy(args1, args2); + va_end(args1); + va_copy(args1, args2); } /* end while */ /* Increment the size & end of the string */ @@ -391,8 +387,8 @@ H5RS_asprintf_cat(H5RS_str_t *rs, const char *fmt, ...) rs->end += out_len; /* Finish access to varargs */ - HDva_end(args1); - HDva_end(args2); + va_end(args1); + va_end(args2); done: FUNC_LEAVE_NOAPI(ret_value) @@ -407,9 +403,6 @@ H5_GCC_CLANG_DIAG_ON("format-nonliteral") * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, September 18, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -420,8 +413,8 @@ H5RS_acat(H5RS_str_t *rs, const char *s) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(rs); - HDassert(s); + assert(rs); + assert(s); /* Concatenate the provided string on to the managed string */ if (*s) { @@ -429,15 +422,15 @@ H5RS_acat(H5RS_str_t *rs, const char *s) /* Allocate the underlying string, if necessary */ if (H5RS__prepare_for_append(rs) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTINIT, FAIL, "can't initialize ref-counted string") + HGOTO_ERROR(H5E_RS, H5E_CANTINIT, FAIL, "can't initialize ref-counted string"); /* Increase the managed string's buffer size if necessary */ if ((rs->len + len) >= rs->max) if (H5RS__resize_for_append(rs, len) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTRESIZE, FAIL, "can't resize ref-counted string buffer") + HGOTO_ERROR(H5E_RS, H5E_CANTRESIZE, FAIL, "can't resize ref-counted string buffer"); /* Append the string */ - HDmemcpy(rs->end, s, len); + memcpy(rs->end, s, len); rs->end += len; *rs->end = '\0'; rs->len += len; @@ -456,9 +449,6 @@ H5RS_acat(H5RS_str_t *rs, const char *s) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, September 18, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -469,8 +459,8 @@ H5RS_ancat(H5RS_str_t *rs, const char *s, size_t n) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(rs); - HDassert(s); + assert(rs); + assert(s); /* Concatenate the provided string on to the managed string */ if (n && *s) { @@ -481,15 +471,15 @@ H5RS_ancat(H5RS_str_t *rs, const char *s, size_t n) /* Allocate the underlying string, if necessary */ if (H5RS__prepare_for_append(rs) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTINIT, FAIL, "can't initialize ref-counted string") + HGOTO_ERROR(H5E_RS, H5E_CANTINIT, FAIL, "can't initialize ref-counted string"); /* Increase the managed string's buffer size if necessary */ if ((rs->len + n) >= rs->max) if (H5RS__resize_for_append(rs, n) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTRESIZE, FAIL, "can't resize ref-counted string buffer") + HGOTO_ERROR(H5E_RS, H5E_CANTRESIZE, FAIL, "can't resize ref-counted string buffer"); /* Append the string */ - HDmemcpy(rs->end, s, n); + memcpy(rs->end, s, n); rs->end += n; *rs->end = '\0'; rs->len += n; @@ -507,9 +497,6 @@ H5RS_ancat(H5RS_str_t *rs, const char *s, size_t n) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, September 18, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -520,17 +507,17 @@ H5RS_aputc(H5RS_str_t *rs, int c) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(rs); - HDassert(c); + assert(rs); + assert(c); /* Allocate the underlying string, if necessary */ if (H5RS__prepare_for_append(rs) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTINIT, FAIL, "can't initialize ref-counted string") + HGOTO_ERROR(H5E_RS, H5E_CANTINIT, FAIL, "can't initialize ref-counted string"); /* Increase the managed string's buffer size if necessary */ if ((rs->len + 1) >= rs->max) if (H5RS__resize_for_append(rs, 1) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTRESIZE, FAIL, "can't resize ref-counted string buffer") + HGOTO_ERROR(H5E_RS, H5E_CANTRESIZE, FAIL, "can't resize ref-counted string buffer"); /* Append the current character */ *rs->end++ = (char)c; @@ -566,8 +553,8 @@ H5RS_decr(H5RS_str_t *rs) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(rs); - HDassert(rs->n > 0); + assert(rs); + assert(rs->n > 0); /* Decrement reference count for string */ if ((--rs->n) == 0) { @@ -605,8 +592,8 @@ H5RS_incr(H5RS_str_t *rs) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(rs); - HDassert(rs->n > 0); + assert(rs); + assert(rs->n > 0); /* If the ref-counted string started life as a wrapper around an existing * string, duplicate the string now, so that the wrapped string can go out @@ -614,7 +601,7 @@ H5RS_incr(H5RS_str_t *rs) */ if (rs->wrapped) { if (H5RS__xstrdup(rs, rs->s) < 0) - HGOTO_ERROR(H5E_RS, H5E_CANTCOPY, FAIL, "can't copy string") + HGOTO_ERROR(H5E_RS, H5E_CANTCOPY, FAIL, "can't copy string"); rs->wrapped = FALSE; } /* end if */ @@ -685,10 +672,10 @@ H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(rs1); - HDassert(rs1->s); - HDassert(rs2); - HDassert(rs2->s); + assert(rs1); + assert(rs1->s); + assert(rs2); + assert(rs2->s); FUNC_LEAVE_NOAPI(HDstrcmp(rs1->s, rs2->s)) } /* end H5RS_cmp() */ @@ -717,8 +704,8 @@ H5RS_len(const H5RS_str_t *rs) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(rs); - HDassert(rs->s); + assert(rs); + assert(rs->s); FUNC_LEAVE_NOAPI(HDstrlen(rs->s)) } /* end H5RS_len() */ @@ -750,8 +737,8 @@ H5RS_get_str(const H5RS_str_t *rs) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(rs); - HDassert(rs->s); + assert(rs); + assert(rs->s); FUNC_LEAVE_NOAPI(rs->s) } /* end H5RS_get_str() */ @@ -781,8 +768,8 @@ H5RS_get_count(const H5RS_str_t *rs) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(rs); - HDassert(rs->n > 0); + assert(rs); + assert(rs->n > 0); FUNC_LEAVE_NOAPI(rs->n) } /* end H5RS_get_count() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Rdeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Rdeprec.c index 1fddad9224..e3ea6063ef 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Rdeprec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Rdeprec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -42,6 +41,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ #include "H5Rpkg.h" /* References */ #include "H5Sprivate.h" /* Dataspaces */ @@ -105,20 +105,20 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref /* Check if using native VOL connector */ if (H5VL_object_is_native(vol_obj, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Get the file for the object */ if ((file_id = H5F_get_file_id(vol_obj, type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Retrieve VOL object */ if (NULL == (vol_obj_file = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO; @@ -126,14 +126,14 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref /* Get container info */ if (H5VL_file_get(vol_obj_file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info"); if (ref_type == H5R_OBJECT1) { size_t buf_size = H5R_OBJ_REF_BUF_SIZE; /* Get object address */ if (H5R__decode_token_obj_compat(buf, &buf_size, obj_token, cont_info.token_size) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token"); } /* end if */ else { size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; @@ -141,16 +141,16 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref /* Retrieve file from VOL object */ if (NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object"); /* Get object address */ if (H5R__decode_token_region_compat(f, buf, &buf_size, obj_token, cont_info.token_size, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address"); } /* end else */ done: if (file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__decode_token_compat() */ @@ -174,15 +174,15 @@ H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t t FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(obj_token); - HDassert(token_size); - HDassert(space); - HDassert(nalloc); + assert(f); + assert(obj_token); + assert(token_size); + assert(space); + assert(nalloc); /* Get required buffer size */ if (H5R__encode_heap(f, NULL, &buf_size, NULL, (size_t)0) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); if (buf && *nalloc >= buf_size) { ssize_t data_size; @@ -195,12 +195,12 @@ H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t t /* Zero the heap ID out, may leak heap space if user is re-using * reference and doesn't have garbage collection turned on */ - HDmemset(buf, 0, buf_size); + memset(buf, 0, buf_size); /* Get the amount of space required to serialize the selection */ if ((data_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, - "Invalid amount of space for serializing selection") + "Invalid amount of space for serializing selection"); /* Increase buffer size to allow for the dataset token */ data_size += (hssize_t)token_size; @@ -208,7 +208,7 @@ H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t t /* Allocate the space to store the serialized information */ H5_CHECK_OVERFLOW(data_size, hssize_t, size_t); if (NULL == (data = (uint8_t *)H5MM_malloc((size_t)data_size))) - HGOTO_ERROR(H5E_REFERENCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_REFERENCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Serialize information for dataset OID into heap buffer */ p = (uint8_t *)data; @@ -217,11 +217,11 @@ H5R__encode_token_region_compat(H5F_t *f, const H5O_token_t *obj_token, size_t t /* Serialize the selection into heap buffer */ if (H5S_SELECT_SERIALIZE(space, &p) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Unable to serialize selection"); /* Write to heap */ if (H5R__encode_heap(f, buf, nalloc, data, (size_t)data_size) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); } *nalloc = buf_size; @@ -258,21 +258,21 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) /* Check args */ if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer"); if (ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference type"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier"); /* Get object type */ if ((vol_obj_type = H5I_get_type(id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier"); /* Get object token */ if (H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5G_UNKNOWN, "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5G_UNKNOWN, "unable to get object token"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; @@ -285,7 +285,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) /* Retrieve object's type */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "can't retrieve object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "can't retrieve object type"); /* Set return value */ ret_value = H5G_map_obj_type(obj_type); @@ -322,21 +322,21 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref) /* Check args */ if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer"); if (ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Get object type */ if ((vol_obj_type = H5I_get_type(obj_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Get object token */ if (H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; @@ -346,11 +346,11 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *ref) /* Dereference */ if (NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token"); /* Register object */ if ((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); done: FUNC_LEAVE_API(ret_value) @@ -390,19 +390,19 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t /* Check args */ if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given"); if (ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); #ifndef NDEBUG { @@ -410,16 +410,16 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t /* Check if using native VOL connector */ if (H5VL_object_is_native(vol_obj, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Get object type */ if ((vol_obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_NAME; @@ -434,15 +434,15 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t /* Get the object token */ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token"); /* Get the file for the object */ if ((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Retrieve VOL object */ if (NULL == (vol_obj_file = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up VOL callback arguments */ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO; @@ -450,7 +450,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t /* Get container info */ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info"); /* Create reference */ if (ref_type == H5R_OBJECT1) { @@ -458,7 +458,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t if ((ret_value = H5R__encode_token_obj_compat((const H5O_token_t *)&obj_token, cont_info.token_size, buf, &buf_size)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to encode object reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to encode object reference"); } /* end if */ else { H5F_t *f = NULL; @@ -467,23 +467,23 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t /* Retrieve space */ if (space_id == H5I_INVALID_HID) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid"); if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Retrieve file from VOL object */ if (NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object"); /* Encode dataset region */ if ((ret_value = H5R__encode_token_region_compat(f, (const H5O_token_t *)&obj_token, cont_info.token_size, space, buf, &buf_size)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to encode region reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to encode region reference"); } /* end else */ done: if (file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on file"); FUNC_LEAVE_API(ret_value) } /* end H5Rcreate() */ @@ -513,21 +513,21 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj /* Check args */ if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer"); if (ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get object type */ if ((vol_obj_type = H5I_get_type(id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get object token */ if (H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object token"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; @@ -540,7 +540,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj /* Retrieve object's type */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type"); done: FUNC_LEAVE_API(ret_value) @@ -574,27 +574,27 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *re /* Check args */ if (oapl_id < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a property list"); if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer"); if (ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&oapl_id, H5P_CLS_DACC, obj_id, FALSE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier"); /* Get object type */ if ((vol_obj_type = H5I_get_type(obj_id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Get object token */ if (H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, H5I_INVALID_HID, "unable to get object token"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; @@ -604,11 +604,11 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *re /* Open object by token */ if (NULL == (opened_obj = H5VL_object_open(vol_obj, &loc_params, &opened_type, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object by token"); /* Register object */ if ((ret_value = H5VL_register(opened_type, opened_obj, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); done: FUNC_LEAVE_API(ret_value) @@ -646,13 +646,13 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) /* Check args */ if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference pointer"); if (ref_type != H5R_DATASET_REGION1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid reference type"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier"); #ifndef NDEBUG { @@ -661,24 +661,24 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) /* Check if using native VOL connector */ if (H5VL_object_is_native(vol_obj, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, - "can't query if file uses native VOL connector") + "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Get object type */ if ((vol_obj_type = H5I_get_type(id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Get the file for the object */ if ((file_id = H5F_get_file_id(vol_obj, vol_obj_type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file or file object"); /* Retrieve VOL object */ if (NULL == (vol_obj_file = H5VL_vol_object(file_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO; @@ -686,23 +686,23 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) /* Get container info */ if (H5VL_file_get(vol_obj_file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get container info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get container info"); /* Retrieve file from VOL object */ if (NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid VOL object"); /* Get the dataspace with the correct region selected */ if (H5R__decode_token_region_compat(f, buf, &buf_size, NULL, cont_info.token_size, &space) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace"); /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID"); done: if (file_id != H5I_INVALID_HID && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on file") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "unable to decrement refcount on file"); FUNC_LEAVE_API(ret_value) } /* end H5Rget_region1() */ @@ -734,21 +734,21 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name /*out*/, /* Check args */ if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer"); if (ref_type != H5R_OBJECT1 && ref_type != H5R_DATASET_REGION1) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type"); /* Get the VOL object */ if (NULL == (vol_obj = H5VL_vol_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier"); /* Get object type */ if ((vol_obj_type = H5I_get_type(id)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier"); /* Get object token */ if (H5R__decode_token_compat(vol_obj, vol_obj_type, ref_type, buf, &obj_token) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, (-1), "unable to get object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, (-1), "unable to get object token"); /* Set location parameters */ loc_params.type = H5VL_OBJECT_BY_TOKEN; @@ -763,7 +763,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name /*out*/, /* Retrieve object's name */ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name"); /* Set return value */ ret_value = (ssize_t)obj_name_len; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Rint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Rint.c index 0fb607ad41..1e4b57e482 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Rint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Rint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -47,7 +46,7 @@ do { \ size_t __nalloc = buf_size; \ if (func(val, buf, &__nalloc) < 0) \ - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, m) \ + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, m); \ if (buf && buf_size >= __nalloc) { \ buf += __nalloc; \ buf_size -= __nalloc; \ @@ -59,7 +58,7 @@ do { \ size_t __nalloc = buf_size; \ if (func(var, size, buf, &__nalloc) < 0) \ - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, m) \ + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, m); \ if (buf && buf_size >= __nalloc) { \ p += __nalloc; \ buf_size -= __nalloc; \ @@ -72,7 +71,7 @@ do { \ size_t __nbytes = buf_size; \ if (func(buf, &__nbytes, val) < 0) \ - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, m) \ + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, m); \ buf += __nbytes; \ buf_size -= __nbytes; \ actual += __nbytes; \ @@ -82,7 +81,7 @@ do { \ size_t __nbytes = buf_size; \ if (func(buf, &__nbytes, var, size) < 0) \ - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, m) \ + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, m); \ p += __nbytes; \ buf_size -= __nbytes; \ actual += __nbytes; \ @@ -92,10 +91,10 @@ #ifdef H5R_DEBUG #define H5R_LOG_DEBUG(...) \ do { \ - HDfprintf(stdout, " # %s(): ", __func__); \ - HDfprintf(stdout, __VA_ARGS__); \ - HDfprintf(stdout, "\n"); \ - HDfflush(stdout); \ + fprintf(stdout, " # %s(): ", __func__); \ + fprintf(stdout, __VA_ARGS__); \ + fprintf(stdout, "\n"); \ + fflush(stdout); \ } while (0) static const char * H5R__print_token(const H5O_token_t token) @@ -188,18 +187,18 @@ H5R__create_object(const H5O_token_t *obj_token, size_t token_size, H5R_ref_priv FUNC_ENTER_PACKAGE - HDassert(ref); + assert(ref); /* Create new reference */ ref->info.obj.filename = NULL; ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_OBJECT2; if (H5R__set_obj_token(ref, obj_token, token_size) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token"); /* Cache encoding size (assume no external reference) */ if (H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to determine encoding size") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to determine encoding size"); ref->encode_size = (uint32_t)encode_size; H5R_LOG_DEBUG("Created object reference, %d, filename=%s, obj_addr=%s, encode size=%u", @@ -227,22 +226,22 @@ H5R__create_region(const H5O_token_t *obj_token, size_t token_size, H5S_t *space FUNC_ENTER_PACKAGE - HDassert(space); - HDassert(ref); + assert(space); + assert(ref); /* Create new reference */ ref->info.obj.filename = NULL; if (NULL == (ref->info.reg.space = H5S_copy(space, FALSE, TRUE))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace"); ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_DATASET_REGION2; if (H5R__set_obj_token(ref, obj_token, token_size) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token"); /* Cache encoding size (assume no external reference) */ if (H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to determine encoding size") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to determine encoding size"); ref->encode_size = (uint32_t)encode_size; H5R_LOG_DEBUG("Created region reference, %d, filename=%s, obj_addr=%s, encode size=%u", @@ -276,27 +275,27 @@ H5R__create_attr(const H5O_token_t *obj_token, size_t token_size, const char *at FUNC_ENTER_PACKAGE - HDassert(attr_name); - HDassert(ref); + assert(attr_name); + assert(ref); /* Make sure that attribute name is not longer than supported encode size */ if (HDstrlen(attr_name) > H5R_MAX_STRING_LEN) HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "attribute name too long (%d > %d)", - (int)HDstrlen(attr_name), H5R_MAX_STRING_LEN) + (int)HDstrlen(attr_name), H5R_MAX_STRING_LEN); /* Create new reference */ ref->info.obj.filename = NULL; if (NULL == (ref->info.attr.name = HDstrdup(attr_name))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name"); ref->loc_id = H5I_INVALID_HID; ref->type = (uint8_t)H5R_ATTR; if (H5R__set_obj_token(ref, obj_token, token_size) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to set object token"); /* Cache encoding size (assume no external reference) */ if (H5R__encode(NULL, ref, NULL, &encode_size, 0) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to determine encoding size") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "unable to determine encoding size"); ref->encode_size = (uint32_t)encode_size; H5R_LOG_DEBUG("Created attribute reference, %d, filename=%s, obj_addr=%s, attr name=%s, encode size=%u", @@ -328,7 +327,7 @@ H5R__destroy(H5R_ref_priv_t *ref) FUNC_ENTER_PACKAGE - HDassert(ref != NULL); + assert(ref != NULL); H5R_LOG_DEBUG("Destroying reference, filename=%s, obj_addr=%s, encode size=%u", ref->info.obj.filename, H5R__print_token(ref->info.obj.token), ref->encode_size); @@ -342,7 +341,7 @@ H5R__destroy(H5R_ref_priv_t *ref) case H5R_DATASET_REGION2: if (H5S_close(ref->info.reg.space) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace"); ref->info.reg.space = NULL; break; @@ -356,23 +355,23 @@ H5R__destroy(H5R_ref_priv_t *ref) break; case H5R_BADTYPE: case H5R_MAXTYPE: - HDassert("invalid reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)") + assert("invalid reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)"); default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + assert("unknown reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)"); } /* end switch */ /* Decrement refcount of attached loc_id */ if (ref->type && (ref->loc_id != H5I_INVALID_HID)) { if (ref->app_ref) { if (H5I_dec_app_ref(ref->loc_id) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed"); } else { if (H5I_dec_ref(ref->loc_id) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed"); } } @@ -396,19 +395,19 @@ H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref, hbool_t app_ref) FUNC_ENTER_PACKAGE - HDassert(ref != NULL); - HDassert(id != H5I_INVALID_HID); + assert(ref != NULL); + assert(id != H5I_INVALID_HID); /* If a location ID was previously assigned, decrement refcount and * assign new one */ if ((ref->loc_id != H5I_INVALID_HID)) { if (ref->app_ref) { if (H5I_dec_app_ref(ref->loc_id) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed"); } else { if (H5I_dec_ref(ref->loc_id) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "decrementing location ID failed"); } } ref->loc_id = id; @@ -418,7 +417,7 @@ H5R__set_loc_id(H5R_ref_priv_t *ref, hid_t id, hbool_t inc_ref, hbool_t app_ref) * expected to be destroyed, this allows the loc_id to be cleanly released * on shutdown if users fail to call H5Rdestroy(). */ if (inc_ref && H5I_inc_ref(ref->loc_id, app_ref) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINC, FAIL, "incrementing location ID failed") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINC, FAIL, "incrementing location ID failed"); ref->app_ref = app_ref; done: @@ -441,7 +440,7 @@ H5R__get_loc_id(const H5R_ref_priv_t *ref) FUNC_ENTER_PACKAGE_NOERR - HDassert(ref != NULL); + assert(ref != NULL); ret_value = ref->loc_id; @@ -473,39 +472,39 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list"); if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info"); /* Stash a copy of the "top-level" connector property, before any pass-through * connectors modify or unwrap it. */ if (H5CX_set_vol_connector_prop(&connector_prop) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, - "can't set VOL connector info in API context") + "can't set VOL connector info in API context"); /* Open the file */ /* (Must open file read-write to allow for object modifications) */ if (NULL == (new_file = H5VL_file_open(&connector_prop, H5R_REF_FILENAME(ref), H5F_ACC_RDWR, fapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file"); /* Get an ID for the file */ if ((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle"); /* Get the file object */ if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier"); /* Make the 'post open' callback */ supported = 0; if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation"); if (supported & H5VL_OPT_QUERY_SUPPORTED) { H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ @@ -516,12 +515,12 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) /* Make the 'post open' callback */ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, - "unable to make file 'post open' callback") + "unable to make file 'post open' callback"); } /* end if */ /* Attach loc_id to reference */ if (H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE, TRUE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "unable to attach location id to reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "unable to attach location id to reference"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -544,7 +543,7 @@ H5R__get_type(const H5R_ref_priv_t *ref) FUNC_ENTER_PACKAGE_NOERR - HDassert(ref != NULL); + assert(ref != NULL); ret_value = (H5R_type_t)ref->type; FUNC_LEAVE_NOAPI(ret_value) @@ -566,8 +565,8 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2) FUNC_ENTER_PACKAGE - HDassert(ref1 != NULL); - HDassert(ref2 != NULL); + assert(ref1 != NULL); + assert(ref2 != NULL); /* Compare reference types */ if (ref1->type != ref2->type) @@ -576,7 +575,7 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2) /* Compare object addresses */ if (ref1->token_size != ref2->token_size) HGOTO_DONE(FALSE); - if (0 != HDmemcmp(&ref1->info.obj.token, &ref2->info.obj.token, ref1->token_size)) + if (0 != memcmp(&ref1->info.obj.token, &ref2->info.obj.token, ref1->token_size)) HGOTO_DONE(FALSE); /* Compare filenames */ @@ -592,10 +591,10 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2) break; case H5R_DATASET_REGION2: if ((ret_value = H5S_extent_equal(ref1->info.reg.space, ref2->info.reg.space)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "cannot compare dataspace extents") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "cannot compare dataspace extents"); break; case H5R_ATTR: - HDassert(ref1->info.attr.name && ref2->info.attr.name); + assert(ref1->info.attr.name && ref2->info.attr.name); if (0 != HDstrcmp(ref1->info.attr.name, ref2->info.attr.name)) HGOTO_DONE(FALSE); break; @@ -603,11 +602,11 @@ H5R__equal(const H5R_ref_priv_t *ref1, const H5R_ref_priv_t *ref2) case H5R_DATASET_REGION1: case H5R_BADTYPE: case H5R_MAXTYPE: - HDassert("invalid reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)") + assert("invalid reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)"); default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + assert("unknown reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)"); } /* end switch */ done: @@ -630,7 +629,7 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) FUNC_ENTER_PACKAGE - HDassert((src_ref != NULL) && (dst_ref != NULL)); + assert((src_ref != NULL) && (dst_ref != NULL)); H5MM_memcpy(&dst_ref->info.obj.token, &src_ref->info.obj.token, sizeof(H5O_token_t)); dst_ref->encode_size = src_ref->encode_size; @@ -642,29 +641,29 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) break; case H5R_DATASET_REGION2: if (NULL == (dst_ref->info.reg.space = H5S_copy(src_ref->info.reg.space, FALSE, TRUE))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy dataspace"); break; case H5R_ATTR: if (NULL == (dst_ref->info.attr.name = HDstrdup(src_ref->info.attr.name))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy attribute name"); break; case H5R_OBJECT1: case H5R_DATASET_REGION1: - HDassert("invalid reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)") + assert("invalid reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)"); case H5R_BADTYPE: case H5R_MAXTYPE: default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + assert("unknown reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)"); } /* end switch */ /* We only need to keep a copy of the filename if we don't have the loc_id */ if (src_ref->loc_id == H5I_INVALID_HID) { - HDassert(src_ref->info.obj.filename); + assert(src_ref->info.obj.filename); if (NULL == (dst_ref->info.obj.filename = HDstrdup(src_ref->info.obj.filename))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy filename") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "Cannot copy filename"); dst_ref->loc_id = H5I_INVALID_HID; } else { @@ -673,7 +672,7 @@ H5R__copy(const H5R_ref_priv_t *src_ref, H5R_ref_priv_t *dst_ref) /* Set location ID and hold reference to it */ dst_ref->loc_id = src_ref->loc_id; if (H5I_inc_ref(dst_ref->loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINC, FAIL, "incrementing location ID failed") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINC, FAIL, "incrementing location ID failed"); dst_ref->app_ref = TRUE; } @@ -697,12 +696,12 @@ H5R__get_obj_token(const H5R_ref_priv_t *ref, H5O_token_t *obj_token, size_t *to FUNC_ENTER_PACKAGE - HDassert(ref != NULL); - HDassert(ref->token_size <= H5O_MAX_TOKEN_SIZE); + assert(ref != NULL); + assert(ref->token_size <= H5O_MAX_TOKEN_SIZE); if (obj_token) { if (0 == ref->token_size) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "NULL token size") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "NULL token size"); H5MM_memcpy(obj_token, &ref->info.obj.token, sizeof(H5O_token_t)); } if (token_size) @@ -728,13 +727,13 @@ H5R__set_obj_token(H5R_ref_priv_t *ref, const H5O_token_t *obj_token, size_t tok FUNC_ENTER_PACKAGE_NOERR - HDassert(ref != NULL); - HDassert(obj_token); - HDassert(token_size); - HDassert(token_size <= H5O_MAX_TOKEN_SIZE); + assert(ref != NULL); + assert(obj_token); + assert(token_size); + assert(token_size <= H5O_MAX_TOKEN_SIZE); H5MM_memcpy(&ref->info.obj.token, obj_token, token_size); - HDassert(token_size <= 255); + assert(token_size <= 255); ref->token_size = (uint8_t)token_size; FUNC_LEAVE_NOAPI(ret_value) @@ -758,13 +757,13 @@ H5R__get_region(const H5R_ref_priv_t *ref, H5S_t *space) FUNC_ENTER_PACKAGE - HDassert(ref != NULL); - HDassert(ref->type == H5R_DATASET_REGION2); - HDassert(space); + assert(ref != NULL); + assert(ref->type == H5R_DATASET_REGION2); + assert(space); /* Copy reference selection to destination */ if (H5S_select_copy(space, ref->info.reg.space, FALSE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy selection") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOPY, FAIL, "unable to copy selection"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -789,15 +788,15 @@ H5R__get_file_name(const H5R_ref_priv_t *ref, char *buf, size_t size) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(ref != NULL); + assert(ref != NULL); /* Return if that reference has no filename set */ if (!ref->info.obj.filename) - HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, (-1), "no filename available for that reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, (-1), "no filename available for that reference"); /* Get the file name length */ copy_len = HDstrlen(ref->info.obj.filename); - HDassert(copy_len <= H5R_MAX_STRING_LEN); + assert(copy_len <= H5R_MAX_STRING_LEN); /* Copy the file name */ if (buf) { @@ -829,12 +828,12 @@ H5R__get_attr_name(const H5R_ref_priv_t *ref, char *buf, size_t size) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(ref != NULL); - HDassert(ref->type == H5R_ATTR); + assert(ref != NULL); + assert(ref->type == H5R_ATTR); /* Get the attribute name length */ attr_name_len = HDstrlen(ref->info.attr.name); - HDassert(attr_name_len <= H5R_MAX_STRING_LEN); + assert(attr_name_len <= H5R_MAX_STRING_LEN); /* Get the attribute name */ if (buf) { @@ -867,8 +866,8 @@ H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, FUNC_ENTER_PACKAGE - HDassert(ref); - HDassert(nalloc); + assert(ref); + assert(nalloc); /** * Encoding format: @@ -930,12 +929,12 @@ H5R__encode(const char *filename, const H5R_ref_priv_t *ref, unsigned char *buf, case H5R_DATASET_REGION1: case H5R_BADTYPE: case H5R_MAXTYPE: - HDassert("invalid reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)") + assert("invalid reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)"); default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + assert("unknown reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)"); } /* end switch */ H5R_LOG_DEBUG("Encoded reference, filename=%s, obj_addr=%s, encode size=%u", ref->info.obj.filename, @@ -967,19 +966,19 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(buf); - HDassert(nbytes); - HDassert(ref); + assert(buf); + assert(nbytes); + assert(ref); /* Don't decode if buffer size isn't big enough */ buf_size = *nbytes; if (buf_size < H5R_ENCODE_HEADER_SIZE) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small"); /* Set new reference */ ref->type = (int8_t)*p++; if (ref->type <= H5R_BADTYPE || ref->type >= H5R_MAXTYPE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type"); /* Set flags */ flags = *p++; @@ -1017,11 +1016,11 @@ H5R__decode(const unsigned char *buf, size_t *nbytes, H5R_ref_priv_t *ref) case H5R_DATASET_REGION1: case H5R_BADTYPE: case H5R_MAXTYPE: - HDassert("invalid reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)") + assert("invalid reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (invalid reference type)"); default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + assert("unknown reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)"); } /* end switch */ /* Set loc ID to invalid */ @@ -1056,7 +1055,7 @@ H5R__encode_obj_token(const H5O_token_t *obj_token, size_t token_size, unsigned FUNC_ENTER_PACKAGE_NOERR - HDassert(nalloc); + assert(nalloc); /* Don't encode if buffer size isn't big enough or buffer is empty */ if (buf && *nalloc >= token_size) { @@ -1090,22 +1089,22 @@ H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj FUNC_ENTER_PACKAGE - HDassert(buf); - HDassert(nbytes); - HDassert(obj_token); - HDassert(token_size); + assert(buf); + assert(nbytes); + assert(obj_token); + assert(token_size); /* Don't decode if buffer size isn't big enough */ if (*nbytes < sizeof(uint8_t)) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small"); /* Get token size */ *token_size = *p++; if (*token_size > sizeof(H5O_token_t)) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Invalid token size (%u)", *token_size) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Invalid token size (%u)", *token_size); /* Make sure that token is initialized */ - HDmemset(obj_token, 0, sizeof(H5O_token_t)); + memset(obj_token, 0, sizeof(H5O_token_t)); /* Decode token */ H5MM_memcpy(obj_token, p, *token_size); @@ -1134,13 +1133,13 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc) FUNC_ENTER_PACKAGE - HDassert(space); - HDassert(nalloc); + assert(space); + assert(nalloc); /* Get the amount of space required to serialize the selection */ if ((buf_size = H5S_SELECT_SERIAL_SIZE(space)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, - "Cannot determine amount of space needed for serializing selection") + "Cannot determine amount of space needed for serializing selection"); /* Don't encode if buffer size isn't big enough or buffer is empty */ if (buf && *nalloc >= ((size_t)buf_size + 2 * sizeof(uint32_t))) { @@ -1152,12 +1151,12 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc) /* Encode the extent rank */ if ((rank = H5S_get_simple_extent_ndims(space)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't get extent rank for selection") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't get extent rank for selection"); UINT32ENCODE(p, (uint32_t)rank); /* Serialize the selection */ if (H5S_SELECT_SERIALIZE(space, (unsigned char **)&p) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "can't serialize selection") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "can't serialize selection"); } /* end if */ *nalloc = (size_t)buf_size + 2 * sizeof(uint32_t); @@ -1178,6 +1177,7 @@ static herr_t H5R__decode_region(const unsigned char *buf, size_t *nbytes, H5S_t **space_ptr) { const uint8_t *p = (const uint8_t *)buf; + const uint8_t *p_end = p + *nbytes - 1; size_t buf_size = 0; unsigned rank; H5S_t *space; @@ -1185,13 +1185,13 @@ H5R__decode_region(const unsigned char *buf, size_t *nbytes, H5S_t **space_ptr) FUNC_ENTER_PACKAGE - HDassert(buf); - HDassert(nbytes); - HDassert(space_ptr); + assert(buf); + assert(nbytes); + assert(space_ptr); /* Don't decode if buffer size isn't big enough */ if (*nbytes < (2 * sizeof(uint32_t))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small"); /* Decode the selection size */ UINT32DECODE(p, buf_size); @@ -1203,15 +1203,19 @@ H5R__decode_region(const unsigned char *buf, size_t *nbytes, H5S_t **space_ptr) /* Don't decode if buffer size isn't big enough */ if (*nbytes < buf_size) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small"); /* Deserialize the selection (dataspaces need the extent rank information) */ if (NULL == (space = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small"); if (H5S_set_extent_simple(space, rank, NULL, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set extent rank for selection") - if (H5S_SELECT_DESERIALIZE(&space, &p) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "can't deserialize selection") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set extent rank for selection"); + + if (p - 1 > p_end) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Ran off end of buffer while decoding"); + + if (H5S_SELECT_DESERIALIZE(&space, &p, (size_t)(p_end - p + 1)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "can't deserialize selection"); *nbytes = buf_size; *space_ptr = space; @@ -1237,13 +1241,13 @@ H5R__encode_string(const char *string, unsigned char *buf, size_t *nalloc) FUNC_ENTER_PACKAGE - HDassert(string); - HDassert(nalloc); + assert(string); + assert(nalloc); /* Get the amount of space required to serialize the string */ string_len = HDstrlen(string); if (string_len > H5R_MAX_STRING_LEN) - HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "string too long") + HGOTO_ERROR(H5E_REFERENCE, H5E_ARGS, FAIL, "string too long"); /* Compute buffer size, allow for the attribute name length and object address */ buf_size = string_len + sizeof(uint16_t); @@ -1280,21 +1284,21 @@ H5R__decode_string(const unsigned char *buf, size_t *nbytes, char **string_ptr) FUNC_ENTER_PACKAGE - HDassert(buf); - HDassert(nbytes); - HDassert(string_ptr); + assert(buf); + assert(nbytes); + assert(string_ptr); /* Don't decode if buffer size isn't big enough */ if (*nbytes < sizeof(uint16_t)) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small"); /* Get the string length */ UINT16DECODE(p, string_len); - HDassert(string_len <= H5R_MAX_STRING_LEN); + assert(string_len <= H5R_MAX_STRING_LEN); /* Allocate the string */ if (NULL == (string = (char *)H5MM_malloc(string_len + 1))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, FAIL, "Cannot allocate string") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, FAIL, "Cannot allocate string"); /* Copy the string */ H5MM_memcpy(string, p, string_len); @@ -1324,8 +1328,8 @@ H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, const unsigned ch FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(nalloc); + assert(f); + assert(nalloc); buf_size = H5HG_HEAP_ID_SIZE(f); if (buf && *nalloc >= buf_size) { @@ -1334,7 +1338,7 @@ H5R__encode_heap(H5F_t *f, unsigned char *buf, size_t *nalloc, const unsigned ch /* Write the reference information to disk (allocates space also) */ if (H5HG_insert(f, data_size, data, &hobjid) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to write reference information") + HGOTO_ERROR(H5E_REFERENCE, H5E_WRITEERROR, FAIL, "Unable to write reference information"); /* Encode the heap information */ H5F_addr_encode(f, &p, hobjid.addr); @@ -1366,25 +1370,25 @@ H5R__decode_heap(H5F_t *f, const unsigned char *buf, size_t *nbytes, unsigned ch FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(buf); - HDassert(nbytes); - HDassert(data_ptr); + assert(f); + assert(buf); + assert(nbytes); + assert(data_ptr); buf_size = H5HG_HEAP_ID_SIZE(f); /* Don't decode if buffer size isn't big enough */ if (*nbytes < buf_size) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small"); /* Get the heap information */ H5F_addr_decode(f, &p, &(hobjid.addr)); - if (!H5F_addr_defined(hobjid.addr) || hobjid.addr == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer") + if (!H5_addr_defined(hobjid.addr) || hobjid.addr == 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Undefined reference pointer"); UINT32DECODE(p, hobjid.idx); /* Read the information from disk */ if (NULL == (*data_ptr = (unsigned char *)H5HG_read(f, &hobjid, (void *)*data_ptr, data_size))) - HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read reference data") + HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read reference data"); *nbytes = buf_size; @@ -1409,9 +1413,9 @@ H5R__encode_token_obj_compat(const H5O_token_t *obj_token, size_t token_size, un FUNC_ENTER_PACKAGE_NOERR - HDassert(obj_token); - HDassert(token_size); - HDassert(nalloc); + assert(obj_token); + assert(token_size); + assert(nalloc); /* Don't encode if buffer size isn't big enough or buffer is empty */ if (buf && *nalloc >= token_size) @@ -1439,14 +1443,14 @@ H5R__decode_token_obj_compat(const unsigned char *buf, size_t *nbytes, H5O_token FUNC_ENTER_PACKAGE - HDassert(buf); - HDassert(nbytes); - HDassert(obj_token); - HDassert(token_size); + assert(buf); + assert(nbytes); + assert(obj_token); + assert(token_size); /* Don't decode if buffer size isn't big enough */ if (*nbytes < token_size) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small"); H5MM_memcpy(obj_token, buf, token_size); @@ -1473,23 +1477,25 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbyt unsigned char *data = NULL; H5O_token_t token = {0}; size_t data_size; - const uint8_t *p; + const uint8_t *p = NULL; + const uint8_t *p_end = NULL; H5S_t *space = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(buf); - HDassert(nbytes); - HDassert(token_size); + assert(f); + assert(buf); + assert(nbytes); + assert(token_size); /* Read from heap */ if (H5R__decode_heap(f, buf, nbytes, &data, &data_size) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Get object address */ - p = (const uint8_t *)data; + p = (const uint8_t *)data; + p_end = p + data_size - 1; H5MM_memcpy(&token, p, token_size); p += token_size; @@ -1502,15 +1508,19 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbyt if (H5VL_native_token_to_addr(f, H5I_FILE, token, &oloc.addr) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); /* Open and copy the dataset's dataspace */ if (NULL == (space = H5S_read(&oloc))) - HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "not found") + HGOTO_ERROR(H5E_REFERENCE, H5E_NOTFOUND, FAIL, "not found"); /* Unserialize the selection */ - if (H5S_SELECT_DESERIALIZE(&space, &p) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "can't deserialize selection") + + if (p - 1 >= p_end) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Ran off end of buffer while deserializing"); + + if (H5S_SELECT_DESERIALIZE(&space, &p, (size_t)(p_end - p + 1)) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "can't deserialize selection"); *space_ptr = space; } @@ -1522,7 +1532,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, size_t *nbyt if (ret_value < 0) { if (space && H5S_close(space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace"); } FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5S.c b/externals/coda-oss/modules/drivers/hdf5/source/H5S.c index 36eed7a681..d1002adcb7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5S.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5S.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -111,12 +110,12 @@ H5S_init(void) /* Initialize the ID group for the dataspace IDs */ if (H5I_register_type(H5I_DATASPACE_CLS) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize dataspace ID class"); /* Initialize the ID group for the dataspace selection iterator IDs */ if (H5I_register_type(H5I_SPACE_SEL_ITER_CLS) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, - "unable to initialize dataspace selection iterator ID class") + "unable to initialize dataspace selection iterator ID class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -187,8 +186,8 @@ H5S_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity checks */ - HDassert(0 == H5I_nmembers(H5I_DATASPACE)); - HDassert(0 == H5I_nmembers(H5I_SPACE_SEL_ITER)); + assert(0 == H5I_nmembers(H5I_DATASPACE)); + assert(0 == H5I_nmembers(H5I_SPACE_SEL_ITER)); /* Destroy the dataspace object id group */ n += (H5I_dec_type_ref(H5I_DATASPACE) > 0); @@ -206,9 +205,6 @@ H5S_term_package(void) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Wednesday, April 8, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -220,7 +216,7 @@ H5S__close_cb(void *_space, void H5_ATTR_UNUSED **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(space); + assert(space); /* Close the dataspace object */ if (H5S_close(space) < 0) @@ -258,7 +254,7 @@ H5S_create(H5S_class_t type) /* Create a new dataspace */ if (NULL == (new_ds = H5FL_CALLOC(H5S_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Initialize default dataspace state */ new_ds->extent.type = type; @@ -281,20 +277,20 @@ H5S_create(H5S_class_t type) case H5S_NO_CLASS: default: - HDassert("unknown dataspace (extent) type" && 0); + assert("unknown dataspace (extent) type" && 0); break; } /* end switch */ /* Start with "all" selection */ if (H5S_select_all(new_ds, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); /* Reset common selection info pointer */ new_ds->select.sel_info.hslab = NULL; /* Reset "shared" info on extent */ if (H5O_msg_reset_share(H5O_SDSPACE_ID, &(new_ds->extent.sh_loc)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRESET, NULL, "unable to reset shared component info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRESET, NULL, "unable to reset shared component info"); /* Set return value */ ret_value = new_ds; @@ -302,7 +298,7 @@ H5S_create(H5S_class_t type) done: if (ret_value == NULL) if (new_ds && H5S_close(new_ds) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_create() */ @@ -336,19 +332,19 @@ H5Screate(H5S_class_t type) /* Check args */ if (type <= H5S_NO_CLASS || type > H5S_NULL) /* don't allow complex dataspace yet */ - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dataspace type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dataspace type"); if (NULL == (new_ds = H5S_create(type))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create dataspace"); /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, new_ds, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); done: if (ret_value < 0) if (new_ds && H5S_close(new_ds) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); FUNC_LEAVE_API(ret_value) } /* end H5Screate() */ @@ -360,9 +356,6 @@ H5Screate(H5S_class_t type) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -370,7 +363,7 @@ H5S__extent_release(H5S_extent_t *extent) { FUNC_ENTER_PACKAGE_NOERR - HDassert(extent); + assert(extent); /* Release extent */ if (extent->type == H5S_SIMPLE) { @@ -393,9 +386,6 @@ H5S__extent_release(H5S_extent_t *extent) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -405,15 +395,15 @@ H5S_close(H5S_t *ds) FUNC_ENTER_NOAPI(FAIL) - HDassert(ds); + assert(ds); /* Release selection (this should come before the extent release) */ if (H5S_SELECT_RELEASE(ds) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace selection"); /* Release extent */ if (H5S__extent_release(&ds->extent) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent"); done: /* Release the main structure. @@ -433,9 +423,6 @@ H5S_close(H5S_t *ds) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -448,11 +435,11 @@ H5Sclose(hid_t space_id) /* Check args */ if (NULL == H5I_object_verify(space_id, H5I_DATASPACE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* When the reference count reaches zero the resources are freed */ if (H5I_dec_app_ref(space_id) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing id"); done: FUNC_LEAVE_API(ret_value) @@ -467,9 +454,6 @@ H5Sclose(hid_t space_id) * * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Friday, January 30, 1998 - * *------------------------------------------------------------------------- */ hid_t @@ -484,20 +468,20 @@ H5Scopy(hid_t space_id) /* Check args */ if (NULL == (src = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace"); /* Copy */ if (NULL == (dst = H5S_copy(src, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy dataspace"); /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, dst, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID"); done: if (ret_value < 0) if (dst && H5S_close(dst) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace"); FUNC_LEAVE_API(ret_value) } /* end H5Scopy() */ @@ -509,9 +493,6 @@ H5Scopy(hid_t space_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -526,13 +507,13 @@ H5Sextent_copy(hid_t dst_id, hid_t src_id) /* Check args */ if (NULL == (src = (H5S_t *)H5I_object_verify(src_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (NULL == (dst = (H5S_t *)H5I_object_verify(dst_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Copy */ if (H5S_extent_copy(dst, src) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent"); done: FUNC_LEAVE_API(ret_value) @@ -545,9 +526,6 @@ H5Sextent_copy(hid_t dst_id, hid_t src_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Neil Fortner - * Monday, February 23, 2015 - * *------------------------------------------------------------------------- */ herr_t @@ -557,18 +535,18 @@ H5S_extent_copy(H5S_t *dst, const H5S_t *src) FUNC_ENTER_NOAPI(FAIL) - HDassert(dst); - HDassert(src); + assert(dst); + assert(src); /* Copy extent */ if (H5S__extent_copy_real(&(dst->extent), &(src->extent), TRUE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy extent"); /* If the selection is 'all', update the number of elements selected in the * destination space */ if (H5S_SEL_ALL == H5S_GET_SELECT_TYPE(dst)) if (H5S_select_all(dst, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -581,9 +559,6 @@ H5S_extent_copy(H5S_t *dst, const H5S_t *src) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 3, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -596,7 +571,7 @@ H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_m /* Release destination extent before we copy over it */ if (H5S__extent_release(dst) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace extent"); /* Copy the regular fields */ dst->type = src->type; @@ -630,13 +605,13 @@ H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_m case H5S_NO_CLASS: default: - HDassert("unknown dataspace type" && 0); + assert("unknown dataspace type" && 0); break; } /* end switch */ /* Copy the shared object info */ if (H5O_set_shared(&(dst->sh_loc), &(src->sh_loc)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy shared information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy shared information"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -656,9 +631,6 @@ H5S__extent_copy_real(H5S_extent_t *dst, const H5S_extent_t *src, hbool_t copy_m * * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 - * *------------------------------------------------------------------------- */ H5S_t * @@ -670,15 +642,15 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max) FUNC_ENTER_NOAPI(NULL) if (NULL == (dst = H5FL_CALLOC(H5S_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); /* Copy the source dataspace's extent */ if (H5S__extent_copy_real(&(dst->extent), &(src->extent), copy_max) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy extent"); /* Copy the source dataspace's selection */ if (H5S_select_copy(dst, src, share_selection) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy select") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy select"); /* Set the return value */ ret_value = dst; @@ -700,9 +672,6 @@ H5S_copy(const H5S_t *src, hbool_t share_selection, hbool_t copy_max) * * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. @@ -717,7 +686,7 @@ H5S_get_simple_extent_npoints(const H5S_t *ds) FUNC_ENTER_NOAPI_NOERR /* check args */ - HDassert(ds); + assert(ds); /* Get the number of elements in extent */ ret_value = (hssize_t)ds->extent.nelem; @@ -733,9 +702,6 @@ H5S_get_simple_extent_npoints(const H5S_t *ds) * Return: Success: Number of data points in the dataset. * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * *------------------------------------------------------------------------- */ hssize_t @@ -749,7 +715,7 @@ H5Sget_simple_extent_npoints(hid_t space_id) /* Check args */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); ret_value = (hssize_t)H5S_GET_EXTENT_NPOINTS(ds); @@ -770,9 +736,6 @@ H5Sget_simple_extent_npoints(hid_t space_id) * may have. * Failure: 0 * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * *------------------------------------------------------------------------- */ hsize_t @@ -784,7 +747,7 @@ H5S_get_npoints_max(const H5S_t *ds) FUNC_ENTER_NOAPI(0) /* check args */ - HDassert(ds); + assert(ds); switch (H5S_GET_EXTENT_TYPE(ds)) { case H5S_NULL: @@ -813,8 +776,8 @@ H5S_get_npoints_max(const H5S_t *ds) case H5S_NO_CLASS: default: - HDassert("unknown dataspace class" && 0); - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, 0, "internal error (unknown dataspace class)") + assert("unknown dataspace class" && 0); + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, 0, "internal error (unknown dataspace class)"); } done: @@ -829,9 +792,6 @@ H5S_get_npoints_max(const H5S_t *ds) * Return: Success: The number of dimensions in a dataspace. * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 - * *------------------------------------------------------------------------- */ int @@ -845,7 +805,7 @@ H5Sget_simple_extent_ndims(hid_t space_id) /* Check args */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a dataspace"); ret_value = (int)H5S_GET_EXTENT_NDIMS(ds); @@ -863,9 +823,6 @@ H5Sget_simple_extent_ndims(hid_t space_id) * * Failure: Negative * - * Programmer: Robb Matzke - * hursday, December 11, 1997 - * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. @@ -880,7 +837,7 @@ H5S_get_simple_extent_ndims(const H5S_t *ds) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(ds); + assert(ds); switch (H5S_GET_EXTENT_TYPE(ds)) { case H5S_NULL: @@ -891,8 +848,8 @@ H5S_get_simple_extent_ndims(const H5S_t *ds) case H5S_NO_CLASS: default: - HDassert("unknown dataspace class" && 0); - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "internal error (unknown dataspace class)") + assert("unknown dataspace class" && 0); + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "internal error (unknown dataspace class)"); } /* end switch */ done: @@ -910,9 +867,6 @@ H5S_get_simple_extent_ndims(const H5S_t *ds) * * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 - * *------------------------------------------------------------------------- */ int @@ -926,7 +880,7 @@ H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[] /*out*/, hsize_t maxdim /* Check args */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a dataspace"); ret_value = H5S_get_simple_extent_dims(ds, dims, maxdims); @@ -943,9 +897,6 @@ H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[] /*out*/, hsize_t maxdim * Return: Success: Number of dimensions. Zero implies scalar. * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, June 30, 2009 - * *------------------------------------------------------------------------- */ int @@ -957,7 +908,7 @@ H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[]) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(ext); + assert(ext); switch (ext->type) { case H5S_NULL: @@ -981,8 +932,8 @@ H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[]) case H5S_NO_CLASS: default: - HDassert("unknown dataspace class" && 0); - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "internal error (unknown dataspace class)") + assert("unknown dataspace class" && 0); + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "internal error (unknown dataspace class)"); } /* end switch */ done: @@ -998,9 +949,6 @@ H5S_extent_get_dims(const H5S_extent_t *ext, hsize_t dims[], hsize_t max_dims[]) * Return: Success: Number of dimensions. Zero implies scalar. * Failure: Negative * - * Programmer: Robb Matzke - * Thursday, December 11, 1997 - * *------------------------------------------------------------------------- */ int @@ -1011,11 +959,11 @@ H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[]) FUNC_ENTER_NOAPI(FAIL) /* check args */ - HDassert(ds); + assert(ds); /* Get dims for extent */ if ((ret_value = H5S_extent_get_dims(&ds->extent, dims, max_dims)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve dataspace extent dims") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve dataspace extent dims"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1029,9 +977,6 @@ H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[]) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -1041,14 +986,14 @@ H5S_write(H5F_t *f, H5O_t *oh, unsigned update_flags, H5S_t *ds) FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(oh); - HDassert(ds); - HDassert(H5S_GET_EXTENT_TYPE(ds) >= 0); + assert(f); + assert(oh); + assert(ds); + assert(H5S_GET_EXTENT_TYPE(ds) >= 0); /* Write the current dataspace extent to the dataspace message */ if (H5O_msg_write_oh(f, oh, H5O_SDSPACE_ID, 0, update_flags, &(ds->extent)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple dataspace message") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't update simple dataspace message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1061,9 +1006,6 @@ H5S_write(H5F_t *f, H5O_t *oh, unsigned update_flags, H5S_t *ds) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, December 31, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -1073,14 +1015,14 @@ H5S_append(H5F_t *f, H5O_t *oh, H5S_t *ds) FUNC_ENTER_NOAPI(FAIL) - HDassert(f); - HDassert(oh); - HDassert(ds); - HDassert(H5S_GET_EXTENT_TYPE(ds) >= 0); + assert(f); + assert(oh); + assert(ds); + assert(H5S_GET_EXTENT_TYPE(ds) >= 0); /* Add the dataspace message to the object header */ if (H5O_msg_append_oh(f, oh, H5O_SDSPACE_ID, 0, 0, &(ds->extent)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't add simple dataspace message") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't add simple dataspace message"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1095,9 +1037,6 @@ H5S_append(H5F_t *f, H5O_t *oh, H5S_t *ds) * * Failure: NULL * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * *------------------------------------------------------------------------- */ H5S_t * @@ -1109,17 +1048,17 @@ H5S_read(const H5O_loc_t *loc) FUNC_ENTER_NOAPI(NULL) /* check args */ - HDassert(loc); + assert(loc); if (NULL == (ds = H5FL_CALLOC(H5S_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); if (NULL == H5O_msg_read(loc, H5O_SDSPACE_ID, &(ds->extent))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to load dataspace info from dataset header") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to load dataspace info from dataset header"); /* Default to entire dataspace being selected */ if (H5S_select_all(ds, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); /* Set the value for successful return */ ret_value = ds; @@ -1154,7 +1093,7 @@ H5S__is_simple(const H5S_t *sdim) FUNC_ENTER_PACKAGE_NOERR /* Check args and all the boring stuff. */ - HDassert(sdim); + assert(sdim); /* H5S_NULL shouldn't be simple dataspace */ ret_value = @@ -1188,7 +1127,7 @@ H5Sis_simple(hid_t space_id) /* Check args and all the boring stuff. */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace"); ret_value = H5S__is_simple(space); @@ -1234,28 +1173,28 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], con /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace"); if (rank > 0 && dims == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no dimensions specified"); if (rank < 0 || rank > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank"); if (dims) for (u = 0; u < rank; u++) if (H5S_UNLIMITED == dims[u]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "current dimension must have a specific size, not H5S_UNLIMITED") + "current dimension must have a specific size, not H5S_UNLIMITED"); if (max != NULL) { if (dims == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "maximum dimension specified, but no current dimensions specified") + "maximum dimension specified, but no current dimensions specified"); for (u = 0; u < rank; u++) if (max[u] != H5S_UNLIMITED && max[u] < dims[u]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid maximum dimension size") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid maximum dimension size"); } /* Do it */ if (H5S_set_extent_simple(space, (unsigned)rank, dims, max) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set simple extent"); done: FUNC_LEAVE_API(ret_value) @@ -1268,9 +1207,6 @@ H5Sset_extent_simple(hid_t space_id, int rank, const hsize_t dims[/*rank*/], con * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, July 8, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1282,11 +1218,11 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, const hs FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(rank <= H5S_MAX_RANK); + assert(rank <= H5S_MAX_RANK); /* shift out of the previous state to a "simple" dataspace. */ if (H5S__extent_release(&space->extent) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "failed to release previous dataspace extent") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "failed to release previous dataspace extent"); if (rank == 0) { /* scalar variable */ space->extent.type = H5S_SCALAR; @@ -1322,13 +1258,13 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, const hs /* Selection related cleanup */ /* Set offset to zeros */ - HDmemset(space->select.offset, 0, sizeof(hsize_t) * space->extent.rank); + memset(space->select.offset, 0, sizeof(hsize_t) * space->extent.rank); space->select.offset_changed = FALSE; /* If the selection is 'all', update the number of elements selected */ if (H5S_GET_SELECT_TYPE(space) == H5S_SEL_ALL) if (H5S_select_all(space, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1350,9 +1286,6 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, const hs * * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol - * Tuesday, January 27, 1998 - * *------------------------------------------------------------------------- */ hid_t @@ -1367,37 +1300,37 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/ /* Check arguments */ if (rank < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dimensionality cannot be negative") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dimensionality cannot be negative"); if (rank > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dimensionality is too large") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dimensionality is too large"); /* We allow users to use this function to create scalar or null dataspace. * Check DIMS isn't set when the RANK is 0. */ if (!dims && rank != 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dataspace information") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dataspace information"); /* Check whether the current dimensions are valid */ for (i = 0; i < rank; i++) { if (H5S_UNLIMITED == dims[i]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, - "current dimension must have a specific size, not H5S_UNLIMITED") + "current dimension must have a specific size, not H5S_UNLIMITED"); if (maxdims && H5S_UNLIMITED != maxdims[i] && maxdims[i] < dims[i]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "maxdims is smaller than dims") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "maxdims is smaller than dims"); } /* end for */ /* Create the space and set the extent */ if (NULL == (space = H5S_create_simple((unsigned)rank, dims, maxdims))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, H5I_INVALID_HID, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, H5I_INVALID_HID, "can't create simple dataspace"); /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, space, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID"); done: if (ret_value < 0) if (space && H5S_close(space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release dataspace"); FUNC_LEAVE_API(ret_value) } /* end H5Screate_simple() */ @@ -1410,9 +1343,6 @@ H5Screate_simple(int rank, const hsize_t dims[/*rank*/], const hsize_t maxdims[/ * Return: Success: A pointer to a dataspace object * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, April 3, 2003 - * *------------------------------------------------------------------------- */ H5S_t * @@ -1423,13 +1353,13 @@ H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t max FUNC_ENTER_NOAPI(NULL) /* Check arguments */ - HDassert(rank <= H5S_MAX_RANK); + assert(rank <= H5S_MAX_RANK); /* Create the space and set the extent */ if (NULL == (ret_value = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "can't create simple dataspace"); if (H5S_set_extent_simple(ret_value, rank, dims, maxdims) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "can't set dimensions") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "can't set dimensions"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1446,9 +1376,6 @@ H5S_create_simple(unsigned rank, const hsize_t dims[/*rank*/], const hsize_t max * Return: Success: Non-negative * Failure: Negative * - * Programmer: Raymond Lu - * July 14, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -1462,14 +1389,14 @@ H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl_id) /* Check argument and retrieve object */ if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); if (H5S_encode(dspace, (unsigned char **)&buf, nalloc) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace"); done: FUNC_LEAVE_API(ret_value) @@ -1484,9 +1411,6 @@ H5Sencode2(hid_t obj_id, void *buf, size_t *nalloc, hid_t fapl_id) * * Return: SUCCEED/FAIL * - * Programmer: Raymond Lu - * July 14, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -1502,15 +1426,15 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) /* Allocate "fake" file structure */ if (NULL == (f = H5F_fake_alloc((uint8_t)0))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct"); /* Find out the size of buffer needed for extent */ if ((extent_size = H5O_msg_raw_size(f, H5O_SDSPACE_ID, TRUE, obj)) == 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace size"); /* Find out the size of buffer needed for selection */ if ((sselect_size = H5S_SELECT_SERIAL_SIZE(obj)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADSIZE, FAIL, "can't find dataspace selection size"); H5_CHECKED_ASSIGN(select_size, size_t, sselect_size, hssize_t); /* Verify the size of buffer. If it's not big enough, simply return the @@ -1534,19 +1458,19 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) /* Encode the extent part of dataspace */ if (H5O_msg_encode(f, H5O_SDSPACE_ID, TRUE, pp, obj) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space"); pp += extent_size; /* Encode the selection part of dataspace. */ *p = pp; if (H5S_SELECT_SERIALIZE(obj, p) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space"); } /* end else */ done: /* Release fake file structure */ if (f && H5F_fake_free(f) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release fake file struct") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release fake file struct"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_encode() */ @@ -1561,9 +1485,6 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc) * * Failure: H5I_INVALID_HID * - * Programmer: Raymond Lu - * July 14, 2004 - * *------------------------------------------------------------------------- */ hid_t @@ -1576,14 +1497,14 @@ H5Sdecode(const void *buf) H5TRACE1("i", "*x", buf); if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "empty buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "empty buffer"); if ((ds = H5S_decode((const unsigned char **)&buf)) == NULL) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, H5I_INVALID_HID, "can't decode object") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, H5I_INVALID_HID, "can't decode object"); /* Register the type and return the ID */ if ((ret_value = H5I_register(H5I_DATASPACE, ds, TRUE)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace"); done: FUNC_LEAVE_API(ret_value) @@ -1599,9 +1520,6 @@ H5Sdecode(const void *buf) * * Failure: NULL * - * Programmer: Raymond Lu - * July 14, 2004 - * *------------------------------------------------------------------------- */ H5S_t * @@ -1609,7 +1527,7 @@ H5S_decode(const unsigned char **p) { H5F_t *f = NULL; /* Fake file structure*/ H5S_t *ds; /* Decoded dataspace */ - H5S_extent_t *extent; /* Entent of decoded dataspace */ + H5S_extent_t *extent; /* Extent of decoded dataspace */ const unsigned char *pp = (*p); /* Local pointer for decoding */ size_t extent_size; /* size of the extent message*/ uint8_t sizeof_size; /* 'Size of sizes' for file */ @@ -1619,18 +1537,18 @@ H5S_decode(const unsigned char **p) /* Decode the type of the information */ if (*pp++ != H5O_SDSPACE_ID) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADMESG, NULL, "not an encoded dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADMESG, NULL, "not an encoded dataspace"); /* Decode the version of the dataspace information */ if (*pp++ != H5S_ENCODE_VERSION) - HGOTO_ERROR(H5E_DATASPACE, H5E_VERSION, NULL, "unknown version of encoded dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_VERSION, NULL, "unknown version of encoded dataspace"); /* Decode the "size of size" information */ sizeof_size = *pp++; /* Allocate "fake" file structure */ if (NULL == (f = H5F_fake_alloc(sizeof_size))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct"); /* Decode size of extent information */ UINT32DECODE(pp, extent_size); @@ -1638,27 +1556,28 @@ H5S_decode(const unsigned char **p) /* Decode the extent part of dataspace */ /* (pass mostly bogus file pointer and bogus DXPL) */ if (NULL == (extent = (H5S_extent_t *)H5O_msg_decode(f, NULL, H5O_SDSPACE_ID, extent_size, pp))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object"); pp += extent_size; /* Copy the extent into dataspace structure */ if (NULL == (ds = H5FL_CALLOC(H5S_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for dataspace conversion path table") + "memory allocation failed for dataspace conversion path table"); if (NULL == H5O_msg_copy(H5O_SDSPACE_ID, extent, &(ds->extent))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy object"); if (H5S__extent_release(extent) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, NULL, "can't release previous dataspace"); extent = H5FL_FREE(H5S_extent_t, extent); /* Initialize to "all" selection. Deserialization relies on valid existing selection. */ if (H5S_select_all(ds, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection"); - /* Decode the select part of dataspace. I believe this part always exists. */ + /* Decode the select part of dataspace. + * Because size of buffer is unknown, assume arbitrarily large buffer to allow decoding. */ *p = pp; - if (H5S_SELECT_DESERIALIZE(&ds, p) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection") + if (H5S_SELECT_DESERIALIZE(&ds, p, SIZE_MAX) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection"); /* Set return value */ ret_value = ds; @@ -1666,7 +1585,7 @@ H5S_decode(const unsigned char **p) done: /* Release fake file structure */ if (f && H5F_fake_free(f) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release fake file struct") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release fake file struct"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_decode() */ @@ -1680,9 +1599,6 @@ H5S_decode(const unsigned char **p) * * Failure: N5S_NO_CLASS * - * Programmer: Quincey Koziol - * Thursday, September 28, 2000 - * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. @@ -1696,7 +1612,7 @@ H5S_get_simple_extent_type(const H5S_t *space) FUNC_ENTER_NOAPI_NOERR - HDassert(space); + assert(space); ret_value = H5S_GET_EXTENT_TYPE(space); @@ -1712,9 +1628,6 @@ H5S_get_simple_extent_type(const H5S_t *space) * * Failure: N5S_NO_CLASS * - * Programmer: Quincey Koziol - * Thursday, July 23, 1998 - * *------------------------------------------------------------------------- */ H5S_class_t @@ -1728,7 +1641,7 @@ H5Sget_simple_extent_type(hid_t sid) /* Check arguments */ if (NULL == (space = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5S_NO_CLASS, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5S_NO_CLASS, "not a dataspace"); ret_value = H5S_GET_EXTENT_TYPE(space); @@ -1761,11 +1674,11 @@ H5Sset_extent_none(hid_t space_id) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace"); /* Clear the previous extent from the dataspace */ if (H5S__extent_release(&space->extent) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, FAIL, "can't release previous dataspace") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTDELETE, FAIL, "can't release previous dataspace"); space->extent.type = H5S_NULL; @@ -1780,9 +1693,6 @@ H5Sset_extent_none(hid_t space_id) * * Return: TRUE/FALSE/FAIL * - * Programmer: Pedro Vicente - * March 13, 2002 - * *------------------------------------------------------------------------- */ htri_t @@ -1794,8 +1704,8 @@ H5S_set_extent(H5S_t *space, const hsize_t *size) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(space && H5S_SIMPLE == H5S_GET_EXTENT_TYPE(space)); - HDassert(size); + assert(space && H5S_SIMPLE == H5S_GET_EXTENT_TYPE(space)); + assert(size); /* Verify that the dimensions being changed are allowed to change */ for (u = 0; u < space->extent.rank; u++) @@ -1804,7 +1714,7 @@ H5S_set_extent(H5S_t *space, const hsize_t *size) if (space->extent.max && H5S_UNLIMITED != space->extent.max[u] && space->extent.max[u] < size[u]) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "dimension cannot exceed the existing maximal size (new: %llu max: %llu)", - (unsigned long long)size[u], (unsigned long long)space->extent.max[u]) + (unsigned long long)size[u], (unsigned long long)space->extent.max[u]); /* Indicate that dimension size can be modified */ ret_value = TRUE; @@ -1813,7 +1723,7 @@ H5S_set_extent(H5S_t *space, const hsize_t *size) /* Update dimension size(s) */ if (ret_value) if (H5S_set_extent_real(space, size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "failed to change dimension size(s)") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "failed to change dimension size(s)"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1828,10 +1738,6 @@ H5S_set_extent(H5S_t *space, const hsize_t *size) * Return: TRUE if dataspace has extent set * FALSE if dataspace's extent is uninitialized * - * Programmer: James Laird - * - * Date: July 23, 2004 - * *------------------------------------------------------------------------- */ H5_ATTR_PURE hbool_t @@ -1841,7 +1747,7 @@ H5S_has_extent(const H5S_t *ds) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(ds); + assert(ds); if (0 == ds->extent.rank && 0 == ds->extent.nelem && H5S_NULL != ds->extent.type) ret_value = FALSE; @@ -1859,9 +1765,6 @@ H5S_has_extent(const H5S_t *ds) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Pedro Vicente - * March 13, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -1874,8 +1777,8 @@ H5S_set_extent_real(H5S_t *space, const hsize_t *size) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(space && H5S_SIMPLE == H5S_GET_EXTENT_TYPE(space)); - HDassert(size); + assert(space && H5S_SIMPLE == H5S_GET_EXTENT_TYPE(space)); + assert(size); /* Change the dataspace size & re-compute the number of elements in the extent */ for (u = 0, nelem = 1; u < space->extent.rank; u++) { @@ -1887,11 +1790,11 @@ H5S_set_extent_real(H5S_t *space, const hsize_t *size) /* If the selection is 'all', update the number of elements selected */ if (H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space)) if (H5S_select_all(space, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); /* Mark the dataspace as no longer shared if it was before */ if (H5O_msg_reset_share(H5O_SDSPACE_ID, space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRESET, FAIL, "can't stop sharing dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRESET, FAIL, "can't stop sharing dataspace"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1906,9 +1809,6 @@ H5S_set_extent_real(H5S_t *space, const hsize_t *size) * * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, October 24, 2005 - * *------------------------------------------------------------------------- */ htri_t @@ -1924,11 +1824,11 @@ H5Sextent_equal(hid_t space1_id, hid_t space2_id) /* check args */ if (NULL == (ds1 = (const H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE)) || NULL == (ds2 = (const H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Check dataspaces for extent's equality */ if ((ret_value = H5S_extent_equal(ds1, ds2)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "dataspace comparison failed") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "dataspace comparison failed"); done: FUNC_LEAVE_API(ret_value) @@ -1956,24 +1856,24 @@ H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(ds1); - HDassert(ds2); + assert(ds1); + assert(ds2); /* Make certain the dataspaces are the same type */ if (ds1->extent.type != ds2->extent.type) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Make certain the dataspaces are the same rank */ if (ds1->extent.rank != ds2->extent.rank) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Make certain the dataspaces' current dimensions are the same size */ if (ds1->extent.rank > 0) { - HDassert(ds1->extent.size); - HDassert(ds2->extent.size); + assert(ds1->extent.size); + assert(ds2->extent.size); for (u = 0; u < ds1->extent.rank; u++) if (ds1->extent.size[u] != ds2->extent.size[u]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ /* Make certain the dataspaces' maximum dimensions are the same size */ @@ -1982,11 +1882,11 @@ H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2) if (ds1->extent.max != NULL && ds2->extent.max != NULL) { for (u = 0; u < ds1->extent.rank; u++) if (ds1->extent.max[u] != ds2->extent.max[u]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ else if ((ds1->extent.max == NULL && ds2->extent.max != NULL) || (ds1->extent.max != NULL && ds2->extent.max == NULL)) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ done: @@ -2001,9 +1901,6 @@ H5S_extent_equal(const H5S_t *ds1, const H5S_t *ds2) * Return: Success: Number of data points in the dataset extent. * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, November 30, 2006 - * *------------------------------------------------------------------------- */ H5_ATTR_PURE hsize_t @@ -2012,7 +1909,7 @@ H5S_extent_nelem(const H5S_extent_t *ext) FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ - HDassert(ext); + assert(ext); /* Return the number of elements in extent */ FUNC_LEAVE_NOAPI(ext->nelem) @@ -2025,8 +1922,6 @@ H5S_extent_nelem(const H5S_extent_t *ext) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; December 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -2038,15 +1933,15 @@ H5S_set_version(H5F_t *f, H5S_t *ds) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(ds); + assert(f); + assert(ds); /* Upgrade to the version indicated by the file's low bound if higher */ version = MAX(ds->extent.version, H5O_sdspace_ver_bounds[H5F_LOW_BOUND(f)]); /* Version bounds check */ if (version > H5O_sdspace_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "Dataspace version out of bounds") + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "Dataspace version out of bounds"); /* Set the message version */ ds->extent.version = version; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5SL.c b/externals/coda-oss/modules/drivers/hdf5/source/H5SL.c index b291d094c2..29d0f5ffec 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5SL.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5SL.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -157,35 +156,35 @@ #define H5SL_GROW(X, LVL, ERR) \ { \ /* Check if we need to increase allocation of forward pointers */ \ - if (LVL + 1 >= 1u << X->log_nalloc) { \ + if (LVL + 1 >= ((size_t)1) << X->log_nalloc) { \ H5SL_node_t **_tmp; \ - HDassert(LVL + 1 == 1U << X->log_nalloc); \ + assert(LVL + 1 == ((size_t)1) << X->log_nalloc); \ /* Double the amount of allocated space */ \ X->log_nalloc++; \ \ /* Check if we need to create a new factory */ \ if (X->log_nalloc >= H5SL_fac_nused_g) { \ - HDassert(X->log_nalloc == H5SL_fac_nused_g); \ + assert(X->log_nalloc == H5SL_fac_nused_g); \ \ /* Check if we need to allocate space for the factory pointer*/ \ if (H5SL_fac_nused_g >= H5SL_fac_nalloc_g) { \ - HDassert(H5SL_fac_nused_g == H5SL_fac_nalloc_g); \ + assert(H5SL_fac_nused_g == H5SL_fac_nalloc_g); \ /* Double the size of the array of factory pointers */ \ H5SL_fac_nalloc_g *= 2; \ if (NULL == (H5SL_fac_g = (H5FL_fac_head_t **)H5MM_realloc( \ (void *)H5SL_fac_g, H5SL_fac_nalloc_g * sizeof(H5FL_fac_head_t *)))) \ - HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, ERR, "memory allocation failed") \ + HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, ERR, "memory allocation failed"); \ } \ \ /* Create the new factory */ \ H5SL_fac_g[H5SL_fac_nused_g] = \ - H5FL_fac_init((1u << H5SL_fac_nused_g) * sizeof(H5SL_node_t *)); \ + H5FL_fac_init((((size_t)1) << H5SL_fac_nused_g) * sizeof(H5SL_node_t *)); \ H5SL_fac_nused_g++; \ } \ \ /* Allocate space for new forward pointers */ \ if (NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \ - HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, ERR, "memory allocation failed") \ + HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, ERR, "memory allocation failed"); \ H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL + 1) * sizeof(H5SL_node_t *)); \ X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc - 1], (void *)X->forward); \ X->forward = _tmp; \ @@ -199,14 +198,14 @@ #define H5SL_SHRINK(X, LVL) \ { \ /* Check if we can reduce the allocation of forward pointers */ \ - if (LVL <= 1u << (X->log_nalloc - 1)) { \ + if (LVL <= ((size_t)1) << (X->log_nalloc - 1)) { \ H5SL_node_t **_tmp; \ - HDassert(LVL == 1U << (X->log_nalloc - 1)); \ + assert(LVL == ((size_t)1) << (X->log_nalloc - 1)); \ X->log_nalloc--; \ \ /* Allocate space for new forward pointers */ \ if (NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \ - HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") \ + HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed"); \ H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL) * sizeof(H5SL_node_t *)); \ X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc + 1], (void *)X->forward); \ X->forward = _tmp; \ @@ -219,24 +218,24 @@ * head node if necessary. PREV is the previous node of the height that X is to * grow to. */ #define H5SL_PROMOTE(SLIST, X, PREV, ERR) \ - { \ + do { \ size_t _lvl = X->level; \ \ H5SL_GROW(X, _lvl, ERR); \ \ if (_lvl == (size_t)SLIST->curr_level) { \ - HDassert(PREV == SLIST->header); \ + assert(PREV == SLIST->header); \ /* Grow the head */ \ H5SL_GROW(PREV, _lvl, ERR) \ SLIST->curr_level++; \ X->forward[_lvl + 1] = NULL; \ } \ else { \ - HDassert(_lvl < (size_t)SLIST->curr_level); \ + assert(_lvl < (size_t)SLIST->curr_level); \ X->forward[_lvl + 1] = PREV->forward[_lvl + 1]; \ } \ PREV->forward[_lvl + 1] = X; \ - } + } while (0) /* Macro used to reduce the level of a node by 1. Does not update the head node * "current level". PREV is the previous node of the current height of X. */ @@ -244,7 +243,7 @@ { \ size_t _lvl = X->level; \ \ - HDassert(PREV->forward[_lvl] == X); \ + assert(PREV->forward[_lvl] == X); \ PREV->forward[_lvl] = X->forward[_lvl]; \ H5SL_SHRINK(X, _lvl); \ } @@ -288,13 +287,13 @@ } \ X = X->forward[_i]; \ } \ - HDassert(!_drop->forward[_i] || \ - !H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, _drop->forward[_i], KEY, HASHVAL)); \ + assert(!_drop->forward[_i] || \ + !H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, _drop->forward[_i], KEY, HASHVAL)); \ \ /* Promote the middle node if necessary */ \ if (_count == 3) { \ - HDassert(X == _last->forward[_i]->forward[_i]); \ - H5SL_PROMOTE(SLIST, X, _last, NULL) \ + assert(X == _last->forward[_i]->forward[_i]); \ + H5SL_PROMOTE(SLIST, X, _last, NULL); \ } \ \ /* Prepare to drop down */ \ @@ -303,7 +302,7 @@ } \ \ if (_next && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, _next, KEY, HASHVAL)) \ - HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, NULL, "can't insert duplicate key") \ + HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, NULL, "can't insert duplicate key"); \ } /* Macro used to remove node */ @@ -352,7 +351,7 @@ /* If we have already found the node to drop into and there */ \ /* is more than one node in this gap, we can stop searching */ \ if (_drop) { \ - HDassert(_count >= 1); \ + assert(_count >= 1); \ _count = 2; \ break; \ } \ @@ -379,9 +378,9 @@ } \ X = X->forward[_i]; \ } \ - HDassert(_count >= 1 && _count <= 3); \ - HDassert(!_drop->forward[_i] || \ - !H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, _drop->forward[_i], KEY, HASHVAL)); \ + assert(_count >= 1 && _count <= 3); \ + assert(!_drop->forward[_i] || \ + !H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, _drop->forward[_i], KEY, HASHVAL)); \ \ /* Check if we need to adjust node heights */ \ if (_count == 1) { \ @@ -399,12 +398,12 @@ /* If there are 2 or more nodes, promote the first */ \ if (_next->forward[_i]->forward[_i] != _llast) { \ X = _next->forward[_i]; \ - H5SL_PROMOTE(SLIST, X, _last, NULL) \ + H5SL_PROMOTE(SLIST, X, _last, NULL); \ } \ else if (!_head->forward[_i + 1]) { \ /* shrink the header */ \ - HDassert(_i == SLIST->curr_level - 1); \ - HDassert((size_t)SLIST->curr_level == _head->level); \ + assert(_i == SLIST->curr_level - 1); \ + assert((size_t)SLIST->curr_level == _head->level); \ \ H5SL_SHRINK(_head, (size_t)(_i + 1)) \ SLIST->curr_level--; \ @@ -418,18 +417,18 @@ X = _llast->forward[_i]; \ for (_count = 1; _count < 3 && X->forward[_i] != _last; _count++) \ X = X->forward[_i]; \ - HDassert(X->forward[_i] == _last); \ + assert(X->forward[_i] == _last); \ \ /* Demote the separator node */ \ H5SL_DEMOTE(_last, _llast) \ \ /* If there are 2 or more nodes, promote the last */ \ if (_count >= 2) \ - H5SL_PROMOTE(SLIST, X, _llast, NULL) \ + H5SL_PROMOTE(SLIST, X, _llast, NULL); \ else if (!_head->forward[_i + 1]) { \ /* shrink the header */ \ - HDassert(_i == SLIST->curr_level - 1); \ - HDassert((size_t)SLIST->curr_level == _head->level); \ + assert(_i == SLIST->curr_level - 1); \ + assert((size_t)SLIST->curr_level == _head->level); \ \ H5SL_SHRINK(_head, (size_t)(_i + 1)) \ SLIST->curr_level--; \ @@ -456,7 +455,7 @@ _next->item = X->item; \ _next->hashval = X->hashval; \ } \ - HDassert(!X->level); \ + assert(!X->level); \ \ /* Remove the node */ \ X->backward->forward[0] = X->forward[0]; \ @@ -539,12 +538,12 @@ H5SL_init(void) /* Allocate space for array of factories */ H5SL_fac_g = (H5FL_fac_head_t **)H5MM_malloc(sizeof(H5FL_fac_head_t *)); - HDassert(H5SL_fac_g); + assert(H5SL_fac_g); H5SL_fac_nalloc_g = 1; /* Initialize first factory */ H5SL_fac_g[0] = H5FL_fac_init(sizeof(H5SL_node_t *)); - HDassert(H5SL_fac_g[0]); + assert(H5SL_fac_g[0]); H5SL_fac_nused_g = 1; FUNC_LEAVE_NOAPI(ret_value) @@ -583,7 +582,7 @@ H5SL_term_package(void) for (i = 0; i < H5SL_fac_nused_g; i++) { ret = H5FL_fac_term(H5SL_fac_g[i]); - HDassert(ret >= 0); + assert(ret >= 0); } H5SL_fac_nused_g = 0; @@ -632,7 +631,7 @@ H5SL__new_node(void *item, const void *key, uint32_t hashval) /* Allocate the node */ if (NULL == (ret_value = (H5SL_node_t *)H5FL_MALLOC(H5SL_node_t))) - HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed"); /* Initialize node */ ret_value->key = key; @@ -641,7 +640,7 @@ H5SL__new_node(void *item, const void *key, uint32_t hashval) ret_value->hashval = hashval; if (NULL == (ret_value->forward = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[0]))) { ret_value = H5FL_FREE(H5SL_node_t, ret_value); - HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed"); } ret_value->log_nalloc = 0; @@ -681,8 +680,8 @@ H5SL__insert_common(H5SL_t *slist, void *item, const void *key) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(slist); - HDassert(key); + assert(slist); + assert(key); /* Check internal consistency */ /* (Pre-condition) */ @@ -731,7 +730,7 @@ H5SL__insert_common(H5SL_t *slist, void *item, const void *key) break; default: - HDassert(0 && "Unknown skiplist type!"); + assert(0 && "Unknown skiplist type!"); } /* 'key' must not have been found in existing list, if we get here */ @@ -741,7 +740,7 @@ H5SL__insert_common(H5SL_t *slist, void *item, const void *key) /* Create new node of level 0 */ if (NULL == (x = H5SL__new_node(item, key, hashval))) - HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "can't create new skip list node") + HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "can't create new skip list node"); /* Update the links */ x->backward = prev; @@ -750,7 +749,7 @@ H5SL__insert_common(H5SL_t *slist, void *item, const void *key) if (x->forward[0]) x->forward[0]->backward = x; else { - HDassert(slist->last == prev); + assert(slist->last == prev); slist->last = x; } @@ -797,7 +796,7 @@ H5SL__release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(slist); + assert(slist); /* Check internal consistency */ /* (Pre-condition) */ @@ -828,7 +827,7 @@ H5SL__release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) slist->header->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[slist->header->log_nalloc], slist->header->forward); if (NULL == (slist->header->forward = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[0]))) - HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, FAIL, "memory allocation failed"); slist->header->forward[0] = NULL; slist->header->log_nalloc = 0; slist->header->level = 0; @@ -875,14 +874,14 @@ H5SL__close_common(H5SL_t *slist, H5SL_operator_t op, void *op_data) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(slist); + assert(slist); /* Check internal consistency */ /* (Pre-condition) */ /* Free skip list nodes */ if (H5SL__release_common(slist, op, op_data) < 0) - HGOTO_ERROR(H5E_SLIST, H5E_CANTFREE, FAIL, "can't release skip list nodes") + HGOTO_ERROR(H5E_SLIST, H5E_CANTFREE, FAIL, "can't release skip list nodes"); /* Release header node */ slist->header->forward = @@ -923,15 +922,15 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp) FUNC_ENTER_NOAPI(NULL) /* Check args */ - HDassert(type >= H5SL_TYPE_INT && type <= H5SL_TYPE_GENERIC); + assert(type >= H5SL_TYPE_INT && type <= H5SL_TYPE_GENERIC); /* Allocate skip list structure */ if (NULL == (new_slist = H5FL_MALLOC(H5SL_t))) - HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed"); /* Set the static internal fields */ new_slist->type = type; - HDassert((type == H5SL_TYPE_GENERIC) == !!cmp); + assert((type == H5SL_TYPE_GENERIC) == !!cmp); new_slist->cmp = cmp; /* Set the dynamic internal fields */ @@ -940,7 +939,7 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp) /* Allocate the header node */ if (NULL == (header = H5SL__new_node(NULL, NULL, (uint32_t)ULONG_MAX))) - HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "can't create new skip list node") + HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "can't create new skip list node"); /* Initialize header node's forward pointer */ header->forward[0] = NULL; @@ -989,7 +988,7 @@ H5SL_count(H5SL_t *slist) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist); + assert(slist); /* Check internal consistency */ /* (Pre-condition) */ @@ -1026,15 +1025,15 @@ H5SL_insert(H5SL_t *slist, void *item, const void *key) FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(slist); - HDassert(key); + assert(slist); + assert(key); /* Check internal consistency */ /* (Pre-condition) */ /* Insert item into skip list */ if (NULL == H5SL__insert_common(slist, item, key)) - HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, FAIL, "can't create new skip list node") + HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, FAIL, "can't create new skip list node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1072,15 +1071,15 @@ H5SL_add(H5SL_t *slist, void *item, const void *key) FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(slist); - HDassert(key); + assert(slist); + assert(key); /* Check internal consistency */ /* (Pre-condition) */ /* Insert item into skip list */ if (NULL == (ret_value = H5SL__insert_common(slist, item, key))) - HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, NULL, "can't create new skip list node") + HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, NULL, "can't create new skip list node"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1115,8 +1114,8 @@ H5SL_remove(H5SL_t *slist, const void *key) FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(slist); - HDassert(key); + assert(slist); + assert(key); /* Check internal consistency */ /* (Pre-condition) */ @@ -1165,7 +1164,7 @@ H5SL_remove(H5SL_t *slist, const void *key) break; default: - HDassert(0 && "Unknown skiplist type!"); + assert(0 && "Unknown skiplist type!"); } done: @@ -1203,7 +1202,7 @@ H5SL_remove_first(H5SL_t *slist) FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(slist); + assert(slist); /* Assign level */ H5_CHECK_OVERFLOW(slist->curr_level, int, size_t); @@ -1219,8 +1218,8 @@ H5SL_remove_first(H5SL_t *slist) /* Assign return value */ ret_value = tmp->item; - HDassert(level == head->level); - HDassert(0 == tmp->level); + assert(level == head->level); + assert(0 == tmp->level); /* Remove the first node */ head->forward[0] = tmp->forward[0]; @@ -1236,14 +1235,14 @@ H5SL_remove_first(H5SL_t *slist) /* Reshape the skip list as necessary to maintain 1-2-3 condition */ for (i = 0; i < level; i++) { next = head->forward[i + 1]; - HDassert(next); + assert(next); /* Check if head->forward[i] == head->forward[i+1] (illegal) */ if (head->forward[i] == next) { tmp = next; next = next->forward[i + 1]; - HDassert(tmp->level == i + 1); + assert(tmp->level == i + 1); /* Demote head->forward[i] */ H5SL_DEMOTE(tmp, head) @@ -1251,8 +1250,8 @@ H5SL_remove_first(H5SL_t *slist) /* Check if we need to promote the following node to maintain * 1-2-3 condition */ if (tmp->forward[i]->forward[i] != next) { - HDassert(tmp->forward[i]->forward[i]->forward[i] == next || - tmp->forward[i]->forward[i]->forward[i]->forward[i] == next); + assert(tmp->forward[i]->forward[i]->forward[i] == next || + tmp->forward[i]->forward[i]->forward[i]->forward[i] == next); tmp = tmp->forward[i]; H5SL_PROMOTE(slist, tmp, head, NULL); /* In this case, since there is a node of height = i+1 here @@ -1262,7 +1261,7 @@ H5SL_remove_first(H5SL_t *slist) } else if (!head->forward[i + 1]) { /* We just shrunk the largest node, shrink the header */ - HDassert(i == level - 1); + assert(i == level - 1); H5SL_SHRINK(head, level) slist->curr_level--; @@ -1306,8 +1305,8 @@ H5SL_search(H5SL_t *slist, const void *key) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist); - HDassert(key); + assert(slist); + assert(key); /* Check internal consistency */ /* (Pre-condition) */ @@ -1356,7 +1355,7 @@ H5SL_search(H5SL_t *slist, const void *key) break; default: - HDassert(0 && "Unknown skiplist type!"); + assert(0 && "Unknown skiplist type!"); } /* 'key' must not have been found in list, if we get here */ @@ -1398,8 +1397,8 @@ H5SL_less(H5SL_t *slist, const void *key) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist); - HDassert(key); + assert(slist); + assert(key); /* Check internal consistency */ /* (Pre-condition) */ @@ -1448,7 +1447,7 @@ H5SL_less(H5SL_t *slist, const void *key) break; default: - HDassert(0 && "Unknown skiplist type!"); + assert(0 && "Unknown skiplist type!"); } /* An exact match for 'key' must not have been found in list, if we get here */ @@ -1503,8 +1502,8 @@ H5SL_greater(H5SL_t *slist, const void *key) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist); - HDassert(key); + assert(slist); + assert(key); /* Check internal consistency */ /* (Pre-condition) */ @@ -1553,7 +1552,7 @@ H5SL_greater(H5SL_t *slist, const void *key) break; default: - HDassert(0 && "Unknown skiplist type!"); + assert(0 && "Unknown skiplist type!"); } /* An exact match for 'key' must not have been found in list, if we get here */ @@ -1598,8 +1597,8 @@ H5SL_find(H5SL_t *slist, const void *key) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist); - HDassert(key); + assert(slist); + assert(key); /* Check internal consistency */ /* (Pre-condition) */ @@ -1648,7 +1647,7 @@ H5SL_find(H5SL_t *slist, const void *key) break; default: - HDassert(0 && "Unknown skiplist type!"); + assert(0 && "Unknown skiplist type!"); } /* 'key' must not have been found in list, if we get here */ @@ -1690,8 +1689,8 @@ H5SL_below(H5SL_t *slist, const void *key) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist); - HDassert(key); + assert(slist); + assert(key); /* Check internal consistency */ /* (Pre-condition) */ @@ -1740,7 +1739,7 @@ H5SL_below(H5SL_t *slist, const void *key) break; default: - HDassert(0 && "Unknown skiplist type!"); + assert(0 && "Unknown skiplist type!"); } /* An exact match for 'key' must not have been found in list, if we get here */ @@ -1795,8 +1794,8 @@ H5SL_above(H5SL_t *slist, const void *key) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist); - HDassert(key); + assert(slist); + assert(key); /* Check internal consistency */ /* (Pre-condition) */ @@ -1845,7 +1844,7 @@ H5SL_above(H5SL_t *slist, const void *key) break; default: - HDassert(0 && "Unknown skiplist type!"); + assert(0 && "Unknown skiplist type!"); } /* An exact match for 'key' must not have been found in list, if we get here */ @@ -1884,7 +1883,7 @@ H5SL_first(H5SL_t *slist) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist); + assert(slist); /* Check internal consistency */ /* (Pre-condition) */ @@ -1917,7 +1916,7 @@ H5SL_next(H5SL_node_t *slist_node) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist_node); + assert(slist_node); /* Check internal consistency */ /* (Pre-condition) */ @@ -1950,7 +1949,7 @@ H5SL_prev(H5SL_node_t *slist_node) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist_node); + assert(slist_node); /* Check internal consistency */ /* (Pre-condition) */ @@ -1984,7 +1983,7 @@ H5SL_last(H5SL_t *slist) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist); + assert(slist); /* Check internal consistency */ /* (Pre-condition) */ @@ -2017,7 +2016,7 @@ H5SL_item(H5SL_node_t *slist_node) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist_node); + assert(slist_node); /* Check internal consistency */ /* (Pre-condition) */ @@ -2068,7 +2067,7 @@ H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(slist); + assert(slist); /* Check internal consistency */ /* (Pre-condition) */ @@ -2126,14 +2125,14 @@ H5SL_release(H5SL_t *slist) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(slist); + assert(slist); /* Check internal consistency */ /* (Pre-condition) */ /* Free skip list nodes */ if (H5SL__release_common(slist, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SLIST, H5E_CANTFREE, FAIL, "can't release skip list nodes") + HGOTO_ERROR(H5E_SLIST, H5E_CANTFREE, FAIL, "can't release skip list nodes"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2175,14 +2174,14 @@ H5SL_free(H5SL_t *slist, H5SL_operator_t op, void *op_data) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(slist); + assert(slist); /* Check internal consistency */ /* (Pre-condition) */ /* Free skip list nodes */ if (H5SL__release_common(slist, op, op_data) < 0) - HGOTO_ERROR(H5E_SLIST, H5E_CANTFREE, FAIL, "can't release skip list nodes") + HGOTO_ERROR(H5E_SLIST, H5E_CANTFREE, FAIL, "can't release skip list nodes"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2222,14 +2221,14 @@ H5SL_destroy(H5SL_t *slist, H5SL_operator_t op, void *op_data) FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(slist); + assert(slist); /* Check internal consistency */ /* (Pre-condition) */ /* Close skip list */ if (H5SL__close_common(slist, op, op_data) < 0) - HGOTO_ERROR(H5E_SLIST, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list") + HGOTO_ERROR(H5E_SLIST, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2262,14 +2261,14 @@ H5SL_close(H5SL_t *slist) FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(slist); + assert(slist); /* Check internal consistency */ /* (Pre-condition) */ /* Close skip list */ if (H5SL__close_common(slist, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SLIST, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list") + HGOTO_ERROR(H5E_SLIST, H5E_CANTCLOSEOBJ, FAIL, "can't close skip list"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5SM.c b/externals/coda-oss/modules/drivers/hdf5/source/H5SM.c index 63030c3622..4c57e3f374 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5SM.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5SM.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -100,9 +99,6 @@ H5FL_ARR_DEFINE(H5SM_sohm_t, H5O_SHMESG_MAX_LIST_SIZE); * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Tuesday, May 2, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -121,59 +117,59 @@ H5SM_init(H5F_t *f, H5P_genplist_t *fc_plist, const H5O_loc_t *ext_loc) FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) - HDassert(f); + assert(f); /* File should not already have a SOHM table */ - HDassert(!H5F_addr_defined(H5F_SOHM_ADDR(f))); + assert(!H5_addr_defined(H5F_SOHM_ADDR(f))); /* Set the ring type in the DXPL */ H5AC_set_ring(H5AC_RING_USER, &orig_ring); /* Initialize master table */ if (NULL == (table = H5FL_CALLOC(H5SM_master_table_t))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTALLOC, FAIL, "memory allocation failed for SOHM table"); table->num_indexes = H5F_SOHM_NINDEXES(f); table->table_size = H5SM_TABLE_SIZE(f); /* Get information from fcpl */ if (H5P_get(fc_plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, &index_type_flags) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM type flags") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM type flags"); if (H5P_get(fc_plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &list_max) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM list maximum") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM list maximum"); if (H5P_get(fc_plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &btree_min) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM btree minimum") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM btree minimum"); if (H5P_get(fc_plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, &minsizes) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM message min sizes") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get SOHM message min sizes"); /* Verify that values are valid */ if (table->num_indexes > H5O_SHMESG_MAX_NINDEXES) - HGOTO_ERROR(H5E_SOHM, H5E_BADRANGE, FAIL, "number of indexes in property list is too large") + HGOTO_ERROR(H5E_SOHM, H5E_BADRANGE, FAIL, "number of indexes in property list is too large"); /* Check that type flags weren't duplicated anywhere */ type_flags_used = 0; for (x = 0; x < table->num_indexes; ++x) { if (index_type_flags[x] & type_flags_used) HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, - "the same shared message type flag is assigned to more than one index") + "the same shared message type flag is assigned to more than one index"); type_flags_used |= index_type_flags[x]; } /* end for */ /* Check that number of indexes in table and in superblock make sense. * Right now we just use one byte to hold the number of indexes. */ - HDassert(table->num_indexes < 256); + assert(table->num_indexes < 256); /* Check that list and btree cutoffs make sense. There can't be any * values greater than the list max but less than the btree min; the * list max has to be greater than or equal to one less than the btree * min. */ - HDassert(list_max + 1 >= btree_min); - HDassert(table->num_indexes > 0 && table->num_indexes <= H5O_SHMESG_MAX_NINDEXES); + assert(list_max + 1 >= btree_min); + assert(table->num_indexes > 0 && table->num_indexes <= H5O_SHMESG_MAX_NINDEXES); /* Allocate the SOHM indexes as an array. */ if (NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed for SOHM indexes") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed for SOHM indexes"); /* Initialize all of the indexes, but don't allocate space for them to * hold messages until we actually need to write to them. @@ -199,11 +195,11 @@ H5SM_init(H5F_t *f, H5P_genplist_t *fc_plist, const H5O_loc_t *ext_loc) /* Allocate space for the table on disk */ if (HADDR_UNDEF == (table_addr = H5MF_alloc(f, H5FD_MEM_SOHM_TABLE, (hsize_t)table->table_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "file allocation failed for SOHM table"); /* Cache the new table */ if (H5AC_insert_entry(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, FAIL, "can't add SOHM table to cache"); /* Record the address of the master table in the file */ H5F_SET_SOHM_ADDR(f, table_addr); @@ -223,7 +219,7 @@ H5SM_init(H5F_t *f, H5P_genplist_t *fc_plist, const H5O_loc_t *ext_loc) sohm_table.nindexes = H5F_SOHM_NINDEXES(f); if (H5O_msg_create(ext_loc, H5O_SHMESG_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &sohm_table) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to update SOHM header message") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to update SOHM header message"); done: /* Reset the ring in the API context */ @@ -247,9 +243,6 @@ H5SM_init(H5F_t *f, H5P_genplist_t *fc_plist, const H5O_loc_t *ext_loc) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Tuesday, October 10, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -275,7 +268,7 @@ H5SM__type_to_flag(unsigned type_id, unsigned *type_flag) break; default: - HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "unknown message type ID") + HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "unknown message type ID"); } /* end switch */ done: @@ -293,9 +286,6 @@ H5SM__type_to_flag(unsigned type_id, unsigned *type_flag) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Tuesday, October 10, 2006 - * *------------------------------------------------------------------------- */ ssize_t @@ -309,14 +299,14 @@ H5SM__get_index(const H5SM_master_table_t *table, unsigned type_id) /* Translate the H5O type_id into an H5SM type flag */ if (H5SM__type_to_flag(type_id, &type_flag) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't map message type to flag") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't map message type to flag"); /* Search the indexes until we find one that matches this flag or we've * searched them all. */ for (x = 0; x < table->num_indexes; ++x) if (table->indexes[x].mesg_types & type_flag) - HGOTO_DONE((ssize_t)x) + HGOTO_DONE((ssize_t)x); /* At this point, ret_value is either the location of the correct * index or it's still FAIL because we didn't find an index. @@ -332,9 +322,6 @@ H5SM__get_index(const H5SM_master_table_t *table, unsigned type_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, December 12, 2006 - * *------------------------------------------------------------------------- */ htri_t @@ -349,10 +336,10 @@ H5SM_type_shared(H5F_t *f, unsigned type_id) /* Translate the H5O type_id into an H5SM type flag */ if (H5SM__type_to_flag(type_id, &type_flag) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't map message type to flag") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't map message type to flag"); /* Look up the master SOHM table */ - if (H5F_addr_defined(H5F_SOHM_ADDR(f))) { + if (H5_addr_defined(H5F_SOHM_ADDR(f))) { H5SM_table_cache_ud_t cache_udata; /* User-data for callback */ /* Set up user data for callback */ @@ -360,23 +347,23 @@ H5SM_type_shared(H5F_t *f, unsigned type_id) if (NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); } /* end if */ else /* No shared messages of any type */ - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Search the indexes until we find one that matches this flag or we've * searched them all. */ for (u = 0; u < table->num_indexes; u++) if (table->indexes[u].mesg_types & type_flag) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); done: /* Release the master SOHM table */ if (table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_type_shared() */ @@ -389,9 +376,6 @@ H5SM_type_shared(H5F_t *f, unsigned type_id) * * Return: Non-negative on success/negative on failure * - * Programmer: James Laird - * Tuesday, October 3, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -405,8 +389,8 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) /* Sanity checks */ - HDassert(f); - HDassert(fheap_addr); + assert(f); + assert(fheap_addr); /* Set up user data for callback */ cache_udata.f = f; @@ -414,11 +398,11 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) /* Look up the master SOHM table */ if (NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); /* Look up index for message type */ if ((index_num = H5SM__get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to find correct SOHM index"); /* Retrieve heap address for index */ *fheap_addr = table->indexes[index_num].heap_addr; @@ -426,7 +410,7 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) done: /* Release the master SOHM table */ if (table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_get_fheap_addr() */ @@ -438,9 +422,6 @@ H5SM_get_fheap_addr(H5F_t *f, unsigned type_id, haddr_t *fheap_addr) * * Return: Non-negative on success/negative on failure * - * Programmer: James Laird - * Tuesday, May 2, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -454,9 +435,9 @@ H5SM__create_index(H5F_t *f, H5SM_index_header_t *header) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(header); - HDassert(header->index_addr == HADDR_UNDEF); - HDassert(header->btree_min <= header->list_max + 1); + assert(header); + assert(header->index_addr == HADDR_UNDEF); + assert(header->btree_min <= header->list_max + 1); /* In most cases, the index starts as a list */ if (header->list_max > 0) { @@ -464,7 +445,7 @@ H5SM__create_index(H5F_t *f, H5SM_index_header_t *header) /* Create the list index */ if (HADDR_UNDEF == (list_addr = H5SM__create_list(f, header))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "list creation failed for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "list creation failed for SOHM index"); /* Set the index type & address */ header->index_type = H5SM_LIST; @@ -482,11 +463,11 @@ H5SM__create_index(H5F_t *f, H5SM_index_header_t *header) bt2_cparam.split_percent = H5SM_B2_SPLIT_PERCENT; bt2_cparam.merge_percent = H5SM_B2_MERGE_PERCENT; if (NULL == (bt2 = H5B2_create(f, &bt2_cparam, f))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index"); /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(bt2, &tree_addr) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for SOHM index"); /* Set the index type & address */ header->index_type = H5SM_BTREE; @@ -494,7 +475,7 @@ H5SM__create_index(H5F_t *f, H5SM_index_header_t *header) } /* end else */ /* Create a heap to hold the shared messages that the list or B-tree will index */ - HDmemset(&fheap_cparam, 0, sizeof(fheap_cparam)); + memset(&fheap_cparam, 0, sizeof(fheap_cparam)); fheap_cparam.managed.width = H5O_FHEAP_MAN_WIDTH; fheap_cparam.managed.start_block_size = H5O_FHEAP_MAN_START_BLOCK_SIZE; fheap_cparam.managed.max_direct_size = H5O_FHEAP_MAN_MAX_DIRECT_SIZE; @@ -504,10 +485,10 @@ H5SM__create_index(H5F_t *f, H5SM_index_header_t *header) fheap_cparam.id_len = 0; fheap_cparam.max_man_size = H5O_FHEAP_MAX_MAN_SIZE; if (NULL == (fheap = H5HF_create(f, &fheap_cparam))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to create fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to create fractal heap"); if (H5HF_get_heap_addr(fheap, &(header->heap_addr)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap address"); #ifndef NDEBUG { @@ -515,17 +496,17 @@ H5SM__create_index(H5F_t *f, H5SM_index_header_t *header) /* Sanity check ID length */ if (H5HF_get_id_len(fheap, &fheap_id_len) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length") - HDassert(fheap_id_len == H5O_FHEAP_ID_LEN); + HGOTO_ERROR(H5E_SOHM, H5E_CANTGETSIZE, FAIL, "can't get fractal heap ID length"); + assert(fheap_id_len == H5O_FHEAP_ID_LEN); } #endif /* NDEBUG */ done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__create_index */ @@ -544,9 +525,6 @@ H5SM__create_index(H5F_t *f, H5SM_index_header_t *header) * * Return: Non-negative on success/negative on failure * - * Programmer: James Laird - * Thursday, January 4, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -562,25 +540,26 @@ H5SM__delete_index(H5F_t *f, H5SM_index_header_t *header, hbool_t delete_heap) /* Check the index list's status in the metadata cache */ if (H5AC_get_entry_status(f, header->index_addr, &index_status) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "unable to check metadata cache status for direct block") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, + "unable to check metadata cache status for direct block"); /* If the index list is in the cache, expunge it now */ if (index_status & H5AC_ES__IN_CACHE) { /* Sanity checks on index list */ - HDassert(!(index_status & H5AC_ES__IS_PINNED)); - HDassert(!(index_status & H5AC_ES__IS_PROTECTED)); + assert(!(index_status & H5AC_ES__IS_PINNED)); + assert(!(index_status & H5AC_ES__IS_PROTECTED)); /* Evict the index list from the metadata cache */ if (H5AC_expunge_entry(f, H5AC_SOHM_LIST, header->index_addr, H5AC__FREE_FILE_SPACE_FLAG) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove list index from cache") + HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove list index from cache"); } /* end if */ } /* end if */ else { - HDassert(header->index_type == H5SM_BTREE); + assert(header->index_type == H5SM_BTREE); /* Delete the B-tree. */ if (H5B2_delete(f, header->index_addr, f, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete B-tree") + HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete B-tree"); /* Revert to list unless B-trees can have zero records */ if (header->btree_min > 0) @@ -590,7 +569,7 @@ H5SM__delete_index(H5F_t *f, H5SM_index_header_t *header, hbool_t delete_heap) /* Free the index's heap if requested. */ if (delete_heap == TRUE) { if (H5HF_delete(f, header->heap_addr) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete fractal heap"); header->heap_addr = HADDR_UNDEF; } /* end if */ @@ -612,9 +591,6 @@ H5SM__delete_index(H5F_t *f, H5SM_index_header_t *header, hbool_t delete_heap) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Monday, August 28, 2006 - * *------------------------------------------------------------------------- */ static haddr_t @@ -628,16 +604,16 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(header); + assert(f); + assert(header); num_entries = header->list_max; /* Allocate list in memory */ if (NULL == (list = H5FL_CALLOC(H5SM_list_t))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list"); if (NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_CALLOC(H5SM_sohm_t, num_entries))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list"); /* Initialize messages in list */ for (x = 0; x < num_entries; x++) @@ -648,11 +624,11 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) /* Allocate space for the list on disk */ if (HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_SOHM_INDEX, (hsize_t)header->list_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, HADDR_UNDEF, "file allocation failed for SOHM list"); /* Put the list into the cache */ if (H5AC_insert_entry(f, H5AC_SOHM_LIST, addr, list, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINS, HADDR_UNDEF, "can't add SOHM list to cache"); /* Set return value */ ret_value = addr; @@ -687,9 +663,6 @@ H5SM__create_list(H5F_t *f, H5SM_index_header_t *header) * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Thursday, January 4, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -708,8 +681,8 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, H5SM_list_t * FUNC_ENTER_PACKAGE - HDassert(_list && *_list); - HDassert(header); + assert(_list && *_list); + assert(header); /* Get pointer to list of messages to convert */ list = *_list; @@ -721,11 +694,11 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, H5SM_list_t * bt2_cparam.split_percent = H5SM_B2_SPLIT_PERCENT; bt2_cparam.merge_percent = H5SM_B2_MERGE_PERCENT; if (NULL == (bt2 = H5B2_create(f, &bt2_cparam, f))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index"); /* Retrieve the v2 B-tree's address in the file */ if (H5B2_get_addr(bt2, &tree_addr) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't get v2 B-tree address for SOHM index"); /* Set up key values that all messages will use. Since these messages * are in the heap, they have a heap ID and no encoding or type_id. @@ -743,13 +716,13 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, H5SM_list_t * /* Get the encoded message */ if (H5SM__read_mesg(f, &(key.message), fheap, open_oh, &key.encoding_size, &encoding_buf) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "Couldn't read SOHM message in list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "Couldn't read SOHM message in list"); key.encoding = encoding_buf; /* Insert the message into the B-tree */ if (H5B2_insert(bt2, &key) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree"); /* Free buffer from H5SM__read_mesg */ if (encoding_buf) @@ -760,7 +733,7 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, H5SM_list_t * /* Unprotect list in cache and release heap */ if (H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list"); *_list = list = NULL; /* Delete the old list index (but not its heap, which the new index is @@ -768,7 +741,7 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, H5SM_list_t * */ num_messages = header->num_messages; /* preserve this across the index deletion */ if (H5SM__delete_index(f, header, FALSE) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "can't free list index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "can't free list index"); /* Set/restore header info */ header->index_addr = tree_addr; @@ -778,7 +751,7 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, H5SM_list_t * done: /* Release resources */ if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index"); if (encoding_buf) encoding_buf = H5MM_xfree(encoding_buf); @@ -796,9 +769,6 @@ H5SM__convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header, H5SM_list_t * * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -811,16 +781,16 @@ H5SM__bt2_convert_to_list_op(const void *record, void *op_data) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(record); - HDassert(op_data); + assert(record); + assert(op_data); /* Get the message index, and increment the # of messages in list */ mesg_idx = list->header->num_messages++; - HDassert(list->header->num_messages <= list->header->list_max); + assert(list->header->num_messages <= list->header->list_max); /* Insert this message at the end of the list */ - HDassert(list->messages[mesg_idx].location == H5SM_NO_LOC); - HDassert(message->location != H5SM_NO_LOC); + assert(list->messages[mesg_idx].location == H5SM_NO_LOC); + assert(message->location != H5SM_NO_LOC); H5MM_memcpy(&(list->messages[mesg_idx]), message, sizeof(H5SM_sohm_t)); FUNC_LEAVE_NOAPI(SUCCEED) @@ -835,9 +805,6 @@ H5SM__bt2_convert_to_list_op(const void *record, void *op_data) * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Thursday, January 4, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -860,7 +827,7 @@ H5SM__convert_btree_to_list(H5F_t *f, H5SM_index_header_t *header) /* Create a new list index */ if (HADDR_UNDEF == (header->index_addr = H5SM__create_list(f, header))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to create shared message list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to create shared message list"); /* Set up user data for metadata cache callback */ cache_udata.f = f; @@ -869,18 +836,18 @@ H5SM__convert_btree_to_list(H5F_t *f, H5SM_index_header_t *header) /* Protect the SOHM list */ if (NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM list index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM list index"); /* Delete the B-tree and have messages copy themselves to the * list as they're deleted */ if (H5B2_delete(f, btree_addr, f, H5SM__bt2_convert_to_list_op, list) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete B-tree") + HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete B-tree"); done: /* Release the SOHM list from the cache */ if (list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to unprotect SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to unprotect SOHM index"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__convert_btree_to_list() */ @@ -898,9 +865,6 @@ H5SM__convert_btree_to_list(H5F_t *f, H5SM_index_header_t *header) * FALSE if this message couldn't be a SOHM * Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, February 21, 2007 - * *------------------------------------------------------------------------- */ static htri_t @@ -912,14 +876,14 @@ H5SM__can_share_common(const H5F_t *f, unsigned type_id, const void *mesg) /* Check whether this message ought to be shared or not */ /* If sharing is disabled in this file, don't share the message */ - if (!H5F_addr_defined(H5F_SOHM_ADDR(f))) - HGOTO_DONE(FALSE) + if (!H5_addr_defined(H5F_SOHM_ADDR(f))) + HGOTO_DONE(FALSE); /* Type-specific check */ if ((ret_value = H5O_msg_can_share(type_id, mesg)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "can_share callback returned error") + HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "can_share callback returned error"); if (ret_value == FALSE) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* At this point, the message passes the "trivial" checks and is worth * further checks. @@ -941,9 +905,6 @@ H5SM__can_share_common(const H5F_t *f, unsigned type_id, const void *mesg) * FALSE if this message won't be a SOHM * Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, February 21, 2007 - * *------------------------------------------------------------------------- */ htri_t @@ -960,9 +921,9 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, ssize_t *sohm_index_num, un /* "trivial" sharing checks */ if ((tri_ret = H5SM__can_share_common(f, type_id, mesg)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "'trivial' sharing checks returned error") + HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "'trivial' sharing checks returned error"); if (tri_ret == FALSE) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Look up the master SOHM table */ /* (use incoming master SOHM table if possible) */ @@ -976,7 +937,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, ssize_t *sohm_index_num, un if (NULL == (my_table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); } /* end if */ /* Find the right index for this message type. If there is no such index @@ -984,14 +945,14 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, ssize_t *sohm_index_num, un */ if ((index_num = H5SM__get_index(my_table, type_id)) < 0) { H5E_clear_stack(NULL); /*ignore error*/ - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ /* If the message isn't big enough, don't bother sharing it */ if (0 == (mesg_size = H5O_msg_raw_size(f, type_id, TRUE, mesg))) - HGOTO_ERROR(H5E_SOHM, H5E_BADMESG, FAIL, "unable to get OH message size") + HGOTO_ERROR(H5E_SOHM, H5E_BADMESG, FAIL, "unable to get OH message size"); if (mesg_size < my_table->indexes[index_num].min_mesg_size) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* At this point, the message will be shared, set the index number if requested. */ if (sohm_index_num) @@ -1001,7 +962,7 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, ssize_t *sohm_index_num, un /* Release the master SOHM table, if we protected it */ if (my_table && my_table != table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), my_table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_can_share() */ @@ -1061,9 +1022,6 @@ H5SM_can_share(H5F_t *f, H5SM_master_table_t *table, ssize_t *sohm_index_num, un * FALSE if this message is not a SOHM * Negative on failure * - * Programmer: James Laird - * Tuesday, May 2, 2006 - * *------------------------------------------------------------------------- */ htri_t @@ -1097,11 +1055,11 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id, /* "trivial" sharing checks */ if (mesg_flags && (*mesg_flags & H5O_MSG_FLAG_DONTSHARE)) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); if ((tri_ret = H5SM__can_share_common(f, type_id, mesg)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "'trivial' sharing checks returned error") + HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "'trivial' sharing checks returned error"); if (tri_ret == FALSE) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Set up user data for callback */ cache_udata.f = f; @@ -1109,20 +1067,20 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id, /* Look up the master SOHM table */ if (NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); /* "complex" sharing checks */ if ((tri_ret = H5SM_can_share(f, table, &index_num, type_id, mesg)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "'complex' sharing checks returned error") + HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "'complex' sharing checks returned error"); if (tri_ret == FALSE) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* At this point, the message will be shared. */ /* If the index hasn't been allocated yet, create it */ if (table->indexes[index_num].index_addr == HADDR_UNDEF) { if (H5SM__create_index(f, &(table->indexes[index_num])) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to create SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to create SOHM index"); cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ @@ -1131,7 +1089,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id, */ if (H5SM__write_mesg(f, open_oh, &(table->indexes[index_num]), (defer_flags & H5SM_DEFER) != 0, type_id, mesg, &cache_flags) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "can't write shared message") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "can't write shared message"); /* Set flags if this message was "written" without error and wasn't a * 'defer' attempt; it is now either fully shared or "shareable". @@ -1140,24 +1098,24 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id, if (((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_HERE) *mesg_flags |= H5O_MSG_FLAG_SHAREABLE; else { - HDassert(((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_SOHM); + assert(((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_SOHM); *mesg_flags |= H5O_MSG_FLAG_SHARED; } /* end else */ } /* end if */ done: - HDassert((ret_value != TRUE) || ((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_HERE || - ((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_SOHM); + assert((ret_value != TRUE) || ((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_HERE || + ((H5O_shared_t *)mesg)->type == H5O_SHARE_TYPE_SOHM); #ifndef NDEBUG /* If we previously deferred this operation, make sure the saved message * type is the same as the one we get here. */ if (defer_flags & H5SM_WAS_DEFERRED) - HDassert(deferred_type == ((H5O_shared_t *)mesg)->type); + assert(deferred_type == ((H5O_shared_t *)mesg)->type); #endif /* NDEBUG */ /* Release the master SOHM table */ if (table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_try_share() */ @@ -1174,9 +1132,6 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id, * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1188,26 +1143,26 @@ H5SM__incr_ref(void *record, void *_op_data, hbool_t *changed) FUNC_ENTER_PACKAGE - HDassert(record); - HDassert(op_data); - HDassert(changed); + assert(record); + assert(op_data); + assert(changed); /* If the message was previously shared in an object header, share * it in the heap now. */ if (message->location == H5SM_IN_OH) { - HDassert(op_data->key && op_data->key->fheap); + assert(op_data->key && op_data->key->fheap); /* Put the message in the heap and record its new heap ID */ if (H5HF_insert(op_data->key->fheap, op_data->key->encoding_size, op_data->key->encoding, &message->u.heap_loc.fheap_id) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to insert message into fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to insert message into fractal heap"); message->location = H5SM_IN_HEAP; message->u.heap_loc.ref_count = 2; } /* end if */ else { - HDassert(message->location == H5SM_IN_HEAP); + assert(message->location == H5SM_IN_HEAP); /* If it's already in the heap, just increment the ref count */ ++message->u.heap_loc.ref_count; } /* end else */ @@ -1250,9 +1205,6 @@ H5SM__incr_ref(void *record, void *_op_data, hbool_t *changed) * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Tuesday, May 2, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1274,21 +1226,21 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(header); - HDassert(header->index_type != H5SM_BADTYPE); - HDassert(cache_flags_ptr); + assert(header); + assert(header->index_type != H5SM_BADTYPE); + assert(cache_flags_ptr); /* Encode the message to be written */ if ((buf_size = H5O_msg_raw_size(f, type_id, TRUE, mesg)) == 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size") + HGOTO_ERROR(H5E_SOHM, H5E_BADSIZE, FAIL, "can't find message size"); if (NULL == (encoding_buf = H5MM_malloc(buf_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "can't allocate buffer for encoding"); if (H5O_msg_encode(f, type_id, TRUE, (unsigned char *)encoding_buf, mesg) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared") + HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, FAIL, "can't encode message to be shared"); /* Open the fractal heap for this index */ if (NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Set up a key for the message to be written */ key.file = f; @@ -1312,14 +1264,14 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t /* The index is a list; get it from the cache */ if (NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, defer ? H5AC__READ_ONLY_FLAG : H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index"); /* See if the message is already in the index and get its location. * Also record the first empty list position we find in case we need it * later. */ if (H5SM__find_in_list(list, &key, &empty_pos, &list_pos) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list"); if (defer) { if (list_pos != SIZE_MAX) @@ -1334,7 +1286,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t /* Put the message in the heap and record its new heap ID */ if (H5HF_insert(fheap, key.encoding_size, key.encoding, &shared.u.heap_id) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, - "unable to insert message into fractal heap") + "unable to insert message into fractal heap"); list->messages[list_pos].location = H5SM_IN_HEAP; list->messages[list_pos].u.heap_loc.fheap_id = shared.u.heap_id; @@ -1342,7 +1294,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t } /* end if */ else { /* If the message was already in the heap, increase its ref count */ - HDassert(list->messages[list_pos].location == H5SM_IN_HEAP); + assert(list->messages[list_pos].location == H5SM_IN_HEAP); ++(list->messages[list_pos].u.heap_loc.ref_count); } /* end else */ @@ -1354,11 +1306,11 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t } /* end if */ /* Index is a B-tree */ else { - HDassert(header->index_type == H5SM_BTREE); + assert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, header->index_addr, f))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index"); if (defer) { /* If this returns 0, it means that the message wasn't found. */ @@ -1367,7 +1319,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t * than 1 is always shared in the heap. */ if (H5B2_find(bt2, &key, &found, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "can't search for message in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "can't search for message in index"); } /* end if */ else { H5SM_incr_ref_opdata op_data; @@ -1403,7 +1355,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t * shared message is serialized. -QAK */ if (defer) - HDmemset(&shared.u, 0, sizeof(shared.u)); + memset(&shared.u, 0, sizeof(shared.u)); #endif /* H5_USING_MEMCHECKER */ } /* end if */ else { @@ -1413,7 +1365,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t /* Check if the message can be shared in another object's header */ if ((share_in_ohdr = H5O_msg_can_share_in_ohdr(type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "'share in ohdr' check returned error") + HGOTO_ERROR(H5E_SOHM, H5E_BADTYPE, FAIL, "'share in ohdr' check returned error"); /* If this message can be shared in an object header location, it is * "shareable" but not shared in the heap. @@ -1438,7 +1390,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t /* Retrieve any creation index from the native message */ if (H5O_msg_get_crt_index(type_id, mesg, &shared.u.loc.index) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "unable to retrieve creation index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "unable to retrieve creation index"); if (defer) shared.u.loc.oh_addr = HADDR_UNDEF; @@ -1458,7 +1410,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t if (!defer) { /* Put the message in the heap and record its new heap ID */ if (H5HF_insert(fheap, key.encoding_size, key.encoding, &shared.u.heap_id) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to insert message into fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to insert message into fractal heap"); key.message.location = H5SM_IN_HEAP; key.message.u.heap_loc.fheap_id = shared.u.heap_id; @@ -1473,7 +1425,7 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t /* Check whether the list has grown enough that it needs to become a B-tree */ if (header->index_type == H5SM_LIST && header->num_messages >= header->list_max) if (H5SM__convert_list_to_btree(f, header, &list, fheap, open_oh) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to convert list to B-tree") + HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to convert list to B-tree"); /* Insert the new message into the SOHM index */ if (header->index_type == H5SM_LIST) { @@ -1482,29 +1434,29 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t size_t pos; if (H5SM__find_in_list(list, NULL, &empty_pos, &pos) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list"); if (pos == SIZE_MAX || empty_pos == SIZE_MAX) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list"); } /* Insert message into list */ - HDassert(list->messages[empty_pos].location == H5SM_NO_LOC); - HDassert(key.message.location != H5SM_NO_LOC); + assert(list->messages[empty_pos].location == H5SM_NO_LOC); + assert(key.message.location != H5SM_NO_LOC); list->messages[empty_pos] = key.message; } /* end if */ /* Index is a B-tree */ else { - HDassert(header->index_type == H5SM_BTREE); + assert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree, if it isn't already */ if (NULL == bt2) { if (NULL == (bt2 = H5B2_open(f, header->index_addr, f))) HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, - "unable to open v2 B-tree for SOHM index") + "unable to open v2 B-tree for SOHM index"); } /* end if */ if (H5B2_insert(bt2, &key) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree"); } /* end else */ ++(header->num_messages); @@ -1518,19 +1470,19 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t /* Update the original message's shared component */ if (H5O_msg_set_share(type_id, &shared, mesg) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADMESG, FAIL, "unable to set sharing information") + HGOTO_ERROR(H5E_SOHM, H5E_BADMESG, FAIL, "unable to set sharing information"); done: /* Release the fractal heap & v2 B-tree if we opened them */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index"); /* If we got a list out of the cache, release it (it is always dirty after writing a message) */ if (list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, defer ? H5AC__NO_FLAGS_SET : H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index"); if (encoding_buf) encoding_buf = H5MM_xfree(encoding_buf); @@ -1551,9 +1503,6 @@ H5SM__write_mesg(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, hbool_t * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Tuesday, May 2, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1571,9 +1520,9 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) - HDassert(f); - HDassert(H5F_addr_defined(H5F_SOHM_ADDR(f))); - HDassert(sh_mesg); + assert(f); + assert(H5_addr_defined(H5F_SOHM_ADDR(f))); + assert(sh_mesg); /* Get message type */ type_id = sh_mesg->msg_type_id; @@ -1584,11 +1533,11 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) /* Look up the master SOHM table */ if (NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); /* Find the correct index and try to delete from it */ if ((index_num = H5SM__get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index"); /* If mesg_buf is not NULL, the message's reference count has reached * zero and any file space it uses needs to be freed. mesg_buf holds the @@ -1596,11 +1545,11 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) */ if (H5SM__delete_from_index(f, open_oh, &(table->indexes[index_num]), sh_mesg, &cache_flags, &mesg_size, &mesg_buf) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete message from SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "unable to delete message from SOHM index"); /* Release the master SOHM table */ if (H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); table = NULL; /* If buf was allocated, delete the message it holds. This message may @@ -1610,16 +1559,16 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) if (mesg_buf) { if (NULL == (native_mesg = H5O_msg_decode(f, open_oh, type_id, mesg_size, (const unsigned char *)mesg_buf))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTDECODE, FAIL, "can't decode shared message.") + HGOTO_ERROR(H5E_SOHM, H5E_CANTDECODE, FAIL, "can't decode shared message."); if (H5O_msg_delete(f, open_oh, type_id, native_mesg) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTFREE, FAIL, "can't delete shared message.") + HGOTO_ERROR(H5E_SOHM, H5E_CANTFREE, FAIL, "can't delete shared message."); } /* end if */ done: /* Release the master SOHM table (should only happen on error) */ if (table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, cache_flags) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); /* Release any native message we decoded */ if (native_mesg) @@ -1653,9 +1602,6 @@ H5SM_delete(H5F_t *f, H5O_t *open_oh, H5O_shared_t *sh_mesg) * Failure: FAIL * pos & empty_pos indeterminate * - * Programmer: James Laird - * Tuesday, May 2, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1666,9 +1612,9 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t * FUNC_ENTER_PACKAGE - HDassert(list); + assert(list); /* Both key and empty_pos can be NULL, but not both! */ - HDassert(key || empty_pos); + assert(key || empty_pos); /* Initialize empty_pos to an invalid value */ if (empty_pos) @@ -1682,11 +1628,11 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t * int cmp; if (H5SM__message_compare(key, &(list->messages[x]), &cmp) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTCOMPARE, FAIL, "can't compare message records") + HGOTO_ERROR(H5E_SOHM, H5E_CANTCOMPARE, FAIL, "can't compare message records"); if (0 == cmp) { *pos = x; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } } else if (empty_pos && list->messages[x].location == H5SM_NO_LOC) { @@ -1719,9 +1665,6 @@ H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t * * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1731,9 +1674,9 @@ H5SM__decr_ref(void *record, void *op_data, hbool_t *changed) FUNC_ENTER_PACKAGE_NOERR - HDassert(record); - HDassert(op_data); - HDassert(changed); + assert(record); + assert(op_data); + assert(changed); /* Adjust the message's reference count if it's stored in the heap. * Messages stored in object headers always have refcounts of 1, @@ -1762,9 +1705,6 @@ H5SM__decr_ref(void *record, void *op_data, hbool_t *changed) * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Tuesday, May 2, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -1785,18 +1725,18 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(header); - HDassert(mesg); - HDassert(cache_flags); - HDassert(*encoded_mesg == NULL); + assert(f); + assert(header); + assert(mesg); + assert(cache_flags); + assert(*encoded_mesg == NULL); /* Get the message type for later */ type_id = mesg->msg_type_id; /* Open the heap for this type of message. */ if (NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Get the message size and encoded message for the message to be deleted, * either from its OH or from the heap. @@ -1815,7 +1755,7 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c /* Get the encoded message */ if (H5SM__read_mesg(f, &key.message, fheap, open_oh, &buf_size, &encoding_buf) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Set up key for message to be deleted. */ key.file = f; @@ -1836,13 +1776,13 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c /* If the index is stored as a list, get it from the cache */ if (NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &cache_udata, H5AC__NO_FLAGS_SET))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index"); /* Find the message in the list */ if (H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list"); if (list_pos == SIZE_MAX) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index"); if (list->messages[list_pos].location == H5SM_IN_HEAP) --(list->messages[list_pos].u.heap_loc.ref_count); @@ -1852,17 +1792,17 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c } /* end if */ else { /* Index is a B-tree */ - HDassert(header->index_type == H5SM_BTREE); + assert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, header->index_addr, f))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index"); /* If this returns failure, it means that the message wasn't found. * If it succeeds, a copy of the modified message will be returned. */ if (H5B2_modify(bt2, &key, H5SM__decr_ref, &message) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index"); /* Point to the message */ message_ptr = &message; @@ -1886,17 +1826,17 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c /* Open the index v2 B-tree, if it isn't already */ if (NULL == bt2) { if (NULL == (bt2 = H5B2_open(f, header->index_addr, f))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index"); } /* end if */ if (H5B2_remove(bt2, &key, NULL, NULL) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to delete message from index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to delete message from index"); } /* end else */ /* Remove the message from the heap if it was stored in the heap*/ if (old_loc == H5SM_IN_HEAP) if (H5HF_remove(fheap, &(message_ptr->u.heap_loc.fheap_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to remove message from heap"); /* Return the message's encoding so anything it references can be freed */ *encoded_mesg = encoding_buf; @@ -1908,37 +1848,37 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c /* Unprotect cache and release heap */ if (list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release SOHM list"); list = NULL; - HDassert(fheap); + assert(fheap); if (H5HF_close(fheap) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap"); fheap = NULL; /* Delete the index and its heap */ if (H5SM__delete_index(f, header, TRUE) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "can't delete empty index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTDELETE, FAIL, "can't delete empty index"); } /* end if */ else if (header->index_type == H5SM_BTREE && header->num_messages < header->btree_min) { /* Otherwise, if we've just passed the btree-to-list cutoff, convert * this B-tree into a list */ if (H5SM__convert_btree_to_list(f, header) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to convert btree to list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTINIT, FAIL, "unable to convert btree to list"); } /* end if */ } /* end if */ done: /* Release the SOHM list */ if (list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__DIRTIED_FLAG) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index"); /* Release the fractal heap & v2 B-tree if we opened them */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index"); /* Free the message encoding, if we're not returning it in encoded_mesg * or if there's been an error. @@ -1958,9 +1898,6 @@ H5SM__delete_from_index(H5F_t *f, H5O_t *open_oh, H5SM_index_header_t *header, c * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Thursday, May 11, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -1977,13 +1914,13 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) /* Sanity check */ - HDassert(ext_loc); - HDassert(f); - HDassert(fc_plist); + assert(ext_loc); + assert(f); + assert(fc_plist); /* Check for the extension having a 'shared message info' message */ if ((status = H5O_msg_exists(ext_loc, H5O_SHMESG_ID)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "unable to read object header"); if (status) { H5SM_table_cache_ud_t cache_udata; /* User-data for callback */ unsigned index_flags[H5O_SHMESG_MAX_NINDEXES]; /* Message flags for each index */ @@ -1994,18 +1931,18 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) /* Retrieve the 'shared message info' structure */ if (NULL == H5O_msg_read(ext_loc, H5O_SHMESG_ID, &sohm_table)) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "shared message info message not present") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "shared message info message not present"); /* Portably initialize the arrays */ - HDmemset(index_flags, 0, sizeof(index_flags)); - HDmemset(minsizes, 0, sizeof(minsizes)); + memset(index_flags, 0, sizeof(index_flags)); + memset(minsizes, 0, sizeof(minsizes)); /* Set SOHM info from file */ H5F_SET_SOHM_ADDR(f, sohm_table.addr); H5F_SET_SOHM_VERS(f, sohm_table.version); H5F_SET_SOHM_NINDEXES(f, sohm_table.nindexes); - HDassert(H5F_addr_defined(H5F_SOHM_ADDR(f))); - HDassert(H5F_SOHM_NINDEXES(f) > 0 && H5F_SOHM_NINDEXES(f) <= H5O_SHMESG_MAX_NINDEXES); + assert(H5_addr_defined(H5F_SOHM_ADDR(f))); + assert(H5F_SOHM_NINDEXES(f) > 0 && H5F_SOHM_NINDEXES(f) <= H5O_SHMESG_MAX_NINDEXES); /* Set up user data for callback */ cache_udata.f = f; @@ -2016,7 +1953,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) /* Read the rest of the SOHM table information from the cache */ if (NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); /* Get index conversion limits */ sohm_l2b = (unsigned)table->indexes[0].list_max; @@ -2029,8 +1966,8 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) minsizes[u] = (unsigned)table->indexes[u].min_mesg_size; /* Sanity check */ - HDassert(sohm_l2b == table->indexes[u].list_max); - HDassert(sohm_b2l == table->indexes[u].btree_min); + assert(sohm_l2b == table->indexes[u].list_max); + assert(sohm_b2l == table->indexes[u].btree_min); /* Check for sharing attributes in this file, which means that creation * indices must be tracked on object header message in the file. @@ -2042,15 +1979,15 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) /* Set values in the property list */ tmp_sohm_nindexes = H5F_SOHM_NINDEXES(f); if (H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &tmp_sohm_nindexes) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set number of SOHM indexes") + HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set number of SOHM indexes"); if (H5P_set(fc_plist, H5F_CRT_SHMSG_INDEX_TYPES_NAME, index_flags) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set type flags for indexes") + HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set type flags for indexes"); if (H5P_set(fc_plist, H5F_CRT_SHMSG_INDEX_MINSIZE_NAME, minsizes) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set type flags for indexes") + HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set type flags for indexes"); if (H5P_set(fc_plist, H5F_CRT_SHMSG_LIST_MAX_NAME, &sohm_l2b) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list"); if (H5P_set(fc_plist, H5F_CRT_SHMSG_BTREE_MIN_NAME, &sohm_b2l) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't set SOHM cutoff in property list"); } /* end if */ else { /* No SOHM info in file */ @@ -2061,7 +1998,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) /* Shared object header messages are disabled */ tmp_sohm_nindexes = H5F_SOHM_NINDEXES(f); if (H5P_set(fc_plist, H5F_CRT_SHMSG_NINDEXES_NAME, &tmp_sohm_nindexes) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set number of SOHM indexes") + HGOTO_ERROR(H5E_SOHM, H5E_CANTSET, FAIL, "can't set number of SOHM indexes"); } /* end else */ done: @@ -2071,7 +2008,7 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) /* Release the master SOHM table if we took it out of the cache */ if (table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_get_info() */ @@ -2084,9 +2021,6 @@ H5SM_get_info(const H5O_loc_t *ext_loc, H5P_genplist_t *fc_plist) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, December 18, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2095,7 +2029,7 @@ H5SM_reconstitute(H5O_shared_t *sh_mesg, H5F_t *f, unsigned msg_type_id, H5O_fhe FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check args */ - HDassert(sh_mesg); + assert(sh_mesg); /* Set flag for shared message */ sh_mesg->type = H5O_SHARE_TYPE_SOHM; @@ -2113,9 +2047,6 @@ H5SM_reconstitute(H5O_shared_t *sh_mesg, H5F_t *f, unsigned msg_type_id, H5O_fhe * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, December 19, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2129,8 +2060,8 @@ H5SM__get_refcount_bt2_cb(const void *_record, void *_op_data) /* * Check arguments. */ - HDassert(record); - HDassert(op_data); + assert(record); + assert(op_data); /* Make a copy of the record */ *op_data = *record; @@ -2145,9 +2076,6 @@ H5SM__get_refcount_bt2_cb(const void *_record, void *_op_data) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, December 19, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2169,9 +2097,9 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize FUNC_ENTER_NOAPI_NOINIT_TAG(H5AC__SOHM_TAG) /* Sanity check */ - HDassert(f); - HDassert(sh_mesg); - HDassert(ref_count); + assert(f); + assert(sh_mesg); + assert(ref_count); /* Set up user data for callback */ tbl_cache_udata.f = f; @@ -2179,16 +2107,16 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize /* Look up the master SOHM table */ if (NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &tbl_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); /* Find the correct index and find the message in it */ if ((index_num = H5SM__get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index"); header = &(table->indexes[index_num]); /* Open the heap for this message type */ if (NULL == (fheap = H5HF_open(f, header->heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Set up a SOHM message to correspond to the shared message passed in */ key.message.location = H5SM_IN_HEAP; @@ -2197,7 +2125,7 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize /* Get the encoded message */ if (H5SM__read_mesg(f, &key.message, fheap, NULL, &buf_size, &encoding_buf) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Set up key for message to locate */ key.file = f; @@ -2218,13 +2146,13 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize /* If the index is stored as a list, get it from the cache */ if (NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, header->index_addr, &lst_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index"); /* Find the message in the list */ if (H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list"); if (list_pos == SIZE_MAX) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index"); /* Copy the message */ message = list->messages[list_pos]; @@ -2233,34 +2161,34 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize hbool_t msg_exists; /* Whether the message exists in the v2 B-tree */ /* Index is a B-tree */ - HDassert(header->index_type == H5SM_BTREE); + assert(header->index_type == H5SM_BTREE); /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, header->index_addr, f))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index"); /* Look up the message in the v2 B-tree */ msg_exists = FALSE; if (H5B2_find(bt2, &key, &msg_exists, H5SM__get_refcount_bt2_cb, &message) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "error finding message in index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "error finding message in index"); if (!msg_exists) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index"); } /* end else */ /* Set the refcount for the message */ - HDassert(message.location == H5SM_IN_HEAP); + assert(message.location == H5SM_IN_HEAP); *ref_count = message.u.heap_loc.ref_count; done: /* Release resources */ if (list && H5AC_unprotect(f, H5AC_SOHM_LIST, header->index_addr, list, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index"); if (table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index"); if (encoding_buf) encoding_buf = H5MM_xfree(encoding_buf); @@ -2280,9 +2208,6 @@ H5SM_get_refcount(H5F_t *f, unsigned type_id, const H5O_shared_t *sh_mesg, hsize * value returned in udata) * negative on error * - * Programmer: James Laird - * Wednesday, February 21, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2297,25 +2222,26 @@ H5SM__read_iter_op(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, /* * Check arguments. */ - HDassert(oh); - HDassert(mesg); - HDassert(udata); - HDassert(NULL == udata->encoding_buf); + assert(oh); + assert(mesg); + assert(udata); + assert(NULL == udata->encoding_buf); /* Check the creation index for this message */ if (sequence == udata->idx) { /* Check if the message is dirty & flush it to the object header if so */ if (mesg->dirty) if (H5O_msg_flush(udata->file, oh, mesg) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, H5_ITER_ERROR, "unable to encode object header message") + HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, H5_ITER_ERROR, + "unable to encode object header message"); /* Get the message's encoded size */ udata->buf_size = mesg->raw_size; - HDassert(udata->buf_size); + assert(udata->buf_size); /* Allocate buffer to return the message in */ if (NULL == (udata->encoding_buf = H5MM_malloc(udata->buf_size))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed"); /* Copy the encoded message into the buffer to return */ H5MM_memcpy(udata->encoding_buf, mesg->raw, udata->buf_size); @@ -2337,9 +2263,6 @@ H5SM__read_iter_op(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, * * Return: Negative on error, non-negative on success * - * Programmer: Quincey Koziol - * Tuesday, June 26, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -2352,7 +2275,7 @@ H5SM__read_mesg_fh_cb(const void *obj, size_t obj_len, void *_udata) /* Allocate a buffer to hold the message */ if (NULL == (udata->encoding_buf = H5MM_malloc(obj_len))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Copy the message from the heap */ H5MM_memcpy(udata->encoding_buf, obj, obj_len); @@ -2370,9 +2293,6 @@ H5SM__read_mesg_fh_cb(const void *obj, size_t obj_len, void *_udata) * * Return: Non-negative on success/negative on error * - * Programmer: James Laird - * Wednesday, February 21, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -2386,9 +2306,9 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *open_oh FUNC_ENTER_PACKAGE - HDassert(f); - HDassert(mesg); - HDassert(fheap); + assert(f); + assert(mesg); + assert(fheap); /* Set up user data for message iteration */ udata.file = f; @@ -2405,22 +2325,22 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *open_oh H5O_mesg_operator_t op; /* Wrapper for operator */ type = H5O_msg_class_g[mesg->msg_type_id]; /* map the type ID to the actual type object */ - HDassert(type); + assert(type); /* Reset object location for operation */ if (H5O_loc_reset(&oloc) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTRESET, FAIL, "unable to initialize location") + HGOTO_ERROR(H5E_SOHM, H5E_CANTRESET, FAIL, "unable to initialize location"); if (NULL == open_oh || mesg->u.mesg_loc.oh_addr != H5O_OH_GET_ADDR(open_oh)) { /* Open the object in the file */ oloc.file = f; oloc.addr = mesg->u.mesg_loc.oh_addr; if (H5O_open(&oloc) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to open object header"); /* Load the object header from the cache */ if (NULL == (oh = H5O_protect(&oloc, H5AC__READ_ONLY_FLAG, FALSE))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header"); } /* end if */ else oh = open_oh; @@ -2429,17 +2349,17 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *open_oh op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5SM__read_iter_op; if ((ret_value = H5O__msg_iterate_real(f, oh, type, &op, &udata)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_BADITER, FAIL, "unable to iterate over object header messages") + HGOTO_ERROR(H5E_SOHM, H5E_BADITER, FAIL, "unable to iterate over object header messages"); } /* end if */ else { - HDassert(mesg->location == H5SM_IN_HEAP); + assert(mesg->location == H5SM_IN_HEAP); /* Copy the message from the heap */ if (H5HF_op(fheap, &(mesg->u.heap_loc.fheap_id), H5SM__read_mesg_fh_cb, &udata) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "can't read message from fractal heap.") + HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "can't read message from fractal heap."); } /* end else */ - HDassert(udata.encoding_buf); - HDassert(udata.buf_size); + assert(udata.encoding_buf); + assert(udata.buf_size); /* Record the returned values */ *encoded_mesg = udata.encoding_buf; @@ -2449,9 +2369,9 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *open_oh /* Close the object header if we opened one and had an error */ if (oh && oh != open_oh) { if (oh && H5O_unprotect(&oloc, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to release object header"); if (H5O_close(&oloc, NULL) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close object header") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close object header"); } /* end if */ /* Release the encoding buffer on error */ @@ -2468,9 +2388,6 @@ H5SM__read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, H5O_t *open_oh * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * November 6, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2479,8 +2396,8 @@ H5SM__table_free(H5SM_master_table_t *table) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(table); - HDassert(table->indexes); + assert(table); + assert(table->indexes); table->indexes = H5FL_ARR_FREE(H5SM_index_header_t, table->indexes); @@ -2496,9 +2413,6 @@ H5SM__table_free(H5SM_master_table_t *table) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * November 6, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -2506,8 +2420,8 @@ H5SM__list_free(H5SM_list_t *list) { FUNC_ENTER_PACKAGE_NOERR - HDassert(list); - HDassert(list->messages); + assert(list); + assert(list->messages); list->messages = H5FL_ARR_FREE(H5SM_sohm_t, list->messages); @@ -2526,9 +2440,6 @@ H5SM__list_free(H5SM_list_t *list) * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Thursday, January 18, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2542,11 +2453,11 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) - HDassert(f); - HDassert(table_addr != HADDR_UNDEF); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(table_addr != HADDR_UNDEF); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* If table_vers and num_indexes are UINT_MAX, replace them with values from * userblock @@ -2554,18 +2465,18 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi if (table_vers == UINT_MAX) table_vers = H5F_SOHM_VERS(f); else if (table_vers != H5F_SOHM_VERS(f)) - HDfprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n"); + fprintf(stream, "*** SOHM TABLE VERSION DOESN'T MATCH VERSION IN SUPERBLOCK!\n"); if (num_indexes == UINT_MAX) num_indexes = H5F_SOHM_NINDEXES(f); else if (num_indexes != H5F_SOHM_NINDEXES(f)) - HDfprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n"); + fprintf(stream, "*** NUMBER OF SOHM INDEXES DOESN'T MATCH VALUE IN SUPERBLOCK!\n"); /* Check arguments. Version must be 0, the only version implemented so far */ if (table_vers > HDF5_SHAREDHEADER_VERSION) - HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "unknown shared message table version") + HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "unknown shared message table version"); if (num_indexes == 0 || num_indexes > H5O_SHMESG_MAX_NINDEXES) HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, - "number of indexes must be between 1 and H5O_SHMESG_MAX_NINDEXES") + "number of indexes must be between 1 and H5O_SHMESG_MAX_NINDEXES"); /* Set up user data for callback */ cache_udata.f = f; @@ -2573,35 +2484,35 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi /* Look up the master SOHM table */ if (NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, table_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); - HDfprintf(stream, "%*sShared Message Master Table...\n", indent, ""); + fprintf(stream, "%*sShared Message Master Table...\n", indent, ""); for (x = 0; x < num_indexes; ++x) { - HDfprintf(stream, "%*sIndex %d...\n", indent, "", x); - HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "SOHM Index Type:", - (table->indexes[x].index_type == H5SM_LIST - ? "List" - : (table->indexes[x].index_type == H5SM_BTREE ? "B-Tree" : "Unknown"))); - - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, - "Address of index:", table->indexes[x].index_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, - "Address of index's heap:", table->indexes[x].heap_addr); - HDfprintf(stream, "%*s%-*s 0x%08x\n", indent + 3, "", fwidth, - "Message type flags:", table->indexes[x].mesg_types); - HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, - "Minimum size of messages:", table->indexes[x].min_mesg_size); - HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, - "Number of messages:", table->indexes[x].num_messages); - HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, - "Maximum list size:", table->indexes[x].list_max); - HDfprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, - "Minimum B-tree size:", table->indexes[x].btree_min); + fprintf(stream, "%*sIndex %d...\n", indent, "", x); + fprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "SOHM Index Type:", + (table->indexes[x].index_type == H5SM_LIST + ? "List" + : (table->indexes[x].index_type == H5SM_BTREE ? "B-Tree" : "Unknown"))); + + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, + "Address of index:", table->indexes[x].index_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, + "Address of index's heap:", table->indexes[x].heap_addr); + fprintf(stream, "%*s%-*s 0x%08x\n", indent + 3, "", fwidth, + "Message type flags:", table->indexes[x].mesg_types); + fprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, + "Minimum size of messages:", table->indexes[x].min_mesg_size); + fprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, + "Number of messages:", table->indexes[x].num_messages); + fprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, + "Maximum list size:", table->indexes[x].list_max); + fprintf(stream, "%*s%-*s %zu\n", indent + 3, "", fwidth, + "Minimum B-tree size:", table->indexes[x].btree_min); } /* end for */ done: if (table && H5AC_unprotect(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_table_debug() */ @@ -2615,9 +2526,6 @@ H5SM_table_debug(H5F_t *f, haddr_t table_addr, FILE *stream, int indent, int fwi * * Return: Non-negative on success/Negative on failure * - * Programmer: James Laird - * Thursday, January 18, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2634,11 +2542,11 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidt FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) - HDassert(f); - HDassert(list_addr != HADDR_UNDEF); - HDassert(stream); - HDassert(indent >= 0); - HDassert(fwidth >= 0); + assert(f); + assert(list_addr != HADDR_UNDEF); + assert(stream); + assert(indent >= 0); + assert(fwidth >= 0); /* Set up user data for callback */ tbl_cache_udata.f = f; @@ -2646,19 +2554,19 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidt /* Look up the master SOHM table */ if (NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, table_addr, &tbl_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); /* Determine which index the list is part of */ index_num = table->num_indexes; for (x = 0; x < table->num_indexes; x++) { - if (H5F_addr_eq(table->indexes[x].index_addr, list_addr)) { + if (H5_addr_eq(table->indexes[x].index_addr, list_addr)) { index_num = x; break; } /* end if */ } /* end for */ if (x == table->num_indexes) HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, - "list address doesn't match address for any indices in table") + "list address doesn't match address for any indices in table"); /* Set up user data for metadata cache callback */ lst_cache_udata.f = f; @@ -2667,47 +2575,47 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidt /* Get the list from the cache */ if (NULL == (list = (H5SM_list_t *)H5AC_protect(f, H5AC_SOHM_LIST, list_addr, &lst_cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index"); /* Open the heap, if one exists */ - if (H5F_addr_defined(table->indexes[index_num].heap_addr)) + if (H5_addr_defined(table->indexes[index_num].heap_addr)) if (NULL == (fh = H5HF_open(f, table->indexes[index_num].heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open SOHM heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open SOHM heap"); - HDfprintf(stream, "%*sShared Message List Index...\n", indent, ""); + fprintf(stream, "%*sShared Message List Index...\n", indent, ""); for (x = 0; x < table->indexes[index_num].num_messages; ++x) { - HDfprintf(stream, "%*sShared Object Header Message %d...\n", indent, "", x); - HDfprintf(stream, "%*s%-*s %08lu\n", indent + 3, "", fwidth, - "Hash value:", (unsigned long)list->messages[x].hash); + fprintf(stream, "%*sShared Object Header Message %d...\n", indent, "", x); + fprintf(stream, "%*s%-*s %08lu\n", indent + 3, "", fwidth, + "Hash value:", (unsigned long)list->messages[x].hash); if (list->messages[x].location == H5SM_IN_HEAP) { - HDassert(fh); + assert(fh); - HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in heap"); - HDfprintf(stream, "%*s%-*s 0x%" PRIx64 "\n", indent + 3, "", fwidth, - "Heap ID:", list->messages[x].u.heap_loc.fheap_id.val); - HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent + 3, "", fwidth, - "Reference count:", list->messages[x].u.heap_loc.ref_count); + fprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in heap"); + fprintf(stream, "%*s%-*s 0x%" PRIx64 "\n", indent + 3, "", fwidth, + "Heap ID:", list->messages[x].u.heap_loc.fheap_id.val); + fprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent + 3, "", fwidth, + "Reference count:", list->messages[x].u.heap_loc.ref_count); } /* end if */ else if (list->messages[x].location == H5SM_IN_OH) { - HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in object header"); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, - "Object header address:", list->messages[x].u.mesg_loc.oh_addr); - HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, - "Message creation index:", list->messages[x].u.mesg_loc.oh_addr); - HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth, - "Message type ID:", list->messages[x].msg_type_id); + fprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "in object header"); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, + "Object header address:", list->messages[x].u.mesg_loc.oh_addr); + fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent + 3, "", fwidth, + "Message creation index:", list->messages[x].u.mesg_loc.oh_addr); + fprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth, + "Message type ID:", list->messages[x].msg_type_id); } /* end if */ else - HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "invalid"); + fprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth, "Location:", "invalid"); } /* end for */ done: if (fh && H5HF_close(fh) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap"); if (list && H5AC_unprotect(f, H5AC_SOHM_LIST, list_addr, list, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index"); if (table && H5AC_unprotect(f, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_list_debug() */ @@ -2723,9 +2631,6 @@ H5SM_list_debug(H5F_t *f, haddr_t list_addr, FILE *stream, int indent, int fwidt * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi - * June 19, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -2741,10 +2646,10 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) FUNC_ENTER_NOAPI_TAG(H5AC__SOHM_TAG, FAIL) /* Sanity check */ - HDassert(f); - HDassert(H5F_addr_defined(H5F_SOHM_ADDR(f))); - HDassert(hdr_size); - HDassert(ih_info); + assert(f); + assert(H5_addr_defined(H5F_SOHM_ADDR(f))); + assert(hdr_size); + assert(ih_info); /* Set up user data for callback */ cache_udata.f = f; @@ -2752,7 +2657,7 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) /* Look up the master SOHM table */ if (NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); /* Get SOHM header size */ *hdr_size = table->table_size; @@ -2761,38 +2666,38 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) for (u = 0; u < table->num_indexes; u++) { /* Get index storage size (for either B-tree or list) */ if (table->indexes[u].index_type == H5SM_BTREE) { - if (H5F_addr_defined(table->indexes[u].index_addr)) { + if (H5_addr_defined(table->indexes[u].index_addr)) { /* Open the index v2 B-tree */ if (NULL == (bt2 = H5B2_open(f, table->indexes[u].index_addr, f))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index"); if (H5B2_size(bt2, &(ih_info->index_size)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info"); /* Close the v2 B-tree */ if (H5B2_close(bt2) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index"); bt2 = NULL; } /* end if */ } /* end if */ else { - HDassert(table->indexes[u].index_type == H5SM_LIST); + assert(table->indexes[u].index_type == H5SM_LIST); ih_info->index_size += table->indexes[u].list_size; } /* end else */ /* Check for heap for this index */ - if (H5F_addr_defined(table->indexes[u].heap_addr)) { + if (H5_addr_defined(table->indexes[u].heap_addr)) { /* Open the fractal heap for this index */ if (NULL == (fheap = H5HF_open(f, table->indexes[u].heap_addr))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open fractal heap"); /* Get heap storage size */ if (H5HF_size(fheap, &(ih_info->heap_size)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info") + HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve fractal heap storage info"); /* Close the fractal heap */ if (H5HF_close(fheap) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") + HGOTO_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap"); fheap = NULL; } /* end if */ } /* end for */ @@ -2800,11 +2705,11 @@ H5SM_ih_size(H5F_t *f, hsize_t *hdr_size, H5_ih_info_t *ih_info) done: /* Release resources */ if (fheap && H5HF_close(fheap) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close fractal heap"); if (bt2 && H5B2_close(bt2) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index") + HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for SOHM index"); if (table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM_ih_size() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5SMbtree2.c b/externals/coda-oss/modules/drivers/hdf5/source/H5SMbtree2.c index 4ab4671e96..d021a482cb 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5SMbtree2.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5SMbtree2.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -78,9 +77,6 @@ H5FL_DEFINE_STATIC(H5SM_bt2_ctx_t); * Return: Success: non-NULL * Failure: NULL * - * Programmer: Quincey Koziol - * Thursday, November 26, 2009 - * *------------------------------------------------------------------------- */ static void * @@ -93,11 +89,11 @@ H5SM__bt2_crt_context(void *_f) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); + assert(f); /* Allocate callback context */ if (NULL == (ctx = H5FL_MALLOC(H5SM_bt2_ctx_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context"); /* Determine the size of addresses & lengths in the file */ ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); @@ -117,9 +113,6 @@ H5SM__bt2_crt_context(void *_f) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Thursday, November 26, 2009 - * *------------------------------------------------------------------------- */ static herr_t @@ -130,7 +123,7 @@ H5SM__bt2_dst_context(void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); /* Release callback context */ ctx = H5FL_FREE(H5SM_bt2_ctx_t, ctx); @@ -148,9 +141,6 @@ H5SM__bt2_dst_context(void *_ctx) * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -174,9 +164,6 @@ H5SM__bt2_store(void *native, const void *udata) * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static herr_t @@ -187,14 +174,14 @@ H5SM__bt2_debug(FILE *stream, int indent, int fwidth, const void *record, const FUNC_ENTER_PACKAGE_NOERR if (sohm->location == H5SM_IN_HEAP) - HDfprintf(stream, "%*s%-*s {%" PRIu64 ", %" PRIo32 ", %" PRIxHSIZE "}\n", indent, "", fwidth, - "Shared Message in heap:", sohm->u.heap_loc.fheap_id.val, sohm->hash, - sohm->u.heap_loc.ref_count); + fprintf(stream, "%*s%-*s {%" PRIu64 ", %" PRIo32 ", %" PRIxHSIZE "}\n", indent, "", fwidth, + "Shared Message in heap:", sohm->u.heap_loc.fheap_id.val, sohm->hash, + sohm->u.heap_loc.ref_count); else { - HDassert(sohm->location == H5SM_IN_OH); - HDfprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIo32 ", %x, %" PRIx32 "}\n", indent, "", fwidth, - "Shared Message in OH:", sohm->u.mesg_loc.oh_addr, sohm->hash, sohm->msg_type_id, - sohm->u.mesg_loc.index); + assert(sohm->location == H5SM_IN_OH); + fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %" PRIo32 ", %x, %" PRIx32 "}\n", indent, "", fwidth, + "Shared Message in OH:", sohm->u.mesg_loc.oh_addr, sohm->hash, sohm->msg_type_id, + sohm->u.mesg_loc.index); } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5SMcache.c b/externals/coda-oss/modules/drivers/hdf5/source/H5SMcache.c index 2920a1cfe1..f12f5be7b4 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5SMcache.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5SMcache.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5SMcache.c - * Nov 13 2006 - * James Laird * * Purpose: Implement shared message metadata cache methods. * @@ -122,9 +119,6 @@ const H5AC_class_t H5AC_SOHM_LIST[1] = {{ * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -135,9 +129,9 @@ H5SM__cache_table_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->f); - HDassert(image_len); + assert(udata); + assert(udata->f); + assert(image_len); /* Set the image length size */ *image_len = H5SM_TABLE_SIZE(udata->f); @@ -154,8 +148,6 @@ H5SM__cache_table_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ htri_t @@ -169,7 +161,7 @@ H5SM__cache_table_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); + assert(image); /* Get stored and computed checksums */ H5F_get_checksums(image, len, &stored_chksum, &computed_chksum); @@ -191,9 +183,6 @@ H5SM__cache_table_verify_chksum(const void *_image, size_t len, void H5_ATTR_UNU * Return: Success: Pointer to in core representation * Failure: NULL * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static void * @@ -211,47 +200,47 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(len > 0); - HDassert(udata); - HDassert(udata->f); + assert(image); + assert(len > 0); + assert(udata); + assert(udata->f); f = udata->f; - HDassert(dirty); + assert(dirty); /* Verify that we're reading version 0 of the table; this is the only * version defined so far. */ - HDassert(H5F_SOHM_VERS(f) == HDF5_SHAREDHEADER_VERSION); + assert(H5F_SOHM_VERS(f) == HDF5_SHAREDHEADER_VERSION); /* Allocate space for the master table in memory */ if (NULL == (table = H5FL_CALLOC(H5SM_master_table_t))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed"); /* Read number of indexes and version from file superblock */ table->num_indexes = H5F_SOHM_NINDEXES(f); - HDassert(table->num_indexes > 0); + assert(table->num_indexes > 0); /* Compute the size of the SOHM table header on disk. This is the "table" * itself plus each index within the table */ table->table_size = H5SM_TABLE_SIZE(f); - HDassert(table->table_size == len); + assert(table->table_size == len); /* Check magic number */ - if (HDmemcmp(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM table signature") + if (memcmp(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM table signature"); image += H5_SIZEOF_MAGIC; /* Allocate space for the index headers in memory*/ if (NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed for SOHM indexes"); /* Read in the index headers */ for (u = 0; u < table->num_indexes; ++u) { /* Verify correct version of index list */ if (H5SM_LIST_VERSION != *image++) - HGOTO_ERROR(H5E_SOHM, H5E_VERSION, NULL, "bad shared message list version number") + HGOTO_ERROR(H5E_SOHM, H5E_VERSION, NULL, "bad shared message list version number"); /* Type of the index (list or B-tree) */ table->indexes[u].index_type = (H5SM_index_type_t)*image++; @@ -287,7 +276,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) == table->table_size); + assert((size_t)(image - (const uint8_t *)_image) == table->table_size); /* Set return value */ ret_value = table; @@ -295,7 +284,7 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l done: if (!ret_value && table) if (H5SM__table_free(table) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTFREE, NULL, "unable to destroy sohm table") + HDONE_ERROR(H5E_SOHM, H5E_CANTFREE, NULL, "unable to destroy sohm table"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5SM__cache_table_deserialize() */ @@ -310,9 +299,6 @@ H5SM__cache_table_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED l * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -324,10 +310,9 @@ H5SM__cache_table_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(table); - HDassert(table->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(table->cache_info.type == H5AC_SOHM_TABLE); - HDassert(image_len); + assert(table); + assert(table->cache_info.type == H5AC_SOHM_TABLE); + assert(image_len); *image_len = table->table_size; @@ -343,9 +328,6 @@ H5SM__cache_table_image_len(const void *_thing, size_t *image_len) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -359,17 +341,16 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_ FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(table); - HDassert(table->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(table->cache_info.type == H5AC_SOHM_TABLE); - HDassert(table->table_size == len); + assert(f); + assert(image); + assert(table); + assert(table->cache_info.type == H5AC_SOHM_TABLE); + assert(table->table_size == len); /* Verify that we're writing version 0 of the table; this is the only * version defined so far. */ - HDassert(H5F_SOHM_VERS(f) == HDF5_SHAREDHEADER_VERSION); + assert(H5F_SOHM_VERS(f) == HDF5_SHAREDHEADER_VERSION); /* Encode magic number */ H5MM_memcpy(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -410,7 +391,7 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_ UINT32ENCODE(image, computed_chksum); /* sanity check */ - HDassert((size_t)(image - ((uint8_t *)_image)) == table->table_size); + assert((size_t)(image - ((uint8_t *)_image)) == table->table_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM__cache_table_serialize() */ @@ -424,16 +405,9 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_ * * Purpose: Free memory used by the SOHM table. * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -445,13 +419,12 @@ H5SM__cache_table_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(table); - HDassert(table->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(table->cache_info.type == H5AC_SOHM_TABLE); + assert(table); + assert(table->cache_info.type == H5AC_SOHM_TABLE); /* Destroy Shared Object Header Message table */ if (H5SM__table_free(table) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to free shared message table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to free shared message table"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -467,9 +440,6 @@ H5SM__cache_table_free_icr(void *_thing) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -480,10 +450,10 @@ H5SM__cache_list_get_initial_load_size(void *_udata, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(udata); - HDassert(udata->header); - HDassert(udata->header->list_size > 0); - HDassert(image_len); + assert(udata); + assert(udata->header); + assert(udata->header->list_size > 0); + assert(image_len); /* Set the image length size */ *image_len = udata->header->list_size; @@ -500,8 +470,6 @@ H5SM__cache_list_get_initial_load_size(void *_udata, size_t *image_len) * Return: Success: TRUE/FALSE * Failure: Negative * - * Programmer: Vailin Choi; Aug 2015 - * *------------------------------------------------------------------------- */ htri_t @@ -517,8 +485,8 @@ H5SM__cache_list_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(image); - HDassert(udata); + assert(image); + assert(udata); /* Exact size with checksum at the end */ chk_size = H5SM_LIST_SIZE(udata->f, udata->header->num_messages); @@ -542,9 +510,6 @@ H5SM__cache_list_verify_chksum(const void *_image, size_t H5_ATTR_UNUSED len, vo * Return: Success: Pointer to in core representation * Failure: NULL * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static void * @@ -562,33 +527,33 @@ H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED le FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(image); - HDassert(len > 0); - HDassert(udata); - HDassert(udata->header); - HDassert(udata->header->list_size == len); - HDassert(dirty); + assert(image); + assert(len > 0); + assert(udata); + assert(udata->header); + assert(udata->header->list_size == len); + assert(dirty); /* Allocate space for the SOHM list data structure */ if (NULL == (list = H5FL_MALLOC(H5SM_list_t))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemset(&list->cache_info, 0, sizeof(H5AC_info_t)); + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "memory allocation failed"); + memset(&list->cache_info, 0, sizeof(H5AC_info_t)); /* Allocate list in memory as an array*/ if (NULL == (list->messages = (H5SM_sohm_t *)H5FL_ARR_MALLOC(H5SM_sohm_t, udata->header->list_max))) - HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "file allocation failed for SOHM list") + HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, NULL, "file allocation failed for SOHM list"); list->header = udata->header; /* Check magic number */ - if (HDmemcmp(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM list signature") + if (memcmp(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC) != 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM list signature"); image += H5_SIZEOF_MAGIC; /* Read messages into the list array */ ctx.sizeof_addr = H5F_SIZEOF_ADDR(udata->f); for (u = 0; u < udata->header->num_messages; u++) { if (H5SM__message_decode(image, &(list->messages[u]), &ctx) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "can't decode shared message") + HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "can't decode shared message"); image += H5SM_SOHM_ENTRY_SIZE(udata->f); } /* end for */ @@ -599,7 +564,7 @@ H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED le UINT32DECODE(image, stored_chksum); /* Sanity check */ - HDassert((size_t)(image - (const uint8_t *)_image) <= udata->header->list_size); + assert((size_t)(image - (const uint8_t *)_image) <= udata->header->list_size); /* Initialize the rest of the array */ for (u = udata->header->num_messages; u < udata->header->list_max; u++) @@ -626,9 +591,6 @@ H5SM__cache_list_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED le * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -639,11 +601,10 @@ H5SM__cache_list_image_len(const void *_thing, size_t *image_len) FUNC_ENTER_PACKAGE_NOERR /* Check arguments */ - HDassert(list); - HDassert(list->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(list->cache_info.type == H5AC_SOHM_LIST); - HDassert(list->header); - HDassert(image_len); + assert(list); + assert(list->cache_info.type == H5AC_SOHM_LIST); + assert(list->header); + assert(image_len); *image_len = list->header->list_size; @@ -659,9 +620,6 @@ H5SM__cache_list_image_len(const void *_thing, size_t *image_len) * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -678,13 +636,12 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_U FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(f); - HDassert(image); - HDassert(list); - HDassert(list->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_MAGIC); - HDassert(list->cache_info.type == H5AC_SOHM_LIST); - HDassert(list->header); - HDassert(list->header->list_size == len); + assert(f); + assert(image); + assert(list); + assert(list->cache_info.type == H5AC_SOHM_LIST); + assert(list->header); + assert(list->header->list_size == len); /* Encode magic number */ H5MM_memcpy(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -696,24 +653,24 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_U for (u = 0; ((u < list->header->list_max) && (mesgs_serialized < list->header->num_messages)); u++) { if (list->messages[u].location != H5SM_NO_LOC) { if (H5SM__message_encode(image, &(list->messages[u]), &ctx) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to serialize shared message") + HGOTO_ERROR(H5E_SOHM, H5E_CANTFLUSH, FAIL, "unable to serialize shared message"); image += H5SM_SOHM_ENTRY_SIZE(f); ++mesgs_serialized; } /* end if */ } /* end for */ - HDassert(mesgs_serialized == list->header->num_messages); + assert(mesgs_serialized == list->header->num_messages); /* Compute checksum on buffer */ computed_chksum = H5_checksum_metadata(_image, (size_t)(image - (uint8_t *)_image), 0); UINT32ENCODE(image, computed_chksum); /* sanity check */ - HDassert((size_t)(image - (uint8_t *)_image) <= list->header->list_size); + assert((size_t)(image - (uint8_t *)_image) <= list->header->list_size); /* Clear memory */ - HDmemset(image, 0, (list->header->list_size - (size_t)(image - (uint8_t *)_image))); + memset(image, 0, (list->header->list_size - (size_t)(image - (uint8_t *)_image))); done: FUNC_LEAVE_NOAPI(ret_value) @@ -728,16 +685,9 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_U * * Purpose: Free all memory used by the list. * - * Note: The metadata cache sets the object's cache_info.magic to - * H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC before calling a free_icr - * callback (checked in assert). - * * Return: Success: SUCCEED * Failure: FAIL * - * Programmer: John Mainzer - * 7/28/14 - * *------------------------------------------------------------------------- */ static herr_t @@ -749,13 +699,12 @@ H5SM__cache_list_free_icr(void *_thing) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(list); - HDassert(list->cache_info.magic == H5C__H5C_CACHE_ENTRY_T_BAD_MAGIC); - HDassert(list->cache_info.type == H5AC_SOHM_LIST); + assert(list); + assert(list->cache_info.type == H5AC_SOHM_LIST); /* Destroy Shared Object Header Message list */ if (H5SM__list_free(list) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to free shared message list") + HGOTO_ERROR(H5E_SOHM, H5E_CANTRELEASE, FAIL, "unable to free shared message list"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5SMmessage.c b/externals/coda-oss/modules/drivers/hdf5/source/H5SMmessage.c index d43d5a533d..34fe8fd08a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5SMmessage.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5SMmessage.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -72,9 +71,6 @@ static herr_t H5SM__compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg, unsigned sequen * * Return: Negative on error, non-negative on success * - * Programmer: James Laird - * Monday, January 8, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -91,7 +87,7 @@ H5SM__compare_cb(const void *obj, size_t obj_len, void *_udata) udata->ret = -1; else /* Sizes are the same. Return result of memcmp */ - udata->ret = HDmemcmp(udata->key->encoding, obj, obj_len); + udata->ret = memcmp(udata->key->encoding, obj, obj_len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM__compare_cb() */ @@ -107,9 +103,6 @@ H5SM__compare_cb(const void *obj, size_t obj_len, void *_udata) * result returned in udata) * negative on error * - * Programmer: James Laird - * Wednesday, February 7, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -124,16 +117,16 @@ H5SM__compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, /* * Check arguments. */ - HDassert(oh); - HDassert(mesg); - HDassert(udata && udata->key); + assert(oh); + assert(mesg); + assert(udata && udata->key); /* Check the creation index for this message */ if (sequence == udata->idx) { size_t aligned_encoded_size = H5O_ALIGN_OH(oh, udata->key->encoding_size); /* Sanity check the message's length */ - HDassert(mesg->raw_size > 0); + assert(mesg->raw_size > 0); if (aligned_encoded_size > mesg->raw_size) udata->ret = 1; @@ -144,10 +137,10 @@ H5SM__compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, if (mesg->dirty) if (H5O_msg_flush(udata->key->file, oh, mesg) < 0) HGOTO_ERROR(H5E_SOHM, H5E_CANTENCODE, H5_ITER_ERROR, - "unable to encode object header message") + "unable to encode object header message"); - HDassert(udata->key->encoding_size <= mesg->raw_size); - udata->ret = HDmemcmp(udata->key->encoding, mesg->raw, udata->key->encoding_size); + assert(udata->key->encoding_size <= mesg->raw_size); + udata->ret = memcmp(udata->key->encoding, mesg->raw, udata->key->encoding_size); } /* end else */ /* Indicate that we found the message we were looking for */ @@ -169,9 +162,6 @@ H5SM__compare_iter_op(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence, * Negative if rec1 < rec2 * Positive if rec1 > rec2 * - * Programmer: James Laird - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -216,8 +206,8 @@ H5SM__message_compare(const void *rec1, const void *rec2, int *result) */ H5SM_compare_udata_t udata; - HDassert(key->message.hash == mesg->hash); - HDassert(key->encoding_size > 0 && key->encoding); + assert(key->message.hash == mesg->hash); + assert(key->encoding_size > 0 && key->encoding); /* Set up user data for callback */ udata.key = key; @@ -228,19 +218,19 @@ H5SM__message_compare(const void *rec1, const void *rec2, int *result) if (mesg->location == H5SM_IN_HEAP) { /* Call heap op routine with comparison callback */ if (H5HF_op(key->fheap, &(mesg->u.heap_loc.fheap_id), H5SM__compare_cb, &udata) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records"); } /* end if */ else { H5O_loc_t oloc; /* Object owning the message */ H5O_mesg_operator_t op; /* Message operator */ /* Sanity checks */ - HDassert(key->file); - HDassert(mesg->location == H5SM_IN_OH); + assert(key->file); + assert(mesg->location == H5SM_IN_OH); /* Reset the object location */ if (H5O_loc_reset(&oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location") + HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location"); /* Set up object location */ oloc.file = key->file; @@ -253,7 +243,7 @@ H5SM__message_compare(const void *rec1, const void *rec2, int *result) op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5SM__compare_iter_op; if (H5O_msg_iterate(&oloc, mesg->msg_type_id, &op, &udata) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links") + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links"); } /* end else */ *result = udata.ret; @@ -271,9 +261,6 @@ H5SM__message_compare(const void *rec1, const void *rec2, int *result) * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -285,7 +272,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(ctx); + assert(ctx); *raw++ = (uint8_t)message->location; UINT32ENCODE(raw, message->hash); @@ -295,7 +282,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) H5MM_memcpy(raw, message->u.heap_loc.fheap_id.id, (size_t)H5O_FHEAP_ID_LEN); } /* end if */ else { - HDassert(message->location == H5SM_IN_OH); + assert(message->location == H5SM_IN_OH); *raw++ = 0; /* reserved (possible flags byte) */ *raw++ = (uint8_t)message->msg_type_id; @@ -314,9 +301,6 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) * Return: Non-negative on success * Negative on failure * - * Programmer: James Laird - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -335,7 +319,7 @@ H5SM__message_decode(const uint8_t *raw, void *_nrecord, void *_ctx) H5MM_memcpy(message->u.heap_loc.fheap_id.id, raw, (size_t)H5O_FHEAP_ID_LEN); } /* end if */ else { - HDassert(message->location == H5SM_IN_OH); + assert(message->location == H5SM_IN_OH); raw++; /* reserved */ message->msg_type_id = *raw++; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5SMtest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5SMtest.c index 3ab6aa0ea0..f306b89207 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5SMtest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5SMtest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -59,9 +58,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, January 3, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -73,11 +69,11 @@ H5SM__get_mesg_count_test(H5F_t *f, unsigned type_id, size_t *mesg_count) FUNC_ENTER_PACKAGE_TAG(H5AC__SOHM_TAG) /* Sanity check */ - HDassert(f); - HDassert(mesg_count); + assert(f); + assert(mesg_count); /* Check for shared messages being enabled */ - if (H5F_addr_defined(H5F_SOHM_ADDR(f))) { + if (H5_addr_defined(H5F_SOHM_ADDR(f))) { H5SM_index_header_t *header; /* Index header for message type */ H5SM_table_cache_ud_t cache_udata; /* User-data for callback */ ssize_t index_num; /* Table index for message type */ @@ -88,11 +84,11 @@ H5SM__get_mesg_count_test(H5F_t *f, unsigned type_id, size_t *mesg_count) /* Look up the master SOHM table */ if (NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table"); /* Find the correct index for this message type */ if ((index_num = H5SM__get_index(table, type_id)) < 0) - HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index") + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to find correct SOHM index"); header = &(table->indexes[index_num]); /* Set the message count for the type */ @@ -105,7 +101,7 @@ H5SM__get_mesg_count_test(H5F_t *f, unsigned type_id, size_t *mesg_count) done: /* Release resources */ if (table && H5AC_unprotect(f, H5AC_SOHM_TABLE, H5F_SOHM_ADDR(f), table, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table") + HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table"); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5SM__get_mesg_count_test() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Sall.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Sall.c index 32bc16246b..62f55de523 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Sall.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Sall.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, June 16, 1998 - * * Purpose: "All" selection dataspace I/O functions. */ @@ -51,7 +47,7 @@ static herr_t H5S__all_release(H5S_t *space); static htri_t H5S__all_is_valid(const H5S_t *space); static hssize_t H5S__all_serial_size(H5S_t *space); static herr_t H5S__all_serialize(H5S_t *space, uint8_t **p); -static herr_t H5S__all_deserialize(H5S_t **space, const uint8_t **p); +static herr_t H5S__all_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hbool_t skip); static herr_t H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__all_offset(const H5S_t *space, hsize_t *off); static int H5S__all_unlim_dim(const H5S_t *space); @@ -138,9 +134,6 @@ static const H5S_sel_iter_class_t H5S_sel_iter_all[1] = {{ * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Tuesday, June 16, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -149,8 +142,8 @@ H5S__all_iter_init(H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space && H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space)); - HDassert(iter); + assert(space && H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space)); + assert(iter); /* Start at the upper left location */ iter->u.all.elmt_offset = 0; @@ -170,9 +163,6 @@ H5S__all_iter_init(H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter) * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Tuesday, April 22, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -183,12 +173,12 @@ H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(iter); - HDassert(coords); + assert(iter); + assert(coords); /* Calculate the coordinates for the current iterator offset */ if (H5VM_array_calc(iter->u.all.elmt_offset, iter->rank, iter->dims, coords) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve coordinates") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't retrieve coordinates"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -202,9 +192,6 @@ H5S__all_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Monday, June 2, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -215,9 +202,9 @@ H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(start); - HDassert(end); + assert(iter); + assert(start); + assert(end); for (u = 0; u < iter->rank; u++) { /* Set the start of the 'all' block */ @@ -239,9 +226,6 @@ H5S__all_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) * * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol - * Tuesday, June 16, 1998 - * *------------------------------------------------------------------------- */ static hsize_t @@ -250,7 +234,7 @@ H5S__all_iter_nelmts(const H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); FUNC_LEAVE_NOAPI(iter->elmt_left) } /* end H5S__all_iter_nelmts() */ @@ -278,7 +262,7 @@ H5S__all_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); FUNC_LEAVE_NOAPI(FALSE) } /* end H5S__all_iter_has_next_block() */ @@ -307,8 +291,8 @@ H5S__all_iter_next(H5S_sel_iter_t *iter, size_t nelem) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(nelem > 0); + assert(iter); + assert(nelem > 0); /* Increment the iterator */ iter->u.all.elmt_offset += nelem; @@ -340,7 +324,7 @@ H5S__all_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); FUNC_LEAVE_NOAPI(FAIL) } /* end H5S__all_iter_next_block() */ @@ -383,18 +367,18 @@ H5S__all_iter_get_seq_list(H5S_sel_iter_t *iter, size_t H5_ATTR_UNUSED maxseq, s FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(maxseq > 0); - HDassert(maxelem > 0); - HDassert(nseq); - HDassert(nelem); - HDassert(off); - HDassert(len); + assert(iter); + assert(maxseq > 0); + assert(maxelem > 0); + assert(nseq); + assert(nelem); + assert(off); + assert(len); /* Determine the actual number of elements to use */ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t); elem_used = MIN(maxelem, (size_t)iter->elmt_left); - HDassert(elem_used > 0); + assert(elem_used > 0); /* Compute the offset in the dataset */ off[0] = iter->u.all.byte_offset; @@ -437,7 +421,7 @@ H5S__all_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__all_iter_release() */ @@ -465,7 +449,7 @@ H5S__all_release(H5S_t *space) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); + assert(space); /* Reset the number of elements in the selection */ space->select.num_elem = 0; @@ -498,8 +482,8 @@ H5S__all_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUSE { FUNC_ENTER_PACKAGE_NOERR - HDassert(src); - HDassert(dst); + assert(src); + assert(dst); /* Set number of elements in selection */ dst->select.num_elem = (hsize_t)H5S_GET_EXTENT_NPOINTS(dst); @@ -532,7 +516,7 @@ H5S__all_is_valid(const H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); FUNC_LEAVE_NOAPI(TRUE) } /* end H5S__all_is_valid() */ @@ -561,7 +545,7 @@ H5S__all_serial_size(H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); /* Basic number of bytes required to serialize point selection: * + + + @@ -599,9 +583,9 @@ H5S__all_serialize(H5S_t *space, uint8_t **p) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); - HDassert(p); - HDassert(pp); + assert(space); + assert(p); + assert(pp); /* Store the preamble information */ UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ @@ -638,17 +622,17 @@ H5S__all_serialize(H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__all_deserialize(H5S_t **space, const uint8_t **p) +H5S__all_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hbool_t skip) { - uint32_t version; /* Version number */ - H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, - either *space or a newly allocated one */ - herr_t ret_value = SUCCEED; /* return value */ - + uint32_t version; /* Version number */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ + herr_t ret_value = SUCCEED; /* return value */ + const uint8_t *p_end = *p + p_size - 1; /* Pointer to last valid byte in buffer */ FUNC_ENTER_PACKAGE - HDassert(p); - HDassert(*p); + assert(p); + assert(*p); /* As part of the efforts to push all selection-type specific coding to the callbacks, the coding for the allocation of a null dataspace @@ -658,23 +642,27 @@ H5S__all_deserialize(H5S_t **space, const uint8_t **p) /* Allocate space if not provided */ if (!*space) { if (NULL == (tmp_space = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace"); } /* end if */ else tmp_space = *space; /* Decode version */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *p, sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection version"); UINT32DECODE(*p, version); if (version < H5S_ALL_VERSION_1 || version > H5S_ALL_VERSION_LATEST) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for all selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for all selection"); /* Skip over the remainder of the header */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *p, 8, p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding header"); *p += 8; /* Change to "all" selection */ if (H5S_select_all(tmp_space, TRUE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); /* Return space to the caller if allocated */ if (!*space) @@ -684,7 +672,7 @@ H5S__all_deserialize(H5S_t **space, const uint8_t **p) /* Free temporary space if not passed to caller (only happens on error) */ if (!*space && tmp_space) if (H5S_close(tmp_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__all_deserialize() */ @@ -722,9 +710,9 @@ H5S__all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) FUNC_ENTER_PACKAGE_NOERR - HDassert(space); - HDassert(start); - HDassert(end); + assert(space); + assert(start); + assert(end); /* Get the dataspace extent rank */ rank = space->extent.rank; @@ -763,8 +751,8 @@ H5S__all_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset) { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); /* 'All' selections always start at offset 0 */ *offset = 0; @@ -824,7 +812,7 @@ H5S__all_is_contiguous(const H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); FUNC_LEAVE_NOAPI(TRUE) } /* end H5S__all_is_contiguous() */ @@ -852,7 +840,7 @@ H5S__all_is_single(const H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); FUNC_LEAVE_NOAPI(TRUE) } /* end H5S__all_is_single() */ @@ -882,7 +870,7 @@ H5S__all_is_regular(H5S_t H5_ATTR_UNUSED *space) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); + assert(space); FUNC_LEAVE_NOAPI(TRUE) } /* end H5S__all_is_regular() */ @@ -916,8 +904,8 @@ H5S__all_shape_same(H5S_t *space1, H5S_t *space2) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space1); - HDassert(space2); + assert(space1); + assert(space2); /* Initialize dataspace dims */ space1_dim = (int)space1->extent.rank - 1; @@ -930,7 +918,7 @@ H5S__all_shape_same(H5S_t *space1, H5S_t *space2) */ while (space2_dim >= 0) { if (space1->extent.size[space1_dim] != space2->extent.size[space2_dim]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); space1_dim--; space2_dim--; @@ -941,7 +929,7 @@ H5S__all_shape_same(H5S_t *space1, H5S_t *space2) */ while (space1_dim >= 0) { if (space1->extent.size[space1_dim] != 1) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); space1_dim--; } /* end while */ @@ -976,10 +964,10 @@ H5S__all_intersect_block(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUS FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(space); - HDassert(H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space)); - HDassert(start); - HDassert(end); + assert(space); + assert(H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space)); + assert(start); + assert(end); FUNC_LEAVE_NOAPI(TRUE) } /* end H5S__all_intersect_block() */ @@ -1008,8 +996,8 @@ H5S__all_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *off FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__all_adjust_u() */ @@ -1038,8 +1026,8 @@ H5S__all_adjust_s(H5S_t H5_ATTR_UNUSED *space, const hssize_t H5_ATTR_UNUSED *of FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__all_adjust_s() */ @@ -1052,9 +1040,6 @@ H5S__all_adjust_s(H5S_t H5_ATTR_UNUSED *space, const hssize_t H5_ATTR_UNUSED *of * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Sunday, July 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1063,8 +1048,8 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space && H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space)); - HDassert(offset); + assert(space && H5S_SEL_ALL == H5S_GET_SELECT_TYPE(space)); + assert(offset); /* Set offset of selection in projected buffer */ *offset = 0; @@ -1080,9 +1065,6 @@ H5S__all_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t *offset) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Sunday, July 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -1094,13 +1076,13 @@ H5S__all_project_simple(const H5S_t H5_ATTR_UNUSED *base_space, H5S_t *new_space FUNC_ENTER_PACKAGE /* Check args */ - HDassert(base_space && H5S_SEL_ALL == H5S_GET_SELECT_TYPE(base_space)); - HDassert(new_space); - HDassert(offset); + assert(base_space && H5S_SEL_ALL == H5S_GET_SELECT_TYPE(base_space)); + assert(new_space); + assert(offset); /* Select the entire new space */ if (H5S_select_all(new_space, TRUE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to set all selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to set all selection"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1110,7 +1092,7 @@ H5S__all_project_simple(const H5S_t H5_ATTR_UNUSED *base_space, H5S_t *new_space NAME H5S_select_all PURPOSE - Specify the the entire extent is selected + Specify the entire extent is selected USAGE herr_t H5S_select_all(dsid) hid_t dsid; IN: Dataspace ID of selection to modify @@ -1132,12 +1114,12 @@ H5S_select_all(H5S_t *space, hbool_t rel_prev) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(space); + assert(space); /* Remove current selection first */ if (rel_prev) if (H5S_SELECT_RELEASE(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection"); /* Set number of elements in selection */ space->select.num_elem = (hsize_t)H5S_GET_EXTENT_NPOINTS(space); @@ -1153,7 +1135,7 @@ H5S_select_all(H5S_t *space, hbool_t rel_prev) NAME H5Sselect_all PURPOSE - Specify the the entire extent is selected + Specify the entire extent is selected USAGE herr_t H5Sselect_all(dsid) hid_t dsid; IN: Dataspace ID of selection to modify @@ -1177,11 +1159,11 @@ H5Sselect_all(hid_t spaceid) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Call internal routine to do the work */ if (H5S_select_all(space, TRUE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Sdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Sdbg.c index d20916b026..f233491cd1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Sdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Sdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Sdbg.c - * Quincey Koziol - * Jul 24 2007 * * Purpose: Dump debugging information about a dataspace * @@ -70,9 +67,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, July 21, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -84,22 +78,22 @@ H5S_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidth) switch (H5S_GET_EXTENT_TYPE(mesg)) { case H5S_NULL: - HDfprintf(stream, "%*s%-*s H5S_NULL\n", indent, "", fwidth, "Space class:"); + fprintf(stream, "%*s%-*s H5S_NULL\n", indent, "", fwidth, "Space class:"); break; case H5S_SCALAR: - HDfprintf(stream, "%*s%-*s H5S_SCALAR\n", indent, "", fwidth, "Space class:"); + fprintf(stream, "%*s%-*s H5S_SCALAR\n", indent, "", fwidth, "Space class:"); break; case H5S_SIMPLE: - HDfprintf(stream, "%*s%-*s H5S_SIMPLE\n", indent, "", fwidth, "Space class:"); + fprintf(stream, "%*s%-*s H5S_SIMPLE\n", indent, "", fwidth, "Space class:"); H5O_debug_id(H5O_SDSPACE_ID, f, &(mesg->extent), stream, indent + 3, MAX(0, fwidth - 3)); break; case H5S_NO_CLASS: default: - HDfprintf(stream, "%*s%-*s **UNKNOWN-%ld**\n", indent, "", fwidth, - "Space class:", (long)(H5S_GET_EXTENT_TYPE(mesg))); + fprintf(stream, "%*s%-*s **UNKNOWN-%ld**\n", indent, "", fwidth, + "Space class:", (long)(H5S_GET_EXTENT_TYPE(mesg))); break; } /* end switch */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Sdeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Sdeprec.c index d050102e41..78f42814df 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Sdeprec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Sdeprec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -77,9 +76,6 @@ * Return: Success: non-negative * Failure: negative * - * Programmer: Raymond Lu - * July 14, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -94,15 +90,15 @@ H5Sencode1(hid_t obj_id, void *buf, size_t *nalloc) /* Check argument and retrieve object */ if (NULL == (dspace = (H5S_t *)H5I_object_verify(obj_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&temp_fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info"); /* Use (earliest, latest) i.e. not latest format */ if (H5S_encode(dspace, (unsigned char **)&buf, nalloc) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Shyper.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Shyper.c index 0e668901f5..9b69926fb3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Shyper.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Shyper.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Thursday, June 18, 1998 - * * Purpose: Hyperslab selection dataspace I/O functions. */ @@ -46,15 +42,16 @@ #define H5S_HYPER_COMPUTE_A_NOT_B 0x04 /* Macro to advance a span, possibly recycling it first */ -#define H5S_HYPER_ADVANCE_SPAN(recover, curr_span, next_span) \ +#define H5S_HYPER_ADVANCE_SPAN(recover, curr_span, next_span, ERR) \ do { \ H5S_hyper_span_t *saved_next_span = (next_span); \ \ /* Check if the span should be recovered */ \ if (recover) { \ - H5S__hyper_free_span(curr_span); \ + if (H5S__hyper_free_span(curr_span) < 0) \ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, ERR, "unable to free span"); \ (recover) = FALSE; \ - } /* end if */ \ + } \ \ /* Set the current span to saved next span */ \ (curr_span) = saved_next_span; \ @@ -68,7 +65,8 @@ * to the projection first before adding skip */ \ if ((UDATA)->nelem > 0) \ if (H5S__hyper_proj_int_build_proj(UDATA) < 0) \ - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, ERR, "can't add elements to projected selection") \ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, ERR, \ + "can't add elements to projected selection"); \ (UDATA)->skip += (ADD); \ } while (0) /* end H5S_HYPER_PROJ_INT_ADD_SKIP() */ @@ -117,8 +115,8 @@ static H5S_hyper_span_info_t *H5S__hyper_copy_span_helper(H5S_hyper_span_info_t static H5S_hyper_span_info_t *H5S__hyper_copy_span(H5S_hyper_span_info_t *spans, unsigned rank); static hbool_t H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_span_info_t *span_info2); -static void H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info); -static void H5S__hyper_free_span(H5S_hyper_span_t *span); +static herr_t H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info); +static herr_t H5S__hyper_free_span(H5S_hyper_span_t *span); static herr_t H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[], hsize_t end[], hsize_t rank, hsize_t *startblock, hsize_t *numblocks, hsize_t **buf); static herr_t H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numblocks, @@ -175,7 +173,7 @@ static htri_t H5S__hyper_is_valid(const H5S_t *space); static hsize_t H5S__hyper_span_nblocks(H5S_hyper_span_info_t *spans); static hssize_t H5S__hyper_serial_size(H5S_t *space); static herr_t H5S__hyper_serialize(H5S_t *space, uint8_t **p); -static herr_t H5S__hyper_deserialize(H5S_t **space, const uint8_t **p); +static herr_t H5S__hyper_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hbool_t skip); static herr_t H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__hyper_offset(const H5S_t *space, hsize_t *offset); static int H5S__hyper_unlim_dim(const H5S_t *space); @@ -296,12 +294,12 @@ H5S__hyper_print_spans_helper(FILE *f, const H5S_hyper_span_t *span, unsigned de FUNC_ENTER_PACKAGE_NOERR while (span) { - HDfprintf(f, "%s: %*sdepth=%u, span=%p, (%" PRIuHSIZE ", %" PRIuHSIZE "), next=%p\n", __func__, - depth * 2, "", depth, (void *)span, span->low, span->high, (void *)span->next); + fprintf(f, "%s: %*sdepth=%u, span=%p, (%" PRIuHSIZE ", %" PRIuHSIZE "), next=%p\n", __func__, + depth * 2, "", depth, (void *)span, span->low, span->high, (void *)span->next); if (span->down) { - HDfprintf(f, "%s: %*sspans=%p, count=%u, bounds[0]={%" PRIuHSIZE ", %" PRIuHSIZE "}, head=%p\n", - __func__, (depth + 1) * 2, "", (void *)span->down, span->down->count, - span->down->low_bounds[0], span->down->high_bounds[0], (void *)span->down->head); + fprintf(f, "%s: %*sspans=%p, count=%u, bounds[0]={%" PRIuHSIZE ", %" PRIuHSIZE "}, head=%p\n", + __func__, (depth + 1) * 2, "", (void *)span->down, span->down->count, + span->down->low_bounds[0], span->down->high_bounds[0], (void *)span->down->head); H5S__hyper_print_spans_helper(f, span->down->head, depth + 1); } /* end if */ span = span->next; @@ -316,9 +314,9 @@ H5S__hyper_print_spans(FILE *f, const H5S_hyper_span_info_t *span_lst) FUNC_ENTER_PACKAGE_NOERR if (span_lst != NULL) { - HDfprintf(f, "%s: spans=%p, count=%u, bounds[0]={%" PRIuHSIZE ", %" PRIuHSIZE "}, head=%p\n", - __func__, (void *)span_lst, span_lst->count, span_lst->low_bounds[0], - span_lst->high_bounds[0], (void *)span_lst->head); + fprintf(f, "%s: spans=%p, count=%u, bounds[0]={%" PRIuHSIZE ", %" PRIuHSIZE "}, head=%p\n", __func__, + (void *)span_lst, span_lst->count, span_lst->low_bounds[0], span_lst->high_bounds[0], + (void *)span_lst->head); H5S__hyper_print_spans_helper(f, span_lst->head, 0); } /* end if */ @@ -343,21 +341,21 @@ H5S__hyper_print_diminfo_helper(FILE *f, const char *field, unsigned ndims, cons FUNC_ENTER_PACKAGE_NOERR if (dinfo != NULL) { - HDfprintf(f, "%s: %s: start=[", __func__, field); + fprintf(f, "%s: %s: start=[", __func__, field); for (u = 0; u < ndims; u++) - HDfprintf(f, "%" PRIuHSIZE "%s", dinfo[u].start, (u < (ndims - 1) ? ", " : "]\n")); - HDfprintf(f, "%s: %s: stride=[", __func__, field); + fprintf(f, "%" PRIuHSIZE "%s", dinfo[u].start, (u < (ndims - 1) ? ", " : "]\n")); + fprintf(f, "%s: %s: stride=[", __func__, field); for (u = 0; u < ndims; u++) - HDfprintf(f, "%" PRIuHSIZE "%s", dinfo[u].stride, (u < (ndims - 1) ? ", " : "]\n")); - HDfprintf(f, "%s: %s: count=[", __func__, field); + fprintf(f, "%" PRIuHSIZE "%s", dinfo[u].stride, (u < (ndims - 1) ? ", " : "]\n")); + fprintf(f, "%s: %s: count=[", __func__, field); for (u = 0; u < ndims; u++) - HDfprintf(f, "%" PRIuHSIZE "%s", dinfo[u].count, (u < (ndims - 1) ? ", " : "]\n")); - HDfprintf(f, "%s: %s: block=[", __func__, field); + fprintf(f, "%" PRIuHSIZE "%s", dinfo[u].count, (u < (ndims - 1) ? ", " : "]\n")); + fprintf(f, "%s: %s: block=[", __func__, field); for (u = 0; u < ndims; u++) - HDfprintf(f, "%" PRIuHSIZE "%s", dinfo[u].block, (u < (ndims - 1) ? ", " : "]\n")); + fprintf(f, "%" PRIuHSIZE "%s", dinfo[u].block, (u < (ndims - 1) ? ", " : "]\n")); } /* end if */ else - HDfprintf(f, "%s: %s==NULL\n", __func__, field); + fprintf(f, "%s: %s==NULL\n", __func__, field); FUNC_LEAVE_NOAPI(SUCCEED) } @@ -404,7 +402,7 @@ H5S__hyper_print_spans_dfs(FILE *f, const H5S_hyper_span_info_t *span_lst, unsig /* get the actual tail from head */ cur_elem = span_lst->head; - HDassert(cur_elem); /* at least 1 element */ + assert(cur_elem); /* at least 1 element */ while (cur_elem) { actual_tail = cur_elem; cur_elem = cur_elem->next; @@ -412,32 +410,32 @@ H5S__hyper_print_spans_dfs(FILE *f, const H5S_hyper_span_info_t *span_lst, unsig } /* end while */ for (u = 0; u < depth; u++) - HDfprintf(f, "\t"); - HDfprintf(f, "DIM[%u]: ref_count=%u, #elems=%u, head=%p, tail=%p, actual_tail=%p, matched=%d\n", depth, - span_lst->count, num_elems, (void *)span_lst->head, (void *)span_lst->tail, (void *)actual_tail, - (span_lst->tail == actual_tail)); + fprintf(f, "\t"); + fprintf(f, "DIM[%u]: ref_count=%u, #elems=%u, head=%p, tail=%p, actual_tail=%p, matched=%d\n", depth, + span_lst->count, num_elems, (void *)span_lst->head, (void *)span_lst->tail, (void *)actual_tail, + (span_lst->tail == actual_tail)); for (u = 0; u < depth; u++) - HDfprintf(f, "\t"); - HDfprintf(f, "low_bounds=["); + fprintf(f, "\t"); + fprintf(f, "low_bounds=["); for (u = 0; u < dims - 1; u++) - HDfprintf(f, "%" PRIuHSIZE ",", span_lst->low_bounds[u]); - HDfprintf(f, "%" PRIuHSIZE "]\n", span_lst->low_bounds[dims - 1]); + fprintf(f, "%" PRIuHSIZE ",", span_lst->low_bounds[u]); + fprintf(f, "%" PRIuHSIZE "]\n", span_lst->low_bounds[dims - 1]); for (u = 0; u < depth; u++) - HDfprintf(f, "\t"); - HDfprintf(f, "high_bounds=["); + fprintf(f, "\t"); + fprintf(f, "high_bounds=["); for (u = 0; u < dims - 1; u++) - HDfprintf(f, "%" PRIuHSIZE ",", span_lst->high_bounds[u]); - HDfprintf(f, "%" PRIuHSIZE "]\n", span_lst->high_bounds[dims - 1]); + fprintf(f, "%" PRIuHSIZE ",", span_lst->high_bounds[u]); + fprintf(f, "%" PRIuHSIZE "]\n", span_lst->high_bounds[dims - 1]); cur_elem = span_lst->head; elem_idx = 0; while (cur_elem) { for (u = 0; u < depth; u++) - HDfprintf(f, "\t"); - HDfprintf(f, "ELEM[%u]: ptr=%p, low=%" PRIuHSIZE ", high=%" PRIuHSIZE ", down=%p\n", elem_idx++, - (void *)cur_elem, cur_elem->low, cur_elem->high, (void *)cur_elem->down); + fprintf(f, "\t"); + fprintf(f, "ELEM[%u]: ptr=%p, low=%" PRIuHSIZE ", high=%" PRIuHSIZE ", down=%p\n", elem_idx++, + (void *)cur_elem, cur_elem->low, cur_elem->high, (void *)cur_elem->down); if (cur_elem->down) H5S__hyper_print_spans_dfs(f, cur_elem->down, depth + 1, dims); cur_elem = cur_elem->next; @@ -471,39 +469,39 @@ H5S__hyper_print_space_dfs(FILE *f, const H5S_t *space) FUNC_ENTER_PACKAGE_NOERR - HDassert(hslab); + assert(hslab); - HDfprintf(f, "=======================\n"); - HDfprintf(f, "SPACE: span_lst=%p, #dims=%u, offset_changed=%d\n", (void *)hslab->span_lst, dims, - space->select.offset_changed); + fprintf(f, "=======================\n"); + fprintf(f, "SPACE: span_lst=%p, #dims=%u, offset_changed=%d\n", (void *)hslab->span_lst, dims, + space->select.offset_changed); - HDfprintf(f, " offset=["); + fprintf(f, " offset=["); for (u = 0; u < dims - 1; u++) - HDfprintf(f, "%lld,", space->select.offset[u]); - HDfprintf(f, "%lld]\n", space->select.offset[dims - 1]); + fprintf(f, "%lld,", space->select.offset[u]); + fprintf(f, "%lld]\n", space->select.offset[dims - 1]); - HDfprintf(f, " low_bounds=["); + fprintf(f, " low_bounds=["); if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { for (u = 0; u < dims - 1; u++) - HDfprintf(f, "%" PRIuHSIZE ",", space->select.sel_info.hslab->diminfo.low_bounds[u]); - HDfprintf(f, "%" PRIuHSIZE "]\n", space->select.sel_info.hslab->diminfo.low_bounds[dims - 1]); + fprintf(f, "%" PRIuHSIZE ",", space->select.sel_info.hslab->diminfo.low_bounds[u]); + fprintf(f, "%" PRIuHSIZE "]\n", space->select.sel_info.hslab->diminfo.low_bounds[dims - 1]); } /* end if */ else { for (u = 0; u < dims - 1; u++) - HDfprintf(f, "%" PRIuHSIZE ",", space->select.sel_info.hslab->span_lst->low_bounds[u]); - HDfprintf(f, "%" PRIuHSIZE "]\n", space->select.sel_info.hslab->span_lst->low_bounds[dims - 1]); + fprintf(f, "%" PRIuHSIZE ",", space->select.sel_info.hslab->span_lst->low_bounds[u]); + fprintf(f, "%" PRIuHSIZE "]\n", space->select.sel_info.hslab->span_lst->low_bounds[dims - 1]); } /* end else */ - HDfprintf(f, " high_bounds=["); + fprintf(f, " high_bounds=["); if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { for (u = 0; u < dims - 1; u++) - HDfprintf(f, "%" PRIuHSIZE ",", space->select.sel_info.hslab->diminfo.high_bounds[u]); - HDfprintf(f, "%" PRIuHSIZE "]\n", space->select.sel_info.hslab->diminfo.high_bounds[dims - 1]); + fprintf(f, "%" PRIuHSIZE ",", space->select.sel_info.hslab->diminfo.high_bounds[u]); + fprintf(f, "%" PRIuHSIZE "]\n", space->select.sel_info.hslab->diminfo.high_bounds[dims - 1]); } /* end if */ else { for (u = 0; u < dims - 1; u++) - HDfprintf(f, "%" PRIuHSIZE ",", space->select.sel_info.hslab->span_lst->high_bounds[u]); - HDfprintf(f, "%" PRIuHSIZE "]\n", space->select.sel_info.hslab->span_lst->high_bounds[dims - 1]); + fprintf(f, "%" PRIuHSIZE ",", space->select.sel_info.hslab->span_lst->high_bounds[u]); + fprintf(f, "%" PRIuHSIZE "]\n", space->select.sel_info.hslab->span_lst->high_bounds[dims - 1]); } /* end else */ /* Print out diminfo, if it's valid */ @@ -513,7 +511,7 @@ H5S__hyper_print_space_dfs(FILE *f, const H5S_t *space) /* Start print out the highest-order of dimension */ if (hslab->span_lst) H5S__hyper_print_spans_dfs(f, hslab->span_lst, 0, dims); - HDfprintf(f, "=======================\n\n"); + fprintf(f, "=======================\n\n"); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_print_space_dfs() */ @@ -526,9 +524,6 @@ H5S__hyper_print_space_dfs(FILE *f, const H5S_t *space) * * Return: Operation generation value (can't fail) * - * Programmer: Quincey Koziol - * Saturday, January 19, 2019 - * * Notes: Assumes that a 64-bit value will not wrap around during * the lifespan of the process. * @@ -539,7 +534,7 @@ H5S__hyper_get_op_gen(void) { FUNC_ENTER_PACKAGE_NOERR - FUNC_LEAVE_NOAPI(H5S_hyper_op_gen_g++); + FUNC_LEAVE_NOAPI(H5S_hyper_op_gen_g++) } /* end H5S__hyper_op_gen() */ /*------------------------------------------------------------------------- @@ -549,9 +544,6 @@ H5S__hyper_get_op_gen(void) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Saturday, February 24, 2001 - * * Notes: If the 'iter->elmt_size' field is set to zero, the regular * hyperslab selection iterator will not be 'flattened'. This * is used by the H5S_select_shape_same() code to avoid changing @@ -573,9 +565,9 @@ H5S__hyper_iter_init(H5S_t *space, H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space)); - HDassert(iter); - HDassert(space->select.sel_info.hslab->unlim_dim < 0); + assert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space)); + assert(iter); + assert(space->select.sel_info.hslab->unlim_dim < 0); /* Initialize the hyperslab iterator's rank */ iter->u.hyp.iter_rank = 0; @@ -639,7 +631,7 @@ H5S__hyper_iter_init(H5S_t *space, H5S_sel_iter_t *iter) for (i = (int)rank - 1, acc = 1; i >= 0; i--) { if (tdiminfo[i].block == mem_size[i] && i > 0) { /* "Flatten" this dimension */ - HDassert(tdiminfo[i].start == 0); + assert(tdiminfo[i].start == 0); acc *= mem_size[i]; /* Indicate that the dimension was flattened */ @@ -727,11 +719,11 @@ H5S__hyper_iter_init(H5S_t *space, H5S_sel_iter_t *iter) /* Copy the span tree */ if (NULL == (iter->u.hyp.spans = H5S__hyper_copy_span(space->select.sel_info.hslab->span_lst, space->extent.rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy span tree") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy span tree"); } /* end if */ else { /* Share the source dataspace's span tree by incrementing the reference count on it */ - HDassert(space->select.sel_info.hslab->span_lst); + assert(space->select.sel_info.hslab->span_lst); iter->u.hyp.spans = space->select.sel_info.hslab->span_lst; iter->u.hyp.spans->count++; } /* end else */ @@ -740,8 +732,8 @@ H5S__hyper_iter_init(H5S_t *space, H5S_sel_iter_t *iter) spans = iter->u.hyp.spans; for (u = 0; u < rank; u++) { /* Set the pointers to the initial span in each dimension */ - HDassert(spans); - HDassert(spans->head); + assert(spans); + assert(spans->head); /* Set the pointer to the first span in the list for this node */ iter->u.hyp.span[u] = spans->head; @@ -791,9 +783,6 @@ H5S__hyper_iter_init(H5S_t *space, H5S_sel_iter_t *iter) * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Tuesday, April 22, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -802,8 +791,8 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(coords); + assert(iter); + assert(coords); /* Copy the offset of the current point */ @@ -832,7 +821,7 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) u = 0; /* Sanity check */ - HDassert(v >= 0); + assert(v >= 0); /* Compute the coords for the flattened dimensions */ H5VM_array_calc(iter->u.hyp.off[v], (unsigned)((begin - u) + 1), &(iter->dims[u]), @@ -846,7 +835,7 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) /* Walk up through as many non-flattened dimensions as possible */ while (u >= 0 && !iter->u.hyp.flattened[u]) { /* Sanity check */ - HDassert(v >= 0); + assert(v >= 0); /* Copy the coordinate */ coords[u] = iter->u.hyp.off[v]; @@ -857,7 +846,7 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) } /* end while */ } /* end else */ } /* end while */ - HDassert(v < 0); + assert(v < 0); } /* end if */ else H5MM_memcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank); @@ -876,9 +865,6 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Monday, June 2, 2003 - * * Notes: This routine assumes that the iterator is always located at * the beginning of a block. * @@ -892,9 +878,9 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(start); - HDassert(end); + assert(iter); + assert(start); + assert(end); /* Copy the offset of the current point */ @@ -924,9 +910,6 @@ H5S__hyper_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) * * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol - * Tuesday, June 16, 1998 - * *------------------------------------------------------------------------- */ static hsize_t @@ -935,7 +918,7 @@ H5S__hyper_iter_nelmts(const H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); FUNC_LEAVE_NOAPI(iter->elmt_left) } /* end H5S__hyper_iter_nelmts() */ @@ -966,7 +949,7 @@ H5S__hyper_iter_has_next_block(const H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); /* Check for a single "regular" hyperslab */ if (iter->u.hyp.diminfo_valid) { @@ -1004,9 +987,6 @@ H5S__hyper_iter_has_next_block(const H5S_sel_iter_t *iter) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Friday, September 8, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -1178,9 +1158,9 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) if (curr_dim >= 0) { /* Walk back down the iterator positions, resetting them */ while (curr_dim < fast_dim) { - HDassert(curr_span); - HDassert(curr_span->down); - HDassert(curr_span->down->head); + assert(curr_span); + assert(curr_span->down); + assert(curr_span->down->head); /* Increment current dimension */ curr_dim++; @@ -1196,7 +1176,7 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) } /* end while */ /* Verify that the curr_span points to the fastest dim */ - HDassert(curr_span == ispan[fast_dim]); + assert(curr_span == ispan[fast_dim]); } /* end if */ } /* end while */ } /* end else */ @@ -1213,9 +1193,6 @@ H5S__hyper_iter_next(H5S_sel_iter_t *iter, size_t nelem) * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Tuesday, June 3, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -1355,9 +1332,9 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) if (curr_dim >= 0) { /* Walk back down the iterator positions, resetting them */ while (curr_dim < fast_dim) { - HDassert(curr_span); - HDassert(curr_span->down); - HDassert(curr_span->down->head); + assert(curr_span); + assert(curr_span->down); + assert(curr_span->down->head); /* Increment current dimension */ curr_dim++; @@ -1373,7 +1350,7 @@ H5S__hyper_iter_next_block(H5S_sel_iter_t *iter) } /* end while */ /* Verify that the curr_span points to the fastest dim */ - HDassert(curr_span == ispan[fast_dim]); + assert(curr_span == ispan[fast_dim]); } /* end if */ } /* end else */ @@ -1432,17 +1409,18 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max unsigned fast_dim; /* Rank of the fastest changing dimension for the dataspace */ int curr_dim; /* Current dimension being operated on */ unsigned u; /* Index variable */ + herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_PACKAGE /* Check args */ - HDassert(iter); - HDassert(maxseq > 0); - HDassert(maxelem > 0); - HDassert(nseq); - HDassert(nelem); - HDassert(off); - HDassert(len); + assert(iter); + assert(maxseq > 0); + assert(maxelem > 0); + assert(nseq); + assert(nelem); + assert(off); + assert(len); /* Set the rank of the fastest changing dimension */ ndims = iter->rank; @@ -1515,7 +1493,7 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max /* Check if we are still within the span */ if (abs_arr[fast_dim] <= curr_span->high) { /* Sanity check */ - HDassert(ispan[fast_dim] == curr_span); + assert(ispan[fast_dim] == curr_span); /* Update byte offset */ loc_arr[fast_dim] += span_size; @@ -1592,9 +1570,9 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max if (curr_dim >= 0) { /* Walk back down the iterator positions, resetting them */ while ((unsigned)curr_dim < fast_dim) { - HDassert(curr_span); - HDassert(curr_span->down); - HDassert(curr_span->down->head); + assert(curr_span); + assert(curr_span->down); + assert(curr_span->down->head); /* Increment current dimension */ curr_dim++; @@ -1614,7 +1592,7 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max } /* end while */ /* Verify that the curr_span points to the fastest dim */ - HDassert(curr_span == ispan[fast_dim]); + assert(curr_span == ispan[fast_dim]); /* Reset the buffer offset */ for (u = 0, loc_off = 0; u < ndims; u++) @@ -1622,7 +1600,7 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max } /* end else */ else /* We had better be done with I/O or bad things are going to happen... */ - HDassert(io_elmts_left == 0); + assert(io_elmts_left == 0); } /* end if */ } /* end if */ @@ -1631,7 +1609,7 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max H5S_hyper_span_t *prev_span; /* Previous hyperslab span node */ /* Sanity check */ - HDassert(curr_span); + assert(curr_span); /* Set to current span, so the first adjustment to loc_off is 0 */ prev_span = curr_span; @@ -1709,7 +1687,8 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max /* Check if we are done */ if (io_elmts_left == 0 || curr_seq >= maxseq) { /* Sanity checks */ - HDassert(curr_span); + if (!curr_span) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "curr_span pointer was NULL"); /* Update absolute position */ abs_arr[fast_dim] = curr_span->low + span_elmts; @@ -1793,15 +1772,15 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max /* Check if we are finished with the spans in the tree */ if (curr_dim < 0) { /* We had better be done with I/O or bad things are going to happen... */ - HDassert(io_elmts_left == 0); + assert(io_elmts_left == 0); break; } /* end if */ else { /* Walk back down the iterator positions, resetting them */ while ((unsigned)curr_dim < fast_dim) { - HDassert(curr_span); - HDassert(curr_span->down); - HDassert(curr_span->down->head); + assert(curr_span); + assert(curr_span->down); + assert(curr_span->down->head); /* Increment current dimension to the next dimension down */ curr_dim++; @@ -1821,7 +1800,7 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max } /* end while */ /* Verify that the curr_span points to the fastest dim */ - HDassert(curr_span == ispan[fast_dim]); + assert(curr_span == ispan[fast_dim]); } /* end else */ /* Reset the buffer offset */ @@ -1839,7 +1818,8 @@ H5S__hyper_iter_get_seq_list_gen(H5S_sel_iter_t *iter, size_t maxseq, size_t max /* Set the number of elements used */ *nelem = io_used; - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_iter_get_seq_list_gen() */ /*-------------------------------------------------------------------------- @@ -1907,13 +1887,13 @@ H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxseq, size_t max FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(maxseq > 0); - HDassert(maxelem > 0); - HDassert(nseq); - HDassert(nelem); - HDassert(off); - HDassert(len); + assert(iter); + assert(maxseq > 0); + assert(maxelem > 0); + assert(nseq); + assert(nelem); + assert(off); + assert(len); /* Set the local copy of the diminfo pointer */ tdiminfo = iter->u.hyp.diminfo; @@ -1950,8 +1930,8 @@ H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxseq, size_t max io_left = MIN((size_t)iter->elmt_left, maxelem); /* Sanity check that there aren't any "remainder" sequences in process */ - HDassert(!((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 || - ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1))); + assert(!((iter->u.hyp.off[fast_dim] - tdiminfo[fast_dim].start) % tdiminfo[fast_dim].stride != 0 || + ((iter->u.hyp.off[fast_dim] != tdiminfo[fast_dim].start) && tdiminfo[fast_dim].count == 1))); /* We've cleared the "remainder" of the previous fastest dimension * sequence before calling this routine, so we must be at the beginning of @@ -2134,7 +2114,7 @@ H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxseq, size_t max duffs_index = (fast_dim_count + 7) / 8; switch (fast_dim_count % 8) { default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); break; case 0: do { @@ -2270,7 +2250,7 @@ H5S__hyper_iter_get_seq_list_opt(H5S_sel_iter_t *iter, size_t maxseq, size_t max } /* end if */ /* don't bother checking slower dimensions */ - HDassert(io_left == 0 || curr_seq == maxseq); + assert(io_left == 0 || curr_seq == maxseq); } /* end if */ /* Update the iterator */ @@ -2346,13 +2326,13 @@ H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(maxseq > 0); - HDassert(maxelem > 0); - HDassert(nseq); - HDassert(nelem); - HDassert(off); - HDassert(len); + assert(iter); + assert(maxseq > 0); + assert(maxelem > 0); + assert(nseq); + assert(nelem); + assert(off); + assert(len); /* Set a local copy of the diminfo pointer */ tdiminfo = iter->u.hyp.diminfo; @@ -2425,8 +2405,8 @@ H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t /* Check for 1-dim selection */ if (0 == fast_dim) { /* Sanity checks */ - HDassert(1 == tot_blk_count); - HDassert(io_left == actual_elem); + assert(1 == tot_blk_count); + assert(io_left == actual_elem); /* Store the sequence information */ *off++ = loc; @@ -2543,8 +2523,8 @@ H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t /* Compute elements left */ elmt_remainder = io_left - (tot_blk_count * actual_elem); - HDassert(elmt_remainder < fast_dim_block); - HDassert(elmt_remainder > 0); + assert(elmt_remainder < fast_dim_block); + assert(elmt_remainder > 0); /* Store the sequence information */ *off++ = loc; @@ -2564,8 +2544,8 @@ H5S__hyper_iter_get_seq_list_single(H5S_sel_iter_t *iter, size_t maxseq, size_t } /* end if */ /* Sanity check */ - HDassert(*nseq > 0); - HDassert(*nelem > 0); + assert(*nseq > 0); + assert(*nelem > 0); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_get_seq_list_single() */ @@ -2609,14 +2589,14 @@ H5S__hyper_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(iter->elmt_left > 0); - HDassert(maxseq > 0); - HDassert(maxelem > 0); - HDassert(nseq); - HDassert(nelem); - HDassert(off); - HDassert(len); + assert(iter); + assert(iter->elmt_left > 0); + assert(maxseq > 0); + assert(maxelem > 0); + assert(nseq); + assert(nelem); + assert(off); + assert(len); /* Check for the special case of just one H5Sselect_hyperslab call made */ if (iter->u.hyp.diminfo_valid) { @@ -2757,16 +2737,20 @@ H5S__hyper_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem static herr_t H5S__hyper_iter_release(H5S_sel_iter_t *iter) { - FUNC_ENTER_PACKAGE_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Check args */ - HDassert(iter); + assert(iter); /* Free the copy of the hyperslab selection span tree */ if (iter->u.hyp.spans != NULL) - H5S__hyper_free_span_info(iter->u.hyp.spans); + if (H5S__hyper_free_span_info(iter->u.hyp.spans) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_iter_release() */ /*-------------------------------------------------------------------------- @@ -2799,7 +2783,7 @@ H5S__hyper_new_span(hsize_t low, hsize_t high, H5S_hyper_span_info_t *down, H5S_ /* Allocate a new span node */ if (NULL == (ret_value = H5FL_MALLOC(H5S_hyper_span_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Copy the span's basic information */ ret_value->low = low; @@ -2842,12 +2826,12 @@ H5S__hyper_new_span_info(unsigned rank) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(rank > 0); - HDassert(rank <= H5S_MAX_RANK); + assert(rank > 0); + assert(rank <= H5S_MAX_RANK); /* Allocate a new span info node */ if (NULL == (ret_value = (H5S_hyper_span_info_t *)H5FL_ARR_CALLOC(hbounds_t, rank * 2))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span info"); /* Set low & high bound pointers into the 'bounds' array */ ret_value->low_bounds = ret_value->bounds; @@ -2889,7 +2873,7 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank, unsigne FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(spans); + assert(spans); /* Check if the span tree was already copied */ if (spans->op_info[op_info_i].op_gen == op_gen) { @@ -2902,7 +2886,7 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank, unsigne else { /* Allocate a new span_info node */ if (NULL == (ret_value = H5S__hyper_new_span_info(rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span info"); /* Set the non-zero span_info information */ H5MM_memcpy(ret_value->low_bounds, spans->low_bounds, rank * sizeof(hsize_t)); @@ -2921,7 +2905,7 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank, unsigne while (span != NULL) { /* Allocate a new node */ if (NULL == (new_span = H5S__hyper_new_span(span->low, span->high, NULL, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Append to list of spans */ if (NULL == prev_span) @@ -2932,7 +2916,7 @@ H5S__hyper_copy_span_helper(H5S_hyper_span_info_t *spans, unsigned rank, unsigne /* Recurse to copy the 'down' spans, if there are any */ if (span->down != NULL) { if (NULL == (new_down = H5S__hyper_copy_span_helper(span->down, rank - 1, op_info_i, op_gen))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab spans") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab spans"); new_span->down = new_down; } /* end if */ @@ -2980,7 +2964,7 @@ H5S__hyper_copy_span(H5S_hyper_span_info_t *spans, unsigned rank) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(spans); + assert(spans); /* Acquire an operation generation value for this operation */ op_gen = H5S__hyper_get_op_gen(); @@ -2989,7 +2973,7 @@ H5S__hyper_copy_span(H5S_hyper_span_info_t *spans, unsigned rank) /* Always use op_info[0] since we own this op_info, so there can be no * simultaneous operations */ if (NULL == (ret_value = H5S__hyper_copy_span_helper(spans, rank, 0, op_gen))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3025,16 +3009,16 @@ H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_sp if (span_info1 != span_info2) { /* Check for one span being NULL */ if (span_info1 == NULL || span_info2 == NULL) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else { /* Compare low & high bounds for this span list */ /* (Could compare lower dimensions also, but not certain if * that's worth it. - QAK, 2019/01/23) */ if (span_info1->low_bounds[0] != span_info2->low_bounds[0]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else if (span_info1->high_bounds[0] != span_info2->high_bounds[0]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else { const H5S_hyper_span_t *span1; const H5S_hyper_span_t *span2; @@ -3044,26 +3028,26 @@ H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_sp span2 = span_info2->head; /* Sanity checking */ - HDassert(span1); - HDassert(span2); + assert(span1); + assert(span2); /* infinite loop which must be broken out of */ while (1) { /* Check for both spans being NULL */ if (span1 == NULL && span2 == NULL) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); else { /* Check for one span being NULL */ if (span1 == NULL || span2 == NULL) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else { /* Check if the actual low & high span information is the same */ if (span1->low != span2->low || span1->high != span2->high) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else { if (span1->down != NULL || span2->down != NULL) { if (!H5S__hyper_cmp_spans(span1->down, span2->down)) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else { /* Keep going... */ } /* end else */ @@ -3095,10 +3079,10 @@ H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_sp PURPOSE Free a hyperslab span info node USAGE - void H5S__hyper_free_span_info(span_info) + herr_t H5S__hyper_free_span_info(span_info) H5S_hyper_span_info_t *span_info; IN: Span info node to free RETURNS - None + SUCCEED/FAIL DESCRIPTION Free a hyperslab span info node, along with all the span nodes and the 'down spans' from the nodes, if reducing their reference count to zero @@ -3108,13 +3092,16 @@ H5S__hyper_cmp_spans(const H5S_hyper_span_info_t *span_info1, const H5S_hyper_sp EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info) { - FUNC_ENTER_PACKAGE_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(span_info); + if (!span_info) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "span_info pointer was NULL"); /* Decrement the span tree's reference count */ span_info->count--; @@ -3132,17 +3119,19 @@ H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info) next_span = span->next; /* Free the current span */ - H5S__hyper_free_span(span); + if (H5S__hyper_free_span(span) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span"); /* Advance to next span */ span = next_span; - } /* end while */ + } /* Free this span info */ span_info = (H5S_hyper_span_info_t *)H5FL_ARR_FREE(hbounds_t, span_info); - } /* end if */ + } - FUNC_LEAVE_NOAPI_VOID +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_free_span_info() */ /*-------------------------------------------------------------------------- @@ -3151,10 +3140,10 @@ H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info) PURPOSE Free a hyperslab span node USAGE - void H5S__hyper_free_span(span) + herr_t H5S__hyper_free_span(span) H5S_hyper_span_t *span; IN: Span node to free RETURNS - None + SUCCEED/FAIL DESCRIPTION Free a hyperslab span node, along with the 'down spans' from the node, if reducing their reference count to zero indicates it is appropriate to @@ -3164,22 +3153,26 @@ H5S__hyper_free_span_info(H5S_hyper_span_info_t *span_info) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void +static herr_t H5S__hyper_free_span(H5S_hyper_span_t *span) { - FUNC_ENTER_PACKAGE_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(span); + assert(span); /* Decrement the reference count of the 'down spans', freeing them if appropriate */ if (span->down != NULL) - H5S__hyper_free_span_info(span->down); + if (H5S__hyper_free_span_info(span->down) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); /* Free this span */ span = H5FL_FREE(H5S_hyper_span_t, span); - FUNC_LEAVE_NOAPI_VOID +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_free_span() */ /*-------------------------------------------------------------------------- @@ -3217,12 +3210,12 @@ H5S__hyper_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(src); - HDassert(dst); + assert(src); + assert(dst); /* Allocate space for the hyperslab selection information */ if (NULL == (dst->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info"); /* Set temporary pointers */ dst_hslab = dst->select.sel_info.hslab; @@ -3286,11 +3279,11 @@ H5S__hyper_is_valid(const H5S_t *space) FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); /* Check for unlimited selection */ if (space->select.sel_info.hslab->unlim_dim >= 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Check which set of low & high bounds we should be using */ if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { @@ -3306,9 +3299,9 @@ H5S__hyper_is_valid(const H5S_t *space) for (u = 0; u < space->extent.rank; u++) { /* Bounds check the selected point + offset against the extent */ if (((hssize_t)low_bounds[u] + space->select.offset[u]) < 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); if ((high_bounds[u] + (hsize_t)space->select.offset[u]) >= space->extent.size[u]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end for */ done: @@ -3342,7 +3335,7 @@ H5S__hyper_span_nblocks_helper(H5S_hyper_span_info_t *spans, unsigned op_info_i, FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(spans); + assert(spans); /* Check if the span tree was already counted */ if (spans->op_info[op_info_i].op_gen == op_gen) @@ -3446,8 +3439,8 @@ H5S__get_select_hyper_nblocks(const H5S_t *space, hbool_t app_ref) FUNC_ENTER_PACKAGE_NOERR - HDassert(space); - HDassert(space->select.sel_info.hslab->unlim_dim < 0); + assert(space); + assert(space->select.sel_info.hslab->unlim_dim < 0); /* Check for a "regular" hyperslab selection */ /* (No need to rebuild the dimension info yet -QAK) */ @@ -3493,12 +3486,12 @@ H5Sget_select_hyper_nblocks(hid_t spaceid) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection"); if (space->select.sel_info.hslab->unlim_dim >= 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, - "cannot get number of blocks for unlimited selection") + "cannot get number of blocks for unlimited selection"); ret_value = (hssize_t)H5S__get_select_hyper_nblocks(space, TRUE); @@ -3592,12 +3585,12 @@ H5S__hyper_get_version_enc_size(H5S_t *space, hsize_t block_count, uint32_t *ver FUNC_ENTER_PACKAGE /* Get bounding box for the selection */ - HDmemset(bounds_end, 0, sizeof(bounds_end)); + memset(bounds_end, 0, sizeof(bounds_end)); if (space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */ /* Get bounding box for the selection */ if (H5S__hyper_bounds(space, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds"); /* Determine whether the number of blocks or the high bounds in the selection exceed (2^32 - 1) */ if (block_count > H5S_UINT32_MAX) @@ -3612,7 +3605,7 @@ H5S__hyper_get_version_enc_size(H5S_t *space, hsize_t block_count, uint32_t *ver /* Get the file's low_bound and high_bound */ if (H5CX_get_libver_bounds(&low_bound, &high_bound) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get low/high bounds from API context") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get low/high bounds from API context"); /* Determine regular hyperslab */ is_regular = H5S__hyper_is_regular(space); @@ -3632,13 +3625,13 @@ H5S__hyper_get_version_enc_size(H5S_t *space, hsize_t block_count, uint32_t *ver /* Fail for irregular hyperslab if exceeds 32 bits */ if (count_up_version) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, - "The number of blocks in hyperslab selection exceeds 2^32") + "The number of blocks in hyperslab selection exceeds 2^32"); else if (bound_up_version) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, - "The end of bounding box in hyperslab selection exceeds 2^32") + "The end of bounding box in hyperslab selection exceeds 2^32"); else HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, - "Dataspace hyperslab selection version out of bounds") + "Dataspace hyperslab selection version out of bounds"); } /* end if */ /* Set the message version */ @@ -3688,7 +3681,7 @@ H5S__hyper_get_version_enc_size(H5S_t *space, hsize_t block_count, uint32_t *ver } /* end if */ else { hsize_t max_size = block_count; - HDassert(space->select.sel_info.hslab->unlim_dim < 0); + assert(space->select.sel_info.hslab->unlim_dim < 0); /* Find max for block_count and bounds_end[] */ for (u = 0; u < space->extent.rank; u++) @@ -3701,7 +3694,7 @@ H5S__hyper_get_version_enc_size(H5S_t *space, hsize_t block_count, uint32_t *ver break; default: - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown hyperslab selection version") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown hyperslab selection version"); break; } @@ -3738,7 +3731,7 @@ H5S__hyper_serial_size(H5S_t *space) FUNC_ENTER_PACKAGE - HDassert(space); + assert(space); /* Determine the number of blocks */ if (space->select.sel_info.hslab->unlim_dim < 0) /* ! H5S_UNLIMITED */ @@ -3746,7 +3739,7 @@ H5S__hyper_serial_size(H5S_t *space) /* Determine the version and the encoded size */ if (H5S__hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version & enc_size") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version & enc_size"); if (version == H5S_HYPER_VERSION_3) { /* Version 3: regular */ @@ -3780,12 +3773,12 @@ H5S__hyper_serial_size(H5S_t *space) * (4 (start/stride/count/block) * * ) = * 17 + (4 * 8 * rank) bytes */ - HDassert(enc_size == 8); + assert(enc_size == 8); ret_value = (hssize_t)17 + ((hssize_t)4 * (hssize_t)8 * (hssize_t)space->extent.rank); } else { - HDassert(version == H5S_HYPER_VERSION_1); - HDassert(enc_size == 4); + assert(version == H5S_HYPER_VERSION_1); + assert(enc_size == 4); /* Version 1 */ /* Basic number of bytes required to serialize hyperslab selection: * + + + @@ -3835,11 +3828,11 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, hsize_t *start, FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(spans); - HDassert(start); - HDassert(end); - HDassert(rank < H5S_MAX_RANK); - HDassert(p && pp); + assert(spans); + assert(start); + assert(end); + assert(rank < H5S_MAX_RANK); + assert(p && pp); /* Walk through the list of spans, recursing or outputting them */ curr = spans->head; @@ -3907,7 +3900,7 @@ H5S__hyper_serialize_helper(const H5S_hyper_span_info_t *spans, hsize_t *start, break; default: - HDassert(0 && "Unknown enc size?!?"); + assert(0 && "Unknown enc size?!?"); } /* end switch */ } /* end else */ @@ -3968,10 +3961,10 @@ H5S__hyper_serialize(H5S_t *space, uint8_t **p) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(space); - HDassert(p); + assert(space); + assert(p); pp = (*p); - HDassert(pp); + assert(pp); /* Set some convenience values */ ndims = space->extent.rank; @@ -3983,7 +3976,7 @@ H5S__hyper_serialize(H5S_t *space, uint8_t **p) /* Determine the version and the encoded size */ if (H5S__hyper_get_version_enc_size(space, block_count, &version, &enc_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version & enc_size") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine hyper version & enc_size"); is_regular = H5S__hyper_is_regular(space); if (is_regular && (version == H5S_HYPER_VERSION_2 || version == H5S_HYPER_VERSION_3)) @@ -4013,68 +4006,68 @@ H5S__hyper_serialize(H5S_t *space, uint8_t **p) if (is_regular) { if (version >= H5S_HYPER_VERSION_2) { - HDassert(H5S_UNLIMITED == HSIZE_UNDEF); + assert(H5S_UNLIMITED == HSIZE_UNDEF); /* Iterate over dimensions */ /* Encode start/stride/block/count */ switch (enc_size) { case H5S_SELECT_INFO_ENC_SIZE_2: - HDassert(version == H5S_HYPER_VERSION_3); + assert(version == H5S_HYPER_VERSION_3); for (u = 0; u < space->extent.rank; u++) { UINT16ENCODE(pp, diminfo[u].start); UINT16ENCODE(pp, diminfo[u].stride); if (diminfo[u].count == H5S_UNLIMITED) - UINT16ENCODE(pp, H5S_UINT16_MAX) + UINT16ENCODE(pp, H5S_UINT16_MAX); else - UINT16ENCODE(pp, diminfo[u].count) + UINT16ENCODE(pp, diminfo[u].count); if (diminfo[u].block == H5S_UNLIMITED) - UINT16ENCODE(pp, H5S_UINT16_MAX) + UINT16ENCODE(pp, H5S_UINT16_MAX); else - UINT16ENCODE(pp, diminfo[u].block) + UINT16ENCODE(pp, diminfo[u].block); } /* end for */ break; case H5S_SELECT_INFO_ENC_SIZE_4: - HDassert(version == H5S_HYPER_VERSION_3); + assert(version == H5S_HYPER_VERSION_3); for (u = 0; u < space->extent.rank; u++) { UINT32ENCODE(pp, diminfo[u].start); UINT32ENCODE(pp, diminfo[u].stride); if (diminfo[u].count == H5S_UNLIMITED) - UINT32ENCODE(pp, H5S_UINT32_MAX) + UINT32ENCODE(pp, H5S_UINT32_MAX); else - UINT32ENCODE(pp, diminfo[u].count) + UINT32ENCODE(pp, diminfo[u].count); if (diminfo[u].block == H5S_UNLIMITED) - UINT32ENCODE(pp, H5S_UINT32_MAX) + UINT32ENCODE(pp, H5S_UINT32_MAX); else - UINT32ENCODE(pp, diminfo[u].block) + UINT32ENCODE(pp, diminfo[u].block); } /* end for */ break; case H5S_SELECT_INFO_ENC_SIZE_8: - HDassert(version == H5S_HYPER_VERSION_2 || version == H5S_HYPER_VERSION_3); + assert(version == H5S_HYPER_VERSION_2 || version == H5S_HYPER_VERSION_3); for (u = 0; u < space->extent.rank; u++) { UINT64ENCODE(pp, diminfo[u].start); UINT64ENCODE(pp, diminfo[u].stride); if (diminfo[u].count == H5S_UNLIMITED) - UINT64ENCODE(pp, H5S_UINT64_MAX) + UINT64ENCODE(pp, H5S_UINT64_MAX); else - UINT64ENCODE(pp, diminfo[u].count) + UINT64ENCODE(pp, diminfo[u].count); if (diminfo[u].block == H5S_UNLIMITED) - UINT64ENCODE(pp, H5S_UINT64_MAX) + UINT64ENCODE(pp, H5S_UINT64_MAX); else - UINT64ENCODE(pp, diminfo[u].block) + UINT64ENCODE(pp, diminfo[u].block); } /* end for */ if (version == H5S_HYPER_VERSION_2) len += (4 * space->extent.rank * 8); break; default: HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, - "unknown offset info size for hyperslab") + "unknown offset info size for hyperslab"); break; } /* end switch */ } /* end if */ else { - HDassert(version == H5S_HYPER_VERSION_1); + assert(version == H5S_HYPER_VERSION_1); /* Set some convenience values */ fast_dim = ndims - 1; @@ -4155,24 +4148,24 @@ H5S__hyper_serialize(H5S_t *space, uint8_t **p) /* Encode number of hyperslabs */ switch (enc_size) { case H5S_SELECT_INFO_ENC_SIZE_2: - HDassert(version == H5S_HYPER_VERSION_3); + assert(version == H5S_HYPER_VERSION_3); H5_CHECK_OVERFLOW(block_count, hsize_t, uint16_t); UINT16ENCODE(pp, (uint16_t)block_count); break; case H5S_SELECT_INFO_ENC_SIZE_4: - HDassert(version == H5S_HYPER_VERSION_1 || version == H5S_HYPER_VERSION_3); + assert(version == H5S_HYPER_VERSION_1 || version == H5S_HYPER_VERSION_3); H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); UINT32ENCODE(pp, (uint32_t)block_count); break; case H5S_SELECT_INFO_ENC_SIZE_8: - HDassert(version == H5S_HYPER_VERSION_3); + assert(version == H5S_HYPER_VERSION_3); UINT64ENCODE(pp, block_count); break; default: - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab"); break; } /* end switch */ @@ -4222,27 +4215,27 @@ H5S__hyper_serialize(H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) +H5S__hyper_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hbool_t skip) { - H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, - either *space or a newly allocated one */ - hsize_t dims[H5S_MAX_RANK]; /* Dimension sizes */ - hsize_t start[H5S_MAX_RANK]; /* hyperslab start information */ - hsize_t block[H5S_MAX_RANK]; /* hyperslab block information */ - uint32_t version; /* Version number */ - uint8_t flags = 0; /* Flags */ - uint8_t enc_size = 0; /* Encoded size of selection info */ - unsigned rank; /* rank of points */ - const uint8_t *pp; /* Local pointer for decoding */ - unsigned u; /* Local counting variable */ - herr_t ret_value = FAIL; /* return value */ - + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ + hsize_t dims[H5S_MAX_RANK]; /* Dimension sizes */ + hsize_t start[H5S_MAX_RANK]; /* hyperslab start information */ + hsize_t block[H5S_MAX_RANK]; /* hyperslab block information */ + uint32_t version; /* Version number */ + uint8_t flags = 0; /* Flags */ + uint8_t enc_size = 0; /* Encoded size of selection info */ + unsigned rank; /* rank of points */ + const uint8_t *pp; /* Local pointer for decoding */ + unsigned u; /* Local counting variable */ + herr_t ret_value = FAIL; /* return value */ + const uint8_t *p_end = *p + p_size - 1; /* Pointer to last valid byte in buffer */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(p); + assert(p); pp = (*p); - HDassert(pp); + assert(pp); /* As part of the efforts to push all selection-type specific coding to the callbacks, the coding for the allocation of a null dataspace @@ -4251,71 +4244,90 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Allocate space if not provided */ if (!*space) { if (NULL == (tmp_space = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace"); } /* end if */ else tmp_space = *space; /* Decode version */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection version"); UINT32DECODE(pp, version); if (version < H5S_HYPER_VERSION_1 || version > H5S_HYPER_VERSION_LATEST) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for hyperslab selection"); if (version >= (uint32_t)H5S_HYPER_VERSION_2) { /* Decode flags */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, 1, p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection flags"); flags = *(pp)++; - if (version >= (uint32_t)H5S_HYPER_VERSION_3) + if (version >= (uint32_t)H5S_HYPER_VERSION_3) { /* decode size of offset info */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, 1, p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding selection encoding size"); enc_size = *(pp)++; + } else { /* Skip over the remainder of the header */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, 4, p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding selection header"); pp += 4; enc_size = H5S_SELECT_INFO_ENC_SIZE_8; } /* end else */ /* Check for unknown flags */ if (flags & ~H5S_SELECT_FLAG_BITS) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown flag for selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown flag for selection"); } else { /* Skip over the remainder of the header */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, 8, p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection header"); pp += 8; enc_size = H5S_SELECT_INFO_ENC_SIZE_4; } /* end else */ /* Check encoded */ if (enc_size & ~H5S_SELECT_INFO_ENC_SIZE_BITS) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown size of point/offset info for selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown size of point/offset info for selection"); /* Decode the rank of the point selection */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection rank"); UINT32DECODE(pp, rank); if (!*space) { /* Patch the rank of the allocated dataspace */ - HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); + memset(dims, 0, (size_t)rank * sizeof(dims[0])); if (H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions"); } /* end if */ else /* Verify the rank of the provided dataspace */ if (rank != tmp_space->extent.rank) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, - "rank of serialized selection does not match dataspace") + "rank of serialized selection does not match dataspace"); if (flags & H5S_HYPER_REGULAR) { hsize_t stride[H5S_MAX_RANK]; /* Hyperslab stride information */ hsize_t count[H5S_MAX_RANK]; /* Hyperslab count information */ /* Sanity checks */ - HDassert(H5S_UNLIMITED == HSIZE_UNDEF); - HDassert(version >= H5S_HYPER_VERSION_2); + assert(H5S_UNLIMITED == HSIZE_UNDEF); + assert(version >= H5S_HYPER_VERSION_2); /* Decode start/stride/block/count */ switch (enc_size) { case H5S_SELECT_INFO_ENC_SIZE_2: for (u = 0; u < tmp_space->extent.rank; u++) { + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, 4 * sizeof(uint16_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding selection ranks"); + UINT16DECODE(pp, start[u]); UINT16DECODE(pp, stride[u]); @@ -4331,6 +4343,10 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) case H5S_SELECT_INFO_ENC_SIZE_4: for (u = 0; u < tmp_space->extent.rank; u++) { + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, 4 * sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding selection ranks"); + UINT32DECODE(pp, start[u]); UINT32DECODE(pp, stride[u]); @@ -4346,6 +4362,10 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) case H5S_SELECT_INFO_ENC_SIZE_8: for (u = 0; u < tmp_space->extent.rank; u++) { + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, 4 * sizeof(uint64_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding selection ranks"); + UINT64DECODE(pp, start[u]); UINT64DECODE(pp, stride[u]); @@ -4360,13 +4380,13 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) break; default: - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab"); break; } /* end switch */ /* Select the hyperslab to the current selection */ if ((ret_value = H5S_select_hyperslab(tmp_space, H5S_SELECT_SET, start, stride, count, block)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection"); } /* end if */ else { const hsize_t *stride; /* Hyperslab stride information */ @@ -4381,19 +4401,28 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Decode the number of blocks */ switch (enc_size) { case H5S_SELECT_INFO_ENC_SIZE_2: + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint16_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding number of selection blocks"); UINT16DECODE(pp, num_elem); break; case H5S_SELECT_INFO_ENC_SIZE_4: + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding number of selection blocks"); UINT32DECODE(pp, num_elem); break; case H5S_SELECT_INFO_ENC_SIZE_8: + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint64_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding number of selection blocks"); UINT64DECODE(pp, num_elem); break; default: - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown offset info size for hyperslab"); break; } /* end switch */ @@ -4405,6 +4434,10 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Decode the starting and ending points */ switch (enc_size) { case H5S_SELECT_INFO_ENC_SIZE_2: + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, rank * 2 * sizeof(uint16_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding selection coordinates"); + for (tstart = start, v = 0; v < rank; v++, tstart++) UINT16DECODE(pp, *tstart); for (tend = end, v = 0; v < rank; v++, tend++) @@ -4412,6 +4445,10 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) break; case H5S_SELECT_INFO_ENC_SIZE_4: + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, rank * 2 * sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding selection coordinates"); + for (tstart = start, v = 0; v < rank; v++, tstart++) UINT32DECODE(pp, *tstart); for (tend = end, v = 0; v < rank; v++, tend++) @@ -4419,6 +4456,10 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) break; case H5S_SELECT_INFO_ENC_SIZE_8: + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, rank * 2 * sizeof(uint64_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding selection coordinates"); + for (tstart = start, v = 0; v < rank; v++, tstart++) UINT64DECODE(pp, *tstart); for (tend = end, v = 0; v < rank; v++, tend++) @@ -4427,7 +4468,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) default: HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, - "unknown offset info size for hyperslab") + "unknown offset info size for hyperslab"); break; } /* end switch */ @@ -4438,7 +4479,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Select or add the hyperslab to the current selection */ if ((ret_value = H5S_select_hyperslab(tmp_space, (u == 0 ? H5S_SELECT_SET : H5S_SELECT_OR), start, stride, count, block)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't change selection"); } /* end for */ } /* end else */ @@ -4453,7 +4494,7 @@ H5S__hyper_deserialize(H5S_t **space, const uint8_t **p) /* Free temporary space if not passed to caller (only happens on error) */ if (!*space && tmp_space) if (H5S_close(tmp_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_deserialize() */ @@ -4501,13 +4542,13 @@ H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[], h FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(spans); - HDassert(rank < H5S_MAX_RANK); - HDassert(start); - HDassert(end); - HDassert(startblock); - HDassert(numblocks && *numblocks > 0); - HDassert(buf && *buf); + assert(spans); + assert(rank < H5S_MAX_RANK); + assert(start); + assert(end); + assert(startblock); + assert(numblocks && *numblocks > 0); + assert(buf && *buf); /* Walk through the list of spans, recursing or outputting them */ curr = spans->head; @@ -4520,7 +4561,7 @@ H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[], h /* Recurse down to the next dimension */ if (H5S__hyper_span_blocklist(curr->down, start, end, (rank + 1), startblock, numblocks, buf) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans"); } /* end if */ else { /* Skip this block if we haven't skipped all the startblocks yet */ @@ -4598,9 +4639,9 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numblo FUNC_ENTER_PACKAGE_NOERR - HDassert(space); - HDassert(buf); - HDassert(space->select.sel_info.hslab->unlim_dim < 0); + assert(space); + assert(buf); + assert(space->select.sel_info.hslab->unlim_dim < 0); /* Attempt to rebuild diminfo if it is invalid and has not been confirmed * to be impossible. @@ -4673,7 +4714,7 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hsize_t startblock, hsize_t numblo /* Iterate over the blocks in the fastest dimension */ while (tmp_count[fast_dim] > 0 && numblocks > 0) { /* Sanity check */ - HDassert(startblock == 0); + assert(startblock == 0); /* Copy the starting location */ H5MM_memcpy(buf, offset, sizeof(hsize_t) * ndims); @@ -4784,13 +4825,13 @@ H5Sget_select_hyper_blocklist(hid_t spaceid, hsize_t startblock, hsize_t numbloc /* Check args */ if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer"); if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection"); if (space->select.sel_info.hslab->unlim_dim >= 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot get blocklist for unlimited selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "cannot get blocklist for unlimited selection"); /* Go get the correct number of blocks */ if (numblocks > 0) @@ -4837,9 +4878,9 @@ H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(space); - HDassert(start); - HDassert(end); + assert(space); + assert(start); + assert(end); /* Check which set of low & high bounds we should be using */ if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { @@ -4858,11 +4899,11 @@ H5S__hyper_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) /* Loop over dimensions */ for (u = 0; u < space->extent.rank; u++) { /* Sanity check */ - HDassert(low_bounds[u] <= high_bounds[u]); + assert(low_bounds[u] <= high_bounds[u]); /* Check for offset moving selection negative */ if (((hssize_t)low_bounds[u] + space->select.offset[u]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds"); /* Set the low & high bounds in this dimension */ start[u] = (hsize_t)((hssize_t)low_bounds[u] + space->select.offset[u]); @@ -4914,8 +4955,8 @@ H5S__hyper_offset(const H5S_t *space, hsize_t *offset) FUNC_ENTER_PACKAGE - HDassert(space && space->extent.rank > 0); - HDassert(offset); + assert(space && space->extent.rank > 0); + assert(offset); /* Start at linear offset 0 */ *offset = 0; @@ -4939,7 +4980,7 @@ H5S__hyper_offset(const H5S_t *space, hsize_t *offset) /* Check for offset moving selection out of the dataspace */ if (hyp_offset < 0 || (hsize_t)hyp_offset >= dim_size[i]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds"); /* Add the hyperslab's offset in this dimension to the total linear offset */ *offset += (hsize_t)(hyp_offset * (hssize_t)accum); @@ -4973,14 +5014,14 @@ H5S__hyper_offset(const H5S_t *space, hsize_t *offset) /* Check for offset moving selection out of the dataspace */ if (hyp_offset < 0 || (hsize_t)hyp_offset >= dim_size[i]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds"); /* Add the hyperslab's offset in this dimension to the total linear offset */ *offset += (hsize_t)(hyp_offset * (hssize_t)dim_accum[i]); /* Advance to first span in "down" dimension */ if (span->down) { - HDassert(span->down->head); + assert(span->down->head); span = span->down->head; } /* end if */ else @@ -5016,7 +5057,7 @@ H5S__hyper_unlim_dim(const H5S_t *space) { FUNC_ENTER_PACKAGE_NOERR - FUNC_LEAVE_NOAPI(space->select.sel_info.hslab->unlim_dim); + FUNC_LEAVE_NOAPI(space->select.sel_info.hslab->unlim_dim) } /* end H5S__hyper_unlim_dim() */ /*-------------------------------------------------------------------------- @@ -5047,14 +5088,14 @@ H5S__hyper_num_elem_non_unlim(const H5S_t *space, hsize_t *num_elem_non_unlim) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(space); - HDassert(num_elem_non_unlim); + assert(space); + assert(num_elem_non_unlim); /* Get number of elements in the non-unlimited dimensions */ if (space->select.sel_info.hslab->unlim_dim >= 0) *num_elem_non_unlim = space->select.sel_info.hslab->num_elem_non_unlim; else - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "selection has no unlimited dimension") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "selection has no unlimited dimension"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5088,7 +5129,7 @@ H5S__hyper_is_contiguous(const H5S_t *space) FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); /* Check for a "regular" hyperslab selection */ /* (No need to rebuild the dimension info yet -QAK) */ @@ -5273,7 +5314,7 @@ H5S__hyper_is_single(const H5S_t *space) FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); /* Check for a "single" hyperslab selection */ /* (No need to rebuild the dimension info yet, since the span-tree @@ -5290,7 +5331,7 @@ H5S__hyper_is_single(const H5S_t *space) /* Check for a single block */ for (u = 0; u < space->extent.rank; u++) if (space->select.sel_info.hslab->diminfo.opt[u].count > 1) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ else { H5S_hyper_span_info_t *spans; /* Hyperslab span info node */ @@ -5309,7 +5350,7 @@ H5S__hyper_is_single(const H5S_t *space) /* Check that this is the only span and it spans the entire dimension */ if (span->next != NULL) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else /* Walk down to the next span */ spans = span->down; @@ -5347,7 +5388,7 @@ H5S__hyper_is_regular(H5S_t *space) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); + assert(space); /* Attempt to rebuild diminfo if it is invalid and has not been confirmed * to be impossible. @@ -5399,19 +5440,19 @@ H5S__hyper_spans_shape_same_helper(const H5S_hyper_span_info_t *span_info1, FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(span_info1); - HDassert(span_info2); - HDassert(offset); - HDassert(rest_zeros); + assert(span_info1); + assert(span_info2); + assert(offset); + assert(rest_zeros); /* Compare low & high bounds for this span list */ /* (Could compare lower dimensions also, but not certain if * that's worth it. - QAK, 2019/01/23) */ if ((hsize_t)((hssize_t)span_info1->low_bounds[0] + offset[0]) != span_info2->low_bounds[0]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else if ((hsize_t)((hssize_t)span_info1->high_bounds[0] + offset[0]) != span_info2->high_bounds[0]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else { const H5S_hyper_span_t *span1; const H5S_hyper_span_t *span2; @@ -5421,30 +5462,30 @@ H5S__hyper_spans_shape_same_helper(const H5S_hyper_span_info_t *span_info1, span2 = span_info2->head; /* Sanity checking */ - HDassert(span1); - HDassert(span2); + assert(span1); + assert(span2); /* infinite loop which must be broken out of */ while (1) { /* Check for both spans being NULL */ if (span1 == NULL && span2 == NULL) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); /* Check for one span being NULL */ if (span1 == NULL || span2 == NULL) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Check if the actual low & high span information is the same */ if ((hsize_t)((hssize_t)span1->low + offset[0]) != span2->low || (hsize_t)((hssize_t)span1->high + offset[0]) != span2->high) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Check for down tree for this span */ if (span1->down != NULL || span2->down != NULL) { /* If the rest of the span trees have a zero offset, use the faster comparison routine */ if (rest_zeros[0]) { if (!H5S__hyper_cmp_spans(span1->down, span2->down)) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else { /* Keep going... */ } /* end else */ @@ -5452,7 +5493,7 @@ H5S__hyper_spans_shape_same_helper(const H5S_hyper_span_info_t *span_info1, else { if (!H5S__hyper_spans_shape_same_helper(span1->down, span2->down, &offset[1], &rest_zeros[1])) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else { /* Keep going... */ } /* end else */ @@ -5509,13 +5550,13 @@ H5S__hyper_spans_shape_same(const H5S_hyper_span_info_t *span_info1, const H5S_h FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(span_info1); - HDassert(span_info2); - HDassert(ndims > 0); + assert(span_info1); + assert(span_info2); + assert(ndims > 0); /* Initialize arrays */ - HDmemset(offset, 0, sizeof(offset)); - HDmemset(rest_zeros, 0, sizeof(rest_zeros)); + memset(offset, 0, sizeof(offset)); + memset(rest_zeros, 0, sizeof(rest_zeros)); /* Check for an offset between the two selections */ span1 = span_info1->head; @@ -5533,7 +5574,7 @@ H5S__hyper_spans_shape_same(const H5S_hyper_span_info_t *span_info1, const H5S_h /* Sanity check */ /* (Both span trees must have the same depth) */ - HDassert((span1->down && span2->down) || (NULL == span1->down && NULL == span2->down)); + assert((span1->down && span2->down) || (NULL == span1->down && NULL == span2->down)); /* Advance to next dimension */ if (span1->down) { @@ -5555,7 +5596,7 @@ H5S__hyper_spans_shape_same(const H5S_hyper_span_info_t *span_info1, const H5S_h /* Sanity check */ /* (Must eventually have found a non-zero offset) */ - HDassert(i >= 0); + assert(i >= 0); } /* end if */ /* If the offset vector is all zero, we can use the faster span tree @@ -5604,16 +5645,16 @@ H5S__hyper_shape_same(H5S_t *space1, H5S_t *space2) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space1); - HDassert(space2); + assert(space1); + assert(space2); /* Get dataspace ranks */ space1_rank = space1->extent.rank; space2_rank = space2->extent.rank; /* Sanity check */ - HDassert(space1_rank >= space2_rank); - HDassert(space2_rank > 0); + assert(space1_rank >= space2_rank); + assert(space2_rank > 0); /* Rebuild diminfo if it is invalid and has not been confirmed to be * impossible */ @@ -5638,15 +5679,15 @@ H5S__hyper_shape_same(H5S_t *space1, H5S_t *space2) while (space2_dim >= 0) { if (space1->select.sel_info.hslab->diminfo.opt[space1_dim].stride != space2->select.sel_info.hslab->diminfo.opt[space2_dim].stride) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); if (space1->select.sel_info.hslab->diminfo.opt[space1_dim].count != space2->select.sel_info.hslab->diminfo.opt[space2_dim].count) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); if (space1->select.sel_info.hslab->diminfo.opt[space1_dim].block != space2->select.sel_info.hslab->diminfo.opt[space2_dim].block) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); space1_dim--; space2_dim--; @@ -5654,7 +5695,7 @@ H5S__hyper_shape_same(H5S_t *space1, H5S_t *space2) while (space1_dim >= 0) { if (space1->select.sel_info.hslab->diminfo.opt[space1_dim].block != 1) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); space1_dim--; } /* end while */ @@ -5667,11 +5708,11 @@ H5S__hyper_shape_same(H5S_t *space1, H5S_t *space2) if (NULL == space1->select.sel_info.hslab->span_lst) if (H5S__hyper_generate_spans(space1) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, - "can't construct span tree for hyperslab selection") + "can't construct span tree for hyperslab selection"); if (NULL == space2->select.sel_info.hslab->span_lst) if (H5S__hyper_generate_spans(space2) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, - "can't construct span tree for hyperslab selection") + "can't construct span tree for hyperslab selection"); /* If rank of space A is different (guaranteed greater) than * rank of space B, walk down the span tree, verifying @@ -5690,11 +5731,11 @@ H5S__hyper_shape_same(H5S_t *space1, H5S_t *space2) /* Check for more spans in this dimension */ if (span->next) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Check for span size > 1 element */ if (span->low != span->high) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Walk down to the next dimension */ spans1 = span->down; @@ -5702,7 +5743,7 @@ H5S__hyper_shape_same(H5S_t *space1, H5S_t *space2) } /* end while */ /* Sanity check */ - HDassert(spans1); + assert(spans1); } /* end if */ else spans1 = space1->select.sel_info.hslab->span_lst; @@ -5737,10 +5778,12 @@ H5S__hyper_shape_same(H5S_t *space1, H5S_t *space2) static herr_t H5S__hyper_release(H5S_t *space) { - FUNC_ENTER_PACKAGE_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space)); + assert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space)); /* Reset the number of points selected */ space->select.num_elem = 0; @@ -5748,13 +5791,15 @@ H5S__hyper_release(H5S_t *space) /* Release irregular hyperslab information */ if (space->select.sel_info.hslab) { if (space->select.sel_info.hslab->span_lst != NULL) - H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst); + if (H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "unable to free span info"); /* Release space for the hyperslab selection information */ space->select.sel_info.hslab = H5FL_FREE(H5S_hyper_sel_t, space->select.sel_info.hslab); - } /* end if */ + } - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_release() */ /*-------------------------------------------------------------------------- @@ -5784,14 +5829,14 @@ H5S__hyper_coord_to_span(unsigned rank, const hsize_t *coords) FUNC_ENTER_PACKAGE - HDassert(rank > 0); - HDassert(coords); + assert(rank > 0); + assert(coords); /* Search for location to insert new element in tree */ if (rank > 1) { /* Allocate a span info node for coordinates below this one */ if (NULL == (down = H5S__hyper_new_span_info(rank - 1))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Set the low & high bounds for this span info node */ H5MM_memcpy(down->low_bounds, &coords[1], (rank - 1) * sizeof(hsize_t)); @@ -5799,7 +5844,7 @@ H5S__hyper_coord_to_span(unsigned rank, const hsize_t *coords) /* Build span tree for coordinates below this one */ if (NULL == (down->head = H5S__hyper_coord_to_span(rank - 1, &coords[1]))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Update the tail pointer of the down dimension, and it's a single span element */ down->tail = down->head; @@ -5807,14 +5852,15 @@ H5S__hyper_coord_to_span(unsigned rank, const hsize_t *coords) /* Build span for this coordinate */ if (NULL == (new_span = H5S__hyper_new_span(coords[0], coords[0], down, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Set return value */ ret_value = new_span; done: if (ret_value == NULL && down != NULL) - H5S__hyper_free_span_info(down); + if (H5S__hyper_free_span_info(down) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, NULL, "unable to free span info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_coord_to_span() */ @@ -5850,10 +5896,10 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ra FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(span_tree); - HDassert(rank > 0); - HDassert(coords); - HDassert(first_dim_modified); + assert(span_tree); + assert(rank > 0); + assert(coords); + assert(first_dim_modified); /* Get pointer to last span in span tree */ tail_span = span_tree->tail; @@ -5869,9 +5915,9 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ra prev_down_tail_span_high = tail_span->down->tail->high; /* Drop down a dimension */ - HDassert(rank > 1); + assert(rank > 1); if (H5S__hyper_add_span_element_helper(tail_span->down, rank - 1, &coords[1], first_dim_modified) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert coordinate into span tree") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert coordinate into span tree"); /* Check & update high bounds for lower dimensions */ if (*first_dim_modified >= 0) { @@ -5914,14 +5960,14 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ra /* Determine which span to stop at */ if (tail_span->down->tail != prev_down_tail_span) { /* Sanity check */ - HDassert(prev_down_tail_span->next == tail_span->down->tail); + assert(prev_down_tail_span->next == tail_span->down->tail); /* Set the span to stop at */ stop_span = prev_down_tail_span; } /* end if */ else { /* Sanity check */ - HDassert(prev_down_tail_span_high != tail_span->down->tail->high); + assert(prev_down_tail_span_high != tail_span->down->tail->high); /* Set the span to stop at */ stop_span = tail_span->down->tail; @@ -5974,26 +6020,28 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ra /* Update pointers appropriately */ if (stop_span == prev_down_tail_span) { /* Sanity check */ - HDassert(stop_span->next == tail_span->down->tail); + assert(stop_span->next == tail_span->down->tail); tmp_span->next = stop_span->next; } /* end if */ else { /* Sanity check */ - HDassert(tmp_span->next == tail_span->down->tail); + assert(tmp_span->next == tail_span->down->tail); tmp_span->next = NULL; tail_span->down->tail = tmp_span; } /* end else */ /* Release last span created */ - H5S__hyper_free_span(stop_span); - } /* end if */ + if (H5S__hyper_free_span(stop_span) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span"); + } /* Span is disjoint, but has the same "down tree" selection */ /* (If it has a "down tree") */ else if (stop_span->down) { /* Release "down tree" information */ - H5S__hyper_free_span_info(stop_span->down); + if (H5S__hyper_free_span_info(stop_span->down) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); /* Point at earlier span's "down tree" */ stop_span->down = tmp_span->down; @@ -6026,7 +6074,7 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ra /* Make span tree for current coordinate(s) */ if (NULL == (new_span = H5S__hyper_coord_to_span(rank, coords))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, - "can't allocate hyperslab spans for coordinate") + "can't allocate hyperslab spans for coordinate"); /* Add new span to span tree list */ tail_span->next = new_span; @@ -6034,7 +6082,7 @@ H5S__hyper_add_span_element_helper(H5S_hyper_span_info_t *span_tree, unsigned ra } /* end else */ /* Update high bound for current span tree */ - HDassert(coords[0] > span_tree->high_bounds[0]); + assert(coords[0] > span_tree->high_bounds[0]); span_tree->high_bounds[0] = coords[0]; /* Update high bounds for dimensions below this one */ @@ -6096,16 +6144,16 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords) FUNC_ENTER_NOAPI(FAIL) - HDassert(space); - HDassert(rank > 0); - HDassert(coords); - HDassert(space->extent.rank == rank); + assert(space); + assert(rank > 0); + assert(coords); + assert(space->extent.rank == rank); /* Check if this is the first element in the selection */ if (NULL == space->select.sel_info.hslab) { /* Allocate a span info node */ if (NULL == (head = H5S__hyper_new_span_info(rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span info"); /* Set the low & high bounds for this span info node */ H5MM_memcpy(head->low_bounds, coords, rank * sizeof(hsize_t)); @@ -6116,14 +6164,14 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords) /* Build span tree for this coordinate */ if (NULL == (head->head = H5S__hyper_coord_to_span(rank, coords))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab spans for coordinate") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab spans for coordinate"); /* Update the tail pointer of this newly created span in dimension "rank" */ head->tail = head->head; /* Allocate selection info */ if (NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab selection"); /* Set the selection to the new span tree */ space->select.sel_info.hslab->span_lst = head; @@ -6146,7 +6194,7 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords) /* Add the element to the current set of spans */ if (H5S__hyper_add_span_element_helper(space->select.sel_info.hslab->span_lst, rank, coords, &first_dim_modified) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert coordinate into span tree") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert coordinate into span tree"); /* Increment # of elements in selection */ space->select.num_elem++; @@ -6155,7 +6203,8 @@ H5S_hyper_add_span_element(H5S_t *space, unsigned rank, const hsize_t *coords) done: if (ret_value < 0) if (head) - H5S__hyper_free_span_info(head); + if (H5S__hyper_free_span_info(head) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_add_span_element() */ @@ -6191,9 +6240,9 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans, unsigned rank, c FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(spans); - HDassert(start); - HDassert(end); + assert(spans); + assert(start); + assert(end); /* Check if we've already visited this span tree */ if (spans->op_info[op_info_i].op_gen != op_gen) { @@ -6205,7 +6254,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans, unsigned rank, c */ for (u = 0; u < rank; u++) if (start[u] > spans->high_bounds[u] || end[u] < spans->low_bounds[u]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Get the span list for spans in this tree */ curr = spans->head; @@ -6218,12 +6267,12 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans, unsigned rank, c curr = curr->next; /* If this span is past the end of the block, then we're done in this dimension */ else if (curr->low > *end) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* block & span overlap */ else { /* If this is the bottom dimension, then the span tree overlaps the block */ if (curr->down == NULL) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); /* Recursively check spans in next dimension down */ else { /* If there is an intersection in the "down" dimensions, @@ -6231,7 +6280,7 @@ H5S__hyper_intersect_block_helper(H5S_hyper_span_info_t *spans, unsigned rank, c */ if (H5S__hyper_intersect_block_helper(curr->down, rank - 1, start + 1, end + 1, op_info_i, op_gen)) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); /* No intersection in down dimensions, advance to next span */ curr = curr->next; @@ -6278,10 +6327,10 @@ H5S__hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *en FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(space); - HDassert(H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space)); - HDassert(start); - HDassert(end); + assert(space); + assert(H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space)); + assert(start); + assert(end); /* Attempt to rebuild diminfo if it is invalid and has not been confirmed * to be impossible. @@ -6308,7 +6357,7 @@ H5S__hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *en * would have been rejected earlier, if they didn't intersect. */ if (single_block) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); else { /* Loop over the dimensions, checking for an intersection */ for (u = 0; u < space->extent.rank; u++) { @@ -6328,7 +6377,7 @@ H5S__hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *en nstride = 0; /* Sanity check */ - HDassert(nstride <= space->select.sel_info.hslab->diminfo.opt[u].count); + assert(nstride <= space->select.sel_info.hslab->diminfo.opt[u].count); /* "Rebase" the adjusted start coord into the same range * range of values as the selections's first block. @@ -6353,7 +6402,7 @@ H5S__hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *en * it doesn't intersect. */ if (adj_end < space->select.sel_info.hslab->diminfo.opt[u].stride) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ } /* end if */ } /* end for */ @@ -6361,7 +6410,7 @@ H5S__hyper_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *en /* If we've looped through all dimensions and none of them didn't * overlap, then all of them do, so we report TRUE. */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end else */ } /* end if */ else { @@ -6409,8 +6458,8 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank, const hs FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(spans); - HDassert(offset); + assert(spans); + assert(offset); /* Check if we've already set this span tree */ if (spans->op_info[op_info_i].op_gen != op_gen) { @@ -6419,7 +6468,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank, const hs /* Adjust the span tree's low & high bounds */ for (u = 0; u < rank; u++) { - HDassert(spans->low_bounds[u] >= offset[u]); + assert(spans->low_bounds[u] >= offset[u]); spans->low_bounds[u] -= offset[u]; spans->high_bounds[u] -= offset[u]; } /* end for */ @@ -6428,7 +6477,7 @@ H5S__hyper_adjust_u_helper(H5S_hyper_span_info_t *spans, unsigned rank, const hs span = spans->head; while (span != NULL) { /* Adjust span offset */ - HDassert(span->low >= *offset); + assert(span->low >= *offset); span->low -= *offset; span->high -= *offset; @@ -6474,8 +6523,8 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); /* Check for an all-zero offset vector */ for (u = 0; u < space->extent.rank; u++) @@ -6490,11 +6539,11 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) /* (No need to rebuild the dimension info yet -QAK) */ if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { for (u = 0; u < space->extent.rank; u++) { - HDassert(space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]); + assert(space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]); space->select.sel_info.hslab->diminfo.opt[u].start -= offset[u]; /* Adjust the low & high bounds */ - HDassert(space->select.sel_info.hslab->diminfo.low_bounds[u] >= offset[u]); + assert(space->select.sel_info.hslab->diminfo.low_bounds[u] >= offset[u]); space->select.sel_info.hslab->diminfo.low_bounds[u] -= offset[u]; space->select.sel_info.hslab->diminfo.high_bounds[u] -= offset[u]; } /* end for */ @@ -6526,9 +6575,6 @@ H5S__hyper_adjust_u(H5S_t *space, const hsize_t *offset) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Sunday, July 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -6539,8 +6585,8 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space)); - HDassert(offset); + assert(space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(space)); + assert(offset); /* Check for a "regular" hyperslab selection */ /* (No need to rebuild the dimension info yet -QAK) */ @@ -6552,11 +6598,11 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset) /* Build the table of the initial offset */ for (u = 0; u < space->extent.rank; u++) { /* Sanity check diminfo */ - HDassert(1 == diminfo[u].count); - HDassert(1 == diminfo[u].block); + assert(1 == diminfo[u].count); + assert(1 == diminfo[u].block); /* Sanity check bounds, while we're here */ - HDassert(diminfo[u].start == space->select.sel_info.hslab->diminfo.low_bounds[u]); + assert(diminfo[u].start == space->select.sel_info.hslab->diminfo.low_bounds[u]); /* Keep the offset for later */ block[u] = diminfo[u].start; @@ -6571,9 +6617,9 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset) curr_dim = 0; while (1) { /* Sanity checks */ - HDassert(NULL == curr->next); - HDassert(curr->low == curr->high); - HDassert(curr_dim < space->extent.rank); + assert(NULL == curr->next); + assert(curr->low == curr->high); + assert(curr_dim < space->extent.rank); /* Save the location of the selection in current dimension */ block[curr_dim] = curr->low; @@ -6602,9 +6648,6 @@ H5S__hyper_project_scalar(const H5S_t *space, hsize_t *offset) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Sunday, July 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -6617,23 +6660,23 @@ H5S__hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(base_space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(base_space)); - HDassert(new_space); - HDassert(new_space->extent.rank < base_space->extent.rank); + assert(base_space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(base_space)); + assert(new_space); + assert(new_space->extent.rank < base_space->extent.rank); /* Walk down the span tree until we reach the selection to project */ down = base_space->select.sel_info.hslab->span_lst; curr_dim = 0; while (down && curr_dim < (base_space->extent.rank - new_space->extent.rank)) { /* Sanity check */ - HDassert(NULL == down->head->next); + assert(NULL == down->head->next); /* Advance down to next dimension */ down = down->head->down; curr_dim++; } /* end while */ if (NULL == down) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "NULL span list pointer") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "NULL span list pointer"); /* Share the underlying hyperslab span information */ new_space->select.sel_info.hslab->span_lst = down; @@ -6651,9 +6694,6 @@ H5S__hyper_project_simple_lower(const H5S_t *base_space, H5S_t *new_space) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Sunday, July 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -6668,9 +6708,9 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(base_space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(base_space)); - HDassert(new_space); - HDassert(new_space->extent.rank > base_space->extent.rank); + assert(base_space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(base_space)); + assert(new_space); + assert(new_space->extent.rank > base_space->extent.rank); /* Create nodes until reaching the correct # of dimensions */ new_space->select.sel_info.hslab->span_lst = NULL; @@ -6683,9 +6723,9 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space) /* Allocate a new span_info node */ if (NULL == (new_span_info = H5S__hyper_new_span_info(new_space->extent.rank))) { if (prev_span) - H5S__hyper_free_span(prev_span); - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span info") - } /* end if */ + (void)H5S__hyper_free_span(prev_span); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span info"); + } /* Check for linking into higher span */ if (prev_span) @@ -6693,10 +6733,10 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space) /* Allocate a new node */ if (NULL == (new_span = H5S__hyper_new_span((hsize_t)0, (hsize_t)0, NULL, NULL))) { - HDassert(new_span_info); + assert(new_span_info); if (!prev_span) (void)H5FL_ARR_FREE(hbounds_t, new_span_info); - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span"); } /* end if */ /* Set the span_info information */ @@ -6727,8 +6767,8 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space) curr_dim++; } /* end while */ if (NULL == new_space->select.sel_info.hslab->span_lst) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "NULL span list pointer") - HDassert(prev_span); + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "NULL span list pointer"); + assert(prev_span); /* Share the underlying hyperslab span information */ prev_span->down = base_space->select.sel_info.hslab->span_lst; @@ -6737,11 +6777,12 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space) done: if (ret_value < 0 && new_space->select.sel_info.hslab->span_lst) { if (new_space->select.sel_info.hslab->span_lst->head) - H5S__hyper_free_span(new_space->select.sel_info.hslab->span_lst->head); + if (H5S__hyper_free_span(new_space->select.sel_info.hslab->span_lst->head) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span"); new_space->select.sel_info.hslab->span_lst = (H5S_hyper_span_info_t *)H5FL_ARR_FREE(hbounds_t, new_space->select.sel_info.hslab->span_lst); - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_project_simple_higher() */ @@ -6754,9 +6795,6 @@ H5S__hyper_project_simple_higher(const H5S_t *base_space, H5S_t *new_space) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Sunday, July 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -6767,17 +6805,17 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of FUNC_ENTER_PACKAGE /* Check args */ - HDassert(base_space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(base_space)); - HDassert(new_space); - HDassert(offset); + assert(base_space && H5S_SEL_HYPERSLABS == H5S_GET_SELECT_TYPE(base_space)); + assert(new_space); + assert(offset); /* We are setting a new selection, remove any current selection in new dataspace */ if (H5S_SELECT_RELEASE(new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection"); /* Allocate space for the hyperslab selection information */ if (NULL == (new_space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info"); /* Set unlim_dim */ new_space->select.sel_info.hslab->unlim_dim = -1; @@ -6796,7 +6834,7 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of hsize_t block[H5S_MAX_RANK]; /* Block selected in base dataspace */ /* Compute the offset for the down-projection */ - HDmemset(block, 0, sizeof(block)); + memset(block, 0, sizeof(block)); for (u = 0; u < (base_space->extent.rank - new_space->extent.rank); u++) block[u] = opt_diminfo[u].start; *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block); @@ -6806,7 +6844,7 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of new_space_dim = 0; } /* end if */ else { - HDassert(new_space->extent.rank > base_space->extent.rank); + assert(new_space->extent.rank > base_space->extent.rank); /* The offset is zero when projected into higher dimensions */ *offset = 0; @@ -6879,7 +6917,7 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of unsigned curr_dim; /* Current dimension being operated on */ /* Clear the block buffer */ - HDmemset(block, 0, sizeof(block)); + memset(block, 0, sizeof(block)); /* Advance down selected spans */ curr = base_space->select.sel_info.hslab->span_lst->head; @@ -6899,10 +6937,10 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of /* Project the base space's selection down in less dimensions */ if (H5S__hyper_project_simple_lower(base_space, new_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, - "can't project hyperslab selection into less dimensions") + "can't project hyperslab selection into less dimensions"); } /* end if */ else { - HDassert(new_space->extent.rank > base_space->extent.rank); + assert(new_space->extent.rank > base_space->extent.rank); /* The offset is zero when projected into higher dimensions */ *offset = 0; @@ -6910,7 +6948,7 @@ H5S__hyper_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of /* Project the base space's selection down in more dimensions */ if (H5S__hyper_project_simple_higher(base_space, new_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, - "can't project hyperslab selection into less dimensions") + "can't project hyperslab selection into less dimensions"); } /* end else */ /* Copy the status of the dimension information */ @@ -6955,8 +6993,8 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank, const hs FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(spans); - HDassert(offset); + assert(spans); + assert(offset); /* Check if we've already set this span tree */ if (spans->op_info[op_info_i].op_gen != op_gen) { @@ -6965,7 +7003,7 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank, const hs /* Adjust the span tree's low & high bounds */ for (u = 0; u < rank; u++) { - HDassert((hssize_t)spans->low_bounds[u] >= offset[u]); + assert((hssize_t)spans->low_bounds[u] >= offset[u]); spans->low_bounds[u] = (hsize_t)((hssize_t)spans->low_bounds[u] - offset[u]); spans->high_bounds[u] = (hsize_t)((hssize_t)spans->high_bounds[u] - offset[u]); } /* end for */ @@ -6974,7 +7012,7 @@ H5S__hyper_adjust_s_helper(H5S_hyper_span_info_t *spans, unsigned rank, const hs span = spans->head; while (span != NULL) { /* Adjust span offset */ - HDassert((hssize_t)span->low >= *offset); + assert((hssize_t)span->low >= *offset); span->low = (hsize_t)((hssize_t)span->low - *offset); span->high = (hsize_t)((hssize_t)span->high - *offset); @@ -7020,8 +7058,8 @@ H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); /* Check for an all-zero offset vector */ for (u = 0; u < space->extent.rank; u++) @@ -7036,12 +7074,12 @@ H5S__hyper_adjust_s(H5S_t *space, const hssize_t *offset) /* (No need to rebuild the dimension info yet -QAK) */ if (space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { for (u = 0; u < space->extent.rank; u++) { - HDassert((hssize_t)space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]); + assert((hssize_t)space->select.sel_info.hslab->diminfo.opt[u].start >= offset[u]); space->select.sel_info.hslab->diminfo.opt[u].start = (hsize_t)((hssize_t)space->select.sel_info.hslab->diminfo.opt[u].start - offset[u]); /* Adjust the low & high bounds */ - HDassert((hssize_t)space->select.sel_info.hslab->diminfo.low_bounds[u] >= offset[u]); + assert((hssize_t)space->select.sel_info.hslab->diminfo.low_bounds[u] >= offset[u]); space->select.sel_info.hslab->diminfo.low_bounds[u] = (hsize_t)((hssize_t)space->select.sel_info.hslab->diminfo.low_bounds[u] - offset[u]); space->select.sel_info.hslab->diminfo.high_bounds[u] = @@ -7096,8 +7134,8 @@ H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(space); - HDassert(old_offset); + assert(space); + assert(old_offset); /* Check for hyperslab selection & offset changed */ if (H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS && space->select.offset_changed) { @@ -7111,10 +7149,10 @@ H5S_hyper_normalize_offset(H5S_t *space, hssize_t *old_offset) /* Call the 'adjust' routine */ if (H5S__hyper_adjust_s(space, space->select.offset) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection"); /* Zero out the selection offset */ - HDmemset(space->select.offset, 0, sizeof(hssize_t) * space->extent.rank); + memset(space->select.offset, 0, sizeof(hssize_t) * space->extent.rank); /* Indicate that the offset was normalized */ ret_value = TRUE; @@ -7153,12 +7191,12 @@ H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(space); - HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS); + assert(space); + assert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS); /* Call the 'adjust' routine */ if (H5S__hyper_adjust_s(space, old_offset) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection"); /* Copy the selection offset over */ H5MM_memcpy(space->select.offset, old_offset, sizeof(hssize_t) * space->extent.rank); @@ -7198,19 +7236,19 @@ H5S__hyper_append_span(H5S_hyper_span_info_t **span_tree, unsigned ndims, hsize_ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(span_tree); + assert(span_tree); /* Check for adding first node to merged spans */ if (*span_tree == NULL) { /* Allocate new span node to append to list */ if (NULL == (new_span = H5S__hyper_new_span(low, high, down, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span"); /* Make new span the first node in span list */ /* Allocate a new span_info node */ if (NULL == (*span_tree = H5S__hyper_new_span_info(ndims))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span"); /* Set the span tree's basic information */ (*span_tree)->count = 1; @@ -7222,7 +7260,7 @@ H5S__hyper_append_span(H5S_hyper_span_info_t **span_tree, unsigned ndims, hsize_ (*span_tree)->high_bounds[0] = high; if (down) { /* Sanity check */ - HDassert(ndims > 1); + assert(ndims > 1); H5MM_memcpy(&((*span_tree)->low_bounds[1]), down->low_bounds, sizeof(hsize_t) * (ndims - 1)); H5MM_memcpy(&((*span_tree)->high_bounds[1]), down->high_bounds, sizeof(hsize_t) * (ndims - 1)); @@ -7247,7 +7285,7 @@ H5S__hyper_append_span(H5S_hyper_span_info_t **span_tree, unsigned ndims, hsize_ /* Sanity check */ /* (If down_cmp was set to TRUE above, we won't be in this branch) */ - HDassert(down_cmp != TRUE); + assert(down_cmp != TRUE); /* Check if there is actually a down span */ if (down) { @@ -7264,7 +7302,7 @@ H5S__hyper_append_span(H5S_hyper_span_info_t **span_tree, unsigned ndims, hsize_ /* Allocate new span node to append to list */ if (NULL == (new_span = H5S__hyper_new_span(low, high, new_down, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span"); /* Update the high bounds for current dimension */ (*span_tree)->high_bounds[0] = high; @@ -7272,8 +7310,8 @@ H5S__hyper_append_span(H5S_hyper_span_info_t **span_tree, unsigned ndims, hsize_ /* Update low & high bounds in lower dimensions, if there are any */ if (down) { /* Sanity checks */ - HDassert(ndims > 1); - HDassert(down_cmp >= 0); + assert(ndims > 1); + assert(down_cmp >= 0); /* Check if we are sharing down spans with a previous node */ /* (Only need to check for bounds changing if down spans aren't shared) */ @@ -7299,7 +7337,8 @@ H5S__hyper_append_span(H5S_hyper_span_info_t **span_tree, unsigned ndims, hsize_ done: if (ret_value < 0) if (new_span) - H5S__hyper_free_span(new_span); + if (H5S__hyper_free_span(new_span) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_append_span() */ @@ -7357,11 +7396,11 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s FUNC_ENTER_PACKAGE /* Check args */ - HDassert(a_spans); - HDassert(b_spans); - HDassert(a_not_b); - HDassert(a_and_b); - HDassert(b_not_a); + assert(a_spans); + assert(b_spans); + assert(a_not_b); + assert(a_and_b); + assert(b_not_a); /* Set which list(s) to be generated, based on selector */ need_a_not_b = ((selector & H5S_HYPER_COMPUTE_A_NOT_B) != 0); @@ -7380,7 +7419,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s *a_and_b = NULL; if (need_b_not_a) { if (NULL == (*b_not_a = H5S__hyper_copy_span(b_spans, ndims))) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree"); } /* end if */ else *b_not_a = NULL; @@ -7391,7 +7430,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s *b_not_a = NULL; if (need_a_not_b) { if (NULL == (*a_not_b = H5S__hyper_copy_span(a_spans, ndims))) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree"); } /* end if */ else *a_not_b = NULL; @@ -7404,7 +7443,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s *b_not_a = NULL; if (need_a_and_b) { if (NULL == (*a_and_b = H5S__hyper_copy_span(a_spans, ndims))) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, FAIL, "can't copy hyperslab span tree"); } /* end if */ else *a_and_b = NULL; @@ -7442,10 +7481,10 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if (need_a_not_b) if (H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_a->high, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); /* Advance span 'a', leave span 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, FAIL); } /* end if */ /* Check if span 'a' overlaps only the lower bound */ /* of span 'b' , up to the upper bound of span 'b' */ @@ -7460,13 +7499,13 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if (need_a_not_b) if (H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_b->low - 1, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); /* Check for overlaps between upper part of span 'a' and lower part of span 'b' */ /* Make certain both spans either have a down span or both don't have one */ - HDassert((span_a->down != NULL && span_b->down != NULL) || - (span_a->down == NULL && span_b->down == NULL)); + assert((span_a->down != NULL && span_b->down != NULL) || + (span_a->down == NULL && span_b->down == NULL)); /* If there are no down spans, just add the overlapping area to the a_and_b list */ if (span_a->down == NULL) { @@ -7474,7 +7513,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if (need_a_and_b) if (H5S__hyper_append_span(a_and_b, ndims, span_b->low, span_a->high, NULL) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); } /* end if */ /* If there are down spans, check for the overlap in them and add to each appropriate list */ @@ -7491,50 +7530,54 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s * after each append call in the following codes */ if (H5S__hyper_clip_spans(span_a->down, span_b->down, selector, ndims - 1, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, + "can't clip hyperslab information"); /* Check for additions to the a_not_b list */ if (down_a_not_b) { - HDassert(need_a_not_b == TRUE); + assert(need_a_not_b == TRUE); /* Merge/add overlapped part with/to a_not_b list */ if (H5S__hyper_append_span(a_not_b, ndims, span_b->low, span_a->high, down_a_not_b) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_a_not_b); - } /* end if */ + if (H5S__hyper_free_span_info(down_a_not_b) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } /* Check for additions to the a_and_b list */ if (down_a_and_b) { - HDassert(need_a_and_b == TRUE); + assert(need_a_and_b == TRUE); /* Merge/add overlapped part with/to a_and_b list */ if (H5S__hyper_append_span(a_and_b, ndims, span_b->low, span_a->high, down_a_and_b) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_a_and_b); - } /* end if */ + if (H5S__hyper_free_span_info(down_a_and_b) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } /* Check for additions to the b_not_a list */ if (down_b_not_a) { - HDassert(need_b_not_a == TRUE); + assert(need_b_not_a == TRUE); /* Merge/add overlapped part with/to b_not_a list */ if (H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_a->high, down_b_not_a) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_b_not_a); - } /* end if */ - } /* end else */ + if (H5S__hyper_free_span_info(down_b_not_a) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } + } /* end else */ /* Split off upper part of span 'b' at upper span of span 'a' */ @@ -7543,20 +7586,20 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Allocate new span node for upper part of span 'b' */ if (NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next))) - HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span"); /* Advance span 'a' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, FAIL); /* Make upper part of span 'b' into new span 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span, FAIL); recover_b = TRUE; } /* end if */ /* No upper part of span 'b' to split */ else { /* Advance both 'a' and 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, FAIL); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, FAIL); } /* end else */ } /* end if */ /* Check if span 'a' overlaps the lower & upper bound */ @@ -7571,13 +7614,13 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if (need_a_not_b) if (H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_b->low - 1, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); /* Check for overlaps between middle part of span 'a' and span 'b' */ /* Make certain both spans either have a down span or both don't have one */ - HDassert((span_a->down != NULL && span_b->down != NULL) || - (span_a->down == NULL && span_b->down == NULL)); + assert((span_a->down != NULL && span_b->down != NULL) || + (span_a->down == NULL && span_b->down == NULL)); /* If there are no down spans, just add the overlapping area to the a_and_b list */ if (span_a->down == NULL) { @@ -7585,7 +7628,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if (need_a_and_b) if (H5S__hyper_append_span(a_and_b, ndims, span_b->low, span_b->high, NULL) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); } /* end if */ /* If there are down spans, check for the overlap in them and add to each appropriate list */ @@ -7598,64 +7641,68 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Check for overlaps in the 'down spans' of span 'a' & 'b' */ if (H5S__hyper_clip_spans(span_a->down, span_b->down, selector, ndims - 1, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, + "can't clip hyperslab information"); /* Check for additions to the a_not_b list */ if (down_a_not_b) { - HDassert(need_a_not_b == TRUE); + assert(need_a_not_b == TRUE); /* Merge/add overlapped part with/to a_not_b list */ if (H5S__hyper_append_span(a_not_b, ndims, span_b->low, span_b->high, down_a_not_b) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_a_not_b); - } /* end if */ + if (H5S__hyper_free_span_info(down_a_not_b) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } /* Check for additions to the a_and_b list */ if (down_a_and_b) { - HDassert(need_a_and_b == TRUE); + assert(need_a_and_b == TRUE); /* Merge/add overlapped part with/to a_and_b list */ if (H5S__hyper_append_span(a_and_b, ndims, span_b->low, span_b->high, down_a_and_b) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_a_and_b); - } /* end if */ + if (H5S__hyper_free_span_info(down_a_and_b) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } /* Check for additions to the b_not_a list */ if (down_b_not_a) { - HDassert(need_b_not_a == TRUE); + assert(need_b_not_a == TRUE); /* Merge/add overlapped part with/to b_not_a list */ if (H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_b->high, down_b_not_a) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_b_not_a); - } /* end if */ - } /* end else */ + if (H5S__hyper_free_span_info(down_b_not_a) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } + } /* end else */ /* Split off upper part of span 'a' at upper span of span 'b' */ /* Allocate new span node for upper part of span 'a' */ if (NULL == (tmp_span = H5S__hyper_new_span(span_b->high + 1, span_a->high, span_a->down, span_a->next))) - HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span"); /* Make upper part of span 'a' the new span 'a' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span, FAIL); recover_a = TRUE; /* Advance span 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, FAIL); } /* end if */ /* Check if span 'a' is entirely within span 'b' */ /* AAAAA */ @@ -7671,7 +7718,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if (H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_a->low - 1, span_b->down) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); } /* end if */ else { /* Keep going, nothing to split off */ @@ -7680,8 +7727,8 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Check for overlaps between span 'a' and midle of span 'b' */ /* Make certain both spans either have a down span or both don't have one */ - HDassert((span_a->down != NULL && span_b->down != NULL) || - (span_a->down == NULL && span_b->down == NULL)); + assert((span_a->down != NULL && span_b->down != NULL) || + (span_a->down == NULL && span_b->down == NULL)); /* If there are no down spans, just add the overlapping area to the a_and_b list */ if (span_a->down == NULL) { @@ -7689,7 +7736,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if (need_a_and_b) if (H5S__hyper_append_span(a_and_b, ndims, span_a->low, span_a->high, NULL) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); } /* end if */ /* If there are down spans, check for the overlap in them and add to each appropriate list */ @@ -7702,50 +7749,54 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Check for overlaps in the 'down spans' of span 'a' & 'b' */ if (H5S__hyper_clip_spans(span_a->down, span_b->down, selector, ndims - 1, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, + "can't clip hyperslab information"); /* Check for additions to the a_not_b list */ if (down_a_not_b) { - HDassert(need_a_not_b == TRUE); + assert(need_a_not_b == TRUE); /* Merge/add overlapped part with/to a_not_b list */ if (H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_a->high, down_a_not_b) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_a_not_b); - } /* end if */ + if (H5S__hyper_free_span_info(down_a_not_b) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } /* Check for additions to the a_and_b list */ if (down_a_and_b) { - HDassert(need_a_and_b == TRUE); + assert(need_a_and_b == TRUE); /* Merge/add overlapped part with/to a_and_b list */ if (H5S__hyper_append_span(a_and_b, ndims, span_a->low, span_a->high, down_a_and_b) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_a_and_b); - } /* end if */ + if (H5S__hyper_free_span_info(down_a_and_b) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } /* Check for additions to the b_not_a list */ if (down_b_not_a) { - HDassert(need_b_not_a == TRUE); + assert(need_b_not_a == TRUE); /* Merge/add overlapped part with/to b_not_a list */ if (H5S__hyper_append_span(b_not_a, ndims, span_a->low, span_a->high, down_b_not_a) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_b_not_a); - } /* end if */ - } /* end else */ + if (H5S__hyper_free_span_info(down_b_not_a) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } + } /* end else */ /* Check if there is actually an upper part of span 'b' to split off */ if (span_a->high < span_b->high) { @@ -7754,19 +7805,19 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Allocate new span node for upper part of spans 'a' */ if (NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span"); /* And advance span 'a' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, FAIL); /* Make upper part of span 'b' the new span 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span, FAIL); recover_b = TRUE; } /* end if */ else { /* Advance both span 'a' & span 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, FAIL); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, FAIL); } /* end else */ } /* end if */ /* Check if span 'a' overlaps only the upper bound */ @@ -7785,7 +7836,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if (H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_a->low - 1, span_b->down) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); } /* end if */ else { /* Keep going, nothing to split off */ @@ -7794,8 +7845,8 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Check for overlaps between lower part of span 'a' and upper part of span 'b' */ /* Make certain both spans either have a down span or both don't have one */ - HDassert((span_a->down != NULL && span_b->down != NULL) || - (span_a->down == NULL && span_b->down == NULL)); + assert((span_a->down != NULL && span_b->down != NULL) || + (span_a->down == NULL && span_b->down == NULL)); /* If there are no down spans, just add the overlapping area to the a_and_b list */ if (span_a->down == NULL) { @@ -7803,7 +7854,7 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if (need_a_and_b) if (H5S__hyper_append_span(a_and_b, ndims, span_a->low, span_b->high, NULL) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); } /* end if */ /* If there are down spans, check for the overlap in them and add to each appropriate list */ @@ -7816,64 +7867,68 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Check for overlaps in the 'down spans' of span 'a' & 'b' */ if (H5S__hyper_clip_spans(span_a->down, span_b->down, selector, ndims - 1, &down_a_not_b, &down_a_and_b, &down_b_not_a) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, + "can't clip hyperslab information"); /* Check for additions to the a_not_b list */ if (down_a_not_b) { - HDassert(need_a_not_b == TRUE); + assert(need_a_not_b == TRUE); /* Merge/add overlapped part with/to a_not_b list */ if (H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_b->high, down_a_not_b) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_a_not_b); - } /* end if */ + if (H5S__hyper_free_span_info(down_a_not_b) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } /* Check for additions to the a_and_b list */ if (down_a_and_b) { - HDassert(need_a_and_b == TRUE); + assert(need_a_and_b == TRUE); /* Merge/add overlapped part with/to a_and_b list */ if (H5S__hyper_append_span(a_and_b, ndims, span_a->low, span_b->high, down_a_and_b) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_a_and_b); - } /* end if */ + if (H5S__hyper_free_span_info(down_a_and_b) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } /* Check for additions to the b_not_a list */ if (down_b_not_a) { - HDassert(need_b_not_a == TRUE); + assert(need_b_not_a == TRUE); /* Merge/add overlapped part with/to b_not_a list */ if (H5S__hyper_append_span(b_not_a, ndims, span_a->low, span_b->high, down_b_not_a) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") + "can't allocate hyperslab span"); /* Release the down span tree generated */ - H5S__hyper_free_span_info(down_b_not_a); - } /* end if */ - } /* end else */ + if (H5S__hyper_free_span_info(down_b_not_a) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); + } + } /* end else */ /* Split off upper part of span 'a' at upper span of span 'b' */ /* Allocate new span node for upper part of span 'a' */ if (NULL == (tmp_span = H5S__hyper_new_span(span_b->high + 1, span_a->high, span_a->down, span_a->next))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab span"); /* Make upper part of span 'a' into new span 'a' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span, FAIL); recover_a = TRUE; /* Advance span 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, FAIL); } /* end if */ /* span 'a' must be entirely above span 'b' */ /* AAAAA */ @@ -7886,10 +7941,10 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s if (need_b_not_a) if (H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_b->high, span_b->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); /* Advance span 'b', leave span 'a' */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, FAIL); } /* end else */ } /* end while */ @@ -7908,16 +7963,17 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Copy span 'a' and add to a_not_b list */ if (H5S__hyper_append_span(a_not_b, ndims, span_a->low, span_a->high, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); /* Advance to the next 'a' span */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, FAIL); } /* end while */ } /* end if */ else { /* Free the span, if it's generated */ if (recover_a) - H5S__hyper_free_span(span_a); + if (H5S__hyper_free_span(span_a) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span"); } /* end else */ } /* end if */ /* Clean up 'b' spans which haven't been covered yet */ @@ -7935,21 +7991,22 @@ H5S__hyper_clip_spans(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_info_t *b_s /* Copy span 'b' and add to b_not_a list */ if (H5S__hyper_append_span(b_not_a, ndims, span_b->low, span_b->high, span_b->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); /* Advance to the next 'b' span */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, FAIL); } /* end while */ } /* end if */ else { /* Free the span, if it's generated */ if (recover_b) - H5S__hyper_free_span(span_b); + if (H5S__hyper_free_span(span_b) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span"); } /* end else */ } /* end if */ else /* Sanity check */ - HDassert(span_a == NULL && span_b == NULL); + assert(span_a == NULL && span_b == NULL); } /* end else */ } /* end else */ @@ -7989,7 +8046,7 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf FUNC_ENTER_PACKAGE /* Make certain both 'a' & 'b' spans have down span trees or neither does */ - HDassert((a_spans != NULL && b_spans != NULL) || (a_spans == NULL && b_spans == NULL)); + assert((a_spans != NULL && b_spans != NULL) || (a_spans == NULL && b_spans == NULL)); /* Check if the span trees for the 'a' span and the 'b' span are the same */ if (H5S__hyper_cmp_spans(a_spans, b_spans)) { @@ -7998,7 +8055,7 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf else { /* Copy one of the span trees to return */ if (NULL == (merged_spans = H5S__hyper_copy_span(a_spans, ndims))) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "can't copy hyperslab span tree"); } /* end else */ } /* end if */ else { @@ -8025,10 +8082,10 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf if (span_a->high < span_b->low) { /* Merge/add span 'a' with/to the merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_a->high, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); /* Advance span 'a' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, NULL); } /* end if */ /* Check if span 'a' overlaps only the lower bound */ /* of span 'b', up to the upper bound of span 'b' */ @@ -8042,13 +8099,13 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Merge/add copy of span 'a' with/to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_a->high, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") - } /* end if */ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); + } else { /* Merge/add lower part of span 'a' with/to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_b->low - 1, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); /* Get merged span tree for overlapped section */ tmp_spans = H5S__hyper_merge_spans_helper(span_a->down, span_b->down, ndims - 1); @@ -8056,11 +8113,12 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Merge/add overlapped section to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_a->high, tmp_spans) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); /* Release merged span tree for overlapped section */ - H5S__hyper_free_span_info(tmp_spans); - } /* end else */ + if (H5S__hyper_free_span_info(tmp_spans) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, NULL, "unable to free span info"); + } /* Check if there is an upper part of span 'b' */ if (span_a->high < span_b->high) { @@ -8069,19 +8127,19 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Allocate new span node to append to list */ if (NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Advance span 'a' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, NULL); /* Set new span 'b' to tmp_span */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span, NULL); recover_b = TRUE; } /* end if */ else { /* Advance both span 'a' & 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, NULL); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, NULL); } /* end else */ } /* end if */ /* Check if span 'a' overlaps the lower & upper bound */ @@ -8095,13 +8153,13 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Merge/add copy of lower & middle parts of span 'a' to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_b->high, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") - } /* end if */ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); + } else { /* Merge/add lower part of span 'a' to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_b->low - 1, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); /* Get merged span tree for overlapped section */ tmp_spans = H5S__hyper_merge_spans_helper(span_a->down, span_b->down, ndims - 1); @@ -8109,25 +8167,26 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Merge/add overlapped section to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_b->high, tmp_spans) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); /* Release merged span tree for overlapped section */ - H5S__hyper_free_span_info(tmp_spans); - } /* end else */ + if (H5S__hyper_free_span_info(tmp_spans) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, NULL, "unable to free span info"); + } /* Copy upper part of span 'a' as new span 'a' (remember to free) */ /* Allocate new span node to append to list */ if (NULL == (tmp_span = H5S__hyper_new_span(span_b->high + 1, span_a->high, span_a->down, span_a->next))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Set new span 'a' to tmp_span */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span, NULL); recover_a = TRUE; /* Advance span 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, NULL); } /* end if */ /* Check if span 'a' is entirely within span 'b' */ /* AAAAA */ @@ -8139,15 +8198,15 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Merge/add copy of lower & middle parts of span 'b' to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_a->high, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") - } /* end if */ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); + } else { /* Check if there is a lower part of span 'b' */ if (span_a->low > span_b->low) { /* Merge/add lower part of span 'b' to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_a->low - 1, span_b->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); } /* end if */ else { /* No lower part of span 'b' , keep going... */ @@ -8159,11 +8218,12 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Merge/add overlapped section to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_a->high, tmp_spans) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); /* Release merged span tree for overlapped section */ - H5S__hyper_free_span_info(tmp_spans); - } /* end else */ + if (H5S__hyper_free_span_info(tmp_spans) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, NULL, "unable to free span info"); + } /* Check if there is an upper part of span 'b' */ if (span_a->high < span_b->high) { @@ -8172,19 +8232,19 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Allocate new span node to append to list */ if (NULL == (tmp_span = H5S__hyper_new_span(span_a->high + 1, span_b->high, span_b->down, span_b->next))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Advance span 'a' */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, NULL); /* Set new span 'b' to tmp_span */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, tmp_span, NULL); recover_b = TRUE; } /* end if */ else { /* Advance both spans */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, NULL); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, NULL); } /* end else */ } /* end if */ /* Check if span 'a' overlaps only the upper bound */ @@ -8199,15 +8259,15 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Merge/add copy of span 'b' to merged spans if so */ if (H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_b->high, span_b->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") - } /* end if */ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); + } else { /* Check if there is a lower part of span 'b' */ if (span_a->low > span_b->low) { /* Merge/add lower part of span 'b' to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_a->low - 1, span_b->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); } /* end if */ else { /* No lower part of span 'b' , keep going... */ @@ -8219,25 +8279,26 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf /* Merge/add overlapped section to merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_b->high, tmp_spans) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); /* Release merged span tree for overlapped section */ - H5S__hyper_free_span_info(tmp_spans); - } /* end else */ + if (H5S__hyper_free_span_info(tmp_spans) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, NULL, "unable to free span info"); + } /* Copy upper part of span 'a' as new span 'a' */ /* Allocate new span node to append to list */ if (NULL == (tmp_span = H5S__hyper_new_span(span_b->high + 1, span_a->high, span_a->down, span_a->next))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Set new span 'a' to tmp_span */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, tmp_span, NULL); recover_a = TRUE; /* Advance span 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, NULL); } /* end if */ /* Span 'a' must be entirely above span 'b' */ /* AAAAA */ @@ -8246,10 +8307,10 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf else { /* Merge/add span 'b' with the merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_b->high, span_b->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); /* Advance span 'b' */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, NULL); } /* end else */ } /* end while */ @@ -8258,10 +8319,10 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf while (span_a != NULL) { /* Merge/add all 'a' spans into the merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_a->low, span_a->high, span_a->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); /* Advance to next 'a' span, until all processed */ - H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next); + H5S_HYPER_ADVANCE_SPAN(recover_a, span_a, span_a->next, NULL); } /* end while */ } /* end if */ @@ -8270,10 +8331,10 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf while (span_b != NULL) { /* Merge/add all 'b' spans into the merged spans */ if (H5S__hyper_append_span(&merged_spans, ndims, span_b->low, span_b->high, span_b->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, NULL, "can't allocate hyperslab span"); /* Advance to next 'b' span, until all processed */ - H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next); + H5S_HYPER_ADVANCE_SPAN(recover_b, span_b, span_b->next, NULL); } /* end while */ } /* end if */ } /* end else */ @@ -8284,7 +8345,8 @@ H5S__hyper_merge_spans_helper(H5S_hyper_span_info_t *a_spans, H5S_hyper_span_inf done: if (ret_value == NULL) if (merged_spans) - H5S__hyper_free_span_info(merged_spans); + if (H5S__hyper_free_span_info(merged_spans) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, NULL, "unable to free span info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_merge_spans_helper() */ @@ -8317,8 +8379,8 @@ H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(space); - HDassert(new_spans); + assert(space); + assert(new_spans); /* If this is the first span tree in the hyperslab selection, just use it */ if (space->select.sel_info.hslab->span_lst == NULL) { @@ -8331,10 +8393,11 @@ H5S__hyper_merge_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans) /* Get the merged spans */ if (NULL == (merged_spans = H5S__hyper_merge_spans_helper(space->select.sel_info.hslab->span_lst, new_spans, space->extent.rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTMERGE, FAIL, "can't merge hyperslab spans") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTMERGE, FAIL, "can't merge hyperslab spans"); /* Free the previous spans */ - H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst); + if (H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); /* Point to the new merged spans */ space->select.sel_info.hslab->span_lst = merged_spans; @@ -8371,7 +8434,7 @@ H5S__hyper_spans_nelem_helper(H5S_hyper_span_info_t *spans, unsigned op_info_i, FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(spans); + assert(spans); /* Check if the span tree was already counted */ if (spans->op_info[op_info_i].op_gen == op_gen) @@ -8441,7 +8504,7 @@ H5S__hyper_spans_nelem(H5S_hyper_span_info_t *spans) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(spans); + assert(spans); /* Acquire an operation generation value for this operation */ op_gen = H5S__hyper_get_op_gen(); @@ -8485,18 +8548,19 @@ H5S__hyper_add_disjoint_spans(H5S_t *space, H5S_hyper_span_info_t *new_spans) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); - HDassert(new_spans); + assert(space); + assert(new_spans); /* Update the number of elements in the selection */ space->select.num_elem += H5S__hyper_spans_nelem(new_spans); /* Add the new spans to the existing selection in the dataspace */ if (H5S__hyper_merge_spans(space, new_spans) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't merge hyperslabs") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't merge hyperslabs"); /* Free the memory space for new spans */ - H5S__hyper_free_span_info(new_spans); + if (H5S__hyper_free_span_info(new_spans) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -8540,11 +8604,11 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride FUNC_ENTER_PACKAGE /* Check args */ - HDassert(rank > 0); - HDassert(start); - HDassert(stride); - HDassert(count); - HDassert(block); + assert(rank > 0); + assert(start); + assert(stride); + assert(count); + assert(block); /* Start creating spans in fastest changing dimension */ for (i = (int)(rank - 1); i >= 0; i--) { @@ -8554,7 +8618,7 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride /* Sanity check */ if (0 == count[i]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, NULL, "count == 0 is invalid") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, NULL, "count == 0 is invalid"); /* Start a new list in this dimension */ head = NULL; @@ -8569,7 +8633,7 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride /* Allocate a span node */ if (NULL == (span = H5FL_MALLOC(H5S_hyper_span_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Set the span's basic information */ span->low = curr_low; @@ -8596,7 +8660,7 @@ H5S__hyper_make_spans(unsigned rank, const hsize_t *start, const hsize_t *stride /* Allocate a span info node */ if (NULL == (down = H5S__hyper_new_span_info(rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate hyperslab span"); /* Keep the pointer to the next dimension down's completed list */ down->head = head; @@ -8688,8 +8752,8 @@ H5S__hyper_update_diminfo(H5S_t *space, H5S_seloper_t op, const H5S_hyper_dim_t FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); - HDassert(new_hyper_diminfo); + assert(space); + assert(new_hyper_diminfo); /* Check for conditions that prevent us from using the fast algorithm here */ /* (and instead require H5S__hyper_rebuild) */ @@ -8796,14 +8860,14 @@ H5S__hyper_update_diminfo(H5S_t *space, H5S_seloper_t op, const H5S_hyper_dim_t } /* end if */ else { /* Check if block values are the same */ - if (tmp_diminfo[curr_dim].block != new_hyper_diminfo[curr_dim].block) { + if (tmp_diminfo[curr_dim].block != high_block) { space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; break; } /* end if */ /* Check phase of strides */ if ((tmp_diminfo[curr_dim].start % tmp_diminfo[curr_dim].stride) != - (new_hyper_diminfo[curr_dim].start % tmp_diminfo[curr_dim].stride)) { + (high_start % tmp_diminfo[curr_dim].stride)) { space->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; break; } /* end if */ @@ -8844,13 +8908,13 @@ H5S__hyper_update_diminfo(H5S_t *space, H5S_seloper_t op, const H5S_hyper_dim_t /* Set the new diminfo values */ space->select.sel_info.hslab->diminfo.app[curr_dim].start = space->select.sel_info.hslab->diminfo.opt[curr_dim].start = tmp_diminfo[curr_dim].start; - HDassert(tmp_diminfo[curr_dim].stride > 0); + assert(tmp_diminfo[curr_dim].stride > 0); space->select.sel_info.hslab->diminfo.app[curr_dim].stride = space->select.sel_info.hslab->diminfo.opt[curr_dim].stride = tmp_diminfo[curr_dim].stride; - HDassert(tmp_diminfo[curr_dim].count > 0); + assert(tmp_diminfo[curr_dim].count > 0); space->select.sel_info.hslab->diminfo.app[curr_dim].count = space->select.sel_info.hslab->diminfo.opt[curr_dim].count = tmp_diminfo[curr_dim].count; - HDassert(tmp_diminfo[curr_dim].block > 0); + assert(tmp_diminfo[curr_dim].block > 0); space->select.sel_info.hslab->diminfo.app[curr_dim].block = space->select.sel_info.hslab->diminfo.opt[curr_dim].block = tmp_diminfo[curr_dim].block; @@ -8905,7 +8969,7 @@ H5S__hyper_rebuild_helper(const H5S_hyper_span_info_t *spans, H5S_hyper_dim_t sp FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(spans); + assert(spans); /* Initialization */ span = spans->head; @@ -8917,7 +8981,7 @@ H5S__hyper_rebuild_helper(const H5S_hyper_span_info_t *spans, H5S_hyper_dim_t sp if (span->down) /* Go to the next down span and check whether the selection can be rebuilt */ if (!H5S__hyper_rebuild_helper(span->down, &span_slab_info[1])) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Assign the initial starting point & block size for this dimension */ start = span->low; @@ -8931,13 +8995,13 @@ H5S__hyper_rebuild_helper(const H5S_hyper_span_info_t *spans, H5S_hyper_dim_t sp hsize_t curr_block; /* Block size of current span */ /* Sanity check */ - HDassert(prev_span); + assert(prev_span); /* Check that down spans match current slab info */ /* (Can skip check if previous span's down pointer is same as current one) */ if (span->down && prev_span->down != span->down) if (!H5S__hyper_cmp_spans(span->down, prev_span->down)) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Obtain values for stride and block */ curr_stride = span->low - prev_low; @@ -8947,10 +9011,10 @@ H5S__hyper_rebuild_helper(const H5S_hyper_span_info_t *spans, H5S_hyper_dim_t sp * three spans are needed. Account for the first two spans. */ if (curr_block != block) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); if (spancount > 1) { if (stride != curr_stride) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ else stride = curr_stride; @@ -9004,8 +9068,8 @@ H5S__hyper_rebuild(H5S_t *space) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); - HDassert(space->select.sel_info.hslab->span_lst); + assert(space); + assert(space->select.sel_info.hslab->span_lst); /* Check whether the slab can be rebuilt */ /* (Only regular selection can be rebuilt. If yes, fill in correct values) */ @@ -9057,8 +9121,8 @@ H5S__hyper_generate_spans(H5S_t *space) FUNC_ENTER_PACKAGE - HDassert(space); - HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS); + assert(space); + assert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS); /* Get the diminfo */ for (u = 0; u < space->extent.rank; u++) { @@ -9067,9 +9131,9 @@ H5S__hyper_generate_spans(H5S_t *space) * that calls this function checks for unlimited selections first * (especially the new hyperslab API) -NAF */ if (space->select.sel_info.hslab->diminfo.opt[u].count == H5S_UNLIMITED) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "can't generate spans with unlimited count") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "can't generate spans with unlimited count"); if (space->select.sel_info.hslab->diminfo.opt[u].block == H5S_UNLIMITED) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "can't generate spans with unlimited block") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "can't generate spans with unlimited block"); tmp_start[u] = space->select.sel_info.hslab->diminfo.opt[u].start; tmp_stride[u] = space->select.sel_info.hslab->diminfo.opt[u].stride; @@ -9079,7 +9143,7 @@ H5S__hyper_generate_spans(H5S_t *space) /* Build the hyperslab information also */ if (H5S__generate_hyperslab(space, H5S_SELECT_SET, tmp_start, tmp_stride, tmp_count, tmp_block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -9097,7 +9161,6 @@ H5S__hyper_generate_spans(H5S_t *space) RETURNS TRUE for overlap, FALSE for no overlap PROGRAMMER - Quincey Koziol - January 24, 2019 GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -9111,8 +9174,8 @@ H5S__check_spans_overlap(const H5S_hyper_span_info_t *spans1, const H5S_hyper_sp FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(spans1); - HDassert(spans2); + assert(spans1); + assert(spans2); /* Use low & high bounds to try to avoid spinning through the span lists */ if (H5S_RANGE_OVERLAP(spans1->low_bounds[0], spans1->high_bounds[0], spans2->low_bounds[0], @@ -9128,7 +9191,7 @@ H5S__check_spans_overlap(const H5S_hyper_span_info_t *spans1, const H5S_hyper_sp /* Check for spans in lowest dimension already */ if (span1->down) { /* Sanity check */ - HDassert(span2->down); + assert(span2->down); /* Check lower dimensions for overlap */ if (H5S__check_spans_overlap(span1->down, span2->down)) @@ -9156,8 +9219,8 @@ H5S__check_spans_overlap(const H5S_hyper_span_info_t *spans1, const H5S_hyper_sp } /* end while */ /* Make certain we've exhausted our comparisons */ - HDassert((NULL == span1 && (NULL != span2 && NULL == span2->next)) || - ((NULL != span1 && NULL == span1->next) && NULL == span2)); + assert((NULL == span1 && (NULL != span2 && NULL == span2->next)) || + ((NULL != span1 && NULL == span1->next) && NULL == span2)); } /* end of */ done: @@ -9182,7 +9245,7 @@ H5S__check_spans_overlap(const H5S_hyper_span_info_t *spans1, const H5S_hyper_sp owned by the result. If not, the 2nd span list has to be copied. hbool_t *span2_owned; OUT: Indicates if the 2nd span list is actually owned - H5S_t **result; OUT: The dataspace containing the the new selection. It + H5S_t **result; OUT: The dataspace containing the new selection. It could be same with the 1st dataspace. RETURNS Non-negative on success, negative on failure @@ -9208,13 +9271,13 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s FUNC_ENTER_PACKAGE - HDassert(space1); - HDassert(space2_span_lst); - HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA); + assert(space1); + assert(space2_span_lst); + assert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA); /* The result is either a to-be-created space or an empty one */ - HDassert(*result == NULL || *result == space1); - HDassert(space1->select.sel_info.hslab->span_lst); - HDassert(span2_owned); + assert(*result == NULL || *result == space1); + assert(space1->select.sel_info.hslab->span_lst); + assert(span2_owned); /* Reset flags to return */ *span2_owned = FALSE; @@ -9223,7 +9286,7 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s /* The result shares the same info from space1 */ if (*result == NULL) { if (NULL == ((*result) = H5S_copy(space1, TRUE, TRUE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace"); space1->select.sel_info.hslab->span_lst->count--; (*result)->select.sel_info.hslab->span_lst = NULL; is_result_new = TRUE; @@ -9244,14 +9307,14 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s if (!can_own_span2) { b_not_a = H5S__hyper_copy_span(space2_span_lst, space1->extent.rank); if (H5S__hyper_add_disjoint_spans(*result, b_not_a) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs"); /* The new_spans are now owned by 'space', so they should not be released */ b_not_a = NULL; } /* end if */ else { if (H5S__hyper_add_disjoint_spans(*result, space2_span_lst) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs"); *span2_owned = TRUE; } /* end else */ @@ -9262,7 +9325,7 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s case H5S_SELECT_AND: /* Convert *result to "none" selection */ if (H5S_select_none(*result) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection"); HGOTO_DONE(SUCCEED); case H5S_SELECT_NOTB: @@ -9277,12 +9340,13 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s case H5S_SELECT_NOTA: if (!is_result_new) { - HDassert(space1 == *result); + assert(space1 == *result); /* Free the current selection */ - H5S__hyper_free_span_info(space1->select.sel_info.hslab->span_lst); + if (H5S__hyper_free_span_info(space1->select.sel_info.hslab->span_lst) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); space1->select.sel_info.hslab->span_lst = NULL; - } /* end if */ + } /* Copy space2's spans to *result */ if (!can_own_span2) @@ -9291,7 +9355,7 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s else { (*result)->select.sel_info.hslab->span_lst = space2_span_lst; *span2_owned = TRUE; - } /* end else */ + } /* Reset the number of items in selection */ (*result)->select.num_elem = H5S__hyper_spans_nelem(space2_span_lst); @@ -9306,7 +9370,7 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s case H5S_SELECT_PREPEND: case H5S_SELECT_INVALID: default: - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); } /* end switch */ } /* end if */ else { @@ -9340,13 +9404,13 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s case H5S_SELECT_PREPEND: case H5S_SELECT_INVALID: default: - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); } /* end switch */ /* Generate lists of spans which overlap and don't overlap */ if (H5S__hyper_clip_spans(space1->select.sel_info.hslab->span_lst, space2_span_lst, selector, space1->extent.rank, &a_not_b, &a_and_b, &b_not_a) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't clip hyperslab information"); switch (op) { case H5S_SELECT_OR: if (is_result_new) @@ -9359,12 +9423,13 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s case H5S_SELECT_NOTB: case H5S_SELECT_NOTA: if (!is_result_new) { - HDassert(space1 == *result); + assert(space1 == *result); /* Free the current selection */ - H5S__hyper_free_span_info(space1->select.sel_info.hslab->span_lst); + if (H5S__hyper_free_span_info(space1->select.sel_info.hslab->span_lst) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); space1->select.sel_info.hslab->span_lst = NULL; - } /* end if */ + } /* Reset the number of items in selection */ /* (Will be set below) */ @@ -9377,7 +9442,7 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s case H5S_SELECT_PREPEND: case H5S_SELECT_INVALID: default: - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); } /* end switch */ /* Check if there are any non-overlapped selections */ @@ -9385,7 +9450,7 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s /* Other than OR, the span_lst is set to NULL. And in OR, * a_not_b is not needed */ - HDassert(NULL == (*result)->select.sel_info.hslab->span_lst); + assert(NULL == (*result)->select.sel_info.hslab->span_lst); /* The results dataspace takes ownership of the spans */ /* (Since it must be NULL) */ @@ -9408,7 +9473,7 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s * 2. a_not_b will never be computed together with a_and_b * because merging these two equals to a. */ - HDassert(NULL == (*result)->select.sel_info.hslab->span_lst); + assert(NULL == (*result)->select.sel_info.hslab->span_lst); /* The results dataspace takes ownership of the spans */ /* (Since it must be NULL) */ @@ -9427,7 +9492,7 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s if (b_not_a) { /* Merge the b_not_a spans into the result dataspace */ if (H5S__hyper_merge_spans(*result, b_not_a) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert hyperslabs"); /* Update the number of elements in current selection */ (*result)->select.num_elem += H5S__hyper_spans_nelem(b_not_a); @@ -9450,18 +9515,21 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s if (H5S_SELECT_OR != op) { /* Convert *result to "none" selection */ if (H5S_select_none(*result) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection") - } /* end else */ - } /* end if */ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection"); + } + } done: /* Free resources */ if (a_not_b) - H5S__hyper_free_span_info(a_not_b); + if (H5S__hyper_free_span_info(a_not_b) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); if (a_and_b) - H5S__hyper_free_span_info(a_and_b); + if (H5S__hyper_free_span_info(a_and_b) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); if (b_not_a) - H5S__hyper_free_span_info(b_not_a); + if (H5S__hyper_free_span_info(b_not_a) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__fill_in_new_space() */ @@ -9473,9 +9541,6 @@ H5S__fill_in_new_space(H5S_t *space1, H5S_seloper_t op, H5S_hyper_span_info_t *s * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, September 12, 2000 - * *------------------------------------------------------------------------- */ static herr_t @@ -9488,22 +9553,23 @@ H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], c FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); - HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID); - HDassert(start); - HDassert(stride); - HDassert(count); - HDassert(block); + assert(space); + assert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID); + assert(start); + assert(stride); + assert(count); + assert(block); /* Generate span tree for new hyperslab information */ if (NULL == (new_spans = H5S__hyper_make_spans(space->extent.rank, start, stride, count, block))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information"); /* Generate list of blocks to add/remove based on selection operation */ if (op == H5S_SELECT_SET) { /* Free current selection */ if (NULL != space->select.sel_info.hslab->span_lst) - H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst); + if (H5S__hyper_free_span_info(space->select.sel_info.hslab->span_lst) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); /* Set the hyperslab selection to the new span tree */ space->select.sel_info.hslab->span_lst = new_spans; @@ -9513,14 +9579,14 @@ H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], c /* Indicate that the new_spans are owned */ new_spans = NULL; - } /* end if */ + } else { hbool_t new_spans_owned = FALSE; hbool_t updated_spans = FALSE; /* Generate new spans for space */ if (H5S__fill_in_new_space(space, op, new_spans, TRUE, &new_spans_owned, &updated_spans, &space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't generate the specified hyperslab") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't generate the specified hyperslab"); /* Check if the spans were updated by H5S__fill_in_new_space */ if (updated_spans) { @@ -9528,7 +9594,7 @@ H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], c unsigned u; /* Local index variable */ /* Sanity check */ - HDassert(space->select.sel_info.hslab->span_lst->head); + assert(space->select.sel_info.hslab->span_lst->head); /* Build diminfo struct */ for (u = 0; u < space->extent.rank; u++) { @@ -9540,17 +9606,18 @@ H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], c /* Update space's dim info */ if (H5S__hyper_update_diminfo(space, op, new_hyper_diminfo) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info"); } /* end if */ /* Indicate that the new_spans are owned, there's no need to free */ if (new_spans_owned) new_spans = NULL; - } /* end else */ + } done: if (new_spans) - H5S__hyper_free_span_info(new_spans); + if (H5S__hyper_free_span_info(new_spans) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__generate_hyperslab() */ @@ -9562,9 +9629,6 @@ H5S__generate_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], c * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, October 2, 2014 - * *------------------------------------------------------------------------- */ herr_t @@ -9578,22 +9642,22 @@ H5S__set_regular_hyperslab(H5S_t *space, const hsize_t start[], const hsize_t *a FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); - HDassert(start); - HDassert(app_stride); - HDassert(app_count); - HDassert(app_block); - HDassert(opt_stride); - HDassert(opt_count); - HDassert(opt_block); + assert(space); + assert(start); + assert(app_stride); + assert(app_count); + assert(app_block); + assert(opt_stride); + assert(opt_count); + assert(opt_block); /* If we are setting a new selection, remove current selection first */ if (H5S_SELECT_RELEASE(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection"); /* Allocate space for the hyperslab selection information */ if (NULL == (space->select.sel_info.hslab = H5FL_MALLOC(H5S_hyper_sel_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info"); /* Set the diminfo */ space->select.num_elem = 1; @@ -9662,9 +9726,6 @@ H5S__set_regular_hyperslab(H5S_t *space, const hsize_t start[], const hsize_t *a * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Saturday, February 9, 2019 - * *------------------------------------------------------------------------- */ static herr_t @@ -9679,9 +9740,9 @@ H5S__hyper_regular_and_single_block(H5S_t *space, const hsize_t start[], const h FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); - HDassert(start); - HDassert(block); + assert(space); + assert(start); + assert(block); /* Check for single block selection in dataspace */ single_block = TRUE; @@ -9720,12 +9781,12 @@ H5S__hyper_regular_and_single_block(H5S_t *space, const hsize_t start[], const h /* Set selection to regular hyperslab */ if (H5S__set_regular_hyperslab(space, new_start, H5S_hyper_ones_g, H5S_hyper_ones_g, new_block, H5S_hyper_ones_g, H5S_hyper_ones_g, new_block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular hyperslab selection"); } /* end if */ else /* Selection & block don't overlap, set to "none" selection */ if (H5S_select_none(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection"); } /* end if */ else { hsize_t new_start[H5S_MAX_RANK]; /* New start for hyperslab selection */ @@ -9837,7 +9898,7 @@ H5S__hyper_regular_and_single_block(H5S_t *space, const hsize_t start[], const h } /* end if */ /* Sanity check */ - HDassert(first_span_start <= last_span_start); + assert(first_span_start <= last_span_start); /* Compute new start / count / block values */ new_start[u] = first_span_start; @@ -9858,24 +9919,24 @@ H5S__hyper_regular_and_single_block(H5S_t *space, const hsize_t start[], const h /* Set selection to regular hyperslab */ if (H5S__set_regular_hyperslab(space, new_start, stride, new_count, new_block, stride, new_count, new_block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular hyperslab selection"); /* If there's a partial first or last span, have to 'AND' against selection */ if (partial_first_span || partial_last_span) { /* Generate span tree for regular selection */ if (H5S__hyper_generate_spans(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree"); /* 'AND' against block */ if (H5S__generate_hyperslab(space, H5S_SELECT_AND, start, H5S_hyper_ones_g, H5S_hyper_ones_g, block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs"); } /* end if */ } /* end if */ else { /* Selection & block don't overlap, set to "none" selection */ if (H5S_select_none(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection"); } /* end else */ } /* end else */ @@ -9890,9 +9951,6 @@ H5S__hyper_regular_and_single_block(H5S_t *space, const hsize_t start[], const h * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, January 10, 2001 - * *------------------------------------------------------------------------- */ herr_t @@ -9912,10 +9970,10 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(space); - HDassert(start); - HDassert(count); - HDassert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID); + assert(space); + assert(start); + assert(count); + assert(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID); /* Point to the correct stride values */ if (stride == NULL) @@ -9929,7 +9987,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons for (u = 0; u < space->extent.rank; u++) { /* Check for overlapping hyperslab blocks in new selection. */ if (count[u] > 1 && stride[u] < block[u]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap"); /* Detect zero-sized hyperslabs in new selection */ if (count[u] == 0 || block[u] == 0) { @@ -9939,7 +9997,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */ /* Convert to "none" selection */ if (H5S_select_none(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection"); HGOTO_DONE(SUCCEED); case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */ @@ -9952,7 +10010,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons case H5S_SELECT_PREPEND: case H5S_SELECT_INVALID: default: - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); } /* end switch */ } /* end if */ @@ -9960,11 +10018,11 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons if ((count[u] == H5S_UNLIMITED) || (block[u] == H5S_UNLIMITED)) { if (unlim_dim >= 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, - "cannot have more than one unlimited dimension in selection") + "cannot have more than one unlimited dimension in selection"); else { if (count[u] == block[u]) /* Both are H5S_UNLIMITED */ HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, - "count and block cannot both be unlimited") + "count and block cannot both be unlimited"); unlim_dim = (int)u; } /* end else */ } /* end if */ @@ -9996,8 +10054,8 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons if (count[u] == 1) int_stride[u] = 1; else { - HDassert((stride[u] > block[u]) || - ((stride[u] == block[u]) && (count[u] == H5S_UNLIMITED))); + assert((stride[u] > block[u]) || + ((stride[u] == block[u]) && (count[u] == H5S_UNLIMITED))); int_stride[u] = stride[u]; } /* end else */ int_count[u] = count[u]; @@ -10012,10 +10070,10 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons /* Check for invalid operation */ if (unlim_dim >= 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, - "cannot modify unlimited selection with another unlimited selection") + "cannot modify unlimited selection with another unlimited selection"); if (!((op == H5S_SELECT_AND) || (op == H5S_SELECT_NOTA))) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported operation on unlimited selection") - HDassert(space->select.sel_info.hslab->diminfo_valid); + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported operation on unlimited selection"); + assert(space->select.sel_info.hslab->diminfo_valid); /* Clip unlimited selection to include new selection */ if (H5S_hyper_clip_unlim(space, @@ -10023,10 +10081,10 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons ((opt_count[space->select.sel_info.hslab->unlim_dim] - (hsize_t)1) * opt_stride[space->select.sel_info.hslab->unlim_dim]) + opt_block[space->select.sel_info.hslab->unlim_dim]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection"); /* If an empty space was returned it must be "none" */ - HDassert((space->select.num_elem > (hsize_t)0) || (space->select.type->type == H5S_SEL_NONE)); + assert((space->select.num_elem > (hsize_t)0) || (space->select.type->type == H5S_SEL_NONE)); } /* end if */ /* Fixup operation for non-hyperslab selections */ @@ -10052,7 +10110,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons case H5S_SELECT_PREPEND: case H5S_SELECT_INVALID: default: - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); } /* end switch */ break; @@ -10087,14 +10145,14 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons /* Convert to hyperslab selection */ if (H5S_select_hyperslab(space, H5S_SELECT_SET, tmp_start, tmp_stride, tmp_count, tmp_block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection"); } /* end case */ break; case H5S_SELECT_NOTA: /* Binary "B not A" operation for hyperslabs */ /* Convert to "none" selection */ if (H5S_select_none(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection"); HGOTO_DONE(SUCCEED); case H5S_SELECT_NOOP: @@ -10102,7 +10160,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons case H5S_SELECT_PREPEND: case H5S_SELECT_INVALID: default: - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); } /* end switch */ break; @@ -10119,20 +10177,20 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons case H5S_SEL_ERROR: case H5S_SEL_N: default: - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); } /* end switch */ if (op == H5S_SELECT_SET) { /* Set selection to regular hyperslab */ if (H5S__set_regular_hyperslab(space, start, stride, count, block, opt_stride, opt_count, opt_block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular hyperslab selection"); } /* end if */ else if (op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA) { hbool_t single_block; /* Whether the selection is a single block */ /* Sanity check */ - HDassert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS); + assert(H5S_GET_SELECT_TYPE(space) == H5S_SEL_HYPERSLABS); /* Handle unlimited selections */ if (unlim_dim >= 0) { @@ -10144,28 +10202,28 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons /* Check for invalid operation */ if (space->select.sel_info.hslab->unlim_dim >= 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, - "cannot modify unlimited selection with another unlimited selection") + "cannot modify unlimited selection with another unlimited selection"); if (!((op == H5S_SELECT_AND) || (op == H5S_SELECT_NOTB))) HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, - "unsupported operation with unlimited selection") + "unsupported operation with unlimited selection"); /* Get bounds of existing selection */ if (H5S__hyper_bounds(space, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds"); /* Patch count and block to remove unlimited and include the * existing selection. */ H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, bounds_end[unlim_dim] + (hsize_t)1); - HDassert((tmp_count == 1) || (opt_count != H5S_hyper_ones_g)); - HDassert((tmp_block == 1) || (opt_block != H5S_hyper_ones_g)); + assert((tmp_count == 1) || (opt_count != H5S_hyper_ones_g)); + assert((tmp_block == 1) || (opt_block != H5S_hyper_ones_g)); if (opt_count != H5S_hyper_ones_g) { - HDassert(opt_count == int_count); + assert(opt_count == int_count); int_count[unlim_dim] = tmp_count; } /* end if */ if (opt_block != H5S_hyper_ones_g) { - HDassert(opt_block == int_block); + assert(opt_block == int_block); int_block[unlim_dim] = tmp_block; } /* end if */ } /* end if */ @@ -10185,24 +10243,24 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], cons space->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { if (H5S__hyper_regular_and_single_block(space, start, opt_block) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTOPERATE, FAIL, - "can't 'AND' single block against regular hyperslab") + "can't 'AND' single block against regular hyperslab"); } /* end if */ else { /* Check if there's no hyperslab span information currently */ if (NULL == space->select.sel_info.hslab->span_lst) if (H5S__hyper_generate_spans(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree"); /* Set selection type */ space->select.type = H5S_sel_hyper; /* Add in the new hyperslab information */ if (H5S__generate_hyperslab(space, op, start, opt_stride, opt_count, opt_block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs"); } /* end else */ } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -10246,26 +10304,26 @@ H5Sselect_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], con /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (H5S_SCALAR == H5S_GET_EXTENT_TYPE(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_SCALAR space"); if (H5S_NULL == H5S_GET_EXTENT_TYPE(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hyperslab doesn't support H5S_NULL space"); if (start == NULL || count == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab not specified"); if (!(op > H5S_SELECT_NOOP && op < H5S_SELECT_INVALID)) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); if (stride != NULL) { unsigned u; /* Local index variable */ /* Check for 0-sized strides */ for (u = 0; u < space->extent.rank; u++) if (stride[u] == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid stride==0 value"); } /* end if */ if (H5S_select_hyperslab(space, op, start, stride, count, block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection"); done: FUNC_LEAVE_API(ret_value) @@ -10311,12 +10369,12 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(old_space); - HDassert(start); - HDassert(count); - HDassert(op >= H5S_SELECT_SET && op <= H5S_SELECT_NOTA); - HDassert(new_space); - HDassert(*new_space == NULL); + assert(old_space); + assert(start); + assert(count); + assert(op >= H5S_SELECT_SET && op <= H5S_SELECT_NOTA); + assert(new_space); + assert(*new_space == NULL); /* Point to the correct stride values */ if (stride == NULL) @@ -10330,7 +10388,7 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st for (u = 0; u < old_space->extent.rank; u++) { /* Check for overlapping hyperslab blocks in new selection. */ if (count[u] > 1 && stride[u] < block[u]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "hyperslab blocks overlap"); /* Detect zero-sized hyperslabs in new selection */ if (count[u] == 0 || block[u] == 0) { @@ -10340,9 +10398,9 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st /* Convert to "none" selection */ /* Copy the first dataspace without sharing the list of spans */ if (NULL == ((*new_space) = H5S_copy(old_space, TRUE, TRUE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace"); if (H5S_select_none((*new_space)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection"); HGOTO_DONE(SUCCEED); case H5S_SELECT_OR: /* Binary "or" operation for hyperslabs */ @@ -10350,7 +10408,7 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st case H5S_SELECT_NOTB: /* Binary "A not B" operation for hyperslabs */ /* Copy the first dataspace with sharing the list of spans */ if (NULL == ((*new_space) = H5S_copy(old_space, FALSE, TRUE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace"); HGOTO_DONE(SUCCEED); /* Selection stays same */ case H5S_SELECT_NOOP: @@ -10359,7 +10417,7 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st case H5S_SELECT_PREPEND: case H5S_SELECT_INVALID: default: - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); } /* end switch */ } /* end if */ } /* end for */ @@ -10397,7 +10455,7 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st H5S_hyper_dim_t new_hyper_diminfo[H5S_MAX_RANK]; if (NULL == ((*new_space) = H5S_copy(old_space, TRUE, TRUE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy dataspace"); if (NULL != (*new_space)->select.sel_info.hslab->span_lst) { old_space->select.sel_info.hslab->span_lst->count--; (*new_space)->select.sel_info.hslab->span_lst = NULL; @@ -10410,12 +10468,13 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st /* Add the new space to the space */ if (NULL == (new_spans = H5S__hyper_make_spans(old_space->extent.rank, start, stride, count, block))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't create hyperslab information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, + "can't create hyperslab information"); if (NULL != old_space->select.sel_info.hslab->span_lst) (*new_space)->select.sel_info.hslab->span_lst = H5S__hyper_copy_span( old_space->select.sel_info.hslab->span_lst, old_space->extent.rank); if (H5S__hyper_add_disjoint_spans(*new_space, new_spans) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't append hyperslabs"); /* Build diminfo struct */ for (u = 0; u < (*new_space)->extent.rank; u++) { @@ -10427,30 +10486,30 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st /* Update space's dim info */ if (H5S__hyper_update_diminfo(*new_space, op, new_hyper_diminfo) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info"); break; case H5S_SELECT_AND: if (H5S_select_none((*new_space)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection"); break; case H5S_SELECT_NOTB: if (NULL != old_space->select.sel_info.hslab->span_lst) { if (NULL == ((*new_space)->select.sel_info.hslab->span_lst = H5S__hyper_copy_span( old_space->select.sel_info.hslab->span_lst, old_space->extent.rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy dataspace"); } /* end if */ else { if (H5S_select_none((*new_space)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection"); } /* end else */ break; case H5S_SELECT_NOTA: if (H5S__set_regular_hyperslab(*new_space, start, stride, count, block, stride, count, block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't set regular selection"); break; case H5S_SELECT_NOOP: @@ -10459,7 +10518,7 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st case H5S_SELECT_PREPEND: case H5S_SELECT_INVALID: default: - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); } /* end switch */ HGOTO_DONE(SUCCEED); @@ -10468,11 +10527,11 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st /* Copy the first dataspace with sharing the list of spans */ if (NULL == ((*new_space) = H5S_copy(old_space, TRUE, TRUE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to copy dataspace"); /* Note: a little overhead in calling the function as some conditions are checked again */ if (H5S_select_hyperslab(*new_space, op, start, stride, count, block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -10486,9 +10545,6 @@ H5S_combine_hyperslab(const H5S_t *old_space, H5S_seloper_t op, const hsize_t st * * Return: Non-negative on success/negative on failure * - * Programmer: Chao Mei - * Tuesday, July 5, 2011 - * *------------------------------------------------------------------------- */ static herr_t @@ -10501,27 +10557,27 @@ H5S__fill_in_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2, H5S_t **resu FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(space1); - HDassert(space2); - HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA); - HDassert(space1->extent.rank == space2->extent.rank); + assert(space1); + assert(space2); + assert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA); + assert(space1->extent.rank == space2->extent.rank); /* The result is either a to-be-created space or an empty one */ - HDassert(NULL == *result || *result == space1); - HDassert(space1->select.sel_info.hslab->span_lst); - HDassert(space2->select.sel_info.hslab->span_lst); + assert(NULL == *result || *result == space1); + assert(space1->select.sel_info.hslab->span_lst); + assert(space2->select.sel_info.hslab->span_lst); /* Note: the offset of space2 is not considered here for bounding box */ if (H5S__fill_in_new_space(space1, op, space2->select.sel_info.hslab->span_lst, FALSE, &span2_owned, &updated_spans, result) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't create the specified selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't create the specified selection"); /* Update diminfo if space2's diminfo was valid, otherwise just mark it as * invalid if the spans were updated */ - HDassert(result); + assert(result); if (updated_spans) { if (space2->select.sel_info.hslab->diminfo_valid == H5S_DIMINFO_VALID_YES) { if (H5S__hyper_update_diminfo(*result, op, space2->select.sel_info.hslab->diminfo.opt) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't update hyperslab info"); } /* end if */ else (*result)->select.sel_info.hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; @@ -10573,19 +10629,19 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], co /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace"); if (start == NULL || count == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "hyperslab not specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "hyperslab not specified"); if (!(op >= H5S_SELECT_SET && op <= H5S_SELECT_NOTA)) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, H5I_INVALID_HID, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, H5I_INVALID_HID, "invalid selection operation"); /* Generate new space, with combination of selections */ if (H5S_combine_hyperslab(space, op, start, stride, count, block, &new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to set hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to set hyperslab selection"); /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID"); done: if (ret_value < 0 && new_space) @@ -10601,9 +10657,6 @@ H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op, const hsize_t start[], co * * Return: New dataspace on success/NULL on failure * - * Programmer: Quincey Koziol - * Tuesday, October 30, 2001 - * *------------------------------------------------------------------------- */ static H5S_t * @@ -10615,14 +10668,14 @@ H5S__combine_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space1); - HDassert(space2); - HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA); + assert(space1); + assert(space2); + assert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA); /* Check if space1 selections has span trees */ if (NULL == space1->select.sel_info.hslab->span_lst) if (H5S__hyper_generate_spans(space1) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, NULL, "dataspace does not have span tree"); if (NULL == space2->select.sel_info.hslab->span_lst) { hsize_t tmp_start[H5S_MAX_RANK]; @@ -10640,12 +10693,12 @@ H5S__combine_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2) /* Combine hyperslab selection with regular selection directly */ if (H5S_combine_hyperslab(space1, op, tmp_start, tmp_stride, tmp_count, tmp_block, &new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to set hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "unable to set hyperslab selection"); } /* end if */ else { /* Combine new_space (a copy of space 1) & space2, with the result in new_space */ if (H5S__fill_in_select(space1, op, space2, &new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, NULL, "can't clip hyperslab information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, NULL, "can't clip hyperslab information"); } /* end else */ /* Set unlim_dim */ @@ -10696,15 +10749,15 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) /* Check args */ if (NULL == (space1 = (H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace"); if (NULL == (space2 = (H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace"); if (!(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA)) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, H5I_INVALID_HID, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, H5I_INVALID_HID, "invalid selection operation"); /* Check that both dataspaces have the same rank */ if (space1->extent.rank != space2->extent.rank) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dataspaces not same rank") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dataspaces not same rank"); /* Note: currently, the offset of each dataspace is ignored */ #if 0 @@ -10712,22 +10765,22 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) /* Same note as in H5Smodify_select */ for(u=0; uextent.rank; u++) { if(space1->select.offset[u] != space2->select.offset[u]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dataspaces not same offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dataspaces not same offset"); } /* end for */ #endif /* Check that both dataspaces have hyperslab selections */ if (H5S_GET_SELECT_TYPE(space1) != H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2) != H5S_SEL_HYPERSLABS) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dataspaces don't have hyperslab selections") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "dataspaces don't have hyperslab selections"); /* Go combine the dataspaces */ if (NULL == (new_space = H5S__combine_select(space1, op, space2))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to create hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to create hyperslab selection"); /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, new_space, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register dataspace ID"); done: if (ret_value < 0 && new_space) @@ -10743,9 +10796,6 @@ H5Scombine_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) * * Return: New dataspace on success/NULL on failure * - * Programmer: Quincey Koziol - * Tuesday, October 30, 2001 - * *------------------------------------------------------------------------- */ herr_t @@ -10756,14 +10806,14 @@ H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space1); - HDassert(space2); - HDassert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA); + assert(space1); + assert(space2); + assert(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA); /* Check that the space selections both have span trees */ if (NULL == space1->select.sel_info.hslab->span_lst) if (H5S__hyper_generate_spans(space1) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, "dataspace does not have span tree"); /* Set unlim_dim */ space1->select.sel_info.hslab->unlim_dim = -1; @@ -10784,12 +10834,12 @@ H5S__modify_select(H5S_t *space1, H5S_seloper_t op, H5S_t *space2) /* Call H5S_select_hyperslab directly */ if (H5S_select_hyperslab(space1, op, tmp_start, tmp_stride, tmp_count, tmp_block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to set hyperslab selection"); } /* end if */ else /* Combine spans from space1 & spans from space2, with the result in space1 */ if (H5S__fill_in_select(space1, op, space2, &space1) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't perform operation on two selections") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't perform operation on two selections"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -10829,15 +10879,15 @@ H5Smodify_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) /* Check args */ if (NULL == (space1 = (H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (NULL == (space2 = (H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (!(op >= H5S_SELECT_OR && op <= H5S_SELECT_NOTA)) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "invalid selection operation"); /* Check that both dataspaces have the same rank */ if (space1->extent.rank != space2->extent.rank) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same rank"); /* Check that both dataspaces have the same offset */ /** Note that this is a tricky part of this function. It's @@ -10860,18 +10910,18 @@ H5Smodify_select(hid_t space1_id, H5S_seloper_t op, hid_t space2_id) #if 0 for(u=0; uextent.rank; u++) { if(space1->select.offset[u] != space2->select.offset[u]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces not same offset"); } /* end for */ #endif /* Check that both dataspaces have hyperslab selections */ if (H5S_GET_SELECT_TYPE(space1) != H5S_SEL_HYPERSLABS || H5S_GET_SELECT_TYPE(space2) != H5S_SEL_HYPERSLABS) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspaces don't have hyperslab selections"); /* Go refine the first selection */ if (H5S__modify_select(space1, op, space2) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to modify hyperslab selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to modify hyperslab selection"); done: FUNC_LEAVE_API(ret_value) @@ -10906,14 +10956,14 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) FUNC_ENTER_PACKAGE - HDassert(udata->nelem > 0); + assert(udata->nelem > 0); /* * Skip over skipped elements */ if (udata->skip > 0) { /* Work upwards, finishing each span tree before moving up */ - HDassert(udata->ds_span[udata->depth]); + assert(udata->ds_span[udata->depth]); do { /* Check for lowest dimension */ if (udata->ds_span[udata->depth]->down) { @@ -10936,11 +10986,11 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) } /* end if */ } /* end if */ else { - HDassert(udata->ds_rank - udata->depth == 1); + assert(udata->ds_rank - udata->depth == 1); /* If we will run out of elements to skip in this span, * skip the remainder of the skipped elements and break out */ - HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + assert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); if (udata->skip < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { udata->ds_low[udata->depth] += udata->skip; udata->skip = 0; @@ -10963,25 +11013,26 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) &udata->ps_span_info[udata->depth - 1], udata->ds_rank - udata->depth + 1, udata->ds_low[udata->depth - 1], udata->ds_low[udata->depth - 1], udata->ps_span_info[udata->depth]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") - H5S__hyper_free_span_info(udata->ps_span_info[udata->depth]); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); + if (H5S__hyper_free_span_info(udata->ps_span_info[udata->depth]) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); udata->ps_span_info[udata->depth] = NULL; - } /* end if */ + } /* Ran out of spans, move up one dimension */ udata->depth--; - HDassert(udata->ds_span[udata->depth]); + assert(udata->ds_span[udata->depth]); udata->ds_low[udata->depth]++; - } /* end if */ + } else HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, - "insufficient elements in destination selection") + "insufficient elements in destination selection"); } while ((udata->skip > 0) || (udata->ds_low[udata->depth] > udata->ds_span[udata->depth]->high)); /* Work downwards until skip is 0 */ - HDassert(udata->ds_span[udata->depth]); + assert(udata->ds_span[udata->depth]); while (udata->skip > 0) { - HDassert(udata->ds_span[udata->depth]->down); + assert(udata->ds_span[udata->depth]->down); udata->depth++; udata->ds_span[udata->depth] = udata->ds_span[udata->depth - 1]->down->head; udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; @@ -11005,7 +11056,7 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) /* Advance to next span */ udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; - HDassert(udata->ds_span[udata->depth]); + assert(udata->ds_span[udata->depth]); udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; } while (udata->skip > 0); } /* end if */ @@ -11025,7 +11076,7 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) /* Advance to next span */ udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; - HDassert(udata->ds_span[udata->depth]); + assert(udata->ds_span[udata->depth]); udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; } while (udata->skip > 0); } /* end else */ @@ -11037,7 +11088,7 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) */ /* Work upwards, adding all elements of each span tree until it can't fit * all elements */ - HDassert(udata->ds_span[udata->depth]); + assert(udata->ds_span[udata->depth]); do { /* Check for lowest dimension */ if (udata->ds_span[udata->depth]->down) { @@ -11060,8 +11111,8 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) 1, udata->ds_span[udata->depth]->down) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") - } /* end if */ + "can't allocate hyperslab span"); + } else { /* If we're not sharing the destination space's * spans, we must copy it first (then release it @@ -11069,7 +11120,8 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) if (NULL == (copied_span_info = H5S__hyper_copy_span_helper( udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, + "can't copy destination spans"); if (H5S__hyper_append_span( &udata->ps_span_info[udata->depth], udata->ds_rank - udata->depth, udata->ds_low[udata->depth], @@ -11079,10 +11131,11 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) 1, copied_span_info) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") - H5S__hyper_free_span_info(copied_span_info); + "can't allocate hyperslab span"); + if (H5S__hyper_free_span_info(copied_span_info) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); copied_span_info = NULL; - } /* end else */ + } udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts; udata->nelem %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts; @@ -11096,8 +11149,8 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) udata->ds_rank - udata->depth, udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, udata->ds_span[udata->depth]->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") - } /* end if */ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); + } else { /* If we're not sharing the destination space's * spans, we must copy it first (then release it @@ -11105,28 +11158,29 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) if (NULL == (copied_span_info = H5S__hyper_copy_span_helper( udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans"); if (H5S__hyper_append_span(&udata->ps_span_info[udata->depth], udata->ds_rank - udata->depth, udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, copied_span_info) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") - H5S__hyper_free_span_info(copied_span_info); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); + if (H5S__hyper_free_span_info(copied_span_info) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); copied_span_info = NULL; - } /* end else */ + } udata->nelem -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1); } /* end if */ } /* end if */ else { - HDassert(udata->ds_rank - udata->depth == 1); + assert(udata->ds_rank - udata->depth == 1); /* If we will run out of elements to add in this span, add the * remainder of the elements and break out */ - HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + assert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); if (udata->nelem < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { if (H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, udata->ds_low[udata->depth], udata->ds_low[udata->depth] + udata->nelem - 1, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); udata->ds_low[udata->depth] += udata->nelem; udata->nelem = 0; break; @@ -11135,7 +11189,7 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) /* Append span tree for entire span */ if (H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); udata->nelem -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1; } /* end else */ @@ -11146,18 +11200,19 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) else if (udata->depth > 0) { /* Append this span tree to the higher dimension's, and release * ownership of it */ - HDassert(udata->ps_span_info[udata->depth]); + assert(udata->ps_span_info[udata->depth]); if (H5S__hyper_append_span(&udata->ps_span_info[udata->depth - 1], udata->ds_rank - udata->depth + 1, udata->ds_low[udata->depth - 1], udata->ds_low[udata->depth - 1], udata->ps_span_info[udata->depth]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") - H5S__hyper_free_span_info(udata->ps_span_info[udata->depth]); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); + if (H5S__hyper_free_span_info(udata->ps_span_info[udata->depth]) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); udata->ps_span_info[udata->depth] = NULL; /* Ran out of spans, move up one dimension */ udata->depth--; - HDassert(udata->ds_span[udata->depth]); + assert(udata->ds_span[udata->depth]); udata->ds_low[udata->depth]++; } /* end if */ else { @@ -11165,15 +11220,15 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) * still elements to add, issue an error. */ if (udata->nelem > 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, - "insufficient elements in destination selection") + "insufficient elements in destination selection"); break; } /* end else */ } while ((udata->nelem > 0) || (udata->ds_low[udata->depth] > udata->ds_span[udata->depth]->high)); /* Work downwards until nelem is 0 */ - HDassert(udata->ds_span[udata->depth] || (udata->nelem == 0)); + assert(udata->ds_span[udata->depth] || (udata->nelem == 0)); while (udata->nelem > 0) { - HDassert(udata->ds_span[udata->depth]->down); + assert(udata->ds_span[udata->depth]->down); udata->depth++; udata->ds_span[udata->depth] = udata->ds_span[udata->depth - 1]->down->head; udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; @@ -11183,7 +11238,7 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) * any complete spans, advance to the first not fully added * span and continue down */ - HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + assert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); if (udata->nelem < H5S__hyper_spans_nelem_helper(udata->ds_span[udata->depth]->down, 0, udata->op_gen) * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { @@ -11198,8 +11253,8 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) 1, udata->ds_span[udata->depth]->down) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") - } /* end if */ + "can't allocate hyperslab span"); + } else { /* If we're not sharing the destination space's * spans, we must copy it first (then release it @@ -11207,7 +11262,8 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) if (NULL == (copied_span_info = H5S__hyper_copy_span_helper( udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, + "can't copy destination spans"); if (H5S__hyper_append_span( &udata->ps_span_info[udata->depth], udata->ds_rank - udata->depth, udata->ds_low[udata->depth], @@ -11217,10 +11273,11 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) 1, copied_span_info) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, - "can't allocate hyperslab span") - H5S__hyper_free_span_info(copied_span_info); + "can't allocate hyperslab span"); + if (H5S__hyper_free_span_info(copied_span_info) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); copied_span_info = NULL; - } /* end else */ + } udata->ds_low[udata->depth] += udata->nelem / udata->ds_span[udata->depth]->down->op_info[0].u.nelmts; udata->nelem %= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts; @@ -11234,8 +11291,8 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) udata->ds_rank - udata->depth, udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, udata->ds_span[udata->depth]->down) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") - } /* end if */ + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); + } else { /* If we're not sharing the destination space's * spans, we must copy it first (then release it @@ -11243,34 +11300,35 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) if (NULL == (copied_span_info = H5S__hyper_copy_span_helper( udata->ds_span[udata->depth]->down, udata->ds_rank - udata->depth, 1, udata->op_gen))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination spans"); if (H5S__hyper_append_span(&udata->ps_span_info[udata->depth], udata->ds_rank - udata->depth, udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, copied_span_info) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") - H5S__hyper_free_span_info(copied_span_info); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); + if (H5S__hyper_free_span_info(copied_span_info) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); copied_span_info = NULL; - } /* end else */ + } udata->nelem -= udata->ds_span[udata->depth]->down->op_info[0].u.nelmts * (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1); /* Advance to next span */ udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; - HDassert(udata->ds_span[udata->depth]); + assert(udata->ds_span[udata->depth]); udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; } while (udata->nelem > 0); } /* end if */ else { - HDassert(udata->ds_rank - udata->depth == 1); + assert(udata->ds_rank - udata->depth == 1); do { /* If we will run out of elements to add in this span, add * the remainder of the elements and break out */ - HDassert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); + assert(udata->ds_low[udata->depth] <= udata->ds_span[udata->depth]->high); if (udata->nelem < (udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1)) { if (H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, udata->ds_low[udata->depth], udata->ds_low[udata->depth] + udata->nelem - 1, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); udata->ds_low[udata->depth] += udata->nelem; udata->nelem = 0; break; @@ -11279,19 +11337,19 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) /* Append span tree for entire span */ if (H5S__hyper_append_span(&udata->ps_span_info[udata->depth], 1, udata->ds_low[udata->depth], udata->ds_span[udata->depth]->high, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); udata->nelem -= udata->ds_span[udata->depth]->high - udata->ds_low[udata->depth] + 1; /* Advance to next span */ udata->ds_span[udata->depth] = udata->ds_span[udata->depth]->next; - HDassert(udata->ds_span[udata->depth]); + assert(udata->ds_span[udata->depth]); udata->ds_low[udata->depth] = udata->ds_span[udata->depth]->low; } while (udata->nelem > 0); } /* end else */ } /* end while */ - HDassert(udata->skip == 0); - HDassert(udata->nelem == 0); + assert(udata->skip == 0); + assert(udata->nelem == 0); /* Mark projected space as changed (for all ranks) */ udata->ps_clean_bitmap = 0; @@ -11299,10 +11357,11 @@ H5S__hyper_proj_int_build_proj(H5S_hyper_project_intersect_ud_t *udata) done: /* Cleanup on failure */ if (copied_span_info) { - HDassert(ret_value < 0); - H5S__hyper_free_span_info(copied_span_info); + assert(ret_value < 0); + if (H5S__hyper_free_span_info(copied_span_info) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); copied_span_info = NULL; - } /* end if */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__hyper_proj_int_build_proj() */ @@ -11375,7 +11434,7 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper for (u = 0; u < count; u++) { ss_span = ss_span_info->head; sis_span = sis_span_info->head; - HDassert(ss_span && sis_span); + assert(ss_span && sis_span); ss_low = ss_span->low; sis_low = sis_span->low; @@ -11401,10 +11460,10 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper if (H5S__hyper_proj_int_iterate(ss_span->down, sis_span->down, high - low + 1, depth + 1, udata) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, - "can't iterate over source selections") + "can't iterate over source selections"); } /* end if */ else { - HDassert(depth == udata->ss_rank - 1); + assert(depth == udata->ss_rank - 1); /* Add skipped elements if there's a pre-gap */ if (ss_low < sis_low) { @@ -11430,7 +11489,7 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper } /* end if */ else if (ss_span->high == high) { /* Advance source span */ - HDassert(ss_span->high < sis_span->high); + assert(ss_span->high < sis_span->high); sis_low = high + 1; ss_span = ss_span->next; if (ss_span) @@ -11438,7 +11497,7 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper } /* end if */ else { /* Advance source intersect span */ - HDassert(ss_span->high > sis_span->high); + assert(ss_span->high > sis_span->high); ss_low = high + 1; sis_span = sis_span->next; if (sis_span) @@ -11465,7 +11524,7 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper } /* end if */ else { /* Advance source intersect span */ - HDassert(ss_low > sis_span->high); + assert(ss_low > sis_span->high); sis_span = sis_span->next; if (sis_span) sis_low = sis_span->low; @@ -11505,18 +11564,18 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper * first iteration of the loop, if so we do not need to continue * looping and can just copy the result */ if (udata->ps_clean_bitmap & (((uint32_t)1) << depth)) { - HDassert(u == 0); + assert(u == 0); if (udata->skip == old_skip) { /* First case: algorithm added only elements */ - HDassert(udata->nelem >= old_nelem); + assert(udata->nelem >= old_nelem); udata->nelem += (count - 1) * (udata->nelem - old_nelem); } /* end if */ else if (udata->nelem == 0) { /* Second case: algorithm added only skip. In this case, * nelem must be 0 since otherwise adding skip would have * triggered a change in the projected space */ - HDassert(old_nelem == 0); - HDassert(udata->skip > old_skip); + assert(old_nelem == 0); + assert(udata->skip > old_skip); udata->skip += (count - 1) * (udata->skip - old_skip); } /* end if */ else { @@ -11526,9 +11585,9 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper hsize_t skip_add; hsize_t nelem_add; - HDassert(udata->nelem > 0); - HDassert(udata->skip > old_skip); - HDassert(old_nelem == 0); + assert(udata->nelem > 0); + assert(udata->skip > old_skip); + assert(old_nelem == 0); skip_add = udata->skip - old_skip; nelem_add = udata->nelem - old_nelem; @@ -11555,7 +11614,7 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper /* Add remaining elements */ if (udata->nelem > 0) if (H5S__hyper_proj_int_build_proj(udata) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't add elements to projected selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't add elements to projected selection"); /* Append remaining span trees */ for (u = udata->ds_rank - 1; u > 0; u--) @@ -11563,11 +11622,12 @@ H5S__hyper_proj_int_iterate(H5S_hyper_span_info_t *ss_span_info, const H5S_hyper if (H5S__hyper_append_span(&udata->ps_span_info[u - 1], udata->ds_rank - u + 1, udata->ds_low[u - 1], udata->ds_low[u - 1], udata->ps_span_info[u]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span") - H5S__hyper_free_span_info(udata->ps_span_info[u]); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTAPPEND, FAIL, "can't allocate hyperslab span"); + if (H5S__hyper_free_span_info(udata->ps_span_info[u]) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); udata->ps_span_info[u] = NULL; - } /* end if */ - } /* end if */ + } + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -11609,18 +11669,18 @@ H5S__hyper_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i FUNC_ENTER_PACKAGE /* Check parameters */ - HDassert(src_space); - HDassert(dst_space); - HDassert(src_intersect_space); - HDassert(proj_space); + assert(src_space); + assert(dst_space); + assert(src_intersect_space); + assert(proj_space); /* Assert that src_space and src_intersect_space have same rank and there * are no point selections */ - HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); - HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); - HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_POINTS); - HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_POINTS); - HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); + assert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); + assert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); + assert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_POINTS); + assert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_POINTS); + assert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); /* Set up ss_span_info */ if (H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_HYPERSLABS) { @@ -11628,19 +11688,19 @@ H5S__hyper_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i if (NULL == src_space->select.sel_info.hslab->span_lst) if (H5S__hyper_generate_spans(src_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, - "can't construct span tree for source hyperslab selection") + "can't construct span tree for source hyperslab selection"); /* Simply point to existing span tree */ ss_span_info = src_space->select.sel_info.hslab->span_lst; } /* end if */ else { /* Create temporary span tree from all selection */ - HDassert(H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_ALL); + assert(H5S_GET_SELECT_TYPE(src_space) == H5S_SEL_ALL); if (NULL == (ss_span_info_buf = H5S__hyper_make_spans(H5S_GET_EXTENT_NDIMS(src_space), H5S_hyper_zeros_g, H5S_hyper_zeros_g, H5S_hyper_ones_g, src_space->extent.size))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't create span tree for ALL source space") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't create span tree for ALL source space"); ss_span_info = ss_span_info_buf; } /* end else */ @@ -11650,19 +11710,20 @@ H5S__hyper_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i if (NULL == dst_space->select.sel_info.hslab->span_lst) if (H5S__hyper_generate_spans(dst_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, - "can't construct span tree for dsetination hyperslab selection") + "can't construct span tree for dsetination hyperslab selection"); /* Simply point to existing span tree */ ds_span_info = dst_space->select.sel_info.hslab->span_lst; } /* end if */ else { /* Create temporary span tree from all selection */ - HDassert(H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_ALL); + assert(H5S_GET_SELECT_TYPE(dst_space) == H5S_SEL_ALL); if (NULL == (ds_span_info_buf = H5S__hyper_make_spans(H5S_GET_EXTENT_NDIMS(dst_space), H5S_hyper_zeros_g, H5S_hyper_zeros_g, H5S_hyper_ones_g, dst_space->extent.size))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't create span tree for ALL destination space") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, + "can't create span tree for ALL destination space"); ds_span_info = ds_span_info_buf; } /* end else */ @@ -11670,11 +11731,11 @@ H5S__hyper_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i if (NULL == src_intersect_space->select.sel_info.hslab->span_lst) if (H5S__hyper_generate_spans(src_intersect_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_UNINITIALIZED, FAIL, - "can't construct span tree for source intersect hyperslab selection") + "can't construct span tree for source intersect hyperslab selection"); /* Initialize udata */ /* We will use op_info[0] for nelem and op_info[1] for copied spans */ - HDmemset(&udata, 0, sizeof(udata)); + memset(&udata, 0, sizeof(udata)); udata.ds_span[0] = ds_span_info->head; udata.ds_low[0] = udata.ds_span[0]->low; udata.ss_rank = H5S_GET_EXTENT_NDIMS(src_space); @@ -11685,18 +11746,18 @@ H5S__hyper_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i /* Iterate over selections and build projected span tree */ if (H5S__hyper_proj_int_iterate(ss_span_info, src_intersect_space->select.sel_info.hslab->span_lst, 1, 0, &udata) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "selection iteration failed") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "selection iteration failed"); /* Remove current selection from proj_space */ if (H5S_SELECT_RELEASE(proj_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection"); /* Check for elements in projected space */ if (udata.ps_span_info[0]) { /* Allocate space for the hyperslab selection information (note this sets * diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */ if (NULL == (proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info"); /* Set selection type */ proj_space->select.type = H5S_sel_hyper; @@ -11719,20 +11780,22 @@ H5S__hyper_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i else /* If we did not add anything to proj_space, select none instead */ if (H5S_select_none(proj_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection"); done: /* Free ss_span_info_buf */ if (ss_span_info_buf) { - H5S__hyper_free_span_info(ss_span_info_buf); + if (H5S__hyper_free_span_info(ss_span_info_buf) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); ss_span_info_buf = NULL; - } /* end if */ + } /* Free ds_span_info_buf */ if (ds_span_info_buf) { - H5S__hyper_free_span_info(ds_span_info_buf); + if (H5S__hyper_free_span_info(ds_span_info_buf) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); ds_span_info_buf = NULL; - } /* end if */ + } /* Cleanup on error */ if (ret_value < 0) { @@ -11741,10 +11804,11 @@ H5S__hyper_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i /* Free span trees */ for (u = 0; u < udata.ds_rank; u++) if (udata.ps_span_info[u]) { - H5S__hyper_free_span_info(udata.ps_span_info[u]); + if (H5S__hyper_free_span_info(udata.ps_span_info[u]) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "unable to free span info"); udata.ps_span_info[u] = NULL; - } /* end if */ - } /* end if */ + } + } #ifndef NDEBUG /* Verify there are no more span trees */ @@ -11752,8 +11816,8 @@ H5S__hyper_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i unsigned u; for (u = 0; u < H5S_MAX_RANK; u++) - HDassert(!udata.ps_span_info[u]); - } /* end block */ + assert(!udata.ps_span_info[u]); + } #endif /* NDEBUG */ FUNC_LEAVE_NOAPI(ret_value) @@ -11802,11 +11866,11 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count, hsize *count = (hsize_t)1; } /* end if */ else { - HDassert(*count == H5S_UNLIMITED); + assert(*count == H5S_UNLIMITED); /* Calculate initial count (last block may be partial) */ *count = (clip_size - start + stride - (hsize_t)1) / stride; - HDassert(*count > (hsize_t)0); + assert(*count > (hsize_t)0); } /* end else */ FUNC_LEAVE_NOAPI_VOID @@ -11845,11 +11909,11 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) FUNC_ENTER_NOAPI(FAIL) /* Check parameters */ - HDassert(space); + assert(space); hslab = space->select.sel_info.hslab; - HDassert(hslab); - HDassert(hslab->unlim_dim >= 0); - HDassert(!hslab->span_lst); + assert(hslab); + assert(hslab->unlim_dim >= 0); + assert(!hslab->span_lst); /* Save original unlimited dimension */ orig_unlim_dim = hslab->unlim_dim; @@ -11870,7 +11934,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) if ((diminfo->block == 0) || (diminfo->count == 0)) { /* Convert to "none" selection */ if (H5S_select_none(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't convert selection"); /* Reset the convenience pointers */ hslab = NULL; @@ -11890,7 +11954,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) /* Check if last block is partial. If superset is set, just keep the * last block complete to speed computation. */ - HDassert(clip_size > diminfo->start); + assert(clip_size > diminfo->start); if (((diminfo->stride * (diminfo->count - (hsize_t)1)) + diminfo->block) > (clip_size - diminfo->start)) { hsize_t start[H5S_MAX_RANK]; @@ -11899,7 +11963,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) /* Last block is partial, need to construct compound selection */ /* Fill start with zeros */ - HDmemset(start, 0, sizeof(start)); + memset(start, 0, sizeof(start)); /* Set block to clip_size in unlimited dimension, H5S_MAX_SIZE in * others so only unlimited dimension is clipped */ @@ -11912,7 +11976,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) /* Generate span tree in selection */ if (!hslab->span_lst) if (H5S__hyper_generate_spans(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to generate span tree") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to generate span tree"); /* Indicate that the regular dimensions are no longer valid */ hslab->diminfo_valid = H5S_DIMINFO_VALID_NO; @@ -11920,7 +11984,7 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size) /* "And" selection with calculated block to perform clip operation */ if (H5S__generate_hyperslab(space, H5S_SELECT_AND, start, H5S_hyper_ones_g, H5S_hyper_ones_g, block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't generate hyperslabs"); } /* end if */ else /* Last block is complete, simply mark that diminfo.opt is valid */ @@ -11976,9 +12040,9 @@ H5S__hyper_get_clip_extent_real(const H5S_t *clip_space, hsize_t num_slices, hbo FUNC_ENTER_PACKAGE_NOERR /* Check parameters */ - HDassert(clip_space); - HDassert(clip_space->select.sel_info.hslab); - HDassert(clip_space->select.sel_info.hslab->unlim_dim >= 0); + assert(clip_space); + assert(clip_space->select.sel_info.hslab); + assert(clip_space->select.sel_info.hslab->unlim_dim >= 0); diminfo = &clip_space->select.sel_info.hslab->diminfo.opt[clip_space->select.sel_info.hslab->unlim_dim]; @@ -11991,7 +12055,7 @@ H5S__hyper_get_clip_extent_real(const H5S_t *clip_space, hsize_t num_slices, hbo else { /* Unlimited count, need to match extent so a block (possibly) gets cut * off so the number of slices matches num_slices */ - HDassert(diminfo->count == H5S_UNLIMITED); + assert(diminfo->count == H5S_UNLIMITED); /* Calculate number of complete blocks in clip_space */ count = num_slices / diminfo->block; @@ -12043,20 +12107,20 @@ H5S_hyper_get_clip_extent(const H5S_t *clip_space, const H5S_t *match_space, hbo FUNC_ENTER_NOAPI_NOERR /* Check parameters */ - HDassert(clip_space); - HDassert(match_space); - HDassert(clip_space->select.sel_info.hslab->unlim_dim >= 0); + assert(clip_space); + assert(match_space); + assert(clip_space->select.sel_info.hslab->unlim_dim >= 0); /* Check for "none" match space */ if (match_space->select.type->type == H5S_SEL_NONE) num_slices = (hsize_t)0; else { - HDassert(match_space->select.type->type == H5S_SEL_HYPERSLABS); - HDassert(match_space->select.sel_info.hslab); + assert(match_space->select.type->type == H5S_SEL_HYPERSLABS); + assert(match_space->select.sel_info.hslab); /* Calculate number of slices */ num_slices = match_space->select.num_elem / clip_space->select.sel_info.hslab->num_elem_non_unlim; - HDassert((match_space->select.num_elem % clip_space->select.sel_info.hslab->num_elem_non_unlim) == 0); + assert((match_space->select.num_elem % clip_space->select.sel_info.hslab->num_elem_non_unlim) == 0); } /* end else */ /* Call "real" get_clip_extent function */ @@ -12100,14 +12164,14 @@ H5S_hyper_get_clip_extent_match(const H5S_t *clip_space, const H5S_t *match_spac FUNC_ENTER_NOAPI_NOERR /* Check parameters */ - HDassert(clip_space); - HDassert(match_space); - HDassert(clip_space->select.sel_info.hslab); - HDassert(match_space->select.sel_info.hslab); - HDassert(clip_space->select.sel_info.hslab->unlim_dim >= 0); - HDassert(match_space->select.sel_info.hslab->unlim_dim >= 0); - HDassert(clip_space->select.sel_info.hslab->num_elem_non_unlim == - match_space->select.sel_info.hslab->num_elem_non_unlim); + assert(clip_space); + assert(match_space); + assert(clip_space->select.sel_info.hslab); + assert(match_space->select.sel_info.hslab); + assert(clip_space->select.sel_info.hslab->unlim_dim >= 0); + assert(match_space->select.sel_info.hslab->unlim_dim >= 0); + assert(clip_space->select.sel_info.hslab->num_elem_non_unlim == + match_space->select.sel_info.hslab->num_elem_non_unlim); match_diminfo = &match_space->select.sel_info.hslab->diminfo.opt[match_space->select.sel_info.hslab->unlim_dim]; @@ -12129,12 +12193,12 @@ H5S_hyper_get_clip_extent_match(const H5S_t *clip_space, const H5S_t *match_spac num_slices = block * count; /* Check for partial last block */ - HDassert(match_clip_size >= match_diminfo->start); + assert(match_clip_size >= match_diminfo->start); if (((match_diminfo->stride * (count - (hsize_t)1)) + block) > (match_clip_size - match_diminfo->start)) { /* Subtract slices missing from last block */ - HDassert((((match_diminfo->stride * (count - (hsize_t)1)) + block) - - (match_clip_size - match_diminfo->start)) < num_slices); + assert((((match_diminfo->stride * (count - (hsize_t)1)) + block) - + (match_clip_size - match_diminfo->start)) < num_slices); num_slices -= ((match_diminfo->stride * (count - (hsize_t)1)) + block) - (match_clip_size - match_diminfo->start); } /* end if */ @@ -12183,11 +12247,11 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index) FUNC_ENTER_NOAPI(NULL) /* Check parameters */ - HDassert(space); + assert(space); hslab = space->select.sel_info.hslab; - HDassert(hslab); - HDassert(hslab->unlim_dim >= 0); - HDassert(hslab->diminfo.opt[hslab->unlim_dim].count == H5S_UNLIMITED); + assert(hslab); + assert(hslab->unlim_dim >= 0); + assert(hslab->diminfo.opt[hslab->unlim_dim].count == H5S_UNLIMITED); /* Set start to select block_indexth block in unlimited dimension and set * count to 1 in that dimension to only select that block. Copy all other @@ -12207,13 +12271,13 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index) /* Create output space, copy extent */ if (NULL == (space_out = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "unable to create output dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, NULL, "unable to create output dataspace"); if (H5S__extent_copy_real(&space_out->extent, &space->extent, TRUE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "unable to copy destination space extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, NULL, "unable to copy destination space extent"); /* Select block as defined by start/stride/count/block computed above */ if (H5S_select_hyperslab(space_out, H5S_SELECT_SET, start, stride, count, block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "can't select hyperslab") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "can't select hyperslab"); /* Set return value */ ret_value = space_out; @@ -12222,7 +12286,7 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index) /* Free space on error */ if (!ret_value) if (space_out && H5S_close(space_out) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, NULL, "unable to release dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_hyper_get_unlim_block */ @@ -12261,11 +12325,11 @@ H5S_hyper_get_first_inc_block(const H5S_t *space, hsize_t clip_size, hbool_t *pa FUNC_ENTER_NOAPI_NOERR /* Check parameters */ - HDassert(space); + assert(space); hslab = space->select.sel_info.hslab; - HDassert(hslab); - HDassert(hslab->unlim_dim >= 0); - HDassert(hslab->diminfo.opt[hslab->unlim_dim].count == H5S_UNLIMITED); + assert(hslab); + assert(hslab->unlim_dim >= 0); + assert(hslab->diminfo.opt[hslab->unlim_dim].count == H5S_UNLIMITED); diminfo = &hslab->diminfo.opt[hslab->unlim_dim]; @@ -12322,9 +12386,9 @@ H5Sis_regular_hyperslab(hid_t spaceid) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection"); ret_value = H5S__hyper_is_regular(space); @@ -12371,11 +12435,11 @@ H5Sget_regular_hyperslab(hid_t spaceid, hsize_t start[] /*out*/, hsize_t stride[ /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (H5S_GET_SELECT_TYPE(space) != H5S_SEL_HYPERSLABS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a hyperslab selection"); if (TRUE != H5S__hyper_is_regular(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a regular hyperslab selection") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a regular hyperslab selection"); /* Retrieve hyperslab parameters */ if (start) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Smpio.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Smpio.c index 30b575087e..179739962b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Smpio.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Smpio.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,10 +11,7 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: rky 980813 - * * Purpose: Create MPI data types for HDF5 selections. - * */ /****************/ @@ -110,8 +106,6 @@ H5FL_EXTERN(H5S_sel_iter_t); * (useful if this is the buffer type for xfer) * *is_derived_type 0 if MPI primitive type, 1 if derived * - * Programmer: rky 980813 - * *------------------------------------------------------------------------- */ static herr_t @@ -127,11 +121,11 @@ H5S__mpio_all_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); + assert(space); /* Just treat the entire extent as a block of bytes */ if ((snelmts = (hssize_t)H5S_GET_EXTENT_NPOINTS(space)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "src dataspace has invalid selection"); H5_CHECKED_ASSIGN(nelmts, hsize_t, snelmts, hssize_t); total_bytes = (hsize_t)elmt_size * nelmts; @@ -148,7 +142,7 @@ H5S__mpio_all_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, /* Create a LARGE derived datatype for this transfer */ if (H5_mpio_create_large_type(total_bytes, 0, MPI_BYTE, new_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't create a large datatype from the all selection") + "couldn't create a large datatype from the all selection"); *count = 1; *is_derived_type = TRUE; } @@ -169,8 +163,6 @@ H5S__mpio_all_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, * (useful if this is the buffer type for xfer) * *is_derived_type 0 if MPI primitive type, 1 if derived * - * Programmer: Quincey Koziol, October 29, 2002 - * *------------------------------------------------------------------------- */ static herr_t @@ -195,8 +187,6 @@ H5S__mpio_none_type(MPI_Datatype *new_type, int *count, hbool_t *is_derived_type * * Outputs: *new_type the MPI type corresponding to the selection * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ static herr_t @@ -234,7 +224,7 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint * #else /* Allocate block sizes for MPI datatype call */ if (NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * num_points))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks"); for (u = 0; u < num_points; u++) blocks[u] = 1; @@ -269,18 +259,18 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint * /* Allocate array if MPI derived types needed */ if (NULL == (inner_types = (MPI_Datatype *)H5MM_malloc((sizeof(MPI_Datatype) * (size_t)total_types)))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks"); if (NULL == (inner_blocks = (int *)H5MM_malloc(sizeof(int) * (size_t)total_types))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks"); if (NULL == (inner_disps = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * (size_t)total_types))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks"); #if MPI_VERSION < 3 /* Allocate block sizes for MPI datatype call */ if (NULL == (blocks = (int *)H5MM_malloc(sizeof(int) * bigio_count))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of blocks"); for (u = 0; u < bigio_count; u++) blocks[u] = 1; @@ -363,8 +353,6 @@ H5S__mpio_create_point_datatype(size_t elmt_size, hsize_t num_points, MPI_Aint * * the MPI_Datatype * *is_permuted 0 if the displacements are permuted, 1 if not * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ static herr_t @@ -381,21 +369,21 @@ H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_typ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); + assert(space); /* Get the total number of points selected */ if ((snum_points = (hssize_t)H5S_GET_SELECT_NPOINTS(space)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); num_points = (hsize_t)snum_points; /* Allocate array for element displacements */ if (NULL == (disp = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * num_points))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements"); /* Allocate array for element permutation - returned to caller */ if (do_permute) if (NULL == (*permute = (hsize_t *)H5MM_malloc(sizeof(hsize_t) * num_points))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate permutation array") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate permutation array"); /* Iterate through list of elements */ curr = space->select.sel_info.pnt_lst->head; @@ -403,7 +391,7 @@ H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_typ /* Calculate the displacement of the current point */ hsize_t disp_tmp = H5VM_array_offset(space->extent.rank, space->extent.size, curr->pnt); if (disp_tmp > LONG_MAX) /* Maximum value of type long */ - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "disp overflow") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "disp overflow"); disp[u] = (MPI_Aint)disp_tmp; disp[u] *= (MPI_Aint)elmt_size; @@ -441,7 +429,7 @@ H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_typ MPI_Aint temp; temp = disp[u]; - HDmemmove(disp + m + 1, disp + m, (u - m) * sizeof(MPI_Aint)); + memmove(disp + m + 1, disp + m, (u - m) * sizeof(MPI_Aint)); disp[m] = temp; } /* end if */ (*permute)[u] = m; @@ -461,7 +449,7 @@ H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_typ /* Create the MPI datatype for the set of element displacements */ if (H5S__mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection"); /* Set values about MPI datatype created */ *count = 1; @@ -499,8 +487,6 @@ H5S__mpio_point_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new_typ * (useful if this is the buffer type for xfer) * *is_derived_type 0 if MPI primitive type, 1 if derived * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ static herr_t @@ -521,30 +507,30 @@ H5S__mpio_permute_type(H5S_t *space, size_t elmt_size, hsize_t **permute, MPI_Da FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); + assert(space); /* Get the total number of points selected */ if ((snum_points = (hssize_t)H5S_GET_SELECT_NPOINTS(space)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); num_points = (hsize_t)snum_points; /* Allocate array to store point displacements */ if (NULL == (disp = (MPI_Aint *)H5MM_malloc(sizeof(MPI_Aint) * num_points))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements"); /* Allocate arrays to hold sequence offsets and lengths */ if (NULL == (off = H5MM_malloc(H5D_IO_VECTOR_SIZE * sizeof(*off)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate sequence offsets array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate sequence offsets array"); if (NULL == (len = H5MM_malloc(H5D_IO_VECTOR_SIZE * sizeof(*len)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate sequence lengths array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate sequence lengths array"); /* Allocate a selection iterator for iterating over the dataspace */ if (NULL == (sel_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "couldn't allocate dataspace selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "couldn't allocate dataspace selection iterator"); /* Initialize selection iterator */ if (H5S_select_iter_init(sel_iter, space, elmt_size, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); sel_iter_init = TRUE; /* Selection iteration info has been initialized */ /* Set the number of elements to iterate over */ @@ -560,7 +546,7 @@ H5S__mpio_permute_type(H5S_t *space, size_t elmt_size, hsize_t **permute, MPI_Da /* Get the sequences of bytes */ if (H5S_SELECT_ITER_GET_SEQ_LIST(sel_iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop, while sequences left to process */ for (curr_seq = 0; curr_seq < nseq; curr_seq++) { @@ -577,7 +563,7 @@ H5S__mpio_permute_type(H5S_t *space, size_t elmt_size, hsize_t **permute, MPI_Da while (curr_len > 0) { /* Set the displacement of the current point */ if (curr_off > LONG_MAX) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "curr_off overflow") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "curr_off overflow"); disp[u] = (MPI_Aint)curr_off; /* This is a memory displacement, so for each point selected, @@ -585,8 +571,8 @@ H5S__mpio_permute_type(H5S_t *space, size_t elmt_size, hsize_t **permute, MPI_Da if ((*permute)[u] != num_points) { MPI_Aint temp = disp[u]; - HDmemmove(disp + (*permute)[u] + 1, disp + (*permute)[u], - (u - (*permute)[u]) * sizeof(MPI_Aint)); + memmove(disp + (*permute)[u] + 1, disp + (*permute)[u], + (u - (*permute)[u]) * sizeof(MPI_Aint)); disp[(*permute)[u]] = temp; } /* end if */ @@ -607,7 +593,7 @@ H5S__mpio_permute_type(H5S_t *space, size_t elmt_size, hsize_t **permute, MPI_Da /* Create the MPI datatype for the set of element displacements */ if (H5S__mpio_create_point_datatype(elmt_size, num_points, disp, new_type) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't create an MPI Datatype from point selection"); /* Set values about MPI datatype created */ *count = 1; @@ -617,7 +603,7 @@ H5S__mpio_permute_type(H5S_t *space, size_t elmt_size, hsize_t **permute, MPI_Da /* Release selection iterator */ if (sel_iter) { if (sel_iter_init && H5S_SELECT_ITER_RELEASE(sel_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); sel_iter = H5FL_FREE(H5S_sel_iter_t, sel_iter); } @@ -647,8 +633,6 @@ H5S__mpio_permute_type(H5S_t *space, size_t elmt_size, hsize_t **permute, MPI_Da * (useful if this is the buffer type for xfer) * *is_derived_type 0 if MPI primitive type, 1 if derived * - * Programmer: rky 980813 - * *------------------------------------------------------------------------- */ static herr_t @@ -682,23 +666,23 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); - HDassert(sizeof(MPI_Aint) >= sizeof(elmt_size)); + assert(space); + assert(sizeof(MPI_Aint) >= sizeof(elmt_size)); bigio_count = H5_mpi_get_bigio_count(); /* Allocate a selection iterator for iterating over the dataspace */ if (NULL == (sel_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "couldn't allocate dataspace selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "couldn't allocate dataspace selection iterator"); /* Initialize selection iterator */ if (H5S_select_iter_init(sel_iter, space, elmt_size, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); sel_iter_init = TRUE; /* Selection iteration info has been initialized */ /* Abbreviate args */ diminfo = sel_iter->u.hyp.diminfo; - HDassert(diminfo); + assert(diminfo); /* Make a local copy of the dimension info so we can operate with them */ @@ -708,10 +692,10 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, rank = sel_iter->u.hyp.iter_rank; #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: Flattened selection\n", __func__); + fprintf(H5DEBUG(S), "%s: Flattened selection\n", __func__); #endif for (u = 0; u < rank; ++u) { - H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t) + H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t); d[u].start = (hssize_t)diminfo[u].start + sel_iter->u.hyp.sel_off[u]; d[u].strid = diminfo[u].stride; d[u].block = diminfo[u].block; @@ -720,21 +704,21 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, #ifdef H5S_DEBUG if (H5DEBUG(S)) { - HDfprintf(H5DEBUG(S), - "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE - " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE, - __func__, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); + fprintf(H5DEBUG(S), + "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE + " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE, + __func__, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); if (u == 0) - HDfprintf(H5DEBUG(S), " rank=%u\n", rank); + fprintf(H5DEBUG(S), " rank=%u\n", rank); else - HDfprintf(H5DEBUG(S), "\n"); + fprintf(H5DEBUG(S), "\n"); } #endif /* Sanity check */ - HDassert(d[u].block > 0); - HDassert(d[u].count > 0); - HDassert(d[u].xtent > 0); + assert(d[u].block > 0); + assert(d[u].count > 0); + assert(d[u].xtent > 0); } /* end for */ } /* end if */ else { @@ -742,10 +726,10 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, rank = space->extent.rank; #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: Non-flattened selection\n", __func__); + fprintf(H5DEBUG(S), "%s: Non-flattened selection\n", __func__); #endif for (u = 0; u < rank; ++u) { - H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t) + H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t); d[u].start = (hssize_t)diminfo[u].start + space->select.offset[u]; d[u].strid = diminfo[u].stride; d[u].block = diminfo[u].block; @@ -754,21 +738,21 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, #ifdef H5S_DEBUG if (H5DEBUG(S)) { - HDfprintf(H5DEBUG(S), - "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE - " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE, - __func__, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); + fprintf(H5DEBUG(S), + "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE + " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE, + __func__, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); if (u == 0) - HDfprintf(H5DEBUG(S), " rank=%u\n", rank); + fprintf(H5DEBUG(S), " rank=%u\n", rank); else - HDfprintf(H5DEBUG(S), "\n"); + fprintf(H5DEBUG(S), "\n"); } #endif /* Sanity check */ - HDassert(d[u].block > 0); - HDassert(d[u].count > 0); - HDassert(d[u].xtent > 0); + assert(d[u].block > 0); + assert(d[u].count > 0); + assert(d[u].xtent > 0); } /* end for */ } /* end else */ @@ -781,8 +765,8 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, #ifdef H5S_DEBUG if (H5DEBUG(S)) { i = ((int)rank) - 1; - HDfprintf(H5DEBUG(S), " offset[%2d]=%" PRIuHSIZE "; max_xtent[%2d]=%" PRIuHSIZE "\n", i, offset[i], i, - max_xtent[i]); + fprintf(H5DEBUG(S), " offset[%2d]=%" PRIuHSIZE "; max_xtent[%2d]=%" PRIuHSIZE "\n", i, offset[i], i, + max_xtent[i]); } #endif for (i = ((int)rank) - 2; i >= 0; --i) { @@ -790,8 +774,8 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, max_xtent[i] = max_xtent[i + 1] * d[i].xtent; #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), " offset[%2d]=%" PRIuHSIZE "; max_xtent[%2d]=%" PRIuHSIZE "\n", i, - offset[i], i, max_xtent[i]); + fprintf(H5DEBUG(S), " offset[%2d]=%" PRIuHSIZE "; max_xtent[%2d]=%" PRIuHSIZE "\n", i, offset[i], + i, max_xtent[i]); #endif } /* end for */ @@ -806,9 +790,9 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, *******************************************************/ #ifdef H5S_DEBUG if (H5DEBUG(S)) { - HDfprintf(H5DEBUG(S), "%s: Making contig type %zu MPI_BYTEs\n", __func__, elmt_size); + fprintf(H5DEBUG(S), "%s: Making contig type %zu MPI_BYTEs\n", __func__, elmt_size); for (i = ((int)rank) - 1; i >= 0; --i) - HDfprintf(H5DEBUG(S), "d[%d].xtent=%" PRIuHSIZE "\n", i, d[i].xtent); + fprintf(H5DEBUG(S), "d[%d].xtent=%" PRIuHSIZE "\n", i, d[i].xtent); } #endif @@ -827,7 +811,7 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, /* Create the compound datatype for this operation (> 2GB) */ if (H5_mpio_create_large_type(elmt_size, 0, MPI_BYTE, &inner_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't create a large inner datatype in hyper selection") + "couldn't create a large inner datatype in hyper selection"); /******************************************************* * Construct the type by walking the hyperslab dims @@ -836,16 +820,16 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, for (i = ((int)rank) - 1; i >= 0; --i) { #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), - "%s: Dimension i=%d \n" - "start=%" PRIdHSIZE " count=%" PRIuHSIZE " block=%" PRIuHSIZE " stride=%" PRIuHSIZE - ", xtent=%" PRIuHSIZE " max_xtent=%" PRIuHSIZE "\n", - __func__, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]); + fprintf(H5DEBUG(S), + "%s: Dimension i=%d \n" + "start=%" PRIdHSIZE " count=%" PRIuHSIZE " block=%" PRIuHSIZE " stride=%" PRIuHSIZE + ", xtent=%" PRIuHSIZE " max_xtent=%" PRIuHSIZE "\n", + __func__, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]); #endif #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", __func__, i); + fprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", __func__, i); #endif /**************************************** * Build vector type of the selection. @@ -883,7 +867,7 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, if (bigio_count < d[i].block) { if (H5_mpio_create_large_type(d[i].block, 0, inner_type, &block_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't create a large block datatype in hyper selection") + "couldn't create a large block datatype in hyper selection"); } else if (MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)d[i].block, inner_type, &block_type))) @@ -905,7 +889,7 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, if (bigio_count < d[i].count) { if (H5_mpio_create_large_type(d[i].count, stride_in_bytes, block_type, &outer_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't create a large outer datatype in hyper selection") + "couldn't create a large outer datatype in hyper selection"); } /* otherwise a regular create_hvector will do */ else if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)d[i].count, /* count */ @@ -926,11 +910,11 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, /* Calculate start and extent values of this dimension */ /* Check if value overflow to cast to type MPI_Aint */ if (d[i].start > LONG_MAX || offset[i] > LONG_MAX || elmt_size > LONG_MAX) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "result overflow") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "result overflow"); start_disp = (MPI_Aint)d[i].start * (MPI_Aint)offset[i] * (MPI_Aint)elmt_size; if (max_xtent[i] > LONG_MAX) - HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "max_xtent overflow") + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "max_xtent overflow"); new_extent = (MPI_Aint)elmt_size * (MPI_Aint)max_xtent[i]; if (MPI_SUCCESS != (mpi_code = MPI_Type_get_extent(outer_type, &lb, &extent_len))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_get_extent failed", mpi_code) @@ -944,7 +928,7 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, MPI_Datatype interm_type; int block_len = 1; - HDassert(0 == lb); + assert(0 == lb); mpi_code = MPI_Type_create_hindexed(1, &block_len, &start_disp, outer_type, &interm_type); MPI_Type_free(&outer_type); @@ -976,14 +960,14 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, /* Release selection iterator */ if (sel_iter) { if (sel_iter_init && H5S_SELECT_ITER_RELEASE(sel_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); sel_iter = H5FL_FREE(H5S_sel_iter_t, sel_iter); } #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "Leave %s, count=%d is_derived_type=%s\n", __func__, *count, - (*is_derived_type) ? "TRUE" : "FALSE"); + fprintf(H5DEBUG(S), "Leave %s, count=%d is_derived_type=%s\n", __func__, *count, + (*is_derived_type) ? "TRUE" : "FALSE"); #endif FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__mpio_reg_hyper_type() */ @@ -1001,8 +985,6 @@ H5S__mpio_reg_hyper_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, * (useful if this is the buffer type for xfer) * *is_derived_type 0 if MPI primitive type, 1 if derived * - * Programmer: kyang - * *------------------------------------------------------------------------- */ static herr_t @@ -1022,10 +1004,10 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *ne FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); - HDassert(space->extent.size); - HDassert(space->select.sel_info.hslab->span_lst); - HDassert(space->select.sel_info.hslab->span_lst->head); + assert(space); + assert(space->extent.size); + assert(space->select.sel_info.hslab->span_lst); + assert(space->select.sel_info.hslab->span_lst->head); bigio_count = H5_mpi_get_bigio_count(); /* Create the base type for an element */ @@ -1035,7 +1017,7 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *ne } else if (H5_mpio_create_large_type(elmt_size, 0, MPI_BYTE, &elmt_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't create a large element datatype in span_hyper selection") + "couldn't create a large element datatype in span_hyper selection"); elmt_type_is_derived = TRUE; /* Compute 'down' sizes for each dimension */ @@ -1050,7 +1032,7 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *ne type_list.head = type_list.tail = NULL; if (H5S__obtain_datatype(space->select.sel_info.hslab->span_lst, down, elmt_size, &elmt_type, &span_type, &type_list, 0, op_gen) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type"); if (MPI_SUCCESS != (mpi_code = MPI_Type_dup(span_type, new_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) if (MPI_SUCCESS != (mpi_code = MPI_Type_commit(new_type))) @@ -1058,7 +1040,7 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *ne /* Release MPI data types generated during span tree traversal */ if (H5S__release_datatype(&type_list) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "couldn't release MPI derived data type") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "couldn't release MPI derived data type"); /* fill in the remaining return values */ *count = 1; @@ -1080,8 +1062,6 @@ H5S__mpio_span_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *ne * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol, February 2, 2019 - * *------------------------------------------------------------------------- */ static herr_t @@ -1093,7 +1073,7 @@ H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(type_list); + assert(type_list); /* Iterate over the list, freeing the MPI data types */ curr = type_list->head; @@ -1128,8 +1108,6 @@ H5S__release_datatype(H5S_mpio_mpitype_list_t *type_list) * * Outputs: *span_type the MPI type corresponding to the selection * - * Programmer: kyang - * *------------------------------------------------------------------------- */ static herr_t @@ -1152,8 +1130,8 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(spans); - HDassert(type_list); + assert(spans); + assert(type_list); bigio_count = H5_mpi_get_bigio_count(); /* Check if we've visited this span tree before */ @@ -1163,9 +1141,9 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e /* Allocate the initial displacement & block length buffers */ alloc_count = H5S_MPIO_INITIAL_ALLOC_COUNT; if (NULL == (disp = (MPI_Aint *)H5MM_malloc(alloc_count * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of displacements"); if (NULL == (blocklen = (int *)H5MM_malloc(alloc_count * sizeof(int)))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of block lengths"); /* If this is the fastest changing dimension, it is the base case for derived datatype. */ span = spans->head; @@ -1187,11 +1165,11 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e /* Re-allocate the buffers */ if (NULL == (tmp_disp = (MPI_Aint *)H5MM_realloc(disp, alloc_count * sizeof(MPI_Aint)))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, - "can't allocate array of displacements") + "can't allocate array of displacements"); disp = tmp_disp; if (NULL == (tmp_blocklen = (int *)H5MM_realloc(blocklen, alloc_count * sizeof(int)))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, - "can't allocate array of block lengths") + "can't allocate array of block lengths"); blocklen = tmp_blocklen; } /* end if */ @@ -1200,7 +1178,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e /* Store displacement & block length */ disp[outercount] = (MPI_Aint)elmt_size * (MPI_Aint)span->low; - H5_CHECK_OVERFLOW(nelmts, hsize_t, int) + H5_CHECK_OVERFLOW(nelmts, hsize_t, int); blocklen[outercount] = (int)nelmts; if (bigio_count < (hsize_t)blocklen[outercount]) @@ -1225,7 +1203,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e if ((hsize_t)(blocklen[u]) > bigio_count) { if (H5_mpio_create_large_type((hsize_t)blocklen[u], 0, *elmt_type, &temp_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't create a large element datatype in span_hyper selection") + "couldn't create a large element datatype in span_hyper selection"); } /* end if */ else if (MPI_SUCCESS != (mpi_code = MPI_Type_contiguous((int)blocklen[u], *elmt_type, &temp_type))) @@ -1258,7 +1236,8 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e MPI_Aint stride; /* Distance between inner MPI datatypes */ if (NULL == (inner_type = (MPI_Datatype *)H5MM_malloc(alloc_count * sizeof(MPI_Datatype)))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate array of inner MPI datatypes") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, + "can't allocate array of inner MPI datatypes"); /* Calculate the total bytes of the lower dimension */ stride = (MPI_Aint)(*down) * (MPI_Aint)elmt_size; @@ -1281,16 +1260,16 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e /* Re-allocate the buffers */ if (NULL == (tmp_disp = (MPI_Aint *)H5MM_realloc(disp, alloc_count * sizeof(MPI_Aint)))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, - "can't allocate array of displacements") + "can't allocate array of displacements"); disp = tmp_disp; if (NULL == (tmp_blocklen = (int *)H5MM_realloc(blocklen, alloc_count * sizeof(int)))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, - "can't allocate array of block lengths") + "can't allocate array of block lengths"); blocklen = tmp_blocklen; if (NULL == (tmp_inner_type = (MPI_Datatype *)H5MM_realloc( inner_type, alloc_count * sizeof(MPI_Datatype)))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, - "can't allocate array of inner MPI datatypes") + "can't allocate array of inner MPI datatypes"); inner_type = tmp_inner_type; } /* end if */ @@ -1303,13 +1282,13 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e /* Generate MPI datatype for next dimension down */ if (H5S__obtain_datatype(span->down, down + 1, elmt_size, elmt_type, &down_type, type_list, op_info_i, op_gen) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "couldn't obtain MPI derived data type"); /* Compute the number of elements to attempt in this span */ nelmts = (span->high - span->low) + 1; /* Build the MPI datatype for this node */ - H5_CHECK_OVERFLOW(nelmts, hsize_t, int) + H5_CHECK_OVERFLOW(nelmts, hsize_t, int); if (MPI_SUCCESS != (mpi_code = MPI_Type_create_hvector((int)nelmts, 1, stride, down_type, &inner_type[outercount]))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hvector failed", mpi_code) @@ -1319,7 +1298,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e } /* end while */ /* Building the whole vector datatype */ - H5_CHECK_OVERFLOW(outercount, size_t, int) + H5_CHECK_OVERFLOW(outercount, size_t, int); if (MPI_SUCCESS != (mpi_code = MPI_Type_create_struct((int)outercount, blocklen, disp, inner_type, &spans->op_info[op_info_i].u.down_type))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_struct failed", mpi_code) @@ -1333,7 +1312,7 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e /* Allocate space for the MPI data type list node */ if (NULL == (type_node = H5FL_MALLOC(H5S_mpio_mpitype_node_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate MPI data type list node") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate MPI data type list node"); /* Set up MPI type node */ type_node->type = spans->op_info[op_info_i].u.down_type; @@ -1384,8 +1363,6 @@ H5S__obtain_datatype(H5S_hyper_span_info_t *spans, const hsize_t *down, size_t e * (useful if this is the buffer type for xfer) * *is_derived_type 0 if MPI primitive type, 1 if derived * - * Programmer: rky 980813 - * *------------------------------------------------------------------------- */ herr_t @@ -1397,8 +1374,8 @@ H5S_mpio_space_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(space); - HDassert(elmt_size); + assert(space); + assert(elmt_size); /* Create MPI type based on the kind of selection */ switch (H5S_GET_EXTENT_TYPE(space)) { @@ -1414,25 +1391,25 @@ H5S_mpio_space_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int case H5S_SEL_NONE: if (H5S__mpio_none_type(new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't convert 'none' selection to MPI type") + "couldn't convert 'none' selection to MPI type"); break; case H5S_SEL_ALL: case H5S_SEL_POINTS: case H5S_SEL_HYPERSLABS: /* Sanity check */ - HDassert(!do_permute); + assert(!do_permute); if (H5S__mpio_permute_type(space, elmt_size, permute_map, new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't convert 'all' selection to MPI type") + "couldn't convert 'all' selection to MPI type"); break; case H5S_SEL_ERROR: case H5S_SEL_N: default: - HDassert("unknown selection type" && 0); + assert("unknown selection type" && 0); break; } /* end switch */ } /* end if */ @@ -1442,20 +1419,20 @@ H5S_mpio_space_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int case H5S_SEL_NONE: if (H5S__mpio_none_type(new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't convert 'none' selection to MPI type") + "couldn't convert 'none' selection to MPI type"); break; case H5S_SEL_ALL: if (H5S__mpio_all_type(space, elmt_size, new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't convert 'all' selection to MPI type") + "couldn't convert 'all' selection to MPI type"); break; case H5S_SEL_POINTS: if (H5S__mpio_point_type(space, elmt_size, new_type, count, is_derived_type, do_permute, permute_map, is_permuted) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't convert 'point' selection to MPI type") + "couldn't convert 'point' selection to MPI type"); break; case H5S_SEL_HYPERSLABS: @@ -1463,18 +1440,18 @@ H5S_mpio_space_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int if (H5S__mpio_reg_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't convert regular 'hyperslab' selection to MPI type") + "couldn't convert regular 'hyperslab' selection to MPI type"); } /* end if */ else if (H5S__mpio_span_hyper_type(space, elmt_size, new_type, count, is_derived_type) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, - "couldn't convert irregular 'hyperslab' selection to MPI type") + "couldn't convert irregular 'hyperslab' selection to MPI type"); break; case H5S_SEL_ERROR: case H5S_SEL_N: default: - HDassert("unknown selection type" && 0); + assert("unknown selection type" && 0); break; } /* end switch */ } /* end else */ @@ -1482,7 +1459,7 @@ H5S_mpio_space_type(H5S_t *space, size_t elmt_size, MPI_Datatype *new_type, int case H5S_NO_CLASS: default: - HDassert("unknown dataspace type" && 0); + assert("unknown dataspace type" && 0); break; } /* end switch */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Snone.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Snone.c index 7ffd6436f7..a20f37bc64 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Snone.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Snone.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, November 10, 1998 - * * Purpose: "None" selection dataspace I/O functions. */ @@ -51,7 +47,7 @@ static herr_t H5S__none_release(H5S_t *space); static htri_t H5S__none_is_valid(const H5S_t *space); static hssize_t H5S__none_serial_size(H5S_t *space); static herr_t H5S__none_serialize(H5S_t *space, uint8_t **p); -static herr_t H5S__none_deserialize(H5S_t **space, const uint8_t **p); +static herr_t H5S__none_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hbool_t skip); static herr_t H5S__none_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__none_offset(const H5S_t *space, hsize_t *off); static int H5S__none_unlim_dim(const H5S_t *space); @@ -138,9 +134,6 @@ static const H5S_sel_iter_class_t H5S_sel_iter_none[1] = {{ * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Tuesday, June 16, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -149,8 +142,8 @@ H5S__none_iter_init(H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space)); - HDassert(iter); + assert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space)); + assert(iter); /* Initialize type of selection iterator */ iter->type = H5S_sel_iter_none; @@ -166,9 +159,6 @@ H5S__none_iter_init(H5S_t H5_ATTR_UNUSED *space, H5S_sel_iter_t *iter) * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Tuesday, April 22, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -177,8 +167,8 @@ H5S__none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(coords); + assert(iter); + assert(coords); FUNC_LEAVE_NOAPI(FAIL) } /* end H5S__none_iter_coords() */ @@ -191,9 +181,6 @@ H5S__none_iter_coords(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Monday, June 2, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -203,9 +190,9 @@ H5S__none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_ FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(start); - HDassert(end); + assert(iter); + assert(start); + assert(end); FUNC_LEAVE_NOAPI(FAIL) } /* end H5S__none_iter_block() */ @@ -217,9 +204,6 @@ H5S__none_iter_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter, hsize_t H5_ATTR_ * * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol - * Tuesday, June 16, 1998 - * *------------------------------------------------------------------------- */ static hsize_t @@ -228,7 +212,7 @@ H5S__none_iter_nelmts(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); FUNC_LEAVE_NOAPI(0) } /* end H5S__none_iter_nelmts() */ @@ -256,7 +240,7 @@ H5S__none_iter_has_next_block(const H5S_sel_iter_t H5_ATTR_UNUSED *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); FUNC_LEAVE_NOAPI(FAIL) } /* end H5S__none_iter_has_next_block() */ @@ -285,8 +269,8 @@ H5S__none_iter_next(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_UNUSED n FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(nelem > 0); + assert(iter); + assert(nelem > 0); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__none_iter_next() */ @@ -314,7 +298,7 @@ H5S__none_iter_next_block(H5S_sel_iter_t H5_ATTR_UNUSED *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); FUNC_LEAVE_NOAPI(FAIL) } /* end H5S__none_iter_next_block() */ @@ -356,13 +340,13 @@ H5S__none_iter_get_seq_list(H5S_sel_iter_t H5_ATTR_UNUSED *iter, size_t H5_ATTR_ FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(maxseq > 0); - HDassert(maxelem > 0); - HDassert(nseq); - HDassert(nelem); - HDassert(off); - HDassert(len); + assert(iter); + assert(maxseq > 0); + assert(maxelem > 0); + assert(nseq); + assert(nelem); + assert(off); + assert(len); /* "none" selections don't generate sequences of bytes */ *nseq = 0; @@ -396,7 +380,7 @@ H5S__none_iter_release(H5S_sel_iter_t H5_ATTR_UNUSED *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__none_iter_release() */ @@ -424,7 +408,7 @@ H5S__none_release(H5S_t H5_ATTR_UNUSED *space) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); + assert(space); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__none_release() */ @@ -454,8 +438,8 @@ H5S__none_copy(H5S_t *dst, const H5S_t H5_ATTR_UNUSED *src, hbool_t H5_ATTR_UNUS { FUNC_ENTER_PACKAGE_NOERR - HDassert(src); - HDassert(dst); + assert(src); + assert(dst); /* Set number of elements in selection */ dst->select.num_elem = 0; @@ -488,7 +472,7 @@ H5S__none_is_valid(const H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); FUNC_LEAVE_NOAPI(TRUE) } /* end H5S__none_is_valid() */ @@ -517,7 +501,7 @@ H5S__none_serial_size(H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); /* Basic number of bytes required to serialize point selection: * + + + @@ -555,9 +539,9 @@ H5S__none_serialize(H5S_t *space, uint8_t **p) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); - HDassert(p); - HDassert(pp); + assert(space); + assert(p); + assert(pp); /* Store the preamble information */ UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ @@ -594,17 +578,18 @@ H5S__none_serialize(H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__none_deserialize(H5S_t **space, const uint8_t **p) +H5S__none_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hbool_t skip) { - H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, - either *space or a newly allocated one */ - uint32_t version; /* Version number */ - herr_t ret_value = SUCCEED; /* return value */ + H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, + either *space or a newly allocated one */ + uint32_t version; /* Version number */ + herr_t ret_value = SUCCEED; /* return value */ + const uint8_t *p_end = *p + p_size - 1; /* Pointer to last valid byte in buffer */ FUNC_ENTER_PACKAGE - HDassert(p); - HDassert(*p); + assert(p); + assert(*p); /* As part of the efforts to push all selection-type specific coding to the callbacks, the coding for the allocation of a null dataspace @@ -613,23 +598,27 @@ H5S__none_deserialize(H5S_t **space, const uint8_t **p) /* Allocate space if not provided */ if (!*space) { if (NULL == (tmp_space = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace"); } /* end if */ else tmp_space = *space; /* Decode version */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *p, sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection version"); UINT32DECODE(*p, version); if (version < H5S_NONE_VERSION_1 || version > H5S_NONE_VERSION_LATEST) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for none selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for none selection"); /* Skip over the remainder of the header */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *p, 8, p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection header"); *p += 8; /* Change to "none" selection */ if (H5S_select_none(tmp_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); /* Return space to the caller if allocated */ if (!*space) @@ -639,7 +628,7 @@ H5S__none_deserialize(H5S_t **space, const uint8_t **p) /* Free temporary space if not passed to caller (only happens on error) */ if (!*space && tmp_space) if (H5S_close(tmp_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S__none_deserialize() */ @@ -675,9 +664,9 @@ H5S__none_bounds(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *star { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); - HDassert(start); - HDassert(end); + assert(space); + assert(start); + assert(end); FUNC_LEAVE_NOAPI(FAIL) } /* end H5S_none_bounds() */ @@ -707,8 +696,8 @@ H5S__none_offset(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUSED *offs { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); FUNC_LEAVE_NOAPI(FAIL) } /* end H5S__none_offset() */ @@ -763,7 +752,7 @@ H5S__none_is_contiguous(const H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); FUNC_LEAVE_NOAPI(FALSE) } /* end H5S__none_is_contiguous() */ @@ -791,7 +780,7 @@ H5S__none_is_single(const H5S_t H5_ATTR_UNUSED *space) { FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); FUNC_LEAVE_NOAPI(FALSE) } /* end H5S__none_is_single() */ @@ -821,7 +810,7 @@ H5S__none_is_regular(H5S_t H5_ATTR_UNUSED *space) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); + assert(space); FUNC_LEAVE_NOAPI(TRUE) } /* end H5S__none_is_regular() */ @@ -851,8 +840,8 @@ H5S__none_shape_same(H5S_t H5_ATTR_UNUSED *space1, H5S_t H5_ATTR_UNUSED *space2) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space1); - HDassert(space2); + assert(space1); + assert(space2); FUNC_LEAVE_NOAPI(TRUE) } /* end H5S__none_shape_same() */ @@ -883,10 +872,10 @@ H5S__none_intersect_block(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNU FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(space); - HDassert(H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space)); - HDassert(start); - HDassert(end); + assert(space); + assert(H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space)); + assert(start); + assert(end); FUNC_LEAVE_NOAPI(FALSE) } /* end H5S__none_intersect_block() */ @@ -915,8 +904,8 @@ H5S__none_adjust_u(H5S_t H5_ATTR_UNUSED *space, const hsize_t H5_ATTR_UNUSED *of FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__none_adjust_u() */ @@ -945,8 +934,8 @@ H5S__none_adjust_s(H5S_t H5_ATTR_UNUSED *space, const hssize_t H5_ATTR_UNUSED *o FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__none_adjust_s() */ @@ -958,9 +947,6 @@ H5S__none_adjust_s(H5S_t H5_ATTR_UNUSED *space, const hssize_t H5_ATTR_UNUSED *o * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Sunday, July 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -969,8 +955,8 @@ H5S__none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUS FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space)); - HDassert(offset); + assert(space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(space)); + assert(offset); FUNC_LEAVE_NOAPI(FAIL) } /* end H5S__none_project_scalar() */ @@ -983,9 +969,6 @@ H5S__none_project_scalar(const H5S_t H5_ATTR_UNUSED *space, hsize_t H5_ATTR_UNUS * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Sunday, July 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -997,13 +980,13 @@ H5S__none_project_simple(const H5S_t H5_ATTR_UNUSED *base_space, H5S_t *new_spac FUNC_ENTER_PACKAGE /* Check args */ - HDassert(base_space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(base_space)); - HDassert(new_space); - HDassert(offset); + assert(base_space && H5S_SEL_NONE == H5S_GET_SELECT_TYPE(base_space)); + assert(new_space); + assert(offset); /* Select the entire new space */ if (H5S_select_none(new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to set none selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to set none selection"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1034,11 +1017,11 @@ H5S_select_none(H5S_t *space) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(space); + assert(space); /* Remove current selection first */ if (H5S_SELECT_RELEASE(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release hyperslab"); /* Set number of elements in selection */ space->select.num_elem = 0; @@ -1078,11 +1061,11 @@ H5Sselect_none(hid_t spaceid) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Change to "none" selection */ if (H5S_select_none(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Spoint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Spoint.c index 453be1c12c..602794686a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Spoint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Spoint.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,9 +11,6 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, June 16, 1998 - * * Purpose: Point selection dataspace I/O functions. */ @@ -61,7 +57,7 @@ static herr_t H5S__point_release(H5S_t *space); static htri_t H5S__point_is_valid(const H5S_t *space); static hssize_t H5S__point_serial_size(H5S_t *space); static herr_t H5S__point_serialize(H5S_t *space, uint8_t **p); -static herr_t H5S__point_deserialize(H5S_t **space, const uint8_t **p); +static herr_t H5S__point_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hbool_t skip); static herr_t H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end); static herr_t H5S__point_offset(const H5S_t *space, hsize_t *off); static int H5S__point_unlim_dim(const H5S_t *space); @@ -123,7 +119,7 @@ const H5S_select_class_t H5S_sel_point[1] = {{ H5S__point_iter_init, }}; -/* Format version bounds for dataspace hyperslab selection */ +/* Format version bounds for dataspace point selection */ const unsigned H5O_sds_point_ver_bounds[] = { H5S_POINT_VERSION_1, /* H5F_LIBVER_EARLIEST */ H5S_POINT_VERSION_1, /* H5F_LIBVER_V18 */ @@ -164,9 +160,6 @@ H5FL_DEFINE_STATIC(H5S_pnt_list_t); * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Tuesday, June 16, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -177,8 +170,8 @@ H5S__point_iter_init(H5S_t *space, H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space)); - HDassert(iter); + assert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space)); + assert(iter); /* If this iterator is created from an API call, by default we clone the * selection now, as the dataspace could be modified or go out of scope. @@ -193,7 +186,7 @@ H5S__point_iter_init(H5S_t *space, H5S_sel_iter_t *iter) /* Copy the point list */ if (NULL == (iter->u.pnt.pnt_lst = H5S__copy_pnt_list(space->select.sel_info.pnt_lst, space->extent.rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy point list") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy point list"); } /* end if */ else /* OK to share point list for internal iterations */ @@ -217,9 +210,6 @@ H5S__point_iter_init(H5S_t *space, H5S_sel_iter_t *iter) * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Tuesday, April 22, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -228,8 +218,8 @@ H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(coords); + assert(iter); + assert(coords); /* Copy the offset of the current point */ H5MM_memcpy(coords, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank); @@ -245,9 +235,6 @@ H5S__point_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Monday, June 2, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -256,9 +243,9 @@ H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(start); - HDassert(end); + assert(iter); + assert(start); + assert(end); /* Copy the current point as a block */ H5MM_memcpy(start, iter->u.pnt.curr->pnt, sizeof(hsize_t) * iter->rank); @@ -274,9 +261,6 @@ H5S__point_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) * * Return: Non-negative number of elements on success, zero on failure * - * Programmer: Quincey Koziol - * Tuesday, June 16, 1998 - * *------------------------------------------------------------------------- */ static hsize_t @@ -285,7 +269,7 @@ H5S__point_iter_nelmts(const H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); FUNC_LEAVE_NOAPI(iter->elmt_left) } /* end H5S__point_iter_nelmts() */ @@ -315,7 +299,7 @@ H5S__point_iter_has_next_block(const H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); /* Check if there is another point in the list */ if (iter->u.pnt.curr->next == NULL) @@ -349,8 +333,8 @@ H5S__point_iter_next(H5S_sel_iter_t *iter, size_t nelem) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(nelem > 0); + assert(iter); + assert(nelem > 0); /* Increment the iterator */ while (nelem > 0) { @@ -384,7 +368,7 @@ H5S__point_iter_next_block(H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); /* Increment the iterator */ iter->u.pnt.curr = iter->u.pnt.curr->next; @@ -438,13 +422,13 @@ H5S__point_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelem FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); - HDassert(maxseq > 0); - HDassert(maxelem > 0); - HDassert(nseq); - HDassert(nelem); - HDassert(off); - HDassert(len); + assert(iter); + assert(maxseq > 0); + assert(maxelem > 0); + assert(nseq); + assert(nelem); + assert(off); + assert(len); /* Choose the minimum number of bytes to sequence through */ H5_CHECK_OVERFLOW(iter->elmt_left, hsize_t, size_t); @@ -545,7 +529,7 @@ H5S__point_iter_release(H5S_sel_iter_t *iter) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(iter); + assert(iter); /* If this iterator copied the point list, we must free it */ if ((iter->flags & H5S_SEL_ITER_API_CALL) && !(iter->flags & H5S_SEL_ITER_SHARE_WITH_DATASPACE)) @@ -583,17 +567,17 @@ H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *c FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(space); - HDassert(num_elem > 0); - HDassert(coord); - HDassert(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND); + assert(space); + assert(num_elem > 0); + assert(coord); + assert(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND); for (u = 0; u < num_elem; u++) { unsigned dim; /* Counter for dimensions */ /* Allocate space for the new node */ if (NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, space->extent.rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node"); /* Initialize fields in node */ new_node->next = NULL; @@ -641,7 +625,7 @@ H5S__point_add(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize_t *c tmp_node = space->select.sel_info.pnt_lst->head; if (tmp_node != NULL) { - HDassert(space->select.sel_info.pnt_lst->tail); + assert(space->select.sel_info.pnt_lst->tail); space->select.sel_info.pnt_lst->tail->next = top; } /* end if */ else @@ -695,7 +679,7 @@ H5S__point_release(H5S_t *space) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); + assert(space); /* Free the point list */ H5S__free_pnt_list(space->select.sel_info.pnt_lst); @@ -744,32 +728,32 @@ H5S_select_elements(H5S_t *space, H5S_seloper_t op, size_t num_elem, const hsize FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(space); - HDassert(num_elem); - HDassert(coord); - HDassert(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND); + assert(space); + assert(num_elem); + assert(coord); + assert(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND); /* If we are setting a new selection, remove current selection first */ if (op == H5S_SELECT_SET || H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS) if (H5S_SELECT_RELEASE(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release point selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release point selection"); /* Allocate space for the point selection information if necessary */ if (H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS || space->select.sel_info.pnt_lst == NULL) { hsize_t tmp = HSIZET_MAX; if (NULL == (space->select.sel_info.pnt_lst = H5FL_CALLOC(H5S_pnt_list_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate element information") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate element information"); /* Set the bound box to the default value */ H5VM_array_fill(space->select.sel_info.pnt_lst->low_bounds, &tmp, sizeof(hsize_t), space->extent.rank); - HDmemset(space->select.sel_info.pnt_lst->high_bounds, 0, sizeof(hsize_t) * space->extent.rank); + memset(space->select.sel_info.pnt_lst->high_bounds, 0, sizeof(hsize_t) * space->extent.rank); } /* Add points to selection */ if (H5S__point_add(space, op, num_elem, coord) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert elements") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINSERT, FAIL, "can't insert elements"); /* Set selection type */ space->select.type = H5S_sel_point; @@ -807,12 +791,12 @@ H5S__copy_pnt_list(const H5S_pnt_list_t *src, unsigned rank) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(src); - HDassert(rank > 0); + assert(src); + assert(rank > 0); /* Allocate room for the head of the point list */ if (NULL == (dst = H5FL_MALLOC(H5S_pnt_list_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate point list node") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate point list node"); curr = src->head; new_tail = NULL; @@ -821,7 +805,7 @@ H5S__copy_pnt_list(const H5S_pnt_list_t *src, unsigned rank) /* Create new point */ if (NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate point node") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate point node"); new_node->next = NULL; /* Copy over the point's coordinates */ @@ -882,7 +866,7 @@ H5S__free_pnt_list(H5S_pnt_list_t *pnt_lst) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(pnt_lst); + assert(pnt_lst); /* Traverse the list, freeing all memory */ curr = pnt_lst->head; @@ -926,13 +910,13 @@ H5S__point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_selec FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(src); - HDassert(dst); + assert(src); + assert(dst); /* Allocate room for the head of the point list */ if (NULL == (dst->select.sel_info.pnt_lst = H5S__copy_pnt_list(src->select.sel_info.pnt_lst, src->extent.rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy point list") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy point list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -966,16 +950,16 @@ H5S__point_is_valid(const H5S_t *space) FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); /* Check each dimension */ for (u = 0; u < space->extent.rank; u++) { /* Bounds check the selected point + offset against the extent */ if ((space->select.sel_info.pnt_lst->high_bounds[u] + (hsize_t)space->select.offset[u]) > space->extent.size[u]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); if (((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] + space->select.offset[u]) < 0) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end for */ done: @@ -1010,9 +994,9 @@ H5Sget_select_elem_npoints(hid_t spaceid) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an element selection") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an element selection"); ret_value = (hssize_t)H5S_GET_SELECT_NPOINTS(space); @@ -1066,9 +1050,9 @@ H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t * FUNC_ENTER_PACKAGE /* Get bounding box for the selection */ - HDmemset(bounds_end, 0, sizeof(bounds_end)); + memset(bounds_end, 0, sizeof(bounds_end)); if (H5S__point_bounds(space, bounds_start, bounds_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds"); /* Determine whether number of points or high bounds exceeds (2^32 - 1) */ if (space->select.num_elem > H5S_UINT32_MAX) @@ -1088,7 +1072,7 @@ H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t * /* Get the file's low/high bounds */ if (H5CX_get_libver_bounds(&low_bound, &high_bound) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get low/high bounds from API context") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get low/high bounds from API context"); /* Upgrade to the version indicated by the file's low bound if higher */ tmp_version = MAX(tmp_version, H5O_sds_point_ver_bounds[low_bound]); @@ -1097,12 +1081,12 @@ H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t * if (tmp_version > H5O_sds_point_ver_bounds[high_bound]) { if (count_up_version) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, - "The number of points in point selection exceeds 2^32") + "The number of points in point selection exceeds 2^32"); else if (bound_up_version) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, - "The end of bounding box in point selection exceeds 2^32") + "The end of bounding box in point selection exceeds 2^32"); else - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "Dataspace point selection version out of bounds") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "Dataspace point selection version out of bounds"); } /* end if */ /* Set the version to return */ @@ -1131,7 +1115,7 @@ H5S__point_get_version_enc_size(const H5S_t *space, uint32_t *version, uint8_t * break; default: - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size"); break; } /* end switch */ @@ -1167,11 +1151,11 @@ H5S__point_serial_size(H5S_t *space) FUNC_ENTER_PACKAGE - HDassert(space); + assert(space); /* Determine the version and encoded size for point selection */ if (H5S__point_get_version_enc_size(space, &version, &enc_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine version and enc_size") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine version and enc_size"); /* Basic number of bytes required to serialize point selection: */ if (version >= H5S_POINT_VERSION_2) @@ -1233,14 +1217,14 @@ H5S__point_serialize(H5S_t *space, uint8_t **p) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); - HDassert(p); + assert(space); + assert(p); pp = (*p); - HDassert(pp); + assert(pp); /* Determine the version and encoded size for point selection info */ if (H5S__point_get_version_enc_size(space, &version, &enc_size) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine version and enc_size") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't determine version and enc_size"); /* Store the preamble information */ UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ @@ -1250,7 +1234,7 @@ H5S__point_serialize(H5S_t *space, uint8_t **p) *(pp)++ = enc_size; /* Store size of point info */ } else { - HDassert(version == H5S_POINT_VERSION_1); + assert(version == H5S_POINT_VERSION_1); UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ lenp = pp; /* Keep the pointer to the length location for later */ pp += 4; /* Skip over space for length */ @@ -1262,7 +1246,7 @@ H5S__point_serialize(H5S_t *space, uint8_t **p) switch (enc_size) { case H5S_SELECT_INFO_ENC_SIZE_2: - HDassert(version == H5S_POINT_VERSION_2); + assert(version == H5S_POINT_VERSION_2); /* Encode number of elements */ UINT16ENCODE(pp, (uint16_t)space->select.num_elem); @@ -1278,7 +1262,7 @@ H5S__point_serialize(H5S_t *space, uint8_t **p) break; case H5S_SELECT_INFO_ENC_SIZE_4: - HDassert(version == H5S_POINT_VERSION_1 || version == H5S_POINT_VERSION_2); + assert(version == H5S_POINT_VERSION_1 || version == H5S_POINT_VERSION_2); /* Encode number of elements */ UINT32ENCODE(pp, (uint32_t)space->select.num_elem); @@ -1298,7 +1282,7 @@ H5S__point_serialize(H5S_t *space, uint8_t **p) break; case H5S_SELECT_INFO_ENC_SIZE_8: - HDassert(version == H5S_POINT_VERSION_2); + assert(version == H5S_POINT_VERSION_2); /* Encode number of elements */ UINT64ENCODE(pp, space->select.num_elem); @@ -1314,7 +1298,7 @@ H5S__point_serialize(H5S_t *space, uint8_t **p) break; default: - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size"); break; } /* end switch */ @@ -1352,7 +1336,7 @@ H5S__point_serialize(H5S_t *space, uint8_t **p) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S__point_deserialize(H5S_t **space, const uint8_t **p) +H5S__point_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size, hbool_t skip) { H5S_t *tmp_space = NULL; /* Pointer to actual dataspace to use, either *space or a newly allocated one */ @@ -1364,14 +1348,16 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p) uint64_t num_elem = 0; /* Number of elements in selection */ unsigned rank; /* Rank of points */ unsigned i, j; /* local counting variables */ - herr_t ret_value = SUCCEED; /* Return value */ - + size_t enc_type_size; + size_t coordinate_buffer_requirement; + herr_t ret_value = SUCCEED; /* Return value */ + const uint8_t *p_end = *p + p_size - 1; /* Pointer to last valid byte in buffer */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(p); + assert(p); pp = (*p); - HDassert(pp); + assert(pp); /* As part of the efforts to push all selection-type specific coding to the callbacks, the coding for the allocation of a null dataspace @@ -1380,64 +1366,110 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p) /* Allocate space if not provided */ if (!*space) { if (NULL == (tmp_space = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace"); } /* end if */ else tmp_space = *space; /* Decode version */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection version"); UINT32DECODE(pp, version); if (version < H5S_POINT_VERSION_1 || version > H5S_POINT_VERSION_LATEST) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for point selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for point selection"); - if (version >= (uint32_t)H5S_POINT_VERSION_2) + if (version >= (uint32_t)H5S_POINT_VERSION_2) { /* Decode size of point info */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, 1, p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding point info"); enc_size = *(pp)++; + } else { /* Skip over the remainder of the header */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, 8, p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding selection headers"); pp += 8; enc_size = H5S_SELECT_INFO_ENC_SIZE_4; } /* Check encoded size */ if (enc_size & ~H5S_SELECT_INFO_ENC_SIZE_BITS) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown size of point/offset info for selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "unknown size of point/offset info for selection"); /* Decode the rank of the point selection */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection rank"); UINT32DECODE(pp, rank); if (!*space) { /* Patch the rank of the allocated dataspace */ - (void)HDmemset(dims, 0, (size_t)rank * sizeof(dims[0])); + (void)memset(dims, 0, (size_t)rank * sizeof(dims[0])); if (H5S_set_extent_simple(tmp_space, rank, dims, NULL) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set dimensions"); } /* end if */ else /* Verify the rank of the provided dataspace */ if (rank != tmp_space->extent.rank) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, - "rank of serialized selection does not match dataspace") + "rank of serialized selection does not match dataspace"); /* decode the number of points */ switch (enc_size) { case H5S_SELECT_INFO_ENC_SIZE_2: + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint16_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding number of points"); + UINT16DECODE(pp, num_elem); break; case H5S_SELECT_INFO_ENC_SIZE_4: + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding number of points"); + UINT32DECODE(pp, num_elem); break; case H5S_SELECT_INFO_ENC_SIZE_8: + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, sizeof(uint64_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding number of points"); + UINT64DECODE(pp, num_elem); break; default: - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size"); break; } /* end switch */ /* Allocate space for the coordinates */ if (NULL == (coord = (hsize_t *)H5MM_malloc(num_elem * rank * sizeof(hsize_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate coordinate information"); + + /* Determine necessary size of buffer for coordinates */ + enc_type_size = 0; + + switch (enc_size) { + case H5S_SELECT_INFO_ENC_SIZE_2: + enc_type_size = sizeof(uint16_t); + break; + case H5S_SELECT_INFO_ENC_SIZE_4: + enc_type_size = sizeof(uint32_t); + break; + case H5S_SELECT_INFO_ENC_SIZE_8: + enc_type_size = sizeof(uint64_t); + break; + default: + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size"); + break; + } + + coordinate_buffer_requirement = num_elem * rank * enc_type_size; + + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, pp, coordinate_buffer_requirement, p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, + "buffer overflow while decoding selection coordinates"); /* Retrieve the coordinates from the buffer */ for (tcoord = coord, i = 0; i < num_elem; i++) @@ -1446,22 +1478,20 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p) case H5S_SELECT_INFO_ENC_SIZE_2: UINT16DECODE(pp, *tcoord); break; - case H5S_SELECT_INFO_ENC_SIZE_4: UINT32DECODE(pp, *tcoord); break; - case H5S_SELECT_INFO_ENC_SIZE_8: UINT64DECODE(pp, *tcoord); break; default: - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unknown point info size"); break; } /* end switch */ /* Select points */ if (H5S_select_elements(tmp_space, H5S_SELECT_SET, num_elem, (const hsize_t *)coord) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); /* Update decoding pointer */ *p = pp; @@ -1474,7 +1504,7 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p) /* Free temporary space if not passed to caller (only happens on error) */ if (!*space && tmp_space) if (H5S_close(tmp_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace"); /* Free the coordinate array if necessary */ if (coord != NULL) @@ -1521,8 +1551,8 @@ H5S__get_select_elem_pointlist(const H5S_t *space, hsize_t startpoint, hsize_t n FUNC_ENTER_PACKAGE_NOERR - HDassert(space); - HDassert(buf); + assert(space); + assert(buf); /* Get the dataspace extent rank */ rank = space->extent.rank; @@ -1598,11 +1628,11 @@ H5Sget_select_elem_pointlist(hid_t spaceid, hsize_t startpoint, hsize_t numpoint /* Check args */ if (NULL == buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer"); if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (H5S_GET_SELECT_TYPE(space) != H5S_SEL_POINTS) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a point selection"); ret_value = H5S__get_select_elem_pointlist(space, startpoint, numpoints, buf); @@ -1645,19 +1675,19 @@ H5S__point_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(space); - HDassert(start); - HDassert(end); + assert(space); + assert(start); + assert(end); /* Loop over dimensions */ for (u = 0; u < space->extent.rank; u++) { /* Sanity check */ - HDassert(space->select.sel_info.pnt_lst->low_bounds[u] <= - space->select.sel_info.pnt_lst->high_bounds[u]); + assert(space->select.sel_info.pnt_lst->low_bounds[u] <= + space->select.sel_info.pnt_lst->high_bounds[u]); /* Check for offset moving selection negative */ if (((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] + space->select.offset[u]) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds"); /* Set the low & high bounds in this dimension */ start[u] = @@ -1702,8 +1732,8 @@ H5S__point_offset(const H5S_t *space, hsize_t *offset) FUNC_ENTER_PACKAGE - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); /* Start at linear offset 0 */ *offset = 0; @@ -1720,7 +1750,7 @@ H5S__point_offset(const H5S_t *space, hsize_t *offset) /* Check for offset moving selection out of the dataspace */ if (pnt_offset < 0 || (hsize_t)pnt_offset >= dim_size[i]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "offset moves selection out of bounds"); /* Add the point's offset in this dimension to the total linear offset */ *offset += (hsize_t)pnt_offset * accum; @@ -1789,7 +1819,7 @@ H5S__point_is_contiguous(const H5S_t *space) FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); /* One point is definitely contiguous */ if (space->select.num_elem == 1) @@ -1826,7 +1856,7 @@ H5S__point_is_single(const H5S_t *space) FUNC_ENTER_PACKAGE_NOERR - HDassert(space); + assert(space); /* One point is definitely 'single' :-) */ if (space->select.num_elem == 1) @@ -1866,7 +1896,7 @@ H5S__point_is_regular(H5S_t *space) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space); + assert(space); /* Only simple check for regular points for now... */ if (space->select.num_elem == 1) @@ -1910,16 +1940,16 @@ H5S__point_shape_same(H5S_t *space1, H5S_t *space2) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(space1); - HDassert(space2); + assert(space1); + assert(space2); /* Get dataspace ranks */ space1_rank = space1->extent.rank; space2_rank = space2->extent.rank; /* Sanity check */ - HDassert(space1_rank >= space2_rank); - HDassert(space2_rank > 0); + assert(space1_rank >= space2_rank); + assert(space2_rank > 0); /* Initialize dimensions */ space1_dim = (int)space1_rank - 1; @@ -1959,7 +1989,7 @@ H5S__point_shape_same(H5S_t *space1, H5S_t *space2) /* Compare locations in common dimensions, including relative offset */ while (space2_dim >= 0) { if ((hsize_t)((hssize_t)pnt1->pnt[space1_dim] + offset[space1_dim]) != pnt2->pnt[space2_dim]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); space1_dim--; space2_dim--; @@ -1969,7 +1999,7 @@ H5S__point_shape_same(H5S_t *space1, H5S_t *space2) while (space1_dim >= 0) { /* Compare the absolute offset in the remaining dimensions */ if ((hssize_t)pnt1->pnt[space1_dim] != offset[space1_dim]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); space1_dim--; } /* end while */ @@ -2011,10 +2041,10 @@ H5S__point_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *en FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(space); - HDassert(H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space)); - HDassert(start); - HDassert(end); + assert(space); + assert(H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space)); + assert(start); + assert(end); /* Loop over points */ pnt = space->select.sel_info.pnt_lst->head; @@ -2028,7 +2058,7 @@ H5S__point_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *en /* Check if point was within block for all dimensions */ if (u == space->extent.rank) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); /* Advance to next point */ pnt = pnt->next; @@ -2066,8 +2096,8 @@ H5S__point_adjust_u(H5S_t *space, const hsize_t *offset) FUNC_ENTER_PACKAGE_NOERR - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); /* Check for an all-zero offset vector */ for (u = 0; u < space->extent.rank; u++) @@ -2085,7 +2115,7 @@ H5S__point_adjust_u(H5S_t *space, const hsize_t *offset) /* Adjust each coordinate for point node */ for (u = 0; u < rank; u++) { /* Check for offset moving selection negative */ - HDassert(node->pnt[u] >= offset[u]); + assert(node->pnt[u] >= offset[u]); /* Adjust node's coordinate location */ node->pnt[u] -= offset[u]; @@ -2133,8 +2163,8 @@ H5S__point_adjust_s(H5S_t *space, const hssize_t *offset) FUNC_ENTER_PACKAGE_NOERR - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); /* Check for an all-zero offset vector */ for (u = 0; u < space->extent.rank; u++) @@ -2152,7 +2182,7 @@ H5S__point_adjust_s(H5S_t *space, const hssize_t *offset) /* Adjust each coordinate for point node */ for (u = 0; u < rank; u++) { /* Check for offset moving selection negative */ - HDassert((hssize_t)node->pnt[u] >= offset[u]); + assert((hssize_t)node->pnt[u] >= offset[u]); /* Adjust node's coordinate location */ node->pnt[u] = (hsize_t)((hssize_t)node->pnt[u] - offset[u]); @@ -2164,7 +2194,7 @@ H5S__point_adjust_s(H5S_t *space, const hssize_t *offset) /* update the bound box of the selection */ for (u = 0; u < rank; u++) { - HDassert((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] >= offset[u]); + assert((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] >= offset[u]); space->select.sel_info.pnt_lst->low_bounds[u] = (hsize_t)((hssize_t)space->select.sel_info.pnt_lst->low_bounds[u] - offset[u]); space->select.sel_info.pnt_lst->high_bounds[u] = @@ -2183,9 +2213,6 @@ H5S__point_adjust_s(H5S_t *space, const hssize_t *offset) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Sunday, July 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -2197,8 +2224,8 @@ H5S__point_project_scalar(const H5S_t *space, hsize_t *offset) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space)); - HDassert(offset); + assert(space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(space)); + assert(offset); /* Get the head of the point list */ node = space->select.sel_info.pnt_lst->head; @@ -2206,7 +2233,7 @@ H5S__point_project_scalar(const H5S_t *space, hsize_t *offset) /* Check for more than one point selected */ if (node->next) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, - "point selection of one element has more than one node!") + "point selection of one element has more than one node!"); /* Calculate offset of selection in projected buffer */ *offset = H5VM_array_offset(space->extent.rank, space->extent.size, node->pnt); @@ -2223,9 +2250,6 @@ H5S__point_project_scalar(const H5S_t *space, hsize_t *offset) * * Return: Non-negative on success, negative on failure. * - * Programmer: Quincey Koziol - * Sunday, July 18, 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -2241,17 +2265,17 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of FUNC_ENTER_PACKAGE /* Check args */ - HDassert(base_space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(base_space)); - HDassert(new_space); - HDassert(offset); + assert(base_space && H5S_SEL_POINTS == H5S_GET_SELECT_TYPE(base_space)); + assert(new_space); + assert(offset); /* We are setting a new selection, remove any current selection in new dataspace */ if (H5S_SELECT_RELEASE(new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't release selection"); /* Allocate room for the head of the point list */ if (NULL == (new_space->select.sel_info.pnt_lst = H5FL_MALLOC(H5S_pnt_list_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point list node") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point list node"); /* Check if the new space's rank is < or > base space's rank */ if (new_space->extent.rank < base_space->extent.rank) { @@ -2261,7 +2285,7 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of rank_diff = base_space->extent.rank - new_space->extent.rank; /* Calculate offset of selection in projected buffer */ - HDmemset(block, 0, sizeof(block)); + memset(block, 0, sizeof(block)); H5MM_memcpy(block, base_space->select.sel_info.pnt_lst->head->pnt, sizeof(hsize_t) * rank_diff); *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block); @@ -2271,7 +2295,7 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of while (base_node) { /* Create new point */ if (NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, new_space->extent.rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node"); new_node->next = NULL; /* Copy over the point's coordinates */ @@ -2299,7 +2323,7 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of } /* end for */ } /* end if */ else { - HDassert(new_space->extent.rank > base_space->extent.rank); + assert(new_space->extent.rank > base_space->extent.rank); /* Compute the difference in ranks */ rank_diff = new_space->extent.rank - base_space->extent.rank; @@ -2313,13 +2337,13 @@ H5S__point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *of while (base_node) { /* Create new point */ if (NULL == (new_node = (H5S_pnt_node_t *)H5FL_ARR_MALLOC(hcoords_t, new_space->extent.rank))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate point node"); new_node->next = NULL; /* Copy over the point's coordinates */ - HDmemset(new_node->pnt, 0, sizeof(hsize_t) * rank_diff); + memset(new_node->pnt, 0, sizeof(hsize_t) * rank_diff); H5MM_memcpy(&new_node->pnt[rank_diff], base_node->pnt, - (new_space->extent.rank * sizeof(hsize_t))); + (base_space->extent.rank * sizeof(hsize_t))); /* Keep the order the same when copying */ if (NULL == prev_node) @@ -2401,19 +2425,19 @@ H5Sselect_elements(hid_t spaceid, H5S_seloper_t op, size_t num_elem, const hsize /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (H5S_SCALAR == H5S_GET_EXTENT_TYPE(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_SCALAR space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_SCALAR space"); if (H5S_NULL == H5S_GET_EXTENT_TYPE(space)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_NULL space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "point doesn't support H5S_NULL space"); if (coord == NULL || num_elem == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "elements not specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "elements not specified"); if (!(op == H5S_SELECT_SET || op == H5S_SELECT_APPEND || op == H5S_SELECT_PREPEND)) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "unsupported operation attempted") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "unsupported operation attempted"); /* Call the real element selection routine */ if ((ret_value = H5S_select_elements(space, op, num_elem, coord)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't select elements") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't select elements"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Sselect.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Sselect.c index f596258a4f..3087df3222 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Sselect.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Sselect.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Friday, May 29, 1998 - * +/* * Purpose: Dataspace selection functions. */ @@ -50,12 +47,6 @@ /* Local Prototypes */ /********************/ -#ifdef LATER -static herr_t H5S__select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end); -static htri_t H5S__select_iter_has_next_block(const H5S_sel_iter_t *iter); -static herr_t H5S__select_iter_next_block(H5S_sel_iter_t *iter); -#endif /* LATER */ - /*****************************/ /* Library Private Variables */ /*****************************/ @@ -102,9 +93,9 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); - HDassert(0 < space->extent.rank && space->extent.rank <= H5S_MAX_RANK); - HDassert(offset); + assert(space); + assert(0 < space->extent.rank && space->extent.rank <= H5S_MAX_RANK); + assert(offset); /* Copy the offset over */ H5MM_memcpy(space->select.offset, offset, sizeof(hssize_t) * space->extent.rank); @@ -142,16 +133,16 @@ H5Soffset_simple(hid_t space_id, const hssize_t *offset) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "not a dataspace"); if (space->extent.rank == 0 || (H5S_GET_EXTENT_TYPE(space) == H5S_SCALAR || H5S_GET_EXTENT_TYPE(space) == H5S_NULL)) - HGOTO_ERROR(H5E_ID, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace") + HGOTO_ERROR(H5E_ID, H5E_UNSUPPORTED, FAIL, "can't set offset on scalar or null dataspace"); if (offset == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no offset specified"); /* Set the selection offset */ if (H5S_select_offset(space, offset) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set offset") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "can't set offset"); done: FUNC_LEAVE_API(ret_value) @@ -190,13 +181,13 @@ H5Sselect_copy(hid_t dst_id, hid_t src_id) /* Check args */ if (NULL == (src = (H5S_t *)H5I_object_verify(src_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); if (NULL == (dst = (H5S_t *)H5I_object_verify(dst_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Copy */ if (H5S_select_copy(dst, src, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy selection"); done: FUNC_LEAVE_API(ret_value) @@ -235,19 +226,19 @@ H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(dst); - HDassert(src); + assert(dst); + assert(src); /* Release the current selection */ if (H5S_SELECT_RELEASE(dst) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection"); /* Copy regular fields */ dst->select = src->select; /* Perform correct type of copy based on the type of selection */ if ((ret_value = (*src->select.type->copy)(dst, src, share_selection)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy selection specific information") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy selection specific information"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -260,9 +251,6 @@ H5S_select_copy(H5S_t *dst, const H5S_t *src, hbool_t share_selection) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, May 30, 2003 - * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. @@ -276,11 +264,11 @@ H5S_select_release(H5S_t *ds) FUNC_ENTER_NOAPI_NOINIT - HDassert(ds); + assert(ds); /* Call the selection type's release function */ if ((ds->select.type) && ((ret_value = (*ds->select.type->release)(ds)) < 0)) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -294,9 +282,6 @@ H5S_select_release(H5S_t *ds) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, May 18, 2004 - * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. @@ -310,7 +295,7 @@ H5S_select_serial_size(H5S_t *space) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(space); + assert(space); /* Call the selection type's serial_size function */ ret_value = (*space->select.type->serial_size)(space); @@ -349,8 +334,8 @@ H5S_select_serialize(H5S_t *space, uint8_t **p) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(space); - HDassert(p); + assert(space); + assert(p); /* Call the selection type's serialize function */ ret_value = (*space->select.type->serialize)(space, p); @@ -386,7 +371,7 @@ H5Sget_select_npoints(hid_t spaceid) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); ret_value = (hssize_t)H5S_GET_SELECT_NPOINTS(space); @@ -400,7 +385,7 @@ H5Sget_select_npoints(hid_t spaceid) PURPOSE Get the number of elements in current selection USAGE - hssize_t H5Sget_select_npoints(space) + hsize_t H5Sget_select_npoints(space) H5S_t *space; IN: Dataspace of selection to query RETURNS The number of elements in selection on success, 0 on failure @@ -420,7 +405,7 @@ H5S_get_select_npoints(const H5S_t *space) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); + assert(space); FUNC_LEAVE_NOAPI(space->select.num_elem) } /* end H5S_get_select_npoints() */ @@ -456,7 +441,7 @@ H5Sselect_valid(hid_t spaceid) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); ret_value = H5S_SELECT_VALID(space); @@ -494,7 +479,7 @@ H5S_select_valid(const H5S_t *space) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(space); + assert(space); ret_value = (*space->select.type->is_valid)(space); @@ -528,36 +513,39 @@ H5S_select_valid(const H5S_t *space) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_select_deserialize(H5S_t **space, const uint8_t **p) +H5S_select_deserialize(H5S_t **space, const uint8_t **p, const size_t p_size) { - uint32_t sel_type; /* Pointer to the selection type */ - herr_t ret_value = FAIL; /* Return value */ - + uint32_t sel_type; /* Pointer to the selection type */ + herr_t ret_value = FAIL; /* Return value */ + const uint8_t *p_end = *p + p_size - 1; /* Pointer to last valid byte in buffer */ + hbool_t skip = (p_size == SIZE_MAX ? TRUE : FALSE); /* If p_size is unknown, skip buffer checks */ FUNC_ENTER_NOAPI(FAIL) - HDassert(space); + assert(space); /* Selection-type specific coding is moved to the callbacks. */ /* Decode selection type */ + if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *p, sizeof(uint32_t), p_end)) + HGOTO_ERROR(H5E_DATASPACE, H5E_OVERFLOW, FAIL, "buffer overflow while decoding selection type"); UINT32DECODE(*p, sel_type); /* Make routine for selection type */ switch (sel_type) { case H5S_SEL_POINTS: /* Sequence of points selected */ - ret_value = (*H5S_sel_point->deserialize)(space, p); + ret_value = (*H5S_sel_point->deserialize)(space, p, p_size - sizeof(uint32_t), skip); break; case H5S_SEL_HYPERSLABS: /* Hyperslab selection defined */ - ret_value = (*H5S_sel_hyper->deserialize)(space, p); + ret_value = (*H5S_sel_hyper->deserialize)(space, p, p_size - sizeof(uint32_t), skip); break; case H5S_SEL_ALL: /* Entire extent selected */ - ret_value = (*H5S_sel_all->deserialize)(space, p); + ret_value = (*H5S_sel_all->deserialize)(space, p, p_size - sizeof(uint32_t), skip); break; case H5S_SEL_NONE: /* Nothing selected */ - ret_value = (*H5S_sel_none->deserialize)(space, p); + ret_value = (*H5S_sel_none->deserialize)(space, p, p_size - sizeof(uint32_t), skip); break; default: @@ -565,7 +553,7 @@ H5S_select_deserialize(H5S_t **space, const uint8_t **p) } if (ret_value < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTLOAD, FAIL, "can't deserialize selection"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -612,9 +600,9 @@ H5Sget_select_bounds(hid_t spaceid, hsize_t start[] /*out*/, hsize_t end[] /*out /* Check args */ if (start == NULL || end == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer"); if (NULL == (space = (H5S_t *)H5I_object_verify(spaceid, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); ret_value = H5S_SELECT_BOUNDS(space, start, end); @@ -657,9 +645,9 @@ H5S_get_select_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); - HDassert(start); - HDassert(end); + assert(space); + assert(start); + assert(end); ret_value = (*space->select.type->bounds)(space, start, end); @@ -697,8 +685,8 @@ H5S_get_select_offset(const H5S_t *space, hsize_t *offset) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); ret_value = (*space->select.type->offset)(space, offset); @@ -735,7 +723,7 @@ H5S_get_select_unlim_dim(const H5S_t *space) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); + assert(space); ret_value = (*space->select.type->unlim_dim)(space); @@ -770,17 +758,18 @@ H5S_get_select_num_elem_non_unlim(const H5S_t *space, hsize_t *num_elem_non_unli FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(space); - HDassert(num_elem_non_unlim); + assert(space); + assert(num_elem_non_unlim); /* Check for selection callback */ if (!space->select.type->num_elem_non_unlim) - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "selection type has no num_elem_non_unlim callback") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, + "selection type has no num_elem_non_unlim callback"); /* Make selection callback */ if ((*space->select.type->num_elem_non_unlim)(space, num_elem_non_unlim) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, - "can't get number of elements in non-unlimited dimension") + "can't get number of elements in non-unlimited dimension"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -815,7 +804,7 @@ H5S_select_is_contiguous(const H5S_t *space) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); + assert(space); ret_value = (*space->select.type->is_contiguous)(space); @@ -851,7 +840,7 @@ H5S_select_is_single(const H5S_t *space) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); + assert(space); ret_value = (*space->select.type->is_single)(space); @@ -887,7 +876,7 @@ H5S_select_is_regular(H5S_t *space) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); + assert(space); ret_value = (*space->select.type->is_regular)(space); @@ -923,8 +912,8 @@ H5S_select_adjust_u(H5S_t *space, const hsize_t *offset) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); /* Perform operation */ ret_value = (*space->select.type->adjust_u)(space, offset); @@ -961,8 +950,8 @@ H5S_select_adjust_s(H5S_t *space, const hssize_t *offset) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); /* Perform operation */ ret_value = (*space->select.type->adjust_s)(space, offset); @@ -1001,19 +990,19 @@ H5Sselect_adjust(hid_t space_id, const hssize_t *offset) H5TRACE2("e", "i*Hs", space_id, offset); if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace"); if (NULL == offset) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "NULL offset pointer"); /* Check bounds */ if (H5S_SELECT_BOUNDS(space, low_bounds, high_bounds) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds"); for (u = 0; u < space->extent.rank; u++) if (offset[u] > (hssize_t)low_bounds[u]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjustment would move selection below zero offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "adjustment would move selection below zero offset"); if (H5S_select_adjust_s(space, offset) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection"); done: FUNC_LEAVE_API(ret_value) @@ -1049,8 +1038,8 @@ H5S_select_project_scalar(const H5S_t *space, hsize_t *offset) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); - HDassert(offset); + assert(space); + assert(offset); ret_value = (*space->select.type->project_scalar)(space, offset); @@ -1088,9 +1077,9 @@ H5S_select_project_simple(const H5S_t *space, H5S_t *new_space, hsize_t *offset) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); - HDassert(new_space); - HDassert(offset); + assert(space); + assert(new_space); + assert(offset); ret_value = (*space->select.type->project_simple)(space, new_space, offset); @@ -1123,8 +1112,8 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, H5S_t *space, size_t elmt_size, u FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(sel_iter); - HDassert(space); + assert(sel_iter); + assert(space); /* Initialize common information */ @@ -1148,7 +1137,7 @@ H5S_select_iter_init(H5S_sel_iter_t *sel_iter, H5S_t *space, size_t elmt_size, u /* Call initialization routine for selection type */ ret_value = (*space->select.type->iter_init)(space, sel_iter); - HDassert(sel_iter->type); + assert(sel_iter->type); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_iter_init() */ @@ -1183,8 +1172,8 @@ H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(sel_iter); - HDassert(coords); + assert(sel_iter); + assert(coords); /* Call iter_coords routine for selection type */ ret_value = (*sel_iter->type->iter_coords)(sel_iter, coords); @@ -1192,50 +1181,6 @@ H5S_select_iter_coords(const H5S_sel_iter_t *sel_iter, hsize_t *coords) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_iter_coords() */ -#ifdef LATER - -/*-------------------------------------------------------------------------- - NAME - H5S__select_iter_block - PURPOSE - Get the block of the current iterator position - USAGE - herr_t H5S__select_iter_block(sel_iter,start,end) - const H5S_sel_iter_t *sel_iter; IN: Selection iterator to query - hsize_t *start; OUT: Array to place iterator start block coordinates - hsize_t *end; OUT: Array to place iterator end block coordinates - RETURNS - Non-negative on success, negative on failure. - DESCRIPTION - The current location of the iterator within the selection is placed in - the COORDS array. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - This routine participates in the "Inlining C function pointers" - pattern, don't call it directly, use the appropriate macro - defined in H5Sprivate.h. - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static herr_t -H5S__select_iter_block(const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) -{ - herr_t ret_value; /* return value */ - - FUNC_ENTER_PACKAGE_NOERR - - /* Check args */ - HDassert(iter); - HDassert(start); - HDassert(end); - - /* Call iter_block routine for selection type */ - ret_value = (*iter->type->iter_block)(iter, start, end); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S__select_iter_block() */ -#endif /* LATER */ - /*-------------------------------------------------------------------------- NAME H5S_select_iter_nelmts @@ -1264,7 +1209,7 @@ H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(sel_iter); + assert(sel_iter); /* Call iter_nelmts routine for selection type */ ret_value = (*sel_iter->type->iter_nelmts)(sel_iter); @@ -1272,46 +1217,6 @@ H5S_select_iter_nelmts(const H5S_sel_iter_t *sel_iter) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_iter_nelmts() */ -#ifdef LATER - -/*-------------------------------------------------------------------------- - NAME - H5S__select_iter_has_next_block - PURPOSE - Check if there is another block available in the selection iterator - USAGE - htri_t H5S__select_iter_has_next_block(sel_iter) - const H5S_sel_iter_t *sel_iter; IN: Selection iterator to query - RETURNS - Non-negative on success, negative on failure. - DESCRIPTION - Check if there is another block available to advance to in the selection - iterator. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - This routine participates in the "Inlining C function pointers" - pattern, don't call it directly, use the appropriate macro - defined in H5Sprivate.h. - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static htri_t -H5S__select_iter_has_next_block(const H5S_sel_iter_t *iter) -{ - herr_t ret_value; /* return value */ - - FUNC_ENTER_PACKAGE_NOERR - - /* Check args */ - HDassert(iter); - - /* Call iter_has_next_block routine for selection type */ - ret_value = (*iter->type->iter_has_next_block)(iter); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S__select_iter_has_next_block() */ -#endif /* LATER */ - /*-------------------------------------------------------------------------- NAME H5S_select_iter_next @@ -1342,8 +1247,8 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(iter); - HDassert(nelem > 0); + assert(iter); + assert(nelem > 0); /* Call iter_next routine for selection type */ ret_value = (*iter->type->iter_next)(iter, nelem); @@ -1354,48 +1259,6 @@ H5S_select_iter_next(H5S_sel_iter_t *iter, size_t nelem) FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_iter_next() */ -#ifdef LATER - -/*-------------------------------------------------------------------------- - NAME - H5S__select_iter_next_block - PURPOSE - Advance selection iterator to next block - USAGE - herr_t H5S__select_iter_next_block(iter) - H5S_sel_iter_t *iter; IN/OUT: Selection iterator to change - RETURNS - Non-negative on success, negative on failure. - DESCRIPTION - Move the current element for the selection iterator to the next - block in the selection. - GLOBAL VARIABLES - COMMENTS, BUGS, ASSUMPTIONS - Doesn't maintain the 'elmt_left' field of the selection iterator. - - This routine participates in the "Inlining C function pointers" - pattern, don't call it directly, use the appropriate macro - defined in H5Sprivate.h. - EXAMPLES - REVISION LOG ---------------------------------------------------------------------------*/ -static herr_t -H5S__select_iter_next_block(H5S_sel_iter_t *iter) -{ - herr_t ret_value; /* return value */ - - FUNC_ENTER_PACKAGE_NOERR - - /* Check args */ - HDassert(iter); - - /* Call iter_next_block routine for selection type */ - ret_value = (*iter->type->iter_next_block)(iter); - - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5S__select_iter_next_block() */ -#endif /* LATER */ - /*------------------------------------------------------------------------- * Function: H5S_select_iter_get_seq_list * @@ -1404,9 +1267,6 @@ H5S__select_iter_next_block(H5S_sel_iter_t *iter) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Tuesday, May 18, 2004 - * * Note: This routine participates in the "Inlining C function pointers" * pattern, don't call it directly, use the appropriate macro * defined in H5Sprivate.h. @@ -1422,11 +1282,11 @@ H5S_select_iter_get_seq_list(H5S_sel_iter_t *iter, size_t maxseq, size_t maxelmt FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(iter); + assert(iter); /* Call the selection type's get_seq_list function */ if ((ret_value = (*iter->type->iter_get_seq_list)(iter, maxseq, maxelmts, nseq, nelmts, off, len)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get selection sequence list") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get selection sequence list"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1460,7 +1320,7 @@ H5S_select_iter_release(H5S_sel_iter_t *sel_iter) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(sel_iter); + assert(sel_iter); /* Call selection type-specific release routine */ ret_value = (*sel_iter->type->iter_release)(sel_iter); @@ -1514,34 +1374,34 @@ H5S_select_iterate(void *buf, const H5T_t *type, H5S_t *space, const H5S_sel_ite FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(buf); - HDassert(type); - HDassert(space); - HDassert(op); + assert(buf); + assert(type); + assert(space); + assert(op); /* Get the datatype size */ if (0 == (elmt_size = H5T_get_size(type))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "datatype size invalid"); /* Allocate the selection iterator */ if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator"); /* Initialize iterator */ if (H5S_select_iter_init(iter, space, elmt_size, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); iter_init = TRUE; /* Selection iteration info has been initialized */ /* Get the number of elements in selection */ if ((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(space)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); /* Get the rank of the dataspace */ ndims = space->extent.rank; if (ndims > 0) { /* Copy the size of the space */ - HDassert(space->extent.size); + assert(space->extent.size); H5MM_memcpy(space_size, space->extent.size, ndims * sizeof(hsize_t)); } /* end if */ space_size[ndims] = elmt_size; @@ -1551,9 +1411,9 @@ H5S_select_iterate(void *buf, const H5T_t *type, H5S_t *space, const H5S_sel_ite /* Allocate the offset & length arrays */ if (NULL == (len = H5FL_SEQ_MALLOC(size_t, H5D_IO_VECTOR_SIZE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate length vector array") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate length vector array"); if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, H5D_IO_VECTOR_SIZE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate offset vector array") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate offset vector array"); /* Loop, while elements left in selection */ while (max_elem > 0 && user_ret == 0) { @@ -1564,7 +1424,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, H5S_t *space, const H5S_sel_ite /* Get the sequences of bytes */ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop, while sequences left to process */ for (curr_seq = 0; curr_seq < nseq && user_ret == 0; curr_seq++) { @@ -1606,7 +1466,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, H5S_t *space, const H5S_sel_ite break; default: - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported op type") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "unsupported op type"); } /* end switch */ /* Check for error return from iterator */ @@ -1637,7 +1497,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, H5S_t *space, const H5S_sel_ite /* Release selection iterator */ if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); if (iter) iter = H5FL_FREE(H5S_sel_iter_t, iter); @@ -1670,7 +1530,7 @@ H5Sget_select_type(hid_t space_id) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, H5S_SEL_ERROR, "not a dataspace") + HGOTO_ERROR(H5E_ID, H5E_BADID, H5S_SEL_ERROR, "not a dataspace"); /* Set return value */ ret_value = H5S_GET_SELECT_TYPE(space); @@ -1706,7 +1566,7 @@ H5S_get_select_type(const H5S_t *space) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Check args */ - HDassert(space); + assert(space); /* Set return value */ ret_value = H5S_GET_SELECT_TYPE(space); @@ -1749,12 +1609,12 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(space1); - HDassert(space2); + assert(space1); + assert(space2); /* Check for different number of elements selected */ if (H5S_GET_SELECT_NPOINTS(space1) != H5S_GET_SELECT_NPOINTS(space2)) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Check special cases if both dataspaces aren't scalar */ /* (If only one is, the number of selected points check is sufficient) */ @@ -1792,8 +1652,8 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) } /* end else */ space_a_rank = space_a->extent.rank; space_b_rank = space_b->extent.rank; - HDassert(space_a_rank >= space_b_rank); - HDassert(space_b_rank > 0); + assert(space_a_rank >= space_b_rank); + assert(space_b_rank > 0); /* Get selection type for both dataspaces */ sel_a_type = H5S_GET_SELECT_TYPE(space_a); @@ -1809,22 +1669,22 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) /* Get low & high bounds for both dataspaces */ if (H5S_SELECT_BOUNDS(space_a, low_a, high_a) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, - "can't get selection bounds for first dataspace") + "can't get selection bounds for first dataspace"); if (H5S_SELECT_BOUNDS(space_b, low_b, high_b) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, - "can't get selection bounds for second dataspace") + "can't get selection bounds for second dataspace"); /* Check that the range between the low & high bounds are the same */ space_a_dim = (int)space_a_rank - 1; space_b_dim = (int)space_b_rank - 1; while (space_b_dim >= 0) { /* Sanity check */ - HDassert(low_a[space_a_dim] <= high_a[space_a_dim]); - HDassert(low_a[space_b_dim] <= high_a[space_b_dim]); + assert(low_a[space_a_dim] <= high_a[space_a_dim]); + assert(low_a[space_b_dim] <= high_a[space_b_dim]); /* Verify that the ranges are the same */ if ((high_a[space_a_dim] - low_a[space_a_dim]) != (high_b[space_b_dim] - low_b[space_b_dim])) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Go to next dimension */ space_a_dim--; @@ -1834,11 +1694,11 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) /* Check that the rest of the ranges in space a are "flat" */ while (space_a_dim >= 0) { /* Sanity check */ - HDassert(low_a[space_a_dim] <= high_a[space_a_dim]); + assert(low_a[space_a_dim] <= high_a[space_a_dim]); /* This range should be flat to be the same in a lower dimension */ if (low_a[space_a_dim] != high_a[space_a_dim]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); space_a_dim--; } /* end while */ @@ -1849,7 +1709,7 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) * the same, then the selections are the same, even if the * selection types are different. */ - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); } /* end if */ } /* end if */ @@ -1869,9 +1729,9 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) /* Allocate the selection iterators */ if (NULL == (iter_a = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator"); if (NULL == (iter_b = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator"); /* Initialize iterator for each dataspace selection * Use '0' for element size instead of actual element size to indicate @@ -1879,10 +1739,10 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) * aren't actually going to be doing I/O with the iterators. */ if (H5S_select_iter_init(iter_a, space_a, (size_t)0, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator a") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator a"); iter_a_init = TRUE; if (H5S_select_iter_init(iter_b, space_b, (size_t)0, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator b") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator b"); iter_b_init = TRUE; /* Iterate over all the blocks in each selection */ @@ -1891,9 +1751,9 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) /* Get the current block for each selection iterator */ if (H5S_SELECT_ITER_BLOCK(iter_a, start_a, end_a) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block a") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block a"); if (H5S_SELECT_ITER_BLOCK(iter_b, start_b, end_b) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block b") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get iterator block b"); space_a_dim = (int)space_a_rank - 1; space_b_dim = (int)space_b_rank - 1; @@ -1908,7 +1768,7 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) while (space_b_dim >= 0) { if ((end_a[space_a_dim] - start_a[space_a_dim]) != (end_b[space_b_dim] - start_b[space_b_dim])) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* Set the relative locations of the selections */ offset[space_a_dim] = (hssize_t)start_b[space_b_dim] - (hssize_t)start_a[space_a_dim]; @@ -1922,7 +1782,7 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) */ while (space_a_dim >= 0) { if (start_a[space_a_dim] != end_a[space_a_dim]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); space_a_dim--; } /* end while */ @@ -1937,12 +1797,12 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) /* Check if the blocks are in the same relative location */ if ((hsize_t)((hssize_t)start_a[space_a_dim] + offset[space_a_dim]) != start_b[space_b_dim]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); /* If the block sizes from each selection doesn't match, get out */ if ((end_a[space_a_dim] - start_a[space_a_dim]) != (end_b[space_b_dim] - start_b[space_b_dim])) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); space_a_dim--; space_b_dim--; @@ -1952,7 +1812,7 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) while (space_a_dim >= 0) { /* If the block size isn't 1, get out */ if (start_a[space_a_dim] != end_a[space_a_dim]) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); space_a_dim--; } /* end while */ @@ -1960,25 +1820,25 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) /* Check if we are able to advance to the next selection block */ if ((status_a = H5S_SELECT_ITER_HAS_NEXT_BLOCK(iter_a)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block a") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block a"); if ((status_b = H5S_SELECT_ITER_HAS_NEXT_BLOCK(iter_b)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block b") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "unable to check iterator block b"); /* Did we run out of blocks at the same time? */ if ((status_a == FALSE) && (status_b == FALSE)) break; else if (status_a != status_b) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); else { /* Advance to next block in selection iterators */ if (H5S_SELECT_ITER_NEXT_BLOCK(iter_a) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, - "unable to advance to next iterator block a") + "unable to advance to next iterator block a"); if (H5S_SELECT_ITER_NEXT_BLOCK(iter_b) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, - "unable to advance to next iterator block b") + "unable to advance to next iterator block b"); } /* end else */ } /* end while */ } /* end else */ @@ -1986,11 +1846,11 @@ H5S_select_shape_same(H5S_t *space1, H5S_t *space2) done: if (iter_a_init && H5S_SELECT_ITER_RELEASE(iter_a) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator a") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator a"); if (iter_a) iter_a = H5FL_FREE(H5S_sel_iter_t, iter_a); if (iter_b_init && H5S_SELECT_ITER_RELEASE(iter_b) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator b") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator b"); if (iter_b) iter_b = H5FL_FREE(H5S_sel_iter_t, iter_b); @@ -2027,12 +1887,12 @@ H5Sselect_shape_same(hid_t space1_id, hid_t space2_id) H5TRACE2("t", "ii", space1_id, space2_id); if (NULL == (space1 = (H5S_t *)H5I_object_verify(space1_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace"); if (NULL == (space2 = (H5S_t *)H5I_object_verify(space2_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace"); if ((ret_value = H5S_select_shape_same(space1, space2)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't compare selections") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't compare selections"); done: FUNC_LEAVE_API(ret_value) @@ -2069,9 +1929,9 @@ H5S_select_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *en FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(space); - HDassert(start); - HDassert(end); + assert(space); + assert(start); + assert(end); /* If selections aren't "none", compare their bounds */ if (H5S_SEL_NONE != H5S_GET_SELECT_TYPE(space)) { @@ -2081,18 +1941,18 @@ H5S_select_intersect_block(H5S_t *space, const hsize_t *start, const hsize_t *en /* Get low & high bounds for dataspace selection */ if (H5S_SELECT_BOUNDS(space, low, high) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds for dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get selection bounds for dataspace"); /* Loop over selection bounds and block, checking for overlap */ for (u = 0; u < space->extent.rank; u++) /* If selection bounds & block don't overlap, can leave now */ if (!H5S_RANGE_OVERLAP(low[u], high[u], start[u], end[u])) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end if */ /* Call selection type's intersect routine */ if ((ret_value = (*space->select.type->intersect_block)(space, start, end)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't intersect block with selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't intersect block with selection"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2132,21 +1992,21 @@ H5Sselect_intersect_block(hid_t space_id, const hsize_t *start, const hsize_t *e /* Check arguments */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace"); if (NULL == start) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "block start array pointer is NULL") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "block start array pointer is NULL"); if (NULL == end) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "block end array pointer is NULL") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "block end array pointer is NULL"); /* Range check start & end values */ for (u = 0; u < space->extent.rank; u++) if (start[u] > end[u]) HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, "block start[%u] (%llu) > end[%u] (%llu)", u, - (unsigned long long)start[u], u, (unsigned long long)end[u]) + (unsigned long long)start[u], u, (unsigned long long)end[u]); /* Call internal routine to do comparison */ if ((ret_value = H5S_select_intersect_block(space, start, end)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't compare selection and block") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't compare selection and block"); done: FUNC_LEAVE_API(ret_value) @@ -2221,19 +2081,19 @@ H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr, unsign FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(base_space != NULL); - HDassert((H5S_GET_EXTENT_TYPE(base_space) == H5S_SCALAR) || - (H5S_GET_EXTENT_TYPE(base_space) == H5S_SIMPLE)); - HDassert(new_space_ptr != NULL); - HDassert((new_space_rank != 0) || (H5S_GET_SELECT_NPOINTS(base_space) <= 1)); - HDassert(new_space_rank <= H5S_MAX_RANK); - HDassert(element_size > 0); + assert(base_space != NULL); + assert((H5S_GET_EXTENT_TYPE(base_space) == H5S_SCALAR) || + (H5S_GET_EXTENT_TYPE(base_space) == H5S_SIMPLE)); + assert(new_space_ptr != NULL); + assert((new_space_rank != 0) || (H5S_GET_SELECT_NPOINTS(base_space) <= 1)); + assert(new_space_rank <= H5S_MAX_RANK); + assert(element_size > 0); /* Get the extent info for the base dataspace */ if ((sbase_space_rank = H5S_get_simple_extent_dims(base_space, base_space_dims, base_space_maxdims)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality of base space") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get dimensionality of base space"); base_space_rank = (unsigned)sbase_space_rank; - HDassert(base_space_rank != new_space_rank); + assert(base_space_rank != new_space_rank); /* Check if projected space is scalar */ if (new_space_rank == 0) { @@ -2241,12 +2101,12 @@ H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr, unsign /* Retrieve the number of elements selected */ if ((npoints = (hssize_t)H5S_GET_SELECT_NPOINTS(base_space)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get number of points selected") - HDassert(npoints <= 1); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "unable to get number of points selected"); + assert(npoints <= 1); /* Create new scalar dataspace */ if (NULL == (new_space = H5S_create(H5S_SCALAR))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create scalar dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create scalar dataspace"); /* No need to register the dataspace(i.e. get an ID) as * we will just be discarding it shortly. @@ -2273,13 +2133,13 @@ H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr, unsign * */ if (H5S_SELECT_PROJECT_SCALAR(base_space, &projected_space_element_offset) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to project scalar selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to project scalar selection"); } /* end if */ else { - HDassert(0 == npoints); + assert(0 == npoints); if (H5S_select_none(new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't delete default selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't delete default selection"); } /* end else */ } /* end if */ else { /* projected space must be simple */ @@ -2345,7 +2205,7 @@ H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr, unsign * so we can create the new simple dataspace. */ if (NULL == (new_space = H5S_create_simple(new_space_rank, new_space_dims, new_space_maxdims))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); /* No need to register the dataspace(i.e. get an ID) as * we will just be discarding it shortly. @@ -2356,7 +2216,7 @@ H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr, unsign * dataspace into the projected dataspace. */ if (H5S_SELECT_PROJECT_SIMPLE(base_space, new_space, &projected_space_element_offset) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to project simple selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "unable to project simple selection"); /* If we get this far, we have created the new dataspace, and projected * the selection in the base dataspace into the new dataspace. @@ -2368,7 +2228,7 @@ H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr, unsign */ if (H5S_GET_EXTENT_TYPE(base_space) == H5S_SIMPLE && base_space->select.offset_changed) { if (new_space_rank > base_space_rank) { - HDmemset(new_space->select.offset, 0, sizeof(new_space->select.offset[0]) * rank_diff); + memset(new_space->select.offset, 0, sizeof(new_space->select.offset[0]) * rank_diff); H5MM_memcpy(&new_space->select.offset[rank_diff], base_space->select.offset, sizeof(new_space->select.offset[0]) * base_space_rank); } /* end if */ @@ -2384,7 +2244,7 @@ H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr, unsign /* If we have done the projection correctly, the following assertion * should hold. */ - HDassert(TRUE == H5S_select_shape_same(base_space, new_space)); + assert(TRUE == H5S_select_shape_same(base_space, new_space)); /* load the address of the new space into *new_space_ptr */ *new_space_ptr = new_space; @@ -2403,7 +2263,7 @@ H5S_select_construct_projection(H5S_t *base_space, H5S_t **new_space_ptr, unsign /* Cleanup on error */ if (ret_value < 0) if (new_space && H5S_close(new_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_select_construct_projection() */ @@ -2446,32 +2306,32 @@ H5S_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *_buf) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(fill); - HDassert(fill_size > 0); - HDassert(space); - HDassert(_buf); + assert(fill); + assert(fill_size > 0); + assert(space); + assert(_buf); /* Allocate the selection iterator */ if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator"); /* Initialize iterator */ if (H5S_select_iter_init(iter, space, fill_size, 0) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize selection iterator"); iter_init = TRUE; /* Selection iteration info has been initialized */ /* Get the number of elements in selection */ if ((nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(space)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOUNT, FAIL, "can't get number of elements selected"); /* Compute the number of bytes to process */ H5_CHECKED_ASSIGN(max_elem, size_t, nelmts, hssize_t); /* Allocate the offset & length arrays */ if (NULL == (len = H5FL_SEQ_MALLOC(size_t, H5D_IO_VECTOR_SIZE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate length vector array") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate length vector array"); if (NULL == (off = H5FL_SEQ_MALLOC(hsize_t, H5D_IO_VECTOR_SIZE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate offset vector array") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate offset vector array"); /* Loop, while elements left in selection */ while (max_elem > 0) { @@ -2482,7 +2342,7 @@ H5S_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *_buf) /* Get the sequences of bytes */ if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, (size_t)H5D_IO_VECTOR_SIZE, max_elem, &nseq, &nelem, off, len) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "sequence length generation failed"); /* Loop over sequences */ for (curr_seq = 0; curr_seq < nseq; curr_seq++) { @@ -2492,7 +2352,7 @@ H5S_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *_buf) buf = (uint8_t *)_buf + off[curr_seq]; /* Fill each sequence in memory with fill value */ - HDassert((len[curr_seq] % fill_size) == 0); + assert((len[curr_seq] % fill_size) == 0); H5VM_array_fill(buf, fill, fill_size, (len[curr_seq] / fill_size)); } /* end for */ @@ -2509,7 +2369,7 @@ H5S_select_fill(const void *fill, size_t fill_size, H5S_t *space, void *_buf) /* Release selection iterator */ if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release selection iterator"); if (iter) iter = H5FL_FREE(H5S_sel_iter_t, iter); @@ -2563,30 +2423,30 @@ H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(src_space); - HDassert(dst_space); - HDassert(src_intersect_space); - HDassert(new_space_ptr); - HDassert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); - HDassert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); + assert(src_space); + assert(dst_space); + assert(src_intersect_space); + assert(new_space_ptr); + assert(H5S_GET_SELECT_NPOINTS(src_space) == H5S_GET_SELECT_NPOINTS(dst_space)); + assert(H5S_GET_EXTENT_NDIMS(src_space) == H5S_GET_EXTENT_NDIMS(src_intersect_space)); if (NULL == (ss_iter = H5FL_CALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator"); if (NULL == (ds_iter = H5FL_CALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate selection iterator"); /* Create new space, using dst extent. Start with "all" selection. */ if (NULL == (new_space = H5S_create(H5S_SIMPLE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create output dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "unable to create output dataspace"); if (H5S__extent_copy_real(&new_space->extent, &dst_space->extent, TRUE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy destination space extent") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "unable to copy destination space extent"); /* If the intersecting space is "all", the intersection must be equal to the * source space and the projection must be equal to the destination space */ if (H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_ALL) { /* Copy the destination selection. */ if (H5S_select_copy(new_space, dst_space, FALSE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination space selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, "can't copy destination space selection"); } /* end if */ /* If any of the selections contain no elements, the projection must be * "none" */ @@ -2594,7 +2454,7 @@ H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i (H5S_GET_SELECT_NPOINTS(dst_space) == 0)) { /* Change to "none" selection */ if (H5S_select_none(new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); } /* end if */ else { /* Handle scalar dataspaces. It should not be possible for the source @@ -2603,8 +2463,8 @@ H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i * covered above, and the source intersect space must have the same * rank, so it also cannot be scalar, as scalar dataspaces have a rank * of 0. */ - HDassert(H5S_GET_EXTENT_TYPE(src_space) != H5S_SCALAR); - HDassert(H5S_GET_EXTENT_TYPE(src_intersect_space) != H5S_SCALAR); + assert(H5S_GET_EXTENT_TYPE(src_space) != H5S_SCALAR); + assert(H5S_GET_EXTENT_TYPE(src_intersect_space) != H5S_SCALAR); /* Check for scalar dst_space. In this case we simply check if the * (single) point selected in src_space intersects src_intersect_space, @@ -2616,21 +2476,21 @@ H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i /* Get source space bounds. Should be a single point. */ if (H5S_SELECT_BOUNDS(src_space, coords_start, coords_end) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source space bounds") - HDassert(0 == HDmemcmp(coords_start, coords_end, - H5S_GET_EXTENT_NDIMS(src_space) * sizeof(coords_start[0]))); + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "can't get source space bounds"); + assert(0 == memcmp(coords_start, coords_end, + H5S_GET_EXTENT_NDIMS(src_space) * sizeof(coords_start[0]))); /* Check for intersection */ if ((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords_start, coords_end)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection"); /* Select all or none as appropriate */ if (intersect) { if (H5S_select_all(new_space, TRUE) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't select all") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't select all"); } /* end if */ else if (H5S_select_none(new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); } /* end if */ else { /* If the source intersect space is a point selection, convert it to a @@ -2645,11 +2505,11 @@ H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i /* Create dataspace and copy extent */ if (NULL == (tmp_src_intersect_space = H5S_create(H5S_SIMPLE))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, - "unable to create temporary source intersect dataspace") + "unable to create temporary source intersect dataspace"); if (H5S__extent_copy_real(&tmp_src_intersect_space->extent, &src_intersect_space->extent, FALSE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOPY, FAIL, - "unable to copy source intersect space extent") + "unable to copy source intersect space extent"); /* Iterate over points */ for (curr_pnt = src_intersect_space->select.sel_info.pnt_lst->head; curr_pnt; @@ -2658,7 +2518,7 @@ H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i if (H5S_hyper_add_span_element(tmp_src_intersect_space, src_intersect_space->extent.rank, curr_pnt->pnt) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, - "can't add point to temporary dataspace selection") + "can't add point to temporary dataspace selection"); /* Redirect local src_intersect_space pointer (will not affect * calling function) */ @@ -2666,7 +2526,7 @@ H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i } /* end for */ /* By this point, src_intersect_space must be a hyperslab selection */ - HDassert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); + assert(H5S_GET_SELECT_TYPE(src_intersect_space) == H5S_SEL_HYPERSLABS); /* If either the source space or the destination space is a point * selection, iterate element by element */ @@ -2677,60 +2537,60 @@ H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i /* Start with "none" selection */ if (H5S_select_none(new_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); /* Initialize iterators */ if (H5S_select_iter_init(ss_iter, src_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, - "can't initialize source space selection iterator") + "can't initialize source space selection iterator"); ss_iter_init = TRUE; if (H5S_select_iter_init(ds_iter, dst_space, 1, H5S_SEL_ITER_SHARE_WITH_DATASPACE) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, - "can't initialize destination space selection iterator") + "can't initialize destination space selection iterator"); ds_iter_init = TRUE; /* Iterate over points */ do { - HDassert(ss_iter->elmt_left > 0); - HDassert(ss_iter->elmt_left > 0); + assert(ss_iter->elmt_left > 0); + assert(ss_iter->elmt_left > 0); /* Get SS coords */ if (H5S_SELECT_ITER_COORDS(ss_iter, coords) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, - "can't get source selection coordinates") + "can't get source selection coordinates"); /* Check for intersection */ if ((intersect = H5S_SELECT_INTERSECT_BLOCK(src_intersect_space, coords, coords)) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCOMPARE, FAIL, "can't check for intersection"); /* Add point if it intersects */ if (intersect) { /* Get DS coords */ if (H5S_SELECT_ITER_COORDS(ds_iter, coords) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, - "can't get destination selection coordinates") + "can't get destination selection coordinates"); /* Add point to new_space */ if (H5S_select_elements(new_space, H5S_SELECT_APPEND, 1, coords) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, - "can't add point to new selection") + "can't add point to new selection"); } /* end if */ /* Advance iterators */ if (H5S_SELECT_ITER_NEXT(ss_iter, 1) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, - "can't advacne source selection iterator") + "can't advacne source selection iterator"); ss_iter->elmt_left--; if (H5S_SELECT_ITER_NEXT(ds_iter, 1) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, - "can't advacne destination selection iterator") + "can't advacne destination selection iterator"); ds_iter->elmt_left--; } while (ss_iter->elmt_left > 0); - HDassert(H5S_SELECT_ITER_NELMTS(ds_iter) == 0); + assert(H5S_SELECT_ITER_NELMTS(ds_iter) == 0); } /* end if */ else { - HDassert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE); - HDassert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_NONE); + assert(H5S_GET_SELECT_TYPE(src_space) != H5S_SEL_NONE); + assert(H5S_GET_SELECT_TYPE(dst_space) != H5S_SEL_NONE); /* Source and destination selections are all or hyperslab, * intersecting selection is hyperslab. Call the hyperslab routine @@ -2738,7 +2598,7 @@ H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i if (H5S__hyper_project_intersection(src_space, dst_space, src_intersect_space, new_space, share_selection) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, - "can't project hyperslab onto destination selection") + "can't project hyperslab onto destination selection"); } /* end else */ } /* end else */ } /* end else */ @@ -2750,15 +2610,15 @@ H5S_select_project_intersection(H5S_t *src_space, H5S_t *dst_space, H5S_t *src_i /* Cleanup on error */ if (ret_value < 0) if (new_space && H5S_close(new_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); /* General cleanup */ if (tmp_src_intersect_space && H5S_close(tmp_src_intersect_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release temporary dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release temporary dataspace"); if (ss_iter_init && H5S_SELECT_ITER_RELEASE(ss_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release source selection iterator") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release source selection iterator"); if (ds_iter_init && H5S_SELECT_ITER_RELEASE(ds_iter) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release destination selection iterator") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release destination selection iterator"); ss_iter = H5FL_FREE(H5S_sel_iter_t, ss_iter); ds_iter = H5FL_FREE(H5S_sel_iter_t, ds_iter); @@ -2810,35 +2670,35 @@ H5Sselect_project_intersection(hid_t src_space_id, hid_t dst_space_id, hid_t src /* Check args */ if (NULL == (src_space = (H5S_t *)H5I_object_verify(src_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace"); if (NULL == (dst_space = (H5S_t *)H5I_object_verify(dst_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace"); if (NULL == (src_intersect_space = (H5S_t *)H5I_object_verify(src_intersect_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace"); /* Check numbers of points selected matches in source and destination */ if (H5S_GET_SELECT_NPOINTS(src_space) != H5S_GET_SELECT_NPOINTS(dst_space)) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, - "number of points selected in source space does not match that in destination space") + "number of points selected in source space does not match that in destination space"); /* Check numbers of dimensions matches in source and source intersect spaces */ if (H5S_GET_EXTENT_NDIMS(src_space) != H5S_GET_EXTENT_NDIMS(src_intersect_space)) HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, - "rank of source space does not match rank of source intersect space") + "rank of source space does not match rank of source intersect space"); /* Perform operation */ if (H5S_select_project_intersection(src_space, dst_space, src_intersect_space, &proj_space, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project dataspace intersection") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project dataspace intersection"); /* Register */ if ((ret_value = H5I_register(H5I_DATASPACE, proj_space, TRUE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); done: if (ret_value < 0) if (proj_space && H5S_close(proj_space) < 0) - HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace") + HDONE_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, "unable to release dataspace"); FUNC_LEAVE_API(ret_value) } /* end H5Sselect_project_intersection() */ @@ -2876,8 +2736,8 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(space); - HDassert(subtract_space); + assert(space); + assert(subtract_space); /* If either space is using the none selection, then we do not need to do * anything */ @@ -2886,12 +2746,12 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space) if (subtract_space->select.type->type == H5S_SEL_ALL) { /* Change to "none" selection */ if (H5S_select_none(space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection"); } /* end if */ /* If either selection is a point selection, fail currently */ else if ((subtract_space->select.type->type == H5S_SEL_POINTS) || (space->select.type->type == H5S_SEL_POINTS)) { - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported") + HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, "point selections not currently supported"); } /* end if */ else { /* Check for all selection in space, convert to hyperslab */ @@ -2915,15 +2775,15 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space) /* Convert to hyperslab selection */ if (H5S_select_hyperslab(space, H5S_SELECT_SET, tmp_start, tmp_stride, tmp_count, tmp_block) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSELECT, FAIL, "can't convert selection"); } /* end if */ - HDassert(space->select.type->type == H5S_SEL_HYPERSLABS); - HDassert(subtract_space->select.type->type == H5S_SEL_HYPERSLABS); + assert(space->select.type->type == H5S_SEL_HYPERSLABS); + assert(subtract_space->select.type->type == H5S_SEL_HYPERSLABS); /* Both spaces are now hyperslabs, perform the operation */ if (H5S__modify_select(space, H5S_SELECT_NOTB, subtract_space) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't subtract hyperslab") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCLIP, FAIL, "can't subtract hyperslab"); } /* end else */ } /* end if */ @@ -2945,7 +2805,6 @@ H5S_select_subtract(H5S_t *space, H5S_t *subtract_space) Creates a selection iterator and initializes it to start at the first element selected in the dataspace. PROGRAMMER - Quincey Koziol - February 11, 2019 GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -2963,27 +2822,27 @@ H5Ssel_iter_create(hid_t space_id, size_t elmt_size, unsigned flags) /* Check args */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace"); if (elmt_size == 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, H5I_INVALID_HID, "element size must be greater than 0") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, H5I_INVALID_HID, "element size must be greater than 0"); if (flags != (flags & H5S_SEL_ITER_ALL_PUBLIC_FLAGS)) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, H5I_INVALID_HID, "invalid selection iterator flag") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, H5I_INVALID_HID, "invalid selection iterator flag"); /* Allocate the iterator */ if (NULL == (sel_iter = H5FL_MALLOC(H5S_sel_iter_t))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate selection iterator"); /* Add flag to indicate that this iterator is from an API call */ flags |= H5S_SEL_ITER_API_CALL; /* Initialize the selection iterator */ if (H5S_select_iter_init(sel_iter, space, elmt_size, flags) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to initialize selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, H5I_INVALID_HID, "unable to initialize selection iterator"); /* Register */ if ((ret_value = H5I_register(H5I_SPACE_SEL_ITER, sel_iter, TRUE)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTREGISTER, H5I_INVALID_HID, - "unable to register dataspace selection iterator ID") + "unable to register dataspace selection iterator ID"); done: FUNC_LEAVE_API(ret_value) @@ -2998,9 +2857,9 @@ H5Ssel_iter_create(hid_t space_id, size_t elmt_size, unsigned flags) herr_t H5Ssel_iter_get_seq_list(sel_iter_id, maxseq, maxbytes, nseq, nbytes, off, len) hid_t sel_iter_id; IN: ID of the dataspace selection iterator to retrieve sequence from size_t maxseq; IN: Max. # of sequences to retrieve - size_t maxbytes; IN: Max. # of bytes to retrieve in sequences + size_t maxelmts; IN: Max. # of elements to retrieve in sequences size_t *nseq; OUT: # of sequences retrieved - size_t *nbytes; OUT: # of bytes retrieved, in all sequences + size_t *nelmts; OUT: # of elements retrieved, in all sequences hsize_t *off; OUT: Array of sequence offsets size_t *len; OUT: Array of sequence lengths RETURNS @@ -3015,8 +2874,8 @@ H5Ssel_iter_create(hid_t space_id, size_t elmt_size, unsigned flags) selections is "in order selected", unless the H5S_SEL_ITER_GET_SEQ_LIST_SORTED flag is passed to H5Sset_iter_create for a point selection. - MAXSEQ and MAXBYTES specify the most sequences or bytes possible to - place into the OFF and LEN arrays. *NSEQ and *NBYTES return the actual + MAXSEQ and MAXELMTS specify the most sequences or bytes possible to + place into the OFF and LEN arrays. *NSEQ and *NELMTS return the actual number of sequences and bytes put into the arrays. Each call to H5Ssel_iter_get_seq_list() will retrieve the next set @@ -3027,48 +2886,124 @@ H5Ssel_iter_create(hid_t space_id, size_t elmt_size, unsigned flags) of elements selected in the dataspace the iterator was created from (which can be retrieved with H5Sget_select_npoints). When there are no further sequences of elements to retrieve, calls to this routine will - set *NSEQ and *NBYTES to zero. + set *NSEQ and *NELMTS to zero. PROGRAMMER - Quincey Koziol - February 11, 2019 GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxbytes, size_t *nseq /*out*/, - size_t *nbytes /*out*/, hsize_t *off /*out*/, size_t *len /*out*/) +H5Ssel_iter_get_seq_list(hid_t sel_iter_id, size_t maxseq, size_t maxelmts, size_t *nseq /*out*/, + size_t *nelmts /*out*/, hsize_t *off /*out*/, size_t *len /*out*/) { H5S_sel_iter_t *sel_iter; /* Dataspace selection iterator to operate on */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "izzxxxx", sel_iter_id, maxseq, maxbytes, nseq, nbytes, off, len); + H5TRACE7("e", "izzxxxx", sel_iter_id, maxseq, maxelmts, nseq, nelmts, off, len); /* Check args */ if (NULL == (sel_iter = (H5S_sel_iter_t *)H5I_object_verify(sel_iter_id, H5I_SPACE_SEL_ITER))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace selection iterator"); if (NULL == nseq) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "'nseq' pointer is NULL") - if (NULL == nbytes) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "'nbytes' pointer is NULL") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "'nseq' pointer is NULL"); + if (NULL == nelmts) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "'nbytes' pointer is NULL"); if (NULL == off) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "offset array pointer is NULL") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "offset array pointer is NULL"); if (NULL == len) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "length array pointer is NULL") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "length array pointer is NULL"); /* Get the sequences of bytes */ - if (maxseq > 0 && maxbytes > 0 && sel_iter->elmt_left > 0) { - if (H5S_SELECT_ITER_GET_SEQ_LIST(sel_iter, maxseq, maxbytes, nseq, nbytes, off, len) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "sequence length generation failed") + if (maxseq > 0 && maxelmts > 0 && sel_iter->elmt_left > 0) { + if (H5S_SELECT_ITER_GET_SEQ_LIST(sel_iter, maxseq, maxelmts, nseq, nelmts, off, len) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTGET, FAIL, "sequence length generation failed"); } /* end if */ else - *nseq = *nbytes = 0; + *nseq = *nelmts = 0; done: FUNC_LEAVE_API(ret_value) } /* end H5Ssel_iter_get_seq_list() */ +/*-------------------------------------------------------------------------- + NAME + H5S_select_contig_block + + PURPOSE + Determines if a selection is a single contiguous block, and returns the + offset and length (in elements) if it is + + USAGE + herr_t H5S_select_contig_block(space, is_contig, off, len) + H5S_t *space; IN: Selection to check + hbool_t *is_contig; OUT: Whether the selection is contiguous + hsize_t *off; OUT: Offset of selection + size_t *len; OUT: Length of selection + + RETURNS + Non-negative on success/Negative on failure. + + DESCRIPTION + Determines if a selection is a single contiguous block, and returns the + offset and length (in elements) if it is. + + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5S_select_contig_block(H5S_t *space, hbool_t *is_contig, hsize_t *off, size_t *len) +{ + H5S_sel_iter_t *iter = NULL; /* Selection iterator */ + hbool_t iter_init = FALSE; /* Selection iteration info has been initialized */ + size_t nseq_tmp; + size_t nelem_tmp; + hsize_t sel_off; + size_t sel_len; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + assert(space); + + /* Allocate and initialize the iterator */ + if (NULL == (iter = H5FL_MALLOC(H5S_sel_iter_t))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate iterator"); + if (H5S_select_iter_init(iter, space, 1, 0) < 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to initialize memory selection information"); + iter_init = TRUE; + + /* Get list of sequences for selection, to check if it is contiguous */ + if (H5S_SELECT_ITER_GET_SEQ_LIST(iter, (size_t)1, (size_t)-1, &nseq_tmp, &nelem_tmp, &sel_off, &sel_len) < + 0) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTNEXT, FAIL, "sequence length generation failed"); + + /* If the first sequence includes all the elements selected in this piece, it it contiguous */ + H5_CHECK_OVERFLOW(space->select.num_elem, hsize_t, size_t); + if (sel_len == (size_t)space->select.num_elem) { + if (is_contig) + *is_contig = TRUE; + if (off) + *off = sel_off; + if (len) + *len = sel_len; + } + else if (is_contig) + *is_contig = FALSE; + +done: + if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator"); + if (iter) + iter = H5FL_FREE(H5S_sel_iter_t, iter); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5S_select_contig_block() */ + /*-------------------------------------------------------------------------- NAME H5Ssel_iter_reset @@ -3102,18 +3037,18 @@ H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id) /* Check args */ if (NULL == (sel_iter = (H5S_sel_iter_t *)H5I_object_verify(sel_iter_id, H5I_SPACE_SEL_ITER))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace selection iterator"); if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace"); /* Call selection type-specific release routine */ if (H5S_SELECT_ITER_RELEASE(sel_iter) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, - "problem releasing a selection iterator's type-specific info") + "problem releasing a selection iterator's type-specific info"); /* Simply re-initialize iterator */ if (H5S_select_iter_init(sel_iter, space, sel_iter->elmt_size, sel_iter->flags) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to re-initialize selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to re-initialize selection iterator"); done: FUNC_LEAVE_API(ret_value) @@ -3126,9 +3061,6 @@ H5Ssel_iter_reset(hid_t sel_iter_id, hid_t space_id) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, April 8, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -3140,7 +3072,7 @@ H5S__sel_iter_close_cb(H5S_sel_iter_t *_sel_iter, void H5_ATTR_UNUSED **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(sel_iter); + assert(sel_iter); /* Close the selection iterator object */ if (H5S_sel_iter_close(sel_iter) < 0) @@ -3157,9 +3089,6 @@ H5S__sel_iter_close_cb(H5S_sel_iter_t *_sel_iter, void H5_ATTR_UNUSED **request) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Monday, February 11, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -3170,12 +3099,12 @@ H5S_sel_iter_close(H5S_sel_iter_t *sel_iter) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(sel_iter); + assert(sel_iter); /* Call selection type-specific release routine */ if (H5S_SELECT_ITER_RELEASE(sel_iter) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTRELEASE, FAIL, - "problem releasing a selection iterator's type-specific info") + "problem releasing a selection iterator's type-specific info"); /* Release the structure */ sel_iter = H5FL_FREE(H5S_sel_iter_t, sel_iter); @@ -3197,7 +3126,6 @@ H5S_sel_iter_close(H5S_sel_iter_t *sel_iter) DESCRIPTION Close a dataspace selection iterator, releasing its state. PROGRAMMER - Quincey Koziol - February 11, 2019 GLOBAL VARIABLES COMMENTS, BUGS, ASSUMPTIONS EXAMPLES @@ -3213,11 +3141,11 @@ H5Ssel_iter_close(hid_t sel_iter_id) /* Check args */ if (NULL == H5I_object_verify(sel_iter_id, H5I_SPACE_SEL_ITER)) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace selection iterator") + HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "not a dataspace selection iterator"); /* When the reference count reaches zero the resources are freed */ if (H5I_dec_app_ref(sel_iter_id) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing dataspace selection iterator ID") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDEC, FAIL, "problem freeing dataspace selection iterator ID"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Stest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Stest.c index 791d652845..e5888ef95d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Stest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Stest.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,9 +10,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* Programmer: Quincey Koziol - * Saturday, May 31, 2003 - * +/* * Purpose: Dataspace selection testing functions. */ @@ -88,12 +85,12 @@ H5S__get_rebuild_status_test(hid_t space_id, H5S_diminfo_valid_t *status1, H5S_d FUNC_ENTER_PACKAGE - HDassert(status1); - HDassert(status2); + assert(status1); + assert(status2); /* Get dataspace structures */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); *status1 = space->select.sel_info.hslab->diminfo_valid; @@ -135,11 +132,11 @@ H5S__get_diminfo_status_test(hid_t space_id, H5S_diminfo_valid_t *status) FUNC_ENTER_PACKAGE - HDassert(status); + assert(status); /* Get dataspace structures */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); *status = space->select.sel_info.hslab->diminfo_valid; @@ -175,7 +172,7 @@ H5S__check_spans_tail_ptr(const H5S_hyper_span_info_t *span_lst) FUNC_ENTER_PACKAGE - HDassert(span_lst); + assert(span_lst); cur_elem = span_lst->head; while (cur_elem) { @@ -185,13 +182,13 @@ H5S__check_spans_tail_ptr(const H5S_hyper_span_info_t *span_lst) if (NULL != cur_elem->down) if ((ret_value = H5S__check_spans_tail_ptr(cur_elem->down)) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, - "the selection has inconsistent tail pointers") + "the selection has inconsistent tail pointers"); cur_elem = cur_elem->next; } /* end while */ if (actual_tail != span_lst->tail) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, - "the selection has inconsistent tail pointers") + "the selection has inconsistent tail pointers"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -224,7 +221,7 @@ H5S__check_points_tail_ptr(const H5S_pnt_list_t *pnt_lst) FUNC_ENTER_PACKAGE - HDassert(pnt_lst); + assert(pnt_lst); cur_elem = pnt_lst->head; while (cur_elem) { @@ -233,7 +230,7 @@ H5S__check_points_tail_ptr(const H5S_pnt_list_t *pnt_lst) } /* end while */ if (actual_tail != pnt_lst->tail) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, - "the selection has inconsistent tail pointers") + "the selection has inconsistent tail pointers"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -269,7 +266,7 @@ H5S__check_internal_consistency(const H5S_t *space) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(space); + assert(space); if (space->select.type->type == H5S_SEL_NONE) HGOTO_DONE(ret_value); @@ -282,7 +279,7 @@ H5S__check_internal_consistency(const H5S_t *space) /* Check the bound box */ if (H5S_get_select_bounds(space, low_bounds, high_bounds) < 0) - HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the bound box could not be retrieved") + HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, "the bound box could not be retrieved"); if (space->select.type->type == H5S_SEL_HYPERSLABS) { H5S_hyper_sel_t *hslab = space->select.sel_info.hslab; @@ -292,11 +289,11 @@ H5S__check_internal_consistency(const H5S_t *space) if ((hsize_t)((hssize_t)hslab->diminfo.low_bounds[u] + space->select.offset[u]) != low_bounds[u]) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, - "the lower bound box of the selection is inconsistent") + "the lower bound box of the selection is inconsistent"); if ((hsize_t)((hssize_t)hslab->diminfo.high_bounds[u] + space->select.offset[u]) != high_bounds[u]) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, - "the higher bound box of the selection is inconsistent") + "the higher bound box of the selection is inconsistent"); } /* end for */ } /* end if */ else { @@ -304,11 +301,11 @@ H5S__check_internal_consistency(const H5S_t *space) if ((hsize_t)((hssize_t)hslab->span_lst->low_bounds[u] + space->select.offset[u]) != low_bounds[u]) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, - "the lower bound box of the selection is inconsistent") + "the lower bound box of the selection is inconsistent"); if ((hsize_t)((hssize_t)hslab->span_lst->high_bounds[u] + space->select.offset[u]) != high_bounds[u]) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, - "the higher bound box of the selection is inconsistent") + "the higher bound box of the selection is inconsistent"); } /* end for */ } /* end else */ @@ -316,7 +313,7 @@ H5S__check_internal_consistency(const H5S_t *space) if ((NULL != hslab) && (NULL != hslab->span_lst)) if (H5S__check_spans_tail_ptr(hslab->span_lst) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, - "the selection has inconsistent tail pointers") + "the selection has inconsistent tail pointers"); } /* end if */ else if (space->select.type->type == H5S_SEL_POINTS) { H5S_pnt_list_t *pnt_lst = space->select.sel_info.pnt_lst; @@ -324,7 +321,7 @@ H5S__check_internal_consistency(const H5S_t *space) if (NULL != pnt_lst) if (H5S__check_points_tail_ptr(pnt_lst) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, - "the selection has inconsistent tail pointers") + "the selection has inconsistent tail pointers"); } /* end else-if */ done: @@ -360,12 +357,12 @@ H5S__internal_consistency_test(hid_t space_id) /* Get dataspace structures */ if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Check if the dataspace selections are the same shape */ if (FAIL == H5S__check_internal_consistency(space)) HGOTO_ERROR(H5E_DATASPACE, H5E_INCONSISTENTSTATE, FAIL, - "The dataspace has inconsistent internal state") + "The dataspace has inconsistent internal state"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5StrType.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5StrType.cpp deleted file mode 100644 index 57bb2c96fc..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5StrType.cpp +++ /dev/null @@ -1,317 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5DxferProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5AtomType.h" -#include "H5AbstractDs.h" -#include "H5DataSpace.h" -#include "H5StrType.h" -#include "H5DataSet.h" -#include "H5PredType.h" - -namespace H5 { - -//-------------------------------------------------------------------------- -// Function: StrType default constructor -///\brief Default constructor: Creates a stub string datatype -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -StrType::StrType() : AtomType() -{ -} - -//-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Creates a string datatype using a predefined type. -///\param pred_type - IN: Predefined datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -StrType::StrType(const PredType &pred_type) : AtomType() -{ - // use DataType::copy to make a copy of this predefined type - copy(pred_type); -} - -//-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -// Purpose Creates a string datatype with a specified length -// Param pred_type - IN: String predefined type to replicate. -// Param size - IN: Length of the new string type -// Exception H5::DataTypeIException -// Description -// The 1st argument could have been skipped, but this -// constructor will collide with the one that takes an -// existing id. -// -// Update: replacing the 1st argument with a dummy 0 to -// avoid the clashing problem, that doesn't eliminate the -// the 1st argument but it's simpler for the user to type -// a '0' than PredType::C_S1. - Dec 2, 2005 -// Note -// The use of this constructor can be shortened by using -// its overloaded below as StrType(0, size). -// Programmer Binh-Minh Ribler - 2000 -// Modification -// Planned for removal. -BMR, 2005/12/02 -// Removed from documentation. -BMR, 2016/03/07 -//-------------------------------------------------------------------------- -StrType::StrType(const PredType &pred_type, const size_t &size) : AtomType() -{ - // use DataType::copy to make a copy of the string predefined type - // then set its length - copy(pred_type); - setSize(size); -} - -//-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Creates a string datatype with a specified length -///\param dummy - IN: To simplify calling the previous constructor -/// and avoid prototype clash with another constructor -///\param size - IN: Length of the new string type -///\exception H5::DataTypeIException -///\par Description -/// The 1st argument is just a dummy to simplify calling the -/// previous constructor, such as: -/// StrType atype(0, size) instead of -/// StrType atype(PredType::C_S1, size) -// Note -// This constructor replaced the previous one. -// Programmer Binh-Minh Ribler - Nov 28, 2005 -//-------------------------------------------------------------------------- -StrType::StrType(const int dummy, const size_t &size) : AtomType() -{ - // Unused - (void)dummy; - - // use DataType::copy to make a copy of the string predefined type - // then set its length - copy(PredType::C_S1); - setSize(size); -} - -//-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Creates an StrType object using the id of an existing datatype. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -StrType::StrType(const hid_t existing_id) : AtomType(existing_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: StrType copy constructor -///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -StrType::StrType(const StrType &original) : AtomType(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Gets the string datatype of the specified dataset -///\param dataset - IN: Dataset that this string datatype associates with -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -StrType::StrType(const DataSet &dataset) : AtomType() -{ - // Calls C function H5Dget_type to get the id of the datatype - id = H5Dget_type(dataset.getId()); - - if (id < 0) { - throw DataSetIException("StrType constructor", "H5Dget_type failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Creates an StrType instance by opening an HDF5 string datatype -/// given its name, provided as a C character string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: String type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openStrType(const char*) to -// improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -StrType::StrType(const H5Location &loc, const char *dtype_name) : AtomType() -{ - id = p_opentype(loc, dtype_name); -} - -//-------------------------------------------------------------------------- -// Function: StrType overloaded constructor -///\brief Creates an StrType instance by opening an HDF5 string datatype -/// given its name, provided as an \c H5std_string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: String type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openStrType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -StrType::StrType(const H5Location &loc, const H5std_string &dtype_name) : AtomType() -{ - id = p_opentype(loc, dtype_name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: StrType::decode -///\brief Returns an StrType object via DataType* by decoding the -/// binary object description of this type. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -DataType * -StrType::decode() const -{ - hid_t encoded_strtype_id = H5I_INVALID_HID; - try { - encoded_strtype_id = p_decode(); - } - catch (DataTypeIException &err) { - throw; - } - StrType *encoded_strtype = new StrType; - encoded_strtype->p_setId(encoded_strtype_id); - return (encoded_strtype); -} - -//-------------------------------------------------------------------------- -// Function: StrType::getCset -///\brief Retrieves the character set type of this string datatype. -///\return Character set type, which can be: -/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII. -///\note -/// ASCII and UTF-8 Unicode are the only currently supported character -/// encodings. Extended ASCII encodings (for example, ISO 8859) are not -/// supported. This encoding policy is not enforced by the HDF5 Library. -/// Using encodings other than ASCII and UTF-8 can lead to compatibility -/// and usability problems. See the C API entry H5Pset_char_encoding for -/// more information. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5T_cset_t -StrType::getCset() const -{ - H5T_cset_t cset = H5Tget_cset(id); - - // Returns a valid character set type if successful - if (cset == H5T_CSET_ERROR) { - throw DataTypeIException("StrType::getCset", "H5Tget_cset failed"); - } - return (cset); -} - -//-------------------------------------------------------------------------- -// Function: StrType::setCset -///\brief Sets character set to be used. -///\param cset - IN: character set type, which can be: -/// \li \c H5T_CSET_ASCII (0) - Character set is US ASCII. -///\note -/// ASCII and UTF-8 Unicode are the only currently supported character -/// encodings. Extended ASCII encodings (for example, ISO 8859) are not -/// supported. This encoding policy is not enforced by the HDF5 Library. -/// Using encodings other than ASCII and UTF-8 can lead to compatibility -/// and usability problems. See the C API entry H5Pset_char_encoding for -/// more information. -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -StrType::setCset(H5T_cset_t cset) const -{ - herr_t ret_value = H5Tset_cset(id, cset); - if (ret_value < 0) { - throw DataTypeIException("StrType::setCset", "H5Tset_cset failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: StrType::getStrpad -///\brief Retrieves the storage mechanism for of this string datatype. -///\return String storage mechanism, which can be: -/// \li \c H5T_STR_NULLTERM (0) - Null terminate (as C does) -/// \li \c H5T_STR_NULLPAD (0) - Pad with zeros -/// \li \c H5T_STR_SPACEPAD (0) - pad with spaces (as FORTRAN does) -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -H5T_str_t -StrType::getStrpad() const -{ - H5T_str_t strpad = H5Tget_strpad(id); - - // Returns a valid string padding type if successful - if (strpad == H5T_STR_ERROR) { - throw DataTypeIException("StrType::getStrpad", "H5Tget_strpad failed - returned H5T_STR_ERROR"); - } - return (strpad); -} - -//-------------------------------------------------------------------------- -// Function: StrType::setStrpad -///\brief Defines the storage mechanism for this string datatype. -///\param strpad - IN: String padding type -///\exception H5::DataTypeIException -///\par Description -/// For information, please refer to the H5Tset_strpad API in -/// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -void -StrType::setStrpad(H5T_str_t strpad) const -{ - herr_t ret_value = H5Tset_strpad(id, strpad); - if (ret_value < 0) { - throw DataTypeIException("StrType::setStrpad", "H5Tset_strpad failed"); - } -} - -//-------------------------------------------------------------------------- -// Function: StrType destructor -///\brief Properly terminates access to this string datatype. -// Programmer Binh-Minh Ribler - 2000 -//-------------------------------------------------------------------------- -StrType::~StrType() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5T.c b/externals/coda-oss/modules/drivers/hdf5/source/H5T.c index 8bbd095d59..1c5c3f58ff 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5T.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5T.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -302,14 +301,14 @@ { \ /* Base off of existing datatype */ \ if (NULL == (dt = H5T_copy(BASE, H5T_COPY_TRANSIENT))) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "duplicating base type failed") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "duplicating base type failed"); \ } #define H5T_INIT_TYPE_ALLOC_CREATE(BASE) \ { \ /* Allocate new datatype info */ \ if (NULL == (dt = H5T__alloc())) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed"); \ } #define H5T_INIT_TYPE(GUTS, GLOBAL, CRT_TMPL, BASE, SIZE_TMPL, SIZE) \ @@ -328,7 +327,7 @@ \ /* Register result */ \ if (((GLOBAL) = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom"); \ } /******************/ @@ -592,9 +591,6 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{ * Return: Success: non-negative * Failure: negative * - * Programmer: Quincey Koziol - * Saturday, November 22, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -611,12 +607,12 @@ H5T__init_inf(void) /* Get the float datatype */ if (NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); dst = &dst_p->shared->u.atomic; /* Check that we can re-order the bytes correctly */ if (H5T_ORDER_LE != H5T_native_order_g && H5T_ORDER_BE != H5T_native_order_g) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); /* +Inf */ d = (uint8_t *)&H5T_NATIVE_FLOAT_POS_INF_g; @@ -652,12 +648,12 @@ H5T__init_inf(void) /* Get the double datatype */ if (NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); dst = &dst_p->shared->u.atomic; /* Check that we can re-order the bytes correctly */ if (H5T_ORDER_LE != H5T_native_order_g && H5T_ORDER_BE != H5T_native_order_g) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); /* +Inf */ d = (uint8_t *)&H5T_NATIVE_DOUBLE_POS_INF_g; @@ -750,7 +746,7 @@ H5T_init(void) /* Initialize the ID group for the file IDs */ if (H5I_register_type(H5I_DATATYPE_CLS) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface"); /* Make certain there aren't too many classes of datatypes defined */ /* Only 16 (numbered 0-15) are supported in the current file format */ @@ -761,38 +757,39 @@ H5T_init(void) * the library configuration by H5detect. */ if (H5T__init_native() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize interface"); + /* Initialize all other native types */ if (H5T__init_native_internal() < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize integers") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize integers"); /* Get the atomic datatype structures needed by the initialization code below */ if (NULL == (native_schar = (H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_uchar = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_short = (H5T_t *)H5I_object(H5T_NATIVE_SHORT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_ushort = (H5T_t *)H5I_object(H5T_NATIVE_USHORT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_int = (H5T_t *)H5I_object(H5T_NATIVE_INT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_uint = (H5T_t *)H5I_object(H5T_NATIVE_UINT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_long = (H5T_t *)H5I_object(H5T_NATIVE_LONG_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_ulong = (H5T_t *)H5I_object(H5T_NATIVE_ULONG_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_llong = (H5T_t *)H5I_object(H5T_NATIVE_LLONG_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_ullong = (H5T_t *)H5I_object(H5T_NATIVE_ULLONG_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_float = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_double = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (NULL == (native_ldouble = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); /*------------------------------------------------------------ * Derived native types @@ -995,19 +992,19 @@ H5T_init(void) /* Deprecated object reference type */ H5T_INIT_TYPE(OBJREF, H5T_STD_REF_OBJ_g, ALLOC, -, NOSET, -) if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); objref = dt; /* Keep type for later */ /* Deprecated region reference type */ H5T_INIT_TYPE(REGREF, H5T_STD_REF_DSETREG_g, ALLOC, -, NOSET, -) if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); regref = dt; /* Keep type for later */ /* Opaque reference type */ H5T_INIT_TYPE(REF, H5T_STD_REF_g, ALLOC, -, NOSET, -) if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); ref = dt; /* Keep type for later */ /* @@ -1017,13 +1014,13 @@ H5T_init(void) fixedpt = native_int; floatpt = native_float; if (NULL == (compound = H5T__create(H5T_COMPOUND, (size_t)1))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (NULL == (enum_type = H5T__create(H5T_ENUM, (size_t)1))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (NULL == (vlen = H5T__vlen_create(native_int))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (NULL == (array = H5T__array_create(native_int, 1, dim))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); status = 0; status |= H5T__register_int(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i); @@ -1386,7 +1383,7 @@ H5T_init(void) status |= H5T__init_inf(); if (status < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function(s)") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to register conversion function(s)"); /* Register datatype creation property class properties here. See similar * code in H5D_init(), etc. for example. @@ -1395,11 +1392,11 @@ H5T_init(void) /* Only register the default property list if it hasn't been created yet */ if (H5P_LST_DATATYPE_CREATE_ID_g == (-1)) { /* ========== Datatype Creation Property Class Initialization ============*/ - HDassert(H5P_CLS_DATATYPE_CREATE_g != NULL); + assert(H5P_CLS_DATATYPE_CREATE_g != NULL); /* Register the default datatype creation property list */ if ((H5P_LST_DATATYPE_CREATE_ID_g = H5P_create_id(H5P_CLS_DATATYPE_CREATE_g, FALSE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class") + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "can't insert property into class"); } /* end if */ done: @@ -1421,7 +1418,7 @@ H5T_init(void) (void)H5T_close_real(dt); else { if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object"); dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); dt = H5FL_FREE(H5T_t, dt); } /* end else */ @@ -1440,9 +1437,6 @@ H5T_init(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, April 27, 1998 - * *------------------------------------------------------------------------- */ static int @@ -1453,8 +1447,8 @@ H5T__unlock_cb(void *_dt, hid_t H5_ATTR_UNUSED id, void *_udata) FUNC_ENTER_PACKAGE_NOERR - HDassert(dt); - HDassert(dt->shared); + assert(dt); + assert(dt->shared); if (H5T_STATE_IMMUTABLE == dt->shared->state) { dt->shared->state = H5T_STATE_RDONLY; @@ -1473,9 +1467,6 @@ H5T__unlock_cb(void *_dt, hid_t H5_ATTR_UNUSED id, void *_udata) * change in some other interface; zero otherwise. * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, September 10, 2015 - * *------------------------------------------------------------------------- */ int @@ -1493,7 +1484,7 @@ H5T_top_term_package(void) H5T_path_t *path; path = H5T_g.path[i]; - HDassert(path); + assert(path); if (path->conv.u.app_func) { H5T__print_stats(path, &nprint /*in,out*/); path->cdata.command = H5T_CONV_FREE; @@ -1502,11 +1493,11 @@ H5T_top_term_package(void) (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { - HDfprintf(H5DEBUG(T), - "H5T: conversion function " - "0x%08lx failed to free private data for " - "%s (ignored)\n", - (unsigned long)(path->conv.u.app_func), path->name); + fprintf(H5DEBUG(T), + "H5T: conversion function " + "0x%016zx failed to free private data for " + "%s (ignored)\n", + (size_t)path->conv.u.app_func, path->name); } /* end if */ #endif H5E_clear_stack(NULL); /*ignore the error*/ @@ -1517,11 +1508,11 @@ H5T_top_term_package(void) (size_t)0, (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { - HDfprintf(H5DEBUG(T), - "H5T: conversion function " - "0x%08lx failed to free private data for " - "%s (ignored)\n", - (unsigned long)(path->conv.u.lib_func), path->name); + fprintf(H5DEBUG(T), + "H5T: conversion function " + "0x%016zx failed to free private data for " + "%s (ignored)\n", + (size_t)path->conv.u.lib_func, path->name); } /* end if */ #endif H5E_clear_stack(NULL); /*ignore the error*/ @@ -1674,9 +1665,6 @@ H5T_top_term_package(void) * otherwise. * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 20, 1998 - * *------------------------------------------------------------------------- */ int @@ -1687,7 +1675,7 @@ H5T_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(0 == H5I_nmembers(H5I_DATATYPE)); + assert(0 == H5I_nmembers(H5I_DATATYPE)); /* Destroy the datatype object id group */ n += (H5I_dec_type_ref(H5I_DATATYPE) > 0); @@ -1712,8 +1700,8 @@ H5T__close_cb(H5T_t *dt, void **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dt); - HDassert(dt->shared); + assert(dt); + assert(dt->shared); /* If this datatype is VOL-managed (i.e.: has a VOL object), * close it through the VOL connector. @@ -1721,17 +1709,17 @@ H5T__close_cb(H5T_t *dt, void **request) if (NULL != dt->vol_obj) { /* Close the connector-managed datatype data */ if (H5VL_datatype_close(dt->vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); /* Free the VOL object */ if (H5VL_free_object(dt->vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object"); dt->vol_obj = NULL; } /* end if */ /* Close the datatype */ if (H5T_close(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1752,8 +1740,6 @@ H5T__close_cb(H5T_t *dt, void **request) * DATATYPE CANTINIT Can't create type. * DATATYPE CANTREGISTER Can't register datatype ID. * - * Programmer: Robb Matzke - * Friday, December 5, 1997 *------------------------------------------------------------------------- */ hid_t @@ -1767,15 +1753,15 @@ H5Tcreate(H5T_class_t type, size_t size) /* check args. We support string (fixed-size or variable-length) now. */ if (size <= 0 && size != H5T_VARIABLE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive"); /* create the type */ if (NULL == (dt = H5T__create(type, size))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create type"); /* Get an ID for the datatype */ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype ID") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype ID"); done: FUNC_LEAVE_API(ret_value) @@ -1814,7 +1800,7 @@ H5Tcopy(hid_t obj_id) case H5I_DATATYPE: /* The argument is a datatype handle */ if (NULL == (dt = (H5T_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "obj_id is not a datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "obj_id is not a datatype ID"); break; case H5I_DATASET: { @@ -1823,7 +1809,7 @@ H5Tcopy(hid_t obj_id) /* The argument is a dataset handle */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(obj_id, H5I_DATASET))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a dataset ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a dataset ID"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATASET_GET_TYPE; @@ -1834,13 +1820,13 @@ H5Tcopy(hid_t obj_id) */ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, - "unable to get datatype from the dataset") + "unable to get datatype from the dataset"); dset_tid = vol_cb_args.args.get_type.type_id; /* Unwrap the type ID */ if (NULL == (dt = (H5T_t *)H5I_object(dset_tid))) HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, - "received invalid datatype from the dataset") + "received invalid datatype from the dataset"); } break; case H5I_UNINIT: @@ -1861,7 +1847,7 @@ H5Tcopy(hid_t obj_id) case H5I_EVENTSET: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype or dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype or dataset"); } /* end switch */ /* Copy datatype */ @@ -1870,19 +1856,19 @@ H5Tcopy(hid_t obj_id) /* Get an ID for the copied datatype */ if ((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom"); done: /* If we got a type ID from a passed-in dataset, we need to close that */ if (dset_tid != H5I_INVALID_HID) if (H5I_dec_app_ref(dset_tid) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADID, FAIL, "problem freeing temporary dataset type ID") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADID, FAIL, "problem freeing temporary dataset type ID"); /* Close the new datatype on errors */ if (H5I_INVALID_HID == ret_value) if (new_dt && H5T_close_real(new_dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release datatype info") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release datatype info"); FUNC_LEAVE_API(ret_value) } /* end H5Tcopy() */ @@ -1894,8 +1880,6 @@ H5Tcopy(hid_t obj_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 *------------------------------------------------------------------------- */ herr_t @@ -1909,13 +1893,13 @@ H5Tclose(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_STATE_IMMUTABLE == dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype"); /* When the reference count reaches zero the resources are freed */ if (H5I_dec_app_ref(type_id) < 0) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "problem freeing id") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "problem freeing id"); done: FUNC_LEAVE_API(ret_value) @@ -1945,13 +1929,13 @@ H5Tclose_async(const char *app_file, const char *app_func, unsigned app_line, hi /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_STATE_IMMUTABLE == dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype"); /* Get dataset object's connector */ if (NULL == (vol_obj = H5VL_vol_object(type_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get VOL object for dataset") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get VOL object for dataset"); /* Prepare for possible asynchronous operation */ if (H5ES_NONE != es_id) { @@ -1966,17 +1950,17 @@ H5Tclose_async(const char *app_file, const char *app_func, unsigned app_line, hi /* When the reference count reaches zero the resources are freed */ if (H5I_dec_app_ref_async(type_id, token_ptr) < 0) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "problem freeing id") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "problem freeing id"); /* If a token was created, add the token to the event set */ if (NULL != token) if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, type_id, es_id)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: if (connector && H5VL_conn_dec_rc(connector) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "can't decrement ref count on connector") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "can't decrement ref count on connector"); FUNC_LEAVE_API(ret_value) } /* end H5Tclose_async() */ @@ -1990,9 +1974,6 @@ H5Tclose_async(const char *app_file, const char *app_func, unsigned app_line, hi * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, December 10, 1997 - * *------------------------------------------------------------------------- */ htri_t @@ -2007,9 +1988,9 @@ H5Tequal(hid_t type1_id, hid_t type2_id) /* check args */ if (NULL == (dt1 = (H5T_t *)H5I_object_verify(type1_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (NULL == (dt2 = (H5T_t *)H5I_object_verify(type2_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); ret_value = (0 == H5T_cmp(dt1, dt2, FALSE)) ? TRUE : FALSE; @@ -2030,9 +2011,6 @@ H5Tequal(hid_t type1_id, hid_t type2_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 9, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2046,12 +2024,12 @@ H5Tlock(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to lock named datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to lock named datatype"); if (H5T_lock(dt, TRUE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to lock transient datatype"); done: FUNC_LEAVE_API(ret_value) @@ -2066,9 +2044,6 @@ H5Tlock(hid_t type_id) * * Failure: H5T_NO_CLASS (Negative) * - * Programmer: Robb Matzke - * Monday, December 8, 1997 - * *------------------------------------------------------------------------- */ H5T_class_t @@ -2082,7 +2057,7 @@ H5Tget_class(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype"); /* Set return value */ ret_value = H5T_get_class(dt, FALSE); @@ -2100,9 +2075,6 @@ H5Tget_class(hid_t type_id) * * Failure: H5T_NO_CLASS (Negative) * - * Programmer: Robb Matzke - * Monday, December 8, 1997 - * *------------------------------------------------------------------------- */ H5T_class_t @@ -2112,7 +2084,7 @@ H5T_get_class(const H5T_t *dt, htri_t internal) FUNC_ENTER_NOAPI_NOERR - HDassert(dt); + assert(dt); /* Externally, a VL string is a string; internally, a VL string is a VL. */ if (internal) { @@ -2136,8 +2108,6 @@ H5T_get_class(const H5T_t *dt, htri_t internal) * * Return: TRUE (1) or FALSE (0) on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, November 29, 2000 *------------------------------------------------------------------------- */ htri_t @@ -2151,13 +2121,13 @@ H5Tdetect_class(hid_t type, H5T_class_t cls) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype"); if (!(cls > H5T_NO_CLASS && cls < H5T_NCLASSES)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a datatype class"); /* Set return value */ if ((ret_value = H5T_detect_class(dt, cls, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5T_NO_CLASS, "can't get datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5T_NO_CLASS, "can't get datatype class"); done: FUNC_LEAVE_API(ret_value) @@ -2171,9 +2141,6 @@ H5Tdetect_class(hid_t type, H5T_class_t cls) * * Return: TRUE (1) or FALSE (0) on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, November 29, 2000 - * *------------------------------------------------------------------------- */ htri_t @@ -2184,8 +2151,8 @@ H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api) FUNC_ENTER_NOAPI_NOERR - HDassert(dt); - HDassert(cls > H5T_NO_CLASS && cls < H5T_NCLASSES); + assert(dt); + assert(cls > H5T_NO_CLASS && cls < H5T_NCLASSES); /* Consider VL string as a string for API, as a VL for internal use. */ /* (note that this check must be performed before checking if the VL @@ -2246,9 +2213,6 @@ H5T_detect_class(const H5T_t *dt, H5T_class_t cls, hbool_t from_api) * * Return: TRUE (1) or FALSE (0) on success/Negative on failure * - * Programmer: Raymond Lu - * November 4, 2002 - * *------------------------------------------------------------------------- */ htri_t @@ -2262,11 +2226,11 @@ H5Tis_variable_str(hid_t dtype_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Set return value */ if ((ret_value = H5T_is_variable_str(dt)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't determine if datatype is VL-string") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't determine if datatype is VL-string"); done: FUNC_LEAVE_API(ret_value) @@ -2279,9 +2243,6 @@ H5Tis_variable_str(hid_t dtype_id) * * Return: TRUE (1) or FALSE (0) on success/Negative on failure * - * Programmer: Quincey Koziol - * October 17, 2007 - * *------------------------------------------------------------------------- */ htri_t @@ -2303,9 +2264,6 @@ H5T_is_variable_str(const H5T_t *dt) * * Failure: 0 (valid datatypes are never zero size) * - * Programmer: Robb Matzke - * Monday, December 8, 1997 - * *------------------------------------------------------------------------- */ size_t @@ -2319,7 +2277,7 @@ H5Tget_size(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype"); /* size */ ret_value = H5T_GET_SIZE(dt); @@ -2347,9 +2305,6 @@ H5Tget_size(hid_t type_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2363,21 +2318,21 @@ H5Tset_size(hid_t type_id, size_t size) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only"); if (size <= 0 && size != H5T_VARIABLE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "size must be positive"); if (size == H5T_VARIABLE && !H5T_IS_STRING(dt->shared)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "only strings may be variable length") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "only strings may be variable length"); if (H5T_ENUM == dt->shared->type && dt->shared->u.enumer.nmembs > 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); if (H5T_REFERENCE == dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for this datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for this datatype"); /* Modify the datatype */ if (H5T__set_size(dt, size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set size for datatype"); done: FUNC_LEAVE_API(ret_value) @@ -2393,8 +2348,6 @@ H5Tset_size(hid_t type_id, size_t size) * * Failure: negative * - * Programmer: Robb Matzke - * Wednesday, December 23, 1998 *------------------------------------------------------------------------- */ hid_t @@ -2408,11 +2361,11 @@ H5Tget_super(hid_t type) H5TRACE1("i", "i", type); if (NULL == (dt = (H5T_t *)H5I_object_verify(type, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype"); if (NULL == (super = H5T_get_super(dt))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "not a datatype"); if ((ret_value = H5I_register(H5I_DATATYPE, super, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register parent datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register parent datatype"); done: if (H5I_INVALID_HID == ret_value) @@ -2433,9 +2386,6 @@ H5Tget_super(hid_t type) * Return: Success: Data type for base data type. * Failure: NULL * - * Programmer: Raymond Lu - * October 9, 2002 - * *------------------------------------------------------------------------- */ H5T_t * @@ -2445,7 +2395,7 @@ H5T_get_super(const H5T_t *dt) FUNC_ENTER_NOAPI(NULL) - HDassert(dt); + assert(dt); if (!dt->shared->parent) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "not a derived data type"); @@ -2463,8 +2413,6 @@ H5T_get_super(const H5T_t *dt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, March 7, 1998 *------------------------------------------------------------------------- */ static herr_t @@ -2476,11 +2424,11 @@ H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T FUNC_ENTER_PACKAGE /* Check args */ - HDassert(H5T_PERS_HARD == pers || H5T_PERS_SOFT == pers); - HDassert(name && *name); - HDassert(src); - HDassert(dst); - HDassert(func); + assert(H5T_PERS_HARD == pers || H5T_PERS_SOFT == pers); + assert(name && *name); + assert(src); + assert(dst); + assert(func); /* Set up conversion function wrapper */ conv_func.is_app = FALSE; @@ -2489,7 +2437,7 @@ H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T /* Register conversion */ if (H5T__register(pers, name, src, dst, &conv_func) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, - "unable to register internal datatype conversion routine") + "unable to register internal datatype conversion routine"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2509,8 +2457,6 @@ H5T__register_int(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 9, 1998 *------------------------------------------------------------------------- */ static herr_t @@ -2527,18 +2473,18 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con FUNC_ENTER_PACKAGE /* Check args */ - HDassert(src); - HDassert(dst); - HDassert(conv); - HDassert(H5T_PERS_HARD == pers || H5T_PERS_SOFT == pers); - HDassert(name && *name); + assert(src); + assert(dst); + assert(conv); + assert(H5T_PERS_HARD == pers || H5T_PERS_SOFT == pers); + assert(name && *name); if (H5T_PERS_HARD == pers) { /* Only bother to register the path if it's not a no-op path (for this machine) */ if (H5T_cmp(src, dst, FALSE)) { /* Locate or create a new conversion path */ if (NULL == (new_path = H5T__path_find_real(src, dst, name, conv))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to locate/allocate conversion path"); /* Notify all other functions to recalculate private data since some * functions might cache a list of conversion functions. For @@ -2558,7 +2504,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con H5T_soft_t *x; if (NULL == (x = (H5T_soft_t *)H5MM_realloc(H5T_g.soft, na * sizeof(H5T_soft_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); H5T_g.asoft = na; H5T_g.soft = x; } /* end if */ @@ -2576,7 +2522,7 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con */ for (i = 1; i < H5T_g.npaths; i++) { old_path = H5T_g.path[i]; - HDassert(old_path); + assert(old_path); /* Does the new soft conversion function apply to this path? */ if (old_path->is_hard || old_path->src->shared->type != src->shared->type || @@ -2586,8 +2532,8 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con if ((tmp_sid = H5I_register(H5I_DATATYPE, H5T_copy(old_path->src, H5T_COPY_ALL), FALSE)) < 0 || (tmp_did = H5I_register(H5I_DATATYPE, H5T_copy(old_path->dst, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, - "unable to register data types for conv query") - HDmemset(&cdata, 0, sizeof cdata); + "unable to register data types for conv query"); + memset(&cdata, 0, sizeof cdata); cdata.command = H5T_CONV_INIT; if (conv->is_app) { if ((conv->u.app_func)(tmp_sid, tmp_did, &cdata, (size_t)0, (size_t)0, (size_t)0, NULL, NULL, @@ -2610,12 +2556,12 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con /* Create a new conversion path */ if (NULL == (new_path = H5FL_CALLOC(H5T_path_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); HDstrncpy(new_path->name, name, (size_t)H5T_NAMELEN); new_path->name[H5T_NAMELEN - 1] = '\0'; if (NULL == (new_path->src = H5T_copy(old_path->src, H5T_COPY_ALL)) || NULL == (new_path->dst = H5T_copy(old_path->dst, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy data types") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy data types"); new_path->conv = *conv; new_path->is_hard = FALSE; new_path->cdata = cdata; @@ -2632,10 +2578,10 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) - HDfprintf(H5DEBUG(T), - "H5T: conversion function 0x%08lx " - "failed to free private data for %s (ignored)\n", - (unsigned long)(old_path->conv.u.app_func), old_path->name); + fprintf(H5DEBUG(T), + "H5T: conversion function 0x%016zx " + "failed to free private data for %s (ignored)\n", + (size_t)old_path->conv.u.app_func, old_path->name); #endif } /* end if */ } /* end if */ @@ -2643,10 +2589,10 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) - HDfprintf(H5DEBUG(T), - "H5T: conversion function 0x%08lx " - "failed to free private data for %s (ignored)\n", - (unsigned long)(old_path->conv.u.lib_func), old_path->name); + fprintf(H5DEBUG(T), + "H5T: conversion function 0x%016zx " + "failed to free private data for %s (ignored)\n", + (size_t)old_path->conv.u.lib_func, old_path->name); #endif } /* end if */ (void)H5T_close_real(old_path->src); @@ -2695,9 +2641,6 @@ H5T__register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_con * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 9, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2713,15 +2656,15 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_c /* Check args */ if (H5T_PERS_HARD != pers && H5T_PERS_SOFT != pers) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid function persistence") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid function persistence"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conversion must have a name for debugging") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "conversion must have a name for debugging"); if (NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); if (NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); if (!func) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no conversion function specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no conversion function specified"); /* Set up conversion function wrapper */ conv_func.is_app = TRUE; @@ -2729,7 +2672,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_c /* Go register the function */ if (H5T__register(pers, name, src, dst, &conv_func) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register conversion function") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register conversion function"); done: FUNC_LEAVE_API(ret_value) @@ -2745,9 +2688,6 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T_c * Return: Success: non-negative * Failure: negative * - * Programmer: Robb Matzke - * Tuesday, January 13, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -2764,7 +2704,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c if (H5T_PERS_DONTCARE == pers || H5T_PERS_SOFT == pers) { for (i = H5T_g.nsoft - 1; i >= 0; --i) { soft = H5T_g.soft + i; - HDassert(soft); + assert(soft); if (name && *name && HDstrcmp(name, soft->name) != 0) continue; if (src && src->shared->type != soft->src) @@ -2774,8 +2714,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c if (func && func != soft->conv.u.app_func) continue; - HDmemmove(H5T_g.soft + i, H5T_g.soft + i + 1, - (size_t)(H5T_g.nsoft - (i + 1)) * sizeof(H5T_soft_t)); + memmove(H5T_g.soft + i, H5T_g.soft + i + 1, (size_t)(H5T_g.nsoft - (i + 1)) * sizeof(H5T_soft_t)); --H5T_g.nsoft; } /* end for */ } /* end if */ @@ -2783,7 +2722,7 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c /* Remove matching conversion paths, except no-op path */ for (i = H5T_g.npaths - 1; i > 0; --i) { path = H5T_g.path[i]; - HDassert(path); + assert(path); /* Not a match */ if (((H5T_PERS_SOFT == pers && path->is_hard) || (H5T_PERS_HARD == pers && !path->is_hard)) || @@ -2800,8 +2739,8 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c } /* end if */ else { /* Remove from table */ - HDmemmove(H5T_g.path + i, H5T_g.path + i + 1, - (size_t)(H5T_g.npaths - (i + 1)) * sizeof(H5T_path_t *)); + memmove(H5T_g.path + i, H5T_g.path + i + 1, + (size_t)(H5T_g.npaths - (i + 1)) * sizeof(H5T_path_t *)); --H5T_g.npaths; /* Shut down path */ @@ -2812,10 +2751,10 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) - HDfprintf(H5DEBUG(T), - "H5T: conversion function 0x%08lx failed " - "to free private data for %s (ignored)\n", - (unsigned long)(path->conv.u.app_func), path->name); + fprintf(H5DEBUG(T), + "H5T: conversion function 0x%016zx failed " + "to free private data for %s (ignored)\n", + (size_t)path->conv.u.app_func, path->name); #endif } /* end if */ } /* end if */ @@ -2823,10 +2762,10 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) - HDfprintf(H5DEBUG(T), - "H5T: conversion function 0x%08lx failed " - "to free private data for %s (ignored)\n", - (unsigned long)(path->conv.u.lib_func), path->name); + fprintf(H5DEBUG(T), + "H5T: conversion function 0x%016zx failed " + "to free private data for %s (ignored)\n", + (size_t)path->conv.u.lib_func, path->name); #endif } /* end if */ (void)H5T_close_real(path->src); @@ -2850,9 +2789,6 @@ H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_c * * Failure: negative * - * Programmer: Robb Matzke - * Tuesday, January 13, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2866,12 +2802,12 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T /* Check arguments */ if (src_id > 0 && (NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "src is not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "src is not a data type"); if (dst_id > 0 && (NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type"); if (H5T__unregister(pers, name, src, dst, func) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed"); done: FUNC_LEAVE_API(ret_value) @@ -2890,9 +2826,6 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, H5T * * Failure: NULL * - * Programmer: Robb Matzke - * Tuesday, January 13, 1998 - * *------------------------------------------------------------------------- */ H5T_conv_t @@ -2908,13 +2841,13 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata /*out*/) /* Check args */ if (NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)) || NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); if (!pcdata) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer"); /* Find it */ if (NULL == (path = H5T_path_find(src, dst))) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "conversion function not found") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "conversion function not found"); if (pcdata) *pcdata = &(path->cdata); @@ -2938,9 +2871,6 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata /*out*/) * FALSE: soft conversion. * FAIL: failed. * - * Programmer: Raymond Lu - * Friday, Sept 2, 2005 - * *------------------------------------------------------------------------- */ htri_t @@ -2955,11 +2885,11 @@ H5Tcompiler_conv(hid_t src_id, hid_t dst_id) /* Check args */ if (NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)) || NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); /* Find it */ if ((ret_value = H5T__compiler_conv(src, dst)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found"); done: FUNC_LEAVE_API(ret_value) @@ -2983,9 +2913,6 @@ H5Tcompiler_conv(hid_t src_id, hid_t dst_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -3001,21 +2928,21 @@ H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *backgroun /* Check args */ if (NULL == (src = (H5T_t *)H5I_object_verify(src_id, H5I_DATATYPE)) || NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset transfer property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset transfer property list"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); /* Find the conversion function */ if (NULL == (tpath = H5T_path_find(src, dst))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types"); if (H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, buf, background) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "data type conversion failed"); done: FUNC_LEAVE_API(ret_value) @@ -3031,9 +2958,6 @@ H5Tconvert(hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, void *backgroun * * Return: Non-negative on success, negative on failure * - * Programmer: Quincey Koziol - * Thursday, June 10, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -3047,17 +2971,17 @@ H5Treclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf) /* Check args */ if (H5I_DATATYPE != H5I_get_type(type_id) || buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument"); if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataspace"); if (!(H5S_has_extent(space))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dataspace does not have extent set"); /* Get the default dataset transfer property list if the user didn't provide one */ if (H5P_DEFAULT == dxpl_id) dxpl_id = H5P_DATASET_XFER_DEFAULT; else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -3079,9 +3003,6 @@ H5Treclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf) * * Failure: negative * - * Programmer: Raymond Lu - * July 14, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -3095,13 +3016,13 @@ H5Tencode(hid_t obj_id, void *buf, size_t *nalloc) /* Check argument and retrieve object */ if (NULL == (dtype = (H5T_t *)H5I_object_verify(obj_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (nalloc == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL pointer for buffer size") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL pointer for buffer size"); /* Go encode the datatype */ if (H5T_encode(dtype, (unsigned char *)buf, nalloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype"); done: FUNC_LEAVE_API(ret_value) @@ -3117,9 +3038,6 @@ H5Tencode(hid_t obj_id, void *buf, size_t *nalloc) * * Failure: negative * - * Programmer: Raymond Lu - * July 14, 2004 - * *------------------------------------------------------------------------- */ hid_t @@ -3133,7 +3051,7 @@ H5Tdecode(const void *buf) /* Check args */ if (buf == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty buffer"); /* Create datatype by decoding buffer * There is no way to get the size of the buffer, so we pass in @@ -3142,11 +3060,11 @@ H5Tdecode(const void *buf) * takes a size parameter. */ if (NULL == (dt = H5T_decode(SIZE_MAX, (const unsigned char *)buf))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, FAIL, "can't decode object"); /* Register the type and return the ID */ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register data type"); done: FUNC_LEAVE_API(ret_value) @@ -3167,9 +3085,6 @@ H5Tdecode(const void *buf) * * Failure: negative * - * Programmer: Raymond Lu - * July 14, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -3183,11 +3098,11 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) /* Allocate "fake" file structure */ if (NULL == (f = H5F_fake_alloc((uint8_t)0))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct"); /* Find out the size of buffer needed */ if ((buf_size = H5O_msg_raw_size(f, H5O_DTYPE_ID, TRUE, obj)) == 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "can't find datatype size") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADSIZE, FAIL, "can't find datatype size"); /* Don't encode if buffer size isn't big enough or buffer is empty */ if (!buf || *nalloc < (buf_size + 1 + 1)) @@ -3201,13 +3116,13 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) /* Encode into user's buffer */ if (H5O_msg_encode(f, H5O_DTYPE_ID, TRUE, buf, obj) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode object"); } /* end else */ done: /* Release fake file structure */ if (f && H5F_fake_free(f) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to release fake file struct") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "unable to release fake file struct"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_encode() */ @@ -3222,9 +3137,6 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) * * Failure: negative * - * Programmer: Raymond Lu - * July 14, 2004 - * *------------------------------------------------------------------------- */ H5T_t * @@ -3237,30 +3149,30 @@ H5T_decode(size_t buf_size, const unsigned char *buf) /* Allocate "fake" file structure */ if (NULL == (f = H5F_fake_alloc((uint8_t)0))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "can't allocate fake file struct"); /* Decode the type of the information */ if (*buf++ != H5O_DTYPE_ID) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADMESG, NULL, "not an encoded datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADMESG, NULL, "not an encoded datatype"); /* Decode the version of the datatype information */ if (*buf++ != H5T_ENCODE_VERSION) - HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype"); /* Decode the serialized datatype message */ if (NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, NULL, H5O_DTYPE_ID, buf_size, buf))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object"); /* Mark datatype as being in memory now */ if (H5T_set_loc(ret_value, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location"); /* No VOL object */ ret_value->vol_obj = NULL; done: /* Release fake file structure */ if (f && H5F_fake_free(f) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "unable to release fake file struct") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "unable to release fake file struct"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_decode() */ @@ -3276,9 +3188,6 @@ H5T_decode(size_t buf_size, const unsigned char *buf) * * Failure: NULL * - * Programmer: Robb Matzke - * Friday, December 5, 1997 - * *------------------------------------------------------------------------- */ H5T_t * @@ -3297,7 +3206,7 @@ H5T__create(H5T_class_t type, size_t size) H5T_t *origin_dt = NULL; if (NULL == (origin_dt = (H5T_t *)H5I_object(H5T_C_S1))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "can't get structure for string type") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "can't get structure for string type"); /* Copy the default string datatype */ if (NULL == (dt = H5T_copy(origin_dt, H5T_COPY_TRANSIENT))) @@ -3305,16 +3214,16 @@ H5T__create(H5T_class_t type, size_t size) /* Modify the datatype */ if (H5T__set_size(dt, size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to set size for string type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to set size for string type"); } break; case H5T_BITFIELD: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "type class is not appropriate - use H5Tcopy()") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "type class is not appropriate - use H5Tcopy()"); case H5T_OPAQUE: case H5T_COMPOUND: if (NULL == (dt = H5T__alloc())) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); dt->shared->type = type; if (type == H5T_COMPOUND) { @@ -3344,27 +3253,27 @@ H5T__create(H5T_class_t type, size_t size) subtype = H5T_NATIVE_LLONG_g; #endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ else - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no applicable native integer type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no applicable native integer type"); if (NULL == (dt = H5T__alloc())) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); dt->shared->type = type; if (NULL == (sub_t_obj = (H5T_t *)H5I_object(subtype))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, NULL, "unable to get datatype object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, NULL, "unable to get datatype object"); if (NULL == (dt->shared->parent = H5T_copy(sub_t_obj, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy base datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy base datatype"); } break; case H5T_VLEN: /* Variable length datatype */ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tvlen_create()") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tvlen_create()"); case H5T_ARRAY: /* Array datatype */ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create2()") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "base type required - use H5Tarray_create2()"); case H5T_NO_CLASS: case H5T_REFERENCE: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "unknown data type class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, NULL, "unknown data type class"); } /* end switch */ /* Set the size except VL string */ @@ -3381,7 +3290,7 @@ H5T__create(H5T_class_t type, size_t size) if (NULL == ret_value) { if (dt) { if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object"); dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); dt = H5FL_FREE(H5T_t, dt); } @@ -3402,9 +3311,6 @@ H5T__create(H5T_class_t type, size_t size) * Note: Common code for both H5T_copy and H5T_copy_reopen, as part of * the const-correct datatype copying routines. * - * Programmer: David Young - * January 18, 2020 - * *------------------------------------------------------------------------- */ static H5T_t * @@ -3417,9 +3323,9 @@ H5T__initiate_copy(const H5T_t *old_dt) /* Allocate space */ if (NULL == (new_dt = H5FL_MALLOC(H5T_t))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "H5T_t memory allocation failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "H5T_t memory allocation failed"); if (NULL == (new_dt->shared = H5FL_MALLOC(H5T_shared_t))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "H5T_shared_t memory allocation failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "H5T_shared_t memory allocation failed"); /* Copy shared information */ *(new_dt->shared) = *(old_dt->shared); @@ -3439,7 +3345,7 @@ H5T__initiate_copy(const H5T_t *old_dt) if (new_dt) { if (new_dt->shared) { if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object"); new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared); } /* end if */ new_dt = H5FL_FREE(H5T_t, new_dt); @@ -3456,9 +3362,6 @@ H5T__initiate_copy(const H5T_t *old_dt) * Return: Success: Pointer to a new copy of the OLD_DT argument. * Failure: NULL * - * Programmer: David Young - * January 18, 2020 - * *------------------------------------------------------------------------- */ static H5T_t * @@ -3470,7 +3373,7 @@ H5T__copy_transient(H5T_t *old_dt) /* Copy datatype, with correct method */ if (NULL == (ret_value = H5T_copy(old_dt, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't make 'transient' copy of datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't make 'transient' copy of datatype"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3484,9 +3387,6 @@ H5T__copy_transient(H5T_t *old_dt) * Return: Success: Pointer to a new copy of the OLD_DT argument. * Failure: NULL * - * Programmer: David Young - * January 18, 2020 - * *------------------------------------------------------------------------- */ static H5T_t * @@ -3498,7 +3398,7 @@ H5T__copy_all(H5T_t *old_dt) /* Copy datatype, with correct method */ if (NULL == (ret_value = H5T_copy(old_dt, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't make 'all' copy of datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't make 'all' copy of datatype"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3515,9 +3415,6 @@ H5T__copy_all(H5T_t *old_dt) * * Note: Common code for both H5T_copy and H5T_copy_reopen. * - * Programmer: David Young - * January 18, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -3537,7 +3434,7 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo /* Copy parent information */ if (old_dt->shared->parent) if (NULL == (new_dt->shared->parent = (*copyfn)(old_dt->shared->parent))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy datatype's parent type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy datatype's parent type"); switch (new_dt->shared->type) { case H5T_COMPOUND: { @@ -3552,7 +3449,7 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo if (new_dt->shared->u.compnd.nalloc > 0) { if (NULL == (new_dt->shared->u.compnd.memb = H5MM_malloc(new_dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t)))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed"); H5MM_memcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb, new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t)); @@ -3564,17 +3461,17 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo if (NULL == (s = H5MM_xstrdup(new_dt->shared->u.compnd.memb[i].name))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, - "can't copy string for compound field's name") + "can't copy string for compound field's name"); new_dt->shared->u.compnd.memb[i].name = s; if (NULL == (tmp = (*copyfn)(old_dt->shared->u.compnd.memb[i].type))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy compound field's datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy compound field's datatype"); new_dt->shared->u.compnd.memb[i].type = tmp; - HDassert(tmp != NULL); + assert(tmp != NULL); /* Range check against compound member's offset */ if ((accum_change < 0) && ((ssize_t)new_dt->shared->u.compnd.memb[i].offset < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype"); /* Apply the accumulated size change to the offset of the field */ new_dt->shared->u.compnd.memb[i].offset += (size_t)accum_change; @@ -3590,7 +3487,7 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo /* check if we couldn't find a match */ if (old_match < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "fields in datatype corrupted") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "fields in datatype corrupted"); } /* end if */ else old_match = (int)i; @@ -3611,7 +3508,7 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo /* Range check against datatype size */ if ((accum_change < 0) && ((ssize_t)new_dt->shared->size < accum_change)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "invalid field size in datatype"); /* Apply the accumulated size change to the size of the compound struct */ new_dt->shared->size += (size_t)accum_change; @@ -3623,21 +3520,28 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo * of each new member with copied values. That is, H5T_copy() is a * deep copy. */ - if (NULL == (new_dt->shared->u.enumer.name = - H5MM_malloc(new_dt->shared->u.enumer.nalloc * sizeof(char *)))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "enam name array memory allocation failed") - if (NULL == (new_dt->shared->u.enumer.value = - H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, - "enam value array memory allocation failed") - H5MM_memcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value, - new_dt->shared->u.enumer.nmembs * new_dt->shared->size); - for (i = 0; i < new_dt->shared->u.enumer.nmembs; i++) { - if (NULL == (s = H5MM_xstrdup(old_dt->shared->u.enumer.name[i]))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, - "can't copy string for enum value's name") - new_dt->shared->u.enumer.name[i] = s; - } /* end for */ + if (old_dt->shared->u.enumer.nalloc > 0) { + if (NULL == (new_dt->shared->u.enumer.name = + H5MM_malloc(new_dt->shared->u.enumer.nalloc * sizeof(char *)))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, + "enam name array memory allocation failed"); + if (NULL == (new_dt->shared->u.enumer.value = + H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, + "enam value array memory allocation failed"); + H5MM_memcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value, + new_dt->shared->u.enumer.nmembs * new_dt->shared->size); + for (i = 0; i < new_dt->shared->u.enumer.nmembs; i++) { + if (NULL == (s = H5MM_xstrdup(old_dt->shared->u.enumer.name[i]))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, + "can't copy string for enum value's name"); + new_dt->shared->u.enumer.name[i] = s; + } + } + else { + /* Empty enum */ + memset(&new_dt->shared->u.enumer, 0, sizeof(H5T_enum_t)); + } break; case H5T_VLEN: @@ -3645,7 +3549,7 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo if (set_memory_type) /* H5T_copy converts any type into a memory type */ if (H5T_set_loc(new_dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid datatype location"); break; case H5T_OPAQUE: @@ -3676,15 +3580,15 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo * type and the new type is also named. */ if (H5O_loc_reset(&new_dt->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to initialize location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to initialize location"); if (H5G_name_reset(&new_dt->path) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path"); if (new_dt->shared->state == H5T_STATE_NAMED || new_dt->shared->state == H5T_STATE_OPEN) { if (H5O_loc_copy_deep(&(new_dt->oloc), &(old_dt->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy object location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy object location"); if (H5G_name_copy(&(new_dt->path), &(old_dt->path), H5_COPY_DEEP) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to copy path"); } /* end if */ /* Copy shared location information if the new type is named or if it is @@ -3693,7 +3597,7 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo if ((old_dt->sh_loc.type == H5O_SHARE_TYPE_SOHM || old_dt->sh_loc.type == H5O_SHARE_TYPE_HERE) || new_dt->shared->state == H5T_STATE_NAMED || new_dt->shared->state == H5T_STATE_OPEN) { if (H5O_set_shared(&(new_dt->sh_loc), &(old_dt->sh_loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy shared information") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "can't copy shared information"); } /* end if */ else /* Reset shared component info */ @@ -3712,9 +3616,6 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo * Return: Success: Pointer to a new copy of the OLD_DT argument. * Failure: NULL * - * Programmer: Robb Matzke - * Thursday, December 4, 1997 - * *------------------------------------------------------------------------- */ H5T_t * @@ -3727,11 +3628,11 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) FUNC_ENTER_NOAPI(NULL) /* check args */ - HDassert(old_dt); + assert(old_dt); /* Allocate and copy core datatype information */ if (NULL == (new_dt = H5T__initiate_copy(old_dt))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy core datatype info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy core datatype info"); /* Check what sort of copy we are making */ switch (method) { @@ -3756,12 +3657,12 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "invalid copy method type") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "invalid copy method type"); } /* end switch */ /* Finish making the copy of the datatype */ if (H5T__complete_copy(new_dt, old_dt, NULL, (method == H5T_COPY_TRANSIENT), copyfn) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't complete datatype initialization") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't complete datatype initialization"); /* Set return value */ ret_value = new_dt; @@ -3769,9 +3670,9 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) done: if (ret_value == NULL) if (new_dt) { - HDassert(new_dt->shared); + assert(new_dt->shared); if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object"); new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared); new_dt = H5FL_FREE(H5T_t, new_dt); } /* end if */ @@ -3788,9 +3689,6 @@ H5T_copy(const H5T_t *old_dt, H5T_copy_t method) * Return: Success: Pointer to a new copy of the OLD_DT argument. * Failure: NULL * - * Programmer: David Young - * January 18, 2020 - * *------------------------------------------------------------------------- */ H5T_t * @@ -3803,11 +3701,11 @@ H5T_copy_reopen(H5T_t *old_dt) FUNC_ENTER_NOAPI(NULL) /* check args */ - HDassert(old_dt); + assert(old_dt); /* Allocate and copy core datatype information */ if (NULL == (new_dt = H5T__initiate_copy(old_dt))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy core datatype info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy core datatype info"); /* * Return a transient type (locked or unlocked) or an opened named @@ -3822,16 +3720,16 @@ H5T_copy_reopen(H5T_t *old_dt) /* Open named datatype again */ if (H5O_open(&old_dt->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reopen named data type"); /* Insert opened named datatype into opened object list for the file */ if (H5FO_insert(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr, new_dt->shared, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, NULL, - "can't insert datatype into list of open objects") + "can't insert datatype into list of open objects"); /* Increment object count for the object in the top file */ if (H5FO_top_incr(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count"); new_dt->shared->fo_count = 1; } /* end if */ @@ -3840,7 +3738,7 @@ H5T_copy_reopen(H5T_t *old_dt) * we had been using and use the one that already exists. * Not terribly efficient. */ if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object"); new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared); new_dt->shared = reopened_fo; @@ -3850,12 +3748,12 @@ H5T_copy_reopen(H5T_t *old_dt) if (H5FO_top_count(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) == 0) { /* Open the object through this top file */ if (H5O_open(&old_dt->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open object header"); } /* end if */ /* Increment object count for the object in the top file */ if (H5FO_top_incr(old_dt->sh_loc.file, old_dt->sh_loc.u.loc.oh_addr) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count"); } /* end else */ /* Set state for new datatype */ @@ -3868,7 +3766,7 @@ H5T_copy_reopen(H5T_t *old_dt) /* Finish making the copy of the datatype */ if (H5T__complete_copy(new_dt, old_dt, reopened_fo, TRUE, H5T_copy_reopen) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't complete datatype initialization") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't complete datatype initialization"); /* Set return value */ ret_value = new_dt; @@ -3876,9 +3774,9 @@ H5T_copy_reopen(H5T_t *old_dt) done: if (ret_value == NULL) if (new_dt) { - HDassert(new_dt->shared); + assert(new_dt->shared); if (new_dt->shared->owned_vol_obj && H5VL_free_object(new_dt->shared->owned_vol_obj) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object"); new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared); new_dt = H5FL_FREE(H5T_t, new_dt); } /* end if */ @@ -3898,8 +3796,6 @@ H5T_copy_reopen(H5T_t *old_dt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 *------------------------------------------------------------------------- */ herr_t @@ -3909,7 +3805,7 @@ H5T_lock(H5T_t *dt, hbool_t immutable) FUNC_ENTER_NOAPI(FAIL) - HDassert(dt); + assert(dt); switch (dt->shared->state) { case H5T_STATE_TRANSIENT: @@ -3925,7 +3821,7 @@ H5T_lock(H5T_t *dt, hbool_t immutable) /*void*/ break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid datatype state") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid datatype state"); } done: @@ -3939,9 +3835,6 @@ H5T_lock(H5T_t *dt, hbool_t immutable) * * Return: Pointer to new H5T_t on success/NULL on failure * - * Programmer: Quincey Koziol - * Monday, August 29, 2005 - * *------------------------------------------------------------------------- */ H5T_t * @@ -3954,14 +3847,14 @@ H5T__alloc(void) /* Allocate & initialize datatype wrapper info */ if (NULL == (dt = H5FL_CALLOC(H5T_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5O_loc_reset(&(dt->oloc)); H5G_name_reset(&(dt->path)); H5O_msg_reset_share(H5O_DTYPE_ID, dt); /* Allocate & initialize shared datatype structure */ if (NULL == (dt->shared = H5FL_CALLOC(H5T_shared_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); dt->shared->version = H5O_DTYPE_VERSION_1; /* No VOL object initially */ @@ -3974,7 +3867,7 @@ H5T__alloc(void) if (ret_value == NULL) if (dt) { if (dt->shared) { - HDassert(!dt->shared->owned_vol_obj); + assert(!dt->shared->owned_vol_obj); dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); } /* end if */ dt = H5FL_FREE(H5T_t, dt); @@ -3992,9 +3885,6 @@ H5T__alloc(void) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, January 6, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -4005,14 +3895,14 @@ H5T__free(H5T_t *dt) FUNC_ENTER_PACKAGE - HDassert(dt && dt->shared); + assert(dt && dt->shared); /* Free the ID to name info */ H5G_name_free(&(dt->path)); /* Don't free locked datatypes */ if (H5T_STATE_IMMUTABLE == dt->shared->state) - HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close immutable datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close immutable datatype"); /* Close the datatype */ switch (dt->shared->type) { @@ -4053,14 +3943,14 @@ H5T__free(H5T_t *dt) dt->shared->type = H5T_NO_CLASS; /* Close the parent */ - HDassert(dt->shared->parent != dt); + assert(dt->shared->parent != dt); if (dt->shared->parent && H5T_close_real(dt->shared->parent) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close parent data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close parent data type"); dt->shared->parent = NULL; /* Close the owned VOL object */ if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object"); dt->shared->owned_vol_obj = NULL; done: @@ -4077,9 +3967,6 @@ H5T__free(H5T_t *dt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, February 12, 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -4090,14 +3977,14 @@ H5T_close_real(H5T_t *dt) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dt && dt->shared); + assert(dt && dt->shared); /* Clean up resources, depending on shared state */ if (dt->shared->state != H5T_STATE_OPEN) { if (H5T__free(dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype"); - HDassert(!dt->shared->owned_vol_obj); + assert(!dt->shared->owned_vol_obj); dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); } /* end if */ else @@ -4119,9 +4006,6 @@ H5T_close_real(H5T_t *dt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, December 8, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -4132,8 +4016,8 @@ H5T_close(H5T_t *dt) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dt); - HDassert(dt->shared); + assert(dt); + assert(dt->shared); /* Named datatype cleanups */ if (dt->shared->state == H5T_STATE_OPEN) { @@ -4141,9 +4025,9 @@ H5T_close(H5T_t *dt) dt->shared->fo_count--; /* Sanity checks */ - HDassert(dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); - HDassert(H5F_addr_defined(dt->sh_loc.u.loc.oh_addr)); - HDassert(H5F_addr_defined(dt->oloc.addr)); + assert(dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); + assert(H5_addr_defined(dt->sh_loc.u.loc.oh_addr)); + assert(H5_addr_defined(dt->oloc.addr)); /* If a named type is being closed then close the object header and * remove from the list of open objects in the file. @@ -4151,7 +4035,7 @@ H5T_close(H5T_t *dt) /* Decrement the ref. count for this object in the top file */ if (H5FO_top_decr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't decrement count for object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "can't decrement count for object"); /* Close things down if this is the last reference to the open named datatype */ if (0 == dt->shared->fo_count) { @@ -4159,17 +4043,17 @@ H5T_close(H5T_t *dt) /* Uncork cache entries with object address tag for named datatype */ if (H5AC_cork(dt->oloc.file, dt->oloc.addr, H5AC__GET_CORKED, &corked) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status"); if (corked) if (H5AC_cork(dt->oloc.file, dt->oloc.addr, H5AC__UNCORK, NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTUNCORK, FAIL, "unable to uncork an object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTUNCORK, FAIL, "unable to uncork an object"); /* Remove the datatype from the list of opened objects in the file */ if (H5FO_delete(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, - "can't remove datatype from list of open objects") + "can't remove datatype from list of open objects"); if (H5O_close(&dt->oloc, NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to close data type object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to close data type object header"); /* Mark named datatype closed now */ dt->shared->state = H5T_STATE_NAMED; @@ -4179,12 +4063,12 @@ H5T_close(H5T_t *dt) if (H5FO_top_count(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) == 0) { /* Close object location for named datatype */ if (H5O_close(&dt->oloc, NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to close") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to close"); } /* end if */ else /* Free object location (i.e. "unhold" the file if appropriate) */ if (H5O_loc_free(&(dt->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "problem attempting to free location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, FAIL, "problem attempting to free location"); } /* end else */ } /* end if */ @@ -4217,9 +4101,6 @@ H5T_close(H5T_t *dt) * * Failure: negative * - * Programmer: Robb Matzke - * Tuesday, December 22, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -4231,11 +4112,11 @@ H5T__set_size(H5T_t *dt, size_t size) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dt); - HDassert(dt->shared); - HDassert(size != 0); - HDassert(H5T_REFERENCE != dt->shared->type); - HDassert(!(H5T_ENUM == dt->shared->type && 0 == dt->shared->u.enumer.nmembs)); + assert(dt); + assert(dt->shared); + assert(size != 0); + assert(H5T_REFERENCE != dt->shared->type); + assert(!(H5T_ENUM == dt->shared->type && 0 == dt->shared->u.enumer.nmembs)); if (dt->shared->parent) { if (H5T__set_size(dt->shared->parent, size) < 0) @@ -4301,7 +4182,7 @@ H5T__set_size(H5T_t *dt, size_t size) /* Compound must not have been packed previously */ /* We will check if resizing changed the packed state of * this type at the end of this function */ - HDassert(!dt->shared->u.compnd.packed); + assert(!dt->shared->u.compnd.packed); } /* end if */ break; @@ -4366,16 +4247,16 @@ H5T__set_size(H5T_t *dt, size_t size) case H5T_VLEN: case H5T_ARRAY: case H5T_REFERENCE: - HDassert("can't happen" && 0); + assert("can't happen" && 0); break; case H5T_NO_CLASS: case H5T_NCLASSES: - HDassert("invalid type" && 0); + assert("invalid type" && 0); break; default: - HDassert("not implemented yet" && 0); + assert("not implemented yet" && 0); break; } /* end switch */ @@ -4408,8 +4289,6 @@ H5T__set_size(H5T_t *dt, size_t size) * * Failure: 0 (valid data types are never zero size) * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 *------------------------------------------------------------------------- */ size_t @@ -4419,8 +4298,8 @@ H5T_get_size(const H5T_t *dt) FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ - HDassert(dt); - HDassert(dt->shared); + assert(dt); + assert(dt->shared); FUNC_LEAVE_NOAPI(dt->shared->size) } /* end H5T_get_size() */ @@ -4434,8 +4313,6 @@ H5T_get_size(const H5T_t *dt) * * Return: TRUE/FALSE (never fails) * - * Programmer: Neil Fortner - * Thursday, January 21, 2021 *------------------------------------------------------------------------- */ hbool_t @@ -4445,8 +4322,8 @@ H5T_get_force_conv(const H5T_t *dt) FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ - HDassert(dt); - HDassert(dt->shared); + assert(dt); + assert(dt->shared); FUNC_LEAVE_NOAPI(dt->shared->force_conv) } /* end H5T_get_force_conv() */ @@ -4462,9 +4339,6 @@ H5T_get_force_conv(const H5T_t *dt) * * Failure: 0, never fails * - * Programmer: Robb Matzke - * Wednesday, December 10, 1997 - * *------------------------------------------------------------------------- */ int @@ -4480,15 +4354,15 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) FUNC_ENTER_NOAPI(0) /* Sanity check */ - HDassert(dt1); - HDassert(dt2); + assert(dt1); + assert(dt2); /* the easy case */ if (dt1 == dt2) HGOTO_DONE(0); - HDassert(dt1->shared); - HDassert(dt2->shared); + assert(dt1->shared); + assert(dt2->shared); /* compare */ if (dt1->shared->type < dt2->shared->type) @@ -4561,10 +4435,10 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) #ifdef H5T_DEBUG /* I don't quite trust the code above yet :-) --RPM */ for (u = 0; u < dt1->shared->u.compnd.nmembs - 1; u++) { - HDassert(HDstrcmp(dt1->shared->u.compnd.memb[idx1[u]].name, - dt1->shared->u.compnd.memb[idx1[u + 1]].name)); - HDassert(HDstrcmp(dt2->shared->u.compnd.memb[idx2[u]].name, - dt2->shared->u.compnd.memb[idx2[u + 1]].name)); + assert(HDstrcmp(dt1->shared->u.compnd.memb[idx1[u]].name, + dt1->shared->u.compnd.memb[idx1[u + 1]].name)); + assert(HDstrcmp(dt2->shared->u.compnd.memb[idx2[u]].name, + dt2->shared->u.compnd.memb[idx2[u + 1]].name)); } #endif @@ -4658,9 +4532,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) #ifdef H5T_DEBUG /* I don't quite trust the code above yet :-) --RPM */ for (u = 0; u < dt1->shared->u.enumer.nmembs - 1; u++) { - HDassert( + assert( HDstrcmp(dt1->shared->u.enumer.name[idx1[u]], dt1->shared->u.enumer.name[idx1[u + 1]])); - HDassert( + assert( HDstrcmp(dt2->shared->u.enumer.name[idx2[u]], dt2->shared->u.enumer.name[idx2[u + 1]])); } #endif @@ -4708,8 +4582,8 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) idx = u; } /* end else */ - tmp = HDmemcmp((uint8_t *)dt1->shared->u.enumer.value + idx1[u] * base_size, - (uint8_t *)dt2->shared->u.enumer.value + idx2[idx] * base_size, base_size); + tmp = memcmp((uint8_t *)dt1->shared->u.enumer.value + idx1[u] * base_size, + (uint8_t *)dt2->shared->u.enumer.value + idx2[idx] * base_size, base_size); if (tmp < 0) HGOTO_DONE(-1); if (tmp > 0) @@ -4718,12 +4592,12 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) break; case H5T_VLEN: - HDassert(dt1->shared->u.vlen.type > H5T_VLEN_BADTYPE && - dt1->shared->u.vlen.type < H5T_VLEN_MAXTYPE); - HDassert(dt2->shared->u.vlen.type > H5T_VLEN_BADTYPE && - dt2->shared->u.vlen.type < H5T_VLEN_MAXTYPE); - HDassert(dt1->shared->u.vlen.loc >= H5T_LOC_BADLOC && dt1->shared->u.vlen.loc < H5T_LOC_MAXLOC); - HDassert(dt2->shared->u.vlen.loc >= H5T_LOC_BADLOC && dt2->shared->u.vlen.loc < H5T_LOC_MAXLOC); + assert(dt1->shared->u.vlen.type > H5T_VLEN_BADTYPE && + dt1->shared->u.vlen.type < H5T_VLEN_MAXTYPE); + assert(dt2->shared->u.vlen.type > H5T_VLEN_BADTYPE && + dt2->shared->u.vlen.type < H5T_VLEN_MAXTYPE); + assert(dt1->shared->u.vlen.loc >= H5T_LOC_BADLOC && dt1->shared->u.vlen.loc < H5T_LOC_MAXLOC); + assert(dt2->shared->u.vlen.loc >= H5T_LOC_BADLOC && dt2->shared->u.vlen.loc < H5T_LOC_MAXLOC); /* Arbitrarily sort sequence VL datatypes before string VL datatypes */ if (dt1->shared->u.vlen.type == H5T_VLEN_SEQUENCE && @@ -4909,7 +4783,7 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) case H5T_ARRAY: case H5T_NCLASSES: default: - HDassert("not implemented yet" && 0); + assert("not implemented yet" && 0); break; } break; @@ -4939,9 +4813,6 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) * Failure: NULL if the path does not exist and no * function can be found to apply to the new path. * - * Programmer: Quincey Koziol - * Monday, March 5, 2018 - * *------------------------------------------------------------------------- */ H5T_path_t * @@ -4953,10 +4824,10 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst) FUNC_ENTER_NOAPI(NULL) /* Sanity check */ - HDassert(src); - HDassert(src->shared); - HDassert(dst); - HDassert(dst->shared); + assert(src); + assert(src->shared); + assert(dst); + assert(dst->shared); /* Set up conversion function wrapper */ conv_func.is_app = FALSE; @@ -4964,7 +4835,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst) /* Call the internal routine, with additional parameters */ if (NULL == (ret_value = H5T__path_find_real(src, dst, NULL, &conv_func))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, NULL, "can't find datatype conversion path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, NULL, "can't find datatype conversion path"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4991,9 +4862,6 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst) * Failure: NULL if the path does not exist and no * function can be found to apply to the new path. * - * Programmer: Robb Matzke - * Tuesday, January 13, 1998 - * *------------------------------------------------------------------------- */ static H5T_path_t * @@ -5013,10 +4881,10 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(src); - HDassert(src->shared); - HDassert(dst); - HDassert(dst->shared); + assert(src); + assert(src->shared); + assert(dst); + assert(dst->shared); /* * Make sure the first entry in the table is the no-op conversion path. @@ -5024,10 +4892,11 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co if (0 == H5T_g.npaths) { if (NULL == (H5T_g.path = (H5T_path_t **)H5MM_malloc(128 * sizeof(H5T_path_t *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "memory allocation failed for type conversion path table") + "memory allocation failed for type conversion path table"); H5T_g.apaths = 128; if (NULL == (H5T_g.path[0] = H5FL_CALLOC(H5T_path_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for no-op conversion path") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, + "memory allocation failed for no-op conversion path"); HDsnprintf(H5T_g.path[0]->name, sizeof(H5T_g.path[0]->name), "no-op"); H5T_g.path[0]->conv.is_app = FALSE; H5T_g.path[0]->conv.u.lib_func = H5T__conv_noop; @@ -5036,7 +4905,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co NULL, NULL) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) - HDfprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); + fprintf(H5DEBUG(T), "H5T: unable to initialize no-op conversion function (ignored)\n"); #endif H5E_clear_stack(NULL); /*ignore the error*/ } /* end if */ @@ -5048,7 +4917,6 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co * then use entry[0], otherwise do a binary search over the * remaining entries. * - * Quincey Koziol, 2 July, 1999 * Only allow the no-op conversion to occur if no "force conversion" flags * are set */ @@ -5065,7 +4933,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co while (cmp && lt < rt) { md = (lt + rt) / 2; - HDassert(H5T_g.path[md]); + assert(H5T_g.path[md]); cmp = H5T_cmp(src, H5T_g.path[md]->src, FALSE); if (0 == cmp) cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE); @@ -5092,7 +4960,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co if (!table || (table && conv->is_app && conv->u.app_func) || (table && !table->is_hard && !conv->is_app && conv->u.lib_func)) { if (NULL == (path = H5FL_CALLOC(H5T_path_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for type conversion path"); if (name && *name) { HDstrncpy(path->name, name, (size_t)H5T_NAMELEN); path->name[H5T_NAMELEN - 1] = '\0'; @@ -5100,9 +4968,9 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co else HDsnprintf(path->name, sizeof(path->name), "NONAME"); if (NULL == (path->src = H5T_copy(src, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path"); if (NULL == (path->dst = H5T_copy(dst, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy datatype for conversion path"); } /* end if */ else path = table; @@ -5114,23 +4982,23 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co */ if (conv->u.app_func && (!table || (table && conv->is_app) || (table && !table->is_hard && !conv->is_app))) { - HDassert(path != table); - HDassert(NULL == path->conv.u.app_func); + assert(path != table); + assert(NULL == path->conv.u.app_func); if (path->src && (src_id = H5I_register(H5I_DATATYPE, H5T_copy(path->src, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, - "unable to register source conversion type for query") + "unable to register source conversion type for query"); if (path->dst && (dst_id = H5I_register(H5I_DATATYPE, H5T_copy(path->dst, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, - "unable to register destination conversion type for query") + "unable to register destination conversion type for query"); path->cdata.command = H5T_CONV_INIT; if (conv->is_app) { if ((conv->u.app_func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function"); } /* end if */ else if ((conv->u.lib_func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to initialize conversion function"); if (src_id >= 0) H5I_dec_ref(src_id); if (dst_id >= 0) @@ -5146,7 +5014,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co * for an applicable function and add it to the path. This can't happen * for the no-op conversion path. */ - HDassert(path->conv.u.app_func || (src && dst)); + assert(path->conv.u.app_func || (src && dst)); for (i = H5T_g.nsoft - 1; i >= 0 && !path->conv.u.app_func; --i) { hbool_t path_init_error = FALSE; @@ -5154,22 +5022,22 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co continue; if ((src_id = H5I_register(H5I_DATATYPE, H5T_copy(path->src, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, - "unable to register src conversion type for query") + "unable to register src conversion type for query"); if ((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(path->dst, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, NULL, - "unable to register dst conversion type for query") + "unable to register dst conversion type for query"); path->cdata.command = H5T_CONV_INIT; if (H5T_g.soft[i].conv.is_app) { if ((H5T_g.soft[i].conv.u.app_func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { - HDmemset(&(path->cdata), 0, sizeof(H5T_cdata_t)); + memset(&(path->cdata), 0, sizeof(H5T_cdata_t)); H5E_clear_stack(NULL); /*ignore the error*/ path_init_error = TRUE; } /* end if */ } /* end if */ else if ((H5T_g.soft[i].conv.u.lib_func)(src_id, dst_id, &(path->cdata), (size_t)0, (size_t)0, (size_t)0, NULL, NULL) < 0) { - HDmemset(&(path->cdata), 0, sizeof(H5T_cdata_t)); + memset(&(path->cdata), 0, sizeof(H5T_cdata_t)); H5E_clear_stack(NULL); /*ignore the error*/ path_init_error = TRUE; } /* end if */ @@ -5186,7 +5054,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co src_id = dst_id = -1; } /* end for */ if (!path->conv.u.app_func) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no appropriate function for conversion path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "no appropriate function for conversion path"); /* Check if paths were inserted into the table through a recursive call * and re-compute the correct location for this path if so. - QAK, 1/26/02 @@ -5198,7 +5066,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co while (cmp && lt < rt) { md = (lt + rt) / 2; - HDassert(H5T_g.path[md]); + assert(H5T_g.path[md]); cmp = H5T_cmp(src, H5T_g.path[md]->src, FALSE); if (0 == cmp) cmp = H5T_cmp(dst, H5T_g.path[md]->dst, FALSE); @@ -5213,7 +5081,7 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co /* Replace an existing table entry or add a new entry */ if (table && path != table) { - HDassert(table == H5T_g.path[md]); + assert(table == H5T_g.path[md]); H5T__print_stats(table, &nprint /*in,out*/); table->cdata.command = H5T_CONV_FREE; if (table->conv.is_app) { @@ -5221,8 +5089,8 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co (size_t)0, NULL, NULL, H5CX_get_dxpl()) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) - HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", - (unsigned long)(path->conv.u.app_func), path->name); + fprintf(H5DEBUG(T), "H5T: conversion function 0x%016zx free failed for %s (ignored)\n", + (size_t)path->conv.u.app_func, path->name); #endif H5E_clear_stack(NULL); /*ignore the failure*/ } /* end if */ @@ -5231,8 +5099,8 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co (size_t)0, NULL, NULL) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) - HDfprintf(H5DEBUG(T), "H5T: conversion function 0x%08lx free failed for %s (ignored)\n", - (unsigned long)(path->conv.u.lib_func), path->name); + fprintf(H5DEBUG(T), "H5T: conversion function 0x%016zx free failed for %s (ignored)\n", + (size_t)path->conv.u.lib_func, path->name); #endif H5E_clear_stack(NULL); /*ignore the failure*/ } /* end if */ @@ -5245,19 +5113,19 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co H5T_g.path[md] = path; } /* end if */ else if (path != table) { - HDassert(cmp); + assert(cmp); if ((size_t)H5T_g.npaths >= H5T_g.apaths) { size_t na = MAX(128, 2 * H5T_g.apaths); H5T_path_t **x; if (NULL == (x = (H5T_path_t **)H5MM_realloc(H5T_g.path, na * sizeof(H5T_path_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); H5T_g.apaths = na; H5T_g.path = x; } /* end if */ if (cmp > 0) md++; - HDmemmove(H5T_g.path + md + 1, H5T_g.path + md, (size_t)(H5T_g.npaths - md) * sizeof(H5T_path_t *)); + memmove(H5T_g.path + md + 1, H5T_g.path + md, (size_t)(H5T_g.npaths - md) * sizeof(H5T_path_t *)); H5T_g.npaths++; H5T_g.path[md] = path; table = path; @@ -5300,8 +5168,6 @@ H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_co * * Return: TRUE/FALSE (can't fail) * - * Programmer: Quincey Koziol - * Thursday, May 8, 2003 *------------------------------------------------------------------------- */ hbool_t @@ -5309,7 +5175,7 @@ H5T_path_noop(const H5T_path_t *p) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(p); + assert(p); FUNC_LEAVE_NOAPI(p->is_noop || (p->is_hard && 0 == H5T_cmp(p->src, p->dst, FALSE))) } /* end H5T_path_noop() */ @@ -5332,9 +5198,6 @@ H5T_path_noop(const H5T_path_t *p) * Return: A pointer to the subset info struct in p, or NULL if there are * no compounds. Points directly into the H5T_path_t structure. * - * Programmer: Raymond Lu - * 8 June 2007 - * *------------------------------------------------------------------------- */ H5T_subset_info_t * @@ -5344,7 +5207,7 @@ H5T_path_compound_subset(const H5T_path_t *p) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(p); + assert(p); if (p->are_compounds) ret_value = H5T__conv_struct_subset(&(p->cdata)); @@ -5359,8 +5222,6 @@ H5T_path_compound_subset(const H5T_path_t *p) * * Return: Background flag (can't fail) * - * Programmer: Quincey Koziol - * Thursday, May 8, 2003 *------------------------------------------------------------------------- */ H5T_bkg_t @@ -5368,7 +5229,7 @@ H5T_path_bkg(const H5T_path_t *p) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(p); + assert(p); FUNC_LEAVE_NOAPI(p->cdata.need_bkg) } /* end H5T_path_bkg() */ @@ -5384,8 +5245,6 @@ H5T_path_bkg(const H5T_path_t *p) * FALSE: soft conversion. * FAIL: function failed. * - * Programmer: Raymond Lu - * Friday, Sept 2, 2005 *------------------------------------------------------------------------- */ static htri_t @@ -5398,7 +5257,7 @@ H5T__compiler_conv(H5T_t *src, H5T_t *dst) /* Find it */ if (NULL == (path = H5T_path_find(src, dst))) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found"); ret_value = (htri_t)path->is_hard; @@ -5416,9 +5275,6 @@ H5T__compiler_conv(H5T_t *src, H5T_t *dst) * * Failure: negative * - * Programmer: Robb Matzke - * Tuesday, December 15, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -5445,11 +5301,11 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t if (tpath->conv.is_app) { if ((tpath->conv.u.app_func)(src_id, dst_id, &(tpath->cdata), nelmts, buf_stride, bkg_stride, buf, bkg, H5CX_get_dxpl()) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); } /* end if */ else if ((tpath->conv.u.lib_func)(src_id, dst_id, &(tpath->cdata), nelmts, buf_stride, bkg_stride, buf, bkg) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "datatype conversion failed"); #ifdef H5T_DEBUG if (H5DEBUG(T)) { /* Stop timer */ @@ -5476,9 +5332,6 @@ H5T_convert(H5T_path_t *tpath, hid_t src_id, hid_t dst_id, size_t nelmts, size_t * Return: Success: Ptr directly into named datatype * Failure: NULL * - * Programmer: Robb Matzke - * Friday, June 5, 1998 - * *------------------------------------------------------------------------- */ H5O_loc_t * @@ -5488,20 +5341,20 @@ H5T_oloc(H5T_t *dt) FUNC_ENTER_NOAPI(NULL) - HDassert(dt); + assert(dt); switch (dt->shared->state) { case H5T_STATE_TRANSIENT: case H5T_STATE_RDONLY: case H5T_STATE_IMMUTABLE: - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "not a named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "not a named datatype"); case H5T_STATE_NAMED: case H5T_STATE_OPEN: - HDassert(dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); + assert(dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); ret_value = &dt->oloc; break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "invalid datatype state") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "invalid datatype state"); } /* end switch */ done: @@ -5516,9 +5369,6 @@ H5T_oloc(H5T_t *dt) * Return: Success: Ptr directly into named datatype * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, September 12, 2005 - * *------------------------------------------------------------------------- */ H5G_name_t * @@ -5528,19 +5378,19 @@ H5T_nameof(H5T_t *dt) FUNC_ENTER_NOAPI(NULL) - HDassert(dt); + assert(dt); switch (dt->shared->state) { case H5T_STATE_TRANSIENT: case H5T_STATE_RDONLY: case H5T_STATE_IMMUTABLE: - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "not a named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "not a named datatype"); case H5T_STATE_NAMED: case H5T_STATE_OPEN: ret_value = &(dt->path); break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "invalid datatype state") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "invalid datatype state"); } /* end switch */ done: @@ -5556,8 +5406,6 @@ H5T_nameof(H5T_t *dt) * * FALSE * - * Programmer: Raymond Lu - * Friday, Dec 7, 2001 *------------------------------------------------------------------------- */ htri_t @@ -5567,7 +5415,7 @@ H5T_is_immutable(const H5T_t *dt) FUNC_ENTER_NOAPI_NOERR - HDassert(dt); + assert(dt); if (dt->shared->state == H5T_STATE_IMMUTABLE) ret_value = TRUE; @@ -5591,7 +5439,7 @@ H5T_is_named(const H5T_t *dt) FUNC_ENTER_NOAPI_NOERR - HDassert(dt); + assert(dt); if (dt->vol_obj) ret_value = TRUE; @@ -5614,8 +5462,6 @@ H5T_is_named(const H5T_t *dt) * Return: Success: non-negative * Failure: negative * - * Programmer: Vailin Choi; June 2016 - * *------------------------------------------------------------------------- */ herr_t @@ -5625,17 +5471,17 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) FUNC_ENTER_NOAPI(FAIL) - HDassert(dt); - HDassert(f); + assert(dt); + assert(f); if (H5T_is_named(dt) && (dt->sh_loc.file != f)) { - HDassert(dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); + assert(dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); H5O_msg_reset_share(H5O_DTYPE_ID, dt); if (H5O_loc_free(&dt->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to initialize location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTRESET, FAIL, "unable to initialize location"); if (H5G_name_free(&dt->path) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to reset path"); /* If the datatype is committed through the VOL, close it */ if (NULL != dt->vol_obj) { @@ -5643,11 +5489,11 @@ H5T_convert_committed_datatype(H5T_t *dt, H5F_t *f) /* Close the datatype through the VOL*/ if (H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to close datatype"); /* Free the datatype and set the VOL object pointer to NULL */ if (H5VL_free_object(vol_obj) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDEC, FAIL, "unable to free VOL object"); dt->vol_obj = NULL; } /* end if */ @@ -5677,7 +5523,7 @@ H5T_get_ref_type(const H5T_t *dt) FUNC_ENTER_NOAPI_NOERR - HDassert(dt); + assert(dt); if (dt->shared->type == H5T_REFERENCE) ret_value = dt->shared->u.atomic.u.r.rtype; @@ -5695,8 +5541,6 @@ H5T_get_ref_type(const H5T_t *dt) * * Failure: Negative * - * Programmer: Quincey Koziol - * Tuesday, June 11, 2002 *------------------------------------------------------------------------- */ htri_t @@ -5706,7 +5550,7 @@ H5T_is_sensible(const H5T_t *dt) FUNC_ENTER_NOAPI_NOERR - HDassert(dt); + assert(dt); switch (dt->shared->type) { case H5T_COMPOUND: @@ -5776,8 +5620,8 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) FUNC_ENTER_NOAPI(FAIL) - HDassert(dt); - HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); + assert(dt); + assert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); /* Datatypes can't change in size if the force_conv flag is not set */ if (dt->shared->force_conv) { @@ -5793,7 +5637,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Mark the VL, compound or array type */ if ((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); if (changed > 0) ret_value = changed; @@ -5924,9 +5768,6 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) * FALSE - If the location of any vlen types is the same * <0 is returned on failure * - * Programmer: Quincey Koziol - * Thursday, June 24, 2004 - * *------------------------------------------------------------------------- */ htri_t @@ -5937,7 +5778,7 @@ H5T_is_relocatable(const H5T_t *dt) FUNC_ENTER_NOAPI_NOERR /* Sanity check */ - HDassert(dt); + assert(dt); /* VL and reference datatypes are relocatable */ if (H5T_detect_class(dt, H5T_VLEN, FALSE) || H5T_detect_class(dt, H5T_REFERENCE, FALSE)) @@ -5955,9 +5796,6 @@ H5T_is_relocatable(const H5T_t *dt) * Return: TRUE (1) or FALSE (0) on success * (Can't fail) * - * Programmer: Quincey Koziol - * Saturday, January 5, 2019 - * *------------------------------------------------------------------------- */ static hbool_t @@ -5969,7 +5807,7 @@ H5T__detect_vlen_ref(const H5T_t *dt) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(dt); + assert(dt); /* Check if this datatype is a vlen reference */ /* TODO currently H5T_STD_REF is always considered as a vlen type */ @@ -6023,9 +5861,6 @@ H5T__detect_vlen_ref(const H5T_t *dt) * FALSE - If the datatype will NOT be stored in a variable-length form * <0 is returned on failure * - * Programmer: Quincey Koziol - * Saturday, January 5, 2019 - * *------------------------------------------------------------------------- */ htri_t @@ -6036,7 +5871,7 @@ H5T_is_vl_storage(const H5T_t *dt) FUNC_ENTER_NOAPI_NOERR /* Sanity check */ - HDassert(dt); + assert(dt); /* VL and region reference datatypes are stored in variable-length form */ if (H5T_detect_class(dt, H5T_VLEN, FALSE)) @@ -6061,9 +5896,6 @@ H5T_is_vl_storage(const H5T_t *dt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 19, 2007 - * *------------------------------------------------------------------------- */ static herr_t @@ -6072,8 +5904,8 @@ H5T__upgrade_version_cb(H5T_t *dt, void *op_value) FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(dt); - HDassert(op_value); + assert(dt); + assert(op_value); /* Special behavior for each type of datatype */ switch (dt->shared->type) { @@ -6115,9 +5947,6 @@ H5T__upgrade_version_cb(H5T_t *dt, void *op_value) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 19, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -6128,12 +5957,12 @@ H5T__upgrade_version(H5T_t *dt, unsigned new_version) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dt); + assert(dt); /* Iterate over entire datatype, upgrading the version of components, if it's useful */ if (H5T__visit(dt, (H5T_VISIT_SIMPLE | H5T_VISIT_COMPLEX_LAST), H5T__upgrade_version_cb, &new_version) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "iteration to upgrade datatype encoding version failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "iteration to upgrade datatype encoding version failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6148,8 +5977,6 @@ H5T__upgrade_version(H5T_t *dt, unsigned new_version) * * Return: Non-negative on success/Negative on failure * - * Programmer: Vailin Choi; December 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -6161,19 +5988,19 @@ H5T_set_version(H5F_t *f, H5T_t *dt) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(f); - HDassert(dt); + assert(f); + assert(dt); vers = H5O_dtype_ver_bounds[H5F_LOW_BOUND(f)]; if (vers > dt->shared->version) { /* Upgrade the format version for the datatype */ if (H5T__upgrade_version(dt, vers) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade datatype encoding") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade datatype encoding"); } /* Version bounds check */ if (dt->shared->version > H5O_dtype_ver_bounds[H5F_HIGH_BOUND(f)]) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "Datatype version out of bounds") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "Datatype version out of bounds"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6189,9 +6016,6 @@ H5T_set_version(H5F_t *f, H5T_t *dt) * * Return: SUCCEED * - * Programmer: Neil Fortner - * Thursday, July 14, 2011 - * *------------------------------------------------------------------------- */ herr_t @@ -6202,8 +6026,8 @@ H5T_patch_file(H5T_t *dt, H5F_t *f) FUNC_ENTER_NOAPI_NOERR /* Sanity check */ - HDassert(dt); - HDassert(f); + assert(dt); + assert(f); if (H5T_STATE_OPEN == dt->shared->state || H5T_STATE_NAMED == dt->shared->state) { dt->oloc.file = f; @@ -6231,9 +6055,9 @@ H5T_patch_vlen_file(H5T_t *dt, H5VL_object_t *file) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(dt); - HDassert(dt->shared); - HDassert(file); + assert(dt); + assert(dt->shared); + assert(file); if ((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.file != file) dt->shared->u.vlen.file = file; @@ -6260,16 +6084,16 @@ H5T_own_vol_obj(H5T_t *dt, H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dt); - HDassert(dt->shared); - HDassert(vol_obj); + assert(dt); + assert(dt->shared); + assert(vol_obj); /* Currently no support for owning multiple VOL objects, free the previous * owned object. Currently this is only used for holding open VOL objects * used in the "loc" for vlens and references, so if this is being * overwritten we don't need the old one anyways. */ if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object"); /* Take ownership */ dt->shared->owned_vol_obj = vol_obj; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5TS.c b/externals/coda-oss/modules/drivers/hdf5/source/H5TS.c index 27823db01b..52cb1cef87 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5TS.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5TS.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -12,14 +11,14 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Purpose: This file contains the framework for ensuring that the global - * library lock is held when an API routine is called. This - * framework works in concert with the FUNC_ENTER_API / FUNC_LEAVE_API - * macros defined in H5private.h. + * Purpose: This file contains the framework for ensuring that the global + * library lock is held when an API routine is called. This + * framework works in concert with the FUNC_ENTER_API / FUNC_LEAVE_API + * macros defined in H5private.h. * * Note: Because this threadsafety framework operates outside the library, - * it does not use the error stack and only uses the "namecheck only" - * FUNC_ENTER_* / FUNC_LEAVE_* macros. + * it does not use the error stack and only uses the "namecheck only" + * FUNC_ENTER_* / FUNC_LEAVE_* macros. */ /****************/ @@ -56,7 +55,7 @@ typedef void *(*H5TS_thread_cb_t)(void *); /* Local Prototypes */ /********************/ static void H5TS__key_destructor(void *key_val); -static herr_t H5TS__mutex_acquire(H5TS_mutex_t *mutex, unsigned int lock_count, hbool_t *acquired); +static herr_t H5TS__mutex_acquire(H5TS_mutex_t *mutex, unsigned int lock_count, bool *acquired); static herr_t H5TS__mutex_unlock(H5TS_mutex_t *mutex, unsigned int *lock_count); /*********************/ @@ -149,10 +148,6 @@ static H5TS_key_t H5TS_tid_key; * Frees the memory for a key. Called by each thread as it exits. * Currently all the thread-specific information for all keys are simple * structures allocated with malloc, so we can free them all uniformly. - * - * PROGRAMMER: Quincey Koziol - * February 7, 2003 - * *-------------------------------------------------------------------------- */ static void @@ -160,9 +155,9 @@ H5TS__key_destructor(void *key_val) { FUNC_ENTER_PACKAGE_NAMECHECK_ONLY - /* Use HDfree here instead of H5MM_xfree(), to avoid calling the H5CS routines */ + /* Use free() here instead of H5MM_xfree(), to avoid calling the H5CS routines */ if (key_val != NULL) - HDfree(key_val); + free(key_val); FUNC_LEAVE_NOAPI_VOID_NAMECHECK_ONLY } /* end H5TS__key_destructor() */ @@ -271,7 +266,7 @@ H5TS_thread_id(void) /* If a prototype ID record was established, copy it to the heap. */ if (tid == &proto_tid) - if ((tid = HDmalloc(sizeof(*tid))) != NULL) + if ((tid = malloc(sizeof(*tid))) != NULL) *tid = proto_tid; if (tid == NULL) @@ -311,8 +306,8 @@ H5TS_thread_id(void) void H5TS_pthread_first_thread_init(void) { - H5_g.H5_libinit_g = FALSE; /* Library hasn't been initialized */ - H5_g.H5_libterm_g = FALSE; /* Library isn't being shutdown */ + H5_g.H5_libinit_g = false; /* Library hasn't been initialized */ + H5_g.H5_libterm_g = false; /* Library isn't being shutdown */ FUNC_ENTER_NOAPI_NAMECHECK_ONLY @@ -362,14 +357,10 @@ H5TS_pthread_first_thread_init(void) * Note: The Windows threads code is very likely bogus. * * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Februrary 27, 2019 - * *-------------------------------------------------------------------------- */ static herr_t -H5TS__mutex_acquire(H5TS_mutex_t *mutex, unsigned int lock_count, hbool_t *acquired) +H5TS__mutex_acquire(H5TS_mutex_t *mutex, unsigned int lock_count, bool *acquired) { herr_t ret_value = SUCCEED; @@ -377,7 +368,7 @@ H5TS__mutex_acquire(H5TS_mutex_t *mutex, unsigned int lock_count, hbool_t *acqui #ifdef H5_HAVE_WIN_THREADS EnterCriticalSection(&mutex->CriticalSection); - *acquired = TRUE; + *acquired = true; #else /* H5_HAVE_WIN_THREADS */ /* Attempt to acquire the mutex lock */ if (0 == pthread_mutex_lock(&mutex->atomic_lock)) { @@ -389,21 +380,21 @@ H5TS__mutex_acquire(H5TS_mutex_t *mutex, unsigned int lock_count, hbool_t *acqui if (pthread_equal(my_thread_id, mutex->owner_thread)) { /* Already owned by self - increment count */ mutex->lock_count += lock_count; - *acquired = TRUE; - } /* end if */ + *acquired = true; + } else - *acquired = FALSE; - } /* end if */ + *acquired = false; + } else { /* Take ownership of the mutex */ mutex->owner_thread = my_thread_id; mutex->lock_count = lock_count; - *acquired = TRUE; - } /* end else */ + *acquired = true; + } if (0 != pthread_mutex_unlock(&mutex->atomic_lock)) ret_value = -1; - } /* end if */ + } else ret_value = -1; #endif /* H5_HAVE_WIN_THREADS */ @@ -420,14 +411,10 @@ H5TS__mutex_acquire(H5TS_mutex_t *mutex, unsigned int lock_count, hbool_t *acqui * global lock was acquired. * * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Februrary 27, 2019 - * *-------------------------------------------------------------------------- */ herr_t -H5TSmutex_acquire(unsigned int lock_count, hbool_t *acquired){ +H5TSmutex_acquire(unsigned int lock_count, bool *acquired){ FUNC_ENTER_API_NAMECHECK_ONLY FUNC_LEAVE_API_NAMECHECK_ONLY(H5TS__mutex_acquire(&H5_g.init_lock, lock_count, acquired))} @@ -488,7 +475,7 @@ herr_t H5TS_mutex_lock(H5TS_mutex_t *mutex) /* After we've received the signal, take ownership of the mutex */ mutex->owner_thread = pthread_self(); mutex->lock_count = 1; - } /* end else */ + } /* Release the library lock */ ret_value = pthread_mutex_unlock(&mutex->atomic_lock); @@ -546,7 +533,7 @@ H5TS__mutex_unlock(H5TS_mutex_t *mutex, unsigned int *lock_count) err = pthread_cond_signal(&mutex->cond_var); if (err != 0) ret_value = err; - } /* end if */ + } done: #endif /* H5_HAVE_WIN_THREADS */ @@ -601,7 +588,7 @@ H5TS_mutex_unlock(H5TS_mutex_t *mutex) err = pthread_cond_signal(&mutex->cond_var); if (err != 0) ret_value = err; - } /* end if */ + } done: #endif /* H5_HAVE_WIN_THREADS */ @@ -614,10 +601,6 @@ H5TS_mutex_unlock(H5TS_mutex_t *mutex) * Purpose: Get the current count of the global lock attempt * * Return: Non-negative on success / Negative on failure - * - * Programmer: Houjun Tang - * June 24, 2019 - * *-------------------------------------------------------------------------- */ herr_t @@ -651,10 +634,6 @@ H5TSmutex_get_attempt_count(unsigned int *count) * Purpose: Releases the HDF5 library global lock * * Return: Non-negative on success / Negative on failure - * - * Programmer: Quincey Koziol - * Februrary 27, 2019 - * *-------------------------------------------------------------------------- */ herr_t @@ -717,20 +696,20 @@ H5TS_cancel_count_inc(void) * First time thread calls library - create new counter and associate * with key. * - * Don't use H5MM calls here since the destructor has to use HDfree in + * Don't use H5MM calls here since the destructor has to use free in * order to avoid codestack calls. */ - cancel_counter = (H5TS_cancel_t *)HDcalloc(1, sizeof(H5TS_cancel_t)); + cancel_counter = (H5TS_cancel_t *)calloc(1, sizeof(H5TS_cancel_t)); if (NULL == cancel_counter) HGOTO_DONE(FAIL); /* Set the thread's cancellation counter with the new object */ ret_value = pthread_setspecific(H5TS_cancel_key_s, (void *)cancel_counter); if (ret_value) { - HDfree(cancel_counter); + free(cancel_counter); HGOTO_DONE(FAIL); - } /* end if */ - } /* end if */ + } + } /* Check if thread entering library */ if (cancel_counter->cancel_count == 0) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tarray.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tarray.c index 43a6a460b7..2c3d7c18d1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tarray.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tarray.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -76,9 +75,6 @@ * Return: Success: ID of new array datatype * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, Oct 17, 2007 - * *------------------------------------------------------------------------- */ hid_t @@ -94,27 +90,27 @@ H5Tarray_create2(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */]) /* Check args */ if (ndims < 1 || ndims > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dimensionality") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dimensionality"); if (!dim) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no dimensions specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no dimensions specified"); for (u = 0; u < ndims; u++) if (!(dim[u] > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "zero-sized dimension specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "zero-sized dimension specified"); if (NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an valid base datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an valid base datatype"); /* Create the array datatype */ if (NULL == (dt = H5T__array_create(base, ndims, dim))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to create datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to create datatype"); /* Register the type */ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype"); done: if (ret_value < 0) if (dt && H5T_close_real(dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "can't release datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "can't release datatype"); FUNC_LEAVE_API(ret_value) } /* end H5Tarray_create2() */ @@ -131,9 +127,6 @@ H5Tarray_create2(hid_t base_id, unsigned ndims, const hsize_t dim[/* ndims */]) * Return: Success: ID of new array data type * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, Oct 26, 2000 - * *------------------------------------------------------------------------- */ H5T_t * @@ -144,18 +137,18 @@ H5T__array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */]) FUNC_ENTER_PACKAGE - HDassert(base); - HDassert(ndims <= H5S_MAX_RANK); - HDassert(dim); + assert(base); + assert(ndims <= H5S_MAX_RANK); + assert(dim); /* Build new type */ if (NULL == (ret_value = H5T__alloc())) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); ret_value->shared->type = H5T_ARRAY; /* Copy the base type of the array */ if (NULL == (ret_value->shared->parent = H5T_copy(base, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy base datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy base datatype"); /* Set the array parameters */ ret_value->shared->u.array.ndims = ndims; @@ -188,9 +181,6 @@ H5T__array_create(H5T_t *base, unsigned ndims, const hsize_t dim[/* ndims */]) * Return: Success: Number of dimensions of the array datatype * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, November 6, 2000 - * *------------------------------------------------------------------------- */ int @@ -204,9 +194,9 @@ H5Tget_array_ndims(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (dt->shared->type != H5T_ARRAY) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype"); /* Retrieve the number of dimensions */ ret_value = H5T__get_array_ndims(dt); @@ -224,9 +214,6 @@ H5Tget_array_ndims(hid_t type_id) * Return: Success: Number of dimensions of the array datatype * Failure: Negative * - * Programmer: Raymond Lu - * October 10, 2002 - * *------------------------------------------------------------------------- */ int @@ -234,8 +221,8 @@ H5T__get_array_ndims(const H5T_t *dt) { FUNC_ENTER_PACKAGE_NOERR - HDassert(dt); - HDassert(dt->shared->type == H5T_ARRAY); + assert(dt); + assert(dt->shared->type == H5T_ARRAY); /* Retrieve the number of dimensions */ FUNC_LEAVE_NOAPI((int)dt->shared->u.array.ndims) @@ -249,9 +236,6 @@ H5T__get_array_ndims(const H5T_t *dt) * Return: Success: Number of dimensions of the array type * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, October 17, 2007 - * *------------------------------------------------------------------------- */ int @@ -265,13 +249,13 @@ H5Tget_array_dims2(hid_t type_id, hsize_t dims[] /*out*/) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (dt->shared->type != H5T_ARRAY) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype"); /* Retrieve the sizes of the dimensions */ if ((ret_value = H5T__get_array_dims(dt, dims)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes"); done: FUNC_LEAVE_API(ret_value) } /* end H5Tget_array_dims2() */ @@ -285,9 +269,6 @@ H5Tget_array_dims2(hid_t type_id, hsize_t dims[] /*out*/) * Return: Success: Number of dimensions of the array type * Failure: Negative * - * Programmer: Raymond Lu - * October 10, 2002 - * *------------------------------------------------------------------------- */ int @@ -297,8 +278,8 @@ H5T__get_array_dims(const H5T_t *dt, hsize_t dims[]) FUNC_ENTER_PACKAGE_NOERR - HDassert(dt); - HDassert(dt->shared->type == H5T_ARRAY); + assert(dt); + assert(dt->shared->type == H5T_ARRAY); /* Retrieve the sizes of the dimensions */ if (dims) @@ -325,9 +306,6 @@ H5T__get_array_dims(const H5T_t *dt, hsize_t dims[]) * Return: Success: ID of new array datatype * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, Oct 26, 2000 - * *------------------------------------------------------------------------- */ hid_t @@ -344,27 +322,27 @@ H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */], /* Check args */ if (ndims < 1 || ndims > H5S_MAX_RANK) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dimensionality") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid dimensionality"); if (!dim) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no dimensions specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no dimensions specified"); for (u = 0; u < (unsigned)ndims; u++) if (!(dim[u] > 0)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "zero-sized dimension specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "zero-sized dimension specified"); if (NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an valid base datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an valid base datatype"); /* Create the array datatype */ if (NULL == (dt = H5T__array_create(base, (unsigned)ndims, dim))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to create datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to create datatype"); /* Register the type */ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype"); done: if (ret_value < 0) if (dt && H5T_close_real(dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "can't release datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "can't release datatype"); FUNC_LEAVE_API(ret_value) } /* end H5Tarray_create1() */ @@ -377,9 +355,6 @@ H5Tarray_create1(hid_t base_id, int ndims, const hsize_t dim[/* ndims */], * Return: Success: Number of dimensions of the array type * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, November 6, 2000 - * *------------------------------------------------------------------------- */ int @@ -393,13 +368,13 @@ H5Tget_array_dims1(hid_t type_id, hsize_t dims[] /*out*/, int H5_ATTR_UNUSED per /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object"); if (dt->shared->type != H5T_ARRAY) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype"); /* Retrieve the sizes of the dimensions */ if ((ret_value = H5T__get_array_dims(dt, dims)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tbit.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tbit.c index 5a3ce1e222..29d5347ae7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tbit.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tbit.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -175,8 +174,8 @@ H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(buf); - HDassert(size); + assert(buf); + assert(size); if (shift_dist) { size_t abs_shift_dist = (size_t)ABS(shift_dist); @@ -189,11 +188,11 @@ H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size) /* Wrap the local buffer for serialized header info */ if (NULL == (wb = H5WB_wrap(tmp_buf, sizeof(tmp_buf)))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't wrap buffer") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't wrap buffer"); /* Get a pointer to a buffer that's large enough */ if (NULL == (shift_buf = (uint8_t *)H5WB_actual(wb, buf_size))) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "can't get actual buffer") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "can't get actual buffer"); /* Shift vector by making copies */ if (shift_dist > 0) { /* left shift */ @@ -217,7 +216,7 @@ H5T__bit_shift(uint8_t *buf, ssize_t shift_dist, size_t offset, size_t size) done: /* Release resources */ if (wb && H5WB_unwrap(wb) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "can't close wrapped buffer"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__bit_shift() */ @@ -241,7 +240,7 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) FUNC_ENTER_PACKAGE_NOERR - HDassert(8 * sizeof(val) >= size); + assert(8 * sizeof(val) >= size); H5T__bit_copy((uint8_t *)&val, (size_t)0, buf, offset, size); switch (H5T_native_order_g) { @@ -262,7 +261,7 @@ H5T__bit_get_d(uint8_t *buf, size_t offset, size_t size) case H5T_ORDER_MIXED: default: /* This function can't return errors */ - HDassert(0 && "unknown byte order"); + assert(0 && "unknown byte order"); } /* Set return value */ @@ -287,7 +286,7 @@ H5T__bit_set_d(uint8_t *buf, size_t offset, size_t size, uint64_t val) FUNC_ENTER_PACKAGE_NOERR - HDassert(8 * sizeof(val) >= size); + assert(8 * sizeof(val) >= size); switch (H5T_native_order_g) { case H5T_ORDER_LE: @@ -395,7 +394,7 @@ H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t directi FUNC_ENTER_PACKAGE_NOERR /* Some functions call this with value=TRUE */ - HDassert(TRUE == 1); + assert(TRUE == 1); switch (direction) { case H5T_BIT_LSB: @@ -465,7 +464,7 @@ H5T__bit_find(const uint8_t *buf, size_t offset, size_t size, H5T_sdir_t directi break; default: - HDassert(0 && "Unknown bit search direction"); + assert(0 && "Unknown bit search direction"); } /* end switch */ done: @@ -492,7 +491,7 @@ H5T__bit_inc(uint8_t *buf, size_t start, size_t size) /* Use FUNC_ENTER_PACKAGE_NOERR here to avoid performance issues */ FUNC_ENTER_PACKAGE_NOERR - HDassert(buf); + assert(buf); start %= 8; @@ -557,8 +556,8 @@ H5T__bit_dec(uint8_t *buf, size_t start, size_t size) /* Use FUNC_ENTER_PACKAGE_NOERR here to avoid performance issues */ FUNC_ENTER_PACKAGE_NOERR - HDassert(buf); - HDassert(size); + assert(buf); + assert(size); /* The first partial byte */ if ((size + start - 1) / 8 > idx) { @@ -632,8 +631,8 @@ H5T__bit_neg(uint8_t *buf, size_t start, size_t size) /* Use FUNC_ENTER_PACKAGE_NOERR here to avoid performance issues */ FUNC_ENTER_PACKAGE_NOERR - HDassert(buf); - HDassert(size); + assert(buf); + assert(size); /* The first partial byte */ tmp[0] = (uint8_t)~buf[idx]; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tcommit.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tcommit.c index 47468fb0e5..2973f5ecde 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tcommit.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tcommit.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -110,41 +109,41 @@ H5T__commit_api_common(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl /* Check arguments */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string"); if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_is_named(dt)) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed"); /* Get correct property list */ if (H5P_DEFAULT == lcpl_id) lcpl_id = H5P_LINK_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link creation property list"); /* Get correct property list */ if (H5P_DEFAULT == tcpl_id) tcpl_id = H5P_DATATYPE_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list"); /* Set the LCPL for the API context */ H5CX_set_lcpl(lcpl_id); /* Set up object access arguments */ if (H5VL_setup_acc_args(loc_id, H5P_CLS_TACC, TRUE, &tapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set object access arguments") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set object access arguments"); /* Commit the type */ if (NULL == (data = H5VL_datatype_commit(*vol_obj_ptr, &loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype"); /* Set up VOL object */ if (NULL == (new_obj = H5VL_create_object(data, (*vol_obj_ptr)->connector))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't create VOL object for committed datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't create VOL object for committed datatype"); /* Set the committed type object to the VOL connector pointer in the H5T_t struct */ dt->vol_obj = new_obj; @@ -161,9 +160,6 @@ H5T__commit_api_common(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * April 5, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -177,7 +173,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, hid_t t /* Commit the dataset synchronously */ if ((ret_value = H5T__commit_api_common(loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id, NULL, NULL)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to commit datatype synchronously") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to commit datatype synchronously"); done: FUNC_LEAVE_API(ret_value) @@ -212,7 +208,7 @@ H5Tcommit_async(const char *app_file, const char *app_func, unsigned app_line, h /* Commit the datatype asynchronously */ if ((ret_value = H5T__commit_api_common(loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to commit datatype asynchronously") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, FAIL, "unable to commit datatype asynchronously"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -220,7 +216,7 @@ H5Tcommit_async(const char *app_file, const char *app_func, unsigned app_line, h if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE10(__func__, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -234,9 +230,6 @@ H5Tcommit_async(const char *app_file, const char *app_func, unsigned app_line, h * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * April 5, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -250,11 +243,11 @@ H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(loc); - HDassert(name && *name); - HDassert(dt); - HDassert(lcpl_id != H5P_DEFAULT); - HDassert(tcpl_id != H5P_DEFAULT); + assert(loc); + assert(name && *name); + assert(dt); + assert(lcpl_id != H5P_DEFAULT); + assert(tcpl_id != H5P_DEFAULT); /* Record the type's state so that we can revert to it if linking fails */ old_state = dt->shared->state; @@ -270,8 +263,8 @@ H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_ /* Create the new named datatype and link it to its parent group */ if (H5L_link_object(loc, name, &ocrt_info, lcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create and link to named datatype") - HDassert(ocrt_info.new_obj); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create and link to named datatype"); + assert(ocrt_info.new_obj); done: /* If the datatype was committed but something failed after that, we need @@ -281,22 +274,22 @@ H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_ if (dt->shared->state == H5T_STATE_OPEN && dt->sh_loc.type == H5O_SHARE_TYPE_COMMITTED) { /* Remove the datatype from the list of opened objects in the file */ if (H5FO_top_decr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object") + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't decrement count for object"); if (H5FO_delete(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, - "can't remove dataset from list of open objects") + "can't remove dataset from list of open objects"); /* Close the datatype object */ if (H5O_close(&(dt->oloc), NULL) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header"); /* Remove the datatype's object header from the file */ if (H5O_delete(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header"); /* Mark datatype as being back in memory */ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY)) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to return datatype to memory") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to return datatype to memory"); dt->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; dt->shared->state = old_state; } /* end if */ @@ -319,9 +312,6 @@ H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt, hid_t lcpl_ * * Return: Non-negative on success/Negative on failure * - * Programmer: Peter Cao - * May 17, 2005 - * *------------------------------------------------------------------------- */ herr_t @@ -339,24 +329,24 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) /* Check arguments */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_is_named(type)) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed"); /* Get correct property list */ if (H5P_DEFAULT == tcpl_id) tcpl_id = H5P_DATATYPE_CREATE_DEFAULT; else if (TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list"); if (H5P_DEFAULT == tapl_id) tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; else if (TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&tapl_id, H5P_CLS_TACC, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info"); /* Fill in location struct fields */ loc_params.type = H5VL_OBJECT_BY_SELF; @@ -364,16 +354,16 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) /* Get the file object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); /* Commit the datatype */ if (NULL == (dt = H5VL_datatype_commit(vol_obj, &loc_params, NULL, type_id, H5P_LINK_CREATE_DEFAULT, tcpl_id, tapl_id, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype"); /* Setup VOL object */ if (NULL == (new_obj = H5VL_create_object(dt, vol_obj->connector))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't create VOL object for committed datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't create VOL object for committed datatype"); /* Set the committed type object to the VOL connector pointer in the H5T_t struct */ type->vol_obj = new_obj; @@ -389,9 +379,6 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Tuesday, December 12, 2017 - * *------------------------------------------------------------------------- */ herr_t @@ -403,23 +390,23 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(file); - HDassert(type); - HDassert(tcpl_id != H5P_DEFAULT); + assert(file); + assert(type); + assert(tcpl_id != H5P_DEFAULT); /* Commit the type */ if (H5T__commit(file, type, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype"); /* Release the datatype's object header */ /* Get the new committed datatype's object location */ if (NULL == (oloc = H5T_oloc(type))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get object location of committed datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get object location of committed datatype"); /* Decrement refcount on committed datatype's object header in memory */ if (H5O_dec_rc_by_loc(oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -433,9 +420,6 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, June 1, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -449,13 +433,13 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id) FUNC_ENTER_PACKAGE - HDassert(file); - HDassert(type); - HDassert(tcpl_id != H5P_DEFAULT); + assert(file); + assert(type); + assert(tcpl_id != H5P_DEFAULT); /* Check if we are allowed to write to this file */ if (0 == (H5F_INTENT(file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "no write intent on file") + HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "no write intent on file"); /* * Check arguments. We cannot commit an immutable type because H5Tclose() @@ -463,50 +447,50 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id) * a named type should always succeed. */ if (H5T_STATE_NAMED == type->shared->state || H5T_STATE_OPEN == type->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is already committed") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is already committed"); if (H5T_STATE_IMMUTABLE == type->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is immutable") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is immutable"); /* Check for a "sensible" datatype to store on disk */ if (H5T_is_sensible(type) <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "datatype is not sensible") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "datatype is not sensible"); /* Mark datatype as being on disk now. This step changes the size of * datatype as stored on disk. */ if (H5T_set_loc(type, H5F_VOL_OBJ(file), H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype on disk"); /* Reset datatype location and path */ if (H5O_loc_reset(&temp_oloc) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize location") + HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize location"); if (H5G_name_reset(&temp_path) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize path") + HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize path"); loc_init = TRUE; /* Set the version for datatype */ if (H5T_set_version(file, type) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set version of datatype"); /* Calculate message size information, for creating object header */ dtype_size = H5O_msg_size_f(file, tcpl_id, H5O_DTYPE_ID, type, (size_t)0); - HDassert(dtype_size); + assert(dtype_size); /* * Create the object header and open it for write access. Insert the data * type message and then give the object header a name. */ if (H5O_create(file, dtype_size, (size_t)1, tcpl_id, &temp_oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to create datatype object header"); if (H5O_msg_create(&temp_oloc, H5O_DTYPE_ID, H5O_MSG_FLAG_CONSTANT | H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, type) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to update type header message"); /* Copy the new object header's location into the datatype, taking ownership of it */ if (H5O_loc_copy_shallow(&(type->oloc), &temp_oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location"); if (H5G_name_copy(&(type->path), &temp_path, H5_COPY_SHALLOW) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy datatype location"); loc_init = FALSE; /* Set the shared info fields */ @@ -516,15 +500,15 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id) /* Add datatype to the list of open objects in the file */ if (H5FO_top_incr(type->sh_loc.file, type->sh_loc.u.loc.oh_addr) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, FAIL, "can't incr object ref. count") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, FAIL, "can't incr object ref. count"); if (H5FO_insert(type->sh_loc.file, type->sh_loc.u.loc.oh_addr, type->shared, TRUE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert datatype into list of open objects") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert datatype into list of open objects"); /* Mark datatype as being on memory again. Since this datatype may still be * used in memory after committed to disk, change its size back as in memory. */ if (H5T_set_loc(type, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype in memory") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "cannot mark datatype in memory"); done: if (ret_value < 0) { @@ -536,11 +520,11 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id) (type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED)) { if (H5O_dec_rc_by_loc(&(type->oloc)) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, - "unable to decrement refcount on newly created object") + "unable to decrement refcount on newly created object"); if (H5O_close(&(type->oloc), NULL) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, FAIL, "unable to release object header"); if (H5O_delete(file, type->sh_loc.u.loc.oh_addr) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "unable to delete object header"); type->sh_loc.type = H5O_SHARE_TYPE_UNSHARED; } /* end if */ } /* end if */ @@ -555,9 +539,6 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id) * * Return: TRUE/FALSE/Negative * - * Programmer: Robb Matzke - * Thursday, June 4, 1998 - * *------------------------------------------------------------------------- */ htri_t @@ -571,7 +552,7 @@ H5Tcommitted(hid_t type_id) /* Check arguments */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Set return value */ ret_value = H5T_is_named(type); @@ -589,9 +570,6 @@ H5Tcommitted(hid_t type_id) * Return: Success: New link count * Failure: -1 * - * Programmer: Quincey Koziol - * Friday, September 26, 2003 - * *------------------------------------------------------------------------- */ int @@ -601,12 +579,12 @@ H5T_link(const H5T_t *type, int adjust) FUNC_ENTER_NOAPI((-1)) - HDassert(type); - HDassert(type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); + assert(type); + assert(type->sh_loc.type == H5O_SHARE_TYPE_COMMITTED); /* Adjust the link count on the named datatype */ if ((ret_value = H5O_link(&type->oloc, adjust)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_LINKCOUNT, (-1), "unable to adjust named datatype link count") + HGOTO_ERROR(H5E_DATATYPE, H5E_LINKCOUNT, (-1), "unable to adjust named datatype link count"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -638,28 +616,28 @@ H5T__open_api_common(hid_t loc_id, const char *name, hid_t tapl_id, void **token /* Check args */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string"); /* Set up object access arguments */ if (H5VL_setup_acc_args(loc_id, H5P_CLS_TACC, FALSE, &tapl_id, vol_obj_ptr, &loc_params) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments"); /* Open the datatype */ if (NULL == (dt = H5VL_datatype_open(*vol_obj_ptr, &loc_params, name, tapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype"); /* Register the type and return the ID */ if ((ret_value = H5VL_register(H5I_DATATYPE, dt, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype"); done: /* Cleanup on error */ if (H5I_INVALID_HID == ret_value) if (dt && H5VL_datatype_close(*vol_obj_ptr, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__open_api_common() */ @@ -674,9 +652,6 @@ H5T__open_api_common(hid_t loc_id, const char *name, hid_t tapl_id, void **token * * Failure: H5I_INVALID_HID * - * Programmer: James Laird - * Thursday July 27, 2006 - * *------------------------------------------------------------------------- */ hid_t @@ -690,7 +665,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) /* Open the datatype synchronously */ if ((ret_value = H5T__open_api_common(loc_id, name, tapl_id, NULL, NULL)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, - "unable to open named datatype synchronously") + "unable to open named datatype synchronously"); done: FUNC_LEAVE_API(ret_value) } /* end H5Topen2() */ @@ -725,7 +700,7 @@ H5Topen_async(const char *app_file, const char *app_func, unsigned app_line, hid /* Open the datatype asynchronously */ if ((ret_value = H5T__open_api_common(loc_id, name, tapl_id, token_ptr, &vol_obj)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, - "unable to open named datatype asynchronously") + "unable to open named datatype asynchronously"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -735,8 +710,8 @@ H5Topen_async(const char *app_file, const char *app_func, unsigned app_line, hid /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, H5I_INVALID_HID, - "can't decrement count on datatype ID") - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + "can't decrement count on datatype ID"); + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set"); } /* end if */ done: @@ -757,9 +732,6 @@ H5Topen_async(const char *app_file, const char *app_func, unsigned app_line, hid * * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 - * *------------------------------------------------------------------------- */ hid_t @@ -774,11 +746,11 @@ H5Tget_create_plist(hid_t dtype_id) /* Check arguments */ if (NULL == (type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype"); /* Check if the datatype is committed */ if (FAIL == (is_named = H5T_is_named(type))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't check whether datatype is committed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't check whether datatype is committed"); /* If the datatype is not committed/named, just copy the default * creation property list and return that. @@ -788,10 +760,10 @@ H5Tget_create_plist(hid_t dtype_id) /* Copy the default datatype creation property list */ if (NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list"); if ((ret_value = H5P_copy_plist(tcpl_plist, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, - "unable to copy the creation property list") + "unable to copy the creation property list"); } /* end if */ /* If the datatype is committed, retrieve further information */ else { @@ -804,7 +776,7 @@ H5Tget_create_plist(hid_t dtype_id) /* Get the property list through the VOL */ if (H5VL_datatype_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info"); /* Set return value */ ret_value = vol_cb_args.args.get_tcpl.tcpl_id; @@ -821,9 +793,6 @@ H5Tget_create_plist(hid_t dtype_id) * * Return: Non-negative on success, negative on failure * - * Programmer: Mike McGreevy - * May 19, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -837,9 +806,9 @@ H5Tflush(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (!H5T_is_named(dt)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype"); /* Flush metadata for named datatype */ if (dt->vol_obj) { @@ -847,14 +816,14 @@ H5Tflush(hid_t type_id) /* Set up collective metadata if appropriate */ if (H5CX_set_loc(type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATATYPE_FLUSH; vol_cb_args.args.flush.type_id = type_id; if (H5VL_datatype_specific(dt->vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype"); } done: @@ -868,9 +837,6 @@ H5Tflush(hid_t type_id) * * Return: Non-negative on success, negative on failure * - * Programmer: Mike McGreevy - * July 21, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -884,9 +850,9 @@ H5Trefresh(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (!H5T_is_named(dt)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype"); /* Refresh the datatype's metadata */ if (dt->vol_obj) { @@ -894,14 +860,14 @@ H5Trefresh(hid_t type_id) /* Set up collective metadata if appropriate */ if (H5CX_set_loc(type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATATYPE_REFRESH; vol_cb_args.args.refresh.type_id = type_id; if (H5VL_datatype_specific(dt->vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype"); } done: @@ -922,9 +888,6 @@ H5Trefresh(hid_t type_id) * * Failure: H5I_INVALID_HID * - * Programmer: Quincey Koziol - * Wednesday, December 13, 2017 - * *------------------------------------------------------------------------- */ hid_t @@ -938,21 +901,21 @@ H5T__get_create_plist(const H5T_t *type) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(type); + assert(type); /* Copy the default datatype creation property list */ if (NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_ID_g))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get default creation property list"); if ((new_tcpl_id = H5P_copy_plist(tcpl_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to copy the creation property list"); /* Get property list object for new TCPL */ if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(new_tcpl_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get property list") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "can't get property list"); /* Retrieve any object creation properties */ if (H5O_get_create_plist(&type->oloc, new_plist) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info"); /* Set the return value */ ret_value = new_tcpl_id; @@ -961,7 +924,7 @@ H5T__get_create_plist(const H5T_t *type) if (ret_value < 0) if (new_tcpl_id > 0) if (H5I_dec_app_ref(new_tcpl_id) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, H5I_INVALID_HID, "unable to close temporary object") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, H5I_INVALID_HID, "unable to close temporary object"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_create_plist() */ @@ -974,9 +937,6 @@ H5T__get_create_plist(const H5T_t *type) * Return: Success: Ptr to a new datatype. * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, December 13, 2017 - * *------------------------------------------------------------------------- */ H5T_t * @@ -993,8 +953,8 @@ H5T__open_name(const H5G_loc_t *loc, const char *name) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(loc); - HDassert(name); + assert(loc); + assert(name); /* Set up datatype location to fill in */ type_loc.oloc = &oloc; @@ -1006,27 +966,27 @@ H5T__open_name(const H5G_loc_t *loc, const char *name) * from it. */ if (H5G_loc_find(loc, name, &type_loc /*out*/) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "not found") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "not found"); obj_found = TRUE; /* Check that the object found is the correct type */ if (H5O_obj_type(&oloc, &obj_type) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, NULL, "can't get object type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, NULL, "can't get object type"); if (obj_type != H5O_TYPE_NAMED_DATATYPE) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "not a named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, NULL, "not a named datatype"); /* Open it */ if (NULL == (dt = H5T_open(&type_loc))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype"); ret_value = dt; done: /* Error cleanup */ if (NULL == ret_value) - if (obj_found && H5F_addr_defined(type_loc.oloc->addr)) + if (obj_found && H5_addr_defined(type_loc.oloc->addr)) if (H5G_loc_free(&type_loc) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "can't free location") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__open_name() */ @@ -1040,9 +1000,6 @@ H5T__open_name(const H5G_loc_t *loc, const char *name) * * Failure: NULL * - * Programmer: Robb Matzke - * Monday, June 1, 1998 - * *------------------------------------------------------------------------- */ H5T_t * @@ -1054,7 +1011,7 @@ H5T_open(const H5G_loc_t *loc) FUNC_ENTER_NOAPI(NULL) - HDassert(loc); + assert(loc); /* Check if datatype was already open */ if (NULL == (shared_fo = (H5T_shared_t *)H5FO_opened(loc->oloc->file, loc->oloc->addr))) { @@ -1063,44 +1020,45 @@ H5T_open(const H5G_loc_t *loc) /* Open the datatype object */ if (NULL == (dt = H5T__open_oid(loc))) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "not found") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "not found"); /* Add the datatype to the list of opened objects in the file */ if (H5FO_insert(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr, dt->shared, FALSE) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, NULL, "can't insert datatype into list of open objects") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, NULL, + "can't insert datatype into list of open objects"); /* Increment object count for the object in the top file */ if (H5FO_top_incr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count"); /* Mark any datatypes as being in memory now */ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location"); dt->shared->fo_count = 1; } /* end if */ else { if (NULL == (dt = H5FL_MALLOC(H5T_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype"); dt->vol_obj = NULL; #if defined(H5_USING_MEMCHECKER) || !defined(NDEBUG) /* Clear object location */ if (H5O_loc_reset(&(dt->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reset location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reset location"); /* Clear path name */ if (H5G_name_reset(&(dt->path)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reset path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to reset path"); #endif /* H5_USING_MEMCHECKER */ /* Shallow copy (take ownership) of the object location object */ if (H5O_loc_copy_shallow(&dt->oloc, loc->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy object location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy object location"); /* Shallow copy (take ownership) of the group hier. path */ if (H5G_name_copy(&(dt->path), loc->path, H5_COPY_SHALLOW) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy path"); /* Set the shared component info */ H5T_update_shared(dt); @@ -1110,7 +1068,7 @@ H5T_open(const H5G_loc_t *loc) /* Mark any datatypes as being in memory now */ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location"); /* Increment ref. count on shared info */ shared_fo->fo_count++; @@ -1119,12 +1077,12 @@ H5T_open(const H5G_loc_t *loc) if (H5FO_top_count(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) == 0) { /* Open the object through this top file */ if (H5O_open(&(dt->oloc)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open object header"); } /* end if */ /* Increment object count for the object in the top file */ if (H5FO_top_incr(dt->sh_loc.file, dt->sh_loc.u.loc.oh_addr) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, NULL, "can't increment object count"); } /* end else */ ret_value = dt; @@ -1134,7 +1092,7 @@ H5T_open(const H5G_loc_t *loc) if (dt) { if (shared_fo == NULL) { /* Need to free shared file object */ if (dt->shared->owned_vol_obj && H5VL_free_object(dt->shared->owned_vol_obj) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "unable to close owned VOL object"); dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); } /* end if */ @@ -1160,9 +1118,6 @@ H5T_open(const H5G_loc_t *loc) * * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, March 17, 1999 - * *------------------------------------------------------------------------- */ static H5T_t * @@ -1173,26 +1128,26 @@ H5T__open_oid(const H5G_loc_t *loc) FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr) - HDassert(loc); + assert(loc); /* Open named datatype object in file */ if (H5O_open(loc->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype"); /* Deserialize the datatype message into a datatype in memory */ if (NULL == (dt = (H5T_t *)H5O_msg_read(loc->oloc, H5O_DTYPE_ID, NULL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to load type message from object header"); /* Mark the type as named and open */ dt->shared->state = H5T_STATE_OPEN; /* Shallow copy (take ownership) of the object location object */ if (H5O_loc_copy_shallow(&dt->oloc, loc->oloc) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy object location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy object location"); /* Shallow copy (take ownership) of the group hier. path */ if (H5G_name_copy(&(dt->path), loc->path, H5_COPY_SHALLOW) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy path") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy path"); /* Set the shared component info */ H5T_update_shared(dt); @@ -1215,9 +1170,6 @@ H5T__open_oid(const H5G_loc_t *loc) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, April 13, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -1225,7 +1177,7 @@ H5T_update_shared(H5T_t *dt) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(dt); + assert(dt); /* Set the shared location fields from the named datatype info */ H5O_UPDATE_SHARED(&(dt->sh_loc), H5O_SHARE_TYPE_COMMITTED, dt->oloc.file, H5O_DTYPE_ID, 0, dt->oloc.addr) @@ -1260,11 +1212,11 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) /* Get required buf size for encoding the datatype */ if (H5VL_datatype_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size"); /* Allocate buffer to store binary description of the datatype */ if (NULL == (buf = (void *)H5MM_calloc(nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_DATATYPE_GET_BINARY; @@ -1273,11 +1225,11 @@ H5T_construct_datatype(H5VL_object_t *vol_obj) /* get binary description of the datatype */ if (H5VL_datatype_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype"); /* Construct datatype, from serialized form in buffer */ if (NULL == (dt = H5T_decode(nalloc, buf))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't decode datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't decode datatype"); dt->vol_obj = vol_obj; /* Set return value */ @@ -1359,20 +1311,20 @@ H5T_save_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared) FUNC_ENTER_NOAPI(FAIL) - HDassert(cached_H5O_shared); + assert(cached_H5O_shared); if (NULL == (dt = (H5T_t *)H5I_object_verify(tid, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not a datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not a datatype ID"); vol_dt = H5T_get_actual_type(dt); if (NULL == vol_dt) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID"); /* Increase the count on the file object */ vol_dt->shared->fo_count += 1; /* Increment object count for the object in the top file */ if (H5FO_top_incr(vol_dt->sh_loc.file, vol_dt->sh_loc.u.loc.oh_addr) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, FAIL, "can't increment object count") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINC, FAIL, "can't increment object count"); /* Cache the H5O_shared_t data */ H5MM_memcpy(cached_H5O_shared, &(vol_dt->sh_loc), sizeof(H5O_shared_t)); @@ -1399,20 +1351,20 @@ H5T_restore_refresh_state(hid_t tid, H5O_shared_t *cached_H5O_shared) FUNC_ENTER_NOAPI(FAIL) - HDassert(cached_H5O_shared); + assert(cached_H5O_shared); if (NULL == (dt = (H5T_t *)H5I_object_verify(tid, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid not a datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid not a datatype ID"); vol_dt = H5T_get_actual_type(dt); if (NULL == vol_dt) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "tid is not not a named datatype ID"); /* Restore the H5O_shared_t data */ H5MM_memcpy(&(vol_dt->sh_loc), cached_H5O_shared, sizeof(H5O_shared_t)); /* Decrement the ref. count for this object in the top file */ if (H5FO_top_decr(vol_dt->sh_loc.file, vol_dt->sh_loc.u.loc.oh_addr) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "can't decrement object count") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "can't decrement object count"); /* Decrease the count on the file object */ vol_dt->shared->fo_count -= 1; @@ -1436,7 +1388,7 @@ H5T_already_vol_managed(const H5T_t *dt) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(dt); + assert(dt); FUNC_LEAVE_NOAPI(dt->vol_obj != NULL) } /* end H5T_already_vol_managed() */ @@ -1461,12 +1413,12 @@ H5T_invoke_vol_optional(H5T_t *dt, H5VL_optional_args_t *args, hid_t dxpl_id, vo /* Check that datatype is committed */ if (!H5T_is_named(dt)) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a committed datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a committed datatype"); /* Only invoke callback if VOL object is set for the datatype */ if (dt->vol_obj) if (H5VL_datatype_optional_op(dt->vol_obj, args, dxpl_id, req, vol_obj_ptr) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tcompound.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tcompound.c index 6d31a1e13b..725525bb77 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tcompound.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tcompound.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -80,9 +79,6 @@ static H5T_t *H5T__reopen_member_type(const H5T_t *dt, unsigned membno); * H5Tget_member_dims() fails with the same * arguments. * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ size_t @@ -96,9 +92,9 @@ H5Tget_member_offset(hid_t type_id, unsigned membno) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a compound datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a compound datatype"); if (membno >= dt->shared->u.compnd.nmembs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid member number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid member number"); /* Value */ ret_value = H5T_GET_MEMBER_OFFSET(dt->shared, membno); @@ -121,9 +117,6 @@ H5Tget_member_offset(hid_t type_id, unsigned membno) * H5Tget_member_dims() fails with the same * arguments. * - * Programmer: Raymond Lu - * October 8, 2002 - * *------------------------------------------------------------------------- */ size_t @@ -131,8 +124,8 @@ H5T_get_member_offset(const H5T_t *dt, unsigned membno) { FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(dt); - HDassert(membno < dt->shared->u.compnd.nmembs); + assert(dt); + assert(membno < dt->shared->u.compnd.nmembs); FUNC_LEAVE_NOAPI(dt->shared->u.compnd.memb[membno].offset) } /* end H5T_get_member_offset() */ @@ -146,9 +139,6 @@ H5T_get_member_offset(const H5T_t *dt, unsigned membno) * * Failure: H5T_NO_CLASS * - * Programmer: Quincey Koziol - * Thursday, November 9, 2000 - * *------------------------------------------------------------------------- */ H5T_class_t @@ -162,9 +152,9 @@ H5Tget_member_class(hid_t type_id, unsigned membno) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a compound datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NO_CLASS, "not a compound datatype"); if (membno >= dt->shared->u.compnd.nmembs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5T_NO_CLASS, "invalid member number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5T_NO_CLASS, "invalid member number"); /* Get the type's class. We have to use this function to get type class * because of the concern of variable-length string. @@ -188,9 +178,6 @@ H5Tget_member_class(hid_t type_id, unsigned membno) * * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ hid_t @@ -205,22 +192,22 @@ H5Tget_member_type(hid_t type_id, unsigned membno) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_COMPOUND != dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a compound datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a compound datatype"); if (membno >= dt->shared->u.compnd.nmembs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid member number"); /* Retrieve the datatype for the member */ if (NULL == (memb_dt = H5T__reopen_member_type(dt, membno))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to retrieve member type"); /* Get an ID for the datatype */ if ((ret_value = H5I_register(H5I_DATATYPE, memb_dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype ID") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable register datatype ID"); done: if (ret_value < 0) if (memb_dt && H5T_close(memb_dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, H5I_INVALID_HID, "can't close datatype"); FUNC_LEAVE_API(ret_value) } /* end H5Tget_member_type() */ @@ -236,9 +223,6 @@ H5Tget_member_type(hid_t type_id, unsigned membno) * * Failure: NULL * - * Programmer: Raymond Lu - * October 8, 2002 - * *------------------------------------------------------------------------- */ H5T_t * @@ -249,12 +233,12 @@ H5T_get_member_type(const H5T_t *dt, unsigned membno) FUNC_ENTER_NOAPI(NULL) /* Sanity checks */ - HDassert(dt); - HDassert(membno < dt->shared->u.compnd.nmembs); + assert(dt); + assert(membno < dt->shared->u.compnd.nmembs); /* Copy datatype */ if (NULL == (ret_value = H5T_copy(dt->shared->u.compnd.memb[membno].type, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy member datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to copy member datatype"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -272,9 +256,6 @@ H5T_get_member_type(const H5T_t *dt, unsigned membno) * * Failure: NULL * - * Programmer: David Young - * January 18, 2020 - * *------------------------------------------------------------------------- */ static H5T_t * @@ -285,12 +266,12 @@ H5T__reopen_member_type(const H5T_t *dt, unsigned membno) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(dt); - HDassert(membno < dt->shared->u.compnd.nmembs); + assert(dt); + assert(membno < dt->shared->u.compnd.nmembs); /* Copy datatype, possibly re-opening it */ if (NULL == (ret_value = H5T_copy_reopen(dt->shared->u.compnd.memb[membno].type))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to reopen member datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "unable to reopen member datatype"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -304,9 +285,6 @@ H5T__reopen_member_type(const H5T_t *dt, unsigned membno) * Return: Success: The size in bytes of the member's datatype. * Failure: 0 * - * Programmer: Quincey Koziol - * October 4, 2004 - * *------------------------------------------------------------------------- */ size_t @@ -314,8 +292,8 @@ H5T__get_member_size(const H5T_t *dt, unsigned membno) { FUNC_ENTER_PACKAGE_NOERR - HDassert(dt); - HDassert(membno < dt->shared->u.compnd.nmembs); + assert(dt); + assert(membno < dt->shared->u.compnd.nmembs); FUNC_LEAVE_NOAPI(dt->shared->u.compnd.memb[membno].type->shared->size) } /* end H5T__get_member_size() */ @@ -337,9 +315,6 @@ H5T__get_member_size(const H5T_t *dt, unsigned membno) * * Errors: * - * Programmer: Robb Matzke - * Monday, December 8, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -354,20 +329,20 @@ H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id) /* Check args */ if (parent_id == member_id) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't insert compound datatype within itself") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't insert compound datatype within itself"); if (NULL == (parent = (H5T_t *)H5I_object_verify(parent_id, H5I_DATATYPE)) || H5T_COMPOUND != parent->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype"); if (H5T_STATE_TRANSIENT != parent->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parent type read-only") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "parent type read-only"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no member name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no member name"); if (NULL == (member = (H5T_t *)H5I_object_verify(member_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Insert */ if (H5T__insert(parent, name, offset, member) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "unable to insert member") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "unable to insert member"); done: FUNC_LEAVE_API(ret_value) @@ -381,9 +356,6 @@ H5Tinsert(hid_t parent_id, const char *name, size_t offset, hid_t member_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -398,11 +370,11 @@ H5Tpack(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)) || H5T_detect_class(dt, H5T_COMPOUND, TRUE) <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a compound datatype"); /* Pack */ if (H5T__pack(dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack compound datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack compound datatype"); done: FUNC_LEAVE_API(ret_value) @@ -418,9 +390,6 @@ H5Tpack(hid_t type_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, December 8, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -434,15 +403,15 @@ H5T__insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) FUNC_ENTER_PACKAGE /* check args */ - HDassert(parent && H5T_COMPOUND == parent->shared->type); - HDassert(H5T_STATE_TRANSIENT == parent->shared->state); - HDassert(member); - HDassert(name && *name); + assert(parent && H5T_COMPOUND == parent->shared->type); + assert(H5T_STATE_TRANSIENT == parent->shared->state); + assert(member); + assert(name && *name); /* Does NAME already exist in PARENT? */ for (i = 0; i < parent->shared->u.compnd.nmembs; i++) if (!HDstrcmp(parent->shared->u.compnd.memb[i].name, name)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member name is not unique") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member name is not unique"); /* Does the new member overlap any existing member ? */ total_size = member->shared->size; @@ -451,11 +420,11 @@ H5T__insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) (offset + total_size) > parent->shared->u.compnd.memb[i].offset) || (parent->shared->u.compnd.memb[i].offset <= offset && (parent->shared->u.compnd.memb[i].offset + parent->shared->u.compnd.memb[i].size) > offset)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member overlaps with another member") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member overlaps with another member"); /* Does the new member overlap the end of the compound type? */ if ((offset + total_size) > parent->shared->size) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member extends past end of compound type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "member extends past end of compound type"); /* Increase member array if necessary */ if (parent->shared->u.compnd.nmembs >= parent->shared->u.compnd.nalloc) { @@ -463,17 +432,19 @@ H5T__insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) H5T_cmemb_t *x = (H5T_cmemb_t *)H5MM_realloc(parent->shared->u.compnd.memb, na * sizeof(H5T_cmemb_t)); if (!x) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed"); parent->shared->u.compnd.nalloc = na; parent->shared->u.compnd.memb = x; } /* end if */ /* Add member to end of member array */ idx = parent->shared->u.compnd.nmembs; - parent->shared->u.compnd.memb[idx].name = H5MM_xstrdup(name); parent->shared->u.compnd.memb[idx].offset = offset; parent->shared->u.compnd.memb[idx].size = total_size; - parent->shared->u.compnd.memb[idx].type = H5T_copy(member, H5T_COPY_ALL); + if (NULL == (parent->shared->u.compnd.memb[idx].name = H5MM_xstrdup(name))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "couldn't duplicate name string"); + if (NULL == (parent->shared->u.compnd.memb[idx].type = H5T_copy(member, H5T_COPY_ALL))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "couldn't copy datatype"); parent->shared->u.compnd.sorted = H5T_SORT_NONE; parent->shared->u.compnd.nmembs++; @@ -481,7 +452,7 @@ H5T__insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) /* It should not be possible to get this far if the type is already packed * - the new member would overlap something */ - HDassert(!(parent->shared->u.compnd.packed)); + assert(!(parent->shared->u.compnd.packed)); /* Determine if the compound datatype becomes packed */ H5T__update_packed(parent); @@ -497,7 +468,7 @@ H5T__insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) * more efficient, so might as well upgrade all members also... -QAK) */ if (H5T__upgrade_version(parent, member->shared->version) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade member encoding version") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't upgrade member encoding version"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -511,9 +482,6 @@ H5T__insert(H5T_t *parent, const char *name, size_t offset, const H5T_t *member) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -523,20 +491,20 @@ H5T__pack(const H5T_t *dt) FUNC_ENTER_PACKAGE - HDassert(dt); + assert(dt); if (H5T_detect_class(dt, H5T_COMPOUND, FALSE) > 0) { /* If datatype has been packed, skip packing it and indicate success */ if (TRUE == H5T__is_packed(dt)) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Check for packing unmodifiable datatype */ if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "datatype is read-only"); if (dt->shared->parent) { if (H5T__pack(dt->shared->parent) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack parent of datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to pack parent of datatype"); /* Adjust size of datatype appropriately */ if (dt->shared->type == H5T_ARRAY) @@ -552,7 +520,7 @@ H5T__pack(const H5T_t *dt) for (i = 0; i < dt->shared->u.compnd.nmembs; i++) { if (H5T__pack(dt->shared->u.compnd.memb[i].type) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, - "unable to pack part of a compound datatype") + "unable to pack part of a compound datatype"); /* Update the member size */ dt->shared->u.compnd.memb[i].size = (dt->shared->u.compnd.memb[i].type)->shared->size; @@ -560,7 +528,7 @@ H5T__pack(const H5T_t *dt) /* Remove padding between members */ if (H5T__sort_value(dt, NULL) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOMPARE, FAIL, "value sort failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOMPARE, FAIL, "value sort failed"); for (i = 0, offset = 0; i < dt->shared->u.compnd.nmembs; i++) { dt->shared->u.compnd.memb[i].offset = offset; offset += dt->shared->u.compnd.memb[i].size; @@ -586,9 +554,6 @@ H5T__pack(const H5T_t *dt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, September 11, 2003 - * *------------------------------------------------------------------------- */ static htri_t @@ -598,7 +563,7 @@ H5T__is_packed(const H5T_t *dt) FUNC_ENTER_PACKAGE_NOERR - HDassert(dt); + assert(dt); /* Go up the chain as far as possible */ while (dt->shared->parent) @@ -621,9 +586,6 @@ H5T__is_packed(const H5T_t *dt) * * Return: void * - * Programmer: Neil Fortner - * Monday, October 19, 2009 - * *------------------------------------------------------------------------- */ void @@ -633,8 +595,8 @@ H5T__update_packed(const H5T_t *dt) FUNC_ENTER_PACKAGE_NOERR - HDassert(dt); - HDassert(dt->shared->type == H5T_COMPOUND); + assert(dt); + assert(dt->shared->type == H5T_COMPOUND); /* First check if all space is used in the "top level" type */ if (dt->shared->size == dt->shared->u.compnd.memb_size) { diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tconv.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tconv.c index f976c80df4..f6b9b915b7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tconv.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tconv.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -192,7 +191,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = (DT)(D_MAX); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else if (*(S) < (ST)(D_MIN)) { \ @@ -202,7 +201,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = (DT)(D_MIN); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else \ @@ -229,7 +228,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = (DT)(D_MAX); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else \ @@ -259,7 +258,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = 0; \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else \ @@ -320,7 +319,7 @@ /* Let compiler convert if case is ignored by user handler */ \ *(D) = (DT)(D_MAX); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if (except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else \ @@ -382,7 +381,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = 0; \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else if (sizeof(ST) > sizeof(DT) && *(S) > (ST)(D_MAX)) { \ @@ -392,7 +391,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = (DT)(D_MAX); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else \ @@ -436,7 +435,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = 0; \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else \ @@ -467,7 +466,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = (DT)(D_MAX); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else \ @@ -506,7 +505,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else if (*(S) < (ST)(D_MIN)) { \ @@ -516,7 +515,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else \ @@ -614,7 +613,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = (DT)(*(S)); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else \ @@ -650,7 +649,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = (DT)(D_MAX); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else if (*(S) < (ST)(D_MIN)) { \ @@ -660,7 +659,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = (DT)(D_MIN); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else if (*(S) != (ST)((DT)(*(S)))) { \ @@ -670,7 +669,7 @@ /* Let compiler convert if case is ignored by user handler*/ \ *(D) = (DT)(*(S)); \ else if (except_ret == H5T_CONV_ABORT) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ } \ else \ @@ -731,9 +730,9 @@ if (NULL == (st = (H5T_t *)H5I_object(src_id)) || \ NULL == (dt = (H5T_t *)H5I_object(dst_id))) \ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \ - "unable to dereference datatype object ID") \ + "unable to dereference datatype object ID"); \ if (st->shared->size != sizeof(ST) || dt->shared->size != sizeof(DT)) \ - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "disagreement about datatype size") \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "disagreement about datatype size"); \ CI_ALLOC_PRIV \ break; \ \ @@ -746,8 +745,8 @@ case H5T_CONV_CONV: \ /* Initialize source & destination strides */ \ if (buf_stride) { \ - HDassert(buf_stride >= sizeof(ST)); \ - HDassert(buf_stride >= sizeof(DT)); \ + assert(buf_stride >= sizeof(ST)); \ + assert(buf_stride >= sizeof(DT)); \ s_stride = d_stride = (ssize_t)buf_stride; \ } \ else { \ @@ -770,13 +769,13 @@ /* Get conversion exception callback property */ \ if (H5CX_get_dt_conv_cb(&cb_struct) < 0) \ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, \ - "unable to get conversion exception callback") \ + "unable to get conversion exception callback"); \ \ /* Get source and destination datatypes */ \ if (NULL == (st = (H5T_t *)H5I_object(src_id)) || \ NULL == (dt = (H5T_t *)H5I_object(dst_id))) \ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \ - "unable to dereference datatype object ID") \ + "unable to dereference datatype object ID"); \ \ H5T_CONV_SET_PREC(PREC) /*init precision variables, or not */ \ \ @@ -871,13 +870,13 @@ done: #define H5T_CONV_SET_PREC_Y \ /* Get source & destination precisions into a variable */ \ tclass = st->shared->type; \ - HDassert(tclass == H5T_INTEGER || tclass == H5T_FLOAT); \ + assert(tclass == H5T_INTEGER || tclass == H5T_FLOAT); \ if (tclass == H5T_INTEGER) \ sprec = st->shared->u.atomic.prec; \ else \ sprec = 1 + st->shared->u.atomic.u.f.msize; \ tclass = dt->shared->type; \ - HDassert(tclass == H5T_INTEGER || tclass == H5T_FLOAT); \ + assert(tclass == H5T_INTEGER || tclass == H5T_FLOAT); \ if (tclass == H5T_INTEGER) \ dprec = dt->shared->u.atomic.prec; \ else \ @@ -888,7 +887,17 @@ done: /* Macro defining action on source data which needs to be aligned (before main action) */ #define H5T_CONV_LOOP_PRE_SALIGN(ST) \ { \ - H5MM_memcpy(&src_aligned, src, sizeof(ST)); \ + /* The uint8_t * cast is required to avoid tripping over undefined behavior. \ + * \ + * The typed pointer arrives via a void pointer, which may have any alignment. \ + * We then cast it to a pointer to a type that is assumed to be aligned, which \ + * is undefined behavior (section 6.3.2.3 paragraph 7 of the C99 standard). \ + * In the past this hasn't caused many problems, but in some cases (e.g. \ + * converting long doubles on macOS), an optimizing compiler might do the \ + * wrong thing (in the macOS case, the conversion uses SSE, which has stricter \ + * requirements about alignment). \ + */ \ + H5MM_memcpy(&src_aligned, (const uint8_t *)src, sizeof(ST)); \ } /* Macro defining action on source data which doesn't need to be aligned (before main action) */ @@ -920,7 +929,17 @@ done: /* Macro defining action on destination data which needs to be aligned (after main action) */ #define H5T_CONV_LOOP_POST_DALIGN(DT) \ { \ - H5MM_memcpy(dst, &dst_aligned, sizeof(DT)); \ + /* The uint8_t * cast is required to avoid tripping over undefined behavior. \ + * \ + * The typed pointer arrives via a void pointer, which may have any alignment. \ + * We then cast it to a pointer to a type that is assumed to be aligned, which \ + * is undefined behavior (section 6.3.2.3 paragraph 7 of the C99 standard). \ + * In the past this hasn't caused many problems, but in some cases (e.g. \ + * converting long doubles on macOS), an optimizing compiler might do the \ + * wrong thing (in the macOS case, the conversion uses SSE, which has stricter \ + * requirements about alignment). \ + */ \ + H5MM_memcpy((uint8_t *)dst, &dst_aligned, sizeof(DT)); \ } /* Macro defining action on destination data which doesn't need to be aligned (after main action) */ @@ -981,16 +1000,16 @@ done: /* Print alignment statistics */ #define CI_PRINT_STATS(STYPE, DTYPE) \ - { \ + do { \ if (H5DEBUG(T) && ((H5T_conv_hw_t *)cdata->priv)->s_aligned) { \ - HDfprintf(H5DEBUG(T), " %zu src elements aligned on %zu-byte boundaries\n", \ - ((H5T_conv_hw_t *)cdata->priv)->s_aligned, H5T_NATIVE_##STYPE##_ALIGN_g); \ + fprintf(H5DEBUG(T), " %zu src elements aligned on %zu-byte boundaries\n", \ + ((H5T_conv_hw_t *)cdata->priv)->s_aligned, H5T_NATIVE_##STYPE##_ALIGN_g); \ } \ if (H5DEBUG(T) && ((H5T_conv_hw_t *)cdata->priv)->d_aligned) { \ - HDfprintf(H5DEBUG(T), " %zu dst elements aligned on %zu-byte boundaries\n", \ - ((H5T_conv_hw_t *)cdata->priv)->d_aligned, H5T_NATIVE_##DTYPE##_ALIGN_g); \ + fprintf(H5DEBUG(T), " %zu dst elements aligned on %zu-byte boundaries\n", \ + ((H5T_conv_hw_t *)cdata->priv)->d_aligned, H5T_NATIVE_##DTYPE##_ALIGN_g); \ } \ - } + } while (0) /* Allocate private alignment structure for atomic types */ #define CI_ALLOC_PRIV \ @@ -1022,12 +1041,12 @@ done: /* Swap two elements (I & J) of an array using a temporary variable */ #define H5_SWAP_BYTES(ARRAY, I, J) \ - { \ + do { \ uint8_t _tmp; \ _tmp = ARRAY[I]; \ ARRAY[I] = ARRAY[J]; \ ARRAY[J] = _tmp; \ - } + } while (0) /* Minimum size of variable-length conversion buffer */ #define H5T_VLEN_MIN_CONF_BUF_SIZE 4096 @@ -1102,9 +1121,6 @@ H5FL_BLK_DEFINE_STATIC(ref_seq); * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 14, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1129,7 +1145,7 @@ H5T__conv_noop(hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, H5T_cda break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -1147,9 +1163,6 @@ H5T__conv_noop(hid_t H5_ATTR_UNUSED src_id, hid_t H5_ATTR_UNUSED dst_id, H5T_cda * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 25, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -1168,21 +1181,21 @@ H5T__conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt case H5T_CONV_INIT: /* Capability query */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (src->shared->size != dst->shared->size || 0 != src->shared->u.atomic.offset || 0 != dst->shared->u.atomic.offset) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); if ((src->shared->type == H5T_REFERENCE && dst->shared->type != H5T_REFERENCE) || (dst->shared->type == H5T_REFERENCE && src->shared->type != H5T_REFERENCE)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); if (src->shared->type != H5T_REFERENCE && !((H5T_ORDER_BE == src->shared->u.atomic.order && H5T_ORDER_LE == dst->shared->u.atomic.order) || (H5T_ORDER_LE == src->shared->u.atomic.order && H5T_ORDER_BE == dst->shared->u.atomic.order))) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); if (src->shared->size != 1 && src->shared->size != 2 && src->shared->size != 4 && src->shared->size != 8 && src->shared->size != 16) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); switch (src->shared->type) { case H5T_INTEGER: case H5T_BITFIELD: @@ -1199,7 +1212,7 @@ H5T__conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt src->shared->u.atomic.u.f.msize != dst->shared->u.atomic.u.f.msize || src->shared->u.atomic.u.f.norm != dst->shared->u.atomic.u.f.norm || src->shared->u.atomic.u.f.pad != dst->shared->u.atomic.u.f.pad) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); break; case H5T_NO_CLASS: @@ -1212,7 +1225,7 @@ H5T__conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt case H5T_ARRAY: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); } cdata->need_bkg = H5T_BKG_NO; break; @@ -1220,13 +1233,13 @@ H5T__conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt case H5T_CONV_CONV: /* The conversion */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Check for "no op" reference conversion */ if (src->shared->type == H5T_REFERENCE) { /* Sanity check */ if (dst->shared->type != H5T_REFERENCE) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_REFERENCE datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_REFERENCE datatype"); /* Check if we are on a little-endian machine (the order that * the addresses in the file must be) and just get out now, there @@ -1530,7 +1543,7 @@ H5T__conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "invalid conversion size") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "invalid conversion size"); } /* end switch */ break; @@ -1539,7 +1552,7 @@ H5T__conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -1556,9 +1569,6 @@ H5T__conv_order_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, January 13, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -1578,14 +1588,14 @@ H5T__conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s case H5T_CONV_INIT: /* Capability query */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (src->shared->size != dst->shared->size || 0 != src->shared->u.atomic.offset || 0 != dst->shared->u.atomic.offset || !((H5T_ORDER_BE == src->shared->u.atomic.order && H5T_ORDER_LE == dst->shared->u.atomic.order) || (H5T_ORDER_LE == src->shared->u.atomic.order && H5T_ORDER_BE == dst->shared->u.atomic.order))) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); switch (src->shared->type) { case H5T_INTEGER: case H5T_BITFIELD: @@ -1601,7 +1611,7 @@ H5T__conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s src->shared->u.atomic.u.f.msize != dst->shared->u.atomic.u.f.msize || src->shared->u.atomic.u.f.norm != dst->shared->u.atomic.u.f.norm || src->shared->u.atomic.u.f.pad != dst->shared->u.atomic.u.f.pad) { - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); } /* end if */ break; @@ -1616,7 +1626,7 @@ H5T__conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s case H5T_ARRAY: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "conversion not supported"); } /* end switch */ cdata->need_bkg = H5T_BKG_NO; break; @@ -1624,7 +1634,7 @@ H5T__conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s case H5T_CONV_CONV: /* The conversion */ if (NULL == (src = (H5T_t *)H5I_object(src_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); buf_stride = buf_stride ? buf_stride : src->shared->size; md = src->shared->size / 2; @@ -1638,7 +1648,7 @@ H5T__conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -1652,9 +1662,6 @@ H5T__conv_order(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 20, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -1683,11 +1690,11 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_CONV_INIT: /* Capability query */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_ORDER_LE != src->shared->u.atomic.order && H5T_ORDER_BE != src->shared->u.atomic.order) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); if (H5T_ORDER_LE != dst->shared->u.atomic.order && H5T_ORDER_BE != dst->shared->u.atomic.order) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); cdata->need_bkg = H5T_BKG_NO; break; @@ -1697,7 +1704,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_CONV_CONV: /* Get the datatypes */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* * Do we process the values from beginning to end or vice versa? Also, @@ -1728,7 +1735,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Get conversion exception callback property */ if (H5CX_get_dt_conv_cb(&cb_struct) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); /* Allocate space for order-reversed source buffer */ src_rev = (uint8_t *)H5MM_calloc(src->shared->size); @@ -1754,11 +1761,11 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ if (d == dbuf) - HDassert((dp >= sp && dp < sp + src->shared->size) || - (sp >= dp && sp < dp + dst->shared->size)); + assert((dp >= sp && dp < sp + src->shared->size) || + (sp >= dp && sp < dp + dst->shared->size)); else - HDassert((dp < sp && dp + dst->shared->size <= sp) || - (sp < dp && sp + src->shared->size <= dp)); + assert((dp < sp && dp + dst->shared->size <= sp) || + (sp < dp && sp + src->shared->size <= dp)); #endif /* @@ -1798,7 +1805,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz dst->shared->u.atomic.prec); } else if (except_ret == H5T_CONV_ABORT) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) /*Don't reverse because user handles it*/ reverse = FALSE; @@ -1826,7 +1833,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_PAD_BACKGROUND: case H5T_NPAD: default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported LSB padding") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported LSB padding"); } /* end switch */ msb_pad_offset = dst->shared->u.atomic.offset + dst->shared->u.atomic.prec; switch (dst->shared->u.atomic.msb_pad) { @@ -1842,7 +1849,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_PAD_BACKGROUND: case H5T_NPAD: default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported MSB padding") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported MSB padding"); } /* end switch */ /* @@ -1883,7 +1890,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -1900,9 +1907,6 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * * Return: The result of H5MM_xfree(priv) (NULL) * - * Programmer: Neil Fortner - * Wednesday, October 1, 2008 - * *------------------------------------------------------------------------- */ static H5T_conv_struct_t * @@ -1919,9 +1923,9 @@ H5T__conv_struct_free(H5T_conv_struct_t *priv) int H5_ATTR_NDEBUG_UNUSED status; status = H5I_dec_ref(src_memb_id[i]); - HDassert(status >= 0); + assert(status >= 0); status = H5I_dec_ref(dst_memb_id[src2dst[i]]); - HDassert(status >= 0); + assert(status >= 0); } /* end if */ H5MM_xfree(src2dst); @@ -1973,9 +1977,6 @@ H5T__conv_struct_free(H5T_conv_struct_t *priv) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, January 26, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -2000,7 +2001,7 @@ H5T__conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) NULL == (priv->src2dst = (int *)H5MM_malloc(src_nmembs * sizeof(int))) || NULL == (priv->src_memb_id = (hid_t *)H5MM_malloc(src_nmembs * sizeof(hid_t))) || NULL == (priv->dst_memb_id = (hid_t *)H5MM_malloc(dst_nmembs * sizeof(hid_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); src2dst = priv->src2dst; priv->src_nmembs = src_nmembs; @@ -2036,12 +2037,12 @@ H5T__conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) type = H5T_copy(src->shared->u.compnd.memb[i].type, H5T_COPY_ALL); tid = H5I_register(H5I_DATATYPE, type, FALSE); - HDassert(tid >= 0); + assert(tid >= 0); priv->src_memb_id[i] = tid; type = H5T_copy(dst->shared->u.compnd.memb[src2dst[i]].type, H5T_COPY_ALL); tid = H5I_register(H5I_DATATYPE, type, FALSE); - HDassert(tid >= 0); + assert(tid >= 0); priv->dst_memb_id[src2dst[i]] = tid; } /* end if */ } /* end for */ @@ -2061,7 +2062,7 @@ H5T__conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) H5MM_xfree(priv->memb_path); if (NULL == (priv->memb_path = (H5T_path_t **)H5MM_malloc(src->shared->u.compnd.nmembs * sizeof(H5T_path_t *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); for (i = 0; i < src_nmembs; i++) { if (src2dst[i] >= 0) { @@ -2070,7 +2071,7 @@ H5T__conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) if (NULL == (priv->memb_path[i] = tpath)) { cdata->priv = H5T__conv_struct_free(priv); - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert member datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unable to convert member datatype"); } /* end if */ } /* end if */ } /* end for */ @@ -2123,7 +2124,6 @@ H5T__conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) else /* If the numbers of source and dest members are equal and no conversion is needed, * the case should have been handled as noop earlier in H5Dio.c. */ { - ; } cdata->recalc = FALSE; @@ -2151,9 +2151,6 @@ H5T__conv_struct_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) * Return: A pointer to the subset info struct in p. Points directly * into the structure. * - * Programmer: Raymond Lu - * 8 June 2007 - * *------------------------------------------------------------------------- */ H5T_subset_info_t * @@ -2163,8 +2160,8 @@ H5T__conv_struct_subset(const H5T_cdata_t *cdata) FUNC_ENTER_PACKAGE_NOERR - HDassert(cdata); - HDassert(cdata->priv); + assert(cdata); + assert(cdata->priv); priv = (H5T_conv_struct_t *)(cdata->priv); @@ -2192,9 +2189,6 @@ H5T__conv_struct_subset(const H5T_cdata_t *cdata) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, January 22, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2229,14 +2223,14 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * that remains (almost) constant for this conversion path. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_COMPOUND != src->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype"); if (H5T_COMPOUND != dst->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype"); if (H5T__conv_struct_init(src, dst, cdata) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data"); break; case H5T_CONV_FREE: @@ -2251,12 +2245,12 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * Conversion. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") - HDassert(priv); - HDassert(bkg && cdata->need_bkg); + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype"); + assert(priv); + assert(bkg && cdata->need_bkg); if (cdata->recalc && H5T__conv_struct_init(src, dst, cdata) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data"); /* * Insure that members are sorted. @@ -2311,12 +2305,12 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, (size_t)0, /*no striding (packed array)*/ xbuf + src_memb->offset, xbkg + dst_memb->offset) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, - "unable to convert compound datatype member") - HDmemmove(xbuf + offset, xbuf + src_memb->offset, dst_memb->size); + "unable to convert compound datatype member"); + memmove(xbuf + offset, xbuf + src_memb->offset, dst_memb->size); offset += dst_memb->size; } /* end if */ else { - HDmemmove(xbuf + offset, xbuf + src_memb->offset, src_memb->size); + memmove(xbuf + offset, xbuf + src_memb->offset, src_memb->size); offset += src_memb->size; } /* end else */ } /* end for */ @@ -2342,13 +2336,13 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, (size_t)0, /*no striding (packed array)*/ xbuf + offset, xbkg + dst_memb->offset) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, - "unable to convert compound datatype member") + "unable to convert compound datatype member"); } /* end if */ else offset -= dst_memb->size; - HDmemmove(xbkg + dst_memb->offset, xbuf + offset, dst_memb->size); + memmove(xbkg + dst_memb->offset, xbuf + offset, dst_memb->size); } /* end for */ - HDassert(0 == offset); + assert(0 == offset); /* * Update pointers @@ -2366,7 +2360,7 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * buffer. */ for (xbuf = buf, xbkg = bkg, elmtno = 0; elmtno < nelmts; elmtno++) { - HDmemmove(xbuf, xbkg, dst->shared->size); + memmove(xbuf, xbkg, dst->shared->size); xbuf += buf_stride ? buf_stride : dst->shared->size; xbkg += bkg_delta; } /* end for */ @@ -2374,7 +2368,7 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, default: /* Some other command we don't know about yet.*/ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -2419,9 +2413,6 @@ H5T__conv_struct(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, January 22, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -2457,15 +2448,15 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * that remains (almost) constant for this conversion path. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_COMPOUND != src->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype"); if (H5T_COMPOUND != dst->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_COMPOUND datatype"); /* Initialize data which is relatively constant */ if (H5T__conv_struct_init(src, dst, cdata) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data"); priv = (H5T_conv_struct_t *)(cdata->priv); src2dst = priv->src2dst; @@ -2499,7 +2490,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm if (dst_memb->size > src->shared->size - offset) { cdata->priv = H5T__conv_struct_free(priv); HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "conversion is unsupported by this function") + "conversion is unsupported by this function"); } /* end if */ } /* end if */ } /* end for */ @@ -2518,15 +2509,15 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * Conversion. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Update cached data if necessary */ if (cdata->recalc && H5T__conv_struct_init(src, dst, cdata) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize conversion data"); priv = (H5T_conv_struct_t *)(cdata->priv); - HDassert(priv); + assert(priv); src2dst = priv->src2dst; - HDassert(bkg && cdata->need_bkg); + assert(bkg && cdata->need_bkg); /* * Insure that members are sorted. @@ -2560,7 +2551,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm copy_size = priv->subset_info.copy_size; for (elmtno = 0; elmtno < nelmts; elmtno++) { - HDmemmove(xbkg, xbuf, copy_size); + memmove(xbkg, xbuf, copy_size); /* Update pointers */ xbuf += buf_stride; @@ -2588,16 +2579,16 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm priv->dst_memb_id[src2dst[u]], nelmts, buf_stride, bkg_stride, xbuf, xbkg) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, - "unable to convert compound datatype member") + "unable to convert compound datatype member"); for (elmtno = 0; elmtno < nelmts; elmtno++) { - HDmemmove(xbkg, xbuf, dst_memb->size); + memmove(xbkg, xbuf, dst_memb->size); xbuf += buf_stride; xbkg += bkg_stride; } /* end for */ } /* end if */ else { for (xbuf = buf, elmtno = 0; elmtno < nelmts; elmtno++) { - HDmemmove(xbuf + offset, xbuf + src_memb->offset, src_memb->size); + memmove(xbuf + offset, xbuf + src_memb->offset, src_memb->size); xbuf += buf_stride; } /* end for */ offset += src_memb->size; @@ -2625,9 +2616,9 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm priv->dst_memb_id[src2dst[i]], nelmts, buf_stride, bkg_stride, xbuf, xbkg) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, - "unable to convert compound datatype member") + "unable to convert compound datatype member"); for (elmtno = 0; elmtno < nelmts; elmtno++) { - HDmemmove(xbkg, xbuf, dst_memb->size); + memmove(xbkg, xbuf, dst_memb->size); xbuf += buf_stride; xbkg += bkg_stride; } /* end for */ @@ -2640,7 +2631,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm /* Move background buffer into result buffer */ for (xbuf = buf, xbkg = bkg, elmtno = 0; elmtno < nelmts; elmtno++) { - HDmemmove(xbuf, xbkg, dst->shared->size); + memmove(xbuf, xbkg, dst->shared->size); xbuf += buf_stride; xbkg += bkg_stride; } /* end for */ @@ -2648,7 +2639,7 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm default: /* Some other command we don't know about yet.*/ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -2664,9 +2655,6 @@ H5T__conv_struct_opt(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Monday, January 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -2684,7 +2672,7 @@ H5T__conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) cdata->need_bkg = H5T_BKG_NO; if (NULL == (priv = (H5T_enum_struct_t *)(cdata->priv = H5MM_calloc(sizeof(*priv))))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); if (0 == src->shared->u.enumer.nmembs) HGOTO_DONE(SUCCEED); @@ -2696,14 +2684,14 @@ H5T__conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) H5T__sort_name(src, NULL); H5T__sort_name(dst, NULL); if (NULL == (priv->src2dst = (int *)H5MM_malloc(src->shared->u.enumer.nmembs * sizeof(int)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); for (i = 0, j = 0; i < src->shared->u.enumer.nmembs && j < dst->shared->u.enumer.nmembs; i++, j++) { while (j < dst->shared->u.enumer.nmembs && HDstrcmp(src->shared->u.enumer.name[i], dst->shared->u.enumer.name[j]) != 0) j++; if (j >= dst->shared->u.enumer.nmembs) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "source type is not a subset of destination type") + "source type is not a subset of destination type"); priv->src2dst[i] = (int)j; } /* end for */ @@ -2750,14 +2738,14 @@ H5T__conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) } } /* end for */ - HDassert(domain[1] >= domain[0]); + assert(domain[1] >= domain[0]); length = (unsigned)(domain[1] - domain[0]) + 1; if (src->shared->u.enumer.nmembs < 2 || (double)length / src->shared->u.enumer.nmembs < (double)(1.2F)) { priv->base = domain[0]; priv->length = length; if (NULL == (map = (int *)H5MM_malloc(length * sizeof(int)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); for (i = 0; i < length; i++) map[i] = -1; /*entry unused*/ for (i = 0; i < src->shared->u.enumer.nmembs; i++) { @@ -2770,8 +2758,8 @@ H5T__conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) n = *( (int *)((void *)((uint8_t *)src->shared->u.enumer.value + (i * src->shared->size)))); n -= priv->base; - HDassert(n >= 0 && (unsigned)n < priv->length); - HDassert(map[n] < 0); + assert(n >= 0 && (unsigned)n < priv->length); + assert(map[n] < 0); map[n] = priv->src2dst[i]; } /* end for */ @@ -2807,8 +2795,6 @@ H5T__conv_enum_init(H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) * * Failure: negative * - * Programmer: Robb Matzke - * Monday, January 4, 1999 *------------------------------------------------------------------------- */ herr_t @@ -2837,22 +2823,21 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si * integer conversion. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_ENUM != src->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype"); if (H5T_ENUM != dst->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype"); if (H5T__conv_enum_init(src, dst, cdata) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize private data") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to initialize private data"); break; case H5T_CONV_FREE: #ifdef H5T_DEBUG if (H5DEBUG(T)) { - HDfprintf(H5DEBUG(T), " Using %s mapping function%s\n", - priv->length ? "O(1)" : "O(log N)", - priv->length ? "" : ", where N is the number of enum members"); + fprintf(H5DEBUG(T), " Using %s mapping function%s\n", priv->length ? "O(1)" : "O(log N)", + priv->length ? "" : ", where N is the number of enum members"); } #endif if (priv) { @@ -2864,11 +2849,11 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si case H5T_CONV_CONV: if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_ENUM != src->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype"); if (H5T_ENUM != dst->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_ENUM datatype"); /* priv->src2dst map was computed for certain sort keys. Make sure those same * sort keys are used here during conversion. See H5T__conv_enum_init(). But @@ -2902,7 +2887,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si /* Get conversion exception callback property */ if (H5CX_get_dt_conv_cb(&cb_struct) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); for (i = 0; i < nelmts; i++, s += src_delta, d += dst_delta) { if (priv->length) { @@ -2929,10 +2914,10 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si cb_struct.user_data); if (except_ret == H5T_CONV_UNHANDLED) - HDmemset(d, 0xff, dst->shared->size); + memset(d, 0xff, dst->shared->size); else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); } else H5MM_memcpy(d, @@ -2949,8 +2934,8 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si while (lt < rt) { md = (lt + rt) / 2; - cmp = HDmemcmp(s, (uint8_t *)src->shared->u.enumer.value + (md * src->shared->size), - src->shared->size); + cmp = memcmp(s, (uint8_t *)src->shared->u.enumer.value + (md * src->shared->size), + src->shared->size); if (cmp < 0) rt = md; else if (cmp > 0) @@ -2966,13 +2951,13 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si cb_struct.user_data); if (except_ret == H5T_CONV_UNHANDLED) - HDmemset(d, 0xff, dst->shared->size); + memset(d, 0xff, dst->shared->size); else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); } /* end if */ else { - HDassert(priv->src2dst[md] >= 0); + assert(priv->src2dst[md] >= 0); H5MM_memcpy(d, (uint8_t *)dst->shared->u.enumer.value + ((unsigned)priv->src2dst[md] * dst->shared->size), @@ -2985,7 +2970,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si default: /* Some other command we don't know about yet.*/ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -3004,8 +2989,6 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si * * Failure: negative * - * Programmer: Raymond Lu - * 12 October 2012 *------------------------------------------------------------------------- */ herr_t @@ -3028,11 +3011,11 @@ H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * path SRC_ID->DST_ID. If not, return failure. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_ENUM != src->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "source type is not a H5T_ENUM datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "source type is not a H5T_ENUM datatype"); if (H5T_INTEGER != dst->shared->type && H5T_FLOAT != dst->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "destination is not an integer type") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "destination is not an integer type"); cdata->need_bkg = H5T_BKG_NO; break; @@ -3042,29 +3025,29 @@ H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne case H5T_CONV_CONV: if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src_parent = src->shared->parent; if (NULL == (tpath = H5T_path_find(src_parent, dst))) { HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, - "unable to convert between src and dest datatype") + "unable to convert between src and dest datatype"); } else if (!H5T_path_noop(tpath)) { if ((src_parent_id = H5I_register(H5I_DATATYPE, H5T_copy(src_parent, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, - "unable to register types for conversion") + "unable to register types for conversion"); /* Convert the data */ if (H5T_convert(tpath, src_parent_id, dst_id, nelmts, buf_stride, bkg_stride, _buf, bkg) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); } break; default: /* Some other command we don't know about yet.*/ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -3094,9 +3077,6 @@ H5T__conv_enum_numeric(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, May 26, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -3139,17 +3119,17 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si * conversion path. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_VLEN != src->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_VLEN datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_VLEN datatype"); if (H5T_VLEN != dst->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_VLEN datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_VLEN datatype"); if (H5T_VLEN_STRING == src->shared->u.vlen.type && H5T_VLEN_STRING == dst->shared->u.vlen.type) { if ((H5T_CSET_ASCII == src->shared->u.vlen.cset && H5T_CSET_UTF8 == dst->shared->u.vlen.cset) || (H5T_CSET_ASCII == dst->shared->u.vlen.cset && H5T_CSET_UTF8 == src->shared->u.vlen.cset)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "The library doesn't convert between strings of ASCII and UTF") + "The library doesn't convert between strings of ASCII and UTF"); } /* end if */ /* Variable-length types don't need a background buffer */ @@ -3166,12 +3146,12 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si * Conversion. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Initialize source & destination strides */ if (buf_stride) { - HDassert(buf_stride >= src->shared->size); - HDassert(buf_stride >= dst->shared->size); + assert(buf_stride >= src->shared->size); + assert(buf_stride >= dst->shared->size); H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t); s_stride = d_stride = (ssize_t)buf_stride; } /* end if */ @@ -3197,19 +3177,19 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si /* Set up conversion path for base elements */ if (NULL == (tpath = H5T_path_find(src->shared->parent, dst->shared->parent))) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "unable to convert between src and dest datatypes") + "unable to convert between src and dest datatypes"); else if (!H5T_path_noop(tpath)) { H5T_t *tsrc_cpy = NULL, *tdst_cpy = NULL; if (NULL == (tsrc_cpy = H5T_copy(src->shared->parent, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy src type for conversion") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy src type for conversion"); /* References need to know about the src file */ if (tsrc_cpy->shared->type == H5T_REFERENCE) if (H5T_set_loc(tsrc_cpy, src->shared->u.vlen.file, src->shared->u.vlen.loc) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); if (NULL == (tdst_cpy = H5T_copy(dst->shared->parent, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy dst type for conversion") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy dst type for conversion"); /* References need to know about the dst file */ if (tdst_cpy->shared->type == H5T_REFERENCE) if (H5T_set_loc(tdst_cpy, dst->shared->u.vlen.file, dst->shared->u.vlen.loc) < 0) @@ -3218,7 +3198,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si if (((tsrc_id = H5I_register(H5I_DATATYPE, tsrc_cpy, FALSE)) < 0) || ((tdst_id = H5I_register(H5I_DATATYPE, tdst_cpy, FALSE)) < 0)) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, - "unable to register types for conversion") + "unable to register types for conversion"); } /* end else-if */ else noop_conv = TRUE; @@ -3226,18 +3206,18 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si /* Check if we need a temporary buffer for this conversion */ if ((parent_is_vlen = H5T_detect_class(dst->shared->parent, H5T_VLEN, FALSE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_SYSTEM, FAIL, - "internal error when detecting variable-length class") + "internal error when detecting variable-length class"); if (tpath->cdata.need_bkg || parent_is_vlen) { /* Set up initial background buffer */ tmp_buf_size = MAX(src_base_size, dst_base_size); if (NULL == (tmp_buf = H5FL_BLK_CALLOC(vlen_seq, tmp_buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "memory allocation failed for type conversion") + "memory allocation failed for type conversion"); } /* end if */ /* Get the allocation info */ if (H5CX_get_vlen_alloc_info(&vl_alloc_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info"); /* Set flags to indicate we are writing to or reading from the file */ if (dst->shared->u.vlen.file != NULL) @@ -3253,9 +3233,9 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si /* Check if we need to go backwards through the buffer */ if (d_stride > s_stride) { /* Sanity check */ - HDassert(s_stride > 0); - HDassert(d_stride > 0); - HDassert(b_stride >= 0); + assert(s_stride > 0); + assert(d_stride > 0); + assert(b_stride >= 0); /* Compute the number of "safe" destination elements at */ /* the end of the buffer (Those which don't overlap with */ @@ -3295,25 +3275,25 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si /* Check for "nil" source sequence */ if ((*(src->shared->u.vlen.cls->isnull))(src->shared->u.vlen.file, s, &is_nil) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if VL data is 'nil'") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if VL data is 'nil'"); else if (is_nil) { /* Write "nil" sequence to destination location */ if ((*(dst->shared->u.vlen.cls->setnull))(dst->shared->u.vlen.file, d, b) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set VL data to 'nil'") + HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set VL data to 'nil'"); } /* end else-if */ else { size_t seq_len; /* The number of elements in the current sequence */ /* Get length of element sequences */ if ((*(src->shared->u.vlen.cls->getlen))(src->shared->u.vlen.file, s, &seq_len) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length"); /* If we are reading from memory and there is no conversion, just get the pointer to * sequence */ if (write_to_file && noop_conv) { /* Get direct pointer to sequence */ if (NULL == (conv_buf = (*(src->shared->u.vlen.cls->getptr))(s))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid source pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid source pointer"); } /* end if */ else { size_t src_size, dst_size; /*source & destination total size in bytes*/ @@ -3328,7 +3308,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si conv_buf_size = H5T_VLEN_MIN_CONF_BUF_SIZE; if (NULL == (conv_buf = H5FL_BLK_CALLOC(vlen_seq, conv_buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for type conversion") + "memory allocation failed for type conversion"); } /* end if */ else if (conv_buf_size < MAX(src_size, dst_size)) { /* Only allocate conversion buffer in H5T_VLEN_MIN_CONF_BUF_SIZE increments */ @@ -3336,14 +3316,14 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si H5T_VLEN_MIN_CONF_BUF_SIZE; if (NULL == (conv_buf = H5FL_BLK_REALLOC(vlen_seq, conv_buf, conv_buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for type conversion") - HDmemset(conv_buf, 0, conv_buf_size); + "memory allocation failed for type conversion"); + memset(conv_buf, 0, conv_buf_size); } /* end else-if */ /* Read in VL sequence */ if ((*(src->shared->u.vlen.cls->read))(src->shared->u.vlen.file, s, conv_buf, src_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data") + HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data"); } /* end else */ if (!noop_conv) { @@ -3354,20 +3334,20 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si tmp_buf_size = conv_buf_size; if (NULL == (tmp_buf = H5FL_BLK_REALLOC(vlen_seq, tmp_buf, tmp_buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for type conversion") - HDmemset(tmp_buf, 0, tmp_buf_size); + "memory allocation failed for type conversion"); + memset(tmp_buf, 0, tmp_buf_size); } /* end if */ /* If we are writing and there is a nested VL type, read * the sequence into the background buffer */ if (nested) { /* Sanity check */ - HDassert(write_to_file); + assert(write_to_file); /* Get length of background element sequence */ if ((*(dst->shared->u.vlen.cls->getlen))(dst->shared->u.vlen.file, b, &bg_seq_len) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length"); /* Read sequence if length > 0 */ if (bg_seq_len > 0) { @@ -3376,33 +3356,33 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si if (NULL == (tmp_buf = H5FL_BLK_REALLOC(vlen_seq, tmp_buf, tmp_buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for type conversion") - HDmemset(tmp_buf, 0, tmp_buf_size); + "memory allocation failed for type conversion"); + memset(tmp_buf, 0, tmp_buf_size); } /* end if */ /* Read in background VL sequence */ if ((*(dst->shared->u.vlen.cls->read))(dst->shared->u.vlen.file, b, tmp_buf, bg_seq_len * dst_base_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data") + HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data"); } /* end if */ /* If the sequence gets shorter, pad out the original sequence with zeros */ if (bg_seq_len < seq_len) - HDmemset((uint8_t *)tmp_buf + dst_base_size * bg_seq_len, 0, - (seq_len - bg_seq_len) * dst_base_size); + memset((uint8_t *)tmp_buf + dst_base_size * bg_seq_len, 0, + (seq_len - bg_seq_len) * dst_base_size); } /* end if */ /* Convert VL sequence */ if (H5T_convert(tpath, tsrc_id, tdst_id, seq_len, (size_t)0, (size_t)0, conv_buf, tmp_buf) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); } /* end if */ /* Write sequence to destination location */ if ((*(dst->shared->u.vlen.cls->write))(dst->shared->u.vlen.file, &vl_alloc_info, d, conv_buf, b, seq_len, dst_base_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data") + HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data"); if (!noop_conv) { /* For nested VL case, free leftover heap objects from the deeper level if the @@ -3412,14 +3392,14 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si size_t u; /* Sanity check */ - HDassert(write_to_file); + assert(write_to_file); tmp = (uint8_t *)tmp_buf + seq_len * dst_base_size; for (u = seq_len; u < bg_seq_len; u++, tmp += dst_base_size) { /* Delete sequence in destination location */ if ((*(dst->shared->u.vlen.cls->del))(dst->shared->u.vlen.file, tmp) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, - "unable to remove heap object") + "unable to remove heap object"); } /* end for */ } /* end if */ } /* end if */ @@ -3445,7 +3425,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si break; default: /* Some other command we don't know about yet.*/ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -3470,9 +3450,6 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Monday, November 6, 2000 - * *------------------------------------------------------------------------- */ herr_t @@ -3503,18 +3480,18 @@ H5T__conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s * conversion path. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - HDassert(H5T_ARRAY == src->shared->type); - HDassert(H5T_ARRAY == dst->shared->type); + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); + assert(H5T_ARRAY == src->shared->type); + assert(H5T_ARRAY == dst->shared->type); /* Check the number and sizes of the dimensions */ if (src->shared->u.array.ndims != dst->shared->u.array.ndims) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "array datatypes do not have the same number of dimensions") + "array datatypes do not have the same number of dimensions"); for (u = 0; u < src->shared->u.array.ndims; u++) if (src->shared->u.array.dim[u] != dst->shared->u.array.dim[u]) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "array datatypes do not have the same sizes of dimensions") + "array datatypes do not have the same sizes of dimensions"); /* Array datatypes don't need a background buffer */ cdata->need_bkg = H5T_BKG_NO; @@ -3530,7 +3507,7 @@ H5T__conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s * Conversion. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* * Do we process the values from beginning to end or vice @@ -3559,7 +3536,7 @@ H5T__conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s /* Set up conversion path for base elements */ if (NULL == (tpath = H5T_path_find(src->shared->parent, dst->shared->parent))) { HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "unable to convert between src and dest datatypes") + "unable to convert between src and dest datatypes"); } else if (!H5T_path_noop(tpath)) { if ((tsrc_id = H5I_register(H5I_DATATYPE, H5T_copy(src->shared->parent, H5T_COPY_ALL), @@ -3567,7 +3544,7 @@ H5T__conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s (tdst_id = H5I_register(H5I_DATATYPE, H5T_copy(dst->shared->parent, H5T_COPY_ALL), FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, - "unable to register types for conversion") + "unable to register types for conversion"); } /* Check if we need a background buffer for this conversion */ @@ -3578,18 +3555,18 @@ H5T__conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s bkg_buf_size = src->shared->u.array.nelem * MAX(src->shared->size, dst->shared->size); if (NULL == (bkg_buf = H5FL_BLK_CALLOC(array_seq, bkg_buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for type conversion") + "memory allocation failed for type conversion"); } /* end if */ /* Perform the actual conversion */ for (elmtno = 0; elmtno < nelmts; elmtno++) { /* Copy the source array into the correct location for the destination */ - HDmemmove(dp, sp, src->shared->size); + memmove(dp, sp, src->shared->size); /* Convert array */ if (H5T_convert(tpath, tsrc_id, tdst_id, src->shared->u.array.nelem, (size_t)0, bkg_stride, dp, bkg_buf) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed"); /* Advance the source & destination pointers */ sp += src_delta; @@ -3604,7 +3581,7 @@ H5T__conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, s break; default: /* Some other command we don't know about yet.*/ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -3654,14 +3631,14 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * conversion path. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_REFERENCE != src->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_REFERENCE datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_REFERENCE datatype"); if (H5T_REFERENCE != dst->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_REFERENCE datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a H5T_REFERENCE datatype"); /* Only allow for source reference that is not an opaque type, destination must be opaque */ if (!dst->shared->u.atomic.u.r.opaque) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not an H5T_STD_REF datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not an H5T_STD_REF datatype"); /* Reference types don't need a background buffer */ cdata->need_bkg = H5T_BKG_NO; @@ -3675,14 +3652,14 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * Conversion. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); - HDassert(src->shared->u.atomic.u.r.cls); + assert(src->shared->u.atomic.u.r.cls); /* Initialize source & destination strides */ if (buf_stride) { - HDassert(buf_stride >= src->shared->size); - HDassert(buf_stride >= dst->shared->size); + assert(buf_stride >= src->shared->size); + assert(buf_stride >= dst->shared->size); H5_CHECK_OVERFLOW(buf_stride, size_t, ssize_t); s_stride = d_stride = (ssize_t)buf_stride; } /* end if */ @@ -3707,9 +3684,9 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Check if we need to go backwards through the buffer */ if (d_stride > s_stride) { /* Sanity check */ - HDassert(s_stride > 0); - HDassert(d_stride > 0); - HDassert(b_stride >= 0); + assert(s_stride > 0); + assert(d_stride > 0); + assert(b_stride >= 0); /* Compute the number of "safe" destination elements at */ /* the end of the buffer (Those which don't overlap with */ @@ -3752,29 +3729,30 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Check for "nil" source reference */ if ((*(src->shared->u.atomic.u.r.cls->isnull))(src->shared->u.atomic.u.r.file, s, &is_nil) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if reference data is 'nil'") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, + "can't check if reference data is 'nil'"); if (is_nil) { /* Write "nil" reference to destination location */ if ((*(dst->shared->u.atomic.u.r.cls->setnull))(dst->shared->u.atomic.u.r.file, d, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, - "can't set reference data to 'nil'") + "can't set reference data to 'nil'"); } /* end else-if */ else { /* Get size of references */ if (0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( src->shared->u.atomic.u.r.file, s, src->shared->size, dst->shared->u.atomic.u.r.file, &dst_copy))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to obtain size of reference") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to obtain size of reference"); /* Check if conversion buffer is large enough, resize if necessary. */ if (conv_buf_size < buf_size) { conv_buf_size = buf_size; if (NULL == (conv_buf = H5FL_BLK_REALLOC(ref_seq, conv_buf, conv_buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "memory allocation failed for type conversion") - HDmemset(conv_buf, 0, conv_buf_size); + "memory allocation failed for type conversion"); + memset(conv_buf, 0, conv_buf_size); } /* end if */ if (dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) @@ -3784,7 +3762,7 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz if (src->shared->u.atomic.u.r.cls->read( src->shared->u.atomic.u.r.file, s, src->shared->size, dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data") + HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data"); } /* end else */ if (dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) @@ -3795,7 +3773,7 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz src->shared->u.atomic.u.r.file, conv_buf, buf_size, src->shared->u.atomic.u.r.rtype, dst->shared->u.atomic.u.r.file, d, dst->shared->size, b) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data") + HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data"); } /* end else */ } /* end else */ @@ -3814,7 +3792,7 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz break; default: /* Some other command we don't know about yet.*/ - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -3834,9 +3812,6 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, June 10, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -3866,13 +3841,13 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz switch (cdata->command) { case H5T_CONV_INIT: if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_ORDER_LE != src->shared->u.atomic.order && H5T_ORDER_BE != src->shared->u.atomic.order) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); if (H5T_ORDER_LE != dst->shared->u.atomic.order && H5T_ORDER_BE != dst->shared->u.atomic.order) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); if (dst->shared->size > sizeof dbuf) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large"); cdata->need_bkg = H5T_BKG_NO; break; @@ -3882,7 +3857,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_CONV_CONV: /* Get the datatypes */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* * Do we process the values from beginning to end or vice versa? Also, @@ -3922,7 +3897,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Get conversion exception callback property */ if (H5CX_get_dt_conv_cb(&cb_struct) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); /* Allocate space for order-reversed source buffer */ src_rev = (uint8_t *)H5MM_calloc(src->shared->size); @@ -3945,12 +3920,12 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ if (d == dbuf) { - HDassert((dp >= sp && dp < sp + src->shared->size) || - (sp >= dp && sp < dp + dst->shared->size)); + assert((dp >= sp && dp < sp + src->shared->size) || + (sp >= dp && sp < dp + dst->shared->size)); } else { - HDassert((dp < sp && dp + dst->shared->size <= sp) || - (sp < dp && sp + src->shared->size <= dp)); + assert((dp < sp && dp + dst->shared->size <= sp) || + (sp < dp && sp + src->shared->size <= dp)); } #endif @@ -4015,7 +3990,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) /*Don't reverse because user handles it already*/ reverse = FALSE; @@ -4048,7 +4023,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) /*Don't reverse because user handles it already*/ reverse = FALSE; @@ -4072,7 +4047,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz H5T__bit_set(d, dst->shared->u.atomic.offset, dst->shared->u.atomic.prec, TRUE); else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) /*Don't reverse because user handles it already*/ reverse = FALSE; @@ -4106,7 +4081,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) /*Don't reverse because user handles it already*/ reverse = FALSE; @@ -4151,7 +4126,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) /*Don't reverse because user handles it already*/ reverse = FALSE; @@ -4191,7 +4166,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) /*Don't reverse because user handles it already*/ reverse = FALSE; @@ -4212,14 +4187,14 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * Set padding areas in destination. */ if (dst->shared->u.atomic.offset > 0) { - HDassert(H5T_PAD_ZERO == dst->shared->u.atomic.lsb_pad || - H5T_PAD_ONE == dst->shared->u.atomic.lsb_pad); + assert(H5T_PAD_ZERO == dst->shared->u.atomic.lsb_pad || + H5T_PAD_ONE == dst->shared->u.atomic.lsb_pad); H5T__bit_set(d, (size_t)0, dst->shared->u.atomic.offset, (hbool_t)(H5T_PAD_ONE == dst->shared->u.atomic.lsb_pad)); } if (dst->shared->u.atomic.offset + dst->shared->u.atomic.prec != 8 * dst->shared->size) { - HDassert(H5T_PAD_ZERO == dst->shared->u.atomic.msb_pad || - H5T_PAD_ONE == dst->shared->u.atomic.msb_pad); + assert(H5T_PAD_ZERO == dst->shared->u.atomic.msb_pad || + H5T_PAD_ONE == dst->shared->u.atomic.msb_pad); H5T__bit_set(d, dst->shared->u.atomic.offset + dst->shared->u.atomic.prec, 8 * dst->shared->size - (dst->shared->u.atomic.offset + dst->shared->u.atomic.prec), @@ -4254,7 +4229,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -4272,9 +4247,6 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, June 23, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -4320,17 +4292,17 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_CONV_INIT: if (NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; if (H5T_ORDER_LE != src.order && H5T_ORDER_BE != src.order && H5T_ORDER_VAX != src.order) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); if (H5T_ORDER_LE != dst.order && H5T_ORDER_BE != dst.order && H5T_ORDER_VAX != dst.order) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); if (dst_p->shared->size > sizeof(dbuf)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large"); if (8 * sizeof(expo) - 1 < src.u.f.esize || 8 * sizeof(expo) - 1 < dst.u.f.esize) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large"); cdata->need_bkg = H5T_BKG_NO; break; @@ -4341,7 +4313,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Get the datatypes */ if (NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; expo_max = ((hssize_t)1 << dst.u.f.esize) - 1; @@ -4383,7 +4355,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Get conversion exception callback property */ if (H5CX_get_dt_conv_cb(&cb_struct) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); /* Allocate space for order-reversed source buffer */ src_rev = (uint8_t *)H5MM_calloc(src_p->shared->size); @@ -4409,12 +4381,12 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ if (d == dbuf) { - HDassert((dp >= sp && dp < sp + src_p->shared->size) || - (sp >= dp && sp < dp + dst_p->shared->size)); + assert((dp >= sp && dp < sp + src_p->shared->size) || + (sp >= dp && sp < dp + dst_p->shared->size)); } else { - HDassert((dp < sp && dp + dst_p->shared->size <= sp) || - (sp < dp && sp + src_p->shared->size <= dp)); + assert((dp < sp && dp + dst_p->shared->size <= sp) || + (sp < dp && sp + src_p->shared->size <= dp)); } #endif @@ -4433,7 +4405,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (H5T_ORDER_VAX == src.order) { tsize = src_p->shared->size; - HDassert(0 == tsize % 2); + assert(0 == tsize % 2); for (i = 0; i < tsize; i += 4) { tmp1 = s[i]; @@ -4494,7 +4466,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); goto padding; } @@ -4533,7 +4505,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz goto next; } else if (except_ret == H5T_CONV_ABORT) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); goto padding; /* Temporary solution to handle VAX special values. @@ -4564,7 +4536,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz goto next; } else if (except_ret == H5T_CONV_ABORT) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); goto padding; } @@ -4600,7 +4572,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "normalization method not implemented yet") + "normalization method not implemented yet"); } /* @@ -4614,7 +4586,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * the source exponent bias. */ if (0 == expo || H5T_NORM_NONE == src.u.f.norm) { - HDassert(bitno >= 0); + assert(bitno >= 0); expo -= (int64_t)((src.u.f.ebias - 1) + (src.u.f.msize - (size_t)bitno)); } else if (H5T_NORM_IMPLIED == src.u.f.norm) { @@ -4622,7 +4594,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "normalization method not implemented yet") + "normalization method not implemented yet"); } /* @@ -4678,7 +4650,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz msize = 0; } else if (except_ret == H5T_CONV_ABORT) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) { reverse = FALSE; goto next; @@ -4694,7 +4666,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz */ if (msize > 0 && mrsh <= dst.u.f.msize && mrsh + msize > dst.u.f.msize) { bitno = (ssize_t)(mrsh + msize - dst.u.f.msize); - HDassert(bitno >= 0 && (size_t)bitno <= msize); + assert(bitno >= 0 && (size_t)bitno <= msize); /* If the 1st bit being cut off is set and source isn't denormalized.*/ if (H5T__bit_get_d(s, (mpos + (size_t)bitno) - 1, (size_t)1) && !denormalized) { /* Don't do rounding if exponent is 111...110 and mantissa is 111...11. @@ -4769,7 +4741,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) { reverse = FALSE; goto next; @@ -4788,11 +4760,11 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * Set external padding areas */ if (dst.offset > 0) { - HDassert(H5T_PAD_ZERO == dst.lsb_pad || H5T_PAD_ONE == dst.lsb_pad); + assert(H5T_PAD_ZERO == dst.lsb_pad || H5T_PAD_ONE == dst.lsb_pad); H5T__bit_set(d, (size_t)0, dst.offset, (hbool_t)(H5T_PAD_ONE == dst.lsb_pad)); } if (dst.offset + dst.prec != 8 * dst_p->shared->size) { - HDassert(H5T_PAD_ZERO == dst.msb_pad || H5T_PAD_ONE == dst.msb_pad); + assert(H5T_PAD_ZERO == dst.msb_pad || H5T_PAD_ONE == dst.msb_pad); H5T__bit_set(d, dst.offset + dst.prec, 8 * dst_p->shared->size - (dst.offset + dst.prec), (hbool_t)(H5T_PAD_ONE == dst.msb_pad)); } @@ -4811,7 +4783,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (H5T_ORDER_VAX == dst.order && reverse) { tsize = dst_p->shared->size; - HDassert(0 == tsize % 2); + assert(0 == tsize % 2); for (i = 0; i < tsize; i += 4) { tmp1 = d[i]; @@ -4841,7 +4813,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -4858,9 +4830,6 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, August 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -4883,27 +4852,27 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz switch (cdata->command) { case H5T_CONV_INIT: if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (8 * src->shared->size != src->shared->u.atomic.prec || 8 * dst->shared->size != dst->shared->u.atomic.prec) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad precision") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad precision"); if (0 != src->shared->u.atomic.offset || 0 != dst->shared->u.atomic.offset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad offset"); if (H5T_CSET_ASCII != src->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 != src->shared->u.atomic.u.s.cset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad source character set") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad source character set"); if (H5T_CSET_ASCII != dst->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 != dst->shared->u.atomic.u.s.cset) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad destination character set") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad destination character set"); if ((H5T_CSET_ASCII == src->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 == dst->shared->u.atomic.u.s.cset) || (H5T_CSET_ASCII == dst->shared->u.atomic.u.s.cset && H5T_CSET_UTF8 == src->shared->u.atomic.u.s.cset)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "The library doesn't convert between strings of ASCII and UTF") + "The library doesn't convert between strings of ASCII and UTF"); if (src->shared->u.atomic.u.s.pad < 0 || src->shared->u.atomic.u.s.pad >= H5T_NSTR || dst->shared->u.atomic.u.s.pad < 0 || dst->shared->u.atomic.u.s.pad >= H5T_NSTR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad character padding") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad character padding"); cdata->need_bkg = H5T_BKG_NO; break; @@ -4913,7 +4882,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_CONV_CONV: /* Get the datatypes */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* * Do we process the values from beginning to end or vice versa? Also, @@ -4956,7 +4925,8 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Allocate the overlap buffer */ if (NULL == (dbuf = (uint8_t *)H5MM_calloc(dst->shared->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for string conversion") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for string conversion"); /* The conversion loop. */ for (elmtno = 0; elmtno < nelmts; elmtno++) { @@ -4976,15 +4946,15 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ if (src->shared->size == dst->shared->size || buf_stride) { - HDassert(s == d); + assert(s == d); } else if (d == dbuf) { - HDassert((dp >= sp && dp < sp + src->shared->size) || - (sp >= dp && sp < dp + dst->shared->size)); + assert((dp >= sp && dp < sp + src->shared->size) || + (sp >= dp && sp < dp + dst->shared->size)); } else { - HDassert((dp < sp && dp + dst->shared->size <= sp) || - (sp < dp && sp + src->shared->size <= dp)); + assert((dp < sp && dp + dst->shared->size <= sp) || + (sp < dp && sp + src->shared->size <= dp)); } #endif @@ -5031,7 +5001,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_STR_ERROR: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "source string padding method not supported") + "source string padding method not supported"); } /* end switch */ /* Terminate or pad the destination */ @@ -5068,7 +5038,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_STR_ERROR: default: HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, - "destination string padding method not supported") + "destination string padding method not supported"); } /* end switch */ /* @@ -5085,7 +5055,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -5103,17 +5073,12 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * * Failure: negative * - * Programmer: Robb Matzke - * Monday, November 16, 1998 - * *------------------------------------------------------------------------- */ herr_t H5T__conv_schar_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_su(SCHAR, UCHAR, signed char, unsigned char, -, -); -} + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_su(SCHAR, UCHAR, signed char, unsigned char, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_schar @@ -5124,17 +5089,11 @@ H5T__conv_schar_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Monday, November 16, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_us(UCHAR, SCHAR, unsigned char, signed char, -, SCHAR_MAX); -} +herr_t H5T__conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_us(UCHAR, SCHAR, unsigned char, signed char, -, SCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_short @@ -5145,17 +5104,11 @@ H5T__conv_uchar_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sS(SCHAR, SHORT, signed char, short, -, -); -} +herr_t H5T__conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sS(SCHAR, SHORT, signed char, short, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_ushort @@ -5166,17 +5119,12 @@ H5T__conv_schar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sU(SCHAR, USHORT, signed char, unsigned short, -, -); -} + H5T__conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_sU(SCHAR, USHORT, signed char, unsigned short, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_short @@ -5187,17 +5135,11 @@ H5T__conv_schar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uS(UCHAR, SHORT, unsigned char, short, -, SHRT_MAX); -} +herr_t H5T__conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uS(UCHAR, SHORT, unsigned char, short, -, SHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_ushort @@ -5208,17 +5150,12 @@ H5T__conv_uchar_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uU(UCHAR, USHORT, unsigned char, unsigned short, -, -); -} + H5T__conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uU(UCHAR, USHORT, unsigned char, unsigned short, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_int @@ -5229,17 +5166,11 @@ H5T__conv_uchar_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sS(SCHAR, INT, signed char, int, -, -); -} +herr_t H5T__conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sS(SCHAR, INT, signed char, int, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_uint @@ -5250,17 +5181,11 @@ H5T__conv_schar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sU(SCHAR, UINT, signed char, unsigned, -, -); -} +herr_t H5T__conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sU(SCHAR, UINT, signed char, unsigned, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_int @@ -5271,17 +5196,11 @@ H5T__conv_schar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uS(UCHAR, INT, unsigned char, int, -, INT_MAX); -} +herr_t H5T__conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_uS(UCHAR, INT, unsigned char, int, -, INT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_uint @@ -5292,17 +5211,11 @@ H5T__conv_uchar_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uU(UCHAR, UINT, unsigned char, unsigned, -, -); -} +herr_t H5T__conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_uU(UCHAR, UINT, unsigned char, unsigned, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_long @@ -5313,17 +5226,11 @@ H5T__conv_uchar_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sS(SCHAR, LONG, signed char, long, -, -); -} +herr_t H5T__conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sS(SCHAR, LONG, signed char, long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_ulong @@ -5334,17 +5241,11 @@ H5T__conv_schar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sU(SCHAR, ULONG, signed char, unsigned long, -, -); -} +herr_t H5T__conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_sU(SCHAR, ULONG, signed char, unsigned long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_long @@ -5355,17 +5256,12 @@ H5T__conv_schar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uS(UCHAR, LONG, unsigned char, long, -, LONG_MAX); -} + H5T__conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_uS(UCHAR, LONG, unsigned char, long, -, LONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_ulong @@ -5376,17 +5272,11 @@ H5T__conv_uchar_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uU(UCHAR, ULONG, unsigned char, unsigned long, -, -); -} +herr_t H5T__conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uU(UCHAR, ULONG, unsigned char, unsigned long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_llong @@ -5397,17 +5287,12 @@ H5T__conv_uchar_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sS(SCHAR, LLONG, signed char, long long, -, -); -} + H5T__conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sS(SCHAR, LLONG, signed char, long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_ullong @@ -5418,17 +5303,12 @@ H5T__conv_schar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sU(SCHAR, ULLONG, signed char, unsigned long long, -, -); -} + H5T__conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_sU(SCHAR, ULLONG, signed char, unsigned long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_llong @@ -5439,17 +5319,11 @@ H5T__conv_schar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uS(UCHAR, LLONG, unsigned char, long long, -, LLONG_MAX); -} +herr_t H5T__conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uS(UCHAR, LLONG, unsigned char, long long, -, LLONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_ullong @@ -5460,17 +5334,12 @@ H5T__conv_uchar_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uU(UCHAR, ULLONG, unsigned char, unsigned long long, -, -); -} + H5T__conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uU(UCHAR, ULLONG, unsigned char, unsigned long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_schar @@ -5481,17 +5350,11 @@ H5T__conv_uchar_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_short_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ss(SHORT, SCHAR, short, signed char, SCHAR_MIN, SCHAR_MAX); -} +herr_t H5T__conv_short_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Ss(SHORT, SCHAR, short, signed char, SCHAR_MIN, SCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_uchar @@ -5502,17 +5365,11 @@ H5T__conv_short_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Su(SHORT, UCHAR, short, unsigned char, -, UCHAR_MAX); -} +herr_t H5T__conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Su(SHORT, UCHAR, short, unsigned char, -, UCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_schar @@ -5523,17 +5380,12 @@ H5T__conv_short_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Us(USHORT, SCHAR, unsigned short, signed char, -, SCHAR_MAX); -} + H5T__conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Us(USHORT, SCHAR, unsigned short, signed char, -, SCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_uchar @@ -5544,17 +5396,12 @@ H5T__conv_ushort_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Uu(USHORT, UCHAR, unsigned short, unsigned char, -, UCHAR_MAX); -} + H5T__conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Uu(USHORT, UCHAR, unsigned short, unsigned char, -, UCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_ushort @@ -5565,17 +5412,12 @@ H5T__conv_ushort_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: negative * - * Programmer: Robb Matzke - * Monday, November 16, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_su(SHORT, USHORT, short, unsigned short, -, -); -} + H5T__conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_su(SHORT, USHORT, short, unsigned short, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_short @@ -5586,17 +5428,12 @@ H5T__conv_short_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: negative * - * Programmer: Robb Matzke - * Monday, November 16, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_us(USHORT, SHORT, unsigned short, short, -, SHRT_MAX); -} + H5T__conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_us(USHORT, SHORT, unsigned short, short, -, SHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_int @@ -5607,17 +5444,11 @@ H5T__conv_ushort_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sS(SHORT, INT, short, int, -, -); -} +herr_t H5T__conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sS(SHORT, INT, short, int, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_uint @@ -5628,17 +5459,11 @@ H5T__conv_short_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sU(SHORT, UINT, short, unsigned, -, -); -} +herr_t H5T__conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sU(SHORT, UINT, short, unsigned, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_int @@ -5649,17 +5474,12 @@ H5T__conv_short_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uS(USHORT, INT, unsigned short, int, -, INT_MAX); -} + H5T__conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_uS(USHORT, INT, unsigned short, int, -, INT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_uint @@ -5670,17 +5490,12 @@ H5T__conv_ushort_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uU(USHORT, UINT, unsigned short, unsigned, -, -); -} + H5T__conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_uU(USHORT, UINT, unsigned short, unsigned, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_long @@ -5691,17 +5506,11 @@ H5T__conv_ushort_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sS(SHORT, LONG, short, long, -, -); -} +herr_t H5T__conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sS(SHORT, LONG, short, long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_ulong @@ -5712,17 +5521,11 @@ H5T__conv_short_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sU(SHORT, ULONG, short, unsigned long, -, -); -} +herr_t H5T__conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sU(SHORT, ULONG, short, unsigned long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_long @@ -5733,17 +5536,11 @@ H5T__conv_short_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uS(USHORT, LONG, unsigned short, long, -, LONG_MAX); -} +herr_t H5T__conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uS(USHORT, LONG, unsigned short, long, -, LONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_ulong @@ -5754,17 +5551,12 @@ H5T__conv_ushort_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uU(USHORT, ULONG, unsigned short, unsigned long, -, -); -} + H5T__conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uU(USHORT, ULONG, unsigned short, unsigned long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_llong @@ -5775,17 +5567,11 @@ H5T__conv_ushort_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sS(SHORT, LLONG, short, long long, -, -); -} +herr_t H5T__conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sS(SHORT, LLONG, short, long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_ullong @@ -5796,17 +5582,12 @@ H5T__conv_short_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sU(SHORT, ULLONG, short, unsigned long long, -, -); -} + H5T__conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_sU(SHORT, ULLONG, short, unsigned long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_llong @@ -5817,17 +5598,12 @@ H5T__conv_short_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uS(USHORT, LLONG, unsigned short, long long, -, LLONG_MAX); -} + H5T__conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uS(USHORT, LLONG, unsigned short, long long, -, LLONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_ullong @@ -5838,17 +5614,12 @@ H5T__conv_ushort_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uU(USHORT, ULLONG, unsigned short, unsigned long long, -, -); -} + H5T__conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uU(USHORT, ULLONG, unsigned short, unsigned long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_schar @@ -5859,17 +5630,11 @@ H5T__conv_ushort_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ss(INT, SCHAR, int, signed char, SCHAR_MIN, SCHAR_MAX); -} +herr_t H5T__conv_int_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Ss(INT, SCHAR, int, signed char, SCHAR_MIN, SCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_uchar @@ -5880,17 +5645,12 @@ H5T__conv_int_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Su(INT, UCHAR, int, unsigned char, -, UCHAR_MAX); -} + H5T__conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_Su(INT, UCHAR, int, unsigned char, -, UCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_schar @@ -5901,17 +5661,11 @@ H5T__conv_int_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Us(UINT, SCHAR, unsigned, signed char, -, SCHAR_MAX); -} +herr_t H5T__conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Us(UINT, SCHAR, unsigned, signed char, -, SCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_uchar @@ -5922,17 +5676,11 @@ H5T__conv_uint_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Uu(UINT, UCHAR, unsigned, unsigned char, -, UCHAR_MAX); -} +herr_t H5T__conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Uu(UINT, UCHAR, unsigned, unsigned char, -, UCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_short @@ -5943,17 +5691,11 @@ H5T__conv_uint_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ss(INT, SHORT, int, short, SHRT_MIN, SHRT_MAX); -} +herr_t H5T__conv_int_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_Ss(INT, SHORT, int, short, SHRT_MIN, SHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_ushort @@ -5964,17 +5706,11 @@ H5T__conv_int_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Su(INT, USHORT, int, unsigned short, -, USHRT_MAX); -} +herr_t H5T__conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Su(INT, USHORT, int, unsigned short, -, USHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_short @@ -5985,17 +5721,11 @@ H5T__conv_int_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Us(UINT, SHORT, unsigned, short, -, SHRT_MAX); -} +herr_t H5T__conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_Us(UINT, SHORT, unsigned, short, -, SHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_ushort @@ -6006,17 +5736,11 @@ H5T__conv_uint_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Uu(UINT, USHORT, unsigned, unsigned short, -, USHRT_MAX); -} +herr_t H5T__conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Uu(UINT, USHORT, unsigned, unsigned short, -, USHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_uint @@ -6027,17 +5751,11 @@ H5T__conv_uint_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Monday, November 16, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_su(INT, UINT, int, unsigned, -, -); -} +herr_t H5T__conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_su(INT, UINT, int, unsigned, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_int @@ -6048,17 +5766,11 @@ H5T__conv_int_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts * * Failure: negative * - * Programmer: Robb Matzke - * Monday, November 16, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_us(UINT, INT, unsigned, int, -, INT_MAX); -} +herr_t H5T__conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_us(UINT, INT, unsigned, int, -, INT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_long @@ -6069,17 +5781,11 @@ H5T__conv_uint_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sS(INT, LONG, int, long, -, -); -} +herr_t H5T__conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sS(INT, LONG, int, long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_ulong @@ -6090,17 +5796,11 @@ H5T__conv_int_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sU(INT, LONG, int, unsigned long, -, -); -} +herr_t H5T__conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sU(INT, LONG, int, unsigned long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_long @@ -6111,17 +5811,11 @@ H5T__conv_int_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uS(UINT, LONG, unsigned, long, -, LONG_MAX); -} +herr_t H5T__conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_uS(UINT, LONG, unsigned, long, -, LONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_ulong @@ -6132,17 +5826,11 @@ H5T__conv_uint_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uU(UINT, ULONG, unsigned, unsigned long, -, -); -} +herr_t H5T__conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_uU(UINT, ULONG, unsigned, unsigned long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_llong @@ -6153,17 +5841,11 @@ H5T__conv_uint_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sS(INT, LLONG, int, long long, -, -); -} +herr_t H5T__conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sS(INT, LLONG, int, long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_ullong @@ -6174,17 +5856,11 @@ H5T__conv_int_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sU(INT, ULLONG, int, unsigned long long, -, -); -} +herr_t H5T__conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sU(INT, ULLONG, int, unsigned long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_llong @@ -6195,17 +5871,11 @@ H5T__conv_int_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uS(UINT, LLONG, unsigned, long long, -, LLONG_MAX); -} +herr_t H5T__conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uS(UINT, LLONG, unsigned, long long, -, LLONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_ullong @@ -6216,17 +5886,11 @@ H5T__conv_uint_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uU(UINT, ULLONG, unsigned, unsigned long long, -, -); -} +herr_t H5T__conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uU(UINT, ULLONG, unsigned, unsigned long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_schar @@ -6237,17 +5901,11 @@ H5T__conv_uint_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_long_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ss(LONG, SCHAR, long, signed char, SCHAR_MIN, SCHAR_MAX); -} +herr_t H5T__conv_long_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Ss(LONG, SCHAR, long, signed char, SCHAR_MIN, SCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_uchar @@ -6258,17 +5916,11 @@ H5T__conv_long_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Su(LONG, UCHAR, long, unsigned char, -, UCHAR_MAX); -} +herr_t H5T__conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Su(LONG, UCHAR, long, unsigned char, -, UCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_schar @@ -6279,17 +5931,11 @@ H5T__conv_long_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Us(ULONG, SCHAR, unsigned long, signed char, -, SCHAR_MAX); -} +herr_t H5T__conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Us(ULONG, SCHAR, unsigned long, signed char, -, SCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_uchar @@ -6300,17 +5946,11 @@ H5T__conv_ulong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Uu(ULONG, UCHAR, unsigned long, unsigned char, -, UCHAR_MAX); -} +herr_t H5T__conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Uu(ULONG, UCHAR, unsigned long, unsigned char, -, UCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_short @@ -6321,17 +5961,12 @@ H5T__conv_ulong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_long_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ss(LONG, SHORT, long, short, SHRT_MIN, SHRT_MAX); -} + H5T__conv_long_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_Ss(LONG, SHORT, long, short, SHRT_MIN, SHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_ushort @@ -6342,17 +5977,11 @@ H5T__conv_long_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Su(LONG, USHORT, long, unsigned short, -, USHRT_MAX); -} +herr_t H5T__conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Su(LONG, USHORT, long, unsigned short, -, USHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_short @@ -6363,17 +5992,11 @@ H5T__conv_long_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Us(ULONG, SHORT, unsigned long, short, -, SHRT_MAX); -} +herr_t H5T__conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Us(ULONG, SHORT, unsigned long, short, -, SHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_ushort @@ -6384,17 +6007,12 @@ H5T__conv_ulong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Uu(ULONG, USHORT, unsigned long, unsigned short, -, USHRT_MAX); -} + H5T__conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Uu(ULONG, USHORT, unsigned long, unsigned short, -, USHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_int @@ -6405,17 +6023,11 @@ H5T__conv_ulong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_long_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ss(LONG, INT, long, int, INT_MIN, INT_MAX); -} +herr_t H5T__conv_long_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_Ss(LONG, INT, long, int, INT_MIN, INT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_uint @@ -6426,17 +6038,11 @@ H5T__conv_long_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Su(LONG, UINT, long, unsigned, -, UINT_MAX); -} +herr_t H5T__conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_Su(LONG, UINT, long, unsigned, -, UINT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_int @@ -6447,17 +6053,11 @@ H5T__conv_long_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Us(ULONG, INT, unsigned long, int, -, INT_MAX); -} +herr_t H5T__conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_Us(ULONG, INT, unsigned long, int, -, INT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_uint @@ -6468,17 +6068,11 @@ H5T__conv_ulong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Uu(ULONG, UINT, unsigned long, unsigned, -, UINT_MAX); -} +herr_t H5T__conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Uu(ULONG, UINT, unsigned long, unsigned, -, UINT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_ulong @@ -6489,17 +6083,11 @@ H5T__conv_ulong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: negative * - * Programmer: Robb Matzke - * Monday, November 16, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_su(LONG, ULONG, long, unsigned long, -, -); -} +herr_t H5T__conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_su(LONG, ULONG, long, unsigned long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_long @@ -6510,17 +6098,12 @@ H5T__conv_long_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: negative * - * Programmer: Robb Matzke - * Monday, November 16, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_us(ULONG, LONG, unsigned long, long, -, LONG_MAX); -} + H5T__conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_us(ULONG, LONG, unsigned long, long, -, LONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_llong @@ -6531,17 +6114,11 @@ H5T__conv_ulong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sS(LONG, LLONG, long, long long, -, -); -} +herr_t H5T__conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sS(LONG, LLONG, long, long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_ullong @@ -6552,17 +6129,12 @@ H5T__conv_long_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_sU(LONG, ULLONG, long, unsigned long long, -, -); -} + H5T__conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_sU(LONG, ULLONG, long, unsigned long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_llong @@ -6573,17 +6145,11 @@ H5T__conv_long_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uS(ULONG, LLONG, unsigned long, long long, -, LLONG_MAX); -} +herr_t H5T__conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uS(ULONG, LLONG, unsigned long, long long, -, LLONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_ullong @@ -6594,17 +6160,12 @@ H5T__conv_ulong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_uU(ULONG, ULLONG, unsigned long, unsigned long long, -, -); -} + H5T__conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_uU(ULONG, ULLONG, unsigned long, unsigned long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_schar @@ -6615,17 +6176,11 @@ H5T__conv_ulong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ss(LLONG, SCHAR, long long, signed char, SCHAR_MIN, SCHAR_MAX); -} +herr_t H5T__conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Ss(LLONG, SCHAR, long long, signed char, SCHAR_MIN, SCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_uchar @@ -6636,17 +6191,11 @@ H5T__conv_llong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Su(LLONG, UCHAR, long long, unsigned char, -, UCHAR_MAX); -} +herr_t H5T__conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Su(LLONG, UCHAR, long long, unsigned char, -, UCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_schar @@ -6657,17 +6206,12 @@ H5T__conv_llong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Us(ULLONG, SCHAR, unsigned long long, signed char, -, SCHAR_MAX); -} + H5T__conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Us(ULLONG, SCHAR, unsigned long long, signed char, -, SCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_uchar @@ -6678,17 +6222,12 @@ H5T__conv_ullong_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Uu(ULLONG, UCHAR, unsigned long long, unsigned char, -, UCHAR_MAX); -} + H5T__conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Uu(ULLONG, UCHAR, unsigned long long, unsigned char, -, UCHAR_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_short @@ -6699,17 +6238,11 @@ H5T__conv_ullong_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ss(LLONG, SHORT, long long, short, SHRT_MIN, SHRT_MAX); -} +herr_t H5T__conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Ss(LLONG, SHORT, long long, short, SHRT_MIN, SHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_ushort @@ -6720,17 +6253,12 @@ H5T__conv_llong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Su(LLONG, USHORT, long long, unsigned short, -, USHRT_MAX); -} + H5T__conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Su(LLONG, USHORT, long long, unsigned short, -, USHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_short @@ -6741,17 +6269,12 @@ H5T__conv_llong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Us(ULLONG, SHORT, unsigned long long, short, -, SHRT_MAX); -} + H5T__conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Us(ULLONG, SHORT, unsigned long long, short, -, SHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_ushort @@ -6762,17 +6285,12 @@ H5T__conv_ullong_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Uu(ULLONG, USHORT, unsigned long long, unsigned short, -, USHRT_MAX); -} + H5T__conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Uu(ULLONG, USHORT, unsigned long long, unsigned short, -, USHRT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_int @@ -6783,17 +6301,12 @@ H5T__conv_ullong_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ss(LLONG, INT, long long, int, INT_MIN, INT_MAX); -} + H5T__conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_Ss(LLONG, INT, long long, int, INT_MIN, INT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_uint @@ -6804,17 +6317,12 @@ H5T__conv_llong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Su(LLONG, UINT, long long, unsigned, -, UINT_MAX); -} + H5T__conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_Su(LLONG, UINT, long long, unsigned, -, UINT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_int @@ -6825,17 +6333,11 @@ H5T__conv_llong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Us(ULLONG, INT, unsigned long long, int, -, INT_MAX); -} +herr_t H5T__conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Us(ULLONG, INT, unsigned long long, int, -, INT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_uint @@ -6846,17 +6348,11 @@ H5T__conv_ullong_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Uu(ULLONG, UINT, unsigned long long, unsigned, -, UINT_MAX); -} +herr_t H5T__conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Uu(ULLONG, UINT, unsigned long long, unsigned, -, UINT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_long @@ -6867,17 +6363,11 @@ H5T__conv_ullong_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ss(LLONG, LONG, long long, long, LONG_MIN, LONG_MAX); -} +herr_t H5T__conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Ss(LLONG, LONG, long long, long, LONG_MIN, LONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_ulong @@ -6888,17 +6378,11 @@ H5T__conv_llong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Su(LLONG, ULONG, long long, unsigned long, -, ULONG_MAX); -} +herr_t H5T__conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Su(LLONG, ULONG, long long, unsigned long, -, ULONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_long @@ -6909,17 +6393,11 @@ H5T__conv_llong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Us(ULLONG, LONG, unsigned long long, long, -, LONG_MAX); -} +herr_t H5T__conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Us(ULLONG, LONG, unsigned long long, long, -, LONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_ulong @@ -6930,17 +6408,12 @@ H5T__conv_ullong_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Failure: Negative * - * Programmer: Robb Matzke - * Friday, November 13, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Uu(ULLONG, ULONG, unsigned long long, unsigned long, -, ULONG_MAX); -} + H5T__conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Uu(ULLONG, ULONG, unsigned long long, unsigned long, -, ULONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_ullong @@ -6951,17 +6424,12 @@ H5T__conv_ullong_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: negative * - * Programmer: Robb Matzke - * Monday, November 16, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_su(LLONG, ULLONG, long long, unsigned long long, -, -); -} + H5T__conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_su(LLONG, ULLONG, long long, unsigned long long, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_llong @@ -6972,17 +6440,12 @@ H5T__conv_llong_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Failure: negative * - * Programmer: Robb Matzke - * Monday, November 16, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_us(ULLONG, LLONG, unsigned long long, long long, -, LLONG_MAX); -} + H5T__conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_us(ULLONG, LLONG, unsigned long long, long long, -, LLONG_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_float_double @@ -6992,17 +6455,11 @@ H5T__conv_ullong_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, June 23, 1998 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_float_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_fF(FLOAT, DOUBLE, float, double, -, -); -} +herr_t H5T__conv_float_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_fF(FLOAT, DOUBLE, float, double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_float_ldouble @@ -7012,17 +6469,12 @@ H5T__conv_float_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, Feb 25, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_float_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_fF(FLOAT, LDOUBLE, float, long double, -, -); -} + H5T__conv_float_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_fF(FLOAT, LDOUBLE, float, long double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_double_float @@ -7032,17 +6484,12 @@ H5T__conv_float_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Tuesday, June 23, 1998 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_double_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ff(DOUBLE, FLOAT, double, float, -FLT_MAX, FLT_MAX); -} + H5T__conv_double_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Ff(DOUBLE, FLOAT, double, float, -FLT_MAX, FLT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_double_ldouble @@ -7052,17 +6499,12 @@ H5T__conv_double_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, Feb 25, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_double_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_fF(DOUBLE, LDOUBLE, double, long double, -, -); -} + H5T__conv_double_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_fF(DOUBLE, LDOUBLE, double, long double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_float @@ -7072,17 +6514,12 @@ H5T__conv_double_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, Feb 25, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ldouble_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ff(LDOUBLE, FLOAT, long double, float, -FLT_MAX, FLT_MAX); -} + H5T__conv_ldouble_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Ff(LDOUBLE, FLOAT, long double, float, -FLT_MAX, FLT_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_double @@ -7092,17 +6529,12 @@ H5T__conv_ldouble_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, Feb 25, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ldouble_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_Ff(LDOUBLE, DOUBLE, long double, double, -DBL_MAX, DBL_MAX); -} + H5T__conv_ldouble_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_Ff(LDOUBLE, DOUBLE, long double, double, -DBL_MAX, DBL_MAX)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_float @@ -7112,17 +6544,11 @@ H5T__conv_ldouble_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_schar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(SCHAR, FLOAT, signed char, float, -, -); -} +herr_t H5T__conv_schar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(SCHAR, FLOAT, signed char, float, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_double @@ -7132,17 +6558,11 @@ H5T__conv_schar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_schar_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(SCHAR, DOUBLE, signed char, double, -, -); -} +herr_t H5T__conv_schar_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(SCHAR, DOUBLE, signed char, double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_schar_ldouble @@ -7152,17 +6572,12 @@ H5T__conv_schar_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_schar_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(SCHAR, LDOUBLE, signed char, long double, -, -); -} + H5T__conv_schar_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_xF(SCHAR, LDOUBLE, signed char, long double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_float @@ -7172,17 +6587,11 @@ H5T__conv_schar_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uchar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(UCHAR, FLOAT, unsigned char, float, -, -); -} +herr_t H5T__conv_uchar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(UCHAR, FLOAT, unsigned char, float, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_double @@ -7192,17 +6601,12 @@ H5T__conv_uchar_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_uchar_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(UCHAR, DOUBLE, unsigned char, double, -, -); -} + H5T__conv_uchar_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(UCHAR, DOUBLE, unsigned char, double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uchar_ldouble @@ -7212,17 +6616,12 @@ H5T__conv_uchar_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_uchar_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(UCHAR, LDOUBLE, unsigned char, long double, -, -); -} + H5T__conv_uchar_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_xF(UCHAR, LDOUBLE, unsigned char, long double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_float @@ -7232,17 +6631,11 @@ H5T__conv_uchar_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_short_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(SHORT, FLOAT, short, float, -, -); -} +herr_t H5T__conv_short_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(SHORT, FLOAT, short, float, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_double @@ -7252,17 +6645,11 @@ H5T__conv_short_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_short_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(SHORT, DOUBLE, short, double, -, -); -} +herr_t H5T__conv_short_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(SHORT, DOUBLE, short, double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_short_ldouble @@ -7272,17 +6659,12 @@ H5T__conv_short_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_short_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(SHORT, LDOUBLE, short, long double, -, -); -} + H5T__conv_short_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(SHORT, LDOUBLE, short, long double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_float @@ -7292,17 +6674,12 @@ H5T__conv_short_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(USHORT, FLOAT, unsigned short, float, -, -); -} + H5T__conv_ushort_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(USHORT, FLOAT, unsigned short, float, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_double @@ -7312,17 +6689,12 @@ H5T__conv_ushort_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(USHORT, DOUBLE, unsigned short, double, -, -); -} + H5T__conv_ushort_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_xF(USHORT, DOUBLE, unsigned short, double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ushort_ldouble @@ -7332,17 +6704,12 @@ H5T__conv_ushort_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ushort_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(USHORT, LDOUBLE, unsigned short, long double, -, -); -} + H5T__conv_ushort_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_xF(USHORT, LDOUBLE, unsigned short, long double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_float @@ -7352,17 +6719,11 @@ H5T__conv_ushort_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(INT, FLOAT, int, float, -, -); -} +herr_t H5T__conv_int_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(INT, FLOAT, int, float, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_double @@ -7372,17 +6733,11 @@ H5T__conv_int_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(INT, DOUBLE, int, double, -, -); -} +herr_t H5T__conv_int_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(INT, DOUBLE, int, double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_int_ldouble @@ -7392,17 +6747,11 @@ H5T__conv_int_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_int_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(INT, LDOUBLE, int, long double, -, -); -} +herr_t H5T__conv_int_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(INT, LDOUBLE, int, long double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_float @@ -7412,17 +6761,11 @@ H5T__conv_int_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(UINT, FLOAT, unsigned int, float, -, -); -} +herr_t H5T__conv_uint_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(UINT, FLOAT, unsigned int, float, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_double @@ -7432,17 +6775,11 @@ H5T__conv_uint_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_uint_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(UINT, DOUBLE, unsigned int, double, -, -); -} +herr_t H5T__conv_uint_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(UINT, DOUBLE, unsigned int, double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_uint_ldouble @@ -7452,17 +6789,12 @@ H5T__conv_uint_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_uint_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(UINT, LDOUBLE, unsigned int, long double, -, -); -} + H5T__conv_uint_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_xF(UINT, LDOUBLE, unsigned int, long double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_float @@ -7472,17 +6804,11 @@ H5T__conv_uint_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_long_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(LONG, FLOAT, long, float, -, -); -} +herr_t H5T__conv_long_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(LONG, FLOAT, long, float, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_double @@ -7492,17 +6818,11 @@ H5T__conv_long_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_long_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(LONG, DOUBLE, long, double, -, -); -} +herr_t H5T__conv_long_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(LONG, DOUBLE, long, double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_long_ldouble @@ -7512,17 +6832,11 @@ H5T__conv_long_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_long_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(LONG, LDOUBLE, long, long double, -, -); -} +herr_t H5T__conv_long_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(LONG, LDOUBLE, long, long double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_float @@ -7532,17 +6846,11 @@ H5T__conv_long_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ulong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(ULONG, FLOAT, unsigned long, float, -, -); -} +herr_t H5T__conv_ulong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(ULONG, FLOAT, unsigned long, float, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_double @@ -7552,17 +6860,12 @@ H5T__conv_ulong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ulong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(ULONG, DOUBLE, unsigned long, double, -, -); -} + H5T__conv_ulong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(ULONG, DOUBLE, unsigned long, double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ulong_ldouble @@ -7572,17 +6875,12 @@ H5T__conv_ulong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ulong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(ULONG, LDOUBLE, unsigned long, long double, -, -); -} + H5T__conv_ulong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5T_CONV_xF(ULONG, LDOUBLE, unsigned long, long double, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_float @@ -7592,17 +6890,11 @@ H5T__conv_ulong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_llong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(LLONG, FLOAT, long long, float, -, -); -} +herr_t H5T__conv_llong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(LLONG, FLOAT, long long, float, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_llong_double @@ -7612,16 +6904,13 @@ H5T__conv_llong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_llong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) + H5T__conv_llong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { - H5T_CONV_xF(LLONG, DOUBLE, long long, double, -, -); + H5T_CONV_xF(LLONG, DOUBLE, long long, double, -, -) } /*------------------------------------------------------------------------- @@ -7632,9 +6921,6 @@ H5T__conv_llong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ #ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE @@ -7642,7 +6928,7 @@ herr_t H5T__conv_llong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { - H5T_CONV_xF(LLONG, LDOUBLE, long long, long double, -, -); + H5T_CONV_xF(LLONG, LDOUBLE, long long, long double, -, -) } #endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ @@ -7654,17 +6940,12 @@ H5T__conv_llong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t H5T__conv_ullong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5T_CONV_xF(ULLONG, FLOAT, unsigned long long, float, -, -); -} + size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){H5T_CONV_xF(ULLONG, FLOAT, unsigned long long, float, -, -)} /*------------------------------------------------------------------------- * Function: H5T__conv_ullong_double @@ -7674,16 +6955,13 @@ H5T__conv_ullong_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ullong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) + H5T__conv_ullong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { - H5T_CONV_xF(ULLONG, DOUBLE, unsigned long long, double, -, -); + H5T_CONV_xF(ULLONG, DOUBLE, unsigned long long, double, -, -) } /*------------------------------------------------------------------------- @@ -7694,9 +6972,6 @@ H5T__conv_ullong_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ #ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE @@ -7704,7 +6979,7 @@ herr_t H5T__conv_ullong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { - H5T_CONV_xF(ULLONG, LDOUBLE, unsigned long long, long double, -, -); + H5T_CONV_xF(ULLONG, LDOUBLE, unsigned long long, long double, -, -) } #endif /*H5T_CONV_INTERNAL_ULLONG_LDOUBLE*/ @@ -7716,19 +6991,13 @@ H5T__conv_ullong_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t H5T__conv_float_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_float_uchar @@ -7738,19 +7007,12 @@ H5T__conv_float_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_float_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_float_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_double_schar @@ -7760,19 +7022,13 @@ H5T__conv_float_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_double_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_double_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_double_uchar @@ -7782,19 +7038,13 @@ H5T__conv_double_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_double_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} + H5T__conv_double_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_schar @@ -7804,19 +7054,13 @@ H5T__conv_double_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ldouble_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} + H5T__conv_ldouble_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, + SCHAR_MAX) H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_uchar @@ -7826,19 +7070,13 @@ H5T__conv_ldouble_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ldouble_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_ldouble_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_float_short @@ -7848,19 +7086,12 @@ H5T__conv_ldouble_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_float_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_float_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_float_ushort @@ -7870,19 +7101,13 @@ H5T__conv_float_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_float_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} + H5T__conv_float_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_double_short @@ -7892,19 +7117,13 @@ H5T__conv_float_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_double_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} + H5T__conv_double_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_double_ushort @@ -7914,19 +7133,13 @@ H5T__conv_double_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_double_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} + H5T__conv_double_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_short @@ -7936,19 +7149,13 @@ H5T__conv_double_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ldouble_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_ldouble_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_ushort @@ -7958,19 +7165,13 @@ H5T__conv_ldouble_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ldouble_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} + H5T__conv_ldouble_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, + USHRT_MAX) H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_float_int @@ -7980,19 +7181,12 @@ H5T__conv_ldouble_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_float_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_float_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_float_uint @@ -8002,19 +7196,12 @@ H5T__conv_float_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmt * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_float_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_float_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_double_int @@ -8024,19 +7211,12 @@ H5T__conv_float_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_double_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_double_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_double_uint @@ -8046,19 +7226,12 @@ H5T__conv_double_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_double_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_double_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_int @@ -8068,19 +7241,12 @@ H5T__conv_double_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ldouble_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_ldouble_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_uint @@ -8090,19 +7256,13 @@ H5T__conv_ldouble_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ldouble_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_ldouble_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_float_long @@ -8112,19 +7272,12 @@ H5T__conv_ldouble_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_float_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_float_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_float_ulong @@ -8134,19 +7287,12 @@ H5T__conv_float_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelm * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_float_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_float_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_double_long @@ -8156,19 +7302,12 @@ H5T__conv_float_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_double_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_double_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_double_ulong @@ -8178,19 +7317,13 @@ H5T__conv_double_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_double_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} + H5T__conv_double_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_long @@ -8200,19 +7333,13 @@ H5T__conv_double_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_ldouble_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} + H5T__conv_ldouble_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_ldouble_ulong @@ -8222,19 +7349,13 @@ H5T__conv_ldouble_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_ldouble_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_ldouble_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_float_llong @@ -8244,19 +7365,12 @@ H5T__conv_ldouble_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_float_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_float_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_float_ullong @@ -8266,19 +7380,13 @@ H5T__conv_float_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nel * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_float_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(FLOAT, ULLONG, float, unsigned long long, 0, ULLONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_float_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(FLOAT, ULLONG, float, unsigned long long, 0, ULLONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_double_llong @@ -8288,19 +7396,13 @@ H5T__conv_float_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ -herr_t -H5T__conv_double_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) -{ - H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") -} +herr_t H5T__conv_double_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, + size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg){ + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal")} /*------------------------------------------------------------------------- * Function: H5T__conv_double_ullong @@ -8310,18 +7412,14 @@ H5T__conv_double_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, November 7, 2003 - * *------------------------------------------------------------------------- */ herr_t -H5T__conv_double_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, - size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) + H5T__conv_double_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride, + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(DOUBLE, ULLONG, double, unsigned long long, 0, ULLONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") + H5T_CONV_Fx(DOUBLE, ULLONG, double, unsigned long long, 0, ULLONG_MAX) H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -8332,9 +7430,6 @@ H5T__conv_double_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ #ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG @@ -8343,8 +7438,8 @@ H5T__conv_ldouble_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") + H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal") } #endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/ @@ -8356,9 +7451,6 @@ H5T__conv_ldouble_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Tuesday, February 1, 2005 - * *------------------------------------------------------------------------- */ #ifdef H5T_CONV_INTERNAL_LDOUBLE_ULLONG @@ -8367,8 +7459,8 @@ H5T__conv_ldouble_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5_GCC_CLANG_DIAG_OFF("float-equal") - H5T_CONV_Fx(LDOUBLE, ULLONG, long double, unsigned long long, 0, ULLONG_MAX); - H5_GCC_CLANG_DIAG_ON("float-equal") + H5T_CONV_Fx(LDOUBLE, ULLONG, long double, unsigned long long, 0, ULLONG_MAX) + H5_GCC_CLANG_DIAG_ON("float-equal") } #endif /*H5T_CONV_INTERNAL_LDOUBLE_ULLONG*/ @@ -8381,9 +7473,6 @@ H5T__conv_ldouble_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Wednesday, Jan 21, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -8425,15 +7514,15 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_CONV_INIT: if (NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; if (H5T_ORDER_LE != src.order && H5T_ORDER_BE != src.order && H5T_ORDER_VAX != src.order) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); if (dst_p->shared->size > sizeof(dbuf)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large"); if (8 * sizeof(expo) - 1 < src.u.f.esize) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large"); cdata->need_bkg = H5T_BKG_NO; break; @@ -8444,7 +7533,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Get the datatypes */ if (NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; @@ -8482,7 +7571,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Get conversion exception callback property */ if (H5CX_get_dt_conv_cb(&cb_struct) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); /* Allocate space for order-reversed source buffer */ src_rev = (uint8_t *)H5MM_calloc(src_p->shared->size); @@ -8509,12 +7598,12 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ if (d == dbuf) { - HDassert((dp >= sp && dp < sp + src_p->shared->size) || - (sp >= dp && sp < dp + dst_p->shared->size)); + assert((dp >= sp && dp < sp + src_p->shared->size) || + (sp >= dp && sp < dp + dst_p->shared->size)); } else { - HDassert((dp < sp && dp + dst_p->shared->size <= sp) || - (sp < dp && sp + src_p->shared->size <= dp)); + assert((dp < sp && dp + dst_p->shared->size <= sp) || + (sp < dp && sp + src_p->shared->size <= dp)); } #endif /* @@ -8532,7 +7621,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (H5T_ORDER_VAX == src.order) { tsize = src_p->shared->size; - HDassert(0 == tsize % 2); + assert(0 == tsize % 2); for (i = 0; i < tsize; i += 4) { tmp1 = s[i]; @@ -8585,7 +7674,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); } else { /* +Infinity */ if (cb_struct.func) { /*If user's exception handler is present, use it*/ @@ -8609,7 +7698,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); } goto padding; } @@ -8641,7 +7730,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); } else { /* +Infinity */ if (cb_struct.func) { /*If user's exception handler is present, use it*/ @@ -8665,7 +7754,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); } goto padding; } @@ -8688,7 +7777,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz goto next; } else if (except_ret == H5T_CONV_ABORT) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); goto padding; } @@ -8712,7 +7801,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "normalization method not implemented yet") + "normalization method not implemented yet"); } /* @@ -8781,7 +7870,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz d, cb_struct.user_data); if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; @@ -8809,7 +7898,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); } else if (first < dst.prec) { if (truncated && @@ -8831,7 +7920,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); } } } @@ -8858,7 +7947,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; @@ -8881,7 +7970,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz H5T__bit_set(d, (dst.offset + dst.prec - 1), (size_t)1, TRUE); else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; @@ -8904,7 +7993,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz H5T__bit_set(d, dst.offset, dst.prec - 1, TRUE); else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; @@ -8927,7 +8016,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) { /*No need to reverse the order of destination because user handles it*/ reverse = FALSE; @@ -8942,11 +8031,11 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * Set padding areas in destination. */ if (dst.offset > 0) { - HDassert(H5T_PAD_ZERO == dst.lsb_pad || H5T_PAD_ONE == dst.lsb_pad); + assert(H5T_PAD_ZERO == dst.lsb_pad || H5T_PAD_ONE == dst.lsb_pad); H5T__bit_set(d, (size_t)0, dst.offset, (hbool_t)(H5T_PAD_ONE == dst.lsb_pad)); } if (dst.offset + dst.prec != 8 * dst_p->shared->size) { - HDassert(H5T_PAD_ZERO == dst.msb_pad || H5T_PAD_ONE == dst.msb_pad); + assert(H5T_PAD_ZERO == dst.msb_pad || H5T_PAD_ONE == dst.msb_pad); H5T__bit_set(d, dst.offset + dst.prec, 8 * dst_p->shared->size - (dst.offset + dst.prec), (hbool_t)(H5T_PAD_ONE == dst.msb_pad)); } @@ -8980,13 +8069,13 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz dp += direction * (ssize_t)dst_p->shared->size; } - HDmemset(int_buf, 0, buf_size); + memset(int_buf, 0, buf_size); } break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -9007,9 +8096,6 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * Friday, Feb 6, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -9053,15 +8139,15 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz case H5T_CONV_INIT: if (NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; if (H5T_ORDER_LE != dst.order && H5T_ORDER_BE != dst.order && H5T_ORDER_VAX != dst.order) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unsupported byte order"); if (dst_p->shared->size > sizeof(dbuf)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "destination size is too large"); if (8 * sizeof(expo) - 1 < src.u.f.esize) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "exponent field is too large"); cdata->need_bkg = H5T_BKG_NO; break; @@ -9072,7 +8158,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Get the datatypes */ if (NULL == (src_p = (H5T_t *)H5I_object(src_id)) || NULL == (dst_p = (H5T_t *)H5I_object(dst_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); src = src_p->shared->u.atomic; dst = dst_p->shared->u.atomic; @@ -9110,7 +8196,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /* Get conversion exception callback property */ if (H5CX_get_dt_conv_cb(&cb_struct) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get conversion exception callback"); /* Allocate space for order-reversed source buffer */ src_rev = (uint8_t *)H5MM_calloc(src_p->shared->size); @@ -9142,12 +8228,12 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz #ifndef NDEBUG /* I don't quite trust the overlap calculations yet --rpm */ if (d == dbuf) { - HDassert((dp >= sp && dp < sp + src_p->shared->size) || - (sp >= dp && sp < dp + dst_p->shared->size)); + assert((dp >= sp && dp < sp + src_p->shared->size) || + (sp >= dp && sp < dp + dst_p->shared->size)); } else { - HDassert((dp < sp && dp + dst_p->shared->size <= sp) || - (sp < dp && sp + src_p->shared->size <= dp)); + assert((dp < sp && dp + dst_p->shared->size <= sp) || + (sp < dp && sp + src_p->shared->size <= dp)); } #endif @@ -9207,7 +8293,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz is_max_neg = 0; } if (sfirst < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "zero bit not found") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "zero bit not found"); /* Sign bit has been negated if bit vector isn't 0x80...00. Set all bits in front of * sign bit to 0 in the temporary buffer because they're all negated from the previous @@ -9230,7 +8316,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else { HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "normalization method not implemented yet") + "normalization method not implemented yet"); } /* Handle mantissa part here */ @@ -9259,7 +8345,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz goto padding; } else if (except_ret == H5T_CONV_ABORT) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); /* If user's exception handler does deal with it, we do it by dropping off the * extra bits at the end and do rounding. If we have .50...0(decimal) after radix @@ -9326,7 +8412,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz if (except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, - "can't handle conversion exception") + "can't handle conversion exception"); else if (except_ret == H5T_CONV_HANDLED) { reverse = FALSE; goto padding; @@ -9336,7 +8422,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz /*make destination infinity by setting exponent to maximal number and *mantissa to zero.*/ expo = expo_max; - HDmemset(int_buf, 0, buf_size); + memset(int_buf, 0, buf_size); } } @@ -9354,11 +8440,11 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * Set padding areas in destination. */ if (dst.offset > 0) { - HDassert(H5T_PAD_ZERO == dst.lsb_pad || H5T_PAD_ONE == dst.lsb_pad); + assert(H5T_PAD_ZERO == dst.lsb_pad || H5T_PAD_ONE == dst.lsb_pad); H5T__bit_set(d, (size_t)0, dst.offset, (hbool_t)(H5T_PAD_ONE == dst.lsb_pad)); } if (dst.offset + dst.prec != 8 * dst_p->shared->size) { - HDassert(H5T_PAD_ZERO == dst.msb_pad || H5T_PAD_ONE == dst.msb_pad); + assert(H5T_PAD_ZERO == dst.msb_pad || H5T_PAD_ONE == dst.msb_pad); H5T__bit_set(d, dst.offset + dst.prec, 8 * dst_p->shared->size - (dst.offset + dst.prec), (hbool_t)(H5T_PAD_ONE == dst.msb_pad)); } @@ -9377,7 +8463,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz } else if (H5T_ORDER_VAX == dst.order && reverse) { tsize = dst_p->shared->size; - HDassert(0 == tsize % 2); + assert(0 == tsize % 2); for (i = 0; i < tsize; i += 4) { tmp1 = d[i]; @@ -9406,13 +8492,13 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz dp += direction * (ssize_t)dst_p->shared->size; } - HDmemset(int_buf, 0, buf_size); + memset(int_buf, 0, buf_size); } break; default: - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command"); } /* end switch */ done: @@ -9435,9 +8521,6 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz * * Failure: Null * - * Programmer: Raymond Lu - * April 26, 2004 - * *------------------------------------------------------------------------- */ static herr_t @@ -9447,8 +8530,8 @@ H5T__reverse_order(uint8_t *rev, uint8_t *s, size_t size, H5T_order_t order) FUNC_ENTER_PACKAGE_NOERR - HDassert(s); - HDassert(size); + assert(s); + assert(size); if (H5T_ORDER_VAX == order) { for (i = 0; i < size; i += 2) { @@ -9490,16 +8573,16 @@ H5T_reclaim(hid_t type_id, H5S_t *space, void *buf) FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(H5I_DATATYPE == H5I_get_type(type_id)); - HDassert(space); - HDassert(buf); + assert(H5I_DATATYPE == H5I_get_type(type_id)); + assert(space); + assert(buf); if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype"); /* Get the allocation info */ if (H5CX_get_vlen_alloc_info(&vl_alloc_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info"); /* Call H5S_select_iterate with args, etc. */ dset_op.op_type = H5S_SEL_ITER_OP_LIB; @@ -9530,19 +8613,19 @@ H5T_reclaim_cb(void *elem, const H5T_t *dt, unsigned H5_ATTR_UNUSED ndim, const FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(elem); - HDassert(dt); + assert(elem); + assert(dt); if (dt->shared->type == H5T_REFERENCE) { if (H5T__ref_reclaim(elem, dt) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim ref elements") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim ref elements"); } else { - HDassert(op_data); + assert(op_data); /* Allow vlen reclaim to recurse into that routine */ if (H5T__vlen_reclaim(elem, dt, (H5T_vlen_alloc_info_t *)op_data) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements"); } done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tcset.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tcset.c index 77bdb6a12b..60eea699e6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tcset.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tcset.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -34,9 +33,6 @@ * * Failure: H5T_CSET_ERROR (Negative) * - * Programmer: Robb Matzke - * Friday, January 9, 1998 - * *------------------------------------------------------------------------- */ H5T_cset_t @@ -50,12 +46,12 @@ H5Tget_cset(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_CSET_ERROR, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_CSET_ERROR, "not a data type"); while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt->shared)) HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_CSET_ERROR, - "operation not defined for data type class") + "operation not defined for data type class"); /* result */ if (H5T_IS_FIXED_STRING(dt->shared)) @@ -76,9 +72,6 @@ H5Tget_cset(hid_t type_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 9, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -92,15 +85,15 @@ H5Tset_cset(hid_t type_id, H5T_cset_t cset) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only"); if (cset < H5T_CSET_ASCII || cset >= H5T_NCSET) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal character set type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal character set type"); while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for data type class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for data type class"); /* Commit */ if (H5T_IS_FIXED_STRING(dt->shared)) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tdbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tdbg.c index 515b710e04..49c9d0f5db 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tdbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tdbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Tdbg.c - * Jul 19 2007 - * Quincey Koziol * * Purpose: Dump debugging information about a datatype * @@ -100,11 +97,11 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i H5_timer_get_time_string(path->stats.times.elapsed)}; if (nprint && 0 == (*nprint)++) { - HDfprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", "Conversion", "Elmts", "Calls", - "User", "System", "Elapsed", "Bandwidth"); - HDfprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", "----------", "-----", "-----", - "----", "------", "-------", "---------"); + fprintf(H5DEBUG(T), "H5T: type conversion statistics:\n"); + fprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", "Conversion", "Elmts", "Calls", + "User", "System", "Elapsed", "Bandwidth"); + fprintf(H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n", "----------", "-----", "-----", + "----", "------", "-------", "---------"); } /* end if */ if (path->src && path->dst) @@ -117,12 +114,12 @@ H5T__print_stats(H5T_path_t H5_ATTR_UNUSED *path, int H5_ATTR_UNUSED *nprint /*i nbytes = 0; nbytes *= path->stats.nelmts; H5_bandwidth(bandwidth, sizeof(bandwidth), (double)nbytes, path->stats.times.elapsed); - HDfprintf(H5DEBUG(T), " %-16s %10" PRIdHSIZE " %10u %8s %8s %8s %10s\n", path->name, - path->stats.nelmts, path->stats.ncalls, timestrs.user, timestrs.system, timestrs.elapsed, - bandwidth); - HDfree(timestrs.user); - HDfree(timestrs.system); - HDfree(timestrs.elapsed); + fprintf(H5DEBUG(T), " %-16s %10" PRIdHSIZE " %10u %8s %8s %8s %10s\n", path->name, + path->stats.nelmts, path->stats.ncalls, timestrs.user, timestrs.system, timestrs.elapsed, + bandwidth); + free(timestrs.user); + free(timestrs.system); + free(timestrs.elapsed); } #endif @@ -149,8 +146,8 @@ H5T_debug(const H5T_t *dt, FILE *stream) FUNC_ENTER_NOAPI_NOINIT /* Check args */ - HDassert(dt); - HDassert(stream); + assert(dt); + assert(stream); switch (dt->shared->type) { case H5T_NO_CLASS: @@ -225,10 +222,10 @@ H5T_debug(const H5T_t *dt, FILE *stream) s2 = "[named,open]"; break; default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); } /* end switch */ - HDfprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size)); + fprintf(stream, "%s%s {nbytes=%lu", s1, s2, (unsigned long)(dt->shared->size)); if (H5T_IS_ATOMIC(dt->shared)) { uint64_t tmp; @@ -260,12 +257,12 @@ H5T_debug(const H5T_t *dt, FILE *stream) break; } /* end switch */ - HDfprintf(stream, ", %s", s1); + fprintf(stream, ", %s", s1); if (dt->shared->u.atomic.offset) - HDfprintf(stream, ", offset=%lu", (unsigned long)(dt->shared->u.atomic.offset)); + fprintf(stream, ", offset=%lu", (unsigned long)(dt->shared->u.atomic.offset)); if (dt->shared->u.atomic.prec != 8 * dt->shared->size) - HDfprintf(stream, ", prec=%lu", (unsigned long)(dt->shared->u.atomic.prec)); + fprintf(stream, ", prec=%lu", (unsigned long)(dt->shared->u.atomic.prec)); switch (dt->shared->type) { case H5T_NO_CLASS: @@ -293,7 +290,7 @@ H5T_debug(const H5T_t *dt, FILE *stream) } /* end switch */ if (s1) - HDfprintf(stream, ", %s", s1); + fprintf(stream, ", %s", s1); break; case H5T_FLOAT: @@ -319,20 +316,20 @@ H5T_debug(const H5T_t *dt, FILE *stream) break; } /* end switch */ - HDfprintf(stream, ", sign=%lu+1", (unsigned long)(dt->shared->u.atomic.u.f.sign)); - HDfprintf(stream, ", mant=%lu+%lu (%s)", (unsigned long)(dt->shared->u.atomic.u.f.mpos), - (unsigned long)(dt->shared->u.atomic.u.f.msize), s1); - HDfprintf(stream, ", exp=%lu+%lu", (unsigned long)(dt->shared->u.atomic.u.f.epos), - (unsigned long)(dt->shared->u.atomic.u.f.esize)); + fprintf(stream, ", sign=%lu+1", (unsigned long)(dt->shared->u.atomic.u.f.sign)); + fprintf(stream, ", mant=%lu+%lu (%s)", (unsigned long)(dt->shared->u.atomic.u.f.mpos), + (unsigned long)(dt->shared->u.atomic.u.f.msize), s1); + fprintf(stream, ", exp=%lu+%lu", (unsigned long)(dt->shared->u.atomic.u.f.epos), + (unsigned long)(dt->shared->u.atomic.u.f.esize)); tmp = dt->shared->u.atomic.u.f.ebias >> 32; if (tmp) { size_t hi = (size_t)tmp; size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff); - HDfprintf(stream, " bias=0x%08lx%08lx", (unsigned long)hi, (unsigned long)lo); + fprintf(stream, " bias=0x%08lx%08lx", (unsigned long)hi, (unsigned long)lo); } else { size_t lo = (size_t)(dt->shared->u.atomic.u.f.ebias & 0xffffffff); - HDfprintf(stream, " bias=0x%08lx", (unsigned long)lo); + fprintf(stream, " bias=0x%08lx", (unsigned long)lo); } break; @@ -354,12 +351,12 @@ H5T_debug(const H5T_t *dt, FILE *stream) else if (H5T_COMPOUND == dt->shared->type) { /* Compound data type */ for (i = 0; i < dt->shared->u.compnd.nmembs; i++) { - HDfprintf(stream, "\n\"%s\" @%lu", dt->shared->u.compnd.memb[i].name, - (unsigned long)(dt->shared->u.compnd.memb[i].offset)); - HDfprintf(stream, " "); + fprintf(stream, "\n\"%s\" @%lu", dt->shared->u.compnd.memb[i].name, + (unsigned long)(dt->shared->u.compnd.memb[i].offset)); + fprintf(stream, " "); H5T_debug(dt->shared->u.compnd.memb[i].type, stream); } /* end for */ - HDfprintf(stream, "\n"); + fprintf(stream, "\n"); } else if (H5T_VLEN == dt->shared->type) { switch (dt->shared->u.vlen.loc) { @@ -368,54 +365,53 @@ H5T_debug(const H5T_t *dt, FILE *stream) break; case H5T_LOC_MEMORY: - HDfprintf(stream, ", loc=memory"); + fprintf(stream, ", loc=memory"); break; case H5T_LOC_DISK: - HDfprintf(stream, ", loc=disk"); + fprintf(stream, ", loc=disk"); break; case H5T_LOC_MAXLOC: default: - HDfprintf(stream, ", loc=UNKNOWN"); + fprintf(stream, ", loc=UNKNOWN"); break; } /* end switch */ if (H5T_IS_VL_STRING(dt->shared)) /* Variable length string datatype */ - HDfprintf(stream, ", variable-length"); + fprintf(stream, ", variable-length"); else { /* Variable length sequence datatype */ - HDfprintf(stream, " VLEN "); + fprintf(stream, " VLEN "); H5T_debug(dt->shared->parent, stream); - HDfprintf(stream, "\n"); + fprintf(stream, "\n"); } /* end else */ } else if (H5T_ENUM == dt->shared->type) { size_t base_size; /* Enumeration data type */ - HDfprintf(stream, " "); + fprintf(stream, " "); H5T_debug(dt->shared->parent, stream); base_size = dt->shared->parent->shared->size; for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { size_t k; - HDfprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); + fprintf(stream, "\n\"%s\" = 0x", dt->shared->u.enumer.name[i]); for (k = 0; k < base_size; k++) - HDfprintf(stream, "%02" PRIx8, - *((uint8_t *)dt->shared->u.enumer.value + (i * base_size) + k)); + fprintf(stream, "%02" PRIx8, *((uint8_t *)dt->shared->u.enumer.value + (i * base_size) + k)); } /* end for */ - HDfprintf(stream, "\n"); + fprintf(stream, "\n"); } else if (H5T_OPAQUE == dt->shared->type) { - HDfprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag); + fprintf(stream, ", tag=\"%s\"", dt->shared->u.opaque.tag); } else { /* Unknown */ - HDfprintf(stream, "unknown class %d\n", (int)(dt->shared->type)); + fprintf(stream, "unknown class %d\n", (int)(dt->shared->type)); } - HDfprintf(stream, "}"); + fprintf(stream, "}"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tdeprec.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tdeprec.c index e99e6e1cac..6fd4d450d5 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tdeprec.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tdeprec.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5Tdeprec.c - * April 5 2007 - * Quincey Koziol * * Purpose: Deprecated functions from the H5T interface. These * functions are here for compatibility purposes and may be @@ -90,9 +87,6 @@ H5FL_EXTERN(H5VL_object_t); * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Monday, June 1, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -110,32 +104,32 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) /* Check arguments */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_is_named(dt)) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed"); /* Set up collective metadata if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info"); loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); /* get the object from the loc_id */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Commit the datatype */ if (NULL == (data = H5VL_datatype_commit(vol_obj, &loc_params, name, type_id, H5P_LINK_CREATE_DEFAULT, H5P_DATATYPE_CREATE_DEFAULT, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype"); /* Set up VOL object */ if (NULL == (new_obj = H5VL_create_object(data, vol_obj->connector))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't create VOL object for committed datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't create VOL object for committed datatype"); /* Set the committed type object to the VOL connector pointer in the H5T_t struct */ dt->vol_obj = new_obj; @@ -155,9 +149,6 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) * * Failure: H5I_INVALID_HID * - * Programmer: Robb Matzke - * Monday, June 1, 1998 - * *------------------------------------------------------------------------- */ hid_t @@ -173,29 +164,29 @@ H5Topen1(hid_t loc_id, const char *name) /* Check args */ if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "no name"); loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); /* Get the location object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Open the datatype */ if (NULL == (dt = H5VL_datatype_open(vol_obj, &loc_params, name, H5P_DATATYPE_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open named datatype"); /* Register the type and return the ID */ if ((ret_value = H5VL_register(H5I_DATATYPE, dt, vol_obj->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register named datatype"); done: /* Cleanup on error */ if (H5I_INVALID_HID == ret_value) if (dt && H5VL_datatype_close(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to close datatype"); FUNC_LEAVE_API(ret_value) } /* end H5Topen1() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tenum.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tenum.c index db60063ecc..3544ef568e 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tenum.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tenum.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -38,9 +37,6 @@ static herr_t H5T__enum_valueof(const H5T_t *dt, const char *name, void *value / * * Failure: Negative * - * Programmer: Robb Matzke - * Tuesday, December 22, 1998 - * *------------------------------------------------------------------------- */ hid_t @@ -56,15 +52,15 @@ H5Tenum_create(hid_t parent_id) /* Check args */ if (NULL == (parent = (H5T_t *)H5I_object_verify(parent_id, H5I_DATATYPE)) || H5T_INTEGER != parent->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an integer data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an integer data type"); /* Build new type */ if (NULL == (dt = H5T__enum_create(parent))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "cannot create enum type") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, H5I_INVALID_HID, "cannot create enum type"); /* Register the type */ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register data type ID") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register data type ID"); done: FUNC_LEAVE_API(ret_value) @@ -81,9 +77,6 @@ H5Tenum_create(hid_t parent_id) * * Failure: NULL * - * Programmer: Raymond Lu - * October 9, 2002 - * *------------------------------------------------------------------------- */ H5T_t * @@ -93,14 +86,14 @@ H5T__enum_create(const H5T_t *parent) FUNC_ENTER_PACKAGE - HDassert(parent); + assert(parent); /* Build new type */ if (NULL == (ret_value = H5T__alloc())) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); ret_value->shared->type = H5T_ENUM; ret_value->shared->parent = H5T_copy(parent, H5T_COPY_ALL); - HDassert(ret_value->shared->parent); + assert(ret_value->shared->parent); ret_value->shared->size = ret_value->shared->parent->shared->size; done: @@ -121,9 +114,6 @@ H5T__enum_create(const H5T_t *parent) * * Failure: negative * - * Programmer: Robb Matzke - * Wednesday, December 23, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -137,17 +127,17 @@ H5Tenum_insert(hid_t type, const char *name, const void *value) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); if (H5T_ENUM != dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an enumeration data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an enumeration data type"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified"); if (!value) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no value specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no value specified"); /* Do work */ if (H5T__enum_insert(dt, name, value) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert new enumeration member") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to insert new enumeration member"); done: FUNC_LEAVE_API(ret_value) @@ -165,9 +155,6 @@ H5Tenum_insert(hid_t type, const char *name, const void *value) * * Failure: negative * - * Programmer: Robb Matzke - * Wednesday, December 23, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -178,17 +165,16 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) FUNC_ENTER_PACKAGE - HDassert(dt); - HDassert(name && *name); - HDassert(value); + assert(dt); + assert(name && *name); + assert(value); /* The name and value had better not already exist */ for (i = 0; i < dt->shared->u.enumer.nmembs; i++) { if (!HDstrcmp(dt->shared->u.enumer.name[i], name)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "name redefinition") - if (!HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->size), value, - dt->shared->size)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "value redefinition") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "name redefinition"); + if (!memcmp((uint8_t *)dt->shared->u.enumer.value + (i * dt->shared->size), value, dt->shared->size)) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "value redefinition"); } /* Increase table sizes */ @@ -198,11 +184,11 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) unsigned n = MAX(32, 2 * dt->shared->u.enumer.nalloc); if (NULL == (names = (char **)H5MM_realloc(dt->shared->u.enumer.name, n * sizeof(char *)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); dt->shared->u.enumer.name = names; if (NULL == (values = (uint8_t *)H5MM_realloc(dt->shared->u.enumer.value, n * dt->shared->size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); dt->shared->u.enumer.value = values; dt->shared->u.enumer.nalloc = n; } @@ -227,9 +213,6 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) * * Failure: negative, VALUE memory is undefined. * - * Programmer: Robb Matzke - * Wednesday, December 23, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -242,16 +225,16 @@ H5Tget_member_value(hid_t type, unsigned membno, void *value /*out*/) H5TRACE3("e", "iIux", type, membno, value); if (NULL == (dt = (H5T_t *)H5I_object_verify(type, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); if (H5T_ENUM != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class"); if (membno >= dt->shared->u.enumer.nmembs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid member number"); if (!value) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null value buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null value buffer"); if (H5T__get_member_value(dt, membno, value) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get member value") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get member value"); done: FUNC_LEAVE_API(ret_value) } @@ -267,9 +250,6 @@ H5Tget_member_value(hid_t type, unsigned membno, void *value /*out*/) * * Failure: negative, VALUE memory is undefined. * - * Programmer: Raymond Lu - * October 9, 2002 - * *------------------------------------------------------------------------- */ herr_t @@ -277,8 +257,8 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value /*out*/) { FUNC_ENTER_PACKAGE_NOERR - HDassert(dt); - HDassert(value); + assert(dt); + assert(value); H5MM_memcpy(value, (uint8_t *)dt->shared->u.enumer.value + (membno * dt->shared->size), dt->shared->size); @@ -300,9 +280,6 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value /*out*/) * Failure: Negative, first character of NAME is set to * null if SIZE allows it. * - * Programmer: Robb Matzke - * Monday, January 4, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -316,16 +293,16 @@ H5Tenum_nameof(hid_t type, const void *value, char *name /*out*/, size_t size) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); if (H5T_ENUM != dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an enumeration data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an enumeration data type"); if (!value) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no value supplied") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no value supplied"); if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name buffer supplied") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name buffer supplied"); if (NULL == H5T__enum_nameof(dt, value, name, size)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "nameof query failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "nameof query failed"); done: FUNC_LEAVE_API(ret_value) @@ -334,7 +311,7 @@ H5Tenum_nameof(hid_t type, const void *value, char *name /*out*/, size_t size) /*------------------------------------------------------------------------- * Function: H5T__enum_nameof * - * Purpose: Finds the symbol name that corresponds the the specified + * Purpose: Finds the symbol name that corresponds to the specified * VALUE of an enumeration data type DT. At most SIZE characters * of the symbol name are copied into the NAME buffer. If the * entire symbol name and null terminator do not fit in the NAME @@ -349,9 +326,6 @@ H5Tenum_nameof(hid_t type, const void *value, char *name /*out*/, size_t size) * * Failure: NULL, name[0] is set to null. * - * Programmer: Robb Matzke - * Monday, January 4, 1999 - * *------------------------------------------------------------------------- */ static char * @@ -366,30 +340,30 @@ H5T__enum_nameof(const H5T_t *dt, const void *value, char *name /*out*/, size_t FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dt && H5T_ENUM == dt->shared->type); - HDassert(value); - HDassert(name || 0 == size); + assert(dt && H5T_ENUM == dt->shared->type); + assert(value); + assert(name || 0 == size); if (name && size > 0) *name = '\0'; /* Sanity check */ if (dt->shared->u.enumer.nmembs == 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "datatype has no members") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "datatype has no members"); /* Do a binary search over the values to find the correct one. Do sorting * and search on the copied datatype to protect the original order. */ if (NULL == (copied_dt = H5T_copy(dt, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to copy data type"); if (H5T__sort_value(copied_dt, NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOMPARE, NULL, "value sort failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOMPARE, NULL, "value sort failed"); lt = 0; rt = copied_dt->shared->u.enumer.nmembs; while (lt < rt) { md = (lt + rt) / 2; - cmp = HDmemcmp(value, (uint8_t *)copied_dt->shared->u.enumer.value + (md * copied_dt->shared->size), - copied_dt->shared->size); + cmp = memcmp(value, (uint8_t *)copied_dt->shared->u.enumer.value + (md * copied_dt->shared->size), + copied_dt->shared->size); if (cmp < 0) rt = md; else if (cmp > 0) @@ -400,7 +374,7 @@ H5T__enum_nameof(const H5T_t *dt, const void *value, char *name /*out*/, size_t /* Value was not yet defined. This fixes bug # 774, 2002/06/05 EIP */ if (cmp != 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "value is currently not defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "value is currently not defined"); /* Save result name */ if (!name) { @@ -410,7 +384,7 @@ H5T__enum_nameof(const H5T_t *dt, const void *value, char *name /*out*/, size_t } /* end if */ HDstrncpy(name, copied_dt->shared->u.enumer.name[md], size); if (HDstrlen(copied_dt->shared->u.enumer.name[md]) >= size) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, NULL, "name has been truncated") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, NULL, "name has been truncated"); /* Set return value */ ret_value = name; @@ -437,9 +411,6 @@ H5T__enum_nameof(const H5T_t *dt, const void *value, char *name /*out*/, size_t * * Failure: Negative * - * Programmer: Robb Matzke - * Monday, January 4, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -453,16 +424,16 @@ H5Tenum_valueof(hid_t type, const char *name, void *value /*out*/) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); if (H5T_ENUM != dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an enumeration data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an enumeration data type"); if (!name || !*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name"); if (!value) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no value buffer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no value buffer"); if (H5T__enum_valueof(dt, name, value) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "valueof query failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "valueof query failed"); done: FUNC_LEAVE_API(ret_value) @@ -471,7 +442,7 @@ H5Tenum_valueof(hid_t type, const char *name, void *value /*out*/) /*------------------------------------------------------------------------- * Function: H5T__enum_valueof * - * Purpose: Finds the value that corresponds the the specified symbol + * Purpose: Finds the value that corresponds to the specified symbol * NAME of an enumeration data type DT and copy it to the VALUE * result buffer. The VALUE should be allocated by the caller to * be large enough for the result. @@ -480,9 +451,6 @@ H5Tenum_valueof(hid_t type, const char *name, void *value /*out*/) * * Failure: Negative, VALUE is undefined. * - * Programmer: Robb Matzke - * Monday, January 4, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -496,20 +464,20 @@ H5T__enum_valueof(const H5T_t *dt, const char *name, void *value /*out*/) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dt && H5T_ENUM == dt->shared->type); - HDassert(name && *name); - HDassert(value); + assert(dt && H5T_ENUM == dt->shared->type); + assert(name && *name); + assert(value); /* Sanity check */ if (dt->shared->u.enumer.nmembs == 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "datatype has no members") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "datatype has no members"); /* Do a binary search over the names to find the correct one. Do sorting * and search on the copied datatype to protect the original order. */ if (NULL == (copied_dt = H5T_copy(dt, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to copy data type"); if (H5T__sort_name(copied_dt, NULL) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOMPARE, FAIL, "value sort failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOMPARE, FAIL, "value sort failed"); lt = 0; rt = copied_dt->shared->u.enumer.nmembs; @@ -529,7 +497,7 @@ H5T__enum_valueof(const H5T_t *dt, const char *name, void *value /*out*/) } /* Value was not yet defined. This fixes bug # 774, 2002/06/05 EIP */ if (cmp != 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "string doesn't exist in the enumeration type") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "string doesn't exist in the enumeration type"); H5MM_memcpy(value, (uint8_t *)copied_dt->shared->u.enumer.value + (md * copied_dt->shared->size), copied_dt->shared->size); @@ -537,7 +505,7 @@ H5T__enum_valueof(const H5T_t *dt, const char *name, void *value /*out*/) done: if (copied_dt) if (H5T_close_real(copied_dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close data type") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close data type"); FUNC_LEAVE_NOAPI(ret_value) } diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tfields.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tfields.c index 249a025cff..9d423d1d3b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tfields.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tfields.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -36,9 +35,6 @@ * * Errors: * - * Programmer: Robb Matzke - * Monday, December 8, 1997 - * *------------------------------------------------------------------------- */ int @@ -52,10 +48,10 @@ H5Tget_nmembers(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if ((ret_value = H5T_get_nmembers(dt)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot return member number") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "cannot return member number"); done: FUNC_LEAVE_API(ret_value) @@ -74,9 +70,6 @@ H5Tget_nmembers(hid_t type_id) * * Errors: * - * Programmer: Raymond Lu - * October 8, 2002 - * *------------------------------------------------------------------------- */ int @@ -86,14 +79,14 @@ H5T_get_nmembers(const H5T_t *dt) FUNC_ENTER_NOAPI(FAIL) - HDassert(dt); + assert(dt); if (H5T_COMPOUND == dt->shared->type) ret_value = (int)dt->shared->u.compnd.nmembs; else if (H5T_ENUM == dt->shared->type) ret_value = (int)dt->shared->u.enumer.nmembs; else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for type class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for type class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -112,9 +105,6 @@ H5T_get_nmembers(const H5T_t *dt) * * Failure: NULL * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ char * @@ -128,10 +118,10 @@ H5Tget_member_name(hid_t type_id, unsigned membno) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype"); if (NULL == (ret_value = H5T__get_member_name(dt, membno))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get member name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get member name"); done: FUNC_LEAVE_API(ret_value) @@ -150,9 +140,6 @@ H5Tget_member_name(hid_t type_id, unsigned membno) * * Failure: NULL * - * Programmer: Raymond Lu - * October 9, 2002 - * *------------------------------------------------------------------------- */ char * @@ -162,18 +149,18 @@ H5T__get_member_name(H5T_t const *dt, unsigned membno) FUNC_ENTER_PACKAGE - HDassert(dt); + assert(dt); switch (dt->shared->type) { case H5T_COMPOUND: if (membno >= dt->shared->u.compnd.nmembs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number"); ret_value = H5MM_xstrdup(dt->shared->u.compnd.memb[membno].name); break; case H5T_ENUM: if (membno >= dt->shared->u.enumer.nmembs) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid member number"); ret_value = H5MM_xstrdup(dt->shared->u.enumer.name[membno]); break; @@ -189,7 +176,7 @@ H5T__get_member_name(H5T_t const *dt, unsigned membno) case H5T_ARRAY: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class"); } /*lint !e788 All appropriate cases are covered */ done: @@ -207,9 +194,6 @@ H5T__get_member_name(H5T_t const *dt, unsigned membno) * Return: Success: index of the member if exists. * Failure: -1. * - * Programmer: Raymond Lu - * Thursday, April 4, 2002 - * *------------------------------------------------------------------------- */ int @@ -223,21 +207,21 @@ H5Tget_member_index(hid_t type_id, const char *name) H5TRACE2("Is", "i*s", type_id, name); /* Check arguments */ - HDassert(name); + assert(name); if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Locate member by name */ switch (dt->shared->type) { case H5T_COMPOUND: for (i = 0; i < dt->shared->u.compnd.nmembs; i++) if (!HDstrcmp(dt->shared->u.compnd.memb[i].name, name)) - HGOTO_DONE((int)i) + HGOTO_DONE((int)i); break; case H5T_ENUM: for (i = 0; i < dt->shared->u.enumer.nmembs; i++) if (!HDstrcmp(dt->shared->u.enumer.name[i], name)) - HGOTO_DONE((int)i) + HGOTO_DONE((int)i); break; case H5T_NO_CLASS: @@ -252,7 +236,7 @@ H5Tget_member_index(hid_t type_id, const char *name) case H5T_ARRAY: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type"); } /*lint !e788 All appropriate cases are covered */ done: @@ -270,9 +254,6 @@ H5Tget_member_index(hid_t type_id, const char *name) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -288,8 +269,8 @@ H5T__sort_value(const H5T_t *dt, int *map) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(dt); - HDassert(H5T_COMPOUND == dt->shared->type || H5T_ENUM == dt->shared->type); + assert(dt); + assert(H5T_COMPOUND == dt->shared->type || H5T_ENUM == dt->shared->type); /* Use a bubble sort because we can short circuit */ if (H5T_COMPOUND == dt->shared->type) { @@ -315,7 +296,7 @@ H5T__sort_value(const H5T_t *dt, int *map) #ifndef NDEBUG /* I never trust a sort :-) -RPM */ for (i = 0; i < (nmembs - 1); i++) - HDassert(dt->shared->u.compnd.memb[i].offset < dt->shared->u.compnd.memb[i + 1].offset); + assert(dt->shared->u.compnd.memb[i].offset < dt->shared->u.compnd.memb[i + 1].offset); #endif } /* end if */ } @@ -324,11 +305,11 @@ H5T__sort_value(const H5T_t *dt, int *map) dt->shared->u.enumer.sorted = H5T_SORT_VALUE; nmembs = dt->shared->u.enumer.nmembs; size = dt->shared->size; - HDassert(size <= sizeof(tbuf)); + assert(size <= sizeof(tbuf)); for (i = (nmembs - 1), swapped = TRUE; i > 0 && swapped; --i) { for (j = 0, swapped = FALSE; j < i; j++) { - if (HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (j * size), - (uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), size) > 0) { + if (memcmp((uint8_t *)dt->shared->u.enumer.value + (j * size), + (uint8_t *)dt->shared->u.enumer.value + ((j + 1) * size), size) > 0) { /* Swap names */ char *tmp = dt->shared->u.enumer.name[j]; dt->shared->u.enumer.name[j] = dt->shared->u.enumer.name[j + 1]; @@ -355,8 +336,8 @@ H5T__sort_value(const H5T_t *dt, int *map) #ifndef NDEBUG /* I never trust a sort :-) -RPM */ for (i = 0; i < (nmembs - 1); i++) - HDassert(HDmemcmp((uint8_t *)dt->shared->u.enumer.value + (i * size), - (uint8_t *)dt->shared->u.enumer.value + ((i + 1) * size), size) < 0); + assert(memcmp((uint8_t *)dt->shared->u.enumer.value + (i * size), + (uint8_t *)dt->shared->u.enumer.value + ((i + 1) * size), size) < 0); #endif } /* end if */ } /* end else */ @@ -375,9 +356,6 @@ H5T__sort_value(const H5T_t *dt, int *map) * * Failure: Negative * - * Programmer: Robb Matzke - * Monday, January 4, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -391,8 +369,8 @@ H5T__sort_name(const H5T_t *dt, int *map) FUNC_ENTER_PACKAGE_NOERR /* Check args */ - HDassert(dt); - HDassert(H5T_COMPOUND == dt->shared->type || H5T_ENUM == dt->shared->type); + assert(dt); + assert(H5T_COMPOUND == dt->shared->type || H5T_ENUM == dt->shared->type); /* Use a bubble sort because we can short circuit */ if (H5T_COMPOUND == dt->shared->type) { @@ -418,8 +396,8 @@ H5T__sort_name(const H5T_t *dt, int *map) #ifndef NDEBUG /* I never trust a sort :-) -RPM */ for (i = 0; i < nmembs - 1; i++) { - HDassert(HDstrcmp(dt->shared->u.compnd.memb[i].name, dt->shared->u.compnd.memb[i + 1].name) < - 0); + assert(HDstrcmp(dt->shared->u.compnd.memb[i].name, dt->shared->u.compnd.memb[i + 1].name) < + 0); } #endif } @@ -429,7 +407,7 @@ H5T__sort_name(const H5T_t *dt, int *map) dt->shared->u.enumer.sorted = H5T_SORT_NAME; nmembs = dt->shared->u.enumer.nmembs; size = dt->shared->size; - HDassert(size <= sizeof(tbuf)); + assert(size <= sizeof(tbuf)); for (i = nmembs - 1, swapped = TRUE; i > 0 && swapped; --i) { for (j = 0, swapped = FALSE; j < i; j++) { if (HDstrcmp(dt->shared->u.enumer.name[j], dt->shared->u.enumer.name[j + 1]) > 0) { @@ -458,7 +436,7 @@ H5T__sort_name(const H5T_t *dt, int *map) #ifndef NDEBUG /* I never trust a sort :-) -RPM */ for (i = 0; i < nmembs - 1; i++) - HDassert(HDstrcmp(dt->shared->u.enumer.name[i], dt->shared->u.enumer.name[i + 1]) < 0); + assert(HDstrcmp(dt->shared->u.enumer.name[i], dt->shared->u.enumer.name[i + 1]) < 0); #endif } } diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tfixed.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tfixed.c index ac462041ba..12f600b92f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tfixed.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tfixed.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -32,9 +31,6 @@ * * Failure: H5T_SGN_ERROR (Negative) * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ H5T_sign_t @@ -48,7 +44,7 @@ H5Tget_sign(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR, "not an integer datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_SGN_ERROR, "not an integer datatype"); ret_value = H5T_get_sign(dt); @@ -66,9 +62,6 @@ H5Tget_sign(hid_t type_id) * * Failure: H5T_SGN_ERROR (Negative) * - * Programmer: Raymond Lu - * October 8, 2002 - * *------------------------------------------------------------------------- */ H5T_sign_t @@ -78,7 +71,7 @@ H5T_get_sign(H5T_t const *dt) FUNC_ENTER_NOAPI(H5T_SGN_ERROR) - HDassert(dt); + assert(dt); /* Defer to parent */ while (dt->shared->parent) @@ -86,7 +79,7 @@ H5T_get_sign(H5T_t const *dt) /* Check args */ if (H5T_INTEGER != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_SGN_ERROR, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_SGN_ERROR, "operation not defined for datatype class"); /* Sign */ ret_value = dt->shared->u.atomic.u.i.sign; @@ -102,9 +95,6 @@ H5T_get_sign(H5T_t const *dt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -118,17 +108,17 @@ H5Tset_sign(hid_t type_id, H5T_sign_t sign) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an integer datatype"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only"); if (sign < H5T_SGN_NONE || sign >= H5T_NSGN) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal sign type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal sign type"); if (H5T_ENUM == dt->shared->type && dt->shared->u.enumer.nmembs > 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_INTEGER != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for datatype class"); /* Commit */ dt->shared->u.atomic.u.i.sign = sign; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tfloat.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tfloat.c index fb9d95b680..01a5607261 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tfloat.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tfloat.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -38,9 +37,6 @@ * * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -55,11 +51,11 @@ H5Tget_fields(hid_t type_id, size_t *spos /*out*/, size_t *epos /*out*/, size_t /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class"); /* Get values */ if (spos) @@ -90,9 +86,6 @@ H5Tget_fields(hid_t type_id, size_t *spos /*out*/, size_t *epos /*out*/, size_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -106,27 +99,27 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize, size_t mpos /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class"); if (epos + esize > dt->shared->u.atomic.prec) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent bit field size/location is invalid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent bit field size/location is invalid"); if (mpos + msize > dt->shared->u.atomic.prec) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mantissa bit field size/location is invalid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mantissa bit field size/location is invalid"); if (spos >= dt->shared->u.atomic.prec) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign location is not valid") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign location is not valid"); /* Check for overlap */ if (spos >= epos && spos < epos + esize) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign bit appears within exponent field") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign bit appears within exponent field"); if (spos >= mpos && spos < mpos + msize) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign bit appears within mantissa field") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "sign bit appears within mantissa field"); if ((mpos < epos && mpos + msize > epos) || (epos < mpos && epos + esize > mpos)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent and mantissa fields overlap") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "exponent and mantissa fields overlap"); /* Commit */ dt->shared->u.atomic.u.f.sign = spos; @@ -148,9 +141,6 @@ H5Tset_fields(hid_t type_id, size_t spos, size_t epos, size_t esize, size_t mpos * * Failure: 0 * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ size_t @@ -164,11 +154,11 @@ H5Tget_ebias(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, 0, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, 0, "operation not defined for datatype class"); /* bias */ H5_CHECKED_ASSIGN(ret_value, size_t, dt->shared->u.atomic.u.f.ebias, uint64_t); @@ -184,9 +174,6 @@ H5Tget_ebias(hid_t type_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -200,13 +187,13 @@ H5Tset_ebias(hid_t type_id, size_t ebias) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class"); /* Commit */ dt->shared->u.atomic.u.f.ebias = ebias; @@ -225,9 +212,6 @@ H5Tset_ebias(hid_t type_id, size_t ebias) * * Failure: H5T_NORM_ERROR (Negative) * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ H5T_norm_t @@ -241,11 +225,11 @@ H5Tget_norm(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NORM_ERROR, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_NORM_ERROR, "not a datatype"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_NORM_ERROR, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_NORM_ERROR, "operation not defined for datatype class"); /* norm */ ret_value = dt->shared->u.atomic.u.f.norm; @@ -262,9 +246,6 @@ H5Tget_norm(hid_t type_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -278,15 +259,15 @@ H5Tset_norm(hid_t type_id, H5T_norm_t norm) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only"); if (norm < H5T_NORM_IMPLIED || norm > H5T_NORM_NONE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal normalization") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal normalization"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class"); /* Commit */ dt->shared->u.atomic.u.f.norm = norm; @@ -307,9 +288,6 @@ H5Tset_norm(hid_t type_id, H5T_norm_t norm) * * Failure: H5T_PAD_ERROR (Negative) * - * Programmer: Robb Matzke - * Friday, January 9, 1998 - * *------------------------------------------------------------------------- */ H5T_pad_t @@ -323,11 +301,11 @@ H5Tget_inpad(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_PAD_ERROR, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_PAD_ERROR, "not a datatype"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_PAD_ERROR, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_PAD_ERROR, "operation not defined for datatype class"); /* pad */ ret_value = dt->shared->u.atomic.u.f.pad; @@ -346,9 +324,6 @@ H5Tget_inpad(hid_t type_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 9, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -362,15 +337,15 @@ H5Tset_inpad(hid_t type_id, H5T_pad_t pad) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only"); if (pad < H5T_PAD_ZERO || pad >= H5T_NPAD) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal internal pad type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal internal pad type"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_FLOAT != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "operation not defined for datatype class"); /* Commit */ dt->shared->u.atomic.u.f.pad = pad; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tinit_GCC.c_ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tinit_GCC.c_ index ef7612fb86..bb463da56b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tinit_GCC.c_ +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tinit_GCC.c_ @@ -4,7 +4,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,8 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Created: Sep 14, 2022 - * J.Daniel Smith + * Created: Aug 17, 2023 + * Dan Smith * * Purpose: This machine-generated source code contains * information about the various integer and @@ -54,8 +53,6 @@ * before the first `M' but after the implicit * bit. * - * Modifications: - * * DO NOT MAKE MODIFICATIONS TO THIS FILE! * It was generated by code in `H5detect.c'. * @@ -144,12 +141,12 @@ H5T__init_native(void) FUNC_ENTER_PACKAGE /* - * 3 2 1 0 + * 3 2 1 0 * SEEEEEEE EMMMMMMM MMMMMMMM MMMMMMMM * Implicit bit? yes */ if(NULL == (dt = H5T__alloc())) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed"); dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_FLOAT; dt->shared->size = 4; @@ -167,18 +164,18 @@ dt->shared->u.atomic.u.f.msize = 23; dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; if((H5T_NATIVE_FLOAT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype"); H5T_NATIVE_FLOAT_ALIGN_g = 4; /* - * 7 6 5 4 + * 7 6 5 4 * SEEEEEEE EEEEMMMM MMMMMMMM MMMMMMMM - * 3 2 1 0 + * 3 2 1 0 * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM * Implicit bit? yes */ if(NULL == (dt = H5T__alloc())) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed"); dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_FLOAT; dt->shared->size = 8; @@ -196,22 +193,22 @@ dt->shared->u.atomic.u.f.msize = 52; dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; if((H5T_NATIVE_DOUBLE_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype"); H5T_NATIVE_DOUBLE_ALIGN_g = 8; /* - * 15 14 13 12 + * 15 14 13 12 * ???????? ???????? ???????? ???????? - * 11 10 9 8 + * 11 10 9 8 * ???????? ???????? SEEEEEEE EEEEEEEE - * 7 6 5 4 + * 7 6 5 4 * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM - * 3 2 1 0 + * 3 2 1 0 * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM * Implicit bit? no */ if(NULL == (dt = H5T__alloc())) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed"); dt->shared->state = H5T_STATE_IMMUTABLE; dt->shared->type = H5T_FLOAT; dt->shared->size = 16; @@ -229,7 +226,7 @@ dt->shared->u.atomic.u.f.msize = 64; dt->shared->u.atomic.u.f.norm = H5T_NORM_NONE; dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; if((H5T_NATIVE_LDOUBLE_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype"); H5T_NATIVE_LDOUBLE_ALIGN_g = 16; /* Set the native order for this machine */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tinit_MSVC.c_ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tinit_MSVC.c_ index 0cfb9a59ea..09a6190029 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tinit_MSVC.c_ +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tinit_MSVC.c_ @@ -1,243 +1,240 @@ -/* Generated automatically by H5detect -- do not edit */ - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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: Sep 14, 2022 - * - * - * Purpose: This machine-generated source code contains - * information about the various integer and - * floating point numeric formats found on this - * architecture. The parameters below should be - * checked carefully and errors reported to the - * HDF5 maintainer. - * - * Each of the numeric formats listed below are - * printed from most significant bit to least - * significant bit even though the actual bytes - * might be stored in a different order in - * memory. The integers above each binary byte - * indicate the relative order of the bytes in - * memory; little-endian machines have - * decreasing numbers while big-endian machines - * have increasing numbers. - * - * The fields of the numbers are printed as - * letters with `S' for the mantissa sign bit, - * `M' for the mantissa magnitude, and `E' for - * the exponent. The exponent has an associated - * bias which can be subtracted to find the - * true exponent. The radix point is assumed - * to be before the first `M' bit. Any bit - * of a floating-point value not falling into one - * of these categories is printed as a question - * mark. Bits of integer types are printed as - * `I' for 2's complement and `U' for magnitude. - * - * If the most significant bit of the normalized - * mantissa (always a `1' except for `0.0') is - * not stored then an `implicit=yes' appears - * under the field description. In this case, - * the radix point is still assumed to be - * before the first `M' but after the implicit - * bit. - * - * Modifications: - * - * DO NOT MAKE MODIFICATIONS TO THIS FILE! - * It was generated by code in `H5detect.c'. - * - *------------------------------------------------------------------------- - */ - -/****************/ -/* Module Setup */ -/****************/ - -#include "H5Tmodule.h" /* This source code file is part of the H5T module */ - - -/***********/ -/* Headers */ -/***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Tpkg.h" /* Datatypes */ - - -/****************/ -/* Local Macros */ -/****************/ - - -/******************/ -/* Local Typedefs */ -/******************/ - - -/********************/ -/* Package Typedefs */ -/********************/ - - -/********************/ -/* Local Prototypes */ -/********************/ - - -/********************/ -/* Public Variables */ -/********************/ - - -/*****************************/ -/* Library Private Variables */ -/*****************************/ - - -/*********************/ -/* Package Variables */ -/*********************/ - - - -/*******************/ -/* Local Variables */ -/*******************/ - - - -/*------------------------------------------------------------------------- - * Function: H5T__init_native - * - * Purpose: Initialize pre-defined native datatypes from code generated - * during the library configuration by H5detect. - * - * Return: Success: non-negative - * Failure: negative - * - * Programmer: Robb Matzke - * Wednesday, December 16, 1998 - * - *------------------------------------------------------------------------- - */ -herr_t -H5T__init_native(void) -{ - H5T_t *dt = NULL; - herr_t ret_value = SUCCEED; - - FUNC_ENTER_PACKAGE - - /* - * 3 2 1 0 - * SEEEEEEE EMMMMMMM MMMMMMMM MMMMMMMM - * Implicit bit? yes - */ - if(NULL == (dt = H5T__alloc())) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") - dt->shared->state = H5T_STATE_IMMUTABLE; - dt->shared->type = H5T_FLOAT; - dt->shared->size = 4; - dt->shared->u.atomic.order = H5T_ORDER_LE; - dt->shared->u.atomic.offset = 0; - dt->shared->u.atomic.prec = 32; - dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; - dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; -dt->shared->u.atomic.u.f.sign = 31; -dt->shared->u.atomic.u.f.epos = 23; -dt->shared->u.atomic.u.f.esize = 8; -dt->shared->u.atomic.u.f.ebias = 0x0000007f; -dt->shared->u.atomic.u.f.mpos = 0; -dt->shared->u.atomic.u.f.msize = 23; -dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; -dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; - if((H5T_NATIVE_FLOAT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") - H5T_NATIVE_FLOAT_ALIGN_g = 4; - - /* - * 7 6 5 4 - * SEEEEEEE EEEEMMMM MMMMMMMM MMMMMMMM - * 3 2 1 0 - * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM - * Implicit bit? yes - */ - if(NULL == (dt = H5T__alloc())) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") - dt->shared->state = H5T_STATE_IMMUTABLE; - dt->shared->type = H5T_FLOAT; - dt->shared->size = 8; - dt->shared->u.atomic.order = H5T_ORDER_LE; - dt->shared->u.atomic.offset = 0; - dt->shared->u.atomic.prec = 64; - dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; - dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; -dt->shared->u.atomic.u.f.sign = 63; -dt->shared->u.atomic.u.f.epos = 52; -dt->shared->u.atomic.u.f.esize = 11; -dt->shared->u.atomic.u.f.ebias = 0x000003ff; -dt->shared->u.atomic.u.f.mpos = 0; -dt->shared->u.atomic.u.f.msize = 52; -dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; -dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; - if((H5T_NATIVE_DOUBLE_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") - H5T_NATIVE_DOUBLE_ALIGN_g = 8; - - /* - * 7 6 5 4 - * SEEEEEEE EEEEMMMM MMMMMMMM MMMMMMMM - * 3 2 1 0 - * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM - * Implicit bit? yes - */ - if(NULL == (dt = H5T__alloc())) - HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed") - dt->shared->state = H5T_STATE_IMMUTABLE; - dt->shared->type = H5T_FLOAT; - dt->shared->size = 8; - dt->shared->u.atomic.order = H5T_ORDER_LE; - dt->shared->u.atomic.offset = 0; - dt->shared->u.atomic.prec = 64; - dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; - dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; -dt->shared->u.atomic.u.f.sign = 63; -dt->shared->u.atomic.u.f.epos = 52; -dt->shared->u.atomic.u.f.esize = 11; -dt->shared->u.atomic.u.f.ebias = 0x000003ff; -dt->shared->u.atomic.u.f.mpos = 0; -dt->shared->u.atomic.u.f.msize = 52; -dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; -dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; - if((H5T_NATIVE_LDOUBLE_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype") - H5T_NATIVE_LDOUBLE_ALIGN_g = 8; - - /* Set the native order for this machine */ - H5T_native_order_g = H5T_ORDER_LE; - -done: - if(ret_value < 0) { - if(dt != NULL) { - dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); - dt = H5FL_FREE(H5T_t, dt); - } /* end if */ - } /* end if */ - - FUNC_LEAVE_NOAPI(ret_value); -} /* end H5T__init_native() */ +/* Generated automatically by H5detect -- do not edit */ + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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: Aug 17, 2023 + * + * + * Purpose: This machine-generated source code contains + * information about the various integer and + * floating point numeric formats found on this + * architecture. The parameters below should be + * checked carefully and errors reported to the + * HDF5 maintainer. + * + * Each of the numeric formats listed below are + * printed from most significant bit to least + * significant bit even though the actual bytes + * might be stored in a different order in + * memory. The integers above each binary byte + * indicate the relative order of the bytes in + * memory; little-endian machines have + * decreasing numbers while big-endian machines + * have increasing numbers. + * + * The fields of the numbers are printed as + * letters with `S' for the mantissa sign bit, + * `M' for the mantissa magnitude, and `E' for + * the exponent. The exponent has an associated + * bias which can be subtracted to find the + * true exponent. The radix point is assumed + * to be before the first `M' bit. Any bit + * of a floating-point value not falling into one + * of these categories is printed as a question + * mark. Bits of integer types are printed as + * `I' for 2's complement and `U' for magnitude. + * + * If the most significant bit of the normalized + * mantissa (always a `1' except for `0.0') is + * not stored then an `implicit=yes' appears + * under the field description. In this case, + * the radix point is still assumed to be + * before the first `M' but after the implicit + * bit. + * + * DO NOT MAKE MODIFICATIONS TO THIS FILE! + * It was generated by code in `H5detect.c'. + * + *------------------------------------------------------------------------- + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Tmodule.h" /* This source code file is part of the H5T module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Tpkg.h" /* Datatypes */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ + + +/********************/ +/* Package Typedefs */ +/********************/ + + +/********************/ +/* Local Prototypes */ +/********************/ + + +/********************/ +/* Public Variables */ +/********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*********************/ +/* Package Variables */ +/*********************/ + + + +/*******************/ +/* Local Variables */ +/*******************/ + + + +/*------------------------------------------------------------------------- + * Function: H5T__init_native + * + * Purpose: Initialize pre-defined native datatypes from code generated + * during the library configuration by H5detect. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Robb Matzke + * Wednesday, December 16, 1998 + * + *------------------------------------------------------------------------- + */ +herr_t +H5T__init_native(void) +{ + H5T_t *dt = NULL; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE + + /* + * 3 2 1 0 + * SEEEEEEE EMMMMMMM MMMMMMMM MMMMMMMM + * Implicit bit? yes + */ + if(NULL == (dt = H5T__alloc())) + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed"); + dt->shared->state = H5T_STATE_IMMUTABLE; + dt->shared->type = H5T_FLOAT; + dt->shared->size = 4; + dt->shared->u.atomic.order = H5T_ORDER_LE; + dt->shared->u.atomic.offset = 0; + dt->shared->u.atomic.prec = 32; + dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; + dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; +dt->shared->u.atomic.u.f.sign = 31; +dt->shared->u.atomic.u.f.epos = 23; +dt->shared->u.atomic.u.f.esize = 8; +dt->shared->u.atomic.u.f.ebias = 0x0000007f; +dt->shared->u.atomic.u.f.mpos = 0; +dt->shared->u.atomic.u.f.msize = 23; +dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; +dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; + if((H5T_NATIVE_FLOAT_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype"); + H5T_NATIVE_FLOAT_ALIGN_g = 4; + + /* + * 7 6 5 4 + * SEEEEEEE EEEEMMMM MMMMMMMM MMMMMMMM + * 3 2 1 0 + * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM + * Implicit bit? yes + */ + if(NULL == (dt = H5T__alloc())) + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed"); + dt->shared->state = H5T_STATE_IMMUTABLE; + dt->shared->type = H5T_FLOAT; + dt->shared->size = 8; + dt->shared->u.atomic.order = H5T_ORDER_LE; + dt->shared->u.atomic.offset = 0; + dt->shared->u.atomic.prec = 64; + dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; + dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; +dt->shared->u.atomic.u.f.sign = 63; +dt->shared->u.atomic.u.f.epos = 52; +dt->shared->u.atomic.u.f.esize = 11; +dt->shared->u.atomic.u.f.ebias = 0x000003ff; +dt->shared->u.atomic.u.f.mpos = 0; +dt->shared->u.atomic.u.f.msize = 52; +dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; +dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; + if((H5T_NATIVE_DOUBLE_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype"); + H5T_NATIVE_DOUBLE_ALIGN_g = 8; + + /* + * 7 6 5 4 + * SEEEEEEE EEEEMMMM MMMMMMMM MMMMMMMM + * 3 2 1 0 + * MMMMMMMM MMMMMMMM MMMMMMMM MMMMMMMM + * Implicit bit? yes + */ + if(NULL == (dt = H5T__alloc())) + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, "datatype allocation failed"); + dt->shared->state = H5T_STATE_IMMUTABLE; + dt->shared->type = H5T_FLOAT; + dt->shared->size = 8; + dt->shared->u.atomic.order = H5T_ORDER_LE; + dt->shared->u.atomic.offset = 0; + dt->shared->u.atomic.prec = 64; + dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO; + dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO; +dt->shared->u.atomic.u.f.sign = 63; +dt->shared->u.atomic.u.f.epos = 52; +dt->shared->u.atomic.u.f.esize = 11; +dt->shared->u.atomic.u.f.ebias = 0x000003ff; +dt->shared->u.atomic.u.f.mpos = 0; +dt->shared->u.atomic.u.f.msize = 52; +dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; +dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; + if((H5T_NATIVE_LDOUBLE_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register ID for built-in datatype"); + H5T_NATIVE_LDOUBLE_ALIGN_g = 8; + + /* Set the native order for this machine */ + H5T_native_order_g = H5T_ORDER_LE; + +done: + if(ret_value < 0) { + if(dt != NULL) { + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); + dt = H5FL_FREE(H5T_t, dt); + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5T__init_native() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tnative.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tnative.c index 92276a5360..76ef403888 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tnative.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tnative.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -63,9 +62,6 @@ static herr_t H5T__cmp_offset(size_t *comp_size, size_t *offset, size_t elem_siz * * Failure: negative * - * Programmer: Raymond Lu - * Oct 3, 2002 - * *------------------------------------------------------------------------- */ hid_t @@ -81,23 +77,23 @@ H5Tget_native_type(hid_t type_id, H5T_direction_t direction) /* Check arguments */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a data type"); if (direction != H5T_DIR_DEFAULT && direction != H5T_DIR_ASCEND && direction != H5T_DIR_DESCEND) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not valid direction value") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not valid direction value"); /* Get the native type */ if (NULL == (new_dt = H5T__get_native_type(dt, direction, NULL, NULL, &comp_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "cannot retrieve native type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "cannot retrieve native type"); /* Get an ID for the new type */ if ((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register data type"); done: /* Error cleanup */ if (ret_value < 0) if (new_dt && H5T_close_real(new_dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype"); FUNC_LEAVE_API(ret_value) } /* end H5Tget_native_type() */ @@ -111,9 +107,6 @@ H5Tget_native_type(hid_t type_id, H5T_direction_t direction) * * Failure: negative * - * Programmer: Raymond Lu - * Oct 3, 2002 - * *------------------------------------------------------------------------- */ static H5T_t * @@ -142,75 +135,75 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali FUNC_ENTER_PACKAGE - HDassert(dtype); + assert(dtype); if (H5T_NO_CLASS == (h5_class = H5T_get_class(dtype, FALSE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid class") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid class"); if (0 == (size = H5T_get_size(dtype))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid size") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid size"); switch (h5_class) { case H5T_INTEGER: { H5T_sign_t sign; /* Signedness of integer type */ if (H5T_SGN_ERROR == (sign = H5T_get_sign(dtype))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid signess") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a valid signess"); prec = dtype->shared->u.atomic.prec; if (NULL == (ret_value = H5T__get_native_integer(prec, sign, direction, struct_align, offset, comp_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve integer type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve integer type"); } /* end case */ break; case H5T_FLOAT: if (NULL == (ret_value = H5T__get_native_float(size, direction, struct_align, offset, comp_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); break; case H5T_STRING: if (NULL == (ret_value = H5T_copy(dtype, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); if (H5T_IS_VL_STRING(dtype->shared)) { /* Update size, offset and compound alignment for parent. */ if (H5T__cmp_offset(comp_size, offset, sizeof(char *), (size_t)1, H5T_POINTER_ALIGN_g, struct_align) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); } /* end if */ else { /* Update size, offset and compound alignment for parent. */ if (H5T__cmp_offset(comp_size, offset, sizeof(char), size, H5T_NATIVE_SCHAR_ALIGN_g, struct_align) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); } /* end else */ break; /* The time type will be supported in the future. Simply return "not supported" * message for now.*/ case H5T_TIME: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "time type is not supported yet") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "time type is not supported yet"); case H5T_BITFIELD: { prec = dtype->shared->u.atomic.prec; if (NULL == (ret_value = H5T__get_native_bitfield(prec, direction, struct_align, offset, comp_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve integer for bitfield type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve integer for bitfield type"); } /* end case */ break; case H5T_OPAQUE: if (NULL == (ret_value = H5T_copy(dtype, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); /* Update size, offset and compound alignment for parent. */ if (H5T__cmp_offset(comp_size, offset, sizeof(char), size, H5T_NATIVE_SCHAR_ALIGN_g, struct_align) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); break; case H5T_REFERENCE: { @@ -219,11 +212,11 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali size_t ref_size; if (NULL == (ret_value = H5T_copy(dtype, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy reference type"); /* Decide if the data type is object reference. */ if (NULL == (dt = (H5T_t *)H5I_object(H5T_STD_REF_OBJ_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); /* Update size, offset and compound alignment for parent. */ if (0 == H5T_cmp(ret_value, dt, FALSE)) { @@ -233,7 +226,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali else { /* Decide if the data type is dataset region reference. */ if (NULL == (dt = (H5T_t *)H5I_object(H5T_STD_REF_DSETREG_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); if (0 == H5T_cmp(ret_value, dt, FALSE)) { align = H5T_HDSETREGREF_ALIGN_g; @@ -247,7 +240,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali } /* end else */ if (H5T__cmp_offset(comp_size, offset, ref_size, (size_t)1, align, struct_align) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); } /* end case */ break; @@ -257,31 +250,31 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali 0; /* The max alignment among compound members. This'll be the compound alignment */ if ((snmemb = H5T_get_nmembers(dtype)) <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "compound data type doesn't have any member") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "compound data type doesn't have any member"); H5_CHECKED_ASSIGN(nmemb, unsigned, snmemb, int); if (NULL == (memb_list = (H5T_t **)H5MM_calloc(nmemb * sizeof(H5T_t *)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); if (NULL == (memb_offset = (size_t *)H5MM_calloc(nmemb * sizeof(size_t)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); if (NULL == (comp_mname = (char **)H5MM_calloc(nmemb * sizeof(char *)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); /* Construct child compound type and retrieve a list of their IDs, offsets, total size, and * alignment for compound type. */ for (u = 0; u < nmemb; u++) { if (NULL == (memb_type = H5T_get_member_type(dtype, u))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed"); if (NULL == (comp_mname[u] = H5T__get_member_name(dtype, u))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member type retrieval failed"); if (NULL == (memb_list[u] = H5T__get_native_type(memb_type, direction, &children_st_align, &(memb_offset[u]), &children_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member identifier retrieval failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "member identifier retrieval failed"); if (H5T_close_real(memb_type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); } /* end for */ /* The alignment for whole compound type */ @@ -290,12 +283,12 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali /* Construct new compound type based on native type */ if (NULL == (new_type = H5T__create(H5T_COMPOUND, children_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot create a compound type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot create a compound type"); /* Insert members for the new compound type */ for (u = 0; u < nmemb; u++) if (H5T__insert(new_type, comp_mname[u], memb_offset[u], memb_list[u]) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member to compound datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member to compound datatype"); /* Update size, offset and compound alignment for parent in the case of * nested compound type. The alignment for a compound type as one field in @@ -317,12 +310,12 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali */ if (H5T__cmp_offset(comp_size, offset, children_size, (size_t)1, children_st_align, struct_align) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); /* Close member data type */ for (u = 0; u < nmemb; u++) { if (H5T_close_real(memb_list[u]) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); /* Free member names in list */ comp_mname[u] = (char *)H5MM_xfree(comp_mname[u]); @@ -346,48 +339,48 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali /* Retrieve base type for enumerated type */ if (NULL == (super_type = H5T_get_super(dtype))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get base type for enumerate type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get base type for enumerate type"); if (NULL == (nat_super_type = H5T__get_native_type(super_type, direction, struct_align, offset, comp_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "base native type retrieval failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "base native type retrieval failed"); if ((super_type_id = H5I_register(H5I_DATATYPE, super_type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype"); if ((nat_super_type_id = H5I_register(H5I_DATATYPE, nat_super_type, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype"); /* Allocate room for the enum values */ if (NULL == (tmp_memb_value = H5MM_calloc(H5T_get_size(super_type)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); if (NULL == (memb_value = H5MM_calloc(H5T_get_size(nat_super_type)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); /* Construct new enum type based on native type */ if (NULL == (new_type = H5T__enum_create(nat_super_type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create enum type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create enum type"); /* Find the conversion function */ if (NULL == (tpath = H5T_path_find(super_type, nat_super_type))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, - "unable to convert between src and dst data types") + "unable to convert between src and dst data types"); /* Retrieve member info and insert members into new enum type */ if ((snmemb = H5T_get_nmembers(dtype)) <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "enumerate data type doesn't have any member") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "enumerate data type doesn't have any member"); H5_CHECKED_ASSIGN(nmemb, unsigned, snmemb, int); for (u = 0; u < nmemb; u++) { if (NULL == (memb_name = H5T__get_member_name(dtype, u))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name"); if (H5T__get_member_value(dtype, u, tmp_memb_value) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value"); H5MM_memcpy(memb_value, tmp_memb_value, H5T_get_size(super_type)); if (H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value"); if (H5T__enum_insert(new_type, memb_name, memb_value) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot insert member"); memb_name = (char *)H5MM_xfree(memb_name); } memb_value = H5MM_xfree(memb_value); @@ -395,10 +388,10 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali /* Close base type */ if (H5I_dec_app_ref(nat_super_type_id) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); /* Close super type */ if (H5I_dec_app_ref(super_type_id) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); ret_value = new_type; } /* end case */ @@ -414,37 +407,37 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali /* Retrieve dimension information for array data type */ if ((sarray_rank = H5T__get_array_ndims(dtype)) <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension rank") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension rank"); H5_CHECKED_ASSIGN(array_rank, unsigned, sarray_rank, int); if (NULL == (dims = (hsize_t *)H5MM_malloc(array_rank * sizeof(hsize_t)))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory"); if (H5T__get_array_dims(dtype, dims) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension size") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get dimension size"); /* Retrieve base type for array type */ if (NULL == (super_type = H5T_get_super(dtype))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for array type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for array type"); if (NULL == (nat_super_type = H5T__get_native_type(super_type, direction, &super_align, &super_offset, &super_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed"); /* Close super type */ if (H5T_close_real(super_type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype") + HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype"); /* Create a new array type based on native type */ if (NULL == (new_type = H5T__array_create(nat_super_type, array_rank, dims))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create array type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create array type"); /* Close base type */ if (H5T_close_real(nat_super_type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype") + HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype"); for (u = 0; u < array_rank; u++) nelems *= dims[u]; H5_CHECK_OVERFLOW(nelems, hsize_t, size_t); if (H5T__cmp_offset(comp_size, offset, super_size, (size_t)nelems, super_align, struct_align) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); dims = (hsize_t *)H5MM_xfree(dims); @@ -459,31 +452,31 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali /* Retrieve base type for array type */ if (NULL == (super_type = H5T_get_super(dtype))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for VL type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to get parent type for VL type"); /* Don't need alignment, offset information if this VL isn't a field of compound type. If it * is, go to a few steps below to compute the information directly. */ if (NULL == (nat_super_type = H5T__get_native_type(super_type, direction, NULL, NULL, &super_size))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "parent native type retrieval failed"); /* Close super type */ if (H5T_close_real(super_type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype") + HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype"); /* Create a new array type based on native type */ if (NULL == (new_type = H5T__vlen_create(nat_super_type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create VL type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create VL type"); /* Close base type */ if (H5T_close_real(nat_super_type) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype") + HGOTO_ERROR(H5E_ARGS, H5E_CLOSEERROR, NULL, "cannot close datatype"); /* Update size, offset and compound alignment for parent compound type directly. */ vl_align = H5T_HVL_ALIGN_g; vl_size = sizeof(hvl_t); if (H5T__cmp_offset(comp_size, offset, vl_size, (size_t)1, vl_align, struct_align) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); ret_value = new_type; } /* end case */ @@ -492,7 +485,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali case H5T_NO_CLASS: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "data type doesn't match any native type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "data type doesn't match any native type"); } /* end switch */ done: @@ -500,13 +493,13 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali if (NULL == ret_value) { if (new_type) if (H5T_close_real(new_type) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, NULL, "unable to release datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, NULL, "unable to release datatype"); /* Free lists for members */ if (memb_list) { for (u = 0; u < nmemb; u++) if (memb_list[u] && H5T_close_real(memb_list[u]) < 0) - HDONE_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype") + HDONE_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype"); memb_list = (H5T_t **)H5MM_xfree(memb_list); } /* end if */ @@ -543,9 +536,6 @@ H5_GCC_DIAG_OFF("duplicated-branches") * * Failure: negative * - * Programmer: Raymond Lu - * Oct 3, 2002 - * *------------------------------------------------------------------------- */ static H5T_t * @@ -665,20 +655,20 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, case H5T_NATIVE_INT_MATCH_UNKNOWN: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "Unknown native integer match") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "Unknown native integer match"); } /* end switch */ /* Create new native type */ - HDassert(tid >= 0); + assert(tid >= 0); if (NULL == (dt = (H5T_t *)H5I_object(tid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); if (NULL == (ret_value = H5T_copy(dt, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy type"); /* compute size and offset of compound type member. */ if (H5T__cmp_offset(comp_size, offset, native_size, (size_t)1, align, struct_align) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -702,9 +692,6 @@ H5_GCC_DIAG_OFF("duplicated-branches") * * Failure: negative * - * Programmer: Raymond Lu - * Oct 3, 2002 - * *------------------------------------------------------------------------- */ static H5T_t * @@ -725,7 +712,7 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali FUNC_ENTER_PACKAGE - HDassert(size > 0); + assert(size > 0); if (direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { if (size <= sizeof(float)) { @@ -779,19 +766,19 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali case H5T_NATIVE_FLOAT_MATCH_UNKNOWN: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "Unknown native floating-point match") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "Unknown native floating-point match"); } /* end switch */ /* Create new native type */ - HDassert(tid >= 0); + assert(tid >= 0); if (NULL == (dt = (H5T_t *)H5I_object(tid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); if ((ret_value = H5T_copy(dt, H5T_COPY_TRANSIENT)) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot retrieve float type"); /* compute offset of compound type member. */ if (H5T__cmp_offset(comp_size, offset, native_size, (size_t)1, align, struct_align) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -816,9 +803,6 @@ H5_GCC_DIAG_OFF("duplicated-branches") * * Failure: negative * - * Programmer: Raymond Lu - * 1 December 2009 - * *------------------------------------------------------------------------- */ static H5T_t * @@ -884,16 +868,16 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, size_t *struct_ } /* Create new native type */ - HDassert(tid >= 0); + assert(tid >= 0); if (NULL == (dt = (H5T_t *)H5I_object(tid))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); if ((ret_value = H5T_copy(dt, H5T_COPY_TRANSIENT)) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot copy type"); /* compute size and offset of compound type member. */ if (H5T__cmp_offset(comp_size, offset, native_size, (size_t)1, align, struct_align) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot compute compound offset"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -911,9 +895,6 @@ H5_GCC_DIAG_ON("duplicated-branches") * * Failure: Negative value. * - * Programmer: Raymond Lu - * December 10, 2002 - * *------------------------------------------------------------------------- */ static herr_t diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Toffset.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Toffset.c index 60b475978e..278e32bf35 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Toffset.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Toffset.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -50,9 +49,6 @@ static herr_t H5T__set_offset(const H5T_t *dt, size_t offset); * Return: Success: The offset (non-negative) * Failure: Negative * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ int @@ -66,11 +62,11 @@ H5Tget_offset(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); /* Get offset */ if ((ret_value = H5T_get_offset(dt)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't get offset for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't get offset for specified datatype"); done: FUNC_LEAVE_API(ret_value) @@ -100,9 +96,6 @@ H5Tget_offset(hid_t type_id) * Return: Success: The offset (non-negative) * Failure: Negative * - * Programmer: Quincey Koziol - * Wednesday, October 17, 2007 - * *------------------------------------------------------------------------- */ int @@ -116,7 +109,7 @@ H5T_get_offset(const H5T_t *dt) while (dt->shared->parent) dt = dt->shared->parent; if (!H5T_IS_ATOMIC(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type"); /* Offset */ ret_value = (int)dt->shared->u.atomic.offset; @@ -155,9 +148,6 @@ H5T_get_offset(const H5T_t *dt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -171,20 +161,20 @@ H5Tset_offset(hid_t type_id, size_t offset) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only"); if (H5T_STRING == dt->shared->type && offset != 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset must be zero for this type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "offset must be zero for this type"); if (H5T_ENUM == dt->shared->type && dt->shared->u.enumer.nmembs > 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); if (H5T_COMPOUND == dt->shared->type || H5T_REFERENCE == dt->shared->type || H5T_OPAQUE == dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for this datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for this datatype"); /* Do the real work */ if (H5T__set_offset(dt, offset) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset"); done: FUNC_LEAVE_API(ret_value) @@ -220,9 +210,6 @@ H5Tset_offset(hid_t type_id, size_t offset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -233,16 +220,16 @@ H5T__set_offset(const H5T_t *dt, size_t offset) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dt); - HDassert(H5T_STRING != dt->shared->type || 0 == offset); - HDassert(H5T_REFERENCE != dt->shared->type); - HDassert(H5T_OPAQUE != dt->shared->type); - HDassert(H5T_COMPOUND != dt->shared->type); - HDassert(!(H5T_ENUM == dt->shared->type && 0 == dt->shared->u.enumer.nmembs)); + assert(dt); + assert(H5T_STRING != dt->shared->type || 0 == offset); + assert(H5T_REFERENCE != dt->shared->type); + assert(H5T_OPAQUE != dt->shared->type); + assert(H5T_COMPOUND != dt->shared->type); + assert(!(H5T_ENUM == dt->shared->type && 0 == dt->shared->u.enumer.nmembs)); if (dt->shared->parent) { if (H5T__set_offset(dt->shared->parent, offset) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset for base type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to set offset for base type"); /* Adjust size of datatype appropriately */ if (dt->shared->type == H5T_ARRAY) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Toh.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Toh.c index f71397e27f..9269aa78d7 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Toh.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Toh.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -82,9 +81,6 @@ const H5O_obj_class_t H5O_OBJ_DATATYPE[1] = {{ * Failure: FAIL if the existence of certain messages * cannot be determined. * - * Programmer: Robb Matzke - * Monday, November 2, 1998 - * *------------------------------------------------------------------------- */ static htri_t @@ -94,10 +90,10 @@ H5O__dtype_isa(const H5O_t *oh) FUNC_ENTER_PACKAGE - HDassert(oh); + assert(oh); if ((ret_value = H5O_msg_exists_oh(oh, H5O_DTYPE_ID)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to read object header") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to read object header"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -111,9 +107,6 @@ H5O__dtype_isa(const H5O_t *oh) * Return: Success: Open object identifier * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static void * @@ -124,20 +117,20 @@ H5O__dtype_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) FUNC_ENTER_PACKAGE - HDassert(obj_loc); + assert(obj_loc); *opened_type = H5I_DATATYPE; /* Open the datatype */ if (NULL == (type = H5T_open(obj_loc))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open datatype"); ret_value = (void *)type; done: if (NULL == ret_value) if (type && H5T_close(type) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, NULL, "unable to release datatype") + HDONE_ERROR(H5E_DATATYPE, H5E_CLOSEERROR, NULL, "unable to release datatype"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dtype_open() */ @@ -150,9 +143,6 @@ H5O__dtype_open(const H5G_loc_t *obj_loc, H5I_type_t *opened_type) * Return: Success: Pointer to the named datatype data structure * Failure: NULL * - * Programmer: Quincey Koziol - * Wednesday, April 11, 2007 - * *------------------------------------------------------------------------- */ static void * @@ -164,19 +154,19 @@ H5O__dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(f); - HDassert(crt_info); - HDassert(obj_loc); + assert(f); + assert(crt_info); + assert(obj_loc); /* Commit the type to the file */ if (H5T__commit(f, crt_info->dt, crt_info->tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype"); /* Set up the new named datatype's location */ if (NULL == (obj_loc->oloc = H5T_oloc(crt_info->dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get object location of named datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get object location of named datatype"); if (NULL == (obj_loc->path = H5T_nameof(crt_info->dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get path of named datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "unable to get path of named datatype"); /* Set the return value */ ret_value = crt_info->dt; @@ -193,9 +183,6 @@ H5O__dtype_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc) * Return: Success: Pointer to object header location * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, November 6, 2006 - * *------------------------------------------------------------------------- */ static H5O_loc_t * @@ -209,14 +196,14 @@ H5O__dtype_get_oloc(hid_t obj_id) /* Get the datatype */ if (NULL == (dt = (H5T_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID") + HGOTO_ERROR(H5E_OHDR, H5E_BADID, NULL, "couldn't get object from ID"); /* If this is a named datatype, get the VOL driver pointer to the datatype */ type = (H5T_t *)H5T_get_actual_type(dt); /* Get the datatype's object header location */ if (NULL == (ret_value = H5T_oloc(type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to get object location from object"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Topaque.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Topaque.c index 15753fe6cd..808eb8c4fd 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Topaque.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Topaque.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -31,9 +30,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Thursday, May 20, 1999 - * *------------------------------------------------------------------------- */ herr_t @@ -47,17 +43,17 @@ H5Tset_tag(hid_t type_id, const char *tag) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_OPAQUE != dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an opaque data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an opaque data type"); if (!tag) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no tag") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no tag"); if (HDstrlen(tag) >= H5T_OPAQUE_TAG_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tag too long") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "tag too long"); /* Commit */ H5MM_xfree(dt->shared->u.opaque.tag); @@ -75,9 +71,6 @@ H5Tset_tag(hid_t type_id, const char *tag) * Return: A pointer to an allocated string. The caller should free * the string. NULL is returned for errors. * - * Programmer: Robb Matzke - * Thursday, May 20, 1999 - * *------------------------------------------------------------------------- */ char * @@ -91,15 +84,15 @@ H5Tget_tag(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (H5T_OPAQUE != dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "operation not defined for data type class") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "operation not defined for data type class"); /* result */ if (NULL == (ret_value = H5MM_strdup(dt->shared->u.opaque.tag))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Torder.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Torder.c index e3abd23b0c..ccdf4bfc10 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Torder.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Torder.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -73,9 +72,6 @@ static herr_t H5T__set_order(H5T_t *dtype, H5T_order_t order); * returns H5T_ORDER_MIXED. * Failure: H5T_ORDER_ERROR (Negative) * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ H5T_order_t @@ -89,11 +85,11 @@ H5Tget_order(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype"); /* Get order */ if (H5T_ORDER_ERROR == (ret_value = H5T_get_order(dt))) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "can't get order for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "can't get order for specified datatype"); done: FUNC_LEAVE_API(ret_value) @@ -107,9 +103,6 @@ H5Tget_order(hid_t type_id) * Return: Success: A byte order constant * Failure: H5T_ORDER_ERROR (Negative) * - * Programmer: Quincey Koziol - * Wednesday, October 17, 2007 - * *------------------------------------------------------------------------- */ H5T_order_t @@ -136,14 +129,14 @@ H5T_get_order(const H5T_t *dtype) /* Retrieve the number of members */ if ((nmemb = H5T_get_nmembers(dtype)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_ORDER_ERROR, - "can't get number of members from compound data type") + "can't get number of members from compound data type"); /* Get order for each compound member type. */ for (i = 0; i < nmemb; i++) { /* Get order for member */ if ((memb_order = H5T_get_order(dtype->shared->u.compnd.memb[i].type)) == H5T_ORDER_ERROR) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5T_ORDER_ERROR, - "can't get order for compound member") + "can't get order for compound member"); /* Ignore the H5T_ORDER_NONE, write down the first non H5T_ORDER_NONE order. */ if (memb_order != H5T_ORDER_NONE && ret_value == H5T_ORDER_NONE) @@ -179,9 +172,6 @@ H5T_get_order(const H5T_t *dtype) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -195,17 +185,17 @@ H5Tset_order(hid_t type_id, H5T_order_t order) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a datatype"); if (order < H5T_ORDER_LE || order > H5T_ORDER_NONE || order == H5T_ORDER_MIXED) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order"); if (NULL != dt->vol_obj) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype is read-only"); /* Call internal routine to set the order */ if (H5T__set_order(dt, order) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "can't set order"); done: FUNC_LEAVE_API(ret_value) @@ -218,9 +208,6 @@ H5Tset_order(hid_t type_id, H5T_order_t order) * * Return: Non-negative on success/Negative on failure * - * Programmer: Raymond Lu - * 13 August 2010 - * *------------------------------------------------------------------------- */ static herr_t @@ -231,7 +218,7 @@ H5T__set_order(H5T_t *dtype, H5T_order_t order) FUNC_ENTER_PACKAGE if (H5T_ENUM == dtype->shared->type && dtype->shared->u.enumer.nmembs > 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after enum members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after enum members are defined"); /* For derived data type, defer to parent */ while (dtype->shared->parent) @@ -240,7 +227,7 @@ H5T__set_order(H5T_t *dtype, H5T_order_t order) /* Check for setting order on inappropriate datatype */ if (order == H5T_ORDER_NONE && !(H5T_REFERENCE == dtype->shared->type || H5T_OPAQUE == dtype->shared->type || H5T_IS_FIXED_STRING(dtype->shared))) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order for type") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADVALUE, FAIL, "illegal byte order for type"); /* For atomic data type */ if (H5T_IS_ATOMIC(dtype->shared)) @@ -254,16 +241,16 @@ H5T__set_order(H5T_t *dtype, H5T_order_t order) /* Retrieve the number of fields in the compound datatype */ if ((nmemb = H5T_get_nmembers(dtype)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, - "can't get number of members from compound data type") + "can't get number of members from compound data type"); /* Check for uninitialized compound datatype */ if (nmemb == 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNINITIALIZED, FAIL, "no member is in the compound data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNINITIALIZED, FAIL, "no member is in the compound data type"); /* Loop through all fields of compound type, setting the order */ for (i = 0; i < nmemb; i++) if (H5T__set_order(dtype->shared->u.compnd.memb[i].type, order) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set order for compound member") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set order for compound member"); } /* end if */ } /* end else */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tpad.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tpad.c index db1a2cb9a2..6487138bd0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tpad.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tpad.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -32,9 +31,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 9, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -48,11 +44,11 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out*/, H5T_pad_t *msb /*out*/) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_ATOMIC(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type"); /* Get values */ if (lsb) @@ -71,9 +67,6 @@ H5Tget_pad(hid_t type_id, H5T_pad_t *lsb /*out*/, H5T_pad_t *msb /*out*/) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 9, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -87,17 +80,17 @@ H5Tset_pad(hid_t type_id, H5T_pad_t lsb, H5T_pad_t msb) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only"); if (lsb < H5T_PAD_ZERO || lsb >= H5T_NPAD || msb < H5T_PAD_ZERO || msb >= H5T_NPAD) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pad type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pad type"); if (H5T_ENUM == dt->shared->type && dt->shared->u.enumer.nmembs > 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); while (dt->shared->parent) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_ATOMIC(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified data type"); /* Commit */ dt->shared->u.atomic.lsb_pad = lsb; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tprecis.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tprecis.c index f6748aba63..4feca69116 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tprecis.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tprecis.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -39,9 +38,6 @@ static herr_t H5T__set_precision(const H5T_t *dt, size_t prec); * Failure: 0 (all atomic types have at least one * significant bit) * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ size_t @@ -55,11 +51,11 @@ H5Tget_precision(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype"); /* Get precision */ if ((ret_value = H5T_get_precision(dt)) == 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, 0, "can't get precision for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, 0, "can't get precision for specified datatype"); done: FUNC_LEAVE_API(ret_value) @@ -77,9 +73,6 @@ H5Tget_precision(hid_t type_id) * Failure: 0 (all atomic types have at least one * significant bit) * - * Programmer: Quincey Koziol - * Wednesday, October 17, 2007 - * *------------------------------------------------------------------------- */ size_t @@ -93,7 +86,7 @@ H5T_get_precision(const H5T_t *dt) while (dt->shared->parent) dt = dt->shared->parent; if (!H5T_IS_ATOMIC(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, 0, "operation not defined for specified datatype"); /* Precision */ ret_value = dt->shared->u.atomic.prec; @@ -122,9 +115,6 @@ H5T_get_precision(const H5T_t *dt) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -138,23 +128,23 @@ H5Tset_precision(hid_t type_id, size_t prec) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is read-only"); if (NULL != dt->vol_obj) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is committed") + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is committed"); if (prec == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "precision must be positive"); if (H5T_ENUM == dt->shared->type && dt->shared->u.enumer.nmembs > 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after members are defined") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "operation not allowed after members are defined"); if (H5T_STRING == dt->shared->type) - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "precision for this type is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "precision for this type is read-only"); if (H5T_COMPOUND == dt->shared->type || H5T_OPAQUE == dt->shared->type) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for specified datatype"); /* Do the work */ if (H5T__set_precision(dt, prec) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision"); done: FUNC_LEAVE_API(ret_value) @@ -180,9 +170,6 @@ H5Tset_precision(hid_t type_id, size_t prec) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Wednesday, January 7, 1998 - * *------------------------------------------------------------------------- */ static herr_t @@ -194,16 +181,16 @@ H5T__set_precision(const H5T_t *dt, size_t prec) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(dt); - HDassert(prec > 0); - HDassert(H5T_OPAQUE != dt->shared->type); - HDassert(H5T_COMPOUND != dt->shared->type); - HDassert(H5T_STRING != dt->shared->type); - HDassert(!(H5T_ENUM == dt->shared->type && 0 == dt->shared->u.enumer.nmembs)); + assert(dt); + assert(prec > 0); + assert(H5T_OPAQUE != dt->shared->type); + assert(H5T_COMPOUND != dt->shared->type); + assert(H5T_STRING != dt->shared->type); + assert(!(H5T_ENUM == dt->shared->type && 0 == dt->shared->u.enumer.nmembs)); if (dt->shared->parent) { if (H5T__set_precision(dt->shared->parent, prec) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision for base type") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set precision for base type"); /* Adjust size of datatype appropriately */ if (dt->shared->type == H5T_ARRAY) @@ -241,7 +228,7 @@ H5T__set_precision(const H5T_t *dt, size_t prec) dt->shared->u.atomic.u.f.epos + dt->shared->u.atomic.u.f.esize > prec + offset || dt->shared->u.atomic.u.f.mpos + dt->shared->u.atomic.u.f.msize > prec + offset) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "adjust sign, mantissa, and exponent fields first") + "adjust sign, mantissa, and exponent fields first"); break; case H5T_NO_CLASS: @@ -254,7 +241,7 @@ H5T__set_precision(const H5T_t *dt, size_t prec) case H5T_ARRAY: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class"); } /* end switch */ /* Commit */ @@ -263,7 +250,7 @@ H5T__set_precision(const H5T_t *dt, size_t prec) dt->shared->u.atomic.prec = prec; } /* end if */ else - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for specified datatype"); } /* end else */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tref.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tref.c index f914b8d75f..ddc73ac5d3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tref.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tref.c @@ -19,13 +19,14 @@ #define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5R_FRIEND /*suppress error about including H5Rpkg */ -#include "H5private.h" /* Generic Functions */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Iprivate.h" /* IDs */ -#include "H5Fpkg.h" /* File */ -#include "H5Rpkg.h" /* References */ -#include "H5Tpkg.h" /* Datatypes */ +#include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Fpkg.h" /* File */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Rpkg.h" /* References */ +#include "H5Tpkg.h" /* Datatypes */ #include "H5VLnative_private.h" /* Native VOL connector */ @@ -45,10 +46,10 @@ #ifdef H5T_REF_DEBUG #define H5T_REF_LOG_DEBUG(...) \ do { \ - HDfprintf(stdout, " # %s(): ", __func__); \ - HDfprintf(stdout, __VA_ARGS__); \ - HDfprintf(stdout, "\n"); \ - HDfflush(stdout); \ + fprintf(stdout, " # %s(): ", __func__); \ + fprintf(stdout, __VA_ARGS__); \ + fprintf(stdout, "\n"); \ + fflush(stdout); \ } while (0) #else #define H5T_REF_LOG_DEBUG(...) \ @@ -163,13 +164,13 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) FUNC_ENTER_PACKAGE H5T_REF_LOG_DEBUG("loc=%d", (int)loc); - HDassert(dt); + assert(dt); /* f is NULL when loc == H5T_LOC_MEMORY */ - HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); + assert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); /* Only change the location if it's different */ if (loc == dt->shared->u.atomic.u.r.loc && file == dt->shared->u.atomic.u.r.file) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); switch (loc) { case H5T_LOC_MEMORY: /* Memory based reference datatype */ @@ -183,7 +184,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Release owned file */ if (dt->shared->owned_vol_obj) { if (H5VL_free_object(dt->shared->owned_vol_obj) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object"); dt->shared->owned_vol_obj = NULL; } /* end if */ @@ -215,11 +216,11 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) dt->shared->u.atomic.u.r.cls = NULL; } /* end else-if */ else - HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid location") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "invalid location"); break; case H5T_LOC_DISK: /* Disk based reference datatype */ - HDassert(file); + assert(file); /* Mark this type as being stored on disk */ dt->shared->u.atomic.u.r.loc = H5T_LOC_DISK; @@ -229,7 +230,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* dt now owns a reference to file */ if (H5T_own_vol_obj(dt, file) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object"); if (dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) { H5F_t *f; @@ -241,16 +242,16 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Check if using native VOL connector */ if (H5VL_object_is_native(file, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, - "can't query if file uses native VOL connector") + "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Retrieve file from VOL object */ if (NULL == (f = (H5F_t *)H5VL_object_data(file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object"); /* Size on disk, memory size is different */ dt->shared->size = H5T_REF_OBJ_DISK_SIZE(f); @@ -269,16 +270,16 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Check if using native VOL connector */ if (H5VL_object_is_native(file, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, - "can't query if file uses native VOL connector") + "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Retrieve file from VOL object */ if (NULL == (f = (H5F_t *)H5VL_object_data(file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object"); /* Size on disk, memory size is different */ dt->shared->size = H5T_REF_DSETREG_DISK_SIZE(f); @@ -299,14 +300,14 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Get container info */ if (H5VL_file_get(file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info"); /* Retrieve min encode size (when references have no vlen part) */ - HDmemset(&fixed_ref, 0, sizeof(fixed_ref)); + memset(&fixed_ref, 0, sizeof(fixed_ref)); fixed_ref.type = (int8_t)H5R_OBJECT2; fixed_ref.token_size = (uint8_t)cont_info.token_size; if (H5R__encode(NULL, &fixed_ref, NULL, &ref_encode_size, 0) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't get encode size") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't get encode size"); /* Size on disk, memory size is different */ dt->shared->size = @@ -337,7 +338,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) case H5T_LOC_MAXLOC: /* MAXLOC is invalid */ default: - HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid reference datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid reference datatype location"); } /* end switch */ /* Indicate that the location changed */ @@ -366,10 +367,10 @@ H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file, const void *sr H5T_REF_LOG_DEBUG(""); /* Check parameters */ - HDassert(src_buf); - HDassert(isnull); + assert(src_buf); + assert(isnull); - *isnull = (0 == HDmemcmp(src_buf, zeros, H5T_REF_MEM_SIZE)) ? TRUE : FALSE; + *isnull = (0 == memcmp(src_buf, zeros, H5T_REF_MEM_SIZE)) ? TRUE : FALSE; FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_mem_isnull() */ @@ -391,7 +392,7 @@ H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, H5_A FUNC_ENTER_PACKAGE_NOERR H5T_REF_LOG_DEBUG(""); - HDmemset(dst_buf, 0, H5T_REF_MEM_SIZE); + memset(dst_buf, 0, H5T_REF_MEM_SIZE); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_mem_setnull() */ @@ -420,19 +421,19 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf H5T_REF_LOG_DEBUG(""); /* Sanity check */ - HDassert(src_buf); - HDassert(src_size == H5T_REF_MEM_SIZE); + assert(src_buf); + assert(src_size == H5T_REF_MEM_SIZE); if (NULL != dst_file) { hbool_t files_equal = TRUE; /* Whether src & dst references are in same file */ /* Retrieve VOL object */ if (NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier"); /* Set external flag if referenced file is not destination file */ if (H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal"); flags |= !files_equal ? H5R_IS_EXTERNAL : 0; } @@ -450,14 +451,14 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf /* Check if using native VOL connector */ if (H5VL_object_is_native(dst_file, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector"); /* Set the file's libver bounds if using the native VOL connector */ if (is_native) { H5F_t *dst_f; /* Native file struct */ if (NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object"); H5CX_set_libver_bounds(dst_f); } /* end if */ else @@ -473,13 +474,13 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf /* Get file name */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name"); /* Check if we need to allocate a buffer for the file name */ if (file_name_len >= sizeof(file_name_buf_static)) { /* Allocate file name buffer */ if (NULL == (file_name_buf_dyn = H5MM_malloc(file_name_len + 1))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, 0, "can't allocate space for file name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, 0, "can't allocate space for file name"); /* Update VOL callback arguments */ vol_cb_args.args.get_name.buf_size = file_name_len + 1; @@ -487,7 +488,7 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf /* Get file name again */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name"); file_name = file_name_buf_dyn; } /* end if */ @@ -496,7 +497,7 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf /* Determine encoding size */ if (H5R__encode(file_name, src_ref, NULL, &ret_value, flags) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, 0, "unable to determine encoding size") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, 0, "unable to determine encoding size"); } /* end if */ else { /* Can do a direct copy and skip blob decoding */ @@ -540,10 +541,10 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s H5T_REF_LOG_DEBUG(""); /* Sanity check */ - HDassert(src_buf); - HDassert(src_size == H5T_REF_MEM_SIZE); - HDassert(dst_buf); - HDassert(dst_size); + assert(src_buf); + assert(src_size == H5T_REF_MEM_SIZE); + assert(dst_buf); + assert(dst_size); /* Memory-to-memory conversion to support vlen conversion */ if (NULL == dst_file) { @@ -553,11 +554,11 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s /* Retrieve VOL object */ if (NULL == (vol_obj = H5VL_vol_object(src_ref->loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier"); /* Set external flag if referenced file is not destination file */ if (H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "can't check if files are equal") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "can't check if files are equal"); flags |= !files_equal ? H5R_IS_EXTERNAL : 0; /* Pass the correct encoding version for the selection depending on the @@ -567,14 +568,14 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s /* Check if using native VOL connector */ if (H5VL_object_is_native(dst_file, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector"); /* Set the file's libver bounds if using the native VOL connector */ if (is_native) { H5F_t *dst_f; if (NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object"); H5CX_set_libver_bounds(dst_f); } /* end if */ else @@ -595,13 +596,13 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s /* Get file name */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name"); /* Check if we need to allocate a buffer for the file name */ if (file_name_len >= sizeof(file_name_buf_static)) { /* Allocate file name buffer */ if (NULL == (file_name_buf_dyn = H5MM_malloc(file_name_len + 1))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, 0, "can't allocate space for file name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, 0, "can't allocate space for file name"); /* Update VOL callback arguments */ vol_cb_args.args.get_name.buf_size = file_name_len + 1; @@ -609,7 +610,7 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s /* Get file name again */ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name"); file_name = file_name_buf_dyn; } /* end if */ @@ -619,7 +620,7 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s /* Encode reference */ if (H5R__encode(file_name, src_ref, (unsigned char *)dst_buf, &dst_size, flags) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot encode reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot encode reference"); done: H5MM_xfree(file_name_buf_dyn); @@ -651,10 +652,10 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size H5T_REF_LOG_DEBUG(""); /* Sanity check */ - HDassert(src_buf); - HDassert(src_size); - HDassert(dst_buf); - HDassert(dst_size == H5T_REF_MEM_SIZE); + assert(src_buf); + assert(src_size); + assert(dst_buf); + assert(dst_size == H5T_REF_MEM_SIZE); HDcompile_assert(sizeof(*dst_ref) == sizeof(tmp_ref)); /* Memory-to-memory conversion to support vlen conversion */ @@ -669,26 +670,26 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size /* Check if using native VOL connector */ if (H5VL_object_is_native(src_file, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Retrieve file from VOL object */ if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object"); /* Make sure reference buffer is correctly initialized */ - HDmemset(&tmp_ref, 0, sizeof(tmp_ref)); + memset(&tmp_ref, 0, sizeof(tmp_ref)); switch (src_type) { case H5R_OBJECT1: { size_t token_size = H5F_SIZEOF_ADDR(src_f); if (H5R__create_object((const H5O_token_t *)src_buf, token_size, &tmp_ref) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference"); } break; case H5R_DATASET_REGION1: { @@ -696,11 +697,11 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size size_t token_size = H5F_SIZEOF_ADDR(src_f); if (H5R__create_region(&src_reg->token, token_size, src_reg->space, &tmp_ref) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create region reference"); /* create_region creates its internal copy of the space */ if (H5S_close(src_reg->space) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "Cannot close dataspace"); } break; case H5R_DATASET_REGION2: @@ -713,34 +714,34 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size case H5R_ATTR: /* Decode reference */ if (H5R__decode((const unsigned char *)src_buf, &src_size, &tmp_ref) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Cannot decode reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Cannot decode reference"); break; case H5R_BADTYPE: case H5R_MAXTYPE: default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + assert("unknown reference type" && 0); + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)"); } /* end switch */ /* If no filename set, this is not an external reference */ if (NULL == H5R_REF_FILENAME(&tmp_ref)) { /* TODO temporary hack to retrieve file object */ if ((file_id = H5F_get_file_id(src_file, H5I_FILE, FALSE)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Attach loc ID to reference and hold reference to it, this is a * user exposed reference so set app_ref to TRUE. */ if (H5R__set_loc_id(&tmp_ref, file_id, TRUE, TRUE) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "unable to attach location id to reference"); } /* end if */ /* Set output info */ - HDmemcpy(dst_ref, &tmp_ref, sizeof(tmp_ref)); + memcpy(dst_ref, &tmp_ref, sizeof(tmp_ref)); done: if ((file_id != H5I_INVALID_HID) && (H5I_dec_ref(file_id) < 0)) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on location id") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "unable to decrement refcount on location id"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__ref_mem_write() */ @@ -772,9 +773,9 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t H5T_REF_LOG_DEBUG(""); /* Check parameters */ - HDassert(src_file); - HDassert(src_buf); - HDassert(isnull); + assert(src_file); + assert(src_buf); + assert(isnull); /* Try to check encoded reference type */ ref_type = (H5R_type_t)*p++; @@ -794,7 +795,7 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t /* Check if blob ID is "nil" */ if (H5VL_blob_specific(src_file, (void *)p, &vol_cb_args) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'"); } done: @@ -822,8 +823,8 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) FUNC_ENTER_PACKAGE H5T_REF_LOG_DEBUG(""); - HDassert(dst_file); - HDassert(dst_buf); + assert(dst_file); + assert(dst_buf); /* TODO Should get rid of bg stuff */ if (p_bg) { @@ -835,11 +836,11 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) /* Remove blob for old data */ if (H5VL_blob_specific(dst_file, (void *)p_bg, &vol_cb_args) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob"); } /* end if */ /* Copy header manually so that it does not get encoded into the blob */ - HDmemset(q, 0, H5R_ENCODE_HEADER_SIZE); + memset(q, 0, H5R_ENCODE_HEADER_SIZE); q += H5R_ENCODE_HEADER_SIZE; /* Set the size */ @@ -850,7 +851,7 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) /* Set blob ID to "nil" */ if (H5VL_blob_specific(dst_file, q, &vol_cb_args) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -877,12 +878,12 @@ H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_bu FUNC_ENTER_PACKAGE H5T_REF_LOG_DEBUG(""); - HDassert(src_buf); + assert(src_buf); /* Set reference type */ ref_type = (H5R_type_t)*p++; if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid reference type"); /* Set flags */ flags = (unsigned)*p++; @@ -926,10 +927,10 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_ FUNC_ENTER_PACKAGE H5T_REF_LOG_DEBUG(""); - HDassert(src_file); - HDassert(src_buf); - HDassert(dst_buf); - HDassert(dst_size); + assert(src_file); + assert(src_buf); + assert(dst_buf); + assert(dst_size); /* Copy header manually */ H5MM_memcpy(q, p, H5R_ENCODE_HEADER_SIZE); @@ -939,11 +940,11 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_ /* Skip the size */ p += sizeof(uint32_t); - HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + sizeof(uint32_t))); + assert(src_size > (H5R_ENCODE_HEADER_SIZE + sizeof(uint32_t))); /* Retrieve blob */ if (H5VL_blob_get(src_file, p, q, blob_size, NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -971,10 +972,10 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, FUNC_ENTER_PACKAGE H5T_REF_LOG_DEBUG(""); - HDassert(src_buf); - HDassert(src_size); - HDassert(dst_file); - HDassert(dst_buf); + assert(src_buf); + assert(src_size); + assert(dst_file); + assert(dst_buf); /* TODO Should get rid of bg stuff */ if (p_bg) { @@ -985,7 +986,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, #ifndef NDEBUG size_t p_buf_size_left = dst_size; - HDassert(p_buf_size_left > (sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE)); + assert(p_buf_size_left > (sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE)); #endif /* Set up VOL callback arguments */ @@ -993,7 +994,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, /* Remove blob for old data */ if (H5VL_blob_specific(dst_file, (void *)p_bg, &vol_cb_args) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob"); } /* end if */ /* Copy header manually so that it does not get encoded into the blob */ @@ -1003,8 +1004,10 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, src_size -= H5R_ENCODE_HEADER_SIZE; #ifndef NDEBUG - size_t buf_size_left = dst_size - sizeof(uint32_t); - HDassert(buf_size_left > sizeof(uint32_t)); + { + size_t buf_size_left = dst_size - sizeof(uint32_t); + assert(buf_size_left > sizeof(uint32_t)); + } #endif /* Set the size */ @@ -1012,7 +1015,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, /* Store blob */ if (H5VL_blob_put(dst_file, p, src_size, q, NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1039,9 +1042,9 @@ H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbo H5T_REF_LOG_DEBUG(""); /* Check parameters */ - HDassert(src_file); - HDassert(src_buf); - HDassert(isnull); + assert(src_file); + assert(src_buf); + assert(isnull); #ifndef NDEBUG { @@ -1049,16 +1052,16 @@ H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbo /* Check if using native VOL connector */ if (H5VL_object_is_native(src_file, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Retrieve file from VOL object */ if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object"); /* Get the object address */ H5F_addr_decode(src_f, &p, &addr); @@ -1090,8 +1093,8 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr FUNC_ENTER_PACKAGE H5T_REF_LOG_DEBUG(""); - HDassert(src_file); - HDassert(src_buf); + assert(src_file); + assert(src_buf); #ifndef NDEBUG { @@ -1099,18 +1102,18 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr /* Check if using native VOL connector */ if (H5VL_object_is_native(src_file, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Retrieve file from VOL object */ if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object"); - HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); + assert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); ret_value = H5T_REF_OBJ_DISK_SIZE(src_f); @@ -1137,9 +1140,9 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ FUNC_ENTER_PACKAGE H5T_REF_LOG_DEBUG(""); - HDassert(src_file); - HDassert(src_buf); - HDassert(dst_buf); + assert(src_file); + assert(src_buf); + assert(dst_buf); #ifndef NDEBUG { @@ -1147,24 +1150,24 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ /* Check if using native VOL connector */ if (H5VL_object_is_native(src_file, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Retrieve file from VOL object */ if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object"); - HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); - HDassert(dst_size == H5F_SIZEOF_ADDR(src_f)); + assert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); + assert(dst_size == H5F_SIZEOF_ADDR(src_f)); /* Get object address */ if (H5R__decode_token_obj_compat((const unsigned char *)src_buf, &src_size, (H5O_token_t *)dst_buf, H5F_SIZEOF_ADDR(src_f)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1191,9 +1194,9 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, H5T_REF_LOG_DEBUG(""); /* Check parameters */ - HDassert(src_file); - HDassert(src_buf); - HDassert(isnull); + assert(src_file); + assert(src_buf); + assert(isnull); #ifndef NDEBUG { @@ -1201,16 +1204,16 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, /* Check if using native VOL connector */ if (H5VL_object_is_native(src_file, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Retrieve file from VOL object */ if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object"); /* Get the heap address */ H5F_addr_decode(src_f, &p, &addr); @@ -1245,7 +1248,7 @@ H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void #endif H5T_REF_LOG_DEBUG(""); - HDassert(src_buf); + assert(src_buf); #ifndef NDEBUG { @@ -1254,16 +1257,16 @@ H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void /* Check if using native VOL connector */ if (H5VL_object_is_native(src_file, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); /* Retrieve file from VOL object */ if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object"); - HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); + assert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); } #endif /* NDEBUG */ @@ -1294,10 +1297,10 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t FUNC_ENTER_PACKAGE H5T_REF_LOG_DEBUG(""); - HDassert(src_file); - HDassert(src_buf); - HDassert(dst_buf); - HDassert(dst_size == sizeof(struct H5Tref_dsetreg)); + assert(src_file); + assert(src_buf); + assert(dst_buf); + assert(dst_size == sizeof(struct H5Tref_dsetreg)); #ifndef NDEBUG { @@ -1305,23 +1308,23 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t /* Check if using native VOL connector */ if (H5VL_object_is_native(src_file, &is_native) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector"); /* Must use native VOL connector for this operation */ - HDassert(is_native); + assert(is_native); } #endif /* NDEBUG */ /* Retrieve file from VOL object */ if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object"); - HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); + assert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); /* Retrieve object address and space */ if (H5R__decode_token_region_compat(src_f, (const unsigned char *)src_buf, &src_size, &dst_reg->token, H5F_SIZEOF_ADDR(src_f), &dst_reg->space) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "unable to get object address"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1345,11 +1348,11 @@ H5T__ref_reclaim(void *elem, const H5T_t *dt) H5T_REF_LOG_DEBUG(""); /* Sanity checks */ - HDassert(elem); - HDassert(dt && (dt->shared->type == H5T_REFERENCE)); + assert(elem); + assert(dt && (dt->shared->type == H5T_REFERENCE)); if (dt->shared->u.atomic.u.r.opaque && H5R__destroy((H5R_ref_priv_t *)elem) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "cannot free reference") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTFREE, FAIL, "cannot free reference"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tstrpad.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tstrpad.c index bea53008c2..89034cc6db 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tstrpad.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tstrpad.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -35,9 +34,6 @@ * * Failure: H5T_STR_ERROR (Negative) * - * Programmer: Robb Matzke - * Friday, January 9, 1998 - * *------------------------------------------------------------------------- */ H5T_str_t @@ -51,11 +47,11 @@ H5Tget_strpad(hid_t type_id) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a datatype"); while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_STR_ERROR, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_STR_ERROR, "operation not defined for datatype class"); /* result */ if (H5T_IS_FIXED_STRING(dt->shared)) @@ -87,9 +83,6 @@ H5Tget_strpad(hid_t type_id) * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, January 9, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -103,15 +96,15 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad) /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (H5T_STATE_TRANSIENT != dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only") + HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "datatype is read-only"); if (strpad < H5T_STR_NULLTERM || strpad >= H5T_NSTR) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type"); while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ if (!H5T_IS_STRING(dt->shared)) - HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class"); /* Commit */ if (H5T_IS_FIXED_STRING(dt->shared)) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tvisit.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tvisit.c index 7974d49890..73c05cbb23 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tvisit.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tvisit.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -21,8 +20,6 @@ /*------------------------------------------------------------------------- * * Created: H5Tvisit.c - * Jul 19 2007 - * Quincey Koziol * * Purpose: Visit all the components of a datatype * @@ -78,9 +75,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 19, 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -92,8 +86,8 @@ H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(dt); - HDassert(op); + assert(dt); + assert(op); /* Check for complex datatype */ is_complex = H5T_IS_COMPLEX(dt->shared->type); @@ -101,7 +95,7 @@ H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value) /* If the callback is to be made on the datatype first, do that */ if (is_complex && (visit_flags & H5T_VISIT_COMPLEX_FIRST)) if (op(dt, op_value) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "operator callback failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "operator callback failed"); /* Make callback for each member/child, if requested */ switch (dt->shared->type) { @@ -111,7 +105,7 @@ H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value) /* Visit each member of the compound datatype */ for (u = 0; u < dt->shared->u.compnd.nmembs; u++) if (H5T__visit(dt->shared->u.compnd.memb[u].type, visit_flags, op, op_value) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "can't visit member datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "can't visit member datatype"); } /* end case */ break; @@ -120,13 +114,13 @@ H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value) case H5T_ENUM: /* Visit parent type */ if (H5T__visit(dt->shared->parent, visit_flags, op, op_value) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "can't visit parent datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "can't visit parent datatype"); break; case H5T_NO_CLASS: case H5T_NCLASSES: /* Not real values */ - HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class") + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, "operation not defined for datatype class"); break; case H5T_INTEGER: @@ -140,14 +134,14 @@ H5T__visit(H5T_t *dt, unsigned visit_flags, H5T_operator_t op, void *op_value) /* Visit "simple" datatypes here */ if (visit_flags & H5T_VISIT_SIMPLE) if (op(dt, op_value) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "operator callback failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "operator callback failed"); break; } /* end switch */ /* If the callback is to be made on the datatype last, do that */ if (is_complex && (visit_flags & H5T_VISIT_COMPLEX_LAST)) if (op(dt, op_value) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "operator callback failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADITER, FAIL, "operator callback failed"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Tvlen.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Tvlen.c index 1650fb8d8c..87f0600092 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Tvlen.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Tvlen.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -137,9 +136,6 @@ static const H5T_vlen_class_t H5T_vlen_disk_g = { * * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, May 20, 1999 - * *------------------------------------------------------------------------- */ hid_t @@ -154,15 +150,15 @@ H5Tvlen_create(hid_t base_id) /* Check args */ if (NULL == (base = (H5T_t *)H5I_object_verify(base_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an valid base datatype"); /* Create up VL datatype */ if ((dt = H5T__vlen_create(base)) == NULL) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid VL location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "invalid VL location"); /* Register the type */ if ((ret_value = H5I_register(H5I_DATATYPE, dt, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype"); done: FUNC_LEAVE_API(ret_value) @@ -178,9 +174,6 @@ H5Tvlen_create(hid_t base_id) * * Failure: NULL * - * Programmer: Quincey Koziol - * Tuesday, November 20, 2001 - * *------------------------------------------------------------------------- */ H5T_t * @@ -192,11 +185,11 @@ H5T__vlen_create(const H5T_t *base) FUNC_ENTER_PACKAGE /* Check args */ - HDassert(base); + assert(base); /* Build new type */ if (NULL == (dt = H5T__alloc())) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "memory allocation failed"); dt->shared->type = H5T_VLEN; /* @@ -205,7 +198,7 @@ H5T__vlen_create(const H5T_t *base) */ dt->shared->force_conv = TRUE; if (NULL == (dt->shared->parent = H5T_copy(base, H5T_COPY_ALL))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy base datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, NULL, "can't copy base datatype"); /* Inherit encoding version from base type */ dt->shared->version = base->shared->version; @@ -215,7 +208,7 @@ H5T__vlen_create(const H5T_t *base) /* Set up VL information */ if (H5T_set_loc(dt, NULL, H5T_LOC_MEMORY) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location"); /* Set return value */ ret_value = dt; @@ -223,7 +216,7 @@ H5T__vlen_create(const H5T_t *base) done: if (!ret_value) if (dt && H5T_close_real(dt) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "unable to release datatype info") + HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "unable to release datatype info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__vlen_create() */ @@ -239,9 +232,6 @@ H5T__vlen_create(const H5T_t *base) * FALSE - If the location of any vlen types is the same * <0 is returned on failure * - * Programmer: Quincey Koziol - * Friday, June 4, 1999 - * *------------------------------------------------------------------------- */ htri_t @@ -252,14 +242,14 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) FUNC_ENTER_PACKAGE /* check parameters */ - HDassert(dt); - HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); + assert(dt); + assert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); /* Only change the location if it's different */ if (loc != dt->shared->u.vlen.loc || file != dt->shared->u.vlen.file) { switch (loc) { case H5T_LOC_MEMORY: /* Memory based VL datatype */ - HDassert(NULL == file); + assert(NULL == file); /* Mark this type as being stored in memory */ dt->shared->u.vlen.loc = H5T_LOC_MEMORY; @@ -279,12 +269,12 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) dt->shared->u.vlen.cls = &H5T_vlen_mem_str_g; } /* end else-if */ else - HDassert(0 && "Invalid VL type"); + assert(0 && "Invalid VL type"); /* Release owned file */ if (dt->shared->owned_vol_obj) { if (H5VL_free_object(dt->shared->owned_vol_obj) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "unable to close owned VOL object"); dt->shared->owned_vol_obj = NULL; } /* end if */ @@ -297,7 +287,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */ - HDassert(file); + assert(file); /* Mark this type as being stored on disk */ dt->shared->u.vlen.loc = H5T_LOC_DISK; @@ -308,7 +298,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Get container info */ if (H5VL_file_get(file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info"); /* The datatype size is equal to 4 bytes for the sequence length * plus the size of a blob id */ @@ -323,7 +313,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* dt now owns a reference to file */ if (H5T_own_vol_obj(dt, file) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object"); break; } @@ -343,7 +333,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) case H5T_LOC_MAXLOC: /* MAXLOC is invalid */ default: - HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype location") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype location"); } /* end switch */ /*lint !e788 All appropriate cases are covered */ /* Indicate that the location changed */ @@ -361,9 +351,6 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 2, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -374,13 +361,13 @@ H5T__vlen_mem_seq_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, si FUNC_ENTER_PACKAGE_NOERR /* Check parameter */ - HDassert(_vl); - HDassert(len); + assert(_vl); + assert(len); /* Copy to ensure correct alignment. memcpy is best here because * it optimizes to fast code. */ - HDmemcpy(&vl, _vl, sizeof(hvl_t)); + memcpy(&vl, _vl, sizeof(hvl_t)); *len = vl.len; @@ -394,9 +381,6 @@ H5T__vlen_mem_seq_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, si * * Return: Non-NULL on success/NULL on failure * - * Programmer: Quincey Koziol - * Saturday, June 12, 2004 - * *------------------------------------------------------------------------- */ static void * @@ -407,9 +391,9 @@ H5T__vlen_mem_seq_getptr(void *_vl) FUNC_ENTER_PACKAGE_NOERR /* check parameters, return result */ - HDassert(_vl); + assert(_vl); /* Copy to ensure correct alignment. */ - HDmemcpy(&vl, _vl, sizeof(hvl_t)); + memcpy(&vl, _vl, sizeof(hvl_t)); FUNC_LEAVE_NOAPI(vl.p) } /* end H5T__vlen_mem_seq_getptr() */ @@ -421,9 +405,6 @@ H5T__vlen_mem_seq_getptr(void *_vl) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Saturday, November 8, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -434,10 +415,10 @@ H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hb FUNC_ENTER_PACKAGE_NOERR /* Check parameters */ - HDassert(_vl); + assert(_vl); /* Copy to ensure correct alignment. */ - HDmemcpy(&vl, _vl, sizeof(hvl_t)); + memcpy(&vl, _vl, sizeof(hvl_t)); *isnull = ((vl.len == 0 || vl.p == NULL) ? TRUE : FALSE); @@ -451,9 +432,6 @@ H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hb * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, November 8, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -464,7 +442,7 @@ H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5 FUNC_ENTER_PACKAGE_NOERR /* check parameters */ - HDassert(_vl); + assert(_vl); /* Set the "nil" hvl_t */ vl.len = 0; @@ -483,9 +461,6 @@ H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5 * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 2, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -496,11 +471,11 @@ H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, FUNC_ENTER_PACKAGE_NOERR /* check parameters, copy data */ - HDassert(buf); - HDassert(_vl); + assert(buf); + assert(_vl); /* Copy to ensure correct alignment. */ - HDmemcpy(&vl, _vl, sizeof(hvl_t)); - HDassert(vl.p); + memcpy(&vl, _vl, sizeof(hvl_t)); + assert(vl.p); H5MM_memcpy(buf, vl.p, len); @@ -514,9 +489,6 @@ H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 2, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -529,8 +501,8 @@ H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc FUNC_ENTER_PACKAGE /* check parameters */ - HDassert(_vl); - HDassert(buf); + assert(_vl); + assert(buf); if (seq_len) { size_t len = seq_len * base_size; /* Sequence size */ @@ -539,11 +511,11 @@ H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc if (vl_alloc_info->alloc_func != NULL) { if (NULL == (vl.p = (vl_alloc_info->alloc_func)(len, vl_alloc_info->alloc_info))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, - "application memory allocation routine failed for VL data") + "application memory allocation routine failed for VL data"); } /* end if */ else /* Default to system malloc */ - if (NULL == (vl.p = HDmalloc(len))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed for VL data") + if (NULL == (vl.p = malloc(len))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed for VL data"); /* Copy the data into the newly allocated buffer */ H5MM_memcpy(vl.p, buf, len); @@ -568,9 +540,6 @@ H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 2, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -581,10 +550,10 @@ H5T__vlen_mem_str_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, si FUNC_ENTER_PACKAGE_NOERR /* check parameters */ - HDassert(_vl); + assert(_vl); /* Copy to ensure correct alignment. */ - HDmemcpy(&s, _vl, sizeof(char *)); + memcpy(&s, _vl, sizeof(char *)); *len = HDstrlen(s); @@ -598,9 +567,6 @@ H5T__vlen_mem_str_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, si * * Return: Non-NULL on success/NULL on failure * - * Programmer: Quincey Koziol - * Saturday, June 12, 2004 - * *------------------------------------------------------------------------- */ static void * @@ -611,9 +577,9 @@ H5T__vlen_mem_str_getptr(void *_vl) FUNC_ENTER_PACKAGE_NOERR /* check parameters */ - HDassert(_vl); + assert(_vl); /* Copy to ensure correct alignment. */ - HDmemcpy(&s, _vl, sizeof(char *)); + memcpy(&s, _vl, sizeof(char *)); FUNC_LEAVE_NOAPI(s) } /* end H5T__vlen_mem_str_getptr() */ @@ -625,9 +591,6 @@ H5T__vlen_mem_str_getptr(void *_vl) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Saturday, November 8, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -638,7 +601,7 @@ H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hb FUNC_ENTER_PACKAGE_NOERR /* Copy to ensure correct alignment. */ - HDmemcpy(&s, _vl, sizeof(char *)); + memcpy(&s, _vl, sizeof(char *)); *isnull = (s == NULL ? TRUE : FALSE); @@ -652,9 +615,6 @@ H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hb * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, November 8, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -677,9 +637,6 @@ H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5 * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 2, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -691,10 +648,10 @@ H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, if (len > 0) { /* check parameters */ - HDassert(buf); - HDassert(_vl); + assert(buf); + assert(_vl); /* Copy to ensure correct alignment. */ - HDmemcpy(&s, _vl, sizeof(char *)); + memcpy(&s, _vl, sizeof(char *)); H5MM_memcpy(buf, s, len); } /* end if */ @@ -709,9 +666,6 @@ H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 2, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -725,18 +679,18 @@ H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc FUNC_ENTER_PACKAGE /* check parameters */ - HDassert(buf); + assert(buf); /* Use the user's memory allocation routine if one is defined */ if (vl_alloc_info->alloc_func != NULL) { if (NULL == (t = (char *)(vl_alloc_info->alloc_func)((seq_len + 1) * base_size, vl_alloc_info->alloc_info))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, - "application memory allocation routine failed for VL data") + "application memory allocation routine failed for VL data"); } /* end if */ else /* Default to system malloc */ - if (NULL == (t = (char *)HDmalloc((seq_len + 1) * base_size))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed for VL data") + if (NULL == (t = (char *)malloc((seq_len + 1) * base_size))) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed for VL data"); /* 'write' the string into the buffer, with memcpy() */ len = (seq_len * base_size); @@ -757,9 +711,6 @@ H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 2, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -770,8 +721,8 @@ H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_ FUNC_ENTER_PACKAGE_NOERR /* Check parameters */ - HDassert(vl); - HDassert(seq_len); + assert(vl); + assert(seq_len); /* Get length of sequence (different from blob size) */ UINT32DECODE(vl, *seq_len); @@ -786,9 +737,6 @@ H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_ * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Saturday, November 8, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -801,9 +749,9 @@ H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull) FUNC_ENTER_PACKAGE /* Check parameters */ - HDassert(file); - HDassert(vl); - HDassert(isnull); + assert(file); + assert(vl); + assert(isnull); /* Skip the sequence's length */ vl += 4; @@ -814,7 +762,7 @@ H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull) /* Check if blob ID is "nil" */ if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -827,9 +775,6 @@ H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Saturday, November 8, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -842,14 +787,14 @@ H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg) FUNC_ENTER_PACKAGE /* check parameters */ - HDassert(file); - HDassert(vl); + assert(file); + assert(vl); /* Free heap object for old data */ if (bg != NULL) /* Delete sequence in destination location */ if (H5T__vlen_disk_delete(file, bg) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object"); /* Set the length of the sequence */ UINT32ENCODE(vl, 0); @@ -859,7 +804,7 @@ H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg) /* Set blob ID to "nil" */ if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -872,9 +817,6 @@ H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 2, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -886,16 +828,16 @@ H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len) FUNC_ENTER_PACKAGE /* Check parameters */ - HDassert(file); - HDassert(vl); - HDassert(buf); + assert(file); + assert(vl); + assert(buf); /* Skip the length of the sequence */ vl += 4; /* Retrieve blob */ if (H5VL_blob_get(file, vl, buf, len, NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -908,9 +850,6 @@ H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, June 2, 1999 - * *------------------------------------------------------------------------- */ static herr_t @@ -924,21 +863,21 @@ H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t H5_ATTR_UN FUNC_ENTER_PACKAGE /* check parameters */ - HDassert(vl); - HDassert(seq_len == 0 || buf); - HDassert(file); + assert(vl); + assert(seq_len == 0 || buf); + assert(file); /* Free heap object for old data, if non-NULL */ if (bg != NULL) if (H5T__vlen_disk_delete(file, bg) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object"); /* Set the length of the sequence */ UINT32ENCODE(vl, seq_len); /* Store blob */ if (H5VL_blob_put(file, buf, (seq_len * base_size), vl, NULL) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -951,9 +890,6 @@ H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t H5_ATTR_UN * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Friday, August 15, 2019 - * *------------------------------------------------------------------------- */ static herr_t @@ -965,7 +901,7 @@ H5T__vlen_disk_delete(H5VL_object_t *file, void *_vl) FUNC_ENTER_PACKAGE /* Check parameters */ - HDassert(file); + assert(file); /* Free heap object for old data */ if (vl != NULL) { @@ -982,7 +918,7 @@ H5T__vlen_disk_delete(H5VL_object_t *file, void *_vl) vol_cb_args.op_type = H5VL_BLOB_DELETE; if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob"); } /* end if */ } /* end if */ @@ -997,9 +933,6 @@ H5T__vlen_disk_delete(H5VL_object_t *file, void *_vl) * * Return: Non-negative on success / Negative on failure * - * Programmer: Quincey Koziol - * Friday, August 15, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1013,9 +946,9 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(elem); - HDassert(dt); - HDassert(alloc_info); + assert(elem); + assert(dt); + assert(alloc_info); free_func = alloc_info->free_func; free_info = alloc_info->free_info; @@ -1031,7 +964,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info for (u = 0; u < dt->shared->u.array.nelem; u++) { off = ((uint8_t *)elem) + u * (dt->shared->parent->shared->size); if (H5T_reclaim_cb(off, dt->shared->parent, 0, NULL, alloc_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free array element") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free array element"); } /* end for */ } /* end if */ break; @@ -1046,7 +979,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info /* Calculate the offset member and recurse on it */ off = ((uint8_t *)elem) + dt->shared->u.compnd.memb[u].offset; if (H5T_reclaim_cb(off, dt->shared->u.compnd.memb[u].type, 0, NULL, alloc_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free compound field") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free compound field"); } /* end if */ } /* end for */ break; @@ -1066,7 +999,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info while (vl->len > 0) { off = ((uint8_t *)vl->p) + (vl->len - 1) * dt->shared->parent->shared->size; if (H5T_reclaim_cb(off, dt->shared->parent, 0, NULL, alloc_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free VL element") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free VL element"); vl->len--; } /* end while */ } /* end if */ @@ -1075,7 +1008,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info if (free_func != NULL) (*free_func)(vl->p, free_info); else - HDfree(vl->p); + free(vl->p); } /* end if */ } else if (dt->shared->u.vlen.type == H5T_VLEN_STRING) { @@ -1083,10 +1016,10 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info if (free_func != NULL) (*free_func)(*(char **)elem, free_info); else - HDfree(*(char **)elem); + free(*(char **)elem); } else { - HDassert(0 && "Invalid VL type"); + assert(0 && "Invalid VL type"); } /* end else */ break; @@ -1105,7 +1038,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info case H5T_NO_CLASS: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype class") + HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype class"); break; } /* end switch */ /*lint !e788 All appropriate cases are covered */ @@ -1125,9 +1058,6 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info * * Return: Non-negative on success/Negative on failure * - * Programmer: Mike McGreevy - * May 11, 2010 - * *------------------------------------------------------------------------- */ herr_t @@ -1136,18 +1066,18 @@ H5T_vlen_reclaim_elmt(void *elem, H5T_t *dt) H5T_vlen_alloc_info_t vl_alloc_info; /* VL allocation info */ herr_t ret_value = SUCCEED; /* return value */ - HDassert(dt); - HDassert(elem); + assert(dt); + assert(elem); FUNC_ENTER_NOAPI(FAIL) /* Get VL allocation info */ if (H5CX_get_vlen_alloc_info(&vl_alloc_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info"); /* Recurse on buffer to free dynamic fields */ if (H5T__vlen_reclaim(elem, dt, &vl_alloc_info) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "can't reclaim vlen elements"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5UC.c b/externals/coda-oss/modules/drivers/hdf5/source/H5UC.c index c1c8b5ba98..00da5306c0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5UC.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5UC.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -59,12 +58,12 @@ H5UC_create(void *o, H5UC_free_func_t free_func) FUNC_ENTER_NOAPI(NULL) /* Sanity check */ - HDassert(o); - HDassert(free_func); + assert(o); + assert(free_func); /* Allocate ref-counted string structure */ if (NULL == (ret_value = H5FL_MALLOC(H5UC_t))) - HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed"); /* Set the internal fields */ ret_value->o = o; @@ -102,10 +101,10 @@ H5UC_decr(H5UC_t *rc) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(rc); - HDassert(rc->o); - HDassert(rc->n > 0); - HDassert(rc->free_func); + assert(rc); + assert(rc->o); + assert(rc->n > 0); + assert(rc->free_func); /* Decrement reference count */ rc->n--; @@ -114,7 +113,7 @@ H5UC_decr(H5UC_t *rc) if (rc->n == 0) { if ((rc->free_func)(rc->o) < 0) { rc = H5FL_FREE(H5UC_t, rc); - HGOTO_ERROR(H5E_RS, H5E_CANTFREE, FAIL, "memory release failed") + HGOTO_ERROR(H5E_RS, H5E_CANTFREE, FAIL, "memory release failed"); } /* end if */ rc = H5FL_FREE(H5UC_t, rc); } /* end if */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VL.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VL.c index fb7af97299..53c72f70dd 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VL.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VL.c @@ -91,11 +91,11 @@ H5VLregister_connector(const H5VL_class_t *cls, hid_t vipl_id) if (H5P_DEFAULT == vipl_id) vipl_id = H5P_VOL_INITIALIZE_DEFAULT; else if (TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list"); /* Register connector */ if ((ret_value = H5VL__register_connector_by_class(cls, TRUE, vipl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector"); done: FUNC_LEAVE_API(ret_value) @@ -128,20 +128,20 @@ H5VLregister_connector_by_name(const char *name, hid_t vipl_id) /* Check arguments */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL connector name is disallowed") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, "null VOL connector name is disallowed"); if (0 == HDstrlen(name)) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, - "zero-length VOL connector name is disallowed") + "zero-length VOL connector name is disallowed"); /* Check VOL initialization property list */ if (H5P_DEFAULT == vipl_id) vipl_id = H5P_VOL_INITIALIZE_DEFAULT; else if (TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list"); /* Register connector */ if ((ret_value = H5VL__register_connector_by_name(name, TRUE, vipl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector"); done: FUNC_LEAVE_API(ret_value) @@ -175,17 +175,17 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id) /* Check arguments */ if (value < 0) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, - "negative VOL connector value is disallowed") + "negative VOL connector value is disallowed"); /* Check VOL initialization property list */ if (H5P_DEFAULT == vipl_id) vipl_id = H5P_VOL_INITIALIZE_DEFAULT; else if (TRUE != H5P_isa_class(vipl_id, H5P_VOL_INITIALIZE)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL initialize property list"); /* Register connector */ if ((ret_value = H5VL__register_connector_by_value(value, TRUE, vipl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector"); done: FUNC_LEAVE_API(ret_value) @@ -201,9 +201,6 @@ H5VLregister_connector_by_value(H5VL_class_value_t value, hid_t vipl_id) * 0 if a VOL connector with that name has NOT been registered * <0 on errors * - * Programmer: Dana Robinson - * June 17, 2017 - * *------------------------------------------------------------------------- */ htri_t @@ -216,7 +213,7 @@ H5VLis_connector_registered_by_name(const char *name) /* Check if connector with this name is registered */ if ((ret_value = H5VL__is_connector_registered_by_name(name)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check for VOL") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check for VOL"); done: FUNC_LEAVE_API(ret_value) @@ -244,7 +241,7 @@ H5VLis_connector_registered_by_value(H5VL_class_value_t connector_value) /* Check if connector with this value is registered */ if ((ret_value = H5VL__is_connector_registered_by_value(connector_value)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check for VOL") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check for VOL"); done: FUNC_LEAVE_API(ret_value) @@ -260,9 +257,6 @@ H5VLis_connector_registered_by_value(H5VL_class_value_t connector_value) * * H5I_INVALID_HID on error. * - * Programmer: Dana Robinson - * June 17, 2017 - * *------------------------------------------------------------------------- */ hid_t @@ -275,7 +269,7 @@ H5VLget_connector_id(hid_t obj_id) /* Get connector ID */ if ((ret_value = H5VL__get_connector_id(obj_id, TRUE)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id"); done: FUNC_LEAVE_API(ret_value) @@ -293,9 +287,6 @@ H5VLget_connector_id(hid_t obj_id) * H5I_INVALID_HID on error or if a VOL connector of that * name has not been registered. * - * Programmer: Dana Robinson - * June 17, 2017 - * *------------------------------------------------------------------------- */ hid_t @@ -308,7 +299,7 @@ H5VLget_connector_id_by_name(const char *name) /* Get connector ID with this name */ if ((ret_value = H5VL__get_connector_id_by_name(name, TRUE)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id"); done: FUNC_LEAVE_API(ret_value) @@ -338,7 +329,7 @@ H5VLget_connector_id_by_value(H5VL_class_value_t connector_value) /* Get connector ID with this value */ if ((ret_value = H5VL__get_connector_id_by_value(connector_value, TRUE)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id"); done: FUNC_LEAVE_API(ret_value) @@ -369,7 +360,7 @@ H5VLpeek_connector_id_by_name(const char *name) /* Get connector ID with this name */ if ((ret_value = H5VL__peek_connector_id_by_name(name)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id"); done: FUNC_LEAVE_API(ret_value) @@ -400,7 +391,7 @@ H5VLpeek_connector_id_by_value(H5VL_class_value_t value) /* Get connector ID with this value */ if ((ret_value = H5VL__peek_connector_id_by_value(value)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL id"); done: FUNC_LEAVE_API(ret_value) @@ -433,7 +424,7 @@ H5VLget_connector_name(hid_t obj_id, char *name /*out*/, size_t size) /* Call internal routine */ if ((ret_value = H5VL__get_connector_name(obj_id, name, size)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get connector name") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Can't get connector name"); done: FUNC_LEAVE_API(ret_value) @@ -462,11 +453,11 @@ H5VLclose(hid_t vol_id) /* Check args */ if (NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector"); /* Decrement the ref count on the ID, possibly releasing the VOL connector */ if (H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close VOL connector ID"); done: FUNC_LEAVE_API(ret_value) @@ -500,22 +491,22 @@ H5VLunregister_connector(hid_t vol_id) /* Check arguments */ if (NULL == H5I_object_verify(vol_id, H5I_VOL)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* For the time being, we disallow unregistering the native VOL connector */ if (H5I_INVALID_HID == (native_id = H5VL__get_connector_id_by_name(H5VL_NATIVE_NAME, FALSE))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to find the native VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to find the native VOL connector ID"); if (vol_id == native_id) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "unregistering the native VOL connector is not allowed") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "unregistering the native VOL connector is not allowed"); /* The H5VL_class_t struct will be freed by this function */ if (H5I_dec_app_ref(vol_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector"); done: if (native_id != H5I_INVALID_HID) if (H5I_dec_ref(native_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement count on native_id") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement count on native_id"); FUNC_LEAVE_API(ret_value) } /* end H5VLunregister_connector() */ @@ -545,13 +536,13 @@ H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2) /* Check args and get class pointers */ if (NULL == (cls1 = (H5VL_class_t *)H5I_object_verify(connector_id1, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); if (NULL == (cls2 = (H5VL_class_t *)H5I_object_verify(connector_id2, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Compare the two VOL connector classes */ if (H5VL_cmp_connector_cls(cmp, cls1, cls2) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes"); done: FUNC_LEAVE_API(ret_value) @@ -612,14 +603,14 @@ H5VLwrap_register(void *obj, H5I_type_t type) case H5I_EVENTSET: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number") + HGOTO_ERROR(H5E_VOL, H5E_BADRANGE, H5I_INVALID_HID, "invalid type number"); } /* end switch */ if (NULL == obj) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "obj is NULL") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, "obj is NULL"); /* Wrap the object and register an ID for it */ if ((ret_value = H5VL_wrap_register(type, obj, TRUE)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to wrap object") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to wrap object"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -649,7 +640,7 @@ H5VLobject(hid_t id) /* Retrieve the object pointer for the ID */ if (NULL == (ret_value = H5VL_object(id))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to retrieve object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to retrieve object"); done: FUNC_LEAVE_API(ret_value) @@ -675,14 +666,14 @@ H5VLobject_is_native(hid_t obj_id, hbool_t *is_native) H5TRACE2("e", "i*b", obj_id, is_native); if (!is_native) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`is_native` argument is NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`is_native` argument is NULL"); /* Get the location object for the ID */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); if (H5VL_object_is_native(vol_obj, is_native) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if object is a native connector object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if object is a native connector object"); done: FUNC_LEAVE_API(ret_value) @@ -712,34 +703,34 @@ H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id) /* Check args */ if (!file_obj) - HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "no file object supplied") + HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "no file object supplied"); if (NULL == (dtype = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); /* Create VOL object for file if necessary (force_conv will be TRUE if and * only if file needs to be passed to H5T_set_loc) */ if (H5T_GET_FORCE_CONV(dtype) && (NULL == (file_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file_obj, connector_id)))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object"); /* Copy the datatype */ if (NULL == (file_type = H5T_copy(dtype, H5T_COPY_TRANSIENT))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy datatype") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy datatype"); /* Register file type id */ if ((file_type_id = H5I_register(H5I_DATATYPE, file_type, FALSE)) < 0) { (void)H5T_close_real(file_type); - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "unable to register file datatype") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "unable to register file datatype"); } /* end if */ /* Set the location of the datatype to be in the file */ if (H5T_set_loc(file_type, file_vol_obj, H5T_LOC_DISK) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't set datatype location") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't set datatype location"); /* Release our reference to file_type */ if (file_vol_obj) { if (H5VL_free_object(file_vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to free VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to free VOL object"); file_vol_obj = NULL; } /* end if */ @@ -750,9 +741,9 @@ H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id) /* Cleanup on error */ if (ret_value < 0) { if (file_vol_obj && H5VL_free_object(file_vol_obj) < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to free VOL object") + HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to free VOL object"); if (file_type_id >= 0 && H5I_dec_ref(file_type_id) < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close file datatype") + HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to close file datatype"); } /* end if */ FUNC_LEAVE_API(ret_value) @@ -770,9 +761,6 @@ H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id) * Return: Success: Non-negative, *state set * Failure: Negative, *state unset * - * Programmer: Quincey Koziol - * Thursday, January 10, 2019 - * *--------------------------------------------------------------------------- */ herr_t @@ -786,11 +774,11 @@ H5VLretrieve_lib_state(void **state /*out*/) /* Check args */ if (NULL == state) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer"); /* Retrieve the library state */ if (H5VL_retrieve_lib_state(state) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve library state") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve library state"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -807,9 +795,6 @@ H5VLretrieve_lib_state(void **state /*out*/) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Friday, February 5, 2021 - * *--------------------------------------------------------------------------- */ herr_t @@ -823,7 +808,7 @@ H5VLstart_lib_state(void) /* Start a new library state */ if (H5VL_start_lib_state() < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't start new library state") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't start new library state"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -840,9 +825,6 @@ H5VLstart_lib_state(void) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, January 10, 2019 - * *--------------------------------------------------------------------------- */ herr_t @@ -856,11 +838,11 @@ H5VLrestore_lib_state(const void *state) /* Check args */ if (NULL == state) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "invalid state pointer"); /* Restore the library state */ if (H5VL_restore_lib_state(state) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't restore library state") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't restore library state"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -882,9 +864,6 @@ H5VLrestore_lib_state(const void *state) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Saturday, February 23, 2019 - * *--------------------------------------------------------------------------- */ herr_t @@ -898,7 +877,7 @@ H5VLfinish_lib_state(void) /* Reset the library state */ if (H5VL_finish_lib_state() < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset library state") + HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset library state"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -918,9 +897,6 @@ H5VLfinish_lib_state(void) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Thursday, January 10, 2019 - * *--------------------------------------------------------------------------- */ herr_t @@ -933,11 +909,11 @@ H5VLfree_lib_state(void *state) /* Check args */ if (NULL == state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid state pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid state pointer"); /* Free the library state */ if (H5VL_free_lib_state(state) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free library state") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free library state"); done: FUNC_LEAVE_API(ret_value) @@ -966,13 +942,13 @@ H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t /* Check args */ if (NULL == flags) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid 'flags' pointer") - if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid 'flags' pointer"); + if (NULL == (vol_obj = H5VL_vol_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier"); /* Query the connector */ if (H5VL_introspect_opt_query(vol_obj, subcls, opt_type, flags) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to query VOL connector operation") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to query VOL connector operation"); done: FUNC_LEAVE_API(ret_value) @@ -1017,20 +993,20 @@ H5VLregister_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_ /* Check args */ if (NULL == op_val) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_val pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_val pointer"); if (NULL == op_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer"); if ('\0' == *op_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string"); if (!((H5VL_SUBCLS_ATTR == subcls) || (H5VL_SUBCLS_DATASET == subcls) || (H5VL_SUBCLS_DATATYPE == subcls) || (H5VL_SUBCLS_FILE == subcls) || (H5VL_SUBCLS_GROUP == subcls) || (H5VL_SUBCLS_OBJECT == subcls) || (H5VL_SUBCLS_LINK == subcls) || (H5VL_SUBCLS_REQUEST == subcls))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type"); /* Register the operation */ if (H5VL__register_opt_operation(subcls, op_name, op_val) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register dynamic optional operation: '%s'", - op_name) + op_name); done: FUNC_LEAVE_API(ret_value) @@ -1056,19 +1032,19 @@ H5VLfind_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val /* Check args */ if (NULL == op_val) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_val pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_val pointer"); if (NULL == op_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer"); if ('\0' == *op_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string"); if (!((H5VL_SUBCLS_ATTR == subcls) || (H5VL_SUBCLS_DATASET == subcls) || (H5VL_SUBCLS_DATATYPE == subcls) || (H5VL_SUBCLS_FILE == subcls) || (H5VL_SUBCLS_GROUP == subcls) || (H5VL_SUBCLS_OBJECT == subcls) || (H5VL_SUBCLS_LINK == subcls) || (H5VL_SUBCLS_REQUEST == subcls))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type"); /* Find the operation */ if (H5VL__find_opt_operation(subcls, op_name, op_val) < 0) - HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "can't find dynamic optional operation: '%s'", op_name) + HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "can't find dynamic optional operation: '%s'", op_name); done: FUNC_LEAVE_API(ret_value) @@ -1094,18 +1070,18 @@ H5VLunregister_opt_operation(H5VL_subclass_t subcls, const char *op_name) /* Check args */ if (NULL == op_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer"); if ('\0' == *op_name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string"); if (!((H5VL_SUBCLS_ATTR == subcls) || (H5VL_SUBCLS_DATASET == subcls) || (H5VL_SUBCLS_DATATYPE == subcls) || (H5VL_SUBCLS_FILE == subcls) || (H5VL_SUBCLS_GROUP == subcls) || (H5VL_SUBCLS_OBJECT == subcls) || (H5VL_SUBCLS_LINK == subcls) || (H5VL_SUBCLS_REQUEST == subcls))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type"); /* Unregister the operation */ if (H5VL__unregister_opt_operation(subcls, op_name) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "can't unregister dynamic optional operation: '%s'", - op_name) + op_name); done: FUNC_LEAVE_API(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLcallback.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLcallback.c index 17547b3ba3..e1dda22a31 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLcallback.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLcallback.c @@ -88,10 +88,12 @@ static void *H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_param hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); static void *H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t dxpl_id, void *buf, void **req); -static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req); +static herr_t H5VL__dataset_read(size_t count, void *obj[], const H5VL_class_t *cls, hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, void *buf[], + void **req); +static herr_t H5VL__dataset_write(size_t count, void *obj[], const H5VL_class_t *cls, hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, + const void *buf[], void **req); static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req); static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_args_t *args, @@ -224,11 +226,11 @@ H5VLinitialize(hid_t connector_id, hid_t vipl_id) /* Check args */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Invoke class' callback, if there is one */ if (cls->initialize && cls->initialize(vipl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not initialize") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not initialize"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -255,11 +257,11 @@ H5VLterminate(hid_t connector_id) /* Check args */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Invoke class' callback, if there is one */ if (cls->terminate && cls->terminate() < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -276,7 +278,7 @@ H5VLterminate(hid_t connector_id) *--------------------------------------------------------------------------- */ herr_t -H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags /*out*/) +H5VLget_cap_flags(hid_t connector_id, uint64_t *cap_flags /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ @@ -286,7 +288,7 @@ H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags /*out*/) /* Check args */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Retrieve capability flags */ if (cap_flags) @@ -317,7 +319,7 @@ H5VLget_value(hid_t connector_id, H5VL_class_value_t *value /*out*/) /* Check args */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Retrieve connector value */ if (value) @@ -350,11 +352,11 @@ H5VL__common_optional_op(hid_t id, H5I_type_t id_type, H5VL_reg_opt_oper_t reg_o /* Check ID type & get VOL object */ if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(id, id_type))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid identifier"); /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(*vol_obj_ptr) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ @@ -366,7 +368,7 @@ H5VL__common_optional_op(hid_t id, H5I_type_t id_type, H5VL_reg_opt_oper_t reg_o done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__common_optional_op() */ @@ -390,22 +392,22 @@ H5VL_copy_connector_info(const H5VL_class_t *connector, void **dst_info, const v FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(connector); + assert(connector); /* Check for actual source info */ if (src_info) { /* Allow the connector to copy or do it ourselves */ if (connector->info_cls.copy) { if (NULL == (new_connector_info = (connector->info_cls.copy)(src_info))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "connector info copy callback failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "connector info copy callback failed"); } /* end if */ else if (connector->info_cls.size > 0) { if (NULL == (new_connector_info = H5MM_malloc(connector->info_cls.size))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "connector info allocation failed"); H5MM_memcpy(new_connector_info, src_info, connector->info_cls.size); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "no way to copy connector info"); } /* end if */ /* Set the connector info for the copy */ @@ -436,11 +438,11 @@ H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_i /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Copy the VOL connector's info object */ if (H5VL_copy_connector_info(cls, dst_vol_info, src_vol_info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL connector info object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL connector info object"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -467,8 +469,8 @@ H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value, const voi FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(connector); - HDassert(cmp_value); + assert(connector); + assert(cmp_value); /* Take care of cases where one or both pointers is NULL */ if (info1 == NULL && info2 != NULL) { @@ -490,11 +492,11 @@ H5VL_cmp_connector_info(const H5VL_class_t *connector, int *cmp_value, const voi */ if (connector->info_cls.cmp) { if ((connector->info_cls.cmp)(cmp_value, info1, info2) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector info") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector info"); } /* end if */ else { - HDassert(connector->info_cls.size > 0); - *cmp_value = HDmemcmp(info1, info2, connector->info_cls.size); + assert(connector->info_cls.size > 0); + *cmp_value = memcmp(info1, info2, connector->info_cls.size); } /* end else */ done: @@ -527,7 +529,7 @@ H5VLcmp_connector_info(int *cmp, hid_t connector_id, const void *info1, const vo /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Compare the two VOL connector info objects */ if (cmp) @@ -556,11 +558,11 @@ H5VL_free_connector_info(hid_t connector_id, const void *info) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(connector_id > 0); + assert(connector_id > 0); /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Only free info object, if it's non-NULL */ if (info) { @@ -568,7 +570,7 @@ H5VL_free_connector_info(hid_t connector_id, const void *info) if (cls->info_cls.free) { /* Cast through uintptr_t to de-const memory */ if ((cls->info_cls.free)((void *)(uintptr_t)info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector info free request failed"); } else H5MM_xfree_const(info); @@ -598,7 +600,7 @@ H5VLfree_connector_info(hid_t connector_id, void *info) /* Free the VOL connector info object */ if (H5VL_free_connector_info(connector_id, info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -628,12 +630,12 @@ H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str) /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Allow the connector to serialize info */ if (cls->info_cls.to_str) { if ((cls->info_cls.to_str)(info, str) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize connector info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize connector info"); } /* end if */ else *str = NULL; @@ -665,7 +667,7 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info /*out /* Call internal routine */ if (H5VL__connector_str_to_info(str, connector_id, info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info") + HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -692,9 +694,9 @@ H5VLget_object(void *obj, hid_t connector_id) /* Check args */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Check for 'get_object' callback in connector */ if (cls->wrap_cls.get_object) @@ -724,18 +726,18 @@ H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(connector); - HDassert(obj); - HDassert(wrap_ctx); + assert(connector); + assert(obj); + assert(wrap_ctx); /* Allow the connector to copy or do it ourselves */ if (connector->wrap_cls.get_wrap_ctx) { /* Sanity check */ - HDassert(connector->wrap_cls.free_wrap_ctx); + assert(connector->wrap_cls.free_wrap_ctx); /* Invoke connector's callback */ if ((connector->wrap_cls.get_wrap_ctx)(obj, wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector wrap context callback failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector wrap context callback failed"); } /* end if */ else *wrap_ctx = NULL; @@ -765,11 +767,11 @@ H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx /*out*/) /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Get the VOL connector's object wrapper */ if (H5VL_get_wrap_ctx(cls, obj, wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL connector object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL connector object wrap context"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -793,14 +795,14 @@ H5VL_wrap_object(const H5VL_class_t *connector, void *wrap_ctx, void *obj, H5I_t FUNC_ENTER_NOAPI(NULL) /* Sanity checks */ - HDassert(connector); - HDassert(obj); + assert(connector); + assert(obj); /* Only wrap object if there's a wrap context */ if (wrap_ctx) { /* Ask the connector to wrap the object */ if (NULL == (ret_value = (connector->wrap_cls.wrap_object)(obj, obj_type, wrap_ctx))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object"); } /* end if */ else ret_value = obj; @@ -830,13 +832,13 @@ H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_c /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Wrap the object */ if (NULL == (ret_value = H5VL_wrap_object(cls, wrap_ctx, obj, obj_type))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -860,14 +862,14 @@ H5VL_unwrap_object(const H5VL_class_t *connector, void *obj) FUNC_ENTER_NOAPI(NULL) /* Sanity checks */ - HDassert(connector); - HDassert(obj); + assert(connector); + assert(obj); /* Only unwrap object if there's an unwrap callback */ if (connector->wrap_cls.wrap_object) { /* Ask the connector to unwrap the object */ if (NULL == (ret_value = (connector->wrap_cls.unwrap_object)(obj))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object"); } /* end if */ else ret_value = obj; @@ -897,13 +899,13 @@ H5VLunwrap_object(void *obj, hid_t connector_id) /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Unwrap the object */ if (NULL == (ret_value = H5VL_unwrap_object(cls, obj))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to unwrap object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to unwrap object"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -927,13 +929,13 @@ H5VL_free_wrap_ctx(const H5VL_class_t *connector, void *wrap_ctx) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(connector); + assert(connector); /* Only free wrap context, if it's non-NULL */ if (wrap_ctx) { /* Free the connector's object wrapping context */ if ((connector->wrap_cls.free_wrap_ctx)(wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "connector wrap context free request failed"); } /* end if */ done: @@ -961,11 +963,11 @@ H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id) /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Release the VOL connector's object wrapper */ if (H5VL_free_wrap_ctx(cls, wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -991,12 +993,12 @@ H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_cla /* Check if the corresponding VOL callback exists */ if (NULL == cls->attr_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr create' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr create' method"); /* Call the corresponding VOL callback */ if (NULL == (ret_value = (cls->attr_cls.create)(obj, loc_params, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1023,18 +1025,18 @@ H5VL_attr_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_para /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__attr_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "attribute create failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_create() */ @@ -1063,14 +1065,14 @@ H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_ /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1096,11 +1098,11 @@ H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class /* Check if the corresponding VOL callback exists */ if (NULL == cls->attr_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr open' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'attr open' method"); /* Call the corresponding VOL open callback */ if (NULL == (ret_value = (cls->attr_cls.open)(obj, loc_params, name, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1127,18 +1129,18 @@ H5VL_attr_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__attr_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "attribute open failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_open() */ @@ -1165,13 +1167,13 @@ H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open attribute") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open attribute"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1196,11 +1198,11 @@ H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf /* Check if the corresponding VOL callback exists */ if (NULL == cls->attr_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr read' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr read' method"); /* Call the corresponding VOL callback */ if ((cls->attr_cls.read)(obj, mem_type_id, buf, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed") + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1226,17 +1228,17 @@ H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, void *buf, hid_t /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__attr_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed") + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "attribute read failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_read() */ @@ -1262,13 +1264,13 @@ H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__attr_read(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute") + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1294,11 +1296,11 @@ H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const vo /* Check if the corresponding VOL callback exists */ if (NULL == cls->attr_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr write' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr write' method"); /* Call the corresponding VOL callback */ if ((cls->attr_cls.write)(obj, mem_type_id, buf, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1324,17 +1326,17 @@ H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, const void *buf /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__attr_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, buf, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed") + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "write failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_write() */ @@ -1361,13 +1363,13 @@ H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__attr_write(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute") + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1392,11 +1394,11 @@ H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_args_t *args, h /* Check if the corresponding VOL callback exists */ if (NULL == cls->attr_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr get' method"); /* Call the corresponding VOL callback */ if ((cls->attr_cls.get)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1422,17 +1424,17 @@ H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_args_t *args, hid_t dx /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_get() */ @@ -1458,15 +1460,15 @@ H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_args_t *args, hid_t dx /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); if (NULL == args) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument struct"); /* Call the corresponding internal VOL routine */ if (H5VL__attr_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1492,7 +1494,7 @@ H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c /* Check if the corresponding VOL callback exists */ if (NULL == cls->attr_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr specific' method"); /* Call the corresponding VOL callback */ /* (Must return value from callback, for iterators) */ @@ -1524,7 +1526,7 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ @@ -1536,7 +1538,7 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_specific() */ @@ -1563,9 +1565,9 @@ H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ /* (Must return value from callback, for iterators) */ @@ -1595,7 +1597,7 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *ar /* Check if the corresponding VOL callback exists */ if (NULL == cls->attr_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr optional' method"); /* Call the corresponding VOL callback */ /* (Must return value from callback, for iterators) */ @@ -1626,7 +1628,7 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ @@ -1637,7 +1639,7 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_attr_optional() */ @@ -1664,9 +1666,9 @@ H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ /* (Must return value from callback, for iterators) */ @@ -1706,7 +1708,7 @@ H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_li /* Call the common VOL connector optional routine */ if ((ret_value = H5VL__common_optional_op(attr_id, H5I_ATTR, H5VL__attr_optional, args, dxpl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -1714,7 +1716,7 @@ H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_li if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, attr_id, args, dxpl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -1739,11 +1741,11 @@ H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) /* Check if the corresponding VOL callback exists */ if (NULL == cls->attr_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr close' method"); /* Call the corresponding VOL callback */ if ((cls->attr_cls.close)(obj, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1767,11 +1769,11 @@ H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); + assert(vol_obj); /* Call the corresponding internal VOL routine */ if (H5VL__attr_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "attribute close failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1798,13 +1800,13 @@ H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__attr_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1831,12 +1833,12 @@ H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_ /* Check if the corresponding VOL callback exists */ if (NULL == cls->dataset_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset create' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset create' method"); /* Call the corresponding VOL callback */ if (NULL == (ret_value = (cls->dataset_cls.create)(obj, loc_params, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1864,19 +1866,19 @@ H5VL_dataset_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_p /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__dataset_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "dataset create failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_create() */ @@ -1905,14 +1907,14 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1938,11 +1940,11 @@ H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_cl /* Check if the corresponding VOL callback exists */ if (NULL == cls->dataset_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset open' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'dataset open' method"); /* Call the corresponding VOL callback */ if (NULL == (ret_value = (cls->dataset_cls.open)(obj, loc_params, name, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1969,18 +1971,18 @@ H5VL_dataset_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__dataset_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "dataset open failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_open() */ @@ -2007,22 +2009,22 @@ H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open dataset") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open dataset"); done: FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_open() */ /*------------------------------------------------------------------------- - * Function: H5VL__dataset_read + * Function: H5VL__dataset_read * - * Purpose: Reads data from dataset through the VOL + * Purpose: Reads data from dataset through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -2030,8 +2032,8 @@ H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t dxpl_id, void *buf, void **req) +H5VL__dataset_read(size_t count, void *obj[], const H5VL_class_t *cls, hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, void *buf[], void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2039,16 +2041,64 @@ H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t /* Check if the corresponding VOL callback exists */ if (NULL == cls->dataset_cls.read) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset read' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset read' method"); /* Call the corresponding VOL callback */ - if ((cls->dataset_cls.read)(obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed") + if ((cls->dataset_cls.read)(count, obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed"); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__dataset_read() */ +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_read_direct + * + * Purpose: Reads data from dataset through the VOL. This is like + * H5VL_dataset_read, but takes an array of void * for the + * objects and a class pointer instead of an array of + * H5VL_object_t. This allows us to avoid allocating and + * copying an extra array (of H5VL_object_ts). + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_read_direct(size_t count, void *obj[], H5VL_t *connector, hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, void *buf[], void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + H5VL_object_t tmp_vol_obj; /* Temporary VOL object for setting VOL wrapper */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + assert(obj); + assert(connector); + + /* Set wrapper info in API context */ + tmp_vol_obj.data = obj[0]; + tmp_vol_obj.connector = connector; + tmp_vol_obj.rc = 1; + if (H5VL_set_vol_wrapper(&tmp_vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_read(count, obj, connector->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, + req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed"); + +done: + /* Reset object wrapping info in API context */ + if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_read_direct() */ + /*------------------------------------------------------------------------- * Function: H5VL_dataset_read * @@ -2060,28 +2110,55 @@ H5VL__dataset_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t dxpl_id, void *buf, void **req) +H5VL_dataset_read(size_t count, const H5VL_object_t *vol_obj[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, void *buf[], void **req) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *obj_local; /* Local buffer for obj */ + void **obj = &obj_local; /* Array of object pointers */ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + assert(vol_obj); + assert(vol_obj[0]); + /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + if (H5VL_set_vol_wrapper(vol_obj[0]) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; + /* Allocate obj array if necessary */ + if (count > 1) + if (NULL == (obj = (void **)H5MM_malloc(count * sizeof(void *)))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate space for object array"); + + /* Build obj array */ + for (i = 0; i < count; i++) { + /* Get the object */ + obj[i] = vol_obj[i]->data; + + /* Make sure the class matches */ + if (vol_obj[i]->connector->cls->value != vol_obj[0]->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "datasets are accessed through different VOL connectors and can't be used in the " + "same I/O call"); + } + /* Call the corresponding internal VOL routine */ - if (H5VL__dataset_read(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, + if (H5VL__dataset_read(count, obj, vol_obj[0]->connector->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed") + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "dataset read failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); + + /* Free memory */ + if (obj != &obj_local) + H5MM_free(obj); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_read() */ @@ -2097,34 +2174,46 @@ H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_spa *------------------------------------------------------------------------- */ herr_t -H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t dxpl_id, void *buf, void **req /*out*/) +H5VLdataset_read(size_t count, void *obj[], hid_t connector_id, hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, void *buf[], void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ + size_t i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "*xiiiii*xx", obj, connector_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, - req); + H5TRACE9("e", "z**xi*i*i*ii**xx", count, obj, connector_id, mem_type_id, mem_space_id, file_space_id, + dxpl_id, buf, req); /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj array not provided"); + for (i = 1; i < count; i++) + if (NULL == obj[i]) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); + if (NULL == mem_type_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_type_id array not provided"); + if (NULL == mem_space_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_space_id array not provided"); + if (NULL == file_space_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_space_id array not provided"); + if (NULL == buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf array not provided"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ - if (H5VL__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") + if (H5VL__dataset_read(count, obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset"); done: FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLdataset_read() */ /*------------------------------------------------------------------------- - * Function: H5VL__dataset_write + * Function: H5VL__dataset_write * - * Purpose: Writes data from dataset through the VOL + * Purpose: Writes data from dataset through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -2132,8 +2221,8 @@ H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_spa *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req) +H5VL__dataset_write(size_t count, void *obj[], const H5VL_class_t *cls, hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, const void *buf[], void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2141,16 +2230,65 @@ H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t /* Check if the corresponding VOL callback exists */ if (NULL == cls->dataset_cls.write) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset write' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset write' method"); /* Call the corresponding VOL callback */ - if ((cls->dataset_cls.write)(obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed") + if ((cls->dataset_cls.write)(count, obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed"); done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__dataset_write() */ +/*------------------------------------------------------------------------- + * Function: H5VL_dataset_write_direct + * + * Purpose: Writes data from dataset through the VOL. This is like + * H5VL_dataset_write, but takes an array of void * for the + * objects and a class pointer instead of an array of + * H5VL_object_t. This allows us to avoid allocating and + * copying an extra array (of H5VL_object_ts). + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_dataset_write_direct(size_t count, void *obj[], H5VL_t *connector, hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, const void *buf[], + void **req) +{ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + H5VL_object_t tmp_vol_obj; /* Temporary VOL object for setting VOL wrapper */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + assert(obj); + assert(connector); + + /* Set wrapper info in API context */ + tmp_vol_obj.data = obj[0]; + tmp_vol_obj.connector = connector; + tmp_vol_obj.rc = 1; + if (H5VL_set_vol_wrapper(&tmp_vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_write(count, obj, connector->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, + buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed"); + +done: + /* Reset object wrapping info in API context */ + if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_dataset_write_direct() */ + /*------------------------------------------------------------------------- * Function: H5VL_dataset_write * @@ -2162,28 +2300,55 @@ H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t dxpl_id, const void *buf, void **req) +H5VL_dataset_write(size_t count, const H5VL_object_t *vol_obj[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, const void *buf[], void **req) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + void *obj_local; /* Local buffer for obj */ + void **obj = &obj_local; /* Array of object pointers */ + size_t i; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) + assert(vol_obj); + assert(vol_obj[0]); + /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + if (H5VL_set_vol_wrapper(vol_obj[0]) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; + /* Allocate obj array if necessary */ + if (count > 1) + if (NULL == (obj = (void **)H5MM_malloc(count * sizeof(void *)))) + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate space for object array"); + + /* Build obj array */ + for (i = 0; i < count; i++) { + /* Get the object */ + obj[i] = vol_obj[i]->data; + + /* Make sure the class matches */ + if (vol_obj[i]->connector->cls->value != vol_obj[0]->connector->cls->value) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, + "datasets are accessed through different VOL connectors and can't be used in the " + "same I/O call"); + } + /* Call the corresponding internal VOL routine */ - if (H5VL__dataset_write(vol_obj->data, vol_obj->connector->cls, mem_type_id, mem_space_id, file_space_id, + if (H5VL__dataset_write(count, obj, vol_obj[0]->connector->cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed") + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "dataset write failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); + + /* Free memory */ + if (obj != &obj_local) + H5MM_free(obj); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_write() */ @@ -2199,25 +2364,37 @@ H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_sp *------------------------------------------------------------------------- */ herr_t -H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t dxpl_id, const void *buf, void **req /*out*/) +H5VLdataset_write(size_t count, void *obj[], hid_t connector_id, hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, const void *buf[], void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ + size_t i; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE8("e", "*xiiiii*xx", obj, connector_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, - req); + H5TRACE9("e", "z**xi*i*i*ii**xx", count, obj, connector_id, mem_type_id, mem_space_id, file_space_id, + dxpl_id, buf, req); /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "obj array not provided"); + for (i = 1; i < count; i++) + if (NULL == obj[i]) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); + if (NULL == mem_type_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_type_id array not provided"); + if (NULL == mem_space_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "mem_space_id array not provided"); + if (NULL == file_space_id) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "file_space_id array not provided"); + if (NULL == buf) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "buf array not provided"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ - if (H5VL__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") + if (H5VL__dataset_write(count, obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2243,11 +2420,11 @@ H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_args_t *a /* Check if the corresponding VOL callback exists */ if (NULL == cls->dataset_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset get' method"); /* Call the corresponding VOL callback */ if ((cls->dataset_cls.get)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2273,17 +2450,17 @@ H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_args_t *args, hi /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_get() */ @@ -2310,13 +2487,13 @@ H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_args_t *args, hi /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__dataset_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2342,11 +2519,11 @@ H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific /* Check if the corresponding VOL callback exists */ if (NULL == cls->dataset_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset specific' method"); /* Call the corresponding VOL callback */ if ((cls->dataset_cls.specific)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2373,17 +2550,17 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_args_t /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_specific() */ @@ -2410,13 +2587,13 @@ H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__dataset_specific(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2442,11 +2619,11 @@ H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t /* Check if the corresponding VOL callback exists */ if (NULL == cls->dataset_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset optional' method"); /* Call the corresponding VOL callback */ if ((cls->dataset_cls.optional)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2472,17 +2649,17 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_optional() */ @@ -2509,13 +2686,13 @@ H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__dataset_optional(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2550,7 +2727,7 @@ H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app /* Call the corresponding internal VOL routine */ if (H5VL__common_optional_op(dset_id, H5I_DATASET, H5VL__dataset_optional, args, dxpl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -2558,7 +2735,7 @@ H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, dset_id, args, dxpl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -2582,16 +2759,16 @@ H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **re FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(obj); - HDassert(cls); + assert(obj); + assert(cls); /* Check if the corresponding VOL callback exists */ if (NULL == cls->dataset_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset close' method"); /* Call the corresponding VOL callback */ if ((cls->dataset_cls.close)(obj, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2616,24 +2793,24 @@ H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); - HDassert(vol_obj->data); - HDassert(vol_obj->connector); - HDassert(vol_obj->connector->cls); + assert(vol_obj); + assert(vol_obj->data); + assert(vol_obj->connector); + assert(vol_obj->connector->cls); /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__dataset_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "dataset close failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_dataset_close() */ @@ -2659,13 +2836,13 @@ H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__dataset_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2692,12 +2869,12 @@ H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const H5VL /* Check if the corresponding VOL callback exists */ if (NULL == cls->datatype_cls.commit) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'datatype commit' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'datatype commit' method"); /* Call the corresponding VOL callback */ if (NULL == (ret_value = (cls->datatype_cls.commit)(obj, loc_params, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2724,18 +2901,18 @@ H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_ /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__datatype_commit(vol_obj->data, loc_params, vol_obj->connector->cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "datatype commit failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_commit() */ @@ -2764,14 +2941,14 @@ H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2797,11 +2974,11 @@ H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c /* Check if the corresponding VOL callback exists */ if (NULL == cls->datatype_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "no datatype open callback"); /* Call the corresponding VOL callback */ if (NULL == (ret_value = (cls->datatype_cls.open)(obj, loc_params, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2828,18 +3005,18 @@ H5VL_datatype_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__datatype_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "datatype open failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_open() */ @@ -2866,13 +3043,13 @@ H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2898,11 +3075,11 @@ H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_args_t /* Check if the corresponding VOL callback exists */ if (NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method"); /* Call the corresponding VOL callback */ if ((cls->datatype_cls.get)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype 'get' failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype 'get' failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2928,17 +3105,17 @@ H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_args_t *args, /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_get() */ @@ -2965,13 +3142,13 @@ H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_args_t *args, /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__datatype_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -2997,11 +3174,11 @@ H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specif /* Check if the corresponding VOL callback exists */ if (NULL == cls->datatype_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method"); /* Call the corresponding VOL callback */ if ((cls->datatype_cls.specific)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3028,17 +3205,17 @@ H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_args /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_specific() */ @@ -3065,13 +3242,13 @@ H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_args /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__datatype_specific(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3097,11 +3274,11 @@ H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t /* Check if the corresponding VOL callback exists */ if (NULL == cls->datatype_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method"); /* Call the corresponding VOL callback */ if ((cls->datatype_cls.optional)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3127,17 +3304,17 @@ H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_optional() */ @@ -3164,24 +3341,24 @@ H5VL_datatype_optional_op(H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hi FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); + assert(vol_obj); /* Set up vol_obj_ptr */ *vol_obj_ptr = vol_obj; /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(*vol_obj_ptr) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__datatype_optional((*vol_obj_ptr)->data, (*vol_obj_ptr)->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_optional_op() */ @@ -3208,13 +3385,13 @@ H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__datatype_optional(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3245,7 +3422,7 @@ H5VLdatatype_optional_op(const char *app_file, const char *app_func, unsigned ap /* Check args */ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) @@ -3253,7 +3430,7 @@ H5VLdatatype_optional_op(const char *app_file, const char *app_func, unsigned ap /* Only invoke callback if VOL object is set for the datatype */ if (H5T_invoke_vol_optional(dt, args, dxpl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to invoke datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to invoke datatype optional callback"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -3261,7 +3438,7 @@ H5VLdatatype_optional_op(const char *app_file, const char *app_func, unsigned ap if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, type_id, args, dxpl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -3286,11 +3463,11 @@ H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **r /* Check if the corresponding VOL callback exists */ if (NULL == cls->datatype_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype close' method"); /* Call the corresponding VOL callback */ if ((cls->datatype_cls.close)(obj, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3316,17 +3493,17 @@ H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__datatype_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "datatype close failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_datatype_close() */ @@ -3352,13 +3529,13 @@ H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*ou /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__datatype_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3387,11 +3564,11 @@ H5VL__file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid /* Check if the corresponding VOL callback exists */ if (NULL == cls->file_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file create' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file create' method"); /* Call the corresponding VOL callback */ if (NULL == (ret_value = (cls->file_cls.create)(name, flags, fcpl_id, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3421,11 +3598,11 @@ H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, /* Get the connector's class */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3455,17 +3632,17 @@ H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info"); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create file") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create file"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3491,11 +3668,11 @@ H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t /* Check if the corresponding VOL callback exists */ if (NULL == cls->file_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file open' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'file open' method"); /* Call the corresponding VOL callback */ if (NULL == (ret_value = (cls->file_cls.open)(name, flags, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3535,11 +3712,11 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in FUNC_ENTER_PACKAGE - HDassert(udata); - HDassert(udata->filename); - HDassert(udata->connector_prop); - HDassert(cls); - HDassert(plugin_type == H5PL_TYPE_VOL); + assert(udata); + assert(udata->filename); + assert(udata->connector_prop); + assert(cls); + assert(plugin_type == H5PL_TYPE_VOL); /* Silence compiler */ (void)plugin_type; @@ -3548,17 +3725,17 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in /* Attempt to register plugin as a VOL connector */ if ((connector_id = H5VL__register_connector_by_class(cls, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5_ITER_ERROR, "unable to register VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5_ITER_ERROR, "unable to register VOL connector"); /* Setup FAPL with registered VOL connector */ if (NULL == (fapl_plist = (H5P_genplist_t *)H5I_object_verify(udata->fapl_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "not a property list"); if ((fapl_id = H5P_copy_plist(fapl_plist, TRUE)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, H5_ITER_ERROR, "can't copy fapl"); if (NULL == (fapl_plist_copy = (H5P_genplist_t *)H5I_object_verify(fapl_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "not a property list"); if (H5P_set_vol(fapl_plist_copy, connector_id, NULL) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5_ITER_ERROR, "can't set VOL connector on fapl") + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5_ITER_ERROR, "can't set VOL connector on fapl"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE; @@ -3568,25 +3745,25 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in /* Store current error stack size */ if ((num_errors = H5Eget_num(H5E_DEFAULT)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, H5_ITER_ERROR, "can't get current error stack size") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, H5_ITER_ERROR, "can't get current error stack size"); /* Check if file is accessible with given VOL connector */ H5E_BEGIN_TRY { status = H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL); } - H5E_END_TRY; + H5E_END_TRY if (status < 0) { ssize_t new_num_errors = 0; /* Pop any errors generated by the above call */ if ((new_num_errors = H5Eget_num(H5E_DEFAULT)) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, H5_ITER_ERROR, "can't get current error stack size") + HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, H5_ITER_ERROR, "can't get current error stack size"); if (new_num_errors > num_errors) { new_num_errors -= num_errors; if (H5Epop(H5E_DEFAULT, (size_t)new_num_errors) < 0) - HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't sanitize error stack") + HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't sanitize error stack"); } } else if (status == SUCCEED && is_accessible) { @@ -3608,9 +3785,9 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in done: if (ret_value != H5_ITER_STOP) { if (fapl_id >= 0 && H5I_dec_app_ref(fapl_id) < 0) - HDONE_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "can't close fapl") + HDONE_ERROR(H5E_PLIST, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "can't close fapl"); if (connector_id >= 0 && H5I_dec_app_ref(connector_id) < 0) - HDONE_ERROR(H5E_ID, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "can't close VOL connector ID") + HDONE_ERROR(H5E_ID, H5E_CANTCLOSEOBJ, H5_ITER_ERROR, "can't close VOL connector ID"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -3640,7 +3817,7 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned /* Get the connector's class */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) { @@ -3666,7 +3843,7 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned (void *)&find_connector_ud); if (iter_ret < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, NULL, - "failed to iterate over available VOL connector plugins") + "failed to iterate over available VOL connector plugins"); else if (iter_ret) { /* If one of the available VOL connector plugins is * able to open the file, clear the error stack from any @@ -3680,13 +3857,13 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned find_connector_ud.fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "can't open file '%s' with VOL connector '%s'", name, - find_connector_ud.cls->name) + find_connector_ud.cls->name); } else - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed"); } /* end if */ else - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed"); } /* end if */ done: @@ -3716,17 +3893,17 @@ H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, vo /* Get the VOL info from the fapl */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list"); if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info"); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open file") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open file"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3751,11 +3928,11 @@ H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_args_t *args, h /* Check if the corresponding VOL callback exists */ if (NULL == cls->file_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file get' method"); /* Call the corresponding VOL callback */ if ((cls->file_cls.get)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3781,17 +3958,17 @@ H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_args_t *args, hid_t dx /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__file_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_get() */ @@ -3817,13 +3994,13 @@ H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dx /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__file_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3849,11 +4026,11 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_args_ /* Check if the corresponding VOL callback exists */ if (NULL == cls->file_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method"); /* Call the corresponding VOL callback */ if ((cls->file_cls.specific)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3889,27 +4066,27 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args if (args->op_type == H5VL_FILE_IS_ACCESSIBLE) fapl_id = args->args.is_accessible.fapl_id; else { - HDassert(args->op_type == H5VL_FILE_DELETE); + assert(args->op_type == H5VL_FILE_DELETE); fapl_id = args->args.del.fapl_id; } /* Get the VOL info from the FAPL */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list"); if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info"); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID"); } /* end if */ /* Set wrapper info in API context, for all other operations */ else { /* Sanity check */ - HDassert(vol_obj); + assert(vol_obj); if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Set the VOL connector class pointer */ @@ -3918,12 +4095,12 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args /* Call the corresponding internal VOL routine */ if (H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_specific() */ @@ -3952,11 +4129,11 @@ H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_args_t *args /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__file_specific(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -3981,11 +4158,11 @@ H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *ar /* Check if the corresponding VOL callback exists */ if (NULL == cls->file_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file optional' method"); /* Call the corresponding VOL callback */ if ((cls->file_cls.optional)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4011,17 +4188,17 @@ H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_optional() */ @@ -4048,13 +4225,13 @@ H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__file_optional(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4089,7 +4266,7 @@ H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_li /* Call the corresponding internal VOL routine */ if (H5VL__common_optional_op(file_id, H5I_FILE, H5VL__file_optional, args, dxpl_id, token_ptr, &vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -4097,7 +4274,7 @@ H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_li if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, file_id, args, dxpl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -4121,16 +4298,16 @@ H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(obj); - HDassert(cls); + assert(obj); + assert(cls); /* Check if the corresponding VOL callback exists */ if (NULL == cls->file_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file close' method"); /* Call the corresponding VOL callback */ if ((cls->file_cls.close)(obj, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4156,17 +4333,17 @@ H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__file_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "file close failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_close() */ @@ -4192,13 +4369,13 @@ H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__file_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4224,12 +4401,12 @@ H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_cl /* Check if the corresponding VOL callback exists */ if (NULL == cls->group_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group create' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group create' method"); /* Call the corresponding VOL callback */ if (NULL == (ret_value = (cls->group_cls.create)(obj, loc_params, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4256,18 +4433,18 @@ H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_par /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__group_create(vol_obj->data, loc_params, vol_obj->connector->cls, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "group create failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_create() */ @@ -4295,14 +4472,14 @@ H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__group_create(obj, loc_params, cls, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4328,11 +4505,11 @@ H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_clas /* Check if the corresponding VOL callback exists */ if (NULL == cls->group_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group open' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'group open' method"); /* Call the corresponding VOL callback */ if (NULL == (ret_value = (cls->group_cls.open)(obj, loc_params, name, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4359,18 +4536,18 @@ H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__group_open(vol_obj->data, loc_params, vol_obj->connector->cls, name, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "group open failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_open() */ @@ -4397,13 +4574,13 @@ H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4428,11 +4605,11 @@ H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_args_t *args, /* Check if the corresponding VOL callback exists */ if (NULL == cls->group_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group get' method"); /* Call the corresponding VOL callback */ if ((cls->group_cls.get)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4458,17 +4635,17 @@ H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_args_t *args, hid_t /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__group_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_get() */ @@ -4494,13 +4671,13 @@ H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__group_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4526,11 +4703,11 @@ H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_arg /* Check if the corresponding VOL callback exists */ if (NULL == cls->group_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group specific' method"); /* Call the corresponding VOL callback */ if ((cls->group_cls.specific)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4556,17 +4733,17 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_args_t *ar /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_specific() */ @@ -4593,13 +4770,13 @@ H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *ar /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__group_specific(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4625,7 +4802,7 @@ H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *a /* Check if the corresponding VOL callback exists */ if (NULL == cls->group_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method"); /* Call the corresponding VOL callback */ /* (Must return value from callback, for iterators) */ @@ -4656,7 +4833,7 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hi /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ @@ -4667,7 +4844,7 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hi done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_optional() */ @@ -4694,9 +4871,9 @@ H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hi /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ /* (Must return value from callback, for iterators) */ @@ -4736,7 +4913,7 @@ H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_l /* Call the corresponding internal VOL routine */ if ((ret_value = H5VL__common_optional_op(group_id, H5I_GROUP, H5VL__group_optional, args, dxpl_id, token_ptr, &vol_obj)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback"); /* If a token was created, add the token to the event set */ if (NULL != token) @@ -4744,7 +4921,7 @@ H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_l if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, group_id, args, dxpl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: FUNC_LEAVE_API(ret_value) @@ -4766,18 +4943,18 @@ H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req) herr_t ret_value = SUCCEED; /* Return value */ /* Sanity check */ - HDassert(obj); - HDassert(cls); + assert(obj); + assert(cls); FUNC_ENTER_PACKAGE /* Check if the corresponding VOL callback exists */ if (NULL == cls->group_cls.close) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group close' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group close' method"); /* Call the corresponding VOL callback */ if ((cls->group_cls.close)(obj, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4803,17 +4980,17 @@ H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req) /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__group_close(vol_obj->data, vol_obj->connector->cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "group close failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_group_close() */ @@ -4839,13 +5016,13 @@ H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/ /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__group_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4873,11 +5050,11 @@ H5VL__link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_param /* Check if the corresponding VOL callback exists */ if (NULL == cls->link_cls.create) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method"); /* Call the corresponding VOL callback */ if ((cls->link_cls.create)(args, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4914,18 +5091,18 @@ H5VL_link_create(H5VL_link_create_args_t *args, const H5VL_object_t *vol_obj, /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(&tmp_vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__link_create(args, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_create() */ @@ -4954,11 +5131,11 @@ H5VLlink_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_ /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__link_create(args, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -4985,11 +5162,11 @@ H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_o /* Check if the corresponding VOL callback exists */ if (NULL == cls->link_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link copy' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link copy' method"); /* Call the corresponding VOL callback */ if ((cls->link_cls.copy)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5019,18 +5196,18 @@ H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa /* Set wrapper info in API context */ vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj); if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__link_copy(src_vol_obj->data, loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_copy() */ @@ -5061,11 +5238,11 @@ H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__link_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -5092,11 +5269,11 @@ H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_o /* Check if the corresponding VOL callback exists */ if (NULL == cls->link_cls.move) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link move' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link move' method"); /* Call the corresponding VOL callback */ if ((cls->link_cls.move)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5126,18 +5303,18 @@ H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa /* Set wrapper info in API context */ vol_obj = (src_vol_obj->data ? src_vol_obj : dst_vol_obj); if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__link_move(src_vol_obj->data, loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_move() */ @@ -5168,11 +5345,11 @@ H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__link_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object") + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -5198,11 +5375,11 @@ H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_ /* Check if the corresponding VOL callback exists */ if (NULL == cls->link_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link get' method"); /* Call the corresponding VOL callback */ if ((cls->link_cls.get)(obj, loc_params, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5229,17 +5406,17 @@ H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_get() */ @@ -5266,13 +5443,13 @@ H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__link_get(obj, loc_params, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -5298,7 +5475,7 @@ H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c /* Check if the corresponding VOL callback exists */ if (NULL == cls->link_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link specific' method"); /* Call the corresponding VOL callback */ /* (Must return value from callback, for iterators) */ @@ -5330,7 +5507,7 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ @@ -5342,7 +5519,7 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_specific() */ @@ -5369,9 +5546,9 @@ H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ /* (Must return value from callback, for iterators) */ @@ -5402,11 +5579,11 @@ H5VL__link_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c /* Check if the corresponding VOL callback exists */ if (NULL == cls->link_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link optional' method"); /* Call the corresponding VOL callback */ if ((cls->link_cls.optional)(obj, loc_params, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5433,17 +5610,17 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__link_optional(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_link_optional() */ @@ -5470,13 +5647,13 @@ H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__link_optional(obj, loc_params, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -5512,7 +5689,7 @@ H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_li /* Set up object access arguments */ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, &vol_obj, &loc_params) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set link access arguments") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set link access arguments"); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) @@ -5520,25 +5697,25 @@ H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_li /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__link_optional(vol_obj->data, &loc_params, vol_obj->connector->cls, args, dxpl_id, token_ptr) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback"); /* If a token was created, add the token to the event set */ if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(__func__, "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_API(ret_value) } /* end H5VLlink_optional_op() */ @@ -5563,11 +5740,11 @@ H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t /* Check if the corresponding VOL callback exists */ if (NULL == cls->object_cls.open) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'object open' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'object open' method"); /* Call the corresponding VOL callback */ if (NULL == (ret_value = (cls->object_cls.open)(obj, params, opened_type, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5594,18 +5771,18 @@ H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__object_open(vol_obj->data, params, vol_obj->connector->cls, opened_type, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, NULL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_open() */ @@ -5632,13 +5809,13 @@ H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__object_open(obj, params, cls, opened_type, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open object") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open object"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -5665,12 +5842,12 @@ H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const /* Check if the corresponding VOL callback exists */ if (NULL == cls->object_cls.copy) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object copy' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object copy' method"); /* Call the corresponding VOL callback */ if ((cls->object_cls.copy)(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, ocpypl_id, lcpl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5699,22 +5876,22 @@ H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_ /* Make sure that the VOL connectors are the same */ if (src_obj->connector->cls->value != dst_obj->connector->cls->value) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "objects are accessed through different VOL connectors and can't be copied") + "objects are accessed through different VOL connectors and can't be copied"); /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(src_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__object_copy(src_obj->data, src_loc_params, src_name, dst_obj->data, dst_loc_params, dst_name, src_obj->connector->cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "object copy failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_copy() */ @@ -5743,14 +5920,14 @@ H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const ch /* Check args and get class pointers */ if (NULL == src_obj || NULL == dst_obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__object_copy(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, cls, ocpypl_id, lcpl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -5776,11 +5953,11 @@ H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_clas /* Check if the corresponding VOL callback exists */ if (NULL == cls->object_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object get' method"); /* Call the corresponding VOL callback */ if ((cls->object_cls.get)(obj, loc_params, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5807,17 +5984,17 @@ H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_get() */ @@ -5844,13 +6021,13 @@ H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__object_get(obj, loc_params, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -5876,7 +6053,7 @@ H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL /* Check if the corresponding VOL callback exists */ if (NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object specific' method"); /* Call the corresponding VOL callback */ /* (Must return value from callback, for iterators) */ @@ -5908,7 +6085,7 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_ /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ @@ -5920,7 +6097,7 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_ done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_specific() */ @@ -5947,9 +6124,9 @@ H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Bypass the H5VLint layer, calling the VOL callback directly */ /* (Must return value from callback, for iterators) */ @@ -5980,11 +6157,11 @@ H5VL__object_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL /* Check if the corresponding VOL callback exists */ if (NULL == cls->object_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object optional' method"); /* Call the corresponding VOL callback */ if ((cls->object_cls.optional)(obj, loc_params, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6011,17 +6188,17 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_ /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__object_optional(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_object_optional() */ @@ -6048,13 +6225,13 @@ H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__object_optional(obj, loc_params, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -6091,7 +6268,7 @@ H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_ /* Set up object access arguments */ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, &vol_obj, &loc_params) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set link access arguments") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set link access arguments"); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) @@ -6099,25 +6276,25 @@ H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_ /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__object_optional(vol_obj->data, &loc_params, vol_obj->connector->cls, args, dxpl_id, token_ptr) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback"); /* If a token was created, add the token to the event set */ if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(__func__, "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id, es_id)) < 0) /* clang-format on */ - HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_API(ret_value) } /* end H5VLobject_optional_op() */ @@ -6142,18 +6319,18 @@ H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls, H5VL_get_conn_ FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(obj); - HDassert(cls); - HDassert(lvl >= H5VL_GET_CONN_LVL_CURR && lvl <= H5VL_GET_CONN_LVL_TERM); - HDassert(conn_cls); + assert(obj); + assert(cls); + assert(lvl >= H5VL_GET_CONN_LVL_CURR && lvl <= H5VL_GET_CONN_LVL_TERM); + assert(conn_cls); /* Check if the corresponding VOL callback exists */ if (NULL == cls->introspect_cls.get_conn_cls) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'get_conn_cls' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'get_conn_cls' method"); /* Call the corresponding VOL callback */ if ((cls->introspect_cls.get_conn_cls)(obj, lvl, conn_cls) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6181,17 +6358,17 @@ H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t l /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__introspect_get_conn_cls(vol_obj->data, vol_obj->connector->cls, lvl, conn_cls) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_introspect_get_conn_cls() */ @@ -6219,17 +6396,17 @@ H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t l /* Check args */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL obj pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL obj pointer"); if (NULL == conn_cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL conn_cls pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL conn_cls pointer"); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__introspect_get_conn_cls(obj, cls, lvl, conn_cls) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -6247,23 +6424,23 @@ H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t l *------------------------------------------------------------------------- */ herr_t -H5VL_introspect_get_cap_flags(const void *info, const H5VL_class_t *cls, unsigned *cap_flags) +H5VL_introspect_get_cap_flags(const void *info, const H5VL_class_t *cls, uint64_t *cap_flags) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(cls); - HDassert(cap_flags); + assert(cls); + assert(cap_flags); /* Check if the corresponding VOL callback exists */ if (NULL == cls->introspect_cls.get_cap_flags) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'get_cap_flags' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'get_cap_flags' method"); /* Call the corresponding VOL callback */ if ((cls->introspect_cls.get_cap_flags)(info, cap_flags) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector capability flags") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector capability flags"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6281,7 +6458,7 @@ H5VL_introspect_get_cap_flags(const void *info, const H5VL_class_t *cls, unsigne *------------------------------------------------------------------------- */ herr_t -H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap_flags /*out*/) +H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, uint64_t *cap_flags /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ @@ -6291,15 +6468,15 @@ H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap /* Check args */ if (NULL == cap_flags) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL conn_cls pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL conn_cls pointer"); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL_introspect_get_cap_flags(info, cls, cap_flags) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -6326,11 +6503,11 @@ H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t s /* Check if the corresponding VOL callback exists */ if (NULL == cls->introspect_cls.opt_query) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'opt_query' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'opt_query' method"); /* Call the corresponding VOL callback */ if ((cls->introspect_cls.opt_query)(obj, subcls, opt_type, flags) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6357,17 +6534,17 @@ H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__introspect_opt_query(vol_obj->data, vol_obj->connector->cls, subcls, opt_type, flags) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_introspect_opt_query() */ @@ -6395,11 +6572,11 @@ H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__introspect_opt_query(obj, cls, subcls, opt_type, flags) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -6423,17 +6600,17 @@ H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t timeout, H5VL_re FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(req); - HDassert(cls); - HDassert(status); + assert(req); + assert(cls); + assert(status); /* Check if the corresponding VOL callback exists */ if (NULL == cls->request_cls.wait) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async wait' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async wait' method"); /* Call the corresponding VOL callback */ if ((cls->request_cls.wait)(req, timeout, status) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6458,21 +6635,21 @@ H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5VL_request_s FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(vol_obj); + assert(vol_obj); /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__request_wait(vol_obj->data, vol_obj->connector->cls, timeout, status) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_wait() */ @@ -6498,11 +6675,11 @@ H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5VL_request_s /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__request_wait(req, cls, timeout, status) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -6527,16 +6704,16 @@ H5VL__request_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t c FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(req); - HDassert(cls); + assert(req); + assert(cls); /* Check if the corresponding VOL callback exists */ if (NULL == cls->request_cls.notify) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async notify' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async notify' method"); /* Call the corresponding VOL callback */ if ((cls->request_cls.notify)(req, cb, ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request notify failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request notify failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6562,21 +6739,21 @@ H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, void FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); + assert(vol_obj); /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__request_notify(vol_obj->data, vol_obj->connector->cls, cb, ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "request notify failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "request notify failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_notify() */ @@ -6603,11 +6780,11 @@ H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__request_notify(req, cls, cb, ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to register notify callback for request") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to register notify callback for request"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -6631,16 +6808,16 @@ H5VL__request_cancel(void *req, const H5VL_class_t *cls, H5VL_request_status_t * FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(req); - HDassert(cls); + assert(req); + assert(cls); /* Check if the corresponding VOL callback exists */ if (NULL == cls->request_cls.cancel) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async cancel' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async cancel' method"); /* Call the corresponding VOL callback */ if ((cls->request_cls.cancel)(req, status) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6665,21 +6842,21 @@ H5VL_request_cancel(const H5VL_object_t *vol_obj, H5VL_request_status_t *status) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); + assert(vol_obj); /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls, status) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_cancel() */ @@ -6705,11 +6882,11 @@ H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__request_cancel(req, cls, status) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -6733,17 +6910,17 @@ H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(req); - HDassert(cls); + assert(req); + assert(cls); /* Check if the corresponding VOL callback exists */ if (NULL == cls->request_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async specific' method"); /* Call the corresponding VOL callback */ if ((cls->request_cls.specific)(req, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request specific callback") + "unable to execute asynchronous request specific callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6768,22 +6945,22 @@ H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_args_t FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); + assert(vol_obj); /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request specific callback") + "unable to execute asynchronous request specific callback"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_specific() */ @@ -6809,12 +6986,12 @@ H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__request_specific(req, cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request specific callback") + "unable to execute asynchronous request specific callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -6838,17 +7015,17 @@ H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_optional_args_t FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(req); - HDassert(cls); + assert(req); + assert(cls); /* Check if the corresponding VOL callback exists */ if (NULL == cls->request_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async optional' method"); /* Call the corresponding VOL callback */ if ((cls->request_cls.optional)(req, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request optional callback") + "unable to execute asynchronous request optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6873,22 +7050,22 @@ H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); + assert(vol_obj); /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ if (H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request optional callback") + "unable to execute asynchronous request optional callback"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_optional() */ @@ -6914,12 +7091,12 @@ H5VLrequest_optional(void *req, hid_t connector_id, H5VL_optional_args_t *args) /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__request_optional(req, cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request optional callback") + "unable to execute asynchronous request optional callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -6946,17 +7123,17 @@ H5VLrequest_optional_op(void *req, hid_t connector_id, H5VL_optional_args_t *arg /* Check arguments */ if (NULL == req) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request"); if (NULL == args) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments"); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__request_optional(req, cls, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute request optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute request optional callback"); done: FUNC_LEAVE_API(ret_value) @@ -6980,16 +7157,16 @@ H5VL__request_free(void *req, const H5VL_class_t *cls) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(req); - HDassert(cls); + assert(req); + assert(cls); /* Check if the corresponding VOL callback exists */ if (NULL == cls->request_cls.free) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async free' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async free' method"); /* Call the corresponding VOL callback */ if ((cls->request_cls.free)(req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7014,21 +7191,21 @@ H5VL_request_free(const H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); + assert(vol_obj); /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding VOL callback */ if (H5VL__request_free(vol_obj->data, vol_obj->connector->cls) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed"); done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_free() */ @@ -7054,11 +7231,11 @@ H5VLrequest_free(void *req, hid_t connector_id) /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if (H5VL__request_free(req, cls) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -7081,18 +7258,18 @@ H5VL__blob_put(void *obj, const H5VL_class_t *cls, const void *buf, size_t size, FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(obj); - HDassert(cls); - HDassert(size == 0 || buf); - HDassert(blob_id); + assert(obj); + assert(cls); + assert(size == 0 || buf); + assert(blob_id); /* Check if the corresponding VOL callback exists */ if (NULL == cls->blob_cls.put) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob put' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob put' method"); /* Call the corresponding VOL callback */ if ((cls->blob_cls.put)(obj, buf, size, blob_id, ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put callback failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put callback failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7105,9 +7282,6 @@ H5VL__blob_put(void *obj, const H5VL_class_t *cls, const void *buf, size_t size, * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Wednesday, August 21, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -7118,13 +7292,13 @@ H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void * FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); - HDassert(size == 0 || buf); - HDassert(blob_id); + assert(vol_obj); + assert(size == 0 || buf); + assert(blob_id); /* Call the corresponding VOL callback */ if (H5VL__blob_put(vol_obj->data, vol_obj->connector->cls, buf, size, blob_id, ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7150,13 +7324,13 @@ H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size, void * /* Get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding VOL callback */ if (H5VL__blob_put(obj, cls, buf, size, blob_id, ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -7179,18 +7353,18 @@ H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id, void *bu FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(obj); - HDassert(cls); - HDassert(blob_id); - HDassert(buf); + assert(obj); + assert(cls); + assert(blob_id); + assert(buf); /* Check if the corresponding VOL callback exists */ if (NULL == cls->blob_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob get' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob get' method"); /* Call the corresponding VOL callback */ if ((cls->blob_cls.get)(obj, blob_id, buf, size, ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get callback failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get callback failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7213,13 +7387,13 @@ H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); - HDassert(blob_id); - HDassert(buf); + assert(vol_obj); + assert(blob_id); + assert(buf); /* Call the corresponding VOL callback */ if (H5VL__blob_get(vol_obj->data, vol_obj->connector->cls, blob_id, buf, size, ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7245,13 +7419,13 @@ H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf /*out /* Get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding VOL callback */ if (H5VL__blob_get(obj, cls, blob_id, buf, size, ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -7264,9 +7438,6 @@ H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf /*out * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Saturday, August 17, 2019 - * *------------------------------------------------------------------------- */ static herr_t @@ -7277,17 +7448,17 @@ H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(obj); - HDassert(cls); - HDassert(blob_id); + assert(obj); + assert(cls); + assert(blob_id); /* Check if the corresponding VOL callback exists */ if (NULL == cls->blob_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob specific' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob specific' method"); /* Call the corresponding VOL callback */ if ((cls->blob_cls.specific)(obj, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7311,12 +7482,12 @@ H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specif FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); - HDassert(blob_id); + assert(vol_obj); + assert(blob_id); /* Call the corresponding internal VOL routine */ if (H5VL__blob_specific(vol_obj->data, vol_obj->connector->cls, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7342,13 +7513,13 @@ H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specif /* Get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding VOL callback */ if (H5VL__blob_specific(obj, cls, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob specific operation failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob specific operation failed"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -7361,9 +7532,6 @@ H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specif * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Thursday, November 14, 2019 - * *------------------------------------------------------------------------- */ static herr_t @@ -7374,17 +7542,17 @@ H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_opti FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(obj); - HDassert(cls); - HDassert(blob_id); + assert(obj); + assert(cls); + assert(blob_id); /* Check if the corresponding VOL callback exists */ if (NULL == cls->blob_cls.optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob optional' method"); /* Call the corresponding VOL callback */ if ((cls->blob_cls.optional)(obj, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7408,12 +7576,12 @@ H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_optional_ar FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); - HDassert(blob_id); + assert(vol_obj); + assert(blob_id); /* Call the corresponding internal VOL routine */ if (H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7439,13 +7607,13 @@ H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_optional_ar /* Get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding VOL callback */ if (H5VL__blob_optional(obj, cls, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob optional operation failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob optional operation failed"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -7473,9 +7641,9 @@ H5VL__token_cmp(void *obj, const H5VL_class_t *cls, const H5O_token_t *token1, c FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(obj); - HDassert(cls); - HDassert(cmp_value); + assert(obj); + assert(cls); + assert(cmp_value); /* Take care of cases where one or both pointers is NULL */ if (token1 == NULL && token2 != NULL) @@ -7491,10 +7659,10 @@ H5VL__token_cmp(void *obj, const H5VL_class_t *cls, const H5O_token_t *token1, c */ if (cls->token_cls.cmp) { if ((cls->token_cls.cmp)(obj, token1, token2, cmp_value) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare object tokens") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare object tokens"); } /* end if */ else - *cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t)); + *cmp_value = memcmp(token1, token2, sizeof(H5O_token_t)); } /* end else */ done: @@ -7523,12 +7691,12 @@ H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, const H5 FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(vol_obj); - HDassert(cmp_value); + assert(vol_obj); + assert(cmp_value); /* Call the corresponding internal VOL routine */ if (H5VL__token_cmp(vol_obj->data, vol_obj->connector->cls, token1, token2, cmp_value) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "token compare failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "token compare failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7561,15 +7729,15 @@ H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1, const H5 /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); if (NULL == cmp_value) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid cmp_value pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid cmp_value pointer"); /* Call the corresponding internal VOL routine */ if (H5VL__token_cmp(obj, cls, token1, token2, cmp_value) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "object token comparison failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "object token comparison failed"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -7594,17 +7762,17 @@ H5VL__token_to_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, cons FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(obj); - HDassert(cls); - HDassert(token); - HDassert(token_str); + assert(obj); + assert(cls); + assert(token); + assert(token_str); /* Use the class's token serialization routine on the token if there is a * callback, otherwise just set the token_str to NULL. */ if (cls->token_cls.to_str) { if ((cls->token_cls.to_str)(obj, obj_type, token, token_str) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize object token") + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "can't serialize object token"); } /* end if */ else *token_str = NULL; @@ -7632,13 +7800,13 @@ H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const H5O_t FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(vol_obj); - HDassert(token); - HDassert(token_str); + assert(vol_obj); + assert(token); + assert(token_str); /* Call the corresponding internal VOL routine */ if (H5VL__token_to_str(vol_obj->data, obj_type, vol_obj->connector->cls, token, token_str) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "token serialization failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "token serialization failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7666,17 +7834,17 @@ H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const H5O_t /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); if (NULL == token) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer"); if (NULL == token_str) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token_str pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token_str pointer"); /* Call the corresponding internal VOL routine */ if (H5VL__token_to_str(obj, obj_type, cls, token, token_str) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "object token to string failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "object token to string failed"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -7701,17 +7869,17 @@ H5VL__token_from_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, co FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(obj); - HDassert(cls); - HDassert(token_str); - HDassert(token); + assert(obj); + assert(cls); + assert(token_str); + assert(token); /* Use the class's token deserialization routine on the token if there is a * callback, otherwise just set the token to H5_TOKEN_UNDEF. */ if (cls->token_cls.from_str) { if ((cls->token_cls.from_str)(obj, obj_type, token_str, token) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token string") + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize object token string"); } /* end if */ else *token = H5O_TOKEN_UNDEF; @@ -7739,13 +7907,13 @@ H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const cha FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(vol_obj); - HDassert(token); - HDassert(token_str); + assert(vol_obj); + assert(token); + assert(token_str); /* Call the corresponding internal VOL routine */ if (H5VL__token_from_str(vol_obj->data, obj_type, vol_obj->connector->cls, token_str, token) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "token deserialization failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "token deserialization failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7773,17 +7941,17 @@ H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const cha /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); if (NULL == token) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token pointer"); if (NULL == token_str) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token_str pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid token_str pointer"); /* Call the corresponding internal VOL routine */ if (H5VL__token_from_str(obj, obj_type, cls, token_str, token) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "object token from string failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "object token from string failed"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -7808,7 +7976,7 @@ H5VL__optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, h /* Check if the corresponding VOL callback exists */ if (NULL == cls->optional) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'optional' method") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'optional' method"); /* Call the corresponding VOL callback */ if ((ret_value = (cls->optional)(obj, args, dxpl_id, req)) < 0) @@ -7838,7 +8006,7 @@ H5VL_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dx /* Set wrapper info in API context */ if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info"); vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ @@ -7848,7 +8016,7 @@ H5VL_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dx done: /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_optional() */ @@ -7874,9 +8042,9 @@ H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dx /* Check args and get class pointer */ if (NULL == obj) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object"); if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Call the corresponding internal VOL routine */ if ((ret_value = H5VL__optional(obj, cls, args, dxpl_id, req)) < 0) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLdyn_ops.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLdyn_ops.c index 2db697fd5f..9d2e287e98 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLdyn_ops.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLdyn_ops.c @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -195,30 +195,30 @@ H5VL__register_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *o FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(op_val); - HDassert(op_name && *op_name); + assert(op_val); + assert(op_name && *op_name); /* Check for duplicate operation */ if (H5VL_opt_ops_g[subcls]) { if (NULL != H5SL_search(H5VL_opt_ops_g[subcls], op_name)) - HGOTO_ERROR(H5E_VOL, H5E_EXISTS, FAIL, "operation name already exists") + HGOTO_ERROR(H5E_VOL, H5E_EXISTS, FAIL, "operation name already exists"); } /* end if */ else { /* Create skip list for operation of this subclass */ if (NULL == (H5VL_opt_ops_g[subcls] = H5SL_create(H5SL_TYPE_STR, NULL))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create skip list for operations") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create skip list for operations"); } /* end else */ /* Register new operation */ if (NULL == (new_op = H5FL_CALLOC(H5VL_dyn_op_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for dynamic operation info") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for dynamic operation info"); if (NULL == (new_op->op_name = H5MM_strdup(op_name))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate name for dynamic operation info") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate name for dynamic operation info"); new_op->op_val = H5VL_opt_vals_g[subcls]++; /* Insert into subclass's skip list */ if (H5SL_insert(H5VL_opt_ops_g[subcls], new_op, new_op->op_name) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert operation info into skip list") + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert operation info into skip list"); /* Return the next operation value to the caller */ *op_val = new_op->op_val; @@ -270,8 +270,8 @@ H5VL__find_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_va FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(op_val); - HDassert(op_name && *op_name); + assert(op_val); + assert(op_name && *op_name); /* Check for dynamic operations in the VOL subclass */ if (H5VL_opt_ops_g[subcls]) { @@ -279,13 +279,13 @@ H5VL__find_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_va /* Search for dynamic operation with correct name */ if (NULL == (dyn_op = H5SL_search(H5VL_opt_ops_g[subcls], op_name))) - HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered") + HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered"); /* Set operation value for user */ *op_val = dyn_op->op_val; } /* end if */ else - HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered") + HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -309,7 +309,7 @@ H5VL__unregister_opt_operation(H5VL_subclass_t subcls, const char *op_name) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(op_name && *op_name); + assert(op_name && *op_name); /* Check for dynamic operations in the VOL subclass */ if (H5VL_opt_ops_g[subcls]) { @@ -317,7 +317,7 @@ H5VL__unregister_opt_operation(H5VL_subclass_t subcls, const char *op_name) /* Search for dynamic operation with correct name */ if (NULL == (dyn_op = H5SL_remove(H5VL_opt_ops_g[subcls], op_name))) - HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered") + HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered"); /* Release the info for the operation */ H5VL__release_dyn_op(dyn_op); @@ -325,12 +325,12 @@ H5VL__unregister_opt_operation(H5VL_subclass_t subcls, const char *op_name) /* Close the skip list, if no more operations in it */ if (0 == H5SL_count(H5VL_opt_ops_g[subcls])) { if (H5SL_close(H5VL_opt_ops_g[subcls]) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "can't close dyn op skip list") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "can't close dyn op skip list"); H5VL_opt_ops_g[subcls] = NULL; } /* end if */ } /* end if */ else - HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered") + HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLint.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLint.c index c1a1c5a398..9cf55c99be 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLint.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLint.c @@ -149,7 +149,7 @@ H5VL_init_phase1(void) /* Initialize the ID group for the VL IDs */ if (H5I_register_type(H5I_VOL_CLS) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize H5VL interface"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -198,19 +198,19 @@ H5VL_init_phase2(void) for (i = 0; i < NELMTS(initializer); i++) { if (initializer[i].func() < 0) { HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, - "unable to initialize %s interface", initializer[i].descr) + "unable to initialize %s interface", initializer[i].descr); } } /* clang-format on */ /* Sanity check default VOL connector */ - HDassert(H5VL_def_conn_s.connector_id == (-1)); - HDassert(H5VL_def_conn_s.connector_info == NULL); + assert(H5VL_def_conn_s.connector_id == (-1)); + assert(H5VL_def_conn_s.connector_info == NULL); /* Set up the default VOL connector in the default FAPL */ if (H5VL__set_def_conn() < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -283,11 +283,11 @@ H5VL__free_cls(H5VL_class_t *cls, void H5_ATTR_UNUSED **request) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(cls); + assert(cls); /* Shut down the VOL connector */ if (cls->terminate && cls->terminate() < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly"); /* Release the class */ H5MM_xfree_const(cls->name); @@ -306,9 +306,6 @@ H5VL__free_cls(H5VL_class_t *cls, void H5_ATTR_UNUSED **request) * members match. H5_ITER_CONT otherwise. * Failure: Can't fail * - * Programmer: Dana Robinson - * June 22, 2017 - * *------------------------------------------------------------------------- */ static int @@ -327,7 +324,7 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data) } /* end if */ } /* end if */ else { - HDassert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->key.kind); + assert(H5VL_GET_CONNECTOR_BY_VALUE == op_data->key.kind); if (cls->value == op_data->key.u.value) { op_data->found_id = id; ret_value = H5_ITER_STOP; @@ -349,9 +346,6 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data) * Return: Success: 0 * Failure: -1 * - * Programmer: Jordan Henderson - * November 2018 - * *------------------------------------------------------------------------- */ herr_t @@ -387,47 +381,48 @@ H5VL__set_def_conn(void) /* Duplicate the string to parse, as it is modified as we go */ if (NULL == (buf = H5MM_strdup(env_var))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for environment variable string") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, + "can't allocate memory for environment variable string"); /* Get the first 'word' of the environment variable. * If it's nothing (environment variable was whitespace) return error. */ if (NULL == (tok = HDstrtok_r(buf, " \t\n\r", &lasts))) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "VOL connector environment variable set empty?") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "VOL connector environment variable set empty?"); /* First, check to see if the connector is already registered */ if ((connector_is_registered = H5VL__is_connector_registered_by_name(tok)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check if VOL connector already registered") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't check if VOL connector already registered"); else if (connector_is_registered) { /* Retrieve the ID of the already-registered VOL connector */ if ((connector_id = H5VL__get_connector_id_by_name(tok, FALSE)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector ID"); } /* end else-if */ else { /* Check for VOL connectors that ship with the library */ if (!HDstrcmp(tok, "native")) { connector_id = H5VL_NATIVE; if (H5I_inc_ref(connector_id, FALSE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount") + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount"); } /* end if */ else if (!HDstrcmp(tok, "pass_through")) { connector_id = H5VL_PASSTHRU; if (H5I_inc_ref(connector_id, FALSE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount") + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount"); } /* end else-if */ else { /* Register the VOL connector */ /* (NOTE: No provisions for vipl_id currently) */ if ((connector_id = H5VL__register_connector_by_name(tok, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register connector"); } /* end else */ } /* end else */ /* Was there any connector info specified in the environment variable? */ - if (NULL != (tok = HDstrtok_r(NULL, " \t\n\r", &lasts))) + if (NULL != (tok = HDstrtok_r(NULL, "\n\r", &lasts))) if (H5VL__connector_str_to_info(tok, connector_id, &vol_info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info") + HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info"); /* Set the default VOL connector */ H5VL_def_conn_s.connector_id = connector_id; @@ -440,36 +435,36 @@ H5VL__set_def_conn(void) /* Increment the ref count on the default connector */ if (H5I_inc_ref(H5VL_def_conn_s.connector_id, FALSE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount") + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, FAIL, "can't increment VOL connector refcount"); } /* end else */ /* Get default file access pclass */ if (NULL == (def_fapclass = (H5P_genclass_t *)H5I_object(H5P_FILE_ACCESS))) - HGOTO_ERROR(H5E_VOL, H5E_BADID, FAIL, "can't find object for default file access property class ID") + HGOTO_ERROR(H5E_VOL, H5E_BADID, FAIL, "can't find object for default file access property class ID"); /* Change the default VOL for the default file access pclass */ if (H5P_reset_vol_class(def_fapclass, &H5VL_def_conn_s) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, - "can't set default VOL connector for default file access property class") + "can't set default VOL connector for default file access property class"); /* Get default file access plist */ if (NULL == (def_fapl = (H5P_genplist_t *)H5I_object(H5P_FILE_ACCESS_DEFAULT))) - HGOTO_ERROR(H5E_VOL, H5E_BADID, FAIL, "can't find object for default fapl ID") + HGOTO_ERROR(H5E_VOL, H5E_BADID, FAIL, "can't find object for default fapl ID"); /* Change the default VOL for the default FAPL */ if (H5P_set_vol(def_fapl, H5VL_def_conn_s.connector_id, H5VL_def_conn_s.connector_info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set default VOL connector for default FAPL") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set default VOL connector for default FAPL"); done: /* Clean up on error */ if (ret_value < 0) { if (vol_info) if (H5VL_free_connector_info(connector_id, vol_info) < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free VOL connector info") + HDONE_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free VOL connector info"); if (connector_id >= 0) /* The H5VL_class_t struct will be freed by this function */ if (H5I_dec_ref(connector_id) < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector") + HDONE_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to unregister VOL connector"); } /* end if */ /* Clean up */ @@ -487,9 +482,6 @@ H5VL__set_def_conn(void) * Return: Success: Wrapped object pointer * Failure: NULL * - * Programmer: Quincey Koziol - * Friday, October 7, 2018 - * *------------------------------------------------------------------------- */ static void * @@ -501,18 +493,18 @@ H5VL__wrap_obj(void *obj, H5I_type_t obj_type) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(obj); + assert(obj); /* Retrieve the VOL object wrapping context */ if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL object wrap context"); /* If there is a VOL object wrapping context, wrap the object */ if (vol_wrap_ctx) { /* Wrap object, using the VOL callback */ if (NULL == (ret_value = H5VL_wrap_object(vol_wrap_ctx->connector->cls, vol_wrap_ctx->obj_wrap_ctx, obj, obj_type))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't wrap object"); } /* end if */ else ret_value = obj; @@ -529,9 +521,6 @@ H5VL__wrap_obj(void *obj, H5I_type_t obj_type) * Return: Success: VOL object pointer * Failure: NULL * - * Programmer: Quincey Koziol - * Friday, October 7, 2018 - * *------------------------------------------------------------------------- */ static H5VL_object_t * @@ -544,21 +533,21 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(object); - HDassert(vol_connector); + assert(object); + assert(vol_connector); /* Make sure type number is valid */ if (type != H5I_ATTR && type != H5I_DATASET && type != H5I_DATATYPE && type != H5I_FILE && type != H5I_GROUP && type != H5I_MAP) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, NULL, "invalid type number") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, NULL, "invalid type number"); /* Create the new VOL object */ if (NULL == (new_vol_obj = H5FL_CALLOC(H5VL_object_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object"); new_vol_obj->connector = vol_connector; if (wrap_obj) { if (NULL == (new_vol_obj->data = H5VL__wrap_obj(object, type))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't wrap library object"); } /* end if */ else new_vol_obj->data = object; @@ -571,7 +560,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t /* If this is a datatype, we have to hide the VOL object under the H5T_t pointer */ if (H5I_DATATYPE == type) { if (NULL == (ret_value = (H5VL_object_t *)H5T_construct_datatype(new_vol_obj))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't construct datatype object") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't construct datatype object"); } /* end if */ else ret_value = (H5VL_object_t *)new_vol_obj; @@ -580,7 +569,7 @@ H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t /* Cleanup on error */ if (NULL == ret_value) { if (conn_rc_incr && H5VL_conn_dec_rc(vol_connector) < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector") + HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector"); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -610,7 +599,8 @@ H5VL_conn_copy(H5VL_connector_prop_t *connector_prop) if (connector_prop->connector_id > 0) { /* Increment the reference count on connector ID and copy connector info */ if (H5I_inc_ref(connector_prop->connector_id, FALSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, "unable to increment ref count on VOL connector ID") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINC, FAIL, + "unable to increment ref count on VOL connector ID"); /* Copy connector info, if it exists */ if (connector_prop->connector_info) { @@ -619,12 +609,12 @@ H5VL_conn_copy(H5VL_connector_prop_t *connector_prop) /* Retrieve the connector for the ID */ if (NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Allocate and copy connector info */ if (H5VL_copy_connector_info(connector, &new_connector_info, connector_prop->connector_info) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed") + HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "connector info copy failed"); /* Set the connector info to the copy */ connector_prop->connector_info = new_connector_info; @@ -660,11 +650,12 @@ H5VL_conn_free(const H5VL_connector_prop_t *connector_prop) /* Free the connector info */ if (H5VL_free_connector_info(connector_prop->connector_id, connector_prop->connector_info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, + "unable to release VOL connector info object"); /* Decrement reference count for connector ID */ if (H5I_dec_ref(connector_prop->connector_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "can't decrement reference count for connector ID"); } } @@ -693,17 +684,17 @@ H5VL_register(H5I_type_t type, void *object, H5VL_t *vol_connector, hbool_t app_ FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Check arguments */ - HDassert(object); - HDassert(vol_connector); + assert(object); + assert(vol_connector); /* Set up VOL object for the passed-in data */ /* (Does not wrap object, since it's from a VOL callback) */ if (NULL == (vol_obj = H5VL__new_vol_obj(type, object, vol_connector, FALSE))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object"); /* Register VOL object as _object_ type, for future object API calls */ if ((ret_value = H5I_register(type, vol_obj, app_ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register handle") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register handle"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -737,17 +728,17 @@ H5VL_register_using_existing_id(H5I_type_t type, void *object, H5VL_t *vol_conne FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(object); - HDassert(vol_connector); + assert(object); + assert(vol_connector); /* Set up VOL object for the passed-in data */ /* (Wraps object, since it's a library object) */ if (NULL == (new_vol_obj = H5VL__new_vol_obj(type, object, vol_connector, TRUE))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object"); /* Call the underlying H5I function to complete the registration */ if (H5I_register_using_existing_id(type, new_vol_obj, app_ref, existing_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register object under existing ID"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -775,15 +766,15 @@ H5VL_new_connector(hid_t connector_id) /* Get the VOL class object from the connector's ID */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Setup VOL info struct */ if (NULL == (connector = H5FL_CALLOC(H5VL_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate VOL connector struct") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate VOL connector struct"); connector->cls = cls; connector->id = connector_id; if (H5I_inc_ref(connector->id, FALSE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, NULL, "unable to increment ref count on VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, NULL, "unable to increment ref count on VOL connector"); conn_id_incr = TRUE; /* Set return value */ @@ -794,7 +785,7 @@ H5VL_new_connector(hid_t connector_id) if (NULL == ret_value) { /* Decrement VOL connector ID ref count on error */ if (conn_id_incr && H5I_dec_ref(connector_id) < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector") + HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector"); /* Free VOL connector struct */ if (NULL != connector) @@ -826,11 +817,11 @@ H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool /* Create new VOL connector object, using the connector ID */ if (NULL == (connector = H5VL_new_connector(connector_id))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't create VOL connector object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't create VOL connector object"); /* Get an ID for the VOL object */ if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle"); done: /* Clean up on error */ @@ -865,13 +856,13 @@ H5VL_create_object(void *object, H5VL_t *vol_connector) FUNC_ENTER_NOAPI(NULL) /* Check arguments */ - HDassert(object); - HDassert(vol_connector); + assert(object); + assert(vol_connector); /* Set up VOL object for the passed-in data */ /* (Does not wrap object, since it's from a VOL callback) */ if (NULL == (ret_value = H5FL_CALLOC(H5VL_object_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate memory for VOL object"); ret_value->connector = vol_connector; ret_value->data = object; ret_value->rc = 1; @@ -907,28 +898,28 @@ H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id) /* Get the VOL class object from the connector's ID */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a VOL connector ID"); /* Setup VOL info struct */ if (NULL == (connector = H5FL_CALLOC(H5VL_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate VOL info struct") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate VOL info struct"); connector->cls = cls; connector->id = connector_id; if (H5I_inc_ref(connector->id, FALSE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINC, NULL, "unable to increment ref count on VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTINC, NULL, "unable to increment ref count on VOL connector"); conn_id_incr = TRUE; /* Set up VOL object for the passed-in data */ /* (Wraps object, since it's a library object) */ if (NULL == (ret_value = H5VL__new_vol_obj(type, obj, connector, TRUE))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't create VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't create VOL object"); done: /* Clean up on error */ if (!ret_value) { /* Decrement VOL connector ID ref count on error */ if (conn_id_incr && H5I_dec_ref(connector_id) < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector") + HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector"); /* Free VOL connector struct */ if (NULL != connector) @@ -945,9 +936,6 @@ H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id) * * Return: Current ref. count (can't fail) * - * Programmer: Quincey Koziol - * February 23, 2019 - * *------------------------------------------------------------------------- */ int64_t @@ -958,7 +946,7 @@ H5VL_conn_inc_rc(H5VL_t *connector) FUNC_ENTER_NOAPI_NOERR /* Check arguments */ - HDassert(connector); + assert(connector); /* Increment refcount for connector */ connector->nrefs++; @@ -975,9 +963,6 @@ H5VL_conn_inc_rc(H5VL_t *connector) * * Return: Current ref. count (>=0) on success, <0 on failure * - * Programmer: Quincey Koziol - * February 23, 2019 - * *------------------------------------------------------------------------- */ int64_t @@ -988,7 +973,7 @@ H5VL_conn_dec_rc(H5VL_t *connector) FUNC_ENTER_NOAPI(-1) /* Check arguments */ - HDassert(connector); + assert(connector); /* Decrement refcount for connector */ connector->nrefs--; @@ -996,7 +981,7 @@ H5VL_conn_dec_rc(H5VL_t *connector) /* Check for last reference */ if (0 == connector->nrefs) { if (H5I_dec_ref(connector->id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector"); H5FL_FREE(H5VL_t, connector); /* Set return value */ @@ -1022,10 +1007,10 @@ H5VL_conn_dec_rc(H5VL_t *connector) hsize_t H5VL_object_inc_rc(H5VL_object_t *vol_obj) { - FUNC_ENTER_NOAPI_NOERR_NOFS + FUNC_ENTER_NOAPI_NOERR /* Check arguments */ - HDassert(vol_obj); + assert(vol_obj); /* Increment refcount for object and return */ FUNC_LEAVE_NOAPI(++vol_obj->rc) @@ -1049,12 +1034,12 @@ H5VL_free_object(H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(vol_obj); + assert(vol_obj); if (--vol_obj->rc == 0) { /* Decrement refcount on connector */ if (H5VL_conn_dec_rc(vol_obj->connector) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector"); vol_obj = H5FL_FREE(H5VL_object_t, vol_obj); } /* end if */ @@ -1071,9 +1056,6 @@ H5VL_free_object(H5VL_object_t *vol_obj) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 14, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1087,21 +1069,21 @@ H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native) FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(obj); - HDassert(is_native); + assert(obj); + assert(is_native); /* Retrieve the terminal connector class for the object */ cls = NULL; if (H5VL_introspect_get_conn_cls(obj, H5VL_GET_CONN_LVL_TERM, &cls) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class"); /* Retrieve the native connector class */ if (NULL == (native_cls = (H5VL_class_t *)H5I_object_verify(H5VL_NATIVE, H5I_VOL))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve native VOL connector class") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve native VOL connector class"); /* Compare connector classes */ if (H5VL_cmp_connector_cls(&cmp_value, cls, native_cls) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes"); /* If classes compare equal, then the object is / is in a native connector's file */ *is_native = (cmp_value == 0); @@ -1117,9 +1099,6 @@ H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * December 14, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1133,21 +1112,21 @@ H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ - HDassert(vol_obj1); - HDassert(vol_obj2); - HDassert(same_file); + assert(vol_obj1); + assert(vol_obj2); + assert(same_file); /* Retrieve the terminal connectors for each object */ cls1 = NULL; if (H5VL_introspect_get_conn_cls(vol_obj1, H5VL_GET_CONN_LVL_TERM, &cls1) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class"); cls2 = NULL; if (H5VL_introspect_get_conn_cls(vol_obj2, H5VL_GET_CONN_LVL_TERM, &cls2) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class"); /* Compare connector classes */ if (H5VL_cmp_connector_cls(&cmp_value, cls1, cls2) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes"); /* If the connector classes are different, the files are different */ if (cmp_value) @@ -1158,7 +1137,7 @@ H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, /* Get unwrapped (terminal) object for vol_obj2 */ if (NULL == (obj2 = H5VL_object_data(vol_obj2))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get unwrapped object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get unwrapped object"); /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_FILE_IS_EQUAL; @@ -1167,7 +1146,7 @@ H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, /* Make 'are files equal' callback */ if (H5VL_file_specific(vol_obj1, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed"); } /* end else */ done: @@ -1185,9 +1164,6 @@ H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, * * Failure: H5I_INVALID_HID * - * Programmer: Dana Robinson - * June 22, 2017 - * *------------------------------------------------------------------------- */ hid_t @@ -1200,24 +1176,24 @@ H5VL__register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id) FUNC_ENTER_PACKAGE /* Check arguments */ - HDassert(cls); + assert(cls); /* Copy the class structure so the caller can reuse or free it */ if (NULL == (saved = H5FL_MALLOC(H5VL_class_t))) HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, - "memory allocation failed for VOL connector class struct") + "memory allocation failed for VOL connector class struct"); H5MM_memcpy(saved, cls, sizeof(H5VL_class_t)); if (NULL == (saved->name = H5MM_strdup(cls->name))) HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, - "memory allocation failed for VOL connector name") + "memory allocation failed for VOL connector name"); /* Initialize the VOL connector */ if (cls->initialize && cls->initialize(vipl_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to init VOL connector"); /* Create the new class ID */ if ((ret_value = H5I_register(H5I_VOL, saved, app_ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID"); done: if (ret_value < 0 && saved) { @@ -1242,9 +1218,6 @@ H5VL__register_connector(const void *_cls, hbool_t app_ref, hid_t vipl_id) * * Failure: H5I_INVALID_HID * - * Programmer: Dana Robinson - * June 22, 2017 - * *------------------------------------------------------------------------- */ hid_t @@ -1258,23 +1231,23 @@ H5VL__register_connector_by_class(const H5VL_class_t *cls, hbool_t app_ref, hid_ /* Check arguments */ if (!cls) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, H5I_INVALID_HID, - "VOL connector class pointer cannot be NULL") + "VOL connector class pointer cannot be NULL"); if (H5VL_VERSION != cls->version) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector has incompatible version") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector has incompatible version"); if (!cls->name) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, - "VOL connector class name cannot be the NULL pointer") + "VOL connector class name cannot be the NULL pointer"); if (0 == HDstrlen(cls->name)) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, - "VOL connector class name cannot be the empty string") + "VOL connector class name cannot be the empty string"); if (cls->info_cls.copy && !cls->info_cls.free) HGOTO_ERROR( H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, - "VOL connector must provide free callback for VOL info objects when a copy callback is provided") + "VOL connector must provide free callback for VOL info objects when a copy callback is provided"); if (cls->wrap_cls.get_wrap_ctx && !cls->wrap_cls.free_wrap_ctx) HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "VOL connector must provide free callback for object wrapping contexts when a get " - "callback is provided") + "callback is provided"); /* Set up op data for iteration */ op_data.key.kind = H5VL_GET_CONNECTOR_BY_NAME; @@ -1283,19 +1256,19 @@ H5VL__register_connector_by_class(const H5VL_class_t *cls, hbool_t app_ref, hid_ /* Check if connector is already registered */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs") + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL IDs"); /* Increment the ref count on the existing VOL connector ID, if it's already registered */ if (op_data.found_id != H5I_INVALID_HID) { if (H5I_inc_ref(op_data.found_id, app_ref) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, - "unable to increment ref count on VOL connector") + "unable to increment ref count on VOL connector"); ret_value = op_data.found_id; } /* end if */ else { /* Create a new class ID */ if ((ret_value = H5VL__register_connector(cls, app_ref, vipl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector"); } /* end else */ done: @@ -1314,9 +1287,6 @@ H5VL__register_connector_by_class(const H5VL_class_t *cls, hbool_t app_ref, hid_ * * Failure: H5I_INVALID_HID * - * Programmer: Dana Robinson - * June 22, 2017 - * *------------------------------------------------------------------------- */ hid_t @@ -1334,13 +1304,13 @@ H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_i /* Check if connector is already registered */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, app_ref) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids"); /* If connector already registered, increment ref count on ID and return ID */ if (op_data.found_id != H5I_INVALID_HID) { if (H5I_inc_ref(op_data.found_id, app_ref) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, - "unable to increment ref count on VOL connector") + "unable to increment ref count on VOL connector"); ret_value = op_data.found_id; } /* end if */ else { @@ -1351,11 +1321,11 @@ H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_i key.vol.kind = H5VL_GET_CONNECTOR_BY_NAME; key.vol.u.name = name; if (NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector"); /* Register the connector we loaded */ if ((ret_value = H5VL__register_connector(cls, app_ref, vipl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID"); } /* end else */ done: @@ -1374,9 +1344,6 @@ H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_i * * Failure: H5I_INVALID_HID * - * Programmer: Dana Robinson - * June 22, 2017 - * *------------------------------------------------------------------------- */ hid_t @@ -1394,13 +1361,13 @@ H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid /* Check if connector is already registered */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, app_ref) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids") + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL ids"); /* If connector already registered, increment ref count on ID and return ID */ if (op_data.found_id != H5I_INVALID_HID) { if (H5I_inc_ref(op_data.found_id, app_ref) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, - "unable to increment ref count on VOL connector") + "unable to increment ref count on VOL connector"); ret_value = op_data.found_id; } /* end if */ else { @@ -1411,11 +1378,11 @@ H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid key.vol.kind = H5VL_GET_CONNECTOR_BY_VALUE; key.vol.u.value = value; if (NULL == (cls = (const H5VL_class_t *)H5PL_load(H5PL_TYPE_VOL, &key))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "unable to load VOL connector"); /* Register the connector we loaded */ if ((ret_value = H5VL__register_connector(cls, app_ref, vipl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register VOL connector ID"); } /* end else */ done: @@ -1431,9 +1398,6 @@ H5VL__register_connector_by_value(H5VL_class_value_t value, hbool_t app_ref, hid * 0 if a VOL connector with that name has NOT been registered * <0 on errors * - * Programmer: Dana Robinson - * June 17, 2017 - * *------------------------------------------------------------------------- */ htri_t @@ -1451,7 +1415,7 @@ H5VL__is_connector_registered_by_name(const char *name) /* Find connector with name */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL connectors") + HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL connectors"); /* Found a connector with that name */ if (op_data.found_id != H5I_INVALID_HID) @@ -1488,7 +1452,7 @@ H5VL__is_connector_registered_by_value(H5VL_class_value_t value) /* Find connector with value */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL connectors") + HGOTO_ERROR(H5E_VOL, H5E_BADITER, FAIL, "can't iterate over VOL connectors"); /* Found a connector with that name */ if (op_data.found_id != H5I_INVALID_HID) @@ -1506,9 +1470,6 @@ H5VL__is_connector_registered_by_value(H5VL_class_value_t value) * Return: Positive if the VOL class has been registered * Negative on error (if the class is not a valid class or not registered) * - * Programmer: Dana Robinson - * June 17, 2017 - * *------------------------------------------------------------------------- */ hid_t @@ -1521,12 +1482,12 @@ H5VL__get_connector_id(hid_t obj_id, hbool_t is_api) /* Get the underlying VOL object for the object ID */ if (NULL == (vol_obj = H5VL_vol_object(obj_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier"); /* Return the VOL object's VOL class ID */ ret_value = vol_obj->connector->id; if (H5I_inc_ref(ret_value, is_api) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1540,9 +1501,6 @@ H5VL__get_connector_id(hid_t obj_id, hbool_t is_api) * Return: Positive if the VOL class has been registered * Negative on error (if the class is not a valid class or not registered) * - * Programmer: Dana Robinson - * June 17, 2017 - * *------------------------------------------------------------------------- */ hid_t @@ -1554,11 +1512,11 @@ H5VL__get_connector_id_by_name(const char *name, hbool_t is_api) /* Find connector with name */ if ((ret_value = H5VL__peek_connector_id_by_name(name)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't find VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't find VOL connector"); /* Found a connector with that name */ if (H5I_inc_ref(ret_value, is_api) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1584,11 +1542,11 @@ H5VL__get_connector_id_by_value(H5VL_class_value_t value, hbool_t is_api) /* Find connector with value */ if ((ret_value = H5VL__peek_connector_id_by_value(value)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't find VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't find VOL connector"); /* Found a connector with that value */ if (H5I_inc_ref(ret_value, is_api) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector") + HGOTO_ERROR(H5E_FILE, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1621,7 +1579,7 @@ H5VL__peek_connector_id_by_name(const char *name) /* Find connector with name */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connectors") + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connectors"); /* Set return value */ ret_value = op_data.found_id; @@ -1657,7 +1615,7 @@ H5VL__peek_connector_id_by_value(H5VL_class_value_t value) /* Find connector with value */ if (H5I_iterate(H5I_VOL, H5VL__get_connector_cb, &op_data, TRUE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connectors") + HGOTO_ERROR(H5E_VOL, H5E_BADITER, H5I_INVALID_HID, "can't iterate over VOL connectors"); /* Set return value */ ret_value = op_data.found_id; @@ -1674,9 +1632,6 @@ H5VL__peek_connector_id_by_value(H5VL_class_value_t value) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * March 2, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -1692,12 +1647,12 @@ H5VL__connector_str_to_info(const char *str, hid_t connector_id, void **info) /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Allow the connector to deserialize info */ if (cls->info_cls.from_str) { if ((cls->info_cls.from_str)(str, info) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info") + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "can't deserialize connector info"); } /* end if */ else *info = NULL; @@ -1731,7 +1686,7 @@ H5VL__get_connector_name(hid_t id, char *name /*out*/, size_t size) /* get the object pointer */ if (NULL == (vol_obj = H5VL_vol_object(id))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid VOL identifier") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid VOL identifier"); cls = vol_obj->connector->cls; @@ -1776,15 +1731,15 @@ H5VL_vol_object(hid_t id) H5I_DATATYPE == obj_type || H5I_MAP == obj_type) { /* Get the object */ if (NULL == (obj = H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); /* If this is a datatype, get the VOL object attached to the H5T_t struct */ if (H5I_DATATYPE == obj_type) if (NULL == (obj = H5T_get_named_type((H5T_t *)obj))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); } /* end if */ else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier type to function"); ret_value = (H5VL_object_t *)obj; @@ -1838,7 +1793,7 @@ H5VL_object_unwrap(const H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI(NULL) if (NULL == (ret_value = H5VL_unwrap_object(vol_obj->connector->cls, vol_obj->data))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't unwrap object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1872,7 +1827,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type) case H5I_MAP: /* get the object */ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); break; case H5I_DATATYPE: { @@ -1880,11 +1835,11 @@ H5VL__object(hid_t id, H5I_type_t obj_type) /* get the object */ if (NULL == (dt = (H5T_t *)H5I_object(id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); /* Get the actual datatype object that should be the vol_obj */ if (NULL == (vol_obj = H5T_get_named_type(dt))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a named datatype"); break; } @@ -1902,7 +1857,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type) case H5I_EVENTSET: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type"); } /* end switch */ /* Set the return value */ @@ -1932,7 +1887,7 @@ H5VL_object(hid_t id) /* Get the underlying object */ if (NULL == (ret_value = H5VL__object(id, H5I_get_type(id)))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't retrieve object for ID") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't retrieve object for ID"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1958,11 +1913,11 @@ H5VL_object_verify(hid_t id, H5I_type_t obj_type) /* Check of ID of correct type */ if (obj_type != H5I_get_type(id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "invalid identifier"); /* Get the underlying object */ if (NULL == (ret_value = H5VL__object(id, obj_type))) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, NULL, "can't retrieve object for ID"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1989,8 +1944,8 @@ H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_clas FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(cls1); - HDassert(cls2); + assert(cls1); + assert(cls2); /* If the pointers are the same the classes are the same */ if (cls1 == cls2) { @@ -2001,47 +1956,47 @@ H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_clas /* Compare connector "values" */ if (cls1->value < cls2->value) { *cmp_value = -1; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ if (cls1->value > cls2->value) { *cmp_value = 1; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ - HDassert(cls1->value == cls2->value); + assert(cls1->value == cls2->value); /* Compare connector names */ if (cls1->name == NULL && cls2->name != NULL) { *cmp_value = -1; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ if (cls1->name != NULL && cls2->name == NULL) { *cmp_value = 1; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ if (0 != (*cmp_value = HDstrcmp(cls1->name, cls2->name))) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Compare connector VOL API versions */ if (cls1->version < cls2->version) { *cmp_value = -1; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ if (cls1->version > cls2->version) { *cmp_value = 1; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ - HDassert(cls1->version == cls2->version); + assert(cls1->version == cls2->version); /* Compare connector info */ if (cls1->info_cls.size < cls2->info_cls.size) { *cmp_value = -1; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ if (cls1->info_cls.size > cls2->info_cls.size) { *cmp_value = 1; - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); } /* end if */ - HDassert(cls1->info_cls.size == cls2->info_cls.size); + assert(cls1->info_cls.size == cls2->info_cls.size); /* Set comparison value to 'equal' */ *cmp_value = 0; @@ -2071,11 +2026,11 @@ H5VL_retrieve_lib_state(void **state) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(state); + assert(state); /* Retrieve the API context state */ if (H5CX_retrieve_state((H5CX_state_t **)state) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get API context state") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get API context state"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2091,9 +2046,6 @@ H5VL_retrieve_lib_state(void **state) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, February 5, 2021 - * *------------------------------------------------------------------------- */ herr_t @@ -2105,7 +2057,7 @@ H5VL_start_lib_state(void) /* Push a new API context on the stack */ if (H5CX_push() < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2121,9 +2073,6 @@ H5VL_start_lib_state(void) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Thursday, January 10, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2134,11 +2083,11 @@ H5VL_restore_lib_state(const void *state) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(state); + assert(state); /* Restore the API context state */ if (H5CX_restore_state((const H5CX_state_t *)state) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set API context state") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set API context state"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2159,9 +2108,6 @@ H5VL_restore_lib_state(const void *state) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Saturday, February 23, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2173,7 +2119,7 @@ H5VL_finish_lib_state(void) /* Pop the API context off the stack */ if (H5CX_pop(FALSE) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't pop API context") + HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't pop API context"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2189,9 +2135,6 @@ H5VL_finish_lib_state(void) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Thursday, January 10, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2202,11 +2145,11 @@ H5VL_free_lib_state(void *state) FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ - HDassert(state); + assert(state); /* Free the API context state */ if (H5CX_free_state((H5CX_state_t *)state) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free API context state") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "can't free API context state"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2219,9 +2162,6 @@ H5VL_free_lib_state(void *state) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Wednesday, January 9, 2019 - * *------------------------------------------------------------------------- */ static herr_t @@ -2232,21 +2172,21 @@ H5VL__free_vol_wrapper(H5VL_wrap_ctx_t *vol_wrap_ctx) FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(vol_wrap_ctx); - HDassert(0 == vol_wrap_ctx->rc); - HDassert(vol_wrap_ctx->connector); - HDassert(vol_wrap_ctx->connector->cls); + assert(vol_wrap_ctx); + assert(0 == vol_wrap_ctx->rc); + assert(vol_wrap_ctx->connector); + assert(vol_wrap_ctx->connector->cls); /* If there is a VOL connector object wrapping context, release it */ if (vol_wrap_ctx->obj_wrap_ctx) /* Release the VOL connector's object wrapping context */ if ((*vol_wrap_ctx->connector->cls->wrap_cls.free_wrap_ctx)(vol_wrap_ctx->obj_wrap_ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, - "unable to release connector's object wrapping context") + "unable to release connector's object wrapping context"); /* Decrement refcount on connector */ if (H5VL_conn_dec_rc(vol_wrap_ctx->connector) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector"); /* Release object wrapping context */ H5FL_FREE(H5VL_wrap_ctx_t, vol_wrap_ctx); @@ -2273,33 +2213,33 @@ H5VL_set_vol_wrapper(const H5VL_object_t *vol_obj) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); + assert(vol_obj); /* Retrieve the VOL object wrap context */ if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context"); /* Check for existing wrapping context */ if (NULL == vol_wrap_ctx) { void *obj_wrap_ctx = NULL; /* VOL connector's wrapping context */ /* Sanity checks */ - HDassert(vol_obj->data); - HDassert(vol_obj->connector); + assert(vol_obj->data); + assert(vol_obj->connector); /* Check if the connector can create a wrap context */ if (vol_obj->connector->cls->wrap_cls.get_wrap_ctx) { /* Sanity check */ - HDassert(vol_obj->connector->cls->wrap_cls.free_wrap_ctx); + assert(vol_obj->connector->cls->wrap_cls.free_wrap_ctx); /* Get the wrap context from the connector */ if ((vol_obj->connector->cls->wrap_cls.get_wrap_ctx)(vol_obj->data, &obj_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve VOL connector's object wrap context"); } /* end if */ /* Allocate VOL object wrapper context */ if (NULL == (vol_wrap_ctx = H5FL_MALLOC(H5VL_wrap_ctx_t))) - HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate VOL wrap context"); /* Increment the outstanding objects that are using the connector */ H5VL_conn_inc_rc(vol_obj->connector); @@ -2315,7 +2255,7 @@ H5VL_set_vol_wrapper(const H5VL_object_t *vol_obj) /* Save the wrapper context */ if (H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context"); done: if (ret_value < 0 && vol_wrap_ctx) @@ -2332,9 +2272,6 @@ H5VL_set_vol_wrapper(const H5VL_object_t *vol_obj) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Wednesday, January 9, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2347,9 +2284,9 @@ H5VL_inc_vol_wrapper(void *_vol_wrap_ctx) /* Check for valid, active VOL object wrap context */ if (NULL == vol_wrap_ctx) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?"); if (0 == vol_wrap_ctx->rc) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "bad VOL object wrap context refcount?") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "bad VOL object wrap context refcount?"); /* Increment ref count on wrapping context */ vol_wrap_ctx->rc++; @@ -2366,9 +2303,6 @@ H5VL_inc_vol_wrapper(void *_vol_wrap_ctx) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Wednesday, January 9, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -2381,9 +2315,9 @@ H5VL_dec_vol_wrapper(void *_vol_wrap_ctx) /* Check for valid, active VOL object wrap context */ if (NULL == vol_wrap_ctx) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?"); if (0 == vol_wrap_ctx->rc) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "bad VOL object wrap context refcount?") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "bad VOL object wrap context refcount?"); /* Decrement ref count on wrapping context */ vol_wrap_ctx->rc--; @@ -2391,7 +2325,7 @@ H5VL_dec_vol_wrapper(void *_vol_wrap_ctx) /* Release context if the ref count drops to zero */ if (0 == vol_wrap_ctx->rc) if (H5VL__free_vol_wrapper(vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL object wrapping context") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL object wrapping context"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2416,11 +2350,11 @@ H5VL_reset_vol_wrapper(void) /* Retrieve the VOL object wrap context */ if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL object wrap context"); /* Check for VOL object wrap context */ if (NULL == vol_wrap_ctx) - HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?") + HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, FAIL, "no VOL object wrap context?"); /* Decrement ref count on wrapping context */ vol_wrap_ctx->rc--; @@ -2429,16 +2363,16 @@ H5VL_reset_vol_wrapper(void) if (0 == vol_wrap_ctx->rc) { /* Release object wrapping context */ if (H5VL__free_vol_wrapper(vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL object wrapping context") + HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL object wrapping context"); /* Reset the wrapper context */ if (H5CX_set_vol_wrap_ctx(NULL) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context"); } /* end if */ else /* Save the updated wrapper context */ if (H5CX_set_vol_wrap_ctx(vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL object wrap context"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2463,14 +2397,14 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) FUNC_ENTER_NOAPI(H5I_INVALID_HID) /* Sanity check */ - HDassert(obj); + assert(obj); /* Retrieve the VOL object wrapping context */ if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL object wrap context"); if (NULL == vol_wrap_ctx || NULL == vol_wrap_ctx->connector) HGOTO_ERROR(H5E_VOL, H5E_BADVALUE, H5I_INVALID_HID, - "VOL object wrap context or its connector is NULL???") + "VOL object wrap context or its connector is NULL???"); /* If the datatype is already VOL-managed, the datatype's vol_obj * field will get clobbered later, so disallow this. @@ -2478,15 +2412,15 @@ H5VL_wrap_register(H5I_type_t type, void *obj, hbool_t app_ref) if (type == H5I_DATATYPE) if (vol_wrap_ctx->connector->id == H5VL_NATIVE) if (TRUE == H5T_already_vol_managed((const H5T_t *)obj)) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "can't wrap an uncommitted datatype"); /* Wrap the object with VOL connector info */ if (NULL == (new_obj = H5VL__wrap_obj(obj, type))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object") + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't wrap library object"); /* Get an ID for the object */ if ((ret_value = H5VL_register_using_vol_id(type, new_obj, vol_wrap_ctx->connector->id, app_ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object") + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get an ID for the object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2517,9 +2451,9 @@ H5VL_check_plugin_load(const H5VL_class_t *cls, const H5PL_key_t *key, hbool_t * FUNC_ENTER_NOAPI_NOERR /* Sanity checks */ - HDassert(cls); - HDassert(key); - HDassert(success); + assert(cls); + assert(key); + assert(success); /* Which kind of key are we looking for? */ if (key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) { @@ -2529,7 +2463,7 @@ H5VL_check_plugin_load(const H5VL_class_t *cls, const H5PL_key_t *key, hbool_t * } /* end if */ else { /* Sanity check */ - HDassert(key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE); + assert(key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE); /* Check if plugin value matches VOL connector class value */ if (cls->value == key->vol.u.value) @@ -2558,7 +2492,7 @@ H5VL__is_default_conn(hid_t fapl_id, hid_t connector_id, hbool_t *is_default) FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ - HDassert(is_default); + assert(is_default); /* Determine if the default VOL connector will be used, based on non-default * values in the FAPL, connector ID, or the HDF5_VOL_CONNECTOR environment @@ -2587,15 +2521,15 @@ H5VL_setup_args(hid_t loc_id, H5I_type_t id_type, H5VL_object_t **vol_obj) FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); + assert(vol_obj); /* Get attribute pointer */ if (NULL == (*vol_obj = (H5VL_object_t *)H5I_object_verify(loc_id, id_type))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not the correct type of ID") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not the correct type of ID"); /* Set up collective metadata (if appropriate) */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set collective metadata read") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set collective metadata read"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2618,16 +2552,16 @@ H5VL_setup_loc_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *lo FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); - HDassert(loc_params); + assert(vol_obj); + assert(loc_params); /* Get the location object */ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not the correct type of ID") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not the correct type of ID"); /* Set up collective metadata (if appropriate */ if (H5CX_set_loc(loc_id) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set collective metadata read") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set collective metadata read"); /* Set location parameters */ loc_params->type = H5VL_OBJECT_BY_SELF; @@ -2655,18 +2589,18 @@ H5VL_setup_acc_args(hid_t loc_id, const H5P_libclass_t *libclass, hbool_t is_col FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(libclass); - HDassert(acspl_id); - HDassert(vol_obj); - HDassert(loc_params); + assert(libclass); + assert(acspl_id); + assert(vol_obj); + assert(loc_params); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(acspl_id, libclass, loc_id, is_collective) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the location object */ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params->type = H5VL_OBJECT_BY_SELF; @@ -2693,12 +2627,12 @@ H5VL_setup_self_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *l FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); - HDassert(loc_params); + assert(vol_obj); + assert(loc_params); /* Get the location object */ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params->type = H5VL_OBJECT_BY_SELF; @@ -2726,22 +2660,22 @@ H5VL_setup_name_args(hid_t loc_id, const char *name, hbool_t is_collective, hid_ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); - HDassert(loc_params); + assert(vol_obj); + assert(loc_params); /* Check args */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, is_collective) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the location object */ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set up location parameters */ loc_params->type = H5VL_OBJECT_BY_NAME; @@ -2772,26 +2706,26 @@ H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); - HDassert(loc_params); + assert(vol_obj); + assert(loc_params); /* Check args */ if (!name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL"); if (!*name) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string"); if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified"); if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified"); /* Verify access property list and set up collective metadata if appropriate */ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, is_collective) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info") + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info"); /* Get the location object */ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params->type = H5VL_OBJECT_BY_IDX; @@ -2824,12 +2758,12 @@ H5VL_setup_token_args(hid_t loc_id, H5O_token_t *obj_token, H5VL_object_t **vol_ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(vol_obj); - HDassert(loc_params); + assert(vol_obj); + assert(loc_params); /* Get the location object */ if (NULL == (*vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Set location parameters */ loc_params->type = H5VL_OBJECT_BY_TOKEN; @@ -2854,14 +2788,14 @@ H5VL_setup_token_args(hid_t loc_id, H5O_token_t *obj_token, H5VL_object_t **vol_ *------------------------------------------------------------------------- */ herr_t -H5VL_get_cap_flags(const H5VL_connector_prop_t *connector_prop, unsigned *cap_flags) +H5VL_get_cap_flags(const H5VL_connector_prop_t *connector_prop, uint64_t *cap_flags) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(connector_prop); + assert(connector_prop); /* Copy the connector ID & info, if there is one */ if (connector_prop->connector_id > 0) { @@ -2869,14 +2803,14 @@ H5VL_get_cap_flags(const H5VL_connector_prop_t *connector_prop, unsigned *cap_fl /* Retrieve the connector for the ID */ if (NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id))) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID") + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID"); /* Query the connector's capability flags */ if (H5VL_introspect_get_cap_flags(connector_prop->connector_info, connector, cap_flags) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags"); } /* end if */ else - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector ID not set?") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector ID not set?"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative.c index 71933264ca..907f020b56 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative.c @@ -45,15 +45,28 @@ static hid_t H5VL_NATIVE_ID_g = H5I_INVALID_HID; /* Prototypes */ static herr_t H5VL__native_term(void); +#define H5VL_NATIVE_CAP_FLAGS \ + (H5VL_CAP_FLAG_NATIVE_FILES | H5VL_CAP_FLAG_ATTR_BASIC | H5VL_CAP_FLAG_ATTR_MORE | \ + H5VL_CAP_FLAG_DATASET_BASIC | H5VL_CAP_FLAG_DATASET_MORE | H5VL_CAP_FLAG_FILE_BASIC | \ + H5VL_CAP_FLAG_FILE_MORE | H5VL_CAP_FLAG_GROUP_BASIC | H5VL_CAP_FLAG_GROUP_MORE | \ + H5VL_CAP_FLAG_LINK_BASIC | H5VL_CAP_FLAG_LINK_MORE | H5VL_CAP_FLAG_OBJECT_BASIC | \ + H5VL_CAP_FLAG_OBJECT_MORE | H5VL_CAP_FLAG_REF_BASIC | H5VL_CAP_FLAG_REF_MORE | H5VL_CAP_FLAG_OBJ_REF | \ + H5VL_CAP_FLAG_REG_REF | H5VL_CAP_FLAG_ATTR_REF | H5VL_CAP_FLAG_STORED_DATATYPES | \ + H5VL_CAP_FLAG_CREATION_ORDER | H5VL_CAP_FLAG_ITERATE | H5VL_CAP_FLAG_STORAGE_SIZE | \ + H5VL_CAP_FLAG_BY_IDX | H5VL_CAP_FLAG_GET_PLIST | H5VL_CAP_FLAG_FLUSH_REFRESH | \ + H5VL_CAP_FLAG_EXTERNAL_LINKS | H5VL_CAP_FLAG_HARD_LINKS | H5VL_CAP_FLAG_SOFT_LINKS | \ + H5VL_CAP_FLAG_UD_LINKS | H5VL_CAP_FLAG_TRACK_TIMES | H5VL_CAP_FLAG_MOUNT | H5VL_CAP_FLAG_FILTERS | \ + H5VL_CAP_FLAG_FILL_VALUES) + /* Native VOL connector class struct */ static const H5VL_class_t H5VL_native_cls_g = { - H5VL_VERSION, /* VOL class struct version */ - H5VL_NATIVE_VALUE, /* value */ - H5VL_NATIVE_NAME, /* name */ - H5VL_NATIVE_VERSION, /* connector version */ - H5VL_CAP_FLAG_NATIVE_FILES, /* capability flags */ - NULL, /* initialize */ - H5VL__native_term, /* terminate */ + H5VL_VERSION, /* VOL class struct version */ + H5VL_NATIVE_VALUE, /* value */ + H5VL_NATIVE_NAME, /* name */ + H5VL_NATIVE_VERSION, /* connector version */ + H5VL_NATIVE_CAP_FLAGS, /* capability flags */ + NULL, /* initialize */ + H5VL__native_term, /* terminate */ { /* info_cls */ (size_t)0, /* info size */ @@ -189,7 +202,7 @@ H5VL_native_register(void) if (H5I_INVALID_HID == H5VL_NATIVE_ID_g) if ((H5VL_NATIVE_ID_g = H5VL__register_connector(&H5VL_native_cls_g, TRUE, H5P_VOL_INITIALIZE_DEFAULT)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, H5I_INVALID_HID, "can't create ID for native VOL connector"); /* Set return value */ ret_value = H5VL_NATIVE_ID_g; @@ -237,7 +250,7 @@ H5VL__native_introspect_get_conn_cls(void H5_ATTR_UNUSED *obj, H5VL_get_conn_lvl FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(conn_cls); + assert(conn_cls); /* Retrieve the native VOL connector class */ *conn_cls = &H5VL_native_cls_g; @@ -258,12 +271,12 @@ H5VL__native_introspect_get_conn_cls(void H5_ATTR_UNUSED *obj, H5VL_get_conn_lvl *--------------------------------------------------------------------------- */ herr_t -H5VL__native_introspect_get_cap_flags(const void H5_ATTR_UNUSED *info, unsigned *cap_flags) +H5VL__native_introspect_get_cap_flags(const void H5_ATTR_UNUSED *info, uint64_t *cap_flags) { FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ - HDassert(cap_flags); + assert(cap_flags); /* Set the flags from the connector's field */ *cap_flags = H5VL_native_cls_g.cap_flags; @@ -292,19 +305,19 @@ H5VL_native_get_file_addr_len(hid_t loc_id, size_t *addr_len) FUNC_ENTER_NOAPI(FAIL) /* check arguments */ - HDassert(addr_len); + assert(addr_len); /* Get object type */ if ((vol_obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Retrieve underlying VOL object */ if (NULL == (vol_obj = H5VL_object(loc_id))) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Retrieve file address length */ if (H5VL__native_get_file_addr_len(vol_obj, vol_obj_type, addr_len) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get file address length") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get file address length"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -330,12 +343,12 @@ H5VL__native_get_file_addr_len(void *obj, H5I_type_t obj_type, size_t *addr_len) FUNC_ENTER_NOAPI(FAIL) /* check arguments */ - HDassert(obj); - HDassert(addr_len); + assert(obj); + assert(addr_len); /* Retrieve file from the VOL object */ if (H5VL_native_get_file_struct(obj, obj_type, &file) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get file from VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get file from VOL object"); /* Get the length of an address in this file */ *addr_len = H5F_SIZEOF_ADDR(file); @@ -365,15 +378,15 @@ H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token) /* Check args */ if (NULL == token) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "token pointer can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "token pointer can't be NULL"); /* Get object type */ if ((vol_obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Retrieve underlying VOL object */ if (NULL == (vol_obj = H5VL_object(loc_id))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object"); #ifndef NDEBUG { @@ -382,20 +395,20 @@ H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token) /* Get the location object */ if (NULL == (vol_obj_container = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Make sure that the VOL object is a native connector object */ if (H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, - "can't determine if VOL object is native connector object") + "can't determine if VOL object is native connector object"); - HDassert(is_native_vol_obj && "not a native VOL connector object"); + assert(is_native_vol_obj && "not a native VOL connector object"); } #endif /* Convert the haddr_t to an object token */ if (H5VL_native_addr_to_token(vol_obj, vol_obj_type, addr, token) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "couldn't serialize haddr_t into object token") + HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "couldn't serialize haddr_t into object token"); done: FUNC_LEAVE_API(ret_value) @@ -420,15 +433,15 @@ H5VL_native_addr_to_token(void *obj, H5I_type_t obj_type, haddr_t addr, H5O_toke FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(obj); - HDassert(token); + assert(obj); + assert(token); /* Get the length of an haddr_t in the file */ if (H5VL__native_get_file_addr_len(obj, obj_type, &addr_len) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get length of haddr_t from VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get length of haddr_t from VOL object"); /* Ensure that token is initialized */ - HDmemset(token, 0, sizeof(H5O_token_t)); + memset(token, 0, sizeof(H5O_token_t)); /* Encode token */ p = (uint8_t *)token; @@ -459,15 +472,15 @@ H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr) /* Check args */ if (NULL == addr) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr pointer can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "addr pointer can't be NULL"); /* Get object type */ if ((vol_obj_type = H5I_get_type(loc_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Retrieve underlying VOL object */ if (NULL == (vol_obj = H5VL_object(loc_id))) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get underlying VOL object"); #ifndef NDEBUG { @@ -476,20 +489,20 @@ H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr) /* Get the location object */ if (NULL == (vol_obj_container = (H5VL_object_t *)H5I_object(loc_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier"); /* Make sure that the VOL object is a native connector object */ if (H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, - "can't determine if VOL object is native connector object") + "can't determine if VOL object is native connector object"); - HDassert(is_native_vol_obj && "not a native VOL connector object"); + assert(is_native_vol_obj && "not a native VOL connector object"); } #endif /* Convert the object token to an haddr_t */ if (H5VL_native_token_to_addr(vol_obj, vol_obj_type, token, addr) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "couldn't deserialize object token into haddr_t") + HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "couldn't deserialize object token into haddr_t"); done: FUNC_LEAVE_API(ret_value) @@ -514,12 +527,12 @@ H5VL_native_token_to_addr(void *obj, H5I_type_t obj_type, H5O_token_t token, had FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(obj); - HDassert(addr); + assert(obj); + assert(addr); /* Get the length of an haddr_t in the file */ if (H5VL__native_get_file_addr_len(obj, obj_type, &addr_len) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get length of haddr_t from VOL object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "couldn't get length of haddr_t from VOL object"); /* Decode token */ p = (const uint8_t *)&token; @@ -544,7 +557,7 @@ H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file) H5O_loc_t *oloc = NULL; /* Object location for ID */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL); + FUNC_ENTER_NOAPI(FAIL) *file = NULL; @@ -570,7 +583,7 @@ H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file) break; case H5I_MAP: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "maps not supported in native VOL connector"); case H5I_UNINIT: case H5I_BADID: @@ -586,7 +599,7 @@ H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file) case H5I_EVENTSET: case H5I_NTYPES: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); } /* end switch */ /* Set return value for objects (not files) */ @@ -595,7 +608,7 @@ H5VL_native_get_file_struct(void *obj, H5I_type_t type, H5F_t **file) /* Couldn't find a file struct */ if (!*file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not associated with a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "object is not associated with a file"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_attr.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_attr.c index b7e9b131a9..c41496a2e1 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_attr.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_attr.c @@ -76,50 +76,54 @@ H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const c hid_t space_id, hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { - H5G_loc_t loc; /* Object location */ - H5G_loc_t obj_loc; /* Location used to open group */ - hbool_t loc_found = FALSE; - H5T_t *type, *dt; /* Datatype to use for attribute */ - H5S_t *space; /* Dataspace to use for attribute */ - H5A_t *attr = NULL; - void *ret_value = NULL; + H5P_genplist_t *plist; + H5G_loc_t loc; /* Object location */ + H5G_loc_t obj_loc; /* Location used to open group */ + hbool_t loc_found = FALSE; + H5T_t *type, *dt; /* Datatype to use for attribute */ + H5S_t *space; /* Dataspace to use for attribute */ + H5A_t *attr = NULL; + void *ret_value = NULL; FUNC_ENTER_PACKAGE if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object"); if (0 == (H5F_INTENT(loc.oloc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, NULL, "no write intent on file") + HGOTO_ERROR(H5E_ARGS, H5E_WRITEERROR, NULL, "no write intent on file"); + + if (NULL == (plist = H5P_object_verify(aapl_id, H5P_ATTRIBUTE_ACCESS))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "AAPL is not an attribute access property list"); if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype"); /* If this is a named datatype, get the connector's pointer to the datatype */ type = H5T_get_actual_type(dt); if (NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data space") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data space"); if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Acreate */ /* Go do the real work for attaching the attribute to the dataset */ if (NULL == (attr = H5A__create(&loc, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Acreate_by_name */ if (NULL == (attr = H5A__create_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name, type, space, acpl_id))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute"); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute create parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute create parameters"); ret_value = (void *)attr; done: /* Release resources */ if (loc_found && H5G_loc_free(&obj_loc) < 0) - HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location") + HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, NULL, "can't free location"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_attr_create() */ @@ -135,30 +139,34 @@ H5VL__native_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const c *------------------------------------------------------------------------- */ void * -H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, - hid_t H5_ATTR_UNUSED aapl_id, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) +H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *attr_name, hid_t aapl_id, + hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req) { - H5G_loc_t loc; /* Object location */ - H5A_t *attr = NULL; /* Attribute opened */ - void *ret_value; + H5P_genplist_t *plist; + H5G_loc_t loc; /* Object location */ + H5A_t *attr = NULL; /* Attribute opened */ + void *ret_value; FUNC_ENTER_PACKAGE /* check arguments */ if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object"); + + if (NULL == (plist = H5P_object_verify(aapl_id, H5P_ATTRIBUTE_ACCESS))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "AAPL is not an attribute access property list"); if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aopen */ /* Open the attribute */ if (NULL == (attr = H5A__open(&loc, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute: '%s'", attr_name); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aopen_by_name */ /* Open the attribute on the object header */ if (NULL == (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute"); } /* end else-if */ else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Aopen_by_idx */ @@ -166,10 +174,10 @@ H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const cha if (NULL == (attr = H5A__open_by_idx( &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "unable to open attribute"); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute open parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown attribute open parameters"); ret_value = (void *)attr; @@ -196,11 +204,11 @@ H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t H5_ATTR_UNUS FUNC_ENTER_PACKAGE if (NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Go write the actual data to the attribute */ if ((ret_value = H5A__read((H5A_t *)attr, mem_type, buf)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") + HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -225,11 +233,11 @@ H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t H5_AT FUNC_ENTER_PACKAGE if (NULL == (mem_type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Go write the actual data to the attribute */ if ((ret_value = H5A__write((H5A_t *)attr, mem_type, buf)) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") + HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -258,7 +266,7 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t H5_ATTR_UNUSE H5A_t *attr = (H5A_t *)obj; if ((args->args.get_space.space_id = H5A_get_space(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute"); break; } @@ -267,7 +275,7 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t H5_ATTR_UNUSE H5A_t *attr = (H5A_t *)obj; if ((args->args.get_type.type_id = H5A__get_type(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute"); break; } @@ -276,7 +284,7 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t H5_ATTR_UNUSE H5A_t *attr = (H5A_t *)obj; if ((args->args.get_acpl.acpl_id = H5A__get_create_plist(attr)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr"); break; } @@ -288,7 +296,7 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t H5_ATTR_UNUSE if (H5VL_OBJECT_BY_SELF == get_name_args->loc_params.type) { if (H5A__get_name((H5A_t *)obj, get_name_args->buf_size, get_name_args->buf, get_name_args->attr_name_len) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name"); } else if (H5VL_OBJECT_BY_IDX == get_name_args->loc_params.type) { H5G_loc_t loc; @@ -296,14 +304,14 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t H5_ATTR_UNUSE /* check arguments */ if (H5G_loc_real(obj, get_name_args->loc_params.obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Open the attribute on the object header */ if (NULL == (attr = H5A__open_by_idx(&loc, get_name_args->loc_params.loc_data.loc_by_idx.name, get_name_args->loc_params.loc_data.loc_by_idx.idx_type, get_name_args->loc_params.loc_data.loc_by_idx.order, get_name_args->loc_params.loc_data.loc_by_idx.n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute"); /* Get the length of the name */ *get_name_args->attr_name_len = HDstrlen(attr->shared->name); @@ -318,10 +326,10 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t H5_ATTR_UNUSE /* Release resources */ if (attr && H5A__close(attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute"); } else - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr"); break; } @@ -334,53 +342,53 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t H5_ATTR_UNUSE if (H5VL_OBJECT_BY_SELF == get_info_args->loc_params.type) { attr = (H5A_t *)obj; if (H5A__get_info(attr, get_info_args->ainfo) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get attribute info") + HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get attribute info"); } else if (H5VL_OBJECT_BY_NAME == get_info_args->loc_params.type) { H5G_loc_t loc; /* check arguments */ if (H5G_loc_real(obj, get_info_args->loc_params.obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Open the attribute on the object header */ if (NULL == (attr = H5A__open_by_name(&loc, get_info_args->loc_params.loc_data.loc_by_name.name, get_info_args->attr_name))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute"); /* Get the attribute information */ if (H5A__get_info(attr, get_info_args->ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info"); /* Release resources */ if (attr && H5A__close(attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute"); } else if (H5VL_OBJECT_BY_IDX == get_info_args->loc_params.type) { H5G_loc_t loc; /* check arguments */ if (H5G_loc_real(obj, get_info_args->loc_params.obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Open the attribute on the object header */ if (NULL == (attr = H5A__open_by_idx(&loc, get_info_args->loc_params.loc_data.loc_by_idx.name, get_info_args->loc_params.loc_data.loc_by_idx.idx_type, get_info_args->loc_params.loc_data.loc_by_idx.order, get_info_args->loc_params.loc_data.loc_by_idx.n))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute"); /* Get the attribute information */ if (H5A__get_info(attr, get_info_args->ainfo) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info"); /* Release resources */ if (attr && H5A__close(attr) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute"); } else - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr"); break; } @@ -394,7 +402,7 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t H5_ATTR_UNUSE } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr"); } /* end switch */ done: @@ -421,7 +429,7 @@ H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ /* Get location for passed-in object */ if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); switch (args->op_type) { /* H5Adelete/delete_by_name */ @@ -429,15 +437,15 @@ H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ if (H5VL_OBJECT_BY_SELF == loc_params->type) { /* Delete the attribute from the location */ if (H5O__attr_remove(loc.oloc, args->args.del.name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); } /* end if */ else if (H5VL_OBJECT_BY_NAME == loc_params->type) { /* Delete the attribute */ if (H5A__delete_by_name(&loc, loc_params->loc_data.loc_by_name.name, args->args.del.name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute delete location") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute delete location"); break; } @@ -450,10 +458,10 @@ H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ /* Delete the attribute from the location */ if (H5A__delete_by_idx(&loc, loc_params->loc_data.loc_by_name.name, del_by_idx_args->idx_type, del_by_idx_args->order, del_by_idx_args->n) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute"); } /* end if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute delete_by_idx location") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute delete_by_idx location"); break; } @@ -462,16 +470,16 @@ H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* Check if the attribute exists */ if (H5O__attr_exists(loc.oloc, args->args.exists.name, args->args.exists.exists) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* Check if the attribute exists */ if (H5A__exists_by_name(loc, loc_params->loc_data.loc_by_name.name, args->args.exists.name, args->args.exists.exists) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") + HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists"); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters"); break; } @@ -487,7 +495,7 @@ H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ else if (loc_params->type == H5VL_OBJECT_BY_NAME) /* H5Aiterate_by_name */ loc_name = loc_params->loc_data.loc_by_name.name; else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unsupported location type") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unsupported location type"); /* Iterate over attributes */ if ((ret_value = H5A__iterate(&loc, loc_name, iter_args->idx_type, iter_args->order, @@ -501,21 +509,21 @@ H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Arename */ /* Call attribute rename routine */ if (H5O__attr_rename(loc.oloc, args->args.rename.old_name, args->args.rename.new_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */ /* Call attribute rename routine */ if (H5A__rename_by_name(loc, loc_params->loc_data.loc_by_name.name, args->args.rename.old_name, args->args.rename.new_name) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") + HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute"); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute rename parameters"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation"); } /* end switch */ done: @@ -557,7 +565,7 @@ H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, H5VL_optional_args_t *args, #endif /* H5_NO_DEPRECATED_SYMBOLS */ default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation"); } /* end switch */ done: @@ -582,7 +590,7 @@ H5VL__native_attr_close(void *attr, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_U FUNC_ENTER_PACKAGE if (H5A__close((H5A_t *)attr) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close attribute") + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close attribute"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_blob.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_blob.c index 606bdeb4e2..6aebc014be 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_blob.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_blob.c @@ -54,9 +54,6 @@ * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, August 15, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -70,13 +67,13 @@ H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, vo FUNC_ENTER_PACKAGE /* Check parameters */ - HDassert(f); - HDassert(size == 0 || buf); - HDassert(id); + assert(f); + assert(size == 0 || buf); + assert(id); /* Write the VL information to disk (allocates space also) */ if (H5HG_insert(f, size, buf, &hobjid) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write blob information") + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write blob information"); /* Encode the heap information */ H5F_addr_encode(f, &id, hobjid.addr); @@ -93,9 +90,6 @@ H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, vo * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, August 15, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -110,9 +104,9 @@ H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, vo FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(id); - HDassert(buf); + assert(f); + assert(id); + assert(buf); /* Get the heap information */ H5F_addr_decode(f, &id, &hobjid.addr); @@ -122,11 +116,11 @@ H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, vo if (hobjid.addr > 0) /* Read the VL information from disk */ if (NULL == H5HG_read(f, &hobjid, buf, &hobj_size)) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read VL information") + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read VL information"); /* Verify the size is correct */ if (hobj_size != size) - HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "Expected global heap object size does not match") + HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "Expected global heap object size does not match"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -139,9 +133,6 @@ H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, vo * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Friday, August 15, 2019 - * *------------------------------------------------------------------------- */ herr_t @@ -153,8 +144,8 @@ H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t * FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(f); - HDassert(blob_id); + assert(f); + assert(blob_id); switch (args->op_type) { case H5VL_BLOB_ISNULL: { @@ -191,13 +182,13 @@ H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t * /* Free heap object */ if (hobjid.addr > 0) if (H5HG_remove(f, &hobjid) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object") + HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation"); } /* end switch */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_dataset.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_dataset.c index 26daa83c8d..92a224908f 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_dataset.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_dataset.c @@ -31,6 +31,7 @@ #include "H5Fprivate.h" /* Files */ #include "H5Gprivate.h" /* Groups */ #include "H5Iprivate.h" /* IDs */ +#include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5Sprivate.h" /* Dataspaces */ #include "H5VLprivate.h" /* Virtual Object Layer */ @@ -50,8 +51,11 @@ /********************/ /* Helper routines for read/write API calls */ -static herr_t H5VL__native_dataset_io_setup(H5D_t *dset, hid_t dxpl_id, hid_t file_space_id, - hid_t mem_space_id, H5S_t **file_space, H5S_t **mem_space); +static herr_t H5VL__native_dataset_io_setup(size_t count, void *obj[], hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t dxpl_id, + H5_flexible_const_ptr_t buf[], H5D_dset_io_info_t *dinfo); +static herr_t H5VL__native_dataset_io_cleanup(size_t count, hid_t mem_space_id[], hid_t file_space_id[], + H5D_dset_io_info_t *dinfo); /*********************/ /* Package Variables */ @@ -75,90 +79,155 @@ static herr_t H5VL__native_dataset_io_setup(H5D_t *dset, hid_t dxpl_id, hid_t fi *------------------------------------------------------------------------- */ static herr_t -H5VL__native_dataset_io_setup(H5D_t *dset, hid_t dxpl_id, hid_t file_space_id, hid_t mem_space_id, - H5S_t **file_space, H5S_t **mem_space) +H5VL__native_dataset_io_setup(size_t count, void *obj[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, H5_flexible_const_ptr_t buf[], + H5D_dset_io_info_t *dinfo) { - herr_t ret_value = SUCCEED; /* Return value */ + H5F_shared_t *f_sh; + size_t i; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(dset); - HDassert(file_space && NULL == *file_space); - HDassert(mem_space && NULL == *mem_space); - - /* Set up file dataspace */ - if (H5S_ALL == file_space_id) - /* Use dataspace for dataset */ - *file_space = dset->shared->space; - else if (H5S_BLOCK == file_space_id) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "H5S_BLOCK is not allowed for file dataspace") - else if (H5S_PLIST == file_space_id) { - H5P_genplist_t *plist; /* Property list pointer */ - H5S_t *space; /* Dataspace to hold selection */ - - /* Get the plist structure */ - if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) - HGOTO_ERROR(H5E_DATASET, H5E_BADID, FAIL, "bad dataset transfer property list") - - /* See if a dataset I/O selection is already set, and free it if it is */ - if (H5P_peek(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting dataset I/O selection") - - /* Use dataspace for dataset */ - *file_space = dset->shared->space; - - /* Copy, but share, selection from property list to dataset's dataspace */ - if (H5S_SELECT_COPY(*file_space, space, TRUE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataset I/O selection") - } /* end else-if */ - else { - /* Get the dataspace pointer */ - if (NULL == (*file_space = (H5S_t *)H5I_object_verify(file_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "file_space_id is not a dataspace ID") - } /* end else */ - - /* Get dataspace for memory buffer */ - if (H5S_ALL == mem_space_id) - *mem_space = *file_space; - else if (H5S_BLOCK == mem_space_id) { - hsize_t nelmts; /* # of selected elements in file */ - - /* Get the # of elements selected */ - nelmts = H5S_GET_SELECT_NPOINTS(*file_space); + assert(dinfo); + + /* Get shared file */ + f_sh = H5F_SHARED(((H5D_t *)obj[0])->oloc.file); + + /* Iterate over datasets */ + for (i = 0; i < count; i++) { + /* Set up dset */ + dinfo[i].dset = (H5D_t *)obj[i]; + assert(dinfo[i].dset); + + /* Check dataset's file pointer is valid */ + if (NULL == dinfo[i].dset->oloc.file) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file"); + if (f_sh != H5F_SHARED(dinfo[i].dset->oloc.file)) + HGOTO_ERROR(H5E_ARGS, H5E_UNSUPPORTED, FAIL, + "different files detected in multi dataset I/O request"); + + /* Set up memory type */ + dinfo[i].mem_type_id = mem_type_id[i]; + + /* Set up file dataspace */ + if (H5S_ALL == file_space_id[i]) + /* Use dataspace for dataset */ + dinfo[i].file_space = dinfo[i].dset->shared->space; + else if (H5S_BLOCK == file_space_id[i]) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "H5S_BLOCK is not allowed for file dataspace"); + else if (H5S_PLIST == file_space_id[i]) { + H5P_genplist_t *plist; /* Property list pointer */ + H5S_t *space; /* Dataspace to hold selection */ + + /* Get the plist structure */ + if (NULL == (plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_DATASET, H5E_BADID, FAIL, "bad dataset transfer property list"); + + /* Get a pointer to the file space in the property list */ + if (H5P_peek(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting dataset I/O selection"); + + /* Use dataspace for dataset */ + dinfo[i].file_space = dinfo[i].dset->shared->space; + + /* Copy, but share, selection from property list to dataset's dataspace */ + if (H5S_SELECT_COPY(dinfo[i].file_space, space, TRUE) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dataset I/O selection"); + } /* end else-if */ + else { + /* Get the dataspace pointer */ + if (NULL == (dinfo[i].file_space = (H5S_t *)H5I_object_verify(file_space_id[i], H5I_DATASPACE))) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "file_space_id is not a dataspace ID"); + } /* end else */ - /* Check for any elements */ - if (nelmts > 0) { - /* Create a 1-D dataspace of the same # of elements */ - if (NULL == (*mem_space = H5S_create_simple(1, &nelmts, NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create simple memory dataspace") - } /* end if */ + /* Get dataspace for memory buffer */ + if (H5S_ALL == mem_space_id[i]) + dinfo[i].mem_space = dinfo[i].file_space; + else if (H5S_BLOCK == mem_space_id[i]) { + hsize_t nelmts; /* # of selected elements in file */ + + /* Get the # of elements selected */ + nelmts = H5S_GET_SELECT_NPOINTS(dinfo[i].file_space); + + /* Check for any elements */ + if (nelmts > 0) { + /* Create a 1-D dataspace of the same # of elements */ + if (NULL == (dinfo[i].mem_space = H5S_create_simple(1, &nelmts, NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, + "unable to create simple memory dataspace"); + } /* end if */ + else { + /* Create a NULL dataspace of the same # of elements */ + if (NULL == (dinfo[i].mem_space = H5S_create(H5S_NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create NULL memory dataspace"); + } /* end else */ + } /* end if */ + else if (H5S_PLIST == mem_space_id[i]) + HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "H5S_PLIST is not allowed for memory dataspace"); else { - /* Create a NULL dataspace of the same # of elements */ - if (NULL == (*mem_space = H5S_create(H5S_NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "unable to create NULL memory dataspace") + /* Get the dataspace pointer */ + if (NULL == (dinfo[i].mem_space = (H5S_t *)H5I_object_verify(mem_space_id[i], H5I_DATASPACE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "mem_space_id is not a dataspace ID"); } /* end else */ - } /* end if */ - else if (H5S_PLIST == mem_space_id) - HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "H5S_PLIST is not allowed for memory dataspace") - else { - /* Get the dataspace pointer */ - if (NULL == (*mem_space = (H5S_t *)H5I_object_verify(mem_space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "mem_space_id is not a dataspace ID") - } /* end else */ - /* Check for valid selections */ - if (H5S_SELECT_VALID(*file_space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, - "selection + offset not within extent for file dataspace") - if (H5S_SELECT_VALID(*mem_space) != TRUE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, - "selection + offset not within extent for memory dataspace") + /* Check for valid selections */ + if (H5S_SELECT_VALID(dinfo[i].file_space) != TRUE) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, + "selection + offset not within extent for file dataspace"); + if (H5S_SELECT_VALID(dinfo[i].mem_space) != TRUE) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, + "selection + offset not within extent for memory dataspace"); + + /* Set up buf */ + dinfo[i].buf = buf[i]; + } done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_dataset_io_setup() */ +/*------------------------------------------------------------------------- + * Function: H5VL__native_dataset_io_cleanup + * + * Purpose: Frees memory allocated by H5VL__native_dataset_io_setup() + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__native_dataset_io_cleanup(size_t count, hid_t mem_space_id[], hid_t file_space_id[], + H5D_dset_io_info_t *dinfo) +{ + size_t i; + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity checks */ + assert(dinfo); + + /* Iterate over datasets */ + for (i = 0; i < count; i++) { + /* Free memory dataspace if it was created. Use HDONE_ERROR in this function so we always + * try to free everything we can. */ + if (H5S_BLOCK == mem_space_id[i] && dinfo[i].mem_space) + if (H5S_close(dinfo[i].mem_space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, + "unable to release temporary memory dataspace for H5S_BLOCK"); + + /* Reset file dataspace selection if it was copied from the property list */ + if (H5S_PLIST == file_space_id[i] && dinfo[i].file_space) + if (H5S_select_all(dinfo[i].file_space, TRUE) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, + "unable to release file dataspace selection for H5S_PLIST"); + } + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__native_dataset_io_cleanup() */ + /*------------------------------------------------------------------------- * Function: H5VL__native_dataset_create * @@ -183,23 +252,23 @@ H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, cons /* Check arguments */ if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object"); if (H5I_DATATYPE != H5I_get_type(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype ID"); if (NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a dataspace ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a dataspace ID"); /* H5Dcreate_anon */ if (NULL == name) { /* build and open the new dataset */ if (NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset"); } /* end if */ /* H5Dcreate2 */ else { /* Create the new dataset & get its ID */ if (NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset"); } /* end else */ ret_value = (void *)dset; @@ -212,12 +281,12 @@ H5VL__native_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, cons /* Get the new dataset's object location */ if (NULL == (oloc = H5D_oloc(dset))) - HDONE_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get object location of dataset") + HDONE_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "unable to get object location of dataset"); /* Decrement refcount on dataset's object header in memory */ if (H5O_dec_rc_by_loc(oloc) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, - "unable to decrement refcount on newly created object") + "unable to decrement refcount on newly created object"); } /* end if */ } /* end if */ @@ -245,11 +314,11 @@ H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const FUNC_ENTER_PACKAGE if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object"); /* Open the dataset */ if (NULL == (dset = H5D__open_name(&loc, name, dapl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "unable to open dataset"); ret_value = (void *)dset; @@ -267,43 +336,39 @@ H5VL__native_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const *------------------------------------------------------------------------- */ herr_t -H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t dxpl_id, void *buf, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_read(size_t count, void *obj[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, void *buf[], void H5_ATTR_UNUSED **req) { - H5D_t *dset = (H5D_t *)obj; - H5S_t *mem_space = NULL; - H5S_t *file_space = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + H5D_dset_io_info_t dinfo_local; + H5D_dset_io_info_t *dinfo = &dinfo_local; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - /* Check arguments */ - if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + /* Allocate dataset info array if necessary */ + if (count > 1) + if (NULL == (dinfo = (H5D_dset_io_info_t *)H5MM_malloc(count * sizeof(H5D_dset_io_info_t)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate dset info array buffer"); /* Get file & memory dataspaces */ - if (H5VL__native_dataset_io_setup(dset, dxpl_id, file_space_id, mem_space_id, &file_space, &mem_space) < - 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up file and memory dataspaces") + if (H5VL__native_dataset_io_setup(count, obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, + (H5_flexible_const_ptr_t *)buf, dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up file and memory dataspaces"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Read raw data */ - if (H5D__read(dset, mem_type_id, mem_space, file_space, buf /*out*/) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data") + /* Read raw data. Call H5D__read directly in single dset case. */ + if (H5D__read(count, dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read data"); done: /* Clean up */ - if (H5S_BLOCK == mem_space_id && mem_space) { - if (H5S_close(mem_space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, - "unable to release temporary memory dataspace for H5S_BLOCK") - } /* end if */ - else if (H5S_PLIST == file_space_id && file_space) - if (H5S_select_all(file_space, TRUE) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, - "unable to release file dataspace selection for H5S_PLIST") + if (H5VL__native_dataset_io_cleanup(count, mem_space_id, file_space_id, dinfo) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataset info"); + + if (dinfo != &dinfo_local) + H5MM_xfree(dinfo); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_dataset_read() */ @@ -318,43 +383,39 @@ H5VL__native_dataset_read(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_ *------------------------------------------------------------------------- */ herr_t -H5VL__native_dataset_write(void *obj, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t dxpl_id, const void *buf, void H5_ATTR_UNUSED **req) +H5VL__native_dataset_write(size_t count, void *obj[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t dxpl_id, const void *buf[], void H5_ATTR_UNUSED **req) { - H5D_t *dset = (H5D_t *)obj; - H5S_t *mem_space = NULL; - H5S_t *file_space = NULL; - herr_t ret_value = SUCCEED; /* Return value */ + H5D_dset_io_info_t dinfo_local; + H5D_dset_io_info_t *dinfo = &dinfo_local; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE - /* check arguments */ - if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + /* Allocate dataset info array if necessary */ + if (count > 1) + if (NULL == (dinfo = (H5D_dset_io_info_t *)H5MM_malloc(count * sizeof(H5D_dset_io_info_t)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate dset info array buffer"); /* Get file & memory dataspaces */ - if (H5VL__native_dataset_io_setup(dset, dxpl_id, file_space_id, mem_space_id, &file_space, &mem_space) < - 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up file and memory dataspaces") + if (H5VL__native_dataset_io_setup(count, obj, mem_type_id, mem_space_id, file_space_id, dxpl_id, + (H5_flexible_const_ptr_t *)buf, dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up file and memory dataspaces"); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); - /* Write the data */ - if (H5D__write(dset, mem_type_id, mem_space, file_space, buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") + /* Write raw data. Call H5D__write directly in single dset case. */ + if (H5D__write(count, dinfo) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data"); done: /* Clean up */ - if (H5S_BLOCK == mem_space_id && mem_space) { - if (H5S_close(mem_space) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, - "unable to release temporary memory dataspace for H5S_BLOCK") - } /* end if */ - else if (H5S_PLIST == file_space_id && file_space) - if (H5S_select_all(file_space, TRUE) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, - "unable to release file dataspace selection for H5S_PLIST") + if (H5VL__native_dataset_io_cleanup(count, mem_space_id, file_space_id, dinfo) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to release dataset info"); + + if (dinfo != &dinfo_local) + H5MM_xfree(dinfo); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_dataset_write() */ @@ -381,7 +442,7 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_args_t *args, hid_t H5_ATTR /* H5Dget_space */ case H5VL_DATASET_GET_SPACE: { if ((args->args.get_space.space_id = H5D__get_space(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get space ID of dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get space ID of dataset"); break; } @@ -389,7 +450,7 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_args_t *args, hid_t H5_ATTR /* H5Dget_space_status */ case H5VL_DATASET_GET_SPACE_STATUS: { if (H5D__get_space_status(dset, args->args.get_space_status.status) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status"); break; } @@ -397,7 +458,7 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_args_t *args, hid_t H5_ATTR /* H5Dget_type */ case H5VL_DATASET_GET_TYPE: { if ((args->args.get_type.type_id = H5D__get_type(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype ID of dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype ID of dataset"); break; } @@ -405,7 +466,7 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_args_t *args, hid_t H5_ATTR /* H5Dget_create_plist */ case H5VL_DATASET_GET_DCPL: { if ((args->args.get_dcpl.dcpl_id = H5D_get_create_plist(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get creation property list for dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get creation property list for dataset"); break; } @@ -413,7 +474,7 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_args_t *args, hid_t H5_ATTR /* H5Dget_access_plist */ case H5VL_DATASET_GET_DAPL: { if ((args->args.get_dapl.dapl_id = H5D_get_access_plist(dset)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get access property list for dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get access property list for dataset"); break; } @@ -421,12 +482,12 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_args_t *args, hid_t H5_ATTR /* H5Dget_storage_size */ case H5VL_DATASET_GET_STORAGE_SIZE: { if (H5D__get_storage_size(dset, args->args.get_storage_size.storage_size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset"); } /* end switch */ done: @@ -455,14 +516,14 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid /* H5Dset_extent (H5Dextend - deprecated) */ case H5VL_DATASET_SET_EXTENT: { if (H5D__set_extent(dset, args->args.set_extent.size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set extent of dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set extent of dataset"); break; } /* H5Dflush */ case H5VL_DATASET_FLUSH: { if (H5D__flush(dset, args->args.flush.dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset"); break; } @@ -470,13 +531,13 @@ H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid /* H5Drefresh */ case H5VL_DATASET_REFRESH: { if (H5D__refresh(dset, args->args.refresh.dset_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation"); } /* end switch */ done: @@ -502,7 +563,7 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(dset); + assert(dset); /* Set DXPL for operation */ H5CX_set_dxpl(dxpl_id); @@ -516,7 +577,7 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ if (dset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE) if (H5D__format_convert(dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, - "unable to downgrade chunk indexing type for dataset") + "unable to downgrade chunk indexing type for dataset"); break; case H5D_CONTIGUOUS: @@ -525,7 +586,7 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ if (dset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT) if (H5D__format_convert(dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, - "unable to downgrade layout version for dataset") + "unable to downgrade layout version for dataset"); break; case H5D_VIRTUAL: @@ -534,10 +595,10 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ case H5D_LAYOUT_ERROR: case H5D_NLAYOUTS: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset layout type"); default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown dataset layout type"); } /* end switch */ break; @@ -547,7 +608,7 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE: { /* Make sure the dataset is chunked */ if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset"); /* Get the chunk indexing type */ *opt_args->get_chunk_idx_type.idx_type = dset->shared->layout.u.chunk.idx_type; @@ -561,11 +622,11 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ /* Make sure the dataset is chunked */ if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset"); /* Call private function */ if (H5D__get_chunk_storage_size(dset, gcss_args->offset, gcss_args->size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk"); break; } @@ -575,23 +636,23 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ H5VL_native_dataset_get_num_chunks_t *gnc_args = &opt_args->get_num_chunks; const H5S_t *space = NULL; - HDassert(dset->shared); - HDassert(dset->shared->space); + assert(dset->shared); + assert(dset->shared->space); /* When default dataspace is given, use the dataset's dataspace */ if (gnc_args->space_id == H5S_ALL) space = dset->shared->space; else /* otherwise, use the given space ID */ if (NULL == (space = (const H5S_t *)H5I_object_verify(gnc_args->space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID"); /* Make sure the dataset is chunked */ if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset"); /* Call private function */ if (H5D__get_num_chunks(dset, space, gnc_args->nchunks) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks"); break; } @@ -601,24 +662,24 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ H5VL_native_dataset_get_chunk_info_by_idx_t *gcibi_args = &opt_args->get_chunk_info_by_idx; const H5S_t *space; - HDassert(dset->shared); - HDassert(dset->shared->space); + assert(dset->shared); + assert(dset->shared->space); /* When default dataspace is given, use the dataset's dataspace */ if (gcibi_args->space_id == H5S_ALL) space = dset->shared->space; else /* otherwise, use the given space ID */ if (NULL == (space = (const H5S_t *)H5I_object_verify(gcibi_args->space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID"); /* Make sure the dataset is chunked */ if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset"); /* Call private function */ if (H5D__get_chunk_info(dset, space, gcibi_args->chk_index, gcibi_args->offset, gcibi_args->filter_mask, gcibi_args->addr, gcibi_args->size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index"); break; } @@ -627,16 +688,17 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD: { H5VL_native_dataset_get_chunk_info_by_coord_t *gcibc_args = &opt_args->get_chunk_info_by_coord; - HDassert(dset->shared); + assert(dset->shared); /* Make sure the dataset is chunked */ if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset"); /* Call private function */ if (H5D__get_chunk_info_by_coord(dset, gcibc_args->offset, gcibc_args->filter_mask, gcibc_args->addr, gcibc_args->size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by its logical coordinates") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, + "can't get chunk info by its logical coordinates"); break; } @@ -648,20 +710,20 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ /* Check arguments */ if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file"); if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset"); /* Copy the user's offset array so we can be sure it's terminated properly. * (we don't want to mess with the user's buffer). */ if (H5D__chunk_get_offset_copy(dset, chunk_read_args->offset, offset_copy) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "failure to copy offset array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "failure to copy offset array"); /* Read the raw chunk */ if (H5D__chunk_direct_read(dset, offset_copy, &chunk_read_args->filters, chunk_read_args->buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data") + HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data"); break; } @@ -673,20 +735,20 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ /* Check arguments */ if (NULL == dset->oloc.file) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not associated with a file"); if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset"); /* Copy the user's offset array so we can be sure it's terminated properly. * (we don't want to mess with the user's buffer). */ if (H5D__chunk_get_offset_copy(dset, chunk_write_args->offset, offset_copy) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "failure to copy offset array") + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "failure to copy offset array"); /* Write chunk */ if (H5D__chunk_direct_write(dset, chunk_write_args->filters, offset_copy, chunk_write_args->size, chunk_write_args->buf) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data") + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data"); break; } @@ -696,7 +758,7 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ H5VL_native_dataset_get_vlen_buf_size_t *gvbs_args = &opt_args->get_vlen_buf_size; if (H5D__vlen_get_buf_size(dset, gvbs_args->type_id, gvbs_args->space_id, gvbs_args->size) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of vlen buf needed") + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of vlen buf needed"); break; } @@ -711,11 +773,11 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ /* H5Dchunk_iter */ case H5VL_NATIVE_DATASET_CHUNK_ITER: { /* Sanity check */ - HDassert(dset->shared); + assert(dset->shared); /* Make sure the dataset is chunked */ if (H5D_CHUNKED != dset->shared->layout.type) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset"); /* Call private function */ if ((ret_value = H5D__chunk_iter(dset, opt_args->chunk_iter.op, opt_args->chunk_iter.op_data)) < @@ -726,7 +788,7 @@ H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_ } default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation"); } /* end switch */ done: @@ -751,7 +813,7 @@ H5VL__native_dataset_close(void *dset, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATT FUNC_ENTER_PACKAGE if (H5D_close((H5D_t *)dset) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close dataset") + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close dataset"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_datatype.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_datatype.c index ad62ae606f..b2451d749b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_datatype.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_datatype.c @@ -83,23 +83,23 @@ H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, con /* check arguments */ if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object"); if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a datatype"); /* Check arguments. We cannot commit an immutable type because H5Tclose() * normally fails on such types (try H5Tclose(H5T_NATIVE_INT)) but closing * a named type should always succeed. */ if (H5T_STATE_NAMED == dt->shared->state || H5T_STATE_OPEN == dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is already committed") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is already committed"); if (H5T_STATE_IMMUTABLE == dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is immutable") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "datatype is immutable"); /* Check for a "sensible" datatype to store on disk */ if (H5T_is_sensible(dt) <= 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "datatype is not sensible"); /* Copy the datatype - the copied one will be the type that is * committed, and attached to original datatype above the VOL @@ -112,12 +112,12 @@ H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, con if (NULL != name) { /* H5Tcommit */ if (H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype"); } /* end if */ else { /* H5Tcommit_anon */ if (H5T__commit_anon(loc.oloc->file, type, tcpl_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to commit datatype"); } /* end else */ ret_value = (void *)type; @@ -151,11 +151,11 @@ H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const FUNC_ENTER_PACKAGE if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object"); /* Open the datatype */ if (NULL == (type = H5T__open_name(&loc, name))) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPENOBJ, NULL, "unable to open named datatype"); type->vol_obj = NULL; @@ -187,7 +187,7 @@ H5VL__native_datatype_get(void *obj, H5VL_datatype_get_args_t *args, hid_t H5_AT /* H5T_construct_datatype (library private routine) */ case H5VL_DATATYPE_GET_BINARY_SIZE: { if (H5T_encode(dt, NULL, args->args.get_binary_size.size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't determine serialized length of datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't determine serialized length of datatype"); break; } @@ -195,7 +195,7 @@ H5VL__native_datatype_get(void *obj, H5VL_datatype_get_args_t *args, hid_t H5_AT /* H5T_construct_datatype (library private routine) */ case H5VL_DATATYPE_GET_BINARY: { if (H5T_encode(dt, args->args.get_binary.buf, &args->args.get_binary.buf_size) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSERIALIZE, FAIL, "can't serialize datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSERIALIZE, FAIL, "can't serialize datatype"); break; } @@ -209,7 +209,7 @@ H5VL__native_datatype_get(void *obj, H5VL_datatype_get_args_t *args, hid_t H5_AT } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype"); } /* end switch */ done: @@ -240,10 +240,10 @@ H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_args_t *args, h /* Currently, H6Oflush causes H5Fclose to trigger an assertion failure in metadata cache. * Leave this situation for the future solution */ if (H5F_HAS_FEATURE(dt->oloc.file, H5FD_FEAT_HAS_MPI)) - HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "H5Oflush isn't supported for parallel") + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "H5Oflush isn't supported for parallel"); if (H5O_flush_common(&dt->oloc, args->args.flush.type_id) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype"); break; } @@ -251,13 +251,13 @@ H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_args_t *args, h /* H5VL_DATATYPE_REFRESH */ case H5VL_DATATYPE_REFRESH: { if ((H5O_refresh_metadata(&dt->oloc, args->args.refresh.type_id)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype") + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation"); } /* end switch */ done: @@ -282,7 +282,7 @@ H5VL__native_datatype_close(void *dt, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR FUNC_ENTER_PACKAGE if (H5T_close((H5T_t *)dt) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close datatype") + HGOTO_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "can't close datatype"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_file.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_file.c index 907a12dedc..56cfae20f3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_file.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_file.c @@ -91,7 +91,7 @@ H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t /* Create the file */ if (NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file"); new_file->id_exists = TRUE; ret_value = (void *)new_file; @@ -99,7 +99,7 @@ H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t done: if (NULL == ret_value && new_file) if (H5F__close(new_file) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_file_create() */ @@ -125,14 +125,14 @@ H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5 /* Open the file */ if (NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file"); new_file->id_exists = TRUE; ret_value = (void *)new_file; done: if (NULL == ret_value && new_file && H5F_try_close(new_file, NULL) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file") + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "problems closing file"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_file_open() */ @@ -159,7 +159,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_args_t *args, hid_t H5_ATTR_UNUSE /* "get container info" */ case H5VL_FILE_GET_CONT_INFO: { if (H5F__get_cont_info((H5F_t *)obj, args->args.get_cont_info.info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file container info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file container info"); break; } @@ -167,7 +167,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_args_t *args, hid_t H5_ATTR_UNUSE /* H5Fget_access_plist */ case H5VL_FILE_GET_FAPL: { if ((args->args.get_fapl.fapl_id = H5F_get_access_plist((H5F_t *)obj, TRUE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file access property list") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file access property list"); break; } @@ -178,11 +178,11 @@ H5VL__native_file_get(void *obj, H5VL_file_get_args_t *args, hid_t H5_ATTR_UNUSE f = (H5F_t *)obj; if (NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); /* Create the property list object to return */ if ((args->args.get_fcpl.fcpl_id = H5P_copy_plist(plist, TRUE)) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file creation properties") + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file creation properties"); break; } @@ -228,7 +228,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_args_t *args, hid_t H5_ATTR_UNUSE H5VL_file_get_name_args_t *file_args = &args->args.get_name; if (H5VL_native_get_file_struct(obj, file_args->type, &f) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Get length of file name */ *file_args->file_name_len = HDstrlen(H5F_OPEN_NAME(f)); @@ -248,7 +248,7 @@ H5VL__native_file_get(void *obj, H5VL_file_get_args_t *args, hid_t H5_ATTR_UNUSE case H5VL_FILE_GET_OBJ_COUNT: { if (H5F_get_obj_count((H5F_t *)obj, args->args.get_obj_count.types, TRUE, args->args.get_obj_count.count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve object count") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve object count"); break; } @@ -259,13 +259,13 @@ H5VL__native_file_get(void *obj, H5VL_file_get_args_t *args, hid_t H5_ATTR_UNUSE if (H5F_get_obj_ids((H5F_t *)obj, file_args->types, file_args->max_objs, file_args->oid_list, TRUE, file_args->count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve object IDs") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve object IDs"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information"); } /* end switch */ done: @@ -296,7 +296,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t H5_ /* Get the file for the object */ if (H5VL_native_get_file_struct(obj, args->args.flush.obj_type, &f) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Nothing to do if the file is read only. This determination is * made at the shared open(2) flags level, implying that opening a @@ -309,13 +309,13 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t H5_ if (H5F_SCOPE_GLOBAL == args->args.flush.scope) { /* Call the flush routine for mounted file hierarchies */ if (H5F_flush_mounts(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy") + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy"); } /* end if */ else { /* Call the flush routine, for this file */ if (H5F__flush(f) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, - "unable to flush file's cached information") + "unable to flush file's cached information"); } /* end else */ } /* end if */ @@ -328,7 +328,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t H5_ /* Reopen the file through the VOL connector */ if (NULL == (new_file = H5F__reopen((H5F_t *)obj))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file"); new_file->id_exists = TRUE; /* Set 'out' value */ @@ -343,7 +343,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t H5_ if ((result = H5F__is_hdf5(args->args.is_accessible.filename, args->args.is_accessible.fapl_id)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "error in HDF5 file check") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "error in HDF5 file check"); /* Set 'out' value */ *args->args.is_accessible.accessible = (hbool_t)result; @@ -354,7 +354,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t H5_ /* H5Fdelete */ case H5VL_FILE_DELETE: { if (H5F__delete(args->args.del.filename, args->args.del.fapl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "error in HDF5 file deletion") + HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "error in HDF5 file deletion"); break; } @@ -371,7 +371,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t H5_ } default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation"); } /* end switch */ done: @@ -405,7 +405,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Get the actual file size & base address */ if (H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa "); base_addr = H5FD_get_base_addr(f->shared->lf); /* Convert relative base address for file to absolute address */ @@ -420,7 +420,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Get file image */ if (H5F__get_file_image(f, gfi_args->buf, gfi_args->buf_size, gfi_args->image_len) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed"); break; } @@ -431,7 +431,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Get the actual amount of free space in the file */ if (H5MF_get_freespace(f, gfs_args->size, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file"); break; } @@ -443,7 +443,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Go get the free-space section information in the file */ if (H5MF_get_free_sections(f, gfs_args->type, gfs_args->nsects, gfs_args->sect_info, gfs_args->sect_count) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file"); break; } @@ -456,11 +456,11 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ * for the top file in a mount hierarchy. */ if (H5VL_native_get_file_struct(obj, gfi_args->type, &f) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct"); /* Get the file info */ if (H5F__get_info(f, gfi_args->finfo) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info"); break; } @@ -469,7 +469,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ case H5VL_NATIVE_FILE_GET_MDC_CONF: { /* Get the metadata cache configuration */ if (H5AC_get_cache_auto_resize_config(f->shared->cache, opt_args->get_mdc_config.config) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache configuration") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache configuration"); break; } @@ -478,7 +478,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ case H5VL_NATIVE_FILE_GET_MDC_HR: { /* Get the current hit rate */ if (H5AC_get_cache_hit_rate(f->shared->cache, opt_args->get_mdc_hit_rate.hit_rate) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache hit rate") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache hit rate"); break; } @@ -490,7 +490,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Get the size data */ if (H5AC_get_cache_size(f->shared->cache, gms_args->max_size, gms_args->min_clean_size, gms_args->cur_size, gms_args->cur_num_entries) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache size") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache size"); break; } @@ -501,7 +501,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Retrieve the VFD handle for the file */ if (H5F_get_vfd_handle(f, gvh_args->fapl_id, gvh_args->file_handle) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle"); break; } @@ -511,7 +511,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Release the EFC */ if (f->shared->efc) if (H5F__efc_release(f->shared->efc) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache") + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache"); break; } @@ -520,7 +520,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ case H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE: { /* Reset the hit rate statistic */ if (H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate"); break; } @@ -529,7 +529,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ case H5VL_NATIVE_FILE_SET_MDC_CONFIG: { /* Set the metadata cache configuration */ if (H5AC_set_cache_auto_resize_config(f->shared->cache, opt_args->set_mdc_config.config) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set metadata cache configuration") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set metadata cache configuration"); break; } @@ -537,7 +537,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* H5Fget_metadata_read_retry_info */ case H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO: { if (H5F_get_metadata_read_retry_info(f, opt_args->get_metadata_read_retry_info.info) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata read retry info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata read retry info"); break; } @@ -545,7 +545,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* H5Fstart_swmr_write */ case H5VL_NATIVE_FILE_START_SWMR_WRITE: { if (H5F__start_swmr_write(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't start SWMR write") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't start SWMR write"); break; } @@ -554,7 +554,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ case H5VL_NATIVE_FILE_START_MDC_LOGGING: { /* Call mdc logging function */ if (H5C_start_logging(f->shared->cache) < 0) - HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging") + HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging"); break; } @@ -563,7 +563,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ case H5VL_NATIVE_FILE_STOP_MDC_LOGGING: { /* Call mdc logging function */ if (H5C_stop_logging(f->shared->cache) < 0) - HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging") + HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging"); break; } @@ -575,7 +575,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Call mdc logging function */ if (H5C_get_logging_status(f->shared->cache, gmls_args->is_enabled, gmls_args->is_currently_logging) < 0) - HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status") + HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status"); break; } @@ -584,7 +584,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ case H5VL_NATIVE_FILE_FORMAT_CONVERT: { /* Convert the format */ if (H5F__format_convert(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format") + HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format"); break; } @@ -593,11 +593,11 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ case H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS: { /* Sanity check */ if (NULL == f->shared->page_buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file"); /* Reset the statistics */ if (H5PB_reset_stats(f->shared->page_buf) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't reset stats for page buffering"); break; } @@ -608,12 +608,12 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Sanity check */ if (NULL == f->shared->page_buf) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file"); /* Get the statistics */ if (H5PB_get_stats(f->shared->page_buf, gpbs_args->accesses, gpbs_args->hits, gpbs_args->misses, gpbs_args->evictions, gpbs_args->bypasses) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering"); break; } @@ -624,7 +624,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Go get the address and size of the cache image */ if (H5AC_get_mdc_image_info(f->shared->cache, gmii_args->addr, gmii_args->len) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info"); break; } @@ -637,11 +637,11 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* We might introduce a new feature flag in the future */ if (!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, - "must use a SWMR-compatible VFD for this public routine") + "must use a SWMR-compatible VFD for this public routine"); /* The real work */ if (HADDR_UNDEF == (rel_eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get_eoa request failed"); /* Set return value */ /* (Note compensating for base address subtraction in internal routine) */ @@ -658,15 +658,15 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* We might introduce a new feature flag in the future */ if (!H5F_HAS_FEATURE(f, H5FD_FEAT_SUPPORTS_SWMR_IO)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, - "must use a SWMR-compatible VFD for this public routine") + "must use a SWMR-compatible VFD for this public routine"); /* Get the maximum of EOA and EOF */ if (H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ") + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa "); /* Set EOA to the maximum value + increment */ if (H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + opt_args->increment_filesize.increment) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed"); break; } @@ -677,7 +677,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Call internal set_libver_bounds function */ if (H5F__set_libver_bounds(f, slb_args->low, slb_args->high) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds") + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds"); break; } @@ -693,7 +693,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG: { if (H5F_set_min_dset_ohdr(f, opt_args->set_min_dset_ohdr_flag.minimize) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, - "cannot set file's dataset object header minimization flag") + "cannot set file's dataset object header minimization flag"); break; } @@ -720,12 +720,12 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ case H5VL_NATIVE_FILE_POST_OPEN: { /* Call package routine */ if (H5F__post_open(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation"); } /* end switch */ done: @@ -753,29 +753,35 @@ H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_U FUNC_ENTER_PACKAGE /* This routine should only be called when a file ID's ref count drops to zero */ - HDassert(H5F_ID_EXISTS(f)); - - /* Flush file if this is the last reference to this id and we have write - * intent, unless it will be flushed by the "shared" file being closed. - * This is only necessary to replicate previous behaviour, and could be - * disabled by an option/property to improve performance. - */ - if ((H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { - /* Get the file ID corresponding to the H5F_t struct */ - if (H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id) - HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "invalid ID") - - /* Get the number of references outstanding for this file ID */ - if ((nref = H5I_get_ref(file_id, FALSE)) < 0) - HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "can't get ID ref count") - if (nref == 1) - if (H5F__flush(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache") - } /* end if */ - - /* Close the file */ - if (H5F__close(f) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close file") + assert(f->shared == NULL || H5F_ID_EXISTS(f)); + + if (f->shared == NULL) + f = H5FL_FREE(H5F_t, f); + + else { + + /* Flush file if this is the last reference to this id and we have write + * intent, unless it will be flushed by the "shared" file being closed. + * This is only necessary to replicate previous behaviour, and could be + * disabled by an option/property to improve performance. + */ + if ((H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { + /* Get the file ID corresponding to the H5F_t struct */ + if (H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id) + HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "invalid ID"); + + /* Get the number of references outstanding for this file ID */ + if ((nref = H5I_get_ref(file_id, FALSE)) < 0) + HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "can't get ID ref count"); + if (nref == 1) + if (H5F__flush(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache"); + } /* end if */ + + /* Close the file */ + if (H5F__close(f) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close file"); + } done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_group.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_group.c index 0cc22f883e..70b7ab9d6c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_group.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_group.c @@ -81,7 +81,7 @@ H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const /* Set up the location */ if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object"); /* if name is NULL then this is from H5Gcreate_anon */ if (name == NULL) { @@ -90,17 +90,17 @@ H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const /* Set up group creation info */ gcrt_info.gcpl_id = gcpl_id; gcrt_info.cache_type = H5G_NOTHING_CACHED; - HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); + memset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ if (NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group"); } /* end if */ /* otherwise it's from H5Gcreate */ else { /* Create the new group & get its ID */ if (NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id))) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, NULL, "unable to create group"); } /* end else */ ret_value = (void *)grp; @@ -113,12 +113,12 @@ H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_params, const /* Get the new group's object location */ if (NULL == (oloc = H5G_oloc(grp))) - HDONE_ERROR(H5E_SYM, H5E_CANTGET, NULL, "unable to get object location of group") + HDONE_ERROR(H5E_SYM, H5E_CANTGET, NULL, "unable to get object location of group"); /* Decrement refcount on group's object header in memory */ if (H5O_dec_rc_by_loc(oloc) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, NULL, - "unable to decrement refcount on newly created object") + "unable to decrement refcount on newly created object"); } /* end if */ } /* end if */ @@ -147,11 +147,11 @@ H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const ch /* Set up the location */ if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object"); /* Open the group */ if ((grp = H5G__open_name(&loc, name)) == NULL) - HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group") + HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, NULL, "unable to open group"); ret_value = (void *)grp; @@ -180,7 +180,7 @@ H5VL__native_group_get(void *obj, H5VL_group_get_args_t *args, hid_t H5_ATTR_UNU /* H5Gget_create_plist */ case H5VL_GROUP_GET_GCPL: { if ((args->args.get_gcpl.gcpl_id = H5G_get_create_plist((H5G_t *)obj)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get creation property list for group") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get creation property list for group"); break; } @@ -191,14 +191,14 @@ H5VL__native_group_get(void *obj, H5VL_group_get_args_t *args, hid_t H5_ATTR_UNU H5G_loc_t loc; if (H5G_loc_real(obj, get_info_args->loc_params.obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); if (get_info_args->loc_params.type == H5VL_OBJECT_BY_SELF) { /* H5Gget_info */ /* Retrieve the group's information */ if (H5G__obj_info(loc.oloc, get_info_args->ginfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info"); } /* end if */ else if (get_info_args->loc_params.type == H5VL_OBJECT_BY_NAME) { /* H5Gget_info_by_name */ @@ -206,7 +206,7 @@ H5VL__native_group_get(void *obj, H5VL_group_get_args_t *args, hid_t H5_ATTR_UNU /* Retrieve the group's information */ if (H5G__get_info_by_name(&loc, get_info_args->loc_params.loc_data.loc_by_name.name, get_info_args->ginfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info"); } /* end else-if */ else if (get_info_args->loc_params.type == H5VL_OBJECT_BY_IDX) { /* H5Gget_info_by_idx */ @@ -217,15 +217,15 @@ H5VL__native_group_get(void *obj, H5VL_group_get_args_t *args, hid_t H5_ATTR_UNU get_info_args->loc_params.loc_data.loc_by_idx.order, get_info_args->loc_params.loc_data.loc_by_idx.n, get_info_args->ginfo) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info"); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get info parameters"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group"); } /* end switch */ done: @@ -256,11 +256,11 @@ H5VL__native_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t H H5G_loc_t loc; if (H5G_loc_real(grp, H5I_GROUP, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group object"); if (H5F_mount(&loc, args->args.mount.name, args->args.mount.child_file, args->args.mount.fmpl_id) < 0) - HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file") + HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file"); break; } @@ -270,10 +270,10 @@ H5VL__native_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t H H5G_loc_t loc; if (H5G_loc_real(grp, H5I_GROUP, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group object"); if (H5F_unmount(&loc, args->args.unmount.name) < 0) - HGOTO_ERROR(H5E_FILE, H5E_UNMOUNT, FAIL, "unable to unmount file") + HGOTO_ERROR(H5E_FILE, H5E_UNMOUNT, FAIL, "unable to unmount file"); break; } @@ -283,10 +283,10 @@ H5VL__native_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t H /* Currently, H5Oflush causes H5Fclose to trigger an assertion failure in metadata cache. * Leave this situation for the future solution */ if (H5F_HAS_FEATURE(grp->oloc.file, H5FD_FEAT_HAS_MPI)) - HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "H5Oflush isn't supported for parallel") + HGOTO_ERROR(H5E_SYM, H5E_UNSUPPORTED, FAIL, "H5Oflush isn't supported for parallel"); if (H5O_flush_common(&grp->oloc, args->args.flush.grp_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group") + HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group"); break; } @@ -294,13 +294,13 @@ H5VL__native_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t H /* H5Grefresh */ case H5VL_GROUP_REFRESH: { if ((H5O_refresh_metadata(&grp->oloc, args->args.refresh.grp_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group") + HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation"); } /* end switch */ done: @@ -337,7 +337,7 @@ H5VL__native_group_optional(void H5_ATTR_UNUSED *obj, H5VL_optional_args_t *args /* Get the location struct for the object */ if (H5G_loc_real(obj, iter_args->loc_params.obj_type, &grp_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Set up link iteration callback struct */ lnk_op.op_type = H5G_LINK_OP_OLD; @@ -359,19 +359,19 @@ H5VL__native_group_optional(void H5_ATTR_UNUSED *obj, H5VL_optional_args_t *args /* Get the location struct for the object */ if (H5G_loc_real(obj, goi_args->loc_params.obj_type, &grp_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Call the actual group objinfo routine */ if (H5G__get_objinfo(&grp_loc, goi_args->loc_params.loc_data.loc_by_name.name, goi_args->follow_link, goi_args->statbuf) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object") + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object"); break; } #endif /* H5_NO_DEPRECATED_SYMBOLS */ default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation"); } /* end switch */ done: @@ -396,7 +396,7 @@ H5VL__native_group_close(void *grp, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_U FUNC_ENTER_PACKAGE if (H5G_close((H5G_t *)grp) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group") + HGOTO_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close group"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_introspect.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_introspect.c index 0cc6ee49de..4c1cb53c0d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_introspect.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_introspect.c @@ -75,7 +75,7 @@ H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subc FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(flags); + assert(flags); /* The native VOL connector supports all optional operations */ *flags = H5VL_OPT_QUERY_SUPPORTED; @@ -83,13 +83,13 @@ H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subc /* Set appropriate flags for each operation in each subclass */ switch (subcls) { case H5VL_SUBCLS_NONE: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional 'none' operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional 'none' operation"); case H5VL_SUBCLS_INFO: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional info operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional info operation"); case H5VL_SUBCLS_WRAP: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional wrapper operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional wrapper operation"); case H5VL_SUBCLS_ATTR: switch (opt_type) { @@ -101,7 +101,7 @@ H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subc #endif /* H5_NO_DEPRECATED_SYMBOLS */ default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional attribute operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional attribute operation"); break; } /* end switch */ break; @@ -131,13 +131,13 @@ H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subc break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional dataset operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional dataset operation"); break; } /* end switch */ break; case H5VL_SUBCLS_DATATYPE: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional datatype operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional datatype operation"); case H5VL_SUBCLS_FILE: switch (opt_type) { @@ -190,7 +190,7 @@ H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subc break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional file operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional file operation"); break; } /* end switch */ break; @@ -209,13 +209,13 @@ H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subc #endif /* H5_NO_DEPRECATED_SYMBOLS */ default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional group operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional group operation"); break; } /* end switch */ break; case H5VL_SUBCLS_LINK: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional link operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional link operation"); case H5VL_SUBCLS_OBJECT: switch (opt_type) { @@ -237,22 +237,22 @@ H5VL__native_introspect_opt_query(void H5_ATTR_UNUSED *obj, H5VL_subclass_t subc break; default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional object operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional object operation"); break; } /* end switch */ break; case H5VL_SUBCLS_REQUEST: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional request operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional request operation"); case H5VL_SUBCLS_BLOB: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional blob operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional blob operation"); case H5VL_SUBCLS_TOKEN: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional token operation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown optional token operation"); default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown H5VL subclass") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unknown H5VL subclass"); } /* end switch */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_link.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_link.c index 4d6d3a821b..342d65dd1b 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_link.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_link.c @@ -84,9 +84,9 @@ H5VL__native_link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_lo H5VL_loc_params_t *cur_params = &args->args.hard.curr_loc_params; if (NULL != cur_obj && H5G_loc_real(cur_obj, cur_params->obj_type, &cur_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); if (NULL != obj && H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* H5Lcreate_hard */ if (H5VL_OBJECT_BY_NAME == cur_params->type) { @@ -101,17 +101,17 @@ H5VL__native_link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_lo link_loc_p = cur_loc_p; else if (cur_loc_p->oloc->file != link_loc_p->oloc->file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "source and destination should be in the same file.") + "source and destination should be in the same file."); /* Create the link */ if (H5L__create_hard(cur_loc_p, cur_params->loc_data.loc_by_name.name, link_loc_p, loc_params->loc_data.loc_by_name.name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link"); } /* end if */ else { /* H5Olink */ /* Link to the object */ if (H5L_link(&link_loc, loc_params->loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link"); } /* end else */ break; @@ -121,10 +121,10 @@ H5VL__native_link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_lo H5G_loc_t link_loc; /* Group location for new link */ if (H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); if (H5L__create_soft(args->args.soft.target, &link_loc, loc_params->loc_data.loc_by_name.name, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link") + HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link"); break; } @@ -133,16 +133,16 @@ H5VL__native_link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_lo H5G_loc_t link_loc; /* Group location for new link */ if (H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); if (H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, args->args.ud.buf, args->args.ud.buf_size, args->args.ud.type, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link"); break; } default: - HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call") + HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "invalid link creation call"); } /* end switch */ done: @@ -170,9 +170,9 @@ H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void FUNC_ENTER_PACKAGE if (NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); if (NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Set up src & dst location pointers */ src_loc_p = &src_loc; @@ -185,7 +185,7 @@ H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void /* Copy the link */ if (H5L__move(src_loc_p, loc_params1->loc_data.loc_by_name.name, dst_loc_p, loc_params2->loc_data.loc_by_name.name, TRUE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link") + HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to copy link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -212,9 +212,9 @@ H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void FUNC_ENTER_PACKAGE if (NULL != src_obj && H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); if (NULL != dst_obj && H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Set up src & dst location pointers */ src_loc_p = &src_loc; @@ -227,7 +227,7 @@ H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void /* Move the link */ if (H5L__move(src_loc_p, loc_params1->loc_data.loc_by_name.name, dst_loc_p, loc_params2->loc_data.loc_by_name.name, FALSE, lcpl_id) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") + HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -252,7 +252,7 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_ FUNC_ENTER_PACKAGE if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); switch (args->op_type) { /* H5Lget_info/H5Lget_info_by_idx */ @@ -260,17 +260,17 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_ /* Get the link information */ if (loc_params->type == H5VL_OBJECT_BY_NAME) { if (H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_info.linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_IDX) { if (H5L__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, args->args.get_info.linfo) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info"); } /* end else-if */ else - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info"); break; } @@ -282,7 +282,7 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, args->args.get_name.name, args->args.get_name.name_size, args->args.get_name.name_len) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info"); break; } @@ -293,23 +293,23 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_ if (loc_params->type == H5VL_OBJECT_BY_NAME) { if (H5L__get_val(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_val.buf, args->args.get_val.buf_size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value"); } else if (loc_params->type == H5VL_OBJECT_BY_IDX) { if (H5L__get_val_by_idx( &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, args->args.get_val.buf, args->args.get_val.buf_size) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val"); } else - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link"); } /* end switch */ done: @@ -338,9 +338,9 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ H5G_loc_t loc; if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); if (H5L__exists(&loc, loc_params->loc_data.loc_by_name.name, args->args.exists.exists) < 0) - HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info"); break; } @@ -351,7 +351,7 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ /* Get the location */ if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location"); /* Visit or iterate over the links */ if (loc_params->type == H5VL_OBJECT_BY_SELF) { @@ -359,13 +359,13 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ /* H5Lvisit */ if ((ret_value = H5G_visit(&loc, ".", iter_args->idx_type, iter_args->order, iter_args->op, iter_args->op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed"); } /* end if */ else { /* H5Literate */ if ((ret_value = H5L_iterate(&loc, ".", iter_args->idx_type, iter_args->order, iter_args->idx_p, iter_args->op, iter_args->op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links"); } /* end else */ } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_NAME) { @@ -374,18 +374,18 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ if ((ret_value = H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, iter_args->idx_type, iter_args->order, iter_args->op, iter_args->op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed"); } /* end if */ else { /* H5Literate_by_name */ if ((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name, iter_args->idx_type, iter_args->order, iter_args->idx_p, iter_args->op, iter_args->op_data)) < 0) - HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links"); } /* end else */ } /* end else-if */ else - HGOTO_ERROR(H5E_LINK, H5E_UNSUPPORTED, FAIL, "unknown link iterate params") + HGOTO_ERROR(H5E_LINK, H5E_UNSUPPORTED, FAIL, "unknown link iterate params"); break; } @@ -394,26 +394,26 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_ H5G_loc_t loc; if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Unlink */ if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Ldelete */ if (H5L__delete(&loc, loc_params->loc_data.loc_by_name.name) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Ldelete_by_idx */ if (H5L__delete_by_idx( &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0) - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link"); } /* end else-if */ else - HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") + HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation"); } /* end switch */ done: diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_object.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_object.c index 01311c92e4..82d267f074 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_object.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_object.c @@ -80,13 +80,13 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ FUNC_ENTER_PACKAGE if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object"); switch (loc_params->type) { case H5VL_OBJECT_BY_NAME: { /* Open the object */ if (NULL == (ret_value = H5O_open_name(&loc, loc_params->loc_data.loc_by_name.name, opened_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by name"); break; } @@ -96,7 +96,7 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, opened_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by index"); break; } @@ -107,17 +107,17 @@ H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_typ /* Decode token */ if (H5VL_native_token_to_addr(loc.oloc->file, H5I_FILE, token, &addr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, NULL, - "can't deserialize object token into address") + "can't deserialize object token into address"); /* Open the object */ if (NULL == (ret_value = H5O__open_by_addr(&loc, addr, opened_type))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address") + HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, NULL, "unable to open object by address"); break; } case H5VL_OBJECT_BY_SELF: default: - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown open parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "unknown open parameters"); } /* end switch */ done: @@ -147,13 +147,13 @@ H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, co /* get location for objects */ if (H5G_loc_real(src_obj, loc_params1->obj_type, &src_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); if (H5G_loc_real(dst_obj, loc_params2->obj_type, &dst_loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); /* Copy the object */ if ((ret_value = H5O__copy(&src_loc, src_name, &dst_loc, dst_name, ocpypl_id, lcpl_id)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -178,7 +178,7 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj FUNC_ENTER_PACKAGE if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); switch (args->op_type) { @@ -194,7 +194,7 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj loc.oloc->file->id_exists = TRUE; } else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_file parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_file parameters"); break; } @@ -205,7 +205,7 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj /* Retrieve object's name */ if (H5G_get_name(&loc, args->args.get_name.buf, args->args.get_name.buf_size, args->args.get_name.name_len, NULL) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve object name") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve object name"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_TOKEN) { H5O_loc_t obj_oloc; /* Object location */ @@ -218,15 +218,15 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj /* Decode token */ if (H5VL_native_token_to_addr(obj_oloc.file, H5I_FILE, token, &obj_oloc.addr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); /* Retrieve object's name */ if (H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, args->args.get_name.buf, args->args.get_name.buf_size, args->args.get_name.name_len) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine object name") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine object name"); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_name parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_name parameters"); break; } @@ -245,15 +245,15 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj /* Decode token */ if (H5VL_native_token_to_addr(obj_oloc.file, H5I_FILE, token, &obj_oloc.addr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNSERIALIZE, FAIL, - "can't deserialize object token into address") + "can't deserialize object token into address"); /* Get the # of links for object, and its type */ /* (To check to make certain that this object hasn't been deleted) */ if (H5O_get_rc_and_type(&obj_oloc, &rc, args->args.get_type.obj_type) < 0 || 0 == rc) - HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object") + HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object"); } else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_type parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_type parameters"); break; } @@ -262,12 +262,12 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj case H5VL_OBJECT_GET_INFO: { if (loc_params->type == H5VL_OBJECT_BY_SELF) { if (H5G_loc_info(&loc, ".", args->args.get_info.oinfo, args->args.get_info.fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_NAME) { if (H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_info.oinfo, args->args.get_info.fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found"); } /* end else-if */ else if (loc_params->type == H5VL_OBJECT_BY_IDX) { H5G_loc_t obj_loc; /* Location used to open group */ @@ -284,26 +284,26 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found"); /* Retrieve the object's information */ if (H5O_get_info(obj_loc.oloc, args->args.get_info.oinfo, args->args.get_info.fields) < 0) { H5G_loc_free(&obj_loc); - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info"); } /* end if */ /* Release the object location */ if (H5G_loc_free(&obj_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location"); } /* end else-if */ else - HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object"); } /* end switch */ done: @@ -330,13 +330,13 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, FUNC_ENTER_PACKAGE if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); switch (args->op_type) { /* H5Oincr_refcount / H5Odecr_refcount */ case H5VL_OBJECT_CHANGE_REF_COUNT: { if (H5O_link(loc.oloc, args->args.change_rc.delta) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed") + HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed"); break; } @@ -347,10 +347,10 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, /* Check if the object exists */ if (H5G_loc_exists(&loc, loc_params->loc_data.loc_by_name.name, args->args.exists.exists) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", - loc_params->loc_data.loc_by_name.name) + loc_params->loc_data.loc_by_name.name); } /* end if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters"); break; } @@ -369,20 +369,20 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, /* Find the object */ if (H5G_loc_find(&loc, loc_params->loc_data.loc_by_name.name, &obj_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found"); /* Encode token */ if (H5VL_native_addr_to_token(loc.oloc->file, H5I_FILE, obj_loc.oloc->addr, args->args.lookup.token_ptr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL, - "can't serialize address into object token") + "can't serialize address into object token"); /* Release the object location */ if (H5G_loc_free(&obj_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location"); } /* end if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters"); break; } @@ -394,13 +394,13 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, if (loc_params->type == H5VL_OBJECT_BY_SELF) { if ((ret_value = H5O__visit(&loc, ".", visit_args->idx_type, visit_args->order, visit_args->op, visit_args->op_data, visit_args->fields)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_NAME) { if ((ret_value = H5O__visit(&loc, loc_params->loc_data.loc_by_name.name, visit_args->idx_type, visit_args->order, visit_args->op, visit_args->op_data, visit_args->fields)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") + HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed"); } /* end else-if */ else HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params"); @@ -411,7 +411,7 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, case H5VL_OBJECT_FLUSH: { /* Flush the object's metadata */ if (H5O_flush(loc.oloc, args->args.flush.obj_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object"); break; } @@ -419,13 +419,13 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params, case H5VL_OBJECT_REFRESH: { /* Refresh the metadata */ if (H5O_refresh_metadata(loc.oloc, args->args.refresh.obj_id) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object"); break; } default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type"); } /* end switch */ done: @@ -452,7 +452,7 @@ H5VL__native_object_optional(void *obj, const H5VL_loc_params_t *loc_params, H5V FUNC_ENTER_PACKAGE if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object"); switch (args->op_type) { /* H5Oget_comment / H5Oget_comment_by_name */ @@ -462,15 +462,15 @@ H5VL__native_object_optional(void *obj, const H5VL_loc_params_t *loc_params, H5V /* Retrieve the object's comment */ if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */ if (H5G_loc_get_comment(&loc, ".", gc_args->buf, gc_args->buf_size, gc_args->comment_len) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */ if (H5G_loc_get_comment(&loc, loc_params->loc_data.loc_by_name.name, gc_args->buf, gc_args->buf_size, gc_args->comment_len) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object"); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters"); break; } @@ -479,15 +479,15 @@ H5VL__native_object_optional(void *obj, const H5VL_loc_params_t *loc_params, H5V case H5VL_NATIVE_OBJECT_SET_COMMENT: { if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */ if (H5G_loc_set_comment(&loc, ".", opt_args->set_comment.comment) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */ if (H5G_loc_set_comment(&loc, loc_params->loc_data.loc_by_name.name, opt_args->set_comment.comment) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found"); } /* end else-if */ else - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters") + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters"); break; } @@ -523,12 +523,12 @@ H5VL__native_object_optional(void *obj, const H5VL_loc_params_t *loc_params, H5V /* Use the original H5Oget_info code to get the data */ if (loc_params->type == H5VL_OBJECT_BY_SELF) { if (H5G_loc_native_info(&loc, ".", gni_args->ninfo, gni_args->fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found"); } /* end if */ else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */ if (H5G_loc_native_info(&loc, loc_params->loc_data.loc_by_name.name, gni_args->ninfo, gni_args->fields) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found"); } /* end else-if */ else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */ H5G_loc_t obj_loc; /* Location used to open group */ @@ -545,19 +545,19 @@ H5VL__native_object_optional(void *obj, const H5VL_loc_params_t *loc_params, H5V loc_params->loc_data.loc_by_idx.idx_type, loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, &obj_loc /*out*/) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") + HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found"); if (H5O_get_native_info(obj_loc.oloc, gni_args->ninfo, gni_args->fields) < 0) { H5G_loc_free(&obj_loc); - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info"); } /* end if */ /* Release the object location */ if (H5G_loc_free(&obj_loc) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location") + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location"); } /* end else-if */ else - HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters") + HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters"); break; } diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_token.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_token.c index b5bd7b8914..e03299ebfc 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_token.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLnative_token.c @@ -70,10 +70,10 @@ H5VL__native_token_cmp(void H5_ATTR_UNUSED *obj, const H5O_token_t *token1, cons FUNC_ENTER_PACKAGE_NOERR /* Check parameters */ - HDassert(token1); - HDassert(token2); + assert(token1); + assert(token2); - *cmp_value = HDmemcmp(token1, token2, sizeof(H5O_token_t)); + *cmp_value = memcmp(token1, token2, sizeof(H5O_token_t)); FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL__native_token_cmp() */ @@ -98,11 +98,11 @@ H5VL__native_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *tok FUNC_ENTER_PACKAGE /* Check parameters */ - HDassert(obj); - HDassert(token); + assert(obj); + assert(token); if (H5VL_native_token_to_addr(obj, obj_type, *token, &addr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert object token to address") + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert object token to address"); if (addr == 0) addr_ndigits = 1; @@ -110,7 +110,7 @@ H5VL__native_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *tok addr_ndigits = (size_t)(HDfloor(HDlog10((double)addr)) + 1); if (NULL == (*token_str = H5MM_malloc(addr_ndigits + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for token string") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate buffer for token string"); HDsnprintf(*token_str, addr_ndigits + 1, "%" PRIuHADDR, addr); @@ -137,12 +137,12 @@ H5VL__native_str_to_token(void *obj, H5I_type_t obj_type, const char *token_str, FUNC_ENTER_PACKAGE /* Check parameters */ - HDassert(token_str); + assert(token_str); HDsscanf(token_str, "%" PRIuHADDR, &addr); if (H5VL_native_addr_to_token(obj, obj_type, addr, token) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert address to object token") + HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "can't convert address to object token"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLpassthru.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLpassthru.c index 986629fc54..3867df2d7a 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLpassthru.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLpassthru.c @@ -121,11 +121,12 @@ static void *H5VL_pass_through_dataset_create(void *obj, const H5VL_loc_params_ hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); static void *H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, void **req); -static herr_t H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, - void **req); +static herr_t H5VL_pass_through_dataset_read(size_t count, void *dset[], hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t plist_id, + void *buf[], void **req); +static herr_t H5VL_pass_through_dataset_write(size_t count, void *dset[], hid_t mem_type_id[], + hid_t mem_space_id[], hid_t file_space_id[], hid_t plist_id, + const void *buf[], void **req); static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req); static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, @@ -207,7 +208,7 @@ static herr_t H5VL_pass_through_object_optional(void *obj, const H5VL_loc_params /* Container/connector introspection callbacks */ static herr_t H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); -static herr_t H5VL_pass_through_introspect_get_cap_flags(const void *info, unsigned *cap_flags); +static herr_t H5VL_pass_through_introspect_get_cap_flags(const void *info, uint64_t *cap_flags); static herr_t H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, uint64_t *flags); @@ -374,9 +375,6 @@ static hid_t H5VL_PASSTHRU_g = H5I_INVALID_HID; * Return: Success: Pointer to the new pass through object * Failure: NULL * - * Programmer: Quincey Koziol - * Monday, December 3, 2018 - * *------------------------------------------------------------------------- */ static H5VL_pass_through_t * @@ -387,6 +385,7 @@ H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id) new_obj = (H5VL_pass_through_t *)calloc(1, sizeof(H5VL_pass_through_t)); new_obj->under_object = under_obj; new_obj->under_vol_id = under_vol_id; + H5Iinc_ref(new_obj->under_vol_id); return new_obj; @@ -403,9 +402,6 @@ H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id) * Return: Success: 0 * Failure: -1 * - * Programmer: Quincey Koziol - * Monday, December 3, 2018 - * *------------------------------------------------------------------------- */ static herr_t @@ -433,9 +429,6 @@ H5VL_pass_through_free_obj(H5VL_pass_through_t *obj) * Return: Success: The ID for the pass-through VOL connector * Failure: -1 * - * Programmer: Quincey Koziol - * Wednesday, November 28, 2018 - * *------------------------------------------------------------------------- */ hid_t @@ -519,12 +512,27 @@ H5VL_pass_through_info_copy(const void *_info) printf("------- PASS THROUGH VOL INFO Copy\n"); #endif + /* Make sure the underneath VOL of this pass-through VOL is specified */ + if (!info) { + printf("\nH5VLpassthru.c line %d in %s: info for pass-through VOL can't be null\n", __LINE__, + __func__); + return NULL; + } + + if (H5Iis_valid(info->under_vol_id) <= 0) { + printf("\nH5VLpassthru.c line %d in %s: not a valid underneath VOL ID for pass-through VOL\n", + __LINE__, __func__); + return NULL; + } + /* Allocate new VOL info struct for the pass through connector */ new_info = (H5VL_pass_through_info_t *)calloc(1, sizeof(H5VL_pass_through_info_t)); /* Increment reference count on underlying VOL ID, and copy the VOL info */ new_info->under_vol_id = info->under_vol_id; + H5Iinc_ref(new_info->under_vol_id); + if (info->under_vol_info) H5VLcopy_connector_info(new_info->under_vol_id, &(new_info->under_vol_info), info->under_vol_info); @@ -752,7 +760,9 @@ H5VL_pass_through_get_wrap_ctx(const void *obj, void **wrap_ctx) /* Increment reference count on underlying VOL ID, and copy the VOL info */ new_wrap_ctx->under_vol_id = o->under_vol_id; + H5Iinc_ref(new_wrap_ctx->under_vol_id); + H5VLget_wrap_ctx(o->under_object, o->under_vol_id, &new_wrap_ctx->under_wrap_ctx); /* Set wrap context to return */ @@ -1197,22 +1207,43 @@ H5VL_pass_through_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, c *------------------------------------------------------------------------- */ static herr_t -H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t plist_id, void *buf, void **req) +H5VL_pass_through_dataset_read(size_t count, void *dset[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t plist_id, void *buf[], void **req) { - H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; - herr_t ret_value; + void *obj_local; /* Local buffer for obj */ + void **obj = &obj_local; /* Array of object pointers */ + size_t i; /* Local index variable */ + herr_t ret_value; #ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Read\n"); #endif - ret_value = H5VLdataset_read(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, req); + /* Allocate obj array if necessary */ + if (count > 1) + if (NULL == (obj = (void **)malloc(count * sizeof(void *)))) + return -1; + + /* Build obj array */ + for (i = 0; i < count; i++) { + /* Get the object */ + obj[i] = ((H5VL_pass_through_t *)dset[i])->under_object; + + /* Make sure the class matches */ + if (((H5VL_pass_through_t *)dset[i])->under_vol_id != ((H5VL_pass_through_t *)dset[0])->under_vol_id) + return -1; + } + + ret_value = H5VLdataset_read(count, obj, ((H5VL_pass_through_t *)dset[0])->under_vol_id, mem_type_id, + mem_space_id, file_space_id, plist_id, buf, req); /* Check for async request */ if (req && *req) - *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + *req = H5VL_pass_through_new_obj(*req, ((H5VL_pass_through_t *)dset[0])->under_vol_id); + + /* Free memory */ + if (obj != &obj_local) + free(obj); return ret_value; } /* end H5VL_pass_through_dataset_read() */ @@ -1228,22 +1259,43 @@ H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id *------------------------------------------------------------------------- */ static herr_t -H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, - hid_t plist_id, const void *buf, void **req) +H5VL_pass_through_dataset_write(size_t count, void *dset[], hid_t mem_type_id[], hid_t mem_space_id[], + hid_t file_space_id[], hid_t plist_id, const void *buf[], void **req) { - H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset; - herr_t ret_value; + void *obj_local; /* Local buffer for obj */ + void **obj = &obj_local; /* Array of object pointers */ + size_t i; /* Local index variable */ + herr_t ret_value; #ifdef ENABLE_PASSTHRU_LOGGING printf("------- PASS THROUGH VOL DATASET Write\n"); #endif - ret_value = H5VLdataset_write(o->under_object, o->under_vol_id, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, req); + /* Allocate obj array if necessary */ + if (count > 1) + if (NULL == (obj = (void **)malloc(count * sizeof(void *)))) + return -1; + + /* Build obj array */ + for (i = 0; i < count; i++) { + /* Get the object */ + obj[i] = ((H5VL_pass_through_t *)dset[i])->under_object; + + /* Make sure the class matches */ + if (((H5VL_pass_through_t *)dset[i])->under_vol_id != ((H5VL_pass_through_t *)dset[0])->under_vol_id) + return -1; + } + + ret_value = H5VLdataset_write(count, obj, ((H5VL_pass_through_t *)dset[0])->under_vol_id, mem_type_id, + mem_space_id, file_space_id, plist_id, buf, req); /* Check for async request */ if (req && *req) - *req = H5VL_pass_through_new_obj(*req, o->under_vol_id); + *req = H5VL_pass_through_new_obj(*req, ((H5VL_pass_through_t *)dset[0])->under_vol_id); + + /* Free memory */ + if (obj != &obj_local) + free(obj); return ret_value; } /* end H5VL_pass_through_dataset_write() */ @@ -1735,7 +1787,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_args_t *args, hid H5VL_pass_through_t *new_o; H5VL_file_specific_args_t my_args; H5VL_file_specific_args_t *new_args; - H5VL_pass_through_info_t *info; + H5VL_pass_through_info_t *info = NULL; hid_t under_vol_id = -1; herr_t ret_value; @@ -2553,7 +2605,7 @@ H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, co *------------------------------------------------------------------------- */ herr_t -H5VL_pass_through_introspect_get_cap_flags(const void *_info, unsigned *cap_flags) +H5VL_pass_through_introspect_get_cap_flags(const void *_info, uint64_t *cap_flags) { const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info; herr_t ret_value; @@ -2562,6 +2614,19 @@ H5VL_pass_through_introspect_get_cap_flags(const void *_info, unsigned *cap_flag printf("------- PASS THROUGH VOL INTROSPECT GetCapFlags\n"); #endif + /* Make sure the underneath VOL of this pass-through VOL is specified */ + if (!info) { + printf("\nH5VLpassthru.c line %d in %s: info for pass-through VOL can't be null\n", __LINE__, + __func__); + return -1; + } + + if (H5Iis_valid(info->under_vol_id) <= 0) { + printf("\nH5VLpassthru.c line %d in %s: not a valid underneath VOL ID for pass-through VOL\n", + __LINE__, __func__); + return -1; + } + /* Invoke the query on the underlying VOL connector */ ret_value = H5VLintrospect_get_cap_flags(info->under_vol_info, info->under_vol_id, cap_flags); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VLtest.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VLtest.c index 1f99ce50c2..17368b77e8 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VLtest.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VLtest.c @@ -5,7 +5,7 @@ * 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. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -13,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5VLtest.c - * Jan 3 2021 - * Quincey Koziol * * Purpose: Virtual Object Layer (VOL) testing routines. * @@ -75,9 +73,6 @@ * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Feb 3, 2021 - * *------------------------------------------------------------------------- */ herr_t @@ -89,7 +84,7 @@ H5VL__reparse_def_vol_conn_variable_test(void) /* Re-check for the HDF5_VOL_CONNECTOR environment variable */ if (H5VL__set_def_conn() < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize default VOL connector") + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize default VOL connector"); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VM.c b/externals/coda-oss/modules/drivers/hdf5/source/H5VM.c index 2e5dc3280e..abfde22568 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VM.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5VM.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,11 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Robb Matzke - * Friday, October 10, 1997 - */ - #include "H5private.h" #include "H5Eprivate.h" #include "H5MMprivate.h" /* Memory management */ @@ -36,11 +30,6 @@ static void H5VM__stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size / const hsize_t *size, hsize_t *stride1); static void H5VM__stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, const hsize_t *size, hsize_t *stride1, hsize_t *stride2); -#ifdef LATER -static void H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n, const hsize_t *dst_size, - const ssize_t *dst_stride, void *_dst, unsigned src_n, const hsize_t *src_size, - const ssize_t *src_stride, const void *_src); -#endif /* LATER */ /*------------------------------------------------------------------------- * Function: H5VM__stride_optimize1 @@ -55,9 +44,6 @@ static void H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n * * Return: void * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * *------------------------------------------------------------------------- */ static void @@ -69,7 +55,7 @@ H5VM__stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c /* This has to be true because if we optimize the dimensionality down to * zero we still must make one reference. */ - HDassert(1 == H5VM_vector_reduce_product(0, NULL)); + assert(1 == H5VM_vector_reduce_product(0, NULL)); /* Combine adjacent memory accesses */ while (*np && stride1[*np - 1] > 0 && (hsize_t)(stride1[*np - 1]) == *elmt_size) { @@ -94,9 +80,6 @@ H5VM__stride_optimize1(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * *------------------------------------------------------------------------- */ static void @@ -108,8 +91,8 @@ H5VM__stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c /* This has to be true because if we optimize the dimensionality down to * zero we still must make one reference. */ - HDassert(1 == H5VM_vector_reduce_product(0, NULL)); - HDassert(*elmt_size > 0); + assert(1 == H5VM_vector_reduce_product(0, NULL)); + assert(*elmt_size > 0); /* Combine adjacent memory accesses */ @@ -218,9 +201,6 @@ H5VM__stride_optimize2(unsigned *np /*in,out*/, hsize_t *elmt_size /*in,out*/, c * * Return: Byte offset from beginning of array to start of striding. * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * *------------------------------------------------------------------------- */ hsize_t @@ -234,48 +214,48 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(size); - HDassert(total_size); - HDassert(stride); + assert(n <= H5VM_HYPER_NDIMS); + assert(size); + assert(total_size); + assert(stride); /* init */ - HDassert(n > 0); + assert(n > 0); stride[n - 1] = 1; skip = offset ? offset[n - 1] : 0; switch (n) { case 2: /* 1-D dataset */ - HDassert(total_size[1] >= size[1]); + assert(total_size[1] >= size[1]); stride[0] = total_size[1] - size[1]; /*overflow checked*/ acc = total_size[1]; skip += acc * (offset ? offset[0] : 0); break; case 3: /* 2-D dataset */ - HDassert(total_size[2] >= size[2]); + assert(total_size[2] >= size[2]); stride[1] = total_size[2] - size[2]; /*overflow checked*/ acc = total_size[2]; skip += acc * (offset ? (hsize_t)offset[1] : 0); - HDassert(total_size[1] >= size[1]); + assert(total_size[1] >= size[1]); stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/ acc *= total_size[1]; skip += acc * (offset ? (hsize_t)offset[0] : 0); break; case 4: /* 3-D dataset */ - HDassert(total_size[3] >= size[3]); + assert(total_size[3] >= size[3]); stride[2] = total_size[3] - size[3]; /*overflow checked*/ acc = total_size[3]; skip += acc * (offset ? (hsize_t)offset[2] : 0); - HDassert(total_size[2] >= size[2]); + assert(total_size[2] >= size[2]); stride[1] = acc * (total_size[2] - size[2]); /*overflow checked*/ acc *= total_size[2]; skip += acc * (offset ? (hsize_t)offset[1] : 0); - HDassert(total_size[1] >= size[1]); + assert(total_size[1] >= size[1]); stride[0] = acc * (total_size[1] - size[1]); /*overflow checked*/ acc *= total_size[1]; skip += acc * (offset ? (hsize_t)offset[0] : 0); @@ -284,7 +264,7 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co default: /* others */ for (i = (int)(n - 2), acc = 1; i >= 0; --i) { - HDassert(total_size[i + 1] >= size[i + 1]); + assert(total_size[i + 1] >= size[i + 1]); stride[i] = acc * (total_size[i + 1] - size[i + 1]); /*overflow checked*/ acc *= total_size[i + 1]; skip += acc * (offset ? (hsize_t)offset[i] : 0); @@ -313,9 +293,6 @@ H5VM_hyper_stride(unsigned n, const hsize_t *size, const hsize_t *total_size, co * * Never returns FAIL * - * Programmer: Robb Matzke - * Friday, October 17, 1997 - * *------------------------------------------------------------------------- */ htri_t @@ -330,17 +307,17 @@ H5VM_hyper_eq(unsigned n, const hsize_t *offset1, const hsize_t *size1, const hs FUNC_ENTER_NOAPI_NOINIT_NOERR if (n == 0) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); for (i = 0; i < n; i++) { if ((offset1 ? offset1[i] : 0) != (offset2 ? offset2[i] : 0)) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); if ((size1 ? size1[i] : 0) != (size2 ? size2[i] : 0)) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); if (0 == (nelmts1 *= (size1 ? size1[i] : 0))) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); if (0 == (nelmts2 *= (size2 ? size2[i] : 0))) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } done: @@ -361,9 +338,6 @@ H5VM_hyper_eq(unsigned n, const hsize_t *offset1, const hsize_t *size1, const hs * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -383,14 +357,14 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, con FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ - HDassert(n > 0 && n <= H5VM_HYPER_NDIMS); - HDassert(_size); - HDassert(total_size); - HDassert(dst); + assert(n > 0 && n <= H5VM_HYPER_NDIMS); + assert(_size); + assert(total_size); + assert(dst); #ifndef NDEBUG for (u = 0; u < n; u++) { - HDassert(_size[u] > 0); - HDassert(total_size[u] > 0); + assert(_size[u] > 0); + assert(total_size[u] > 0); } #endif @@ -431,9 +405,6 @@ H5VM_hyper_fill(unsigned n, const hsize_t *_size, const hsize_t *total_size, con * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Friday, October 10, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -455,17 +426,17 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const FUNC_ENTER_NOAPI_NOINIT_NOERR /* check args */ - HDassert(n > 0 && n <= H5VM_HYPER_NDIMS); - HDassert(_size); - HDassert(dst_size); - HDassert(src_size); - HDassert(dst); - HDassert(src); + assert(n > 0 && n <= H5VM_HYPER_NDIMS); + assert(_size); + assert(dst_size); + assert(src_size); + assert(dst); + assert(src); #ifndef NDEBUG for (u = 0; u < n; u++) { - HDassert(_size[u] > 0); - HDassert(dst_size[u] > 0); - HDassert(src_size[u] > 0); + assert(_size[u] > 0); + assert(dst_size[u] > 0); + assert(src_size[u] > 0); } #endif @@ -484,7 +455,7 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const int ii; /*counter */ /* init */ - HDassert(n > 0); + assert(n > 0); dst_stride[n - 1] = 1; src_stride[n - 1] = 1; dst_start = dst_offset ? dst_offset[n - 1] : 0; @@ -493,8 +464,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const /* Unroll loop for common cases */ switch (n) { case 2: - HDassert(dst_size[1] >= size[1]); - HDassert(src_size[1] >= size[1]); + assert(dst_size[1] >= size[1]); + assert(src_size[1] >= size[1]); dst_stride[0] = dst_size[1] - size[1]; /*overflow checked*/ src_stride[0] = src_size[1] - size[1]; /*overflow checked*/ dst_acc = dst_size[1]; @@ -504,8 +475,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const break; case 3: - HDassert(dst_size[2] >= size[2]); - HDassert(src_size[2] >= size[2]); + assert(dst_size[2] >= size[2]); + assert(src_size[2] >= size[2]); dst_stride[1] = dst_size[2] - size[2]; /*overflow checked*/ src_stride[1] = src_size[2] - size[2]; /*overflow checked*/ dst_acc = dst_size[2]; @@ -513,8 +484,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0); src_start += src_acc * (src_offset ? src_offset[1] : 0); - HDassert(dst_size[1] >= size[1]); - HDassert(src_size[1] >= size[1]); + assert(dst_size[1] >= size[1]); + assert(src_size[1] >= size[1]); dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/ src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/ dst_acc *= dst_size[1]; @@ -524,8 +495,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const break; case 4: - HDassert(dst_size[3] >= size[3]); - HDassert(src_size[3] >= size[3]); + assert(dst_size[3] >= size[3]); + assert(src_size[3] >= size[3]); dst_stride[2] = dst_size[3] - size[3]; /*overflow checked*/ src_stride[2] = src_size[3] - size[3]; /*overflow checked*/ dst_acc = dst_size[3]; @@ -533,8 +504,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const dst_start += dst_acc * (dst_offset ? dst_offset[2] : 0); src_start += src_acc * (src_offset ? src_offset[2] : 0); - HDassert(dst_size[2] >= size[2]); - HDassert(src_size[2] >= size[2]); + assert(dst_size[2] >= size[2]); + assert(src_size[2] >= size[2]); dst_stride[1] = dst_acc * (dst_size[2] - size[2]); /*overflow checked*/ src_stride[1] = src_acc * (src_size[2] - size[2]); /*overflow checked*/ dst_acc *= dst_size[2]; @@ -542,8 +513,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const dst_start += dst_acc * (dst_offset ? dst_offset[1] : 0); src_start += src_acc * (src_offset ? src_offset[1] : 0); - HDassert(dst_size[1] >= size[1]); - HDassert(src_size[1] >= size[1]); + assert(dst_size[1] >= size[1]); + assert(src_size[1] >= size[1]); dst_stride[0] = dst_acc * (dst_size[1] - size[1]); /*overflow checked*/ src_stride[0] = src_acc * (src_size[1] - size[1]); /*overflow checked*/ dst_acc *= dst_size[1]; @@ -555,8 +526,8 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const default: /* others */ for (ii = (int)(n - 2), dst_acc = 1, src_acc = 1; ii >= 0; --ii) { - HDassert(dst_size[ii + 1] >= size[ii + 1]); - HDassert(src_size[ii + 1] >= size[ii + 1]); + assert(dst_size[ii + 1] >= size[ii + 1]); + assert(src_size[ii + 1] >= size[ii + 1]); dst_stride[ii] = dst_acc * (dst_size[ii + 1] - size[ii + 1]); /*overflow checked*/ src_stride[ii] = src_acc * (src_size[ii + 1] - size[ii + 1]); /*overflow checked*/ dst_acc *= dst_size[ii + 1]; @@ -587,9 +558,6 @@ H5VM_hyper_copy(unsigned n, const hsize_t *_size, const hsize_t *dst_size, const * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -605,14 +573,14 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(elmt_size < SIZE_MAX); + assert(elmt_size < SIZE_MAX); H5VM_vector_cpy(n, idx, size); nelmts = H5VM_vector_reduce_product(n, size); for (i = 0; i < nelmts; i++) { /* Copy an element */ H5_CHECK_OVERFLOW(elmt_size, hsize_t, size_t); - HDmemset(dst, (int)fill_value, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + memset(dst, (int)fill_value, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ /* Decrement indices and advance pointer */ for (j = (int)(n - 1), carry = TRUE; j >= 0 && carry; --j) { @@ -621,7 +589,7 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize if (--idx[j]) carry = FALSE; else { - HDassert(size); + assert(size); idx[j] = size[j]; } /* end else */ } @@ -644,9 +612,6 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -663,7 +628,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(elmt_size < SIZE_MAX); + assert(elmt_size < SIZE_MAX); if (n) { H5VM_vector_cpy(n, idx, size); @@ -682,7 +647,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize if (--idx[j]) carry = FALSE; else { - HDassert(size); + assert(size); idx[j] = size[j]; } } @@ -710,9 +675,6 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize * * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * *------------------------------------------------------------------------- */ herr_t @@ -729,7 +691,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(elmt_size < SIZE_MAX); + assert(elmt_size < SIZE_MAX); if (n) { H5VM_vector_cpy(n, idx, size); @@ -748,7 +710,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss if (--idx[j]) carry = FALSE; else { - HDassert(size); + assert(size); idx[j] = size[j]; } } @@ -762,76 +724,6 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss FUNC_LEAVE_NOAPI(SUCCEED) } -#ifdef LATER - -/*------------------------------------------------------------------------- - * Function: H5VM__stride_copy2 - * - * Purpose: Similar to H5VM_stride_copy() except the source and - * destination each have their own dimensionality and size and - * we copy exactly NELMTS elements each of size ELMT_SIZE. The - * size counters wrap if NELMTS is more than a size counter. - * - * Return: void - * - * Programmer: Robb Matzke - * Saturday, October 11, 1997 - * - *------------------------------------------------------------------------- - */ -static void -H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n, const hsize_t *dst_size, - const hsize_t *dst_stride, void *_dst, unsigned src_n, const hsize_t *src_size, - const hsize_t *src_stride, const void *_src) -{ - uint8_t *dst = (uint8_t *)_dst; - const uint8_t *src = (const uint8_t *)_src; - hsize_t dst_idx[H5VM_HYPER_NDIMS]; - hsize_t src_idx[H5VM_HYPER_NDIMS]; - hsize_t i; /* Local index variable */ - int j; /* Local index variable */ - hbool_t carry; - - FUNC_ENTER_PACKAGE_NOERR - - HDassert(elmt_size < SIZE_MAX); - HDassert(dst_n > 0); - HDassert(src_n > 0); - - H5VM_vector_cpy(dst_n, dst_idx, dst_size); - H5VM_vector_cpy(src_n, src_idx, src_size); - - for (i = 0; i < nelmts; i++) { - - /* Copy an element */ - H5_CHECK_OVERFLOW(elmt_size, hsize_t, size_t); - H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ - - /* Decrement indices and advance pointers */ - for (j = (int)(dst_n - 1), carry = TRUE; j >= 0 && carry; --j) { - dst += dst_stride[j]; - if (--dst_idx[j]) - carry = FALSE; - else { - HDassert(dst_size); - dst_idx[j] = dst_size[j]; - } /* end else */ - } - for (j = (int)(src_n - 1), carry = TRUE; j >= 0 && carry; --j) { - src += src_stride[j]; - if (--src_idx[j]) - carry = FALSE; - else { - HDassert(src_size); - src_idx[j] = src_size[j]; - } /* end else */ - } - } - - FUNC_LEAVE_NOAPI_VOID -} -#endif /* LATER */ - /*------------------------------------------------------------------------- * Function: H5VM_array_fill * @@ -841,9 +733,6 @@ H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size, unsigned dst_n, const hsiz * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, June 18, 1998 - * *------------------------------------------------------------------------- */ herr_t @@ -856,10 +745,10 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(dst); - HDassert(src); - HDassert(size < SIZE_MAX && size > 0); - HDassert(count < SIZE_MAX && count > 0); + assert(dst); + assert(src); + assert(size < SIZE_MAX && size > 0); + assert(count < SIZE_MAX && count > 0); H5MM_memcpy(dst, src, size); /* copy first item */ @@ -894,9 +783,6 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count) * * Return: void * - * Programmer: Quincey Koziol - * Monday, April 28, 2003 - * *------------------------------------------------------------------------- */ void @@ -907,9 +793,9 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(total_size); - HDassert(down); + assert(n <= H5VM_HYPER_NDIMS); + assert(total_size); + assert(down); /* Build the sizes of each dimension in the array * (From fastest to slowest) @@ -934,9 +820,6 @@ H5VM_array_down(unsigned n, const hsize_t *total_size, hsize_t *down) * * Return: Byte offset from beginning of array to element offset * - * Programmer: Quincey Koziol - * Tuesday, June 22, 1999 - * *------------------------------------------------------------------------- */ hsize_t @@ -947,9 +830,9 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) FUNC_ENTER_NOAPI_NOINIT_NOERR - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(acc); - HDassert(offset); + assert(n <= H5VM_HYPER_NDIMS); + assert(acc); + assert(offset); /* Compute offset in array */ for (u = 0, ret_value = 0; u < n; u++) @@ -970,9 +853,6 @@ H5VM_array_offset_pre(unsigned n, const hsize_t *acc, const hsize_t *offset) * * Return: Byte offset from beginning of array to element offset * - * Programmer: Quincey Koziol - * Tuesday, June 22, 1999 - * *------------------------------------------------------------------------- */ hsize_t @@ -983,9 +863,9 @@ H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset) FUNC_ENTER_NOAPI_NOERR - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(total_size); - HDassert(offset); + assert(n <= H5VM_HYPER_NDIMS); + assert(total_size); + assert(offset); /* Build the sizes of each dimension in the array */ H5VM_array_down(n, total_size, acc_arr); @@ -1009,9 +889,6 @@ H5VM_array_offset(unsigned n, const hsize_t *total_size, const hsize_t *offset) * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, July 16, 2009 - * *------------------------------------------------------------------------- */ herr_t @@ -1022,8 +899,8 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *co FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(coords); + assert(n <= H5VM_HYPER_NDIMS); + assert(coords); /* Compute the coordinates from the offset */ for (u = 0; u < n; u++) { @@ -1047,9 +924,6 @@ H5VM_array_calc_pre(hsize_t offset, unsigned n, const hsize_t *down, hsize_t *co * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Wednesday, April 16, 2003 - * *------------------------------------------------------------------------- */ herr_t @@ -1061,16 +935,16 @@ H5VM_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t * FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(n <= H5VM_HYPER_NDIMS); - HDassert(total_size); - HDassert(coords); + assert(n <= H5VM_HYPER_NDIMS); + assert(total_size); + assert(coords); /* Build the sizes of each dimension in the array */ H5VM_array_down(n, total_size, idx); /* Compute the coordinates from the offset */ if (H5VM_array_calc_pre(offset, n, idx, coords) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute coordinates") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "can't compute coordinates"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1111,9 +985,6 @@ H5VM_array_calc(hsize_t offset, unsigned n, const hsize_t *total_size, hsize_t * * * Return: Chunk index on success (can't fail) * - * Programmer: Quincey Koziol - * Monday, April 21, 2003 - * *------------------------------------------------------------------------- */ hsize_t @@ -1125,10 +996,10 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, co FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(ndims <= H5VM_HYPER_NDIMS); - HDassert(coord); - HDassert(chunk); - HDassert(down_nchunks); + assert(ndims <= H5VM_HYPER_NDIMS); + assert(coord); + assert(chunk); + assert(down_nchunks); /* Defer to H5VM_chunk_index_scaled */ chunk_idx = H5VM_chunk_index_scaled(ndims, coord, chunk, down_nchunks, scaled_coord); @@ -1143,9 +1014,6 @@ H5VM_chunk_index(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, co * * Return: void * - * Programmer: Quincey Koziol - * Wednesday, November 19, 2014 - * *------------------------------------------------------------------------- */ void @@ -1156,10 +1024,10 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(ndims <= H5VM_HYPER_NDIMS); - HDassert(coord); - HDassert(chunk); - HDassert(scaled); + assert(ndims <= H5VM_HYPER_NDIMS); + assert(coord); + assert(chunk); + assert(scaled); /* Compute the scaled coordinates for actual coordinates */ /* (Note that the 'scaled' array is an 'OUT' parameter) */ @@ -1207,9 +1075,6 @@ H5VM_chunk_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *chunk, h * * Return: Chunk index on success (can't fail) * - * Programmer: Vailin Choi - * Monday, February 9, 2015 - * *------------------------------------------------------------------------- */ hsize_t @@ -1222,11 +1087,11 @@ H5VM_chunk_index_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *ch FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(ndims <= H5VM_HYPER_NDIMS); - HDassert(coord); - HDassert(chunk); - HDassert(down_nchunks); - HDassert(scaled); + assert(ndims <= H5VM_HYPER_NDIMS); + assert(coord); + assert(chunk); + assert(down_nchunks); + assert(scaled); /* Compute the scaled coordinates for actual coordinates */ /* (Note that the 'scaled' array is an 'OUT' parameter) */ @@ -1257,9 +1122,6 @@ H5VM_chunk_index_scaled(unsigned ndims, const hsize_t *coord, const uint32_t *ch * * Return: Non-negative # of bytes operated on, on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, September 30, 2010 - * *------------------------------------------------------------------------- */ ssize_t @@ -1278,15 +1140,15 @@ H5VM_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ - HDassert(dst_curr_seq); - HDassert(*dst_curr_seq < dst_max_nseq); - HDassert(dst_len_arr); - HDassert(dst_off_arr); - HDassert(src_curr_seq); - HDassert(*src_curr_seq < src_max_nseq); - HDassert(src_len_arr); - HDassert(src_off_arr); - HDassert(op); + assert(dst_curr_seq); + assert(*dst_curr_seq < dst_max_nseq); + assert(dst_len_arr); + assert(dst_off_arr); + assert(src_curr_seq); + assert(*src_curr_seq < src_max_nseq); + assert(src_len_arr); + assert(src_off_arr); + assert(op); /* Set initial offset & length pointers */ dst_len_ptr = dst_len_arr + *dst_curr_seq; @@ -1314,7 +1176,7 @@ H5VM_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize do { /* Make operator callback */ if ((*op)(tmp_dst_off, tmp_src_off, tmp_src_len, op_data) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation"); /* Accumulate number of bytes copied */ acc_len += tmp_src_len; @@ -1356,7 +1218,7 @@ H5VM_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize do { /* Make operator callback */ if ((*op)(tmp_dst_off, tmp_src_off, tmp_dst_len, op_data) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation"); /* Accumulate number of bytes copied */ acc_len += tmp_dst_len; @@ -1398,7 +1260,7 @@ H5VM_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize do { /* Make operator callback */ if ((*op)(tmp_dst_off, tmp_src_off, tmp_dst_len, op_data) < 0) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTOPERATE, FAIL, "can't perform operation"); /* Accumulate number of bytes copied */ acc_len += tmp_dst_len; @@ -1461,9 +1323,6 @@ H5VM_opvv(size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_len_arr[], hsize * * Return: Non-negative # of bytes copied on success/Negative on failure * - * Programmer: Quincey Koziol - * Friday, May 2, 2003 - * *------------------------------------------------------------------------- */ ssize_t @@ -1484,16 +1343,16 @@ H5VM_memcpyvv(void *_dst, size_t dst_max_nseq, size_t *dst_curr_seq, size_t dst_ FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(_dst); - HDassert(dst_curr_seq); - HDassert(*dst_curr_seq < dst_max_nseq); - HDassert(dst_len_arr); - HDassert(dst_off_arr); - HDassert(_src); - HDassert(src_curr_seq); - HDassert(*src_curr_seq < src_max_nseq); - HDassert(src_len_arr); - HDassert(src_off_arr); + assert(_dst); + assert(dst_curr_seq); + assert(*dst_curr_seq < dst_max_nseq); + assert(dst_len_arr); + assert(dst_off_arr); + assert(_src); + assert(src_curr_seq); + assert(*src_curr_seq < src_max_nseq); + assert(src_len_arr); + assert(src_off_arr); /* Set initial offset & length pointers */ dst_len_ptr = dst_len_arr + *dst_curr_seq; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5VarLenType.cpp b/externals/coda-oss/modules/drivers/hdf5/source/H5VarLenType.cpp deleted file mode 100644 index 0270febfe5..0000000000 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5VarLenType.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#include - -#include "H5Include.h" -#include "H5Exception.h" -#include "H5IdComponent.h" -#include "H5PropList.h" -#include "H5OcreatProp.h" -#include "H5DcreatProp.h" -#include "H5LcreatProp.h" -#include "H5LaccProp.h" -#include "H5DaccProp.h" -#include "H5Location.h" -#include "H5Object.h" -#include "H5DataType.h" -#include "H5VarLenType.h" - -namespace H5 { - -//-------------------------------------------------------------------------- -// Function: VarLenType default constructor -///\brief Default constructor: Creates a stub variable-length datatype. -//-------------------------------------------------------------------------- -VarLenType::VarLenType() : DataType() -{ -} - -//-------------------------------------------------------------------------- -// Function: VarLenType overloaded constructor -///\brief Creates an VarLenType object using an existing id. -///\param existing_id - IN: Id of an existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -VarLenType::VarLenType(const hid_t existing_id) : DataType(existing_id) -{ -} - -//-------------------------------------------------------------------------- -// Function: VarLenType copy constructor -///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -VarLenType::VarLenType(const VarLenType &original) : DataType(original) -{ -} - -//-------------------------------------------------------------------------- -// Function: VarLenType overloaded constructor -///\brief Deprecated - will be removed after 1.10.2 -///\param base_type - IN: Pointer to existing datatype -///\exception H5::DataTypeIException -// Description -// DataType passed by pointer to avoid clashing with copy -// constructor. -// Updated: this is unnecessary. -// -BMR, Sep, 2017 -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -VarLenType::VarLenType(const DataType *base_type) : DataType() -{ - id = H5Tvlen_create(base_type->getId()); - if (id < 0) { - throw DataTypeIException("VarLenType constructor", "H5Tvlen_create returns negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: VarLenType overloaded constructor -///\brief Creates a new variable-length datatype based on the specified -/// \a base_type. -///\param base_type - IN: An existing datatype -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -VarLenType::VarLenType(const DataType &base_type) : DataType() -{ - id = H5Tvlen_create(base_type.getId()); - if (id < 0) { - throw DataTypeIException("VarLenType constructor", "H5Tvlen_create returns negative value"); - } -} - -//-------------------------------------------------------------------------- -// Function: VarLenType overloaded constructor -///\brief Creates an VarLenType instance by opening an HDF5 variable -/// length datatype given its name, provided as a C char*. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Variable length type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openVarLenType(const char*) to -// improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -VarLenType::VarLenType(const H5Location &loc, const char *dtype_name) : DataType() -{ - id = p_opentype(loc, dtype_name); -} - -//-------------------------------------------------------------------------- -// Function: VarLenType overloaded constructor -///\brief Creates an VarLenType instance by opening an HDF5 variable -/// length datatype given its name, provided as an \c H5std_string. -///\param loc - IN: Location of the type -///\param dtype_name - IN: Variable length type name -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 -// Description -// In 1.10.1, this constructor was introduced and may replace the -// existing function CommonFG::openVarLenType(const H5std_string&) -// to improve usability. -// -BMR, Dec 2016 -//-------------------------------------------------------------------------- -VarLenType::VarLenType(const H5Location &loc, const H5std_string &dtype_name) : DataType() -{ - id = p_opentype(loc, dtype_name.c_str()); -} - -//-------------------------------------------------------------------------- -// Function: VarLenType::decode -///\brief Returns an VarLenType object via DataType* by decoding the -/// binary object description of this type. -/// -///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 -//-------------------------------------------------------------------------- -DataType * -VarLenType::decode() const -{ - hid_t encoded_vltype_id = H5I_INVALID_HID; - try { - encoded_vltype_id = p_decode(); - } - catch (DataTypeIException &err) { - throw; - } - VarLenType *encoded_vltype = new VarLenType; - encoded_vltype->p_setId(encoded_vltype_id); - return (encoded_vltype); -} - -//-------------------------------------------------------------------------- -// Function: VarLenType destructor -///\brief Properly terminates access to this datatype. -// Programmer Binh-Minh Ribler - May, 2004 -//-------------------------------------------------------------------------- -VarLenType::~VarLenType() -{ -} - -} // namespace H5 diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5WB.c b/externals/coda-oss/modules/drivers/hdf5/source/H5WB.c index 7bbb6fcf88..7be258d8f9 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5WB.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5WB.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5WB.c - * Jun 26 2007 - * Quincey Koziol * * Purpose: Implements the "wrapped buffer" code for wrapping * an existing [statically sized] buffer, in order to @@ -87,9 +84,6 @@ H5FL_BLK_DEFINE_STATIC(extra_buf); * Return: Pointer to buffer wrapper info on success * NULL on failure * - * Programmer: Quincey Koziol - * Jun 26 2007 - * *------------------------------------------------------------------------- */ H5WB_t * @@ -103,12 +97,12 @@ H5WB_wrap(void *buf, size_t buf_size) /* * Check arguments. */ - HDassert(buf); - HDassert(buf_size); + assert(buf); + assert(buf_size); /* Create wrapped buffer info */ if (NULL == (wb = H5FL_MALLOC(H5WB_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for wrapped buffer info") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for wrapped buffer info"); /* Wrap buffer given */ wb->wrapped_buf = buf; @@ -139,9 +133,6 @@ H5WB_wrap(void *buf, size_t buf_size) * Return: Pointer to buffer pointer on success * NULL on failure * - * Programmer: Quincey Koziol - * Jun 26 2007 - * *------------------------------------------------------------------------- */ void * @@ -154,17 +145,17 @@ H5WB_actual(H5WB_t *wb, size_t need) /* * Check arguments. */ - HDassert(wb); - HDassert(wb->wrapped_buf); + assert(wb); + assert(wb->wrapped_buf); /* Check for previously allocated buffer */ if (wb->actual_buf && wb->actual_buf != wb->wrapped_buf) { /* Sanity check */ - HDassert(wb->actual_size > wb->wrapped_size); + assert(wb->actual_size > wb->wrapped_size); /* Check if we can re-use existing buffer */ if (need <= wb->alloc_size) - HGOTO_DONE(wb->actual_buf) + HGOTO_DONE(wb->actual_buf); /* Can't re-use existing buffer, free it and proceed */ else wb->actual_buf = H5FL_BLK_FREE(extra_buf, wb->actual_buf); @@ -174,7 +165,7 @@ H5WB_actual(H5WB_t *wb, size_t need) if (need > wb->wrapped_size) { /* Need to allocate new buffer */ if (NULL == (wb->actual_buf = H5FL_BLK_MALLOC(extra_buf, need))) - HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, NULL, "memory allocation failed"); /* Remember size of buffer allocated */ wb->alloc_size = need; @@ -205,9 +196,6 @@ H5WB_actual(H5WB_t *wb, size_t need) * Return: Pointer to buffer pointer on success * NULL on failure * - * Programmer: Quincey Koziol - * Jun 26 2007 - * *------------------------------------------------------------------------- */ void * @@ -220,15 +208,15 @@ H5WB_actual_clear(H5WB_t *wb, size_t need) /* * Check arguments. */ - HDassert(wb); - HDassert(wb->wrapped_buf); + assert(wb); + assert(wb->wrapped_buf); /* Get a pointer to an actual buffer */ if (NULL == (ret_value = H5WB_actual(wb, need))) - HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, NULL, "memory allocation failed"); /* Clear the buffer */ - HDmemset(ret_value, 0, need); + memset(ret_value, 0, need); done: FUNC_LEAVE_NOAPI(ret_value) @@ -241,9 +229,6 @@ H5WB_actual_clear(H5WB_t *wb, size_t need) * * Return: SUCCEED/FAIL * - * Programmer: Quincey Koziol - * Jun 26 2007 - * *------------------------------------------------------------------------- */ herr_t @@ -254,13 +239,13 @@ H5WB_unwrap(H5WB_t *wb) /* * Check arguments. */ - HDassert(wb); - HDassert(wb->wrapped_buf); + assert(wb); + assert(wb->wrapped_buf); /* Release any extra buffers allocated */ if (wb->actual_buf && wb->actual_buf != wb->wrapped_buf) { /* Sanity check */ - HDassert(wb->actual_size > wb->wrapped_size); + assert(wb->actual_size > wb->wrapped_size); wb->actual_buf = H5FL_BLK_FREE(extra_buf, wb->actual_buf); } /* end if */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Z.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Z.c index b2c48d2f26..111d71a314 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Z.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Z.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -87,27 +86,33 @@ H5Z_init(void) FUNC_ENTER_NOAPI(FAIL) if (H5_TERM_GLOBAL) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Internal filters */ if (H5Z_register(H5Z_SHUFFLE) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register shuffle filter"); if (H5Z_register(H5Z_FLETCHER32) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register fletcher32 filter"); if (H5Z_register(H5Z_NBIT) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register nbit filter"); if (H5Z_register(H5Z_SCALEOFFSET) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register scaleoffset filter"); /* External filters */ #ifdef H5_HAVE_FILTER_DEFLATE if (H5Z_register(H5Z_DEFLATE) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register deflate filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register deflate filter"); #endif /* H5_HAVE_FILTER_DEFLATE */ #ifdef H5_HAVE_FILTER_SZIP - H5Z_SZIP->encoder_present = SZ_encoder_enabled(); - if (H5Z_register(H5Z_SZIP) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter") + { + int encoder_enabled = SZ_encoder_enabled(); + if (encoder_enabled < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "check for szip encoder failed"); + + H5Z_SZIP->encoder_present = (unsigned)encoder_enabled; + if (H5Z_register(H5Z_SZIP) < 0) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register szip filter"); + } #endif /* H5_HAVE_FILTER_SZIP */ done: @@ -149,12 +154,12 @@ H5Z_term_package(void) if (0 == nprint++) { /* Print column headers */ - HDfprintf(H5DEBUG(Z), "H5Z: filter statistics " - "accumulated over life of library:\n"); - HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "Filter", "Total", - "Errors", "User", "System", "Elapsed", "Bandwidth"); - HDfprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "------", "-----", - "------", "----", "------", "-------", "---------"); + fprintf(H5DEBUG(Z), "H5Z: filter statistics " + "accumulated over life of library:\n"); + fprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "Filter", "Total", "Errors", + "User", "System", "Elapsed", "Bandwidth"); + fprintf(H5DEBUG(Z), " %-16s %10s %10s %8s %8s %8s %10s\n", "------", "-----", "------", + "----", "------", "-------", "---------"); } /* end if */ /* Truncate the comment to fit in the field */ @@ -170,14 +175,14 @@ H5Z_term_package(void) H5Z_stat_table_g[i].stats[dir].times.elapsed); /* Print the statistics */ - HDfprintf(H5DEBUG(Z), " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE " %8s %8s %8s %10s\n", - (dir ? "<" : ">"), comment, H5Z_stat_table_g[i].stats[dir].total, - H5Z_stat_table_g[i].stats[dir].errors, timestrs.user, timestrs.system, - timestrs.elapsed, bandwidth); + fprintf(H5DEBUG(Z), " %s%-15s %10" PRIdHSIZE " %10" PRIdHSIZE " %8s %8s %8s %10s\n", + (dir ? "<" : ">"), comment, H5Z_stat_table_g[i].stats[dir].total, + H5Z_stat_table_g[i].stats[dir].errors, timestrs.user, timestrs.system, + timestrs.elapsed, bandwidth); next: - HDfree(timestrs.user); - HDfree(timestrs.system); - HDfree(timestrs.elapsed); + free(timestrs.user); + free(timestrs.system); + free(timestrs.elapsed); } /* end for */ } /* end for */ } /* end if */ @@ -220,7 +225,7 @@ H5Zregister(const void *cls) /* Check args */ if (cls_real == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter class"); /* Check H5Z_class_t version number; this is where a function to convert * from an outdated version should be called. @@ -257,15 +262,15 @@ H5Zregister(const void *cls) } /* end if */ if (cls_real->id < 0 || cls_real->id > H5Z_FILTER_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number"); if (cls_real->id < H5Z_FILTER_RESERVED) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters"); if (cls_real->filter == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no filter function specified"); /* Do it */ if (H5Z_register(cls_real) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter"); done: FUNC_LEAVE_API(ret_value) @@ -289,8 +294,8 @@ H5Z_register(const H5Z_class2_t *cls) FUNC_ENTER_NOAPI(FAIL) - HDassert(cls); - HDassert(cls->id >= 0 && cls->id <= H5Z_FILTER_MAX); + assert(cls); + assert(cls->id >= 0 && cls->id <= H5Z_FILTER_MAX); /* Is the filter already registered? */ for (i = 0; i < H5Z_table_used_g; i++) @@ -306,11 +311,11 @@ H5Z_register(const H5Z_class2_t *cls) H5Z_stats_t *stat_table = (H5Z_stats_t *)H5MM_realloc(H5Z_stat_table_g, n * sizeof(H5Z_stats_t)); #endif /* H5Z_DEBUG */ if (!table) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter table") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter table"); H5Z_table_g = table; #ifdef H5Z_DEBUG if (!stat_table) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter statistics table") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend filter statistics table"); H5Z_stat_table_g = stat_table; #endif /* H5Z_DEBUG */ H5Z_table_alloc_g = n; @@ -320,7 +325,7 @@ H5Z_register(const H5Z_class2_t *cls) i = H5Z_table_used_g++; H5MM_memcpy(H5Z_table_g + i, cls, sizeof(H5Z_class2_t)); #ifdef H5Z_DEBUG - HDmemset(H5Z_stat_table_g + i, 0, sizeof(H5Z_stats_t)); + memset(H5Z_stat_table_g + i, 0, sizeof(H5Z_stats_t)); #endif /* H5Z_DEBUG */ } /* end if */ /* Filter already registered */ @@ -352,13 +357,13 @@ H5Zunregister(H5Z_filter_t id) /* Check args */ if (id < 0 || id > H5Z_FILTER_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number"); if (id < H5Z_FILTER_RESERVED) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to modify predefined filters"); /* Do it */ if (H5Z__unregister(id) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to unregister filter"); done: FUNC_LEAVE_API(ret_value) @@ -383,7 +388,7 @@ H5Z__unregister(H5Z_filter_t filter_id) FUNC_ENTER_PACKAGE - HDassert(filter_id >= 0 && filter_id <= H5Z_FILTER_MAX); + assert(filter_id >= 0 && filter_id <= H5Z_FILTER_MAX); /* Is the filter already registered? */ for (filter_index = 0; filter_index < H5Z_table_used_g; filter_index++) @@ -392,7 +397,7 @@ H5Z__unregister(H5Z_filter_t filter_id) /* Fail if filter not found */ if (filter_index >= H5Z_table_used_g) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered") + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter is not registered"); /* Initialize the structure object for iteration */ object.filter_id = filter_id; @@ -403,31 +408,31 @@ H5Z__unregister(H5Z_filter_t filter_id) /* Iterate through all opened datasets, returns a failure if any of them uses the filter */ if (H5I_iterate(H5I_DATASET, H5Z__check_unregister_dset_cb, &object, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed"); if (object.found) HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, - "can't unregister filter because a dataset is still using it") + "can't unregister filter because a dataset is still using it"); /* Iterate through all opened groups, returns a failure if any of them uses the filter */ if (H5I_iterate(H5I_GROUP, H5Z__check_unregister_group_cb, &object, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed"); if (object.found) HGOTO_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, - "can't unregister filter because a group is still using it") + "can't unregister filter because a group is still using it"); /* Iterate through all opened files and flush them */ if (H5I_iterate(H5I_FILE, H5Z__flush_file_cb, &object, FALSE) < 0) - HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed") + HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "iteration failed"); /* Remove filter from table */ /* Don't worry about shrinking table size (for now) */ - HDmemmove(&H5Z_table_g[filter_index], &H5Z_table_g[filter_index + 1], - sizeof(H5Z_class2_t) * ((H5Z_table_used_g - 1) - filter_index)); + memmove(&H5Z_table_g[filter_index], &H5Z_table_g[filter_index + 1], + sizeof(H5Z_class2_t) * ((H5Z_table_used_g - 1) - filter_index)); #ifdef H5Z_DEBUG - HDmemmove(&H5Z_stat_table_g[filter_index], &H5Z_stat_table_g[filter_index + 1], - sizeof(H5Z_stats_t) * ((H5Z_table_used_g - 1) - filter_index)); + memmove(&H5Z_stat_table_g[filter_index], &H5Z_stat_table_g[filter_index + 1], + sizeof(H5Z_stats_t) * ((H5Z_table_used_g - 1) - filter_index)); #endif /* H5Z_DEBUG */ H5Z_table_used_g--; @@ -456,11 +461,11 @@ H5Z__check_unregister(hid_t ocpl_id, H5Z_filter_t filter_id) /* Get the plist structure of object creation */ if (NULL == (plist = H5P_object_verify(ocpl_id, H5P_OBJECT_CREATE))) - HGOTO_ERROR(H5E_PLINE, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_PLINE, H5E_BADID, FAIL, "can't find object for ID"); /* Check if the object creation property list uses the filter */ if ((ret_value = H5P_filter_in_pline(plist, filter_id)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -490,15 +495,15 @@ H5Z__check_unregister_group_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void FUNC_ENTER_PACKAGE - HDassert(obj_ptr); + assert(obj_ptr); /* Get the group creation property */ if ((ocpl_id = H5G_get_create_plist((H5G_t *)obj_ptr)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get group creation property list") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get group creation property list"); /* Check if the filter is in the group creation property list */ if ((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline"); /* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and * let H5Z__unregister return failure. @@ -511,7 +516,7 @@ H5Z__check_unregister_group_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void done: if (ocpl_id > 0) if (H5I_dec_app_ref(ocpl_id) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist") + HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__check_unregister_group_cb() */ @@ -540,15 +545,15 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * FUNC_ENTER_PACKAGE - HDassert(obj_ptr); + assert(obj_ptr); /* Get the dataset creation property */ if ((ocpl_id = H5D_get_create_plist((H5D_t *)obj_ptr)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get dataset creation property list"); /* Check if the filter is in the dataset creation property list */ if ((filter_in_pline = H5Z__check_unregister(ocpl_id, object->filter_id)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't check filter in pipeline"); /* H5I_iterate expects TRUE to stop the loop over objects. Stop the loop and * let H5Z__unregister return failure. @@ -561,7 +566,7 @@ H5Z__check_unregister_dset_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void * done: if (ocpl_id > 0) if (H5I_dec_app_ref(ocpl_id) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist") + HDONE_ERROR(H5E_PLINE, H5E_CANTDEC, FAIL, "can't release plist"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__check_unregister_dset_cb() */ @@ -588,8 +593,8 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_PARA FUNC_ENTER_PACKAGE /* Sanity checks */ - HDassert(obj_ptr); - HDassert(key); + assert(obj_ptr); + assert(key); /* Do a global flush if the file is opened for write */ if (H5F_ACC_RDWR & H5F_INTENT(f)) { @@ -607,7 +612,7 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_PARA /* Retrieve the file communicator */ if (MPI_COMM_NULL == (mpi_comm = H5F_mpi_get_comm(f))) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get MPI communicator") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get MPI communicator"); /* Issue the barrier */ if (mpi_comm != MPI_COMM_NULL) @@ -621,7 +626,7 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_PARA /* Call the flush routine for mounted file hierarchies */ if (H5F_flush_mounts((H5F_t *)obj_ptr) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFLUSH, FAIL, "unable to flush file hierarchy"); } /* end if */ done: @@ -646,10 +651,10 @@ H5Zfilter_avail(H5Z_filter_t id) /* Check args */ if (id < 0 || id > H5Z_FILTER_MAX) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid filter identification number"); if ((ret_value = H5Z_filter_avail(id)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "unable to check the availability of the filter") + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "unable to check the availability of the filter"); done: FUNC_LEAVE_API(ret_value) @@ -676,13 +681,13 @@ H5Z_filter_avail(H5Z_filter_t id) /* Is the filter already registered? */ for (i = 0; i < H5Z_table_used_g; i++) if (H5Z_table_g[i].id == id) - HGOTO_DONE(TRUE) + HGOTO_DONE(TRUE); key.id = (int)id; if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) { if (H5Z_register(filter_info) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter") - HGOTO_DONE(TRUE) + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register loaded filter"); + HGOTO_DONE(TRUE); } /* end if */ done: @@ -712,7 +717,7 @@ H5Z__prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, hi FUNC_ENTER_PACKAGE - HDassert(pline->nused > 0); + assert(pline->nused > 0); /* Iterate over filters */ for (u = 0; u < pline->nused; u++) { @@ -722,7 +727,7 @@ H5Z__prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, hi if (pline->filter[u].flags & H5Z_FLAG_OPTIONAL) H5E_clear_stack(NULL); else - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located") + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "required filter was not located"); } /* end if */ else { /* Make correct callback */ @@ -740,12 +745,12 @@ H5Z__prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, hi /* Indicate error during filter callback */ if (status < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback") + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "error during user callback"); /* Indicate filter can't apply to this combination of parameters. * If the filter is NOT optional, returns failure. */ if (status == FALSE && !(pline->filter[u].flags & H5Z_FLAG_OPTIONAL)) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate") + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "filter parameters not appropriate"); } /* end if */ break; @@ -755,12 +760,12 @@ H5Z__prelude_callback(const H5O_pline_t *pline, hid_t dcpl_id, hid_t type_id, hi /* Make callback to filter's "set local" function */ if ((fclass->set_local)(dcpl_id, type_id, space_id) < 0) /* Indicate error during filter callback */ - HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback") + HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "error during user callback"); } /* end if */ break; default: - HDassert("invalid prelude type" && 0); + assert("invalid prelude type" && 0); } /* end switch */ } /* end else */ } /* end for */ @@ -792,8 +797,8 @@ H5Z__prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_typ FUNC_ENTER_PACKAGE - HDassert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); - HDassert(H5I_DATATYPE == H5I_get_type(type_id)); + assert(H5I_GENPROP_LST == H5I_get_type(dcpl_id)); + assert(H5I_DATATYPE == H5I_get_type(type_id)); /* Check if the property list is non-default */ if (dcpl_id != H5P_DATASET_CREATE_DEFAULT) { @@ -801,15 +806,15 @@ H5Z__prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_typ /* Get memory for the layout */ if (NULL == (dcpl_layout = (H5O_layout_t *)H5MM_calloc(sizeof(H5O_layout_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate dcpl layout buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate dcpl layout buffer"); /* Get dataset creation property list object */ if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list"); /* Peek at the layout information */ if (H5P_peek(dc_plist, H5D_CRT_LAYOUT_NAME, dcpl_layout) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve layout"); /* Check if the dataset is chunked */ if (H5D_CHUNKED == dcpl_layout->type) { @@ -817,7 +822,7 @@ H5Z__prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_typ /* Get I/O pipeline information */ if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &dcpl_pline) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't retrieve pipeline filter"); /* Check if the chunks have filters */ if (dcpl_pline.nused > 0) { @@ -829,24 +834,24 @@ H5Z__prepare_prelude_callback_dcpl(hid_t dcpl_id, hid_t type_id, H5Z_prelude_typ for (u = 0; u < dcpl_layout->u.chunk.ndims; u++) chunk_dims[u] = dcpl_layout->u.chunk.dim[u]; if (NULL == (space = H5S_create_simple(dcpl_layout->u.chunk.ndims, chunk_dims, NULL))) - HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create simple dataspace"); /* Get ID for dataspace to pass to filter routines */ if ((space_id = H5I_register(H5I_DATASPACE, space, FALSE)) < 0) { (void)H5S_close(space); - HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID") + HGOTO_ERROR(H5E_ID, H5E_CANTREGISTER, FAIL, "unable to register dataspace ID"); } /* Make the callbacks */ if (H5Z__prelude_callback(&dcpl_pline, dcpl_id, type_id, space_id, prelude_type) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter"); } } } done: if (space_id > 0 && H5I_dec_ref(space_id) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace") + HDONE_ERROR(H5E_PLINE, H5E_CANTRELEASE, FAIL, "unable to close dataspace"); if (dcpl_layout) dcpl_layout = (H5O_layout_t *)H5MM_xfree(dcpl_layout); @@ -878,7 +883,7 @@ H5Z_can_apply(hid_t dcpl_id, hid_t type_id) /* Make "can apply" callbacks for filters in pipeline */ if (H5Z__prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_CAN_APPLY) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -908,7 +913,7 @@ H5Z_set_local(hid_t dcpl_id, hid_t type_id) /* Make "set local" callbacks for filters in pipeline */ if (H5Z__prepare_prelude_callback_dcpl(dcpl_id, type_id, H5Z_PRELUDE_SET_LOCAL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") + HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -932,11 +937,11 @@ H5Z_can_apply_direct(const H5O_pline_t *pline) FUNC_ENTER_NOAPI(FAIL) - HDassert(pline->nused > 0); + assert(pline->nused > 0); /* Make "can apply" callbacks for filters in pipeline */ if (H5Z__prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_CAN_APPLY) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANAPPLY, FAIL, "unable to apply filter"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -964,11 +969,11 @@ H5Z_set_local_direct(const H5O_pline_t *pline) FUNC_ENTER_NOAPI(FAIL) - HDassert(pline->nused > 0); + assert(pline->nused > 0); /* Make "set local" callbacks for filters in pipeline */ if (H5Z__prelude_callback(pline, (hid_t)-1, (hid_t)-1, (hid_t)-1, H5Z_PRELUDE_SET_LOCAL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set") + HGOTO_ERROR(H5E_PLINE, H5E_SETLOCAL, FAIL, "local filter parameters not set"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1005,11 +1010,11 @@ H5Z_ignore_filters(hid_t dcpl_id, const H5T_t *type, const H5S_t *space) FUNC_ENTER_NOAPI(FAIL) if (NULL == (dc_plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list"); /* Get pipeline information */ if (H5P_peek(dc_plist, H5O_CRT_PIPELINE_NAME, &pline) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't retrieve pipeline filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't retrieve pipeline filter"); /* Get datatype and dataspace classes for quick access */ space_class = H5S_GET_EXTENT_TYPE(space); @@ -1026,7 +1031,7 @@ H5Z_ignore_filters(hid_t dcpl_id, const H5T_t *type, const H5S_t *space) if (pline.nused > 0) { for (ii = 0; ii < pline.nused; ii++) { if (!(pline.filter[ii].flags & H5Z_FLAG_OPTIONAL)) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "not suitable for filters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "not suitable for filters"); } /* All filters are optional, we can ignore them */ @@ -1056,10 +1061,10 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t FUNC_ENTER_NOAPI(FAIL) - HDassert(pline); - HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); - HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); - HDassert(0 == cd_nelmts || cd_values); + assert(pline); + assert(filter >= 0 && filter <= H5Z_FILTER_MAX); + assert(0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); + assert(0 == cd_nelmts || cd_values); /* Locate the filter in the pipeline */ for (idx = 0; idx < pline->nused; idx++) @@ -1068,7 +1073,7 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t /* Check if the filter was not already in the pipeline */ if (idx > pline->nused) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline"); /* Change parameters for filter */ pline->filter[idx].flags = flags; @@ -1086,7 +1091,8 @@ H5Z_modify(const H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t if (cd_nelmts > H5Z_COMMON_CD_VALUES) { pline->filter[idx].cd_values = (unsigned *)H5MM_malloc(cd_nelmts * sizeof(unsigned)); if (NULL == pline->filter[idx].cd_values) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter parameters") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, + "memory allocation failed for filter parameters"); } /* end if */ else pline->filter[idx].cd_values = pline->filter[idx]._cd_values; @@ -1120,17 +1126,17 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_ne FUNC_ENTER_NOAPI(FAIL) - HDassert(pline); - HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); - HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); - HDassert(0 == cd_nelmts || cd_values); + assert(pline); + assert(filter >= 0 && filter <= H5Z_FILTER_MAX); + assert(0 == (flags & ~((unsigned)H5Z_FLAG_DEFMASK))); + assert(0 == cd_nelmts || cd_values); /* * Check filter limit. We do it here for early warnings although we may * decide to relax this restriction in the future. */ if (pline->nused >= H5Z_MAX_NFILTERS) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "too many filters in pipeline"); /* Check for freshly allocated filter pipeline */ if (pline->version == 0) @@ -1155,7 +1161,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_ne x.nalloc = MAX(H5Z_MAX_NFILTERS, 2 * pline->nalloc); x.filter = (H5Z_filter_info_t *)H5MM_realloc(pline->filter, x.nalloc * sizeof(x.filter[0])); if (NULL == x.filter) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter pipeline"); /* Fix pointers in previous filters that need to point to their own * internal data. @@ -1182,7 +1188,7 @@ H5Z_append(H5O_pline_t *pline, H5Z_filter_t filter, unsigned flags, size_t cd_ne if (cd_nelmts > H5Z_COMMON_CD_VALUES) { pline->filter[idx].cd_values = (unsigned *)H5MM_malloc(cd_nelmts * sizeof(unsigned)); if (NULL == pline->filter[idx].cd_values) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for filter"); } /* end if */ else pline->filter[idx].cd_values = pline->filter[idx]._cd_values; @@ -1220,7 +1226,7 @@ H5Z__find_idx(H5Z_filter_t id) for (i = 0; i < H5Z_table_used_g; i++) if (H5Z_table_g[i].id == id) - HGOTO_DONE((int)i) + HGOTO_DONE((int)i); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1246,7 +1252,7 @@ H5Z_find(H5Z_filter_t id) /* Get the index in the global table */ if ((idx = H5Z__find_idx(id)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "required filter %d is not registered", id) + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "required filter %d is not registered", id); /* Set return value */ ret_value = H5Z_table_g + idx; @@ -1299,12 +1305,12 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i FUNC_ENTER_NOAPI(FAIL) - HDassert(0 == (flags & ~((unsigned)H5Z_FLAG_INVMASK))); - HDassert(filter_mask); - HDassert(nbytes && *nbytes > 0); - HDassert(buf_size && *buf_size > 0); - HDassert(buf && *buf); - HDassert(!pline || pline->nused < H5Z_MAX_NFILTERS); + assert(0 == (flags & ~((unsigned)H5Z_FLAG_INVMASK))); + assert(filter_mask); + assert(nbytes && *nbytes > 0); + assert(buf_size && *buf_size > 0); + assert(buf && *buf); + assert(!pline || pline->nused < H5Z_MAX_NFILTERS); #ifdef H5Z_DEBUG H5_timer_init(&timer); @@ -1331,7 +1337,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i if (NULL != (filter_info = (const H5Z_class2_t *)H5PL_load(H5PL_TYPE_FILTER, &key))) { /* Register the filter we loaded */ if (H5Z_register(filter_info) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, FAIL, "unable to register filter"); /* Search in the table of registered filters again to find the dynamic filter just loaded * and registered */ @@ -1347,10 +1353,10 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i * the filter */ if (pline->filter[idx].name) HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "required filter '%s' is not registered", - pline->filter[idx].name) + pline->filter[idx].name); else HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, - "required filter (name unavailable) is not registered") + "required filter (name unavailable) is not registered"); } } /* end if */ @@ -1382,7 +1388,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *buf_size, cb_struct.op_data))) || !cb_struct.func) - HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read") + HGOTO_ERROR(H5E_PLINE, H5E_READERROR, FAIL, "filter returned failure during read"); *nbytes = *buf_size; failed |= (unsigned)1 << idx; @@ -1401,7 +1407,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i if ((fclass_idx = H5Z__find_idx(pline->filter[idx].id)) < 0) { /* Check if filter is optional -- If it isn't, then error */ if ((pline->filter[idx].flags & H5Z_FLAG_OPTIONAL) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered") + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "required filter is not registered"); failed |= (unsigned)1 << idx; H5E_clear_stack(NULL); continue; /* filter excluded */ @@ -1434,7 +1440,7 @@ H5Z_pipeline(const H5O_pline_t *pline, unsigned flags, unsigned *filter_mask /*i if ((cb_struct.func && (H5Z_CB_FAIL == cb_struct.func(pline->filter[idx].id, *buf, *nbytes, cb_struct.op_data))) || !cb_struct.func) - HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure") + HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "filter returned failure"); *nbytes = *buf_size; } @@ -1469,8 +1475,8 @@ H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter) FUNC_ENTER_NOAPI(NULL) - HDassert(pline); - HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); + assert(pline); + assert(filter >= 0 && filter <= H5Z_FILTER_MAX); /* Locate the filter in the pipeline */ for (idx = 0; idx < pline->nused; idx++) @@ -1479,7 +1485,7 @@ H5Z_filter_info(const H5O_pline_t *pline, H5Z_filter_t filter) /* Check if the filter was not already in the pipeline */ if (idx >= pline->nused) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, NULL, "filter not in pipeline"); /* Set return value */ ret_value = &pline->filter[idx]; @@ -1507,8 +1513,8 @@ H5Z_filter_in_pline(const H5O_pline_t *pline, H5Z_filter_t filter) FUNC_ENTER_NOAPI_NOERR - HDassert(pline); - HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); + assert(pline); + assert(filter >= 0 && filter <= H5Z_FILTER_MAX); /* Locate the filter in the pipeline */ for (idx = 0; idx < pline->nused; idx++) @@ -1541,7 +1547,7 @@ H5Z_all_filters_avail(const H5O_pline_t *pline) FUNC_ENTER_NOAPI_NOERR /* Check args */ - HDassert(pline); + assert(pline); /* Iterate through all the filters in pipeline */ for (i = 0; i < pline->nused; i++) { @@ -1552,7 +1558,7 @@ H5Z_all_filters_avail(const H5O_pline_t *pline) /* Check if we didn't find the filter */ if (j == H5Z_table_used_g) - HGOTO_DONE(FALSE) + HGOTO_DONE(FALSE); } /* end for */ done: @@ -1577,17 +1583,17 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) FUNC_ENTER_NOAPI(FAIL) /* Check args */ - HDassert(pline); - HDassert(filter >= 0 && filter <= H5Z_FILTER_MAX); + assert(pline); + assert(filter >= 0 && filter <= H5Z_FILTER_MAX); /* if the pipeline has no filters, just return */ if (pline->nused == 0) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); /* Delete all filters */ if (H5Z_FILTER_ALL == filter) { if (H5O_msg_reset(H5O_PLINE_ID, pline) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFREE, FAIL, "can't release pipeline info") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFREE, FAIL, "can't release pipeline info"); } /* Delete filter */ else { @@ -1603,15 +1609,15 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) /* filter was not found in the pipeline */ if (!found) - HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline") + HGOTO_ERROR(H5E_PLINE, H5E_NOTFOUND, FAIL, "filter not in pipeline"); /* Free information for deleted filter */ if (pline->filter[idx].name && pline->filter[idx].name != pline->filter[idx]._name) - HDassert((HDstrlen(pline->filter[idx].name) + 1) > H5Z_COMMON_NAME_LEN); + assert((HDstrlen(pline->filter[idx].name) + 1) > H5Z_COMMON_NAME_LEN); if (pline->filter[idx].name != pline->filter[idx]._name) pline->filter[idx].name = (char *)H5MM_xfree(pline->filter[idx].name); if (pline->filter[idx].cd_values && pline->filter[idx].cd_values != pline->filter[idx]._cd_values) - HDassert(pline->filter[idx].cd_nelmts > H5Z_COMMON_CD_VALUES); + assert(pline->filter[idx].cd_nelmts > H5Z_COMMON_CD_VALUES); if (pline->filter[idx].cd_values != pline->filter[idx]._cd_values) pline->filter[idx].cd_values = (unsigned *)H5MM_xfree(pline->filter[idx].cd_values); @@ -1631,7 +1637,7 @@ H5Z_delete(H5O_pline_t *pline, H5Z_filter_t filter) pline->nused--; /* Reset information for previous last filter in pipeline */ - HDmemset(&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); + memset(&pline->filter[pline->nused], 0, sizeof(H5Z_filter_info_t)); } /* end else */ done: @@ -1658,7 +1664,7 @@ H5Zget_filter_info(H5Z_filter_t filter, unsigned *filter_config_flags /*out*/) /* Get the filter info */ if (H5Z_get_filter_info(filter, filter_config_flags) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "Filter info not retrieved"); done: FUNC_LEAVE_API(ret_value) @@ -1684,7 +1690,7 @@ H5Z_get_filter_info(H5Z_filter_t filter, unsigned int *filter_config_flags) /* Look up the filter class info */ if (NULL == (fclass = H5Z_find(filter))) - HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "Filter not defined") + HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "Filter not defined"); /* Set the filter config flags for the application */ if (filter_config_flags != NULL) { diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Zdeflate.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Zdeflate.c index 00d12c183c..b7a372b645 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Zdeflate.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Zdeflate.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,11 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Robb Matzke - * Friday, August 27, 1999 - */ - #include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -59,9 +53,6 @@ const H5Z_class2_t H5Z_DEFLATE[1] = {{ * Return: Success: Size of buffer filtered * Failure: 0 * - * Programmer: Robb Matzke - * Thursday, April 16, 1998 - * *------------------------------------------------------------------------- */ static size_t @@ -75,13 +66,13 @@ H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] FUNC_ENTER_PACKAGE /* Sanity check */ - HDassert(*buf_size > 0); - HDassert(buf); - HDassert(*buf); + assert(*buf_size > 0); + assert(buf); + assert(*buf); /* Check arguments */ if (cd_nelmts != 1 || cd_values[0] > 9) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid deflate aggression level"); if (flags & H5Z_FLAG_REVERSE) { /* Input; uncompress */ @@ -90,10 +81,10 @@ H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] /* Allocate space for the compressed buffer */ if (NULL == (outbuf = H5MM_malloc(nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for deflate uncompression") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for deflate uncompression"); /* Set the uncompression parameters */ - HDmemset(&z_strm, 0, sizeof(z_strm)); + memset(&z_strm, 0, sizeof(z_strm)); z_strm.next_in = (Bytef *)*buf; H5_CHECKED_ASSIGN(z_strm.avail_in, unsigned, nbytes, size_t); z_strm.next_out = (Bytef *)outbuf; @@ -101,7 +92,7 @@ H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] /* Initialize the uncompression routines */ if (Z_OK != inflateInit(&z_strm)) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflateInit() failed") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflateInit() failed"); /* Loop to uncompress the buffer */ do { @@ -115,7 +106,7 @@ H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] /* Check for error */ if (Z_OK != status) { (void)inflateEnd(&z_strm); - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflate() failed") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "inflate() failed"); } else { /* If we're not done and just ran out of buffer space, get more */ @@ -127,7 +118,7 @@ H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] if (NULL == (new_outbuf = H5MM_realloc(outbuf, nalloc))) { (void)inflateEnd(&z_strm); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, - "memory allocation failed for deflate uncompression") + "memory allocation failed for deflate uncompression"); } /* end if */ outbuf = new_outbuf; @@ -167,7 +158,7 @@ H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] /* Allocate output (compressed) buffer */ if (NULL == (outbuf = H5MM_malloc(z_dst_nbytes))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate deflate destination buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate deflate destination buffer"); z_dst = (Bytef *)outbuf; /* Perform compression from the source to the destination buffer */ @@ -175,11 +166,11 @@ H5Z__filter_deflate(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] /* Check for various zlib errors */ if (Z_BUF_ERROR == status) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow"); else if (Z_MEM_ERROR == status) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "deflate memory error"); else if (Z_OK != status) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "other deflate error") + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "other deflate error"); /* Successfully uncompressed the buffer */ else { /* Free the input buffer */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Zfletcher32.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Zfletcher32.c index 22d1dd73a8..e5b98be66d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Zfletcher32.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Zfletcher32.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -11,11 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* - * Programmer: Raymond Lu - * Jan 3, 2003 - */ - #include "H5Zmodule.h" /* This source code file is part of the H5Z module */ #include "H5private.h" /* Generic Functions */ @@ -50,9 +44,6 @@ const H5Z_class2_t H5Z_FLETCHER32[1] = {{ * Return: Success: Size of buffer filtered * Failure: 0 * - * Programmer: Raymond Lu - * Jan 3, 2003 - * *------------------------------------------------------------------------- */ static size_t @@ -69,7 +60,7 @@ H5Z__filter_fletcher32(unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, FUNC_ENTER_PACKAGE - HDassert(sizeof(uint32_t) >= 4); + assert(sizeof(uint32_t) >= 4); if (flags & H5Z_FLAG_REVERSE) { /* Read */ /* Do checksum if it's enabled for read; otherwise skip it @@ -109,7 +100,7 @@ H5Z__filter_fletcher32(unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, /* Verify computed checksum matches stored checksum */ if (stored_fletcher != fletcher && stored_fletcher != reversed_fletcher) - HGOTO_ERROR(H5E_STORAGE, H5E_READERROR, 0, "data error detected by Fletcher32 checksum") + HGOTO_ERROR(H5E_STORAGE, H5E_READERROR, 0, "data error detected by Fletcher32 checksum"); } /* Set return values */ @@ -124,7 +115,7 @@ H5Z__filter_fletcher32(unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, if (NULL == (outbuf = H5MM_malloc(nbytes + FLETCHER_LEN))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, - "unable to allocate Fletcher32 checksum destination buffer") + "unable to allocate Fletcher32 checksum destination buffer"); dst = (unsigned char *)outbuf; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Znbit.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Znbit.c index 43dd0c13a5..80878f6790 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Znbit.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Znbit.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -116,9 +115,6 @@ H5Z_class2_t H5Z_NBIT[1] = {{ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Tuesday, December 21, 2004 - * *------------------------------------------------------------------------- */ static htri_t @@ -131,15 +127,15 @@ H5Z__can_apply_nbit(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_U /* Get datatype */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Get datatype's class, for checking the "datatype class" */ if (H5T_get_class(type, TRUE) == H5T_NO_CLASS) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class"); /* Get datatype's size, for checking the "datatype size" */ if (H5T_get_size(type) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -152,9 +148,6 @@ H5Z__can_apply_nbit(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_U * of datatype that is not integer, nor floating-point, nor * compound, and nor array. * - * Programmer: Xiaowen Wu - * Thursday, March 3, 2005 - * *------------------------------------------------------------------------- */ static void @@ -174,9 +167,6 @@ H5Z__calc_parms_nooptype(size_t *cd_values_actual_nparms) * of atomic datatype whose datatype class is integer * or floating point * - * Programmer: Xiaowen Wu - * Saturday, January 29, 2005 - * *------------------------------------------------------------------------- */ static void @@ -208,9 +198,6 @@ H5Z__calc_parms_atomic(size_t *cd_values_actual_nparms) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Wednesday, January 19, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -230,11 +217,11 @@ H5Z__calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms) /* Get array datatype's base datatype */ if (NULL == (dtype_base = H5T_get_super(type))) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype"); /* Get base datatype's class */ if ((dtype_base_class = H5T_get_class(dtype_base, TRUE)) == H5T_NO_CLASS) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype class") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype class"); /* Calculate number of the rest parameters according to base datatype's class */ switch (dtype_base_class) { @@ -245,12 +232,12 @@ H5Z__calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms) case H5T_ARRAY: if (H5Z__calc_parms_array(dtype_base, cd_values_actual_nparms) == FAIL) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype"); break; case H5T_COMPOUND: if (H5Z__calc_parms_compound(dtype_base, cd_values_actual_nparms) == FAIL) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype"); break; case H5T_TIME: @@ -268,14 +255,14 @@ H5Z__calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms) case H5T_NCLASSES: default: /* Badness */ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype"); break; } /* end switch */ done: if (dtype_base) if (H5T_close_real(dtype_base) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close base datatype") + HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close base datatype"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__calc_parms_array() */ @@ -290,9 +277,6 @@ H5Z__calc_parms_array(const H5T_t *type, size_t *cd_values_actual_nparms) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Wednesday, January 19, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -313,7 +297,7 @@ H5Z__calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms) /* Get number of members */ if ((nmembers = H5T_get_nmembers(type)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype number of members") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype number of members"); /* Store number of members */ *cd_values_actual_nparms += 1; @@ -324,11 +308,11 @@ H5Z__calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms) /* Get member datatype */ if (NULL == (dtype_member = H5T_get_member_type(type, u))) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype"); /* Get member datatype's class */ if ((dtype_member_class = H5T_get_class(dtype_member, TRUE)) == H5T_NO_CLASS) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype class") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype class"); /* Store member offset */ *cd_values_actual_nparms += 1; @@ -342,12 +326,12 @@ H5Z__calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms) case H5T_ARRAY: if (H5Z__calc_parms_array(dtype_member, cd_values_actual_nparms) == FAIL) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype"); break; case H5T_COMPOUND: if (H5Z__calc_parms_compound(dtype_member, cd_values_actual_nparms) == FAIL) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype"); break; case H5T_TIME: @@ -365,20 +349,20 @@ H5Z__calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms) case H5T_NCLASSES: default: /* Badness */ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype"); break; } /* end switch */ /* Close member datatype */ if (H5T_close_real(dtype_member) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype") + HGOTO_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype"); dtype_member = NULL; } /* end for */ done: if (dtype_member) if (H5T_close_real(dtype_member) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype") + HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_calc_params_compound */ @@ -394,9 +378,6 @@ H5Z__calc_parms_compound(const H5T_t *type, size_t *cd_values_actual_nparms) * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Tuesday, April 5, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -412,7 +393,7 @@ H5Z__set_parms_nooptype(const H5T_t *type, unsigned *cd_values_index, unsigned c /* Get datatype's size */ if ((dtype_size = H5T_get_size(type)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); /* Set "local" parameter for datatype size */ H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); @@ -431,9 +412,6 @@ H5Z__set_parms_nooptype(const H5T_t *type, unsigned *cd_values_index, unsigned c * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Tuesday, January 11, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -454,7 +432,7 @@ H5Z__set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, unsigned cd_ /* Get datatype's size */ if ((dtype_size = H5T_get_size(type)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); /* Set "local" parameter for datatype size */ H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); @@ -462,7 +440,7 @@ H5Z__set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, unsigned cd_ /* Get datatype's endianness order */ if ((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order"); /* Set "local" parameter for datatype endianness */ switch (dtype_order) { @@ -479,21 +457,21 @@ H5Z__set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, unsigned cd_ case H5T_ORDER_ERROR: case H5T_ORDER_NONE: default: - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order"); } /* end switch */ /* Get datatype's precision */ if ((dtype_precision = H5T_get_precision(type)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype precision") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype precision"); /* Get datatype's offset */ if ((sdtype_offset = H5T_get_offset(type)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype offset") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype offset"); dtype_offset = (unsigned)sdtype_offset; /* Check values of precision and offset */ if (dtype_precision > dtype_size * 8 || (dtype_precision + dtype_offset) > dtype_size * 8) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset"); /* Set "local" parameter for datatype precision */ H5_CHECK_OVERFLOW(dtype_precision, size_t, unsigned); @@ -522,9 +500,6 @@ H5Z__set_parms_atomic(const H5T_t *type, unsigned *cd_values_index, unsigned cd_ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Tuesday, April 5, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -544,7 +519,7 @@ H5Z__set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_v /* Get array datatype's size */ if ((dtype_size = H5T_get_size(type)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); /* Set "local" parameter for array datatype's size */ H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); @@ -552,42 +527,42 @@ H5Z__set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_v /* Get array datatype's base datatype */ if (NULL == (dtype_base = H5T_get_super(type))) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype"); /* Get base datatype's class */ if ((dtype_base_class = H5T_get_class(dtype_base, TRUE)) == H5T_NO_CLASS) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype class") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad base datatype class"); /* Call appropriate function according to base datatype's class */ switch (dtype_base_class) { case H5T_INTEGER: case H5T_FLOAT: if (H5Z__set_parms_atomic(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_ARRAY: if (H5Z__set_parms_array(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_COMPOUND: if (H5Z__set_parms_compound(dtype_base, cd_values_index, cd_values, need_not_compress) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_VLEN: /* Check if base datatype is a variable-length string */ if ((is_vlstring = H5T_is_variable_str(dtype_base)) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, - "cannot determine if datatype is a variable-length string") + "cannot determine if datatype is a variable-length string"); /* base datatype of VL or VL-string is not supported */ if (dtype_base_class == H5T_VLEN || is_vlstring) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype not supported by nbit") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype not supported by nbit"); if (H5Z__set_parms_nooptype(dtype_base, cd_values_index, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_TIME: @@ -597,21 +572,21 @@ H5Z__set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_v case H5T_REFERENCE: case H5T_ENUM: if (H5Z__set_parms_nooptype(dtype_base, cd_values_index, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_NO_CLASS: case H5T_NCLASSES: default: /* Badness */ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype"); break; } /* end switch */ done: if (dtype_base) if (H5T_close_real(dtype_base) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close base datatype") + HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close base datatype"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z__set_parms_array() */ @@ -625,9 +600,6 @@ H5Z__set_parms_array(const H5T_t *type, unsigned *cd_values_index, unsigned cd_v * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Tuesday, April 5, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -652,7 +624,7 @@ H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned c /* Get datatype's size */ if ((dtype_size = H5T_get_size(type)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); /* Set "local" parameter for compound datatype size */ H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); @@ -660,7 +632,7 @@ H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned c /* Get number of members */ if ((snmembers = H5T_get_nmembers(type)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype number of members") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype number of members"); nmembers = (unsigned)snmembers; /* Set "local" parameter for number of members */ @@ -670,11 +642,11 @@ H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned c for (u = 0; u < nmembers; u++) { /* Get member datatype */ if (NULL == (dtype_member = H5T_get_member_type(type, u))) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype"); /* Get member datatype's class */ if ((dtype_member_class = H5T_get_class(dtype_member, TRUE)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype class") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad member datatype class"); /* Get member offset, success if H5T_get_class() success */ dtype_member_offset = H5T_get_member_offset(type, u); @@ -688,24 +660,24 @@ H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned c case H5T_INTEGER: case H5T_FLOAT: if (H5Z__set_parms_atomic(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_ARRAY: if (H5Z__set_parms_array(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_COMPOUND: if (H5Z__set_parms_compound(dtype_member, cd_values_index, cd_values, need_not_compress) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_VLEN: /* Check if datatype is a variable-length string */ if ((is_vlstring = H5T_is_variable_str(dtype_member)) < 0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, - "cannot determine if datatype is a variable-length string") + "cannot determine if datatype is a variable-length string"); /* Because for some no-op datatype (VL datatype and VL string datatype), its * size can not be retrieved correctly by using function call H5T_get_size, @@ -738,27 +710,27 @@ H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned c case H5T_ENUM: /* other datatype that nbit does no compression */ if (H5Z__set_parms_nooptype(dtype_member, cd_values_index, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_NO_CLASS: case H5T_NCLASSES: default: /* Badness */ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit was passed bad datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit was passed bad datatype"); break; } /* end switch */ /* Close member datatype */ if (H5T_close_real(dtype_member) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype") + HGOTO_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype"); dtype_member = NULL; } /* end for */ done: if (dtype_member) if (H5T_close_real(dtype_member) < 0) - HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype") + HDONE_ERROR(H5E_PLINE, H5E_CLOSEERROR, FAIL, "Unable to close member datatype"); FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_set_params_compound */ @@ -771,9 +743,6 @@ H5Z__set_parms_compound(const H5T_t *type, unsigned *cd_values_index, unsigned c * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Tuesday, January 11, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -796,11 +765,11 @@ H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get datatype */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Get datatype's class */ if ((dtype_class = H5T_get_class(type, TRUE)) == H5T_NO_CLASS) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class"); /* Calculate how many parameters will fill the cd_values array * First three parameters reserved for: @@ -817,12 +786,12 @@ H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) case H5T_ARRAY: if (H5Z__calc_parms_array(type, &cd_values_actual_nparms) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype"); break; case H5T_COMPOUND: if (H5Z__calc_parms_compound(type, &cd_values_actual_nparms) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot compute parameters for datatype"); break; case H5T_TIME: @@ -839,35 +808,35 @@ H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) case H5T_NCLASSES: default: /* Badness */ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype"); break; } /* end switch */ /* Check if the number of parameters exceed what cd_values[] can store */ if (cd_values_actual_nparms > H5Z_NBIT_MAX_NPARMS) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype needs too many nbit parameters") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype needs too many nbit parameters"); /* Allocate memory space for cd_values[] */ if (NULL == (cd_values = (unsigned *)H5MM_malloc(cd_values_actual_nparms * sizeof(unsigned)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for cd_values[]") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for cd_values[]"); /* Get the plist structure */ if (NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get the filter's current parameters */ if (H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_NBIT, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get nbit parameters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get nbit parameters"); /* Get dataspace */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Get total number of elements in the chunk */ if ((npoints = H5S_GET_EXTENT_NPOINTS(ds)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get number of points in the dataspace") - HDassert(npoints); + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get number of points in the dataspace"); + assert(npoints); /* Initialize index for cd_values array starting from the third entry */ cd_values_index = 2; @@ -884,17 +853,17 @@ H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) case H5T_INTEGER: case H5T_FLOAT: if (H5Z__set_parms_atomic(type, &cd_values_index, cd_values, &need_not_compress) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_ARRAY: if (H5Z__set_parms_array(type, &cd_values_index, cd_values, &need_not_compress) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_COMPOUND: if (H5Z__set_parms_compound(type, &cd_values_index, cd_values, &need_not_compress) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit cannot set parameters for datatype"); break; case H5T_TIME: @@ -911,12 +880,12 @@ H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) case H5T_NCLASSES: default: /* Badness */ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "nbit received bad datatype"); break; } /* end switch */ /* Check if calculation of parameters matches with setting of parameters */ - HDassert(cd_values_actual_nparms == cd_values_index); + assert(cd_values_actual_nparms == cd_values_index); /* Finally set the first two entries of cd_values[] */ H5_CHECK_OVERFLOW(cd_values_actual_nparms, size_t, unsigned); @@ -925,7 +894,7 @@ H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Modify the filter's parameters for this dataset */ if (H5P_modify_filter(dcpl_plist, H5Z_FILTER_NBIT, flags, cd_values_actual_nparms, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local nbit parameters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local nbit parameters"); done: if (cd_values) @@ -942,9 +911,6 @@ H5Z__set_local_nbit(hid_t dcpl_id, hid_t type_id, hid_t space_id) * Return: Success: Size of buffer filtered * Failure: 0 * - * Programmer: Xiaowen Wu - * Friday, January 21, 2005 - * *------------------------------------------------------------------------- */ static size_t @@ -962,13 +928,13 @@ H5Z__filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], s * cd_values[0] stores actual number of parameters in cd_values[] */ if (cd_nelmts != cd_values[0]) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid nbit aggression level") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid nbit aggression level"); /* check if need to do nbit compress or decompress * cd_values[1] stores the flag if true indicating no need to compress */ if (cd_values[1]) - HGOTO_DONE(*buf_size) + HGOTO_DONE(*buf_size); /* copy a filter parameter to d_nelmts */ d_nelmts = cd_values[2]; @@ -979,21 +945,21 @@ H5Z__filter_nbit(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], s /* allocate memory space for decompressed buffer */ if (NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit decompression") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit decompression"); /* decompress the buffer */ if (H5Z__nbit_decompress(outbuf, d_nelmts, (unsigned char *)*buf, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, 0, "can't decompress buffer") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, 0, "can't decompress buffer"); } /* end if */ /* output; compress */ else { - HDassert(nbytes == d_nelmts * cd_values[4]); + assert(nbytes == d_nelmts * cd_values[4]); size_out = nbytes; /* allocate memory space for compressed buffer */ if (NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit compression") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for nbit compression"); /* compress the buffer, size_out will be changed */ H5Z__nbit_compress((unsigned char *)*buf, d_nelmts, outbuf, &size_out, cd_values); @@ -1129,7 +1095,7 @@ H5Z__nbit_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigne } else { /* big endian */ /* Sanity check */ - HDassert(p->order == H5Z_NBIT_ORDER_BE); + assert(p->order == H5Z_NBIT_ORDER_BE); /* calculate begin_i and end_i */ begin_i = ((unsigned)datatype_len - p->precision - p->offset) / 8; @@ -1166,7 +1132,7 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned /* Check values of precision and offset */ if (p.precision > p.size * 8 || (p.precision + p.offset) > p.size * 8) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset"); n = total_size / p.size; for (i = 0; i < n; i++) @@ -1181,7 +1147,7 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned for (i = 0; i < n; i++) { if (H5Z__nbit_decompress_one_array(data, data_offset + i * (size_t)base_size, buffer, j, buf_len, parms, parms_index) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array"); *parms_index = begin_index; } break; @@ -1193,7 +1159,7 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned for (i = 0; i < n; i++) { if (H5Z__nbit_decompress_one_compound(data, data_offset + i * (size_t)base_size, buffer, j, buf_len, parms, parms_index) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound"); *parms_index = begin_index; } break; @@ -1204,7 +1170,7 @@ H5Z__nbit_decompress_one_array(unsigned char *data, size_t data_offset, unsigned break; default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); } /* end switch */ done: @@ -1232,7 +1198,7 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsig member_size = parms[*parms_index]; used_size += member_size; if (used_size > size) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "compound member offset overflowed compound size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "compound member offset overflowed compound size"); switch (member_class) { case H5Z_NBIT_ATOMIC: p.size = member_size; @@ -1244,7 +1210,7 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsig /* Check values of precision and offset */ if (p.precision > p.size * 8 || (p.precision + p.offset) > p.size * 8) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset"); H5Z__nbit_decompress_one_atomic(data, data_offset + member_offset, buffer, j, buf_len, &p); break; @@ -1252,13 +1218,13 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsig case H5Z_NBIT_ARRAY: if (H5Z__nbit_decompress_one_array(data, data_offset + member_offset, buffer, j, buf_len, parms, parms_index) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array"); break; case H5Z_NBIT_COMPOUND: if (H5Z__nbit_decompress_one_compound(data, data_offset + member_offset, buffer, j, buf_len, parms, parms_index) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound"); break; case H5Z_NBIT_NOOPTYPE: @@ -1269,7 +1235,7 @@ H5Z__nbit_decompress_one_compound(unsigned char *data, size_t data_offset, unsig break; default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); } /* end switch */ } @@ -1292,7 +1258,7 @@ H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buff FUNC_ENTER_PACKAGE /* may not have to initialize to zeros */ - HDmemset(data, 0, d_nelmts * (size_t)parms[4]); + memset(data, 0, d_nelmts * (size_t)parms[4]); /* initialization before the loop */ j = 0; @@ -1307,7 +1273,7 @@ H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buff /* Check values of precision and offset */ if (p.precision > p.size * 8 || (p.precision + p.offset) > p.size * 8) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "invalid datatype precision/offset"); for (i = 0; i < d_nelmts; i++) H5Z__nbit_decompress_one_atomic(data, i * (size_t)p.size, buffer, &j, &buf_len, &p); @@ -1319,7 +1285,7 @@ H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buff for (i = 0; i < d_nelmts; i++) { if (H5Z__nbit_decompress_one_array(data, i * size, buffer, &j, &buf_len, parms, &parms_index) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress array"); parms_index = 4; } break; @@ -1330,13 +1296,13 @@ H5Z__nbit_decompress(unsigned char *data, unsigned d_nelmts, unsigned char *buff for (i = 0; i < d_nelmts; i++) { if (H5Z__nbit_decompress_one_compound(data, i * size, buffer, &j, &buf_len, parms, &parms_index) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound") + HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, FAIL, "can't decompress compound"); parms_index = 4; } break; default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); } /* end switch */ done: @@ -1436,7 +1402,7 @@ H5Z__nbit_compress_one_atomic(unsigned char *data, size_t data_offset, unsigned } else { /* big endian */ /* Sanity check */ - HDassert(p->order == H5Z_NBIT_ORDER_BE); + assert(p->order == H5Z_NBIT_ORDER_BE); /* calculate begin_i and end_i */ begin_i = ((unsigned)datatype_len - p->precision - p->offset) / 8; @@ -1500,7 +1466,7 @@ H5Z__nbit_compress_one_array(unsigned char *data, size_t data_offset, unsigned c break; default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); } /* end switch */ } @@ -1543,7 +1509,7 @@ H5Z__nbit_compress_one_compound(unsigned char *data, size_t data_offset, unsigne break; default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); } /* end switch */ } } @@ -1562,7 +1528,7 @@ H5Z__nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer unsigned parms_index; /* index in array parms used by compression/decompression functions */ /* must initialize buffer to be zeros */ - HDmemset(buffer, 0, *buffer_size); + memset(buffer, 0, *buffer_size); /* initialization before the loop */ buf_len = sizeof(unsigned char) * 8; @@ -1599,7 +1565,7 @@ H5Z__nbit_compress(unsigned char *data, unsigned d_nelmts, unsigned char *buffer break; default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); } /* end switch */ /* Update the size to the new value after compression. If there are any bits hanging over in diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Zscaleoffset.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Zscaleoffset.c index 61b3fe4295..123c767ff3 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Zscaleoffset.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Zscaleoffset.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -165,7 +164,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } while (_size_rem); \ } /* end if */ \ else { \ - HDassert(H5T_native_order_g == H5T_ORDER_BE); \ + assert(H5T_native_order_g == H5T_ORDER_BE); \ \ /* Copy 4 bytes at a time to each cd value, but start at the end \ * (highest address) of fill_val */ \ @@ -184,7 +183,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ _fv_p -= _size_rem; \ } /* end while */ \ \ - HDassert(_fv_p == (char *)&(fill_val)); \ + assert(_fv_p == (char *)&(fill_val)); \ if (_size_rem) { \ /* Amount left to copy is smaller than a cd_value, initialize \ * _cd_value as it will not be fully overwritten and copy to the end \ @@ -203,7 +202,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ /* Get dataset fill value */ \ if (H5P_get_fill_value(dcpl_plist, dt, &fill_val) < 0) \ - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \ + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value"); \ \ if (need_convert) \ H5Z__scaleoffset_convert(&fill_val, 1, sizeof(type)); \ @@ -218,7 +217,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ /* Get dataset fill value */ \ if (H5P_get_fill_value(dcpl_plist, dt, &fill_val) < 0) \ - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \ + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value"); \ \ if (need_convert) \ H5Z__scaleoffset_convert(&fill_val, 1, sizeof(type)); \ @@ -233,7 +232,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ /* Get dataset fill value */ \ if (H5P_get_fill_value(dcpl_plist, dt, &fill_val) < 0) \ - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \ + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value"); \ \ /* Store the fill value as the last entry in cd_values[] */ \ (cd_values)[H5Z_SCALEOFFSET_PARM_FILVAL] = (unsigned)((unsigned char)fill_val); \ @@ -246,7 +245,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ /* Get dataset fill value */ \ if (H5P_get_fill_value(dcpl_plist, dt, &fill_val) < 0) \ - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value") \ + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get fill value"); \ \ if (need_convert) \ H5Z__scaleoffset_convert(&fill_val, 1, sizeof(type)); \ @@ -256,7 +255,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Get the fill value for integer type */ #define H5Z_scaleoffset_get_filval_1(type, cd_values, fill_val) \ - { \ + do { \ unsigned _i = H5Z_SCALEOFFSET_PARM_FILVAL; /* index into cd_values */ \ uint32_t _cd_value; /* Current cd_value */ \ char *_fv_p; /* Pointer to current byte in fill_val */ \ @@ -292,7 +291,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } while (_size_rem); \ } /* end if */ \ else { \ - HDassert(H5T_native_order_g == H5T_ORDER_BE); \ + assert(H5T_native_order_g == H5T_ORDER_BE); \ \ /* Copy 4 bytes at a time to each cd value, but start at the end \ * (highest address) of fill_val */ \ @@ -311,7 +310,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ _fv_p -= _size_rem; \ } /* end while */ \ \ - HDassert(_fv_p == (char *)&(fill_val)); \ + assert(_fv_p == (char *)&(fill_val)); \ if (_size_rem) { \ /* Amount left to copy is smaller than a cd_value, initialize \ * _cd_value as it will not be fully overwritten and copy to the end \ @@ -320,15 +319,16 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ H5MM_memcpy(_fv_p, (char *)&_cd_value + 4 - _size_rem, _size_rem); \ } /* end if */ \ } /* end else */ \ - } + } while (0) /* Get the fill value for floating-point type */ #define H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ - { \ + do { \ if (sizeof(type) <= sizeof(long long)) \ - H5Z_scaleoffset_get_filval_1(type, cd_values, filval) else HGOTO_ERROR( \ - H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ - } + H5Z_scaleoffset_get_filval_1(type, cd_values, filval); \ + else \ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer datatype"); \ + } while (0) /* Find maximum and minimum values of a buffer with fill value defined for integer type */ #define H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ @@ -446,7 +446,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } \ } \ else \ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer datatype"); \ } /* Precompress for unsigned integer type */ @@ -456,32 +456,32 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ unsigned i; \ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_1(type, cd_values, \ - filval) if (*minbits == H5Z_SO_INT_MINBITS_DEFAULT) \ - { /* minbits not set yet, calculate max, min, and minbits */ \ + H5Z_scaleoffset_get_filval_1(type, cd_values, filval); \ + if (*minbits == \ + H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ \ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_1(type, max, min, minbits) span = (type)(max - min + 1); \ *minbits = H5Z__scaleoffset_log2((unsigned long long)(span + 1)); \ } \ else /* minbits already set, only calculate min */ \ - H5Z_scaleoffset_min_1( \ - i, d_nelmts, buf, filval, \ - min) if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ - for (i = 0; i < d_nelmts; i++) buf[i] = \ - (type)((buf[i] == filval) ? (((type)1 << *minbits) - 1) : (buf[i] - min)); \ + H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min); \ + if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ + for (i = 0; i < d_nelmts; i++) \ + buf[i] = (type)((buf[i] == filval) ? (((type)1 << *minbits) - 1) : (buf[i] - min)); \ } \ else { /* fill value undefined */ \ if (*minbits == \ H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ \ - H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ - H5Z_scaleoffset_check_1(type, max, min, minbits) span = (type)(max - min + 1); \ + H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min); \ + H5Z_scaleoffset_check_1(type, max, min, minbits); \ + span = (type)(max - min + 1); \ *minbits = H5Z__scaleoffset_log2((unsigned long long)span); \ } \ else /* minbits already set, only calculate min */ \ - H5Z_scaleoffset_min_2( \ - i, d_nelmts, buf, \ - min) if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ - for (i = 0; i < d_nelmts; i++) buf[i] = (type)(buf[i] - min); \ + H5Z_scaleoffset_min_2(i, d_nelmts, buf, min); \ + if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ + for (i = 0; i < d_nelmts; i++) \ + buf[i] = (type)(buf[i] - min); \ } \ *minval = min; \ } while (0) @@ -494,20 +494,19 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ unsigned i; \ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_1(type, cd_values, \ - filval) if (*minbits == H5Z_SO_INT_MINBITS_DEFAULT) \ - { /* minbits not set yet, calculate max, min, and minbits */ \ + H5Z_scaleoffset_get_filval_1(type, cd_values, filval); \ + if (*minbits == \ + H5Z_SO_INT_MINBITS_DEFAULT) { /* minbits not set yet, calculate max, min, and minbits */ \ H5Z_scaleoffset_max_min_1(i, d_nelmts, buf, filval, max, min) \ H5Z_scaleoffset_check_2(type, max, min, minbits) span = (unsigned type)(max - min + 1); \ *minbits = H5Z__scaleoffset_log2((unsigned long long)(span + 1)); \ } \ else /* minbits already set, only calculate min */ \ - H5Z_scaleoffset_min_1( \ - i, d_nelmts, buf, filval, \ - min) if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ - for (i = 0; i < d_nelmts; i++) buf[i] = \ - (type)((buf[i] == filval) ? (type)(((unsigned type)1 << *minbits) - 1) \ - : (buf[i] - min)); \ + H5Z_scaleoffset_min_1(i, d_nelmts, buf, filval, min); \ + if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ + for (i = 0; i < d_nelmts; i++) \ + buf[i] = (type)((buf[i] == filval) ? (type)(((unsigned type)1 << *minbits) - 1) \ + : (buf[i] - min)); \ } \ else { /* fill value undefined */ \ if (*minbits == \ @@ -554,7 +553,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ min * pow_fun((type)10, (type)D_val)); \ } \ else \ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer datatype"); \ } /* Modify values of data in precompression if fill value undefined for floating-point type */ @@ -573,7 +572,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \ min * pow_fun((type)10, (type)D_val)); \ else \ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer datatype"); \ } /* Save the minimum value for floating-point type */ @@ -587,11 +586,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if (H5T_native_order_g == H5T_ORDER_LE) \ H5MM_memcpy(minval, &min, sizeof(type)); \ else { \ - HDassert(H5T_native_order_g == H5T_ORDER_BE); \ + assert(H5T_native_order_g == H5T_ORDER_BE); \ H5MM_memcpy(((char *)minval) + (sizeof(long long) - sizeof(type)), &min, sizeof(type)); \ } /* end else */ \ else \ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer datatype"); \ } /* Precompress for floating-point type using variable-minimum-bits method */ @@ -604,29 +603,29 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ *minval = 0; \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ - H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \ - H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) span = \ - (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \ - min * pow_fun((type)10, (type)D_val)) + \ - 1); \ + H5Z_scaleoffset_get_filval_2(type, cd_values, filval); \ + H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val); \ + H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val); \ + span = (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \ + min * pow_fun((type)10, (type)D_val)) + \ + 1); \ *minbits = H5Z__scaleoffset_log2(span + 1); \ if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_1(i, type, pow_fun, abs_fun, lround_fun, llround_fun, buf, d_nelmts, \ - filval, minbits, min, D_val) \ + filval, minbits, min, D_val); \ } \ else { /* fill value undefined */ \ - H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \ - H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) span = \ - (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \ - min * pow_fun((type)10, (type)D_val)) + \ - 1); \ + H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min); \ + H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val); \ + span = (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \ + min * pow_fun((type)10, (type)D_val)) + \ + 1); \ *minbits = H5Z__scaleoffset_log2(span); \ if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \ H5Z_scaleoffset_modify_2(i, type, pow_fun, lround_fun, llround_fun, buf, d_nelmts, min, \ - D_val) \ + D_val); \ } \ - H5Z_scaleoffset_save_min(i, type, minval, min) \ + H5Z_scaleoffset_save_min(i, type, minval, min); \ } while (0) /* Postdecompress for unsigned integer type */ @@ -636,8 +635,9 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ unsigned i; \ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_1(type, cd_values, filval) for (i = 0; i < d_nelmts; i++) buf[i] = \ - (type)((buf[i] == (((type)1 << minbits) - 1)) ? filval : (buf[i] + minval)); \ + H5Z_scaleoffset_get_filval_1(type, cd_values, filval); \ + for (i = 0; i < d_nelmts; i++) \ + buf[i] = (type)((buf[i] == (((type)1 << minbits) - 1)) ? filval : (buf[i] + minval)); \ } \ else /* fill value undefined */ \ for (i = 0; i < d_nelmts; i++) \ @@ -651,9 +651,11 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ unsigned i; \ \ if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_1(type, cd_values, filval) for (i = 0; i < d_nelmts; i++) buf[i] = \ - (type)(((unsigned type)buf[i] == (((unsigned type)1 << minbits) - 1)) ? filval \ - : (buf[i] + minval)); \ + H5Z_scaleoffset_get_filval_1(type, cd_values, filval); \ + for (i = 0; i < d_nelmts; i++) \ + buf[i] = (type)(((unsigned type)buf[i] == (((unsigned type)1 << minbits) - 1)) \ + ? filval \ + : (buf[i] + minval)); \ } \ else /* fill value undefined */ \ for (i = 0; i < d_nelmts; i++) \ @@ -662,7 +664,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ /* Retrieve minimum value of floating-point type */ #define H5Z_scaleoffset_get_min(type, minval, min) \ - { \ + do { \ if (sizeof(type) <= sizeof(long long)) \ /* retrieve min value from corresponding position \ * byte-order has already been swapped as appropriate, but be sure to \ @@ -671,16 +673,16 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ if (H5T_native_order_g == H5T_ORDER_LE) \ H5MM_memcpy(&min, &minval, sizeof(type)); \ else { \ - HDassert(H5T_native_order_g == H5T_ORDER_BE); \ + assert(H5T_native_order_g == H5T_ORDER_BE); \ H5MM_memcpy(&min, ((char *)&minval) + (sizeof(long long) - sizeof(type)), sizeof(type)); \ } /* end else */ \ else \ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ - } + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer datatype"); \ + } while (0) /* Modify values of data in postdecompression if fill value defined for floating-point type */ #define H5Z_scaleoffset_modify_3(i, type, pow_fun, buf, d_nelmts, filval, minbits, min, D_val) \ - { \ + do { \ if (sizeof(type) == sizeof(int)) \ for (i = 0; i < d_nelmts; i++) \ buf[i] = \ @@ -702,12 +704,12 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ : (type)(*(long long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + \ min); \ else \ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ - } + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer datatype"); \ + } while (0) /* Modify values of data in postdecompression if fill value undefined for floating-point type */ #define H5Z_scaleoffset_modify_4(i, type, pow_fun, buf, d_nelmts, min, D_val) \ - { \ + do { \ if (sizeof(type) == sizeof(int)) \ for (i = 0; i < d_nelmts; i++) \ buf[i] = ((type)(*(int *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \ @@ -718,8 +720,8 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ for (i = 0; i < d_nelmts; i++) \ buf[i] = ((type)(*(long long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \ else \ - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \ - } + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer datatype"); \ + } while (0) /* Postdecompress for floating-point type using variable-minimum-bits method */ #define H5Z_scaleoffset_postdecompress_3(type, pow_fun, data, d_nelmts, filavail, cd_values, minbits, \ @@ -728,15 +730,14 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ type *buf = (type *)data, filval = 0, min = 0; \ unsigned i; \ \ - H5Z_scaleoffset_get_min(type, minval, min) \ + H5Z_scaleoffset_get_min(type, minval, min); \ \ - if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) \ - { /* fill value defined */ \ - H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \ - H5Z_scaleoffset_modify_3(i, type, pow_fun, buf, d_nelmts, filval, minbits, min, D_val) \ + if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ \ + H5Z_scaleoffset_get_filval_2(type, cd_values, filval); \ + H5Z_scaleoffset_modify_3(i, type, pow_fun, buf, d_nelmts, filval, minbits, min, D_val); \ } \ else /* fill value undefined */ \ - H5Z_scaleoffset_modify_4(i, type, pow_fun, buf, d_nelmts, min, D_val) \ + H5Z_scaleoffset_modify_4(i, type, pow_fun, buf, d_nelmts, min, D_val); \ } while (0) /*------------------------------------------------------------------------- @@ -748,9 +749,6 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Friday, February 4, 2005 - * *------------------------------------------------------------------------- */ static htri_t @@ -765,27 +763,27 @@ H5Z__can_apply_scaleoffset(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5 /* Get datatype */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Get datatype's class, for checking the "datatype class" */ if ((dtype_class = H5T_get_class(type, TRUE)) == H5T_NO_CLASS) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class"); /* Get datatype's size, for checking the "datatype size" */ if (H5T_get_size(type) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); if (dtype_class == H5T_INTEGER || dtype_class == H5T_FLOAT) { /* Get datatype's endianness order */ if ((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order"); /* Range check datatype's endianness order */ if (dtype_order != H5T_ORDER_LE && dtype_order != H5T_ORDER_BE) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FALSE, "bad datatype endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FALSE, "bad datatype endianness order"); } else - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FALSE, "datatype class not supported by scaleoffset") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FALSE, "datatype class not supported by scaleoffset"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -800,9 +798,6 @@ H5Z__can_apply_scaleoffset(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5 * Return: Success: id number of integer type * Failure: 0 * - * Programmer: Xiaowen Wu - * Wednesday, April 13, 2005 - * *------------------------------------------------------------------------- */ static enum H5Z_scaleoffset_t @@ -828,7 +823,7 @@ H5Z__scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dt type = t_ulong_long; #endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ else - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory dataype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory datatype"); } if (dtype_sign == H5Z_SCALEOFFSET_SGN_2) { /* signed integer */ @@ -845,7 +840,7 @@ H5Z__scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dt type = t_long_long; #endif /* H5_SIZEOF_LONG != H5_SIZEOF_LONG_LONG */ else - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory dataype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory datatype"); } } @@ -855,7 +850,7 @@ H5Z__scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dt else if (dtype_size == sizeof(double)) type = t_double; else - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory dataype") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, t_bad, "cannot find matched memory datatype"); } /* Set return value */ @@ -873,9 +868,6 @@ H5Z__scaleoffset_get_type(unsigned dtype_class, unsigned dtype_size, unsigned dt * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Monday, March 7, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -924,9 +916,6 @@ H5Z__scaleoffset_set_parms_fillval(H5P_genplist_t *dcpl_plist, H5T_t *type, enum * Return: Success: Non-negative * Failure: Negative * - * Programmer: Xiaowen Wu - * Friday, February 4, 2005 - * *------------------------------------------------------------------------- */ static herr_t @@ -951,34 +940,34 @@ H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get the plist structure */ if (NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get datatype */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Initialize the parameters to a known state */ - HDmemset(cd_values, 0, sizeof(cd_values)); + memset(cd_values, 0, sizeof(cd_values)); /* Get the filter's current parameters */ if (H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get scaleoffset parameters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get scaleoffset parameters"); /* Get dataspace */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Get total number of elements in the chunk */ if ((npoints = H5S_GET_EXTENT_NPOINTS(ds)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get number of points in the dataspace") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get number of points in the dataspace"); /* Set "local" parameter for this dataset's number of elements */ H5_CHECKED_ASSIGN(cd_values[H5Z_SCALEOFFSET_PARM_NELMTS], unsigned, npoints, hssize_t); /* Get datatype's class */ if ((dtype_class = H5T_get_class(type, TRUE)) == H5T_NO_CLASS) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype class"); /* Set "local" parameter for datatype's class */ switch (dtype_class) { @@ -1002,12 +991,12 @@ H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) case H5T_ARRAY: case H5T_NCLASSES: default: - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype class not supported by scaleoffset") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "datatype class not supported by scaleoffset"); } /* end switch */ /* Get datatype's size */ if ((dtype_size = H5T_get_size(type)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); /* Set "local" parameter for datatype size */ H5_CHECK_OVERFLOW(dtype_size, size_t, unsigned); @@ -1016,7 +1005,7 @@ H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) if (dtype_class == H5T_INTEGER) { /* Get datatype's sign */ if ((dtype_sign = H5T_get_sign(type)) == H5T_SGN_ERROR) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype sign") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype sign"); /* Set "local" parameter for integer datatype sign */ switch (dtype_sign) { @@ -1031,13 +1020,13 @@ H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) case H5T_SGN_ERROR: case H5T_NSGN: default: - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad integer sign") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad integer sign"); } /* end switch */ } /* end if */ /* Get datatype's endianness order */ if ((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order"); /* Set "local" parameter for datatype endianness */ switch (dtype_order) { @@ -1054,12 +1043,12 @@ H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) case H5T_ORDER_MIXED: case H5T_ORDER_NONE: default: - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order"); } /* end switch */ /* Check whether fill value is defined for dataset */ if (H5P_fill_value_defined(dcpl_plist, &status) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to determine if fill value is defined") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to determine if fill value is defined"); /* Set local parameter for availability of fill value */ if (status == H5D_FILL_VALUE_UNDEFINED) @@ -1077,17 +1066,17 @@ H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) if ((scale_type = H5Z__scaleoffset_get_type(cd_values[H5Z_SCALEOFFSET_PARM_CLASS], cd_values[H5Z_SCALEOFFSET_PARM_SIZE], cd_values[H5Z_SCALEOFFSET_PARM_SIGN])) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot use C integer datatype for cast") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot use C integer datatype for cast"); /* Get dataset fill value and store in cd_values[] */ if (H5Z__scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "unable to set fill value") + HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "unable to set fill value"); } /* end else */ /* Modify the filter's parameters for this dataset */ if (H5P_modify_filter(dcpl_plist, H5Z_FILTER_SCALEOFFSET, flags, (size_t)H5Z_SCALEOFFSET_TOTAL_NPARMS, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local scaleoffset parameters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local scaleoffset parameters"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1102,9 +1091,6 @@ H5Z__set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) * Return: Success: Size of buffer filtered * Failure: 0 * - * Programmer: Xiaowen Wu - * Monday, February 7, 2005 - * *------------------------------------------------------------------------- */ static size_t @@ -1133,7 +1119,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu /* check arguments */ if (cd_nelmts != H5Z_SCALEOFFSET_TOTAL_NPARMS) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scaleoffset number of parameters") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scaleoffset number of parameters"); /* Check if memory byte order matches dataset datatype byte order */ switch (H5T_native_order_g) { @@ -1152,7 +1138,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu case H5T_ORDER_MIXED: case H5T_ORDER_NONE: default: - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "bad H5T_NATIVE_INT endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "bad H5T_NATIVE_INT endianness order"); } /* end switch */ /* copy filter parameters to local variables */ @@ -1173,12 +1159,12 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu */ if (dtype_class == H5Z_SCALEOFFSET_CLS_FLOAT) { /* floating-point type */ if (scale_type != H5Z_SO_FLOAT_DSCALE && scale_type != H5Z_SO_FLOAT_ESCALE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scale type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scale type"); } if (dtype_class == H5Z_SCALEOFFSET_CLS_INTEGER) { /* integer type */ if (scale_type != H5Z_SO_INT) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scale type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid scale type"); /* if scale_factor is less than 0 for integer, library will reset it to 0 * in this case, library will calculate the minimum-bits @@ -1189,14 +1175,14 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu /* fixed-minimum-bits method is not implemented and is forbidden */ if (scale_type == H5Z_SO_FLOAT_ESCALE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "E-scaling method not supported") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "E-scaling method not supported"); if (scale_type == H5Z_SO_FLOAT_DSCALE) { /* floating-point type, variable-minimum-bits */ D_val = (double)scale_factor; } else { /* integer type, or floating-point type with fixed-minimum-bits method */ if (scale_factor > (int)(cd_values[H5Z_SCALEOFFSET_PARM_SIZE] * 8)) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "minimum number of bits exceeds maximum") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "minimum number of bits exceeds maximum"); /* no need to process data */ if (scale_factor == (int)(cd_values[H5Z_SCALEOFFSET_PARM_SIZE] * 8)) { @@ -1239,7 +1225,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu minval |= minval_mask; } - HDassert(minbits <= p.size * 8); + assert(minbits <= p.size * 8); p.minbits = minbits; /* calculate size of output buffer after decompression */ @@ -1248,7 +1234,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu /* allocate memory space for decompressed buffer */ if (NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, - "memory allocation failed for scaleoffset decompression") + "memory allocation failed for scaleoffset decompression"); /* special case: minbits equal to full precision */ if (minbits == p.size * 8) { @@ -1278,7 +1264,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu /* before postprocess, get memory type */ if ((type = H5Z__scaleoffset_get_type(dtype_class, p.size, dtype_sign)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot use C integer datatype for cast") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot use C integer datatype for cast"); /* postprocess after decompression */ if (dtype_class == H5Z_SCALEOFFSET_CLS_INTEGER) @@ -1288,7 +1274,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu if (scale_type == 0) { /* variable-minimum-bits method */ if (H5Z__scaleoffset_postdecompress_fd(outbuf, d_nelmts, type, filavail, cd_values, minbits, minval, D_val) == FAIL) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "post-decompression failed") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "post-decompression failed"); } /* after postprocess, convert to dataset datatype endianness order if needed */ @@ -1297,7 +1283,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu } /* output; compress */ else { - HDassert(nbytes == d_nelmts * p.size); + assert(nbytes == d_nelmts * p.size); /* before preprocess, convert to memory endianness order if needed */ if (need_convert) @@ -1305,7 +1291,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu /* before preprocess, get memory type */ if ((type = H5Z__scaleoffset_get_type(dtype_class, p.size, dtype_sign)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot use C integer datatype for cast") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "cannot use C integer datatype for cast"); /* preprocess before compression */ if (dtype_class == H5Z_SCALEOFFSET_CLS_INTEGER) @@ -1315,10 +1301,10 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu if (scale_type == 0) { /* variable-minimum-bits method */ if (H5Z__scaleoffset_precompress_fd(*buf, d_nelmts, type, filavail, cd_values, &minbits, &minval, D_val) == FAIL) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "pre-compression failed") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, 0, "pre-compression failed"); } - HDassert(minbits <= p.size * 8); + assert(minbits <= p.size * 8); /* calculate buffer size after compression * minbits and minval are stored in the front of the compressed buffer @@ -1328,7 +1314,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu /* allocate memory space for compressed buffer */ if (NULL == (outbuf = (unsigned char *)H5MM_malloc(size_out))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for scaleoffset compression") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for scaleoffset compression"); /* store minbits and minval in the front of output compressed buffer * store byte by byte from least significant byte to most significant byte @@ -1348,7 +1334,7 @@ H5Z__filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_valu /* (Looks like an error in the original determination of how many * bytes would be needed for parameters. - QAK, 2010/08/19) */ - HDmemset(outbuf + 13, 0, (size_t)8); + memset(outbuf + 13, 0, (size_t)8); /* special case: minbits equal to full precision */ if (minbits == p.size * 8) { @@ -1539,9 +1525,10 @@ H5Z__scaleoffset_postdecompress_i(void *data, unsigned d_nelmts, enum H5Z_scaleo unsigned i; if (filavail == H5Z_SCALEOFFSET_FILL_DEFINED) { /* fill value defined */ - H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval) for (i = 0; i < d_nelmts; - i++) buf[i] = - (signed char)((buf[i] == (((unsigned char)1 << minbits) - 1)) ? filval : (buf[i] + sminval)); + H5Z_scaleoffset_get_filval_1(signed char, cd_values, filval); + for (i = 0; i < d_nelmts; i++) + buf[i] = (signed char)((buf[i] == (((unsigned char)1 << minbits) - 1)) ? filval + : (buf[i] + sminval)); } else /* fill value undefined */ for (i = 0; i < d_nelmts; i++) @@ -1653,7 +1640,7 @@ H5Z__scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, unsigned dtype_len; int k; - HDassert(p.minbits > 0); + assert(p.minbits > 0); dtype_len = p.size * 8; @@ -1665,7 +1652,7 @@ H5Z__scaleoffset_decompress_one_atomic(unsigned char *data, size_t data_offset, p, dtype_len); } else { /* big endian */ - HDassert(p.mem_order == H5Z_SCALEOFFSET_ORDER_BE); + assert(p.mem_order == H5Z_SCALEOFFSET_ORDER_BE); begin_i = (dtype_len - p.minbits) / 8; @@ -1737,7 +1724,7 @@ H5Z__scaleoffset_compress_one_atomic(unsigned char *data, size_t data_offset, un unsigned dtype_len; int k; - HDassert(p.minbits > 0); + assert(p.minbits > 0); dtype_len = p.size * 8; @@ -1749,7 +1736,7 @@ H5Z__scaleoffset_compress_one_atomic(unsigned char *data, size_t data_offset, un dtype_len); } else { /* big endian */ - HDassert(p.mem_order == H5Z_SCALEOFFSET_ORDER_BE); + assert(p.mem_order == H5Z_SCALEOFFSET_ORDER_BE); begin_i = (dtype_len - p.minbits) / 8; for (k = (int)begin_i; k <= (int)(p.size - 1); k++) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Zshuffle.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Zshuffle.c index 3db963888c..6db510dbff 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Zshuffle.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Zshuffle.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -50,9 +49,6 @@ const H5Z_class2_t H5Z_SHUFFLE[1] = {{ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, April 7, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -69,25 +65,25 @@ H5Z__set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_ /* Get the plist structure */ if (NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get datatype */ if (NULL == (type = (const H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Get the filter's current parameters */ if (H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SHUFFLE, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get shuffle parameters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get shuffle parameters"); /* Set "local" parameter for this dataset */ if ((cd_values[H5Z_SHUFFLE_PARM_SIZE] = (unsigned)H5T_get_size(type)) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); /* Modify the filter's parameters for this dataset */ if (H5P_modify_filter(dcpl_plist, H5Z_FILTER_SHUFFLE, flags, (size_t)H5Z_SHUFFLE_TOTAL_NPARMS, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local shuffle parameters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local shuffle parameters"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -106,9 +102,6 @@ H5Z__set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_ * Return: Success: Size of buffer filtered * Failure: 0 * - * Programmer: Kent Yang - * Wednesday, November 13, 2002 - * *------------------------------------------------------------------------- */ static size_t @@ -131,7 +124,7 @@ H5Z__filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] /* Check arguments */ if (cd_nelmts != H5Z_SHUFFLE_TOTAL_NPARMS || cd_values[H5Z_SHUFFLE_PARM_SIZE] == 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid shuffle parameters") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid shuffle parameters"); /* Get the number of bytes per element from the parameter block */ bytesoftype = cd_values[H5Z_SHUFFLE_PARM_SIZE]; @@ -146,7 +139,7 @@ H5Z__filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] /* Allocate the destination buffer */ if (NULL == (dest = H5MM_malloc(nbytes))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for shuffle buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for shuffle buffer"); if (flags & H5Z_FLAG_REVERSE) { /* Get the pointer to the source buffer */ @@ -172,7 +165,7 @@ H5Z__filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] duffs_index = (numofelements + 7) / 8; switch (numofelements % 8) { default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); break; case 0: do { @@ -243,7 +236,7 @@ H5Z__filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[] duffs_index = (numofelements + 7) / 8; switch (numofelements % 8) { default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); break; case 0: do { diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Zszip.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Zszip.c index 56b816e428..d636afd158 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Zszip.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Zszip.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -64,16 +63,13 @@ H5Z_class2_t H5Z_SZIP[1] = {{ * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, April 7, 2003 - * *------------------------------------------------------------------------- */ static htri_t H5Z__can_apply_szip(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSED space_id) { const H5T_t *type; /* Datatype */ - unsigned dtype_size; /* Datatype's size (in bits) */ + size_t dtype_size; /* Datatype's size (in bits) */ H5T_order_t dtype_order; /* Datatype's endianness order */ htri_t ret_value = TRUE; /* Return value */ @@ -81,24 +77,24 @@ H5Z__can_apply_szip(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_U /* Get datatype */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Get datatype's size, for checking the "bits-per-pixel" */ if ((dtype_size = (8 * H5T_get_size(type))) == 0) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); /* Range check datatype's size */ if (dtype_size > 32 && dtype_size != 64) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype size") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype size"); /* Get datatype's endianness order */ if ((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "can't retrieve datatype endianness order"); /* Range check datatype's endianness order */ /* (Note: this may not handle non-atomic datatypes well) */ if (dtype_order != H5T_ORDER_LE && dtype_order != H5T_ORDER_BE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype endianness order") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FALSE, "invalid datatype endianness order"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -112,9 +108,6 @@ H5Z__can_apply_szip(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_U * Return: Success: Non-negative * Failure: Negative * - * Programmer: Quincey Koziol - * Monday, April 7, 2003 - * *------------------------------------------------------------------------- */ static herr_t @@ -131,7 +124,7 @@ H5Z__set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) H5T_order_t dtype_order; /* Datatype's endianness order */ size_t dtype_size; /* Datatype's size (in bits) */ size_t dtype_precision; /* Datatype's precision (in bits) */ - size_t dtype_offset; /* Datatype's offset (in bits) */ + int dtype_offset; /* Datatype's offset (in bits) */ hsize_t scanline; /* Size of dataspace's fastest changing dimension */ herr_t ret_value = SUCCEED; /* Return value */ @@ -139,15 +132,15 @@ H5Z__set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get the plist structure */ if (NULL == (dcpl_plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE))) - HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID") + HGOTO_ERROR(H5E_ID, H5E_BADID, FAIL, "can't find object for ID"); /* Get datatype */ if (NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); /* Get the filter's current parameters */ if (H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SZIP, &flags, &cd_nelmts, cd_values, 0, NULL, NULL) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get szip parameters"); /* Get datatype's size, for checking the "bits-per-pixel" */ if ((dtype_size = (8 * H5T_get_size(type))) == 0) @@ -161,28 +154,28 @@ H5Z__set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) dtype_offset = H5T_get_offset(type); if (dtype_offset != 0) dtype_precision = dtype_size; - } /* end if */ + } if (dtype_precision > 24) { if (dtype_precision <= 32) dtype_precision = 32; else if (dtype_precision <= 64) dtype_precision = 64; - } /* end if */ + } /* Set "local" parameter for this dataset's "bits-per-pixel" */ - cd_values[H5Z_SZIP_PARM_BPP] = dtype_precision; + cd_values[H5Z_SZIP_PARM_BPP] = (unsigned)dtype_precision; /* Get dataspace */ if (NULL == (ds = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace"); /* Get dimensions for dataspace */ if ((ndims = H5S_get_simple_extent_dims(ds, dims, NULL)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get dataspace dimensions") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get dataspace dimensions"); /* Set "local" parameter for this dataset's "pixels-per-scanline" */ /* (Use the chunk's fastest changing dimension size) */ - HDassert(ndims > 0); + assert(ndims > 0); scanline = dims[ndims - 1]; /* Adjust scanline if it is smaller than number of pixels per block or @@ -196,11 +189,11 @@ H5Z__set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get number of elements for the dataspace; use total number of elements in the chunk to define the new 'scanline' size */ if ((npoints = H5S_GET_EXTENT_NPOINTS(ds)) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get number of points in the dataspace") + HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "unable to get number of points in the dataspace"); if (npoints < cd_values[H5Z_SZIP_PARM_PPB]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, - "pixels per block greater than total number of elements in the chunk") - scanline = MIN((cd_values[H5Z_SZIP_PARM_PPB] * SZ_MAX_BLOCKS_PER_SCANLINE), npoints); + "pixels per block greater than total number of elements in the chunk"); + scanline = (hsize_t)MIN((cd_values[H5Z_SZIP_PARM_PPB] * SZ_MAX_BLOCKS_PER_SCANLINE), npoints); } else { if (scanline <= SZ_MAX_PIXELS_PER_SCANLINE) @@ -214,11 +207,11 @@ H5Z__set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) /* Get datatype's endianness order */ if ((dtype_order = H5T_get_order(type)) == H5T_ORDER_ERROR) - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order"); /* Set the correct endianness flag for szip */ /* (Note: this may not handle non-atomic datatypes well) */ - cd_values[H5Z_SZIP_PARM_MASK] &= ~(SZ_LSB_OPTION_MASK | SZ_MSB_OPTION_MASK); + cd_values[H5Z_SZIP_PARM_MASK] &= ~((unsigned)SZ_LSB_OPTION_MASK | (unsigned)SZ_MSB_OPTION_MASK); switch (dtype_order) { case H5T_ORDER_LE: /* Little-endian byte order */ cd_values[H5Z_SZIP_PARM_MASK] |= SZ_LSB_OPTION_MASK; @@ -233,12 +226,12 @@ H5Z__set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) case H5T_ORDER_MIXED: case H5T_ORDER_NONE: default: - HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order") + HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype endianness order"); } /* end switch */ /* Modify the filter's parameters for this dataset */ if (H5P_modify_filter(dcpl_plist, H5Z_FILTER_SZIP, flags, H5Z_SZIP_TOTAL_NPARMS, cd_values) < 0) - HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local szip parameters") + HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "can't set local szip parameters"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -253,9 +246,6 @@ H5Z__set_local_szip(hid_t dcpl_id, hid_t type_id, hid_t space_id) * Return: Success: Size of buffer filtered * Failure: 0 * - * Programmer: Kent Yang - * Tuesday, April 1, 2003 - * *------------------------------------------------------------------------- */ static size_t @@ -272,17 +262,17 @@ H5Z__filter_szip(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], s /* Sanity check to make certain that we haven't drifted out of date with * the mask options from the szlib.h header */ - HDassert(H5_SZIP_ALLOW_K13_OPTION_MASK == SZ_ALLOW_K13_OPTION_MASK); - HDassert(H5_SZIP_CHIP_OPTION_MASK == SZ_CHIP_OPTION_MASK); - HDassert(H5_SZIP_EC_OPTION_MASK == SZ_EC_OPTION_MASK); - HDassert(H5_SZIP_LSB_OPTION_MASK == SZ_LSB_OPTION_MASK); - HDassert(H5_SZIP_MSB_OPTION_MASK == SZ_MSB_OPTION_MASK); - HDassert(H5_SZIP_NN_OPTION_MASK == SZ_NN_OPTION_MASK); - HDassert(H5_SZIP_RAW_OPTION_MASK == SZ_RAW_OPTION_MASK); + assert(H5_SZIP_ALLOW_K13_OPTION_MASK == SZ_ALLOW_K13_OPTION_MASK); + assert(H5_SZIP_CHIP_OPTION_MASK == SZ_CHIP_OPTION_MASK); + assert(H5_SZIP_EC_OPTION_MASK == SZ_EC_OPTION_MASK); + assert(H5_SZIP_LSB_OPTION_MASK == SZ_LSB_OPTION_MASK); + assert(H5_SZIP_MSB_OPTION_MASK == SZ_MSB_OPTION_MASK); + assert(H5_SZIP_NN_OPTION_MASK == SZ_NN_OPTION_MASK); + assert(H5_SZIP_RAW_OPTION_MASK == SZ_RAW_OPTION_MASK); /* Check arguments */ if (cd_nelmts != 4) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid number of filter parameters") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid number of filter parameters"); /* Copy the filter parameters into the szip parameter block */ H5_CHECKED_ASSIGN(sz_param.options_mask, int, cd_values[H5Z_SZIP_PARM_MASK], unsigned); @@ -302,13 +292,13 @@ H5Z__filter_szip(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], s /* Allocate space for the uncompressed buffer */ if (NULL == (outbuf = (unsigned char *)H5MM_malloc(nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for szip decompression") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "memory allocation failed for szip decompression"); /* Decompress the buffer */ size_out = nalloc; if (SZ_BufftoBuffDecompress(outbuf, &size_out, newbuf, nbytes - 4, &sz_param) != SZ_OK) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "szip_filter: decompression failed") - HDassert(size_out == nalloc); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "szip_filter: decompression failed"); + assert(size_out == nalloc); /* Free the input buffer */ H5MM_xfree(*buf); @@ -325,7 +315,7 @@ H5Z__filter_szip(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], s /* Allocate space for the compressed buffer & header (assume data won't get bigger) */ if (NULL == (dst = outbuf = (unsigned char *)H5MM_malloc(nbytes + 4))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate szip destination buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, 0, "unable to allocate szip destination buffer"); /* Encode the uncompressed length */ H5_CHECK_OVERFLOW(nbytes, size_t, uint32_t); @@ -334,8 +324,8 @@ H5Z__filter_szip(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], s /* Compress the buffer */ size_out = nbytes; if (SZ_OK != SZ_BufftoBuffCompress(dst, &size_out, *buf, nbytes, &sz_param)) - HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow") - HDassert(size_out <= nbytes); + HGOTO_ERROR(H5E_PLINE, H5E_CANTINIT, 0, "overflow"); + assert(size_out <= nbytes); /* Free the input buffer */ H5MM_xfree(*buf); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5Ztrans.c b/externals/coda-oss/modules/drivers/hdf5/source/H5Ztrans.c index 6d428a310d..8839897736 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5Ztrans.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5Ztrans.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -147,7 +146,7 @@ static void H5Z__xform_reduce_tree(H5Z_node *tree); } \ } \ else \ - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unexpected type conversion operation") \ + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unexpected type conversion operation"); \ } #if CHAR_MIN >= 0 @@ -240,7 +239,7 @@ static void H5Z__xform_reduce_tree(H5Z_node *tree); #define H5Z_XFORM_DO_OP4(TYPE) \ { \ if ((ret_value = (H5Z_node *)H5MM_malloc(sizeof(H5Z_node))) == NULL) \ - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree") \ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree"); \ else { \ ret_value->type = (TYPE); \ if (tree->lchild) \ @@ -305,11 +304,6 @@ static void H5Z__xform_reduce_tree(H5Z_node *tree); } \ } -/* - * Programmer: Bill Wendling - * 25. August 2003 - */ - /* * This is the context-free grammar for our expressions: * @@ -335,9 +329,6 @@ static void H5Z__xform_reduce_tree(H5Z_node *tree); * * Return: Always succeeds. * - * Programmer: Bill Wendling - * 26. August 2003 - * *------------------------------------------------------------------------- */ static void @@ -346,7 +337,7 @@ H5Z__unget_token(H5Z_token *current) FUNC_ENTER_PACKAGE_NOERR /* check args */ - HDassert(current); + assert(current); current->tok_type = current->tok_last_type; current->tok_begin = current->tok_last_begin; @@ -368,9 +359,6 @@ H5Z__unget_token(H5Z_token *current) * Failure: The passed in H5Z_token but with the tok_type * field set to ERROR. * - * Programmer: Bill Wendling - * 26. August 2003 - * *------------------------------------------------------------------------- */ static H5Z_token * @@ -381,7 +369,7 @@ H5Z__get_token(H5Z_token *current) FUNC_ENTER_PACKAGE /* check args */ - HDassert(current); + assert(current); /* Save the last position for possible ungets */ current->tok_last_type = current->tok_type; @@ -391,10 +379,10 @@ H5Z__get_token(H5Z_token *current) current->tok_begin = current->tok_end; while (current->tok_begin[0] != '\0') { - if (HDisspace(current->tok_begin[0])) { + if (isspace(current->tok_begin[0])) { /* ignore whitespace */ } - else if (HDisdigit(current->tok_begin[0]) || current->tok_begin[0] == '.') { + else if (isdigit(current->tok_begin[0]) || current->tok_begin[0] == '.') { current->tok_end = current->tok_begin; /* @@ -406,7 +394,7 @@ H5Z__get_token(H5Z_token *current) /* is number */ current->tok_type = H5Z_XFORM_INTEGER; - while (HDisdigit(current->tok_end[0])) + while (isdigit(current->tok_end[0])) ++current->tok_end; } @@ -423,7 +411,7 @@ H5Z__get_token(H5Z_token *current) if (current->tok_end[0] == '.') do { ++current->tok_end; - } while (HDisdigit(current->tok_end[0])); + } while (isdigit(current->tok_end[0])); if (current->tok_end[0] == 'e' || current->tok_end[0] == 'E') { ++current->tok_end; @@ -431,31 +419,31 @@ H5Z__get_token(H5Z_token *current) if (current->tok_end[0] == '-' || current->tok_end[0] == '+') ++current->tok_end; - if (!HDisdigit(current->tok_end[0])) { + if (!isdigit(current->tok_end[0])) { current->tok_type = H5Z_XFORM_ERROR; HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, current, - "Invalidly formatted floating point number") + "Invalidly formatted floating point number"); } - while (HDisdigit(current->tok_end[0])) + while (isdigit(current->tok_end[0])) ++current->tok_end; } /* Check that this is a properly formatted numerical value */ - if (HDisalpha(current->tok_end[0]) || current->tok_end[0] == '.') { + if (isalpha(current->tok_end[0]) || current->tok_end[0] == '.') { current->tok_type = H5Z_XFORM_ERROR; - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, current, "Invalidly formatted floating point number") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, current, "Invalidly formatted floating point number"); } } break; } - else if (HDisalpha(current->tok_begin[0])) { + else if (isalpha(current->tok_begin[0])) { /* is symbol */ current->tok_type = H5Z_XFORM_SYMBOL; current->tok_end = current->tok_begin; - while (HDisalnum(current->tok_end[0])) + while (isalnum(current->tok_end[0])) ++current->tok_end; break; @@ -484,7 +472,7 @@ H5Z__get_token(H5Z_token *current) default: current->tok_type = H5Z_XFORM_ERROR; HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, current, - "Unknown H5Z_token in data transform expression ") + "Unknown H5Z_token in data transform expression "); } current->tok_end = current->tok_begin + 1; @@ -508,9 +496,6 @@ H5Z__get_token(H5Z_token *current) * Function: H5Z__xform_destroy_parse_tree * Purpose: Recursively destroys the expression tree. * Return: Nothing - * Programmer: Bill Wendling - * 25. August 2003 - * *------------------------------------------------------------------------- */ static void @@ -536,9 +521,6 @@ H5Z__xform_destroy_parse_tree(H5Z_node *tree) * Return: Success: Valid H5Z_node ptr to an expression tree. * Failure: NULL * - * Programmer: Bill Wendling - * 26. August 2003 - * *------------------------------------------------------------------------- */ static void * @@ -550,7 +532,7 @@ H5Z__xform_parse(const char *expression, H5Z_datval_ptrs *dat_val_pointers) FUNC_ENTER_PACKAGE if (!expression) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "No expression provided?") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "No expression provided?"); /* Set up the initial H5Z_token for parsing */ tok.tok_expr = tok.tok_begin = tok.tok_end = expression; @@ -573,9 +555,6 @@ H5Z__xform_parse(const char *expression, H5Z_datval_ptrs *dat_val_pointers) * Return: Success: Valid H5Z_node ptr to expression tree * Failure: NULL * - * Programmer: Bill Wendling - * 26. August 2003 - * *------------------------------------------------------------------------- */ static H5Z_node * @@ -599,7 +578,7 @@ H5Z__parse_expression(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!new_node) { H5Z__xform_destroy_parse_tree(expr); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node"); } new_node->lchild = expr; @@ -607,7 +586,7 @@ H5Z__parse_expression(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!new_node->rchild) { H5Z__xform_destroy_parse_tree(new_node); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } expr = new_node; @@ -618,7 +597,7 @@ H5Z__parse_expression(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!new_node) { H5Z__xform_destroy_parse_tree(expr); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node"); } new_node->lchild = expr; @@ -626,7 +605,7 @@ H5Z__parse_expression(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!new_node->rchild) { H5Z__xform_destroy_parse_tree(new_node); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } expr = new_node; @@ -634,10 +613,10 @@ H5Z__parse_expression(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) case H5Z_XFORM_RPAREN: H5Z__unget_token(current); - HGOTO_DONE(expr) + HGOTO_DONE(expr); case H5Z_XFORM_END: - HGOTO_DONE(expr) + HGOTO_DONE(expr); case H5Z_XFORM_ERROR: case H5Z_XFORM_INTEGER: @@ -648,7 +627,7 @@ H5Z__parse_expression(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) case H5Z_XFORM_LPAREN: default: H5Z__xform_destroy_parse_tree(expr); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } } @@ -665,9 +644,6 @@ H5Z__parse_expression(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) * Return: Success: Valid H5Z_node ptr to expression tree * Failure: NULL * - * Programmer: Bill Wendling - * 26. August 2003 - * *------------------------------------------------------------------------- */ static H5Z_node * @@ -691,7 +667,7 @@ H5Z__parse_term(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!new_node) { H5Z__xform_destroy_parse_tree(term); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node"); } new_node->lchild = term; @@ -699,7 +675,7 @@ H5Z__parse_term(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!new_node->rchild) { H5Z__xform_destroy_parse_tree(new_node); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } term = new_node; @@ -710,7 +686,7 @@ H5Z__parse_term(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!new_node) { H5Z__xform_destroy_parse_tree(term); - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node"); } new_node->lchild = term; @@ -719,16 +695,16 @@ H5Z__parse_term(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!new_node->rchild) { H5Z__xform_destroy_parse_tree(new_node); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } break; case H5Z_XFORM_RPAREN: H5Z__unget_token(current); - HGOTO_DONE(term) + HGOTO_DONE(term); case H5Z_XFORM_END: - HGOTO_DONE(term) + HGOTO_DONE(term); case H5Z_XFORM_INTEGER: case H5Z_XFORM_FLOAT: @@ -737,13 +713,13 @@ H5Z__parse_term(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) case H5Z_XFORM_MINUS: case H5Z_XFORM_LPAREN: H5Z__unget_token(current); - HGOTO_DONE(term) + HGOTO_DONE(term); case H5Z_XFORM_ERROR: default: H5Z__xform_destroy_parse_tree(term); HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, - "bad transform type passed to data transform expression") + "bad transform type passed to data transform expression"); } /* end switch */ } /* end for */ @@ -764,9 +740,6 @@ H5Z__parse_term(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) * Return: Success: Valid H5Z_node ptr to expression tree * Failure: NULL * - * Programmer: Bill Wendling - * 26. August 2003 - * *------------------------------------------------------------------------- */ static H5Z_node * @@ -785,7 +758,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) factor = H5Z__new_node(H5Z_XFORM_INTEGER); if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node"); HDsscanf(current->tok_begin, "%ld", &factor->value.int_val); break; @@ -793,7 +766,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) factor = H5Z__new_node(H5Z_XFORM_FLOAT); if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node"); HDsscanf(current->tok_begin, "%lf", &factor->value.float_val); break; @@ -801,7 +774,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) factor = H5Z__new_node(H5Z_XFORM_SYMBOL); if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node"); factor->value.dat_val = &(dat_val_pointers->ptr_dat_val[dat_val_pointers->num_ptrs]); dat_val_pointers->num_ptrs++; @@ -811,20 +784,20 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) factor = H5Z__parse_expression(current, dat_val_pointers); if (!factor) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Unable to allocate new node"); current = H5Z__get_token(current); if (current->tok_type != H5Z_XFORM_RPAREN) { H5Z__xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error in data transform expression"); } break; case H5Z_XFORM_RPAREN: /* We shouldn't see a ) right now */ H5Z__xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error: unexpected ')' ") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Syntax error: unexpected ')' "); case H5Z_XFORM_PLUS: /* unary + */ @@ -835,7 +808,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) new_node->type != H5Z_XFORM_SYMBOL) { H5Z__xform_destroy_parse_tree(new_node); H5Z__xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } factor = new_node; @@ -843,7 +816,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!new_node) { H5Z__xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } new_node->rchild = factor; @@ -851,7 +824,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) } else { H5Z__xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } break; @@ -864,7 +837,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) new_node->type != H5Z_XFORM_SYMBOL) { H5Z__xform_destroy_parse_tree(new_node); H5Z__xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } factor = new_node; @@ -872,7 +845,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) if (!new_node) { H5Z__xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } new_node->rchild = factor; @@ -880,7 +853,7 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) } else { H5Z__xform_destroy_parse_tree(factor); - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error parsing data transform expression"); } break; @@ -891,14 +864,15 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) case H5Z_XFORM_DIVIDE: case H5Z_XFORM_ERROR: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Invalid token while parsing data transform expression") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, + "Invalid token while parsing data transform expression"); } /* Set return value */ ret_value = factor; done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /*------------------------------------------------------------------------- @@ -909,9 +883,6 @@ H5Z__parse_factor(H5Z_token *current, H5Z_datval_ptrs *dat_val_pointers) * Return: Success: Valid H5Z_node ptr * Failure: NULL * - * Programmer: Bill Wendling - * 26. August 2003 - * *------------------------------------------------------------------------- */ static H5Z_node * @@ -923,7 +894,7 @@ H5Z__new_node(H5Z_token_type type) if (NULL == (ret_value = (H5Z_node *)H5MM_calloc(sizeof(H5Z_node)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "Ran out of memory trying to allocate space for nodes in the parse tree") + "Ran out of memory trying to allocate space for nodes in the parse tree"); ret_value->type = type; @@ -937,9 +908,6 @@ H5Z__new_node(H5Z_token_type type) * Otherwise, it calls H5Z__xform_eval_full to do the full * transform. * Return: SUCCEED if transform applied successfully, FAIL otherwise - * Programmer: Leon Arber - * 5/1/04 - * *------------------------------------------------------------------------- */ herr_t @@ -953,13 +921,13 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void *array, size_t array_size FUNC_ENTER_NOAPI(FAIL) - HDassert(data_xform_prop); + assert(data_xform_prop); tree = data_xform_prop->parse_root; /* Get the datatype ID for the buffer's type */ if ((array_type = H5Z__xform_find_type(buf_type)) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Cannot perform data transform on this type.") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Cannot perform data transform on this type."); /* After this point, we're assured that the type of the array is handled by the eval code, * so we no longer have to check for valid types @@ -1012,7 +980,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void *array, size_t array_size if (NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val[i] = (void *)H5MM_malloc( array_size * H5T_get_size((H5T_t *)H5I_object(array_type))))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "Ran out of memory trying to allocate space for data in data transform") + "Ran out of memory trying to allocate space for data in data transform"); H5MM_memcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size * H5T_get_size((H5T_t *)H5I_object(array_type))); @@ -1020,7 +988,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void *array, size_t array_size } /* end else */ if (H5Z__xform_eval_full(tree, array_size, array_type, &res) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform"); if (data_xform_prop->dat_val_pointers->num_ptrs > 1) H5MM_memcpy(array, res.value.dat_val, array_size * H5T_get_size((H5T_t *)H5I_object(array_type))); @@ -1057,9 +1025,6 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void *array, size_t array_size * * Return: Nothing * - * Programmer: Leon Arber - * 5/1/04 - * *------------------------------------------------------------------------- */ static herr_t @@ -1071,10 +1036,10 @@ H5Z__xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ FUNC_ENTER_PACKAGE /* check args */ - HDassert(tree); + assert(tree); - HDmemset(&resl, 0, sizeof(H5Z_result)); - HDmemset(&resr, 0, sizeof(H5Z_result)); + memset(&resl, 0, sizeof(H5Z_result)); + memset(&resr, 0, sizeof(H5Z_result)); if (tree->type == H5Z_XFORM_INTEGER) { res->type = H5Z_XFORM_INTEGER; @@ -1094,9 +1059,9 @@ H5Z__xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ } /* end if */ else { if (tree->lchild && H5Z__xform_eval_full(tree->lchild, array_size, array_type, &resl) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform"); if (H5Z__xform_eval_full(tree->rchild, array_size, array_type, &resr) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform"); res->type = H5Z_XFORM_SYMBOL; @@ -1129,7 +1094,7 @@ H5Z__xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ case H5Z_XFORM_RPAREN: case H5Z_XFORM_END: default: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid expression tree") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Invalid expression tree"); } /* end switch */ /* The result stores a pointer to the new data */ @@ -1140,7 +1105,7 @@ H5Z__xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ else if (resr.type == H5Z_XFORM_SYMBOL) res->value.dat_val = resr.value.dat_val; else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error during transform evaluation") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error during transform evaluation"); } /* end else */ done: @@ -1152,8 +1117,6 @@ H5Z__xform_eval_full(H5Z_node *tree, const size_t array_size, const hid_t array_ * * Return: Native type of datatype that is passed in * - * Programmer: Leon Arber, 4/20/04 - * *------------------------------------------------------------------------- */ static hid_t @@ -1164,52 +1127,52 @@ H5Z__xform_find_type(const H5T_t *type) FUNC_ENTER_PACKAGE - HDassert(type); + assert(type); /* Check for SHORT type */ if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_SHORT)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_SHORT) + HGOTO_DONE(H5T_NATIVE_SHORT); /* Check for INT type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_INT)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_INT) + HGOTO_DONE(H5T_NATIVE_INT); /* Check for LONG type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_LONG)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_LONG) + HGOTO_DONE(H5T_NATIVE_LONG); /* Check for LONGLONG type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_LLONG)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_LLONG) + HGOTO_DONE(H5T_NATIVE_LLONG); /* Check for UCHAR type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_UCHAR)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_UCHAR) + HGOTO_DONE(H5T_NATIVE_UCHAR); /* Check for CHAR type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_CHAR)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_CHAR) + HGOTO_DONE(H5T_NATIVE_CHAR); /* Check for SCHAR type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_SCHAR)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_SCHAR) + HGOTO_DONE(H5T_NATIVE_SCHAR); /* Check for USHORT type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_USHORT)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_USHORT) + HGOTO_DONE(H5T_NATIVE_USHORT); /* Check for UINT type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_UINT)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_UINT) + HGOTO_DONE(H5T_NATIVE_UINT); /* Check for ULONG type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_ULONG)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_ULONG) + HGOTO_DONE(H5T_NATIVE_ULONG); /* Check for ULONGLONG type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_ULLONG)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_ULLONG) + HGOTO_DONE(H5T_NATIVE_ULLONG); /* Check for FLOAT type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_FLOAT) + HGOTO_DONE(H5T_NATIVE_FLOAT); /* Check for DOUBLE type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_DOUBLE) + HGOTO_DONE(H5T_NATIVE_DOUBLE); /* Check for LONGDOUBLE type */ else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE)) && 0 == H5T_cmp(type, tmp, FALSE)) - HGOTO_DONE(H5T_NATIVE_LDOUBLE) + HGOTO_DONE(H5T_NATIVE_LDOUBLE); else - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not find matching type") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not find matching type"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1223,9 +1186,6 @@ H5Z__xform_find_type(const H5T_t *type) * Return: A pointer to a root for a new parse tree which is a copy * of the one passed in. * - * Programmer: Leon Arber - * April 1, 2004. - * *------------------------------------------------------------------------- */ static void * @@ -1235,11 +1195,11 @@ H5Z__xform_copy_tree(H5Z_node *tree, H5Z_datval_ptrs *dat_val_pointers, H5Z_datv FUNC_ENTER_PACKAGE - HDassert(tree); + assert(tree); if (tree->type == H5Z_XFORM_INTEGER) { if ((ret_value = (H5Z_node *)H5MM_malloc(sizeof(H5Z_node))) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree"); else { ret_value->type = H5Z_XFORM_INTEGER; ret_value->value.int_val = tree->value.int_val; @@ -1249,7 +1209,7 @@ H5Z__xform_copy_tree(H5Z_node *tree, H5Z_datval_ptrs *dat_val_pointers, H5Z_datv } else if (tree->type == H5Z_XFORM_FLOAT) { if ((ret_value = (H5Z_node *)H5MM_malloc(sizeof(H5Z_node))) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree"); else { ret_value->type = H5Z_XFORM_FLOAT; ret_value->value.float_val = tree->value.float_val; @@ -1259,7 +1219,7 @@ H5Z__xform_copy_tree(H5Z_node *tree, H5Z_datval_ptrs *dat_val_pointers, H5Z_datv } else if (tree->type == H5Z_XFORM_SYMBOL) { if ((ret_value = (H5Z_node *)H5MM_malloc(sizeof(H5Z_node))) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to copy parse tree"); else { ret_value->type = H5Z_XFORM_SYMBOL; @@ -1278,7 +1238,7 @@ H5Z__xform_copy_tree(H5Z_node *tree, H5Z_datval_ptrs *dat_val_pointers, H5Z_datv else if (tree->type == H5Z_XFORM_DIVIDE) H5Z_XFORM_DO_OP4(H5Z_XFORM_DIVIDE) else - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error in parse tree while trying to copy") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "Error in parse tree while trying to copy"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1292,9 +1252,6 @@ H5Z__xform_copy_tree(H5Z_node *tree, H5Z_datval_ptrs *dat_val_pointers, H5Z_datv * * Return: TRUE or FALSE * - * Programmer: Raymond Lu - * 15 March 2012 - * *------------------------------------------------------------------------- */ static hbool_t @@ -1304,7 +1261,7 @@ H5Z__op_is_numbs(H5Z_node *_tree) FUNC_ENTER_PACKAGE_NOERR - HDassert(_tree); + assert(_tree); if (((_tree->lchild->type == H5Z_XFORM_INTEGER) || (_tree->lchild->type == H5Z_XFORM_FLOAT)) && ((_tree->rchild->type == H5Z_XFORM_INTEGER) || (_tree->rchild->type == H5Z_XFORM_FLOAT))) @@ -1323,9 +1280,6 @@ H5Z__op_is_numbs(H5Z_node *_tree) * * Return: TRUE or FALSE * - * Programmer: Raymond Lu - * 15 March 2012 - * *------------------------------------------------------------------------- */ static hbool_t @@ -1335,7 +1289,7 @@ H5Z__op_is_numbs2(H5Z_node *_tree) FUNC_ENTER_PACKAGE_NOERR - HDassert(_tree); + assert(_tree); if ((!_tree->lchild && ((_tree->rchild->type == H5Z_XFORM_INTEGER) || (_tree->rchild->type == H5Z_XFORM_FLOAT))) || @@ -1356,9 +1310,6 @@ H5Z__op_is_numbs2(H5Z_node *_tree) * * Return: None. * - * Programmer: Leon Arber - * April 1, 2004. - * *------------------------------------------------------------------------- */ static void @@ -1397,7 +1348,7 @@ H5Z__xform_reduce_tree(H5Z_node *tree) } } - FUNC_LEAVE_NOAPI_VOID; + FUNC_LEAVE_NOAPI_VOID } /*------------------------------------------------------------------------- @@ -1411,9 +1362,6 @@ H5Z__xform_reduce_tree(H5Z_node *tree) * * Return: None. * - * Programmer: Leon Arber - * April 1, 2004. - * *------------------------------------------------------------------------- */ static void @@ -1430,7 +1378,7 @@ H5Z__do_op(H5Z_node *tree) else if (tree->type == H5Z_XFORM_MINUS) H5Z_XFORM_DO_OP6(-) - FUNC_LEAVE_NOAPI_VOID; + FUNC_LEAVE_NOAPI_VOID } /*------------------------------------------------------------------------- @@ -1442,10 +1390,6 @@ H5Z__do_op(H5Z_node *tree) * Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * - * Date: May 4, 2004 - * *------------------------------------------------------------------------- */ H5Z_data_xform_t * @@ -1458,30 +1402,30 @@ H5Z_xform_create(const char *expr) FUNC_ENTER_NOAPI(NULL) - HDassert(expr); + assert(expr); /* Allocate space for the data transform information */ if (NULL == (data_xform_prop = (H5Z_data_xform_t *)H5MM_calloc(sizeof(H5Z_data_xform_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform info") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform info"); if (NULL == (data_xform_prop->dat_val_pointers = (H5Z_datval_ptrs *)H5MM_malloc(sizeof(H5Z_datval_ptrs)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate memory for data transform array storage") + "unable to allocate memory for data transform array storage"); /* copy the user's string into the property */ if (NULL == (data_xform_prop->xform_exp = (char *)H5MM_xstrdup(expr))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate memory for data transform expression") + "unable to allocate memory for data transform expression"); /* Find the number of times "x" is used in this equation, and allocate room for storing that many points * A more sophisticated check is needed to support scientific notation. */ for (i = 0; i < HDstrlen(expr); i++) { - if (HDisalpha(expr[i])) { + if (isalpha(expr[i])) { if ((i > 0) && (i < (HDstrlen(expr) - 1))) { if (((expr[i] == 'E') || (expr[i] == 'e')) && - (HDisdigit(expr[i - 1]) || (expr[i - 1] == '.')) && - (HDisdigit(expr[i + 1]) || (expr[i + 1] == '-') || (expr[i + 1] == '+'))) + (isdigit(expr[i - 1]) || (expr[i - 1] == '.')) && + (isdigit(expr[i + 1]) || (expr[i + 1] == '-') || (expr[i + 1] == '+'))) continue; } /* end if */ @@ -1496,7 +1440,7 @@ H5Z_xform_create(const char *expr) if (NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val = (void **)H5MM_calloc(count * sizeof(void *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, - "unable to allocate memory for pointers in transform array") + "unable to allocate memory for pointers in transform array"); /* Initialize the num_ptrs field, which will be used to keep track of the number of copies * of the data we have for polynomial transforms */ @@ -1505,13 +1449,13 @@ H5Z_xform_create(const char *expr) /* we generate the parse tree right here and store a pointer to its root in the property. */ if ((data_xform_prop->parse_root = (H5Z_node *)H5Z__xform_parse(expr, data_xform_prop->dat_val_pointers)) == NULL) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to generate parse tree from expression") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to generate parse tree from expression"); /* Sanity check * count should be the same num_ptrs */ if (count != data_xform_prop->dat_val_pointers->num_ptrs) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, - "error copying the parse tree, did not find correct number of \"variables\"") + "error copying the parse tree, did not find correct number of \"variables\""); /* Assign return value */ ret_value = data_xform_prop; @@ -1544,10 +1488,6 @@ H5Z_xform_create(const char *expr) * Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * - * Date: May 4, 2004 - * *------------------------------------------------------------------------- */ herr_t @@ -1585,10 +1525,6 @@ H5Z_xform_destroy(H5Z_data_xform_t *data_xform_prop) * Success: SUCCEED * Failure: FAIL * - * Programmer: Quincey Koziol - * - * Date: May 4, 2004 - * * Comments: This is an "in-place" copy, since this routine gets called * after the top-level copy has been performed and this routine finishes * the "deep" part of the copy. @@ -1608,29 +1544,29 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) if (*data_xform_prop) { /* Allocate new node */ if (NULL == (new_data_xform_prop = (H5Z_data_xform_t *)H5MM_calloc(sizeof(H5Z_data_xform_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform info") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform info"); /* Copy string */ if (NULL == (new_data_xform_prop->xform_exp = (char *)H5MM_xstrdup((*data_xform_prop)->xform_exp))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "unable to allocate memory for data transform expression") + "unable to allocate memory for data transform expression"); if (NULL == (new_data_xform_prop->dat_val_pointers = (H5Z_datval_ptrs *)H5MM_malloc(sizeof(H5Z_datval_ptrs)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "unable to allocate memory for data transform array storage") + "unable to allocate memory for data transform array storage"); /* Find the number of times "x" is used in this equation, and allocate room for storing that many * points */ for (i = 0; i < HDstrlen(new_data_xform_prop->xform_exp); i++) - if (HDisalpha(new_data_xform_prop->xform_exp[i])) + if (isalpha(new_data_xform_prop->xform_exp[i])) count++; if (count > 0) if (NULL == (new_data_xform_prop->dat_val_pointers->ptr_dat_val = (void **)H5MM_calloc(count * sizeof(void *)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, - "unable to allocate memory for pointers in transform array") + "unable to allocate memory for pointers in transform array"); /* Zero out num_pointers prior to H5Z_xform_cop_tree call; that call will increment it to the right * amount */ @@ -1640,13 +1576,13 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) if ((new_data_xform_prop->parse_root = (H5Z_node *)H5Z__xform_copy_tree( (*data_xform_prop)->parse_root, (*data_xform_prop)->dat_val_pointers, new_data_xform_prop->dat_val_pointers)) == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "error copying the parse tree") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "error copying the parse tree"); /* Sanity check * count should be the same num_ptrs */ if (count != new_data_xform_prop->dat_val_pointers->num_ptrs) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "error copying the parse tree, did not find correct number of \"variables\"") + "error copying the parse tree, did not find correct number of \"variables\""); /* Copy new information on top of old information */ *data_xform_prop = new_data_xform_prop; @@ -1674,10 +1610,6 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) * * Return: TRUE for no data transform, FALSE for a data transform * - * Programmer: Quincey Koziol - * - * Date: May 4, 2004 - * * Comments: Can't fail * *------------------------------------------------------------------------- @@ -1710,10 +1642,6 @@ H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop) * Return: * Pointer to a copy of the string in the data_xform property. * - * Programmer: Leon Arber - * - * Date: Sept. 4, 2004 - * *------------------------------------------------------------------------- */ const char * @@ -1724,7 +1652,7 @@ H5Z_xform_extract_xform_str(const H5Z_data_xform_t *data_xform_prop) /* There should be no way that this can be NULL since the function * that calls this one checks to make sure it isn't before * passing them */ - HDassert(data_xform_prop); + assert(data_xform_prop); FUNC_LEAVE_NOAPI(data_xform_prop->xform_exp) } /* H5Z_xform_extract_xform_str() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5checksum.c b/externals/coda-oss/modules/drivers/hdf5/source/H5checksum.c index dcf2536224..b9823d86fb 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5checksum.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5checksum.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5checksum.c - * Aug 21 2006 - * Quincey Koziol * * Purpose: Internal code for computing fletcher32 checksums * @@ -92,9 +89,6 @@ static hbool_t H5_crc_table_computed = FALSE; * * Return: 32-bit fletcher checksum of input buffer (can't fail) * - * Programmer: Quincey Koziol - * Monday, August 21, 2006 - * *------------------------------------------------------------------------- */ uint32_t @@ -107,8 +101,8 @@ H5_checksum_fletcher32(const void *_data, size_t _len) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(_data); - HDassert(_len > 0); + assert(_data); + assert(_len > 0); /* Compute checksum for pairs of bytes */ /* (the magic "360" value is the largest number of sums that can be @@ -148,9 +142,6 @@ H5_checksum_fletcher32(const void *_data, size_t _len) * * Return: none * - * Programmer: Quincey Koziol - * Tuesday, September 5, 2006 - * *------------------------------------------------------------------------- */ static void @@ -186,9 +177,6 @@ H5__checksum_crc_make_table(void) * * Return: 32-bit CRC checksum of input buffer (can't fail) * - * Programmer: Quincey Koziol - * Tuesday, September 5, 2006 - * *------------------------------------------------------------------------- */ static uint32_t @@ -221,9 +209,6 @@ H5__checksum_crc_update(uint32_t crc, const uint8_t *buf, size_t len) * * Return: 32-bit CRC checksum of input buffer (can't fail) * - * Programmer: Quincey Koziol - * Tuesday, September 5, 2006 - * *------------------------------------------------------------------------- */ uint32_t @@ -232,8 +217,8 @@ H5_checksum_crc(const void *_data, size_t len) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(_data); - HDassert(len > 0); + assert(_data); + assert(len > 0); FUNC_LEAVE_NOAPI(H5__checksum_crc_update((uint32_t)0xffffffffL, (const uint8_t *)_data, len) ^ 0xffffffffL) @@ -285,7 +270,7 @@ rotates. */ #define H5_lookup3_rot(x, k) (((x) << (k)) ^ ((x) >> (32 - (k)))) #define H5_lookup3_mix(a, b, c) \ - { \ + do { \ a -= c; \ a ^= H5_lookup3_rot(c, 4); \ c += b; \ @@ -304,7 +289,7 @@ rotates. c -= b; \ c ^= H5_lookup3_rot(b, 4); \ b += a; \ - } + } while (0) /* ------------------------------------------------------------------------------- @@ -332,7 +317,7 @@ and these came close: ------------------------------------------------------------------------------- */ #define H5_lookup3_final(a, b, c) \ - { \ + do { \ c ^= b; \ c -= H5_lookup3_rot(b, 14); \ a ^= c; \ @@ -347,7 +332,7 @@ and these came close: b -= H5_lookup3_rot(a, 14); \ c ^= b; \ c -= H5_lookup3_rot(b, 24); \ - } + } while (0) /* ------------------------------------------------------------------------------- @@ -385,8 +370,8 @@ H5_checksum_lookup3(const void *key, size_t length, uint32_t initval) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(key); - HDassert(length > 0); + assert(key); + assert(length > 0); /* Set up the internal state */ a = b = c = 0xdeadbeef + ((uint32_t)length) + initval; @@ -463,7 +448,7 @@ H5_checksum_lookup3(const void *key, size_t length, uint32_t initval) case 0: goto done; default: - HDassert(0 && "This Should never be executed!"); + assert(0 && "This Should never be executed!"); } H5_lookup3_final(a, b, c); @@ -481,9 +466,6 @@ H5_checksum_lookup3(const void *key, size_t length, uint32_t initval) * * Return: checksum of input buffer (can't fail) * - * Programmer: Quincey Koziol - * Tuesday, August 22, 2006 - * *------------------------------------------------------------------------- */ uint32_t @@ -492,8 +474,8 @@ H5_checksum_metadata(const void *data, size_t len, uint32_t initval) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(data); - HDassert(len > 0); + assert(data); + assert(len > 0); /* Choose the appropriate checksum routine */ /* (use Bob Jenkin's "lookup3" algorithm for all buffer sizes) */ @@ -510,9 +492,6 @@ H5_checksum_metadata(const void *data, size_t len, uint32_t initval) * * Return: hash of input string (can't fail) * - * Programmer: Quincey Koziol - * Tuesday, December 11, 2007 - * *------------------------------------------------------------------------- */ uint32_t @@ -524,7 +503,7 @@ H5_hash_string(const char *str) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ - HDassert(str); + assert(str); while ((c = *str++)) hash = ((hash << 5) + hash) + (uint32_t)c; /* hash * 33 + c */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5dbg.c b/externals/coda-oss/modules/drivers/hdf5/source/H5dbg.c index 5af6525780..69afd013fc 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5dbg.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5dbg.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5dbg.c - * Mar 4 2006 - * Quincey Koziol * * Purpose: Generic debugging routines * @@ -63,9 +60,6 @@ * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Mar 4 2006 - * *------------------------------------------------------------------------- */ herr_t @@ -79,33 +73,33 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark /* * Check arguments. */ - HDassert(stream); - HDassert(indent >= 0); - HDassert(buf); - HDassert(marker); - HDassert(buf_size > 0); + assert(stream); + assert(indent >= 0); + assert(buf); + assert(marker); + assert(buf_size > 0); /* * Print the buffer in a VMS-style octal dump. */ - HDfprintf(stream, "%*sData follows (`__' indicates free region)...\n", indent, ""); + fprintf(stream, "%*sData follows (`__' indicates free region)...\n", indent, ""); for (u = 0; u < buf_size; u += 16) { uint8_t c; - HDfprintf(stream, "%*s %8zu: ", indent, "", u + buf_offset); + fprintf(stream, "%*s %8zu: ", indent, "", u + buf_offset); /* Print the hex values */ for (v = 0; v < 16; v++) { if (u + v < buf_size) { if (marker[u + v]) - HDfprintf(stream, "__ "); + fprintf(stream, "__ "); else { c = buf[buf_offset + u + v]; - HDfprintf(stream, "%02x ", c); + fprintf(stream, "%02x ", c); } /* end else */ } /* end if */ else - HDfprintf(stream, " "); + fprintf(stream, " "); if (7 == v) HDfputc(' ', stream); @@ -120,7 +114,7 @@ H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, const uint8_t *mark else { c = buf[buf_offset + u + v]; - if (HDisprint(c)) + if (isprint(c)) HDfputc(c, stream); else HDfputc('.', stream); diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5detect.c b/externals/coda-oss/modules/drivers/hdf5/source/H5detect.c new file mode 100644 index 0000000000..9520faabc8 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5detect.c @@ -0,0 +1,941 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/*keep this declaration near the top of this file -RPM*/ +static const char *FileHeader = "\n\ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\ + * Copyright by The HDF Group. *\n\ + * All rights reserved. *\n\ + * *\n\ + * This file is part of HDF5. The full HDF5 copyright notice, including *\n\ + * terms governing use, modification, and redistribution, is contained in *\n\ + * the COPYING file, which can be found at the root of the source code *\n\ + * distribution tree, or in https://www.hdfgroup.org/licenses. *\n\ + * If you do not have access to either file, you may request a copy from *\n\ + * help@hdfgroup.org. *\n\ + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"; +/* + * Purpose: This code was borrowed heavily from the `detect.c' + * program in the AIO distribution from Lawrence + * Livermore National Laboratory. + * + * Detects machine byte order and floating point + * format and generates a C source file (H5Tinit.c) + * to describe those parameters. + * + * Assumptions: We have an ANSI compiler. We're on a Unix like + * system or configure has detected those Unix + * features which aren't available. We're not + * running on a Vax or other machine with mixed + * endianness. + *------------------------------------------------------------------------- + */ +#undef NDEBUG +#include "H5private.h" +/* Do NOT use fprintf in this file as it is not linked with the library, + * which contains the H5system.c file in which the function is defined. + */ +#include "H5Tpublic.h" +#include "H5Rpublic.h" + +#if defined(__has_attribute) +#if __has_attribute(no_sanitize_address) +#define HDF_NO_UBSAN __attribute__((no_sanitize_address)) +#else +#define HDF_NO_UBSAN +#endif +#else +#define HDF_NO_UBSAN +#endif + +#define MAXDETECT 64 + +/* + * This structure holds information about a type that + * was detected. + */ +typedef struct detected_t { + const char *varname; + unsigned int size; /* total byte size */ + unsigned int precision; /* meaningful bits */ + unsigned int offset; /* bit offset to meaningful bits */ + int perm[32]; /* for detection of byte order */ + hbool_t is_vax; /* for vax (float & double) only */ + unsigned int sign; /* location of sign bit */ + unsigned int mpos, msize, imp; /* information about mantissa */ + unsigned int epos, esize; /* information about exponent */ + unsigned long bias; /* exponent bias for floating pt */ + unsigned int comp_align; /* alignment for structure */ +} detected_t; + +FILE *rawoutstream = NULL; + +/* global variables types detection code */ +H5_GCC_DIAG_OFF("larger-than=") +static detected_t d_g[MAXDETECT]; +H5_GCC_DIAG_ON("larger-than=") +static volatile int nd_g = 0; + +static void print_results(int nd, detected_t *d); +static void iprint(detected_t *); +static int byte_cmp(int, const void *, const void *, const unsigned char *); +static unsigned int bit_cmp(unsigned int, int *, void *, void *, const unsigned char *); +static void fix_order(int, int, int *, const char **); +static unsigned int imp_bit(unsigned int, int *, void *, void *, const unsigned char *); +static unsigned int find_bias(unsigned int, unsigned int, int *, void *); +static void precision(detected_t *); +static void print_header(void); +static void detect_C89_floats(void); +static void detect_C99_floats(void); + +/*------------------------------------------------------------------------- + * Function: precision + * + * Purpose: Determine the precision and offset. + * + * Return: void + *------------------------------------------------------------------------- + */ +static void +precision(detected_t *d) +{ + /* A floating point */ + d->offset = MIN3(d->mpos, d->epos, d->sign); + d->precision = d->msize + d->esize + 1; +} + +/*------------------------------------------------------------------------- + * Function: DETECT_F + * + * Purpose: This macro takes a floating point type like `double' and + * a base name like `natd' and detects byte order, mantissa + * location, exponent location, sign bit location, presence or + * absence of implicit mantissa bit, and exponent bias and + * initializes a detected_t structure with those properties. + *------------------------------------------------------------------------- + */ +#define DETECT_F(TYPE, VAR, INFO) \ + { \ + TYPE _v1, _v2, _v3; \ + unsigned char _buf1[sizeof(TYPE)], _buf3[sizeof(TYPE)]; \ + unsigned char _pad_mask[sizeof(TYPE)]; \ + unsigned char _byte_mask; \ + int _i, _j, _last = (-1); \ + const char *_mesg; \ + \ + memset(&INFO, 0, sizeof(INFO)); \ + INFO.varname = #VAR; \ + INFO.size = sizeof(TYPE); \ + \ + /* Initialize padding mask */ \ + memset(_pad_mask, 0, sizeof(_pad_mask)); \ + \ + /* Padding bits. Set a variable to 4.0, then flip each bit and see if \ + * the modified variable is equal ("==") to the original. Build a \ + * padding bitmask to indicate which bits in the type are padding (i.e. \ + * have no effect on the value and should be ignored by subsequent \ + * steps). This is necessary because padding bits can change arbitrarily \ + * and interfere with detection of the various properties below unless we \ + * know to ignore them. */ \ + _v1 = (TYPE)4.0L; \ + memcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ + for (_i = 0; _i < (int)sizeof(TYPE); _i++) \ + for (_byte_mask = (unsigned char)1; _byte_mask; _byte_mask = (unsigned char)(_byte_mask << 1)) { \ + _buf1[_i] ^= _byte_mask; \ + memcpy((void *)&_v2, (const void *)_buf1, sizeof(TYPE)); \ + H5_GCC_CLANG_DIAG_OFF("float-equal") \ + if (_v1 != _v2) \ + _pad_mask[_i] |= _byte_mask; \ + H5_GCC_CLANG_DIAG_ON("float-equal") \ + _buf1[_i] ^= _byte_mask; \ + } /* end for */ \ + \ + /* Byte Order */ \ + for (_i = 0, _v1 = (TYPE)0.0L, _v2 = (TYPE)1.0L; _i < (int)sizeof(TYPE); _i++) { \ + _v3 = _v1; \ + _v1 += _v2; \ + _v2 /= (TYPE)256.0L; \ + memcpy(_buf1, (const void *)&_v1, sizeof(TYPE)); \ + memcpy(_buf3, (const void *)&_v3, sizeof(TYPE)); \ + _j = byte_cmp(sizeof(TYPE), _buf3, _buf1, _pad_mask); \ + if (_j >= 0) { \ + INFO.perm[_i] = _j; \ + _last = _i; \ + } \ + } \ + fix_order(sizeof(TYPE), _last, INFO.perm, (const char **)&_mesg); \ + \ + if (!strcmp(_mesg, "VAX")) \ + INFO.is_vax = TRUE; \ + \ + /* Implicit mantissa bit */ \ + _v1 = (TYPE)0.5L; \ + _v2 = (TYPE)1.0L; \ + INFO.imp = imp_bit(sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ + \ + /* Sign bit */ \ + _v1 = (TYPE)1.0L; \ + _v2 = (TYPE)-1.0L; \ + INFO.sign = bit_cmp(sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ + \ + /* Mantissa */ \ + INFO.mpos = 0; \ + \ + _v1 = (TYPE)1.0L; \ + _v2 = (TYPE)1.5L; \ + INFO.msize = bit_cmp(sizeof(TYPE), INFO.perm, &_v1, &_v2, _pad_mask); \ + INFO.msize += 1 + (unsigned int)(INFO.imp ? 0 : 1) - INFO.mpos; \ + \ + /* Exponent */ \ + INFO.epos = INFO.mpos + INFO.msize; \ + \ + INFO.esize = INFO.sign - INFO.epos; \ + \ + _v1 = (TYPE)1.0L; \ + INFO.bias = find_bias(INFO.epos, INFO.esize, INFO.perm, &_v1); \ + precision(&(INFO)); \ + if (!strcmp(INFO.varname, "FLOAT") || !strcmp(INFO.varname, "DOUBLE") || \ + !strcmp(INFO.varname, "LDOUBLE")) { \ + COMP_ALIGNMENT(TYPE, INFO.comp_align); \ + } \ + } + +/* Detect alignment for C structure */ +#define COMP_ALIGNMENT(TYPE, COMP_ALIGN) \ + { \ + struct { \ + char c; \ + TYPE x; \ + } s; \ + \ + COMP_ALIGN = (unsigned int)((char *)(&(s.x)) - (char *)(&s)); \ + } + +/*------------------------------------------------------------------------- + * Function: print_results + * + * Purpose: Prints information about the detected data types. + * + * Return: void + *------------------------------------------------------------------------- + */ +static void +print_results(int nd, detected_t *d) +{ + int byte_order = 0; /*byte order of data types*/ + int i, j; + + /* Include files */ + fprintf(rawoutstream, "\ +/****************/\n\ +/* Module Setup */\n\ +/****************/\n\ +\n\ +#include \"H5Tmodule.h\" /* This source code file is part of the H5T module */\n\ +\n\ +\n\ +/***********/\n\ +/* Headers */\n\ +/***********/\n\ +#include \"H5private.h\" /* Generic Functions */\n\ +#include \"H5Eprivate.h\" /* Error handling */\n\ +#include \"H5FLprivate.h\" /* Free Lists */\n\ +#include \"H5Iprivate.h\" /* IDs */\n\ +#include \"H5Tpkg.h\" /* Datatypes */\n\ +\n\ +\n\ +/****************/\n\ +/* Local Macros */\n\ +/****************/\n\ +\n\ +\n\ +/******************/\n\ +/* Local Typedefs */\n\ +/******************/\n\ +\n\ +\n\ +/********************/\n\ +/* Package Typedefs */\n\ +/********************/\n\ +\n\ +\n\ +/********************/\n\ +/* Local Prototypes */\n\ +/********************/\n\ +\n\ +\n\ +/********************/\n\ +/* Public Variables */\n\ +/********************/\n\ +\n\ +\n\ +/*****************************/\n\ +/* Library Private Variables */\n\ +/*****************************/\n\ +\n\ +\n\ +/*********************/\n\ +/* Package Variables */\n\ +/*********************/\n\ +\n\ +\n"); + fprintf(rawoutstream, "\n\ +/*******************/\n\ +/* Local Variables */\n\ +/*******************/\n\ +\n"); + + /* The interface initialization function */ + fprintf(rawoutstream, "\n\ + \n\ +/*-------------------------------------------------------------------------\n\ + * Function: H5T__init_native\n\ + *\n\ + * Purpose: Initialize pre-defined native datatypes from code generated\n\ + * during the library configuration by H5detect.\n\ + *\n\ + * Return: Success: non-negative\n\ + * Failure: negative\n\ + *\n\ + * Programmer: Robb Matzke\n\ + * Wednesday, December 16, 1998\n\ + *\n\ + *-------------------------------------------------------------------------\n\ + */\n\ +herr_t\n\ +H5T__init_native(void)\n\ +{\n\ + H5T_t *dt = NULL;\n\ + herr_t ret_value = SUCCEED;\n\ +\n\ + FUNC_ENTER_PACKAGE\n"); + + for (i = 0; i < nd; i++) { + /* The native endianness of this machine */ + /* The INFO.perm now contains `-1' for bytes that aren't used and + * are always zero. This happens on the Cray for `short' where + * sizeof(short) is 8, but only the low-order 4 bytes are ever used. + */ + if (d[i].is_vax) /* the type is a VAX floating number */ + byte_order = -1; + else { + for (j = 0; j < 32; j++) { + /*Find the 1st containing valid data*/ + if (d[i].perm[j] > -1) { + byte_order = d[i].perm[j]; + break; + } + } + } + + /* Print a comment to describe this section of definitions. */ + fprintf(rawoutstream, "\n /*\n"); + iprint(d + i); + fprintf(rawoutstream, " */\n"); + + /* The part common to fixed and floating types */ + fprintf(rawoutstream, "\ + if(NULL == (dt = H5T__alloc()))\n\ + HGOTO_ERROR(H5E_DATATYPE, H5E_NOSPACE, FAIL, \"datatype allocation failed\");\n\ + dt->shared->state = H5T_STATE_IMMUTABLE;\n\ + dt->shared->type = H5T_FLOAT;\n\ + dt->shared->size = %d;\n", + d[i].size); /*size */ + + if (byte_order == -1) + fprintf(rawoutstream, "\ + dt->shared->u.atomic.order = H5T_ORDER_VAX;\n"); + else if (byte_order == 0) + fprintf(rawoutstream, "\ + dt->shared->u.atomic.order = H5T_ORDER_LE;\n"); + else + fprintf(rawoutstream, "\ + dt->shared->u.atomic.order = H5T_ORDER_BE;\n"); + + fprintf(rawoutstream, "\ + dt->shared->u.atomic.offset = %d;\n\ + dt->shared->u.atomic.prec = %d;\n\ + dt->shared->u.atomic.lsb_pad = H5T_PAD_ZERO;\n\ + dt->shared->u.atomic.msb_pad = H5T_PAD_ZERO;\n", + d[i].offset, /*offset */ + d[i].precision); /*precision */ + /*assert((d[i].perm[0]>0)==(byte_order>0));*/ /* Double-check that byte-order doesn't change */ + + /* The part unique to floating point types */ + fprintf(rawoutstream, "\ +dt->shared->u.atomic.u.f.sign = %d;\n\ +dt->shared->u.atomic.u.f.epos = %d;\n\ +dt->shared->u.atomic.u.f.esize = %d;\n\ +dt->shared->u.atomic.u.f.ebias = 0x%08lx;\n\ +dt->shared->u.atomic.u.f.mpos = %d;\n\ +dt->shared->u.atomic.u.f.msize = %d;\n\ +dt->shared->u.atomic.u.f.norm = H5T_NORM_%s;\n\ +dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO;\n", + d[i].sign, /*sign location */ + d[i].epos, /*exponent loc */ + d[i].esize, /*exponent size */ + (unsigned long)(d[i].bias), /*exponent bias */ + d[i].mpos, /*mantissa loc */ + d[i].msize, /*mantissa size */ + d[i].imp ? "IMPLIED" : "NONE"); /*normalization */ + + /* Register the type */ + fprintf(rawoutstream, "\ + if((H5T_NATIVE_%s_g = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0)\n\ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, \"can't register ID for built-in datatype\");\n", + d[i].varname); + + /* Variables for alignment of compound datatype */ + if (!strcmp(d[i].varname, "SCHAR") || !strcmp(d[i].varname, "SHORT") || + !strcmp(d[i].varname, "INT") || !strcmp(d[i].varname, "LONG") || !strcmp(d[i].varname, "LLONG") || + !strcmp(d[i].varname, "FLOAT") || !strcmp(d[i].varname, "DOUBLE") || + !strcmp(d[i].varname, "LDOUBLE")) { + fprintf(rawoutstream, " H5T_NATIVE_%s_ALIGN_g = %lu;\n", d[i].varname, + (unsigned long)(d[i].comp_align)); + } + } + + /* Consider VAX a little-endian machine */ + if (byte_order == 0 || byte_order == -1) { + fprintf(rawoutstream, "\n\ + /* Set the native order for this machine */\n\ + H5T_native_order_g = H5T_ORDER_%s;\n", + "LE"); + } + else { + fprintf(rawoutstream, "\n\ + /* Set the native order for this machine */\n\ + H5T_native_order_g = H5T_ORDER_%s;\n", + "BE"); + } + + fprintf(rawoutstream, "\ +\n\ +done:\n\ + if(ret_value < 0) {\n\ + if(dt != NULL) {\n\ + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared);\n\ + dt = H5FL_FREE(H5T_t, dt);\n\ + } /* end if */\n\ + } /* end if */\n\ +\n\ + FUNC_LEAVE_NOAPI(ret_value);\n} /* end H5T__init_native() */\n"); + +} /* end print_results() */ + +/*------------------------------------------------------------------------- + * Function: iprint + * + * Purpose: Prints information about the fields of a floating point format. + * + * Return: void + + *------------------------------------------------------------------------- + */ +static void +iprint(detected_t *d) +{ + unsigned int pass; + + for (pass = (d->size - 1) / 4;; --pass) { + unsigned int i, k; + /* + * Print the byte ordering above the bit fields. + */ + fprintf(rawoutstream, " * "); + for (i = MIN(pass * 4 + 3, d->size - 1); i >= pass * 4; --i) { + fprintf(rawoutstream, "%4d", d->perm[i]); + if (i > pass * 4) + fputs(" ", rawoutstream); + if (!i) + break; + } + + /* + * Print the bit fields + */ + fprintf(rawoutstream, "\n * "); + for (i = MIN(pass * 4 + 3, d->size - 1), k = MIN(pass * 32 + 31, 8 * d->size - 1); i >= pass * 4; + --i) { + unsigned int j; + + for (j = 8; j > 0; --j) { + if (k == d->sign) { + fputc('S', rawoutstream); + } + else if (k >= d->epos && k < d->epos + d->esize) { + fputc('E', rawoutstream); + } + else if (k >= d->mpos && k < d->mpos + d->msize) { + fputc('M', rawoutstream); + } + else { + fputc('?', rawoutstream); /*unknown floating point bit */ + } + --k; + } + if (i > pass * 4) + fputc(' ', rawoutstream); + if (!i) + break; + } + fputc('\n', rawoutstream); + if (!pass) + break; + } + + /* + * Is there an implicit bit in the mantissa. + */ + fprintf(rawoutstream, " * Implicit bit? %s\n", d->imp ? "yes" : "no"); +} + +/*------------------------------------------------------------------------- + * Function: byte_cmp + * + * Purpose: Compares two chunks of memory A and B and returns the + * byte index into those arrays of the first byte that + * differs between A and B. Ignores differences where the + * corresponding bit in pad_mask is set to 0. + * + * Return: Success: Index of differing byte. + * Failure: -1 if all bytes are the same. + *------------------------------------------------------------------------- + */ +static int +byte_cmp(int n, const void *_a, const void *_b, const unsigned char *pad_mask) +{ + int i; + const unsigned char *a = (const unsigned char *)_a; + const unsigned char *b = (const unsigned char *)_b; + + for (i = 0; i < n; i++) + if ((a[i] & pad_mask[i]) != (b[i] & pad_mask[i])) + return i; + + return -1; +} + +/*------------------------------------------------------------------------- + * Function: bit_cmp + * + * Purpose: Compares two bit vectors and returns the index for the + * first bit that differs between the two vectors. The + * size of the vector is NBYTES. PERM is a mapping from + * actual order to little endian. Ignores differences where + * the corresponding bit in pad_mask is set to 0. + * + * Return: Index of first differing bit. + * + *------------------------------------------------------------------------- + */ +static unsigned int +bit_cmp(unsigned int nbytes, int *perm, void *_a, void *_b, const unsigned char *pad_mask) +{ + unsigned int i; + unsigned char *a = (unsigned char *)_a; + unsigned char *b = (unsigned char *)_b; + unsigned char aa, bb; + + for (i = 0; i < nbytes; i++) { + assert(perm[i] < (int)nbytes); + if ((aa = (unsigned char)(a[perm[i]] & pad_mask[perm[i]])) != + (bb = (unsigned char)(b[perm[i]] & pad_mask[perm[i]]))) { + unsigned int j; + + for (j = 0; j < 8; j++, aa >>= 1, bb >>= 1) { + if ((aa & 1) != (bb & 1)) + return i * 8 + j; + } + fprintf(stderr, "INTERNAL ERROR"); + abort(); + } + } + fprintf(stderr, "INTERNAL ERROR"); + abort(); + return 0; +} + +/*------------------------------------------------------------------------- + * Function: fix_order + * + * Purpose: Given an array PERM with elements FIRST through LAST + * initialized with zero origin byte numbers, this function + * creates a permutation vector that maps the actual order + * of a floating point number to little-endian. + * + * This function assumes that the mantissa byte ordering + * implies the total ordering. + * + * Return: void + *------------------------------------------------------------------------- + */ +static void +fix_order(int n, int last, int *perm, const char **mesg) +{ + int i; + + if (last > 1) { + /* + * We have at least three points to consider. + */ + if (perm[last] < perm[last - 1] && perm[last - 1] < perm[last - 2]) { + /* + * Little endian. + */ + if (mesg) + *mesg = "Little-endian"; + for (i = 0; i < n; i++) + perm[i] = i; + } + else if (perm[last] > perm[last - 1] && perm[last - 1] > perm[last - 2]) { + /* + * Big endian. + */ + if (mesg) + *mesg = "Big-endian"; + for (i = 0; i < n; i++) + perm[i] = (n - 1) - i; + } + else { + /* + * Bi-endian machines like VAX. + * (NOTE: This is not an actual determination of the VAX-endianness. + * It could have some other endianness and fall into this + * case - JKM & QAK) + */ + assert(0 == n % 2); + if (mesg) + *mesg = "VAX"; + for (i = 0; i < n; i += 2) { + perm[i] = (n - 2) - i; + perm[i + 1] = (n - 1) - i; + } + } + } + else { + fprintf(stderr, "Failed to detect byte order of %d-byte floating point.\n", n); + exit(1); + } +} + +/*------------------------------------------------------------------------- + * Function: imp_bit + * + * Purpose: Looks for an implicit bit in the mantissa. The value + * of _A should be 1.0 and the value of _B should be 0.5. + * Some floating-point formats discard the most significant + * bit of the mantissa after normalizing since it will always + * be a one (except for 0.0). If this is true for the native + * floating point values stored in _A and _B then the function + * returns non-zero. + * + * This function assumes that the exponent occupies higher + * order bits than the mantissa and that the most significant + * bit of the mantissa is next to the least significant bit + * of the exponent. + * + * + * Return: Success: Non-zero if the most significant bit + * of the mantissa is discarded (ie, the + * mantissa has an implicit `one' as the + * most significant bit). Otherwise, + * returns zero. + * + * Failure: 1 + * + *------------------------------------------------------------------------- + */ +static unsigned int +imp_bit(unsigned int n, int *perm, void *_a, void *_b, const unsigned char *pad_mask) +{ + unsigned char *a = (unsigned char *)_a; + unsigned char *b = (unsigned char *)_b; + unsigned int changed, major, minor; + unsigned int msmb; /* most significant mantissa bit */ + + /* + * Look for the least significant bit that has changed between + * A and B. This is the least significant bit of the exponent. + */ + changed = bit_cmp(n, perm, a, b, pad_mask); + + /* + * The bit to the right (less significant) of the changed bit should + * be the most significant bit of the mantissa. If it is non-zero + * then the format does not remove the leading `1' of the mantissa. + */ + msmb = changed - 1; + major = msmb / 8; + minor = msmb % 8; + + return (a[perm[major]] >> minor) & 0x01 ? 0 : 1; +} + +/*------------------------------------------------------------------------- + * Function: find_bias + * + * Purpose: Determines the bias of the exponent. This function should + * be called with _A having a value of `1'. + * + * Return: The exponent bias. + * + *------------------------------------------------------------------------- + */ +H5_ATTR_PURE static unsigned int +find_bias(unsigned int epos, unsigned int esize, int *perm, void *_a) +{ + unsigned char *a = (unsigned char *)_a; + unsigned char mask; + unsigned int b, shift = 0, nbits, bias = 0; + + while (esize > 0) { + nbits = MIN(esize, (8 - epos % 8)); + mask = (unsigned char)((1 << nbits) - 1); + b = (unsigned int)(a[perm[epos / 8]] >> (epos % 8)) & mask; + bias |= b << shift; + + shift += nbits; + esize -= nbits; + epos += nbits; + } + return bias; +} + +/*------------------------------------------------------------------------- + * Function: print_header + * + * Purpose: Prints the C file header for the generated file. + * + * Return: void + *------------------------------------------------------------------------- + */ +static void +print_header(void) +{ + + time_t now = HDtime(NULL); + struct tm *tm = HDlocaltime(&now); + char real_name[30]; + char host_name[256]; + int i; + const char *s; +#ifdef H5_HAVE_GETPWUID + struct passwd *pwd = NULL; +#else + int pwd = 1; +#endif + static const char *month_name[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + static const char *purpose = "\ +This machine-generated source code contains\n\ +information about the various integer and\n\ +floating point numeric formats found on this\n\ +architecture. The parameters below should be\n\ +checked carefully and errors reported to the\n\ +HDF5 maintainer.\n\ +\n\ +Each of the numeric formats listed below are\n\ +printed from most significant bit to least\n\ +significant bit even though the actual bytes\n\ +might be stored in a different order in\n\ +memory. The integers above each binary byte\n\ +indicate the relative order of the bytes in\n\ +memory; little-endian machines have\n\ +decreasing numbers while big-endian machines\n\ +have increasing numbers.\n\ +\n\ +The fields of the numbers are printed as\n\ +letters with `S' for the mantissa sign bit,\n\ +`M' for the mantissa magnitude, and `E' for\n\ +the exponent. The exponent has an associated\n\ +bias which can be subtracted to find the\n\ +true exponent. The radix point is assumed\n\ +to be before the first `M' bit. Any bit\n\ +of a floating-point value not falling into one\n\ +of these categories is printed as a question\n\ +mark. Bits of integer types are printed as\n\ +`I' for 2's complement and `U' for magnitude.\n\ +\n\ +If the most significant bit of the normalized\n\ +mantissa (always a `1' except for `0.0') is\n\ +not stored then an `implicit=yes' appears\n\ +under the field description. In this case,\n\ +the radix point is still assumed to be\n\ +before the first `M' but after the implicit\n\ +bit.\n"; + + /* + * The real name is the first item from the passwd gecos field. + */ +#ifdef H5_HAVE_GETPWUID + { + size_t n; + char *comma; + if ((pwd = getpwuid(getuid()))) { + if ((comma = strchr(pwd->pw_gecos, ','))) { + n = MIN(sizeof(real_name) - 1, (unsigned)(comma - pwd->pw_gecos)); + strncpy(real_name, pwd->pw_gecos, n); + real_name[n] = '\0'; + } + else { + strncpy(real_name, pwd->pw_gecos, sizeof(real_name)); + real_name[sizeof(real_name) - 1] = '\0'; + } + } + else + real_name[0] = '\0'; + } +#else + real_name[0] = '\0'; +#endif + + /* + * The FQDM of this host or the empty string. + */ +#ifdef H5_HAVE_GETHOSTNAME + if (gethostname(host_name, sizeof(host_name)) < 0) { + host_name[0] = '\0'; + } +#else + host_name[0] = '\0'; +#endif + + /* + * The file header: warning, copyright notice, build information. + */ + fprintf(rawoutstream, "/* Generated automatically by H5detect -- do not edit */\n\n\n"); + fputs(FileHeader, rawoutstream); /*the copyright notice--see top of this file */ + + fprintf(rawoutstream, " *\n * Created:\t\t%s %2d, %4d\n", month_name[tm->tm_mon], tm->tm_mday, + 1900 + tm->tm_year); + if (pwd || real_name[0] || host_name[0]) { + fprintf(rawoutstream, " *\t\t\t"); + if (real_name[0]) + fprintf(rawoutstream, "%s <", real_name); +#ifdef H5_HAVE_GETPWUID + if (pwd) + fputs(pwd->pw_name, rawoutstream); +#endif + if (host_name[0]) + fprintf(rawoutstream, "@%s", host_name); + if (real_name[0]) + fprintf(rawoutstream, ">"); + fputc('\n', rawoutstream); + } + fprintf(rawoutstream, " *\n * Purpose:\t\t"); + for (s = purpose; *s; s++) { + fputc(*s, rawoutstream); + if ('\n' == *s && s[1]) + fprintf(rawoutstream, " *\t\t\t"); + } + + fprintf(rawoutstream, " *\n"); + fprintf(rawoutstream, " *\tDO NOT MAKE MODIFICATIONS TO THIS FILE!\n"); + fprintf(rawoutstream, " *\tIt was generated by code in `H5detect.c'.\n"); + + fprintf(rawoutstream, " *\n *"); + for (i = 0; i < 73; i++) + fputc('-', rawoutstream); + fprintf(rawoutstream, "\n */\n\n"); +} + +/*------------------------------------------------------------------------- + * Function: detect_C89_floats + * + * Purpose: Detect C89 floating point types + * + * Return: void + *------------------------------------------------------------------------- + */ +static void HDF_NO_UBSAN +detect_C89_floats(void) +{ + DETECT_F(float, FLOAT, d_g[nd_g]); + nd_g++; + DETECT_F(double, DOUBLE, d_g[nd_g]); + nd_g++; +} + +/*------------------------------------------------------------------------- + * Function: detect_C99_floats + * + * Purpose: Detect C99 floating point types + * + * Return: void + *------------------------------------------------------------------------- + */ +static void HDF_NO_UBSAN +detect_C99_floats(void) +{ +#if H5_SIZEOF_DOUBLE == H5_SIZEOF_LONG_DOUBLE + /* + * If sizeof(double)==sizeof(long double) then assume that `long double' + * isn't supported and use `double' instead. This suppresses warnings on + * some systems and `long double' is probably the same as `double' here + * anyway. + */ + DETECT_F(double, LDOUBLE, d_g[nd_g]); + nd_g++; +#else + DETECT_F(long double, LDOUBLE, d_g[nd_g]); + nd_g++; +#endif +} + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Main entry point. + * + * Return: Success: EXIT_SUCCESS + * + *------------------------------------------------------------------------- + */ +int HDF_NO_UBSAN +main(int argc, char *argv[]) +{ + char *fname = NULL; + FILE *f; /* temporary holding place for the stream pointer + * so that rawoutstream is changed only when succeeded */ + + if (argc > 1) + fname = argv[1]; + + /* First check if filename is string "NULL" */ + if (fname != NULL) { + /* binary output */ + if ((f = fopen(fname, "w")) != NULL) + rawoutstream = f; + } + if (!rawoutstream) + rawoutstream = stdout; + + print_header(); + + /* C89 floating point types */ + detect_C89_floats(); + + /* C99 floating point types */ + detect_C99_floats(); + + print_results(nd_g, d_g); + + if (rawoutstream && rawoutstream != stdout) { + if (fclose(rawoutstream)) + fprintf(stderr, "closing rawoutstream"); + else + rawoutstream = NULL; + } + + return EXIT_SUCCESS; +} diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5err.txt b/externals/coda-oss/modules/drivers/hdf5/source/H5err.txt new file mode 100644 index 0000000000..fceb72618c --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5err.txt @@ -0,0 +1,294 @@ +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# 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. +# + +# This file is used to generate the various headers that are needed for the +# error API. The bin/make_err script reads in this file and creates the +# appropriate files in the src/ directory when the generated headers are out +# of date with respect to this file. +# +# Blank lines and lines beginning with '#' are ignored +# +# The format of this file is as follows: +# ,,, +# +# For example, the following sample input shows two major errors and two minor +# errors in each section: +# +# MAJOR, H5E_ARGS, Invalid arguments to routine +# MAJOR, H5E_RESOURCE, Resource unavailable +# +# SECTION, ARGS, Argument errors +# SECTION, RESOURCE, Resource errors +# +# MINOR, ARGS, H5E_UNINITIALIZED, Information is uinitialized +# MINOR, ARGS, H5E_UNSUPPORTED, Feature is unsupported +# MINOR, RESOURCE, H5E_NOSPACE, No space available for allocation +# MINOR, RESOURCE, H5E_CANTCOPY, unable to copy object +# +# The section information is just used for grouping the information in the +# files created and can have any value. They generally correspond to the +# major errors, but don't have to. The section definition for each minor error +# must come before any minor error that uses it. +# + +# Major errors +MAJOR, H5E_ARGS, Invalid arguments to routine +MAJOR, H5E_RESOURCE, Resource unavailable +MAJOR, H5E_INTERNAL, Internal error (too specific to document in detail) +MAJOR, H5E_LIB, General library infrastructure +MAJOR, H5E_FILE, File accessibility +MAJOR, H5E_IO, Low-level I/O +MAJOR, H5E_FUNC, Function entry/exit +MAJOR, H5E_ID, Object ID +MAJOR, H5E_CACHE, Object cache +MAJOR, H5E_LINK, Links +MAJOR, H5E_BTREE, B-Tree node +MAJOR, H5E_SYM, Symbol table +MAJOR, H5E_HEAP, Heap +MAJOR, H5E_OHDR, Object header +MAJOR, H5E_DATATYPE, Datatype +MAJOR, H5E_DATASPACE, Dataspace +MAJOR, H5E_DATASET, Dataset +MAJOR, H5E_STORAGE, Data storage +MAJOR, H5E_PLIST, Property lists +MAJOR, H5E_ATTR, Attribute +MAJOR, H5E_PLINE, Data filters +MAJOR, H5E_EFL, External file list +MAJOR, H5E_REFERENCE, References +MAJOR, H5E_VFL, Virtual File Layer +MAJOR, H5E_VOL, Virtual Object Layer +MAJOR, H5E_TST, Ternary Search Trees +MAJOR, H5E_RS, Reference Counted Strings +MAJOR, H5E_ERROR, Error API +MAJOR, H5E_SLIST, Skip Lists +MAJOR, H5E_FSPACE, Free Space Manager +MAJOR, H5E_SOHM, Shared Object Header Messages +MAJOR, H5E_EARRAY, Extensible Array +MAJOR, H5E_FARRAY, Fixed Array +MAJOR, H5E_PLUGIN, Plugin for dynamically loaded library +MAJOR, H5E_PAGEBUF, Page Buffering +MAJOR, H5E_CONTEXT, API Context +MAJOR, H5E_MAP, Map +MAJOR, H5E_EVENTSET, Event Set +MAJOR, H5E_NONE_MAJOR, No error + +# Sections (for grouping minor errors) +SECTION, ARGS, Argument errors +SECTION, RESOURCE, Resource errors +SECTION, FILEACC, File accessibility errors +SECTION, FILE, Generic low-level file I/O errors +SECTION, FUNC, Function entry/exit interface errors +SECTION, ID, Object ID related errors +SECTION, CACHE, Cache related errors +SECTION, LINK, Link related errors +SECTION, BTREE, B-tree related errors +SECTION, OHDR, Object header related errors +SECTION, GROUP, Group related errors +SECTION, TYPECONV, Datatype conversion errors +SECTION, DSPACE, Dataspace errors +SECTION, PLIST, Property list errors +SECTION, MPI, Parallel MPI errors +SECTION, HEAP, Heap errors +SECTION, FSPACE, Free space errors +SECTION, PIPELINE, I/O pipeline errors +SECTION, SYSTEM, System level errors +SECTION, PLUGIN, Plugin errors +SECTION, MAP, Map related errors +SECTION, ASYNC, Asynchronous operation errors +SECTION, NONE, No error + +# Minor errors + +# Argument errors +MINOR, ARGS, H5E_UNINITIALIZED, Information is uinitialized +MINOR, ARGS, H5E_UNSUPPORTED, Feature is unsupported +MINOR, ARGS, H5E_BADTYPE, Inappropriate type +MINOR, ARGS, H5E_BADRANGE, Out of range +MINOR, ARGS, H5E_BADVALUE, Bad value + +# Resource errors +MINOR, RESOURCE, H5E_NOSPACE, No space available for allocation +MINOR, RESOURCE, H5E_CANTALLOC, Can't allocate space +MINOR, RESOURCE, H5E_CANTCOPY, Unable to copy object +MINOR, RESOURCE, H5E_CANTFREE, Unable to free object +MINOR, RESOURCE, H5E_ALREADYEXISTS, Object already exists +MINOR, RESOURCE, H5E_CANTLOCK, Unable to lock object +MINOR, RESOURCE, H5E_CANTUNLOCK, Unable to unlock object +MINOR, RESOURCE, H5E_CANTGC, Unable to garbage collect +MINOR, RESOURCE, H5E_CANTGETSIZE, Unable to compute size +MINOR, RESOURCE, H5E_OBJOPEN, Object is already open + +# File accessibility errors +MINOR, FILEACC, H5E_FILEEXISTS, File already exists +MINOR, FILEACC, H5E_FILEOPEN, File already open +MINOR, FILEACC, H5E_CANTCREATE, Unable to create file +MINOR, FILEACC, H5E_CANTOPENFILE, Unable to open file +MINOR, FILEACC, H5E_CANTCLOSEFILE, Unable to close file +MINOR, FILEACC, H5E_NOTHDF5, Not an HDF5 file +MINOR, FILEACC, H5E_BADFILE, Bad file ID accessed +MINOR, FILEACC, H5E_TRUNCATED, File has been truncated +MINOR, FILEACC, H5E_MOUNT, File mount error +MINOR, FILEACC, H5E_UNMOUNT, File unmount error +MINOR, FILEACC, H5E_CANTDELETEFILE, Unable to delete file +MINOR, FILEACC, H5E_CANTLOCKFILE, Unable to lock file +MINOR, FILEACC, H5E_CANTUNLOCKFILE, Unable to unlock file + +# Generic low-level file I/O errors +MINOR, FILE, H5E_SEEKERROR, Seek failed +MINOR, FILE, H5E_READERROR, Read failed +MINOR, FILE, H5E_WRITEERROR, Write failed +MINOR, FILE, H5E_CLOSEERROR, Close failed +MINOR, FILE, H5E_OVERFLOW, Address overflowed +MINOR, FILE, H5E_FCNTL, File control (fcntl) failed + +# Function entry/exit interface errors +MINOR, FUNC, H5E_CANTINIT, Unable to initialize object +MINOR, FUNC, H5E_ALREADYINIT, Object already initialized +MINOR, FUNC, H5E_CANTRELEASE, Unable to release object + +# Object ID related errors +MINOR, ID, H5E_BADID, Unable to find ID information (already closed?) +MINOR, ID, H5E_BADGROUP, Unable to find ID group information +MINOR, ID, H5E_CANTREGISTER, Unable to register new ID +MINOR, ID, H5E_CANTINC, Unable to increment reference count +MINOR, ID, H5E_CANTDEC, Unable to decrement reference count +MINOR, ID, H5E_NOIDS, Out of IDs for group + +# Cache related errors +MINOR, CACHE, H5E_CANTFLUSH, Unable to flush data from cache +MINOR, CACHE, H5E_CANTUNSERIALIZE, Unable to mark metadata as unserialized +MINOR, CACHE, H5E_CANTSERIALIZE, Unable to serialize data from cache +MINOR, CACHE, H5E_CANTTAG, Unable to tag metadata in the cache +MINOR, CACHE, H5E_CANTLOAD, Unable to load metadata into cache +MINOR, CACHE, H5E_PROTECT, Protected metadata error +MINOR, CACHE, H5E_NOTCACHED, Metadata not currently cached +MINOR, CACHE, H5E_SYSTEM, Internal error detected +MINOR, CACHE, H5E_CANTINS, Unable to insert metadata into cache +MINOR, CACHE, H5E_CANTPROTECT, Unable to protect metadata +MINOR, CACHE, H5E_CANTUNPROTECT, Unable to unprotect metadata +MINOR, CACHE, H5E_CANTPIN, Unable to pin cache entry +MINOR, CACHE, H5E_CANTUNPIN, Unable to un-pin cache entry +MINOR, CACHE, H5E_CANTMARKDIRTY, Unable to mark a pinned entry as dirty +MINOR, CACHE, H5E_CANTMARKCLEAN, Unable to mark a pinned entry as clean +MINOR, CACHE, H5E_CANTMARKUNSERIALIZED, Unable to mark an entry as unserialized +MINOR, CACHE, H5E_CANTMARKSERIALIZED, Unable to mark an entry as serialized +MINOR, CACHE, H5E_CANTDIRTY, Unable to mark metadata as dirty +MINOR, CACHE, H5E_CANTCLEAN, Unable to mark metadata as clean +MINOR, CACHE, H5E_CANTEXPUNGE, Unable to expunge a metadata cache entry +MINOR, CACHE, H5E_CANTRESIZE, Unable to resize a metadata cache entry +MINOR, CACHE, H5E_CANTDEPEND, Unable to create a flush dependency +MINOR, CACHE, H5E_CANTUNDEPEND, Unable to destroy a flush dependency +MINOR, CACHE, H5E_CANTNOTIFY, Unable to notify object about action +MINOR, CACHE, H5E_LOGGING, Failure in the cache logging framework +MINOR, CACHE, H5E_CANTCORK, Unable to cork an object +MINOR, CACHE, H5E_CANTUNCORK, Unable to uncork an object + +# B-tree related errors +MINOR, BTREE, H5E_NOTFOUND, Object not found +MINOR, BTREE, H5E_EXISTS, Object already exists +MINOR, BTREE, H5E_CANTENCODE, Unable to encode value +MINOR, BTREE, H5E_CANTDECODE, Unable to decode value +MINOR, BTREE, H5E_CANTSPLIT, Unable to split node +MINOR, BTREE, H5E_CANTREDISTRIBUTE, Unable to redistribute records +MINOR, BTREE, H5E_CANTSWAP, Unable to swap records +MINOR, BTREE, H5E_CANTINSERT, Unable to insert object +MINOR, BTREE, H5E_CANTLIST, Unable to list node +MINOR, BTREE, H5E_CANTMODIFY, Unable to modify record +MINOR, BTREE, H5E_CANTREMOVE, Unable to remove object +MINOR, BTREE, H5E_CANTFIND, Unable to check for record + +# Object header related errors +MINOR, OHDR, H5E_LINKCOUNT, Bad object header link count +MINOR, OHDR, H5E_VERSION, Wrong version number +MINOR, OHDR, H5E_ALIGNMENT, Alignment error +MINOR, OHDR, H5E_BADMESG, Unrecognized message +MINOR, OHDR, H5E_CANTDELETE, Can't delete message +MINOR, OHDR, H5E_BADITER, Iteration failed +MINOR, OHDR, H5E_CANTPACK, Can't pack messages +MINOR, OHDR, H5E_CANTRESET, Can't reset object +MINOR, OHDR, H5E_CANTRENAME, Unable to rename object + +# Group related errors +MINOR, GROUP, H5E_CANTOPENOBJ, Can't open object +MINOR, GROUP, H5E_CANTCLOSEOBJ, Can't close object +MINOR, GROUP, H5E_COMPLEN, Name component is too long +MINOR, GROUP, H5E_PATH, Problem with path to object + +# Datatype conversion errors +MINOR, TYPECONV, H5E_CANTCONVERT, Can't convert datatypes +MINOR, TYPECONV, H5E_BADSIZE, Bad size for object + +# Dataspace errors +MINOR, DSPACE, H5E_CANTCLIP, Can't clip hyperslab region +MINOR, DSPACE, H5E_CANTCOUNT, Can't count elements +MINOR, DSPACE, H5E_CANTSELECT, Can't select hyperslab +MINOR, DSPACE, H5E_CANTNEXT, Can't move to next iterator location +MINOR, DSPACE, H5E_BADSELECT, Invalid selection +MINOR, DSPACE, H5E_CANTCOMPARE, Can't compare objects +MINOR, DSPACE, H5E_INCONSISTENTSTATE, Internal states are inconsistent +MINOR, DSPACE, H5E_CANTAPPEND, Can't append object + +# Property list errors +MINOR, PLIST, H5E_CANTGET, Can't get value +MINOR, PLIST, H5E_CANTSET, Can't set value +MINOR, PLIST, H5E_DUPCLASS, Duplicate class name in parent class +MINOR, PLIST, H5E_SETDISALLOWED, Disallowed operation + +# Link errors +MINOR, LINK, H5E_TRAVERSE, Link traversal failure +MINOR, LINK, H5E_NLINKS, Too many soft links in path +MINOR, LINK, H5E_NOTREGISTERED, Link class not registered +MINOR, LINK, H5E_CANTMOVE, Can't move object +MINOR, LINK, H5E_CANTSORT, Can't sort objects + +# Parallel MPI errors +MINOR, MPI, H5E_MPI, Some MPI function failed +MINOR, MPI, H5E_MPIERRSTR, MPI Error String +MINOR, MPI, H5E_CANTRECV, Can't receive data +MINOR, MPI, H5E_CANTGATHER, Can't gather data +MINOR, MPI, H5E_NO_INDEPENDENT, Can't perform independent IO + +# Heap errors +MINOR, HEAP, H5E_CANTRESTORE, Can't restore condition +MINOR, HEAP, H5E_CANTCOMPUTE, Can't compute value +MINOR, HEAP, H5E_CANTEXTEND, Can't extend heap's space +MINOR, HEAP, H5E_CANTATTACH, Can't attach object +MINOR, HEAP, H5E_CANTUPDATE, Can't update object +MINOR, HEAP, H5E_CANTOPERATE, Can't operate on object + +# Free space manager errors +MINOR, FSPACE, H5E_CANTMERGE, Can't merge objects +MINOR, FSPACE, H5E_CANTREVIVE, Can't revive object +MINOR, FSPACE, H5E_CANTSHRINK, Can't shrink container + +# I/O pipeline errors +MINOR, PIPELINE, H5E_NOFILTER, Requested filter is not available +MINOR, PIPELINE, H5E_CALLBACK, Callback failed +MINOR, PIPELINE, H5E_CANAPPLY, Error from filter 'can apply' callback +MINOR, PIPELINE, H5E_SETLOCAL, Error from filter 'set local' callback +MINOR, PIPELINE, H5E_NOENCODER, Filter present but encoding disabled +MINOR, PIPELINE, H5E_CANTFILTER, Filter operation failed + +# System level errors +MINOR, SYSTEM, H5E_SYSERRSTR, System error message + +# Plugin errors +MINOR, PLUGIN, H5E_OPENERROR, Can't open directory or file + +# Map related errors +MINOR, MAP, H5E_CANTPUT, Can't put value + +# Asynchronous operation errors +MINOR, ASYNC, H5E_CANTWAIT, Can't wait on operation +MINOR, ASYNC, H5E_CANTCANCEL, Can't cancel operation + +# No error, for backward compatibility */ +MINOR, NONE, H5E_NONE_MINOR, No error diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings.c b/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings.c index 5d4156408d..c0408197ef 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings.c @@ -1,12 +1,12 @@ -// This file is generated as part of the build process. -// It isn't necessary different for each compiler, but that's -// probably a slightly better discriminant than OS/platform. - -// These have a ".c_" extention so the normal build process won't find them. -#if defined(_MSC_VER) -#include "H5lib_settings_MSVC.c_" -#elif defined(__GNUC__) -#include "H5lib_settings_GCC.c_" -#else -#error "Unknown compiler." -#endif +// This file is generated as part of the build process. +// It isn't necessary different for each compiler, but that's +// probably a slightly better discriminant than OS/platform. + +// These have a ".c_" extension so the normal build process won't find them. +#if defined(_MSC_VER) +#include "H5lib_settings_MSVC.c_" +#elif defined(__GNUC__) +#include "H5lib_settings_GCC.c_" +#else +#error "Unknown compiler." +#endif \ No newline at end of file diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings_GCC.c_ b/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings_GCC.c_ index c58a5089a9..33e0c3a96c 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings_GCC.c_ +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings_GCC.c_ @@ -4,7 +4,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,14 +13,12 @@ * If you do not have access to either file, you may request a copy from * * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Created: Sep 14, 2022 - * J.Daniel Smith + * Created: Aug 17, 2023 + * Dan Smith * * Purpose: This machine-generated source code contains * information about the library build configuration * - * Modifications: - * * DO NOT MAKE MODIFICATIONS TO THIS FILE! * It was generated by code in `H5make_libsettings.c'. * @@ -33,23 +30,23 @@ H5_GCC_DIAG_OFF("larger-than=") H5_CLANG_DIAG_OFF("overlength-strings") -char H5libhdf5_settings[]= +const char H5libhdf5_settings[]= " SUMMARY OF THE HDF5 CONFIGURATION\n" " =================================\n" "\n" "General Information:\n" "-------------------\n" - " HDF5 Version: 1.13.2\n" - " Configured on: 2022-09-14\n" + " HDF5 Version: 1.14.2\n" + " Configured on: 2023-08-17\n" " Configured by: Unix Makefiles\n" - " Host system: Linux-3.10.0-1160.49.1.el7.x86_64\n" + " Host system: Linux-3.10.0-1160.88.1.el7.x86_64\n" " Uname information: Linux\n" " Byte sex: little-endian\n" - " Installation point: /usr/local/HDF_Group/HDF5/1.13.2\n" + " Installation point: /usr/local/HDF_Group/HDF5/1.14.2\n" "\n" "Compiling Options:\n" "------------------\n" - " Build Mode: RelWithDebInfo\n" + " Build Mode: Release\n" " Debugging Symbols: OFF\n" " Asserts: OFF\n" " Profiling: OFF\n" @@ -64,6 +61,7 @@ char H5libhdf5_settings[]= " AM_LDFLAGS: \n" " Extra libraries: m;dl\n" " Archiver: /bin/ar\n" + " AR_FLAGS: \n" " Ranlib: /bin/ranlib\n" "\n" "Languages:\n" @@ -76,7 +74,7 @@ char H5libhdf5_settings[]= " CFLAGS: -std=c99 -fstdarg-opt -fmessage-length=0\n" " H5_CFLAGS: -Wall;-Wcast-qual;-Wconversion;-Wextra;-Wfloat-equal;-Wformat=2;-Winit-self;-Winvalid-pch;-Wmissing-include-dirs;-Wshadow;-Wundef;-Wwrite-strings;-pedantic;-Wno-c++-compat;-Wbad-function-cast;-Wcast-align;-Wformat;-Wimplicit-function-declaration;-Wint-to-pointer-cast;-Wmissing-declarations;-Wmissing-prototypes;-Wnested-externs;-Wold-style-definition;-Wpacked;-Wpointer-sign;-Wpointer-to-int-cast;-Wredundant-decls;-Wstrict-prototypes;-Wswitch;-Wunused-but-set-variable;-Wunused-variable;-Wunused-function;-Wunused-parameter;-finline-functions;-Wno-aggregate-return;-Wno-inline;-Wno-missing-format-attribute;-Wno-missing-noreturn;-Wno-overlength-strings;-Wlarger-than=2560;-Wlogical-op;-Wframe-larger-than=16384;-Wpacked-bitfield-compat;-Wsync-nand;-Wno-unsuffixed-float-constants;-Wdouble-promotion;-Wtrampolines;-Wstack-usage=8192;-Wmaybe-uninitialized;-Wno-jump-misses-init;-Wstrict-overflow=2;-Wno-suggest-attribute=const;-Wno-suggest-attribute=noreturn;-Wno-suggest-attribute=pure;-Wno-suggest-attribute=format;-Wdate-time;-Warray-bounds=2;-Wc99-c11-compat;-Wincompatible-pointer-types;-Wint-conversion;-Wshadow;-Wduplicated-cond;-Whsa;-Wnormalized;-Wnull-dereference;-Wunused-const-variable;-Walloca;-Walloc-zero;-Wduplicated-branches;-Wformat-overflow=2;-Wformat-truncation=1;-Wrestrict;-Wattribute-alias;-Wcast-align=strict;-Wshift-overflow=2;-Wcast-function-type;-Wmaybe-uninitialized;-Wno-suggest-attribute=cold;-Wno-suggest-attribute=malloc;-Wattribute-alias=2;-Wmissing-profile\n" " AM_CFLAGS: \n" - " Shared C Library: NO\n" + " Shared C Library: YES\n" " Static C Library: YES\n" "\n" " Fortran: OFF\n" @@ -84,19 +82,20 @@ char H5libhdf5_settings[]= " Fortran Flags: \n" " H5 Fortran Flags: \n" " AM Fortran Flags: \n" - " Shared Fortran Library: NO\n" + " Shared Fortran Library: YES\n" " Static Fortran Library: YES\n" + " Module Directory: /corp/SST/jdsmith/xdata1/coda-oss/modules/drivers/hdf5/hdf5-hdf5-1_14_2/out/mod\n" "\n" " C++: OFF\n" " C++ Compiler: \n" " C++ Flags: \n" " H5 C++ Flags: \n" " AM C++ Flags: \n" - " Shared C++ Library: NO\n" + " Shared C++ Library: YES\n" " Static C++ Library: YES\n" "\n" - " JAVA: OFF\n" - " JAVA Compiler: \n" + " JAVA: OFF\n" + " JAVA Compiler: \n" "\n" "Features:\n" "---------\n" @@ -107,22 +106,20 @@ char H5libhdf5_settings[]= "Dimension scales w/ new references: \n" " Build HDF5 Tests: ON\n" " Build HDF5 Tools: ON\n" - " Build High-level HDF5 Tools: ON\n" + " Build GIF Tools: OFF\n" " Threadsafety: OFF\n" " Default API mapping: v114\n" " With deprecated public symbols: ON\n" - " I/O filters (external): \n" - " MPE: \n" + " I/O filters (external): DEFLATE\n" + " Map (H5M) API: \n" " Direct VFD: \n" " Mirror VFD: \n" " Subfiling VFD: \n" " (Read-Only) S3 VFD: \n" " (Read-Only) HDFS VFD: \n" - " dmalloc: \n" " Packages w/ extra debug output: \n" " API Tracing: OFF\n" " Using memory checker: OFF\n" - " Memory allocation sanity checks: OFF\n" " Function Stack Tracing: OFF\n" " Use file locking: best-effort\n" " Strict File Format Checks: OFF\n" diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings_MSVC.c_ b/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings_MSVC.c_ index a3b0506951..f3c6c933f0 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings_MSVC.c_ +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5lib_settings_MSVC.c_ @@ -1,133 +1,130 @@ -/* Generated automatically by H5make_libsettings -- do not edit */ - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the COPYING file, which can be found at the root of the source code * - * 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: Sep 14, 2022 - * - * - * Purpose: This machine-generated source code contains - * information about the library build configuration - * - * Modifications: - * - * DO NOT MAKE MODIFICATIONS TO THIS FILE! - * It was generated by code in `H5make_libsettings.c'. - * - *------------------------------------------------------------------------- - */ - -#include "H5private.h" -H5_GCC_DIAG_OFF("larger-than=") - -H5_CLANG_DIAG_OFF("overlength-strings") - -char H5libhdf5_settings[]= - " SUMMARY OF THE HDF5 CONFIGURATION\n" - " =================================\n" - "\n" - "General Information:\n" - "-------------------\n" - " HDF5 Version: 1.13.2\n" - " Configured on: 2022-09-14\n" - " Configured by: Visual Studio 17 2022\n" - " Host system: Windows-10.0.19044\n" - " Uname information: Windows\n" - " Byte sex: little-endian\n" - " Installation point: C:/Program Files/HDF_Group/HDF5/1.13.2\n" - "\n" - "Compiling Options:\n" - "------------------\n" - " Build Mode: \n" - " Debugging Symbols: OFF\n" - " Asserts: OFF\n" - " Profiling: OFF\n" - " Optimization Level: OFF\n" - "\n" - "Linking Options:\n" - "----------------\n" - " Libraries: \n" - " Statically Linked Executables: OFF\n" - " LDFLAGS: /machine:x64\n" - " H5_LDFLAGS: \n" - " AM_LDFLAGS: \n" - " Extra libraries: \n" - " Archiver: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/lib.exe\n" - " Ranlib: :\n" - "\n" - "Languages:\n" - "----------\n" - " C: YES\n" - " C Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe 19.33.31629.0\n" - " CPPFLAGS: \n" - " H5_CPPFLAGS: \n" - " AM_CPPFLAGS: \n" - " CFLAGS: /DWIN32 /D_WINDOWS -wd5105\n" - " H5_CFLAGS: /W3;/wd4100;/wd4706;/wd4127\n" - " AM_CFLAGS: \n" - " Shared C Library: NO\n" - " Static C Library: YES\n" - "\n" - " Fortran: OFF\n" - " Fortran Compiler: \n" - " Fortran Flags: \n" - " H5 Fortran Flags: \n" - " AM Fortran Flags: \n" - " Shared Fortran Library: NO\n" - " Static Fortran Library: YES\n" - "\n" - " C++: OFF\n" - " C++ Compiler: \n" - " C++ Flags: \n" - " H5 C++ Flags: \n" - " AM C++ Flags: \n" - " Shared C++ Library: NO\n" - " Static C++ Library: YES\n" - "\n" - " JAVA: OFF\n" - " JAVA Compiler: \n" - "\n" - "Features:\n" - "---------\n" - " Parallel HDF5: OFF\n" - " Parallel Filtered Dataset Writes: \n" - " Large Parallel I/O: \n" - " High-level library: ON\n" - "Dimension scales w/ new references: \n" - " Build HDF5 Tests: ON\n" - " Build HDF5 Tools: ON\n" - " Build High-level HDF5 Tools: ON\n" - " Threadsafety: OFF\n" - " Default API mapping: v114\n" - " With deprecated public symbols: ON\n" - " I/O filters (external): \n" - " MPE: \n" - " Direct VFD: \n" - " Mirror VFD: \n" - " Subfiling VFD: \n" - " (Read-Only) S3 VFD: \n" - " (Read-Only) HDFS VFD: \n" - " dmalloc: \n" - " Packages w/ extra debug output: \n" - " API Tracing: OFF\n" - " Using memory checker: OFF\n" - " Memory allocation sanity checks: OFF\n" - " Function Stack Tracing: OFF\n" - " Use file locking: best-effort\n" - " Strict File Format Checks: OFF\n" - " Optimization Instrumentation: \n" -; - -H5_GCC_DIAG_ON("larger-than=") -H5_CLANG_DIAG_OFF("overlength-strings") +/* Generated automatically by H5make_libsettings -- do not edit */ + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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: Aug 16, 2023 + * + * + * Purpose: This machine-generated source code contains + * information about the library build configuration + * + * DO NOT MAKE MODIFICATIONS TO THIS FILE! + * It was generated by code in `H5make_libsettings.c'. + * + *------------------------------------------------------------------------- + */ + +#include "H5private.h" +H5_GCC_DIAG_OFF("larger-than=") + +H5_CLANG_DIAG_OFF("overlength-strings") + +const char H5libhdf5_settings[]= + " SUMMARY OF THE HDF5 CONFIGURATION\n" + " =================================\n" + "\n" + "General Information:\n" + "-------------------\n" + " HDF5 Version: 1.14.2\n" + " Configured on: 2023-08-16\n" + " Configured by: Ninja\n" + " Host system: Windows-10.0.19045\n" + " Uname information: Windows\n" + " Byte sex: little-endian\n" + " Installation point: C:/Users/jdsmith/source/repos/coda-oss/modules/drivers/hdf5/hdf5-hdf5-1_14_2/out/install/x64-debug\n" + "\n" + "Compiling Options:\n" + "------------------\n" + " Build Mode: Debug\n" + " Debugging Symbols: OFF\n" + " Asserts: OFF\n" + " Profiling: OFF\n" + " Optimization Level: OFF\n" + "\n" + "Linking Options:\n" + "----------------\n" + " Libraries: \n" + " Statically Linked Executables: OFF\n" + " LDFLAGS: /machine:x64\n" + " H5_LDFLAGS: \n" + " AM_LDFLAGS: \n" + " Extra libraries: shlwapi\n" + " Archiver: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/lib.exe\n" + " AR_FLAGS: \n" + " Ranlib: :\n" + "\n" + "Languages:\n" + "----------\n" + " C: YES\n" + " C Compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.33.31629/bin/Hostx64/x64/cl.exe 19.33.31630.0\n" + " CPPFLAGS: \n" + " H5_CPPFLAGS: \n" + " AM_CPPFLAGS: \n" + " CFLAGS: /DWIN32 /D_WINDOWS -wd5105\n" + " H5_CFLAGS: /W3;/wd4100;/wd4706;/wd4127\n" + " AM_CFLAGS: \n" + " Shared C Library: YES\n" + " Static C Library: YES\n" + "\n" + " Fortran: OFF\n" + " Fortran Compiler: \n" + " Fortran Flags: \n" + " H5 Fortran Flags: \n" + " AM Fortran Flags: \n" + " Shared Fortran Library: YES\n" + " Static Fortran Library: YES\n" + " Module Directory: C:/Users/jdsmith/source/repos/coda-oss/modules/drivers/hdf5/hdf5-hdf5-1_14_2/out/build/x64-debug/mod\n" + "\n" + " C++: OFF\n" + " C++ Compiler: cl.exe \n" + " C++ Flags: \n" + " H5 C++ Flags: \n" + " AM C++ Flags: \n" + " Shared C++ Library: YES\n" + " Static C++ Library: YES\n" + "\n" + " JAVA: OFF\n" + " JAVA Compiler: \n" + "\n" + "Features:\n" + "---------\n" + " Parallel HDF5: OFF\n" + " Parallel Filtered Dataset Writes: \n" + " Large Parallel I/O: \n" + " High-level library: ON\n" + "Dimension scales w/ new references: \n" + " Build HDF5 Tests: ON\n" + " Build HDF5 Tools: ON\n" + " Build GIF Tools: OFF\n" + " Threadsafety: OFF\n" + " Default API mapping: v114\n" + " With deprecated public symbols: ON\n" + " I/O filters (external): \n" + " Map (H5M) API: \n" + " Direct VFD: \n" + " Mirror VFD: \n" + " Subfiling VFD: \n" + " (Read-Only) S3 VFD: \n" + " (Read-Only) HDFS VFD: \n" + " Packages w/ extra debug output: \n" + " API Tracing: OFF\n" + " Using memory checker: OFF\n" + " Function Stack Tracing: OFF\n" + " Use file locking: best-effort\n" + " Strict File Format Checks: OFF\n" + " Optimization Instrumentation: \n" +; + +H5_GCC_DIAG_ON("larger-than=") +H5_CLANG_DIAG_OFF("overlength-strings") diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5mpi.c b/externals/coda-oss/modules/drivers/hdf5/source/H5mpi.c index e95b590140..8fd7252527 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5mpi.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5mpi.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -44,8 +43,6 @@ static hsize_t bigio_count_g = H5_MAX_MPI_COUNT; * * Return: The current/previous value of bigio_count_g. * - * Programmer: Richard Warren, March 10, 2017 - * *------------------------------------------------------------------------- */ hsize_t @@ -67,11 +64,9 @@ H5_mpi_set_bigio_count(hsize_t new_count) * * Return: The current/previous value of bigio_count_g. * - * Programmer: Richard Warren, October 7, 2019 - * *------------------------------------------------------------------------- */ -hsize_t +H5_ATTR_PURE hsize_t H5_mpi_get_bigio_count(void) { return bigio_count_g; @@ -102,7 +97,7 @@ H5_mpi_comm_dup(MPI_Comm comm, MPI_Comm *comm_new) /* Check arguments */ if (!comm_new) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm_new cannot be NULL") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm_new cannot be NULL"); /* Handle MPI_COMM_NULL separately */ if (MPI_COMM_NULL == comm) { @@ -161,7 +156,7 @@ H5_mpi_info_dup(MPI_Info info, MPI_Info *info_new) /* Check arguments */ if (!info_new) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "info_new cannot be NULL") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "info_new cannot be NULL"); /* Duplicate the MPI info */ if (info == MPI_INFO_NULL) { @@ -207,7 +202,7 @@ H5_mpi_comm_free(MPI_Comm *comm) /* Check arguments */ if (!comm) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm pointer cannot be NULL") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "comm pointer cannot be NULL"); /* Free the communicator */ if (MPI_COMM_WORLD != *comm && MPI_COMM_NULL != *comm) @@ -239,7 +234,7 @@ H5_mpi_info_free(MPI_Info *info) /* Check arguments */ if (!info) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "info pointer cannot be NULL") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "info pointer cannot be NULL"); /* Free the info */ if (MPI_INFO_NULL != *info) @@ -282,7 +277,7 @@ H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result) /* Check arguments */ if (!result) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "result cannot be NULL") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "result cannot be NULL"); /* Set out parameter to something reasonable in case something goes wrong */ *result = 0; @@ -350,7 +345,7 @@ H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result) /* Check arguments */ if (!result) - HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "result cannot be NULL") + HGOTO_ERROR(H5E_INTERNAL, H5E_BADVALUE, FAIL, "result cannot be NULL"); /* Check for MPI_INFO_NULL */ if (MPI_INFO_NULL == info1 && MPI_INFO_NULL == info2) { @@ -384,11 +379,11 @@ H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result) /* Allocate buffers for iteration */ if (NULL == (key = (char *)H5MM_malloc(MPI_MAX_INFO_KEY * sizeof(char)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); if (NULL == (value1 = (char *)H5MM_malloc(MPI_MAX_INFO_VAL * sizeof(char)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); if (NULL == (value2 = (char *)H5MM_malloc(MPI_MAX_INFO_VAL * sizeof(char)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); /* Iterate over the keys, comparing them */ for (i = 0; i < nkeys_1; i++) { @@ -396,9 +391,9 @@ H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result) same = TRUE; /* Memset the buffers to zero */ - HDmemset(key, 0, MPI_MAX_INFO_KEY); - HDmemset(value1, 0, MPI_MAX_INFO_VAL); - HDmemset(value2, 0, MPI_MAX_INFO_VAL); + memset(key, 0, MPI_MAX_INFO_KEY); + memset(value1, 0, MPI_MAX_INFO_VAL); + memset(value2, 0, MPI_MAX_INFO_VAL); /* Get the nth key */ if (MPI_SUCCESS != (mpi_code = MPI_Info_get_nthkey(info1, i, key))) @@ -411,7 +406,7 @@ H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result) HMPI_GOTO_ERROR(FAIL, "MPI_Info_get failed", mpi_code) /* Compare values and flags */ - if (!flag1 || !flag2 || HDmemcmp(value1, value2, MPI_MAX_INFO_VAL)) { + if (!flag1 || !flag2 || memcmp(value1, value2, MPI_MAX_INFO_VAL)) { same = FALSE; break; } @@ -451,8 +446,6 @@ H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result) * * *new_type the new datatype created * - * Programmer: Mohamad Chaarawi - * *------------------------------------------------------------------------- */ herr_t @@ -640,9 +633,9 @@ H5_mpio_gatherv_alloc(void *send_buf, int send_count, MPI_Datatype send_type, co FUNC_ENTER_NOAPI(FAIL) - HDassert(send_buf || send_count == 0); + assert(send_buf || send_count == 0); if (allgather || (mpi_rank == root)) - HDassert(out_buf && out_buf_num_entries); + assert(out_buf && out_buf_num_entries); /* Retrieve the extent of the MPI Datatype being used */ #if H5_CHECK_MPI_VERSION(3, 0) @@ -653,7 +646,7 @@ H5_mpio_gatherv_alloc(void *send_buf, int send_count, MPI_Datatype send_type, co HMPI_GOTO_ERROR(FAIL, "MPI_Type_get_extent(_x) failed", mpi_code) if (type_extent < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "MPI recv_type had a negative extent") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "MPI recv_type had a negative extent"); /* * Calculate the total size of the buffer being @@ -669,11 +662,11 @@ H5_mpio_gatherv_alloc(void *send_buf, int send_count, MPI_Datatype send_type, co /* If our buffer size is 0, there's nothing to do */ if (buf_size == 0) - HGOTO_DONE(SUCCEED) + HGOTO_DONE(SUCCEED); if (NULL == (recv_buf = H5MM_malloc(buf_size))) /* Push an error, but still participate in collective gather operation */ - HDONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate receive buffer") + HDONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't allocate receive buffer"); } /* Perform gather operation */ @@ -726,9 +719,9 @@ H5_mpio_gatherv_alloc_simple(void *send_buf, int send_count, MPI_Datatype send_t FUNC_ENTER_NOAPI(FAIL) - HDassert(send_buf || send_count == 0); + assert(send_buf || send_count == 0); if (allgather || (mpi_rank == root)) - HDassert(out_buf && out_buf_num_entries); + assert(out_buf && out_buf_num_entries); /* * Allocate array to store the receive counts of each rank, as well as @@ -742,7 +735,7 @@ H5_mpio_gatherv_alloc_simple(void *send_buf, int send_count, MPI_Datatype send_t (recv_counts_disps_array = H5MM_malloc(2 * (size_t)mpi_size * sizeof(*recv_counts_disps_array)))) /* Push an error, but still participate in collective gather operation */ HDONE_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, - "couldn't allocate receive counts and displacements array") + "couldn't allocate receive counts and displacements array"); } /* Collect each rank's send count to interested ranks */ @@ -773,7 +766,7 @@ H5_mpio_gatherv_alloc_simple(void *send_buf, int send_count, MPI_Datatype send_t if (H5_mpio_gatherv_alloc(send_buf, send_count, send_type, recv_counts_disps_array, &recv_counts_disps_array[mpi_size], recv_type, allgather, root, comm, mpi_rank, mpi_size, out_buf, out_buf_num_entries) < 0) - HGOTO_ERROR(H5E_LIB, H5E_CANTGATHER, FAIL, "can't gather data") + HGOTO_ERROR(H5E_LIB, H5E_CANTGATHER, FAIL, "can't gather data"); done: if (recv_counts_disps_array) @@ -795,8 +788,6 @@ H5_mpio_gatherv_alloc_simple(void *send_buf, int send_count, MPI_Datatype send_t * * Return: Non-negative on success/Negative on failure * - * Programmer: Houjun Tang, April 7, 2022 - * *------------------------------------------------------------------------- */ herr_t @@ -804,30 +795,31 @@ H5_mpio_get_file_sync_required(MPI_File fh, hbool_t *file_sync_required) { MPI_Info info_used; int flag; + char *sync_env_var; char value[MPI_MAX_INFO_VAL]; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI(FAIL) - HDassert(file_sync_required); + assert(file_sync_required); *file_sync_required = FALSE; if (MPI_SUCCESS != MPI_File_get_info(fh, &info_used)) - HGOTO_ERROR(H5E_LIB, H5E_CANTGET, FAIL, "can't get MPI info") + HGOTO_ERROR(H5E_LIB, H5E_CANTGET, FAIL, "can't get MPI info"); if (MPI_SUCCESS != MPI_Info_get(info_used, "romio_visibility_immediate", MPI_MAX_INFO_VAL - 1, value, &flag)) - HGOTO_ERROR(H5E_LIB, H5E_CANTGET, FAIL, "can't get MPI info") + HGOTO_ERROR(H5E_LIB, H5E_CANTGET, FAIL, "can't get MPI info"); if (flag && !HDstrcmp(value, "false")) *file_sync_required = TRUE; if (MPI_SUCCESS != MPI_Info_free(&info_used)) - HGOTO_ERROR(H5E_LIB, H5E_CANTFREE, FAIL, "can't free MPI info") + HGOTO_ERROR(H5E_LIB, H5E_CANTFREE, FAIL, "can't free MPI info"); /* Force setting the flag via env variable (temp solution before the flag is implemented in MPI) */ - char *sync_env_var = HDgetenv("HDF5_DO_MPI_FILE_SYNC"); + sync_env_var = HDgetenv("HDF5_DO_MPI_FILE_SYNC"); if (sync_env_var && (!HDstrcmp(sync_env_var, "TRUE") || !HDstrcmp(sync_env_var, "1"))) *file_sync_required = TRUE; if (sync_env_var && (!HDstrcmp(sync_env_var, "FALSE") || !HDstrcmp(sync_env_var, "0"))) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5overflow.txt b/externals/coda-oss/modules/drivers/hdf5/source/H5overflow.txt new file mode 100644 index 0000000000..87c5151298 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5overflow.txt @@ -0,0 +1,43 @@ +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# 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. +# + +# This file is used to generate the headers that is needed for detecting +# overflows between types at run-time +# +# The bin/make_overflow script reads in this file and creates the appropriate +# file in the src/ directory when the generated header is out of date with +# respect to this file. +# +# Blank lines and lines beginning with '#' are ignored +# +# The format of this file is as follows: +# , ; +# +# Where is a valid C type (like 'int8_t', 'hssize_t', etc. and whether +# the type is signed or unsigned follows. +# + +unsigned, UNSIGNED; +int8_t, SIGNED; +int, SIGNED; +long, SIGNED; +int64_t, SIGNED; +uint8_t, UNSIGNED; +uint16_t, UNSIGNED; +uint32_t, UNSIGNED; +uint64_t, UNSIGNED; +ptrdiff_t, SIGNED; +size_t, UNSIGNED; +ssize_t, SIGNED; +haddr_t, UNSIGNED; +hsize_t, UNSIGNED; +hssize_t, SIGNED; +h5_stat_size_t, UNSIGNED; diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5system.c b/externals/coda-oss/modules/drivers/hdf5/source/H5system.c index 9a19860383..eb233bcb25 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5system.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5system.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5system.c - * Aug 21 2006 - * Quincey Koziol * * Purpose: System call wrapper implementations. * @@ -76,18 +73,18 @@ HDvasprintf(char **bufp, const char *fmt, va_list _ap) char *buf; /* buffer to receive formatted string */ size_t bufsz; /* size of buffer to allocate */ - for (bufsz = 32; (buf = HDmalloc(bufsz)) != NULL;) { + for (bufsz = 32; (buf = malloc(bufsz)) != NULL;) { int ret; va_list ap; - HDva_copy(ap, _ap); + va_copy(ap, _ap); ret = HDvsnprintf(buf, bufsz, fmt, ap); va_end(ap); if (ret >= 0 && (size_t)ret < bufsz) { *bufp = buf; return ret; } - HDfree(buf); + free(buf); if (ret < 0) return ret; bufsz = (size_t)ret + 1; @@ -110,9 +107,6 @@ HDvasprintf(char **bufp, const char *fmt, va_list _ap) * * Failure: Cannot fail. * - * Programmer: Leon Arber - * March 6, 2006. - * *------------------------------------------------------------------------- */ #ifdef H5_HAVE_RAND_R @@ -168,7 +162,7 @@ Pflock(int fd, int operation) flk.l_pid = 0; /* not used with set */ /* Lock or unlock */ - if (HDfcntl(fd, F_SETLK, &flk) < 0) + if (fcntl(fd, F_SETLK, &flk) < 0) return -1; return 0; @@ -207,9 +201,6 @@ Nflock(int H5_ATTR_UNUSED fd, int H5_ATTR_UNUSED operation) * Return: Success: The value of timezone * Failure: -1 * - * Programmer: Quincey Koziol - * November 18, 2015 - * *------------------------------------------------------------------------- */ time_t @@ -228,7 +219,7 @@ H5_make_time(struct tm *tm) FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(tm); + assert(tm); /* Initialize timezone information */ if (!H5_ntzset) { @@ -238,7 +229,7 @@ H5_make_time(struct tm *tm) /* Perform base conversion */ if ((time_t)-1 == (the_time = HDmktime(tm))) - HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCONVERT, FAIL, "badly formatted modification time message") + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCONVERT, FAIL, "badly formatted modification time message"); /* Adjust for timezones */ #if defined(H5_HAVE_TM_GMTOFF) @@ -262,7 +253,7 @@ H5_make_time(struct tm *tm) * only way a user can get the modification time is from our internal * query routines, which can gracefully recover. */ - HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "unable to obtain local timezone information") + HGOTO_ERROR(H5E_INTERNAL, H5E_UNSUPPORTED, FAIL, "unable to obtain local timezone information"); #endif /* Set return value */ @@ -293,9 +284,6 @@ H5_make_time(struct tm *tm) * Danny Smith * and released in the public domain. * - * Programmer: Scott Wegner - * May 19, 2009 - * *------------------------------------------------------------------------- */ int @@ -341,9 +329,6 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz) * Return: Success: 0 * Failure: non-zero error code * - * Programmer: Dana Robinson - * February 2016 - * *------------------------------------------------------------------------- */ int @@ -378,9 +363,6 @@ Wsetenv(const char *name, const char *value, int overwrite) * Return: Success: 0 * Failure: -1 * - * Programmer: Dana Robinson - * May 2011 - * *------------------------------------------------------------------------- */ #ifdef H5_HAVE_WIN32_API @@ -399,7 +381,7 @@ H5_get_win32_times(H5_timevals_t *tvs /*in,out*/) static hbool_t is_initialized = FALSE; BOOL err; - HDassert(tvs); + assert(tvs); if (!is_initialized) { /* NOTE: This is just a pseudo handle and does not need to be closed. */ @@ -503,9 +485,6 @@ Wflock(int fd, int operation) * This must be freed by the caller using H5MM_xfree() * Failure: NULL * - * Programmer: Dana Robinson - * Spring 2019 - * *------------------------------------------------------------------------- */ wchar_t * @@ -544,9 +523,6 @@ H5_get_utf16_str(const char *s) * Return: Success: A POSIX file descriptor * Failure: -1 * - * Programmer: Dana Robinson - * Spring 2019 - * *------------------------------------------------------------------------- */ int @@ -570,9 +546,9 @@ Wopen_utf8(const char *path, int oflag, ...) if (oflag & O_CREAT) { va_list vl; - HDva_start(vl, oflag); - pmode = HDva_arg(vl, int); - HDva_end(vl); + va_start(vl, oflag); + pmode = va_arg(vl, int); + va_end(vl); } /* Open the file */ @@ -595,9 +571,6 @@ Wopen_utf8(const char *path, int oflag, ...) * Return: Success: 0 * Failure: -1 * - * Programmer: Dana Robinson - * Spring 2019 - * *------------------------------------------------------------------------- */ int @@ -633,9 +606,6 @@ Wremove_utf8(const char *path) * * Return: SUCCEED/FAIL * - * Programmer: Vailin Choi - * April 2, 2008 - * *------------------------------------------------------------------------- */ #define MAX_PATH_LEN 1024 @@ -651,8 +621,8 @@ H5_build_extpath(const char *name, char **extpath /*out*/) FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ - HDassert(name); - HDassert(extpath); + assert(name); + assert(extpath); /* Clear external path pointer to begin with */ *extpath = NULL; @@ -663,7 +633,7 @@ H5_build_extpath(const char *name, char **extpath /*out*/) */ if (H5_CHECK_ABSOLUTE(name)) { if (NULL == (full_path = (char *)H5MM_strdup(name))) - HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed"); } /* end if */ else { /* relative pathname */ char *retcwd; @@ -671,10 +641,10 @@ H5_build_extpath(const char *name, char **extpath /*out*/) int drive; if (NULL == (cwdpath = (char *)H5MM_malloc(MAX_PATH_LEN))) - HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed"); name_len = HDstrlen(name) + 1; if (NULL == (new_name = (char *)H5MM_malloc(name_len))) - HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed"); /* * Windows: name[0-1] is ":" @@ -706,13 +676,13 @@ H5_build_extpath(const char *name, char **extpath /*out*/) size_t cwdlen; size_t path_len; - HDassert(cwdpath); + assert(cwdpath); cwdlen = HDstrlen(cwdpath); - HDassert(cwdlen); - HDassert(new_name); + assert(cwdlen); + assert(new_name); path_len = cwdlen + HDstrlen(new_name) + 2; if (NULL == (full_path = (char *)H5MM_malloc(path_len))) - HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_INTERNAL, H5E_NOSPACE, FAIL, "memory allocation failed"); HDstrncpy(full_path, cwdpath, cwdlen + 1); if (!H5_CHECK_DELIMITER(cwdpath[cwdlen - 1])) @@ -726,7 +696,7 @@ H5_build_extpath(const char *name, char **extpath /*out*/) char *ptr = NULL; H5_GET_LAST_DELIMITER(full_path, ptr) - HDassert(ptr); + assert(ptr); *++ptr = '\0'; *extpath = full_path; } /* end if */ @@ -750,8 +720,6 @@ H5_build_extpath(const char *name, char **extpath /*out*/) * * Return: SUCCEED/FAIL * - * Programmer: Steffen Kiess - * June 22, 2015 *-------------------------------------------------------------------------- */ herr_t @@ -763,7 +731,7 @@ H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/) FUNC_ENTER_NOAPI_NOINIT - HDassert(path2); + assert(path2); if (path1) path1_len = HDstrlen(path1); @@ -773,7 +741,7 @@ H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/) /* If path1 is empty or path2 is absolute, simply use path2 */ if (NULL == (*full_name = (char *)H5MM_strdup(path2))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } /* end if */ else if (H5_CHECK_ABS_PATH(path2)) { @@ -784,7 +752,7 @@ H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/) * Use the drive letter of path1 + path2 */ if (NULL == (*full_name = (char *)H5MM_malloc(path2_len + 3))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate path2 buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate path2 buffer"); HDsnprintf(*full_name, (path2_len + 3), "%c:%s", path1[0], path2); } /* end if */ else { @@ -793,7 +761,7 @@ H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/) * Use path2. */ if (NULL == (*full_name = (char *)H5MM_strdup(path2))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); } /* end else */ } /* end else if */ @@ -806,7 +774,7 @@ H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/) if (NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2 + 2))) /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */ - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer"); /* Compose the full file name */ HDsnprintf(*full_name, (path1_len + path2_len + 2 + 2), "%s%s%s", @@ -900,15 +868,15 @@ H5_expand_windows_env_vars(char **env_var) /* Allocate buffer for expanded environment variable string */ if (NULL == (temp_buf = (char *)H5MM_calloc((size_t)H5_WIN32_ENV_VAR_BUFFER_SIZE))) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for expanded path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for expanded path"); /* Expand the environment variable string */ if ((n_chars = ExpandEnvironmentStringsA(*env_var, temp_buf, H5_WIN32_ENV_VAR_BUFFER_SIZE)) > H5_WIN32_ENV_VAR_BUFFER_SIZE) - HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "expanded path is too long") + HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "expanded path is too long"); if (0 == n_chars) - HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "failed to expand path") + HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "failed to expand path"); *env_var = (char *)H5MM_xfree(*env_var); *env_var = temp_buf; @@ -948,13 +916,13 @@ H5_strndup(const char *s, size_t n) FUNC_ENTER_NOAPI_NOINIT if (!s) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "string cannot be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "string cannot be NULL"); for (len = 0; len < n && s[len] != '\0'; len++) ; if (NULL == (ret_value = H5MM_malloc(len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate buffer for string") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate buffer for string"); H5MM_memcpy(ret_value, s, len); ret_value[len] = '\0'; @@ -962,6 +930,28 @@ H5_strndup(const char *s, size_t n) done: FUNC_LEAVE_NOAPI(ret_value) } + +/*------------------------------------------------------------------------- + * Function: Wstrcasestr_wrap + * + * Purpose: Windows wrapper function for strcasestr to retain GNU + * behavior where searching for an empty substring returns the + * input string being searched. StrStrIA on Windows does not + * exhibit this same behavior. + * + * Return: Pointer to input string if 'needle' is the empty substring + * Otherwise, returns StrStrIA(haystack, needle) + * + *------------------------------------------------------------------------- + */ +char * +Wstrcasestr_wrap(const char *haystack, const char *needle) +{ + if (needle && !*needle) + return (char *)haystack; + else + return StrStrIA(haystack, needle); +} #endif /* H5_HAVE_WIN32_API */ /* dirname() and basename() are not easily ported to Windows and basename @@ -1006,9 +996,9 @@ H5_dirname(const char *path, char **dirname) FUNC_ENTER_NOAPI_NOINIT if (!path) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "path can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "path can't be NULL"); if (!dirname) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dirname can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dirname can't be NULL"); if (NULL == (sep = HDstrrchr(path, H5_DIR_SEPC))) { /* Pathname with no file separator characters */ @@ -1063,7 +1053,7 @@ H5_dirname(const char *path, char **dirname) else { /* Pathname of form "dir/filename" */ len = sep - path; - HDassert(len >= 0); + assert(len >= 0); out = H5MM_strndup(path, (size_t)len); } @@ -1115,9 +1105,9 @@ H5_basename(const char *path, char **basename) FUNC_ENTER_NOAPI_NOINIT if (!path) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "path can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "path can't be NULL"); if (!basename) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "basename can't be NULL") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "basename can't be NULL"); if (NULL == (sep = HDstrrchr(path, H5_DIR_SEPC))) { if (*path == '\0') @@ -1165,7 +1155,7 @@ H5_basename(const char *path, char **basename) c_ptr--; len = sep - c_ptr; - HDassert(len >= 0); + assert(len >= 0); out = H5MM_strndup(c_ptr, (size_t)len); } @@ -1251,7 +1241,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct } else if (l_opts[i].has_arg == require_arg) { if (H5_opterr) - HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg); + fprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg); optchar = '?'; } @@ -1260,7 +1250,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct else { if (H5_optarg) { if (H5_opterr) - HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg); + fprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg); optchar = '?'; } @@ -1269,10 +1259,10 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct } } - if (l_opts[i].name == NULL) { + if (l_opts && l_opts[i].name == NULL) { /* exhausted all of the l_opts we have and still didn't match */ if (H5_opterr) - HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); + fprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); optchar = '?'; } @@ -1280,7 +1270,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct H5_optind++; sp = 1; - HDfree(arg); + free(arg); } else { char *cp; /* pointer into current token */ @@ -1290,7 +1280,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct if (optchar == ':' || (cp = HDstrchr(opts, optchar)) == 0) { if (H5_opterr) - HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optchar); + fprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optchar); /* if no chars left in this token, move to next token */ if (argv[H5_optind][++sp] == '\0') { @@ -1308,7 +1298,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct } else if (++H5_optind >= argc) { if (H5_opterr) - HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optchar); + fprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optchar); optchar = '?'; } @@ -1350,3 +1340,42 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct /* return the current flag character found */ return optchar; } + +/*------------------------------------------------------------------------- + * Function: H5_strcasestr + * + * Purpose: Find the first occurrence of the substring needle in the + * string haystack ignoring case. + * + * Return: Success: Pointer to the beginning of the located substring + * + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +char * +H5_strcasestr(const char *haystack, const char *needle) +{ + /* Check arguments. */ + assert(haystack); + assert(needle); + + /* begin once from each character of haystack, until needle is found */ + do { + const char *h = haystack; + const char *n = needle; + /* loop while lowercase strings match, or needle ends */ + while (HDtolower(*h) == HDtolower(*n) && *n) { + h++; + n++; + } + /* if all characters in needle matched we found it */ + if (*n == 0) { + /* must discard const qualifier here, so turn off the warning */ + H5_GCC_CLANG_DIAG_OFF("cast-qual") + return (char *)haystack; + H5_GCC_CLANG_DIAG_ON("cast-qual") + } + } while (*haystack++); + return 0; +} /* end H5_strcasestr() */ diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5timer.c b/externals/coda-oss/modules/drivers/hdf5/source/H5timer.c index 83fd243303..c0a945b56d 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5timer.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5timer.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -13,8 +12,6 @@ /*------------------------------------------------------------------------- * Created: H5timer.c - * Aug 21 2006 - * Quincey Koziol * * Purpose: Internal, platform-independent 'timer' support routines. * @@ -90,9 +87,6 @@ * * Return: void * - * Programmer: Robb Matzke - * Wednesday, August 5, 1998 - * *------------------------------------------------------------------------- */ void @@ -147,9 +141,6 @@ H5_bandwidth(char *buf /*out*/, size_t bufsize, double nbytes, double nseconds) * * Return: # of seconds from the epoch (can't fail) * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 - * *------------------------------------------------------------------------- */ time_t @@ -178,9 +169,6 @@ H5_now(void) * * Return: # of microseconds from the epoch (can't fail) * - * Programmer: Quincey Koziol - * Tuesday, November 28, 2006 - * *------------------------------------------------------------------------- */ uint64_t @@ -192,7 +180,7 @@ H5_now_usec(void) { struct timespec ts; - HDclock_gettime(CLOCK_MONOTONIC, &ts); + clock_gettime(CLOCK_MONOTONIC, &ts); /* Cast all values in this expression to uint64_t to ensure that all intermediate * calculations are done in 64 bit, to prevent overflow */ @@ -226,8 +214,6 @@ H5_now_usec(void) * Return: Success: A non-negative time value * Failure: -1.0 (in theory, can't currently fail) * - * Programmer: Quincey Koziol - * October 05, 2016 *-------------------------------------------------------------------------- */ double @@ -241,7 +227,7 @@ H5_get_time(void) { struct timespec ts; - HDclock_gettime(CLOCK_MONOTONIC, &ts); + clock_gettime(CLOCK_MONOTONIC, &ts); ret_value = (double)ts.tv_sec + ((double)ts.tv_nsec / 1000000000.0); } #elif defined(H5_HAVE_GETTIMEOFDAY) @@ -267,16 +253,13 @@ H5_get_time(void) * Return: Success: 0 * Failure: -1 * - * Programmer: Dana Robinson - * May 2011 - * *------------------------------------------------------------------------- */ static herr_t H5__timer_get_timevals(H5_timevals_t *times /*in,out*/) { /* Sanity check */ - HDassert(times); + assert(times); /* Windows call handles both system/user and elapsed times */ #ifdef H5_HAVE_WIN32_API @@ -296,7 +279,7 @@ H5__timer_get_timevals(H5_timevals_t *times /*in,out*/) { struct rusage res; - if (HDgetrusage(RUSAGE_SELF, &res) < 0) + if (getrusage(RUSAGE_SELF, &res) < 0) return -1; times->system = (double)res.ru_stime.tv_sec + ((double)res.ru_stime.tv_usec / 1.0E6); times->user = (double)res.ru_utime.tv_sec + ((double)res.ru_utime.tv_usec / 1.0E6); @@ -367,19 +350,16 @@ H5__timer_get_timevals(H5_timevals_t *times /*in,out*/) * Return: Success: 0 * Failure: -1 * - * Programmer: Dana Robinson - * May 2011 - * *------------------------------------------------------------------------- */ herr_t H5_timer_init(H5_timer_t *timer /*in,out*/) { /* Sanity check */ - HDassert(timer); + assert(timer); /* Initialize everything */ - HDmemset(timer, 0, sizeof(H5_timer_t)); + memset(timer, 0, sizeof(H5_timer_t)); return 0; } /* end H5_timer_init() */ @@ -392,16 +372,13 @@ H5_timer_init(H5_timer_t *timer /*in,out*/) * Return: Success: 0 * Failure: -1 * - * Programmer: Dana Robinson - * May 2011 - * *------------------------------------------------------------------------- */ herr_t H5_timer_start(H5_timer_t *timer /*in,out*/) { /* Sanity check */ - HDassert(timer); + assert(timer); /* Start the timer * This sets the "initial" times to the system-defined start times. @@ -422,16 +399,13 @@ H5_timer_start(H5_timer_t *timer /*in,out*/) * Return: Success: 0 * Failure: -1 * - * Programmer: Dana Robinson - * May 2011 - * *------------------------------------------------------------------------- */ herr_t H5_timer_stop(H5_timer_t *timer /*in,out*/) { /* Sanity check */ - HDassert(timer); + assert(timer); /* Stop the timer */ if (H5__timer_get_timevals(&(timer->final_interval)) < 0) @@ -473,16 +447,13 @@ H5_timer_stop(H5_timer_t *timer /*in,out*/) * Return: Success: 0 * Failure: -1 * - * Programmer: Dana Robinson - * May 2011 - * *------------------------------------------------------------------------- */ herr_t H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) { /* Sanity check */ - HDassert(times); + assert(times); if (timer.is_running) { H5_timevals_t now; @@ -528,16 +499,13 @@ H5_timer_get_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) * Return: Success: 0 * Failure: -1 * - * Programmer: Dana Robinson - * May 2011 - * *------------------------------------------------------------------------- */ herr_t H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) { /* Sanity check */ - HDassert(times); + assert(times); if (timer.is_running) { H5_timevals_t now; @@ -581,9 +549,6 @@ H5_timer_get_total_times(H5_timer_t timer, H5_timevals_t *times /*in,out*/) * * Failure: NULL * - * Programmer: Dana Robinson - * May 2011 - * *------------------------------------------------------------------------- */ char * @@ -618,7 +583,7 @@ H5_timer_get_time_string(double seconds) } /* end if */ /* Allocate */ - if (NULL == (s = (char *)HDcalloc(H5TIMER_TIME_STRING_LEN, sizeof(char)))) + if (NULL == (s = (char *)calloc(H5TIMER_TIME_STRING_LEN, sizeof(char)))) return NULL; /* Do we need a format string? Some people might like a certain diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5trace.c b/externals/coda-oss/modules/drivers/hdf5/source/H5trace.c index fd9da448b9..0aa85eda07 100644 --- a/externals/coda-oss/modules/drivers/hdf5/source/H5trace.c +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5trace.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -14,8 +13,6 @@ /*------------------------------------------------------------------------- * * Created: H5trace.c - * Aug 21 2006 - * Quincey Koziol * * Purpose: Internal code for tracing API calls * @@ -86,9 +83,6 @@ static herr_t H5_trace_args_close_degree(H5RS_str_t *rs, H5F_close_degree_t degr * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Monday, September 21, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -114,9 +108,6 @@ H5_trace_args_bool(H5RS_str_t *rs, hbool_t val) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Sunday, September 20, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -170,9 +161,6 @@ H5_trace_args_cset(H5RS_str_t *rs, H5T_cset_t cset) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Monday, September 21, 2020 - * *------------------------------------------------------------------------- */ static herr_t @@ -228,9 +216,6 @@ H5_trace_args_close_degree(H5RS_str_t *rs, H5F_close_degree_t degree) * * Return: SUCCEED / FAIL * - * Programmer: Quincey Koziol - * Saturday, September 19, 2020 - * *------------------------------------------------------------------------- */ herr_t @@ -249,7 +234,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) asize[i] = -1; /* Parse the argument types */ - for (argno = 0; *type; argno++, type += (HDisupper(*type) ? 2 : 1)) { + for (argno = 0; *type; argno++, type += (isupper(*type) ? 2 : 1)) { /* Count levels of indirection */ for (ptr = 0; '*' == *type; type++) ptr++; @@ -259,14 +244,14 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) char *rest; if ('a' == type[1]) { - asize_idx = (int)HDstrtol(type + 2, &rest, 10); - HDassert(0 <= asize_idx && asize_idx < (int)NELMTS(asize)); - HDassert(']' == *rest); + asize_idx = (int)strtol(type + 2, &rest, 10); + assert(0 <= asize_idx && asize_idx < (int)NELMTS(asize)); + assert(']' == *rest); type = rest + 1; } else { rest = (char *)HDstrchr(type, ']'); - HDassert(rest); + assert(rest); type = rest + 1; asize_idx = -1; } @@ -279,15 +264,13 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) * don't print the argument or the following `=' (this is used for * return values). */ - argname = HDva_arg(ap, char *); + argname = va_arg(ap, char *); if (argname) H5RS_asprintf_cat(rs, "%s%s=", argno ? ", " : "", argname); - else - argname = ""; /* A pointer/array */ if (ptr) { - vp = HDva_arg(ap, void *); + vp = va_arg(ap, void *); if (vp) { switch (type[0]) { case 'h': /* hsize_t */ @@ -442,9 +425,9 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[0]) { case 'a': /* haddr_t */ { - haddr_t addr = HDva_arg(ap, haddr_t); + haddr_t addr = va_arg(ap, haddr_t); - if (H5F_addr_defined(addr)) + if (H5_addr_defined(addr)) H5RS_asprintf_cat(rs, "%" PRIuHADDR, addr); else H5RS_acat(rs, "UNDEF"); @@ -455,7 +438,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[1]) { case 'i': /* H5A_info_t */ { - H5A_info_t ainfo = HDva_arg(ap, H5A_info_t); + H5A_info_t ainfo = va_arg(ap, H5A_info_t); H5RS_acat(rs, "{"); H5_trace_args_bool(rs, ainfo.corder_valid); @@ -468,7 +451,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) #ifndef H5_NO_DEPRECATED_SYMBOLS case 'o': /* H5A_operator1_t */ { - H5A_operator1_t aop1 = (H5A_operator1_t)HDva_arg(ap, H5A_operator1_t); + H5A_operator1_t aop1 = (H5A_operator1_t)va_arg(ap, H5A_operator1_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)aop1); } /* end block */ @@ -477,7 +460,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'O': /* H5A_operator2_t */ { - H5A_operator2_t aop2 = (H5A_operator2_t)HDva_arg(ap, H5A_operator2_t); + H5A_operator2_t aop2 = (H5A_operator2_t)va_arg(ap, H5A_operator2_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)aop2); } /* end block */ @@ -491,8 +474,8 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'b': /* hbool_t */ { - /* Can't pass hbool_t to HDva_arg() */ - hbool_t bool_var = (hbool_t)HDva_arg(ap, int); + /* Can't pass hbool_t to va_arg() */ + hbool_t bool_var = (hbool_t)va_arg(ap, int); H5_trace_args_bool(rs, bool_var); } /* end block */ @@ -502,7 +485,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[1]) { case 'c': /* H5AC_cache_config_t */ { - H5AC_cache_config_t cc = HDva_arg(ap, H5AC_cache_config_t); + H5AC_cache_config_t cc = va_arg(ap, H5AC_cache_config_t); H5RS_asprintf_cat(rs, "{%d, ", cc.version); H5_trace_args_bool(rs, cc.rpt_fcn_enabled); @@ -587,7 +570,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'C': /* H5AC_cache_image_config_t */ { - H5AC_cache_image_config_t cic = HDva_arg(ap, H5AC_cache_image_config_t); + H5AC_cache_image_config_t cic = va_arg(ap, H5AC_cache_image_config_t); H5RS_asprintf_cat(rs, "{%d, ", cic.version); H5_trace_args_bool(rs, cic.generate_image); @@ -606,7 +589,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'd': /* double */ { - double dbl = HDva_arg(ap, double); + double dbl = va_arg(ap, double); H5RS_asprintf_cat(rs, "%g", dbl); } /* end block */ @@ -616,7 +599,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[1]) { case 'a': /* H5D_alloc_time_t */ { - H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)HDva_arg(ap, int); + H5D_alloc_time_t alloc_time = (H5D_alloc_time_t)va_arg(ap, int); switch (alloc_time) { case H5D_ALLOC_TIME_ERROR: @@ -648,7 +631,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'A': /* H5D_append_cb_t */ { - H5D_append_cb_t dapp = (H5D_append_cb_t)HDva_arg(ap, H5D_append_cb_t); + H5D_append_cb_t dapp = (H5D_append_cb_t)va_arg(ap, H5D_append_cb_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)dapp); } /* end block */ @@ -656,7 +639,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'c': /* H5FD_mpio_collective_opt_t */ { - H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)HDva_arg(ap, int); + H5FD_mpio_collective_opt_t opt = (H5FD_mpio_collective_opt_t)va_arg(ap, int); switch (opt) { case H5FD_MPIO_COLLECTIVE_IO: @@ -674,9 +657,34 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) } /* end block */ break; + case 'C': /* H5D_selection_io_mode_t */ + { + H5D_selection_io_mode_t selection_io_mode = + (H5D_selection_io_mode_t)va_arg(ap, int); + + switch (selection_io_mode) { + case H5D_SELECTION_IO_MODE_DEFAULT: + H5RS_acat(rs, "H5D_SELECTION_IO_MODE_DEFAULT"); + break; + + case H5D_SELECTION_IO_MODE_OFF: + H5RS_acat(rs, "H5D_SELECTION_IO_MODE_OFF"); + break; + + case H5D_SELECTION_IO_MODE_ON: + H5RS_acat(rs, "H5D_SELECTION_IO_MODE_ON"); + break; + + default: + H5RS_asprintf_cat(rs, "%ld", (long)selection_io_mode); + break; + } /* end switch */ + } /* end block */ + break; + case 'f': /* H5D_fill_time_t */ { - H5D_fill_time_t fill_time = (H5D_fill_time_t)HDva_arg(ap, int); + H5D_fill_time_t fill_time = (H5D_fill_time_t)va_arg(ap, int); switch (fill_time) { case H5D_FILL_TIME_ERROR: @@ -704,7 +712,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'F': /* H5D_fill_value_t */ { - H5D_fill_value_t fill_value = (H5D_fill_value_t)HDva_arg(ap, int); + H5D_fill_value_t fill_value = (H5D_fill_value_t)va_arg(ap, int); switch (fill_value) { case H5D_FILL_VALUE_ERROR: @@ -732,7 +740,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'g': /* H5D_gather_func_t */ { - H5D_gather_func_t gop = (H5D_gather_func_t)HDva_arg(ap, H5D_gather_func_t); + H5D_gather_func_t gop = (H5D_gather_func_t)va_arg(ap, H5D_gather_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)gop); } /* end block */ @@ -740,7 +748,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'h': /* H5FD_mpio_chunk_opt_t */ { - H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)HDva_arg(ap, int); + H5FD_mpio_chunk_opt_t opt = (H5FD_mpio_chunk_opt_t)va_arg(ap, int); switch (opt) { case H5FD_MPIO_CHUNK_DEFAULT: @@ -765,7 +773,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'i': /* H5D_mpio_actual_io_mode_t */ { H5D_mpio_actual_io_mode_t actual_io_mode = - (H5D_mpio_actual_io_mode_t)HDva_arg(ap, int); + (H5D_mpio_actual_io_mode_t)va_arg(ap, int); switch (actual_io_mode) { case H5D_MPIO_NO_COLLECTIVE: @@ -797,7 +805,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'I': /* H5FD_file_image_callbacks_t */ { - H5FD_file_image_callbacks_t ficb = HDva_arg(ap, H5FD_file_image_callbacks_t); + H5FD_file_image_callbacks_t ficb = va_arg(ap, H5FD_file_image_callbacks_t); H5RS_asprintf_cat(rs, "{%p, ", (void *)(uintptr_t)ficb.image_malloc); H5RS_asprintf_cat(rs, "%p, ", (void *)(uintptr_t)ficb.image_memcpy); @@ -811,7 +819,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'k': /* H5D_chunk_index_t */ { - H5D_chunk_index_t idx = (H5D_chunk_index_t)HDva_arg(ap, int); + H5D_chunk_index_t idx = (H5D_chunk_index_t)va_arg(ap, int); switch (idx) { case H5D_CHUNK_IDX_BTREE: @@ -851,7 +859,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'l': /* H5D_layout_t */ { - H5D_layout_t layout = (H5D_layout_t)HDva_arg(ap, int); + H5D_layout_t layout = (H5D_layout_t)va_arg(ap, int); switch (layout) { case H5D_LAYOUT_ERROR: @@ -888,7 +896,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'n': /* H5D_mpio_no_collective_cause_t */ { H5D_mpio_no_collective_cause_t nocol_cause_mode = - (H5D_mpio_no_collective_cause_t)HDva_arg(ap, int); + (H5D_mpio_no_collective_cause_t)va_arg(ap, int); hbool_t flag_already_displayed = FALSE; /* Check for all bit-flags which might be set */ @@ -936,7 +944,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'o': /* H5D_mpio_actual_chunk_opt_mode_t */ { H5D_mpio_actual_chunk_opt_mode_t chunk_opt_mode = - (H5D_mpio_actual_chunk_opt_mode_t)HDva_arg(ap, int); + (H5D_mpio_actual_chunk_opt_mode_t)va_arg(ap, int); switch (chunk_opt_mode) { case H5D_MPIO_NO_CHUNK_OPTIMIZATION: @@ -960,7 +968,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'O': /* H5D_operator_t */ { - H5D_operator_t dop = (H5D_operator_t)HDva_arg(ap, H5D_operator_t); + H5D_operator_t dop = (H5D_operator_t)va_arg(ap, H5D_operator_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)dop); } /* end block */ @@ -968,7 +976,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 's': /* H5D_space_status_t */ { - H5D_space_status_t space_status = (H5D_space_status_t)HDva_arg(ap, int); + H5D_space_status_t space_status = (H5D_space_status_t)va_arg(ap, int); switch (space_status) { case H5D_SPACE_STATUS_NOT_ALLOCATED: @@ -996,7 +1004,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'S': /* H5D_scatter_func_t */ { - H5D_scatter_func_t sop = (H5D_scatter_func_t)HDva_arg(ap, H5D_scatter_func_t); + H5D_scatter_func_t sop = (H5D_scatter_func_t)va_arg(ap, H5D_scatter_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)sop); } /* end block */ @@ -1004,7 +1012,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5FD_mpio_xfer_t */ { - H5FD_mpio_xfer_t transfer = (H5FD_mpio_xfer_t)HDva_arg(ap, int); + H5FD_mpio_xfer_t transfer = (H5FD_mpio_xfer_t)va_arg(ap, int); switch (transfer) { case H5FD_MPIO_INDEPENDENT: @@ -1024,7 +1032,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'v': /* H5D_vds_view_t */ { - H5D_vds_view_t view = (H5D_vds_view_t)HDva_arg(ap, int); + H5D_vds_view_t view = (H5D_vds_view_t)va_arg(ap, int); switch (view) { case H5D_VDS_ERROR: @@ -1048,8 +1056,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'V': /* H5FD_class_value_t */ { - H5FD_class_value_t class_val = - (H5FD_class_value_t)HDva_arg(ap, H5FD_class_value_t); + H5FD_class_value_t class_val = (H5FD_class_value_t)va_arg(ap, H5FD_class_value_t); switch (class_val) { case H5_VFD_INVALID: @@ -1121,7 +1128,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'e': /* herr_t */ { - herr_t status = HDva_arg(ap, herr_t); + herr_t status = va_arg(ap, herr_t); if (status >= 0) H5RS_acat(rs, "SUCCEED"); @@ -1135,7 +1142,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) #ifndef H5_NO_DEPRECATED_SYMBOLS case 'a': /* H5E_auto1_t */ { - H5E_auto1_t eauto1 = (H5E_auto1_t)HDva_arg(ap, H5E_auto1_t); + H5E_auto1_t eauto1 = (H5E_auto1_t)va_arg(ap, H5E_auto1_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)eauto1); } /* end block */ @@ -1144,7 +1151,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'A': /* H5E_auto2_t */ { - H5E_auto2_t eauto2 = (H5E_auto2_t)HDva_arg(ap, H5E_auto2_t); + H5E_auto2_t eauto2 = (H5E_auto2_t)va_arg(ap, H5E_auto2_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)eauto2); } /* end block */ @@ -1153,7 +1160,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'C': /* H5ES_event_complete_func_t */ { H5ES_event_complete_func_t cfunc = - (H5ES_event_complete_func_t)HDva_arg(ap, H5ES_event_complete_func_t); + (H5ES_event_complete_func_t)va_arg(ap, H5ES_event_complete_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)cfunc); } /* end block */ @@ -1161,7 +1168,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'd': /* H5E_direction_t */ { - H5E_direction_t direction = (H5E_direction_t)HDva_arg(ap, int); + H5E_direction_t direction = (H5E_direction_t)va_arg(ap, int); switch (direction) { case H5E_WALK_UPWARD: @@ -1181,7 +1188,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'e': /* H5E_error_t */ { - H5E_error2_t *error = HDva_arg(ap, H5E_error2_t *); + H5E_error2_t *error = va_arg(ap, H5E_error2_t *); H5RS_asprintf_cat(rs, "%p", (void *)error); } /* end block */ @@ -1190,7 +1197,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'I': /* H5ES_event_insert_func_t */ { H5ES_event_insert_func_t ifunc = - (H5ES_event_insert_func_t)HDva_arg(ap, H5ES_event_insert_func_t); + (H5ES_event_insert_func_t)va_arg(ap, H5ES_event_insert_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)ifunc); } /* end block */ @@ -1198,7 +1205,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 's': /* H5ES_status_t */ { - H5ES_status_t status = (H5ES_status_t)HDva_arg(ap, int); + H5ES_status_t status = (H5ES_status_t)va_arg(ap, int); switch (status) { case H5ES_STATUS_IN_PROGRESS: @@ -1226,7 +1233,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5E_type_t */ { - H5E_type_t etype = (H5E_type_t)HDva_arg(ap, int); + H5E_type_t etype = (H5E_type_t)va_arg(ap, int); switch (etype) { case H5E_MAJOR: @@ -1254,7 +1261,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[1]) { case 'C': /* H5FD_class_t */ { - H5FD_class_t cls = HDva_arg(ap, H5FD_class_t); + H5FD_class_t cls = va_arg(ap, H5FD_class_t); H5RS_asprintf_cat(rs, "{'%s', %" PRIuHADDR ", ", cls.name, cls.maxaddr); H5_trace_args_close_degree(rs, cls.fc_degree); @@ -1264,7 +1271,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'd': /* H5F_close_degree_t */ { - H5F_close_degree_t degree = (H5F_close_degree_t)HDva_arg(ap, int); + H5F_close_degree_t degree = (H5F_close_degree_t)va_arg(ap, int); H5_trace_args_close_degree(rs, degree); } /* end block */ @@ -1272,7 +1279,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'f': /* H5F_fspace_strategy_t */ { - H5F_fspace_strategy_t fs_strategy = (H5F_fspace_strategy_t)HDva_arg(ap, int); + H5F_fspace_strategy_t fs_strategy = (H5F_fspace_strategy_t)va_arg(ap, int); switch (fs_strategy) { case H5F_FSPACE_STRATEGY_FSM_AGGR: @@ -1301,7 +1308,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'F': /* H5F_flush_cb_t */ { - H5F_flush_cb_t fflsh = (H5F_flush_cb_t)HDva_arg(ap, H5F_flush_cb_t); + H5F_flush_cb_t fflsh = (H5F_flush_cb_t)va_arg(ap, H5F_flush_cb_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)fflsh); } /* end block */ @@ -1309,7 +1316,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'I': /* H5F_info2_t */ { - H5F_info2_t fi2 = HDva_arg(ap, H5F_info2_t); + H5F_info2_t fi2 = va_arg(ap, H5F_info2_t); H5RS_asprintf_cat(rs, "{{%u, %" PRIuHSIZE ", %" PRIuHSIZE "}, ", fi2.super.version, fi2.super.super_size, @@ -1324,7 +1331,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'm': /* H5F_mem_t */ { - H5F_mem_t mem_type = (H5F_mem_t)HDva_arg(ap, int); + H5F_mem_t mem_type = (H5F_mem_t)va_arg(ap, int); switch (mem_type) { case H5FD_MEM_NOLIST: @@ -1369,7 +1376,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 's': /* H5F_scope_t */ { - H5F_scope_t scope = (H5F_scope_t)HDva_arg(ap, int); + H5F_scope_t scope = (H5F_scope_t)va_arg(ap, int); switch (scope) { case H5F_SCOPE_LOCAL: @@ -1389,7 +1396,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5F_file_space_type_t */ { - H5F_file_space_type_t fspace_type = (H5F_file_space_type_t)HDva_arg(ap, int); + H5F_file_space_type_t fspace_type = (H5F_file_space_type_t)va_arg(ap, int); switch (fspace_type) { case H5F_FILE_SPACE_DEFAULT: @@ -1422,7 +1429,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'v': /* H5F_libver_t */ { - H5F_libver_t libver_vers = (H5F_libver_t)HDva_arg(ap, int); + H5F_libver_t libver_vers = (H5F_libver_t)va_arg(ap, int); switch (libver_vers) { case H5F_LIBVER_EARLIEST: @@ -1466,7 +1473,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) #ifndef H5_NO_DEPRECATED_SYMBOLS case 'i': /* H5G_iterate_t */ { - H5G_iterate_t git = (H5G_iterate_t)HDva_arg(ap, H5G_iterate_t); + H5G_iterate_t git = (H5G_iterate_t)va_arg(ap, H5G_iterate_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)git); } /* end block */ @@ -1474,7 +1481,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'o': /* H5G_obj_t */ { - H5G_obj_t obj_type = (H5G_obj_t)HDva_arg(ap, int); + H5G_obj_t obj_type = (H5G_obj_t)va_arg(ap, int); switch (obj_type) { case H5G_UNKNOWN: @@ -1516,7 +1523,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 's': /* H5G_stat_t */ { - H5G_stat_t *statbuf = HDva_arg(ap, H5G_stat_t *); + H5G_stat_t *statbuf = va_arg(ap, H5G_stat_t *); H5RS_asprintf_cat(rs, "%p", (void *)statbuf); } /* end block */ @@ -1531,7 +1538,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'h': /* hsize_t */ { - hsize_t hsize = HDva_arg(ap, hsize_t); + hsize_t hsize = va_arg(ap, hsize_t); if (H5S_UNLIMITED == hsize) H5RS_acat(rs, "H5S_UNLIMITED"); @@ -1544,21 +1551,9 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'H': switch (type[1]) { - case 'a': /* H5_alloc_stats_t */ - { - H5_alloc_stats_t stats = HDva_arg(ap, H5_alloc_stats_t); - - H5RS_asprintf_cat(rs, "{%llu, %zu, %zu, %zu, %zu, %zu, %zu}", - stats.total_alloc_bytes, stats.curr_alloc_bytes, - stats.peak_alloc_bytes, stats.max_block_size, - stats.total_alloc_blocks_count, stats.curr_alloc_blocks_count, - stats.peak_alloc_blocks_count); - } /* end block */ - break; - case 'c': /* H5_atclose_func_t */ { - H5_atclose_func_t cfunc = (H5_atclose_func_t)HDva_arg(ap, H5_atclose_func_t); + H5_atclose_func_t cfunc = (H5_atclose_func_t)va_arg(ap, H5_atclose_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)cfunc); } /* end block */ @@ -1566,7 +1561,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 's': /* hssize_t */ { - hssize_t hssize = HDva_arg(ap, hssize_t); + hssize_t hssize = va_arg(ap, hssize_t); H5RS_asprintf_cat(rs, "%" PRIdHSIZE, hssize); asize[argno] = (hssize_t)hssize; @@ -1581,7 +1576,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'i': /* hid_t (and H5E_major_t / H5E_minor_t) */ { - hid_t obj = HDva_arg(ap, hid_t); + hid_t obj = va_arg(ap, hid_t); if (H5P_DEFAULT == obj) H5RS_acat(rs, "H5P_DEFAULT"); @@ -1775,7 +1770,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'D': /* H5I_future_discard_func_t */ { H5I_future_discard_func_t ifdisc = - (H5I_future_discard_func_t)HDva_arg(ap, H5I_future_discard_func_t); + (H5I_future_discard_func_t)va_arg(ap, H5I_future_discard_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)ifdisc); } /* end block */ @@ -1783,7 +1778,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'f': /* H5I_free_t */ { - H5I_free_t ifree = (H5I_free_t)HDva_arg(ap, H5I_free_t); + H5I_free_t ifree = (H5I_free_t)va_arg(ap, H5I_free_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)ifree); } /* end block */ @@ -1791,7 +1786,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'i': /* H5_index_t */ { - H5_index_t idx_type = (H5_index_t)HDva_arg(ap, int); + H5_index_t idx_type = (H5_index_t)va_arg(ap, int); switch (idx_type) { case H5_INDEX_UNKNOWN: @@ -1819,7 +1814,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'I': /* H5I_iterate_func_t */ { - H5I_iterate_func_t iiter = (H5I_iterate_func_t)HDva_arg(ap, H5I_iterate_func_t); + H5I_iterate_func_t iiter = (H5I_iterate_func_t)va_arg(ap, H5I_iterate_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)iiter); } /* end block */ @@ -1827,7 +1822,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'o': /* H5_iter_order_t */ { - H5_iter_order_t order = (H5_iter_order_t)HDva_arg(ap, int); + H5_iter_order_t order = (H5_iter_order_t)va_arg(ap, int); switch (order) { case H5_ITER_UNKNOWN: @@ -1860,7 +1855,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'R': /* H5I_future_realize_func_t */ { H5I_future_realize_func_t ifreal = - (H5I_future_realize_func_t)HDva_arg(ap, H5I_future_realize_func_t); + (H5I_future_realize_func_t)va_arg(ap, H5I_future_realize_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)ifreal); } /* end block */ @@ -1868,7 +1863,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 's': /* int / int32_t */ { - int is = HDva_arg(ap, int); + int is = va_arg(ap, int); H5RS_asprintf_cat(rs, "%d", is); asize[argno] = is; @@ -1877,7 +1872,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'S': /* H5I_search_func_t */ { - H5I_search_func_t isearch = (H5I_search_func_t)HDva_arg(ap, H5I_search_func_t); + H5I_search_func_t isearch = (H5I_search_func_t)va_arg(ap, H5I_search_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)isearch); } /* end block */ @@ -1885,7 +1880,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5I_type_t */ { - H5I_type_t id_type = (H5I_type_t)HDva_arg(ap, int); + H5I_type_t id_type = (H5I_type_t)va_arg(ap, int); switch (id_type) { case H5I_UNINIT: @@ -1973,7 +1968,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'u': /* unsigned / uint32_t */ { - unsigned iu = HDva_arg(ap, unsigned); + unsigned iu = va_arg(ap, unsigned); H5RS_asprintf_cat(rs, "%u", iu); asize[argno] = iu; @@ -1988,7 +1983,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'k': /* H5O_token_t */ { - H5O_token_t token = HDva_arg(ap, H5O_token_t); + H5O_token_t token = va_arg(ap, H5O_token_t); int j; for (j = 0; j < H5O_MAX_TOKEN_SIZE; j++) @@ -2001,7 +1996,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) #ifndef H5_NO_DEPRECATED_SYMBOLS case 'i': /* H5L_iterate1_t */ { - H5L_iterate1_t liter = (H5L_iterate1_t)HDva_arg(ap, H5L_iterate1_t); + H5L_iterate1_t liter = (H5L_iterate1_t)va_arg(ap, H5L_iterate1_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)liter); } /* end block */ @@ -2010,7 +2005,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'I': /* H5L_iterate2_t */ { - H5L_iterate2_t liter = (H5L_iterate2_t)HDva_arg(ap, H5L_iterate2_t); + H5L_iterate2_t liter = (H5L_iterate2_t)va_arg(ap, H5L_iterate2_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)liter); } /* end block */ @@ -2018,7 +2013,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'l': /* H5L_type_t (or H5G_link_t) */ { - H5L_type_t link_type = (H5L_type_t)HDva_arg(ap, int); + H5L_type_t link_type = (H5L_type_t)va_arg(ap, int); switch (link_type) { case H5L_TYPE_ERROR: @@ -2050,8 +2045,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5L_elink_traverse_t */ { - H5L_elink_traverse_t elt = - (H5L_elink_traverse_t)HDva_arg(ap, H5L_elink_traverse_t); + H5L_elink_traverse_t elt = (H5L_elink_traverse_t)va_arg(ap, H5L_elink_traverse_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)elt); } /* end block */ @@ -2067,7 +2061,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[1]) { case 'a': /* H5MM_allocate_t */ { - H5MM_allocate_t afunc = (H5MM_allocate_t)HDva_arg(ap, H5MM_allocate_t); + H5MM_allocate_t afunc = (H5MM_allocate_t)va_arg(ap, H5MM_allocate_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)afunc); } /* end block */ @@ -2076,7 +2070,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) #ifdef H5_HAVE_PARALLEL case 'c': /* MPI_Comm */ { - MPI_Comm comm = HDva_arg(ap, MPI_Comm); + MPI_Comm comm = va_arg(ap, MPI_Comm); H5RS_asprintf_cat(rs, "%ld", (long)comm); } /* end block */ @@ -2085,7 +2079,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'f': /* H5MM_free_t */ { - H5MM_free_t ffunc = (H5MM_free_t)HDva_arg(ap, H5MM_free_t); + H5MM_free_t ffunc = (H5MM_free_t)va_arg(ap, H5MM_free_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)ffunc); } /* end block */ @@ -2094,7 +2088,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) #ifdef H5_HAVE_PARALLEL case 'i': /* MPI_Info */ { - MPI_Info info = HDva_arg(ap, MPI_Info); + MPI_Info info = va_arg(ap, MPI_Info); H5RS_asprintf_cat(rs, "%ld", (long)info); } /* end block */ @@ -2104,7 +2098,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) #ifdef H5_HAVE_MAP_API case 'I': /* H5M_iterate_t */ { - H5M_iterate_t miter = (H5M_iterate_t)HDva_arg(ap, H5M_iterate_t); + H5M_iterate_t miter = (H5M_iterate_t)va_arg(ap, H5M_iterate_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)miter); } /* end block */ @@ -2113,7 +2107,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5FD_mem_t */ { - H5FD_mem_t mt = (H5FD_mem_t)HDva_arg(ap, int); + H5FD_mem_t mt = (H5FD_mem_t)va_arg(ap, int); switch (mt) { case H5FD_MEM_NOLIST: @@ -2166,7 +2160,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'o': /* off_t */ { - off_t offset = HDva_arg(ap, off_t); + off_t offset = va_arg(ap, off_t); H5RS_asprintf_cat(rs, "%ld", (long)offset); } /* end block */ @@ -2177,7 +2171,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) #ifndef H5_NO_DEPRECATED_SYMBOLS case 'i': /* H5O_iterate1_t */ { - H5O_iterate1_t oiter = (H5O_iterate1_t)HDva_arg(ap, H5O_iterate1_t); + H5O_iterate1_t oiter = (H5O_iterate1_t)va_arg(ap, H5O_iterate1_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)oiter); } /* end block */ @@ -2186,7 +2180,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'I': /* H5O_iterate2_t */ { - H5O_iterate2_t oiter2 = (H5O_iterate2_t)HDva_arg(ap, H5O_iterate2_t); + H5O_iterate2_t oiter2 = (H5O_iterate2_t)va_arg(ap, H5O_iterate2_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)oiter2); } /* end block */ @@ -2195,7 +2189,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 's': /* H5O_mcdt_search_cb_t */ { H5O_mcdt_search_cb_t osrch = - (H5O_mcdt_search_cb_t)HDva_arg(ap, H5O_mcdt_search_cb_t); + (H5O_mcdt_search_cb_t)va_arg(ap, H5O_mcdt_search_cb_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)osrch); } /* end block */ @@ -2203,7 +2197,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5O_type_t */ { - H5O_type_t objtype = (H5O_type_t)HDva_arg(ap, int); + H5O_type_t objtype = (H5O_type_t)va_arg(ap, int); switch (objtype) { case H5O_TYPE_UNKNOWN: @@ -2245,7 +2239,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'p': /* H5P_class_t */ { - hid_t pclass_id = HDva_arg(ap, hid_t); + hid_t pclass_id = va_arg(ap, hid_t); char *class_name = NULL; H5P_genclass_t *pclass; @@ -2266,7 +2260,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'c': /* H5P_cls_create_func_t */ { H5P_cls_create_func_t pcls_crt = - (H5P_cls_create_func_t)HDva_arg(ap, H5P_cls_create_func_t); + (H5P_cls_create_func_t)va_arg(ap, H5P_cls_create_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)pcls_crt); } /* end block */ @@ -2275,7 +2269,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'C': /* H5P_prp_create_func_t */ { H5P_prp_create_func_t prp_crt = - (H5P_prp_create_func_t)HDva_arg(ap, H5P_prp_create_func_t); + (H5P_prp_create_func_t)va_arg(ap, H5P_prp_create_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)prp_crt); } /* end block */ @@ -2284,7 +2278,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'D': /* H5P_prp_delete_func_t */ { H5P_prp_delete_func_t prp_del = - (H5P_prp_delete_func_t)HDva_arg(ap, H5P_prp_delete_func_t); + (H5P_prp_delete_func_t)va_arg(ap, H5P_prp_delete_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)prp_del); } /* end block */ @@ -2292,7 +2286,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'G': /* H5P_prp_get_func_t */ { - H5P_prp_get_func_t prp_get = (H5P_prp_get_func_t)HDva_arg(ap, H5P_prp_get_func_t); + H5P_prp_get_func_t prp_get = (H5P_prp_get_func_t)va_arg(ap, H5P_prp_get_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)prp_get); } /* end block */ @@ -2300,7 +2294,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'i': /* H5P_iterate_t */ { - H5P_iterate_t piter = (H5P_iterate_t)HDva_arg(ap, H5P_iterate_t); + H5P_iterate_t piter = (H5P_iterate_t)va_arg(ap, H5P_iterate_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)piter); } /* end block */ @@ -2309,7 +2303,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'l': /* H5P_cls_close_func_t */ { H5P_cls_close_func_t pcls_cls = - (H5P_cls_close_func_t)HDva_arg(ap, H5P_cls_close_func_t); + (H5P_cls_close_func_t)va_arg(ap, H5P_cls_close_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)pcls_cls); } /* end block */ @@ -2318,7 +2312,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'L': /* H5P_prp_close_func_t */ { H5P_prp_close_func_t prp_cls = - (H5P_prp_close_func_t)HDva_arg(ap, H5P_prp_close_func_t); + (H5P_prp_close_func_t)va_arg(ap, H5P_prp_close_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)prp_cls); } /* end block */ @@ -2327,7 +2321,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'M': /* H5P_prp_compare_func_t */ { H5P_prp_compare_func_t prp_cmp = - (H5P_prp_compare_func_t)HDva_arg(ap, H5P_prp_compare_func_t); + (H5P_prp_compare_func_t)va_arg(ap, H5P_prp_compare_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)prp_cmp); } /* end block */ @@ -2336,7 +2330,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'o': /* H5P_cls_copy_func_t */ { H5P_cls_copy_func_t pcls_cpy = - (H5P_cls_copy_func_t)HDva_arg(ap, H5P_cls_copy_func_t); + (H5P_cls_copy_func_t)va_arg(ap, H5P_cls_copy_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)pcls_cpy); } /* end block */ @@ -2345,7 +2339,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'O': /* H5P_prp_copy_func_t */ { H5P_prp_copy_func_t prp_cpy = - (H5P_prp_copy_func_t)HDva_arg(ap, H5P_prp_copy_func_t); + (H5P_prp_copy_func_t)va_arg(ap, H5P_prp_copy_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)prp_cpy); } /* end block */ @@ -2353,7 +2347,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'S': /* H5P_prp_set_func_t */ { - H5P_prp_set_func_t prp_set = (H5P_prp_set_func_t)HDva_arg(ap, H5P_prp_set_func_t); + H5P_prp_set_func_t prp_set = (H5P_prp_set_func_t)va_arg(ap, H5P_prp_set_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)prp_set); } /* end block */ @@ -2377,7 +2371,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'o': /* hobj_ref_t */ { - hobj_ref_t ref = HDva_arg(ap, hobj_ref_t); + hobj_ref_t ref = va_arg(ap, hobj_ref_t); H5RS_asprintf_cat(rs, "Reference Object=%" PRIuHADDR, ref); } /* end block */ @@ -2393,7 +2387,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5R_type_t */ { - H5R_type_t reftype = (H5R_type_t)HDva_arg(ap, int); + H5R_type_t reftype = (H5R_type_t)va_arg(ap, int); switch (reftype) { case H5R_BADTYPE: @@ -2441,7 +2435,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[1]) { case 'c': /* H5S_class_t */ { - H5S_class_t cls = (H5S_class_t)HDva_arg(ap, int); + H5S_class_t cls = (H5S_class_t)va_arg(ap, int); switch (cls) { case H5S_NO_CLASS: @@ -2469,7 +2463,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 's': /* H5S_seloper_t */ { - H5S_seloper_t so = (H5S_seloper_t)HDva_arg(ap, int); + H5S_seloper_t so = (H5S_seloper_t)va_arg(ap, int); switch (so) { case H5S_SELECT_NOOP: @@ -2521,7 +2515,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5S_sel_type */ { - H5S_sel_type st = (H5S_sel_type)HDva_arg(ap, int); + H5S_sel_type st = (H5S_sel_type)va_arg(ap, int); switch (st) { case H5S_SEL_ERROR: @@ -2563,7 +2557,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* htri_t */ { - htri_t tri_var = HDva_arg(ap, htri_t); + htri_t tri_var = va_arg(ap, htri_t); if (tri_var > 0) H5RS_acat(rs, "TRUE"); @@ -2578,7 +2572,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[1]) { case 'c': /* H5T_cset_t */ { - H5T_cset_t cset = (H5T_cset_t)HDva_arg(ap, int); + H5T_cset_t cset = (H5T_cset_t)va_arg(ap, int); H5_trace_args_cset(rs, cset); } /* end block */ @@ -2586,7 +2580,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'C': /* H5T_conv_t */ { - H5T_conv_t tconv = (H5T_conv_t)HDva_arg(ap, H5T_conv_t); + H5T_conv_t tconv = (H5T_conv_t)va_arg(ap, H5T_conv_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)tconv); } /* end block */ @@ -2594,7 +2588,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'd': /* H5T_direction_t */ { - H5T_direction_t direct = (H5T_direction_t)HDva_arg(ap, int); + H5T_direction_t direct = (H5T_direction_t)va_arg(ap, int); switch (direct) { case H5T_DIR_DEFAULT: @@ -2618,7 +2612,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'e': /* H5T_pers_t */ { - H5T_pers_t pers = (H5T_pers_t)HDva_arg(ap, int); + H5T_pers_t pers = (H5T_pers_t)va_arg(ap, int); switch (pers) { case H5T_PERS_DONTCARE: @@ -2643,7 +2637,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'E': /* H5T_conv_except_func_t */ { H5T_conv_except_func_t conv_ex = - (H5T_conv_except_func_t)HDva_arg(ap, H5T_conv_except_func_t); + (H5T_conv_except_func_t)va_arg(ap, H5T_conv_except_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)conv_ex); } /* end block */ @@ -2651,7 +2645,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'n': /* H5T_norm_t */ { - H5T_norm_t norm = (H5T_norm_t)HDva_arg(ap, int); + H5T_norm_t norm = (H5T_norm_t)va_arg(ap, int); switch (norm) { case H5T_NORM_ERROR: @@ -2679,7 +2673,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'o': /* H5T_order_t */ { - H5T_order_t order = (H5T_order_t)HDva_arg(ap, int); + H5T_order_t order = (H5T_order_t)va_arg(ap, int); switch (order) { case H5T_ORDER_ERROR: @@ -2715,7 +2709,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'p': /* H5T_pad_t */ { - H5T_pad_t pad = (H5T_pad_t)HDva_arg(ap, int); + H5T_pad_t pad = (H5T_pad_t)va_arg(ap, int); switch (pad) { case H5T_PAD_ERROR: @@ -2747,7 +2741,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 's': /* H5T_sign_t */ { - H5T_sign_t sign = (H5T_sign_t)HDva_arg(ap, int); + H5T_sign_t sign = (H5T_sign_t)va_arg(ap, int); switch (sign) { case H5T_SGN_ERROR: @@ -2775,7 +2769,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5T_class_t */ { - H5T_class_t type_class = (H5T_class_t)HDva_arg(ap, int); + H5T_class_t type_class = (H5T_class_t)va_arg(ap, int); switch (type_class) { case H5T_NO_CLASS: @@ -2839,7 +2833,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'z': /* H5T_str_t */ { - H5T_str_t str = (H5T_str_t)HDva_arg(ap, int); + H5T_str_t str = (H5T_str_t)va_arg(ap, int); switch (str) { case H5T_STR_ERROR: @@ -2891,7 +2885,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[1]) { case 'l': /* unsigned long */ { - unsigned long iul = HDva_arg(ap, unsigned long); + unsigned long iul = va_arg(ap, unsigned long); H5RS_asprintf_cat(rs, "%lu", iul); asize[argno] = (hssize_t)iul; @@ -2900,7 +2894,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'L': /* unsigned long long / uint64_t */ { - unsigned long long iull = HDva_arg(ap, unsigned long long); + unsigned long long iull = va_arg(ap, unsigned long long); H5RS_asprintf_cat(rs, "%llu", iull); asize[argno] = (hssize_t)iull; @@ -2917,7 +2911,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[1]) { case 'a': /* H5VL_attr_get_t */ { - H5VL_attr_get_t get = (H5VL_attr_get_t)HDva_arg(ap, int); + H5VL_attr_get_t get = (H5VL_attr_get_t)va_arg(ap, int); switch (get) { case H5VL_ATTR_GET_SPACE: @@ -2953,7 +2947,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'A': /* H5VL_blob_optional_t */ { - H5VL_blob_optional_t optional = (H5VL_blob_optional_t)HDva_arg(ap, int); + H5VL_blob_optional_t optional = (H5VL_blob_optional_t)va_arg(ap, int); H5RS_asprintf_cat(rs, "%ld", (long)optional); } /* end block */ @@ -2961,7 +2955,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'b': /* H5VL_attr_specific_t */ { - H5VL_attr_specific_t specific = (H5VL_attr_specific_t)HDva_arg(ap, int); + H5VL_attr_specific_t specific = (H5VL_attr_specific_t)va_arg(ap, int); switch (specific) { case H5VL_ATTR_DELETE: @@ -2993,7 +2987,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'B': /* H5VL_blob_specific_t */ { - H5VL_blob_specific_t specific = (H5VL_blob_specific_t)HDva_arg(ap, int); + H5VL_blob_specific_t specific = (H5VL_blob_specific_t)va_arg(ap, int); switch (specific) { case H5VL_BLOB_DELETE: @@ -3017,7 +3011,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'c': /* H5VL_dataset_get_t */ { - H5VL_dataset_get_t get = (H5VL_dataset_get_t)HDva_arg(ap, int); + H5VL_dataset_get_t get = (H5VL_dataset_get_t)va_arg(ap, int); switch (get) { case H5VL_DATASET_GET_SPACE: @@ -3053,8 +3047,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'C': /* H5VL_class_value_t */ { - H5VL_class_value_t class_val = - (H5VL_class_value_t)HDva_arg(ap, H5VL_class_value_t); + H5VL_class_value_t class_val = (H5VL_class_value_t)va_arg(ap, H5VL_class_value_t); if (H5_VOL_NATIVE == class_val) H5RS_acat(rs, "H5_VOL_NATIVE"); @@ -3065,7 +3058,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'd': /* H5VL_dataset_specific_t */ { - H5VL_dataset_specific_t specific = (H5VL_dataset_specific_t)HDva_arg(ap, int); + H5VL_dataset_specific_t specific = (H5VL_dataset_specific_t)va_arg(ap, int); switch (specific) { case H5VL_DATASET_SET_EXTENT: @@ -3089,7 +3082,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'e': /* H5VL_datatype_get_t */ { - H5VL_datatype_get_t get = (H5VL_datatype_get_t)HDva_arg(ap, int); + H5VL_datatype_get_t get = (H5VL_datatype_get_t)va_arg(ap, int); switch (get) { case H5VL_DATATYPE_GET_BINARY_SIZE: @@ -3113,7 +3106,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'f': /* H5VL_datatype_specific_t */ { - H5VL_datatype_specific_t specific = (H5VL_datatype_specific_t)HDva_arg(ap, int); + H5VL_datatype_specific_t specific = (H5VL_datatype_specific_t)va_arg(ap, int); switch (specific) { case H5VL_DATATYPE_FLUSH: @@ -3133,7 +3126,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'g': /* H5VL_file_get_t */ { - H5VL_file_get_t get = (H5VL_file_get_t)HDva_arg(ap, int); + H5VL_file_get_t get = (H5VL_file_get_t)va_arg(ap, int); switch (get) { case H5VL_FILE_GET_CONT_INFO: @@ -3177,7 +3170,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'h': /* H5VL_file_specific_t */ { - H5VL_file_specific_t specific = (H5VL_file_specific_t)HDva_arg(ap, int); + H5VL_file_specific_t specific = (H5VL_file_specific_t)va_arg(ap, int); switch (specific) { case H5VL_FILE_FLUSH: @@ -3209,7 +3202,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'i': /* H5VL_group_get_t */ { - H5VL_group_get_t get = (H5VL_group_get_t)HDva_arg(ap, int); + H5VL_group_get_t get = (H5VL_group_get_t)va_arg(ap, int); switch (get) { case H5VL_GROUP_GET_GCPL: @@ -3229,7 +3222,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'j': /* H5VL_group_specific_t */ { - H5VL_group_specific_t specific = (H5VL_group_specific_t)HDva_arg(ap, int); + H5VL_group_specific_t specific = (H5VL_group_specific_t)va_arg(ap, int); switch (specific) { case H5VL_GROUP_MOUNT: @@ -3257,7 +3250,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'k': /* H5VL_link_create_t */ { - H5VL_link_create_t create = (H5VL_link_create_t)HDva_arg(ap, int); + H5VL_link_create_t create = (H5VL_link_create_t)va_arg(ap, int); switch (create) { case H5VL_LINK_CREATE_HARD: @@ -3281,7 +3274,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'l': /* H5VL_link_get_t */ { - H5VL_link_get_t get = (H5VL_link_get_t)HDva_arg(ap, int); + H5VL_link_get_t get = (H5VL_link_get_t)va_arg(ap, int); switch (get) { case H5VL_LINK_GET_INFO: @@ -3305,7 +3298,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'L': /* H5VL_get_conn_lvl_t */ { - H5VL_get_conn_lvl_t get = (H5VL_get_conn_lvl_t)HDva_arg(ap, int); + H5VL_get_conn_lvl_t get = (H5VL_get_conn_lvl_t)va_arg(ap, int); switch (get) { case H5VL_GET_CONN_LVL_CURR: @@ -3325,7 +3318,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'm': /* H5VL_link_specific_t */ { - H5VL_link_specific_t specific = (H5VL_link_specific_t)HDva_arg(ap, int); + H5VL_link_specific_t specific = (H5VL_link_specific_t)va_arg(ap, int); switch (specific) { case H5VL_LINK_DELETE: @@ -3349,7 +3342,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'n': /* H5VL_object_get_t */ { - H5VL_object_get_t get = (H5VL_object_get_t)HDva_arg(ap, int); + H5VL_object_get_t get = (H5VL_object_get_t)va_arg(ap, int); switch (get) { case H5VL_OBJECT_GET_FILE: @@ -3378,7 +3371,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'N': /* H5VL_request_notify_t */ { H5VL_request_notify_t vlrnot = - (H5VL_request_notify_t)HDva_arg(ap, H5VL_request_notify_t); + (H5VL_request_notify_t)va_arg(ap, H5VL_request_notify_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)vlrnot); } /* end block */ @@ -3386,7 +3379,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'o': /* H5VL_object_specific_t */ { - H5VL_object_specific_t specific = (H5VL_object_specific_t)HDva_arg(ap, int); + H5VL_object_specific_t specific = (H5VL_object_specific_t)va_arg(ap, int); switch (specific) { case H5VL_OBJECT_CHANGE_REF_COUNT: @@ -3422,7 +3415,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'r': /* H5VL_request_specific_t */ { - H5VL_request_specific_t specific = (H5VL_request_specific_t)HDva_arg(ap, int); + H5VL_request_specific_t specific = (H5VL_request_specific_t)va_arg(ap, int); switch (specific) { case H5VL_REQUEST_GET_ERR_STACK: @@ -3442,7 +3435,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 's': /* H5VL_attr_optional_t */ { - H5VL_attr_optional_t optional = (H5VL_attr_optional_t)HDva_arg(ap, int); + H5VL_attr_optional_t optional = (H5VL_attr_optional_t)va_arg(ap, int); switch (optional) { #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -3460,7 +3453,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'S': /* H5VL_subclass_t */ { - H5VL_subclass_t subclass = (H5VL_subclass_t)HDva_arg(ap, int); + H5VL_subclass_t subclass = (H5VL_subclass_t)va_arg(ap, int); switch (subclass) { case H5VL_SUBCLS_NONE: @@ -3524,7 +3517,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 't': /* H5VL_dataset_optional_t */ { - H5VL_dataset_optional_t optional = (H5VL_dataset_optional_t)HDva_arg(ap, int); + H5VL_dataset_optional_t optional = (H5VL_dataset_optional_t)va_arg(ap, int); switch (optional) { case H5VL_NATIVE_DATASET_FORMAT_CONVERT: @@ -3576,7 +3569,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'u': /* H5VL_datatype_optional_t */ { - H5VL_datatype_optional_t optional = (H5VL_datatype_optional_t)HDva_arg(ap, int); + H5VL_datatype_optional_t optional = (H5VL_datatype_optional_t)va_arg(ap, int); H5RS_asprintf_cat(rs, "%ld", (long)optional); } /* end block */ @@ -3584,7 +3577,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'v': /* H5VL_file_optional_t */ { - H5VL_file_optional_t optional = (H5VL_file_optional_t)HDva_arg(ap, int); + H5VL_file_optional_t optional = (H5VL_file_optional_t)va_arg(ap, int); switch (optional) { case H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE: @@ -3714,7 +3707,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'w': /* H5VL_group_optional_t */ { - H5VL_group_optional_t optional = (H5VL_group_optional_t)HDva_arg(ap, int); + H5VL_group_optional_t optional = (H5VL_group_optional_t)va_arg(ap, int); switch (optional) { #ifndef H5_NO_DEPRECATED_SYMBOLS @@ -3736,7 +3729,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'x': /* H5VL_link_optional_t */ { - H5VL_link_optional_t optional = (H5VL_link_optional_t)HDva_arg(ap, int); + H5VL_link_optional_t optional = (H5VL_link_optional_t)va_arg(ap, int); H5RS_asprintf_cat(rs, "%ld", (long)optional); } /* end block */ @@ -3744,7 +3737,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'y': /* H5VL_object_optional_t */ { - H5VL_object_optional_t optional = (H5VL_object_optional_t)HDva_arg(ap, int); + H5VL_object_optional_t optional = (H5VL_object_optional_t)va_arg(ap, int); switch (optional) { case H5VL_NATIVE_OBJECT_GET_COMMENT: @@ -3780,7 +3773,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'z': /* H5VL_request_optional_t */ { - H5VL_request_optional_t optional = (H5VL_request_optional_t)HDva_arg(ap, int); + H5VL_request_optional_t optional = (H5VL_request_optional_t)va_arg(ap, int); H5RS_asprintf_cat(rs, "%ld", (long)optional); } /* end block */ @@ -3793,7 +3786,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) break; case 'x': { /* void / va_list */ - vp = HDva_arg(ap, void *); + vp = va_arg(ap, void *); if (vp) H5RS_asprintf_cat(rs, "%p", vp); @@ -3803,7 +3796,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) break; case 'z': { - size_t size = HDva_arg(ap, size_t); + size_t size = va_arg(ap, size_t); H5RS_asprintf_cat(rs, "%zu", size); asize[argno] = (hssize_t)size; @@ -3814,7 +3807,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) switch (type[1]) { case 'a': /* H5Z_SO_scale_type_t */ { - H5Z_SO_scale_type_t scale_type = (H5Z_SO_scale_type_t)HDva_arg(ap, int); + H5Z_SO_scale_type_t scale_type = (H5Z_SO_scale_type_t)va_arg(ap, int); switch (scale_type) { case H5Z_SO_FLOAT_DSCALE: @@ -3838,7 +3831,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'c': /* H5Z_class2_t */ { - H5Z_class2_t *filter = HDva_arg(ap, H5Z_class2_t *); + H5Z_class2_t *filter = va_arg(ap, H5Z_class2_t *); H5RS_asprintf_cat(rs, "%p", (void *)filter); } /* end block */ @@ -3846,7 +3839,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'e': /* H5Z_EDC_t */ { - H5Z_EDC_t edc = (H5Z_EDC_t)HDva_arg(ap, int); + H5Z_EDC_t edc = (H5Z_EDC_t)va_arg(ap, int); if (H5Z_DISABLE_EDC == edc) H5RS_acat(rs, "H5Z_DISABLE_EDC"); @@ -3859,7 +3852,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'f': /* H5Z_filter_t */ { - H5Z_filter_t id = HDva_arg(ap, H5Z_filter_t); + H5Z_filter_t id = va_arg(ap, H5Z_filter_t); if (H5Z_FILTER_NONE == id) H5RS_acat(rs, "H5Z_FILTER_NONE"); @@ -3882,14 +3875,14 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) case 'F': /* H5Z_filter_func_t */ { - H5Z_filter_func_t ffunc = (H5Z_filter_func_t)HDva_arg(ap, H5Z_filter_func_t); + H5Z_filter_func_t ffunc = (H5Z_filter_func_t)va_arg(ap, H5Z_filter_func_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)ffunc); } /* end block */ break; case 's': { - ssize_t ssize = HDva_arg(ap, ssize_t); + ssize_t ssize = va_arg(ap, ssize_t); H5RS_asprintf_cat(rs, "%zd", ssize); asize[argno] = (hssize_t)ssize; @@ -3911,7 +3904,7 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) break; default: - if (HDisupper(type[0])) + if (isupper(type[0])) H5RS_asprintf_cat(rs, "BADTYPE(%c%c)", type[0], type[1]); else H5RS_asprintf_cat(rs, "BADTYPE(%c)", type[0]); @@ -3955,9 +3948,6 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) * * Return: Execution time for an API call * - * Programmer: Robb Matzke - * Tuesday, June 16, 1998 - * *------------------------------------------------------------------------- */ double @@ -3968,8 +3958,8 @@ H5_trace(const double *returning, const char *func, const char *type, ...) hssize_t i; FILE *out = H5_debug_g.trace; static hbool_t is_first_invocation = TRUE; - H5_timer_t function_timer; - H5_timevals_t function_times = {0.0, 0.0, 0.0}; + H5_timer_t function_timer = {{0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, {0.0, 0.0, 0.0}, FALSE}; + H5_timevals_t function_times = {0.0, 0.0, 0.0}; static H5_timer_t running_timer; H5_timevals_t running_times; static int current_depth = 0; @@ -4022,7 +4012,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) * since the one for the function call, then we're continuing * the same line. */ if (returning) { - HDassert(current_depth > 0); + assert(current_depth > 0); --current_depth; if (current_depth < last_call_depth) { /* We are at the beginning of a line */ @@ -4056,9 +4046,9 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* Format arguments into the refcounted string */ - HDva_start(ap, type); + va_start(ap, type); H5_trace_args(rs, type, ap); - HDva_end(ap); + va_end(ap); /* Display event time for return */ if (returning && H5_debug_g.ttimes) { @@ -4076,7 +4066,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) H5RS_acat(rs, ")"); } HDfputs(H5RS_get_str(rs), out); - HDfflush(out); + fflush(out); H5RS_decr(rs); if (H5_debug_g.ttimes) diff --git a/externals/coda-oss/modules/drivers/hdf5/source/H5vers.txt b/externals/coda-oss/modules/drivers/hdf5/source/H5vers.txt new file mode 100644 index 0000000000..8bf8eddb2f --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5/source/H5vers.txt @@ -0,0 +1,96 @@ +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# 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. +# + +# This file is used to generate the various headers that are needed for +# versioning the public symbols for the library. +# +# The bin/make_vers script reads in this file and creates the appropriate files +# in the src/ directory when the generated headers are out of date with respect +# to this file. +# +# Blank lines and lines beginning with '#' are ignored +# +# The format of this file is as follows: +# : ; ; , +# +# Where is either 'FUNCTION' or 'TYPEDEF' +# +# For example, the following sample input shows two functions with different +# API versions for each. The example below shows H5Gfoo being added to the +# library in the v1.0 branch and revised in the v1.4 and v1.8 branches (so +# there should be three versioned names for the routine: H5Gfoo1, H5Gfoo2 and +# H5Gfoo3). H5Gbar is shown as being added to the library in the v1.2 branch +# (so the "base" version of the API name wouldn't appear if the library +# was configured with the default API interface corresponding to v1.0) and +# revised in the v1.6 branch (so there should be two versioned names for the +# routine: H5Gbar1 and H5Gbar2). +# +# FUNCTION: H5Gfoo; ; v10, v14, v18 +# FUNCTION: H5Gbar; ; v12, v16 +# + +# API function names +# (although not required, it's easier to compare this file with the headers +# generated if the list below is in alphanumeric sort order - QAK) +FUNCTION: H5Acreate; ; v10, v18 +FUNCTION: H5Aiterate; H5A_operator; v10, v18 +FUNCTION: H5Dcreate; ; v10, v18 +FUNCTION: H5Dopen; ; v10, v18 +FUNCTION: H5Eclear; ; v10, v18 +FUNCTION: H5Eget_auto; ; v10, v18 +FUNCTION: H5Eprint; ; v10, v18 +FUNCTION: H5Epush; ; v14, v18 +FUNCTION: H5Eset_auto; ; v10, v18 +FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18 +FUNCTION: H5Fget_info; H5F_info; v18, v110 +FUNCTION: H5Gcreate; ; v10, v18 +FUNCTION: H5Gopen; ; v10, v18 +FUNCTION: H5Lget_info; H5L_info; v18, v112 +FUNCTION: H5Lget_info_by_idx; H5L_info; v18, v112 +FUNCTION: H5Literate; H5L_iterate; v18, v112 +FUNCTION: H5Literate_by_name; H5L_iterate; v18, v112 +FUNCTION: H5Lvisit; H5L_iterate; v18, v112 +FUNCTION: H5Lvisit_by_name; H5L_iterate; v18, v112 +# Note: v111 is allowed in make_vers because H5O functions were prematurely +# versioned in HDF5 1.10. Because users were affected by this, the +# versioning was rescinded but the H5O version 2 functions were kept +# to be called directly. Now that the version macros are added in 1.12, +# along with a 3rd version of the H5O functions, the H5O function +# version for default api=v110 should be version 1 to work correctly +# with 1.10 applications that were using unversioned H5O functions, +# and the H5O function version should be version 3 for default api=v112 +# (the default api version for 1.12). +FUNCTION: H5Oget_info; ; v18, v111, v112 +FUNCTION: H5Oget_info_by_name; ; v18, v111, v112 +FUNCTION: H5Oget_info_by_idx; ; v18, v111, v112 +FUNCTION: H5Ovisit; ; v18, v111, v112 +FUNCTION: H5Ovisit_by_name; ; v18, v111, v112 +FUNCTION: H5Pencode; ; v110, v112 +FUNCTION: H5Pget_filter; ; v10, v18 +FUNCTION: H5Pget_filter_by_id; ; v16, v18 +FUNCTION: H5Pinsert; ; v14, v18 +FUNCTION: H5Pregister; ; v14, v18 +FUNCTION: H5Rdereference; ; v10, v110 +FUNCTION: H5Rget_obj_type; ; v16, v18 +FUNCTION: H5Sencode; ; v18, v112 +FUNCTION: H5Tarray_create; ; v14, v18 +FUNCTION: H5Tcommit; ; v10, v18 +FUNCTION: H5Tget_array_dims; ; v14, v18 +FUNCTION: H5Topen; ; v10, v18 + +# API typedefs +# (although not required, it's easier to compare this file with the headers +# generated if the list below is in alphanumeric sort order - QAK) +TYPEDEF: H5E_auto; v10, v18 +TYPEDEF: H5O_info; v18, v112 +TYPEDEF: H5O_iterate; v18, v112 +TYPEDEF: H5Z_class; v16, v18 + diff --git a/externals/coda-oss/modules/drivers/hdf5/wscript b/externals/coda-oss/modules/drivers/hdf5/wscript index 761d6ec4d9..08450e32a6 100644 --- a/externals/coda-oss/modules/drivers/hdf5/wscript +++ b/externals/coda-oss/modules/drivers/hdf5/wscript @@ -1,5 +1,5 @@ NAME = 'hdf5' -VERSION = '1.13.2' +VERSION = '1.14.2' LANG = 'c' distclean = options = configure = lambda p: None diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5AbstractDs.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5AbstractDs.h new file mode 100644 index 0000000000..49bcfebea0 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5AbstractDs.h @@ -0,0 +1,83 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5AbstractDs_H +#define H5AbstractDs_H + +namespace H5 { + +class ArrayType; +class CompType; +class EnumType; +class FloatType; +class IntType; +class StrType; +class VarLenType; +class DataSpace; + +/*! \class AbstractDs + \brief AbstractDs is an abstract base class, inherited by Attribute + and DataSet. + + It provides a collection of services that are common to both Attribute + and DataSet. +*/ +class H5_DLLCPP AbstractDs { + public: + // Gets a copy the datatype of that this abstract dataset uses. + // Note that this datatype is a generic one and can only be accessed + // via generic member functions, i.e., member functions belong + // to DataType. To get specific datatype, i.e. EnumType, FloatType, + // etc..., use the specific functions, that follow, instead. + DataType getDataType() const; + + // Gets a copy of the specific datatype of this abstract dataset. + ArrayType getArrayType() const; + CompType getCompType() const; + EnumType getEnumType() const; + IntType getIntType() const; + FloatType getFloatType() const; + StrType getStrType() const; + VarLenType getVarLenType() const; + + ///\brief Gets the size in memory of this abstract dataset. + virtual size_t getInMemDataSize() const = 0; + + ///\brief Gets the dataspace of this abstract dataset - pure virtual. + virtual DataSpace getSpace() const = 0; + + // Gets the class of the datatype that is used by this abstract + // dataset. + H5T_class_t getTypeClass() const; + + ///\brief Returns the amount of storage size required - pure virtual. + virtual hsize_t getStorageSize() const = 0; + + // Returns this class name - pure virtual. + virtual H5std_string fromClass() const = 0; + + // Destructor + virtual ~AbstractDs(); + + protected: + // Default constructor + AbstractDs(); + + private: + // This member function is implemented by DataSet and Attribute - pure virtual. + virtual hid_t p_get_type() const = 0; + +}; // end of AbstractDs +} // namespace H5 + +#endif // H5AbstractDs_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Alltypes.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Alltypes.h new file mode 100644 index 0000000000..b18add8d1f --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Alltypes.h @@ -0,0 +1,26 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +// This header file simply serves as a container to hold the +// header files of all datatypes. It simplifies the header +// file including in the code. + +#include "H5DataType.h" +#include "H5AtomType.h" +#include "H5EnumType.h" +#include "H5IntType.h" +#include "H5FloatType.h" +#include "H5StrType.h" +#include "H5ArrayType.h" +#include "H5VarLenType.h" +#include "H5CompType.h" diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5ArrayType.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5ArrayType.h new file mode 100644 index 0000000000..e9afb9c453 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5ArrayType.h @@ -0,0 +1,71 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5ArrayType_H +#define H5ArrayType_H + +namespace H5 { + +/*! \class ArrayType + \brief Class ArrayType inherits from DataType and provides wrappers for + the HDF5's Array Datatypes. +*/ +// Inheritance: DataType -> H5Object -> H5Location -> IdComponent +class H5_DLLCPP ArrayType : public DataType { + public: + // Constructor that creates a new array data type based on the + // specified base type. + ArrayType(const DataType &base_type, int ndims, const hsize_t *dims); + + // Assignment operator + ArrayType &operator=(const ArrayType &rhs); + + // Constructors that open an array datatype, given a location. + ArrayType(const H5Location &loc, const char *name); + ArrayType(const H5Location &loc, const H5std_string &name); + + // Returns an ArrayType object via DataType* by decoding the + // binary object description of this type. + virtual DataType *decode() const override; + + // Returns the number of dimensions of this array datatype. + int getArrayNDims() const; + // int getArrayNDims(); // removed 1.8.18 and 1.10.1 + + // Returns the sizes of dimensions of this array datatype. + int getArrayDims(hsize_t *dims) const; + // int getArrayDims(hsize_t* dims); // removed 1.8.18 and 1.10.1 + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("ArrayType"); + } + + // Copy constructor: same as the original ArrayType. + ArrayType(const ArrayType &original); + + // Constructor that takes an existing id + ArrayType(const hid_t existing_id); + + // Noop destructor + virtual ~ArrayType() override; + + // Default constructor + ArrayType(); + +}; // end of ArrayType +} // namespace H5 + +#endif // H5ArrayType_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5AtomType.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5AtomType.h new file mode 100644 index 0000000000..bb2cf48b33 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5AtomType.h @@ -0,0 +1,85 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5AtomType_H +#define H5AtomType_H + +namespace H5 { + +/*! \class AtomType + \brief AtomType is a base class, inherited by IntType, FloatType, + StrType, and PredType. + + AtomType provides operations on HDF5 atomic datatypes. It also inherits + from DataType. +*/ +// Inheritance: DataType -> H5Object -> H5Location -> IdComponent +class H5_DLLCPP AtomType : public DataType { + public: + // Returns the byte order of an atomic datatype. + H5T_order_t getOrder() const; + H5T_order_t getOrder(H5std_string &order_string) const; + + // Sets the byte ordering of an atomic datatype. + void setOrder(H5T_order_t order) const; + + // Retrieves the bit offset of the first significant bit. + // 12/05/00 - changed return type to int from size_t - C API + int getOffset() const; + + // Sets the bit offset of the first significant bit. + void setOffset(size_t offset) const; + + // Retrieves the padding type of the least and most-significant bit padding. + void getPad(H5T_pad_t &lsb, H5T_pad_t &msb) const; + + // Sets the least and most-significant bits padding types + void setPad(H5T_pad_t lsb, H5T_pad_t msb) const; + + // Returns the precision of an atomic datatype. + size_t getPrecision() const; + + // Sets the precision of an atomic datatype. + void setPrecision(size_t precision) const; + + // Sets the total size for an atomic datatype. + void setSize(size_t size) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("AtomType"); + } + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Copy constructor: same as the original AtomType. + AtomType(const AtomType &original); + + // Noop destructor + virtual ~AtomType() override; +#endif // DOXYGEN_SHOULD_SKIP_THIS + + protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Default constructor + AtomType(); + + // Constructor that takes an existing id + AtomType(const hid_t existing_id); +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of AtomType +} // namespace H5 + +#endif // H5AtomType_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Attribute.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Attribute.h new file mode 100644 index 0000000000..6851e1ac76 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Attribute.h @@ -0,0 +1,106 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5Attribute_H +#define H5Attribute_H + +namespace H5 { + +/*! \class Attribute + \brief Class Attribute operates on HDF5 attributes. + + An attribute has many characteristics similar to a dataset, thus both + Attribute and DataSet are derivatives of AbstractDs. Attribute also + inherits from H5Location because an attribute can be used to specify + a location. +*/ +// Inheritance: multiple H5Location/AbstractDs -> IdComponent +class H5_DLLCPP Attribute : public AbstractDs, public H5Location { + public: + // Copy constructor: same as the original Attribute. + Attribute(const Attribute &original); + + // Default constructor + Attribute(); + + // Creates a copy of an existing attribute using the attribute id + Attribute(const hid_t attr_id); + + // Closes this attribute. + virtual void close() override; + + // Gets the name of this attribute. + ssize_t getName(char *attr_name, size_t buf_size = 0) const; + H5std_string getName(size_t len) const; + H5std_string getName() const; + ssize_t getName(H5std_string &attr_name, size_t len = 0) const; + // The overloaded function below is replaced by the one above and it + // is kept for backward compatibility purpose. + ssize_t getName(size_t buf_size, H5std_string &attr_name) const; + + // Gets a copy of the dataspace for this attribute. + virtual DataSpace getSpace() const override; + + // Returns the amount of storage size required for this attribute. + virtual hsize_t getStorageSize() const override; + + // Returns the in memory size of this attribute's data. + virtual size_t getInMemDataSize() const override; + + // Reads data from this attribute. + void read(const DataType &mem_type, void *buf) const; + void read(const DataType &mem_type, H5std_string &strg) const; + + // Writes data to this attribute. + void write(const DataType &mem_type, const void *buf) const; + void write(const DataType &mem_type, const H5std_string &strg) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("Attribute"); + } + + // Gets the attribute id. + virtual hid_t getId() const override; + + // Destructor: properly terminates access to this attribute. + virtual ~Attribute() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + protected: + // Sets the attribute id. + virtual void p_setId(const hid_t new_id) override; +#endif // DOXYGEN_SHOULD_SKIP_THIS + + private: + hid_t id; // HDF5 attribute id + + // This function contains the common code that is used by + // getTypeClass and various API functions getXxxType + // defined in AbstractDs for generic datatype and specific + // sub-types + virtual hid_t p_get_type() const override; + + // Reads variable or fixed len strings from this attribute. + void p_read_variable_len(const DataType &mem_type, H5std_string &strg) const; + void p_read_fixed_len(const DataType &mem_type, H5std_string &strg) const; + + // Friend function to set Attribute id. For library use only. + friend void f_Attribute_setId(Attribute *attr, hid_t new_id); + +}; // end of Attribute +} // namespace H5 + +#endif // H5Attribute_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Classes.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Classes.h new file mode 100644 index 0000000000..b4a0670d46 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Classes.h @@ -0,0 +1,45 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5Classes_H +#define H5Classes_H + +namespace H5 { +class Exception; +class IdComponent; +class H5Location; +class H5Object; +class PropList; +class FileCreatPropList; +class FileAccPropList; +class LinkAccPropList; +class DSetCreatPropList; +class DSetMemXferPropList; +class DTypePropList; +class DataType; +class DataSpace; +class AtomType; +class PredType; +class IntType; +class FloatType; +class StrType; +class EnumType; +class CompType; +class AbstractDs; +class DataSet; +class Group; +class H5File; +class Attribute; +class H5Library; +} // namespace H5 +#endif // H5Classes_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5CommonFG.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5CommonFG.h new file mode 100644 index 0000000000..e6756177a7 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5CommonFG.h @@ -0,0 +1,95 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5CommonFG_H +#define H5CommonFG_H + +namespace H5 { + +// Class forwarding +class Group; +class H5File; +class ArrayType; +class VarLenType; + +/*! \class CommonFG + \brief \a CommonFG is an abstract base class of H5Group. +*/ +/* Note: This class is being deprecated gradually. */ +class H5_DLLCPP CommonFG { + public: + // Opens a generic named datatype in this location. + DataType openDataType(const char *name) const; + DataType openDataType(const H5std_string &name) const; + + // Opens a named array datatype in this location. + ArrayType openArrayType(const char *name) const; + ArrayType openArrayType(const H5std_string &name) const; + + // Opens a named compound datatype in this location. + CompType openCompType(const char *name) const; + CompType openCompType(const H5std_string &name) const; + + // Opens a named enumeration datatype in this location. + EnumType openEnumType(const char *name) const; + EnumType openEnumType(const H5std_string &name) const; + + // Opens a named integer datatype in this location. + IntType openIntType(const char *name) const; + IntType openIntType(const H5std_string &name) const; + + // Opens a named floating-point datatype in this location. + FloatType openFloatType(const char *name) const; + FloatType openFloatType(const H5std_string &name) const; + + // Opens a named string datatype in this location. + StrType openStrType(const char *name) const; + StrType openStrType(const H5std_string &name) const; + + // Opens a named variable length datatype in this location. + VarLenType openVarLenType(const char *name) const; + VarLenType openVarLenType(const H5std_string &name) const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + /// For subclasses, H5File and Group, to return the correct + /// object id, i.e. file or group id. + virtual hid_t getLocId() const = 0; + + /// For subclasses, H5File and Group, to throw appropriate exception. + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const = 0; + + // Default constructor. + CommonFG(); + + // Noop destructor. + virtual ~CommonFG(); + + protected: + virtual void p_setId(const hid_t new_id) = 0; + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of CommonFG +} // namespace H5 + +#endif // H5CommonFG_H + +/*************************************************************************** + Design Note + =========== + +September 2017: + + This class used to be base class of H5File as well, until the + restructure that moved H5File to be subclass of H5Group. +*/ diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5CompType.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5CompType.h new file mode 100644 index 0000000000..0675d2041d --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5CompType.h @@ -0,0 +1,126 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5CompType_H +#define H5CompType_H + +namespace H5 { + +/*! \class CompType + \brief CompType is a derivative of a DataType and operates on HDF5 + compound datatypes. +*/ +// Inheritance: DataType -> H5Object -> H5Location -> IdComponent +class H5_DLLCPP CompType : public DataType { + public: + // Default constructor + CompType(); + + // Creates a compound datatype using an existing id + CompType(const hid_t existing_id); + + // Creates a new compound datatype, given the type's size + CompType(size_t size); // H5Tcreate + + // Gets the compound datatype of the specified dataset + CompType(const DataSet &dataset); // H5Dget_type + + // Copy constructor - same as the original CompType. + CompType(const CompType &original); + + // Constructors that open a compound datatype, given a location. + CompType(const H5Location &loc, const char *name); + CompType(const H5Location &loc, const H5std_string &name); + + // Returns a CompType object via DataType* by decoding the binary + // object description of this type. + virtual DataType *decode() const override; + + // Returns the type class of the specified member of this compound + // datatype. It provides to the user a way of knowing what type + // to create another datatype of the same class + H5T_class_t getMemberClass(unsigned member_num) const; + + // Returns the index of a member in this compound data type. + int getMemberIndex(const char *name) const; + int getMemberIndex(const H5std_string &name) const; + + // Returns the offset of a member of this compound datatype. + size_t getMemberOffset(unsigned memb_no) const; + + // Returns the name of a member of this compound datatype. + H5std_string getMemberName(unsigned member_num) const; + + // Returns the generic datatype of the specified member in + // this compound datatype. + DataType getMemberDataType(unsigned member_num) const; + + // Returns the array datatype of the specified member in + // this compound datatype. + ArrayType getMemberArrayType(unsigned member_num) const; + + // Returns the compound datatype of the specified member in + // this compound datatype. + CompType getMemberCompType(unsigned member_num) const; + + // Returns the enumeration datatype of the specified member in + // this compound datatype. + EnumType getMemberEnumType(unsigned member_num) const; + + // Returns the integer datatype of the specified member in + // this compound datatype. + IntType getMemberIntType(unsigned member_num) const; + + // Returns the floating-point datatype of the specified member in + // this compound datatype. + FloatType getMemberFloatType(unsigned member_num) const; + + // Returns the string datatype of the specified member in + // this compound datatype. + StrType getMemberStrType(unsigned member_num) const; + + // Returns the variable length datatype of the specified member in + // this compound datatype. + VarLenType getMemberVarLenType(unsigned member_num) const; + + // Returns the number of members in this compound datatype. + int getNmembers() const; + + // Adds a new member to this compound datatype. + void insertMember(const H5std_string &name, size_t offset, const DataType &new_member) const; + + // Recursively removes padding from within this compound datatype. + void pack() const; + + // Sets the total size for this compound datatype. + void setSize(size_t size) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("CompType"); + } + + // Noop destructor. + virtual ~CompType() override; + + private: + // Contains common code that is used by the member functions + // getMemberXxxType + hid_t p_get_member_type(unsigned member_num) const; + +}; // end of CompType +} // namespace H5 + +#endif // H5CompType_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Cpp.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Cpp.h index 202d5843f5..34fdef2032 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Cpp.h +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Cpp.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5CppDoc.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5CppDoc.h index 4337a6fe91..37bd8a5cd0 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5CppDoc.h +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5CppDoc.h @@ -1,7 +1,6 @@ // C++ informative line for the emacs editor: -*- C++ -*- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DaccProp.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DaccProp.h new file mode 100644 index 0000000000..bb404cec40 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DaccProp.h @@ -0,0 +1,71 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5DSetAccPropList_H +#define H5DSetAccPropList_H + +namespace H5 { + +/*! \class DSetAccPropList + \brief Class DSetAccPropList inherits from LinkAccPropList and provides + wrappers for the HDF5 dataset access property functions. +*/ +// Inheritance: LinkAccPropList -> PropList -> IdComponent +class H5_DLLCPP DSetAccPropList : public LinkAccPropList { + public: + ///\brief Default dataset creation property list. + static const DSetAccPropList &DEFAULT; + + // Creates a dataset creation property list. + DSetAccPropList(); + + // Sets the raw data chunk cache parameters. + void setChunkCache(size_t rdcc_nslots, size_t rdcc_nbytes, double rdcc_w0) const; + + // Retrieves the raw data chunk cache parameters. + void getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double &rdcc_w0) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("DSetAccPropList"); + } + + // Copy constructor - same as the original DSetAccPropList. + DSetAccPropList(const DSetAccPropList &orig); + + // Creates a copy of an existing dataset creation property list + // using the property list id. + DSetAccPropList(const hid_t plist_id); + + // Noop destructor. + virtual ~DSetAccPropList() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the global constant, should only be used by the library + static void deleteConstants(); + + private: + static DSetAccPropList *DEFAULT_; + + // Creates the global constant, should only be used by the library + static DSetAccPropList *getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of DSetAccPropList +} // namespace H5 + +#endif // H5DSetAccPropList_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DataSet.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DataSet.h new file mode 100644 index 0000000000..399235086f --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DataSet.h @@ -0,0 +1,158 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5DataSet_H +#define H5DataSet_H + +namespace H5 { + +/*! \class DataSet + \brief Class DataSet operates on HDF5 datasets. + + An datasets has many characteristics similar to an attribute, thus both + Attribute and DataSet are derivatives of AbstractDs. DataSet also + inherits from H5Object because a dataset is an HDF5 object. +*/ +// Inheritance: multiple H5Object/AbstractDs -> H5Location -> IdComponent +class H5_DLLCPP DataSet : public H5Object, public AbstractDs { + public: + // Close this dataset. + virtual void close() override; + + // Extends the dataset with unlimited dimension. + void extend(const hsize_t *size) const; + + // Fills a selection in memory with a value + void fillMemBuf(const void *fill, const DataType &fill_type, void *buf, const DataType &buf_type, + const DataSpace &space) const; + // void fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& + // space); // removed from 1.8.18 and 1.10.1 + + // Fills a selection in memory with zero + void fillMemBuf(void *buf, const DataType &buf_type, const DataSpace &space) const; + // void fillMemBuf(void *buf, DataType& buf_type, DataSpace& space); // removed from 1.8.18 and 1.10.1 + + // Gets the creation property list of this dataset. + DSetCreatPropList getCreatePlist() const; + + // Gets the access property list of this dataset. + DSetAccPropList getAccessPlist() const; + + // Returns the address of this dataset in the file. + haddr_t getOffset() const; + + // Gets the dataspace of this dataset. + virtual DataSpace getSpace() const override; + + // Determines whether space has been allocated for a dataset. + void getSpaceStatus(H5D_space_status_t &status) const; + + // Returns the amount of storage size required for this dataset. + virtual hsize_t getStorageSize() const override; + + // Returns the in memory size of this attribute's data. + virtual size_t getInMemDataSize() const override; + + // Returns the number of bytes required to store VL data. + hsize_t getVlenBufSize(const DataType &type, const DataSpace &space) const; + // hsize_t getVlenBufSize(DataType& type, DataSpace& space) const; // removed from 1.8.18 and 1.10.1 + + // Reclaims VL datatype memory buffers. + static void vlenReclaim(const DataType &type, const DataSpace &space, + const DSetMemXferPropList &xfer_plist, void *buf); + static void vlenReclaim(void *buf, const DataType &type, const DataSpace &space = DataSpace::ALL, + const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT); + + // Reads the data of this dataset and stores it in the provided buffer. + // The memory and file dataspaces and the transferring property list + // can be defaults. + void read(void *buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL, + const DataSpace &file_space = DataSpace::ALL, + const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const; + void read(H5std_string &buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL, + const DataSpace &file_space = DataSpace::ALL, + const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const; + + // Writes the buffered data to this dataset. + // The memory and file dataspaces and the transferring property list + // can be defaults. + void write(const void *buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL, + const DataSpace &file_space = DataSpace::ALL, + const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const; + void write(const H5std_string &buf, const DataType &mem_type, const DataSpace &mem_space = DataSpace::ALL, + const DataSpace &file_space = DataSpace::ALL, + const DSetMemXferPropList &xfer_plist = DSetMemXferPropList::DEFAULT) const; + + // Iterates the selected elements in the specified dataspace - not implemented in C++ style yet + int iterateElems(void *buf, const DataType &type, const DataSpace &space, H5D_operator_t op, + void *op_data = NULL); + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("DataSet"); + } + + // Creates a dataset by way of dereference. + DataSet(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT, + const PropList &plist = PropList::DEFAULT); + DataSet(const Attribute &attr, const void *ref, H5R_type_t ref_type = H5R_OBJECT, + const PropList &plist = PropList::DEFAULT); + + // Default constructor. + DataSet(); + + // Copy constructor - same as the original DataSet. + DataSet(const DataSet &original); + + // Assignment operator + DataSet &operator=(const DataSet &original); + + // Creates a copy of an existing DataSet using its id. + DataSet(const hid_t existing_id); + + // Gets the dataset id. + virtual hid_t getId() const override; + + // Destructor: properly terminates access to this dataset. + virtual ~DataSet() override; + + protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Sets the dataset id. + virtual void p_setId(const hid_t new_id) override; +#endif // DOXYGEN_SHOULD_SKIP_THIS + + private: + hid_t id; // HDF5 dataset id + + // This function contains the common code that is used by + // getTypeClass and various API functions getXxxType + // defined in AbstractDs for generic datatype and specific + // sub-types + virtual hid_t p_get_type() const override; + + // Reads variable or fixed len strings from this dataset. + void p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, + const hid_t xfer_plist_id, H5std_string &strg) const; + void p_read_variable_len(const hid_t mem_type_id, const hid_t mem_space_id, const hid_t file_space_id, + const hid_t xfer_plist_id, H5std_string &strg) const; + + // Friend function to set DataSet id. For library use only. + friend void f_DataSet_setId(DataSet *dset, hid_t new_id); + +}; // end of DataSet +} // namespace H5 + +#endif // H5DataSet_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DataSpace.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DataSpace.h new file mode 100644 index 0000000000..136a8ea63b --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DataSpace.h @@ -0,0 +1,157 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5DataSpace_H +#define H5DataSpace_H + +namespace H5 { + +/*! \class DataSpace + \brief Class DataSpace inherits from IdComponent and provides wrappers for + the HDF5's dataspaces. +*/ +// Inheritance: IdComponent +class H5_DLLCPP DataSpace : public IdComponent { + public: + ///\brief Default DataSpace objects + static const DataSpace &ALL; + + // Creates a dataspace object given the space type + DataSpace(H5S_class_t type = H5S_SCALAR); + + // Creates a simple dataspace + DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims = NULL); + + // Creates a DataSpace object using an existing dataspace id. + DataSpace(const hid_t space_id); + + // Copy constructor - same as the original DataSpace. + DataSpace(const DataSpace &original); + + // Assignment operator + DataSpace &operator=(const DataSpace &rhs); + + // Closes this dataspace. + virtual void close() override; + + // Makes copy of an existing dataspace. + void copy(const DataSpace &like_space); + + // Copies the extent of this dataspace. + void extentCopy(const DataSpace &dest_space) const; + // removed from 1.8.18 and 1.10.1 + // void extentCopy(DataSpace& dest_space) const; + + // Gets the bounding box containing the current selection. + void getSelectBounds(hsize_t *start, hsize_t *end) const; + + // Gets the number of element points in the current selection. + hssize_t getSelectElemNpoints() const; + + // Retrieves the list of element points currently selected. + void getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const; + + // Gets the list of hyperslab blocks currently selected. + void getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const; + + // Get number of hyperslab blocks. + hssize_t getSelectHyperNblocks() const; + + // Gets the number of elements in this dataspace selection. + hssize_t getSelectNpoints() const; + + // Retrieves dataspace dimension size and maximum size. + int getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims = NULL) const; + + // Gets the dimensionality of this dataspace. + int getSimpleExtentNdims() const; + + // Gets the number of elements in this dataspace. + // 12/05/00 - changed return type to hssize_t from hsize_t - C API + hssize_t getSimpleExtentNpoints() const; + + // Gets the current class of this dataspace. + H5S_class_t getSimpleExtentType() const; + + // Determines if this dataspace is a simple one. + bool isSimple() const; + + // Sets the offset of this simple dataspace. + void offsetSimple(const hssize_t *offset) const; + + // Selects the entire dataspace. + void selectAll() const; + + // Selects array elements to be included in the selection for + // this dataspace. + void selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const; + + // Selects a hyperslab region to add to the current selected region. + void selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, + const hsize_t *stride = NULL, const hsize_t *block = NULL) const; + + // Resets the selection region to include no elements. + void selectNone() const; + + // Verifies that the selection is within the extent of the dataspace. + bool selectValid() const; + + // Removes the extent from this dataspace. + void setExtentNone() const; + + // Sets or resets the size of this dataspace. + void setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size = NULL) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("DataSpace"); + } + + // Gets the dataspace id. + virtual hid_t getId() const override; + + // Deletes the global constant + static void deleteConstants(); + + // Destructor: properly terminates access to this dataspace. + virtual ~DataSpace() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + protected: + // Sets the dataspace id. + virtual void p_setId(const hid_t new_id) override; + +#endif // DOXYGEN_SHOULD_SKIP_THIS + + private: + hid_t id; // HDF5 dataspace id + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + static DataSpace *ALL_; + + // Creates the global constant + static DataSpace *getConstant(); + + // Friend function to set DataSpace id. For library use only. + friend void f_DataSpace_setId(DataSpace *dspace, hid_t new_id); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of DataSpace +} // namespace H5 + +#endif // H5DataSpace_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DataType.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DataType.h new file mode 100644 index 0000000000..7cc1d31579 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DataType.h @@ -0,0 +1,185 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5DataType_H +#define H5DataType_H + +namespace H5 { + +/*! \class DataType + \brief Class DataType provides generic operations on HDF5 datatypes. + + DataType inherits from H5Object because a named datatype is an HDF5 + object and is a base class of ArrayType, AtomType, CompType, EnumType, + and VarLenType. +*/ +// Inheritance: DataType -> H5Object -> H5Location -> IdComponent +class H5_DLLCPP DataType : public H5Object { + public: + // Creates a datatype given its class and size + DataType(const H5T_class_t type_class, size_t size); + + // Copy constructor - same as the original DataType. + DataType(const DataType &original); + + // Creates a copy of a predefined type + DataType(const PredType &pred_type); + + // Constructors to open a generic named datatype at a given location. + DataType(const H5Location &loc, const char *name); + DataType(const H5Location &loc, const H5std_string &name); + + // Creates a datatype by way of dereference. + DataType(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT, + const PropList &plist = PropList::DEFAULT); + // DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const + // PropList& plist = PropList::DEFAULT); + + // Closes this datatype. + virtual void close() override; + + // Copies an existing datatype to this datatype object. + void copy(const DataType &like_type); + + // Copies the datatype of dset to this datatype object. + void copy(const DataSet &dset); + + // Returns a DataType instance by decoding the binary object + // description of this datatype. + virtual DataType *decode() const; + + // Creates a binary object description of this datatype. + void encode(); + + // Returns the datatype class identifier. + H5T_class_t getClass() const; + + // Commits a transient datatype to a file; this datatype becomes + // a named datatype which can be accessed from the location. + void commit(const H5Location &loc, const char *name); + void commit(const H5Location &loc, const H5std_string &name); + + // These two overloaded functions are kept for backward compatibility + // only; they missed the const - removed from 1.8.18 and 1.10.1 + // void commit(H5Location& loc, const char* name); + // void commit(H5Location& loc, const H5std_string& name); + + // Determines whether this datatype is a named datatype or + // a transient datatype. + bool committed() const; + + // Finds a conversion function that can handle the conversion + // this datatype to the given datatype, dest. + H5T_conv_t find(const DataType &dest, H5T_cdata_t **pcdata) const; + + // Converts data from between specified datatypes. + void convert(const DataType &dest, size_t nelmts, void *buf, void *background, + const PropList &plist = PropList::DEFAULT) const; + + // Assignment operator + DataType &operator=(const DataType &rhs); + + // Determines whether two datatypes are the same. + bool operator==(const DataType &compared_type) const; + + // Determines whether two datatypes are not the same. + bool operator!=(const DataType &compared_type) const; + + // Locks a datatype. + void lock() const; + + // Returns the size of a datatype. + size_t getSize() const; + + // Returns the base datatype from which a datatype is derived. + // Note: not quite right for specific types yet??? + DataType getSuper() const; + + // Registers a conversion function. + void registerFunc(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const; + void registerFunc(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const; + + // Removes a conversion function from all conversion paths. + void unregister(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const; + void unregister(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const; + + // Tags an opaque datatype. + void setTag(const char *tag) const; + void setTag(const H5std_string &tag) const; + + // Gets the tag associated with an opaque datatype. + H5std_string getTag() const; + + // Checks whether this datatype contains (or is) a certain type class. + bool detectClass(H5T_class_t cls) const; + static bool detectClass(const PredType &pred_type, H5T_class_t cls); + + // Checks whether this datatype is a variable-length string. + bool isVariableStr() const; + + // Returns a copy of the creation property list of a datatype. + PropList getCreatePlist() const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("DataType"); + } + + // Creates a copy of an existing DataType using its id + DataType(const hid_t type_id); + + // Default constructor + DataType(); + + // Determines whether this datatype has a binary object description. + bool hasBinaryDesc() const; + + // Gets the datatype id. + virtual hid_t getId() const override; + + // Destructor: properly terminates access to this datatype. + virtual ~DataType() override; + + protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + hid_t id; // HDF5 datatype id + + // Returns an id of a type by decoding the binary object + // description of this datatype. + hid_t p_decode() const; + + // Sets the datatype id. + virtual void p_setId(const hid_t new_id) override; + + // Opens a datatype and returns the id. + hid_t p_opentype(const H5Location &loc, const char *dtype_name) const; + +#endif // DOXYGEN_SHOULD_SKIP_THIS + + private: + // Buffer for binary object description of this datatype, allocated + // in DataType::encode and used in DataType::decode + unsigned char *encoded_buf; + size_t buf_size; + + // Friend function to set DataType id. For library use only. + friend void f_DataType_setId(DataType *dtype, hid_t new_id); + + void p_commit(hid_t loc_id, const char *name); + +}; // end of DataType +} // namespace H5 + +#endif // H5DataType_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DcreatProp.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DcreatProp.h new file mode 100644 index 0000000000..94ecbb53a8 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DcreatProp.h @@ -0,0 +1,161 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5DSCreatPropList_H +#define H5DSCreatPropList_H + +namespace H5 { + +// Class forwarding +class DataType; +class DataSpace; + +/*! \class DSetCreatPropList + \brief Class DSetCreatPropList inherits from ObjCreatPropList and provides + wrappers for the HDF5 dataset creation property functions. +*/ +// Inheritance: ObjCreatPropList -> PropList -> IdComponent +class H5_DLLCPP DSetCreatPropList : public ObjCreatPropList { + public: + ///\brief Default dataset creation property list. + static const DSetCreatPropList &DEFAULT; + + // Creates a dataset creation property list. + DSetCreatPropList(); + + // Queries whether all the filters set in this property list are + // available currently. + bool allFiltersAvail() const; + + // Get space allocation time for this property. + H5D_alloc_time_t getAllocTime() const; + + // Set space allocation time for dataset during creation. + void setAllocTime(H5D_alloc_time_t alloc_time) const; + + // Retrieves the size of the chunks used to store a chunked layout dataset. + int getChunk(int max_ndims, hsize_t *dim) const; + + // Sets the size of the chunks used to store a chunked layout dataset. + void setChunk(int ndims, const hsize_t *dim) const; + + // Returns information about an external file. + void getExternal(unsigned idx, size_t name_size, char *name, off_t &offset, hsize_t &size) const; + + // Returns the number of external files for a dataset. + int getExternalCount() const; + + // Gets fill value writing time. + H5D_fill_time_t getFillTime() const; + + // Sets fill value writing time for dataset. + void setFillTime(H5D_fill_time_t fill_time) const; + + // Retrieves a dataset fill value. + void getFillValue(const DataType &fvalue_type, void *value) const; + + // Sets a dataset fill value. + void setFillValue(const DataType &fvalue_type, const void *value) const; + + // Returns information about a filter in a pipeline. + H5Z_filter_t getFilter(int filter_number, unsigned int &flags, size_t &cd_nelmts, unsigned int *cd_values, + size_t namelen, char name[], unsigned int &filter_config) const; + + // Returns information about a filter in a pipeline given the filter id. + void getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, + unsigned int *cd_values, size_t namelen, char name[], + unsigned int &filter_config) const; + + // Gets the layout of the raw data storage of the data that uses this + // property list. + H5D_layout_t getLayout() const; + + // Sets the type of storage used to store the raw data for the + // dataset that uses this property list. + void setLayout(H5D_layout_t layout) const; + + // Returns the number of filters in the pipeline. + int getNfilters() const; + + // Checks if fill value has been defined for this property. + H5D_fill_value_t isFillValueDefined() const; + + // Modifies the specified filter. + void modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, + const unsigned int cd_values[]) const; + + // Remove one or all filters from the filter pipeline. + void removeFilter(H5Z_filter_t filter_id) const; + + // Sets compression method and compression level. + void setDeflate(int level) const; + + // Adds an external file to the list of external files. + void setExternal(const char *name, off_t offset, hsize_t size) const; + + // Adds a filter to the filter pipeline. + void setFilter(H5Z_filter_t filter, unsigned int flags = 0, size_t cd_nelmts = 0, + const unsigned int cd_values[] = NULL) const; + + // Sets Fletcher32 checksum of EDC for this property list. + void setFletcher32() const; + + // Sets method of the shuffle filter. + void setShuffle() const; + + // Sets SZIP compression method. + void setSzip(unsigned int options_mask, unsigned int pixels_per_block) const; + + // Sets N-bit compression method. + void setNbit() const; + + // Maps elements of a virtual dataset to elements of the source dataset. + void setVirtual(const DataSpace &vspace, const char *src_fname, const char *src_dsname, + const DataSpace &sspace) const; + void setVirtual(const DataSpace &vspace, const H5std_string src_fname, const H5std_string src_dsname, + const DataSpace &sspace) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("DSetCreatPropList"); + } + + // Copy constructor - same as the original DSetCreatPropList. + DSetCreatPropList(const DSetCreatPropList &orig); + + // Creates a copy of an existing dataset creation property list + // using the property list id. + DSetCreatPropList(const hid_t plist_id); + + // Noop destructor. + virtual ~DSetCreatPropList() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the global constant, should only be used by the library + static void deleteConstants(); + + private: + static DSetCreatPropList *DEFAULT_; + + // Creates the global constant, should only be used by the library + static DSetCreatPropList *getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of DSetCreatPropList +} // namespace H5 + +#endif // H5DSCreatPropList_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DxferProp.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DxferProp.h new file mode 100644 index 0000000000..d0a65c108a --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5DxferProp.h @@ -0,0 +1,133 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5DSetMemXferPropList_H +#define H5DSetMemXferPropList_H + +namespace H5 { + +/*! \class DSetMemXferPropList + \brief Class DSetCreatPropList inherits from PropList and provides + wrappers for the HDF5 dataset memory and transfer property list. +*/ +// Inheritance: PropList -> IdComponent +class H5_DLLCPP DSetMemXferPropList : public PropList { + public: + ///\brief Default dataset memory and transfer property list. + static const DSetMemXferPropList &DEFAULT; + + // Creates a dataset memory and transfer property list. + DSetMemXferPropList(); + + // Creates a dataset transform property list. + DSetMemXferPropList(const char *expression); + + // Sets type conversion and background buffers. + void setBuffer(size_t size, void *tconv, void *bkg) const; + + // Reads buffer settings. + size_t getBuffer(void **tconv, void **bkg) const; + + // Sets B-tree split ratios for a dataset transfer property list. + void setBtreeRatios(double left, double middle, double right) const; + + // Gets B-tree split ratios for a dataset transfer property list. + void getBtreeRatios(double &left, double &middle, double &right) const; + + // Sets data transform expression. + void setDataTransform(const char *expression) const; + void setDataTransform(const H5std_string &expression) const; + + // Gets data transform expression. + ssize_t getDataTransform(char *exp, size_t buf_size = 0) const; + H5std_string getDataTransform() const; + + // Sets the dataset transfer property list status to TRUE or FALSE. + void setPreserve(bool status) const; + + // Checks status of the dataset transfer property list. + bool getPreserve() const; + + // Sets an exception handling callback for datatype conversion. + void setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const; + + // Gets the exception handling callback for datatype conversion. + void getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const; + + // Sets the memory manager for variable-length datatype + // allocation in H5Dread and H5Treclaim. + void setVlenMemManager(H5MM_allocate_t alloc, void *alloc_info, H5MM_free_t free, void *free_info) const; + + // alloc and free are set to NULL, indicating that system + // malloc and free are to be used. + void setVlenMemManager() const; + + // Gets the memory manager for variable-length datatype + // allocation in H5Dread and H5Treclaim. + void getVlenMemManager(H5MM_allocate_t &alloc, void **alloc_info, H5MM_free_t &free, + void **free_info) const; + + // Sets the size of a contiguous block reserved for small data. + void setSmallDataBlockSize(hsize_t size) const; + + // Returns the current small data block size setting. + hsize_t getSmallDataBlockSize() const; + + // Sets number of I/O vectors to be read/written in hyperslab I/O. + void setHyperVectorSize(size_t vector_size) const; + + // Returns the number of I/O vectors to be read/written in + // hyperslab I/O. + size_t getHyperVectorSize() const; + + // Enables or disables error-detecting for a dataset reading + // process. + void setEDCCheck(H5Z_EDC_t check) const; + + // Determines whether error-detection is enabled for dataset reads. + H5Z_EDC_t getEDCCheck() const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("DSetMemXferPropList"); + } + + // Copy constructor - same as the original DSetMemXferPropList. + DSetMemXferPropList(const DSetMemXferPropList &orig); + + // Creates a copy of an existing dataset memory and transfer + // property list using the property list id. + DSetMemXferPropList(const hid_t plist_id); + + // Noop destructor + virtual ~DSetMemXferPropList() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the global constant, should only be used by the library + static void deleteConstants(); + + private: + static DSetMemXferPropList *DEFAULT_; + + // Creates the global constant, should only be used by the library + static DSetMemXferPropList *getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of DSetMemXferPropList +} // namespace H5 + +#endif // H5DSetMemXferPropList_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5EnumType.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5EnumType.h new file mode 100644 index 0000000000..a98688ea0b --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5EnumType.h @@ -0,0 +1,89 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5EnumType_H +#define H5EnumType_H + +namespace H5 { + +/*! \class EnumType + \brief EnumType is a derivative of a DataType and operates on HDF5 + enum datatypes. +*/ +// Inheritance: DataType -> H5Object -> H5Location -> IdComponent +class H5_DLLCPP EnumType : public DataType { + + public: + // Creates an empty enumeration datatype based on a native signed + // integer type, whose size is given by size. + EnumType(size_t size); + + // Gets the enum datatype of the specified dataset + EnumType(const DataSet &dataset); // H5Dget_type + + // Creates a new enum datatype based on an integer datatype + EnumType(const IntType &data_type); // H5Tenum_create + + // Constructors that open an enum datatype, given a location. + EnumType(const H5Location &loc, const char *name); + EnumType(const H5Location &loc, const H5std_string &name); + + // Returns an EnumType object via DataType* by decoding the + // binary object description of this type. + virtual DataType *decode() const override; + + // Returns the number of members in this enumeration datatype. + int getNmembers() const; + + // Returns the index of a member in this enumeration data type. + int getMemberIndex(const char *name) const; + int getMemberIndex(const H5std_string &name) const; + + // Returns the value of an enumeration datatype member + void getMemberValue(unsigned memb_no, void *value) const; + + // Inserts a new member to this enumeration type. + void insert(const char *name, void *value) const; + void insert(const H5std_string &name, void *value) const; + + // Returns the symbol name corresponding to a specified member + // of this enumeration datatype. + H5std_string nameOf(void *value, size_t size) const; + + // Returns the value corresponding to a specified member of this + // enumeration datatype. + void valueOf(const char *name, void *value) const; + void valueOf(const H5std_string &name, void *value) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("EnumType"); + } + + // Default constructor + EnumType(); + + // Creates an enumeration datatype using an existing id + EnumType(const hid_t existing_id); + + // Copy constructor: same as the original EnumType. + EnumType(const EnumType &original); + + virtual ~EnumType() override; + +}; // end of EnumType +} // namespace H5 + +#endif // H5EnumType_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Exception.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Exception.h new file mode 100644 index 0000000000..d4533e59d3 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Exception.h @@ -0,0 +1,174 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5Exception_H +#define H5Exception_H + +#include + +namespace H5 { +#define H5std_string std::string + +/*! \class Exception + \brief Exception provides wrappers of HDF5 error handling functions. + + Many classes are derived from Exception for specific HDF5 C interfaces. +*/ +class H5_DLLCPP Exception { + public: + // Creates an exception with a function name where the failure occurs + // and an optional detailed message + Exception(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + + // Returns a character string that describes the error specified by + // a major error number. + H5std_string getMajorString(hid_t err_major_id) const; + + // Returns a character string that describes the error specified by + // a minor error number. + H5std_string getMinorString(hid_t err_minor_id) const; + + // Returns the detailed message set at the time the exception is thrown + H5std_string getDetailMsg() const; + const char *getCDetailMsg() const; // C string of detailed message + H5std_string getFuncName() const; // function name as a string object + const char *getCFuncName() const; // function name as a char string + + // Turns on the automatic error printing. + static void setAutoPrint(H5E_auto2_t &func, void *client_data); + + // Turns off the automatic error printing. + static void dontPrint(); + + // Retrieves the current settings for the automatic error stack + // traversal function and its data. + static void getAutoPrint(H5E_auto2_t &func, void **client_data); + + // Clears the error stack for the current thread. + static void clearErrorStack(); + + // Walks the error stack for the current thread, calling the + // specified function. + static void walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void *client_data); + + // Prints the error stack in a default manner. + static void printErrorStack(FILE *stream = stderr, hid_t err_stack = H5E_DEFAULT); + // Deprecated in favor of printErrorStack. + // Removed from code. -BMR, 2017/08/11 1.8.20 and 1.10.2 + // virtual void printError(FILE* stream = NULL) const; + + // Default constructor + Exception(); + + // copy constructor + Exception(const Exception &orig); + + // virtual Destructor + virtual ~Exception() throw(); + + protected: + // Default value for detail_message + static const char DEFAULT_MSG[]; + + private: + H5std_string detail_message; + H5std_string func_name; +}; + +class H5_DLLCPP FileIException : public Exception { + public: + FileIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + FileIException(); + virtual ~FileIException() throw() override; +}; + +class H5_DLLCPP GroupIException : public Exception { + public: + GroupIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + GroupIException(); + virtual ~GroupIException() throw() override; +}; + +class H5_DLLCPP DataSpaceIException : public Exception { + public: + DataSpaceIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + DataSpaceIException(); + virtual ~DataSpaceIException() throw() override; +}; + +class H5_DLLCPP DataTypeIException : public Exception { + public: + DataTypeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + DataTypeIException(); + virtual ~DataTypeIException() throw() override; +}; + +class H5_DLLCPP ObjHeaderIException : public Exception { + public: + ObjHeaderIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + ObjHeaderIException(); + virtual ~ObjHeaderIException() throw() override; +}; + +class H5_DLLCPP PropListIException : public Exception { + public: + PropListIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + PropListIException(); + virtual ~PropListIException() throw() override; +}; + +class H5_DLLCPP DataSetIException : public Exception { + public: + DataSetIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + DataSetIException(); + virtual ~DataSetIException() throw() override; +}; + +class H5_DLLCPP AttributeIException : public Exception { + public: + AttributeIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + AttributeIException(); + virtual ~AttributeIException() throw() override; +}; + +class H5_DLLCPP ReferenceException : public Exception { + public: + ReferenceException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + ReferenceException(); + virtual ~ReferenceException() throw() override; +}; + +class H5_DLLCPP LibraryIException : public Exception { + public: + LibraryIException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + LibraryIException(); + virtual ~LibraryIException() throw() override; +}; + +class H5_DLLCPP LocationException : public Exception { + public: + LocationException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + LocationException(); + virtual ~LocationException() throw() override; +}; + +class H5_DLLCPP IdComponentException : public Exception { + public: + IdComponentException(const H5std_string &func_name, const H5std_string &message = DEFAULT_MSG); + IdComponentException(); + virtual ~IdComponentException() throw() override; + +}; // end of IdComponentException +} // namespace H5 + +#endif // H5Exception_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5FaccProp.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5FaccProp.h new file mode 100644 index 0000000000..27028a2bcc --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5FaccProp.h @@ -0,0 +1,170 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5FileAccPropList_H +#define H5FileAccPropList_H + +namespace H5 { + +/*! \class FileAccPropList + \brief Class FileAccPropList inherits from PropList and provides + wrappers for the HDF5 file access property list. +*/ +// Inheritance: PropList -> IdComponent +class H5_DLLCPP FileAccPropList : public PropList { + public: + ///\brief Default file access property list. + static const FileAccPropList &DEFAULT; + + // Creates a file access property list. + FileAccPropList(); + + // Modifies this property list to use the H5FD_STDIO driver + void setStdio() const; + + // Set file driver for this property list + void setDriver(hid_t new_driver_id, const void *new_driver_info) const; + + // Returns a low-level file driver identifier. + hid_t getDriver() const; + + // Sets offset for family driver. + void setFamilyOffset(hsize_t offset) const; + + // Gets offset for family driver. + hsize_t getFamilyOffset() const; + + // Modifies this file access property list to use the sec2 driver. + void setSec2() const; + + // Modifies this file access property list to use the H5FD_CORE + // driver. + void setCore(size_t increment, hbool_t backing_store) const; + + // Queries H5FD_CORE driver properties. + void getCore(size_t &increment, hbool_t &backing_store) const; + + // Sets this file access properties list to the family driver. + void setFamily(hsize_t memb_size, const FileAccPropList &memb_plist) const; + + // Returns information about the family file access property list. + void getFamily(hsize_t &memb_size, FileAccPropList &memb_plist) const; + FileAccPropList getFamily(hsize_t &memb_size) const; + + // Emulates the old split file driver, + void setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist, + const char *meta_ext = ".meta", const char *raw_ext = ".raw") const; + void setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist, + const H5std_string &meta_ext = ".meta", const H5std_string &raw_ext = ".raw") const; + + // Sets the maximum size of the data sieve buffer. + void setSieveBufSize(size_t bufsize) const; + + // Returns the current settings for the data sieve buffer size + // property + size_t getSieveBufSize() const; + + // Sets the minimum size of metadata block allocations. + void setMetaBlockSize(hsize_t &block_size) const; + + // Returns the current metadata block size setting. + hsize_t getMetaBlockSize() const; + + // Modifies this file access property list to use the logging driver. + void setLog(const char *logfile, unsigned flags, size_t buf_size) const; + void setLog(const H5std_string &logfile, unsigned flags, size_t buf_size) const; + + // Sets alignment properties of this file access property list + void setAlignment(hsize_t threshold = 1, hsize_t alignment = 1) const; + + // Retrieves the current settings for alignment properties from + // this property list. + void getAlignment(hsize_t &threshold, hsize_t &alignment) const; + + // Sets data type for multi driver. + void setMultiType(H5FD_mem_t dtype) const; + + // Returns the data type property for MULTI driver. + H5FD_mem_t getMultiType() const; + + // Sets the meta data cache and raw data chunk cache parameters. + void setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const; + + // Queries the meta data cache and raw data chunk cache parameters. + void getCache(int &mdc_nelmts, size_t &rdcc_nelmts, size_t &rdcc_nbytes, double &rdcc_w0) const; + + // Sets the degree for the file close behavior. + void setFcloseDegree(H5F_close_degree_t degree) const; + + // Returns the degree for the file close behavior. + H5F_close_degree_t getFcloseDegree() const; + + // Sets file access property list to use the H5FD_DIRECT driver. + void setFileAccDirect(size_t boundary, size_t block_size, size_t cbuf_size) const; + + // Retrieves information about the direct file access property list. + void getFileAccDirect(size_t &boundary, size_t &block_size, size_t &cbuf_size) const; + + // Sets garbage collecting references flag. + void setGcReferences(unsigned gc_ref = 0) const; + + // Returns garbage collecting references setting. + unsigned getGcReferences() const; + + // Sets file locking parameters. + void setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const; + + // Gets file locking parameters. + void getFileLocking(hbool_t &use_file_locking, hbool_t &ignore_when_disabled) const; + + // Sets bounds on versions of library format to be used when creating + // or writing objects. + void setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const; + + // Gets the current settings for the library version format bounds. + void getLibverBounds(H5F_libver_t &libver_low, H5F_libver_t &libver_high) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("FileAccPropList"); + } + + // Copy constructor: same as the original FileAccPropList. + FileAccPropList(const FileAccPropList &original); + + // Creates a copy of an existing file access property list + // using the property list id. + FileAccPropList(const hid_t plist_id); + + // Noop destructor + virtual ~FileAccPropList() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the global constant, should only be used by the library + static void deleteConstants(); + + private: + static FileAccPropList *DEFAULT_; + + // Creates the global constant, should only be used by the library + static FileAccPropList *getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of FileAccPropList +} // namespace H5 + +#endif // H5FileAccPropList_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5FcreatProp.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5FcreatProp.h new file mode 100644 index 0000000000..399db71d43 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5FcreatProp.h @@ -0,0 +1,111 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5FileCreatPropList_H +#define H5FileCreatPropList_H + +namespace H5 { + +/*! \class FileCreatPropList + \brief Class FileCreatPropList inherits from PropList and provides + wrappers for the HDF5 file create property list. +*/ +// Inheritance: PropList -> IdComponent +class H5_DLLCPP FileCreatPropList : public PropList { + public: + ///\brief Default file creation property list. + static const FileCreatPropList &DEFAULT; + + // Creates a file create property list. + FileCreatPropList(); + +#ifndef H5_NO_DEPRECATED_SYMBOLS + // Retrieves version information for various parts of a file. + void getVersion(unsigned &super, unsigned &freelist, unsigned &stab, unsigned &shhdr) const; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + // Sets the userblock size field of a file creation property list. + void setUserblock(hsize_t size) const; + + // Gets the size of a user block in this file creation property list. + hsize_t getUserblock() const; + + // Retrieves the size-of address and size quantities stored in a + // file according to this file creation property list. + void getSizes(size_t &sizeof_addr, size_t &sizeof_size) const; + + // Sets file size-of addresses and sizes. + void setSizes(size_t sizeof_addr = 4, size_t sizeof_size = 4) const; + + // Retrieves the size of the symbol table B-tree 1/2 rank and the + // symbol table leaf node 1/2 size. + void getSymk(unsigned &int_nodes_k, unsigned &leaf_nodes_k) const; + + // Sets the size of parameters used to control the symbol table nodes. + void setSymk(unsigned int_nodes_k, unsigned leaf_nodes_k) const; + + // Returns the 1/2 rank of an indexed storage B-tree. + unsigned getIstorek() const; + + // Sets the size of parameter used to control the B-trees for + // indexing chunked datasets. + void setIstorek(unsigned ik) const; + + // Sets the strategy and the threshold value that the library will + // will employ in managing file space. + void setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold) const; + + // Returns the strategy that the library uses in managing file space. + void getFileSpaceStrategy(H5F_fspace_strategy_t &strategy, hbool_t &persist, hsize_t &threshold) const; + + // Sets the file space page size for paged aggregation. + void setFileSpacePagesize(hsize_t fsp_psize) const; + + // Returns the threshold value that the library uses in tracking free + // space sections. + hsize_t getFileSpacePagesize() const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("FileCreatPropList"); + } + + // Copy constructor: same as the original FileCreatPropList. + FileCreatPropList(const FileCreatPropList &orig); + + // Creates a copy of an existing file create property list + // using the property list id. + FileCreatPropList(const hid_t plist_id); + + // Noop destructor + virtual ~FileCreatPropList() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the global constant, should only be used by the library + static void deleteConstants(); + + private: + static FileCreatPropList *DEFAULT_; + + // Creates the global constant, should only be used by the library + static FileCreatPropList *getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of FileCreatPropList +} // namespace H5 + +#endif // H5FileCreatPropList_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5File.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5File.h new file mode 100644 index 0000000000..617adaadb4 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5File.h @@ -0,0 +1,140 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5File_H +#define H5File_H + +namespace H5 { + +/*! \class H5File + \brief Class H5File represents an HDF5 file and inherits from class Group + as file is a root group. +*/ +// Inheritance: Group -> CommonFG/H5Object -> H5Location -> IdComponent +class H5_DLLCPP H5File : public Group { + public: + // Creates or opens an HDF5 file. + H5File(const char *name, unsigned int flags, + const FileCreatPropList &create_plist = FileCreatPropList::DEFAULT, + const FileAccPropList &access_plist = FileAccPropList::DEFAULT); + H5File(const H5std_string &name, unsigned int flags, + const FileCreatPropList &create_plist = FileCreatPropList::DEFAULT, + const FileAccPropList &access_plist = FileAccPropList::DEFAULT); + H5File(const char *name, unsigned int flags, const FileAccPropList &access_plist); + H5File(const H5std_string &name, unsigned int flags, const FileAccPropList &access_plist); + + // Open the file + void openFile(const H5std_string &name, unsigned int flags, + const FileAccPropList &access_plist = FileAccPropList::DEFAULT); + void openFile(const char *name, unsigned int flags, + const FileAccPropList &access_plist = FileAccPropList::DEFAULT); + + // Close this file. + virtual void close() override; + + // Gets a copy of the access property list of this file. + FileAccPropList getAccessPlist() const; + + // Gets a copy of the creation property list of this file. + FileCreatPropList getCreatePlist() const; + + // Gets general information about this file. + void getFileInfo(H5F_info2_t &file_info) const; + + // Returns the amount of free space in the file. + hssize_t getFreeSpace() const; + + // Returns the number of opened object IDs (files, datasets, groups + // and datatypes) in the same file. + ssize_t getObjCount(unsigned types = H5F_OBJ_ALL) const; + + // Retrieves a list of opened object IDs (files, datasets, groups + // and datatypes) in the same file. + void getObjIDs(unsigned types, size_t max_objs, hid_t *oid_list) const; + + // Returns the pointer to the file handle of the low-level file driver. + void getVFDHandle(void **file_handle) const; + void getVFDHandle(const FileAccPropList &fapl, void **file_handle) const; + // void getVFDHandle(FileAccPropList& fapl, void **file_handle) const; // removed from 1.8.18 and 1.10.1 + + // Returns the file size of the HDF5 file. + hsize_t getFileSize() const; + + // Returns the 'file number' of the HDF5 file. + unsigned long getFileNum() const; + + // Determines if a file, specified by its name, is in HDF5 format + static bool isHdf5(const char *name); + static bool isHdf5(const H5std_string &name); + + // Determines if a file, specified by its name, can be accessed as HDF5 + static bool isAccessible(const char *name, + const FileAccPropList &access_plist = FileAccPropList::DEFAULT); + static bool isAccessible(const H5std_string &name, + const FileAccPropList &access_plist = FileAccPropList::DEFAULT); + + // Reopens this file. + void reOpen(); // added for better name + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + void reopen(); // obsolete in favor of reOpen() + + // Creates an H5File using an existing file id. Not recommended + // in applications. + H5File(hid_t existing_id); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("H5File"); + } + + // Throw file exception. + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const override; + + // For CommonFG to get the file id. + virtual hid_t getLocId() const override; + + // Default constructor + H5File(); + + // Copy constructor: same as the original H5File. + H5File(const H5File &original); + + // Gets the HDF5 file id. + virtual hid_t getId() const override; + + // H5File destructor. + virtual ~H5File() override; + + protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Sets the HDF5 file id. + virtual void p_setId(const hid_t new_id) override; +#endif // DOXYGEN_SHOULD_SKIP_THIS + + private: + hid_t id; // HDF5 file id + + // This function is private and contains common code between the + // constructors taking a string or a char* + void p_get_file(const char *name, unsigned int flags, const FileCreatPropList &create_plist, + const FileAccPropList &access_plist); + +}; // end of H5File +} // namespace H5 + +#endif // H5File_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5FloatType.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5FloatType.h new file mode 100644 index 0000000000..42437ec115 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5FloatType.h @@ -0,0 +1,86 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5FloatType_H +#define H5FloatType_H + +namespace H5 { + +/*! \class FloatType + \brief FloatType is a derivative of a DataType and operates on HDF5 + floating point datatype. +*/ +// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent +class H5_DLLCPP FloatType : public AtomType { + public: + // Creates a floating-point type using a predefined type. + FloatType(const PredType &pred_type); + + // Gets the floating-point datatype of the specified dataset. + FloatType(const DataSet &dataset); + + // Constructors that open an HDF5 float datatype, given a location. + FloatType(const H5Location &loc, const char *name); + FloatType(const H5Location &loc, const H5std_string &name); + + // Returns an FloatType object via DataType* by decoding the + // binary object description of this type. + virtual DataType *decode() const override; + + // Retrieves the exponent bias of a floating-point type. + size_t getEbias() const; + + // Sets the exponent bias of a floating-point type. + void setEbias(size_t ebias) const; + + // Retrieves floating point datatype bit field information. + void getFields(size_t &spos, size_t &epos, size_t &esize, size_t &mpos, size_t &msize) const; + + // Sets locations and sizes of floating point bit fields. + void setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const; + + // Retrieves the internal padding type for unused bits in floating-point datatypes. + H5T_pad_t getInpad(H5std_string &pad_string) const; + + // Fills unused internal floating point bits. + void setInpad(H5T_pad_t inpad) const; + + // Retrieves mantissa normalization of a floating-point datatype. + H5T_norm_t getNorm(H5std_string &norm_string) const; + + // Sets the mantissa normalization of a floating-point datatype. + void setNorm(H5T_norm_t norm) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("FloatType"); + } + + // Default constructor + FloatType(); + + // Creates a floating-point datatype using an existing id. + FloatType(const hid_t existing_id); + + // Copy constructor: same as the original FloatType. + FloatType(const FloatType &original); + + // Noop destructor. + virtual ~FloatType() override; + +}; // end of FloatType +} // namespace H5 + +#endif // H5FloatType_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Group.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Group.h new file mode 100644 index 0000000000..cb9b0920f8 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Group.h @@ -0,0 +1,85 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5Group_H +#define H5Group_H + +namespace H5 { + +/*! \class Group + \brief Class Group represents an HDF5 group. +*/ +// Inheritance: CommonFG/H5Object -> H5Location -> IdComponent +class H5_DLLCPP Group : public H5Object, public CommonFG { + public: + // Close this group. + virtual void close() override; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("Group"); + } + + // Throw group exception. + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const override; + + // for CommonFG to get the file id. + virtual hid_t getLocId() const override; + + // Creates a group by way of dereference. + Group(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT, + const PropList &plist = PropList::DEFAULT); + // Removed in 1.10.1, because H5Location is baseclass + // Group(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const PropList& + // plist = PropList::DEFAULT); + + // Returns the number of objects in this group. + hsize_t getNumObjs() const; + + // Opens an object within a group or a file, i.e., root group. + hid_t getObjId(const char *name, const PropList &plist = PropList::DEFAULT) const; + hid_t getObjId(const H5std_string &name, const PropList &plist = PropList::DEFAULT) const; + + // Closes an object opened by getObjId(). + void closeObjId(hid_t obj_id) const; + + // default constructor + Group(); + + // Copy constructor: same as the original Group. + Group(const Group &original); + + // Gets the group id. + virtual hid_t getId() const override; + + // Destructor + virtual ~Group() override; + + // Creates a copy of an existing group using its id. + Group(const hid_t group_id); + + protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // Sets the group id. + virtual void p_setId(const hid_t new_id) override; +#endif // DOXYGEN_SHOULD_SKIP_THIS + + private: + hid_t id; // HDF5 group id + +}; // end of Group +} // namespace H5 + +#endif // H5Group_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5IdComponent.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5IdComponent.h new file mode 100644 index 0000000000..d64bdb5ab7 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5IdComponent.h @@ -0,0 +1,115 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5IdComponent_H +#define H5IdComponent_H + +namespace H5 { + +/*! \class IdComponent + \brief Class IdComponent provides wrappers of the C functions that + operate on an HDF5 identifier. + + In most cases, the C library handles these operations and an application + rarely needs them. +*/ +class H5_DLLCPP IdComponent { + public: + // Increment reference counter. + void incRefCount(const hid_t obj_id) const; + void incRefCount() const; + + // Decrement reference counter. + void decRefCount(const hid_t obj_id) const; + void decRefCount() const; + + // Get the reference counter to this identifier. + int getCounter(const hid_t obj_id) const; + int getCounter() const; + + // Returns an HDF5 object type, given the object id. + static H5I_type_t getHDFObjType(const hid_t obj_id); + + // Returns an HDF5 object type of this object. + H5I_type_t getHDFObjType() const; + + // Returns the number of members in a type. + static hsize_t getNumMembers(H5I_type_t type); + + // Checks if the given ID is valid. + static bool isValid(hid_t an_id); + + // Determines if an type exists. + static bool typeExists(H5I_type_t type); + + // Assignment operator. + IdComponent &operator=(const IdComponent &rhs); + + // Sets the identifier of this object to a new value. + void setId(const hid_t new_id); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Gets the identifier of this object. + virtual hid_t getId() const = 0; + + // Pure virtual function for there are various H5*close for the + // subclasses. + virtual void close() = 0; + + // Makes and returns the string "::"; + // is returned by fromClass(). + H5std_string inMemFunc(const char *func_name) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const + { + return ("IdComponent"); + } + +#endif // DOXYGEN_SHOULD_SKIP_THIS + + // Destructor + virtual ~IdComponent(); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + protected: + // Default constructor. + IdComponent(); + + // Gets the name of the file, in which an HDF5 object belongs. + H5std_string p_get_file_name() const; + + // Verifies that the given id is valid. + static bool p_valid_id(const hid_t obj_id); + + // Sets the identifier of this object to a new value. - this one + // doesn't increment reference count + virtual void p_setId(const hid_t new_id) = 0; + + // This flag is used to decide whether H5dont_atexit should be called + static bool H5dontAtexit_called; + + private: + // This flag indicates whether H5Library::initH5cpp has been called + // to register various terminating functions with atexit() + static bool H5cppinit; + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end class IdComponent +} // namespace H5 + +#endif // H5IdComponent_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Include.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Include.h new file mode 100644 index 0000000000..a55cbe4f4c --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Include.h @@ -0,0 +1,25 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +// These are defined in H5Opkg.h, which should not be included in the C++ API, +// so re-define them here for now. + +/* Initial version of the object header format */ +#define H5O_VERSION_1 1 + +/* Revised version - leaves out reserved bytes and alignment padding, and adds + * magic number as prefix and checksum as suffix for all chunks. + */ +#define H5O_VERSION_2 2 diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5IntType.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5IntType.h new file mode 100644 index 0000000000..170ed374d4 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5IntType.h @@ -0,0 +1,68 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5IntType_H +#define H5IntType_H + +namespace H5 { + +/*! \class IntType + \brief IntType is a derivative of a DataType and operates on HDF5 + integer datatype. +*/ +// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent +class H5_DLLCPP IntType : public AtomType { + public: + // Creates an integer type using a predefined type + IntType(const PredType &pred_type); + + // Gets the integer datatype of the specified dataset + IntType(const DataSet &dataset); + + // Constructors that open an HDF5 integer datatype, given a location. + IntType(const H5Location &loc, const char *name); + IntType(const H5Location &loc, const H5std_string &name); + + // Returns an IntType object via DataType* by decoding the + // binary object description of this type. + virtual DataType *decode() const override; + + // Retrieves the sign type for an integer type + H5T_sign_t getSign() const; + + // Sets the sign property for an integer type. + void setSign(H5T_sign_t sign) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("IntType"); + } + + // Default constructor + IntType(); + + // Creates a integer datatype using an existing id + IntType(const hid_t existing_id); + + // Copy constructor: same as the original IntType. + IntType(const IntType &original); + + // Noop destructor. + virtual ~IntType() override; + +}; // end of IntType +} // namespace H5 + +#endif // H5IntType_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5LaccProp.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5LaccProp.h new file mode 100644 index 0000000000..53389e2e68 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5LaccProp.h @@ -0,0 +1,72 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5LinkAccPropList_H +#define H5LinkAccPropList_H + +namespace H5 { + +/*! \class LinkAccPropList + \brief Class LinkAccPropList inherits from PropList and provides + wrappers for the HDF5 link access property list. +*/ +// Inheritance: PropList -> IdComponent +class H5_DLLCPP LinkAccPropList : public PropList { + public: + ///\brief Default link access property list. + static const LinkAccPropList &DEFAULT; + + // Creates a link access property list. + LinkAccPropList(); + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("LinkAccPropList"); + } + + // Copy constructor: same as the original LinkAccPropList. + LinkAccPropList(const LinkAccPropList &original); + + // Creates a copy of an existing link access property list + // using the property list id. + LinkAccPropList(const hid_t plist_id); + + // Sets the number of soft or user-defined links that can be + // traversed before a failure occurs. + void setNumLinks(size_t nlinks) const; + + // Gets the number of soft or user-defined link traversals allowed + size_t getNumLinks() const; + + // Noop destructor + virtual ~LinkAccPropList() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the global constant, should only be used by the library + static void deleteConstants(); + + private: + static LinkAccPropList *DEFAULT_; + + // Creates the global constant, should only be used by the library + static LinkAccPropList *getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of LinkAccPropList +} // namespace H5 + +#endif // H5LinkAccPropList_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5LcreatProp.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5LcreatProp.h new file mode 100644 index 0000000000..233a98bd92 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5LcreatProp.h @@ -0,0 +1,79 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5LinkCreatPropList_H +#define H5LinkCreatPropList_H + +namespace H5 { + +/*! \class LinkCreatPropList + \brief Class LinkCreatPropList inherits from PropList and provides + wrappers for the HDF5 link creation property list. +*/ +// Inheritance: PropList -> IdComponent +class H5_DLLCPP LinkCreatPropList : public PropList { + public: + ///\brief Default link creation property list. + static const LinkCreatPropList &DEFAULT; + + // Creates a link creation property list. + LinkCreatPropList(); + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("LinkCreatPropList"); + } + + // Copy constructor: same as the original LinkCreatPropList. + LinkCreatPropList(const LinkCreatPropList &original); + + // Creates a copy of an existing link creation property list + // using the property list id. + LinkCreatPropList(const hid_t plist_id); + + // Specifies in property list whether to create missing + // intermediate groups + void setCreateIntermediateGroup(bool crt_intmd_group) const; + + // Determines whether property is set to enable creating missing + // intermediate groups + bool getCreateIntermediateGroup() const; + + // Sets the character encoding of the string. + void setCharEncoding(H5T_cset_t encoding) const; + + // Gets the character encoding of the string. + H5T_cset_t getCharEncoding() const; + + // Noop destructor + virtual ~LinkCreatPropList() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the global constant, should only be used by the library + static void deleteConstants(); + + private: + static LinkCreatPropList *DEFAULT_; + + // Creates the global constant, should only be used by the library + static LinkCreatPropList *getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of LinkCreatPropList +} // namespace H5 + +#endif // H5LinkCreatPropList_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Library.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Library.h new file mode 100644 index 0000000000..3770639155 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Library.h @@ -0,0 +1,71 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5Library_H +#define H5Library_H + +namespace H5 { + +/*! \class H5Library + \brief Class H5Library operates the HDF5 library globably. + + It is not necessary to construct an instance of H5Library to use the + methods. +*/ +class H5_DLLCPP H5Library { + public: + // Initializes the HDF5 library. + static void open(); + + // Flushes all data to disk, closes files, and cleans up memory. + static void close(); + + // Instructs library not to install atexit cleanup routine + static void dontAtExit(); + + // Returns the HDF library release number. + static void getLibVersion(unsigned &majnum, unsigned &minnum, unsigned &relnum); + + // Verifies that the arguments match the version numbers compiled + // into the library + static void checkVersion(unsigned majnum, unsigned minnum, unsigned relnum); + + // Walks through all the garbage collection routines for the library, + // which are supposed to free any unused memory they have allocated. + static void garbageCollect(); + + // Sets limits on the different kinds of free lists. + static void setFreeListLimits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim, + int blk_global_lim, int blk_list_lim); + + // Initializes C++ library and registers terminating functions at exit. + // Only for the library functions, not for user-defined functions. + static void initH5cpp(void); + + // Sends request for terminating the HDF5 library. + static void termH5cpp(void); + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + private: + // Default constructor - no instance ever created from outsiders + H5Library(); + + // Destructor + ~H5Library(); +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of H5Library +} // namespace H5 + +#endif // H5Library_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Location.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Location.h new file mode 100644 index 0000000000..ee45d679de --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Location.h @@ -0,0 +1,341 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5Location_H +#define H5Location_H + +#include "H5Classes.h" // contains forward class declarations + +namespace H5 { + +/*! \class H5Location + \brief H5Location is an abstract base class, added in version 1.8.12. + + It provides a collection of wrappers for the C functions that take a + location identifier to specify the HDF5 object. The location identifier + can be either file, group, dataset, attribute, or named datatype. + Wrappers for H5A functions stay in H5Object. +*/ +// Inheritance: IdComponent +class H5_DLLCPP H5Location : public IdComponent { + public: + // Checks if a link of a given name exists in a location + bool nameExists(const char *name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + bool nameExists(const H5std_string &name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Checks if a link of a given name exists in a location + // Deprecated in favor of nameExists for better name. + bool exists(const char *name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + bool exists(const H5std_string &name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Flushes all buffers associated with this location to disk. + void flush(H5F_scope_t scope) const; + + // Gets the name of the file, specified by this location. + H5std_string getFileName() const; + +#ifndef H5_NO_DEPRECATED_SYMBOLS + // Retrieves the type of object that an object reference points to. + H5G_obj_t getObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + // Retrieves the type of object that an object reference points to. + H5O_type_t getRefObjType(void *ref, H5R_type_t ref_type = H5R_OBJECT) const; + // Note: getRefObjType deprecates getObjType, but getObjType's name is + // misleading, so getRefObjType is used in the new function instead. + + // Sets the comment for an HDF5 object specified by its name. + void setComment(const char *name, const char *comment) const; + void setComment(const H5std_string &name, const H5std_string &comment) const; + void setComment(const char *comment) const; + void setComment(const H5std_string &comment) const; + + // Retrieves comment for the HDF5 object specified by its name. + ssize_t getComment(const char *name, size_t buf_size, char *comment) const; + H5std_string getComment(const char *name, size_t buf_size = 0) const; + H5std_string getComment(const H5std_string &name, size_t buf_size = 0) const; + + // Removes the comment for the HDF5 object specified by its name. + void removeComment(const char *name) const; + void removeComment(const H5std_string &name) const; + + // Creates a reference to a named object or to a dataset region + // in this object. + void reference(void *ref, const char *name, H5R_type_t ref_type = H5R_OBJECT) const; + void reference(void *ref, const H5std_string &name, H5R_type_t ref_type = H5R_OBJECT) const; + void reference(void *ref, const char *name, const DataSpace &dataspace, + H5R_type_t ref_type = H5R_DATASET_REGION) const; + void reference(void *ref, const H5std_string &name, const DataSpace &dataspace, + H5R_type_t ref_type = H5R_DATASET_REGION) const; + + // Open a referenced object whose location is specified by either + // a file, an HDF5 object, or an attribute. + void dereference(const H5Location &loc, const void *ref, H5R_type_t ref_type = H5R_OBJECT, + const PropList &plist = PropList::DEFAULT); + // Removed in 1.10.1, because H5Location is baseclass + // void dereference(const Attribute& attr, const void* ref, H5R_type_t ref_type = H5R_OBJECT, const + // PropList& plist = PropList::DEFAULT); + + // Retrieves a dataspace with the region pointed to selected. + DataSpace getRegion(void *ref, H5R_type_t ref_type = H5R_DATASET_REGION) const; + + // Create a new group with using link create property list. + Group createGroup(const char *name, const LinkCreatPropList &lcpl) const; + Group createGroup(const H5std_string &name, const LinkCreatPropList &lcpl) const; + + // From CommonFG + // Creates a new group at this location which can be a file + // or another group. + Group createGroup(const char *name, size_t size_hint = 0) const; + Group createGroup(const H5std_string &name, size_t size_hint = 0) const; + + // Opens an existing group in a location which can be a file + // or another group. + Group openGroup(const char *name) const; + Group openGroup(const H5std_string &name) const; + + // Creates a new dataset in this location. + DataSet createDataSet(const char *name, const DataType &data_type, const DataSpace &data_space, + const DSetCreatPropList &create_plist = DSetCreatPropList::DEFAULT, + const DSetAccPropList &dapl = DSetAccPropList::DEFAULT, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT) const; + DataSet createDataSet(const H5std_string &name, const DataType &data_type, const DataSpace &data_space, + const DSetCreatPropList &create_plist = DSetCreatPropList::DEFAULT, + const DSetAccPropList &dapl = DSetAccPropList::DEFAULT, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT) const; + + // Deprecated to add LinkCreatPropList and DSetAccPropList - 1.10.3 + // DataSet createDataSet(const char* name, const DataType& data_type, const DataSpace& data_space, const + // DSetCreatPropList& create_plist = DSetCreatPropList::DEFAULT) const; DataSet createDataSet(const + // H5std_string& name, const DataType& data_type, const DataSpace& data_space, const DSetCreatPropList& + // create_plist = DSetCreatPropList::DEFAULT) const; + + // Opens an existing dataset at this location. + // DSetAccPropList is added - 1.10.3 + DataSet openDataSet(const char *name, const DSetAccPropList &dapl = DSetAccPropList::DEFAULT) const; + DataSet openDataSet(const H5std_string &name, + const DSetAccPropList &dapl = DSetAccPropList::DEFAULT) const; + + H5L_info2_t getLinkInfo(const char *link_name, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + H5L_info2_t getLinkInfo(const H5std_string &link_name, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Returns the value of a symbolic link. + H5std_string getLinkval(const char *link_name, size_t size = 0) const; + H5std_string getLinkval(const H5std_string &link_name, size_t size = 0) const; + + // Returns the number of objects in this group. + // Deprecated - moved to H5::Group in 1.10.2. + hsize_t getNumObjs() const; + + // Retrieves the name of an object in this group, given the + // object's index. + H5std_string getObjnameByIdx(hsize_t idx) const; + ssize_t getObjnameByIdx(hsize_t idx, char *name, size_t size) const; + ssize_t getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const; + + // Retrieves the type of an object in this file or group, given the + // object's name + H5O_type_t childObjType(const H5std_string &objname) const; + H5O_type_t childObjType(const char *objname) const; + H5O_type_t childObjType(hsize_t index, H5_index_t index_type = H5_INDEX_NAME, + H5_iter_order_t order = H5_ITER_INC, const char *objname = ".") const; + + // Returns the object header version of an object in this file or group, + // given the object's name. + unsigned childObjVersion(const char *objname) const; + unsigned childObjVersion(const H5std_string &objname) const; + + // Retrieves information about an HDF5 object. + void getObjinfo(H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC) const; + + // Retrieves information about an HDF5 object, given its name. + void getObjinfo(const char *name, H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void getObjinfo(const H5std_string &name, H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Retrieves information about an HDF5 object, given its index. + void getObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, + H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void getObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, + H5O_info2_t &objinfo, unsigned fields = H5O_INFO_BASIC, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Retrieves native native information about an HDF5 object. + void getNativeObjinfo(H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR) const; + + // Retrieves native information about an HDF5 object, given its name. + void getNativeObjinfo(const char *name, H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void getNativeObjinfo(const H5std_string &name, H5O_native_info_t &objinfo, + unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Retrieves native information about an HDF5 object, given its index. + void getNativeObjinfo(const char *grp_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t idx, + H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void getNativeObjinfo(const H5std_string &grp_name, H5_index_t idx_type, H5_iter_order_t order, + hsize_t idx, H5O_native_info_t &objinfo, unsigned fields = H5O_NATIVE_INFO_HDR, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + +#ifndef H5_NO_DEPRECATED_SYMBOLS + // Returns the type of an object in this group, given the + // object's index. + H5G_obj_t getObjTypeByIdx(hsize_t idx) const; + H5G_obj_t getObjTypeByIdx(hsize_t idx, char *type_name) const; + H5G_obj_t getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const; + + // Returns information about an HDF5 object, given by its name, + // at this location. - Deprecated + void getObjinfo(const char *name, hbool_t follow_link, H5G_stat_t &statbuf) const; + void getObjinfo(const H5std_string &name, hbool_t follow_link, H5G_stat_t &statbuf) const; + void getObjinfo(const char *name, H5G_stat_t &statbuf) const; + void getObjinfo(const H5std_string &name, H5G_stat_t &statbuf) const; + + // Iterates over the elements of this group - not implemented in + // C++ style yet. + int iterateElems(const char *name, int *idx, H5G_iterate_t op, void *op_data); + int iterateElems(const H5std_string &name, int *idx, H5G_iterate_t op, void *op_data); +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + // Creates a soft link from link_name to target_name. + void link(const char *target_name, const char *link_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void link(const H5std_string &target_name, const H5std_string &link_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Creates a hard link from new_name to curr_name. + void link(const char *curr_name, const Group &new_loc, const char *new_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void link(const H5std_string &curr_name, const Group &new_loc, const H5std_string &new_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Creates a hard link from new_name to curr_name in same location. + void link(const char *curr_name, const hid_t same_loc, const char *new_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void link(const H5std_string &curr_name, const hid_t same_loc, const H5std_string &new_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Creates a link of the specified type from new_name to current_name; + // both names are interpreted relative to the specified location id. + // Deprecated due to inadequate functionality. + void link(H5L_type_t link_type, const char *curr_name, const char *new_name) const; + void link(H5L_type_t link_type, const H5std_string &curr_name, const H5std_string &new_name) const; + + // Removes the specified link from this location. + void unlink(const char *link_name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void unlink(const H5std_string &link_name, const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Mounts the file 'child' onto this location. + void mount(const char *name, const H5File &child, const PropList &plist) const; + void mount(const H5std_string &name, const H5File &child, const PropList &plist) const; + + // Unmounts the file named 'name' from this parent location. + void unmount(const char *name) const; + void unmount(const H5std_string &name) const; + + // Copies a link from a group to another. + void copyLink(const char *src_name, const Group &dst, const char *dst_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void copyLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Makes a copy of a link in the same group. + void copyLink(const char *src_name, const char *dst_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void copyLink(const H5std_string &src_name, const H5std_string &dst_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Renames a link in this group and moves to a new location. + void moveLink(const char *src_name, const Group &dst, const char *dst_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void moveLink(const H5std_string &src_name, const Group &dst, const H5std_string &dst_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Renames a link in this group. + void moveLink(const char *src_name, const char *dst_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + void moveLink(const H5std_string &src_name, const H5std_string &dst_name, + const LinkCreatPropList &lcpl = LinkCreatPropList::DEFAULT, + const LinkAccPropList &lapl = LinkAccPropList::DEFAULT) const; + + // Renames an object at this location. + // Deprecated due to inadequate functionality. + void move(const char *src, const char *dst) const; + void move(const H5std_string &src, const H5std_string &dst) const; + + // end From CommonFG + + /// For subclasses, H5File and Group, to throw appropriate exception. + virtual void throwException(const H5std_string &func_name, const H5std_string &msg) const; + + // Default constructor + H5Location(); + + protected: +#ifndef DOXYGEN_SHOULD_SKIP_THIS + // *** Deprecation warning *** + // The following two constructors are no longer appropriate after the + // data member "id" had been moved to the sub-classes. + // The copy constructor is a noop and is removed in 1.8.15 and the + // other will be removed from 1.10 release, and then from 1.8 if its + // removal does not raise any problems in two 1.10 releases. + + // Creates a copy of an existing object giving the location id. + // H5Location(const hid_t loc_id); + + // Creates a reference to an HDF5 object or a dataset region. + void p_reference(void *ref, const char *name, hid_t space_id, H5R_type_t ref_type) const; + + // Dereferences a ref into an HDF5 id. + hid_t p_dereference(hid_t loc_id, const void *ref, H5R_type_t ref_type, const PropList &plist, + const char *from_func); + +#ifndef H5_NO_DEPRECATED_SYMBOLS + // Retrieves the type of object that an object reference points to. + H5G_obj_t p_get_obj_type(void *ref, H5R_type_t ref_type) const; +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + + // Retrieves the type of object that an object reference points to. + H5O_type_t p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const; + + // Sets the identifier of this object to a new value. - this one + // doesn't increment reference count + // virtual void p_setId(const hid_t new_id); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + + // Noop destructor. + virtual ~H5Location() override; + +}; // end of H5Location +} // namespace H5 + +#endif // H5Location_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Object.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Object.h new file mode 100644 index 0000000000..1e93c0c826 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5Object.h @@ -0,0 +1,134 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5Object_H +#define H5Object_H + +namespace H5 { + +/*! \class H5Object + \brief Class H5Object is a bridge between H5Location and DataSet, DataType, + and Group. + + Modification: + Sept 18, 2012: Added class H5Location in between IdComponent and + H5Object. An H5File now inherits from H5Location. All HDF5 + wrappers in H5Object are moved up to H5Location. H5Object + is left mostly empty for future wrappers that are only for + group, dataset, and named datatype. Note that the reason for + adding H5Location instead of simply moving H5File to be under + H5Object is H5File is not an HDF5 object, and renaming H5Object + to H5Location will risk breaking user applications. + -BMR + Apr 2, 2014: Added wrapper getObjName for H5Iget_name + Sep 21, 2016: Rearranging classes (HDFFV-9920) moved H5A wrappers back + into H5Object. This way, C functions that takes attribute id + can be in H5Location and those that cannot take attribute id + can be in H5Object. +*/ +// Inheritance: H5Location -> IdComponent + +// Define the operator function pointer for H5Aiterate(). +typedef void (*attr_operator_t)(H5Object &loc, const H5std_string attr_name, void *operator_data); + +// Define the operator function pointer for H5Ovisit3(). +typedef int (*visit_operator_t)(H5Object &obj, const H5std_string attr_name, const H5O_info2_t *oinfo, + void *operator_data); + +// User data for attribute iteration +class UserData4Aiterate { + public: + attr_operator_t op; + void *opData; + H5Object *location; // Consider changing to H5Location +}; + +// User data for visit iteration +class UserData4Visit { + public: + visit_operator_t op; + void *opData; + H5Object *obj; +}; + +class H5_DLLCPP H5Object : public H5Location { + public: + // Creates an attribute for the specified object + // PropList is currently not used, so always be default. + Attribute createAttribute(const char *name, const DataType &type, const DataSpace &space, + const PropList &create_plist = PropList::DEFAULT) const; + Attribute createAttribute(const H5std_string &name, const DataType &type, const DataSpace &space, + const PropList &create_plist = PropList::DEFAULT) const; + + // Given its name, opens the attribute that belongs to an object at + // this location. + Attribute openAttribute(const char *name) const; + Attribute openAttribute(const H5std_string &name) const; + + // Given its index, opens the attribute that belongs to an object at + // this location. + Attribute openAttribute(const unsigned int idx) const; + + // Iterate user's function over the attributes of this object. + int iterateAttrs(attr_operator_t user_op, unsigned *idx = NULL, void *op_data = NULL); + + // Recursively visit elements reachable from this object. + void visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, + unsigned int fields); + + // Returns the object header version of an object + unsigned objVersion() const; + + // Determines the number of attributes belong to this object. + int getNumAttrs() const; + + // Checks whether the named attribute exists for this object. + bool attrExists(const char *name) const; + bool attrExists(const H5std_string &name) const; + + // Renames the named attribute to a new name. + void renameAttr(const char *oldname, const char *newname) const; + void renameAttr(const H5std_string &oldname, const H5std_string &newname) const; + + // Removes the named attribute from this object. + void removeAttr(const char *name) const; + void removeAttr(const H5std_string &name) const; + + // Returns an identifier. + virtual hid_t getId() const override = 0; + + // Gets the name of this HDF5 object, i.e., Group, DataSet, or + // DataType. + ssize_t getObjName(char *obj_name, size_t buf_size = 0) const; + ssize_t getObjName(H5std_string &obj_name, size_t len = 0) const; + H5std_string getObjName() const; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + protected: + // Default constructor + H5Object(); + + // Sets the identifier of this object to a new value. - this one + // doesn't increment reference count + virtual void p_setId(const hid_t new_id) override = 0; + + // Noop destructor. + virtual ~H5Object() override; + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of H5Object +} // namespace H5 + +#endif // H5Object_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5OcreatProp.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5OcreatProp.h new file mode 100644 index 0000000000..6d752ed9c9 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5OcreatProp.h @@ -0,0 +1,77 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5ObjCreatPropList_H +#define H5ObjCreatPropList_H + +namespace H5 { + +/*! \class ObjCreatPropList + \brief Class ObjCreatPropList inherits from PropList and provides + wrappers for the HDF5 object create property list. +*/ +// Inheritance: PropList -> IdComponent +class H5_DLLCPP ObjCreatPropList : public PropList { + public: + ///\brief Default object creation property list. + static const ObjCreatPropList &DEFAULT; + + // Creates a object creation property list. + ObjCreatPropList(); + + // Sets attribute storage phase change thresholds. + void setAttrPhaseChange(unsigned max_compact = 8, unsigned min_dense = 6) const; + + // Gets attribute storage phase change thresholds. + void getAttrPhaseChange(unsigned &max_compact, unsigned &min_dense) const; + + // Sets tracking and indexing of attribute creation order. + void setAttrCrtOrder(unsigned crt_order_flags) const; + + // Gets tracking and indexing settings for attribute creation order. + unsigned getAttrCrtOrder() const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("ObjCreatPropList"); + } + + // Copy constructor: same as the original ObjCreatPropList. + ObjCreatPropList(const ObjCreatPropList &original); + + // Creates a copy of an existing object creation property list + // using the property list id. + ObjCreatPropList(const hid_t plist_id); + + // Noop destructor + virtual ~ObjCreatPropList() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the global constant, should only be used by the library + static void deleteConstants(); + + private: + static ObjCreatPropList *DEFAULT_; + + // Creates the global constant, should only be used by the library + static ObjCreatPropList *getConstant(); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of ObjCreatPropList +} // namespace H5 + +#endif // H5ObjCreatPropList_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5PredType.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5PredType.h new file mode 100644 index 0000000000..1e305fc00a --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5PredType.h @@ -0,0 +1,379 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5PredType_H +#define H5PredType_H + +namespace H5 { + +/*! \class PredType + \brief Class PredType holds the definition of all the HDF5 predefined + datatypes. + + These types can only be made copy of, not created by H5Tcreate or + closed by H5Tclose. They are treated as constants. +*/ +// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent +class H5_DLLCPP PredType : public AtomType { + public: + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("PredType"); + } + + // Makes a copy of the predefined type and stores the new + // id in the left hand side object. + PredType &operator=(const PredType &rhs); + + // Copy constructor: same as the original PredType. + PredType(const PredType &original); + + // Noop destructor + virtual ~PredType() override; + + /*! \brief This dummy function do not inherit from DataType - it will + throw a DataTypeIException if invoked. + */ + void commit(H5Location &loc, const H5std_string &name); + /*! \brief This dummy function do not inherit from DataType - it will + throw a DataTypeIException if invoked. + */ + void commit(H5Location &loc, const char *name); + /*! \brief This dummy function do not inherit from DataType - it will + throw a DataTypeIException if invoked. + */ + bool committed(); + + ///\brief PredType constants + static const PredType &STD_I8BE; + static const PredType &STD_I8LE; + static const PredType &STD_I16BE; + static const PredType &STD_I16LE; + static const PredType &STD_I32BE; + static const PredType &STD_I32LE; + static const PredType &STD_I64BE; + static const PredType &STD_I64LE; + static const PredType &STD_U8BE; + static const PredType &STD_U8LE; + static const PredType &STD_U16BE; + static const PredType &STD_U16LE; + static const PredType &STD_U32BE; + static const PredType &STD_U32LE; + static const PredType &STD_U64BE; + static const PredType &STD_U64LE; + static const PredType &STD_B8BE; + static const PredType &STD_B8LE; + static const PredType &STD_B16BE; + static const PredType &STD_B16LE; + static const PredType &STD_B32BE; + static const PredType &STD_B32LE; + static const PredType &STD_B64BE; + static const PredType &STD_B64LE; + static const PredType &STD_REF_OBJ; + static const PredType &STD_REF_DSETREG; + + static const PredType &C_S1; + static const PredType &FORTRAN_S1; + + static const PredType &IEEE_F32BE; + static const PredType &IEEE_F32LE; + static const PredType &IEEE_F64BE; + static const PredType &IEEE_F64LE; + + static const PredType &UNIX_D32BE; + static const PredType &UNIX_D32LE; + static const PredType &UNIX_D64BE; + static const PredType &UNIX_D64LE; + + static const PredType &INTEL_I8; + static const PredType &INTEL_I16; + static const PredType &INTEL_I32; + static const PredType &INTEL_I64; + static const PredType &INTEL_U8; + static const PredType &INTEL_U16; + static const PredType &INTEL_U32; + static const PredType &INTEL_U64; + static const PredType &INTEL_B8; + static const PredType &INTEL_B16; + static const PredType &INTEL_B32; + static const PredType &INTEL_B64; + static const PredType &INTEL_F32; + static const PredType &INTEL_F64; + + static const PredType &ALPHA_I8; + static const PredType &ALPHA_I16; + static const PredType &ALPHA_I32; + static const PredType &ALPHA_I64; + static const PredType &ALPHA_U8; + static const PredType &ALPHA_U16; + static const PredType &ALPHA_U32; + static const PredType &ALPHA_U64; + static const PredType &ALPHA_B8; + static const PredType &ALPHA_B16; + static const PredType &ALPHA_B32; + static const PredType &ALPHA_B64; + static const PredType &ALPHA_F32; + static const PredType &ALPHA_F64; + + static const PredType &MIPS_I8; + static const PredType &MIPS_I16; + static const PredType &MIPS_I32; + static const PredType &MIPS_I64; + static const PredType &MIPS_U8; + static const PredType &MIPS_U16; + static const PredType &MIPS_U32; + static const PredType &MIPS_U64; + static const PredType &MIPS_B8; + static const PredType &MIPS_B16; + static const PredType &MIPS_B32; + static const PredType &MIPS_B64; + static const PredType &MIPS_F32; + static const PredType &MIPS_F64; + + static const PredType &NATIVE_CHAR; + static const PredType &NATIVE_SCHAR; + static const PredType &NATIVE_UCHAR; + static const PredType &NATIVE_SHORT; + static const PredType &NATIVE_USHORT; + static const PredType &NATIVE_INT; + static const PredType &NATIVE_UINT; + static const PredType &NATIVE_LONG; + static const PredType &NATIVE_ULONG; + static const PredType &NATIVE_LLONG; + static const PredType &NATIVE_ULLONG; + static const PredType &NATIVE_FLOAT; + static const PredType &NATIVE_DOUBLE; + static const PredType &NATIVE_LDOUBLE; + static const PredType &NATIVE_B8; + static const PredType &NATIVE_B16; + static const PredType &NATIVE_B32; + static const PredType &NATIVE_B64; + static const PredType &NATIVE_OPAQUE; + static const PredType &NATIVE_HSIZE; + static const PredType &NATIVE_HSSIZE; + static const PredType &NATIVE_HERR; + static const PredType &NATIVE_HBOOL; + + static const PredType &NATIVE_INT8; + static const PredType &NATIVE_UINT8; + static const PredType &NATIVE_INT16; + static const PredType &NATIVE_UINT16; + static const PredType &NATIVE_INT32; + static const PredType &NATIVE_UINT32; + static const PredType &NATIVE_INT64; + static const PredType &NATIVE_UINT64; + + // LEAST types + static const PredType &NATIVE_INT_LEAST8; + static const PredType &NATIVE_UINT_LEAST8; + + static const PredType &NATIVE_INT_LEAST16; + static const PredType &NATIVE_UINT_LEAST16; + + static const PredType &NATIVE_INT_LEAST32; + static const PredType &NATIVE_UINT_LEAST32; + + static const PredType &NATIVE_INT_LEAST64; + static const PredType &NATIVE_UINT_LEAST64; + + // FAST types + static const PredType &NATIVE_INT_FAST8; + static const PredType &NATIVE_UINT_FAST8; + + static const PredType &NATIVE_INT_FAST16; + static const PredType &NATIVE_UINT_FAST16; + + static const PredType &NATIVE_INT_FAST32; + static const PredType &NATIVE_UINT_FAST32; + + static const PredType &NATIVE_INT_FAST64; + static const PredType &NATIVE_UINT_FAST64; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the PredType global constants + static void deleteConstants(); + + // Dummy constant + static const PredType &PREDTYPE_CONST; // dummy constant + + protected: + // Default constructor + PredType(); + + // Creates a pre-defined type using an HDF5 pre-defined constant + PredType(const hid_t predtype_id); // used by the library only + + private: + // Activates the creation of the PredType global constants + static PredType *getPredTypes(); + + // Dynamically allocates PredType global constants + static void makePredTypes(); + + // Dummy constant + static PredType *PREDTYPE_CONST_; + + // Declaration of pointers to constants + static PredType *STD_I8BE_; + static PredType *STD_I8LE_; + static PredType *STD_I16BE_; + static PredType *STD_I16LE_; + static PredType *STD_I32BE_; + static PredType *STD_I32LE_; + static PredType *STD_I64BE_; + static PredType *STD_I64LE_; + static PredType *STD_U8BE_; + static PredType *STD_U8LE_; + static PredType *STD_U16BE_; + static PredType *STD_U16LE_; + static PredType *STD_U32BE_; + static PredType *STD_U32LE_; + static PredType *STD_U64BE_; + static PredType *STD_U64LE_; + static PredType *STD_B8BE_; + static PredType *STD_B8LE_; + static PredType *STD_B16BE_; + static PredType *STD_B16LE_; + static PredType *STD_B32BE_; + static PredType *STD_B32LE_; + static PredType *STD_B64BE_; + static PredType *STD_B64LE_; + static PredType *STD_REF_OBJ_; + static PredType *STD_REF_DSETREG_; + + static PredType *C_S1_; + static PredType *FORTRAN_S1_; + + static PredType *IEEE_F32BE_; + static PredType *IEEE_F32LE_; + static PredType *IEEE_F64BE_; + static PredType *IEEE_F64LE_; + + static PredType *UNIX_D32BE_; + static PredType *UNIX_D32LE_; + static PredType *UNIX_D64BE_; + static PredType *UNIX_D64LE_; + + static PredType *INTEL_I8_; + static PredType *INTEL_I16_; + static PredType *INTEL_I32_; + static PredType *INTEL_I64_; + static PredType *INTEL_U8_; + static PredType *INTEL_U16_; + static PredType *INTEL_U32_; + static PredType *INTEL_U64_; + static PredType *INTEL_B8_; + static PredType *INTEL_B16_; + static PredType *INTEL_B32_; + static PredType *INTEL_B64_; + static PredType *INTEL_F32_; + static PredType *INTEL_F64_; + + static PredType *ALPHA_I8_; + static PredType *ALPHA_I16_; + static PredType *ALPHA_I32_; + static PredType *ALPHA_I64_; + static PredType *ALPHA_U8_; + static PredType *ALPHA_U16_; + static PredType *ALPHA_U32_; + static PredType *ALPHA_U64_; + static PredType *ALPHA_B8_; + static PredType *ALPHA_B16_; + static PredType *ALPHA_B32_; + static PredType *ALPHA_B64_; + static PredType *ALPHA_F32_; + static PredType *ALPHA_F64_; + + static PredType *MIPS_I8_; + static PredType *MIPS_I16_; + static PredType *MIPS_I32_; + static PredType *MIPS_I64_; + static PredType *MIPS_U8_; + static PredType *MIPS_U16_; + static PredType *MIPS_U32_; + static PredType *MIPS_U64_; + static PredType *MIPS_B8_; + static PredType *MIPS_B16_; + static PredType *MIPS_B32_; + static PredType *MIPS_B64_; + static PredType *MIPS_F32_; + static PredType *MIPS_F64_; + + static PredType *NATIVE_CHAR_; + static PredType *NATIVE_SCHAR_; + static PredType *NATIVE_UCHAR_; + static PredType *NATIVE_SHORT_; + static PredType *NATIVE_USHORT_; + static PredType *NATIVE_INT_; + static PredType *NATIVE_UINT_; + static PredType *NATIVE_LONG_; + static PredType *NATIVE_ULONG_; + static PredType *NATIVE_LLONG_; + static PredType *NATIVE_ULLONG_; + static PredType *NATIVE_FLOAT_; + static PredType *NATIVE_DOUBLE_; + static PredType *NATIVE_LDOUBLE_; + static PredType *NATIVE_B8_; + static PredType *NATIVE_B16_; + static PredType *NATIVE_B32_; + static PredType *NATIVE_B64_; + static PredType *NATIVE_OPAQUE_; + static PredType *NATIVE_HSIZE_; + static PredType *NATIVE_HSSIZE_; + static PredType *NATIVE_HERR_; + static PredType *NATIVE_HBOOL_; + + static PredType *NATIVE_INT8_; + static PredType *NATIVE_UINT8_; + static PredType *NATIVE_INT16_; + static PredType *NATIVE_UINT16_; + static PredType *NATIVE_INT32_; + static PredType *NATIVE_UINT32_; + static PredType *NATIVE_INT64_; + static PredType *NATIVE_UINT64_; + + // LEAST types + static PredType *NATIVE_INT_LEAST8_; + static PredType *NATIVE_UINT_LEAST8_; + + static PredType *NATIVE_INT_LEAST16_; + static PredType *NATIVE_UINT_LEAST16_; + + static PredType *NATIVE_INT_LEAST32_; + static PredType *NATIVE_UINT_LEAST32_; + + static PredType *NATIVE_INT_LEAST64_; + static PredType *NATIVE_UINT_LEAST64_; + + // FAST types + static PredType *NATIVE_INT_FAST8_; + static PredType *NATIVE_UINT_FAST8_; + + static PredType *NATIVE_INT_FAST16_; + static PredType *NATIVE_UINT_FAST16_; + + static PredType *NATIVE_INT_FAST32_; + static PredType *NATIVE_UINT_FAST32_; + + static PredType *NATIVE_INT_FAST64_; + static PredType *NATIVE_UINT_FAST64_; + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of PredType +} // namespace H5 + +#endif // H5PredType_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5PropList.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5PropList.h new file mode 100644 index 0000000000..beef474f65 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5PropList.h @@ -0,0 +1,146 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5PropList_H +#define H5PropList_H + +namespace H5 { + +/*! \class PropList + \brief Class PropList inherits from IdComponent and provides wrappers for + the HDF5 generic property list. +*/ +// Inheritance: IdComponent +class H5_DLLCPP PropList : public IdComponent { + public: + ///\brief Default property list + static const PropList &DEFAULT; + + // Creates a property list of a given type or creates a copy of an + // existing property list giving the property list id. + PropList(const hid_t plist_id); + + // Make a copy of the given property list using assignment statement + PropList &operator=(const PropList &rhs); + + // Compares this property list or class against the given list or class. + bool operator==(const PropList &rhs) const; + + // Close this property list. + virtual void close() override; + + // Close a property list class. + void closeClass() const; + + // Makes a copy of the given property list. + void copy(const PropList &like_plist); + + // Copies a property from this property list or class to another + void copyProp(PropList &dest, const char *name) const; + void copyProp(PropList &dest, const H5std_string &name) const; + + // Copies a property from one property list or property class to another + void copyProp(PropList &dest, PropList &src, const char *name) const; + void copyProp(PropList &dest, PropList &src, const H5std_string &name) const; + + // Gets the class of this property list, i.e. H5P_FILE_CREATE, + // H5P_FILE_ACCESS, ... + hid_t getClass() const; + + // Return the name of a generic property list class. + H5std_string getClassName() const; + + // Returns the parent class of a generic property class. + PropList getClassParent() const; + + // Returns the number of properties in this property list or class. + size_t getNumProps() const; + + // Query the value of a property in a property list. + void getProperty(const char *name, void *value) const; + void getProperty(const H5std_string &name, void *value) const; + H5std_string getProperty(const char *name) const; + H5std_string getProperty(const H5std_string &name) const; + + // Set a property's value in a property list. + void setProperty(const char *name, const char *charptr) const; + void setProperty(const char *name, const void *value) const; + void setProperty(const char *name, const H5std_string &strg) const; + void setProperty(const H5std_string &name, const void *value) const; + void setProperty(const H5std_string &name, const H5std_string &strg) const; + // Deprecated after 1.10.1, missing const + void setProperty(const char *name, void *value) const; + void setProperty(const char *name, H5std_string &strg) const; + void setProperty(const H5std_string &name, void *value) const; + void setProperty(const H5std_string &name, H5std_string &strg) const; + + // Query the size of a property in a property list or class. + size_t getPropSize(const char *name) const; + size_t getPropSize(const H5std_string &name) const; + + // Determines whether a property list is a certain class. + bool isAClass(const PropList &prop_class) const; + + /// Query the existence of a property in a property object. + bool propExist(const char *name) const; + bool propExist(const H5std_string &name) const; + + // Removes a property from a property list. + void removeProp(const char *name) const; + void removeProp(const H5std_string &name) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("PropList"); + } + + // Default constructor: creates a stub PropList object. + PropList(); + + // Copy constructor: same as the original PropList. + PropList(const PropList &original); + + // Gets the property list id. + virtual hid_t getId() const override; + + // Destructor: properly terminates access to this property list. + virtual ~PropList() override; + +#ifndef DOXYGEN_SHOULD_SKIP_THIS + + // Deletes the PropList global constant + static void deleteConstants(); + + protected: + hid_t id; // HDF5 property list id + + // Sets the property list id. + virtual void p_setId(const hid_t new_id) override; + + private: + static PropList *DEFAULT_; + + // Dynamically allocates the PropList global constant + static PropList *getConstant(); + + // Friend function to set PropList id. For library use only. + friend void f_PropList_setId(PropList *plist, hid_t new_id); + +#endif // DOXYGEN_SHOULD_SKIP_THIS + +}; // end of PropList +} // namespace H5 + +#endif // H5PropList_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5StrType.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5StrType.h new file mode 100644 index 0000000000..ccae3e750d --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5StrType.h @@ -0,0 +1,80 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5StrType_H +#define H5StrType_H + +namespace H5 { + +/*! \class StrType + \brief StrType is a derivative of a DataType and operates on HDF5 + string datatype. +*/ +// Inheritance: AtomType -> DataType -> H5Object -> H5Location -> IdComponent +class H5_DLLCPP StrType : public AtomType { + public: + // Creates a string type using a predefined type + StrType(const PredType &pred_type); + + // Creates a string type with specified length - may be obsolete + StrType(const PredType &pred_type, const size_t &size); + + // Creates a string type with specified length + StrType(const int dummy, const size_t &size); + + // Gets the string datatype of the specified dataset + StrType(const DataSet &dataset); + + // Constructors that open an HDF5 string datatype, given a location. + StrType(const H5Location &loc, const char *name); + StrType(const H5Location &loc, const H5std_string &name); + + // Returns an StrType object via DataType* by decoding the + // binary object description of this type. + virtual DataType *decode() const override; + + // Retrieves the character set type of this string datatype. + H5T_cset_t getCset() const; + + // Sets character set to be used. + void setCset(H5T_cset_t cset) const; + + // Retrieves the string padding method for this string datatype. + H5T_str_t getStrpad() const; + + // Defines the storage mechanism for character strings. + void setStrpad(H5T_str_t strpad) const; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("StrType"); + } + + // default constructor + StrType(); + + // Creates a string datatype using an existing id + StrType(const hid_t existing_id); + + // Copy constructor: same as the original StrType. + StrType(const StrType &original); + + // Noop destructor. + virtual ~StrType() override; + +}; // end of StrType +} // namespace H5 + +#endif // H5StrType_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/include/H5VarLenType.h b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5VarLenType.h new file mode 100644 index 0000000000..318681aca3 --- /dev/null +++ b/externals/coda-oss/modules/drivers/hdf5cpp/include/H5VarLenType.h @@ -0,0 +1,63 @@ +// C++ informative line for the emacs editor: -*- C++ -*- +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * 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. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef H5VarLenType_H +#define H5VarLenType_H + +namespace H5 { + +/*! \class VarLenType + \brief VarLenType is a derivative of a DataType and operates on HDF5 + Variable-length Datatypes. +*/ +// Inheritance: DataType -> H5Object -> H5Location -> IdComponent +class H5_DLLCPP VarLenType : public DataType { + public: + // Constructor that creates a variable-length datatype based + // on the specified base type. + VarLenType(const DataType &base_type); + + // Deprecated - will be removed after 1.10.2 + VarLenType(const DataType *base_type); + + // Returns an VarLenType object via DataType* by decoding the + // binary object description of this type. + virtual DataType *decode() const override; + + ///\brief Returns this class name. + virtual H5std_string + fromClass() const override + { + return ("VarLenType"); + } + + // Copy constructor: same as the original VarLenType. + VarLenType(const VarLenType &original); + + // Constructor that takes an existing id + VarLenType(const hid_t existing_id); + + // Constructors that open a variable-length datatype, given a location. + VarLenType(const H5Location &loc, const char *name); + VarLenType(const H5Location &loc, const H5std_string &name); + + // Noop destructor + virtual ~VarLenType() override; + + // Default constructor + VarLenType(); + +}; // end of VarLenType +} // namespace H5 + +#endif // H5VarLenType_H diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5AbstractDs.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5AbstractDs.cpp index 70d8531653..7ea107c7f4 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5AbstractDs.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5AbstractDs.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -36,7 +35,6 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: AbstractDs default constructor ///\brief Default constructor -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AbstractDs::AbstractDs() { @@ -45,7 +43,6 @@ AbstractDs::AbstractDs() //-------------------------------------------------------------------------- // Function: AbstractDs default constructor ///\brief Creates an AbstractDs instance using an existing id. -// Programmer Binh-Minh Ribler - 2000 // // *** Deprecation warning *** // This constructor is no longer appropriate because the data member "id" had @@ -61,7 +58,6 @@ AbstractDs::AbstractDs() /// object, which can be a dataset or an attribute. ///\return Datatype class identifier ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_class_t AbstractDs::getTypeClass() const @@ -108,7 +104,6 @@ AbstractDs::getTypeClass() const /// can be a dataset or an attribute. ///\return DataType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType AbstractDs::getDataType() const @@ -136,7 +131,6 @@ AbstractDs::getDataType() const /// can be a dataset or an attribute. ///\return ArrayType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- ArrayType AbstractDs::getArrayType() const @@ -166,7 +160,6 @@ AbstractDs::getArrayType() const /// can be a dataset or an attribute. ///\return CompType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType AbstractDs::getCompType() const @@ -194,7 +187,6 @@ AbstractDs::getCompType() const /// can be a dataset or an attribute. ///\return EnumType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType AbstractDs::getEnumType() const @@ -222,7 +214,6 @@ AbstractDs::getEnumType() const /// can be a dataset or an attribute. ///\return IntType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType AbstractDs::getIntType() const @@ -250,7 +241,6 @@ AbstractDs::getIntType() const /// which can be a dataset or an attribute. ///\return FloatType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType AbstractDs::getFloatType() const @@ -278,7 +268,6 @@ AbstractDs::getFloatType() const /// can be a dataset or an attribute. ///\return StrType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType AbstractDs::getStrType() const @@ -306,7 +295,6 @@ AbstractDs::getStrType() const /// which can be a dataset or an attribute. ///\return VarLenType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- VarLenType AbstractDs::getVarLenType() const @@ -331,7 +319,6 @@ AbstractDs::getVarLenType() const //-------------------------------------------------------------------------- // Function: AbstractDs destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AbstractDs::~AbstractDs() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5ArrayType.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5ArrayType.cpp index 953c355105..c5ad7eaad8 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5ArrayType.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5ArrayType.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -32,7 +31,6 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: ArrayType default constructor ///\brief Default constructor: Creates a stub ArrayType -// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- ArrayType::ArrayType() : DataType() { @@ -43,7 +41,6 @@ ArrayType::ArrayType() : DataType() ///\brief Creates an ArrayType object using an existing id. ///\param existing_id - IN: Id of an existing datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- ArrayType::ArrayType(const hid_t existing_id) : DataType(existing_id) { @@ -52,7 +49,6 @@ ArrayType::ArrayType(const hid_t existing_id) : DataType(existing_id) //-------------------------------------------------------------------------- // Function: ArrayType copy constructor ///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- ArrayType::ArrayType(const ArrayType &original) : DataType(original) { @@ -66,7 +62,6 @@ ArrayType::ArrayType(const ArrayType &original) : DataType(original) ///\param ndims - IN: Rank of the array, [0..H5S_MAX_RANK] ///\param dims - IN: Size of each array dimension ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- ArrayType::ArrayType(const DataType &base_type, int ndims, const hsize_t *dims) : DataType() { @@ -89,7 +84,6 @@ ArrayType::ArrayType(const DataType &base_type, int ndims, const hsize_t *dims) ///\param loc - IN: Location of the type ///\param dtype_name - IN: Array type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openArrayType(const char*) to @@ -108,7 +102,6 @@ ArrayType::ArrayType(const H5Location &loc, const char *dtype_name) : DataType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: Array type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openArrayType(const H5std_string&) @@ -129,7 +122,6 @@ ArrayType::ArrayType(const H5Location &loc, const H5std_string &dtype_name) : Da // Description // Closes the id on the lhs object first with setId, then copies // each data member from the rhs object. (Issue HDFFV-9562) -// Programmer Binh-Minh Ribler - Mar 2016 //-------------------------------------------------------------------------- ArrayType & ArrayType::operator=(const ArrayType &rhs) @@ -154,7 +146,6 @@ ArrayType::operator=(const ArrayType &rhs) /// binary object description of this type. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- DataType * ArrayType::decode() const @@ -176,7 +167,6 @@ ArrayType::decode() const ///\brief Returns the number of dimensions for an array datatype. ///\return Number of dimensions ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- int ArrayType::getArrayNDims() const @@ -196,7 +186,6 @@ ArrayType::getArrayNDims() const ///\param dims - OUT: Sizes of dimensions ///\return Number of dimensions ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- int ArrayType::getArrayDims(hsize_t *dims) const @@ -213,7 +202,6 @@ ArrayType::getArrayDims(hsize_t *dims) const //-------------------------------------------------------------------------- // Function: ArrayType destructor ///\brief Properly terminates access to this array datatype. -// Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- ArrayType::~ArrayType() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5AtomType.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5AtomType.cpp index 0b480464c9..db6c8f840a 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5AtomType.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5AtomType.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -33,7 +32,6 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: AtomType default constructor [protected] // Purpose Default constructor: creates a stub atomic datatype. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::AtomType() : DataType() { @@ -44,7 +42,6 @@ AtomType::AtomType() : DataType() // Purpose Creates an AtomType object using an existing id. // Parameter existing_id - IN: Id of an existing datatype // Exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::AtomType(const hid_t existing_id) : DataType(existing_id) { @@ -53,7 +50,6 @@ AtomType::AtomType(const hid_t existing_id) : DataType(existing_id) //-------------------------------------------------------------------------- // Function: AtomType copy constructor ///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::AtomType(const AtomType &original) : DataType(original) { @@ -65,7 +61,6 @@ AtomType::AtomType(const AtomType &original) : DataType(original) ///\brief Sets the total size for an atomic datatype. ///\param size - IN: Size to set ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void AtomType::setSize(size_t size) const @@ -85,7 +80,6 @@ AtomType::setSize(size_t size) const /// \li \c H5T_ORDER_BE /// \li \c H5T_ORDER_VAX ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- H5T_order_t AtomType::getOrder() const @@ -115,7 +109,6 @@ AtomType::getOrder() const /// \li \c H5T_ORDER_BE /// \li \c H5T_ORDER_VAX ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_order_t AtomType::getOrder(H5std_string &order_string) const @@ -141,7 +134,6 @@ AtomType::getOrder(H5std_string &order_string) const /// \li \c H5T_ORDER_BE /// \li \c H5T_ORDER_VAX ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void AtomType::setOrder(H5T_order_t order) const @@ -162,7 +154,6 @@ AtomType::setOrder(H5T_order_t order) const /// The precision is the number of significant bits which, /// unless padding is present, is 8 times larger than the /// value returned by \c DataType::getSize(). -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- size_t AtomType::getPrecision() const @@ -185,7 +176,6 @@ AtomType::getPrecision() const ///\par Description /// For information, please refer to the H5Tset_precision API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void AtomType::setPrecision(size_t precision) const @@ -205,7 +195,6 @@ AtomType::setPrecision(size_t precision) const ///\par Description /// For information, please refer to the H5Tget_offset API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 // Modification // 12/05/00: due to C API change // - return type changed from size_t to int @@ -231,7 +220,6 @@ AtomType::getOffset() const ///\par Description /// For information, please refer to the H5Tset_offset API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void AtomType::setOffset(size_t offset) const @@ -255,7 +243,6 @@ AtomType::setOffset(size_t offset) const /// \li \c H5T_PAD_ZERO (0) - Set background to zeros. /// \li \c H5T_PAD_ONE (1) - Set background to ones. /// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void AtomType::getPad(H5T_pad_t &lsb, H5T_pad_t &msb) const @@ -278,7 +265,6 @@ AtomType::getPad(H5T_pad_t &lsb, H5T_pad_t &msb) const /// \li \c H5T_PAD_ZERO (0) - Set background to zeros. /// \li \c H5T_PAD_ONE (1) - Set background to ones. /// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const @@ -294,7 +280,6 @@ AtomType::setPad(H5T_pad_t lsb, H5T_pad_t msb) const //-------------------------------------------------------------------------- // Function: AtomType destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- AtomType::~AtomType() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Attribute.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Attribute.cpp index 8fd25433fa..e838b4ffb4 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Attribute.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Attribute.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -42,7 +41,6 @@ class H5Object; // forward declaration for UserData4Aiterate //-------------------------------------------------------------------------- // Function: Attribute default constructor ///\brief Default constructor: Creates a stub attribute -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) { @@ -52,7 +50,6 @@ Attribute::Attribute() : AbstractDs(), H5Location(), id(H5I_INVALID_HID) // Function: Attribute copy constructor ///\brief Copy constructor: same HDF5 object as \a original ///\param original - IN: Original Attribute object to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute::Attribute(const Attribute &original) : AbstractDs(), H5Location(), id(original.id) { @@ -65,7 +62,6 @@ Attribute::Attribute(const Attribute &original) : AbstractDs(), H5Location(), id /// attribute. ///\param existing_id - IN: Id of an existing attribute ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(existing_id) { @@ -78,7 +74,6 @@ Attribute::Attribute(const hid_t existing_id) : AbstractDs(), H5Location(), id(e ///\param mem_type - IN: Attribute datatype (in memory) ///\param buf - IN: Data to be written ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Attribute::write(const DataType &mem_type, const void *buf) const @@ -96,7 +91,6 @@ Attribute::write(const DataType &mem_type, const void *buf) const ///\param mem_type - IN: Attribute datatype (in memory) ///\param strg - IN: Data to be written ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Apr, 2003 //-------------------------------------------------------------------------- void Attribute::write(const DataType &mem_type, const H5std_string &strg) const @@ -131,7 +125,6 @@ Attribute::write(const DataType &mem_type, const H5std_string &strg) const ///\param mem_type - IN: Attribute datatype (in memory) ///\param buf - OUT: Buffer for read data ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Attribute::read(const DataType &mem_type, void *buf) const @@ -149,7 +142,6 @@ Attribute::read(const DataType &mem_type, void *buf) const ///\param mem_type - IN: Attribute datatype (in memory) ///\param strg - IN: Buffer for read string ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Apr, 2003 // Modification // Mar 2008 // Corrected a misunderstanding that H5Aread would allocate @@ -186,7 +178,6 @@ Attribute::read(const DataType &mem_type, H5std_string &strg) const ///\brief Gets the size in memory of the attribute's data. ///\return Size of data (in memory) ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Apr 2009 //-------------------------------------------------------------------------- size_t Attribute::getInMemDataSize() const @@ -245,7 +236,6 @@ Attribute::getInMemDataSize() const ///\brief Gets a copy of the dataspace for this attribute. ///\return Dataspace instance ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace Attribute::getSpace() const @@ -279,7 +269,6 @@ Attribute::getSpace() const /// To get length of the attribute's name for buffer allocation, /// an application can call this function passing in NULL for the /// first argument and ignore the second argument. -// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- ssize_t Attribute::getName(char *attr_name, size_t buf_size) const @@ -303,7 +292,6 @@ Attribute::getName(char *attr_name, size_t buf_size) const ///\brief Returns the name of this attribute as an \a H5std_string. ///\return Name of the attribute ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - May, 2004 // Modification // Mar 2014 - BMR // Revised to use the modified getName() above @@ -354,7 +342,6 @@ Attribute::getName() const ///\return Name (or part of name) of the attribute ///\param len - IN: Desired length of the name ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 // Modification // Mar 2014 - BMR // Revised to use the new getName() below @@ -381,7 +368,6 @@ Attribute::getName(size_t len) const /// This function retrieves the attribute's name as a string. The /// buf_size can specify a specific length or default to 0, in /// which case the entire name will be retrieved. -// Programmer Binh-Minh Ribler - Nov, 2001 // Modification // Mar 2014 - BMR // Added to replace getName(size_t, H5std_string&) so that it'll @@ -426,7 +412,6 @@ Attribute::getName(H5std_string &attr_name, size_t len) const // Param attr_name - OUT: Buffer for the name string // Return Actual length of the attribute name // Exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Nov, 2001 // Modification // Modified to call its replacement. -BMR, 2014/04/16 // Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 @@ -444,7 +429,6 @@ Attribute::getName(H5std_string &attr_name, size_t len) const ///\exception H5::AttributeIException // Note: H5Dget_storage_size returns 0 when there is no data. This // function should have no failure. (from SLU) -// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- hsize_t Attribute::getStorageSize() const @@ -462,7 +446,6 @@ Attribute::getStorageSize() const // AbstractDS and Attribute are moved out of H5Object. In // addition, member IdComponent::id is moved into subclasses, and // IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 // Modification // Aug 2016 - BMR // Note that Attribute is now inheriting from H5Location, because @@ -482,7 +465,6 @@ Attribute::getId() const // Exception H5::AttributeIException // Description // This private function is used in AbstractDs. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hid_t Attribute::p_get_type() const @@ -501,7 +483,6 @@ Attribute::p_get_type() const // param mem_type - IN: Attribute datatype (in memory) // param strg - IN: Buffer for read string // exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Jul, 2009 // Modification // Jul 2009 // Separated the fixed length case from the original @@ -536,7 +517,6 @@ Attribute::p_read_fixed_len(const DataType &mem_type, H5std_string &strg) const // param mem_type - IN: Attribute datatype (in memory) // param strg - IN: Buffer for read string // exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Jul, 2009 // Modification // Jul 2009 // Separated the variable length case from the original @@ -571,7 +551,6 @@ Attribute::p_read_variable_len(const DataType &mem_type, H5std_string &strg) con // The underlying reference counting in the C library ensures // that the current valid id of this object is properly closed. // Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Attribute::p_setId(const hid_t new_id) @@ -593,7 +572,6 @@ Attribute::p_setId(const hid_t new_id) ///\brief Closes this attribute. /// ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void Attribute::close() @@ -611,7 +589,6 @@ Attribute::close() //-------------------------------------------------------------------------- // Function: Attribute destructor ///\brief Properly terminates access to this attribute. -// Programmer Binh-Minh Ribler - 2000 // Modification // - Replaced resetIdComponent() with decRefCount() to use C // library ID reference counting mechanism - BMR, Jun 1, 2004 diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5CommonFG.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5CommonFG.cpp index 8401b9c83b..277ba349e4 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5CommonFG.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5CommonFG.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -52,7 +51,6 @@ namespace H5 { ///\param name - IN: Name of the datatype to open ///\return DataType instance ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType CommonFG::openDataType(const char *name) const @@ -76,7 +74,6 @@ CommonFG::openDataType(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType CommonFG::openDataType(const H5std_string &name) const @@ -90,7 +87,6 @@ CommonFG::openDataType(const H5std_string &name) const ///\param name - IN: Name of the array datatype to open ///\return ArrayType instance ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- ArrayType CommonFG::openArrayType(const char *name) const @@ -114,7 +110,6 @@ CommonFG::openArrayType(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- ArrayType CommonFG::openArrayType(const H5std_string &name) const @@ -128,7 +123,6 @@ CommonFG::openArrayType(const H5std_string &name) const ///\param name - IN: Name of the compound datatype to open ///\return CompType instance ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType CommonFG::openCompType(const char *name) const @@ -152,7 +146,6 @@ CommonFG::openCompType(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType CommonFG::openCompType(const H5std_string &name) const @@ -166,7 +159,6 @@ CommonFG::openCompType(const H5std_string &name) const ///\param name - IN: Name of the enumeration datatype to open ///\return EnumType instance ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType CommonFG::openEnumType(const char *name) const @@ -190,7 +182,6 @@ CommonFG::openEnumType(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType CommonFG::openEnumType(const H5std_string &name) const @@ -204,7 +195,6 @@ CommonFG::openEnumType(const H5std_string &name) const ///\param name - IN: Name of the integer datatype to open ///\return IntType instance ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType CommonFG::openIntType(const char *name) const @@ -228,7 +218,6 @@ CommonFG::openIntType(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType CommonFG::openIntType(const H5std_string &name) const @@ -242,7 +231,6 @@ CommonFG::openIntType(const H5std_string &name) const ///\param name - IN: Name of the floating-point datatype to open ///\return FloatType instance ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType CommonFG::openFloatType(const char *name) const @@ -266,7 +254,6 @@ CommonFG::openFloatType(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType CommonFG::openFloatType(const H5std_string &name) const @@ -280,7 +267,6 @@ CommonFG::openFloatType(const H5std_string &name) const ///\param name - IN: Name of the string datatype to open ///\return StrType instance ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType CommonFG::openStrType(const char *name) const @@ -304,7 +290,6 @@ CommonFG::openStrType(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType CommonFG::openStrType(const H5std_string &name) const @@ -318,7 +303,6 @@ CommonFG::openStrType(const H5std_string &name) const ///\param name - IN: Name of the variable length datatype to open ///\return VarLenType instance ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- VarLenType CommonFG::openVarLenType(const char *name) const @@ -342,7 +326,6 @@ CommonFG::openVarLenType(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- VarLenType CommonFG::openVarLenType(const H5std_string &name) const @@ -354,7 +337,6 @@ CommonFG::openVarLenType(const H5std_string &name) const //-------------------------------------------------------------------------- // Function: CommonFG default constructor ///\brief Default constructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CommonFG::CommonFG() { @@ -363,7 +345,6 @@ CommonFG::CommonFG() //-------------------------------------------------------------------------- // Function: CommonFG destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CommonFG::~CommonFG() { @@ -377,7 +358,6 @@ CommonFG::~CommonFG() // Applications shouldn't need to use it. // param dtype - IN/OUT: DataType object to be changed // param new_id - IN: New id to set -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void f_DataType_setId(DataType *dtype, hid_t new_id) @@ -393,7 +373,6 @@ f_DataType_setId(DataType *dtype, hid_t new_id) // Applications shouldn't need to use it. // param dset - IN/OUT: DataSet object to be changed // param new_id - IN: New id to set -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void f_DataSet_setId(DataSet *dset, hid_t new_id) diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5CompType.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5CompType.cpp index 3b38c6d81c..c89fa5c8f2 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5CompType.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5CompType.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -35,7 +34,6 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: CompType default constructor ///\brief Default constructor: Creates a stub compound datatype -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType::CompType() : DataType() { @@ -45,7 +43,6 @@ CompType::CompType() : DataType() // Function: CompType copy constructor ///\brief Copy constructor: same HDF5 object as \a original ///\param original - IN: Original CompType instance -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType::CompType(const CompType &original) : DataType(original) { @@ -55,7 +52,6 @@ CompType::CompType(const CompType &original) : DataType(original) // Function: CompType overloaded constructor ///\brief Creates a CompType object using the id of an existing datatype. ///\param existing_id - IN: Id of an existing compound datatype -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType::CompType(const hid_t existing_id) : DataType(existing_id) { @@ -69,7 +65,6 @@ CompType::CompType(const hid_t existing_id) : DataType(existing_id) // Description // The DataType constructor calls the C API H5Tcreate to create // the compound datatype. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) { @@ -81,7 +76,6 @@ CompType::CompType(size_t size) : DataType(H5T_COMPOUND, size) ///\param dataset - IN: Dataset that this enum datatype associates with ///\return CompType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType::CompType(const DataSet &dataset) : DataType() { @@ -101,7 +95,6 @@ CompType::CompType(const DataSet &dataset) : DataType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: Compound type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openCompType(const char*) to @@ -120,7 +113,6 @@ CompType::CompType(const H5Location &loc, const char *dtype_name) : DataType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: Compound type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openCompType(const H5Location&) @@ -138,7 +130,6 @@ CompType::CompType(const H5Location &loc, const H5std_string &dtype_name) : Data /// binary object description of this datatype. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- DataType * CompType::decode() const @@ -160,7 +151,6 @@ CompType::decode() const ///\brief Returns the number of members in this compound datatype. ///\return Number of members ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int CompType::getNmembers() const @@ -179,7 +169,6 @@ CompType::getNmembers() const ///\param member_num - IN: Zero-based index of the member ///\return Name of member ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string CompType::getMemberName(unsigned member_num) const @@ -205,7 +194,6 @@ CompType::getMemberName(unsigned member_num) const /// Members are stored in no particular order with numbers 0 /// through N-1, where N is the value returned by the member /// function \c CompType::getNmembers. -// Programmer Binh-Minh Ribler - May 16, 2002 //-------------------------------------------------------------------------- int CompType::getMemberIndex(const char *name) const @@ -228,7 +216,6 @@ CompType::getMemberIndex(const H5std_string &name) const /// respect to the beginning of the compound data type datum. ///\param member_num - IN: Zero-based index of the member ///\return Byte offset -// Programmer Binh-Minh Ribler - 2000 // Description /// Members are stored in no particular order with numbers 0 /// through N-1, where N is the value returned by the member @@ -250,7 +237,6 @@ CompType::getMemberOffset(unsigned member_num) const ///\param member_num - IN: Zero-based index of the member ///\return Type class of the member ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 // Modification // Modified to use H5Tget_member_class instead. - Jul, 2005 //-------------------------------------------------------------------------- @@ -289,7 +275,6 @@ CompType::p_get_member_type(unsigned member_num) const ///\param member_num - IN: Zero-based index of the member ///\return DataType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType CompType::getMemberDataType(unsigned member_num) const @@ -311,7 +296,6 @@ CompType::getMemberDataType(unsigned member_num) const ///\param member_num - IN: Zero-based index of the member ///\return ArrayType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- ArrayType CompType::getMemberArrayType(unsigned member_num) const @@ -333,7 +317,6 @@ CompType::getMemberArrayType(unsigned member_num) const ///\param member_num - IN: Zero-based index of the member ///\return CompType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType CompType::getMemberCompType(unsigned member_num) const @@ -355,7 +338,6 @@ CompType::getMemberCompType(unsigned member_num) const ///\param member_num - IN: Zero-based index of the member ///\return EnumType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType CompType::getMemberEnumType(unsigned member_num) const @@ -377,7 +359,6 @@ CompType::getMemberEnumType(unsigned member_num) const ///\param member_num - IN: Zero-based index of the member ///\return IntType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType CompType::getMemberIntType(unsigned member_num) const @@ -399,7 +380,6 @@ CompType::getMemberIntType(unsigned member_num) const ///\param member_num - IN: Zero-based index of the member ///\return FloatType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType CompType::getMemberFloatType(unsigned member_num) const @@ -421,7 +401,6 @@ CompType::getMemberFloatType(unsigned member_num) const ///\param member_num - IN: Zero-based index of the member ///\return StrType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType CompType::getMemberStrType(unsigned member_num) const @@ -443,7 +422,6 @@ CompType::getMemberStrType(unsigned member_num) const ///\param member_num - IN: Zero-based index of the member ///\return VarLenType instance ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- VarLenType CompType::getMemberVarLenType(unsigned member_num) const @@ -498,7 +476,6 @@ void CompType::getMemberType(unsigned member_num, StrType& strtype) const ///\param offset - IN: Offset in memory structure of the field to insert ///\param new_member - IN: New member to be inserted ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CompType::insertMember(const H5std_string &name, size_t offset, const DataType &new_member) const @@ -521,7 +498,6 @@ CompType::insertMember(const H5std_string &name, size_t offset, const DataType & ///\brief Recursively removes padding from within a compound datatype. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void CompType::pack() const @@ -540,7 +516,6 @@ CompType::pack() const ///\exception H5::DataTypeIException // Note // H5Tset_size works on atom datatypes and compound datatypes only -// Programmer Binh-Minh Ribler - 2014 //-------------------------------------------------------------------------- void CompType::setSize(size_t size) const @@ -555,7 +530,6 @@ CompType::setSize(size_t size) const //-------------------------------------------------------------------------- // Function: CompType destructor ///\brief Properly terminates access to this compound datatype. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- CompType::~CompType() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DaccProp.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DaccProp.cpp index 1905f277c0..8b01665c19 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DaccProp.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DaccProp.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -41,7 +40,6 @@ DSetAccPropList *DSetAccPropList::DEFAULT_ = 0; // If DSetAccPropList::DEFAULT_ already points to an allocated // object, throw a PropListIException. This scenario should // not happen. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- DSetAccPropList * DSetAccPropList::getConstant() @@ -67,7 +65,6 @@ DSetAccPropList::getConstant() // Function: DSetAccPropList::deleteConstants // Purpose: Deletes the constant object that DSetAccPropList::DEFAULT_ // points to. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void DSetAccPropList::deleteConstants() @@ -85,7 +82,6 @@ const DSetAccPropList &DSetAccPropList::DEFAULT = *getConstant(); //-------------------------------------------------------------------------- // Function: DSetAccPropList default constructor ///\brief Default constructor: creates a stub dataset creation property list -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetAccPropList::DSetAccPropList() : LinkAccPropList(H5P_DATASET_ACCESS) { @@ -95,7 +91,6 @@ DSetAccPropList::DSetAccPropList() : LinkAccPropList(H5P_DATASET_ACCESS) // Function: DSetAccPropList copy constructor ///\brief Copy constructor: same HDF5 object as \a original /// DSetAccPropList object -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetAccPropList::DSetAccPropList(const DSetAccPropList &orig) : LinkAccPropList(orig) { @@ -105,7 +100,6 @@ DSetAccPropList::DSetAccPropList(const DSetAccPropList &orig) : LinkAccPropList( // Function: DSetAccPropList overloaded constructor ///\brief Creates a DSetAccPropList object using the id of an /// existing dataset creation property list. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetAccPropList::DSetAccPropList(const hid_t plist_id) : LinkAccPropList(plist_id) { @@ -162,7 +156,6 @@ DSetAccPropList::getChunkCache(size_t &rdcc_nslots, size_t &rdcc_nbytes, double //-------------------------------------------------------------------------- // Function: DSetAccPropList destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetAccPropList::~DSetAccPropList() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataSet.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataSet.cpp index 3ee0ec5e22..40b40f2f21 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataSet.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataSet.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -730,7 +729,7 @@ DataSet::p_read_fixed_len(const hid_t mem_type_id, const hid_t mem_space_id, con } // Get string from the C char* and release resource allocated locally - strg = strg_C; + strg = H5std_string(strg_C, data_size); delete[] strg_C; } } diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataSpace.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataSpace.cpp index e4aef837e0..403f9ece67 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataSpace.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataSpace.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -39,7 +38,6 @@ DataSpace *DataSpace::ALL_ = 0; // Description // If DataSpace::ALL_ already points to an allocated object, throw // a DataSpaceIException. This scenario should not happen. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- DataSpace * DataSpace::getConstant() @@ -64,7 +62,6 @@ DataSpace::getConstant() //-------------------------------------------------------------------------- // Function: DataSpace::deleteConstants // Purpose: Deletes the constant object that DataSpace::ALL_ points to -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void DataSpace::deleteConstants() @@ -86,7 +83,6 @@ const DataSpace &DataSpace::ALL = *getConstant(); /// currently can be either \c H5S_SCALAR or \c H5S_SIMPLE; /// default to \c H5S_SCALAR. ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace::DataSpace(H5S_class_t type) : IdComponent(), id{H5Screate(type)} { @@ -102,7 +98,6 @@ DataSpace::DataSpace(H5S_class_t type) : IdComponent(), id{H5Screate(type)} ///\param dims - IN: An array of the size of each dimension. ///\param maxdims - IN: An array of the maximum size of each dimension. ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace::DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims) : IdComponent(), id{H5Screate_simple(rank, dims, maxdims)} @@ -118,7 +113,6 @@ DataSpace::DataSpace(int rank, const hsize_t *dims, const hsize_t *maxdims) /// dataspace. ///\param existing_id - IN: Id of an existing dataspace ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace::DataSpace(const hid_t existing_id) : IdComponent(), id(existing_id) { @@ -129,7 +123,6 @@ DataSpace::DataSpace(const hid_t existing_id) : IdComponent(), id(existing_id) // Function: DataSpace copy constructor ///\brief Copy constructor: same HDF5 object as \a original ///\param original - IN: DataSpace object to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace::DataSpace(const DataSpace &original) : IdComponent(), id(original.id) { @@ -141,7 +134,6 @@ DataSpace::DataSpace(const DataSpace &original) : IdComponent(), id(original.id) ///\brief Makes a copy of an existing dataspace. ///\param like_space - IN: Dataspace to be copied ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 // Modification // - Replaced resetIdComponent() with decRefCount() to use C // library ID reference counting mechanism - BMR, Jun 1, 2004 @@ -177,7 +169,6 @@ DataSpace::copy(const DataSpace &like_space) // Description // Makes a copy of the type on the right hand side and stores // the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataSpace & DataSpace::operator=(const DataSpace &rhs) @@ -193,7 +184,6 @@ DataSpace::operator=(const DataSpace &rhs) ///\return \c true if the dataspace is a simple dataspace, and \c false, /// otherwise ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DataSpace::isSimple() const @@ -218,7 +208,6 @@ DataSpace::isSimple() const /// an extent, allowing the same shaped selection to be moved /// to different locations within a dataspace without requiring /// it to be re-defined. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::offsetSimple(const hssize_t *offset) const @@ -237,7 +226,6 @@ DataSpace::offsetSimple(const hssize_t *offset) const ///\return Number of dimensions, the same value as returned by /// \c DataSpace::getSimpleExtentNdims() ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DataSpace::getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims) const @@ -255,7 +243,6 @@ DataSpace::getSimpleExtentDims(hsize_t *dims, hsize_t *maxdims) const ///\brief Returns the dimensionality of a dataspace. ///\return Number of dimensions ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DataSpace::getSimpleExtentNdims() const @@ -278,7 +265,6 @@ DataSpace::getSimpleExtentNdims() const // 12/05/00: due to C API change // return type hssize_t vs. hsize_t // num_elements = -1 when failure occurs vs. 0 -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hssize_t DataSpace::getSimpleExtentNpoints() const @@ -298,7 +284,6 @@ DataSpace::getSimpleExtentNpoints() const ///\brief Returns the current class of a dataspace. ///\return Class of the dataspace ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5S_class_t DataSpace::getSimpleExtentType() const @@ -316,7 +301,6 @@ DataSpace::getSimpleExtentType() const ///\brief Copies the extent of a dataspace. ///\param dest_space - IN: Dataspace to copy from ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::extentCopy(const DataSpace &dest_space) const @@ -335,7 +319,6 @@ DataSpace::extentCopy(const DataSpace &dest_space) const // misses const. This wrapper will be removed in future release. // Param dest_space - IN: Dataspace to copy from // Exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 // Modification // Modified to call its replacement. -BMR, 2014/04/16 // Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 @@ -353,7 +336,6 @@ DataSpace::extentCopy(const DataSpace &dest_space) const ///\param current_size - IN: Array containing current size of dataspace ///\param maximum_size - IN: Array containing maximum size of dataspace ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsize_t *maximum_size) const @@ -370,7 +352,6 @@ DataSpace::setExtentSimple(int rank, const hsize_t *current_size, const hsize_t ///\brief Removes the extent from a dataspace. /// ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::setExtentNone() const @@ -386,7 +367,6 @@ DataSpace::setExtentNone() const ///\brief Returns the number of elements in a dataspace selection. ///\return Number of elements ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hssize_t DataSpace::getSelectNpoints() const @@ -405,7 +385,6 @@ DataSpace::getSelectNpoints() const ///\brief Returns number of hyperslab blocks. ///\return Number of hyperslab blocks ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hssize_t DataSpace::getSelectHyperNblocks() const @@ -426,7 +405,6 @@ DataSpace::getSelectHyperNblocks() const ///\param numblocks - IN: Number of hyperslab blocks to get ///\param buf - IN: List of hyperslab blocks selected ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_t *buf) const @@ -444,7 +422,6 @@ DataSpace::getSelectHyperBlocklist(hsize_t startblock, hsize_t numblocks, hsize_ ///\brief Returns the number of element points in the current selection. ///\return Number of element points ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hssize_t DataSpace::getSelectElemNpoints() const @@ -466,7 +443,6 @@ DataSpace::getSelectElemNpoints() const ///\par Description /// For information, please refer to the C API /// H5Sget_select_elem_pointlist in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t *buf) const @@ -488,7 +464,6 @@ DataSpace::getSelectElemPointlist(hsize_t startpoint, hsize_t numpoints, hsize_t ///\par Description /// For information, please refer to the H5Sget_select_bounds API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::getSelectBounds(hsize_t *start, hsize_t *end) const @@ -512,7 +487,6 @@ DataSpace::getSelectBounds(hsize_t *start, hsize_t *end) const ///\par Description /// For information, please refer to the H5Sselect_elements API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::selectElements(H5S_seloper_t op, const size_t num_elements, const hsize_t *coord) const @@ -529,7 +503,6 @@ DataSpace::selectElements(H5S_seloper_t op, const size_t num_elements, const hsi ///\brief Selects the entire dataspace. /// ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::selectAll() const @@ -545,7 +518,6 @@ DataSpace::selectAll() const ///\brief Resets the selection region to include no elements. /// ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::selectNone() const @@ -563,7 +535,6 @@ DataSpace::selectNone() const ///\return \c true if the selection is within the extent of the /// dataspace, and \c false, otherwise ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DataSpace::selectValid() const @@ -590,7 +561,6 @@ DataSpace::selectValid() const ///\par Description /// For information, please refer to the H5Sselect_hyperslab API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t *start, @@ -613,7 +583,6 @@ DataSpace::selectHyperslab(H5S_seloper_t op, const hsize_t *count, const hsize_t // AbstractDS and Attribute are moved out of H5Object. In // addition, member IdComponent::id is moved into subclasses, and // IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 //-------------------------------------------------------------------------- hid_t DataSpace::getId() const @@ -632,7 +601,6 @@ DataSpace::getId() const // The underlying reference counting in the C library ensures // that the current valid id of this object is properly closed. // Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataSpace::p_setId(const hid_t new_id) @@ -654,7 +622,6 @@ DataSpace::p_setId(const hid_t new_id) ///\brief Closes this dataspace. /// ///\exception H5::DataSpaceIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void DataSpace::close() @@ -673,7 +640,6 @@ DataSpace::close() //-------------------------------------------------------------------------- // Function: DataSpace destructor ///\brief Properly terminates access to this dataspace. -// Programmer Binh-Minh Ribler - 2000 // Modification // - Replaced resetIdComponent() with decRefCount() to use C // library ID reference counting mechanism - BMR, Jun 1, 2004 diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataType.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataType.cpp index d889f135c9..13b0decc02 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataType.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DataType.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -44,7 +43,6 @@ using std::endl; //-------------------------------------------------------------------------- // Function: DataType default constructor ///\brief Default constructor: Creates a stub datatype -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType::DataType() : H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0) { @@ -57,7 +55,6 @@ DataType::DataType() : H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_s // Description // Constructor creates a copy of an existing DataType using // its id. -// Programmer Binh-Minh Ribler - 2000 // Modification // Dec, 2005 // Removed second argument, "predefined", after changing to the @@ -74,7 +71,6 @@ DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id), encod ///\param type_class - IN: Class of datatype to create ///\param size - IN: Number of bytes in the datatype to create ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType::DataType(const H5T_class_t type_class, size_t size) : H5Object(), id{H5Tcreate(type_class, size)}, encoded_buf(NULL), buf_size(0) @@ -93,7 +89,6 @@ DataType::DataType(const H5T_class_t type_class, size_t size) ///\param ref_type - IN: Reference type - default to H5R_OBJECT ///\param plist - IN: Property list - default to PropList::DEFAULT ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- DataType::DataType(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist) : H5Object(), id{H5Location::p_dereference(loc.getId(), ref, ref_type, plist, @@ -111,7 +106,6 @@ DataType::DataType(const H5Location &loc, const void *ref, H5R_type_t ref_type, // param ref_type - IN: Reference type - default to H5R_OBJECT // param plist - IN: Property list - default to PropList::DEFAULT // exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // Jul, 2008 // Added for application convenience. @@ -126,7 +120,6 @@ H5Object(), id(H5I_INVALID_HID), encoded_buf(NULL), buf_size(0) //-------------------------------------------------------------------------- // Function: DataType copy constructor ///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType::DataType(const DataType &original) : H5Object(), id(original.id), encoded_buf(NULL), buf_size(0) { @@ -138,7 +131,6 @@ DataType::DataType(const DataType &original) : H5Object(), id(original.id), enco ///\brief Creates a DataType instance using a predefined type ///\param pred_type - IN: Predefined datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2015 // Description // Copying the type so that when a predefined type is passed in, // a copy of it is made, not just a duplicate of the HDF5 id. @@ -160,7 +152,6 @@ DataType::DataType(const PredType &pred_type) ///\param loc - IN: Location of the type ///\param dtype_name - IN: Datatype name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openDataType(const char*) to @@ -179,7 +170,6 @@ DataType::DataType(const H5Location &loc, const char *dtype_name) ///\param loc - IN: Location of the type ///\param dtype_name - IN: Datatype name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openDataType(const H5std_string&) to @@ -196,7 +186,6 @@ DataType::DataType(const H5Location &loc, const H5std_string &dtype_name) ///\brief Copies an existing datatype to this datatype object ///\param like_type - IN: Datatype to be copied ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 // Modification // - Replaced resetIdComponent() with decRefCount() to use C // library ID reference counting mechanism - BMR, Jun 1, 2004 @@ -225,7 +214,6 @@ DataType::copy(const DataType &like_type) ///\brief Copies the datatype of the given dataset to this datatype object ///\param dset - IN: Dataset ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 ///\par Description /// The resulted dataset will be transient and modifiable. //-------------------------------------------------------------------------- @@ -252,7 +240,6 @@ DataType::copy(const DataSet &dset) // Purpose Returns an id of a type by decoding the binary object /// description of this datatype. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- hid_t DataType::p_decode() const @@ -281,7 +268,6 @@ DataType::p_decode() const /// description of this datatype. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- DataType * DataType::decode() const @@ -303,7 +289,6 @@ DataType::decode() const ///\brief Creates a binary object description of this datatype. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- void DataType::encode() @@ -334,7 +319,6 @@ DataType::encode() /// description. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- bool DataType::hasBinaryDesc() const @@ -351,7 +335,6 @@ DataType::hasBinaryDesc() const // Description // Makes a copy of the type on the right hand side and stores // the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 // Modification // Changed operator= to simply copy the id of rhs instead of // calling H5Tcopy because, when the operator= is invoked, a @@ -377,7 +360,6 @@ DataType::operator=(const DataType &rhs) ///\param compared_type - IN: Reference to the datatype to compare ///\return true if the datatypes are equal, and false, otherwise. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DataType::operator==(const DataType &compared_type) const @@ -417,7 +399,6 @@ DataType::operator!=(const DataType &compared_type) const // datatype, or attribute. //\param name - IN: Name of the datatype //\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 // Modification: // Copied from DataType::commit and made into private function // to be commonly used by several overloads of DataType::commit. @@ -439,7 +420,6 @@ DataType::p_commit(hid_t loc_id, const char *name) ///\param loc - IN: A location (file, dataset, datatype, or group) ///\param name - IN: Name of the datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 //-------------------------------------------------------------------------- void DataType::commit(const H5Location &loc, const char *name) @@ -455,7 +435,6 @@ DataType::commit(const H5Location &loc, const char *name) // Param loc - IN: A location (file, dataset, datatype, or group) // Param name - IN: Name of the datatype // Exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 // Modification // Planned for removal. -BMR, 2014/04/16 // Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 @@ -471,7 +450,6 @@ DataType::commit(const H5Location &loc, const char *name) ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function only in the type of the /// argument \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::commit(const H5Location &loc, const H5std_string &name) @@ -487,7 +465,6 @@ DataType::commit(const H5Location &loc, const H5std_string &name) // Param loc - IN: A location (file, dataset, datatype, or group) // Param name - IN: Name of the datatype // Exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Jan, 2007 // Modification // Planned for removal. -BMR, 2014/04/16 // Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 @@ -505,7 +482,6 @@ DataType::commit(const H5Location &loc, const H5std_string &name) ///\return \c true if the datatype is a named type, and \c false, /// otherwise. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DataType::committed() const @@ -529,7 +505,6 @@ DataType::committed() const ///\param pcdata - IN: Pointer to type conversion data ///\return Pointer to a suitable conversion function ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_conv_t DataType::find(const DataType &dest, H5T_cdata_t **pcdata) const @@ -553,7 +528,6 @@ DataType::find(const DataType &dest, H5T_cdata_t **pcdata) const ///\param plist - IN: Property list - default to PropList::DEFAULT ///\return Pointer to a suitable conversion function ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::convert(const DataType &dest, size_t nelmts, void *buf, void *background, @@ -583,7 +557,6 @@ DataType::convert(const DataType &dest, size_t nelmts, void *buf, void *backgrou /// /// Once a data type is locked it can never be unlocked unless /// the entire library is closed. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::lock() const @@ -600,7 +573,6 @@ DataType::lock() const ///\brief Returns the datatype class identifier. ///\return Datatype class identifier ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_class_t DataType::getClass() const @@ -619,7 +591,6 @@ DataType::getClass() const ///\brief Returns the size of a datatype. ///\return Datatype size in bytes ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- size_t DataType::getSize() const @@ -638,7 +609,6 @@ DataType::getSize() const ///\brief Returns the base datatype from which a datatype is derived. ///\return DataType object ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DataType DataType::getSuper() const @@ -673,7 +643,6 @@ DataType::getSuper() const ///\par Description /// For information, please refer to the H5Tregister API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::registerFunc(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const @@ -692,7 +661,6 @@ DataType::registerFunc(H5T_pers_t pers, const char *name, const DataType &dest, ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function only in the type of the /// argument \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::registerFunc(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const @@ -711,7 +679,6 @@ DataType::registerFunc(H5T_pers_t pers, const H5std_string &name, const DataType ///\param func - IN: Function to convert between source and /// destination datatypes. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::unregister(H5T_pers_t pers, const char *name, const DataType &dest, H5T_conv_t func) const @@ -730,7 +697,6 @@ DataType::unregister(H5T_pers_t pers, const char *name, const DataType &dest, H5 ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function only in the type of the /// argument \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::unregister(H5T_pers_t pers, const H5std_string &name, const DataType &dest, H5T_conv_t func) const @@ -744,7 +710,6 @@ DataType::unregister(H5T_pers_t pers, const H5std_string &name, const DataType & ///\param tag - IN: Descriptive ASCII string with which the opaque /// datatype is to be tagged. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::setTag(const char *tag) const @@ -761,7 +726,6 @@ DataType::setTag(const char *tag) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function only in the type of the /// argument \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::setTag(const H5std_string &tag) const @@ -774,7 +738,6 @@ DataType::setTag(const H5std_string &tag) const ///\brief Gets the tag associated with an opaque datatype. ///\return Tag associated with the opaque datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string DataType::getTag() const @@ -800,7 +763,6 @@ DataType::getTag() const ///\return true if this datatype contains or is the specified type, /// and false, otherwise. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- bool DataType::detectClass(H5T_class_t cls) const @@ -821,7 +783,6 @@ DataType::detectClass(H5T_class_t cls) const ///\return true if this predtype is the specified type class, and false, /// otherwise. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - August, 2017 //-------------------------------------------------------------------------- bool DataType::detectClass(const PredType &pred_type, H5T_class_t cls) @@ -842,7 +803,6 @@ DataType::detectClass(const PredType &pred_type, H5T_class_t cls) ///\return true if this datatype is a variable-length string, and /// false, otherwise. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- bool DataType::isVariableStr() const @@ -863,7 +823,6 @@ DataType::isVariableStr() const /// creation. ///\return A property list object ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - March, 2017 // Description // Currently, there is no datatype creation property list class // in the C++ API because there is no associated functionality. @@ -891,7 +850,6 @@ DataType::getCreatePlist() const // AbstractDS and Attribute are moved out of H5Object. In // addition, member IdComponent::id is moved into subclasses, and // IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 //-------------------------------------------------------------------------- hid_t DataType::getId() const @@ -906,7 +864,6 @@ DataType::getId() const ///\param loc - IN: Location of the type ///\param dtype_name - IN: Datatype name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // This function was introduced in 1.10.1 to be used by the new // XxxType constructors that open a datatype. -BMR, Dec 2016 @@ -931,7 +888,6 @@ DataType::p_opentype(const H5Location &loc, const char *dtype_name) const // The underlying reference counting in the C library ensures // that the current valid id of this object is properly closed. // Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DataType::p_setId(const hid_t new_id) @@ -953,7 +909,6 @@ DataType::p_setId(const hid_t new_id) ///\brief Closes the datatype if it is not a predefined type. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void DataType::close() @@ -977,7 +932,6 @@ DataType::close() //-------------------------------------------------------------------------- // Function: DataType destructor ///\brief Properly terminates access to this datatype. -// Programmer Binh-Minh Ribler - 2000 // Modification // - Replaced resetIdComponent() with decRefCount() to use C // library ID reference counting mechanism - BMR, Jun 1, 2004 diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DcreatProp.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DcreatProp.cpp index 97c6ddbbfc..3d0193dbec 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DcreatProp.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DcreatProp.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -47,7 +46,6 @@ DSetCreatPropList *DSetCreatPropList::DEFAULT_ = 0; // If DSetCreatPropList::DEFAULT_ already points to an allocated // object, throw a PropListIException. This scenario should // not happen. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- DSetCreatPropList * DSetCreatPropList::getConstant() @@ -73,7 +71,6 @@ DSetCreatPropList::getConstant() // Function: DSetCreatPropList::deleteConstants // Purpose: Deletes the constant object that DSetCreatPropList::DEFAULT_ // points to. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void DSetCreatPropList::deleteConstants() @@ -91,7 +88,6 @@ const DSetCreatPropList &DSetCreatPropList::DEFAULT = *getConstant(); //-------------------------------------------------------------------------- // Function: DSetCreatPropList default constructor ///\brief Default constructor: creates a stub dataset creation property list -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) { @@ -101,7 +97,6 @@ DSetCreatPropList::DSetCreatPropList() : ObjCreatPropList(H5P_DATASET_CREATE) // Function: DSetCreatPropList copy constructor ///\brief Copy constructor: same HDF5 object as \a original /// DSetCreatPropList object -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList &orig) : ObjCreatPropList(orig) { @@ -111,7 +106,6 @@ DSetCreatPropList::DSetCreatPropList(const DSetCreatPropList &orig) : ObjCreatPr // Function: DSetCreatPropList overloaded constructor ///\brief Creates a DSetCreatPropList object using the id of an /// existing dataset creation property list. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : ObjCreatPropList(plist_id) { @@ -130,7 +124,6 @@ DSetCreatPropList::DSetCreatPropList(const hid_t plist_id) : ObjCreatPropList(pl /// define the size of the chunks to store the dataset's raw /// data. As a side-effect, the layout of the dataset will be /// changed to \c H5D_CHUNKED, if it is not so already. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setChunk(int ndims, const hsize_t *dim) const @@ -148,7 +141,6 @@ DSetCreatPropList::setChunk(int ndims, const hsize_t *dim) const ///\param max_ndims - IN: Size of \a dim array ///\param dim - OUT: Array to store the chunk dimensions ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DSetCreatPropList::getChunk(int max_ndims, hsize_t *dim) const @@ -168,7 +160,6 @@ DSetCreatPropList::getChunk(int max_ndims, hsize_t *dim) const ///\par Description /// For information, please refer to the H5Pset_layout API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setLayout(H5D_layout_t layout) const @@ -193,7 +184,6 @@ DSetCreatPropList::setLayout(H5D_layout_t layout) const /// in the file. ///\exception H5::PropListIException ///\par Description -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_layout_t DSetCreatPropList::getLayout() const @@ -215,7 +205,6 @@ DSetCreatPropList::getLayout() const /// list to \c H5D_COMPRESS_DEFLATE and the compression level to /// \a level. Lower compression levels are faster but result in /// less compression. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setDeflate(int level) const @@ -245,7 +234,6 @@ DSetCreatPropList::setDeflate(int level) const /// H5Z_FILTER_SZIP, for a dataset. For more information about /// SZIP and usage, please refer to the H5Pset_szip API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - Jan, 2007 //-------------------------------------------------------------------------- void DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_block) const @@ -266,7 +254,6 @@ DSetCreatPropList::setSzip(unsigned int options_mask, unsigned int pixels_per_bl /// H5Z_FILTER_NBIT, for a dataset. For more information about /// Nbit compression, please refer to the H5Pset_nbit API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - Apr, 2016 //-------------------------------------------------------------------------- void DSetCreatPropList::setNbit() const @@ -292,7 +279,6 @@ DSetCreatPropList::setNbit() const ///\par /// For information on setting fill value, please refer to the /// H5Pset_fill_value API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFillValue(const DataType &fvalue_type, const void *value) const @@ -314,7 +300,6 @@ DSetCreatPropList::setFillValue(const DataType &fvalue_type, const void *value) /// and the memory is allocated by the caller. The fill /// value will be converted from its current data type to the /// specified by \a fvalue_type. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::getFillValue(const DataType &fvalue_type, void *value) const @@ -333,7 +318,6 @@ DSetCreatPropList::getFillValue(const DataType &fvalue_type, void *value) const /// \li \c H5D_FILL_VALUE_DEFAULT =1, /// \li \c H5D_FILL_VALUE_USER_DEFINED =2 ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_fill_value_t DSetCreatPropList::isFillValueDefined() const @@ -366,7 +350,6 @@ DSetCreatPropList::isFillValueDefined() const /// failed; the filter will not participate in the pipeline /// during a \c DataSet::read() of the chunk. If this bit is clear /// and the filter fails then the entire I/O operation fails. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, @@ -386,7 +369,6 @@ DSetCreatPropList::setFilter(H5Z_filter_t filter_id, unsigned int flags, size_t ///\par Description /// Deletes a filter from the dataset creation property list; /// deletes all filters if \a filter_id is \c H5Z_FILTER_NONE. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const @@ -402,7 +384,6 @@ DSetCreatPropList::removeFilter(H5Z_filter_t filter_id) const ///\brief Returns the number of filters in the pipeline ///\return Number of filters ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DSetCreatPropList::getNfilters() const @@ -465,7 +446,6 @@ DSetCreatPropList::getFilter(int filter_number, unsigned int &flags, size_t &cd_ ///\param name - OUT: Name of the filter ///\param filter_config - OUT: Flags indicating whether filter can encode/decode ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::getFilterById(H5Z_filter_t filter_id, unsigned int &flags, size_t &cd_nelmts, @@ -497,7 +477,6 @@ DSetCreatPropList::getFilterById(H5Z_filter_t filter_id, unsigned int &flags, si /// failed; the filter will not participate in the pipeline /// during a DataSet::read() of the chunk. If this bit is clear /// and the filter fails then the entire I/O operation fails. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size_t cd_nelmts, @@ -516,7 +495,6 @@ DSetCreatPropList::modifyFilter(H5Z_filter_t filter_id, unsigned int flags, size ///\return true if all filters available, and false if one or more /// filters not currently available ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DSetCreatPropList::allFiltersAvail() const @@ -541,7 +519,6 @@ DSetCreatPropList::allFiltersAvail() const ///\par Description /// For information, please refer to the H5Pset_shuffle API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setShuffle() const @@ -564,7 +541,6 @@ DSetCreatPropList::setShuffle() const /// \li \c H5D_ALLOC_TIME_EARLY /// \li \c H5D_ALLOC_TIME_LATE /// \li \c H5D_ALLOC_TIME_INCR -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_alloc_time_t DSetCreatPropList::getAllocTime() const @@ -587,7 +563,6 @@ DSetCreatPropList::getAllocTime() const /// Valid values for fill value writing time include /// \li \c H5D_FILL_TIME_NEVER /// \li \c H5D_FILL_TIME_ALLOC. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5D_fill_time_t DSetCreatPropList::getFillTime() const @@ -612,7 +587,6 @@ DSetCreatPropList::getFillTime() const /// \li \c H5D_ALLOC_TIME_EARLY /// \li \c H5D_ALLOC_TIME_LATE /// \li \c H5D_ALLOC_TIME_INCR -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const @@ -632,7 +606,6 @@ DSetCreatPropList::setAllocTime(H5D_alloc_time_t alloc_time) const /// Valid values for fill value writing time include /// \li \c H5D_FILL_TIME_NEVER /// \li \c H5D_FILL_TIME_ALLOC. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const @@ -648,7 +621,6 @@ DSetCreatPropList::setFillTime(H5D_fill_time_t fill_time) const ///\brief Sets Fletcher32 checksum of EDC for this property list. /// ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setFletcher32() const @@ -673,7 +645,6 @@ DSetCreatPropList::setFletcher32() const /// the total size is larger than the size of a dataset then the /// dataset can be extended (provided the data space also allows /// the extending). -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::setExternal(const char *name, off_t offset, hsize_t size) const @@ -689,7 +660,6 @@ DSetCreatPropList::setExternal(const char *name, off_t offset, hsize_t size) con ///\brief Returns the number of external files for a dataset ///\return Number of external files ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int DSetCreatPropList::getExternalCount() const @@ -723,7 +693,6 @@ DSetCreatPropList::getExternalCount() const /// external file name will not be returned. If \a offset or /// \a size are null pointers then the corresponding information /// will not be returned. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, off_t &offset, hsize_t &size) const @@ -750,7 +719,6 @@ DSetCreatPropList::getExternal(unsigned idx, size_t name_size, char *name, off_t ///\par Description /// For information, please refer to the H5Pset_virtual API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - Mar, 2017 //-------------------------------------------------------------------------- void DSetCreatPropList::setVirtual(const DataSpace &vspace, const char *src_fname, const char *src_dsname, @@ -778,7 +746,6 @@ DSetCreatPropList::setVirtual(const DataSpace &vspace, const char *src_fname, co ///\par Description /// For information, please refer to the H5Pset_virtual API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - Mar, 2017 //-------------------------------------------------------------------------- void DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string src_fname, @@ -790,7 +757,6 @@ DSetCreatPropList::setVirtual(const DataSpace &vspace, const H5std_string src_fn //-------------------------------------------------------------------------- // Function: DSetCreatPropList destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetCreatPropList::~DSetCreatPropList() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DxferProp.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DxferProp.cpp index ccb49be821..33e2ff58c1 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DxferProp.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5DxferProp.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -39,7 +38,6 @@ DSetMemXferPropList *DSetMemXferPropList::DEFAULT_ = 0; // If DSetMemXferPropList::DEFAULT_ already points to an allocated // object, throw a PropListIException. This scenario should not // happen. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- DSetMemXferPropList * DSetMemXferPropList::getConstant() @@ -66,7 +64,6 @@ DSetMemXferPropList::getConstant() // Function: DSetMemXferPropList::deleteConstants // Purpose: Deletes the constant object that DSetMemXferPropList::DEFAULT_ // points to. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void DSetMemXferPropList::deleteConstants() @@ -85,7 +82,6 @@ const DSetMemXferPropList &DSetMemXferPropList::DEFAULT = *getConstant(); // Function DSetMemXferPropList default constructor ///\brief Default constructor: creates a stub dataset memory and /// transfer property list object. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) { @@ -95,7 +91,6 @@ DSetMemXferPropList::DSetMemXferPropList() : PropList(H5P_DATASET_XFER) // Function DSetMemXferPropList constructor ///\brief Creates a dataset transfer property list with transform /// expression. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetMemXferPropList::DSetMemXferPropList(const char *exp) : PropList(H5P_DATASET_XFER) { @@ -108,7 +103,6 @@ DSetMemXferPropList::DSetMemXferPropList(const char *exp) : PropList(H5P_DATASET /// DSetMemXferPropList object ///\param original - IN: Original dataset memory and transfer property /// list object to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList &original) : PropList(original) { @@ -120,7 +114,6 @@ DSetMemXferPropList::DSetMemXferPropList(const DSetMemXferPropList &original) : /// existing DSetMemXferPropList. ///\param plist_id - IN: Id of an existing dataset memory and transfer /// property list -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_id) { @@ -133,7 +126,6 @@ DSetMemXferPropList::DSetMemXferPropList(const hid_t plist_id) : PropList(plist_ ///\param tconv - IN: Pointer to application-allocated type conversion buffer ///\param bkg - IN: Pointer to application-allocated background buffer ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetMemXferPropList::setBuffer(size_t size, void *tconv, void *bkg) const @@ -151,7 +143,6 @@ DSetMemXferPropList::setBuffer(size_t size, void *tconv, void *bkg) const ///\param bkg - OUT: Pointer to application-allocated background buffer ///\return Buffer size, in bytes ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- size_t DSetMemXferPropList::getBuffer(void **tconv, void **bkg) const @@ -169,7 +160,6 @@ DSetMemXferPropList::getBuffer(void **tconv, void **bkg) const ///\brief Sets the dataset transfer property list status to true or false. ///\param status - IN: Status to set, true or false ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetMemXferPropList::setPreserve(bool status) const @@ -185,7 +175,6 @@ DSetMemXferPropList::setPreserve(bool status) const ///\brief Checks status of the dataset transfer property list. ///\return Status of the dataset transfer property list ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool DSetMemXferPropList::getPreserve() const @@ -208,7 +197,6 @@ DSetMemXferPropList::getPreserve() const ///\param middle - IN: B-tree split ratio for right-most nodes and lone nodes ///\param right - IN: B-tree split ratio for all other nodes ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetMemXferPropList::setBtreeRatios(double left, double middle, double right) const @@ -226,7 +214,6 @@ DSetMemXferPropList::setBtreeRatios(double left, double middle, double right) co ///\param middle - OUT: B-tree split ratio for right-most nodes and lone nodes ///\param right - OUT: B-tree split ratio for all other nodes ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetMemXferPropList::getBtreeRatios(double &left, double &middle, double &right) const @@ -242,7 +229,6 @@ DSetMemXferPropList::getBtreeRatios(double &left, double &middle, double &right) ///\brief Sets data transform expression. ///\param expression - IN: null-terminated data transform expression (char*) ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- void DSetMemXferPropList::setDataTransform(const char *expression) const @@ -259,7 +245,6 @@ DSetMemXferPropList::setDataTransform(const char *expression) const /// It takes a reference to a \c H5std_string for the expression. ///\param expression - IN: H5std_string data transform expression ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- void DSetMemXferPropList::setDataTransform(const H5std_string &expression) const @@ -274,7 +259,6 @@ DSetMemXferPropList::setDataTransform(const H5std_string &expression) const ///\param buf_size - IN: size of buffer for expression, including the /// null terminator ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- ssize_t DSetMemXferPropList::getDataTransform(char *exp, size_t buf_size) const @@ -303,7 +287,6 @@ DSetMemXferPropList::getDataTransform(char *exp, size_t buf_size) const /// It takes no parameter and returns a \c H5std_string for the expression. /// ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- H5std_string DSetMemXferPropList::getDataTransform() const @@ -350,7 +333,6 @@ DSetMemXferPropList::getDataTransform() const ///\param op - IN: User's function ///\param user_data - IN: User's data ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_data) const @@ -367,7 +349,6 @@ DSetMemXferPropList::setTypeConvCB(H5T_conv_except_func_t op, void *user_data) c ///\param op - IN: Retrieved user function ///\param user_data - IN: Retrieved user data ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) const @@ -386,7 +367,6 @@ DSetMemXferPropList::getTypeConvCB(H5T_conv_except_func_t *op, void **user_data) ///\param free_func - IN: User's free routine ///\param free_info - IN: User's free parameters ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, @@ -404,7 +384,6 @@ DSetMemXferPropList::setVlenMemManager(H5MM_allocate_t alloc_func, void *alloc_i /// allocation - system \c malloc and \c free will be used. /// ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetMemXferPropList::setVlenMemManager() const @@ -420,7 +399,6 @@ DSetMemXferPropList::setVlenMemManager() const ///\param free_func - OUT: User's free routine ///\param free_info - OUT: User's free parameters ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t &alloc_func, void **alloc_info, H5MM_free_t &free_func, @@ -440,7 +418,6 @@ DSetMemXferPropList::getVlenMemManager(H5MM_allocate_t &alloc_func, void **alloc ///\par Description /// For detail, please refer to the H5Pset_small_data_block_size /// API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const @@ -457,7 +434,6 @@ DSetMemXferPropList::setSmallDataBlockSize(hsize_t size) const ///\brief Returns the current small data block size setting. ///\return Size of the small data block, in bytes ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hsize_t DSetMemXferPropList::getSmallDataBlockSize() const @@ -479,7 +455,6 @@ DSetMemXferPropList::getSmallDataBlockSize() const ///\par Description /// For detail, please refer to the H5Pset_hyper_vector_size /// API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const @@ -497,7 +472,6 @@ DSetMemXferPropList::setHyperVectorSize(size_t vector_size) const /// hyperslab I/O. ///\return Number of I/O vectors ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- size_t DSetMemXferPropList::getHyperVectorSize() const @@ -527,7 +501,6 @@ DSetMemXferPropList::getHyperVectorSize() const /// Valid values are as follows: /// \li \c H5Z_ENABLE_EDC (default) /// \li \c H5Z_DISABLE_EDC -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const @@ -543,7 +516,6 @@ DSetMemXferPropList::setEDCCheck(H5Z_EDC_t check) const ///\brief Determines whether error-detection is enabled for dataset reads. ///\return \c H5Z_ENABLE_EDC or \c H5Z_DISABLE_EDC ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5Z_EDC_t DSetMemXferPropList::getEDCCheck() const @@ -558,7 +530,6 @@ DSetMemXferPropList::getEDCCheck() const //-------------------------------------------------------------------------- // Function: DSetMemXferPropList destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- DSetMemXferPropList::~DSetMemXferPropList() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5EnumType.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5EnumType.cpp index 2073365efd..03c07d9512 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5EnumType.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5EnumType.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -38,7 +37,6 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: EnumType default constructor ///\brief Default constructor: Creates a stub datatype -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType::EnumType() : DataType() { @@ -49,7 +47,6 @@ EnumType::EnumType() : DataType() ///\brief Creates an EnumType object using the id of an existing datatype. ///\param existing_id - IN: Id of an existing datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType::EnumType(const hid_t existing_id) : DataType(existing_id) { @@ -58,7 +55,6 @@ EnumType::EnumType(const hid_t existing_id) : DataType(existing_id) //-------------------------------------------------------------------------- // Function: EnumType copy constructor ///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType::EnumType(const EnumType &original) : DataType(original) { @@ -72,7 +68,6 @@ EnumType::EnumType(const EnumType &original) : DataType(original) // Description // The DataType constructor calls the C API H5Tcreate to create // the enum datatype. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType::EnumType(size_t size) : DataType(H5T_ENUM, size) { @@ -83,7 +78,6 @@ EnumType::EnumType(size_t size) : DataType(H5T_ENUM, size) ///\brief Gets the enum datatype of the specified dataset. ///\param dataset - IN: Dataset that this enum datatype associates with ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType::EnumType(const DataSet &dataset) : DataType() { @@ -101,7 +95,6 @@ EnumType::EnumType(const DataSet &dataset) : DataType() ///\brief Creates a new enum datatype based on an integer datatype. ///\param data_type - IN: Base datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType::EnumType(const IntType &data_type) : DataType() { @@ -121,7 +114,6 @@ EnumType::EnumType(const IntType &data_type) : DataType() ///\param dtype_name - IN: Enum datatype name ///\param loc - IN: Location of the type ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openEnumType(const char*) to @@ -140,7 +132,6 @@ EnumType::EnumType(const H5Location &loc, const char *dtype_name) : DataType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: Enum datatype name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openEnumType(const H5std_string&) @@ -158,7 +149,6 @@ EnumType::EnumType(const H5Location &loc, const H5std_string &dtype_name) : Data /// binary object description of this type. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- DataType * EnumType::decode() const @@ -181,7 +171,6 @@ EnumType::decode() const ///\param name - IN: Name of the new member ///\param value - IN: Pointer to the value of the new member ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void EnumType::insert(const char *name, void *value) const @@ -198,7 +187,6 @@ EnumType::insert(const char *name, void *value) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function only in the type of /// argument \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void EnumType::insert(const H5std_string &name, void *value) const @@ -213,7 +201,6 @@ EnumType::insert(const H5std_string &name, void *value) const ///\param value - IN: Pointer to the value of the enum datatype ///\param size - IN: Size for the name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string EnumType::nameOf(void *value, size_t size) const @@ -241,7 +228,6 @@ EnumType::nameOf(void *value, size_t size) const ///\param name - IN: Name of the queried member ///\param value - OUT: Pointer to the retrieved value ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void EnumType::valueOf(const char *name, void *value) const @@ -258,7 +244,6 @@ EnumType::valueOf(const char *name, void *value) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function only in the type of /// argument \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void EnumType::valueOf(const H5std_string &name, void *value) const @@ -274,7 +259,6 @@ EnumType::valueOf(const H5std_string &name, void *value) const /// between 0 and \c N-1, where \c N is the value returned by the /// member function \c EnumType::getNmembers. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May 16, 2002 //-------------------------------------------------------------------------- int EnumType::getMemberIndex(const char *name) const @@ -291,7 +275,6 @@ EnumType::getMemberIndex(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function only in the type of /// argument \a name. -// Programmer Binh-Minh Ribler - May 16, 2002 //-------------------------------------------------------------------------- int EnumType::getMemberIndex(const H5std_string &name) const @@ -304,7 +287,6 @@ EnumType::getMemberIndex(const H5std_string &name) const ///\brief Returns the number of members in this enumeration datatype. ///\return Number of members ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- int EnumType::getNmembers() const @@ -324,7 +306,6 @@ EnumType::getNmembers() const ///\param memb_no - IN: Index of the queried member ///\param value - OUT: Pointer to the retrieved value ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void EnumType::getMemberValue(unsigned memb_no, void *value) const @@ -339,7 +320,6 @@ EnumType::getMemberValue(unsigned memb_no, void *value) const //-------------------------------------------------------------------------- // Function: EnumType destructor ///\brief Properly terminates access to this enum datatype. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- EnumType::~EnumType() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Exception.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Exception.cpp index 91ab3311b4..01b9cc10d0 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Exception.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Exception.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -23,7 +22,6 @@ const char Exception::DEFAULT_MSG[] = "No detailed information provided"; //-------------------------------------------------------------------------- // Function: Exception default constructor ///\brief Default constructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Exception::Exception() : detail_message{""}, func_name{""} { @@ -35,7 +33,6 @@ Exception::Exception() : detail_message{""}, func_name{""} /// in which the failure occurs, and an optional detailed message. ///\param func - IN: Name of the function where failure occurs ///\param message - IN: Message on the failure -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Exception::Exception(const H5std_string &func, const H5std_string &message) : detail_message(message), func_name(func) @@ -46,7 +43,6 @@ Exception::Exception(const H5std_string &func, const H5std_string &message) // Function: Exception copy constructor ///\brief Copy constructor: same HDF5 object as \a original ///\param orig - IN: Exception instance to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Exception::Exception(const Exception &orig) : detail_message(orig.detail_message), func_name(orig.func_name) { @@ -61,7 +57,6 @@ Exception::Exception(const Exception &orig) : detail_message(orig.detail_message ///\par Description /// In the failure case, the string "Invalid major error number" /// will be returned. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string Exception::getMajorString(hid_t err_major) const @@ -103,7 +98,6 @@ Exception::getMajorString(hid_t err_major) const ///\par Description /// In the failure case, the string "Invalid minor error number" /// will be returned. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string Exception::getMinorString(hid_t err_minor) const @@ -150,7 +144,6 @@ Exception::getMinorString(hid_t err_minor) const ///\par /// Users are encouraged to write their own more specific error /// handlers -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::setAutoPrint(H5E_auto2_t &func, void *client_data) @@ -165,7 +158,6 @@ Exception::setAutoPrint(H5E_auto2_t &func, void *client_data) //-------------------------------------------------------------------------- // Function: Exception::dontPrint ///\brief Turns off the automatic error printing from the C library. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::dontPrint() @@ -185,7 +177,6 @@ Exception::dontPrint() /// called upon an error condition ///\param client_data - OUT: Current setting for the data passed to /// the error function -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::getAutoPrint(H5E_auto2_t &func, void **client_data) @@ -203,7 +194,6 @@ Exception::getAutoPrint(H5E_auto2_t &func, void **client_data) ///\par Description /// The stack is also cleared whenever a C API function is /// called, with certain exceptions (for instance, \c H5Eprint). -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::clearErrorStack() @@ -253,7 +243,6 @@ Exception::clearErrorStack() /// const char *desc; //optional supplied description /// } H5E_error2_t; ///\endcode -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void *client_data) @@ -269,7 +258,6 @@ Exception::walkErrorStack(H5E_direction_t direction, H5E_walk2_t func, void *cli ///\brief Returns the detailed message set at the time the exception /// is thrown. ///\return Text message - \c H5std_string -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string Exception::getDetailMsg() const @@ -282,7 +270,6 @@ Exception::getDetailMsg() const ///\brief Returns the detailed message set at the time the exception /// is thrown. ///\return Text message - \c char pointer -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- const char * Exception::getCDetailMsg() const @@ -294,7 +281,6 @@ Exception::getCDetailMsg() const // Function: Exception::getFuncName ///\brief Returns the name of the function, where the exception is thrown. ///\return Text message - \c H5std_string -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string Exception::getFuncName() const @@ -306,7 +292,6 @@ Exception::getFuncName() const // Function: Exception::getCFuncName ///\brief Returns the name of the function, where the exception is thrown. ///\return Text message - \c char pointer -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- const char * Exception::getCFuncName() const @@ -319,7 +304,6 @@ Exception::getCFuncName() const ///\brief Prints the error stack in a default manner. ///\param stream - IN: File pointer, default to stderr ///\param err_stack - IN: Error stack ID, default to H5E_DEFAULT(0) -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Exception::printErrorStack(FILE *stream, hid_t err_stack) @@ -335,7 +319,6 @@ Exception::printErrorStack(FILE *stream, hid_t err_stack) // function is replaced by the static function printErrorStack // and will be removed from the next major release. // Parameter stream - IN: File pointer -// Programmer Binh-Minh Ribler - 2000 // Description: // This function can be removed in next major release. // -BMR, 2014/04/24 @@ -350,15 +333,13 @@ Exception::printErrorStack(FILE *stream, hid_t err_stack) //-------------------------------------------------------------------------- // Function: Exception destructor ///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Exception::~Exception() noexcept +Exception::~Exception() throw() { } //-------------------------------------------------------------------------- // Subclass: FileIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: FileIException default constructor @@ -382,13 +363,12 @@ FileIException::FileIException(const H5std_string &func, const H5std_string &mes // Function: FileIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -FileIException::~FileIException() noexcept +FileIException::~FileIException() throw() { } //-------------------------------------------------------------------------- // Subclass: GroupIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: GroupIException default constructor @@ -412,13 +392,12 @@ GroupIException::GroupIException(const H5std_string &func, const H5std_string &m // Function: GroupIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -GroupIException::~GroupIException() noexcept +GroupIException::~GroupIException() throw() { } //-------------------------------------------------------------------------- // Subclass: DataSpaceIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: DataSpaceIException default constructor @@ -442,13 +421,12 @@ DataSpaceIException::DataSpaceIException(const H5std_string &func, const H5std_s // Function: DataSpaceIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataSpaceIException::~DataSpaceIException() noexcept +DataSpaceIException::~DataSpaceIException() throw() { } //-------------------------------------------------------------------------- // Subclass: DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: DataTypeIException default constructor @@ -472,13 +450,12 @@ DataTypeIException::DataTypeIException(const H5std_string &func, const H5std_str // Function: DataTypeIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataTypeIException::~DataTypeIException() noexcept +DataTypeIException::~DataTypeIException() throw() { } //-------------------------------------------------------------------------- // Subclass: ObjHeaderIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: ObjHeaderIException default constructor @@ -502,13 +479,12 @@ ObjHeaderIException::ObjHeaderIException(const H5std_string &func, const H5std_s // Function: ObjHeaderIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -ObjHeaderIException::~ObjHeaderIException() noexcept +ObjHeaderIException::~ObjHeaderIException() throw() { } //-------------------------------------------------------------------------- // Subclass: PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: PropListIException default constructor @@ -532,13 +508,12 @@ PropListIException::PropListIException(const H5std_string &func, const H5std_str // Function: PropListIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -PropListIException::~PropListIException() noexcept +PropListIException::~PropListIException() throw() { } //-------------------------------------------------------------------------- // Subclass: DataSetIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: DataSetIException default constructor @@ -562,13 +537,12 @@ DataSetIException::DataSetIException(const H5std_string &func, const H5std_strin // Function: DataSetIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataSetIException::~DataSetIException() noexcept +DataSetIException::~DataSetIException() throw() { } //-------------------------------------------------------------------------- // Subclass: AttributeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: AttributeIException default constructor @@ -592,13 +566,12 @@ AttributeIException::AttributeIException(const H5std_string &func, const H5std_s // Function: AttributeIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -AttributeIException::~AttributeIException() noexcept +AttributeIException::~AttributeIException() throw() { } //-------------------------------------------------------------------------- // Subclass: ReferenceException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: ReferenceException default constructor @@ -622,13 +595,12 @@ ReferenceException::ReferenceException(const H5std_string &func, const H5std_str // Function: ReferenceException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -ReferenceException::~ReferenceException() noexcept +ReferenceException::~ReferenceException() throw() { } //-------------------------------------------------------------------------- // Subclass: LibraryIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: LibraryIException default constructor @@ -652,13 +624,12 @@ LibraryIException::LibraryIException(const H5std_string &func, const H5std_strin // Function: LibraryIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -LibraryIException::~LibraryIException() noexcept +LibraryIException::~LibraryIException() throw() { } //-------------------------------------------------------------------------- // Subclass: LocationException -// Programmer Binh-Minh Ribler - 2014 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: LocationException default constructor @@ -682,13 +653,12 @@ LocationException::LocationException(const H5std_string &func, const H5std_strin // Function: LocationException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -LocationException::~LocationException() noexcept +LocationException::~LocationException() throw() { } //-------------------------------------------------------------------------- // Subclass: IdComponentException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- //-------------------------------------------------------------------------- // Function: IdComponentException default constructor @@ -712,7 +682,7 @@ IdComponentException::IdComponentException(const H5std_string &func, const H5std // Function: IdComponentException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -IdComponentException::~IdComponentException() noexcept +IdComponentException::~IdComponentException() throw() { } diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FaccProp.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FaccProp.cpp index 68a130eac0..ea5692ac7c 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FaccProp.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FaccProp.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -42,7 +41,6 @@ FileAccPropList *FileAccPropList::DEFAULT_ = 0; // If FileAccPropList::DEFAULT_ already points to an allocated // object, throw a PropListIException. This scenario should not // happen. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- FileAccPropList * FileAccPropList::getConstant() @@ -69,7 +67,6 @@ FileAccPropList::getConstant() // Purpose Deletes the constant object that FileAccPropList::DEFAULT_ // points to. // exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void FileAccPropList::deleteConstants() @@ -87,7 +84,6 @@ const FileAccPropList &FileAccPropList::DEFAULT = *getConstant(); //-------------------------------------------------------------------------- // Function: Default Constructor ///\brief Creates a file access property list -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileAccPropList::FileAccPropList() : PropList(H5P_FILE_ACCESS) { @@ -97,7 +93,6 @@ FileAccPropList::FileAccPropList() : PropList(H5P_FILE_ACCESS) // Function: FileAccPropList copy constructor ///\brief Copy constructor: same HDF5 object as \a original ///\param original - IN: FileAccPropList instance to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileAccPropList::FileAccPropList(const FileAccPropList &original) : PropList(original) { @@ -107,7 +102,6 @@ FileAccPropList::FileAccPropList(const FileAccPropList &original) : PropList(ori // Function: FileAccPropList overloaded constructor ///\brief Creates a file access property list using the id of an /// existing one. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) { @@ -118,7 +112,6 @@ FileAccPropList::FileAccPropList(const hid_t plist_id) : PropList(plist_id) ///\brief Modifies this property list to use the \c H5FD_STDIO driver. /// ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setStdio() const @@ -138,7 +131,6 @@ FileAccPropList::setStdio() const /// For detail on valid driver identifiers, please refer to the /// H5Pget_driver API in the HDF5 C Reference Manual. ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hid_t FileAccPropList::getDriver() const @@ -159,7 +151,6 @@ FileAccPropList::getDriver() const ///\par Description /// For information, please refer to the H5Pset_driver API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) const @@ -175,7 +166,6 @@ FileAccPropList::setDriver(hid_t new_driver_id, const void *new_driver_info) con ///\brief Sets offset for family driver. ///\param offset - IN: offset value ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setFamilyOffset(hsize_t offset) const @@ -191,7 +181,6 @@ FileAccPropList::setFamilyOffset(hsize_t offset) const ///\brief Get offset for family driver. ///\return Offset for family driver ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hsize_t FileAccPropList::getFamilyOffset() const @@ -216,7 +205,6 @@ FileAccPropList::getFamilyOffset() const ///\par Description /// For more details on the use of \c H5FD_CORE driver, please /// refer to the H5Pset_fapl_core API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setCore(size_t increment, hbool_t backing_store) const @@ -234,7 +222,6 @@ FileAccPropList::setCore(size_t increment, hbool_t backing_store) const ///\param backing_store - OUT: Indicating whether to write the file /// contents to disk when the file is closed ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::getCore(size_t &increment, hbool_t &backing_store) const @@ -254,7 +241,6 @@ FileAccPropList::getCore(size_t &increment, hbool_t &backing_store) const ///\exception H5::PropListIException ///\par Description /// Note that \a memb_size is used only when creating a new file. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList &memb_plist) const @@ -273,7 +259,6 @@ FileAccPropList::setFamily(hsize_t memb_size, const FileAccPropList &memb_plist) ///\param memb_plist - OUT: Retrieved file access property list for each /// file member ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::getFamily(hsize_t &memb_size, FileAccPropList &memb_plist) const @@ -294,7 +279,6 @@ FileAccPropList::getFamily(hsize_t &memb_size, FileAccPropList &memb_plist) cons ///\param memb_size - OUT: Size in bytes of each file member ///\return The file access property list for each file member ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- FileAccPropList FileAccPropList::getFamily(hsize_t &memb_size) const @@ -320,7 +304,6 @@ FileAccPropList::getFamily(hsize_t &memb_size) const ///\par Description /// For information, please refer to the H5Pset_fapl_split API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist, @@ -343,7 +326,6 @@ FileAccPropList::setSplit(const FileAccPropList &meta_plist, const FileAccPropLi ///\param meta_ext - IN: Metadata filename extension as \c H5std_string ///\param raw_ext - IN: Raw data filename extension as \c H5std_string ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setSplit(const FileAccPropList &meta_plist, const FileAccPropList &raw_plist, @@ -362,7 +344,6 @@ FileAccPropList::setSplit(const FileAccPropList &meta_plist, const FileAccPropLi /// property from this property list. ///\return Data sieve buffer size, in bytes ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- size_t FileAccPropList::getSieveBufSize() const @@ -383,7 +364,6 @@ FileAccPropList::getSieveBufSize() const ///\par Description /// For more detail, please refer to the H5Pset_sieve_buf_size /// API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setSieveBufSize(size_t bufsize) const @@ -403,7 +383,6 @@ FileAccPropList::setSieveBufSize(size_t bufsize) const ///\par Description /// For information, please refer to the H5Pset_meta_block_size /// API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setMetaBlockSize(hsize_t &block_size) const @@ -419,7 +398,6 @@ FileAccPropList::setMetaBlockSize(hsize_t &block_size) const ///\brief Returns the current metadata block size setting. ///\return Metadata block size ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hsize_t FileAccPropList::getMetaBlockSize() const @@ -443,7 +421,6 @@ FileAccPropList::getMetaBlockSize() const ///\par Description /// For information, please refer to the H5Pset_fapl_log API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) const @@ -462,7 +439,6 @@ FileAccPropList::setLog(const char *logfile, unsigned flags, size_t buf_size) co ///\param logfile - IN: Name of the log file - string ///\param flags - IN: Flags specifying the types of logging activity ///\param buf_size - IN: Size of the logging buffer -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setLog(const H5std_string &logfile, unsigned flags, size_t buf_size) const @@ -476,7 +452,6 @@ FileAccPropList::setLog(const H5std_string &logfile, unsigned flags, size_t buf_ /// driver. /// ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setSec2() const @@ -501,7 +476,6 @@ FileAccPropList::setSec2() const /// /// For more detail, please refer to the H5Pset_alignment API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const @@ -519,7 +493,6 @@ FileAccPropList::setAlignment(hsize_t threshold, hsize_t alignment) const ///\param threshold - OUT: Retrieved threshold value for file object size ///\param alignment - OUT: Retrieved alignment value ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const @@ -538,7 +511,6 @@ FileAccPropList::getAlignment(hsize_t &threshold, hsize_t &alignment) const ///\par Description /// For information, please refer to the H5Pset_multi_type API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setMultiType(H5FD_mem_t dtype) const @@ -557,7 +529,6 @@ FileAccPropList::setMultiType(H5FD_mem_t dtype) const ///\par Description /// For information, please refer to the H5Pget_multi_type API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5FD_mem_t FileAccPropList::getMultiType() const @@ -585,7 +556,6 @@ FileAccPropList::getMultiType() const /// means fully read chunks are treated no differently than other /// chunks (the preemption is strictly LRU) while a value of one /// means fully read chunks are always preempted before other chunks. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0) const @@ -604,7 +574,6 @@ FileAccPropList::setCache(int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes ///\param rdcc_nbytes - OUT: Total size of the raw data chunk cache, in bytes ///\param rdcc_w0 - OUT: Preemption policy ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileAccPropList::getCache(int &mdc_nelmts, size_t &rdcc_nelmts, size_t &rdcc_nbytes, double &rdcc_w0) const @@ -620,7 +589,6 @@ FileAccPropList::getCache(int &mdc_nelmts, size_t &rdcc_nelmts, size_t &rdcc_nby ///\brief Sets the degree for the file close behavior. ///\param degree - IN: ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const @@ -636,7 +604,6 @@ FileAccPropList::setFcloseDegree(H5F_close_degree_t degree) const ///\brief Returns the degree for the file close behavior. ///\return The degree for the file close behavior ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5F_close_degree_t FileAccPropList::getFcloseDegree() const @@ -658,7 +625,6 @@ FileAccPropList::getFcloseDegree() const ///\par Description /// For information, please refer to the H5Pset_gc_references API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileAccPropList::setGcReferences(unsigned gc_ref) const @@ -674,7 +640,6 @@ FileAccPropList::setGcReferences(unsigned gc_ref) const ///\brief Returns the garbage collecting references setting. ///\return Garbage collecting references setting, 0 (off) or 1 (on) ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- unsigned FileAccPropList::getGcReferences() const @@ -700,7 +665,6 @@ FileAccPropList::getGcReferences() const ///\par Description /// For information, please refer to the H5Pset_file_locking API in /// the HDF5 C Reference Manual. -// Programmer Dana Robinson - 2020 //-------------------------------------------------------------------------- void FileAccPropList::setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_disabled) const @@ -723,7 +687,6 @@ FileAccPropList::setFileLocking(hbool_t use_file_locking, hbool_t ignore_when_di ///\par Description /// For information, please refer to the H5Pget_file_locking API in /// the HDF5 C Reference Manual. -// Programmer Dana Robinson - 2020 //-------------------------------------------------------------------------- void FileAccPropList::getFileLocking(hbool_t &use_file_locking, hbool_t &ignore_when_disabled) const @@ -761,7 +724,6 @@ FileAccPropList::getFileLocking(hbool_t &use_file_locking, hbool_t &ignore_when_ /// /// For more detail, please refer to the H5Pset_libver_bounds API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - March, 2015 //-------------------------------------------------------------------------- void FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_high) const @@ -797,7 +759,6 @@ FileAccPropList::setLibverBounds(H5F_libver_t libver_low, H5F_libver_t libver_hi /// \li \c H5F_LIBVER_112 /// \li \c H5F_LIBVER_114 /// \li \c H5F_LIBVER_LATEST -// Programmer Binh-Minh Ribler - March, 2015 //-------------------------------------------------------------------------- void FileAccPropList::getLibverBounds(H5F_libver_t &libver_low, H5F_libver_t &libver_high) const @@ -811,7 +772,6 @@ FileAccPropList::getLibverBounds(H5F_libver_t &libver_low, H5F_libver_t &libver_ //-------------------------------------------------------------------------- // Function: FileAccPropList destructor ///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileAccPropList::~FileAccPropList() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FcreatProp.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FcreatProp.cpp index b51ba10fe0..fe46dee35e 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FcreatProp.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FcreatProp.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -37,7 +36,6 @@ FileCreatPropList *FileCreatPropList::DEFAULT_ = 0; // Description // If FileCreatPropList::DEFAULT_ already points to an allocated // object, throw a PropListIException. This scenario should not happen. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- FileCreatPropList * FileCreatPropList::getConstant() @@ -63,7 +61,6 @@ FileCreatPropList::getConstant() // Function: FileCreatPropList::deleteConstants // Purpose Deletes the constant object that FileCreatPropList::DEFAULT_ // points to. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void FileCreatPropList::deleteConstants() @@ -81,7 +78,6 @@ const FileCreatPropList &FileCreatPropList::DEFAULT = *getConstant(); //-------------------------------------------------------------------------- // Function: FileCreatPropList default constructor ///\brief Default constructor: Creates a file create property list -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileCreatPropList::FileCreatPropList() : PropList(H5P_FILE_CREATE) { @@ -92,7 +88,6 @@ FileCreatPropList::FileCreatPropList() : PropList(H5P_FILE_CREATE) ///\brief Copy constructor: same HDF5 object as \a original /// FileCreatPropList object. ///\param original - IN: FileCreatPropList instance to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileCreatPropList::FileCreatPropList(const FileCreatPropList &original) : PropList(original) { @@ -103,7 +98,6 @@ FileCreatPropList::FileCreatPropList(const FileCreatPropList &original) : PropLi ///\brief Creates a file creation property list using the id of an /// existing one. ///\param plist_id - IN: FileCreatPropList id to use -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id) { @@ -120,7 +114,6 @@ FileCreatPropList::FileCreatPropList(const hid_t plist_id) : PropList(plist_id) ///\exception H5::PropListIException ///\par Description /// Any (or even all) of the output arguments can be null pointers. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::getVersion(unsigned &super, unsigned &freelist, unsigned &stab, unsigned &shhdr) const @@ -140,7 +133,6 @@ FileCreatPropList::getVersion(unsigned &super, unsigned &freelist, unsigned &sta ///\par Description /// The default user block size is 0; it may be set to any power /// of 2 equal to 512 or greater (512, 1024, 2048, etc.) -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::setUserblock(hsize_t size) const @@ -156,7 +148,6 @@ FileCreatPropList::setUserblock(hsize_t size) const ///\brief Returns the user block size of this file creation property list. ///\return User block size ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- hsize_t FileCreatPropList::getUserblock() const @@ -179,7 +170,6 @@ FileCreatPropList::getUserblock() const ///\par Description /// For information, please refer to the H5Pset_sizes API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const @@ -196,7 +186,6 @@ FileCreatPropList::setSizes(size_t sizeof_addr, size_t sizeof_size) const /// HDF5 file. /// ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::getSizes(size_t &sizeof_addr, size_t &sizeof_size) const @@ -217,7 +206,6 @@ FileCreatPropList::getSizes(size_t &sizeof_addr, size_t &sizeof_size) const ///\par Description /// For information, please refer to the H5Pset_sym_k API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::setSymk(unsigned ik, unsigned lk) const @@ -237,7 +225,6 @@ FileCreatPropList::setSymk(unsigned ik, unsigned lk) const ///\par Description /// For information, please refer to the H5Pget_sym_k API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::getSymk(unsigned &ik, unsigned &lk) const @@ -257,7 +244,6 @@ FileCreatPropList::getSymk(unsigned &ik, unsigned &lk) const ///\par Description /// For information, please refer to the H5Pset_istore_k API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileCreatPropList::setIstorek(unsigned ik) const @@ -276,7 +262,6 @@ FileCreatPropList::setIstorek(unsigned ik) const ///\par Description /// For information, please refer to the H5Pget_istore_k API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- unsigned FileCreatPropList::getIstorek() const @@ -305,7 +290,6 @@ FileCreatPropList::getIstorek() const /// changed and the existing threshold will be retained. /// For information, please refer to the H5Pset_file_space_strategy /// API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - Feb, 2017 //-------------------------------------------------------------------------- void FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, @@ -326,7 +310,6 @@ FileCreatPropList::setFileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t ///\param persist - OUT: Whether to persist free-space ///\param threshold - OUT: Free-space section threshold ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Feb, 2017 //-------------------------------------------------------------------------- void FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t &strategy, hbool_t &persist, @@ -344,7 +327,6 @@ FileCreatPropList::getFileSpaceStrategy(H5F_fspace_strategy_t &strategy, hbool_t ///\brief Sets the file space page size for paged aggregation. ///\param fsp_psize - IN: Filespace's page size ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Feb, 2017 //-------------------------------------------------------------------------- void FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const @@ -362,7 +344,6 @@ FileCreatPropList::setFileSpacePagesize(hsize_t fsp_psize) const /// metadata or raw data. ///\return File space page size ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Feb, 2017 //-------------------------------------------------------------------------- hsize_t FileCreatPropList::getFileSpacePagesize() const @@ -379,7 +360,6 @@ FileCreatPropList::getFileSpacePagesize() const //-------------------------------------------------------------------------- // Function: FileCreatPropList destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FileCreatPropList::~FileCreatPropList() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5File.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5File.cpp index eaa7162976..9c390f9c73 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5File.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5File.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -619,7 +618,6 @@ H5File::getVFDHandle(void **file_handle) const ///\par Description /// This function is called after an existing file is opened in /// order to learn the true size of the underlying file. -// Programmer Raymond Lu - June 24, 2004 //-------------------------------------------------------------------------- hsize_t H5File::getFileSize() const @@ -640,7 +638,6 @@ H5File::getFileSize() const ///\par Description /// This function is called after an existing file is opened in /// order to retrieve the unique 'file number' for the file. -// Programmer Quincey Koziol - April 13, 2019 //-------------------------------------------------------------------------- unsigned long H5File::getFileNum() const diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FloatType.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FloatType.cpp index 33f8377084..74170da00a 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FloatType.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5FloatType.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -38,7 +37,6 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: FloatType default constructor ///\brief Default constructor: Creates a stub floating-point datatype -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType::FloatType() { @@ -49,7 +47,6 @@ FloatType::FloatType() ///\brief Creates a floating-point datatype using a predefined type. ///\param pred_type - IN: Predefined datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType::FloatType(const PredType &pred_type) : AtomType() { @@ -63,7 +60,6 @@ FloatType::FloatType(const PredType &pred_type) : AtomType() /// datatype. ///\param existing_id - IN: Id of an existing datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType::FloatType(const hid_t existing_id) : AtomType(existing_id) { @@ -72,7 +68,6 @@ FloatType::FloatType(const hid_t existing_id) : AtomType(existing_id) //-------------------------------------------------------------------------- // Function: FloatType copy constructor ///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType::FloatType(const FloatType &original) : AtomType(original) { @@ -84,7 +79,6 @@ FloatType::FloatType(const FloatType &original) : AtomType(original) ///\param dataset - IN: Dataset that this floating-point datatype /// associates with ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType::FloatType(const DataSet &dataset) : AtomType() { @@ -103,7 +97,6 @@ FloatType::FloatType(const DataSet &dataset) : AtomType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: Float type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openFloatType(const char*) @@ -122,7 +115,6 @@ FloatType::FloatType(const H5Location &loc, const char *dtype_name) : AtomType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: Float type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openFloatType(const H5std_string&) @@ -140,7 +132,6 @@ FloatType::FloatType(const H5Location &loc, const H5std_string &dtype_name) : At /// binary object description of this type. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- DataType * FloatType::decode() const @@ -166,7 +157,6 @@ FloatType::decode() const ///\param mpos - OUT: Retrieved mantissa bit-position ///\param msize - OUT: Retrieved size of mantissa, in bits ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FloatType::getFields(size_t &spos, size_t &epos, size_t &esize, size_t &mpos, size_t &msize) const @@ -187,7 +177,6 @@ FloatType::getFields(size_t &spos, size_t &epos, size_t &esize, size_t &mpos, si ///\param mpos - OUT: Mantissa bit-position ///\param msize - OUT: Size of mantissa, in bits ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t msize) const @@ -203,7 +192,6 @@ FloatType::setFields(size_t spos, size_t epos, size_t esize, size_t mpos, size_t ///\brief Retrieves the exponent bias of a floating-point type. ///\return Exponent bias ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- size_t FloatType::getEbias() const @@ -221,7 +209,6 @@ FloatType::getEbias() const ///\brief Sets the exponent bias of a floating-point type. ///\param ebias - Exponent bias value ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FloatType::setEbias(size_t ebias) const @@ -245,7 +232,6 @@ FloatType::setEbias(size_t ebias) const /// For your convenience, this function also provides the text /// string of the returned normalization type, via parameter /// \a norm_string. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_norm_t FloatType::getNorm(H5std_string &norm_string) const @@ -274,7 +260,6 @@ FloatType::getNorm(H5std_string &norm_string) const /// \li \c H5T_NORM_IMPLIED (0) - MSB of mantissa is not stored /// \li \c H5T_NORM_MSBSET (1) - MSB of mantissa is always 1 /// \li \c H5T_NORM_NONE (2) - Mantissa is not normalized -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FloatType::setNorm(H5T_norm_t norm) const @@ -298,7 +283,6 @@ FloatType::setNorm(H5T_norm_t norm) const /// For your convenience, this function also provides the text /// string of the returned internal padding type, via parameter /// \a pad_string. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_pad_t FloatType::getInpad(H5std_string &pad_string) const @@ -332,7 +316,6 @@ FloatType::getInpad(H5std_string &pad_string) const /// \li \c H5T_PAD_ZERO (0) - Set background to zeros /// \li \c H5T_PAD_ONE (1) - Set background to ones /// \li \c H5T_PAD_BACKGROUND (2) - Leave background alone -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FloatType::setInpad(H5T_pad_t inpad) const @@ -346,7 +329,6 @@ FloatType::setInpad(H5T_pad_t inpad) const //-------------------------------------------------------------------------- // Function: FloatType destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- FloatType::~FloatType() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Group.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Group.cpp index b017f4f6ee..35e9d26bfa 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Group.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Group.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -44,7 +43,6 @@ using std::endl; //-------------------------------------------------------------------------- // Function: Group default constructor ///\brief Default constructor: creates a stub Group. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) { @@ -54,7 +52,6 @@ Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) // Function: Group copy constructor ///\brief Copy constructor: same HDF5 object as \a original ///\param original - IN: Original group to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group::Group(const Group &original) : H5Object(), CommonFG(), id(original.id) { @@ -66,7 +63,6 @@ Group::Group(const Group &original) : H5Object(), CommonFG(), id(original.id) ///\brief Closes an object, which was opened with Group::getObjId /// ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - March, 2017 //-------------------------------------------------------------------------- void Group::closeObjId(hid_t obj_id) const @@ -80,7 +76,6 @@ Group::closeObjId(hid_t obj_id) const //-------------------------------------------------------------------------- // Function: Group::getLocId // Purpose: Get the id of this group -// Programmer Binh-Minh Ribler - 2000 // Description // This function is a redefinition of CommonFG::getLocId. It // is used by CommonFG member functions to get the file id. @@ -99,7 +94,6 @@ Group::getLocId() const // Function: Group overloaded constructor ///\brief Creates a Group object using the id of an existing group. ///\param existing_id - IN: Id of an existing group -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id) { @@ -117,7 +111,6 @@ Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id) ///\par Description /// \c obj can be DataSet, Group, or named DataType, that /// is a datatype that has been named by DataType::commit. -// Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- Group::Group(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist) : H5Object(), CommonFG(), id(H5I_INVALID_HID) @@ -130,7 +123,6 @@ Group::Group(const H5Location &loc, const void *ref, H5R_type_t ref_type, const ///\brief Returns the number of objects in this group. ///\return Number of objects ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- hsize_t Group::getNumObjs() const @@ -154,7 +146,6 @@ Group::getNumObjs() const /// This function opens an object in a group or file, using /// H5Oopen. Thus, an object can be opened without knowing /// the object's type. -// Programmer Binh-Minh Ribler - March, 2017 //-------------------------------------------------------------------------- hid_t Group::getObjId(const char *obj_name, const PropList &plist) const @@ -174,7 +165,6 @@ Group::getObjId(const char *obj_name, const PropList &plist) const ///\param plist - IN: Access property list for the link pointing to /// the object ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - March, 2017 //-------------------------------------------------------------------------- hid_t Group::getObjId(const H5std_string &obj_name, const PropList &plist) const @@ -192,7 +182,6 @@ Group::getObjId(const H5std_string &obj_name, const PropList &plist) const // AbstractDS and Attribute are moved out of H5Object. In // addition, member IdComponent::id is moved into subclasses, and // IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 //-------------------------------------------------------------------------- hid_t Group::getId() const @@ -211,7 +200,6 @@ Group::getId() const // The underlying reference counting in the C library ensures // that the current valid id of this object is properly closed. // Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Group::p_setId(const hid_t new_id) @@ -233,7 +221,6 @@ Group::p_setId(const hid_t new_id) ///\brief Closes this group. /// ///\exception H5::GroupIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void Group::close() @@ -259,7 +246,6 @@ Group::close() // proper exception can be thrown for file or group. The // "Group::" will be inserted to indicate the function called is // an implementation of Group. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void Group::throwException(const H5std_string &func_name, const H5std_string &msg) const @@ -272,7 +258,6 @@ Group::throwException(const H5std_string &func_name, const H5std_string &msg) co //-------------------------------------------------------------------------- // Function: Group destructor ///\brief Properly terminates access to this group. -// Programmer Binh-Minh Ribler - 2000 // Modification // - Replaced resetIdComponent() with decRefCount() to use C // library ID reference counting mechanism - BMR, Feb 20, 2005 diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5IdComponent.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5IdComponent.cpp index ce52fb0d60..93df34391c 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5IdComponent.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5IdComponent.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -35,7 +34,6 @@ bool IdComponent::H5dontAtexit_called = false; //-------------------------------------------------------------------------- // Function: IdComponent::incRefCount ///\brief Increment reference counter for a given id. -// Programmer Binh-Minh Ribler - May 2005 //-------------------------------------------------------------------------- void IdComponent::incRefCount(const hid_t obj_id) const @@ -48,7 +46,6 @@ IdComponent::incRefCount(const hid_t obj_id) const //-------------------------------------------------------------------------- // Function: IdComponent::incRefCount ///\brief Increment reference counter for the id of this object. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void IdComponent::incRefCount() const @@ -59,7 +56,6 @@ IdComponent::incRefCount() const //-------------------------------------------------------------------------- // Function: IdComponent::decRefCount ///\brief Decrement reference counter for a given id. -// Programmer Binh-Minh Ribler - May 2005 // Modification: // Added the check for ref counter to give a little more info // on why H5Idec_ref fails in some cases - BMR 5/19/2005 @@ -79,7 +75,6 @@ IdComponent::decRefCount(const hid_t obj_id) const //-------------------------------------------------------------------------- // Function: IdComponent::decRefCount ///\brief Decrement reference counter for the id of this object. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void IdComponent::decRefCount() const @@ -91,7 +86,6 @@ IdComponent::decRefCount() const // Function: IdComponent::getCounter ///\brief Returns the reference counter for a given id. ///\return Reference count -// Programmer Binh-Minh Ribler - May 2005 //-------------------------------------------------------------------------- int IdComponent::getCounter(const hid_t obj_id) const @@ -110,7 +104,6 @@ IdComponent::getCounter(const hid_t obj_id) const // Function: IdComponent::getCounter ///\brief Returns the reference counter for the id of this object. ///\return Reference count -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int IdComponent::getCounter() const @@ -130,7 +123,6 @@ IdComponent::getCounter() const /// \li \c H5I_ATTR /// \li or \c H5I_BADID, if no valid type can be determined or the /// input object id is invalid. -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- H5I_type_t IdComponent::getHDFObjType(const hid_t obj_id) @@ -157,7 +149,6 @@ IdComponent::getHDFObjType(const hid_t obj_id) /// \li \c H5I_ATTR /// \li or \c H5I_BADID, if no valid type can be determined or the /// input object id is invalid. -// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- H5I_type_t IdComponent::getHDFObjType() const @@ -185,7 +176,6 @@ IdComponent::getHDFObjType() const /// \li \c H5I_ERROR_CLASS /// \li \c H5I_ERROR_MSG /// \li \c H5I_ERROR_STACK -// Programmer Binh-Minh Ribler - Feb, 2017 //-------------------------------------------------------------------------- hsize_t IdComponent::getNumMembers(H5I_type_t type) @@ -205,7 +195,6 @@ IdComponent::getNumMembers(H5I_type_t type) ///\par Description /// A valid ID is one that is in use and has an application /// reference count of at least 1. -// Programmer Binh-Minh Ribler - Mar 1, 2017 //-------------------------------------------------------------------------- bool IdComponent::isValid(hid_t an_id) @@ -240,7 +229,6 @@ IdComponent::isValid(hid_t an_id) /// \li \c H5I_ERROR_CLASS /// \li \c H5I_ERROR_MSG /// \li \c H5I_ERROR_STACK -// Programmer Binh-Minh Ribler - Feb, 2017 //-------------------------------------------------------------------------- bool IdComponent::typeExists(H5I_type_t type) @@ -271,7 +259,6 @@ IdComponent::typeExists(H5I_type_t type) // 2010/5/9 - BMR // Removed close() and incRefCount() because setId/p_setId takes // care of close() and setId takes care incRefCount(). -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IdComponent & IdComponent::operator=(const IdComponent &rhs) @@ -299,7 +286,6 @@ IdComponent::operator=(const IdComponent &rhs) // Description: // p_setId ensures that the current valid id of this object is // properly closed before resetting the object's id to the new id. -// Programmer Binh-Minh Ribler - 2000 // Modification // 2008/7/23 - BMR // Changed all subclasses' setId to p_setId and put back setId @@ -324,7 +310,6 @@ IdComponent::setId(const hid_t new_id) //-------------------------------------------------------------------------- // Function: IdComponent destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IdComponent::~IdComponent() { @@ -346,7 +331,6 @@ IdComponent::~IdComponent() /// where the failure occurs. The class-name is provided by /// fromClass(). This string will be used by a base class when /// an exception is thrown. -// Programmer Binh-Minh Ribler - Aug 6, 2005 //-------------------------------------------------------------------------- H5std_string IdComponent::inMemFunc(const char *func_name) const @@ -360,7 +344,6 @@ IdComponent::inMemFunc(const char *func_name) const //-------------------------------------------------------------------------- // Function: IdComponent default constructor - private ///\brief Default constructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IdComponent::IdComponent() { @@ -382,7 +365,6 @@ IdComponent::IdComponent() // September 2017 // This function should be moved to H5Location now that Attribute // inherits from H5Location. -// Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string IdComponent::p_get_file_name() const @@ -428,7 +410,6 @@ IdComponent::p_get_file_name() const // Purpose Verifies that the given id is a valid id so it can be passed // into an H5I C function. // Return true if id is valid, false, otherwise -// Programmer Binh-Minh Ribler - May, 2005 //-------------------------------------------------------------------------- bool IdComponent::p_valid_id(const hid_t obj_id) diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5IntType.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5IntType.cpp index 27c449165b..87a287f674 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5IntType.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5IntType.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -38,7 +37,6 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: IntType default constructor ///\brief Default constructor: Creates a stub integer datatype -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType::IntType() { @@ -47,7 +45,6 @@ IntType::IntType() //-------------------------------------------------------------------------- // Function: IntType copy constructor ///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType::IntType(const IntType &original) : AtomType(original) { @@ -58,7 +55,6 @@ IntType::IntType(const IntType &original) : AtomType(original) ///\brief Creates a integer type using a predefined type ///\param pred_type - IN: Predefined datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType::IntType(const PredType &pred_type) : AtomType() { @@ -72,7 +68,6 @@ IntType::IntType(const PredType &pred_type) : AtomType() /// datatype. ///\param existing_id - IN: Id of an existing datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType::IntType(const hid_t existing_id) : AtomType(existing_id) { @@ -83,7 +78,6 @@ IntType::IntType(const hid_t existing_id) : AtomType(existing_id) ///\brief Gets the integer datatype of the specified dataset. ///\param dataset - IN: Dataset that this integer datatype associates with ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType::IntType(const DataSet &dataset) : AtomType() { @@ -102,7 +96,6 @@ IntType::IntType(const DataSet &dataset) : AtomType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: Integer type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openIntType(const char*) to @@ -121,7 +114,6 @@ IntType::IntType(const H5Location &loc, const char *dtype_name) : AtomType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: Integer type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openIntType(const H5std_string&) @@ -139,7 +131,6 @@ IntType::IntType(const H5Location &loc, const H5std_string &dtype_name) : AtomTy /// binary object description of this type. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- DataType * IntType::decode() const @@ -161,7 +152,6 @@ IntType::decode() const ///\brief Retrieves the sign type for an integer type. ///\return Valid sign type ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_sign_t IntType::getSign() const @@ -181,7 +171,6 @@ IntType::getSign() const ///\brief Sets the sign property for an integer type. ///\param sign - IN: Sign type ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void IntType::setSign(H5T_sign_t sign) const @@ -196,7 +185,6 @@ IntType::setSign(H5T_sign_t sign) const //-------------------------------------------------------------------------- // Function: IntType destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- IntType::~IntType() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5LaccProp.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5LaccProp.cpp index acdaa13d57..0285ee7baf 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5LaccProp.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5LaccProp.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -38,7 +37,6 @@ LinkAccPropList *LinkAccPropList::DEFAULT_ = 0; // If LinkAccPropList::DEFAULT_ already points to an allocated // object, throw a PropListIException. This scenario should not // happen. -// Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- LinkAccPropList * LinkAccPropList::getConstant() @@ -65,7 +63,6 @@ LinkAccPropList::getConstant() // Purpose: Deletes the constant object that LinkAccPropList::DEFAULT_ // points to. // exception H5::PropListIException -// Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- void LinkAccPropList::deleteConstants() @@ -83,7 +80,6 @@ const LinkAccPropList &LinkAccPropList::DEFAULT = *getConstant(); //-------------------------------------------------------------------------- // Function: Default Constructor ///\brief Creates a file access property list -// Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) { @@ -93,7 +89,6 @@ LinkAccPropList::LinkAccPropList() : PropList(H5P_LINK_ACCESS) // Function: LinkAccPropList copy constructor ///\brief Copy Constructor: same HDF5 object as \a original ///\param original - IN: LinkAccPropList instance to copy -// Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- LinkAccPropList::LinkAccPropList(const LinkAccPropList &original) : PropList(original) { @@ -103,7 +98,6 @@ LinkAccPropList::LinkAccPropList(const LinkAccPropList &original) : PropList(ori // Function: LinkAccPropList overloaded constructor ///\brief Creates a file access property list using the id of an /// existing one. -// Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) { @@ -116,7 +110,6 @@ LinkAccPropList::LinkAccPropList(const hid_t plist_id) : PropList(plist_id) /// traversal. /// ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - March 1, 2017 //-------------------------------------------------------------------------- void LinkAccPropList::setNumLinks(size_t nlinks) const @@ -134,7 +127,6 @@ LinkAccPropList::setNumLinks(size_t nlinks) const /// traversed before a failure occurs. /// ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - March 1, 2017 //-------------------------------------------------------------------------- size_t LinkAccPropList::getNumLinks() const @@ -151,7 +143,6 @@ LinkAccPropList::getNumLinks() const //-------------------------------------------------------------------------- // Function: LinkAccPropList destructor ///\brief Noop destructor -// Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- LinkAccPropList::~LinkAccPropList() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5LcreatProp.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5LcreatProp.cpp index 3851d56dc1..2f3437531b 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5LcreatProp.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5LcreatProp.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Library.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Library.cpp index 19c7ee78a7..019ae67b4c 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Library.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Library.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -42,7 +41,6 @@ namespace H5 { ///\brief Initializes the HDF5 library. /// ///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Library::open() @@ -58,7 +56,6 @@ H5Library::open() ///\brief Flushes all data to disk, closes files, and cleans up memory. /// ///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Library::close() @@ -74,7 +71,6 @@ H5Library::close() ///\brief Instructs library not to install the C \c atexit cleanup routine /// ///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 // Modification // Removed the check for failure returned from H5dont_atexit. // will be fixed to not fail (HDFFV-9540) @@ -92,7 +88,6 @@ H5Library::dontAtExit() ///\param minnum - OUT: Minor version of the library ///\param relnum - OUT: Release number of the library ///\exception H5::LibraryIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Library::getLibVersion(unsigned &majnum, unsigned &minnum, unsigned &relnum) @@ -114,7 +109,6 @@ H5Library::getLibVersion(unsigned &majnum, unsigned &minnum, unsigned &relnum) ///\par Description /// For information about library version, please refer to /// the H5check_version API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum) @@ -143,7 +137,6 @@ H5Library::checkVersion(unsigned majnum, unsigned minnum, unsigned relnum) ///\par /// The library automatically garbage collects all the free /// lists when the application ends. -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Library::garbageCollect() @@ -167,7 +160,6 @@ H5Library::garbageCollect() // for global constants ///\exception H5::LibraryIException // -// Programmer Binh-Minh Ribler - September, 2015 //-------------------------------------------------------------------------- void H5Library::initH5cpp() @@ -237,7 +229,6 @@ H5Library::initH5cpp() ///\brief Sends request for the C layer to terminate. ///\par Description /// If the C library fails to terminate, exit with a failure. -// Programmer Binh-Minh Ribler - September, 2015 //-------------------------------------------------------------------------- void H5Library::termH5cpp() @@ -262,7 +253,6 @@ H5Library::termH5cpp() /// Setting a value of -1 for a limit means no limit of that type. /// For more information on free list limits, please refer to /// the H5set_free_list_limits API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim, @@ -279,7 +269,6 @@ H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, int arr_globa //-------------------------------------------------------------------------- // Function: H5Library default constructor - private ///\brief Default constructor: Creates a stub H5Library object -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Library::H5Library() { @@ -288,7 +277,6 @@ H5Library::H5Library() //-------------------------------------------------------------------------- // Function: H5Library destructor ///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Library::~H5Library() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Location.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Location.cpp index a20386392b..8befefc5a1 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Location.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Location.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -42,7 +41,6 @@ namespace H5 { #ifndef DOXYGEN_SHOULD_SKIP_THIS //-------------------------------------------------------------------------- // Function: H5Location default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::H5Location() : IdComponent() { @@ -53,7 +51,6 @@ H5Location::H5Location() : IdComponent() // Purpose Creates an H5Location object using the id of an existing HDF5 // object. // Parameters object_id - IN: Id of an existing HDF5 object -// Programmer Binh-Minh Ribler - 2000 // *** Deprecation warning *** // This constructor is no longer appropriate because the data member "id" had @@ -69,7 +66,6 @@ H5Location::H5Location() : IdComponent() // Purpose This noop copy constructor is removed as a result of the data // member "id" being moved down to sub-classes. (Mar 2015) ///\param original - IN: H5Location instance to copy -// Programmer Binh-Minh Ribler - 2000 // // *** Deprecation warning *** // This constructor is no longer appropriate because the data member "id" had @@ -125,7 +121,6 @@ H5Location::nameExists(const H5std_string &name, const LinkAccPropList &lapl) co ///\param name - IN: Searched name ///\param lapl - IN: Link access property list ///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Nov, 2016 // Modification // Renamed to nameExists() in 1.10.2 -BMR //-------------------------------------------------------------------------- @@ -142,7 +137,6 @@ H5Location::exists(const char *name, const LinkAccPropList &lapl) const ///\param name - IN: Searched name ///\param lapl - IN: Link access property list ///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Dec, 2016 // Modification // Renamed to nameExists() in 1.10.2 -BMR //-------------------------------------------------------------------------- @@ -162,7 +156,6 @@ H5Location::exists(const H5std_string &name, const LinkAccPropList &lapl) const ///\exception H5::LocationException ///\par Description /// This location is used to identify the file to be flushed. -// Programmer Binh-Minh Ribler - 2012 // Modification // Sep 2012 - BMR // Moved from H5File/H5Object @@ -182,7 +175,6 @@ H5Location::flush(H5F_scope_t scope) const /// location belongs. ///\return File name ///\exception H5::LocationException -// Programmer Binh-Minh Ribler - Jul, 2004 //-------------------------------------------------------------------------- H5std_string H5Location::getFileName() const @@ -208,7 +200,6 @@ H5Location::getFileName() const /// strings. They can be attached to any object that has an /// object header, e.g., data sets, groups, named data types, /// and data spaces, but not symbolic links. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) // Modification // 2007: QAK modified to use H5O APIs; however the first parameter is // no longer just file or group, this function should be moved @@ -228,7 +219,6 @@ H5Location::setComment(const char *name, const char *comment) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name and \a comment. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) //-------------------------------------------------------------------------- void H5Location::setComment(const H5std_string &name, const H5std_string &comment) const @@ -241,7 +231,6 @@ H5Location::setComment(const H5std_string &name, const H5std_string &comment) co ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it doesn't take /// an object name. -// Programmer Binh-Minh Ribler - Sep 2013 //-------------------------------------------------------------------------- void H5Location::setComment(const char *comment) const @@ -256,7 +245,6 @@ H5Location::setComment(const char *comment) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a comment. -// Programmer Binh-Minh Ribler - Sep 2013 //-------------------------------------------------------------------------- void H5Location::setComment(const H5std_string &comment) const @@ -269,7 +257,6 @@ H5Location::setComment(const H5std_string &comment) const ///\brief Removes the comment from an object specified by its name. ///\param name - IN: Name of the object ///\exception H5::LocationException -// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) // 2007: QAK modified to use H5O APIs; however the first parameter is // no longer just file or group, this function should be moved // to another class to accommodate attribute, dataset, and named @@ -288,7 +275,6 @@ H5Location::removeComment(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - May 2005 (moved from CommonFG, Sep 2013) //-------------------------------------------------------------------------- void H5Location::removeComment(const H5std_string &name) const @@ -309,7 +295,6 @@ H5Location::removeComment(const H5std_string &name) const /// including the null terminator. Thus, if the actual length /// of the comment is more than buf_size-1, the retrieved comment /// will be truncated to accommodate the null terminator. -// Programmer Binh-Minh Ribler - Mar 2014 //-------------------------------------------------------------------------- ssize_t H5Location::getComment(const char *name, size_t buf_size, char *comment) const @@ -340,7 +325,6 @@ H5Location::getComment(const char *name, size_t buf_size, char *comment) const ///\param buf_size - IN: Length of the comment to retrieve, default to 0 ///\return Comment string ///\exception H5::LocationException -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) //-------------------------------------------------------------------------- H5std_string H5Location::getComment(const char *name, size_t buf_size) const @@ -391,7 +375,6 @@ H5Location::getComment(const char *name, size_t buf_size) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 (moved from CommonFG, Sep 2013) //-------------------------------------------------------------------------- H5std_string H5Location::getComment(const H5std_string &name, size_t buf_size) const @@ -409,7 +392,6 @@ H5Location::getComment(const H5std_string &name, size_t buf_size) const // dataspace - IN: Dataspace with selection // ref_type - IN: Type of reference; default to \c H5R_DATASET_REGION // Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::p_reference(void *ref, const char *name, hid_t space_id, H5R_type_t ref_type) const @@ -434,7 +416,6 @@ H5Location::p_reference(void *ref, const char *name, hid_t space_id, H5R_type_t /// reference. (default) ///\exception H5::ReferenceException ///\note This method is more suitable for a dataset region reference. -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void *ref, const char *name, const DataSpace &dataspace, H5R_type_t ref_type) const @@ -461,7 +442,6 @@ H5Location::reference(void *ref, const char *name, const DataSpace &dataspace, H /// reference. (default) ///\exception H5::ReferenceException ///\note This method is more suitable for a dataset region reference. -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void *ref, const H5std_string &name, const DataSpace &dataspace, @@ -487,7 +467,6 @@ H5Location::reference(void *ref, const H5std_string &name, const DataSpace &data /// \li \c H5R_DATASET_REGION - Reference is a dataset region ///\exception H5::ReferenceException ///\note This method is more suitable for an object reference. -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void *ref, const char *name, H5R_type_t ref_type) const @@ -511,7 +490,6 @@ H5Location::reference(void *ref, const char *name, H5R_type_t ref_type) const /// \li \c H5R_OBJECT - Reference is an object reference (default) /// \li \c H5R_DATASET_REGION - Reference is a dataset region ///\note This method is more suitable for an object reference. -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- void H5Location::reference(void *ref, const H5std_string &name, H5R_type_t ref_type) const @@ -531,7 +509,6 @@ H5Location::reference(void *ref, const H5std_string &name, H5R_type_t ref_type) // plist - IN: Property list - default to PropList::DEFAULT // from_func - IN: Name of the calling function // Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- hid_t H5Location::p_dereference(hid_t loc_id, const void *ref, H5R_type_t ref_type, const PropList &plist, @@ -560,7 +537,6 @@ H5Location::p_dereference(hid_t loc_id, const void *ref, H5R_type_t ref_type, co ///\param ref_type - IN: Reference type ///\param plist - IN: Property list - default to PropList::DEFAULT ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 //-------------------------------------------------------------------------- void H5Location::dereference(const H5Location &loc, const void *ref, H5R_type_t ref_type, const PropList &plist) @@ -576,7 +552,6 @@ H5Location::dereference(const H5Location &loc, const void *ref, H5R_type_t ref_t // param ref_type - IN: Reference type // param plist - IN: Property list - default to PropList::DEFAULT // exception H5::ReferenceException -// Programmer Binh-Minh Ribler - Oct, 2006 // Modification // Mar, 2017 // Removed in 1.10.1 because H5Location is Attribute's baseclass @@ -605,7 +580,6 @@ plist) /// \li \c H5G_LINK - Object is a symbolic link. /// \li \c H5G_UDLINK - Object is a user-defined link. ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 // Modification // Sep 2012: Moved up from H5File, Group, DataSet, and DataType //-------------------------------------------------------------------------- @@ -635,7 +609,6 @@ H5Location::getObjType(void *ref, H5R_type_t ref_type) const // H5G_LINK \tObject is a symbolic link. // H5G_UDLINK \tObject is a user-defined link. // Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5G_obj_t H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const @@ -664,7 +637,6 @@ H5Location::p_get_obj_type(void *ref, H5R_type_t ref_type) const /// \li \c H5O_TYPE_NAMED_DATATYPE - Object is a named datatype /// \li \c H5O_TYPE_NTYPES - Number of different object types ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const @@ -691,7 +663,6 @@ H5Location::getRefObjType(void *ref, H5R_type_t ref_type) const // H5O_TYPE_NAMED_DATATYPE - Object is a named datatype // H5O_TYPE_NTYPES - Number of object types // Exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- H5O_type_t H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const @@ -716,7 +687,6 @@ H5Location::p_get_ref_obj_type(void *ref, H5R_type_t ref_type) const // to H5R_DATASET_REGION ///\return DataSpace object ///\exception H5::ReferenceException -// Programmer Binh-Minh Ribler - May, 2004 // Modification // Mar 29, 2015 // Used friend function to set id for DataSpace instead of the @@ -786,7 +756,6 @@ H5Location::getRegion(void *ref, H5R_type_t ref_type) const /// reserve for storing the names that will appear in this new /// group. If a non-positive value is provided for the \a size_hint /// then a default size is chosen. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group H5Location::createGroup(const char *name, const LinkCreatPropList &lcpl) const @@ -811,7 +780,6 @@ H5Location::createGroup(const char *name, const LinkCreatPropList &lcpl) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group H5Location::createGroup(const H5std_string &name, const LinkCreatPropList &lcpl) const @@ -833,7 +801,6 @@ H5Location::createGroup(const H5std_string &name, const LinkCreatPropList &lcpl) /// reserve for storing the names that will appear in this new /// group. If a non-positive value is provided for the \a size_hint /// then a default size is chosen. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group H5Location::createGroup(const char *name, size_t size_hint) const @@ -877,7 +844,6 @@ H5Location::createGroup(const char *name, size_t size_hint) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group H5Location::createGroup(const H5std_string &name, size_t size_hint) const @@ -892,7 +858,6 @@ H5Location::createGroup(const H5std_string &name, size_t size_hint) const ///\param name - IN: Name of the group to open ///\return Group instance ///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group H5Location::openGroup(const char *name) const @@ -918,7 +883,6 @@ H5Location::openGroup(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Group H5Location::openGroup(const H5std_string &name) const @@ -1185,7 +1149,6 @@ H5Location::link(const H5std_string &curr_name, const hid_t same_loc, const H5st /// For information on creating hard link and soft link, please /// refer to the H5Lcreate_hard and H5Lcreate_soft APIs in the /// HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 // Modification // 2007: QAK modified to use H5L APIs - BMR // Mar 2018: Inadequate functionality, new hard link is only in @@ -1223,7 +1186,6 @@ H5Location::link(H5L_type_t link_type, const char *curr_name, const char *new_na ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a curr_name and \a new_name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Location::link(H5L_type_t link_type, const H5std_string &curr_name, const H5std_string &new_name) const @@ -1733,7 +1695,6 @@ H5Location::getObjinfo(const char *name, hbool_t follow_link, H5G_stat_t &statbu ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Location::getObjinfo(const H5std_string &name, hbool_t follow_link, H5G_stat_t &statbuf) const @@ -1761,7 +1722,6 @@ H5Location::getObjinfo(const char *name, H5G_stat_t &statbuf) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - Nov, 2005 //-------------------------------------------------------------------------- void H5Location::getObjinfo(const H5std_string &name, H5G_stat_t &statbuf) const @@ -1853,7 +1813,6 @@ H5Location::getLinkval(const char *name, size_t size) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5std_string H5Location::getLinkval(const H5std_string &name, size_t size) const @@ -1868,7 +1827,6 @@ H5Location::getLinkval(const H5std_string &name, size_t size) const ///\param child - IN: File to mount ///\param plist - IN: Property list to use ///\exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2014 (original 2000) //-------------------------------------------------------------------------- void H5Location::mount(const char *name, const H5File &child, const PropList &plist) const @@ -1894,7 +1852,6 @@ H5Location::mount(const char *name, const H5File &child, const PropList &plist) // Param child - IN: File to mount // Param plist - IN: Property list to use // Exception H5::FileIException or H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 // Modification // Modified to call its replacement. -BMR, 2014/04/16 // Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 @@ -1909,7 +1866,6 @@ H5Location::mount(const char *name, const H5File &child, const PropList &plist) // Function: H5Location::mount ///\brief This is an overloaded member function, provided for convenience. /// It takes an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Location::mount(const H5std_string &name, const H5File &child, const PropList &plist) const @@ -1922,7 +1878,6 @@ H5Location::mount(const H5std_string &name, const H5File &child, const PropList // Purpose This is an overloaded member function, kept for backward // compatibility. It differs from the above function in that it // misses const's. This wrapper will be removed in future release. -// Programmer Binh-Minh Ribler - 2014 // Modification // Modified to call its replacement. -BMR, 2014/04/16 // Removed from documentation. -BMR, 2016/03/07 1.8.17 and 1.10.0 @@ -1938,7 +1893,6 @@ H5Location::mount(const H5std_string &name, const H5File &child, const PropList ///\brief Unmounts the specified file. ///\param name - IN: Name of the file to unmount ///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Location::unmount(const char *name) const @@ -1956,7 +1910,6 @@ H5Location::unmount(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Location::unmount(const H5std_string &name) const @@ -1976,7 +1929,6 @@ H5Location::unmount(const H5std_string &name) const /// or zero if all members were processed with no operator /// returning non-zero. ///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int H5Location::iterateElems(const char *name, int *idx, H5G_iterate_t op, void *op_data) @@ -1993,7 +1945,6 @@ H5Location::iterateElems(const char *name, int *idx, H5G_iterate_t op, void *op_ ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int H5Location::iterateElems(const H5std_string &name, int *idx, H5G_iterate_t op, void *op_data) @@ -2007,7 +1958,6 @@ H5Location::iterateElems(const H5std_string &name, int *idx, H5G_iterate_t op, v ///\brief Deprecated - moved to H5::Group in 1.10.2. ///\return Deprecated ///\exception Deprecated -// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- hsize_t H5Location::getNumObjs() const @@ -2033,7 +1983,6 @@ H5Location::getNumObjs() const /// the function \c H5Location::getNumObjs. Note that this is a /// transient index; thus, an object may have a different index /// each time the group is opened. -// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- H5std_string H5Location::getObjnameByIdx(hsize_t idx) const @@ -2080,7 +2029,6 @@ H5Location::getObjnameByIdx(hsize_t idx) const /// the function \c H5Location::getNumObjs. Note that this is a /// transient index; thus, an object may have a different index /// each time the group is opened. -// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- ssize_t H5Location::getObjnameByIdx(hsize_t idx, char *name, size_t size) const @@ -2098,7 +2046,6 @@ H5Location::getObjnameByIdx(hsize_t idx, char *name, size_t size) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes an /// \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- ssize_t H5Location::getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const @@ -2135,7 +2082,6 @@ H5Location::getObjnameByIdx(hsize_t idx, H5std_string &name, size_t size) const /// Exception will be thrown when: /// - an error returned by the C API /// - object type is not one of the valid values above -// Programmer Binh-Minh Ribler - April, 2014 //-------------------------------------------------------------------------- H5O_type_t H5Location::childObjType(const char *objname) const @@ -2174,7 +2120,6 @@ H5Location::childObjType(const char *objname) const /// object's name. ///\param objname - IN: Name of the object (H5std_string&) ///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - April, 2014 //-------------------------------------------------------------------------- H5O_type_t H5Location::childObjType(const H5std_string &objname) const @@ -2211,7 +2156,6 @@ H5Location::childObjType(const H5std_string &objname) const // fully specified // - Leave property list out for now because C API is not using it, it // can be added later when needed. -// Programmer Binh-Minh Ribler - April, 2014 //-------------------------------------------------------------------------- H5O_type_t H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t order, @@ -2257,7 +2201,6 @@ H5Location::childObjType(hsize_t index, H5_index_t index_type, H5_iter_order_t o /// Exception will be thrown when: /// - an error returned by the C API /// - version number is not one of the valid values above -// Programmer Binh-Minh Ribler - April, 2014 //-------------------------------------------------------------------------- unsigned H5Location::childObjVersion(const char *objname) const @@ -2289,7 +2232,6 @@ H5Location::childObjVersion(const char *objname) const /// object's name. ///\param objname - IN: Name of the object (H5std_string&) ///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - April, 2014 //-------------------------------------------------------------------------- unsigned H5Location::childObjVersion(const H5std_string &objname) const @@ -2307,7 +2249,6 @@ H5Location::childObjVersion(const H5std_string &objname) const ///\param idx - IN: Transient index of the object ///\return Object type ///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx) const @@ -2328,7 +2269,6 @@ H5Location::getObjTypeByIdx(hsize_t idx) const ///\param type_name - OUT: Object type in text ///\return Object type ///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - May, 2010 // Modification // Modified to use the other function. -BMR, 2016/03/07 //-------------------------------------------------------------------------- @@ -2347,7 +2287,6 @@ H5Location::getObjTypeByIdx(hsize_t idx, char *type_name) const ///\param type_name - OUT: Object type in text ///\return Object type ///\exception H5::FileIException/H5::GroupIException/H5::LocationException -// Programmer Binh-Minh Ribler - January, 2003 //-------------------------------------------------------------------------- H5G_obj_t H5Location::getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const @@ -2385,7 +2324,6 @@ H5Location::getObjTypeByIdx(hsize_t idx, H5std_string &type_name) const ///\param func_name - Name of the function where failure occurs ///\param msg - Message describing the failure ///\exception H5::GroupIException -// Programmer Binh-Minh Ribler - 2000 // Modification // August 2017 - BMR // Keep H5Location::throwException and H5File::throwException to @@ -2422,7 +2360,6 @@ H5Location::throwException(const H5std_string &func_name, const H5std_string &ms // Applications shouldn't need to use it. // param dspace - IN/OUT: DataSpace object to be changed // param new_id - IN: New id to set -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void f_DataSpace_setId(DataSpace *dspace, hid_t new_id) @@ -2433,7 +2370,6 @@ f_DataSpace_setId(DataSpace *dspace, hid_t new_id) //-------------------------------------------------------------------------- // Function: H5Location destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Location::~H5Location() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Object.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Object.cpp index d092ef0d6b..2b898e761b 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Object.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5Object.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -74,7 +73,6 @@ userVisitOpWrpr(hid_t obj_id, const char *attr_name, const H5O_info2_t *obj_info //-------------------------------------------------------------------------- // Function: H5Object default constructor (protected) -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Object::H5Object() : H5Location() { @@ -88,7 +86,6 @@ H5Object::H5Object() : H5Location() // Applications shouldn't need to use it. // param attr - IN/OUT: Attribute object to be changed // param new_id - IN: New id to set -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void f_Attribute_setId(Attribute *attr, hid_t new_id) @@ -116,7 +113,6 @@ f_Attribute_setId(Attribute *attr, hid_t new_id) /// attribute with a new attribute of the same name, first /// delete the existing one with \c H5Object::removeAttr, then /// recreate it with this function. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute H5Object::createAttribute(const char *name, const DataType &data_type, const DataSpace &data_space, @@ -142,7 +138,6 @@ H5Object::createAttribute(const char *name, const DataType &data_type, const Dat ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes /// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute H5Object::createAttribute(const H5std_string &name, const DataType &data_type, const DataSpace &data_space, @@ -157,7 +152,6 @@ H5Object::createAttribute(const H5std_string &name, const DataType &data_type, c ///\param name - IN: Name of the attribute ///\return Attribute instance ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute H5Object::openAttribute(const char *name) const @@ -178,7 +172,6 @@ H5Object::openAttribute(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes /// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute H5Object::openAttribute(const H5std_string &name) const @@ -192,7 +185,6 @@ H5Object::openAttribute(const H5std_string &name) const ///\param idx - IN: Index of the attribute, a 0-based, non-negative integer ///\return Attribute instance ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- Attribute H5Object::openAttribute(const unsigned int idx) const @@ -222,7 +214,6 @@ H5Object::openAttribute(const unsigned int idx) const ///\par Description /// The signature of user_op is /// void (*)(H5::H5Location&, H5std_string, void*). -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data) @@ -282,7 +273,6 @@ H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data) ///\par Description /// For information, please refer to the H5Ovisit3 API in the HDF5 /// C Reference Manual. -// Programmer Binh-Minh Ribler - Feb, 2019 //-------------------------------------------------------------------------- void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, @@ -317,7 +307,6 @@ H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t use /// Exception will be thrown when: /// - an error returned by the C API /// - version number is not one of the valid values above -// Programmer Binh-Minh Ribler - December, 2016 //-------------------------------------------------------------------------- unsigned H5Object::objVersion() const @@ -345,7 +334,6 @@ H5Object::objVersion() const ///\brief Returns the number of attributes attached to this HDF5 object. ///\return Number of attributes ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- int H5Object::getNumAttrs() const @@ -363,7 +351,6 @@ H5Object::getNumAttrs() const ///\brief Checks whether the named attribute exists at this location. ///\param name - IN: Name of the attribute to be queried ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2013 //-------------------------------------------------------------------------- bool H5Object::attrExists(const char *name) const @@ -385,7 +372,6 @@ H5Object::attrExists(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes /// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- bool H5Object::attrExists(const H5std_string &name) const @@ -398,7 +384,6 @@ H5Object::attrExists(const H5std_string &name) const ///\brief Removes the named attribute from this object. ///\param name - IN: Name of the attribute to be removed ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Object::removeAttr(const char *name) const @@ -413,7 +398,6 @@ H5Object::removeAttr(const char *name) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes /// a reference to an \c H5std_string for \a name. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void H5Object::removeAttr(const H5std_string &name) const @@ -427,7 +411,6 @@ H5Object::removeAttr(const H5std_string &name) const ///\param oldname - IN: Name of the attribute to be renamed ///\param newname - IN: New name ame of the attribute ///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- void H5Object::renameAttr(const char *oldname, const char *newname) const @@ -442,7 +425,6 @@ H5Object::renameAttr(const char *oldname, const char *newname) const ///\brief This is an overloaded member function, provided for convenience. /// It differs from the above function in that it takes /// a reference to an \c H5std_string for the names. -// Programmer Binh-Minh Ribler - Mar, 2005 //-------------------------------------------------------------------------- void H5Object::renameAttr(const H5std_string &oldname, const H5std_string &newname) const @@ -454,7 +436,6 @@ H5Object::renameAttr(const H5std_string &oldname, const H5std_string &newname) c // Function: getObjName ///\brief Given an id, returns the type of the object. ///\return The name of the object -// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- ssize_t H5Object::getObjName(char *obj_name, size_t buf_size) const @@ -478,7 +459,6 @@ H5Object::getObjName(char *obj_name, size_t buf_size) const ///\brief Returns the name of this object as an \a H5std_string. ///\return Name of the object ///\exception H5::Exception -// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- H5std_string H5Object::getObjName() const @@ -530,7 +510,6 @@ H5Object::getObjName() const /// This function retrieves the object's name as an std string. /// buf_size can specify a specific length or default to 0, in /// which case the entire name will be retrieved. -// Programmer Binh-Minh Ribler - Mar, 2014 //-------------------------------------------------------------------------- ssize_t H5Object::getObjName(H5std_string &obj_name, size_t len) const @@ -566,7 +545,6 @@ H5Object::getObjName(H5std_string &obj_name, size_t len) const //-------------------------------------------------------------------------- // Function: H5Object destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5Object::~H5Object() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5OcreatProp.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5OcreatProp.cpp index dffdeb1022..54808cbf92 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5OcreatProp.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5OcreatProp.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -38,7 +37,6 @@ ObjCreatPropList *ObjCreatPropList::DEFAULT_ = 0; // If ObjCreatPropList::DEFAULT_ already points to an allocated // object, throw a PropListIException. This scenario should not // happen. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- ObjCreatPropList * ObjCreatPropList::getConstant() @@ -65,7 +63,6 @@ ObjCreatPropList::getConstant() // Purpose: Deletes the constant object that ObjCreatPropList::DEFAULT_ // points to. // exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void ObjCreatPropList::deleteConstants() @@ -83,7 +80,6 @@ const ObjCreatPropList &ObjCreatPropList::DEFAULT = *getConstant(); //-------------------------------------------------------------------------- // Function: Default Constructor ///\brief Creates a file access property list -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) { @@ -93,7 +89,6 @@ ObjCreatPropList::ObjCreatPropList() : PropList(H5P_OBJECT_CREATE) // Function: ObjCreatPropList copy constructor ///\brief Copy constructor: same HDF5 object as \a original ///\param original - IN: ObjCreatPropList instance to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList &original) : PropList(original) { @@ -103,7 +98,6 @@ ObjCreatPropList::ObjCreatPropList(const ObjCreatPropList &original) : PropList( // Function: ObjCreatPropList overloaded constructor ///\brief Creates a file access property list using the id of an /// existing one. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) { @@ -121,7 +115,6 @@ ObjCreatPropList::ObjCreatPropList(const hid_t plist_id) : PropList(plist_id) /// If \c max_compact is set to 0, dense storage will be used. /// For more detail about on attribute storage, please refer to the /// H5Pset_attr_phase_change API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- void ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) const @@ -144,7 +137,6 @@ ObjCreatPropList::setAttrPhaseChange(unsigned max_compact, unsigned min_dense) c /// If \c max_compact is set to 0, dense storage will be used. /// For more detail about on attribute storage, please refer to the /// H5Pget_attr_phase_change API in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- void ObjCreatPropList::getAttrPhaseChange(unsigned &max_compact, unsigned &min_dense) const @@ -173,7 +165,6 @@ ObjCreatPropList::getAttrPhaseChange(unsigned &max_compact, unsigned &min_dense) /// creation time and to build the index later. /// For detail, please refer to the H5Pset_attr_creation_order API /// in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- void ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const @@ -195,7 +186,6 @@ ObjCreatPropList::setAttrCrtOrder(unsigned crt_order_flags) const /// creation order is neither tracked not indexed. /// For detail, please refer to the H5Pget_attr_creation_order API /// in the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- unsigned ObjCreatPropList::getAttrCrtOrder() const @@ -212,7 +202,6 @@ ObjCreatPropList::getAttrCrtOrder() const //-------------------------------------------------------------------------- // Function: ObjCreatPropList destructor ///\brief Noop destructor -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- ObjCreatPropList::~ObjCreatPropList() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5PredType.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5PredType.cpp index 9458fb7117..6aa5b17056 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5PredType.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5PredType.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -39,7 +38,6 @@ namespace H5 { // Description // This constructor creates a PredType object by copying // the provided HDF5 predefined datatype. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id) { @@ -49,7 +47,6 @@ PredType::PredType(const hid_t predtype_id) : AtomType(predtype_id) //-------------------------------------------------------------------------- // Function: PredType default constructor ///\brief Default constructor: Creates a stub predefined datatype -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType::PredType() : AtomType() { @@ -60,7 +57,6 @@ PredType::PredType() : AtomType() // Function: PredType copy constructor ///\brief Copy constructor: same HDF5 object as \a original ///\param original - IN: PredType instance to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType::PredType(const PredType &original) : AtomType(original) { @@ -75,7 +71,6 @@ PredType::PredType(const PredType &original) : AtomType(original) // Description // Makes a copy of the type on the right hand side and stores // the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType & PredType::operator=(const PredType &rhs) @@ -117,7 +112,6 @@ PredType::committed() //-------------------------------------------------------------------------- // Function: PredType destructor ///\brief Noop destructor. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PredType::~PredType() { @@ -288,7 +282,6 @@ PredType *PredType::NATIVE_UINT_FAST64_; // Note that, there is a similar function to getPredTypes() in // other classes, that have global constants, is called getConstant(). // -// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- PredType * PredType::getPredTypes() @@ -314,7 +307,6 @@ PredType::getPredTypes() //-------------------------------------------------------------------------- // Function: PredType::makePredTypes // Purpose Allocate all PredType constants. -// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- void PredType::makePredTypes() @@ -470,7 +462,6 @@ PredType::makePredTypes() //-------------------------------------------------------------------------- // Function: PredType::deleteConstants // Purpose Deletes all PredType constant pointers. -// Programmer Binh-Minh Ribler - September 2015 //-------------------------------------------------------------------------- void PredType::deleteConstants() diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5PropList.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5PropList.cpp index d4e7b397d4..a116494a40 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5PropList.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5PropList.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -39,7 +38,6 @@ PropList *PropList::DEFAULT_ = 0; // Description // If PropList::DEFAULT_ already points to an allocated object, // throw a PropListIException. This scenario should not happen. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- PropList * PropList::getConstant() @@ -64,7 +62,6 @@ PropList::getConstant() //-------------------------------------------------------------------------- // Function: PropList::deleteConstants // Purpose Deletes the constant object that PropList::DEFAULT_ points to. -// Programmer Binh-Minh Ribler - 2015 //-------------------------------------------------------------------------- void PropList::deleteConstants() @@ -82,7 +79,6 @@ const PropList &PropList::DEFAULT = *getConstant(); //-------------------------------------------------------------------------- // Function: Default constructor ///\brief Default constructor: creates a stub property list object. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PropList::PropList() : IdComponent(), id(H5P_DEFAULT) { @@ -92,7 +88,6 @@ PropList::PropList() : IdComponent(), id(H5P_DEFAULT) // Function: PropList copy constructor ///\brief Copy constructor: same HDF5 object as \a original ///\param original - IN: The original property list to copy -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PropList::PropList(const PropList &original) : IdComponent(), id(original.id) { @@ -109,7 +104,6 @@ PropList::PropList(const PropList &original) : IdComponent(), id(original.id) // class is provided or makes a copy of a property list if one // is given. If the given id is anything else, then set this // property's id to H5P_DEFAULT. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PropList::PropList(const hid_t plist_id) : IdComponent(), id{H5P_DEFAULT} { @@ -161,7 +155,6 @@ PropList::PropList(const hid_t plist_id) : IdComponent(), id{H5P_DEFAULT} ///\brief Makes a copy of an existing property list. ///\param like_plist - IN: Reference to the existing property list ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 // Modification // - Replaced resetIdComponent() with decRefCount() to use C // library ID reference counting mechanism - BMR, Jun 1, 2004 @@ -195,7 +188,6 @@ PropList::copy(const PropList &like_plist) // Description // Makes a copy of the property list on the right hand side // and stores the new id in the left hand side object. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- PropList & PropList::operator=(const PropList &rhs) @@ -211,7 +203,6 @@ PropList::operator=(const PropList &rhs) ///\param dest - IN: Destination property list or class ///\param name - IN: Name of the property to copy - \c char pointer ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- void PropList::copyProp(PropList &dest, const char *name) const @@ -230,7 +221,6 @@ PropList::copyProp(PropList &dest, const char *name) const /// accepts. ///\param dest - IN: Destination property list or class ///\param name - IN: Name of the property to copy - \c H5std_string -// Programmer Binh-Minh Ribler - Jul, 2005 //-------------------------------------------------------------------------- void PropList::copyProp(PropList &dest, const H5std_string &name) const @@ -246,7 +236,6 @@ PropList::copyProp(PropList &dest, const H5std_string &name) const ///\param name - IN: Name of the property to copy - \c char pointer ///\note This member function will be removed in the next release ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void PropList::copyProp(PropList &dest, PropList &src, const char *name) const @@ -267,7 +256,6 @@ PropList::copyProp(PropList &dest, PropList &src, const char *name) const ///\param dest - IN: Destination property list or class ///\param src - IN: Source property list or class ///\param name - IN: Name of the property to copy - \c H5std_string -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void PropList::copyProp(PropList &dest, PropList &src, const H5std_string &name) const @@ -284,7 +272,6 @@ PropList::copyProp(PropList &dest, PropList &src, const H5std_string &name) cons // AbstractDS and Attribute are moved out of H5Object. In // addition, member IdComponent::id is moved into subclasses, and // IdComponent::getId now becomes pure virtual function. -// Programmer Binh-Minh Ribler - May, 2008 //-------------------------------------------------------------------------- hid_t PropList::getId() const @@ -303,7 +290,6 @@ PropList::getId() const // The underlying reference counting in the C library ensures // that the current valid id of this object is properly closed. // Then the object's id is reset to the new id. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void PropList::p_setId(const hid_t new_id) @@ -326,7 +312,6 @@ PropList::p_setId(const hid_t new_id) ///\brief Closes the property list if it is not a default one. /// ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - Mar 9, 2005 //-------------------------------------------------------------------------- void PropList::close() @@ -346,7 +331,6 @@ PropList::close() ///\brief Returns the class of this property list, i.e. \c H5P_FILE_CREATE... ///\return The property list class if it is not equal to \c H5P_ROOT ///\exception H5::PropListIException -// Programmer Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- hid_t PropList::getClass() const @@ -368,7 +352,6 @@ PropList::getClass() const ///\par Description /// This routine checks if a property exists within a property /// list or class. -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- bool PropList::propExist(const char *name) const @@ -392,7 +375,6 @@ PropList::propExist(const char *name) const /// It differs from the above function only in what arguments it /// accepts. ///\param name - IN: Name of property to check for - \c H5std_string -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- bool PropList::propExist(const H5std_string &name) const @@ -408,7 +390,6 @@ PropList::propExist(const H5std_string &name) const ///\par Description /// Releases memory and detaches a class from the property /// list class hierarchy. -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::closeClass() const @@ -429,7 +410,6 @@ PropList::closeClass() const /// Retrieves a copy of the value for a property in a property /// list. The property name must exist or this routine will /// throw an exception. -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::getProperty(const char *name, void *value) const @@ -447,7 +427,6 @@ PropList::getProperty(const char *name, void *value) const ///\param name - IN: Name of property to query - \c char pointer ///\return The property that is a \c H5std_string. ///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5std_string PropList::getProperty(const char *name) const @@ -478,7 +457,6 @@ PropList::getProperty(const char *name) const /// accepts. ///\param name - IN: Name of property to query - \c H5std_string ///\param value - OUT: Pointer to the buffer for the property value -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::getProperty(const H5std_string &name, void *value) const @@ -492,7 +470,6 @@ PropList::getProperty(const H5std_string &name, void *value) const /// accepts. ///\param name - IN: Name of property to query - \c H5std_string ///\return The property that is a \c H5std_string. -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5std_string PropList::getProperty(const H5std_string &name) const @@ -511,7 +488,6 @@ PropList::getProperty(const H5std_string &name) const /// in bytes. Zero-sized properties are allowed and the return /// value will be of 0. This function works for both property /// lists and classes. -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- size_t PropList::getPropSize(const char *name) const @@ -530,7 +506,6 @@ PropList::getPropSize(const char *name) const /// accepts. ///\param name - IN: Name of property to query - \c H5std_string /// -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- size_t PropList::getPropSize(const H5std_string &name) const @@ -543,7 +518,6 @@ PropList::getPropSize(const H5std_string &name) const ///\brief Return the name of a generic property list class. ///\return A string containing the class name, if success, otherwise, /// an empty string. -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- H5std_string PropList::getClassName() const @@ -564,7 +538,6 @@ PropList::getClassName() const ///\brief Returns the number of properties in this property list or class. ///\return Size of the property. ///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- size_t PropList::getNumProps() const @@ -586,7 +559,6 @@ PropList::getNumProps() const // Description // Revision svn r29815 changed 'value' to const, hence, deprecated // the non-const setProperty. -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const char *name, const void *value) const @@ -600,7 +572,6 @@ PropList::setProperty(const char *name, const void *value) const //-------------------------------------------------------------------------- // Function: PropList::setProperty ///\brief Deprecated due to missing const in prototype. (1.10.1) -// Programmer: Binh-Minh Ribler - March, 2017 // Modification // Planned for removal. -BMR, 2017/03/17 1.10.1 //-------------------------------------------------------------------------- @@ -623,7 +594,6 @@ PropList::setProperty(const char *name, void *value) const // Description // Revision svn r29815 changed 'value' to const, hence, deprecated // the non-const setProperty. -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const char *name, const char *charptr) const @@ -641,7 +611,6 @@ PropList::setProperty(const char *name, const char *charptr) const /// accepts. ///\param name - IN: Name of property to set - \c char pointer ///\param strg - IN: Value for the property is a \c H5std_string -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const char *name, const H5std_string &strg) const @@ -652,7 +621,6 @@ PropList::setProperty(const char *name, const H5std_string &strg) const //-------------------------------------------------------------------------- // Function: PropList::setProperty ///\brief Deprecated due to missing const in prototype. (1.10.1) -// Programmer: Binh-Minh Ribler - March, 2017 // Modification // Planned for removal. -BMR, 2017/03/17 1.10.1 //-------------------------------------------------------------------------- @@ -669,7 +637,6 @@ PropList::setProperty(const char *name, H5std_string &strg) const /// accepts. ///\param name - IN: Name of property to set - \c H5std_string ///\param value - IN: Void pointer to the value for the property -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const H5std_string &name, const void *value) const @@ -680,7 +647,6 @@ PropList::setProperty(const H5std_string &name, const void *value) const //-------------------------------------------------------------------------- // Function: PropList::setProperty ///\brief Deprecated due to missing const in prototype. (1.10.1) -// Programmer: Binh-Minh Ribler - March, 2017 // Modification // Planned for removal. -BMR, 2017/03/17 1.10.1 //-------------------------------------------------------------------------- @@ -697,7 +663,6 @@ PropList::setProperty(const H5std_string &name, void *value) const /// accepts. ///\param name - IN: Name of property to set - \c H5std_string ///\param strg - IN: Value for the property is a \c H5std_string -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::setProperty(const H5std_string &name, const H5std_string &strg) const @@ -708,7 +673,6 @@ PropList::setProperty(const H5std_string &name, const H5std_string &strg) const //-------------------------------------------------------------------------- // Function: PropList::setProperty ///\brief Deprecated due to missing const in prototype. (1.10.1) -// Programmer: Binh-Minh Ribler - March, 2017 // Modification // Planned for removal. -BMR, 2017/03/17 1.10.1 //-------------------------------------------------------------------------- @@ -725,7 +689,6 @@ PropList::setProperty(const H5std_string &name, H5std_string &strg) const ///\return true if the property list is a member of the property list /// class, and false, otherwise. ///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- bool PropList::isAClass(const PropList &prop_class) const @@ -746,7 +709,6 @@ PropList::isAClass(const PropList &prop_class) const ///\brief Removes a property from a property list. ///\param name - IN: Name of property to remove - \c char pointer ///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::removeProp(const char *name) const @@ -763,7 +725,6 @@ PropList::removeProp(const char *name) const /// It differs from the above function only in what arguments it /// accepts. ///\param name - IN: Name of property to remove - \c H5std_string -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- void PropList::removeProp(const H5std_string &name) const @@ -778,7 +739,6 @@ PropList::removeProp(const H5std_string &name) const ///\return true if the property lists or classes are equal, and /// false, otherwise. ///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- bool PropList::operator==(const PropList &rhs) const @@ -799,7 +759,6 @@ PropList::operator==(const PropList &rhs) const ///\brief Returns the parent class of a generic property class ///\return The parent class of a property class ///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 //-------------------------------------------------------------------------- PropList PropList::getClassParent() const @@ -815,7 +774,6 @@ PropList::getClassParent() const //-------------------------------------------------------------------------- // Function: PropList destructor ///\brief Properly terminates access to this property list. -// Programmer Binh-Minh Ribler - 2000 // Modification // - Replaced resetIdComponent() with decRefCount() to use C // library ID reference counting mechanism - BMR, Jun 1, 2004 diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5StrType.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5StrType.cpp index 57bb2c96fc..2c47809207 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5StrType.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5StrType.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -38,7 +37,6 @@ namespace H5 { //-------------------------------------------------------------------------- // Function: StrType default constructor ///\brief Default constructor: Creates a stub string datatype -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType::StrType() : AtomType() { @@ -49,7 +47,6 @@ StrType::StrType() : AtomType() ///\brief Creates a string datatype using a predefined type. ///\param pred_type - IN: Predefined datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType::StrType(const PredType &pred_type) : AtomType() { @@ -75,7 +72,6 @@ StrType::StrType(const PredType &pred_type) : AtomType() // Note // The use of this constructor can be shortened by using // its overloaded below as StrType(0, size). -// Programmer Binh-Minh Ribler - 2000 // Modification // Planned for removal. -BMR, 2005/12/02 // Removed from documentation. -BMR, 2016/03/07 @@ -102,7 +98,6 @@ StrType::StrType(const PredType &pred_type, const size_t &size) : AtomType() /// StrType atype(PredType::C_S1, size) // Note // This constructor replaced the previous one. -// Programmer Binh-Minh Ribler - Nov 28, 2005 //-------------------------------------------------------------------------- StrType::StrType(const int dummy, const size_t &size) : AtomType() { @@ -120,7 +115,6 @@ StrType::StrType(const int dummy, const size_t &size) : AtomType() ///\brief Creates an StrType object using the id of an existing datatype. ///\param existing_id - IN: Id of an existing datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType::StrType(const hid_t existing_id) : AtomType(existing_id) { @@ -129,7 +123,6 @@ StrType::StrType(const hid_t existing_id) : AtomType(existing_id) //-------------------------------------------------------------------------- // Function: StrType copy constructor ///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType::StrType(const StrType &original) : AtomType(original) { @@ -140,7 +133,6 @@ StrType::StrType(const StrType &original) : AtomType(original) ///\brief Gets the string datatype of the specified dataset ///\param dataset - IN: Dataset that this string datatype associates with ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType::StrType(const DataSet &dataset) : AtomType() { @@ -159,7 +151,6 @@ StrType::StrType(const DataSet &dataset) : AtomType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: String type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openStrType(const char*) to @@ -178,7 +169,6 @@ StrType::StrType(const H5Location &loc, const char *dtype_name) : AtomType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: String type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openStrType(const H5std_string&) @@ -196,7 +186,6 @@ StrType::StrType(const H5Location &loc, const H5std_string &dtype_name) : AtomTy /// binary object description of this type. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- DataType * StrType::decode() const @@ -226,7 +215,6 @@ StrType::decode() const /// and usability problems. See the C API entry H5Pset_char_encoding for /// more information. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_cset_t StrType::getCset() const @@ -253,7 +241,6 @@ StrType::getCset() const /// and usability problems. See the C API entry H5Pset_char_encoding for /// more information. ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void StrType::setCset(H5T_cset_t cset) const @@ -272,7 +259,6 @@ StrType::setCset(H5T_cset_t cset) const /// \li \c H5T_STR_NULLPAD (0) - Pad with zeros /// \li \c H5T_STR_SPACEPAD (0) - pad with spaces (as FORTRAN does) ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- H5T_str_t StrType::getStrpad() const @@ -294,7 +280,6 @@ StrType::getStrpad() const ///\par Description /// For information, please refer to the H5Tset_strpad API in /// the HDF5 C Reference Manual. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void StrType::setStrpad(H5T_str_t strpad) const @@ -308,7 +293,6 @@ StrType::setStrpad(H5T_str_t strpad) const //-------------------------------------------------------------------------- // Function: StrType destructor ///\brief Properly terminates access to this string datatype. -// Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- StrType::~StrType() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5VarLenType.cpp b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5VarLenType.cpp index 0270febfe5..e8b7cbb8c7 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/source/H5VarLenType.cpp +++ b/externals/coda-oss/modules/drivers/hdf5cpp/source/H5VarLenType.cpp @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * @@ -42,7 +41,6 @@ VarLenType::VarLenType() : DataType() ///\brief Creates an VarLenType object using an existing id. ///\param existing_id - IN: Id of an existing datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- VarLenType::VarLenType(const hid_t existing_id) : DataType(existing_id) { @@ -51,7 +49,6 @@ VarLenType::VarLenType(const hid_t existing_id) : DataType(existing_id) //-------------------------------------------------------------------------- // Function: VarLenType copy constructor ///\brief Copy constructor: same HDF5 object as \a original -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- VarLenType::VarLenType(const VarLenType &original) : DataType(original) { @@ -67,7 +64,6 @@ VarLenType::VarLenType(const VarLenType &original) : DataType(original) // constructor. // Updated: this is unnecessary. // -BMR, Sep, 2017 -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- VarLenType::VarLenType(const DataType *base_type) : DataType() { @@ -83,7 +79,6 @@ VarLenType::VarLenType(const DataType *base_type) : DataType() /// \a base_type. ///\param base_type - IN: An existing datatype ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- VarLenType::VarLenType(const DataType &base_type) : DataType() { @@ -100,7 +95,6 @@ VarLenType::VarLenType(const DataType &base_type) : DataType() ///\param loc - IN: Location of the type ///\param dtype_name - IN: Variable length type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openVarLenType(const char*) to @@ -119,7 +113,6 @@ VarLenType::VarLenType(const H5Location &loc, const char *dtype_name) : DataType ///\param loc - IN: Location of the type ///\param dtype_name - IN: Variable length type name ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Dec 2016 // Description // In 1.10.1, this constructor was introduced and may replace the // existing function CommonFG::openVarLenType(const H5std_string&) @@ -137,7 +130,6 @@ VarLenType::VarLenType(const H5Location &loc, const H5std_string &dtype_name) : /// binary object description of this type. /// ///\exception H5::DataTypeIException -// Programmer Binh-Minh Ribler - Aug 2017 //-------------------------------------------------------------------------- DataType * VarLenType::decode() const @@ -157,7 +149,6 @@ VarLenType::decode() const //-------------------------------------------------------------------------- // Function: VarLenType destructor ///\brief Properly terminates access to this datatype. -// Programmer Binh-Minh Ribler - May, 2004 //-------------------------------------------------------------------------- VarLenType::~VarLenType() { diff --git a/externals/coda-oss/modules/drivers/hdf5cpp/wscript b/externals/coda-oss/modules/drivers/hdf5cpp/wscript index a3c9e7e54c..492fca2941 100644 --- a/externals/coda-oss/modules/drivers/hdf5cpp/wscript +++ b/externals/coda-oss/modules/drivers/hdf5cpp/wscript @@ -1,5 +1,5 @@ NAME = 'hdf5cpp' -VERSION = '1.13.2' +VERSION = '1.14.2' MODULE_DEPS = 'hdf5' USELIB_LOCAL = 'hdf5-c' diff --git a/externals/coda-oss/modules/drivers/highfive/CMakeLists.txt b/externals/coda-oss/modules/drivers/highfive/CMakeLists.txt index 32f2ba30d8..0c9209e25c 100644 --- a/externals/coda-oss/modules/drivers/highfive/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/highfive/CMakeLists.txt @@ -7,7 +7,7 @@ if(CODA_ENABLE_HDF5) coda_add_module( ${MODULE_NAME} - VERSION 2.6.2 + VERSION 2.7.1 DEPS ${MODULE_DEPS}) coda_add_tests( diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2.zip b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2.zip deleted file mode 100644 index 0668a026bb..0000000000 Binary files a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2.zip and /dev/null differ diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/config/CompilerFlagsHelpers.cmake b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/config/CompilerFlagsHelpers.cmake deleted file mode 100644 index e3755ad8c6..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/config/CompilerFlagsHelpers.cmake +++ /dev/null @@ -1,59 +0,0 @@ -# CompilerFlagsHelpers.cmake -# -# set of Convenience functions for portable compiler flags -# -# License: BSD 3 -# -# Copyright (c) 2016, Adrien Devresse -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -set(SUPPORTED_COMPILER_LANGUAGE_LIST "C;CXX") - -foreach(COMPILER_LANGUAGE ${SUPPORTED_COMPILER_LANGUAGE_LIST}) - - # XLC compiler - if(CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID MATCHES "XL") - - # XLC -qinfo=all is awfully verbose on any platforms that use the GNU STL - # Enable by default only the relevant one - set(CMAKE_${COMPILER_LANGUAGE}_WARNING_ALL "-qformat=all -qinfo=lan:trx:ret:zea:cmp:ret") - - ## GCC, CLANG, rest of the world - elseif(CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID MATCHES "Clang" - OR CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID MATCHES "GNU" - OR CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID MATCHES "Intel") - set(CMAKE_${COMPILER_LANGUAGE}_WARNING_ALL " -Wall -Wextra") - string(CONCAT CMAKE_${COMPILER_LANGUAGE}_WARNING_DEBUG - " -Werror -Wshadow -Wnon-virtual-dtor -Wunused -Woverloaded-virtual" - " -Wformat=2 -Wconversion -Wsign-conversion -Wno-error=deprecated-declarations" - ) - if(NOT CMAKE_${COMPILER_LANGUAGE}_COMPILER_IS_ICC) - string(CONCAT CMAKE_${COMPILER_LANGUAGE}_WARNING_DEBUG - ${CMAKE_${COMPILER_LANGUAGE}_WARNING_DEBUG} - " -Wpedantic -Wcast-align -Wdouble-promotion" - ) - endif() - endif() - - if(CMAKE_${COMPILER_LANGUAGE}_COMPILER_ID MATCHES "GNU" - AND (CMAKE_${COMPILER_LANGUAGE}_COMPILER_VERSION VERSION_GREATER "4.7.0")) - set(CMAKE_${COMPILER_LANGUAGE}_WARNING_ALL - "${CMAKE_${COMPILER_LANGUAGE}_WARNING_ALL} -Wno-unused-parameter") - endif() - -endforeach() - - - diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/config/ReleaseDebugAutoFlags.cmake b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/config/ReleaseDebugAutoFlags.cmake deleted file mode 100644 index 2b980698eb..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/config/ReleaseDebugAutoFlags.cmake +++ /dev/null @@ -1,45 +0,0 @@ -# ReleaseDebugAutoFlags.cmake -# -# Release / Debug configuration helper -# -# License: BSD 3 -# -# Copyright (c) 2016, Adrien Devresse -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. -# -# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -## default configuration -if(NOT CMAKE_BUILD_TYPE AND (NOT CMAKE_CONFIGURATION_TYPES)) - set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) - message(STATUS "Setting build type to '${CMAKE_BUILD_TYPE}' as none was specified.") -endif() - - -# Different configuration types: -# -# Debug : Optimized for debugging, include symbols -# Release : Release mode, no debuginfo -# RelWithDebInfo : Distribution mode, basic optimizations for potable code with debuginfos - -include(CompilerFlagsHelpers) - - -string(APPEND CMAKE_C_FLAGS_RELEASE "${CMAKE_C_WARNING_ALL}") -string(APPEND CMAKE_C_FLAGS_DEBUG "${CMAKE_C_WARNING_ALL}" "${CMAKE_C_WARNING_DEBUG}") -string(APPEND CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_WARNING_ALL}" "${CMAKE_C_WARNING_DEBUG}") - - -string(APPEND CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_WARNING_ALL}") -string(APPEND CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_WARNING_ALL}" "${CMAKE_CXX_WARNING_DEBUG}") -string(APPEND CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_WARNING_ALL}" "${CMAKE_C_WARNING_DEBUG}") diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/VERSION b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/VERSION deleted file mode 100644 index b1b25a5ffa..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/VERSION +++ /dev/null @@ -1 +0,0 @@ -2.2.2 diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/mainpage.md b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/mainpage.md deleted file mode 100644 index ca43132894..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/mainpage.md +++ /dev/null @@ -1,16 +0,0 @@ -HighFive documentation {#mainpage} -====================== - -HighFive is a modern C++11 friendly interface for libhdf5. - -HighFive supports STL vector/string, eigen3, xtensor, Boost::UBLAS and Boost::Multi-array. - -It handles C++ from/to HDF5 automatic type mapping. - -HighFive does not require an additional library and supports both HDF5 thread safety and Parallel HDF5 (contrary to the official hdf5 cpp). - -HighFive has two interfaces: normal HighFive and H5Easy. - -H5Easy is a high-level interface composed by two main functions: H5Easy::load and H5Easy::dump. - -HighFive is a wrapper of HDF5 library which take care of ownership of your HDF5 objects. diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_eigen.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_eigen.cpp deleted file mode 100644 index 9c21dbc738..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_eigen.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include - -#define H5_USE_EIGEN 1 - -#include -#include - -using namespace HighFive; - -void data_io(void) { - const std::string DATASET_NAME("dset"); - const int nrows = 10; - const int ncols = 3; - - try { - Eigen::MatrixXd mat(nrows, ncols); - - for (int i = 0; i < nrows; ++i) { - for (int j = 0; j < ncols; ++j) { - mat(i, j) = double(j + i * 100); - } - } - - File file("eigen_mat.h5", File::ReadWrite | File::Create | File::Truncate); - - DataSet dset = file.createDataSet(DATASET_NAME, mat); - dset.write(mat); - - Eigen::MatrixXd result; - dset.read(result); - - } catch (const Exception& err) { - std::cerr << err.what() << std::endl; - } -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Attribute.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Attribute.hpp deleted file mode 100644 index 9efa17df5a..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Attribute.hpp +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (c), 2017, Ali Can Demiralp - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#ifndef H5ATTRIBUTE_HPP -#define H5ATTRIBUTE_HPP - -#include - -#include "H5Apublic.h" - -#include "H5DataSpace.hpp" -#include "H5DataType.hpp" -#include "H5Object.hpp" -#include "bits/H5Path_traits.hpp" - -namespace HighFive { - -/// -/// \brief Class representing an attribute of a dataset or group -/// -class Attribute: public Object, public PathTraits { - public: - const static ObjectType type = ObjectType::Attribute; - - /// - /// \brief return the name of the current attribute - /// \return the name of the attribute - std::string getName() const; - - size_t getStorageSize() const; - - /// - /// \brief getDataType - /// \return return the datatype associated with this dataset - /// - DataType getDataType() const; - - /// - /// \brief getSpace - /// \return return the dataspace associated with this dataset - /// - DataSpace getSpace() const; - - /// - /// \brief getMemSpace - /// \return same than getSpace for DataSet, compatibility with Selection - /// class - /// - DataSpace getMemSpace() const; - - /// \brief Return the attribute - template - T read() const; - - /// - /// Read the attribute into a buffer - /// An exception is raised if the numbers of dimension of the buffer and of - /// the attribute are different - /// - /// The array type can be a N-pointer or a N-vector ( e.g int** integer two - /// dimensional array ) - template - void read(T& array) const; - - /// \brief Read the attribute into a buffer - template - void read(T* array, const DataType& dtype = DataType()) const; - - /// - /// Write the integrality N-dimension buffer to this attribute - /// An exception is raised if the numbers of dimension of the buffer and of - /// the attribute are different - /// - /// The array type can be a N-pointer or a N-vector ( e.g int** integer two - /// dimensional array ) - template - void write(const T& buffer); - - /// \brief Write a buffer to this attribute - template - void write_raw(const T* buffer, const DataType& dtype = DataType()); - - /// \brief Get the list of properties for creation of this attribute - AttributeCreateProps getCreatePropertyList() const { - return details::get_plist(*this, H5Aget_create_plist); - } - - // No empty attributes - Attribute() = delete; - - private: - using Object::Object; - - template - friend class ::HighFive::AnnotateTraits; -}; - -} // namespace HighFive - - -#endif // H5ATTRIBUTE_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5DataSpace.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5DataSpace.hpp deleted file mode 100644 index 34eb7eac8a..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5DataSpace.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#ifndef H5DATASPACE_HPP -#define H5DATASPACE_HPP - -#include -#include -#include -#include -#include - -#include "H5Object.hpp" -#include "bits/H5_definitions.hpp" - -namespace HighFive { - -/// -/// \brief Class representing the space (dimensions) of a dataset -/// -class DataSpace: public Object { - public: - const static ObjectType type = ObjectType::DataSpace; - - static const size_t UNLIMITED = SIZE_MAX; - - /// dataspace type - enum DataspaceType { - dataspace_scalar, - dataspace_null - // simple dataspace are handle directly from their dimensions - }; - - /// create a dataspace of N-dimensions - /// Each dimension is configured this way - /// size(dim1) = vec[0] - /// size(dim2) = vec[1] - /// etc... - explicit DataSpace(const std::vector& dims); - - // create a dataspace of N-dimensions - template - explicit DataSpace(const std::array& dims); - - /// Make sure that DataSpace({1,2,3}) works on GCC. This is - /// the shortcut form of the vector initializer, but one some compilers (gcc) - /// this does not resolve correctly without this constructor. - DataSpace(const std::initializer_list& items); - - /// Allow directly listing 1 or more dimensions to initialize, - /// that is, DataSpace(1,2) means DataSpace(std::vector{1,2}). - template - explicit DataSpace(size_t dim1, Args... dims); - - /// Create a dataspace from an iterator pair - /// - /// Explicitly disable DataSpace(int_like, int_like) from trying to use this constructor - template ::value, IT>::type> - DataSpace(const IT begin, const IT end); - - /// \brief Create a resizable N-dimensional dataspace - /// \param dims Initial size of dataspace - /// \param maxdims Maximum size of the dataspace - explicit DataSpace(const std::vector& dims, const std::vector& maxdims); - - /// - /// \brief DataSpace create a scalar dataspace or a null dataset - /// - explicit DataSpace(DataspaceType dtype); - - /// Create a new DataSpace - /// with a different id available for modifications - DataSpace clone() const; - - /// - /// \brief getNumberDimensions - /// \return the number of dimensions in the current dataspace - /// - size_t getNumberDimensions() const; - - /// \brief getDimensions - /// \return return a vector of N-element, each element is the size of the - /// associated dataset dimension - std::vector getDimensions() const; - - /// \brief getElementCount - /// \return the total number of elements in the dataspace - size_t getElementCount() const; - - /// \brief getMaxDimensions - /// \return return a vector of N-element, each element is the size of the - /// associated dataset maximum dimension - std::vector getMaxDimensions() const; - - /// Create a dataspace matching a type accepted by details::inspector - template - static DataSpace From(const T& value); - - template - static DataSpace FromCharArrayStrings(const char (&)[N][Width]); - - protected: - DataSpace() = default; - - friend class Attribute; - friend class File; - friend class DataSet; -}; - -} // namespace HighFive - -// We include bits right away since DataSpace is user-constructible -#include "bits/H5Dataspace_misc.hpp" - -#endif // H5DATASPACE_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Utility.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Utility.hpp deleted file mode 100644 index 70ce7cde49..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Utility.hpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c), 2017, Blue Brain Project - EPFL (CH) - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ - -#ifndef H5UTILITY_HPP -#define H5UTILITY_HPP - -#include - -namespace HighFive { - -/// -/// \brief Utility class to disable HDF5 stack printing inside a scope. -/// -class SilenceHDF5 { - public: - inline SilenceHDF5(bool enable = true) - : _client_data(nullptr) { - H5Eget_auto2(H5E_DEFAULT, &_func, &_client_data); - if (enable) - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - } - - inline ~SilenceHDF5() { - H5Eset_auto2(H5E_DEFAULT, _func, _client_data); - } - - private: - H5E_auto2_t _func; - void* _client_data; -}; - -} // namespace HighFive - -#endif // H5UTIL_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Version.hpp.in b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Version.hpp.in deleted file mode 100644 index 5969ebc905..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Version.hpp.in +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c), 2020 - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#ifndef H5VERSION_HPP -#define H5VERSION_HPP - -#define HIGHFIVE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ -#define HIGHFIVE_VERSION_MINOR @PROJECT_VERSION_MINOR@ -#define HIGHFIVE_VERSION_PATCH @PROJECT_VERSION_PATCH@ -#define HIGHFIVE_VERSION @PROJECT_VERSION@ - -#endif // H5VERSION_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5PropertyList_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5PropertyList_misc.hpp deleted file mode 100644 index 976b9f51e4..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5PropertyList_misc.hpp +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (c), 2017-2018, Adrien Devresse - * Juan Hernando - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#ifndef H5PROPERTY_LIST_MISC_HPP -#define H5PROPERTY_LIST_MISC_HPP - -#include - -namespace HighFive { - -namespace { -inline hid_t convert_plist_type(PropertyType propertyType) { - // The HP5_XXX are macros with function calls so we can't assign - // them as the enum values - switch (propertyType) { - case PropertyType::OBJECT_CREATE: - return H5P_OBJECT_CREATE; - case PropertyType::FILE_CREATE: - return H5P_FILE_CREATE; - case PropertyType::FILE_ACCESS: - return H5P_FILE_ACCESS; - case PropertyType::DATASET_CREATE: - return H5P_DATASET_CREATE; - case PropertyType::DATASET_ACCESS: - return H5P_DATASET_ACCESS; - case PropertyType::DATASET_XFER: - return H5P_DATASET_XFER; - case PropertyType::GROUP_CREATE: - return H5P_GROUP_CREATE; - case PropertyType::GROUP_ACCESS: - return H5P_GROUP_ACCESS; - case PropertyType::DATATYPE_CREATE: - return H5P_DATATYPE_CREATE; - case PropertyType::DATATYPE_ACCESS: - return H5P_DATATYPE_ACCESS; - case PropertyType::STRING_CREATE: - return H5P_STRING_CREATE; - case PropertyType::ATTRIBUTE_CREATE: - return H5P_ATTRIBUTE_CREATE; - case PropertyType::OBJECT_COPY: - return H5P_OBJECT_COPY; - case PropertyType::LINK_CREATE: - return H5P_LINK_CREATE; - case PropertyType::LINK_ACCESS: - return H5P_LINK_ACCESS; - default: - HDF5ErrMapper::ToException("Unsupported property list type"); - } -} - -} // namespace - - -inline PropertyListBase::PropertyListBase() noexcept - : Object(H5P_DEFAULT) {} - - -template -inline void PropertyList::_initializeIfNeeded() { - if (_hid != H5P_DEFAULT) { - return; - } - if ((_hid = H5Pcreate(convert_plist_type(T))) < 0) { - HDF5ErrMapper::ToException("Unable to create property list"); - } -} - -template -template -inline void PropertyList::add(const P& property) { - _initializeIfNeeded(); - property.apply(_hid); -} - -template -template -inline void RawPropertyList::add(const F& funct, const Args&... args) { - this->_initializeIfNeeded(); - if (funct(this->_hid, args...) < 0) { - HDF5ErrMapper::ToException("Error setting raw hdf5 property."); - } -} - - -// Specific options to be added to Property Lists -#if H5_VERSION_GE(1, 10, 1) -inline FileSpaceStrategy::FileSpaceStrategy(H5F_fspace_strategy_t strategy, - hbool_t persist, - hsize_t threshold) - : _strategy(strategy) - , _persist(persist) - , _threshold(threshold) {} - -inline void FileSpaceStrategy::apply(const hid_t list) const { - if (H5Pset_file_space_strategy(list, _strategy, _persist, _threshold) < 0) { - HDF5ErrMapper::ToException("Error setting file space strategy."); - } -} - -inline FileSpacePageSize::FileSpacePageSize(hsize_t page_size) - : _page_size(page_size) {} - -inline void FileSpacePageSize::apply(const hid_t list) const { - if (H5Pset_file_space_page_size(list, _page_size) < 0) { - HDF5ErrMapper::ToException("Error setting file space page size."); - } -} - -#ifndef H5_HAVE_PARALLEL -inline PageBufferSize::PageBufferSize(size_t page_buffer_size, - unsigned min_meta_percent, - unsigned min_raw_percent) - : _page_buffer_size(page_buffer_size) - , _min_meta(min_meta_percent) - , _min_raw(min_raw_percent) {} - -inline void PageBufferSize::apply(const hid_t list) const { - if (H5Pset_page_buffer_size(list, _page_buffer_size, _min_meta, _min_raw) < 0) { - HDF5ErrMapper::ToException("Error setting page buffer size."); - } -} -#endif -#endif - -#ifdef H5_HAVE_PARALLEL - -inline void MPIOCollectiveMetadata::apply(const hid_t plist) const { - auto read = MPIOCollectiveMetadataRead{collective_}; - auto write = MPIOCollectiveMetadataWrite{collective_}; - - read.apply(plist); - write.apply(plist); -} - -inline void MPIOCollectiveMetadataRead::apply(const hid_t plist) const { - if (H5Pset_all_coll_metadata_ops(plist, collective_) < 0) { - HDF5ErrMapper::ToException("Unable to request collective metadata reads"); - } -} - -inline void MPIOCollectiveMetadataWrite::apply(const hid_t plist) const { - if (H5Pset_coll_metadata_write(plist, collective_) < 0) { - HDF5ErrMapper::ToException("Unable to request collective metadata writes"); - } -} - -#endif - - -inline void EstimatedLinkInfo::apply(const hid_t hid) const { - if (H5Pset_est_link_info(hid, _entries, _length) < 0) { - HDF5ErrMapper::ToException("Error setting estimated link info"); - } -} - -inline void Chunking::apply(const hid_t hid) const { - if (H5Pset_chunk(hid, static_cast(_dims.size()), _dims.data()) < 0) { - HDF5ErrMapper::ToException("Error setting chunk property"); - } -} - -inline void Deflate::apply(const hid_t hid) const { - if (!H5Zfilter_avail(H5Z_FILTER_DEFLATE) || H5Pset_deflate(hid, _level) < 0) { - HDF5ErrMapper::ToException("Error setting deflate property"); - } -} - -inline void Szip::apply(const hid_t hid) const { - if (!H5Zfilter_avail(H5Z_FILTER_SZIP)) { - HDF5ErrMapper::ToException("Error setting szip property"); - } - - if (H5Pset_szip(hid, _options_mask, _pixels_per_block) < 0) { - HDF5ErrMapper::ToException("Error setting szip property"); - } -} - -inline void Shuffle::apply(const hid_t hid) const { - if (!H5Zfilter_avail(H5Z_FILTER_SHUFFLE)) { - HDF5ErrMapper::ToException("Error setting shuffle property"); - } - - if (H5Pset_shuffle(hid) < 0) { - HDF5ErrMapper::ToException("Error setting shuffle property"); - } -} - -inline void AllocationTime::apply(hid_t dcpl) const { - if (H5Pset_alloc_time(dcpl, _alloc_time) < 0) { - HDF5ErrMapper::ToException("Error setting allocation time"); - } -} - -inline void Caching::apply(const hid_t hid) const { - if (H5Pset_chunk_cache(hid, _numSlots, _cacheSize, _w0) < 0) { - HDF5ErrMapper::ToException("Error setting dataset cache parameters"); - } -} - -inline void CreateIntermediateGroup::apply(const hid_t hid) const { - if (H5Pset_create_intermediate_group(hid, _create ? 1 : 0) < 0) { - HDF5ErrMapper::ToException( - "Error setting property for create intermediate groups"); - } -} - -#ifdef H5_HAVE_PARALLEL -inline void UseCollectiveIO::apply(const hid_t hid) const { - if (H5Pset_dxpl_mpio(hid, _enable ? H5FD_MPIO_COLLECTIVE : H5FD_MPIO_INDEPENDENT) < 0) { - HDF5ErrMapper::ToException("Error setting H5Pset_dxpl_mpio."); - } -} -#endif - -} // namespace HighFive - -#endif // H5PROPERTY_LIST_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/boost_multi_array_2D.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/boost_multi_array_2D.cpp deleted file mode 100644 index 29ce9f4513..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/boost_multi_array_2D.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include - -#undef H5_USE_BOOST -#define H5_USE_BOOST - -#include -#include - -using namespace HighFive; - -const std::string FILE_NAME("boost_multiarray_example.h5"); -const std::string DATASET_NAME("dset"); -const int size_x = 10; -const int size_y = 3; - -// Create a 2D dataset 10x3 of double with boost multi array -// and write it to a file -int main(void) { - try { - boost::multi_array my_array(boost::extents[size_x][size_y]); - - for (int i = 0; i < size_x; ++i) { - for (int j = 0; j < size_y; ++j) { - my_array[i][j] = double(j + i * size_y); - } - } - - // we create a new hdf5 file - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - // let's create our dataset of the size of the boost::multi_array - DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace::From(my_array)); - - // we fill it - dataset.write(my_array); - - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_attribute_string_integer.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_attribute_string_integer.cpp deleted file mode 100644 index 564901bdaa..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_attribute_string_integer.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include -#include -#include - -#include -#include -#include -#include - -using namespace HighFive; - -const std::string FILE_NAME("create_attribute.h5"); -const std::string DATASET_NAME("my_dataset"); - -const std::string ATTRIBUTE_NAME_NOTE("note"); -const std::string ATTRIBUTE_NAME_VERSION("version_string"); - -// create a dataset from a vector of string -// read it back and print it -int main(void) { - try { - // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - // Create a dummy dataset of one single integer - DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace(1), create_datatype()); - - // Now let's add a attribute on this dataset - // This attribute will be named "note" - // and have the following content - std::string string_list("very important Dataset !"); - - Attribute a = dataset.createAttribute(ATTRIBUTE_NAME_NOTE, - DataSpace::From(string_list)); - a.write(string_list); - - // We also add a "version" attribute - // that will be an array 1x2 of integer - std::vector version; - version.push_back(1); - version.push_back(0); // version 1.0 - - Attribute v = dataset.createAttribute(ATTRIBUTE_NAME_VERSION, - DataSpace::From(version)); - v.write(version); - - // Ok all attributes are now written - - // let's list the keys of all attributes now - std::vector all_attributes_keys = dataset.listAttributeNames(); - for (const auto& attr: all_attributes_keys) { - std::cout << "attribute: " << attr << std::endl; - } - - } catch (const Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_dataset_double.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_dataset_double.cpp deleted file mode 100644 index ba7f4bc034..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_dataset_double.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include -#include -#include - -#include -#include -#include - -const std::string FILE_NAME("create_dataset_example.h5"); -const std::string DATASET_NAME("dset"); - -// Create a dataset name "dset" of double 4x6 -// -int main(void) { - using namespace HighFive; - try { - // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - // Define the size of our dataset: 2x6 - std::vector dims{2, 6}; - - // Create the dataset - DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace(dims)); - - double data[2][6] = {{1.1, 2.2, 3.3, 4.4, 5.5, 6.6}, - {11.11, 12.12, 13.13, 14.14, 15.15, 16.16}}; - - // write it - dataset.write(data); - - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_dataset_half_float.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_dataset_half_float.cpp deleted file mode 100644 index c73d009944..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_dataset_half_float.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c), 2022, Blue Brain Project - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ - -#ifdef H5_USE_HALF_FLOAT - -#include -#include -#include - -#include -#include -#include - -const std::string FILE_NAME("create_dataset_half_float_example.h5"); -const std::string DATASET_NAME("dset"); - -// Create a dataset name "dset", size 4x6, and type float16_t (i.e., 16-bit half-precision -// floating-point format) -// -int main(void) { - using namespace HighFive; - try { - // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - // Define the size of our dataset: 4x6 - std::vector dims{4, 6}; - - // Create the dataset - DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace(dims)); - - std::vector> data; - for (size_t i = 0; i < 4; ++i) { - data.emplace_back(); - for (size_t j = 0; j < 6; ++j) - data[i].emplace_back((i + 1) * (j + 1)); - } - - // write it - dataset.write(data); - - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} - -#endif \ No newline at end of file diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_datatype.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_datatype.cpp deleted file mode 100644 index c7aa1bfbe7..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_datatype.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include - -#include -#include - -using namespace HighFive; - -static const std::string FILE_NAME("create_datatype_example.h5"); -static const std::string DATASET_NAME("test_dataset"); - - -// Struct representation of custom type (type v below) -typedef struct { - char a; - short b; - unsigned long long c; -} csl; - -bool operator==(csl x, csl y) { - return x.a == y.a && x.b == y.b && x.c == y.c; -} - -bool operator!=(csl x, csl y) { - return !(x == y); -} - -// Tell HighFive how to create the HDF5 datatype for this base type by -// using the HIGHFIVE_REGISTER_TYPE macro -CompoundType create_compound_csl() { - return {{"u1", create_datatype()}, - {"u2", create_datatype()}, - {"u3", create_datatype()}}; -} -HIGHFIVE_REGISTER_TYPE(csl, create_compound_csl) - -int main(void) { - try { - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - // Create a simple compound type with automatic alignment of the - // members. For this the type alignment is trivial. - std::vector t_members( - {{"real", create_datatype()}, {"imag", create_datatype()}}); - CompoundType t(t_members); - t.commit(file, "new_type1"); - - // Create a complex nested datatype with manual alignment - CompoundType u({{"u1", t, 0}, {"u2", t, 9}, {"u3", create_datatype(), 20}}, 26); - u.commit(file, "new_type3"); - - // Create a more complex type with automatic alignment. For this the - // type alignment is more complex. - CompoundType v_aligned{{"u1", create_datatype()}, - {"u2", create_datatype()}, - {"u3", create_datatype()}}; - // introspect the compound type - std::cout << "v_aligned size: " << v_aligned.getSize(); - for (const auto& member: v_aligned.getMembers()) { - std::cout << " field " << member.name << " offset: " << member.offset << std::endl; - } - - v_aligned.commit(file, "new_type2_aligned"); - - // Create a more complex type with a fully packed alignment. The - // equivalent type is created with a standard struct alignment in the - // implementation of HighFive::create_datatype above - CompoundType v_packed({{"u1", create_datatype(), 0}, - {"u2", create_datatype(), 1}, - {"u3", create_datatype(), 3}}, - 11); - v_packed.commit(file, "new_type2_packed"); - - - // Initialise some data - std::vector data; - data.push_back({'f', 1, 4}); - data.push_back({'g', -4, 18}); - - // Write the data into the file in a fully packed form - DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace(2), v_packed); - dataset.write(data); - - file.flush(); - - // Read a subset of the data back - std::vector result; - dataset.select({0}, {2}).read(result); - - for (size_t i = 0; i < data.size(); ++i) { - if (result[i] != data[i]) { - std::cout << "result[" << i << "]:" << std::endl; - std::cout << " " << result[i].a << std::endl; - std::cout << " " << result[i].b << std::endl; - std::cout << " " << result[i].c << std::endl; - std::cout << "data[" << i << "]:" << std::endl; - std::cout << " " << data[i].a << std::endl; - std::cout << " " << data[i].b << std::endl; - std::cout << " " << data[i].c << std::endl; - } - } - - - } catch (const Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - return 1; - } - - return 0; // successfully terminated -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_extensible_dataset.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_extensible_dataset.cpp deleted file mode 100644 index 96dc2a11b3..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_extensible_dataset.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include -#include -#include - -#include -#include -#include - -const std::string FILE_NAME("create_extensible_dataset_example.h5"); -const std::string DATASET_NAME("dset"); - -// Create a dataset name "dset" of double 4x6 -// -int main(void) { - using namespace HighFive; - try { - // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - // Create a dataspace with initial shape and max shape - DataSpace dataspace = DataSpace({4, 5}, {17, DataSpace::UNLIMITED}); - - // Use chunking - DataSetCreateProps props; - props.add(Chunking(std::vector{2, 2})); - - // Create the dataset - DataSet dataset = - file.createDataSet(DATASET_NAME, dataspace, create_datatype(), props); - - // Write into the initial part of the dataset - double t1[3][1] = {{2.0}, {2.0}, {4.0}}; - dataset.select({0, 0}, {3, 1}).write(t1); - - // Resize the dataset to a larger size - dataset.resize({4, 6}); - - // Write into the new part of the dataset - double t2[1][3] = {{4.0, 8.0, 6.0}}; - dataset.select({3, 3}, {1, 3}).write(t2); - - // now we read it back - std::vector> result; - dataset.read(result); - - // we print it out and see: - // 2 0 0 0 0 0 - // 2 0 0 0 0 0 - // 4 0 0 0 0 0 - // 0 0 0 4 8 6 - for (auto row: result) { - for (auto col: row) - std::cout << " " << col; - std::cout << std::endl; - } - - } catch (const Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/eigen_matrix.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/eigen_matrix.cpp deleted file mode 100644 index 50c3d40b2b..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/eigen_matrix.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * Copyright (c), 2022, Blue Brain Project - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include - -#ifdef H5_USE_EIGEN - -#include -#include - -using namespace HighFive; - -const std::string FILE_NAME("eigen_matrix_example.h5"); -const std::string DATASET_NAME("dset"); -const int nrows = 10; -const int ncols = 3; - -// Create a 2D dataset 10x3 of double with eigen matrix -// and write it to a file -int main(void) { - try { - Eigen::MatrixXd matrix(nrows, ncols); - - for (int i = 0; i < nrows; ++i) { - for (int j = 0; j < ncols; ++j) { - matrix(i, j) = double(j + i * 100); - } - } - - // we create a new hdf5 file - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - // let's create our dataset of the size of the eigen matrix - file.createDataSet(DATASET_NAME, matrix); - - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} - -#endif diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_dataset_string.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_dataset_string.cpp deleted file mode 100644 index ec1813eb2f..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_dataset_string.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include -#include -#include - -#include -#include -#include - -using namespace HighFive; - -const std::string FILE_NAME("create_dataset_string_example.h5"); -const std::string DATASET_NAME("story"); - -// create a dataset from a vector of string -// read it back and print it -int main(void) { - try { - // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - std::vector string_list; - string_list.push_back("Hello World !"); - string_list.push_back( - "This string list is mapped to a dataset of " - "variable length string"); - string_list.push_back("Encoding is done in UTF-8 - 你好 - Здравствуйте!"); - string_list.push_back("May the force be with you"); - string_list.push_back("Enjoy !"); - - // create a dataset ready to contains strings of the size of the vector - // string_list - DataSet dataset = file.createDataSet(DATASET_NAME, - DataSpace::From(string_list)); - - // let's write our vector of string - dataset.write(string_list); - - // now we read it back - std::vector result_string_list; - dataset.read(result_string_list); - - for (size_t i = 0; i < result_string_list.size(); ++i) { - std::cout << ":" << i << " " << result_string_list[i] << "\n"; - } - - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_fixedlen_string.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_fixedlen_string.cpp deleted file mode 100644 index 1d13f97bc5..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_fixedlen_string.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c), 2020, Blue Brain Project - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include -#include -#include - -#include -#include -#include - -using namespace HighFive; - -static const std::string FILE_NAME("create_dataset_string_example.h5"); - -// create a dataset from a vector of string -// read it back and print it -int main(void) { - try { - // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - const char strings_fixed[][16] = {"abcabcabcabcabc", "123123123123123"}; - - // create a dataset ready to contains strings of the size of the vector - file.createDataSet("ds1", DataSpace(2)).write(strings_fixed); - - // Without specific type info this will create an int8 dataset - file.createDataSet("ds2", strings_fixed); - - // Now test the new interface type - FixedLenStringArray<10> arr{"0000000", "1111111"}; // also accepts std::vector - auto ds = file.createDataSet("ds3", arr); - - // Read back truncating to 4 chars - FixedLenStringArray<4> array_back; - ds.read(array_back); - std::cout << "First item is '" << array_back[0] << "'" << std::endl - << "Second item is '" << array_back[1] << "'" << std::endl; - - - } catch (const Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_raw_ptr.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_raw_ptr.cpp deleted file mode 100644 index bef55278b1..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_raw_ptr.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * Copyright (c), 2022, Blue Brain Project - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include -#include -#include - -#include -#include -#include - -const std::string FILE_NAME("read_write_raw_ptr.h5"); -const std::string DATASET_NAME("array"); - -// This create a "multi-dimensional" array. Meaning a pointer with -// dimensions. The `std::vector` is mearly a convenient way -// of allocating and releasing memory. -// -// Conceptionually this is only a raw pointer with dimensions. The -// data is store in row-major, aka C-style, without stride, offset -// or padding. -std::vector make_array(const std::vector& dims) { - auto n_elements = dims[0] * dims[1]; - std::vector nd_array(n_elements, 0.0); - - for (size_t i = 0; i < dims[0]; ++i) { - for (size_t j = 0; j < dims[1]; ++j) { - nd_array[j + i * dims[1]] = double(j) + 100.0 * double(i); - } - } - - return nd_array; -} - -int main(void) { - using namespace HighFive; - try { - // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - // Let's write to file. - { - std::vector dims{3, 5}; - auto nd_array = make_array(dims); - - // First, create a dataset with the correct dimensions. - auto dataset = file.createDataSet(DATASET_NAME, DataSpace(dims)); - - // Then write, using the raw pointer. - dataset.write_raw(nd_array.data()); - } - - // Let's read from file. - { - auto dataset = file.getDataSet(DATASET_NAME); - - // First read the dimensions. - auto dims = dataset.getDimensions(); - - // Then allocate memory. - auto n_elements = dims[0] * dims[1]; - auto nd_array = std::vector(n_elements); - - // Finally, read into the memory by passing a raw pointer to the library. - dataset.read(nd_array.data()); - } - - - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_single_scalar.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_single_scalar.cpp deleted file mode 100644 index ed0492d680..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_single_scalar.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include -#include -#include - -#include -#include -#include - -const std::string FILE_NAME("read_write_scalar.h5"); -const std::string DATASET_NAME("single_scalar"); - -// Create a dataset name "single_scalar" -// which contains only the perfect integer number "42" -// -int main(void) { - using namespace HighFive; - try { - // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - int perfect_number = 42; - - // Create the dataset - DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace::From(perfect_number)); - - // write it - dataset.write(perfect_number); - - // flush everything - file.flush(); - - // let's read it back - int potentially_perfect_number; - - dataset.read(potentially_perfect_number); - - std::cout << "perfect number: " << potentially_perfect_number << std::endl; - - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/select_by_id_dataset_cpp11.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/select_by_id_dataset_cpp11.cpp deleted file mode 100644 index 7941689197..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/select_by_id_dataset_cpp11.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include -#include -#include -#include - -#include -#include -#include - -const std::string FILE_NAME("select_partial_string.h5"); -const std::string DATASET_NAME("message"); - -// Create a dataset name "dset" of double 4x6 -// -int main(void) { - using namespace HighFive; - try { - // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - { - // We have a set of string - std::vector values = { - "Cat", - "Dog", - "Hello", - "Tree", - "World", - "Plane", - ", ", - "你好", - "Tea", - "Moon", - "صباح جميل", - "Spaceship", - }; - - // let's create a dataset - DataSet dataset = file.createDataSet(DATASET_NAME, - DataSpace::From(values)); - - // and write them - dataset.write(values); - } - - { - DataSet dataset = file.getDataSet(DATASET_NAME); - - // now let's read back by cherry pick our interesting string - std::vector result; - // we select only element N° 2 and 5 - dataset.select(ElementSet({2, 4, 6, 7, 6, 10})).read(result); - - // and display it - for (auto i: result) { - std::cout << i << " "; - } - std::cout << "\n"; - } - - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/select_partial_dataset_cpp11.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/select_partial_dataset_cpp11.cpp deleted file mode 100644 index dce12fde70..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/select_partial_dataset_cpp11.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c), 2017, Adrien Devresse - * - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file LICENSE_1_0.txt or copy at - * http://www.boost.org/LICENSE_1_0.txt) - * - */ -#include -#include -#include -#include - -#include -#include -#include - -const std::string FILE_NAME("select_partial_example.h5"); -const std::string DATASET_NAME("dset"); - -// Create a dataset name "dset" of double 4x6 -// -int main(void) { - using namespace HighFive; - try { - // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - - // we have some example values in a 2D vector 2x5 - std::vector> values = {{1.0, 2.0, 4.0, 8.0, 16.0}, - {32.0, 64.0, 128.0, 256.0, 512.0}}; - - // let's create a dataset of this size - DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace::From(values)); - // and write them - dataset.write(values); - - // now we read back 2x2 values after an offset of 0x2 - std::vector> result; - dataset.select({0, 2}, {2, 2}).read(result); - - // we print out 4 values - for (auto i: result) { - for (auto j: i) { - std::cout << " " << j; - } - std::cout << "\n"; - } - - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated -} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/include/simpleton.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/include/simpleton.hpp deleted file mode 100644 index 0684294d0f..0000000000 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/include/simpleton.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef H5_TEST_SIMPLETON_HPP -#define H5_TEST_SIMPLETON_HPP - -// Include all headers here to catch any missing `inline` statements, since -// they will be included by two different compilation units. -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// Boost should always be found in this setup -#include - -void function(const HighFive::Object& obj); -void other_function(const boost::numeric::ublas::matrix& m); - -#endif diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0.zip b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0.zip new file mode 100644 index 0000000000..a1471cfe00 Binary files /dev/null and b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0.zip differ diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.clang-format b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.clang-format similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.clang-format rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.clang-format diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.git-blame-ignore-revs b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.git-blame-ignore-revs similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.git-blame-ignore-revs rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.git-blame-ignore-revs diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/ISSUE_TEMPLATE/bug_report.md b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/ISSUE_TEMPLATE/bug_report.md similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/ISSUE_TEMPLATE/bug_report.md rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/ISSUE_TEMPLATE/bug_report.md diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/ISSUE_TEMPLATE/config.yml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/ISSUE_TEMPLATE/config.yml similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/ISSUE_TEMPLATE/config.yml rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/ISSUE_TEMPLATE/config.yml diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/ISSUE_TEMPLATE/feature_request.md b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/ISSUE_TEMPLATE/feature_request.md similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/ISSUE_TEMPLATE/feature_request.md rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/ISSUE_TEMPLATE/feature_request.md diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/build.sh b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/build.sh similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/build.sh rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/build.sh diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/pull_request_template.md b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/pull_request_template.md similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/pull_request_template.md rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/pull_request_template.md diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/run_examples.sh b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/run_examples.sh new file mode 100644 index 0000000000..77861f3884 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/run_examples.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env bash + +set -e + +if [[ $# -eq 0 ]] +then + examples_dir="." +elif [[ $# -eq 1 ]] +then + examples_dir="$1" +else + echo "Usage: $0 [EXAMPLES_DIR]" + exit -1 +fi + +for f in "${examples_dir}"/*_bin +do + echo "-- ${f}" + "${f}" +done diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/check_doxygen_awesome_version.yml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/check_doxygen_awesome_version.yml similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/check_doxygen_awesome_version.yml rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/check_doxygen_awesome_version.yml diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/ci.yml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/ci.yml similarity index 56% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/ci.yml rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/ci.yml index a34847188e..e7f5fca10b 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/ci.yml +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/ci.yml @@ -28,26 +28,35 @@ jobs: # Job testing compiling on several Ubuntu systems + MPI # ========================================================= # - # For 18.04: bare HighFive - # For 20.04: activate Boost, OpenCV + # For 20.04: bare and activate Boost, OpenCV # For latest: activate Boost, Eigen, OpenCV, with Ninja # # XTensor tests are run for conda/mamba and MacOS Linux_MPI: - runs-on: ${{matrix.os}} + runs-on: ${{matrix.config.os}} + name: Linux_MPI (${{toJson(matrix.config)}}) strategy: matrix: - os: [ubuntu-18.04, ubuntu-20.04, ubuntu-latest] include: - - os: ubuntu-18.04 - pkgs: '' - flags: '-DHIGHFIVE_USE_BOOST:Bool=OFF' - - os: ubuntu-20.04 - pkgs: 'libboost-all-dev libopencv-dev' - flags: '-DHIGHFIVE_USE_OPENCV:Bool=ON -GNinja' - - os: ubuntu-latest - pkgs: 'libboost-all-dev libeigen3-dev libopencv-dev' - flags: '-DHIGHFIVE_USE_EIGEN:Bool=ON -DHIGHFIVE_USE_OPENCV:Bool=ON -GNinja' + - config: + os: ubuntu-20.04 + pkgs: '' + flags: '-DHIGHFIVE_USE_BOOST:Bool=OFF' + - config: + os: ubuntu-20.04 + pkgs: 'libboost-all-dev libopencv-dev' + flags: '-DHIGHFIVE_USE_OPENCV:Bool=ON -GNinja' + - config: + os: ubuntu-latest + pkgs: 'libboost-all-dev libeigen3-dev libopencv-dev' + flags: '-DHIGHFIVE_USE_EIGEN:Bool=ON -DHIGHFIVE_USE_OPENCV:Bool=ON -GNinja' + - config: + os: ubuntu-20.04 + pkgs: 'libboost-all-dev' + flags: '-DCMAKE_CXX_STANDARD=17' + - config: + os: ubuntu-22.04 + flags: '-DHIGHFIVE_USE_BOOST=Off -DCMAKE_CXX_STANDARD=20' steps: - uses: actions/checkout@v3 @@ -62,16 +71,16 @@ jobs: - name: "Install libraries" run: | sudo apt-get -qq update - sudo apt-get -qq install libhdf5-openmpi-dev libsz2 ninja-build ${{ matrix.pkgs }} + sudo apt-get -qq install libhdf5-openmpi-dev libsz2 ninja-build ${{ matrix.config.pkgs }} - name: Build run: | - CMAKE_OPTIONS=(-DHIGHFIVE_PARALLEL_HDF5:BOOL=ON ${{ matrix.flags }}) + CMAKE_OPTIONS=(-DHIGHFIVE_PARALLEL_HDF5:BOOL=ON ${{ matrix.config.flags }}) source $GITHUB_WORKSPACE/.github/build.sh - name: Test working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -C $BUILD_TYPE + run: ctest -j2 --output-on-failure -C $BUILD_TYPE # Job testing several versions of hdf5 @@ -80,7 +89,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - hdf5_version : [ hdf5-1_8_22, hdf5-1_10_9, hdf5-1_12_2, hdf5-1_13_2 ] + hdf5_version : [ hdf5-1_8_23, hdf5-1_10_11, hdf5-1_12_2, hdf5-1_14_3 ] steps: - uses: actions/checkout@v3 @@ -96,18 +105,25 @@ jobs: wget https://github.com/HDFGroup/hdf5/archive/refs/tags/${{ matrix.hdf5_version }}.tar.gz --output-document hdf5.tar.gz tar xf hdf5.tar.gz mkdir -p hdf5-${{ matrix.hdf5_version }}/BUILD && cd hdf5-${{ matrix.hdf5_version }}/BUILD - cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.hdf5_version }} -DHDF5_ENABLE_Z_LIB_SUPPORT=ON -DUSE_LIBAEC=ON + cmake .. -DCMAKE_BUILD_TYPE=Release -GNinja -DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.hdf5_version }} -DHDF5_ENABLE_Z_LIB_SUPPORT=ON -DUSE_LIBAEC=ON -DHDF5_BUILD_EXAMPLES=OFF -DBUILD_STATIC_LIBS=OFF -DBUILD_TESTING=OFF ninja && ninja install - name: Build run: | - mkdir BUILD && cd BUILD - cmake -GNinja -DHDF5_ROOT=$HOME/${{ matrix.hdf5_version }} .. - ninja + CMAKE_OPTIONS=( + -GNinja + -DHDF5_ROOT=$HOME/${{ matrix.hdf5_version }} + ) + source $GITHUB_WORKSPACE/.github/build.sh - name: Test - run: | - cd BUILD && ctest --output-on-failure + working-directory: ${{github.workspace}}/build + run: ctest -j2 --output-on-failure -C $BUILD_TYPE + + + - name: Examples + working-directory: ${{github.workspace}}/build/src/examples + run: $GITHUB_WORKSPACE/.github/run_examples.sh # Job testing several compilers on a stable Linux # ==================================================== @@ -140,22 +156,86 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -C $BUILD_TYPE + run: ctest -j2 --output-on-failure -C $BUILD_TYPE + + - name: Examples + working-directory: ${{github.workspace}}/build/src/examples + run: $GITHUB_WORKSPACE/.github/run_examples.sh + + # Job running unit-test with sanitizers + # ===================================== + Linux_Sanitizers: + runs-on: ubuntu-20.04 + strategy: + matrix: + env: [ + {CC: clang-12, CXX: clang++-12, HIGHFIVE_SANITIZER: address}, + {CC: clang-12, CXX: clang++-12, HIGHFIVE_SANITIZER: undefined}, + {CC: gcc-10, CXX: g++-10, HIGHFIVE_GLIBCXX_ASSERTIONS: On}, + ] + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: "Install libraries" + run: | + sudo apt-get -qq update + sudo apt-get -qq install libboost-all-dev libeigen3-dev libhdf5-dev libsz2 ninja-build + + - name: Build + env: ${{matrix.env}} + run: | + CMAKE_OPTIONS=( + -GNinja + -DHIGHFIVE_USE_BOOST:BOOL=ON + -DHIGHFIVE_USE_EIGEN:BOOL=ON + -DHIGHFIVE_BUILD_DOCS:BOOL=FALSE + -DHIGHFIVE_GLIBCXX_ASSERTIONS=${HIGHFIVE_GLIBCXX_ASSERTIONS:-OFF} + -DHIGHFIVE_SANITIZER=${HIGHFIVE_SANITIZER:-OFF} + ) + source $GITHUB_WORKSPACE/.github/build.sh + + - name: Test + working-directory: ${{github.workspace}}/build + run: ctest -j2 --output-on-failure -C $BUILD_TYPE + + - name: Examples + working-directory: ${{github.workspace}}/build/src/examples + run: $GITHUB_WORKSPACE/.github/run_examples.sh # Job to check using HighFive from other CMake projects # ===================================================== CMake_Project: runs-on: ubuntu-20.04 + strategy: + matrix: + parallelism: [ serial, parallel ] steps: - uses: actions/checkout@v3 with: submodules: true - - name: "Install libraries" + - name: "Update Ubuntu" run: | sudo apt-get -qq update - sudo apt-get -qq install libboost-all-dev libhdf5-dev libsz2 ninja-build + + - name: "Install common libraries" + run: | + sudo apt-get -qq install libboost-all-dev libsz2 ninja-build + + - name: "Install serial HDF5" + if: matrix.parallelism == 'serial' + run: | + sudo apt-get -qq install libhdf5-dev + + + - name: "Install parallel HDF5" + if: matrix.parallelism == 'parallel' + run: | + sudo apt-get -qq install libhdf5-openmpi-dev - name: "CMake Project Integration" run: bash tests/test_project_integration.sh @@ -183,9 +263,13 @@ jobs: # Job testing in OSX - # ======================= + # ================== OSX: - runs-on: macOS-10.15 + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [ "macOS-12" ] + cxxstd: ["14", "17", "20"] steps: - uses: actions/checkout@v3 @@ -205,24 +289,44 @@ jobs: -DHIGHFIVE_BUILD_DOCS:BOOL=FALSE -DHIGHFIVE_TEST_SINGLE_INCLUDES=ON -DCMAKE_CXX_FLAGS="-coverage -O0" + -DCMAKE_CXX_STANDARD=${{matrix.cxxstd}} ) source $GITHUB_WORKSPACE/.github/build.sh - name: Test working-directory: ${{github.workspace}}/build - run: ctest --output-on-failure -C $BUILD_TYPE + run: ctest -j2 --output-on-failure -C $BUILD_TYPE + + - name: Examples + working-directory: ${{github.workspace}}/build/src/examples + run: $GITHUB_WORKSPACE/.github/run_examples.sh # Job testing in Windows - # =========================== + # ====================== Windows: - runs-on: Windows-latest + runs-on: ${{matrix.os}} + strategy: + matrix: + os: [ "windows-2022"] + vs-toolset: [ "v141", "v143" ] + cxxstd: ["14", "17", "20"] + + include: + - os: "windows-2019" + vs-toolset: "v142" + cxxstd: "14" + + - os: "windows-2019" + vs-toolset: "v142" + cxxstd: "17" + steps: - uses: actions/checkout@v3 with: submodules: true - - uses: mamba-org/provision-with-micromamba@main + - uses: mamba-org/setup-micromamba@v1 with: environment-file: doc/environment.yaml environment-name: win-test @@ -231,6 +335,8 @@ jobs: shell: bash -l {0} run: | CMAKE_OPTIONS=( + -T ${{matrix.vs-toolset}} + -DCMAKE_CXX_STANDARD=${{matrix.cxxstd}} -DHIGHFIVE_UNIT_TESTS=ON -DHIGHFIVE_USE_BOOST:BOOL=ON -DHIGHFIVE_USE_EIGEN:BOOL=ON @@ -242,41 +348,4 @@ jobs: - name: Test working-directory: ${{github.workspace}}/build shell: bash -l {0} - run: ctest --output-on-failure -C $BUILD_TYPE - - # Job producing code coverage report - # ================================== - Code_coverage: - # When ubuntu version will be upgrade, you should look if xtensor is nowavailable - runs-on: ubuntu-20.04 - - steps: - - name: "Install libraries" - run: | - sudo apt-get update - sudo apt-get install lcov libboost-all-dev libhdf5-dev libeigen3-dev libopencv-dev libsz2 ninja-build - - - uses: actions/checkout@v3 - with: - fetch-depth: 2 - submodules: true - - - name: Build and test for code coverage - run: | - CMAKE_OPTIONS=( - -GNinja - -DHIGHFIVE_USE_BOOST:BOOL=ON - -DHIGHFIVE_USE_EIGEN:BOOL=ON - -DHIGHFIVE_USE_OPENCV:BOOL=ON - #-DHIGHFIVE_USE_XTENSOR:BOOL=ON - -DHIGHFIVE_TEST_SINGLE_INCLUDES=ON - -DHIGHFIVE_BUILD_DOCS:BOOL=FALSE - -DCMAKE_CXX_FLAGS="-coverage -O0" - ) - source $GITHUB_WORKSPACE/.github/build.sh - cd $HIGHFIVE_BUILD - (cd $GITHUB_WORKSPACE; lcov --capture --initial --directory . --no-external --output-file build/coverage-base.info) - cmake --build $HIGHFIVE_BUILD --target test - (cd $GITHUB_WORKSPACE; lcov --capture --directory . --no-external --output-file build/coverage-run.info) - lcov --add-tracefile coverage-base.info --add-tracefile coverage-run.info --output-file coverage-combined.info - bash <(curl -s https://codecov.io/bash) -f coverage-combined.info + run: ctest -j2 --output-on-failure -C $BUILD_TYPE diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/clang_format.yml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/clang_format.yml similarity index 90% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/clang_format.yml rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/clang_format.yml index 99cb6e1b3b..56f2fd8d53 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/clang_format.yml +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/clang_format.yml @@ -32,5 +32,8 @@ jobs: then echo "Some files are not well formatted:" echo $modified_files + echo "" + echo "The diff is:" + git diff exit 1 fi diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/coverage.yml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/coverage.yml new file mode 100644 index 0000000000..b3f4a212bc --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/coverage.yml @@ -0,0 +1,68 @@ +name: Coverage + +concurrency: + group: ${{ github.workflow }}#${{ github.ref }} + cancel-in-progress: true + +on: + push: + branches: + - master + - ci_test + - release/** + pull_request: + branches: + - master + - release/** + paths-ignore: + - '**.md' + - '**.rst' + - 'doc/**' + +env: + BUILD_TYPE: RelWithDebInfo + INSTALL_DIR: install + +jobs: + # Job producing code coverage report + # ================================== + Code_coverage: + # When ubuntu version will be upgrade, you should look if xtensor is now available + runs-on: ubuntu-20.04 + + steps: + - name: "Install libraries" + run: | + sudo apt-get update + sudo apt-get install lcov libboost-all-dev libhdf5-dev libeigen3-dev libopencv-dev libsz2 ninja-build + + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + submodules: true + + - name: Build for code coverage + run: | + CMAKE_OPTIONS=( + -GNinja + -DHIGHFIVE_USE_BOOST:BOOL=ON + -DHIGHFIVE_USE_EIGEN:BOOL=ON + -DHIGHFIVE_USE_OPENCV:BOOL=ON + #-DHIGHFIVE_USE_XTENSOR:BOOL=ON + -DHIGHFIVE_TEST_SINGLE_INCLUDES=ON + -DHIGHFIVE_BUILD_DOCS:BOOL=FALSE + -DCMAKE_CXX_FLAGS="-coverage -O0" + ) + source $GITHUB_WORKSPACE/.github/build.sh + - name: Test for code coverage + run: | + lcov --capture --initial --directory . --no-external --output-file build/coverage-base.info + (cd build; cmake --build . --target test) + lcov --capture --directory . --no-external --output-file build/coverage-run.info + (cd build; lcov --add-tracefile coverage-base.info --add-tracefile coverage-run.info --output-file coverage-combined.info) + - uses: codecov/codecov-action@v3 + with: + files: ./build/coverage-combined.info + fail_ci_if_error: false + verbose: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/gh-pages.yml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/gh-pages.yml similarity index 85% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/gh-pages.yml rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/gh-pages.yml index 0f51447c46..2032f91abc 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/gh-pages.yml +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/gh-pages.yml @@ -24,7 +24,7 @@ jobs: with: submodules: 'recursive' - - uses: mamba-org/provision-with-micromamba@main + - uses: mamba-org/setup-micromamba@v1 with: environment-file: doc/environment.yaml environment-name: doc-build @@ -33,9 +33,6 @@ jobs: run: | CMAKE_OPTIONS=( -DHIGHFIVE_UNIT_TESTS=OFF - -DHIGHFIVE_USE_BOOST:BOOL=ON - -DHIGHFIVE_USE_EIGEN:BOOL=ON - -DHIGHFIVE_USE_XTENSOR:BOOL=ON ) cmake -B build -S . "${CMAKE_OPTIONS[@]}" cmake --build build --target doc diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/integration_trigger.yml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/integration_trigger.yml similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.github/workflows/integration_trigger.yml rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/integration_trigger.yml diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/version_file.yml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/version_file.yml new file mode 100644 index 0000000000..816137e955 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.github/workflows/version_file.yml @@ -0,0 +1,36 @@ +name: HighFive Check Version File + +on: + push: + branches: + - ci_test + - release/** + pull_request: + branches: + - master + - release/** + +jobs: + CheckVersion: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: true + + - name: "Install libraries" + run: | + sudo apt-get -qq update + sudo apt-get -qq install libhdf5-dev ninja-build + + - name: Build + run: | + # Will trigger `configure_file` for H5Version.hpp. + cmake -DHIGHFIVE_USE_BOOST=Off -B build . + + - name: Test + run: | + # Check that the file hasn't changed, i.e. was updated + # after changing the version number. + ! git status | grep include/highfive/H5Version.hpp diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.gitignore b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.gitignore similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.gitignore rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.gitignore diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.gitmodules b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.gitmodules similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.gitmodules rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.gitmodules diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.travis.yml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.travis.yml similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/.travis.yml rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/.travis.yml diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/AUTHORS.txt b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/AUTHORS.txt similarity index 90% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/AUTHORS.txt rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/AUTHORS.txt index ed89f76832..78f573a9a6 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/AUTHORS.txt +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/AUTHORS.txt @@ -2,6 +2,7 @@ Adrien Devresse Alexandru Săvulescu Ali Can Demiralp Angelos Plastropoulos +@antonysigma Chris Byrohl Chris De Grendele @contre @@ -12,6 +13,8 @@ Fernando L. Pereira @guoxy Haoran Ni Henry Schreiner +@hn-sl +Hunter Belanger @JaWSnl Jia Li John W. Peterson @@ -28,6 +31,7 @@ Maximilian Nöthe @Mightrider Mike DePalatis Mike Gevaert +Moritz Koenemann Nico Jahn Nicolas Cornu (maintainer) Omar Awile @@ -35,6 +39,7 @@ Pablo Toharia Philip Deegan Philipp Gloor Pramod Kumbhar +@Quark-X10 Richard Shaw Rick Nitsche Rob Latham @@ -47,6 +52,7 @@ Tino Wagner Tobias Klauser Tom de Geus Tom Vander Aa +Torsten Reuschel Tristan Carel Wolf Vollprecht Y. Yang diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CHANGELOG.md b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CHANGELOG.md similarity index 77% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CHANGELOG.md rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CHANGELOG.md index f6bf0bb2fa..9a8cd86139 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CHANGELOG.md +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CHANGELOG.md @@ -1,3 +1,61 @@ +# Changes +## Version 2.8.0 - 2023-11-02 +### Important Change + - `Eigen::Matrix` is (by default) stored with column-major index ordering. Under + certain conditions `Eigen::Matrix` was written and read as row-major. + Due to code duplication H5Easy isn't affected by this bug. Starting + `2.8.0` HighFive will now throw an exception whenever prior versions would + have read with incorrect assumptions about the index ordering. (#731) + +### New Features + - Improve reading and writing `std::string` as fixed and variable length HDF5 strings (#744). + - Implement creation of hard links (#765). Thanks to @Quark-X10. + - Get the size of file and amound of tracked unused space (#764). Thanks to @Quark-X10. + - `class DataType` has a new ctor to open a commited `DataType` (#796). Thanks to @Quark-X10. + - Allow user-specified `mem_space` for hyperslabs. (#740) + - New properties: `AttributePhaseChange`. (#785) + - New options to link against HDF5 statically (#823). Thanks @HunterBelanger. + - Add support for `std::complex` valid with C++23 (#828). Thanks @unbtorsten. + - Add a top-level header to include all compononents (#818). + +### Improvements + - Add concept checks to `Property` if C++20 for better errors (#811). Thanks @antonysigma. + - Add parallel HDF5 test in CI (#760). + - Simplify github workflow (#761). + - Move inspectors in their own file to be able to better implements strings (#759). + +### Bug Fix + - Fix vector constructor ambiguity in H5DataType.hpp (#775). Thanks to @hn-sl. + - `getElementCount()` fixed. (#787) + - Remove leak when calling dtor of `CompoundType`. (#798) + +## Version 2.7.1 - 2023-04-04 +### Bug Fix + - Revert removing `#include "H5FileDriver.hpp"` from `H5File.hpp` (#711). + - Change relative import to "../H5Utility.hpp" (#726). + - Fix nameclash with macros on Windows (#717 #722 #723). + - Add workaround for MSVC bug (#728). + - Don't downgrade the requested C++ standard (#729). + +## Version 2.7.0 - 2023-03-31 +### New Features + - Properties can now be read (#684). + - Adding a property for LinkCreationOrder (#683). + - Adding a logging infrastructure (#690). + - Support of bool in the way of h5py (#654). + - Support `std::bool` in C++17 mode (#698). + +### Improvements + - Catch2 move to v3 (#655). + +### Bug Fix + - To avoid build failure in certain circumstances, user can not set `Boost_NO_BOOST_CMAKE` (#687). + - Fix leak when reading variable length strings (#660). + - Use `H5free_memory` instead of `free` in error handler (#665). Thanks to Moritz Koenemann. + - Fix a bug with old GCC due to templated friend classes (#688). + - Fix regression in broadcasting support (#697). + - Fix bug related to zero-length datasets (#702). + ## Version 2.6.2 - 2022-11-10 ### Bug Fix - Allow CMake to use Config mode to find HDF5. diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/HighFiveConfig.cmake.in b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveConfig.cmake.in similarity index 90% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/HighFiveConfig.cmake.in rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveConfig.cmake.in index c37fffdf34..464a645d03 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/HighFiveConfig.cmake.in +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveConfig.cmake.in @@ -15,6 +15,8 @@ if(TARGET HighFive) return() endif() +@PACKAGE_INIT@ + # Get HighFive targets include("${CMAKE_CURRENT_LIST_DIR}/HighFiveTargets.cmake") @@ -55,13 +57,18 @@ endif() set(HIGHFIVE_USE_EIGEN "${HIGHFIVE_USE_EIGEN}" CACHE BOOL "Enable Eigen testing") set(HIGHFIVE_USE_XTENSOR "${HIGHFIVE_USE_XTENSOR}" CACHE BOOL "Enable xtensor testing") set(HIGHFIVE_PARALLEL_HDF5 @HIGHFIVE_PARALLEL_HDF5@ CACHE BOOL "Enable Parallel HDF5 support") +option(HIGHFIVE_VERBOSE "Enable verbose logging" @HIGHFIVE_VERBOSE@) if(HIGHFIVE_USE_XTENSOR AND NOT CMAKE_VERSION VERSION_LESS 3.8) set_property(TARGET HighFive APPEND PROPERTY INTERFACE_COMPILE_FEATURES cxx_std_14) endif() -message(STATUS "HIGHFIVE @PROJECT_VERSION@: (Re)Detecting Highfive dependencies (HIGHFIVE_USE_INSTALL_DEPS=NO)") +if(NOT HighFive_FIND_QUIETLY) + message(STATUS "HIGHFIVE @PROJECT_VERSION@: (Re)Detecting Highfive dependencies (HIGHFIVE_USE_INSTALL_DEPS=NO)") +endif() include("${CMAKE_CURRENT_LIST_DIR}/HighFiveTargetDeps.cmake") foreach(dependency HighFive_libheaders libdeps) copy_interface_properties(HighFive ${dependency}) endforeach() + +check_required_components(HighFive) diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/HighFiveTargetDeps.cmake b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveTargetDeps.cmake similarity index 70% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/HighFiveTargetDeps.cmake rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveTargetDeps.cmake index 6f8dbaec56..919b53544e 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/HighFiveTargetDeps.cmake +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveTargetDeps.cmake @@ -6,9 +6,27 @@ if(NOT TARGET libdeps) # Independent target to make it possible to have new dependencies each build add_library(libdeps INTERFACE) + if(HIGHFIVE_VERBOSE) + target_compile_definitions(libdeps INTERFACE -DHIGHFIVE_LOG_LEVEL=0) + endif() + + if(HIGHFIVE_GLIBCXX_ASSERTIONS) + target_compile_definitions(libdeps INTERFACE -D_GLIBCXX_ASSERTIONS) + endif() + + if(HIGHFIVE_HAS_FRIEND_DECLARATIONS) + target_compile_definitions(libdeps INTERFACE -DHIGHFIVE_HAS_FRIEND_DECLARATIONS=1) + endif() + + if(HIGHFIVE_SANITIZER) + target_compile_options(libdeps INTERFACE -fsanitize=${HIGHFIVE_SANITIZER}) + target_link_options(libdeps INTERFACE -fsanitize=${HIGHFIVE_SANITIZER}) + endif() + # HDF5 if(NOT DEFINED HDF5_C_LIBRARIES) set(HDF5_PREFER_PARALLEL ${HIGHFIVE_PARALLEL_HDF5}) + set(HDF5_USE_STATIC_LIBRARIES ${HIGHFIVE_STATIC_HDF5}) find_package(HDF5 REQUIRED) endif() @@ -19,10 +37,21 @@ if(NOT TARGET libdeps) target_include_directories(libdeps SYSTEM INTERFACE ${HDF5_INCLUDE_DIRS}) target_link_libraries(libdeps INTERFACE ${HDF5_LIBRARIES}) target_compile_definitions(libdeps INTERFACE ${HDF5_DEFINITIONS}) + target_compile_definitions(libdeps INTERFACE HIGHFIVE_HAS_CONCEPTS=$) + # Boost if(HIGHFIVE_USE_BOOST) - set(Boost_NO_BOOST_CMAKE TRUE) # Consistency + if(NOT DEFINED Boost_NO_BOOST_CMAKE) + # HighFive deactivated finding Boost via Boost's own CMake files + # in Oct 2016 (commit '25627b085'). Likely to appease one cluster. + # Boost's CMake support has since improved and likely this setting + # isn't needed anymore. It is kept for backwards compatibility. + # However, a rework of HighFive's CMake code should consider removing + # this default. Hard coding this to true has been reported to cause + # build failures. + set(Boost_NO_BOOST_CMAKE TRUE) + endif() find_package(Boost REQUIRED COMPONENTS system serialization) # Dont use imported targets yet, not avail before cmake 3.5 target_include_directories(libdeps SYSTEM INTERFACE ${Boost_INCLUDE_DIR}) diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/HighFiveTargetExport.cmake b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveTargetExport.cmake similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/HighFiveTargetExport.cmake rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveTargetExport.cmake diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveWarnings.cmake b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveWarnings.cmake new file mode 100644 index 0000000000..8e8ec22019 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/HighFiveWarnings.cmake @@ -0,0 +1,36 @@ +if(TARGET HighFiveWarnings) + # Allow multiple `include(HighFiveWarnings)`, which would + # attempt to redefine `HighFiveWarnings` and fail without + # this check. + return() +endif() + +add_library(HighFiveWarnings INTERFACE) + +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" + OR CMAKE_CXX_COMPILER_ID MATCHES "GNU" + OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") + + target_compile_options(HighFiveWarnings + INTERFACE + -Wall + -Wextra + -Wshadow + -Wnon-virtual-dtor + -Wunused + -Woverloaded-virtual + -Wformat=2 + -Wconversion + -Wsign-conversion + -Wno-error=deprecated-declarations + ) + + if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Intel") + target_compile_options(HighFiveWarnings + INTERFACE + -Wpedantic + -Wcast-align + -Wdouble-promotion + ) + endif() +endif() diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/config/TestHelpers.cmake b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/config/TestHelpers.cmake similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMake/config/TestHelpers.cmake rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMake/config/TestHelpers.cmake diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMakeLists.txt b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMakeLists.txt similarity index 64% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMakeLists.txt rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMakeLists.txt index 27746c2ff6..af274d9e25 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/CMakeLists.txt @@ -5,15 +5,14 @@ else() cmake_policy(VERSION 3.13) endif() -project(HighFive VERSION 2.6.2) +project(HighFive VERSION 2.8.0) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/highfive/H5Version.hpp.in - ${CMAKE_CURRENT_BINARY_DIR}/include/highfive/H5Version.hpp) + ${CMAKE_CURRENT_SOURCE_DIR}/include/highfive/H5Version.hpp) # INCLUDES list(APPEND CMAKE_MODULE_PATH - ${PROJECT_SOURCE_DIR}/CMake - ${PROJECT_SOURCE_DIR}/CMake/portability - ${PROJECT_SOURCE_DIR}/CMake/config) + ${CMAKE_CURRENT_SOURCE_DIR}/CMake + ${CMAKE_CURRENT_SOURCE_DIR}/CMake/config) # OPTIONS # Compatibility within Highfive 2.x series @@ -33,7 +32,41 @@ option(HIGHFIVE_USE_OPENCV "Enable OpenCV testing" ${USE_OPENCV}) option(HIGHFIVE_USE_XTENSOR "Enable xtensor testing" ${USE_XTENSOR}) option(HIGHFIVE_EXAMPLES "Compile examples" ON) option(HIGHFIVE_PARALLEL_HDF5 "Enable Parallel HDF5 support" OFF) +option(HIGHFIVE_STATIC_HDF5 "Staticly link to HDF5 library" OFF) option(HIGHFIVE_BUILD_DOCS "Enable documentation building" ON) +option(HIGHFIVE_VERBOSE "Set logging level to verbose." OFF) +option(HIGHFIVE_GLIBCXX_ASSERTIONS "Enable bounds check for STL." OFF) +option(HIGHFIVE_HAS_CONCEPTS "Print readable compiler errors w/ C++20 concepts" ON) + +# Controls if HighFive classes are friends of each other. +# +# There are two compiler bugs that require incompatible choices. The +# GCC compiler bug [1] prevents us from writing: +# +# template +# friend class NodeTraits; +# +# While a MSVC compiler bug [2] complains that it can't access a +# protected constructor, e.g., `HighFive::Object::Object`. +# +# Starting with `2.7.0` these friend declarations don't matter +# anymore. It's mearly a means of appeasing a compiler. +# +# The values of `HIGHFIVE_HAS_FRIEND_DECLARATIONS` are: +# - that the macro is undefined. +# - `0` which implies not adding the friend declarations. +# - any non-zero integer, i.e. `1`, to add the friend declarations. +# +# Not defining the macro implies that it'll be set to `1` if MSVC is +# detected (or other compilers requiring the friend declarations). +# +# [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52625 +# [2]: https://developercommunity.visualstudio.com/t/MSVC-compiler-improperly-implements-N489/1516410 +option(HIGHFIVE_HAS_FRIEND_DECLARATIONS "Enable additional friend declarations. Certain compiler require this On, others Off." OFF) +mark_as_advanced(HIGHFIVE_HAS_FRIEND_DECLARATIONS) + +set(HIGHFIVE_SANITIZER OFF CACHE STRING "Enable a group of sanitizers, requires compiler support. Supported: 'address' and 'undefined'.") +mark_as_advanced(HIGHFIVE_SANITIZER) # In deployments we probably don't want/cant have dynamic dependencies option(HIGHFIVE_USE_INSTALL_DEPS "End applications by default use detected dependencies here" OFF) @@ -53,11 +86,12 @@ if(NOT DEFINED CMAKE_CXX_STANDARD) set(CMAKE_CXX_EXTENSIONS OFF) endif() -if(HIGHFIVE_USE_XTENSOR) +if(HIGHFIVE_USE_XTENSOR AND CMAKE_CXX_STANDARD LESS 14) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() +add_compile_definitions(HIGHFIVE_CXX_STD=${CMAKE_CXX_STANDARD}) # Search dependencies (hdf5, boost, eigen, xtensor, mpi) and build target highfive_deps include(${PROJECT_SOURCE_DIR}/CMake/HighFiveTargetDeps.cmake) @@ -70,17 +104,12 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ DESTINATION "include" PATTERN "*.in" EXCLUDE) -# Installation of configured headers -install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/ - DESTINATION "include") - - # Preparing local building (tests, examples) # ------------------------------------------ # Disable test if Boost was expressly disabled, or if HighFive is a sub-project if (NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) - if(HIGHFIVE_UNIT_TESTS) + if(HIGHFIVE_UNIT_TESTS AND NOT HighFive_FIND_QUIETLY) message(WARNING "Unit tests have been DISABLED.") endif() set(HIGHFIVE_UNIT_TESTS FALSE) @@ -101,15 +130,6 @@ if(HIGHFIVE_UNIT_TESTS) endif() endif() - -if(CMAKE_CXX_COMPILER_ID MATCHES "Intel") - # ICC gets mad if we shorten "int"s - add_definitions("-wd1682") -endif() - -# Set compile time flags _after_ including required dependencies -include(ReleaseDebugAutoFlags) - if(HIGHFIVE_EXAMPLES) add_subdirectory(src/examples) endif() diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/LICENSE b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/LICENSE similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/LICENSE rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/LICENSE diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/README.md b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/README.md similarity index 53% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/README.md rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/README.md index 953f534a0c..3ea0680157 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/README.md +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/README.md @@ -1,7 +1,5 @@ # HighFive - HDF5 header-only C++ Library -[![Build Status](https://travis-ci.org/BlueBrain/HighFive.svg?branch=master)](https://travis-ci.org/BlueBrain/HighFive) -[![Coverity Statys](https://scan.coverity.com/projects/13635/badge.svg)](https://scan.coverity.com/projects/highfive) [![Doxygen -> gh-pages](https://github.com/BlueBrain/HighFive/workflows/gh-pages/badge.svg)](https://BlueBrain.github.io/HighFive) [![codecov](https://codecov.io/gh/BlueBrain/HighFive/branch/master/graph/badge.svg?token=UBKxHEn7RS)](https://codecov.io/gh/BlueBrain/HighFive) [![HighFive_Integration_tests](https://github.com/BlueBrain/HighFive-testing/actions/workflows/integration.yml/badge.svg)](https://github.com/BlueBrain/HighFive-testing/actions/workflows/integration.yml) @@ -12,12 +10,11 @@ Documentation: https://bluebrain.github.io/HighFive/ HighFive is a modern header-only C++11 friendly interface for libhdf5. -HighFive supports STL vector/string, Boost::UBLAS, Boost::Multi-array, Eigen and Xtensor. It handles C++ from/to HDF5 with automatic type mapping. -HighFive does not require additional libraries (see dependencies) and supports both HDF5 thread safety and Parallel HDF5 (contrary to the official hdf5 cpp) +HighFive supports STL vector/string, Boost::UBLAS, Boost::Multi-array and Xtensor. It handles C++ from/to HDF5 with automatic type mapping. +HighFive does not require additional libraries (see dependencies). It integrates nicely with other CMake projects by defining (and exporting) a HighFive target. - ### Design - Simple C++-ish minimalist interface - No other dependency than libhdf5 @@ -33,6 +30,7 @@ It integrates nicely with other CMake projects by defining (and exporting) a Hig - parallel Read/Write operations from several nodes with Parallel HDF5 - Advanced types: Compound, Enum, Arrays of Fixed-length strings, References - half-precision (16-bit) floating-point datasets +- `std::byte` in C++17 mode (with `-DCMAKE_CXX_STANDARD=17` or higher) - etc... (see [ChangeLog](./CHANGELOG.md)) ### Dependencies @@ -43,13 +41,19 @@ It integrates nicely with other CMake projects by defining (and exporting) a Hig - xtensor (optional, opt-in with -D*HIGHFIVE_USE_XTENSOR*=ON) - half (optional, opt-in with -D*HIGHFIVE_USE_HALF_FLOAT*=ON) +### Known flaws +- HighFive is not thread-safe. At best it has the same limitations as the HDF5 library. However, HighFive objects modify their members without protecting these writes. Users have reported that HighFive is not thread-safe even when using the threadsafe HDF5 library, e.g., https://github.com/BlueBrain/HighFive/discussions/675. +- Eigen support in core HighFive is broken. See https://github.com/BlueBrain/HighFive/issues/532. H5Easy is not + affected. +- The support of fixed length strings isn't ideal. + ## Examples #### Write a std::vector to 1D HDF5 dataset and read it back ```c++ -#include +#include using namespace HighFive; @@ -86,30 +90,24 @@ dataset over the course of a simulation. #### Write a 2 dimensional C double float array to a 2D HDF5 dataset -See [create_dataset_double.cpp](src/examples/create_dataset_double.cpp) +See [create_dataset_double.cpp](https://github.com/BlueBrain/HighFive/blob/master/src/examples/create_dataset_double.cpp) #### Write and read a matrix of double float (boost::ublas) to a 2D HDF5 dataset -See [boost_ublas_double.cpp](src/examples/boost_ublas_double.cpp) +See [boost_ublas_double.cpp](https://github.com/BlueBrain/HighFive/blob/master/src/examples/boost_ublas_double.cpp) #### Write and read a subset of a 2D double dataset -See [select_partial_dataset_cpp11.cpp](src/examples/select_partial_dataset_cpp11.cpp) +See [select_partial_dataset_cpp11.cpp](https://github.com/BlueBrain/HighFive/blob/master/src/examples/select_partial_dataset_cpp11.cpp) #### Create, write and list HDF5 attributes -See [create_attribute_string_integer.cpp](src/examples/create_attribute_string_integer.cpp) +See [create_attribute_string_integer.cpp](https://github.com/BlueBrain/HighFive/blob/master/src/examples/create_attribute_string_integer.cpp) #### And others -See [src/examples/](src/examples/) subdirectory for more info. - +See [src/examples/](https://github.com/BlueBrain/HighFive/blob/master/src/examples/) subdirectory for more info. -### Compiling with HighFive - -```bash -c++ -o program -I/path/to/highfive/include source.cpp -lhdf5 -``` ### H5Easy @@ -152,60 +150,98 @@ whereby the `int` type of this example can be replaced by any of the above types ## CMake integration +There's two common paths of integrating HighFive into a CMake based project. +The first is to "vendor" HighFive, the second is to install HighFive as a +normal C++ library. Due to how HighFive CMake code works, sometimes following +the third Bailout Approach is needed. -HighFive can easily be used by other C++ CMake projects. +### Vendoring HighFive -You may use HighFive from a folder in your project (typically a git submodule). +In this approach the HighFive sources are included in a subdirectory of the +project (typically as a git submodule), for example in `third_party/HighFive`. + +The projects `CMakeLists.txt` add the following lines ```cmake -cmake_minimum_required(VERSION 3.1 FATAL_ERROR) -project(foo) -set(CMAKE_CXX_STANDARD 11) +add_executable(foo foo.cpp) + +# You might want to turn off Boost support: +if(NOT DEFINED HIGHFIVE_USE_BOOST) + set(HIGHFIVE_USE_BOOST Off) +endif() -add_subdirectory(highfive_folder) -add_executable(bar bar.cpp) -target_link_libraries(bar HighFive) +# Include the subdirectory and use the target HighFive. +add_subdirectory(third_party/HighFive) +target_link_libraries(foo HighFive) ``` -Alternativelly you can install HighFive once and use it in several projects via `find_package()`. +**Note:** `add_subdirectory(third_party/HighFive)` will search and "link" HDF5 +and optional dependencies such as Boost. -A HighFive target will bring the compilation settings to find HighFive headers and all chosen dependencies. +### Regular Installation of HighFive +Alternatively you can install HighFive once and use it in several projects via +`find_package()`. First one should clone the sources: +```bash +git clone --recursive https://github.com/BlueBrain/HighFive.git HighFive-src +``` +By default CMake will install systemwide, which is likely not appropriate. The +instruction below allow users to select a custom path where HighFive will be +installed, e.g. `HIGHFIVE_INSTALL_PREFIX=${HOME}/third_party/HighFive` or some +other location. The CMake invocations would be +```bash +cmake -DHIGHFIVE_EXAMPLES=Off \ + -DHIGHFIVE_USE_BOOST=Off \ + -DHIGHFIVE_UNIT_TESTS=Off \ + -DCMAKE_INSTALL_PREFIX=${HIGHFIVE_INSTALL_PREFIX} \ + -B HighFive-src/build \ + HighFive-src + +cmake --build HighFive-src/build +cmake --install HighFive-src/build +``` +This will install (i.e. copy) the headers to +`${HIGHFIVE_INSTALL_PREFIX}/include` and some CMake files into an appropriate +subfolder of `${HIGHFIVE_INSTALL_PREFIX}`. + +The projects `CMakeLists.txt` should add the following: ```cmake # ... +add_executable(foo foo.cpp) + find_package(HighFive REQUIRED) -add_executable(bar bar.cpp) -target_link_libraries(bar HighFive) +target_link_libraries(foo HighFive) ``` -**Note:** Like with other libraries you may need to provide CMake the location to find highfive: `CMAKE_PREFIX_PATH=` -**Note:** `find_package(HighFive)` will search dependencies as well (e.g. Boost if requested). In order to use the same dependencies found at HighFive install time (e.g. for system deployments) you may set `HIGHFIVE_USE_INSTALL_DEPS=YES` +**Note:** If HighFive hasn't been installed in a default location, CMake needs +to be told where to find it which can be done by adding +`-DCMAKE_PREFIX_PATH=${HIGHFIVE_INSTALL_PREFIX}` to the CMake command for +building the project using HighFive. The variable `CMAKE_PREFIX_PATH` is a +semi-colon `;` separated list of directories. -### Installing -When installing via CMake, besides the headers, a HighFiveConfig.cmake is generated which provides the HighFive target, as seen before. Note: You may need to set `CMAKE_INSTALL_PREFIX`: -```bash -mkdir build && cd build -# Look up HighFive CMake options, consider inspecting with `ccmake` -cmake .. -DHIGHFIVE_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX="" -make install -``` +**Note:** `find_package(HighFive)` will search and "link" HDF5 and optional +dependencies such as Boost. -### Test Compilation -As a header-only library, HighFive doesn't require compilation. You may however build tests and examples. +### The Bailout Approach +Since both `add_subdirectory` and `find_package` will trigger finding HDF5 and +other optional dependencies of HighFive as well as the `target_link_libraries` +code for "linking" with the dependencies, things can go wrong. + +Fortunately, HighFive is a header only library and all that's needed is the +headers. Preferably, the version obtained by installing HighFive, since those +include `H5Version.hpp`. Let's assume they've been copied to +`third_party/HighFive`. Then one could create a target: ```bash -mkdir build && cd build -cmake ../ -make # build tests and examples -make test # build and run unit tests -``` +add_library(HighFive INTERFACE) +target_include_directory(HighFive INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/HighFive/include) -**Note:** Unit tests require Boost. In case it's unavailable you may use `-DHIGHFIVE_USE_BOOST=OFF`. -HighFive with disable support for Boost types as well as unit tests (though most examples will build). -### Code formatting -If you want to propose pull requests to this project, do not forget to format code with -clang-format version 12. -The .clang-format is at the root of the git repository. +add_executable(foo foo.cpp) +target_link_libraries(foo HighFive) +``` + +One known case where this is required is when vendoring the optional +dependencies of HighFive. # Questions? @@ -213,6 +249,8 @@ Do you have questions on how to use HighFive? Would you like to share an interes discuss HighFive features? Head over to the [Discussions](https://github.com/BlueBrain/HighFive/discussions) forum and join the community. +For bugs and issues please use [Issues](https://github.com/BlueBrain/HighFive/issues). + # Funding & Acknowledgment The development of this software was supported by funding to the Blue Brain Project, a research center of the École polytechnique fédérale de Lausanne (EPFL), from the Swiss government's ETH Board of the Swiss Federal Institutes of Technology. diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/codecov.yml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/codecov.yml new file mode 100644 index 0000000000..bfdc9877d9 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/codecov.yml @@ -0,0 +1,8 @@ +coverage: + status: + project: + default: + informational: true + patch: + default: + informational: true diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/CMakeLists.txt b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/CMakeLists.txt similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/CMakeLists.txt rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/CMakeLists.txt diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/Doxyfile b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/Doxyfile similarity index 99% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/Doxyfile rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/Doxyfile index 52638f15ca..6ebc393ec2 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/Doxyfile +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/Doxyfile @@ -865,7 +865,10 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = @CMAKE_CURRENT_SOURCE_DIR@/../include \ - @CMAKE_CURRENT_SOURCE_DIR@/mainpage.md + @CMAKE_CURRENT_SOURCE_DIR@/installation.md \ + @CMAKE_CURRENT_SOURCE_DIR@/developer_guide.md \ + @CMAKE_CURRENT_SOURCE_DIR@/../CHANGELOG.md \ + @CMAKE_CURRENT_SOURCE_DIR@/../README.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -1061,7 +1064,7 @@ FILTER_SOURCE_PATTERNS = # (index.html). This can be useful if you have a project on for instance GitHub # and want to reuse the introduction page also for the doxygen output. -USE_MDFILE_AS_MAINPAGE = +USE_MDFILE_AS_MAINPAGE = @CMAKE_CURRENT_SOURCE_DIR@/../README.md #--------------------------------------------------------------------------- # Configuration options related to source browsing @@ -2176,7 +2179,7 @@ ENABLE_PREPROCESSING = YES # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -MACRO_EXPANSION = NO +MACRO_EXPANSION = YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then # the macro expansion is limited to the macros specified with the PREDEFINED and @@ -2184,7 +2187,7 @@ MACRO_EXPANSION = NO # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_ONLY_PREDEF = NO +EXPAND_ONLY_PREDEF = YES # If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. @@ -2216,7 +2219,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = +PREDEFINED = H5_HAVE_PARALLEL H5_USE_EIGEN H5_USE_BOOST H5_USE_OPENCV H5_USE_XTENSOR H5_USE_HALF_FLOAT H5_DEPRECATED(x):= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/DoxygenLayout.xml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/DoxygenLayout.xml similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/DoxygenLayout.xml rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/DoxygenLayout.xml index 76c566b2d9..8fee2ee56a 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/DoxygenLayout.xml +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/DoxygenLayout.xml @@ -181,6 +181,7 @@ + @@ -205,7 +206,6 @@ - diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/developer_guide.md b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/developer_guide.md new file mode 100644 index 0000000000..3017289b51 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/developer_guide.md @@ -0,0 +1,93 @@ +# Developer Guide +First clone the repository and remember the `--recursive`: +```bash +git clone --recursive git@github.com:BlueBrain/HighFive.git +``` +The instructions to recover if you forgot are: +```bash +git submodule update --init --recursive +``` + +One remark on submodules: each HighFive commit expects that the submodules are +at a particular commit. The catch is that performing `git checkout` will not +update the submodules automatically. Hence, sometimes a `git submodule update +--recursive` might be needed to checkout the expected version of the +submodules. + +## Compiling and Running the Tests +The instructions for compiling with examples and unit-tests are: + +```bash +cmake -B build -DCMAKE_BUILD_TYPE={Debug,Release} . +cmake --build build --parallel +ctest --test-dir build +``` + +You might want to turn off Boost `-DHIGHFIVE_USE_BOOST=Off` or turn on other +optional dependencies. + +## Contributing +There's numerous HDF5 features that haven't been wrapped yet. HighFive is a +collaborative effort to slowly cover ever larger parts of the HDF5 library. +The process of contributing is to fork the repository and then create a PR. +Please ensure that any new API is appropriately documented and covered with +tests. + +### Code formatting +The project is formatted using clang-format version 12.0.1 and CI will complain +if a commit isn't formatted accordingly. The `.clang-format` is at the root of +the git repository. Conveniently, `clang-format` is available via `pip`: + +```bash +python -m venv venv +source venv/bin/activate + +pip install clang-format==12.0.1 +``` + +The changed lines can be formatted with `git-clang-format`, e.g. to format all lines changed compared to master: + +```bash +git-clang-format master +``` +(add `-f` to allow formatting unstaged changes if you trust it to not destroy +your changes.) + +## Releasing HighFive +Before releasing a new version perform the following: + +* Update `CHANGELOG.md` and `AUTHORS.txt` as required. +* Update `CMakeLists.txt` and `include/highfive/H5Version.hpp`. +* Follow semantic versioning when deciding the next version number. +* Check that + [HighFive-testing](https://github.com/BlueBrain/HighFive-testing/actions) ran + recently. + +At this point there should be a commit on master which will be the release +candidate. Don't tag it yet. + +Next step is to update the [HighFive/spack](https://github.com/BlueBrain/spack) +recipe such that the proposed version points to the release candidate using the +SHA of that commit. The recipe will look something like this: + +```python + # ... + + version("2.8.0", commit="094400f22145bcdcd2726ce72888d9d1c21e7068") + version("2.7.1", sha256="25b4c51a94d1e670dc93b9b73f51e79b65d8ff49bcd6e5d5582d5ecd2789a249") + version("2.7.0", sha256="8e05672ddf81a59ce014b1d065bd9a8c5034dbd91a5c2578e805ef880afa5907") + # ... +``` + +Push the changes to the BlueBrain spack repository. This will trigger building +all BBP dependencies of HighFive, i.e. another integration test. Don't actually +merge this commit yet. + +Now that we know that the integration test ran, and all BBP software can be +built with the proposed version of HighFive, we can proceed and create the +release. Once this is done perform a final round of updates: + +* Download the archive (`*.tar.gz`) and compute its SHA256. +* Update BlueBrain Spack recipe to use the archive and not the Git commit. +* Update the upstream Spack recipe. + diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/doxygen-awesome-css/doxygen-awesome.css b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/doxygen-awesome-css/doxygen-awesome.css similarity index 94% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/doxygen-awesome-css/doxygen-awesome.css rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/doxygen-awesome-css/doxygen-awesome.css index abd2893ccc..08238977a6 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/doxygen-awesome-css/doxygen-awesome.css +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/doxygen-awesome-css/doxygen-awesome.css @@ -5,7 +5,7 @@ https://github.com/jothepro/doxygen-awesome-css MIT License -Copyright (c) 2021 - 2022 jothepro +Copyright (c) 2021 - 2023 jothepro Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -160,7 +160,7 @@ html { --toc-background: var(--side-nav-background); --toc-foreground: var(--side-nav-foreground); - /* height of an item in any tree / collapsable table */ + /* height of an item in any tree / collapsible table */ --tree-item-height: 30px; --memname-font-size: var(--code-font-size); @@ -776,6 +776,8 @@ html.dark-mode iframe#MSearchResults { #side-nav { padding: 0 !important; background: var(--side-nav-background); + min-width: 8px; + max-width: 50vw; } @media screen and (max-width: 767px) { @@ -790,6 +792,7 @@ html.dark-mode iframe#MSearchResults { #nav-tree { background: transparent; + margin-right: 1px; } #nav-tree .label { @@ -862,8 +865,9 @@ html.dark-mode iframe#MSearchResults { } .ui-resizable-e { - background: var(--separator-color); - width: 1px; + width: 4px; + background: transparent; + box-shadow: inset -1px 0 0 0 var(--separator-color); } /* @@ -956,8 +960,9 @@ div.contents div.dyncontent { html:not(.light-mode) div.contents > table img, html:not(.light-mode) div.contents div.dyncontent iframe, html:not(.light-mode) div.contents center iframe, - html:not(.light-mode) div.contents table iframe { - filter: hue-rotate(180deg) invert(); + html:not(.light-mode) div.contents table iframe, + html:not(.light-mode) div.contents .dotgraph iframe { + filter: brightness(89%) hue-rotate(180deg) invert(); } } @@ -966,8 +971,10 @@ html.dark-mode div.contents center img, html.dark-mode div.contents > table img, html.dark-mode div.contents div.dyncontent iframe, html.dark-mode div.contents center iframe, -html.dark-mode div.contents table iframe { - filter: hue-rotate(180deg) invert(); +html.dark-mode div.contents table iframe, +html.dark-mode div.contents .dotgraph iframe + { + filter: brightness(89%) hue-rotate(180deg) invert(); } h2.groupheader { @@ -1056,6 +1063,21 @@ h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { color: var(--page-foreground-color); } +.dotgraph { + max-width: 100%; + overflow-x: scroll; +} + +.dotgraph .caption { + position: sticky; + left: 0; +} + +/* Wrap Graphviz graphs with the `interactive_dotgraph` class if `INTERACTIVE_SVG = YES` */ +.interactive_dotgraph .dotgraph iframe { + max-width: 100%; +} + /* Table of Contents */ @@ -1322,7 +1344,7 @@ dl.bug dt a, dl.deprecated dt a, dl.todo dt a { font-weight: bold !important; } -dl.warning, dl.attention, dl.note, dl.deprecated, dl.bug, dl.invariant, dl.pre, dl.todo, dl.remark { +dl.warning, dl.attention, dl.note, dl.deprecated, dl.bug, dl.invariant, dl.pre, dl.post, dl.todo, dl.remark { padding: var(--spacing-medium); margin: var(--spacing-medium) 0; color: var(--page-background-color); @@ -1393,13 +1415,13 @@ dl.section dd, dl.bug dd, dl.deprecated dd, dl.todo dd { margin-inline-start: 0px; } -dl.invariant, dl.pre { +dl.invariant, dl.pre, dl.post { background: var(--invariant-color); border-left: 8px solid var(--invariant-color-dark); color: var(--invariant-color-darker); } -dl.invariant dt, dl.pre dt { +dl.invariant dt, dl.pre dt, dl.post dt { color: var(--invariant-color-dark); } @@ -1603,6 +1625,10 @@ table.doxtable tbody { border-radius: var(--border-radius-small); } +table.markdownTable, table.doxtable, table.fieldtable { + padding: 1px; +} + table.doxtable caption { display: block; } @@ -1693,6 +1719,15 @@ table.markdownTable tr:last-child, table.doxtable tr:last-child { border-bottom: none; } +.full_width_table table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) { + display: block; +} + +.full_width_table table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody { + display: table; + width: 100%; +} + table.fieldtable th { font-size: var(--page-font-size); font-weight: 600; @@ -2195,7 +2230,9 @@ div.memproto::-webkit-scrollbar, .contents center::-webkit-scrollbar, .contents .center::-webkit-scrollbar, .contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar, -div.contents .toc::-webkit-scrollbar { +div.contents .toc::-webkit-scrollbar, +.contents .dotgraph::-webkit-scrollbar, +.contents .tabs-overview-container::-webkit-scrollbar { background: transparent; width: calc(var(--webkit-scrollbar-size) + var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); height: calc(var(--webkit-scrollbar-size) + var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); @@ -2208,7 +2245,9 @@ div.memproto::-webkit-scrollbar-thumb, .contents center::-webkit-scrollbar-thumb, .contents .center::-webkit-scrollbar-thumb, .contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar-thumb, -div.contents .toc::-webkit-scrollbar-thumb { +div.contents .toc::-webkit-scrollbar-thumb, +.contents .dotgraph::-webkit-scrollbar-thumb, +.contents .tabs-overview-container::-webkit-scrollbar-thumb { background-color: transparent; border: var(--webkit-scrollbar-padding) solid transparent; border-radius: calc(var(--webkit-scrollbar-padding) + var(--webkit-scrollbar-padding)); @@ -2222,7 +2261,9 @@ div.memproto:hover::-webkit-scrollbar-thumb, .contents center:hover::-webkit-scrollbar-thumb, .contents .center:hover::-webkit-scrollbar-thumb, .contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody:hover::-webkit-scrollbar-thumb, -div.contents .toc:hover::-webkit-scrollbar-thumb { +div.contents .toc:hover::-webkit-scrollbar-thumb, +.contents .dotgraph:hover::-webkit-scrollbar-thumb, +.contents .tabs-overview-container:hover::-webkit-scrollbar-thumb { background-color: var(--webkit-scrollbar-color); } @@ -2233,7 +2274,9 @@ div.memproto::-webkit-scrollbar-track, .contents center::-webkit-scrollbar-track, .contents .center::-webkit-scrollbar-track, .contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody::-webkit-scrollbar-track, -div.contents .toc::-webkit-scrollbar-track { +div.contents .toc::-webkit-scrollbar-track, +.contents .dotgraph::-webkit-scrollbar-track, +.contents .tabs-overview-container::-webkit-scrollbar-track { background: transparent; } @@ -2270,7 +2313,9 @@ div.memproto, .contents center, .contents .center, .contents table:not(.memberdecls):not(.mlabels):not(.fieldtable):not(.memname) tbody, -div.contents .toc { +div.contents .toc, +.contents .dotgraph, +.contents .tabs-overview-container { scrollbar-width: thin; } @@ -2403,3 +2448,83 @@ a.anchorlink:hover { h2:hover a.anchorlink, h1:hover a.anchorlink, h3:hover a.anchorlink, h4:hover a.anchorlink { display: inline-block; } + +/* + Optional tab feature +*/ + +.tabbed { + margin: var(--spacing-medium) auto; +} + +.tabbed ul { + padding-inline-start: 0px; + margin: 0; + padding: var(--spacing-small) 0; + border-bottom: 1px solid var(--separator-color); +} + +.tabbed li { + display: none; +} + +.tabbed li.selected { + display: block; +} + +.tabs-overview-container { + overflow-x: auto; + display: block; + overflow-y: visible; +} + +.tabs-overview { + border-bottom: 1px solid var(--separator-color); + display: flex; + flex-direction: row; +} + +.tabs-overview button.tab-button { + color: var(--page-foreground-color); + margin: 0; + border: none; + background: transparent; + padding: var(--spacing-small) 0; + display: inline-block; + font-size: var(--page-font-size); + cursor: pointer; + box-shadow: 0 1px 0 0 var(--separator-color); + position: relative; +} + +.tabs-overview button.tab-button .tab-title { + float: left; + white-space: nowrap; + padding: var(--spacing-small) var(--spacing-large); + border-radius: var(--border-radius-medium); +} + +.tabs-overview button.tab-button:not(:last-child) .tab-title { + box-shadow: 8px 0 0 -7px var(--separator-color); +} + +.tabs-overview button.tab-button:hover .tab-title { + background: var(--separator-color); + box-shadow: none; +} + +.tabs-overview button.tab-button.active { + color: var(--primary-color); +} + +.tabs-overview button.tab-button.active::after { + content: ''; + display: block; + position: absolute; + left: 0px; + bottom: 0; + right: 0px; + height: 3px; + border-radius: var(--border-radius-small) var(--border-radius-small) 0 0; + background-color: var(--primary-color); +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/doxygen-awesome-css/update_doxygen_awesome.sh b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/doxygen-awesome-css/update_doxygen_awesome.sh similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/doxygen-awesome-css/update_doxygen_awesome.sh rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/doxygen-awesome-css/update_doxygen_awesome.sh diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/environment.yaml b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/environment.yaml similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/environment.yaml rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/environment.yaml diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/installation.md b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/installation.md new file mode 100644 index 0000000000..41521bba5e --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/installation.md @@ -0,0 +1,254 @@ +# Beginners Installation Guide on Linux + +These installation instruction are aimed at developers that aren't very +familiar with installing C/C++ software and using CMake on Linux. + +## Obtaining CMake +You'll need a compiler and CMake. We'll assume that a reasonably modern C++ +compiler is available. Often a sufficiently new version CMake is also present +on the system. + +If not, there's two options: use the system package manager or use `pip`. CMake +is improving in leaps and bounds. Which means you want a recent version. We +suggest reconsidering fighting an older version of CMake if you can simply +install the newest version via `pip`. + +## Obtaining HDF5 +First, you need to decide if you need MPI-support. Rule of thumb is: if you're +unsure, then you don't need it. If you need MPI you must install an +MPI-enabled version of HDF5. Otherwise pick either one, if something is already +installed, e.g. because `h5py` was installed as a system package, stick with +that version. + +The options for installing HDF5 are: +1. Use the system package manager. +2. On a cluster use modules. +3. Use [Spack](https://github.com/spack/spack). +4. Use [Conan](https://conan.io). +5. Manually install it. + +The system package manager will install HDF5 in a default location, were CMake +will later be able to find it without further help. All the other approaches +install into a non-default location and CMake might need help locating HDF5. +The way one tells CMake where to find HDF5 is through `CMAKE_PREFIX_PATH`, +e.g., + + cmake -DCMAKE_PREFIX_PATH="${HDF5_ROOT}" ... + +Note that `${HDF5_ROOT}` points to the folder which contains the two folders +`include` and `lib`. + +### System Package Manager +The default choice is to use the system package manager to install HDF5. +One thing to keep an eye out is that certain Linux distributions don't install +the headers automatically. Since you're about to develop an application which +(indirectly) uses HDF5, you need those headers. If the packages are split, the +development package is often suffixed with `-dev` or `-devel`. + +#### Ubuntu +The package manager is apt. To install the HDF5 C library without MPI support: + + sudo apt-get install libhdf5-dev + +for MPI support you'd install `libhdf5-openmpi-dev`. + +#### ArchLinux +On ArchLinux you install + + sudo pacman -S hdf5 + +or `hdf5-openmpi` for HDF5 with OpenMPI support. + + +### Using Modules +If you're on a cluster, HDF5 has almost certainly been installed for you. +Figure out how to use it. This is the preferred solution on clusters. As +always, the precise instructions depend on the cluster, but something like + + module load hdf5 + +will probably be part of the solution. Try if `module avail` helps. Otherwise, +you'd need to check the documentation for your cluster. Cluster admins like to +hide the good stuff, i.e. modern versions, behind another package `"new"` or +some other mechanism. + +You might need to know where HDF5 has been installed. You can find out what a +module does by typing + + module show hdf5 + +If it contains something about prepending to `CMAKE_PREFIX_PATH`, then CMake +should find the correct version automatically after loading the module. + +### Using Spack +If neither of the above work, the next best choice might be Spack. It's a +package manager for scientific computing. The general idea behind it is to +avoid dependency issues by compiling a compatible set of everything. + +Obtain Spack by cloning their repo: + + git clone https://github.com/spack/spack.git + +Activate Spack by sourcing a magic file: + + source spack/share/spack/setup-env.sh + +which will put the command `spack` into your `PATH`. Okay, now we're set. First +step is to create an environment for your project, which we'll call `useful`: + + spack env create useful + spack env activate -p useful + spack add hdf5 + spack install --jobs NPROC + +If you need MPI support use `hdf5+mpi` instead. The location of the HDF5 +installation is `spack location --install-dir hdf5`. + +### Conan +If Spack doesn't work, you can try Conan. + +### Manually Install HDF5 +If all else fails, you can try to manually install HDF5. First you need to +obtain the source code. For example by using `git` or by downloading an archive +from their webpage. + + git clone https://github.com/HDFGroup/hdf5 + cd hdf5 + git checkout hdf5-1_14_0 + +Now, fingers crossed it'll compile and install: + + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../hdf5-v1.14.0 -B build . + cmake --build build --parallel [NPROC] + cmake --install build + +Note that here we picked the installation path (or more precisely prefix) to be +`../hdf5-v1.14.0`. You might want to install HDF5 somewhere else. This +installation prefix is the also the path you need to give CMake so it's able to +find HDF5 later on. + +### Confirming HDF5 Has Been Installed +For this purpose we need a dummy file `dummy.cpp` to compile: + + #include + + int main() { + auto file = H5Fcreate("foo.h5", H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT); + H5Fclose(file); + return 0; + } + +and a `CMakeLists.txt` with the following contents + + cmake_minimum_required(VERSION 3.19) + project(Dummy) + + find_package(HDF5 REQUIRED) + add_executable(dummy dummy.cpp) + target_link_libraries(dummy HDF5::HDF5) + +Now run CMake to configure the build system and keep an eye out for some a line +related to HDF5, e.g. + + $ cmake -B build . + ... + -- Found HDF5: hdf5-shared (found version "1.14.0") + ... + +Compile and check that it's doing something with sensible + + $ cmake -build build --verbose + [ 50%] Building CXX object CMakeFiles/dummy.dir/dummy.cpp.o + /usr/bin/c++ ... -isystem ${HDF5_ROOT}/include ... -c ${PWD}/dummy.cpp + [100%] Linking CXX executable dummy + /usr/bin/c++ ... -o dummy -Wl,-rpath,${HDF5_ROOT}/lib ${HDF5_ROOT}/lib/libhdf5.so.310.0.0 ... + +mostly you're checking that the paths are what you'd expect them to be. If +this command was successful, chances are high that HDF5 is properly installed +and you've figured out the correct CMake invocations. If you want you can run +the executable: + + build/dummy + +which would create an empty file `foo.h5`. + +## Obtaining HighFive + +In principle the same instruction as for HDF5 can be used. However, HighFive is +much less popular compared to HDF5 and therefore the system package manager +likely doesn't know about it, nor does Conan. You're left with Spack and the +manual process. It seems someone has done the wonderful work of adding HighFive +to conda-forge, so maybe that's also an option. + +### Git Submodules +This is the well-tested method for "vendoring" HighFive, i.e. including the +HighFive sources with those of you project. + +### Spack +Similarly as for HDF5, you can use Spack to install HighFive: + + spack env activate -p useful + spack add highfive + spack install --jobs NPROC + +Again `spack location --install-dir highfive` will return the path where +HighFive was installed. Since the Spack recipe of HighFive declares HDF5 as a +dependency, technically, it's not necessary to add `hdf5`, just `highfive` is +enough. + +### Manually Install HighFive +Just like before the steps are, clone, configure, compile (kinda a no-op), +install. The detailed instructions would be + + git clone --recursive https://github.com/BlueBrain/HighFive.git + cd HighFive + git checkout v2.8.0 + +If it complains that Catch is missing, you forgot the `--recursive`. To fix +this you type + + git submodule update --init --recursive + +Okay, on to configure, compile and install. The CMake commands are + + cmake -DCMAKE_INSTALL_PREFIX=../highfive-v2.7.1 -DHIGHFIVE_USE_BOOST=Off -B build . + cmake --build build --parallel + cmake --install build + +### Confirming It Works +We again need a dummy file called `dummy.cpp` with the following contents + + #include + + int main() { + auto file = HighFive::File("foo.h5", HighFive::File::Create); + return 0; + } + +and the following `CMakeLists.txt`: + + cmake_minimum_required(VERSION 3.19) + project(UseHighFive) + + find_package(HighFive REQUIRED) + add_executable(dummy dummy.cpp) + target_link_libraries(dummy HighFive) + +The required CMake commands are: + + $ cmake -DCMAKE_PREFIX_PATH="${HDF5_ROOT};${HIGHFIVE_ROOT}" -B build . + ... + -- HIGHFIVE 2.7.1: (Re)Detecting Highfive dependencies (HIGHFIVE_USE_INSTALL_DEPS=NO) + -- Found HDF5: hdf5-shared (found version "1.14.0") + ... + + $ cmake --build build --verbose + [ 50%] Building CXX object CMakeFiles/dummy.dir/dummy.cpp.o + /usr/bin/c++ ... -isystem ${HIGHFIVE_ROOT}/include -isystem ${HDF5_ROOT}/include ... -c dummy.cpp + [100%] Linking CXX executable dummy + /usr/bin/c++ ... -o dummy -Wl,-rpath,${HDF5_ROOT}/lib ${HDF5_ROOT}/lib/libhdf5.so.310.0.0 ... + +Pay attention to the semi-colon (not colon like the rest of Linux) used to +separate directories in `CMAKE_PREFIX_PATH`. If this worked you should be set +to either copy the instruction to your "real" project, or start developing the +rest of your project. diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example1_hdf5.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example1_hdf5.cpp similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example1_hdf5.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example1_hdf5.cpp diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example1_highfive.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example1_highfive.cpp similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example1_highfive.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example1_highfive.cpp diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example3.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example3.cpp similarity index 95% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example3.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example3.cpp index 64f2ed6be7..e18fbbf83e 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example3.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example3.cpp @@ -1,4 +1,4 @@ -#include +#include typedef struct { diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example6.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example6.cpp similarity index 93% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example6.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example6.cpp index 8f7419f23f..41a0505705 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example6.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example6.cpp @@ -2,9 +2,7 @@ #include -#include -#include -#include +#include int main(int argc, char** argv) { diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_boost.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_boost.cpp similarity index 85% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_boost.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_boost.cpp index aceaa20681..56b78d074e 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_boost.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_boost.cpp @@ -1,11 +1,9 @@ #include #define H5_USE_BOOST 1 +#include #include -#include -#include -#include using complex_t = std::complex; diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_boost_ublas.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_boost_ublas.cpp similarity index 97% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_boost_ublas.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_boost_ublas.cpp index 3a2b4c73a5..986a671de5 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_boost_ublas.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_boost_ublas.cpp @@ -1,6 +1,7 @@ #include #define H5_USE_BOOST 1 +#include // In some versions of Boost (starting with 1.64), you have to // include the serialization header before ublas @@ -8,7 +9,6 @@ #include #include -#include using namespace HighFive; diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_easy_h5py.py b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_easy_h5py.py similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_easy_h5py.py rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_easy_h5py.py diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_easy_highfive.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_easy_highfive.cpp similarity index 99% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_easy_highfive.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_easy_highfive.cpp index 07d37a22c5..700056cae9 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_easy_highfive.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_easy_highfive.cpp @@ -1,4 +1,5 @@ #include + #include int main() { diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_props.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_props.cpp similarity index 94% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_props.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_props.cpp index e46fe119ce..0e5b14bde7 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/example_props.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/example_props.cpp @@ -1,4 +1,4 @@ -#include +#include using namespace HighFive; diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/examples.js b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/examples.js similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/examples.js rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/examples.js diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/godbolt.org.ico b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/godbolt.org.ico similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/godbolt.org.ico rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/godbolt.org.ico diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/index.html b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/index.html similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/doc/poster/index.html rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/doc/poster/index.html diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Attribute.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Attribute.hpp new file mode 100644 index 0000000000..810d388ae8 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Attribute.hpp @@ -0,0 +1,266 @@ +/* + * Copyright (c), 2017, Ali Can Demiralp + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#pragma once + +#include + +#include + +#include "H5DataType.hpp" +#include "H5Object.hpp" +#include "bits/H5Friends.hpp" +#include "bits/H5Path_traits.hpp" + +namespace HighFive { +class DataSpace; + +namespace detail { + +/// \brief Internal hack to create an `Attribute` from an ID. +/// +/// WARNING: Creating an Attribute from an ID has implications w.r.t. the lifetime of the object +/// that got passed via its ID. Using this method careless opens up the suite of issues +/// related to C-style resource management, including the analog of double free, dangling +/// pointers, etc. +/// +/// NOTE: This is not part of the API and only serves to work around a compiler issue in GCC which +/// prevents us from using `friend`s instead. This function should only be used for internal +/// purposes. The problematic construct is: +/// +/// template +/// friend class SomeCRTP; +/// +/// \private +Attribute make_attribute(hid_t hid); +} // namespace detail + +/// \brief Class representing an Attribute of a DataSet or Group +/// +/// \sa AnnotateTraits::createAttribute, AnnotateTraits::getAttribute, AnnotateTraits::listAttributeNames, AnnotateTraits::hasAttribute, AnnotateTraits::deleteAttribute for create, get, list, check or delete Attribute +class Attribute: public Object, public PathTraits { + public: + const static ObjectType type = ObjectType::Attribute; + + /// \brief Get the name of the current Attribute. + /// \code{.cpp} + /// auto attr = dset.createAttribute("my_attribute", DataSpace::From(string_list)); + /// std::cout << attr.getName() << std::endl; // Will print "my_attribute" + /// \endcode + /// \since 2.2.2 + std::string getName() const; + + /// \brief The number of bytes required to store the attribute in the HDF5 file. + /// \code{.cpp} + /// size_t size = dset.createAttribute("foo", DataSpace(1, 2)).getStorageSize(); + /// \endcode + /// \since 1.0 + size_t getStorageSize() const; + + /// \brief Get the DataType of the Attribute. + /// \code{.cpp} + /// Attribute attr = dset.createAttribute("foo", DataSpace(1, 2)); + /// auto dtype = attr.getDataType(); // Will be an hdf5 type deduced from int + /// \endcode + /// \since 1.0 + DataType getDataType() const; + + /// \brief Get the DataSpace of the current Attribute. + /// \code{.cpp} + /// Attribute attr = dset.createAttribute("foo", DataSpace(1, 2)); + /// auto dspace = attr.getSpace(); // This will be a DataSpace of dimension 1 * 2 + /// \endcode + /// \since 1.0 + DataSpace getSpace() const; + + /// \brief Get the DataSpace of the current Attribute. + /// \note This is an alias of getSpace(). + /// \since 1.0 + DataSpace getMemSpace() const; + + /// \brief Get the value of the Attribute. + /// \code{.cpp} + /// Attribute attr = dset.getAttribute("foo"); + /// // The value will contains what have been written in the attribute + /// std::vector value = attr.read>(); + /// \endcode + /// \since 2.5.0 + template + T read() const; + + /// \brief Get the value of the Attribute in a buffer. + /// + /// Read the attribute into an existing object. Only available for + /// supported types `T`. If `array` has preallocated the correct amount of + /// memory, then this routine should not trigger reallocation. Otherwise, + /// if supported, the object will be resized. + /// + /// An exception is raised if the numbers of dimension of the buffer and of + /// the attribute are different. + /// + /// \code{.cpp} + /// // Will read into `value` avoiding memory allocation if the dimensions + /// // match, i.e. if the attribute `"foo"` has three element. + /// std::vector value(3); + /// file.getAttribute("foo").read(value); + /// \endcode + /// \since 1.0 + template + void read(T& array) const; + + /// \brief Read the attribute into a pre-allocated buffer. + /// \param array A pointer to the first byte of sufficient pre-allocated memory. + /// \param mem_datatype The DataType of the array. + /// + /// \note This is the shallowest wrapper around `H5Aread`. If possible + /// prefer either Attribute::read() const or Attribute::read(T&) const. + /// + /// \code{.cpp} + /// auto attr = file.getAttribute("foo"); + /// + /// // Simulate custom allocation by the application. + /// size_t n_elements = attr.getSpace().getElementCount(); + /// int * ptr = (int*) malloc(n_elements*sizeof(int)); + /// + /// // Read into the pre-allocated memory. + /// attr.read(ptr, mem_datatype); + /// \endcode + /// \since 2.2.2 + template + void read(T* array, const DataType& mem_datatype) const; + + /// \brief Read the attribute into a buffer. + /// Behaves like Attribute::read(T*, const DataType&) const but + /// additionally this overload deduces the memory datatype from `T`. + /// + /// \param array Pointer to the first byte of pre-allocated memory. + /// + /// \note If possible prefer either Attribute::read() const or Attribute::read(T&) const. + /// + /// \code{.cpp} + /// auto attr = file.getAttribute("foo"); + /// + /// // Simulate custom allocation by the application. + /// size_t n_elements = attr.getSpace().getElementCount(); + /// int * ptr = (int*) malloc(n_elements*sizeof(int)); + /// + /// // Read into the pre-allocated memory. + /// attr.read(ptr); + /// \endcode + /// \since 2.2.2 + template + void read(T* array) const; + + /// \brief Write the value into the Attribute. + /// + /// Write the value to the attribute. For supported types `T`, this overload + /// will write the value to the attribute. The datatype and dataspace are + /// deduced automatically. However, since the attribute has already been + /// created, the dimensions of `value` must match those of the attribute. + /// + /// \code{.cpp} + /// // Prefer the fused version if creating and writing the attribute + /// // at the same time. + /// dset.createAttribute("foo", std::vector{1, 2, 3}); + /// + /// // To overwrite the value: + /// std::vector value{4, 5, 6}; + /// dset.getAttribute("foo").write(value); + /// \endcode + /// \since 1.0 + template + void write(const T& value); + + /// \brief Write from a raw pointer. + /// + /// Values that have been correctly arranged memory, can be written directly + /// by passing a raw pointer. + /// + /// \param buffer Pointer to the first byte of the value. + /// \param mem_datatype The DataType of the buffer. + /// + /// \note This is the shallowest wrapper around `H5Awrite`. It's useful + /// if you need full control. If possible prefer Attribute::write. + /// + /// \code{.cpp} + /// Attribute attr = dset.createAttribute("foo", DataSpace(2, 3)); + /// + /// // Simulate the application creating `value` and only exposing access + /// // to the raw pointer `ptr`. + /// std::vector> value{{1, 2, 3}, {4, 5, 6}}; + /// int * ptr = (int*) value.data(); + /// + /// // Simply write the bytes to disk. + /// attr.write(ptr, AtomicType()); + /// \endcode + /// \since 2.2.2 + template + void write_raw(const T* buffer, const DataType& mem_datatype); + + /// \brief Write from a raw pointer. + /// + /// Much like Attribute::write_raw(const T*, const DataType&). + /// Additionally, this overload attempts to automatically deduce the + /// datatype of the buffer. Note, that the file datatype is already set. + /// + /// \param buffer Pointer to the first byte. + /// + /// \note If possible prefer Attribute::write. + /// + /// \code{.cpp} + /// // Simulate the application creating `value` and only exposing access + /// // to the raw pointer `ptr`. + /// std::vector> value{{1, 2, 3}, {4, 5, 6}}; + /// int * ptr = (int*) value.data(); + /// + /// // Simply write the bytes to disk. + /// attr.write(ptr); + /// \endcode + /// \since 2.2.2 + template + void write_raw(const T* buffer); + + /// \brief The create property list used for this attribute. + /// + /// Some of HDF5 properties/setting of an attribute are defined by a + /// create property list. This method returns a copy of the create + /// property list used during creation of the attribute. + /// + /// \code{.cpp} + /// auto acpl = attr.getCreatePropertyList(); + /// + /// // For example to create another attribute with the same properties. + /// file.createAttribute("foo", 42, acpl); + /// \endcode + /// \since 2.5.0 + AttributeCreateProps getCreatePropertyList() const { + return details::get_plist(*this, H5Aget_create_plist); + } + + // No empty attributes + Attribute() = delete; + + protected: + using Object::Object; + + private: +#if HIGHFIVE_HAS_FRIEND_DECLARATIONS + template + friend class ::HighFive::AnnotateTraits; +#endif + + friend Attribute detail::make_attribute(hid_t); +}; + +namespace detail { +inline Attribute make_attribute(hid_t hid) { + return Attribute(hid); +} +} // namespace detail + +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5DataSet.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5DataSet.hpp similarity index 97% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5DataSet.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5DataSet.hpp index a98feb4b95..0236f06c23 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5DataSet.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5DataSet.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATASET_HPP -#define H5DATASET_HPP +#pragma once #include @@ -99,6 +98,7 @@ class DataSet: public Object, return details::get_plist(*this, H5Dget_access_plist); } + /// \deprecated Default constructor creates unsafe uninitialized objects H5_DEPRECATED("Default constructor creates unsafe uninitialized objects") DataSet() = default; @@ -114,5 +114,3 @@ class DataSet: public Object, }; } // namespace HighFive - -#endif // H5DATASET_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5DataSpace.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5DataSpace.hpp new file mode 100644 index 0000000000..95d04dbbbd --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5DataSpace.hpp @@ -0,0 +1,243 @@ +/* + * Copyright (c), 2017, Adrien Devresse + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#pragma once + +#include +#include +#include +#include +#include + +#include "H5Object.hpp" +#include "bits/H5_definitions.hpp" + +namespace HighFive { + +/// \brief Class representing the space (dimensions) of a DataSet +/// +/// \code{.cpp} +/// // Create a DataSpace of dimension 1 x 2 x 3 +/// DataSpace dspace(1, 2, 3); +/// std::cout << dspace.getElementCount() << std::endl; // Print 1 * 2 * 3 = 6 +/// std::cout << dspace.getNumberDimensions() << std::endl; // Print 3 +/// std::vector dims = dspace.getDimensions(); // dims is {1, 2, 3} +/// \endcode +class DataSpace: public Object { + public: + const static ObjectType type = ObjectType::DataSpace; + + /// \brief Magic value to specify that a DataSpace can grow without limit. + /// + /// This value should be used with DataSpace::DataSpace(const std::vector& dims, const + /// std::vector& maxdims); + /// + /// \since 2.0 + static const size_t UNLIMITED = SIZE_MAX; + + /// \brief An enum to create scalar and null DataSpace with DataSpace::DataSpace(DataspaceType dtype). + /// + /// This enum is needed otherwise we will not be able to distringuish between both with normal + /// constructors. Both have a dimension of 0. + /// \since 1.3 + enum DataspaceType { + dataspace_scalar, ///< Value to create scalar DataSpace + dataspace_null, ///< Value to create null DataSpace + // simple dataspace are handle directly from their dimensions + }; + + /// \brief Create a DataSpace of N-dimensions from a std::vector. + /// \param dims Dimensions of the new DataSpace + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3 + /// DataSpace(std::vector{1, 3}); + /// \endcode + /// \since 1.0 + explicit DataSpace(const std::vector& dims); + + /// \brief Create a DataSpace of N-dimensions from a std::array. + /// \param dims Dimensions of the new DataSpace + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3 + /// DataSpace(std::array{1, 3}); + /// \endcode + /// \since 2.3 + template + explicit DataSpace(const std::array& dims); + + /// \brief Create a DataSpace of N-dimensions from an initializer list. + /// \param dims Dimensions of the new DataSpace + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3 + /// DataSpace{1, 3}; + /// \endcode + /// \since 2.1 + DataSpace(const std::initializer_list& dims); + + /// \brief Create a DataSpace of N-dimensions from direct values. + /// \param dim1 The first dimension + /// \param dims The following dimensions + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3 + /// DataSpace(1, 3); + /// \endcode + /// \since 2.1 + template + explicit DataSpace(size_t dim1, Args... dims); + + /// \brief Create a DataSpace from a pair of iterators. + /// \param begin The beginning of the container + /// \param end The end of the container + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3 + /// std::vector v{1, 3}; + /// DataSpace(v.begin(), v.end()); + /// \endcode + /// + /// \since 2.0 + // Attention: Explicitly disable DataSpace(int_like, int_like) from trying + // to use this constructor + template ::value, IT>::type> + DataSpace(const IT begin, const IT end); + + /// \brief Create a resizable N-dimensional DataSpace. + /// \param dims Initial size of dataspace + /// \param maxdims Maximum size of the dataspace + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3. + /// // It can later be resized up to a maximum of 10 x 10 + /// DataSpace(std::vector{1, 3}, std::vector{10, 10}); + /// \endcode + /// + /// \see UNLIMITED for a DataSpace that can be resized without limit. + /// \since 2.0 + explicit DataSpace(const std::vector& dims, const std::vector& maxdims); + + /// \brief Create a scalar or a null DataSpace. + /// + /// This overload enables creating scalar or null data spaces, both have + /// dimension 0. + /// + /// \param space_type The value from the enum + /// + /// \code{.cpp} + /// DataSpace(DataspaceType::dataspace_scalar); + /// \endcode + /// + /// \attention Avoid braced intialization in these cases, i.e. + /// \code{.cpp} + /// // This is not a scalar dataset: + /// DataSpace{DataspaceType::dataspace_scalar}; + /// \endcode + /// + /// \since 1.3 + explicit DataSpace(DataspaceType space_type); + + /// \brief Create a copy of the DataSpace which will have different id. + /// + /// \code{.cpp} + /// DataSpace dspace1(1, 3); + /// auto dspace2 = dspace.clone(); + /// \endcode + /// + /// \since 1.0 + DataSpace clone() const; + + /// \brief Returns the number of dimensions of a DataSpace. + /// \code{.cpp} + /// DataSpace dspace(1, 3); + /// size_t number_of_dim = dspace.getNumberDimensions(); // returns 2 + /// \endcode + /// \since 1.0 + size_t getNumberDimensions() const; + + /// \brief Returns the size of the dataset in each dimension. + /// + /// For zero-dimensional datasets (e.g. scalar or null datasets) an empty + /// vector is returned. + /// + /// \code{.cpp} + /// DataSpace dspace(1, 3); + /// auto dims = dspace.getDimensions(); // returns {1, 3} + /// \endcode + /// + /// \sa DataSpace::getMaxDimensions + /// + /// \since 1.0 + std::vector getDimensions() const; + + /// \brief Return the number of elements in this DataSpace. + /// + /// \code{.cpp} + /// DataSpace dspace(1, 3); + /// size_t elementcount = dspace.getElementCount(); // return 1 x 3 = 3 + /// \endcode + /// \since 2.1 + size_t getElementCount() const; + + /// \brief Returns the maximum size of the dataset in each dimension. + /// + /// This is the maximum size a dataset can be extended to, which may be + /// different from the current size of the dataset. + /// + /// \code{.cpp} + /// DataSpace dspace(std::vector{1, 3}, std::vector{UNLIMITED, 10}); + /// dspace.getMaxDimensions(); // Return {UNLIMITED, 10} + /// \endcode + /// + /// \sa DataSpace::getDimensions + /// \since 2.0 + std::vector getMaxDimensions() const; + + /// \brief Automatically deduce the DataSpace from a container/value. + /// + /// Certain containers and scalar values are fully supported by HighFive. + /// For these containers, HighFive can deduce the dimensions from `value`. + /// + /// \code{.cpp} + /// double d = 42.0; + /// std::vector> v = {{4, 5, 6}, {7, 8, 9}}; + /// DataSpace::From(v); // A DataSpace of dimensions 2, 3. + /// DataSpace::From(d); // A scalar dataspace. + /// \endcode + /// + /// \since 1.0 + template + static DataSpace From(const T& value); + + /// \brief Create a DataSpace from a value of type string array. + /// \param string_array An C-array of C-string (null-terminated). + /// + /// \code{.cpp} + /// char string_array[2][10] = {"123456789", "abcdefghi"}; + /// auto dspace = DataSpace::FromCharArrayStrings(string_array); // dspace is a DataSpace of + /// dimensions 2 + /// \endcode + /// \since 2.2 + template + static DataSpace FromCharArrayStrings(const char (&string_array)[N][Width]); + + protected: + DataSpace() = default; + + friend class Attribute; + friend class File; + friend class DataSet; +}; + +} // namespace HighFive + +// We include bits right away since DataSpace is user-constructible +#include "bits/H5Dataspace_misc.hpp" diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5DataType.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5DataType.hpp similarity index 78% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5DataType.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5DataType.hpp index c1b42d6318..886107961b 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5DataType.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5DataType.hpp @@ -6,15 +6,17 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATATYPE_HPP -#define H5DATATYPE_HPP +#pragma once #include #include +#include + #include "H5Object.hpp" #include "bits/H5Utils.hpp" +#include "bits/string_padding.hpp" #include "H5PropertyList.hpp" namespace HighFive { @@ -48,6 +50,7 @@ inline DataTypeClass operator&(DataTypeClass lhs, DataTypeClass rhs) { return static_cast(static_cast(lhs) & static_cast(rhs)); } +class StringType; /// /// \brief HDF5 Data Type @@ -86,6 +89,11 @@ class DataType: public Object { /// bool isFixedLenStr() const; + /// + /// \brief Returns this datatype as a `StringType`. + /// + StringType asStringType() const; + /// /// \brief Check the DataType was default constructed. /// Such value might represent auto-detection of the datatype from a buffer @@ -107,8 +115,67 @@ class DataType: public Object { friend class File; friend class DataSet; friend class CompoundType; + template + friend class NodeTraits; +}; + + +enum class CharacterSet : std::underlying_type::type { + Ascii = H5T_CSET_ASCII, + Utf8 = H5T_CSET_UTF8, +}; + +class StringType: public DataType { + public: + /// + /// \brief For stings return the character set. + /// + CharacterSet getCharacterSet() const; + + /// + /// \brief For fixed length stings return the padding. + /// + StringPadding getPadding() const; + + protected: + using DataType::DataType; + friend class DataType; }; +class FixedLengthStringType: public StringType { + public: + /// + /// \brief Create a fixed length string datatype. + /// + /// The string will be `size` bytes long, regardless whether it's ASCII or + /// UTF8. In particular, a string with `n` UFT8 characters in general + /// requires `4*n` bytes. + /// + /// The string padding is subtle, essentially it's just a hint. A + /// nullterminated string is guaranteed to have one `'\0'` which marks the + /// semantic end of the string. The length of the buffer must be at least + /// `size` bytes regardless. HDF5 will read or write `size` bytes, + /// irrespective of the when the `\0` occurs. + /// + /// Note that when writing passing `StringPadding::NullTerminated` is a + /// guarantee to the reader that it contains a `\0`. Therefore, make sure + /// that the string really is nullterminated. Otherwise prefer a + /// null-padded string which only means states that the buffer is filled up + /// with 0 or more `\0`. + FixedLengthStringType(size_t size, + StringPadding padding, + CharacterSet character_set = CharacterSet::Ascii); +}; + +class VariableLengthStringType: public StringType { + public: + /// + /// \brief Create a variable length string HDF5 datatype. + /// + VariableLengthStringType(CharacterSet character_set = CharacterSet::Ascii); +}; + + /// /// \brief create an HDF5 DataType from a C++ type /// @@ -176,11 +243,14 @@ class CompoundType: public DataType { size_t n_members = static_cast(result); members.reserve(n_members); for (unsigned i = 0; i < n_members; i++) { - const char* name = H5Tget_member_name(_hid, i); + char* name = H5Tget_member_name(_hid, i); size_t offset = H5Tget_member_offset(_hid, i); hid_t member_hid = H5Tget_member_type(_hid, i); DataType member_type{member_hid}; - members.emplace_back(name, member_type, offset); + members.emplace_back(std::string(name), member_type, offset); + if (H5free_memory(name) < 0) { + throw DataTypeException("Could not free names from the compound datatype"); + } } } @@ -251,7 +321,7 @@ class EnumType: public DataType { } EnumType(std::initializer_list t_members) - : EnumType(std::vector({t_members})) {} + : EnumType(std::vector(t_members)) {} /// \brief Commit datatype into the given Object /// \param object Location to commit object into @@ -281,15 +351,20 @@ DataType create_and_check_datatype(); /// Although fixed-len arrays can be created 'raw' without the need for /// this structure, to retrieve results efficiently it must be used. /// +/// \tparam N Size of the string in bytes, including the null character. Note, +/// that all string must be null-terminated. +/// template class FixedLenStringArray { public: FixedLenStringArray() = default; /// - /// \brief Create a FixedStringArray from a raw contiguous buffer + /// \brief Create a FixedStringArray from a raw contiguous buffer. /// - FixedLenStringArray(const char array[][N], std::size_t length); + /// The argument `n_strings` specifies the number of strings. + /// + FixedLenStringArray(const char array[][N], std::size_t n_strings); /// /// \brief Create a FixedStringArray from a sequence of strings. @@ -404,12 +479,10 @@ class FixedLenStringArray { /// } /// HIGHFIVE_REGISTER_TYPE(FooBar, create_enum_foobar) /// \endcode -#define HIGHFIVE_REGISTER_TYPE(type, function) \ - template <> \ - HighFive::DataType HighFive::create_datatype() { \ - return function(); \ +#define HIGHFIVE_REGISTER_TYPE(type, function) \ + template <> \ + inline HighFive::DataType HighFive::create_datatype() { \ + return function(); \ } #include "bits/H5DataType_misc.hpp" - -#endif // H5DATATYPE_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Easy.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Easy.hpp similarity index 99% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Easy.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Easy.hpp index 2c34856a39..e793fd8753 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Easy.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Easy.hpp @@ -15,8 +15,7 @@ /// - xtensor objects /// - OpenCV objects -#ifndef H5EASY_HPP -#define H5EASY_HPP +#pragma once #include #include @@ -399,5 +398,3 @@ inline T loadAttribute(const File& file, const std::string& path, const std::str #include "h5easy_bits/H5Easy_scalar.hpp" #include "h5easy_bits/H5Easy_vector.hpp" #include "h5easy_bits/H5Easy_xtensor.hpp" - -#endif // H5EASY_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Exception.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Exception.hpp similarity index 97% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Exception.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Exception.hpp index c20ea0bef1..54905aa0fe 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Exception.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Exception.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EXCEPTION_HPP -#define H5EXCEPTION_HPP +#pragma once #include #include @@ -163,5 +162,3 @@ class ReferenceException: public Exception { } // namespace HighFive #include "bits/H5Exception_misc.hpp" - -#endif // H5EXCEPTION_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5File.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5File.hpp similarity index 86% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5File.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5File.hpp index 93cbee66d6..9b393e5a35 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5File.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5File.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5FILE_HPP -#define H5FILE_HPP +#pragma once #include @@ -60,7 +59,7 @@ class File: public Object, public NodeTraits, public AnnotateTraits /// \brief File /// \param filename: filepath of the HDF5 file /// \param openFlags: Open mode / flags ( ReadOnly, ReadWrite) - /// \param fileAccessProps: the file create properties + /// \param fileCreateProps: the file create properties /// \param fileAccessProps: the file access properties /// /// Open or create a new HDF5 file @@ -111,9 +110,22 @@ class File: public Object, public NodeTraits, public AnnotateTraits return details::get_plist(*this, H5Fget_access_plist); } - private: + /// \brief Get the size of this file in bytes + size_t getFileSize() const; + + /// \brief Get the amount of tracked, unused space in bytes. + /// + /// Note, this is a wrapper for `H5Fget_freespace` and returns the number + /// bytes in the free space manager. This might be different from the total + /// amount of unused space in the HDF5 file, since the free space manager + /// might not track everything or not track across open-close cycles. + size_t getFreeSpace() const; + + protected: + File() = default; using Object::Object; + private: mutable std::string _filename{}; template @@ -127,5 +139,3 @@ class File: public Object, public NodeTraits, public AnnotateTraits #include "bits/H5File_misc.hpp" #include "bits/H5Node_traits_misc.hpp" #include "bits/H5Path_traits_misc.hpp" - -#endif // H5FILE_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5FileDriver.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5FileDriver.hpp similarity index 86% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5FileDriver.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5FileDriver.hpp index 6f0df99261..2cd4813a36 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5FileDriver.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5FileDriver.hpp @@ -6,35 +6,27 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5FILEDRIVER_HPP -#define H5FILEDRIVER_HPP +#pragma once #include "H5PropertyList.hpp" #include "bits/H5_definitions.hpp" namespace HighFive { -/// /// \brief file driver base concept -/// +/// \deprecated Use FileAccessProps directly class H5_DEPRECATED("Use FileAccessProps directly") FileDriver: public FileAccessProps {}; #ifdef H5_HAVE_PARALLEL -/// /// \brief MPIIO Driver for Parallel HDF5 -/// - +/// \deprecated Add MPIOFileAccess directly to FileAccessProps class H5_DEPRECATED("Add MPIOFileAccess directly to FileAccessProps") MPIOFileDriver : public FileAccessProps { public: inline MPIOFileDriver(MPI_Comm mpi_comm, MPI_Info mpi_info); - - private: }; #endif } // namespace HighFive #include "bits/H5FileDriver_misc.hpp" - -#endif // H5FILEDRIVER_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Group.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Group.hpp similarity index 54% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Group.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Group.hpp index 60c465aedb..0a6a4cdae6 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Group.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Group.hpp @@ -6,12 +6,12 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef HIGHFIVE_H5GROUP_HPP -#define HIGHFIVE_H5GROUP_HPP +#pragma once #include #include "H5Object.hpp" +#include "bits/H5Friends.hpp" #include "bits/H5_definitions.hpp" #include "bits/H5Annotate_traits.hpp" #include "bits/H5Node_traits.hpp" @@ -19,6 +19,25 @@ namespace HighFive { +namespace detail { +/// \brief Internal hack to create an `Group` from an ID. +/// +/// WARNING: Creating an Group from an ID has implications w.r.t. the lifetime of the object +/// that got passed via its ID. Using this method careless opens up the suite of issues +/// related to C-style resource management, including the analog of double free, dangling +/// pointers, etc. +/// +/// NOTE: This is not part of the API and only serves to work around a compiler issue in GCC which +/// prevents us from using `friend`s instead. This function should only be used for internal +/// purposes. The problematic construct is: +/// +/// template +/// friend class SomeCRTP; +/// +/// \private +Group make_group(hid_t); +} // namespace detail + /// /// \brief Represents an hdf5 group class Group: public Object, @@ -28,6 +47,7 @@ class Group: public Object, public: const static ObjectType type = ObjectType::Group; + /// \deprecated Default constructor creates unsafe uninitialized objects H5_DEPRECATED("Default constructor creates unsafe uninitialized objects") Group() = default; @@ -38,30 +58,31 @@ class Group: public Object, return details::get_plist(*this, H5Gget_create_plist); } - protected: - using Object::Object; - Group(Object&& o) noexcept : Object(std::move(o)){}; + protected: + using Object::Object; + + friend Group detail::make_group(hid_t); friend class File; friend class Reference; +#if HIGHFIVE_HAS_FRIEND_DECLARATIONS template friend class ::HighFive::NodeTraits; +#endif }; inline std::pair Group::getEstimatedLinkInfo() const { - unsigned int est_num_entries; - unsigned int est_name_len; - auto gcpl = getCreatePropertyList(); - if (H5Pget_est_link_info(gcpl.getId(), &est_num_entries, &est_name_len) < 0) { - HDF5ErrMapper::ToException( - std::string("Unable to access group link size property")); - } - return std::make_pair(est_num_entries, est_name_len); + auto eli = EstimatedLinkInfo(gcpl); + return std::make_pair(eli.getEntries(), eli.getNameLength()); } -} // namespace HighFive +namespace detail { +inline Group make_group(hid_t hid) { + return Group(hid); +} +} // namespace detail -#endif // HIGHFIVE_H5GROUP_HPP +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Object.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Object.hpp similarity index 74% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Object.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Object.hpp index f0a090f9cf..4cf4e7de08 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Object.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Object.hpp @@ -6,16 +6,15 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5OBJECT_HPP -#define H5OBJECT_HPP +#pragma once #include #include #include -#include "H5Exception.hpp" #include "bits/H5_definitions.hpp" +#include "bits/H5Friends.hpp" namespace HighFive { @@ -32,9 +31,31 @@ enum class ObjectType { Other // Internal/custom object type }; +namespace detail { +/// \brief Internal hack to create an `Object` from an ID. +/// +/// WARNING: Creating an Object from an ID has implications w.r.t. the lifetime of the object +/// that got passed via its ID. Using this method careless opens up the suite of issues +/// related to C-style resource management, including the analog of double free, dangling +/// pointers, etc. +/// +/// NOTE: This is not part of the API and only serves to work around a compiler issue in GCC which +/// prevents us from using `friend`s instead. This function should only be used for internal +/// purposes. The problematic construct is: +/// +/// template +/// friend class SomeCRTP; +/// +/// \private +Object make_object(hid_t hid); +} // namespace detail + class Object { public: + // move constructor, reuse hid + Object(Object&& other) noexcept; + // decrease reference counter ~Object(); @@ -75,9 +96,6 @@ class Object { // copy constructor, increase reference counter Object(const Object& other); - // move constructor, reuse hid - Object(Object&& other) noexcept; - // Init with an low-level object id explicit Object(hid_t); @@ -87,14 +105,18 @@ class Object { hid_t _hid; private: + friend Object detail::make_object(hid_t); + friend class Reference; + friend class CompoundType; + +#if HIGHFIVE_HAS_FRIEND_DECLARATIONS template friend class NodeTraits; template friend class AnnotateTraits; - friend class Reference; - friend class CompoundType; template friend class PathTraits; +#endif }; @@ -104,6 +126,7 @@ class Object { class ObjectInfo { public: /// \brief Retrieve the address of the object (within its file) + /// \deprecated Deprecated since HighFive 2.2. Soon supporting VOL tokens H5_DEPRECATED("Deprecated since HighFive 2.2. Soon supporting VOL tokens") haddr_t getAddress() const noexcept; @@ -130,5 +153,3 @@ class ObjectInfo { } // namespace HighFive #include "bits/H5Object_misc.hpp" - -#endif // H5OBJECT_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5PropertyList.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5PropertyList.hpp similarity index 52% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5PropertyList.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5PropertyList.hpp index a09959647d..53b3c4a137 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5PropertyList.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5PropertyList.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5PROPERTY_LIST_HPP -#define H5PROPERTY_LIST_HPP +#pragma once #include @@ -23,6 +22,67 @@ namespace HighFive { +/// \defgroup PropertyLists Property Lists +/// HDF5 is configured through what they call property lists. In HDF5 the +/// process has four steps: +/// +/// 1. Create a property list. As users we now have an `hid_t` identifying the +/// property list. +/// 2. Set properties as desired. +/// 3. Pass the HID to the HDF5 function to be configured. +/// 4. Free the property list. +/// +/// Note that the mental picture is that one creates a settings object, and +/// then passes those settings to a function such as `H5Dwrite`. In and of +/// themselves the settings don't change the behaviour of HDF5. Rather they +/// need to be used to take affect. +/// +/// The second aspect is that property lists represent any number of related +/// settings, e.g. there's property lists anything related to creating files +/// and another for accessing files, same for creating and accessing datasets, +/// etc. Settings that affect creating files, must be passed a file creation +/// property list, while settings that affect file access require a file access +/// property list. +/// +/// In HighFive the `PropertyList` works similar in that it's a object +/// representing the settings, i.e. internally it's just the property lists +/// HID. Just like in HDF5 one adds the settings to the settings object; and +/// then passes the settings object to the respective method. Example: +/// +/// +/// // Create an object which contains the setting to +/// // open files with MPI-IO. +/// auto fapl = FileAccessProps(); +/// fapl.add(MPIOFileAccess(MPI_COMM_WORLD, MPI_INFO_NULL); +/// +/// // To open a specific file with MPI-IO, we do: +/// auto file = File("foo.h5", File::ReadOnly, fapl); +/// +/// Note that the `MPIOFileAccess` object by itself doesn't affect the +/// `FileAccessProps`. Rather it needs to be explicitly added to the `fapl` +/// (the group of file access related settings), and then the `fapl` needs to +/// be passed to the constructor of `File` for the settings to take affect. +/// +/// This is important to understand when reading properties. Example: +/// +/// // Obtain the file access property list: +/// auto fapl = file.getAccessPropertyList() +/// +/// // Extracts a copy of the collective MPI-IO metadata settings from +/// // the group of file access related setting, i.e. the `fapl`: +/// auto mpio_metadata = MPIOCollectiveMetadata(fapl); +/// +/// if(mpio_metadata.isCollectiveRead()) { +/// // something specific if meta data is read collectively. +/// } +/// +/// // Careful, this only affects the `mpio_metadata` object, but not the +/// // `fapl`, and also not whether `file` uses collective MPI-IO for +/// // metadata. +/// mpio_metadata = MPIOCollectiveMetadata(false, false); +/// +/// @{ + /// /// \brief Types of property lists /// @@ -49,7 +109,7 @@ template T get_plist(const U& obj, hid_t (*f)(hid_t)) { auto hid = f(obj.getId()); if (hid < 0) { - HDF5ErrMapper::ToException(std::string("Unable to get property list")); + HDF5ErrMapper::ToException("Unable to get property list"); } T t{}; t._hid = hid; @@ -73,6 +133,26 @@ class PropertyListBase: public Object { friend T details::get_plist(const U&, hid_t (*f)(hid_t)); }; +/// \interface PropertyInterface +/// \brief HDF5 file property object +/// +/// A property is an object which is expected to have a method with the +/// following signature `void apply(hid_t hid) const` +/// +/// \sa Instructions to document C++20 concepts with Doxygen: https://github.com/doxygen/doxygen/issues/2732#issuecomment-509629967 +/// +/// \cond +#if HIGHFIVE_HAS_CONCEPTS && __cplusplus >= 202002L +template +concept PropertyInterface = requires(P p, const hid_t hid) { + {p.apply(hid)}; +}; + +#else +#define PropertyInterface typename +#endif +/// \endcond + /// /// \brief HDF5 property Lists /// @@ -89,8 +169,8 @@ class PropertyList: public PropertyListBase { /// Add a property to this property list. /// A property is an object which is expected to have a method with the /// following signature void apply(hid_t hid) const - /// - template + /// \tparam PropertyInterface + template void add(const P& property); /// @@ -139,35 +219,36 @@ class RawPropertyList: public PropertyList { /// class MPIOFileAccess { public: - MPIOFileAccess(MPI_Comm comm, MPI_Info info) - : _comm(comm) - , _info(info) {} - - void apply(const hid_t list) const { - if (H5Pset_fapl_mpio(list, _comm, _info) < 0) { - HDF5ErrMapper::ToException("Unable to set-up MPIO Driver configuration"); - } - } + MPIOFileAccess(MPI_Comm comm, MPI_Info info); private: + friend FileAccessProps; + void apply(const hid_t list) const; + MPI_Comm _comm; MPI_Info _info; }; /// -/// \brief Use collective MPI-IO for metadata read and write? +/// \brief Use collective MPI-IO for metadata read and write. /// /// See `MPIOCollectiveMetadataRead` and `MPIOCollectiveMetadataWrite`. /// class MPIOCollectiveMetadata { public: - explicit MPIOCollectiveMetadata(bool collective = true) - : collective_(collective) {} + explicit MPIOCollectiveMetadata(bool collective = true); + explicit MPIOCollectiveMetadata(const FileAccessProps& plist); + + bool isCollectiveRead() const; + bool isCollectiveWrite() const; + private: friend FileAccessProps; void apply(hid_t plist) const; - bool collective_; + + bool collective_read_; + bool collective_write_; }; /// @@ -185,8 +266,10 @@ class MPIOCollectiveMetadata { /// class MPIOCollectiveMetadataRead { public: - explicit MPIOCollectiveMetadataRead(bool collective = true) - : collective_(collective) {} + explicit MPIOCollectiveMetadataRead(bool collective = true); + explicit MPIOCollectiveMetadataRead(const FileAccessProps& plist); + + bool isCollective() const; private: friend FileAccessProps; @@ -209,8 +292,10 @@ class MPIOCollectiveMetadataRead { /// class MPIOCollectiveMetadataWrite { public: - explicit MPIOCollectiveMetadataWrite(bool collective = true) - : collective_(collective) {} + explicit MPIOCollectiveMetadataWrite(bool collective = true); + explicit MPIOCollectiveMetadataWrite(const FileAccessProps& plist); + + bool isCollective() const; private: friend FileAccessProps; @@ -241,19 +326,17 @@ class MPIOCollectiveMetadataWrite { /// class FileVersionBounds { public: - FileVersionBounds(H5F_libver_t low, H5F_libver_t high) - : _low(low) - , _high(high) {} + FileVersionBounds(H5F_libver_t low, H5F_libver_t high); + explicit FileVersionBounds(const FileAccessProps& fapl); + + std::pair getVersion() const; private: friend FileAccessProps; - void apply(const hid_t list) const { - if (H5Pset_libver_bounds(list, _low, _high) < 0) { - HDF5ErrMapper::ToException("Error setting file version bounds"); - } - } - const H5F_libver_t _low; - const H5F_libver_t _high; + void apply(const hid_t list) const; + + H5F_libver_t _low; + H5F_libver_t _high; }; /// @@ -263,17 +346,15 @@ class FileVersionBounds { /// class MetadataBlockSize { public: - MetadataBlockSize(hsize_t size) - : _size(size) {} + explicit MetadataBlockSize(hsize_t size); + explicit MetadataBlockSize(const FileAccessProps& fapl); + + hsize_t getSize() const; private: friend FileAccessProps; - void apply(const hid_t list) const { - if (H5Pset_meta_block_size(list, _size) < 0) { - HDF5ErrMapper::ToException("Error setting metadata block size"); - } - } - const hsize_t _size; + void apply(const hid_t list) const; + hsize_t _size; }; #if H5_VERSION_GE(1, 10, 1) @@ -292,6 +373,11 @@ class FileSpaceStrategy { /// \param persist Should free space managers be persisted across file closing and reopening. /// \param threshold The free-space manager wont track sections small than this threshold. FileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold); + explicit FileSpaceStrategy(const FileCreateProps& fcpl); + + H5F_fspace_strategy_t getStrategy() const; + hbool_t getPersist() const; + hsize_t getThreshold() const; private: friend FileCreateProps; @@ -319,10 +405,12 @@ class FileSpacePageSize { /// /// \param page_size The page size in bytes. explicit FileSpacePageSize(hsize_t page_size); + explicit FileSpacePageSize(const FileCreateProps& fcpl); + + hsize_t getPageSize() const; private: friend FileCreateProps; - void apply(const hid_t list) const; hsize_t _page_size; @@ -351,12 +439,18 @@ class PageBufferSize { unsigned min_meta_percent = 0, unsigned min_raw_percent = 0); + explicit PageBufferSize(const FileAccessProps& fapl); + + size_t getPageBufferSize() const; + unsigned getMinMetaPercent() const; + unsigned getMinRawPercent() const; + private: friend FileAccessProps; void apply(hid_t list) const; - hsize_t _page_buffer_size; + size_t _page_buffer_size; unsigned _min_meta; unsigned _min_raw; }; @@ -364,47 +458,55 @@ class PageBufferSize { #endif /// \brief Set hints as to how many links to expect and their average length +/// \implements PropertyInterface /// class EstimatedLinkInfo { public: - explicit EstimatedLinkInfo(unsigned entries, unsigned length) - : _entries(entries) - , _length(length) {} + /// \brief Create a property with the request parameters. + /// + /// @param entries The estimated number of links in a group. + /// @param length The estimated length of the names of links. + explicit EstimatedLinkInfo(unsigned entries, unsigned length); + + explicit EstimatedLinkInfo(const GroupCreateProps& gcpl); + + /// \brief The estimated number of links in a group. + unsigned getEntries() const; + + /// \brief The estimated length of the names of links. + unsigned getNameLength() const; private: friend GroupCreateProps; void apply(hid_t hid) const; - const unsigned _entries; - const unsigned _length; + unsigned _entries; + unsigned _length; }; +/// \implements PropertyInterface class Chunking { public: - explicit Chunking(const std::vector& dims) - : _dims(dims) {} - - Chunking(const std::initializer_list& items) - : Chunking(std::vector{items}) {} + explicit Chunking(const std::vector& dims); + Chunking(const std::initializer_list& items); template - explicit Chunking(hsize_t item, Args... args) - : Chunking(std::vector{item, static_cast(args)...}) {} + explicit Chunking(hsize_t item, Args... args); - const std::vector& getDimensions() const noexcept { - return _dims; - } + explicit Chunking(DataSetCreateProps& plist, size_t max_dims = 32); + + const std::vector& getDimensions() const noexcept; private: friend DataSetCreateProps; void apply(hid_t hid) const; - const std::vector _dims; + std::vector _dims; }; +/// \implements PropertyInterface class Deflate { public: - explicit Deflate(unsigned level) - : _level(level) {} + explicit Deflate(unsigned level); private: friend DataSetCreateProps; @@ -413,12 +515,14 @@ class Deflate { const unsigned _level; }; +/// \implements PropertyInterface class Szip { public: explicit Szip(unsigned options_mask = H5_SZIP_EC_OPTION_MASK, - unsigned pixels_per_block = H5_SZIP_MAX_PIXELS_PER_BLOCK) - : _options_mask(options_mask) - , _pixels_per_block(pixels_per_block) {} + unsigned pixels_per_block = H5_SZIP_MAX_PIXELS_PER_BLOCK); + + unsigned getOptionsMask() const; + unsigned getPixelsPerBlock() const; private: friend DataSetCreateProps; @@ -427,6 +531,7 @@ class Szip { const unsigned _pixels_per_block; }; +/// \implements PropertyInterface class Shuffle { public: Shuffle() = default; @@ -441,10 +546,13 @@ class Shuffle { /// The precise time of when HDF5 requests space to store the dataset /// can be configured. Please, consider the upstream documentation for /// `H5Pset_alloc_time`. +/// \implements PropertyInterface class AllocationTime { public: - explicit AllocationTime(H5D_alloc_time_t alloc_time) - : _alloc_time(alloc_time) {} + explicit AllocationTime(H5D_alloc_time_t alloc_time); + explicit AllocationTime(const DataSetCreateProps& dcpl); + + H5D_alloc_time_t getAllocationTime(); private: friend DataSetCreateProps; @@ -455,52 +563,172 @@ class AllocationTime { /// Dataset access property to control chunk cache configuration. /// Do not confuse with the similar file access property for H5Pset_cache +/// \implements PropertyInterface class Caching { public: /// https://support.hdfgroup.org/HDF5/doc/RM/H5P/H5Pset_chunk_cache.html for /// details. Caching(const size_t numSlots, const size_t cacheSize, - const double w0 = static_cast(H5D_CHUNK_CACHE_W0_DEFAULT)) - : _numSlots(numSlots) - , _cacheSize(cacheSize) - , _w0(w0) {} + const double w0 = static_cast(H5D_CHUNK_CACHE_W0_DEFAULT)); + + explicit Caching(const DataSetCreateProps& dcpl); + + size_t getNumSlots() const; + size_t getCacheSize() const; + double getW0() const; private: friend DataSetAccessProps; void apply(hid_t hid) const; - const size_t _numSlots; - const size_t _cacheSize; - const double _w0; + size_t _numSlots; + size_t _cacheSize; + double _w0; }; +/// \implements PropertyInterface class CreateIntermediateGroup { public: - explicit CreateIntermediateGroup(bool create = true) - : _create(create) {} + explicit CreateIntermediateGroup(bool create = true); + + explicit CreateIntermediateGroup(const ObjectCreateProps& ocpl); + explicit CreateIntermediateGroup(const LinkCreateProps& lcpl); + + bool isSet() const; + + protected: + void fromPropertyList(hid_t hid); private: friend ObjectCreateProps; friend LinkCreateProps; void apply(hid_t hid) const; - const bool _create; + bool _create; }; #ifdef H5_HAVE_PARALLEL +/// \implements PropertyInterface class UseCollectiveIO { public: - explicit UseCollectiveIO(bool enable = true) - : _enable(enable) {} + explicit UseCollectiveIO(bool enable = true); + + explicit UseCollectiveIO(const DataTransferProps& dxpl); + + /// \brief Does the property request collective IO? + bool isCollective() const; private: friend DataTransferProps; void apply(hid_t hid) const; bool _enable; }; + + +/// \brief The cause for non-collective I/O. +/// +/// The cause refers to the most recent I/O with data transfer property list `dxpl` at time of +/// creation of this object. This object will not update automatically for later data transfers, +/// i.e. `H5Pget_mpio_no_collective_cause` is called in the constructor, and not when fetching +/// a value, such as `wasCollective`. +/// \implements PropertyInterface +class MpioNoCollectiveCause { + public: + explicit MpioNoCollectiveCause(const DataTransferProps& dxpl); + + /// \brief Was the datatransfer collective? + bool wasCollective() const; + + /// \brief The local cause for a non-collective I/O. + uint32_t getLocalCause() const; + + /// \brief The global cause for a non-collective I/O. + uint32_t getGlobalCause() const; + + /// \brief A pair of the local and global cause for non-collective I/O. + std::pair getCause() const; + + private: + friend DataTransferProps; + uint32_t _local_cause; + uint32_t _global_cause; +}; #endif +struct CreationOrder { + enum _CreationOrder { + Tracked = H5P_CRT_ORDER_TRACKED, + Indexed = H5P_CRT_ORDER_INDEXED, + }; +}; + +/// +/// \brief Track and index creation order time +/// +/// Let user retrieve objects by creation order time instead of name. +/// +/// \implements PropertyInterface +class LinkCreationOrder { + public: + /// + /// \brief Create the property + /// \param flags Should be a composition of HighFive::CreationOrder. + /// + explicit LinkCreationOrder(unsigned flags) + : _flags(flags) {} + + explicit LinkCreationOrder(const FileCreateProps& fcpl); + explicit LinkCreationOrder(const GroupCreateProps& gcpl); + + unsigned getFlags() const; + + protected: + void fromPropertyList(hid_t hid); + + private: + friend FileCreateProps; + friend GroupCreateProps; + void apply(hid_t hid) const; + unsigned _flags; +}; + + +/// +/// \brief Set threshold for attribute storage. +/// +/// HDF5 can store Attributes in the object header (compact) or in the B-tree +/// (dense). This property sets the threshold when attributes are moved to one +/// or the other storage format. +/// +/// Please refer to the upstream documentation of `H5Pset_attr_phase_change` or +/// Section 8 (Attributes) in the User Guide, in particular Subsection 8.5. +/// +/// \implements PropertyInterface +class AttributePhaseChange { + public: + /// + /// \brief Create the property from the threshold values. + /// + /// When the number of attributes hits `max_compact` the attributes are + /// moved to dense storage, once the number drops to below `min_dense` the + /// attributes are moved to compact storage. + AttributePhaseChange(unsigned max_compact, unsigned min_dense); + + /// \brief Extract threshold values from property list. + explicit AttributePhaseChange(const GroupCreateProps& gcpl); + + unsigned max_compact() const; + unsigned min_dense() const; + + private: + friend GroupCreateProps; + void apply(hid_t hid) const; + + unsigned _max_compact; + unsigned _min_dense; +}; + +/// @} + } // namespace HighFive #include "bits/H5PropertyList_misc.hpp" - -#endif // H5PROPERTY_LIST_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Reference.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Reference.hpp similarity index 96% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Reference.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Reference.hpp index db69895d99..38062e987b 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Reference.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Reference.hpp @@ -7,8 +7,7 @@ * */ -#ifndef H5REFERENCE_HPP -#define H5REFERENCE_HPP +#pragma once #include #include @@ -16,7 +15,6 @@ #include #include -#include "H5Object.hpp" #include "bits/H5_definitions.hpp" namespace HighFive { @@ -81,5 +79,3 @@ class Reference { } // namespace HighFive #include "bits/H5Reference_misc.hpp" - -#endif // H5REFERENCE_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Selection.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Selection.hpp similarity index 83% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Selection.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Selection.hpp index 404f0772b1..c00c66d52f 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/H5Selection.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Selection.hpp @@ -6,15 +6,19 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5SELECTION_HPP -#define H5SELECTION_HPP +#pragma once #include "H5DataSet.hpp" #include "H5DataSpace.hpp" #include "bits/H5Slice_traits.hpp" +#include "bits/H5Friends.hpp" namespace HighFive { +namespace detail { +Selection make_selection(const DataSpace&, const DataSpace&, const DataSet&); +} + /// /// \brief Selection: represent a view on a slice/part of a dataset /// @@ -47,17 +51,18 @@ class Selection: public SliceTraits { /// \return return the datatype of the selection const DataType getDataType() const; - private: + protected: Selection(const DataSpace& memspace, const DataSpace& file_space, const DataSet& set); + private: DataSpace _mem_space, _file_space; DataSet _set; +#if HIGHFIVE_HAS_FRIEND_DECLARATIONS template friend class ::HighFive::SliceTraits; - // absolute namespace naming due to GCC bug 52625 +#endif + friend Selection detail::make_selection(const DataSpace&, const DataSpace&, const DataSet&); }; } // namespace HighFive - -#endif // H5SELECTION_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Utility.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Utility.hpp new file mode 100644 index 0000000000..64ac1e5c89 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Utility.hpp @@ -0,0 +1,215 @@ +/* + * Copyright (c), 2017, Blue Brain Project - EPFL (CH) + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ + +#pragma once + +#include +#include +#include +#include + +#include "bits/H5Friends.hpp" + +namespace HighFive { + +/// +/// \brief Utility class to disable HDF5 stack printing inside a scope. +/// +class SilenceHDF5 { + public: + inline SilenceHDF5(bool enable = true) + : _client_data(nullptr) { + H5Eget_auto2(H5E_DEFAULT, &_func, &_client_data); + if (enable) + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + } + + inline ~SilenceHDF5() { + H5Eset_auto2(H5E_DEFAULT, _func, _client_data); + } + + private: + H5E_auto2_t _func; + void* _client_data; +}; + +#define HIGHFIVE_LOG_LEVEL_DEBUG 10 +#define HIGHFIVE_LOG_LEVEL_INFO 20 +#define HIGHFIVE_LOG_LEVEL_WARN 30 +#define HIGHFIVE_LOG_LEVEL_ERROR 40 + +#ifndef HIGHFIVE_LOG_LEVEL +#define HIGHFIVE_LOG_LEVEL HIGHFIVE_LOG_LEVEL_WARN +#endif + +enum class LogSeverity { + Debug = HIGHFIVE_LOG_LEVEL_DEBUG, + Info = HIGHFIVE_LOG_LEVEL_INFO, + Warn = HIGHFIVE_LOG_LEVEL_WARN, + Error = HIGHFIVE_LOG_LEVEL_ERROR +}; + +inline std::string to_string(LogSeverity severity) { + switch (severity) { + case LogSeverity::Debug: + return "DEBUG"; + case LogSeverity::Info: + return "INFO"; + case LogSeverity::Warn: + return "WARN"; + case LogSeverity::Error: + return "ERROR"; + default: + return "??"; + } +} + +/** \brief A logger with supporting basic functionality. + * + * This logger delegates the logging task to a callback. This level of + * indirection enables using the default Python logger from C++; or + * integrating HighFive into some custom logging solution. + * + * Using this class directly to log is not intended. Rather you should use + * - `HIGHFIVE_LOG_DEBUG{,_IF}` + * - `HIGHFIVE_LOG_INFO{,_IF}` + * - `HIGHFIVE_LOG_WARNING{,_IF}` + * - `HIGHFIVE_LOG_ERROR{,_IF}` + * + * This is intended to used as a singleton, via `get_global_logger()`. + */ +class Logger { + public: + using callback_type = + std::function; + + public: + Logger() = delete; + Logger(const Logger&) = delete; + Logger(Logger&&) = delete; + + explicit Logger(callback_type cb) + : _cb(std::move(cb)) {} + + Logger& operator=(const Logger&) = delete; + Logger& operator=(Logger&&) = delete; + + inline void log(LogSeverity severity, + const std::string& message, + const std::string& file, + int line) { + _cb(severity, message, file, line); + } + + inline void set_logging_callback(callback_type cb) { + _cb = std::move(cb); + } + + private: + callback_type _cb; +}; + +inline void default_logging_callback(LogSeverity severity, + const std::string& message, + const std::string& file, + int line) { + std::clog << file << ": " << line << " :: " << to_string(severity) << message << std::endl; +} + +/// \brief Obtain a reference to the logger used by HighFive. +/// +/// This uses a Meyers singleton, to ensure that the global logger is +/// initialized with a safe default logger, before it is used. +/// +/// Note: You probably don't need to call this function explicitly. +/// +inline Logger& get_global_logger() { + static Logger logger(&default_logging_callback); + return logger; +} + +/// \brief Sets the callback that's used by the logger. +inline void register_logging_callback(Logger::callback_type cb) { + auto& logger = get_global_logger(); + logger.set_logging_callback(std::move(cb)); +} + +namespace detail { +/// \brief Log a `message` with severity `severity`. +inline void log(LogSeverity severity, + const std::string& message, + const std::string& file, + int line) { + auto& logger = get_global_logger(); + logger.log(severity, message, file, line); +} +} // namespace detail + +#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_DEBUG +#define HIGHFIVE_LOG_DEBUG(message) \ + ::HighFive::detail::log(::HighFive::LogSeverity::Debug, (message), __FILE__, __LINE__); + +// Useful, for the common pattern: if ...; then log something. +#define HIGHFIVE_LOG_DEBUG_IF(cond, message) \ + if ((cond)) { \ + HIGHFIVE_LOG_DEBUG((message)); \ + } + +#else +#define HIGHFIVE_LOG_DEBUG(message) ; +#define HIGHFIVE_LOG_DEBUG_IF(cond, message) ; +#endif + +#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_INFO +#define HIGHFIVE_LOG_INFO(message) \ + ::HighFive::detail::log(::HighFive::LogSeverity::Info, (message), __FILE__, __LINE__); + +// Useful, for the common pattern: if ...; then log something. +#define HIGHFIVE_LOG_INFO_IF(cond, message) \ + if ((cond)) { \ + HIGHFIVE_LOG_INFO((message)); \ + } + +#else +#define HIGHFIVE_LOG_INFO(message) ; +#define HIGHFIVE_LOG_INFO_IF(cond, message) ; +#endif + + +#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_WARN +#define HIGHFIVE_LOG_WARN(message) \ + ::HighFive::detail::log(::HighFive::LogSeverity::Warn, (message), __FILE__, __LINE__); + +// Useful, for the common pattern: if ...; then log something. +#define HIGHFIVE_LOG_WARN_IF(cond, message) \ + if ((cond)) { \ + HIGHFIVE_LOG_WARN((message)); \ + } + +#else +#define HIGHFIVE_LOG_WARN(message) ; +#define HIGHFIVE_LOG_WARN_IF(cond, message) ; +#endif + +#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_ERROR +#define HIGHFIVE_LOG_ERROR(message) \ + ::HighFive::detail::log(::HighFive::LogSeverity::Error, (message), __FILE__, __LINE__); + +// Useful, for the common pattern: if ...; then log something. +#define HIGHFIVE_LOG_ERROR_IF(cond, message) \ + if ((cond)) { \ + HIGHFIVE_LOG_ERROR((message)); \ + } + +#else +#define HIGHFIVE_LOG_ERROR(message) ; +#define HIGHFIVE_LOG_ERROR_IF(cond, message) ; +#endif + +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Version.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Version.hpp new file mode 100644 index 0000000000..dc238432cb --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Version.hpp @@ -0,0 +1,33 @@ +/* + * Copyright (c), 2020 + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#pragma once + +#define HIGHFIVE_VERSION_MAJOR 2 +#define HIGHFIVE_VERSION_MINOR 8 +#define HIGHFIVE_VERSION_PATCH 0 + +/** \brief Concatenated representation of the HighFive version. + * + * \warning The macro `HIGHFIVE_VERSION` by itself isn't valid C/C++. + * + * However, it can be stringified with two layers of macros, e.g., + * \code{.cpp} + * #define STRINGIFY_VALUE(s) STRINGIFY_NAME(s) + * #define STRINGIFY_NAME(s) #s + * + * std::cout << STRINGIFY_VALUE(HIGHFIVE_VERSION) << "\n"; + * \endcode + */ +#define HIGHFIVE_VERSION 2.8.0 + +/** \brief String representation of the HighFive version. + * + * \warning This macro only exists from 2.7.1 onwards. + */ +#define HIGHFIVE_VERSION_STRING "2.8.0" diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Version.hpp.in b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Version.hpp.in new file mode 100644 index 0000000000..acddcffd39 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/H5Version.hpp.in @@ -0,0 +1,33 @@ +/* + * Copyright (c), 2020 + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#pragma once + +#define HIGHFIVE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ +#define HIGHFIVE_VERSION_MINOR @PROJECT_VERSION_MINOR@ +#define HIGHFIVE_VERSION_PATCH @PROJECT_VERSION_PATCH@ + +/** \brief Concatenated representation of the HighFive version. + * + * \warning The macro `HIGHFIVE_VERSION` by itself isn't valid C/C++. + * + * However, it can be stringified with two layers of macros, e.g., + * \code{.cpp} + * #define STRINGIFY_VALUE(s) STRINGIFY_NAME(s) + * #define STRINGIFY_NAME(s) #s + * + * std::cout << STRINGIFY_VALUE(HIGHFIVE_VERSION) << "\n"; + * \endcode + */ +#define HIGHFIVE_VERSION @PROJECT_VERSION@ + +/** \brief String representation of the HighFive version. + * + * \warning This macro only exists from 2.7.1 onwards. + */ +#define HIGHFIVE_VERSION_STRING "@PROJECT_VERSION@" diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Annotate_traits.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Annotate_traits.hpp similarity index 96% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Annotate_traits.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Annotate_traits.hpp index 7b613ab657..375b535a46 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Annotate_traits.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Annotate_traits.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5ANNOTATE_TRAITS_HPP -#define H5ANNOTATE_TRAITS_HPP +#pragma once #include @@ -80,6 +79,3 @@ class AnnotateTraits { using derivate_type = Derivate; }; } // namespace HighFive - - -#endif // H5ANNOTATE_TRAITS_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Annotate_traits_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Annotate_traits_misc.hpp similarity index 94% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Annotate_traits_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Annotate_traits_misc.hpp index de20fbd2b2..85d2798fe2 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Annotate_traits_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Annotate_traits_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5ANNOTATE_TRAITS_MISC_HPP -#define H5ANNOTATE_TRAITS_MISC_HPP +#pragma once #include #include @@ -26,15 +25,15 @@ inline Attribute AnnotateTraits::createAttribute(const std::string& at const DataType& dtype) { auto attr_id = H5Acreate2(static_cast(this)->getId(), attribute_name.c_str(), - dtype._hid, - space._hid, + dtype.getId(), + space.getId(), H5P_DEFAULT, H5P_DEFAULT); if (attr_id < 0) { HDF5ErrMapper::ToException( std::string("Unable to create the attribute \"") + attribute_name + "\":"); } - return Attribute(attr_id); + return detail::make_attribute(attr_id); } template @@ -72,7 +71,7 @@ inline Attribute AnnotateTraits::getAttribute(const std::string& attri HDF5ErrMapper::ToException( std::string("Unable to open the attribute \"") + attribute_name + "\":"); } - return Attribute(attr_id); + return detail::make_attribute(attr_id); } template @@ -117,5 +116,3 @@ inline bool AnnotateTraits::hasAttribute(const std::string& attr_name) } } // namespace HighFive - -#endif // H5ANNOTATE_TRAITS_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Attribute_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Attribute_misc.hpp similarity index 67% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Attribute_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Attribute_misc.hpp index 777f0c824c..6516788297 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Attribute_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Attribute_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5ATTRIBUTE_MISC_HPP -#define H5ATTRIBUTE_MISC_HPP +#pragma once #include #include @@ -18,6 +17,7 @@ #include #include +#include "../H5DataSpace.hpp" #include "H5Converter_misc.hpp" #include "H5ReadWrite_misc.hpp" #include "H5Utils.hpp" @@ -61,8 +61,9 @@ inline T Attribute::read() const { template inline void Attribute::read(T& array) const { const DataSpace& mem_space = getMemSpace(); + auto file_datatype = getDataType(); const details::BufferInfo buffer_info( - getDataType(), + file_datatype, [this]() -> std::string { return this->getName(); }, details::BufferInfo::read); @@ -73,36 +74,64 @@ inline void Attribute::read(T& array) const { throw DataSpaceException(ss.str()); } auto dims = mem_space.getDimensions(); - auto r = details::data_converter::get_reader(dims, array); - read(r.get_pointer(), buffer_info.data_type); + + if (mem_space.getElementCount() == 0) { + auto effective_dims = details::squeezeDimensions(dims, + details::inspector::recursive_ndim); + + details::inspector::prepare(array, effective_dims); + return; + } + + auto r = details::data_converter::get_reader(dims, array, file_datatype); + read(r.getPointer(), buffer_info.data_type); // re-arrange results - r.unserialize(); - auto t = create_datatype::base_type>(); + r.unserialize(array); + + auto t = buffer_info.data_type; auto c = t.getClass(); - if (c == DataTypeClass::VarLen) { - (void) H5Dvlen_reclaim(t.getId(), mem_space.getId(), H5P_DEFAULT, r.get_pointer()); + + if (c == DataTypeClass::VarLen || t.isVariableStr()) { +#if H5_VERSION_GE(1, 12, 0) + // This one have been created in 1.12.0 + (void) H5Treclaim(t.getId(), mem_space.getId(), H5P_DEFAULT, r.getPointer()); +#else + // This one is deprecated since 1.12.0 + (void) H5Dvlen_reclaim(t.getId(), mem_space.getId(), H5P_DEFAULT, r.getPointer()); +#endif } } template -inline void Attribute::read(T* array, const DataType& dtype) const { +inline void Attribute::read(T* array, const DataType& mem_datatype) const { static_assert(!std::is_const::value, "read() requires a non-const structure to read data into"); - using element_type = typename details::inspector::base_type; - // Auto-detect mem datatype if not provided - const DataType& mem_datatype = dtype.empty() ? create_and_check_datatype() - : dtype; if (H5Aread(getId(), mem_datatype.getId(), static_cast(array)) < 0) { HDF5ErrMapper::ToException("Error during HDF5 Read: "); } } +template +inline void Attribute::read(T* array) const { + using element_type = typename details::inspector::base_type; + const DataType& mem_datatype = create_and_check_datatype(); + + read(array, mem_datatype); +} + template inline void Attribute::write(const T& buffer) { const DataSpace& mem_space = getMemSpace(); + + if (mem_space.getElementCount() == 0) { + return; + } + + auto file_datatype = getDataType(); + const details::BufferInfo buffer_info( - getDataType(), + file_datatype, [this]() -> std::string { return this->getName(); }, details::BufferInfo::write); @@ -112,20 +141,23 @@ inline void Attribute::write(const T& buffer) { << " into dataset of dimensions " << mem_space.getNumberDimensions(); throw DataSpaceException(ss.str()); } - auto w = details::data_converter::serialize(buffer); - write_raw(w.get_pointer(), buffer_info.data_type); + auto w = details::data_converter::serialize(buffer, file_datatype); + write_raw(w.getPointer(), buffer_info.data_type); } template -inline void Attribute::write_raw(const T* buffer, const DataType& dtype) { - using element_type = typename details::inspector::base_type; - const auto& mem_datatype = dtype.empty() ? create_and_check_datatype() : dtype; - +inline void Attribute::write_raw(const T* buffer, const DataType& mem_datatype) { if (H5Awrite(getId(), mem_datatype.getId(), buffer) < 0) { HDF5ErrMapper::ToException("Error during HDF5 Write: "); } } -} // namespace HighFive +template +inline void Attribute::write_raw(const T* buffer) { + using element_type = typename details::inspector::base_type; + const auto& mem_datatype = create_and_check_datatype(); -#endif // H5ATTRIBUTE_MISC_HPP + write_raw(buffer, mem_datatype); +} + +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Converter_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Converter_misc.hpp new file mode 100644 index 0000000000..00749d1b6d --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Converter_misc.hpp @@ -0,0 +1,421 @@ +/* + * Copyright (c) 2022 Blue Brain Project + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#pragma once + +#include + +#include "H5Inspector_misc.hpp" +#include "../H5DataType.hpp" + +namespace HighFive { +namespace details { + +template +struct is_std_string { + static constexpr bool value = + std::is_same::base_type, std::string>::value; +}; + +template +struct enable_shallow_copy + : public std::enable_if::value && inspector::is_trivially_copyable, V> {}; + +template +struct enable_deep_copy + : public std::enable_if::value && !inspector::is_trivially_copyable, V> {}; + +template +struct enable_string_copy: public std::enable_if::value, V> {}; + + +template +struct ShallowCopyBuffer { + using type = unqualified_t; + using hdf5_type = + typename std::conditional::hdf5_type>::type, + typename inspector::hdf5_type>::type; + + ShallowCopyBuffer() = delete; + + explicit ShallowCopyBuffer(typename std::conditional::type val) + : ptr(inspector::data(val)){}; + + hdf5_type* getPointer() const { + return ptr; + } + + hdf5_type* begin() const { + return getPointer(); + } + + void unserialize(T& /* val */) const { + /* nothing to do. */ + } + + private: + hdf5_type* ptr; +}; + +template +struct DeepCopyBuffer { + using type = unqualified_t; + using hdf5_type = typename inspector::hdf5_type; + + explicit DeepCopyBuffer(const std::vector& _dims) + : buffer(inspector::getSize(_dims)) + , dims(_dims) {} + + hdf5_type* getPointer() { + return buffer.data(); + } + + hdf5_type const* getPointer() const { + return buffer.data(); + } + + hdf5_type* begin() { + return getPointer(); + } + + hdf5_type const* begin() const { + return getPointer(); + } + + void unserialize(T& val) const { + inspector::unserialize(buffer.data(), dims, val); + } + + private: + std::vector buffer; + std::vector dims; +}; + +enum class BufferMode { Read, Write }; + + +/// +/// \brief String length in bytes excluding the `\0`. +/// +inline size_t char_buffer_size(char const* const str, size_t max_string_length) { + for (size_t i = 0; i <= max_string_length; ++i) { + if (str[i] == '\0') { + return i; + } + } + + return max_string_length; +} + + +/// +/// \brief A buffer for reading/writing strings. +/// +/// A string in HDF5 can be represented as a fixed or variable length string. +/// The important difference for this buffer is that `H5D{read,write}` expects +/// different input depending on whether the strings are fixed or variable length. +/// For fixed length strings, it expects an array of chars, i.e. one string +/// packed after the other contiguously. While for variable length strings it +/// expects a list of pointers to the beginning of each string. Variable length +/// string must be null-terminated; because that's how their length is +/// determined. +/// +/// This buffer hides the difference between fixed and variable length strings +/// by having internal data structures available for both cases at compile time. +/// The choice which internal buffer to use is made at runtime. +/// +/// Consider an HDF5 dataset with N fixed-length strings, each of which is M +/// characters long. Then the in-memory strings are copied into an internal +/// buffer of size N*M. If null- or space-padded the buffer should be filled +/// with the appropriate character. This is important if the in-memory strings +/// are less than M characters long. +/// +/// An HDF5 dataset with N variable-length strings (all null-terminated) uses +/// the internal list of pointers to the beginning of each string. Those +/// pointers can either point to the in-memory strings themselves, if those +/// strings are known to be null-terminated. Otherwise the in-memory strings are +/// copied to an internal buffer of null-terminated strings; and the pointer +/// points to the start of the string in the internal buffer. +/// +/// This class is responsible for arranging the strings properly before passing +/// the buffers to HDF5. To keep this class generic, it provides a generic +/// read/write interface to the internal strings, i.e. a pointer with a size. +/// For reading from the buffer the proxy is called `StringConstView`. This +/// proxy object is to be used by the `inspector` to copy from the buffer into +/// the final destination, e.g. an `std::string`. Similarly, there's a proxy +/// object for serializing into the buffer, i.e. the `StringView`. Again the +/// `inspector` is responsible for obtaining the pointer, size and padding of +/// the string. +/// +/// Nomenclature: +/// - size of a string is the number of bytes required to store the string, +/// including the null character for null-terminated strings. +/// +/// - length of a string is the number of bytes without the null character. +/// +/// Note: both 'length' and 'size' are counted in number of bytes, not number +/// of symbols or characters. Even for UTF8 strings. +template +struct StringBuffer { + using type = unqualified_t; + using hdf5_type = typename inspector::hdf5_type; + + class StringView { + public: + StringView(StringBuffer& _buffer, size_t _i) + : buffer(_buffer) + , i(_i) {} + + /// + /// \brief Assign the in-memory string to the buffer. + /// + /// This method copies the in-memory string to the appropriate + /// internal buffer as needed. + /// + /// The `length` is the length of the string in bytes. + void assign(char const* data, size_t length, StringPadding padding) { + if (buffer.isVariableLengthString()) { + if (padding == StringPadding::NullTerminated) { + buffer.variable_length_pointers[i] = data; + } else { + buffer.variable_length_buffer[i] = std::string(data, length); + buffer.variable_length_pointers[i] = buffer.variable_length_buffer[i].data(); + } + } else if (buffer.isFixedLengthString()) { + // If the buffer is fixed-length and null-terminated, then + // `buffer.string_length` doesn't include the null-character. + if (length > buffer.string_length) { + throw std::invalid_argument("String length too big."); + } + + memcpy(&buffer.fixed_length_buffer[i * buffer.string_size], data, length); + } + } + + private: + StringBuffer& buffer; + size_t i; + }; + + + class StringConstView { + public: + StringConstView(const StringBuffer& _buffer, size_t _i) + : buffer(_buffer) + , i(_i) {} + + /// \brief Pointer to the first byte of the string. + /// + /// The valid indices for this pointer are: 0, ..., length() - 1. + char const* data() const { + if (buffer.isVariableLengthString()) { + return buffer.variable_length_pointers[i]; + } else { + return &buffer.fixed_length_buffer[i * buffer.string_size]; + } + } + + /// \brief Length of the string in bytes. + /// + /// Note that for null-terminated strings the "length" doesn't include + /// the null character. Hence, if storing this string as a + /// null-terminated string, the destination buffer needs to be at least + /// `length() + 1` bytes long. + size_t length() const { + if (buffer.isNullTerminated()) { + return char_buffer_size(data(), buffer.string_length); + } else { + return buffer.string_length; + } + } + + private: + const StringBuffer& buffer; + size_t i; + }; + + + class Iterator { + public: + Iterator(StringBuffer& _buffer, size_t _pos) + : buffer(_buffer) + , pos(_pos) {} + + Iterator operator+(size_t n_strings) const { + return Iterator(buffer, pos + n_strings); + } + + void operator+=(size_t n_strings) { + pos += n_strings; + } + + StringView operator*() { + return StringView(buffer, pos); + } + + StringConstView operator*() const { + return StringConstView(buffer, pos); + } + + private: + StringBuffer& buffer; + size_t pos; + }; + + StringBuffer(std::vector _dims, const DataType& _file_datatype) + : file_datatype(_file_datatype.asStringType()) + , padding(file_datatype.getPadding()) + , string_size(file_datatype.isVariableStr() ? size_t(-1) : file_datatype.getSize()) + , string_length(string_size - size_t(isNullTerminated())) + , dims(_dims) { + if (string_size == 0 && isNullTerminated()) { + throw DataTypeException( + "Fixed-length, null-terminated need at least one byte to store the " + "null-character."); + } + + auto n_strings = compute_total_size(dims); + if (isVariableLengthString()) { + variable_length_buffer.resize(n_strings); + variable_length_pointers.resize(n_strings); + } else { + char pad = padding == StringPadding::SpacePadded ? ' ' : '\0'; + fixed_length_buffer.assign(n_strings * string_size, pad); + } + } + + bool isVariableLengthString() const { + return file_datatype.isVariableStr(); + } + + bool isFixedLengthString() const { + return file_datatype.isFixedLenStr(); + } + + bool isNullTerminated() const { + return file_datatype.getPadding() == StringPadding::NullTerminated; + } + + + void* getPointer() { + if (file_datatype.isVariableStr()) { + return variable_length_pointers.data(); + } else { + return fixed_length_buffer.data(); + } + } + + Iterator begin() { + return Iterator(*this, 0ul); + } + + void unserialize(T& val) { + inspector::unserialize(begin(), dims, val); + } + + private: + StringType file_datatype; + StringPadding padding; + size_t string_size; // Size of buffer required to store the string. + // Meaningful for fixed length strings only. + size_t string_length; // Semantic length of string. + std::vector dims; + + std::vector fixed_length_buffer; + std::vector variable_length_buffer; + std::vector< + typename std::conditional::type*> + variable_length_pointers; +}; + + +template +struct Writer; + +template +struct Writer::type>: public ShallowCopyBuffer { + private: + using super = ShallowCopyBuffer; + + public: + explicit Writer(const T& val, const DataType& /* file_datatype */) + : super(val){}; +}; + +template +struct Writer::type>: public DeepCopyBuffer { + explicit Writer(const T& val, const DataType& /* file_datatype */) + : DeepCopyBuffer(inspector::getDimensions(val)) { + inspector::serialize(val, this->begin()); + } +}; + +template +struct Writer::type>: public StringBuffer { + explicit Writer(const T& val, const DataType& _file_datatype) + : StringBuffer(inspector::getDimensions(val), _file_datatype) { + inspector::serialize(val, this->begin()); + } +}; + +template +struct Reader; + +template +struct Reader::type>: public ShallowCopyBuffer { + private: + using super = ShallowCopyBuffer; + using type = typename super::type; + + public: + Reader(const std::vector&, type& val, const DataType& /* file_datatype */) + : super(val) {} +}; + +template +struct Reader::type>: public DeepCopyBuffer { + private: + using super = DeepCopyBuffer; + using type = typename super::type; + + public: + Reader(const std::vector& _dims, type&, const DataType& /* file_datatype */) + : super(_dims) {} +}; + + +template +struct Reader::type>: public StringBuffer { + public: + explicit Reader(const std::vector& _dims, + const T& /* val */, + const DataType& _file_datatype) + : StringBuffer(_dims, _file_datatype) {} +}; + +struct data_converter { + template + static Writer serialize(const typename inspector::type& val, + const DataType& file_datatype) { + return Writer(val, file_datatype); + } + + template + static Reader get_reader(const std::vector& dims, + T& val, + const DataType& file_datatype) { + // TODO Use bufferinfo for recursive_ndim + auto effective_dims = details::squeezeDimensions(dims, inspector::recursive_ndim); + inspector::prepare(val, effective_dims); + return Reader(effective_dims, val, file_datatype); + } +}; + +} // namespace details +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5DataSet_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5DataSet_misc.hpp similarity index 95% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5DataSet_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5DataSet_misc.hpp index 9bf2441162..4411b4c0d4 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5DataSet_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5DataSet_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATASET_MISC_HPP -#define H5DATASET_MISC_HPP +#pragma once #include #include @@ -66,5 +65,3 @@ inline void DataSet::resize(const std::vector& dims) { } } // namespace HighFive - -#endif // H5DATASET_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5DataType_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5DataType_misc.hpp similarity index 73% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5DataType_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5DataType_misc.hpp index 2390f13e3f..8535d617ab 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5DataType_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5DataType_misc.hpp @@ -6,12 +6,14 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATATYPE_MISC_HPP -#define H5DATATYPE_MISC_HPP +#pragma once #include #include #include +#if HIGHFIVE_CXX_STD >= 17 +#include +#endif #include #include @@ -20,10 +22,68 @@ #include #endif -#include "H5Converter_misc.hpp" +#include "H5Inspector_misc.hpp" namespace HighFive { +namespace detail { + +inline hid_t h5t_copy(hid_t original) { + auto copy = H5Tcopy(original); + if (copy == H5I_INVALID_HID) { + HDF5ErrMapper::ToException("Error copying datatype."); + } + + return copy; +} + +inline hsize_t h5t_get_size(hid_t hid) { + hsize_t size = H5Tget_size(hid); + if (size == 0) { + HDF5ErrMapper::ToException("Error getting size of datatype."); + } + + return size; +} + +inline H5T_cset_t h5t_get_cset(hid_t hid) { + auto cset = H5Tget_cset(hid); + if (cset == H5T_CSET_ERROR) { + HDF5ErrMapper::ToException("Error getting cset of datatype."); + } + + return cset; +} + +inline H5T_str_t h5t_get_strpad(hid_t hid) { + auto strpad = H5Tget_strpad(hid); + if (strpad == H5T_STR_ERROR) { + HDF5ErrMapper::ToException("Error getting strpad of datatype."); + } + + return strpad; +} + +inline void h5t_set_size(hid_t hid, hsize_t size) { + if (H5Tset_size(hid, size) < 0) { + HDF5ErrMapper::ToException("Error setting size of datatype."); + } +} + +inline void h5t_set_cset(hid_t hid, H5T_cset_t cset) { + if (H5Tset_cset(hid, cset) < 0) { + HDF5ErrMapper::ToException("Error setting cset of datatype."); + } +} + +inline void h5t_set_strpad(hid_t hid, H5T_str_t strpad) { + if (H5Tset_strpad(hid, strpad) < 0) { + HDF5ErrMapper::ToException("Error setting strpad of datatype."); + } +} +} // namespace detail + + namespace { // unnamed inline DataTypeClass convert_type_class(const H5T_class_t& tclass); inline std::string type_class_string(DataTypeClass); @@ -39,7 +99,7 @@ inline DataTypeClass DataType::getClass() const { } inline size_t DataType::getSize() const { - return H5Tget_size(_hid); + return detail::h5t_get_size(_hid); } inline bool DataType::operator==(const DataType& other) const { @@ -66,68 +126,110 @@ inline bool DataType::isReference() const { return H5Tequal(_hid, H5T_STD_REF_OBJ) > 0; } +inline StringType DataType::asStringType() const { + if (getClass() != DataTypeClass::String) { + throw DataTypeException("Invalid conversion to StringType."); + } + + if (isValid() && H5Iinc_ref(_hid) < 0) { + throw ObjectException("Reference counter increase failure"); + } + + return StringType(_hid); +} + inline std::string DataType::string() const { return type_class_string(getClass()) + std::to_string(getSize() * 8); } +inline StringPadding StringType::getPadding() const { + return StringPadding(detail::h5t_get_strpad(_hid)); +} + +inline CharacterSet StringType::getCharacterSet() const { + return CharacterSet(detail::h5t_get_cset(_hid)); +} + +inline FixedLengthStringType::FixedLengthStringType(size_t size, + StringPadding padding, + CharacterSet character_set) { + if (size == 0 && padding == StringPadding::NullTerminated) { + throw DataTypeException( + "Fixed-length, null-terminated need at least one byte to store the null-character."); + } + + _hid = detail::h5t_copy(H5T_C_S1); + + detail::h5t_set_size(_hid, hsize_t(size)); + detail::h5t_set_cset(_hid, H5T_cset_t(character_set)); + detail::h5t_set_strpad(_hid, H5T_str_t(padding)); +} + +inline VariableLengthStringType::VariableLengthStringType(CharacterSet character_set) { + _hid = detail::h5t_copy(H5T_C_S1); + + detail::h5t_set_size(_hid, H5T_VARIABLE); + detail::h5t_set_cset(_hid, H5T_cset_t(character_set)); +} + // char mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_CHAR); + _hid = detail::h5t_copy(H5T_NATIVE_CHAR); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_SCHAR); + _hid = detail::h5t_copy(H5T_NATIVE_SCHAR); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_UCHAR); + _hid = detail::h5t_copy(H5T_NATIVE_UCHAR); } // short mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_SHORT); + _hid = detail::h5t_copy(H5T_NATIVE_SHORT); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_USHORT); + _hid = detail::h5t_copy(H5T_NATIVE_USHORT); } // integer mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_INT); + _hid = detail::h5t_copy(H5T_NATIVE_INT); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_UINT); + _hid = detail::h5t_copy(H5T_NATIVE_UINT); } // long mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_LONG); + _hid = detail::h5t_copy(H5T_NATIVE_LONG); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_ULONG); + _hid = detail::h5t_copy(H5T_NATIVE_ULONG); } // long long mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_LLONG); + _hid = detail::h5t_copy(H5T_NATIVE_LLONG); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_ULLONG); + _hid = detail::h5t_copy(H5T_NATIVE_ULLONG); } // half-float, float, double and long double mapping @@ -136,11 +238,11 @@ using float16_t = half_float::half; template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_FLOAT); + _hid = detail::h5t_copy(H5T_NATIVE_FLOAT); // Sign position, exponent position, exponent size, mantissa position, mantissa size H5Tset_fields(_hid, 15, 10, 5, 0, 10); // Total datatype size (in bytes) - H5Tset_size(_hid, 2); + detail::h5t_set_size(_hid, 2); // Floating point exponent bias H5Tset_ebias(_hid, 15); } @@ -148,23 +250,17 @@ inline AtomicType::AtomicType() { template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_FLOAT); + _hid = detail::h5t_copy(H5T_NATIVE_FLOAT); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_DOUBLE); + _hid = detail::h5t_copy(H5T_NATIVE_DOUBLE); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_LDOUBLE); -} - -// boolean mapping -template <> -inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_HBOOL); + _hid = detail::h5t_copy(H5T_NATIVE_LDOUBLE); } // std string @@ -173,6 +269,14 @@ inline AtomicType::AtomicType() { _hid = create_string(H5T_VARIABLE); } +#if HIGHFIVE_CXX_STD >= 17 +// std byte +template <> +inline AtomicType::AtomicType() { + _hid = detail::h5t_copy(H5T_NATIVE_B8); +} +#endif + // Fixed-Length strings // require class specialization templated for the char length template @@ -196,11 +300,16 @@ class AtomicType>: public DataType { : DataType( CompoundType({{"r", create_datatype(), 0}, {"i", create_datatype(), sizeof(T)}}, sizeof(std::complex))) { - static_assert(std::is_floating_point::value, - "std::complex accepts only floating point numbers."); + static_assert(std::is_arithmetic::value, + "std::complex accepts only floating point and integral numbers."); } }; +// For boolean we act as h5py +inline EnumType create_enum_boolean() { + return {{"FALSE", details::Boolean::HighFiveFalse}, {"TRUE", details::Boolean::HighFiveTrue}}; +} + // Other cases not supported. Fail early with a user message template AtomicType::AtomicType() { @@ -221,18 +330,15 @@ inline FixedLenStringArray::FixedLenStringArray(const char array[][N], std::s template inline FixedLenStringArray::FixedLenStringArray(const std::string* iter_begin, const std::string* iter_end) { - datavec.resize(static_cast(iter_end - iter_begin)); - for (auto& dst_array: datavec) { - const char* src = (iter_begin++)->c_str(); - const size_t length = std::min(N - 1, std::strlen(src)); - std::memcpy(dst_array.data(), src, length); - dst_array[length] = 0; + datavec.reserve(static_cast(iter_end - iter_begin)); + for (std::string const* it = iter_begin; it != iter_end; ++it) { + push_back(*it); } } template inline FixedLenStringArray::FixedLenStringArray(const std::vector& vec) - : FixedLenStringArray(&vec.front(), &vec.back()) {} + : FixedLenStringArray(vec.data(), vec.data() + vec.size()) {} template inline FixedLenStringArray::FixedLenStringArray( @@ -262,7 +368,7 @@ inline std::string FixedLenStringArray::getString(std::size_t i) const { // Reference mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_STD_REF_OBJ); + _hid = detail::h5t_copy(H5T_STD_REF_OBJ); } inline size_t find_first_atomic_member_size(hid_t hid) { @@ -285,7 +391,7 @@ inline size_t find_first_atomic_member_size(hid_t hid) { } else if (H5Tget_class(hid) == H5T_STRING) { return 1; } - return H5Tget_size(hid); + return detail::h5t_get_size(hid); } // Calculate the padding required to align an element of a struct @@ -316,7 +422,7 @@ inline void CompoundType::create(size_t size) { // Do a first pass to find the total size of the compound datatype for (auto& member: members) { - size_t member_size = H5Tget_size(member.base_type.getId()); + size_t member_size = detail::h5t_get_size(member.base_type.getId()); if (member_size == 0) { throw DataTypeException("Cannot get size of DataType with hid: " + @@ -384,12 +490,9 @@ inline void EnumType::commit(const Object& object, const std::string& name) c namespace { inline hid_t create_string(size_t length) { - hid_t _hid = H5Tcopy(H5T_C_S1); - if (H5Tset_size(_hid, length) < 0) { - HDF5ErrMapper::ToException("Unable to define datatype size to variable"); - } - // define encoding to UTF-8 by default - H5Tset_cset(_hid, H5T_CSET_UTF8); + hid_t _hid = detail::h5t_copy(H5T_C_S1); + detail::h5t_set_size(_hid, length); + detail::h5t_set_cset(_hid, H5T_CSET_UTF8); return _hid; } @@ -494,6 +597,4 @@ inline DataType create_and_check_datatype() { } } // namespace HighFive - - -#endif // H5DATATYPE_MISC_HPP +HIGHFIVE_REGISTER_TYPE(HighFive::details::Boolean, HighFive::create_enum_boolean) diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Dataspace_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Dataspace_misc.hpp similarity index 80% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Dataspace_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Dataspace_misc.hpp index c371a18316..0fdcacefdb 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Dataspace_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Dataspace_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATASPACE_MISC_HPP -#define H5DATASPACE_MISC_HPP +#pragma once #include #include @@ -63,9 +62,9 @@ inline DataSpace::DataSpace(const std::vector& dims, const std::vector DataSpace::getDimensions() const { } inline size_t DataSpace::getElementCount() const { - const std::vector& dims = getDimensions(); - return std::accumulate(dims.begin(), dims.end(), size_t{1u}, std::multiplies()); + hssize_t nelements = H5Sget_simple_extent_npoints(_hid); + if (nelements < 0) { + HDF5ErrMapper::ToException( + "Unable to get number of elements in dataspace"); + } + + return static_cast(nelements); } inline std::vector DataSpace::getMaxDimensions() const { @@ -142,30 +146,9 @@ inline DataSpace DataSpace::FromCharArrayStrings(const char (&)[N][Width]) { namespace details { /// dimension checks @internal -inline bool checkDimensions(const DataSpace& mem_space, size_t input_dims) { - size_t dataset_dims = mem_space.getNumberDimensions(); - if (input_dims == dataset_dims) - return true; - - const std::vector& dims = mem_space.getDimensions(); - for (auto i = dims.crbegin(); i != --dims.crend() && *i == 1; ++i) - --dataset_dims; - - if (input_dims == dataset_dims) - return true; - - dataset_dims = dims.size(); - for (auto i = dims.cbegin(); i != --dims.cend() && *i == 1; ++i) - --dataset_dims; - - if (input_dims == dataset_dims) - return true; - - // The final tests is for scalars - return input_dims == 0 && dataset_dims == 1 && dims.back() == 1; +inline bool checkDimensions(const DataSpace& mem_space, size_t n_dim_requested) { + return checkDimensions(mem_space.getDimensions(), n_dim_requested); } } // namespace details } // namespace HighFive - -#endif // H5DATASPACE_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Exception_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Exception_misc.hpp similarity index 92% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Exception_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Exception_misc.hpp index ff3839198c..f7382f2c2c 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Exception_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Exception_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EXCEPTION_MISC_HPP -#define H5EXCEPTION_MISC_HPP +#pragma once #include #include @@ -28,8 +27,8 @@ struct HDF5ErrMapper { std::ostringstream oss; oss << '(' << major_err << ") " << minor_err; - free((void*) major_err); - free((void*) minor_err); + H5free_memory((void*) major_err); + H5free_memory((void*) minor_err); auto* e = new ExceptionType(oss.str()); e->_err_major = err_desc->maj_num; @@ -61,5 +60,3 @@ struct HDF5ErrMapper { }; } // namespace HighFive - -#endif // H5OBJECT_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5FileDriver_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5FileDriver_misc.hpp similarity index 84% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5FileDriver_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5FileDriver_misc.hpp index 12a485d90c..a6331bd5a9 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5FileDriver_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5FileDriver_misc.hpp @@ -7,8 +7,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5FILEDRIVER_MISC_HPP -#define H5FILEDRIVER_MISC_HPP +#pragma once namespace HighFive { @@ -19,5 +18,3 @@ inline MPIOFileDriver::MPIOFileDriver(MPI_Comm comm, MPI_Info info) { #endif } // namespace HighFive - -#endif // H5FILEDRIVER_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5File_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5File_misc.hpp similarity index 80% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5File_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5File_misc.hpp index 5dd86cadd2..b90792a712 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5File_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5File_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5FILE_MISC_HPP -#define H5FILE_MISC_HPP +#pragma once #include @@ -93,56 +92,32 @@ inline const std::string& File::getName() const noexcept { } inline hsize_t File::getMetadataBlockSize() const { - hsize_t size; auto fapl = getAccessPropertyList(); - if (H5Pget_meta_block_size(fapl.getId(), &size) < 0) { - HDF5ErrMapper::ToException( - std::string("Unable to access file metadata block size")); - } - return size; + return MetadataBlockSize(fapl).getSize(); } inline std::pair File::getVersionBounds() const { - H5F_libver_t low; - H5F_libver_t high; auto fapl = getAccessPropertyList(); - if (H5Pget_libver_bounds(fapl.getId(), &low, &high) < 0) { - HDF5ErrMapper::ToException( - std::string("Unable to access file version bounds")); - } - return std::make_pair(low, high); + auto fileVer = FileVersionBounds(fapl); + return fileVer.getVersion(); } #if H5_VERSION_GE(1, 10, 1) inline H5F_fspace_strategy_t File::getFileSpaceStrategy() const { auto fcpl = getCreatePropertyList(); - - H5F_fspace_strategy_t strategy; - hbool_t persist; - hsize_t threshold; - - if (H5Pget_file_space_strategy(fcpl.getId(), &strategy, &persist, &threshold) < 0) { - HDF5ErrMapper::ToException(std::string("Unable to get file space strategy")); - } - - return strategy; + FileSpaceStrategy spaceStrategy(fcpl); + return spaceStrategy.getStrategy(); } inline hsize_t File::getFileSpacePageSize() const { auto fcpl = getCreatePropertyList(); - hsize_t page_size; if (getFileSpaceStrategy() != H5F_FSPACE_STRATEGY_PAGE) { HDF5ErrMapper::ToException( std::string("Cannot obtain page size as paged allocation is not used.")); } - if (H5Pget_file_space_page_size(fcpl.getId(), &page_size) < 0) { - HDF5ErrMapper::ToException( - std::string("Unable to get file space page size")); - } - - return page_size; + return FileSpacePageSize(fcpl).getPageSize(); } #endif @@ -152,6 +127,22 @@ inline void File::flush() { } } -} // namespace HighFive +inline size_t File::getFileSize() const { + hsize_t sizeValue = 0; + if (H5Fget_filesize(_hid, &sizeValue) < 0) { + HDF5ErrMapper::ToException( + std::string("Unable to retrieve size of file " + getName())); + } + return static_cast(sizeValue); +} -#endif // H5FILE_MISC_HPP +inline size_t File::getFreeSpace() const { + hssize_t unusedSize = H5Fget_freespace(_hid); + if (unusedSize < 0) { + HDF5ErrMapper::ToException( + std::string("Unable to retrieve unused space of file " + getName())); + } + return static_cast(unusedSize); +} + +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Friends.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Friends.hpp new file mode 100644 index 0000000000..d19125c7f5 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Friends.hpp @@ -0,0 +1,10 @@ +#pragma once + +#ifndef HIGHFIVE_HAS_FRIEND_DECLARATIONS +#ifdef _MSC_VER +// This prevents a compiler bug on certain versions of MSVC. +// Known to fail: Toolset 141. +// See `CMakeLists.txt` for more information. +#define HIGHFIVE_HAS_FRIEND_DECLARATIONS 1 +#endif +#endif \ No newline at end of file diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Converter_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Inspector_misc.hpp similarity index 73% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Converter_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Inspector_misc.hpp index f4b6e946b8..05ed6bc3ec 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Converter_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Inspector_misc.hpp @@ -6,12 +6,21 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ + #pragma once #include #include +#include +#include +#include +#include +#include #include "../H5Reference.hpp" + +#include "string_padding.hpp" + #ifdef H5_USE_BOOST #include // starting Boost 1.64, serialization header must come before ublas @@ -22,7 +31,100 @@ #include #endif + namespace HighFive { + +namespace details { + +inline bool checkDimensions(const std::vector& dims, size_t n_dim_requested) { + size_t n_dim_actual = dims.size(); + + // We should allow reading scalar from shapes like `(1, 1, 1)`. + if (n_dim_requested == 0) { + if (n_dim_actual == 0ul) { + return true; + } + + return size_t(std::count(dims.begin(), dims.end(), 1ul)) == n_dim_actual; + } + + // For non-scalar datasets, we can squeeze away singleton dimension, but + // we never add any. + if (n_dim_actual < n_dim_requested) { + return false; + } + + // Special case for 1-dimensional arrays, which can squeeze `1`s from either + // side simultaneously if needed. + if (n_dim_requested == 1ul) { + return n_dim_actual >= 1ul && + size_t(std::count(dims.begin(), dims.end(), 1ul)) >= n_dim_actual - 1ul; + } + + // All other cases strip front only. This avoid unstable behaviour when + // squeezing singleton dimensions. + size_t n_dim_excess = n_dim_actual - n_dim_requested; + + bool squeeze_back = true; + for (size_t i = 1; i <= n_dim_excess; ++i) { + if (dims[n_dim_actual - i] != 1) { + squeeze_back = false; + break; + } + } + + return squeeze_back; +} + + +inline std::vector squeezeDimensions(const std::vector& dims, + size_t n_dim_requested) { + auto format_error_message = [&]() -> std::string { + return "Can't interpret dims = " + format_vector(dims) + " as " + + std::to_string(n_dim_requested) + "-dimensional."; + }; + + if (n_dim_requested == 0) { + if (!checkDimensions(dims, n_dim_requested)) { + throw std::invalid_argument(format_error_message()); + } + + return {1ul}; + } + + auto n_dim = dims.size(); + if (n_dim < n_dim_requested) { + throw std::invalid_argument(format_error_message()); + } + + if (n_dim_requested == 1ul) { + size_t non_singleton_dim = size_t(-1); + for (size_t i = 0; i < n_dim; ++i) { + if (dims[i] != 1ul) { + if (non_singleton_dim == size_t(-1)) { + non_singleton_dim = i; + } else { + throw std::invalid_argument(format_error_message()); + } + } + } + + return {dims[std::min(non_singleton_dim, n_dim - 1)]}; + } + + size_t n_dim_excess = dims.size() - n_dim_requested; + for (size_t i = 1; i <= n_dim_excess; ++i) { + if (dims[n_dim - i] != 1) { + throw std::invalid_argument(format_error_message()); + } + } + + return std::vector(dims.begin(), + dims.end() - static_cast(n_dim_excess)); +} +} // namespace details + + inline size_t compute_total_size(const std::vector& dims) { return std::accumulate(dims.begin(), dims.end(), size_t{1u}, std::multiplies()); } @@ -80,8 +182,6 @@ struct type_helper { static constexpr size_t recursive_ndim = ndim; static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; - static_assert(!std::is_same::value, "Booleans are not supported yet."); - static std::vector getDimensions(const type& /* val */) { return {}; } @@ -122,6 +222,37 @@ struct type_helper { template struct inspector: type_helper {}; +enum class Boolean : int8_t { + HighFiveFalse = 0, + HighFiveTrue = 1, +}; + +template <> +struct inspector: type_helper { + using base_type = Boolean; + using hdf5_type = int8_t; + + static constexpr bool is_trivially_copyable = false; + + static hdf5_type* data(type& /* val */) { + throw DataSpaceException("A boolean cannot be read directly."); + } + + static const hdf5_type* data(const type& /* val */) { + throw DataSpaceException("A boolean cannot be written directly."); + } + + static void unserialize(const hdf5_type* vec, + const std::vector& /* dims */, + type& val) { + val = vec[0] != 0 ? true : false; + } + + static void serialize(const type& val, hdf5_type* m) { + *m = val ? 1 : 0; + } +}; + template <> struct inspector: type_helper { using hdf5_type = const char*; @@ -131,17 +262,18 @@ struct inspector: type_helper { } static const hdf5_type* data(const type& /* val */) { - throw DataSpaceException("A std::string cannot be write directly."); + throw DataSpaceException("A std::string cannot be written directly."); } - static void serialize(const type& val, hdf5_type* m) { - *m = val.c_str(); + template + static void serialize(const type& val, It m) { + (*m).assign(val.data(), val.size(), StringPadding::NullTerminated); } - static void unserialize(const hdf5_type* vec, - const std::vector& /* dims */, - type& val) { - val = vec[0]; + template + static void unserialize(const It& vec, const std::vector& /* dims */, type& val) { + const auto& view = *vec; + val.assign(view.data(), view.length()); } }; @@ -156,7 +288,7 @@ struct inspector: type_helper { } static const hdf5_type* data(const type& /* val */) { - throw DataSpaceException("A Reference cannot be write directly."); + throw DataSpaceException("A Reference cannot be written directly."); } static void serialize(const type& val, hdf5_type* m) { @@ -236,13 +368,18 @@ struct inspector> { static constexpr size_t ndim = 1; static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; static std::vector getDimensions(const type& val) { - std::vector sizes{val.size()}; + std::vector sizes(recursive_ndim, 1ul); + sizes[0] = val.size(); if (!val.empty()) { auto s = inspector::getDimensions(val[0]); - sizes.insert(sizes.end(), s.begin(), s.end()); + assert(s.size() + ndim == sizes.size()); + for (size_t i = 0; i < s.size(); ++i) { + sizes[i + ndim] = s[i]; + } } return sizes; } @@ -258,7 +395,7 @@ struct inspector> { static void prepare(type& val, const std::vector& dims) { val.resize(dims[0]); std::vector next_dims(dims.begin() + 1, dims.end()); - for (auto& e: val) { + for (auto&& e: val) { inspector::prepare(e, next_dims); } } @@ -271,17 +408,17 @@ struct inspector> { return inspector::data(val[0]); } - static void serialize(const type& val, hdf5_type* m) { + template + static void serialize(const type& val, It m) { size_t subsize = inspector::getSizeVal(val[0]); - for (auto& e: val) { + for (auto&& e: val) { inspector::serialize(e, m); m += subsize; } } - static void unserialize(const hdf5_type* vec_align, - const std::vector& dims, - type& val) { + template + static void unserialize(const It& vec_align, const std::vector& dims, type& val) { std::vector next_dims(dims.begin() + 1, dims.end()); size_t next_size = compute_total_size(next_dims); for (size_t i = 0; i < dims[0]; ++i) { @@ -290,17 +427,75 @@ struct inspector> { } }; +template <> +struct inspector> { + using type = std::vector; + using value_type = bool; + using base_type = Boolean; + using hdf5_type = uint8_t; + + static constexpr size_t ndim = 1; + static constexpr size_t recursive_ndim = ndim; + static constexpr bool is_trivially_copyable = false; + + static std::vector getDimensions(const type& val) { + std::vector sizes{val.size()}; + return sizes; + } + + static size_t getSizeVal(const type& val) { + return val.size(); + } + + static size_t getSize(const std::vector& dims) { + if (dims.size() > 1) { + throw DataSpaceException("std::vector is only 1 dimension."); + } + return dims[0]; + } + + static void prepare(type& val, const std::vector& dims) { + if (dims.size() > 1) { + throw DataSpaceException("std::vector is only 1 dimension."); + } + val.resize(dims[0]); + } + + static hdf5_type* data(type& /* val */) { + throw DataSpaceException("A std::vector cannot be read directly."); + } + + static const hdf5_type* data(const type& /* val */) { + throw DataSpaceException("A std::vector cannot be written directly."); + } + + static void serialize(const type& val, hdf5_type* m) { + for (size_t i = 0; i < val.size(); ++i) { + m[i] = val[i] ? 1 : 0; + } + } + + static void unserialize(const hdf5_type* vec_align, + const std::vector& dims, + type& val) { + for (size_t i = 0; i < dims[0]; ++i) { + val[i] = vec_align[i] != 0 ? true : false; + } + } +}; template struct inspector> { using type = std::array; - using value_type = T; + using value_type = unqualified_t; using base_type = typename inspector::base_type; using hdf5_type = typename inspector::hdf5_type; static constexpr size_t ndim = 1; static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + sizeof(type) == N * sizeof(T) && + inspector::is_trivially_copyable; static std::vector getDimensions(const type& val) { std::vector sizes{N}; @@ -335,7 +530,8 @@ struct inspector> { return inspector::data(val[0]); } - static void serialize(const type& val, hdf5_type* m) { + template + static void serialize(const type& val, It m) { size_t subsize = inspector::getSizeVal(val[0]); for (auto& e: val) { inspector::serialize(e, m); @@ -343,9 +539,8 @@ struct inspector> { } } - static void unserialize(const hdf5_type* vec_align, - const std::vector& dims, - type& val) { + template + static void unserialize(const It& vec_align, const std::vector& dims, type& val) { if (dims[0] != N) { std::ostringstream os; os << "Impossible to pair DataSet with " << dims[0] << " elements into an array with " @@ -370,7 +565,8 @@ struct inspector { static constexpr size_t ndim = 1; static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; static size_t getSizeVal(const type& /* val */) { throw DataSpaceException("Not possible to have size of a T*"); @@ -401,7 +597,8 @@ struct inspector { static constexpr size_t ndim = 1; static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; static size_t getSizeVal(const type& val) { return compute_total_size(getDimensions(val)); @@ -440,9 +637,21 @@ struct inspector> { static constexpr size_t ndim = 2; static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; + + + static void assert_not_buggy(Eigen::Index nrows, Eigen::Index ncols) { + if (nrows > 1 && ncols > 1) { + throw std::runtime_error( + "HighFive has been broken for Eigen::Matrix. Please check " + "https://github.com/BlueBrain/HighFive/issues/532."); + } + } static std::vector getDimensions(const type& val) { + assert_not_buggy(val.rows(), val.cols()); + std::vector sizes{static_cast(val.rows()), static_cast(val.cols())}; auto s = inspector::getDimensions(val.data()[0]); sizes.insert(sizes.end(), s.begin(), s.end()); @@ -463,23 +672,29 @@ struct inspector> { val.resize(static_cast(dims[0]), static_cast(dims[1])); } + + assert_not_buggy(val.rows(), val.cols()); } static hdf5_type* data(type& val) { + assert_not_buggy(val.rows(), val.cols()); return inspector::data(*val.data()); } static const hdf5_type* data(const type& val) { + assert_not_buggy(val.rows(), val.cols()); return inspector::data(*val.data()); } static void serialize(const type& val, hdf5_type* m) { + assert_not_buggy(val.rows(), val.cols()); std::memcpy(m, val.data(), static_cast(val.size()) * sizeof(hdf5_type)); } static void unserialize(const hdf5_type* vec_align, const std::vector& dims, type& val) { + assert_not_buggy(val.rows(), val.cols()); if (dims.size() < 2) { std::ostringstream os; os << "Impossible to pair DataSet with " << dims.size() @@ -501,7 +716,8 @@ struct inspector> { static constexpr size_t ndim = Dims; static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; static std::vector getDimensions(const type& val) { std::vector sizes; @@ -549,7 +765,8 @@ struct inspector> { return inspector::data(*val.data()); } - static void serialize(const type& val, hdf5_type* m) { + template + static void serialize(const type& val, It m) { size_t size = val.num_elements(); size_t subsize = inspector::getSizeVal(*val.origin()); for (size_t i = 0; i < size; ++i) { @@ -557,9 +774,8 @@ struct inspector> { } } - static void unserialize(const hdf5_type* vec_align, - const std::vector& dims, - type& val) { + template + static void unserialize(It vec_align, const std::vector& dims, type& val) { std::vector next_dims(dims.begin() + ndim, dims.end()); size_t subsize = compute_total_size(next_dims); for (size_t i = 0; i < val.num_elements(); ++i) { @@ -579,7 +795,8 @@ struct inspector> { static constexpr size_t ndim = 2; static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; static std::vector getDimensions(const type& val) { std::vector sizes{val.size1(), val.size2()}; @@ -637,85 +854,5 @@ struct inspector> { }; #endif -template -struct Writer { - using hdf5_type = typename inspector::hdf5_type; - const hdf5_type* get_pointer() { - if (vec.empty()) { - return ptr; - } else { - return vec.data(); - } - } - std::vector vec{}; - const hdf5_type* ptr{nullptr}; -}; - -template -struct Reader { - using type = unqualified_t; - using hdf5_type = typename inspector::hdf5_type; - - Reader(const std::vector& _dims, type& _val) - : dims(_dims) - , val(_val) {} - - hdf5_type* get_pointer() { - if (vec.empty()) { - return inspector::data(val); - } else { - return vec.data(); - } - } - - void unserialize() { - if (!vec.empty()) { - inspector::unserialize(vec.data(), dims, val); - } - } - - std::vector dims{}; - std::vector vec{}; - type& val{}; -}; - -struct data_converter { - template - static typename std::enable_if::is_trivially_copyable, Writer>::type serialize( - const typename inspector::type& val) { - Writer w; - w.ptr = inspector::data(val); - return w; - } - - template - static typename std::enable_if::is_trivially_copyable, Writer>::type serialize( - const typename inspector::type& val) { - Writer w; - w.vec.resize(inspector::getSizeVal(val)); - inspector::serialize(val, w.vec.data()); - return w; - } - - template - static - typename std::enable_if>::is_trivially_copyable, Reader>::type - get_reader(const std::vector& dims, T& val) { - Reader r(dims, val); - inspector::prepare(r.val, dims); - return r; - } - - template - static typename std::enable_if>::is_trivially_copyable, - Reader>::type - get_reader(const std::vector& dims, T& val) { - Reader r(dims, val); - inspector::prepare(r.val, dims); - r.vec.resize(inspector::getSize(dims)); - return r; - } -}; - } // namespace details } // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Iterables_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Iterables_misc.hpp similarity index 93% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Iterables_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Iterables_misc.hpp index e28cf313bd..38ebda9ab5 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Iterables_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Iterables_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5ITERABLE_MISC_HPP -#define H5ITERABLE_MISC_HPP +#pragma once #include #include @@ -53,5 +52,3 @@ inline herr_t internal_high_five_iterate(hid_t /*id*/, } // namespace details } // namespace HighFive - -#endif // H5ITERABLE_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Node_traits.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Node_traits.hpp similarity index 79% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Node_traits.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Node_traits.hpp index 949fd107ca..d53d3f0488 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Node_traits.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Node_traits.hpp @@ -6,16 +6,21 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5NODE_TRAITS_HPP -#define H5NODE_TRAITS_HPP +#pragma once #include #include "../H5PropertyList.hpp" #include "H5_definitions.hpp" +#include "H5Converter_misc.hpp" namespace HighFive { +enum class IndexType : std::underlying_type::type { + NAME = H5_INDEX_NAME, + CRT_ORDER = H5_INDEX_CRT_ORDER, +}; + /// /// \brief NodeTraits: Base class for Group and File /// @@ -48,7 +53,20 @@ class NodeTraits { /// \param accessProps A property list with data set access properties /// \param parents Create intermediate groups if needed. Default: true. /// \return DataSet Object - template + template ::base_type, details::Boolean>::value, + int>::type* = nullptr> + DataSet createDataSet(const std::string& dataset_name, + const DataSpace& space, + const DataSetCreateProps& createProps = DataSetCreateProps::Default(), + const DataSetAccessProps& accessProps = DataSetAccessProps::Default(), + bool parents = true); + + template ::base_type, details::Boolean>::value, + int>::type* = nullptr> DataSet createDataSet(const std::string& dataset_name, const DataSpace& space, const DataSetCreateProps& createProps = DataSetCreateProps::Default(), @@ -111,6 +129,14 @@ class NodeTraits { /// \return the group object Group getGroup(const std::string& group_name) const; + /// + /// \brief open a commited datatype with the name type_name + /// \param type_name + /// \return the datatype object + DataType getDataType( + const std::string& type_name, + const DataTypeAccessProps& accessProps = DataTypeAccessProps::Default()) const; + /// /// \brief return the number of leaf objects of the node / group /// \return number of leaf objects @@ -133,8 +159,11 @@ class NodeTraits { /// /// \brief list all leaf objects name of the node / group + /// \param idx_type tell if the list should be ordered by Name or CreationOrderTime. + /// CreationOrderTime can be use only if the file/group has been created with + /// the HighFive::LinkCreationTime property. /// \return number of leaf objects - std::vector listObjectNames() const; + std::vector listObjectNames(IndexType idx_type = IndexType::NAME) const; /// /// \brief check a dataset or group exists in the current node / group @@ -187,6 +216,20 @@ class NodeTraits { const LinkAccessProps& linkAccessProps = LinkAccessProps(), const bool parents = true); + /// + /// \brief Creates hardlinks + /// \param link_name The name of the link + /// \param target_obj The target object + /// \param linkCreateProps A Link_Create property list. Notice "parents=true" overrides + /// \param linkAccessProps The Link_Access property list + /// \param parents Whether parent groups should be created: Default: true + template + void createHardLink(const std::string& link_name, + const T& target_obj, + LinkCreateProps linkCreateProps = LinkCreateProps(), + const LinkAccessProps& linkAccessProps = LinkAccessProps(), + const bool parents = true); + private: using derivate_type = Derivate; @@ -213,6 +256,3 @@ enum class LinkType { } // namespace HighFive - - -#endif // H5NODE_TRAITS_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Node_traits_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Node_traits_misc.hpp similarity index 81% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Node_traits_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Node_traits_misc.hpp index 524f075f88..2f75ff3111 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Node_traits_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Node_traits_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5NODE_TRAITS_MISC_HPP -#define H5NODE_TRAITS_MISC_HPP +#pragma once #include #include @@ -42,8 +41,8 @@ inline DataSet NodeTraits::createDataSet(const std::string& dataset_na lcpl.add(CreateIntermediateGroup(parents)); const auto hid = H5Dcreate2(static_cast(this)->getId(), dataset_name.c_str(), - dtype._hid, - space._hid, + dtype.getId(), + space.getId(), lcpl.getId(), createProps.getId(), accessProps.getId()); @@ -55,14 +54,35 @@ inline DataSet NodeTraits::createDataSet(const std::string& dataset_na } template -template +template ::base_type, details::Boolean>::value, + int>::type*> +inline DataSet NodeTraits::createDataSet(const std::string& dataset_name, + const DataSpace& space, + const DataSetCreateProps& createProps, + const DataSetAccessProps& accessProps, + bool parents) { + return createDataSet(dataset_name, + space, + create_and_check_datatype::base_type>(), + createProps, + accessProps, + parents); +} + +template +template ::base_type, details::Boolean>::value, + int>::type*> inline DataSet NodeTraits::createDataSet(const std::string& dataset_name, const DataSpace& space, const DataSetCreateProps& createProps, const DataSetAccessProps& accessProps, bool parents) { return createDataSet( - dataset_name, space, create_and_check_datatype(), createProps, accessProps, parents); + dataset_name, space, create_and_check_datatype(), createProps, accessProps, parents); } template @@ -122,7 +142,7 @@ inline Group NodeTraits::createGroup(const std::string& group_name, bo HDF5ErrMapper::ToException(std::string("Unable to create the group \"") + group_name + "\":"); } - return Group(hid); + return detail::make_group(hid); } template @@ -140,7 +160,7 @@ inline Group NodeTraits::createGroup(const std::string& group_name, HDF5ErrMapper::ToException(std::string("Unable to create the group \"") + group_name + "\":"); } - return Group(hid); + return detail::make_group(hid); } template @@ -151,7 +171,20 @@ inline Group NodeTraits::getGroup(const std::string& group_name) const HDF5ErrMapper::ToException(std::string("Unable to open the group \"") + group_name + "\":"); } - return Group(hid); + return detail::make_group(hid); +} + +template +inline DataType NodeTraits::getDataType(const std::string& type_name, + const DataTypeAccessProps& accessProps) const { + const auto hid = H5Topen2(static_cast(this)->getId(), + type_name.c_str(), + accessProps.getId()); + if (hid < 0) { + HDF5ErrMapper::ToException( + std::string("Unable to open the datatype \"") + type_name + "\":"); + } + return DataType(hid); } template @@ -199,7 +232,7 @@ inline bool NodeTraits::rename(const std::string& src_path, } template -inline std::vector NodeTraits::listObjectNames() const { +inline std::vector NodeTraits::listObjectNames(IndexType idx_type) const { std::vector names; details::HighFiveIterateData iterateData(names); @@ -207,7 +240,7 @@ inline std::vector NodeTraits::listObjectNames() const { names.reserve(num_objs); if (H5Literate(static_cast(this)->getId(), - H5_INDEX_NAME, + static_cast(idx_type), H5_ITER_INC, NULL, &details::internal_high_five_iterate, @@ -338,6 +371,29 @@ inline void NodeTraits::createExternalLink(const std::string& link_nam } } +template +template +inline void NodeTraits::createHardLink(const std::string& link_name, + const T& target_obj, + LinkCreateProps linkCreateProps, + const LinkAccessProps& linkAccessProps, + const bool parents) { + static_assert(!std::is_same::value, + "hdf5 doesn't support hard links to Attributes"); + if (parents) { + linkCreateProps.add(CreateIntermediateGroup{}); + } + auto status = H5Lcreate_hard(target_obj.getId(), + ".", + static_cast(this)->getId(), + link_name.c_str(), + linkCreateProps.getId(), + linkAccessProps.getId()); + if (status < 0) { + HDF5ErrMapper::ToException(std::string("Unable to create hard link: ")); + } +} + template inline Object NodeTraits::_open(const std::string& node_name, @@ -349,10 +405,8 @@ inline Object NodeTraits::_open(const std::string& node_name, HDF5ErrMapper::ToException(std::string("Unable to open \"") + node_name + "\":"); } - return Object(id); + return detail::make_object(id); } } // namespace HighFive - -#endif // H5NODE_TRAITS_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Object_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Object_misc.hpp similarity index 91% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Object_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Object_misc.hpp index 31927485c5..f477d7fdf3 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Object_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Object_misc.hpp @@ -6,12 +6,20 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5OBJECT_MISC_HPP -#define H5OBJECT_MISC_HPP +#pragma once #include +#include "../H5Exception.hpp" +#include "../H5Utility.hpp" + namespace HighFive { +namespace detail { +inline Object make_object(hid_t hid) { + return Object(hid); +} +} // namespace detail + inline Object::Object() : _hid(H5I_INVALID_HID) {} @@ -46,7 +54,7 @@ inline Object& Object::operator=(const Object& other) { inline Object::~Object() { if (isValid() && H5Idec_ref(_hid) < 0) { - std::cerr << "HighFive::~Object: reference counter decrease failure" << std::endl; + HIGHFIVE_LOG_ERROR("HighFive::~Object: reference counter decrease failure"); } } @@ -113,5 +121,3 @@ inline time_t ObjectInfo::getModificationTime() const noexcept { } // namespace HighFive - -#endif // H5OBJECT_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Path_traits.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Path_traits.hpp similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Path_traits.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Path_traits.hpp diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Path_traits_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Path_traits_misc.hpp similarity index 95% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Path_traits_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Path_traits_misc.hpp index 73704f03af..444e9294bf 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Path_traits_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Path_traits_misc.hpp @@ -34,7 +34,7 @@ inline PathTraits::PathTraits() { template inline std::string PathTraits::getPath() const { return details::get_name([this](char* buffer, size_t length) { - return H5Iget_name(static_cast(this)->getId(), buffer, length); + return H5Iget_name(static_cast(*this).getId(), buffer, length); }); } diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5PropertyList_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5PropertyList_misc.hpp new file mode 100644 index 0000000000..cef301e53a --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5PropertyList_misc.hpp @@ -0,0 +1,574 @@ +/* + * Copyright (c), 2017-2018, Adrien Devresse + * Juan Hernando + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#pragma once + +#include + +namespace HighFive { + +namespace { +inline hid_t convert_plist_type(PropertyType propertyType) { + // The HP5_XXX are macros with function calls so we can't assign + // them as the enum values + switch (propertyType) { + case PropertyType::OBJECT_CREATE: + return H5P_OBJECT_CREATE; + case PropertyType::FILE_CREATE: + return H5P_FILE_CREATE; + case PropertyType::FILE_ACCESS: + return H5P_FILE_ACCESS; + case PropertyType::DATASET_CREATE: + return H5P_DATASET_CREATE; + case PropertyType::DATASET_ACCESS: + return H5P_DATASET_ACCESS; + case PropertyType::DATASET_XFER: + return H5P_DATASET_XFER; + case PropertyType::GROUP_CREATE: + return H5P_GROUP_CREATE; + case PropertyType::GROUP_ACCESS: + return H5P_GROUP_ACCESS; + case PropertyType::DATATYPE_CREATE: + return H5P_DATATYPE_CREATE; + case PropertyType::DATATYPE_ACCESS: + return H5P_DATATYPE_ACCESS; + case PropertyType::STRING_CREATE: + return H5P_STRING_CREATE; + case PropertyType::ATTRIBUTE_CREATE: + return H5P_ATTRIBUTE_CREATE; + case PropertyType::OBJECT_COPY: + return H5P_OBJECT_COPY; + case PropertyType::LINK_CREATE: + return H5P_LINK_CREATE; + case PropertyType::LINK_ACCESS: + return H5P_LINK_ACCESS; + default: + HDF5ErrMapper::ToException("Unsupported property list type"); + } +} + +} // namespace + + +inline PropertyListBase::PropertyListBase() noexcept + : Object(H5P_DEFAULT) {} + + +template +inline void PropertyList::_initializeIfNeeded() { + if (_hid != H5P_DEFAULT) { + return; + } + if ((_hid = H5Pcreate(convert_plist_type(T))) < 0) { + HDF5ErrMapper::ToException("Unable to create property list"); + } +} + +template +template +inline void PropertyList::add(const P& property) { + _initializeIfNeeded(); + property.apply(_hid); +} + +template +template +inline void RawPropertyList::add(const F& funct, const Args&... args) { + this->_initializeIfNeeded(); + if (funct(this->_hid, args...) < 0) { + HDF5ErrMapper::ToException("Error setting raw hdf5 property."); + } +} + +// Specific options to be added to Property Lists +#if H5_VERSION_GE(1, 10, 1) +inline FileSpaceStrategy::FileSpaceStrategy(H5F_fspace_strategy_t strategy, + hbool_t persist, + hsize_t threshold) + : _strategy(strategy) + , _persist(persist) + , _threshold(threshold) {} + +inline FileSpaceStrategy::FileSpaceStrategy(const FileCreateProps& fcpl) { + if (H5Pget_file_space_strategy(fcpl.getId(), &_strategy, &_persist, &_threshold) < 0) { + HDF5ErrMapper::ToException("Unable to get file space strategy"); + } +} + +inline void FileSpaceStrategy::apply(const hid_t list) const { + if (H5Pset_file_space_strategy(list, _strategy, _persist, _threshold) < 0) { + HDF5ErrMapper::ToException("Error setting file space strategy."); + } +} + +inline H5F_fspace_strategy_t FileSpaceStrategy::getStrategy() const { + return _strategy; +} + +inline hbool_t FileSpaceStrategy::getPersist() const { + return _persist; +} + +inline hsize_t FileSpaceStrategy::getThreshold() const { + return _threshold; +} + +inline FileSpacePageSize::FileSpacePageSize(hsize_t page_size) + : _page_size(page_size) {} + +inline void FileSpacePageSize::apply(const hid_t list) const { + if (H5Pset_file_space_page_size(list, _page_size) < 0) { + HDF5ErrMapper::ToException("Error setting file space page size."); + } +} + +inline FileSpacePageSize::FileSpacePageSize(const FileCreateProps& fcpl) { + if (H5Pget_file_space_page_size(fcpl.getId(), &_page_size) < 0) { + HDF5ErrMapper::ToException("Unable to get file space page size"); + } +} + +inline hsize_t FileSpacePageSize::getPageSize() const { + return _page_size; +} + +#ifndef H5_HAVE_PARALLEL +inline PageBufferSize::PageBufferSize(size_t page_buffer_size, + unsigned min_meta_percent, + unsigned min_raw_percent) + : _page_buffer_size(page_buffer_size) + , _min_meta(min_meta_percent) + , _min_raw(min_raw_percent) {} + +inline PageBufferSize::PageBufferSize(const FileAccessProps& plist) { + if (H5Pget_page_buffer_size(plist.getId(), &_page_buffer_size, &_min_meta, &_min_raw) < 0) { + HDF5ErrMapper::ToException("Error setting page buffer size."); + } +} + +inline void PageBufferSize::apply(const hid_t list) const { + if (H5Pset_page_buffer_size(list, _page_buffer_size, _min_meta, _min_raw) < 0) { + HDF5ErrMapper::ToException("Error setting page buffer size."); + } +} + +inline size_t PageBufferSize::getPageBufferSize() const { + return _page_buffer_size; +} + +inline unsigned PageBufferSize::getMinMetaPercent() const { + return _min_meta; +} + +inline unsigned PageBufferSize::getMinRawPercent() const { + return _min_raw; +} +#endif +#endif + +#ifdef H5_HAVE_PARALLEL + +inline MPIOFileAccess::MPIOFileAccess(MPI_Comm comm, MPI_Info info) + : _comm(comm) + , _info(info) {} + +inline void MPIOFileAccess::apply(const hid_t list) const { + if (H5Pset_fapl_mpio(list, _comm, _info) < 0) { + HDF5ErrMapper::ToException("Unable to set-up MPIO Driver configuration"); + } +} + +inline void MPIOCollectiveMetadata::apply(const hid_t plist) const { + auto read = MPIOCollectiveMetadataRead{collective_read_}; + auto write = MPIOCollectiveMetadataWrite{collective_write_}; + + read.apply(plist); + write.apply(plist); +} + +inline MPIOCollectiveMetadata::MPIOCollectiveMetadata(bool collective) + : collective_read_(collective) + , collective_write_(collective) {} + + +inline MPIOCollectiveMetadata::MPIOCollectiveMetadata(const FileAccessProps& plist) + : collective_read_(MPIOCollectiveMetadataRead(plist).isCollective()) + , collective_write_(MPIOCollectiveMetadataWrite(plist).isCollective()) {} + +inline bool MPIOCollectiveMetadata::isCollectiveRead() const { + return collective_read_; +} + +inline bool MPIOCollectiveMetadata::isCollectiveWrite() const { + return collective_write_; +} + + +inline void MPIOCollectiveMetadataRead::apply(const hid_t plist) const { + if (H5Pset_all_coll_metadata_ops(plist, collective_) < 0) { + HDF5ErrMapper::ToException("Unable to request collective metadata reads"); + } +} + +inline bool MPIOCollectiveMetadataRead::isCollective() const { + return collective_; +} + +inline MPIOCollectiveMetadataRead::MPIOCollectiveMetadataRead(const FileAccessProps& plist) { + if (H5Pget_all_coll_metadata_ops(plist.getId(), &collective_) < 0) { + HDF5ErrMapper::ToException("Error loading MPI metadata read."); + } +} + +inline MPIOCollectiveMetadataRead::MPIOCollectiveMetadataRead(bool collective) + : collective_(collective) {} + +inline void MPIOCollectiveMetadataWrite::apply(const hid_t plist) const { + if (H5Pset_coll_metadata_write(plist, collective_) < 0) { + HDF5ErrMapper::ToException("Unable to request collective metadata writes"); + } +} + +inline bool MPIOCollectiveMetadataWrite::isCollective() const { + return collective_; +} + +inline MPIOCollectiveMetadataWrite::MPIOCollectiveMetadataWrite(const FileAccessProps& plist) { + if (H5Pget_coll_metadata_write(plist.getId(), &collective_) < 0) { + HDF5ErrMapper::ToException("Error loading MPI metadata write."); + } +} + +inline MPIOCollectiveMetadataWrite::MPIOCollectiveMetadataWrite(bool collective) + : collective_(collective) {} + +#endif + +inline FileVersionBounds::FileVersionBounds(H5F_libver_t low, H5F_libver_t high) + : _low(low) + , _high(high) {} + +inline FileVersionBounds::FileVersionBounds(const FileAccessProps& fapl) { + if (H5Pget_libver_bounds(fapl.getId(), &_low, &_high) < 0) { + HDF5ErrMapper::ToException("Unable to access file version bounds"); + } +} + +inline std::pair FileVersionBounds::getVersion() const { + return std::make_pair(_low, _high); +} + +inline void FileVersionBounds::apply(const hid_t list) const { + if (H5Pset_libver_bounds(list, _low, _high) < 0) { + HDF5ErrMapper::ToException("Error setting file version bounds"); + } +} + +inline MetadataBlockSize::MetadataBlockSize(hsize_t size) + : _size(size) {} + +inline MetadataBlockSize::MetadataBlockSize(const FileAccessProps& fapl) { + if (H5Pget_meta_block_size(fapl.getId(), &_size) < 0) { + HDF5ErrMapper::ToException("Unable to access file metadata block size"); + } +} + +inline void MetadataBlockSize::apply(const hid_t list) const { + if (H5Pset_meta_block_size(list, _size) < 0) { + HDF5ErrMapper::ToException("Error setting metadata block size"); + } +} + +inline hsize_t MetadataBlockSize::getSize() const { + return _size; +} + +inline void EstimatedLinkInfo::apply(const hid_t hid) const { + if (H5Pset_est_link_info(hid, _entries, _length) < 0) { + HDF5ErrMapper::ToException("Error setting estimated link info"); + } +} + +inline EstimatedLinkInfo::EstimatedLinkInfo(unsigned entries, unsigned length) + : _entries(entries) + , _length(length) {} + +inline EstimatedLinkInfo::EstimatedLinkInfo(const GroupCreateProps& gcpl) { + if (H5Pget_est_link_info(gcpl.getId(), &_entries, &_length) < 0) { + HDF5ErrMapper::ToException("Unable to access group link size property"); + } +} + +inline unsigned EstimatedLinkInfo::getEntries() const { + return _entries; +} + +inline unsigned EstimatedLinkInfo::getNameLength() const { + return _length; +} + +inline void Chunking::apply(const hid_t hid) const { + if (H5Pset_chunk(hid, static_cast(_dims.size()), _dims.data()) < 0) { + HDF5ErrMapper::ToException("Error setting chunk property"); + } +} + +inline Chunking::Chunking(const std::vector& dims) + : _dims(dims) {} + +inline Chunking::Chunking(const std::initializer_list& items) + : Chunking(std::vector{items}) {} + +inline Chunking::Chunking(DataSetCreateProps& plist, size_t max_dims) + : _dims(max_dims + 1) { + auto n_loaded = H5Pget_chunk(plist.getId(), static_cast(_dims.size()), _dims.data()); + if (n_loaded < 0) { + HDF5ErrMapper::ToException("Error getting chunk size"); + } + + if (n_loaded >= static_cast(_dims.size())) { + *this = Chunking(plist, 8 * max_dims); + } else { + _dims.resize(static_cast(n_loaded)); + } +} + +inline const std::vector& Chunking::getDimensions() const noexcept { + return _dims; +} + +template +inline Chunking::Chunking(hsize_t item, Args... args) + : Chunking(std::vector{item, static_cast(args)...}) {} + +inline void Deflate::apply(const hid_t hid) const { + if (!H5Zfilter_avail(H5Z_FILTER_DEFLATE) || H5Pset_deflate(hid, _level) < 0) { + HDF5ErrMapper::ToException("Error setting deflate property"); + } +} + +inline Deflate::Deflate(unsigned int level) + : _level(level) {} + +inline void Szip::apply(const hid_t hid) const { + if (!H5Zfilter_avail(H5Z_FILTER_SZIP)) { + HDF5ErrMapper::ToException("Error setting szip property"); + } + + if (H5Pset_szip(hid, _options_mask, _pixels_per_block) < 0) { + HDF5ErrMapper::ToException("Error setting szip property"); + } +} + +inline Szip::Szip(unsigned int options_mask, unsigned int pixels_per_block) + : _options_mask(options_mask) + , _pixels_per_block(pixels_per_block) {} + +inline unsigned Szip::getOptionsMask() const { + return _options_mask; +} + +inline unsigned Szip::getPixelsPerBlock() const { + return _pixels_per_block; +} + +inline void Shuffle::apply(const hid_t hid) const { + if (!H5Zfilter_avail(H5Z_FILTER_SHUFFLE)) { + HDF5ErrMapper::ToException("Error setting shuffle property"); + } + + if (H5Pset_shuffle(hid) < 0) { + HDF5ErrMapper::ToException("Error setting shuffle property"); + } +} + +inline AllocationTime::AllocationTime(H5D_alloc_time_t alloc_time) + : _alloc_time(alloc_time) {} + +inline AllocationTime::AllocationTime(const DataSetCreateProps& dcpl) { + if (H5Pget_alloc_time(dcpl.getId(), &_alloc_time) < 0) { + HDF5ErrMapper::ToException("Error getting allocation time"); + } +} + +inline void AllocationTime::apply(hid_t dcpl) const { + if (H5Pset_alloc_time(dcpl, _alloc_time) < 0) { + HDF5ErrMapper::ToException("Error setting allocation time"); + } +} + +inline H5D_alloc_time_t AllocationTime::getAllocationTime() { + return _alloc_time; +} + +inline Caching::Caching(const DataSetCreateProps& dcpl) { + if (H5Pget_chunk_cache(dcpl.getId(), &_numSlots, &_cacheSize, &_w0) < 0) { + HDF5ErrMapper::ToException("Error getting dataset cache parameters"); + } +} + +inline void Caching::apply(const hid_t hid) const { + if (H5Pset_chunk_cache(hid, _numSlots, _cacheSize, _w0) < 0) { + HDF5ErrMapper::ToException("Error setting dataset cache parameters"); + } +} + +inline Caching::Caching(const size_t numSlots, const size_t cacheSize, const double w0) + : _numSlots(numSlots) + , _cacheSize(cacheSize) + , _w0(w0) {} + +inline size_t Caching::getNumSlots() const { + return _numSlots; +} + +inline size_t Caching::getCacheSize() const { + return _cacheSize; +} + +inline double Caching::getW0() const { + return _w0; +} + +inline CreateIntermediateGroup::CreateIntermediateGroup(bool create) + : _create(create) {} + +inline CreateIntermediateGroup::CreateIntermediateGroup(const ObjectCreateProps& ocpl) { + fromPropertyList(ocpl.getId()); +} + + +inline void CreateIntermediateGroup::apply(const hid_t hid) const { + if (H5Pset_create_intermediate_group(hid, _create ? 1 : 0) < 0) { + HDF5ErrMapper::ToException( + "Error setting property for create intermediate groups"); + } +} + +inline CreateIntermediateGroup::CreateIntermediateGroup(const LinkCreateProps& lcpl) { + fromPropertyList(lcpl.getId()); +} + +inline void CreateIntermediateGroup::fromPropertyList(hid_t hid) { + unsigned c_bool = 0; + if (H5Pget_create_intermediate_group(hid, &c_bool) < 0) { + HDF5ErrMapper::ToException( + "Error getting property for create intermediate groups"); + } + + _create = bool(c_bool); +} + +inline bool CreateIntermediateGroup::isSet() const { + return _create; +} + +#ifdef H5_HAVE_PARALLEL +inline UseCollectiveIO::UseCollectiveIO(bool enable) + : _enable(enable) {} + +inline void UseCollectiveIO::apply(const hid_t hid) const { + if (H5Pset_dxpl_mpio(hid, _enable ? H5FD_MPIO_COLLECTIVE : H5FD_MPIO_INDEPENDENT) < 0) { + HDF5ErrMapper::ToException("Error setting H5Pset_dxpl_mpio."); + } +} + +inline UseCollectiveIO::UseCollectiveIO(const DataTransferProps& dxpl) { + H5FD_mpio_xfer_t collective; + + if (H5Pget_dxpl_mpio(dxpl.getId(), &collective) < 0) { + HDF5ErrMapper::ToException("Error getting H5Pset_dxpl_mpio."); + } + + if (collective != H5FD_MPIO_COLLECTIVE && collective != H5FD_MPIO_INDEPENDENT) { + throw std::logic_error("H5Pget_dxpl_mpio returned something strange."); + } + + _enable = collective == H5FD_MPIO_COLLECTIVE; +} + +inline bool UseCollectiveIO::isCollective() const { + return _enable; +} + +inline MpioNoCollectiveCause::MpioNoCollectiveCause(const DataTransferProps& dxpl) { + if (H5Pget_mpio_no_collective_cause(dxpl.getId(), &_local_cause, &_global_cause) < 0) { + HDF5ErrMapper::ToException("Failed to check mpio_no_collective_cause."); + } +} + +inline bool MpioNoCollectiveCause::wasCollective() const { + return _local_cause == 0 && _global_cause == 0; +} + +inline uint32_t MpioNoCollectiveCause::getLocalCause() const { + return _local_cause; +} + +inline uint32_t MpioNoCollectiveCause::getGlobalCause() const { + return _global_cause; +} + +inline std::pair MpioNoCollectiveCause::getCause() const { + return {_local_cause, _global_cause}; +} +#endif + +inline LinkCreationOrder::LinkCreationOrder(const FileCreateProps& fcpl) { + fromPropertyList(fcpl.getId()); +} + +inline LinkCreationOrder::LinkCreationOrder(const GroupCreateProps& gcpl) { + fromPropertyList(gcpl.getId()); +} + +inline unsigned LinkCreationOrder::getFlags() const { + return _flags; +} + +inline void LinkCreationOrder::apply(const hid_t hid) const { + if (H5Pset_link_creation_order(hid, _flags) < 0) { + HDF5ErrMapper::ToException("Error setting LinkCreationOrder."); + } +} + +inline void LinkCreationOrder::fromPropertyList(hid_t hid) { + if (H5Pget_link_creation_order(hid, &_flags) < 0) { + HDF5ErrMapper::ToException( + "Error getting property for link creation order"); + } +} + +inline AttributePhaseChange::AttributePhaseChange(unsigned max_compact, unsigned min_dense) + : _max_compact(max_compact) + , _min_dense(min_dense) {} + +inline AttributePhaseChange::AttributePhaseChange(const GroupCreateProps& gcpl) { + if (H5Pget_attr_phase_change(gcpl.getId(), &_max_compact, &_min_dense) < 0) { + HDF5ErrMapper::ToException( + "Error getting property for attribute phase change"); + } +} + +inline unsigned AttributePhaseChange::max_compact() const { + return _max_compact; +} + +inline unsigned AttributePhaseChange::min_dense() const { + return _min_dense; +} + +inline void AttributePhaseChange::apply(hid_t hid) const { + if (H5Pset_attr_phase_change(hid, _max_compact, _min_dense) < 0) { + HDF5ErrMapper::ToException( + "Error getting property for attribute phase change"); + } +} + + +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5ReadWrite_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5ReadWrite_misc.hpp similarity index 59% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5ReadWrite_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5ReadWrite_misc.hpp index bd31f2b53b..c8e7361740 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5ReadWrite_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5ReadWrite_misc.hpp @@ -8,7 +8,7 @@ */ #pragma once -#include "H5Tpublic.h" +#include #include "H5Utils.hpp" namespace HighFive { @@ -19,9 +19,13 @@ template using unqualified_t = typename std::remove_const::type>::type; // Find the type of an eventual char array, otherwise void -template +template struct type_char_array { - using type = void; + using type = typename std::conditional< + std::is_same::base_type, std::string>::value, + std::string, + void>::type; + static constexpr bool is_char_array = false; }; template @@ -29,6 +33,7 @@ struct type_char_array { using type = typename std::conditional, char>::value, char*, typename type_char_array::type>::type; + static constexpr bool is_char_array = true; }; template @@ -36,6 +41,7 @@ struct type_char_array { using type = typename std::conditional, char>::value, char[N], typename type_char_array::type>::type; + static constexpr bool is_char_array = true; }; template @@ -43,7 +49,7 @@ struct BufferInfo { using type_no_const = typename std::remove_const::type; using elem_type = typename details::inspector::base_type; using char_array_t = typename details::type_char_array::type; - static constexpr bool is_char_array = !std::is_same::value; + static constexpr bool is_char_array = details::type_char_array::is_char_array; enum Operation { read, write }; const Operation op; @@ -63,29 +69,44 @@ struct string_type_checker { static DataType getDataType(const DataType&, const DataType&); }; +inline void enforce_ascii_hack(const DataType& dst, const DataType& src) { + // Note: constness only refers to constness of the DataType object, which + // is just an ID, we can/will change properties of `dst`. + + // TEMP. CHANGE: Ensure that the character set is properly configured to prevent + // converter issues on HDF5 <=v1.12.0 when loading ASCII strings first. + // See https://github.com/HDFGroup/hdf5/issues/544 for further information. + if (H5Tget_cset(src.getId()) == H5T_CSET_ASCII) { + H5Tset_cset(dst.getId(), H5T_CSET_ASCII); + } +} + template <> struct string_type_checker { inline static DataType getDataType(const DataType& element_type, const DataType& dtype) { - // TEMP. CHANGE: Ensure that the character set is properly configured to prevent - // converter issues on HDF5 <=v1.12.0 when loading ASCII strings first. - // See https://github.com/HDFGroup/hdf5/issues/544 for further information. - if (H5Tget_class(element_type.getId()) == H5T_STRING && - H5Tget_cset(dtype.getId()) == H5T_CSET_ASCII) { - H5Tset_cset(element_type.getId(), H5T_CSET_ASCII); + if (H5Tget_class(element_type.getId()) == H5T_STRING) { + enforce_ascii_hack(element_type, dtype); } return element_type; } }; +template <> +struct string_type_checker { + inline static DataType getDataType(const DataType&, const DataType& file_datatype) { + // The StringBuffer ensures that the data is transformed such that it + // matches the datatype of the dataset, i.e. `file_datatype` and + // `mem_datatype` are the same. + return file_datatype; + } +}; + template struct string_type_checker { inline static DataType getDataType(const DataType& element_type, const DataType& dtype) { DataType return_type = (dtype.isFixedLenStr()) ? AtomicType() : element_type; - // TEMP. CHANGE: See string_type_checker definition - if (H5Tget_cset(dtype.getId()) == H5T_CSET_ASCII) { - H5Tset_cset(return_type.getId(), H5T_CSET_ASCII); - } + enforce_ascii_hack(return_type, dtype); return return_type; } }; @@ -93,13 +114,11 @@ struct string_type_checker { template <> struct string_type_checker { inline static DataType getDataType(const DataType&, const DataType& dtype) { - if (dtype.isFixedLenStr()) + if (dtype.isFixedLenStr()) { throw DataSetException("Can't output variable-length to fixed-length strings"); - // TEMP. CHANGE: See string_type_checker definition - DataType return_type = AtomicType(); - if (H5Tget_cset(dtype.getId()) == H5T_CSET_ASCII) { - H5Tset_cset(return_type.getId(), H5T_CSET_ASCII); } + DataType return_type = AtomicType(); + enforce_ascii_hack(return_type, dtype); return return_type; } }; @@ -114,26 +133,21 @@ BufferInfo::BufferInfo(const DataType& dtype, F getName, Operation _op) ((is_fixed_len_string && is_char_array) ? 1 : 0)) , data_type( string_type_checker::getDataType(create_datatype(), dtype)) { - if (is_fixed_len_string && std::is_same::value) { - throw DataSetException( - "Can't output std::string as fixed-length. " - "Use raw arrays or FixedLenStringArray"); - } // We warn. In case they are really not convertible an exception will rise on read/write if (dtype.getClass() != data_type.getClass()) { - std::cerr << "HighFive WARNING \"" << getName() - << "\": data and hdf5 dataset have different types: " << data_type.string() - << " -> " << dtype.string() << std::endl; + HIGHFIVE_LOG_WARN(getName() + "\": data and hdf5 dataset have different types: " + + data_type.string() + " -> " + dtype.string()); } else if ((dtype.getClass() & data_type.getClass()) == DataTypeClass::Float) { - if ((op == read) && (dtype.getSize() > data_type.getSize())) { - std::clog << "HighFive WARNING \"" << getName() - << "\": hdf5 dataset has higher floating point precision than data on read: " - << dtype.string() << " -> " << data_type.string() << std::endl; - } else if ((op == write) && (dtype.getSize() < data_type.getSize())) { - std::clog << "HighFive WARNING \"" << getName() - << "\": data has higher floating point precision than hdf5 dataset on write: " - << data_type.string() << " -> " << dtype.string() << std::endl; - } + HIGHFIVE_LOG_WARN_IF( + (op == read) && (dtype.getSize() > data_type.getSize()), + getName() + "\": hdf5 dataset has higher floating point precision than data on read: " + + dtype.string() + " -> " + data_type.string()); + + HIGHFIVE_LOG_WARN_IF( + (op == write) && (dtype.getSize() < data_type.getSize()), + getName() + + "\": data has higher floating point precision than hdf5 dataset on write: " + + data_type.string() + " -> " + dtype.string()); } } diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Reference_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Reference_misc.hpp similarity index 95% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Reference_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Reference_misc.hpp index fbcb5a8b65..7c8db36fb6 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Reference_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Reference_misc.hpp @@ -7,14 +7,15 @@ * */ -#ifndef H5REFERENCE_MISC_HPP -#define H5REFERENCE_MISC_HPP +#pragma once #include #include #include "H5Utils.hpp" +#include "../H5Object.hpp" + namespace HighFive { inline Reference::Reference(const Object& location, const Object& object) @@ -64,5 +65,3 @@ inline Object Reference::get_ref(const Object& location) const { } } // namespace HighFive - -#endif // H5REFERENCE_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Selection_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Selection_misc.hpp similarity index 78% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Selection_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Selection_misc.hpp index 09c28f3283..c35b7bbf32 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Selection_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Selection_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5SELECTION_MISC_HPP -#define H5SELECTION_MISC_HPP +#pragma once namespace HighFive { @@ -39,6 +38,12 @@ inline const DataType Selection::getDataType() const { return _set.getDataType(); } -} // namespace HighFive +namespace detail { +inline Selection make_selection(const DataSpace& mem_space, + const DataSpace& file_space, + const DataSet& set) { + return Selection(mem_space, file_space, set); +} +} // namespace detail -#endif // H5SELECTION_MISC_HPP +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Slice_traits.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Slice_traits.hpp similarity index 85% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Slice_traits.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Slice_traits.hpp index 5bab4fa484..52c52713f0 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Slice_traits.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Slice_traits.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5SLICE_TRAITS_HPP -#define H5SLICE_TRAITS_HPP +#pragma once #include #include @@ -259,6 +258,15 @@ class SliceTraits { /// Therefore, the only memspaces supported for general hyperslabs are one-dimensional arrays. Selection select(const HyperSlab& hyperslab) const; + /// + /// \brief Select an \p hyperslab in the current Slice/Dataset. + /// + /// If the selection can be read into a simple, multi-dimensional dataspace, + /// then this overload enable specifying the shape of the memory dataspace + /// with `memspace`. Note, that simple implies no offsets, strides or + /// number of blocks, just the size of the block in each dimension. + Selection select(const HyperSlab& hyperslab, const DataSpace& memspace) const; + /// /// \brief Select a region in the current Slice/Dataset of \p count points at /// \p offset separated by \p stride. If strides are not provided they will @@ -306,11 +314,24 @@ class SliceTraits { /// allocated. /// \param array: A buffer containing enough space for the data /// \param dtype: The type of the data, in case it cannot be automatically guessed + /// \param xfer_props: Data Transfer properties template void read(T* array, - const DataType& dtype = DataType(), + const DataType& dtype, const DataTransferProps& xfer_props = DataTransferProps()) const; + /// + /// Read the entire dataset into a raw buffer + /// + /// Same as `read(T*, const DataType&, const DataTransferProps&)`. However, + /// this overload deduces the HDF5 datatype of the element of `array` from + /// `T`. Note, that the file datatype is already fixed. + /// + /// \param array: A buffer containing enough space for the data + /// \param xfer_props: Data Transfer properties + template + void read(T* array, const DataTransferProps& xfer_props = DataTransferProps()) const; + /// /// Write the integrality N-dimension buffer to this dataset /// An exception is raised is if the numbers of dimension of the buffer and @@ -322,24 +343,33 @@ class SliceTraits { void write(const T& buffer, const DataTransferProps& xfer_props = DataTransferProps()); /// - /// Write from a raw buffer into this dataset + /// Write from a raw pointer into this dataset. /// /// No dimensionality checks will be performed, it is the user's /// responsibility to ensure that the buffer holds the right amount of /// elements. For n-dimensional matrices the buffer layout follows H5 /// default conventions. + /// + /// Note, this is the shallowest wrapper around `H5Dwrite` and should + /// be used if full control is needed. Generally prefer `write`. + /// /// \param buffer: A buffer containing the data to be written - /// \param dtype: The type of the data, in case it cannot be automatically guessed + /// \param dtype: The datatype of `buffer`, i.e. the memory data type. /// \param xfer_props: The HDF5 data transfer properties, e.g. collective MPI-IO. template void write_raw(const T* buffer, - const DataType& dtype = DataType(), + const DataType& mem_datatype, const DataTransferProps& xfer_props = DataTransferProps()); - protected: - inline Selection select_impl(const HyperSlab& hyperslab, const DataSpace& memspace) const; + /// + /// Write from a raw pointer into this dataset. + /// + /// Same as `write_raw(const T*, const DataTransferProps&)`. However, this + /// overload attempts to guess the data type of `buffer`, i.e. the memory + /// datatype. Note that the file datatype is already fixed. + /// + template + void write_raw(const T* buffer, const DataTransferProps& xfer_props = DataTransferProps()); }; } // namespace HighFive - -#endif // H5SLICE_TRAITS_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Slice_traits_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Slice_traits_misc.hpp similarity index 74% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Slice_traits_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Slice_traits_misc.hpp index 3a1d0de203..7b07c9abf9 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Slice_traits_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Slice_traits_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5SLICE_TRAITS_MISC_HPP -#define H5SLICE_TRAITS_MISC_HPP +#pragma once #include #include @@ -65,8 +64,8 @@ inline ElementSet::ElementSet(const std::vector>& eleme } template -inline Selection SliceTraits::select_impl(const HyperSlab& hyperslab, - const DataSpace& memspace) const { +inline Selection SliceTraits::select(const HyperSlab& hyperslab, + const DataSpace& memspace) const { // Note: The current limitation are that memspace must describe a // packed memspace. // @@ -76,7 +75,7 @@ inline Selection SliceTraits::select_impl(const HyperSlab& hyperslab, const auto& slice = static_cast(*this); auto filespace = hyperslab.apply(slice.getSpace()); - return Selection(memspace, filespace, details::get_dataset(slice)); + return detail::make_selection(memspace, filespace, details::get_dataset(slice)); } template @@ -88,7 +87,7 @@ inline Selection SliceTraits::select(const HyperSlab& hyper_slab) cons auto n_elements = H5Sget_select_npoints(filespace.getId()); auto memspace = DataSpace(std::array{size_t(n_elements)}); - return Selection(memspace, filespace, details::get_dataset(slice)); + return detail::make_selection(memspace, filespace, details::get_dataset(slice)); } @@ -99,7 +98,7 @@ inline Selection SliceTraits::select(const std::vector& offset const std::vector& block) const { auto slab = HyperSlab(RegularHyperSlab(offset, count, stride, block)); auto memspace = DataSpace(count); - return select_impl(slab, memspace); + return select(slab, memspace); } template @@ -122,7 +121,7 @@ inline Selection SliceTraits::select(const std::vector& column std::vector memdims = dims; memdims.back() = columns.size(); - return select_impl(slab, DataSpace(memdims)); + return select(slab, DataSpace(memdims)); } template @@ -154,7 +153,7 @@ inline Selection SliceTraits::select(const ElementSet& elements) const HDF5ErrMapper::ToException("Unable to select elements"); } - return Selection(DataSpace(num_elements), space, details::get_dataset(slice)); + return detail::make_selection(DataSpace(num_elements), space, details::get_dataset(slice)); } @@ -172,9 +171,12 @@ template inline void SliceTraits::read(T& array, const DataTransferProps& xfer_props) const { const auto& slice = static_cast(*this); const DataSpace& mem_space = slice.getMemSpace(); + + auto file_datatype = slice.getDataType(); + const details::BufferInfo buffer_info( - slice.getDataType(), - [slice]() -> std::string { return details::get_dataset(slice).getPath(); }, + file_datatype, + [&slice]() -> std::string { return details::get_dataset(slice).getPath(); }, details::BufferInfo::Operation::read); if (!details::checkDimensions(mem_space, buffer_info.n_dimensions)) { @@ -184,14 +186,30 @@ inline void SliceTraits::read(T& array, const DataTransferProps& xfer_ throw DataSpaceException(ss.str()); } auto dims = mem_space.getDimensions(); - auto r = details::data_converter::get_reader(dims, array); - read(r.get_pointer(), buffer_info.data_type, xfer_props); + + if (mem_space.getElementCount() == 0) { + auto effective_dims = details::squeezeDimensions(dims, + details::inspector::recursive_ndim); + + details::inspector::prepare(array, effective_dims); + return; + } + + auto r = details::data_converter::get_reader(dims, array, file_datatype); + read(r.getPointer(), buffer_info.data_type, xfer_props); // re-arrange results - r.unserialize(); - auto t = create_datatype::base_type>(); + r.unserialize(array); + + auto t = buffer_info.data_type; auto c = t.getClass(); - if (c == DataTypeClass::VarLen) { - (void) H5Dvlen_reclaim(t.getId(), mem_space.getId(), xfer_props.getId(), r.get_pointer()); + if (c == DataTypeClass::VarLen || t.isVariableStr()) { +#if H5_VERSION_GE(1, 12, 0) + // This one have been created in 1.12.0 + (void) H5Treclaim(t.getId(), mem_space.getId(), xfer_props.getId(), r.getPointer()); +#else + // This one is deprecated since 1.12.0 + (void) H5Dvlen_reclaim(t.getId(), mem_space.getId(), xfer_props.getId(), r.getPointer()); +#endif } } @@ -199,16 +217,12 @@ inline void SliceTraits::read(T& array, const DataTransferProps& xfer_ template template inline void SliceTraits::read(T* array, - const DataType& dtype, + const DataType& mem_datatype, const DataTransferProps& xfer_props) const { static_assert(!std::is_const::value, "read() requires a non-const structure to read data into"); - const auto& slice = static_cast(*this); - using element_type = typename details::inspector::base_type; - // Auto-detect mem datatype if not provided - const DataType& mem_datatype = dtype.empty() ? create_and_check_datatype() - : dtype; + const auto& slice = static_cast(*this); if (H5Dread(details::get_dataset(slice).getId(), mem_datatype.getId(), @@ -220,36 +234,51 @@ inline void SliceTraits::read(T* array, } } +template +template +inline void SliceTraits::read(T* array, const DataTransferProps& xfer_props) const { + using element_type = typename details::inspector::base_type; + const DataType& mem_datatype = create_and_check_datatype(); + + read(array, mem_datatype, xfer_props); +} + template template inline void SliceTraits::write(const T& buffer, const DataTransferProps& xfer_props) { const auto& slice = static_cast(*this); const DataSpace& mem_space = slice.getMemSpace(); + + if (mem_space.getElementCount() == 0) { + return; + } + + auto file_datatype = slice.getDataType(); + const details::BufferInfo buffer_info( - slice.getDataType(), - [slice]() -> std::string { return details::get_dataset(slice).getPath(); }, + file_datatype, + [&slice]() -> std::string { return details::get_dataset(slice).getPath(); }, details::BufferInfo::Operation::write); if (!details::checkDimensions(mem_space, buffer_info.n_dimensions)) { std::ostringstream ss; - ss << "Impossible to write buffer of dimensions " << buffer_info.n_dimensions - << " into dataset of dimensions " << mem_space.getNumberDimensions(); + ss << "Impossible to write buffer of dimensions " + << details::format_vector(mem_space.getDimensions()) + << " into dataset with n = " << buffer_info.n_dimensions << " dimensions."; throw DataSpaceException(ss.str()); } - auto w = details::data_converter::serialize(buffer); - write_raw(w.get_pointer(), buffer_info.data_type, xfer_props); + auto w = details::data_converter::serialize(buffer, file_datatype); + write_raw(w.getPointer(), buffer_info.data_type, xfer_props); } template template inline void SliceTraits::write_raw(const T* buffer, - const DataType& dtype, + const DataType& mem_datatype, const DataTransferProps& xfer_props) { - using element_type = typename details::inspector::base_type; const auto& slice = static_cast(*this); - const auto& mem_datatype = dtype.empty() ? create_and_check_datatype() : dtype; if (H5Dwrite(details::get_dataset(slice).getId(), mem_datatype.getId(), @@ -261,7 +290,14 @@ inline void SliceTraits::write_raw(const T* buffer, } } +template +template +inline void SliceTraits::write_raw(const T* buffer, const DataTransferProps& xfer_props) { + using element_type = typename details::inspector::base_type; + const auto& mem_datatype = create_and_check_datatype(); + + write_raw(buffer, mem_datatype, xfer_props); +} -} // namespace HighFive -#endif // H5SLICE_TRAITS_MISC_HPP +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Utils.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Utils.hpp similarity index 84% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Utils.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Utils.hpp index 1b00624d38..2d9d24f887 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5Utils.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5Utils.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5UTILS_HPP -#define H5UTILS_HPP +#pragma once // internal utilities functions #include @@ -17,10 +16,12 @@ #include #include #include +#include #include #include "../H5Exception.hpp" +#include "H5Friends.hpp" namespace HighFive { @@ -64,7 +65,18 @@ inline std::string get_name(T fct) { return std::string(bigBuffer.data(), length); } +template +inline std::string format_vector(const Container& container) { + auto sout = std::stringstream{}; + + sout << "[ "; + for (size_t i = 0; i < container.size(); ++i) { + sout << container[i] << (i == container.size() - 1 ? "" : ", "); + } + sout << "]"; + + return sout.str(); +} + } // namespace details } // namespace HighFive - -#endif // H5UTILS_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5_definitions.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5_definitions.hpp similarity index 96% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5_definitions.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5_definitions.hpp index be91157ed2..746723c883 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/bits/H5_definitions.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/H5_definitions.hpp @@ -6,7 +6,7 @@ #define H5_DEPRECATED(msg) __declspec(deprecated(#msg)) #else #pragma message("WARNING: Compiler doesnt support deprecation") -#define H5_DEPRECATED +#define H5_DEPRECATED(msg) #endif diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/string_padding.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/string_padding.hpp new file mode 100644 index 0000000000..e6e6908ddc --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/bits/string_padding.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace HighFive { + +enum class StringPadding : std::underlying_type::type { + NullTerminated = H5T_STR_NULLTERM, + NullPadded = H5T_STR_NULLPAD, + SpacePadded = H5T_STR_SPACEPAD +}; + + +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_Eigen.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_Eigen.hpp similarity index 98% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_Eigen.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_Eigen.hpp index 787cbc5f2b..5b5d3b9a5f 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_Eigen.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_Eigen.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_EIGEN_HPP -#define H5EASY_BITS_EIGEN_HPP +#pragma once #include "../H5Easy.hpp" #include "H5Easy_misc.hpp" @@ -144,4 +143,3 @@ struct io_impl, T } // namespace H5Easy #endif // H5_USE_EIGEN -#endif // H5EASY_BITS_EIGEN_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_misc.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_misc.hpp similarity index 98% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_misc.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_misc.hpp index 1016bbc7e5..69798b2a4e 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_MISC_HPP -#define H5EASY_BITS_MISC_HPP +#pragma once #include "../H5Easy.hpp" @@ -152,5 +151,3 @@ inline Attribute initScalarAttribute(File& file, } // namespace detail } // namespace H5Easy - -#endif // H5EASY_BITS_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_opencv.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_opencv.hpp similarity index 97% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_opencv.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_opencv.hpp index b0fbf1af7d..b640cd8543 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_opencv.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_opencv.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_OPENCV_HPP -#define H5EASY_BITS_OPENCV_HPP +#pragma once #include "../H5Easy.hpp" #include "H5Easy_misc.hpp" @@ -99,4 +98,3 @@ struct io_impl::value>::type> { } // namespace H5Easy #endif // H5_USE_OPENCV -#endif // H5EASY_BITS_OPENCV_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_public.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_public.hpp similarity index 98% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_public.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_public.hpp index f212ea1233..2cc55d0f0f 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_public.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_public.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_PUBLIC_HPP -#define H5EASY_BITS_PUBLIC_HPP +#pragma once #include "../H5Easy.hpp" @@ -169,5 +168,3 @@ inline T loadAttribute(const File& file, const std::string& path, const std::str } } // namespace H5Easy - -#endif // H5EASY_BITS_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_scalar.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_scalar.hpp similarity index 97% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_scalar.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_scalar.hpp index f99e408a60..056d8f2dc5 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_scalar.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_scalar.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_SCALAR_HPP -#define H5EASY_BITS_SCALAR_HPP +#pragma once #include "../H5Easy.hpp" #include "H5Easy_misc.hpp" @@ -131,5 +130,3 @@ struct io_impl { } // namespace detail } // namespace H5Easy - -#endif // H5EASY_BITS_SCALAR_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_vector.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_vector.hpp similarity index 96% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_vector.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_vector.hpp index d5e252ebeb..4c60f5cfc6 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_vector.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_vector.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_VECTOR_HPP -#define H5EASY_BITS_VECTOR_HPP +#pragma once #include "../H5Easy.hpp" #include "H5Easy_misc.hpp" @@ -79,5 +78,3 @@ struct io_impl::value>::type> { } // namespace detail } // namespace H5Easy - -#endif // H5EASY_BITS_VECTOR_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_xtensor.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_xtensor.hpp similarity index 96% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_xtensor.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_xtensor.hpp index cccc4926d2..6b0238c4db 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/include/highfive/h5easy_bits/H5Easy_xtensor.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/h5easy_bits/H5Easy_xtensor.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_XTENSOR_HPP -#define H5EASY_BITS_XTENSOR_HPP +#pragma once #include "../H5Easy.hpp" #include "H5Easy_misc.hpp" @@ -83,4 +82,3 @@ struct io_impl::value>::type> { } // namespace H5Easy #endif // H5_USE_XTENSOR -#endif // H5EASY_BITS_XTENSOR_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/highfive.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/highfive.hpp new file mode 100644 index 0000000000..f5e20cae91 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/include/highfive/highfive.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/README.md b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/README.md similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/README.md rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/README.md diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/hdf5_bench.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/hdf5_bench.cpp similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/hdf5_bench.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/hdf5_bench.cpp diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/hdf5_bench_improved.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/hdf5_bench_improved.cpp similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/hdf5_bench_improved.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/hdf5_bench_improved.cpp diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/highfive_bench.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/highfive_bench.cpp similarity index 90% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/highfive_bench.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/highfive_bench.cpp index e4e04dee8e..bcc7be93ce 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/highfive_bench.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/highfive_bench.cpp @@ -1,4 +1,4 @@ -#include +#include #include const std::vector> data(1000000, {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}); diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/imgs/bench_hdf5_base.png b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/imgs/bench_hdf5_base.png similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/imgs/bench_hdf5_base.png rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/imgs/bench_hdf5_base.png diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/imgs/bench_hdf5_improved.png b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/imgs/bench_hdf5_improved.png similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/imgs/bench_hdf5_improved.png rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/imgs/bench_hdf5_improved.png diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/imgs/bench_highfive.png b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/imgs/bench_highfive.png similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/imgs/bench_highfive.png rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/imgs/bench_highfive.png diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/run_benchmark.sh b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/run_benchmark.sh similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/benchmarks/run_benchmark.sh rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/benchmarks/run_benchmark.sh diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/CMakeLists.txt b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/CMakeLists.txt similarity index 54% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/CMakeLists.txt rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/CMakeLists.txt index 8da5c503ae..8b5f8b0aff 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/CMakeLists.txt @@ -1,8 +1,8 @@ -include_directories(${HDF5_INCLUDE_DIRS}) +include(HighFiveWarnings) -function(compile_example exemple_source) +function(compile_example example_source) - get_filename_component(example_filename ${exemple_source} NAME) + get_filename_component(example_filename ${example_source} NAME) string(REPLACE ".cpp" "_bin" example_name ${example_filename}) if(${example_filename} MATCHES ".*eigen.*") @@ -29,8 +29,18 @@ function(compile_example exemple_source) endif() endif() - add_executable(${example_name} ${exemple_source}) - target_link_libraries(${example_name} HighFive) + if(${example_name} MATCHES ".*hl_hdf5.*") + find_package(HDF5 QUIET COMPONENTS HL NAMES HDF5_HL) + if(${HDF5_HL_FOUND}) + message("HDF5 HL: ${HDF5_HL_LIBRARIES}") + add_executable(${example_name} ${example_source}) + target_link_libraries(${example_name} HighFive HighFiveWarnings ${HDF5_HL_LIBRARIES}) + endif() + return() + endif() + + add_executable(${example_name} ${example_source}) + target_link_libraries(${example_name} HighFive HighFiveWarnings) endfunction() diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/boost_multi_array_2D.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/boost_multi_array_2D.cpp new file mode 100644 index 0000000000..4bec1ec129 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/boost_multi_array_2D.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (c), 2017, Adrien Devresse + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include + +#undef H5_USE_BOOST +#define H5_USE_BOOST + +#include +#include + +using namespace HighFive; + +// Create a 2D dataset 10x3 of double with boost multi array +// and write it to a file. +int main(void) { + const int nx = 10; + const int ny = 3; + + boost::multi_array array(boost::extents[nx][ny]); + + for (int i = 0; i < nx; ++i) { + for (int j = 0; j < ny; ++j) { + array[i][j] = double(j + i * ny); + } + } + + // We create a new HDF5 file + File file("boost_multiarray_example.h5", File::Truncate); + + // let's create our dataset of the size of the boost::multi_array + file.createDataSet("dset", array); + + return 0; +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/boost_multiarray_complex.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/boost_multiarray_complex.cpp similarity index 88% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/boost_multiarray_complex.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/boost_multiarray_complex.cpp index a5c1985834..37481db625 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/boost_multiarray_complex.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/boost_multiarray_complex.cpp @@ -12,10 +12,9 @@ #undef H5_USE_BOOST #define H5_USE_BOOST +#include + #include -#include -#include -#include typedef std::complex complex_t; @@ -25,7 +24,7 @@ int main() { multi_array[1][1][0][0] = complex_t{1.1, 1.2}; HighFive::File file("multi_array_complex.h5", HighFive::File::Truncate); - HighFive::DataSet dataset = file.createDataSet("multi_array", multi_array); + return 0; } diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/boost_ublas_double.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/boost_ublas_double.cpp similarity index 97% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/boost_ublas_double.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/boost_ublas_double.cpp index ca3307ecfc..b025475b95 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/boost_ublas_double.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/boost_ublas_double.cpp @@ -11,13 +11,14 @@ #undef H5_USE_BOOST #define H5_USE_BOOST +#include + // In some versions of Boost (starting with 1.64), you have to include the serialization header // before ublas #include #include #include -#include using namespace HighFive; diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/compound_types.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/compound_types.cpp similarity index 73% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/compound_types.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/compound_types.cpp index 0f127f0a6f..158bc6dc6d 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/compound_types.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/compound_types.cpp @@ -10,7 +10,7 @@ // Compound datatype test :: May 2021 // ////////////////////////////////// -#include +#include typedef struct { @@ -27,17 +27,16 @@ HighFive::CompoundType create_compound_Size2D() { HIGHFIVE_REGISTER_TYPE(Size2D, create_compound_Size2D) int main() { - const std::string FILE_NAME("compounds_test.h5"); - const std::string DATASET_NAME("dims"); + const std::string dataset_name("dims"); - HighFive::File file(FILE_NAME, HighFive::File::Truncate); + HighFive::File file("compounds_test.h5", HighFive::File::Truncate); auto t1 = create_compound_Size2D(); t1.commit(file, "Size2D"); std::vector dims = {{1., 2.5}, {3., 4.5}}; - auto dataset = file.createDataSet(DATASET_NAME, dims); + auto dataset = file.createDataSet(dataset_name, dims); auto g1 = file.createGroup("group1"); - g1.createAttribute(DATASET_NAME, dims); + g1.createAttribute(dataset_name, dims); } diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_attribute_string_integer.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_attribute_string_integer.cpp new file mode 100644 index 0000000000..f658457adf --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_attribute_string_integer.cpp @@ -0,0 +1,54 @@ +/* + * Copyright (c), 2017, Adrien Devresse + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include +#include + +#include + +using namespace HighFive; + +// create a dataset from a vector of string +// read it back and print it +int main(void) { + // Create a new file using the default property lists. + File file("create_attribute.h5", File::Truncate); + + // Create a dummy dataset of one single integer + DataSet dataset = file.createDataSet("dset", DataSpace(1), create_datatype()); + + // Now let's add a attribute on this dataset + // This attribute will be named "note" + // and have the following content + std::string note = "Very important Dataset!"; + + // Write in one line of code: + dataset.createAttribute("note", note); + + // We also add a "version" attribute + // that will be an array 1x2 of integer + std::vector version{1, 0}; + + Attribute v = dataset.createAttribute("version", version); + + // We can also create attributes on the file: + file.createAttribute("file_version", 1); + + // and on groups in the file: + auto group = file.createGroup("group"); + group.createAttribute("secret", 123); + + // let's now list the keys of all attributes + std::vector all_attributes_keys = dataset.listAttributeNames(); + for (const auto& attr: all_attributes_keys) { + std::cout << "attribute: " << attr << std::endl; + } + + return 0; +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_dataset_double.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_dataset_double.cpp new file mode 100644 index 0000000000..d15fbdc54f --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_dataset_double.cpp @@ -0,0 +1,38 @@ +/* + * Copyright (c), 2017, Adrien Devresse + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include +#include + +#include + +// Create a dataset name "dset" of double 4x6 +int main(void) { + using namespace HighFive; + + // Create a new file using the default property lists. Note that + // `File::Truncate` will, if present, truncate the file before opening + // it for reading and writing. + File file("create_dataset_example.h5", File::Truncate); + + // Define the size of our dataset: 2x6 + std::vector dims{2, 6}; + + // Create the dataset + DataSet dataset = file.createDataSet("dset", DataSpace(dims)); + + double data[2][6] = {{1.1, 2.2, 3.3, 4.4, 5.5, 6.6}, + {11.11, 12.12, 13.13, 14.14, 15.15, 16.16}}; + + // write it + dataset.write(data); + + + return 0; // successfully terminated +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_dataset_half_float.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_dataset_half_float.cpp new file mode 100644 index 0000000000..2b720cd187 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_dataset_half_float.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c), 2022, Blue Brain Project + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ + +#ifdef H5_USE_HALF_FLOAT + +#include +#include +#include + +#include + +const std::string FILE_NAME("create_dataset_half_float_example.h5"); +const std::string DATASET_NAME("dset"); + +// Create a dataset name "dset", size 4x6, and type float16_t (i.e., 16-bit half-precision +// floating-point format) +// +int main(void) { + using namespace HighFive; + + // Create a new file using the default property lists. + File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + + // Define the size of our dataset: 4x6 + std::vector dims{4, 6}; + + // Create the dataset + DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace(dims)); + + std::vector> data; + for (size_t i = 0; i < 4; ++i) { + data.emplace_back(); + for (size_t j = 0; j < 6; ++j) + data[i].emplace_back((i + 1) * (j + 1)); + } + + // write it + dataset.write(data); + + return 0; +} + +#endif diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_datatype.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_datatype.cpp new file mode 100644 index 0000000000..0b1a0fb520 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_datatype.cpp @@ -0,0 +1,101 @@ +#include + +#include + +using namespace HighFive; + +static const std::string FILE_NAME("create_datatype_example.h5"); +static const std::string DATASET_NAME("test_dataset"); + + +// Struct representation of custom type (type v below) +typedef struct { + char a; + short b; + unsigned long long c; +} csl; + +bool operator==(csl x, csl y) { + return x.a == y.a && x.b == y.b && x.c == y.c; +} + +bool operator!=(csl x, csl y) { + return !(x == y); +} + +// Tell HighFive how to create the HDF5 datatype for this base type by +// using the HIGHFIVE_REGISTER_TYPE macro +CompoundType create_compound_csl() { + return {{"u1", create_datatype()}, + {"u2", create_datatype()}, + {"u3", create_datatype()}}; +} +HIGHFIVE_REGISTER_TYPE(csl, create_compound_csl) + +int main(void) { + File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + + // Create a simple compound type with automatic alignment of the + // members. For this the type alignment is trivial. + std::vector t_members( + {{"real", create_datatype()}, {"imag", create_datatype()}}); + CompoundType t(t_members); + t.commit(file, "new_type1"); + + // Create a complex nested datatype with manual alignment + CompoundType u({{"u1", t, 0}, {"u2", t, 9}, {"u3", create_datatype(), 20}}, 26); + u.commit(file, "new_type3"); + + // Create a more complex type with automatic alignment. For this the + // type alignment is more complex. + CompoundType v_aligned{{"u1", create_datatype()}, + {"u2", create_datatype()}, + {"u3", create_datatype()}}; + // introspect the compound type + std::cout << "v_aligned size: " << v_aligned.getSize(); + for (const auto& member: v_aligned.getMembers()) { + std::cout << " field " << member.name << " offset: " << member.offset << std::endl; + } + + v_aligned.commit(file, "new_type2_aligned"); + + // Create a more complex type with a fully packed alignment. The + // equivalent type is created with a standard struct alignment in the + // implementation of HighFive::create_datatype above + CompoundType v_packed({{"u1", create_datatype(), 0}, + {"u2", create_datatype(), 1}, + {"u3", create_datatype(), 3}}, + 11); + v_packed.commit(file, "new_type2_packed"); + + + // Initialise some data + std::vector data; + data.push_back({'f', 1, 4}); + data.push_back({'g', -4, 18}); + + // Write the data into the file in a fully packed form + DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace(2), v_packed); + dataset.write(data); + + file.flush(); + + // Read a subset of the data back + std::vector result; + dataset.select({0}, {2}).read(result); + + for (size_t i = 0; i < data.size(); ++i) { + if (result[i] != data[i]) { + std::cout << "result[" << i << "]:" << std::endl; + std::cout << " " << result[i].a << std::endl; + std::cout << " " << result[i].b << std::endl; + std::cout << " " << result[i].c << std::endl; + std::cout << "data[" << i << "]:" << std::endl; + std::cout << " " << data[i].a << std::endl; + std::cout << " " << data[i].b << std::endl; + std::cout << " " << data[i].c << std::endl; + } + } + + return 0; +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_extensible_dataset.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_extensible_dataset.cpp new file mode 100644 index 0000000000..17153cd574 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_extensible_dataset.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (c), 2017, Adrien Devresse + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include +#include + +#include + +const std::string FILE_NAME("create_extensible_dataset_example.h5"); +const std::string DATASET_NAME("dset"); + +// Create a dataset name "dset" of double 4x6 +// +int main(void) { + using namespace HighFive; + + // Create a new file using the default property lists. + File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + + // Create a dataspace with initial shape and max shape + DataSpace dataspace = DataSpace({4, 5}, {17, DataSpace::UNLIMITED}); + + // Use chunking + DataSetCreateProps props; + props.add(Chunking(std::vector{2, 2})); + + // Create the dataset + DataSet dataset = file.createDataSet(DATASET_NAME, dataspace, create_datatype(), props); + + // Write into the initial part of the dataset + double t1[3][1] = {{2.0}, {2.0}, {4.0}}; + dataset.select({0, 0}, {3, 1}).write(t1); + + // Resize the dataset to a larger size + dataset.resize({4, 6}); + + // Write into the new part of the dataset + double t2[1][3] = {{4.0, 8.0, 6.0}}; + dataset.select({3, 3}, {1, 3}).write(t2); + + // now we read it back + std::vector> result; + dataset.read(result); + + // we print it out and see: + // 2 0 0 0 0 0 + // 2 0 0 0 0 0 + // 4 0 0 0 0 0 + // 0 0 0 4 8 6 + for (auto row: result) { + for (auto col: row) + std::cout << " " << col; + std::cout << std::endl; + } + + return 0; +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_large_attribute.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_large_attribute.cpp new file mode 100644 index 0000000000..022d11d87b --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_large_attribute.cpp @@ -0,0 +1,19 @@ +#include +#include + +#include + +int main() { + std::vector large_attr(16000, 0.0); + + auto fapl = HighFive::FileAccessProps::Default(); + fapl.add(HighFive::FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)); + HighFive::File file("create_large_attribute.h5", HighFive::File::Truncate, fapl); + auto gcpl = HighFive::GroupCreateProps::Default(); + gcpl.add(HighFive::AttributePhaseChange(0, 0)); + + auto group = file.createGroup("grp", gcpl); + group.createAttribute("attr", large_attr); + + return 0; +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_page_allocated_files.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_page_allocated_files.cpp similarity index 53% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_page_allocated_files.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_page_allocated_files.cpp index df58f0d3a0..0b4d29dffb 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/create_page_allocated_files.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/create_page_allocated_files.cpp @@ -12,14 +12,11 @@ #include #include -#include +#include // This example requires HDF5 version 1.10.1 or newer. #if H5_VERSION_GE(1, 10, 1) -const std::string FILE_NAME("create_page_allocated_files.h5"); -const std::string DATASET_NAME("array"); - // This example show how to create an HDF5 file that internally aggregates // metadata and raw data into separate pages. The advantage of this approach // is that reading a single page, pulls in the metadata for a large chunk of @@ -40,34 +37,29 @@ const std::string DATASET_NAME("array"); int main() { using namespace HighFive; - try { - // Create a new file requesting paged allocation. - auto create_props = FileCreateProps{}; - // Let request pagesizes of 16 kB. This setting should be tuned - // in real applications. We'll allow HDF5 to not keep track of - // left-over free space of size less than 128 bytes. Finally, - // we don't need the free space manager to be stored in the - // HDF5 file. - size_t pagesize = 16 * 1024; // Must be tuned. - size_t threshold = 128; - size_t persist = false; + // Create a new file requesting paged allocation. + auto create_props = FileCreateProps{}; - create_props.add(FileSpaceStrategy(H5F_FSPACE_STRATEGY_PAGE, persist, threshold)); - create_props.add(FileSpacePageSize(pagesize)); + // Let request pagesizes of 16 kB. This setting should be tuned + // in real applications. We'll allow HDF5 to not keep track of + // left-over free space of size less than 128 bytes. Finally, + // we don't need the free space manager to be stored in the + // HDF5 file. + size_t pagesize = 16 * 1024; // Must be tuned. + size_t threshold = 128; + size_t persist = false; - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate, create_props); + create_props.add(FileSpaceStrategy(H5F_FSPACE_STRATEGY_PAGE, persist, threshold)); + create_props.add(FileSpacePageSize(pagesize)); - // The `file` (and also the low-level `file.getId()`) behave as normal, i.e. - // one can proceed to add content to the file as usual. + File file("create_page_allocated_files.h5", File::Truncate, create_props); - auto data = std::vector{0.0, 1.0, 2.0}; - file.createDataSet(DATASET_NAME, data); + // The `file` (and also the low-level `file.getId()`) behave as normal, i.e. + // one can proceed to add content to the file as usual. - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } + auto data = std::vector{0.0, 1.0, 2.0}; + file.createDataSet("data", data); return 0; } @@ -77,4 +69,4 @@ int main() { std::cout << "This example can't be run prior to HDF5 1.10.1.\n"; return 0; } -#endif \ No newline at end of file +#endif diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/easy_attribute.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/easy_attribute.cpp similarity index 99% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/easy_attribute.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/easy_attribute.cpp index be03c5378a..87a7f6592c 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/easy_attribute.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/easy_attribute.cpp @@ -34,6 +34,5 @@ int main() { H5Easy::dumpAttribute(file, "/path/to/measurement", "description", desc); H5Easy::dumpAttribute(file, "/path/to/measurement", "temperature", temperature); - return 0; } diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/easy_dumpoptions.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/easy_dumpoptions.cpp similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/easy_dumpoptions.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/easy_dumpoptions.cpp diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/easy_load_dump.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/easy_load_dump.cpp similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/easy_load_dump.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/easy_load_dump.cpp diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/hl_hdf5_inmemory_files.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/hl_hdf5_inmemory_files.cpp new file mode 100644 index 0000000000..088fd71cc8 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/hl_hdf5_inmemory_files.cpp @@ -0,0 +1,69 @@ +/* + * Copyright (c), 2022, Blue Brain Project + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include + +#include + +#include + +using namespace HighFive; + +class InMemoryFile: public HighFive::File { + public: + explicit InMemoryFile(std::vector buffer) + : _buffer(std::move(buffer)) { + _hid = H5LTopen_file_image(_buffer.data(), + sizeof(_buffer[0]) * _buffer.size(), + H5LT_FILE_IMAGE_DONT_RELEASE | H5LT_FILE_IMAGE_DONT_COPY); + } + + private: + std::vector _buffer; +}; + + +// Create a 2D dataset 10x3 of double with eigen matrix +// and write it to a file +int main(void) { + const std::string file_name("inmemory_file.h5"); + const std::string dataset_name("dset"); + + auto data = std::vector{1.0, 2.0, 3.0}; + + { + // We create an HDF5 file. + File file(file_name, File::Truncate); + file.createDataSet(dataset_name, data); + } + + // Simulate having an inmemory file by reading a file + // byte-by-byte into RAM. + auto buffer = std::vector(1ul << 20); + auto file = std::fopen(file_name.c_str(), "r"); + auto nread = std::fread(buffer.data(), sizeof(buffer[0]), buffer.size(), file); + std::cout << "Bytes read: " << nread << "\n"; + + // Create a file from a buffer. + auto h5 = InMemoryFile(std::move(buffer)); + + // Read a dataset as usual. + auto read_back = h5.getDataSet(dataset_name).read>(); + + // Check if the values match. + for (size_t i = 0; i < read_back.size(); ++i) { + if (read_back[i] != data[i]) { + throw std::runtime_error("Values don't match."); + } else { + std::cout << "read_back[" << i << "] = " << read_back[i] << "\n"; + } + } + + return 0; +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/parallel_hdf5_collective_io.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/parallel_hdf5_collective_io.cpp similarity index 83% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/parallel_hdf5_collective_io.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/parallel_hdf5_collective_io.cpp index dd105073ae..7261b7cf1d 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/parallel_hdf5_collective_io.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/parallel_hdf5_collective_io.cpp @@ -13,28 +13,21 @@ #include -#include -#include -#include -#include +#include -const std::string FILE_NAME("parallel_collective_example.h5"); -const std::string DATASET_NAME("dset"); +const std::string file_name("parallel_collective_example.h5"); +const std::string dataset_name("dset"); // Currently, HighFive doesn't wrap retrieving information from property lists. // Therefore, one needs to use HDF5 directly. For example, to see if collective // MPI-IO operations were used, one may. Conveniently, this also provides identifiers // of the cause for not using collective MPI calls. void check_collective_io(const HighFive::DataTransferProps& xfer_props) { - uint32_t local_cause = 0, global_cause = 0; - auto err = H5Pget_mpio_no_collective_cause(xfer_props.getId(), &local_cause, &global_cause); - if (err < 0) { - throw std::runtime_error("Failed to check mpio_no_collective_cause."); - } - if (local_cause || global_cause) { + auto mnccp = HighFive::MpioNoCollectiveCause(xfer_props); + if (mnccp.getLocalCause() || mnccp.getGlobalCause()) { std::cout << "The operation was successful, but couldn't use collective MPI-IO. local cause: " - << local_cause << " global cause:" << global_cause << std::endl; + << mnccp.getLocalCause() << " global cause:" << mnccp.getGlobalCause() << std::endl; } } @@ -59,6 +52,7 @@ int main(int argc, char** argv) { MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); using namespace HighFive; + try { // MPI-IO requires informing HDF5 that we want something other than // the default behaviour. This is done through property lists. We @@ -74,7 +68,7 @@ int main(int argc, char** argv) { fapl.add(MPIOCollectiveMetadata{}); // Now we can create the file as usual. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate, fapl); + File file(file_name, File::Truncate, fapl); // We can create a group as usual, but all MPI ranks must participate. auto group = file.createGroup("grp"); @@ -85,7 +79,7 @@ int main(int argc, char** argv) { dims[1] = 2ul; // We follow the path for - DataSet dataset = group.createDataSet(DATASET_NAME, DataSpace(dims)); + DataSet dataset = group.createDataSet(dataset_name, DataSpace(dims)); // Each node want to write its own rank two time in // its associated row diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/parallel_hdf5_independent_io.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/parallel_hdf5_independent_io.cpp similarity index 90% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/parallel_hdf5_independent_io.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/parallel_hdf5_independent_io.cpp index 5c5537f3a2..b43012890c 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/parallel_hdf5_independent_io.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/parallel_hdf5_independent_io.cpp @@ -13,13 +13,9 @@ #include -#include -#include -#include -#include +#include -const std::string FILE_NAME("parallel_independent_example.h5"); -const std::string DATASET_NAME("dset"); +const std::string file_name("parallel_independent_example.h5"); // This is an example of how to let MPI ranks read independent parts of the // HDF5 file. @@ -41,7 +37,7 @@ int main(int argc, char** argv) { // ... // } if (mpi_rank == 0) { - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); for (int i = 0; i < mpi_size; ++i) { std::stringstream group_name; @@ -74,7 +70,7 @@ int main(int argc, char** argv) { // fapl.add(MPIOCollectiveMetadataWrite{}); // Now we can create the file as usual. - File file(FILE_NAME, File::ReadOnly, fapl); + File file(file_name, File::ReadOnly, fapl); // Note that this operation isn't collective. Each MPI rank is requesting to // open a different group. diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_dataset_string.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_dataset_string.cpp new file mode 100644 index 0000000000..2a4c3c4911 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_dataset_string.cpp @@ -0,0 +1,51 @@ +/* + * Copyright (c), 2017, Adrien Devresse + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include +#include + +#include + +using namespace HighFive; + +const std::string file_name("create_dataset_string_example.h5"); +const std::string dataset_name("story"); + +// create a dataset from a vector of string +// read it back and print it +int main(void) { + // Create a new file using the default property lists. + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + + std::vector string_list; + string_list.push_back("Hello World !"); + string_list.push_back( + "This string list is mapped to a dataset of " + "variable length string"); + string_list.push_back("Encoding is done in UTF-8 - 你好 - Здравствуйте!"); + string_list.push_back("May the force be with you"); + string_list.push_back("Enjoy !"); + + // create a dataset ready to contains strings of the size of the vector + // string_list + DataSet dataset = file.createDataSet(dataset_name, DataSpace::From(string_list)); + + // let's write our vector of string + dataset.write(string_list); + + // now we read it back + std::vector result_string_list; + dataset.read(result_string_list); + + for (size_t i = 0; i < result_string_list.size(); ++i) { + std::cout << ":" << i << " " << result_string_list[i] << "\n"; + } + + return 0; // successfully terminated +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_fixedlen_string.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_fixedlen_string.cpp new file mode 100644 index 0000000000..60589637ea --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_fixedlen_string.cpp @@ -0,0 +1,42 @@ +/* + * Copyright (c), 2020, Blue Brain Project + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include + +#include + +using namespace HighFive; + +// This examples shows how compile time constant strings work. +// +// Note, that as of version 2.8.0., writing `std::string` as fixed-length +// strings there's a simpler API. +int main() { + // Create a new file using the default property lists. + File file("create_dataset_string_example.h5", File::Truncate); + const char strings_fixed[][16] = {"abcabcabcabcabc", "123123123123123"}; + + // create a dataset ready to contains strings of the size of the vector + file.createDataSet("ds1", DataSpace(2)).write(strings_fixed); + + // Without specific type info this will create an int8 dataset + file.createDataSet("ds2", strings_fixed); + + // Now test the new interface type + FixedLenStringArray<10> arr{"0000000", "1111111"}; + auto ds = file.createDataSet("ds3", arr); + + // Read back truncating to 4 chars + FixedLenStringArray<4> array_back; + ds.read(array_back); + std::cout << "First item is '" << array_back[0] << "'\n" + << "Second item is '" << array_back[1] << "'\n"; + + return 0; +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_raw_ptr.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_raw_ptr.cpp new file mode 100644 index 0000000000..b6cd9eda59 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_raw_ptr.cpp @@ -0,0 +1,73 @@ +/* + * Copyright (c), 2017, Adrien Devresse + * Copyright (c), 2022, Blue Brain Project + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include +#include + +#include + +const std::string file_name("read_write_raw_ptr.h5"); +const std::string dataset_name("array"); + +// This create a "multi-dimensional" array. Meaning a pointer with +// dimensions. The `std::vector` is mearly a convenient way +// of allocating and releasing memory. +// +// Conceptionually this is only a raw pointer with dimensions. The +// data is store in row-major, aka C-style, without stride, offset +// or padding. +std::vector make_array(const std::vector& dims) { + auto n_elements = dims[0] * dims[1]; + std::vector nd_array(n_elements, 0.0); + + for (size_t i = 0; i < dims[0]; ++i) { + for (size_t j = 0; j < dims[1]; ++j) { + nd_array[j + i * dims[1]] = double(j) + 100.0 * double(i); + } + } + + return nd_array; +} + +int main(void) { + using namespace HighFive; + + // Create a new file using the default property lists. + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + + // Let's write to file. + { + std::vector dims{3, 5}; + auto nd_array = make_array(dims); + + // First, create a dataset with the correct dimensions. + auto dataset = file.createDataSet(dataset_name, DataSpace(dims)); + + // Then write, using the raw pointer. + dataset.write_raw(nd_array.data()); + } + + // Let's read from file. + { + auto dataset = file.getDataSet(dataset_name); + + // First read the dimensions. + auto dims = dataset.getDimensions(); + + // Then allocate memory. + auto n_elements = dims[0] * dims[1]; + auto nd_array = std::vector(n_elements); + + // Finally, read into the memory by passing a raw pointer to the library. + dataset.read(nd_array.data()); + } + + return 0; +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_single_scalar.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_single_scalar.cpp new file mode 100644 index 0000000000..4b4c6887c9 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_single_scalar.cpp @@ -0,0 +1,46 @@ +/* + * Copyright (c), 2017, Adrien Devresse + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include +#include + +#include + +const std::string file_name("read_write_scalar.h5"); +const std::string dataset_name("single_scalar"); + +// Create a dataset name "single_scalar" +// which contains only the perfect integer number "42" +// +int main(void) { + using namespace HighFive; + + // Create a new file using the default property lists. + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + + int perfect_number = 42; + + // Create the dataset + DataSet dataset = file.createDataSet(dataset_name, DataSpace::From(perfect_number)); + + // write it + dataset.write(perfect_number); + + // flush everything + file.flush(); + + // let's read it back + int potentially_perfect_number; + + dataset.read(potentially_perfect_number); + + std::cout << "perfect number: " << potentially_perfect_number << std::endl; + + return 0; // successfully terminated +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_std_strings.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_std_strings.cpp new file mode 100644 index 0000000000..7699e0c0c4 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_std_strings.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (c), 2023, Blue Brain Project, EPFL + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include +#include + +#include +#include +#include + +using namespace HighFive; + +// This example shows how to write (containers of) `std::string` +// to dataset either as fixed or variable length HDF5 strings. +// The feature is available from 2.8.0 onwards. +int main(void) { + auto file = File("read_write_std_string.h5", File::Truncate); + + // A string of length 3 in a buffer of size 4 bytes. We'll use "length" for + // the semantic length of the string, i.e. excluding the '\0' character and + // "size" to refer to the length of the buffer in which the string is stored. + // For null-terminated strings, the `size == length + 1`. + std::string ascii_string = "foo"; + auto scalar_dataspace = DataSpace(DataSpace::dataspace_scalar); + + // Just write the string: + file.createDataSet("single_automatic", ascii_string); + + // The above results in writing the string as an HDF5 variable length UTF8 + // string. In HDF5 a variable length string doesn't specify the length of + // the string. Variable length strings are always null-terminated. + auto variable_stringtype = VariableLengthStringType(); + file.createDataSet("single_variable", scalar_dataspace, variable_stringtype) + .write(ascii_string); + + // HDF5 also has the concept of fixed length string. In fixed length strings + // the size of the string, in bytes, is part of the datatype. The HDF5 API + // for fixed and variable length strings is distinct. Hence, when writing + // string that need to be read by other programs, it can matter if the string + // is stored as fixed or variable length. + // + // Important: The HDF5 string size is the size of the buffer required to + // store the string. + // + // We know that ascii_string requires 4 bytes to store, but want to store + // it in fixed length strings of length 8. Additionally, we promise that + // the strings are null-terminated. The character set defaults to ASCII. + auto fixed_stringtype = FixedLengthStringType(8, StringPadding::NullTerminated); + file.createDataSet("single_fixed_nullterm", scalar_dataspace, fixed_stringtype) + .write(ascii_string); + + // When reading into an `std::string` it doesn't matter if the HDF5 datatype + // is fixed or variable length. HighFive will internally read into a buffer + // and then write to the final destination. + auto from_variable = file.getDataSet("single_variable").read(); + auto from_fixed = file.getDataSet("single_fixed_nullterm").read(); + + // Note that because the fixed length string is null-terminated, + // `from_fixed.size() == ascii_string.size()` despite it being stored as a string of + // length 8. + std::cout << "from_variable = '" << from_variable << "' size = " << from_variable.size() + << "\n"; + std::cout << "from_fixed = '" << from_fixed << "' size = " << from_fixed.size() << "\n"; + + // Fixed-length string don't have to be null-terminated. Their length could + // be defined simply by the known size of the buffer required to store the + // string. To deal with the situation where the string is shorter than the + // buffer, one defines a padding character. This must be either the null or + // space character. We'll show null-padded, space-padded works the same way. + auto fixed_nullpad = FixedLengthStringType(8, StringPadding::NullPadded); + file.createDataSet("single_fixed_nullpad", scalar_dataspace, fixed_nullpad).write(ascii_string); + + // Note that because we only know that the string is padded with nulls, but we + // don't know if those nulls were part of the string to begin with. The full + // size of the buffer is read into the `std::string`. The length of the + // `std::string` is the size of the string type. + auto from_nullpad = file.getDataSet("single_fixed_nullpad").read(); + std::cout << "from_nullpad = '" << from_nullpad << "' size = " << from_nullpad.size() << "\n"; + + // Let's look at UTF8 strings. In HDF5 the size of a string is the size in + // bytes of the buffer required to store the string. A UTF8 symbol/character + // requires 1 to 4 bytes. + // + // The 'a' is 1 byte, the 'α' 2 bytes, therefore a total of 3 bytes (same + // as `utf8_string.size()`). Which including the null character fits into + // 8 bytes. However, 8 bytes would, in general not be enough to store 2 + // UTF8 characters and the null character. Which would require 9 bytes. + std::string utf8_string = "aα"; + auto fixed_utf8_type = + FixedLengthStringType(8, StringPadding::NullTerminated, CharacterSet::Utf8); + file.createDataSet("single_fixed_utf8", scalar_dataspace, fixed_utf8_type).write(utf8_string); + + auto from_utf8 = file.getDataSet("single_fixed_utf8").read(); + std::cout << "from_utf8 = '" << from_utf8 << "' size = " << from_utf8.size() << "\n"; + + // Finally, containers of `std::string`s work analogously: + auto ascii_strings = std::vector{"123", "456"}; + file.createDataSet("multi_fixed_nullterm", DataSpace::From(ascii_strings), fixed_stringtype) + .write(ascii_strings); + + auto ascii_strings_from_fixed = + file.getDataSet("multi_fixed_nullterm").read>(); + + // In order to see details of how each is stored in the HDF5 file use: + // h5dump read_write_std_string.h5 + + return 0; +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_vector_dataset.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_vector_dataset.cpp similarity index 64% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_vector_dataset.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_vector_dataset.cpp index 4ed57a9b35..9718c1c2bc 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_vector_dataset.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_vector_dataset.cpp @@ -10,20 +10,18 @@ #include #include -#include -#include -#include +#include using namespace HighFive; -const std::string FILE_NAME("dataset_integer.h5"); -const std::string DATASET_NAME("dset"); +const std::string file_name("dataset_integer.h5"); +const std::string dataset_name("dset"); const size_t size_dataset = 20; // create a dataset 1D from a vector of string void write_dataset() { // we create a new hdf5 file - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); std::vector data(size_dataset); for (size_t i = 0; i < data.size(); ++i) { @@ -32,7 +30,7 @@ void write_dataset() { // let's create a dataset of native integer with the size of the vector // 'data' - DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace::From(data)); + DataSet dataset = file.createDataSet(dataset_name, DataSpace::From(data)); // let's write our vector of int to the HDF5 dataset dataset.write(data); @@ -41,12 +39,12 @@ void write_dataset() { // read our data back void read_dataset() { // we open the existing hdf5 file we created before - File file(FILE_NAME, File::ReadOnly); + File file(file_name, File::ReadOnly); std::vector read_data; // we get the dataset - DataSet dataset = file.getDataSet(DATASET_NAME); + DataSet dataset = file.getDataSet(dataset_name); // we convert the hdf5 dataset to a single dimension vector dataset.read(read_data); @@ -58,14 +56,8 @@ void read_dataset() { } int main(void) { - try { - write_dataset(); - read_dataset(); + write_dataset(); + read_dataset(); - } catch (Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - - return 0; // successfully terminated + return 0; } diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_vector_dataset_references.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_vector_dataset_references.cpp similarity index 85% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_vector_dataset_references.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_vector_dataset_references.cpp index 8733dc2758..ca08467682 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/read_write_vector_dataset_references.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/read_write_vector_dataset_references.cpp @@ -10,10 +10,7 @@ #include #include -#include -#include -#include -#include +#include // create a dataset 1D from a vector of int void write_dataset() { @@ -69,13 +66,8 @@ void read_dataset() { } int main() { - try { - write_dataset(); - read_dataset(); + write_dataset(); + read_dataset(); - } catch (const HighFive::Exception& err) { - // catch and print any HDF5 error - std::cerr << err.what() << std::endl; - } - return 0; // successfully terminated + return 0; } diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/readme_snippet.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/readme_snippet.cpp similarity index 70% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/readme_snippet.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/readme_snippet.cpp index 47187ee44f..160dabce56 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/readme_snippet.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/readme_snippet.cpp @@ -1,4 +1,4 @@ -#include +#include using namespace HighFive; @@ -22,9 +22,10 @@ int main() { // Read back, with allocating: auto data = dataset.read>(); - // Because `data` has the correct size, this will - // not cause `data` to be reallocated: - dataset.read(data); + // Because `pre_allocated` has the correct size, this will + // not cause `pre_allocated` to be reallocated: + auto pre_allocated = std::vector(50); + dataset.read(pre_allocated); } return 0; diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/renaming_objects.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/renaming_objects.cpp similarity index 94% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/renaming_objects.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/renaming_objects.cpp index 0f2a93ac70..f0759e52a2 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/src/examples/renaming_objects.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/renaming_objects.cpp @@ -1,8 +1,4 @@ -#include -#include -#include -#include -#include +#include using namespace HighFive; diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/select_by_id_dataset_cpp11.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/select_by_id_dataset_cpp11.cpp new file mode 100644 index 0000000000..973c57435f --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/select_by_id_dataset_cpp11.cpp @@ -0,0 +1,67 @@ +/* + * Copyright (c), 2017, Adrien Devresse + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include +#include +#include + +#include + +const std::string file_name("select_partial_string.h5"); +const std::string dataset_name("message"); + +// Create a dataset name "dset" of double 4x6 +// +int main(void) { + using namespace HighFive; + + // Create a new file using the default property lists. + File file(file_name, File::Truncate); + + { + // We have a set of string + std::vector values = { + "Cat", + "Dog", + "Hello", + "Tree", + "World", + "Plane", + ", ", + "你好", + "Tea", + "Moon", + "صباح جميل", + "Spaceship", + }; + + // let's create a dataset + DataSet dataset = file.createDataSet(dataset_name, DataSpace::From(values)); + + // and write them + dataset.write(values); + } + + { + DataSet dataset = file.getDataSet(dataset_name); + + // now let's read back by cherry pick our interesting string + std::vector result; + // we select only element N° 2 and 5 + dataset.select(ElementSet({2, 4, 6, 7, 6, 10})).read(result); + + // and display it + for (auto i: result) { + std::cout << i << " "; + } + std::cout << "\n"; + } + + return 0; // successfully terminated +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/select_partial_dataset_cpp11.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/select_partial_dataset_cpp11.cpp new file mode 100644 index 0000000000..1e480c1603 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/src/examples/select_partial_dataset_cpp11.cpp @@ -0,0 +1,49 @@ +/* + * Copyright (c), 2017, Adrien Devresse + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include +#include +#include +#include + +#include + +const std::string file_name("select_partial_example.h5"); +const std::string dataset_name("dset"); + +// Create a dataset name "dset" of double 4x6 +// +int main(void) { + using namespace HighFive; + + // Create a new file using the default property lists. + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + + // we have some example values in a 2D vector 2x5 + std::vector> values = {{1.0, 2.0, 4.0, 8.0, 16.0}, + {32.0, 64.0, 128.0, 256.0, 512.0}}; + + // let's create a dataset of this size + DataSet dataset = file.createDataSet(dataset_name, DataSpace::From(values)); + // and write them + dataset.write(values); + + // now we read back 2x2 values after an offset of 0x2 + std::vector> result; + dataset.select({0, 2}, {2, 2}).read(result); + + // we print out 4 values + for (auto i: result) { + for (auto j: i) { + std::cout << " " << j; + } + std::cout << "\n"; + } + + return 0; // successfully terminated +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/CMakeLists.txt b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/CMakeLists.txt similarity index 97% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/CMakeLists.txt rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/CMakeLists.txt index 1231a14196..570dba224e 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/CMakeLists.txt @@ -15,7 +15,7 @@ option(USE_BUNDLED_HIGHFIVE "Use highfive from deps folder. Otherwise must be in if(USE_BUNDLED_HIGHFIVE) add_subdirectory("deps/HighFive" EXCLUDE_FROM_ALL) else() - find_package(HighFive REQUIRED) + find_package(HighFive REQUIRED QUIET) endif() add_library(simpleton SHARED "src/simpleton.cpp" "src/otherton.cpp") diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/deps/.gitignore b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/deps/.gitignore similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/deps/.gitignore rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/deps/.gitignore diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/include/simpleton.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/include/simpleton.hpp new file mode 100644 index 0000000000..b98a09fda0 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/include/simpleton.hpp @@ -0,0 +1,14 @@ +#ifndef H5_TEST_SIMPLETON_HPP +#define H5_TEST_SIMPLETON_HPP + +// Include all headers here to catch any missing `inline` statements, since +// they will be included by two different compilation units. +#include + +// Boost should always be found in this setup +#include + +void function(const HighFive::Object& obj); +void other_function(const boost::numeric::ublas::matrix& m); + +#endif diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/src/otherton.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/src/otherton.cpp similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/src/otherton.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/src/otherton.cpp diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/src/simpleton.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/src/simpleton.cpp similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_dependent_library/src/simpleton.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_dependent_library/src/simpleton.cpp diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_project_integration.sh b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_project_integration.sh similarity index 91% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_project_integration.sh rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_project_integration.sh index 386a052b3a..ae88695a0c 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/test_project_integration.sh +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/test_project_integration.sh @@ -11,12 +11,12 @@ test_install() { local builddir="${BUILDDIR}/${project}/${2}" shift shift - ln -s ../../.. "${TESTDIR}/${project}/deps/HighFive" + ln -sf ../../.. "${TESTDIR}/${project}/deps/HighFive" rm -rf "${builddir}" mkdir -p "${builddir}" pushd "${builddir}" cmake "${TESTDIR}/${project}" "$@" - make VERBOSE=1 + cmake --build . --verbose ctest popd rm "${TESTDIR}/${project}/deps/HighFive" @@ -29,7 +29,7 @@ cmake "${ROOT}" \ -DHIGHFIVE_EXAMPLES=OFF \ -DHIGHFIVE_UNIT_TESTS=OFF \ -DCMAKE_INSTALL_PREFIX="${PWD}/install" -make install +cmake --build . --target install popd for project in test_project test_dependent_library; do diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/CMakeLists.txt b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/CMakeLists.txt similarity index 89% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/CMakeLists.txt rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/CMakeLists.txt index 2c5f6422d9..3644d117ce 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/CMakeLists.txt @@ -1,14 +1,15 @@ include(CTest) include(Catch) +include(HighFiveWarnings) if(MSVC) add_definitions(/bigobj) endif() ## Base tests -foreach(test_name tests_high_five_base tests_high_five_multi_dims tests_high_five_easy) +foreach(test_name tests_high_five_base tests_high_five_multi_dims tests_high_five_easy test_all_types) add_executable(${test_name} "${test_name}.cpp") - target_link_libraries(${test_name} HighFive Catch2::Catch2) + target_link_libraries(${test_name} HighFive HighFiveWarnings Catch2::Catch2WithMain) catch_discover_tests(${test_name}) endforeach() @@ -18,7 +19,7 @@ if(HIGHFIVE_PARALLEL_HDF5) ## parallel MPI tests add_executable(tests_parallel_bin ${tests_parallel_src}) - target_link_libraries(tests_parallel_bin HighFive Catch2::Catch2) + target_link_libraries(tests_parallel_bin HighFive HighFiveWarnings Catch2::Catch2) # We need to patch in a call to `mpirun` or equivalent when using # parallel tests. Somehow, this is not foreseen in Catch2, modify the @@ -48,6 +49,6 @@ if(HIGHFIVE_TEST_SINGLE_INCLUDES) get_filename_component(CLASS_NAME ${PUBLIC_HEADER} NAME_WE) configure_file(tests_import_public_headers.cpp "tests_${CLASS_NAME}.cpp" @ONLY) add_executable("tests_include_${CLASS_NAME}" "${CMAKE_CURRENT_BINARY_DIR}/tests_${CLASS_NAME}.cpp") - target_link_libraries("tests_include_${CLASS_NAME}" HighFive) + target_link_libraries("tests_include_${CLASS_NAME}" HighFive HighFiveWarnings) endforeach() endif() diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/test_all_types.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/test_all_types.cpp new file mode 100644 index 0000000000..d74579af6b --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/test_all_types.cpp @@ -0,0 +1,205 @@ +/* + * Copyright (c), 2017-2019, Blue Brain Project - EPFL + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#include + +#include + +#include +#include "tests_high_five.hpp" + +using namespace HighFive; + +TEMPLATE_TEST_CASE("Scalar in DataSet", "[Types]", bool, std::string) { + const std::string FILE_NAME("rw_dataset_" + typeNameHelper() + ".h5"); + const std::string DATASET_NAME("dset"); + TestType t1{}; + + { + // Create a new file using the default property lists. + File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + + // Create the dataset + DataSet dataset = + file.createDataSet(DATASET_NAME, + DataSpace(1), + create_datatype::base_type>()); + + // Write into the initial part of the dataset + dataset.write(t1); + } + + // read it back + { + File file(FILE_NAME, File::ReadOnly); + + TestType value; + DataSet dataset = file.getDataSet("/" + DATASET_NAME); + dataset.read(value); + CHECK(t1 == value); + } +} + +TEMPLATE_PRODUCT_TEST_CASE("Scalar in std::vector", "[Types]", std::vector, (bool, std::string)) { + const std::string FILE_NAME("rw_dataset_" + typeNameHelper() + ".h5"); + const std::string DATASET_NAME("dset"); + TestType t1(5); + + { + // Create a new file using the default property lists. + File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + + // Create the dataset + DataSet dataset = file.createDataSet( + DATASET_NAME, {5}, create_datatype::base_type>()); + + // Write into the initial part of the dataset + dataset.write(t1); + } + + // read it back + { + File file(FILE_NAME, File::ReadOnly); + + TestType value; + DataSet dataset = file.getDataSet("/" + DATASET_NAME); + dataset.read(value); + CHECK(t1 == value); + CHECK(value.size() == 5); + } +} + +TEMPLATE_PRODUCT_TEST_CASE("Scalar in std::vector", + "[Types]", + std::vector, + (bool, std::string)) { + const std::string FILE_NAME("rw_dataset_vector_" + typeNameHelper() + ".h5"); + const std::string DATASET_NAME("dset"); + std::vector t1(5); + for (auto&& e: t1) { + e.resize(6); + } + + { + // Create a new file using the default property lists. + File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + + // Create the dataset + DataSet dataset = file.createDataSet( + DATASET_NAME, + {5, 6}, + create_datatype>::base_type>()); + + // Write into the initial part of the dataset + dataset.write(t1); + } + + // read it back + { + File file(FILE_NAME, File::ReadOnly); + + std::vector value; + DataSet dataset = file.getDataSet("/" + DATASET_NAME); + dataset.read(value); + CHECK(t1 == value); + CHECK(value.size() == 5); + } +} + +TEMPLATE_TEST_CASE("Scalar in std::array", "[Types]", bool, std::string) { + const std::string FILE_NAME("rw_dataset_array_" + typeNameHelper() + ".h5"); + const std::string DATASET_NAME("dset"); + std::array t1{}; + + { + // Create a new file using the default property lists. + File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + + // Create the dataset + DataSet dataset = file.createDataSet( + DATASET_NAME, + {5}, + create_datatype>::base_type>()); + + // Write into the initial part of the dataset + dataset.write(t1); + } + + // read it back + { + File file(FILE_NAME, File::ReadOnly); + + std::array value; + DataSet dataset = file.getDataSet("/" + DATASET_NAME); + dataset.read(value); + CHECK(t1 == value); + CHECK(value.size() == 5); + } +} + +TEMPLATE_TEST_CASE("Scalar in std::vector", "[Types]", bool, std::string) { + const std::string FILE_NAME("rw_dataset_vector_array_" + typeNameHelper() + ".h5"); + const std::string DATASET_NAME("dset"); + std::vector> t1(5); + + { + // Create a new file using the default property lists. + File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + + // Create the dataset + DataSet dataset = file.createDataSet( + DATASET_NAME, + {5, 6}, + create_datatype< + typename details::inspector>>::base_type>()); + + // Write into the initial part of the dataset + dataset.write(t1); + } + + // read it back + { + File file(FILE_NAME, File::ReadOnly); + + std::vector> value; + DataSet dataset = file.getDataSet("/" + DATASET_NAME); + dataset.read(value); + CHECK(t1 == value); + CHECK(value.size() == 5); + } +} + +#if HIGHFIVE_CXX_STD >= 17 +TEMPLATE_PRODUCT_TEST_CASE("Scalar in std::vector", "[Types]", std::vector, std::byte) { + const std::string FILE_NAME("rw_dataset_vector_" + typeNameHelper() + ".h5"); + const std::string DATASET_NAME("dset"); + TestType t1(5, std::byte(0xCD)); + + { + // Create a new file using the default property lists. + File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + + // Create the dataset + DataSet dataset = file.createDataSet(DATASET_NAME, {5}, create_datatype()); + + // Write into the initial part of the dataset + dataset.write(t1); + } + + // read it back + { + File file(FILE_NAME, File::ReadOnly); + + TestType value(5, std::byte(0xCD)); + DataSet dataset = file.getDataSet("/" + DATASET_NAME); + dataset.read(value); + CHECK(t1 == value); + CHECK(value.size() == 5); + } +} +#endif diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five.hpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five.hpp similarity index 87% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five.hpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five.hpp index 79866b4638..0ebd58c448 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five.hpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five.hpp @@ -12,6 +12,17 @@ #include #include #include +#include +#include +#include + +// We don't need windows specific functionality. However, to better detect defects caused by macros, +// we include this header. +// The list of identifiers is taken from `Boost::Predef`. +#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || \ + defined(__WINDOWS__) +#include +#endif using ldcomplex = std::complex; using dcomplex = std::complex; @@ -35,8 +46,8 @@ using base_test_types = std::tuple using float16_t = half_float::half; -using numerical_test_types = decltype( - std::tuple_cat(std::declval(), std::tuple())); +using numerical_test_types = + decltype(std::tuple_cat(std::declval(), std::tuple())); #else using numerical_test_types = base_test_types; #endif @@ -154,16 +165,22 @@ struct ContentGenerate { template inline std::string typeNameHelper() { std::string name = typeid(T).name(); -#if defined(WIN32) - // Replace illegal windows file path characters std::replace(std::begin(name), std::end(name), ' ', '_'); std::replace(std::begin(name), std::end(name), '<', '_'); std::replace(std::begin(name), std::end(name), '>', '_'); std::replace(std::begin(name), std::end(name), ':', '_'); -#endif - return name; + + if (name.size() > 64) { + std::stringstream hash; + hash << std::hex << std::hash{}(name); + + return hash.str(); + } else { + return name; + } } + template inline HighFive::DataSet readWriteDataset(const DataT& ndvec, DataT& result, @@ -185,4 +202,4 @@ inline HighFive::DataSet readWriteDataset(const DataT& ndvec, dataset.read(result); return dataset; -} \ No newline at end of file +} diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_base.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_base.cpp similarity index 54% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_base.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_base.cpp index 50600281b9..899170d932 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_base.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_base.cpp @@ -11,35 +11,31 @@ #include #include #include +#include #include #include #include #include #include -#include -#include -#include -#include -#include -#include - -#define CATCH_CONFIG_MAIN -#include +#include +#include +#include +#include #include "tests_high_five.hpp" using namespace HighFive; using Catch::Matchers::Equals; TEST_CASE("Basic HighFive tests") { - const std::string FILE_NAME("h5tutr_dset.h5"); - const std::string DATASET_NAME("dset"); + const std::string file_name("h5tutr_dset.h5"); + const std::string dataset_name("dset"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); - CHECK(file.getName() == FILE_NAME); + CHECK(file.getName() == file_name); // Create the data space for the dataset. std::vector dims{4, 6}; @@ -47,27 +43,27 @@ TEST_CASE("Basic HighFive tests") { DataSpace dataspace(dims); // check if the dataset exist - CHECK(!file.exist(DATASET_NAME + "_double")); + CHECK(!file.exist(dataset_name + "_double")); // Create a dataset with double precision floating points DataSet dataset_double = - file.createDataSet(DATASET_NAME + "_double", dataspace, AtomicType()); + file.createDataSet(dataset_name + "_double", dataspace, AtomicType()); - CHECK(file.getObjectName(0) == DATASET_NAME + "_double"); + CHECK(file.getObjectName(0) == dataset_name + "_double"); { // check if it exist again - CHECK(file.exist(DATASET_NAME + "_double")); + CHECK(file.exist(dataset_name + "_double")); // and also try to recreate it to the sake of exception testing SilenceHDF5 silencer; - CHECK_THROWS_AS(file.createDataSet(DATASET_NAME + "_double", + CHECK_THROWS_AS(file.createDataSet(dataset_name + "_double", dataspace, AtomicType()), DataSetException); } - DataSet dataset_size_t = file.createDataSet(DATASET_NAME + "_size_t", dataspace); + DataSet dataset_size_t = file.createDataSet(dataset_name + "_size_t", dataspace); } TEST_CASE("Test silent HighFive") { @@ -92,61 +88,61 @@ TEST_CASE("Test silent HighFive") { } TEST_CASE("Test open modes in HighFive") { - const std::string FILE_NAME("openmodes.h5"); + const std::string file_name("openmodes.h5"); - std::remove(FILE_NAME.c_str()); + std::remove(file_name.c_str()); SilenceHDF5 silencer; // Attempt open file only ReadWrite should fail (wont create) - CHECK_THROWS_AS(File(FILE_NAME, File::ReadWrite), FileException); + CHECK_THROWS_AS(File(file_name, File::ReadWrite), FileException); // But with Create flag should be fine - { File file(FILE_NAME, File::ReadWrite | File::Create); } + { File file(file_name, File::ReadWrite | File::Create); } // But if its there and exclusive is given, should fail - CHECK_THROWS_AS(File(FILE_NAME, File::ReadWrite | File::Excl), FileException); + CHECK_THROWS_AS(File(file_name, File::ReadWrite | File::Excl), FileException); // ReadWrite and Excl flags are fine together (posix) - std::remove(FILE_NAME.c_str()); - { File file(FILE_NAME, File::ReadWrite | File::Excl); } + std::remove(file_name.c_str()); + { File file(file_name, File::ReadWrite | File::Excl); } // All three are fine as well (as long as the file does not exist) - std::remove(FILE_NAME.c_str()); - { File file(FILE_NAME, File::ReadWrite | File::Create | File::Excl); } + std::remove(file_name.c_str()); + { File file(file_name, File::ReadWrite | File::Create | File::Excl); } // Just a few combinations are incompatible, detected by hdf5lib - CHECK_THROWS_AS(File(FILE_NAME, File::Truncate | File::Excl), FileException); + CHECK_THROWS_AS(File(file_name, File::Truncate | File::Excl), FileException); - std::remove(FILE_NAME.c_str()); - CHECK_THROWS_AS(File(FILE_NAME, File::Truncate | File::Excl), FileException); + std::remove(file_name.c_str()); + CHECK_THROWS_AS(File(file_name, File::Truncate | File::Excl), FileException); // But in most cases we will truncate and that should always work - { File file(FILE_NAME, File::Truncate); } - std::remove(FILE_NAME.c_str()); - { File file(FILE_NAME, File::Truncate); } + { File file(file_name, File::Truncate); } + std::remove(file_name.c_str()); + { File file(file_name, File::Truncate); } // Last but not least, defaults should be ok - { File file(FILE_NAME); } // ReadOnly - { File file(FILE_NAME, 0); } // force empty-flags, does open without flags + { File file(file_name); } // ReadOnly + { File file(file_name, 0); } // force empty-flags, does open without flags } TEST_CASE("Test file version bounds") { - const std::string FILE_NAME("h5_version_bounds.h5"); + const std::string file_name("h5_version_bounds.h5"); - std::remove(FILE_NAME.c_str()); + std::remove(file_name.c_str()); { - File file(FILE_NAME, File::Truncate); + File file(file_name, File::Truncate); auto bounds = file.getVersionBounds(); CHECK(bounds.first == H5F_LIBVER_EARLIEST); CHECK(bounds.second == H5F_LIBVER_LATEST); } - std::remove(FILE_NAME.c_str()); + std::remove(file_name.c_str()); { FileAccessProps fapl; fapl.add(FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)); - File file(FILE_NAME, File::Truncate, fapl); + File file(file_name, File::Truncate, fapl); auto bounds = file.getVersionBounds(); CHECK(bounds.first == H5F_LIBVER_LATEST); CHECK(bounds.second == H5F_LIBVER_LATEST); @@ -155,7 +151,7 @@ TEST_CASE("Test file version bounds") { #if H5_VERSION_GE(1, 10, 1) TEST_CASE("Test file space strategy") { - const std::string FILE_NAME("h5_file_space_strategy.h5"); + const std::string file_name("h5_file_space_strategy.h5"); auto strategies = std::vector{H5F_FSPACE_STRATEGY_FSM_AGGR, H5F_FSPACE_STRATEGY_AGGR, H5F_FSPACE_STRATEGY_PAGE, @@ -166,43 +162,46 @@ TEST_CASE("Test file space strategy") { FileCreateProps create_props; create_props.add(FileSpaceStrategy(strategy, true, 0)); - File file(FILE_NAME, File::Truncate, create_props); + File file(file_name, File::Truncate, create_props); } { - File file(FILE_NAME, File::ReadOnly); + File file(file_name, File::ReadOnly); CHECK(file.getFileSpaceStrategy() == strategy); } } } TEST_CASE("Test file space page size") { - const std::string FILE_NAME("h5_file_space_page_size.h5"); + const std::string file_name("h5_file_space_page_size.h5"); hsize_t page_size = 1024; { FileCreateProps create_props; create_props.add(FileSpaceStrategy(H5F_FSPACE_STRATEGY_PAGE, true, 0)); create_props.add(FileSpacePageSize(page_size)); - File file(FILE_NAME, File::Truncate, create_props); + File file(file_name, File::Truncate, create_props); } { - File file(FILE_NAME, File::ReadOnly); + File file(file_name, File::ReadOnly); CHECK(file.getFileSpacePageSize() == page_size); } } #ifndef H5_HAVE_PARALLEL TEST_CASE("Test page buffer size") { - const std::string FILE_NAME("h5_page_buffer_size.h5"); + const std::string file_name("h5_page_buffer_size.h5"); hsize_t page_size = 1024; { FileCreateProps create_props; create_props.add(FileSpaceStrategy(H5F_FSPACE_STRATEGY_PAGE, true, 0)); create_props.add(FileSpacePageSize(page_size)); - File file(FILE_NAME, File::Truncate, create_props); + FileAccessProps access_props; + access_props.add(FileVersionBounds(H5F_LIBVER_V110, H5F_LIBVER_V110)); + + File file(file_name, File::Truncate, create_props, access_props); file.createDataSet("x", std::vector{1.0, 2.0, 3.0}); } @@ -211,7 +210,7 @@ TEST_CASE("Test page buffer size") { FileAccessProps access_props; access_props.add(PageBufferSize(1024)); - File file(FILE_NAME, File::ReadOnly, access_props); + File file(file_name, File::ReadOnly, access_props); auto accesses = std::array{0, 0}; auto hits = std::array{0, 0}; @@ -256,46 +255,46 @@ TEST_CASE("Test page buffer size") { #endif TEST_CASE("Test metadata block size assignment") { - const std::string FILE_NAME("h5_meta_block_size.h5"); + const std::string file_name("h5_meta_block_size.h5"); - std::remove(FILE_NAME.c_str()); + std::remove(file_name.c_str()); { - File file(FILE_NAME, File::Truncate); + File file(file_name, File::Truncate); // Default for HDF5 CHECK(file.getMetadataBlockSize() == 2048); } - std::remove(FILE_NAME.c_str()); + std::remove(file_name.c_str()); { FileAccessProps fapl; fapl.add(MetadataBlockSize(10240)); - File file(FILE_NAME, File::Truncate, fapl); + File file(file_name, File::Truncate, fapl); CHECK(file.getMetadataBlockSize() == 10240); } } TEST_CASE("Test group properties") { - const std::string FILE_NAME("h5_group_properties.h5"); + const std::string file_name("h5_group_properties.h5"); FileAccessProps fapl; // When using hdf5 1.10.2 and later, the lower bound may be set to // H5F_LIBVER_V18 fapl.add(FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)); - File file(FILE_NAME, File::Truncate, fapl); + File file(file_name, File::Truncate, fapl); GroupCreateProps props; - props.add(EstimatedLinkInfo(1000, 500)); + props.add(EstimatedLinkInfo(10, 60)); auto group = file.createGroup("g", props); auto sizes = group.getEstimatedLinkInfo(); - CHECK(sizes.first == 1000); - CHECK(sizes.second == 500); + CHECK(sizes.first == 10); + CHECK(sizes.second == 60); } TEST_CASE("Test allocation time") { - const std::string FILE_NAME("h5_dataset_alloc_time.h5"); - File file(FILE_NAME, File::Truncate); + const std::string file_name("h5_dataset_alloc_time.h5"); + File file(file_name, File::Truncate); size_t n_elements = 10; std::vector data(n_elements); @@ -311,13 +310,21 @@ TEST_CASE("Test allocation time") { CHECK(alloc_size == data.size() * sizeof(decltype(data)::value_type)); } +/* + * Test to ensure legacy support: DataSet used to have a default constructor. + * However, it is not useful to have a DataSet object that does not actually + * refer to a dataset in a file. Hence, the the default constructor was + * deprecated. + * This test is to ensure that the constructor is not accidentally removed and + * thereby break users' code. + */ TEST_CASE("Test default constructors") { - const std::string FILE_NAME("h5_group_test.h5"); - const std::string DATASET_NAME("dset"); - File file(FILE_NAME, File::Truncate); - auto ds = file.createDataSet(DATASET_NAME, std::vector{1, 2, 3, 4, 5}); + const std::string file_name("h5_default_ctors.h5"); + const std::string dataset_name("dset"); + File file(file_name, File::Truncate); + auto ds = file.createDataSet(dataset_name, std::vector{1, 2, 3, 4, 5}); - DataSet d2; // deprecated as it constructs unsafe objects + DataSet d2; // expect deprecation warning, as it constructs unsafe object // d2.getFile(); // runtime error CHECK(!d2.isValid()); d2 = ds; // copy @@ -325,39 +332,39 @@ TEST_CASE("Test default constructors") { } TEST_CASE("Test groups and datasets") { - const std::string FILE_NAME("h5_group_test.h5"); - const std::string DATASET_NAME("dset"); - const std::string CHUNKED_DATASET_NAME("chunked_dset"); - const std::string CHUNKED_DATASET_SMALL_NAME("chunked_dset_small"); - const std::string GROUP_NAME1("/group1"); - const std::string GROUP_NAME2("group2"); - const std::string GROUP_NESTED_NAME("group_nested"); + const std::string file_name("h5_group_test.h5"); + const std::string dataset_name("dset"); + const std::string chunked_dataset_name("chunked_dset"); + const std::string chunked_dataset_small_name("chunked_dset_small"); + const std::string group_name_1("/group1"); + const std::string group_name_2("group2"); + const std::string group_nested_name("group_nested"); { // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); // absolute group - file.createGroup(GROUP_NAME1); + file.createGroup(group_name_1); // nested group absolute - file.createGroup(GROUP_NAME1 + "/" + GROUP_NESTED_NAME); + file.createGroup(group_name_1 + "/" + group_nested_name); // relative group - Group g1 = file.createGroup(GROUP_NAME2); + Group g1 = file.createGroup(group_name_2); // relative group - Group nested = g1.createGroup(GROUP_NESTED_NAME); + Group nested = g1.createGroup(group_nested_name); // Create the data space for the dataset. std::vector dims{4, 6}; DataSpace dataspace(dims); - DataSet dataset_absolute = file.createDataSet(GROUP_NAME1 + "/" + GROUP_NESTED_NAME + "/" + - DATASET_NAME, + DataSet dataset_absolute = file.createDataSet(group_name_1 + "/" + group_nested_name + "/" + + dataset_name, dataspace, AtomicType()); DataSet dataset_relative = - nested.createDataSet(DATASET_NAME, dataspace, AtomicType()); + nested.createDataSet(dataset_name, dataspace, AtomicType()); DataSetCreateProps goodChunking; goodChunking.add(Chunking(std::vector{2, 2})); @@ -373,13 +380,13 @@ TEST_CASE("Test groups and datasets") { { SilenceHDF5 silencer; - CHECK_THROWS_AS(file.createDataSet(CHUNKED_DATASET_NAME, + CHECK_THROWS_AS(file.createDataSet(chunked_dataset_name, dataspace, AtomicType(), badChunking0), DataSetException); - CHECK_THROWS_AS(file.createDataSet(CHUNKED_DATASET_NAME, + CHECK_THROWS_AS(file.createDataSet(chunked_dataset_name, dataspace, AtomicType(), badChunking1), @@ -388,47 +395,108 @@ TEST_CASE("Test groups and datasets") { // here we use the other signature DataSet dataset_chunked = - file.createDataSet(CHUNKED_DATASET_NAME, dataspace, goodChunking, cacheConfig); + file.createDataSet(chunked_dataset_name, dataspace, goodChunking, cacheConfig); // Here we resize to smaller than the chunking size DataSet dataset_chunked_small = - file.createDataSet(CHUNKED_DATASET_SMALL_NAME, dataspace, goodChunking); + file.createDataSet(chunked_dataset_small_name, dataspace, goodChunking); dataset_chunked_small.resize({1, 1}); } // read it back { - File file(FILE_NAME, File::ReadOnly); - Group g1 = file.getGroup(GROUP_NAME1); - Group g2 = file.getGroup(GROUP_NAME2); - Group nested_group2 = g2.getGroup(GROUP_NESTED_NAME); + File file(file_name, File::ReadOnly); + Group g1 = file.getGroup(group_name_1); + Group g2 = file.getGroup(group_name_2); + Group nested_group2 = g2.getGroup(group_nested_name); - DataSet dataset_absolute = file.getDataSet(GROUP_NAME1 + "/" + GROUP_NESTED_NAME + "/" + - DATASET_NAME); + DataSet dataset_absolute = file.getDataSet(group_name_1 + "/" + group_nested_name + "/" + + dataset_name); CHECK(4 == dataset_absolute.getSpace().getDimensions()[0]); - DataSet dataset_relative = nested_group2.getDataSet(DATASET_NAME); + DataSet dataset_relative = nested_group2.getDataSet(dataset_name); CHECK(4 == dataset_relative.getSpace().getDimensions()[0]); DataSetAccessProps accessProps; accessProps.add(Caching(13, 1024, 0.5)); - DataSet dataset_chunked = file.getDataSet(CHUNKED_DATASET_NAME, accessProps); + DataSet dataset_chunked = file.getDataSet(chunked_dataset_name, accessProps); CHECK(4 == dataset_chunked.getSpace().getDimensions()[0]); - DataSet dataset_chunked_small = file.getDataSet(CHUNKED_DATASET_SMALL_NAME); + DataSet dataset_chunked_small = file.getDataSet(chunked_dataset_small_name); CHECK(1 == dataset_chunked_small.getSpace().getDimensions()[0]); } } +TEST_CASE("FileSpace") { + const std::string filename = "filespace.h5"; + const std::string ds_path = "dataset"; + const std::vector data{13, 24, 36}; + + File file(filename, File::Truncate); + file.createDataSet(ds_path, data); + + CHECK(file.getFileSize() > 0); +} + +TEST_CASE("FreeSpace (default)") { + const std::string filename = "freespace_default.h5"; + const std::string ds_path = "dataset"; + const std::vector data{13, 24, 36}; + + { + File file(filename, File::Truncate); + auto dset = file.createDataSet(ds_path, data); + } + + { + File file(filename, File::ReadWrite); + file.unlink(ds_path); + CHECK(file.getFreeSpace() > 0); + CHECK(file.getFreeSpace() < file.getFileSize()); + } +} + +#if H5_VERSION_GE(1, 10, 1) +TEST_CASE("FreeSpace (tracked)") { + const std::string filename = "freespace_tracked.h5"; + const std::string ds_path = "dataset"; + const std::vector data{13, 24, 36}; + + { + FileCreateProps fcp; + fcp.add(FileSpaceStrategy(H5F_FSPACE_STRATEGY_FSM_AGGR, true, 0)); + File file(filename, File::Truncate, fcp); + auto dset = file.createDataSet(ds_path, data); + } + + { + File file(filename, File::ReadWrite); + file.unlink(ds_path); + +#if H5_VERSION_GE(1, 12, 0) + // This fails on 1.10.x but starts working in 1.12.0 + CHECK(file.getFreeSpace() > 0); +#endif + CHECK(file.getFreeSpace() < file.getFileSize()); + } + + { + File file(filename, File::ReadOnly); + CHECK(file.getFreeSpace() > 0); + CHECK(file.getFreeSpace() < file.getFileSize()); + } +} +#endif + TEST_CASE("Test extensible datasets") { - const std::string FILE_NAME("create_extensible_dataset_example.h5"); - const std::string DATASET_NAME("dset"); + const std::string file_name("create_extensible_dataset_example.h5"); + const std::string dataset_name("dset"); constexpr long double t1[3][1] = {{2.0l}, {2.0l}, {4.0l}}; constexpr long double t2[1][3] = {{4.0l, 8.0l, 6.0l}}; { // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); // Create a dataspace with initial shape and max shape DataSpace dataspace = DataSpace({4, 5}, {17, DataSpace::UNLIMITED}); @@ -439,7 +507,7 @@ TEST_CASE("Test extensible datasets") { // Create the dataset DataSet dataset = - file.createDataSet(DATASET_NAME, dataspace, AtomicType(), props); + file.createDataSet(dataset_name, dataspace, AtomicType(), props); // Write into the initial part of the dataset dataset.select({0, 0}, {3, 1}).write(t1); @@ -462,9 +530,9 @@ TEST_CASE("Test extensible datasets") { // read it back { - File file(FILE_NAME, File::ReadOnly); + File file(file_name, File::ReadOnly); - DataSet dataset_absolute = file.getDataSet("/" + DATASET_NAME); + DataSet dataset_absolute = file.getDataSet("/" + dataset_name); const auto dims = dataset_absolute.getSpace().getDimensions(); long double values[4][6]; dataset_absolute.read(values); @@ -482,23 +550,23 @@ TEST_CASE("Test extensible datasets") { } TEST_CASE("Test reference count") { - const std::string FILE_NAME("h5_ref_count_test.h5"); - const std::string DATASET_NAME("dset"); - const std::string GROUP_NAME1("/group1"); - const std::string GROUP_NAME2("/group2"); + const std::string file_name("h5_ref_count_test.h5"); + const std::string dataset_name("dset"); + const std::string group_name_1("/group1"); + const std::string group_name_2("/group2"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); std::unique_ptr d1_ptr; std::unique_ptr g_ptr; { // create group - Group g1 = file.createGroup(GROUP_NAME1); + Group g1 = file.createGroup(group_name_1); // override object - g1 = file.createGroup(GROUP_NAME2); + g1 = file.createGroup(group_name_2); // Create the data space for the dataset. std::vector dims = {10, 10}; @@ -506,7 +574,7 @@ TEST_CASE("Test reference count") { DataSpace dataspace(dims); DataSet d1 = - file.createDataSet(GROUP_NAME1 + DATASET_NAME, dataspace, AtomicType()); + file.createDataSet(group_name_1 + dataset_name, dataspace, AtomicType()); double values[10][10] = {{0}}; values[5][0] = 1; @@ -547,18 +615,18 @@ TEST_CASE("Test reference count") { } TEST_CASE("Test simple listings") { - const std::string FILE_NAME("h5_list_test.h5"); - const std::string GROUP_NAME_CORE("group_name"); - const std::string GROUP_NESTED_NAME("/group_nested"); + const std::string file_name("h5_list_test.h5"); + const std::string group_name_core("group_name"); + const std::string group_nested_name("/group_nested"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); { // absolute group for (int i = 0; i < 2; ++i) { std::ostringstream ss; - ss << "/" << GROUP_NAME_CORE << "_" << i; + ss << "/" << group_name_core << "_" << i; file.createGroup(ss.str()); } @@ -570,7 +638,7 @@ TEST_CASE("Test simple listings") { std::vector reference_elems; for (int i = 0; i < 2; ++i) { std::ostringstream ss; - ss << GROUP_NAME_CORE << "_" << i; + ss << group_name_core << "_" << i; reference_elems.push_back(ss.str()); } @@ -578,12 +646,12 @@ TEST_CASE("Test simple listings") { } { - file.createGroup(GROUP_NESTED_NAME); - Group g_nest = file.getGroup(GROUP_NESTED_NAME); + file.createGroup(group_nested_name); + Group g_nest = file.getGroup(group_nested_name); for (int i = 0; i < 50; ++i) { std::ostringstream ss; - ss << GROUP_NAME_CORE << "_" << i; + ss << group_name_core << "_" << i; g_nest.createGroup(ss.str()); } @@ -596,7 +664,7 @@ TEST_CASE("Test simple listings") { for (int i = 0; i < 50; ++i) { std::ostringstream ss; - ss << GROUP_NAME_CORE << "_" << i; + ss << group_name_core << "_" << i; reference_elems.push_back(ss.str()); } // there is no guarantee on the order of the hdf5 index, let's sort it @@ -627,12 +695,51 @@ TEST_CASE("Simple test for type equality") { CHECK(int_var != uint_var); } +TEST_CASE("StringType") { + SECTION("enshrine-defaults") { + auto fixed_length = FixedLengthStringType(32, StringPadding::SpacePadded); + auto variable_length = VariableLengthStringType(); + + REQUIRE(fixed_length.getCharacterSet() == CharacterSet::Ascii); + REQUIRE(variable_length.getCharacterSet() == CharacterSet::Ascii); + } + + SECTION("fixed-length") { + auto fixed_length = + FixedLengthStringType(32, StringPadding::SpacePadded, CharacterSet::Utf8); + auto string_type = fixed_length.asStringType(); + + REQUIRE(string_type.getId() == fixed_length.getId()); + REQUIRE(string_type.getCharacterSet() == CharacterSet::Utf8); + REQUIRE(string_type.getPadding() == StringPadding::SpacePadded); + REQUIRE(string_type.getSize() == 32); + REQUIRE(!string_type.isVariableStr()); + REQUIRE(string_type.isFixedLenStr()); + } + + SECTION("variable-length") { + auto variable_length = VariableLengthStringType(CharacterSet::Utf8); + auto string_type = variable_length.asStringType(); + + REQUIRE(string_type.getId() == variable_length.getId()); + REQUIRE(string_type.getCharacterSet() == CharacterSet::Utf8); + REQUIRE(string_type.isVariableStr()); + REQUIRE(!string_type.isFixedLenStr()); + } + + SECTION("atomic") { + auto atomic = AtomicType(); + REQUIRE_THROWS(atomic.asStringType()); + } +} + + TEST_CASE("DataTypeEqualTakeBack") { - const std::string FILE_NAME("h5tutr_dset.h5"); - const std::string DATASET_NAME("dset"); + const std::string file_name("h5tutr_dset.h5"); + const std::string dataset_name("dset"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); // Create the data space for the dataset. std::vector dims{10, 1}; @@ -640,7 +747,7 @@ TEST_CASE("DataTypeEqualTakeBack") { DataSpace dataspace(dims); // Create a dataset with double precision floating points - DataSet dataset = file.createDataSet(DATASET_NAME + "_double", dataspace); + DataSet dataset = file.createDataSet(dataset_name + "_double", dataspace); AtomicType s; AtomicType d; @@ -654,23 +761,25 @@ TEST_CASE("DataTypeEqualTakeBack") { } TEST_CASE("DataSpaceTest") { - const std::string FILE_NAME("h5tutr_space.h5"); - const std::string DATASET_NAME("dset"); + const std::string file_name("h5tutr_space.h5"); + const std::string dataset_name("dset"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); // Create the data space for the dataset. DataSpace dataspace{std::vector{10, 1}}; // Create a dataset with size_t type - DataSet dataset = file.createDataSet(DATASET_NAME, dataspace); + DataSet dataset = file.createDataSet(dataset_name, dataspace); DataSpace space = dataset.getSpace(); DataSpace space2 = dataset.getSpace(); + auto space3 = space.clone(); // verify space id are different CHECK(space.getId() != space2.getId()); + CHECK(space.getId() != space3.getId()); // verify space id are consistent CHECK(space.getDimensions().size() == 2); @@ -678,6 +787,39 @@ TEST_CASE("DataSpaceTest") { CHECK(space.getDimensions()[1] == 1); } +TEST_CASE("DataSpace::getElementCount") { + SECTION("null") { + auto space = DataSpace(DataSpace::dataspace_null); + CHECK(space.getElementCount() == 0); + } + + SECTION("scalar") { + auto space = DataSpace(DataSpace::dataspace_scalar); + CHECK(space.getElementCount() == 1); + } + + SECTION("simple, empty (1D)") { + auto space = DataSpace(0); + CHECK(space.getElementCount() == 0); + } + + SECTION("simple, empty (2D)") { + auto space = DataSpace(0, 0); + CHECK(space.getElementCount() == 0); + } + + SECTION("simple, non-empty (2D)") { + auto space = DataSpace(2, 3); + CHECK(space.getElementCount() == 6); + } + + SECTION("FromCharArrayStrings") { + char string_array[2][10] = {"123456789", "abcdefghi"}; + auto space = DataSpace::FromCharArrayStrings(string_array); + CHECK(space.getElementCount() == 2); + } +} + TEST_CASE("DataSpaceVectorTest") { // Create 1D shortcut dataspace DataSpace space(7); @@ -764,7 +906,7 @@ TEST_CASE("HighFiveReadWriteShortcut") { filename << "h5_rw_vec_shortcut_test.h5"; const unsigned x_size = 800; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); std::vector vec; vec.resize(x_size); for (unsigned i = 0; i < x_size; i++) @@ -777,7 +919,7 @@ TEST_CASE("HighFiveReadWriteShortcut") { File file(filename.str(), File::ReadWrite | File::Create | File::Truncate); // Create a dataset with int points - DataSet dataset = file.createDataSet(DATASET_NAME, vec); + DataSet dataset = file.createDataSet(dataset_name, vec); dataset.createAttribute("str", at_contents); DataSet ds_int = file.createDataSet("/TmpInt", my_int); @@ -838,7 +980,7 @@ void readWriteAttributeVectorTest() { std::srand((unsigned) std::time(0)); const size_t x_size = 25; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); typename std::vector vec; // Create a new file using the default property lists. @@ -928,6 +1070,34 @@ TEMPLATE_LIST_TEST_CASE("ReadWriteAttributeVector", "[template]", dataset_test_t readWriteAttributeVectorTest(); } +TEST_CASE("WriteLargeAttribute") { + std::vector large_attr(16000, 0.0); + + auto fapl = HighFive::FileAccessProps::Default(); + fapl.add(HighFive::FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)); + HighFive::File file("create_large_attribute.h5", HighFive::File::Truncate, fapl); + auto gcpl = HighFive::GroupCreateProps::Default(); + gcpl.add(HighFive::AttributePhaseChange(0, 0)); + + auto group = file.createGroup("grp", gcpl); + CHECK_NOTHROW(group.createAttribute("attr", large_attr)); +} + +TEST_CASE("AttributePhaseChange") { + auto fapl = HighFive::FileAccessProps::Default(); + fapl.add(HighFive::FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)); + HighFive::File file("attribute_phase_change.h5", HighFive::File::Truncate, fapl); + + auto gcpl = HighFive::GroupCreateProps::Default(); + gcpl.add(HighFive::AttributePhaseChange(42, 24)); + + auto group = file.createGroup("grp", gcpl); + + auto actual = AttributePhaseChange(group.getCreatePropertyList()); + CHECK(actual.min_dense() == 24); + CHECK(actual.max_compact() == 42); +} + TEST_CASE("datasetOffset") { std::string filename = "datasetOffset.h5"; std::string dsetname = "dset"; @@ -951,7 +1121,7 @@ void selectionArraySimpleTest() { const size_t size_x = 10; const size_t offset_x = 2, count_x = 5; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); Vector values(size_x); @@ -961,7 +1131,7 @@ void selectionArraySimpleTest() { // Create a new file using the default property lists. File file(filename.str(), File::ReadWrite | File::Create | File::Truncate); - DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace::From(values)); + DataSet dataset = file.createDataSet(dataset_name, DataSpace::From(values)); dataset.write(values); @@ -1019,9 +1189,9 @@ TEMPLATE_LIST_TEST_CASE("selectionArraySimple", "[template]", dataset_test_types } TEST_CASE("selectionByElementMultiDim") { - const std::string FILE_NAME("h5_test_selection_multi_dim.h5"); + const std::string file_name("h5_test_selection_multi_dim.h5"); // Create a 2-dim dataset - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); std::vector dims{3, 3}; auto set = file.createDataSet("test", DataSpace(dims), AtomicType()); @@ -1062,7 +1232,7 @@ void columnSelectionTest() { const size_t x_size = 10; const size_t y_size = 7; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); T values[x_size][y_size]; @@ -1077,7 +1247,7 @@ void columnSelectionTest() { DataSpace dataspace(dims); // Create a dataset with arbitrary type - DataSet dataset = file.createDataSet(DATASET_NAME, dataspace); + DataSet dataset = file.createDataSet(dataset_name, dataspace); dataset.write(values); @@ -1249,21 +1419,21 @@ template void regularHyperSlabSelectionTest() { std::ostringstream filename; filename << "h5_rw_select_regular_hyperslab_test_" << typeNameHelper() << "_test.h5"; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); const size_t x_size = 10; const size_t y_size = 8; T values[x_size][y_size]; - auto file = setupHyperSlabFile(values, filename.str(), DATASET_NAME); + auto file = setupHyperSlabFile(values, filename.str(), dataset_name); auto test_cases = make_regular_hyperslab_test_data(); for (const auto& test_case: test_cases) { SECTION(test_case.desc) { std::vector result; - file.getDataSet(DATASET_NAME).select(test_case.slab).read(result); + file.getDataSet(dataset_name).select(test_case.slab).read(result); auto n_selected = test_case.answer.global_indices.size(); for (size_t i = 0; i < n_selected; ++i) { @@ -1365,13 +1535,13 @@ void irregularHyperSlabSelectionReadTest() { std::ostringstream filename; filename << "h5_write_select_irregular_hyperslab_test_" << typeNameHelper() << "_test.h5"; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); const size_t x_size = 10; const size_t y_size = 8; T values[x_size][y_size]; - auto file = setupHyperSlabFile(values, filename.str(), DATASET_NAME); + auto file = setupHyperSlabFile(values, filename.str(), dataset_name); auto test_cases = make_irregular_hyperslab_test_data(); @@ -1379,7 +1549,7 @@ void irregularHyperSlabSelectionReadTest() { SECTION(test_case.desc) { std::vector result; - file.getDataSet(DATASET_NAME).select(test_case.slab).read(result); + file.getDataSet(dataset_name).select(test_case.slab).read(result); auto n_selected = test_case.answer.global_indices.size(); for (size_t i = 0; i < n_selected; ++i) { @@ -1400,13 +1570,13 @@ void irregularHyperSlabSelectionWriteTest() { std::ostringstream filename; filename << "h5_write_select_irregular_hyperslab_test_" << typeNameHelper() << "_test.h5"; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); const size_t x_size = 10; const size_t y_size = 8; T orig_values[x_size][y_size]; - auto file = setupHyperSlabFile(orig_values, filename.str(), DATASET_NAME); + auto file = setupHyperSlabFile(orig_values, filename.str(), dataset_name); auto test_cases = make_irregular_hyperslab_test_data(); @@ -1417,10 +1587,10 @@ void irregularHyperSlabSelectionWriteTest() { ContentGenerate gen; std::generate(changed_values.begin(), changed_values.end(), gen); - file.getDataSet(DATASET_NAME).select(test_case.slab).write(changed_values); + file.getDataSet(dataset_name).select(test_case.slab).write(changed_values); T overwritten_values[x_size][y_size]; - file.getDataSet(DATASET_NAME).read(overwritten_values); + file.getDataSet(dataset_name).read(overwritten_values); T expected_values[x_size][y_size]; for (size_t i = 0; i < x_size; ++i) { @@ -1495,7 +1665,7 @@ TEST_CASE("attribute_scalar_rw_string") { TEST_CASE("HighFiveOutofDimension") { std::string filename("h5_rw_reg_zero_dim_test.h5"); - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); { // Create a new file using the default property lists. @@ -1503,7 +1673,7 @@ TEST_CASE("HighFiveOutofDimension") { DataSpace d_null(DataSpace::DataspaceType::dataspace_null); - DataSet d1 = file.createDataSet(DATASET_NAME, d_null); + DataSet d1 = file.createDataSet(dataset_name, d_null); file.flush(); @@ -1521,7 +1691,7 @@ template void readWriteShuffleDeflateTest() { std::ostringstream filename; filename << "h5_rw_deflate_" << typeNameHelper() << "_test.h5"; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); const size_t x_size = 128; const size_t y_size = 32; const size_t x_chunk = 16; @@ -1551,7 +1721,7 @@ void readWriteShuffleDeflateTest() { props.add(Deflate(deflate_level)); // Create a dataset with arbitrary type - DataSet dataset = file.createDataSet(DATASET_NAME, dataspace, props); + DataSet dataset = file.createDataSet(dataset_name, dataspace, props); ContentGenerate generator; generate2D(array, x_size, y_size, generator); @@ -1564,7 +1734,7 @@ void readWriteShuffleDeflateTest() { // read it back { File file_read(filename.str(), File::ReadOnly); - DataSet dataset_read = file_read.getDataSet("/" + DATASET_NAME); + DataSet dataset_read = file_read.getDataSet("/" + dataset_name); T result[x_size][y_size]; @@ -1586,7 +1756,7 @@ template void readWriteSzipTest() { std::ostringstream filename; filename << "h5_rw_szip_" << typeNameHelper() << "_test.h5"; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); const size_t x_size = 128; const size_t y_size = 32; const size_t x_chunk = 8; @@ -1614,7 +1784,7 @@ void readWriteSzipTest() { props.add(Szip(options_mask, pixels_per_block)); // Create a dataset with arbitrary type - DataSet dataset = file.createDataSet(DATASET_NAME, dataspace, props); + DataSet dataset = file.createDataSet(dataset_name, dataspace, props); ContentGenerate generator; generate2D(array, x_size, y_size, generator); @@ -1627,7 +1797,7 @@ void readWriteSzipTest() { // read it back { File file_read(filename.str(), File::ReadOnly); - DataSet dataset_read = file_read.getDataSet("/" + DATASET_NAME); + DataSet dataset_read = file_read.getDataSet("/" + dataset_name); T result[x_size][y_size]; @@ -1650,46 +1820,455 @@ TEMPLATE_LIST_TEST_CASE("ReadWriteSzip", "[template]", dataset_test_types) { } } +TEST_CASE("CheckDimensions") { + // List of dims which can all be one-dimensional. + std::vector> test_cases{ + {1ul, 3ul}, {3ul, 1ul}, {1ul, 1ul, 3ul}, {3ul, 1ul, 1ul}, {1ul, 3ul, 1ul}}; + + for (const auto& dims: test_cases) { + auto actual = details::checkDimensions(dims, 1ul); + + INFO("dims = " + details::format_vector(dims) + ", n_dims = 1"); + CHECK(actual); + + INFO("dims = " + details::format_vector(dims) + ", n_dims = 1"); + CHECK(!details::checkDimensions(dims, dims.size() + 1)); + } + + CHECK(details::checkDimensions(std::vector{1ul}, 0ul)); + CHECK(details::checkDimensions(std::vector{1ul}, 1ul)); + + CHECK(!details::checkDimensions(std::vector{0ul}, 0ul)); + CHECK(!details::checkDimensions(std::vector{2ul}, 0ul)); + + CHECK(!details::checkDimensions(std::vector{1ul, 2ul, 3ul}, 2ul)); + CHECK(details::checkDimensions(std::vector{3ul, 2ul, 1ul}, 2ul)); + + CHECK(details::checkDimensions(std::vector{1ul, 1ul, 1ul, 1ul}, 1ul)); + + CHECK(details::checkDimensions(std::vector{}, 0ul)); + CHECK(!details::checkDimensions(std::vector{}, 1ul)); + CHECK(!details::checkDimensions(std::vector{}, 2ul)); +} + + +TEST_CASE("SqueezeDimensions") { + SECTION("possible") { + // List of testcases: the first number is n_dims then the input dimensions + // and finally the squeezed dimensions. + std::vector, std::vector>> test_cases{ + {1ul, {3ul, 1ul}, {3ul}}, + + {1ul, {1ul, 1ul, 1ul}, {1ul}}, + + {1ul, {1ul, 3ul, 1ul}, {3ul}}, + + {1ul, {3ul, 1ul, 1ul}, {3ul}}, + {2ul, {3ul, 1ul, 1ul}, {3ul, 1ul}}, + {3ul, {3ul, 1ul, 1ul}, {3ul, 1ul, 1ul}}, + + {3ul, {2ul, 1ul, 3ul}, {2ul, 1ul, 3ul}}}; + + for (const auto& tc: test_cases) { + auto n_dim_requested = std::get<0>(tc); + auto dims = std::get<1>(tc); + auto expected = std::get<2>(tc); + auto actual = details::squeezeDimensions(dims, n_dim_requested); + + CHECK(actual == expected); + } + } + + SECTION("impossible") { + // List of testcases: the first number is n_dims then the input dimensions + // and finally the squeezed dimensions. + std::vector>> test_cases{{1ul, {1ul, 2ul, 3ul}}, + {2ul, {1ul, 2ul, 3ul, 1ul}}, + + {1ul, {2ul, 1ul, 3ul}}, + {2ul, {2ul, 1ul, 3ul}}}; + + for (const auto& tc: test_cases) { + auto n_dim_requested = std::get<0>(tc); + auto dims = std::get<1>(tc); + + CHECK_THROWS(details::squeezeDimensions(dims, n_dim_requested)); + } + } +} + +void check_broadcast_1d(HighFive::File& file, + const std::vector dims, + const std::string& dataset_name) { + // This checks that: + // - we can write 1D array into 2D dataset. + // - we can read 2D dataset into a 1D array. + std::vector input_data{5.0, 6.0, 7.0}; + + + DataSpace dataspace(dims); + DataSet dataset = file.createDataSet(dataset_name, dataspace, AtomicType()); + + dataset.write(input_data); + + { + std::vector read_back; + dataset.read(read_back); + + CHECK(read_back == input_data); + } + + { + auto read_back = dataset.read>(); + CHECK(read_back == input_data); + } +} + +// Broadcasting is supported +TEST_CASE("ReadInBroadcastDims") { + const std::string file_name("h5_broadcast_dset.h5"); + const std::string dataset_name("dset"); + + // Create a new file using the default property lists. + File file(file_name, File::Truncate); + + SECTION("one-dimensional (1, 3)") { + check_broadcast_1d(file, {1, 3}, dataset_name + "_a"); + } + + SECTION("one-dimensional (3, 1)") { + check_broadcast_1d(file, {3, 1}, dataset_name + "_b"); + } + + SECTION("two-dimensional (2, 3, 1)") { + std::vector dims{2, 3, 1}; + std::vector> input_data_2d{{2.0, 3.0, 4.0}, {10.0, 11.0, 12.0}}; + + DataSpace dataspace(dims); + DataSet dataset = file.createDataSet(dataset_name + "_c", dataspace, AtomicType()); + + dataset.write(input_data_2d); + + auto check = [](const std::vector>& lhs, + const std::vector>& rhs) { + CHECK(lhs.size() == rhs.size()); + for (size_t i = 0; i < rhs.size(); ++i) { + CHECK(lhs[i].size() == rhs[i].size()); + + for (size_t j = 0; j < rhs[i].size(); ++j) { + CHECK(lhs[i][j] == rhs[i][j]); + } + } + }; + + { + std::vector> read_back; + dataset.read(read_back); + + check(read_back, input_data_2d); + } + + { + auto read_back = dataset.read>>(); + check(read_back, input_data_2d); + } + } + + SECTION("one-dimensional fixed length string") { + std::vector dims{1, 1, 2}; + char input_data[2] = "a"; + + DataSpace dataspace(dims); + DataSet dataset = file.createDataSet(dataset_name + "_d", dataspace, AtomicType()); + dataset.write(input_data); + + { + char read_back[2]; + dataset.read(read_back); + + CHECK(read_back[0] == 'a'); + CHECK(read_back[1] == '\0'); + } + } +} + + +template +struct CreateEmptyVector; + +template <> +struct CreateEmptyVector<1> { + using container_type = std::vector; + + static container_type create(const std::vector& dims) { + return container_type(dims[0], 2); + } +}; + +template +struct CreateEmptyVector { + using container_type = std::vector::container_type>; + + static container_type create(const std::vector& dims) { + auto subdims = std::vector(dims.begin() + 1, dims.end()); + return container_type(dims[0], CreateEmptyVector::create(subdims)); + } +}; + +#ifdef H5_USE_BOOST +template +struct CreateEmptyBoostMultiArray { + using container_type = boost::multi_array(n_dim)>; + + static container_type create(const std::vector& dims) { + auto container = container_type(dims); + + auto raw_data = std::vector(compute_total_size(dims)); + container.assign(raw_data.begin(), raw_data.end()); + + return container; + } +}; +#endif + + +#ifdef H5_USE_EIGEN +struct CreateEmptyEigenVector { + using container_type = Eigen::VectorXi; + + static container_type create(const std::vector& dims) { + return container_type::Constant(int(dims[0]), 2); + } +}; + +struct CreateEmptyEigenMatrix { + using container_type = Eigen::MatrixXi; + + static container_type create(const std::vector& dims) { + return container_type::Constant(int(dims[0]), int(dims[1]), 2); + } +}; +#endif + +template +void check_empty_dimensions(const Container& container, const std::vector& expected_dims) { + auto deduced_dims = details::inspector::getDimensions(container); + + REQUIRE(expected_dims.size() == deduced_dims.size()); + + // The dims after hitting the first `0` are finicky. We allow those to be deduced as either `1` + // or what the original dims said. The `1` allows broadcasting, the "same as original" enables + // statically sized objects, which conceptually have dims, even if there's no object. + bool allow_one = false; + for (size_t i = 0; i < expected_dims.size(); ++i) { + REQUIRE(((expected_dims[i] == deduced_dims[i]) || (allow_one && (deduced_dims[i] == 1ul)))); + + if (expected_dims[i] == 0) { + allow_one = true; + } + } +} + +template +void check_empty_dimensions(const std::vector& dims) { + auto input_data = CreateContainer::create(dims); + check_empty_dimensions(input_data, dims); +} + +struct ReadWriteAttribute { + template + static void create(HighFive::File& file, const std::string& name, const Container& container) { + file.createAttribute(name, container); + } + + static HighFive::Attribute get(HighFive::File& file, const std::string& name) { + return file.getAttribute(name); + } +}; + +struct ReadWriteDataSet { + template + static void create(HighFive::File& file, const std::string& name, const Container& container) { + file.createDataSet(name, container); + } + + static HighFive::DataSet get(HighFive::File& file, const std::string& name) { + return file.getDataSet(name); + } +}; + +template +void check_empty_read_write_cycle(const std::vector& dims) { + using container_type = typename CreateContainer::container_type; + + const std::string file_name("h5_empty_attr.h5"); + const std::string dataset_name("dset"); + File file(file_name, File::Truncate); + + auto input_data = CreateContainer::create(dims); + ReadWriteInterface::create(file, dataset_name, input_data); + + SECTION("read; one-dimensional vector (empty)") { + auto output_data = CreateEmptyVector<1>::create({0ul}); + + ReadWriteInterface::get(file, dataset_name).read(output_data); + check_empty_dimensions(output_data, {0ul}); + } + + SECTION("read; pre-allocated (empty)") { + auto output_data = CreateContainer::create(dims); + ReadWriteInterface::get(file, dataset_name).read(output_data); + + check_empty_dimensions(output_data, dims); + } + + SECTION("read; pre-allocated (oversized)") { + auto oversize_dims = std::vector(dims.size(), 2ul); + auto output_data = CreateContainer::create(oversize_dims); + ReadWriteInterface::get(file, dataset_name).read(output_data); + + check_empty_dimensions(output_data, dims); + } + + SECTION("read; auto-allocated") { + auto output_data = + ReadWriteInterface::get(file, dataset_name).template read(); + check_empty_dimensions(output_data, dims); + } +} + +template +void check_empty_dataset(const std::vector& dims) { + check_empty_read_write_cycle(dims); +} + +template +void check_empty_attribute(const std::vector& dims) { + check_empty_read_write_cycle(dims); +} + +template +void check_empty_everything(const std::vector& dims) { + SECTION("Empty dimensions") { + check_empty_dimensions(dims); + } + + SECTION("Empty datasets") { + check_empty_dataset(dims); + } + + SECTION("Empty attribute") { + check_empty_attribute(dims); + } +} + +#ifdef H5_USE_EIGEN +template +void check_empty_eigen(const std::vector&) {} + +template <> +void check_empty_eigen<1>(const std::vector& dims) { + SECTION("Eigen::Vector") { + check_empty_everything({dims[0], 1ul}); + } +} + +template <> +void check_empty_eigen<2>(const std::vector& dims) { + SECTION("Eigen::Matrix") { + check_empty_everything(dims); + } +} +#endif + +template +void check_empty(const std::vector& dims) { + REQUIRE(dims.size() == ndim); + + SECTION("std::vector") { + check_empty_everything>(dims); + } + +#ifdef H5_USE_BOOST + SECTION("boost::multi_array") { + check_empty_everything>(dims); + } +#endif + +#ifdef H5_USE_EIGEN + check_empty_eigen(dims); +#endif +} + +TEST_CASE("Empty arrays") { + SECTION("one-dimensional") { + check_empty<1>({0ul}); + } + + SECTION("two-dimensional") { + std::vector> testcases{{0ul, 1ul}, {1ul, 0ul}}; + + for (const auto& dims: testcases) { + SECTION(details::format_vector(dims)) { + check_empty<2>(dims); + } + } + } + + SECTION("three-dimensional") { + std::vector> testcases{{0ul, 1ul, 1ul}, + {1ul, 1ul, 0ul}, + {1ul, 0ul, 1ul}}; + + for (const auto& dims: testcases) { + SECTION(details::format_vector(dims)) { + check_empty<3>(dims); + } + } + } +} + TEST_CASE("HighFiveRecursiveGroups") { - const std::string FILE_NAME("h5_ds_exist.h5"); - const std::string GROUP_1("group1"), GROUP_2("group2"); - const std::string DS_PATH = GROUP_1 + "/" + GROUP_2; - const std::string DS_NAME = "ds"; + const std::string file_name("h5_ds_exist.h5"); + const std::string group_1("group1"); + const std::string group_2("group2"); + const std::string ds_path = group_1 + "/" + group_2; + const std::string ds_name = "ds"; // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); - CHECK(file.getName() == FILE_NAME); + CHECK(file.getName() == file_name); // Without parents creating both groups will fail { SilenceHDF5 silencer; - CHECK_THROWS_AS(file.createGroup(DS_PATH, false), std::exception); + CHECK_THROWS_AS(file.createGroup(ds_path, false), std::exception); } - Group g2 = file.createGroup(DS_PATH); + Group g2 = file.createGroup(ds_path); std::vector some_data{5.0, 6.0, 7.0}; - g2.createDataSet(DS_NAME, some_data); + g2.createDataSet(ds_name, some_data); - CHECK(file.exist(GROUP_1)); + CHECK(file.exist(group_1)); - Group g1 = file.getGroup(GROUP_1); - CHECK(g1.exist(GROUP_2)); + Group g1 = file.getGroup(group_1); + CHECK(g1.exist(group_2)); // checks with full path - CHECK(file.exist(DS_PATH)); - CHECK(file.exist(DS_PATH + "/" + DS_NAME)); + CHECK(file.exist(ds_path)); + CHECK(file.exist(ds_path + "/" + ds_name)); // Check with wrong middle path (before would raise Exception) CHECK(!file.exist(std::string("blabla/group2"))); // Using root slash - CHECK(file.exist(std::string("/") + DS_PATH)); + CHECK(file.exist(std::string("/") + ds_path)); // Check unlink with existing group - CHECK(g1.exist(GROUP_2)); - g1.unlink(GROUP_2); - CHECK(!g1.exist(GROUP_2)); + CHECK(g1.exist(group_2)); + g1.unlink(group_2); + CHECK(!g1.exist(group_2)); // Check unlink with non-existing group { @@ -1699,35 +2278,35 @@ TEST_CASE("HighFiveRecursiveGroups") { } TEST_CASE("HighFiveInspect") { - const std::string FILE_NAME("group_info.h5"); - const std::string GROUP_1("group1"); - const std::string DS_NAME = "ds"; + const std::string file_name("group_info.h5"); + const std::string group_1("group1"); + const std::string ds_name = "ds"; // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - Group g = file.createGroup(GROUP_1); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + Group g = file.createGroup(group_1); std::vector some_data{5.0, 6.0, 7.0}; - g.createDataSet(DS_NAME, some_data); + g.createDataSet(ds_name, some_data); - CHECK(file.getLinkType(GROUP_1) == LinkType::Hard); + CHECK(file.getLinkType(group_1) == LinkType::Hard); { SilenceHDF5 silencer; CHECK_THROWS_AS(file.getLinkType("x"), HighFive::GroupException); } - CHECK(file.getObjectType(GROUP_1) == ObjectType::Group); - CHECK(file.getObjectType(GROUP_1 + "/" + DS_NAME) == ObjectType::Dataset); - CHECK(g.getObjectType(DS_NAME) == ObjectType::Dataset); + CHECK(file.getObjectType(group_1) == ObjectType::Group); + CHECK(file.getObjectType(group_1 + "/" + ds_name) == ObjectType::Dataset); + CHECK(g.getObjectType(ds_name) == ObjectType::Dataset); { SilenceHDF5 silencer; - CHECK_THROWS_AS(file.getObjectType(DS_NAME), HighFive::GroupException); + CHECK_THROWS_AS(file.getObjectType(ds_name), HighFive::GroupException); } // Data type - auto ds = g.getDataSet(DS_NAME); + auto ds = g.getDataSet(ds_name); auto dt = ds.getDataType(); CHECK(dt.getClass() == DataTypeClass::Float); CHECK(dt.getSize() == 8); @@ -1767,28 +2346,28 @@ TEST_CASE("HighFiveGetPath") { } TEST_CASE("HighFiveSoftLinks") { - const std::string FILE_NAME("softlinks.h5"); - const std::string DS_PATH("/hard_link/dataset"); - const std::string LINK_PATH("/soft_link/to_ds"); + const std::string file_name("softlinks.h5"); + const std::string ds_path("/hard_link/dataset"); + const std::string link_path("/soft_link/to_ds"); const std::vector data{11, 22, 33}; { - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - auto dset = file.createDataSet(DS_PATH, data); - file.createSoftLink(LINK_PATH, dset); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + auto dset = file.createDataSet(ds_path, data); + file.createSoftLink(link_path, dset); } { - File file(FILE_NAME, File::ReadWrite); + File file(file_name, File::ReadWrite); std::vector data_out; - file.getDataSet(LINK_PATH).read(data_out); + file.getDataSet(link_path).read(data_out); CHECK(data == data_out); } { const std::string EXTERNAL_LINK_PATH("/external_link/to_ds"); File file2("link_external_to.h5", File::ReadWrite | File::Create | File::Truncate); - file2.createExternalLink(EXTERNAL_LINK_PATH, FILE_NAME, DS_PATH); + file2.createExternalLink(EXTERNAL_LINK_PATH, file_name, ds_path); std::vector data_out; file2.getDataSet(EXTERNAL_LINK_PATH).read(data_out); @@ -1796,8 +2375,72 @@ TEST_CASE("HighFiveSoftLinks") { } } +TEST_CASE("HighFiveHardLinks Dataset (create intermediate)") { + const std::string file_name("hardlinks_dataset_intermiate.h5"); + const std::string ds_path("/group/dataset"); + const std::string ds_link_path("/alternate/dataset"); + const std::vector data{12, 24, 36}; + + { + File file(file_name, File::Truncate); + auto dset = file.createDataSet(ds_path, data); + file.createHardLink(ds_link_path, dset); + file.unlink(ds_path); + } + + { + File file(file_name, File::ReadWrite); + auto data_out = file.getDataSet(ds_link_path).read>(); + CHECK(data == data_out); + } +} + +TEST_CASE("HighFiveHardLinks Dataset (relative paths)") { + const std::string file_name("hardlinks_dataset_relative.h5"); + const std::string ds_path("/group/dataset"); + const std::string ds_link_path("/alternate/dataset"); + const std::vector data{12, 24, 36}; + + { + File file(file_name, File::Truncate); + auto dset = file.createDataSet(ds_path, data); + + auto alternate = file.createGroup("/alternate"); + alternate.createHardLink("dataset", dset); + file.unlink(ds_path); + } + + { + File file(file_name, File::ReadWrite); + auto data_out = file.getDataSet(ds_link_path).read>(); + CHECK(data == data_out); + } +} + +TEST_CASE("HighFiveHardLinks Group") { + const std::string file_name("hardlinks_group.h5"); + const std::string group_path("/group"); + const std::string ds_name("dataset"); + const std::string group_link_path("/alternate"); + const std::vector data{12, 24, 36}; + + { + File file(file_name, File::Truncate); + auto dset = file.createDataSet(group_path + "/" + ds_name, data); + auto group = file.getGroup(group_path); + file.createHardLink(group_link_path, group); + file.unlink(group_path); + } + + { + File file(file_name, File::ReadWrite); + auto data_out = file.getDataSet(group_link_path + "/" + ds_name).read>(); + CHECK(data == data_out); + } +} + TEST_CASE("HighFiveRename") { - File file("move.h5", File::ReadWrite | File::Create | File::Truncate); + File file("h5_rename.h5", File::ReadWrite | File::Create | File::Truncate); int number = 100; @@ -1822,7 +2465,7 @@ TEST_CASE("HighFiveRename") { } TEST_CASE("HighFiveRenameRelative") { - File file("move.h5", File::ReadWrite | File::Create | File::Truncate); + File file("h5_rename_relative.h5", File::ReadWrite | File::Create | File::Truncate); Group group = file.createGroup("group"); int number = 100; @@ -1865,6 +2508,63 @@ TEST_CASE("HighFivePropertyObjects") { CHECK(plist_g2.isValid()); } +TEST_CASE("HighFiveLinkCreationOrderProperty") { + { // For file + const std::string file_name("h5_keep_creation_order_file.h5"); + FileCreateProps keepCreationOrder{}; + keepCreationOrder.add(LinkCreationOrder(CreationOrder::Tracked | CreationOrder::Indexed)); + + File file(file_name, File::ReadWrite | File::Create | File::Truncate, keepCreationOrder); + file.createGroup("1"); + file.createGroup("2"); + file.createGroup("10"); + + CHECK(file.listObjectNames(IndexType::CRT_ORDER) == + std::vector{"1", "2", "10"}); + CHECK(file.listObjectNames(IndexType::NAME) == std::vector{"1", "10", "2"}); + + auto fcpl = file.getCreatePropertyList(); + LinkCreationOrder linkCreationOrder(fcpl); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Tracked) != 0); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Indexed) != 0); + } + { // For groups + const std::string file_name("h5_keep_creation_order_group.h5"); + GroupCreateProps keepCreationOrder{}; + keepCreationOrder.add(LinkCreationOrder(CreationOrder::Tracked | CreationOrder::Indexed)); + + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + auto group = file.createGroup("group_crt", keepCreationOrder); + group.createGroup("1"); + group.createGroup("2"); + group.createGroup("10"); + + CHECK(group.listObjectNames(IndexType::CRT_ORDER) == + std::vector{"1", "2", "10"}); + CHECK(group.listObjectNames(IndexType::NAME) == std::vector{"1", "10", "2"}); + + auto group2 = file.createGroup("group_name"); + group2.createGroup("1"); + group2.createGroup("2"); + group2.createGroup("10"); + + CHECK(group2.listObjectNames() == std::vector{"1", "10", "2"}); + + { + auto gcpl = group.getCreatePropertyList(); + LinkCreationOrder linkCreationOrder(gcpl); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Tracked) != 0); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Indexed) != 0); + } + { + auto gcpl = group2.getCreatePropertyList(); + LinkCreationOrder linkCreationOrder(gcpl); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Tracked) == 0); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Indexed) == 0); + } + } +} + struct CSL1 { int m1; int m2; @@ -1894,11 +2594,11 @@ HIGHFIVE_REGISTER_TYPE(CSL1, create_compound_csl1) HIGHFIVE_REGISTER_TYPE(CSL2, create_compound_csl2) TEST_CASE("HighFiveCompounds") { - const std::string FILE_NAME("compounds_test.h5"); - const std::string DATASET_NAME1("/a"); - const std::string DATASET_NAME2("/b"); + const std::string file_name("compounds_test.h5"); + const std::string dataset_name1("/a"); + const std::string dataset_name2("/b"); - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); auto t3 = AtomicType(); CompoundType t1 = create_compound_csl1(); @@ -1908,7 +2608,7 @@ TEST_CASE("HighFiveCompounds") { t2.commit(file, "my_type2"); { // Not nested - auto dataset = file.createDataSet(DATASET_NAME1, DataSpace(2), t1); + auto dataset = file.createDataSet(dataset_name1, DataSpace(2), t1); std::vector csl = {{1, 1, 1}, {2, 3, 4}}; dataset.write(csl); @@ -1928,7 +2628,7 @@ TEST_CASE("HighFiveCompounds") { } { // Nested - auto dataset = file.createDataSet(DATASET_NAME2, DataSpace(2), t2); + auto dataset = file.createDataSet(dataset_name2, DataSpace(2), t2); std::vector csl = {{{1, 1, 1}, {2, 3, 4}}}; dataset.write(csl); @@ -1952,6 +2652,10 @@ TEST_CASE("HighFiveCompounds") { CompoundType t2_from_hid(t2); CHECK(t2 == t2_from_hid); + + // Back from a DataType + CHECK_NOTHROW(CompoundType(DataType(t1_from_hid))); + CHECK_THROWS(CompoundType(AtomicType{})); } struct GrandChild { @@ -2004,14 +2708,14 @@ HIGHFIVE_REGISTER_TYPE(Child, create_compound_Child) HIGHFIVE_REGISTER_TYPE(Parent, create_compound_Parent) TEST_CASE("HighFiveCompoundsNested") { - const std::string FILE_NAME("nested_compounds_test.h5"); - const std::string DATASET_NAME("/a"); + const std::string file_name("nested_compounds_test.h5"); + const std::string dataset_name("/a"); { // Write - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); auto type = create_compound_Parent(); - auto dataset = file.createDataSet(DATASET_NAME, DataSpace(2), type); + auto dataset = file.createDataSet(dataset_name, DataSpace(2), type); CHECK(dataset.getDataType().getSize() == 20); std::vector csl = {Parent{1, Child{GrandChild{1, 1, 1}, 1}}, @@ -2020,9 +2724,9 @@ TEST_CASE("HighFiveCompoundsNested") { } { // Read - File file(FILE_NAME, File::ReadOnly); + File file(file_name, File::ReadOnly); std::vector result; - auto dataset = file.getDataSet(DATASET_NAME); + auto dataset = file.getDataSet(dataset_name); CHECK(dataset.getDataType().getSize() == 20); dataset.select({0}, {2}).read(result); @@ -2085,9 +2789,9 @@ std::string check(File& f) { } TEST_CASE("HighFiveCompoundsSeveralPadding") { - const std::string FILE_NAME("padded_compounds_test.h5"); + const std::string file_name("padded_compounds_test.h5"); - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); { // Write // 4 have been choose because no padding // /* offset | size */ type = struct Record<4> { @@ -2122,17 +2826,17 @@ TEST_CASE("HighFiveCompoundsSeveralPadding") { } enum Position { - FIRST = 1, - SECOND = 2, - THIRD = 3, - LAST = -1, + highfive_first = 1, + highfive_second = 2, + highfive_third = 3, + highfive_last = -1, }; enum class Direction : signed char { - FORWARD = 1, - BACKWARD = -1, - LEFT = -2, - RIGHT = 2, + Forward = 1, + Backward = -1, + Left = -2, + Right = 2, }; // This is only for boost test @@ -2142,53 +2846,53 @@ std::ostream& operator<<(std::ostream& ost, const Direction& dir) { } EnumType create_enum_position() { - return {{"FIRST", Position::FIRST}, - {"SECOND", Position::SECOND}, - {"THIRD", Position::THIRD}, - {"LAST", Position::LAST}}; + return {{"highfive_first", Position::highfive_first}, + {"highfive_second", Position::highfive_second}, + {"highfive_third", Position::highfive_third}, + {"highfive_last", Position::highfive_last}}; } HIGHFIVE_REGISTER_TYPE(Position, create_enum_position) EnumType create_enum_direction() { - return {{"FORWARD", Direction::FORWARD}, - {"BACKWARD", Direction::BACKWARD}, - {"LEFT", Direction::LEFT}, - {"RIGHT", Direction::RIGHT}}; + return {{"Forward", Direction::Forward}, + {"Backward", Direction::Backward}, + {"Left", Direction::Left}, + {"Right", Direction::Right}}; } HIGHFIVE_REGISTER_TYPE(Direction, create_enum_direction) TEST_CASE("HighFiveEnum") { - const std::string FILE_NAME("enum_test.h5"); - const std::string DATASET_NAME1("/a"); - const std::string DATASET_NAME2("/b"); + const std::string file_name("enum_test.h5"); + const std::string dataset_name1("/a"); + const std::string dataset_name2("/b"); - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); { // Unscoped enum auto e1 = create_enum_position(); e1.commit(file, "Position"); - auto dataset = file.createDataSet(DATASET_NAME1, DataSpace(1), e1); - dataset.write(Position::FIRST); + auto dataset = file.createDataSet(dataset_name1, DataSpace(1), e1); + dataset.write(Position::highfive_first); file.flush(); Position result; dataset.select(ElementSet({0})).read(result); - CHECK(result == Position::FIRST); + CHECK(result == Position::highfive_first); } { // Scoped enum auto e1 = create_enum_direction(); e1.commit(file, "Direction"); - auto dataset = file.createDataSet(DATASET_NAME2, DataSpace(5), e1); - std::vector robot_moves({Direction::BACKWARD, - Direction::FORWARD, - Direction::FORWARD, - Direction::LEFT, - Direction::LEFT}); + auto dataset = file.createDataSet(dataset_name2, DataSpace(5), e1); + std::vector robot_moves({Direction::Backward, + Direction::Forward, + Direction::Forward, + Direction::Left, + Direction::Left}); dataset.write(robot_moves); file.flush(); @@ -2196,25 +2900,269 @@ TEST_CASE("HighFiveEnum") { std::vector result; dataset.read(result); - CHECK(result[0] == Direction::BACKWARD); - CHECK(result[1] == Direction::FORWARD); - CHECK(result[2] == Direction::FORWARD); - CHECK(result[3] == Direction::LEFT); - CHECK(result[4] == Direction::LEFT); + CHECK(result[0] == Direction::Backward); + CHECK(result[1] == Direction::Forward); + CHECK(result[2] == Direction::Forward); + CHECK(result[3] == Direction::Left); + CHECK(result[4] == Direction::Left); } } +TEST_CASE("HighFiveReadType") { + const std::string file_name("readtype_test.h5"); + const std::string datatype_name1("my_type"); + const std::string datatype_name2("position"); + + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + + CompoundType t1 = create_compound_csl1(); + t1.commit(file, datatype_name1); + + CompoundType t2 = file.getDataType(datatype_name1); + + auto t3 = create_enum_position(); + t3.commit(file, datatype_name2); + + DataType t4 = file.getDataType(datatype_name2); + + CHECK(t2 == t1); + CHECK(t4 == t3); +} + +class ForwardToAttribute { + public: + ForwardToAttribute(const HighFive::File& file) + : _file(file) {} + + template + HighFive::Attribute create(const std::string& name, const T& value) { + return _file.createAttribute(name, value); + } + + HighFive::Attribute create(const std::string& name, + const HighFive::DataSpace filespace, + const HighFive::DataType& datatype) { + return _file.createAttribute(name, filespace, datatype); + } + + HighFive::Attribute get(const std::string& name) { + return _file.getAttribute(name); + } + + private: + HighFive::File _file; +}; + +class ForwardToDataSet { + public: + ForwardToDataSet(const HighFive::File& file) + : _file(file) {} + + template + HighFive::DataSet create(const std::string& name, const T& value) { + return _file.createDataSet(name, value); + } + + HighFive::DataSet create(const std::string& name, + const HighFive::DataSpace filespace, + const HighFive::DataType& datatype) { + return _file.createDataSet(name, filespace, datatype); + } + + HighFive::DataSet get(const std::string& name) { + return _file.getDataSet(name); + } + + private: + HighFive::File _file; +}; + +template +void check_single_string(Proxy proxy, size_t string_length) { + auto value = std::string(string_length, 'o'); + auto dataspace = DataSpace::From(value); + + auto n_chars = value.size() + 1; + auto n_chars_overlength = n_chars + 10; + auto fixed_length = FixedLengthStringType(n_chars, StringPadding::NullTerminated); + auto overlength_nullterm = FixedLengthStringType(n_chars_overlength, + StringPadding::NullTerminated); + auto overlength_nullpad = FixedLengthStringType(n_chars_overlength, StringPadding::NullPadded); + auto overlength_spacepad = FixedLengthStringType(n_chars_overlength, + StringPadding::SpacePadded); + auto variable_length = VariableLengthStringType(); + + SECTION("automatic") { + proxy.create("auto", value); + REQUIRE(proxy.get("auto").template read() == value); + } + + SECTION("fixed length") { + proxy.create("fixed", dataspace, fixed_length).write(value); + REQUIRE(proxy.get("fixed").template read() == value); + } + + SECTION("overlength null-terminated") { + proxy.create("overlength_nullterm", dataspace, overlength_nullterm).write(value); + REQUIRE(proxy.get("overlength_nullterm").template read() == value); + } + + SECTION("overlength null-padded") { + proxy.create("overlength_nullpad", dataspace, overlength_nullpad).write(value); + auto expected = std::string(n_chars_overlength, '\0'); + expected.replace(0, value.size(), value.data()); + REQUIRE(proxy.get("overlength_nullpad").template read() == expected); + } + + SECTION("overlength space-padded") { + proxy.create("overlength_spacepad", dataspace, overlength_spacepad).write(value); + auto expected = std::string(n_chars_overlength, ' '); + expected.replace(0, value.size(), value.data()); + REQUIRE(proxy.get("overlength_spacepad").template read() == expected); + } + + SECTION("variable length") { + proxy.create("variable", dataspace, variable_length).write(value); + REQUIRE(proxy.get("variable").template read() == value); + } +} + +template +void check_multiple_string(Proxy proxy, size_t string_length) { + using value_t = std::vector; + auto value = value_t{std::string(string_length, 'o'), std::string(string_length, 'x')}; + + auto dataspace = DataSpace::From(value); + + auto string_overlength = string_length + 10; + auto onpoint_nullpad = FixedLengthStringType(string_length, StringPadding::NullPadded); + auto onpoint_spacepad = FixedLengthStringType(string_length, StringPadding::SpacePadded); + + auto overlength_nullterm = FixedLengthStringType(string_overlength, + StringPadding::NullTerminated); + auto overlength_nullpad = FixedLengthStringType(string_overlength, StringPadding::NullPadded); + auto overlength_spacepad = FixedLengthStringType(string_overlength, StringPadding::SpacePadded); + auto variable_length = VariableLengthStringType(); + + auto check = [](const value_t actual, const value_t& expected) { + REQUIRE(actual.size() == expected.size()); + for (size_t i = 0; i < actual.size(); ++i) { + REQUIRE(actual[i] == expected[i]); + } + }; + + SECTION("automatic") { + proxy.create("auto", value); + check(proxy.get("auto").template read(), value); + } + + SECTION("variable length") { + proxy.create("variable", dataspace, variable_length).write(value); + check(proxy.get("variable").template read(), value); + } + + auto make_padded_reference = [&](char pad, size_t n) { + auto expected = std::vector(value.size(), std::string(n, pad)); + for (size_t i = 0; i < value.size(); ++i) { + expected[i].replace(0, value[i].size(), value[i].data()); + } + + return expected; + }; + + auto check_fixed_length = [&](const std::string& label, size_t length) { + SECTION(label + " null-terminated") { + auto datatype = FixedLengthStringType(length + 1, StringPadding::NullTerminated); + proxy.create(label + "_nullterm", dataspace, datatype).write(value); + check(proxy.get(label + "_nullterm").template read(), value); + } + + SECTION(label + " null-padded") { + auto datatype = FixedLengthStringType(length, StringPadding::NullPadded); + proxy.create(label + "_nullpad", dataspace, datatype).write(value); + auto expected = make_padded_reference('\0', length); + check(proxy.get(label + "_nullpad").template read(), expected); + } + + SECTION(label + " space-padded") { + auto datatype = FixedLengthStringType(length, StringPadding::SpacePadded); + proxy.create(label + "_spacepad", dataspace, datatype).write(value); + auto expected = make_padded_reference(' ', length); + check(proxy.get(label + "_spacepad").template read(), expected); + } + }; + + check_fixed_length("onpoint", string_length); + check_fixed_length("overlength", string_length + 5); + + + SECTION("underlength null-terminated") { + auto datatype = FixedLengthStringType(string_length, StringPadding::NullTerminated); + REQUIRE_THROWS(proxy.create("underlength_nullterm", dataspace, datatype).write(value)); + } + + SECTION("underlength nullpad") { + auto datatype = FixedLengthStringType(string_length - 1, StringPadding::NullPadded); + REQUIRE_THROWS(proxy.create("underlength_nullpad", dataspace, datatype).write(value)); + } + + SECTION("underlength spacepad") { + auto datatype = FixedLengthStringType(string_length - 1, StringPadding::NullTerminated); + REQUIRE_THROWS(proxy.create("underlength_spacepad", dataspace, datatype).write(value)); + } +} + +TEST_CASE("HighFiveSTDString (dataset, single, short)") { + File file("std_string_dataset_single_short.h5", File::Truncate); + check_single_string(ForwardToDataSet(file), 3); +} + +TEST_CASE("HighFiveSTDString (attribute, single, short)") { + File file("std_string_attribute_single_short.h5", File::Truncate); + check_single_string(ForwardToAttribute(file), 3); +} + +TEST_CASE("HighFiveSTDString (dataset, single, long)") { + File file("std_string_dataset_single_long.h5", File::Truncate); + check_single_string(ForwardToDataSet(file), 256); +} + +TEST_CASE("HighFiveSTDString (attribute, single, long)") { + File file("std_string_attribute_single_long.h5", File::Truncate); + check_single_string(ForwardToAttribute(file), 256); +} + +TEST_CASE("HighFiveSTDString (dataset, multiple, short)") { + File file("std_string_dataset_multiple_short.h5", File::Truncate); + check_multiple_string(ForwardToDataSet(file), 3); +} + +TEST_CASE("HighFiveSTDString (attribute, multiple, short)") { + File file("std_string_attribute_multiple_short.h5", File::Truncate); + check_multiple_string(ForwardToAttribute(file), 3); +} + +TEST_CASE("HighFiveSTDString (dataset, multiple, long)") { + File file("std_string_dataset_multiple_short.h5", File::Truncate); + check_multiple_string(ForwardToDataSet(file), 256); +} + +TEST_CASE("HighFiveSTDString (attribute, multiple, long)") { + File file("std_string_attribute_multiple_short.h5", File::Truncate); + check_multiple_string(ForwardToAttribute(file), 256); +} + TEST_CASE("HighFiveFixedString") { - const std::string FILE_NAME("array_atomic_types.h5"); - const std::string GROUP_1("group1"); + const std::string file_name("array_atomic_types.h5"); + const std::string group_1("group1"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); char raw_strings[][10] = {"abcd", "1234"}; /// This will not compile - only char arrays - hits static_assert with a nice /// error - // file.createDataSet(DS_NAME, DataSpace(2))); + // file.createDataSet(ds_name, DataSpace(2))); { // But char should be fine auto ds = file.createDataSet("ds1", DataSpace(2)); @@ -2238,6 +3186,7 @@ TEST_CASE("HighFiveFixedString") { file.createDataSet("ds4", DataSpace(2)).write(strings_fixed); } + { // Cant convert flex-length to fixed-length const char* buffer[] = {"abcd", "1234"}; SilenceHDF5 silencer; @@ -2252,8 +3201,6 @@ TEST_CASE("HighFiveFixedString") { { // Dedicated FixedLenStringArray FixedLenStringArray<10> arr{"0000000", "1111111"}; - // For completeness, test also the other constructor - FixedLenStringArray<10> arrx(std::vector{"0000", "1111"}); // More API: test inserting something arr.push_back("2222"); @@ -2281,6 +3228,72 @@ TEST_CASE("HighFiveFixedString") { CHECK((*iter)[1] == 'y'); } } + + { + // Direct way of writing `std::string` as a fixed length + // HDF5 string. + + std::string value = "foo"; + auto n_chars = value.size() + 1; + + auto datatype = FixedLengthStringType(n_chars, StringPadding::NullTerminated); + auto dataspace = DataSpace(1); + + auto ds = file.createDataSet("ds8", dataspace, datatype); + ds.write_raw(value.data(), datatype); + + { + // Due to missing non-const overload of `data()` until C++17 we'll + // read into something else instead (don't forget the '\0'). + auto expected = std::vector(n_chars, '!'); + ds.read(expected.data(), datatype); + + CHECK(expected.size() == value.size() + 1); + for (size_t i = 0; i < value.size(); ++i) { + REQUIRE(expected[i] == value[i]); + } + } + +#if HIGHFIVE_CXX_STD >= 17 + { + auto expected = std::string(value.size(), '-'); + ds.read(expected.data(), datatype); + + REQUIRE(expected == value); + } +#endif + } + + { + size_t n_chars = 4; + size_t n_strings = 2; + + std::vector value(n_chars * n_strings, '!'); + + auto datatype = FixedLengthStringType(n_chars, StringPadding::NullTerminated); + auto dataspace = DataSpace(n_strings); + + auto ds = file.createDataSet("ds9", dataspace, datatype); + ds.write_raw(value.data(), datatype); + + auto expected = std::vector(value.size(), '-'); + ds.read(expected.data(), datatype); + + CHECK(expected.size() == value.size()); + for (size_t i = 0; i < value.size(); ++i) { + REQUIRE(expected[i] == value[i]); + } + } +} + +template +static void check_fixed_len_string_array_contents(const FixedLenStringArray& array, + const std::vector& expected) { + REQUIRE(array.size() == expected.size()); + + for (size_t i = 0; i < array.size(); ++i) { + CHECK(array[i] == expected[i]); + } } TEST_CASE("HighFiveFixedLenStringArrayStructure") { @@ -2297,16 +3310,52 @@ TEST_CASE("HighFiveFixedLenStringArrayStructure") { return output; }; + SECTION("create from std::vector (onpoint)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<4>(expected); + check_fixed_len_string_array_contents(actual, expected); + } + + SECTION("create from std::vector (oversized)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<8>(expected); + check_fixed_len_string_array_contents(actual, expected); + } + + SECTION("create from pointers (onpoint)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<4>(expected.data(), expected.data() + expected.size()); + check_fixed_len_string_array_contents(actual, expected); + } + + SECTION("create from pointers (oversized)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<8>(expected.data(), expected.data() + expected.size()); + check_fixed_len_string_array_contents(actual, expected); + } + + + SECTION("create from std::initializer_list (onpoint)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<4>{"000", "111"}; + check_fixed_len_string_array_contents(actual, expected); + } + + SECTION("create from std::initializer_list (oversized)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<8>{"000", "111"}; + check_fixed_len_string_array_contents(actual, expected); + } + // manipulate FixedLenStringArray with std::copy - { + SECTION("compatible with std::copy") { const fixed_array_t arr1{"0000000", "1111111"}; fixed_array_t arr2{"0000000", "1111111"}; std::copy(arr1.begin(), arr1.end(), std::back_inserter(arr2)); CHECK(arr2.size() == 4); } - // manipulate FixedLenStringArray with std::transform - { + SECTION("compatible with std::transform") { fixed_array_t arr; { const fixed_array_t arr1{"0000000", "1111111"}; @@ -2317,8 +3366,7 @@ TEST_CASE("HighFiveFixedLenStringArrayStructure") { CHECK(arr[1] == std::string("2222222")); } - // manipulate FixedLenStringArray with std::transform and reverse iterator - { + SECTION("compatible with std::transform (reverse iterator)") { fixed_array_t arr; { const fixed_array_t arr1{"0000000", "1111111"}; @@ -2329,8 +3377,7 @@ TEST_CASE("HighFiveFixedLenStringArrayStructure") { CHECK(arr[1] == std::string("0000000")); } - // manipulate FixedLenStringArray with std::remove_copy_if - { + SECTION("compatible with std::remove_copy_if") { fixed_array_t arr2; { const fixed_array_t arr1{"0000000", "1111111"}; @@ -2347,16 +3394,16 @@ TEST_CASE("HighFiveFixedLenStringArrayStructure") { } TEST_CASE("HighFiveFixedLenStringArrayAttribute") { - const std::string FILE_NAME("fixed_array_attr.h5"); + const std::string file_name("fixed_array_attr.h5"); // Create a new file using the default property lists. { - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); FixedLenStringArray<10> arr{"Hello", "world"}; file.createAttribute("str", arr); } // Re-read it { - File file(FILE_NAME); + File file(file_name); FixedLenStringArray<8> arr; // notice the output strings can be smaller file.getAttribute("str").read(arr); CHECK(arr.size() == 2); @@ -2366,12 +3413,12 @@ TEST_CASE("HighFiveFixedLenStringArrayAttribute") { } TEST_CASE("HighFiveReference") { - const std::string FILE_NAME("h5_ref_test.h5"); - const std::string DATASET1_NAME("dset1"); - const std::string DATASET2_NAME("dset2"); - const std::string GROUP_NAME("/group1"); - const std::string REFGROUP_NAME("/group2"); - const std::string REFDATASET_NAME("dset2"); + const std::string file_name("h5_ref_test.h5"); + const std::string dataset1_name("dset1"); + const std::string dataset2_name("dset2"); + const std::string group_name("/group1"); + const std::string refgroup_name("/group2"); + const std::string refdataset_name("dset2"); ContentGenerate generator; std::vector vec1(4); @@ -2380,28 +3427,28 @@ TEST_CASE("HighFiveReference") { std::generate(vec2.begin(), vec2.end(), generator); { // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); // create group - Group g1 = file.createGroup(GROUP_NAME); + Group g1 = file.createGroup(group_name); // create datasets and write some data - DataSet dataset1 = g1.createDataSet(DATASET1_NAME, vec1); - DataSet dataset2 = g1.createDataSet(DATASET2_NAME, vec2); + DataSet dataset1 = g1.createDataSet(dataset1_name, vec1); + DataSet dataset2 = g1.createDataSet(dataset2_name, vec2); // create group to hold reference - Group refgroup = file.createGroup(REFGROUP_NAME); + Group refgroup = file.createGroup(refgroup_name); // create the references and write them into a new dataset inside refgroup auto references = std::vector({{g1, dataset1}, {file, g1}}); - DataSet ref_ds = refgroup.createDataSet(REFDATASET_NAME, references); + DataSet ref_ds = refgroup.createDataSet(refdataset_name, references); } // read it back { - File file(FILE_NAME, File::ReadOnly); - Group refgroup = file.getGroup(REFGROUP_NAME); + File file(file_name, File::ReadOnly); + Group refgroup = file.getGroup(refgroup_name); - DataSet refdataset = refgroup.getDataSet(REFDATASET_NAME); + DataSet refdataset = refgroup.getDataSet(refdataset_name); CHECK(2 == refdataset.getSpace().getDimensions()[0]); auto refs = std::vector(); refdataset.read(refs); @@ -2414,7 +3461,7 @@ TEST_CASE("HighFiveReference") { } auto group = refs[1].dereference(file); - DataSet data_ds2 = group.getDataSet(DATASET2_NAME); + DataSet data_ds2 = group.getDataSet(dataset2_name); std::vector rdata2; data_ds2.read(rdata2); for (size_t i = 0; i < rdata2.size(); ++i) { @@ -2424,15 +3471,15 @@ TEST_CASE("HighFiveReference") { } TEST_CASE("HighFiveReadWriteConsts") { - const std::string FILE_NAME("3d_dataset_from_flat.h5"); - const std::string DATASET_NAME("dset"); + const std::string file_name("3d_dataset_from_flat.h5"); + const std::string dataset_name("dset"); const std::array DIMS{3, 3, 3}; using datatype = int; - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); DataSpace dataspace = DataSpace(DIMS); - DataSet dataset = file.createDataSet(DATASET_NAME, dataspace); + DataSet dataset = file.createDataSet(dataset_name, dataspace); std::vector const t1(DIMS[0] * DIMS[1] * DIMS[2], 1); auto raw_3d_vec_const = reinterpret_cast(t1.data()); dataset.write(raw_3d_vec_const); @@ -2468,68 +3515,68 @@ TEST_CASE("HighFiveDataTypeClass") { template void test_eigen_vec(File& file, const std::string& test_flavor, const T& vec_input, T& vec_output) { - const std::string DS_NAME = "ds"; - file.createDataSet(DS_NAME + test_flavor, vec_input).write(vec_input); - file.getDataSet(DS_NAME + test_flavor).read(vec_output); + const std::string ds_name = "ds"; + file.createDataSet(ds_name + test_flavor, vec_input).write(vec_input); + file.getDataSet(ds_name + test_flavor).read(vec_output); CHECK(vec_input == vec_output); } TEST_CASE("HighFiveEigen") { - const std::string FILE_NAME("test_eigen.h5"); + const std::string file_name("test_eigen.h5"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - std::string DS_NAME_FLAVOR; + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + std::string ds_name_flavor; // std::vector> { - DS_NAME_FLAVOR = "VectorOfVectorOfPOD"; + ds_name_flavor = "VectorOfVectorOfPOD"; std::vector> vec_in{{5.0f, 6.0f, 7.0f}, {5.1f, 6.1f, 7.1f}, {5.2f, 6.2f, 7.2f}}; std::vector> vec_out; - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + test_eigen_vec(file, ds_name_flavor, vec_in, vec_out); } // std::vector { - DS_NAME_FLAVOR = "VectorOfEigenVector3d"; + ds_name_flavor = "VectorOfEigenVector3d"; std::vector vec_in{{5.0, 6.0, 7.0}, {7.0, 8.0, 9.0}}; std::vector vec_out; - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + test_eigen_vec(file, ds_name_flavor, vec_in, vec_out); } // Eigen Vector2d { - DS_NAME_FLAVOR = "EigenVector2d"; + ds_name_flavor = "EigenVector2d"; Eigen::Vector2d vec_in{5.0, 6.0}; Eigen::Vector2d vec_out; - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + test_eigen_vec(file, ds_name_flavor, vec_in, vec_out); } // Eigen Matrix { - DS_NAME_FLAVOR = "EigenMatrix"; + ds_name_flavor = "EigenMatrix"; Eigen::Matrix vec_in; vec_in << 1, 2, 3, 4, 5, 6, 7, 8, 9; Eigen::Matrix vec_out; - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + CHECK_THROWS(test_eigen_vec(file, ds_name_flavor, vec_in, vec_out)); } // Eigen MatrixXd { - DS_NAME_FLAVOR = "EigenMatrixXd"; + ds_name_flavor = "EigenMatrixXd"; Eigen::MatrixXd vec_in = 100. * Eigen::MatrixXd::Random(20, 5); Eigen::MatrixXd vec_out(20, 5); - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + CHECK_THROWS(test_eigen_vec(file, ds_name_flavor, vec_in, vec_out)); } // std::vector { - DS_NAME_FLAVOR = "VectorEigenMatrixXd"; + ds_name_flavor = "VectorEigenMatrixXd"; Eigen::MatrixXd m1 = 100. * Eigen::MatrixXd::Random(20, 5); Eigen::MatrixXd m2 = 100. * Eigen::MatrixXd::Random(20, 5); @@ -2538,13 +3585,13 @@ TEST_CASE("HighFiveEigen") { vec_in.push_back(m2); std::vector vec_out(2, Eigen::MatrixXd::Zero(20, 5)); - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + CHECK_THROWS(test_eigen_vec(file, ds_name_flavor, vec_in, vec_out)); } #ifdef H5_USE_BOOST // boost::multi_array { - DS_NAME_FLAVOR = "BMultiEigenVector3f"; + ds_name_flavor = "BMultiEigenVector3f"; boost::multi_array vec_in(boost::extents[3][2][2]); for (int i = 0; i < 3; ++i) { @@ -2556,12 +3603,12 @@ TEST_CASE("HighFiveEigen") { } boost::multi_array vec_out(boost::extents[3][2][2]); - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + test_eigen_vec(file, ds_name_flavor, vec_in, vec_out); } // boost::multi_array { - DS_NAME_FLAVOR = "BMultiEigenMatrixXd"; + ds_name_flavor = "BMultiEigenMatrixXd"; boost::multi_array vec_in(boost::extents[3][2][2]); for (int i = 0; i < 3; ++i) { @@ -2572,17 +3619,144 @@ TEST_CASE("HighFiveEigen") { } } boost::multi_array vec_out(boost::extents[3][2][2]); - for (int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) { for (int j = 0; j < 2; ++j) { for (int k = 0; k < 2; ++k) { vec_out[i][j][k] = Eigen::MatrixXd::Zero(3, 3); } } - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + } + + CHECK_THROWS(test_eigen_vec(file, ds_name_flavor, vec_in, vec_out)); } #endif } #endif -TEST_MAIN() \ No newline at end of file +TEST_CASE("Logging") { + struct TestLogger { + LogSeverity last_log_severity = LogSeverity(11); + std::string last_message = "---"; + + void operator()(LogSeverity log_severity, + const std::string& message, + const std::string&, + int) { + std::cout << "Something got logged !!!" << message << " " << to_string(log_severity) + << std::endl; + last_log_severity = log_severity; + last_message = message; + } + }; + + auto test_logger = TestLogger(); + + register_logging_callback( + [&test_logger](LogSeverity log_severity, + const std::string& message, + const std::string& file, + int line) { test_logger(log_severity, message, file, line); }); + + auto check = [&test_logger](bool should_log, const auto& message, LogSeverity log_severity) { + if (should_log && (HIGHFIVE_LOG_LEVEL <= int(log_severity))) { + REQUIRE(test_logger.last_message == message); + REQUIRE(test_logger.last_log_severity == log_severity); + } else { + REQUIRE(test_logger.last_message != message); + REQUIRE(test_logger.last_log_severity != log_severity); + } + }; + + SECTION("LOG_DEBUG") { + auto message = "Debug!"; + HIGHFIVE_LOG_DEBUG(message); + check(true, message, LogSeverity::Debug); + } + + SECTION("LOG_DEBUG_IF true") { + auto message = "DEBUG_IF true!"; + HIGHFIVE_LOG_DEBUG_IF(true, message); + check(true, message, LogSeverity::Debug); + } + + SECTION("LOG_DEBUG_IF false") { + auto message = "DEBUG_IF false!"; + HIGHFIVE_LOG_DEBUG_IF(false, message); + check(false, message, LogSeverity::Debug); + } + + SECTION("LOG_INFO") { + auto message = "Info!"; + HIGHFIVE_LOG_INFO(message); + check(true, message, LogSeverity::Info); + } + + SECTION("LOG_INFO_IF true") { + auto message = "INFO_IF true!"; + HIGHFIVE_LOG_INFO_IF(true, message); + check(true, message, LogSeverity::Info); + } + + SECTION("LOG_INFO_IF false") { + auto message = "INFO_IF false!"; + HIGHFIVE_LOG_INFO_IF(false, message); + check(false, message, LogSeverity::Info); + } + + SECTION("LOG_WARN") { + auto message = "Warn!"; + HIGHFIVE_LOG_WARN(message); + check(true, message, LogSeverity::Warn); + } + + SECTION("LOG_WARN_IF true") { + auto message = "WARN_IF true!"; + HIGHFIVE_LOG_WARN_IF(true, message); + check(true, message, LogSeverity::Warn); + } + + SECTION("LOG_WARN_IF false") { + auto message = "WARN_IF false!"; + HIGHFIVE_LOG_WARN_IF(false, message); + check(false, message, LogSeverity::Warn); + } + + SECTION("LOG_ERROR") { + auto message = "Error!"; + HIGHFIVE_LOG_ERROR(message); + check(true, message, LogSeverity::Error); + } + + SECTION("LOG_ERROR_IF true") { + auto message = "ERROR_IF true!"; + HIGHFIVE_LOG_ERROR_IF(true, message); + check(true, message, LogSeverity::Error); + } + + SECTION("LOG_ERROR_IF false") { + auto message = "ERROR_IF false!"; + HIGHFIVE_LOG_ERROR_IF(false, message); + check(false, message, LogSeverity::Error); + } +} + +#define HIGHFIVE_STRINGIFY_VALUE(s) HIGHFIVE_STRINGIFY_NAME(s) +#define HIGHFIVE_STRINGIFY_NAME(s) #s + + +TEST_CASE("Version Numbers") { + int major = HIGHFIVE_VERSION_MAJOR; + int minor = HIGHFIVE_VERSION_MINOR; + int patch = HIGHFIVE_VERSION_PATCH; + std::string version = HIGHFIVE_STRINGIFY_VALUE(HIGHFIVE_VERSION); + + auto expected = std::to_string(major) + "." + std::to_string(minor) + "." + + std::to_string(patch); + + CHECK(version == expected); + CHECK(HIGHFIVE_VERSION_STRING == expected); +} + +#undef HIGHFIVE_STRINGIFY_VALUE +#undef HIGHFIVE_STRINGIFY_NAME diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_easy.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_easy.cpp similarity index 78% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_easy.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_easy.cpp index 0df27b09a6..e003c32340 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_easy.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_easy.cpp @@ -27,8 +27,7 @@ #include #endif -#define CATCH_CONFIG_MAIN -#include +#include TEST_CASE("H5Easy_Compression") { { @@ -57,40 +56,66 @@ TEST_CASE("H5Easy_Compression") { } TEST_CASE("H5Easy_scalar") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_scalar.h5", H5Easy::File::Overwrite); double a = 1.2345; int b = 12345; std::string c = "12345"; + std::complex d = std::complex(1.2345, -5.4321); + std::complex e = std::complex(12345, -54321); H5Easy::dump(file, "/path/to/a", a); H5Easy::dump(file, "/path/to/b", b); H5Easy::dump(file, "/path/to/c", c); H5Easy::dump(file, "/path/to/c", c, H5Easy::DumpMode::Overwrite); + H5Easy::dump(file, "/path/to/d", d); + H5Easy::dump(file, "/path/to/e", e); double a_r = H5Easy::load(file, "/path/to/a"); int b_r = H5Easy::load(file, "/path/to/b"); std::string c_r = H5Easy::load(file, "/path/to/c"); + std::complex d_r = H5Easy::load>(file, "/path/to/d"); + std::complex e_r = H5Easy::load>(file, "/path/to/e"); CHECK(a == a_r); CHECK(b == b_r); CHECK(c == c_r); + CHECK(d == d_r); + CHECK(e == e_r); } TEST_CASE("H5Easy_vector1d") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_vector1d.h5", H5Easy::File::Overwrite); std::vector a = {1, 2, 3, 4, 5}; + std::vector> b = {std::complex(1, .1), + std::complex(2, -.4), + std::complex(3, .9), + std::complex(4, -.16), + std::complex(5, .25)}; + std::vector> c = {std::complex(1, -5), + std::complex(2, -4), + std::complex(3, -3), + std::complex(4, -2), + std::complex(5, -1)}; H5Easy::dump(file, "/path/to/a", a); + H5Easy::dump(file, "/path/to/b", b); + H5Easy::dump(file, "/path/to/c", c); std::vector a_r = H5Easy::load>(file, "/path/to/a"); + std::vector> b_r = + H5Easy::load>>(file, "/path/to/b"); + std::vector> c_r = + H5Easy::load>>(file, "/path/to/c"); CHECK(a == a_r); + CHECK(b == b_r); + CHECK(c == c_r); } TEST_CASE("H5Easy_vector2d") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_vector2d.h5", H5Easy::File::Overwrite); std::vector> a({{0, 1}, {2, 3}, {4, 5}}); @@ -102,7 +127,7 @@ TEST_CASE("H5Easy_vector2d") { } TEST_CASE("H5Easy_vector2d_compression") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_vector2d_compression.h5", H5Easy::File::Overwrite); std::vector> a({{0, 1}, {2, 3}, {4, 5}}); @@ -119,7 +144,7 @@ TEST_CASE("H5Easy_vector2d_compression") { } TEST_CASE("H5Easy_vector3d") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_vector3d.h5", H5Easy::File::Overwrite); using type = std::vector>>; @@ -133,7 +158,7 @@ TEST_CASE("H5Easy_vector3d") { } TEST_CASE("H5Easy_Attribute_scalar") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_attribute_scalar.h5", H5Easy::File::Overwrite); double a = 1.2345; int b = 12345; @@ -156,7 +181,7 @@ TEST_CASE("H5Easy_Attribute_scalar") { #ifdef H5_USE_XTENSOR TEST_CASE("H5Easy_extend1d") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_extend1d.h5", H5Easy::File::Overwrite); for (size_t i = 0; i < 10; ++i) { H5Easy::dump(file, "/path/to/A", i, {i}); @@ -173,7 +198,7 @@ TEST_CASE("H5Easy_extend1d") { } TEST_CASE("H5Easy_extend2d") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_extend2d.h5", H5Easy::File::Overwrite); for (size_t i = 0; i < 10; ++i) { for (size_t j = 0; j < 5; ++j) { @@ -194,7 +219,7 @@ TEST_CASE("H5Easy_extend2d") { } TEST_CASE("H5Easy_xtensor") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_xtensor.h5", H5Easy::File::Overwrite); xt::xtensor A = 100. * xt::random::randn({20, 5}); xt::xtensor B = A; @@ -210,7 +235,7 @@ TEST_CASE("H5Easy_xtensor") { } TEST_CASE("H5Easy_xarray") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_xarray.h5", H5Easy::File::Overwrite); xt::xarray A = 100. * xt::random::randn({20, 5}); xt::xarray B = A; @@ -226,7 +251,7 @@ TEST_CASE("H5Easy_xarray") { } TEST_CASE("H5Easy_view") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_view.h5", H5Easy::File::Overwrite); xt::xtensor A = 100. * xt::random::randn({20, 5}); auto a = xt::view(A, xt::range(0, 10), xt::range(0, 10)); @@ -239,7 +264,7 @@ TEST_CASE("H5Easy_view") { } TEST_CASE("H5Easy_xtensor_compress") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_xtensor_compress.h5", H5Easy::File::Overwrite); xt::xtensor A = 100. * xt::random::randn({20, 5}); xt::xtensor B = A; @@ -261,7 +286,7 @@ TEST_CASE("H5Easy_xtensor_compress") { } TEST_CASE("H5Easy_Attribute_xtensor") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_attribute_xtensor.h5", H5Easy::File::Overwrite); xt::xtensor A = 100. * xt::random::randn({20, 5}); xt::xtensor B = A; @@ -281,7 +306,7 @@ TEST_CASE("H5Easy_Attribute_xtensor") { #ifdef H5_USE_EIGEN TEST_CASE("H5Easy_Eigen_MatrixX") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_eigen_MatrixX.h5", H5Easy::File::Overwrite); Eigen::MatrixXd A = 100. * Eigen::MatrixXd::Random(20, 5); Eigen::MatrixXi B = A.cast(); @@ -297,7 +322,7 @@ TEST_CASE("H5Easy_Eigen_MatrixX") { } TEST_CASE("H5Easy_Eigen_ArrayXX") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_eigen_ArrayXX.h5", H5Easy::File::Overwrite); Eigen::ArrayXXf A = 100. * Eigen::ArrayXXf::Random(20, 5); Eigen::ArrayXXi B = A.cast(); @@ -313,7 +338,7 @@ TEST_CASE("H5Easy_Eigen_ArrayXX") { } TEST_CASE("H5Easy_Eigen_ArrayX") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_eigen_ArrayX.h5", H5Easy::File::Overwrite); Eigen::ArrayXf A = Eigen::ArrayXf::Random(50); Eigen::ArrayXi B = A.cast(); @@ -330,7 +355,7 @@ TEST_CASE("H5Easy_Eigen_ArrayX") { TEST_CASE("H5Easy_Eigen_VectorX") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_eigen_VectorX.h5", H5Easy::File::Overwrite); Eigen::VectorXd A = 100. * Eigen::VectorXd::Random(20); Eigen::VectorXi B = A.cast(); @@ -349,7 +374,7 @@ TEST_CASE("H5Easy_Eigen_MatrixXRowMajor") { typedef Eigen::Matrix MatrixXd; typedef Eigen::Matrix MatrixXi; - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("H5Easy_Eigen_MatrixXRowMajor.h5", H5Easy::File::Overwrite); MatrixXd A = 100. * MatrixXd::Random(20, 5); MatrixXi B = A.cast(); @@ -368,7 +393,7 @@ TEST_CASE("H5Easy_Eigen_VectorXRowMajor") { typedef Eigen::Matrix VectorXd; typedef Eigen::Matrix VectorXi; - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_eigen_VectorXRowMajor.h5", H5Easy::File::Overwrite); VectorXd A = 100. * VectorXd::Random(20); VectorXi B = A.cast(); @@ -384,7 +409,7 @@ TEST_CASE("H5Easy_Eigen_VectorXRowMajor") { } TEST_CASE("H5Easy_Eigen_Map") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_eigen_Map.h5", H5Easy::File::Overwrite); std::vector A = {1, 2, 3, 4, 5, 6, 7, 8, 9}; Eigen::Map mapped_vector(A.data(), static_cast(A.size())); @@ -397,7 +422,7 @@ TEST_CASE("H5Easy_Eigen_Map") { } TEST_CASE("H5Easy_Attribute_Eigen_MatrixX") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_attribute_eigen_MatrixX.h5", H5Easy::File::Overwrite); Eigen::MatrixXd A = 100. * Eigen::MatrixXd::Random(20, 5); Eigen::MatrixXi B = A.cast(); @@ -416,7 +441,7 @@ TEST_CASE("H5Easy_Attribute_Eigen_MatrixX") { #ifdef H5_USE_OPENCV TEST_CASE("H5Easy_OpenCV_Mat_") { - H5Easy::File file("test.h5", H5Easy::File::Overwrite); + H5Easy::File file("h5easy_opencv_Mat_.h5", H5Easy::File::Overwrite); using T = typename cv::Mat_; @@ -437,6 +462,7 @@ TEST_CASE("H5Easy_OpenCV_Mat_") { H5Easy::dump(file, "/path/to/A", A); H5Easy::dumpAttribute(file, "/path/to/A", "attr", A); + T A_r = H5Easy::load(file, "/path/to/A"); T B_r = H5Easy::loadAttribute(file, "/path/to/A", "attr"); diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_multi_dims.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_multi_dims.cpp similarity index 97% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_multi_dims.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_multi_dims.cpp index 66ca071056..442f1c9cc5 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_multi_dims.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_multi_dims.cpp @@ -10,16 +10,15 @@ #include #include -#include -#include +#include #ifdef H5_USE_BOOST #include #endif -#define CATCH_CONFIG_MAIN -#include +#include +#include #include "tests_high_five.hpp" diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_parallel.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_parallel.cpp similarity index 91% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_parallel.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_parallel.cpp index a51e6cbde8..8b096205e8 100644 --- a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_high_five_parallel.cpp +++ b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_high_five_parallel.cpp @@ -13,14 +13,11 @@ #include #include -#include -#include -#include -#include - -#define CATCH_CONFIG_RUNNER -#include +#include +#include +#include +#include #include "tests_high_five.hpp" using namespace HighFive; @@ -40,12 +37,10 @@ struct MpiFixture { }; void check_was_collective(const DataTransferProps& xfer_props) { - uint32_t local_cause = 0, global_cause = 0; - if (H5Pget_mpio_no_collective_cause(xfer_props.getId(), &local_cause, &global_cause) < 0) { - throw std::runtime_error("Failed to check mpio_no_collective_cause."); - } - CHECK(local_cause == 0); - CHECK(global_cause == 0); + auto mnccp = MpioNoCollectiveCause(xfer_props); + CHECK(mnccp.wasCollective()); + CHECK(mnccp.getLocalCause() == 0); + CHECK(mnccp.getGlobalCause() == 0); } template diff --git a/externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_import_public_headers.cpp b/externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_import_public_headers.cpp similarity index 100% rename from externals/coda-oss/modules/drivers/highfive/HighFive-2.6.2/tests/unit/tests_import_public_headers.cpp rename to externals/coda-oss/modules/drivers/highfive/HighFive-2.8.0/tests/unit/tests_import_public_headers.cpp diff --git a/externals/coda-oss/modules/drivers/highfive/README.txt b/externals/coda-oss/modules/drivers/highfive/README.txt index e057764ba0..58aac5612c 100644 --- a/externals/coda-oss/modules/drivers/highfive/README.txt +++ b/externals/coda-oss/modules/drivers/highfive/README.txt @@ -1,2 +1,2 @@ -HighFive (HDF5 header-only C++ library) from https://github.com/BlueBrain/HighFive - +HighFive (HDF5 header-only C++ library) from https://github.com/BlueBrain/HighFive + diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Attribute.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Attribute.hpp index 9efa17df5a..810d388ae8 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Attribute.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Attribute.hpp @@ -6,86 +6,238 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5ATTRIBUTE_HPP -#define H5ATTRIBUTE_HPP +#pragma once #include -#include "H5Apublic.h" +#include -#include "H5DataSpace.hpp" #include "H5DataType.hpp" #include "H5Object.hpp" +#include "bits/H5Friends.hpp" #include "bits/H5Path_traits.hpp" namespace HighFive { +class DataSpace; +namespace detail { + +/// \brief Internal hack to create an `Attribute` from an ID. +/// +/// WARNING: Creating an Attribute from an ID has implications w.r.t. the lifetime of the object +/// that got passed via its ID. Using this method careless opens up the suite of issues +/// related to C-style resource management, including the analog of double free, dangling +/// pointers, etc. +/// +/// NOTE: This is not part of the API and only serves to work around a compiler issue in GCC which +/// prevents us from using `friend`s instead. This function should only be used for internal +/// purposes. The problematic construct is: /// -/// \brief Class representing an attribute of a dataset or group +/// template +/// friend class SomeCRTP; /// +/// \private +Attribute make_attribute(hid_t hid); +} // namespace detail + +/// \brief Class representing an Attribute of a DataSet or Group +/// +/// \sa AnnotateTraits::createAttribute, AnnotateTraits::getAttribute, AnnotateTraits::listAttributeNames, AnnotateTraits::hasAttribute, AnnotateTraits::deleteAttribute for create, get, list, check or delete Attribute class Attribute: public Object, public PathTraits { public: const static ObjectType type = ObjectType::Attribute; - /// - /// \brief return the name of the current attribute - /// \return the name of the attribute + /// \brief Get the name of the current Attribute. + /// \code{.cpp} + /// auto attr = dset.createAttribute("my_attribute", DataSpace::From(string_list)); + /// std::cout << attr.getName() << std::endl; // Will print "my_attribute" + /// \endcode + /// \since 2.2.2 std::string getName() const; + /// \brief The number of bytes required to store the attribute in the HDF5 file. + /// \code{.cpp} + /// size_t size = dset.createAttribute("foo", DataSpace(1, 2)).getStorageSize(); + /// \endcode + /// \since 1.0 size_t getStorageSize() const; - /// - /// \brief getDataType - /// \return return the datatype associated with this dataset - /// + /// \brief Get the DataType of the Attribute. + /// \code{.cpp} + /// Attribute attr = dset.createAttribute("foo", DataSpace(1, 2)); + /// auto dtype = attr.getDataType(); // Will be an hdf5 type deduced from int + /// \endcode + /// \since 1.0 DataType getDataType() const; - /// - /// \brief getSpace - /// \return return the dataspace associated with this dataset - /// + /// \brief Get the DataSpace of the current Attribute. + /// \code{.cpp} + /// Attribute attr = dset.createAttribute("foo", DataSpace(1, 2)); + /// auto dspace = attr.getSpace(); // This will be a DataSpace of dimension 1 * 2 + /// \endcode + /// \since 1.0 DataSpace getSpace() const; - /// - /// \brief getMemSpace - /// \return same than getSpace for DataSet, compatibility with Selection - /// class - /// + /// \brief Get the DataSpace of the current Attribute. + /// \note This is an alias of getSpace(). + /// \since 1.0 DataSpace getMemSpace() const; - /// \brief Return the attribute + /// \brief Get the value of the Attribute. + /// \code{.cpp} + /// Attribute attr = dset.getAttribute("foo"); + /// // The value will contains what have been written in the attribute + /// std::vector value = attr.read>(); + /// \endcode + /// \since 2.5.0 template T read() const; + /// \brief Get the value of the Attribute in a buffer. + /// + /// Read the attribute into an existing object. Only available for + /// supported types `T`. If `array` has preallocated the correct amount of + /// memory, then this routine should not trigger reallocation. Otherwise, + /// if supported, the object will be resized. /// - /// Read the attribute into a buffer /// An exception is raised if the numbers of dimension of the buffer and of - /// the attribute are different + /// the attribute are different. /// - /// The array type can be a N-pointer or a N-vector ( e.g int** integer two - /// dimensional array ) + /// \code{.cpp} + /// // Will read into `value` avoiding memory allocation if the dimensions + /// // match, i.e. if the attribute `"foo"` has three element. + /// std::vector value(3); + /// file.getAttribute("foo").read(value); + /// \endcode + /// \since 1.0 template void read(T& array) const; - /// \brief Read the attribute into a buffer + /// \brief Read the attribute into a pre-allocated buffer. + /// \param array A pointer to the first byte of sufficient pre-allocated memory. + /// \param mem_datatype The DataType of the array. + /// + /// \note This is the shallowest wrapper around `H5Aread`. If possible + /// prefer either Attribute::read() const or Attribute::read(T&) const. + /// + /// \code{.cpp} + /// auto attr = file.getAttribute("foo"); + /// + /// // Simulate custom allocation by the application. + /// size_t n_elements = attr.getSpace().getElementCount(); + /// int * ptr = (int*) malloc(n_elements*sizeof(int)); + /// + /// // Read into the pre-allocated memory. + /// attr.read(ptr, mem_datatype); + /// \endcode + /// \since 2.2.2 template - void read(T* array, const DataType& dtype = DataType()) const; + void read(T* array, const DataType& mem_datatype) const; + /// \brief Read the attribute into a buffer. + /// Behaves like Attribute::read(T*, const DataType&) const but + /// additionally this overload deduces the memory datatype from `T`. /// - /// Write the integrality N-dimension buffer to this attribute - /// An exception is raised if the numbers of dimension of the buffer and of - /// the attribute are different + /// \param array Pointer to the first byte of pre-allocated memory. + /// + /// \note If possible prefer either Attribute::read() const or Attribute::read(T&) const. + /// + /// \code{.cpp} + /// auto attr = file.getAttribute("foo"); + /// + /// // Simulate custom allocation by the application. + /// size_t n_elements = attr.getSpace().getElementCount(); + /// int * ptr = (int*) malloc(n_elements*sizeof(int)); + /// + /// // Read into the pre-allocated memory. + /// attr.read(ptr); + /// \endcode + /// \since 2.2.2 + template + void read(T* array) const; + + /// \brief Write the value into the Attribute. /// - /// The array type can be a N-pointer or a N-vector ( e.g int** integer two - /// dimensional array ) + /// Write the value to the attribute. For supported types `T`, this overload + /// will write the value to the attribute. The datatype and dataspace are + /// deduced automatically. However, since the attribute has already been + /// created, the dimensions of `value` must match those of the attribute. + /// + /// \code{.cpp} + /// // Prefer the fused version if creating and writing the attribute + /// // at the same time. + /// dset.createAttribute("foo", std::vector{1, 2, 3}); + /// + /// // To overwrite the value: + /// std::vector value{4, 5, 6}; + /// dset.getAttribute("foo").write(value); + /// \endcode + /// \since 1.0 + template + void write(const T& value); + + /// \brief Write from a raw pointer. + /// + /// Values that have been correctly arranged memory, can be written directly + /// by passing a raw pointer. + /// + /// \param buffer Pointer to the first byte of the value. + /// \param mem_datatype The DataType of the buffer. + /// + /// \note This is the shallowest wrapper around `H5Awrite`. It's useful + /// if you need full control. If possible prefer Attribute::write. + /// + /// \code{.cpp} + /// Attribute attr = dset.createAttribute("foo", DataSpace(2, 3)); + /// + /// // Simulate the application creating `value` and only exposing access + /// // to the raw pointer `ptr`. + /// std::vector> value{{1, 2, 3}, {4, 5, 6}}; + /// int * ptr = (int*) value.data(); + /// + /// // Simply write the bytes to disk. + /// attr.write(ptr, AtomicType()); + /// \endcode + /// \since 2.2.2 template - void write(const T& buffer); + void write_raw(const T* buffer, const DataType& mem_datatype); - /// \brief Write a buffer to this attribute + /// \brief Write from a raw pointer. + /// + /// Much like Attribute::write_raw(const T*, const DataType&). + /// Additionally, this overload attempts to automatically deduce the + /// datatype of the buffer. Note, that the file datatype is already set. + /// + /// \param buffer Pointer to the first byte. + /// + /// \note If possible prefer Attribute::write. + /// + /// \code{.cpp} + /// // Simulate the application creating `value` and only exposing access + /// // to the raw pointer `ptr`. + /// std::vector> value{{1, 2, 3}, {4, 5, 6}}; + /// int * ptr = (int*) value.data(); + /// + /// // Simply write the bytes to disk. + /// attr.write(ptr); + /// \endcode + /// \since 2.2.2 template - void write_raw(const T* buffer, const DataType& dtype = DataType()); + void write_raw(const T* buffer); - /// \brief Get the list of properties for creation of this attribute + /// \brief The create property list used for this attribute. + /// + /// Some of HDF5 properties/setting of an attribute are defined by a + /// create property list. This method returns a copy of the create + /// property list used during creation of the attribute. + /// + /// \code{.cpp} + /// auto acpl = attr.getCreatePropertyList(); + /// + /// // For example to create another attribute with the same properties. + /// file.createAttribute("foo", 42, acpl); + /// \endcode + /// \since 2.5.0 AttributeCreateProps getCreatePropertyList() const { return details::get_plist(*this, H5Aget_create_plist); } @@ -93,14 +245,22 @@ class Attribute: public Object, public PathTraits { // No empty attributes Attribute() = delete; - private: + protected: using Object::Object; + private: +#if HIGHFIVE_HAS_FRIEND_DECLARATIONS template friend class ::HighFive::AnnotateTraits; -}; +#endif -} // namespace HighFive + friend Attribute detail::make_attribute(hid_t); +}; +namespace detail { +inline Attribute make_attribute(hid_t hid) { + return Attribute(hid); +} +} // namespace detail -#endif // H5ATTRIBUTE_HPP +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataSet.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataSet.hpp index a98feb4b95..0236f06c23 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataSet.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataSet.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATASET_HPP -#define H5DATASET_HPP +#pragma once #include @@ -99,6 +98,7 @@ class DataSet: public Object, return details::get_plist(*this, H5Dget_access_plist); } + /// \deprecated Default constructor creates unsafe uninitialized objects H5_DEPRECATED("Default constructor creates unsafe uninitialized objects") DataSet() = default; @@ -114,5 +114,3 @@ class DataSet: public Object, }; } // namespace HighFive - -#endif // H5DATASET_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataSpace.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataSpace.hpp index 34eb7eac8a..95d04dbbbd 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataSpace.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataSpace.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATASPACE_HPP -#define H5DATASPACE_HPP +#pragma once #include #include @@ -20,90 +19,215 @@ namespace HighFive { +/// \brief Class representing the space (dimensions) of a DataSet /// -/// \brief Class representing the space (dimensions) of a dataset -/// +/// \code{.cpp} +/// // Create a DataSpace of dimension 1 x 2 x 3 +/// DataSpace dspace(1, 2, 3); +/// std::cout << dspace.getElementCount() << std::endl; // Print 1 * 2 * 3 = 6 +/// std::cout << dspace.getNumberDimensions() << std::endl; // Print 3 +/// std::vector dims = dspace.getDimensions(); // dims is {1, 2, 3} +/// \endcode class DataSpace: public Object { public: const static ObjectType type = ObjectType::DataSpace; + /// \brief Magic value to specify that a DataSpace can grow without limit. + /// + /// This value should be used with DataSpace::DataSpace(const std::vector& dims, const + /// std::vector& maxdims); + /// + /// \since 2.0 static const size_t UNLIMITED = SIZE_MAX; - /// dataspace type + /// \brief An enum to create scalar and null DataSpace with DataSpace::DataSpace(DataspaceType dtype). + /// + /// This enum is needed otherwise we will not be able to distringuish between both with normal + /// constructors. Both have a dimension of 0. + /// \since 1.3 enum DataspaceType { - dataspace_scalar, - dataspace_null + dataspace_scalar, ///< Value to create scalar DataSpace + dataspace_null, ///< Value to create null DataSpace // simple dataspace are handle directly from their dimensions }; - /// create a dataspace of N-dimensions - /// Each dimension is configured this way - /// size(dim1) = vec[0] - /// size(dim2) = vec[1] - /// etc... + /// \brief Create a DataSpace of N-dimensions from a std::vector. + /// \param dims Dimensions of the new DataSpace + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3 + /// DataSpace(std::vector{1, 3}); + /// \endcode + /// \since 1.0 explicit DataSpace(const std::vector& dims); - // create a dataspace of N-dimensions + /// \brief Create a DataSpace of N-dimensions from a std::array. + /// \param dims Dimensions of the new DataSpace + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3 + /// DataSpace(std::array{1, 3}); + /// \endcode + /// \since 2.3 template explicit DataSpace(const std::array& dims); - /// Make sure that DataSpace({1,2,3}) works on GCC. This is - /// the shortcut form of the vector initializer, but one some compilers (gcc) - /// this does not resolve correctly without this constructor. - DataSpace(const std::initializer_list& items); - - /// Allow directly listing 1 or more dimensions to initialize, - /// that is, DataSpace(1,2) means DataSpace(std::vector{1,2}). + /// \brief Create a DataSpace of N-dimensions from an initializer list. + /// \param dims Dimensions of the new DataSpace + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3 + /// DataSpace{1, 3}; + /// \endcode + /// \since 2.1 + DataSpace(const std::initializer_list& dims); + + /// \brief Create a DataSpace of N-dimensions from direct values. + /// \param dim1 The first dimension + /// \param dims The following dimensions + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3 + /// DataSpace(1, 3); + /// \endcode + /// \since 2.1 template explicit DataSpace(size_t dim1, Args... dims); - /// Create a dataspace from an iterator pair + /// \brief Create a DataSpace from a pair of iterators. + /// \param begin The beginning of the container + /// \param end The end of the container + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3 + /// std::vector v{1, 3}; + /// DataSpace(v.begin(), v.end()); + /// \endcode /// - /// Explicitly disable DataSpace(int_like, int_like) from trying to use this constructor + /// \since 2.0 + // Attention: Explicitly disable DataSpace(int_like, int_like) from trying + // to use this constructor template ::value, IT>::type> DataSpace(const IT begin, const IT end); - /// \brief Create a resizable N-dimensional dataspace + /// \brief Create a resizable N-dimensional DataSpace. /// \param dims Initial size of dataspace /// \param maxdims Maximum size of the dataspace + /// + /// \code{.cpp} + /// // Create a DataSpace with 2 dimensions: 1 and 3. + /// // It can later be resized up to a maximum of 10 x 10 + /// DataSpace(std::vector{1, 3}, std::vector{10, 10}); + /// \endcode + /// + /// \see UNLIMITED for a DataSpace that can be resized without limit. + /// \since 2.0 explicit DataSpace(const std::vector& dims, const std::vector& maxdims); + /// \brief Create a scalar or a null DataSpace. /// - /// \brief DataSpace create a scalar dataspace or a null dataset + /// This overload enables creating scalar or null data spaces, both have + /// dimension 0. /// - explicit DataSpace(DataspaceType dtype); - - /// Create a new DataSpace - /// with a different id available for modifications - DataSpace clone() const; + /// \param space_type The value from the enum + /// + /// \code{.cpp} + /// DataSpace(DataspaceType::dataspace_scalar); + /// \endcode + /// + /// \attention Avoid braced intialization in these cases, i.e. + /// \code{.cpp} + /// // This is not a scalar dataset: + /// DataSpace{DataspaceType::dataspace_scalar}; + /// \endcode + /// + /// \since 1.3 + explicit DataSpace(DataspaceType space_type); + /// \brief Create a copy of the DataSpace which will have different id. /// - /// \brief getNumberDimensions - /// \return the number of dimensions in the current dataspace + /// \code{.cpp} + /// DataSpace dspace1(1, 3); + /// auto dspace2 = dspace.clone(); + /// \endcode /// + /// \since 1.0 + DataSpace clone() const; + + /// \brief Returns the number of dimensions of a DataSpace. + /// \code{.cpp} + /// DataSpace dspace(1, 3); + /// size_t number_of_dim = dspace.getNumberDimensions(); // returns 2 + /// \endcode + /// \since 1.0 size_t getNumberDimensions() const; - /// \brief getDimensions - /// \return return a vector of N-element, each element is the size of the - /// associated dataset dimension + /// \brief Returns the size of the dataset in each dimension. + /// + /// For zero-dimensional datasets (e.g. scalar or null datasets) an empty + /// vector is returned. + /// + /// \code{.cpp} + /// DataSpace dspace(1, 3); + /// auto dims = dspace.getDimensions(); // returns {1, 3} + /// \endcode + /// + /// \sa DataSpace::getMaxDimensions + /// + /// \since 1.0 std::vector getDimensions() const; - /// \brief getElementCount - /// \return the total number of elements in the dataspace + /// \brief Return the number of elements in this DataSpace. + /// + /// \code{.cpp} + /// DataSpace dspace(1, 3); + /// size_t elementcount = dspace.getElementCount(); // return 1 x 3 = 3 + /// \endcode + /// \since 2.1 size_t getElementCount() const; - /// \brief getMaxDimensions - /// \return return a vector of N-element, each element is the size of the - /// associated dataset maximum dimension + /// \brief Returns the maximum size of the dataset in each dimension. + /// + /// This is the maximum size a dataset can be extended to, which may be + /// different from the current size of the dataset. + /// + /// \code{.cpp} + /// DataSpace dspace(std::vector{1, 3}, std::vector{UNLIMITED, 10}); + /// dspace.getMaxDimensions(); // Return {UNLIMITED, 10} + /// \endcode + /// + /// \sa DataSpace::getDimensions + /// \since 2.0 std::vector getMaxDimensions() const; - /// Create a dataspace matching a type accepted by details::inspector + /// \brief Automatically deduce the DataSpace from a container/value. + /// + /// Certain containers and scalar values are fully supported by HighFive. + /// For these containers, HighFive can deduce the dimensions from `value`. + /// + /// \code{.cpp} + /// double d = 42.0; + /// std::vector> v = {{4, 5, 6}, {7, 8, 9}}; + /// DataSpace::From(v); // A DataSpace of dimensions 2, 3. + /// DataSpace::From(d); // A scalar dataspace. + /// \endcode + /// + /// \since 1.0 template static DataSpace From(const T& value); + /// \brief Create a DataSpace from a value of type string array. + /// \param string_array An C-array of C-string (null-terminated). + /// + /// \code{.cpp} + /// char string_array[2][10] = {"123456789", "abcdefghi"}; + /// auto dspace = DataSpace::FromCharArrayStrings(string_array); // dspace is a DataSpace of + /// dimensions 2 + /// \endcode + /// \since 2.2 template - static DataSpace FromCharArrayStrings(const char (&)[N][Width]); + static DataSpace FromCharArrayStrings(const char (&string_array)[N][Width]); protected: DataSpace() = default; @@ -117,5 +241,3 @@ class DataSpace: public Object { // We include bits right away since DataSpace is user-constructible #include "bits/H5Dataspace_misc.hpp" - -#endif // H5DATASPACE_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataType.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataType.hpp index c1b42d6318..886107961b 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataType.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5DataType.hpp @@ -6,15 +6,17 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATATYPE_HPP -#define H5DATATYPE_HPP +#pragma once #include #include +#include + #include "H5Object.hpp" #include "bits/H5Utils.hpp" +#include "bits/string_padding.hpp" #include "H5PropertyList.hpp" namespace HighFive { @@ -48,6 +50,7 @@ inline DataTypeClass operator&(DataTypeClass lhs, DataTypeClass rhs) { return static_cast(static_cast(lhs) & static_cast(rhs)); } +class StringType; /// /// \brief HDF5 Data Type @@ -86,6 +89,11 @@ class DataType: public Object { /// bool isFixedLenStr() const; + /// + /// \brief Returns this datatype as a `StringType`. + /// + StringType asStringType() const; + /// /// \brief Check the DataType was default constructed. /// Such value might represent auto-detection of the datatype from a buffer @@ -107,8 +115,67 @@ class DataType: public Object { friend class File; friend class DataSet; friend class CompoundType; + template + friend class NodeTraits; +}; + + +enum class CharacterSet : std::underlying_type::type { + Ascii = H5T_CSET_ASCII, + Utf8 = H5T_CSET_UTF8, +}; + +class StringType: public DataType { + public: + /// + /// \brief For stings return the character set. + /// + CharacterSet getCharacterSet() const; + + /// + /// \brief For fixed length stings return the padding. + /// + StringPadding getPadding() const; + + protected: + using DataType::DataType; + friend class DataType; }; +class FixedLengthStringType: public StringType { + public: + /// + /// \brief Create a fixed length string datatype. + /// + /// The string will be `size` bytes long, regardless whether it's ASCII or + /// UTF8. In particular, a string with `n` UFT8 characters in general + /// requires `4*n` bytes. + /// + /// The string padding is subtle, essentially it's just a hint. A + /// nullterminated string is guaranteed to have one `'\0'` which marks the + /// semantic end of the string. The length of the buffer must be at least + /// `size` bytes regardless. HDF5 will read or write `size` bytes, + /// irrespective of the when the `\0` occurs. + /// + /// Note that when writing passing `StringPadding::NullTerminated` is a + /// guarantee to the reader that it contains a `\0`. Therefore, make sure + /// that the string really is nullterminated. Otherwise prefer a + /// null-padded string which only means states that the buffer is filled up + /// with 0 or more `\0`. + FixedLengthStringType(size_t size, + StringPadding padding, + CharacterSet character_set = CharacterSet::Ascii); +}; + +class VariableLengthStringType: public StringType { + public: + /// + /// \brief Create a variable length string HDF5 datatype. + /// + VariableLengthStringType(CharacterSet character_set = CharacterSet::Ascii); +}; + + /// /// \brief create an HDF5 DataType from a C++ type /// @@ -176,11 +243,14 @@ class CompoundType: public DataType { size_t n_members = static_cast(result); members.reserve(n_members); for (unsigned i = 0; i < n_members; i++) { - const char* name = H5Tget_member_name(_hid, i); + char* name = H5Tget_member_name(_hid, i); size_t offset = H5Tget_member_offset(_hid, i); hid_t member_hid = H5Tget_member_type(_hid, i); DataType member_type{member_hid}; - members.emplace_back(name, member_type, offset); + members.emplace_back(std::string(name), member_type, offset); + if (H5free_memory(name) < 0) { + throw DataTypeException("Could not free names from the compound datatype"); + } } } @@ -251,7 +321,7 @@ class EnumType: public DataType { } EnumType(std::initializer_list t_members) - : EnumType(std::vector({t_members})) {} + : EnumType(std::vector(t_members)) {} /// \brief Commit datatype into the given Object /// \param object Location to commit object into @@ -281,15 +351,20 @@ DataType create_and_check_datatype(); /// Although fixed-len arrays can be created 'raw' without the need for /// this structure, to retrieve results efficiently it must be used. /// +/// \tparam N Size of the string in bytes, including the null character. Note, +/// that all string must be null-terminated. +/// template class FixedLenStringArray { public: FixedLenStringArray() = default; /// - /// \brief Create a FixedStringArray from a raw contiguous buffer + /// \brief Create a FixedStringArray from a raw contiguous buffer. /// - FixedLenStringArray(const char array[][N], std::size_t length); + /// The argument `n_strings` specifies the number of strings. + /// + FixedLenStringArray(const char array[][N], std::size_t n_strings); /// /// \brief Create a FixedStringArray from a sequence of strings. @@ -404,12 +479,10 @@ class FixedLenStringArray { /// } /// HIGHFIVE_REGISTER_TYPE(FooBar, create_enum_foobar) /// \endcode -#define HIGHFIVE_REGISTER_TYPE(type, function) \ - template <> \ - HighFive::DataType HighFive::create_datatype() { \ - return function(); \ +#define HIGHFIVE_REGISTER_TYPE(type, function) \ + template <> \ + inline HighFive::DataType HighFive::create_datatype() { \ + return function(); \ } #include "bits/H5DataType_misc.hpp" - -#endif // H5DATATYPE_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Easy.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Easy.hpp index 4bb45f9d9e..e793fd8753 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Easy.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Easy.hpp @@ -15,12 +15,10 @@ /// - xtensor objects /// - OpenCV objects -#ifndef H5EASY_HPP -#define H5EASY_HPP +#pragma once #include #include -#include // optionally enable xtensor plug-in and load the library #ifdef XTENSOR_VERSION_MAJOR @@ -102,20 +100,14 @@ class Compression { /// /// \param level the compression level template - explicit Compression(T /*level*/); - - Compression(const Compression&) = default; - Compression& operator=(const Compression&) = default; - Compression(Compression&&) = default; - Compression& operator=(Compression&&) = default; - ~Compression() = default; + Compression(T level); /// /// \brief Return compression level. inline unsigned get() const; private: - unsigned m_compression_level = 9; + unsigned m_compression_level; }; /// @@ -131,18 +123,13 @@ class DumpOptions { /// /// \brief Constructor: accept all default settings. DumpOptions() = default; - DumpOptions(const DumpOptions&) = default; - DumpOptions& operator=(const DumpOptions&) = default; - DumpOptions(DumpOptions&&) = default; - DumpOptions& operator=(DumpOptions&&) = default; - ~DumpOptions() = default; /// /// \brief Constructor: overwrite (some of the) defaults. /// \param args any of DumpMode(), Flush(), Compression() in arbitrary number and order. template - DumpOptions(Args&&... args) { - set(std::forward(args)...); + DumpOptions(Args... args) { + set(args...); } /// @@ -165,7 +152,7 @@ class DumpOptions { /// \param arg any of DumpMode(), Flush(), Compression in arbitrary number and order. /// \param args any of DumpMode(), Flush(), Compression in arbitrary number and order. template - inline void set(T arg, Args&&... args); + inline void set(T arg, Args... args); /// /// \brief Set chunk-size. If the input is rank (size) zero, automatic chunking is enabled. @@ -411,5 +398,3 @@ inline T loadAttribute(const File& file, const std::string& path, const std::str #include "h5easy_bits/H5Easy_scalar.hpp" #include "h5easy_bits/H5Easy_vector.hpp" #include "h5easy_bits/H5Easy_xtensor.hpp" - -#endif // H5EASY_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Exception.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Exception.hpp index c20ea0bef1..54905aa0fe 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Exception.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Exception.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EXCEPTION_HPP -#define H5EXCEPTION_HPP +#pragma once #include #include @@ -163,5 +162,3 @@ class ReferenceException: public Exception { } // namespace HighFive #include "bits/H5Exception_misc.hpp" - -#endif // H5EXCEPTION_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5File.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5File.hpp index 93cbee66d6..9b393e5a35 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5File.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5File.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5FILE_HPP -#define H5FILE_HPP +#pragma once #include @@ -60,7 +59,7 @@ class File: public Object, public NodeTraits, public AnnotateTraits /// \brief File /// \param filename: filepath of the HDF5 file /// \param openFlags: Open mode / flags ( ReadOnly, ReadWrite) - /// \param fileAccessProps: the file create properties + /// \param fileCreateProps: the file create properties /// \param fileAccessProps: the file access properties /// /// Open or create a new HDF5 file @@ -111,9 +110,22 @@ class File: public Object, public NodeTraits, public AnnotateTraits return details::get_plist(*this, H5Fget_access_plist); } - private: + /// \brief Get the size of this file in bytes + size_t getFileSize() const; + + /// \brief Get the amount of tracked, unused space in bytes. + /// + /// Note, this is a wrapper for `H5Fget_freespace` and returns the number + /// bytes in the free space manager. This might be different from the total + /// amount of unused space in the HDF5 file, since the free space manager + /// might not track everything or not track across open-close cycles. + size_t getFreeSpace() const; + + protected: + File() = default; using Object::Object; + private: mutable std::string _filename{}; template @@ -127,5 +139,3 @@ class File: public Object, public NodeTraits, public AnnotateTraits #include "bits/H5File_misc.hpp" #include "bits/H5Node_traits_misc.hpp" #include "bits/H5Path_traits_misc.hpp" - -#endif // H5FILE_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5FileDriver.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5FileDriver.hpp index 6f0df99261..2cd4813a36 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5FileDriver.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5FileDriver.hpp @@ -6,35 +6,27 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5FILEDRIVER_HPP -#define H5FILEDRIVER_HPP +#pragma once #include "H5PropertyList.hpp" #include "bits/H5_definitions.hpp" namespace HighFive { -/// /// \brief file driver base concept -/// +/// \deprecated Use FileAccessProps directly class H5_DEPRECATED("Use FileAccessProps directly") FileDriver: public FileAccessProps {}; #ifdef H5_HAVE_PARALLEL -/// /// \brief MPIIO Driver for Parallel HDF5 -/// - +/// \deprecated Add MPIOFileAccess directly to FileAccessProps class H5_DEPRECATED("Add MPIOFileAccess directly to FileAccessProps") MPIOFileDriver : public FileAccessProps { public: inline MPIOFileDriver(MPI_Comm mpi_comm, MPI_Info mpi_info); - - private: }; #endif } // namespace HighFive #include "bits/H5FileDriver_misc.hpp" - -#endif // H5FILEDRIVER_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Group.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Group.hpp index 60c465aedb..0a6a4cdae6 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Group.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Group.hpp @@ -6,12 +6,12 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef HIGHFIVE_H5GROUP_HPP -#define HIGHFIVE_H5GROUP_HPP +#pragma once #include #include "H5Object.hpp" +#include "bits/H5Friends.hpp" #include "bits/H5_definitions.hpp" #include "bits/H5Annotate_traits.hpp" #include "bits/H5Node_traits.hpp" @@ -19,6 +19,25 @@ namespace HighFive { +namespace detail { +/// \brief Internal hack to create an `Group` from an ID. +/// +/// WARNING: Creating an Group from an ID has implications w.r.t. the lifetime of the object +/// that got passed via its ID. Using this method careless opens up the suite of issues +/// related to C-style resource management, including the analog of double free, dangling +/// pointers, etc. +/// +/// NOTE: This is not part of the API and only serves to work around a compiler issue in GCC which +/// prevents us from using `friend`s instead. This function should only be used for internal +/// purposes. The problematic construct is: +/// +/// template +/// friend class SomeCRTP; +/// +/// \private +Group make_group(hid_t); +} // namespace detail + /// /// \brief Represents an hdf5 group class Group: public Object, @@ -28,6 +47,7 @@ class Group: public Object, public: const static ObjectType type = ObjectType::Group; + /// \deprecated Default constructor creates unsafe uninitialized objects H5_DEPRECATED("Default constructor creates unsafe uninitialized objects") Group() = default; @@ -38,30 +58,31 @@ class Group: public Object, return details::get_plist(*this, H5Gget_create_plist); } - protected: - using Object::Object; - Group(Object&& o) noexcept : Object(std::move(o)){}; + protected: + using Object::Object; + + friend Group detail::make_group(hid_t); friend class File; friend class Reference; +#if HIGHFIVE_HAS_FRIEND_DECLARATIONS template friend class ::HighFive::NodeTraits; +#endif }; inline std::pair Group::getEstimatedLinkInfo() const { - unsigned int est_num_entries; - unsigned int est_name_len; - auto gcpl = getCreatePropertyList(); - if (H5Pget_est_link_info(gcpl.getId(), &est_num_entries, &est_name_len) < 0) { - HDF5ErrMapper::ToException( - std::string("Unable to access group link size property")); - } - return std::make_pair(est_num_entries, est_name_len); + auto eli = EstimatedLinkInfo(gcpl); + return std::make_pair(eli.getEntries(), eli.getNameLength()); } -} // namespace HighFive +namespace detail { +inline Group make_group(hid_t hid) { + return Group(hid); +} +} // namespace detail -#endif // HIGHFIVE_H5GROUP_HPP +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Object.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Object.hpp index f0a090f9cf..4cf4e7de08 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Object.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Object.hpp @@ -6,16 +6,15 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5OBJECT_HPP -#define H5OBJECT_HPP +#pragma once #include #include #include -#include "H5Exception.hpp" #include "bits/H5_definitions.hpp" +#include "bits/H5Friends.hpp" namespace HighFive { @@ -32,9 +31,31 @@ enum class ObjectType { Other // Internal/custom object type }; +namespace detail { +/// \brief Internal hack to create an `Object` from an ID. +/// +/// WARNING: Creating an Object from an ID has implications w.r.t. the lifetime of the object +/// that got passed via its ID. Using this method careless opens up the suite of issues +/// related to C-style resource management, including the analog of double free, dangling +/// pointers, etc. +/// +/// NOTE: This is not part of the API and only serves to work around a compiler issue in GCC which +/// prevents us from using `friend`s instead. This function should only be used for internal +/// purposes. The problematic construct is: +/// +/// template +/// friend class SomeCRTP; +/// +/// \private +Object make_object(hid_t hid); +} // namespace detail + class Object { public: + // move constructor, reuse hid + Object(Object&& other) noexcept; + // decrease reference counter ~Object(); @@ -75,9 +96,6 @@ class Object { // copy constructor, increase reference counter Object(const Object& other); - // move constructor, reuse hid - Object(Object&& other) noexcept; - // Init with an low-level object id explicit Object(hid_t); @@ -87,14 +105,18 @@ class Object { hid_t _hid; private: + friend Object detail::make_object(hid_t); + friend class Reference; + friend class CompoundType; + +#if HIGHFIVE_HAS_FRIEND_DECLARATIONS template friend class NodeTraits; template friend class AnnotateTraits; - friend class Reference; - friend class CompoundType; template friend class PathTraits; +#endif }; @@ -104,6 +126,7 @@ class Object { class ObjectInfo { public: /// \brief Retrieve the address of the object (within its file) + /// \deprecated Deprecated since HighFive 2.2. Soon supporting VOL tokens H5_DEPRECATED("Deprecated since HighFive 2.2. Soon supporting VOL tokens") haddr_t getAddress() const noexcept; @@ -130,5 +153,3 @@ class ObjectInfo { } // namespace HighFive #include "bits/H5Object_misc.hpp" - -#endif // H5OBJECT_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5PropertyList.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5PropertyList.hpp index a09959647d..53b3c4a137 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5PropertyList.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5PropertyList.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5PROPERTY_LIST_HPP -#define H5PROPERTY_LIST_HPP +#pragma once #include @@ -23,6 +22,67 @@ namespace HighFive { +/// \defgroup PropertyLists Property Lists +/// HDF5 is configured through what they call property lists. In HDF5 the +/// process has four steps: +/// +/// 1. Create a property list. As users we now have an `hid_t` identifying the +/// property list. +/// 2. Set properties as desired. +/// 3. Pass the HID to the HDF5 function to be configured. +/// 4. Free the property list. +/// +/// Note that the mental picture is that one creates a settings object, and +/// then passes those settings to a function such as `H5Dwrite`. In and of +/// themselves the settings don't change the behaviour of HDF5. Rather they +/// need to be used to take affect. +/// +/// The second aspect is that property lists represent any number of related +/// settings, e.g. there's property lists anything related to creating files +/// and another for accessing files, same for creating and accessing datasets, +/// etc. Settings that affect creating files, must be passed a file creation +/// property list, while settings that affect file access require a file access +/// property list. +/// +/// In HighFive the `PropertyList` works similar in that it's a object +/// representing the settings, i.e. internally it's just the property lists +/// HID. Just like in HDF5 one adds the settings to the settings object; and +/// then passes the settings object to the respective method. Example: +/// +/// +/// // Create an object which contains the setting to +/// // open files with MPI-IO. +/// auto fapl = FileAccessProps(); +/// fapl.add(MPIOFileAccess(MPI_COMM_WORLD, MPI_INFO_NULL); +/// +/// // To open a specific file with MPI-IO, we do: +/// auto file = File("foo.h5", File::ReadOnly, fapl); +/// +/// Note that the `MPIOFileAccess` object by itself doesn't affect the +/// `FileAccessProps`. Rather it needs to be explicitly added to the `fapl` +/// (the group of file access related settings), and then the `fapl` needs to +/// be passed to the constructor of `File` for the settings to take affect. +/// +/// This is important to understand when reading properties. Example: +/// +/// // Obtain the file access property list: +/// auto fapl = file.getAccessPropertyList() +/// +/// // Extracts a copy of the collective MPI-IO metadata settings from +/// // the group of file access related setting, i.e. the `fapl`: +/// auto mpio_metadata = MPIOCollectiveMetadata(fapl); +/// +/// if(mpio_metadata.isCollectiveRead()) { +/// // something specific if meta data is read collectively. +/// } +/// +/// // Careful, this only affects the `mpio_metadata` object, but not the +/// // `fapl`, and also not whether `file` uses collective MPI-IO for +/// // metadata. +/// mpio_metadata = MPIOCollectiveMetadata(false, false); +/// +/// @{ + /// /// \brief Types of property lists /// @@ -49,7 +109,7 @@ template T get_plist(const U& obj, hid_t (*f)(hid_t)) { auto hid = f(obj.getId()); if (hid < 0) { - HDF5ErrMapper::ToException(std::string("Unable to get property list")); + HDF5ErrMapper::ToException("Unable to get property list"); } T t{}; t._hid = hid; @@ -73,6 +133,26 @@ class PropertyListBase: public Object { friend T details::get_plist(const U&, hid_t (*f)(hid_t)); }; +/// \interface PropertyInterface +/// \brief HDF5 file property object +/// +/// A property is an object which is expected to have a method with the +/// following signature `void apply(hid_t hid) const` +/// +/// \sa Instructions to document C++20 concepts with Doxygen: https://github.com/doxygen/doxygen/issues/2732#issuecomment-509629967 +/// +/// \cond +#if HIGHFIVE_HAS_CONCEPTS && __cplusplus >= 202002L +template +concept PropertyInterface = requires(P p, const hid_t hid) { + {p.apply(hid)}; +}; + +#else +#define PropertyInterface typename +#endif +/// \endcond + /// /// \brief HDF5 property Lists /// @@ -89,8 +169,8 @@ class PropertyList: public PropertyListBase { /// Add a property to this property list. /// A property is an object which is expected to have a method with the /// following signature void apply(hid_t hid) const - /// - template + /// \tparam PropertyInterface + template void add(const P& property); /// @@ -139,35 +219,36 @@ class RawPropertyList: public PropertyList { /// class MPIOFileAccess { public: - MPIOFileAccess(MPI_Comm comm, MPI_Info info) - : _comm(comm) - , _info(info) {} - - void apply(const hid_t list) const { - if (H5Pset_fapl_mpio(list, _comm, _info) < 0) { - HDF5ErrMapper::ToException("Unable to set-up MPIO Driver configuration"); - } - } + MPIOFileAccess(MPI_Comm comm, MPI_Info info); private: + friend FileAccessProps; + void apply(const hid_t list) const; + MPI_Comm _comm; MPI_Info _info; }; /// -/// \brief Use collective MPI-IO for metadata read and write? +/// \brief Use collective MPI-IO for metadata read and write. /// /// See `MPIOCollectiveMetadataRead` and `MPIOCollectiveMetadataWrite`. /// class MPIOCollectiveMetadata { public: - explicit MPIOCollectiveMetadata(bool collective = true) - : collective_(collective) {} + explicit MPIOCollectiveMetadata(bool collective = true); + explicit MPIOCollectiveMetadata(const FileAccessProps& plist); + + bool isCollectiveRead() const; + bool isCollectiveWrite() const; + private: friend FileAccessProps; void apply(hid_t plist) const; - bool collective_; + + bool collective_read_; + bool collective_write_; }; /// @@ -185,8 +266,10 @@ class MPIOCollectiveMetadata { /// class MPIOCollectiveMetadataRead { public: - explicit MPIOCollectiveMetadataRead(bool collective = true) - : collective_(collective) {} + explicit MPIOCollectiveMetadataRead(bool collective = true); + explicit MPIOCollectiveMetadataRead(const FileAccessProps& plist); + + bool isCollective() const; private: friend FileAccessProps; @@ -209,8 +292,10 @@ class MPIOCollectiveMetadataRead { /// class MPIOCollectiveMetadataWrite { public: - explicit MPIOCollectiveMetadataWrite(bool collective = true) - : collective_(collective) {} + explicit MPIOCollectiveMetadataWrite(bool collective = true); + explicit MPIOCollectiveMetadataWrite(const FileAccessProps& plist); + + bool isCollective() const; private: friend FileAccessProps; @@ -241,19 +326,17 @@ class MPIOCollectiveMetadataWrite { /// class FileVersionBounds { public: - FileVersionBounds(H5F_libver_t low, H5F_libver_t high) - : _low(low) - , _high(high) {} + FileVersionBounds(H5F_libver_t low, H5F_libver_t high); + explicit FileVersionBounds(const FileAccessProps& fapl); + + std::pair getVersion() const; private: friend FileAccessProps; - void apply(const hid_t list) const { - if (H5Pset_libver_bounds(list, _low, _high) < 0) { - HDF5ErrMapper::ToException("Error setting file version bounds"); - } - } - const H5F_libver_t _low; - const H5F_libver_t _high; + void apply(const hid_t list) const; + + H5F_libver_t _low; + H5F_libver_t _high; }; /// @@ -263,17 +346,15 @@ class FileVersionBounds { /// class MetadataBlockSize { public: - MetadataBlockSize(hsize_t size) - : _size(size) {} + explicit MetadataBlockSize(hsize_t size); + explicit MetadataBlockSize(const FileAccessProps& fapl); + + hsize_t getSize() const; private: friend FileAccessProps; - void apply(const hid_t list) const { - if (H5Pset_meta_block_size(list, _size) < 0) { - HDF5ErrMapper::ToException("Error setting metadata block size"); - } - } - const hsize_t _size; + void apply(const hid_t list) const; + hsize_t _size; }; #if H5_VERSION_GE(1, 10, 1) @@ -292,6 +373,11 @@ class FileSpaceStrategy { /// \param persist Should free space managers be persisted across file closing and reopening. /// \param threshold The free-space manager wont track sections small than this threshold. FileSpaceStrategy(H5F_fspace_strategy_t strategy, hbool_t persist, hsize_t threshold); + explicit FileSpaceStrategy(const FileCreateProps& fcpl); + + H5F_fspace_strategy_t getStrategy() const; + hbool_t getPersist() const; + hsize_t getThreshold() const; private: friend FileCreateProps; @@ -319,10 +405,12 @@ class FileSpacePageSize { /// /// \param page_size The page size in bytes. explicit FileSpacePageSize(hsize_t page_size); + explicit FileSpacePageSize(const FileCreateProps& fcpl); + + hsize_t getPageSize() const; private: friend FileCreateProps; - void apply(const hid_t list) const; hsize_t _page_size; @@ -351,12 +439,18 @@ class PageBufferSize { unsigned min_meta_percent = 0, unsigned min_raw_percent = 0); + explicit PageBufferSize(const FileAccessProps& fapl); + + size_t getPageBufferSize() const; + unsigned getMinMetaPercent() const; + unsigned getMinRawPercent() const; + private: friend FileAccessProps; void apply(hid_t list) const; - hsize_t _page_buffer_size; + size_t _page_buffer_size; unsigned _min_meta; unsigned _min_raw; }; @@ -364,47 +458,55 @@ class PageBufferSize { #endif /// \brief Set hints as to how many links to expect and their average length +/// \implements PropertyInterface /// class EstimatedLinkInfo { public: - explicit EstimatedLinkInfo(unsigned entries, unsigned length) - : _entries(entries) - , _length(length) {} + /// \brief Create a property with the request parameters. + /// + /// @param entries The estimated number of links in a group. + /// @param length The estimated length of the names of links. + explicit EstimatedLinkInfo(unsigned entries, unsigned length); + + explicit EstimatedLinkInfo(const GroupCreateProps& gcpl); + + /// \brief The estimated number of links in a group. + unsigned getEntries() const; + + /// \brief The estimated length of the names of links. + unsigned getNameLength() const; private: friend GroupCreateProps; void apply(hid_t hid) const; - const unsigned _entries; - const unsigned _length; + unsigned _entries; + unsigned _length; }; +/// \implements PropertyInterface class Chunking { public: - explicit Chunking(const std::vector& dims) - : _dims(dims) {} - - Chunking(const std::initializer_list& items) - : Chunking(std::vector{items}) {} + explicit Chunking(const std::vector& dims); + Chunking(const std::initializer_list& items); template - explicit Chunking(hsize_t item, Args... args) - : Chunking(std::vector{item, static_cast(args)...}) {} + explicit Chunking(hsize_t item, Args... args); - const std::vector& getDimensions() const noexcept { - return _dims; - } + explicit Chunking(DataSetCreateProps& plist, size_t max_dims = 32); + + const std::vector& getDimensions() const noexcept; private: friend DataSetCreateProps; void apply(hid_t hid) const; - const std::vector _dims; + std::vector _dims; }; +/// \implements PropertyInterface class Deflate { public: - explicit Deflate(unsigned level) - : _level(level) {} + explicit Deflate(unsigned level); private: friend DataSetCreateProps; @@ -413,12 +515,14 @@ class Deflate { const unsigned _level; }; +/// \implements PropertyInterface class Szip { public: explicit Szip(unsigned options_mask = H5_SZIP_EC_OPTION_MASK, - unsigned pixels_per_block = H5_SZIP_MAX_PIXELS_PER_BLOCK) - : _options_mask(options_mask) - , _pixels_per_block(pixels_per_block) {} + unsigned pixels_per_block = H5_SZIP_MAX_PIXELS_PER_BLOCK); + + unsigned getOptionsMask() const; + unsigned getPixelsPerBlock() const; private: friend DataSetCreateProps; @@ -427,6 +531,7 @@ class Szip { const unsigned _pixels_per_block; }; +/// \implements PropertyInterface class Shuffle { public: Shuffle() = default; @@ -441,10 +546,13 @@ class Shuffle { /// The precise time of when HDF5 requests space to store the dataset /// can be configured. Please, consider the upstream documentation for /// `H5Pset_alloc_time`. +/// \implements PropertyInterface class AllocationTime { public: - explicit AllocationTime(H5D_alloc_time_t alloc_time) - : _alloc_time(alloc_time) {} + explicit AllocationTime(H5D_alloc_time_t alloc_time); + explicit AllocationTime(const DataSetCreateProps& dcpl); + + H5D_alloc_time_t getAllocationTime(); private: friend DataSetCreateProps; @@ -455,52 +563,172 @@ class AllocationTime { /// Dataset access property to control chunk cache configuration. /// Do not confuse with the similar file access property for H5Pset_cache +/// \implements PropertyInterface class Caching { public: /// https://support.hdfgroup.org/HDF5/doc/RM/H5P/H5Pset_chunk_cache.html for /// details. Caching(const size_t numSlots, const size_t cacheSize, - const double w0 = static_cast(H5D_CHUNK_CACHE_W0_DEFAULT)) - : _numSlots(numSlots) - , _cacheSize(cacheSize) - , _w0(w0) {} + const double w0 = static_cast(H5D_CHUNK_CACHE_W0_DEFAULT)); + + explicit Caching(const DataSetCreateProps& dcpl); + + size_t getNumSlots() const; + size_t getCacheSize() const; + double getW0() const; private: friend DataSetAccessProps; void apply(hid_t hid) const; - const size_t _numSlots; - const size_t _cacheSize; - const double _w0; + size_t _numSlots; + size_t _cacheSize; + double _w0; }; +/// \implements PropertyInterface class CreateIntermediateGroup { public: - explicit CreateIntermediateGroup(bool create = true) - : _create(create) {} + explicit CreateIntermediateGroup(bool create = true); + + explicit CreateIntermediateGroup(const ObjectCreateProps& ocpl); + explicit CreateIntermediateGroup(const LinkCreateProps& lcpl); + + bool isSet() const; + + protected: + void fromPropertyList(hid_t hid); private: friend ObjectCreateProps; friend LinkCreateProps; void apply(hid_t hid) const; - const bool _create; + bool _create; }; #ifdef H5_HAVE_PARALLEL +/// \implements PropertyInterface class UseCollectiveIO { public: - explicit UseCollectiveIO(bool enable = true) - : _enable(enable) {} + explicit UseCollectiveIO(bool enable = true); + + explicit UseCollectiveIO(const DataTransferProps& dxpl); + + /// \brief Does the property request collective IO? + bool isCollective() const; private: friend DataTransferProps; void apply(hid_t hid) const; bool _enable; }; + + +/// \brief The cause for non-collective I/O. +/// +/// The cause refers to the most recent I/O with data transfer property list `dxpl` at time of +/// creation of this object. This object will not update automatically for later data transfers, +/// i.e. `H5Pget_mpio_no_collective_cause` is called in the constructor, and not when fetching +/// a value, such as `wasCollective`. +/// \implements PropertyInterface +class MpioNoCollectiveCause { + public: + explicit MpioNoCollectiveCause(const DataTransferProps& dxpl); + + /// \brief Was the datatransfer collective? + bool wasCollective() const; + + /// \brief The local cause for a non-collective I/O. + uint32_t getLocalCause() const; + + /// \brief The global cause for a non-collective I/O. + uint32_t getGlobalCause() const; + + /// \brief A pair of the local and global cause for non-collective I/O. + std::pair getCause() const; + + private: + friend DataTransferProps; + uint32_t _local_cause; + uint32_t _global_cause; +}; #endif +struct CreationOrder { + enum _CreationOrder { + Tracked = H5P_CRT_ORDER_TRACKED, + Indexed = H5P_CRT_ORDER_INDEXED, + }; +}; + +/// +/// \brief Track and index creation order time +/// +/// Let user retrieve objects by creation order time instead of name. +/// +/// \implements PropertyInterface +class LinkCreationOrder { + public: + /// + /// \brief Create the property + /// \param flags Should be a composition of HighFive::CreationOrder. + /// + explicit LinkCreationOrder(unsigned flags) + : _flags(flags) {} + + explicit LinkCreationOrder(const FileCreateProps& fcpl); + explicit LinkCreationOrder(const GroupCreateProps& gcpl); + + unsigned getFlags() const; + + protected: + void fromPropertyList(hid_t hid); + + private: + friend FileCreateProps; + friend GroupCreateProps; + void apply(hid_t hid) const; + unsigned _flags; +}; + + +/// +/// \brief Set threshold for attribute storage. +/// +/// HDF5 can store Attributes in the object header (compact) or in the B-tree +/// (dense). This property sets the threshold when attributes are moved to one +/// or the other storage format. +/// +/// Please refer to the upstream documentation of `H5Pset_attr_phase_change` or +/// Section 8 (Attributes) in the User Guide, in particular Subsection 8.5. +/// +/// \implements PropertyInterface +class AttributePhaseChange { + public: + /// + /// \brief Create the property from the threshold values. + /// + /// When the number of attributes hits `max_compact` the attributes are + /// moved to dense storage, once the number drops to below `min_dense` the + /// attributes are moved to compact storage. + AttributePhaseChange(unsigned max_compact, unsigned min_dense); + + /// \brief Extract threshold values from property list. + explicit AttributePhaseChange(const GroupCreateProps& gcpl); + + unsigned max_compact() const; + unsigned min_dense() const; + + private: + friend GroupCreateProps; + void apply(hid_t hid) const; + + unsigned _max_compact; + unsigned _min_dense; +}; + +/// @} + } // namespace HighFive #include "bits/H5PropertyList_misc.hpp" - -#endif // H5PROPERTY_LIST_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Reference.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Reference.hpp index db69895d99..38062e987b 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Reference.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Reference.hpp @@ -7,8 +7,7 @@ * */ -#ifndef H5REFERENCE_HPP -#define H5REFERENCE_HPP +#pragma once #include #include @@ -16,7 +15,6 @@ #include #include -#include "H5Object.hpp" #include "bits/H5_definitions.hpp" namespace HighFive { @@ -81,5 +79,3 @@ class Reference { } // namespace HighFive #include "bits/H5Reference_misc.hpp" - -#endif // H5REFERENCE_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Selection.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Selection.hpp index 404f0772b1..c00c66d52f 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Selection.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Selection.hpp @@ -6,15 +6,19 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5SELECTION_HPP -#define H5SELECTION_HPP +#pragma once #include "H5DataSet.hpp" #include "H5DataSpace.hpp" #include "bits/H5Slice_traits.hpp" +#include "bits/H5Friends.hpp" namespace HighFive { +namespace detail { +Selection make_selection(const DataSpace&, const DataSpace&, const DataSet&); +} + /// /// \brief Selection: represent a view on a slice/part of a dataset /// @@ -47,17 +51,18 @@ class Selection: public SliceTraits { /// \return return the datatype of the selection const DataType getDataType() const; - private: + protected: Selection(const DataSpace& memspace, const DataSpace& file_space, const DataSet& set); + private: DataSpace _mem_space, _file_space; DataSet _set; +#if HIGHFIVE_HAS_FRIEND_DECLARATIONS template friend class ::HighFive::SliceTraits; - // absolute namespace naming due to GCC bug 52625 +#endif + friend Selection detail::make_selection(const DataSpace&, const DataSpace&, const DataSet&); }; } // namespace HighFive - -#endif // H5SELECTION_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Utility.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Utility.hpp index 70ce7cde49..64ac1e5c89 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Utility.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Utility.hpp @@ -7,10 +7,14 @@ * */ -#ifndef H5UTILITY_HPP -#define H5UTILITY_HPP +#pragma once #include +#include +#include +#include + +#include "bits/H5Friends.hpp" namespace HighFive { @@ -35,6 +39,177 @@ class SilenceHDF5 { void* _client_data; }; -} // namespace HighFive +#define HIGHFIVE_LOG_LEVEL_DEBUG 10 +#define HIGHFIVE_LOG_LEVEL_INFO 20 +#define HIGHFIVE_LOG_LEVEL_WARN 30 +#define HIGHFIVE_LOG_LEVEL_ERROR 40 + +#ifndef HIGHFIVE_LOG_LEVEL +#define HIGHFIVE_LOG_LEVEL HIGHFIVE_LOG_LEVEL_WARN +#endif + +enum class LogSeverity { + Debug = HIGHFIVE_LOG_LEVEL_DEBUG, + Info = HIGHFIVE_LOG_LEVEL_INFO, + Warn = HIGHFIVE_LOG_LEVEL_WARN, + Error = HIGHFIVE_LOG_LEVEL_ERROR +}; + +inline std::string to_string(LogSeverity severity) { + switch (severity) { + case LogSeverity::Debug: + return "DEBUG"; + case LogSeverity::Info: + return "INFO"; + case LogSeverity::Warn: + return "WARN"; + case LogSeverity::Error: + return "ERROR"; + default: + return "??"; + } +} + +/** \brief A logger with supporting basic functionality. + * + * This logger delegates the logging task to a callback. This level of + * indirection enables using the default Python logger from C++; or + * integrating HighFive into some custom logging solution. + * + * Using this class directly to log is not intended. Rather you should use + * - `HIGHFIVE_LOG_DEBUG{,_IF}` + * - `HIGHFIVE_LOG_INFO{,_IF}` + * - `HIGHFIVE_LOG_WARNING{,_IF}` + * - `HIGHFIVE_LOG_ERROR{,_IF}` + * + * This is intended to used as a singleton, via `get_global_logger()`. + */ +class Logger { + public: + using callback_type = + std::function; + + public: + Logger() = delete; + Logger(const Logger&) = delete; + Logger(Logger&&) = delete; + + explicit Logger(callback_type cb) + : _cb(std::move(cb)) {} + + Logger& operator=(const Logger&) = delete; + Logger& operator=(Logger&&) = delete; + + inline void log(LogSeverity severity, + const std::string& message, + const std::string& file, + int line) { + _cb(severity, message, file, line); + } + + inline void set_logging_callback(callback_type cb) { + _cb = std::move(cb); + } + + private: + callback_type _cb; +}; + +inline void default_logging_callback(LogSeverity severity, + const std::string& message, + const std::string& file, + int line) { + std::clog << file << ": " << line << " :: " << to_string(severity) << message << std::endl; +} -#endif // H5UTIL_HPP +/// \brief Obtain a reference to the logger used by HighFive. +/// +/// This uses a Meyers singleton, to ensure that the global logger is +/// initialized with a safe default logger, before it is used. +/// +/// Note: You probably don't need to call this function explicitly. +/// +inline Logger& get_global_logger() { + static Logger logger(&default_logging_callback); + return logger; +} + +/// \brief Sets the callback that's used by the logger. +inline void register_logging_callback(Logger::callback_type cb) { + auto& logger = get_global_logger(); + logger.set_logging_callback(std::move(cb)); +} + +namespace detail { +/// \brief Log a `message` with severity `severity`. +inline void log(LogSeverity severity, + const std::string& message, + const std::string& file, + int line) { + auto& logger = get_global_logger(); + logger.log(severity, message, file, line); +} +} // namespace detail + +#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_DEBUG +#define HIGHFIVE_LOG_DEBUG(message) \ + ::HighFive::detail::log(::HighFive::LogSeverity::Debug, (message), __FILE__, __LINE__); + +// Useful, for the common pattern: if ...; then log something. +#define HIGHFIVE_LOG_DEBUG_IF(cond, message) \ + if ((cond)) { \ + HIGHFIVE_LOG_DEBUG((message)); \ + } + +#else +#define HIGHFIVE_LOG_DEBUG(message) ; +#define HIGHFIVE_LOG_DEBUG_IF(cond, message) ; +#endif + +#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_INFO +#define HIGHFIVE_LOG_INFO(message) \ + ::HighFive::detail::log(::HighFive::LogSeverity::Info, (message), __FILE__, __LINE__); + +// Useful, for the common pattern: if ...; then log something. +#define HIGHFIVE_LOG_INFO_IF(cond, message) \ + if ((cond)) { \ + HIGHFIVE_LOG_INFO((message)); \ + } + +#else +#define HIGHFIVE_LOG_INFO(message) ; +#define HIGHFIVE_LOG_INFO_IF(cond, message) ; +#endif + + +#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_WARN +#define HIGHFIVE_LOG_WARN(message) \ + ::HighFive::detail::log(::HighFive::LogSeverity::Warn, (message), __FILE__, __LINE__); + +// Useful, for the common pattern: if ...; then log something. +#define HIGHFIVE_LOG_WARN_IF(cond, message) \ + if ((cond)) { \ + HIGHFIVE_LOG_WARN((message)); \ + } + +#else +#define HIGHFIVE_LOG_WARN(message) ; +#define HIGHFIVE_LOG_WARN_IF(cond, message) ; +#endif + +#if HIGHFIVE_LOG_LEVEL <= HIGHFIVE_LOG_LEVEL_ERROR +#define HIGHFIVE_LOG_ERROR(message) \ + ::HighFive::detail::log(::HighFive::LogSeverity::Error, (message), __FILE__, __LINE__); + +// Useful, for the common pattern: if ...; then log something. +#define HIGHFIVE_LOG_ERROR_IF(cond, message) \ + if ((cond)) { \ + HIGHFIVE_LOG_ERROR((message)); \ + } + +#else +#define HIGHFIVE_LOG_ERROR(message) ; +#define HIGHFIVE_LOG_ERROR_IF(cond, message) ; +#endif + +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Version.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Version.hpp new file mode 100644 index 0000000000..dc238432cb --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Version.hpp @@ -0,0 +1,33 @@ +/* + * Copyright (c), 2020 + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ +#pragma once + +#define HIGHFIVE_VERSION_MAJOR 2 +#define HIGHFIVE_VERSION_MINOR 8 +#define HIGHFIVE_VERSION_PATCH 0 + +/** \brief Concatenated representation of the HighFive version. + * + * \warning The macro `HIGHFIVE_VERSION` by itself isn't valid C/C++. + * + * However, it can be stringified with two layers of macros, e.g., + * \code{.cpp} + * #define STRINGIFY_VALUE(s) STRINGIFY_NAME(s) + * #define STRINGIFY_NAME(s) #s + * + * std::cout << STRINGIFY_VALUE(HIGHFIVE_VERSION) << "\n"; + * \endcode + */ +#define HIGHFIVE_VERSION 2.8.0 + +/** \brief String representation of the HighFive version. + * + * \warning This macro only exists from 2.7.1 onwards. + */ +#define HIGHFIVE_VERSION_STRING "2.8.0" diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Version.hpp.in b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Version.hpp.in index 5969ebc905..acddcffd39 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Version.hpp.in +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/H5Version.hpp.in @@ -6,12 +6,28 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5VERSION_HPP -#define H5VERSION_HPP +#pragma once #define HIGHFIVE_VERSION_MAJOR @PROJECT_VERSION_MAJOR@ #define HIGHFIVE_VERSION_MINOR @PROJECT_VERSION_MINOR@ #define HIGHFIVE_VERSION_PATCH @PROJECT_VERSION_PATCH@ + +/** \brief Concatenated representation of the HighFive version. + * + * \warning The macro `HIGHFIVE_VERSION` by itself isn't valid C/C++. + * + * However, it can be stringified with two layers of macros, e.g., + * \code{.cpp} + * #define STRINGIFY_VALUE(s) STRINGIFY_NAME(s) + * #define STRINGIFY_NAME(s) #s + * + * std::cout << STRINGIFY_VALUE(HIGHFIVE_VERSION) << "\n"; + * \endcode + */ #define HIGHFIVE_VERSION @PROJECT_VERSION@ -#endif // H5VERSION_HPP +/** \brief String representation of the HighFive version. + * + * \warning This macro only exists from 2.7.1 onwards. + */ +#define HIGHFIVE_VERSION_STRING "@PROJECT_VERSION@" diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Annotate_traits.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Annotate_traits.hpp index 7b613ab657..375b535a46 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Annotate_traits.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Annotate_traits.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5ANNOTATE_TRAITS_HPP -#define H5ANNOTATE_TRAITS_HPP +#pragma once #include @@ -80,6 +79,3 @@ class AnnotateTraits { using derivate_type = Derivate; }; } // namespace HighFive - - -#endif // H5ANNOTATE_TRAITS_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Annotate_traits_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Annotate_traits_misc.hpp index dea8fb6e16..85d2798fe2 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Annotate_traits_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Annotate_traits_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5ANNOTATE_TRAITS_MISC_HPP -#define H5ANNOTATE_TRAITS_MISC_HPP +#pragma once #include #include @@ -26,15 +25,15 @@ inline Attribute AnnotateTraits::createAttribute(const std::string& at const DataType& dtype) { auto attr_id = H5Acreate2(static_cast(this)->getId(), attribute_name.c_str(), - dtype._hid, - space._hid, + dtype.getId(), + space.getId(), H5P_DEFAULT, H5P_DEFAULT); if (attr_id < 0) { HDF5ErrMapper::ToException( std::string("Unable to create the attribute \"") + attribute_name + "\":"); } - return Attribute(attr_id); + return detail::make_attribute(attr_id); } template @@ -72,7 +71,7 @@ inline Attribute AnnotateTraits::getAttribute(const std::string& attri HDF5ErrMapper::ToException( std::string("Unable to open the attribute \"") + attribute_name + "\":"); } - return Attribute(attr_id); + return detail::make_attribute(attr_id); } template @@ -113,9 +112,7 @@ inline bool AnnotateTraits::hasAttribute(const std::string& attr_name) HDF5ErrMapper::ToException( std::string("Unable to check for attribute in group")); } - return res ? true : false; + return res; } } // namespace HighFive - -#endif // H5ANNOTATE_TRAITS_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Attribute_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Attribute_misc.hpp index 3e0f556630..6516788297 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Attribute_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Attribute_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5ATTRIBUTE_MISC_HPP -#define H5ATTRIBUTE_MISC_HPP +#pragma once #include #include @@ -18,6 +17,7 @@ #include #include +#include "../H5DataSpace.hpp" #include "H5Converter_misc.hpp" #include "H5ReadWrite_misc.hpp" #include "H5Utils.hpp" @@ -61,8 +61,9 @@ inline T Attribute::read() const { template inline void Attribute::read(T& array) const { const DataSpace& mem_space = getMemSpace(); + auto file_datatype = getDataType(); const details::BufferInfo buffer_info( - getDataType(), + file_datatype, [this]() -> std::string { return this->getName(); }, details::BufferInfo::read); @@ -73,37 +74,64 @@ inline void Attribute::read(T& array) const { throw DataSpaceException(ss.str()); } auto dims = mem_space.getDimensions(); - auto r = details::data_converter::get_reader(dims, array); - read(r.get_pointer(), buffer_info.data_type); + + if (mem_space.getElementCount() == 0) { + auto effective_dims = details::squeezeDimensions(dims, + details::inspector::recursive_ndim); + + details::inspector::prepare(array, effective_dims); + return; + } + + auto r = details::data_converter::get_reader(dims, array, file_datatype); + read(r.getPointer(), buffer_info.data_type); // re-arrange results - r.unserialize(); - auto t = create_datatype::base_type>(); + r.unserialize(array); + + auto t = buffer_info.data_type; auto c = t.getClass(); - if (c == DataTypeClass::VarLen) { - //(void) H5Dvlen_reclaim(t.getId(), mem_space.getId(), H5P_DEFAULT, r.get_pointer()); - throw std::logic_error("H5Dvlen_reclaim() is deprecated."); + + if (c == DataTypeClass::VarLen || t.isVariableStr()) { +#if H5_VERSION_GE(1, 12, 0) + // This one have been created in 1.12.0 + (void) H5Treclaim(t.getId(), mem_space.getId(), H5P_DEFAULT, r.getPointer()); +#else + // This one is deprecated since 1.12.0 + (void) H5Dvlen_reclaim(t.getId(), mem_space.getId(), H5P_DEFAULT, r.getPointer()); +#endif } } template -inline void Attribute::read(T* array, const DataType& dtype) const { +inline void Attribute::read(T* array, const DataType& mem_datatype) const { static_assert(!std::is_const::value, "read() requires a non-const structure to read data into"); - using element_type = typename details::inspector::base_type; - // Auto-detect mem datatype if not provided - const DataType& mem_datatype = dtype.empty() ? create_and_check_datatype() - : dtype; if (H5Aread(getId(), mem_datatype.getId(), static_cast(array)) < 0) { HDF5ErrMapper::ToException("Error during HDF5 Read: "); } } +template +inline void Attribute::read(T* array) const { + using element_type = typename details::inspector::base_type; + const DataType& mem_datatype = create_and_check_datatype(); + + read(array, mem_datatype); +} + template inline void Attribute::write(const T& buffer) { const DataSpace& mem_space = getMemSpace(); + + if (mem_space.getElementCount() == 0) { + return; + } + + auto file_datatype = getDataType(); + const details::BufferInfo buffer_info( - getDataType(), + file_datatype, [this]() -> std::string { return this->getName(); }, details::BufferInfo::write); @@ -113,20 +141,23 @@ inline void Attribute::write(const T& buffer) { << " into dataset of dimensions " << mem_space.getNumberDimensions(); throw DataSpaceException(ss.str()); } - auto w = details::data_converter::serialize(buffer); - write_raw(w.get_pointer(), buffer_info.data_type); + auto w = details::data_converter::serialize(buffer, file_datatype); + write_raw(w.getPointer(), buffer_info.data_type); } template -inline void Attribute::write_raw(const T* buffer, const DataType& dtype) { - using element_type = typename details::inspector::base_type; - const auto& mem_datatype = dtype.empty() ? create_and_check_datatype() : dtype; - +inline void Attribute::write_raw(const T* buffer, const DataType& mem_datatype) { if (H5Awrite(getId(), mem_datatype.getId(), buffer) < 0) { HDF5ErrMapper::ToException("Error during HDF5 Write: "); } } -} // namespace HighFive +template +inline void Attribute::write_raw(const T* buffer) { + using element_type = typename details::inspector::base_type; + const auto& mem_datatype = create_and_check_datatype(); -#endif // H5ATTRIBUTE_MISC_HPP + write_raw(buffer, mem_datatype); +} + +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Converter_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Converter_misc.hpp index f4b6e946b8..00749d1b6d 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Converter_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Converter_misc.hpp @@ -9,711 +9,411 @@ #pragma once #include -#include - -#include "../H5Reference.hpp" -#ifdef H5_USE_BOOST -#include -// starting Boost 1.64, serialization header must come before ublas -#include -#include -#endif -#ifdef H5_USE_EIGEN -#include -#endif + +#include "H5Inspector_misc.hpp" +#include "../H5DataType.hpp" namespace HighFive { -inline size_t compute_total_size(const std::vector& dims) { - return std::accumulate(dims.begin(), dims.end(), size_t{1u}, std::multiplies()); -} +namespace details { -template -using unqualified_t = typename std::remove_const::type>::type; - -/***** -inspector { - using type = T - // base_type is the base type inside c++ (e.g. std::vector => int) - using base_type - // hdf5_type is the base read by hdf5 (c-type) (e.g. std::vector => const char*) - using hdf5_type - - // Number of dimensions starting from here - static constexpr size_t recursive_ndim - // Is the inner type trivially copyable for optimisation - // If this value is true: data() is mandatory - // If this value is false: getSizeVal, getSize, serialize, unserialize are mandatory - static constexpr bool is_trivially_copyable - - // Reading: - // Allocate the value following dims (should be recursive) - static void prepare(type& val, const std::vector dims) - // Return the size of the vector pass to/from hdf5 from a vector of dims - static size_t getSize(const std::vector& dims) - // Return a pointer of the first value of val (for reading) - static hdf5_type* data(type& val) - // Take a serialized vector 'in', some dims and copy value to val (for reading) - static void unserialize(const hdf5_type* in, const std::vector&i, type& val) - - - // Writing: - // Return the size of the vector pass to/from hdf5 from a value - static size_t getSizeVal(const type& val) - // Return a point of the first value of val - static const hdf5_type* data(const type& val) - // Take a val and serialize it inside 'out' - static void serialize(const type& val, hdf5_type* out) - // Return an array of dimensions of the space needed for writing val - static std::vector getDimensions(const type& val) -} -*****/ +template +struct is_std_string { + static constexpr bool value = + std::is_same::base_type, std::string>::value; +}; +template +struct enable_shallow_copy + : public std::enable_if::value && inspector::is_trivially_copyable, V> {}; -namespace details { -template -struct type_helper { - using type = unqualified_t; - using base_type = unqualified_t; - using hdf5_type = base_type; +template +struct enable_deep_copy + : public std::enable_if::value && !inspector::is_trivially_copyable, V> {}; - static constexpr size_t ndim = 0; - static constexpr size_t recursive_ndim = ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; +template +struct enable_string_copy: public std::enable_if::value, V> {}; - static_assert(!std::is_same::value, "Booleans are not supported yet."); - static std::vector getDimensions(const type& /* val */) { - return {}; - } +template +struct ShallowCopyBuffer { + using type = unqualified_t; + using hdf5_type = + typename std::conditional::hdf5_type>::type, + typename inspector::hdf5_type>::type; - static size_t getSizeVal(const type& val) { - return compute_total_size(getDimensions(val)); - } + ShallowCopyBuffer() = delete; - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } + explicit ShallowCopyBuffer(typename std::conditional::type val) + : ptr(inspector::data(val)){}; - static void prepare(type& /* val */, const std::vector& /* dims */) {} - - static hdf5_type* data(type& val) { - static_assert(is_trivially_copyable, "The type is not trivially copyable"); - return &val; + hdf5_type* getPointer() const { + return ptr; } - static const hdf5_type* data(const type& val) { - static_assert(is_trivially_copyable, "The type is not trivially copyable"); - return &val; + hdf5_type* begin() const { + return getPointer(); } - static void serialize(const type& val, hdf5_type* m) { - static_assert(is_trivially_copyable, "The type is not trivially copyable"); - *m = val; + void unserialize(T& /* val */) const { + /* nothing to do. */ } - static void unserialize(const hdf5_type* vec, - const std::vector& /* dims */, - type& val) { - static_assert(is_trivially_copyable, "The type is not trivially copyable"); - val = vec[0]; - } + private: + hdf5_type* ptr; }; -template -struct inspector: type_helper {}; - -template <> -struct inspector: type_helper { - using hdf5_type = const char*; - - static hdf5_type* data(type& /* val */) { - throw DataSpaceException("A std::string cannot be read directly."); - } +template +struct DeepCopyBuffer { + using type = unqualified_t; + using hdf5_type = typename inspector::hdf5_type; - static const hdf5_type* data(const type& /* val */) { - throw DataSpaceException("A std::string cannot be write directly."); - } + explicit DeepCopyBuffer(const std::vector& _dims) + : buffer(inspector::getSize(_dims)) + , dims(_dims) {} - static void serialize(const type& val, hdf5_type* m) { - *m = val.c_str(); + hdf5_type* getPointer() { + return buffer.data(); } - static void unserialize(const hdf5_type* vec, - const std::vector& /* dims */, - type& val) { - val = vec[0]; + hdf5_type const* getPointer() const { + return buffer.data(); } -}; - -template <> -struct inspector: type_helper { - using hdf5_type = hobj_ref_t; - static constexpr bool is_trivially_copyable = false; - - static hdf5_type* data(type& /* val */) { - throw DataSpaceException("A Reference cannot be read directly."); + hdf5_type* begin() { + return getPointer(); } - static const hdf5_type* data(const type& /* val */) { - throw DataSpaceException("A Reference cannot be write directly."); + hdf5_type const* begin() const { + return getPointer(); } - static void serialize(const type& val, hdf5_type* m) { - hobj_ref_t ref; - val.create_ref(&ref); - *m = ref; + void unserialize(T& val) const { + inspector::unserialize(buffer.data(), dims, val); } - static void unserialize(const hdf5_type* vec, - const std::vector& /* dims */, - type& val) { - val = type{vec[0]}; - } + private: + std::vector buffer; + std::vector dims; }; -template -struct inspector> { - using type = FixedLenStringArray; - using value_type = char*; - using base_type = FixedLenStringArray; - using hdf5_type = char; +enum class BufferMode { Read, Write }; - static constexpr size_t ndim = 1; - static constexpr size_t recursive_ndim = ndim; - static constexpr bool is_trivially_copyable = false; - static std::vector getDimensions(const type& val) { - return std::vector{val.size()}; - } - - static size_t getSizeVal(const type& val) { - return N * compute_total_size(getDimensions(val)); - } - - static size_t getSize(const std::vector& dims) { - return N * compute_total_size(dims); - } - - static void prepare(type& /* val */, const std::vector& dims) { - if (dims[0] > N) { - std::ostringstream os; - os << "Size of FixedlenStringArray (" << N << ") is too small for dims (" << dims[0] - << ")."; - throw DataSpaceException(os.str()); +/// +/// \brief String length in bytes excluding the `\0`. +/// +inline size_t char_buffer_size(char const* const str, size_t max_string_length) { + for (size_t i = 0; i <= max_string_length; ++i) { + if (str[i] == '\0') { + return i; } } - static hdf5_type* data(type& val) { - return val.data(); - } + return max_string_length; +} - static const hdf5_type* data(const type& val) { - return val.data(); - } - static void serialize(const type& val, hdf5_type* m) { - for (size_t i = 0; i < val.size(); ++i) { - std::memcpy(m + i * N, val[i], N); - } - } +/// +/// \brief A buffer for reading/writing strings. +/// +/// A string in HDF5 can be represented as a fixed or variable length string. +/// The important difference for this buffer is that `H5D{read,write}` expects +/// different input depending on whether the strings are fixed or variable length. +/// For fixed length strings, it expects an array of chars, i.e. one string +/// packed after the other contiguously. While for variable length strings it +/// expects a list of pointers to the beginning of each string. Variable length +/// string must be null-terminated; because that's how their length is +/// determined. +/// +/// This buffer hides the difference between fixed and variable length strings +/// by having internal data structures available for both cases at compile time. +/// The choice which internal buffer to use is made at runtime. +/// +/// Consider an HDF5 dataset with N fixed-length strings, each of which is M +/// characters long. Then the in-memory strings are copied into an internal +/// buffer of size N*M. If null- or space-padded the buffer should be filled +/// with the appropriate character. This is important if the in-memory strings +/// are less than M characters long. +/// +/// An HDF5 dataset with N variable-length strings (all null-terminated) uses +/// the internal list of pointers to the beginning of each string. Those +/// pointers can either point to the in-memory strings themselves, if those +/// strings are known to be null-terminated. Otherwise the in-memory strings are +/// copied to an internal buffer of null-terminated strings; and the pointer +/// points to the start of the string in the internal buffer. +/// +/// This class is responsible for arranging the strings properly before passing +/// the buffers to HDF5. To keep this class generic, it provides a generic +/// read/write interface to the internal strings, i.e. a pointer with a size. +/// For reading from the buffer the proxy is called `StringConstView`. This +/// proxy object is to be used by the `inspector` to copy from the buffer into +/// the final destination, e.g. an `std::string`. Similarly, there's a proxy +/// object for serializing into the buffer, i.e. the `StringView`. Again the +/// `inspector` is responsible for obtaining the pointer, size and padding of +/// the string. +/// +/// Nomenclature: +/// - size of a string is the number of bytes required to store the string, +/// including the null character for null-terminated strings. +/// +/// - length of a string is the number of bytes without the null character. +/// +/// Note: both 'length' and 'size' are counted in number of bytes, not number +/// of symbols or characters. Even for UTF8 strings. +template +struct StringBuffer { + using type = unqualified_t; + using hdf5_type = typename inspector::hdf5_type; - static void unserialize(const hdf5_type* vec, const std::vector& dims, type& val) { - for (size_t i = 0; i < dims[0]; ++i) { - std::array s; - std::memcpy(s.data(), vec + (i * N), N); - val.push_back(s); + class StringView { + public: + StringView(StringBuffer& _buffer, size_t _i) + : buffer(_buffer) + , i(_i) {} + + /// + /// \brief Assign the in-memory string to the buffer. + /// + /// This method copies the in-memory string to the appropriate + /// internal buffer as needed. + /// + /// The `length` is the length of the string in bytes. + void assign(char const* data, size_t length, StringPadding padding) { + if (buffer.isVariableLengthString()) { + if (padding == StringPadding::NullTerminated) { + buffer.variable_length_pointers[i] = data; + } else { + buffer.variable_length_buffer[i] = std::string(data, length); + buffer.variable_length_pointers[i] = buffer.variable_length_buffer[i].data(); + } + } else if (buffer.isFixedLengthString()) { + // If the buffer is fixed-length and null-terminated, then + // `buffer.string_length` doesn't include the null-character. + if (length > buffer.string_length) { + throw std::invalid_argument("String length too big."); + } + + memcpy(&buffer.fixed_length_buffer[i * buffer.string_size], data, length); + } } - } -}; -template -struct inspector> { - using type = std::vector; - using value_type = unqualified_t; - using base_type = typename inspector::base_type; - using hdf5_type = typename inspector::hdf5_type; - - static constexpr size_t ndim = 1; - static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; - - static std::vector getDimensions(const type& val) { - std::vector sizes{val.size()}; - if (!val.empty()) { - auto s = inspector::getDimensions(val[0]); - sizes.insert(sizes.end(), s.begin(), s.end()); + private: + StringBuffer& buffer; + size_t i; + }; + + + class StringConstView { + public: + StringConstView(const StringBuffer& _buffer, size_t _i) + : buffer(_buffer) + , i(_i) {} + + /// \brief Pointer to the first byte of the string. + /// + /// The valid indices for this pointer are: 0, ..., length() - 1. + char const* data() const { + if (buffer.isVariableLengthString()) { + return buffer.variable_length_pointers[i]; + } else { + return &buffer.fixed_length_buffer[i * buffer.string_size]; + } } - return sizes; - } - static size_t getSizeVal(const type& val) { - return compute_total_size(getDimensions(val)); - } - - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - - static void prepare(type& val, const std::vector& dims) { - val.resize(dims[0]); - std::vector next_dims(dims.begin() + 1, dims.end()); - for (auto& e: val) { - inspector::prepare(e, next_dims); + /// \brief Length of the string in bytes. + /// + /// Note that for null-terminated strings the "length" doesn't include + /// the null character. Hence, if storing this string as a + /// null-terminated string, the destination buffer needs to be at least + /// `length() + 1` bytes long. + size_t length() const { + if (buffer.isNullTerminated()) { + return char_buffer_size(data(), buffer.string_length); + } else { + return buffer.string_length; + } } - } - static hdf5_type* data(type& val) { - return inspector::data(val[0]); - } + private: + const StringBuffer& buffer; + size_t i; + }; - static const hdf5_type* data(const type& val) { - return inspector::data(val[0]); - } - static void serialize(const type& val, hdf5_type* m) { - size_t subsize = inspector::getSizeVal(val[0]); - for (auto& e: val) { - inspector::serialize(e, m); - m += subsize; - } - } + class Iterator { + public: + Iterator(StringBuffer& _buffer, size_t _pos) + : buffer(_buffer) + , pos(_pos) {} - static void unserialize(const hdf5_type* vec_align, - const std::vector& dims, - type& val) { - std::vector next_dims(dims.begin() + 1, dims.end()); - size_t next_size = compute_total_size(next_dims); - for (size_t i = 0; i < dims[0]; ++i) { - inspector::unserialize(vec_align + i * next_size, next_dims, val[i]); + Iterator operator+(size_t n_strings) const { + return Iterator(buffer, pos + n_strings); } - } -}; - - -template -struct inspector> { - using type = std::array; - using value_type = T; - using base_type = typename inspector::base_type; - using hdf5_type = typename inspector::hdf5_type; - - static constexpr size_t ndim = 1; - static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; - static std::vector getDimensions(const type& val) { - std::vector sizes{N}; - if (!val.empty()) { - auto s = inspector::getDimensions(val[0]); - sizes.insert(sizes.end(), s.begin(), s.end()); + void operator+=(size_t n_strings) { + pos += n_strings; } - return sizes; - } - - static size_t getSizeVal(const type& val) { - return compute_total_size(getDimensions(val)); - } - - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - static void prepare(type& /* val */, const std::vector& dims) { - if (dims[0] > N) { - std::ostringstream os; - os << "Size of std::array (" << N << ") is too small for dims (" << dims[0] << ")."; - throw DataSpaceException(os.str()); + StringView operator*() { + return StringView(buffer, pos); } - } - - static hdf5_type* data(type& val) { - return inspector::data(val[0]); - } - - static const hdf5_type* data(const type& val) { - return inspector::data(val[0]); - } - static void serialize(const type& val, hdf5_type* m) { - size_t subsize = inspector::getSizeVal(val[0]); - for (auto& e: val) { - inspector::serialize(e, m); - m += subsize; + StringConstView operator*() const { + return StringConstView(buffer, pos); } - } - static void unserialize(const hdf5_type* vec_align, - const std::vector& dims, - type& val) { - if (dims[0] != N) { - std::ostringstream os; - os << "Impossible to pair DataSet with " << dims[0] << " elements into an array with " - << N << " elements."; - throw DataSpaceException(os.str()); - } - std::vector next_dims(dims.begin() + 1, dims.end()); - size_t next_size = compute_total_size(next_dims); - for (size_t i = 0; i < dims[0]; ++i) { - inspector::unserialize(vec_align + i * next_size, next_dims, val[i]); + private: + StringBuffer& buffer; + size_t pos; + }; + + StringBuffer(std::vector _dims, const DataType& _file_datatype) + : file_datatype(_file_datatype.asStringType()) + , padding(file_datatype.getPadding()) + , string_size(file_datatype.isVariableStr() ? size_t(-1) : file_datatype.getSize()) + , string_length(string_size - size_t(isNullTerminated())) + , dims(_dims) { + if (string_size == 0 && isNullTerminated()) { + throw DataTypeException( + "Fixed-length, null-terminated need at least one byte to store the " + "null-character."); } - } -}; - -// Cannot be use for reading -template -struct inspector { - using type = T*; - using value_type = unqualified_t; - using base_type = typename inspector::base_type; - using hdf5_type = typename inspector::hdf5_type; - - static constexpr size_t ndim = 1; - static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; - - static size_t getSizeVal(const type& /* val */) { - throw DataSpaceException("Not possible to have size of a T*"); - } - - static std::vector getDimensions(const type& /* val */) { - throw DataSpaceException("Not possible to have size of a T*"); - } - - static const hdf5_type* data(const type& val) { - return reinterpret_cast(val); - } - - /* it works because there is only T[][][] currently - we will fix it one day */ - static void serialize(const type& /* val */, hdf5_type* /* m */) { - throw DataSpaceException("Not possible to serialize a T*"); - } -}; - -// Cannot be use for reading -template -struct inspector { - using type = T[N]; - using value_type = unqualified_t; - using base_type = typename inspector::base_type; - using hdf5_type = typename inspector::hdf5_type; - - static constexpr size_t ndim = 1; - static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; - - static size_t getSizeVal(const type& val) { - return compute_total_size(getDimensions(val)); - } - static std::vector getDimensions(const type& val) { - std::vector sizes{N}; - if (N > 0) { - auto s = inspector::getDimensions(val[0]); - sizes.insert(sizes.end(), s.begin(), s.end()); + auto n_strings = compute_total_size(dims); + if (isVariableLengthString()) { + variable_length_buffer.resize(n_strings); + variable_length_pointers.resize(n_strings); + } else { + char pad = padding == StringPadding::SpacePadded ? ' ' : '\0'; + fixed_length_buffer.assign(n_strings * string_size, pad); } - return sizes; } - static const hdf5_type* data(const type& val) { - return inspector::data(val[0]); + bool isVariableLengthString() const { + return file_datatype.isVariableStr(); } - /* it works because there is only T[][][] currently - we will fix it one day */ - static void serialize(const type& val, hdf5_type* m) { - size_t subsize = inspector::getSizeVal(val[0]); - for (size_t i = 0; i < N; ++i) { - inspector::serialize(val[i], m + i * subsize); - } + bool isFixedLengthString() const { + return file_datatype.isFixedLenStr(); } -}; -#ifdef H5_USE_EIGEN -template -struct inspector> { - using type = Eigen::Matrix; - using value_type = T; - using base_type = typename inspector::base_type; - using hdf5_type = base_type; - - static constexpr size_t ndim = 2; - static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; - - static std::vector getDimensions(const type& val) { - std::vector sizes{static_cast(val.rows()), static_cast(val.cols())}; - auto s = inspector::getDimensions(val.data()[0]); - sizes.insert(sizes.end(), s.begin(), s.end()); - return sizes; + bool isNullTerminated() const { + return file_datatype.getPadding() == StringPadding::NullTerminated; } - static size_t getSizeVal(const type& val) { - return compute_total_size(getDimensions(val)); - } - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - - static void prepare(type& val, const std::vector& dims) { - if (dims[0] != static_cast(val.rows()) || - dims[1] != static_cast(val.cols())) { - val.resize(static_cast(dims[0]), - static_cast(dims[1])); + void* getPointer() { + if (file_datatype.isVariableStr()) { + return variable_length_pointers.data(); + } else { + return fixed_length_buffer.data(); } } - static hdf5_type* data(type& val) { - return inspector::data(*val.data()); + Iterator begin() { + return Iterator(*this, 0ul); } - static const hdf5_type* data(const type& val) { - return inspector::data(*val.data()); + void unserialize(T& val) { + inspector::unserialize(begin(), dims, val); } - static void serialize(const type& val, hdf5_type* m) { - std::memcpy(m, val.data(), static_cast(val.size()) * sizeof(hdf5_type)); - } + private: + StringType file_datatype; + StringPadding padding; + size_t string_size; // Size of buffer required to store the string. + // Meaningful for fixed length strings only. + size_t string_length; // Semantic length of string. + std::vector dims; - static void unserialize(const hdf5_type* vec_align, - const std::vector& dims, - type& val) { - if (dims.size() < 2) { - std::ostringstream os; - os << "Impossible to pair DataSet with " << dims.size() - << " dimensions into an eigen-matrix."; - throw DataSpaceException(os.str()); - } - std::memcpy(val.data(), vec_align, compute_total_size(dims) * sizeof(hdf5_type)); - } + std::vector fixed_length_buffer; + std::vector variable_length_buffer; + std::vector< + typename std::conditional::type*> + variable_length_pointers; }; -#endif - -#ifdef H5_USE_BOOST -template -struct inspector> { - using type = boost::multi_array; - using value_type = T; - using base_type = typename inspector::base_type; - using hdf5_type = typename inspector::hdf5_type; - - static constexpr size_t ndim = Dims; - static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; - - static std::vector getDimensions(const type& val) { - std::vector sizes; - for (size_t i = 0; i < ndim; ++i) { - sizes.push_back(val.shape()[i]); - } - auto s = inspector::getDimensions(val.data()[0]); - sizes.insert(sizes.end(), s.begin(), s.end()); - return sizes; - } - - static size_t getSizeVal(const type& val) { - return compute_total_size(getDimensions(val)); - } - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - static void prepare(type& val, const std::vector& dims) { - if (dims.size() < ndim) { - std::ostringstream os; - os << "Only '" << dims.size() << "' given but boost::multi_array is of size '" << ndim - << "'."; - throw DataSpaceException(os.str()); - } - boost::array ext; - std::copy(dims.begin(), dims.begin() + ndim, ext.begin()); - val.resize(ext); - std::vector next_dims(dims.begin() + Dims, dims.end()); - std::size_t size = std::accumulate(dims.begin(), - dims.begin() + Dims, - std::size_t{1}, - std::multiplies()); - for (size_t i = 0; i < size; ++i) { - inspector::prepare(*(val.origin() + i), next_dims); - } - } +template +struct Writer; - static hdf5_type* data(type& val) { - return inspector::data(*val.data()); - } - - static const hdf5_type* data(const type& val) { - return inspector::data(*val.data()); - } - - static void serialize(const type& val, hdf5_type* m) { - size_t size = val.num_elements(); - size_t subsize = inspector::getSizeVal(*val.origin()); - for (size_t i = 0; i < size; ++i) { - inspector::serialize(*(val.origin() + i), m + i * subsize); - } - } +template +struct Writer::type>: public ShallowCopyBuffer { + private: + using super = ShallowCopyBuffer; - static void unserialize(const hdf5_type* vec_align, - const std::vector& dims, - type& val) { - std::vector next_dims(dims.begin() + ndim, dims.end()); - size_t subsize = compute_total_size(next_dims); - for (size_t i = 0; i < val.num_elements(); ++i) { - inspector::unserialize(vec_align + i * subsize, - next_dims, - *(val.origin() + i)); - } - } + public: + explicit Writer(const T& val, const DataType& /* file_datatype */) + : super(val){}; }; template -struct inspector> { - using type = boost::numeric::ublas::matrix; - using value_type = unqualified_t; - using base_type = typename inspector::base_type; - using hdf5_type = typename inspector::hdf5_type; - - static constexpr size_t ndim = 2; - static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; - static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; - - static std::vector getDimensions(const type& val) { - std::vector sizes{val.size1(), val.size2()}; - auto s = inspector::getDimensions(val(0, 0)); - sizes.insert(sizes.end(), s.begin(), s.end()); - return sizes; - } - - static size_t getSizeVal(const type& val) { - return compute_total_size(getDimensions(val)); - } - - static size_t getSize(const std::vector& dims) { - return compute_total_size(dims); - } - - static void prepare(type& val, const std::vector& dims) { - if (dims.size() < ndim) { - std::ostringstream os; - os << "Impossible to pair DataSet with " << dims.size() << " dimensions into a " << ndim - << " boost::numeric::ublas::matrix"; - throw DataSpaceException(os.str()); - } - val.resize(dims[0], dims[1], false); - } - - static hdf5_type* data(type& val) { - return inspector::data(val(0, 0)); - } - - static const hdf5_type* data(const type& val) { - return inspector::data(val(0, 0)); - } - - static void serialize(const type& val, hdf5_type* m) { - size_t size = val.size1() * val.size2(); - size_t subsize = inspector::getSizeVal(val(0, 0)); - for (size_t i = 0; i < size; ++i) { - inspector::serialize(*(&val(0, 0) + i), m + i * subsize); - } - } - - static void unserialize(const hdf5_type* vec_align, - const std::vector& dims, - type& val) { - std::vector next_dims(dims.begin() + ndim, dims.end()); - size_t subsize = compute_total_size(next_dims); - size_t size = val.size1() * val.size2(); - for (size_t i = 0; i < size; ++i) { - inspector::unserialize(vec_align + i * subsize, - next_dims, - *(&val(0, 0) + i)); - } +struct Writer::type>: public DeepCopyBuffer { + explicit Writer(const T& val, const DataType& /* file_datatype */) + : DeepCopyBuffer(inspector::getDimensions(val)) { + inspector::serialize(val, this->begin()); } }; -#endif template -struct Writer { - using hdf5_type = typename inspector::hdf5_type; - const hdf5_type* get_pointer() { - if (vec.empty()) { - return ptr; - } else { - return vec.data(); - } +struct Writer::type>: public StringBuffer { + explicit Writer(const T& val, const DataType& _file_datatype) + : StringBuffer(inspector::getDimensions(val), _file_datatype) { + inspector::serialize(val, this->begin()); } - std::vector vec{}; - const hdf5_type* ptr{nullptr}; }; -template -struct Reader { - using type = unqualified_t; - using hdf5_type = typename inspector::hdf5_type; +template +struct Reader; - Reader(const std::vector& _dims, type& _val) - : dims(_dims) - , val(_val) {} +template +struct Reader::type>: public ShallowCopyBuffer { + private: + using super = ShallowCopyBuffer; + using type = typename super::type; + + public: + Reader(const std::vector&, type& val, const DataType& /* file_datatype */) + : super(val) {} +}; - hdf5_type* get_pointer() { - if (vec.empty()) { - return inspector::data(val); - } else { - return vec.data(); - } - } +template +struct Reader::type>: public DeepCopyBuffer { + private: + using super = DeepCopyBuffer; + using type = typename super::type; + + public: + Reader(const std::vector& _dims, type&, const DataType& /* file_datatype */) + : super(_dims) {} +}; - void unserialize() { - if (!vec.empty()) { - inspector::unserialize(vec.data(), dims, val); - } - } - std::vector dims{}; - std::vector vec{}; - type& val{}; +template +struct Reader::type>: public StringBuffer { + public: + explicit Reader(const std::vector& _dims, + const T& /* val */, + const DataType& _file_datatype) + : StringBuffer(_dims, _file_datatype) {} }; struct data_converter { template - static typename std::enable_if::is_trivially_copyable, Writer>::type serialize( - const typename inspector::type& val) { - Writer w; - w.ptr = inspector::data(val); - return w; - } - - template - static typename std::enable_if::is_trivially_copyable, Writer>::type serialize( - const typename inspector::type& val) { - Writer w; - w.vec.resize(inspector::getSizeVal(val)); - inspector::serialize(val, w.vec.data()); - return w; - } - - template - static - typename std::enable_if>::is_trivially_copyable, Reader>::type - get_reader(const std::vector& dims, T& val) { - Reader r(dims, val); - inspector::prepare(r.val, dims); - return r; + static Writer serialize(const typename inspector::type& val, + const DataType& file_datatype) { + return Writer(val, file_datatype); } template - static typename std::enable_if>::is_trivially_copyable, - Reader>::type - get_reader(const std::vector& dims, T& val) { - Reader r(dims, val); - inspector::prepare(r.val, dims); - r.vec.resize(inspector::getSize(dims)); - return r; + static Reader get_reader(const std::vector& dims, + T& val, + const DataType& file_datatype) { + // TODO Use bufferinfo for recursive_ndim + auto effective_dims = details::squeezeDimensions(dims, inspector::recursive_ndim); + inspector::prepare(val, effective_dims); + return Reader(effective_dims, val, file_datatype); } }; diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5DataSet_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5DataSet_misc.hpp index 9bf2441162..4411b4c0d4 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5DataSet_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5DataSet_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATASET_MISC_HPP -#define H5DATASET_MISC_HPP +#pragma once #include #include @@ -66,5 +65,3 @@ inline void DataSet::resize(const std::vector& dims) { } } // namespace HighFive - -#endif // H5DATASET_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5DataType_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5DataType_misc.hpp index bc72d3ee59..8535d617ab 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5DataType_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5DataType_misc.hpp @@ -6,12 +6,14 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATATYPE_MISC_HPP -#define H5DATATYPE_MISC_HPP +#pragma once #include #include #include +#if HIGHFIVE_CXX_STD >= 17 +#include +#endif #include #include @@ -20,10 +22,68 @@ #include #endif -#include "H5Converter_misc.hpp" +#include "H5Inspector_misc.hpp" namespace HighFive { +namespace detail { + +inline hid_t h5t_copy(hid_t original) { + auto copy = H5Tcopy(original); + if (copy == H5I_INVALID_HID) { + HDF5ErrMapper::ToException("Error copying datatype."); + } + + return copy; +} + +inline hsize_t h5t_get_size(hid_t hid) { + hsize_t size = H5Tget_size(hid); + if (size == 0) { + HDF5ErrMapper::ToException("Error getting size of datatype."); + } + + return size; +} + +inline H5T_cset_t h5t_get_cset(hid_t hid) { + auto cset = H5Tget_cset(hid); + if (cset == H5T_CSET_ERROR) { + HDF5ErrMapper::ToException("Error getting cset of datatype."); + } + + return cset; +} + +inline H5T_str_t h5t_get_strpad(hid_t hid) { + auto strpad = H5Tget_strpad(hid); + if (strpad == H5T_STR_ERROR) { + HDF5ErrMapper::ToException("Error getting strpad of datatype."); + } + + return strpad; +} + +inline void h5t_set_size(hid_t hid, hsize_t size) { + if (H5Tset_size(hid, size) < 0) { + HDF5ErrMapper::ToException("Error setting size of datatype."); + } +} + +inline void h5t_set_cset(hid_t hid, H5T_cset_t cset) { + if (H5Tset_cset(hid, cset) < 0) { + HDF5ErrMapper::ToException("Error setting cset of datatype."); + } +} + +inline void h5t_set_strpad(hid_t hid, H5T_str_t strpad) { + if (H5Tset_strpad(hid, strpad) < 0) { + HDF5ErrMapper::ToException("Error setting strpad of datatype."); + } +} +} // namespace detail + + namespace { // unnamed inline DataTypeClass convert_type_class(const H5T_class_t& tclass); inline std::string type_class_string(DataTypeClass); @@ -39,7 +99,7 @@ inline DataTypeClass DataType::getClass() const { } inline size_t DataType::getSize() const { - return H5Tget_size(_hid); + return detail::h5t_get_size(_hid); } inline bool DataType::operator==(const DataType& other) const { @@ -55,7 +115,7 @@ inline bool DataType::isVariableStr() const { if (var_value < 0) { HDF5ErrMapper::ToException("Unable to define datatype size to variable"); } - return var_value ? true : false; + return static_cast(var_value); } inline bool DataType::isFixedLenStr() const { @@ -66,68 +126,110 @@ inline bool DataType::isReference() const { return H5Tequal(_hid, H5T_STD_REF_OBJ) > 0; } +inline StringType DataType::asStringType() const { + if (getClass() != DataTypeClass::String) { + throw DataTypeException("Invalid conversion to StringType."); + } + + if (isValid() && H5Iinc_ref(_hid) < 0) { + throw ObjectException("Reference counter increase failure"); + } + + return StringType(_hid); +} + inline std::string DataType::string() const { return type_class_string(getClass()) + std::to_string(getSize() * 8); } +inline StringPadding StringType::getPadding() const { + return StringPadding(detail::h5t_get_strpad(_hid)); +} + +inline CharacterSet StringType::getCharacterSet() const { + return CharacterSet(detail::h5t_get_cset(_hid)); +} + +inline FixedLengthStringType::FixedLengthStringType(size_t size, + StringPadding padding, + CharacterSet character_set) { + if (size == 0 && padding == StringPadding::NullTerminated) { + throw DataTypeException( + "Fixed-length, null-terminated need at least one byte to store the null-character."); + } + + _hid = detail::h5t_copy(H5T_C_S1); + + detail::h5t_set_size(_hid, hsize_t(size)); + detail::h5t_set_cset(_hid, H5T_cset_t(character_set)); + detail::h5t_set_strpad(_hid, H5T_str_t(padding)); +} + +inline VariableLengthStringType::VariableLengthStringType(CharacterSet character_set) { + _hid = detail::h5t_copy(H5T_C_S1); + + detail::h5t_set_size(_hid, H5T_VARIABLE); + detail::h5t_set_cset(_hid, H5T_cset_t(character_set)); +} + // char mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_CHAR); + _hid = detail::h5t_copy(H5T_NATIVE_CHAR); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_SCHAR); + _hid = detail::h5t_copy(H5T_NATIVE_SCHAR); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_UCHAR); + _hid = detail::h5t_copy(H5T_NATIVE_UCHAR); } // short mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_SHORT); + _hid = detail::h5t_copy(H5T_NATIVE_SHORT); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_USHORT); + _hid = detail::h5t_copy(H5T_NATIVE_USHORT); } // integer mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_INT); + _hid = detail::h5t_copy(H5T_NATIVE_INT); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_UINT); + _hid = detail::h5t_copy(H5T_NATIVE_UINT); } // long mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_LONG); + _hid = detail::h5t_copy(H5T_NATIVE_LONG); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_ULONG); + _hid = detail::h5t_copy(H5T_NATIVE_ULONG); } // long long mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_LLONG); + _hid = detail::h5t_copy(H5T_NATIVE_LLONG); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_ULLONG); + _hid = detail::h5t_copy(H5T_NATIVE_ULLONG); } // half-float, float, double and long double mapping @@ -136,11 +238,11 @@ using float16_t = half_float::half; template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_FLOAT); + _hid = detail::h5t_copy(H5T_NATIVE_FLOAT); // Sign position, exponent position, exponent size, mantissa position, mantissa size H5Tset_fields(_hid, 15, 10, 5, 0, 10); // Total datatype size (in bytes) - H5Tset_size(_hid, 2); + detail::h5t_set_size(_hid, 2); // Floating point exponent bias H5Tset_ebias(_hid, 15); } @@ -148,23 +250,17 @@ inline AtomicType::AtomicType() { template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_FLOAT); + _hid = detail::h5t_copy(H5T_NATIVE_FLOAT); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_DOUBLE); + _hid = detail::h5t_copy(H5T_NATIVE_DOUBLE); } template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_LDOUBLE); -} - -// boolean mapping -template <> -inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_NATIVE_HBOOL); + _hid = detail::h5t_copy(H5T_NATIVE_LDOUBLE); } // std string @@ -173,6 +269,14 @@ inline AtomicType::AtomicType() { _hid = create_string(H5T_VARIABLE); } +#if HIGHFIVE_CXX_STD >= 17 +// std byte +template <> +inline AtomicType::AtomicType() { + _hid = detail::h5t_copy(H5T_NATIVE_B8); +} +#endif + // Fixed-Length strings // require class specialization templated for the char length template @@ -196,11 +300,16 @@ class AtomicType>: public DataType { : DataType( CompoundType({{"r", create_datatype(), 0}, {"i", create_datatype(), sizeof(T)}}, sizeof(std::complex))) { - static_assert(std::is_floating_point::value, - "std::complex accepts only floating point numbers."); + static_assert(std::is_arithmetic::value, + "std::complex accepts only floating point and integral numbers."); } }; +// For boolean we act as h5py +inline EnumType create_enum_boolean() { + return {{"FALSE", details::Boolean::HighFiveFalse}, {"TRUE", details::Boolean::HighFiveTrue}}; +} + // Other cases not supported. Fail early with a user message template AtomicType::AtomicType() { @@ -221,18 +330,15 @@ inline FixedLenStringArray::FixedLenStringArray(const char array[][N], std::s template inline FixedLenStringArray::FixedLenStringArray(const std::string* iter_begin, const std::string* iter_end) { - datavec.resize(static_cast(iter_end - iter_begin)); - for (auto& dst_array: datavec) { - const char* src = (iter_begin++)->c_str(); - const size_t length = std::min(N - 1, std::strlen(src)); - std::memcpy(dst_array.data(), src, length); - dst_array[length] = 0; + datavec.reserve(static_cast(iter_end - iter_begin)); + for (std::string const* it = iter_begin; it != iter_end; ++it) { + push_back(*it); } } template inline FixedLenStringArray::FixedLenStringArray(const std::vector& vec) - : FixedLenStringArray(&vec.front(), &vec.back()) {} + : FixedLenStringArray(vec.data(), vec.data() + vec.size()) {} template inline FixedLenStringArray::FixedLenStringArray( @@ -262,7 +368,7 @@ inline std::string FixedLenStringArray::getString(std::size_t i) const { // Reference mapping template <> inline AtomicType::AtomicType() { - _hid = H5Tcopy(H5T_STD_REF_OBJ); + _hid = detail::h5t_copy(H5T_STD_REF_OBJ); } inline size_t find_first_atomic_member_size(hid_t hid) { @@ -285,7 +391,7 @@ inline size_t find_first_atomic_member_size(hid_t hid) { } else if (H5Tget_class(hid) == H5T_STRING) { return 1; } - return H5Tget_size(hid); + return detail::h5t_get_size(hid); } // Calculate the padding required to align an element of a struct @@ -316,7 +422,7 @@ inline void CompoundType::create(size_t size) { // Do a first pass to find the total size of the compound datatype for (auto& member: members) { - size_t member_size = H5Tget_size(member.base_type.getId()); + size_t member_size = detail::h5t_get_size(member.base_type.getId()); if (member_size == 0) { throw DataTypeException("Cannot get size of DataType with hid: " + @@ -384,12 +490,9 @@ inline void EnumType::commit(const Object& object, const std::string& name) c namespace { inline hid_t create_string(size_t length) { - hid_t _hid = H5Tcopy(H5T_C_S1); - if (H5Tset_size(_hid, length) < 0) { - HDF5ErrMapper::ToException("Unable to define datatype size to variable"); - } - // define encoding to UTF-8 by default - H5Tset_cset(_hid, H5T_CSET_UTF8); + hid_t _hid = detail::h5t_copy(H5T_C_S1); + detail::h5t_set_size(_hid, length); + detail::h5t_set_cset(_hid, H5T_CSET_UTF8); return _hid; } @@ -494,6 +597,4 @@ inline DataType create_and_check_datatype() { } } // namespace HighFive - - -#endif // H5DATATYPE_MISC_HPP +HIGHFIVE_REGISTER_TYPE(HighFive::details::Boolean, HighFive::create_enum_boolean) diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Dataspace_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Dataspace_misc.hpp index c371a18316..0fdcacefdb 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Dataspace_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Dataspace_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5DATASPACE_MISC_HPP -#define H5DATASPACE_MISC_HPP +#pragma once #include #include @@ -63,9 +62,9 @@ inline DataSpace::DataSpace(const std::vector& dims, const std::vector DataSpace::getDimensions() const { } inline size_t DataSpace::getElementCount() const { - const std::vector& dims = getDimensions(); - return std::accumulate(dims.begin(), dims.end(), size_t{1u}, std::multiplies()); + hssize_t nelements = H5Sget_simple_extent_npoints(_hid); + if (nelements < 0) { + HDF5ErrMapper::ToException( + "Unable to get number of elements in dataspace"); + } + + return static_cast(nelements); } inline std::vector DataSpace::getMaxDimensions() const { @@ -142,30 +146,9 @@ inline DataSpace DataSpace::FromCharArrayStrings(const char (&)[N][Width]) { namespace details { /// dimension checks @internal -inline bool checkDimensions(const DataSpace& mem_space, size_t input_dims) { - size_t dataset_dims = mem_space.getNumberDimensions(); - if (input_dims == dataset_dims) - return true; - - const std::vector& dims = mem_space.getDimensions(); - for (auto i = dims.crbegin(); i != --dims.crend() && *i == 1; ++i) - --dataset_dims; - - if (input_dims == dataset_dims) - return true; - - dataset_dims = dims.size(); - for (auto i = dims.cbegin(); i != --dims.cend() && *i == 1; ++i) - --dataset_dims; - - if (input_dims == dataset_dims) - return true; - - // The final tests is for scalars - return input_dims == 0 && dataset_dims == 1 && dims.back() == 1; +inline bool checkDimensions(const DataSpace& mem_space, size_t n_dim_requested) { + return checkDimensions(mem_space.getDimensions(), n_dim_requested); } } // namespace details } // namespace HighFive - -#endif // H5DATASPACE_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Exception_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Exception_misc.hpp index ff3839198c..f7382f2c2c 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Exception_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Exception_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EXCEPTION_MISC_HPP -#define H5EXCEPTION_MISC_HPP +#pragma once #include #include @@ -28,8 +27,8 @@ struct HDF5ErrMapper { std::ostringstream oss; oss << '(' << major_err << ") " << minor_err; - free((void*) major_err); - free((void*) minor_err); + H5free_memory((void*) major_err); + H5free_memory((void*) minor_err); auto* e = new ExceptionType(oss.str()); e->_err_major = err_desc->maj_num; @@ -61,5 +60,3 @@ struct HDF5ErrMapper { }; } // namespace HighFive - -#endif // H5OBJECT_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5FileDriver_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5FileDriver_misc.hpp index 12a485d90c..a6331bd5a9 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5FileDriver_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5FileDriver_misc.hpp @@ -7,8 +7,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5FILEDRIVER_MISC_HPP -#define H5FILEDRIVER_MISC_HPP +#pragma once namespace HighFive { @@ -19,5 +18,3 @@ inline MPIOFileDriver::MPIOFileDriver(MPI_Comm comm, MPI_Info info) { #endif } // namespace HighFive - -#endif // H5FILEDRIVER_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5File_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5File_misc.hpp index 5dd86cadd2..b90792a712 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5File_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5File_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5FILE_MISC_HPP -#define H5FILE_MISC_HPP +#pragma once #include @@ -93,56 +92,32 @@ inline const std::string& File::getName() const noexcept { } inline hsize_t File::getMetadataBlockSize() const { - hsize_t size; auto fapl = getAccessPropertyList(); - if (H5Pget_meta_block_size(fapl.getId(), &size) < 0) { - HDF5ErrMapper::ToException( - std::string("Unable to access file metadata block size")); - } - return size; + return MetadataBlockSize(fapl).getSize(); } inline std::pair File::getVersionBounds() const { - H5F_libver_t low; - H5F_libver_t high; auto fapl = getAccessPropertyList(); - if (H5Pget_libver_bounds(fapl.getId(), &low, &high) < 0) { - HDF5ErrMapper::ToException( - std::string("Unable to access file version bounds")); - } - return std::make_pair(low, high); + auto fileVer = FileVersionBounds(fapl); + return fileVer.getVersion(); } #if H5_VERSION_GE(1, 10, 1) inline H5F_fspace_strategy_t File::getFileSpaceStrategy() const { auto fcpl = getCreatePropertyList(); - - H5F_fspace_strategy_t strategy; - hbool_t persist; - hsize_t threshold; - - if (H5Pget_file_space_strategy(fcpl.getId(), &strategy, &persist, &threshold) < 0) { - HDF5ErrMapper::ToException(std::string("Unable to get file space strategy")); - } - - return strategy; + FileSpaceStrategy spaceStrategy(fcpl); + return spaceStrategy.getStrategy(); } inline hsize_t File::getFileSpacePageSize() const { auto fcpl = getCreatePropertyList(); - hsize_t page_size; if (getFileSpaceStrategy() != H5F_FSPACE_STRATEGY_PAGE) { HDF5ErrMapper::ToException( std::string("Cannot obtain page size as paged allocation is not used.")); } - if (H5Pget_file_space_page_size(fcpl.getId(), &page_size) < 0) { - HDF5ErrMapper::ToException( - std::string("Unable to get file space page size")); - } - - return page_size; + return FileSpacePageSize(fcpl).getPageSize(); } #endif @@ -152,6 +127,22 @@ inline void File::flush() { } } -} // namespace HighFive +inline size_t File::getFileSize() const { + hsize_t sizeValue = 0; + if (H5Fget_filesize(_hid, &sizeValue) < 0) { + HDF5ErrMapper::ToException( + std::string("Unable to retrieve size of file " + getName())); + } + return static_cast(sizeValue); +} -#endif // H5FILE_MISC_HPP +inline size_t File::getFreeSpace() const { + hssize_t unusedSize = H5Fget_freespace(_hid); + if (unusedSize < 0) { + HDF5ErrMapper::ToException( + std::string("Unable to retrieve unused space of file " + getName())); + } + return static_cast(unusedSize); +} + +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Friends.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Friends.hpp new file mode 100644 index 0000000000..d19125c7f5 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Friends.hpp @@ -0,0 +1,10 @@ +#pragma once + +#ifndef HIGHFIVE_HAS_FRIEND_DECLARATIONS +#ifdef _MSC_VER +// This prevents a compiler bug on certain versions of MSVC. +// Known to fail: Toolset 141. +// See `CMakeLists.txt` for more information. +#define HIGHFIVE_HAS_FRIEND_DECLARATIONS 1 +#endif +#endif \ No newline at end of file diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Inspector_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Inspector_misc.hpp new file mode 100644 index 0000000000..05ed6bc3ec --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Inspector_misc.hpp @@ -0,0 +1,858 @@ +/* + * Copyright (c) 2022 Blue Brain Project + * + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include "../H5Reference.hpp" + +#include "string_padding.hpp" + +#ifdef H5_USE_BOOST +#include +// starting Boost 1.64, serialization header must come before ublas +#include +#include +#endif +#ifdef H5_USE_EIGEN +#include +#endif + + +namespace HighFive { + +namespace details { + +inline bool checkDimensions(const std::vector& dims, size_t n_dim_requested) { + size_t n_dim_actual = dims.size(); + + // We should allow reading scalar from shapes like `(1, 1, 1)`. + if (n_dim_requested == 0) { + if (n_dim_actual == 0ul) { + return true; + } + + return size_t(std::count(dims.begin(), dims.end(), 1ul)) == n_dim_actual; + } + + // For non-scalar datasets, we can squeeze away singleton dimension, but + // we never add any. + if (n_dim_actual < n_dim_requested) { + return false; + } + + // Special case for 1-dimensional arrays, which can squeeze `1`s from either + // side simultaneously if needed. + if (n_dim_requested == 1ul) { + return n_dim_actual >= 1ul && + size_t(std::count(dims.begin(), dims.end(), 1ul)) >= n_dim_actual - 1ul; + } + + // All other cases strip front only. This avoid unstable behaviour when + // squeezing singleton dimensions. + size_t n_dim_excess = n_dim_actual - n_dim_requested; + + bool squeeze_back = true; + for (size_t i = 1; i <= n_dim_excess; ++i) { + if (dims[n_dim_actual - i] != 1) { + squeeze_back = false; + break; + } + } + + return squeeze_back; +} + + +inline std::vector squeezeDimensions(const std::vector& dims, + size_t n_dim_requested) { + auto format_error_message = [&]() -> std::string { + return "Can't interpret dims = " + format_vector(dims) + " as " + + std::to_string(n_dim_requested) + "-dimensional."; + }; + + if (n_dim_requested == 0) { + if (!checkDimensions(dims, n_dim_requested)) { + throw std::invalid_argument(format_error_message()); + } + + return {1ul}; + } + + auto n_dim = dims.size(); + if (n_dim < n_dim_requested) { + throw std::invalid_argument(format_error_message()); + } + + if (n_dim_requested == 1ul) { + size_t non_singleton_dim = size_t(-1); + for (size_t i = 0; i < n_dim; ++i) { + if (dims[i] != 1ul) { + if (non_singleton_dim == size_t(-1)) { + non_singleton_dim = i; + } else { + throw std::invalid_argument(format_error_message()); + } + } + } + + return {dims[std::min(non_singleton_dim, n_dim - 1)]}; + } + + size_t n_dim_excess = dims.size() - n_dim_requested; + for (size_t i = 1; i <= n_dim_excess; ++i) { + if (dims[n_dim - i] != 1) { + throw std::invalid_argument(format_error_message()); + } + } + + return std::vector(dims.begin(), + dims.end() - static_cast(n_dim_excess)); +} +} // namespace details + + +inline size_t compute_total_size(const std::vector& dims) { + return std::accumulate(dims.begin(), dims.end(), size_t{1u}, std::multiplies()); +} + +template +using unqualified_t = typename std::remove_const::type>::type; + +/***** +inspector { + using type = T + // base_type is the base type inside c++ (e.g. std::vector => int) + using base_type + // hdf5_type is the base read by hdf5 (c-type) (e.g. std::vector => const char*) + using hdf5_type + + // Number of dimensions starting from here + static constexpr size_t recursive_ndim + // Is the inner type trivially copyable for optimisation + // If this value is true: data() is mandatory + // If this value is false: getSizeVal, getSize, serialize, unserialize are mandatory + static constexpr bool is_trivially_copyable + + // Reading: + // Allocate the value following dims (should be recursive) + static void prepare(type& val, const std::vector dims) + // Return the size of the vector pass to/from hdf5 from a vector of dims + static size_t getSize(const std::vector& dims) + // Return a pointer of the first value of val (for reading) + static hdf5_type* data(type& val) + // Take a serialized vector 'in', some dims and copy value to val (for reading) + static void unserialize(const hdf5_type* in, const std::vector&i, type& val) + + + // Writing: + // Return the size of the vector pass to/from hdf5 from a value + static size_t getSizeVal(const type& val) + // Return a point of the first value of val + static const hdf5_type* data(const type& val) + // Take a val and serialize it inside 'out' + static void serialize(const type& val, hdf5_type* out) + // Return an array of dimensions of the space needed for writing val + static std::vector getDimensions(const type& val) +} +*****/ + + +namespace details { +template +struct type_helper { + using type = unqualified_t; + using base_type = unqualified_t; + using hdf5_type = base_type; + + static constexpr size_t ndim = 0; + static constexpr size_t recursive_ndim = ndim; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value; + + static std::vector getDimensions(const type& /* val */) { + return {}; + } + + static size_t getSizeVal(const type& val) { + return compute_total_size(getDimensions(val)); + } + + static size_t getSize(const std::vector& dims) { + return compute_total_size(dims); + } + + static void prepare(type& /* val */, const std::vector& /* dims */) {} + + static hdf5_type* data(type& val) { + static_assert(is_trivially_copyable, "The type is not trivially copyable"); + return &val; + } + + static const hdf5_type* data(const type& val) { + static_assert(is_trivially_copyable, "The type is not trivially copyable"); + return &val; + } + + static void serialize(const type& val, hdf5_type* m) { + static_assert(is_trivially_copyable, "The type is not trivially copyable"); + *m = val; + } + + static void unserialize(const hdf5_type* vec, + const std::vector& /* dims */, + type& val) { + static_assert(is_trivially_copyable, "The type is not trivially copyable"); + val = vec[0]; + } +}; + +template +struct inspector: type_helper {}; + +enum class Boolean : int8_t { + HighFiveFalse = 0, + HighFiveTrue = 1, +}; + +template <> +struct inspector: type_helper { + using base_type = Boolean; + using hdf5_type = int8_t; + + static constexpr bool is_trivially_copyable = false; + + static hdf5_type* data(type& /* val */) { + throw DataSpaceException("A boolean cannot be read directly."); + } + + static const hdf5_type* data(const type& /* val */) { + throw DataSpaceException("A boolean cannot be written directly."); + } + + static void unserialize(const hdf5_type* vec, + const std::vector& /* dims */, + type& val) { + val = vec[0] != 0 ? true : false; + } + + static void serialize(const type& val, hdf5_type* m) { + *m = val ? 1 : 0; + } +}; + +template <> +struct inspector: type_helper { + using hdf5_type = const char*; + + static hdf5_type* data(type& /* val */) { + throw DataSpaceException("A std::string cannot be read directly."); + } + + static const hdf5_type* data(const type& /* val */) { + throw DataSpaceException("A std::string cannot be written directly."); + } + + template + static void serialize(const type& val, It m) { + (*m).assign(val.data(), val.size(), StringPadding::NullTerminated); + } + + template + static void unserialize(const It& vec, const std::vector& /* dims */, type& val) { + const auto& view = *vec; + val.assign(view.data(), view.length()); + } +}; + +template <> +struct inspector: type_helper { + using hdf5_type = hobj_ref_t; + + static constexpr bool is_trivially_copyable = false; + + static hdf5_type* data(type& /* val */) { + throw DataSpaceException("A Reference cannot be read directly."); + } + + static const hdf5_type* data(const type& /* val */) { + throw DataSpaceException("A Reference cannot be written directly."); + } + + static void serialize(const type& val, hdf5_type* m) { + hobj_ref_t ref; + val.create_ref(&ref); + *m = ref; + } + + static void unserialize(const hdf5_type* vec, + const std::vector& /* dims */, + type& val) { + val = type{vec[0]}; + } +}; + +template +struct inspector> { + using type = FixedLenStringArray; + using value_type = char*; + using base_type = FixedLenStringArray; + using hdf5_type = char; + + static constexpr size_t ndim = 1; + static constexpr size_t recursive_ndim = ndim; + static constexpr bool is_trivially_copyable = false; + + static std::vector getDimensions(const type& val) { + return std::vector{val.size()}; + } + + static size_t getSizeVal(const type& val) { + return N * compute_total_size(getDimensions(val)); + } + + static size_t getSize(const std::vector& dims) { + return N * compute_total_size(dims); + } + + static void prepare(type& /* val */, const std::vector& dims) { + if (dims[0] > N) { + std::ostringstream os; + os << "Size of FixedlenStringArray (" << N << ") is too small for dims (" << dims[0] + << ")."; + throw DataSpaceException(os.str()); + } + } + + static hdf5_type* data(type& val) { + return val.data(); + } + + static const hdf5_type* data(const type& val) { + return val.data(); + } + + static void serialize(const type& val, hdf5_type* m) { + for (size_t i = 0; i < val.size(); ++i) { + std::memcpy(m + i * N, val[i], N); + } + } + + static void unserialize(const hdf5_type* vec, const std::vector& dims, type& val) { + for (size_t i = 0; i < dims[0]; ++i) { + std::array s; + std::memcpy(s.data(), vec + (i * N), N); + val.push_back(s); + } + } +}; + +template +struct inspector> { + using type = std::vector; + using value_type = unqualified_t; + using base_type = typename inspector::base_type; + using hdf5_type = typename inspector::hdf5_type; + + static constexpr size_t ndim = 1; + static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; + + static std::vector getDimensions(const type& val) { + std::vector sizes(recursive_ndim, 1ul); + sizes[0] = val.size(); + if (!val.empty()) { + auto s = inspector::getDimensions(val[0]); + assert(s.size() + ndim == sizes.size()); + for (size_t i = 0; i < s.size(); ++i) { + sizes[i + ndim] = s[i]; + } + } + return sizes; + } + + static size_t getSizeVal(const type& val) { + return compute_total_size(getDimensions(val)); + } + + static size_t getSize(const std::vector& dims) { + return compute_total_size(dims); + } + + static void prepare(type& val, const std::vector& dims) { + val.resize(dims[0]); + std::vector next_dims(dims.begin() + 1, dims.end()); + for (auto&& e: val) { + inspector::prepare(e, next_dims); + } + } + + static hdf5_type* data(type& val) { + return inspector::data(val[0]); + } + + static const hdf5_type* data(const type& val) { + return inspector::data(val[0]); + } + + template + static void serialize(const type& val, It m) { + size_t subsize = inspector::getSizeVal(val[0]); + for (auto&& e: val) { + inspector::serialize(e, m); + m += subsize; + } + } + + template + static void unserialize(const It& vec_align, const std::vector& dims, type& val) { + std::vector next_dims(dims.begin() + 1, dims.end()); + size_t next_size = compute_total_size(next_dims); + for (size_t i = 0; i < dims[0]; ++i) { + inspector::unserialize(vec_align + i * next_size, next_dims, val[i]); + } + } +}; + +template <> +struct inspector> { + using type = std::vector; + using value_type = bool; + using base_type = Boolean; + using hdf5_type = uint8_t; + + static constexpr size_t ndim = 1; + static constexpr size_t recursive_ndim = ndim; + static constexpr bool is_trivially_copyable = false; + + static std::vector getDimensions(const type& val) { + std::vector sizes{val.size()}; + return sizes; + } + + static size_t getSizeVal(const type& val) { + return val.size(); + } + + static size_t getSize(const std::vector& dims) { + if (dims.size() > 1) { + throw DataSpaceException("std::vector is only 1 dimension."); + } + return dims[0]; + } + + static void prepare(type& val, const std::vector& dims) { + if (dims.size() > 1) { + throw DataSpaceException("std::vector is only 1 dimension."); + } + val.resize(dims[0]); + } + + static hdf5_type* data(type& /* val */) { + throw DataSpaceException("A std::vector cannot be read directly."); + } + + static const hdf5_type* data(const type& /* val */) { + throw DataSpaceException("A std::vector cannot be written directly."); + } + + static void serialize(const type& val, hdf5_type* m) { + for (size_t i = 0; i < val.size(); ++i) { + m[i] = val[i] ? 1 : 0; + } + } + + static void unserialize(const hdf5_type* vec_align, + const std::vector& dims, + type& val) { + for (size_t i = 0; i < dims[0]; ++i) { + val[i] = vec_align[i] != 0 ? true : false; + } + } +}; + +template +struct inspector> { + using type = std::array; + using value_type = unqualified_t; + using base_type = typename inspector::base_type; + using hdf5_type = typename inspector::hdf5_type; + + static constexpr size_t ndim = 1; + static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + sizeof(type) == N * sizeof(T) && + inspector::is_trivially_copyable; + + static std::vector getDimensions(const type& val) { + std::vector sizes{N}; + if (!val.empty()) { + auto s = inspector::getDimensions(val[0]); + sizes.insert(sizes.end(), s.begin(), s.end()); + } + return sizes; + } + + static size_t getSizeVal(const type& val) { + return compute_total_size(getDimensions(val)); + } + + static size_t getSize(const std::vector& dims) { + return compute_total_size(dims); + } + + static void prepare(type& /* val */, const std::vector& dims) { + if (dims[0] > N) { + std::ostringstream os; + os << "Size of std::array (" << N << ") is too small for dims (" << dims[0] << ")."; + throw DataSpaceException(os.str()); + } + } + + static hdf5_type* data(type& val) { + return inspector::data(val[0]); + } + + static const hdf5_type* data(const type& val) { + return inspector::data(val[0]); + } + + template + static void serialize(const type& val, It m) { + size_t subsize = inspector::getSizeVal(val[0]); + for (auto& e: val) { + inspector::serialize(e, m); + m += subsize; + } + } + + template + static void unserialize(const It& vec_align, const std::vector& dims, type& val) { + if (dims[0] != N) { + std::ostringstream os; + os << "Impossible to pair DataSet with " << dims[0] << " elements into an array with " + << N << " elements."; + throw DataSpaceException(os.str()); + } + std::vector next_dims(dims.begin() + 1, dims.end()); + size_t next_size = compute_total_size(next_dims); + for (size_t i = 0; i < dims[0]; ++i) { + inspector::unserialize(vec_align + i * next_size, next_dims, val[i]); + } + } +}; + +// Cannot be use for reading +template +struct inspector { + using type = T*; + using value_type = unqualified_t; + using base_type = typename inspector::base_type; + using hdf5_type = typename inspector::hdf5_type; + + static constexpr size_t ndim = 1; + static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; + + static size_t getSizeVal(const type& /* val */) { + throw DataSpaceException("Not possible to have size of a T*"); + } + + static std::vector getDimensions(const type& /* val */) { + throw DataSpaceException("Not possible to have size of a T*"); + } + + static const hdf5_type* data(const type& val) { + return reinterpret_cast(val); + } + + /* it works because there is only T[][][] currently + we will fix it one day */ + static void serialize(const type& /* val */, hdf5_type* /* m */) { + throw DataSpaceException("Not possible to serialize a T*"); + } +}; + +// Cannot be use for reading +template +struct inspector { + using type = T[N]; + using value_type = unqualified_t; + using base_type = typename inspector::base_type; + using hdf5_type = typename inspector::hdf5_type; + + static constexpr size_t ndim = 1; + static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; + + static size_t getSizeVal(const type& val) { + return compute_total_size(getDimensions(val)); + } + + static std::vector getDimensions(const type& val) { + std::vector sizes{N}; + if (N > 0) { + auto s = inspector::getDimensions(val[0]); + sizes.insert(sizes.end(), s.begin(), s.end()); + } + return sizes; + } + + static const hdf5_type* data(const type& val) { + return inspector::data(val[0]); + } + + /* it works because there is only T[][][] currently + we will fix it one day */ + static void serialize(const type& val, hdf5_type* m) { + size_t subsize = inspector::getSizeVal(val[0]); + for (size_t i = 0; i < N; ++i) { + inspector::serialize(val[i], m + i * subsize); + } + } +}; + +#ifdef H5_USE_EIGEN +template +struct inspector> { + using type = Eigen::Matrix; + using value_type = T; + using base_type = typename inspector::base_type; + using hdf5_type = base_type; + + static constexpr size_t ndim = 2; + static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; + + + static void assert_not_buggy(Eigen::Index nrows, Eigen::Index ncols) { + if (nrows > 1 && ncols > 1) { + throw std::runtime_error( + "HighFive has been broken for Eigen::Matrix. Please check " + "https://github.com/BlueBrain/HighFive/issues/532."); + } + } + + static std::vector getDimensions(const type& val) { + assert_not_buggy(val.rows(), val.cols()); + + std::vector sizes{static_cast(val.rows()), static_cast(val.cols())}; + auto s = inspector::getDimensions(val.data()[0]); + sizes.insert(sizes.end(), s.begin(), s.end()); + return sizes; + } + + static size_t getSizeVal(const type& val) { + return compute_total_size(getDimensions(val)); + } + + static size_t getSize(const std::vector& dims) { + return compute_total_size(dims); + } + + static void prepare(type& val, const std::vector& dims) { + if (dims[0] != static_cast(val.rows()) || + dims[1] != static_cast(val.cols())) { + val.resize(static_cast(dims[0]), + static_cast(dims[1])); + } + + assert_not_buggy(val.rows(), val.cols()); + } + + static hdf5_type* data(type& val) { + assert_not_buggy(val.rows(), val.cols()); + return inspector::data(*val.data()); + } + + static const hdf5_type* data(const type& val) { + assert_not_buggy(val.rows(), val.cols()); + return inspector::data(*val.data()); + } + + static void serialize(const type& val, hdf5_type* m) { + assert_not_buggy(val.rows(), val.cols()); + std::memcpy(m, val.data(), static_cast(val.size()) * sizeof(hdf5_type)); + } + + static void unserialize(const hdf5_type* vec_align, + const std::vector& dims, + type& val) { + assert_not_buggy(val.rows(), val.cols()); + if (dims.size() < 2) { + std::ostringstream os; + os << "Impossible to pair DataSet with " << dims.size() + << " dimensions into an eigen-matrix."; + throw DataSpaceException(os.str()); + } + std::memcpy(val.data(), vec_align, compute_total_size(dims) * sizeof(hdf5_type)); + } +}; +#endif + +#ifdef H5_USE_BOOST +template +struct inspector> { + using type = boost::multi_array; + using value_type = T; + using base_type = typename inspector::base_type; + using hdf5_type = typename inspector::hdf5_type; + + static constexpr size_t ndim = Dims; + static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; + + static std::vector getDimensions(const type& val) { + std::vector sizes; + for (size_t i = 0; i < ndim; ++i) { + sizes.push_back(val.shape()[i]); + } + auto s = inspector::getDimensions(val.data()[0]); + sizes.insert(sizes.end(), s.begin(), s.end()); + return sizes; + } + + static size_t getSizeVal(const type& val) { + return compute_total_size(getDimensions(val)); + } + + static size_t getSize(const std::vector& dims) { + return compute_total_size(dims); + } + + static void prepare(type& val, const std::vector& dims) { + if (dims.size() < ndim) { + std::ostringstream os; + os << "Only '" << dims.size() << "' given but boost::multi_array is of size '" << ndim + << "'."; + throw DataSpaceException(os.str()); + } + boost::array ext; + std::copy(dims.begin(), dims.begin() + ndim, ext.begin()); + val.resize(ext); + std::vector next_dims(dims.begin() + Dims, dims.end()); + std::size_t size = std::accumulate(dims.begin(), + dims.begin() + Dims, + std::size_t{1}, + std::multiplies()); + for (size_t i = 0; i < size; ++i) { + inspector::prepare(*(val.origin() + i), next_dims); + } + } + + static hdf5_type* data(type& val) { + return inspector::data(*val.data()); + } + + static const hdf5_type* data(const type& val) { + return inspector::data(*val.data()); + } + + template + static void serialize(const type& val, It m) { + size_t size = val.num_elements(); + size_t subsize = inspector::getSizeVal(*val.origin()); + for (size_t i = 0; i < size; ++i) { + inspector::serialize(*(val.origin() + i), m + i * subsize); + } + } + + template + static void unserialize(It vec_align, const std::vector& dims, type& val) { + std::vector next_dims(dims.begin() + ndim, dims.end()); + size_t subsize = compute_total_size(next_dims); + for (size_t i = 0; i < val.num_elements(); ++i) { + inspector::unserialize(vec_align + i * subsize, + next_dims, + *(val.origin() + i)); + } + } +}; + +template +struct inspector> { + using type = boost::numeric::ublas::matrix; + using value_type = unqualified_t; + using base_type = typename inspector::base_type; + using hdf5_type = typename inspector::hdf5_type; + + static constexpr size_t ndim = 2; + static constexpr size_t recursive_ndim = ndim + inspector::recursive_ndim; + static constexpr bool is_trivially_copyable = std::is_trivially_copyable::value && + inspector::is_trivially_copyable; + + static std::vector getDimensions(const type& val) { + std::vector sizes{val.size1(), val.size2()}; + auto s = inspector::getDimensions(val(0, 0)); + sizes.insert(sizes.end(), s.begin(), s.end()); + return sizes; + } + + static size_t getSizeVal(const type& val) { + return compute_total_size(getDimensions(val)); + } + + static size_t getSize(const std::vector& dims) { + return compute_total_size(dims); + } + + static void prepare(type& val, const std::vector& dims) { + if (dims.size() < ndim) { + std::ostringstream os; + os << "Impossible to pair DataSet with " << dims.size() << " dimensions into a " << ndim + << " boost::numeric::ublas::matrix"; + throw DataSpaceException(os.str()); + } + val.resize(dims[0], dims[1], false); + } + + static hdf5_type* data(type& val) { + return inspector::data(val(0, 0)); + } + + static const hdf5_type* data(const type& val) { + return inspector::data(val(0, 0)); + } + + static void serialize(const type& val, hdf5_type* m) { + size_t size = val.size1() * val.size2(); + size_t subsize = inspector::getSizeVal(val(0, 0)); + for (size_t i = 0; i < size; ++i) { + inspector::serialize(*(&val(0, 0) + i), m + i * subsize); + } + } + + static void unserialize(const hdf5_type* vec_align, + const std::vector& dims, + type& val) { + std::vector next_dims(dims.begin() + ndim, dims.end()); + size_t subsize = compute_total_size(next_dims); + size_t size = val.size1() * val.size2(); + for (size_t i = 0; i < size; ++i) { + inspector::unserialize(vec_align + i * subsize, + next_dims, + *(&val(0, 0) + i)); + } + } +}; +#endif + +} // namespace details +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Iterables_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Iterables_misc.hpp index e28cf313bd..38ebda9ab5 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Iterables_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Iterables_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5ITERABLE_MISC_HPP -#define H5ITERABLE_MISC_HPP +#pragma once #include #include @@ -53,5 +52,3 @@ inline herr_t internal_high_five_iterate(hid_t /*id*/, } // namespace details } // namespace HighFive - -#endif // H5ITERABLE_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Node_traits.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Node_traits.hpp index 949fd107ca..d53d3f0488 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Node_traits.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Node_traits.hpp @@ -6,16 +6,21 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5NODE_TRAITS_HPP -#define H5NODE_TRAITS_HPP +#pragma once #include #include "../H5PropertyList.hpp" #include "H5_definitions.hpp" +#include "H5Converter_misc.hpp" namespace HighFive { +enum class IndexType : std::underlying_type::type { + NAME = H5_INDEX_NAME, + CRT_ORDER = H5_INDEX_CRT_ORDER, +}; + /// /// \brief NodeTraits: Base class for Group and File /// @@ -48,7 +53,20 @@ class NodeTraits { /// \param accessProps A property list with data set access properties /// \param parents Create intermediate groups if needed. Default: true. /// \return DataSet Object - template + template ::base_type, details::Boolean>::value, + int>::type* = nullptr> + DataSet createDataSet(const std::string& dataset_name, + const DataSpace& space, + const DataSetCreateProps& createProps = DataSetCreateProps::Default(), + const DataSetAccessProps& accessProps = DataSetAccessProps::Default(), + bool parents = true); + + template ::base_type, details::Boolean>::value, + int>::type* = nullptr> DataSet createDataSet(const std::string& dataset_name, const DataSpace& space, const DataSetCreateProps& createProps = DataSetCreateProps::Default(), @@ -111,6 +129,14 @@ class NodeTraits { /// \return the group object Group getGroup(const std::string& group_name) const; + /// + /// \brief open a commited datatype with the name type_name + /// \param type_name + /// \return the datatype object + DataType getDataType( + const std::string& type_name, + const DataTypeAccessProps& accessProps = DataTypeAccessProps::Default()) const; + /// /// \brief return the number of leaf objects of the node / group /// \return number of leaf objects @@ -133,8 +159,11 @@ class NodeTraits { /// /// \brief list all leaf objects name of the node / group + /// \param idx_type tell if the list should be ordered by Name or CreationOrderTime. + /// CreationOrderTime can be use only if the file/group has been created with + /// the HighFive::LinkCreationTime property. /// \return number of leaf objects - std::vector listObjectNames() const; + std::vector listObjectNames(IndexType idx_type = IndexType::NAME) const; /// /// \brief check a dataset or group exists in the current node / group @@ -187,6 +216,20 @@ class NodeTraits { const LinkAccessProps& linkAccessProps = LinkAccessProps(), const bool parents = true); + /// + /// \brief Creates hardlinks + /// \param link_name The name of the link + /// \param target_obj The target object + /// \param linkCreateProps A Link_Create property list. Notice "parents=true" overrides + /// \param linkAccessProps The Link_Access property list + /// \param parents Whether parent groups should be created: Default: true + template + void createHardLink(const std::string& link_name, + const T& target_obj, + LinkCreateProps linkCreateProps = LinkCreateProps(), + const LinkAccessProps& linkAccessProps = LinkAccessProps(), + const bool parents = true); + private: using derivate_type = Derivate; @@ -213,6 +256,3 @@ enum class LinkType { } // namespace HighFive - - -#endif // H5NODE_TRAITS_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Node_traits_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Node_traits_misc.hpp index 524f075f88..2f75ff3111 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Node_traits_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Node_traits_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5NODE_TRAITS_MISC_HPP -#define H5NODE_TRAITS_MISC_HPP +#pragma once #include #include @@ -42,8 +41,8 @@ inline DataSet NodeTraits::createDataSet(const std::string& dataset_na lcpl.add(CreateIntermediateGroup(parents)); const auto hid = H5Dcreate2(static_cast(this)->getId(), dataset_name.c_str(), - dtype._hid, - space._hid, + dtype.getId(), + space.getId(), lcpl.getId(), createProps.getId(), accessProps.getId()); @@ -55,14 +54,35 @@ inline DataSet NodeTraits::createDataSet(const std::string& dataset_na } template -template +template ::base_type, details::Boolean>::value, + int>::type*> +inline DataSet NodeTraits::createDataSet(const std::string& dataset_name, + const DataSpace& space, + const DataSetCreateProps& createProps, + const DataSetAccessProps& accessProps, + bool parents) { + return createDataSet(dataset_name, + space, + create_and_check_datatype::base_type>(), + createProps, + accessProps, + parents); +} + +template +template ::base_type, details::Boolean>::value, + int>::type*> inline DataSet NodeTraits::createDataSet(const std::string& dataset_name, const DataSpace& space, const DataSetCreateProps& createProps, const DataSetAccessProps& accessProps, bool parents) { return createDataSet( - dataset_name, space, create_and_check_datatype(), createProps, accessProps, parents); + dataset_name, space, create_and_check_datatype(), createProps, accessProps, parents); } template @@ -122,7 +142,7 @@ inline Group NodeTraits::createGroup(const std::string& group_name, bo HDF5ErrMapper::ToException(std::string("Unable to create the group \"") + group_name + "\":"); } - return Group(hid); + return detail::make_group(hid); } template @@ -140,7 +160,7 @@ inline Group NodeTraits::createGroup(const std::string& group_name, HDF5ErrMapper::ToException(std::string("Unable to create the group \"") + group_name + "\":"); } - return Group(hid); + return detail::make_group(hid); } template @@ -151,7 +171,20 @@ inline Group NodeTraits::getGroup(const std::string& group_name) const HDF5ErrMapper::ToException(std::string("Unable to open the group \"") + group_name + "\":"); } - return Group(hid); + return detail::make_group(hid); +} + +template +inline DataType NodeTraits::getDataType(const std::string& type_name, + const DataTypeAccessProps& accessProps) const { + const auto hid = H5Topen2(static_cast(this)->getId(), + type_name.c_str(), + accessProps.getId()); + if (hid < 0) { + HDF5ErrMapper::ToException( + std::string("Unable to open the datatype \"") + type_name + "\":"); + } + return DataType(hid); } template @@ -199,7 +232,7 @@ inline bool NodeTraits::rename(const std::string& src_path, } template -inline std::vector NodeTraits::listObjectNames() const { +inline std::vector NodeTraits::listObjectNames(IndexType idx_type) const { std::vector names; details::HighFiveIterateData iterateData(names); @@ -207,7 +240,7 @@ inline std::vector NodeTraits::listObjectNames() const { names.reserve(num_objs); if (H5Literate(static_cast(this)->getId(), - H5_INDEX_NAME, + static_cast(idx_type), H5_ITER_INC, NULL, &details::internal_high_five_iterate, @@ -338,6 +371,29 @@ inline void NodeTraits::createExternalLink(const std::string& link_nam } } +template +template +inline void NodeTraits::createHardLink(const std::string& link_name, + const T& target_obj, + LinkCreateProps linkCreateProps, + const LinkAccessProps& linkAccessProps, + const bool parents) { + static_assert(!std::is_same::value, + "hdf5 doesn't support hard links to Attributes"); + if (parents) { + linkCreateProps.add(CreateIntermediateGroup{}); + } + auto status = H5Lcreate_hard(target_obj.getId(), + ".", + static_cast(this)->getId(), + link_name.c_str(), + linkCreateProps.getId(), + linkAccessProps.getId()); + if (status < 0) { + HDF5ErrMapper::ToException(std::string("Unable to create hard link: ")); + } +} + template inline Object NodeTraits::_open(const std::string& node_name, @@ -349,10 +405,8 @@ inline Object NodeTraits::_open(const std::string& node_name, HDF5ErrMapper::ToException(std::string("Unable to open \"") + node_name + "\":"); } - return Object(id); + return detail::make_object(id); } } // namespace HighFive - -#endif // H5NODE_TRAITS_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Object_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Object_misc.hpp index 31927485c5..f477d7fdf3 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Object_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Object_misc.hpp @@ -6,12 +6,20 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5OBJECT_MISC_HPP -#define H5OBJECT_MISC_HPP +#pragma once #include +#include "../H5Exception.hpp" +#include "../H5Utility.hpp" + namespace HighFive { +namespace detail { +inline Object make_object(hid_t hid) { + return Object(hid); +} +} // namespace detail + inline Object::Object() : _hid(H5I_INVALID_HID) {} @@ -46,7 +54,7 @@ inline Object& Object::operator=(const Object& other) { inline Object::~Object() { if (isValid() && H5Idec_ref(_hid) < 0) { - std::cerr << "HighFive::~Object: reference counter decrease failure" << std::endl; + HIGHFIVE_LOG_ERROR("HighFive::~Object: reference counter decrease failure"); } } @@ -113,5 +121,3 @@ inline time_t ObjectInfo::getModificationTime() const noexcept { } // namespace HighFive - -#endif // H5OBJECT_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Path_traits_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Path_traits_misc.hpp index 73704f03af..444e9294bf 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Path_traits_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Path_traits_misc.hpp @@ -34,7 +34,7 @@ inline PathTraits::PathTraits() { template inline std::string PathTraits::getPath() const { return details::get_name([this](char* buffer, size_t length) { - return H5Iget_name(static_cast(this)->getId(), buffer, length); + return H5Iget_name(static_cast(*this).getId(), buffer, length); }); } diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5PropertyList_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5PropertyList_misc.hpp index 976b9f51e4..cef301e53a 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5PropertyList_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5PropertyList_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5PROPERTY_LIST_MISC_HPP -#define H5PROPERTY_LIST_MISC_HPP +#pragma once #include @@ -71,7 +70,7 @@ inline void PropertyList::_initializeIfNeeded() { } template -template +template inline void PropertyList::add(const P& property) { _initializeIfNeeded(); property.apply(_hid); @@ -86,7 +85,6 @@ inline void RawPropertyList::add(const F& funct, const Args&... args) { } } - // Specific options to be added to Property Lists #if H5_VERSION_GE(1, 10, 1) inline FileSpaceStrategy::FileSpaceStrategy(H5F_fspace_strategy_t strategy, @@ -96,12 +94,30 @@ inline FileSpaceStrategy::FileSpaceStrategy(H5F_fspace_strategy_t strategy, , _persist(persist) , _threshold(threshold) {} +inline FileSpaceStrategy::FileSpaceStrategy(const FileCreateProps& fcpl) { + if (H5Pget_file_space_strategy(fcpl.getId(), &_strategy, &_persist, &_threshold) < 0) { + HDF5ErrMapper::ToException("Unable to get file space strategy"); + } +} + inline void FileSpaceStrategy::apply(const hid_t list) const { if (H5Pset_file_space_strategy(list, _strategy, _persist, _threshold) < 0) { HDF5ErrMapper::ToException("Error setting file space strategy."); } } +inline H5F_fspace_strategy_t FileSpaceStrategy::getStrategy() const { + return _strategy; +} + +inline hbool_t FileSpaceStrategy::getPersist() const { + return _persist; +} + +inline hsize_t FileSpaceStrategy::getThreshold() const { + return _threshold; +} + inline FileSpacePageSize::FileSpacePageSize(hsize_t page_size) : _page_size(page_size) {} @@ -111,6 +127,16 @@ inline void FileSpacePageSize::apply(const hid_t list) const { } } +inline FileSpacePageSize::FileSpacePageSize(const FileCreateProps& fcpl) { + if (H5Pget_file_space_page_size(fcpl.getId(), &_page_size) < 0) { + HDF5ErrMapper::ToException("Unable to get file space page size"); + } +} + +inline hsize_t FileSpacePageSize::getPageSize() const { + return _page_size; +} + #ifndef H5_HAVE_PARALLEL inline PageBufferSize::PageBufferSize(size_t page_buffer_size, unsigned min_meta_percent, @@ -119,38 +145,148 @@ inline PageBufferSize::PageBufferSize(size_t page_buffer_size, , _min_meta(min_meta_percent) , _min_raw(min_raw_percent) {} +inline PageBufferSize::PageBufferSize(const FileAccessProps& plist) { + if (H5Pget_page_buffer_size(plist.getId(), &_page_buffer_size, &_min_meta, &_min_raw) < 0) { + HDF5ErrMapper::ToException("Error setting page buffer size."); + } +} + inline void PageBufferSize::apply(const hid_t list) const { if (H5Pset_page_buffer_size(list, _page_buffer_size, _min_meta, _min_raw) < 0) { HDF5ErrMapper::ToException("Error setting page buffer size."); } } + +inline size_t PageBufferSize::getPageBufferSize() const { + return _page_buffer_size; +} + +inline unsigned PageBufferSize::getMinMetaPercent() const { + return _min_meta; +} + +inline unsigned PageBufferSize::getMinRawPercent() const { + return _min_raw; +} #endif #endif #ifdef H5_HAVE_PARALLEL +inline MPIOFileAccess::MPIOFileAccess(MPI_Comm comm, MPI_Info info) + : _comm(comm) + , _info(info) {} + +inline void MPIOFileAccess::apply(const hid_t list) const { + if (H5Pset_fapl_mpio(list, _comm, _info) < 0) { + HDF5ErrMapper::ToException("Unable to set-up MPIO Driver configuration"); + } +} + inline void MPIOCollectiveMetadata::apply(const hid_t plist) const { - auto read = MPIOCollectiveMetadataRead{collective_}; - auto write = MPIOCollectiveMetadataWrite{collective_}; + auto read = MPIOCollectiveMetadataRead{collective_read_}; + auto write = MPIOCollectiveMetadataWrite{collective_write_}; read.apply(plist); write.apply(plist); } +inline MPIOCollectiveMetadata::MPIOCollectiveMetadata(bool collective) + : collective_read_(collective) + , collective_write_(collective) {} + + +inline MPIOCollectiveMetadata::MPIOCollectiveMetadata(const FileAccessProps& plist) + : collective_read_(MPIOCollectiveMetadataRead(plist).isCollective()) + , collective_write_(MPIOCollectiveMetadataWrite(plist).isCollective()) {} + +inline bool MPIOCollectiveMetadata::isCollectiveRead() const { + return collective_read_; +} + +inline bool MPIOCollectiveMetadata::isCollectiveWrite() const { + return collective_write_; +} + + inline void MPIOCollectiveMetadataRead::apply(const hid_t plist) const { if (H5Pset_all_coll_metadata_ops(plist, collective_) < 0) { HDF5ErrMapper::ToException("Unable to request collective metadata reads"); } } +inline bool MPIOCollectiveMetadataRead::isCollective() const { + return collective_; +} + +inline MPIOCollectiveMetadataRead::MPIOCollectiveMetadataRead(const FileAccessProps& plist) { + if (H5Pget_all_coll_metadata_ops(plist.getId(), &collective_) < 0) { + HDF5ErrMapper::ToException("Error loading MPI metadata read."); + } +} + +inline MPIOCollectiveMetadataRead::MPIOCollectiveMetadataRead(bool collective) + : collective_(collective) {} + inline void MPIOCollectiveMetadataWrite::apply(const hid_t plist) const { if (H5Pset_coll_metadata_write(plist, collective_) < 0) { HDF5ErrMapper::ToException("Unable to request collective metadata writes"); } } +inline bool MPIOCollectiveMetadataWrite::isCollective() const { + return collective_; +} + +inline MPIOCollectiveMetadataWrite::MPIOCollectiveMetadataWrite(const FileAccessProps& plist) { + if (H5Pget_coll_metadata_write(plist.getId(), &collective_) < 0) { + HDF5ErrMapper::ToException("Error loading MPI metadata write."); + } +} + +inline MPIOCollectiveMetadataWrite::MPIOCollectiveMetadataWrite(bool collective) + : collective_(collective) {} + #endif +inline FileVersionBounds::FileVersionBounds(H5F_libver_t low, H5F_libver_t high) + : _low(low) + , _high(high) {} + +inline FileVersionBounds::FileVersionBounds(const FileAccessProps& fapl) { + if (H5Pget_libver_bounds(fapl.getId(), &_low, &_high) < 0) { + HDF5ErrMapper::ToException("Unable to access file version bounds"); + } +} + +inline std::pair FileVersionBounds::getVersion() const { + return std::make_pair(_low, _high); +} + +inline void FileVersionBounds::apply(const hid_t list) const { + if (H5Pset_libver_bounds(list, _low, _high) < 0) { + HDF5ErrMapper::ToException("Error setting file version bounds"); + } +} + +inline MetadataBlockSize::MetadataBlockSize(hsize_t size) + : _size(size) {} + +inline MetadataBlockSize::MetadataBlockSize(const FileAccessProps& fapl) { + if (H5Pget_meta_block_size(fapl.getId(), &_size) < 0) { + HDF5ErrMapper::ToException("Unable to access file metadata block size"); + } +} + +inline void MetadataBlockSize::apply(const hid_t list) const { + if (H5Pset_meta_block_size(list, _size) < 0) { + HDF5ErrMapper::ToException("Error setting metadata block size"); + } +} + +inline hsize_t MetadataBlockSize::getSize() const { + return _size; +} inline void EstimatedLinkInfo::apply(const hid_t hid) const { if (H5Pset_est_link_info(hid, _entries, _length) < 0) { @@ -158,18 +294,67 @@ inline void EstimatedLinkInfo::apply(const hid_t hid) const { } } +inline EstimatedLinkInfo::EstimatedLinkInfo(unsigned entries, unsigned length) + : _entries(entries) + , _length(length) {} + +inline EstimatedLinkInfo::EstimatedLinkInfo(const GroupCreateProps& gcpl) { + if (H5Pget_est_link_info(gcpl.getId(), &_entries, &_length) < 0) { + HDF5ErrMapper::ToException("Unable to access group link size property"); + } +} + +inline unsigned EstimatedLinkInfo::getEntries() const { + return _entries; +} + +inline unsigned EstimatedLinkInfo::getNameLength() const { + return _length; +} + inline void Chunking::apply(const hid_t hid) const { if (H5Pset_chunk(hid, static_cast(_dims.size()), _dims.data()) < 0) { HDF5ErrMapper::ToException("Error setting chunk property"); } } +inline Chunking::Chunking(const std::vector& dims) + : _dims(dims) {} + +inline Chunking::Chunking(const std::initializer_list& items) + : Chunking(std::vector{items}) {} + +inline Chunking::Chunking(DataSetCreateProps& plist, size_t max_dims) + : _dims(max_dims + 1) { + auto n_loaded = H5Pget_chunk(plist.getId(), static_cast(_dims.size()), _dims.data()); + if (n_loaded < 0) { + HDF5ErrMapper::ToException("Error getting chunk size"); + } + + if (n_loaded >= static_cast(_dims.size())) { + *this = Chunking(plist, 8 * max_dims); + } else { + _dims.resize(static_cast(n_loaded)); + } +} + +inline const std::vector& Chunking::getDimensions() const noexcept { + return _dims; +} + +template +inline Chunking::Chunking(hsize_t item, Args... args) + : Chunking(std::vector{item, static_cast(args)...}) {} + inline void Deflate::apply(const hid_t hid) const { if (!H5Zfilter_avail(H5Z_FILTER_DEFLATE) || H5Pset_deflate(hid, _level) < 0) { HDF5ErrMapper::ToException("Error setting deflate property"); } } +inline Deflate::Deflate(unsigned int level) + : _level(level) {} + inline void Szip::apply(const hid_t hid) const { if (!H5Zfilter_avail(H5Z_FILTER_SZIP)) { HDF5ErrMapper::ToException("Error setting szip property"); @@ -180,6 +365,18 @@ inline void Szip::apply(const hid_t hid) const { } } +inline Szip::Szip(unsigned int options_mask, unsigned int pixels_per_block) + : _options_mask(options_mask) + , _pixels_per_block(pixels_per_block) {} + +inline unsigned Szip::getOptionsMask() const { + return _options_mask; +} + +inline unsigned Szip::getPixelsPerBlock() const { + return _pixels_per_block; +} + inline void Shuffle::apply(const hid_t hid) const { if (!H5Zfilter_avail(H5Z_FILTER_SHUFFLE)) { HDF5ErrMapper::ToException("Error setting shuffle property"); @@ -190,18 +387,62 @@ inline void Shuffle::apply(const hid_t hid) const { } } +inline AllocationTime::AllocationTime(H5D_alloc_time_t alloc_time) + : _alloc_time(alloc_time) {} + +inline AllocationTime::AllocationTime(const DataSetCreateProps& dcpl) { + if (H5Pget_alloc_time(dcpl.getId(), &_alloc_time) < 0) { + HDF5ErrMapper::ToException("Error getting allocation time"); + } +} + inline void AllocationTime::apply(hid_t dcpl) const { if (H5Pset_alloc_time(dcpl, _alloc_time) < 0) { HDF5ErrMapper::ToException("Error setting allocation time"); } } +inline H5D_alloc_time_t AllocationTime::getAllocationTime() { + return _alloc_time; +} + +inline Caching::Caching(const DataSetCreateProps& dcpl) { + if (H5Pget_chunk_cache(dcpl.getId(), &_numSlots, &_cacheSize, &_w0) < 0) { + HDF5ErrMapper::ToException("Error getting dataset cache parameters"); + } +} + inline void Caching::apply(const hid_t hid) const { if (H5Pset_chunk_cache(hid, _numSlots, _cacheSize, _w0) < 0) { HDF5ErrMapper::ToException("Error setting dataset cache parameters"); } } +inline Caching::Caching(const size_t numSlots, const size_t cacheSize, const double w0) + : _numSlots(numSlots) + , _cacheSize(cacheSize) + , _w0(w0) {} + +inline size_t Caching::getNumSlots() const { + return _numSlots; +} + +inline size_t Caching::getCacheSize() const { + return _cacheSize; +} + +inline double Caching::getW0() const { + return _w0; +} + +inline CreateIntermediateGroup::CreateIntermediateGroup(bool create) + : _create(create) {} + +inline CreateIntermediateGroup::CreateIntermediateGroup(const ObjectCreateProps& ocpl) { + fromPropertyList(ocpl.getId()); +} + + inline void CreateIntermediateGroup::apply(const hid_t hid) const { if (H5Pset_create_intermediate_group(hid, _create ? 1 : 0) < 0) { HDF5ErrMapper::ToException( @@ -209,14 +450,125 @@ inline void CreateIntermediateGroup::apply(const hid_t hid) const { } } +inline CreateIntermediateGroup::CreateIntermediateGroup(const LinkCreateProps& lcpl) { + fromPropertyList(lcpl.getId()); +} + +inline void CreateIntermediateGroup::fromPropertyList(hid_t hid) { + unsigned c_bool = 0; + if (H5Pget_create_intermediate_group(hid, &c_bool) < 0) { + HDF5ErrMapper::ToException( + "Error getting property for create intermediate groups"); + } + + _create = bool(c_bool); +} + +inline bool CreateIntermediateGroup::isSet() const { + return _create; +} + #ifdef H5_HAVE_PARALLEL +inline UseCollectiveIO::UseCollectiveIO(bool enable) + : _enable(enable) {} + inline void UseCollectiveIO::apply(const hid_t hid) const { if (H5Pset_dxpl_mpio(hid, _enable ? H5FD_MPIO_COLLECTIVE : H5FD_MPIO_INDEPENDENT) < 0) { HDF5ErrMapper::ToException("Error setting H5Pset_dxpl_mpio."); } } + +inline UseCollectiveIO::UseCollectiveIO(const DataTransferProps& dxpl) { + H5FD_mpio_xfer_t collective; + + if (H5Pget_dxpl_mpio(dxpl.getId(), &collective) < 0) { + HDF5ErrMapper::ToException("Error getting H5Pset_dxpl_mpio."); + } + + if (collective != H5FD_MPIO_COLLECTIVE && collective != H5FD_MPIO_INDEPENDENT) { + throw std::logic_error("H5Pget_dxpl_mpio returned something strange."); + } + + _enable = collective == H5FD_MPIO_COLLECTIVE; +} + +inline bool UseCollectiveIO::isCollective() const { + return _enable; +} + +inline MpioNoCollectiveCause::MpioNoCollectiveCause(const DataTransferProps& dxpl) { + if (H5Pget_mpio_no_collective_cause(dxpl.getId(), &_local_cause, &_global_cause) < 0) { + HDF5ErrMapper::ToException("Failed to check mpio_no_collective_cause."); + } +} + +inline bool MpioNoCollectiveCause::wasCollective() const { + return _local_cause == 0 && _global_cause == 0; +} + +inline uint32_t MpioNoCollectiveCause::getLocalCause() const { + return _local_cause; +} + +inline uint32_t MpioNoCollectiveCause::getGlobalCause() const { + return _global_cause; +} + +inline std::pair MpioNoCollectiveCause::getCause() const { + return {_local_cause, _global_cause}; +} #endif -} // namespace HighFive +inline LinkCreationOrder::LinkCreationOrder(const FileCreateProps& fcpl) { + fromPropertyList(fcpl.getId()); +} + +inline LinkCreationOrder::LinkCreationOrder(const GroupCreateProps& gcpl) { + fromPropertyList(gcpl.getId()); +} + +inline unsigned LinkCreationOrder::getFlags() const { + return _flags; +} + +inline void LinkCreationOrder::apply(const hid_t hid) const { + if (H5Pset_link_creation_order(hid, _flags) < 0) { + HDF5ErrMapper::ToException("Error setting LinkCreationOrder."); + } +} + +inline void LinkCreationOrder::fromPropertyList(hid_t hid) { + if (H5Pget_link_creation_order(hid, &_flags) < 0) { + HDF5ErrMapper::ToException( + "Error getting property for link creation order"); + } +} + +inline AttributePhaseChange::AttributePhaseChange(unsigned max_compact, unsigned min_dense) + : _max_compact(max_compact) + , _min_dense(min_dense) {} + +inline AttributePhaseChange::AttributePhaseChange(const GroupCreateProps& gcpl) { + if (H5Pget_attr_phase_change(gcpl.getId(), &_max_compact, &_min_dense) < 0) { + HDF5ErrMapper::ToException( + "Error getting property for attribute phase change"); + } +} -#endif // H5PROPERTY_LIST_HPP +inline unsigned AttributePhaseChange::max_compact() const { + return _max_compact; +} + +inline unsigned AttributePhaseChange::min_dense() const { + return _min_dense; +} + +inline void AttributePhaseChange::apply(hid_t hid) const { + if (H5Pset_attr_phase_change(hid, _max_compact, _min_dense) < 0) { + HDF5ErrMapper::ToException( + "Error getting property for attribute phase change"); + } +} + + +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5ReadWrite_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5ReadWrite_misc.hpp index bd31f2b53b..c8e7361740 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5ReadWrite_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5ReadWrite_misc.hpp @@ -8,7 +8,7 @@ */ #pragma once -#include "H5Tpublic.h" +#include #include "H5Utils.hpp" namespace HighFive { @@ -19,9 +19,13 @@ template using unqualified_t = typename std::remove_const::type>::type; // Find the type of an eventual char array, otherwise void -template +template struct type_char_array { - using type = void; + using type = typename std::conditional< + std::is_same::base_type, std::string>::value, + std::string, + void>::type; + static constexpr bool is_char_array = false; }; template @@ -29,6 +33,7 @@ struct type_char_array { using type = typename std::conditional, char>::value, char*, typename type_char_array::type>::type; + static constexpr bool is_char_array = true; }; template @@ -36,6 +41,7 @@ struct type_char_array { using type = typename std::conditional, char>::value, char[N], typename type_char_array::type>::type; + static constexpr bool is_char_array = true; }; template @@ -43,7 +49,7 @@ struct BufferInfo { using type_no_const = typename std::remove_const::type; using elem_type = typename details::inspector::base_type; using char_array_t = typename details::type_char_array::type; - static constexpr bool is_char_array = !std::is_same::value; + static constexpr bool is_char_array = details::type_char_array::is_char_array; enum Operation { read, write }; const Operation op; @@ -63,29 +69,44 @@ struct string_type_checker { static DataType getDataType(const DataType&, const DataType&); }; +inline void enforce_ascii_hack(const DataType& dst, const DataType& src) { + // Note: constness only refers to constness of the DataType object, which + // is just an ID, we can/will change properties of `dst`. + + // TEMP. CHANGE: Ensure that the character set is properly configured to prevent + // converter issues on HDF5 <=v1.12.0 when loading ASCII strings first. + // See https://github.com/HDFGroup/hdf5/issues/544 for further information. + if (H5Tget_cset(src.getId()) == H5T_CSET_ASCII) { + H5Tset_cset(dst.getId(), H5T_CSET_ASCII); + } +} + template <> struct string_type_checker { inline static DataType getDataType(const DataType& element_type, const DataType& dtype) { - // TEMP. CHANGE: Ensure that the character set is properly configured to prevent - // converter issues on HDF5 <=v1.12.0 when loading ASCII strings first. - // See https://github.com/HDFGroup/hdf5/issues/544 for further information. - if (H5Tget_class(element_type.getId()) == H5T_STRING && - H5Tget_cset(dtype.getId()) == H5T_CSET_ASCII) { - H5Tset_cset(element_type.getId(), H5T_CSET_ASCII); + if (H5Tget_class(element_type.getId()) == H5T_STRING) { + enforce_ascii_hack(element_type, dtype); } return element_type; } }; +template <> +struct string_type_checker { + inline static DataType getDataType(const DataType&, const DataType& file_datatype) { + // The StringBuffer ensures that the data is transformed such that it + // matches the datatype of the dataset, i.e. `file_datatype` and + // `mem_datatype` are the same. + return file_datatype; + } +}; + template struct string_type_checker { inline static DataType getDataType(const DataType& element_type, const DataType& dtype) { DataType return_type = (dtype.isFixedLenStr()) ? AtomicType() : element_type; - // TEMP. CHANGE: See string_type_checker definition - if (H5Tget_cset(dtype.getId()) == H5T_CSET_ASCII) { - H5Tset_cset(return_type.getId(), H5T_CSET_ASCII); - } + enforce_ascii_hack(return_type, dtype); return return_type; } }; @@ -93,13 +114,11 @@ struct string_type_checker { template <> struct string_type_checker { inline static DataType getDataType(const DataType&, const DataType& dtype) { - if (dtype.isFixedLenStr()) + if (dtype.isFixedLenStr()) { throw DataSetException("Can't output variable-length to fixed-length strings"); - // TEMP. CHANGE: See string_type_checker definition - DataType return_type = AtomicType(); - if (H5Tget_cset(dtype.getId()) == H5T_CSET_ASCII) { - H5Tset_cset(return_type.getId(), H5T_CSET_ASCII); } + DataType return_type = AtomicType(); + enforce_ascii_hack(return_type, dtype); return return_type; } }; @@ -114,26 +133,21 @@ BufferInfo::BufferInfo(const DataType& dtype, F getName, Operation _op) ((is_fixed_len_string && is_char_array) ? 1 : 0)) , data_type( string_type_checker::getDataType(create_datatype(), dtype)) { - if (is_fixed_len_string && std::is_same::value) { - throw DataSetException( - "Can't output std::string as fixed-length. " - "Use raw arrays or FixedLenStringArray"); - } // We warn. In case they are really not convertible an exception will rise on read/write if (dtype.getClass() != data_type.getClass()) { - std::cerr << "HighFive WARNING \"" << getName() - << "\": data and hdf5 dataset have different types: " << data_type.string() - << " -> " << dtype.string() << std::endl; + HIGHFIVE_LOG_WARN(getName() + "\": data and hdf5 dataset have different types: " + + data_type.string() + " -> " + dtype.string()); } else if ((dtype.getClass() & data_type.getClass()) == DataTypeClass::Float) { - if ((op == read) && (dtype.getSize() > data_type.getSize())) { - std::clog << "HighFive WARNING \"" << getName() - << "\": hdf5 dataset has higher floating point precision than data on read: " - << dtype.string() << " -> " << data_type.string() << std::endl; - } else if ((op == write) && (dtype.getSize() < data_type.getSize())) { - std::clog << "HighFive WARNING \"" << getName() - << "\": data has higher floating point precision than hdf5 dataset on write: " - << data_type.string() << " -> " << dtype.string() << std::endl; - } + HIGHFIVE_LOG_WARN_IF( + (op == read) && (dtype.getSize() > data_type.getSize()), + getName() + "\": hdf5 dataset has higher floating point precision than data on read: " + + dtype.string() + " -> " + data_type.string()); + + HIGHFIVE_LOG_WARN_IF( + (op == write) && (dtype.getSize() < data_type.getSize()), + getName() + + "\": data has higher floating point precision than hdf5 dataset on write: " + + data_type.string() + " -> " + dtype.string()); } } diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Reference_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Reference_misc.hpp index fbcb5a8b65..7c8db36fb6 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Reference_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Reference_misc.hpp @@ -7,14 +7,15 @@ * */ -#ifndef H5REFERENCE_MISC_HPP -#define H5REFERENCE_MISC_HPP +#pragma once #include #include #include "H5Utils.hpp" +#include "../H5Object.hpp" + namespace HighFive { inline Reference::Reference(const Object& location, const Object& object) @@ -64,5 +65,3 @@ inline Object Reference::get_ref(const Object& location) const { } } // namespace HighFive - -#endif // H5REFERENCE_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Selection_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Selection_misc.hpp index 09c28f3283..c35b7bbf32 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Selection_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Selection_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5SELECTION_MISC_HPP -#define H5SELECTION_MISC_HPP +#pragma once namespace HighFive { @@ -39,6 +38,12 @@ inline const DataType Selection::getDataType() const { return _set.getDataType(); } -} // namespace HighFive +namespace detail { +inline Selection make_selection(const DataSpace& mem_space, + const DataSpace& file_space, + const DataSet& set) { + return Selection(mem_space, file_space, set); +} +} // namespace detail -#endif // H5SELECTION_MISC_HPP +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Slice_traits.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Slice_traits.hpp index 5bab4fa484..52c52713f0 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Slice_traits.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Slice_traits.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5SLICE_TRAITS_HPP -#define H5SLICE_TRAITS_HPP +#pragma once #include #include @@ -259,6 +258,15 @@ class SliceTraits { /// Therefore, the only memspaces supported for general hyperslabs are one-dimensional arrays. Selection select(const HyperSlab& hyperslab) const; + /// + /// \brief Select an \p hyperslab in the current Slice/Dataset. + /// + /// If the selection can be read into a simple, multi-dimensional dataspace, + /// then this overload enable specifying the shape of the memory dataspace + /// with `memspace`. Note, that simple implies no offsets, strides or + /// number of blocks, just the size of the block in each dimension. + Selection select(const HyperSlab& hyperslab, const DataSpace& memspace) const; + /// /// \brief Select a region in the current Slice/Dataset of \p count points at /// \p offset separated by \p stride. If strides are not provided they will @@ -306,11 +314,24 @@ class SliceTraits { /// allocated. /// \param array: A buffer containing enough space for the data /// \param dtype: The type of the data, in case it cannot be automatically guessed + /// \param xfer_props: Data Transfer properties template void read(T* array, - const DataType& dtype = DataType(), + const DataType& dtype, const DataTransferProps& xfer_props = DataTransferProps()) const; + /// + /// Read the entire dataset into a raw buffer + /// + /// Same as `read(T*, const DataType&, const DataTransferProps&)`. However, + /// this overload deduces the HDF5 datatype of the element of `array` from + /// `T`. Note, that the file datatype is already fixed. + /// + /// \param array: A buffer containing enough space for the data + /// \param xfer_props: Data Transfer properties + template + void read(T* array, const DataTransferProps& xfer_props = DataTransferProps()) const; + /// /// Write the integrality N-dimension buffer to this dataset /// An exception is raised is if the numbers of dimension of the buffer and @@ -322,24 +343,33 @@ class SliceTraits { void write(const T& buffer, const DataTransferProps& xfer_props = DataTransferProps()); /// - /// Write from a raw buffer into this dataset + /// Write from a raw pointer into this dataset. /// /// No dimensionality checks will be performed, it is the user's /// responsibility to ensure that the buffer holds the right amount of /// elements. For n-dimensional matrices the buffer layout follows H5 /// default conventions. + /// + /// Note, this is the shallowest wrapper around `H5Dwrite` and should + /// be used if full control is needed. Generally prefer `write`. + /// /// \param buffer: A buffer containing the data to be written - /// \param dtype: The type of the data, in case it cannot be automatically guessed + /// \param dtype: The datatype of `buffer`, i.e. the memory data type. /// \param xfer_props: The HDF5 data transfer properties, e.g. collective MPI-IO. template void write_raw(const T* buffer, - const DataType& dtype = DataType(), + const DataType& mem_datatype, const DataTransferProps& xfer_props = DataTransferProps()); - protected: - inline Selection select_impl(const HyperSlab& hyperslab, const DataSpace& memspace) const; + /// + /// Write from a raw pointer into this dataset. + /// + /// Same as `write_raw(const T*, const DataTransferProps&)`. However, this + /// overload attempts to guess the data type of `buffer`, i.e. the memory + /// datatype. Note that the file datatype is already fixed. + /// + template + void write_raw(const T* buffer, const DataTransferProps& xfer_props = DataTransferProps()); }; } // namespace HighFive - -#endif // H5SLICE_TRAITS_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Slice_traits_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Slice_traits_misc.hpp index 64a02236d6..7b07c9abf9 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Slice_traits_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Slice_traits_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5SLICE_TRAITS_MISC_HPP -#define H5SLICE_TRAITS_MISC_HPP +#pragma once #include #include @@ -65,8 +64,8 @@ inline ElementSet::ElementSet(const std::vector>& eleme } template -inline Selection SliceTraits::select_impl(const HyperSlab& hyperslab, - const DataSpace& memspace) const { +inline Selection SliceTraits::select(const HyperSlab& hyperslab, + const DataSpace& memspace) const { // Note: The current limitation are that memspace must describe a // packed memspace. // @@ -76,7 +75,7 @@ inline Selection SliceTraits::select_impl(const HyperSlab& hyperslab, const auto& slice = static_cast(*this); auto filespace = hyperslab.apply(slice.getSpace()); - return Selection(memspace, filespace, details::get_dataset(slice)); + return detail::make_selection(memspace, filespace, details::get_dataset(slice)); } template @@ -88,7 +87,7 @@ inline Selection SliceTraits::select(const HyperSlab& hyper_slab) cons auto n_elements = H5Sget_select_npoints(filespace.getId()); auto memspace = DataSpace(std::array{size_t(n_elements)}); - return Selection(memspace, filespace, details::get_dataset(slice)); + return detail::make_selection(memspace, filespace, details::get_dataset(slice)); } @@ -99,7 +98,7 @@ inline Selection SliceTraits::select(const std::vector& offset const std::vector& block) const { auto slab = HyperSlab(RegularHyperSlab(offset, count, stride, block)); auto memspace = DataSpace(count); - return select_impl(slab, memspace); + return select(slab, memspace); } template @@ -122,7 +121,7 @@ inline Selection SliceTraits::select(const std::vector& column std::vector memdims = dims; memdims.back() = columns.size(); - return select_impl(slab, DataSpace(memdims)); + return select(slab, DataSpace(memdims)); } template @@ -154,7 +153,7 @@ inline Selection SliceTraits::select(const ElementSet& elements) const HDF5ErrMapper::ToException("Unable to select elements"); } - return Selection(DataSpace(num_elements), space, details::get_dataset(slice)); + return detail::make_selection(DataSpace(num_elements), space, details::get_dataset(slice)); } @@ -172,9 +171,12 @@ template inline void SliceTraits::read(T& array, const DataTransferProps& xfer_props) const { const auto& slice = static_cast(*this); const DataSpace& mem_space = slice.getMemSpace(); + + auto file_datatype = slice.getDataType(); + const details::BufferInfo buffer_info( - slice.getDataType(), - [slice]() -> std::string { return details::get_dataset(slice).getPath(); }, + file_datatype, + [&slice]() -> std::string { return details::get_dataset(slice).getPath(); }, details::BufferInfo::Operation::read); if (!details::checkDimensions(mem_space, buffer_info.n_dimensions)) { @@ -184,15 +186,30 @@ inline void SliceTraits::read(T& array, const DataTransferProps& xfer_ throw DataSpaceException(ss.str()); } auto dims = mem_space.getDimensions(); - auto r = details::data_converter::get_reader(dims, array); - read(r.get_pointer(), buffer_info.data_type, xfer_props); + + if (mem_space.getElementCount() == 0) { + auto effective_dims = details::squeezeDimensions(dims, + details::inspector::recursive_ndim); + + details::inspector::prepare(array, effective_dims); + return; + } + + auto r = details::data_converter::get_reader(dims, array, file_datatype); + read(r.getPointer(), buffer_info.data_type, xfer_props); // re-arrange results - r.unserialize(); - auto t = create_datatype::base_type>(); + r.unserialize(array); + + auto t = buffer_info.data_type; auto c = t.getClass(); - if (c == DataTypeClass::VarLen) { - //(void) H5Dvlen_reclaim(t.getId(), mem_space.getId(), xfer_props.getId(), r.get_pointer()); - throw std::logic_error("H5Dvlen_reclaim() is deprecated."); + if (c == DataTypeClass::VarLen || t.isVariableStr()) { +#if H5_VERSION_GE(1, 12, 0) + // This one have been created in 1.12.0 + (void) H5Treclaim(t.getId(), mem_space.getId(), xfer_props.getId(), r.getPointer()); +#else + // This one is deprecated since 1.12.0 + (void) H5Dvlen_reclaim(t.getId(), mem_space.getId(), xfer_props.getId(), r.getPointer()); +#endif } } @@ -200,16 +217,12 @@ inline void SliceTraits::read(T& array, const DataTransferProps& xfer_ template template inline void SliceTraits::read(T* array, - const DataType& dtype, + const DataType& mem_datatype, const DataTransferProps& xfer_props) const { static_assert(!std::is_const::value, "read() requires a non-const structure to read data into"); - const auto& slice = static_cast(*this); - using element_type = typename details::inspector::base_type; - // Auto-detect mem datatype if not provided - const DataType& mem_datatype = dtype.empty() ? create_and_check_datatype() - : dtype; + const auto& slice = static_cast(*this); if (H5Dread(details::get_dataset(slice).getId(), mem_datatype.getId(), @@ -221,36 +234,51 @@ inline void SliceTraits::read(T* array, } } +template +template +inline void SliceTraits::read(T* array, const DataTransferProps& xfer_props) const { + using element_type = typename details::inspector::base_type; + const DataType& mem_datatype = create_and_check_datatype(); + + read(array, mem_datatype, xfer_props); +} + template template inline void SliceTraits::write(const T& buffer, const DataTransferProps& xfer_props) { const auto& slice = static_cast(*this); const DataSpace& mem_space = slice.getMemSpace(); + + if (mem_space.getElementCount() == 0) { + return; + } + + auto file_datatype = slice.getDataType(); + const details::BufferInfo buffer_info( - slice.getDataType(), - [slice]() -> std::string { return details::get_dataset(slice).getPath(); }, + file_datatype, + [&slice]() -> std::string { return details::get_dataset(slice).getPath(); }, details::BufferInfo::Operation::write); if (!details::checkDimensions(mem_space, buffer_info.n_dimensions)) { std::ostringstream ss; - ss << "Impossible to write buffer of dimensions " << buffer_info.n_dimensions - << " into dataset of dimensions " << mem_space.getNumberDimensions(); + ss << "Impossible to write buffer of dimensions " + << details::format_vector(mem_space.getDimensions()) + << " into dataset with n = " << buffer_info.n_dimensions << " dimensions."; throw DataSpaceException(ss.str()); } - auto w = details::data_converter::serialize(buffer); - write_raw(w.get_pointer(), buffer_info.data_type, xfer_props); + auto w = details::data_converter::serialize(buffer, file_datatype); + write_raw(w.getPointer(), buffer_info.data_type, xfer_props); } template template inline void SliceTraits::write_raw(const T* buffer, - const DataType& dtype, + const DataType& mem_datatype, const DataTransferProps& xfer_props) { - using element_type = typename details::inspector::base_type; const auto& slice = static_cast(*this); - const auto& mem_datatype = dtype.empty() ? create_and_check_datatype() : dtype; if (H5Dwrite(details::get_dataset(slice).getId(), mem_datatype.getId(), @@ -262,7 +290,14 @@ inline void SliceTraits::write_raw(const T* buffer, } } +template +template +inline void SliceTraits::write_raw(const T* buffer, const DataTransferProps& xfer_props) { + using element_type = typename details::inspector::base_type; + const auto& mem_datatype = create_and_check_datatype(); + + write_raw(buffer, mem_datatype, xfer_props); +} -} // namespace HighFive -#endif // H5SLICE_TRAITS_MISC_HPP +} // namespace HighFive diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Utils.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Utils.hpp index 1b00624d38..2d9d24f887 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Utils.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5Utils.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5UTILS_HPP -#define H5UTILS_HPP +#pragma once // internal utilities functions #include @@ -17,10 +16,12 @@ #include #include #include +#include #include #include "../H5Exception.hpp" +#include "H5Friends.hpp" namespace HighFive { @@ -64,7 +65,18 @@ inline std::string get_name(T fct) { return std::string(bigBuffer.data(), length); } +template +inline std::string format_vector(const Container& container) { + auto sout = std::stringstream{}; + + sout << "[ "; + for (size_t i = 0; i < container.size(); ++i) { + sout << container[i] << (i == container.size() - 1 ? "" : ", "); + } + sout << "]"; + + return sout.str(); +} + } // namespace details } // namespace HighFive - -#endif // H5UTILS_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5_definitions.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5_definitions.hpp index be91157ed2..746723c883 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5_definitions.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/H5_definitions.hpp @@ -6,7 +6,7 @@ #define H5_DEPRECATED(msg) __declspec(deprecated(#msg)) #else #pragma message("WARNING: Compiler doesnt support deprecation") -#define H5_DEPRECATED +#define H5_DEPRECATED(msg) #endif diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/string_padding.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/string_padding.hpp new file mode 100644 index 0000000000..e6e6908ddc --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/bits/string_padding.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include + +namespace HighFive { + +enum class StringPadding : std::underlying_type::type { + NullTerminated = H5T_STR_NULLTERM, + NullPadded = H5T_STR_NULLPAD, + SpacePadded = H5T_STR_SPACEPAD +}; + + +} diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_Eigen.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_Eigen.hpp index 787cbc5f2b..5b5d3b9a5f 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_Eigen.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_Eigen.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_EIGEN_HPP -#define H5EASY_BITS_EIGEN_HPP +#pragma once #include "../H5Easy.hpp" #include "H5Easy_misc.hpp" @@ -144,4 +143,3 @@ struct io_impl, T } // namespace H5Easy #endif // H5_USE_EIGEN -#endif // H5EASY_BITS_EIGEN_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_misc.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_misc.hpp index 1016bbc7e5..69798b2a4e 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_misc.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_misc.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_MISC_HPP -#define H5EASY_BITS_MISC_HPP +#pragma once #include "../H5Easy.hpp" @@ -152,5 +151,3 @@ inline Attribute initScalarAttribute(File& file, } // namespace detail } // namespace H5Easy - -#endif // H5EASY_BITS_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_opencv.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_opencv.hpp index b0fbf1af7d..b640cd8543 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_opencv.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_opencv.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_OPENCV_HPP -#define H5EASY_BITS_OPENCV_HPP +#pragma once #include "../H5Easy.hpp" #include "H5Easy_misc.hpp" @@ -99,4 +98,3 @@ struct io_impl::value>::type> { } // namespace H5Easy #endif // H5_USE_OPENCV -#endif // H5EASY_BITS_OPENCV_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_public.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_public.hpp index e61f41cd68..2cc55d0f0f 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_public.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_public.hpp @@ -6,10 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_PUBLIC_HPP -#define H5EASY_BITS_PUBLIC_HPP - -#include +#pragma once #include "../H5Easy.hpp" @@ -32,11 +29,11 @@ inline unsigned Compression::get() const { } inline void DumpOptions::set(DumpMode mode) { - m_overwrite = mode == DumpMode::Overwrite; + m_overwrite = static_cast(mode); } inline void DumpOptions::set(Flush mode) { - m_flush = mode == Flush::True; + m_flush = static_cast(mode); } inline void DumpOptions::set(const Compression& level) { @@ -44,9 +41,9 @@ inline void DumpOptions::set(const Compression& level) { } template -inline void DumpOptions::set(T arg, Args&&... args) { +inline void DumpOptions::set(T arg, Args... args) { set(arg); - set(std::forward(args)...); + set(args...); } template @@ -171,5 +168,3 @@ inline T loadAttribute(const File& file, const std::string& path, const std::str } } // namespace H5Easy - -#endif // H5EASY_BITS_MISC_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_scalar.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_scalar.hpp index f99e408a60..056d8f2dc5 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_scalar.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_scalar.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_SCALAR_HPP -#define H5EASY_BITS_SCALAR_HPP +#pragma once #include "../H5Easy.hpp" #include "H5Easy_misc.hpp" @@ -131,5 +130,3 @@ struct io_impl { } // namespace detail } // namespace H5Easy - -#endif // H5EASY_BITS_SCALAR_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_vector.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_vector.hpp index d5e252ebeb..4c60f5cfc6 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_vector.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_vector.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_VECTOR_HPP -#define H5EASY_BITS_VECTOR_HPP +#pragma once #include "../H5Easy.hpp" #include "H5Easy_misc.hpp" @@ -79,5 +78,3 @@ struct io_impl::value>::type> { } // namespace detail } // namespace H5Easy - -#endif // H5EASY_BITS_VECTOR_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_xtensor.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_xtensor.hpp index cccc4926d2..6b0238c4db 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_xtensor.hpp +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/h5easy_bits/H5Easy_xtensor.hpp @@ -6,8 +6,7 @@ * http://www.boost.org/LICENSE_1_0.txt) * */ -#ifndef H5EASY_BITS_XTENSOR_HPP -#define H5EASY_BITS_XTENSOR_HPP +#pragma once #include "../H5Easy.hpp" #include "H5Easy_misc.hpp" @@ -83,4 +82,3 @@ struct io_impl::value>::type> { } // namespace H5Easy #endif // H5_USE_XTENSOR -#endif // H5EASY_BITS_XTENSOR_HPP diff --git a/externals/coda-oss/modules/drivers/highfive/include/highfive/highfive.hpp b/externals/coda-oss/modules/drivers/highfive/include/highfive/highfive.hpp new file mode 100644 index 0000000000..f5e20cae91 --- /dev/null +++ b/externals/coda-oss/modules/drivers/highfive/include/highfive/highfive.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/externals/coda-oss/modules/drivers/highfive/include/import/highfive.h b/externals/coda-oss/modules/drivers/highfive/include/import/highfive.h index 464845d623..475015d11e 100644 --- a/externals/coda-oss/modules/drivers/highfive/include/import/highfive.h +++ b/externals/coda-oss/modules/drivers/highfive/include/import/highfive.h @@ -1,35 +1,40 @@ -/* ========================================================================= - * This file is part of coda-oss - * ========================================================================= - * - * (C) Copyright 2004 - 2014, MDA Information Systems LLC - * - * sys-c++ is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; If not, - * see . - * - */ - - -#ifndef CODA_OSS_import_highfive_h_INCLUDED_ -#define CODA_OSS_import_highfive_h_INCLUDED_ -#pragma once - -#ifdef H5_USE_BOOST -#undef H5_USE_BOOST -#endif - -#include "highfive/H5Easy.hpp" - -#endif // CODA_OSS_import_highfive_h_INCLUDED_ - +/* ========================================================================= + * This file is part of coda-oss + * ========================================================================= + * + * (C) Copyright 2004 - 2014, MDA Information Systems LLC + * + * sys-c++ is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, + * see . + * + */ + + +#pragma once +#ifndef CODA_OSS_import_highfive_h_INCLUDED_ +#define CODA_OSS_import_highfive_h_INCLUDED_ + +#ifdef H5_USE_BOOST +#undef H5_USE_BOOST +#endif + +#include "highfive/H5Easy.hpp" +#incldue "highfive/highfive.hpp" + +#if _MSC_VER +#pragma comment(lib, "shlwapi") // StrStrI() +#endif + +#endif // CODA_OSS_import_highfive_h_INCLUDED_ + diff --git a/externals/coda-oss/modules/drivers/highfive/unittests/tests_high_five.hpp b/externals/coda-oss/modules/drivers/highfive/unittests/tests_high_five.hpp index 79866b4638..0ebd58c448 100644 --- a/externals/coda-oss/modules/drivers/highfive/unittests/tests_high_five.hpp +++ b/externals/coda-oss/modules/drivers/highfive/unittests/tests_high_five.hpp @@ -12,6 +12,17 @@ #include #include #include +#include +#include +#include + +// We don't need windows specific functionality. However, to better detect defects caused by macros, +// we include this header. +// The list of identifiers is taken from `Boost::Predef`. +#if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || \ + defined(__WINDOWS__) +#include +#endif using ldcomplex = std::complex; using dcomplex = std::complex; @@ -35,8 +46,8 @@ using base_test_types = std::tuple using float16_t = half_float::half; -using numerical_test_types = decltype( - std::tuple_cat(std::declval(), std::tuple())); +using numerical_test_types = + decltype(std::tuple_cat(std::declval(), std::tuple())); #else using numerical_test_types = base_test_types; #endif @@ -154,16 +165,22 @@ struct ContentGenerate { template inline std::string typeNameHelper() { std::string name = typeid(T).name(); -#if defined(WIN32) - // Replace illegal windows file path characters std::replace(std::begin(name), std::end(name), ' ', '_'); std::replace(std::begin(name), std::end(name), '<', '_'); std::replace(std::begin(name), std::end(name), '>', '_'); std::replace(std::begin(name), std::end(name), ':', '_'); -#endif - return name; + + if (name.size() > 64) { + std::stringstream hash; + hash << std::hex << std::hash{}(name); + + return hash.str(); + } else { + return name; + } } + template inline HighFive::DataSet readWriteDataset(const DataT& ndvec, DataT& result, @@ -185,4 +202,4 @@ inline HighFive::DataSet readWriteDataset(const DataT& ndvec, dataset.read(result); return dataset; -} \ No newline at end of file +} diff --git a/externals/coda-oss/modules/drivers/highfive/unittests/tests_high_five_base.cpp b/externals/coda-oss/modules/drivers/highfive/unittests/tests_high_five_base.cpp index 49ccbe34be..8cbce80961 100644 --- a/externals/coda-oss/modules/drivers/highfive/unittests/tests_high_five_base.cpp +++ b/externals/coda-oss/modules/drivers/highfive/unittests/tests_high_five_base.cpp @@ -11,15 +11,18 @@ #include #include #include +#include #include #include #include #include #include -#include +#include #if _MSC_VER #pragma warning(disable : 4127) // conditional expression is constant + +#pragma comment(lib, "shlwapi") // StrStrI() #endif #include @@ -53,24 +56,28 @@ inline bool Equals_(const std::vector& lhs, const std::vector& rhs) #include "TestCase.h" -#define CHECK(x) TEST_ASSERT_TRUE(x) +#define CHECK(...) TEST_ASSERT_TRUE((__VA_ARGS__)) #define CHECK_THROWS_AS(f, e) TEST_SPECIFIC_EXCEPTION(f, e) +#define CHECK_THROWS(f) TEST_EXCEPTION(f) #define CHECK_NOTHROW(f) (f); TEST_SUCCESS #define REQUIRE(x) TEST_ASSERT_TRUE(x) #define CHECK_THAT(x, y) TEST_ASSERT(Equals_(x, y)) +#define INFO(...) { } +#define SECTION(name) +#include #include "tests_high_five.hpp" using namespace HighFive; TEST_CASE(Basic_HighFive_tests) { - const std::string FILE_NAME("h5tutr_dset.h5"); - const std::string DATASET_NAME("dset"); + const std::string file_name("h5tutr_dset.h5"); + const std::string dataset_name("dset"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); - CHECK(file.getName() == FILE_NAME); + CHECK(file.getName() == file_name); // Create the data space for the dataset. std::vector dims{4, 6}; @@ -78,27 +85,27 @@ TEST_CASE(Basic_HighFive_tests) { DataSpace dataspace(dims); // check if the dataset exist - CHECK(!file.exist(DATASET_NAME + "_double")); + CHECK(!file.exist(dataset_name + "_double")); // Create a dataset with double precision floating points DataSet dataset_double = - file.createDataSet(DATASET_NAME + "_double", dataspace, AtomicType()); + file.createDataSet(dataset_name + "_double", dataspace, AtomicType()); - CHECK(file.getObjectName(0) == DATASET_NAME + "_double"); + CHECK(file.getObjectName(0) == dataset_name + "_double"); { // check if it exist again - CHECK(file.exist(DATASET_NAME + "_double")); + CHECK(file.exist(dataset_name + "_double")); // and also try to recreate it to the sake of exception testing SilenceHDF5 silencer; - CHECK_THROWS_AS(file.createDataSet(DATASET_NAME + "_double", + CHECK_THROWS_AS(file.createDataSet(dataset_name + "_double", dataspace, AtomicType()), DataSetException); } - DataSet dataset_size_t = file.createDataSet(DATASET_NAME + "_size_t", dataspace); + DataSet dataset_size_t = file.createDataSet(dataset_name + "_size_t", dataspace); } TEST_CASE(Test_silent_HighFive) { @@ -123,61 +130,61 @@ TEST_CASE(Test_silent_HighFive) { } TEST_CASE(Test_open_modes_in_HighFive) { - const std::string FILE_NAME("openmodes.h5"); + const std::string file_name("openmodes.h5"); - std::remove(FILE_NAME.c_str()); + std::remove(file_name.c_str()); SilenceHDF5 silencer; // Attempt open file only ReadWrite should fail (wont create) - CHECK_THROWS_AS(File(FILE_NAME, File::ReadWrite), FileException); + CHECK_THROWS_AS(File(file_name, File::ReadWrite), FileException); // But with Create flag should be fine - { File file(FILE_NAME, File::ReadWrite | File::Create); } + { File file(file_name, File::ReadWrite | File::Create); } // But if its there and exclusive is given, should fail - CHECK_THROWS_AS(File(FILE_NAME, File::ReadWrite | File::Excl), FileException); + CHECK_THROWS_AS(File(file_name, File::ReadWrite | File::Excl), FileException); // ReadWrite and Excl flags are fine together (posix) - std::remove(FILE_NAME.c_str()); - { File file(FILE_NAME, File::ReadWrite | File::Excl); } + std::remove(file_name.c_str()); + { File file(file_name, File::ReadWrite | File::Excl); } // All three are fine as well (as long as the file does not exist) - std::remove(FILE_NAME.c_str()); - { File file(FILE_NAME, File::ReadWrite | File::Create | File::Excl); } + std::remove(file_name.c_str()); + { File file(file_name, File::ReadWrite | File::Create | File::Excl); } // Just a few combinations are incompatible, detected by hdf5lib - CHECK_THROWS_AS(File(FILE_NAME, File::Truncate | File::Excl), FileException); + CHECK_THROWS_AS(File(file_name, File::Truncate | File::Excl), FileException); - std::remove(FILE_NAME.c_str()); - CHECK_THROWS_AS(File(FILE_NAME, File::Truncate | File::Excl), FileException); + std::remove(file_name.c_str()); + CHECK_THROWS_AS(File(file_name, File::Truncate | File::Excl), FileException); // But in most cases we will truncate and that should always work - { File file(FILE_NAME, File::Truncate); } - std::remove(FILE_NAME.c_str()); - { File file(FILE_NAME, File::Truncate); } + { File file(file_name, File::Truncate); } + std::remove(file_name.c_str()); + { File file(file_name, File::Truncate); } // Last but not least, defaults should be ok - { File file(FILE_NAME); } // ReadOnly - { File file(FILE_NAME, 0); } // force empty-flags, does open without flags + { File file(file_name); } // ReadOnly + { File file(file_name, 0); } // force empty-flags, does open without flags } TEST_CASE(Test_file_version_bounds) { - const std::string FILE_NAME("h5_version_bounds.h5"); + const std::string file_name("h5_version_bounds.h5"); - std::remove(FILE_NAME.c_str()); + std::remove(file_name.c_str()); { - File file(FILE_NAME, File::Truncate); + File file(file_name, File::Truncate); auto bounds = file.getVersionBounds(); CHECK(bounds.first == H5F_LIBVER_EARLIEST); CHECK(bounds.second == H5F_LIBVER_LATEST); } - std::remove(FILE_NAME.c_str()); + std::remove(file_name.c_str()); { FileAccessProps fapl; fapl.add(FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)); - File file(FILE_NAME, File::Truncate, fapl); + File file(file_name, File::Truncate, fapl); auto bounds = file.getVersionBounds(); CHECK(bounds.first == H5F_LIBVER_LATEST); CHECK(bounds.second == H5F_LIBVER_LATEST); @@ -186,7 +193,7 @@ TEST_CASE(Test_file_version_bounds) { #if H5_VERSION_GE(1, 10, 1) TEST_CASE(Test_file_space_strategy) { - const std::string FILE_NAME("h5_file_space_strategy.h5"); + const std::string file_name("h5_file_space_strategy.h5"); auto strategies = std::vector{H5F_FSPACE_STRATEGY_FSM_AGGR, H5F_FSPACE_STRATEGY_AGGR, H5F_FSPACE_STRATEGY_PAGE, @@ -197,43 +204,46 @@ TEST_CASE(Test_file_space_strategy) { FileCreateProps create_props; create_props.add(FileSpaceStrategy(strategy, true, 0)); - File file(FILE_NAME, File::Truncate, create_props); + File file(file_name, File::Truncate, create_props); } { - File file(FILE_NAME, File::ReadOnly); + File file(file_name, File::ReadOnly); CHECK(file.getFileSpaceStrategy() == strategy); } } } TEST_CASE(Test_file_space_page_size) { - const std::string FILE_NAME("h5_file_space_page_size.h5"); + const std::string file_name("h5_file_space_page_size.h5"); hsize_t page_size = 1024; { FileCreateProps create_props; create_props.add(FileSpaceStrategy(H5F_FSPACE_STRATEGY_PAGE, true, 0)); create_props.add(FileSpacePageSize(page_size)); - File file(FILE_NAME, File::Truncate, create_props); + File file(file_name, File::Truncate, create_props); } { - File file(FILE_NAME, File::ReadOnly); + File file(file_name, File::ReadOnly); CHECK(file.getFileSpacePageSize() == page_size); } } #ifndef H5_HAVE_PARALLEL TEST_CASE(Test_page_buffer_size) { - const std::string FILE_NAME("h5_page_buffer_size.h5"); + const std::string file_name("h5_page_buffer_size.h5"); hsize_t page_size = 1024; { FileCreateProps create_props; create_props.add(FileSpaceStrategy(H5F_FSPACE_STRATEGY_PAGE, true, 0)); create_props.add(FileSpacePageSize(page_size)); - File file(FILE_NAME, File::Truncate, create_props); + FileAccessProps access_props; + access_props.add(FileVersionBounds(H5F_LIBVER_V110, H5F_LIBVER_V110)); + + File file(file_name, File::Truncate, create_props, access_props); file.createDataSet("x", std::vector{1.0, 2.0, 3.0}); } @@ -242,7 +252,7 @@ TEST_CASE(Test_page_buffer_size) { FileAccessProps access_props; access_props.add(PageBufferSize(1024)); - File file(FILE_NAME, File::ReadOnly, access_props); + File file(file_name, File::ReadOnly, access_props); auto accesses = std::array{0, 0}; auto hits = std::array{0, 0}; @@ -287,46 +297,46 @@ TEST_CASE(Test_page_buffer_size) { #endif TEST_CASE(Test_metadata_block_size_assignment) { - const std::string FILE_NAME("h5_meta_block_size.h5"); + const std::string file_name("h5_meta_block_size.h5"); - std::remove(FILE_NAME.c_str()); + std::remove(file_name.c_str()); { - File file(FILE_NAME, File::Truncate); + File file(file_name, File::Truncate); // Default for HDF5 CHECK(file.getMetadataBlockSize() == 2048); } - std::remove(FILE_NAME.c_str()); + std::remove(file_name.c_str()); { FileAccessProps fapl; fapl.add(MetadataBlockSize(10240)); - File file(FILE_NAME, File::Truncate, fapl); + File file(file_name, File::Truncate, fapl); CHECK(file.getMetadataBlockSize() == 10240); } } TEST_CASE(Test_group_properties) { - const std::string FILE_NAME("h5_group_properties.h5"); + const std::string file_name("h5_group_properties.h5"); FileAccessProps fapl; // When using hdf5 1.10.2 and later, the lower bound may be set to // H5F_LIBVER_V18 fapl.add(FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)); - File file(FILE_NAME, File::Truncate, fapl); + File file(file_name, File::Truncate, fapl); GroupCreateProps props; - props.add(EstimatedLinkInfo(1000, 500)); + props.add(EstimatedLinkInfo(10, 60)); auto group = file.createGroup("g", props); auto sizes = group.getEstimatedLinkInfo(); - CHECK(sizes.first == 1000); - CHECK(sizes.second == 500); + CHECK(sizes.first == 10); + CHECK(sizes.second == 60); } TEST_CASE(Test_allocation_time) { - const std::string FILE_NAME("h5_dataset_alloc_time.h5"); - File file(FILE_NAME, File::Truncate); + const std::string file_name("h5_dataset_alloc_time.h5"); + File file(file_name, File::Truncate); size_t n_elements = 10; std::vector data(n_elements); @@ -342,13 +352,21 @@ TEST_CASE(Test_allocation_time) { CHECK(alloc_size == data.size() * sizeof(decltype(data)::value_type)); } +/* + * Test to ensure legacy support: DataSet used to have a default constructor. + * However, it is not useful to have a DataSet object that does not actually + * refer to a dataset in a file. Hence, the the default constructor was + * deprecated. + * This test is to ensure that the constructor is not accidentally removed and + * thereby break users' code. + */ TEST_CASE(Test_default_constructors) { - const std::string FILE_NAME("h5_group_test.h5"); - const std::string DATASET_NAME("dset"); - File file(FILE_NAME, File::Truncate); - auto ds = file.createDataSet(DATASET_NAME, std::vector{1, 2, 3, 4, 5}); + const std::string file_name("h5_default_ctors.h5"); + const std::string dataset_name("dset"); + File file(file_name, File::Truncate); + auto ds = file.createDataSet(dataset_name, std::vector{1, 2, 3, 4, 5}); - DataSet d2; // deprecated as it constructs unsafe objects + DataSet d2; // expect deprecation warning, as it constructs unsafe object // d2.getFile(); // runtime error CHECK(!d2.isValid()); d2 = ds; // copy @@ -356,39 +374,39 @@ TEST_CASE(Test_default_constructors) { } TEST_CASE(Test_groups_and_datasets) { - const std::string FILE_NAME("h5_group_test.h5"); - const std::string DATASET_NAME("dset"); - const std::string CHUNKED_DATASET_NAME("chunked_dset"); - const std::string CHUNKED_DATASET_SMALL_NAME("chunked_dset_small"); - const std::string GROUP_NAME1("/group1"); - const std::string GROUP_NAME2("group2"); - const std::string GROUP_NESTED_NAME("group_nested"); + const std::string file_name("h5_group_test.h5"); + const std::string dataset_name("dset"); + const std::string chunked_dataset_name("chunked_dset"); + const std::string chunked_dataset_small_name("chunked_dset_small"); + const std::string group_name_1("/group1"); + const std::string group_name_2("group2"); + const std::string group_nested_name("group_nested"); { // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); // absolute group - file.createGroup(GROUP_NAME1); + file.createGroup(group_name_1); // nested group absolute - file.createGroup(GROUP_NAME1 + "/" + GROUP_NESTED_NAME); + file.createGroup(group_name_1 + "/" + group_nested_name); // relative group - Group g1 = file.createGroup(GROUP_NAME2); + Group g1 = file.createGroup(group_name_2); // relative group - Group nested = g1.createGroup(GROUP_NESTED_NAME); + Group nested = g1.createGroup(group_nested_name); // Create the data space for the dataset. std::vector dims{4, 6}; DataSpace dataspace(dims); - DataSet dataset_absolute = file.createDataSet(GROUP_NAME1 + "/" + GROUP_NESTED_NAME + "/" + - DATASET_NAME, + DataSet dataset_absolute = file.createDataSet(group_name_1 + "/" + group_nested_name + "/" + + dataset_name, dataspace, AtomicType()); DataSet dataset_relative = - nested.createDataSet(DATASET_NAME, dataspace, AtomicType()); + nested.createDataSet(dataset_name, dataspace, AtomicType()); DataSetCreateProps goodChunking; goodChunking.add(Chunking(std::vector{2, 2})); @@ -404,13 +422,13 @@ TEST_CASE(Test_groups_and_datasets) { { SilenceHDF5 silencer; - CHECK_THROWS_AS(file.createDataSet(CHUNKED_DATASET_NAME, + CHECK_THROWS_AS(file.createDataSet(chunked_dataset_name, dataspace, AtomicType(), badChunking0), DataSetException); - CHECK_THROWS_AS(file.createDataSet(CHUNKED_DATASET_NAME, + CHECK_THROWS_AS(file.createDataSet(chunked_dataset_name, dataspace, AtomicType(), badChunking1), @@ -419,47 +437,108 @@ TEST_CASE(Test_groups_and_datasets) { // here we use the other signature DataSet dataset_chunked = - file.createDataSet(CHUNKED_DATASET_NAME, dataspace, goodChunking, cacheConfig); + file.createDataSet(chunked_dataset_name, dataspace, goodChunking, cacheConfig); // Here we resize to smaller than the chunking size DataSet dataset_chunked_small = - file.createDataSet(CHUNKED_DATASET_SMALL_NAME, dataspace, goodChunking); + file.createDataSet(chunked_dataset_small_name, dataspace, goodChunking); dataset_chunked_small.resize({1, 1}); } // read it back { - File file(FILE_NAME, File::ReadOnly); - Group g1 = file.getGroup(GROUP_NAME1); - Group g2 = file.getGroup(GROUP_NAME2); - Group nested_group2 = g2.getGroup(GROUP_NESTED_NAME); + File file(file_name, File::ReadOnly); + Group g1 = file.getGroup(group_name_1); + Group g2 = file.getGroup(group_name_2); + Group nested_group2 = g2.getGroup(group_nested_name); - DataSet dataset_absolute = file.getDataSet(GROUP_NAME1 + "/" + GROUP_NESTED_NAME + "/" + - DATASET_NAME); + DataSet dataset_absolute = file.getDataSet(group_name_1 + "/" + group_nested_name + "/" + + dataset_name); CHECK(4 == dataset_absolute.getSpace().getDimensions()[0]); - DataSet dataset_relative = nested_group2.getDataSet(DATASET_NAME); + DataSet dataset_relative = nested_group2.getDataSet(dataset_name); CHECK(4 == dataset_relative.getSpace().getDimensions()[0]); DataSetAccessProps accessProps; accessProps.add(Caching(13, 1024, 0.5)); - DataSet dataset_chunked = file.getDataSet(CHUNKED_DATASET_NAME, accessProps); + DataSet dataset_chunked = file.getDataSet(chunked_dataset_name, accessProps); CHECK(4 == dataset_chunked.getSpace().getDimensions()[0]); - DataSet dataset_chunked_small = file.getDataSet(CHUNKED_DATASET_SMALL_NAME); + DataSet dataset_chunked_small = file.getDataSet(chunked_dataset_small_name); CHECK(1 == dataset_chunked_small.getSpace().getDimensions()[0]); } } +TEST_CASE(FileSpace) { + const std::string filename = "filespace.h5"; + const std::string ds_path = "dataset"; + const std::vector data{13, 24, 36}; + + File file(filename, File::Truncate); + file.createDataSet(ds_path, data); + + CHECK(file.getFileSize() > 0); +} + +TEST_CASE(FreeSpace_default) { + const std::string filename = "freespace_default.h5"; + const std::string ds_path = "dataset"; + const std::vector data{13, 24, 36}; + + { + File file(filename, File::Truncate); + auto dset = file.createDataSet(ds_path, data); + } + + { + File file(filename, File::ReadWrite); + file.unlink(ds_path); + CHECK(file.getFreeSpace() > 0); + CHECK(file.getFreeSpace() < file.getFileSize()); + } +} + +#if H5_VERSION_GE(1, 10, 1) +TEST_CASE(FreeSpace_tracked) { + const std::string filename = "freespace_tracked.h5"; + const std::string ds_path = "dataset"; + const std::vector data{13, 24, 36}; + + { + FileCreateProps fcp; + fcp.add(FileSpaceStrategy(H5F_FSPACE_STRATEGY_FSM_AGGR, true, 0)); + File file(filename, File::Truncate, fcp); + auto dset = file.createDataSet(ds_path, data); + } + + { + File file(filename, File::ReadWrite); + file.unlink(ds_path); + +#if H5_VERSION_GE(1, 12, 0) + // This fails on 1.10.x but starts working in 1.12.0 + CHECK(file.getFreeSpace() > 0); +#endif + CHECK(file.getFreeSpace() < file.getFileSize()); + } + + { + File file(filename, File::ReadOnly); + CHECK(file.getFreeSpace() > 0); + CHECK(file.getFreeSpace() < file.getFileSize()); + } +} +#endif + TEST_CASE(Test_extensible_datasets) { - const std::string FILE_NAME("create_extensible_dataset_example.h5"); - const std::string DATASET_NAME("dset"); + const std::string file_name("create_extensible_dataset_example.h5"); + const std::string dataset_name("dset"); constexpr long double t1[3][1] = {{2.0l}, {2.0l}, {4.0l}}; constexpr long double t2[1][3] = {{4.0l, 8.0l, 6.0l}}; { // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); // Create a dataspace with initial shape and max shape DataSpace dataspace = DataSpace({4, 5}, {17, DataSpace::UNLIMITED}); @@ -470,7 +549,7 @@ TEST_CASE(Test_extensible_datasets) { // Create the dataset DataSet dataset = - file.createDataSet(DATASET_NAME, dataspace, AtomicType(), props); + file.createDataSet(dataset_name, dataspace, AtomicType(), props); // Write into the initial part of the dataset dataset.select({0, 0}, {3, 1}).write(t1); @@ -493,9 +572,9 @@ TEST_CASE(Test_extensible_datasets) { // read it back { - File file(FILE_NAME, File::ReadOnly); + File file(file_name, File::ReadOnly); - DataSet dataset_absolute = file.getDataSet("/" + DATASET_NAME); + DataSet dataset_absolute = file.getDataSet("/" + dataset_name); const auto dims = dataset_absolute.getSpace().getDimensions(); long double values[4][6]; dataset_absolute.read(values); @@ -513,23 +592,23 @@ TEST_CASE(Test_extensible_datasets) { } TEST_CASE(Test_reference_count) { - const std::string FILE_NAME("h5_ref_count_test.h5"); - const std::string DATASET_NAME("dset"); - const std::string GROUP_NAME1("/group1"); - const std::string GROUP_NAME2("/group2"); + const std::string file_name("h5_ref_count_test.h5"); + const std::string dataset_name("dset"); + const std::string group_name_1("/group1"); + const std::string group_name_2("/group2"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); std::unique_ptr d1_ptr; std::unique_ptr g_ptr; { // create group - Group g1 = file.createGroup(GROUP_NAME1); + Group g1 = file.createGroup(group_name_1); // override object - g1 = file.createGroup(GROUP_NAME2); + g1 = file.createGroup(group_name_2); // Create the data space for the dataset. std::vector dims = {10, 10}; @@ -537,7 +616,7 @@ TEST_CASE(Test_reference_count) { DataSpace dataspace(dims); DataSet d1 = - file.createDataSet(GROUP_NAME1 + DATASET_NAME, dataspace, AtomicType()); + file.createDataSet(group_name_1 + dataset_name, dataspace, AtomicType()); double values[10][10] = {{0}}; values[5][0] = 1; @@ -578,18 +657,18 @@ TEST_CASE(Test_reference_count) { } TEST_CASE(Test_simple_listings) { - const std::string FILE_NAME("h5_list_test.h5"); - const std::string GROUP_NAME_CORE("group_name"); - const std::string GROUP_NESTED_NAME("/group_nested"); + const std::string file_name("h5_list_test.h5"); + const std::string group_name_core("group_name"); + const std::string group_nested_name("/group_nested"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); { // absolute group for (int i = 0; i < 2; ++i) { std::ostringstream ss; - ss << "/" << GROUP_NAME_CORE << "_" << i; + ss << "/" << group_name_core << "_" << i; file.createGroup(ss.str()); } @@ -601,7 +680,7 @@ TEST_CASE(Test_simple_listings) { std::vector reference_elems; for (int i = 0; i < 2; ++i) { std::ostringstream ss; - ss << GROUP_NAME_CORE << "_" << i; + ss << group_name_core << "_" << i; reference_elems.push_back(ss.str()); } @@ -609,12 +688,12 @@ TEST_CASE(Test_simple_listings) { } { - file.createGroup(GROUP_NESTED_NAME); - Group g_nest = file.getGroup(GROUP_NESTED_NAME); + file.createGroup(group_nested_name); + Group g_nest = file.getGroup(group_nested_name); for (int i = 0; i < 50; ++i) { std::ostringstream ss; - ss << GROUP_NAME_CORE << "_" << i; + ss << group_name_core << "_" << i; g_nest.createGroup(ss.str()); } @@ -627,7 +706,7 @@ TEST_CASE(Test_simple_listings) { for (int i = 0; i < 50; ++i) { std::ostringstream ss; - ss << GROUP_NAME_CORE << "_" << i; + ss << group_name_core << "_" << i; reference_elems.push_back(ss.str()); } // there is no guarantee on the order of the hdf5 index, let's sort it @@ -658,12 +737,51 @@ TEST_CASE(Simple_test_for_type_equality) { CHECK(int_var != uint_var); } +TEST_CASE(TestStringType) { + SECTION("enshrine-defaults") { + auto fixed_length = FixedLengthStringType(32, StringPadding::SpacePadded); + auto variable_length = VariableLengthStringType(); + + REQUIRE(fixed_length.getCharacterSet() == CharacterSet::Ascii); + REQUIRE(variable_length.getCharacterSet() == CharacterSet::Ascii); + } + + SECTION("fixed-length") { + auto fixed_length = + FixedLengthStringType(32, StringPadding::SpacePadded, CharacterSet::Utf8); + auto string_type = fixed_length.asStringType(); + + REQUIRE(string_type.getId() == fixed_length.getId()); + REQUIRE(string_type.getCharacterSet() == CharacterSet::Utf8); + REQUIRE(string_type.getPadding() == StringPadding::SpacePadded); + REQUIRE(string_type.getSize() == 32); + REQUIRE(!string_type.isVariableStr()); + REQUIRE(string_type.isFixedLenStr()); + } + + SECTION("variable-length") { + auto variable_length = VariableLengthStringType(CharacterSet::Utf8); + auto string_type = variable_length.asStringType(); + + REQUIRE(string_type.getId() == variable_length.getId()); + REQUIRE(string_type.getCharacterSet() == CharacterSet::Utf8); + REQUIRE(string_type.isVariableStr()); + REQUIRE(!string_type.isFixedLenStr()); + } + + SECTION("atomic") { + auto atomic = AtomicType(); + //REQUIRE_THROWS(atomic.asStringType()); + } +} + + TEST_CASE(DataTypeEqualTakeBack) { - const std::string FILE_NAME("h5tutr_dset.h5"); - const std::string DATASET_NAME("dset"); + const std::string file_name("h5tutr_dset.h5"); + const std::string dataset_name("dset"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); // Create the data space for the dataset. std::vector dims{10, 1}; @@ -671,7 +789,7 @@ TEST_CASE(DataTypeEqualTakeBack) { DataSpace dataspace(dims); // Create a dataset with double precision floating points - DataSet dataset = file.createDataSet(DATASET_NAME + "_double", dataspace); + DataSet dataset = file.createDataSet(dataset_name + "_double", dataspace); AtomicType s; AtomicType d; @@ -679,29 +797,31 @@ TEST_CASE(DataTypeEqualTakeBack) { CHECK(s == dataset.getDataType()); CHECK(d != dataset.getDataType()); - //// Test getAddress and expect deprecation warning - //auto addr = dataset.getInfo().getAddress(); - //CHECK(addr != 0); + // Test getAddress and expect deprecation warning + auto addr = dataset.getInfo().getAddress(); + CHECK(addr != 0); } TEST_CASE(DataSpaceTest) { - const std::string FILE_NAME("h5tutr_space.h5"); - const std::string DATASET_NAME("dset"); + const std::string file_name("h5tutr_space.h5"); + const std::string dataset_name("dset"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); // Create the data space for the dataset. DataSpace dataspace{std::vector{10, 1}}; // Create a dataset with size_t type - DataSet dataset = file.createDataSet(DATASET_NAME, dataspace); + DataSet dataset = file.createDataSet(dataset_name, dataspace); DataSpace space = dataset.getSpace(); DataSpace space2 = dataset.getSpace(); + auto space3 = space.clone(); // verify space id are different CHECK(space.getId() != space2.getId()); + CHECK(space.getId() != space3.getId()); // verify space id are consistent CHECK(space.getDimensions().size() == 2); @@ -709,6 +829,39 @@ TEST_CASE(DataSpaceTest) { CHECK(space.getDimensions()[1] == 1); } +TEST_CASE(DataSpace_getElementCount) { + SECTION("null") { + auto space = DataSpace(DataSpace::dataspace_null); + CHECK(space.getElementCount() == 0); + } + + SECTION("scalar") { + auto space = DataSpace(DataSpace::dataspace_scalar); + CHECK(space.getElementCount() == 1); + } + + SECTION("simple, empty (1D)") { + auto space = DataSpace(0); + CHECK(space.getElementCount() == 0); + } + + SECTION("simple, empty (2D)") { + auto space = DataSpace(0, 0); + CHECK(space.getElementCount() == 0); + } + + SECTION("simple, non-empty (2D)") { + auto space = DataSpace(2, 3); + CHECK(space.getElementCount() == 6); + } + + SECTION("FromCharArrayStrings") { + char string_array[2][10] = {"123456789", "abcdefghi"}; + auto space = DataSpace::FromCharArrayStrings(string_array); + CHECK(space.getElementCount() == 2); + } +} + TEST_CASE(DataSpaceVectorTest) { // Create 1D shortcut dataspace DataSpace space(7); @@ -795,7 +948,7 @@ TEST_CASE(HighFiveReadWriteShortcut) { filename << "h5_rw_vec_shortcut_test.h5"; const unsigned x_size = 800; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); std::vector vec; vec.resize(x_size); for (unsigned i = 0; i < x_size; i++) @@ -808,7 +961,7 @@ TEST_CASE(HighFiveReadWriteShortcut) { File file(filename.str(), File::ReadWrite | File::Create | File::Truncate); // Create a dataset with int points - DataSet dataset = file.createDataSet(DATASET_NAME, vec); + DataSet dataset = file.createDataSet(dataset_name, vec); dataset.createAttribute("str", at_contents); DataSet ds_int = file.createDataSet("/TmpInt", my_int); @@ -863,13 +1016,13 @@ TEST_CASE(HighFiveReadWriteShortcut) { } template -void readWriteAttributeVectorTest(const std::string& testName) { +void readWriteAttributeVectorTest() { std::ostringstream filename; filename << "h5_rw_attribute_vec_" << typeNameHelper() << "_test.h5"; std::srand((unsigned) std::time(0)); const size_t x_size = 25; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); typename std::vector vec; // Create a new file using the default property lists. @@ -885,22 +1038,22 @@ void readWriteAttributeVectorTest(const std::string& testName) { // check that no attributes are there std::size_t n = g.getNumberAttributes(); - CHECK(n == 0); + //CHECK(n == 0); std::vector all_attribute_names = g.listAttributeNames(); - CHECK(all_attribute_names.size() == 0); - CHECK(!g.hasAttribute("my_attribute")); + //CHECK(all_attribute_names.size() == 0); + //CHECK(!g.hasAttribute("my_attribute")); Attribute a1 = g.createAttribute("my_attribute", DataSpace::From(vec)); a1.write(vec); // check now that we effectively have an attribute listable - CHECK(g.getNumberAttributes() == 1); - CHECK(g.hasAttribute("my_attribute")); + //CHECK(g.getNumberAttributes() == 1); + //CHECK(g.hasAttribute("my_attribute")); all_attribute_names = g.listAttributeNames(); - CHECK(all_attribute_names.size() == 1); - CHECK(all_attribute_names[0] == std::string("my_attribute")); + //CHECK(all_attribute_names.size() == 1); + //CHECK(all_attribute_names[0] == std::string("my_attribute")); // Create the same attribute on a newly created dataset DataSet s = g.createDataSet("dummy_dataset", DataSpace(1), AtomicType()); @@ -919,17 +1072,17 @@ void readWriteAttributeVectorTest(const std::string& testName) { Attribute a1_read = file.getGroup("dummy_group").getAttribute("my_attribute"); a1_read.read(result1); - CHECK(vec.size() == x_size); - CHECK(result1.size() == x_size); - CHECK(vec == result1); + //CHECK(vec.size() == x_size); + //CHECK(result1.size() == x_size); + //CHECK(vec == result1); Attribute a2_read = file.getDataSet("/dummy_group/dummy_dataset").getAttribute("my_attribute_copy"); a2_read.read(result2); - CHECK(vec.size() == x_size); - CHECK(result2.size() == x_size); - CHECK(vec == result2); + //CHECK(vec.size() == x_size); + //CHECK(result2.size() == x_size); + //CHECK(vec == result2); std::vector v; // with const would print a nice err msg file.getDataSet("/dummy_group/dummy_dataset").getAttribute("version_test").read(v); @@ -941,24 +1094,52 @@ void readWriteAttributeVectorTest(const std::string& testName) { auto g = file.getGroup("dummy_group"); g.deleteAttribute("my_attribute"); auto n = g.getNumberAttributes(); - CHECK(n == 0); + //CHECK(n == 0); // From dataset auto d = file.getDataSet("/dummy_group/dummy_dataset"); d.deleteAttribute("my_attribute_copy"); n = g.getNumberAttributes(); - CHECK(n == 0); + //CHECK(n == 0); } } TEST_CASE(ReadWriteAttributeVectorString) { - readWriteAttributeVectorTest(testName); + readWriteAttributeVectorTest(); } -// + //TEMPLATE_LIST_TEST_CASE("ReadWriteAttributeVector", "[template]", dataset_test_types) { // readWriteAttributeVectorTest(); //} +TEST_CASE(WriteLargeAttribute) { + std::vector large_attr(16000, 0.0); + + auto fapl = HighFive::FileAccessProps::Default(); + fapl.add(HighFive::FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)); + HighFive::File file("create_large_attribute.h5", HighFive::File::Truncate, fapl); + auto gcpl = HighFive::GroupCreateProps::Default(); + gcpl.add(HighFive::AttributePhaseChange(0, 0)); + + auto group = file.createGroup("grp", gcpl); + CHECK_NOTHROW(group.createAttribute("attr", large_attr)); +} + +TEST_CASE(TestAttributePhaseChange) { + auto fapl = HighFive::FileAccessProps::Default(); + fapl.add(HighFive::FileVersionBounds(H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)); + HighFive::File file("attribute_phase_change.h5", HighFive::File::Truncate, fapl); + + auto gcpl = HighFive::GroupCreateProps::Default(); + gcpl.add(HighFive::AttributePhaseChange(42, 24)); + + auto group = file.createGroup("grp", gcpl); + + auto actual = AttributePhaseChange(group.getCreatePropertyList()); + CHECK(actual.min_dense() == 24); + CHECK(actual.max_compact() == 42); +} + TEST_CASE(datasetOffset) { std::string filename = "datasetOffset.h5"; std::string dsetname = "dset"; @@ -973,7 +1154,7 @@ TEST_CASE(datasetOffset) { } template -void selectionArraySimpleTest(const std::string& testName) { +void selectionArraySimpleTest() { typedef typename std::vector Vector; std::ostringstream filename; @@ -982,7 +1163,7 @@ void selectionArraySimpleTest(const std::string& testName) { const size_t size_x = 10; const size_t offset_x = 2, count_x = 5; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); Vector values(size_x); @@ -992,7 +1173,7 @@ void selectionArraySimpleTest(const std::string& testName) { // Create a new file using the default property lists. File file(filename.str(), File::ReadWrite | File::Create | File::Truncate); - DataSet dataset = file.createDataSet(DATASET_NAME, DataSpace::From(values)); + DataSet dataset = file.createDataSet(dataset_name, DataSpace::From(values)); dataset.write(values); @@ -1007,15 +1188,15 @@ void selectionArraySimpleTest(const std::string& testName) { Selection slice = dataset.select(offset, size); - CHECK(slice.getSpace().getDimensions()[0] == size_x); - CHECK(slice.getMemSpace().getDimensions()[0] == count_x); + //CHECK(slice.getSpace().getDimensions()[0] == size_x); + //CHECK(slice.getMemSpace().getDimensions()[0] == count_x); slice.read(result); - CHECK(result.size() == 5); + //CHECK(result.size() == 5); for (size_t i = 0; i < count_x; ++i) { - REQUIRE(values[i + offset_x] == result[i]); + //REQUIRE(values[i + offset_x] == result[i]); } } @@ -1027,22 +1208,22 @@ void selectionArraySimpleTest(const std::string& testName) { Selection slice = dataset.select(ElementSet(ids)); - CHECK(slice.getSpace().getDimensions()[0] == size_x); - CHECK(slice.getMemSpace().getDimensions()[0] == ids.size()); + //CHECK(slice.getSpace().getDimensions()[0] == size_x); + //CHECK(slice.getMemSpace().getDimensions()[0] == ids.size()); slice.read(result); - CHECK(result.size() == ids.size()); + //CHECK(result.size() == ids.size()); for (size_t i = 0; i < ids.size(); ++i) { const std::size_t id = ids[i]; - REQUIRE(values[id] == result[i]); + //REQUIRE(values[id] == result[i]); } } } TEST_CASE(selectionArraySimpleString) { - selectionArraySimpleTest(testName); + selectionArraySimpleTest(); } //TEMPLATE_LIST_TEST_CASE("selectionArraySimple", "[template]", dataset_test_types) { @@ -1050,9 +1231,9 @@ TEST_CASE(selectionArraySimpleString) { //} TEST_CASE(selectionByElementMultiDim) { - const std::string FILE_NAME("h5_test_selection_multi_dim.h5"); + const std::string file_name("h5_test_selection_multi_dim.h5"); // Create a 2-dim dataset - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); std::vector dims{3, 3}; auto set = file.createDataSet("test", DataSpace(dims), AtomicType()); @@ -1086,14 +1267,14 @@ TEST_CASE(selectionByElementMultiDim) { } template -void columnSelectionTest(const std::string& testName) { +void columnSelectionTest() { std::ostringstream filename; filename << "h5_rw_select_column_test_" << typeNameHelper() << "_test.h5"; const size_t x_size = 10; const size_t y_size = 7; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); T values[x_size][y_size]; @@ -1108,7 +1289,7 @@ void columnSelectionTest(const std::string& testName) { DataSpace dataspace(dims); // Create a dataset with arbitrary type - DataSet dataset = file.createDataSet(DATASET_NAME, dataspace); + DataSet dataset = file.createDataSet(dataset_name, dataspace); dataset.write(values); @@ -1120,12 +1301,13 @@ void columnSelectionTest(const std::string& testName) { T result[x_size][3]; slice.read(result); - CHECK(slice.getSpace().getDimensions()[0] == x_size); - CHECK(slice.getMemSpace().getDimensions()[0] == x_size); + //CHECK(slice.getSpace().getDimensions()[0] == x_size); + //CHECK(slice.getMemSpace().getDimensions()[0] == x_size); for (size_t i = 0; i < 3; ++i) - for (size_t j = 0; j < x_size; ++j) - REQUIRE(result[j][i] == values[j][columns[i]]); + for (size_t j = 0; j < x_size; ++j) { + //REQUIRE(result[j][i] == values[j][columns[i]]); + } } //TEMPLATE_LIST_TEST_CASE("columnSelection", "[template]", numerical_test_types) { @@ -1276,42 +1458,40 @@ File setupHyperSlabFile(T (&values)[x_size][y_size], return file; } -#if 0 template void regularHyperSlabSelectionTest() { std::ostringstream filename; filename << "h5_rw_select_regular_hyperslab_test_" << typeNameHelper() << "_test.h5"; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); const size_t x_size = 10; const size_t y_size = 8; T values[x_size][y_size]; - auto file = setupHyperSlabFile(values, filename.str(), DATASET_NAME); + auto file = setupHyperSlabFile(values, filename.str(), dataset_name); auto test_cases = make_regular_hyperslab_test_data(); for (const auto& test_case: test_cases) { SECTION(test_case.desc) { std::vector result; - file.getDataSet(DATASET_NAME).select(test_case.slab).read(result); + file.getDataSet(dataset_name).select(test_case.slab).read(result); auto n_selected = test_case.answer.global_indices.size(); for (size_t i = 0; i < n_selected; ++i) { const auto ig = test_case.answer.global_indices[i]; const auto il = test_case.answer.local_indices[i]; - REQUIRE(result[il[0]] == values[ig[0]][ig[1]]); + //REQUIRE(result[il[0]] == values[ig[0]][ig[1]]); } } } } -TEMPLATE_LIST_TEST_CASE("hyperSlabSelection", "[template]", numerical_test_types) { - regularHyperSlabSelectionTest(); -} -#endif +//TEMPLATE_LIST_TEST_CASE("hyperSlabSelection", "[template]", numerical_test_types) { +// regularHyperSlabSelectionTest(); +//} struct IrregularHyperSlabAnswer { // These are the selected indices in the outer (larger) array. @@ -1393,19 +1573,18 @@ std::vector make_irregular_hyperslab_test_data() { return test_data; } -#if 0 template void irregularHyperSlabSelectionReadTest() { std::ostringstream filename; filename << "h5_write_select_irregular_hyperslab_test_" << typeNameHelper() << "_test.h5"; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); const size_t x_size = 10; const size_t y_size = 8; T values[x_size][y_size]; - auto file = setupHyperSlabFile(values, filename.str(), DATASET_NAME); + auto file = setupHyperSlabFile(values, filename.str(), dataset_name); auto test_cases = make_irregular_hyperslab_test_data(); @@ -1413,36 +1592,34 @@ void irregularHyperSlabSelectionReadTest() { SECTION(test_case.desc) { std::vector result; - file.getDataSet(DATASET_NAME).select(test_case.slab).read(result); + file.getDataSet(dataset_name).select(test_case.slab).read(result); auto n_selected = test_case.answer.global_indices.size(); for (size_t i = 0; i < n_selected; ++i) { const auto ig = test_case.answer.global_indices[i]; - REQUIRE(result[i] == values[ig[0]][ig[1]]); + //REQUIRE(result[i] == values[ig[0]][ig[1]]); } } } } -TEMPLATE_LIST_TEST_CASE("irregularHyperSlabSelectionRead", "[template]", numerical_test_types) { - irregularHyperSlabSelectionReadTest(); -} -#endif +//TEMPLATE_LIST_TEST_CASE("irregularHyperSlabSelectionRead", "[template]", numerical_test_types) { +// irregularHyperSlabSelectionReadTest(); +//} -#if 0 template void irregularHyperSlabSelectionWriteTest() { std::ostringstream filename; filename << "h5_write_select_irregular_hyperslab_test_" << typeNameHelper() << "_test.h5"; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); const size_t x_size = 10; const size_t y_size = 8; T orig_values[x_size][y_size]; - auto file = setupHyperSlabFile(orig_values, filename.str(), DATASET_NAME); + auto file = setupHyperSlabFile(orig_values, filename.str(), dataset_name); auto test_cases = make_irregular_hyperslab_test_data(); @@ -1453,10 +1630,10 @@ void irregularHyperSlabSelectionWriteTest() { ContentGenerate gen; std::generate(changed_values.begin(), changed_values.end(), gen); - file.getDataSet(DATASET_NAME).select(test_case.slab).write(changed_values); + file.getDataSet(dataset_name).select(test_case.slab).write(changed_values); T overwritten_values[x_size][y_size]; - file.getDataSet(DATASET_NAME).read(overwritten_values); + file.getDataSet(dataset_name).read(overwritten_values); T expected_values[x_size][y_size]; for (size_t i = 0; i < x_size; ++i) { @@ -1472,20 +1649,19 @@ void irregularHyperSlabSelectionWriteTest() { for (size_t i = 0; i < x_size; ++i) { for (size_t j = 0; j < y_size; ++j) { - REQUIRE(expected_values[i][j] == overwritten_values[i][j]); + //REQUIRE(expected_values[i][j] == overwritten_values[i][j]); } } } } } -TEMPLATE_LIST_TEST_CASE("irregularHyperSlabSelectionWrite", "[template]", std::tuple) { - irregularHyperSlabSelectionWriteTest(); -} -#endif +//TEMPLATE_LIST_TEST_CASE("irregularHyperSlabSelectionWrite", "[template]", std::tuple) { +// irregularHyperSlabSelectionWriteTest(); +//} template -void attribute_scalar_rw(const std::string& testName) { +void attribute_scalar_rw() { std::ostringstream filename; filename << "h5_rw_attribute_scalar_rw" << typeNameHelper() << "_test.h5"; @@ -1497,7 +1673,7 @@ void attribute_scalar_rw(const std::string& testName) { Group g = h5file.createGroup("metadata"); - CHECK(!g.hasAttribute("family")); + //CHECK(!g.hasAttribute("family")); // write a scalar attribute { @@ -1509,14 +1685,14 @@ void attribute_scalar_rw(const std::string& testName) { h5file.flush(); // test if attribute exist - CHECK(g.hasAttribute("family")); + //CHECK(g.hasAttribute("family")); // read back a scalar attribute { T res; Attribute att = g.getAttribute("family"); att.read(res); - CHECK(res == attribute_value); + //CHECK(res == attribute_value); } } @@ -1525,14 +1701,14 @@ void attribute_scalar_rw(const std::string& testName) { //} TEST_CASE(attribute_scalar_rw_string) { - attribute_scalar_rw(testName); + attribute_scalar_rw(); } // regression test https://github.com/BlueBrain/HighFive/issues/98 TEST_CASE(HighFiveOutofDimension) { std::string filename("h5_rw_reg_zero_dim_test.h5"); - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); { // Create a new file using the default property lists. @@ -1540,7 +1716,7 @@ TEST_CASE(HighFiveOutofDimension) { DataSpace d_null(DataSpace::DataspaceType::dataspace_null); - DataSet d1 = file.createDataSet(DATASET_NAME, d_null); + DataSet d1 = file.createDataSet(dataset_name, d_null); file.flush(); @@ -1555,10 +1731,10 @@ TEST_CASE(HighFiveOutofDimension) { } template -void readWriteShuffleDeflateTest(const std::string& testName) { +void readWriteShuffleDeflateTest() { std::ostringstream filename; filename << "h5_rw_deflate_" << typeNameHelper() << "_test.h5"; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); const size_t x_size = 128; const size_t y_size = 32; const size_t x_chunk = 16; @@ -1588,7 +1764,7 @@ void readWriteShuffleDeflateTest(const std::string& testName) { props.add(Deflate(deflate_level)); // Create a dataset with arbitrary type - DataSet dataset = file.createDataSet(DATASET_NAME, dataspace, props); + DataSet dataset = file.createDataSet(dataset_name, dataspace, props); ContentGenerate generator; generate2D(array, x_size, y_size, generator); @@ -1601,7 +1777,7 @@ void readWriteShuffleDeflateTest(const std::string& testName) { // read it back { File file_read(filename.str(), File::ReadOnly); - DataSet dataset_read = file_read.getDataSet("/" + DATASET_NAME); + DataSet dataset_read = file_read.getDataSet("/" + dataset_name); T result[x_size][y_size]; @@ -1609,7 +1785,7 @@ void readWriteShuffleDeflateTest(const std::string& testName) { for (size_t i = 0; i < x_size; ++i) { for (size_t j = 0; i < y_size; ++i) { - REQUIRE(result[i][j] == array[i][j]); + //REQUIRE(result[i][j] == array[i][j]); } } } @@ -1620,10 +1796,10 @@ void readWriteShuffleDeflateTest(const std::string& testName) { //} template -void readWriteSzipTest(const std::string& testName) { +void readWriteSzipTest() { std::ostringstream filename; filename << "h5_rw_szip_" << typeNameHelper() << "_test.h5"; - const std::string DATASET_NAME("dset"); + const std::string dataset_name("dset"); const size_t x_size = 128; const size_t y_size = 32; const size_t x_chunk = 8; @@ -1651,7 +1827,7 @@ void readWriteSzipTest(const std::string& testName) { props.add(Szip(options_mask, pixels_per_block)); // Create a dataset with arbitrary type - DataSet dataset = file.createDataSet(DATASET_NAME, dataspace, props); + DataSet dataset = file.createDataSet(dataset_name, dataspace, props); ContentGenerate generator; generate2D(array, x_size, y_size, generator); @@ -1664,7 +1840,7 @@ void readWriteSzipTest(const std::string& testName) { // read it back { File file_read(filename.str(), File::ReadOnly); - DataSet dataset_read = file_read.getDataSet("/" + DATASET_NAME); + DataSet dataset_read = file_read.getDataSet("/" + dataset_name); T result[x_size][y_size]; @@ -1672,7 +1848,7 @@ void readWriteSzipTest(const std::string& testName) { for (size_t i = 0; i < x_size; ++i) { for (size_t j = 0; i < y_size; ++i) { - REQUIRE(result[i][j] == array[i][j]); + //REQUIRE(result[i][j] == array[i][j]); } } } @@ -1687,46 +1863,455 @@ void readWriteSzipTest(const std::string& testName) { // } //} +TEST_CASE(CheckDimensions) { + // List of dims which can all be one-dimensional. + std::vector> test_cases{ + {1ul, 3ul}, {3ul, 1ul}, {1ul, 1ul, 3ul}, {3ul, 1ul, 1ul}, {1ul, 3ul, 1ul}}; + + for (const auto& dims: test_cases) { + auto actual = details::checkDimensions(dims, 1ul); + + INFO("dims = " + details::format_vector(dims) + ", n_dims = 1"); + CHECK(actual); + + INFO("dims = " + details::format_vector(dims) + ", n_dims = 1"); + CHECK(!details::checkDimensions(dims, dims.size() + 1)); + } + + CHECK(details::checkDimensions(std::vector{1ul}, 0ul)); + CHECK(details::checkDimensions(std::vector{1ul}, 1ul)); + + CHECK(!details::checkDimensions(std::vector{0ul}, 0ul)); + CHECK(!details::checkDimensions(std::vector{2ul}, 0ul)); + + CHECK(!details::checkDimensions(std::vector{1ul, 2ul, 3ul}, 2ul)); + CHECK(details::checkDimensions(std::vector{3ul, 2ul, 1ul}, 2ul)); + + CHECK(details::checkDimensions(std::vector{1ul, 1ul, 1ul, 1ul}, 1ul)); + + CHECK(details::checkDimensions(std::vector{}, 0ul)); + CHECK(!details::checkDimensions(std::vector{}, 1ul)); + CHECK(!details::checkDimensions(std::vector{}, 2ul)); +} + + +TEST_CASE(SqueezeDimensions) { + SECTION("possible") { + // List of testcases: the first number is n_dims then the input dimensions + // and finally the squeezed dimensions. + std::vector, std::vector>> test_cases{ + {1ul, {3ul, 1ul}, {3ul}}, + + {1ul, {1ul, 1ul, 1ul}, {1ul}}, + + {1ul, {1ul, 3ul, 1ul}, {3ul}}, + + {1ul, {3ul, 1ul, 1ul}, {3ul}}, + {2ul, {3ul, 1ul, 1ul}, {3ul, 1ul}}, + {3ul, {3ul, 1ul, 1ul}, {3ul, 1ul, 1ul}}, + + {3ul, {2ul, 1ul, 3ul}, {2ul, 1ul, 3ul}}}; + + for (const auto& tc: test_cases) { + auto n_dim_requested = std::get<0>(tc); + auto dims = std::get<1>(tc); + auto expected = std::get<2>(tc); + auto actual = details::squeezeDimensions(dims, n_dim_requested); + + CHECK(actual == expected); + } + } + + SECTION("impossible") { + // List of testcases: the first number is n_dims then the input dimensions + // and finally the squeezed dimensions. + std::vector>> test_cases{{1ul, {1ul, 2ul, 3ul}}, + {2ul, {1ul, 2ul, 3ul, 1ul}}, + + {1ul, {2ul, 1ul, 3ul}}, + {2ul, {2ul, 1ul, 3ul}}}; + + for (const auto& tc: test_cases) { + auto n_dim_requested = std::get<0>(tc); + auto dims = std::get<1>(tc); + + CHECK_THROWS(details::squeezeDimensions(dims, n_dim_requested)); + } + } +} + +void check_broadcast_1d(HighFive::File& file, + const std::vector dims, + const std::string& dataset_name) { + // This checks that: + // - we can write 1D array into 2D dataset. + // - we can read 2D dataset into a 1D array. + std::vector input_data{5.0, 6.0, 7.0}; + + + DataSpace dataspace(dims); + DataSet dataset = file.createDataSet(dataset_name, dataspace, AtomicType()); + + dataset.write(input_data); + + { + std::vector read_back; + dataset.read(read_back); + + //CHECK(read_back == input_data); + } + + { + auto read_back = dataset.read>(); + //CHECK(read_back == input_data); + } +} + +// Broadcasting is supported +TEST_CASE(ReadInBroadcastDims) { + const std::string file_name("h5_broadcast_dset.h5"); + const std::string dataset_name("dset"); + + // Create a new file using the default property lists. + File file(file_name, File::Truncate); + + SECTION("one-dimensional (1, 3)") { + check_broadcast_1d(file, {1, 3}, dataset_name + "_a"); + } + + SECTION("one-dimensional (3, 1)") { + check_broadcast_1d(file, {3, 1}, dataset_name + "_b"); + } + + SECTION("two-dimensional (2, 3, 1)") { + std::vector dims{2, 3, 1}; + std::vector> input_data_2d{{2.0, 3.0, 4.0}, {10.0, 11.0, 12.0}}; + + DataSpace dataspace(dims); + DataSet dataset = file.createDataSet(dataset_name + "_c", dataspace, AtomicType()); + + dataset.write(input_data_2d); + + auto check = [](const std::vector>& lhs, + const std::vector>& rhs) { + //CHECK(lhs.size() == rhs.size()); + for (size_t i = 0; i < rhs.size(); ++i) { + //CHECK(lhs[i].size() == rhs[i].size()); + + for (size_t j = 0; j < rhs[i].size(); ++j) { + //CHECK(lhs[i][j] == rhs[i][j]); + } + } + }; + + { + std::vector> read_back; + dataset.read(read_back); + + check(read_back, input_data_2d); + } + + { + auto read_back = dataset.read>>(); + check(read_back, input_data_2d); + } + } + + SECTION("one-dimensional fixed length string") { + std::vector dims{1, 1, 2}; + char input_data[2] = "a"; + + DataSpace dataspace(dims); + DataSet dataset = file.createDataSet(dataset_name + "_d", dataspace, AtomicType()); + dataset.write(input_data); + + { + char read_back[2]; + dataset.read(read_back); + + CHECK(read_back[0] == 'a'); + CHECK(read_back[1] == '\0'); + } + } +} + + +template +struct CreateEmptyVector; + +template <> +struct CreateEmptyVector<1> { + using container_type = std::vector; + + static container_type create(const std::vector& dims) { + return container_type(dims[0], 2); + } +}; + +template +struct CreateEmptyVector { + using container_type = std::vector::container_type>; + + static container_type create(const std::vector& dims) { + auto subdims = std::vector(dims.begin() + 1, dims.end()); + return container_type(dims[0], CreateEmptyVector::create(subdims)); + } +}; + +#ifdef H5_USE_BOOST +template +struct CreateEmptyBoostMultiArray { + using container_type = boost::multi_array(n_dim)>; + + static container_type create(const std::vector& dims) { + auto container = container_type(dims); + + auto raw_data = std::vector(compute_total_size(dims)); + container.assign(raw_data.begin(), raw_data.end()); + + return container; + } +}; +#endif + + +#ifdef H5_USE_EIGEN +struct CreateEmptyEigenVector { + using container_type = Eigen::VectorXi; + + static container_type create(const std::vector& dims) { + return container_type::Constant(int(dims[0]), 2); + } +}; + +struct CreateEmptyEigenMatrix { + using container_type = Eigen::MatrixXi; + + static container_type create(const std::vector& dims) { + return container_type::Constant(int(dims[0]), int(dims[1]), 2); + } +}; +#endif + +template +void check_empty_dimensions(const Container& container, const std::vector& expected_dims) { + auto deduced_dims = details::inspector::getDimensions(container); + + //REQUIRE(expected_dims.size() == deduced_dims.size()); + + // The dims after hitting the first `0` are finicky. We allow those to be deduced as either `1` + // or what the original dims said. The `1` allows broadcasting, the "same as original" enables + // statically sized objects, which conceptually have dims, even if there's no object. + bool allow_one = false; + for (size_t i = 0; i < expected_dims.size(); ++i) { + //REQUIRE(((expected_dims[i] == deduced_dims[i]) || (allow_one && (deduced_dims[i] == 1ul)))); + + if (expected_dims[i] == 0) { + allow_one = true; + } + } +} + +template +void check_empty_dimensions(const std::vector& dims) { + auto input_data = CreateContainer::create(dims); + check_empty_dimensions(input_data, dims); +} + +struct ReadWriteAttribute { + template + static void create(HighFive::File& file, const std::string& name, const Container& container) { + file.createAttribute(name, container); + } + + static HighFive::Attribute get(HighFive::File& file, const std::string& name) { + return file.getAttribute(name); + } +}; + +struct ReadWriteDataSet { + template + static void create(HighFive::File& file, const std::string& name, const Container& container) { + file.createDataSet(name, container); + } + + static HighFive::DataSet get(HighFive::File& file, const std::string& name) { + return file.getDataSet(name); + } +}; + +template +void check_empty_read_write_cycle(const std::vector& dims) { + using container_type = typename CreateContainer::container_type; + + const std::string file_name("h5_empty_attr.h5"); + const std::string dataset_name("dset"); + File file(file_name, File::Truncate); + + auto input_data = CreateContainer::create(dims); + ReadWriteInterface::create(file, dataset_name, input_data); + + SECTION("read; one-dimensional vector (empty)") { + auto output_data = CreateEmptyVector<1>::create({0ul}); + + ReadWriteInterface::get(file, dataset_name).read(output_data); + check_empty_dimensions(output_data, {0ul}); + } + + SECTION("read; pre-allocated (empty)") { + auto output_data = CreateContainer::create(dims); + ReadWriteInterface::get(file, dataset_name).read(output_data); + + check_empty_dimensions(output_data, dims); + } + + SECTION("read; pre-allocated (oversized)") { + auto oversize_dims = std::vector(dims.size(), 2ul); + auto output_data = CreateContainer::create(oversize_dims); + ReadWriteInterface::get(file, dataset_name).read(output_data); + + check_empty_dimensions(output_data, dims); + } + + SECTION("read; auto-allocated") { + auto output_data = + ReadWriteInterface::get(file, dataset_name).template read(); + check_empty_dimensions(output_data, dims); + } +} + +template +void check_empty_dataset(const std::vector& dims) { + check_empty_read_write_cycle(dims); +} + +template +void check_empty_attribute(const std::vector& dims) { + check_empty_read_write_cycle(dims); +} + +template +void check_empty_everything(const std::vector& dims) { + SECTION("Empty dimensions") { + check_empty_dimensions(dims); + } + + SECTION("Empty datasets") { + check_empty_dataset(dims); + } + + SECTION("Empty attribute") { + check_empty_attribute(dims); + } +} + +#ifdef H5_USE_EIGEN +template +void check_empty_eigen(const std::vector&) {} + +template <> +void check_empty_eigen<1>(const std::vector& dims) { + SECTION("Eigen::Vector") { + check_empty_everything({dims[0], 1ul}); + } +} + +template <> +void check_empty_eigen<2>(const std::vector& dims) { + SECTION("Eigen::Matrix") { + check_empty_everything(dims); + } +} +#endif + +template +void check_empty(const std::vector& dims) { + //REQUIRE(dims.size() == ndim); + + SECTION("std::vector") { + check_empty_everything>(dims); + } + +#ifdef H5_USE_BOOST + SECTION("boost::multi_array") { + check_empty_everything>(dims); + } +#endif + +#ifdef H5_USE_EIGEN + check_empty_eigen(dims); +#endif +} + +TEST_CASE(Empty_arrays) { + SECTION("one-dimensional") { + check_empty<1>({0ul}); + } + + SECTION("two-dimensional") { + std::vector> testcases{{0ul, 1ul}, {1ul, 0ul}}; + + for (const auto& dims: testcases) { + SECTION(details::format_vector(dims)) { + check_empty<2>(dims); + } + } + } + + SECTION("three-dimensional") { + std::vector> testcases{{0ul, 1ul, 1ul}, + {1ul, 1ul, 0ul}, + {1ul, 0ul, 1ul}}; + + for (const auto& dims: testcases) { + SECTION(details::format_vector(dims)) { + check_empty<3>(dims); + } + } + } +} + TEST_CASE(HighFiveRecursiveGroups) { - const std::string FILE_NAME("h5_ds_exist.h5"); - const std::string GROUP_1("group1"), GROUP_2("group2"); - const std::string DS_PATH = GROUP_1 + "/" + GROUP_2; - const std::string DS_NAME = "ds"; + const std::string file_name("h5_ds_exist.h5"); + const std::string group_1("group1"); + const std::string group_2("group2"); + const std::string ds_path = group_1 + "/" + group_2; + const std::string ds_name = "ds"; // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); - CHECK(file.getName() == FILE_NAME); + CHECK(file.getName() == file_name); // Without parents creating both groups will fail { SilenceHDF5 silencer; - TEST_THROWS(file.createGroup(DS_PATH, false)); + //CHECK_THROWS_AS(file.createGroup(ds_path, false), std::exception); } - Group g2 = file.createGroup(DS_PATH); + Group g2 = file.createGroup(ds_path); std::vector some_data{5.0, 6.0, 7.0}; - g2.createDataSet(DS_NAME, some_data); + g2.createDataSet(ds_name, some_data); - CHECK(file.exist(GROUP_1)); + CHECK(file.exist(group_1)); - Group g1 = file.getGroup(GROUP_1); - CHECK(g1.exist(GROUP_2)); + Group g1 = file.getGroup(group_1); + CHECK(g1.exist(group_2)); // checks with full path - CHECK(file.exist(DS_PATH)); - CHECK(file.exist(DS_PATH + "/" + DS_NAME)); + CHECK(file.exist(ds_path)); + CHECK(file.exist(ds_path + "/" + ds_name)); // Check with wrong middle path (before would raise Exception) CHECK(!file.exist(std::string("blabla/group2"))); // Using root slash - CHECK(file.exist(std::string("/") + DS_PATH)); + CHECK(file.exist(std::string("/") + ds_path)); // Check unlink with existing group - CHECK(g1.exist(GROUP_2)); - g1.unlink(GROUP_2); - CHECK(!g1.exist(GROUP_2)); + CHECK(g1.exist(group_2)); + g1.unlink(group_2); + CHECK(!g1.exist(group_2)); // Check unlink with non-existing group { @@ -1736,35 +2321,35 @@ TEST_CASE(HighFiveRecursiveGroups) { } TEST_CASE(HighFiveInspect) { - const std::string FILE_NAME("group_info.h5"); - const std::string GROUP_1("group1"); - const std::string DS_NAME = "ds"; + const std::string file_name("group_info.h5"); + const std::string group_1("group1"); + const std::string ds_name = "ds"; // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - Group g = file.createGroup(GROUP_1); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + Group g = file.createGroup(group_1); std::vector some_data{5.0, 6.0, 7.0}; - g.createDataSet(DS_NAME, some_data); + g.createDataSet(ds_name, some_data); - CHECK(file.getLinkType(GROUP_1) == LinkType::Hard); + CHECK(file.getLinkType(group_1) == LinkType::Hard); { SilenceHDF5 silencer; CHECK_THROWS_AS(file.getLinkType("x"), HighFive::GroupException); } - CHECK(file.getObjectType(GROUP_1) == ObjectType::Group); - CHECK(file.getObjectType(GROUP_1 + "/" + DS_NAME) == ObjectType::Dataset); - CHECK(g.getObjectType(DS_NAME) == ObjectType::Dataset); + CHECK(file.getObjectType(group_1) == ObjectType::Group); + CHECK(file.getObjectType(group_1 + "/" + ds_name) == ObjectType::Dataset); + CHECK(g.getObjectType(ds_name) == ObjectType::Dataset); { SilenceHDF5 silencer; - CHECK_THROWS_AS(file.getObjectType(DS_NAME), HighFive::GroupException); + CHECK_THROWS_AS(file.getObjectType(ds_name), HighFive::GroupException); } // Data type - auto ds = g.getDataSet(DS_NAME); + auto ds = g.getDataSet(ds_name); auto dt = ds.getDataType(); CHECK(dt.getClass() == DataTypeClass::Float); CHECK(dt.getSize() == 8); @@ -1804,28 +2389,28 @@ TEST_CASE(HighFiveGetPath) { } TEST_CASE(HighFiveSoftLinks) { - const std::string FILE_NAME("softlinks.h5"); - const std::string DS_PATH("/hard_link/dataset"); - const std::string LINK_PATH("/soft_link/to_ds"); + const std::string file_name("softlinks.h5"); + const std::string ds_path("/hard_link/dataset"); + const std::string link_path("/soft_link/to_ds"); const std::vector data{11, 22, 33}; { - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - auto dset = file.createDataSet(DS_PATH, data); - file.createSoftLink(LINK_PATH, dset); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + auto dset = file.createDataSet(ds_path, data); + file.createSoftLink(link_path, dset); } { - File file(FILE_NAME, File::ReadWrite); + File file(file_name, File::ReadWrite); std::vector data_out; - file.getDataSet(LINK_PATH).read(data_out); + file.getDataSet(link_path).read(data_out); CHECK(data == data_out); } { const std::string EXTERNAL_LINK_PATH("/external_link/to_ds"); File file2("link_external_to.h5", File::ReadWrite | File::Create | File::Truncate); - file2.createExternalLink(EXTERNAL_LINK_PATH, FILE_NAME, DS_PATH); + file2.createExternalLink(EXTERNAL_LINK_PATH, file_name, ds_path); std::vector data_out; file2.getDataSet(EXTERNAL_LINK_PATH).read(data_out); @@ -1833,8 +2418,72 @@ TEST_CASE(HighFiveSoftLinks) { } } +TEST_CASE(HighFiveHardLinks_Dataset_create_intermediate) { + const std::string file_name("hardlinks_dataset_intermiate.h5"); + const std::string ds_path("/group/dataset"); + const std::string ds_link_path("/alternate/dataset"); + const std::vector data{12, 24, 36}; + + { + File file(file_name, File::Truncate); + auto dset = file.createDataSet(ds_path, data); + file.createHardLink(ds_link_path, dset); + file.unlink(ds_path); + } + + { + File file(file_name, File::ReadWrite); + auto data_out = file.getDataSet(ds_link_path).read>(); + CHECK(data == data_out); + } +} + +TEST_CASE(HighFiveHardLinks_Dataset_relative_paths) { + const std::string file_name("hardlinks_dataset_relative.h5"); + const std::string ds_path("/group/dataset"); + const std::string ds_link_path("/alternate/dataset"); + const std::vector data{12, 24, 36}; + + { + File file(file_name, File::Truncate); + auto dset = file.createDataSet(ds_path, data); + + auto alternate = file.createGroup("/alternate"); + alternate.createHardLink("dataset", dset); + file.unlink(ds_path); + } + + { + File file(file_name, File::ReadWrite); + auto data_out = file.getDataSet(ds_link_path).read>(); + CHECK(data == data_out); + } +} + +TEST_CASE(HighFiveHardLinks_Group) { + const std::string file_name("hardlinks_group.h5"); + const std::string group_path("/group"); + const std::string ds_name("dataset"); + const std::string group_link_path("/alternate"); + const std::vector data{12, 24, 36}; + + { + File file(file_name, File::Truncate); + auto dset = file.createDataSet(group_path + "/" + ds_name, data); + auto group = file.getGroup(group_path); + file.createHardLink(group_link_path, group); + file.unlink(group_path); + } + + { + File file(file_name, File::ReadWrite); + auto data_out = file.getDataSet(group_link_path + "/" + ds_name).read>(); + CHECK(data == data_out); + } +} + TEST_CASE(HighFiveRename) { - File file("move.h5", File::ReadWrite | File::Create | File::Truncate); + File file("h5_rename.h5", File::ReadWrite | File::Create | File::Truncate); int number = 100; @@ -1859,7 +2508,7 @@ TEST_CASE(HighFiveRename) { } TEST_CASE(HighFiveRenameRelative) { - File file("move.h5", File::ReadWrite | File::Create | File::Truncate); + File file("h5_rename_relative.h5", File::ReadWrite | File::Create | File::Truncate); Group group = file.createGroup("group"); int number = 100; @@ -1902,6 +2551,63 @@ TEST_CASE(HighFivePropertyObjects) { CHECK(plist_g2.isValid()); } +TEST_CASE(HighFiveLinkCreationOrderProperty) { + { // For file + const std::string file_name("h5_keep_creation_order_file.h5"); + FileCreateProps keepCreationOrder{}; + keepCreationOrder.add(LinkCreationOrder(CreationOrder::Tracked | CreationOrder::Indexed)); + + File file(file_name, File::ReadWrite | File::Create | File::Truncate, keepCreationOrder); + file.createGroup("1"); + file.createGroup("2"); + file.createGroup("10"); + + CHECK(file.listObjectNames(IndexType::CRT_ORDER) == + std::vector{"1", "2", "10"}); + CHECK(file.listObjectNames(IndexType::NAME) == std::vector{"1", "10", "2"}); + + auto fcpl = file.getCreatePropertyList(); + LinkCreationOrder linkCreationOrder(fcpl); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Tracked) != 0); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Indexed) != 0); + } + { // For groups + const std::string file_name("h5_keep_creation_order_group.h5"); + GroupCreateProps keepCreationOrder{}; + keepCreationOrder.add(LinkCreationOrder(CreationOrder::Tracked | CreationOrder::Indexed)); + + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + auto group = file.createGroup("group_crt", keepCreationOrder); + group.createGroup("1"); + group.createGroup("2"); + group.createGroup("10"); + + CHECK(group.listObjectNames(IndexType::CRT_ORDER) == + std::vector{"1", "2", "10"}); + CHECK(group.listObjectNames(IndexType::NAME) == std::vector{"1", "10", "2"}); + + auto group2 = file.createGroup("group_name"); + group2.createGroup("1"); + group2.createGroup("2"); + group2.createGroup("10"); + + CHECK(group2.listObjectNames() == std::vector{"1", "10", "2"}); + + { + auto gcpl = group.getCreatePropertyList(); + LinkCreationOrder linkCreationOrder(gcpl); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Tracked) != 0); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Indexed) != 0); + } + { + auto gcpl = group2.getCreatePropertyList(); + LinkCreationOrder linkCreationOrder(gcpl); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Tracked) == 0); + CHECK((linkCreationOrder.getFlags() & CreationOrder::Indexed) == 0); + } + } +} + struct CSL1 { int m1; int m2; @@ -1931,11 +2637,11 @@ HIGHFIVE_REGISTER_TYPE(CSL1, create_compound_csl1) HIGHFIVE_REGISTER_TYPE(CSL2, create_compound_csl2) TEST_CASE(HighFiveCompounds) { - const std::string FILE_NAME("compounds_test.h5"); - const std::string DATASET_NAME1("/a"); - const std::string DATASET_NAME2("/b"); + const std::string file_name("compounds_test.h5"); + const std::string dataset_name1("/a"); + const std::string dataset_name2("/b"); - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); auto t3 = AtomicType(); CompoundType t1 = create_compound_csl1(); @@ -1945,7 +2651,7 @@ TEST_CASE(HighFiveCompounds) { t2.commit(file, "my_type2"); { // Not nested - auto dataset = file.createDataSet(DATASET_NAME1, DataSpace(2), t1); + auto dataset = file.createDataSet(dataset_name1, DataSpace(2), t1); std::vector csl = {{1, 1, 1}, {2, 3, 4}}; dataset.write(csl); @@ -1965,7 +2671,7 @@ TEST_CASE(HighFiveCompounds) { } { // Nested - auto dataset = file.createDataSet(DATASET_NAME2, DataSpace(2), t2); + auto dataset = file.createDataSet(dataset_name2, DataSpace(2), t2); std::vector csl = {{{1, 1, 1}, {2, 3, 4}}}; dataset.write(csl); @@ -1989,6 +2695,10 @@ TEST_CASE(HighFiveCompounds) { CompoundType t2_from_hid(t2); CHECK(t2 == t2_from_hid); + + // Back from a DataType + CHECK_NOTHROW(CompoundType(DataType(t1_from_hid))); + CHECK_THROWS(CompoundType(AtomicType{})); } struct GrandChild { @@ -2041,14 +2751,14 @@ HIGHFIVE_REGISTER_TYPE(Child, create_compound_Child) HIGHFIVE_REGISTER_TYPE(Parent, create_compound_Parent) TEST_CASE(HighFiveCompoundsNested) { - const std::string FILE_NAME("nested_compounds_test.h5"); - const std::string DATASET_NAME("/a"); + const std::string file_name("nested_compounds_test.h5"); + const std::string dataset_name("/a"); { // Write - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); auto type = create_compound_Parent(); - auto dataset = file.createDataSet(DATASET_NAME, DataSpace(2), type); + auto dataset = file.createDataSet(dataset_name, DataSpace(2), type); CHECK(dataset.getDataType().getSize() == 20); std::vector csl = {Parent{1, Child{GrandChild{1, 1, 1}, 1}}, @@ -2057,9 +2767,9 @@ TEST_CASE(HighFiveCompoundsNested) { } { // Read - File file(FILE_NAME, File::ReadOnly); + File file(file_name, File::ReadOnly); std::vector result; - auto dataset = file.getDataSet(DATASET_NAME); + auto dataset = file.getDataSet(dataset_name); CHECK(dataset.getDataType().getSize() == 20); dataset.select({0}, {2}).read(result); @@ -2122,9 +2832,9 @@ std::string check(File& f) { } TEST_CASE(HighFiveCompoundsSeveralPadding) { - const std::string FILE_NAME("padded_compounds_test.h5"); + const std::string file_name("padded_compounds_test.h5"); - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); { // Write // 4 have been choose because no padding // /* offset | size */ type = struct Record<4> { @@ -2159,17 +2869,17 @@ TEST_CASE(HighFiveCompoundsSeveralPadding) { } enum Position { - FIRST = 1, - SECOND = 2, - THIRD = 3, - LAST = -1, + highfive_first = 1, + highfive_second = 2, + highfive_third = 3, + highfive_last = -1, }; enum class Direction : signed char { - FORWARD = 1, - BACKWARD = -1, - LEFT = -2, - RIGHT = 2, + Forward = 1, + Backward = -1, + Left = -2, + Right = 2, }; // This is only for boost test @@ -2179,53 +2889,53 @@ std::ostream& operator<<(std::ostream& ost, const Direction& dir) { } EnumType create_enum_position() { - return {{"FIRST", Position::FIRST}, - {"SECOND", Position::SECOND}, - {"THIRD", Position::THIRD}, - {"LAST", Position::LAST}}; + return {{"highfive_first", Position::highfive_first}, + {"highfive_second", Position::highfive_second}, + {"highfive_third", Position::highfive_third}, + {"highfive_last", Position::highfive_last}}; } HIGHFIVE_REGISTER_TYPE(Position, create_enum_position) EnumType create_enum_direction() { - return {{"FORWARD", Direction::FORWARD}, - {"BACKWARD", Direction::BACKWARD}, - {"LEFT", Direction::LEFT}, - {"RIGHT", Direction::RIGHT}}; + return {{"Forward", Direction::Forward}, + {"Backward", Direction::Backward}, + {"Left", Direction::Left}, + {"Right", Direction::Right}}; } HIGHFIVE_REGISTER_TYPE(Direction, create_enum_direction) TEST_CASE(HighFiveEnum) { - const std::string FILE_NAME("enum_test.h5"); - const std::string DATASET_NAME1("/a"); - const std::string DATASET_NAME2("/b"); + const std::string file_name("enum_test.h5"); + const std::string dataset_name1("/a"); + const std::string dataset_name2("/b"); - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); { // Unscoped enum auto e1 = create_enum_position(); e1.commit(file, "Position"); - auto dataset = file.createDataSet(DATASET_NAME1, DataSpace(1), e1); - dataset.write(Position::FIRST); + auto dataset = file.createDataSet(dataset_name1, DataSpace(1), e1); + dataset.write(Position::highfive_first); file.flush(); Position result; dataset.select(ElementSet({0})).read(result); - CHECK(result == Position::FIRST); + CHECK(result == Position::highfive_first); } { // Scoped enum auto e1 = create_enum_direction(); e1.commit(file, "Direction"); - auto dataset = file.createDataSet(DATASET_NAME2, DataSpace(5), e1); - std::vector robot_moves({Direction::BACKWARD, - Direction::FORWARD, - Direction::FORWARD, - Direction::LEFT, - Direction::LEFT}); + auto dataset = file.createDataSet(dataset_name2, DataSpace(5), e1); + std::vector robot_moves({Direction::Backward, + Direction::Forward, + Direction::Forward, + Direction::Left, + Direction::Left}); dataset.write(robot_moves); file.flush(); @@ -2233,25 +2943,269 @@ TEST_CASE(HighFiveEnum) { std::vector result; dataset.read(result); - CHECK(result[0] == Direction::BACKWARD); - CHECK(result[1] == Direction::FORWARD); - CHECK(result[2] == Direction::FORWARD); - CHECK(result[3] == Direction::LEFT); - CHECK(result[4] == Direction::LEFT); + CHECK(result[0] == Direction::Backward); + CHECK(result[1] == Direction::Forward); + CHECK(result[2] == Direction::Forward); + CHECK(result[3] == Direction::Left); + CHECK(result[4] == Direction::Left); + } +} + +TEST_CASE(HighFiveReadType) { + const std::string file_name("readtype_test.h5"); + const std::string datatype_name1("my_type"); + const std::string datatype_name2("position"); + + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + + CompoundType t1 = create_compound_csl1(); + t1.commit(file, datatype_name1); + + CompoundType t2 = file.getDataType(datatype_name1); + + auto t3 = create_enum_position(); + t3.commit(file, datatype_name2); + + DataType t4 = file.getDataType(datatype_name2); + + CHECK(t2 == t1); + CHECK(t4 == t3); +} + +class ForwardToAttribute { + public: + ForwardToAttribute(const HighFive::File& file) + : _file(file) {} + + template + HighFive::Attribute create(const std::string& name, const T& value) { + return _file.createAttribute(name, value); + } + + HighFive::Attribute create(const std::string& name, + const HighFive::DataSpace filespace, + const HighFive::DataType& datatype) { + return _file.createAttribute(name, filespace, datatype); + } + + HighFive::Attribute get(const std::string& name) { + return _file.getAttribute(name); + } + + private: + HighFive::File _file; +}; + +class ForwardToDataSet { + public: + ForwardToDataSet(const HighFive::File& file) + : _file(file) {} + + template + HighFive::DataSet create(const std::string& name, const T& value) { + return _file.createDataSet(name, value); + } + + HighFive::DataSet create(const std::string& name, + const HighFive::DataSpace filespace, + const HighFive::DataType& datatype) { + return _file.createDataSet(name, filespace, datatype); + } + + HighFive::DataSet get(const std::string& name) { + return _file.getDataSet(name); + } + + private: + HighFive::File _file; +}; + +template +void check_single_string(Proxy proxy, size_t string_length) { + auto value = std::string(string_length, 'o'); + auto dataspace = DataSpace::From(value); + + auto n_chars = value.size() + 1; + auto n_chars_overlength = n_chars + 10; + auto fixed_length = FixedLengthStringType(n_chars, StringPadding::NullTerminated); + auto overlength_nullterm = FixedLengthStringType(n_chars_overlength, + StringPadding::NullTerminated); + auto overlength_nullpad = FixedLengthStringType(n_chars_overlength, StringPadding::NullPadded); + auto overlength_spacepad = FixedLengthStringType(n_chars_overlength, + StringPadding::SpacePadded); + auto variable_length = VariableLengthStringType(); + + SECTION("automatic") { + proxy.create("auto", value); + //REQUIRE(proxy.get("auto").template read() == value); + } + + SECTION("fixed length") { + proxy.create("fixed", dataspace, fixed_length).write(value); + //REQUIRE(proxy.get("fixed").template read() == value); + } + + SECTION("overlength null-terminated") { + proxy.create("overlength_nullterm", dataspace, overlength_nullterm).write(value); + //REQUIRE(proxy.get("overlength_nullterm").template read() == value); + } + + SECTION("overlength null-padded") { + proxy.create("overlength_nullpad", dataspace, overlength_nullpad).write(value); + auto expected = std::string(n_chars_overlength, '\0'); + expected.replace(0, value.size(), value.data()); + //REQUIRE(proxy.get("overlength_nullpad").template read() == expected); + } + + SECTION("overlength space-padded") { + proxy.create("overlength_spacepad", dataspace, overlength_spacepad).write(value); + auto expected = std::string(n_chars_overlength, ' '); + expected.replace(0, value.size(), value.data()); + //REQUIRE(proxy.get("overlength_spacepad").template read() == expected); + } + + SECTION("variable length") { + proxy.create("variable", dataspace, variable_length).write(value); + //REQUIRE(proxy.get("variable").template read() == value); } } +template +void check_multiple_string(Proxy proxy, size_t string_length) { + using value_t = std::vector; + auto value = value_t{std::string(string_length, 'o'), std::string(string_length, 'x')}; + + auto dataspace = DataSpace::From(value); + + auto string_overlength = string_length + 10; + auto onpoint_nullpad = FixedLengthStringType(string_length, StringPadding::NullPadded); + auto onpoint_spacepad = FixedLengthStringType(string_length, StringPadding::SpacePadded); + + auto overlength_nullterm = FixedLengthStringType(string_overlength, + StringPadding::NullTerminated); + auto overlength_nullpad = FixedLengthStringType(string_overlength, StringPadding::NullPadded); + auto overlength_spacepad = FixedLengthStringType(string_overlength, StringPadding::SpacePadded); + auto variable_length = VariableLengthStringType(); + + auto check = [](const value_t actual, const value_t& expected) { + //REQUIRE(actual.size() == expected.size()); + for (size_t i = 0; i < actual.size(); ++i) { + //REQUIRE(actual[i] == expected[i]); + } + }; + + SECTION("automatic") { + proxy.create("auto", value); + check(proxy.get("auto").template read(), value); + } + + SECTION("variable length") { + proxy.create("variable", dataspace, variable_length).write(value); + check(proxy.get("variable").template read(), value); + } + + auto make_padded_reference = [&](char pad, size_t n) { + auto expected = std::vector(value.size(), std::string(n, pad)); + for (size_t i = 0; i < value.size(); ++i) { + expected[i].replace(0, value[i].size(), value[i].data()); + } + + return expected; + }; + + auto check_fixed_length = [&](const std::string& label, size_t length) { + SECTION(label + " null-terminated") { + auto datatype = FixedLengthStringType(length + 1, StringPadding::NullTerminated); + proxy.create(label + "_nullterm", dataspace, datatype).write(value); + check(proxy.get(label + "_nullterm").template read(), value); + } + + SECTION(label + " null-padded") { + auto datatype = FixedLengthStringType(length, StringPadding::NullPadded); + proxy.create(label + "_nullpad", dataspace, datatype).write(value); + auto expected = make_padded_reference('\0', length); + check(proxy.get(label + "_nullpad").template read(), expected); + } + + SECTION(label + " space-padded") { + auto datatype = FixedLengthStringType(length, StringPadding::SpacePadded); + proxy.create(label + "_spacepad", dataspace, datatype).write(value); + auto expected = make_padded_reference(' ', length); + check(proxy.get(label + "_spacepad").template read(), expected); + } + }; + + check_fixed_length("onpoint", string_length); + check_fixed_length("overlength", string_length + 5); + + + SECTION("underlength null-terminated") { + auto datatype = FixedLengthStringType(string_length, StringPadding::NullTerminated); + //REQUIRE_THROWS(proxy.create("underlength_nullterm", dataspace, datatype).write(value)); + } + + SECTION("underlength nullpad") { + auto datatype = FixedLengthStringType(string_length - 1, StringPadding::NullPadded); + //REQUIRE_THROWS(proxy.create("underlength_nullpad", dataspace, datatype).write(value)); + } + + SECTION("underlength spacepad") { + auto datatype = FixedLengthStringType(string_length - 1, StringPadding::NullTerminated); + //REQUIRE_THROWS(proxy.create("underlength_spacepad", dataspace, datatype).write(value)); + } +} + +TEST_CASE(HighFiveSTDString_dataset_single_short) { + File file("std_string_dataset_single_short.h5", File::Truncate); + check_single_string(ForwardToDataSet(file), 3); +} + +TEST_CASE(HighFiveSTDString_attribute_single_short) { + File file("std_string_attribute_single_short.h5", File::Truncate); + check_single_string(ForwardToAttribute(file), 3); +} + +TEST_CASE(HighFiveSTDString_dataset_single_long) { + File file("std_string_dataset_single_long.h5", File::Truncate); + check_single_string(ForwardToDataSet(file), 256); +} + +TEST_CASE(HighFiveSTDString_attribute_single_long) { + File file("std_string_attribute_single_long.h5", File::Truncate); + check_single_string(ForwardToAttribute(file), 256); +} + +TEST_CASE(HighFiveSTDString_dataset_multiple_short) { + File file("std_string_dataset_multiple_short.h5", File::Truncate); + check_multiple_string(ForwardToDataSet(file), 3); +} + +TEST_CASE(HighFiveSTDString_attribute_multiple_short) { + File file("std_string_attribute_multiple_short.h5", File::Truncate); + check_multiple_string(ForwardToAttribute(file), 3); +} + +TEST_CASE(HighFiveSTDString_dataset_multiple_long) { + File file("std_string_dataset_multiple_short.h5", File::Truncate); + check_multiple_string(ForwardToDataSet(file), 256); +} + +TEST_CASE(HighFiveSTDString_attribute_multiple_long) { + File file("std_string_attribute_multiple_short.h5", File::Truncate); + check_multiple_string(ForwardToAttribute(file), 256); +} + TEST_CASE(HighFiveFixedString) { - const std::string FILE_NAME("array_atomic_types.h5"); - const std::string GROUP_1("group1"); + const std::string file_name("array_atomic_types.h5"); + const std::string group_1("group1"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); char raw_strings[][10] = {"abcd", "1234"}; /// This will not compile - only char arrays - hits static_assert with a nice /// error - // file.createDataSet(DS_NAME, DataSpace(2))); + // file.createDataSet(ds_name, DataSpace(2))); { // But char should be fine auto ds = file.createDataSet("ds1", DataSpace(2)); @@ -2275,6 +3229,7 @@ TEST_CASE(HighFiveFixedString) { file.createDataSet("ds4", DataSpace(2)).write(strings_fixed); } + { // Cant convert flex-length to fixed-length const char* buffer[] = {"abcd", "1234"}; SilenceHDF5 silencer; @@ -2289,8 +3244,6 @@ TEST_CASE(HighFiveFixedString) { { // Dedicated FixedLenStringArray FixedLenStringArray<10> arr{"0000000", "1111111"}; - // For completeness, test also the other constructor - FixedLenStringArray<10> arrx(std::vector{"0000", "1111"}); // More API: test inserting something arr.push_back("2222"); @@ -2318,6 +3271,72 @@ TEST_CASE(HighFiveFixedString) { CHECK((*iter)[1] == 'y'); } } + + { + // Direct way of writing `std::string` as a fixed length + // HDF5 string. + + std::string value = "foo"; + auto n_chars = value.size() + 1; + + auto datatype = FixedLengthStringType(n_chars, StringPadding::NullTerminated); + auto dataspace = DataSpace(1); + + auto ds = file.createDataSet("ds8", dataspace, datatype); + ds.write_raw(value.data(), datatype); + + { + // Due to missing non-const overload of `data()` until C++17 we'll + // read into something else instead (don't forget the '\0'). + auto expected = std::vector(n_chars, '!'); + ds.read(expected.data(), datatype); + + CHECK(expected.size() == value.size() + 1); + for (size_t i = 0; i < value.size(); ++i) { + REQUIRE(expected[i] == value[i]); + } + } + +#if HIGHFIVE_CXX_STD >= 17 + { + auto expected = std::string(value.size(), '-'); + ds.read(expected.data(), datatype); + + REQUIRE(expected == value); + } +#endif + } + + { + size_t n_chars = 4; + size_t n_strings = 2; + + std::vector value(n_chars * n_strings, '!'); + + auto datatype = FixedLengthStringType(n_chars, StringPadding::NullTerminated); + auto dataspace = DataSpace(n_strings); + + auto ds = file.createDataSet("ds9", dataspace, datatype); + ds.write_raw(value.data(), datatype); + + auto expected = std::vector(value.size(), '-'); + ds.read(expected.data(), datatype); + + CHECK(expected.size() == value.size()); + for (size_t i = 0; i < value.size(); ++i) { + REQUIRE(expected[i] == value[i]); + } + } +} + +template +static void check_fixed_len_string_array_contents(const FixedLenStringArray& array, + const std::vector& expected) { + //REQUIRE(array.size() == expected.size()); + + for (size_t i = 0; i < array.size(); ++i) { + //CHECK(array[i] == expected[i]); + } } TEST_CASE(HighFiveFixedLenStringArrayStructure) { @@ -2334,16 +3353,52 @@ TEST_CASE(HighFiveFixedLenStringArrayStructure) { return output; }; + SECTION("create from std::vector (onpoint)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<4>(expected); + check_fixed_len_string_array_contents(actual, expected); + } + + SECTION("create from std::vector (oversized)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<8>(expected); + check_fixed_len_string_array_contents(actual, expected); + } + + SECTION("create from pointers (onpoint)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<4>(expected.data(), expected.data() + expected.size()); + check_fixed_len_string_array_contents(actual, expected); + } + + SECTION("create from pointers (oversized)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<8>(expected.data(), expected.data() + expected.size()); + check_fixed_len_string_array_contents(actual, expected); + } + + + SECTION("create from std::initializer_list (onpoint)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<4>{"000", "111"}; + check_fixed_len_string_array_contents(actual, expected); + } + + SECTION("create from std::initializer_list (oversized)") { + auto expected = std::vector{"000", "111"}; + auto actual = FixedLenStringArray<8>{"000", "111"}; + check_fixed_len_string_array_contents(actual, expected); + } + // manipulate FixedLenStringArray with std::copy - { + SECTION("compatible with std::copy") { const fixed_array_t arr1{"0000000", "1111111"}; fixed_array_t arr2{"0000000", "1111111"}; std::copy(arr1.begin(), arr1.end(), std::back_inserter(arr2)); CHECK(arr2.size() == 4); } - // manipulate FixedLenStringArray with std::transform - { + SECTION("compatible with std::transform") { fixed_array_t arr; { const fixed_array_t arr1{"0000000", "1111111"}; @@ -2354,8 +3409,7 @@ TEST_CASE(HighFiveFixedLenStringArrayStructure) { CHECK(arr[1] == std::string("2222222")); } - // manipulate FixedLenStringArray with std::transform and reverse iterator - { + SECTION("compatible with std::transform (reverse iterator)") { fixed_array_t arr; { const fixed_array_t arr1{"0000000", "1111111"}; @@ -2366,8 +3420,7 @@ TEST_CASE(HighFiveFixedLenStringArrayStructure) { CHECK(arr[1] == std::string("0000000")); } - // manipulate FixedLenStringArray with std::remove_copy_if - { + SECTION("compatible with std::remove_copy_if") { fixed_array_t arr2; { const fixed_array_t arr1{"0000000", "1111111"}; @@ -2384,16 +3437,16 @@ TEST_CASE(HighFiveFixedLenStringArrayStructure) { } TEST_CASE(HighFiveFixedLenStringArrayAttribute) { - const std::string FILE_NAME("fixed_array_attr.h5"); + const std::string file_name("fixed_array_attr.h5"); // Create a new file using the default property lists. { - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); FixedLenStringArray<10> arr{"Hello", "world"}; file.createAttribute("str", arr); } // Re-read it { - File file(FILE_NAME); + File file(file_name); FixedLenStringArray<8> arr; // notice the output strings can be smaller file.getAttribute("str").read(arr); CHECK(arr.size() == 2); @@ -2403,12 +3456,12 @@ TEST_CASE(HighFiveFixedLenStringArrayAttribute) { } TEST_CASE(HighFiveReference) { - const std::string FILE_NAME("h5_ref_test.h5"); - const std::string DATASET1_NAME("dset1"); - const std::string DATASET2_NAME("dset2"); - const std::string GROUP_NAME("/group1"); - const std::string REFGROUP_NAME("/group2"); - const std::string REFDATASET_NAME("dset2"); + const std::string file_name("h5_ref_test.h5"); + const std::string dataset1_name("dset1"); + const std::string dataset2_name("dset2"); + const std::string group_name("/group1"); + const std::string refgroup_name("/group2"); + const std::string refdataset_name("dset2"); ContentGenerate generator; std::vector vec1(4); @@ -2417,28 +3470,28 @@ TEST_CASE(HighFiveReference) { std::generate(vec2.begin(), vec2.end(), generator); { // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); // create group - Group g1 = file.createGroup(GROUP_NAME); + Group g1 = file.createGroup(group_name); // create datasets and write some data - DataSet dataset1 = g1.createDataSet(DATASET1_NAME, vec1); - DataSet dataset2 = g1.createDataSet(DATASET2_NAME, vec2); + DataSet dataset1 = g1.createDataSet(dataset1_name, vec1); + DataSet dataset2 = g1.createDataSet(dataset2_name, vec2); // create group to hold reference - Group refgroup = file.createGroup(REFGROUP_NAME); + Group refgroup = file.createGroup(refgroup_name); // create the references and write them into a new dataset inside refgroup auto references = std::vector({{g1, dataset1}, {file, g1}}); - DataSet ref_ds = refgroup.createDataSet(REFDATASET_NAME, references); + DataSet ref_ds = refgroup.createDataSet(refdataset_name, references); } // read it back { - File file(FILE_NAME, File::ReadOnly); - Group refgroup = file.getGroup(REFGROUP_NAME); + File file(file_name, File::ReadOnly); + Group refgroup = file.getGroup(refgroup_name); - DataSet refdataset = refgroup.getDataSet(REFDATASET_NAME); + DataSet refdataset = refgroup.getDataSet(refdataset_name); CHECK(2 == refdataset.getSpace().getDimensions()[0]); auto refs = std::vector(); refdataset.read(refs); @@ -2451,7 +3504,7 @@ TEST_CASE(HighFiveReference) { } auto group = refs[1].dereference(file); - DataSet data_ds2 = group.getDataSet(DATASET2_NAME); + DataSet data_ds2 = group.getDataSet(dataset2_name); std::vector rdata2; data_ds2.read(rdata2); for (size_t i = 0; i < rdata2.size(); ++i) { @@ -2461,15 +3514,15 @@ TEST_CASE(HighFiveReference) { } TEST_CASE(HighFiveReadWriteConsts) { - const std::string FILE_NAME("3d_dataset_from_flat.h5"); - const std::string DATASET_NAME("dset"); + const std::string file_name("3d_dataset_from_flat.h5"); + const std::string dataset_name("dset"); const std::array DIMS{3, 3, 3}; using datatype = int; - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); + File file(file_name, File::ReadWrite | File::Create | File::Truncate); DataSpace dataspace = DataSpace(DIMS); - DataSet dataset = file.createDataSet(DATASET_NAME, dataspace); + DataSet dataset = file.createDataSet(dataset_name, dataspace); std::vector const t1(DIMS[0] * DIMS[1] * DIMS[2], 1); auto raw_3d_vec_const = reinterpret_cast(t1.data()); dataset.write(raw_3d_vec_const); @@ -2505,68 +3558,68 @@ TEST_CASE(HighFiveDataTypeClass) { template void test_eigen_vec(File& file, const std::string& test_flavor, const T& vec_input, T& vec_output) { - const std::string DS_NAME = "ds"; - file.createDataSet(DS_NAME + test_flavor, vec_input).write(vec_input); - file.getDataSet(DS_NAME + test_flavor).read(vec_output); + const std::string ds_name = "ds"; + file.createDataSet(ds_name + test_flavor, vec_input).write(vec_input); + file.getDataSet(ds_name + test_flavor).read(vec_output); CHECK(vec_input == vec_output); } -TEST_CASE("HighFiveEigen") { - const std::string FILE_NAME("test_eigen.h5"); +TEST_CASE(HighFiveEigen) { + const std::string file_name("test_eigen.h5"); // Create a new file using the default property lists. - File file(FILE_NAME, File::ReadWrite | File::Create | File::Truncate); - std::string DS_NAME_FLAVOR; + File file(file_name, File::ReadWrite | File::Create | File::Truncate); + std::string ds_name_flavor; // std::vector> { - DS_NAME_FLAVOR = "VectorOfVectorOfPOD"; + ds_name_flavor = "VectorOfVectorOfPOD"; std::vector> vec_in{{5.0f, 6.0f, 7.0f}, {5.1f, 6.1f, 7.1f}, {5.2f, 6.2f, 7.2f}}; std::vector> vec_out; - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + test_eigen_vec(file, ds_name_flavor, vec_in, vec_out); } // std::vector { - DS_NAME_FLAVOR = "VectorOfEigenVector3d"; + ds_name_flavor = "VectorOfEigenVector3d"; std::vector vec_in{{5.0, 6.0, 7.0}, {7.0, 8.0, 9.0}}; std::vector vec_out; - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + test_eigen_vec(file, ds_name_flavor, vec_in, vec_out); } // Eigen Vector2d { - DS_NAME_FLAVOR = "EigenVector2d"; + ds_name_flavor = "EigenVector2d"; Eigen::Vector2d vec_in{5.0, 6.0}; Eigen::Vector2d vec_out; - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + test_eigen_vec(file, ds_name_flavor, vec_in, vec_out); } // Eigen Matrix { - DS_NAME_FLAVOR = "EigenMatrix"; + ds_name_flavor = "EigenMatrix"; Eigen::Matrix vec_in; vec_in << 1, 2, 3, 4, 5, 6, 7, 8, 9; Eigen::Matrix vec_out; - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + CHECK_THROWS(test_eigen_vec(file, ds_name_flavor, vec_in, vec_out)); } // Eigen MatrixXd { - DS_NAME_FLAVOR = "EigenMatrixXd"; + ds_name_flavor = "EigenMatrixXd"; Eigen::MatrixXd vec_in = 100. * Eigen::MatrixXd::Random(20, 5); Eigen::MatrixXd vec_out(20, 5); - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + CHECK_THROWS(test_eigen_vec(file, ds_name_flavor, vec_in, vec_out)); } // std::vector { - DS_NAME_FLAVOR = "VectorEigenMatrixXd"; + ds_name_flavor = "VectorEigenMatrixXd"; Eigen::MatrixXd m1 = 100. * Eigen::MatrixXd::Random(20, 5); Eigen::MatrixXd m2 = 100. * Eigen::MatrixXd::Random(20, 5); @@ -2575,13 +3628,13 @@ TEST_CASE("HighFiveEigen") { vec_in.push_back(m2); std::vector vec_out(2, Eigen::MatrixXd::Zero(20, 5)); - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + CHECK_THROWS(test_eigen_vec(file, ds_name_flavor, vec_in, vec_out)); } #ifdef H5_USE_BOOST // boost::multi_array { - DS_NAME_FLAVOR = "BMultiEigenVector3f"; + ds_name_flavor = "BMultiEigenVector3f"; boost::multi_array vec_in(boost::extents[3][2][2]); for (int i = 0; i < 3; ++i) { @@ -2593,12 +3646,12 @@ TEST_CASE("HighFiveEigen") { } boost::multi_array vec_out(boost::extents[3][2][2]); - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + test_eigen_vec(file, ds_name_flavor, vec_in, vec_out); } // boost::multi_array { - DS_NAME_FLAVOR = "BMultiEigenMatrixXd"; + ds_name_flavor = "BMultiEigenMatrixXd"; boost::multi_array vec_in(boost::extents[3][2][2]); for (int i = 0; i < 3; ++i) { @@ -2609,51 +3662,193 @@ TEST_CASE("HighFiveEigen") { } } boost::multi_array vec_out(boost::extents[3][2][2]); - for (int i = 0; i < 3; ++i) + for (int i = 0; i < 3; ++i) { for (int j = 0; j < 2; ++j) { for (int k = 0; k < 2; ++k) { vec_out[i][j][k] = Eigen::MatrixXd::Zero(3, 3); } } - test_eigen_vec(file, DS_NAME_FLAVOR, vec_in, vec_out); + } + + CHECK_THROWS(test_eigen_vec(file, ds_name_flavor, vec_in, vec_out)); } #endif } #endif +TEST_CASE(Logging) { + struct TestLogger { + LogSeverity last_log_severity = LogSeverity(11); + std::string last_message = "---"; + + void operator()(LogSeverity log_severity, + const std::string& message, + const std::string&, + int) { + std::cout << "Something got logged !!!" << message << " " << to_string(log_severity) + << std::endl; + last_log_severity = log_severity; + last_message = message; + } + }; + + auto test_logger = TestLogger(); + + register_logging_callback( + [&test_logger](LogSeverity log_severity, + const std::string& message, + const std::string& file, + int line) { test_logger(log_severity, message, file, line); }); + + auto check = [&](bool should_log, const auto& message, LogSeverity log_severity) { + if (should_log && (HIGHFIVE_LOG_LEVEL <= int(log_severity))) { + REQUIRE(test_logger.last_message == message); + REQUIRE(test_logger.last_log_severity == log_severity); + } else { + REQUIRE(test_logger.last_message != message); + REQUIRE(test_logger.last_log_severity != log_severity); + } + }; + + SECTION("LOG_DEBUG") { + auto message = "Debug!"; + HIGHFIVE_LOG_DEBUG(message); + check(true, message, LogSeverity::Debug); + } + + SECTION("LOG_DEBUG_IF true") { + auto message = "DEBUG_IF true!"; + HIGHFIVE_LOG_DEBUG_IF(true, message); + check(true, message, LogSeverity::Debug); + } + + SECTION("LOG_DEBUG_IF false") { + auto message = "DEBUG_IF false!"; + HIGHFIVE_LOG_DEBUG_IF(false, message); + check(false, message, LogSeverity::Debug); + } + + SECTION("LOG_INFO") { + auto message = "Info!"; + HIGHFIVE_LOG_INFO(message); + check(true, message, LogSeverity::Info); + } + + SECTION("LOG_INFO_IF true") { + auto message = "INFO_IF true!"; + HIGHFIVE_LOG_INFO_IF(true, message); + check(true, message, LogSeverity::Info); + } + + SECTION("LOG_INFO_IF false") { + auto message = "INFO_IF false!"; + HIGHFIVE_LOG_INFO_IF(false, message); + check(false, message, LogSeverity::Info); + } + + SECTION("LOG_WARN") { + auto message = "Warn!"; + HIGHFIVE_LOG_WARN(message); + check(true, message, LogSeverity::Warn); + } + + SECTION("LOG_WARN_IF true") { + auto message = "WARN_IF true!"; + HIGHFIVE_LOG_WARN_IF(true, message); + check(true, message, LogSeverity::Warn); + } + + SECTION("LOG_WARN_IF false") { + auto message = "WARN_IF false!"; + HIGHFIVE_LOG_WARN_IF(false, message); + check(false, message, LogSeverity::Warn); + } + + SECTION("LOG_ERROR") { + auto message = "Error!"; + HIGHFIVE_LOG_ERROR(message); + check(true, message, LogSeverity::Error); + } + + SECTION("LOG_ERROR_IF true") { + auto message = "ERROR_IF true!"; + HIGHFIVE_LOG_ERROR_IF(true, message); + check(true, message, LogSeverity::Error); + } + + SECTION("LOG_ERROR_IF false") { + auto message = "ERROR_IF false!"; + HIGHFIVE_LOG_ERROR_IF(false, message); + check(false, message, LogSeverity::Error); + } +} + +#define HIGHFIVE_STRINGIFY_VALUE(s) HIGHFIVE_STRINGIFY_NAME(s) +#define HIGHFIVE_STRINGIFY_NAME(s) #s + + +TEST_CASE(Version_Numbers) { + int major = HIGHFIVE_VERSION_MAJOR; + int minor = HIGHFIVE_VERSION_MINOR; + int patch = HIGHFIVE_VERSION_PATCH; + std::string version = HIGHFIVE_STRINGIFY_VALUE(HIGHFIVE_VERSION); + + auto expected = std::to_string(major) + "." + std::to_string(minor) + "." + + std::to_string(patch); + + CHECK(version == expected); + CHECK(HIGHFIVE_VERSION_STRING == expected); +} + +#undef HIGHFIVE_STRINGIFY_VALUE +#undef HIGHFIVE_STRINGIFY_NAME + TEST_MAIN( TEST_CHECK(Basic_HighFive_tests); TEST_CHECK(Test_silent_HighFive); TEST_CHECK(Test_file_version_bounds); TEST_CHECK(Test_file_space_strategy); TEST_CHECK(Test_file_space_page_size); - //TEST_CHECK(Test_page_buffer_size); + // TEST_CHECK(Test_page_buffer_size); TEST_CHECK(Test_metadata_block_size_assignment); - //TEST_CHECK(Test_group_properties); + // TEST_CHECK(Test_group_properties); TEST_CHECK(Test_allocation_time); TEST_CHECK(Test_default_constructors); TEST_CHECK(Test_groups_and_datasets); + TEST_CHECK(FileSpace); + TEST_CHECK(FreeSpace_default); + TEST_CHECK(FreeSpace_tracked); TEST_CHECK(Test_extensible_datasets); TEST_CHECK(Test_reference_count); TEST_CHECK(Test_simple_listings); TEST_CHECK(Simple_test_for_type_equality); + TEST_CHECK(TestStringType); TEST_CHECK(DataTypeEqualTakeBack); TEST_CHECK(DataSpaceTest); + TEST_CHECK(DataSpace_getElementCount); TEST_CHECK(DataSpaceVectorTest); TEST_CHECK(DataSpaceVariadicTest); TEST_CHECK(ChunkingConstructorsTest); TEST_CHECK(HighFiveReadWriteShortcut); TEST_CHECK(ReadWriteAttributeVectorString); + TEST_CHECK(WriteLargeAttribute); + TEST_CHECK(TestAttributePhaseChange); TEST_CHECK(datasetOffset); TEST_CHECK(selectionArraySimpleString); TEST_CHECK(selectionByElementMultiDim); TEST_CHECK(attribute_scalar_rw_string); TEST_CHECK(HighFiveOutofDimension); + TEST_CHECK(CheckDimensions); + TEST_CHECK(SqueezeDimensions); + TEST_CHECK(ReadInBroadcastDims); TEST_CHECK(HighFiveRecursiveGroups); TEST_CHECK(HighFiveInspect); TEST_CHECK(HighFiveGetPath); TEST_CHECK(HighFiveSoftLinks); + TEST_CHECK(HighFiveHardLinks_Dataset_create_intermediate); + TEST_CHECK(HighFiveHardLinks_Dataset_relative_paths); + TEST_CHECK(HighFiveHardLinks_Group); TEST_CHECK(HighFiveRename); TEST_CHECK(HighFiveRenameRelative); TEST_CHECK(HighFivePropertyObjects); @@ -2661,10 +3856,21 @@ TEST_MAIN( TEST_CHECK(HighFiveCompoundsNested); TEST_CHECK(HighFiveCompoundsSeveralPadding); TEST_CHECK(HighFiveEnum); + TEST_CHECK(HighFiveSTDString_dataset_single_short); + TEST_CHECK(HighFiveSTDString_attribute_single_short); + TEST_CHECK(HighFiveSTDString_dataset_single_long); + TEST_CHECK(HighFiveSTDString_attribute_single_long); + TEST_CHECK(HighFiveSTDString_dataset_multiple_short); + TEST_CHECK(HighFiveSTDString_attribute_multiple_short); + TEST_CHECK(HighFiveSTDString_dataset_multiple_long); + TEST_CHECK(HighFiveSTDString_attribute_multiple_long); TEST_CHECK(HighFiveFixedString); + TEST_CHECK(HighFiveReadType); TEST_CHECK(HighFiveFixedLenStringArrayStructure); TEST_CHECK(HighFiveFixedLenStringArrayAttribute); TEST_CHECK(HighFiveReference); TEST_CHECK(HighFiveReadWriteConsts); TEST_CHECK(HighFiveDataTypeClass); -) + //TEST_CHECK(Logging); + TEST_CHECK(Version_Numbers); + ) diff --git a/externals/coda-oss/modules/drivers/highfive/wscript b/externals/coda-oss/modules/drivers/highfive/wscript index 33fc430e8c..c5eacfb6d4 100644 --- a/externals/coda-oss/modules/drivers/highfive/wscript +++ b/externals/coda-oss/modules/drivers/highfive/wscript @@ -1,5 +1,5 @@ NAME = 'highfive' -VERSION = '2.6.2' +VERSION = '2.7.1' MODULE_DEPS = 'hdf5 hdf5cpp config' USELIB_LOCAL = 'hdf5-c hdf5cpp-c' UNITTEST_DEPS = 'sys' diff --git a/externals/coda-oss/modules/drivers/uuid/CMakeLists.txt b/externals/coda-oss/modules/drivers/uuid/CMakeLists.txt index 319b35d55c..0a437f6e05 100644 --- a/externals/coda-oss/modules/drivers/uuid/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/uuid/CMakeLists.txt @@ -41,8 +41,8 @@ else() coda_fetch_driver( NAME ${TARGET_NAME} - ARCHIVE "e2fsprogs-1.40-uuid.tar" - HASH "SHA256=3507c7e9f226656b3903651c038e9c4907a31282cc4ba86aed8a588e6cc4cec2" + ARCHIVE "e2fsprogs-1.47.0.tar" + HASH "SHA256=c7c3a26bee8bb3b0041ee8701a5f47a29e81ee0b20d5995bc4544638cd0ea394" ) set(SOURCE_DIR "${${CMAKE_PROJECT_NAME}_${TARGET_NAME}_SOURCE_DIR}") diff --git a/externals/coda-oss/modules/drivers/uuid/e2fsprogs-1.40-uuid.tar b/externals/coda-oss/modules/drivers/uuid/e2fsprogs-1.40-uuid.tar deleted file mode 100644 index 23abccb81b..0000000000 Binary files a/externals/coda-oss/modules/drivers/uuid/e2fsprogs-1.40-uuid.tar and /dev/null differ diff --git a/externals/coda-oss/modules/drivers/uuid/e2fsprogs-1.47.0.tar b/externals/coda-oss/modules/drivers/uuid/e2fsprogs-1.47.0.tar new file mode 100644 index 0000000000..9d1bfa2cea Binary files /dev/null and b/externals/coda-oss/modules/drivers/uuid/e2fsprogs-1.47.0.tar differ diff --git a/externals/coda-oss/modules/drivers/uuid/wscript b/externals/coda-oss/modules/drivers/uuid/wscript index 15db74e935..eb83d58ad2 100644 --- a/externals/coda-oss/modules/drivers/uuid/wscript +++ b/externals/coda-oss/modules/drivers/uuid/wscript @@ -12,7 +12,7 @@ def options(opt): default=True, help='will build the uuid library if not found on the system (default)') opt.add_option('--build-uuid', action='store_true', dest='build_uuid', help='force building libuuid from scratch', - default=os.path.exists(os.path.join(opt.path.abspath(), 'e2fsprogs-1.40-uuid.tar'))) + default=os.path.exists(os.path.join(opt.path.abspath(), 'e2fsprogs-1.47.0.tar'))) opt.add_option('--nobuild-uuid', action='store_false', dest='build_uuid', help='force not building libuuid from scratch') opt.add_option('--with-uuid-home', action='store', dest='uuid_home', @@ -35,7 +35,7 @@ def configure(conf): elif Options.options.build_uuid: # Build is off by default when tarfile not found, fail if forced on - if not os.path.exists(os.path.join(conf.path.abspath(), 'e2fsprogs-1.40-uuid.tar')): + if not os.path.exists(os.path.join(conf.path.abspath(), 'e2fsprogs-1.47.0.tar')): conf.fatal('Missing uuid tarfile') def uuid_callback(conf): @@ -74,9 +74,9 @@ def configure(conf): conf.env['MAKE_UUID'] = True conf.msg('Building local lib', 'uuid') - untarFile(path=conf.path, fname='e2fsprogs-1.40-uuid.tar') + untarFile(path=conf.path, fname='e2fsprogs-1.47.0.tar') - fname='e2fsprogs-1.40-uuid' + fname='e2fsprogs-1.47.0' driverNode = conf.path.make_node(join(fname, 'lib', 'uuid')) writeConfig(conf, uuid_callback, 'uuid', infile='uuid_types.h.in', @@ -100,7 +100,7 @@ def build(bld): if 'MAKE_UUID' in env: - fname = 'e2fsprogs-1.40-uuid' + fname = 'e2fsprogs-1.47.0' driverNode = driversNode.make_node(fname) @@ -154,7 +154,7 @@ def distclean(context): import shutil dirs = map(lambda d: os.path.join(context.path.abspath(), d), - ['e2fsprogs-1.40-uuid']) + ['e2fsprogs-1.47.0']) for d in dirs: try: if os.path.exists(d): diff --git a/externals/coda-oss/modules/drivers/xml/xerces/CMakeLists.txt b/externals/coda-oss/modules/drivers/xml/xerces/CMakeLists.txt index 664d68d0d4..fca630811f 100644 --- a/externals/coda-oss/modules/drivers/xml/xerces/CMakeLists.txt +++ b/externals/coda-oss/modules/drivers/xml/xerces/CMakeLists.txt @@ -59,8 +59,8 @@ else() message("XML_HOME not specified, so XercesC will be built") coda_fetch_driver( NAME ${TARGET_NAME} - ARCHIVE "xerces-c-3.2.3.tar" - HASH "SHA256=61981c7a464e33913a093e0dfe7daf8a45f21e46b1924eb97f92bdbb746e2e6e" + ARCHIVE "xerces-c-3.2.4.tar" + HASH "SHA256=9b374fe066b0ae65a606a39dd67f1bd98c0ef505ec1baf45ce012cc2371999d8" ) set(HAVE_INTTYPES_H true) @@ -206,11 +206,11 @@ else() set(PACKAGE xerces-c) set(PACKAGE_BUGREPORT "") set(PACKAGE_NAME "xerces-c") - set(PACKAGE_STRING "xerces-c 3.2.3") + set(PACKAGE_STRING "xerces-c 3.2.4") set(PACKAGE_TARNAME "xerces-c") set(PACKAGE_URL "") - set(PACKAGE_VERSION "3.2.3") - set(VERSION "3.2.3") + set(PACKAGE_VERSION "3.2.4") + set(VERSION "3.2.4") # extra defines for Xerces_autoconf_config.hpp set(XERCES_USE_MSGLOADER_INMEMORY 1) diff --git a/externals/coda-oss/modules/drivers/xml/xerces/wscript b/externals/coda-oss/modules/drivers/xml/xerces/wscript index ddba3d2d08..2ad2cb4402 100644 --- a/externals/coda-oss/modules/drivers/xml/xerces/wscript +++ b/externals/coda-oss/modules/drivers/xml/xerces/wscript @@ -1,358 +1,360 @@ -import os, sys -from os.path import join, exists -from waflib import Options, Utils -from waflib.TaskGen import feature, before, task_gen -from build import untarFile, writeConfig - -SOURCE = 'xerces-c-3.2.3' -XERCES_USELIBS = 'THREAD SOCKET' - -options = lambda x : None - -def configure(conf): - xmlHome = Options.options.xml_home - xmlLayer = Options.options.xml_layer - - if xmlLayer == 'xerces' : - - xercesUselibs = XERCES_USELIBS - if sys.platform == 'win32': - # Xerces requires this standard Windows library - conf.check_cc(lib='advapi32', uselib_store='ADVAPI32') - xercesUselibs += ' ADVAPI32' - - # use an already built version - if xmlHome: - # attempt to test the third party library -- - # if test fails then fail the configure - conf.check(lib='xerces-c', uselib_store='XML', - header_name='xercesc/util/PlatformUtils.hpp', - function_name='xercesc::XMLPlatformUtils::Terminate', - defines='XERCES_STATIC_LIBRARY', uselib=xercesUselibs, - libpath=join(xmlHome, 'lib'), - includes=join(xmlHome, 'include'), - msg='Checking for library xerces', okmsg=xmlHome, - mandatory=True) - conf.undefine('HAVE_XERCESC__XMLPLATFORMUTILS__TERMINATE') - conf.env.append_value('DEFINES_XML', 'XERCES_STATIC_LIBRARY') - - # build it with waf - elif Options.options.build_xml: - # check for the source tarball - if not exists(join(conf.path.abspath(), SOURCE + '.tar')): - conf.fatal('Missing xerces tarfile') - - # callback function to check for all #defines used by the xerces driver - def xerces_callback(conf): - conf.check_cc(header_name="inttypes.h", mandatory=False) - conf.check_cc(header_name="netinet/in.h", mandatory=False) - conf.check_cc(header_name="arpa/inet.h", mandatory=False) - conf.check_cc(header_name="netdb.h", mandatory=False) - conf.check_cc(header_name="intrin.h", mandatory=False) - conf.check_cc(header_name="emmintrin.h", mandatory=False) - conf.check_cc(header_name="wchar.h", mandatory=False) - conf.check_cc(header_name="stdint.h", mandatory=True) - conf.check_cc(header_name="stdio.h", mandatory=True) - conf.check_cc(header_name="langinfo.h", mandatory=False) - conf.check_cc(header_name="iconv.h", mandatory=False) - conf.check_cc(header_name="nl_types.h", mandatory=False) - conf.check_cc(header_name="ctype.h", mandatory=False) - conf.check_cc(header_name="wctype.h", mandatory=False) - conf.check_cc(header_name="cpuid.h", mandatory=False) - conf.check_cc(header_name="endian.h", mandatory=False) - conf.check_cc(header_name="machine/endian.h", mandatory=False) - conf.check_cc(header_name="arpa/nameser_compat.h", mandatory=False) - conf.check_cc(header_name="errno.h", mandatory=False) - conf.check_cc(header_name="float.h", mandatory=False) - conf.check_cc(header_name="locale.h", mandatory=False) - conf.check_cc(header_name="sys/param.h", mandatory=False) - conf.check_cc(header_name="sys/socket.h", mandatory=False) - conf.check_cc(header_name="sys/stat.h", mandatory=False) - conf.check_cc(header_name="sys/timeb.h", mandatory=False) - conf.check_cc(header_name="sys/types.h", mandatory=False) - - conf.check_cc(function_name='mblen', header_name="stdlib.h", mandatory=False) - conf.check_cc(function_name='mbrlen', header_name="stdlib.h", mandatory=False) - conf.check_cc(function_name='mbsrtowcs', header_name="stdlib.h", mandatory=False) - conf.check_cc(function_name='mbstowcs', header_name="stdlib.h", mandatory=False) - conf.check_cc(function_name='wsctombs', header_name="stdlib.h", mandatory=False) - conf.check_cc(function_name='wcsrtombs', header_name="stdlib.h", mandatory=False) - conf.check_cc(function_name='realpath', header_name="stdlib.h", mandatory=False) - conf.check_cc(function_name='strchr', header_name="string.h", mandatory=True) - conf.check_cc(function_name='strdup', header_name="string.h", mandatory=False) - conf.check_cc(function_name='stricmp', header_name="string.h", mandatory=False) - conf.check_cc(function_name='strnicmp', header_name="string.h", mandatory=False) - conf.check_cc(function_name='strrcmp', header_name="string.h", mandatory=False) - conf.check_cc(function_name='strstr', header_name="string.h", mandatory=True) - conf.check_cc(function_name='strtol', header_name="string.h", mandatory=False) - conf.check_cc(function_name='strtoul', header_name="string.h", mandatory=False) - conf.check_cc(function_name='strcasecmp', header_name="strings.h", mandatory=False) - conf.check_cc(function_name='strncasecmp', header_name="strings.h", mandatory=False) - conf.check_cc(function_name='pathconf', header_name="unistd.h", mandatory=False) - conf.check_cc(function_name='nl_langinfo', header_name="langinfo.h", mandatory=False) - conf.check_cc(function_name='iconv', header_name="iconv.h", mandatory=False) - conf.check_cc(function_name='iconv_close', header_name="iconv.h", mandatory=False) - conf.check_cc(function_name='iconv_open', header_name="iconv.h", mandatory=False) - conf.check_cc(function_name='towupper', header_name="wctype.h", mandatory=False) - conf.check_cc(function_name='towlower', header_name="wctype.h", mandatory=False) - conf.check_cc(function_name='catclose', header_name="nl_types.h", mandatory=False) - conf.check_cc(function_name='catclose', header_name="nl_types.h", mandatory=False) - conf.check_cc(function_name='catgets', header_name="nl_types.h", mandatory=False) - conf.check_cc(function_name='catopen', header_name="nl_types.h", mandatory=False) - conf.check_cc(function_name='localeconv', header_name="locale.h", mandatory=False) - conf.check_cc(function_name='setlocale', header_name="locale.h", mandatory=False) - conf.check_cc(function_name='socket', header_name="sys/socket.h", mandatory=False) - conf.check_cc(function_name='ftime', header_name="sys/timeb.h", mandatory=False) - conf.check_cc(function_name='getaddrinfo', header_name="netdb.h", mandatory=False) - - conf.check_cc(lib="nsl", mandatory=False, uselib_store='NSL') - - conf.check_cc(header_name="unistd.h", mandatory=False) - conf.check_cc(header_name="sys/time.h", mandatory=False) - conf.check_cc(header_name="limits.h", mandatory=False) - conf.check_cc(header_name="strings.h", mandatory=False) - - # extra defines for config.h - if 'HAVE_ICONV_H=1' in conf.env['DEFINES'] : - conf.define('ICONV_USES_CONST_POINTER', 0) - if 'HAVE_SYS_TIME_H=1' in conf.env['DEFINES'] and 'HAVE_TIME_H=1' in conf.env['DEFINES']: - conf.define('TIME_WITH_SYS_TIME', 1) - if 'HAVE_SYS_TYPES_H=1' in conf.env['DEFINES'] : - conf.define('XERCES_HAVE_SYS_TYPES_H', 1) - if 'HAVE_INTTYPES_H=1' in conf.env['DEFINES'] : - conf.define('XERCES_HAVE_INTTYPES_H', 1) - if 'HAVE_INTRIN_H=1' in conf.env['DEFINES'] : - conf.define('XERCES_HAVE_INTRIN_H', 1) - if 'HAVE_EMMINTRIN_H=1' in conf.env['DEFINES'] : - conf.define('XERCES_HAVE_EMMINTRIN_H', 1) - if 'HAVE_WCHAR_H=1' in conf.env['DEFINES'] : - conf.define('XERCES_INCLUDE_WCHAR_H', 1) - if 'HAVE_EMMINTRIN_H=1' in conf.env['DEFINES'] : - conf.define('XERCES_HAVE_SSE2_INTRINSIC', 1) - if 'HAVE_STRICMP=1' in conf.env['DEFINES'] : - conf.define('HAVE_STRICMP', 1) - else : - conf.define('HAVE_STRICMP', 0) - if 'HAVE_STRNICMP=1' in conf.env['DEFINES'] : - conf.define('HAVE_STRNICMP', 1) - else : - conf.define('HAVE_STRNICMP', 0) - - if sys.platform == 'win32' : - conf.define('XERCES_USE_FILEMGR_WINDOWS', 1) - conf.define('XERCES_USE_MUTEXMGR_WINDOWS', 1) - conf.define('XERCES_USE_NETACCESSOR_WINSOCK', 1) - conf.define('XERCES_USE_TRANSCODER_WINDOWS', 1) - conf.define('XERCES_PATH_DELIMITER_BACKSLASH', 1) - - - # -- please note -- we diverge from the xerces-c make - # system and treat all unix platforms similarly. Solaris - # was make configured to use ICU and Linux the GNUICONV, - # but here we use the regular ICONV for both to avoid - # having complicated checks and additional build logic. - else : - conf.define('HAVE_PTHREAD', 1) - - conf.define('XERCES_USE_FILEMGR_POSIX', 1) - conf.define('XERCES_USE_MUTEXMGR_POSIX', 1) - conf.define('XERCES_USE_TRANSCODER_ICONV', 1) - - conf.define('XERCES_S16BIT_INT', 'int16_t', quote=False) - conf.define('XERCES_S32BIT_INT', 'int32_t', quote=False) - conf.define('XERCES_S64BIT_INT', 'int64_t', quote=False) - conf.define('XERCES_U16BIT_INT', 'uint16_t', quote=False) - conf.define('XERCES_U32BIT_INT', 'uint32_t', quote=False) - conf.define('XERCES_U64BIT_INT', 'uint64_t', quote=False) - conf.define('XERCES_SIZE_T', 'size_t', quote=False) - # This is for a UTF-16 value, 16 bits - if sys.platform == 'win32': - conf.define('XERCES_XMLCH_T', 'wchar_t', quote=False) - else: - conf.define('XERCES_XMLCH_T', 'char16_t', quote=False) - if 'HAVE_SSIZE_T=1' in conf.env['DEFINES'] : - conf.define('XERCES_SSIZE_T', 'ssize_t', quote=False) - else : - if 'SIZEOF_SIZE_T=8' in conf.env['DEFINES'] : - conf.define('XERCES_SSIZE_T', 'int64_t', quote=False) - else : - conf.define('XERCES_SSIZE_T', 'int32_t', quote=False) - conf.define('XERCES_SIZE_MAX', 'SIZE_MAX', quote=False) - - conf.define('LT_OBJDIR', '.libs/', quote=False) - conf.define('PACKAGE', 'xerces-c', quote=False) - conf.define('PACKAGE_BUGREPORT', '', quote=False) - conf.define('PACKAGE_NAME', 'xerces-c', quote=False) - conf.define('PACKAGE_STRING', 'xerces-c 3.2.3', quote=False) - conf.define('PACKAGE_TARNAME', 'xerces-c', quote=False) - conf.define('PACKAGE_URL', '', quote=False) - conf.define('PACKAGE_VERSION', '3.2.3', quote=False) - conf.define('VERSION', '3.2.3', quote=False) - - # extra defines for Xerces_autoconf_config.hpp - conf.define('XERCES_USE_MSGLOADER_INMEMORY', 1) - conf.define('XERCES_BUILDING_LIBRARY', 1) - conf.define('HAVE_NAMESPACES', 1) - conf.define('HAVE_SOCKET', 1) - conf.define('HAVE_STD_LIBS', 1) - conf.define('HAVE_STD_NAMESPACE', 1) - - conf.define('XERCES_AUTOCONF', 1) - conf.define('XERCES_PLATFORM_EXPORT', conf.env['declspec_decoration'], quote=False) - conf.define('XERCES_PLATFORM_IMPORT', '', quote=False) - conf.define('XERCES_TEMPLATE_EXTERN', 'extern', quote=False) - conf.define('XERCES_HAS_CPP_NAMESPACE', 1) - conf.define('XERCES_STD_NAMESPACE', 1) - conf.define('XERCES_NEW_IOSTREAMS', 1) - conf.define('XERCES_LSTRSUPPORT', 1) - conf.define('HAVE_BOOL', 1) - - if 'HAVE_NL_TYPES_H=1' in conf.env['DEFINES'] : - conf.define('HAVE_CATCLOSE', 1) - conf.define('HAVE_CATGETS', 1) - conf.define('HAVE_CATOPEN', 1) - - # untar and setup env - conf.env['MAKE_XERCES'] = True - conf.env['MAKE_XML'] = True - conf.msg('Building local lib', xmlLayer) - untarFile(path=conf.path, fname=SOURCE + '.tar') - - # make config.h & config.hpp - xercesNode = conf.path.make_node(SOURCE) - writeConfig(conf, xerces_callback, 'xercesConfigH', - infile='config.h.in', outfile='config.h', - path=xercesNode, feature='handleDefs') - - xercesNode = conf.path.make_node(join(SOURCE, 'src', 'xercesc', 'util')) - writeConfig(conf, xerces_callback, 'xercesAutoH', - infile='Xerces_autoconf_config.hpp.in', - outfile='Xerces_autoconf_config.hpp', - path=xercesNode, feature='handleDefs') - - # use an already built version that's on the system - else : - # if test fails then fail the configure - conf.check(lib='xerces-c', uselib_store='XML', - header_name='xercesc/util/PlatformUtils.hpp', - function_name='xercesc::XMLPlatformUtils::Terminate', - defines='XERCES_STATIC_LIBRARY', uselib=xercesUselibs, - msg='Checking for library xerces', - mandatory=True) - conf.undefine('HAVE_XERCESC__XMLPLATFORMUTILS__TERMINATE') - conf.env.append_value('DEFINES_XML', 'XERCES_STATIC_LIBRARY') - -def build(bld): - env = bld.get_env() - sourceFiles = [] - - # check it again just in case - if 'MAKE_XERCES' in env: - - xercesNode = bld.path.make_node(SOURCE) - xercesUselibs = XERCES_USELIBS - if sys.platform == 'win32': - # Xerces requires this standard Windows library - xercesUselibs += ' ADVAPI32' - - # setup some known excludes per platform -- - # we avoid building the system specific files - # and instead build the safely cross-platform files for all unix - # platforms. -- for more information see note above -- - GENERAL_EXCLUDES = ['URLAccessCFBinInputStream.cpp', - 'MacOSURLAccessCF.cpp', 'IconvGNUTransService.cpp', - 'MacOSUnicodeConverter.cpp', 'MsgCatalogLoader.cpp', - 'CurlURLInputStream.cpp', 'CurlNetAccessor.cpp', - 'ICUMsgLoader.cpp', 'ICUTransService.cpp', - 'Win32MsgLoader.cpp'] - UNIX_SPECIFIC = ['SocketNetAccessor.cpp','UnixHTTPURLInputStream.cpp', - 'PosixFileMgr.cpp', 'PosixMutexMgr.cpp', - 'IconvTransService.cpp'] - WIN_SPECIFIC = ['Win32TransService.cpp', 'WinSockNetAccessor.cpp', - 'BinHTTPURLInputStream.cpp', - 'WindowsFileMgr.cpp', 'WindowsMutexMgr.cpp'] - - # create filter for system specific files - # MacOS could be supported here as well - EXCLUDES = GENERAL_EXCLUDES - if sys.platform == 'win32' : - EXCLUDES += UNIX_SPECIFIC - else : - EXCLUDES += WIN_SPECIFIC - - # walk the directory of files -- - # this sorts files based on the filtering above, and - # whether they are sources vs headers - sources = [] - headers = [] - xercesDir = join(bld.path.abspath(), SOURCE) - for root,dirs,files in os.walk(join(xercesDir, 'src')) : - relativePath = root.replace(xercesDir + os.sep, "") - for file in files : - if file.endswith('.cpp') and 'Test' not in file and file not in EXCLUDES or \ - sys.platform != 'win32' and dirs == ['xercesc'] and file.endswith('.c') : - sources.append(join(relativePath, file)) - elif file.endswith('.h') or file.endswith('.hpp') or file.endswith('.c') : - headers.append(join(relativePath, file)) - sources = ' '.join(sources) - - # build the library - libType = env['LIB_TYPE'] or 'stlib' - xercesDefines = env['DEFINES'] + ['HAVE_CONFIG_H', 'XERCES_BUILDING_LIBRARY'] - if libType == 'shlib': - xercesDefines.append('DLL_EXPORT') - xerces = bld(features='c c%s add_targets' % env['LIB_TYPE'] or 'stlib', - source=sources, - includes=['.', 'src'], export_includes=['src'], - target='xerces-c', path=xercesNode, - uselib=xercesUselibs, name='XML', env=env.derive(), - defines=xercesDefines, - targets_to_add=[]) - if libType == 'stlib': - xerces.export_defines='XERCES_STATIC_LIBRARY' - - if env['install_libs']: - xerces.install_path = env['install_libdir'] - - - # install header target if necessary - if env['install_headers']: - # install all hpp, h, and c files into the include directory in a relative structure - srcNode = xercesNode.make_node('src') - - # add the config.h file to the install - bld(features='install_tgt', pattern='*.h', - dir=xercesNode, install_path=env['install_includedir'], - name='XML_INCLUDE_CONFIG_H_INSTALL') - xerces.targets_to_add=[bld(features='install_tgt add_targets', - pattern='**/*.hpp xercesc/**/*.h xercesc/**/*.c', - dir=srcNode, install_path=env['install_includedir'], - name='XML_INCLUDE_INSTALL', - targets_to_add=['XML_INCLUDE_CONFIG_H_INSTALL'])] - - if env['install_source']: - sourceFiles += [SOURCE + '.tar'] - xerces.targets_to_add += ['XML_SOURCE_INSTALL'] - - # In the event that we used --with-xml-home to point to a pre-built - # library, we still need a dummy XML_SOURCE_INSTALL target that doesn't - # install anything. This is needed in order to get this wscript - # auto-magically installed. - if env['install_source']: - sourceNode = bld.path.make_node('source') - bld.install_tgt(files=sourceFiles, - dir=bld.path, - install_path=join('${PREFIX}', sourceNode.path_from(bld.path)), - relative_trick=True, - name='XML_SOURCE_INSTALL') - -def distclean(context): - - # remove the untarred directories - import shutil - dirs = filter(lambda x: exists(join(context.path.abspath(), x)), - ['xerces-c-3.2.3']) - for d in dirs: - try: - shutil.rmtree(join(context.path.abspath(), d), ignore_errors=True) - except:{} +import os, sys +from os.path import join, exists +from waflib import Options, Utils +from waflib.TaskGen import feature, before, task_gen +from build import untarFile, writeConfig + +SOURCE = 'xerces-c-3.2.4' +XERCES_USELIBS = 'THREAD SOCKET' + +options = lambda x : None + +def configure(conf): + xmlHome = Options.options.xml_home + xmlLayer = Options.options.xml_layer + + if xmlLayer == 'xerces' : + + xercesUselibs = XERCES_USELIBS + if sys.platform == 'win32': + conf.define('WIN32', 1) + # Xerces requires this standard Windows library + conf.check_cc(lib='advapi32', uselib_store='ADVAPI32') + xercesUselibs += ' ADVAPI32' + + # use an already built version + if xmlHome: + # attempt to test the third party library -- + # if test fails then fail the configure + conf.check(lib='xerces-c', uselib_store='XML', + header_name='xercesc/util/PlatformUtils.hpp', + function_name='xercesc::XMLPlatformUtils::Terminate', + defines='XERCES_STATIC_LIBRARY', uselib=xercesUselibs, + libpath=join(xmlHome, 'lib'), + includes=join(xmlHome, 'include'), + msg='Checking for library xerces', okmsg=xmlHome, + mandatory=True) + conf.undefine('HAVE_XERCESC__XMLPLATFORMUTILS__TERMINATE') + conf.env.append_value('DEFINES_XML', 'XERCES_STATIC_LIBRARY') + + # build it with waf + elif Options.options.build_xml: + # check for the source tarball + if not exists(join(conf.path.abspath(), SOURCE + '.tar')): + conf.fatal('Missing xerces tarfile') + + # callback function to check for all #defines used by the xerces driver + def xerces_callback(conf): + conf.check_cc(header_name="inttypes.h", mandatory=False) + conf.check_cc(header_name="netinet/in.h", mandatory=False) + conf.check_cc(header_name="arpa/inet.h", mandatory=False) + conf.check_cc(header_name="netdb.h", mandatory=False) + conf.check_cc(header_name="intrin.h", mandatory=False) + conf.check_cc(header_name="emmintrin.h", mandatory=False) + conf.check_cc(header_name="wchar.h", mandatory=False) + conf.check_cc(header_name="stdint.h", mandatory=True) + conf.check_cc(header_name="stdio.h", mandatory=True) + conf.check_cc(header_name="langinfo.h", mandatory=False) + conf.check_cc(header_name="iconv.h", mandatory=False) + conf.check_cc(header_name="nl_types.h", mandatory=False) + conf.check_cc(header_name="ctype.h", mandatory=False) + conf.check_cc(header_name="wctype.h", mandatory=False) + conf.check_cc(header_name="cpuid.h", mandatory=False) + conf.check_cc(header_name="endian.h", mandatory=False) + conf.check_cc(header_name="machine/endian.h", mandatory=False) + conf.check_cc(header_name="arpa/nameser_compat.h", mandatory=False) + conf.check_cc(header_name="errno.h", mandatory=False) + conf.check_cc(header_name="float.h", mandatory=False) + conf.check_cc(header_name="locale.h", mandatory=False) + conf.check_cc(header_name="sys/param.h", mandatory=False) + conf.check_cc(header_name="sys/socket.h", mandatory=False) + conf.check_cc(header_name="sys/stat.h", mandatory=False) + conf.check_cc(header_name="sys/timeb.h", mandatory=False) + conf.check_cc(header_name="sys/types.h", mandatory=False) + + conf.check_cc(function_name='mblen', header_name="stdlib.h", mandatory=False) + conf.check_cc(function_name='mbrlen', header_name="stdlib.h", mandatory=False) + conf.check_cc(function_name='mbsrtowcs', header_name="stdlib.h", mandatory=False) + conf.check_cc(function_name='mbstowcs', header_name="stdlib.h", mandatory=False) + conf.check_cc(function_name='wsctombs', header_name="stdlib.h", mandatory=False) + conf.check_cc(function_name='wcsrtombs', header_name="stdlib.h", mandatory=False) + conf.check_cc(function_name='realpath', header_name="stdlib.h", mandatory=False) + conf.check_cc(function_name='strchr', header_name="string.h", mandatory=True) + conf.check_cc(function_name='strdup', header_name="string.h", mandatory=False) + conf.check_cc(function_name='stricmp', header_name="string.h", mandatory=False) + conf.check_cc(function_name='strnicmp', header_name="string.h", mandatory=False) + conf.check_cc(function_name='strrcmp', header_name="string.h", mandatory=False) + conf.check_cc(function_name='strstr', header_name="string.h", mandatory=True) + conf.check_cc(function_name='strtol', header_name="string.h", mandatory=False) + conf.check_cc(function_name='strtoul', header_name="string.h", mandatory=False) + conf.check_cc(function_name='strcasecmp', header_name="strings.h", mandatory=False) + conf.check_cc(function_name='strncasecmp', header_name="strings.h", mandatory=False) + conf.check_cc(function_name='pathconf', header_name="unistd.h", mandatory=False) + conf.check_cc(function_name='nl_langinfo', header_name="langinfo.h", mandatory=False) + conf.check_cc(function_name='iconv', header_name="iconv.h", mandatory=False) + conf.check_cc(function_name='iconv_close', header_name="iconv.h", mandatory=False) + conf.check_cc(function_name='iconv_open', header_name="iconv.h", mandatory=False) + conf.check_cc(function_name='towupper', header_name="wctype.h", mandatory=False) + conf.check_cc(function_name='towlower', header_name="wctype.h", mandatory=False) + conf.check_cc(function_name='catclose', header_name="nl_types.h", mandatory=False) + conf.check_cc(function_name='catclose', header_name="nl_types.h", mandatory=False) + conf.check_cc(function_name='catgets', header_name="nl_types.h", mandatory=False) + conf.check_cc(function_name='catopen', header_name="nl_types.h", mandatory=False) + conf.check_cc(function_name='localeconv', header_name="locale.h", mandatory=False) + conf.check_cc(function_name='setlocale', header_name="locale.h", mandatory=False) + conf.check_cc(function_name='socket', header_name="sys/socket.h", mandatory=False) + conf.check_cc(function_name='ftime', header_name="sys/timeb.h", mandatory=False) + conf.check_cc(function_name='getaddrinfo', header_name="netdb.h", mandatory=False) + + conf.check_cc(lib="nsl", mandatory=False, uselib_store='NSL') + + conf.check_cc(header_name="unistd.h", mandatory=False) + conf.check_cc(header_name="sys/time.h", mandatory=False) + conf.check_cc(header_name="limits.h", mandatory=False) + conf.check_cc(header_name="strings.h", mandatory=False) + + # extra defines for config.h + if 'HAVE_ICONV_H=1' in conf.env['DEFINES'] : + conf.define('ICONV_USES_CONST_POINTER', 0) + if 'HAVE_SYS_TIME_H=1' in conf.env['DEFINES'] and 'HAVE_TIME_H=1' in conf.env['DEFINES']: + conf.define('TIME_WITH_SYS_TIME', 1) + if 'HAVE_SYS_TYPES_H=1' in conf.env['DEFINES'] : + conf.define('XERCES_HAVE_SYS_TYPES_H', 1) + if 'HAVE_INTTYPES_H=1' in conf.env['DEFINES'] : + conf.define('XERCES_HAVE_INTTYPES_H', 1) + if 'HAVE_INTRIN_H=1' in conf.env['DEFINES'] : + conf.define('XERCES_HAVE_INTRIN_H', 1) + if 'HAVE_EMMINTRIN_H=1' in conf.env['DEFINES'] : + conf.define('XERCES_HAVE_EMMINTRIN_H', 1) + if 'HAVE_WCHAR_H=1' in conf.env['DEFINES'] : + conf.define('XERCES_INCLUDE_WCHAR_H', 1) + if 'HAVE_EMMINTRIN_H=1' in conf.env['DEFINES'] : + conf.define('XERCES_HAVE_SSE2_INTRINSIC', 1) + if 'HAVE_STRICMP=1' in conf.env['DEFINES'] : + conf.define('HAVE_STRICMP', 1) + else : + conf.define('HAVE_STRICMP', 0) + if 'HAVE_STRNICMP=1' in conf.env['DEFINES'] : + conf.define('HAVE_STRNICMP', 1) + else : + conf.define('HAVE_STRNICMP', 0) + + if sys.platform == 'win32' : + conf.define('XERCES_USE_FILEMGR_WINDOWS', 1) + conf.define('XERCES_USE_MUTEXMGR_WINDOWS', 1) + conf.define('XERCES_USE_NETACCESSOR_WINSOCK', 1) + conf.define('XERCES_USE_TRANSCODER_WINDOWS', 1) + conf.define('XERCES_PATH_DELIMITER_BACKSLASH', 1) + + + # -- please note -- we diverge from the xerces-c make + # system and treat all unix platforms similarly. Solaris + # was make configured to use ICU and Linux the GNUICONV, + # but here we use the regular ICONV for both to avoid + # having complicated checks and additional build logic. + else : + conf.define('HAVE_PTHREAD', 1) + + conf.define('XERCES_USE_FILEMGR_POSIX', 1) + conf.define('XERCES_USE_MUTEXMGR_POSIX', 1) + conf.define('XERCES_USE_TRANSCODER_ICONV', 1) + + conf.define('XERCES_S16BIT_INT', 'int16_t', quote=False) + conf.define('XERCES_S32BIT_INT', 'int32_t', quote=False) + conf.define('XERCES_S64BIT_INT', 'int64_t', quote=False) + conf.define('XERCES_U16BIT_INT', 'uint16_t', quote=False) + conf.define('XERCES_U32BIT_INT', 'uint32_t', quote=False) + conf.define('XERCES_U64BIT_INT', 'uint64_t', quote=False) + conf.define('XERCES_SIZE_T', 'size_t', quote=False) + # This is for a UTF-16 value, 16 bits + if sys.platform == 'win32': + conf.define('XERCES_XMLCH_T', 'wchar_t', quote=False) + else: + conf.define('XERCES_XMLCH_T', 'char16_t', quote=False) + if 'HAVE_SSIZE_T=1' in conf.env['DEFINES'] : + conf.define('XERCES_SSIZE_T', 'ssize_t', quote=False) + else : + if 'SIZEOF_SIZE_T=8' in conf.env['DEFINES'] : + conf.define('XERCES_SSIZE_T', 'int64_t', quote=False) + else : + conf.define('XERCES_SSIZE_T', 'int32_t', quote=False) + conf.define('XERCES_SIZE_MAX', 'SIZE_MAX', quote=False) + + conf.define('LT_OBJDIR', '.libs/', quote=False) + conf.define('PACKAGE', 'xerces-c', quote=False) + conf.define('PACKAGE_BUGREPORT', '', quote=False) + conf.define('PACKAGE_NAME', 'xerces-c', quote=False) + conf.define('PACKAGE_STRING', 'xerces-c 3.2.4', quote=False) + conf.define('PACKAGE_TARNAME', 'xerces-c', quote=False) + conf.define('PACKAGE_URL', '', quote=False) + conf.define('PACKAGE_VERSION', '3.2.4', quote=False) + conf.define('VERSION', '3.2.4', quote=False) + + # extra defines for Xerces_autoconf_config.hpp + conf.define('XERCES_USE_MSGLOADER_INMEMORY', 1) + conf.define('XERCES_BUILDING_LIBRARY', 1) + conf.define('HAVE_NAMESPACES', 1) + conf.define('HAVE_SOCKET', 1) + conf.define('HAVE_STD_LIBS', 1) + conf.define('HAVE_STD_NAMESPACE', 1) + + conf.define('XERCES_AUTOCONF', 1) + conf.define('XERCES_PLATFORM_EXPORT', conf.env['declspec_decoration'], quote=False) + conf.define('XERCES_PLATFORM_IMPORT', '', quote=False) + conf.define('XERCES_TEMPLATE_EXTERN', 'extern', quote=False) + conf.define('XERCES_HAS_CPP_NAMESPACE', 1) + conf.define('XERCES_STD_NAMESPACE', 1) + conf.define('XERCES_NEW_IOSTREAMS', 1) + conf.define('XERCES_LSTRSUPPORT', 1) + conf.define('HAVE_BOOL', 1) + + if 'HAVE_NL_TYPES_H=1' in conf.env['DEFINES'] : + conf.define('HAVE_CATCLOSE', 1) + conf.define('HAVE_CATGETS', 1) + conf.define('HAVE_CATOPEN', 1) + + # untar and setup env + conf.env['MAKE_XERCES'] = True + conf.env['MAKE_XML'] = True + conf.msg('Building local lib', xmlLayer) + untarFile(path=conf.path, fname=SOURCE + '.tar') + + # make config.h & config.hpp + xercesNode = conf.path.make_node(SOURCE) + writeConfig(conf, xerces_callback, 'xercesConfigH', + infile='config.h.in', outfile='config.h', + path=xercesNode, feature='handleDefs') + + xercesNode = conf.path.make_node(join(SOURCE, 'src', 'xercesc', 'util')) + writeConfig(conf, xerces_callback, 'xercesAutoH', + infile='Xerces_autoconf_config.hpp.in', + outfile='Xerces_autoconf_config.hpp', + path=xercesNode, feature='handleDefs') + + # use an already built version that's on the system + else : + # if test fails then fail the configure + conf.check(lib='xerces-c', uselib_store='XML', + header_name='xercesc/util/PlatformUtils.hpp', + function_name='xercesc::XMLPlatformUtils::Terminate', + defines='XERCES_STATIC_LIBRARY', uselib=xercesUselibs, + msg='Checking for library xerces', + mandatory=True) + conf.undefine('HAVE_XERCESC__XMLPLATFORMUTILS__TERMINATE') + conf.env.append_value('DEFINES_XML', 'XERCES_STATIC_LIBRARY') + +def build(bld): + env = bld.get_env() + sourceFiles = [] + + # check it again just in case + if 'MAKE_XERCES' in env: + + xercesNode = bld.path.make_node(SOURCE) + xercesUselibs = XERCES_USELIBS + if sys.platform == 'win32': + # Xerces requires this standard Windows library + bld.define('WIN32', 1) + xercesUselibs += ' ADVAPI32' + + # setup some known excludes per platform -- + # we avoid building the system specific files + # and instead build the safely cross-platform files for all unix + # platforms. -- for more information see note above -- + GENERAL_EXCLUDES = ['URLAccessCFBinInputStream.cpp', + 'MacOSURLAccessCF.cpp', 'IconvGNUTransService.cpp', + 'MacOSUnicodeConverter.cpp', 'MsgCatalogLoader.cpp', + 'CurlURLInputStream.cpp', 'CurlNetAccessor.cpp', + 'ICUMsgLoader.cpp', 'ICUTransService.cpp', + 'Win32MsgLoader.cpp'] + UNIX_SPECIFIC = ['SocketNetAccessor.cpp','UnixHTTPURLInputStream.cpp', + 'PosixFileMgr.cpp', 'PosixMutexMgr.cpp', + 'IconvTransService.cpp'] + WIN_SPECIFIC = ['Win32TransService.cpp', 'WinSockNetAccessor.cpp', + 'BinHTTPURLInputStream.cpp', + 'WindowsFileMgr.cpp', 'WindowsMutexMgr.cpp'] + + # create filter for system specific files + # MacOS could be supported here as well + EXCLUDES = GENERAL_EXCLUDES + if sys.platform == 'win32' : + EXCLUDES += UNIX_SPECIFIC + else : + EXCLUDES += WIN_SPECIFIC + + # walk the directory of files -- + # this sorts files based on the filtering above, and + # whether they are sources vs headers + sources = [] + headers = [] + xercesDir = join(bld.path.abspath(), SOURCE) + for root,dirs,files in os.walk(join(xercesDir, 'src')) : + relativePath = root.replace(xercesDir + os.sep, "") + for file in files : + if file.endswith('.cpp') and 'Test' not in file and file not in EXCLUDES or \ + sys.platform != 'win32' and dirs == ['xercesc'] and file.endswith('.c') : + sources.append(join(relativePath, file)) + elif file.endswith('.h') or file.endswith('.hpp') or file.endswith('.c') : + headers.append(join(relativePath, file)) + sources = ' '.join(sources) + + # build the library + libType = env['LIB_TYPE'] or 'stlib' + xercesDefines = env['DEFINES'] + ['HAVE_CONFIG_H', 'XERCES_BUILDING_LIBRARY'] + if libType == 'shlib': + xercesDefines.append('DLL_EXPORT') + xerces = bld(features='c c%s add_targets' % env['LIB_TYPE'] or 'stlib', + source=sources, + includes=['.', 'src'], export_includes=['src'], + target='xerces-c', path=xercesNode, + uselib=xercesUselibs, name='XML', env=env.derive(), + defines=xercesDefines, + targets_to_add=[]) + if libType == 'stlib': + xerces.export_defines='XERCES_STATIC_LIBRARY' + + if env['install_libs']: + xerces.install_path = env['install_libdir'] + + + # install header target if necessary + if env['install_headers']: + # install all hpp, h, and c files into the include directory in a relative structure + srcNode = xercesNode.make_node('src') + + # add the config.h file to the install + bld(features='install_tgt', pattern='*.h', + dir=xercesNode, install_path=env['install_includedir'], + name='XML_INCLUDE_CONFIG_H_INSTALL') + xerces.targets_to_add=[bld(features='install_tgt add_targets', + pattern='**/*.hpp xercesc/**/*.h xercesc/**/*.c', + dir=srcNode, install_path=env['install_includedir'], + name='XML_INCLUDE_INSTALL', + targets_to_add=['XML_INCLUDE_CONFIG_H_INSTALL'])] + + if env['install_source']: + sourceFiles += [SOURCE + '.tar'] + xerces.targets_to_add += ['XML_SOURCE_INSTALL'] + + # In the event that we used --with-xml-home to point to a pre-built + # library, we still need a dummy XML_SOURCE_INSTALL target that doesn't + # install anything. This is needed in order to get this wscript + # auto-magically installed. + if env['install_source']: + sourceNode = bld.path.make_node('source') + bld.install_tgt(files=sourceFiles, + dir=bld.path, + install_path=join('${PREFIX}', sourceNode.path_from(bld.path)), + relative_trick=True, + name='XML_SOURCE_INSTALL') + +def distclean(context): + + # remove the untarred directories + import shutil + dirs = filter(lambda x: exists(join(context.path.abspath(), x)), + ['xerces-c-3.2.4']) + for d in dirs: + try: + shutil.rmtree(join(context.path.abspath(), d), ignore_errors=True) + except:{} diff --git a/externals/coda-oss/modules/drivers/xml/xerces/xerces-c-3.2.3.tar b/externals/coda-oss/modules/drivers/xml/xerces/xerces-c-3.2.3.tar deleted file mode 100644 index 3a95f937cc..0000000000 Binary files a/externals/coda-oss/modules/drivers/xml/xerces/xerces-c-3.2.3.tar and /dev/null differ diff --git a/externals/coda-oss/modules/drivers/xml/xerces/xerces-c-3.2.4.tar b/externals/coda-oss/modules/drivers/xml/xerces/xerces-c-3.2.4.tar new file mode 100644 index 0000000000..341c50c986 Binary files /dev/null and b/externals/coda-oss/modules/drivers/xml/xerces/xerces-c-3.2.4.tar differ diff --git a/externals/nitro/.gitattributes b/externals/nitro/.gitattributes index 11cea51085..c888454a3c 100644 --- a/externals/nitro/.gitattributes +++ b/externals/nitro/.gitattributes @@ -4,3 +4,96 @@ conanfile.py text eol=lf CMakeLists.txt text eol=lf *.cmake text eol=lf *.in text eol=lf + +# Modern tools on Windows can handle Linux LF +# See https://stackoverflow.com/a/13154031/8877 for details +* text=auto eol=lf +*.* text=auto eol=lf +.git?* text=auto eol=lf + +# Leave known Windows-only text files as CR/LF +*.sln text eol=crlf +*.dsw text eol=crlf +*.dsp text eol=crlf +*.vcproj text eol=crlf +*.vcxproj text eol=crlf +*.vcxproj.filters text eol=crlf +*.ruleset text eol=crlf +*.bat text eol=crlf + +###################### +# Known binary files + +# Python builds with WAF +waf binary + +# executables, libraries; yes, sometimes they're part of a repository +*.exe binary +*.out binary +lib*.so* binary +*.dll binary +lib*.a* binary +*.lib binary +*.mex binary +*.pyc binary + +# from various unit_test/ directories +*.dat binary +*.*hdr binary +*.flat binary +*.sig binary +*.bin binary +*.dump binary + +# images +*.bmp binary +*.ico binary +*.tiff binary +*.tif binary +*.gif binary +*.jpg binary +*.jpeg binary +*.png binary +# SVG images are XML +*.svg text +*.raw binary +*.hei? binary +*.kmz binary + +# music +*.mp3 binary +*.m4a binary +*.wav binary +*.wma binary + +# video +*.m4v binary +*.avi binary +*.wmv binary +*.mkv binary + +# documents +*.pdf binary +*.dvi binary +*.doc binary +*.docx binary +*.xls binary +*.xlsx binary +*.ppt binary +*.pptx binary + +# SAR +*.h5 binary +*.sio binary +*.hdr binary +*.ntf binary +*.nitf binary +*.sidd binary +*.sicd? binary + +# containers +*.zip binary +*.gz binary +*.tar binary +*.tgz binary +*.jar binary diff --git a/externals/nitro/.github/workflows/frequent_check.yml b/externals/nitro/.github/workflows/frequent_check.yml index aa0c3d30d6..9c1777f88a 100644 --- a/externals/nitro/.github/workflows/frequent_check.yml +++ b/externals/nitro/.github/workflows/frequent_check.yml @@ -63,7 +63,7 @@ jobs: cmake --build . --config ${{ matrix.configuration }} -j cmake --build . --config ${{ matrix.configuration }} --target install - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1 # https://github.com/marketplace/actions/setup-msbuild + uses: microsoft/setup-msbuild@v1.0.2 # https://github.com/marketplace/actions/setup-msbuild with: msbuild-architecture: x64 - name: msbuild diff --git a/externals/nitro/.github/workflows/main.yml b/externals/nitro/.github/workflows/main.yml index f08b708076..ef3dfa65e6 100644 --- a/externals/nitro/.github/workflows/main.yml +++ b/externals/nitro/.github/workflows/main.yml @@ -37,7 +37,7 @@ jobs: cd out ctest -C ${{ matrix.configuration }} --output-on-failure - name: Add msbuild to PATH - uses: microsoft/setup-msbuild@v1 # https://github.com/marketplace/actions/setup-msbuild + uses: microsoft/setup-msbuild@v1.0.2 # https://github.com/marketplace/actions/setup-msbuild with: msbuild-architecture: x64 - name: msbuild diff --git a/externals/nitro/.gitignore b/externals/nitro/.gitignore index 3062657fbd..5d75601512 100644 --- a/externals/nitro/.gitignore +++ b/externals/nitro/.gitignore @@ -47,5 +47,5 @@ libnitf.pc cmake-build*/ # unit tests -outputPathname.ntf -sicd_*_nitf__*_band_*.man +outputPathname.ntf +sicd_*_nitf__*_band_*.man diff --git a/externals/nitro/CHANGES b/externals/nitro/CHANGES index 0be232971d..dd120e4686 100644 --- a/externals/nitro/CHANGES +++ b/externals/nitro/CHANGES @@ -1,19 +1,19 @@ -2.7 Changes -=========== -- 12 new TREs: CSCCGA, CSCRNA, CSEPHA, CSEXRA, CSPROA, CSSFAA, CSSHPA, GRDPSB, J2KLRA, PIXQLA, SENSRB, XML_DATA_CONTENT -- Variety of minor memory leaks, access errors, and other bug fixes -- Fixed IOInterface and BandSource C++ API so overriding methods works as expected -- Several complexity level bugs -- Fixed bug in Windows involving reading and writing files larger than 4 GB -- Build system upgrades: Among other thing, building Java bindings is now easier as it's done directly through waf automatically - -Please see our wiki for detailed change information on previous versions: - -2.5 Changes: http://nitro-nitf.sourceforge.net/wikka.php?wakka=ReleaseNotes25 - -2.0 Changes: http://nitro-nitf.sourceforge.net/wikka.php?wakka=ReleaseNotes20 - -1.5 Changes: http://nitro-nitf.sourceforge.net/wikka.php?wakka=ReleaseNotes15 - - -Wiki Home: http://nitro-nitf.sourceforge.net/ +2.7 Changes +=========== +- 12 new TREs: CSCCGA, CSCRNA, CSEPHA, CSEXRA, CSPROA, CSSFAA, CSSHPA, GRDPSB, J2KLRA, PIXQLA, SENSRB, XML_DATA_CONTENT +- Variety of minor memory leaks, access errors, and other bug fixes +- Fixed IOInterface and BandSource C++ API so overriding methods works as expected +- Several complexity level bugs +- Fixed bug in Windows involving reading and writing files larger than 4 GB +- Build system upgrades: Among other thing, building Java bindings is now easier as it's done directly through waf automatically + +Please see our wiki for detailed change information on previous versions: + +2.5 Changes: http://nitro-nitf.sourceforge.net/wikka.php?wakka=ReleaseNotes25 + +2.0 Changes: http://nitro-nitf.sourceforge.net/wikka.php?wakka=ReleaseNotes20 + +1.5 Changes: http://nitro-nitf.sourceforge.net/wikka.php?wakka=ReleaseNotes15 + + +Wiki Home: http://nitro-nitf.sourceforge.net/ diff --git a/externals/nitro/ReleaseNotes.md b/externals/nitro/ReleaseNotes.md index c158869648..7111a792e9 100644 --- a/externals/nitro/ReleaseNotes.md +++ b/externals/nitro/ReleaseNotes.md @@ -1,5 +1,13 @@ # NITRO (NITF i/o) Release Notes +## [Version 2.11.5](https://github.com/mdaus/nitro/releases/tag/NITRO-2.11.5); October 23, 2023 +* [coda-oss](https://github.com/mdaus/coda-oss) release [2023-10-23](https://github.com/mdaus/coda-oss/releases/tag/2023-10-23) +* Fix some ASAN diagnostics, still more to do. + +## [Version 2.11.4](https://github.com/mdaus/nitro/releases/tag/NITRO-2.11.4); August 18 5, 2023 +* [coda-oss](https://github.com/mdaus/coda-oss) release [2023-08-18](https://github.com/mdaus/coda-oss/releases/tag/2023-08-18) +* Added **.gitattributes** and normalized line-endings (`\n` for most text files). + ## [Version 2.11.3](https://github.com/mdaus/nitro/releases/tag/NITRO-2.11.3); June 5, 2023 * [coda-oss](https://github.com/mdaus/coda-oss) release [2023-06-05](https://github.com/mdaus/coda-oss/releases/tag/2023-06-05) * Fix display of [certain TREs](https://github.com/mdaus/nitro/issues/529). diff --git a/externals/nitro/UnitTest/CppUnitTestAssert.cpp b/externals/nitro/UnitTest/CppUnitTestAssert.cpp index 5bea8da590..13b75386ac 100644 --- a/externals/nitro/UnitTest/CppUnitTestAssert.cpp +++ b/externals/nitro/UnitTest/CppUnitTestAssert.cpp @@ -1,5 +1,5 @@ -#include "pch.h" -#include "TestCase.h" - -// Can't get this to build in the **coda-oss** project. -#include "sys/source/CppUnitTestAssert_.cpp_" +#include "pch.h" +#include "TestCase.h" + +// Can't get this to build in the **coda-oss** project. +#include "sys/source/CppUnitTestAssert_.cpp_" diff --git a/externals/nitro/UnitTest/Test.h b/externals/nitro/UnitTest/Test.h index a36e09780e..a9ac754ab4 100644 --- a/externals/nitro/UnitTest/Test.h +++ b/externals/nitro/UnitTest/Test.h @@ -1,8 +1,8 @@ -#pragma once - -#include "nitf/unittests/Test.h" -#include "TestCase.h" - -#define TEST_ASSERT_EQ_INT(X1, X2) TEST_ASSERT_EQ(X2, X1) -#define TEST_ASSERT_EQ_STR(X1, X2) TEST_ASSERT_EQ(std::string(X1), std::string(X2)) +#pragma once + +#include "nitf/unittests/Test.h" +#include "TestCase.h" + +#define TEST_ASSERT_EQ_INT(X1, X2) TEST_ASSERT_EQ(X2, X1) +#define TEST_ASSERT_EQ_STR(X1, X2) TEST_ASSERT_EQ(std::string(X1), std::string(X2)) #define TEST_ASSERT_EQ_FLOAT(X1, X2) TEST_ASSERT_EQ(static_cast(X1), static_cast(X2)) \ No newline at end of file diff --git a/externals/nitro/UnitTest/UnitTest.cpp b/externals/nitro/UnitTest/UnitTest.cpp index aedc2a9f63..bd3176e4ae 100644 --- a/externals/nitro/UnitTest/UnitTest.cpp +++ b/externals/nitro/UnitTest/UnitTest.cpp @@ -1,11 +1,11 @@ -#include "pch.h" -#include "CppUnitTest.h" - -#include - -// https://learn.microsoft.com/en-us/visualstudio/test/microsoft-visualstudio-testtools-cppunittestframework-api-reference?view=vs-2022 -TEST_MODULE_INITIALIZE(methodName) -{ - // module initialization code - nitf::Test::setNitfPluginPath(); +#include "pch.h" +#include "CppUnitTest.h" + +#include + +// https://learn.microsoft.com/en-us/visualstudio/test/microsoft-visualstudio-testtools-cppunittestframework-api-reference?view=vs-2022 +TEST_MODULE_INITIALIZE(methodName) +{ + // module initialization code + nitf::Test::setNitfPluginPath(); } \ No newline at end of file diff --git a/externals/nitro/UnitTest/UnitTest.vcxproj b/externals/nitro/UnitTest/UnitTest.vcxproj index d936467254..582a6e41c8 100644 --- a/externals/nitro/UnitTest/UnitTest.vcxproj +++ b/externals/nitro/UnitTest/UnitTest.vcxproj @@ -1,301 +1,271 @@ - - - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1} - Win32Proj - UnitTest - 10.0 - NativeUnitTestProject - - - - DynamicLibrary - true - v143 - Unicode - false - - - DynamicLibrary - false - v143 - true - Unicode - false - - - - - - - - - - - - - - - true - - - false - - - - Use - Level3 - true - $(ProjectDir);$(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)externals\coda-oss\modules\c++;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - _DEBUG;%(PreprocessorDefinitions) - true - pch.h - AdvancedVectorExtensions2 - MultiThreadedDebugDLL - true - true - true - true - true - - - Windows - $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - - - Use - Level3 - true - true - true - $(ProjectDir);$(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)externals\coda-oss\modules\c++;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) - NDEBUG;%(PreprocessorDefinitions) - true - pch.h - AdvancedVectorExtensions2 - Guard - true - true - true - true - - - Windows - true - true - $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) - - - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - Create - Create - - - - - - - - - - - {8f357a19-799e-4971-850e-3f28485c130b} - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - {53f9f908-c678-4dee-9309-e71c1d03a45f} - - - {730b1e6e-2469-4f9e-b093-d0c6262453c9} - - - {51d7b426-899e-428d-9f69-5ddac9e403fb} - - - {12aa0752-4ee3-4e0a-85af-0e5deadbf343} - - - {023de06d-3967-4406-b1b8-032118bb2552} - - - {0a9bda26-092f-4a2c-bbef-00c64bf0c65e} - - - {53f9f908-c678-4dee-9309-e71c1e03a45f} - - - {d749aa73-4c9a-473d-96bb-070a6d9caa54} - - - {d1d7fcd3-6130-4504-9da0-9d80506be55e} - - - {2baaaca9-a5a4-412c-ae52-b16c2d107f55} - - - {cf5b4f02-364d-4117-9fb9-6c9c7938e412} - - - {78849481-d356-4cc7-b182-31c21f857ed1} - - - - - + + + + + Debug + x64 + + + Release + x64 + + + + 17.0 + {8ACE478C-8F6F-4D42-9B43-7D75882D4BE1} + Win32Proj + UnitTest + 10.0 + NativeUnitTestProject + + + + DynamicLibrary + true + v143 + Unicode + false + + + DynamicLibrary + false + v143 + true + Unicode + false + + + + + + + + + + + + + + + true + + + false + + + + Use + Level3 + true + $(ProjectDir);$(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)externals\coda-oss\modules\c++;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions) + true + pch.h + AdvancedVectorExtensions2 + MultiThreadedDebugDLL + true + true + true + true + true + + + Windows + $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Use + Level3 + true + true + true + $(ProjectDir);$(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)externals\coda-oss\modules\c++;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions) + true + pch.h + AdvancedVectorExtensions2 + Guard + true + true + true + true + + + Windows + true + true + $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + Create + Create + + + + + + + + + + + {8f357a19-799e-4971-850e-3f28485c130b} + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + {53f9f908-c678-4dee-9309-e71c1e03a45f} + + + {78849481-d356-4cc7-b182-31c21f857ed1} + + + + + \ No newline at end of file diff --git a/externals/nitro/UnitTest/UnitTest.vcxproj.filters b/externals/nitro/UnitTest/UnitTest.vcxproj.filters index 7eecfb2b8e..4b8da65dfc 100644 --- a/externals/nitro/UnitTest/UnitTest.vcxproj.filters +++ b/externals/nitro/UnitTest/UnitTest.vcxproj.filters @@ -1,135 +1,135 @@ - - - - - {d6b8959a-344d-4af2-b926-05be973609a4} - - - {a03980e8-d43d-473b-9f2a-a883ddd94df0} - - - {555282a7-bf5d-4012-842a-435bfb7324ab} - - - - - nrt - - - - nrt - - - - nrt - - - nrt - - - nrt - - - nrt - - - nrt - - - nrt - - - nitf-c - - - nitf-c - - - nitf-c - - - nitf-c - - - nitf-c - - - nitf-c - - - nitf-c - - - nitf-c - - - nitf-c - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - nitf-c++ - - - - - - - - + + + + + {d6b8959a-344d-4af2-b926-05be973609a4} + + + {a03980e8-d43d-473b-9f2a-a883ddd94df0} + + + {555282a7-bf5d-4012-842a-435bfb7324ab} + + + + + nrt + + + + nrt + + + + nrt + + + nrt + + + nrt + + + nrt + + + nrt + + + nrt + + + nitf-c + + + nitf-c + + + nitf-c + + + nitf-c + + + nitf-c + + + nitf-c + + + nitf-c + + + nitf-c + + + nitf-c + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + nitf-c++ + + + + + + + + \ No newline at end of file diff --git a/externals/nitro/UnitTest/pch.cpp b/externals/nitro/UnitTest/pch.cpp index 91c22df2a1..64b7eef6d6 100644 --- a/externals/nitro/UnitTest/pch.cpp +++ b/externals/nitro/UnitTest/pch.cpp @@ -1,5 +1,5 @@ -// pch.cpp: source file corresponding to the pre-compiled header - -#include "pch.h" - -// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/externals/nitro/UnitTest/pch.h b/externals/nitro/UnitTest/pch.h index 2fa0542e05..37e984a9ed 100644 --- a/externals/nitro/UnitTest/pch.h +++ b/externals/nitro/UnitTest/pch.h @@ -6,47 +6,41 @@ #ifndef PCH_H #define PCH_H -#pragma once + +// add headers that you want to pre-compile here #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #define NOMINMAX #pragma warning(push) #pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. +#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior #include #pragma warning(pop) #pragma comment(lib, "ws2_32") -#pragma warning(disable: 4820) // '...': '...' bytes padding added after data member '...' -#pragma warning(disable: 4710) // '...': function not inlined -#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if / Qspectre switch specified -#pragma warning(disable: 4668) // '...' is not defined as a preprocessor macro, replacing with '...' for '...' -// TODO: get rid of these someday? -#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under -EHc. Undefined behavior may occur if this function throws an exception. -#pragma warning(disable: 4514) // '...': unreferenced inline function has been removed - // We're building in Visual Studio ... used to control where we get a little bit of config info #define NITRO_PCH 1 -#pragma warning(disable: 5032) // detected #pragma warning(push) with no corresponding #pragma warning(pop) -#pragma warning(push) -#pragma warning(disable: 4464) // relative include path contains '..' +#include +#include +#include + #include -#pragma warning(disable: 5031) // #pragma warning(pop): likely mismatch, popping warning state pushed in different file +#pragma comment(lib, "io-c++") #pragma comment(lib, "io-c++") #pragma comment(lib, "except-c++") #pragma comment(lib, "sys-c++") #pragma comment(lib, "str-c++") -#pragma warning(pop) +#pragma comment(lib, "sio.lite-c++.lib") +#pragma comment(lib, "math-c++") +#pragma comment(lib, "mt-c++") -#pragma warning(push) -#include "CppUnitTest.h" -#pragma warning(pop) - -#include -#include -#include +#include +#include +#include +#include +#include -#include "nitf_Test.h" #include "Test.h" #endif //PCH_H diff --git a/externals/nitro/modules/c++/CMakeLists.txt b/externals/nitro/modules/c++/CMakeLists.txt index 4cdefcec61..6b60cd28f5 100644 --- a/externals/nitro/modules/c++/CMakeLists.txt +++ b/externals/nitro/modules/c++/CMakeLists.txt @@ -2,16 +2,12 @@ set(TARGET_LANGUAGE c++) # turn on warnings as errors if (MSVC) - add_compile_options(/std:c++14) - # By default, there is a /W3 on the command-line from somewhere (?); adding # /W4 results in a compiler warning. #add_compile_options(/W4) # /Wall string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") # /Wall elseif (UNIX) - add_compile_options(-std=c++14) - #add_compile_options(-Wall -pedantic -Wextra) add_compile_options(-Wall -Wextra) endif() diff --git a/externals/nitro/modules/c++/nitf-c++.vcxproj b/externals/nitro/modules/c++/nitf-c++.vcxproj index bb2e908281..7d08f71073 100644 --- a/externals/nitro/modules/c++/nitf-c++.vcxproj +++ b/externals/nitro/modules/c++/nitf-c++.vcxproj @@ -1,282 +1,280 @@ - - - - - Debug - x64 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Create - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {f06550ad-cfc7-40b8-8727-6c82c69a8982} - - - - 16.0 - Win32Proj - {8F357A19-799E-4971-850E-3F28485C130B} - nitro - 10.0 - nitf-c++ - - - - StaticLibrary - v143 - - - StaticLibrary - v143 - true - - - - - - - - - - - - - - - true - true - nitf.ruleset - - - false - - - - EnableAllWarnings - true - _DEBUG;%(PreprocessorDefinitions) - true - $(ProjectDir)nitf\include;$(ProjectDir)..\c\nrt\include;$(ProjectDir)..\c\nitf\include;$(ProjectDir)..\c\j2k\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include - Use - pch.h - pch.h - Guard - true - ProgramDatabase - true - true - EnableFastChecks - Disabled - true - AdvancedVectorExtensions2 - true - MultiThreadedDebugDLL - true - - - - - true - $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib\;$(SolutionDir)externals\coda-oss\install-$(Configuration)-$(Platform).$(PlatformToolset)\lib\ - - - $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib\;$(SolutionDir)externals\coda-oss\install-$(Configuration)-$(Platform).$(PlatformToolset)\lib\ - - - - - true - true - true - NDEBUG;%(PreprocessorDefinitions) - true - $(ProjectDir)nitf\include;$(ProjectDir)..\c\nrt\include;$(ProjectDir)..\c\nitf\include;$(ProjectDir)..\c\j2k\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include - Use - pch.h - pch.h - Guard - true - Speed - true - Level3 - AdvancedVectorExtensions2 - true - - - - - true - true - true - $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib\;$(SolutionDir)externals\coda-oss\install-$(Configuration)-$(Platform).$(PlatformToolset)\lib\ - - - $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib\;$(SolutionDir)externals\coda-oss\install-$(Configuration)-$(Platform).$(PlatformToolset)\lib\ - - - - - + + + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {f06550ad-cfc7-40b8-8727-6c82c69a8982} + + + + 16.0 + Win32Proj + {8F357A19-799E-4971-850E-3F28485C130B} + nitro + 10.0 + nitf-c++ + + + + StaticLibrary + v143 + + + StaticLibrary + v143 + true + + + + + + + + + + + + + + + true + nitf.ruleset + + + false + + + + EnableAllWarnings + true + _DEBUG;%(PreprocessorDefinitions) + true + $(ProjectDir)nitf\include;$(ProjectDir)..\c\nrt\include;$(ProjectDir)..\c\nitf\include;$(ProjectDir)..\c\j2k\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include + Use + pch.h + pch.h + Guard + true + ProgramDatabase + true + true + EnableFastChecks + Disabled + true + AdvancedVectorExtensions2 + MultiThreadedDebugDLL + true + + + + + true + $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib\;$(SolutionDir)externals\coda-oss\install-$(Configuration)-$(Platform).$(PlatformToolset)\lib\ + + + $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib\;$(SolutionDir)externals\coda-oss\install-$(Configuration)-$(Platform).$(PlatformToolset)\lib\ + + + + + true + true + true + NDEBUG;%(PreprocessorDefinitions) + true + $(ProjectDir)nitf\include;$(ProjectDir)..\c\nrt\include;$(ProjectDir)..\c\nitf\include;$(ProjectDir)..\c\j2k\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include + Use + pch.h + pch.h + Guard + true + Speed + true + Level3 + AdvancedVectorExtensions2 + true + + + + + true + true + true + $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib\;$(SolutionDir)externals\coda-oss\install-$(Configuration)-$(Platform).$(PlatformToolset)\lib\ + + + $(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib\;$(SolutionDir)externals\coda-oss\install-$(Configuration)-$(Platform).$(PlatformToolset)\lib\ + + + + + \ No newline at end of file diff --git a/externals/nitro/modules/c++/nitf-c++.vcxproj.filters b/externals/nitro/modules/c++/nitf-c++.vcxproj.filters index 2ae0875ada..7f786dc0b8 100644 --- a/externals/nitro/modules/c++/nitf-c++.vcxproj.filters +++ b/externals/nitro/modules/c++/nitf-c++.vcxproj.filters @@ -1,467 +1,467 @@ - - - - - {a27442f1-79dc-4424-a9b5-d80d8b732c8d} - - - {a1304f4a-5908-469f-8f6a-36405be78e35} - - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - + + + + + {a27442f1-79dc-4424-a9b5-d80d8b732c8d} + + + {a1304f4a-5908-469f-8f6a-36405be78e35} + + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + \ No newline at end of file diff --git a/externals/nitro/modules/c++/nitf.ruleset b/externals/nitro/modules/c++/nitf.ruleset index cc9be298a2..b022d96452 100644 --- a/externals/nitro/modules/c++/nitf.ruleset +++ b/externals/nitro/modules/c++/nitf.ruleset @@ -1,32 +1,32 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.cpp b/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.cpp index 91c22df2a1..64b7eef6d6 100644 --- a/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.cpp +++ b/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.cpp @@ -1,5 +1,5 @@ -// pch.cpp: source file corresponding to the pre-compiled header - -#include "pch.h" - -// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.h b/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.h index 8177193aee..9bb7897610 100644 --- a/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.h +++ b/externals/nitro/modules/c++/nitf/apps/show_nitf++/pch.h @@ -1,65 +1,66 @@ -// pch.h: This is a precompiled header file. -// Files listed below are compiled only once, improving build performance for future builds. -// This also affects IntelliSense performance, including code completion and many code browsing features. -// However, files listed here are ALL re-compiled if any one of them is updated between builds. -// Do not add files here that you will be updating frequently as this negates the performance advantage. - -#ifndef PCH_H -#define PCH_H -#pragma once - -// add headers that you want to pre-compile here - -// -// pch.h -// Header for standard system include files. -// -#pragma once - -// We're building in Visual Studio ... used to control where we get a little bit of config info -#define NITRO_PCH 1 - -#pragma warning(disable: 4668) // '...' is not defined as a preprocessor macro, replacing with '...' for '...' -#pragma warning(disable: 4820) // '...': '...' bytes padding added after data member '...' -#pragma warning(disable: 4710) // '...': function not inlined - -#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if / Qspectre switch specified - -#pragma warning(disable: 4625) // '...': copy constructor was implicitly defined as deleted -#pragma warning(disable: 4626) // '...': assignment operator was implicitly defined as deleted -#pragma warning(disable: 5026) // '...': move constructor was implicitly defined as deleted -#pragma warning(disable: 5027) // '...': move assignment operator was implicitly defined as deleted - -// TODO: get rid of these someday? ... from Visual Studio code-analysis -#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under - EHc.Undefined behavior may occur if this function throws an exception. - -#pragma warning(disable: 26495) // Variable '...' is uninitialized. Always initialize a member variable(type.6). -#pragma warning(disable: 26451) // Arithmetic overflow : Using operator '...' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '*' to avoid overflow(io.2). -#pragma warning(disable: 6385) // Reading invalid data from '...': the readable size is '...' bytes, but '...' bytes may be read. -#pragma warning(disable: 6386) // Buffer overrun while writing to '...': the writable size is '...' bytes, but '...' bytes might be written. -#pragma warning(disable: 5219) // implicit conversion from '...' to '...', possible loss of data -#pragma warning(disable: 5204) // '...': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly -#pragma warning(disable: 5220) // '...': a non-static data member with a volatile qualified type no longer implies -#pragma warning(disable: 4355) // '...': used in base member initializer list - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#include -#undef min -#undef max - -#include -#include -#include - -#include -#include - -#pragma comment(lib, "io-c++") -#pragma comment(lib, "except-c++") -#pragma comment(lib, "sys-c++") -#pragma comment(lib, "str-c++") - -#pragma comment(lib, "ws2_32") - - +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#ifndef PCH_H +#define PCH_H +#pragma once + +// add headers that you want to pre-compile here + +// +// pch.h +// Header for standard system include files. +// +#pragma once + +// We're building in Visual Studio ... used to control where we get a little bit of config info +#define NITRO_PCH 1 + +#pragma warning(disable: 4668) // '...' is not defined as a preprocessor macro, replacing with '...' for '...' +#pragma warning(disable: 4820) // '...': '...' bytes padding added after data member '...' +#pragma warning(disable: 4710) // '...': function not inlined + +#pragma warning(disable: 5045) // Compiler will insert Spectre mitigation for memory load if / Qspectre switch specified + +#pragma warning(disable: 4625) // '...': copy constructor was implicitly defined as deleted +#pragma warning(disable: 4626) // '...': assignment operator was implicitly defined as deleted +#pragma warning(disable: 5026) // '...': move constructor was implicitly defined as deleted +#pragma warning(disable: 5027) // '...': move assignment operator was implicitly defined as deleted + +// TODO: get rid of these someday? ... from Visual Studio code-analysis +#pragma warning(disable: 5039) // '...': pointer or reference to potentially throwing function passed to 'extern "C"' function under - EHc.Undefined behavior may occur if this function throws an exception. + +#pragma warning(disable: 26495) // Variable '...' is uninitialized. Always initialize a member variable(type.6). +#pragma warning(disable: 26451) // Arithmetic overflow : Using operator '...' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '*' to avoid overflow(io.2). +#pragma warning(disable: 6385) // Reading invalid data from '...': the readable size is '...' bytes, but '...' bytes may be read. +#pragma warning(disable: 6386) // Buffer overrun while writing to '...': the writable size is '...' bytes, but '...' bytes might be written. +#pragma warning(disable: 5219) // implicit conversion from '...' to '...', possible loss of data +#pragma warning(disable: 5204) // '...': class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed correctly +#pragma warning(disable: 5220) // '...': a non-static data member with a volatile qualified type no longer implies +#pragma warning(disable: 4355) // '...': used in base member initializer list +#pragma warning(disable: 5105) // macro expansion producing '...' has undefined behavior + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#include +#undef min +#undef max + +#include +#include +#include + +#include +#include + +#pragma comment(lib, "io-c++") +#pragma comment(lib, "except-c++") +#pragma comment(lib, "sys-c++") +#pragma comment(lib, "str-c++") + +#pragma comment(lib, "ws2_32") + + #endif //PCH_H \ No newline at end of file diff --git a/externals/nitro/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj b/externals/nitro/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj index 7e93ad84ad..66dcf81bab 100644 --- a/externals/nitro/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj +++ b/externals/nitro/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj @@ -1,123 +1,122 @@ - - - - - Debug - x64 - - - Release - x64 - - - - 16.0 - Win32Proj - {839ff52c-57d1-45b6-81fd-5c7d72523ee5} - Project1 - 10.0 - - - - Application - v143 - - - Application - v143 - true - - - - - - - - - - - - - - - true - - - false - - - - EnableAllWarnings - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c\jpeg\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c\cgm\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include - Use - pch.h - pch.h - Guard - ProgramDatabase - true - true - EnableFastChecks - Disabled - MultiThreadedDebugDLL - true - AdvancedVectorExtensions2 - true - true - - - Console - true - $(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib - - - - - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c\jpeg\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c\cgm\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include - Use - pch.h - pch.h - Speed - true - Guard - true - Level3 - AdvancedVectorExtensions2 - true - - - Console - true - true - true - $(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib - - - - - - Create - Create - pch.h - pch.h - - - - - - - - {8f357a19-799e-4971-850e-3f28485c130b} - - - - - + + + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {839ff52c-57d1-45b6-81fd-5c7d72523ee5} + Project1 + 10.0 + + + + Application + v143 + + + Application + v143 + true + + + + + + + + + + + + + + + true + + + false + + + + EnableAllWarnings + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c\jpeg\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c\cgm\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include + Use + pch.h + pch.h + Guard + ProgramDatabase + true + true + EnableFastChecks + Disabled + MultiThreadedDebugDLL + true + AdvancedVectorExtensions2 + true + + + Console + true + $(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib + + + + + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)modules\c\nrt\include;$(SolutionDir)modules\c\nitf\include;$(SolutionDir)modules\c\jpeg\include;$(SolutionDir)modules\c\j2k\include;$(SolutionDir)modules\c\cgm\include;$(SolutionDir)modules\c;$(SolutionDir)modules\c++;$(SolutionDir)modules\c++\nitf\include;$(SolutionDir)out\install\$(Platform)-$(Configuration)\include;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\include + Use + pch.h + pch.h + Speed + true + Guard + true + Level3 + AdvancedVectorExtensions2 + true + + + Console + true + true + true + $(SolutionDir)out\install\$(Platform)-$(Configuration)\lib;$(SolutionDir)externals\coda-oss\out\install\$(Platform)-$(Configuration)\lib + + + + + + Create + Create + pch.h + pch.h + + + + + + + + {8f357a19-799e-4971-850e-3f28485c130b} + + + + + \ No newline at end of file diff --git a/externals/nitro/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj.filters b/externals/nitro/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj.filters index f227aaad7a..73ae79ed20 100644 --- a/externals/nitro/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj.filters +++ b/externals/nitro/modules/c++/nitf/apps/show_nitf++/show_nitf++.vcxproj.filters @@ -1,30 +1,30 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - Source Files - - - - - Header Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + + + Header Files + + \ No newline at end of file diff --git a/externals/nitro/modules/c++/nitf/include/nitf/Enum.hpp b/externals/nitro/modules/c++/nitf/include/nitf/Enum.hpp index aa6e0c8e3b..4c657eb011 100644 --- a/externals/nitro/modules/c++/nitf/include/nitf/Enum.hpp +++ b/externals/nitro/modules/c++/nitf/include/nitf/Enum.hpp @@ -32,7 +32,7 @@ #include // std::nothrow #include "str/Manip.h" -#include "str/EncodedStringView.h" +#include "str/Encoding.h" namespace nitf { diff --git a/externals/nitro/modules/c++/nitf/include/nitf/NITFBufferList.hpp b/externals/nitro/modules/c++/nitf/include/nitf/NITFBufferList.hpp index e03c6c707f..bec827b1a0 100644 --- a/externals/nitro/modules/c++/nitf/include/nitf/NITFBufferList.hpp +++ b/externals/nitro/modules/c++/nitf/include/nitf/NITFBufferList.hpp @@ -1,181 +1,181 @@ -/* ========================================================================= - * This file is part of NITRO - * ========================================================================= - * - * (C) Copyright 2004 - 2017, MDA Information Systems LLC - * - * NITRO is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, If not, - * see . - * - */ - -#ifndef __NITF_BUFFER_LIST_HPP__ -#define __NITF_BUFFER_LIST_HPP__ -#pragma once - -#include -#include -#include -#include // std::byte - -#include "nitf/coda-oss.hpp" -#include "nitf/System.hpp" -#include "nitf/exports.hpp" - -namespace nitf -{ -/*! - * \class NITFBuffer - * \brief Represents a pointer to raw NITF bytes and its length - */ -struct NITRO_NITFCPP_API NITFBuffer -{ - /*! - * Initializes to an empty buffer - */ - NITFBuffer() = default; - - /*! - * Initializes to the specified pointer and size. No copy is made and - * this object does not take ownership. - * - * \param data The raw bytes of data - * \param numBytes The number of bytes of contiguous data this - * represents - */ - NITFBuffer(const void* data, size_t numBytes) noexcept; - - const void* mData = nullptr; - size_t mNumBytes = 0; - - std::span getBytes() const noexcept - { - return sys::make_span(static_cast(mData), mNumBytes); - } -}; - -/*! - * \class NITFBufferList - * \brief Represents a sequence of buffers which appear in contiguous order - * in the NITF (the underlying pointers are not contiguous) - */ -struct NITRO_NITFCPP_API NITFBufferList -{ - //! The buffers - std::vector mBuffers; - - /*! - * \return The total number of bytes across all the buffers - */ - size_t getTotalNumBytes() const noexcept; - - /*! - * \return Whether or not the buffer list is empty - */ - bool empty() const noexcept - { - return mBuffers.empty(); - } - - /*! - * Clear the buffers - */ - void clear() noexcept - { - mBuffers.clear(); - } - - /*! - * Push data onto the buffer list - * - * \param data The raw bytes - * \param numBytes The number of bytes of data - */ - void pushBack(const void* data, size_t numBytes) - { - mBuffers.push_back(NITFBuffer(data, numBytes)); - } - - /*! - * Push data onto the buffer list - * - * \tparam DataT The type of data - * - * \param data The raw bytes - */ - template - void pushBack(const std::vector& data) - { - pushBack(data.empty() ? nullptr : data.data(), - data.size() * sizeof(DataT)); - } - - /*! - * Get the number of blocks of data of size 'blockSize'. In cases - * where the block size is not an even multiple of the total number of - * bytes, the last block will be larger than the block size (rather - * than there being one more block which is smaller than the block - * size). This is intentional in order to make this easily usable with - * Amazon's S3 storage with multipart uploads where there is a minimum - * part size (there may be multiple machines, all with their portion - * of the SICD, performing a multipart upload of their parts, and - * only the last overall part of the object can be less than the - * minimum part size). - * - * \param blockSize The desired block size - * - * \return The associated number of blocks - */ - size_t getNumBlocks(size_t blockSize) const; - - /*! - * Get the number of bytes in the specified block. All blocks will be - * the same size except for the last block (see getNumBlocks() for - * details). - * - * \param blockSize The desired block size - * \param blockIdx The 0-based block index - * - * \return The number of bytes in this block - */ - size_t getNumBytesInBlock(size_t blockSize, size_t blockIdx) const; - - /*! - * Returns a pointer to contiguous memory associated with the desired - * block. If this block lies entirely within a NITFBuffer, no copy - * is performed. Otherwise, the scratch buffer is resized, the bytes - * are copied into this, and a pointer to the scratch buffer is - * returned. - * - * \param blockSize The desired block size. See getNumBlocks() for a - * description on the behavior of the last block. - * \param blockIdx The 0-based block index - * \param[out] scratch Scratch buffer. This will be resized and used - * if the underlying memory for this block is not contiguous (i.e. it - * spans NITFBuffers). - * \param[out] numBytes The number of bytes in this block - * - * \return A pointer to contiguous memory associated with this block - */ - const void* getBlock(size_t blockSize, - size_t blockIdx, - std::vector& scratch, - size_t& numBytes) const; - const void* getBlock(size_t blockSize, - size_t blockIdx, - std::vector& scratch, - size_t& numBytes) const;}; -} - -#endif +/* ========================================================================= + * This file is part of NITRO + * ========================================================================= + * + * (C) Copyright 2004 - 2017, MDA Information Systems LLC + * + * NITRO is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, If not, + * see . + * + */ + +#ifndef __NITF_BUFFER_LIST_HPP__ +#define __NITF_BUFFER_LIST_HPP__ +#pragma once + +#include +#include +#include +#include // std::byte + +#include "nitf/coda-oss.hpp" +#include "nitf/System.hpp" +#include "nitf/exports.hpp" + +namespace nitf +{ +/*! + * \class NITFBuffer + * \brief Represents a pointer to raw NITF bytes and its length + */ +struct NITRO_NITFCPP_API NITFBuffer +{ + /*! + * Initializes to an empty buffer + */ + NITFBuffer() = default; + + /*! + * Initializes to the specified pointer and size. No copy is made and + * this object does not take ownership. + * + * \param data The raw bytes of data + * \param numBytes The number of bytes of contiguous data this + * represents + */ + NITFBuffer(const void* data, size_t numBytes) noexcept; + + const void* mData = nullptr; + size_t mNumBytes = 0; + + std::span getBytes() const noexcept + { + return sys::make_span(static_cast(mData), mNumBytes); + } +}; + +/*! + * \class NITFBufferList + * \brief Represents a sequence of buffers which appear in contiguous order + * in the NITF (the underlying pointers are not contiguous) + */ +struct NITRO_NITFCPP_API NITFBufferList +{ + //! The buffers + std::vector mBuffers; + + /*! + * \return The total number of bytes across all the buffers + */ + size_t getTotalNumBytes() const noexcept; + + /*! + * \return Whether or not the buffer list is empty + */ + bool empty() const noexcept + { + return mBuffers.empty(); + } + + /*! + * Clear the buffers + */ + void clear() noexcept + { + mBuffers.clear(); + } + + /*! + * Push data onto the buffer list + * + * \param data The raw bytes + * \param numBytes The number of bytes of data + */ + void pushBack(const void* data, size_t numBytes) + { + mBuffers.push_back(NITFBuffer(data, numBytes)); + } + + /*! + * Push data onto the buffer list + * + * \tparam DataT The type of data + * + * \param data The raw bytes + */ + template + void pushBack(const std::vector& data) + { + pushBack(data.empty() ? nullptr : data.data(), + data.size() * sizeof(DataT)); + } + + /*! + * Get the number of blocks of data of size 'blockSize'. In cases + * where the block size is not an even multiple of the total number of + * bytes, the last block will be larger than the block size (rather + * than there being one more block which is smaller than the block + * size). This is intentional in order to make this easily usable with + * Amazon's S3 storage with multipart uploads where there is a minimum + * part size (there may be multiple machines, all with their portion + * of the SICD, performing a multipart upload of their parts, and + * only the last overall part of the object can be less than the + * minimum part size). + * + * \param blockSize The desired block size + * + * \return The associated number of blocks + */ + size_t getNumBlocks(size_t blockSize) const; + + /*! + * Get the number of bytes in the specified block. All blocks will be + * the same size except for the last block (see getNumBlocks() for + * details). + * + * \param blockSize The desired block size + * \param blockIdx The 0-based block index + * + * \return The number of bytes in this block + */ + size_t getNumBytesInBlock(size_t blockSize, size_t blockIdx) const; + + /*! + * Returns a pointer to contiguous memory associated with the desired + * block. If this block lies entirely within a NITFBuffer, no copy + * is performed. Otherwise, the scratch buffer is resized, the bytes + * are copied into this, and a pointer to the scratch buffer is + * returned. + * + * \param blockSize The desired block size. See getNumBlocks() for a + * description on the behavior of the last block. + * \param blockIdx The 0-based block index + * \param[out] scratch Scratch buffer. This will be resized and used + * if the underlying memory for this block is not contiguous (i.e. it + * spans NITFBuffers). + * \param[out] numBytes The number of bytes in this block + * + * \return A pointer to contiguous memory associated with this block + */ + const void* getBlock(size_t blockSize, + size_t blockIdx, + std::vector& scratch, + size_t& numBytes) const; + const void* getBlock(size_t blockSize, + size_t blockIdx, + std::vector& scratch, + size_t& numBytes) const;}; +} + +#endif diff --git a/externals/nitro/modules/c++/nitf/include/nitf/NITFException.hpp b/externals/nitro/modules/c++/nitf/include/nitf/NITFException.hpp index 46b9bac5bf..6c91837d71 100644 --- a/externals/nitro/modules/c++/nitf/include/nitf/NITFException.hpp +++ b/externals/nitro/modules/c++/nitf/include/nitf/NITFException.hpp @@ -20,9 +20,9 @@ * */ +#pragma once #ifndef __NITF_EXCEPTION_HPP__ #define __NITF_EXCEPTION_HPP__ -#pragma once #include @@ -79,7 +79,11 @@ namespace nitf * \class NITFException * \brief The C++ wrapper for the nitf_Error */ -class NITFException /*final*/ : public except::Exception // no "final", SWIG doesn't like it +#ifndef SWIGPYTHON // no "final", SWIG doesn't like it +class NITFException final : public except::Exception +#else +class NITFException : public except::Exception +#endif { static except::Context make_Context_(const Error& error, const std::string& message) { diff --git a/externals/nitro/modules/c++/nitf/include/nitf/Object.hpp b/externals/nitro/modules/c++/nitf/include/nitf/Object.hpp index 3a264b0c42..815943483e 100644 --- a/externals/nitro/modules/c++/nitf/include/nitf/Object.hpp +++ b/externals/nitro/modules/c++/nitf/include/nitf/Object.hpp @@ -20,9 +20,9 @@ * */ +#pragma once #ifndef NITRO_nitf_Object_hpp_INCLUDED_ #define NITRO_nitf_Object_hpp_INCLUDED_ -#pragma once #include @@ -151,7 +151,7 @@ class NITRO_NITFCPP_API Object */ std::string getObjectID() const { - return FmtX("%p", getNative()); + return str::Format("%p", getNative()); } bool isManaged() const noexcept { return isValid() && mHandle->isManaged(); } diff --git a/externals/nitro/modules/c++/nitf/include/nitf/SubWindow.hpp b/externals/nitro/modules/c++/nitf/include/nitf/SubWindow.hpp index 241cf7513e..485d952aa7 100644 --- a/externals/nitro/modules/c++/nitf/include/nitf/SubWindow.hpp +++ b/externals/nitro/modules/c++/nitf/include/nitf/SubWindow.hpp @@ -119,18 +119,7 @@ DECLARE_CLASS(SubWindow) std::optional> bandList; }; -#if CODA_OSS_cpp14 -// This template